/* * mesh.h * - wrapper for assimp http://www.assimp.org */ #pragma once #include #include "animation.h" #include "util.h" #include "util_image.h" struct mesh_info { glm::mat4 model_transform; // NOTE: vertices, normals, and tex_coords have the same count uint num_vertices; glm::vec3* vertices; glm::vec3* normals; glm::vec3* texture_coords; // NOTE: stay aligned with other buffers uint num_indices; uint* indices; // FIXME: WTF? why are we storing a copy of the texture on each mesh_info // instead of once per mesh_group? util_image diffuse_texture; node_animation* node_anim; }; struct mesh_group { // TODO: this should be one big allocation since the mesh doesn't change // while running mesh_info** meshes; uint num_meshes; }; struct simple_mesh { glm::mat4 model_transform; uint num_vertices; glm::vec3* vertices; glm::vec3* vert_colors; }; // NOTE: meshes loaded from assimp require texture coordinates, and a diffuse // texture, which can be a seperate file, or embedded in the input file bool meLoadFromFile(mesh_group& mesh_group, const char* filepath); simple_mesh* meInitMesh(uint num_vertices); void meFreeMeshGroup(mesh_group& mesh_group); void meFreeSimpleMesh(simple_mesh* mesh); void meShutdownAssimp();