Class VirtualMaterial
Represents a temporary container used to store material properties before they are applied to a Unity Material.
Namespace: TriLibCore.General
Assembly: TriLibCore.Source.dll
Syntax
public class VirtualMaterial
Remarks
This class is typically used during import pipelines to accumulate material data in a renderer-agnostic format.
Fields
GlobalIlluminationFlags
Gets or sets the material global illumination flags.
Declaration
public MaterialGlobalIlluminationFlags GlobalIlluminationFlags
Field Value
| Type | Description |
|---|---|
| MaterialGlobalIlluminationFlags |
HasAlpha
Indicates whether the material contains alpha information in its diffuse color or texture.
Declaration
public bool HasAlpha
Field Value
| Type | Description |
|---|---|
| bool |
Offset
Gets or sets the texture coordinate offset.
Declaration
public Vector2 Offset
Field Value
| Type | Description |
|---|---|
| Vector2 |
Tiling
Gets or sets the texture coordinate tiling.
Declaration
public Vector2 Tiling
Field Value
| Type | Description |
|---|---|
| Vector2 |
Properties
ColorProperties
Gets the color material properties.
Declaration
public Dictionary<string, Color> ColorProperties { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, Color> |
FloatProperties
Gets the float (single) material properties.
Declaration
public Dictionary<string, float> FloatProperties { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, float> |
HasEmissionColor
Gets or sets a value indicating whether the source material defines an emission color.
Declaration
[Obsolete("Please use the GenericColorPropertyIsSetAndValid method")]
public bool HasEmissionColor { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Keywords
Gets the shader keywords and their enabled states.
Declaration
public Dictionary<string, bool> Keywords { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, bool> |
TextureProperties
Gets the texture material properties.
Declaration
public Dictionary<string, Texture> TextureProperties { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, Texture> |
VectorProperties
Gets the vector material properties.
Declaration
public Dictionary<string, Vector3> VectorProperties { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, Vector3> |
Methods
DisableKeyword(string)
Disables the specified shader keyword.
Declaration
public void DisableKeyword(string keyword)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyword | The keyword to disable. |
EnableKeyword(string)
Enables the specified shader keyword.
Declaration
public void EnableKeyword(string keyword)
Parameters
| Type | Name | Description |
|---|---|---|
| string | keyword | The keyword to enable. |
GenericColorPropertyIsSetAndValid(GenericMaterialProperty)
Determines whether a generic color-related material property has been set and is considered valid.
Declaration
public bool GenericColorPropertyIsSetAndValid(GenericMaterialProperty genericMaterialProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| GenericMaterialProperty | genericMaterialProperty | The generic color property to query. |
Returns
| Type | Description |
|---|---|
| bool |
|
GenericPropertyIsSet(GenericMaterialProperty)
Determines whether a generic material property has been set, regardless of its validity.
Declaration
public bool GenericPropertyIsSet(GenericMaterialProperty genericMaterialProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| GenericMaterialProperty | genericMaterialProperty | The generic material property to query. |
Returns
| Type | Description |
|---|---|
| bool |
|
GenericPropertyIsSetAndValid(GenericMaterialProperty)
Determines whether a generic material property has been set and is considered valid.
Declaration
public bool GenericPropertyIsSetAndValid(GenericMaterialProperty genericMaterialProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| GenericMaterialProperty | genericMaterialProperty | The generic material property to query. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
If the property represents a color, the corresponding texture property is also taken into account.
SetProperty(string, float, GenericMaterialProperty)
Sets a float material property.
Declaration
public void SetProperty(string property, float value, GenericMaterialProperty genericMaterialProperty = GenericMaterialProperty.Unknown)
Parameters
| Type | Name | Description |
|---|---|---|
| string | property | The shader property name. |
| float | value | The property value. |
| GenericMaterialProperty | genericMaterialProperty | The generic material property associated with this value. |
SetProperty(string, Color, GenericMaterialProperty)
Sets a color material property.
Declaration
public void SetProperty(string property, Color value, GenericMaterialProperty genericMaterialProperty = GenericMaterialProperty.Unknown)
Parameters
| Type | Name | Description |
|---|---|---|
| string | property | The shader property name. |
| Color | value | The property value. |
| GenericMaterialProperty | genericMaterialProperty | The generic material property associated with this value. |
SetProperty(string, Texture, GenericMaterialProperty)
Sets a texture material property.
Declaration
public void SetProperty(string property, Texture value, GenericMaterialProperty genericMaterialProperty = GenericMaterialProperty.Unknown)
Parameters
| Type | Name | Description |
|---|---|---|
| string | property | The shader property name. |
| Texture | value | The texture value. |
| GenericMaterialProperty | genericMaterialProperty | The generic material property associated with this value. |
SetProperty(string, Vector3, GenericMaterialProperty)
Sets a vector material property.
Declaration
public void SetProperty(string property, Vector3 value, GenericMaterialProperty genericMaterialProperty = GenericMaterialProperty.Unknown)
Parameters
| Type | Name | Description |
|---|---|---|
| string | property | The shader property name. |
| Vector3 | value | The property value. |
| GenericMaterialProperty | genericMaterialProperty | The generic material property associated with this value. |