49 lines
2.1 KiB
C++
49 lines
2.1 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 "Texture2D.h"
|
|
#include "../../core/gui/text/UiTheme.h"
|
|
#include "../model/ModelStages.h"
|
|
|
|
|
|
class Font;
|
|
|
|
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);
|
|
static std::shared_ptr<ModelTexture> loadTexture(const std::string &name, const std::string &texturePath, Loader &loader);
|
|
static std::shared_ptr<ModelTexture> getTexture(const std::string& texturePath);
|
|
static std::shared_ptr<UiTheme> getUiTheme(const std::string& themeName);
|
|
static std::shared_ptr<UiTheme> loadUiTheme(const std::string& themeName, const std::string& themePath);
|
|
|
|
static void insertLoadedTexture(const std::string& name, const Texture2D& texture);
|
|
static void insertTexturedModel(const std::string & name, const TexturedModel & textured_model);
|
|
static void insertModelStages(const std::string &name, ModelStages modelStages);
|
|
|
|
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 inline std::unordered_map<std::string, std::shared_ptr<ModelTexture>> textures;
|
|
static inline std::unordered_map<std::string, std::shared_ptr<UiTheme>> uiThemes;
|
|
|
|
static nlohmann::json readJsonFile(const std::string &path);
|
|
};
|
|
|
|
|
|
|
|
#endif //ASSETMANAGER_H
|