Class CustomizableMaterialMapper
A customizable material mapper for converting source materials into Unity materials during runtime model importing.
Inherited Members
Namespace: TriLibCore.Mappers
Assembly: Assembly-CSharp.dll
Syntax
[Serializable]
[CreateAssetMenu(menuName = "TriLib/Mappers/Material/Customizable Material Mapper", fileName = "CustomizableMaterialMapper")]
public class CustomizableMaterialMapper : MaterialMapper
Fields
GenericPropertiesCount
The number of generic material properties supported by this mapper.
Declaration
public const int GenericPropertiesCount = 20
Field Value
| Type | Description |
|---|---|
| int |
GenericPropertyIndices
Array mapping generic material properties to their corresponding indices.
Declaration
public static int[] GenericPropertyIndices
Field Value
| Type | Description |
|---|---|
| int[] |
Properties
ConvertMaterialTextures
Gets whether material textures should be converted.
Declaration
public override bool ConvertMaterialTextures { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
CutoutMaterialPreset
Gets the cutout material preset.
Declaration
public override Material CutoutMaterialPreset { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
CutoutMaterialPresetNoMetallicTexture
Gets the cutout material preset without metallic textures.
Declaration
public override Material CutoutMaterialPresetNoMetallicTexture { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
ExtractMetallicAndSmoothness
Gets whether metallic and smoothness values should be extracted.
Declaration
public override bool ExtractMetallicAndSmoothness { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
MaterialPreset
Gets the default material preset.
Declaration
public override Material MaterialPreset { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
MaterialPresetNoMetallicTexture
Gets the material preset without metallic textures.
Declaration
public override Material MaterialPresetNoMetallicTexture { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
TransparentComposeMaterialPreset
Gets the transparent compose material preset.
Declaration
public override Material TransparentComposeMaterialPreset { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
TransparentComposeMaterialPresetNoMetallicTexture
Gets the transparent compose material preset without metallic textures.
Declaration
public override Material TransparentComposeMaterialPresetNoMetallicTexture { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
TransparentMaterialPreset
Gets the transparent material preset.
Declaration
public override Material TransparentMaterialPreset { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
TransparentMaterialPresetNoMetallicTexture
Gets the transparent material preset without metallic textures.
Declaration
public override Material TransparentMaterialPresetNoMetallicTexture { get; }
Property Value
| Type | Description |
|---|---|
| Material |
Overrides
UseShaderVariantCollection
Gets whether to use a shader variant collection.
Declaration
public override bool UseShaderVariantCollection { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
UsesCoroutines
Gets whether this mapper uses coroutines for asynchronous processing.
Declaration
public override bool UsesCoroutines { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Overrides
Methods
ApplyDiffuseMapTexture(TextureLoadingContext)
Applies a diffuse map texture to the material.
Declaration
protected virtual IEnumerable ApplyDiffuseMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
ApplyDisplacementTexture(TextureLoadingContext)
Applies a displacement texture to the material.
Declaration
protected virtual IEnumerable ApplyDisplacementTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
ApplyEmissionMapTexture(TextureLoadingContext)
Applies an emission map texture to the material.
Declaration
protected virtual IEnumerable ApplyEmissionMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
ApplyGlossinessMapTexture(TextureLoadingContext)
Applies a glossiness or roughness map texture to the material.
Declaration
protected virtual IEnumerable ApplyGlossinessMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
ApplyKeywords(MaterialMapperContext, GenericMaterialProperty)
Applies shader keywords for a given material property.
Declaration
protected virtual void ApplyKeywords(MaterialMapperContext materialMapperContext, GenericMaterialProperty genericMaterialProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
| GenericMaterialProperty | genericMaterialProperty | The generic material property. |
ApplyMetallicGlossMapTexture(TextureLoadingContext)
Applies a metallic gloss map texture to the material.
Declaration
protected virtual IEnumerable ApplyMetallicGlossMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
ApplyNormalMapTexture(TextureLoadingContext)
Applies a normal map texture to the material.
Declaration
protected virtual IEnumerable ApplyNormalMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
ApplyOcclusionMapTexture(TextureLoadingContext)
Applies an occlusion map texture to the material.
Declaration
protected virtual IEnumerable ApplyOcclusionMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
ApplySpecularMapTexture(TextureLoadingContext)
Applies a specular map texture to the material.
Declaration
protected virtual IEnumerable ApplySpecularMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
ApplyTexture(TextureLoadingContext, GenericMaterialProperty)
Applies a texture to the material for a specific generic property.
Declaration
protected virtual void ApplyTexture(TextureLoadingContext textureLoadingContext, GenericMaterialProperty genericMaterialProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
| GenericMaterialProperty | genericMaterialProperty | The generic material property. |
ApplyTransparencyMapTexture(TextureLoadingContext)
Applies a transparency map texture to the material.
Declaration
protected virtual IEnumerable ApplyTransparencyMapTexture(TextureLoadingContext textureLoadingContext)
Parameters
| Type | Name | Description |
|---|---|---|
| TextureLoadingContext | textureLoadingContext | The texture loading context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckDiffuseColor(MaterialMapperContext)
Checks and applies the diffuse color to the material.
Declaration
protected virtual IEnumerable CheckDiffuseColor(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckDiffuseMapTexture(MaterialMapperContext)
Checks and loads the diffuse map texture.
Declaration
protected virtual IEnumerable CheckDiffuseMapTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckDisplacementTexture(MaterialMapperContext)
Checks and loads the displacement texture.
Declaration
protected virtual IEnumerable CheckDisplacementTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckEmissionColor(MaterialMapperContext)
Checks and applies the emission color to the material.
Declaration
protected virtual IEnumerable CheckEmissionColor(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckEmissionMapTexture(MaterialMapperContext)
Checks and loads the emission map texture.
Declaration
protected virtual IEnumerable CheckEmissionMapTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckGlossinessMapTexture(MaterialMapperContext)
Checks and loads the glossiness or roughness map texture.
Declaration
protected virtual IEnumerable CheckGlossinessMapTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckGlossinessValue(MaterialMapperContext)
Checks and applies the glossiness or roughness value to the material.
Declaration
protected virtual IEnumerable CheckGlossinessValue(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckMetallicGlossMapTexture(MaterialMapperContext)
Checks and loads the metallic gloss map texture.
Declaration
protected virtual IEnumerable CheckMetallicGlossMapTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckMetallicValue(MaterialMapperContext)
Checks and applies the metallic value to the material.
Declaration
protected virtual IEnumerable CheckMetallicValue(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckNormalMapTexture(MaterialMapperContext)
Checks and loads the normal map texture.
Declaration
protected virtual IEnumerable CheckNormalMapTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckOcclusionMapTexture(MaterialMapperContext)
Checks and loads the occlusion map texture.
Declaration
protected virtual IEnumerable CheckOcclusionMapTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckSpecularMapTexture(MaterialMapperContext)
Checks and loads the specular map texture.
Declaration
protected virtual IEnumerable CheckSpecularMapTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
CheckTransparencyMapTexture(MaterialMapperContext)
Checks and loads the transparency map texture.
Declaration
protected virtual IEnumerable CheckTransparencyMapTexture(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |
GetDiffuseColorName(MaterialMapperContext)
Gets the shader property name for the diffuse color.
Declaration
public override string GetDiffuseColorName(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| string | The shader property name for the diffuse color. |
Overrides
GetDiffuseTextureName(MaterialMapperContext)
Gets the shader property name for the diffuse texture.
Declaration
public override string GetDiffuseTextureName(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| string | The shader property name for the diffuse texture. |
Overrides
GetEmissionColorName(MaterialMapperContext)
Gets the shader property name for the emission color.
Declaration
public override string GetEmissionColorName(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| string | The shader property name for the emission color. |
Overrides
GetGlossinessOrRoughnessName(MaterialMapperContext)
Gets the shader property name for glossiness or roughness.
Declaration
public override string GetGlossinessOrRoughnessName(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| string | The shader property name for glossiness or roughness. |
Overrides
GetGlossinessOrRoughnessTextureName(MaterialMapperContext)
Gets the shader property name for the glossiness or roughness texture.
Declaration
public override string GetGlossinessOrRoughnessTextureName(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| string | The shader property name for the glossiness or roughness texture. |
Overrides
GetMappedProperty(GenericMaterialProperty)
Gets the mapped shader property name for a generic material property.
Declaration
protected virtual string GetMappedProperty(GenericMaterialProperty genericMaterialProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| GenericMaterialProperty | genericMaterialProperty | The generic material property. |
Returns
| Type | Description |
|---|---|
| string | The mapped shader property name. |
GetMaterialPreset(Material)
Gets the material preset, falling back to the default preset if none is specified.
Declaration
protected virtual Material GetMaterialPreset(Material materialPreset)
Parameters
| Type | Name | Description |
|---|---|---|
| Material | materialPreset | The material preset to use. |
Returns
| Type | Description |
|---|---|
| Material | The selected material preset. |
GetMetallicName(MaterialMapperContext)
Gets the shader property name for the metallic value.
Declaration
public override string GetMetallicName(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| string | The shader property name for the metallic value. |
Overrides
GetMetallicTextureName(MaterialMapperContext)
Gets the shader property name for the metallic texture.
Declaration
public override string GetMetallicTextureName(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| string | The shader property name for the metallic texture. |
Overrides
IsCompatible(MaterialMapperContext)
Determines if this mapper is compatible with the provided material context.
Declaration
public override bool IsCompatible(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| bool | True if compatible, otherwise false. |
Overrides
MapCoroutine(MaterialMapperContext)
Maps material properties using coroutines for asynchronous processing.
Declaration
public override IEnumerable MapCoroutine(MaterialMapperContext materialMapperContext)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialMapperContext | materialMapperContext | The material mapping context. |
Returns
| Type | Description |
|---|---|
| IEnumerable | An enumerable of coroutine steps. |