OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DriveManipulator.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_DRIVEMANIPULATOR
15 #define OSGGA_DRIVEMANIPULATOR 1
16 
17 #include <osgGA/CameraManipulator>
18 #include <osg/Quat>
19 
20 namespace osgGA{
21 
30 {
31  public:
32 
34 
35  virtual const char* className() const { return "Drive"; }
36 
38  virtual void setByMatrix(const osg::Matrixd& matrix);
39 
41  virtual void setByInverseMatrix(const osg::Matrixd& matrix) { setByMatrix(osg::Matrixd::inverse(matrix)); }
42 
44  virtual osg::Matrixd getMatrix() const;
45 
47  virtual osg::Matrixd getInverseMatrix() const;
48 
49  virtual void setNode(osg::Node*);
50 
51  virtual const osg::Node* getNode() const;
52 
53  virtual osg::Node* getNode();
54 
55  virtual void computeHomePosition();
56 
57  virtual void home(const GUIEventAdapter& ea,GUIActionAdapter& us);
58 
59  virtual void init(const GUIEventAdapter& ea,GUIActionAdapter& us);
60 
61  virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
62 
64  virtual void getUsage(osg::ApplicationUsage& usage) const;
65 
66  void setModelScale( double in_ms ) { _modelScale = in_ms; }
67  double getModelScale() const { return _modelScale; }
68 
69  void setVelocity( double in_vel ) { _velocity = in_vel; }
70  double getVelocity() const { return _velocity; }
71 
72  void setHeight( double in_h ) { _height = in_h; }
73  double getHeight() const { return _height; }
74 
75  protected:
76 
77  virtual ~DriveManipulator();
78 
79  bool intersect(const osg::Vec3d& start, const osg::Vec3d& end, osg::Vec3d& intersection, osg::Vec3d& normal) const;
80 
82  void flushMouseEventStack();
83 
85  void addMouseEvent(const GUIEventAdapter& ea);
86 
87  void computePosition(const osg::Vec3d& eye,const osg::Vec3d& lv,const osg::Vec3d& up);
88 
92  bool calcMovement();
93 
94  // Internal event stack comprising last two mouse events.
97 
99 
100  double _modelScale;
101  double _velocity;
102  double _height;
103  double _buffer;
104 
107  USE_MOUSE_BUTTONS_FOR_SPEED
108  };
109 
111 
114  double _pitch;
115  double _distance;
116 
119 };
120 
121 }
122 
123 #endif
virtual void setByInverseMatrix(const osg::Matrixd &matrix)
SpeedControlMode _speedMode
double getModelScale() const
double getVelocity() const
void setModelScale(double in_ms)
void setHeight(double in_h)
#define OSGGA_EXPORT
Definition: Export.h:40
static Matrixd inverse(const Matrixd &matrix)
Definition: Matrixd.h:530
osg::ref_ptr< const GUIEventAdapter > _ga_t1
osg::observer_ptr< osg::Node > _node
virtual const char * className() const
osg::ref_ptr< const GUIEventAdapter > _ga_t0
double getHeight() const
Definition: Node.h:71
void setVelocity(double in_vel)
Definition: Quat.h:29