![]() |
Mali OpenGL ES SDK
2.0.0
A simple framework to aid development of OpenGL ES applications targeting ARM Mali platforms.
|
Functions for manipulating matrices. More...
#include <Matrix.h>
Public Member Functions | |
float * | getAsArray (void) |
Get the matrix elements as a column major order array. | |
Matrix (void) | |
Default constructor. | |
float & | operator[] (unsigned element) |
Array operator for accessing the elements of the matrix. | |
Matrix | operator* (Matrix right) |
Multiply operator to post multiply a matrix by another. | |
Matrix (const float *array) | |
Constructor from element array. | |
void | print (void) |
Print the matrix. |
Static Public Member Functions | |
static float | degreesToRadians (float degrees) |
Convert an angle in degrees to radians. | |
static Vec4f | vertexTransform (Vec4f *vector, Matrix *matrix) |
Transform a 4D vertex by a matrix. | |
static Vec3f | vertexTransform (Vec3f *vector, Matrix *matrix) |
Transform a 3D vertex by a matrix. | |
static void | matrixTranspose (Matrix *matrix) |
Transpose a matrix in-place. | |
static Matrix | createRotationX (float angle) |
Create and return a rotation matrix around the x-axis matrix. | |
static Matrix | createRotationY (float angle) |
Create and return a rotation matrix around the y-axis matrix. | |
static Matrix | createRotationZ (float angle) |
Create and return a rotation matrix around the z-axis matrix. | |
static Matrix | createTranslation (float x, float y, float z) |
Create and return a translation matrix. | |
static Matrix | createScaling (float x, float y, float z) |
Create and return a scaling matrix. | |
static Matrix | matrixPerspective (float FOV, float ratio, float zNear, float zFar) |
Create and return a perspective projection matrix. | |
static Matrix | matrixOrthographic (float left, float right, float bottom, float top, float zNear, float zFar) |
Create and return an orthographic projection matrix. | |
static Matrix | matrixInvert (Matrix *matrix) |
Get the inverse of a matrix. | |
static float | matrixDeterminant (float *matrix) |
Calculate determinant of supplied 3x3 matrix. | |
static float | matrixDeterminant (Matrix *matrix) |
Calculate determinant of supplied 4x4 matrix. | |
static Matrix | matrixScale (Matrix *matrix, float scale) |
Scale each element in a matrix by a constant. |
Static Public Attributes | |
static Matrix | identityMatrix = Matrix(identityArray) |
The identity matrix. |
Static Private Member Functions | |
static Matrix | multiply (Matrix *left, Matrix *right) |
Multiply 2 matrices to return a third. |
Private Attributes | |
float | elements [16] |
A 16 element floating point array used to represent a 4x4 matrix. |
Functions for manipulating matrices.
MaliSDK::Matrix::Matrix | ( | const float * | array | ) |
Constructor from element array.
[in] | array | A column major order array to use as the matrix elements. |
|
static |
Create and return a rotation matrix around the x-axis matrix.
[in] | angle | Angle of rotation (in degrees). |
|
static |
Create and return a rotation matrix around the y-axis matrix.
[in] | angle | Angle of rotation (in degrees). |
|
static |
Create and return a rotation matrix around the z-axis matrix.
[in] | angle | Angle of rotation (in degrees). |
|
static |
Create and return a scaling matrix.
[in] | x | Scale factor in the x-axis. |
[in] | y | Scale factor in the y-axis. |
[in] | z | Scale factor in the z-axis. |
|
static |
Create and return a translation matrix.
[in] | x | Distance to translate in the x-axis. |
[in] | y | Distance to translate in the y-axis. |
[in] | z | Distance to translate in the z-axis. |
|
static |
Convert an angle in degrees to radians.
[in] | degrees | The angle (in degrees) to convert to radians. |
float * MaliSDK::Matrix::getAsArray | ( | void | ) |
Get the matrix elements as a column major order array.
|
static |
Calculate determinant of supplied 3x3 matrix.
[in] | matrix | The matrix to calculate the determinant of (supplied as a 9 element float array in column major order). |
|
static |
Calculate determinant of supplied 4x4 matrix.
[in] | matrix | The matrix to calculate the determinant of. |
Get the inverse of a matrix.
[in] | matrix | The matrix to invert. |
|
static |
Create and return an orthographic projection matrix.
Assumes Z is positive going away from the user's view (left-hand coordinate system).
[in] | left | The coordinate for the left vertical clipping plane. |
[in] | right | The coordinate for the right vertical clipping plane. |
[in] | bottom | The coordinate for the bottom horizontal clipping plane. |
[in] | top | The coordinate for the top horizontal clipping plane. |
[in] | zNear | The distance from the camera to the near clipping plane. |
[in] | zFar | the distance from the camera to the far clipping plane. |
|
static |
Create and return a perspective projection matrix.
[in] | FOV | The field of view angle (in degrees) in the y direction. |
[in] | ratio | The ratio used to calculate the field of view in the x direction. The ratio of x (width) to y (height). |
[in] | zNear | The distance from the camera to the near clipping plane. |
[in] | zFar | the distance from the camera to the far clipping plane. |
Scale each element in a matrix by a constant.
[in] | matrix | The matrix to scale. |
[in] | scale | The scale factor |
|
static |
Transpose a matrix in-place.
[in,out] | matrix | The matrix to transpose. |
Multiply 2 matrices to return a third.
[in] | left | First matrix to multiply. |
[in] | right | Second matrix to multiply. |
Multiply operator to post multiply a matrix by another.
[in] | right | The matrix to post multiply by. |
float & MaliSDK::Matrix::operator[] | ( | unsigned | element | ) |
Array operator for accessing the elements of the matrix.
[in] | element | The element index of the matrix (accepts 0-15). |
Transform a 4D vertex by a matrix.
[in] | vector | The 4D vector to be transformed. |
[in] | matrix | The transformation matrix. |
Transform a 3D vertex by a matrix.
[in] | vector | The 3D vector to be transformed. |
[in] | matrix | The transformation matrix. |
|
private |
A 16 element floating point array used to represent a 4x4 matrix.
The identity matrix.
A matrix with 1's on the main diagonal and 0's everywhere else.