diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_raycasting.c | 4 | ||||
-rw-r--r-- | src/ft_tex_init.c | 10 |
2 files changed, 3 insertions, 11 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index 7ce45d5..26a3ec9 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -26,7 +26,8 @@ void clist->rlist.wall_hit_x = clist->plist->pos_x + clist->rlist.wall_dist * clist->rlist.x_ray_dir; clist->rlist.wall_hit_x -= floor(clist->rlist.wall_hit_x); - /*clist->rlist.tex_x =(int)(clist->rlist.wall_hit_x * clist->tlist[clist->w_side].img_w);*/ + clist->rlist.tex_x = (clist->rlist.wall_hit_x * (double)clist->tlist[clist->w_side].img_w); + printf("wall_hit_x : %f\ntex_x : %d\nimg_w : %d\n", clist->rlist.wall_hit_x, clist->rlist.tex_x, clist->tlist[clist->w_side].img_w); } static void @@ -65,6 +66,7 @@ void i = 0; wl = cl->wlist; + ft_wall_tex_init(cl); while (i < wl->x_size) { ft_initray(cl, i); diff --git a/src/ft_tex_init.c b/src/ft_tex_init.c index 166f431..724877f 100644 --- a/src/ft_tex_init.c +++ b/src/ft_tex_init.c @@ -23,15 +23,6 @@ ** 4 : sprite */ -void ft_puttex(t_cub *cl) -{ - int i; - - i = 0; - while (i < cl->tlist[0].img_w) - i += 4; -} - void ft_wall_tex_init(t_cub *cl) { cl->tlist[0].img = mlx_xpm_file_to_image(cl->wlist->wlx, @@ -54,5 +45,4 @@ void ft_wall_tex_init(t_cub *cl) cl->mlist->sprite_path, &cl->tlist[4].img_w, &cl->tlist[4].img_h); cl->tlist[4].ptr = mlx_get_data_addr(cl->tlist[4].img, &cl->tlist[4].bpp, &cl->tlist[4].sizeline, &cl->tlist[4].endian); - ft_puttex(cl); } |