TriLib
Search Results for

    Show / Hide Table of Contents

    Interface IMaterial

    Represents a TriLib Material. Each IMaterial holds various properties (floats, vectors, colors, textures, etc.) that describe how the material will appear when rendered in Unity.

    Inherited Members
    IObject.Name
    IObject.Used
    Namespace: TriLibCore.Interfaces
    Assembly: TriLibCore.dll
    Syntax
    public interface IMaterial : IObject

    Properties

    DoubleSided

    Gets or sets a value indicating whether this Material should be rendered from both sides (i.e., whether backface culling is disabled).

    Declaration
    bool DoubleSided { get; set; }
    Property Value
    Type Description
    bool

    Index

    Gets or sets the index of this Material within a model or collection.

    Declaration
    int Index { get; set; }
    Property Value
    Type Description
    int

    MaterialShadingSetup

    Gets the MaterialShadingSetup associated with this Material. This setup is typically used by Material Mappers to select an appropriate Unity Shader or template.

    Declaration
    MaterialShadingSetup MaterialShadingSetup { get; }
    Property Value
    Type Description
    MaterialShadingSetup

    MixAlbedoColorWithTexture

    Gets a value indicating whether the albedo (diffuse) color from this Material should be multiplied by the albedo texture for final rendering.

    Declaration
    bool MixAlbedoColorWithTexture { get; }
    Property Value
    Type Description
    bool

    Processed

    Gets or sets a value indicating whether this Material has already been processed. Useful for tracking the state of asynchronous or multi-stage operations.

    Declaration
    bool Processed { get; set; }
    Property Value
    Type Description
    bool

    Processing

    Gets or sets a value indicating whether this Material is currently being processed.

    Declaration
    bool Processing { get; set; }
    Property Value
    Type Description
    bool

    UsesAlpha

    Gets a value indicating whether this Material uses any alpha (transparency) data, whether via alpha textures or alpha color channels.

    Declaration
    bool UsesAlpha { get; }
    Property Value
    Type Description
    bool

    UsesRoughnessSetup

    Gets a value indicating whether this Material uses a "Roughness" setup. Materials using roughness typically have metallic/roughness maps instead of gloss/specular maps.

    Declaration
    bool UsesRoughnessSetup { get; }
    Property Value
    Type Description
    bool

    Methods

    AddProperty(string, object, bool)

    Adds a new 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. Can be a float, int, string, color, vector, or texture.

    bool isTexture

    Indicates whether the property is a texture. If true, propertyValue is treated as an ITexture.

    ApplyOffsetAndScale(TextureLoadingContext)

    Applies material-specific offset and scale transformations to a texture. This can be used for shifting or tiling a texture as required by the Material's properties.

    Declaration
    bool ApplyOffsetAndScale(TextureLoadingContext textureLoadingContext)
    Parameters
    Type Name Description
    TextureLoadingContext textureLoadingContext

    The TextureLoadingContext containing both the original and the Unity-generated texture references.

    Returns
    Type Description
    bool

    true if an offset or scale was applied; otherwise, false.

    GetColorValue(string)

    Retrieves a property value from this Material as a UnityEngine.Color.

    Declaration
    Color GetColorValue(string propertyName)
    Parameters
    Type Name Description
    string propertyName

    The name of the property to look up.

    Returns
    Type Description
    Color

    The property value as UnityEngine.Color, if found; otherwise, UnityEngine.Color.white.

    GetFloatValue(string)

    Retrieves a property value from this Material as a float.

    Declaration
    float GetFloatValue(string propertyName)
    Parameters
    Type Name Description
    string propertyName

    The name of the property to look up.

    Returns
    Type Description
    float

    The property value as a float, if found; otherwise, 0.

    GetGenericColorValue(GenericMaterialProperty)

    Retrieves a property value from this Material as a UnityEngine.Color, using a GenericMaterialProperty identifier.

    Declaration
    Color GetGenericColorValue(GenericMaterialProperty materialProperty)
    Parameters
    Type Name Description
    GenericMaterialProperty materialProperty

    The enumerated property or descriptor identifying the material property to look up.

    Returns
    Type Description
    Color

    The property value as UnityEngine.Color, if found; otherwise, UnityEngine.Color.white.

    GetGenericColorValueMultiplied(GenericMaterialProperty, MaterialMapperContext)

    Retrieves the UnityEngine.Color multiplier for the specified GenericMaterialProperty, according to the current MaterialMapperContext. Some readers may require specific multipliers for certain color-based properties.

    Declaration
    Color GetGenericColorValueMultiplied(GenericMaterialProperty genericMaterialProperty, MaterialMapperContext materialMapperContext = null)
    Parameters
    Type Name Description
    GenericMaterialProperty genericMaterialProperty

    The GenericMaterialProperty to get the color multiplier for.

    MaterialMapperContext materialMapperContext

    The MaterialMapperContext providing additional context for determining the appropriate multiplier. This parameter is optional.

    Returns
    Type Description
    Color

    The color multiplier associated with the specified property, or UnityEngine.Color.white if not found.

    GetGenericFloatValue(GenericMaterialProperty)

    Retrieves a property value from this Material as a float, using a GenericMaterialProperty identifier.

    Declaration
    float GetGenericFloatValue(GenericMaterialProperty materialProperty)
    Parameters
    Type Name Description
    GenericMaterialProperty materialProperty

    The enumerated property or descriptor identifying the material property to look up.

    Returns
    Type Description
    float

    The property value as a float, if found; otherwise, 0.

    GetGenericFloatValueMultiplied(GenericMaterialProperty, MaterialMapperContext)

    Retrieves the float multiplier for the specified GenericMaterialProperty, according to the current MaterialMapperContext. Some readers may require specific multipliers for certain float-based properties.

    Declaration
    float GetGenericFloatValueMultiplied(GenericMaterialProperty genericMaterialProperty, MaterialMapperContext materialMapperContext = null)
    Parameters
    Type Name Description
    GenericMaterialProperty genericMaterialProperty

    The GenericMaterialProperty to get the float multiplier for.

    MaterialMapperContext materialMapperContext

    The MaterialMapperContext providing additional context for determining the appropriate multiplier. This parameter is optional.

    Returns
    Type Description
    float

    The float multiplier associated with the specified property, or 1.0f if not found.

    GetGenericIntValue(GenericMaterialProperty)

    Retrieves a property value from this Material as an int, using a GenericMaterialProperty identifier.

    Declaration
    int GetGenericIntValue(GenericMaterialProperty materialProperty)
    Parameters
    Type Name Description
    GenericMaterialProperty materialProperty

    The enumerated property or descriptor identifying the material property to look up.

    Returns
    Type Description
    int

    The property value as an int, if found; otherwise, 0.

    GetGenericPropertyName(GenericMaterialProperty)

    Returns the material property name (used by specific readers) corresponding to a given GenericMaterialProperty. Different readers (importers) may use different naming conventions for the same generic property.

    Declaration
    string GetGenericPropertyName(GenericMaterialProperty genericMaterialProperty)
    Parameters
    Type Name Description
    GenericMaterialProperty genericMaterialProperty

    The GenericMaterialProperty to get the name for.

    Returns
    Type Description
    string

    The material property name used internally for the given genericMaterialProperty.

    GetGenericStringValue(GenericMaterialProperty)

    Retrieves a property value from this Material as a string, using a GenericMaterialProperty identifier.

    Declaration
    string GetGenericStringValue(GenericMaterialProperty materialProperty)
    Parameters
    Type Name Description
    GenericMaterialProperty materialProperty

    The enumerated property or descriptor identifying the material property to look up.

    Returns
    Type Description
    string

    The property value as a string, if found; otherwise, null.

    GetGenericTextureValue(GenericMaterialProperty)

    Retrieves a property value from this Material as an ITexture, using a GenericMaterialProperty identifier.

    Declaration
    ITexture GetGenericTextureValue(GenericMaterialProperty materialProperty)
    Parameters
    Type Name Description
    GenericMaterialProperty materialProperty

    The enumerated property or descriptor identifying the material property to look up.

    Returns
    Type Description
    ITexture

    The property value as an ITexture, if found; otherwise, null.

    GetGenericVector3Value(GenericMaterialProperty)

    Retrieves a property value from this Material as a UnityEngine.Vector3, using a GenericMaterialProperty identifier.

    Declaration
    Vector3 GetGenericVector3Value(GenericMaterialProperty materialProperty)
    Parameters
    Type Name Description
    GenericMaterialProperty materialProperty

    The enumerated property or descriptor identifying the material property to look up.

    Returns
    Type Description
    Vector3

    The property value as UnityEngine.Vector3, if found; otherwise, a zero (empty) vector.

    GetGenericVector4Value(GenericMaterialProperty)

    Retrieves a property value from this Material as a UnityEngine.Vector4, using a GenericMaterialProperty identifier.

    Declaration
    Vector4 GetGenericVector4Value(GenericMaterialProperty materialProperty)
    Parameters
    Type Name Description
    GenericMaterialProperty materialProperty

    The enumerated property or descriptor identifying the material property to look up.

    Returns
    Type Description
    Vector4

    The property value as UnityEngine.Vector4, if found; otherwise, a zero (empty) vector.

    GetIntValue(string)

    Retrieves a property value from this Material as an int.

    Declaration
    int GetIntValue(string propertyName)
    Parameters
    Type Name Description
    string propertyName

    The name of the property to look up.

    Returns
    Type Description
    int

    The property value as an int, if found; otherwise, 0.

    GetStringValue(string)

    Retrieves a property value from this Material as a string.

    Declaration
    string GetStringValue(string propertyName)
    Parameters
    Type Name Description
    string propertyName

    The name of the property to look up.

    Returns
    Type Description
    string

    The property value as a string, if found; otherwise, null.

    GetTextureValue(string)

    Retrieves a property value from this Material as an ITexture.

    Declaration
    ITexture GetTextureValue(string propertyName)
    Parameters
    Type Name Description
    string propertyName

    The name of the property to look up.

    Returns
    Type Description
    ITexture

    The property value as an ITexture, if found; otherwise, null.

    GetVector3Value(string)

    Retrieves a property value from this Material as a UnityEngine.Vector3.

    Declaration
    Vector3 GetVector3Value(string propertyName)
    Parameters
    Type Name Description
    string propertyName

    The name of the property to look up.

    Returns
    Type Description
    Vector3

    The property value as UnityEngine.Vector3, if found; otherwise, a zero (empty) vector.

    GetVector4Value(string)

    Retrieves a property value from this Material as a UnityEngine.Vector4.

    Declaration
    Vector4 GetVector4Value(string propertyName)
    Parameters
    Type Name Description
    string propertyName

    The name of the property to look up.

    Returns
    Type Description
    Vector4

    The property value as UnityEngine.Vector4, if found; otherwise, a zero (empty) vector.

    HasProperty(string)

    Determines whether this Material has a property with the given name.

    Declaration
    bool HasProperty(string propertyName)
    Parameters
    Type Name Description
    string propertyName

    The name of the property to check.

    Returns
    Type Description
    bool

    true if the property is found; otherwise, false.

    PostProcessTexture(TextureLoadingContext)

    Optionally post-processes a texture after it has been loaded. This hook can be used to perform additional operations such as color-space conversions, compression settings, etc.

    Declaration
    bool PostProcessTexture(TextureLoadingContext textureLoadingContext)
    Parameters
    Type Name Description
    TextureLoadingContext textureLoadingContext

    The TextureLoadingContext containing both the original and the Unity-generated texture references.

    Returns
    Type Description
    bool

    true if the texture was processed; otherwise, false.

    Extension Methods

    IObjectExtensions.TryToDispose<T>(object)
    In this article
    Back to top Generated by DocFX