mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
feat: floor and ceiling colors
This commit is contained in:
parent
c242df5b72
commit
c4bb3efe3e
2 changed files with 18 additions and 6 deletions
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue