QVR 4.1.0
A library to build Virtual Reality applications
|
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 QVRObserverConfig & | config () 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. | |
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.
QVRObserver::QVRObserver | ( | ) |
Constructor.
QVRObserver::QVRObserver | ( | int | index | ) |
Constructor for the observer with the given index in the QVR configuration.
QVRObserver::~QVRObserver | ( | ) |
Destructor.
const QVRObserverConfig & QVRObserver::config | ( | ) | const |
Returns the configuration.
|
inline |
Returns the eye distance (interpupillary distance).
const QString & QVRObserver::id | ( | ) | const |
Returns the unique id.
int QVRObserver::index | ( | ) | const |
Returns the index of the observer in the QVR configuration.
|
inline |
Returns the navigation position and orientation as a matrix.
|
inline |
Returns the navigation orientation.
|
inline |
Returns the navigation position.
|
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.
|
inline |
Sets the navigation position and orientation.
pos | Navigation position |
rot | Navigation orientation |
This function is called internally by QVR except for custom observers, which may be modified from QVRApp::update().
void QVRObserver::setTracking | ( | const QVector3D & | pos, |
const QQuaternion & | rot ) |
Sets the tracking position and orientation for all three eyes.
pos | Position of the center eye |
rot | Orientation 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().
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.
posLeft | Position of the left eye |
rotLeft | Orientation of the left eye |
posRight | Position of the right eye |
rotRight | Orientation 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().
|
inline |
Returns the tracking position and orientation of eye as a matrix.
|
inline |
Returns the tracking orientation of eye.
|
inline |
Returns the tracking position of eye.
|
friend |
Writes the observer o to the stream ds.
|
friend |
Reads the observer o from the stream ds.