carb::assets::CreateDependenciesFn

Defined in carb/assets/AssetsTypes.h

using carb::assets::CreateDependenciesFn = const char *(*)(carb::datasource::IDataSource *dataSource, carb::datasource::Connection *connection, const char *path, const uint8_t *data, size_t size, const LoadParameters *loadParameters, LoadContext *context)

Loader function (member of LoaderDesc) that returns a string of the asset dependencies, that is, other files to watch for changes.

This function is optional, if it isn’t provided, then only path (passed to IAssets::loadAsset()) will be monitored for changes.

Many asset types, such as shaders, include additional files to generate their content. In this case it isn’t just the original file changing that requires the asset to be reloaded, if any dependent file changes, then the asset has to be reloaded as well.

Multiple dependencies must separated by the | character.

Parameters
  • dataSource – The datasource the asset is being loaded from.

  • connection – The connection the asset is being loaded from.

  • path – The path of the file that is being loaded.

  • data – The loaded data of the requested assets file.

  • size – The size of the requested asset file.

  • loadParameters – The load parameters provided to IAssets::loadAsset().

  • context – The context if any generated by CreateContextFn.

Returns

A string containing dependencies to watch, delimited by |; nullptr may be returned to indicate no dependencies. The returned pointer will be passed to DestroyDependenciesFn to clean up the returned memory.