|
srp
software rendering pipeline
|
Internals of the Vector & Matrix API. More...

Files | |
| file | mat.c |
| file | utils.h |
| file | vec.c |
| SRP_FORCEINLINE vec4 | mat4MultiplyVec4 (const mat4 *restrict m, vec4 v) |
| SRP_FORCEINLINE mat4 | mat4MultiplyMat4 (const mat4 *restrict a, const mat4 *restrict b) |
| SRP_FORCEINLINE mat4 | mat4ConstructIdentity () |
| SRP_FORCEINLINE mat4 | mat4ConstructScale (float x, float y, float z) |
| SRP_FORCEINLINE mat4 | mat4ConstructTranslate (float x, float y, float z) |
| SRP_FORCEINLINE mat4 | mat4ConstructRotate (float x, float y, float z) |
| SRP_FORCEINLINE mat4 | mat4ConstructTRS (float transX, float transY, float transZ, float rotataionX, float rotataionY, float rotataionZ, float scaleX, float scaleY, float scaleZ) |
| SRP_FORCEINLINE mat4 | mat4ConstructView (float cameraX, float cameraY, float cameraZ, float rotataionX, float rotataionY, float rotataionZ, float scaleX, float scaleY, float scaleZ) |
| SRP_FORCEINLINE mat4 | mat4ConstructOrthogonalProjection (float x_min, float x_max, float y_min, float y_max, float z_min, float z_max) |
| SRP_FORCEINLINE mat4 | mat4ConstructPerspectiveProjection (float x_min_near, float x_max_near, float y_min_near, float y_max_near, float z_near, float z_far) |
| SRP_FORCEINLINE vec2 | vec2Add (vec2 a, vec2 b) |
| SRP_FORCEINLINE vec2 | vec2Subtract (vec2 a, vec2 b) |
| SRP_FORCEINLINE float | vec2DotProduct (vec2 a, vec2 b) |
| SRP_FORCEINLINE vec2 | vec2MultiplyScalar (vec2 a, float b) |
| SRP_FORCEINLINE vec3 | vec3Add (vec3 a, vec3 b) |
| SRP_FORCEINLINE vec3 | vec3Subtract (vec3 a, vec3 b) |
| SRP_FORCEINLINE float | vec3DotProduct (vec3 a, vec3 b) |
| SRP_FORCEINLINE vec3 | vec3MultiplyScalar (vec3 a, float b) |
| SRP_FORCEINLINE vec4 | vec4Add (vec4 a, vec4 b) |
| SRP_FORCEINLINE vec4 | vec4Subtract (vec4 a, vec4 b) |
| SRP_FORCEINLINE float | vec4DotProduct (vec4 a, vec4 b) |
| SRP_FORCEINLINE vec4 | vec4MultiplyScalar (vec4 a, float b) |
| #define | _USE_MATH_DEFINES |
| #define | M_PI 3.14159265358979323846 |
| #define | MIN(a, b) ( (a) > (b) ? (b) : (a) ) |
| #define | MAX(a, b) ( (a) > (b) ? (a) : (b) ) |
| #define | CLAMP(min, max, value) |
| #define | FRACTIONAL(x) ( (x) - floor(x) ) |
| #define | EPSILON 1e-9 |
| #define | ROUGHLY_EQUAL(a, b) (fabs((a) - (b)) <= EPSILON) |
| #define | ROUGHLY_ZERO(x) (fabs(x) <= EPSILON) |
| #define | ROUGHLY_LESS_OR_EQUAL(a, b) ((a) <= (b) + EPSILON) |
| #define | ROUGHLY_GREATER_OR_EQUAL(a, b) ((a) >= (b) - EPSILON) |
Internals of the Vector & Matrix API.
| #define CLAMP | ( | min, | |
| max, | |||
| value | |||
| ) |
Clamp the value between min and max
min, if value < min; max, if value > max; value otherwise | #define FRACTIONAL | ( | x | ) | ( (x) - floor(x) ) |
Get the fractional part of float or double
| #define MAX | ( | a, | |
| b | |||
| ) | ( (a) > (b) ? (a) : (b) ) |
Get the maximum of two values
| #define MIN | ( | a, | |
| b | |||
| ) | ( (a) > (b) ? (b) : (a) ) |
Get the minimum of two values
| #define ROUGHLY_EQUAL | ( | a, | |
| b | |||
| ) | (fabs((a) - (b)) <= EPSILON) |
Determine if two values are roughly equal
| #define ROUGHLY_GREATER_OR_EQUAL | ( | a, | |
| b | |||
| ) | ((a) >= (b) - EPSILON) |
Determine if the first value is roughly greater or equal than the second one
| #define ROUGHLY_LESS_OR_EQUAL | ( | a, | |
| b | |||
| ) | ((a) <= (b) + EPSILON) |
Determine if the first value is roughly less or equal than the second one
| #define ROUGHLY_ZERO | ( | x | ) | (fabs(x) <= EPSILON) |
Determine if a value is roughly zero
| SRP_FORCEINLINE mat4 mat4ConstructIdentity | ( | ) |
Construct a 4x4 identity matrix
| SRP_FORCEINLINE 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
| 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 |
| SRP_FORCEINLINE mat4 mat4ConstructPerspectiveProjection | ( | float | x_min_near, |
| float | x_max_near, | ||
| float | y_min_near, | ||
| float | y_max_near, | ||
| float | z_near, | ||
| float | z_far | ||
| ) |
| SRP_FORCEINLINE mat4 mat4ConstructRotate | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Construct a 4x4 matrix that rotates the points
| x,y,z | Angle (in radians) by which the points are rotated around X, Y, Z axis respectively |
| SRP_FORCEINLINE mat4 mat4ConstructScale | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Construct a 4x4 matrix that scales the X, Y and Z dimensions
| x,y,z | Scaling coefficients for X, Y, Z dimensions respectively |
| SRP_FORCEINLINE mat4 mat4ConstructTranslate | ( | float | x, |
| float | y, | ||
| float | z | ||
| ) |
Construct a 4x4 matrix that translates the points
| x,y,z | Translating coefficient for X, Y, Z dimensions respectively |
| SRP_FORCEINLINE mat4 mat4ConstructTRS | ( | float | transX, |
| float | transY, | ||
| float | transZ, | ||
| float | rotataionX, | ||
| float | rotataionY, | ||
| float | rotataionZ, | ||
| float | scaleX, | ||
| float | scaleY, | ||
| float | scaleZ | ||
| ) |
Construct a 4x4 matrix that translates, rotates the points and scales the X, Y, and Z dimenstions
| SRP_FORCEINLINE 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
| cameraX,cameraY,cameraZ | Camera position |
| rotationX,rotationY,rotationZ | Camera rotation along each dimension |
| scaleX,scaleY,scaleZ | Camera "zoom" along each dimension |
Multiply two 4x4 matrices
| a | Pointer to a matrix A |
| b | Pointer to a matrix B |