From 4a05caf4f7a614df9b4ca22869b203845958b612 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 20 Jan 2017 23:01:04 +0100 Subject: [PATCH] MakeFastGeometryVisitor: fix handling of Geometries that are directly in the scene graph not attached to a Geode --- include/osgUtil/Optimizer | 6 ++---- src/osgUtil/Optimizer.cpp | 30 ++++++++---------------------- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/include/osgUtil/Optimizer b/include/osgUtil/Optimizer index 979baa1d0..7b1bfa82a 100644 --- a/include/osgUtil/Optimizer +++ b/include/osgUtil/Optimizer @@ -509,7 +509,7 @@ class OSGUTIL_EXPORT Optimizer CheckGeometryVisitor(Optimizer* optimizer=0): BaseOptimizerVisitor(optimizer, CHECK_GEOMETRY) {} - virtual void apply(osg::Geode& geode) { checkGeode(geode); } + virtual void apply(osg::Geometry& geom); void checkGeode(osg::Geode& geode); @@ -523,9 +523,7 @@ class OSGUTIL_EXPORT Optimizer MakeFastGeometryVisitor(Optimizer* optimizer=0): BaseOptimizerVisitor(optimizer, MAKE_FAST_GEOMETRY) {} - virtual void apply(osg::Geode& geode) { checkGeode(geode); } - - void checkGeode(osg::Geode& geode); + virtual void apply(osg::Geometry& geom); }; diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 0c92f984b..6bfbcc607 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -1732,39 +1732,25 @@ struct LessGeometryPrimitiveType } }; -void Optimizer::CheckGeometryVisitor::checkGeode(osg::Geode& geode) +void Optimizer::CheckGeometryVisitor::apply(osg::Geometry& geom) { - if (isOperationPermissibleForObject(&geode)) + if (isOperationPermissibleForObject(&geom)) { - for(unsigned int i=0;iasGeometry(); - if (geom && isOperationPermissibleForObject(geom)) - { #ifdef GEOMETRYDEPRECATED - geom1829 - ->computeCorrectBindingsAndArraySizes(); + geom + .computeCorrectBindingsAndArraySizes(); #endif - } - } } } -void Optimizer::MakeFastGeometryVisitor::checkGeode(osg::Geode& geode) +void Optimizer::MakeFastGeometryVisitor::apply(osg::Geometry& geom) { // GeometryDeprecated CAN REMOVED - if (isOperationPermissibleForObject(&geode)) + if (isOperationPermissibleForObject(&geom)) { - for(unsigned int i=0;iasGeometry(); - if (geom && isOperationPermissibleForObject(geom)) - { - if (geom->checkForDeprecatedData()) - { - geom->fixDeprecatedData(); - } - } + geom.fixDeprecatedData(); } } }