Added s/getDoTriStrip and s/getSmoothing method.

This commit is contained in:
Robert Osfield 2006-02-06 20:36:09 +00:00
parent 5418757d9d
commit 608a183753
2 changed files with 24 additions and 7 deletions

View File

@ -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> _continueSimplificationCallback;

View File

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