From 6b8af9cf83851c075c6c9514b1deaa931c2b19a4 Mon Sep 17 00:00:00 2001 From: Thomas Guillermo Albers Raviola Date: Fri, 16 Jan 2026 23:02:32 +0100 Subject: Initial commit --- 07-july/src/math/matrix4x4.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 07-july/src/math/matrix4x4.h (limited to '07-july/src/math/matrix4x4.h') 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 +#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 -- cgit v1.2.3