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,541 @@
|
|
|
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_ATTRIBUTES_GEOMETRY_ATTRIBUTE_H_
|
|
16
|
+
#define DRACO_ATTRIBUTES_GEOMETRY_ATTRIBUTE_H_
|
|
17
|
+
|
|
18
|
+
#include <algorithm>
|
|
19
|
+
#include <array>
|
|
20
|
+
#include <cmath>
|
|
21
|
+
#include <limits>
|
|
22
|
+
|
|
23
|
+
#include "draco/attributes/geometry_indices.h"
|
|
24
|
+
#include "draco/core/data_buffer.h"
|
|
25
|
+
#include "draco/core/hash_utils.h"
|
|
26
|
+
#include "draco/draco_features.h"
|
|
27
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
28
|
+
#include "draco/core/status.h"
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
namespace draco {
|
|
32
|
+
|
|
33
|
+
// The class provides access to a specific attribute which is stored in a
|
|
34
|
+
// DataBuffer, such as normals or coordinates. However, the GeometryAttribute
|
|
35
|
+
// class does not own the buffer and the buffer itself may store other data
|
|
36
|
+
// unrelated to this attribute (such as data for other attributes in which case
|
|
37
|
+
// we can have multiple GeometryAttributes accessing one buffer). Typically,
|
|
38
|
+
// all attributes for a point (or corner, face) are stored in one block, which
|
|
39
|
+
// is advantageous in terms of memory access. The length of the entire block is
|
|
40
|
+
// given by the byte_stride, the position where the attribute starts is given by
|
|
41
|
+
// the byte_offset, the actual number of bytes that the attribute occupies is
|
|
42
|
+
// given by the data_type and the number of components.
|
|
43
|
+
class GeometryAttribute {
|
|
44
|
+
public:
|
|
45
|
+
// Supported attribute types.
|
|
46
|
+
enum Type {
|
|
47
|
+
INVALID = -1,
|
|
48
|
+
// Named attributes start here. The difference between named and generic
|
|
49
|
+
// attributes is that for named attributes we know their purpose and we
|
|
50
|
+
// can apply some special methods when dealing with them (e.g. during
|
|
51
|
+
// encoding).
|
|
52
|
+
POSITION = 0,
|
|
53
|
+
NORMAL,
|
|
54
|
+
COLOR,
|
|
55
|
+
TEX_COORD,
|
|
56
|
+
// A special id used to mark attributes that are not assigned to any known
|
|
57
|
+
// predefined use case. Such attributes are often used for a shader specific
|
|
58
|
+
// data.
|
|
59
|
+
GENERIC,
|
|
60
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
61
|
+
// TODO(ostava): Adding a new attribute would be bit-stream change for GLTF.
|
|
62
|
+
// Older decoders wouldn't know what to do with this attribute type. This
|
|
63
|
+
// should be open-sourced only when we are ready to increase our bit-stream
|
|
64
|
+
// version.
|
|
65
|
+
TANGENT,
|
|
66
|
+
MATERIAL,
|
|
67
|
+
JOINTS,
|
|
68
|
+
WEIGHTS,
|
|
69
|
+
#endif
|
|
70
|
+
// Total number of different attribute types.
|
|
71
|
+
// Always keep behind all named attributes.
|
|
72
|
+
NAMED_ATTRIBUTES_COUNT,
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
GeometryAttribute();
|
|
76
|
+
// Initializes and enables the attribute.
|
|
77
|
+
void Init(Type attribute_type, DataBuffer *buffer, uint8_t num_components,
|
|
78
|
+
DataType data_type, bool normalized, int64_t byte_stride,
|
|
79
|
+
int64_t byte_offset);
|
|
80
|
+
bool IsValid() const { return buffer_ != nullptr; }
|
|
81
|
+
|
|
82
|
+
// Copies data from the source attribute to the this attribute.
|
|
83
|
+
// This attribute must have a valid buffer allocated otherwise the operation
|
|
84
|
+
// is going to fail and return false.
|
|
85
|
+
bool CopyFrom(const GeometryAttribute &src_att);
|
|
86
|
+
|
|
87
|
+
// Function for getting a attribute value with a specific format.
|
|
88
|
+
// Unsafe. Caller must ensure the accessed memory is valid.
|
|
89
|
+
// T is the attribute data type.
|
|
90
|
+
// att_components_t is the number of attribute components.
|
|
91
|
+
template <typename T, int att_components_t>
|
|
92
|
+
std::array<T, att_components_t> GetValue(
|
|
93
|
+
AttributeValueIndex att_index) const {
|
|
94
|
+
// Byte address of the attribute index.
|
|
95
|
+
const int64_t byte_pos = byte_offset_ + byte_stride_ * att_index.value();
|
|
96
|
+
std::array<T, att_components_t> out;
|
|
97
|
+
buffer_->Read(byte_pos, &(out[0]), sizeof(out));
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Function for getting a attribute value with a specific format.
|
|
102
|
+
// T is the attribute data type.
|
|
103
|
+
// att_components_t is the number of attribute components.
|
|
104
|
+
template <typename T, int att_components_t>
|
|
105
|
+
bool GetValue(AttributeValueIndex att_index,
|
|
106
|
+
std::array<T, att_components_t> *out) const {
|
|
107
|
+
// Byte address of the attribute index.
|
|
108
|
+
const int64_t byte_pos = byte_offset_ + byte_stride_ * att_index.value();
|
|
109
|
+
// Check we are not reading past end of data.
|
|
110
|
+
if (byte_pos + sizeof(*out) > buffer_->data_size()) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
buffer_->Read(byte_pos, &((*out)[0]), sizeof(*out));
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Returns the byte position of the attribute entry in the data buffer.
|
|
118
|
+
inline int64_t GetBytePos(AttributeValueIndex att_index) const {
|
|
119
|
+
return byte_offset_ + byte_stride_ * att_index.value();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
inline const uint8_t *GetAddress(AttributeValueIndex att_index) const {
|
|
123
|
+
const int64_t byte_pos = GetBytePos(att_index);
|
|
124
|
+
return buffer_->data() + byte_pos;
|
|
125
|
+
}
|
|
126
|
+
inline uint8_t *GetAddress(AttributeValueIndex att_index) {
|
|
127
|
+
const int64_t byte_pos = GetBytePos(att_index);
|
|
128
|
+
return buffer_->data() + byte_pos;
|
|
129
|
+
}
|
|
130
|
+
inline bool IsAddressValid(const uint8_t *address) const {
|
|
131
|
+
return ((buffer_->data() + buffer_->data_size()) > address);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Fills out_data with the raw value of the requested attribute entry.
|
|
135
|
+
// out_data must be at least byte_stride_ long.
|
|
136
|
+
void GetValue(AttributeValueIndex att_index, void *out_data) const {
|
|
137
|
+
const int64_t byte_pos = byte_offset_ + byte_stride_ * att_index.value();
|
|
138
|
+
buffer_->Read(byte_pos, out_data, byte_stride_);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Sets a value of an attribute entry. The input value must be allocated to
|
|
142
|
+
// cover all components of a single attribute entry.
|
|
143
|
+
void SetAttributeValue(AttributeValueIndex entry_index, const void *value) {
|
|
144
|
+
const int64_t byte_pos = entry_index.value() * byte_stride();
|
|
145
|
+
buffer_->Write(byte_pos, value, byte_stride());
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
149
|
+
// Sets a value of an attribute entry. The input |value| must have
|
|
150
|
+
// |input_num_components| entries and it will be automatically converted to
|
|
151
|
+
// the internal format used by the geometry attribute. If the conversion is
|
|
152
|
+
// not possible, an error status will be returned.
|
|
153
|
+
template <typename InputT>
|
|
154
|
+
Status ConvertAndSetAttributeValue(AttributeValueIndex avi,
|
|
155
|
+
int input_num_components,
|
|
156
|
+
const InputT *value);
|
|
157
|
+
#endif
|
|
158
|
+
|
|
159
|
+
// DEPRECATED: Use
|
|
160
|
+
// ConvertValue(AttributeValueIndex att_id,
|
|
161
|
+
// int out_num_components,
|
|
162
|
+
// OutT *out_val);
|
|
163
|
+
//
|
|
164
|
+
// Function for conversion of a attribute to a specific output format.
|
|
165
|
+
// OutT is the desired data type of the attribute.
|
|
166
|
+
// out_att_components_t is the number of components of the output format.
|
|
167
|
+
// Returns false when the conversion failed.
|
|
168
|
+
template <typename OutT, int out_att_components_t>
|
|
169
|
+
bool ConvertValue(AttributeValueIndex att_id, OutT *out_val) const {
|
|
170
|
+
return ConvertValue(att_id, out_att_components_t, out_val);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Function for conversion of a attribute to a specific output format.
|
|
174
|
+
// |out_val| needs to be able to store |out_num_components| values.
|
|
175
|
+
// OutT is the desired data type of the attribute.
|
|
176
|
+
// Returns false when the conversion failed.
|
|
177
|
+
template <typename OutT>
|
|
178
|
+
bool ConvertValue(AttributeValueIndex att_id, int8_t out_num_components,
|
|
179
|
+
OutT *out_val) const {
|
|
180
|
+
if (out_val == nullptr) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
switch (data_type_) {
|
|
184
|
+
case DT_INT8:
|
|
185
|
+
return ConvertTypedValue<int8_t, OutT>(att_id, out_num_components,
|
|
186
|
+
out_val);
|
|
187
|
+
case DT_UINT8:
|
|
188
|
+
return ConvertTypedValue<uint8_t, OutT>(att_id, out_num_components,
|
|
189
|
+
out_val);
|
|
190
|
+
case DT_INT16:
|
|
191
|
+
return ConvertTypedValue<int16_t, OutT>(att_id, out_num_components,
|
|
192
|
+
out_val);
|
|
193
|
+
case DT_UINT16:
|
|
194
|
+
return ConvertTypedValue<uint16_t, OutT>(att_id, out_num_components,
|
|
195
|
+
out_val);
|
|
196
|
+
case DT_INT32:
|
|
197
|
+
return ConvertTypedValue<int32_t, OutT>(att_id, out_num_components,
|
|
198
|
+
out_val);
|
|
199
|
+
case DT_UINT32:
|
|
200
|
+
return ConvertTypedValue<uint32_t, OutT>(att_id, out_num_components,
|
|
201
|
+
out_val);
|
|
202
|
+
case DT_INT64:
|
|
203
|
+
return ConvertTypedValue<int64_t, OutT>(att_id, out_num_components,
|
|
204
|
+
out_val);
|
|
205
|
+
case DT_UINT64:
|
|
206
|
+
return ConvertTypedValue<uint64_t, OutT>(att_id, out_num_components,
|
|
207
|
+
out_val);
|
|
208
|
+
case DT_FLOAT32:
|
|
209
|
+
return ConvertTypedValue<float, OutT>(att_id, out_num_components,
|
|
210
|
+
out_val);
|
|
211
|
+
case DT_FLOAT64:
|
|
212
|
+
return ConvertTypedValue<double, OutT>(att_id, out_num_components,
|
|
213
|
+
out_val);
|
|
214
|
+
case DT_BOOL:
|
|
215
|
+
return ConvertTypedValue<bool, OutT>(att_id, out_num_components,
|
|
216
|
+
out_val);
|
|
217
|
+
default:
|
|
218
|
+
// Wrong attribute type.
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Function for conversion of a attribute to a specific output format.
|
|
224
|
+
// The |out_value| must be able to store all components of a single attribute
|
|
225
|
+
// entry.
|
|
226
|
+
// OutT is the desired data type of the attribute.
|
|
227
|
+
// Returns false when the conversion failed.
|
|
228
|
+
template <typename OutT>
|
|
229
|
+
bool ConvertValue(AttributeValueIndex att_index, OutT *out_value) const {
|
|
230
|
+
return ConvertValue<OutT>(att_index, num_components_, out_value);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Utility function. Returns |attribute_type| as std::string.
|
|
234
|
+
static std::string TypeToString(Type attribute_type) {
|
|
235
|
+
switch (attribute_type) {
|
|
236
|
+
case INVALID:
|
|
237
|
+
return "INVALID";
|
|
238
|
+
case POSITION:
|
|
239
|
+
return "POSITION";
|
|
240
|
+
case NORMAL:
|
|
241
|
+
return "NORMAL";
|
|
242
|
+
case COLOR:
|
|
243
|
+
return "COLOR";
|
|
244
|
+
case TEX_COORD:
|
|
245
|
+
return "TEX_COORD";
|
|
246
|
+
case GENERIC:
|
|
247
|
+
return "GENERIC";
|
|
248
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
249
|
+
case TANGENT:
|
|
250
|
+
return "TANGENT";
|
|
251
|
+
case MATERIAL:
|
|
252
|
+
return "MATERIAL";
|
|
253
|
+
case JOINTS:
|
|
254
|
+
return "JOINTS";
|
|
255
|
+
case WEIGHTS:
|
|
256
|
+
return "WEIGHTS";
|
|
257
|
+
#endif
|
|
258
|
+
default:
|
|
259
|
+
return "UNKNOWN";
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
bool operator==(const GeometryAttribute &va) const;
|
|
264
|
+
|
|
265
|
+
// Returns the type of the attribute indicating the nature of the attribute.
|
|
266
|
+
Type attribute_type() const { return attribute_type_; }
|
|
267
|
+
void set_attribute_type(Type type) { attribute_type_ = type; }
|
|
268
|
+
// Returns the data type that is stored in the attribute.
|
|
269
|
+
DataType data_type() const { return data_type_; }
|
|
270
|
+
// Returns the number of components that are stored for each entry.
|
|
271
|
+
// For position attribute this is usually three (x,y,z),
|
|
272
|
+
// while texture coordinates have two components (u,v).
|
|
273
|
+
uint8_t num_components() const { return num_components_; }
|
|
274
|
+
// Indicates whether the data type should be normalized before interpretation,
|
|
275
|
+
// that is, it should be divided by the max value of the data type.
|
|
276
|
+
bool normalized() const { return normalized_; }
|
|
277
|
+
void set_normalized(bool normalized) { normalized_ = normalized; }
|
|
278
|
+
// The buffer storing the entire data of the attribute.
|
|
279
|
+
const DataBuffer *buffer() const { return buffer_; }
|
|
280
|
+
// Returns the number of bytes between two attribute entries, this is, at
|
|
281
|
+
// least size of the data types times number of components.
|
|
282
|
+
int64_t byte_stride() const { return byte_stride_; }
|
|
283
|
+
// The offset where the attribute starts within the block of size byte_stride.
|
|
284
|
+
int64_t byte_offset() const { return byte_offset_; }
|
|
285
|
+
void set_byte_offset(int64_t byte_offset) { byte_offset_ = byte_offset; }
|
|
286
|
+
DataBufferDescriptor buffer_descriptor() const { return buffer_descriptor_; }
|
|
287
|
+
uint32_t unique_id() const { return unique_id_; }
|
|
288
|
+
void set_unique_id(uint32_t id) { unique_id_ = id; }
|
|
289
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
290
|
+
std::string name() const { return name_; }
|
|
291
|
+
void set_name(std::string name) { name_ = name; }
|
|
292
|
+
#endif
|
|
293
|
+
|
|
294
|
+
protected:
|
|
295
|
+
// Sets a new internal storage for the attribute.
|
|
296
|
+
void ResetBuffer(DataBuffer *buffer, int64_t byte_stride,
|
|
297
|
+
int64_t byte_offset);
|
|
298
|
+
|
|
299
|
+
private:
|
|
300
|
+
// Function for conversion of an attribute to a specific output format given a
|
|
301
|
+
// format of the stored attribute.
|
|
302
|
+
// T is the stored attribute data type.
|
|
303
|
+
// OutT is the desired data type of the attribute.
|
|
304
|
+
template <typename T, typename OutT>
|
|
305
|
+
bool ConvertTypedValue(AttributeValueIndex att_id, uint8_t out_num_components,
|
|
306
|
+
OutT *out_value) const {
|
|
307
|
+
const uint8_t *src_address = GetAddress(att_id);
|
|
308
|
+
|
|
309
|
+
// Convert all components available in both the original and output formats.
|
|
310
|
+
for (int i = 0; i < std::min(num_components_, out_num_components); ++i) {
|
|
311
|
+
if (!IsAddressValid(src_address)) {
|
|
312
|
+
return false;
|
|
313
|
+
}
|
|
314
|
+
const T in_value = *reinterpret_cast<const T *>(src_address);
|
|
315
|
+
if (!ConvertComponentValue<T, OutT>(in_value, normalized_,
|
|
316
|
+
out_value + i)) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
src_address += sizeof(T);
|
|
320
|
+
}
|
|
321
|
+
// Fill empty data for unused output components if needed.
|
|
322
|
+
for (int i = num_components_; i < out_num_components; ++i) {
|
|
323
|
+
out_value[i] = static_cast<OutT>(0);
|
|
324
|
+
}
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
329
|
+
// Function that converts input |value| from type T to the internal attribute
|
|
330
|
+
// representation defined by OutT and |num_components_|.
|
|
331
|
+
template <typename T, typename OutT>
|
|
332
|
+
Status ConvertAndSetAttributeTypedValue(AttributeValueIndex avi,
|
|
333
|
+
int8_t input_num_components,
|
|
334
|
+
const T *value) {
|
|
335
|
+
uint8_t *address = GetAddress(avi);
|
|
336
|
+
|
|
337
|
+
// Convert all components available in both the original and output formats.
|
|
338
|
+
for (int i = 0; i < num_components_; ++i) {
|
|
339
|
+
if (!IsAddressValid(address)) {
|
|
340
|
+
return ErrorStatus("GeometryAttribute: Invalid address.");
|
|
341
|
+
}
|
|
342
|
+
OutT *const out_value = reinterpret_cast<OutT *>(address);
|
|
343
|
+
if (i < input_num_components) {
|
|
344
|
+
if (!ConvertComponentValue<T, OutT>(*(value + i), normalized_,
|
|
345
|
+
out_value)) {
|
|
346
|
+
return ErrorStatus(
|
|
347
|
+
"GeometryAttribute: Failed to convert component value.");
|
|
348
|
+
}
|
|
349
|
+
} else {
|
|
350
|
+
*out_value = static_cast<OutT>(0);
|
|
351
|
+
}
|
|
352
|
+
address += sizeof(OutT);
|
|
353
|
+
}
|
|
354
|
+
return OkStatus();
|
|
355
|
+
}
|
|
356
|
+
#endif // DRACO_TRANSCODER_SUPPORTED
|
|
357
|
+
|
|
358
|
+
// Converts |in_value| of type T into |out_value| of type OutT. If
|
|
359
|
+
// |normalized| is true, any conversion between floating point and integer
|
|
360
|
+
// values will be treating integers as normalized types (the entire integer
|
|
361
|
+
// range will be used to represent 0-1 floating point range).
|
|
362
|
+
template <typename T, typename OutT>
|
|
363
|
+
static bool ConvertComponentValue(const T &in_value, bool normalized,
|
|
364
|
+
OutT *out_value) {
|
|
365
|
+
// Make sure the |in_value| can be represented as an integral type OutT.
|
|
366
|
+
if (std::is_integral<OutT>::value) {
|
|
367
|
+
// Make sure the |in_value| fits within the range of values that OutT
|
|
368
|
+
// is able to represent. Perform the check only for integral types.
|
|
369
|
+
if (!std::is_same<T, bool>::value && std::is_integral<T>::value) {
|
|
370
|
+
static constexpr OutT kOutMin =
|
|
371
|
+
std::is_signed<T>::value ? std::numeric_limits<OutT>::min() : 0;
|
|
372
|
+
if (in_value < kOutMin || in_value > std::numeric_limits<OutT>::max()) {
|
|
373
|
+
return false;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Check conversion of floating point |in_value| to integral value OutT.
|
|
378
|
+
if (std::is_floating_point<T>::value) {
|
|
379
|
+
// Make sure the floating point |in_value| is not NaN and not Inf as
|
|
380
|
+
// integral type OutT is unable to represent these values.
|
|
381
|
+
if (sizeof(in_value) > sizeof(double)) {
|
|
382
|
+
if (std::isnan(static_cast<long double>(in_value)) ||
|
|
383
|
+
std::isinf(static_cast<long double>(in_value))) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
} else if (sizeof(in_value) > sizeof(float)) {
|
|
387
|
+
if (std::isnan(static_cast<double>(in_value)) ||
|
|
388
|
+
std::isinf(static_cast<double>(in_value))) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
} else {
|
|
392
|
+
if (std::isnan(static_cast<float>(in_value)) ||
|
|
393
|
+
std::isinf(static_cast<float>(in_value))) {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// Make sure the floating point |in_value| fits within the range of
|
|
399
|
+
// values that integral type OutT is able to represent.
|
|
400
|
+
if (in_value < std::numeric_limits<OutT>::min() ||
|
|
401
|
+
in_value >= std::numeric_limits<OutT>::max()) {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (std::is_integral<T>::value && std::is_floating_point<OutT>::value &&
|
|
408
|
+
normalized) {
|
|
409
|
+
// When converting integer to floating point, normalize the value if
|
|
410
|
+
// necessary.
|
|
411
|
+
*out_value = static_cast<OutT>(in_value);
|
|
412
|
+
*out_value /= static_cast<OutT>(std::numeric_limits<T>::max());
|
|
413
|
+
} else if (std::is_floating_point<T>::value &&
|
|
414
|
+
std::is_integral<OutT>::value && normalized) {
|
|
415
|
+
// Converting from floating point to a normalized integer.
|
|
416
|
+
if (in_value > 1 || in_value < 0) {
|
|
417
|
+
// Normalized float values need to be between 0 and 1.
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
// TODO(ostava): Consider allowing float to normalized integer conversion
|
|
421
|
+
// for 64-bit integer types. Currently it doesn't work because we don't
|
|
422
|
+
// have a floating point type that could store all 64 bit integers.
|
|
423
|
+
if (sizeof(OutT) > 4) {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
// Expand the float to the range of the output integer and round it to the
|
|
427
|
+
// nearest representable value. Use doubles for the math to ensure the
|
|
428
|
+
// integer values are represented properly during the conversion process.
|
|
429
|
+
*out_value = static_cast<OutT>(std::floor(
|
|
430
|
+
in_value * static_cast<double>(std::numeric_limits<OutT>::max()) +
|
|
431
|
+
0.5));
|
|
432
|
+
} else {
|
|
433
|
+
*out_value = static_cast<OutT>(in_value);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// TODO(ostava): Add handling of normalized attributes when converting
|
|
437
|
+
// between different integer representations. If the attribute is
|
|
438
|
+
// normalized, integer values should be converted as if they represent 0-1
|
|
439
|
+
// range. E.g. when we convert uint16 to uint8, the range <0, 2^16 - 1>
|
|
440
|
+
// should be converted to range <0, 2^8 - 1>.
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
DataBuffer *buffer_;
|
|
445
|
+
// The buffer descriptor is stored at the time the buffer is attached to this
|
|
446
|
+
// attribute. The purpose is to detect if any changes happened to the buffer
|
|
447
|
+
// since the time it was attached.
|
|
448
|
+
DataBufferDescriptor buffer_descriptor_;
|
|
449
|
+
uint8_t num_components_;
|
|
450
|
+
DataType data_type_;
|
|
451
|
+
bool normalized_;
|
|
452
|
+
int64_t byte_stride_;
|
|
453
|
+
int64_t byte_offset_;
|
|
454
|
+
|
|
455
|
+
Type attribute_type_;
|
|
456
|
+
|
|
457
|
+
// Unique id of this attribute. No two attributes could have the same unique
|
|
458
|
+
// id. It is used to identify each attribute, especially when there are
|
|
459
|
+
// multiple attribute of the same type in a point cloud.
|
|
460
|
+
uint32_t unique_id_;
|
|
461
|
+
|
|
462
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
463
|
+
std::string name_;
|
|
464
|
+
#endif
|
|
465
|
+
|
|
466
|
+
friend struct GeometryAttributeHasher;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
#ifdef DRACO_TRANSCODER_SUPPORTED
|
|
470
|
+
template <typename InputT>
|
|
471
|
+
Status GeometryAttribute::ConvertAndSetAttributeValue(AttributeValueIndex avi,
|
|
472
|
+
int input_num_components,
|
|
473
|
+
const InputT *value) {
|
|
474
|
+
switch (this->data_type()) {
|
|
475
|
+
case DT_INT8:
|
|
476
|
+
return ConvertAndSetAttributeTypedValue<InputT, int8_t>(
|
|
477
|
+
avi, input_num_components, value);
|
|
478
|
+
case DT_UINT8:
|
|
479
|
+
return ConvertAndSetAttributeTypedValue<InputT, uint8_t>(
|
|
480
|
+
avi, input_num_components, value);
|
|
481
|
+
case DT_INT16:
|
|
482
|
+
return ConvertAndSetAttributeTypedValue<InputT, int16_t>(
|
|
483
|
+
avi, input_num_components, value);
|
|
484
|
+
case DT_UINT16:
|
|
485
|
+
return ConvertAndSetAttributeTypedValue<InputT, uint16_t>(
|
|
486
|
+
avi, input_num_components, value);
|
|
487
|
+
case DT_INT32:
|
|
488
|
+
return ConvertAndSetAttributeTypedValue<InputT, int32_t>(
|
|
489
|
+
avi, input_num_components, value);
|
|
490
|
+
case DT_UINT32:
|
|
491
|
+
return ConvertAndSetAttributeTypedValue<InputT, uint32_t>(
|
|
492
|
+
avi, input_num_components, value);
|
|
493
|
+
case DT_INT64:
|
|
494
|
+
return ConvertAndSetAttributeTypedValue<InputT, int64_t>(
|
|
495
|
+
avi, input_num_components, value);
|
|
496
|
+
case DT_UINT64:
|
|
497
|
+
return ConvertAndSetAttributeTypedValue<InputT, uint64_t>(
|
|
498
|
+
avi, input_num_components, value);
|
|
499
|
+
case DT_FLOAT32:
|
|
500
|
+
return ConvertAndSetAttributeTypedValue<InputT, float>(
|
|
501
|
+
avi, input_num_components, value);
|
|
502
|
+
case DT_FLOAT64:
|
|
503
|
+
return ConvertAndSetAttributeTypedValue<InputT, double>(
|
|
504
|
+
avi, input_num_components, value);
|
|
505
|
+
case DT_BOOL:
|
|
506
|
+
return ConvertAndSetAttributeTypedValue<InputT, bool>(
|
|
507
|
+
avi, input_num_components, value);
|
|
508
|
+
default:
|
|
509
|
+
break;
|
|
510
|
+
}
|
|
511
|
+
return ErrorStatus(
|
|
512
|
+
"GeometryAttribute::SetAndConvertAttributeValue: Unsupported "
|
|
513
|
+
"attribute type.");
|
|
514
|
+
}
|
|
515
|
+
#endif
|
|
516
|
+
|
|
517
|
+
// Hashing support
|
|
518
|
+
|
|
519
|
+
// Function object for using Attribute as a hash key.
|
|
520
|
+
struct GeometryAttributeHasher {
|
|
521
|
+
size_t operator()(const GeometryAttribute &va) const {
|
|
522
|
+
size_t hash = HashCombine(va.buffer_descriptor_.buffer_id,
|
|
523
|
+
va.buffer_descriptor_.buffer_update_count);
|
|
524
|
+
hash = HashCombine(va.num_components_, hash);
|
|
525
|
+
hash = HashCombine(static_cast<int8_t>(va.data_type_), hash);
|
|
526
|
+
hash = HashCombine(static_cast<int8_t>(va.attribute_type_), hash);
|
|
527
|
+
hash = HashCombine(va.byte_stride_, hash);
|
|
528
|
+
return HashCombine(va.byte_offset_, hash);
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
// Function object for using GeometryAttribute::Type as a hash key.
|
|
533
|
+
struct GeometryAttributeTypeHasher {
|
|
534
|
+
size_t operator()(const GeometryAttribute::Type &at) const {
|
|
535
|
+
return static_cast<size_t>(at);
|
|
536
|
+
}
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
} // namespace draco
|
|
540
|
+
|
|
541
|
+
#endif // DRACO_ATTRIBUTES_GEOMETRY_ATTRIBUTE_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_ATTRIBUTES_GEOMETRY_INDICES_H_
|
|
16
|
+
#define DRACO_ATTRIBUTES_GEOMETRY_INDICES_H_
|
|
17
|
+
|
|
18
|
+
#include <inttypes.h>
|
|
19
|
+
|
|
20
|
+
#include <limits>
|
|
21
|
+
|
|
22
|
+
#include "draco/core/draco_index_type.h"
|
|
23
|
+
|
|
24
|
+
namespace draco {
|
|
25
|
+
|
|
26
|
+
// Index of an attribute value entry stored in a GeometryAttribute.
|
|
27
|
+
DEFINE_NEW_DRACO_INDEX_TYPE(uint32_t, AttributeValueIndex)
|
|
28
|
+
// Index of a point in a PointCloud.
|
|
29
|
+
DEFINE_NEW_DRACO_INDEX_TYPE(uint32_t, PointIndex)
|
|
30
|
+
// Vertex index in a Mesh or CornerTable.
|
|
31
|
+
DEFINE_NEW_DRACO_INDEX_TYPE(uint32_t, VertexIndex)
|
|
32
|
+
// Corner index that identifies a corner in a Mesh or CornerTable.
|
|
33
|
+
DEFINE_NEW_DRACO_INDEX_TYPE(uint32_t, CornerIndex)
|
|
34
|
+
// Face index for Mesh and CornerTable.
|
|
35
|
+
DEFINE_NEW_DRACO_INDEX_TYPE(uint32_t, FaceIndex)
|
|
36
|
+
|
|
37
|
+
// Constants denoting invalid indices.
|
|
38
|
+
static constexpr AttributeValueIndex kInvalidAttributeValueIndex(
|
|
39
|
+
std::numeric_limits<uint32_t>::max());
|
|
40
|
+
static constexpr PointIndex kInvalidPointIndex(
|
|
41
|
+
std::numeric_limits<uint32_t>::max());
|
|
42
|
+
static constexpr VertexIndex kInvalidVertexIndex(
|
|
43
|
+
std::numeric_limits<uint32_t>::max());
|
|
44
|
+
static constexpr CornerIndex kInvalidCornerIndex(
|
|
45
|
+
std::numeric_limits<uint32_t>::max());
|
|
46
|
+
static constexpr FaceIndex kInvalidFaceIndex(
|
|
47
|
+
std::numeric_limits<uint32_t>::max());
|
|
48
|
+
|
|
49
|
+
// TODO(ostava): Add strongly typed indices for attribute id and unique
|
|
50
|
+
// attribute id.
|
|
51
|
+
|
|
52
|
+
} // namespace draco
|
|
53
|
+
|
|
54
|
+
#endif // DRACO_ATTRIBUTES_GEOMETRY_INDICES_H_
|