Cogs.Core
Public Member Functions | Public Attributes | List of all members
Cogs::Core::MaterialInstance Struct Reference

Material instances represent a specialized Material combined with state for all its buffers and properties. More...

#include <MaterialInstance.h>

Inheritance diagram for Cogs::Core::MaterialInstance:
Cogs::Core::ResourceBase

Public Member Functions

 MaterialInstance ()=default
 
 MaterialInstance (MaterialInstance &&other) noexcept=default
 Move construct MaterialInstance from other.
 
MaterialInstanceoperator= (MaterialInstance &&other) noexcept=default
 Move assign MaterialInstance from other.
 
void setupInstance (Material *material)
 Setup the material instance from the given material.
 
void clone (MaterialInstance *instance)
 Clone the the given material instance.
 
int cloneMatchingProperties (MaterialInstance *instance)
 Clones matching property values from the given instance.
 
void cloneMatchingVariants (MaterialInstance *instance)
 Clones matching varient values from the given instance.
 
void reset ()
 Reset the material instance properties.
 
void setMaterialFlag (MaterialFlags::EMaterialFlags flag)
 Set the given material flag.
 
void setMaterialFlag (MaterialFlags::EMaterialFlags flag, bool status)
 Set the given material flag to the given state.
 
void unsetMaterialFlag (MaterialFlags::EMaterialFlags flag)
 Unset the given material flag.
 
uint16_t getMaterialFlags () const
 Gets flags of the instance, combined from material flags and overrides from instance.
 
void setBackdrop ()
 Set the material instance to act as backdrop when rendering.
 
void unsetBackdrop ()
 Set the material instance to act as regular geometry, not backdrop, when rendering.
 
bool isBackdrop () const
 Get if geometry rendered with this material instance is to be treated as backdrops.
 
void setTransparent ()
 Set the material instance to transparent, indicating to the renderer that blending should be enabled when rendering using this material.
 
void setOpaque ()
 Set the material instance to opaque, indicating to the renderer that blending should be disabled for this instance.
 
bool hasTransparency () const
 Get if this instance has any transparency and should be rendered with blending enabled.
 
bool isDefaultMaterial () const
 Gets if this material instance is created from the default material.
 
void setOption (const StringView &key, const StringView &value)
 Sets the option with the given key to a value parsed from the value string.
 
void setProperty (const StringView &key, const void *value, const size_t sizeInBytes)
 
void setProperty (VariableKey key, const void *value, const size_t sizeInBytes)
 
bool getProperty (const StringView &key, void *value, const size_t sizeInBytes) const
 
bool getProperty (VariableKey key, void *value, const size_t sizeInBytes) const
 
void setTextureAddressMode (const StringView &key, const StringView &addressMode)
 Set texture address mode with textual name.
 
void setTextureFilterMode (const StringView &key, const StringView &filterMode)
 Set texture filter mode with textual name.
 
template<typename T >
void setProperty (const VariableKey key, T value)
 Set the property value of the property with the given key.
 
template<typename T >
getProperty (const VariableKey key) const
 Get the property value of the property with the given key in the given collection.
 
void setVec2Property (const VariableKey key, glm::vec2 value)
 Set the vec2 property with the given key to value.
 
void setVec3Property (const VariableKey key, glm::vec3 value)
 Set the vec3 property with the given key to value.
 
void setVec4Property (const VariableKey key, glm::vec4 value)
 Set the vec4 property with the given key to value.
 
void setInt4Property (const VariableKey key, glm::ivec4 value)
 Set the ivec4 property with the given key to value.
 
void setMat4Property (const VariableKey key, glm::mat4 value)
 Set the mat4 property with the given key to value.
 
void setFloatProperty (const VariableKey key, float value)
 Set the float property with the given key to value.
 
void setIntProperty (const VariableKey key, int value)
 
void setUIntProperty (const VariableKey key, uint32_t value)
 
void setBoolProperty (const VariableKey key, bool value)
 Set the bool property with the given key to value.
 
