56#include "QtBaseViewer.hh"
57#include <QPropertyAnimation>
69 size_t nodeIdx, targetIdx;
78 ACG::Vec3d e = eye + t * (_moveBack ? -0.5f : 0.5f);
79 flyTo(e, hitPoint, 300);
87 ACG::Vec3d centerPointProjected = hitPointProjected;
90 int w = 0, h = 0,left = 0, bottom = 0;
104 ACG::Vec3d t = hitPoint - centerPointUnProjected;
148 const double pos = _pos.toDouble();
176 const double pos = _pos.toDouble();
186 if (fabs(a) > FLT_MIN)
235 flyAngle_ = acos(std::max(-1.0, std::min(1.0, (z | view)))) / M_PI * 180.0;
Vec3d eye() const
get eye point
const GLMatrixd & modelview() const
get modelview matrix
int viewport_width() const
get viewport width
Vec3d unproject(const Vec3d &_winPoint) const
unproject point in window coordinates _winPoint to world coordinates
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
int viewport_height() const
get viewport height
void get_viewport(int &_left, int &_bottom, int &_width, int &_height) const
get viewport
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
double orthoWidth()
Get width of the gl scene in orthogonal projection mode (defaults to 2.0)
ACG::Vec3d trackballCenter()
Get virtual trackball center (rotation center when using mouse)
double sceneRadius()
Get radius of the current scene.
double trackballRadius()
Get trackball radius (rotation sphere when using mouse)
virtual void makeCurrent()
Makes this widget the current widget for OpenGL operations.
bool pick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
bool allowRotation_
mouse interaction position
virtual void updateGL()
Redraw scene. Triggers paint event for updating the view (cf. drawNow()).
double lastAnimationPos_
The last position of the animation to compute the difference vector.
void viewChanged()
This signal is emitted whenever the view is changed by the user.
@ PERSPECTIVE_PROJECTION
perspective
void translate(const ACG::Vec3d &trans)
translate the scene and update modelview matrix
ACG::Vec3d flyPosition_
The new position after the flyTo animation.
double flyOrthoWidthOriginal_
Original orthogonal width during flyTo in orthogonal mode.
void flyAnimationPerspective(QVariant _pos)
Slot called during flyTo Animation in perspective mode.
QPropertyAnimation * flyAnimationPerspective_
The animation object for flyTo.
ACG::Vec3d flyCenter_
The new center after the flyTo animation.
QPropertyAnimation * flyAnimationOrthogonal_
The animation object for flyTo.
ACG::GLState * glstate_
Gl State.
double flyAngle_
The rotation angle (full angle) for fly to animation.
Viewer::ViewerProperties & properties_
All properties for this viewer.
ACG::Vec3d flyAxis_
The rotation axis for fly to animation.
void rotate(const ACG::Vec3d &axis, double angle)
rotate the scene (around its center) and update modelview matrix
void flyAnimationOrthogonalFinished()
Slot called when flyTo orthogonal Animation finished.
bool flyMoveBack_
Flag for fly in orthogonal mode if we move back or forward.
virtual void flyTo(const QPoint &_pos, bool _moveBack)
Animated flight to or away from a given point.
bool updatePickCache_
Should the pick cache be updated.
void flyAnimationPerspectiveFinished()
Slot called when flyTo perspective Animation finished.
void flyAnimationOrthogonal(QVariant _pos)
Slot called during flyTo Animation in orthogonal mode.
void updateProjectionMatrix(double _aspect=0.0)
updates projection matrix
ACG::Vec3d flyTranslation_
Full translation between start and ed of animation.
@ PICK_ANYTHING
pick any of the prior targets (should be implemented for all nodes)
VectorT< double, 3 > Vec3d