diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2020-02-20 04:23:50 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2020-02-20 04:23:50 +0100 |
commit | 2082e311ed02aac56a0eeb0b8b610b3ab2dc2518 (patch) | |
tree | 274bbdbdf5ab9dc51f3c9e882d5e5bbc39f6b87f /src/ft_raycasting.c | |
parent | :^)))))))))))))))))))))))))))) (diff) | |
download | 42-cub3d-2082e311ed02aac56a0eeb0b8b610b3ab2dc2518.tar.gz 42-cub3d-2082e311ed02aac56a0eeb0b8b610b3ab2dc2518.tar.bz2 42-cub3d-2082e311ed02aac56a0eeb0b8b610b3ab2dc2518.tar.xz 42-cub3d-2082e311ed02aac56a0eeb0b8b610b3ab2dc2518.tar.zst 42-cub3d-2082e311ed02aac56a0eeb0b8b610b3ab2dc2518.zip |
asd works cool
Diffstat (limited to 'src/ft_raycasting.c')
-rw-r--r-- | src/ft_raycasting.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/ft_raycasting.c b/src/ft_raycasting.c index 1ad16e1..0c00a87 100644 --- a/src/ft_raycasting.c +++ b/src/ft_raycasting.c @@ -13,17 +13,16 @@ #include <libft.h> #include <cub3d.h> #include <stdint.h> -#include <stdio.h> #include <math.h> void ft_calc_tex(t_cub *clist) { if (clist->rlist.side == 0) - clist->rlist.wall_hit_x = clist->plist->pos_y + + clist->rlist.wall_hit_x = (clist->plist->pos_x - clist->plist->start_x) + clist->rlist.wall_dist * clist->rlist.y_ray_dir; else - clist->rlist.wall_hit_x = clist->plist->pos_x + + clist->rlist.wall_hit_x = (clist->plist->pos_y - clist->plist->start_y) + clist->rlist.wall_dist * clist->rlist.x_ray_dir; clist->rlist.wall_hit_x -= floor(clist->rlist.wall_hit_x); clist->tlist[clist->w_side].tex_x = (int)(clist->rlist.wall_hit_x * @@ -31,10 +30,9 @@ void if (clist->rlist.side == 0 && clist->rlist.x_ray_dir > 0) clist->tlist[clist->w_side].tex_x = clist->tlist[clist->w_side].img_w - clist->tlist[clist->w_side].tex_x - 1; - if (clist->rlist.side == 1 && clist->rlist.y_ray_dir < 0) + else if (clist->rlist.side == 1 && clist->rlist.y_ray_dir < 0) clist->tlist[clist->w_side].tex_x = clist->tlist[clist->w_side].img_w - clist->tlist[clist->w_side].tex_x - 1; - printf("dir :%f\ntex_x : %d\n", clist->rlist.y_ray_dir, clist->tlist[clist->w_side].tex_x); } static void |