Fix handling of in-scenegraph Drawables in MeshOptimizers
This commit is contained in:
@@ -33,7 +33,7 @@ public:
|
||||
Optimizer::OptimizationOptions options)
|
||||
: BaseOptimizerVisitor(optimizer, options) {}
|
||||
void reset();
|
||||
void apply(osg::Geode& geode);
|
||||
void apply(osg::Geometry& geom);
|
||||
typedef std::set<osg::Geometry*> GeometryList;
|
||||
GeometryList& getGeometryList() { return _geometryList; };
|
||||
protected:
|
||||
@@ -77,7 +77,7 @@ class OSGUTIL_EXPORT VertexCacheMissVisitor : public osg::NodeVisitor
|
||||
public:
|
||||
VertexCacheMissVisitor(unsigned cacheSize = 16);
|
||||
void reset();
|
||||
virtual void apply(osg::Geode& geode);
|
||||
virtual void apply(osg::Geometry& geom);
|
||||
void doGeometry(osg::Geometry& geom);
|
||||
unsigned misses;
|
||||
unsigned triangles;
|
||||
|
||||
@@ -38,13 +38,9 @@ void GeometryCollector::reset()
|
||||
_geometryList.clear();
|
||||
}
|
||||
|
||||
void GeometryCollector::apply(Geode& geode)
|
||||
void GeometryCollector::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);
|
||||
}
|
||||
|
||||
namespace
|
||||
@@ -890,14 +886,9 @@ void VertexCacheMissVisitor::reset()
|
||||
triangles = 0;
|
||||
}
|
||||
|
||||
void VertexCacheMissVisitor::apply(Geode& geode)
|
||||
void VertexCacheMissVisitor::apply(Geometry& geom)
|
||||
{
|
||||
for(unsigned int i = 0; i < geode.getNumDrawables(); ++i )
|
||||
{
|
||||
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
|
||||
if (geom)
|
||||
doGeometry(*geom);
|
||||
}
|
||||
doGeometry(geom);
|
||||
}
|
||||
|
||||
namespace
|
||||
|
||||
Reference in New Issue
Block a user