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();
165 lastAnimationPos_ = pos;
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;
QPropertyAnimation * flyAnimationPerspective_
The animation object for flyTo.
double sceneRadius()
Get radius of the current scene.
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.
virtual void makeCurrent()
Makes this widget the current widget for OpenGL operations.
int viewport_width() const
get viewport width
void flyAnimationOrthogonalFinished()
Slot called when flyTo orthogonal Animation finished.
void rotate(const ACG::Vec3d &axis, double angle)
rotate the scene (around its center) and update modelview matrix
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
QPropertyAnimation * flyAnimationOrthogonal_
The animation object for flyTo.
void get_viewport(int &_left, int &_bottom, int &_width, int &_height) const
get viewport
ACG::Vec3d trackballCenter()
Get virtual trackball center (rotation center when using mouse)
double lastAnimationPos_
The last position of the animation to compute the difference vector.
ACG::Vec3d flyTranslation_
Full translation between start and ed of animation.
double trackballRadius()
Get trackball radius (rotation sphere when using mouse)
void translate(const ACG::Vec3d &trans)
translate the scene and update modelview matrix
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
void viewChanged()
This signal is emitted whenever the view is changed by the user.
ACG::Vec3d flyCenter_
The new center after the flyTo animation.
Vec3d unproject(const Vec3d &_winPoint) const
unproject point in window coordinates _winPoint to world coordinates
void flyAnimationPerspective(QVariant _pos)
Slot called during flyTo Animation in perspective mode.
pick any of the prior targets (should be implemented for all nodes)
int viewport_height() const
get viewport height
void updateProjectionMatrix(double _aspect=0.0)
updates projection matrix
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
ACG::Vec3d flyPosition_
The new position after the flyTo animation.
double flyAngle_
The rotation angle (full angle) for fly to animation.
void flyAnimationPerspectiveFinished()
Slot called when flyTo perspective Animation finished.
const GLMatrixd & modelview() const
get modelview matrix
double flyOrthoWidthOriginal_
Original orthogonal width during flyTo in orthogonal mode.
ACG::Vec3d flyAxis_
The rotation axis for fly to animation.
virtual void updateGL()
Redraw scene. Triggers paint event for updating the view (cf. drawNow()).
void flyAnimationOrthogonal(QVariant _pos)
Slot called during flyTo Animation in orthogonal mode.
bool flyMoveBack_
Flag for fly in orthogonal mode if we move back or forward.
bool allowRotation_
mouse interaction position
double orthoWidth()
Get width of the gl scene in orthogonal projection mode (defaults to 2.0)
Viewer::ViewerProperties & properties_
All properties for this viewer.
Vec3d eye() const
get eye point
VectorT< double, 3 > Vec3d
ACG::GLState * glstate_
Gl State.
bool pick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)