CF_M4x4¶
Category: math
GitHub: cute_math3d.h
A 4x4 matrix, stored column-major.
| Struct Members | Description |
|---|---|
float elements[16] |
The 16 elements, in column-major order. (row, col) is at elements[col * 4 + row]. |
Remarks¶
Element (row, col) lives at elements[col * 4 + row], matching GLSL/MSL's default
mat4 layout. This means a CF_M4x4 can be handed straight to
cf_material_set_uniform_vs as CF_UNIFORM_TYPE_MAT4 with no transpose:
CF_M4x4 mvp = cf_mul(projection, cf_mul(view, model));
cf_material_set_uniform_vs(material, "u_mvp", &mvp, CF_UNIFORM_TYPE_MAT4, 1);
Note that Metal only supports mat4 inside a uniform block -- a mat3 normal matrix
must be widened to a CF_M4x4 before upload.
Related Pages¶
CF_UniformType
cf_m4_identity
cf_mul
cf_perspective
cf_ortho
cf_look_at