OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AstcTextures::Matrix Class Reference

Functions for manipulating matrices. More...

#include <Matrix.h>

Public Member Functions

floatgetAsArray (void)
 Get the matrix elements as a column major order array. More...
 
 Matrix (void)
 Default constructor. More...
 
floatoperator[] (unsigned element)
 Array operator for accessing the elements of the matrix. More...
 
Matrix operator* (Matrix right)
 Multiply operator to post multiply a matrix by another. More...
 
Matrixoperator= (const Matrix &another)
 Overloading assingment operater to do deep copy of the Matrix elements. More...
 
 Matrix (const float *array)
 Constructor from element array. More...
 
floatgetAsArray (void)
 Get the matrix elements as a column major order array. More...
 
 Matrix (void)
 Default constructor. More...
 
floatoperator[] (unsigned element)
 Array operator for accessing the elements of the matrix. More...
 
Matrix operator* (Matrix right)
 Multiply operator to post multiply a matrix by another. More...
 
Matrixoperator= (const Matrix &another)
 Overloading assingment operater to do deep copy of the Matrix elements. More...
 
 Matrix (const float *array)
 Constructor from element array. More...
 

Static Public Member Functions

static Matrix createRotationX (float angle)
 Create and return a rotation matrix around the x-axis matrix. More...
 
static Matrix createRotationY (float angle)
 Create and return a rotation matrix around the y-axis matrix. More...
 
static Matrix createRotationZ (float angle)
 Create and return a rotation matrix around the z-axis matrix. More...
 
static Matrix matrixOrthographic (float left, float right, float bottom, float top, float zNear, float zFar)
 Create and return an orthographic projection matrix. More...
 
static Matrix matrixPerspective (float FOV, float ratio, float zNear, float zFar)
 Create and return a perspective projection matrix. More...
 
static Matrix createRotationX (float angle)
 Create and return a rotation matrix around the x-axis matrix. More...
 
static Matrix createRotationY (float angle)
 Create and return a rotation matrix around the y-axis matrix. More...
 
static Matrix createRotationZ (float angle)
 Create and return a rotation matrix around the z-axis matrix. More...
 
static Matrix matrixOrthographic (float left, float right, float bottom, float top, float zNear, float zFar)
 Create and return an orthographic projection matrix. More...
 
static Matrix matrixPerspective (float FOV, float ratio, float zNear, float zFar)
 Create and return a perspective projection matrix. More...
 

Static Public Attributes

static Matrix identityMatrix = Matrix(identityArray)
 The identity matrix. More...
 

Static Private Member Functions

static Matrix multiply (Matrix *left, Matrix *right)
 Multiply 2 matrices to return a third. More...
 
static Matrix multiply (Matrix *left, Matrix *right)
 Multiply 2 matrices to return a third. More...
 

Private Attributes

float elements [16]
 A 16 element floating point array used to represent a 4x4 matrix. More...
 

Static Private Attributes

static const float identityArray []
 A 4x4 identity Matrix;. More...
 

Detailed Description

Functions for manipulating matrices.

Definition at line 29 of file Matrix.h.

Constructor & Destructor Documentation

AstcTextures::Matrix::Matrix ( void  )

Default constructor.

Definition at line 49 of file Matrix.cpp.

AstcTextures::Matrix::Matrix ( const float array)

Constructor from element array.

Parameters
[in]arrayA column major order array to use as the matrix elements.

Definition at line 40 of file Matrix.cpp.

AstcTextures::Matrix::Matrix ( void  )

Default constructor.

AstcTextures::Matrix::Matrix ( const float array)

Constructor from element array.

Parameters
[in]arrayA column major order array to use as the matrix elements.

Member Function Documentation

Matrix AstcTextures::Matrix::createRotationX ( float  angle)
static

Create and return a rotation matrix around the x-axis matrix.

Parameters
[in]angleAngle of rotation (in degrees).
Returns
A rotation matrix around the x-axis matrix with the required angle of rotation.

Definition at line 121 of file Matrix.cpp.

static Matrix AstcTextures::Matrix::createRotationX ( float  angle)
static

Create and return a rotation matrix around the x-axis matrix.

Parameters
[in]angleAngle of rotation (in degrees).
Returns
A rotation matrix around the x-axis matrix with the required angle of rotation.
static Matrix AstcTextures::Matrix::createRotationY ( float  angle)
static

Create and return a rotation matrix around the y-axis matrix.

Parameters
[in]angleAngle of rotation (in degrees).
Returns
A rotation matrix around the y-axis matrix with the required angle of rotation.
Matrix AstcTextures::Matrix::createRotationY ( float  angle)
static

Create and return a rotation matrix around the y-axis matrix.

Parameters
[in]angleAngle of rotation (in degrees).
Returns
A rotation matrix around the y-axis matrix with the required angle of rotation.

Definition at line 135 of file Matrix.cpp.

Matrix AstcTextures::Matrix::createRotationZ ( float  angle)
static

Create and return a rotation matrix around the z-axis matrix.

Parameters
[in]angleAngle of rotation (in degrees).
Returns
A rotation matrix around the z-axis matrix with the required angle of rotation.

Definition at line 149 of file Matrix.cpp.

static Matrix AstcTextures::Matrix::createRotationZ ( float  angle)
static

Create and return a rotation matrix around the z-axis matrix.

Parameters
[in]angleAngle of rotation (in degrees).
Returns
A rotation matrix around the z-axis matrix with the required angle of rotation.
float* AstcTextures::Matrix::getAsArray ( void  )

