wip solving buble effect by wall height calculation

This commit is contained in:
hugogogo
2022-04-29 09:57:41 +02:00
parent 81aef1eab0
commit 778ddef393
5 changed files with 12 additions and 23 deletions

View File

@@ -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)