diff --git a/ressources/good_maps/testmap.cub b/ressources/good_maps/testmap.cub index d55c185..62ef140 100644 --- a/ressources/good_maps/testmap.cub +++ b/ressources/good_maps/testmap.cub @@ -3,8 +3,8 @@ SO ressources/south.xpm WE ressources/west.xpm EA ressources/east.xpm -F 220,100,0 -C 225,30,0 +F 220,100,100 +C 20,30,0 1111111111111111111111111 1000000000110000000000001 diff --git a/src/raycast/walls.c b/src/raycast/walls.c index 97adbd7..9616414 100644 --- a/src/raycast/walls.c +++ b/src/raycast/walls.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/31 13:17:39 by kcolin #+# #+# */ -/* Updated: 2025/08/05 13:25:01 by kcolin ### ########.fr */ +/* Updated: 2025/08/05 14:59:24 by kcolin ### ########.fr */ /* */ /* ************************************************************************** */ @@ -70,14 +70,26 @@ void render_walls(t_cub3d_data *data, t_ray *ray, int x) unsigned int color; double step; double tex_y; + int y; step = 1.0 * TEXTURE_SIZE / ray->wall_height; tex_y = (ray->draw_start - HEIGHT / 2 + ray->wall_height / 2) * step; - while (ray->draw_start < ray->draw_end) + y = 0; + while (y < ray->draw_start) + { + matrix_set(data, x, y, data->map->c_color); + y++; + } + while (y < ray->draw_end - 1) { tex_y += step; color = get_color(data, ray, (int)tex_y); - matrix_set(data, x, ray->draw_start, color); - ray->draw_start++; + matrix_set(data, x, y, color); + y++; + } + while (y < HEIGHT) + { + matrix_set(data, x, y, data->map->f_color); + y++; } }