summaryrefslogtreecommitdiffstats
path: root/src/AssetManager.cpp
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-06-13 10:47:33 +0200
committerLaG1924 <lag1924@gmail.com>2021-06-13 10:47:33 +0200
commitf2266b843959413277767a990bb9a9c5593f3489 (patch)
treef26e90e9f7ceb9be3c108eb5129305356ac8df3a /src/AssetManager.cpp
parentAdded RmlUi to CMakeLists.txt (diff)
downloadAltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.gz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.bz2
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.lz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.xz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.zst
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.zip
Diffstat (limited to '')
-rw-r--r--src/AssetManager.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/AssetManager.cpp b/src/AssetManager.cpp
index 514d008..0db495a 100644
--- a/src/AssetManager.cpp
+++ b/src/AssetManager.cpp
@@ -402,22 +402,26 @@ void ParseAssetShader(AssetTreeNode &node) {
std::string vertPath = j["vert"].get<std::string>();
std::string fragPath = j["frag"].get<std::string>();
- AssetTreeNode *vertAsset = AssetManager::GetAssetByAssetName(vertPath);
- AssetTreeNode *fragAsset = AssetManager::GetAssetByAssetName(fragPath);
+ AssetTreeNode* vertAsset = AssetManager::GetAssetByAssetName(vertPath);
+ AssetTreeNode* fragAsset = AssetManager::GetAssetByAssetName(fragPath);
std::string vertSource((char*)vertAsset->data.data(), (char*)vertAsset->data.data() + vertAsset->data.size());
std::string fragSource((char*)fragAsset->data.data(), (char*)fragAsset->data.data() + fragAsset->data.size());
std::vector<std::string> uniforms;
- for (auto &it : j["uniforms"]) {
+ for (auto& it : j["uniforms"]) {
uniforms.push_back(it.get<std::string>());
}
node.asset = std::make_unique<AssetShader>();
- AssetShader *asset = dynamic_cast<AssetShader*>(node.asset.get());
+ AssetShader* asset = dynamic_cast<AssetShader*>(node.asset.get());
asset->shader = std::make_unique<Shader>(vertSource, fragSource, uniforms);
+ } catch (std::exception &e) {
+ glCheckError();
+ LOG(ERROR) << "Shader asset parsing failed: " << e.what();
} catch (...) {
glCheckError();
+ LOG(ERROR) << "Shader asset parsing failed with unknown reason";
return;
}
}