Vector & Matrix API, only included if you define SRP_INCLUDE_VECTOR or SRP_INCLUDE_MAT
More...
|
| struct | mat4 |
| |
| struct | vec2 |
| |
| typedef struct mat4 | mat4 |
| |
| vec4 | mat4MultiplyVec4 (const mat4 *restrict a, vec4 b) |
| |
| mat4 | mat4MultiplyMat4 (const mat4 *restrict a, const mat4 *restrict b) |
| |
| mat4 | mat4ConstructIdentity () |
| |
| mat4 | mat4ConstructScale (float x, float y, float z) |
| |
| mat4 | mat4ConstructTranslate (float x, float y, float z) |
| |
| mat4 | mat4ConstructRotate (float x, float y, float z) |
| |
| mat4 | mat4ConstructTRS (float transX, float transY, float transZ, float rotataionX, float rotataionY, float rotataionZ, float scaleX, float scaleY, float scaleZ) |
| |
| mat4 | mat4ConstructView (float cameraX, float cameraY, float cameraZ, float rotationX, float rotationY, float rotationZ, float scaleX, float scaleY, float scaleZ) |
| |
| mat4 | mat4ConstructOrthogonalProjection (float x_min, float x_max, float y_min, float y_max, float z_min, float z_max) |
| |
| mat4 | mat4ConstructPerspectiveProjection (float x_min_near, float x_max_near, float y_min_near, float y_max_near, float z_near, float z_far) |
| |
| typedef struct vec2 | vec2 |
| |
Vector & Matrix API, only included if you define SRP_INCLUDE_VECTOR or SRP_INCLUDE_MAT
◆ mat4
Represents a 4x4 matrix of floats, stores data in row-major order
◆ vec2
Represents a 2D vector of floats
◆ mat4ConstructIdentity()
| mat4 mat4ConstructIdentity |
( |
| ) |
|
Construct a 4x4 identity matrix
- Returns
- 4x4 identity matrix
◆ mat4ConstructOrthogonalProjection()
| mat4 mat4ConstructOrthogonalProjection |
( |
float |
x_min, |
|
|
float |
x_max, |
|
|
float |
y_min, |
|
|
float |
y_max, |
|
|
float |
z_min, |
|
|
float |
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
◆ mat4ConstructPerspectiveProjection()
| mat4 mat4ConstructPerspectiveProjection |
( |
float |
x_min_near, |
|
|
float |
x_max_near, |
|
|
float |
y_min_near, |
|
|
float |
y_max_near, |
|
|
float |
z_near, |
|
|
float |
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?
◆ mat4ConstructRotate()
| mat4 mat4ConstructRotate |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
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
◆ mat4ConstructScale()
| mat4 mat4ConstructScale |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
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
◆ mat4ConstructTranslate()
| mat4 mat4ConstructTranslate |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
| |
Construct a 4x4 matrix that translates the points
- Parameters
-
| x,y,z | Translating coefficient for X, Y, Z dimensions respectively |
- Returns
- Translation matrix
◆ mat4ConstructTRS()
| mat4 mat4ConstructTRS |
( |
float |
transX, |
|
|
float |
transY, |
|
|
float |
transZ, |
|
|
float |
rotataionX, |
|
|
float |
rotataionY, |
|
|
float |
rotataionZ, |
|
|
float |
scaleX, |
|
|
float |
scaleY, |
|
|
float |
scaleZ |
|
) |
| |
◆ mat4ConstructView()
| mat4 mat4ConstructView |
( |
float |
cameraX, |
|
|
float |
cameraY, |
|
|
float |
cameraZ, |
|
|
float |
rotationX, |
|
|
float |
rotationY, |
|
|
float |
rotationZ, |
|
|
float |
scaleX, |
|
|
float |
scaleY, |
|
|
float |
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
◆ mat4MultiplyMat4()
| mat4 mat4MultiplyMat4 |
( |
const mat4 *restrict |
a, |
|
|
const mat4 *restrict |
b |
|
) |
| |
Multiply two 4x4 matrices
- Parameters
-
| a | Pointer to a matrix A |
| b | Pointer to a matrix B |
- Returns
- The product A*B
◆ mat4MultiplyVec4()
Multiply mat4 by vec4
- Parameters
-
| a | Pointer to a matrix A |
| b | Vector B |
- Returns
- The product A*B