draco_web_decoder.idl 9.1 KB

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