StaticObjectDetectionVisitor: make use of apply(Drawable) visitor function

This commit is contained in:
scrawl 2017-01-20 21:48:45 +01:00
parent 764b2f60c6
commit ff1a9a195a
2 changed files with 4 additions and 19 deletions

View File

@ -847,15 +847,12 @@ class OSGUTIL_EXPORT Optimizer
BaseOptimizerVisitor(optimizer, STATIC_OBJECT_DETECTION) {} BaseOptimizerVisitor(optimizer, STATIC_OBJECT_DETECTION) {}
virtual void apply(osg::Node& node); virtual void apply(osg::Node& node);
virtual void apply(osg::Drawable& drawable);
virtual void apply(osg::Geode& geode);
protected: protected:
void applyStateSet(osg::StateSet& stateset); void applyStateSet(osg::StateSet& stateset);
void applyDrawable(osg::Drawable& drawable);
}; };
/** For all geometry apply settings.*/ /** For all geometry apply settings.*/

View File

@ -4405,14 +4405,11 @@ void Optimizer::StaticObjectDetectionVisitor::apply(osg::Node& node)
traverse(node); traverse(node);
} }
void Optimizer::StaticObjectDetectionVisitor::apply(osg::Geode& geode) void Optimizer::StaticObjectDetectionVisitor::apply(osg::Drawable& drawable)
{ {
if (geode.getStateSet()) applyStateSet(*geode.getStateSet()); if (drawable.getStateSet()) applyStateSet(*drawable.getStateSet());
for(unsigned int i=0; i<geode.getNumDrawables(); ++i) drawable.computeDataVariance();
{
applyDrawable(*geode.getDrawable(i));
}
} }
void Optimizer::StaticObjectDetectionVisitor::applyStateSet(osg::StateSet& stateset) void Optimizer::StaticObjectDetectionVisitor::applyStateSet(osg::StateSet& stateset)
@ -4421,15 +4418,6 @@ void Optimizer::StaticObjectDetectionVisitor::applyStateSet(osg::StateSet& state
} }
void Optimizer::StaticObjectDetectionVisitor::applyDrawable(osg::Drawable& drawable)
{
if (drawable.getStateSet()) applyStateSet(*drawable.getStateSet());
drawable.computeDataVariance();
}
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
// FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor // FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor