From 8a89388d397b50f2c70cef05f8fa6cfa10cc213c Mon Sep 17 00:00:00 2001 From: salaaad2 Date: Mon, 17 Feb 2020 16:27:35 +0100 Subject: small but important changes --- src/ft_raycasting.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/ft_raycasting.c') diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index a4446b3..7b03b84 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -12,6 +12,16 @@ #include #include +#include + +void + ft_calc_tex(t_cub *clist) +{ + if (clist->rlist.side == 1) + clist->rlist.wall_hit_x = clist->plist->pos_y + clist->rlist.wall_dist * clist->rlist.y_ray_dir; + else + clist->rlist.wall_hit_x = clist->plist->pos_x + clist->rlist.wall_dist * clist->rlist.x_ray_dir; +} static void ft_initray(t_cub *cl, uint16_t i) @@ -57,6 +67,9 @@ void cl->rlist.wall_b = cl->rlist.line_h / 2 + wl->y_size / 2; if (cl->rlist.wall_b >= wl->y_size) cl->rlist.wall_b = wl->y_size - 1; + ft_choose_tex(cl); + ft_calc_tex(cl); + printf("%f\n", cl->rlist.wall_hit_x); ft_draw_verline(cl, i, cl->rlist.wall_t - 1, cl->rlist.wall_b); i++; } -- cgit v1.2.3