Osiris Framework  0.3
OMatrixStack Class Reference

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.
 
OMatrixStackoperator= (const OMatrixStack &in)
 Assignment operator.
 
OMatrixStackoperator*= (const OMatrixStack &in)
 
OMatrixStackoperator*= (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...
 

Detailed Description

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.

Member Function Documentation

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.

Parameters
positionCurrent camera position coordinates.
directionCamera looking direction vector.
upVertical 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.

Parameters
fieldOfViewDegAngle of the camera's field of view in degrees.
aspectRatioThe aspect ration of the screen (width/height).
zNearNearest camera depth.
zFarFarthest camera depth.
void OMatrixStack::product ( const OMatrixStack in)

Multiply the top matrix by another stack top matrix.

Parameters
inStack 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.

Parameters
inRight value matrix in this product.
void OMatrixStack::rotate ( const OVector3 axis,
const float &  angle 
)

Applies the rotation transformation around a given axis.

Parameters
axisRotation axis vector.
angleRotation 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.

Parameters
axisXRotation axis vector component on the X axis.
axisYRotation axis vector component on the Y axis.
axisZRotation axis vector component on the Z axis.
angleRotation angle in degrees.
void OMatrixStack::rotateX ( const float &  angle)

Applies the rotation transformation around the X axis.

Parameters
angleRotation angle in degrees.
void OMatrixStack::rotateY ( const float &  angle)

Applies the rotation transformation around the Y axis.

Parameters
angleRotation angle in degrees.
void OMatrixStack::rotateZ ( const float &  angle)

Applies the rotation transformation around the Z axis.

Parameters
angleRotation 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.

Parameters
factorVecScale factors for each axis component.
void OMatrixStack::scale ( const float &  uniformFactor)

Applies the scale transformation by a uniform parameter for all space axes.

Parameters
uniformFactorScale factor for all space axes.
void OMatrixStack::translate ( const OVector3 dir)

Applies the translation transformation to a given direction.

Parameters
dirDisplacement direction vector.
void OMatrixStack::translate ( const float &  dx,
const float &  dy,
const float &  dz 
)

Applies the translation transform to a given direction.

Parameters
dxDisplacement direction on the X axis.
dyDisplacement direction on the Y axis.
dzDisplacement direction on the Z axis.

The documentation for this class was generated from the following files: