mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 12:40:25 +00:00
CellPreloader::preload(CellStore&
This commit is contained in:
parent
a3a2685b9a
commit
5bb9bfd224
3 changed files with 8 additions and 8 deletions
|
@ -259,20 +259,20 @@ namespace MWWorld
|
||||||
mPreloadCells.clear();
|
mPreloadCells.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellPreloader::preload(CellStore* cell, double timestamp)
|
void CellPreloader::preload(CellStore& cell, double timestamp)
|
||||||
{
|
{
|
||||||
if (!mWorkQueue)
|
if (!mWorkQueue)
|
||||||
{
|
{
|
||||||
Log(Debug::Error) << "Error: can't preload, no work queue set";
|
Log(Debug::Error) << "Error: can't preload, no work queue set";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (cell->getState() == CellStore::State_Unloaded)
|
if (cell.getState() == CellStore::State_Unloaded)
|
||||||
{
|
{
|
||||||
Log(Debug::Error) << "Error: can't preload objects for unloaded cell";
|
Log(Debug::Error) << "Error: can't preload objects for unloaded cell";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PreloadMap::iterator found = mPreloadCells.find(cell);
|
PreloadMap::iterator found = mPreloadCells.find(&cell);
|
||||||
if (found != mPreloadCells.end())
|
if (found != mPreloadCells.end())
|
||||||
{
|
{
|
||||||
// already preloaded, nothing to do other than updating the timestamp
|
// already preloaded, nothing to do other than updating the timestamp
|
||||||
|
@ -304,11 +304,11 @@ namespace MWWorld
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<PreloadItem> item(new PreloadItem(cell, mResourceSystem->getSceneManager(), mBulletShapeManager,
|
osg::ref_ptr<PreloadItem> item(new PreloadItem(&cell, mResourceSystem->getSceneManager(), mBulletShapeManager,
|
||||||
mResourceSystem->getKeyframeManager(), mTerrain, mLandManager, mPreloadInstances));
|
mResourceSystem->getKeyframeManager(), mTerrain, mLandManager, mPreloadInstances));
|
||||||
mWorkQueue->addWorkItem(item);
|
mWorkQueue->addWorkItem(item);
|
||||||
|
|
||||||
mPreloadCells[cell] = PreloadEntry(timestamp, item);
|
mPreloadCells[&cell] = PreloadEntry(timestamp, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellPreloader::notifyLoaded(CellStore* cell)
|
void CellPreloader::notifyLoaded(CellStore* cell)
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace MWWorld
|
||||||
|
|
||||||
/// Ask a background thread to preload rendering meshes and collision shapes for objects in this cell.
|
/// Ask a background thread to preload rendering meshes and collision shapes for objects in this cell.
|
||||||
/// @note The cell itself must be in State_Loaded or State_Preloaded.
|
/// @note The cell itself must be in State_Loaded or State_Preloaded.
|
||||||
void preload(MWWorld::CellStore* cell, double timestamp);
|
void preload(MWWorld::CellStore& cell, double timestamp);
|
||||||
|
|
||||||
void notifyLoaded(MWWorld::CellStore* cell);
|
void notifyLoaded(MWWorld::CellStore* cell);
|
||||||
|
|
||||||
|
|
|
@ -1194,14 +1194,14 @@ namespace MWWorld
|
||||||
for (int dy = -mHalfGridSize; dy <= mHalfGridSize; ++dy)
|
for (int dy = -mHalfGridSize; dy <= mHalfGridSize; ++dy)
|
||||||
{
|
{
|
||||||
mPreloader->preload(
|
mPreloader->preload(
|
||||||
&mWorld.getWorldModel().getExterior(x + dx, y + dy), mRendering.getReferenceTime());
|
mWorld.getWorldModel().getExterior(x + dx, y + dy), mRendering.getReferenceTime());
|
||||||
if (++numpreloaded >= mPreloader->getMaxCacheSize())
|
if (++numpreloaded >= mPreloader->getMaxCacheSize())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mPreloader->preload(&cell, mRendering.getReferenceTime());
|
mPreloader->preload(cell, mRendering.getReferenceTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::preloadTerrain(const osg::Vec3f& pos, bool sync)
|
void Scene::preloadTerrain(const osg::Vec3f& pos, bool sync)
|
||||||
|
|
Loading…
Reference in a new issue