![]() |
Raven Engine v0.1
|
Central manager for material lifetimes and asset persistence. More...
#include <MaterialRegistry.h>
Public Member Functions | |
| MaterialRegistry ()=default | |
| ~MaterialRegistry ()=default | |
| void | Shutdown () |
| Destroys all registered materials and clears registry state. | |
| MaterialHandle | LoadMaterialAsset (const std::string &assetPath) |
| Load a material asset from disk or return existing slot handle. | |
| MaterialHandle | CreateMaterialTransient (const Ref< Material > &mat) |
| Register a transient runtime-only material. | |
| MaterialHandle | CreateOrLoadMaterial (const MaterialAsset &desc) |
| Create a new material or load existing from disk. | |
| Ref< Material > | GetMaterial (const MaterialHandle &handle) |
| Resolve a Ref<Material> from a handle. | |
| void | RemoveMaterial (const MaterialHandle &handle) |
| Remove a material and free its slot. | |
| bool | SaveMaterial (const MaterialHandle &handle) |
| Persist a material asset to disk. | |
Central manager for material lifetimes and asset persistence.
MaterialRegistry provides both runtime and asset-backed material creation. It hides the complexity of reference management, slot reuse, and serialization.
Key workflows:
Handles remain valid until their version mismatches with the slot version.
|
default |
|
default |
| MaterialHandle Raven::MaterialRegistry::CreateMaterialTransient | ( | const Ref< Material > & | mat | ) |
Register a transient runtime-only material.
| mat | Ref<Material> to register. |
| MaterialHandle Raven::MaterialRegistry::CreateOrLoadMaterial | ( | const MaterialAsset & | desc | ) |
Create a new material or load existing from disk.
| desc | MaterialAsset descriptor. |
| 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::string & | assetPath | ) |
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.