56 lines
No EOL
2.2 KiB
C
56 lines
No EOL
2.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* utils2.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* 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 */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
// #include "algo.h"
|
|
|
|
// void ft_init_texture(const double perpwalldist)
|
|
// {
|
|
// if (g_ray.side == 0 && g_ray.dir.x < 0)
|
|
// g_tex.tex_dir = 0;
|
|
// if (g_ray.side == 0 && g_ray.dir.x >= 0)
|
|
// g_tex.tex_dir = 1;
|
|
// if (g_ray.side == 1 && g_ray.dir.y < 0)
|
|
// g_tex.tex_dir = 2;
|
|
// if (g_ray.side == 1 && g_ray.dir.y >= 0)
|
|
// g_tex.tex_dir = 3;
|
|
// if (g_ray.side == 0)
|
|
// g_ray.wallx = g_player.pos.y + perpwalldist
|
|
// * g_ray.dir.y;
|
|
// else
|
|
// g_ray.wallx = g_player.pos.x + perpwalldist
|
|
// * g_ray.dir.x;
|
|
// g_ray.wallx -= floor((g_ray.wallx));
|
|
// }
|
|
|
|
// void *tex_ptr = (int *)mlx_get_data_addr(texture[0].img, &bpp,
|
|
// g_tex, &endian);
|
|
|
|
|
|
// tex_y = ((y - draw_start) * texture_height) / line_height;
|
|
|
|
// tex_x = (int)(wall_x * (double)texture_width);
|
|
// if ((!side && raydir.x > 0) || (side && raydir.y < 0))
|
|
// {
|
|
// tex_x = texture_width - tex_x - 1;
|
|
// }
|
|
|
|
// u_int32_t color = textures[direction][tex_y * texture_width + tex_x];
|
|
|
|
|
|
// 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);
|
|
// u_int32_t *texture_data = (u_int32_t *)g_tex.textures[g_tex.tex_dir];
|
|
// u_int32_t color = texture_data[tex_y * g_tex.tex_width + tex_x];
|
|
// img_data[y * SCREEN_WIDTH + x] = color;
|
|
// }
|