Resource Management
Documentation for the ResourceManager, explaining how assets are loaded and managed.
Overview
The ResourceManager is a central system in Nevo Engine responsible for loading, storing, and managing the lifecycle of various assets used by the engine. It handles both high-level metadata and low-level GPU resources.
Managed Resources
The ResourceManager tracks several types of resources:
- Meshes: 3D model data (vertices, indices).
- Shaders: High-level shader metadata and compiled GPU shader programs.
- Materials: Definitions of how surfaces should be rendered, including properties, color, and optional textures.
- Textures: Image data and corresponding GPU textures.
- Scenes: Hierarchical entity structures loaded from scene files.
- Graphics Buffers: Low-level GPU buffers (VBO, EBO, VAO).
Resource Lifecycle
Registration
Resources are typically registered in pairs: high-level metadata along with its corresponding GPU resource.
void RegisterMeshResource(const std::string &name, MeshPtr mesh, ...);
void RegisterShaderResource(const std::string &name, ShaderPtr shader, ...);
void RegisterTextureResource(const std::string &name, TexturePtr texture, ...);Retrieval
Assets can be retrieved by their unique string identifiers.
Mesh* mesh = resourceManager.GetMesh("player_model");
Material* material = resourceManager.GetMaterial("gold_material");
GraphicsTexture* texture = resourceManager.GetGraphicTexture("brick_diffuse");Removal and Cleanup
The ResourceManager provides methods to remove specific resources or clear entire collections, ensuring proper cleanup of both CPU and GPU memory.
resourceManager.RemoveMeshResource("player_model");
resourceManager.ClearAll(); // Destroys all managed resourcesPerformance
The ResourceManager is optimized for fast retrieval using hash maps and is integrated with the Tracy profiler for real-time performance monitoring.
