43 #ifndef OPENMESHAPPS_MESHVIEWERWIDGETT_HH
44 #define OPENMESHAPPS_MESHVIEWERWIDGETT_HH
50 #include <OpenMesh/Core/IO/MeshIO.hh>
51 #include <OpenMesh/Core/IO/Options.hh>
52 #include <OpenMesh/Core/Utils/GenProg.hh>
53 #include <OpenMesh/Core/Utils/color_cast.hh>
55 #include <OpenMesh/Tools/Utils/StripifierT.hh>
57 #include <OpenMesh/Apps/QtViewer/QGLViewerWidget.hh>
82 tex_mode_(GL_MODULATE),
85 show_vnormals_(false),
90 #if defined(OM_USE_OSG) && OM_USE_OSG
105 bool set_texture( QImage& _texsrc );
107 void enable_strips();
108 void disable_strips();
111 Mesh& mesh() {
return mesh_; }
112 const Mesh& mesh()
const {
return mesh_; }
117 virtual void draw_scene(
const std::string& _draw_mode);
125 void glVertex(
const typename Mesh::VertexHandle _vh )
126 { glVertex3fv( &mesh_.point( _vh )[0] ); }
128 void glVertex(
const typename Mesh::Point& _p )
129 { glVertex3fv( &_p[0] ); }
131 void glNormal(
const typename Mesh::VertexHandle _vh )
132 { glNormal3fv( &mesh_.normal( _vh )[0] ); }
134 void glTexCoord(
const typename Mesh::VertexHandle _vh )
135 { glTexCoord2fv( &mesh_.texcoord(_vh)[0] ); }
137 void glColor(
const typename Mesh::VertexHandle _vh )
138 { glColor3ubv( &mesh_.color(_vh)[0] ); }
142 void glNormal(
const typename Mesh::FaceHandle _fh )
143 { glNormal3fv( &mesh_.normal( _fh )[0] ); }
145 void glColor(
const typename Mesh::FaceHandle _fh )
146 { glColor3ubv( &mesh_.color(_fh)[0] ); }
148 void glMaterial(
const typename Mesh::FaceHandle _fh,
149 int _f=GL_FRONT_AND_BACK,
int _m=GL_DIFFUSE )
151 OpenMesh::Vec3f c=OpenMesh::color_cast<OpenMesh::Vec3f>(mesh_.color(_fh));
152 OpenMesh::Vec4f m( c[0], c[1], c[2], 1.0f );
154 glMaterialfv(_f, _m, &m[0]);
160 void compute_strips(
void)
171 virtual void keyPressEvent( QKeyEvent* _event);
181 MyStripifier strips_;
191 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESHAPPS_MESHVIEWERWIDGET_CC)
192 # define OPENMESH_MESHVIEWERWIDGET_TEMPLATES
193 # include "MeshViewerWidgetT.cc"
196 #endif // OPENMESHAPPS_MESHVIEWERWIDGETT_HH defined
void clear()
delete all strips
Definition: StripifierT.hh:98
Set options for reader/writer modules.
Definition: Options.hh:88
MeshViewerWidgetT(QWidget *_parent=0)
default constructor
Definition: MeshViewerWidgetT.hh:78
QAction * add_draw_mode(const std::string &_s)
add draw mode to popup menu, and return the QAction created
Definition: QGLViewerWidget.cc:635
virtual bool open_mesh(const char *_filename, OpenMesh::IO::Options _opt)
open mesh
Definition: MeshViewerWidgetT.cc:76
Definition: QGLViewerWidget.hh:66
This file provides some macros containing attribute usage.
virtual bool open_texture(const char *_filename)
load texture
Definition: MeshViewerWidgetT.cc:205
virtual void draw_scene(const std::string &_draw_mode)
inherited drawing method
Definition: MeshViewerWidgetT.cc:571
size_t stripify()
Compute triangle strips, returns number of strips.
Definition: StripifierT.cc:80
~MeshViewerWidgetT()
destructor
Definition: MeshViewerWidgetT.hh:96
This class decomposes a triangle mesh into several triangle strips.
Definition: StripifierT.hh:77
virtual void draw_openmesh(const std::string &_drawmode)
draw the mesh
Definition: MeshViewerWidgetT.cc:283
Definition: MeshViewerWidgetT.hh:69