42 lines
1.1 KiB
C
42 lines
1.1 KiB
C
#ifndef MAT4_H
|
|
# define MAT4_H
|
|
|
|
# include "vec4.h"
|
|
# include "vec3.h"
|
|
# include <math.h>
|
|
|
|
typedef struct s_mat4 t_mat4;
|
|
typedef struct s_persp_tool t_persp_tool;
|
|
|
|
struct s_mat4 {
|
|
float data[16];
|
|
};
|
|
|
|
struct s_persp_tool {
|
|
double xmin;
|
|
double xmax;
|
|
double ymin;
|
|
double ymax;
|
|
};
|
|
|
|
t_mat4 mat4_transpose(t_mat4 m);
|
|
t_mat4 mat4_multiply(t_mat4 m, t_mat4 rhs);
|
|
t_mat4 mat4_perspective(double fov, double aspect, double near, double far);
|
|
t_mat4 mat4_frustrum(t_persp_tool tool, double near, double far);
|
|
t_mat4 mat4_lookat(t_vec3 eye, t_vec3 up, t_vec3 target);
|
|
t_mat4 mat4_lookat_make_mat(t_vec3 x, t_vec3 y, t_vec3 z, t_vec3 eye);
|
|
t_vec3 mat4_lookat_make_y(t_vec3 x, t_vec3 z);
|
|
t_vec3 mat4_lookat_make_x(t_vec3 z, t_vec3 up);
|
|
t_vec3 mat4_lookat_make_z(t_vec3 eye, t_vec3 target);
|
|
t_mat4 mat4_identity(void);
|
|
t_mat4 mat4_inverse(t_mat4 m);
|
|
t_mat4 mat4_rotatex(t_mat4 m, double theta);
|
|
t_mat4 mat4_rotatey(t_mat4 m, double theta);
|
|
t_mat4 mat4_rotatez(t_mat4 m, double theta);
|
|
t_mat4 mat4_rotatexyz(t_mat4 m, t_vec3 theta);
|
|
t_mat4 mat4_translate(t_mat4 m, t_vec3 t);
|
|
t_mat4 mat4_scale(t_mat4 m, t_vec3 s);
|
|
|
|
#endif
|
|
|