suppression of the map view

This commit is contained in:
hugogogo
2022-05-02 09:39:03 +02:00
parent a2e4db41a9
commit a6fd2df6d5
7 changed files with 5 additions and 158 deletions

View File

@@ -1,35 +1,5 @@
#include "cube3d.h"
// tmp, to draw rays
static void calcul_ray_end(t_rcast *rcast, t_vec *ray)
{
if (rcast->is_x)
{
ray->end.x = rcast->cell_x * rcast->cell;
if (rcast->ray_sign_x == 1)
ray->end.x += rcast->cell;
if (rcast->slope_x)
{
rcast->ratio = (double)(ray->end.x - ray->start.x);
rcast->ratio /= (double)rcast->slope_x;
ray->end.y = ray->start.y + (double)rcast->slope_y * rcast->ratio;
}
}
else
{
ray->end.y = rcast->cell_y * rcast->cell;
if (rcast->ray_sign_y == 1)
ray->end.y += rcast->cell;
if (rcast->slope_y)
{
rcast->ratio = (double)(ray->end.y - ray->start.y);
rcast->ratio /= (double)rcast->slope_y;
ray->end.x = ray->start.x + (double)rcast->slope_x * rcast->ratio;
}
}
}
// tmp end
static void fill_wall_vector(t_rcast *rcast, int height)
{
if (height < 0)
@@ -51,17 +21,13 @@ static void calcul_wall(t_rcast *rcast)
delta = rcast->next_x - rcast->ray_step_x;
else if (rcast->is_x == 0)
delta = rcast->next_y - rcast->ray_step_y;
if (rcast->ray_nb % 10) printf("delta:%i ", delta);
height = rcast->screen_height * rcast->cell;
if (rcast->slope_x)
height *= rcast->slope_x;
if (rcast->ray_nb % 10) printf("height:%li ", height);
if (rcast->slope_y)
height *= rcast->slope_y;
if (rcast->ray_nb % 10) printf("height:%li ", height);
if (delta && rcast->screen_dist)
height /= (delta * rcast->screen_dist);
if (rcast->ray_nb % 10) printf("height:%li\n", height);
height = ft_abs(height);
fill_wall_vector(rcast, height);
}
@@ -71,16 +37,9 @@ void raycast(t_game *game, t_rcast *rcast)
t_vec ray;
rcast->ray_nb = 0;
printf("\n");
while (rcast->ray_nb <= rcast->screen_width)
{
ray_intersect(game, rcast, &ray);
// tmp, to draw the map
calcul_ray_end(rcast, &ray);
draw_line(&game->map_img, &ray, 0x00FF00FF);
// tmp end
calcul_wall(rcast);
draw_column(game, rcast);
(rcast->ray_nb)++;