first pr fixes from reviews

This commit is contained in:
Clément Le Bihan
2021-06-02 18:14:44 +02:00
parent e45942d532
commit 3790b2a8cd
6 changed files with 20 additions and 16 deletions

View File

@@ -60,15 +60,17 @@ namespace RAY {
{};
std::shared_ptr<::ModelAnimation> fetch(const std::string &path, int *counter)
{
if (this->_cache.find(path) != this->_cache.end())
return this->_cache[path];
::ModelAnimation *animations = this->_dataLoader(path.c_str(), counter);
unsigned int animCount = *counter;
if (this->_cache.find(path) == this->_cache.end())
this->_cache.emplace(path, std::shared_ptr<::ModelAnimation>(
animations, [this, animCount](::ModelAnimation *p) {
this->_dataUnloader(p, animCount);
}));
return _cache[path];
this->_cache.emplace(path, std::shared_ptr<::ModelAnimation>(
animations, [this, animCount](::ModelAnimation *p) {
this->_dataUnloader(p, animCount);
}));
return this->_cache[path];
};
private:
//! @brief function to call to load data