OpenSceneGraph 3.6.5
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
28
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
109
111
114 double _pitch;
115 double _distance;
116
119};
120
121}
122
123#endif
The 'GA' in osgGA stands for 'GUI Abstraction'; the osgGA namespace provides facilities to help devel...
Definition Callback:21
Definition ApplicationUsage:26
Definition Matrixd:27
static Matrixd inverse(const Matrixd &matrix)
Definition Matrixd:536
Base class for all internal nodes in the scene graph.
Definition Node:72
Smart pointer for observed objects, that automatically set pointers to them to null when they are del...
Definition observer_ptr:39
A quaternion class.
Definition Quat:30
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
virtual void setNode(osg::Node *)
Attach a node to the manipulator, automatically detaching any previously attached node.
virtual void home(const GUIEventAdapter &ea, GUIActionAdapter &us)
Move the camera to the default position.
SpeedControlMode
Definition DriveManipulator:105
@ USE_MOUSE_Y_FOR_SPEED
Definition DriveManipulator:106
@ USE_MOUSE_BUTTONS_FOR_SPEED
Definition DriveManipulator:107
double _pitch
Definition DriveManipulator:114
osg::observer_ptr< osg::Node > _node
Definition DriveManipulator:98
void flushMouseEventStack()
Reset the internal GUIEvent stack.
SpeedControlMode _speedMode
Definition DriveManipulator:110
virtual void setByMatrix(const osg::Matrixd &matrix)
Get the position of the matrix manipulator using a 4x4 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()
Return node if attached.
virtual void getUsage(osg::ApplicationUsage &usage) const
Get the keyboard and mouse usage of this manipulator.
void computePosition(const osg::Vec3d &eye, const osg::Vec3d &lv, const osg::Vec3d &up)
void addMouseEvent(const GUIEventAdapter &ea)
Add the current mouse GUIEvent to internal stack.
void setHeight(double in_h)
Definition DriveManipulator:72
bool calcMovement()
For the given mouse movement calculate the movement of the camera.
virtual const char * className() const
return the name of the object's class type.
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)
Set the position of the matrix manipulator using a 4x4 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
Get the position of the manipulator as 4x4 Matrix.
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)
Start/restart the manipulator.
virtual const osg::Node * getNode() const
Return const node if attached.
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)
Handle events, return true if handled, false otherwise.
virtual osg::Matrixd getInverseMatrix() const
Get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model...
Definition GUIActionAdapter:62
Event class for storing Keyboard, mouse and window events.
Definition GUIEventAdapter:82
#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.