2020-09-21 19:05:25 +08:00
|
|
|
|
#ifndef HGL_GRAPH_RENDERABLE_INSTANCE_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_RENDERABLE_INSTANCE_INCLUDE
|
|
|
|
|
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VKRenderable.h>
|
|
|
|
|
#include<hgl/graph/VKPipeline.h>
|
|
|
|
|
#include<hgl/graph/VKDescriptorSets.h>
|
2021-06-16 20:29:25 +08:00
|
|
|
|
#include<hgl/graph/VKMaterial.h>
|
2021-06-16 11:43:19 +08:00
|
|
|
|
#include<hgl/graph/VKMaterialParameters.h>
|
2021-06-16 20:29:25 +08:00
|
|
|
|
#include<hgl/graph/VKMaterialInstance.h>
|
2020-09-21 19:05:25 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
|
|
|
|
/**
|
2020-12-18 16:51:53 +08:00
|
|
|
|
* 可渲染对象实例<br>
|
|
|
|
|
* RenderList会统一管理Shader中的LocalToWorld数据,使用DynamicUBO/DynamicSSBO实现。
|
2020-09-21 19:05:25 +08:00
|
|
|
|
*/
|
2020-12-18 16:51:53 +08:00
|
|
|
|
class RenderableInstance ///可渲染对象实例
|
2020-09-21 19:05:25 +08:00
|
|
|
|
{
|
2020-12-09 21:33:29 +08:00
|
|
|
|
Pipeline * pipeline;
|
2021-06-16 20:29:25 +08:00
|
|
|
|
MaterialInstance * mat_inst;
|
2020-12-09 21:33:29 +08:00
|
|
|
|
Renderable * render_obj;
|
2020-09-21 19:05:25 +08:00
|
|
|
|
|
2021-06-16 20:29:25 +08:00
|
|
|
|
MaterialParameters *mp_r;
|
2021-05-12 19:03:08 +08:00
|
|
|
|
|
2020-12-09 21:33:29 +08:00
|
|
|
|
uint32_t buffer_count;
|
|
|
|
|
VkBuffer * buffer_list;
|
|
|
|
|
VkDeviceSize * buffer_size;
|
2020-09-21 19:05:25 +08:00
|
|
|
|
|
2021-06-10 18:54:53 +08:00
|
|
|
|
uint32_t buffer_hash;
|
|
|
|
|
|
2020-09-21 19:05:25 +08:00
|
|
|
|
private:
|
|
|
|
|
|
2021-06-16 20:29:25 +08:00
|
|
|
|
friend RenderableInstance *CreateRenderableInstance(Renderable *,MaterialInstance *,Pipeline *);
|
2020-09-21 19:05:25 +08:00
|
|
|
|
|
2021-06-16 20:29:25 +08:00
|
|
|
|
RenderableInstance(Renderable *,MaterialInstance *,Pipeline *,const uint32_t,VkBuffer *,VkDeviceSize *);
|
2020-09-21 19:05:25 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual ~RenderableInstance();
|
|
|
|
|
|
2020-12-09 21:33:29 +08:00
|
|
|
|
Pipeline * GetPipeline (){return pipeline;}
|
2021-06-16 20:29:25 +08:00
|
|
|
|
VkPipelineLayout GetPipelineLayout (){return mat_inst->GetMaterial()->GetPipelineLayout();}
|
|
|
|
|
MaterialInstance * GetMaterialInstance (){return mat_inst;}
|
2020-12-09 21:33:29 +08:00
|
|
|
|
Renderable * GetRenderable (){return render_obj;}
|
|
|
|
|
const AABB & GetBoundingBox ()const{return render_obj->GetBoundingBox();}
|
2020-09-21 19:05:25 +08:00
|
|
|
|
|
2020-12-09 21:33:29 +08:00
|
|
|
|
const uint32_t GetBufferCount ()const{return buffer_count;}
|
|
|
|
|
VkBuffer * GetBuffer ()const{return buffer_list;}
|
|
|
|
|
VkDeviceSize * GetBufferSize ()const{return buffer_size;}
|
|
|
|
|
IndexBuffer * GetIndexBuffer ()const{return render_obj->GetIndexBuffer();}
|
|
|
|
|
const uint32_t GetIndexBufferOffset()const{return render_obj->GetIndexBufferOffset();}
|
|
|
|
|
const uint32_t GetDrawCount ()const{return render_obj->GetDrawCount();}
|
2020-09-21 19:05:25 +08:00
|
|
|
|
|
2021-06-10 18:54:53 +08:00
|
|
|
|
const uint32_t GetBufferHash ()const{return buffer_hash;}
|
|
|
|
|
|
2021-06-16 20:29:25 +08:00
|
|
|
|
MaterialParameters *GetMP (const DescriptorSetsType &type);
|
2020-09-21 19:05:25 +08:00
|
|
|
|
};//class RenderableInstance
|
|
|
|
|
|
2021-06-16 20:29:25 +08:00
|
|
|
|
RenderableInstance *CreateRenderableInstance(Renderable *,MaterialInstance *,Pipeline *);
|
2020-09-21 19:05:25 +08:00
|
|
|
|
VK_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_RENDERABLE_INSTANCE_INCLUDE
|