Class TextureMapper
Provides a mechanism to locate and load texture data for a model, either by leveraging its original filename or tapping into embedded resources. TextureMapper can be subclassed to implement specialized texture-finding strategies—for instance, searching alternative file paths or retrieving assets from remote sources.
Inheritance
Namespace: TriLibCore.Mappers
Assembly: TriLibCore.dll
Syntax
public class TextureMapper : ScriptableObject
Constructors
TextureMapper()
Declaration
public TextureMapper()
Fields
CheckingOrder
Indicates the relative priority of this mapper when multiple TextureMapper
instances are present in an AssetLoaderOptions. Mappers with lower
CheckingOrder
values are attempted first.
Declaration
public int CheckingOrder
Field Value
Type | Description |
---|---|
int |
Methods
Map(AssetLoaderContext, ITexture)
Attempts to retrieve a TextureLoadingContext that points to the data stream
for the specified texture
. This method is marked as Obsolete
,
and the recommended approach is to use the overload that accepts
TextureLoadingContext instead.
Declaration
[Obsolete("Please use the second override accepting a TextureLoadingContext.")]
public virtual TextureLoadingContext Map(AssetLoaderContext assetLoaderContext, ITexture texture)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The AssetLoaderContext providing references to loaded model data, user options, and other contextual information. |
ITexture | texture | The TriLib ITexture instance containing metadata (filename, embedded data pointers, etc.). |
Returns
Type | Description |
---|---|
TextureLoadingContext | A TextureLoadingContext containing the data Stream
if successful; otherwise |
Remarks
Returning null
indicates that this mapper did not find a suitable data source,
so TriLib may attempt other mappers.
Map(TextureLoadingContext)
Attempts to retrieve or open the data stream for textureLoadingContext
.
By default, this method calls the obsolete Map(AssetLoaderContext, ITexture) method
to maintain backwards compatibility, then assigns its resulting Stream
to textureLoadingContext
.
Declaration
public virtual void Map(TextureLoadingContext textureLoadingContext)
Parameters
Type | Name | Description |
---|---|---|
TextureLoadingContext | textureLoadingContext | Holds data pertinent to loading a specific texture (e.g., the ITexture reference, AssetLoaderContext, and any preexisting stream references). |