feat: floor and ceiling colors

This commit is contained in:
Khaïs COLIN 2025-08-05 14:55:41 +02:00
parent c242df5b72
commit c4bb3efe3e
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
2 changed files with 18 additions and 6 deletions

View file

@ -3,8 +3,8 @@ SO ressources/south.xpm
WE ressources/west.xpm WE ressources/west.xpm
EA ressources/east.xpm EA ressources/east.xpm
F 220,100,0 F 220,100,100
C 225,30,0 C 20,30,0
1111111111111111111111111 1111111111111111111111111
1000000000110000000000001 1000000000110000000000001

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */ /* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/31 13:17:39 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; unsigned int color;
double step; double step;
double tex_y; double tex_y;
int y;
step = 1.0 * TEXTURE_SIZE / ray->wall_height; step = 1.0 * TEXTURE_SIZE / ray->wall_height;
tex_y = (ray->draw_start - HEIGHT / 2 + ray->wall_height / 2) * step; 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; tex_y += step;
color = get_color(data, ray, (int)tex_y); color = get_color(data, ray, (int)tex_y);
matrix_set(data, x, ray->draw_start, color); matrix_set(data, x, y, color);
ray->draw_start++; y++;
}
while (y < HEIGHT)
{
matrix_set(data, x, y, data->map->f_color);
y++;
} }
} }