#ifndef ENGINE_INCLUDE_SYSTEMS_MESH_RENDER_SYSTEM_H_ #define ENGINE_INCLUDE_SYSTEMS_MESH_RENDER_SYSTEM_H_ #include #include "ecs_system.h" #include "scene.h" #include "gfx.h" namespace engine { struct RenderListEntry { const gfx::Pipeline* pipeline; const gfx::Buffer* vertex_buffer; const gfx::Buffer* index_buffer; const gfx::DescriptorSet* base_colour_texture; glm::mat4 model_matrix; uint32_t index_count; }; using RenderList = std::vector; class MeshRenderSystem : public System { public: MeshRenderSystem(Scene* scene); ~MeshRenderSystem(); void RebuildStaticRenderList(); const RenderList* GetStaticRenderList() const { return &static_render_list_; } const RenderList* GetDynamicRenderList() const { return &dynamic_render_list_; } void OnComponentInsert(uint32_t entity) override; void OnUpdate(float ts) override; private: RenderList static_render_list_; RenderList dynamic_render_list_; bool list_needs_rebuild_ = false; // with_static_entities = false, build list of dynamic meshes // with_static_entities = true, build list of static meshes void BuildRenderList(RenderList& render_list, bool with_static_entities); }; } // namespace engine #endif