forked from mirror/openmw-tes3mp
optimizer: consider a Group with more than one child redundant as well
While there could be some value in this hierarchy (i.e. improved culling), we don't know if this is being used sensibly; and using a 'flat' hierarchy helps other optimizations.
This commit is contained in:
parent
75677f03e7
commit
330e5fefd1
1 changed files with 8 additions and 6 deletions
|
@ -840,18 +840,20 @@ void Optimizer::RemoveRedundantNodesVisitor::removeRedundantNodes()
|
|||
// take a copy of parents list since subsequent removes will modify the original one.
|
||||
osg::Node::ParentList parents = group->getParents();
|
||||
|
||||
if (group->getNumChildren()==1)
|
||||
for(osg::Node::ParentList::iterator pitr=parents.begin();
|
||||
pitr!=parents.end();
|
||||
++pitr)
|
||||
{
|
||||
osg::Node* child = group->getChild(0);
|
||||
for(osg::Node::ParentList::iterator pitr=parents.begin();
|
||||
pitr!=parents.end();
|
||||
++pitr)
|
||||
for (unsigned int i=0; i<group->getNumChildren(); ++i)
|
||||
{
|
||||
(*pitr)->replaceChild(group.get(),child);
|
||||
osg::Node* child = group->getChild(i);
|
||||
(*pitr)->addChild(child);
|
||||
}
|
||||
|
||||
(*pitr)->removeChild(group);
|
||||
}
|
||||
|
||||
group->removeChildren(0, group->getNumChildren());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue