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.
Files changed (214) hide show
  1. bin/draco_decoder.exe +0 -0
  2. bin/draco_encoder.exe +0 -0
  3. dracox/__init__.py +252 -0
  4. dracox/dracox_ext.cp39-win_amd64.pyd +0 -0
  5. dracox-0.0.1.dist-info/METADATA +14 -0
  6. dracox-0.0.1.dist-info/RECORD +214 -0
  7. dracox-0.0.1.dist-info/WHEEL +5 -0
  8. include/draco/animation/keyframe_animation.h +107 -0
  9. include/draco/animation/keyframe_animation_decoder.h +34 -0
  10. include/draco/animation/keyframe_animation_encoder.h +39 -0
  11. include/draco/attributes/attribute_octahedron_transform.h +81 -0
  12. include/draco/attributes/attribute_quantization_transform.h +102 -0
  13. include/draco/attributes/attribute_transform.h +76 -0
  14. include/draco/attributes/attribute_transform_data.h +71 -0
  15. include/draco/attributes/attribute_transform_type.h +30 -0
  16. include/draco/attributes/geometry_attribute.h +541 -0
  17. include/draco/attributes/geometry_indices.h +54 -0
  18. include/draco/attributes/point_attribute.h +196 -0
  19. include/draco/compression/attributes/attributes_decoder.h +97 -0
  20. include/draco/compression/attributes/attributes_decoder_interface.h +62 -0
  21. include/draco/compression/attributes/attributes_encoder.h +154 -0
  22. include/draco/compression/attributes/kd_tree_attributes_decoder.h +50 -0
  23. include/draco/compression/attributes/kd_tree_attributes_encoder.h +51 -0
  24. include/draco/compression/attributes/kd_tree_attributes_shared.h +28 -0
  25. include/draco/compression/attributes/linear_sequencer.h +51 -0
  26. include/draco/compression/attributes/mesh_attribute_indices_encoding_data.h +58 -0
  27. include/draco/compression/attributes/normal_compression_utils.h +372 -0
  28. include/draco/compression/attributes/point_d_vector.h +288 -0
  29. include/draco/compression/attributes/points_sequencer.h +63 -0
  30. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_decoder.h +236 -0
  31. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_encoder.h +413 -0
  32. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_constrained_multi_parallelogram_shared.h +34 -0
  33. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_data.h +72 -0
  34. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_decoder.h +46 -0
  35. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_encoder.h +46 -0
  36. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_decoder.h +176 -0
  37. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_encoder.h +180 -0
  38. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_area.h +117 -0
  39. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_geometric_normal_predictor_base.h +96 -0
  40. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_decoder.h +128 -0
  41. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_multi_parallelogram_encoder.h +133 -0
  42. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_encoder.h +111 -0
  43. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_parallelogram_shared.h +78 -0
  44. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_decoder.h +372 -0
  45. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_encoder.h +318 -0
  46. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_decoder.h +143 -0
  47. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_encoder.h +136 -0
  48. include/draco/compression/attributes/prediction_schemes/mesh_prediction_scheme_tex_coords_portable_predictor.h +282 -0
  49. include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder.h +90 -0
  50. include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_factory.h +194 -0
  51. include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoder_interface.h +53 -0
  52. include/draco/compression/attributes/prediction_schemes/prediction_scheme_decoding_transform.h +65 -0
  53. include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_decoder.h +65 -0
  54. include/draco/compression/attributes/prediction_schemes/prediction_scheme_delta_encoder.h +69 -0
  55. include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder.h +90 -0
  56. include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_factory.h +134 -0
  57. include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoder_interface.h +55 -0
  58. include/draco/compression/attributes/prediction_schemes/prediction_scheme_encoding_transform.h +77 -0
  59. include/draco/compression/attributes/prediction_schemes/prediction_scheme_factory.h +85 -0
  60. include/draco/compression/attributes/prediction_schemes/prediction_scheme_interface.h +60 -0
  61. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_decoding_transform.h +118 -0
  62. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_encoding_transform.h +116 -0
  63. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_canonicalized_transform_base.h +102 -0
  64. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_decoding_transform.h +115 -0
  65. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_encoding_transform.h +105 -0
  66. include/draco/compression/attributes/prediction_schemes/prediction_scheme_normal_octahedron_transform_base.h +90 -0
  67. include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_decoding_transform.h +88 -0
  68. include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_encoding_transform.h +81 -0
  69. include/draco/compression/attributes/prediction_schemes/prediction_scheme_wrap_transform_base.h +120 -0
  70. include/draco/compression/attributes/sequential_attribute_decoder.h +86 -0
  71. include/draco/compression/attributes/sequential_attribute_decoders_controller.h +61 -0
  72. include/draco/compression/attributes/sequential_attribute_encoder.h +134 -0
  73. include/draco/compression/attributes/sequential_attribute_encoders_controller.h +115 -0
  74. include/draco/compression/attributes/sequential_integer_attribute_decoder.h +76 -0
  75. include/draco/compression/attributes/sequential_integer_attribute_encoder.h +67 -0
  76. include/draco/compression/attributes/sequential_normal_attribute_decoder.h +83 -0
  77. include/draco/compression/attributes/sequential_normal_attribute_encoder.h +82 -0
  78. include/draco/compression/attributes/sequential_quantization_attribute_decoder.h +52 -0
  79. include/draco/compression/attributes/sequential_quantization_attribute_encoder.h +52 -0
  80. include/draco/compression/bit_coders/adaptive_rans_bit_coding_shared.h +43 -0
  81. include/draco/compression/bit_coders/adaptive_rans_bit_decoder.h +54 -0
  82. include/draco/compression/bit_coders/adaptive_rans_bit_encoder.h +61 -0
  83. include/draco/compression/bit_coders/direct_bit_decoder.h +89 -0
  84. include/draco/compression/bit_coders/direct_bit_encoder.h +89 -0
  85. include/draco/compression/bit_coders/folded_integer_bit_decoder.h +77 -0
  86. include/draco/compression/bit_coders/folded_integer_bit_encoder.h +82 -0
  87. include/draco/compression/bit_coders/rans_bit_decoder.h +55 -0
  88. include/draco/compression/bit_coders/rans_bit_encoder.h +57 -0
  89. include/draco/compression/bit_coders/symbol_bit_decoder.h +36 -0
  90. include/draco/compression/bit_coders/symbol_bit_encoder.h +36 -0
  91. include/draco/compression/config/compression_shared.h +155 -0
  92. include/draco/compression/config/decoder_options.h +34 -0
  93. include/draco/compression/config/draco_options.h +249 -0
  94. include/draco/compression/config/encoder_options.h +101 -0
  95. include/draco/compression/config/encoding_features.h +39 -0
  96. include/draco/compression/decode.h +80 -0
  97. include/draco/compression/draco_compression_options.h +141 -0
  98. include/draco/compression/encode.h +139 -0
  99. include/draco/compression/encode_base.h +131 -0
  100. include/draco/compression/entropy/ans.h +526 -0
  101. include/draco/compression/entropy/rans_symbol_coding.h +53 -0
  102. include/draco/compression/entropy/rans_symbol_decoder.h +171 -0
  103. include/draco/compression/entropy/rans_symbol_encoder.h +290 -0
  104. include/draco/compression/entropy/shannon_entropy.h +110 -0
  105. include/draco/compression/entropy/symbol_decoding.h +29 -0
  106. include/draco/compression/entropy/symbol_encoding.h +47 -0
  107. include/draco/compression/expert_encode.h +160 -0
  108. include/draco/compression/mesh/mesh_decoder.h +68 -0
  109. include/draco/compression/mesh/mesh_edgebreaker_decoder.h +54 -0
  110. include/draco/compression/mesh/mesh_edgebreaker_decoder_impl.h +228 -0
  111. include/draco/compression/mesh/mesh_edgebreaker_decoder_impl_interface.h +47 -0
  112. include/draco/compression/mesh/mesh_edgebreaker_encoder.h +73 -0
  113. include/draco/compression/mesh/mesh_edgebreaker_encoder_impl.h +209 -0
  114. include/draco/compression/mesh/mesh_edgebreaker_encoder_impl_interface.h +57 -0
  115. include/draco/compression/mesh/mesh_edgebreaker_shared.h +129 -0
  116. include/draco/compression/mesh/mesh_edgebreaker_traversal_decoder.h +201 -0
  117. include/draco/compression/mesh/mesh_edgebreaker_traversal_encoder.h +139 -0
  118. include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_decoder.h +134 -0
  119. include/draco/compression/mesh/mesh_edgebreaker_traversal_predictive_encoder.h +172 -0
  120. include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_decoder.h +219 -0
  121. include/draco/compression/mesh/mesh_edgebreaker_traversal_valence_encoder.h +226 -0
  122. include/draco/compression/mesh/mesh_encoder.h +84 -0
  123. include/draco/compression/mesh/mesh_sequential_decoder.h +39 -0
  124. include/draco/compression/mesh/mesh_sequential_encoder.h +56 -0
  125. include/draco/compression/mesh/traverser/depth_first_traverser.h +172 -0
  126. include/draco/compression/mesh/traverser/max_prediction_degree_traverser.h +226 -0
  127. include/draco/compression/mesh/traverser/mesh_attribute_indices_encoding_observer.h +76 -0
  128. include/draco/compression/mesh/traverser/mesh_traversal_sequencer.h +113 -0
  129. include/draco/compression/mesh/traverser/traverser_base.h +87 -0
  130. include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_decoder.h +369 -0
  131. include/draco/compression/point_cloud/algorithms/dynamic_integer_points_kd_tree_encoder.h +372 -0
  132. include/draco/compression/point_cloud/algorithms/float_points_tree_decoder.h +141 -0
  133. include/draco/compression/point_cloud/algorithms/float_points_tree_encoder.h +126 -0
  134. include/draco/compression/point_cloud/algorithms/point_cloud_compression_method.h +34 -0
  135. include/draco/compression/point_cloud/algorithms/point_cloud_types.h +76 -0
  136. include/draco/compression/point_cloud/algorithms/quantize_points_3.h +84 -0
  137. include/draco/compression/point_cloud/algorithms/queuing_policy.h +75 -0
  138. include/draco/compression/point_cloud/point_cloud_decoder.h +118 -0
  139. include/draco/compression/point_cloud/point_cloud_encoder.h +158 -0
  140. include/draco/compression/point_cloud/point_cloud_kd_tree_decoder.h +31 -0
  141. include/draco/compression/point_cloud/point_cloud_kd_tree_encoder.h +45 -0
  142. include/draco/compression/point_cloud/point_cloud_sequential_decoder.h +33 -0
  143. include/draco/compression/point_cloud/point_cloud_sequential_encoder.h +43 -0
  144. include/draco/core/bit_utils.h +127 -0
  145. include/draco/core/bounding_box.h +77 -0
  146. include/draco/core/constants.h +6 -0
  147. include/draco/core/cycle_timer.h +51 -0
  148. include/draco/core/data_buffer.h +82 -0
  149. include/draco/core/decoder_buffer.h +216 -0
  150. include/draco/core/divide.h +42 -0
  151. include/draco/core/draco_index_type.h +184 -0
  152. include/draco/core/draco_index_type_vector.h +90 -0
  153. include/draco/core/draco_types.h +52 -0
  154. include/draco/core/draco_version.h +25 -0
  155. include/draco/core/encoder_buffer.h +152 -0
  156. include/draco/core/hash_utils.h +64 -0
  157. include/draco/core/macros.h +124 -0
  158. include/draco/core/math_utils.h +79 -0
  159. include/draco/core/options.h +151 -0
  160. include/draco/core/quantization_utils.h +82 -0
  161. include/draco/core/status.h +83 -0
  162. include/draco/core/status_or.h +81 -0
  163. include/draco/core/varint_decoding.h +81 -0
  164. include/draco/core/varint_encoding.h +61 -0
  165. include/draco/core/vector_d.h +355 -0
  166. include/draco/draco_features.h +25 -0
  167. include/draco/io/file_reader_factory.h +34 -0
  168. include/draco/io/file_reader_interface.h +32 -0
  169. include/draco/io/file_utils.h +86 -0
  170. include/draco/io/file_writer_factory.h +34 -0
  171. include/draco/io/file_writer_interface.h +26 -0
  172. include/draco/io/file_writer_utils.h +38 -0
  173. include/draco/io/mesh_io.h +107 -0
  174. include/draco/io/obj_decoder.h +147 -0
  175. include/draco/io/obj_encoder.h +107 -0
  176. include/draco/io/parser_utils.h +66 -0
  177. include/draco/io/ply_decoder.h +69 -0
  178. include/draco/io/ply_encoder.h +54 -0
  179. include/draco/io/ply_property_reader.h +96 -0
  180. include/draco/io/ply_property_writer.h +94 -0
  181. include/draco/io/ply_reader.h +155 -0
  182. include/draco/io/point_cloud_io.h +89 -0
  183. include/draco/io/stdio_file_reader.h +48 -0
  184. include/draco/io/stdio_file_writer.h +42 -0
  185. include/draco/io/stl_decoder.h +38 -0
  186. include/draco/io/stl_encoder.h +52 -0
  187. include/draco/mesh/corner_table.h +397 -0
  188. include/draco/mesh/corner_table_iterators.h +309 -0
  189. include/draco/mesh/mesh.h +378 -0
  190. include/draco/mesh/mesh_are_equivalent.h +71 -0
  191. include/draco/mesh/mesh_attribute_corner_table.h +202 -0
  192. include/draco/mesh/mesh_cleanup.h +61 -0
  193. include/draco/mesh/mesh_features.h +93 -0
  194. include/draco/mesh/mesh_indices.h +37 -0
  195. include/draco/mesh/mesh_misc_functions.h +105 -0
  196. include/draco/mesh/mesh_stripifier.h +258 -0
  197. include/draco/mesh/triangle_soup_mesh_builder.h +134 -0
  198. include/draco/mesh/valence_cache.h +142 -0
  199. include/draco/metadata/geometry_metadata.h +142 -0
  200. include/draco/metadata/metadata.h +209 -0
  201. include/draco/metadata/metadata_decoder.h +42 -0
  202. include/draco/metadata/metadata_encoder.h +41 -0
  203. include/draco/metadata/property_attribute.h +107 -0
  204. include/draco/metadata/property_table.h +222 -0
  205. include/draco/metadata/structural_metadata.h +78 -0
  206. include/draco/metadata/structural_metadata_schema.h +118 -0
  207. include/draco/point_cloud/point_cloud.h +289 -0
  208. include/draco/point_cloud/point_cloud_builder.h +101 -0
  209. lib/draco.lib +0 -0
  210. lib/pkgconfig/draco.pc +6 -0
  211. share/cmake/draco/draco-config-version.cmake +43 -0
  212. share/cmake/draco/draco-config.cmake +27 -0
  213. share/cmake/draco/draco-targets-release.cmake +19 -0
  214. share/cmake/draco/draco-targets.cmake +107 -0
