24 #ifndef __CAMERAMANIPULATOR_H
25 #define __CAMERAMANIPULATOR_H
29 #include <osg/Version>
30 #if OPENSCENEGRAPH_MAJOR_VERSION >= 3
31 #include <osgGA/CameraManipulator>
32 #define OSGCameraManipulator osgGA::CameraManipulator
34 #include <osgGA/MatrixManipulator>
35 #define OSGCameraManipulator osgGA::MatrixManipulator
38 #include <selforg/position.h>
39 #include <selforg/callbackable.h>
66 virtual const char*
className()
const {
return "Default Camera"; }
69 virtual void setByMatrix(
const osg::Matrixd& matrix);
92 virtual void setNode(osg::Node*);
94 virtual const osg::Node*
getNode()
const;
102 virtual void home(
const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us);
104 virtual void init(
const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us);
106 virtual bool handle(
const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us);
109 virtual void getUsage(osg::ApplicationUsage& usage)
const;
141 virtual void addMouseEvent(
const osgGA::GUIEventAdapter& ea);
158 osg::ref_ptr<const osgGA::GUIEventAdapter>
event;
osg::ref_ptr< const osgGA::GUIEventAdapter > event
Definition: cameramanipulator.h:158
CameraManipulator is a MatrixManipulator which provides a flying camera updating of the camera positi...
Definition: cameramanipulator.h:55
virtual void addMouseEvent(const osgGA::GUIEventAdapter &ea)
Add the current mouse GUIEvent to internal stack.
Definition: cameramanipulator.cpp:268
Interface class for a class which wants to be callback on a certain action.
Definition: callbackable.h:39
#define OSGCameraManipulator
Definition: cameramanipulator.h:35
virtual void calcManipulationPointHorizontal(float x, float y)
manipulates Agent by forces.
Definition: cameramanipulator.cpp:556
virtual void manipulateAgent(OsgHandle &osgHandle)
manipulate agent if Manipulation is active (should be called every simulation step) ...
Definition: cameramanipulator.cpp:604
GlobalData & globalData
Definition: cameramanipulator.h:167
osg::ref_ptr< const osgGA::GUIEventAdapter > event_old
Definition: cameramanipulator.h:157
virtual void setHomeEyeByAgent()
Definition: cameramanipulator.cpp:505
virtual bool calcMovement()
For the give mouse movement calculate the movement of the camera.
Definition: cameramanipulator.cpp:376
osg::ref_ptr< osg::Node > node
Definition: cameramanipulator.h:160
virtual void getUsage(osg::ApplicationUsage &usage) const
Get the keyboard and mouse usage of this manipulator.
Definition: cameramanipulator.cpp:253
double degreeSmoothness
Definition: cameramanipulator.h:170
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
virtual void update()
updates the camera module at every drawstep should be called from the simulation loop ...
Definition: cameramanipulator.cpp:300
virtual OdeAgent * getWatchedAgent()
returns watched agent
Definition: cameramanipulator.cpp:672
osg::Matrixd pose
Definition: cameramanipulator.h:163
virtual void setHome(const osg::Vec3 &eye, const osg::Vec3 &view)
set the home position of the camera. (and place it there)
Definition: cameramanipulator.cpp:79
virtual void setByMatrix(const osg::Matrixd &matrix)
set the position of the matrix manipulator using a 4x4 Matrix.
Definition: cameramanipulator.cpp:275
Class which holds all data used by CameraManipulators.
Definition: camerahandle.h:54
virtual const char * className() const
returns the classname of the manipulator it's NECCESSARY to define this funtion, otherwise the new ma...
Definition: cameramanipulator.h:66
virtual ~CameraManipulator()
Definition: cameramanipulator.cpp:63
virtual void setWatchedAgent(OdeAgent *agent)
Sets the agent to be watched with the camera.
Definition: cameramanipulator.cpp:660
double lengthSmoothness
Definition: cameramanipulator.h:171
static const CallbackableType DEFAULT_CALLBACKABLE_TYPE
This is the default Callbackable type.
Definition: backcaller.h:51
unsigned long CallbackableType
Definition: backcaller.h:45
virtual void setByInverseMatrix(const osg::Matrixd &matrix)
set the position of the matrix manipulator using a 4x4 Matrix.
Definition: cameramanipulator.h:72
virtual void calcManipulationPointVertical(float x, float y)
Definition: cameramanipulator.cpp:526
Vec3f Vec3
Definition: osgforwarddecl.h:42
double lengthAccuracy
Definition: cameramanipulator.h:173
virtual void manageAgents(const int &fkey)
This manages the robots, switching between them and so on Is normally called from handle(...
Definition: cameramanipulator.cpp:407
virtual void calcMovementByAgent()
This handles robot movements, so that the camera movemenent is right affected.
Definition: cameramanipulator.cpp:492
virtual void moveBehindAgent()
moves behind the robot which is actually watched
Definition: cameramanipulator.cpp:415
double degreeAccuracy
Definition: cameramanipulator.h:172
Data structure holding all essential global information.
Definition: globaldata.h:57
Specialised agent for ode robots.
Definition: odeagent.h:62
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
Definition: cameramanipulator.cpp:123
virtual void setNode(osg::Node *)
is called every time the draw is updated.
Definition: cameramanipulator.cpp:66
float modelScale
Definition: cameramanipulator.h:162
virtual void init(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
Definition: cameramanipulator.cpp:112
virtual void doOnCallBack(BackCaller *source, BackCaller::CallbackableType type=BackCaller::DEFAULT_CALLBACKABLE_TYPE)
called if agents list changed
Definition: cameramanipulator.cpp:677
virtual const osg::Node * getNode() const
Definition: cameramanipulator.cpp:70
virtual bool isWatchingAgentDefined()
Checks if an agent is selected and if this agent is available.
Definition: cameramanipulator.cpp:583
virtual osg::Matrixd getInverseMatrix() const
get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model...
Definition: cameramanipulator.cpp:356
virtual void home(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
place the camera at its home position
Definition: cameramanipulator.cpp:91
CameraManipulator(osg::Node *node, GlobalData &global, CameraHandle &cameraHandle)
Definition: cameramanipulator.cpp:46
Class prototype which provides functions to handle callbackable classes.
Definition: backcaller.h:42
virtual void setHomeViewByAgent()
Sets the right view and eye if the robot has changed.
Definition: cameramanipulator.cpp:500
virtual osg::Matrixd getMatrix() const
get the position of the manipulator as 4x4 Matrix.
Definition: cameramanipulator.cpp:296
virtual void centerOnAgent()
centers on the robot which is actually watched
Definition: cameramanipulator.cpp:465
virtual void computeMatrix()
Definition: cameramanipulator.cpp:360
virtual void flushMouseEventStack()
Reset the internal GUIEvent stack.
Definition: cameramanipulator.cpp:264
CameraHandle & camHandle
Definition: cameramanipulator.h:165
virtual void calcManipulationPoint(float x, float y)
Definition: cameramanipulator.cpp:510