forked from mirror/openmw-tes3mp
Add abort flag to TerrainPreloadItem
This commit is contained in:
parent
aed4cbaf29
commit
e987fe85d0
1 changed files with 12 additions and 4 deletions
|
@ -7,16 +7,16 @@
|
||||||
#include <components/resource/bulletshapemanager.hpp>
|
#include <components/resource/bulletshapemanager.hpp>
|
||||||
#include <components/resource/keyframemanager.hpp>
|
#include <components/resource/keyframemanager.hpp>
|
||||||
#include <components/misc/resourcehelpers.hpp>
|
#include <components/misc/resourcehelpers.hpp>
|
||||||
|
#include <components/misc/stringops.hpp>
|
||||||
#include <components/nifosg/nifloader.hpp>
|
#include <components/nifosg/nifloader.hpp>
|
||||||
#include <components/terrain/world.hpp>
|
#include <components/terrain/world.hpp>
|
||||||
#include <components/esmterrain/storage.hpp>
|
#include <components/esmterrain/storage.hpp>
|
||||||
#include <components/sceneutil/unrefqueue.hpp>
|
#include <components/sceneutil/unrefqueue.hpp>
|
||||||
|
#include <components/esm/loadcell.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
|
|
||||||
#include "../mwworld/inventorystore.hpp"
|
|
||||||
#include "../mwworld/esmstore.hpp"
|
|
||||||
#include "../mwrender/landmanager.hpp"
|
#include "../mwrender/landmanager.hpp"
|
||||||
|
|
||||||
#include "cellstore.hpp"
|
#include "cellstore.hpp"
|
||||||
|
@ -205,6 +205,7 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
if (mTerrainPreloadItem)
|
if (mTerrainPreloadItem)
|
||||||
{
|
{
|
||||||
|
mTerrainPreloadItem->abort();
|
||||||
mTerrainPreloadItem->waitTillDone();
|
mTerrainPreloadItem->waitTillDone();
|
||||||
mTerrainPreloadItem = NULL;
|
mTerrainPreloadItem = NULL;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +371,8 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TerrainPreloadItem(const std::vector<osg::ref_ptr<Terrain::View> >& views, Terrain::World* world, const std::vector<osg::Vec3f>& preloadPositions)
|
TerrainPreloadItem(const std::vector<osg::ref_ptr<Terrain::View> >& views, Terrain::World* world, const std::vector<osg::Vec3f>& preloadPositions)
|
||||||
: mTerrainViews(views)
|
: mAbort(false)
|
||||||
|
, mTerrainViews(views)
|
||||||
, mWorld(world)
|
, mWorld(world)
|
||||||
, mPreloadPositions(preloadPositions)
|
, mPreloadPositions(preloadPositions)
|
||||||
{
|
{
|
||||||
|
@ -378,14 +380,20 @@ namespace MWWorld
|
||||||
|
|
||||||
virtual void doWork()
|
virtual void doWork()
|
||||||
{
|
{
|
||||||
for (unsigned int i=0; i<mTerrainViews.size() && i<mPreloadPositions.size(); ++i)
|
for (unsigned int i=0; i<mTerrainViews.size() && i<mPreloadPositions.size() && !mAbort; ++i)
|
||||||
{
|
{
|
||||||
mWorld->preload(mTerrainViews[i], mPreloadPositions[i]);
|
mWorld->preload(mTerrainViews[i], mPreloadPositions[i]);
|
||||||
mTerrainViews[i]->reset(0);
|
mTerrainViews[i]->reset(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void abort()
|
||||||
|
{
|
||||||
|
mAbort = true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
volatile bool mAbort;
|
||||||
std::vector<osg::ref_ptr<Terrain::View> > mTerrainViews;
|
std::vector<osg::ref_ptr<Terrain::View> > mTerrainViews;
|
||||||
Terrain::World* mWorld;
|
Terrain::World* mWorld;
|
||||||
std::vector<osg::Vec3f> mPreloadPositions;
|
std::vector<osg::Vec3f> mPreloadPositions;
|
||||||
|
|
Loading…
Reference in a new issue