Central manager for material lifetimes. More...
#include <MaterialRegistry.h>
Inherits Raven::RefCounted.
Public Member Functions | |
| MaterialRegistry ()=default | |
| ~MaterialRegistry ()=default | |
| ILLUMINE_API void | Shutdown () |
| Destroys all registered materials and clears registry state. | |
| ILLUMINE_API MaterialHandle | LoadMaterialAsset (const std::filesystem::path &materialPath) |
| Load a material asset from disk or return existing slot handle. | |
| ILLUMINE_API MaterialHandle | CreateOrLoadMaterial (const MaterialAsset &desc) |
| Create a new material or load existing from disk. | |
| ILLUMINE_API Ref< Material > | GetMaterial (const MaterialHandle &handle) |
| Resolve a Ref<Material> from a handle. | |
| ILLUMINE_API void | RemoveMaterial (const MaterialHandle &handle) |
| Remove a material and free its slot. | |
| ILLUMINE_API bool | SaveMaterial (const MaterialHandle &handle) |
| Persist a material asset to disk. | |
| glz::ordered_map< MaterialHandle, Slot > & | GetAllSlots () |
| Get all registered material Slots. | |
| Public Member Functions inherited from Raven::RefCounted | |
| RefCounted () | |
| virtual | ~RefCounted () |
| void | IncRefCount () |
| void | DecRefCount () |
| u32 | GetRefCount () const |
Central manager for material lifetimes.
MaterialRegistry provides both runtime and asset-backed material creation. It hides the complexity of reference management, slot reuse, and serialization.
Key workflows:
|
default |
|
default |
| MaterialHandle Raven::MaterialRegistry::CreateOrLoadMaterial | ( | const MaterialAsset & | desc | ) |
Create a new material or load existing from disk.
| desc | MaterialAsset descriptor. |
|
inline |
Get all registered material Slots.
| Ref< Material > Raven::MaterialRegistry::GetMaterial | ( | const MaterialHandle & | handle | ) |
Resolve a Ref<Material> from a handle.
| handle | MaterialHandle to resolve. |
| MaterialHandle Raven::MaterialRegistry::LoadMaterialAsset | ( | const std::filesystem::path & | materialPath | ) |
Load a material asset from disk or return existing slot handle.
| assetPath | Normalized relative path to the JSON material file. |
| void Raven::MaterialRegistry::RemoveMaterial | ( | const MaterialHandle & | handle | ) |
Remove a material and free its slot.
| handle | MaterialHandle to remove. |
| bool Raven::MaterialRegistry::SaveMaterial | ( | const MaterialHandle & | handle | ) |
Persist a material asset to disk.
| handle | MaterialHandle of material to save. |
| void Raven::MaterialRegistry::Shutdown | ( | ) |
Destroys all registered materials and clears registry state.
Calls VulkanMaterial::Destroy() on Vulkan-backed materials to ensure descriptor sets are released before GPU shutdown.