From Jan Perciva with changes from Robert Osfield, "I am submitting improved osgGA camera manipulators.

Changes:
- new mouse wheel zoom/movement/center functionality
- ability to fix vertical axis (important for CAD)
- possibility to specify values as absolute values or relative to model size
- kind of backward compatibility by flags passed to constructor
- and much more
- restructuring classes to use kind of hierarchy and standard way of event processing (handle methods). This way, there is much more code reusability and it is more easy to develop new kinds of manipulators.

Briefly, the new architecture keeps MatrixManipulator as base abstract class. StandardManipulator is the feature-rich standard manipulator with two main descendant classes: OrbitManipulator and FirstPersonManipulator. OrbitManipulator is base class for all trackball style manipulators, based on center, rotation and distance from center. FirstPersonManipulator is base for walk or fly style manipulators, using position and rotation for camera manipulation.
"

Changes by Robert: Replaced osg::Vec3 by osg::Vec3d, introduced DEFAULT_SETTINGS enum and usage.  Added frame time member variables in prep for improving throw animation when vysync is off.
This commit is contained in:
Robert Osfield
2010-05-25 12:05:13 +00:00
parent fce49ae02a
commit d0f48a2712
24 changed files with 2944 additions and 2187 deletions

View File

@@ -1,13 +1,13 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -57,7 +57,7 @@ public:
/** Get the const complete list of manipulators attached to this keyswitch manipulator.*/
const KeyManipMap& getKeyManipMap() const { return _manips; }
/** Get the current active manipulators.*/
MatrixManipulator* getCurrentMatrixManipulator() { return _current.get(); }
@@ -81,10 +81,6 @@ public:
// Overrides from MatrixManipulator...
/** set the minimum distance (as ratio) the eye point can be zoomed in towards the
center before the center is pushed forward.*/
virtual void setMinimumDistance(float minimumDistance);
/** set the coordinate frame which callback tells the manipulator which way is up, east and north.*/
virtual void setCoordinateFrameCallback(CoordinateFrameCallback* cb);
@@ -106,12 +102,6 @@ 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);
@@ -125,7 +115,7 @@ public:
virtual void computeHomePosition();
virtual void home(const GUIEventAdapter& ee,GUIActionAdapter& aa) { if (_current.valid()) _current->home(ee,aa); }
virtual void home(const GUIEventAdapter& ee,GUIActionAdapter& aa);
virtual void init(const GUIEventAdapter& ee,GUIActionAdapter& aa) { if (_current.valid()) _current->init(ee,aa); }