44
44
See the <a href="../mouse.html">mouse page</a> for a description of the possible actions that can
45
45
be performed using the mouse and their bindings.
47
class QGLVIEWER_EXPORT ManipulatedCameraFrame : public ManipulatedFrame
51
friend class ::QGLViewer;
57
ManipulatedCameraFrame();
58
/*! Virtual destructor. Empty. */
59
virtual ~ManipulatedCameraFrame() {};
61
ManipulatedCameraFrame(const ManipulatedCameraFrame& mcf);
62
ManipulatedCameraFrame& operator=(const ManipulatedCameraFrame& mcf);
64
/*! @name Revolve around point */
67
/*! Returns the point the ManipulatedCameraFrame revolves around when rotated.
69
It is defined in the world coordinate system. Default value is (0,0,0).
71
When the ManipulatedCameraFrame is associated to a Camera, Camera::revolveAroundPoint() also
72
returns this value. This point can interactively be changed using the mouse (see
73
QGLViewer::RAP_FROM_PIXEL and QGLViewer::RAP_IS_CENTER in the <a href="../mouse.html">mouse
75
Vec revolveAroundPoint() const { return revolveAroundPoint_; }
76
/*! Sets the revolveAroundPoint(), defined in the world coordinate system. */
77
void setRevolveAroundPoint(const Vec& revolveAroundPoint) { revolveAroundPoint_ = revolveAroundPoint; }
80
/*! @name Fly parameters */
83
/*! Sets the flySpeed(), defined in OpenGL units.
85
Default value is 0.0, but it is modified according to the QGLViewer::sceneRadius() when the
86
ManipulatedCameraFrame is set as the Camera::frame(). */
87
void setFlySpeed(float speed) { flySpeed_ = speed; };
89
/*! Sets the flyUpVector(), defined in the world coordinate system.
91
Default value is (0,1,0), but it is updated by the Camera when set as its Camera::frame(). Use
92
Camera::setUpVector() instead in that case. */
93
void setFlyUpVector(const Vec& up) { flyUpVector_ = up; };
96
/*! Returns the fly speed, expressed in OpenGL units.
98
It corresponds to the incremental displacement that is periodically applied to the
99
ManipulatedCameraFrame position when a QGLViewer::MOVE_FORWARD or QGLViewer::MOVE_BACKWARD
100
QGLViewer::MouseAction is proceeded.
102
\attention When the ManipulatedCameraFrame is set as the Camera::frame(), this value is set
103
according to the QGLViewer::sceneRadius() by QGLViewer::setSceneRadius(). */
104
float flySpeed() const { return flySpeed_; };
106
/*! Returns the up vector used in fly mode, expressed in the world coordinate system.
108
Fly mode corresponds to the QGLViewer::MOVE_FORWARD and QGLViewer::MOVE_BACKWARD
109
QGLViewer::MouseAction bindings. In these modes, horizontal displacements of the mouse rotate
110
the ManipulatedCameraFrame around this vector. Vertical displacements rotate always around the
113
Default value is (0,1,0), but it is updated by the Camera when set as its Camera::frame().
114
Camera::setOrientation() and Camera::setUpVector()) modify this value and should be used
116
Vec flyUpVector() const { return flyUpVector_; };
119
/*! @name Mouse event handlers */
122
virtual void mouseReleaseEvent(QMouseEvent* const event, Camera* const camera);
123
virtual void mouseMoveEvent (QMouseEvent* const event, Camera* const camera);
124
virtual void wheelEvent (QWheelEvent* const event, Camera* const camera);
127
/*! @name Spinning */
133
/*! @name XML representation */
136
virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
138
virtual void initFromDOMElement(const QDomElement& element);
143
virtual void startAction(int ma, bool withConstraint=true); // int is really a QGLViewer::MouseAction
147
virtual void flyUpdate();
150
void updateFlyUpVector();
151
Quaternion turnQuaternion(int x, const Camera* const camera);
152
Quaternion pitchYawQuaternion(int x, int y, const Camera* const camera);
161
Vec revolveAroundPoint_;
47
class QGLVIEWER_EXPORT ManipulatedCameraFrame : public ManipulatedFrame
51
friend class ::QGLViewer;
57
ManipulatedCameraFrame();
58
/*! Virtual destructor. Empty. */
59
virtual ~ManipulatedCameraFrame() {}
61
ManipulatedCameraFrame(const ManipulatedCameraFrame& mcf);
62
ManipulatedCameraFrame& operator=(const ManipulatedCameraFrame& mcf);
64
/*! @name Revolve around point */
67
/*! Returns the point the ManipulatedCameraFrame revolves around when rotated.
69
It is defined in the world coordinate system. Default value is (0,0,0).
71
When the ManipulatedCameraFrame is associated to a Camera, Camera::revolveAroundPoint() also
72
returns this value. This point can interactively be changed using the mouse (see
73
QGLViewer::RAP_FROM_PIXEL and QGLViewer::RAP_IS_CENTER in the <a href="../mouse.html">mouse
75
Vec revolveAroundPoint() const { return revolveAroundPoint_; }
76
/*! Sets the revolveAroundPoint(), defined in the world coordinate system. */
77
void setRevolveAroundPoint(const Vec& revolveAroundPoint) { revolveAroundPoint_ = revolveAroundPoint; }
80
/*! @name Fly parameters */
83
/*! Sets the flySpeed(), defined in OpenGL units.
85
Default value is 0.0, but it is modified according to the QGLViewer::sceneRadius() when the
86
ManipulatedCameraFrame is set as the Camera::frame(). */
87
void setFlySpeed(float speed) { flySpeed_ = speed; }
89
/*! Sets the flyUpVector(), defined in the world coordinate system.
91
Default value is (0,1,0), but it is updated by the Camera when set as its Camera::frame(). Use
92
Camera::setUpVector() instead in that case. */
93
void setFlyUpVector(const Vec& up) { flyUpVector_ = up; }
96
/*! Returns the fly speed, expressed in OpenGL units.
98
It corresponds to the incremental displacement that is periodically applied to the
99
ManipulatedCameraFrame position when a QGLViewer::MOVE_FORWARD or QGLViewer::MOVE_BACKWARD
100
QGLViewer::MouseAction is proceeded.
102
\attention When the ManipulatedCameraFrame is set as the Camera::frame(), this value is set
103
according to the QGLViewer::sceneRadius() by QGLViewer::setSceneRadius(). */
104
float flySpeed() const { return flySpeed_; }
106
/*! Returns the up vector used in fly mode, expressed in the world coordinate system.
108
Fly mode corresponds to the QGLViewer::MOVE_FORWARD and QGLViewer::MOVE_BACKWARD
109
QGLViewer::MouseAction bindings. In these modes, horizontal displacements of the mouse rotate
110
the ManipulatedCameraFrame around this vector. Vertical displacements rotate always around the
113
Default value is (0,1,0), but it is updated by the Camera when set as its Camera::frame().
114
Camera::setOrientation() and Camera::setUpVector()) modify this value and should be used
116
Vec flyUpVector() const { return flyUpVector_; }
119
/*! @name Mouse event handlers */
122
virtual void mouseReleaseEvent(QMouseEvent* const event, Camera* const camera);
123
virtual void mouseMoveEvent (QMouseEvent* const event, Camera* const camera);
124
virtual void wheelEvent (QWheelEvent* const event, Camera* const camera);
127
/*! @name Spinning */
133
/*! @name XML representation */
136
virtual QDomElement domElement(const QString& name, QDomDocument& document) const;
138
virtual void initFromDOMElement(const QDomElement& element);
143
virtual void startAction(int ma, bool withConstraint=true); // int is really a QGLViewer::MouseAction
147
virtual void flyUpdate();
150
void updateFlyUpVector();
151
Quaternion turnQuaternion(int x, const Camera* const camera);
152
Quaternion pitchYawQuaternion(int x, int y, const Camera* const camera);
161
Vec revolveAroundPoint_;
164
164
} // namespace qglviewer