add t_point_2d and fdf struct, and tweaked map struct
This commit is contained in:
parent
33f398bd60
commit
0cb11a2bbe
53
inc/fdf.h
53
inc/fdf.h
@ -22,37 +22,64 @@
|
|||||||
# include "libft.h"
|
# include "libft.h"
|
||||||
# include "MLX42.h"
|
# include "MLX42.h"
|
||||||
|
|
||||||
#define WRONG_LINE_LENGTH "Error: wrong line length. Expected %d, got %d in line nr %d\n"
|
# define WRONG_LINE_LENGTH "Error: wrong line length. \
|
||||||
#define MALLOC_ERROR "Error: malloc failed\n"
|
Expected %d, got %d in line nr %d\n"
|
||||||
#define FILE_ERROR "Error: could not open file %s\n"
|
# define MALLOC_ERROR "Error: malloc failed\n"
|
||||||
#define USAGE_ERROR "Usage: %s <filename>\n"
|
# define FILE_ERROR "Error: could not open file %s\n"
|
||||||
|
# define USAGE_ERROR "Usage: %s <filename>\n"
|
||||||
|
|
||||||
#define WIDTH 1024
|
# define WIDTH 1500
|
||||||
#define HEIGHT 1024
|
# define HEIGHT 1500
|
||||||
|
|
||||||
typedef struct s_point
|
typedef struct s_point_3d
|
||||||
{
|
{
|
||||||
double x;
|
double x;
|
||||||
double y;
|
double y;
|
||||||
double z;
|
double z;
|
||||||
} t_point;
|
int color;
|
||||||
|
} t_point_3d;
|
||||||
|
|
||||||
|
typedef struct s_point_2d
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
int color;
|
||||||
|
} t_point_2d;
|
||||||
|
|
||||||
|
|
||||||
typedef struct s_map
|
typedef struct s_map
|
||||||
{
|
{
|
||||||
t_point *points;
|
t_point_3d *points;
|
||||||
|
t_point_2d *projected;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int z_max;
|
int z_max;
|
||||||
} t_map;
|
} t_map;
|
||||||
|
|
||||||
|
typedef struct s_fdf
|
||||||
|
{
|
||||||
|
t_map *map;
|
||||||
|
mlx_t *mlx;
|
||||||
|
mlx_image_t *img;
|
||||||
|
double angle_x;
|
||||||
|
double angle_y;
|
||||||
|
double angle_z;
|
||||||
|
double zoom;
|
||||||
|
int offset_x;
|
||||||
|
int offset_y;
|
||||||
|
double z_scale;
|
||||||
|
} t_fdf;
|
||||||
|
|
||||||
int get_map_sizes(char *filename, t_map *map);
|
int get_map_sizes(char *filename, t_map *map);
|
||||||
void free_line_and_split(char **line, char ***split);
|
void free_line_and_split(char **line, char ***split);
|
||||||
int read_map(char *filename, t_map *map);
|
int read_map(char *filename, t_map *map);
|
||||||
t_map *parse_map(char *filename);
|
t_map *parse_map(char *filename);
|
||||||
void print_map(t_map *map);
|
void print_map(t_map *map);
|
||||||
void rotate_x(t_point **points, double angle, int size);
|
void rotate_x(t_point_3d **points, double angle, int size);
|
||||||
void rotate_y(t_point **points, double angle, int size);
|
void rotate_y(t_point_3d **points, double angle, int size);
|
||||||
void rotate_z(t_point **points, double angle, int size);
|
void rotate_z(t_point_3d **points, double angle, int size);
|
||||||
|
bool fdf_put_pixel(mlx_image_t *img, t_point_2d point);
|
||||||
|
void fdf_draw_line(mlx_image_t *img, t_point_2d start,
|
||||||
|
t_point_2d end);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user