Class MaterialMapperContext
Acts as a container for data used when converting a TriLib IMaterial into a Unity Material. This includes both the original material information, an intermediate VirtualMaterial representation, and the final Unity material reference, all of which are coordinated by a corresponding MaterialMapper.
Inherited Members
Namespace: TriLibCore
Assembly: TriLibCore.dll
Syntax
public class MaterialMapperContext : IAssetLoaderContext, IAwaitable
Constructors
MaterialMapperContext()
Declaration
public MaterialMapperContext()
Fields
AlphaMaterial
Optional reference to an “alpha” material used for situations where a second pass is needed
to render partially transparent geometry. For example, if AlphaMaterialMode
is set to CutoutAndTransparent
, this field might hold a secondary material for layered blending.
Declaration
public Material AlphaMaterial
Field Value
Type | Description |
---|---|
Material |
Index
The zero-based index of this material among all parsed materials in the loaded model, which can be useful for tracking or referencing the original material order.
Declaration
public int Index
Field Value
Type | Description |
---|---|
int |
Material
The original IMaterial source data, extracted from the loaded model. This object contains property values (e.g., texture references, color properties) that the MaterialMapper can process.
Declaration
public IMaterial Material
Field Value
Type | Description |
---|---|
IMaterial |
MaterialMapper
The MaterialMapper instance responsible for converting the TriLib IMaterial to the final Unity Material. This reference is useful if additional mapper-specific logic or settings are needed during or after processing.
Declaration
public MaterialMapper MaterialMapper
Field Value
Type | Description |
---|---|
MaterialMapper |
UnityMaterial
The final Unity material instance after the mapper has assigned textures and property values. This is usually created by instantiating a preset (e.g., a built-in TriLib material) or a custom pipeline material, then applying VirtualMaterial properties.
Declaration
public Material UnityMaterial
Field Value
Type | Description |
---|---|
Material |
VirtualMaterial
A “virtual” material object that stores property values (colors, textures, floats, keywords) used to build the final UnityMaterial. This intermediate stage allows for layering or composition of multiple properties before applying them to the actual material.
Declaration
public VirtualMaterial VirtualMaterial
Field Value
Type | Description |
---|---|
VirtualMaterial |
Properties
Completed
Indicates whether material processing is finished. This can be false
if
asynchronous texture loading or other operations are still ongoing,
or true
if UnityMaterial is fully assigned and ready.
Declaration
public bool Completed { get; set; }
Property Value
Type | Description |
---|---|
bool |
Context
Gets or sets the AssetLoaderContext that contains the overall data (e.g., root UnityEngine.GameObject, import options, callbacks) for the current model loading process.
Declaration
public AssetLoaderContext Context { get; set; }
Property Value
Type | Description |
---|---|
AssetLoaderContext |