LoadAssetFn#

Fully qualified name: carb::assets::LoadAssetFn

Defined in carb/assets/AssetsTypes.h

using carb::assets::LoadAssetFn = void *(*)(carb::datasource::IDataSource *dataSource, carb::datasource::Connection *connection, const char *path, const uint8_t *data, size_t size, const LoadParameters *loadParameters, LoadContext *loadContext, IsLoadCanceledFn isLoadCanceled, void *isLoadCanceledUserData)#

Loader function (member of LoaderDesc) used to construct an asset from raw data.

Though the raw data for path has already been loaded from dataSource and connection, they are all provided to this function in case additional data must be loaded.

Note

This function is called in Task Context (from carb::tasking::ITasking), therefore the called function is free to await any fiber-aware I/O functions (i.e. sleep in a fiber safe manner) without bottlenecking the system.

Param dataSource:

The datasource the asset is being loaded from.

Param connection:

The connection the asset is being loaded from.

Param path:

The path the file was loaded from.

Param data:

The data to be loaded.

Param size:

The size of the data (in bytes) to be loaded.

Param loadParameters:

Optional parameters passed from IAssets::loadAsset() (Asset Type specific).

Param loadContext:

A context generated by CreateContextFn, if one was provided.

Param isLoadCanceled:

A function that can be called periodically to determine if load should be canceled. This function need only be called if the load process has multiple steps or lots of processing.

Param isLoadCanceledUserData:

User data that must be provided to isLoadCanceled when (if) it is called.

Return:

The loaded Asset, or nullptr if loading is aborted or an error occurred.