aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r6p3.le-101.fr>2020-03-08 20:54:29 +0100
committerRudy Bousset <rbousset@z2r6p3.le-101.fr>2020-03-08 20:54:41 +0100
commit8771817c18a1058c9524e8ba150d65e8fab20a03 (patch)
tree3fe68616719dd502f72045425a67221bdfa67472
parentClean af (diff)
download42-cub3d-8771817c18a1058c9524e8ba150d65e8fab20a03.tar.gz
42-cub3d-8771817c18a1058c9524e8ba150d65e8fab20a03.tar.bz2
42-cub3d-8771817c18a1058c9524e8ba150d65e8fab20a03.tar.xz
42-cub3d-8771817c18a1058c9524e8ba150d65e8fab20a03.tar.zst
42-cub3d-8771817c18a1058c9524e8ba150d65e8fab20a03.zip
it will be done
-rw-r--r--inc/cub3d_structs.h5
-rw-r--r--src/ft_floor_cast.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/inc/cub3d_structs.h b/inc/cub3d_structs.h
index cf8b6fa..aff5663 100644
--- a/inc/cub3d_structs.h
+++ b/inc/cub3d_structs.h
@@ -138,6 +138,11 @@ typedef struct s_ray
uint8_t hit;
double wall_hit_x;
double step_tex_v;
+ float x_f_ray_dir;
+ float y_f_ray_dir;
+ float x_f_ray_dir_bis;
+ float y_f_ray_dir_bis;
+ uint16_t p;
} t_ray;
typedef struct s_map
diff --git a/src/ft_floor_cast.c b/src/ft_floor_cast.c
index a0321d0..1d98e03 100644
--- a/src/ft_floor_cast.c
+++ b/src/ft_floor_cast.c
@@ -16,6 +16,13 @@
void
ft_floor_cast(uint16_t y, t_cub *cl)
{
- (void)y;
- (void)cl;
+ t_ray *rl;
+
+ rl = &cl->rlist;
+ rl->x_f_ray_dir = cl->plist.dir_x - cl->plist.plane_x;
+ rl->y_f_ray_dir = cl->plist.dir_y - cl->plist.plane_y;
+ rl->x_f_ray_dir_bis = cl->plist.dir_x + cl->plist.plane_x;
+ rl->y_f_ray_dir_bis = cl->plist.dir_y + cl->plist.plane_y;
+ rl->p = y - cl->wlist.y_size / 2;
+ cl->plist.pos_z = 0.5 * cl->wlist.y_size;
}