.. _program_listing_file_include_Ramus_Assets_AssetManager.hpp: Program Listing for File AssetManager.hpp ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``include/Ramus/Assets/AssetManager.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #pragma once #include "Ramus/Assets/Loaders/MaterialLoader.hpp" #include "Ramus/Assets/Loaders/ModelLoader.hpp" #include "Ramus/Assets/Loaders/TextureLoader.hpp" #include #include /* #include "Ramus/Assets/IResourceService.hpp" #include "Ramus/Assets/Loaders/AssetLoader.hpp" #include namespace ramus { template using ResourceCache = std::unordered_map>; class Model; class Texture; class Shader; class ResourceService : public IResourceService { public: ResourceService(); ~ResourceService() override = default; std::shared_ptr GetModel(const std::string& modelPath) override ; std::shared_ptr GetTexture(const std::string& texturePath) override; std::shared_ptr GetShader(const std::string& shaderPath) override; private: template std::shared_ptr GetResource(const std::string& path, ResourceCache& cache, AssetLoader& loader); std::unique_ptr> m_modelLoader; std::unique_ptr> m_textureLoader; std::unique_ptr> m_shaderLoader; ResourceCache m_modelCache; ResourceCache m_textureCache; ResourceCache m_shaderCache; }; } */ namespace ramus { template using AssetCache = std::unordered_map>; class Material; class Model; class Texture; class AssetManager { public: AssetManager(); std::shared_ptr GetMaterial(const std::string& shaderPath); std::shared_ptr GetModel(const std::string& modelPath); std::shared_ptr GetTexture(const std::string& texturePath); private: std::unique_ptr m_materialLoader; std::unique_ptr m_modelLoader; std::unique_ptr m_textureLoader; AssetCache m_materialCache; AssetCache m_modelCache; AssetCache m_textureCache; template std::shared_ptr GetAsset(const std::string& path, AssetCache& cache, AssetLoader& loader); }; }