aboutsummaryrefslogtreecommitdiff
path: root/09-september/tomcat/math/matrix4x4.h
diff options
context:
space:
mode:
Diffstat (limited to '09-september/tomcat/math/matrix4x4.h')
-rw-r--r--09-september/tomcat/math/matrix4x4.h39
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