@@ -0,0 +1,142 @@
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_MESH_VALENCE_CACHE_H_
16
+ #define DRACO_MESH_VALENCE_CACHE_H_
17
+
18
+ #include "draco/attributes/geometry_indices.h"
19
+ #include "draco/core/draco_index_type_vector.h"
20
+ #include "draco/core/macros.h"
21
+
22
+ namespace draco {
23
+
24
+ // ValenceCache provides support for the caching of valences off of some kind of
25
+ // CornerTable 'type' of class.
26
+ // No valences should be queried before Caching is
27
+ // performed and values should be removed/recached when changes to the
28
+ // underlying mesh are taking place.
29
+
30
+ template <class CornerTableT>
31
+ class ValenceCache {
32
+ const CornerTableT &table_;
33
+
34
+ public:
35
+ explicit ValenceCache(const CornerTableT &table) : table_(table) {}
36
+
37
+ // Do not call before CacheValences() / CacheValencesInaccurate().
38
+ inline int8_t ValenceFromCacheInaccurate(CornerIndex c) const {
39
+ if (c == kInvalidCornerIndex) {
40
+ return -1;
41
+ }
42
+ return ValenceFromCacheInaccurate(table_.Vertex(c));
43
+ }
44
+ inline int32_t ValenceFromCache(CornerIndex c) const {
45
+ if (c == kInvalidCornerIndex) {
46
+ return -1;
47
+ }
48
+ return ValenceFromCache(table_.Vertex(c));
49
+ }
50
+
51
+ inline int32_t ConfidentValenceFromCache(VertexIndex v) const {
52
+ DRACO_DCHECK_LT(v.value(), table_.num_vertices());
53
+ DRACO_DCHECK_EQ(vertex_valence_cache_32_bit_.size(), table_.num_vertices());
54
+ return vertex_valence_cache_32_bit_[v];
55
+ }
56
+
57
+ // Collect the valence for all vertices so they can be reused later. The
58
+ // 'inaccurate' versions of this family of functions clips the true valence
59
+ // of the vertices to 8 signed bits as a space optimization. This clipping
60
+ // will lead to occasionally wrong results. If accurate results are required
61
+ // under all circumstances, do not use the 'inaccurate' version or else
62
+ // use it and fetch the correct result in the event the value appears clipped.
63
+ // The topology of the mesh should be a constant when Valence Cache functions
64
+ // are being used. Modification of the mesh while cache(s) are filled will
65
+ // not guarantee proper results on subsequent calls unless they are rebuilt.
66
+ void CacheValencesInaccurate() const {
67
+ if (vertex_valence_cache_8_bit_.size() == 0) {
68
+ const VertexIndex vertex_count = VertexIndex(table_.num_vertices());
69
+ vertex_valence_cache_8_bit_.resize(vertex_count.value());
70
+ for (VertexIndex v = VertexIndex(0); v < vertex_count; v += 1) {
71
+ vertex_valence_cache_8_bit_[v] = static_cast<int8_t>(
72
+ (std::min)(static_cast<int32_t>(std::numeric_limits<int8_t>::max()),
73
+ table_.Valence(v)));
74
+ }
75
+ }
76
+ }
77
+ void CacheValences() const {
78
+ if (vertex_valence_cache_32_bit_.size() == 0) {
79
+ const VertexIndex vertex_count = VertexIndex(table_.num_vertices());
80
+ vertex_valence_cache_32_bit_.resize(vertex_count.value());
81
+ for (VertexIndex v = VertexIndex(0); v < vertex_count; v += 1) {
82
+ vertex_valence_cache_32_bit_[v] = table_.Valence(v);
83
+ }
84
+ }
85
+ }
86
+
87
+ inline int8_t ConfidentValenceFromCacheInaccurate(CornerIndex c) const {
88
+ DRACO_DCHECK_GE(c.value(), 0);
89
+ return ConfidentValenceFromCacheInaccurate(table_.ConfidentVertex(c));
90
+ }
91
+ inline int32_t ConfidentValenceFromCache(CornerIndex c) const {
92
+ DRACO_DCHECK_GE(c.value(), 0);
93
+ return ConfidentValenceFromCache(table_.ConfidentVertex(c));
94
+ }
95
+ inline int8_t ValenceFromCacheInaccurate(VertexIndex v) const {
96
+ DRACO_DCHECK_EQ(vertex_valence_cache_8_bit_.size(), table_.num_vertices());
97
+ if (v == kInvalidVertexIndex || v.value() >= table_.num_vertices()) {
98
+ return -1;
99
+ }
100
+ return ConfidentValenceFromCacheInaccurate(v);
101
+ }
102
+ inline int8_t ConfidentValenceFromCacheInaccurate(VertexIndex v) const {
103
+ DRACO_DCHECK_LT(v.value(), table_.num_vertices());
104
+ DRACO_DCHECK_EQ(vertex_valence_cache_8_bit_.size(), table_.num_vertices());
105
+ return vertex_valence_cache_8_bit_[v];
106
+ }
107
+
108
+ // TODO(draco-eng) Add unit tests for ValenceCache functions.
109
+ inline int32_t ValenceFromCache(VertexIndex v) const {
110
+ DRACO_DCHECK_EQ(vertex_valence_cache_32_bit_.size(), table_.num_vertices());
111
+ if (v == kInvalidVertexIndex || v.value() >= table_.num_vertices()) {
112
+ return -1;
113
+ }
114
+ return ConfidentValenceFromCache(v);
115
+ }
116
+
117
+ // Clear the cache of valences and deallocate the memory.
118
+ void ClearValenceCacheInaccurate() const {
119
+ vertex_valence_cache_8_bit_.clear();
120
+ // Force erasure.
121
+ IndexTypeVector<VertexIndex, int8_t>().swap(vertex_valence_cache_8_bit_);
122
+ }
123
+ void ClearValenceCache() const {
124
+ vertex_valence_cache_32_bit_.clear();
125
+ // Force erasure.
126
+ IndexTypeVector<VertexIndex, int32_t>().swap(vertex_valence_cache_32_bit_);
127
+ }
128
+
129
+ bool IsCacheEmpty() const {
130
+ return vertex_valence_cache_8_bit_.size() == 0 &&
131
+ vertex_valence_cache_32_bit_.size() == 0;
132
+ }
133
+
134
+ private:
135
+ // Retain valences and clip them to char size.
136
+ mutable IndexTypeVector<VertexIndex, int8_t> vertex_valence_cache_8_bit_;
137
+ mutable IndexTypeVector<VertexIndex, int32_t> vertex_valence_cache_32_bit_;
138
+ };
139
+
140
+ } // namespace draco
141
+
142
+ #endif // DRACO_MESH_VALENCE_CACHE_H_
@@ -0,0 +1,142 @@
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_METADATA_GEOMETRY_METADATA_H_
16
+ #define DRACO_METADATA_GEOMETRY_METADATA_H_
17
+
18
+ #include "draco/metadata/metadata.h"
19
+
20
+ namespace draco {
21
+
22
+ // Class for representing specifically metadata of attributes. It must have an
23
+ // attribute id which should be identical to it's counterpart attribute in
24
+ // the point cloud it belongs to.
25
+ class AttributeMetadata : public Metadata {
26
+ public:
27
+ AttributeMetadata() : att_unique_id_(0) {}
28
+ AttributeMetadata(const AttributeMetadata &metadata);
29
+ explicit AttributeMetadata(const Metadata &metadata)
30
+ : Metadata(metadata), att_unique_id_(0) {}
31
+
32
+ void set_att_unique_id(uint32_t att_unique_id) {
33
+ att_unique_id_ = att_unique_id;
34
+ }
35
+ // The unique id of the attribute that this metadata belongs to.
36
+ uint32_t att_unique_id() const { return att_unique_id_; }
37
+
38
+ private:
39
+ uint32_t att_unique_id_;
40
+
41
+ friend struct AttributeMetadataHasher;
42
+ friend class PointCloud;
43
+ };
44
+
45
+ // Functor for computing a hash from data stored in a AttributeMetadata class.
46
+ struct AttributeMetadataHasher {
47
+ size_t operator()(const AttributeMetadata &metadata) const {
48
+ size_t hash = metadata.att_unique_id_;
49
+ MetadataHasher metadata_hasher;
50
+ hash = HashCombine(metadata_hasher(static_cast<const Metadata &>(metadata)),
51
+ hash);
52
+ return hash;
53
+ }
54
+ };
55
+
56
+ // Class for representing the metadata for a point cloud. It could have a list
57
+ // of attribute metadata.
58
+ class GeometryMetadata : public Metadata {
59
+ public:
60
+ GeometryMetadata() {}
61
+ GeometryMetadata(const GeometryMetadata &metadata);
62
+ explicit GeometryMetadata(const Metadata &metadata) : Metadata(metadata) {}
63
+
64
+ const AttributeMetadata *GetAttributeMetadataByStringEntry(
65
+ const std::string &entry_name, const std::string &entry_value) const;
66
+ bool AddAttributeMetadata(std::unique_ptr<AttributeMetadata> att_metadata);
67
+
68
+ void DeleteAttributeMetadataByUniqueId(int32_t att_unique_id) {
69
+ if (att_unique_id < 0) {
70
+ return;
71
+ }
72
+ for (auto itr = att_metadatas_.begin(); itr != att_metadatas_.end();
73
+ ++itr) {
74
+ if (itr->get()->att_unique_id() == static_cast<uint32_t>(att_unique_id)) {
75
+ att_metadatas_.erase(itr);
76
+ return;
77
+ }
78
+ }
79
+ }
80
+
81
+ const AttributeMetadata *GetAttributeMetadataByUniqueId(
82
+ int32_t att_unique_id) const {
83
+ if (att_unique_id < 0) {
84
+ return nullptr;
85
+ }
86
+
87
+ // TODO(draco-eng): Consider using unordered_map instead of vector to store
88
+ // attribute metadata.
89
+ for (auto &&att_metadata : att_metadatas_) {
90
+ if (att_metadata->att_unique_id() ==
91
+ static_cast<uint32_t>(att_unique_id)) {
92
+ return att_metadata.get();
93
+ }
94
+ }
95
+ return nullptr;
96
+ }
97
+
98
+ AttributeMetadata *attribute_metadata(int32_t att_unique_id) {
99
+ if (att_unique_id < 0) {
100
+ return nullptr;
101
+ }
102
+
103
+ // TODO(draco-eng): Consider use unordered_map instead of vector to store
104
+ // attribute metadata.
105
+ for (auto &&att_metadata : att_metadatas_) {
106
+ if (att_metadata->att_unique_id() ==
107
+ static_cast<uint32_t>(att_unique_id)) {
108
+ return att_metadata.get();
109
+ }
110
+ }
111
+ return nullptr;
112
+ }
113
+
114
+ const std::vector<std::unique_ptr<AttributeMetadata>> &attribute_metadatas()
115
+ const {
116
+ return att_metadatas_;
117
+ }
118
+
119
+ private:
120
+ std::vector<std::unique_ptr<AttributeMetadata>> att_metadatas_;
121
+
122
+ friend struct GeometryMetadataHasher;
123
+ };
124
+
125
+ // Functor for computing a hash from data stored in a GeometryMetadata class.
126
+ struct GeometryMetadataHasher {
127
+ size_t operator()(const GeometryMetadata &metadata) const {
128
+ size_t hash = metadata.att_metadatas_.size();
129
+ AttributeMetadataHasher att_metadata_hasher;
130
+ for (auto &&att_metadata : metadata.att_metadatas_) {
131
+ hash = HashCombine(att_metadata_hasher(*att_metadata), hash);
132
+ }
133
+ MetadataHasher metadata_hasher;
134
+ hash = HashCombine(metadata_hasher(static_cast<const Metadata &>(metadata)),
135
+ hash);
136
+ return hash;
137
+ }
138
+ };
139
+
140
+ } // namespace draco
141
+
142
+ #endif // THIRD_PARTY_DRACO_METADATA_GEOMETRY_METADATA_H_
@@ -0,0 +1,209 @@
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_METADATA_METADATA_H_
16
+ #define DRACO_METADATA_METADATA_H_
17
+
18
+ #include <cstring>
19
+ #include <map>
20
+ #include <memory>
21
+ #include <string>
22
+ #include <vector>
23
+
24
+ #include "draco/core/hash_utils.h"
25
+
26
+ namespace draco {
27
+
28
+ // Class for storing a value of an entry in Metadata. Internally it is
29
+ // represented by a buffer of data. It can be accessed by various data types,
30
+ // e.g. int, float, binary data or string.
31
+ class EntryValue {
32
+ public:
33
+ template <typename DataTypeT>
34
+ explicit EntryValue(const DataTypeT &data) {
35
+ const size_t data_type_size = sizeof(DataTypeT);
36
+ data_.resize(data_type_size);
37
+ memcpy(&data_[0], &data, data_type_size);
38
+ }
39
+
40
+ template <typename DataTypeT>
41
+ explicit EntryValue(const std::vector<DataTypeT> &data) {
42
+ const size_t total_size = sizeof(DataTypeT) * data.size();
43
+ data_.resize(total_size);
44
+ memcpy(&data_[0], &data[0], total_size);
45
+ }
46
+
47
+ EntryValue(const EntryValue &value);
48
+ explicit EntryValue(const std::string &value);
49
+
50
+ template <typename DataTypeT>
51
+ bool GetValue(DataTypeT *value) const {
52
+ const size_t data_type_size = sizeof(DataTypeT);
53
+ if (data_type_size != data_.size()) {
54
+ return false;
55
+ }
56
+ memcpy(value, &data_[0], data_type_size);
57
+ return true;
58
+ }
59
+
60
+ template <typename DataTypeT>
61
+ bool GetValue(std::vector<DataTypeT> *value) const {
62
+ if (data_.empty()) {
63
+ return false;
64
+ }
65
+ const size_t data_type_size = sizeof(DataTypeT);
66
+ if (data_.size() % data_type_size != 0) {
67
+ return false;
68
+ }
69
+ value->resize(data_.size() / data_type_size);
70
+ memcpy(&value->at(0), &data_[0], data_.size());
71
+ return true;
72
+ }
73
+
74
+ const std::vector<uint8_t> &data() const { return data_; }
75
+
76
+ private:
77
+ std::vector<uint8_t> data_;
78
+
79
+ friend struct EntryValueHasher;
80
+ };
81
+
82
+ // Functor for computing a hash from data stored within an EntryValue.
83
+ struct EntryValueHasher {
84
+ size_t operator()(const EntryValue &ev) const {
85
+ size_t hash = ev.data_.size();
86
+ for (size_t i = 0; i < ev.data_.size(); ++i) {
87
+ hash = HashCombine(ev.data_[i], hash);
88
+ }
89
+ return hash;
90
+ }
91
+ };
92
+
93
+ // Class for holding generic metadata. It has a list of entries which consist of
94
+ // an entry name and an entry value. Each Metadata could also have nested
95
+ // metadata.
96
+ class Metadata {
97
+ public:
98
+ Metadata() {}
99
+ Metadata(const Metadata &metadata);
100
+ // In theory, we support all types of data as long as it could be serialized
101
+ // to binary data. We provide the following functions for inserting and
102
+ // accessing entries of common data types. For now, developers need to know
103
+ // the type of entries they are requesting.
104
+ void AddEntryInt(const std::string &name, int32_t value);
105
+
106
+ // Returns false if Metadata does not contain an entry with a key of |name|.
107
+ // This function does not guarantee that entry's type is int32_t.
108
+ bool GetEntryInt(const std::string &name, int32_t *value) const;
109
+
110
+ void AddEntryIntArray(const std::string &name,
111
+ const std::vector<int32_t> &value);
112
+
113
+ // Returns false if Metadata does not contain an entry with a key of |name|.
114
+ // This function does not guarantee that entry's type is a vector of int32_t.
115
+ bool GetEntryIntArray(const std::string &name,
116
+ std::vector<int32_t> *value) const;
117
+
118
+ void AddEntryDouble(const std::string &name, double value);
119
+
120
+ // Returns false if Metadata does not contain an entry with a key of |name|.
121
+ // This function does not guarantee that entry's type is double.
122
+ bool GetEntryDouble(const std::string &name, double *value) const;
123
+
124
+ void AddEntryDoubleArray(const std::string &name,
125
+ const std::vector<double> &value);
126
+
127
+ // Returns false if Metadata does not contain an entry with a key of |name|.
128
+ // This function does not guarantee that entry's type is a vector of double.
129
+ bool GetEntryDoubleArray(const std::string &name,
130
+ std::vector<double> *value) const;
131
+
132
+ void AddEntryString(const std::string &name, const std::string &value);
133
+
134
+ // Returns false if Metadata does not contain an entry with a key of |name|.
135
+ // This function does not guarantee that entry's type is std::string.
136
+ bool GetEntryString(const std::string &name, std::string *value) const;
137
+
138
+ // Add a blob of data as an entry.
139
+ void AddEntryBinary(const std::string &name,
140
+ const std::vector<uint8_t> &value);
141
+
142
+ // Returns false if Metadata does not contain an entry with a key of |name|.
143
+ // This function does not guarantee that entry's type is a vector of uint8_t.
144
+ bool GetEntryBinary(const std::string &name,
145
+ std::vector<uint8_t> *value) const;
146
+
147
+ bool AddSubMetadata(const std::string &name,
148
+ std::unique_ptr<Metadata> sub_metadata);
149
+ const Metadata *GetSubMetadata(const std::string &name) const;
150
+ Metadata *sub_metadata(const std::string &name);
151
+
152
+ void RemoveEntry(const std::string &name);
153
+
154
+ int num_entries() const { return static_cast<int>(entries_.size()); }
155
+ const std::map<std::string, EntryValue> &entries() const { return entries_; }
156
+ const std::map<std::string, std::unique_ptr<Metadata>> &sub_metadatas()
157
+ const {
158
+ return sub_metadatas_;
159
+ }
160
+
161
+ private:
162
+ // Make this function private to avoid adding undefined data types.
163
+ template <typename DataTypeT>
164
+ void AddEntry(const std::string &entry_name, const DataTypeT &entry_value) {
165
+ const auto itr = entries_.find(entry_name);
166
+ if (itr != entries_.end()) {
167
+ entries_.erase(itr);
168
+ }
169
+ entries_.insert(std::make_pair(entry_name, EntryValue(entry_value)));
170
+ }
171
+
172
+ // Make this function private to avoid adding undefined data types.
173
+ template <typename DataTypeT>
174
+ bool GetEntry(const std::string &entry_name, DataTypeT *entry_value) const {
175
+ const auto itr = entries_.find(entry_name);
176
+ if (itr == entries_.end()) {
177
+ return false;
178
+ }
179
+ return itr->second.GetValue(entry_value);
180
+ }
181
+
182
+ std::map<std::string, EntryValue> entries_;
183
+ std::map<std::string, std::unique_ptr<Metadata>> sub_metadatas_;
184
+
185
+ friend struct MetadataHasher;
186
+ };
187
+
188
+ // Functor for computing a hash from data stored within a metadata class.
189
+ struct MetadataHasher {
190
+ size_t operator()(const Metadata &metadata) const {
191
+ size_t hash =
192
+ HashCombine(metadata.entries_.size(), metadata.sub_metadatas_.size());
193
+ EntryValueHasher entry_value_hasher;
194
+ for (const auto &entry : metadata.entries_) {
195
+ hash = HashCombine(entry.first, hash);
196
+ hash = HashCombine(entry_value_hasher(entry.second), hash);
197
+ }
198
+ MetadataHasher metadata_hasher;
199
+ for (auto &&sub_metadata : metadata.sub_metadatas_) {
200
+ hash = HashCombine(sub_metadata.first, hash);
201
+ hash = HashCombine(metadata_hasher(*sub_metadata.second), hash);
202
+ }
203
+ return hash;
204
+ }
205
+ };
206
+
207
+ } // namespace draco
208
+
209
+ #endif // DRACO_METADATA_METADATA_H_
@@ -0,0 +1,42 @@
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_METADATA_METADATA_DECODER_H_
16
+ #define DRACO_METADATA_METADATA_DECODER_H_
17
+
18
+ #include "draco/core/decoder_buffer.h"
19
+ #include "draco/metadata/geometry_metadata.h"
20
+ #include "draco/metadata/metadata.h"
21
+
22
+ namespace draco {
23
+
24
+ // Class for decoding the metadata.
25
+ class MetadataDecoder {
26
+ public:
27
+ MetadataDecoder();
28
+ bool DecodeMetadata(DecoderBuffer *in_buffer, Metadata *metadata);
29
+ bool DecodeGeometryMetadata(DecoderBuffer *in_buffer,
30
+ GeometryMetadata *metadata);
31
+
32
+ private:
33
+ bool DecodeMetadata(Metadata *metadata);
34
+ bool DecodeEntries(Metadata *metadata);
35
+ bool DecodeEntry(Metadata *metadata);
36
+ bool DecodeName(std::string *name);
37
+
38
+ DecoderBuffer *buffer_;
39
+ };
40
+ } // namespace draco
41
+
42
+ #endif // DRACO_METADATA_METADATA_DECODER_H_
@@ -0,0 +1,41 @@
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_METADATA_METADATA_ENCODER_H_
16
+ #define DRACO_METADATA_METADATA_ENCODER_H_
17
+
18
+ #include "draco/core/encoder_buffer.h"
19
+ #include "draco/metadata/geometry_metadata.h"
20
+ #include "draco/metadata/metadata.h"
21
+
22
+ namespace draco {
23
+
24
+ // Class for encoding metadata. It could encode either base Metadata class or
25
+ // a metadata of a geometry, e.g. a point cloud.
26
+ class MetadataEncoder {
27
+ public:
28
+ MetadataEncoder() {}
29
+
30
+ bool EncodeGeometryMetadata(EncoderBuffer *out_buffer,
31
+ const GeometryMetadata *metadata);
32
+ bool EncodeMetadata(EncoderBuffer *out_buffer, const Metadata *metadata);
33
+
34
+ private:
35
+ bool EncodeAttributeMetadata(EncoderBuffer *out_buffer,
36
+ const AttributeMetadata *metadata);
37
+ bool EncodeString(EncoderBuffer *out_buffer, const std::string &str);
38
+ };
39
+ } // namespace draco
40
+
41
+ #endif // DRACO_METADATA_METADATA_ENCODER_H_
@@ -0,0 +1,107 @@
1
+ // Copyright 2023 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_METADATA_PROPERTY_ATTRIBUTE_H_
16
+ #define DRACO_METADATA_PROPERTY_ATTRIBUTE_H_
17
+
18
+ #include "draco/draco_features.h"
19
+
20
+ #ifdef DRACO_TRANSCODER_SUPPORTED
21
+
22
+ #include <memory>
23
+ #include <string>
24
+ #include <vector>
25
+
26
+ #include "draco/core/status_or.h"
27
+
28
+ namespace draco {
29
+
30
+ // Describes a property attribute as defined in the EXT_structural_metadata glTF
31
+ // extension.
32
+ class PropertyAttribute {
33
+ public:
34
+ // Describes where property is stored (as an attribute).
35
+ class Property {
36
+ public:
37
+ // Creates an empty property.
38
+ Property() = default;
39
+
40
+ // Methods for comparing two properties.
41
+ bool operator==(const Property &other) const;
42
+ bool operator!=(const Property &other) const { return !(*this == other); }
43
+
44
+ // Copies all data from |src| property.
45
+ void Copy(const Property &src);
46
+
47
+ // Name of this property.
48
+ void SetName(const std::string &name);
49
+ const std::string &GetName() const;
50
+
51
+ // Name of glTF attribute containing property values, like "_DIRECTION".
52
+ void SetAttributeName(const std::string &name);
53
+ const std::string &GetAttributeName() const;
54
+
55
+ private:
56
+ // Name of this property as in structural metadata schema class property.
57
+ std::string name_;
58
+
59
+ // Name of glTF attribute containing property values, like "_DIRECTION".
60
+ std::string attribute_name_;
61
+
62
+ // TODO(vytyaz): Support property value modifiers min, max, offset, scale.
63
+ };
64
+
65
+ // Creates an empty property attribute.
66
+ PropertyAttribute() = default;
67
+
68
+ // Methods for comparing two property attributes.
69
+ bool operator==(const PropertyAttribute &other) const;
70
+ bool operator!=(const PropertyAttribute &other) const {
71
+ return !(*this == other);
72
+ }
73
+
74
+ // Copies all data from |src| property attribute.
75
+ void Copy(const PropertyAttribute &src);
76
+
77
+ // Name of this property attribute.
78
+ void SetName(const std::string &value);
79
+ const std::string &GetName() const;
80
+
81
+ // Class of this property attribute.
82
+ void SetClass(const std::string &value);
83
+ const std::string &GetClass() const;
84
+
85
+ // Properties.
86
+ int AddProperty(std::unique_ptr<Property> property);
87
+ int NumProperties() const;
88
+ const Property &GetProperty(int index) const;
89
+ Property &GetProperty(int index);
90
+ void RemoveProperty(int index);
91
+
92
+ private:
93
+ // The name of the property attribute, e.g., for display purposes.
94
+ std::string name_;
95
+
96
+ // The class in structural metadata schema that property values conform to.
97
+ std::string class_;
98
+
99
+ // Properties corresponding to schema class properties, describing where the
100
+ // property values are stored (as attributes).
101
+ std::vector<std::unique_ptr<Property>> properties_;
102
+ };
103
+
104
+ } // namespace draco
105
+
106
+ #endif // DRACO_TRANSCODER_SUPPORTED
107
+ #endif // DRACO_METADATA_PROPERTY_ATTRIBUTE_H_