void cone_collision(t_loop *data, t_info *cone) { int i; i = 0; while (i < cone->nb_cone) { calcul_cone(data, cone, i); if (data->collision.is_collision == 1) find_light(data); i = i + 1; } }
int find_color(t_img *img) { int sv; int color; float light; int dist; dist = find_inter(img, &sv); if (sv != -1) { light = find_light(&img->scene.ray, dist, img->scene.obj[sv].pos, img->scene.light); color = chg_color(img->scene.obj[sv].color, light); } else color = BGD_COLOR; return (color); }
void my_find(t_loop *loop, t_ray *ray, t_set *set, int rec) { set->dist = 0; set->color = 0; set->type = 0; my_find_sphere(&loop->geom, ray, set); my_find_cylinder(&loop->geom, ray, set); my_find_cone(&loop->geom, ray, set); my_find_plan(&loop->geom, ray, set); set->col = loop->palette[set->color]; if (set->dist > 0 && rec != -1) find_light(loop, ray, set); if (set->type == 1 && rec < REFL_NB && rec != -1) { *ray = my_ray_reflexion(ray, set); my_find(loop, ray, set, rec + 1); } }