Fix handling of in-scenegraph Drawables in SmoothingVisitor, TriStripVisitor and GraphicsCostEstimator

This commit is contained in:
scrawl
2017-02-03 17:55:32 +01:00
parent 4e1a2d3246
commit e38c3d0303
5 changed files with 13 additions and 31 deletions

View File

@@ -205,15 +205,10 @@ public:
traverse(node);
}
virtual void apply(osg::Geode& geode)
virtual void apply(osg::Geometry& geom)
{
apply(geode.getStateSet());
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
apply(geode.getDrawable(i)->getStateSet());
osg::Geometry* geometry = geode.getDrawable(i)->asGeometry();
if (geometry) apply(geometry);
}
apply(geom.getStateSet());
apply(&geom);
}
void apply(osg::StateSet* stateset)
@@ -282,15 +277,10 @@ public:
traverse(node);
}
virtual void apply(osg::Geode& geode)
virtual void apply(osg::Geometry& geom)
{
apply(geode.getStateSet());
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
apply(geode.getDrawable(i)->getStateSet());
osg::Geometry* geometry = geode.getDrawable(i)->asGeometry();
if (geometry) apply(geometry);
}
apply(geom.getStateSet());
apply(&geom);
}
void apply(osg::StateSet* stateset)

View File

@@ -702,11 +702,7 @@ void SmoothingVisitor::smooth(osg::Geometry& geom, double creaseAngle)
}
void SmoothingVisitor::apply(osg::Geode& geode)
void SmoothingVisitor::apply(osg::Geometry& geom)
{
for(unsigned int i = 0; i < geode.getNumDrawables(); i++ )
{
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
if (geom) smooth(*geom, _creaseAngle);
}
smooth(geom, _creaseAngle);
}

View File

@@ -629,11 +629,7 @@ void TriStripVisitor::stripify()
}
}
void TriStripVisitor::apply(Geode& geode)
void TriStripVisitor::apply(Geometry& geom)
{
for(unsigned int i = 0; i < geode.getNumDrawables(); ++i )
{
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
if (geom) _geometryList.insert(geom);
}
_geometryList.insert(&geom);
}