Namespace P64::AssetManager¶
Functions¶
-
void P64::AssetManager::init()¶
-
void P64::AssetManager::freeAll()¶
Frees all currently loaded assets.
This should never be called manually, and is done automatically during a scene change.
-
void *P64::AssetManager::getByIndex(uint32_t idx)¶
Returns an asset handle by its asset-index.
Internally a table is used to prevent loading the same asset multiple time. So this function will cause a load if not already loaded, and return the same point on subsequent calls. During a scene-transition, all assets will be freed, so don’t keep any pointers around between scenes.
The index can be determined at build time with the provided ‘_asset’ suffix for string. For example: logoPyrite = (sprite_t*)AssetManager::getByIndex(“ui/logoPyrite.sprite”_asset);
- Parameters:
idx – index, the
_assetsuffix can be used- Returns:
pointer to asset, nullptr if not found
-
const char *P64::AssetManager::getPathByIndex(uint32_t idx)¶
-
float P64::AssetManager::getVertexScale(uint32_t idx)¶
Returns the vertex-scale of a 3D model asset: the factor that converts the model’s quantized vertex units back into meters (1 / import base-scale).
Pass it to Renderer::fillModelMatrixFP() when drawing a model manually. Returns 1.0 for non-model assets.
- Parameters:
idx – asset index, the
_assetsuffix can be used