ULRE/inc/hgl/graph/RenderList.h

110 lines
2.7 KiB
C
Raw Normal View History

2019-05-25 00:50:04 +08:00
#ifndef HGL_GRAPH_RENDER_LIST_INCLUDE
#define HGL_GRAPH_RENDER_LIST_INCLUDE
#include<hgl/graph/VK.h>
2019-05-25 00:50:04 +08:00
#include<hgl/graph/Camera.h>
#include<hgl/graph/SceneNode.h>
2021-06-10 18:56:23 +08:00
#include<hgl/graph/RenderNode.h>
#include<hgl/graph/VKArrayBuffer.h>
2021-05-24 20:44:20 +08:00
#include<hgl/graph/SceneInfo.h>
#include<hgl/color/Color4f.h>
2022-02-08 11:12:17 +08:00
#include<hgl/type/SortedSets.h>
2019-05-25 00:50:04 +08:00
namespace hgl
{
namespace graph
{
2022-02-08 11:12:17 +08:00
using MaterialSets=SortedSets<Material *>;
2021-04-30 18:56:20 +08:00
/**
* <br>
* mvp用UBO/SSBO等数据RenderCommandBuffer
*/
2019-05-25 00:50:04 +08:00
class RenderList
{
2023-03-22 21:19:23 +08:00
protected:
GPUDevice * device;
RenderCmdBuffer *cmd_buf;
2019-05-25 00:50:04 +08:00
private:
RenderNodeList render_node_list; ///<场景节点列表
MaterialSets material_sets; ///<材质合集
2023-03-23 21:43:10 +08:00
RenderNodeComparator *render_node_comparator;
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();
virtual bool Expend(SceneNode *);
virtual void End();
private:
2019-05-25 00:50:04 +08:00
2020-10-21 12:47:06 +08:00
Pipeline * last_pipeline;
MaterialParameters *last_mp[DESCRIPTOR_SET_TYPE_COUNT];
uint32_t last_vbo;
2019-05-25 00:50:04 +08:00
void Render(Renderable *);
2019-05-25 00:50:04 +08:00
public:
RenderList(GPUDevice *);
virtual ~RenderList();
virtual bool Expend(const CameraInfo &,SceneNode *);
virtual bool Render(RenderCmdBuffer *);
};//class RenderList
2023-03-22 21:19:23 +08:00
class RenderList2D:public RenderList
{
2023-03-23 21:43:10 +08:00
protected:
virtual bool Begin() override;
virtual bool Expend(SceneNode *) override;
virtual void End() override;
public:
RenderList2D();
virtual ~RenderList2D() override;
virtual bool Expend(SceneNode *);
2023-03-22 21:19:23 +08:00
};
class RenderList3D:public RenderList
{
protected:
CameraInfo camera_info;
GPUArrayBuffer *mvp_array;
protected:
virtual bool Begin() override;
virtual bool Expend(SceneNode *) override;
virtual void End() override;
public:
RenderList3D();
virtual ~RenderList3D() override;
2023-03-23 21:43:10 +08:00
bool Expend(const CameraInfo &,SceneNode *);
2023-03-22 21:19:23 +08:00
};
2019-05-25 00:50:04 +08:00
}//namespace graph
}//namespace hgl
#endif//HGL_GRAPH_RENDER_LIST_INCLUDE