Developer Documentation
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 
45 
46 //=============================================================================
47 //
48 // CLASS QtBaseViewer
49 //
50 //=============================================================================
51 
52 #ifndef ACG_QTBASEVIEWER_HH
53 #define ACG_QTBASEVIEWER_HH
54 
55 //== INCLUDES =================================================================
56 
57 
58 #include "../Scenegraph/DrawModes.hh"
59 #include "../Config/ACGDefines.hh"
60 #include "../Math/VectorT.hh"
61 #include "../Math/GLMatrixT.hh"
62 #include "../Scenegraph/PickTarget.hh"
63 #include "../GL/gl.hh"
64 
65 #include <QBoxLayout>
66 #include <QtNetwork/QUdpSocket>
67 #include <QWheelEvent>
68 #include <QKeyEvent>
69 #include <QDropEvent>
70 #include <QContextMenuEvent>
71 #include <QDragEnterEvent>
72 #include <QMouseEvent>
73 #include <QAction>
74 #include <QSize>
75 #include <QMap>
76 #include <QString>
77 #include <QMenu>
78 #include <QToolBar>
79 #include <QElapsedTimer>
80 
81 #include <vector>
82 #include <string>
83 
84 
85 //== FORWARDDECLARATIONS ======================================================
86 
87 
88 class QPushButton;
89 class QToolButton;
90 class QStatusBar;
91 class QSplitter;
92 class QElapsedTimer;
93 class QImage;
94 class QSocketNotifier;
95 class QGraphicsWidget;
96 class QGraphicsGridLayout;
97 class QGLFormat;
98 class QGLWidget;
99 
100 //== NAMESPACES ===============================================================
101 
102 namespace ACG {
103 class GLState;
104 namespace SceneGraph {
105 class BaseNode;
106 }
107 namespace QtWidgets {
108 
109 
110 //== FORWARDDECLARATIONS ======================================================
111 
112 
113 class QtWheel;
114 class QtGLGraphicsScene;
115 class QtGLGraphicsView;
116 class QtSceneGraphDialog;
117 class QtShiftPopupMenu;
118 
119 //== CLASS DEFINITION =========================================================
120 
121 
129 class ACGDLLEXPORT QtBaseViewer : public QWidget
130 {
131 Q_OBJECT
132 
133 //-------------------------------------------------------------- public methods
134 public:
135 
139  enum Options {
141  Nothing=0,
142 
149  ShowPrivateStatusBar=1,
150 
160  ShowToolBar=2,
161 
163  ShowPickButton=4,
165  ShowLassoButton=8,
167  ShowQuestionButton=0x10,
168 
170  ShowWheelX=0x20,
172  ShowWheelY=0x40,
176  ShowWheelZ=0x80,
177 
179  ShowWheels=0xe0,
180 
182  DefaultOptions = 0xffff & (~ShowPrivateStatusBar)
183  };
184 
185 
186 
187 
188  //--------------------------------------------------- constructor / destructor
189 
199  QtBaseViewer( QWidget* _parent=0,
200  const char* _name=0,
201  QStatusBar *_statusBar=0,
202  const QGLFormat* _format=0,
203  const QtBaseViewer* _share=0,
204  Options _options=DefaultOptions );
205 
207  virtual ~QtBaseViewer();
208 
209 
210 
211 
212 
213  //------------------------------------------------------------- public methods
214 
215  virtual QSize sizeHint () const;
216 
218  QStatusBar* statusBar() { return statusbar_; }
227  void setStatusBar(QStatusBar* _sb);
228 
230  void applyOptions(int _options);
232  int options() const { return options_; }
233 
234 
236  virtual void makeCurrent();
238  virtual void swapBuffers();
239 
240 
242  GLState& glState() { return *glstate_; }
243 
244 
248  void backgroundColor(const Vec4f& _color);
250  Vec4f backgroundColor();
251 
252 
258  virtual void lockUpdate();
260  virtual void unlockUpdate();
265  virtual void unlockAndUpdate();
268  bool isUpdateLocked() const { return updateLocked_; }
269 
270 
272  void lockProjectionUpdate( void ) { projectionUpdateLocked_ = true; }
273 
275  void unlockProjectionUpdate( void ) { projectionUpdateLocked_ = false; }
276 
278  bool animation() const { return animation_; }
280  void animation(bool _b);
281 
283  void trackMouse(bool _track);
284 
286  void enablePopupMenu(bool _enable);
287 
288 
289 
290 
291 
292 
294  SceneGraph::BaseNode* sceneGraph() { return sceneGraphRoot_; }
296  const SceneGraph::BaseNode* sceneGraph() const { return sceneGraphRoot_; }
306  void sceneGraph(SceneGraph::BaseNode* _root);
307 
311  FIRSTPERSON_NAVIGATION
312  };
313 
317  PERSPECTIVE_PROJECTION
318  };
319 
321  void projectionMode(ProjectionMode _p);
323  ProjectionMode projectionMode() const { return projectionMode_; }
324 
326  void navigationMode(NavigationMode _n);
328  NavigationMode navigationMode() const { return navigationMode_; }
329 
334  void setScenePos( const ACG::Vec3d& _center, double _radius, const bool _setCenter = true );
335 
339  void setSceneCenter( const ACG::Vec3d& _center );
340 
344  const ACG::Vec3d& scene_center() const { return scene_center_; }
348  double scene_radius() const { return scene_radius_; }
349 
350  void setSceneRadius(double radius) { scene_radius_ = radius; }
351 
353  void viewingDirection( const ACG::Vec3d& _dir, const ACG::Vec3d& _up );
354 
356  void setFovy( double _fovy );
357 
359  enum ActionMode {
360  // examine geometry, get transformations from mouse events
361  ExamineMode,
366  // same as picking, but emit signalMouseEventIdentify()
367  QuestionMode,
368  // Ligh rotation mode
369  LightMode
370  };
371 
372 
378  void actionMode(ActionMode);
379 
381  ActionMode lastActionMode(){ return lastActionMode_; };
382 
384  ActionMode actionMode() const { return actionMode_; }
385 
386 
390  CW_ORIENTATION
391  };
392 
394  void faceOrientation(FaceOrientation);
396  FaceOrientation faceOrientation() const { return faceOrientation_; }
397 
399  void backFaceCulling( bool _b );
401  bool backFaceCulling() const { return backFaceCulling_; }
402 
404  void twoSidedLighting( bool _b );
406  bool twoSidedLighting() const { return twoSidedLighting_; }
407 
409  enum NormalsMode {
416  NORMALIZE_NORMALS
417  };
418 
420  void normalsMode(NormalsMode _mode);
422  NormalsMode normalsMode() const { return normalsMode_; }
423 
424 
426  GLMatrixd& light_matrix() { return light_matrix_; }
428  void rotate_lights(Vec3d& _axis, double _angle);
430  void update_lights();
431 
432 
434  void copyToImage( QImage& _image, GLenum _buffer=GL_BACK) {
435  copyToImage(_image, 0, 0, glWidth(), glHeight(), _buffer);
436  }
437 
439  void copyToImage( QImage& _image,
440  unsigned int _left, unsigned int _top,
441  unsigned int _width, unsigned int _height,
442  GLenum _buffer );
443 
444 
446  unsigned int glWidth() const;
448  unsigned int glHeight() const;
450  QSize glSize() const;
452  QPoint glMapFromGlobal( const QPoint& _pos ) const;
454  QPoint glMapToGlobal( const QPoint& _pos ) const;
455 
456 
459  {
460  curDrawMode_=_mode;
461  updatePopupMenu();
462  }
463 
466 
468  void encodeView(QString& _view);
473  bool decodeView(const QString& _view);
474 
476  void initModelviewMatrix();
477 
478  // get all Mouse & Key Events for GlWidget
479  void grabGLArea();
480 
481  // undo grabbing GLArea
482  void releaseGLArea();
483 
485  void drawBlendedObjects(bool _status) { blending_ = _status; }
486 
488  void translate(const Vec3d& trans);
489 
491  void rotate(const Vec3d& axis, double angle)
492  { rotate(axis, angle, trackball_center_); }
493 
495  void rotate(const Vec3d& axis, double angle, const Vec3d& _center);
496 
498  QMenu * getPickMenu() { return pickMenu_; };
499  QMenu * getFuncMenu() { return funcMenu_; };
500  QMenu * getDrawMenu() { return drawMenu_; };
501 
503  QToolBar* getToolBar();
504 
506  QToolBar* removeToolBar();
507 
509  void moveForward();
510 
512  void moveBack();
513 
515  void strafeLeft();
516 
518  void strafeRight();
519 
520 //---------------------------------------------------------------- public slots
521 public slots:
522 
528  virtual void drawNow();
530  virtual void updateGL();
531 
533  virtual void setHome();
535  virtual void home();
537  virtual void viewAll();
539  virtual void flyTo(const QPoint& _pos, bool _move_back);
541  virtual void flyTo(const QPoint& _pos) { flyTo(_pos,false); }
543  virtual void flyFrom(const QPoint& _pos) { flyTo(_pos,true); }
544 
550  virtual void flyTo(const Vec3d& _position,
551  const Vec3d& _center,
552  double _time = 1000.0);
553 
555  virtual void examineMode() { actionMode(ExamineMode); }
557  virtual void lightMode() { actionMode(LightMode); }
559  virtual void questionMode() { actionMode(QuestionMode); }
560 
562  virtual void perspectiveProjection();
564  virtual void orthographicProjection();
566  virtual void toggleProjectionMode();
568  virtual void toggleNavigationMode();
569 
570  signals:
571 
572  void projectionModeChanged( bool _ortho );
573  void navigationModeChanged( bool _normal );
574 
575  public slots:
576 
578  virtual void showSceneGraphDialog();
579 
581  virtual void setView( const GLMatrixd& _modelview,
582  const GLMatrixd& _inverse_modelview );
583 
584  void actionBackground();
585  void actionCopyView();
586  void actionPasteView();
587  void actionPasteDropSize();
588  void actionSynchronize();
589  void actionAnimation();
590  void actionBackfaceCulling();
591  void actionTwoSidedLighting();
592  void actionSynchronize(bool _enable);
593  void actionAnimation(bool _enable);
594  void actionBackfaceCulling(bool _enable);
595  void actionTwoSidedLighting(bool _enable);
596 
597  void actionDrawMenu( QAction * _action );
598  void actionPickMenu( QAction * _action );
599 
600 
601 
602 
603 //-------------------------------------------------------------- public signals
604 signals:
605 
607  void signalInitializeGL();
608 
619  void signalMouseEvent(QMouseEvent*, const std::string&);
620 
622  void signalMouseEvent(QMouseEvent*);
623 
625  void signalWheelEvent(QWheelEvent*, const std::string&);
626 
630  void signalMouseEventIdentify( QMouseEvent* );
631 
632 
634  void signalSetView( const GLMatrixd& _modelview,
635  const GLMatrixd& _inverse_modelview );
637  void signalSceneGraphChanged(ACG::SceneGraph::BaseNode* _root);
639  void signalNodeChanged(ACG::SceneGraph::BaseNode* _node);
641  void signalActionModeChanged(ACG::QtWidgets::QtBaseViewer::ActionMode _m);
643  void signalDrawScene(ACG::GLState* _state);
644 
645 
646  signals:
647 
652  void signalCustomContextMenuRequested ( const QPoint & );
653 
654 
655 //----------------------------------------------------------- protected methods
656 protected:
657 
658  friend class QtGLGraphicsScene;
659  friend class QtGLGraphicsView;
660 
662  virtual void initializeGL();
664  virtual void paintGL();
666  virtual void resizeGL(int _w, int _h);
667 
668 
670  virtual void glMousePressEvent(QMouseEvent* _event);
672  virtual void glMouseDoubleClickEvent(QMouseEvent* _event);
674  virtual void glMouseMoveEvent(QMouseEvent* _event);
676  virtual void glMouseReleaseEvent(QMouseEvent* _event);
678  virtual void glMouseWheelEvent(QWheelEvent* _event);
680  virtual void glContextMenuEvent(QContextMenuEvent* _event);
681 
682 
684  virtual void viewMouseEvent( QMouseEvent* _event) = 0;
686  virtual void viewWheelEvent(QWheelEvent* _event) = 0;
687 
689  virtual void lightMouseEvent( QMouseEvent* /* _event */ ) {}
690 
691 
692  protected:
693 
694 
696  void updateProjectionMatrix();
698  void updatePickMenu();
699 
700 
701 
702 //------------------------------------------------------------- protected slots
703 protected slots:
704 
706  virtual void sceneRectChanged(const QRectF & rect);
707 
709  virtual void slotWheelX(double _dAngle);
711  virtual void slotWheelY(double _dAngle);
713  virtual void slotWheelZ(double _dist);
714 
716  virtual void slotNodeChanged(ACG::SceneGraph::BaseNode* _node);
717 
719  virtual void cleanupEventFilter()
720  { removeEventFilter( sender());}
721 
722 
723 
724 //--------------------------------------------------------------- private slots
725 private slots:
726 
727  void hidePopupMenus();
728 
729 //----------------------------------------------------------- private functions
730 private:
731 
732  // IDs for \c funcMenu_
733  enum FuncMenuID {
734  M_CopyView=0x100,
735  M_PasteView,
736  M_PasteDropSize,
737  M_Animation,
738  M_BackfaceCulling,
739  M_TwoSidedLighting,
740  M_Background,
741  M_Snapshot,
742  M_SnapshotName,
743  M_SnapshotSavesView,
744  M_Synchronize
745  };
746 
748  QtBaseViewer(const QtBaseViewer&);
750  QtBaseViewer& operator=(const QtBaseViewer&);
751 
752  // create widgets
753  void createWidgets(const QGLFormat* _format,QStatusBar* _sb,
754  const QtBaseViewer* _share);
755 
756  /* Recursively draws each node in the scene graph.
757  Called by paintGL(). */
758  void drawScene();
759  // helper called by drawScene().
760  void drawScene_mono();
761  // helper called by drawScene() when stereo viewing is active.
762  void drawScene_stereo();
763 
764  // helper to check openGL support
765  bool hasOpenGL();
766 
767  // updates popup menu with the available draw modes
768  void updatePopupMenu();
769 
770 //-------------------------------------------------------------- protected data
771 protected:
772 
773 
774  // scene center and radius
775  Vec3d scene_center_, trackball_center_;
776  double scene_radius_, trackball_radius_;
777 
778 
779  // projection stuff
780  GLdouble orthoWidth_;
781  GLdouble near_, far_, fovy_;
782 
783 
784  // scenegraph
785  GLState *glstate_;
786 
787 
788  // helper
789  bool isRotating_;
790 
791 
792  // current status bar, guaranteed to be !=0
793  QStatusBar* statusbar_;
794 
795 
796 
797 //---------------------------------------------------------------- private data
798 private:
799 
800 
801  // data stored for home view
802  Vec3d home_center_;
803  double home_radius_;
804  GLMatrixd home_modelview_,
805  home_inverse_modelview_;
806  double homeOrthoWidth_;
807 
808 
809  // matrix for rotating light position
810  GLMatrixd light_matrix_;
811 
812 
813  // modi
814  NormalsMode normalsMode_;
815  FaceOrientation faceOrientation_;
816  ProjectionMode projectionMode_;
817  NavigationMode navigationMode_;
818 
819  ActionMode actionMode_, lastActionMode_;
820  bool backFaceCulling_;
821  bool twoSidedLighting_;
822  bool animation_;
823 
824  // helper
825  bool trackMouse_;
826  bool popupEnabled_;
827  bool glareaGrabbed_;
828  double frame_time_;
829 
830 
831  QMenu * pickMenu_;
832  QMenu * funcMenu_;
833  QMenu * drawMenu_;
834 
835  // scenegraph stuff
836  SceneGraph::BaseNode* sceneGraphRoot_;
837 
839  availDrawModes_;
840 
841  bool updateLocked_;
842  bool projectionUpdateLocked_;
843  bool blending_;
844 
845 
846  // widget showing the scenegraph
847  QtSceneGraphDialog* sceneGraphDialog_;
848 
849 
850 
851  // options
852  Options options_;
853  // gl widget used as drawing area to paint the graphics scene
854  QGLWidget* glWidget_;
855  // graphics scene used to paint gl context and widgets
856  QtGLGraphicsScene* glScene_;
857  // graphics view that holds the gl scene
858  QtGLGraphicsView* glView_;
859 
860  // Base graphics widget for wheels in the scene
861  QGraphicsWidget* glBase_;
862  // Base graphics widget layout
863  QGraphicsGridLayout* glBaseLayout_;
864 
865  // private status bar, 0 if status bar is provided externally
866  QStatusBar* privateStatusBar_;
867 
868  // Layout for the basic widget ( viewer + wheels )
869  QGridLayout* glLayout_;
870 
871  // tool bar
872  QToolBar * buttonBar_;
873 
874  // set pick mode
875  QToolButton* pickButton_;
876  // set move mode
877  QToolButton* moveButton_;
878  // set light mode
879  QToolButton* lightButton_;
880  // set question mode
881  QToolButton* questionButton_;
882  // change projection mode (perspective/orthographic)
883  QToolButton* projectionButton_;
884  // go to home() position
885  QToolButton* homeButton_;
886  // setHome()
887  QToolButton* setHomeButton_;
888  // viewAll()
889  QToolButton* viewAllButton_;
890  // show sceneGraphDialog_
891  QToolButton* sceneGraphButton_;
892  // enable/disable stereo viewing
893  QToolButton* stereoButton_;
894 
895  // rotate around x-axis
896  QtWheel* wheelX_;
897  // rotate around y-axis
898  QtWheel* wheelY_;
899  // translate along z-axis
900  QtWheel* wheelZ_;
901 
902  // all actions
903  QMap< QString, QAction * > action_;
904 
905  // vector of current draw mode actions
906  std::vector< QAction * > drawMenuActions_;
907 
908  // Used to calculate the time passed between redraws
909  QElapsedTimer redrawTime_;
910 
911  //===========================================================================
914  //===========================================================================
915  signals:
917  void viewUpdated();
918 
920  void viewChanged();
921 
924  //===========================================================================
927  //===========================================================================
928 
929  public slots:
930 
932  virtual void toggleStereoMode();
933 
935  virtual void setStereoMode(bool _b);
936 
937  public:
942  void setEyeDistance(double _distance);
943 
945  double eyeDistance( );
946 
951  void setFocalDistance(double _distance);
952 
954  double focalDistance( );
955 
956  private:
957  // stereo stuff
958  bool stereo_;
959  double eyeDist_, focalDist_;
960 
961 
965  //===========================================================================
968  //===========================================================================
969 
970  signals:
977  void signalKeyPressEvent(QKeyEvent*);
978 
979  public:
985  void disableKeyHandling(bool _state );
986 
990  bool keyHandlingState();
991 
992  protected:
993 
998  virtual void glKeyPressEvent(QKeyEvent*);
999 
1006  virtual void glKeyReleaseEvent(QKeyEvent* _event);
1007 
1015  virtual bool viewKeyPressEvent(QKeyEvent* _event) = 0;
1016 
1017  private:
1019 
1022  //===========================================================================
1025  //===========================================================================
1026 
1027  protected:
1028 
1030  virtual void startDrag();
1032  virtual void glDragEnterEvent(QDragEnterEvent* _event);
1034  virtual void glDropEvent(QDropEvent* _event);
1035 
1036  public:
1038  void setExternalDrag( bool _external ) { externalDrag_ = _external; };
1039 
1040  signals:
1044  void startDragEvent( QMouseEvent* _event );
1045 
1049  void dragEnterEvent(QDragEnterEvent* _event);
1050 
1054  void dropEvent( QDropEvent* _event );
1055 
1056  private:
1057 
1062 
1066  //===========================================================================
1069  //===========================================================================
1070 
1071  public:
1076  void sync_connect(const QtBaseViewer*);
1077 
1079  void sync_disconnect(const QtBaseViewer*);
1080 
1082  virtual void setSynchronization(bool _b);
1083 
1085  bool add_sync_host(const QString& _name);
1087  void add_sync_host(QHostAddress& _adr);
1088 
1089  bool synchronization();
1090 
1091  private slots:
1092 
1093  void sync_receive();
1094  void sync_send(const GLMatrixd& _modelview,
1095  const GLMatrixd& _inverse_modelview);
1096 
1097  private:
1100 
1103 
1105  QUdpSocket * socket_;
1106 
1108  std::vector<QHostAddress> sync_hosts_;
1109 
1112  //===========================================================================
1115  //===========================================================================
1116 
1117  public slots:
1129  virtual void snapshotBaseFileName(const QString& _fname);
1130 
1135  virtual void snapshot();
1136 
1139  void actionSnapshot();
1140 
1143  void actionSnapshotName();
1144 
1147  void actionSnapshotSavesView();
1148 
1149  private:
1150 
1151  QString snapshotName_;
1153  QImage* snapshot_;
1154 
1157  //===========================================================================
1160  //===========================================================================
1161  public:
1175  bool pick( SceneGraph::PickTarget _pickTarget,
1176  const QPoint& _mousePos,
1177  unsigned int& _nodeIdx,
1178  unsigned int& _targetIdx,
1179  Vec3d* _hitPointPtr=0 );
1180 
1186  bool fast_pick( const QPoint& _mousePos,
1187  Vec3d& _hitPoint );
1188 
1197  void addPickMode(const std::string& _name,
1198  bool _mouse_tracking = false,
1199  int _pos = -1,
1200  bool _visible = true,
1201  QCursor _cursor = Qt::ArrowCursor );
1202 
1205  void clearPickModes();
1206 
1209  const std::string& pickMode() const;
1210 
1214  void pickMode(const std::string& _name);
1215 
1219  void pickMode( int _id );
1220 
1225  void renderPicking(bool _renderPicking, ACG::SceneGraph::PickTarget _mode);
1226 
1227  public slots:
1228 
1232  virtual void pickingMode();
1233 
1239  void setPickModeCursor(const std::string& _name, QCursor _cursor);
1240 
1246  void setPickModeMouseTracking(const std::string& _name, bool _mouseTracking);
1247 
1248  signals:
1251  void signalPickModeChanged(const std::string&);
1252 
1253  private:
1254 
1257  struct PickMode
1258  {
1260  PickMode(const std::string& _n, bool _t, bool _v, QCursor _c) :
1261  name(_n), tracking(_t), visible(_v), cursor(_c) {}
1262 
1265  std::string name;
1266 
1269  bool tracking;
1270 
1273  bool visible;
1274 
1277  QCursor cursor;
1278  };
1279 
1282  std::vector<PickMode> pick_modes_;
1283 
1286  std::string pick_mode_name_;
1287 
1291 
1295 
1301 
1303 };
1304 
1305 
1306 //=============================================================================
1307 } // namespace QtWidgets
1308 } // namespace ACG
1309 //=============================================================================
1310 #endif // ACG_QTBASEVIEWER_HH defined
1311 //=============================================================================
void setExternalDrag(bool _external)
Enable or disable external dragging controls.
ACG::SceneGraph::DrawModes::DrawMode drawMode()
get current draw mode
virtual void examineMode()
calls actionMode() with ExamineMode (cf. ActionMode)
ProjectionMode projectionMode() const
get current projection mode
Namespace providing different geometric functions concerning angles.
void lockProjectionUpdate(void)
Lock update of projection matrix.
void unlockProjectionUpdate(void)
Unlock update of projection matrix.
GLState & glState()
get OpenGL state
virtual void cleanupEventFilter()
correct ??? (same function as in qt src)
bool disableKeyHandling_
Enable or disable internal Key handling.
FaceOrientation
orientation of the faces
bool animation() const
Is animation enabled?
std::vector< QHostAddress > sync_hosts_
List of hosts which should receive sync information.
GLMatrixd & light_matrix()
get light rotation matrix
virtual void lightMode()
calls actionMode() with LightMode (cf. ActionMode)
NavigationMode navigationMode() const
get current navigation mode
ACG::SceneGraph::PickTarget pickRendererMode_
double focalDist_
Set eye distance for stereo.
FaceOrientation faceOrientation() const
get face orientation
void rotate(const Vec3d &axis, double angle)
rotate the scene (around its center) and update modelview matrix
PickTarget
What target to use for picking.
Definition: PickTarget.hh:73
void copyToImage(QImage &_image, GLenum _buffer=GL_BACK)
copy current framebuffer to an QImage
bool backFaceCulling() const
is backface culling enabled?
NormalsMode normalsMode() const
get treatment of normals
ActionMode lastActionMode()
Return the last action mode.
NormalsMode
Automatically normalize normals?
bool synchronized_
synchronized with different viewer?
ActionMode
How to react on mouse events?
bool skipNextSync_
Skips the next synch event.
std::vector< PickMode > pick_modes_
SceneGraph::BaseNode * sceneGraph()
Returns: root node of scene graph.
QStatusBar * statusBar()
get status bar, guaranteed to be not 0 (QStatusBar may be invisible)
NavigationMode
Navigation mode.
const SceneGraph::BaseNode * sceneGraph() const
same but const
int options() const
get current ORed Options
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
ActionMode actionMode() const
get action mode
virtual void questionMode()
calls actionMode() with QuestionMode (cf. ActionMode)
const ACG::Vec3d & scene_center() const
virtual void flyFrom(const QPoint &_pos)
Fly to, get more distant.
QUdpSocket * socket_
socket used for synchronization
QMenu * getPickMenu()
Get the menu pointers (required to add them to the menubar as a temp workaround for a qt 4...
bool stereo_
Set eye distance for stereo.
virtual void lightMouseEvent(QMouseEvent *)
optional: hande mouse events to rotate light
bool twoSidedLighting() const
is 2-sided lighing enabled?
ProjectionMode
projection mode
void drawBlendedObjects(bool _status)
One or two pass Drawing.
PickMode(const std::string &_n, bool _t, bool _v, QCursor _c)
Constructor.
virtual void flyTo(const QPoint &_pos)
Fly to, get closer.