Defines |
| #define | MAT_FLAG_IDENTITY 0 |
| #define | MAT_FLAG_GENERAL 0x1 |
| #define | MAT_FLAG_ROTATION 0x2 |
| #define | MAT_FLAG_TRANSLATION 0x4 |
| #define | MAT_FLAG_UNIFORM_SCALE 0x8 |
| #define | MAT_FLAG_GENERAL_SCALE 0x10 |
| #define | MAT_FLAG_GENERAL_3D 0x20 |
| #define | MAT_FLAG_PERSPECTIVE 0x40 |
| #define | MAT_FLAG_SINGULAR 0x80 |
| #define | MAT_DIRTY_TYPE 0x100 |
| #define | MAT_DIRTY_FLAGS 0x200 |
| #define | MAT_DIRTY_INVERSE 0x400 |
| #define | MAT_FLAGS_ANGLE_PRESERVING |
| #define | MAT_FLAGS_GEOMETRY |
| #define | MAT_FLAGS_LENGTH_PRESERVING |
| #define | MAT_FLAGS_3D |
| #define | MAT_DIRTY |
| #define | TEST_MAT_FLAGS(mat, a) ((MAT_FLAGS_GEOMETRY & (~(a)) & ((mat)->flags) ) == 0) |
| #define | MAT(m, r, c) (m)[(c)*4+(r)] |
| #define | M(row, col) m[col*4+row] |
| #define | M(row, col) m[col*4+row] |
| #define | M(row, col) m[col*4+row] |
Functions |
| GLboolean | _math_matrix_is_length_preserving (const GLmatrix *m) |
| GLboolean | _math_matrix_has_rotation (const GLmatrix *m) |
| GLboolean | _math_matrix_is_general_scale (const GLmatrix *m) |
| GLboolean | _math_matrix_is_dirty (const GLmatrix *m) |
|
| static void | print_matrix_floats (const GLfloat m[16]) |
| void | _math_matrix_print (const GLmatrix *m) |
|
| void | _math_matrix_rotate (GLmatrix *mat, GLfloat angle, GLfloat x, GLfloat y, GLfloat z) |
| void | _math_matrix_frustum (GLmatrix *mat, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearval, GLfloat farval) |
| void | _math_matrix_ortho (GLmatrix *mat, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat nearval, GLfloat farval) |
| void | _math_matrix_scale (GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z) |
| void | _math_matrix_translate (GLmatrix *mat, GLfloat x, GLfloat y, GLfloat z) |
| void | _math_matrix_viewport (GLmatrix *m, GLint x, GLint y, GLint width, GLint height, GLfloat zNear, GLfloat zFar, GLfloat depthMax) |
| void | _math_matrix_set_identity (GLmatrix *mat) |
|
| void | _math_matrix_copy (GLmatrix *to, const GLmatrix *from) |
| void | _math_matrix_loadf (GLmatrix *mat, const GLfloat *m) |
| void | _math_matrix_ctr (GLmatrix *m) |
| void | _math_matrix_dtr (GLmatrix *m) |
| void | _math_matrix_alloc_inv (GLmatrix *m) |
|
| void | _math_transposef (GLfloat to[16], const GLfloat from[16]) |
| void | _math_transposed (GLdouble to[16], const GLdouble from[16]) |
| void | _math_transposefd (GLfloat to[16], const GLdouble from[16]) |
Variables |
| static const char * | types [] |
| static GLfloat | Identity [16] |
Matrix multiplication |
| #define | A(row, col) a[(col<<2)+row] |
| #define | B(row, col) b[(col<<2)+row] |
| #define | P(row, col) product[(col<<2)+row] |
| static void | matmul4 (GLfloat *product, const GLfloat *a, const GLfloat *b) |
| static void | matmul34 (GLfloat *product, const GLfloat *a, const GLfloat *b) |
| static void | matrix_multf (GLmatrix *mat, const GLfloat *m, GLuint flags) |
| void | _math_matrix_mul_matrix (GLmatrix *dest, const GLmatrix *a, const GLmatrix *b) |
| void | _math_matrix_mul_floats (GLmatrix *dest, const GLfloat *m) |
Matrix inversion |
| #define | SWAP_ROWS(a, b) { GLfloat *_tmp = a; (a)=(b); (b)=_tmp; } |
| typedef GLboolean(* | inv_mat_func )(GLmatrix *mat) |
| static inv_mat_func | inv_mat_tab [7] |
| static GLboolean | invert_matrix_general (GLmatrix *mat) |
| static GLboolean | invert_matrix_3d_general (GLmatrix *mat) |
| static GLboolean | invert_matrix_3d (GLmatrix *mat) |
| static GLboolean | invert_matrix_identity (GLmatrix *mat) |
| static GLboolean | invert_matrix_3d_no_rot (GLmatrix *mat) |
| static GLboolean | invert_matrix_2d_no_rot (GLmatrix *mat) |
| static GLboolean | matrix_invert (GLmatrix *mat) |
Matrix analysis |
| #define | ZERO(x) (1<<x) |
| #define | ONE(x) (1<<(x+16)) |
| #define | MASK_NO_TRX (ZERO(12) | ZERO(13) | ZERO(14)) |
| #define | MASK_NO_2D_SCALE ( ONE(0) | ONE(5)) |
| #define | MASK_IDENTITY |
| #define | MASK_2D_NO_ROT |
| #define | MASK_2D |
| #define | MASK_3D_NO_ROT |
| #define | MASK_3D |
| #define | MASK_PERSPECTIVE |
| #define | SQ(x) ((x)*(x)) |
| static void | analyse_from_scratch (GLmatrix *mat) |
| static void | analyse_from_flags (GLmatrix *mat) |
| void | _math_matrix_analyse (GLmatrix *mat) |
Matrix operations.
- Note:
- 4x4 transformation matrices are stored in memory in column major order.
- Points/vertices are to be thought of as column vectors.
- Transformation of a point p by a matrix M is: p' = M * p
Definition in file m_matrix.c.