From Mikkel Gjøl, addition of paramter set/get methods to osgGA::*Manipulators,

change of ' ' to GUIEventAdapter::KEY_Space, fix to url in Matrix_implementation.cpp.
Syntax fixes by Robert Osfield to above submission fix inconsistencies with normal
OSG coding style.
This commit is contained in:
Robert Osfield 2005-11-17 11:03:20 +00:00
parent d91f2c631d
commit b15b677cc3
9 changed files with 51 additions and 17 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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 &center, 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<osg::Node> _node;
float _viewAngle;
osg::Matrixd _matrix;

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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;