Central manager responsible for loading, storing, and managing all engine assets. Supports meshes, textures, and materials. Ensures that assets are loaded only once and reused when requested again.
More...
#include <AssetManager.hpp>
|
| void | Initialize (ID3D11Device *device, ID3D11DeviceContext *context) |
| | Initializes the AssetManager with the Direct3D device and context. These are required for creating GPU resources (buffers, textures, etc.).
|
| template<typename T> |
| std::shared_ptr< T > | Load (const std::string &path) |
| | Loads an asset of type T from the specified path. If the asset is already loaded, returns the cached version.
|
| std::shared_ptr< Material > | LoadMaterialForMesh (const std::string &meshPath) |
| | Loads the material associated with a specific mesh. Typically used when meshes reference material files.
|
| void | Reload (const std::string &path) |
| | Reloads an asset from disk. Useful for hot-reloading during development.
|
| void | UnloadAll () |
| | Unloads all currently loaded assets and frees associated resources.
|
| const std::unordered_map< std::string, std::shared_ptr< MeshAsset > > & | GetMeshes () const |
| | Returns the map of all loaded meshes.
|
| const std::unordered_map< std::string, std::shared_ptr< TextureAsset > > & | GetTextures () const |
| | Returns the map of all loaded textures.
|
| | AssetManager ()=default |
| | Default constructor.
|
| | ~AssetManager () |
| | Destructor responsible for cleaning up loaded assets.
|
| | AssetManager (const AssetManager &)=delete |
| | Disable copy constructor.
|
| AssetManager & | operator= (const AssetManager &)=delete |
| | Disable assignment operator.
|
Central manager responsible for loading, storing, and managing all engine assets. Supports meshes, textures, and materials. Ensures that assets are loaded only once and reused when requested again.
◆ AssetManager() [1/2]
| AssetManager::AssetManager |
( |
| ) |
|
|
default |
◆ ~AssetManager()
| AssetManager::~AssetManager |
( |
| ) |
|
Destructor responsible for cleaning up loaded assets.
◆ AssetManager() [2/2]
Disable copy constructor.
◆ Get()
◆ GetMeshes()
| const std::unordered_map< std::string, std::shared_ptr< MeshAsset > > & AssetManager::GetMeshes |
( |
| ) |
const |
|
inline |
Returns the map of all loaded meshes.
- Returns
- Reference to the mesh asset map
◆ GetTextures()
| const std::unordered_map< std::string, std::shared_ptr< TextureAsset > > & AssetManager::GetTextures |
( |
| ) |
const |
|
inline |
Returns the map of all loaded textures.
- Returns
- Reference to the texture asset map
◆ Initialize()
| void AssetManager::Initialize |
( |
ID3D11Device * | device, |
|
|
ID3D11DeviceContext * | context ) |
Initializes the AssetManager with the Direct3D device and context. These are required for creating GPU resources (buffers, textures, etc.).
- Parameters
-
| device | D3D11 device used to create GPU resources |
| context | D3D11 device context used for rendering |
◆ Load()
template<typename T>
| std::shared_ptr< T > AssetManager::Load |
( |
const std::string & | path | ) |
|
|
inline |
Loads an asset of type T from the specified path. If the asset is already loaded, returns the cached version.
- Template Parameters
-
- Parameters
-
| path | File path of the asset |
- Returns
- Shared pointer to the loaded asset
◆ LoadMaterialForMesh()
| std::shared_ptr< Material > AssetManager::LoadMaterialForMesh |
( |
const std::string & | meshPath | ) |
|
Loads the material associated with a specific mesh. Typically used when meshes reference material files.
- Parameters
-
- Returns
- Shared pointer to the material
◆ operator=()
Disable assignment operator.
◆ Reload()
| void AssetManager::Reload |
( |
const std::string & | path | ) |
|
Reloads an asset from disk. Useful for hot-reloading during development.
- Parameters
-
| path | Path of the asset to reload |
◆ UnloadAll()
| void AssetManager::UnloadAll |
( |
| ) |
|
Unloads all currently loaded assets and frees associated resources.
The documentation for this class was generated from the following file: