|
|
@ -123,6 +123,7 @@ namespace MWWorld
|
|
|
|
CellPreloader::CellPreloader(Resource::ResourceSystem* resourceSystem, Resource::BulletShapeManager* bulletShapeManager)
|
|
|
|
CellPreloader::CellPreloader(Resource::ResourceSystem* resourceSystem, Resource::BulletShapeManager* bulletShapeManager)
|
|
|
|
: mResourceSystem(resourceSystem)
|
|
|
|
: mResourceSystem(resourceSystem)
|
|
|
|
, mBulletShapeManager(bulletShapeManager)
|
|
|
|
, mBulletShapeManager(bulletShapeManager)
|
|
|
|
|
|
|
|
, mExpiryDelay(0.0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mWorkQueue = new SceneUtil::WorkQueue;
|
|
|
|
mWorkQueue = new SceneUtil::WorkQueue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -156,13 +157,11 @@ namespace MWWorld
|
|
|
|
|
|
|
|
|
|
|
|
void CellPreloader::updateCache(double timestamp)
|
|
|
|
void CellPreloader::updateCache(double timestamp)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// time (in seconds) to keep a preloaded cell in cache after it's no longer needed
|
|
|
|
// TODO: add settings for a minimum/maximum size of the cache
|
|
|
|
// additionally we could support a minimum/maximum size for the cache
|
|
|
|
|
|
|
|
const double expiryTime = 60.0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (PreloadMap::iterator it = mPreloadCells.begin(); it != mPreloadCells.end();)
|
|
|
|
for (PreloadMap::iterator it = mPreloadCells.begin(); it != mPreloadCells.end();)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (it->second.mTimeStamp < timestamp - expiryTime)
|
|
|
|
if (it->second.mTimeStamp < timestamp - mExpiryDelay)
|
|
|
|
mPreloadCells.erase(it++);
|
|
|
|
mPreloadCells.erase(it++);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
++it;
|
|
|
|
++it;
|
|
|
@ -172,6 +171,11 @@ namespace MWWorld
|
|
|
|
mWorkQueue->addWorkItem(new UpdateCacheItem(mResourceSystem, timestamp));
|
|
|
|
mWorkQueue->addWorkItem(new UpdateCacheItem(mResourceSystem, timestamp));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CellPreloader::setExpiryDelay(double expiryDelay)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mExpiryDelay = expiryDelay;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CellPreloader::setWorkQueue(osg::ref_ptr<SceneUtil::WorkQueue> workQueue)
|
|
|
|
void CellPreloader::setWorkQueue(osg::ref_ptr<SceneUtil::WorkQueue> workQueue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mWorkQueue = workQueue;
|
|
|
|
mWorkQueue = workQueue;
|
|
|
|