mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-05 06:40:09 +00:00
Allow to interrupt terrain preloading
This commit is contained in:
parent
b214c54b3a
commit
12f9184d00
@ -381,7 +381,7 @@ namespace MWWorld
|
||||
{
|
||||
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], mAbort);
|
||||
mTerrainViews[i]->reset(0);
|
||||
}
|
||||
}
|
||||
|
@ -478,14 +478,14 @@ View* QuadTreeWorld::createView()
|
||||
return new ViewData;
|
||||
}
|
||||
|
||||
void QuadTreeWorld::preload(View *view, const osg::Vec3f &eyePoint)
|
||||
void QuadTreeWorld::preload(View *view, const osg::Vec3f &eyePoint, std::atomic<bool> &abort)
|
||||
{
|
||||
ensureQuadTreeBuilt();
|
||||
|
||||
ViewData* vd = static_cast<ViewData*>(view);
|
||||
traverse(mRootNode.get(), vd, nullptr, mRootNode->getLodCallback(), eyePoint, false);
|
||||
|
||||
for (unsigned int i=0; i<vd->getNumEntries(); ++i)
|
||||
for (unsigned int i=0; i<vd->getNumEntries() && !abort; ++i)
|
||||
{
|
||||
ViewData::Entry& entry = vd->getEntry(i);
|
||||
loadRenderingNode(entry, vd, mVertexLodMod, mChunkManager.get());
|
||||
|
@ -30,7 +30,7 @@ namespace Terrain
|
||||
void cacheCell(View *view, int x, int y);
|
||||
|
||||
View* createView();
|
||||
void preload(View* view, const osg::Vec3f& eyePoint);
|
||||
void preload(View* view, const osg::Vec3f& eyePoint, std::atomic<bool>& abort);
|
||||
|
||||
void reportStats(unsigned int frameNumber, osg::Stats* stats);
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <osg/Referenced>
|
||||
#include <osg/Vec3f>
|
||||
|
||||
#include <atomic>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
@ -93,7 +94,7 @@ namespace Terrain
|
||||
virtual View* createView() { return nullptr; }
|
||||
|
||||
/// @note Thread safe, as long as you do not attempt to load into the same view from multiple threads.
|
||||
virtual void preload(View* view, const osg::Vec3f& eyePoint) {}
|
||||
virtual void preload(View* view, const osg::Vec3f& eyePoint, std::atomic<bool>& abort) {}
|
||||
|
||||
virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user