forked from mirror/openmw-tes3mp
Add 'prediction time' setting for cell/terrain pre-loading
This commit is contained in:
parent
3e03a0d7bd
commit
20606a2aff
4 changed files with 19 additions and 1 deletions
|
@ -478,6 +478,7 @@ namespace MWWorld
|
||||||
, mPreloadExteriorGrid(Settings::Manager::getBool("preload exterior grid", "Cells"))
|
, mPreloadExteriorGrid(Settings::Manager::getBool("preload exterior grid", "Cells"))
|
||||||
, mPreloadDoors(Settings::Manager::getBool("preload doors", "Cells"))
|
, mPreloadDoors(Settings::Manager::getBool("preload doors", "Cells"))
|
||||||
, mPreloadFastTravel(Settings::Manager::getBool("preload fast travel", "Cells"))
|
, mPreloadFastTravel(Settings::Manager::getBool("preload fast travel", "Cells"))
|
||||||
|
, mPredictionTime(Settings::Manager::getFloat("prediction time", "Cells"))
|
||||||
{
|
{
|
||||||
mPreloader.reset(new CellPreloader(rendering.getResourceSystem(), physics->getShapeManager(), rendering.getTerrain(), rendering.getLandManager()));
|
mPreloader.reset(new CellPreloader(rendering.getResourceSystem(), physics->getShapeManager(), rendering.getTerrain(), rendering.getLandManager()));
|
||||||
mPreloader->setWorkQueue(mRendering.getWorkQueue());
|
mPreloader->setWorkQueue(mRendering.getWorkQueue());
|
||||||
|
@ -685,7 +686,7 @@ namespace MWWorld
|
||||||
const MWWorld::ConstPtr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
const MWWorld::ConstPtr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
|
||||||
osg::Vec3f playerPos = player.getRefData().getPosition().asVec3();
|
osg::Vec3f playerPos = player.getRefData().getPosition().asVec3();
|
||||||
osg::Vec3f moved = playerPos - mLastPlayerPos;
|
osg::Vec3f moved = playerPos - mLastPlayerPos;
|
||||||
osg::Vec3f predictedPos = playerPos + moved / dt;
|
osg::Vec3f predictedPos = playerPos + moved / dt * mPredictionTime;
|
||||||
|
|
||||||
if (mCurrentCell->isExterior())
|
if (mCurrentCell->isExterior())
|
||||||
exteriorPositions.push_back(predictedPos);
|
exteriorPositions.push_back(predictedPos);
|
||||||
|
|
|
@ -67,6 +67,7 @@ namespace MWWorld
|
||||||
bool mPreloadExteriorGrid;
|
bool mPreloadExteriorGrid;
|
||||||
bool mPreloadDoors;
|
bool mPreloadDoors;
|
||||||
bool mPreloadFastTravel;
|
bool mPreloadFastTravel;
|
||||||
|
float mPredictionTime;
|
||||||
|
|
||||||
osg::Vec3f mLastPlayerPos;
|
osg::Vec3f mLastPlayerPos;
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,19 @@ preload cell expiry delay
|
||||||
The amount of time (in seconds) that a preloaded cell will stay in cache after it is no longer referenced or required,
|
The amount of time (in seconds) that a preloaded cell will stay in cache after it is no longer referenced or required,
|
||||||
for example, after the player has moved away from a door without entering it.
|
for example, after the player has moved away from a door without entering it.
|
||||||
|
|
||||||
|
prediction time
|
||||||
|
---------------
|
||||||
|
|
||||||
|
:Type: floating point
|
||||||
|
:Range: >=0
|
||||||
|
:Default: 1
|
||||||
|
|
||||||
|
The amount of time (in seconds) in the future to predict the player position for. This predicted position is used to preload any cells and/or distant terrain required at that position.
|
||||||
|
|
||||||
|
This setting will only have an effect if 'preload enabled' is set or the 'distant terrain' in the Terrain section is set.
|
||||||
|
|
||||||
|
Increasing this setting from its default may help if your computer/hard disk is too slow to preload in time and you see loading screens and/or lag spikes.
|
||||||
|
|
||||||
cache expiry delay
|
cache expiry delay
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,9 @@ preload cell cache max = 20
|
||||||
# How long to keep preloaded cells in cache after they're no longer referenced/required (in seconds)
|
# How long to keep preloaded cells in cache after they're no longer referenced/required (in seconds)
|
||||||
preload cell expiry delay = 5
|
preload cell expiry delay = 5
|
||||||
|
|
||||||
|
# The predicted position of the player N seconds in the future will be used for preloading cells and distant terrain
|
||||||
|
prediction time = 1
|
||||||
|
|
||||||
# How long to keep models/textures/collision shapes in cache after they're no longer referenced/required (in seconds)
|
# How long to keep models/textures/collision shapes in cache after they're no longer referenced/required (in seconds)
|
||||||
cache expiry delay = 5
|
cache expiry delay = 5
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue