Dicewars-Siedler/src/engine/renderer/loader/AssetManager.h

34 lines
1.2 KiB
C++

//
// Created by sebastian on 08.02.26.
//
#ifndef ASSETMANAGER_H
#define ASSETMANAGER_H
#include <memory>
#include <unordered_map>
#include "json.hpp"
#include "../model/TexturedModel.h"
#include "Loader.h"
#include "../model/ModelStages.h"
class AssetManager {
public:
static std::shared_ptr<TexturedModel> loadModel(const std::string& name, const std::string& objPath, const std::string& texturePath, Loader& loader);
static std::shared_ptr<TexturedModel> getModel(const std::string& name);
static void insertGeneratedModel(const std::string& name, std::shared_ptr<TexturedModel> model);
static void loadAsset(const std::string& assetPath, Loader& loader);
static std::shared_ptr<ModelStages> getModelStages(const std::string& modelName);
static std::shared_ptr<ModelStageConfiguration> getModelStageConfiguration(const std::string& modelName, const std::string& stageName);
private:
static inline std::unordered_map<std::string, std::shared_ptr<TexturedModel>> models;
static inline std::unordered_map<std::string, std::shared_ptr<ModelStages>> modelsWithStages;
static nlohmann::json readJsonFile(const std::string &path);
};
#endif //ASSETMANAGER_H