-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminirt.h
More file actions
118 lines (102 loc) · 2.21 KB
/
minirt.h
File metadata and controls
118 lines (102 loc) · 2.21 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#ifndef MINI_RT_H
# define MINI_RT_H
#include "libft/libft.h"
// typedef struct s_data
// {
// void *img;
// char *addr;
// int bits_per_pixel;
// int line_length;
// int endian;
// } t_data;
// typedef struct s_ray
// {
// float vector[3];
// } t_ray;
typedef struct s_rgb
{
int red;
int green;
int blue;
} t_rgb;
typedef struct s_coordinates
{
double x;
double y;
double z;
} t_coordinates;
typedef struct s_camera
{
t_coordinates coordinates;
t_coordinates vector;
int FOV;
} t_camera;
typedef struct s_light
{
t_coordinates coordinates;
t_rgb rgb;
double brightness;
} t_light;
typedef struct s_sphere
{
t_coordinates coordinates;
t_rgb rgb;
float diameter;
} t_sphere;
typedef struct s_plane
{
t_coordinates coordinates;
t_coordinates vector;
t_rgb rgb;
} t_plane;
typedef struct s_square
{
t_coordinates coordinates;
t_coordinates vector;
t_rgb rgb;
float side;
} t_square;
typedef struct s_cylinder
{
t_coordinates coordinates;
t_coordinates vector;
t_rgb rgb;
float diameter;
float height;
} t_cylinder;
typedef struct s_triangle
{
t_coordinates coordinates1;
t_coordinates coordinates2;
t_coordinates coordinates3;
t_rgb rgb;
} t_triangle;
typedef struct s_scene
{
int resolution[2];
float ambi_light;
t_rgb rgb;
t_list *planes;
t_list *spheres;
t_list *squares;
t_list *cylinders;
t_list *triangles;
t_list *cameras;
t_list *lights;
} t_scene;
t_scene *parse_scene (char *str, t_scene *scene);
t_scene *init_scene(t_scene *scene);
t_camera *init_camera(t_camera *camera);
void get_resolution(t_scene *scene, char *str);
void get_ambient(t_scene *scene, char *str);
void get_camera(t_scene *scene, char *str);
void get_light(t_scene *scene, char *str);
void get_plane(t_scene *scene, char *str);
void get_sphere(t_scene *scene, char *str);
void get_square(t_scene *scene, char *str);
void get_cylinder(t_scene *scene, char *str);
void get_triangle(t_scene *scene, char *str);
void free_2d_array(char **str);
t_rgb get_rgb(t_rgb rgb, char *str);
t_coordinates get_coords(t_coordinates coordinates, char *str);
#endif