fdf/inc/fdf.h
2017-03-05 19:00:05 +02:00

97 lines
1.6 KiB
C

// C/C++ File
// AUTHOR: fotonmootn
// FILE: inc/fdf.h
// ROLE: to rule them all
// CREATED: 2017-02-13 20:07:04
// MODIFIED: 2017-02-18 01:11:28
#ifndef FDF_H
# define FDF_H
#include "libft.h"
#include "mlx.h"
#include <math.h>
#include <fcntl.h>
#include <stdio.h>
typedef struct s_vec
{
double x;
double y;
double z;
} t_vec;
typedef struct s_pnt
{
int x;
int y;
int color;
} t_pnt;
typedef struct s_mlx
{
void *mlx;
void *win;
} t_mlx;
typedef struct s_map
{
t_list *lst_map;
t_pnt **arr_pnt;
int width;
int height;
} t_map;
typedef struct s_mat4
{
double mx[4][4];
} t_mat4;
typedef struct s_trnsf
{
t_mat4 *tr;
t_mat4 *xr;
t_mat4 *yr;
t_mat4 *zr;
t_mat4 *fin;
} t_trnsf;
typedef struct s_swap
{
int swap_x;
int swap_coord;
} t_swap;
//delete
typedef struct s_edg
{
int p1;
int p2;
} t_edg;
void line(t_pnt p1, t_pnt p2, t_mlx *m);
t_map *map_init(char *path);
void pnt_init(t_map *map);
t_mat4 *mat4_init(void);
t_mat4 *mat4_mult(t_mat4 *m1, t_mat4 *m2);
void mat4_translate(t_mat4 *m, double x, double y, double z);
void mat4_scale(t_mat4 *m, double x, double y, double z);
void mat4_z_rot(t_mat4 *m, double angle);
void mat4_x_rot(t_mat4 *m, double angle);
void mat4_y_rot(t_mat4 *m, double angle);
void vec_mat_mult(t_mat4 *m, t_vec *v, t_pnt *result);
void map_transform(t_map *map);
void transform(t_mat4 *mat, t_map *map);
void perspective_transform(t_map *map, t_mlx *mlx);
void render(t_map *map, t_mlx *m, int x, int y);
void free_tab(char **tab);
void quit(t_mlx *m);
#endif