63 lines
1.9 KiB
C
63 lines
1.9 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* algo.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: greg <greg@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/09/30 15:45:59 by grobledo #+# #+# */
|
|
/* Updated: 2024/10/11 04:32:39 by greg ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef ALGO_H
|
|
#define ALGO_H
|
|
|
|
#include <unistd.h>
|
|
#include <math.h>
|
|
#include "Minilibx/mlx.h"
|
|
#include "Minilibx/mlx_int.h"
|
|
# include "Libft/libft.h"
|
|
#define mapWidth 24
|
|
#define mapHeight 24
|
|
|
|
typedef struct s_ray
|
|
{
|
|
// pos player on map
|
|
double posX;
|
|
double posY;
|
|
// orientation player on map
|
|
double dirX;
|
|
double dirY;
|
|
// orientation cam on map
|
|
double planeX;
|
|
double planeY;
|
|
// camera pos
|
|
double cameraX;
|
|
// direction rayon
|
|
double raydirX;
|
|
double raydirY;
|
|
// longueur du rayon entre pos actuelle et pos du prochain cote d'une box
|
|
double sidedistX;
|
|
double sidedistY;
|
|
// longueur du rayon entre pos d'un cote d'une box jusqu'a pos du prochain cote d'une box
|
|
double deltadistX;
|
|
double deltadistY;
|
|
// calcul lenght of ray (shortest perpendicular distance between wall and camera plane)
|
|
double perpwalldist;
|
|
// step direction (can be -1 or +1)
|
|
int stepX;
|
|
int stepY;
|
|
double movespeed;
|
|
double rotspeed;
|
|
double oldDirX;
|
|
double oldPlaneX;
|
|
void *mlx_ptr;
|
|
void *win_ptr;
|
|
void *img_ptr;
|
|
int *img_data;
|
|
int mapX;
|
|
int mapY;
|
|
} t_ray;
|
|
|
|
#endif
|