OpenMesh
VDPMSynthesizerViewerWidget.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//
46// CLASS newClass
47//
48//=============================================================================
49
50
51#ifndef OPENMESH_VDPROGMESH_VDPMSYNTHESIZERVIEWERWIDGET_HH
52#define OPENMESH_VDPROGMESH_VDPMSYNTHESIZERVIEWERWIDGET_HH
53
54
55//== INCLUDES =================================================================
56
57#include <string>
58#include <QTimer>
59
60#include <OpenMesh/Core/IO/MeshIO.hh>
61#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
62#include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>
63
64#include <OpenMesh/Tools/VDPM/MeshTraits.hh>
65#include <OpenMesh/Tools/VDPM/StreamingDef.hh>
66#include <OpenMesh/Tools/VDPM/ViewingParameters.hh>
67#include <OpenMesh/Tools/VDPM/VHierarchy.hh>
68#include <OpenMesh/Tools/VDPM/VFront.hh>
69
70
71//== FORWARDDECLARATIONS ======================================================
72
73
74//== NAMESPACES ===============================================================
75
76namespace OpenMesh {
77
78
79//== CLASS DEFINITION =========================================================
80
81
82typedef TriMesh_ArrayKernelT<VDPM::MeshTraits> VDPMMesh;
84
85
86 // using view dependent progressive mesh
87
88 using VDPM::Plane3d;
89 using VDPM::VFront;
90 using VDPM::VHierarchy;
91 using VDPM::VHierarchyNode;
92 using VDPM::VHierarchyNodeIndex;
93 using VDPM::VHierarchyNodeHandle;
95 using VDPM::ViewingParameters;
96
97
98//== CLASS DEFINITION =========================================================
99
100
102{
103public:
104
105 typedef MeshViewerWidget Base;
106
107public:
108
109 explicit VDPMSynthesizerViewerWidget(QWidget* _parent=0, const char* _name=0);
110
112
114 void open_vd_prog_mesh(const char* _filename);
115
116
117private:
118
119 QString qFilename_;
120 VHierarchy vhierarchy_;
121 VFront vfront_;
122 ViewingParameters viewing_parameters_;
123 float kappa_square_;
124 bool adaptive_mode_;
125
126 unsigned int n_base_vertices_;
127 unsigned int n_base_edges_;
128 unsigned int n_base_faces_;
129 unsigned int n_details_;
130
131
132private:
133
134 bool outside_view_frustum(const OpenMesh::Vec3f &pos, float radius);
135
136 bool oriented_away(float sin_square,
137 float distance_square,
138 float product_value);
139
140 bool screen_space_error(float mue_square,
141 float sigma_square,
142 float distance_square,
143 float product_value);
144
145 void update_viewing_parameters();
146
147 virtual void keyPressEvent(QKeyEvent* _event) override;
148
149protected:
150
152 virtual void draw_scene(const std::string& _draw_mode) override;
153
154public:
155
156 void adaptive_refinement();
157
158 bool qrefine(VHierarchyNodeHandle _node_handle);
159
160 void force_vsplit(VHierarchyNodeHandle _node_handle);
161
162 bool ecol_legal(VHierarchyNodeHandle _parent_handle,
164
165 void get_active_cuts(VHierarchyNodeHandle _node_handle,
167
168 void vsplit(VHierarchyNodeHandle _node_handle,
170
171 void ecol(VHierarchyNodeHandle _parent_handle,
172 const VDPMMesh::HalfedgeHandle& v0v1);
173
174 void init_vfront();
175
176};
177
178
179//=============================================================================
180} // namespace OpenMesh
181//=============================================================================
182#endif // OPENMESHAPPS_VDPMSYNTHESIZERVIEWERWIDGET_HH defined
183//=============================================================================
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
std::vector< VHierarchyNodeHandle > VHierarchyNodeHandleContainer
Container for vertex hierarchy node handles.
Definition: VHierarchyNode.hh:183
Definition: MeshViewerWidget.hh:76
Definition: MeshViewerWidgetT.hh:71
Definition: VDPMSynthesizerViewerWidget.hh:102
void open_vd_prog_mesh(const char *_filename)
open view-dependent progressive mesh
Definition: VDPMSynthesizerViewerWidget.cc:383
virtual void draw_scene(const std::string &_draw_mode) override
inherited drawing method
Definition: VDPMSynthesizerViewerWidget.cc:100
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:136
Kernel::HalfedgeHandle HalfedgeHandle
Scalar type.
Definition: PolyMeshT.hh:137
Active nodes in vertex hierarchy.
Definition: VFront.hh:76
Keeps the vertex hierarchy build during analyzing a progressive mesh.
Definition: VHierarchy.hh:74
Handle for vertex hierarchy nodes
Definition: VHierarchyNode.hh:78
Definition: ViewingParameters.hh:75

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