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.
 
 
 

57 lines
1.1 KiB

/*
* 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 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;
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;
glm::vec3* vertices;
glm::vec3* vert_colors;
uint num_vertices;
};
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(mesh_group& mesh_group, const char* filepath);
void meFreeMeshGroup(mesh_group& mesh_group);
void meFreeSimpleMesh(simple_mesh& mesh);
void meShutdownAssimp();