mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 01:48:08 +01:00
fix: fixed norme
This commit is contained in:
parent
e28cd1c85b
commit
f21b8dc448
4 changed files with 22 additions and 21 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/17 14:54:36 by kcolin #+# #+# */
|
||||
/* Updated: 2025/07/29 14:28:45 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/07/30 16:38:32 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -32,6 +32,7 @@ extern const float g_southeast;
|
|||
# define MOVEMENT_SPEED 0.1
|
||||
# define ROTATION_SPEED 0.1
|
||||
# define PLANE_VALUE 0.66
|
||||
# define TEXTURE_SIZE 64
|
||||
# ifdef BONUS
|
||||
# define COMPILED_TEXT "Compiled with bonuses"
|
||||
# else
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre. +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/29 11:32:20 by tchampio #+# #+# */
|
||||
/* Updated: 2025/07/29 11:35:17 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/07/30 16:39:24 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/30 12:50:10 by tchampio #+# #+# */
|
||||
/* Updated: 2025/07/30 16:22:42 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/07/30 16:38:59 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -30,7 +30,6 @@ int get_cardinal(t_ray *ray)
|
|||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -47,20 +46,20 @@ void render_walls(t_cub3d_data *data, t_ray *ray, int x)
|
|||
unsigned int color;
|
||||
double step;
|
||||
double pos;
|
||||
static int texture_size = 64; // to be changed in favor of a const
|
||||
|
||||
dir = get_cardinal(ray);
|
||||
tex_x = (int)(ray->wall_x * texture_size);
|
||||
if ((ray->side == 0 && ray->dir_x < 0) || (ray->side == 1 && ray->dir_y > 0))
|
||||
tex_x = texture_size - tex_x - 1;
|
||||
step = 1.0 * texture_size / ray->wall_height;
|
||||
tex_x = (int)(ray->wall_x * TEXTURE_SIZE);
|
||||
if ((ray->side == 0 && ray->dir_x < 0)
|
||||
|| (ray->side == 1 && ray->dir_y > 0))
|
||||
tex_x = TEXTURE_SIZE - tex_x - 1;
|
||||
step = 1.0 * TEXTURE_SIZE / ray->wall_height;
|
||||
pos = (ray->draw_start - HEIGHT / 2 + ray->wall_height / 2) * step;
|
||||
while (ray->draw_start < ray->draw_end)
|
||||
{
|
||||
pos += step;
|
||||
color = 0x0000ff;
|
||||
(void)dir; // cc complains otherwise
|
||||
(void)pos; // cc complains otherwise
|
||||
(void)dir;
|
||||
(void)pos;
|
||||
data->screen_matrix[ray->draw_start][x] = color;
|
||||
ray->draw_start++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: tchampio <tchampio@student.42lehavre.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/07/30 14:53:39 by tchampio #+# #+# */
|
||||
/* Updated: 2025/07/30 16:21:18 by tchampio ### ########.fr */
|
||||
/* Updated: 2025/07/30 16:39:51 by tchampio ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -46,7 +46,8 @@ void matrix_to_image(t_cub3d_data *data)
|
|||
while (x < WIDTH)
|
||||
{
|
||||
if (data->screen_matrix[y][x] > 0)
|
||||
my_mlx_pixel_put(data->img_data, x, y, data->screen_matrix[y][x]);
|
||||
my_mlx_pixel_put(data->img_data,
|
||||
x, y, data->screen_matrix[y][x]);
|
||||
x++;
|
||||
}
|
||||
y++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue