OpenSceneGraph 3.6.5
FirstPersonManipulator
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
2 *
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.
7 *
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.
12 *
13 * FirstPersonManipulator code Copyright (C) 2010 PCJohn (Jan Peciva)
14 * while some pieces of code were taken from OSG.
15 * Thanks to company Cadwork (www.cadwork.ch) and
16 * Brno University of Technology (www.fit.vutbr.cz) for open-sourcing this work.
17*/
18
19#ifndef OSGGA_FIRST_PERSON_MANIPULATOR
20#define OSGGA_FIRST_PERSON_MANIPULATOR 1
21
23
24
25namespace osgGA {
26
27
31{
32 typedef StandardManipulator inherited;
33
34 public:
35
38 const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
39
41
42 virtual void setByMatrix( const osg::Matrixd& matrix );
43 virtual void setByInverseMatrix( const osg::Matrixd& matrix );
44 virtual osg::Matrixd getMatrix() const;
46
47 virtual void setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation );
48 virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up );
49 virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const;
50 virtual void getTransformation( osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up ) const;
51
52 virtual void setVelocity( const double& velocity );
53 inline double getVelocity() const;
54 virtual void setAcceleration( const double& acceleration, bool relativeToModelSize = false );
55 double getAcceleration( bool *relativeToModelSize = NULL ) const;
56 virtual void setMaxVelocity( const double& maxVelocity, bool relativeToModelSize = false );
57 double getMaxVelocity( bool *relativeToModelSize = NULL ) const;
58
59 virtual void setWheelMovement( const double& wheelMovement, bool relativeToModelSize = false );
60 double getWheelMovement( bool *relativeToModelSize = NULL ) const;
61
62 virtual void home( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
63 virtual void home( double );
64
65 virtual void init( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
66
67 protected:
68
70
71 virtual bool performMovementLeftMouseButton( const double eventTimeDelta, const double dx, const double dy );
72 virtual bool performMouseDeltaMovement( const float dx, const float dy );
73 virtual void applyAnimationStep( const double currentProgress, const double prevProgress );
75
76 void moveForward( const double distance );
77 void moveForward( const osg::Quat& rotation, const double distance );
78 void moveRight( const double distance );
79 void moveUp( const double distance );
80
83 double _velocity;
84
91
93 public:
96 void start( const osg::Quat& startRotation, const osg::Quat& targetRotation, const double startTime );
97 };
99};
100
101
102//
103// inline methods
104//
105
108
109
110}
111
112#endif /* OSGGA_FIRST_PERSON_MANIPULATOR */
The 'GA' in osgGA stands for 'GUI Abstraction'; the osgGA namespace provides facilities to help devel...
Definition Callback:21
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition Matrixd:27
A quaternion class.
Definition Quat:30
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
virtual void allocAnimationData()
Definition FirstPersonManipulator:98
double getAcceleration(bool *relativeToModelSize=NULL) const
virtual void init(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
Start/restart the manipulator.
void moveUp(const double distance)
virtual osg::Matrixd getInverseMatrix() const
get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model...
static int _wheelMovementFlagIndex
Definition FirstPersonManipulator:90
double _maxVelocity
Definition FirstPersonManipulator:87
virtual void home(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
Move the camera to the default position.
static int _maxVelocityFlagIndex
Definition FirstPersonManipulator:88
double _velocity
Definition FirstPersonManipulator:83
osg::Vec3d _eye
Definition FirstPersonManipulator:81
virtual void setTransformation(const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up)
Sets manipulator by eye position, center of rotation, and up vector.
virtual void setAcceleration(const double &acceleration, bool relativeToModelSize=false)
virtual void getTransformation(osg::Vec3d &eye, osg::Quat &rotation) const
Gets manipulator's eye position and eye orientation.
virtual void setWheelMovement(const double &wheelMovement, bool relativeToModelSize=false)
osg::Quat _rotation
Definition FirstPersonManipulator:82
static int _accelerationFlagIndex
Definition FirstPersonManipulator:86
void moveForward(const osg::Quat &rotation, const double distance)
double getVelocity() const
Returns velocity.
Definition FirstPersonManipulator:107
META_Object(osgGA, FirstPersonManipulator)
virtual osg::Matrixd getMatrix() const
get the position of the manipulator as 4x4 Matrix.
virtual void setTransformation(const osg::Vec3d &eye, const osg::Quat &rotation)
Sets manipulator by eye position and eye orientation.
virtual void setByInverseMatrix(const osg::Matrixd &matrix)
set the position of the matrix manipulator using a 4x4 Matrix.
void moveForward(const double distance)
double getMaxVelocity(bool *relativeToModelSize=NULL) const
double _acceleration
Definition FirstPersonManipulator:85
virtual bool startAnimationByMousePointerIntersection(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
virtual void getTransformation(osg::Vec3d &eye, osg::Vec3d &center, osg::Vec3d &up) const
Gets manipulator's focal center, eye position, and up vector.
virtual void home(double)
Move the camera to the default position.
virtual bool performMovementLeftMouseButton(const double eventTimeDelta, const double dx, const double dy)
virtual void setMaxVelocity(const double &maxVelocity, bool relativeToModelSize=false)
FirstPersonManipulator(int flags=DEFAULT_SETTINGS)
virtual bool handleMouseWheel(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &us)
virtual void setVelocity(const double &velocity)
void moveRight(const double distance)
virtual void setByMatrix(const osg::Matrixd &matrix)
set the position of the matrix manipulator using a 4x4 Matrix.
virtual bool performMouseDeltaMovement(const float dx, const float dy)
virtual void applyAnimationStep(const double currentProgress, const double prevProgress)
double _wheelMovement
Definition FirstPersonManipulator:89
FirstPersonManipulator(const FirstPersonManipulator &fpm, const osg::CopyOp &copyOp=osg::CopyOp::SHALLOW_COPY)
double getWheelMovement(bool *relativeToModelSize=NULL) const
void start(const osg::Quat &startRotation, const osg::Quat &targetRotation, const double startTime)
osg::Quat _startRot
Definition FirstPersonManipulator:94
osg::Quat _targetRot
Definition FirstPersonManipulator:95
Definition GUIActionAdapter:62
Event class for storing Keyboard, mouse and window events.
Definition GUIEventAdapter:82
StandardManipulator(int flags=DEFAULT_SETTINGS)
@ DEFAULT_SETTINGS
Definition StandardManipulator:43
osg::ref_ptr< AnimationData > _animationData
Definition StandardManipulator:159
#define NULL
Definition Export:55
#define OSGGA_EXPORT
Definition Export:40

osg logo
Generated at Sun Jul 20 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.