generic cache system

This commit is contained in:
arthur.jamet
2021-06-01 17:00:00 +02:00
parent 812a4da727
commit 382b830b27
12 changed files with 115 additions and 74 deletions

View File

@@ -7,8 +7,10 @@
#include "Model/ModelAnimations.hpp"
RAY::Cache<::ModelAnimation> RAY::ModelAnimations::_animationsCache(LoadModelAnimations, UnloadModelAnimations);
RAY::ModelAnimations::ModelAnimations(const std::string &filePath):
_animationsPtr(LoadModelAnimations(filePath.c_str(), &this->_animationCount))
_animationsPtr(_animationsCache.fetch(filePath, &this->_animationCount))
{
::ModelAnimation *ptr = this->_animationsPtr.get();
@@ -16,11 +18,6 @@ RAY::ModelAnimations::ModelAnimations(const std::string &filePath):
this->_animations.push_back(RAY::ModelAnimation(ptr[i]));
}
RAY::ModelAnimations::~ModelAnimations()
{
UnloadModelAnimations(this->_animationsPtr.release(), this->_animationCount);
}
RAY::ModelAnimation &RAY::ModelAnimations::operator[](int index)
{
return this->_animations[index];