Matrix API, only included if you define SRP_INCLUDE_MAT
More...
|
| struct | mat4 |
| |
| typedef struct mat4 | mat4 |
| |
| typedef struct mat4d | mat4d |
| |
| vec4d | mat4dGetColumn (const mat4d *a, uint8_t index) |
| |
| void | mat4dSetColumn (mat4d *a, vec4d column, uint8_t index) |
| |
| vec4d | mat4dMultiplyVec4d (const mat4d *a, vec4d b) |
| |
| mat4d | mat4dMultiplyMat4d (const mat4d *a, const mat4d *b) |
| |
| mat4d | mat4dConstructIdentity () |
| |
| mat4d | mat4dConstructScale (double x, double y, double z) |
| |
| mat4d | mat4dConstructTranslate (double x, double y, double z) |
| |
| mat4d | mat4dConstructRotate (double x, double y, double z) |
| |
| mat4d | mat4dConstructTRS (double transX, double transY, double transZ, double rotataionX, double rotataionY, double rotataionZ, double scaleX, double scaleY, double scaleZ) |
| |
| mat4d | mat4dConstructView (double cameraX, double cameraY, double cameraZ, double rotataionX, double rotataionY, double rotataionZ, double scaleX, double scaleY, double scaleZ) |
| |
| mat4d | mat4dConstructOrthogonalProjection (double x_min, double x_max, double y_min, double y_max, double z_min, double z_max) |
| |
| mat4d | mat4dConstructPerspectiveProjection (double x_min_near, double x_max_near, double y_min_near, double y_max_near, double z_near, double z_far) |
| |
Matrix API, only included if you define SRP_INCLUDE_MAT
◆ mat4
Represents a 4x4 matrix of floats, stores data in row-major order
◆ mat4d
Represents a 4x4 matrix of doubles, stores data in row-major order
◆ mat4dConstructIdentity()
| mat4d mat4dConstructIdentity |
( |
| ) |
|
Construct a 4x4 identity matrix
- Returns
- 4x4 identity matrix
◆ mat4dConstructOrthogonalProjection()
| mat4d mat4dConstructOrthogonalProjection |
( |
double |
x_min, |
|
|
double |
x_max, |
|
|
double |
y_min, |
|
|
double |
y_max, |
|
|
double |
z_min, |
|
|
double |
z_max |
|
) |
| |
Construct a 4x4 orthogonal projection matrix. The orthogonal projection matrix transforms arbitrary rectangular parallelepiped (defined by 2 points: "min" and "max" ones) into an NDC cube, so it can be drawn in screen space
- Parameters
-
| x_min,y_min,z_min | Coordinates of the "min" point defining a rectangular parallelepiped |
| x_max,y_max,z_max | Coordinates of the "max" point defining a rectangular parallelepiped |
- Returns
- Orthogonal projection matrix
◆ mat4dConstructPerspectiveProjection()
| mat4d mat4dConstructPerspectiveProjection |
( |
double |
x_min_near, |
|
|
double |
x_max_near, |
|
|
double |
y_min_near, |
|
|
double |
y_max_near, |
|
|
double |
z_near, |
|
|
double |
z_far |
|
) |
| |
Construct a 4x4 perspective projection matrix. The perspective projection matrix transforms the perspective frustum (defined by the distance to near and far planes and by "min" and "max" points on the near plane) to a unit cube, so it can be drawn in screen space
- Parameters
-
| x_min_near,x_max_near | Minimum and maximum X values on the near plane |
| y_min_near,y_max_near | Minimum and maximum Y on the near plane |
| z_near,z_far | Distance to the near and far planes |
- Returns
- Perspective projection matrix
- Todo:
- Avoid matmul here?
◆ mat4dConstructRotate()
| mat4d mat4dConstructRotate |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
z |
|
) |
| |
Construct a 4x4 matrix that rotates the points
- Parameters
-
| x,y,z | Angle (in radians) by which the points are rotated around X, Y, Z axis respectively |
- Returns
- Rotation matrix
◆ mat4dConstructScale()
| mat4d mat4dConstructScale |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
z |
|
) |
| |
Construct a 4x4 matrix that scales the X, Y and Z dimensions
- Parameters
-
| x,y,z | Scaling coefficients for X, Y, Z dimensions respectively |
- Returns
- Scale matrix
◆ mat4dConstructTranslate()
| mat4d mat4dConstructTranslate |
( |
double |
x, |
|
|
double |
y, |
|
|
double |
z |
|
) |
| |
Construct a 4x4 matrix that translates the points
- Parameters
-
| x,y,z | Translating coefficient for X, Y, Z dimensions respectively |
- Returns
- Translation matrix
◆ mat4dConstructTRS()
| mat4d mat4dConstructTRS |
( |
double |
transX, |
|
|
double |
transY, |
|
|
double |
transZ, |
|
|
double |
rotataionX, |
|
|
double |
rotataionY, |
|
|
double |
rotataionZ, |
|
|
double |
scaleX, |
|
|
double |
scaleY, |
|
|
double |
scaleZ |
|
) |
| |
◆ mat4dConstructView()
| mat4d mat4dConstructView |
( |
double |
cameraX, |
|
|
double |
cameraY, |
|
|
double |
cameraZ, |
|
|
double |
rotataionX, |
|
|
double |
rotataionY, |
|
|
double |
rotataionZ, |
|
|
double |
scaleX, |
|
|
double |
scaleY, |
|
|
double |
scaleZ |
|
) |
| |
Construct a 4x4 view matrix
- Parameters
-
| cameraX,cameraY,cameraZ | Camera position |
| rotationX,rotationY,rotationZ | Camera rotation along each dimension |
| scaleX,scaleY,scaleZ | Camera "zoom" along each dimension |
- Returns
- View matrix
◆ mat4dGetColumn()
| vec4d mat4dGetColumn |
( |
const mat4d * |
a, |
|
|
uint8_t |
index |
|
) |
| |
Get the indexth column of the matrix A
- Parameters
-
| a | Pointer to a matrix A |
| index | Index of a column to get |
- Returns
- indexth column of the matrix A
◆ mat4dMultiplyMat4d()
Multiply two 4x4 matrices
- Parameters
-
| a | Pointer to a matrix A |
| b | Pointer to a matrix B |
- Returns
- The product A*B
◆ mat4dMultiplyVec4d()
Multiply mat4d by vec4d
- Parameters
-
| a | Pointer to a matrix A |
| b | Vector B |
- Returns
- The product A*B
◆ mat4dSetColumn()
| void mat4dSetColumn |
( |
mat4d * |
a, |
|
|
vec4d |
column, |
|
|
uint8_t |
index |
|
) |
| |
Set the indexth column of the *a matrix to column
- Parameters
-
| a | Pointer to a matrix |
| column | A new column |
| index | Index of a column to modify |