openscenegraph
TerrainManipulator
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 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_TERRAIN_MANIPULATOR
15#define OSGGA_TERRAIN_MANIPULATOR 1
16
17#include <osgGA/OrbitManipulator>
18
19
20namespace osgGA {
21
22
23class OSGGA_EXPORT TerrainManipulator : public OrbitManipulator
24{
25 typedef OrbitManipulator inherited;
26
27public:
28
29 TerrainManipulator( int flags = DEFAULT_SETTINGS );
30 TerrainManipulator( const TerrainManipulator& tm,
31 const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
32
33 META_Object( osgGA, TerrainManipulator );
34
35 enum RotationMode
36 {
37 ELEVATION_AZIM_ROLL,
38 ELEVATION_AZIM
39 };
40
41 virtual void setRotationMode(RotationMode mode);
42 RotationMode getRotationMode() const;
43
44 virtual void setByMatrix( const osg::Matrixd& matrix );
45
46 virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up );
47
48 virtual void setNode( osg::Node* node );
49
50protected:
51
52 virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
53 virtual bool performMovementRightMouseButton( const double eventTimeDelta, const double dx, const double dy );
54
55 bool intersect( const osg::Vec3d& start, const osg::Vec3d& end, osg::Vec3d& intersection ) const;
56 void clampOrientation();
57
58 osg::Vec3d _previousUp;
59};
60
61
62}
63
64#endif /* OSGGA_TERRAIN_MANIPULATOR */