|
The Vish Visualization Shell 0.3
Vish
|
The Camera object for OpenGL operations in VISH. More...
#include <ocean/shrimp/VCamera.hpp>
Public Member Functions | |
| std::array< double, 16 > | getModelViewMatrix () const |
| Get an OpenGL-compatible model view matrix from the camera parameters, similar to calling glLookAt() . | |
| std::array< double, 16 > | getUntranslatedModelViewMatrix () const |
| Same as untranslatedLookAt() . | |
| void | translate (std::array< double, 16 > &OpenGLMatrix) const |
| Translate a given OpenGL matrix with the camera's observer location. | |
| std::array< double, 16 > | untranslatedLookAt () const |
| void | untranslatedLookAt (double m[16]) const |
| Compute a 3x3 matrix as subset of a 4x4 matrix containing rotations as defined by the current camera settings. | |
| VCamera () | |
| Setup a default camera where the observer is located at (0,1,0), so at the y-axis, looking at the origin (0,0,0) with z-axis as up direction. | |
| VCamera (const point_t &Observer, const point_t &lookat=point_t(0, 0, 0), const bivector_t &UpVector=bivector_t(0, 0, 1), const double viewangle=45.0) | |
| Setup a camera with view parameters. | |
| tvector3 | viewdir () const |
| The view direction. | |
| ~VCamera () | |
| Destructor. | |
Public Attributes | |
| point_t | LookAt |
| The point that is watched. | |
| point_t | Observer |
| Location of the observer. | |
| bivector_t | Up |
| The horizontal plane, a bi-vector, whose dual is the up-direction. | |
| double | ViewAngle |
| Default view angle is 45 degrees, units are degrees. | |
The Camera object for OpenGL operations in VISH.
Its functionality is based on geometric algebra.
| Wizt::VCamera::VCamera | ( | const point_t & | Observer, |
| const point_t & | lookat = point_t(0,0,0), |
||
| const bivector_t & | UpVector = bivector_t(0,0,1), |
||
| const double | viewangle = 45.0 |
||
| ) |
Setup a camera with view parameters.
| viewangle | angle in degree, default is 45.0 |
|
inline |
Get an OpenGL-compatible model view matrix from the camera parameters, similar to calling glLookAt() .
Note that model view matrices are numerically instable for large translations. In general it is better to separate translation and rotation. The rotation matrix can be retrieve via getUntranslatedModelViewMatrix()
This function here will calculate the combined 4x4 matrix (stored in column-major order as 1D array, as required by OpenGL).
Referenced by Wizt::View::computeModelViewMatrix().
| void Wizt::VCamera::translate | ( | std::array< double, 16 > & | OpenGLMatrix | ) | const |
Translate a given OpenGL matrix with the camera's observer location.
The function is intentionally void to emphasize that its argument will be modified by this call.
References Observer.
| std::array< double, 16 > Wizt::VCamera::untranslatedLookAt | ( | ) | const |
Compute a 3x3 matrix as subset of a 4x4
matrix containing rotations as defined by
the current camera settings.
This function is similar to
http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml
but does not include the translation by the
Observer because the translation operation
leads to severe numerical instabilities once
coordinates become very large. If it is an
option to translate object coordinates instead
of the camera during the LookAt() call, then
this is highly preferable. Otherwise, there
needs to be a glTranslate( Observer ) call.
This call is similar to calling gluLookAt
(without translation) in the following manner:
References LookAt, Eagle::norm(), Observer, and Up.
| void Wizt::VCamera::untranslatedLookAt | ( | double | m[16] | ) | const |
Compute a 3x3 matrix as subset of a 4x4 matrix containing rotations as defined by the current camera settings.
This function is similar to http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml but does not include the translation by the Observer because the translation operation leads to severe numerical instabilities once coordinates become very large. If it is an option to translate object coordinates instead of the camera during the LookAt() call, then this is highly preferable. Otherwise, there needs to be a glTranslate( Observer ) call.
References LookAt, Eagle::norm(), Observer, and Up.
Referenced by Wizt::View::computeModelViewMatrix().