osg MatrixManipulator CameraManipulator

<osgGA/MatrixManipulator>:No such file or directory

修改为

#include <osgGA/CameraManipulator>

osgGA::GUIEventHandler

/* -*-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
 * (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
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSGGA_GUIEVENTHANDLER
#define OSGGA_GUIEVENTHANDLER 1

#include <vector>

#include <osg/Drawable>
#include <osg/ApplicationUsage>

#include <osgGA/EventHandler>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIActionAdapter>


// #define COMPILE_COMPOSITE_EVENTHANDLER

namespace osgGA{

/**

GUIEventHandler provides a basic interface for any class which wants to handle
a GUI Events.

The GUIEvent is supplied by a GUIEventAdapter. Feedback resulting from the
handle method is supplied by a GUIActionAdapter, which allows the GUIEventHandler
to ask the GUI to take some action in response to an incoming event.

For example, consider a Trackball Viewer class which takes mouse events and
manipulates a scene camera in response. The Trackball Viewer is a GUIEventHandler,
and receives the events via the handle method. If the user 'throws' the model,
the Trackball Viewer class can detect this via the incoming events, and
request that the GUI set up a timer callback to continually redraw the view.
This request is made via the GUIActionAdapter class.

*/

class OSGGA_EXPORT GUIEventHandler : public EventHandler
{
public:

        GUIEventHandler() {}
        GUIEventHandler(const GUIEventHandler& eh,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
            osg::Object(eh, copyop),
            osg::Callback(eh, copyop),
            EventHandler(eh, copyop) {}

        META_Object(osgGA,GUIEventHandler);

        /** Handle event. Override the handle(..) method in your event handlers to respond to events. */
        virtual bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv);

        /** Handle events, return true if handled, false otherwise. */
        virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor*) { return handle(ea,aa); }

        /** Deprecated, Handle events, return true if handled, false otherwise. */
        virtual bool handle(const GUIEventAdapter&,GUIActionAdapter&) { return false; }

protected:
        virtual ~GUIEventHandler();

};

}

#endif

osgGA::CameraManipulator

/* -*-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
 * (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
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSGGA_CameraManipulator
#define OSGGA_CameraManipulator 1

#include <osg/Node>
#include <osg/Matrixd>
#include <osg/CoordinateSystemNode>

#include <osgUtil/SceneView>

#include <osgGA/Export>
#include <osgGA/GUIEventHandler>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIActionAdapter>

namespace osgGA{

#define NEW_HOME_POSITION

/**

CameraManipulator is an abstract base class defining the interface, and a certain
amount of default functionality, for classes which wish to control OSG cameras
in response to GUI events.

*/
class OSGGA_EXPORT CameraManipulator : public GUIEventHandler
{
        typedef GUIEventHandler inherited;

    public:

        // We are not using META_Object as this is abstract class.
        // Use META_Object(osgGA,YourManipulator); in your descendant non-abstract classes.
        virtual const char* className() const { return "CameraManipulator"; }

        /** callback class to use to allow matrix manipulators to query the application for the local coordinate frame.*/
        class CoordinateFrameCallback : public osg::Referenced
        {
        public:
            virtual osg::CoordinateFrame getCoordinateFrame(const osg::Vec3d& position) const = 0;
        protected:
            virtual ~CoordinateFrameCallback() {}
        };

        /** set the coordinate frame which callback tells the manipulator which way is up, east and north.*/
        virtual void setCoordinateFrameCallback(CoordinateFrameCallback* cb) { _coordinateFrameCallback = cb; }

        /** get the coordinate frame callback which tells the manipulator which way is up, east and north.*/
        CoordinateFrameCallback* getCoordinateFrameCallback() { return _coordinateFrameCallback.get(); }

        /** get the coordinate frame callback which tells the manipulator which way is up, east and north.*/
        const CoordinateFrameCallback* getCoordinateFrameCallback() const { return _coordinateFrameCallback.get(); }

        /** get the coordinate frame.*/
        osg::CoordinateFrame getCoordinateFrame(const osg::Vec3d& position) const
        {
            if (_coordinateFrameCallback.valid()) return  _coordinateFrameCallback->getCoordinateFrame(position);
            return osg::CoordinateFrame();
        }

