Class SimpleExternalDataMapper
A custom ExternalDataMapper implementation that uses user-supplied callbacks to handle external data loading. This is useful when the model references additional files (e.g., textures, external geometry, etc.) and you want fine-grained control over how and where those files are retrieved.
Inherited Members
Namespace: TriLibCore.Samples
Assembly: Assembly-CSharp.dll
Syntax
public class SimpleExternalDataMapper : ExternalDataMapper
Methods
Map(AssetLoaderContext, string, out string)
Overrides the default mapping logic to use the user-supplied callbacks.
Declaration
public override Stream Map(AssetLoaderContext assetLoaderContext, string originalFilename, out string finalPath)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | The current TriLib asset loading context containing model-related state. |
string | originalFilename | The original filename (or path) referencing external data. |
string | finalPath | The resolved final path of the file. This may be modified by your custom callback. |
Returns
Type | Description |
---|---|
Stream | An open Stream containing the external file data. |
Overrides
Remarks
When TriLib needs to load external data (e.g., texture files), it calls this method, allowing you to provide custom behavior such as streaming from memory or from an alternative storage location.
Setup(Func<string, Stream>, Func<string, string>)
Configures the callbacks used for external data mapping.
Declaration
public void Setup(Func<string, Stream> streamReceivingCallback, Func<string, string> finalPathReceivingCallback)
Parameters
Type | Name | Description |
---|---|---|
Func<string, Stream> | streamReceivingCallback | A required callback that returns the Stream used to read the requested file’s content. |
Func<string, string> | finalPathReceivingCallback | An optional callback that modifies or resolves the final file path before loading. |
Exceptions
Type | Condition |
---|---|
Exception | Thrown if |