void setTextureProperty (const StringView &key, TextureHandle value)
 Set the texture property with the given key to the texture resource held by value.
 
void setTextureProperty (const VariableKey key, TextureHandle value)
 
void setTextureAddressMode (const VariableKey key, SamplerState::AddressMode mode)
 Set the address mode used for the texture property with the given key to mode.
 
void setTextureAddressMode (const VariableKey key, SamplerState::AddressMode sMode, SamplerState::AddressMode tMode, SamplerState::AddressMode uMode)
 
void setTextureFilterMode (const VariableKey key, SamplerState::FilterMode filterMode)
 Set the filter mode used for a texture property.
 
glm::vec2 getVec2Property (const VariableKey key) const
 Get the value of the property with the given key.
 
glm::vec3 getVec3Property (const VariableKey key) const
 Get the value of the property with the given key.
 
glm::vec4 getVec4Property (const VariableKey key) const
 Get the value of the property with the given key.
 
glm::mat4 getMat4Property (const VariableKey key) const
 Get the value of the property with the given key.
 
bool getBoolProperty (const VariableKey key) const
 Get the value of the property with the given key.
 
float getFloatProperty (const VariableKey key) const
 Get the value of the property with the given key.
 
TextureValue getTextureProperty (const VariableKey key) const
 Get the value of the property with the given key.
 
size_t getPermutationIndex (const StringView &key) const
 
void setPermutation (const StringView &key)
 
StringView getPermutation () const
 
void setVariant (size_t index, int value)
 
void setVariant (size_t index, bool value)
 
void setVariant (size_t index, const StringView &value)
 
void setVariant (const StringView &key, const StringView &value)
 
void setVariant (const StringView &key, const char *value)
 
void setVariant (const StringView &key, bool value)
 
void setVariant (const StringView &key, int value)
 
std::string getVariant (const StringView &key) const
 
- Public Member Functions inherited from Cogs::Core::ResourceBase
 ResourceBase ()=default
 Constructs a new resource base.
 
 ResourceBase (const ResourceBase &other)=delete
 Disable trivial copies of resources.
 
ResourceBaseoperator= (const ResourceBase &other)=delete
 Disable copy-assignment of resources.
 
 ResourceBase (ResourceBase &&other)
 Move constructs a resource base from other.
 
ResourceBaseoperator= (ResourceBase &&other)
 Move assign the resource from the given ResourceBase other.
 
 ~ResourceBase ()
 Destructs the resource.
 
void setInitialized ()
 
void setChanged ()
 
bool hasChanged () const
 
void setLoading ()
 
void setLoaded ()
 
void setFailedLoad ()
 
void setActive ()
 
void setResident ()
 
void setProxy ()
 
void setKeepStorage ()
 
bool isInitialized () const
 
bool isLoaded () const
 
bool isActive () const
 
bool isResident () const
 
bool isDependency () const
 
bool isDeleted () const
 
bool isOrphaned () const
 
bool isProxy () const
 
bool hasFailedLoad () const
 
bool hasFailedActivation () const
 
bool keepStorage () const
 
void setType (ResourceTypes type)
 Set the type enumeration of the resource.
 
ResourceTypes getType () const
 Gets the type enumeration of the resource.
 
void setId (ResourceId resourceId)
 Set the resource id of the resource.
 
ResourceId getId () const
 Get the resource id of this instance.
 
void setFlag (ResourceFlags flags)
 Set the given resource flag.
 
void setFlags (ResourceFlags flags)
 
void unsetFlag (ResourceFlags flag)
 Unset the given flag.
 
bool isSet (ResourceFlags flag) const
 Check if the given flag is currently set.
 
ResourceFlags getFlags () const
 Get the current flags of the resource.
 
void attachResource (RenderResource *attachment)
 Attach the given GPU resource to the resource.
 
bool hasAttachedResource () const
 Check if the resource has an attachment.
 
RenderResourcegetAttachedResource () const
 Get the attached resource.
 
void setOwner (IResourceManager *owner)
 Sets the owner of this resource instance.
 
IResourceManagergetOwner () const
 
void setName (const StringView &name)
 Set the user friendly name of the resource.
 
StringView getName () const
 Get the name of the resource.
 
void setSource (const StringView &source)
 
StringView getSource () const
 
void increment ()
 Increments the reference count of the resource.
 
void decrement ()
 Decrement the reference count of the resource.
 
uint32_t referenceCount () const
 Get the current reference count.
 
void incrementGeneration ()
 Increment the generation count.
 
uint32_t getGeneration () const
 Get the generation count.
 
void setSlot (uint32_t slot)
 Sets the slot at which the resource is internally tracked.
 
uint32_t getSlot () const
 Gets the slot where the resource is tracked internally.
 

Public Attributes

Materialmaterial = nullptr
 Material resource this MaterialInstance is created from.
 
MaterialInstanceHandle masterInstance
 Master material instance overriding properties in this instance if override is enabled.
 
std::vector< MaterialPropertyBufferInstancebuffers
 Buffer instances matching the buffers and layout of the parent material.
 
std::vector< TextureValuetextureVariables
 Texture property values for this instance.
 
uint16_t instanceFlags = MaterialFlags::None
 Material instance flags.
 
MaterialOptions options
 Material rendering options used by this instance.
 
ShaderVariantSelectors variantSelectors
 Variant selectors.
 
std::vector< std::string > variantStrings
 String storage for string variants.
 
size_t permutationIndex = 0
 Index of material permutation to use.
 
size_t variantGeneration = 0
 If the variant or definitions need updates.
 
uint16_t buffersGeneration = 1
 If the material buffer bindings need updates.
 

Additional Inherited Members

- Static Public Attributes inherited from Cogs::Core::ResourceBase
static const uint32_t NoAttachment = 0xFFFFFFFF
 Constant used to signal no attachment.
 

Detailed Description

Material instances represent a specialized Material combined with state for all its buffers and properties.

All material instances created from the same material share the effect resource and properties of the material. Only the values contained in the buffers and properties may differ between MaterialInstances created from the same Material.

Definition at line 16 of file MaterialInstance.h.

Constructor & Destructor Documentation

◆ MaterialInstance()

Cogs::Core::MaterialInstance::MaterialInstance ( )
default

Default constructs a MaterialInstance. The instance is not usable before the call to setupInstance() with a valid material.

Member Function Documentation

◆ clone()

void Cogs::Core::MaterialInstance::clone ( MaterialInstance instance)

Clone the the given material instance.

Replaces the current material type with that of the source instance.

Cloned properties include:

  • material
  • permutation
  • variant
  • options
  • properties (textures, values)
  • flags

Definition at line 156 of file MaterialInstance.cpp.

References buffers, instanceFlags, masterInstance, material, options, permutationIndex, Cogs::setChanged(), textureVariables, variantSelectors, and variantStrings.

Referenced by Cogs::Core::EchoSounder::UniformGridSystem::preUpdate().

◆ cloneMatchingProperties()

int Cogs::Core::MaterialInstance::cloneMatchingProperties ( MaterialInstance instance)

Clones matching property values from the given instance.

The material types do not have to be equal. Properties are considered matching and copied if name, type, size and flags are equal.

Returns
The number of cloned properties.

Definition at line 178 of file MaterialInstance.cpp.

References getBoolProperty(), getTextureProperty(), Cogs::Core::TextureWithSampler::handle, material, Cogs::Core::TextureValue::texture, and Cogs::Core::ConstantBuffers::variables.

◆ cloneMatchingVariants()

void Cogs::Core::MaterialInstance::cloneMatchingVariants ( MaterialInstance instance)

Clones matching varient values from the given instance.

Definition at line 225 of file MaterialInstance.cpp.

References material, and variantStrings.

◆ getBoolProperty()

bool Cogs::Core::MaterialInstance::getBoolProperty ( const VariableKey  key) const
inline

