libmove3d
3.13.0
|
00001 /* 00002 * Header File for the qtOpenGL Widget 00003 */ 00004 00005 #ifndef GLWIDGET_H 00006 #define GLWIDGET_H 00007 00008 #include "Graphic-pkg.h" 00009 00010 #undef Status 00011 #undef Black 00012 #undef Bool 00013 #undef CursorShape 00014 #undef None 00015 #undef KeyPress 00016 #undef KeyRelease 00017 #undef FocusIn 00018 #undef FocusOut 00019 #undef FontChange 00020 #undef Unsorted 00021 00022 #include <QtOpenGL/QGLWidget> 00023 #include <QtCore/QObject> 00024 00025 #include "../../graphic/proto/g3d_newWindow.hpp" 00026 00027 class Move3D2OpenGl; 00028 00029 void qt_get_win_mouse(int* i, int* j); 00030 void qt_ui_calc_param(g3d_cam_param& p); 00031 00036 class GLWidget: public QGLWidget 00037 { 00038 Q_OBJECT 00039 00040 public: 00041 GLWidget(QWidget *parent = 0); 00042 ~GLWidget(); 00043 00044 //void setMainWindow(MainWindow* w) { m_mainWindow = w; } 00045 void setWinSize(double size); 00046 void setWinSize(int x, int y); 00047 void resetImageVector(); 00048 void setThreadWorking(bool isWorking); 00049 void newG3dWindow(); 00050 void initG3DFunctions(); 00051 void setAutoBufferSwapping(bool swapping); 00052 00053 public slots: 00054 void saveView(); 00055 void reinitGraphics(); 00056 00057 void addCurrentImage(); 00058 void saveImagesToDisk(); 00059 00060 signals: 00061 void xRotationChanged(int angle); 00062 void yRotationChanged(int angle); 00063 void zRotationChanged(int angle); 00064 void zoomChanged(int value); 00065 00066 protected: 00067 // OpenGL functions 00068 void initializeGL(); 00069 void paintGL(); // This is called when changing environments. 00070 void resizeGL(int width, int height); 00071 void computeNewVectors(p3d_vector4& Xc,p3d_vector4& Xw,p3d_vector4& up); 00072 00073 // Mouse events 00074 void mousePressEvent(QMouseEvent *event); 00075 void mouseMoveEvent(QMouseEvent *event); 00076 void keyPressEvent(QKeyEvent *e); 00077 void keyReleaseEvent(QKeyEvent *e); 00078 void mouseDoubleClickEvent(QMouseEvent *event); 00079 00080 private: 00081 // Pointer that allows resizing 00082 //MainWindow* m_mainWindow; 00083 00084 // OpenGl variables 00085 GLdouble x,y,z,el,az,zo; 00086 00087 // size of the OpenGl scene 00088 int _w,_h; 00089 double _size; 00090 00091 p3d_vector4 up; 00092 00093 QPoint lastPos; 00094 00095 // Colors for background 00096 QColor trolltechGreen; 00097 QColor trolltechPurple; 00098 QColor trolltechGrey; 00099 QColor trolltechBlack; 00100 QColor trolltechWhite; 00101 00102 bool _light; 00103 bool _watingMouseRelease; 00104 00105 // Do not draw when this 00106 // variable is true 00107 bool _isThreadWorking; 00108 00109 // Vector of recorded images 00110 QVector<QImage*> _pictures; 00111 00112 // Counts the number of draw 00113 int paintNum; 00114 00115 #ifndef WITH_XFORMS 00116 qtG3DWindow* mG3DOld; 00117 #endif 00118 }; 00119 00120 extern int mouse_mode; 00121 00122 #endif