2020-12-22 19:49:06 +00:00
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* mat4.h :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: gbrochar <gbrochar@student.42.fr> +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2020/12/22 20:35:00 by gbrochar #+# #+# */
|
2020-12-23 19:38:33 +00:00
|
|
|
/* Updated: 2020/12/23 20:17:35 by gbrochar ### ########.fr */
|
2020-12-22 19:49:06 +00:00
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#ifndef MAT4_H
|
|
|
|
# define MAT4_H
|
|
|
|
|
2020-12-23 15:13:12 +00:00
|
|
|
# include "vec4.h"
|
2020-12-23 16:06:42 +00:00
|
|
|
# include <math.h>
|
2020-12-23 15:13:12 +00:00
|
|
|
|
2020-12-22 19:49:06 +00:00
|
|
|
typedef struct s_mat4 t_mat4;
|
2020-12-23 15:11:35 +00:00
|
|
|
typedef struct s_persp_tool t_persp_tool;
|
2020-12-22 19:49:06 +00:00
|
|
|
|
|
|
|
struct s_mat4
|
|
|
|
{
|
|
|
|
double data[16];
|
|
|
|
};
|
|
|
|
|
2020-12-23 15:11:35 +00:00
|
|
|
struct s_persp_tool
|
|
|
|
{
|
|
|
|
double xmin;
|
|
|
|
double xmax;
|
|
|
|
double ymin;
|
|
|
|
double ymax;
|
|
|
|
};
|
|
|
|
|
2020-12-23 09:51:35 +00:00
|
|
|
t_mat4 mat4_transpose(t_mat4 m);
|
2020-12-23 15:11:35 +00:00
|
|
|
|
2020-12-23 09:51:35 +00:00
|
|
|
t_mat4 mat4_multiply(t_mat4 m, t_mat4 rhs);
|
|
|
|
t_mat4 mat4_multiply_tmp(t_mat4 m, t_mat4 rhs);
|
|
|
|
|
2020-12-23 15:11:35 +00:00
|
|
|
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);
|
|
|
|
|
2020-12-23 19:38:33 +00:00
|
|
|
t_mat4 mat4_identity(void);
|
|
|
|
|
|
|
|
t_mat4 mat4_inverse(t_mat4 m);
|
|
|
|
|
2020-12-22 19:49:06 +00:00
|
|
|
#endif
|