#pragma once #include #include #include #include #include #include #include #include "M_shader.h" enum { M_OBJECT_CUBE, M_OBJECT_CUSTOM }; //Temporary type for storing M_Object rotation information, //will get replaced in later revisions. typedef struct { float angle; vec3 direction; } M_Rotation; //Stores information about a 3D model loaded in VRAM typedef struct { int num_indices; unsigned int VAO, VBO, EBO; } M_ViewModel; typedef struct { unsigned short type; M_ViewModel *model; } M_ObjectInfo; //Type meant for handling 3D models in a scene, //stores additional information like a model's position, size and rotation. typedef struct { M_ViewModel *model; M_ShaderProgram *shader; unsigned short type; vec3 pos, size; M_Rotation rotation; mat4 transform; } M_Object; //Creates a M_ViewModel out of vertices and indices manually void M_createViewModel(M_ViewModel *model, int num_vertices, float *vert, int num_indices, unsigned int *indices); //Unloads M_ViewModel from memory when no longer needed void M_killViewModel(M_ViewModel *model); //Loads and creates a M_ViewModel from a 3D object file like .obj M_ViewModel M_loadViewModel(const char* filename); //Creates a M_Object void M_createObject(M_Object *obj, M_ObjectInfo object_info); //Functions for moving, scaling and rotating M_Object void M_moveObject(M_Object *obj, vec3 pos); void M_scaleObject(M_Object *obj, vec3 scale); void M_rotateObject(M_Object *obj, float angle, vec3 direction); //Updates M_Object transform matrix manually void M_updateObjectTransform(M_Object *obj); //Binds M_ViewModel for drawing void M_bindViewModel(M_ViewModel *model);