feat(render): add model loading and rendering pipeline

This commit is contained in:
2026-07-24 18:35:09 +08:00
parent f4174724c6
commit 94fed9a810
20 changed files with 393 additions and 11 deletions

View File

@@ -0,0 +1,32 @@
#include "Cubed/render/model_manager.hpp"
#include "Cubed/tools/log.hpp"
namespace Cubed {
ModelManager::ModelManager() {}
ModelManager::~ModelManager() {}
void ModelManager::init() {
};
const ModelNode& ModelManager::get_model(const std::string& model_name) {
auto it = m_models.find(model_name);
if (it == m_models.end()) {
return load_model(model_name);
}
return it->second;
}
const ModelNode& ModelManager::load_model(const std::string& model_name) {
std::string path = ASSETS_PATH + model_name;
auto model = m_loader.load(path);
auto [it, instert] = m_models.try_emplace(model_name, std::move(model));
if (!instert) {
Logger::error("Model Key {} already exist!", model_name);
}
return it->second;
}
} // namespace Cubed