Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef GLAREA_H_
00034 #define GLAREA_H_
00035
00037 #include <GL/glew.h>
00038 #include <QGLWidget>
00039
00041 #include <vcg/complex/complex.h>
00042 #include <vcg/complex/algorithms/update/bounding.h>
00043 #include <vcg/complex/algorithms/update/normal.h>
00044 #include <vcg/complex/algorithms/create/platonic.h>
00045
00047 #include <wrap/io_trimesh/import.h>
00048 #include <wrap/gl/trimesh.h>
00049 #include <wrap/gui/trackball.h>
00050
00052
00053 using namespace vcg;
00054 class CFace;
00055 class CVertex;
00056
00057 struct MyUsedTypes : public UsedTypes< Use<CVertex> ::AsVertexType,
00058 Use<CFace> ::AsFaceType>{};
00059
00061 class CVertex : public vcg::Vertex< MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags>{};
00062 class CFace : public vcg::Face< MyUsedTypes, vcg::face::VertexRef, vcg::face::Normal3f, vcg::face::BitFlags > {};
00063 class CMesh : public vcg::tri::TriMesh< std::vector<CVertex>, std::vector<CFace> > {};
00064
00065 class GLArea:public QGLWidget
00066 {
00067 Q_OBJECT
00068 public:
00069 GLArea (QWidget * parent = 0);
00071 enum DrawMode{SMOOTH=0,POINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
00072 public slots:
00074 void selectDrawMode(int mode);
00075 void loadMesh(QString filename);
00076 void loadTetrahedron();
00077 void loadDodecahedron();
00078 signals:
00080 void setStatusBar(QString message);
00081 protected:
00083 void initializeGL ();
00084 void resizeGL (int w, int h);
00085 void paintGL ();
00087 void keyReleaseEvent(QKeyEvent * e);
00088 void keyPressEvent(QKeyEvent * e);
00089 void mousePressEvent(QMouseEvent*e);
00090 void mouseMoveEvent(QMouseEvent*e);
00091 void mouseReleaseEvent(QMouseEvent*e);
00092 void wheelEvent(QWheelEvent*e);
00093 private:
00095 CMesh mesh;
00097 vcg::GlTrimesh<CMesh> glWrap;
00099 vcg::Trackball track;
00101 DrawMode drawmode;
00103 void initMesh(QString message);
00104 };
00105
00106 #endif