2010-05-27 21:59:34 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
|
2004-05-06 19:01:16 +08:00
|
|
|
*
|
2010-05-25 20:05:13 +08:00
|
|
|
* 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
|
2004-05-06 19:01:16 +08:00
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
2010-05-25 20:05:13 +08:00
|
|
|
*
|
2004-05-06 19:01:16 +08:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-05-25 20:05:13 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-05-06 19:01:16 +08:00
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
#ifndef OSGGA_TERRAIN_MANIPULATOR
|
|
|
|
#define OSGGA_TERRAIN_MANIPULATOR 1
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
#include <osgGA/OrbitManipulator>
|
2004-05-06 19:01:16 +08:00
|
|
|
|
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
namespace osgGA {
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-01-05 19:09:18 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
class OSGGA_EXPORT TerrainManipulator : public OrbitManipulator
|
|
|
|
{
|
|
|
|
typedef OrbitManipulator inherited;
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
public:
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
TerrainManipulator( int flags = DEFAULT_SETTINGS );
|
|
|
|
TerrainManipulator( const TerrainManipulator& tm,
|
|
|
|
const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
META_Object( osgGA, TerrainManipulator );
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
enum RotationMode
|
|
|
|
{
|
|
|
|
ELEVATION_AZIM_ROLL,
|
|
|
|
ELEVATION_AZIM
|
|
|
|
};
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
virtual void setRotationMode(RotationMode mode);
|
|
|
|
RotationMode getRotationMode() const;
|
2004-05-17 23:50:44 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
virtual void setByMatrix( const osg::Matrixd& matrix );
|
2004-05-17 23:50:44 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up );
|
2004-05-17 23:50:44 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
virtual void setNode( osg::Node* node );
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
protected:
|
2004-05-17 23:50:44 +08:00
|
|
|
|
2010-05-27 21:59:34 +08:00
|
|
|
virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
|
|
|
|
virtual bool performMovementRightMouseButton( const double eventTimeDelta, const double dx, const double dy );
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
bool intersect( const osg::Vec3d& start, const osg::Vec3d& end, osg::Vec3d& intersection ) const;
|
|
|
|
void clampOrientation();
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
osg::Vec3d _previousUp;
|
2004-05-06 19:01:16 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
}
|
2004-05-06 19:01:16 +08:00
|
|
|
|
2010-05-25 20:05:13 +08:00
|
|
|
#endif /* OSGGA_TERRAIN_MANIPULATOR */
|