Interface IMaterial
Represents a TriLib Material.
Namespace: TriLibCore.Interfaces
Assembly: TriLibCore.dll
Syntax
public interface IMaterial : IObject
Properties
DoubleSided
Defines whether this material must be rendered from both sides.
Declaration
bool DoubleSided { get; set; }
Property Value
Type | Description |
---|---|
bool |
Index
Gets/Sets the index of the material.
Declaration
int Index { get; set; }
Property Value
Type | Description |
---|---|
int | The index of the material. |
MaterialShadingSetup
Gets the Material Shading Setup. Used by Material Mappers to select the most suitable Unity Material template.
Declaration
MaterialShadingSetup MaterialShadingSetup { get; }
Property Value
Type | Description |
---|---|
MaterialShadingSetup |
MixAlbedoColorWithTexture
Defines whether the albedo color from this material will be multiplied with the albedo texture.
Declaration
bool MixAlbedoColorWithTexture { get; }
Property Value
Type | Description |
---|---|
bool |
Processed
Declaration
bool Processed { get; set; }
Property Value
Type | Description |
---|---|
bool |
Processing
Declaration
bool Processing { get; set; }
Property Value
Type | Description |
---|---|
bool |
UsesAlpha
Indicates if this Material uses any Alpha Texture or value.
Declaration
bool UsesAlpha { get; }
Property Value
Type | Description |
---|---|
bool |
UsesRoughnessSetup
Gets a flag indicating whether this Material uses a Roughness setup (Roughness/Metallic textures).
Declaration
bool UsesRoughnessSetup { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
AddProperty(string, object, bool)
Adds a Property to this Material.
Declaration
void AddProperty(string propertyName, object propertyValue, bool isTexture)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The name of the Property to add. |
object | propertyValue | The value of the Property to add. |
bool | isTexture | Indicates whether the Property is a texture. |
ApplyOffsetAndScale(TextureLoadingContext)
Applies per-Material offset and scale to the Context Texture.
Declaration
bool ApplyOffsetAndScale(TextureLoadingContext textureLoadingContext)
Parameters
Type | Name | Description |
---|---|---|
TextureLoadingContext | textureLoadingContext | The Texture Context containing Data from the original and the Unity Texture. |
Returns
Type | Description |
---|---|
bool |
|
GetColorValue(string)
Tries to get a Property value as a Color.
Declaration
Color GetColorValue(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The Property to look for. |
Returns
Type | Description |
---|---|
Color | The property value as Color, if found, otherwise, returns white. |
GetFloatValue(string)
Tries to get a Property value as a Single (float).
Declaration
float GetFloatValue(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The Property to look for. |
Returns
Type | Description |
---|---|
float | The property value as float, if found, otherwise, returns 0. |
GetGenericColorValue(GenericMaterialProperty)
Tries to get a Property value as a Color.
Declaration
Color GetGenericColorValue(GenericMaterialProperty materialProperty)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | materialProperty | The Property to look for. |
Returns
Type | Description |
---|---|
Color | The property value as Color, if found, otherwise, returns white. |
GetGenericColorValueMultiplied(GenericMaterialProperty, MaterialMapperContext)
Returns the generic Material Color Property multiplier from the Parser used to parse the Model. Some Materials used by specific Readers may use different values on Properties.
Declaration
Color GetGenericColorValueMultiplied(GenericMaterialProperty genericMaterialProperty, MaterialMapperContext materialMapperContext = null)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | genericMaterialProperty | The Generic Material Property to get the multiplier from. |
MaterialMapperContext | materialMapperContext | The Material Mapper Context being filled. |
Returns
Type | Description |
---|---|
Color | The material property multiplier for the reader used to parse the model. |
GetGenericFloatValue(GenericMaterialProperty)
Tries to get a Property value as a Single Tries to get a Property value as a Single (float). GetFloatValue:summary False.
Declaration
float GetGenericFloatValue(GenericMaterialProperty materialProperty)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | materialProperty | The Property to look for. |
Returns
Type | Description |
---|---|
float | The property value as float, if found, otherwise, returns 0. |
GetGenericFloatValueMultiplied(GenericMaterialProperty, MaterialMapperContext)
Returns the generic Material Float Property multiplier from the Parser used to parse the Model. Some Materials used by specific Readers may use different values on Properties.
Declaration
float GetGenericFloatValueMultiplied(GenericMaterialProperty genericMaterialProperty, MaterialMapperContext materialMapperContext = null)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | genericMaterialProperty | The Generic Material Property to get the multiplier from. |
MaterialMapperContext | materialMapperContext |
Returns
Type | Description |
---|---|
float | The material property multiplier for the reader used to parse the model. |
GetGenericIntValue(GenericMaterialProperty)
Tries to get a Property value as an Integer.
Declaration
int GetGenericIntValue(GenericMaterialProperty materialProperty)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | materialProperty | The Property to look for. |
Returns
Type | Description |
---|---|
int | The property value as int, if found, otherwise, returns 0. |
GetGenericPropertyName(GenericMaterialProperty)
Returns the generic Material Property name from the Parser used to parse the Model. Some Materials used by specific Readers may use different names on Properties.
Declaration
string GetGenericPropertyName(GenericMaterialProperty genericMaterialProperty)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | genericMaterialProperty | The Generic Material Property to get the name from.MaterialProperty to get the name from. |
Returns
Type | Description |
---|---|
string | The material property name for the reader used to parse the model. |
GetGenericStringValue(GenericMaterialProperty)
Tries to get a Property value as a String.
Declaration
string GetGenericStringValue(GenericMaterialProperty materialProperty)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | materialProperty | The Property to look for. |
Returns
Type | Description |
---|---|
string | The property value as string, if found, otherwise, returns |
GetGenericTextureValue(GenericMaterialProperty)
Tries to get a Property value as a Texture.
Declaration
ITexture GetGenericTextureValue(GenericMaterialProperty materialProperty)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | materialProperty | The Property to look for. |
Returns
Type | Description |
---|---|
ITexture | The property value as Texture, if found, otherwise, returns null. |
GetGenericVector3Value(GenericMaterialProperty)
Tries to get a Property value as a Vector3.
Declaration
Vector3 GetGenericVector3Value(GenericMaterialProperty materialProperty)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | materialProperty | The Property to look for. |
Returns
Type | Description |
---|---|
Vector3 | The property value as Vector3, if found, otherwise, returns an empty vector. |
GetGenericVector4Value(GenericMaterialProperty)
Tries to get a Property value as Vector4.
Declaration
Vector4 GetGenericVector4Value(GenericMaterialProperty materialProperty)
Parameters
Type | Name | Description |
---|---|---|
GenericMaterialProperty | materialProperty | The Property to look for. |
Returns
Type | Description |
---|---|
Vector4 | The property value as Vector4, if found, otherwise, returns an empty vector. |
GetIntValue(string)
Tries to get a Property value as an Integer.
Declaration
int GetIntValue(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The Property to look for. |
Returns
Type | Description |
---|---|
int | The property value as int, if found, otherwise, returns 0. |
GetStringValue(string)
Tries to get a Property value as a String.
Declaration
string GetStringValue(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The Property to look for. |
Returns
Type | Description |
---|---|
string | The property value as string, if found, otherwise, returns |
GetTextureValue(string)
Tries to get a Property value as a Texture.
Declaration
ITexture GetTextureValue(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The Property to look for. |
Returns
Type | Description |
---|---|
ITexture | The property value as Texture, if found, otherwise, returns null. |
GetVector3Value(string)
Tries to get a Property value as a Vector3.
Declaration
Vector3 GetVector3Value(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The Property to look for. |
Returns
Type | Description |
---|---|
Vector3 | The property value as Vector3, if found, otherwise, returns an empty vector. |
GetVector4Value(string)
Tries to get a Property value as Vector4.
Declaration
Vector4 GetVector4Value(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The Property to look for. |
Returns
Type | Description |
---|---|
Vector4 | The property value as Vector4, if found, otherwise, returns an empty vector. |
HasProperty(string)
Returns true
if the Material has the given Property.
Declaration
bool HasProperty(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The name of the Property to check. |
Returns
Type | Description |
---|---|
bool |
|
PostProcessTexture(TextureLoadingContext)
Optional method used to post-process a Texture.
Declaration
bool PostProcessTexture(TextureLoadingContext textureLoadingContext)
Parameters
Type | Name | Description |
---|---|---|
TextureLoadingContext | textureLoadingContext | The Texture Context containing Data from the original and the Unity Texture. |
Returns
Type | Description |
---|---|
bool |
|