43 #ifndef OPENMESHAPPS_QGLVIEWERWIDGET_HH
44 #define OPENMESHAPPS_QGLVIEWERWIDGET_HH
50 #include <OpenMesh/Core/Geometry/VectorT.hh>
72 typedef QGLWidget Super;
92 void set_scene_pos(
const OpenMesh::Vec3f& _center,
float _radius );
104 const std::string& current_draw_mode()
const
105 {
return draw_mode_ ? draw_mode_names_[draw_mode_-1] : nomode_; }
107 float radius()
const {
return radius_; }
108 const OpenMesh::Vec3f& center()
const {
return center_; }
110 const GLdouble* modelview_matrix()
const {
return modelview_matrix_; }
111 const GLdouble* projection_matrix()
const {
return projection_matrix_; }
113 float fovy()
const {
return 45.0f; }
115 QAction* findAction(
const char *name);
116 void addAction(QAction* action,
const char* name);
117 void removeAction(
const char* name);
118 void removeAction(QAction* action);
123 virtual void draw_scene(
const std::string& _draw_mode);
125 double performance(
void);
127 void setDefaultMaterial(
void);
128 void setDefaultLight(
void);
133 void slotDrawMode(QAction *_mode);
134 void slotSnapshot(
void );
146 void resizeGL(
int w,
int h );
151 virtual void mousePressEvent( QMouseEvent* );
152 virtual void mouseReleaseEvent( QMouseEvent* );
153 virtual void mouseMoveEvent( QMouseEvent* );
154 virtual void wheelEvent( QWheelEvent* );
155 virtual void keyPressEvent( QKeyEvent* );
160 void update_projection_matrix();
163 void translate(
const OpenMesh::Vec3f& _trans);
166 void rotate(
const OpenMesh::Vec3f& _axis,
float _angle);
168 OpenMesh::Vec3f center_;
171 GLdouble projection_matrix_[16],
172 modelview_matrix_[16];
177 QActionGroup* draw_modes_group_;
178 typedef std::map<QString,QAction*> ActionMap;
179 ActionMap names_to_actions;
180 unsigned int draw_mode_;
181 unsigned int n_draw_modes_;
182 std::vector<std::string> draw_mode_names_;
183 static std::string nomode_;
188 bool map_to_sphere(
const QPoint& _point, OpenMesh::Vec3f& _result);
190 QPoint last_point_2D_;
191 OpenMesh::Vec3f last_point_3D_;
198 #endif // OPENMESHAPPS_QGLVIEWERWIDGET_HH
void del_draw_mode(const std::string &_s)
delete draw mode from popup menu
Definition: QGLViewerWidget.cc:702
QAction * add_draw_mode(const std::string &_s)
add draw mode to popup menu, and return the QAction created
Definition: QGLViewerWidget.cc:635
Definition: QGLViewerWidget.hh:66