From 48d671352d01f084428423aaf7a8ca315549fcca Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 7 Jun 2004 14:49:39 +0000 Subject: [PATCH] Changed the terrain manipulator so the intersection ray is only computed near to the current center point during panning. --- src/osgGA/TerrainManipulator.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/osgGA/TerrainManipulator.cpp b/src/osgGA/TerrainManipulator.cpp index fb2a843db..efe1ef791 100644 --- a/src/osgGA/TerrainManipulator.cpp +++ b/src/osgGA/TerrainManipulator.cpp @@ -8,11 +8,9 @@ using namespace osgGA; TerrainManipulator::TerrainManipulator() { - _modelScale = 0.01f; - _rotationMode =ELEVATION_AZIM; - _minimumZoomScale = 0.0005f; - _distance = 1.0f; + _minimumDistance = 1.0; + _distance = 1.0; _thrown = false; @@ -34,11 +32,6 @@ void TerrainManipulator::setRotationMode(RotationMode mode) void TerrainManipulator::setNode(osg::Node* node) { _node = node; - if (_node.get()) - { - const osg::BoundingSphere& boundingSphere=_node->getBound(); - _modelScale = boundingSphere._radius; - } } @@ -456,7 +449,7 @@ bool TerrainManipulator::calcMovement() // need to reintersect with the terrain osgUtil::IntersectVisitor iv; - double distance = _node->getBound().radius(); + double distance = _node->getBound().radius()*0.1f; osg::Vec3d start_segment = _center + getUpVector(coordinateFrame) * distance; osg::Vec3d end_segment = start_segment - getUpVector(coordinateFrame) * (2.0f*distance); @@ -505,7 +498,7 @@ bool TerrainManipulator::calcMovement() } else { - osg::notify(osg::NOTICE)<<"New up orientation nearly inline - no need to rotate"<_modelScale*_minimumZoomScale) + if (fd*scale>_minimumDistance) { _distance *= scale; + } else + { + _distance = _minimumDistance; } return true;