10#include <unordered_map>
88 std::string
UploadModelToRAM(std::string fileName, std::vector<uint8_t>
const& fileBytes);
150 std::unordered_map<std::string, std::shared_ptr<MeshDataGpu>>
mModels;
Interface for GPU mesh resource management.
Defines an abstract interface for rendering backends.
Interface for observing renderer resource lifecycle events.
Manages mesh data in RAM and GPU, including upload and release operations.
void CreateQuad2D()
Creates a built-in 2D quad mesh.
void ReleaseAll()
Remove all models from both GPU and RAM, clearing the cache.
void UploadModelToGPU(std::string filename)
Upload a cached model's mesh data to the GPU.
std::shared_ptr< MeshDataGpu > GetMeshResources(std::string filename)
Get a shared pointer to the MeshDataGpu for a model.
IMeshRenderResources * GetMeshRenderResources(std::string filename)
Get the IMeshRenderResources interface for a model's GPU resources.
std::unordered_map< std::string, std::shared_ptr< MeshDataGpu > > mModels
~ModelCache()
Destructor. Releases all resources and unregisters observer.
size_t GetSizeInRAM() const
Get the total size (in bytes) of all models loaded in RAM.
void LoadModelsFromFolder(std::string pathToFolder)
Load all models found in the specified folder into RAM.
size_t GetSizeInGPU() const
Get the total size (in bytes) of all models currently resident on GPU.
void OnRenderResourcesRebuild() override
Renderer callback: re-upload or recreate all GPU resources (used after device reset/rebuild).
std::string UploadModelToRAM(std::string path)
Load a single model from file into RAM.
void OnRenderResourcesRelease() override
Renderer callback: release all GPU resources (used during device loss/reset).
void LoadModelsFromPackage()
Load all models from the packed asset container.
void ReleaseAllFromGPU()
Release all model mesh data from GPU memory.
ModelCache(IRenderer *renderer)
Construct a ModelCache and register it with the given renderer.
void ReleaseModelFromGPU(std::string filename)
Release a model's mesh data from GPU memory.