mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:53:53 +00:00
Add preloading settings
This commit is contained in:
parent
610257cd3a
commit
5efaa9817c
3 changed files with 16 additions and 7 deletions
|
@ -192,6 +192,8 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::update (float duration, bool paused)
|
void Scene::update (float duration, bool paused)
|
||||||
|
{
|
||||||
|
if (mPreloadEnabled)
|
||||||
{
|
{
|
||||||
mPreloadTimer += duration;
|
mPreloadTimer += duration;
|
||||||
if (mPreloadTimer > 0.5f)
|
if (mPreloadTimer > 0.5f)
|
||||||
|
@ -199,6 +201,7 @@ namespace MWWorld
|
||||||
preloadCells();
|
preloadCells();
|
||||||
mPreloadTimer = 0.f;
|
mPreloadTimer = 0.f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mRendering.update (duration, paused);
|
mRendering.update (duration, paused);
|
||||||
}
|
}
|
||||||
|
@ -448,7 +451,8 @@ namespace MWWorld
|
||||||
, mPreloadTimer(0.f)
|
, mPreloadTimer(0.f)
|
||||||
, mHalfGridSize(Settings::Manager::getInt("exterior cell load distance", "Cells"))
|
, mHalfGridSize(Settings::Manager::getInt("exterior cell load distance", "Cells"))
|
||||||
, mCellLoadingThreshold(1024.f)
|
, mCellLoadingThreshold(1024.f)
|
||||||
, mPreloadDistance(1000.f)
|
, mPreloadDistance(Settings::Manager::getInt("preload distance", "Cells"))
|
||||||
|
, mPreloadEnabled(Settings::Manager::getBool("preload enabled", "Cells"))
|
||||||
{
|
{
|
||||||
mPreloader.reset(new CellPreloader(rendering.getResourceSystem(), physics->getShapeManager()));
|
mPreloader.reset(new CellPreloader(rendering.getResourceSystem(), physics->getShapeManager()));
|
||||||
}
|
}
|
||||||
|
@ -700,8 +704,6 @@ namespace MWWorld
|
||||||
float dist = std::max(std::abs(thisCellCenterX - playerPos.x()), std::abs(thisCellCenterY - playerPos.y()));
|
float dist = std::max(std::abs(thisCellCenterX - playerPos.x()), std::abs(thisCellCenterY - playerPos.y()));
|
||||||
float loadDist = 8192/2 + 8192 - mCellLoadingThreshold + mPreloadDistance;
|
float loadDist = 8192/2 + 8192 - mCellLoadingThreshold + mPreloadDistance;
|
||||||
|
|
||||||
std::cout << cellX+dx << " " << cellY+dy << " dist " << dist << " need " << loadDist << std::endl;
|
|
||||||
|
|
||||||
if (dist < loadDist)
|
if (dist < loadDist)
|
||||||
mPreloader->preload(MWBase::Environment::get().getWorld()->getExterior(cellX+dx, cellY+dy), mRendering.getReferenceTime());
|
mPreloader->preload(MWBase::Environment::get().getWorld()->getExterior(cellX+dx, cellY+dy), mRendering.getReferenceTime());
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ namespace MWWorld
|
||||||
int mHalfGridSize;
|
int mHalfGridSize;
|
||||||
float mCellLoadingThreshold;
|
float mCellLoadingThreshold;
|
||||||
float mPreloadDistance;
|
float mPreloadDistance;
|
||||||
|
bool mPreloadEnabled;
|
||||||
|
|
||||||
void insertCell (CellStore &cell, bool rescale, Loading::Listener* loadingListener);
|
void insertCell (CellStore &cell, bool rescale, Loading::Listener* loadingListener);
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,12 @@ first person field of view = 55.0
|
||||||
# dramatically affect performance, see documentation for details.
|
# dramatically affect performance, see documentation for details.
|
||||||
exterior cell load distance = 1
|
exterior cell load distance = 1
|
||||||
|
|
||||||
|
# Preload cells in a background thread
|
||||||
|
preload enabled = true
|
||||||
|
|
||||||
|
# Preloading distance threshold
|
||||||
|
preload distance = 1000
|
||||||
|
|
||||||
[Map]
|
[Map]
|
||||||
|
|
||||||
# Size of each exterior cell in pixels in the world map. (e.g. 12 to 24).
|
# Size of each exterior cell in pixels in the world map. (e.g. 12 to 24).
|
||||||
|
|
Loading…
Reference in a new issue