aboutsummaryrefslogtreecommitdiff
path: root/07-july/src/math/matrix4x4.h
diff options
context:
space:
mode:
authorThomas Guillermo Albers Raviola <thomas@thomaslabs.org>2026-01-16 23:02:32 +0100
committerThomas Guillermo Albers Raviola <thomas@thomaslabs.org>2026-01-16 23:02:32 +0100
commit6b8af9cf83851c075c6c9514b1deaa931c2b19a4 (patch)
tree428986b49c32e21d3f7a3c2dfa41858ae0153209 /07-july/src/math/matrix4x4.h
Initial commit
Diffstat (limited to '07-july/src/math/matrix4x4.h')
-rw-r--r--07-july/src/math/matrix4x4.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/07-july/src/math/matrix4x4.h b/07-july/src/math/matrix4x4.h
new file mode 100644
index 0000000..6668fc5
--- /dev/null
+++ b/07-july/src/math/matrix4x4.h
@@ -0,0 +1,35 @@
+#ifndef MATRIX4X4_H
+#define MATRIX4X4_H
+
+#include <GL/glew.h>
+#include "vector3f.h"
+
+/* accesing data: row + column * width */
+typedef struct
+{
+ GLfloat data[16];
+} mat4_t;
+
+extern void mat4_identity(mat4_t* a);
+extern mat4_t mat4_mul(const mat4_t* a, const mat4_t* b);
+
+extern mat4_t mat4_translate(const vec3_t *a);
+extern mat4_t mat4_scale(GLfloat x, GLfloat y, GLfloat z);
+extern mat4_t mat4_rotate_x(GLfloat degrees);
+extern mat4_t mat4_rotate_y(GLfloat degrees);
+extern mat4_t mat4_rotate_z(GLfloat degrees);
+extern mat4_t mat4_rotate(GLfloat degrees, const vec3_t* a);
+
+extern mat4_t
+mat4_perspective(GLfloat fov, GLfloat aspect, GLfloat zNear, GLfloat zFar);
+
+extern mat4_t
+mat4_orthographic(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top);
+
+extern mat4_t
+mat4_lookAt(vec3_t* eye, vec3_t* center, vec3_t* up);
+
+extern vec3_t
+mat4_mul_vec3(const mat4_t* a, const vec3_t* b);
+
+#endif // MATRIX4X4_H