Fixed the numerical accuracy problems in the Drive and Flight Manipulators.
This commit is contained in:
@@ -24,15 +24,15 @@ public:
|
||||
|
||||
virtual ~DriveManipulator();
|
||||
|
||||
virtual void setNode(osg::Node*);
|
||||
virtual void setNode(osg::Node*);
|
||||
|
||||
virtual const osg::Node* getNode() const;
|
||||
virtual const osg::Node* getNode() const;
|
||||
|
||||
virtual osg::Node* getNode();
|
||||
virtual osg::Node* getNode();
|
||||
|
||||
virtual void home(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
virtual void home(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
virtual void init(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
virtual void init(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
|
||||
|
||||
@@ -44,6 +44,11 @@ private:
|
||||
/** Add the current mouse GUIEvent to internal stack.*/
|
||||
void addMouseEvent(const GUIEventAdapter& ea);
|
||||
|
||||
void computeLocalDataFromCamera();
|
||||
|
||||
void computeCameraFromLocalData();
|
||||
void computeCameraFromLocalData(const osg::Vec3& lv,const osg::Vec3& up);
|
||||
|
||||
/** For the give mouse movement calculate the movement of the camera.
|
||||
Return true is camera has moved and a redraw is required.*/
|
||||
bool calcMovement();
|
||||
@@ -66,6 +71,9 @@ private:
|
||||
|
||||
SpeedControlMode _speedMode;
|
||||
|
||||
osg::Vec3 _eye;
|
||||
osg::Quat _rotation;
|
||||
float _distance;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -50,10 +50,15 @@ private:
|
||||
/** Add the current mouse GUIEvent to internal stack.*/
|
||||
void addMouseEvent(const GUIEventAdapter& ea);
|
||||
|
||||
void computeLocalDataFromCamera();
|
||||
|
||||
void computeCameraFromLocalData();
|
||||
|
||||
/** For the give mouse movement calculate the movement of the camera.
|
||||
Return true is camera has moved and a redraw is required.*/
|
||||
bool calcMovement();
|
||||
|
||||
|
||||
// Internal event stack comprising last three mouse events.
|
||||
osg::ref_ptr<const GUIEventAdapter> _ga_t1;
|
||||
osg::ref_ptr<const GUIEventAdapter> _ga_t0;
|
||||
@@ -64,6 +69,10 @@ private:
|
||||
float _velocity;
|
||||
|
||||
YawControlMode _yawMode;
|
||||
|
||||
osg::Vec3 _eye;
|
||||
osg::Quat _rotation;
|
||||
float _distance;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -46,14 +46,14 @@ class OSGGA_EXPORT TrackballManipulator : public CameraManipulator
|
||||
/** Add the current mouse GUIEvent to internal stack.*/
|
||||
void addMouseEvent(const GUIEventAdapter& ea);
|
||||
|
||||
void computeLocalDataFromCamera();
|
||||
|
||||
void computeCameraFromLocalData();
|
||||
|
||||
/** For the give mouse movement calculate the movement of the camera.
|
||||
Return true is camera has moved and a redraw is required.*/
|
||||
bool calcMovement();
|
||||
|
||||
void computeLocalDataFromCamera();
|
||||
|
||||
void computeCameraFromLocalData();
|
||||
|
||||
void trackball(osg::Vec3& axis,float& angle, float p1x, float p1y, float p2x, float p2y);
|
||||
float tb_project_to_sphere(float r, float x, float y);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user