mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-06 03:12:01 +00:00
when a resource is not found, an exceptions is thrown
This commit is contained in:
@@ -13,7 +13,13 @@
|
||||
namespace RAY::Drawables::Drawables3D
|
||||
{
|
||||
|
||||
RAY::Cache<::Model> Model::_modelsCache(LoadModel, UnloadModel);
|
||||
RAY::Cache<::Model> Model::_modelsCache([] (const char *str) {
|
||||
::Model model = LoadModel(str);
|
||||
|
||||
if (model.meshCount == 0)
|
||||
throw Exception::ResourceNotFound(std::string(str));
|
||||
return model;
|
||||
}, UnloadModel);
|
||||
|
||||
Model::Model(const std::string &filename,
|
||||
bool lonely,
|
||||
|
||||
@@ -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)),
|
||||
|
||||
Reference in New Issue
Block a user