glarea.h
Go to the documentation of this file.
00001 /****************************************************************************
00002  * VCGLib                                                            o o     *
00003  * Visual and Computer Graphics Library                            o     o   *
00004  *                                                                _   O  _   *
00005  * Copyright(C) 2007                                                \/)\/    *
00006  * Visual Computing Lab                                            /\/|      *
00007  * ISTI - Italian National Research Council                           |      *
00008  *                                                                    \      *
00009  * All rights reserved.                                                      *
00010  *                                                                           *
00011  * This program is free software; you can redistribute it and/or modify      *   
00012  * it under the terms of the GNU General Public License as published by      *
00013  * the Free Software Foundation; either version 2 of the License, or         *
00014  * (at your option) any later version.                                       *
00015  *                                                                           *
00016  * This program is distributed in the hope that it will be useful,           *
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
00019  * GNU General Public License (http://www.gnu.org/licenses/gpl.txt)          *
00020  * for more details.                                                         *
00021  *                                                                           *
00022  ****************************************************************************/
00023 /****************************************************************************
00024   History
00025 
00026 $Log: not supported by cvs2svn $
00027 Revision 1.1  2007/10/18 08:52:06  benedetti
00028 Initial release.
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 /*GLAREA_H_ */


shape_reconstruction
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:31:26