miniRT
By Marcelo Magalhães and Ygor G. Sena, 2023.
camera.h
Go to the documentation of this file.
1 /* ************************************************************************** */
2 /* */
3 /* ::: :::::::: */
4 /* camera.h :+: :+: :+: */
5 /* +:+ +:+ +:+ */
6 /* By: yde-goes <yde-goes@student.42sp.org.br> +#+ +:+ +#+ */
7 /* +#+#+#+#+#+ +#+ */
8 /* Created: 2023/04/18 12:29:11 by mdias-ma #+# #+# */
9 /* Updated: 2023/06/16 13:39:48 by yde-goes ### ########.fr */
10 /* */
11 /* ************************************************************************** */
12 
14 #ifndef CAMERA_H
15 # define CAMERA_H
16 
17 # include "tuples.h"
18 # include "matrices.h"
19 # include "rays.h"
20 
44 typedef struct s_camera
45 {
46  float hsize;
47  float vsize;
48  float field_of_view;
49  float half_width;
50  float half_height;
51  float pixel_size;
52  t_matrix transform;
53  t_matrix inverse;
54  t_matrix transpose;
56 
57 /* ************************************************************************** */
58 /* VIEW_TRANSFORM.C */
59 /* ************************************************************************** */
60 
76 
77 /* ************************************************************************** */
78 /* CAMERA.C */
79 /* ************************************************************************** */
80 
98 t_camera new_camera(float hsize, float vsize, float field_of_view);
99 
121 t_ray ray_for_pixel(t_camera *camera, float px, float py);
122 
123 #endif
t_ray ray_for_pixel(t_camera *camera, float px, float py)
Computes the ray that passes through the specified pixel on the camera plane.
Definition: camera.c:32
t_camera new_camera(float hsize, float vsize, float field_of_view)
Creates a new camera with the given attributes.
Definition: camera.c:19
t_matrix view_transform(t_point from, t_point to, t_vector up)
Computes the view transformation matrix given the position of the camera and the point to look at.
Definition: view_transform.c:17
struct s_camera t_camera
The structure of type t_camera contains the necessary information for camera configuration,...
The structure of type t_camera contains the necessary information for camera configuration,...
Definition: camera.h:45
The struct t_matrix stores a matrix up to 4x4 and size of 16. A matrix is a grid of numbers that can ...
Definition: matrices.h:34
The struct of type t_ray represents a ray, which is the foundation for ray casting....
Definition: rays.h:28
Tuple means a list of ordered things. The struct t_tuple stores coordinates for a left-handed coordin...
Definition: tuples.h:33