Class ReaderBase
Represents the base class used in all file-format Readers.
Inherited Members
Namespace: TriLibCore
Assembly: TriLibCore.dll
Syntax
public abstract class ReaderBase
Constructors
ReaderBase()
Declaration
protected ReaderBase()
Fields
ProfileStepCallback
Assign a method to this callback to be called by the builtin profiler.
Declaration
public static Action<string, string, TimeSpan, long> ProfileStepCallback
Field Value
Type | Description |
---|---|
Action<string, string, TimeSpan, long> |
Properties
AssetLoaderContext
Gets the Asset Loader Context used to load the Model.
Declaration
public AssetLoaderContext AssetLoaderContext { get; }
Property Value
Type | Description |
---|---|
AssetLoaderContext |
LoadingStepEnumType
Gets the Type used to track loading steps.
Declaration
protected abstract Type LoadingStepEnumType { get; }
Property Value
Type | Description |
---|---|
Type |
LoadingStepsCount
Gets the number of loading steps.
Declaration
public virtual int LoadingStepsCount { get; }
Property Value
Type | Description |
---|---|
int |
Name
Gets this reader name.
Declaration
public abstract string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
CreateRootModel()
Creates a RootModel.
Declaration
protected abstract IRootModel CreateRootModel()
Returns
Type | Description |
---|---|
IRootModel | The created RootModel. |
GetCurrentStepName()
Declaration
protected virtual string GetCurrentStepName()
Returns
Type | Description |
---|---|
string |
MapName(AssetLoaderContext, ModelNamingData, IModel, string)
Uses the object reader data to create the final model name. If the AssetLoaderOptions used has a NameMapper, the NameMapper will be used instead.
Declaration
public string MapName(AssetLoaderContext assetLoaderContext, ModelNamingData data, IModel model, string readerName)
Parameters
Type | Name | Description |
---|---|---|
AssetLoaderContext | assetLoaderContext | |
ModelNamingData | data | |
IModel | model | |
string | readerName |
Returns
Type | Description |
---|---|
string | The final model name. |
PostProcessModel(ref IRootModel)
Applies final post-processing to the Model.
Declaration
protected void PostProcessModel(ref IRootModel model)
Parameters
Type | Name | Description |
---|---|---|
IRootModel | model | The source Model. |
ProfileStep(ProfileContext)
Declaration
protected virtual void ProfileStep(ReaderBase.ProfileContext profileContext)
Parameters
Type | Name | Description |
---|---|---|
ReaderBase.ProfileContext | profileContext |
ReadExternalFile(string)
Reads an external file into a Stream trying to use the external data mapper first, if there is one.
Declaration
public virtual Stream ReadExternalFile(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The external file path. |
Returns
Type | Description |
---|---|
Stream | The external file stream. |
ReadStream(Stream, AssetLoaderContext, string, Action<AssetLoaderContext, float>)
Loads a Model from the given Stream.
Declaration
public virtual IRootModel ReadStream(Stream stream, AssetLoaderContext assetLoaderContext, string filename = null, Action<AssetLoaderContext, float> onProgress = null)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The Stream containing the Model data. |
AssetLoaderContext | assetLoaderContext | The Asset Loader Context reference. Asset Loader Context contains the Model loading data. |
string | filename | The Model filename, if loading from local storage. |
Action<AssetLoaderContext, float> | onProgress | The Method to call when the Model loading progress changes. |
Returns
Type | Description |
---|---|
IRootModel | The loaded root model. |
SetupStream(ref Stream)
Declaration
public void SetupStream(ref Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream |
UpdateLoadingPercentage(float, int, float)
Updates the Model loading percentage.
Declaration
public void UpdateLoadingPercentage(float value, int step = 0, float maxValue = 0)
Parameters
Type | Name | Description |
---|---|---|
float | value | The loading percentage. |
int | step | The loading process step. |
float | maxValue | The maximum 'value' field value. |