QVR 4.0.1
A library to build Virtual Reality applications
Public Member Functions | Friends | List of all members
QVRObserver Class Reference

Observer of the virtual world. More...

#include <observer.hpp>

Public Member Functions

 QVRObserver ()
 Constructor. More...
 
 QVRObserver (int index)
 Constructor for the observer with the given index in the QVR configuration. More...
 
 ~QVRObserver ()
 Destructor. More...
 
int index () const
 Returns the index of the observer in the QVR configuration. More...
 
const QString & id () const
 Returns the unique id. More...
 
const QVRObserverConfigconfig () const
 Returns the configuration. More...
 
const QVector3D & navigationPosition () const
 Returns the navigation position. More...
 
const QQuaternion & navigationOrientation () const
 Returns the navigation orientation. More...
 
QMatrix4x4 navigationMatrix () const
 Returns the navigation position and orientation as a matrix. More...
 
float eyeDistance () const
 Returns the eye distance (interpupillary distance). More...
 
const QVector3D & trackingPosition (QVREye eye=QVR_Eye_Center) const
 Returns the tracking position of eye. More...
 
const QQuaternion & trackingOrientation (QVREye eye=QVR_Eye_Center) const
 Returns the tracking orientation of eye. More...
 
QMatrix4x4 trackingMatrix (QVREye eye=QVR_Eye_Center) const
 Returns the tracking position and orientation of eye as a matrix. More...
 
void setNavigation (const QVector3D &pos, const QQuaternion &rot)
 Sets the navigation position and orientation. More...
 
void setEyeDistance (float d)
 Sets the eye distance (interpupillary distance) to d. More...
 
void setTracking (const QVector3D &pos, const QQuaternion &rot)
 Sets the tracking position and orientation for all three eyes. More...
 
void setTracking (const QVector3D &posLeft, const QQuaternion &rotLeft, const QVector3D &posRight, const QQuaternion &rotRight)
 Sets the tracking position and orientation for all three eyes. More...
 

Friends

QDataStream & operator<< (QDataStream &ds, const QVRObserver &o)
 Writes the observer o to the stream ds. More...
 
QDataStream & operator>> (QDataStream &ds, QVRObserver &o)
 Reads the observer o from the stream ds. More...
 

Detailed Description

Observer of the virtual world.

Imagine your Virtual Reality setup is the cockpit of an UFO flying through the virtual world. Inside the cockpit is a UFO crew member. This crew member looks through the cockpit windows onto the virtual world. In QVR, this means one or more windows (QVRWindow) are viewed by a QVRObserver.

What a crew member will see in the cockpit windows depends on two things:

An observer typically has two eyes (left and right). This class additionally handles an imaginary third eye at the center between left and right eye. Each eye has a pose in the virtual world relative to the navigation pose. All poses are represented as transformation matrices.

A QVRWindow provides a view of the virtual world for exactly one observer. An observer can view multiple windows, e.g. in multi-projector setups.

An observer is configured via QVRObserverConfig.

Constructor & Destructor Documentation

◆ QVRObserver() [1/2]

QVRObserver::QVRObserver ( )

Constructor.

◆ QVRObserver() [2/2]

QVRObserver::QVRObserver ( int  index)

Constructor for the observer with the given index in the QVR configuration.

◆ ~QVRObserver()

QVRObserver::~QVRObserver ( )

Destructor.

Member Function Documentation

◆ config()

const QVRObserverConfig & QVRObserver::config ( ) const

Returns the configuration.

◆ eyeDistance()

float QVRObserver::eyeDistance ( ) const
inline

Returns the eye distance (interpupillary distance).

◆ id()

const QString & QVRObserver::id ( ) const

Returns the unique id.

◆ index()

int QVRObserver::index ( ) const

Returns the index of the observer in the QVR configuration.

◆ navigationMatrix()

QMatrix4x4 QVRObserver::navigationMatrix ( ) const
inline

Returns the navigation position and orientation as a matrix.

◆ navigationOrientation()

const QQuaternion & QVRObserver::navigationOrientation ( ) const
inline

Returns the navigation orientation.

◆ navigationPosition()

const QVector3D & QVRObserver::navigationPosition ( ) const
inline

Returns the navigation position.

◆ setEyeDistance()

void QVRObserver::setEyeDistance ( float  d)
inline

Sets the eye distance (interpupillary distance) to d.

Note that this only takes effect once setTracking() with arguments for the center eye is called.

A call to setTracking() with arguments for left and right eye will set a new value for the eye distance.

◆ setNavigation()

void QVRObserver::setNavigation ( const QVector3D &  pos,
const QQuaternion &  rot 
)
inline

Sets the navigation position and orientation.

Parameters
posNavigation position
rotNavigation orientation

This function is called internally by QVR except for custom observers, which may be modified from QVRApp::update().

◆ setTracking() [1/2]

void QVRObserver::setTracking ( const QVector3D &  pos,
const QQuaternion &  rot 
)

Sets the tracking position and orientation for all three eyes.

Parameters
posPosition of the center eye
rotOrientation of the center eye

The position and orientation for the left and right eye are computed using eyeDistance().

This function is called internally by QVR except for custom observers, which may be modified from QVRApp::update().

◆ setTracking() [2/2]

void QVRObserver::setTracking ( const QVector3D &  posLeft,
const QQuaternion &  rotLeft,
const QVector3D &  posRight,
const QQuaternion &  rotRight 
)

Sets the tracking position and orientation for all three eyes.

Parameters
posLeftPosition of the left eye
rotLeftOrientation of the left eye
posRightPosition of the right eye
rotRightOrientation of the right eye

The position and orientation for the center eye and the eye distance is computed from the information for the left and right eyes.

This function is called internally by QVR except for custom observers, which may be modified from QVRApp::update().

◆ trackingMatrix()

QMatrix4x4 QVRObserver::trackingMatrix ( QVREye  eye = QVR_Eye_Center) const
inline

Returns the tracking position and orientation of eye as a matrix.

◆ trackingOrientation()

const QQuaternion & QVRObserver::trackingOrientation ( QVREye  eye = QVR_Eye_Center) const
inline

Returns the tracking orientation of eye.

◆ trackingPosition()

const QVector3D & QVRObserver::trackingPosition ( QVREye  eye = QVR_Eye_Center) const
inline

Returns the tracking position of eye.

Friends And Related Function Documentation

◆ operator<<

QDataStream & operator<< ( QDataStream &  ds,
const QVRObserver o 
)
friend

Writes the observer o to the stream ds.

◆ operator>>

QDataStream & operator>> ( QDataStream &  ds,
QVRObserver o 
)
friend

Reads the observer o from the stream ds.


The documentation for this class was generated from the following file: