NodeTrackerManipulator
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGGA_NODE_TRACKER_MANIPULATOR
#define OSGGA_NODE_TRACKER_MANIPULATOR 1
#include <osgGA/OrbitManipulator>
#include <osg/ObserverNodePath>
namespace osgGA {
class OSGGA_EXPORT NodeTrackerManipulator : public OrbitManipulator
{
typedef OrbitManipulator inherited;
public:
NodeTrackerManipulator( int flags = DEFAULT_SETTINGS );
NodeTrackerManipulator( const NodeTrackerManipulator& om,
const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
META_Object( osgGA, NodeTrackerManipulator );
void setTrackNodePath(const osg::NodePath& nodePath);
void setTrackNodePath(const osg::ObserverNodePath& nodePath) { _trackNodePath = nodePath; }
osg::ObserverNodePath& getTrackNodePath() { return _trackNodePath; }
void setTrackNode(osg::Node* node);
osg::Node* getTrackNode() { osg::NodePath nodePath; return _trackNodePath.getNodePath(nodePath) && !nodePath.empty() ? nodePath.back() : 0; }
const osg::Node* getTrackNode() const { osg::NodePath nodePath; return _trackNodePath.getNodePath(nodePath) && !nodePath.empty() ? nodePath.back() : 0; }
enum TrackerMode
{
NODE_CENTER,
NODE_CENTER_AND_AZIM,
NODE_CENTER_AND_ROTATION
};
void setTrackerMode(TrackerMode mode);
TrackerMode getTrackerMode() const { return _trackerMode; }
enum RotationMode
{
TRACKBALL,
ELEVATION_AZIM
};
void setRotationMode(RotationMode mode);
RotationMode getRotationMode() const;
virtual void setByMatrix(const osg::Matrixd& matrix);
virtual osg::Matrixd getMatrix() const;
virtual osg::Matrixd getInverseMatrix() const;
virtual void setNode(osg::Node*);
virtual void computeHomePosition();
protected:
virtual bool performMovementLeftMouseButton(const double eventTimeDelta, const double dx, const double dy);
virtual bool performMovementMiddleMouseButton(const double eventTimeDelta, const double dx, const double dy);
virtual bool performMovementRightMouseButton(const double eventTimeDelta, const double dx, const double dy);
void computeNodeWorldToLocal(osg::Matrixd& worldToLocal) const;
void computeNodeLocalToWorld(osg::Matrixd& localToWorld) const;
void computeNodeCenterAndRotation(osg::Vec3d& center, osg::Quat& rotation) const;
void computePosition(const osg::Vec3d& eye,const osg::Vec3d& lv,const osg::Vec3d& up);
osg::ObserverNodePath _trackNodePath;
TrackerMode _trackerMode;
};
}
#endif /* OSGGA_NODE_TRACKER_MANIPULATOR */
ObserverNodePath
OrbitManipulator
osgGA::NodeTrackerManipulator::getTrackNode
osg::Node * getTrackNode()
Definition NodeTrackerManipulator:42
osgGA::NodeTrackerManipulator::setByMatrix
virtual void setByMatrix(const osg::Matrixd &matrix)
osgGA::NodeTrackerManipulator::computeNodeWorldToLocal
void computeNodeWorldToLocal(osg::Matrixd &worldToLocal) const
osgGA::NodeTrackerManipulator::setTrackNode
void setTrackNode(osg::Node *node)
osgGA::NodeTrackerManipulator::setNode
virtual void setNode(osg::Node *)
osgGA::NodeTrackerManipulator::computeNodeCenterAndRotation
void computeNodeCenterAndRotation(osg::Vec3d &center, osg::Quat &rotation) const
osgGA::NodeTrackerManipulator::setTrackNodePath
void setTrackNodePath(const osg::ObserverNodePath &nodePath)
Definition NodeTrackerManipulator:38
osgGA::NodeTrackerManipulator::_trackNodePath
osg::ObserverNodePath _trackNodePath
Definition NodeTrackerManipulator:100
osgGA::NodeTrackerManipulator::NodeTrackerManipulator
NodeTrackerManipulator(int flags=DEFAULT_SETTINGS)
osgGA::NodeTrackerManipulator::getTrackNodePath
osg::ObserverNodePath & getTrackNodePath()
Definition NodeTrackerManipulator:39
osgGA::NodeTrackerManipulator::computeNodeLocalToWorld
void computeNodeLocalToWorld(osg::Matrixd &localToWorld) const
osgGA::NodeTrackerManipulator::performMovementLeftMouseButton
virtual bool performMovementLeftMouseButton(const double eventTimeDelta, const double dx, const double dy)
osgGA::NodeTrackerManipulator::META_Object
META_Object(osgGA, NodeTrackerManipulator)
osgGA::NodeTrackerManipulator::getRotationMode
RotationMode getRotationMode() const
osgGA::NodeTrackerManipulator::setTrackNodePath
void setTrackNodePath(const osg::NodePath &nodePath)
osgGA::NodeTrackerManipulator::_trackerMode
TrackerMode _trackerMode
Definition NodeTrackerManipulator:101
osgGA::NodeTrackerManipulator::getMatrix
virtual osg::Matrixd getMatrix() const
osgGA::NodeTrackerManipulator::performMovementMiddleMouseButton
virtual bool performMovementMiddleMouseButton(const double eventTimeDelta, const double dx, const double dy)
osgGA::NodeTrackerManipulator::setRotationMode
void setRotationMode(RotationMode mode)
osgGA::NodeTrackerManipulator::computePosition
void computePosition(const osg::Vec3d &eye, const osg::Vec3d &lv, const osg::Vec3d &up)
osgGA::NodeTrackerManipulator::NodeTrackerManipulator
NodeTrackerManipulator(const NodeTrackerManipulator &om, const osg::CopyOp &copyOp=osg::CopyOp::SHALLOW_COPY)
osgGA::NodeTrackerManipulator::setTrackerMode
void setTrackerMode(TrackerMode mode)
osgGA::NodeTrackerManipulator::TrackerMode
TrackerMode
Definition NodeTrackerManipulator:46
osgGA::NodeTrackerManipulator::NODE_CENTER
@ NODE_CENTER
Definition NodeTrackerManipulator:50
osgGA::NodeTrackerManipulator::NODE_CENTER_AND_AZIM
@ NODE_CENTER_AND_AZIM
Definition NodeTrackerManipulator:54
osgGA::NodeTrackerManipulator::NODE_CENTER_AND_ROTATION
@ NODE_CENTER_AND_ROTATION
Definition NodeTrackerManipulator:57
osgGA::NodeTrackerManipulator::getInverseMatrix
virtual osg::Matrixd getInverseMatrix() const
osgGA::NodeTrackerManipulator::getTrackNode
const osg::Node * getTrackNode() const
Definition NodeTrackerManipulator:43
osgGA::NodeTrackerManipulator::performMovementRightMouseButton
virtual bool performMovementRightMouseButton(const double eventTimeDelta, const double dx, const double dy)
osgGA::NodeTrackerManipulator::RotationMode
RotationMode
Definition NodeTrackerManipulator:65
osgGA::NodeTrackerManipulator::ELEVATION_AZIM
@ ELEVATION_AZIM
Definition NodeTrackerManipulator:71
osgGA::NodeTrackerManipulator::TRACKBALL
@ TRACKBALL
Definition NodeTrackerManipulator:68
osgGA::NodeTrackerManipulator::getTrackerMode
TrackerMode getTrackerMode() const
Definition NodeTrackerManipulator:61
osgGA::NodeTrackerManipulator::computeHomePosition
virtual void computeHomePosition()
osgGA::OrbitManipulator::OrbitManipulator
OrbitManipulator(int flags=DEFAULT_SETTINGS)
osgGA::StandardManipulator::DEFAULT_SETTINGS
@ DEFAULT_SETTINGS
Definition StandardManipulator:43
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Matrixd
Definition Matrixd:27
osg::Node
Definition Node:72
osg::ObserverNodePath
Definition ObserverNodePath:28
osg::Quat
Definition Quat:30
osg::Vec3d
Definition Vec3d:30
osgGA
Definition Callback:21
osg::NodePath
std::vector< Node * > NodePath
Definition Node:47
OSGGA_EXPORT
#define OSGGA_EXPORT
Definition osgGA/Export:40