dracox 0.0.1__cp39-cp39-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bin/draco_decoder.exe +0 -0
- bin/draco_encoder.exe +0 -0
- dracox/__init__.py +252 -0
- dracox/dracox_ext.cp39-win_amd64.pyd +0 -0
- dracox-0.0.1.dist-info/METADATA +14 -0
- dracox-0.0.1.dist-info/RECORD +214 -0
- dracox-0.0.1.dist-info/WHEEL +5 -0
- include/draco/animation/keyframe_animation.h +107 -0
- include/draco/animation/keyframe_animation_decoder.h +34 -0
- include/draco/animation/keyframe_animation_encoder.h +39 -0
- include/draco/attributes/attribute_octahedron_transform.h +81 -0
- include/draco/attributes/attribute_quantization_transform.h +102 -0
- include/draco/attributes/attribute_transform.h +76 -0
- include/draco/attributes/attribute_transform_data.h +71 -0
- include/draco/attributes/attribute_transform_type.h +30 -0
- include/draco/attributes/geometry_attribute.h +541 -0
- include/draco/attributes/geometry_indices.h +54 -0
- include/draco/attributes/point_attribute.h +196 -0
- include/draco/compression/attributes/attributes_decoder.h +97 -0
- include/draco/compression/attributes/attributes_decoder_interface.h +62 -0
- include/draco/compression/attributes/attributes_encoder.h +154 -0
- include/draco/compression/attributes/kd_tree_attributes_decoder.h +50 -0
- include/draco/compression/attributes/kd_tree_attributes_encoder.h +51 -0
- include/draco/compression/attributes/kd_tree_attributes_shared.h +28 -0
- include/draco/compression/attributes/linear_sequencer.h +51 -0
- include/draco/compression/attributes/mesh_attribute_indices_encoding_data.h +58 -0
- include/draco/compression/attributes/normal_compression_utils.h +372 -0
- include/draco/compression/attributes/point_d_vector.h +288 -0
- include/draco/compression/attributes/points_sequencer.h +63 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h +236 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_encoder.h +413 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h +34 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_data.h +72 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h +46 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h +46 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h +176 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h +180 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_area.h +117 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_base.h +96 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h +128 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_encoder.h +133 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_encoder.h +111 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h +78 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h +372 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_encoder.h +318 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h +143 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_encoder.h +136 -0
- include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_predictor.h +282 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h +194 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_interface.h +53 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoding_transform.h +65 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_decoder.h +65 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_encoder.h +69 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h +134 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_interface.h +55 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoding_transform.h +77 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_factory.h +85 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_interface.h +60 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_decoding_transform.h +118 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_encoding_transform.h +116 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_transform_base.h +102 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_decoding_transform.h +115 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_encoding_transform.h +105 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h +90 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h +88 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_encoding_transform.h +81 -0
- include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h +120 -0
- include/draco/compression/attributes/sequential_attribute_decoder.h +86 -0
- include/draco/compression/attributes/sequential_attribute_decoders_controller.h +61 -0
- include/draco/compression/attributes/sequential_attribute_encoder.h +134 -0
- include/draco/compression/attributes/sequential_attribute_encoders_controller.h +115 -0
- include/draco/compression/attributes/sequential_integer_attribute_decoder.h +76 -0
- include/draco/compression/attributes/sequential_integer_attribute_encoder.h +67 -0
- include/draco/compression/attributes/sequential_normal_attribute_decoder.h +83 -0
- include/draco/compression/attributes/sequential_normal_attribute_encoder.h +82 -0
- include/draco/compression/attributes/sequential_quantization_attribute_decoder.h +52 -0
- include/draco/compression/attributes/sequential_quantization_attribute_encoder.h +52 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_coding_shared.h +43 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_decoder.h +54 -0
- include/draco/compression/bit_coders/adaptive_rans_bit_encoder.h +61 -0
- include/draco/compression/bit_coders/direct_bit_decoder.h +89 -0
- include/draco/compression/bit_coders/direct_bit_encoder.h +89 -0
- include/draco/compression/bit_coders/folded_integer_bit_decoder.h +77 -0
- include/draco/compression/bit_coders/folded_integer_bit_encoder.h +82 -0
- include/draco/compression/bit_coders/rans_bit_decoder.h +55 -0
- include/draco/compression/bit_coders/rans_bit_encoder.h +57 -0
- include/draco/compression/bit_coders/symbol_bit_decoder.h +36 -0
- include/draco/compression/bit_coders/symbol_bit_encoder.h +36 -0
- include/draco/compression/config/compression_shared.h +155 -0
- include/draco/compression/config/decoder_options.h +34 -0
- include/draco/compression/config/draco_options.h +249 -0
- include/draco/compression/config/encoder_options.h +101 -0
- include/draco/compression/config/encoding_features.h +39 -0
- include/draco/compression/decode.h +80 -0
- include/draco/compression/draco_compression_options.h +141 -0
- include/draco/compression/encode.h +139 -0
- include/draco/compression/encode_base.h +131 -0
- include/draco/compression/entropy/ans.h +526 -0
- include/draco/compression/entropy/rans_symbol_coding.h +53 -0
- include/draco/compression/entropy/rans_symbol_decoder.h +171 -0
- include/draco/compression/entropy/rans_symbol_encoder.h +290 -0
- include/draco/compression/entropy/shannon_entropy.h +110 -0
- include/draco/compression/entropy/symbol_decoding.h +29 -0
- include/draco/compression/entropy/symbol_encoding.h +47 -0
- include/draco/compression/expert_encode.h +160 -0
- include/draco/compression/mesh/mesh_decoder.h +68 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder.h +54 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h +228 -0
- include/draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h +47 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder.h +73 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder_impl.h +209 -0
- include/draco/compression/mesh/mesh_edgebreaker_encoder_impl_interface.h +57 -0
- include/draco/compression/mesh/mesh_edgebreaker_shared.h +129 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_decoder.h +201 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_encoder.h +139 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_decoder.h +134 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_encoder.h +172 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_decoder.h +219 -0
- include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h +226 -0
- include/draco/compression/mesh/mesh_encoder.h +84 -0
- include/draco/compression/mesh/mesh_sequential_decoder.h +39 -0
- include/draco/compression/mesh/mesh_sequential_encoder.h +56 -0
- include/draco/compression/mesh/traverser/depth_first_traverser.h +172 -0
- include/draco/compression/mesh/traverser/max_prediction_degree_traverser.h +226 -0
- include/draco/compression/mesh/traverser/mesh_attribute_indices_encoding_observer.h +76 -0
- include/draco/compression/mesh/traverser/mesh_traversal_sequencer.h +113 -0
- include/draco/compression/mesh/traverser/traverser_base.h +87 -0
- include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.h +369 -0
- include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.h +372 -0
- include/draco/compression/point_cloud/algorithms/float_points_tree_decoder.h +141 -0
- include/draco/compression/point_cloud/algorithms/float_points_tree_encoder.h +126 -0
- include/draco/compression/point_cloud/algorithms/point_cloud_compression_method.h +34 -0
- include/draco/compression/point_cloud/algorithms/point_cloud_types.h +76 -0
- include/draco/compression/point_cloud/algorithms/quantize_points_3.h +84 -0
- include/draco/compression/point_cloud/algorithms/queuing_policy.h +75 -0
- include/draco/compression/point_cloud/point_cloud_decoder.h +118 -0
- include/draco/compression/point_cloud/point_cloud_encoder.h +158 -0
- include/draco/compression/point_cloud/point_cloud_kd_tree_decoder.h +31 -0
- include/draco/compression/point_cloud/point_cloud_kd_tree_encoder.h +45 -0
- include/draco/compression/point_cloud/point_cloud_sequential_decoder.h +33 -0
- include/draco/compression/point_cloud/point_cloud_sequential_encoder.h +43 -0
- include/draco/core/bit_utils.h +127 -0
- include/draco/core/bounding_box.h +77 -0
- include/draco/core/constants.h +6 -0
- include/draco/core/cycle_timer.h +51 -0
- include/draco/core/data_buffer.h +82 -0
- include/draco/core/decoder_buffer.h +216 -0
- include/draco/core/divide.h +42 -0
- include/draco/core/draco_index_type.h +184 -0
- include/draco/core/draco_index_type_vector.h +90 -0
- include/draco/core/draco_types.h +52 -0
- include/draco/core/draco_version.h +25 -0
- include/draco/core/encoder_buffer.h +152 -0
- include/draco/core/hash_utils.h +64 -0
- include/draco/core/macros.h +124 -0
- include/draco/core/math_utils.h +79 -0
- include/draco/core/options.h +151 -0
- include/draco/core/quantization_utils.h +82 -0
- include/draco/core/status.h +83 -0
- include/draco/core/status_or.h +81 -0
- include/draco/core/varint_decoding.h +81 -0
- include/draco/core/varint_encoding.h +61 -0
- include/draco/core/vector_d.h +355 -0
- include/draco/draco_features.h +25 -0
- include/draco/io/file_reader_factory.h +34 -0
- include/draco/io/file_reader_interface.h +32 -0
- include/draco/io/file_utils.h +86 -0
- include/draco/io/file_writer_factory.h +34 -0
- include/draco/io/file_writer_interface.h +26 -0
- include/draco/io/file_writer_utils.h +38 -0
- include/draco/io/mesh_io.h +107 -0
- include/draco/io/obj_decoder.h +147 -0
- include/draco/io/obj_encoder.h +107 -0
- include/draco/io/parser_utils.h +66 -0
- include/draco/io/ply_decoder.h +69 -0
- include/draco/io/ply_encoder.h +54 -0
- include/draco/io/ply_property_reader.h +96 -0
- include/draco/io/ply_property_writer.h +94 -0
- include/draco/io/ply_reader.h +155 -0
- include/draco/io/point_cloud_io.h +89 -0
- include/draco/io/stdio_file_reader.h +48 -0
- include/draco/io/stdio_file_writer.h +42 -0
- include/draco/io/stl_decoder.h +38 -0
- include/draco/io/stl_encoder.h +52 -0
- include/draco/mesh/corner_table.h +397 -0
- include/draco/mesh/corner_table_iterators.h +309 -0
- include/draco/mesh/mesh.h +378 -0
- include/draco/mesh/mesh_are_equivalent.h +71 -0
- include/draco/mesh/mesh_attribute_corner_table.h +202 -0
- include/draco/mesh/mesh_cleanup.h +61 -0
- include/draco/mesh/mesh_features.h +93 -0
- include/draco/mesh/mesh_indices.h +37 -0
- include/draco/mesh/mesh_misc_functions.h +105 -0
- include/draco/mesh/mesh_stripifier.h +258 -0
- include/draco/mesh/triangle_soup_mesh_builder.h +134 -0
- include/draco/mesh/valence_cache.h +142 -0
- include/draco/metadata/geometry_metadata.h +142 -0
- include/draco/metadata/metadata.h +209 -0
- include/draco/metadata/metadata_decoder.h +42 -0
- include/draco/metadata/metadata_encoder.h +41 -0
- include/draco/metadata/property_attribute.h +107 -0
- include/draco/metadata/property_table.h +222 -0
- include/draco/metadata/structural_metadata.h +78 -0
- include/draco/metadata/structural_metadata_schema.h +118 -0
- include/draco/point_cloud/point_cloud.h +289 -0
- include/draco/point_cloud/point_cloud_builder.h +101 -0
- lib/draco.lib +0 -0
- lib/pkgconfig/draco.pc +6 -0
- share/cmake/draco/draco-config-version.cmake +43 -0
- share/cmake/draco/draco-config.cmake +27 -0
- share/cmake/draco/draco-targets-release.cmake +19 -0
- share/cmake/draco/draco-targets.cmake +107 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
#ifndef DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_TRAVERSAL_VALENCE_ENCODER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_TRAVERSAL_VALENCE_ENCODER_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/entropy/symbol_encoding.h"
|
|
19
|
+
#include "draco/compression/mesh/mesh_edgebreaker_traversal_encoder.h"
|
|
20
|
+
#include "draco/core/varint_encoding.h"
|
|
21
|
+
|
|
22
|
+
namespace draco {
|
|
23
|
+
|
|
24
|
+
// Predictive encoder for the Edgebreaker symbols based on valences of the
|
|
25
|
+
// previously encoded vertices, following the method described in: Szymczak'02,
|
|
26
|
+
// "Optimized Edgebreaker Encoding for Large and Regular Triangle Meshes". Each
|
|
27
|
+
// valence is used to specify a different entropy context for encoding of the
|
|
28
|
+
// symbols.
|
|
29
|
+
// Encoder can operate in various predefined modes that can be used to select
|
|
30
|
+
// the way in which the entropy contexts are computed (e.g. using different
|
|
31
|
+
// clamping for valences, or even using different inputs to compute the
|
|
32
|
+
// contexts), see EdgebreakerValenceCodingMode in mesh_edgebreaker_shared.h for
|
|
33
|
+
// a list of supported modes.
|
|
34
|
+
class MeshEdgebreakerTraversalValenceEncoder
|
|
35
|
+
: public MeshEdgebreakerTraversalEncoder {
|
|
36
|
+
public:
|
|
37
|
+
MeshEdgebreakerTraversalValenceEncoder()
|
|
38
|
+
: corner_table_(nullptr),
|
|
39
|
+
prev_symbol_(-1),
|
|
40
|
+
last_corner_(kInvalidCornerIndex),
|
|
41
|
+
num_symbols_(0),
|
|
42
|
+
min_valence_(2),
|
|
43
|
+
max_valence_(7) {}
|
|
44
|
+
|
|
45
|
+
bool Init(MeshEdgebreakerEncoderImplInterface *encoder) {
|
|
46
|
+
if (!MeshEdgebreakerTraversalEncoder::Init(encoder)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
min_valence_ = 2;
|
|
50
|
+
max_valence_ = 7;
|
|
51
|
+
corner_table_ = encoder->GetCornerTable();
|
|
52
|
+
|
|
53
|
+
// Initialize valences of all vertices.
|
|
54
|
+
vertex_valences_.resize(corner_table_->num_vertices());
|
|
55
|
+
for (VertexIndex i(0); i < static_cast<uint32_t>(vertex_valences_.size());
|
|
56
|
+
++i) {
|
|
57
|
+
vertex_valences_[i] = corner_table_->Valence(VertexIndex(i));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Replicate the corner to vertex map from the corner table. We need to do
|
|
61
|
+
// this because the map may get updated during encoding because we add new
|
|
62
|
+
// vertices when we encounter split symbols.
|
|
63
|
+
corner_to_vertex_map_.resize(corner_table_->num_corners());
|
|
64
|
+
for (CornerIndex i(0); i < corner_table_->num_corners(); ++i) {
|
|
65
|
+
corner_to_vertex_map_[i] = corner_table_->Vertex(i);
|
|
66
|
+
}
|
|
67
|
+
const int32_t num_unique_valences = max_valence_ - min_valence_ + 1;
|
|
68
|
+
|
|
69
|
+
context_symbols_.resize(num_unique_valences);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
inline void NewCornerReached(CornerIndex corner) { last_corner_ = corner; }
|
|
74
|
+
|
|
75
|
+
inline void EncodeSymbol(EdgebreakerTopologyBitPattern symbol) {
|
|
76
|
+
++num_symbols_;
|
|
77
|
+
// Update valences on the mesh and compute the context that is going to be
|
|
78
|
+
// used to encode the processed symbol.
|
|
79
|
+
// Note that the valences are computed for the so far unencoded part of the
|
|
80
|
+
// mesh (i.e. the decoding is reverse). Adding a new symbol either reduces
|
|
81
|
+
// valences on the vertices or leaves the valence unchanged.
|
|
82
|
+
|
|
83
|
+
const CornerIndex next = corner_table_->Next(last_corner_);
|
|
84
|
+
const CornerIndex prev = corner_table_->Previous(last_corner_);
|
|
85
|
+
|
|
86
|
+
// Get valence on the tip corner of the active edge (outgoing edge that is
|
|
87
|
+
// going to be used in reverse decoding of the connectivity to predict the
|
|
88
|
+
// next symbol).
|
|
89
|
+
const int active_valence = vertex_valences_[corner_to_vertex_map_[next]];
|
|
90
|
+
switch (symbol) {
|
|
91
|
+
case TOPOLOGY_C:
|
|
92
|
+
// Compute prediction.
|
|
93
|
+
FALLTHROUGH_INTENDED;
|
|
94
|
+
case TOPOLOGY_S:
|
|
95
|
+
// Update valences.
|
|
96
|
+
vertex_valences_[corner_to_vertex_map_[next]] -= 1;
|
|
97
|
+
vertex_valences_[corner_to_vertex_map_[prev]] -= 1;
|
|
98
|
+
if (symbol == TOPOLOGY_S) {
|
|
99
|
+
// Whenever we reach a split symbol, we need to split the vertex into
|
|
100
|
+
// two and attach all corners on the left and right sides of the split
|
|
101
|
+
// vertex to the respective vertices (see image below). This is
|
|
102
|
+
// necessary since the decoder works in the reverse order and it
|
|
103
|
+
// merges the two vertices only after the split symbol is processed.
|
|
104
|
+
//
|
|
105
|
+
// * -----
|
|
106
|
+
// / \--------
|
|
107
|
+
// / \--------
|
|
108
|
+
// / \-------
|
|
109
|
+
// *-------v-------*
|
|
110
|
+
// \ /c\ /
|
|
111
|
+
// \ / \ /
|
|
112
|
+
// \ /n S p\ /
|
|
113
|
+
// *.......*
|
|
114
|
+
//
|
|
115
|
+
|
|
116
|
+
// Count the number of faces on the left side of the split vertex and
|
|
117
|
+
// update the valence on the "left vertex".
|
|
118
|
+
int num_left_faces = 0;
|
|
119
|
+
CornerIndex act_c = corner_table_->Opposite(prev);
|
|
120
|
+
while (act_c != kInvalidCornerIndex) {
|
|
121
|
+
if (encoder_impl()->IsFaceEncoded(corner_table_->Face(act_c))) {
|
|
122
|
+
break; // Stop when we reach the first visited face.
|
|
123
|
+
}
|
|
124
|
+
++num_left_faces;
|
|
125
|
+
act_c = corner_table_->Opposite(corner_table_->Next(act_c));
|
|
126
|
+
}
|
|
127
|
+
vertex_valences_[corner_to_vertex_map_[last_corner_]] =
|
|
128
|
+
num_left_faces + 1;
|
|
129
|
+
|
|
130
|
+
// Create a new vertex for the right side and count the number of
|
|
131
|
+
// faces that should be attached to this vertex.
|
|
132
|
+
const int new_vert_id = static_cast<int>(vertex_valences_.size());
|
|
133
|
+
int num_right_faces = 0;
|
|
134
|
+
|
|
135
|
+
act_c = corner_table_->Opposite(next);
|
|
136
|
+
while (act_c != kInvalidCornerIndex) {
|
|
137
|
+
if (encoder_impl()->IsFaceEncoded(corner_table_->Face(act_c))) {
|
|
138
|
+
break; // Stop when we reach the first visited face.
|
|
139
|
+
}
|
|
140
|
+
++num_right_faces;
|
|
141
|
+
// Map corners on the right side to the newly created vertex.
|
|
142
|
+
corner_to_vertex_map_[corner_table_->Next(act_c)] = new_vert_id;
|
|
143
|
+
act_c = corner_table_->Opposite(corner_table_->Previous(act_c));
|
|
144
|
+
}
|
|
145
|
+
vertex_valences_.push_back(num_right_faces + 1);
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
case TOPOLOGY_R:
|
|
149
|
+
// Update valences.
|
|
150
|
+
vertex_valences_[corner_to_vertex_map_[last_corner_]] -= 1;
|
|
151
|
+
vertex_valences_[corner_to_vertex_map_[next]] -= 1;
|
|
152
|
+
vertex_valences_[corner_to_vertex_map_[prev]] -= 2;
|
|
153
|
+
break;
|
|
154
|
+
case TOPOLOGY_L:
|
|
155
|
+
|
|
156
|
+
vertex_valences_[corner_to_vertex_map_[last_corner_]] -= 1;
|
|
157
|
+
vertex_valences_[corner_to_vertex_map_[next]] -= 2;
|
|
158
|
+
vertex_valences_[corner_to_vertex_map_[prev]] -= 1;
|
|
159
|
+
break;
|
|
160
|
+
case TOPOLOGY_E:
|
|
161
|
+
vertex_valences_[corner_to_vertex_map_[last_corner_]] -= 2;
|
|
162
|
+
vertex_valences_[corner_to_vertex_map_[next]] -= 2;
|
|
163
|
+
vertex_valences_[corner_to_vertex_map_[prev]] -= 2;
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (prev_symbol_ != -1) {
|
|
170
|
+
int clamped_valence;
|
|
171
|
+
if (active_valence < min_valence_) {
|
|
172
|
+
clamped_valence = min_valence_;
|
|
173
|
+
} else if (active_valence > max_valence_) {
|
|
174
|
+
clamped_valence = max_valence_;
|
|
175
|
+
} else {
|
|
176
|
+
clamped_valence = active_valence;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const int context = clamped_valence - min_valence_;
|
|
180
|
+
context_symbols_[context].push_back(
|
|
181
|
+
edge_breaker_topology_to_symbol_id[prev_symbol_]);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
prev_symbol_ = symbol;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
void Done() {
|
|
188
|
+
// Store the init face configurations and attribute seam data
|
|
189
|
+
MeshEdgebreakerTraversalEncoder::EncodeStartFaces();
|
|
190
|
+
MeshEdgebreakerTraversalEncoder::EncodeAttributeSeams();
|
|
191
|
+
|
|
192
|
+
// Store the contexts.
|
|
193
|
+
for (int i = 0; i < context_symbols_.size(); ++i) {
|
|
194
|
+
EncodeVarint<uint32_t>(static_cast<uint32_t>(context_symbols_[i].size()),
|
|
195
|
+
GetOutputBuffer());
|
|
196
|
+
if (context_symbols_[i].size() > 0) {
|
|
197
|
+
EncodeSymbols(context_symbols_[i].data(),
|
|
198
|
+
static_cast<int>(context_symbols_[i].size()), 1, nullptr,
|
|
199
|
+
GetOutputBuffer());
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
int NumEncodedSymbols() const { return num_symbols_; }
|
|
205
|
+
|
|
206
|
+
private:
|
|
207
|
+
const CornerTable *corner_table_;
|
|
208
|
+
// Explicit map between corners and vertices. We cannot use the one stored
|
|
209
|
+
// in the |corner_table_| because we may need to add additional vertices to
|
|
210
|
+
// handle split symbols.
|
|
211
|
+
IndexTypeVector<CornerIndex, VertexIndex> corner_to_vertex_map_;
|
|
212
|
+
IndexTypeVector<VertexIndex, int> vertex_valences_;
|
|
213
|
+
// Previously encoded symbol.
|
|
214
|
+
int32_t prev_symbol_;
|
|
215
|
+
CornerIndex last_corner_;
|
|
216
|
+
// Explicitly count the number of encoded symbols.
|
|
217
|
+
int num_symbols_;
|
|
218
|
+
|
|
219
|
+
int min_valence_;
|
|
220
|
+
int max_valence_;
|
|
221
|
+
std::vector<std::vector<uint32_t>> context_symbols_;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
} // namespace draco
|
|
225
|
+
|
|
226
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_TRAVERSAL_VALENCE_ENCODER_H_
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
#ifndef DRACO_COMPRESSION_MESH_MESH_ENCODER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_MESH_ENCODER_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/attributes/mesh_attribute_indices_encoding_data.h"
|
|
19
|
+
#include "draco/compression/point_cloud/point_cloud_encoder.h"
|
|
20
|
+
#include "draco/mesh/mesh.h"
|
|
21
|
+
#include "draco/mesh/mesh_attribute_corner_table.h"
|
|
22
|
+
|
|
23
|
+
namespace draco {
|
|
24
|
+
|
|
25
|
+
// Abstract base class for all mesh encoders. It provides some basic
|
|
26
|
+
// functionality that's shared between different encoders.
|
|
27
|
+
class MeshEncoder : public PointCloudEncoder {
|
|
28
|
+
public:
|
|
29
|
+
MeshEncoder();
|
|
30
|
+
|
|
31
|
+
// Sets the mesh that is going be encoded. Must be called before the Encode()
|
|
32
|
+
// method.
|
|
33
|
+
void SetMesh(const Mesh &m);
|
|
34
|
+
|
|
35
|
+
EncodedGeometryType GetGeometryType() const override {
|
|
36
|
+
return TRIANGULAR_MESH;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Returns the number of faces that were encoded during the last Encode().
|
|
40
|
+
// function call. Valid only if "store_number_of_encoded_faces" flag was set
|
|
41
|
+
// in the provided EncoderOptions.
|
|
42
|
+
size_t num_encoded_faces() const { return num_encoded_faces_; }
|
|
43
|
+
|
|
44
|
+
// Returns the base connectivity of the encoded mesh (or nullptr if it is not
|
|
45
|
+
// initialized).
|
|
46
|
+
virtual const CornerTable *GetCornerTable() const { return nullptr; }
|
|
47
|
+
|
|
48
|
+
// Returns the attribute connectivity data or nullptr if it does not exist.
|
|
49
|
+
virtual const MeshAttributeCornerTable *GetAttributeCornerTable(
|
|
50
|
+
int /* att_id */) const {
|
|
51
|
+
return nullptr;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Returns the encoding data for a given attribute or nullptr when the data
|
|
55
|
+
// does not exist.
|
|
56
|
+
virtual const MeshAttributeIndicesEncodingData *GetAttributeEncodingData(
|
|
57
|
+
int /* att_id */) const {
|
|
58
|
+
return nullptr;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const Mesh *mesh() const { return mesh_; }
|
|
62
|
+
|
|
63
|
+
protected:
|
|
64
|
+
Status EncodeGeometryData() override;
|
|
65
|
+
|
|
66
|
+
// Needs to be implemented by the derived classes.
|
|
67
|
+
virtual Status EncodeConnectivity() = 0;
|
|
68
|
+
|
|
69
|
+
// Computes and sets the num_encoded_faces_ for the encoder.
|
|
70
|
+
virtual void ComputeNumberOfEncodedFaces() = 0;
|
|
71
|
+
|
|
72
|
+
void set_mesh(const Mesh *mesh) { mesh_ = mesh; }
|
|
73
|
+
void set_num_encoded_faces(size_t num_faces) {
|
|
74
|
+
num_encoded_faces_ = num_faces;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private:
|
|
78
|
+
const Mesh *mesh_;
|
|
79
|
+
size_t num_encoded_faces_;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace draco
|
|
83
|
+
|
|
84
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_ENCODER_H_
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
#ifndef DRACO_COMPRESSION_MESH_MESH_SEQUENTIAL_DECODER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_MESH_SEQUENTIAL_DECODER_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/mesh/mesh_decoder.h"
|
|
19
|
+
|
|
20
|
+
namespace draco {
|
|
21
|
+
|
|
22
|
+
// Class for decoding data encoded by MeshSequentialEncoder.
|
|
23
|
+
class MeshSequentialDecoder : public MeshDecoder {
|
|
24
|
+
public:
|
|
25
|
+
MeshSequentialDecoder();
|
|
26
|
+
|
|
27
|
+
protected:
|
|
28
|
+
bool DecodeConnectivity() override;
|
|
29
|
+
bool CreateAttributesDecoder(int32_t att_decoder_id) override;
|
|
30
|
+
|
|
31
|
+
private:
|
|
32
|
+
// Decodes face indices that were compressed with an entropy code.
|
|
33
|
+
// Returns false on error.
|
|
34
|
+
bool DecodeAndDecompressIndices(uint32_t num_faces);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
} // namespace draco
|
|
38
|
+
|
|
39
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_SEQUENTIAL_DECODER_H_
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
// The encoder compresses all attribute values using an order preserving
|
|
16
|
+
// attribute encoder (that can still support quantization, prediction schemes,
|
|
17
|
+
// and other features).
|
|
18
|
+
// The mesh connectivity data can be encoded using two modes that are controlled
|
|
19
|
+
// using a global encoder options flag called "compress_connectivity"
|
|
20
|
+
// 1. When "compress_connectivity" == true:
|
|
21
|
+
// All point ids are first delta coded and then compressed using an entropy
|
|
22
|
+
// coding.
|
|
23
|
+
// 2. When "compress_connectivity" == false:
|
|
24
|
+
// All point ids are encoded directly using either 8, 16, or 32 bits per
|
|
25
|
+
// value based on the maximum point id value.
|
|
26
|
+
|
|
27
|
+
#ifndef DRACO_COMPRESSION_MESH_MESH_SEQUENTIAL_ENCODER_H_
|
|
28
|
+
#define DRACO_COMPRESSION_MESH_MESH_SEQUENTIAL_ENCODER_H_
|
|
29
|
+
|
|
30
|
+
#include "draco/compression/mesh/mesh_encoder.h"
|
|
31
|
+
|
|
32
|
+
namespace draco {
|
|
33
|
+
|
|
34
|
+
// Class that encodes mesh data using a simple binary representation of mesh's
|
|
35
|
+
// connectivity and geometry.
|
|
36
|
+
class MeshSequentialEncoder : public MeshEncoder {
|
|
37
|
+
public:
|
|
38
|
+
MeshSequentialEncoder();
|
|
39
|
+
uint8_t GetEncodingMethod() const override {
|
|
40
|
+
return MESH_SEQUENTIAL_ENCODING;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protected:
|
|
44
|
+
Status EncodeConnectivity() override;
|
|
45
|
+
bool GenerateAttributesEncoder(int32_t att_id) override;
|
|
46
|
+
void ComputeNumberOfEncodedPoints() override;
|
|
47
|
+
void ComputeNumberOfEncodedFaces() override;
|
|
48
|
+
|
|
49
|
+
private:
|
|
50
|
+
// Returns false on error.
|
|
51
|
+
bool CompressAndEncodeIndices();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace draco
|
|
55
|
+
|
|
56
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_SEQUENTIAL_ENCODER_H_
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// Copyright 2016 The Draco Authors.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
//
|
|
15
|
+
#ifndef DRACO_COMPRESSION_MESH_TRAVERSER_DEPTH_FIRST_TRAVERSER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_TRAVERSER_DEPTH_FIRST_TRAVERSER_H_
|
|
17
|
+
|
|
18
|
+
#include <vector>
|
|
19
|
+
|
|
20
|
+
#include "draco/compression/mesh/traverser/traverser_base.h"
|
|
21
|
+
#include "draco/mesh/corner_table.h"
|
|
22
|
+
|
|
23
|
+
namespace draco {
|
|
24
|
+
|
|
25
|
+
// Basic traverser that traverses a mesh in a DFS like fashion using the
|
|
26
|
+
// CornerTable data structure. The necessary bookkeeping is available via the
|
|
27
|
+
// TraverserBase. Callbacks are handled through template argument
|
|
28
|
+
// TraversalObserverT.
|
|
29
|
+
//
|
|
30
|
+
// TraversalObserverT can perform an action on a traversal event such as newly
|
|
31
|
+
// visited face, or corner, but it does not affect the traversal itself.
|
|
32
|
+
//
|
|
33
|
+
// Concept TraversalObserverT requires:
|
|
34
|
+
//
|
|
35
|
+
// public:
|
|
36
|
+
// void OnNewFaceVisited(FaceIndex face);
|
|
37
|
+
// - Called whenever a previously unvisited face is reached.
|
|
38
|
+
//
|
|
39
|
+
// void OnNewVertexVisited(VertexIndex vert, CornerIndex corner)
|
|
40
|
+
// - Called when a new vertex is visited. |corner| is used to indicate the
|
|
41
|
+
// which of the vertex's corners has been reached.
|
|
42
|
+
|
|
43
|
+
template <class CornerTableT, class TraversalObserverT>
|
|
44
|
+
class DepthFirstTraverser
|
|
45
|
+
: public TraverserBase<CornerTableT, TraversalObserverT> {
|
|
46
|
+
public:
|
|
47
|
+
typedef CornerTableT CornerTable;
|
|
48
|
+
typedef TraversalObserverT TraversalObserver;
|
|
49
|
+
typedef TraverserBase<CornerTable, TraversalObserver> Base;
|
|
50
|
+
|
|
51
|
+
DepthFirstTraverser() {}
|
|
52
|
+
|
|
53
|
+
// Called before any traversing starts.
|
|
54
|
+
void OnTraversalStart() {}
|
|
55
|
+
|
|
56
|
+
// Called when all the traversing is done.
|
|
57
|
+
void OnTraversalEnd() {}
|
|
58
|
+
|
|
59
|
+
bool TraverseFromCorner(CornerIndex corner_id) {
|
|
60
|
+
if (this->IsFaceVisited(corner_id)) {
|
|
61
|
+
return true; // Already traversed.
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
corner_traversal_stack_.clear();
|
|
65
|
+
corner_traversal_stack_.push_back(corner_id);
|
|
66
|
+
// For the first face, check the remaining corners as they may not be
|
|
67
|
+
// processed yet.
|
|
68
|
+
const VertexIndex next_vert =
|
|
69
|
+
this->corner_table()->Vertex(this->corner_table()->Next(corner_id));
|
|
70
|
+
const VertexIndex prev_vert =
|
|
71
|
+
this->corner_table()->Vertex(this->corner_table()->Previous(corner_id));
|
|
72
|
+
if (next_vert == kInvalidVertexIndex || prev_vert == kInvalidVertexIndex) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (!this->IsVertexVisited(next_vert)) {
|
|
76
|
+
this->MarkVertexVisited(next_vert);
|
|
77
|
+
this->traversal_observer().OnNewVertexVisited(
|
|
78
|
+
next_vert, this->corner_table()->Next(corner_id));
|
|
79
|
+
}
|
|
80
|
+
if (!this->IsVertexVisited(prev_vert)) {
|
|
81
|
+
this->MarkVertexVisited(prev_vert);
|
|
82
|
+
this->traversal_observer().OnNewVertexVisited(
|
|
83
|
+
prev_vert, this->corner_table()->Previous(corner_id));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Start the actual traversal.
|
|
87
|
+
while (!corner_traversal_stack_.empty()) {
|
|
88
|
+
// Currently processed corner.
|
|
89
|
+
corner_id = corner_traversal_stack_.back();
|
|
90
|
+
FaceIndex face_id(corner_id.value() / 3);
|
|
91
|
+
// Make sure the face hasn't been visited yet.
|
|
92
|
+
if (corner_id == kInvalidCornerIndex || this->IsFaceVisited(face_id)) {
|
|
93
|
+
// This face has been already traversed.
|
|
94
|
+
corner_traversal_stack_.pop_back();
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
while (true) {
|
|
98
|
+
this->MarkFaceVisited(face_id);
|
|
99
|
+
this->traversal_observer().OnNewFaceVisited(face_id);
|
|
100
|
+
const VertexIndex vert_id = this->corner_table()->Vertex(corner_id);
|
|
101
|
+
if (vert_id == kInvalidVertexIndex) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
if (!this->IsVertexVisited(vert_id)) {
|
|
105
|
+
const bool on_boundary = this->corner_table()->IsOnBoundary(vert_id);
|
|
106
|
+
this->MarkVertexVisited(vert_id);
|
|
107
|
+
this->traversal_observer().OnNewVertexVisited(vert_id, corner_id);
|
|
108
|
+
if (!on_boundary) {
|
|
109
|
+
corner_id = this->corner_table()->GetRightCorner(corner_id);
|
|
110
|
+
face_id = FaceIndex(corner_id.value() / 3);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// The current vertex has been already visited or it was on a boundary.
|
|
115
|
+
// We need to determine whether we can visit any of it's neighboring
|
|
116
|
+
// faces.
|
|
117
|
+
const CornerIndex right_corner_id =
|
|
118
|
+
this->corner_table()->GetRightCorner(corner_id);
|
|
119
|
+
const CornerIndex left_corner_id =
|
|
120
|
+
this->corner_table()->GetLeftCorner(corner_id);
|
|
121
|
+
const FaceIndex right_face_id(
|
|
122
|
+
(right_corner_id == kInvalidCornerIndex
|
|
123
|
+
? kInvalidFaceIndex
|
|
124
|
+
: FaceIndex(right_corner_id.value() / 3)));
|
|
125
|
+
const FaceIndex left_face_id(
|
|
126
|
+
(left_corner_id == kInvalidCornerIndex
|
|
127
|
+
? kInvalidFaceIndex
|
|
128
|
+
: FaceIndex(left_corner_id.value() / 3)));
|
|
129
|
+
if (this->IsFaceVisited(right_face_id)) {
|
|
130
|
+
// Right face has been already visited.
|
|
131
|
+
if (this->IsFaceVisited(left_face_id)) {
|
|
132
|
+
// Both neighboring faces are visited. End reached.
|
|
133
|
+
corner_traversal_stack_.pop_back();
|
|
134
|
+
break; // Break from the while (true) loop.
|
|
135
|
+
} else {
|
|
136
|
+
// Go to the left face.
|
|
137
|
+
corner_id = left_corner_id;
|
|
138
|
+
face_id = left_face_id;
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
// Right face was not visited.
|
|
142
|
+
if (this->IsFaceVisited(left_face_id)) {
|
|
143
|
+
// Left face visited, go to the right one.
|
|
144
|
+
corner_id = right_corner_id;
|
|
145
|
+
face_id = right_face_id;
|
|
146
|
+
} else {
|
|
147
|
+
// Both neighboring faces are unvisited, we need to visit both of
|
|
148
|
+
// them.
|
|
149
|
+
|
|
150
|
+
// Split the traversal.
|
|
151
|
+
// First make the top of the current corner stack point to the left
|
|
152
|
+
// face (this one will be processed second).
|
|
153
|
+
corner_traversal_stack_.back() = left_corner_id;
|
|
154
|
+
// Add a new corner to the top of the stack (right face needs to
|
|
155
|
+
// be traversed first).
|
|
156
|
+
corner_traversal_stack_.push_back(right_corner_id);
|
|
157
|
+
// Break from the while (true) loop.
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private:
|
|
167
|
+
std::vector<CornerIndex> corner_traversal_stack_;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
} // namespace draco
|
|
171
|
+
|
|
172
|
+
#endif // DRACO_COMPRESSION_MESH_TRAVERSER_DEPTH_FIRST_TRAVERSER_H_
|