1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
13//osgManipulator - Copyright (C) 2007 Fugro-Jason B.V.
15#ifndef OSGMANIPULATOR_ROTATESPHEREDRAGGER
16#define OSGMANIPULATOR_ROTATESPHEREDRAGGER 1
18#include <osgManipulator/Dragger>
19#include <osgManipulator/Projector>
21namespace osgManipulator {
24 * Dragger for performing 3D rotation on a sphere.
26class OSGMANIPULATOR_EXPORT RotateSphereDragger : public Dragger
30 RotateSphereDragger();
32 META_OSGMANIPULATOR_Object(osgManipulator,RotateSphereDragger)
35 * Handle pick events on dragger and generate TranslateInLine commands.
37 virtual bool handle(const PointerInfo&, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
39 /** Setup default geometry for dragger. */
40 void setupDefaultGeometry();
42 /** Set/Get color for dragger. */
43 inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
44 inline const osg::Vec4& getColor() const { return _color; }
47 * Set/Get pick color for dragger. Pick color is color of the dragger
48 * when picked. It gives a visual feedback to show that the dragger has
51 inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
52 inline const osg::Vec4& getPickColor() const { return _pickColor; }
56 virtual ~RotateSphereDragger();
58 osg::ref_ptr<SpherePlaneProjector> _projector;
60 osg::Vec3d _prevWorldProjPt;
62 osg::Matrix _startLocalToWorld, _startWorldToLocal;
63 osg::Quat _prevRotation;