#include <CMacrosGL.h>
Public Member Functions | |
cMatrixGL () | |
const double * | pMatrix () const |
void | set (const cVector3d &a_pos) |
cVector3d | getPos () const |
cMatrix3d | getRot () const |
void | set (const cMatrix3d &a_rot) |
void | set (const cVector3d &a_pos, const cMatrix3d &a_rot) |
void | copyto (cMatrixGL &a_destination) const |
void | copyfrom (const cMatrixGL &a_source) |
void | identity () |
void | mul (const cMatrixGL &a_matrix) |
void | mulr (const cMatrix3d &a_matrix, cMatrix3d &a_result) const |
void | trans () |
void | transr (cMatrixGL &a_result) const |
void | buildFrustumMatrix (double l, double r, double b, double t, double n, double f) |
bool | invert () |
void | buildPerspectiveMatrix (double fovy, double aspect, double zNear, double zFar) |
void | buildLookAtMatrix (double eyex, double eyey, double eyez, double centerx, double centery, double centerz, double upx, double upy, double upz) |
void | buildLookAtMatrix (cVector3d &a_eye, cVector3d &a_lookAt, cVector3d a_up) |
void | glMatrixPush () |
void | glMatrixLoad () |
void | glMatrixMultiply () |
void | glMatrixPushMultiply () |
void | glMatrixPop () |
void | str (std::string &a_string, int a_precision) |
cMatrixGL also provides OpenGL calls to push, multiply and pop matrices off the OpenGL stack.
Note that OpenGL Matrices are COLUMN major, but CHAI matrices (and all other matrices in the universe) are ROW major.
cMatrixGL::cMatrixGL | ( | ) | [inline] |
Default constructor of cMatrixGL.
void cMatrixGL::buildFrustumMatrix | ( | double | l, | |
double | r, | |||
double | b, | |||
double | t, | |||
double | n, | |||
double | f | |||
) | [inline] |
Create a frustum matrix, as defined by the glFrustum function.
void cMatrixGL::buildLookAtMatrix | ( | cVector3d & | a_eye, | |
cVector3d & | a_lookAt, | |||
cVector3d | a_up | |||
) | [inline] |
Build a 4x4 matrix transform, according to the gluLookAt function.
void cMatrixGL::buildLookAtMatrix | ( | double | eyex, | |
double | eyey, | |||
double | eyez, | |||
double | centerx, | |||
double | centery, | |||
double | centerz, | |||
double | upx, | |||
double | upy, | |||
double | upz | |||
) | [inline] |
Build a 4x4 matrix transform, according to the gluLookAt function.
void cMatrixGL::buildPerspectiveMatrix | ( | double | fovy, | |
double | aspect, | |||
double | zNear, | |||
double | zFar | |||
) | [inline] |
Build a perspective matrix, according to the gluPerspective function.
void cMatrixGL::copyfrom | ( | const cMatrixGL & | a_source | ) | [inline] |
Copy values from an external matrix passed as parameter to this matrix.
a_source | Source matrix. |
void cMatrixGL::copyto | ( | cMatrixGL & | a_destination | ) | const [inline] |
Copy the current matrix to an external matrix passed as a parameter.
a_destination | Destination matrix. |
cVector3d cMatrixGL::getPos | ( | ) | const [inline] |
Extract the translational component of this matrix.
cMatrix3d cMatrixGL::getRot | ( | ) | const [inline] |
Extract the rotational component of this matrix.
void cMatrixGL::glMatrixLoad | ( | ) | [inline] |
Load the current OpenGL matrix with this cMatrixGL matrix.
void cMatrixGL::glMatrixMultiply | ( | ) | [inline] |
Multiply the current OpenGL matrix with this cMatrixGL matrix.
void cMatrixGL::glMatrixPop | ( | ) | [inline] |
Pop current OpenGL matrix off the stack.
void cMatrixGL::glMatrixPush | ( | ) | [inline] |
Push the current OpenGL matrix stack.
void cMatrixGL::glMatrixPushMultiply | ( | ) | [inline] |
Push the current OpenGL matrix stack and multiply with this cMatrixGL matrix.
void cMatrixGL::identity | ( | ) | [inline] |
Set this matrix to be equal to the identity matrix.
bool cMatrixGL::invert | ( | ) | [inline] |
Invert this matrix.
void cMatrixGL::mul | ( | const cMatrixGL & | a_matrix | ) | [inline] |
Left-multiply the current matrix by an external matrix passed as a parameter. That is, compute:
this = a_matrix * this
Remember that all matrices are column-major. That's why the following code looks like right-multiplication...
a_matrix | Matrix with which multiplication is performed. |
Left-multiply the current matrix by an external matrix passed as a parameter, storing the result externally. That is, compute:
a_result = a_matrix * this;
Remember that all matrices are column-major. That's why the following code looks like right-multiplication...
a_matrix | Matrix with which multiplication is performed. | |
a_result | Matrix where the result is stored. |
const double* cMatrixGL::pMatrix | ( | ) | const [inline] |
Returns a pointer to the matrix array in memory.
Create an OpenGL translation matrix from a 3-vector and a 3x3 matrix passed as a parameter.
a_pos | Translational component of the transformation. | |
a_rot | Rotational component of the transformation. |
void cMatrixGL::set | ( | const cMatrix3d & | a_rot | ) | [inline] |
Create an OpenGL rotation matrix from a 3x3 rotation matrix passed as a parameter.
a_rot | The source rotation matrix. |
void cMatrixGL::set | ( | const cVector3d & | a_pos | ) | [inline] |
Creates OpenGL translation matrix from a position vector passed as parameter.
a_pos | Input vector. |
void cMatrixGL::str | ( | std::string & | a_string, | |
int | a_precision | |||
) | [inline] |
Convert the current matrix into an std::string.
a_string | String where conversion is stored | |
a_precision | Number of digits |
void cMatrixGL::trans | ( | ) | [inline] |
Transpose this matrix.
void cMatrixGL::transr | ( | cMatrixGL & | a_result | ) | const [inline] |
Transpose this matrix and store the result in a_result.
a_result | Result is stored here. |