>From 0053a5a85e95007142c8bc6de2e49b2e557bc9c9 Mon Sep 17 00:00:00 2001
From: Magnus Kessler <[email protected]>
Date: Thu, 30 Jun 2011 14:35:57 +0100
Subject: [PATCH 02/12] Replace MatrixManipulator with CameraManipulator in
documentation
---
include/osgGA/FlightManipulator | 2 +-
include/osgGA/GUIActionAdapter | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/osgGA/FlightManipulator b/include/osgGA/FlightManipulator
index b5ea50d..c39ff92 100644
--- a/include/osgGA/FlightManipulator
+++ b/include/osgGA/FlightManipulator
@@ -20,7 +20,7 @@
namespace osgGA {
-/** FlightManipulator is a MatrixManipulator which provides flight simulator-
like
+/** FlightManipulator is a CameraManipulator which provides flight simulator-
like
* updating of the camera position & orientation. By default, the left mouse
* button accelerates, the right mouse button decelerates, and the middle
mouse
* button (or left and right simultaneously) stops dead.
diff --git a/include/osgGA/GUIActionAdapter b/include/osgGA/GUIActionAdapter
index f70e6fa..07ddce4 100644
--- a/include/osgGA/GUIActionAdapter
+++ b/include/osgGA/GUIActionAdapter
@@ -67,8 +67,8 @@ public:
virtual void requestRedraw() = 0;
/**
- requestContinousUpdate(bool) is for en/disabling a throw or idle
- callback to be requested by a GUIEventHandler (typically a
MatrixManipulator,
+ requestContinuousUpdate(bool) is for en/disabling a throw or idle
+ callback to be requested by a GUIEventHandler (typically a
CameraManipulator,
though other GUIEventHandler's may also provide functionality).
GUI toolkits can respond to this immediately by registering an
idle/timed
callback, or can delay setting the callback and update at their own
leisure.
--
1.7.3.4
/* -*-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_FLIGHT_MANIPULATOR
#define OSGGA_FLIGHT_MANIPULATOR 1
#include <osgGA/FirstPersonManipulator>
namespace osgGA {
/** FlightManipulator is a CameraManipulator which provides flight simulator-like
* updating of the camera position & orientation. By default, the left mouse
* button accelerates, the right mouse button decelerates, and the middle mouse
* button (or left and right simultaneously) stops dead.
*/
class OSGGA_EXPORT FlightManipulator : public FirstPersonManipulator
{
typedef FirstPersonManipulator inherited;
public:
enum YawControlMode
{
YAW_AUTOMATICALLY_WHEN_BANKED,
NO_AUTOMATIC_YAW
};
FlightManipulator( int flags = UPDATE_MODEL_SIZE | COMPUTE_HOME_USING_BBOX );
FlightManipulator( const FlightManipulator& fpm,
const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
META_Object( osgGA, FlightManipulator );
virtual void setYawControlMode( YawControlMode ycm );
inline YawControlMode getYawControlMode() const;
virtual void home( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
virtual void init( 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 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 flightHandleEvent( 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 );
YawControlMode _yawMode;
};
//
// inline methods
//
/// Returns the Yaw control for the flight model.
inline FlightManipulator::YawControlMode FlightManipulator::getYawControlMode() const { return _yawMode; }
}
#endif /* OSGGA_FLIGHT_MANIPULATOR */
/* -*-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_GUIACTIONADAPTER
#define OSGGA_GUIACTIONADAPTER 1
#include <osgGA/Export>
#include <osg/View>
namespace osgGA{
/**
Abstract base class defining the interface by which GUIEventHandlers may request
actions of the GUI system in use. These requests for actions should then be honored
by the GUI toolkit of the user's application.
To provide more detail, when a GUIEventHandler (e.g. a TrackballManipulator)
handles an incoming event, such as a mouse event, it may wish to make
a request of the GUI. E.g. if a model is 'thrown', the trackball manipulator
may wish to start a timer, and be repeatedly called, to continuously refresh the
camera's position and orientation. However, it has no way of doing this, as it
knows nothing of the window system in which it's operating. Instead, the
GUIEventHandler issues it's request via a GUIActionAdapter, and the viewer
in use should honour the request, using the GUI system in play.
There is more than one way of using the GUIActionAdapter. E.g. it may be inherited
into a Viewer class, as is done with osgGLUT::Viewer. Alternatively, a simple
subclass of GUIActionAdapter (e.g. osgQt::QtActionAdapter) may be passed to
the GUIEventHandler::handle() function; once the function has returned, the viewer
will then unpack the results and work out what to do to respond to the
requests.
Also there are several ways to run your app and handle the updating of
the window. osgGLUT::Viewer always has a idle callback registered which does a
redraw all the time. osgGLUT::Viewer can safely ignore both requestRedraw() and
requestContinousUpdate() as these are happening all the time anyway.
Other apps will probably want to respond to the requestRedraw() and
requestContinousUpdate(bool) and again there is more than one way to handle it.
You can override requestRedraw() and implement to call your own window
redraw straight away. Or you can implement so that a flag is set and
then you then respond the flag being set in your own leisure.
*/
class GUIActionAdapter
{
public:
virtual ~GUIActionAdapter() {}
/** Provide a mechanism for getting the osg::View associated with this GUIActionAdapter.
* One would use this to case view to osgViewer::View(er) if supported by the subclass.*/
virtual osg::View* asView() { return 0; }
/**
requestRedraw() requests a single redraw.
*/
virtual void requestRedraw() = 0;
/**
requestContinuousUpdate(bool) is for en/disabling a throw or idle
callback to be requested by a GUIEventHandler (typically a CameraManipulator,
though other GUIEventHandler's may also provide functionality).
GUI toolkits can respond to this immediately by registering an idle/timed
callback, or can delay setting the callback and update at their own leisure.
*/
virtual void requestContinuousUpdate(bool needed=true) = 0;
/**
requestWarpPointer(int,int) is requesting a repositioning of the mouse pointer
to a specified x,y location on the window. This is used by some camera manipulators
to initialise the mouse pointer when mouse position relative to a controls
neutral mouse position is required, i.e when mimicking a aircrafts joystick.
*/
virtual void requestWarpPointer(float x,float y) = 0;
};
}
#endif
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org