carb::assets::CreateContextFn
Defined in carb/assets/AssetsTypes.h
-
using carb::assets::CreateContextFn = LoadContext *(*)(carb::datasource::IDataSource *dataSource, carb::datasource::Connection *connection, const char *path, const uint8_t *data, size_t size, const LoadParameters *loadParameters)
Loader function (member of LoaderDesc) that informs the asset type that loading a file has started and creates any load-specific context data necessary.
This function gives the programmer the option to do initial work that may be repetitive in the function calls that load the file.
The created context only exists during the loading of the asset, after the asset is loaded this context is destroyed with DestroyContextFn.
Note
This callback is optional, if it isn’t provided, in future callbacks
loadContext
will benullptr
. If this function is provided, DestroyContextFn should also be provided to destroy the context.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 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 of the file that is being loaded.
- Param data
The data read at the asset’s URI path.
- Param size
The size of the data read in bytes.
- Param loadParameters
The load parameters passed to IAssets::loadAsset(), or
nullptr
.- Return
A derivative of LoadContext that is passed to LoadAssetFn and CreateDependenciesFn.