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 fromdataSource
andconnection
, 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.
- Parameters
dataSource – The datasource the asset is being loaded from.
connection – The connection the asset is being loaded from.
path – The path the file was loaded from.
data – The data to be loaded.
size – The size of the data (in bytes) to be loaded.
loadParameters – Optional parameters passed from IAssets::loadAsset() (Asset Type specific).
loadContext – A context generated by CreateContextFn, if one was provided.
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.
isLoadCanceledUserData – User data that must be provided to
isLoadCanceled
when (if) it is called.
- Returns
The loaded Asset, or
nullptr
if loading is aborted or an error occurred.