A small OpenGL 3+ renderer and game engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
985 B

/*
* mesh.h
* - wrapper for assimp http://www.assimp.org
*/
#pragma once
#include <glm/glm.hpp>
#include "animation.h"
#include "util.h"
#include "util_image.h"
struct meMeshInfo
{
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;
util_image diffuse_texture;
node_animation* node_anim;
};
struct meMeshGroup
{
// TODO: this should be one big allocation since the mesh doesn't change
// while running
meMeshInfo** meshes;
uint num_meshes;
};
bool meInitAssimp();
// 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(meMeshGroup& mesh_group, const char* filepath);
void meFreeMeshGroup(meMeshGroup& mesh_group);
void meShutdownAssimp();