wip solving buble effect by wall height calculation
This commit is contained in:
@@ -57,6 +57,7 @@ static void wall_height(t_rcast *rcast)
|
||||
{
|
||||
int height;
|
||||
|
||||
/*
|
||||
height = rcast->screen_height * (rcast->hor - rcast->ray_len) / rcast->hor;
|
||||
|
||||
if (height < 0)
|
||||
@@ -66,6 +67,16 @@ static void wall_height(t_rcast *rcast)
|
||||
|
||||
rcast->wall.start.y = rcast->screen_height / 2 + height / 2;
|
||||
rcast->wall.end.y = rcast->screen_height / 2 - height / 2;
|
||||
*/
|
||||
if (rcast->ray_len)
|
||||
height = rcast->screen_height / rcast->ray_len;
|
||||
|
||||
rcast->wall.start.y = -height / 2 + rcast->screen_height / 2;
|
||||
if (rcast->wall.start.y < 0)
|
||||
rcast->wall.start.y = 0;
|
||||
rcast->wall.end.y = height / 2 + rcast->screen_height / 2;
|
||||
if (rcast->wall.end.y >= rcast->screen_height)
|
||||
rcast->wall.end.y = rcast->screen_height;
|
||||
}
|
||||
|
||||
void draw_column(t_game *game, t_rcast *rcast)
|
||||
|
||||
Reference in New Issue
Block a user