openscenegraph
DriveManipulator
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
18#include <osg/Quat>
19
20namespace 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
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
78
79 bool intersect(const osg::Vec3d& start, const osg::Vec3d& end, osg::Vec3d& intersection, osg::Vec3d& normal) const;
80
83
86
87 void computePosition(const osg::Vec3d& eye,const osg::Vec3d& lv,const osg::Vec3d& up);
88
93
94 // Internal event stack comprising last two mouse events.
97
99
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
Definition CameraManipulator:40
Definition DriveManipulator:30
virtual void setNode(osg::Node *)
virtual void home(const GUIEventAdapter &ea, GUIActionAdapter &us)
SpeedControlMode
Definition DriveManipulator:105
@ USE_MOUSE_Y_FOR_SPEED
Definition DriveManipulator:106
double _pitch
Definition DriveManipulator:114
osg::observer_ptr< osg::Node > _node
Definition DriveManipulator:98
SpeedControlMode _speedMode
Definition DriveManipulator:110
virtual void setByMatrix(const osg::Matrixd &matrix)
void setModelScale(double in_ms)
Definition DriveManipulator:66
bool _pitchUpKeyPressed
Definition DriveManipulator:117
osg::Vec3d _eye
Definition DriveManipulator:112
double getVelocity() const
Definition DriveManipulator:70
osg::Quat _rotation
Definition DriveManipulator:113
virtual void computeHomePosition()
double _buffer
Definition DriveManipulator:103
double getModelScale() const
Definition DriveManipulator:67
double _velocity
Definition DriveManipulator:101
virtual osg::Node * getNode()
virtual void getUsage(osg::ApplicationUsage &usage) const
void computePosition(const osg::Vec3d &eye, const osg::Vec3d &lv, const osg::Vec3d &up)
void addMouseEvent(const GUIEventAdapter &ea)
void setHeight(double in_h)
Definition DriveManipulator:72
virtual const char * className() const
Definition DriveManipulator:35
double _distance
Definition DriveManipulator:115
double _height
Definition DriveManipulator:102
double getHeight() const
Definition DriveManipulator:73
virtual void setByInverseMatrix(const osg::Matrixd &matrix)
Definition DriveManipulator:41
bool intersect(const osg::Vec3d &start, const osg::Vec3d &end, osg::Vec3d &intersection, osg::Vec3d &normal) const
virtual osg::Matrixd getMatrix() const
double _modelScale
Definition DriveManipulator:100
bool _pitchDownKeyPressed
Definition DriveManipulator:118
void setVelocity(double in_vel)
Definition DriveManipulator:69
virtual void init(const GUIEventAdapter &ea, GUIActionAdapter &us)
virtual const osg::Node * getNode() const
osg::ref_ptr< const GUIEventAdapter > _ga_t1
Definition DriveManipulator:95
osg::ref_ptr< const GUIEventAdapter > _ga_t0
Definition DriveManipulator:96
virtual bool handle(const GUIEventAdapter &ea, GUIActionAdapter &us)
virtual osg::Matrixd getInverseMatrix() const
Definition GUIActionAdapter:62
Definition GUIEventAdapter:82
Definition ApplicationUsage:26
Definition Matrixd:27
static Matrixd inverse(const Matrixd &matrix)
Definition Matrixd:536
Definition Node:72
Definition Quat:30
Definition Vec3d:30
Definition observer_ptr:39
Definition ref_ptr:32
Definition Callback:21
#define OSGGA_EXPORT
Definition osgGA/Export:40