3d view works

This commit is contained in:
hugogogo
2022-05-01 10:46:25 +02:00
parent 853fb39c84
commit 858af3d1c1

View File

@@ -30,7 +30,7 @@
}
// tmp end
static void wall_height(t_rcast *rcast)
static void calcul_wall(t_rcast *rcast)
{
int height;
int delta;
@@ -42,7 +42,10 @@ static void wall_height(t_rcast *rcast)
else if (rcast->is_x == 0)
delta = rcast->next_y - rcast->ray_step_y;
height = rcast->screen_height * rcast->cell;
height *= rcast->slope_y * rcast->slope_x;
if (rcast->slope_x)
height *= rcast->slope_x;
if (rcast->slope_y)
height *= rcast->slope_y;
if (delta && rcast->screen_dist)
height /= (delta * rcast->screen_dist);
@@ -94,7 +97,7 @@ void raycast(t_game *game, t_rcast *rcast)
draw_line(&game->map_img, &ray, 0x00FF00FF);
// tmp end
wall_height(rcast);
calcul_wall(rcast);
draw_column(game, rcast);
(rcast->ray_nb)++;
}