manque render mur pas fixe
This commit is contained in:
parent
dee20e3897
commit
fab7758283
3 changed files with 6 additions and 7 deletions
9
render.c
9
render.c
|
@ -6,7 +6,7 @@
|
|||
/* By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/14 14:55:05 by greg #+# #+# */
|
||||
/* Updated: 2024/10/17 16:56:10 by grobledo ### ########.fr */
|
||||
/* Updated: 2024/10/17 18:02:06 by grobledo ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -148,16 +148,15 @@ static void draw_vertical_line(int x, u_int32_t *img_data)
|
|||
img_data[y * SCREEN_WIDTH + x] = COLOR_CEILING;
|
||||
else if (y < draw_end)
|
||||
{
|
||||
tex_y = ((y - draw_start) * g_tex.tex_height) / line_height;
|
||||
tex_x = (int)(g_ray.wallx * g_tex.tex_width);
|
||||
tex_y = ((y - (-line_height / 2 + SCREEN_HEIGHT / 2)) * g_tex.tex_height) / line_height;
|
||||
tex_x = (int)(g_ray.wallx * (double)g_tex.tex_width);
|
||||
if (g_ray.side == 0 && g_ray.dir.x > 0)
|
||||
tex_x = g_tex.tex_width - tex_x - 1;
|
||||
if (g_ray.side == 1 && g_ray.dir.y < 0)
|
||||
tex_x = g_tex.tex_width - tex_x - 1;
|
||||
tex_x = g_tex.tex_height - tex_x - 1;
|
||||
u_int32_t *texture_data = (u_int32_t *)mlx_get_data_addr(g_tex.textures[g_tex.tex_dir], &bpp, &size_line, &endian);
|
||||
color = texture_data[tex_x * g_tex.tex_width + tex_y];
|
||||
img_data[y * SCREEN_WIDTH + x] = color;
|
||||
// img_data[y * SCREEN_WIDTH + x] = COLOR_WALL;
|
||||
}
|
||||
else
|
||||
img_data[y * SCREEN_WIDTH + x] = COLOR_FLOOR;
|
||||
|
|
|
@ -4,7 +4,7 @@ NO theimageforthenorthwall
|
|||
C 0,2,67
|
||||
SO SOUTH!!!!!!1
|
||||
WE weeeee
|
||||
111
|
||||
111111111
|
||||
111110111
|
||||
10000N001
|
||||
111110111
|
||||
|
|
2
utils2.c
2
utils2.c
|
@ -6,7 +6,7 @@
|
|||
/* By: grobledo <grobledo@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/17 01:57:03 by greg #+# #+# */
|
||||
/* Updated: 2024/10/17 14:58:33 by grobledo ### ########.fr */
|
||||
/* Updated: 2024/10/17 17:39:18 by grobledo ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue