2019-05-25 00:50:04 +08:00
|
|
|
|
#ifndef HGL_GRAPH_RENDER_LIST_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_RENDER_LIST_INCLUDE
|
|
|
|
|
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VK.h>
|
2019-05-27 16:54:08 +08:00
|
|
|
|
#include<hgl/graph/SceneNode.h>
|
2023-06-01 15:08:45 +08:00
|
|
|
|
#include<hgl/graph/MaterialRenderMap.h>
|
2021-04-26 20:36:56 +08:00
|
|
|
|
#include<hgl/graph/VKArrayBuffer.h>
|
2023-03-25 15:47:08 +08:00
|
|
|
|
#include<hgl/graph/VKMaterial.h>
|
2019-05-25 00:50:04 +08:00
|
|
|
|
namespace hgl
|
|
|
|
|
{
|
|
|
|
|
namespace graph
|
|
|
|
|
{
|
2021-04-30 18:56:20 +08:00
|
|
|
|
/**
|
|
|
|
|
* 渲染对象列表<br>
|
2023-05-07 01:07:26 +08:00
|
|
|
|
* 该类会长期保存使用过的材质信息,避重新分配造成的时间和空间浪费。如需彻底清空列表请使用Clear()函数
|
2021-04-30 18:56:20 +08:00
|
|
|
|
*/
|
2019-05-25 00:50:04 +08:00
|
|
|
|
class RenderList
|
|
|
|
|
{
|
2023-05-07 01:07:26 +08:00
|
|
|
|
protected:
|
2023-03-22 21:19:23 +08:00
|
|
|
|
|
2025-05-18 02:19:14 +08:00
|
|
|
|
VulkanDevice * device;
|
2021-06-19 20:31:07 +08:00
|
|
|
|
|
2024-08-02 23:17:07 +08:00
|
|
|
|
CameraInfo * camera_info; ///<相机信息
|
|
|
|
|
|
2023-05-07 01:07:26 +08:00
|
|
|
|
uint renderable_count; ///<可渲染对象数量
|
|
|
|
|
MaterialRenderMap mrl_map; ///<按材质分类的渲染列表
|
2020-11-26 17:51:59 +08:00
|
|
|
|
|
2021-06-19 20:31:07 +08:00
|
|
|
|
protected:
|
|
|
|
|
|
2023-05-07 01:07:26 +08:00
|
|
|
|
virtual bool ExpendNode(SceneNode *);
|
2019-05-25 00:50:04 +08:00
|
|
|
|
|
2025-06-07 05:49:07 +08:00
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
const CameraInfo *GetCameraInfo()const{return camera_info;}
|
|
|
|
|
|
2019-05-25 00:50:04 +08:00
|
|
|
|
public:
|
|
|
|
|
|
2025-05-17 20:26:36 +08:00
|
|
|
|
RenderList(VulkanDevice *);
|
2024-07-20 13:15:12 +08:00
|
|
|
|
virtual ~RenderList()=default;
|
2023-05-07 01:07:26 +08:00
|
|
|
|
|
2025-06-07 05:49:07 +08:00
|
|
|
|
virtual void SetCameraInfo(CameraInfo *ci){camera_info=ci;} ///<设置相机信息
|
2024-08-02 23:17:07 +08:00
|
|
|
|
virtual bool Expend(SceneNode *); ///<展开场景树到渲染列表
|
2023-03-24 22:14:43 +08:00
|
|
|
|
|
2025-05-28 02:27:59 +08:00
|
|
|
|
bool IsEmpty()const{return !renderable_count;} ///<是否是空的
|
|
|
|
|
|
2024-08-02 23:17:07 +08:00
|
|
|
|
virtual bool Render(RenderCmdBuffer *); ///<渲染所有对象
|
2021-06-19 20:31:07 +08:00
|
|
|
|
|
2024-08-27 01:27:53 +08:00
|
|
|
|
virtual void UpdateLocalToWorld(); ///<更新所有对象的变换数据
|
2025-06-14 21:05:36 +08:00
|
|
|
|
virtual void UpdateMaterialInstance(StaticMeshComponent *); ///<有对象互换了材质实例
|
2024-08-04 22:35:31 +08:00
|
|
|
|
|
2024-08-02 23:17:07 +08:00
|
|
|
|
virtual void Clear(); ///<彻底清理
|
2023-03-22 19:37:48 +08:00
|
|
|
|
};//class RenderList
|
2019-05-25 00:50:04 +08:00
|
|
|
|
}//namespace graph
|
|
|
|
|
}//namespace hgl
|
|
|
|
|
#endif//HGL_GRAPH_RENDER_LIST_INCLUDE
|