3d view works
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
// tmp end
|
// tmp end
|
||||||
|
|
||||||
static void wall_height(t_rcast *rcast)
|
static void calcul_wall(t_rcast *rcast)
|
||||||
{
|
{
|
||||||
int height;
|
int height;
|
||||||
int delta;
|
int delta;
|
||||||
@@ -42,7 +42,10 @@ static void wall_height(t_rcast *rcast)
|
|||||||
else if (rcast->is_x == 0)
|
else if (rcast->is_x == 0)
|
||||||
delta = rcast->next_y - rcast->ray_step_y;
|
delta = rcast->next_y - rcast->ray_step_y;
|
||||||
height = rcast->screen_height * rcast->cell;
|
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)
|
if (delta && rcast->screen_dist)
|
||||||
height /= (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);
|
draw_line(&game->map_img, &ray, 0x00FF00FF);
|
||||||
// tmp end
|
// tmp end
|
||||||
|
|
||||||
wall_height(rcast);
|
calcul_wall(rcast);
|
||||||
draw_column(game, rcast);
|
draw_column(game, rcast);
|
||||||
(rcast->ray_nb)++;
|
(rcast->ray_nb)++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user