visual 3d with buble effect and rays for slope null

This commit is contained in:
hugogogo
2022-04-25 13:17:55 +02:00
parent 0d9e5879c0
commit ef4cc1a996
2 changed files with 10 additions and 1 deletions

View File

@@ -38,9 +38,18 @@ static void calcul_wall(t_rcast *rcast)
rcast->wall.start.x = rcast->ray_nb;
rcast->wall.end.x = rcast->ray_nb;
if (rcast->is_x == 1 && rcast->slope_y != 0)
{
length = (rcast->next_x - rcast->ray_step_x) / ft_abs(rcast->slope_y);
length = (double)length * (double)rcast->screen_dist.end.y / (double)rcast->slope_x;
// length = (rcast->next_x - rcast->ray_step_x) / ft_abs(rcast->slope_y);
}
if (rcast->is_x == 0 && rcast->slope_x != 0)
{
length = (rcast->next_y - rcast->ray_step_y) / ft_abs(rcast->slope_x);
length = (double)length * (double)rcast->screen_dist.end.y / (double)rcast->slope_y;
// length = (rcast->next_y - rcast->ray_step_y) / ft_abs(rcast->slope_x);
}
length = ft_abs(length);
height = rcast->wall_height - length;
if (height < 0)
height = 0;