TerrainManipulator 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #ifndef OSGGA_TERRAIN_MANIPULATOR
  14. #define OSGGA_TERRAIN_MANIPULATOR 1
  15. #include <osgGA/OrbitManipulator>
  16. namespace osgGA {
  17. class OSGGA_EXPORT TerrainManipulator : public OrbitManipulator
  18. {
  19. typedef OrbitManipulator inherited;
  20. public:
  21. TerrainManipulator( int flags = DEFAULT_SETTINGS );
  22. TerrainManipulator( const TerrainManipulator& tm,
  23. const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
  24. META_Object( osgGA, TerrainManipulator );
  25. enum RotationMode
  26. {
  27. ELEVATION_AZIM_ROLL,
  28. ELEVATION_AZIM
  29. };
  30. virtual void setRotationMode(RotationMode mode);
  31. RotationMode getRotationMode() const;
  32. virtual void setByMatrix( const osg::Matrixd& matrix );
  33. virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up );
  34. virtual void setNode( osg::Node* node );
  35. protected:
  36. virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
  37. virtual bool performMovementRightMouseButton( const double eventTimeDelta, const double dx, const double dy );
  38. bool intersect( const osg::Vec3d& start, const osg::Vec3d& end, osg::Vec3d& intersection ) const;
  39. void clampOrientation();
  40. osg::Vec3d _previousUp;
  41. };
  42. }
  43. #endif /* OSGGA_TERRAIN_MANIPULATOR */