Loading...
Searching...
No Matches
AssetManager.h
Go to the documentation of this file.
1//
2// Created by denzel on 08/12/2025.
3//
4
5#pragma once
7#include "hellfire/graphics/Mesh.h"
8
9namespace hellfire {
11 public:
12 explicit AssetManager(AssetRegistry& registry);
13
14 // Typed asset loading with caching
15 std::shared_ptr<Mesh> get_mesh(AssetID id);
16 std::shared_ptr<Material> get_material(AssetID id);
17 std::shared_ptr<Texture> get_texture(AssetID id, TextureType type);
18
19 // Cache management
20 void unload(AssetID id);
21 void clear_cache();
22 void reload_modified(); // Reload assets that changed on disk
23
24 // Stats
25 size_t get_loaded_mesh_count() const { return mesh_cache_.size(); }
26 size_t get_loaded_material_count() const { return material_cache_.size(); }
27 size_t get_loaded_texture_count() const { return texture_cache_.size(); }
28
29 private:
31
35 };
36} // hellfire
size_t get_loaded_mesh_count() const
std::unordered_map< AssetID, std::shared_ptr< Texture > > texture_cache_
AssetManager(AssetRegistry &registry)
std::shared_ptr< Mesh > get_mesh(AssetID id)
size_t get_loaded_material_count() const
void unload(AssetID id)
AssetRegistry & registry_
std::shared_ptr< Texture > get_texture(AssetID id, TextureType type)
std::unordered_map< AssetID, std::shared_ptr< Material > > material_cache_
size_t get_loaded_texture_count() const
std::shared_ptr< Material > get_material(AssetID id)
std::unordered_map< AssetID, std::shared_ptr< Mesh > > mesh_cache_
Registry for storing assets.
std::filesystem::path get_absolute_path(AssetID uuid)
static std::optional< MaterialData > load(const std::filesystem::path &filepath)
static std::shared_ptr< Mesh > load(const std::filesystem::path &filepath)
TextureType
Definition Texture.h:13