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 <qvcore/qvworker.h>
00029 #include <qvmath/qvmatrix.h>
00030 #include <qvgui/qv3dmodel.h>
00031 #include <qvmath/qvquaternion.h>
00032
00033 #ifndef DOXYGEN_IGNORE_THIS
00034
00063 class QVGLCanvas : public QGLWidget, public QVPropertyContainer
00064 {
00065 Q_OBJECT
00066
00067 public:
00068 QVGLCanvas(const QString &title, QWidget* parent = 0);
00069 ~QVGLCanvas ();
00070
00071 virtual void init() {};
00072 virtual void display() {};
00073 virtual void reshape(int w, int h) {};
00074
00075 void linkModelMatrix(QVWorker &worker, const QString &matrixPropertyName, const QString &objectName);
00076 void add(const QV3DModel &model, const QString &name);
00077 GLuint bindTexture(const QVImage<uChar,3> &image, GLenum target = GL_TEXTURE_2D);
00078
00079
00080
00081 signals:
00082 void closed();
00083
00084 protected:
00085
00086 void initializeGL();
00087 void paintGL();
00088 void resizeGL(int w, int h );
00089
00090 void drawModels();
00091
00092 void mousePressEvent(QMouseEvent * event);
00093 void mouseReleaseEvent(QMouseEvent *event);
00094 void mouseMoveEvent(QMouseEvent *event);
00095 void wheelEvent(QWheelEvent *event);
00096 void keyPressEvent(QKeyEvent *event);
00097
00098 void closeEvent(QCloseEvent * event);
00099
00100 int beginx, beginy;
00101 QVQuaternion trackballQuat;
00102 double zoom;
00103 bool pressedleft,pressedright;
00104 double maxwide;
00105 double cx,cy,cz;
00106 };
00107
00108 #endif
00109 #endif