scop/src/env.c

56 lines
1.7 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* env.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbrochar <gbrochar@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/12/22 18:56:21 by gbrochar #+# #+# */
/* Updated: 2020/12/22 19:07:24 by gbrochar ### ########.fr */
/* */
/* ************************************************************************** */
#include "scop.h"
void free_env(t_env *e)
{
free(e->file_name);
free(e->object.vertices.data);
free(e->object.uvs.data);
free(e->object.normals.data);
free(e->object.indices.data);
}
void init_window(t_env *e)
{
e->window.width = 640;
e->window.height = 480;
}
void init_camera(t_env *e)
{
e->camera.fov = 45;
e->camera.near = 0.001;
e->camera.far = 1000;
e->camera.aspect = 1;
}
void init_object(t_env *e)
{
e->object.vertices.data = (double *)malloc(sizeof(double) * 4096);
e->object.uvs.data = (double *)malloc(sizeof(double) * 4096);
e->object.normals.data = (double *)malloc(sizeof(double) * 4096);
e->object.indices.data = (short *)malloc(sizeof(short) * 4096);
e->object.vertices_ptr = 0;
e->object.uvs_ptr = 0;
e->object.normals_ptr = 0;
e->object.indices_ptr = 0;
}
void init_env(t_env *e)
{
init_window(e);
init_camera(e);
init_object(e);
}