diff options
| author | Thomas Guillermo Albers Raviola <thomas@thomaslabs.org> | 2026-01-16 23:02:32 +0100 |
|---|---|---|
| committer | Thomas Guillermo Albers Raviola <thomas@thomaslabs.org> | 2026-01-16 23:02:32 +0100 |
| commit | 6b8af9cf83851c075c6c9514b1deaa931c2b19a4 (patch) | |
| tree | 428986b49c32e21d3f7a3c2dfa41858ae0153209 /09-september/tomcat/math/matrix4x4.h | |
Initial commit
Diffstat (limited to '09-september/tomcat/math/matrix4x4.h')
| -rw-r--r-- | 09-september/tomcat/math/matrix4x4.h | 39 |
1 files changed, 39 insertions, 0 deletions
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 <GL/glew.h> +#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 |
