QVR 4.1.0
A library to build Virtual Reality applications
Loading...
Searching...
No Matches
QVRObserver Class Reference

Observer of the virtual world. More...

#include <observer.hpp>

Public Member Functions

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

Friends

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

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:

  • The pose of the UFO in the virtual world. In QVR, this means an observer can navigate: a navigation transformation matrix will be applied to all the windows he views.
  • The pose of the crew member, or more specifically the crew member's eyes, inside the UFO cockpit. In QVR, this is the tracking of an observer inside a restricted space. This determines the eye transformation matrices, which are relative to the navigation matrix.

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 Symbol 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: