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.
 
 
 

56 lines
1.3 KiB

#pragma once
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "mesh.h"
#include "render_group.h"
// NOTE: an entity is the basic unit of the high level renderer interface
struct entity
{
// NOTE: glm::mat4 combines translation, scale, and rotation in a 4x4
// transform matrix. This is the equivalent of the 'model' matrix in
// the model, view, projection matrix composition
glm::mat4 world_transform;
// TODO: should be a pointer into a global array of mesh_info(s) or
// mesh_groups stored on the render_state object
meMeshGroup mesh_group;
// NOTE: an array of render objects with all the vertex, normal, and uv
// data loaded from assimp
render_object* ren_objects;
uint ren_object_count;
//render_group* ren_group;
};
// NOTE: an entity group is an array of entities rendered with the same shader
// program
struct entity_group
{
entity* entities;
uint entity_count;
rg_shader_program shader_prg;
};
inline void
entTranslate(entity& e, glm::vec3 v)
{
e.world_transform = glm::translate(e.world_transform, v);
}
inline void
entScale(entity& e, glm::vec3 v)
{
e.world_transform = glm::scale(e.world_transform, v);
}
bool entInit(entity& e, const char* model_path, rg_shader_program& shader);
void entFree(entity& e);
void entSetWorldPosition(entity& e, float x, float y, float z);