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

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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++;
}
}