diff --git a/include/osgGA/KeySwitchMatrixManipulator b/include/osgGA/KeySwitchMatrixManipulator index d53985c88..d544cde8c 100644 --- a/include/osgGA/KeySwitchMatrixManipulator +++ b/include/osgGA/KeySwitchMatrixManipulator @@ -106,6 +106,12 @@ public: /** Get the FusionDistanceValue. Used by SceneView for setting up stereo convergence.*/ virtual float getFusionDistanceValue() const { return _current->getFusionDistanceValue(); } + /** Set the distance property. */ + void setDistance(double distance); + + /** Get the distance property. */ + double getDistance() const; + virtual void setNode(osg::Node* n); diff --git a/include/osgGA/MatrixManipulator b/include/osgGA/MatrixManipulator index e0c7c48d8..3ae435afe 100644 --- a/include/osgGA/MatrixManipulator +++ b/include/osgGA/MatrixManipulator @@ -100,6 +100,12 @@ public: /** Get the FusionDistanceValue. Used by SceneView for setting up stereo convergence.*/ virtual float getFusionDistanceValue() const { return 1.0f; } + /** Set the distance parameter (used by TrackballManipulator etc.) */ + void setDistance(double /*distance*/) {} + + /** Get the distance parameter. */ + virtual double getDistance() const { return 1.0; } + /** Set the mask to use when set up intersection traversal such as used in manipulators that follow terrain or have collision detection. * The intersection traversal mask is useful for controlling what parts of the scene graph should be used for intersection purposes.*/ void setIntersectTraversalMask(unsigned int mask) { _intersectTraversalMask = mask; } diff --git a/include/osgGA/TerrainManipulator b/include/osgGA/TerrainManipulator index c64df4a74..ab68a1ac1 100644 --- a/include/osgGA/TerrainManipulator +++ b/include/osgGA/TerrainManipulator @@ -56,6 +56,13 @@ class OSGGA_EXPORT TerrainManipulator : public MatrixManipulator /** Get the FusionDistanceValue. Used by SceneView for setting up stereo convergence.*/ virtual float getFusionDistanceValue() const { return _distance; } + /** Set the distance of the trackball. */ + void setDistance(double distance) { _distance = distance; } + + /** Get the distance of the trackball. */ + double getDistance() const { return _distance; } + + /** Attach a node to the manipulator. Automatically detaches previously attached node. setNode(NULL) detaches previously nodes. diff --git a/src/osgGA/KeySwitchMatrixManipulator.cpp b/src/osgGA/KeySwitchMatrixManipulator.cpp index a7b7bf733..11abfe3f3 100644 --- a/src/osgGA/KeySwitchMatrixManipulator.cpp +++ b/src/osgGA/KeySwitchMatrixManipulator.cpp @@ -56,6 +56,26 @@ void KeySwitchMatrixManipulator::selectMatrixManipulator(unsigned int num) } } +/** Set the distance parameter (used by TrackballManipulator etc.) */ +void KeySwitchMatrixManipulator::setDistance(double distance) +{ + for(KeyManipMap::iterator itr=_manips.begin(); + itr!=_manips.end(); + ++itr) + { + itr->second.second->setDistance(distance); + } +} + +double KeySwitchMatrixManipulator::getDistance() const +{ + if(!_current) + { + return _current->getDistance(); + } + else return 1.0; +} + void KeySwitchMatrixManipulator::setNode(osg::Node* node) { for(KeyManipMap::iterator itr=_manips.begin();