2019-04-25 10:09:56 +08:00
|
|
|
|
#ifndef HGL_GRAPH_VULKAN_MATERIAL_INCLUDE
|
|
|
|
|
#define HGL_GRAPH_VULKAN_MATERIAL_INCLUDE
|
|
|
|
|
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VK.h>
|
2019-04-28 16:06:53 +08:00
|
|
|
|
#include<hgl/type/Map.h>
|
2020-09-05 17:54:21 +08:00
|
|
|
|
#include<hgl/type/String.h>
|
2020-10-21 11:43:18 +08:00
|
|
|
|
#include<hgl/graph/VKShaderModuleMap.h>
|
|
|
|
|
#include<hgl/graph/VKVertexAttributeBinding.h>
|
2019-04-25 10:09:56 +08:00
|
|
|
|
VK_NAMESPACE_BEGIN
|
2020-01-20 15:39:39 +08:00
|
|
|
|
class DescriptorSetLayoutCreater;
|
2019-04-25 10:09:56 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 材质类<br>
|
|
|
|
|
* 用于管理shader,提供DescriptorSetLayoutCreater
|
|
|
|
|
*/
|
|
|
|
|
class Material
|
|
|
|
|
{
|
2021-05-10 15:19:16 +08:00
|
|
|
|
UTF8String mtl_name;
|
|
|
|
|
|
2019-04-28 16:06:53 +08:00
|
|
|
|
ShaderModuleMap *shader_maps;
|
|
|
|
|
VertexShaderModule *vertex_sm;
|
2019-04-28 21:25:52 +08:00
|
|
|
|
List<VkPipelineShaderStageCreateInfo> *shader_stage_list;
|
2019-05-05 21:30:55 +08:00
|
|
|
|
|
2019-04-27 02:07:06 +08:00
|
|
|
|
DescriptorSetLayoutCreater *dsl_creater;
|
2019-05-05 21:30:55 +08:00
|
|
|
|
|
2021-06-16 11:43:19 +08:00
|
|
|
|
MaterialParameters *mp_m,*mp_g,*mp_r;
|
2021-06-15 21:20:57 +08:00
|
|
|
|
|
2019-04-28 21:25:52 +08:00
|
|
|
|
VertexAttributeBinding *vab;
|
2019-04-25 10:09:56 +08:00
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
2021-05-10 15:19:16 +08:00
|
|
|
|
Material(const UTF8String &name,ShaderModuleMap *smm,List<VkPipelineShaderStageCreateInfo> *,DescriptorSetLayoutCreater *dslc);
|
2019-04-25 10:09:56 +08:00
|
|
|
|
~Material();
|
|
|
|
|
|
2021-06-16 20:27:10 +08:00
|
|
|
|
const UTF8String & GetName ()const{return mtl_name;}
|
2021-05-10 15:19:16 +08:00
|
|
|
|
|
2021-06-16 20:27:10 +08:00
|
|
|
|
const VertexShaderModule * GetVertexShaderModule ()const{return vertex_sm;}
|
2019-04-28 16:06:53 +08:00
|
|
|
|
|
2020-09-20 03:15:50 +08:00
|
|
|
|
const uint32_t GetStageCount ()const{return shader_stage_list->GetCount();}
|
|
|
|
|
const VkPipelineShaderStageCreateInfo * GetStages ()const{return shader_stage_list->GetData();}
|
2019-04-28 16:06:53 +08:00
|
|
|
|
|
2020-09-20 03:15:50 +08:00
|
|
|
|
const VkPipelineLayout GetPipelineLayout ()const;
|
2021-06-16 11:43:19 +08:00
|
|
|
|
|
2020-09-20 03:15:50 +08:00
|
|
|
|
const VertexAttributeBinding * GetVAB ()const{return vab;}
|
|
|
|
|
const uint32_t GetVertexAttrCount ()const{return vab->GetVertexAttrCount();}
|
|
|
|
|
const VkVertexInputBindingDescription * GetVertexBindingList ()const{return vab->GetVertexBindingList();}
|
|
|
|
|
const VkVertexInputAttributeDescription * GetVertexAttributeList ()const{return vab->GetVertexAttributeList();}
|
2019-04-28 17:02:38 +08:00
|
|
|
|
|
2020-09-20 03:15:50 +08:00
|
|
|
|
public:
|
2019-04-28 16:06:53 +08:00
|
|
|
|
|
2021-06-16 20:27:10 +08:00
|
|
|
|
MaterialParameters * CreateMP (const DescriptorSetsType &type)const;
|
2021-06-16 11:43:19 +08:00
|
|
|
|
MaterialParameters * GetMP (const DescriptorSetsType &type)
|
|
|
|
|
{
|
|
|
|
|
if(type==DescriptorSetsType::Material )return mp_m;else
|
|
|
|
|
if(type==DescriptorSetsType::Renderable )return mp_r;else
|
|
|
|
|
if(type==DescriptorSetsType::Global )return mp_g;else
|
|
|
|
|
return(nullptr);
|
|
|
|
|
}
|
2021-06-16 20:27:10 +08:00
|
|
|
|
|
|
|
|
|
MaterialInstance * CreateInstance();
|
2019-04-28 21:25:52 +08:00
|
|
|
|
};//class Material
|
2019-04-25 10:09:56 +08:00
|
|
|
|
VK_NAMESPACE_END
|
|
|
|
|
#endif//HGL_GRAPH_VULKAN_MATERIAL_INCLUDE
|