Added Simplifier::requiresDownSampling()/requiresDownSamplingImplementation() to make it possible for the

Simplfifer::ContinueSimplificationCallback to be able to decide whether up or downsampling is required,
removing the previous hardwards reliance on getSampleRatio<1.0.
This commit is contained in:
Robert Osfield
2016-01-18 11:50:07 +00:00
parent e9179aaa4b
commit 7409820a8f
2 changed files with 20 additions and 2 deletions

View File

@@ -1744,14 +1744,17 @@ void Simplifier::simplify(osg::Geometry& geometry, const IndexList& protectedPoi
{
OSG_INFO<<"++++++++++++++simplifier************"<<std::endl;
bool downSample = requiresDownSampling();
EdgeCollapse ec;
ec.setComputeErrorMetricUsingLength(getSampleRatio()>=1.0);
ec.setComputeErrorMetricUsingLength(!downSample);
ec.setGeometry(&geometry, protectedPoints);
ec.updateErrorMetricForAllEdges();
unsigned int numOriginalPrimitives = ec._triangleSet.size();
if (getSampleRatio()<1.0)
if (downSample)
{
while (!ec._edgeSet.empty() &&
continueSimplification((*ec._edgeSet.begin())->getErrorMetric() , numOriginalPrimitives, ec._triangleSet.size()) &&