Fixed the computation of terrain bounding volume so that it properly accounts for

elevation layers
This commit is contained in:
Robert Osfield
2008-01-17 15:37:35 +00:00
parent ae33e4a459
commit efdc026114
4 changed files with 61 additions and 32 deletions

View File

@@ -104,14 +104,19 @@ osg::BoundingSphere Terrain::computeBound() const
{
osg::BoundingSphere bs;
if (_elevationLayer.valid()) bs.expandBy(_elevationLayer->computeBound());
for(Layers::const_iterator itr = _colorLayers.begin();
itr != _colorLayers.end();
++itr)
if (_elevationLayer.valid())
{
if (itr->layer.valid()) bs.expandBy(itr->layer->computeBound());
bs.expandBy(_elevationLayer->computeBound(true));
}
else
{
for(Layers::const_iterator itr = _colorLayers.begin();
itr != _colorLayers.end();
++itr)
{
if (itr->layer.valid()) bs.expandBy(itr->layer->computeBound(false));
}
}
return bs;
}