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 --- 09-september/tomcat/math/matrix4x4.h | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 09-september/tomcat/math/matrix4x4.h (limited to '09-september/tomcat/math/matrix4x4.h') diff --git a/09-september/tomcat/math/matrix4x4.h b/09-september/tomcat/math/matrix4x4.h new file mode 100644 index 0000000..74918fe --- /dev/null +++ b/09-september/tomcat/math/matrix4x4.h @@ -0,0 +1,39 @@ +#ifndef MATRIX4X4_H +#define MATRIX4X4_H + +#include +#include "vector.h" + +/* accesing data: row + column * width */ +typedef struct +{ + GLfloat data[16]; +} Mat4; + +extern void mat4_identity(Mat4 *a); +extern Mat4 mat4_inverse(const Mat4 *a); +extern Mat4 mat4_mul(const Mat4 *a, const Mat4 *b); + +extern Mat4 mat4_translate(const Vec3 *a); +extern Mat4 mat4_scale(GLfloat x, GLfloat y, GLfloat z); +extern Mat4 mat4_rotate_x(GLfloat degrees); +extern Mat4 mat4_rotate_y(GLfloat degrees); +extern Mat4 mat4_rotate_z(GLfloat degrees); +extern Mat4 mat4_rotate(GLfloat degrees, const Vec3 *a); + +extern Mat4 +mat4_perspective(GLfloat fov, GLfloat aspect, GLfloat zNear, GLfloat zFar); + +extern Mat4 +mat4_orthographic(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat near, GLfloat far); + +extern Mat4 +mat4_lookAt(Vec3 *eye, Vec3 *center, Vec3 *up); + +extern Vec3 +mat4_mul_vec3(const Mat4 *a, const Vec3 *b); + +extern Vec4 +mat4_mul_vec4(const Mat4 *a, const Vec4 *b); + +#endif // MATRIX4X4_H -- cgit v1.2.3