#include "keyframemanager.hpp" #include #include #include "objectcache.hpp" namespace Resource { KeyframeManager::KeyframeManager(const VFS::Manager* vfs) : ResourceManager(vfs) { } KeyframeManager::~KeyframeManager() { } osg::ref_ptr KeyframeManager::get(const std::string &name) { std::string normalized = name; mVFS->normalizeFilename(normalized); osg::ref_ptr obj = mCache->getRefFromObjectCache(normalized); if (obj) return osg::ref_ptr(static_cast(obj.get())); else { osg::ref_ptr loaded (new NifOsg::KeyframeHolder); NifOsg::Loader::loadKf(Nif::NIFFilePtr(new Nif::NIFFile(mVFS->getNormalized(normalized), normalized)), *loaded.get()); mCache->addEntryToObjectCache(normalized, loaded); return loaded; } } }