        osg::Vec3d getSideVector(const osg::CoordinateFrame& cf) const { return osg::Vec3d(cf(0,0),cf(0,1),cf(0,2)); }
        osg::Vec3d getFrontVector(const osg::CoordinateFrame& cf) const { return osg::Vec3d(cf(1,0),cf(1,1),cf(1,2)); }
        osg::Vec3d getUpVector(const osg::CoordinateFrame& cf) const { return osg::Vec3d(cf(2,0),cf(2,1),cf(2,2)); }

        /** set the position of the matrix manipulator using a 4x4 Matrix.*/
        virtual void setByMatrix(const osg::Matrixd& matrix) = 0;

        /** set the position of the matrix manipulator using a 4x4 Matrix.*/
        virtual void setByInverseMatrix(const osg::Matrixd& matrix) = 0;

        /** get the position of the manipulator as 4x4 Matrix.*/
        virtual osg::Matrixd getMatrix() const = 0;

        /** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/
        virtual osg::Matrixd getInverseMatrix() const = 0;

        /** update the camera for the current frame, typically called by the viewer classes.
            Default implementation simply set the camera view matrix. */
        virtual void updateCamera(osg::Camera& camera) { camera.setViewMatrix(getInverseMatrix()); }

        /** Get the FusionDistanceMode. Used by SceneView for setting up stereo convergence.*/
        virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const { return osgUtil::SceneView::PROPORTIONAL_TO_SCREEN_DISTANCE; }

        /** Get the FusionDistanceValue. Used by SceneView for setting up stereo convergence.*/
        virtual float getFusionDistanceValue() const { return 1.0f; }

        /** 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; }

        /** Get the mask to use when set up intersection traversal such as used in manipulators that follow terrain or have collision detection.*/
        unsigned int getIntersectTraversalMask() const { return _intersectTraversalMask; }

        /**
        Attach a node to the manipulator, automatically detaching any previously attached node.
        setNode(NULL) detaches previous nodes.
        May be ignored by manipulators which do not require a reference model.
        */
        virtual void setNode(osg::Node*) {}

        /** Return const node if attached.*/
        virtual const osg::Node* getNode() const { return NULL; }

        /** Return node if attached.*/
        virtual osg::Node* getNode() { return NULL; }

        /** Manually set the home position, and set the automatic compute of home position. */
        virtual void setHomePosition(const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up, bool autoComputeHomePosition=false)
        {
            setAutoComputeHomePosition(autoComputeHomePosition);
            _homeEye = eye;
            _homeCenter = center;
            _homeUp = up;
        }

        /** Get the manually set home position. */
        virtual void getHomePosition(osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up) const
        {
            eye = _homeEye;
            center = _homeCenter;
            up = _homeUp;
        }

        /** Set whether the automatic compute of the home position is enabled.*/
        virtual void setAutoComputeHomePosition(bool flag) { _autoComputeHomePosition = flag; }

        /** Get whether the automatic compute of the home position is enabled.*/
        bool getAutoComputeHomePosition() const { return _autoComputeHomePosition; }

        /** Compute the home position.*/
        virtual void computeHomePosition(const osg::Camera *camera = NULL, bool useBoundingBox = false);

        /** finish any active manipulator animations.*/
        virtual void finishAnimation() {}

        /**
        Move the camera to the default position.
        May be ignored by manipulators if home functionality is not appropriate.
        */
        virtual void home(const GUIEventAdapter& ,GUIActionAdapter&) {}

        /**
        Move the camera to the default position.
        This version does not require GUIEventAdapter and GUIActionAdapter so may be
        called from somewhere other than a handle() method in GUIEventHandler.  Application
        must be aware of implications.
        */
        virtual void home(double /*currentTime*/) {}

        /**
        Start/restart the manipulator.
        */
        virtual void init(const GUIEventAdapter& ,GUIActionAdapter&) {}

        /** Handle event. Override the handle(..) method in your event handlers to respond to events. */
        virtual bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv) { return GUIEventHandler::handle(event, object, nv); }

        /** Handle events, return true if handled, false otherwise. */
        virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);

    protected:

        CameraManipulator();
        CameraManipulator(const CameraManipulator& mm, const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY);

        virtual ~CameraManipulator();

        std::string getManipulatorName() const;

        unsigned int            _intersectTraversalMask;

        bool                    _autoComputeHomePosition;

        osg::Vec3d              _homeEye;
        osg::Vec3d              _homeCenter;
        osg::Vec3d              _homeUp;

        osg::ref_ptr<CoordinateFrameCallback> _coordinateFrameCallback;

};

}

#endif

osgGA::StandardManipulator

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 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
 * (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
 * OpenSceneGraph Public License for more details.
 *
 * StandardManipulator code Copyright (C) 2010 PCJohn (Jan Peciva)
 * while some pieces of code were taken from OSG.
 * Thanks to company Cadwork (www.cadwork.ch) and
 * Brno University of Technology (www.fit.vutbr.cz) for open-sourcing this work.
*/

#ifndef OSGGA_CAMERA_MANIPULATOR
#define OSGGA_CAMERA_MANIPULATOR 1

#include <osgGA/CameraManipulator>


namespace osgGA {


/** StandardManipulator class provides basic functionality
    for user controlled manipulation.*/
class OSGGA_EXPORT StandardManipulator : public CameraManipulator
{
        typedef CameraManipulator inherited;

    public:

        // flags
        enum UserInteractionFlags
        {
            UPDATE_MODEL_SIZE = 0x01,
            COMPUTE_HOME_USING_BBOX = 0x02,
            PROCESS_MOUSE_WHEEL = 0x04,
            SET_CENTER_ON_WHEEL_FORWARD_MOVEMENT = 0x08,
            DEFAULT_SETTINGS = UPDATE_MODEL_SIZE /*| COMPUTE_HOME_USING_BBOX*/ | PROCESS_MOUSE_WHEEL
        };

        StandardManipulator( int flags = DEFAULT_SETTINGS );
        StandardManipulator( const StandardManipulator& m,
                             const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );

        // We are not using META_Object as this is abstract class.
        // Use META_Object(osgGA,YourManipulator); in your descendant non-abstract classes.
        virtual const char* className() const { return "StandardManipulator"; }

        /** Sets manipulator by eye position and eye orientation.*/
        virtual void setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation ) = 0;

        /** Sets manipulator by eye position, center of rotation, and up vector.*/
        virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up ) = 0;

        /** Gets manipulator's eye position and eye orientation.*/
        virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const = 0;

        /** Gets manipulator's focal center, eye position, and up vector.*/
        virtual void getTransformation( osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up ) const = 0;

        virtual void setNode( osg::Node* );
        virtual const osg::Node* getNode() const;
        virtual osg::Node* getNode();

        virtual void setVerticalAxisFixed( bool value );
        inline bool getVerticalAxisFixed() const;
        inline bool getAllowThrow() const;
        virtual void setAllowThrow( bool allowThrow );

        virtual void setAnimationTime( const double t );
        double getAnimationTime() const;
        bool isAnimating() const;
        virtual void finishAnimation();

        virtual void home( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual void home( double );

        virtual void init( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual void getUsage( osg::ApplicationUsage& usage ) const;

    protected:

        virtual bool handleFrame( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleResize( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleMouseMove( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleMouseDrag( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleMousePush( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleMouseRelease( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleKeyDown( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleKeyUp( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool handleMouseDeltaMovement( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );

        virtual bool performMovement();
        virtual bool performMovementLeftMouseButton( const double eventTimeDelta, const double dx, const double dy );
        virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
        virtual bool performMovementRightMouseButton( const double eventTimeDelta, const double dx, const double dy );
        virtual bool performMouseDeltaMovement( const float dx, const float dy );
        virtual bool performAnimationMovement( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual void applyAnimationStep( const double currentProgress, const double prevProgress );

        void addMouseEvent( const osgGA::GUIEventAdapter& ea );
        void flushMouseEventStack();
        virtual bool isMouseMoving() const;
        float getThrowScale( const double eventTimeDelta ) const;
        virtual void centerMousePointer( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );

        static void rotateYawPitch( osg::Quat& rotation, const double yaw, const double pitch,
                                    const osg::Vec3d& localUp = osg::Vec3d( 0.,0.,0.) );
        static void fixVerticalAxis( osg::Quat& rotation, const osg::Vec3d& localUp, bool disallowFlipOver );
        void fixVerticalAxis( osg::Vec3d& eye, osg::Quat& rotation, bool disallowFlipOver );
        static void fixVerticalAxis( const osg::Vec3d& forward, const osg::Vec3d& up, osg::Vec3d& newUp,
                                     const osg::Vec3d& localUp, bool disallowFlipOver );
        virtual bool setCenterByMousePointerIntersection( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
        virtual bool startAnimationByMousePointerIntersection( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );

        // mouse state
        bool _thrown;
        bool _allowThrow;
        float _mouseCenterX, _mouseCenterY;

        // internal event stack comprising last two mouse events.
        osg::ref_ptr< const osgGA::GUIEventAdapter > _ga_t1;
        osg::ref_ptr< const osgGA::GUIEventAdapter > _ga_t0;

        /** The approximate amount of time it is currently taking to draw a frame.
            * This is used to compute the delta in translation/rotation during a thrown display update.
            * It allows us to match an delta in position/rotation independent of the rendering frame rate.
            */
        double _delta_frame_time;

        /** The time the last frame started.
            * Used when _rate_sensitive is true so that we can match display update rate to rotation/translation rate.
            */
        double _last_frame_time;

        // scene data
        osg::ref_ptr< osg::Node > _node;
        double _modelSize;
        bool _verticalAxisFixed;

        // animation stuff
        class OSGGA_EXPORT AnimationData : public osg::Referenced {
        public:
            double _animationTime;
            bool _isAnimating;
            double _startTime;
            double _phase;

            AnimationData();
            void start( const double startTime );
        };
        osg::ref_ptr< AnimationData > _animationData;
        virtual void allocAnimationData() { _animationData = new AnimationData(); }

        // flags
        int _flags;

        // flags indicating that a value is relative to model size
        int _relativeFlags;
        inline bool getRelativeFlag( int index ) const;
        inline void setRelativeFlag( int index, bool value );
        static int numRelativeFlagsAllocated;
        static int allocateRelativeFlag();
};


//
//  inline methods
//

inline bool StandardManipulator::getRelativeFlag( int index ) const
{
    return ( _relativeFlags & (0x01 << index) ) != 0;
}

inline void StandardManipulator::setRelativeFlag( int index, bool value )
{
    if( value )  _relativeFlags |= (0x01 << index);
    else  _relativeFlags &= ~(0x01 << index);
}

/// Returns whether manipulator preserves camera's "UP" vector.
inline bool StandardManipulator::getVerticalAxisFixed() const
{
    return _verticalAxisFixed;
}

/// Returns true if the camera can be thrown, false otherwise. It defaults to true.
inline bool StandardManipulator::getAllowThrow() const
{
    return _allowThrow;
}


}

#endif /* OSGGA_CAMERA_MANIPULATOR */

osgGA::OrbitManipulator

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 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
 * (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
 * OpenSceneGraph Public License for more details.
 *
 * OrbitManipulator code Copyright (C) 2010 PCJohn (Jan Peciva)
 * while some pieces of code were taken from OSG.
 * Thanks to company Cadwork (www.cadwork.ch) and
 * Brno University of Technology (www.fit.vutbr.cz) for open-sourcing this work.
*/

#ifndef OSGGA_ORBIT_MANIPULATOR
#define OSGGA_ORBIT_MANIPULATOR 1

#include <osgGA/StandardManipulator>


namespace osgGA {


/** OrbitManipulator is base class for camera control based on focal center,
    distance from the center, and orientation of distance vector to the eye.
    This is the base class for trackball style manipulators.*/
class OSGGA_EXPORT OrbitManipulator : public StandardManipulator
{
        typedef StandardManipulator inherited;

    public:

        OrbitManipulator( int flags = DEFAULT_SETTINGS );
        OrbitManipulator( const OrbitManipulator& om,
                          const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );

        META_Object( osgGA, OrbitManipulator );

        virtual void setByMatrix( const osg::Matrixd& matrix );
        virtual void setByInverseMatrix( const osg::Matrixd& matrix );
        virtual osg::Matrixd getMatrix() const;
        virtual osg::Matrixd getInverseMatrix() const;

        virtual void setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation );
        virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up );
        virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const;
        virtual void getTransformation( osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up ) const;

        void setHeading( double azimuth );
        double getHeading() const;
        void setElevation( double elevation );
        double getElevation() const;

        virtual void setCenter( const osg::Vec3d& center );
        const osg::Vec3d& getCenter() const;
        virtual void setRotation( const osg::Quat& rotation );
        const osg::Quat& getRotation() const;
        virtual void setDistance( double distance );
        double getDistance() const;

        virtual void setTrackballSize( const double& size );
        inline double getTrackballSize() const;
        virtual void setWheelZoomFactor( double wheelZoomFactor );
        inline double getWheelZoomFactor() const;

        virtual void setMinimumDistance( const double& minimumDistance, bool relativeToModelSize = false );
        double getMinimumDistance( bool *relativeToModelSize = NULL ) const;

        virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const;
        virtual float getFusionDistanceValue() const;

    protected:

        virtual bool handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );

        virtual bool performMovementLeftMouseButton( const double eventTimeDelta, const double dx, const double dy );
        virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
        virtual bool performMovementRightMouseButton( const double eventTimeDelta, const double dx, const double dy );
        virtual bool performMouseDeltaMovement( const float dx, const float dy );
        virtual void applyAnimationStep( const double currentProgress, const double prevProgress );

        virtual void rotateTrackball( const float px0, const float py0,
                                      const float px1, const float py1, const float scale );
        virtual void rotateWithFixedVertical( const float dx, const float dy );
        virtual void rotateWithFixedVertical( const float dx, const float dy, const osg::Vec3f& up );
        virtual void panModel( const float dx, const float dy, const float dz = 0.f );
        virtual void zoomModel( const float dy, bool pushForwardIfNeeded = true );
        void trackball( osg::Vec3d& axis, float& angle, float p1x, float p1y, float p2x, float p2y );
        float tb_project_to_sphere( float r, float x, float y );
        virtual bool startAnimationByMousePointerIntersection( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );

        osg::Vec3d _center;
        osg::Quat  _rotation;
        double     _distance;

        double _trackballSize;
        double _wheelZoomFactor;

        double _minimumDistance;
        static int _minimumDistanceFlagIndex;

        class OrbitAnimationData : public AnimationData {
        public:
            osg::Vec3d _movement;
            void start( const osg::Vec3d& movement, const double startTime );
        };
        virtual void allocAnimationData() { _animationData = new OrbitAnimationData(); }
};


//
//  inline functions
//

/** Get the size of the trackball relative to the model size. */
inline double OrbitManipulator::getTrackballSize() const  { return _trackballSize; }
/** Get the mouse wheel zoom factor.*/
inline double OrbitManipulator::getWheelZoomFactor() const  { return _wheelZoomFactor; }


}

#endif /* OSGGA_ORBIT_MANIPULATOR */

osgGA::TrackballManipulator

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 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
 * (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
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSGGA_TRACKBALL_MANIPULATOR
#define OSGGA_TRACKBALL_MANIPULATOR 1

#include <osgGA/OrbitManipulator>


namespace osgGA {


class OSGGA_EXPORT TrackballManipulator : public OrbitManipulator
{
        typedef OrbitManipulator inherited;

    public:

        TrackballManipulator( int flags = DEFAULT_SETTINGS );
        TrackballManipulator( const TrackballManipulator& tm,
                              const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );

        META_Object( osgGA, TrackballManipulator );

};


}

#endif /* OSGGA_TRACKBALL_MANIPULATOR */
原文地址:https://www.cnblogs.com/herd/p/11079293.html