From ae3b1454e83e095728a070a7babc6972f53c7353 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 30 Jun 2004 14:37:06 +0000 Subject: [PATCH] Completed support for "--levels min max" option where the levels that a source imager or DEM contributes to. --- include/osgTerrain/DataSet | 2 ++ src/osgTerrain/DataSet.cpp | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/osgTerrain/DataSet b/include/osgTerrain/DataSet index 10f4cf932..f80814e8e 100644 --- a/include/osgTerrain/DataSet +++ b/include/osgTerrain/DataSet @@ -738,6 +738,8 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced bool _equalized[NUMBER_OF_POSITIONS]; + unsigned int _maxSourceLevel; + unsigned int _imagery_maxNumColumns; unsigned int _imagery_maxNumRows; float _imagery_maxSourceResolutionX; diff --git a/src/osgTerrain/DataSet.cpp b/src/osgTerrain/DataSet.cpp index d7fd46437..58f55fd23 100644 --- a/src/osgTerrain/DataSet.cpp +++ b/src/osgTerrain/DataSet.cpp @@ -1161,6 +1161,7 @@ DataSet::DestinationTile::DestinationTile(): _level(0), _tileX(0), _tileY(0), + _maxSourceLevel(0), _imagery_maxNumColumns(4096), _imagery_maxNumRows(4096), _imagery_maxSourceResolutionX(0.0f), @@ -1183,6 +1184,12 @@ void DataSet::DestinationTile::computeMaximumSourceResolution(CompositeSource* s { for(CompositeSource::source_iterator itr(sourceGraph);itr.valid();++itr) { + + if ((*itr)->getMaxLevel()<_level) + { + // skip the contribution of this source since this destination tile exceeds its contribution level. + continue; + } SourceData* data = (*itr)->getSourceData(); if (data && (*itr)->getType()!=Source::MODEL) @@ -1192,13 +1199,15 @@ void DataSet::DestinationTile::computeMaximumSourceResolution(CompositeSource* s if (!sp._extents.intersects(_extents)) { -// std::cout<<"DataSet::DestinationTile::computeMaximumSourceResolution:: source does not overlap ignoring for this tile."<getMaxLevel(),_maxSourceLevel); + float sourceResolutionX = (sp._extents.xMax()-sp._extents.xMin())/(float)sp._numValuesX; float sourceResolutionY = (sp._extents.yMax()-sp._extents.yMin())/(float)sp._numValuesY; @@ -2932,8 +2941,8 @@ DataSet::CompositeDestination* DataSet::createDestinationGraph(CompositeDestinat insertTileToQuadMap(destinationGraph); - if (currentLevel>=maxNumLevels-1) - { + if (currentLevel>=maxNumLevels-1 || currentLevel>=tile->_maxSourceLevel) + { // bottom level can't divide any further. destinationGraph->_tiles.push_back(tile); }