fdf/inc/fdf.h

103 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>
# define HEIGHT 500
# define WIDTH 500
typedef struct s_vec
{
double x;
double y;
double z;
int color;
} t_vec;
typedef struct s_pnt
{
int x;
int y;
int z;
int color;
} t_pnt;
typedef struct s_mw
{
void *mlx;
void *win;
} t_mw;
typedef struct s_map
{
t_list *lst_map;
t_pnt **arr_pnt;
int x_max;
int y_max;
int z_max;
} 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_FDF
{
t_map *map;
t_mw *mw;
int w_heigth;
int w_width;
} t_FDF;
typedef struct s_swap
{
int swap_x;
int swap_coord;
} t_swap;
void line(t_pnt p1, t_pnt p2, t_mw *mw);
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 render(t_FDF *FDF);
void free_tab(char **tab);
void quit(t_FDF *FDF);
#endif