resolve wall distorsion and lag
This commit is contained in:
@@ -18,12 +18,19 @@ static void calcul_img_column(t_game *game, t_rcast *rcast, t_wall *wall)
|
||||
}
|
||||
}
|
||||
|
||||
static void fill_wall_vector(t_rcast *rcast, int height)
|
||||
static void fill_wall_vector(t_rcast *rcast, t_wall *wall)
|
||||
{
|
||||
int height;
|
||||
|
||||
height = wall->height;
|
||||
if (height < 0)
|
||||
height = 0;
|
||||
wall->limit = 0;
|
||||
if (height > rcast->screen_height)
|
||||
{
|
||||
wall->limit = (height - rcast->screen_height) / 2;
|
||||
height = rcast->screen_height;
|
||||
}
|
||||
rcast->wall.vec.start.y = rcast->screen_height / 2 + height / 2;
|
||||
rcast->wall.vec.end.y = rcast->screen_height / 2 - height / 2;
|
||||
}
|
||||
@@ -46,7 +53,7 @@ static void calcul_wall(t_rcast *rcast)
|
||||
if (rcast->wall.delta && rcast->screen_dist)
|
||||
height /= (rcast->wall.delta * rcast->screen_dist);
|
||||
rcast->wall.height = ft_abs(height);
|
||||
fill_wall_vector(rcast, rcast->wall.height);
|
||||
fill_wall_vector(rcast, &rcast->wall);
|
||||
}
|
||||
|
||||
void raycast(t_game *game, t_rcast *rcast)
|
||||
|
||||
Reference in New Issue
Block a user