Merge branch 'fix-exterior-regression' into 'master'

Fixes #7437

Closes #7388 and #7437

See merge request OpenMW/openmw!3187
revert-6246b479
psi29a 2 years ago
commit 2b11c2cf36

@ -577,7 +577,7 @@ namespace MWWorld
if (mRendering.pagingUnlockCache())
mPreloader->abortTerrainPreloadExcept(nullptr);
if (!mPreloader->isTerrainLoaded(std::make_pair(pos, newGrid), mRendering.getReferenceTime()))
preloadTerrain(pos, true);
preloadTerrain(pos, playerCellIndex.mWorldspace, true);
mPagedRefs.clear();
mRendering.getPagedRefnums(newGrid, mPagedRefs);
@ -1205,10 +1205,11 @@ namespace MWWorld
mPreloader->preload(cell, mRendering.getReferenceTime());
}
void Scene::preloadTerrain(const osg::Vec3f& pos, bool sync)
void Scene::preloadTerrain(const osg::Vec3f& pos, ESM::RefId worldspace, bool sync)
{
ESM::ExteriorCellLocation cellPos = ESM::positionToExteriorCellLocation(pos.x(), pos.y(), worldspace);
std::vector<PositionCellGrid> vec;
vec.emplace_back(pos, gridCenterToBounds(getNewGridCenter(pos)));
vec.emplace_back(pos, gridCenterToBounds({ cellPos.mX, cellPos.mY }));
mPreloader->abortTerrainPreloadExcept(vec.data());
mPreloader->setTerrainPreloadPositions(vec);
if (!sync)

@ -145,7 +145,7 @@ namespace MWWorld
~Scene();
void preloadCell(MWWorld::CellStore& cell, bool preloadSurrounding = false);
void preloadTerrain(const osg::Vec3f& pos, bool sync = false);
void preloadTerrain(const osg::Vec3f& pos, ESM::RefId worldspace, bool sync = false);
void reloadTerrain();
void playerMoved(const osg::Vec3f& pos);

@ -513,7 +513,8 @@ namespace MWWorld
if (getPlayerPtr().isInCell())
{
if (getPlayerPtr().getCell()->isExterior())
mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3());
mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3(),
getPlayerPtr().getCell()->getCell()->getWorldSpace());
mWorldScene->preloadCell(*getPlayerPtr().getCell(), true);
}
break;

Loading…
Cancel
Save