File: TerrainManipulator

package info (click to toggle)
openscenegraph 3.2.3%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 32,824 kB
  • sloc: cpp: 370,040; ansic: 9,071; java: 1,020; yacc: 548; objc: 288; makefile: 285; xml: 155; lex: 151
file content (64 lines) | stat: -rw-r--r-- 1,942 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 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_TERRAIN_MANIPULATOR
#define OSGGA_TERRAIN_MANIPULATOR 1

#include <osgGA/OrbitManipulator>


namespace osgGA {


class OSGGA_EXPORT TerrainManipulator : public OrbitManipulator
{
   typedef OrbitManipulator inherited;

public:

   TerrainManipulator( int flags = DEFAULT_SETTINGS );
   TerrainManipulator( const TerrainManipulator& tm,
                       const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );

   META_Object( osgGA, TerrainManipulator );

   enum RotationMode
   {
      ELEVATION_AZIM_ROLL,
      ELEVATION_AZIM
   };

   virtual void setRotationMode(RotationMode mode);
   RotationMode getRotationMode() const;

   virtual void setByMatrix( const osg::Matrixd& matrix );

   virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up );

   virtual void setNode( osg::Node* node );

protected:

   virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
   virtual bool performMovementRightMouseButton( const double eventTimeDelta, const double dx, const double dy );

   bool intersect( const osg::Vec3d& start, const osg::Vec3d& end, osg::Vec3d& intersection ) const;
   void clampOrientation();

   osg::Vec3d _previousUp;
};


}

#endif /* OSGGA_TERRAIN_MANIPULATOR */