aboutsummaryrefslogtreecommitdiffstats
path: root/src/ft_raycasting.c
diff options
context:
space:
mode:
authorRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-17 16:47:59 +0100
committerRudy Bousset <rbousset@z2r4p3.le-101.fr>2020-02-17 16:47:59 +0100
commit5c908cdcd9c09ee4e5656ddc62ca1153f630354a (patch)
treef9efc3e226ca87904cab92716c65b051b11c304d /src/ft_raycasting.c
parentRemoved "vim" map (diff)
parentsmall but important changes (diff)
download42-cub3d-5c908cdcd9c09ee4e5656ddc62ca1153f630354a.tar.gz
42-cub3d-5c908cdcd9c09ee4e5656ddc62ca1153f630354a.tar.bz2
42-cub3d-5c908cdcd9c09ee4e5656ddc62ca1153f630354a.tar.xz
42-cub3d-5c908cdcd9c09ee4e5656ddc62ca1153f630354a.tar.zst
42-cub3d-5c908cdcd9c09ee4e5656ddc62ca1153f630354a.zip
Merge branch 'tex_fmoen' of gitlab.com into tex_fmoen
Diffstat (limited to 'src/ft_raycasting.c')
-rw-r--r--src/ft_raycasting.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c
index bf33374..90f6d88 100644
--- a/src/ft_raycasting.c
+++ b/src/ft_raycasting.c
@@ -12,6 +12,16 @@
#include <cub3d.h>
#include <stdint.h>
+#include <stdio.h>
+
+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 >= (float)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++;
}