#ifndef MATRIX_H
#define MATRIX_H
#include "glad/glad.h"

#define M_PI 3.14159265358979323846
#define ONE_DEG_IN_RAD (2.0 * M_PI) / 360.0 // 0.017444444
#ifndef TO_RAD
#define TO_RAD(deg) ((deg) * 3.14159265358979323846)
#endif

typedef struct {
    GLfloat m[16];
} mat4_t;

typedef struct {
    float q[4];
} versor_t;

mat4_t mat4_make_rotation_x(GLfloat m);
mat4_t mat4_make_rotation_y(GLfloat m);
mat4_t mat4_make_rotation_z(GLfloat m);
mat4_t mat4_make_scale(GLfloat sx, GLfloat sy, GLfloat sz);
mat4_t mat4_make_translation(GLfloat tx, GLfloat ty, GLfloat tz);
mat4_t mat4_make_quaternion(const GLfloat* q, GLfloat* m);
mat4_t mat4_make_perspective(float fov_rad, float aspect, float znear, float zfar);
mat4_t mat4_mul_mat4(mat4_t a, mat4_t b);
mat4_t mat4_identity(void);

mat4_t mat4_look_at(float eyex, float eyey, float eyez,
                    float targetx, float targety, float targetz,
                    float upx, float upy, float upz);

#endif //MATRIX_H
