ULRE/inc/hgl/graph/VKRenderableInstance.h

65 lines
2.7 KiB
C
Raw Normal View History

#ifndef HGL_GRAPH_RENDERABLE_INSTANCE_INCLUDE
#define HGL_GRAPH_RENDERABLE_INSTANCE_INCLUDE
2022-06-24 17:51:05 +08:00
#include<hgl/graph/VKPrimitive.h>
#include<hgl/graph/VKPipeline.h>
#include<hgl/graph/VKDescriptorSets.h>
2021-06-16 20:29:25 +08:00
#include<hgl/graph/VKMaterial.h>
#include<hgl/graph/VKMaterialParameters.h>
2021-06-16 20:29:25 +08:00
#include<hgl/graph/VKMaterialInstance.h>
VK_NAMESPACE_BEGIN
/**
2020-12-18 16:51:53 +08:00
* <br>
* RenderList会统一管理Shader中的LocalToWorld数据使DynamicUBO/DynamicSSBO实现
*/
2020-12-18 16:51:53 +08:00
class RenderableInstance ///可渲染对象实例
{
Pipeline * pipeline;
2021-06-16 20:29:25 +08:00
MaterialInstance * mat_inst;
2022-06-24 17:51:05 +08:00
Primitive * render_obj;
uint32_t buffer_count;
VkBuffer * buffer_list;
VkDeviceSize * buffer_size;
uint32_t buffer_hash;
private:
2022-06-24 17:51:05 +08:00
friend RenderableInstance *CreateRenderableInstance(Primitive *,MaterialInstance *,Pipeline *);
2022-06-24 17:51:05 +08:00
RenderableInstance(Primitive *,MaterialInstance *,Pipeline *,const uint32_t,VkBuffer *,VkDeviceSize *);
public:
virtual ~RenderableInstance();
void UpdatePipeline (Pipeline *p){pipeline=p;}
Pipeline * GetPipeline (){return pipeline;}
2021-06-16 20:29:25 +08:00
VkPipelineLayout GetPipelineLayout (){return mat_inst->GetMaterial()->GetPipelineLayout();}
Material * GetMaterial (){return mat_inst->GetMaterial();}
2021-06-16 20:29:25 +08:00
MaterialInstance * GetMaterialInstance (){return mat_inst;}
2022-06-24 17:51:05 +08:00
Primitive * GetRenderable (){return render_obj;}
const AABB & GetBoundingBox ()const{return render_obj->GetBoundingBox();}
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();}
const uint32_t GetBufferHash ()const{return buffer_hash;}
MaterialParameters *GetMP (const DescriptorSetsType &type){return mat_inst->GetMP(type);}
public: //instance support
virtual const uint32_t GetInstanceCount ()const{return 1;}
};//class RenderableInstance
2022-06-24 17:51:05 +08:00
RenderableInstance *CreateRenderableInstance(Primitive *,MaterialInstance *,Pipeline *);
VK_NAMESPACE_END
#endif//HGL_GRAPH_RENDERABLE_INSTANCE_INCLUDE