Osiris Framework
0.3
|
Matrix stack class. More...
#include <OsirisSDK/OMatrixStack.h>
Public Member Functions | |
OMatrixStack () | |
Class constructor. | |
virtual | ~OMatrixStack () |
Class destructor. | |
void | push () |
Pushes the current matrix on the stack. | |
void | pop () |
Discards the matrix on top of the stack, and brings up the next one. | |
OMatrix4x4 | top () const |
Retrieves the current (top) matrix. | |
bool | isEmpty () const |
Returns true if the current stack is empty. | |
void | clear () |
Clears the stack and resets top matrix to identity. | |
OMatrixStack & | operator= (const OMatrixStack &in) |
Assignment operator. | |
OMatrixStack & | operator*= (const OMatrixStack &in) |
OMatrixStack & | operator*= (const OMatrix4x4 &in) |
OVector4 | operator* (const OVector4 &in) |
Product of the top matrix by a four-dimentional vector. | |
void | product (const OMatrixStack &in) |
Multiply the top matrix by another stack top matrix. More... | |
void | product (const OMatrix4x4 &in) |
Multiply the top matrix by another matrix. More... | |
void | translate (const OVector3 &dir) |
Applies the translation transformation to a given direction. More... | |
void | translate (const float &dx, const float &dy, const float &dz) |
Applies the translation transform to a given direction. More... | |
void | rotate (const OVector3 &axis, const float &angle) |
Applies the rotation transformation around a given axis. More... | |
void | rotate (const float &axisX, const float &axisY, const float &axisZ, const float &angle) |
Applies the rotation transformation around a given axis. More... | |
void | rotateX (const float &angle) |
Applies the rotation transformation around the X axis. More... | |
void | rotateY (const float &angle) |
Applies the rotation transformation around the Y axis. More... | |
void | rotateZ (const float &angle) |
Applies the rotation transformation around the Z axis. More... | |
void | scale (const OVector3 &factorVec) |
Applies the scale transformation, which re-scales the coordinate system by given factors in each component axis. More... | |
void | scale (const float &uniformFactor) |
Applies the scale transformation by a uniform parameter for all space axes. More... | |
void | perspective (float fieldOfViewDeg, float aspectRatio, float zNear, float zFar) |
Applies the perspective projection transformation. More... | |
void | camera (const OVector3 &position, const OVector3 &direction, const OVector3 &up=OVector3(0, 1, 0)) |
Applies the camera transformation, moving the coordinate system to account for the current camera position and looking direction. More... | |
Matrix stack class.
This class represents a stack of matrices, useful for handling coordinate system transformations on multiple levels. There is a top matrix on the stack, where transformations can be applied. When the need comes to preserve the top matrix, it can be pushed onto the stack, so it can be retrieved at a later time by using the pop() method.
void OMatrixStack::camera | ( | const OVector3 & | position, |
const OVector3 & | direction, | ||
const OVector3 & | up = OVector3(0, 1, 0) |
||
) |
Applies the camera transformation, moving the coordinate system to account for the current camera position and looking direction.
position | Current camera position coordinates. |
direction | Camera looking direction vector. |
up | Vertical reference vector (direction when the camera is facing "up"). |
OMatrixStack & OMatrixStack::operator*= | ( | const OMatrixStack & | in | ) |
OMatrixStack & OMatrixStack::operator*= | ( | const OMatrix4x4 & | in | ) |
void OMatrixStack::perspective | ( | float | fieldOfViewDeg, |
float | aspectRatio, | ||
float | zNear, | ||
float | zFar | ||
) |
Applies the perspective projection transformation.
fieldOfViewDeg | Angle of the camera's field of view in degrees. |
aspectRatio | The aspect ration of the screen (width/height). |
zNear | Nearest camera depth. |
zFar | Farthest camera depth. |
void OMatrixStack::product | ( | const OMatrixStack & | in | ) |
Multiply the top matrix by another stack top matrix.
in | Stack matrix that contains the top matrix that is going to be used in this operation. |
void OMatrixStack::product | ( | const OMatrix4x4 & | in | ) |
Multiply the top matrix by another matrix.
in | Right value matrix in this product. |
void OMatrixStack::rotate | ( | const OVector3 & | axis, |
const float & | angle | ||
) |
Applies the rotation transformation around a given axis.
axis | Rotation axis vector. |
angle | Rotation angle in degrees. |
void OMatrixStack::rotate | ( | const float & | axisX, |
const float & | axisY, | ||
const float & | axisZ, | ||
const float & | angle | ||
) |
Applies the rotation transformation around a given axis.
axisX | Rotation axis vector component on the X axis. |
axisY | Rotation axis vector component on the Y axis. |
axisZ | Rotation axis vector component on the Z axis. |
angle | Rotation angle in degrees. |
void OMatrixStack::rotateX | ( | const float & | angle | ) |
Applies the rotation transformation around the X axis.
angle | Rotation angle in degrees. |
void OMatrixStack::rotateY | ( | const float & | angle | ) |
Applies the rotation transformation around the Y axis.
angle | Rotation angle in degrees. |
void OMatrixStack::rotateZ | ( | const float & | angle | ) |
Applies the rotation transformation around the Z axis.
angle | Rotation angle in degrees. |
void OMatrixStack::scale | ( | const OVector3 & | factorVec | ) |
Applies the scale transformation, which re-scales the coordinate system by given factors in each component axis.
factorVec | Scale factors for each axis component. |
void OMatrixStack::scale | ( | const float & | uniformFactor | ) |
Applies the scale transformation by a uniform parameter for all space axes.
uniformFactor | Scale factor for all space axes. |
void OMatrixStack::translate | ( | const OVector3 & | dir | ) |
Applies the translation transformation to a given direction.
dir | Displacement direction vector. |
void OMatrixStack::translate | ( | const float & | dx, |
const float & | dy, | ||
const float & | dz | ||
) |
Applies the translation transform to a given direction.
dx | Displacement direction on the X axis. |
dy | Displacement direction on the Y axis. |
dz | Displacement direction on the Z axis. |