@loaders.gl/gltf 4.0.0-alpha.1 → 4.0.0-alpha.11

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 (332) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +2 -2
  4. package/dist/dist.min.js +5767 -0
  5. package/dist/es5/bundle.js +6 -0
  6. package/dist/es5/bundle.js.map +1 -0
  7. package/dist/es5/glb-loader.js +56 -0
  8. package/dist/es5/glb-loader.js.map +1 -0
  9. package/dist/es5/glb-writer.js +34 -0
  10. package/dist/es5/glb-writer.js.map +1 -0
  11. package/dist/es5/gltf-loader.js +81 -0
  12. package/dist/es5/gltf-loader.js.map +1 -0
  13. package/dist/es5/gltf-writer.js +35 -0
  14. package/dist/es5/gltf-writer.js.map +1 -0
  15. package/dist/es5/index.js +55 -0
  16. package/dist/es5/index.js.map +1 -0
  17. package/dist/es5/lib/api/gltf-extensions.js +109 -0
  18. package/dist/es5/lib/api/gltf-extensions.js.map +1 -0
  19. package/dist/es5/lib/api/gltf-scenegraph.js +598 -0
  20. package/dist/es5/lib/api/gltf-scenegraph.js.map +1 -0
  21. package/dist/es5/lib/api/normalize-gltf-v1.js +331 -0
  22. package/dist/es5/lib/api/normalize-gltf-v1.js.map +1 -0
  23. package/dist/es5/lib/api/post-process-gltf.js +470 -0
  24. package/dist/es5/lib/api/post-process-gltf.js.map +1 -0
  25. package/dist/es5/lib/encoders/encode-glb.js +61 -0
  26. package/dist/es5/lib/encoders/encode-glb.js.map +1 -0
  27. package/dist/es5/lib/encoders/encode-gltf.js +20 -0
  28. package/dist/es5/lib/encoders/encode-gltf.js.map +1 -0
  29. package/dist/es5/lib/extensions/EXT_meshopt_compression.js +94 -0
  30. package/dist/es5/lib/extensions/EXT_meshopt_compression.js.map +1 -0
  31. package/dist/es5/lib/extensions/EXT_texture_webp.js +43 -0
  32. package/dist/es5/lib/extensions/EXT_texture_webp.js.map +1 -0
  33. package/dist/es5/lib/extensions/KHR_binary_gltf.js +39 -0
  34. package/dist/es5/lib/extensions/KHR_binary_gltf.js.map +1 -0
  35. package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js +247 -0
  36. package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js.map +1 -0
  37. package/dist/es5/lib/extensions/KHR_texture_basisu.js +36 -0
  38. package/dist/es5/lib/extensions/KHR_texture_basisu.js.map +1 -0
  39. package/dist/es5/lib/extensions/KHR_texture_transform.js +230 -0
  40. package/dist/es5/lib/extensions/KHR_texture_transform.js.map +1 -0
  41. package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +281 -0
  42. package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -0
  43. package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js +99 -0
  44. package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -0
  45. package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js +76 -0
  46. package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -0
  47. package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js +113 -0
  48. package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -0
  49. package/dist/es5/lib/gltf-utils/get-typed-array.js +23 -0
  50. package/dist/es5/lib/gltf-utils/get-typed-array.js.map +1 -0
  51. package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js +68 -0
  52. package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js.map +1 -0
  53. package/dist/es5/lib/gltf-utils/gltf-constants.js +48 -0
  54. package/dist/es5/lib/gltf-utils/gltf-constants.js.map +1 -0
  55. package/dist/es5/lib/gltf-utils/gltf-utils.js +86 -0
  56. package/dist/es5/lib/gltf-utils/gltf-utils.js.map +1 -0
  57. package/dist/es5/lib/gltf-utils/resolve-url.js +18 -0
  58. package/dist/es5/lib/gltf-utils/resolve-url.js.map +1 -0
  59. package/dist/es5/lib/parsers/parse-glb.js +120 -0
  60. package/dist/es5/lib/parsers/parse-glb.js.map +1 -0
  61. package/dist/es5/lib/parsers/parse-gltf.js +280 -0
  62. package/dist/es5/lib/parsers/parse-gltf.js.map +1 -0
  63. package/dist/es5/lib/types/glb-types.js +2 -0
  64. package/dist/es5/lib/types/glb-types.js.map +1 -0
  65. package/dist/es5/lib/types/gltf-json-schema.js +2 -0
  66. package/dist/es5/lib/types/gltf-json-schema.js.map +1 -0
  67. package/dist/es5/lib/types/gltf-postprocessed-schema.js +2 -0
  68. package/dist/es5/lib/types/gltf-postprocessed-schema.js.map +1 -0
  69. package/dist/es5/lib/types/gltf-types.js +2 -0
  70. package/dist/es5/lib/types/gltf-types.js.map +1 -0
  71. package/dist/es5/lib/utils/assert.js +12 -0
  72. package/dist/es5/lib/utils/assert.js.map +1 -0
  73. package/dist/es5/lib/utils/version.js +9 -0
  74. package/dist/es5/lib/utils/version.js.map +1 -0
  75. package/dist/es5/meshopt/meshopt-decoder.js +215 -0
  76. package/dist/es5/meshopt/meshopt-decoder.js.map +1 -0
  77. package/dist/es5/webp/webp.js +83 -0
  78. package/dist/es5/webp/webp.js.map +1 -0
  79. package/dist/esm/bundle.js +4 -0
  80. package/dist/esm/bundle.js.map +1 -0
  81. package/dist/esm/glb-loader.js +31 -0
  82. package/dist/esm/glb-loader.js.map +1 -0
  83. package/dist/esm/glb-writer.js +27 -0
  84. package/dist/esm/glb-writer.js.map +1 -0
  85. package/dist/esm/gltf-loader.js +51 -0
  86. package/dist/esm/gltf-loader.js.map +1 -0
  87. package/dist/esm/gltf-writer.js +28 -0
  88. package/dist/esm/gltf-writer.js.map +1 -0
  89. package/dist/esm/index.js +8 -0
  90. package/dist/esm/index.js.map +1 -0
  91. package/dist/esm/lib/api/gltf-extensions.js +35 -0
  92. package/dist/esm/lib/api/gltf-extensions.js.map +1 -0
  93. package/dist/esm/lib/api/gltf-scenegraph.js +455 -0
  94. package/dist/esm/lib/api/gltf-scenegraph.js.map +1 -0
  95. package/dist/esm/lib/api/normalize-gltf-v1.js +204 -0
  96. package/dist/esm/lib/api/normalize-gltf-v1.js.map +1 -0
  97. package/dist/esm/lib/api/post-process-gltf.js +396 -0
  98. package/dist/esm/lib/api/post-process-gltf.js.map +1 -0
  99. package/dist/esm/lib/encoders/encode-glb.js +54 -0
  100. package/dist/esm/lib/encoders/encode-glb.js.map +1 -0
  101. package/dist/esm/lib/encoders/encode-gltf.js +14 -0
  102. package/dist/esm/lib/encoders/encode-gltf.js.map +1 -0
  103. package/dist/esm/lib/extensions/EXT_meshopt_compression.js +41 -0
  104. package/dist/esm/lib/extensions/EXT_meshopt_compression.js.map +1 -0
  105. package/dist/esm/lib/extensions/EXT_texture_webp.js +25 -0
  106. package/dist/esm/lib/extensions/EXT_texture_webp.js.map +1 -0
  107. package/dist/esm/lib/extensions/KHR_binary_gltf.js +21 -0
  108. package/dist/esm/lib/extensions/KHR_binary_gltf.js.map +1 -0
  109. package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js +111 -0
  110. package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js.map +1 -0
  111. package/dist/esm/lib/extensions/KHR_texture_basisu.js +18 -0
  112. package/dist/esm/lib/extensions/KHR_texture_basisu.js.map +1 -0
  113. package/dist/esm/lib/extensions/KHR_texture_transform.js +182 -0
  114. package/dist/esm/lib/extensions/KHR_texture_transform.js.map +1 -0
  115. package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js +223 -0
  116. package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -0
  117. package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js +42 -0
  118. package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -0
  119. package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js +33 -0
  120. package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -0
  121. package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js +61 -0
  122. package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -0
  123. package/dist/esm/lib/gltf-utils/get-typed-array.js +16 -0
  124. package/dist/esm/lib/gltf-utils/get-typed-array.js.map +1 -0
  125. package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js +62 -0
  126. package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js.map +1 -0
  127. package/dist/esm/lib/gltf-utils/gltf-constants.js +37 -0
  128. package/dist/esm/lib/gltf-utils/gltf-constants.js.map +1 -0
  129. package/dist/esm/lib/gltf-utils/gltf-utils.js +74 -0
  130. package/dist/esm/lib/gltf-utils/gltf-utils.js.map +1 -0
  131. package/dist/esm/lib/gltf-utils/resolve-url.js +12 -0
  132. package/dist/esm/lib/gltf-utils/resolve-url.js.map +1 -0
  133. package/dist/esm/lib/parsers/parse-glb.js +114 -0
  134. package/dist/esm/lib/parsers/parse-glb.js.map +1 -0
  135. package/dist/esm/lib/parsers/parse-gltf.js +151 -0
  136. package/dist/esm/lib/parsers/parse-gltf.js.map +1 -0
  137. package/dist/esm/lib/types/glb-types.js +2 -0
  138. package/dist/esm/lib/types/glb-types.js.map +1 -0
  139. package/dist/esm/lib/types/gltf-json-schema.js +2 -0
  140. package/dist/esm/lib/types/gltf-json-schema.js.map +1 -0
  141. package/dist/esm/lib/types/gltf-postprocessed-schema.js +2 -0
  142. package/dist/esm/lib/types/gltf-postprocessed-schema.js.map +1 -0
  143. package/dist/esm/lib/types/gltf-types.js +2 -0
  144. package/dist/esm/lib/types/gltf-types.js.map +1 -0
  145. package/dist/esm/lib/utils/assert.js +6 -0
  146. package/dist/esm/lib/utils/assert.js.map +1 -0
  147. package/dist/esm/lib/utils/version.js +2 -0
  148. package/dist/esm/lib/utils/version.js.map +1 -0
  149. package/dist/esm/meshopt/meshopt-decoder.js +91 -0
  150. package/dist/esm/meshopt/meshopt-decoder.js.map +1 -0
  151. package/dist/esm/meshopt/meshopt-encoder.ts.disabled +409 -0
  152. package/dist/esm/webp/webp.js +25 -0
  153. package/dist/esm/webp/webp.js.map +1 -0
  154. package/dist/glb-loader.d.ts +14 -0
  155. package/dist/glb-loader.d.ts.map +1 -0
  156. package/dist/glb-loader.js +30 -28
  157. package/dist/glb-writer.d.ts +13 -0
  158. package/dist/glb-writer.d.ts.map +1 -0
  159. package/dist/glb-writer.js +32 -26
  160. package/dist/gltf-loader.d.ts +19 -0
  161. package/dist/gltf-loader.d.ts.map +1 -0
  162. package/dist/gltf-loader.js +46 -43
  163. package/dist/gltf-writer.d.ts +25 -0
  164. package/dist/gltf-writer.d.ts.map +1 -0
  165. package/dist/gltf-writer.js +29 -26
  166. package/dist/index.d.ts +15 -0
  167. package/dist/index.d.ts.map +1 -0
  168. package/dist/index.js +28 -7
  169. package/dist/lib/api/gltf-extensions.d.ts +31 -0
  170. package/dist/lib/api/gltf-extensions.d.ts.map +1 -0
  171. package/dist/lib/api/gltf-extensions.js +79 -31
  172. package/dist/lib/api/gltf-scenegraph.d.ts +180 -0
  173. package/dist/lib/api/gltf-scenegraph.d.ts.map +1 -0
  174. package/dist/lib/api/gltf-scenegraph.js +578 -513
  175. package/dist/lib/api/normalize-gltf-v1.d.ts +2 -0
  176. package/dist/lib/api/normalize-gltf-v1.d.ts.map +1 -0
  177. package/dist/lib/api/normalize-gltf-v1.js +278 -226
  178. package/dist/lib/api/post-process-gltf.d.ts +5 -0
  179. package/dist/lib/api/post-process-gltf.d.ts.map +1 -0
  180. package/dist/lib/api/post-process-gltf.js +386 -345
  181. package/dist/lib/encoders/encode-glb.d.ts +15 -0
  182. package/dist/lib/encoders/encode-glb.d.ts.map +1 -0
  183. package/dist/lib/encoders/encode-glb.js +67 -58
  184. package/dist/lib/encoders/encode-gltf.d.ts +20 -0
  185. package/dist/lib/encoders/encode-gltf.d.ts.map +1 -0
  186. package/dist/lib/encoders/encode-gltf.js +30 -12
  187. package/dist/lib/extensions/EXT_meshopt_compression.d.ts +7 -0
  188. package/dist/lib/extensions/EXT_meshopt_compression.d.ts.map +1 -0
  189. package/dist/lib/extensions/EXT_meshopt_compression.js +35 -50
  190. package/dist/lib/extensions/EXT_texture_webp.d.ts +12 -0
  191. package/dist/lib/extensions/EXT_texture_webp.d.ts.map +1 -0
  192. package/dist/lib/extensions/EXT_texture_webp.js +32 -28
  193. package/dist/lib/extensions/KHR_binary_gltf.d.ts +7 -0
  194. package/dist/lib/extensions/KHR_binary_gltf.d.ts.map +1 -0
  195. package/dist/lib/extensions/KHR_binary_gltf.js +36 -23
  196. package/dist/lib/extensions/KHR_draco_mesh_compression.d.ts +13 -0
  197. package/dist/lib/extensions/KHR_draco_mesh_compression.d.ts.map +1 -0
  198. package/dist/lib/extensions/KHR_draco_mesh_compression.js +123 -111
  199. package/dist/lib/extensions/KHR_texture_basisu.d.ts +12 -0
  200. package/dist/lib/extensions/KHR_texture_basisu.d.ts.map +1 -0
  201. package/dist/lib/extensions/KHR_texture_basisu.js +26 -19
  202. package/dist/lib/extensions/KHR_texture_transform.d.ts +13 -0
  203. package/dist/lib/extensions/KHR_texture_transform.d.ts.map +1 -0
  204. package/dist/lib/extensions/KHR_texture_transform.js +227 -0
  205. package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts +7 -0
  206. package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts.map +1 -0
  207. package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +290 -0
  208. package/dist/lib/extensions/deprecated/KHR_lights_punctual.d.ts +7 -0
  209. package/dist/lib/extensions/deprecated/KHR_lights_punctual.d.ts.map +1 -0
  210. package/dist/lib/extensions/deprecated/KHR_lights_punctual.js +54 -44
  211. package/dist/lib/extensions/deprecated/KHR_materials_unlit.d.ts +7 -0
  212. package/dist/lib/extensions/deprecated/KHR_materials_unlit.d.ts.map +1 -0
  213. package/dist/lib/extensions/deprecated/KHR_materials_unlit.js +39 -32
  214. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts +7 -0
  215. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.d.ts.map +1 -0
  216. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js +73 -62
  217. package/dist/lib/gltf-utils/get-typed-array.d.ts +3 -0
  218. package/dist/lib/gltf-utils/get-typed-array.d.ts.map +1 -0
  219. package/dist/lib/gltf-utils/get-typed-array.js +39 -14
  220. package/dist/lib/gltf-utils/gltf-attribute-utils.d.ts +6 -0
  221. package/dist/lib/gltf-utils/gltf-attribute-utils.d.ts.map +1 -0
  222. package/dist/lib/gltf-utils/gltf-attribute-utils.js +65 -65
  223. package/dist/lib/gltf-utils/gltf-constants.d.ts +21 -0
  224. package/dist/lib/gltf-utils/gltf-constants.d.ts.map +1 -0
  225. package/dist/lib/gltf-utils/gltf-constants.js +38 -32
  226. package/dist/lib/gltf-utils/gltf-utils.d.ts +15 -0
  227. package/dist/lib/gltf-utils/gltf-utils.d.ts.map +1 -0
  228. package/dist/lib/gltf-utils/gltf-utils.js +79 -45
  229. package/dist/lib/gltf-utils/resolve-url.d.ts +2 -0
  230. package/dist/lib/gltf-utils/resolve-url.d.ts.map +1 -0
  231. package/dist/lib/gltf-utils/resolve-url.js +17 -15
  232. package/dist/lib/parsers/parse-glb.d.ts +20 -0
  233. package/dist/lib/parsers/parse-glb.d.ts.map +1 -0
  234. package/dist/lib/parsers/parse-glb.js +143 -105
  235. package/dist/lib/parsers/parse-gltf.d.ts +18 -0
  236. package/dist/lib/parsers/parse-gltf.d.ts.map +1 -0
  237. package/dist/lib/parsers/parse-gltf.js +164 -155
  238. package/dist/lib/types/glb-types.d.ts +17 -0
  239. package/dist/lib/types/glb-types.d.ts.map +1 -0
  240. package/dist/lib/types/glb-types.js +2 -2
  241. package/dist/lib/types/gltf-json-schema.d.ts +1119 -0
  242. package/dist/lib/types/gltf-json-schema.d.ts.map +1 -0
  243. package/dist/lib/types/gltf-json-schema.js +4 -2
  244. package/dist/lib/types/gltf-postprocessed-schema.d.ts +651 -0
  245. package/dist/lib/types/gltf-postprocessed-schema.d.ts.map +1 -0
  246. package/dist/lib/types/gltf-postprocessed-schema.js +4 -2
  247. package/dist/lib/types/gltf-types.d.ts +26 -0
  248. package/dist/lib/types/gltf-types.d.ts.map +1 -0
  249. package/dist/lib/types/gltf-types.js +3 -2
  250. package/dist/lib/utils/assert.d.ts +2 -0
  251. package/dist/lib/utils/assert.d.ts.map +1 -0
  252. package/dist/lib/utils/assert.js +11 -5
  253. package/dist/lib/utils/version.d.ts +2 -0
  254. package/dist/lib/utils/version.d.ts.map +1 -0
  255. package/dist/lib/utils/version.js +7 -2
  256. package/dist/meshopt/meshopt-decoder.d.ts +6 -0
  257. package/dist/meshopt/meshopt-decoder.d.ts.map +1 -0
  258. package/dist/meshopt/meshopt-decoder.js +97 -82
  259. package/dist/webp/webp.d.ts +7 -0
  260. package/dist/webp/webp.d.ts.map +1 -0
  261. package/dist/webp/webp.js +32 -23
  262. package/package.json +11 -13
  263. package/src/glb-loader.ts +4 -4
  264. package/src/glb-writer.ts +11 -3
  265. package/src/gltf-loader.ts +12 -8
  266. package/src/gltf-writer.ts +2 -2
  267. package/src/index.ts +34 -5
  268. package/src/lib/api/gltf-extensions.ts +14 -3
  269. package/src/lib/api/gltf-scenegraph.ts +68 -40
  270. package/src/lib/api/{normalize-gltf-v1.js → normalize-gltf-v1.ts} +20 -17
  271. package/src/lib/api/post-process-gltf.ts +556 -0
  272. package/src/lib/encoders/{encode-glb.js → encode-glb.ts} +21 -4
  273. package/src/lib/encoders/encode-gltf.ts +34 -0
  274. package/src/lib/extensions/EXT_meshopt_compression.ts +16 -25
  275. package/src/lib/extensions/EXT_texture_webp.ts +5 -4
  276. package/src/lib/extensions/KHR_binary_gltf.ts +3 -3
  277. package/src/lib/extensions/KHR_draco_mesh_compression.ts +8 -8
  278. package/src/lib/extensions/KHR_texture_basisu.ts +6 -5
  279. package/src/lib/extensions/KHR_texture_transform.ts +308 -0
  280. package/src/lib/extensions/deprecated/EXT_feature_metadata.ts +404 -0
  281. package/src/lib/extensions/deprecated/KHR_lights_punctual.ts +2 -2
  282. package/src/lib/extensions/deprecated/KHR_materials_unlit.ts +5 -5
  283. package/src/lib/extensions/deprecated/KHR_techniques_webgl.ts +3 -2
  284. package/src/lib/gltf-utils/gltf-attribute-utils.ts +1 -1
  285. package/src/lib/gltf-utils/gltf-constants.ts +2 -2
  286. package/src/lib/gltf-utils/gltf-utils.ts +31 -0
  287. package/src/lib/parsers/parse-glb.ts +50 -24
  288. package/src/lib/parsers/parse-gltf.ts +38 -28
  289. package/src/lib/types/glb-types.ts +1 -1
  290. package/src/lib/types/gltf-json-schema.ts +585 -126
  291. package/src/lib/types/gltf-postprocessed-schema.ts +290 -212
  292. package/src/lib/types/gltf-types.ts +43 -43
  293. package/src/lib/utils/{assert.js → assert.ts} +1 -1
  294. package/dist/bundle.js.map +0 -1
  295. package/dist/glb-loader.js.map +0 -1
  296. package/dist/glb-writer.js.map +0 -1
  297. package/dist/gltf-loader.js.map +0 -1
  298. package/dist/gltf-writer.js.map +0 -1
  299. package/dist/index.js.map +0 -1
  300. package/dist/lib/api/gltf-extensions.js.map +0 -1
  301. package/dist/lib/api/gltf-scenegraph.js.map +0 -1
  302. package/dist/lib/api/normalize-gltf-v1.js.map +0 -1
  303. package/dist/lib/api/post-process-gltf.js.map +0 -1
  304. package/dist/lib/encoders/encode-glb.js.map +0 -1
  305. package/dist/lib/encoders/encode-gltf.js.map +0 -1
  306. package/dist/lib/extensions/EXT_meshopt_compression.js.map +0 -1
  307. package/dist/lib/extensions/EXT_texture_webp.js.map +0 -1
  308. package/dist/lib/extensions/KHR_binary_gltf.js.map +0 -1
  309. package/dist/lib/extensions/KHR_draco_mesh_compression.js.map +0 -1
  310. package/dist/lib/extensions/KHR_texture_basisu.js.map +0 -1
  311. package/dist/lib/extensions/deprecated/KHR_lights_punctual.js.map +0 -1
  312. package/dist/lib/extensions/deprecated/KHR_materials_unlit.js.map +0 -1
  313. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js.map +0 -1
  314. package/dist/lib/gltf-utils/get-typed-array.js.map +0 -1
  315. package/dist/lib/gltf-utils/gltf-attribute-utils.js.map +0 -1
  316. package/dist/lib/gltf-utils/gltf-constants.js.map +0 -1
  317. package/dist/lib/gltf-utils/gltf-utils.js.map +0 -1
  318. package/dist/lib/gltf-utils/resolve-url.js.map +0 -1
  319. package/dist/lib/parsers/parse-glb.js.map +0 -1
  320. package/dist/lib/parsers/parse-gltf.js.map +0 -1
  321. package/dist/lib/types/glb-types.js.map +0 -1
  322. package/dist/lib/types/gltf-json-schema.js.map +0 -1
  323. package/dist/lib/types/gltf-postprocessed-schema.js.map +0 -1
  324. package/dist/lib/types/gltf-types.js.map +0 -1
  325. package/dist/lib/utils/assert.js.map +0 -1
  326. package/dist/lib/utils/version.js.map +0 -1
  327. package/dist/meshopt/meshopt-decoder.js.map +0 -1
  328. package/dist/webp/webp.js.map +0 -1
  329. package/src/lib/api/post-process-gltf.js +0 -388
  330. package/src/lib/encoders/encode-gltf.js +0 -25
  331. /package/dist/{meshopt → es5/meshopt}/meshopt-encoder.ts.disabled +0 -0
  332. /package/src/lib/utils/{version.js → version.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-typed-array.d.ts","sourceRoot":"","sources":["../../../src/lib/gltf-utils/get-typed-array.ts"],"names":[],"mappings":"AAKA,wBAAgB,0BAA0B,CAAC,IAAI,KAAA,EAAE,OAAO,KAAA,EAAE,eAAe,KAAA,cAWxE;AAID,wBAAgB,yBAAyB,CAAC,IAAI,KAAA,EAAE,OAAO,KAAA,EAAE,UAAU,KAAA,cAIlE"}
@@ -1,16 +1,41 @@
1
- import { assert } from '../utils/assert';
2
- export function getTypedArrayForBufferView(json, buffers, bufferViewIndex) {
3
- const bufferView = json.bufferViews[bufferViewIndex];
4
- assert(bufferView);
5
- const bufferIndex = bufferView.buffer;
6
- const binChunk = buffers[bufferIndex];
7
- assert(binChunk);
8
- const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;
9
- return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTypedArrayForImageData = exports.getTypedArrayForBufferView = void 0;
4
+ // TODO - GLTFScenegraph should use these
5
+ const assert_1 = require("../utils/assert");
6
+ // accepts buffer view index or buffer view object
7
+ // returns a `Uint8Array`
8
+ function getTypedArrayForBufferView(json, buffers, bufferViewIndex) {
9
+ const bufferView = json.bufferViews[bufferViewIndex];
10
+ (0, assert_1.assert)(bufferView);
11
+ // Get hold of the arrayBuffer
12
+ const bufferIndex = bufferView.buffer;
13
+ const binChunk = buffers[bufferIndex];
14
+ (0, assert_1.assert)(binChunk);
15
+ const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;
16
+ return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);
10
17
  }
11
- export function getTypedArrayForImageData(json, buffers, imageIndex) {
12
- const image = json.images[imageIndex];
13
- const bufferViewIndex = json.bufferViews[image.bufferView];
14
- return getTypedArrayForBufferView(json, buffers, bufferViewIndex);
18
+ exports.getTypedArrayForBufferView = getTypedArrayForBufferView;
19
+ // accepts accessor index or accessor object
20
+ // returns a `Uint8Array`
21
+ function getTypedArrayForImageData(json, buffers, imageIndex) {
22
+ const image = json.images[imageIndex];
23
+ const bufferViewIndex = json.bufferViews[image.bufferView];
24
+ return getTypedArrayForBufferView(json, buffers, bufferViewIndex);
15
25
  }
16
- //# sourceMappingURL=get-typed-array.js.map
26
+ exports.getTypedArrayForImageData = getTypedArrayForImageData;
27
+ /*
28
+ // accepts accessor index or accessor object
29
+ // returns a typed array with type that matches the types
30
+ export function getTypedArrayForAccessor(accessor) {
31
+ accessor = this.getAccessor(accessor);
32
+ const bufferView = this.getBufferView(accessor.bufferView);
33
+ const buffer = this.getBuffer(bufferView.buffer);
34
+ const arrayBuffer = buffer.data;
35
+
36
+ // Create a new typed array as a view into the combined buffer
37
+ const {ArrayType, length} = getAccessorArrayTypeAndLength(accessor, bufferView);
38
+ const byteOffset = bufferView.byteOffset + accessor.byteOffset;
39
+ return new ArrayType(arrayBuffer, byteOffset, length);
40
+ }
41
+ */
@@ -0,0 +1,6 @@
1
+ import type { GLTFAccessor } from '../types/gltf-json-schema';
2
+ export declare function getGLTFAccessors(attributes: any): {
3
+ [key: string]: GLTFAccessor;
4
+ };
5
+ export declare function getGLTFAccessor(attribute: any): GLTFAccessor;
6
+ //# sourceMappingURL=gltf-attribute-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gltf-attribute-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/gltf-utils/gltf-attribute-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAO5D,wBAAgB,gBAAgB,CAAC,UAAU,KAAA,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAAC,CAU1E;AAKD,wBAAgB,eAAe,CAAC,SAAS,KAAA,gBAmBxC"}
@@ -1,73 +1,73 @@
1
- import { getAccessorTypeFromSize, getComponentTypeFromArray } from './gltf-utils';
2
- export function getGLTFAccessors(attributes) {
3
- const accessors = {};
4
-
5
- for (const name in attributes) {
6
- const attribute = attributes[name];
7
-
8
- if (name !== 'indices') {
9
- const glTFAccessor = getGLTFAccessor(attribute);
10
- accessors[name] = glTFAccessor;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGLTFAccessor = exports.getGLTFAccessors = void 0;
4
+ // TODO - remove
5
+ const gltf_utils_1 = require("./gltf-utils");
6
+ // Returns a fresh attributes object with glTF-standardized attributes names
7
+ // Attributes that cannot be identified will not be included
8
+ // Removes `indices` if present, as it should be stored separately from the attributes
9
+ function getGLTFAccessors(attributes) {
10
+ const accessors = {};
11
+ for (const name in attributes) {
12
+ const attribute = attributes[name];
13
+ if (name !== 'indices') {
14
+ const glTFAccessor = getGLTFAccessor(attribute);
15
+ accessors[name] = glTFAccessor;
16
+ }
11
17
  }
12
- }
13
-
14
- return accessors;
18
+ return accessors;
15
19
  }
16
- export function getGLTFAccessor(attribute) {
17
- const {
18
- buffer,
19
- size,
20
- count
21
- } = getAccessorData(attribute);
22
- const glTFAccessor = {
23
- value: buffer,
24
- size,
25
- byteOffset: 0,
26
- count,
27
- type: getAccessorTypeFromSize(size),
28
- componentType: getComponentTypeFromArray(buffer)
29
- };
30
- return glTFAccessor;
20
+ exports.getGLTFAccessors = getGLTFAccessors;
21
+ // Fix up a single accessor.
22
+ // Input: typed array or a partial accessor object
23
+ // Return: accessor object
24
+ function getGLTFAccessor(attribute) {
25
+ const { buffer, size, count } = getAccessorData(attribute);
26
+ const glTFAccessor = {
27
+ // glTF Accessor values
28
+ // TODO: Instead of a bufferView index we could have an actual buffer (typed array)
29
+ // bufferView: null,
30
+ // TODO: Deprecate `value` in favor of bufferView?
31
+ // @ts-ignore
32
+ value: buffer,
33
+ size,
34
+ byteOffset: 0,
35
+ count,
36
+ type: (0, gltf_utils_1.getAccessorTypeFromSize)(size),
37
+ componentType: (0, gltf_utils_1.getComponentTypeFromArray)(buffer)
38
+ };
39
+ return glTFAccessor;
31
40
  }
32
-
41
+ exports.getGLTFAccessor = getGLTFAccessor;
42
+ // export function getGLTFAttribute(data, gltfAttributeName): GLTFAccessor {
43
+ // return data.attributes[data.glTFAttributeMap[gltfAttributeName]];
44
+ // }
33
45
  function getAccessorData(attribute) {
34
- let buffer = attribute;
35
- let size = 1;
36
- let count = 0;
37
-
38
- if (attribute && attribute.value) {
39
- buffer = attribute.value;
40
- size = attribute.size || 1;
41
- }
42
-
43
- if (buffer) {
44
- if (!ArrayBuffer.isView(buffer)) {
45
- buffer = toTypedArray(buffer, Float32Array);
46
+ let buffer = attribute;
47
+ let size = 1;
48
+ let count = 0;
49
+ if (attribute && attribute.value) {
50
+ buffer = attribute.value;
51
+ size = attribute.size || 1;
46
52
  }
47
-
48
- count = buffer.length / size;
49
- }
50
-
51
- return {
52
- buffer,
53
- size,
54
- count
55
- };
53
+ if (buffer) {
54
+ if (!ArrayBuffer.isView(buffer)) {
55
+ buffer = toTypedArray(buffer, Float32Array);
56
+ }
57
+ count = buffer.length / size;
58
+ }
59
+ return { buffer, size, count };
56
60
  }
57
-
61
+ // Convert non-typed arrays to arrays of specified format
58
62
  function toTypedArray(array, ArrayType, convertTypedArrays = false) {
59
- if (!array) {
60
- return null;
61
- }
62
-
63
- if (Array.isArray(array)) {
64
- return new ArrayType(array);
65
- }
66
-
67
- if (convertTypedArrays && !(array instanceof ArrayType)) {
68
- return new ArrayType(array);
69
- }
70
-
71
- return array;
63
+ if (!array) {
64
+ return null;
65
+ }
66
+ if (Array.isArray(array)) {
67
+ return new ArrayType(array);
68
+ }
69
+ if (convertTypedArrays && !(array instanceof ArrayType)) {
70
+ return new ArrayType(array);
71
+ }
72
+ return array;
72
73
  }
73
- //# sourceMappingURL=gltf-attribute-utils.js.map
@@ -0,0 +1,21 @@
1
+ export declare const COMPONENTS: {
2
+ SCALAR: number;
3
+ VEC2: number;
4
+ VEC3: number;
5
+ VEC4: number;
6
+ MAT2: number;
7
+ MAT3: number;
8
+ MAT4: number;
9
+ };
10
+ export declare const BYTES: {
11
+ 5120: number;
12
+ 5121: number;
13
+ 5122: number;
14
+ 5123: number;
15
+ 5125: number;
16
+ 5126: number;
17
+ };
18
+ export declare function getBytesFromComponentType(componentType: any): any;
19
+ export declare function getSizeFromAccessorType(type: any): any;
20
+ export declare function getGLEnumFromSamplerParameter(parameter: any): any;
21
+ //# sourceMappingURL=gltf-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gltf-constants.d.ts","sourceRoot":"","sources":["../../../src/lib/gltf-utils/gltf-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;CAQtB,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;CAOjB,CAAC;AAIF,wBAAgB,yBAAyB,CAAC,aAAa,KAAA,OAEtD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,KAAA,OAE3C;AAED,wBAAgB,6BAA6B,CAAC,SAAS,KAAA,OActD"}
@@ -1,37 +1,43 @@
1
- const COMPONENTS = {
2
- SCALAR: 1,
3
- VEC2: 2,
4
- VEC3: 3,
5
- VEC4: 4,
6
- MAT2: 4,
7
- MAT3: 9,
8
- MAT4: 16
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGLEnumFromSamplerParameter = exports.getSizeFromAccessorType = exports.getBytesFromComponentType = exports.BYTES = exports.COMPONENTS = void 0;
4
+ exports.COMPONENTS = {
5
+ SCALAR: 1,
6
+ VEC2: 2,
7
+ VEC3: 3,
8
+ VEC4: 4,
9
+ MAT2: 4,
10
+ MAT3: 9,
11
+ MAT4: 16
9
12
  };
10
- const BYTES = {
11
- 5120: 1,
12
- 5121: 1,
13
- 5122: 2,
14
- 5123: 2,
15
- 5125: 4,
16
- 5126: 4
13
+ exports.BYTES = {
14
+ 5120: 1,
15
+ 5121: 1,
16
+ 5122: 2,
17
+ 5123: 2,
18
+ 5125: 4,
19
+ 5126: 4 // FLOAT
17
20
  };
18
- export function getBytesFromComponentType(componentType) {
19
- return BYTES[componentType];
21
+ // ENUM LOOKUP
22
+ function getBytesFromComponentType(componentType) {
23
+ return exports.BYTES[componentType];
20
24
  }
21
- export function getSizeFromAccessorType(type) {
22
- return COMPONENTS[type];
25
+ exports.getBytesFromComponentType = getBytesFromComponentType;
26
+ function getSizeFromAccessorType(type) {
27
+ return exports.COMPONENTS[type];
23
28
  }
24
- export function getGLEnumFromSamplerParameter(parameter) {
25
- const GL_TEXTURE_MAG_FILTER = 0x2800;
26
- const GL_TEXTURE_MIN_FILTER = 0x2801;
27
- const GL_TEXTURE_WRAP_S = 0x2802;
28
- const GL_TEXTURE_WRAP_T = 0x2803;
29
- const PARAMETER_MAP = {
30
- magFilter: GL_TEXTURE_MAG_FILTER,
31
- minFilter: GL_TEXTURE_MIN_FILTER,
32
- wrapS: GL_TEXTURE_WRAP_S,
33
- wrapT: GL_TEXTURE_WRAP_T
34
- };
35
- return PARAMETER_MAP[parameter];
29
+ exports.getSizeFromAccessorType = getSizeFromAccessorType;
30
+ function getGLEnumFromSamplerParameter(parameter) {
31
+ const GL_TEXTURE_MAG_FILTER = 0x2800;
32
+ const GL_TEXTURE_MIN_FILTER = 0x2801;
33
+ const GL_TEXTURE_WRAP_S = 0x2802;
34
+ const GL_TEXTURE_WRAP_T = 0x2803;
35
+ const PARAMETER_MAP = {
36
+ magFilter: GL_TEXTURE_MAG_FILTER,
37
+ minFilter: GL_TEXTURE_MIN_FILTER,
38
+ wrapS: GL_TEXTURE_WRAP_S,
39
+ wrapT: GL_TEXTURE_WRAP_T
40
+ };
41
+ return PARAMETER_MAP[parameter];
36
42
  }
37
- //# sourceMappingURL=gltf-constants.js.map
43
+ exports.getGLEnumFromSamplerParameter = getGLEnumFromSamplerParameter;
@@ -0,0 +1,15 @@
1
+ import type { GLTFPostprocessed } from '../types/gltf-postprocessed-schema';
2
+ export declare function getAccessorTypeFromSize(size: any): string;
3
+ export declare function getComponentTypeFromArray(typedArray: any): number;
4
+ export declare function getAccessorArrayTypeAndLength(accessor: any, bufferView: any): {
5
+ ArrayType: any;
6
+ length: number;
7
+ byteLength: number;
8
+ };
9
+ /**
10
+ * Calculate the GPU memory used by a GLTF tile, for both buffer and texture memory
11
+ * @param gltf - the gltf content of a GLTF tile
12
+ * @returns - total memory usage in bytes
13
+ */
14
+ export declare function getMemoryUsageGLTF(gltf: GLTFPostprocessed): number;
15
+ //# sourceMappingURL=gltf-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gltf-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/gltf-utils/gltf-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oCAAoC,CAAC;AA+D1E,wBAAgB,uBAAuB,CAAC,IAAI,KAAA,UAG3C;AAED,wBAAgB,yBAAyB,CAAC,UAAU,KAAA,UAMnD;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,KAAA,EAAE,UAAU,KAAA;;;;EAQjE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAiBlE"}
@@ -1,56 +1,90 @@
1
- import { assert } from '../utils/assert';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMemoryUsageGLTF = exports.getAccessorArrayTypeAndLength = exports.getComponentTypeFromArray = exports.getAccessorTypeFromSize = void 0;
4
+ const assert_1 = require("../utils/assert");
5
+ /**
6
+ * Memory needed to store texture and all mipmap levels 1 + 1/4 + 1/16 + 1/64 + ...
7
+ * Minimum 1.33, but due to GPU layout may be 1.5
8
+ */
9
+ const MIPMAP_FACTOR = 1.33;
2
10
  const TYPES = ['SCALAR', 'VEC2', 'VEC3', 'VEC4'];
3
- const ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT = [[Int8Array, 5120], [Uint8Array, 5121], [Int16Array, 5122], [Uint16Array, 5123], [Uint32Array, 5125], [Float32Array, 5126], [Float64Array, 5130]];
11
+ const ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT = [
12
+ [Int8Array, 5120],
13
+ [Uint8Array, 5121],
14
+ [Int16Array, 5122],
15
+ [Uint16Array, 5123],
16
+ [Uint32Array, 5125],
17
+ [Float32Array, 5126],
18
+ [Float64Array, 5130]
19
+ ];
4
20
  const ARRAY_TO_COMPONENT_TYPE = new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);
5
21
  const ATTRIBUTE_TYPE_TO_COMPONENTS = {
6
- SCALAR: 1,
7
- VEC2: 2,
8
- VEC3: 3,
9
- VEC4: 4,
10
- MAT2: 4,
11
- MAT3: 9,
12
- MAT4: 16
22
+ SCALAR: 1,
23
+ VEC2: 2,
24
+ VEC3: 3,
25
+ VEC4: 4,
26
+ MAT2: 4,
27
+ MAT3: 9,
28
+ MAT4: 16
13
29
  };
14
30
  const ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {
15
- 5120: 1,
16
- 5121: 1,
17
- 5122: 2,
18
- 5123: 2,
19
- 5125: 4,
20
- 5126: 4
31
+ 5120: 1,
32
+ 5121: 1,
33
+ 5122: 2,
34
+ 5123: 2,
35
+ 5125: 4,
36
+ 5126: 4
21
37
  };
22
38
  const ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {
23
- 5120: Int8Array,
24
- 5121: Uint8Array,
25
- 5122: Int16Array,
26
- 5123: Uint16Array,
27
- 5125: Uint32Array,
28
- 5126: Float32Array
39
+ 5120: Int8Array,
40
+ 5121: Uint8Array,
41
+ 5122: Int16Array,
42
+ 5123: Uint16Array,
43
+ 5125: Uint32Array,
44
+ 5126: Float32Array
29
45
  };
30
- export function getAccessorTypeFromSize(size) {
31
- const type = TYPES[size - 1];
32
- return type || TYPES[0];
46
+ function getAccessorTypeFromSize(size) {
47
+ const type = TYPES[size - 1];
48
+ return type || TYPES[0];
33
49
  }
34
- export function getComponentTypeFromArray(typedArray) {
35
- const componentType = ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);
36
-
37
- if (!componentType) {
38
- throw new Error('Illegal typed array');
39
- }
40
-
41
- return componentType;
50
+ exports.getAccessorTypeFromSize = getAccessorTypeFromSize;
51
+ function getComponentTypeFromArray(typedArray) {
52
+ const componentType = ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);
53
+ if (!componentType) {
54
+ throw new Error('Illegal typed array');
55
+ }
56
+ return componentType;
42
57
  }
43
- export function getAccessorArrayTypeAndLength(accessor, bufferView) {
44
- const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];
45
- const components = ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];
46
- const bytesPerComponent = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];
47
- const length = accessor.count * components;
48
- const byteLength = accessor.count * components * bytesPerComponent;
49
- assert(byteLength >= 0 && byteLength <= bufferView.byteLength);
50
- return {
51
- ArrayType,
52
- length,
53
- byteLength
54
- };
58
+ exports.getComponentTypeFromArray = getComponentTypeFromArray;
59
+ function getAccessorArrayTypeAndLength(accessor, bufferView) {
60
+ const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];
61
+ const components = ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];
62
+ const bytesPerComponent = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];
63
+ const length = accessor.count * components;
64
+ const byteLength = accessor.count * components * bytesPerComponent;
65
+ (0, assert_1.assert)(byteLength >= 0 && byteLength <= bufferView.byteLength);
66
+ return { ArrayType, length, byteLength };
55
67
  }
56
- //# sourceMappingURL=gltf-utils.js.map
68
+ exports.getAccessorArrayTypeAndLength = getAccessorArrayTypeAndLength;
69
+ /**
70
+ * Calculate the GPU memory used by a GLTF tile, for both buffer and texture memory
71
+ * @param gltf - the gltf content of a GLTF tile
72
+ * @returns - total memory usage in bytes
73
+ */
74
+ function getMemoryUsageGLTF(gltf) {
75
+ let { images, bufferViews } = gltf;
76
+ images = images || [];
77
+ bufferViews = bufferViews || [];
78
+ const imageBufferViews = images.map((i) => i.bufferView);
79
+ bufferViews = bufferViews.filter((view) => !imageBufferViews.includes(view));
80
+ const bufferMemory = bufferViews.reduce((acc, view) => acc + view.byteLength, 0);
81
+ // Assume each pixel of the texture is 4 channel with mimmaps (which add 33%)
82
+ // TODO correctly handle compressed textures
83
+ const pixelCount = images.reduce((acc, image) => {
84
+ // @ts-ignore
85
+ const { width, height } = image.image;
86
+ return acc + width * height;
87
+ }, 0);
88
+ return bufferMemory + Math.ceil(4 * pixelCount * MIPMAP_FACTOR);
89
+ }
90
+ exports.getMemoryUsageGLTF = getMemoryUsageGLTF;
@@ -0,0 +1,2 @@
1
+ export declare function resolveUrl(url: any, options: any): any;
2
+ //# sourceMappingURL=resolve-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-url.d.ts","sourceRoot":"","sources":["../../../src/lib/gltf-utils/resolve-url.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,GAAG,KAAA,EAAE,OAAO,KAAA,OAWtC"}
@@ -1,16 +1,18 @@
1
- export function resolveUrl(url, options) {
2
- const absolute = url.startsWith('data:') || url.startsWith('http:') || url.startsWith('https:');
3
-
4
- if (absolute) {
5
- return url;
6
- }
7
-
8
- const baseUrl = options.baseUri || options.uri;
9
-
10
- if (!baseUrl) {
11
- throw new Error("'baseUri' must be provided to resolve relative url ".concat(url));
12
- }
13
-
14
- return baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1) + url;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveUrl = void 0;
4
+ // Resolves a relative url against a baseUrl
5
+ // If url is absolute, return it unchanged
6
+ function resolveUrl(url, options) {
7
+ // TODO: Use better logic to handle all protocols plus not delay on data
8
+ const absolute = url.startsWith('data:') || url.startsWith('http:') || url.startsWith('https:');
9
+ if (absolute) {
10
+ return url;
11
+ }
12
+ const baseUrl = options.baseUri || options.uri;
13
+ if (!baseUrl) {
14
+ throw new Error(`'baseUri' must be provided to resolve relative url ${url}`);
15
+ }
16
+ return baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1) + url;
15
17
  }
16
- //# sourceMappingURL=resolve-url.js.map
18
+ exports.resolveUrl = resolveUrl;
@@ -0,0 +1,20 @@
1
+ import type { GLB } from '../types/glb-types';
2
+ /** Options for parsing a GLB */
3
+ export type ParseGLBOptions = {
4
+ /** @deprecated This option was used by XVIZ protocol to define a non-standard magic number */
5
+ magic?: number;
6
+ /** @deprecated This option was used by XVIZ protocol to embed non-standard chunks */
7
+ strict?: boolean;
8
+ };
9
+ /** Check if the contents of an array buffer contains GLB byte markers */
10
+ export declare function isGLB(arrayBuffer: ArrayBuffer, byteOffset?: number, options?: ParseGLBOptions): boolean;
11
+ /**
12
+ * Synchronously parse a GLB
13
+ * @param glb - Target, Output is stored there
14
+ * @param arrayBuffer - Input data
15
+ * @param byteOffset - Offset into arrayBuffer to start parsing from (for "embedded" GLBs, e.g. in 3D tiles)
16
+ * @param options
17
+ * @returns
18
+ */
19
+ export declare function parseGLBSync(glb: GLB, arrayBuffer: ArrayBuffer, byteOffset?: number, options?: ParseGLBOptions): number;
20
+ //# sourceMappingURL=parse-glb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-glb.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-glb.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,oBAAoB,CAAC;AAG5C,gCAAgC;AAChC,MAAM,MAAM,eAAe,GAAG;IAC5B,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qFAAqF;IACrF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA0BF,yEAAyE;AACzE,wBAAgB,KAAK,CACnB,WAAW,EAAE,WAAW,EACxB,UAAU,GAAE,MAAU,EACtB,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAMT;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,WAAW,EACxB,UAAU,GAAE,MAAU,EACtB,OAAO,GAAE,eAAoB,UAmC9B"}