Added automatic scaling of the minimum distance to cope with models of

small dimensions.
This commit is contained in:
Robert Osfield
2004-07-07 11:29:58 +00:00
parent 1634cc47c6
commit c6ca80f2c5

View File

@@ -32,6 +32,18 @@ void TerrainManipulator::setRotationMode(RotationMode mode)
void TerrainManipulator::setNode(osg::Node* node)
{
_node = node;
if (_node.get())
{
const osg::BoundingSphere& boundingSphere=_node->getBound();
const float minimumDistanceScale = 0.001f;
_minimumDistance = osg::clampBetween(
boundingSphere._radius * minimumDistanceScale,
0.00001f,1.0f);
osg::notify(osg::NOTICE)<<"Setting terrain manipulator _minimumDistance to "<<_minimumDistance<<std::endl;
}
}