diff --git a/src/main.cpp b/src/main.cpp index f382546..4bede5d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,6 +31,19 @@ struct RenderState Assets* assets; + // FIXME: WIP + // TODO: need to initialize groups + u32 num_render_groups; + u32 max_render_groups; + RenderGroup* render_groups; + + // TODO: need to initialize mappings + u32 num_mappings; + u32 max_mappings; + ShaderToRenderGroupMapping* mappings; + /// + + // TODO: can remove these after implementing render groups u32 num_gl_meshes; u32 max_gl_meshes; GLmesh* gl_meshes; diff --git a/src/shader.h b/src/shader.h index d60abdf..a0b3216 100644 --- a/src/shader.h +++ b/src/shader.h @@ -8,27 +8,6 @@ #include "types.h" -struct gl_buffer -{ - GLuint id; - GLenum target; - GLenum data_type; - GLuint location; // NOTE: if used as backing for vertex attribute - GLuint binding_idx; // NOTE: if used as backing from unifor buffer object - char* name; -}; - -// NOTE: we need another struct for vertex attributes that mirrors gl_buffer -// because an attribute is associated with a shader_programe while a buffer is -// associated with the vertex data passed to glBufferData() -struct GLVertexAttrib -{ - GLenum data_type; - u32 num_components; - GLuint location; - char* name; -}; - struct gl_uniform { // NOTE: would be nice to use idx as the location parameter because it seems @@ -52,6 +31,17 @@ struct GLUniformBlock char* name; }; +// NOTE: we need another struct for vertex attributes that mirrors gl_buffer +// because an attribute is associated with a shader_program while a buffer is +// associated with the vertex data passed to glBufferData() +struct GLVertexAttrib +{ + GLenum data_type; + u32 num_components; + GLuint location; + char* name; +}; + struct shader_program { GLuint prog_id; @@ -71,6 +61,15 @@ struct shader_program u64 hash; // NOTE: hash of vs filpath + fs filepath concat }; +struct gl_buffer +{ + GLuint id; + GLenum target; + GLenum data_type; + GLuint binding_idx; // NOTE: if used as backing from uniform buffer object + char* name; +}; + struct GLContext { GLuint binding_count; @@ -88,6 +87,13 @@ struct GLContext shader_program* shaders; }; +struct GLBufferToAttribMapping +{ + const char* buf_name; + gl_buffer* buf; + GLVertexAttrib* attrib; +}; + struct GLmesh { u32 num_indices; @@ -103,6 +109,13 @@ struct GLmesh shader_program* shader; glm::mat4* model_xform; + // FIXME: WIP + u32 max_vertex_buffers; + u32 num_vertex_buffers; + gl_buffer* vertex_buffers; + // WIP + + // FIXME: replace IDs here with gl_buffer struct array? GLuint vert_buf_id; GLuint norm_buf_id; GLuint uv_buf_id; @@ -110,12 +123,38 @@ struct GLmesh GLuint idx_buf_id; }; +// TODO: node/tree structure for entities +struct Node; + +struct Entity +{ + u32 num_meshes; + GLmesh* meshes; +}; + +struct RenderGroup +{ + u32 num_entites; + u32 max_entities; + Entity* entities; + char* name; +}; + +struct ShaderToRenderGroupMapping +{ + shader_program* shader; + RenderGroup* render_group; +}; + +struct Animation; +#if 0 // NOTE: attempt to resolve GLmesh to shader_program mapping issue struct GLmeshMapping { - u32 mesh_idx; + u32 entity_idx; u32 shader_idx; }; +#endif struct PointLight { @@ -124,10 +163,6 @@ struct PointLight u32 intensity; }; -struct node; -struct entity; -struct animation; - struct transforms { glm::mat4 view_xform;