-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug.c
More file actions
46 lines (42 loc) · 1.08 KB
/
Copy pathdebug.c
File metadata and controls
46 lines (42 loc) · 1.08 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
#include "minirt.h"
char *get_type_name(enum e_shape type)
{
if (type == PLANE)
return ("PLANE");
else if (type == SPHERE)
return ("SPHERE");
else if (type == SQUARE)
return ("SQUARE");
else if (type == CYLINDER)
return ("CYLINDER");
else if (type == TRIANGLE)
return ("TRIANGLE");
return ("INVALID");
}
void print_world(t_world *world)
{
printf("world:\t%p\n", world);
printf("\tscreen_width: %d\n", world->screen_width);
printf("\tscreen_height: %d\n", world->screen_height);
printf("\tobjects: %p\n", world->objects);
t_list *current_lst = world->objects;
while (current_lst){
printf("\t\ttype: %s\n", get_type_name(((t_object*)current_lst->content)->type));
current_lst = current_lst->next;
}
}
void print_vec3(t_vec3 vec)
{
printf("{x: %lf,y: %lf, z: %lf}", vec.x, vec.y, vec.z);
}
void print_object(t_object object)
{
printf("type: %d (%s)\n", object.type, get_type_name(object.type));
printf("center: ");
print_vec3(object.center);
printf("\n");
printf("normal: ");
print_vec3(object.normal);
printf("\n");
printf("radius: %lf\n", object.radius);
}