SpiecsEngine
 
Loading...
Searching...
No Matches
Spices::Material Class Reference

Material Class. This class contains a branch of parameter and shader, also descriptor. More...

#include <Material.h>

Public Member Functions

 Material ()=default
 Constructor Function.
 
 Material (const std::string &materialPath)
 Constructor Function. Deserialize immediately. Usually call it.
 
virtual ~Material ()
 Destructor Function.
 
void Serialize ()
 Serialize this class data to a disk file(.material).
 
void Deserialize ()
 Deserialize the data from a disk file(.material) to this class.
 
const std::string & GetName () const
 Get Material Path.
 
const std::vector< std::string > & GetShaderPath (const std::string &stage)
 Get material shader path.
 
const std::unordered_map< std::string, std::vector< std::string > > & GetShaderPath () const
 Get material shader path.
 
scl::linked_unordered_map< std::string, TextureParam > & GetTextureParams ()
 Get material texture parameters.
 
scl::linked_unordered_map< std::string, ConstantParams > & GetConstantParams ()
 Get material constant parameters.
 
void SetName (const std::string &path)
 Set material path.
 
void PushToShaderPath (const std::string &name, const std::string &shader)
 Push item to ShaderPath.
 
void PushToTextureParams (const std::string &name, const TextureParam &texture)
 Push item to ShaderPath.
 
void PushToConstParams (const std::string &name, const ConstantParam &param)
 Push item to ConstParams.
 
template<typename T >
GetDefaultConstantParams (const std::string &name)
 Get default material constant parameter.
 
uint64_t GetMaterialParamsAddress () const
 Get material parameter address on GPU.
 
bool GetIsDrawWindow () const
 Get boolean of whether draw a material window.
 
void SetIsDrawWindow (bool isDrawWindow)
 Set boolean of whether draw a material window.
 
void BuildMaterial (bool isAutoRegistry=true)
 This interface need to be overwritten by specific material. It defines how we build texture and descriptor set.
 
void UpdateMaterial ()
 Update material data to buffer.
 

Protected Attributes

std::string m_MaterialPath
 
std::unordered_map< std::string, std::vector< std::string > > m_Shaders
 Shader path Key: shader usage, Value: shader file name.
 
std::unordered_map< std::string, std::vector< std::string > > m_DefaultShaders
 
scl::linked_unordered_map< std::string, TextureParamm_TextureParams
 Texture parameters. Key: parameter name, Value: parameter value.
 
scl::linked_unordered_map< std::string, TextureParamm_DefaultTextureParams
 
scl::linked_unordered_map< std::string, ConstantParamsm_ConstantParams
 Constant parameters. Key: parameter name, Value: parameter value.
 
scl::runtime_memory_block m_Buffermemoryblocks
 m_Buffers's c++ data container. Key: set, Value: scl::runtime_memory_block.
 
std::unique_ptr< VulkanBufferm_MaterialParameterBuffer
 
MaterialProperties m_Properties
 Properties of render options.
 
bool m_IsDrawWindow
 True if this material needs to draw a window.
 
bool m_AlreadyBuild
 True if this material already build a buffer.
 
std::mutex m_Mutex
 Mutex of this material.
 

Friends

class MaterialLoader
 Allow MaterialLoader access all data.
 
class MeshPack
 Allow MeshPack access all data.
 

Detailed Description

Material Class. This class contains a branch of parameter and shader, also descriptor.

Definition at line 61 of file Material.h.


The documentation for this class was generated from the following files: