summaryrefslogtreecommitdiff
path: root/src/maths
diff options
context:
space:
mode:
authorJoshua Rowe <17525998+omnisci3nce@users.noreply.github.com>2024-04-21 11:48:06 +1000
committerGitHub <noreply@github.com>2024-04-21 11:48:06 +1000
commitd8b564ffd1257152094966784a8db3d1396a8879 (patch)
treeadbbda6eec38d0cd6f35f29e422debe09b807461 /src/maths
parent45f035c2174a018444a4e495ec78b4806900d903 (diff)
parent540bdfd0cbe4a95b49281cec4d3ed207070a3b5b (diff)
Merge pull request #10 from omnisci3nce/cel-41-port-over-a-basic-3d-scene-example
Cel 41 port over a basic 3d scene example
Diffstat (limited to 'src/maths')
-rw-r--r--src/maths/maths.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/maths/maths.h b/src/maths/maths.h
index 57d575d..3301634 100644
--- a/src/maths/maths.h
+++ b/src/maths/maths.h
@@ -215,12 +215,14 @@ static inline mat4 mat4_look_at(vec3 position, vec3 target, vec3 up) {
.is_dirty = false })
static transform transform_create(vec3 pos, quat rot, f32 scale) {
- return (transform){ .position = pos, .rotation = rot, .scale = scale, .is_dirty = false };
+ return (transform){ .position = pos, .rotation = rot, .scale = scale, .is_dirty = true };
}
static inline mat4 transform_to_mat(transform *tf) {
- // TODO: rotation
- return mat4_mult(mat4_translation(tf->position), mat4_scale(tf->scale));
+ mat4 trans = mat4_translation(tf->position);
+ mat4 rot = mat4_rotation(tf->rotation);
+ mat4 scale = mat4_scale(tf->scale);
+ return mat4_mult(trans, mat4_mult(rot, scale));
}
// --- Sizing asserts