25 setBasicTexture3D.
materialName = std::string{
"BasicTexture3D" };
32 if (basicTexture3DMat)
34 basicTexture3DMat->
AddTexture(
"test_cube_color");
41 setFlatColorFiltering.
materialName = std::string{
"FlatColorFiltering" };
48 if (flatColorFilteringMat)
50 flatColorFilteringMat->
AddTexture(
"D4FontTextureSegoeScript");
65 testSprite2dMat->
AddTexture(
"PNG_transparency_demonstration_1");
95 it->second->ReleaseRenderResources();
109 material.second->ReleaseRenderResources();
117 material.second->InitializeRenderResources();
Defines an abstract interface for rendering backends.
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.
void InitializeRenderResources()
Initializes backend-specific GPU resources associated with this material.
void AddTexture(const std::string &textureName)
Adds a texture name to the material's list of used textures.
Settings required to define a material instance.
MaterialDomain materialDomain
ShadingModel shadingModel