aboutsummaryrefslogtreecommitdiff
path: root/07-july/src/math/matrix4x4.h
blob: 6668fc5b3a282b6eb7b83ad891df88ee5317e90e (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
#ifndef MATRIX4X4_H
#define MATRIX4X4_H

#include <GL/glew.h>
#include "vector3f.h"

/* accesing data: row + column * width */
typedef struct
{
    GLfloat data[16];
} mat4_t;

extern void mat4_identity(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);

#endif // MATRIX4X4_H