The Socrates Gameboy Advance Development Engine
The SGADE is a development library for the Nintendo Gameboy
Advance. It's free for all uses and is distributed without guarantees.
For more information visit
the SGADE page.
Files | |
| file | SoMatrix.c |
| file | SoMatrix.h |
Data Structures | |
| struct | SoMatrix |
| Matrix definition. More... | |
Functions | |
| void | SoMatrixMakeIdentity (SoMatrix *a_This) |
| Makes the given matrix an identity matrix. | |
| void | SoMatrixMakeRotationX (SoMatrix *a_This, s32 a_Angle) |
| Makes the given matrix an rotational matrix around the X-axis. | |
| void | SoMatrixMakeRotationY (SoMatrix *a_This, s32 a_Angle) |
| Makes the given matrix an rotational matrix around the Y-axis. | |
| void | SoMatrixMakeRotationZ (SoMatrix *a_This, s32 a_Angle) |
| Makes the given matrix an rotational matrix around the Z-axis. | |
| void | SoMatrixSetTranslation (SoMatrix *a_This, sofixedpoint a_X, sofixedpoint a_Y, sofixedpoint a_Z) |
| Sets the translational part of the matrix. | |
| void | SoMatrixScale (SoMatrix *a_This, sofixedpoint a_ScaleX, sofixedpoint a_ScaleY, sofixedpoint a_ScaleZ) |
| Non-uniformly scales the matrix. | |
| void | SoMatrixMultiplyBy (SoMatrix *a_This, SoMatrix *a_Matrix) |
| Multiplies the matrix by another matrix. | |
| void | SoMatrixMultiply (SoMatrix *a_This, SoMatrix *a_A, SoMatrix *a_B) |
| Multiplies two matrices, placing the result into this. | |
| void | SoMatrixMode4DebugDraw (SoMatrix *a_This) |
| Prints the matrix elements on the screen for debugging purposes. Only works in mode 4. | |
This module contains the matrix definition and all its methods.
To save memory we use a 3 row, 4 column matrix system. The missing 4th row is assumed to contain [0, 0, 0, 1]. This works because we only support homogeneous transforms (rotations, translations and uniform scales).
All cells in a matrix are in fixed point format.
Note that you rarely need to work with matrices. You should use the SoTransform structure instead, because it is better in dealing with accumulating precision problems. Even in the best case, if you multiply two orthogonal matrices a few hundred times, you can be sure they won't be orthogonal anymore. This is even worse with a fixed-point number system as the errors crop up much faster.
|
|
Makes the given matrix an identity matrix.
|
|
||||||||||||
|
Makes the given matrix an rotational matrix around the X-axis.
|
|
||||||||||||
|
Makes the given matrix an rotational matrix around the Y-axis.
|
|
||||||||||||
|
Makes the given matrix an rotational matrix around the Z-axis.
|
|
|
Prints the matrix elements on the screen for debugging purposes. Only works in mode 4.
|
|
||||||||||||||||
|
Multiplies two matrices, placing the result into this.
|
|
||||||||||||
|
Multiplies the matrix by another matrix.
|
|
||||||||||||||||||||
|
Non-uniformly scales the matrix.
|
|
||||||||||||||||||||
|
Sets the translational part of the matrix.
|