00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __BASEVIEWER_H__
00020 #define __BASEVIEWER_H__
00021
00022 #include <QtGui/QtGui>
00023 #include <QGLWidget>
00024 #include <QGLViewer/qglviewer.h>
00025
00026 #include "../lib/utils/utils.h"
00027 #include "../lib/math/math.h"
00028 #include "../lib/mesh/mesh.h"
00029
00030 namespace ViewerNS {
00031
00032 typedef MeshNS::Polyhedron Polyhedron;
00033
00044 class BaseViewer: public QGLViewer {
00045 Q_OBJECT
00046
00047 public:
00052 BaseViewer(QWidget* parent = 0);
00053 virtual ~BaseViewer() {
00054 makeCurrent();
00055 }
00056
00061 virtual void displayMesh(const MeshNS::Polyhedron& polyhedron);
00062
00063 public slots:
00067 void invertSmooth() {
00068 if (_renderMode == MeshNS::smooth)
00069 _renderMode = MeshNS::wire;
00070 else
00071 _renderMode = MeshNS::smooth;
00072 updateGL();
00073 }
00074
00078 void swapSnapshot() {
00079 _snapshot = !_snapshot;
00080 }
00081
00086 QString helpString() const;
00087
00093 virtual void load(const QString& basename) =0;
00094
00095 protected:
00096 MeshNS::RenderMode _renderMode;
00097 bool _snapshot;
00098 };
00099 }
00100
00101 #endif