Mali OpenGL ES SDK  2.0.0
A simple framework to aid development of OpenGL ES applications targeting ARM Mali platforms.
 All Classes Files Functions Variables Enumerations Enumerator
Matrix.h
1 /*
2  * This confidential and proprietary software may be used only as
3  * authorised by a licensing agreement from ARM Limited
4  * (C) COPYRIGHT 2012 ARM Limited
5  * ALL RIGHTS RESERVED
6  * The entire notice above must be reproduced on all authorised
7  * copies and copies may only be made to the extent permitted
8  * by a licensing agreement from ARM Limited.
9  */
10 
11 #ifndef MATRIX_H
12 #define MATRIX_H
13 
14 #include "VectorTypes.h"
15 
16 #ifndef M_PI
17 
20 #define M_PI 3.14159265358979323846f
21 #endif /* M_PI */
22 
23 namespace MaliSDK
24 {
28  class Matrix
29  {
30  private:
35  float elements[16];
36 
44  static Matrix multiply(Matrix *left, Matrix *right);
45  public:
50  static float degreesToRadians(float degrees);
51 
56  float* getAsArray(void);
57 
61  Matrix(void);
62 
68  float& operator[] (unsigned element);
69 
75  Matrix operator* (Matrix right);
76 
81  Matrix(const float* array);
82 
89 
96  static Vec4f vertexTransform(Vec4f *vector, Matrix *matrix);
97 
104  static Vec3f vertexTransform(Vec3f *vector, Matrix *matrix);
105 
110  static void matrixTranspose(Matrix *matrix);
111 
112 
118  static Matrix createRotationX(float angle);
119 
125  static Matrix createRotationY(float angle);
126 
132  static Matrix createRotationZ(float angle);
133 
141  static Matrix createTranslation(float x, float y, float z);
142 
150  static Matrix createScaling(float x, float y, float z);
151 
155  void print(void);
156 
166  static Matrix matrixPerspective(float FOV, float ratio, float zNear, float zFar);
167 
180  static Matrix matrixOrthographic(float left, float right, float bottom, float top, float zNear, float zFar);
181 
187  static Matrix matrixInvert(Matrix *matrix);
188 
194  static float matrixDeterminant(float *matrix);
195 
201  static float matrixDeterminant(Matrix *matrix);
202 
209  static Matrix matrixScale(Matrix *matrix, float scale);
210  };
211 }
212 #endif /* MATRIX_H */