-
Notifications
You must be signed in to change notification settings - Fork 955
/
draco_web_decoder.idl
283 lines (238 loc) · 9.06 KB
/
draco_web_decoder.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
// Interface exposed to emscripten's WebIDL Binder.
// http://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html
// Deprecated: DecoderBuffer is no longer supported and will be removed in
// future releases. Please refer to Decoder declaration below for
// new decoding functions that do not use DecoderBuffer.
[Prefix="draco::"]
interface DecoderBuffer {
void DecoderBuffer();
void Init([Const] byte[] data, unsigned long data_size);
};
// TODO(fgalligan): Can we remove this?
enum draco_AttributeTransformType {
"draco::ATTRIBUTE_INVALID_TRANSFORM",
"draco::ATTRIBUTE_NO_TRANSFORM",
"draco::ATTRIBUTE_QUANTIZATION_TRANSFORM",
"draco::ATTRIBUTE_OCTAHEDRON_TRANSFORM"
};
[Prefix="draco::"]
interface AttributeTransformData {
void AttributeTransformData();
long transform_type();
};
enum draco_GeometryAttribute_Type {
"draco_GeometryAttribute::INVALID",
"draco_GeometryAttribute::POSITION",
"draco_GeometryAttribute::NORMAL",
"draco_GeometryAttribute::COLOR",
"draco_GeometryAttribute::TEX_COORD",
"draco_GeometryAttribute::GENERIC"
};
[Prefix="draco::"]
interface GeometryAttribute {
void GeometryAttribute();
};
enum draco_EncodedGeometryType {
"draco::INVALID_GEOMETRY_TYPE",
"draco::POINT_CLOUD",
"draco::TRIANGULAR_MESH"
};
enum draco_DataType {
"draco::DT_INVALID",
"draco::DT_INT8",
"draco::DT_UINT8",
"draco::DT_INT16",
"draco::DT_UINT16",
"draco::DT_INT32",
"draco::DT_UINT32",
"draco::DT_INT64",
"draco::DT_UINT64",
"draco::DT_FLOAT32",
"draco::DT_FLOAT64",
"draco::DT_BOOL",
"draco::DT_TYPES_COUNT"
};
[Prefix="draco::"]
interface PointAttribute {
void PointAttribute();
long size();
[Const] AttributeTransformData GetAttributeTransformData();
// From GeometryAttribute
long attribute_type();
long data_type();
byte num_components();
boolean normalized();
long byte_stride();
long byte_offset();
long unique_id();
};
[Prefix="draco::"]
interface AttributeQuantizationTransform {
void AttributeQuantizationTransform();
boolean InitFromAttribute([Ref, Const] PointAttribute att);
long quantization_bits();
float min_value(long axis);
float range();
};
[Prefix="draco::"]
interface AttributeOctahedronTransform {
void AttributeOctahedronTransform();
boolean InitFromAttribute([Ref, Const] PointAttribute att);
long quantization_bits();
};
[Prefix="draco::"]
interface PointCloud {
void PointCloud();
long num_attributes();
long num_points();
};
[Prefix="draco::"]
interface Mesh : PointCloud {
void Mesh();
long num_faces();
// From PointCloud
long num_attributes();
long num_points();
};
[Prefix="draco::"]
interface Metadata {
void Metadata();
};
enum draco_StatusCode {
"draco_Status::OK",
"draco_Status::DRACO_ERROR",
"draco_Status::IO_ERROR",
"draco_Status::INVALID_PARAMETER",
"draco_Status::UNSUPPORTED_VERSION",
"draco_Status::UNKNOWN_VERSION",
};
[Prefix="draco::"]
interface Status {
draco_StatusCode code();
boolean ok();
[Const] DOMString error_msg();
};
// Draco version of typed arrays. The memory of these arrays is allocated on the
// emscripten heap.
interface DracoFloat32Array {
void DracoFloat32Array();
float GetValue(long index);
long size();
};
interface DracoInt8Array {
void DracoInt8Array();
byte GetValue(long index);
long size();
};
interface DracoUInt8Array {
void DracoUInt8Array();
octet GetValue(long index);
long size();
};
interface DracoInt16Array {
void DracoInt16Array();
short GetValue(long index);
long size();
};
interface DracoUInt16Array {
void DracoUInt16Array();
unsigned short GetValue(long index);
long size();
};
interface DracoInt32Array {
void DracoInt32Array();
long GetValue(long index);
long size();
};
interface DracoUInt32Array {
void DracoUInt32Array();
unsigned long GetValue(long index);
long size();
};
interface MetadataQuerier {
void MetadataQuerier();
boolean HasEntry([Ref, Const] Metadata metadata,
[Const] DOMString entry_name);
long GetIntEntry([Ref, Const] Metadata metadata,
[Const] DOMString entry_name);
void GetIntEntryArray([Ref, Const] Metadata metadata,
[Const] DOMString entry_name,
DracoInt32Array out_values);
double GetDoubleEntry([Ref, Const] Metadata metadata,
[Const] DOMString entry_name);
[Const] DOMString GetStringEntry([Ref, Const] Metadata metadata,
[Const] DOMString entry_name);
long NumEntries([Ref, Const] Metadata metadata);
[Const] DOMString GetEntryName([Ref, Const] Metadata metadata, long entry_id);
};
interface Decoder {
void Decoder();
[Const] Status DecodeArrayToPointCloud([Const] byte[] data,
unsigned long data_size,
PointCloud out_point_cloud);
[Const] Status DecodeArrayToMesh([Const] byte[] data,
unsigned long data_size,
Mesh out_mesh);
long GetAttributeId([Ref, Const] PointCloud pc,
draco_GeometryAttribute_Type type);
long GetAttributeIdByName([Ref, Const] PointCloud pc, [Const] DOMString name);
long GetAttributeIdByMetadataEntry([Ref, Const] PointCloud pc,
[Const] DOMString name,
[Const] DOMString value);
[Const] PointAttribute GetAttribute([Ref, Const] PointCloud pc, long att_id);
[Const] PointAttribute GetAttributeByUniqueId([Ref, Const] PointCloud pc,
long unique_id);
[Const] Metadata GetMetadata([Ref, Const] PointCloud pc);
[Const] Metadata GetAttributeMetadata([Ref, Const] PointCloud pc,
long att_id);
boolean GetFaceFromMesh([Ref, Const] Mesh m, long face_id,
DracoInt32Array out_values);
long GetTriangleStripsFromMesh([Ref, Const] Mesh m,
DracoInt32Array strip_values);
boolean GetTrianglesUInt16Array([Ref, Const] Mesh m,
long out_size, VoidPtr out_values);
boolean GetTrianglesUInt32Array([Ref, Const] Mesh m,
long out_size, VoidPtr out_values);
boolean GetAttributeFloat([Ref, Const] PointAttribute pa,
long att_index,
DracoFloat32Array out_values);
boolean GetAttributeFloatForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoFloat32Array out_values);
// Deprecated, use GetAttributeInt32ForAllPoints instead.
boolean GetAttributeIntForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoInt32Array out_values);
boolean GetAttributeInt8ForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoInt8Array out_values);
boolean GetAttributeUInt8ForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoUInt8Array out_values);
boolean GetAttributeInt16ForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoInt16Array out_values);
boolean GetAttributeUInt16ForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoUInt16Array out_values);
boolean GetAttributeInt32ForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoInt32Array out_values);
boolean GetAttributeUInt32ForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
DracoUInt32Array out_values);
boolean GetAttributeDataArrayForAllPoints([Ref, Const] PointCloud pc,
[Ref, Const] PointAttribute pa,
draco_DataType data_type,
long out_size, VoidPtr out_values);
void SkipAttributeTransform(draco_GeometryAttribute_Type att_type);
// Deprecated: Use decoder.GetEncodedGeometryType(array) instead, where
// |array| is an Int8Array containing the encoded data.
draco_EncodedGeometryType GetEncodedGeometryType_Deprecated(
DecoderBuffer in_buffer);
// Deprecated: UseDecodeArrayToPointCloud instead.
[Const] Status DecodeBufferToPointCloud(DecoderBuffer in_buffer,
PointCloud out_point_cloud);
// Deprecated: UseDecodeArrayToMesh instead.
[Const] Status DecodeBufferToMesh(DecoderBuffer in_buffer, Mesh out_mesh);
};