2021-06-16 10:41:04 +08:00
|
|
|
#ifndef HGL_GRAPH_VULKAN_MATERIAL_PARAMETERS_INCLUDE
|
|
|
|
#define HGL_GRAPH_VULKAN_MATERIAL_PARAMETERS_INCLUDE
|
2020-01-20 15:39:39 +08:00
|
|
|
|
2020-10-21 11:43:18 +08:00
|
|
|
#include<hgl/graph/VK.h>
|
2020-09-05 17:54:21 +08:00
|
|
|
#include<hgl/type/String.h>
|
2021-06-16 20:27:10 +08:00
|
|
|
#include<hgl/graph/VKDescriptorSets.h>
|
2020-01-20 15:39:39 +08:00
|
|
|
VK_NAMESPACE_BEGIN
|
2021-06-16 10:41:04 +08:00
|
|
|
class MaterialParameters
|
2020-01-20 15:39:39 +08:00
|
|
|
{
|
2021-09-13 20:39:25 +08:00
|
|
|
const MaterialDescriptorSets *mds;
|
2020-01-20 15:39:39 +08:00
|
|
|
|
2021-06-22 14:48:08 +08:00
|
|
|
DescriptorSetType ds_type;
|
2021-06-16 10:41:04 +08:00
|
|
|
|
2020-01-20 15:39:39 +08:00
|
|
|
DescriptorSets *descriptor_sets;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
friend class Material;
|
|
|
|
|
2021-09-13 20:39:25 +08:00
|
|
|
MaterialParameters(const MaterialDescriptorSets *,const DescriptorSetType &type,DescriptorSets *);
|
2021-06-16 10:41:04 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2021-06-22 17:39:15 +08:00
|
|
|
const DescriptorSetType GetType (){return ds_type;}
|
2021-06-16 20:27:10 +08:00
|
|
|
DescriptorSets * GetDescriptorSet (){return descriptor_sets;}
|
|
|
|
const VkDescriptorSet GetVkDescriptorSet ()const{return descriptor_sets->GetDescriptorSet();}
|
2020-01-20 15:39:39 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2021-06-22 14:48:08 +08:00
|
|
|
#define MP_TYPE_IS(name) const bool is##name()const{return ds_type==DescriptorSetType::name;}
|
2021-06-16 10:41:04 +08:00
|
|
|
MP_TYPE_IS(Material)
|
2021-06-16 11:43:19 +08:00
|
|
|
// MP_TYPE_IS(Texture)
|
2021-06-16 20:27:10 +08:00
|
|
|
MP_TYPE_IS(Value)
|
2021-06-16 10:41:04 +08:00
|
|
|
MP_TYPE_IS(Renderable)
|
|
|
|
MP_TYPE_IS(Global)
|
|
|
|
#undef MP_TYPE_IS
|
2020-01-20 15:39:39 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2021-06-16 10:41:04 +08:00
|
|
|
virtual ~MaterialParameters();
|
2020-01-20 15:39:39 +08:00
|
|
|
|
2020-12-18 16:00:43 +08:00
|
|
|
bool BindUBO(const AnsiString &name,GPUBuffer *ubo,bool dynamic=false);
|
2020-12-18 16:14:36 +08:00
|
|
|
bool BindSSBO(const AnsiString &name,GPUBuffer *ubo,bool dynamic=false);
|
2020-07-07 19:16:23 +08:00
|
|
|
bool BindSampler(const AnsiString &name,Texture *tex,Sampler *sampler);
|
2020-01-20 15:39:39 +08:00
|
|
|
|
|
|
|
void Update();
|
2021-06-16 10:41:04 +08:00
|
|
|
};//class MaterialParameters
|
2020-01-20 15:39:39 +08:00
|
|
|
VK_NAMESPACE_END
|
2021-06-16 10:41:04 +08:00
|
|
|
#endif//HGL_GRAPH_VULKAN_MATERIAL_PARAMETERS_INCLUDE
|