diff --git a/include/osgUtil/Simplifier b/include/osgUtil/Simplifier index dc41f129e..0aadf48eb 100644 --- a/include/osgUtil/Simplifier +++ b/include/osgUtil/Simplifier @@ -43,6 +43,12 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor * Note, Only used when up sampling i.e. sampleRatio > 1.0.*/ void setMaximumLength(float length) { _maximumLength = length; } float getMaximumLength() const { return _maximumLength; } + + void setDoTriStrip(bool on) { _triStrip = on; } + bool getDoTriStrip() const { return _triStrip; } + + void setSmoothing(bool on) { _smoothing = on; } + bool getSmoothing() const { return _smoothing; } class ContinueSimplificationCallback : public osg::Referenced { @@ -101,6 +107,8 @@ class OSGUTIL_EXPORT Simplifier : public osg::NodeVisitor float _sampleRatio; float _maximumError; float _maximumLength; + bool _triStrip; + bool _smoothing; osg::ref_ptr _continueSimplificationCallback; diff --git a/src/osgUtil/Simplifier.cpp b/src/osgUtil/Simplifier.cpp index dc7803423..e2034d299 100644 --- a/src/osgUtil/Simplifier.cpp +++ b/src/osgUtil/Simplifier.cpp @@ -1671,12 +1671,6 @@ void EdgeCollapse::copyBackToGeometry() _geometry->getPrimitiveSetList().clear(); _geometry->addPrimitiveSet(primitives); -#if 1 - osgUtil::SmoothingVisitor::smooth(*_geometry); - - osgUtil::TriStripVisitor stripper; - stripper.stripify(*_geometry); -#endif } @@ -1684,7 +1678,10 @@ Simplifier::Simplifier(float sampleRatio, float maximumError, float maximumLengt osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _sampleRatio(sampleRatio), _maximumError(maximumError), - _maximumLength(maximumLength) + _maximumLength(maximumLength), + _triStrip(true), + _smoothing(true) + { } @@ -1749,4 +1746,16 @@ void Simplifier::simplify(osg::Geometry& geometry, const IndexList& protectedPoi } ec.copyBackToGeometry(); + + if (_smoothing) + { + osgUtil::SmoothingVisitor::smooth(geometry); + } + + if (_triStrip) + { + osgUtil::TriStripVisitor stripper; + stripper.stripify(geometry); + } + }