Get the value of the property with the given key.

Parameters
keyKey to the property.
Returns
A bool containing the current property value.

Definition at line 382 of file MaterialInstance.h.

Referenced by cloneMatchingProperties().

◆ getFloatProperty()

float Cogs::Core::MaterialInstance::getFloatProperty ( const VariableKey  key) const
inline

Get the value of the property with the given key.

Parameters
keyKey to the property.
Returns
A float containing the current property value.

Definition at line 394 of file MaterialInstance.h.

◆ getMat4Property()

glm::mat4 Cogs::Core::MaterialInstance::getMat4Property ( const VariableKey  key) const
inline

Get the value of the property with the given key.

Parameters
keyKey to the property.
Returns
A vec4 containing the current property value.

Definition at line 370 of file MaterialInstance.h.

◆ getMaterialFlags()

uint16_t Cogs::Core::MaterialInstance::getMaterialFlags ( ) const
inline

Gets flags of the instance, combined from material flags and overrides from instance.

Definition at line 103 of file MaterialInstance.h.

◆ getPermutation()

Cogs::StringView Cogs::Core::MaterialInstance::getPermutation ( ) const

Definition at line 568 of file MaterialInstance.cpp.

◆ getPermutationIndex()

size_t Cogs::Core::MaterialInstance::getPermutationIndex ( const StringView key) const

Definition at line 536 of file MaterialInstance.cpp.

◆ getProperty() [1/3]

bool Cogs::Core::MaterialInstance::getProperty ( const StringView key,
void *  value,
const size_t  sizeInBytes 
) const

Definition at line 375 of file MaterialInstance.cpp.

◆ getProperty() [2/3]

template<typename T >
T Cogs::Core::MaterialInstance::getProperty ( const VariableKey  key) const
inline

Get the property value of the property with the given key in the given collection.

Parameters
collectionCollection of properties the property is located in.
keyProperty key used to look up the material property in the collection.
Returns
The value of the property.
Template Parameters
TType of the property value to get. Must be the same as the value type of the properties contained in collection.
CollectionType of the property collection. Inferred from collection.

Definition at line 212 of file MaterialInstance.h.

◆ getProperty() [3/3]

bool Cogs::Core::MaterialInstance::getProperty ( VariableKey  key,
void *  value,
const size_t  sizeInBytes 
) const

Definition at line 387 of file MaterialInstance.cpp.

◆ getTextureProperty()

TextureValue Cogs::Core::MaterialInstance::getTextureProperty ( const VariableKey  key) const
inline

Get the value of the property with the given key.

Parameters
keyKey to the property.
Returns
A texture variable containing the current property value.

Definition at line 406 of file MaterialInstance.h.

Referenced by Cogs::Core::SetTexturePropertyCommand::apply(), and cloneMatchingProperties().

◆ getVariant()

std::string Cogs::Core::MaterialInstance::getVariant ( const StringView key) const

Definition at line 663 of file MaterialInstance.cpp.

◆ getVec2Property()

glm::vec2 Cogs::Core::MaterialInstance::getVec2Property ( const VariableKey  key) const
inline

Get the value of the property with the given key.

Parameters
keyKey to the property.
Returns
A vec2 containing the current property value.

Definition at line 334 of file MaterialInstance.h.

◆ getVec3Property()

glm::vec3 Cogs::Core::MaterialInstance::getVec3Property ( const VariableKey  key) const
inline

Get the value of the property with the given key.

Parameters
keyKey to the property.
Returns
A vec3 containing the current property value.

Definition at line 346 of file MaterialInstance.h.

◆ getVec4Property()

glm::vec4 Cogs::Core::MaterialInstance::getVec4Property ( const VariableKey  key) const
inline

Get the value of the property with the given key.

Parameters
keyKey to the property.
Returns
A vec4 containing the current property value.

Definition at line 358 of file MaterialInstance.h.

◆ hasTransparency()

bool Cogs::Core::MaterialInstance::hasTransparency ( ) const

