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
1.1 KiB

#pragma once
#include <glm/glm.hpp>
#include "mesh.h"
#include "render_object.h"
enum mesh_group_type
{
DEFAULT_MESHES = 0,
SIMPLE_MESH = 1
};
// TODO: having a separate code path for each shader is annoying and error
// prone. could try using opaque pointers at high level (renderer, entity),
// and then cast to the appropriate render_object/mesh/shader type in the lower
// level functions based on the mesh_type property
struct entity
{
mesh_group_type mesh_type;
simple_mesh mesh;
simple_render_object simple_ro;
GLenum draw_mode;
// TODO: should be a pointer into a global array of mesh_info(s) or
// mesh_groups stored on the render_state object
mesh_group meshes;
render_object* render_objs;
uint ro_count;
};
bool entInitModel(entity& e, const char* model_path);
bool entInitSimpleMesh(entity& e, simple_mesh& mesh, GLenum draw_mode);
void entFree(entity& e);
void entSetWorldPosition(entity& e, glm::vec3 v);
void entTranslate(entity& e, glm::vec3 v);
void entScale(entity& e, glm::vec3 v);
void entRotate(entity& e, float angle, glm::vec3 axis);