OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UFOManipulator.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 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 
14 #ifndef OSGGA_UFO_MANIPULATOR_DEF
15 #define OSGGA_UFO_MANIPULATOR_DEF 1
16 
17 #include <iostream>
18 
19 #include <osgGA/CameraManipulator>
20 #include <osg/Node>
21 #include <osg/Matrix>
22 
54 namespace osgGA {
55 
57 {
58 
59  public:
62 
66  virtual const char* className() const;
67 
71  virtual void setByMatrix( const osg::Matrixd &matrix ) ;
72 
76  virtual void setByInverseMatrix( const osg::Matrixd &invmat);
77 
79  virtual osg::Matrixd getMatrix() const;
80 
82  virtual osg::Matrixd getInverseMatrix() const ;
83 
87  virtual void setNode(osg::Node* node);
88 
90  virtual const osg::Node* getNode() const;
91 
93  virtual osg::Node* getNode();
94 
97  virtual void computeHomePosition();
98 
100  virtual void home(const osgGA::GUIEventAdapter&, osgGA::GUIActionAdapter&) ;
101  void home(double);
102 
103  virtual void init(const GUIEventAdapter& ,GUIActionAdapter&);
104 
106  bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter &aa);
107 
109  void getUsage(osg::ApplicationUsage& usage) const;
110 
112  void getCurrentPositionAsLookAt( osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up );
113 
114 
115  void setMinHeight( double in_min_height ) { _minHeightAboveGround = in_min_height; }
116  double getMinHeight() const { return _minHeightAboveGround; }
117 
118  void setMinDistance( double in_min_dist ) { _minDistanceInFront = in_min_dist; }
119  double getMinDistance() const { return _minDistanceInFront; }
120 
121  void setForwardSpeed( double in_fs ) { _forwardSpeed = in_fs; }
122  double getForwardSpeed() const { return _forwardSpeed; }
123 
124  void setSideSpeed( double in_ss ) { _sideSpeed = in_ss; }
125  double getSideSpeed() const { return _sideSpeed; }
126 
127  void setRotationSpeed( double in_rot_speed ) { _directionRotationRate = in_rot_speed; }
128  double getRotationSpeed() const { return _directionRotationRate; }
129 
130 
131  protected:
132 
133  virtual ~UFOManipulator();
134 
135  bool intersect(const osg::Vec3d& start, const osg::Vec3d& end, osg::Vec3d& intersection) const;
136 
138  float _viewAngle;
142 
145 
148  double _sideSpeed;
149  double _upSpeed;
152 
154 
159 
162  double _pitchOffset;
164  double _yawOffset;
165 
166  double _t0;
167  double _dt;
170 
171 
172  bool _shift;
173  bool _ctrl;
175 
177 
178  void _stop();
179  void _keyDown( const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &);
180  void _keyUp( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter &);
181  void _frame(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter &);
182 
183  void _adjustPosition();
184 };
185 
186 }
187 
188 #endif
void setMinDistance(double in_min_dist)
double getSideSpeed() const
double _directionRotationDeceleration
void setMinHeight(double in_min_height)
void setForwardSpeed(double in_fs)
osg::observer_ptr< osg::Node > _node
#define OSGGA_EXPORT
Definition: Export.h:40
double getMinDistance() const
A UFO manipulator driven with keybindings.
double getForwardSpeed() const
Definition: Node.h:71
osg::Matrixd _inverseMatrix
double _directionRotationAcceleration
void setRotationSpeed(double in_rot_speed)
double getMinHeight() const
void setSideSpeed(double in_ss)
double getRotationSpeed() const