aboutsummaryrefslogtreecommitdiff
path: root/07-july/src/renderer/entity.c
diff options
context:
space:
mode:
Diffstat (limited to '07-july/src/renderer/entity.c')
-rw-r--r--07-july/src/renderer/entity.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/07-july/src/renderer/entity.c b/07-july/src/renderer/entity.c
new file mode 100644
index 0000000..b96491d
--- /dev/null
+++ b/07-july/src/renderer/entity.c
@@ -0,0 +1,18 @@
+#include "entity.h"
+
+mat4_t Entity_GetModelTransform(entity_t* entity)
+{
+ mat4_t temp;
+ mat4_t rotation = mat4_rotate_x(entity->rotX);
+ temp = mat4_rotate_y(entity->rotY);
+ rotation = mat4_mul(&rotation, &temp);
+ temp = mat4_rotate_z(entity->rotZ);
+ rotation = mat4_mul(&rotation, &temp);
+
+ temp = mat4_translate(&entity->position);
+
+ mat4_t modelTransform = mat4_mul(&temp, &rotation);
+
+ return modelTransform;
+}
+