mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Ignore empty children of osg::LOD and osg::Switch like in OSG
This commit is contained in:
parent
63fe02b1ba
commit
957d2a890f
2 changed files with 5 additions and 18 deletions
|
@ -735,20 +735,6 @@ bool Optimizer::CombineStaticTransformsVisitor::removeTransforms(osg::Node* node
|
|||
// RemoveEmptyNodes.
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Switch& switchNode)
|
||||
{
|
||||
// We should keep all switch child nodes since they reflect different switch states.
|
||||
for (unsigned int i=0; i<switchNode.getNumChildren(); ++i)
|
||||
traverse(*switchNode.getChild(i));
|
||||
}
|
||||
|
||||
void Optimizer::RemoveEmptyNodesVisitor::apply(osg::LOD& lod)
|
||||
{
|
||||
// don't remove any direct children of the LOD because they are used to define each LOD level.
|
||||
for (unsigned int i=0; i<lod.getNumChildren(); ++i)
|
||||
traverse(*lod.getChild(i));
|
||||
}
|
||||
|
||||
void Optimizer::RemoveEmptyNodesVisitor::apply(osg::Group& group)
|
||||
{
|
||||
if (group.getNumParents()>0)
|
||||
|
@ -787,8 +773,11 @@ void Optimizer::RemoveEmptyNodesVisitor::removeEmptyNodes()
|
|||
++pitr)
|
||||
{
|
||||
osg::Group* parent = *pitr;
|
||||
parent->removeChild(nodeToRemove.get());
|
||||
if (parent->getNumChildren()==0 && isOperationPermissibleForObject(parent)) newEmptyGroups.insert(parent);
|
||||
if (!parent->asSwitch() && !dynamic_cast<osg::LOD*>(parent))
|
||||
{
|
||||
parent->removeChild(nodeToRemove.get());
|
||||
if (parent->getNumChildren()==0 && isOperationPermissibleForObject(parent)) newEmptyGroups.insert(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue