1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSGGA_FLIGHT_MANIPULATOR
15#define OSGGA_FLIGHT_MANIPULATOR 1
17#include <osgGA/FirstPersonManipulator>
23/** FlightManipulator is a CameraManipulator which provides flight simulator-like
24 * updating of the camera position & orientation. By default, the left mouse
25 * button accelerates, the right mouse button decelerates, and the middle mouse
26 * button (or left and right simultaneously) stops dead.
28class OSGGA_EXPORT FlightManipulator : public FirstPersonManipulator
30 typedef FirstPersonManipulator inherited;
36 YAW_AUTOMATICALLY_WHEN_BANKED,
40 FlightManipulator( int flags = UPDATE_MODEL_SIZE | COMPUTE_HOME_USING_BBOX );
41 FlightManipulator( const FlightManipulator& fpm,
42 const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
44 META_Object( osgGA, FlightManipulator );
46 virtual void setYawControlMode( YawControlMode ycm );
47 inline YawControlMode getYawControlMode() const;
49 virtual void home( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
50 virtual void init( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
51 virtual void getUsage( osg::ApplicationUsage& usage ) const;
55 virtual bool handleFrame( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
56 virtual bool handleMouseMove( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
57 virtual bool handleMouseDrag( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
58 virtual bool handleMousePush( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
59 virtual bool handleMouseRelease( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
60 virtual bool handleKeyDown( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
61 virtual bool flightHandleEvent( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
63 virtual bool performMovement();
64 virtual bool performMovementLeftMouseButton( const double eventTimeDelta, const double dx, const double dy );
65 virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
66 virtual bool performMovementRightMouseButton( const double eventTimeDelta, const double dx, const double dy );
68 YawControlMode _yawMode;
77/// Returns the Yaw control for the flight model.
78inline FlightManipulator::YawControlMode FlightManipulator::getYawControlMode() const { return _yawMode; }
83#endif /* OSGGA_FLIGHT_MANIPULATOR */