From Andrew Sampson, "The terravista terrain generation tool can insert references to external model files into a terrapage tile. It unfortunately does not update the bounding sphere of that tile to include the extents of the external model. This means that if a large model (such as an airfield model) is attached to a tile, the model will disappear when the tile is off-screen (outside the view volume), even though the model is on-screen."

This commit is contained in:
Robert Osfield
2006-03-13 21:20:07 +00:00
parent 1a16d6d6b0
commit d50f2e3add
2 changed files with 16 additions and 0 deletions

View File

@@ -100,3 +100,18 @@ void TXPPagedLOD::traverse(osg::NodeVisitor& nv)
}
}
osg::BoundingSphere TXPPagedLOD::computeBound() const
{
// Force calculation of entire bounding sphere; this will include any
// externally-referenced models which are attached to the tile.
// If this is not done, then externally referenced models will disappear
// when the tile they are attached to leaves the view volume.
osg::BoundingSphere result = osg::Group::computeBound();
if (_centerMode==USER_DEFINED_CENTER && _radius>=0.0f)
{
float tempRadius = std::max( _radius, result.radius() );
result = osg::BoundingSphere(_userDefinedCenter,tempRadius);
}
return result;
}

View File

@@ -58,6 +58,7 @@ namespace txp
TileIdentifier _tileIdentifier;
virtual osg::BoundingSphere computeBound() const;
protected:
virtual ~TXPPagedLOD();