|
|
@ -66,12 +66,12 @@ namespace MWWorld
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
/// Constructor to be called from the main thread.
|
|
|
|
/// Constructor to be called from the main thread.
|
|
|
|
PreloadItem(MWWorld::CellStore* cell, Resource::SceneManager* sceneManager,
|
|
|
|
explicit PreloadItem(MWWorld::CellStore* cell, Resource::SceneManager* sceneManager,
|
|
|
|
Resource::BulletShapeManager* bulletShapeManager, Resource::KeyframeManager* keyframeManager,
|
|
|
|
Resource::BulletShapeManager* bulletShapeManager, Resource::KeyframeManager* keyframeManager,
|
|
|
|
Terrain::World* terrain, MWRender::LandManager* landManager, bool preloadInstances)
|
|
|
|
Terrain::World* terrain, MWRender::LandManager* landManager, bool preloadInstances)
|
|
|
|
: mIsExterior(cell->getCell()->isExterior())
|
|
|
|
: mIsExterior(cell->getCell()->isExterior())
|
|
|
|
, mX(cell->getCell()->getGridX())
|
|
|
|
, mCellLocation(cell->getCell()->getExteriorCellLocation())
|
|
|
|
, mY(cell->getCell()->getGridY())
|
|
|
|
, mCellId(cell->getCell()->getId())
|
|
|
|
, mSceneManager(sceneManager)
|
|
|
|
, mSceneManager(sceneManager)
|
|
|
|
, mBulletShapeManager(bulletShapeManager)
|
|
|
|
, mBulletShapeManager(bulletShapeManager)
|
|
|
|
, mKeyframeManager(keyframeManager)
|
|
|
|
, mKeyframeManager(keyframeManager)
|
|
|
@ -95,12 +95,13 @@ namespace MWWorld
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mTerrain->cacheCell(mTerrainView.get(), mX, mY);
|
|
|
|
mTerrain->cacheCell(mTerrainView.get(), mCellLocation.mX, mCellLocation.mY);
|
|
|
|
mPreloadedObjects.insert(
|
|
|
|
mPreloadedObjects.insert(mLandManager->getLand(mCellLocation));
|
|
|
|
mLandManager->getLand(ESM::ExteriorCellLocation(mX, mY, ESM::Cell::sDefaultWorldspaceId)));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (std::exception&)
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
Log(Debug::Warning) << "Failed to cache terrain for exterior cell " << mCellLocation << ": "
|
|
|
|
|
|
|
|
<< e.what();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -113,8 +114,12 @@ namespace MWWorld
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
const VFS::Manager& vfs = *mSceneManager->getVFS();
|
|
|
|
mesh = Misc::ResourceHelpers::correctMeshPath(path);
|
|
|
|
mesh = Misc::ResourceHelpers::correctMeshPath(path);
|
|
|
|
mesh = Misc::ResourceHelpers::correctActorModelPath(mesh, mSceneManager->getVFS());
|
|
|
|
mesh = Misc::ResourceHelpers::correctActorModelPath(mesh, &vfs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!vfs.exists(mesh))
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
size_t slashpos = mesh.find_last_of("/\\");
|
|
|
|
size_t slashpos = mesh.find_last_of("/\\");
|
|
|
|
if (slashpos != std::string::npos && slashpos != mesh.size() - 1)
|
|
|
|
if (slashpos != std::string::npos && slashpos != mesh.size() - 1)
|
|
|
@ -124,7 +129,7 @@ namespace MWWorld
|
|
|
|
{
|
|
|
|
{
|
|
|
|
kfname = mesh;
|
|
|
|
kfname = mesh;
|
|
|
|
kfname.replace(kfname.size() - 4, 4, ".kf");
|
|
|
|
kfname.replace(kfname.size() - 4, 4, ".kf");
|
|
|
|
if (mSceneManager->getVFS()->exists(kfname))
|
|
|
|
if (vfs.exists(kfname))
|
|
|
|
mPreloadedObjects.insert(mKeyframeManager->get(kfname));
|
|
|
|
mPreloadedObjects.insert(mKeyframeManager->get(kfname));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -134,18 +139,18 @@ namespace MWWorld
|
|
|
|
else
|
|
|
|
else
|
|
|
|
mPreloadedObjects.insert(mBulletShapeManager->getShape(mesh));
|
|
|
|
mPreloadedObjects.insert(mBulletShapeManager->getShape(mesh));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (std::exception&)
|
|
|
|
catch (const std::exception& e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// ignore error for now, would spam the log too much
|
|
|
|
Log(Debug::Warning) << "Failed to preload mesh \"" << path << "\" from cell " << mCellId << ": "
|
|
|
|
// error will be shown when visiting the cell
|
|
|
|
<< e.what();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
bool mIsExterior;
|
|
|
|
bool mIsExterior;
|
|
|
|
int mX;
|
|
|
|
ESM::ExteriorCellLocation mCellLocation;
|
|
|
|
int mY;
|
|
|
|
ESM::RefId mCellId;
|
|
|
|
std::vector<std::string_view> mMeshes;
|
|
|
|
std::vector<std::string_view> mMeshes;
|
|
|
|
Resource::SceneManager* mSceneManager;
|
|
|
|
Resource::SceneManager* mSceneManager;
|
|
|
|
Resource::BulletShapeManager* mBulletShapeManager;
|
|
|
|
Resource::BulletShapeManager* mBulletShapeManager;
|
|
|
|