16 #include <osgGA/CameraManipulator>
21 namespace Visualization
29 virtual const char* className()
const {
return "Trackball"; }
32 virtual void setByMatrix(
const osg::Matrixd& matrix);
35 virtual void setByInverseMatrix(
const osg::Matrixd& matrix) { setByMatrix(osg::Matrixd::inverse(matrix)); }
38 virtual osg::Matrixd getMatrix()
const;
41 virtual osg::Matrixd getInverseMatrix()
const;
44 virtual osgUtil::SceneView::FusionDistanceMode
getFusionDistanceMode()
const {
return osgUtil::SceneView::USE_FUSION_DISTANCE_VALUE; }
53 virtual void setNode(osg::Node*);
56 virtual const osg::Node* getNode()
const;
59 virtual osg::Node* getNode();
63 virtual void home(
const GUIEventAdapter& ea,GUIActionAdapter& us);
64 virtual void home(
double);
67 virtual void init(
const GUIEventAdapter& ea,GUIActionAdapter& us);
70 virtual bool handle(
const GUIEventAdapter& ea,GUIActionAdapter& us);
73 virtual void getUsage(osg::ApplicationUsage& usage)
const;
84 void setCenter(
const osg::Vec3d& center) { _center = center; }
87 const osg::Vec3d&
getCenter()
const {
return _center; }
90 void setRotation(
const osg::Quat& rotation) { _rotation = rotation; }
102 void setTrackballSize(
float size);
111 void flushMouseEventStack();
113 void addMouseEvent(
const GUIEventAdapter& ea);
115 void computePosition(
const osg::Vec3& eye,
const osg::Vec3& lv,
const osg::Vec3& up);
121 void trackball(osg::Vec3& axis,
float& angle,
float p1x,
float p1y,
float p2x,
float p2y);
122 float tb_project_to_sphere(
float r,
float x,
float y);
127 bool isMouseMoving();
130 osg::ref_ptr<const GUIEventAdapter> _ga_t1;
131 osg::ref_ptr<const GUIEventAdapter> _ga_t0;
133 osg::ref_ptr<osg::Node> _node;
136 double _minimumZoomScale;
143 float _trackballSize;
const osg::Vec3d & getCenter() const
void setDistance(double distance)
float getTrackballSize() const
virtual void setByInverseMatrix(const osg::Matrixd &matrix)
Classes for implementing the cm-labs vortex physics engine for AnimatLab.
void setMinimumZoomScale(double minimumZoomScale)
const osg::Quat & getRotation() const
void setCenter(const osg::Vec3d ¢er)
virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const
double getMinimumZoomScale() const
virtual float getFusionDistanceValue() const
void setRotation(const osg::Quat &rotation)
double getDistance() const