1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-04-09 21:44:54 +00:00

Select only one level of LOD outside the active grid

Do not create group when not needed
This commit is contained in:
Cédric Mocquillon 2022-11-09 21:57:17 +01:00
parent 4140e4ea05
commit 7142bb4ce7

View File

@ -186,12 +186,7 @@ namespace MWRender
return nullptr; return nullptr;
if (children.size() == 1) if (children.size() == 1)
{ return children.front().first.release();
osg::Group* n = new osg::Group;
n->addChild(children.front().first);
n->setDataVariance(osg::Object::STATIC);
return n;
}
else else
{ {
osg::LOD* n = new osg::LOD; osg::LOD* n = new osg::LOD;
@ -572,7 +567,11 @@ namespace MWRender
constexpr auto copyMask = ~Mask_UpdateVisitor; constexpr auto copyMask = ~Mask_UpdateVisitor;
const auto smallestDistanceToChunk = (size > 1 / 8.f) ? (size * ESM::Land::REAL_SIZE) : 0.f; const auto smallestDistanceToChunk = (size > 1 / 8.f) ? (size * ESM::Land::REAL_SIZE) : 0.f;
const auto higherDistanceToChunk = ((size < 1) ? 5 : 3) * ESM::Land::REAL_SIZE * size + 1; const auto higherDistanceToChunk = [&] {
if (!activeGrid)
return smallestDistanceToChunk + 1;
return ((size < 1) ? 5 : 3) * ESM::Land::REAL_SIZE * size + 1;
}();
AnalyzeVisitor analyzeVisitor(copyMask); AnalyzeVisitor analyzeVisitor(copyMask);
float minSize = mMinSize; float minSize = mMinSize;