Add base animations to preloadCommonAssets

coverity_scan^2
scrawl 8 years ago
parent 066aa2e60e
commit d141b98f0c

@ -20,6 +20,7 @@
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/resource/imagemanager.hpp> #include <components/resource/imagemanager.hpp>
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
#include <components/resource/keyframemanager.hpp>
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
@ -140,14 +141,24 @@ namespace MWRender
virtual void doWork() virtual void doWork()
{ {
for (std::vector<std::string>::const_iterator it = mModels.begin(); it != mModels.end(); ++it) try
mResourceSystem->getSceneManager()->getTemplate(*it); {
for (std::vector<std::string>::const_iterator it = mTextures.begin(); it != mTextures.end(); ++it) for (std::vector<std::string>::const_iterator it = mModels.begin(); it != mModels.end(); ++it)
mResourceSystem->getImageManager()->getImage(*it); mResourceSystem->getSceneManager()->cacheInstance(*it);
for (std::vector<std::string>::const_iterator it = mTextures.begin(); it != mTextures.end(); ++it)
mResourceSystem->getImageManager()->getImage(*it);
for (std::vector<std::string>::const_iterator it = mKeyframes.begin(); it != mKeyframes.end(); ++it)
mResourceSystem->getKeyframeManager()->get(*it);
}
catch (std::exception&)
{
// ignore error (will be shown when these are needed proper)
}
} }
std::vector<std::string> mModels; std::vector<std::string> mModels;
std::vector<std::string> mTextures; std::vector<std::string> mTextures;
std::vector<std::string> mKeyframes;
private: private:
Resource::ResourceSystem* mResourceSystem; Resource::ResourceSystem* mResourceSystem;
@ -308,6 +319,13 @@ namespace MWRender
mSky->listAssetsToPreload(workItem->mModels, workItem->mTextures); mSky->listAssetsToPreload(workItem->mModels, workItem->mTextures);
mWater->listAssetsToPreload(workItem->mTextures); mWater->listAssetsToPreload(workItem->mTextures);
const char* basemodels[] = {"xbase_anim", "xbase_anim.1st", "xbase_anim_female", "xbase_animkna"};
for (size_t i=0; i<sizeof(basemodels)/sizeof(basemodels[0]); ++i)
{
workItem->mModels.push_back(std::string("meshes/") + basemodels[i] + ".nif");
workItem->mKeyframes.push_back(std::string("meshes/") + basemodels[i] + ".kf");
}
workItem->mTextures.push_back("textures/_land_default.dds"); workItem->mTextures.push_back("textures/_land_default.dds");
mWorkQueue->addWorkItem(workItem); mWorkQueue->addWorkItem(workItem);

@ -1,7 +1,6 @@
#include "keyframemanager.hpp" #include "keyframemanager.hpp"
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
#include <components/nifosg/nifloader.hpp>
#include "objectcache.hpp" #include "objectcache.hpp"

@ -4,12 +4,9 @@
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <string> #include <string>
#include "resourcemanager.hpp" #include <components/nifosg/nifloader.hpp>
namespace NifOsg #include "resourcemanager.hpp"
{
class KeyframeHolder;
}
namespace Resource namespace Resource
{ {

Loading…
Cancel
Save