diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-30 15:46:38 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-07-30 15:46:38 +1000 |
commit | 4505fb6585885866ff9a76f76c00ed727d3bb818 (patch) | |
tree | 5a6fb84426827e818513632cf9bde8dca0300b4b /src/maths | |
parent | bfae2fd3f7b367709f21a8b4fccab107e2e81797 (diff) |
wip
Diffstat (limited to 'src/maths')
-rw-r--r-- | src/maths/maths.c | 8 | ||||
-rw-r--r-- | src/maths/maths.h | 8 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/maths/maths.c b/src/maths/maths.c index adeee3e..aedee76 100644 --- a/src/maths/maths.c +++ b/src/maths/maths.c @@ -24,4 +24,12 @@ c_static_inline Vec3 vec3_cross(Vec3 a, Vec3 b) { Mat4 mat4_ident() { return (Mat4){ .data = { 1.0, 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1.0 } }; +} + +Mat4 transform_to_mat(Transform *tf) { + Mat4 scale = mat4_scale(tf->scale); + Mat4 rotation = mat4_rotation(tf->rotation); + Mat4 translation = mat4_translation(tf->position); + return mat4_mult(translation, mat4_mult(rotation, scale)); + // return mat4_mult(mat4_mult(scale, rotation), translation); }
\ No newline at end of file diff --git a/src/maths/maths.h b/src/maths/maths.h index 5055637..0b3760e 100644 --- a/src/maths/maths.h +++ b/src/maths/maths.h @@ -311,13 +311,7 @@ static Transform transform_create(Vec3 pos, Quat rot, f32 scale) { return (Transform){ .position = pos, .rotation = rot, .scale = scale, .is_dirty = true }; } -static Mat4 transform_to_mat(Transform *tf) { - Mat4 scale = mat4_scale(tf->scale); - Mat4 rotation = mat4_rotation(tf->rotation); - Mat4 translation = mat4_translation(tf->position); - return mat4_mult(translation, mat4_mult(rotation, scale)); - // return mat4_mult(mat4_mult(scale, rotation), translation); -} + Mat4 transform_to_mat(Transform *tf); // --- Sizing asserts |