Added scaling of the PagedLOD range to be relative to the radius of children.

This commit is contained in:
Robert Osfield 2004-04-01 13:09:05 +00:00
parent 4d2d47e656
commit dbc3dbc5fa
2 changed files with 15 additions and 4 deletions

View File

@ -839,7 +839,9 @@ class DataSet : public osg::Referenced
void loadSources();
void setRadiusToMaxVisibleDistanceRatio(float ratio) { _radiusToMaxVisibleDistanceRatio = ratio; }
float getRadiusToMaxVisibleDistanceRatio() const { return _radiusToMaxVisibleDistanceRatio; }
void setVerticalScale(float verticalScale) { _verticalScale = verticalScale; }
float getVerticalScale() const { return _verticalScale; }
@ -935,6 +937,8 @@ class DataSet : public osg::Referenced
QuadMap _quadMap;
float _radiusToMaxVisibleDistanceRatio;
float _verticalScale;
osg::ref_ptr<osgTerrain::CoordinateSystem> _destinationCoordinateSystem;

View File

@ -2410,7 +2410,7 @@ osg::Node* DataSet::CompositeDestination::createPagedLODScene()
float farDistance = 1e8;
if (tileNodes.size()==1)
{
pagedLOD->addChild(tileNodes.front(),cutOffDistance,farDistance);
pagedLOD->addChild(tileNodes.front());
}
else if (tileNodes.size()>1)
{
@ -2421,9 +2421,13 @@ osg::Node* DataSet::CompositeDestination::createPagedLODScene()
{
group->addChild(*itr);
}
pagedLOD->addChild(group,cutOffDistance,farDistance);
pagedLOD->addChild(group);
}
cutOffDistance = pagedLOD->getBound().radius()*_dataSet->getRadiusToMaxVisibleDistanceRatio();
pagedLOD->setRange(0,cutOffDistance,farDistance);
pagedLOD->setFileName(1,getSubTileName());
pagedLOD->setRange(1,0,cutOffDistance);
@ -2499,6 +2503,9 @@ DataSet::DataSet()
{
init();
_radiusToMaxVisibleDistanceRatio = 11.0f;
_verticalScale = 1.0f;
_convertFromGeographicToGeocentric = false;
_defaultColor.set(0.5f,0.5f,1.0f,1.0f);
@ -2557,7 +2564,7 @@ DataSet::CompositeDestination* DataSet::createDestinationGraph(CompositeDestinat
DataSet::CompositeDestination* destinationGraph = new DataSet::CompositeDestination(cs,extents);
destinationGraph->_maxVisibleDistance = extents.radius()*11.0f;
destinationGraph->_maxVisibleDistance = extents.radius()*getRadiusToMaxVisibleDistanceRatio();
// first create the topmost tile