From b15b677cc326d4e538569ab89befece87fa36294 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 17 Nov 2005 11:03:20 +0000 Subject: [PATCH] =?UTF-8?q?From=20Mikkel=20Gj=C3=B8l,=20addition=20of=20pa?= =?UTF-8?q?ramter=20set/get=20methods=20to=20osgGA::*Manipulators,=20chang?= =?UTF-8?q?e=20of=20'=20'=20to=20GUIEventAdapter::KEY=5FSpace,=20fix=20to?= =?UTF-8?q?=20url=20in=20Matrix=5Fimplementation.cpp.=20Syntax=20fixes=20b?= =?UTF-8?q?y=20Robert=20Osfield=20to=20above=20submission=20fix=20inconsis?= =?UTF-8?q?tencies=20with=20normal=20OSG=20coding=20style.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/osgGA/DriveManipulator | 9 +++++++++ include/osgGA/FlightManipulator | 11 ++++++++++- include/osgGA/TrackballManipulator | 16 ++++++++-------- include/osgGA/UFOManipulator | 19 +++++++++++++++++-- src/osg/Matrix_implementation.cpp | 2 +- src/osgGA/DriveManipulator.cpp | 2 +- src/osgGA/FlightManipulator.cpp | 5 +++-- src/osgGA/TerrainManipulator.cpp | 2 +- src/osgGA/TrackballManipulator.cpp | 2 +- 9 files changed, 51 insertions(+), 17 deletions(-) diff --git a/include/osgGA/DriveManipulator b/include/osgGA/DriveManipulator index bc4f04961..ea08da520 100644 --- a/include/osgGA/DriveManipulator +++ b/include/osgGA/DriveManipulator @@ -63,6 +63,15 @@ class OSGGA_EXPORT DriveManipulator : public MatrixManipulator /** Get the keyboard and mouse usage of this manipulator.*/ virtual void getUsage(osg::ApplicationUsage& usage) const; + void setModelScale( double in_ms ) { _modelScale = in_ms; } + double getModelScale() const { return _modelScale; } + + void setVelocity( double in_vel ) { _velocity = in_vel; } + double getVelocity() const { return _velocity; } + + void setHeight( double in_h ) { _height = in_h; } + double getHeight() const { return _height; } + protected: virtual ~DriveManipulator(); diff --git a/include/osgGA/FlightManipulator b/include/osgGA/FlightManipulator index 744537505..836e63297 100644 --- a/include/osgGA/FlightManipulator +++ b/include/osgGA/FlightManipulator @@ -67,9 +67,18 @@ class OSGGA_EXPORT FlightManipulator : public MatrixManipulator NO_AUTOMATIC_YAW }; - /** Configure the Yaw control for the flight model. */ + /** Configure the Yaw control for the flight model. */ void setYawControlMode(YawControlMode ycm) { _yawMode = ycm; } + void setModelScale(double in_ms) { _modelScale = in_ms; } + double getModelScale() const { return _modelScale; } + + void setAcceleration(double in_acc) { _acceleration = in_acc; } + double getAcceleration() const { return _acceleration; } + + void setVelocity(double in_vel) { _velocity = in_vel; } + double getVelocity() const { return _velocity; } + protected: virtual ~FlightManipulator(); diff --git a/include/osgGA/TrackballManipulator b/include/osgGA/TrackballManipulator index dfe6d1327..df1e11fc0 100644 --- a/include/osgGA/TrackballManipulator +++ b/include/osgGA/TrackballManipulator @@ -22,18 +22,10 @@ namespace osgGA{ class OSGGA_EXPORT TrackballManipulator : public MatrixManipulator { public: - TrackballManipulator(); virtual const char* className() const { return "Trackball"; } - /** set the minimum distance (as ratio) the eye point can be zoomed in towards the - center before the center is pushed forward.*/ - void setMinimumZoomScale(float minimumZoomScale) { _minimumZoomScale=minimumZoomScale; } - - /** get the minimum distance (as ratio) the eye point can be zoomed in */ - float getMinimumZoomScale() const { return _minimumZoomScale; } - /** set the position of the matrix manipulator using a 4x4 Matrix.*/ virtual void setByMatrix(const osg::Matrixd& matrix); @@ -78,6 +70,14 @@ class OSGGA_EXPORT TrackballManipulator : public MatrixManipulator /** Get the keyboard and mouse usage of this manipulator.*/ virtual void getUsage(osg::ApplicationUsage& usage) const; + + /** set the minimum distance (as ratio) the eye point can be zoomed in towards the + center before the center is pushed forward.*/ + void setMinimumZoomScale(double minimumZoomScale) { _minimumZoomScale=minimumZoomScale; } + + /** get the minimum distance (as ratio) the eye point can be zoomed in */ + double getMinimumZoomScale() const { return _minimumZoomScale; } + /** Set the size of the trackball. */ void setTrackballSize(float size); diff --git a/include/osgGA/UFOManipulator b/include/osgGA/UFOManipulator index 9881ef053..da9230e60 100644 --- a/include/osgGA/UFOManipulator +++ b/include/osgGA/UFOManipulator @@ -111,9 +111,24 @@ class OSGGA_EXPORT UFOManipulator : public osgGA::MatrixManipulator /** Report the current position as LookAt vectors */ void getCurrentPositionAsLookAt( osg::Vec3 &eye, osg::Vec3 ¢er, osg::Vec3 &up ); - protected: - private: + void setMinHeight( double in_min_height ) { _minHeightAboveGround = in_min_height; } + double getMinHeight() const { return _minHeightAboveGround; } + + void setMinDistance( double in_min_dist ) { _minDistanceInFront = in_min_dist; } + double getMinDistance() const { return _minDistanceInFront; } + + void setForwardSpeed( double in_fs ) { _forwardSpeed = in_fs; } + double getForwardSpeed() const { return _forwardSpeed; } + + void setSideSpeed( double in_ss ) { _sideSpeed = in_ss; } + double getSideSpeed() const { return _sideSpeed; } + + void setRotationSpeed( double in_rot_speed ) { _directionRotationRate = in_rot_speed; } + double getRotationSpeed() const { return _directionRotationRate; } + + + protected: osg::ref_ptr _node; float _viewAngle; osg::Matrixd _matrix; diff --git a/src/osg/Matrix_implementation.cpp b/src/osg/Matrix_implementation.cpp index a2cb54508..3a81f1e4c 100644 --- a/src/osg/Matrix_implementation.cpp +++ b/src/osg/Matrix_implementation.cpp @@ -74,7 +74,7 @@ void Matrix_implementation::set(const Quat& q_in) // Source: Gamasutra, Rotating Objects Using Quaternions // - //http://www.gamasutra.com/features/programming/19980703/quaternions_01.htm + //http://www.gamasutra.com/features/19980703/quaternions_01.htm double wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; diff --git a/src/osgGA/DriveManipulator.cpp b/src/osgGA/DriveManipulator.cpp index 924c2ea82..fb1b5cfd1 100644 --- a/src/osgGA/DriveManipulator.cpp +++ b/src/osgGA/DriveManipulator.cpp @@ -341,7 +341,7 @@ bool DriveManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) case(GUIEventAdapter::KEYDOWN): { - if (ea.getKey()==' ') + if (ea.getKey()==GUIEventAdapter::KEY_Space) { flushMouseEventStack(); home(ea,us); diff --git a/src/osgGA/FlightManipulator.cpp b/src/osgGA/FlightManipulator.cpp index 56e83de1e..5c1407ef1 100644 --- a/src/osgGA/FlightManipulator.cpp +++ b/src/osgGA/FlightManipulator.cpp @@ -131,7 +131,8 @@ bool FlightManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) } case(GUIEventAdapter::KEYDOWN): - if (ea.getKey()==' ') + { + if (ea.getKey()==GUIEventAdapter::KEY_Space) { flushMouseEventStack(); home(ea,us); @@ -150,7 +151,7 @@ bool FlightManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) return true; } return false; - + } case(GUIEventAdapter::FRAME): addMouseEvent(ea); if (calcMovement()) us.requestRedraw(); diff --git a/src/osgGA/TerrainManipulator.cpp b/src/osgGA/TerrainManipulator.cpp index 33fba1b5b..8c8d21ac4 100644 --- a/src/osgGA/TerrainManipulator.cpp +++ b/src/osgGA/TerrainManipulator.cpp @@ -158,7 +158,7 @@ bool TerrainManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) } case(GUIEventAdapter::KEYDOWN): - if (ea.getKey()==' ') + if (ea.getKey()== GUIEventAdapter::KEY_Space) { flushMouseEventStack(); _thrown = false; diff --git a/src/osgGA/TrackballManipulator.cpp b/src/osgGA/TrackballManipulator.cpp index c1e03b96f..db8f4c84d 100644 --- a/src/osgGA/TrackballManipulator.cpp +++ b/src/osgGA/TrackballManipulator.cpp @@ -136,7 +136,7 @@ bool TrackballManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us } case(GUIEventAdapter::KEYDOWN): - if (ea.getKey()==' ') + if (ea.getKey()== GUIEventAdapter::KEY_Space) { flushMouseEventStack(); _thrown = false;