scop/inc/mat4.h

68 lines
2.2 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* mat4.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbrochar <gbrochar@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/12/22 20:35:00 by gbrochar #+# #+# */
/* Updated: 2020/12/26 09:16:18 by gbrochar ### ########.fr */
/* */
/* ************************************************************************** */
#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_multiply_tmp(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_frustrum_tmp(double x, double y, t_vec4 tool);
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