Added set/getDistance() method

This commit is contained in:
Robert Osfield
2010-01-05 11:09:18 +00:00
parent 43709c0de7
commit bbf1ef45ee
4 changed files with 39 additions and 0 deletions

View File

@@ -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);

View File

@@ -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; }

View File

@@ -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.

View File

@@ -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();