Terminus
|
The Camera class manages view and projection matrices that define a view of a 3D scene. More...
#include <camera.h>
Public Member Functions | |
Camera (const QVector3D &eye=QVector3D(0.0, 0.0, 1.0), const QVector3D ¢er=QVector3D(0.0, 0.0, 0.0), const QVector3D &up=QVector3D(0.0, 1.0, 0.0)) | |
virtual | ~Camera () |
const QVector3D & | eye () const |
void | setEye (const QVector3D &eye) |
const QVector3D & | center () const |
void | setCenter (const QVector3D ¢er) |
const QVector3D & | up () const |
void | setUp (const QVector3D &up) |
QVector3D | normalizedLook () const |
float | zNear () const |
void | setZNear (float zNear) |
float | zFar () const |
void | setZFar (float zFar) |
float | fovy () const |
void | setFovy (float fovy) |
const QPoint & | viewport () const |
void | setViewport (const QPoint &viewport) |
void | setViewport (int width, int height) |
float | aspectRatio () const |
const QMatrix4x4 & | view () const |
const QMatrix4x4 & | projection () const |
const QMatrix4x4 & | viewProjection () const |
const QMatrix4x4 & | viewInverted () const |
const QMatrix4x4 & | projectionInverted () const |
const QMatrix4x4 & | viewProjectionInverted () const |
const QMatrix3x3 & | normal () const |
void | setMatrices (Program &program, const QMatrix4x4 &model) const |
sets the view and projection as well as the given model matrix as uniforms on the given shader program More... | |
void | bindTo (AbstractGraphicsObject *object) |
bind camera to track an AbstractGraphicsObject More... | |
void | unbind () |
release the camera from the object it is currently bound to More... | |
void | unbound (AbstractGraphicsObject *object) |
is called if an object releases this camera More... | |
bool | isBound () const |
void | moveEvent (QVector3D movement) |
called if the GUI requests the camera to be moved More... | |
void | rotateEvent (QVector2D rotation) |
called if the GUI requests the camera to be rotated More... | |
Protected Member Functions | |
void | invalidateMatrices () const |
Protected Attributes | |
QVector3D | m_eye |
QVector3D | m_center |
QVector3D | m_up |
float | m_fovy |
float | m_aspect |
float | m_zNear |
float | m_zFar |
QPoint | m_viewport |
QMatrix4x4 | m_view |
QMatrix4x4 | m_viewInverted |
QMatrix4x4 | m_projection |
QMatrix4x4 | m_projectionInverted |
QMatrix4x4 | m_viewProjection |
QMatrix4x4 | m_viewProjectionInverted |
QMatrix3x3 | m_normal |
bool | m_viewChanged |
bool | m_viewInvertedChanged |
bool | m_projectionChanged |
bool | m_projectionInvertedChanged |
bool | m_viewProjectionChanged |
bool | m_viewProjectionInvertedChanged |
bool | m_normalChanged |
AbstractGraphicsObject * | m_associatedObject |
object that this camera is bound to in order to track it More... | |
The Camera class manages view and projection matrices that define a view of a 3D scene.
It also contains a mechanism that allows it to be bound to AbstractGraphicsObjects in order to track their movement and implements a simple navigation mechanism that is active if it is not bound.
terminus::Camera::Camera | ( | const QVector3D & | eye = QVector3D(0.0, 0.0, 1.0) , |
const QVector3D & | center = QVector3D(0.0, 0.0, 0.0) , |
||
const QVector3D & | up = QVector3D(0.0, 1.0, 0.0) |
||
) |
|
virtual |
float terminus::Camera::aspectRatio | ( | ) | const |
void terminus::Camera::bindTo | ( | AbstractGraphicsObject * | object | ) |
bind camera to track an AbstractGraphicsObject
object | passing a nullptr releases the camera |
const QVector3D & terminus::Camera::center | ( | ) | const |
const QVector3D & terminus::Camera::eye | ( | ) | const |
float terminus::Camera::fovy | ( | ) | const |
|
protected |
bool terminus::Camera::isBound | ( | ) | const |
void terminus::Camera::moveEvent | ( | QVector3D | movement | ) |
called if the GUI requests the camera to be moved
movement | If this camera is bound to an object, this object's moveEvent() method will be called. Otherwise the camera is moved according to a simple navigation mechanism. |
const QMatrix3x3 & terminus::Camera::normal | ( | ) | const |
QVector3D terminus::Camera::normalizedLook | ( | ) | const |
const QMatrix4x4 & terminus::Camera::projection | ( | ) | const |
const QMatrix4x4 & terminus::Camera::projectionInverted | ( | ) | const |
void terminus::Camera::rotateEvent | ( | QVector2D | rotation | ) |
called if the GUI requests the camera to be rotated
rotation | If this camera is bound to an object, this object's rotateEvent() method will be called. Otherwise the camera is rotated according to a simple navigation mechanism. |
void terminus::Camera::setCenter | ( | const QVector3D & | center | ) |
void terminus::Camera::setEye | ( | const QVector3D & | eye | ) |
void terminus::Camera::setFovy | ( | float | fovy | ) |
void terminus::Camera::setMatrices | ( | Program & | program, |
const QMatrix4x4 & | model | ||
) | const |
sets the view and projection as well as the given model matrix as uniforms on the given shader program
program | |
model |
void terminus::Camera::setUp | ( | const QVector3D & | up | ) |
void terminus::Camera::setViewport | ( | const QPoint & | viewport | ) |
void terminus::Camera::setViewport | ( | int | width, |
int | height | ||
) |
void terminus::Camera::setZFar | ( | float | zFar | ) |
void terminus::Camera::setZNear | ( | float | zNear | ) |
void terminus::Camera::unbind | ( | ) |
release the camera from the object it is currently bound to
void terminus::Camera::unbound | ( | AbstractGraphicsObject * | object | ) |
is called if an object releases this camera
object |
const QVector3D & terminus::Camera::up | ( | ) | const |
const QMatrix4x4 & terminus::Camera::view | ( | ) | const |
const QMatrix4x4 & terminus::Camera::viewInverted | ( | ) | const |
const QPoint & terminus::Camera::viewport | ( | ) | const |
const QMatrix4x4 & terminus::Camera::viewProjection | ( | ) | const |
const QMatrix4x4 & terminus::Camera::viewProjectionInverted | ( | ) | const |
float terminus::Camera::zFar | ( | ) | const |
float terminus::Camera::zNear | ( | ) | const |
|
protected |
|
protected |
object that this camera is bound to in order to track it
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
protected |