Wall orientation and see through wall

This commit is contained in:
Angel Ortigosa Perez
2026-01-25 15:58:40 +01:00
parent ccde6227cb
commit bec53b6484
155 changed files with 55 additions and 37 deletions

14
src/execution/render.c Normal file → Executable file
View File

@@ -6,7 +6,7 @@
/* By: aortigos <aortigos@student.42malaga.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/09 18:42:30 by aortigos #+# #+# */
/* Updated: 2025/12/11 20:02:51 by aortigos ### ########.fr */
/* Updated: 2026/01/25 15:29:56 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
@@ -53,11 +53,23 @@ double get_x_o(mlx_texture_t *texture, t_mlx *mlx)
double x_o;
if (mlx->ray->flag == 1)
{
x_o = (int)fmodf((mlx->ray->horiz_x * (texture->width / WALL_SIZE)),
texture->width);
// Lets invert south wall so we can read text
if (mlx->ray->ray_ngl > 0 && mlx->ray->ray_ngl < M_PI)
x_o = texture->width - x_o - 1;
}
else
{
x_o = (int)fmodf((mlx->ray->vert_y * (texture->width / WALL_SIZE)),
texture->width);
// Invert also east wall
if (mlx->ray->ray_ngl > M_PI / 2
&& mlx->ray->ray_ngl < 3 * M_PI / 2)
x_o = texture->width - x_o - 1;
}
return (x_o);
}