Registry store for material asset handles.
More...
#include <AssetRegistry.h>
|
| struct | Record |
| | Stored metadata for one material handle slot. More...
|
|
| static std::string | keyFor (const Asset::MeshPath &materialPath) |
| | Builds the deduplication key for a material path and material name.
|
|
| AssetManager * | assetManager_ = nullptr |
| | Optional bridge used to request and register legacy materials.
|
| std::vector< Record > | records_ |
| | Slot storage indexed by MaterialHandle::index.
|
| std::unordered_map< std::string, uint32_t > | pathToIndex_ |
| | Deduplication map from keyFor() to slot index.
|
Registry store for material asset handles.
MaterialStore maps authored material paths to stable MaterialHandle values and can bridge those handles back to legacy material asset refs.
Definition at line 158 of file AssetRegistry.h.
◆ MaterialStore()
| Engine::Core::MaterialStore::MaterialStore |
( |
AssetManager * | assetManager = nullptr | ) |
|
|
explicit |
Creates a material store backed by an optional asset manager.
- Parameters
-
| assetManager | Asset manager used to request material payload loads, or nullptr for handle-only use. |
◆ isValid()
Checks whether a material handle refers to a live slot in this store.
- Parameters
-
| handle | Handle to validate. |
- Returns
- True when the handle index and generation match a stored record.
◆ keyFor()
| std::string Engine::Core::MaterialStore::keyFor |
( |
const Asset::MeshPath & | materialPath | ) |
|
|
staticnodiscardprivate |
Builds the deduplication key for a material path and material name.
- Parameters
-
| materialPath | Material source path and material name. |
- Returns
- Stable string key used by pathToIndex_.
◆ load()
Gets or creates a stable handle for an authored material path.
- Parameters
-
| materialPath | Engine-relative source path and material name. |
- Returns
- Existing or newly created material handle, or a null handle for an empty path.
- Exceptions
-
| std::invalid_argument | when materialPath contains an absolute source path. |
◆ path()
Returns the authored material path for a material handle.
- Parameters
-
- Returns
- Pointer to the stored material path, or nullptr when the handle is invalid.
◆ registerRuntimeMaterial()
Registers a runtime material payload and returns its stable material handle.
- Parameters
-
| materialPath | Engine-relative path and material name used as the registry key. |
| material | Material payload to transfer to the attached asset manager. |
- Returns
- Material handle, or a null handle when materialPath is empty or material is null.
◆ setAssetManager()
| void Engine::Core::MaterialStore::setAssetManager |
( |
AssetManager * | assetManager | ) |
|
Sets the asset manager used when new material handles request payload loading.
- Parameters
-
| assetManager | Asset manager to use, or nullptr to disable payload load requests. |
◆ assetManager_
| AssetManager* Engine::Core::MaterialStore::assetManager_ = nullptr |
|
private |
Optional bridge used to request and register legacy materials.
Definition at line 222 of file AssetRegistry.h.
◆ pathToIndex_
| std::unordered_map<std::string, uint32_t> Engine::Core::MaterialStore::pathToIndex_ |
|
private |
Deduplication map from keyFor() to slot index.
Definition at line 224 of file AssetRegistry.h.
◆ records_
| std::vector<Record> Engine::Core::MaterialStore::records_ |
|
private |
Slot storage indexed by MaterialHandle::index.
Definition at line 223 of file AssetRegistry.h.
The documentation for this class was generated from the following file:
- /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Asset/AssetRegistry.h