|
|
|
@ -29,6 +29,7 @@ struct Entity |
|
|
|
{ |
|
|
|
{ |
|
|
|
u32 num_meshes; |
|
|
|
u32 num_meshes; |
|
|
|
GLmesh* meshes; |
|
|
|
GLmesh* meshes; |
|
|
|
|
|
|
|
GLTexture* diffuse_texture; // NOTE: pointer into gl_ctx->textures array
|
|
|
|
glm::mat4* xform; |
|
|
|
glm::mat4* xform; |
|
|
|
char* name; |
|
|
|
char* name; |
|
|
|
}; |
|
|
|
}; |
|
|
|
@ -156,23 +157,6 @@ getFreeRenderGroup(RenderState* rs) |
|
|
|
return nullptr; |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_SHADER_COUNT 64 |
|
|
|
|
|
|
|
#define DEFAULT_UBO_COUNT 32 |
|
|
|
|
|
|
|
GLContext* |
|
|
|
|
|
|
|
initGLContext(memory_arena* arena) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GLContext* gl_ctx = ARENA_ALLOC(arena, GLContext, 1); |
|
|
|
|
|
|
|
gl_ctx->max_shaders = DEFAULT_SHADER_COUNT; |
|
|
|
|
|
|
|
gl_ctx->num_shaders = 0; |
|
|
|
|
|
|
|
gl_ctx->shaders = ARENA_ALLOC(arena, shader_program, DEFAULT_SHADER_COUNT); |
|
|
|
|
|
|
|
gl_ctx->max_ubos = DEFAULT_UBO_COUNT; |
|
|
|
|
|
|
|
gl_ctx->num_ubos = 0; |
|
|
|
|
|
|
|
gl_ctx->uniform_buffers = ARENA_ALLOC(arena, gl_buffer, gl_ctx->max_ubos); |
|
|
|
|
|
|
|
gl_ctx->binding_count = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return gl_ctx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_MODEL_COUNT 256 |
|
|
|
#define DEFAULT_MODEL_COUNT 256 |
|
|
|
#define DEFAULT_TEXTURE_COUNT 64 |
|
|
|
#define DEFAULT_TEXTURE_COUNT 64 |
|
|
|
Assets* |
|
|
|
Assets* |
|
|
|
@ -188,6 +172,22 @@ initAssets(memory_arena* arena, |
|
|
|
return assets; |
|
|
|
return assets; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_SHADER_COUNT 64 |
|
|
|
|
|
|
|
#define DEFAULT_UBO_COUNT 32 |
|
|
|
|
|
|
|
GLContext* |
|
|
|
|
|
|
|
initGLContext(memory_arena* arena) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GLContext* gl_ctx = ARENA_ALLOC(arena, GLContext, 1); |
|
|
|
|
|
|
|
gl_ctx->max_shaders = DEFAULT_SHADER_COUNT; |
|
|
|
|
|
|
|
gl_ctx->shaders = ARENA_ALLOC(arena, shader_program, DEFAULT_SHADER_COUNT); |
|
|
|
|
|
|
|
gl_ctx->max_ubos = DEFAULT_UBO_COUNT; |
|
|
|
|
|
|
|
gl_ctx->uniform_buffers = ARENA_ALLOC(arena, gl_buffer, gl_ctx->max_ubos); |
|
|
|
|
|
|
|
gl_ctx->max_textures = DEFAULT_TEXTURE_COUNT; |
|
|
|
|
|
|
|
gl_ctx->textures = ARENA_ALLOC(arena, GLTexture, gl_ctx->max_textures); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return gl_ctx; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#define DEFAULT_RENDER_GROUP_COUNT 256 |
|
|
|
#define DEFAULT_RENDER_GROUP_COUNT 256 |
|
|
|
RenderState* |
|
|
|
RenderState* |
|
|
|
initRenderState() |
|
|
|
initRenderState() |
|
|
|
|