OpenSceneGraph 3.6.5
NodeTrackerManipulator
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_NODE_TRACKER_MANIPULATOR
15#define OSGGA_NODE_TRACKER_MANIPULATOR 1
16
18#include <osg/ObserverNodePath>
19
20
21namespace osgGA {
22
23
25{
26 typedef OrbitManipulator inherited;
27
28 public:
29
31
33 const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
34
36
37 void setTrackNodePath(const osg::NodePath& nodePath);
38 void setTrackNodePath(const osg::ObserverNodePath& nodePath) { _trackNodePath = nodePath; }
40
42 osg::Node* getTrackNode() { osg::NodePath nodePath; return _trackNodePath.getNodePath(nodePath) && !nodePath.empty() ? nodePath.back() : 0; }
43 const osg::Node* getTrackNode() const { osg::NodePath nodePath; return _trackNodePath.getNodePath(nodePath) && !nodePath.empty() ? nodePath.back() : 0; }
44
59
62
63
73
76
77
78 virtual void setByMatrix(const osg::Matrixd& matrix);
79 virtual osg::Matrixd getMatrix() const;
81
82 virtual void setNode(osg::Node*);
83
84 virtual void computeHomePosition();
85
86 protected:
87
88 virtual bool performMovementLeftMouseButton(const double eventTimeDelta, const double dx, const double dy);
89 virtual bool performMovementMiddleMouseButton(const double eventTimeDelta, const double dx, const double dy);
90 virtual bool performMovementRightMouseButton(const double eventTimeDelta, const double dx, const double dy);
91
92 void computeNodeWorldToLocal(osg::Matrixd& worldToLocal) const;
93 void computeNodeLocalToWorld(osg::Matrixd& localToWorld) const;
94
95 void computeNodeCenterAndRotation(osg::Vec3d& center, osg::Quat& rotation) const;
96
97 void computePosition(const osg::Vec3d& eye,const osg::Vec3d& lv,const osg::Vec3d& up);
98
99
102
103};
104
105}
106
107#endif /* OSGGA_NODE_TRACKER_MANIPULATOR */
std::vector< Node * > NodePath
A vector of Nodes pointers which is used to describe the path from a root node to a descendant.
Definition Node:47
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
Base class for all internal nodes in the scene graph.
Definition Node:72
ObserverNodePath is an observer class for tracking changes to a NodePath, that automatically invalida...
Definition ObserverNodePath:28
A quaternion class.
Definition Quat:30
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
osg::Node * getTrackNode()
Definition NodeTrackerManipulator:42
virtual void setByMatrix(const osg::Matrixd &matrix)
set the position of the matrix manipulator using a 4x4 Matrix.
void computeNodeWorldToLocal(osg::Matrixd &worldToLocal) const
void setTrackNode(osg::Node *node)
virtual void setNode(osg::Node *)
Attach a node to the manipulator, automatically detaching any previously attached node.
void computeNodeCenterAndRotation(osg::Vec3d &center, osg::Quat &rotation) const
void setTrackNodePath(const osg::ObserverNodePath &nodePath)
Definition NodeTrackerManipulator:38
osg::ObserverNodePath _trackNodePath
Definition NodeTrackerManipulator:100
NodeTrackerManipulator(int flags=DEFAULT_SETTINGS)
osg::ObserverNodePath & getTrackNodePath()
Definition NodeTrackerManipulator:39
void computeNodeLocalToWorld(osg::Matrixd &localToWorld) const
virtual bool performMovementLeftMouseButton(const double eventTimeDelta, const double dx, const double dy)
META_Object(osgGA, NodeTrackerManipulator)
RotationMode getRotationMode() const
void setTrackNodePath(const osg::NodePath &nodePath)
TrackerMode _trackerMode
Definition NodeTrackerManipulator:101
virtual osg::Matrixd getMatrix() const
get the position of the manipulator as 4x4 Matrix.
virtual bool performMovementMiddleMouseButton(const double eventTimeDelta, const double dx, const double dy)
void setRotationMode(RotationMode mode)
void computePosition(const osg::Vec3d &eye, const osg::Vec3d &lv, const osg::Vec3d &up)
NodeTrackerManipulator(const NodeTrackerManipulator &om, const osg::CopyOp &copyOp=osg::CopyOp::SHALLOW_COPY)
void setTrackerMode(TrackerMode mode)
TrackerMode
Definition NodeTrackerManipulator:46
@ NODE_CENTER
Track the center of the node's bounding sphere, but not rotations of the node.
Definition NodeTrackerManipulator:50
@ NODE_CENTER_AND_AZIM
Track the center of the node's bounding sphere, and the azimuth rotation (about the z axis of the cur...
Definition NodeTrackerManipulator:54
@ NODE_CENTER_AND_ROTATION
Tack the center of the node's bounding sphere, and the all rotations of the node.
Definition NodeTrackerManipulator:57
virtual osg::Matrixd getInverseMatrix() const
get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model...
const osg::Node * getTrackNode() const
Definition NodeTrackerManipulator:43
virtual bool performMovementRightMouseButton(const double eventTimeDelta, const double dx, const double dy)
RotationMode
Definition NodeTrackerManipulator:65
@ ELEVATION_AZIM
Allow the elevation and azimuth angles to be adjust w.r.t the tracked orientation.
Definition NodeTrackerManipulator:71
@ TRACKBALL
Use a trackball style manipulation of the view direction w.r.t the tracked orientation.
Definition NodeTrackerManipulator:68
TrackerMode getTrackerMode() const
Definition NodeTrackerManipulator:61
virtual void computeHomePosition()
OrbitManipulator(int flags=DEFAULT_SETTINGS)
@ DEFAULT_SETTINGS
Definition StandardManipulator:43
#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.