MakeFastGeometryVisitor: fix handling of Geometries that are directly in the scene graph not attached to a Geode

This commit is contained in:
scrawl 2017-01-20 23:01:04 +01:00
parent 833f37ea57
commit 4a05caf4f7
2 changed files with 10 additions and 26 deletions

View File

@ -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);
};

View File

@ -1732,39 +1732,25 @@ struct LessGeometryPrimitiveType
}
};
void Optimizer::CheckGeometryVisitor::checkGeode(osg::Geode& geode)
void Optimizer::CheckGeometryVisitor::apply(osg::Geometry& geom)
{
if (isOperationPermissibleForObject(&geode))
{
for(unsigned int i=0;i<geode.getNumDrawables();++i)
{
osg::Geometry* geom = geode.getDrawable(i)->asGeometry();
if (geom && isOperationPermissibleForObject(geom))
if (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;i<geode.getNumDrawables();++i)
if (geom.checkForDeprecatedData())
{
osg::Geometry* geom = geode.getDrawable(i)->asGeometry();
if (geom && isOperationPermissibleForObject(geom))
{
if (geom->checkForDeprecatedData())
{
geom->fixDeprecatedData();
}
}
geom.fixDeprecatedData();
}
}
}