10#include <unordered_map>
17struct MaterialSettings;
106 std::unordered_map<std::string, std::shared_ptr<Material>>
mMaterials;
Interface for observing renderer resource lifecycle events.
Defines an abstract interface for rendering backends.
Manages creation, storage, and lifecycle of Material objects within the rendering engine.
void OnRenderResourcesRebuild() override
Renderer callback: re-upload or recreate all GPU resources (used after device reset/rebuild).
Material * GetMaterial(std::string materialName)
Retrieves a pointer to a Material instance by name.
void CreateBuildInMaterials()
Creates built-in materials for testing or demonstration.
void RemoveMaterial(std::string materialName)
Removes a material from the cache.
MaterialCache(IRenderer *renderer)
Constructs a MaterialCache and registers it as a renderer observer.
void AddMaterial(MaterialSettings matSettings)
Adds a new Material instance using the provided settings.
std::unordered_map< std::string, std::shared_ptr< Material > > mMaterials
~MaterialCache()
Destructor. Automatically unregisters from the renderer.
void OnRenderResourcesRelease() override
Renderer callback: release all GPU resources (used during device loss/reset).
void ReleaseAll()
Releases all GPU resources associated with cached materials.
Represents a material instance with parameter values, texture bindings, and rendering configuration.
Settings required to define a material instance.