00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #ifndef QVGLCANVAS_H
00026 #define QVGLCANVAS_H
00027
00028 #include <QVWorker>
00029 #include <QVMatrix>
00030 #include <QVQuaternion>
00031
00032 #include <qvgui/qv3dmodel.h>
00033
00034 #ifndef DOXYGEN_IGNORE_THIS
00035
00064 class QVGLCanvas : public QGLWidget, public QVPropertyContainer
00065 {
00066 Q_OBJECT
00067
00068 public:
00069 QVGLCanvas(const QString &title, QWidget* parent = 0);
00070 ~QVGLCanvas ();
00071
00072 virtual void init() {};
00073 virtual void display() {};
00074 virtual void reshape(int w, int h) {};
00075
00076 void linkModelMatrix(QVWorker &worker, const QString &matrixPropertyName, const QString &objectName);
00077 void add(const QV3DModel &model, const QString &name);
00078 GLuint bindTexture(const QVImage<uChar,3> &image, GLenum target = GL_TEXTURE_2D);
00079
00080
00081
00082 signals:
00083 void closed();
00084
00085 protected:
00086
00087 void initializeGL();
00088 void paintGL();
00089 void resizeGL(int w, int h );
00090
00091 void drawModels();
00092
00093 void mousePressEvent(QMouseEvent * event);
00094 void mouseReleaseEvent(QMouseEvent *event);
00095 void mouseMoveEvent(QMouseEvent *event);
00096 void wheelEvent(QWheelEvent *event);
00097 void keyPressEvent(QKeyEvent *event);
00098
00099 void closeEvent(QCloseEvent * event);
00100
00101 int beginx, beginy;
00102 QVQuaternion trackballQuat;
00103 double zoom;
00104 bool pressedleft,pressedright;
00105 double maxwide;
00106 double cx,cy,cz;
00107 };
00108
00109 #endif
00110 #endif