-
Notifications
You must be signed in to change notification settings - Fork 2
/
camera.h
52 lines (46 loc) · 1.88 KB
/
camera.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* camera.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: upopee <upopee@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/05/13 19:27:10 by upopee #+# #+# */
/* Updated: 2018/05/13 20:26:51 by upopee ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef CAMERA_H
# define CAMERA_H
#include "../../vector/includes/vector.h"
#include "../../matrix/includes/matrix.h"
# define DFLT_VANGLE 70.0
# define DFLT_NEAR 0.1
# define DFLT_FAR 100.0
typedef struct s_camera
{
t_vector3 eye;
t_vector3 center;
t_vector3 up;
t_vector3 forward;
t_vector3 side;
float view_angle;
float aspect_ratio;
float near;
float far;
float top_limit;
float bottom_limit;
float right_limit;
float left_limit;
t_matrix4 view_matrix;
t_matrix4 projection_matrix;
} t_camera;
t_camera ft_init_cam(float fov, float ratio, float near, float far);
t_camera *ft_init_cam_new(float fov, float ratio, float near, float far);
t_matrix4 ft_lookat(t_camera *cam, t_vector3 eye,
t_vector3 center, t_vector3 up);
t_matrix4 ft_view_mat4(t_vector3 eye, t_vector3 up,
t_vector3 side, t_vector3 forward);
t_matrix4 ft_persproj_mat4(float fov, float near, float far, float ratio);
t_matrix4 ft_orthoproj_mat4(float fov, float near,
float far, float ratio);
#endif