mk_mat4_cptrfunction
const float * mk_mat4_cptr(const mk_mat4 *m)Perform the mat4 cptr operation.
| Parameter | Type | Description |
|---|---|---|
m | const mk_mat4 * | Value for m. |
Returns A borrowed pointer, or NULL when unavailable.
#include <modkit/math/types.h>10 functions · 5 structs · 5 typedefs · 18 macros
Core math types for GPU rendering.
All types are simple float arrays that can be:Passed directly to GPU functions via .data memberUsed with cglm inline functions via .v or .m memberInitialized with compound literal macros Column-major matrix layout (OpenGL convention): [0] [4] [8] [12] col0 col1 col2 col3 [1] [5] [9] [13] = Xx Yx Zx Tx [2] [6] [10] [14] Xy Yy Zy Ty [3] [7] [11] [15] Xz Yz Zz Tz Translation is at indices [12, 13, 14]
mk_mat4_cptrfunctionconst float * mk_mat4_cptr(const mk_mat4 *m)Perform the mat4 cptr operation.
| Parameter | Type | Description |
|---|---|---|
m | const mk_mat4 * | Value for m. |
Returns A borrowed pointer, or NULL when unavailable.
mk_mat4_ptrfunctionfloat * mk_mat4_ptr(mk_mat4 *m)Perform the mat4 ptr operation.
| Parameter | Type | Description |
|---|---|---|
m | mk_mat4 * | Value for m. |
Returns A borrowed pointer, or NULL when unavailable.
mk_quat_cptrfunctionconst float * mk_quat_cptr(const mk_quat *q)Perform the quat cptr operation.
| Parameter | Type | Description |
|---|---|---|
q | const mk_quat * | Value for q. |
Returns A borrowed pointer, or NULL when unavailable.
mk_quat_ptrfunctionfloat * mk_quat_ptr(mk_quat *q)Perform the quat ptr operation.
| Parameter | Type | Description |
|---|---|---|
q | mk_quat * | Value for q. |
Returns A borrowed pointer, or NULL when unavailable.
mk_vec2_cptrfunctionconst float * mk_vec2_cptr(const mk_vec2 *v)Perform the vec2 cptr operation.
| Parameter | Type | Description |
|---|---|---|
v | const mk_vec2 * | Value for v. |
Returns A borrowed pointer, or NULL when unavailable.
mk_vec2_ptrfunctionfloat * mk_vec2_ptr(mk_vec2 *v)Perform the vec2 ptr operation.
| Parameter | Type | Description |
|---|---|---|
v | mk_vec2 * | Value for v. |
Returns A borrowed pointer, or NULL when unavailable.
mk_vec3_cptrfunctionconst float * mk_vec3_cptr(const mk_vec3 *v)Perform the vec3 cptr operation.
| Parameter | Type | Description |
|---|---|---|
v | const mk_vec3 * | Value for v. |
Returns A borrowed pointer, or NULL when unavailable.
mk_vec3_ptrfunctionfloat * mk_vec3_ptr(mk_vec3 *v)Perform the vec3 ptr operation.
| Parameter | Type | Description |
|---|---|---|
v | mk_vec3 * | Value for v. |
Returns A borrowed pointer, or NULL when unavailable.
mk_vec4_cptrfunctionconst float * mk_vec4_cptr(const mk_vec4 *v)Perform the vec4 cptr operation.
| Parameter | Type | Description |
|---|---|---|
v | const mk_vec4 * | Value for v. |
Returns A borrowed pointer, or NULL when unavailable.
mk_vec4_ptrfunctionfloat * mk_vec4_ptr(mk_vec4 *v)Perform the vec4 ptr operation.
| Parameter | Type | Description |
|---|---|---|
v | mk_vec4 * | Value for v. |
Returns A borrowed pointer, or NULL when unavailable.
mk_mat4struct4x4 matrix (column-major)
| Field | Type | Description |
|---|---|---|
data | float | The data. |
col | float | col[column][row] |
m | mat4 | cglm compatibility |
mk_quatstructQuaternion for rotations Stored as [x, y, z, w] (imaginary first, real/scalar last) - cglm convention.
| Field | Type | Description |
|---|---|---|
x | float | Imaginary X component. |
y | float | Imaginary Y component. |
z | float | Imaginary Z component. |
w | float | Real scalar component. |
data | float | The data. |
q | versor | cglm compatibility |
mk_vec2struct2D vector (position, UV coordinates, etc.)
| Field | Type | Description |
|---|---|---|
x | float | X component. |
y | float | Y component. |
data | float | The data. |
v | vec2 | cglm compatibility |
mk_vec3struct3D vector (position, direction, scale, etc.)
| Field | Type | Description |
|---|---|---|
x | float | X component. |
y | float | Y component. |
z | float | Z component. |
data | float | The data. |
v | vec3 | cglm compatibility |
mk_vec4struct4D vector (homogeneous coordinates, colors, planes)
| Field | Type | Description |
|---|---|---|
x | float | X component. |
y | float | Y component. |
z | float | Z component. |
w | float | W component. |
data | float | The data. |
v | vec4 | cglm compatibility |
mk_mat4typedeftypedef struct mk_mat4 mk_mat44x4 matrix (column-major)
mk_quattypedeftypedef struct mk_quat mk_quatQuaternion for rotations Stored as [x, y, z, w] (imaginary first, real/scalar last) - cglm convention.
mk_vec2typedeftypedef struct mk_vec2 mk_vec22D vector (position, UV coordinates, etc.)
mk_vec3typedeftypedef struct mk_vec3 mk_vec33D vector (position, direction, scale, etc.)
mk_vec4typedeftypedef struct mk_vec4 mk_vec44D vector (homogeneous coordinates, colors, planes)
MK_MAT4_IDENTITYdefineMK_MAT4_IDENTITYConstant for mat4 identity.
MK_QUATdefineMK_QUAT(qx, qy, qz, qw)Constant for quat.
MK_QUAT_IDENTITYdefineMK_QUAT_IDENTITYConstant for quat identity.
MK_VEC2defineMK_VEC2(px, py)Constant for vec2.
MK_VEC2_ONEdefineMK_VEC2_ONEConstant for vec2 one.
MK_VEC2_ZEROdefineMK_VEC2_ZEROConstant for vec2 zero.
MK_VEC3defineMK_VEC3(px, py, pz)Constant for vec3.
MK_VEC3_BACKdefineMK_VEC3_BACKConstant for vec3 back.
MK_VEC3_DOWNdefineMK_VEC3_DOWNConstant for vec3 down.
MK_VEC3_FORWARDdefineMK_VEC3_FORWARDConstant for vec3 forward.
MK_VEC3_LEFTdefineMK_VEC3_LEFTConstant for vec3 left.
MK_VEC3_ONEdefineMK_VEC3_ONEConstant for vec3 one.
MK_VEC3_RIGHTdefineMK_VEC3_RIGHTConstant for vec3 right.
MK_VEC3_UPdefineMK_VEC3_UPConstant for vec3 up.
MK_VEC3_ZEROdefineMK_VEC3_ZEROConstant for vec3 zero.
MK_VEC4defineMK_VEC4(px, py, pz, pw)Constant for vec4.
MK_VEC4_ONEdefineMK_VEC4_ONEConstant for vec4 one.
MK_VEC4_ZEROdefineMK_VEC4_ZEROConstant for vec4 zero.