Fix the optimizer messing up LOD node's children (Fixes #4301)

pull/377/head
scrawl 7 years ago
parent 89c6b59c30
commit 25a6a67508
No known key found for this signature in database
GPG Key ID: 2E6CC3676024C402

@ -800,6 +800,13 @@ bool Optimizer::RemoveRedundantNodesVisitor::isOperationPermissible(osg::Node& n
isOperationPermissibleForObject(&node);
}
void Optimizer::RemoveRedundantNodesVisitor::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::RemoveRedundantNodesVisitor::apply(osg::Group& group)
{
if (typeid(group)==typeid(osg::Group) &&
@ -1849,6 +1856,12 @@ bool Optimizer::MergeGroupsVisitor::isOperationPermissible(osg::Group& node)
isOperationPermissibleForObject(&node);
}
void Optimizer::MergeGroupsVisitor::apply(osg::LOD &lod)
{
// don't merge the direct children of the LOD because they are used to define each LOD level.
traverse(lod);
}
void Optimizer::MergeGroupsVisitor::apply(osg::Group &group)
{
if (group.getNumChildren() <= 1)

@ -339,6 +339,7 @@ class Optimizer
virtual void apply(osg::Group& group);
virtual void apply(osg::Transform& transform);
virtual void apply(osg::LOD& lod);
bool isOperationPermissible(osg::Node& node);
@ -358,6 +359,7 @@ class Optimizer
bool isOperationPermissible(osg::Group& node);
virtual void apply(osg::Group& group);
virtual void apply(osg::LOD& lod);
};
class MergeGeometryVisitor : public BaseOptimizerVisitor

Loading…
Cancel
Save