2023-03-24 22:14:43 +08:00
|
|
|
|
#ifndef HGL_GRAPH_RENDER_LIST_2D_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_RENDER_LIST_2D_INCLUDE
|
2023-03-23 21:43:10 +08:00
|
|
|
|
|
|
|
|
|
#include<hgl/graph/VK.h>
|
|
|
|
|
#include<hgl/graph/SceneNode.h>
|
2023-03-24 22:14:43 +08:00
|
|
|
|
#include<hgl/graph/RenderNode2D.h>
|
2023-03-23 21:43:10 +08:00
|
|
|
|
#include<hgl/graph/VKArrayBuffer.h>
|
2023-03-24 22:14:43 +08:00
|
|
|
|
#include<hgl/graph/VKMaterial.h>
|
2023-03-23 21:43:10 +08:00
|
|
|
|
namespace hgl
|
|
|
|
|
{
|
|
|
|
|
namespace graph
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* 渲染对象列表<br>
|
|
|
|
|
* 已经展开的渲染对象列表,产生mvp用UBO/SSBO等数据,最终创建RenderCommandBuffer
|
|
|
|
|
*/
|
2023-03-24 22:14:43 +08:00
|
|
|
|
class RenderList2D
|
2023-03-23 21:43:10 +08:00
|
|
|
|
{
|
|
|
|
|
protected:
|
|
|
|
|
|
2023-03-24 22:14:43 +08:00
|
|
|
|
GPUDevice * device;
|
|
|
|
|
RenderCmdBuffer * cmd_buf;
|
2023-03-23 21:43:10 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
2023-03-24 22:14:43 +08:00
|
|
|
|
// GPUArrayBuffer * mvp_array;
|
|
|
|
|
|
|
|
|
|
RenderNode2DList render_node_list; ///<场景节点列表
|
|
|
|
|
MaterialSets material_sets; ///<材质合集
|
2023-03-23 21:43:10 +08:00
|
|
|
|
|
2023-03-24 22:14:43 +08:00
|
|
|
|
RenderNode2DComparator render_node_comparator;
|
2023-03-23 21:43:10 +08:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
List<Renderable *> ri_list;
|
|
|
|
|
|
|
|
|
|
VkDescriptorSet ds_list[DESCRIPTOR_SET_TYPE_COUNT];
|
|
|
|
|
DescriptorSet *renderable_desc_sets;
|
|
|
|
|
|
|
|
|
|
uint32_t ubo_offset;
|
|
|
|
|
uint32_t ubo_align;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual bool Begin();
|
2023-03-24 22:14:43 +08:00
|
|
|
|
virtual bool ExpendNode(SceneNode *);
|
2023-03-23 21:43:10 +08:00
|
|
|
|
virtual void End();
|
|
|
|
|
|
2023-03-28 21:52:08 +08:00
|
|
|
|
bool BindPerFrameDescriptor();
|
|
|
|
|
bool BindPerMaterialDescriptor();
|
|
|
|
|
|
2023-03-23 21:43:10 +08:00
|
|
|
|
private:
|
|
|
|
|
|
2023-03-28 21:52:08 +08:00
|
|
|
|
Material * last_mtl;
|
2023-03-23 21:43:10 +08:00
|
|
|
|
Pipeline * last_pipeline;
|
|
|
|
|
MaterialParameters *last_mp[DESCRIPTOR_SET_TYPE_COUNT];
|
|
|
|
|
uint32_t last_vbo;
|
|
|
|
|
|
|
|
|
|
void Render(Renderable *);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2023-03-24 22:14:43 +08:00
|
|
|
|
RenderList2D(GPUDevice *);
|
|
|
|
|
virtual ~RenderList2D();
|
2023-03-23 21:43:10 +08:00
|
|
|
|
|
|
|
|
|
virtual bool Expend(SceneNode *);
|
|
|
|
|
|
2023-03-24 22:14:43 +08:00
|
|
|
|
virtual bool Render(RenderCmdBuffer *);
|
|
|
|
|
};//class RenderList2D
|
2023-03-23 21:43:10 +08:00
|
|
|
|
}//namespace graph
|
|
|
|
|
}//namespace hgl
|
2023-03-24 22:14:43 +08:00
|
|
|
|
#endif//HGL_GRAPH_RENDER_LIST_2D_INCLUDE
|