Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
QtBaseViewer.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 
51 
52 
53 //=============================================================================
54 //
55 // CLASS glViewer
56 //
57 //=============================================================================
58 
59 #ifndef BASEVIEWER_HH
60 #define BASEVIEWER_HH
61 
62 //== INCLUDES =================================================================
63 
66 
67 #include <ACG/GL/GLState.hh>
68 #include <ACG/GL/FBO.hh>
70 #include <ACG/QtWidgets/QtSceneGraphWidget.hh>
71 
72 #include <ACG/ShaderUtils/GLSLShader.hh>
73 #include <ACG/GL/globjects.hh>
74 
75 #include <vector>
76 #include <string>
77 #include <limits>
78 
79 #include <QGraphicsWidget>
80 #include <QTimer>
81 #include <QMouseEvent>
82 #include <QTime>
83 
84 //== FORWARDDECLARATIONS ======================================================
85 
86 
87 class QPushButton;
88 class QToolButton;
89 class QSplitter;
90 class QImage;
91 class QSocketNotifier;
92 class QPropertyAnimation;
93 class QGLWidget;
94 struct PostProcessorInput;
95 
96 
97 //== NAMESPACES ===============================================================
98 
99 //== FORWARDDECLARATIONS ======================================================
100 
101 namespace ACG {
102  namespace QtWidgets {
103  class QtWheel;
104  }
105 }
106 class QGraphicsScene;
107 class QtGLViewerLayout;
108 class QtShiftPopupMenu;
109 class CursorPainter;
110 class PostProcessing;
111 
112 #if QT_VERSION < 0x050000
113 class QGLFramebufferObject;
114 class QGLFramebufferObjectFormat;
115 #else
116 class QOpenGLFramebufferObject;
117 class QOpenGLFramebufferObjectFormat;
118 #endif
119 
120 
121 //== CLASS DEFINITION =========================================================
122 
123 
130 class DLLEXPORT glViewer : public QGraphicsWidget
131 {
132 Q_OBJECT
133 
134 //-------------------------------------------------------------- public methods
135 public:
136 
137  //--------------------------------------------------- constructor / destructor
138 
147  glViewer( QGraphicsScene* _scene,
148  QGLWidget* _glWidget,
149  Viewer::ViewerProperties& _properties,
150  QGraphicsWidget* _parent = 0 );
151 
153  virtual ~glViewer();
154 
155  //------------------------------------------------------------- public methods
156 
157 
159  virtual void makeCurrent();
161  virtual void swapBuffers();
162 
164  void lockProjectionUpdate( void ) { projectionUpdateLocked_ = true; }
165 
167  void unlockProjectionUpdate( void ) { projectionUpdateLocked_ = false; }
168 
169  signals :
170  void functionMenuUpdate();
171 
172  void statusMessage (const QString & message, int timeout = 0);
173 
174  public:
175 
177  void trackMouse(bool _track);
178 
193  void sceneGraph(ACG::SceneGraph::BaseNode* _root,
194  unsigned int _maxPasses,
195  ACG::Vec3d _bbmin,
196  ACG::Vec3d _bbmax,
197  const bool _resetTrackBall = false);
198 
202  PERSPECTIVE_PROJECTION
203  };
204 
208  FIRSTPERSON_NAVIGATION
209  };
210 
212  void projectionMode(ProjectionMode _p);
214  ProjectionMode projectionMode() const { return projectionMode_; }
215 
217  void navigationMode(NavigationMode _n);
219  NavigationMode navigationMode() const { return navigationMode_; }
220 
225  void setScenePos( const ACG::Vec3d& _center, double _radius, const bool _resetTrackBall = false );
226 
228  void viewingDirection( const ACG::Vec3d& _dir, const ACG::Vec3d& _up );
229 
231  void lookAt(const ACG::Vec3d& _eye, const ACG::Vec3d& _center, const ACG::Vec3d& _up);
232 
234  enum NormalsMode {
241  NORMALIZE_NORMALS
242  };
243 
245  void normalsMode(NormalsMode _mode);
247  NormalsMode normalsMode() const { return normalsMode_; }
248 
250  void copyToImage( QImage& _image, GLenum _buffer=GL_BACK) {
251  copyToImage(_image, 0, 0, glWidth(), glHeight(), _buffer);
252  }
253 
255  void copyToImage( QImage& _image,
256  unsigned int _left, unsigned int _top,
257  unsigned int _width, unsigned int _height,
258  GLenum _buffer );
259 
260 
262  unsigned int glWidth() const;
264  unsigned int glHeight() const;
266  QSize glSize() const;
268  QPoint glMapFromGlobal( const QPoint& _pos ) const;
270  QPoint glMapToGlobal( const QPoint& _pos ) const;
271 
272  double field_of_view_vertical() const;
273 
275  double aspect_ratio() const {
276  if (isVisible() && glWidth() && glHeight())
277  return (double) glWidth() / (double) glHeight();
278  else
279  return 1.0;
280  }
281 
283  double near_plane() const {
284  return properties_.nearPlane();
285  }
286 
288  double far_plane() const {
289  return properties_.farPlane();
290  }
291 
293  double ortho_width() const {
294  return properties_.orthoWidth();
295  }
296 
301  void encodeView(QString& _view, const QSize& _windowSize = QSize(-1,-1),
302  const int _toolBarWidth = -1, const bool _make_c_string = false);
303 
316  static bool decodeView(const QString& _view,
317  ACG::GLMatrixd &m, ACG::GLMatrixd &p, int &pMode, double &ortho_width,
318  QSize *_windowSize = NULL,
319  int* _splitterWidth = NULL, QSize *_viewportSize = NULL);
320 
330  bool decodeView(const QString& _view, QSize *_windowSize = NULL,
331  int* _toolBarWidth = NULL, QSize *_viewportSize = NULL);
332 
334  void initModelviewMatrix();
335 
337  void grabGLArea();
338 
340  void releaseGLArea();
341 
343  void translate(const ACG::Vec3d& trans);
344 
346  void rotate(const ACG::Vec3d& axis, double angle)
347  { rotate(axis, angle, properties_.trackballCenter()); }
348 
350  void rotate(const ACG::Vec3d& axis, double angle, const ACG::Vec3d& _center);
351 
353  void setCursorPainter (CursorPainter *_cursorPainter);
354 
356  void updateCursorPosition (QPointF _scenePos);
357 
359  void moveForward();
360 
362  void moveBack();
363 
365  void strafeLeft();
366 
368  void strafeRight();
369 
370 //---------------------------------------------------------------- public slots
371 public slots:
372 
374  virtual void updateGL();
375 
377  virtual void setHome();
379  virtual void home();
381  virtual void viewAll();
382 
384  virtual void perspectiveProjection();
386  virtual void orthographicProjection();
388  virtual void toggleProjectionMode();
390  virtual void toggleNavigationMode();
391 
393  virtual void setFOVY(double _fovy);
394 
395  signals:
396 
397  void projectionModeChanged( bool _ortho );
398  void navigationModeChanged( bool _normal );
399 
400  public slots:
401 
403  virtual void setView( const ACG::GLMatrixd& _modelview,
404  const ACG::GLMatrixd& _inverse_modelview );
405 
410  void actionPasteView(QSize * _windowSize = NULL, int *_splitterWidth = NULL);
414  void actionCopyView(const QSize &_windowSize = QSize(-1,-1), const int _splitterWidth = -1,
415  const bool _make_c_string = false);
416 
417  void actionSetView(QString view);
418 
419 //-------------------------------------------------------------- public signals
420 signals:
421 
432  void signalMouseEvent(QMouseEvent*, const std::string&);
433 
435  void signalMouseEvent(QMouseEvent*);
436 
438  void signalWheelEvent(QWheelEvent*, const std::string&);
439 
443  void signalMouseEventIdentify( QMouseEvent* );
444 
448  void signalMouseEventLight( QMouseEvent* );
449 
451  void signalSceneGraphChanged(ACG::SceneGraph::BaseNode* _root);
452 
455  void signalMouseEventClick ( QMouseEvent*, bool _double );
456 
457 
458  signals:
459 
464  void signalCustomContextMenuRequested ( const QPoint & );
465 
466  private slots:
467 
469  void slotClickTimeout ();
470 
471 
472 //----------------------------------------------------------- protected methods
473 protected:
474 
475  friend class QtGLGraphicsScene;
476  friend class SimpleGLGraphicsScene;
477  friend class QtGLGraphicsView;
478 
479 
481  //virtual QSizeF sizeHint (Qt::SizeHint which, const QSizeF & constraint) const;
482 
484  virtual void initializeGL();
486  virtual void paintGL();
488  virtual void resizeEvent(QGraphicsSceneResizeEvent * _e);
490  virtual void moveEvent (QGraphicsSceneMoveEvent * _e);
491 
493  virtual void mousePressEvent(QGraphicsSceneMouseEvent* _event);
495  virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* _event);
497  virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* _event);
499  virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* _event);
501  virtual void wheelEvent(QGraphicsSceneWheelEvent* _event);
503  virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent* _e);
504 
505 
507  void viewMouseEvent( QMouseEvent* _event);
509  void viewWheelEvent(QWheelEvent* _event);
511  void viewKeyEvent( QKeyEvent* _event);
512 
513 
514  protected:
515 
516 
518  void updateProjectionMatrix();
519 
520 
521 //------------------------------------------------------------- protected slots
522 protected slots:
523 
525  virtual void slotWheelX(double _dAngle);
527  virtual void slotWheelY(double _dAngle);
529  virtual void slotWheelZ(double _dist);
530 
532  virtual void cleanupEventFilter()
533  { removeEventFilter( sender());}
534 
535 //----------------------------------------------------------- private functions
536 private:
537 
539  glViewer(const glViewer&);
541  glViewer& operator=(const glViewer&);
542 
543  // create widgets
544  void createWidgets();
545 
546  /* Recursively draws each node in the scene graph.
547  Called by paintGL(). */
548  void drawScene();
549  // helper called by drawScene().
550  void drawScene_mono();
552  void setCoordSysProjection(glViewer::ProjectionMode _mode);
554  void drawCursor();
555 
556 
557 
558 //-------------------------------------------------------------- protected data
559 protected:
560 
561  // helper
562  bool isRotating_;
563  bool lookAround_;
564 
565 
566 //---------------------------------------------------------------- private data
567 private:
568 
569 
570  // data stored for home view
571  ACG::Vec3d home_center_;
572  double home_radius_;
573  ACG::GLMatrixd home_modelview_,
574  home_inverse_modelview_;
575  double homeOrthoWidth_;
576 
577 
578  // modi
579  NormalsMode normalsMode_;
580  ProjectionMode projectionMode_;
581  NavigationMode navigationMode_;
582 
583 
584  // helper
585  bool trackMouse_;
586  bool glareaGrabbed_;
587  double frame_time_;
588 
589 
590  // scenegraph stuff
591  ACG::SceneGraph::BaseNode* sceneGraphRoot_;
592 
593  bool projectionUpdateLocked_;
594 
595  // graphics scene used to paint gl context and widgets
596  QGraphicsScene* glScene_;
597 
598  // gl widget used as drawing area to paint the graphics scene
599  QGLWidget* glWidget_;
600 
601  // Base graphics widget layout
602  QtGLViewerLayout* glBaseLayout_;
603 
604  // vector of current draw mode actions
605  std::vector< QAction * > drawMenuActions_;
606 
607  // Used to calculate the time passed between redraws
608  QTime redrawTime_;
609 
610  //===========================================================================
613  //===========================================================================
614 
615  public:
616  bool wheelsVisible();
617 
618  public slots:
619  void slotShowWheels();
620  void slotHideWheels();
621 
622  private:
623  // rotate around x-axis
624  ACG::QtWidgets::QtWheel* wheelX_;
625  // rotate around y-axis
626  ACG::QtWidgets::QtWheel* wheelY_;
627  // translate along z-axis
628  ACG::QtWidgets::QtWheel* wheelZ_;
629 
630 
633  //===========================================================================
636  //===========================================================================
637  signals:
639  void viewUpdated();
640 
642  void viewChanged();
643 
645  void signalMakeActive ();
646 
650  //===========================================================================
653  //===========================================================================
654 
655  public:
659  void setSceneCenter( const ACG::Vec3d& _center ) { properties_.sceneCenter(_center); };
660 
665  void setTrackBallCenter( const ACG::Vec3d& _center ) { properties_.trackballCenter(_center); }
666 
671  const ACG::Vec3d trackBallCenter( ) { return properties_.trackballCenter(); };
672 
676  const ACG::Vec3d scene_center() const { return properties_.sceneCenter(); }
679  double scene_radius() const { return properties_.sceneRadius(); }
680 
681  void setSceneRadius(double _radius) { properties_.sceneRadius(_radius); }
682 
686  //===========================================================================
689  //===========================================================================
690 
691  signals:
698  void signalKeyPressEvent(QKeyEvent*);
699 
700  protected:
701 
706  virtual void keyPressEvent(QKeyEvent* _event) { _event->ignore(); };
707 
714  virtual void keyReleaseEvent(QKeyEvent* _event) { _event->ignore(); };
715 
723  virtual bool viewKeyPressEvent(QKeyEvent* /* _event */ ) { return false; }
724 
727  //===========================================================================
730  //===========================================================================
731 
732  public:
733 
735  virtual void dragEnterEvent(QGraphicsSceneDragDropEvent* _e);
736 
738  virtual void dropEvent(QGraphicsSceneDragDropEvent* _e);
739 
740  signals:
744  void startDragEvent( QMouseEvent* _event );
745 
749  void dragEnterEvent(QDragEnterEvent* _event);
750 
754  void dropEvent( QDropEvent* _event );
755 
756 
759  //===========================================================================
762  //===========================================================================
763 
764  public slots:
765 
766 
771  virtual void snapshot(int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false, int samples = 1);
772 
774  virtual void snapshot(QImage& _image, int _width = 0, int _height = 0, bool _alpha = false, bool _hideCoordsys = false, int samples = 1);
775 
778  //===========================================================================
781  //===========================================================================
782  public:
796  bool pick( ACG::SceneGraph::PickTarget _pickTarget,
797  const QPoint& _mousePos,
798  unsigned int& _nodeIdx,
799  unsigned int& _targetIdx,
800  ACG::Vec3d* _hitPointPtr=0 );
801 
815  bool pick_region( ACG::SceneGraph::PickTarget _pickTarget,
816  const QRegion& _region,
817  QList<QPair<unsigned int, unsigned int> >& _list,
818  QVector<float>* _depths = 0,
819  QVector<ACG::Vec3d>* _points = 0);
820 
821 
827  bool fast_pick( const QPoint& _mousePos,
828  ACG::Vec3d& _hitPoint );
829 
831  return glstate_->unproject(pt);
832  }
833 
834  private:
835 
837  int pickColor( ACG::SceneGraph::PickTarget _pickTarget,
838  const QPoint& _mousePos,
839  unsigned int& _nodeIdx,
840  unsigned int& _targetIdx,
841  ACG::Vec3d* _hitPointPtr=0 );
842 
844  int pickFromCache( ACG::SceneGraph::PickTarget _pickTarget,
845  const QPoint& _mousePos,
846  unsigned int& _nodeIdx,
847  unsigned int& _targetIdx,
848  ACG::Vec3d* _hitPointPtr=0 );
849 
850  private:
851 
852 #if QT_VERSION < 0x050000
853  typedef QGLFramebufferObjectFormat QFramebufferObjectFormat;
854  typedef QGLFramebufferObject QFramebufferObject;
855 #else
856  typedef QOpenGLFramebufferObjectFormat QFramebufferObjectFormat;
857  typedef QOpenGLFramebufferObject QFramebufferObject;
858 #endif
859 
861  QFramebufferObject* pickCache_;
862 
865 
868 
871 
874  //===========================================================================
877  //===========================================================================
878 
879  public:
880 
882  void allowRotation( bool _mode ) { allowRotation_ = _mode; };
883  bool allowRotation() { return allowRotation_; };
884 
886  constrainedRotationAxis_ = axis;
887  }
889  return constrainedRotationAxis_[0] == constrainedRotationAxis_[0];
890  }
892  return constrainedRotationAxis_;
893  }
895  constrainedRotationAxis_[0] = std::numeric_limits<double>::quiet_NaN();
896  }
898  updatePickCache_ = true;
899  }
900 
901  private slots:
902 
903  void slotAnimation();
904 
905  protected:
906 
911  QPoint lastPoint2D_;
912 
917  float startDepth_;
918 
919  private:
920 
922  bool mapToSphere(const QPoint& _p, ACG::Vec3d& _result) const;
923 
925  void handleFirstPersonNavigation( QMouseEvent* _event);
926 
928  void handleNormalNavigation( QMouseEvent* _event);
929 
930 
931  // mouse interaction
935 
936  // animation stuff
941  QTimer* timer_;
943 
944  QTimer clickTimer_;
945  QTime clickTime_;
946  QMouseEvent clickEvent_;
947 
948 
951  //===========================================================================
954  //===========================================================================
955 
956  public:
958  Viewer::ViewerProperties* properties() { return &properties_; };
959  const Viewer::ViewerProperties* properties() const { return &properties_; };
960 
961  private:
963  Viewer::ViewerProperties& properties_;
964 
967 
970 
971  private slots:
975  void slotPropertiesUpdated();
976 
977  private:
981  void applyProperties();
982 
985  //===========================================================================
988  //===========================================================================
989  public slots:
990 
998  virtual void flyTo(const QPoint& _pos, bool _moveBack);
999 
1005  virtual void flyTo(const QPoint& _pos) { flyTo(_pos,false); }
1006 
1007 
1013  virtual void flyFrom(const QPoint& _pos) { flyTo(_pos,true); }
1014 
1020  virtual void flyTo(const ACG::Vec3d& _position,
1021  const ACG::Vec3d& _center,
1022  int _time = 1000);
1023 
1024  private:
1025 
1027  QPropertyAnimation* flyAnimationPerspective_;
1028  QPropertyAnimation* flyAnimationOrthogonal_;
1029 
1032 
1035 
1037  double flyAngle_;
1038 
1041 
1042  Q_PROPERTY(double currentAnimationPosition READ currentAnimationPos WRITE currentAnimationPos NOTIFY currentAnimationPosChanged)
1043 
1044 
1045  double currentAnimationPos_;
1046 
1048  double currentAnimationPos() {return currentAnimationPos_;};
1049 
1051  void currentAnimationPos(double _currentAnimationPos) {currentAnimationPos_ = _currentAnimationPos; emit currentAnimationPosChanged(_currentAnimationPos); };
1052 
1054  ACG::Vec3d flyCenter_;
1055 
1058 
1061 
1064 
1065  signals:
1067  void currentAnimationPosChanged(double _currentAnimationPos);
1068 
1069  private slots:
1071  void flyAnimationPerspective(QVariant _pos);
1072 
1074  void flyAnimationOrthogonal(QVariant _pos);
1075 
1077  void flyAnimationPerspectiveFinished();
1078 
1080  void flyAnimationOrthogonalFinished();
1081 
1086  //===========================================================================
1089  //===========================================================================
1090 
1091 private:
1092 
1101  void computeProjStereo(int _width, int _height,
1102  Viewer::ViewerProperties& _properties,
1103  ACG::GLMatrixd* _outLeft, ACG::GLMatrixd* _outRight);
1104 
1108  //===========================================================================
1111  //===========================================================================
1112 
1113 private:
1114 
1115 
1118 
1119 
1122 };
1123 
1124 
1125 //=============================================================================
1126 //=============================================================================
1127 #endif // BASEVIEWER_HH defined
1128 //=============================================================================
ACG::Vec3d flyPosition_
The new position after the flyTo animation.
PostProcessing * postproc_
Post-Processing executor.
const ACG::Vec3d trackBallCenter()
Get Trackball Center point of scene.
Namespace providing different geometric functions concerning angles.
Definition: DBSCANT.cc:51
bool flyMoveBack_
Flag for fly in orthogonal mode if we move back or forward.
bool initialized_
Have the viewer gl properties been initalized.
ACG::Vec3d lastRotationAxis_
mouse interaction position
PickTarget
What target to use for picking.
Definition: BaseNode.hh:99
ACG::Vec3d lastPoint3D_
mouse interaction position
void setSceneRadius(double _radius)
double scene_radius() const
virtual void keyPressEvent(QKeyEvent *_event)
Get keyPress events from the glArea.
NavigationMode
Navigation mode.
double lastAnimationPos_
The last position of the animation to compute the difference vector.
QPoint lastPoint2D_
mouse interaction position
double lastRotationAngle_
mouse interaction position
QPropertyAnimation * flyAnimationPerspective_
The animation object for flyTo.
QGLFramebufferObjectFormat QFramebufferObjectFormat
Framebuffer object that holds the pick cache.
virtual void cleanupEventFilter()
correct ??? (same function as in qt src)
ProjectionMode projectionMode() const
get current projection mode
NavigationMode navigationMode() const
get current navigation mode
double far_plane() const
Returns a peanut butter sandwich.
ACG::Vec3d unproject(const ACG::Vec3d &pt)
Framebuffer object that holds the pick cache.
void disallowConstrainedRotation()
mouse interaction position
const ACG::Vec3d & getConstrainedRotationAxis()
mouse interaction position
void setTrackBallCenter(const ACG::Vec3d &_center)
Set Trackball Center point of scene.
double flyAngle_
The rotation angle (full angle) for fly to animation.
ACG::SceneGraph::PickTarget pickCacheTarget_
Pick target stored in pick cache.
bool allowRotation()
mouse interaction position
QTimer clickTimer_
mouse interaction position
ACG::Vec3d flyTranslation_
Full translation between start and ed of animation.
const ACG::Vec3d scene_center() const
void allowRotation(bool _mode)
Lock scene rotation.
virtual void keyReleaseEvent(QKeyEvent *_event)
Get keyRelease events from the glArea.
QGLFramebufferObject QFramebufferObject
Framebuffer object that holds the pick cache.
virtual void flyFrom(const QPoint &_pos)
Animated flight.
void allowConstrainedRotation(const ACG::Vec3d &axis)
mouse interaction position
virtual bool viewKeyPressEvent(QKeyEvent *)
Handle key events in view mode.
ACG::Vec3d flyAxis_
The rotation axis for fly to animation.
ACG::Vec3d constrainedRotationAxis_
mouse interaction position
NormalsMode normalsMode() const
get treatment of normals
NormalsMode
Automatically normalize normals?
bool lastPoint_hitSphere_
mouse interaction position
QMouseEvent clickEvent_
mouse interaction position
QTime lastMoveTime_
mouse interaction position
ProjectionMode
projection mode
bool pickCacheSupported_
Is pick caching supported.
ACG::GLState * glstate_
Gl State.
#define DLLEXPORT
double aspect_ratio() const
Returns the viewer's aspect ratio.
QFramebufferObject * pickCache_
Framebuffer object that holds the pick cache.
float startDepth_
mouse interaction depth
bool allowConstrainedRotation()
mouse interaction position
void lockProjectionUpdate(void)
Lock update of projection matrix.
double near_plane() const
Returns a chili cheese burger.
Viewer::ViewerProperties * properties()
Returns a pointer to the Viewer Status.
QTimer * timer_
mouse interaction position
bool updatePickCache_
Should the pick cache be updated.
void rotate(const ACG::Vec3d &axis, double angle)
rotate the scene (around its center) and update modelview matrix
bool allowRotation_
mouse interaction position
void copyToImage(QImage &_image, GLenum _buffer=GL_BACK)
copy current framebuffer to an QImage
QPropertyAnimation * flyAnimationOrthogonal_
The animation object for flyTo.
virtual void flyTo(const QPoint &_pos)
Animated flight.
void setSceneCenter(const ACG::Vec3d &_center)
double ortho_width() const
Get width of the gl scene in orthogonal projection mode.
double fovyModifier_
mouse interaction position
void unlockProjectionUpdate(void)
Unlock update of projection matrix.
void invalidatePickCache()
mouse interaction position
QTime clickTime_
mouse interaction position
use provided normals as is
double flyOrthoWidthOriginal_
Original orthogonal width during flyTo in orthogonal mode.