Get if this instance has any transparency and should be rendered with blending enabled.

Returns
A boolean indicating if the material instance has transparency.

Definition at line 278 of file MaterialInstance.cpp.

References Cogs::Core::HandleIsValid(), and Cogs::Core::MaterialFlags::MasterTransparency.

◆ isBackdrop()

bool Cogs::Core::MaterialInstance::isBackdrop ( ) const
inline

Get if geometry rendered with this material instance is to be treated as backdrops.

Returns
A boolean indicating if the material instance is backdrop.

Definition at line 116 of file MaterialInstance.h.

◆ isDefaultMaterial()

bool Cogs::Core::MaterialInstance::isDefaultMaterial ( ) const
inline

Gets if this material instance is created from the default material.

Definition at line 142 of file MaterialInstance.h.

◆ reset()

void Cogs::Core::MaterialInstance::reset ( )

Reset the material instance properties.

Definition at line 259 of file MaterialInstance.cpp.

◆ setBackdrop()

void Cogs::Core::MaterialInstance::setBackdrop ( )
inline

Set the material instance to act as backdrop when rendering.

Definition at line 106 of file MaterialInstance.h.

◆ setBoolProperty()

void Cogs::Core::MaterialInstance::setBoolProperty ( const VariableKey  key,
bool  value 
)
inline

Set the bool property with the given key to value.

Parameters
keyKey of the bool property to set.
valueValue to set the property to.

Definition at line 301 of file MaterialInstance.h.

Referenced by Cogs::Core::updateMaterialInstance().

◆ setFloatProperty()

void Cogs::Core::MaterialInstance::setFloatProperty ( const VariableKey  key,
float  value 
)
inline

Set the float property with the given key to value.

Parameters
keyKey of the float property to set.
valueValue to set the property to.

Definition at line 280 of file MaterialInstance.h.

Referenced by Cogs::Core::EchoSounder::UniformGridSystem::preUpdate(), and Cogs::Core::updateMaterialInstance().

◆ setInt4Property()

void Cogs::Core::MaterialInstance::setInt4Property ( const VariableKey  key,
glm::ivec4  value 
)
inline

Set the ivec4 property with the given key to value.

Parameters
keyKey of the vec4 property to set.
valueValue to set the property to.

Definition at line 258 of file MaterialInstance.h.

◆ setIntProperty()

void Cogs::Core::MaterialInstance::setIntProperty ( const VariableKey  key,
int  value 
)
inline

Definition at line 285 of file MaterialInstance.h.

◆ setMat4Property()

void Cogs::Core::MaterialInstance::setMat4Property ( const VariableKey  key,
glm::mat4  value 
)
inline

Set the mat4 property with the given key to value.

Parameters
keyKey of the mat4 property to set.
valueValue to set the property to.

Definition at line 269 of file MaterialInstance.h.

◆ setMaterialFlag() [1/2]

void Cogs::Core::MaterialInstance::setMaterialFlag ( MaterialFlags::EMaterialFlags  flag)
inline

Set the given material flag.

The material flags of the MaterialInstance are combined with those from the parent material to form the final flag status.

Parameters
flagMaterial flag to set.

Definition at line 82 of file MaterialInstance.h.

◆ setMaterialFlag() [2/2]

void Cogs::Core::MaterialInstance::setMaterialFlag ( MaterialFlags::EMaterialFlags  flag,
bool  status 
)
inline

Set the given material flag to the given state.

The material flags of the MaterialInstance are combined with those from the parent material to form the final flag status.

Parameters
flagMaterial flag.
statusState to set the flag to.

Definition at line 93 of file MaterialInstance.h.

◆ setOpaque()

void Cogs::Core::MaterialInstance::setOpaque ( )

Set the material instance to opaque, indicating to the renderer that blending should be disabled for this instance.

Definition at line 314 of file MaterialInstance.cpp.

Referenced by Cogs::Core::EchoSounder::UniformGridSystem::preUpdate().

◆ setOption()

