aboutsummaryrefslogtreecommitdiff
path: root/08-august/src/math/matrix4x4.h
diff options
context:
space:
mode:
Diffstat (limited to '08-august/src/math/matrix4x4.h')
-rw-r--r--08-august/src/math/matrix4x4.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/08-august/src/math/matrix4x4.h b/08-august/src/math/matrix4x4.h
new file mode 100644
index 0000000..b7d54aa
--- /dev/null
+++ b/08-august/src/math/matrix4x4.h
@@ -0,0 +1,40 @@
+#ifndef MATRIX4X4_H
+#define MATRIX4X4_H
+
+#include <GL/glew.h>
+#include "vector3f.h"
+#include "vector4f.h"
+
+/* accesing data: row + column * width */
+typedef struct
+{
+ GLfloat data[16];
+} mat4_t;
+
+extern void mat4_identity(mat4_t *a);
+extern mat4_t mat4_inverse(const 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);
+
+extern vec4_t
+mat4_mul_vec4(const mat4_t *a, const vec4_t *b);
+
+#endif // MATRIX4X4_H