Central asset registry — maps names to renderer model indices.
More...
#include <AssetRegistry.hpp>
|
| int | add (const std::string &name, const std::string &filename="", AssetRole role=AssetRole::Entity, glm::vec3 renderScale=glm::vec3{1.0f}, glm::vec3 renderTranslation=glm::vec3{0.0f}, glm::vec3 renderRotationDegrees=glm::vec3{0.0f}) |
| | Register a new asset. Returns its asset ID (index into entries_).
|
| void | setModelIndex (int assetId, int32_t modelIndex) |
| | Set the renderer model index for a registered asset.
|
| void | setHasCollision (int assetId, bool v=true) |
| | Mark an asset as having collision data.
|
| int32_t | modelIndex (const std::string &name) const |
| | Look up the renderer model index by asset name. Returns -1 if not found.
|
| int32_t | modelIndex (int assetId) const |
| | Look up the renderer model index by asset ID. Returns -1 if out of range.
|
| int | id (const std::string &name) const |
| | Look up asset ID by name. Returns -1 if not found.
|
| const AssetEntry & | entry (int assetId) const |
| | Get a read-only reference to an entry.
|
| int | count () const |
| | Number of registered assets.
|
| const std::vector< AssetEntry > & | entries () const |
| | All entries (for debug UI / logging).
|
Central asset registry — maps names to renderer model indices.
Usage: int id = assets.add("porsche", "free_1975_porsche_911_930_turbo.glb", AssetRole::Prop); assets.setModelIndex(id, renderer.loadSceneModel(...)); int modelIdx = assets.modelIndex("porsche"); // → the renderer index int modelIdx = assets.modelIndex(id); // → same thing
◆ add()
| int AssetRegistry::add |
( |
const std::string & | name, |
|
|
const std::string & | filename = "", |
|
|
AssetRole | role = AssetRole::Entity, |
|
|
glm::vec3 | renderScale = glm::vec3{1.0f}, |
|
|
glm::vec3 | renderTranslation = glm::vec3{0.0f}, |
|
|
glm::vec3 | renderRotationDegrees = glm::vec3{0.0f} ) |
|
inline |
Register a new asset. Returns its asset ID (index into entries_).
◆ count()
| int AssetRegistry::count |
( |
| ) |
const |
|
inlinenodiscard |
Number of registered assets.
◆ entries()
| const std::vector< AssetEntry > & AssetRegistry::entries |
( |
| ) |
const |
|
inlinenodiscard |
All entries (for debug UI / logging).
◆ entry()
| const AssetEntry & AssetRegistry::entry |
( |
int | assetId | ) |
const |
|
inlinenodiscard |
Get a read-only reference to an entry.
◆ id()
| int AssetRegistry::id |
( |
const std::string & | name | ) |
const |
|
inlinenodiscard |
Look up asset ID by name. Returns -1 if not found.
◆ modelIndex() [1/2]
| int32_t AssetRegistry::modelIndex |
( |
const std::string & | name | ) |
const |
|
inlinenodiscard |
Look up the renderer model index by asset name. Returns -1 if not found.
◆ modelIndex() [2/2]
| int32_t AssetRegistry::modelIndex |
( |
int | assetId | ) |
const |
|
inlinenodiscard |
Look up the renderer model index by asset ID. Returns -1 if out of range.
◆ setHasCollision()
| void AssetRegistry::setHasCollision |
( |
int | assetId, |
|
|
bool | v = true ) |
|
inline |
Mark an asset as having collision data.
◆ setModelIndex()
| void AssetRegistry::setModelIndex |
( |
int | assetId, |
|
|
int32_t | modelIndex ) |
|
inline |
Set the renderer model index for a registered asset.
◆ entries_
◆ nameToId_
| std::unordered_map<std::string, int> AssetRegistry::nameToId_ |
|
private |
The documentation for this class was generated from the following file: