OpenMesh
ProgViewerWidget.hh
1/* ========================================================================= *
2 * *
3 * OpenMesh *
4 * Copyright (c) 2001-2023, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openmesh.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenMesh. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 * ========================================================================= */
41
42
43
44
45#ifndef OPENMESHAPPS_PROGVIEWERWIDGET_HH
46#define OPENMESHAPPS_PROGVIEWERWIDGET_HH
47
48
49//== INCLUDES =================================================================
50
51#include <QTimer>
52#include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>
53#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
55#include <string>
56
57
58
59//== CLASS DEFINITION =========================================================
60
61
62using namespace OpenMesh;
63using namespace OpenMesh::Attributes;
64
65
67{
68 VertexAttributes ( OpenMesh::Attributes::Normal |
70 EdgeAttributes ( OpenMesh::Attributes::Status );
71 HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge );
72 FaceAttributes ( OpenMesh::Attributes::Normal |
74};
75
76
79
80
81//== CLASS DEFINITION =========================================================
82
83
84
86{
87 Q_OBJECT
88
89public:
90
92 typedef ProgViewerWidget This;
93
94
95public:
97 explicit ProgViewerWidget(QWidget* _parent=0)
98 : MeshViewerWidgetProgBase(_parent),
99 animateRefinement_(true),
100 n_base_vertices_(0),
101 n_base_faces_(0),
102 n_detail_vertices_(0),
103 n_max_vertices_(0)
104 {
105 timer_ = new QTimer(this);
106
107 connect( timer_, SIGNAL(timeout()), SLOT(animate()) );
108 }
109
112 {
113 delete timer_;
114 }
115
117 void open_prog_mesh(const char* _filename);
118
119protected slots:
120
121void animate( void );
122
123private:
124
125 QTimer *timer_;
126
127 struct PMInfo
128 {
129 MyMesh::Point p0;
130 MyMesh::VertexHandle v0, v1, vl, vr;
131 };
132 typedef std::vector<PMInfo> PMInfoContainer;
133 typedef PMInfoContainer::iterator PMInfoIter;
134
136 void refine(unsigned int _n);
137
139 void coarsen(unsigned int _n);
140
141 virtual void keyPressEvent(QKeyEvent* _event) override;
142
143 // mesh data
144 bool animateRefinement_;
145 PMInfoContainer pminfos_;
146 PMInfoIter pmiter_;
147 size_t n_base_vertices_, n_base_faces_, n_detail_vertices_;
148 size_t n_max_vertices_;
149};
150
151
152//=============================================================================
153#endif // OPENMESHAPPS_PROGVIEWERWIDGET_HH defined
154//=============================================================================
155
This file provides some macros containing attribute usage.
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
This namespace holds per item attributes like normal/color.
@ Normal
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:82
@ Status
Add status to mesh item (all items)
Definition: Attributes.hh:85
@ PrevHalfedge
Add storage for previous halfedge (halfedges). The bit is set by default in the DefaultTraits.
Definition: Attributes.hh:84
Definition: ProgViewerWidget.hh:67
Definition: ProgViewerWidget.hh:86
void open_prog_mesh(const char *_filename)
open progressive mesh
Definition: ProgViewerWidget.cc:76
~ProgViewerWidget()
destructor
Definition: ProgViewerWidget.hh:111
ProgViewerWidget(QWidget *_parent=0)
default constructor
Definition: ProgViewerWidget.hh:97
Triangle mesh based on the ArrayKernel.
Definition: TriMesh_ArrayKernelT.hh:96
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:96
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:112
Base class for all traits.
Definition: Traits.hh:122

Project OpenMesh, ©  Visual Computing Institute, RWTH Aachen. Documentation generated using doxygen .