From c22fde2bcdab0f136e76c703eb409b0d895e513c Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 12 Mar 2017 22:38:50 +0100 Subject: [PATCH] Preload terrain while reading savegame --- apps/openmw/mwworld/scene.cpp | 7 +++++++ apps/openmw/mwworld/scene.hpp | 1 + apps/openmw/mwworld/worldimp.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 6be1dbc97f..e27c0b5858 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -809,6 +809,13 @@ namespace MWWorld mPreloader->preload(cell, mRendering.getReferenceTime()); } + void Scene::preloadTerrain(const osg::Vec3f &pos) + { + std::vector vec; + vec.push_back(pos); + mPreloader->setTerrainPreloadPositions(vec); + } + struct ListFastTravelDestinationsVisitor { ListFastTravelDestinationsVisitor(float preloadDist, const osg::Vec3f& playerPos) diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index 82b8dcaba0..f3c2d31cad 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -89,6 +89,7 @@ namespace MWWorld ~Scene(); void preloadCell(MWWorld::CellStore* cell, bool preloadSurrounding=false); + void preloadTerrain(const osg::Vec3f& pos); void unloadCell (CellStoreCollection::iterator iter); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 9d3110a675..851b02ba8f 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -379,6 +379,7 @@ namespace MWWorld case ESM::REC_PLAY: mPlayer->readRecord(reader, type); mWorldScene->preloadCell(getPlayerPtr().getCell(), true); + mWorldScene->preloadTerrain(getPlayerPtr().getRefData().getPosition().asVec3()); break; default: if (!mStore.readRecord (reader, type) &&