void Cogs::Core::MaterialInstance::setOption ( const StringView key,
const StringView value 
)

Sets the option with the given key to a value parsed from the value string.

Definition at line 320 of file MaterialInstance.cpp.

Referenced by Cogs::Core::updateMaterialInstance().

◆ setPermutation()

void Cogs::Core::MaterialInstance::setPermutation ( const StringView key)

Definition at line 547 of file MaterialInstance.cpp.

◆ setProperty() [1/3]

void Cogs::Core::MaterialInstance::setProperty ( const StringView key,
const void *  value,
const size_t  sizeInBytes 
)

Definition at line 325 of file MaterialInstance.cpp.

◆ setProperty() [2/3]

template<typename T >
void Cogs::Core::MaterialInstance::setProperty ( const VariableKey  key,
value 
)
inline

Set the property value of the property with the given key.

Setting a property triggers resending the properties to the renderer before using this instance for rendering.

Parameters
keyProperty key used to look up the material property.
valueValue to set the property to.
Template Parameters
TType of the value to set the property to. Inferred from value. Must be the same as the value type of the properties contained in collection.

Definition at line 182 of file MaterialInstance.h.

References Cogs::setChanged().

◆ setProperty() [3/3]

void Cogs::Core::MaterialInstance::setProperty ( VariableKey  key,
const void *  value,
const size_t  sizeInBytes 
)

Definition at line 337 of file MaterialInstance.cpp.

◆ setTextureAddressMode() [1/3]

void Cogs::Core::MaterialInstance::setTextureAddressMode ( const StringView key,
const StringView addressMode 
)

Set texture address mode with textual name.

Parameters
addressModeString with address mode, accepted values are "Clamp", "Wrap", "Mirror", and "Border".

Definition at line 411 of file MaterialInstance.cpp.

References Cogs::SamplerState::Border, Cogs::SamplerState::Clamp, Cogs::hash(), Cogs::StringView::hashLowercase(), Cogs::SamplerState::Mirror, and Cogs::SamplerState::Wrap.

Referenced by Cogs::Core::EchoSounder::UniformGridSystem::preUpdate().

◆ setTextureAddressMode() [2/3]

void Cogs::Core::MaterialInstance::setTextureAddressMode ( const VariableKey  key,
SamplerState::AddressMode  mode 
)

Set the address mode used for the texture property with the given key to mode.

Parameters
keyKey to a texture property.
modeAddress mode to use when rendering geometry with this texture and material instance.

Definition at line 497 of file MaterialInstance.cpp.

◆ setTextureAddressMode() [3/3]

void Cogs::Core::MaterialInstance::setTextureAddressMode ( const VariableKey  key,
SamplerState::AddressMode  sMode,
SamplerState::AddressMode  tMode,
SamplerState::AddressMode  uMode 
)

Definition at line 502 of file MaterialInstance.cpp.

◆ setTextureFilterMode() [1/2]

void Cogs::Core::MaterialInstance::setTextureFilterMode ( const StringView key,
const StringView filterMode 
)

Set texture filter mode with textual name.

Parameters
filterModeString with textdure mode, accepted values are "Point", "MinMagMipPoint", "Linear", "MinMagMipLinear", "ComparisonPoint", "ComparisonMinMagMipPoint", "ComparisonLinear", "ComparisonMinMagMipLinear".
Note
"Point" is a short-hand synonym for "MinMagMipPoint" etc.

Definition at line 443 of file MaterialInstance.cpp.

References Cogs::SamplerState::ComparisonMinMagMipLinear, Cogs::SamplerState::ComparisonMinMagMipPoint, Cogs::hash(), Cogs::StringView::hashLowercase(), Cogs::SamplerState::MinMagMipLinear, and Cogs::SamplerState::MinMagMipPoint.

◆ setTextureFilterMode() [2/2]

void Cogs::Core::MaterialInstance::setTextureFilterMode ( const VariableKey  key,
SamplerState::FilterMode  filterMode 
)

Set the filter mode used for a texture property.

Definition at line 521 of file MaterialInstance.cpp.

References Cogs::Core::TextureWithSampler::filterMode, Cogs::setChanged(), and Cogs::Core::TextureValue::texture.

◆ setTextureProperty() [1/2]

void Cogs::Core::MaterialInstance::setTextureProperty ( const StringView key,
TextureHandle  value 
)

Set the texture property with the given key to the texture resource held by value.

Parameters
keyKey of the texture property to set.
valueHandle to a Texture resource to use. If NoHandle, no texture is passed to the effect.

Definition at line 475 of file MaterialInstance.cpp.

Referenced by Cogs::Core::SetTexturePropertyCommand::apply(), Cogs::Core::Image360System::update(), and Cogs::Core::updateMaterialInstance().

◆ setTextureProperty() [2/2]

void Cogs::Core::MaterialInstance::setTextureProperty ( const VariableKey  key,
TextureHandle  value 
)

Definition at line 480 of file MaterialInstance.cpp.

◆ setTransparent()

void Cogs::Core::MaterialInstance::setTransparent ( )

Set the material instance to transparent, indicating to the renderer that blending should be enabled when rendering using this material.

See also
MaterialOptions::blendMode

Definition at line 308 of file MaterialInstance.cpp.

Referenced by Cogs::Core::EchoSounder::UniformGridSystem::preUpdate().

◆ setUIntProperty()

void Cogs::Core::MaterialInstance::setUIntProperty ( const VariableKey  key,
uint32_t  value 
)
inline

Definition at line 290 of file MaterialInstance.h.

◆ setupInstance()

void Cogs::Core::MaterialInstance::setupInstance ( Material material)

Setup the material instance from the given material.

All values and fields of the material instance will be initialized to the values of the material given, and the instance will automatically have the same buffers and properties as those of the material.

Parameters
materialPointer to an existing material to base the material instance on.

Definition at line 126 of file MaterialInstance.cpp.

References Cogs::Core::ConstantBuffers::buffers, buffers, material, Cogs::Core::Material::options, options, textureVariables, and variantSelectors.

◆ setVariant() [1/7]

void Cogs::Core::MaterialInstance::setVariant ( const StringView key,
bool  value 
)

Definition at line 642 of file MaterialInstance.cpp.

◆ setVariant() [2/7]

void Cogs::Core::MaterialInstance::setVariant ( const StringView key,
const char *  value 
)
inline

Definition at line 425 of file MaterialInstance.h.

◆ setVariant() [3/7]

void Cogs::Core::MaterialInstance::setVariant ( const StringView key,
const StringView value 
)

Definition at line 656 of file MaterialInstance.cpp.

◆ setVariant() [4/7]

void Cogs::Core::MaterialInstance::setVariant ( const StringView key,
int  value 
)

Definition at line 649 of file MaterialInstance.cpp.

◆ setVariant() [5/7]

void Cogs::Core::MaterialInstance::setVariant ( size_t  index,
bool  value 
)

Definition at line 573 of file MaterialInstance.cpp.

◆ setVariant() [6/7]

void Cogs::Core::MaterialInstance::setVariant ( size_t  index,
const StringView value 
)

Definition at line 583 of file MaterialInstance.cpp.

◆ setVariant() [7/7]

void Cogs::Core::MaterialInstance::setVariant ( size_t  index,
int  value 
)

Definition at line 578 of file MaterialInstance.cpp.

◆ setVec2Property()

void Cogs::Core::MaterialInstance::setVec2Property ( const VariableKey  key,
glm::vec2  value 
)
inline

Set the vec2 property with the given key to value.

Parameters
keyKey of the vec2 property to set.
valueValue to set the property to.

Definition at line 225 of file MaterialInstance.h.

Referenced by Cogs::Core::updateMaterialInstance().

◆ setVec3Property()

void Cogs::Core::MaterialInstance::setVec3Property ( const VariableKey  key,
glm::vec3  value 
)
inline

Set the vec3 property with the given key to value.

