-
Notifications
You must be signed in to change notification settings - Fork 0
/
raycasting_2.c
37 lines (35 loc) · 1.7 KB
/
raycasting_2.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* raycasting_2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ahajji <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/03 15:32:35 by ahajji #+# #+# */
/* Updated: 2023/12/10 17:41:15 by ahajji ### ########.fr */
/* */
/* ************************************************************************** */
#include "cub3d.h"
void call_raycasting(t_cub3d *data, float ray_angle, int id_ray)
{
if (data->distance_horz < data->distance_vert)
{
data->dist = data->distance_horz;
if (ray_angle >= 180 && ray_angle <= 360)
ray_casting(data, ray_angle, id_ray, data->textures.no_texture);
else
ray_casting(data, ray_angle, id_ray, data->textures.so_texture);
data->present_texture = (data->hores_inters_x / data->size_shape)
- ((int)(data->hores_inters_x / data->size_shape));
}
else
{
data->dist = data->distance_vert;
if (ray_angle >= 90 && ray_angle <= 270)
ray_casting(data, ray_angle, id_ray, data->textures.ea_texture);
else
ray_casting(data, ray_angle, id_ray, data->textures.we_texture);
data->present_texture = (data->vertcl_inters_y / data->size_shape)
- ((int)(data->vertcl_inters_y / data->size_shape));
}
}