From Jason Beverage, added option to control whether simplification of

tiles is done during osgdem builds.
This commit is contained in:
Robert Osfield
2005-12-15 16:30:31 +00:00
parent 4b269ba9da
commit 72554ca27e
4 changed files with 24 additions and 6 deletions

View File

@@ -3023,14 +3023,15 @@ osg::Node* DataSet::DestinationTile::createPolygonal()
osgDB::writeNodeFile(*geode,"NodeBeforeSimplification.osg");
}
#if 1
unsigned int targetMaxNumVertices = 2048;
float sample_ratio = (numVertices <= targetMaxNumVertices) ? 1.0f : (float)targetMaxNumVertices/(float)numVertices;
if (_dataSet->getSimplifyTerrain())
{
unsigned int targetMaxNumVertices = 2048;
float sample_ratio = (numVertices <= targetMaxNumVertices) ? 1.0f : (float)targetMaxNumVertices/(float)numVertices;
osgUtil::Simplifier simplifier(sample_ratio,geometry->getBound().radius()/2000.0f);
osgUtil::Simplifier simplifier(sample_ratio,geometry->getBound().radius()/2000.0f);
simplifier.simplify(*geometry, pointsToProtectDuringSimplification); // this will replace the normal vector with a new one
#endif
simplifier.simplify(*geometry, pointsToProtectDuringSimplification); // this will replace the normal vector with a new one
}
osgUtil::TriStripVisitor tsv;
tsv.setMinStripSize(3);
@@ -3743,6 +3744,8 @@ DataSet::DataSet()
_writeNodeBeforeSimplification = false;
_simplifyTerrain = true;
setEllipsoidModel(new osg::EllipsoidModel());
}