Parameters
keyKey of the vec3 property to set.
valueValue to set the property to.

Definition at line 236 of file MaterialInstance.h.

Referenced by Cogs::Core::updateMaterialInstance().

◆ setVec4Property()

void Cogs::Core::MaterialInstance::setVec4Property ( const VariableKey  key,
glm::vec4  value 
)
inline

Set the vec4 property with the given key to value.

Parameters
keyKey of the vec4 property to set.
valueValue to set the property to.

Definition at line 247 of file MaterialInstance.h.

Referenced by Cogs::Core::OGC3DTilesSystem::initialize(), Cogs::Core::EchoSounder::UniformGridSystem::preUpdate(), and Cogs::Core::updateMaterialInstance().

◆ unsetBackdrop()

void Cogs::Core::MaterialInstance::unsetBackdrop ( )
inline

Set the material instance to act as regular geometry, not backdrop, when rendering.

Definition at line 109 of file MaterialInstance.h.

◆ unsetMaterialFlag()

void Cogs::Core::MaterialInstance::unsetMaterialFlag ( MaterialFlags::EMaterialFlags  flag)
inline

Unset the given material flag.

Parameters
flagMaterial flag to unset.

Definition at line 100 of file MaterialInstance.h.

Member Data Documentation

◆ buffers

std::vector<MaterialPropertyBufferInstance> Cogs::Core::MaterialInstance::buffers

Buffer instances matching the buffers and layout of the parent material.

Definition at line 438 of file MaterialInstance.h.

Referenced by clone(), and setupInstance().

◆ buffersGeneration

uint16_t Cogs::Core::MaterialInstance::buffersGeneration = 1

If the material buffer bindings need updates.

Definition at line 462 of file MaterialInstance.h.

Referenced by Cogs::Core::RenderMaterialInstance::checkReady().

◆ instanceFlags

uint16_t Cogs::Core::MaterialInstance::instanceFlags = MaterialFlags::None

Material instance flags.

Definition at line 444 of file MaterialInstance.h.

Referenced by clone().

◆ masterInstance

MaterialInstanceHandle Cogs::Core::MaterialInstance::masterInstance

Master material instance overriding properties in this instance if override is enabled.

Definition at line 435 of file MaterialInstance.h.

Referenced by clone().

◆ material

Material* Cogs::Core::MaterialInstance::material = nullptr

◆ options

MaterialOptions Cogs::Core::MaterialInstance::options

Material rendering options used by this instance.

Definition at line 447 of file MaterialInstance.h.

Referenced by clone(), Cogs::Core::EchoSounder::UniformGridSystem::preUpdate(), setupInstance(), and Cogs::Core::Image360System::update().

◆ permutationIndex

size_t Cogs::Core::MaterialInstance::permutationIndex = 0

Index of material permutation to use.

Definition at line 456 of file MaterialInstance.h.

Referenced by clone(), and Cogs::Core::MaterialManager::loadMaterialVariant().

◆ textureVariables

std::vector<TextureValue> Cogs::Core::MaterialInstance::textureVariables

Texture property values for this instance.

Definition at line 441 of file MaterialInstance.h.

Referenced by clone(), Cogs::Core::ModelSystem::getLoadProgress(), setupInstance(), and Cogs::Core::ModelSystem::update().

◆ variantGeneration

size_t Cogs::Core::MaterialInstance::variantGeneration = 0

If the variant or definitions need updates.

Definition at line 459 of file MaterialInstance.h.

◆ variantSelectors

ShaderVariantSelectors Cogs::Core::MaterialInstance::variantSelectors

Variant selectors.

Definition at line 450 of file MaterialInstance.h.

Referenced by clone(), Cogs::Core::MaterialManager::loadMaterialVariant(), and setupInstance().

◆ variantStrings

std::vector<std::string> Cogs::Core::MaterialInstance::variantStrings

String storage for string variants.

Definition at line 453 of file MaterialInstance.h.

Referenced by clone(), and cloneMatchingVariants().


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