aboutsummaryrefslogtreecommitdiff
path: root/09-september/tomcat/math/matrix4x4.h
blob: 74918fe5251dd91fae564d6ad56f9f7ac1314fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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