when a resource is not found, an exceptions is thrown

This commit is contained in:
arthur.jamet
2021-06-17 11:17:18 +02:00
parent 5a948bca46
commit 1f1379a5a5
11 changed files with 67 additions and 16 deletions
+7 -1
View File
@@ -7,7 +7,13 @@
#include "Model/ModelAnimations.hpp"
RAY::Cache<::ModelAnimation> RAY::ModelAnimations::_animationsCache(LoadModelAnimations, UnloadModelAnimations);
RAY::Cache<::ModelAnimation> RAY::ModelAnimations::_animationsCache([] (const char *str, int *counter) {
::ModelAnimation *modelanimations = LoadModelAnimations(str, counter);
if (modelanimations == nullptr)
throw Exception::ResourceNotFound(std::string(str));
return modelanimations;
}, UnloadModelAnimations);
RAY::ModelAnimations::ModelAnimations(const std::string &filePath):
_animationsPtr(_animationsCache.fetch(filePath, &this->_animationCount)),