TessellateVisitor: fix handling of Geometries that are directly in the scene graph not attached to a Geode
This commit is contained in:
parent
41cbf9a45e
commit
f229b19496
@ -403,7 +403,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
|
||||
};
|
||||
|
||||
/** Tessellate all geodes, to remove POLYGONS.*/
|
||||
/** Tessellate all Geometries, to remove POLYGONS.*/
|
||||
class OSGUTIL_EXPORT TessellateVisitor : public BaseOptimizerVisitor
|
||||
{
|
||||
public:
|
||||
@ -414,7 +414,7 @@ class OSGUTIL_EXPORT Optimizer
|
||||
TessellateVisitor(Optimizer* optimizer=0):
|
||||
BaseOptimizerVisitor(optimizer, TESSELLATE_GEOMETRY) {}
|
||||
|
||||
virtual void apply(osg::Geode& geode);
|
||||
virtual void apply(osg::Geometry& geom);
|
||||
|
||||
};
|
||||
|
||||
|
@ -405,17 +405,10 @@ void Optimizer::optimize(osg::Node* node, unsigned int options)
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Tessellate geometry - eg break complex POLYGONS into triangles, strips, fans..
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void Optimizer::TessellateVisitor::apply(osg::Geode& geode)
|
||||
void Optimizer::TessellateVisitor::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) {
|
||||
osgUtil::Tessellator Tessellator;
|
||||
Tessellator.retessellatePolygons(*geom);
|
||||
}
|
||||
}
|
||||
traverse(geode);
|
||||
osgUtil::Tessellator Tessellator;
|
||||
Tessellator.retessellatePolygons(geom);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user