CellPreloader::preload(CellStore&

7344-support-launching-the-example-suite
florent.teppe 2 years ago
parent a3a2685b9a
commit 5bb9bfd224

@ -259,20 +259,20 @@ namespace MWWorld
mPreloadCells.clear();
}
void CellPreloader::preload(CellStore* cell, double timestamp)
void CellPreloader::preload(CellStore& cell, double timestamp)
{
if (!mWorkQueue)
{
Log(Debug::Error) << "Error: can't preload, no work queue set";
return;
}
if (cell->getState() == CellStore::State_Unloaded)
if (cell.getState() == CellStore::State_Unloaded)
{
Log(Debug::Error) << "Error: can't preload objects for unloaded cell";
return;
}
PreloadMap::iterator found = mPreloadCells.find(cell);
PreloadMap::iterator found = mPreloadCells.find(&cell);
if (found != mPreloadCells.end())
{
// already preloaded, nothing to do other than updating the timestamp
@ -304,11 +304,11 @@ namespace MWWorld
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));
mWorkQueue->addWorkItem(item);
mPreloadCells[cell] = PreloadEntry(timestamp, item);
mPreloadCells[&cell] = PreloadEntry(timestamp, item);
}
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.
/// @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);

@ -1194,14 +1194,14 @@ namespace MWWorld
for (int dy = -mHalfGridSize; dy <= mHalfGridSize; ++dy)
{
mPreloader->preload(
&mWorld.getWorldModel().getExterior(x + dx, y + dy), mRendering.getReferenceTime());
mWorld.getWorldModel().getExterior(x + dx, y + dy), mRendering.getReferenceTime());
if (++numpreloaded >= mPreloader->getMaxCacheSize())
break;
}
}
}
else
mPreloader->preload(&cell, mRendering.getReferenceTime());
mPreloader->preload(cell, mRendering.getReferenceTime());
}
void Scene::preloadTerrain(const osg::Vec3f& pos, bool sync)

Loading…
Cancel
Save