Get the matrix elements as a column major order array.

Returns
A pointer to the matrix elements.
float * AstcTextures::Matrix::getAsArray ( void  )

Get the matrix elements as a column major order array.

Returns
A pointer to the matrix elements.

Definition at line 52 of file Matrix.cpp.

Matrix AstcTextures::Matrix::matrixOrthographic ( float  left,
float  right,
float  bottom,
float  top,
float  zNear,
float  zFar 
)
static

Create and return an orthographic projection matrix.

Assumes Z is positive going away from the user's view (left-hand coordinate system).

Parameters
[in]leftThe coordinate for the left vertical clipping plane.
[in]rightThe coordinate for the right vertical clipping plane.
[in]bottomThe coordinate for the bottom horizontal clipping plane.
[in]topThe coordinate for the top horizontal clipping plane.
[in]zNearThe distance from the camera to the near clipping plane.
[in]zFarthe distance from the camera to the far clipping plane.
Returns
An orthographic projection matrix.

Definition at line 87 of file Matrix.cpp.

static Matrix AstcTextures::Matrix::matrixOrthographic ( float  left,
float  right,
float  bottom,
float  top,
float  zNear,
float  zFar 
)
static

Create and return an orthographic projection matrix.

Assumes Z is positive going away from the user's view (left-hand coordinate system).

Parameters
[in]leftThe coordinate for the left vertical clipping plane.
[in]rightThe coordinate for the right vertical clipping plane.
[in]bottomThe coordinate for the bottom horizontal clipping plane.
[in]topThe coordinate for the top horizontal clipping plane.
[in]zNearThe distance from the camera to the near clipping plane.
[in]zFarthe distance from the camera to the far clipping plane.
Returns
An orthographic projection matrix.
Matrix AstcTextures::Matrix::matrixPerspective ( float  FOV,
float  ratio,
float  zNear,
float  zFar 
)
static

Create and return a perspective projection matrix.

Parameters
[in]FOVThe field of view angle (in degrees) in the y direction.
[in]ratioThe ratio used to calculate the field of view in the x direction. The ratio of x (width) to y (height).
[in]zNearThe distance from the camera to the near clipping plane.
[in]zFarthe distance from the camera to the far clipping plane.
Returns
A perspective projection matrix.

Definition at line 104 of file Matrix.cpp.

static Matrix AstcTextures::Matrix::matrixPerspective ( float  FOV,
float  ratio,
float  zNear,
float  zFar 
)
static

Create and return a perspective projection matrix.

Parameters
[in]FOVThe field of view angle (in degrees) in the y direction.
[in]ratioThe ratio used to calculate the field of view in the x direction. The ratio of x (width) to y (height).
[in]zNearThe distance from the camera to the near clipping plane.
[in]zFarthe distance from the camera to the far clipping plane.
Returns
A perspective projection matrix.
static Matrix AstcTextures::Matrix::multiply ( Matrix left,
Matrix right 
)
staticprivate

Multiply 2 matrices to return a third.

Note
When multiplying matrices the ordering of the parameters affects the result.
Parameters
[in]leftFirst matrix to multiply.
[in]rightSecond matrix to multiply.
Returns
The result of left * right
Matrix AstcTextures::Matrix::multiply ( Matrix left,
Matrix right 
)
staticprivate

Multiply 2 matrices to return a third.

Note
When multiplying matrices the ordering of the parameters affects the result.
Parameters
[in]leftFirst matrix to multiply.
[in]rightSecond matrix to multiply.
Returns
The result of left * right

Definition at line 163 of file Matrix.cpp.

Matrix AstcTextures::Matrix::operator* ( Matrix  right)

Multiply operator to post multiply a matrix by another.

Parameters
[in]rightThe matrix to post multiply by.
Returns
The result of matrix * right.

Definition at line 70 of file Matrix.cpp.

Matrix AstcTextures::Matrix::operator* ( Matrix  right)

Multiply operator to post multiply a matrix by another.

Parameters
[in]rightThe matrix to post multiply by.
Returns
The result of matrix * right.
Matrix & AstcTextures::Matrix::operator= ( const Matrix another)

Overloading assingment operater to do deep copy of the Matrix elements.

Definition at line 76 of file Matrix.cpp.

Matrix& AstcTextures::Matrix::operator= ( const Matrix another)

Overloading assingment operater to do deep copy of the Matrix elements.

float& AstcTextures::Matrix::operator[] ( unsigned  element)

Array operator for accessing the elements of the matrix.

Parameters
[in]elementThe element index of the matrix (accepts 0-15).
Returns
The element of the matrix.
float & AstcTextures::Matrix::operator[] ( unsigned  element)

Array operator for accessing the elements of the matrix.

Parameters
[in]elementThe element index of the matrix (accepts 0-15).
Returns
The element of the matrix.

Definition at line 58 of file Matrix.cpp.

Member Data Documentation

float AstcTextures::Matrix::elements
private

A 16 element floating point array used to represent a 4x4 matrix.

Note
Items are stored in column major order as OpenGL ES expects them.

Definition at line 36 of file Matrix.h.

static const float AstcTextures::Matrix::identityArray
staticprivate
Initial value:
=
{
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
}

A 4x4 identity Matrix;.

Definition at line 51 of file Matrix.h.

static Matrix AstcTextures::Matrix::identityMatrix = Matrix(identityArray)
static

The identity matrix.

A matrix with 1's on the main diagonal and 0's everywhere else.

Definition at line 99 of file Matrix.h.


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