mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 16:29:55 +00:00
Preload terrain in single pass
Otherwise there is lodFlags mismatch because some of the neighbours are removed during preloading. This makes rendering culling create land chunk nodes again for the same position, lod because lodFlags are different.
This commit is contained in:
parent
52ab47771c
commit
d3dca99a76
1 changed files with 9 additions and 30 deletions
|
@ -544,37 +544,16 @@ namespace Terrain
|
|||
vd->setViewPoint(viewPoint);
|
||||
vd->setActiveGrid(grid);
|
||||
|
||||
for (unsigned int pass = 0; pass < 3; ++pass)
|
||||
{
|
||||
unsigned int startEntry = vd->getNumEntries();
|
||||
|
||||
float distanceModifier = 0.f;
|
||||
if (pass == 1)
|
||||
distanceModifier = 1024;
|
||||
else if (pass == 2)
|
||||
distanceModifier = -1024;
|
||||
DefaultLodCallback lodCallback(mLodFactor, mMinSize, mViewDistance, grid, cellWorldSize, distanceModifier);
|
||||
DefaultLodCallback lodCallback(mLodFactor, mMinSize, mViewDistance, grid, cellWorldSize);
|
||||
mRootNode->traverseNodes(vd, viewPoint, &lodCallback);
|
||||
|
||||
if (pass == 0)
|
||||
{
|
||||
std::size_t progressTotal = 0;
|
||||
for (unsigned int i = 0, n = vd->getNumEntries(); i < n; ++i)
|
||||
progressTotal += vd->getEntry(i).mNode->getSize();
|
||||
reporter.addTotal(vd->getNumEntries());
|
||||
|
||||
reporter.addTotal(progressTotal);
|
||||
}
|
||||
|
||||
for (unsigned int i = startEntry; i < vd->getNumEntries() && !abort; ++i)
|
||||
for (unsigned int i = 0, n = vd->getNumEntries(); i < n && !abort; ++i)
|
||||
{
|
||||
ViewDataEntry& entry = vd->getEntry(i);
|
||||
|
||||
loadRenderingNode(entry, vd, cellWorldSize, grid, true);
|
||||
if (pass == 0)
|
||||
reporter.addProgress(entry.mNode->getSize());
|
||||
vd->removeNodeFromIndex(entry.mNode);
|
||||
entry.mNode = nullptr; // Clear node lest we break the neighbours search for the next pass
|
||||
}
|
||||
reporter.addProgress(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue