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,160 @@
|
|
|
1
|
+
// Copyright 2017 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_EXPERT_ENCODE_H_
|
|
16
|
+
#define DRACO_COMPRESSION_EXPERT_ENCODE_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/config/compression_shared.h"
|
|
19
|
+
#include "draco/compression/config/encoder_options.h"
|
|
20
|
+
#include "draco/compression/encode_base.h"
|
|
21
|
+
#include "draco/core/encoder_buffer.h"
|
|
22
|
+
#include "draco/core/status.h"
|
|
23
|
+
#include "draco/mesh/mesh.h"
|
|
24
|
+
|
|
25
|
+
namespace draco {
|
|
26
|
+
|
|
27
|
+
// Advanced helper class for encoding geometry using the Draco compression
|
|
28
|
+
// library. Unlike the basic Encoder (encode.h), this class allows users to
|
|
29
|
+
// specify options for each attribute individually using provided attribute ids.
|
|
30
|
+
// The drawback of this encoder is that it can be used to encode only one model
|
|
31
|
+
// at a time, and for each new model the options need to be set again,
|
|
32
|
+
class ExpertEncoder : public EncoderBase<EncoderOptions> {
|
|
33
|
+
public:
|
|
34
|
+
typedef EncoderBase<EncoderOptions> Base;
|
|
35
|
+
typedef EncoderOptions OptionsType;
|
|
36
|
+
|
|
37
|
+
explicit ExpertEncoder(const PointCloud &point_cloud);
|
|
38
|
+
explicit ExpertEncoder(const Mesh &mesh);
|
|
39
|
+
|
|
40
|
+
// Encodes the geometry provided in the constructor to the target buffer.
|
|
41
|
+
Status EncodeToBuffer(EncoderBuffer *out_buffer);
|
|
42
|
+
|
|
43
|
+
// Set encoder options used during the geometry encoding. Note that this call
|
|
44
|
+
// overwrites any modifications to the options done with the functions below.
|
|
45
|
+
void Reset(const EncoderOptions &options);
|
|
46
|
+
void Reset();
|
|
47
|
+
|
|
48
|
+
// Sets the desired encoding and decoding speed for the given options.
|
|
49
|
+
//
|
|
50
|
+
// 0 = slowest speed, but the best compression.
|
|
51
|
+
// 10 = fastest, but the worst compression.
|
|
52
|
+
// -1 = undefined.
|
|
53
|
+
//
|
|
54
|
+
// Note that both speed options affect the encoder choice of used methods and
|
|
55
|
+
// algorithms. For example, a requirement for fast decoding may prevent the
|
|
56
|
+
// encoder from using the best compression methods even if the encoding speed
|
|
57
|
+
// is set to 0. In general, the faster of the two options limits the choice of
|
|
58
|
+
// features that can be used by the encoder. Additionally, setting
|
|
59
|
+
// |decoding_speed| to be faster than the |encoding_speed| may allow the
|
|
60
|
+
// encoder to choose the optimal method out of the available features for the
|
|
61
|
+
// given |decoding_speed|.
|
|
62
|
+
void SetSpeedOptions(int encoding_speed, int decoding_speed);
|
|
63
|
+
|
|
64
|
+
// Sets the quantization compression options for a specific attribute. The
|
|
65
|
+
// attribute values will be quantized in a box defined by the maximum extent
|
|
66
|
+
// of the attribute values. I.e., the actual precision of this option depends
|
|
67
|
+
// on the scale of the attribute values.
|
|
68
|
+
void SetAttributeQuantization(int32_t attribute_id, int quantization_bits);
|
|
69
|
+
|
|
70
|
+
// Sets the explicit quantization compression for a named attribute. The
|
|
71
|
+
// attribute values will be quantized in a coordinate system defined by the
|
|
72
|
+
// provided origin and range (the input values should be within interval:
|
|
73
|
+
// <origin, origin + range>).
|
|
74
|
+
void SetAttributeExplicitQuantization(int32_t attribute_id,
|
|
75
|
+
int quantization_bits, int num_dims,
|
|
76
|
+
const float *origin, float range);
|
|
77
|
+
|
|
78
|
+
// Enables/disables built in entropy coding of attribute values. Disabling
|
|
79
|
+
// this option may be useful to improve the performance when third party
|
|
80
|
+
// compression is used on top of the Draco compression. Default: [true].
|
|
81
|
+
void SetUseBuiltInAttributeCompression(bool enabled);
|
|
82
|
+
|
|
83
|
+
// Sets the desired encoding method for a given geometry. By default, encoding
|
|
84
|
+
// method is selected based on the properties of the input geometry and based
|
|
85
|
+
// on the other options selected in the used EncoderOptions (such as desired
|
|
86
|
+
// encoding and decoding speed). This function should be called only when a
|
|
87
|
+
// specific method is required.
|
|
88
|
+
//
|
|
89
|
+
// |encoding_method| can be one of the values defined in
|
|
90
|
+
// compression/config/compression_shared.h based on the type of the input
|
|
91
|
+
// geometry that is going to be encoded. For point clouds, allowed entries are
|
|
92
|
+
// POINT_CLOUD_SEQUENTIAL_ENCODING
|
|
93
|
+
// POINT_CLOUD_KD_TREE_ENCODING
|
|
94
|
+
//
|
|
95
|
+
// For meshes the input can be
|
|
96
|
+
// MESH_SEQUENTIAL_ENCODING
|
|
97
|
+
// MESH_EDGEBREAKER_ENCODING
|
|
98
|
+
//
|
|
99
|
+
// If the selected method cannot be used for the given input, the subsequent
|
|
100
|
+
// call of EncodePointCloudToBuffer or EncodeMeshToBuffer is going to fail.
|
|
101
|
+
void SetEncodingMethod(int encoding_method);
|
|
102
|
+
|
|
103
|
+
// Sets the desired encoding submethod, only for MESH_EDGEBREAKER_ENCODING.
|
|
104
|
+
// Valid values for |encoding_submethod| are:
|
|
105
|
+
// MESH_EDGEBREAKER_STANDARD_ENCODING
|
|
106
|
+
// MESH_EDGEBREAKER_VALENCE_ENCODING
|
|
107
|
+
// see also compression/config/compression_shared.h.
|
|
108
|
+
void SetEncodingSubmethod(int encoding_submethod);
|
|
109
|
+
|
|
110
|
+
// Sets the desired prediction method for a given attribute. By default,
|
|
111
|
+
// prediction scheme is selected automatically by the encoder using other
|
|
112
|
+
// provided options (such as speed) and input geometry type (mesh, point
|
|
113
|
+
// cloud). This function should be called only when a specific prediction is
|
|
114
|
+
// preferred (e.g., when it is known that the encoder would select a less
|
|
115
|
+
// optimal prediction for the given input data).
|
|
116
|
+
//
|
|
117
|
+
// |prediction_scheme_method| should be one of the entries defined in
|
|
118
|
+
// compression/config/compression_shared.h :
|
|
119
|
+
//
|
|
120
|
+
// PREDICTION_NONE - use no prediction.
|
|
121
|
+
// PREDICTION_DIFFERENCE - delta coding
|
|
122
|
+
// MESH_PREDICTION_PARALLELOGRAM - parallelogram prediction for meshes.
|
|
123
|
+
// MESH_PREDICTION_CONSTRAINED_PARALLELOGRAM
|
|
124
|
+
// - better and more costly version of the parallelogram prediction.
|
|
125
|
+
// MESH_PREDICTION_TEX_COORDS_PORTABLE
|
|
126
|
+
// - specialized predictor for tex coordinates.
|
|
127
|
+
// MESH_PREDICTION_GEOMETRIC_NORMAL
|
|
128
|
+
// - specialized predictor for normal coordinates.
|
|
129
|
+
//
|
|
130
|
+
// Note that in case the desired prediction cannot be used, the default
|
|
131
|
+
// prediction will be automatically used instead.
|
|
132
|
+
Status SetAttributePredictionScheme(int32_t attribute_id,
|
|
133
|
+
int prediction_scheme_method);
|
|
134
|
+
|
|
135
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
136
|
+
// Applies grid quantization to position attribute in point cloud |pc| at
|
|
137
|
+
// |attribute_index| with a given grid |spacing|.
|
|
138
|
+
Status SetAttributeGridQuantization(const PointCloud &pc, int attribute_index,
|
|
139
|
+
float spacing);
|
|
140
|
+
#endif // DRACO_TRANSCODER_SUPPORTED
|
|
141
|
+
|
|
142
|
+
private:
|
|
143
|
+
Status EncodePointCloudToBuffer(const PointCloud &pc,
|
|
144
|
+
EncoderBuffer *out_buffer);
|
|
145
|
+
|
|
146
|
+
Status EncodeMeshToBuffer(const Mesh &m, EncoderBuffer *out_buffer);
|
|
147
|
+
|
|
148
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
149
|
+
// Applies compression options stored in |pc|.
|
|
150
|
+
Status ApplyCompressionOptions(const PointCloud &pc);
|
|
151
|
+
Status ApplyGridQuantization(const PointCloud &pc, int attribute_index);
|
|
152
|
+
#endif // DRACO_TRANSCODER_SUPPORTED
|
|
153
|
+
|
|
154
|
+
const PointCloud *point_cloud_;
|
|
155
|
+
const Mesh *mesh_;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
} // namespace draco
|
|
159
|
+
|
|
160
|
+
#endif // DRACO_COMPRESSION_EXPERT_ENCODE_H_
|
|
@@ -0,0 +1,68 @@
|
|
|
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_DECODER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_MESH_DECODER_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/attributes/mesh_attribute_indices_encoding_data.h"
|
|
19
|
+
#include "draco/compression/point_cloud/point_cloud_decoder.h"
|
|
20
|
+
#include "draco/mesh/mesh.h"
|
|
21
|
+
#include "draco/mesh/mesh_attribute_corner_table.h"
|
|
22
|
+
|
|
23
|
+
namespace draco {
|
|
24
|
+
|
|
25
|
+
// Class that reconstructs a 3D mesh from input data that was encoded by
|
|
26
|
+
// MeshEncoder.
|
|
27
|
+
class MeshDecoder : public PointCloudDecoder {
|
|
28
|
+
public:
|
|
29
|
+
MeshDecoder();
|
|
30
|
+
|
|
31
|
+
EncodedGeometryType GetGeometryType() const override {
|
|
32
|
+
return TRIANGULAR_MESH;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// The main entry point for mesh decoding.
|
|
36
|
+
Status Decode(const DecoderOptions &options, DecoderBuffer *in_buffer,
|
|
37
|
+
Mesh *out_mesh);
|
|
38
|
+
|
|
39
|
+
// Returns the base connectivity of the decoded mesh (or nullptr if it is not
|
|
40
|
+
// initialized).
|
|
41
|
+
virtual const CornerTable *GetCornerTable() const { return nullptr; }
|
|
42
|
+
|
|
43
|
+
// Returns the attribute connectivity data or nullptr if it does not exist.
|
|
44
|
+
virtual const MeshAttributeCornerTable *GetAttributeCornerTable(
|
|
45
|
+
int /* att_id */) const {
|
|
46
|
+
return nullptr;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Returns the decoding data for a given attribute or nullptr when the data
|
|
50
|
+
// does not exist.
|
|
51
|
+
virtual const MeshAttributeIndicesEncodingData *GetAttributeEncodingData(
|
|
52
|
+
int /* att_id */) const {
|
|
53
|
+
return nullptr;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Mesh *mesh() const { return mesh_; }
|
|
57
|
+
|
|
58
|
+
protected:
|
|
59
|
+
bool DecodeGeometryData() override;
|
|
60
|
+
virtual bool DecodeConnectivity() = 0;
|
|
61
|
+
|
|
62
|
+
private:
|
|
63
|
+
Mesh *mesh_;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace draco
|
|
67
|
+
|
|
68
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_DECODER_H_
|
|
@@ -0,0 +1,54 @@
|
|
|
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_DECODER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/mesh/mesh_decoder.h"
|
|
19
|
+
#include "draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h"
|
|
20
|
+
#include "draco/draco_features.h"
|
|
21
|
+
|
|
22
|
+
namespace draco {
|
|
23
|
+
|
|
24
|
+
// Class for decoding data encoded by MeshEdgebreakerEncoder.
|
|
25
|
+
class MeshEdgebreakerDecoder : public MeshDecoder {
|
|
26
|
+
public:
|
|
27
|
+
MeshEdgebreakerDecoder();
|
|
28
|
+
|
|
29
|
+
const CornerTable *GetCornerTable() const override {
|
|
30
|
+
return impl_->GetCornerTable();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const MeshAttributeCornerTable *GetAttributeCornerTable(
|
|
34
|
+
int att_id) const override {
|
|
35
|
+
return impl_->GetAttributeCornerTable(att_id);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const MeshAttributeIndicesEncodingData *GetAttributeEncodingData(
|
|
39
|
+
int att_id) const override {
|
|
40
|
+
return impl_->GetAttributeEncodingData(att_id);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protected:
|
|
44
|
+
bool InitializeDecoder() override;
|
|
45
|
+
bool CreateAttributesDecoder(int32_t att_decoder_id) override;
|
|
46
|
+
bool DecodeConnectivity() override;
|
|
47
|
+
bool OnAttributesDecoded() override;
|
|
48
|
+
|
|
49
|
+
std::unique_ptr<MeshEdgebreakerDecoderImplInterface> impl_;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
} // namespace draco
|
|
53
|
+
|
|
54
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_H_
|
|
@@ -0,0 +1,228 @@
|
|
|
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_DECODER_IMPL_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_IMPL_H_
|
|
17
|
+
|
|
18
|
+
#include <unordered_map>
|
|
19
|
+
#include <unordered_set>
|
|
20
|
+
|
|
21
|
+
#include "draco/compression/attributes/mesh_attribute_indices_encoding_data.h"
|
|
22
|
+
#include "draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h"
|
|
23
|
+
#include "draco/compression/mesh/mesh_edgebreaker_shared.h"
|
|
24
|
+
#include "draco/compression/mesh/traverser/mesh_traversal_sequencer.h"
|
|
25
|
+
#include "draco/core/decoder_buffer.h"
|
|
26
|
+
#include "draco/draco_features.h"
|
|
27
|
+
#include "draco/mesh/corner_table.h"
|
|
28
|
+
#include "draco/mesh/mesh_attribute_corner_table.h"
|
|
29
|
+
|
|
30
|
+
namespace draco {
|
|
31
|
+
|
|
32
|
+
// Implementation of the edgebreaker decoder that decodes data encoded with the
|
|
33
|
+
// MeshEdgebreakerEncoderImpl class. The implementation of the decoder is based
|
|
34
|
+
// on the algorithm presented in Isenburg et al'02 "Spirale Reversi: Reverse
|
|
35
|
+
// decoding of the Edgebreaker encoding". Note that the encoding is still based
|
|
36
|
+
// on the standard edgebreaker method as presented in "3D Compression
|
|
37
|
+
// Made Simple: Edgebreaker on a Corner-Table" by Rossignac at al.'01.
|
|
38
|
+
// http://www.cc.gatech.edu/~jarek/papers/CornerTableSMI.pdf. One difference is
|
|
39
|
+
// caused by the properties of the spirale reversi algorithm that decodes the
|
|
40
|
+
// symbols from the last one to the first one. To make the decoding more
|
|
41
|
+
// efficient, we encode all symbols in the reverse order, therefore the decoder
|
|
42
|
+
// can process them one by one.
|
|
43
|
+
// The main advantage of the spirale reversi method is that the partially
|
|
44
|
+
// decoded mesh has valid connectivity data at any time during the decoding
|
|
45
|
+
// process (valid with respect to the decoded portion of the mesh). The standard
|
|
46
|
+
// Edgebreaker decoder used two passes (forward decoding + zipping) which not
|
|
47
|
+
// only prevented us from having a valid connectivity but it was also slower.
|
|
48
|
+
// The main benefit of having the valid connectivity is that we can use the
|
|
49
|
+
// known connectivity to predict encoded symbols that can improve the
|
|
50
|
+
// compression rate.
|
|
51
|
+
template <class TraversalDecoderT>
|
|
52
|
+
class MeshEdgebreakerDecoderImpl : public MeshEdgebreakerDecoderImplInterface {
|
|
53
|
+
public:
|
|
54
|
+
MeshEdgebreakerDecoderImpl();
|
|
55
|
+
bool Init(MeshEdgebreakerDecoder *decoder) override;
|
|
56
|
+
|
|
57
|
+
const MeshAttributeCornerTable *GetAttributeCornerTable(
|
|
58
|
+
int att_id) const override;
|
|
59
|
+
const MeshAttributeIndicesEncodingData *GetAttributeEncodingData(
|
|
60
|
+
int att_id) const override;
|
|
61
|
+
|
|
62
|
+
bool CreateAttributesDecoder(int32_t att_decoder_id) override;
|
|
63
|
+
bool DecodeConnectivity() override;
|
|
64
|
+
bool OnAttributesDecoded() override;
|
|
65
|
+
MeshEdgebreakerDecoder *GetDecoder() const override { return decoder_; }
|
|
66
|
+
const CornerTable *GetCornerTable() const override {
|
|
67
|
+
return corner_table_.get();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
// Creates a vertex traversal sequencer for the specified |TraverserT| type.
|
|
72
|
+
template <class TraverserT>
|
|
73
|
+
std::unique_ptr<PointsSequencer> CreateVertexTraversalSequencer(
|
|
74
|
+
MeshAttributeIndicesEncodingData *encoding_data);
|
|
75
|
+
|
|
76
|
+
// Decodes connectivity between vertices (vertex indices).
|
|
77
|
+
// Returns the number of vertices created by the decoder or -1 on error.
|
|
78
|
+
int DecodeConnectivity(int num_symbols);
|
|
79
|
+
|
|
80
|
+
// Returns true if the current symbol was part of a topology split event. This
|
|
81
|
+
// means that the current face was connected to the left edge of a face
|
|
82
|
+
// encoded with the TOPOLOGY_S symbol. |out_symbol_edge| can be used to
|
|
83
|
+
// identify which edge of the source symbol was connected to the TOPOLOGY_S
|
|
84
|
+
// symbol.
|
|
85
|
+
bool IsTopologySplit(int encoder_symbol_id, EdgeFaceName *out_face_edge,
|
|
86
|
+
int *out_encoder_split_symbol_id) {
|
|
87
|
+
if (topology_split_data_.size() == 0) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (topology_split_data_.back().source_symbol_id >
|
|
91
|
+
static_cast<uint32_t>(encoder_symbol_id)) {
|
|
92
|
+
// Something is wrong; if the desired source symbol is greater than the
|
|
93
|
+
// current encoder_symbol_id, we missed it, or the input was tampered
|
|
94
|
+
// (|encoder_symbol_id| keeps decreasing).
|
|
95
|
+
// Return invalid symbol id to notify the decoder that there was an
|
|
96
|
+
// error.
|
|
97
|
+
*out_encoder_split_symbol_id = -1;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
if (topology_split_data_.back().source_symbol_id != encoder_symbol_id) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
*out_face_edge =
|
|
104
|
+
static_cast<EdgeFaceName>(topology_split_data_.back().source_edge);
|
|
105
|
+
*out_encoder_split_symbol_id = topology_split_data_.back().split_symbol_id;
|
|
106
|
+
// Remove the latest split event.
|
|
107
|
+
topology_split_data_.pop_back();
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Decodes event data for hole and topology split events and stores them for
|
|
112
|
+
// future use.
|
|
113
|
+
// Returns the number of parsed bytes, or -1 on error.
|
|
114
|
+
int32_t DecodeHoleAndTopologySplitEvents(DecoderBuffer *decoder_buffer);
|
|
115
|
+
|
|
116
|
+
// Decodes all non-position attribute connectivity on the currently
|
|
117
|
+
// processed face.
|
|
118
|
+
#ifdef DRACO_BACKWARDS_COMPATIBILITY_SUPPORTED
|
|
119
|
+
bool DecodeAttributeConnectivitiesOnFaceLegacy(CornerIndex corner);
|
|
120
|
+
#endif
|
|
121
|
+
bool DecodeAttributeConnectivitiesOnFace(CornerIndex corner);
|
|
122
|
+
|
|
123
|
+
// Initializes mapping between corners and point ids.
|
|
124
|
+
bool AssignPointsToCorners(int num_connectivity_verts);
|
|
125
|
+
|
|
126
|
+
bool IsFaceVisited(CornerIndex corner_id) const {
|
|
127
|
+
if (corner_id < 0) {
|
|
128
|
+
return true; // Invalid corner signalizes that the face does not exist.
|
|
129
|
+
}
|
|
130
|
+
return visited_faces_[corner_table_->Face(corner_id).value()];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
void SetOppositeCorners(CornerIndex corner_0, CornerIndex corner_1) {
|
|
134
|
+
corner_table_->SetOppositeCorner(corner_0, corner_1);
|
|
135
|
+
corner_table_->SetOppositeCorner(corner_1, corner_0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
MeshEdgebreakerDecoder *decoder_;
|
|
139
|
+
|
|
140
|
+
std::unique_ptr<CornerTable> corner_table_;
|
|
141
|
+
|
|
142
|
+
// Stack used for storing corners that need to be traversed when decoding
|
|
143
|
+
// mesh vertices. New corner is added for each initial face and a split
|
|
144
|
+
// symbol, and one corner is removed when the end symbol is reached.
|
|
145
|
+
// Stored as member variable to prevent frequent memory reallocations when
|
|
146
|
+
// handling meshes with lots of disjoint components. Originally, we used
|
|
147
|
+
// recursive functions to handle this behavior, but that can cause stack
|
|
148
|
+
// memory overflow when compressing huge meshes.
|
|
149
|
+
std::vector<CornerIndex> corner_traversal_stack_;
|
|
150
|
+
|
|
151
|
+
// Array stores the number of visited visited for each mesh traversal.
|
|
152
|
+
std::vector<int> vertex_traversal_length_;
|
|
153
|
+
|
|
154
|
+
// List of decoded topology split events.
|
|
155
|
+
std::vector<TopologySplitEventData> topology_split_data_;
|
|
156
|
+
|
|
157
|
+
// List of decoded hole events.
|
|
158
|
+
std::vector<HoleEventData> hole_event_data_;
|
|
159
|
+
|
|
160
|
+
// Configuration of the initial face for each mesh component.
|
|
161
|
+
std::vector<bool> init_face_configurations_;
|
|
162
|
+
|
|
163
|
+
// Initial corner for each traversal.
|
|
164
|
+
std::vector<CornerIndex> init_corners_;
|
|
165
|
+
|
|
166
|
+
// Id of the last processed input symbol.
|
|
167
|
+
int last_symbol_id_;
|
|
168
|
+
|
|
169
|
+
// Id of the last decoded vertex.
|
|
170
|
+
int last_vert_id_;
|
|
171
|
+
|
|
172
|
+
// Id of the last decoded face.
|
|
173
|
+
int last_face_id_;
|
|
174
|
+
|
|
175
|
+
// Array for marking visited faces.
|
|
176
|
+
std::vector<bool> visited_faces_;
|
|
177
|
+
// Array for marking visited vertices.
|
|
178
|
+
std::vector<bool> visited_verts_;
|
|
179
|
+
// Array for marking vertices on open boundaries.
|
|
180
|
+
std::vector<bool> is_vert_hole_;
|
|
181
|
+
|
|
182
|
+
// The number of new vertices added by the encoder (because of non-manifold
|
|
183
|
+
// vertices on the input mesh).
|
|
184
|
+
// If there are no non-manifold edges/vertices on the input mesh, this should
|
|
185
|
+
// be 0.
|
|
186
|
+
int num_new_vertices_;
|
|
187
|
+
// For every newly added vertex, this array stores it's mapping to the
|
|
188
|
+
// parent vertex id of the encoded mesh.
|
|
189
|
+
std::unordered_map<int, int> new_to_parent_vertex_map_;
|
|
190
|
+
// The number of vertices that were encoded (can be different from the number
|
|
191
|
+
// of vertices of the input mesh).
|
|
192
|
+
int num_encoded_vertices_;
|
|
193
|
+
|
|
194
|
+
// Array for storing the encoded corner ids in the order their associated
|
|
195
|
+
// vertices were decoded.
|
|
196
|
+
std::vector<int32_t> processed_corner_ids_;
|
|
197
|
+
|
|
198
|
+
// Array storing corners in the order they were visited during the
|
|
199
|
+
// connectivity decoding (always storing the tip corner of each newly visited
|
|
200
|
+
// face).
|
|
201
|
+
std::vector<int> processed_connectivity_corners_;
|
|
202
|
+
|
|
203
|
+
MeshAttributeIndicesEncodingData pos_encoding_data_;
|
|
204
|
+
|
|
205
|
+
// Id of an attributes decoder that uses |pos_encoding_data_|.
|
|
206
|
+
int pos_data_decoder_id_;
|
|
207
|
+
|
|
208
|
+
// Data for non-position attributes used by the decoder.
|
|
209
|
+
struct AttributeData {
|
|
210
|
+
AttributeData() : decoder_id(-1), is_connectivity_used(true) {}
|
|
211
|
+
// Id of the attribute decoder that was used to decode this attribute data.
|
|
212
|
+
int decoder_id;
|
|
213
|
+
MeshAttributeCornerTable connectivity_data;
|
|
214
|
+
// Flag that can mark the connectivity_data invalid. In such case the base
|
|
215
|
+
// corner table of the mesh should be used instead.
|
|
216
|
+
bool is_connectivity_used;
|
|
217
|
+
MeshAttributeIndicesEncodingData encoding_data;
|
|
218
|
+
// Opposite corners to attribute seam edges.
|
|
219
|
+
std::vector<int32_t> attribute_seam_corners;
|
|
220
|
+
};
|
|
221
|
+
std::vector<AttributeData> attribute_data_;
|
|
222
|
+
|
|
223
|
+
TraversalDecoderT traversal_decoder_;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
} // namespace draco
|
|
227
|
+
|
|
228
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_IMPL_H_
|
|
@@ -0,0 +1,47 @@
|
|
|
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_DECODER_IMPL_INTERFACE_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_IMPL_INTERFACE_H_
|
|
17
|
+
|
|
18
|
+
#include "draco/compression/attributes/mesh_attribute_indices_encoding_data.h"
|
|
19
|
+
#include "draco/mesh/mesh_attribute_corner_table.h"
|
|
20
|
+
|
|
21
|
+
namespace draco {
|
|
22
|
+
|
|
23
|
+
// Forward declaration is necessary here to avoid circular dependencies.
|
|
24
|
+
class MeshEdgebreakerDecoder;
|
|
25
|
+
|
|
26
|
+
// Abstract interface used by MeshEdgebreakerDecoder to interact with the actual
|
|
27
|
+
// implementation of the edgebreaker decoding method.
|
|
28
|
+
class MeshEdgebreakerDecoderImplInterface {
|
|
29
|
+
public:
|
|
30
|
+
virtual ~MeshEdgebreakerDecoderImplInterface() = default;
|
|
31
|
+
virtual bool Init(MeshEdgebreakerDecoder *decoder) = 0;
|
|
32
|
+
|
|
33
|
+
virtual const MeshAttributeCornerTable *GetAttributeCornerTable(
|
|
34
|
+
int att_id) const = 0;
|
|
35
|
+
virtual const MeshAttributeIndicesEncodingData *GetAttributeEncodingData(
|
|
36
|
+
int att_id) const = 0;
|
|
37
|
+
virtual bool CreateAttributesDecoder(int32_t att_decoder_id) = 0;
|
|
38
|
+
virtual bool DecodeConnectivity() = 0;
|
|
39
|
+
virtual bool OnAttributesDecoded() = 0;
|
|
40
|
+
|
|
41
|
+
virtual MeshEdgebreakerDecoder *GetDecoder() const = 0;
|
|
42
|
+
virtual const CornerTable *GetCornerTable() const = 0;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace draco
|
|
46
|
+
|
|
47
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_DECODER_IMPL_INTERFACE_H_
|
|
@@ -0,0 +1,73 @@
|
|
|
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_ENCODER_H_
|
|
16
|
+
#define DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_ENCODER_H_
|
|
17
|
+
|
|
18
|
+
#include <unordered_map>
|
|
19
|
+
|
|
20
|
+
#include "draco/compression/mesh/mesh_edgebreaker_encoder_impl_interface.h"
|
|
21
|
+
#include "draco/compression/mesh/mesh_edgebreaker_shared.h"
|
|
22
|
+
#include "draco/compression/mesh/mesh_encoder.h"
|
|
23
|
+
#include "draco/mesh/corner_table.h"
|
|
24
|
+
|
|
25
|
+
namespace draco {
|
|
26
|
+
|
|
27
|
+
// Class implements the edge breaker geometry compression method as described
|
|
28
|
+
// in "3D Compression Made Simple: Edgebreaker on a Corner-Table" by Rossignac
|
|
29
|
+
// at al.'01. http://www.cc.gatech.edu/~jarek/papers/CornerTableSMI.pdf
|
|
30
|
+
class MeshEdgebreakerEncoder : public MeshEncoder {
|
|
31
|
+
public:
|
|
32
|
+
MeshEdgebreakerEncoder();
|
|
33
|
+
|
|
34
|
+
const CornerTable *GetCornerTable() const override {
|
|
35
|
+
return impl_->GetCornerTable();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const MeshAttributeCornerTable *GetAttributeCornerTable(
|
|
39
|
+
int att_id) const override {
|
|
40
|
+
return impl_->GetAttributeCornerTable(att_id);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const MeshAttributeIndicesEncodingData *GetAttributeEncodingData(
|
|
44
|
+
int att_id) const override {
|
|
45
|
+
return impl_->GetAttributeEncodingData(att_id);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
uint8_t GetEncodingMethod() const override {
|
|
49
|
+
return MESH_EDGEBREAKER_ENCODING;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
protected:
|
|
53
|
+
bool InitializeEncoder() override;
|
|
54
|
+
Status EncodeConnectivity() override;
|
|
55
|
+
bool GenerateAttributesEncoder(int32_t att_id) override;
|
|
56
|
+
bool EncodeAttributesEncoderIdentifier(int32_t att_encoder_id) override;
|
|
57
|
+
void ComputeNumberOfEncodedPoints() override;
|
|
58
|
+
void ComputeNumberOfEncodedFaces() override;
|
|
59
|
+
|
|
60
|
+
private:
|
|
61
|
+
// The actual implementation of the edge breaker method. The implementations
|
|
62
|
+
// are in general specializations of a template class
|
|
63
|
+
// MeshEdgebreakerEncoderImpl where the template arguments control encoding
|
|
64
|
+
// of the connectivity data. The actual implementation is selected in this
|
|
65
|
+
// class based on the provided encoding options. Because this choice is done
|
|
66
|
+
// in run-time, the actual implementation has to be hidden behind the
|
|
67
|
+
// abstract interface MeshEdgebreakerEncoderImplInterface.
|
|
68
|
+
std::unique_ptr<MeshEdgebreakerEncoderImplInterface> impl_;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace draco
|
|
72
|
+
|
|
73
|
+
#endif // DRACO_COMPRESSION_MESH_MESH_EDGEBREAKER_ENCODER_H_
|