@loaders.gl/gltf 4.0.0-beta.2 → 4.0.0-beta.4

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 (247) hide show
  1. package/dist/{dist.min.js → dist.dev.js} +3016 -3442
  2. package/dist/{esm/glb-loader.js → glb-loader.js} +2 -2
  3. package/dist/glb-loader.js.map +1 -0
  4. package/dist/{esm/glb-writer.js → glb-writer.js} +2 -2
  5. package/dist/glb-writer.js.map +1 -0
  6. package/dist/{esm/gltf-loader.js → gltf-loader.js} +2 -2
  7. package/dist/gltf-loader.js.map +1 -0
  8. package/dist/{esm/gltf-writer.js → gltf-writer.js} +2 -2
  9. package/dist/gltf-writer.js.map +1 -0
  10. package/dist/index.cjs +3558 -0
  11. package/dist/index.js +13 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/{esm/lib → lib}/api/gltf-extensions.js +11 -11
  14. package/dist/lib/api/gltf-extensions.js.map +1 -0
  15. package/dist/lib/api/gltf-scenegraph.d.ts.map +1 -1
  16. package/dist/{esm/lib → lib}/api/gltf-scenegraph.js +9 -17
  17. package/dist/lib/api/gltf-scenegraph.js.map +1 -0
  18. package/dist/{esm/lib → lib}/api/normalize-gltf-v1.js +7 -8
  19. package/dist/lib/api/normalize-gltf-v1.js.map +1 -0
  20. package/dist/{esm/lib → lib}/api/post-process-gltf.js +19 -20
  21. package/dist/lib/api/post-process-gltf.js.map +1 -0
  22. package/dist/lib/encoders/encode-glb.js.map +1 -0
  23. package/dist/{esm/lib → lib}/encoders/encode-gltf.js +1 -1
  24. package/dist/lib/encoders/encode-gltf.js.map +1 -0
  25. package/dist/lib/extensions/EXT_mesh_features.d.ts.map +1 -1
  26. package/dist/{esm/lib → lib}/extensions/EXT_mesh_features.js +7 -5
  27. package/dist/lib/extensions/EXT_mesh_features.js.map +1 -0
  28. package/dist/{esm/lib → lib}/extensions/EXT_meshopt_compression.js +2 -2
  29. package/dist/lib/extensions/EXT_meshopt_compression.js.map +1 -0
  30. package/dist/{esm/lib → lib}/extensions/EXT_structural_metadata.js +7 -7
  31. package/dist/lib/extensions/EXT_structural_metadata.js.map +1 -0
  32. package/dist/{esm/lib → lib}/extensions/EXT_texture_webp.js +2 -2
  33. package/dist/lib/extensions/EXT_texture_webp.js.map +1 -0
  34. package/dist/{esm/lib → lib}/extensions/KHR_binary_gltf.js +1 -1
  35. package/dist/lib/extensions/KHR_binary_gltf.js.map +1 -0
  36. package/dist/{esm/lib → lib}/extensions/KHR_draco_mesh_compression.js +2 -2
  37. package/dist/lib/extensions/KHR_draco_mesh_compression.js.map +1 -0
  38. package/dist/{esm/lib → lib}/extensions/KHR_texture_basisu.js +1 -1
  39. package/dist/lib/extensions/KHR_texture_basisu.js.map +1 -0
  40. package/dist/{esm/lib → lib}/extensions/KHR_texture_transform.js +6 -6
  41. package/dist/lib/extensions/KHR_texture_transform.js.map +1 -0
  42. package/dist/{esm/lib → lib}/extensions/deprecated/EXT_feature_metadata.js +3 -3
  43. package/dist/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -0
  44. package/dist/{esm/lib → lib}/extensions/deprecated/KHR_lights_punctual.js +2 -2
  45. package/dist/lib/extensions/deprecated/KHR_lights_punctual.js.map +1 -0
  46. package/dist/{esm/lib → lib}/extensions/deprecated/KHR_materials_unlit.js +1 -1
  47. package/dist/lib/extensions/deprecated/KHR_materials_unlit.js.map +1 -0
  48. package/dist/{esm/lib → lib}/extensions/deprecated/KHR_techniques_webgl.js +1 -1
  49. package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js.map +1 -0
  50. package/dist/lib/extensions/utils/3d-tiles-utils.d.ts +1 -1
  51. package/dist/lib/extensions/utils/3d-tiles-utils.d.ts.map +1 -1
  52. package/dist/{esm/lib → lib}/extensions/utils/3d-tiles-utils.js +6 -9
  53. package/dist/lib/extensions/utils/3d-tiles-utils.js.map +1 -0
  54. package/dist/lib/gltf-utils/get-typed-array.d.ts +10 -0
  55. package/dist/lib/gltf-utils/get-typed-array.d.ts.map +1 -1
  56. package/dist/lib/gltf-utils/get-typed-array.js +51 -0
  57. package/dist/lib/gltf-utils/get-typed-array.js.map +1 -0
  58. package/dist/{esm/lib → lib}/gltf-utils/gltf-attribute-utils.js +1 -1
  59. package/dist/lib/gltf-utils/gltf-attribute-utils.js.map +1 -0
  60. package/dist/lib/gltf-utils/gltf-constants.js.map +1 -0
  61. package/dist/lib/gltf-utils/gltf-utils.d.ts +2 -2
  62. package/dist/lib/gltf-utils/gltf-utils.d.ts.map +1 -1
  63. package/dist/{esm/lib → lib}/gltf-utils/gltf-utils.js +7 -32
  64. package/dist/lib/gltf-utils/gltf-utils.js.map +1 -0
  65. package/dist/{esm/lib → lib}/gltf-utils/resolve-url.js +1 -1
  66. package/dist/lib/gltf-utils/resolve-url.js.map +1 -0
  67. package/dist/{esm/lib → lib}/parsers/parse-glb.js +6 -2
  68. package/dist/lib/parsers/parse-glb.js.map +1 -0
  69. package/dist/{esm/lib → lib}/parsers/parse-gltf.js +7 -7
  70. package/dist/lib/parsers/parse-gltf.js.map +1 -0
  71. package/dist/lib/types/glb-types.js.map +1 -0
  72. package/dist/lib/types/gltf-ext-feature-metadata-schema.js.map +1 -0
  73. package/dist/lib/types/gltf-ext-mesh-features-schema.d.ts +3 -1
  74. package/dist/lib/types/gltf-ext-mesh-features-schema.d.ts.map +1 -1
  75. package/dist/lib/types/gltf-ext-mesh-features-schema.js.map +1 -0
  76. package/dist/lib/types/gltf-ext-structural-metadata-schema.js.map +1 -0
  77. package/dist/lib/types/gltf-json-schema.d.ts +7 -0
  78. package/dist/lib/types/gltf-json-schema.d.ts.map +1 -1
  79. package/dist/lib/types/gltf-json-schema.js.map +1 -0
  80. package/dist/lib/types/gltf-postprocessed-schema.js.map +1 -0
  81. package/dist/lib/types/gltf-types.d.ts +1 -1
  82. package/dist/lib/types/gltf-types.d.ts.map +1 -1
  83. package/dist/lib/types/gltf-types.js.map +1 -0
  84. package/dist/lib/utils/assert.js.map +1 -0
  85. package/dist/lib/utils/version.js +2 -0
  86. package/dist/lib/utils/version.js.map +1 -0
  87. package/dist/{esm/meshopt → meshopt}/meshopt-decoder.js +1 -1
  88. package/dist/meshopt/meshopt-decoder.js.map +1 -0
  89. package/dist/{esm/webp → webp}/webp.js +1 -1
  90. package/dist/webp/webp.js.map +1 -0
  91. package/package.json +19 -11
  92. package/src/lib/api/gltf-scenegraph.ts +5 -17
  93. package/src/lib/extensions/EXT_mesh_features.ts +4 -2
  94. package/src/lib/extensions/utils/3d-tiles-utils.ts +17 -17
  95. package/src/lib/gltf-utils/get-typed-array.ts +53 -14
  96. package/src/lib/gltf-utils/gltf-utils.ts +3 -39
  97. package/src/lib/types/gltf-ext-mesh-features-schema.ts +3 -1
  98. package/src/lib/types/gltf-json-schema.ts +7 -0
  99. package/src/lib/types/gltf-types.ts +1 -1
  100. package/dist/bundle.d.ts +0 -2
  101. package/dist/bundle.d.ts.map +0 -1
  102. package/dist/es5/bundle.js +0 -6
  103. package/dist/es5/bundle.js.map +0 -1
  104. package/dist/es5/glb-loader.js +0 -54
  105. package/dist/es5/glb-loader.js.map +0 -1
  106. package/dist/es5/glb-writer.js +0 -34
  107. package/dist/es5/glb-writer.js.map +0 -1
  108. package/dist/es5/gltf-loader.js +0 -81
  109. package/dist/es5/gltf-loader.js.map +0 -1
  110. package/dist/es5/gltf-writer.js +0 -35
  111. package/dist/es5/gltf-writer.js.map +0 -1
  112. package/dist/es5/index.js +0 -88
  113. package/dist/es5/index.js.map +0 -1
  114. package/dist/es5/lib/api/gltf-extensions.js +0 -111
  115. package/dist/es5/lib/api/gltf-extensions.js.map +0 -1
  116. package/dist/es5/lib/api/gltf-scenegraph.js +0 -598
  117. package/dist/es5/lib/api/gltf-scenegraph.js.map +0 -1
  118. package/dist/es5/lib/api/normalize-gltf-v1.js +0 -331
  119. package/dist/es5/lib/api/normalize-gltf-v1.js.map +0 -1
  120. package/dist/es5/lib/api/post-process-gltf.js +0 -470
  121. package/dist/es5/lib/api/post-process-gltf.js.map +0 -1
  122. package/dist/es5/lib/encoders/encode-glb.js +0 -61
  123. package/dist/es5/lib/encoders/encode-glb.js.map +0 -1
  124. package/dist/es5/lib/encoders/encode-gltf.js +0 -20
  125. package/dist/es5/lib/encoders/encode-gltf.js.map +0 -1
  126. package/dist/es5/lib/extensions/EXT_mesh_features.js +0 -99
  127. package/dist/es5/lib/extensions/EXT_mesh_features.js.map +0 -1
  128. package/dist/es5/lib/extensions/EXT_meshopt_compression.js +0 -94
  129. package/dist/es5/lib/extensions/EXT_meshopt_compression.js.map +0 -1
  130. package/dist/es5/lib/extensions/EXT_structural_metadata.js +0 -375
  131. package/dist/es5/lib/extensions/EXT_structural_metadata.js.map +0 -1
  132. package/dist/es5/lib/extensions/EXT_texture_webp.js +0 -43
  133. package/dist/es5/lib/extensions/EXT_texture_webp.js.map +0 -1
  134. package/dist/es5/lib/extensions/KHR_binary_gltf.js +0 -39
  135. package/dist/es5/lib/extensions/KHR_binary_gltf.js.map +0 -1
  136. package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js +0 -246
  137. package/dist/es5/lib/extensions/KHR_draco_mesh_compression.js.map +0 -1
  138. package/dist/es5/lib/extensions/KHR_texture_basisu.js +0 -36
  139. package/dist/es5/lib/extensions/KHR_texture_basisu.js.map +0 -1
  140. package/dist/es5/lib/extensions/KHR_texture_transform.js +0 -231
  141. package/dist/es5/lib/extensions/KHR_texture_transform.js.map +0 -1
  142. package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +0 -260
  143. package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +0 -1
  144. package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js +0 -99
  145. package/dist/es5/lib/extensions/deprecated/KHR_lights_punctual.js.map +0 -1
  146. package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js +0 -76
  147. package/dist/es5/lib/extensions/deprecated/KHR_materials_unlit.js.map +0 -1
  148. package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js +0 -113
  149. package/dist/es5/lib/extensions/deprecated/KHR_techniques_webgl.js.map +0 -1
  150. package/dist/es5/lib/extensions/utils/3d-tiles-utils.js +0 -254
  151. package/dist/es5/lib/extensions/utils/3d-tiles-utils.js.map +0 -1
  152. package/dist/es5/lib/gltf-utils/get-typed-array.js +0 -23
  153. package/dist/es5/lib/gltf-utils/get-typed-array.js.map +0 -1
  154. package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js +0 -68
  155. package/dist/es5/lib/gltf-utils/gltf-attribute-utils.js.map +0 -1
  156. package/dist/es5/lib/gltf-utils/gltf-constants.js +0 -48
  157. package/dist/es5/lib/gltf-utils/gltf-constants.js.map +0 -1
  158. package/dist/es5/lib/gltf-utils/gltf-utils.js +0 -115
  159. package/dist/es5/lib/gltf-utils/gltf-utils.js.map +0 -1
  160. package/dist/es5/lib/gltf-utils/resolve-url.js +0 -18
  161. package/dist/es5/lib/gltf-utils/resolve-url.js.map +0 -1
  162. package/dist/es5/lib/parsers/parse-glb.js +0 -120
  163. package/dist/es5/lib/parsers/parse-glb.js.map +0 -1
  164. package/dist/es5/lib/parsers/parse-gltf.js +0 -283
  165. package/dist/es5/lib/parsers/parse-gltf.js.map +0 -1
  166. package/dist/es5/lib/types/glb-types.js +0 -2
  167. package/dist/es5/lib/types/glb-types.js.map +0 -1
  168. package/dist/es5/lib/types/gltf-ext-feature-metadata-schema.js +0 -2
  169. package/dist/es5/lib/types/gltf-ext-feature-metadata-schema.js.map +0 -1
  170. package/dist/es5/lib/types/gltf-ext-mesh-features-schema.js +0 -2
  171. package/dist/es5/lib/types/gltf-ext-mesh-features-schema.js.map +0 -1
  172. package/dist/es5/lib/types/gltf-ext-structural-metadata-schema.js +0 -2
  173. package/dist/es5/lib/types/gltf-ext-structural-metadata-schema.js.map +0 -1
  174. package/dist/es5/lib/types/gltf-json-schema.js +0 -2
  175. package/dist/es5/lib/types/gltf-json-schema.js.map +0 -1
  176. package/dist/es5/lib/types/gltf-postprocessed-schema.js +0 -2
  177. package/dist/es5/lib/types/gltf-postprocessed-schema.js.map +0 -1
  178. package/dist/es5/lib/types/gltf-types.js +0 -2
  179. package/dist/es5/lib/types/gltf-types.js.map +0 -1
  180. package/dist/es5/lib/utils/assert.js +0 -12
  181. package/dist/es5/lib/utils/assert.js.map +0 -1
  182. package/dist/es5/lib/utils/version.js +0 -9
  183. package/dist/es5/lib/utils/version.js.map +0 -1
  184. package/dist/es5/meshopt/meshopt-decoder.js +0 -215
  185. package/dist/es5/meshopt/meshopt-decoder.js.map +0 -1
  186. package/dist/es5/webp/webp.js +0 -83
  187. package/dist/es5/webp/webp.js.map +0 -1
  188. package/dist/esm/bundle.js +0 -4
  189. package/dist/esm/bundle.js.map +0 -1
  190. package/dist/esm/glb-loader.js.map +0 -1
  191. package/dist/esm/glb-writer.js.map +0 -1
  192. package/dist/esm/gltf-loader.js.map +0 -1
  193. package/dist/esm/gltf-writer.js.map +0 -1
  194. package/dist/esm/index.js +0 -13
  195. package/dist/esm/index.js.map +0 -1
  196. package/dist/esm/lib/api/gltf-extensions.js.map +0 -1
  197. package/dist/esm/lib/api/gltf-scenegraph.js.map +0 -1
  198. package/dist/esm/lib/api/normalize-gltf-v1.js.map +0 -1
  199. package/dist/esm/lib/api/post-process-gltf.js.map +0 -1
  200. package/dist/esm/lib/encoders/encode-glb.js.map +0 -1
  201. package/dist/esm/lib/encoders/encode-gltf.js.map +0 -1
  202. package/dist/esm/lib/extensions/EXT_mesh_features.js.map +0 -1
  203. package/dist/esm/lib/extensions/EXT_meshopt_compression.js.map +0 -1
  204. package/dist/esm/lib/extensions/EXT_structural_metadata.js.map +0 -1
  205. package/dist/esm/lib/extensions/EXT_texture_webp.js.map +0 -1
  206. package/dist/esm/lib/extensions/KHR_binary_gltf.js.map +0 -1
  207. package/dist/esm/lib/extensions/KHR_draco_mesh_compression.js.map +0 -1
  208. package/dist/esm/lib/extensions/KHR_texture_basisu.js.map +0 -1
  209. package/dist/esm/lib/extensions/KHR_texture_transform.js.map +0 -1
  210. package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +0 -1
  211. package/dist/esm/lib/extensions/deprecated/KHR_lights_punctual.js.map +0 -1
  212. package/dist/esm/lib/extensions/deprecated/KHR_materials_unlit.js.map +0 -1
  213. package/dist/esm/lib/extensions/deprecated/KHR_techniques_webgl.js.map +0 -1
  214. package/dist/esm/lib/extensions/utils/3d-tiles-utils.js.map +0 -1
  215. package/dist/esm/lib/gltf-utils/get-typed-array.js +0 -16
  216. package/dist/esm/lib/gltf-utils/get-typed-array.js.map +0 -1
  217. package/dist/esm/lib/gltf-utils/gltf-attribute-utils.js.map +0 -1
  218. package/dist/esm/lib/gltf-utils/gltf-constants.js.map +0 -1
  219. package/dist/esm/lib/gltf-utils/gltf-utils.js.map +0 -1
  220. package/dist/esm/lib/gltf-utils/resolve-url.js.map +0 -1
  221. package/dist/esm/lib/parsers/parse-glb.js.map +0 -1
  222. package/dist/esm/lib/parsers/parse-gltf.js.map +0 -1
  223. package/dist/esm/lib/types/glb-types.js.map +0 -1
  224. package/dist/esm/lib/types/gltf-ext-feature-metadata-schema.js.map +0 -1
  225. package/dist/esm/lib/types/gltf-ext-mesh-features-schema.js.map +0 -1
  226. package/dist/esm/lib/types/gltf-ext-structural-metadata-schema.js.map +0 -1
  227. package/dist/esm/lib/types/gltf-json-schema.js.map +0 -1
  228. package/dist/esm/lib/types/gltf-postprocessed-schema.js.map +0 -1
  229. package/dist/esm/lib/types/gltf-types.js.map +0 -1
  230. package/dist/esm/lib/utils/assert.js.map +0 -1
  231. package/dist/esm/lib/utils/version.js +0 -2
  232. package/dist/esm/lib/utils/version.js.map +0 -1
  233. package/dist/esm/meshopt/meshopt-decoder.js.map +0 -1
  234. package/dist/esm/meshopt/meshopt-encoder.ts.disabled +0 -409
  235. package/dist/esm/webp/webp.js.map +0 -1
  236. package/src/bundle.ts +0 -4
  237. /package/dist/{esm/lib → lib}/encoders/encode-glb.js +0 -0
  238. /package/dist/{esm/lib → lib}/gltf-utils/gltf-constants.js +0 -0
  239. /package/dist/{esm/lib → lib}/types/glb-types.js +0 -0
  240. /package/dist/{esm/lib → lib}/types/gltf-ext-feature-metadata-schema.js +0 -0
  241. /package/dist/{esm/lib → lib}/types/gltf-ext-mesh-features-schema.js +0 -0
  242. /package/dist/{esm/lib → lib}/types/gltf-ext-structural-metadata-schema.js +0 -0
  243. /package/dist/{esm/lib → lib}/types/gltf-json-schema.js +0 -0
  244. /package/dist/{esm/lib → lib}/types/gltf-postprocessed-schema.js +0 -0
  245. /package/dist/{esm/lib → lib}/types/gltf-types.js +0 -0
  246. /package/dist/{esm/lib → lib}/utils/assert.js +0 -0
  247. /package/dist/{es5/meshopt → meshopt}/meshopt-encoder.ts.disabled +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"EXT_feature_metadata.js","names":["GLTFScenegraph","convertRawBufferToMetadataArray","getPrimitiveTextureData","primitivePropertyDataToAttributes","getArrayElementByteSize","getOffsetsForProperty","parseVariableLengthArrayNumeric","parseFixedLengthArrayNumeric","getPropertyDataString","EXT_FEATURE_METADATA_NAME","name","decode","gltfData","options","scenegraph","decodeExtFeatureMetadata","getPropertyTableFromExtFeatureMetadata","extension","metadataClass","featureTables","_Object$keys","firstFeatureTableName","Object","keys","featureTable","propertyTable","propertyName","properties","data","featureTextures","featureTexture","textureKey","texture","class","console","warn","_options$gltf","_options$gltf2","gltf","loadBuffers","getExtension","loadImages","decodePropertyTextures","decodePropertyTables","schema","schemaClasses","classes","schemaName","schemaClass","findFeatureTextureByClass","handleFeatureTextureProperties","propertyTables","findPropertyTableByClass","processPropertyTable","schemaClassName","propertyTableName","featureTexturesName","_schema$classes","Error","concat","numberOfElements","count","_propertyTable$proper","classProperty","propertyTableProperty","getPropertyDataFromBinarySource","attributeName","_featureTexture$prope","featureTextureProperty","getPropertyDataFromTexture","numberOfFeatures","featureTableProperty","bufferView","dataArray","getTypedArrayForBufferView","arrayOffsets","getArrayOffsetsForProperty","stringOffsets","getStringOffsetsForProperty","type","componentType","isNumericProperty","getPropertyDataNumeric","componentCount","arrayOffsetBufferView","offsetType","stringOffsetBufferView","schemaProperty","types","includes","valuesDataBytes","isArray","arrayCount","attributeType","elementSize","elementCount","byteLength","valuesData","length","json","meshes","featureTextureTable","mesh","primitive","primitives","processPrimitiveTextures","textureInfoTopLevel","channels","propertyData"],"sources":["../../../../../src/lib/extensions/deprecated/EXT_feature_metadata.ts"],"sourcesContent":["/* eslint-disable camelcase */\nimport type {GLTF, GLTFTextureInfoMetadata} from '../../types/gltf-json-schema';\nimport type {\n GLTF_EXT_feature_metadata_Class,\n GLTF_EXT_feature_metadata_ClassProperty,\n GLTF_EXT_feature_metadata_FeatureTable,\n GLTF_EXT_feature_metadata_FeatureTableProperty,\n GLTF_EXT_feature_metadata_FeatureTexture,\n GLTF_EXT_feature_metadata_GLTF,\n GLTF_EXT_feature_metadata_TextureAccessor,\n GLTF_EXT_feature_metadata_Schema\n} from '../../types/gltf-ext-feature-metadata-schema';\nimport type {BigTypedArray, TypedArray} from '@loaders.gl/schema';\nimport type {FeatureTableJson} from '../../types/gltf-types';\nimport {GLTFScenegraph} from '../../api/gltf-scenegraph';\nimport {GLTFMeshPrimitive} from '../../types/gltf-json-schema';\nimport {GLTFLoaderOptions} from '../../../gltf-loader';\nimport {\n convertRawBufferToMetadataArray,\n getPrimitiveTextureData,\n primitivePropertyDataToAttributes,\n getArrayElementByteSize,\n NumericComponentType,\n getOffsetsForProperty,\n parseVariableLengthArrayNumeric,\n parseFixedLengthArrayNumeric,\n getPropertyDataString\n} from '../utils/3d-tiles-utils';\n\n/** Extension name */\nconst EXT_FEATURE_METADATA_NAME = 'EXT_feature_metadata';\nexport const name = EXT_FEATURE_METADATA_NAME;\n\nexport async function decode(gltfData: {json: GLTF}, options: GLTFLoaderOptions): Promise<void> {\n const scenegraph = new GLTFScenegraph(gltfData);\n decodeExtFeatureMetadata(scenegraph, options);\n}\n\n/**\n * Handles EXT_feature_metadata to get property table.\n * @param extension - Global level of EXT_FEATURE_METADATA extension.\n * @param metadataClass - User selected feature metadata class name.\n * @returns {FeatureTableJson | null} Property table or null if the extension can't be handled properly.\n */\nexport function getPropertyTableFromExtFeatureMetadata(\n extension: GLTF_EXT_feature_metadata_GLTF,\n metadataClass?: string\n): FeatureTableJson | null {\n if (extension.featureTables) {\n /**\n * Take only first feature table to generate attributes storage info object.\n * TODO: Think about getting data from all feature tables?\n * It can be tricky just because 3dTiles is able to have multiple featureId attributes and multiple feature tables.\n * In I3S we should decide which featureIds attribute will be passed to geometry data.\n */\n const firstFeatureTableName = Object.keys(extension.featureTables)?.[0];\n\n if (firstFeatureTableName) {\n const featureTable = extension.featureTables[firstFeatureTableName];\n const propertyTable = {};\n\n for (const propertyName in featureTable.properties) {\n propertyTable[propertyName] = featureTable.properties[propertyName].data;\n }\n\n return propertyTable;\n }\n }\n\n if (extension.featureTextures) {\n let featureTexture: string | undefined;\n for (const textureKey in extension.featureTextures) {\n const texture = extension.featureTextures[textureKey];\n if (texture.class === metadataClass) {\n featureTexture = textureKey;\n }\n }\n\n if (typeof featureTexture === 'string') {\n const featureTable = extension.featureTextures[featureTexture];\n const propertyTable = {};\n\n for (const propertyName in featureTable.properties) {\n propertyTable[propertyName] = featureTable.properties[propertyName].data;\n }\n\n return propertyTable;\n }\n }\n\n // eslint-disable-next-line no-console\n console.warn(\n 'Cannot get property table from EXT_feature_metadata extension. There is neither featureTables, nor featureTextures in the extension.'\n );\n return null;\n}\n\n/**\n * Decodes feature metadata from extension.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param options - GLTFLoader options.\n */\nfunction decodeExtFeatureMetadata(scenegraph: GLTFScenegraph, options: GLTFLoaderOptions): void {\n // Decoding metadata involves buffers processing.\n // So, if buffers have not been loaded, there is no reason to process metadata.\n if (!options.gltf?.loadBuffers) {\n return;\n }\n const extension: GLTF_EXT_feature_metadata_GLTF | null =\n scenegraph.getExtension(EXT_FEATURE_METADATA_NAME);\n if (!extension) {\n return;\n }\n\n if (options.gltf?.loadImages) {\n decodePropertyTextures(scenegraph, extension);\n }\n\n decodePropertyTables(scenegraph, extension);\n}\n\n/**\n * Processes the data stored in the textures\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTextures(\n scenegraph: GLTFScenegraph,\n extension: GLTF_EXT_feature_metadata_GLTF\n): void {\n const schema = extension.schema;\n if (!schema) {\n return;\n }\n const schemaClasses = schema.classes;\n\n const {featureTextures} = extension;\n if (schemaClasses && featureTextures) {\n for (const schemaName in schemaClasses) {\n const schemaClass = schemaClasses[schemaName];\n const featureTexture = findFeatureTextureByClass(featureTextures, schemaName);\n\n if (featureTexture) {\n handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass);\n }\n }\n }\n}\n\n/**\n * Processes the data stored in the property tables.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param extension - Top-level extension.\n */\nfunction decodePropertyTables(\n scenegraph: GLTFScenegraph,\n extension: GLTF_EXT_feature_metadata_GLTF\n): void {\n const schema = extension.schema;\n if (!schema) {\n return;\n }\n const schemaClasses = schema.classes;\n const propertyTables = extension.featureTables;\n if (schemaClasses && propertyTables) {\n for (const schemaName in schemaClasses) {\n const propertyTable = findPropertyTableByClass(propertyTables, schemaName);\n if (propertyTable) {\n processPropertyTable(scenegraph, schema, propertyTable);\n }\n }\n }\n}\n\n/**\n * Finds the property table by class name.\n * @param propertyTables - propertyTable definition taken from the top-level extension.\n * @param schemaClassName - class name in the extension schema.\n */\nfunction findPropertyTableByClass(\n propertyTables: {[key: string]: GLTF_EXT_feature_metadata_FeatureTable},\n schemaClassName: string\n): GLTF_EXT_feature_metadata_FeatureTable | null {\n for (const propertyTableName in propertyTables) {\n const propertyTable = propertyTables[propertyTableName];\n if (propertyTable.class === schemaClassName) {\n return propertyTable;\n }\n }\n\n return null;\n}\n\nfunction findFeatureTextureByClass(\n featureTextures: {[key: string]: GLTF_EXT_feature_metadata_FeatureTexture},\n schemaClassName: string\n): GLTF_EXT_feature_metadata_FeatureTexture | null {\n for (const featureTexturesName in featureTextures) {\n const featureTable = featureTextures[featureTexturesName];\n\n if (featureTable.class === schemaClassName) {\n return featureTable;\n }\n }\n\n return null;\n}\n\n/**\n * Navigates through all properies in the property table, gets properties data,\n * and put the data to `propertyTable.data` as an array.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schema - schema object.\n * @param propertyTable - propertyTable definition taken from the top-level extension.\n */\nfunction processPropertyTable(\n scenegraph: GLTFScenegraph,\n schema: GLTF_EXT_feature_metadata_Schema,\n propertyTable: GLTF_EXT_feature_metadata_FeatureTable\n): void {\n // Though 'class' is not required by spec, it doesn't make any scence when it's not provided.\n // So, bale out here.\n if (!propertyTable.class) {\n return;\n }\n\n const schemaClass = schema.classes?.[propertyTable.class];\n if (!schemaClass) {\n throw new Error(\n `Incorrect data in the EXT_structural_metadata extension: no schema class with name ${propertyTable.class}`\n );\n }\n\n const numberOfElements = propertyTable.count; // `propertyTable.count` is a number of elements in each property array.\n\n for (const propertyName in schemaClass.properties) {\n const classProperty = schemaClass.properties[propertyName];\n const propertyTableProperty: GLTF_EXT_feature_metadata_FeatureTableProperty | undefined =\n propertyTable.properties?.[propertyName];\n\n if (propertyTableProperty) {\n // Getting all elements (`numberOfElements`) of the array in the `propertyTableProperty`\n const data = getPropertyDataFromBinarySource(\n scenegraph,\n schema,\n classProperty,\n numberOfElements,\n propertyTableProperty\n );\n propertyTableProperty.data = data;\n }\n }\n}\n\n/**\n * Navigates through all properies in feature texture and gets properties data.\n * Data will be stored in featureTexture.properties[propertyName].data.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param featureTexture\n * @param schemaClass\n */\nfunction handleFeatureTextureProperties(\n scenegraph: GLTFScenegraph,\n featureTexture: GLTF_EXT_feature_metadata_FeatureTexture,\n schemaClass: GLTF_EXT_feature_metadata_Class\n): void {\n const attributeName = featureTexture.class;\n\n for (const propertyName in schemaClass.properties) {\n const featureTextureProperty = featureTexture?.properties?.[propertyName];\n\n if (featureTextureProperty) {\n const data = getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName);\n featureTextureProperty.data = data;\n }\n }\n}\n\n/**\n * Decodes properties from binary sourse based on property type.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param schemaProperty\n * @param numberOfFeatures\n * @param featureTableProperty\n */\nfunction getPropertyDataFromBinarySource(\n scenegraph: GLTFScenegraph,\n schema: GLTF_EXT_feature_metadata_Schema,\n classProperty: GLTF_EXT_feature_metadata_ClassProperty,\n numberOfFeatures: number,\n featureTableProperty: GLTF_EXT_feature_metadata_FeatureTableProperty\n): string[] | BigTypedArray | string[][] | BigTypedArray[] {\n let data: string[] | BigTypedArray | string[][] | BigTypedArray[] = [];\n const bufferView = featureTableProperty.bufferView;\n const dataArray: Uint8Array = scenegraph.getTypedArrayForBufferView(bufferView);\n\n const arrayOffsets = getArrayOffsetsForProperty(\n scenegraph,\n classProperty,\n featureTableProperty,\n numberOfFeatures\n );\n const stringOffsets = getStringOffsetsForProperty(\n scenegraph,\n classProperty,\n featureTableProperty,\n numberOfFeatures\n );\n\n if (classProperty.type === 'STRING' || classProperty.componentType === 'STRING') {\n data = getPropertyDataString(numberOfFeatures, dataArray, arrayOffsets, stringOffsets);\n } else if (isNumericProperty(classProperty)) {\n data = getPropertyDataNumeric(classProperty, numberOfFeatures, dataArray, arrayOffsets);\n }\n\n return data;\n}\n\n/**\n * Parses propertyTable.property.arrayOffsets that are offsets of sub-arrays in a flatten array of values.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param classProperty - class property object.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array with offset values.\n * @see https://github.com/CesiumGS/glTF/blob/2976f1183343a47a29e4059a70961371cd2fcee8/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json#L21\n */\nfunction getArrayOffsetsForProperty(\n scenegraph: GLTFScenegraph,\n classProperty: GLTF_EXT_feature_metadata_ClassProperty,\n propertyTableProperty: GLTF_EXT_feature_metadata_FeatureTableProperty,\n numberOfElements: number\n): TypedArray | null {\n /*\n If ARRAY is used, then componentType must also be specified.\n ARRAY is a fixed-length array when componentCount is defined, and variable-length otherwise.\n*/\n if (\n classProperty.type === 'ARRAY' &&\n // `componentCount` is a number of fixed-length array elements.\n // If `componentCount` is NOT defined, it's a VARIABLE-length array\n typeof classProperty.componentCount === 'undefined' &&\n // `arrayOffsetBufferView` is an index of the buffer view containing offsets for variable-length arrays.\n typeof propertyTableProperty.arrayOffsetBufferView !== 'undefined'\n ) {\n // Data are in a VARIABLE-length array\n return getOffsetsForProperty(\n scenegraph,\n propertyTableProperty.arrayOffsetBufferView,\n propertyTableProperty.offsetType || 'UINT32', // offsetType is used both for stringOffsetBufferView and arrayOffsetBufferView\n numberOfElements\n );\n }\n return null;\n}\n\n/**\n * Parses featureTable.property.stringOffsetBufferView.\n * String offsets is an array of offsets of strings in the united array of characters.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param propertyTableProperty - propertyTable's property metadata.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @returns Typed array of offset values. The number of offsets in the array is equal to `numberOfElements` plus one.\n * @see https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTable.property.schema.json#L50C10-L50C32\n */\nfunction getStringOffsetsForProperty(\n scenegraph: GLTFScenegraph,\n classProperty: GLTF_EXT_feature_metadata_ClassProperty,\n propertyTableProperty: GLTF_EXT_feature_metadata_FeatureTableProperty,\n numberOfElements: number\n): TypedArray | null {\n if (\n typeof propertyTableProperty.stringOffsetBufferView !== 'undefined' // `stringOffsetBufferView` is an index of the buffer view containing offsets for strings.\n ) {\n // Data are in a FIXED-length array\n return getOffsetsForProperty(\n scenegraph,\n propertyTableProperty.stringOffsetBufferView,\n propertyTableProperty.offsetType || 'UINT32', // offsetType is used both for stringOffsetBufferView and arrayOffsetBufferView\n numberOfElements\n );\n }\n return null;\n}\n\n/**\n * Checks if the feature table property is of numeric type.\n * @param schemaPropertyType - feature table property\n * @returns true if property is numeric, else - false\n */\nfunction isNumericProperty(schemaProperty: GLTF_EXT_feature_metadata_ClassProperty): boolean {\n const types = [\n 'UINT8',\n 'INT16',\n 'UINT16',\n 'INT32',\n 'UINT32',\n 'INT64',\n 'UINT64',\n 'FLOAT32',\n 'FLOAT64'\n ];\n return (\n types.includes(schemaProperty.type) ||\n (typeof schemaProperty.componentType !== 'undefined' &&\n types.includes(schemaProperty.componentType))\n );\n}\n\n/**\n * Decodes properties of numeric types from binary sourse.\n * @param classProperty - class property object.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @returns Property values in a typed array or in an array of typed arrays.\n */\nfunction getPropertyDataNumeric(\n classProperty: GLTF_EXT_feature_metadata_ClassProperty,\n numberOfElements: number,\n valuesDataBytes: Uint8Array,\n arrayOffsets: TypedArray | null\n): BigTypedArray | BigTypedArray[] {\n const isArray = classProperty.type === 'ARRAY';\n const arrayCount = classProperty.componentCount;\n\n /*\n We are getting Numeric data. So,\n the component type can be one of NumericComponentType,\n the attribute type should be 'SCALAR'\n */\n const attributeType = 'SCALAR';\n const componentType = classProperty.componentType || classProperty.type;\n const elementSize = getArrayElementByteSize(attributeType, componentType);\n const elementCount = valuesDataBytes.byteLength / elementSize;\n\n const valuesData: BigTypedArray = convertRawBufferToMetadataArray(\n valuesDataBytes,\n attributeType,\n componentType as NumericComponentType,\n elementCount\n );\n\n if (isArray) {\n if (arrayOffsets) {\n // VARIABLE-length array\n return parseVariableLengthArrayNumeric(\n valuesData,\n numberOfElements,\n arrayOffsets,\n valuesDataBytes.length,\n elementSize\n );\n }\n if (arrayCount) {\n // FIXED-length array\n return parseFixedLengthArrayNumeric(valuesData, numberOfElements, arrayCount);\n }\n return [];\n }\n\n return valuesData;\n}\n\n/**\n * Gets properties from texture associated with all mesh primitives.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param featureTextureProperty\n * @param attributeName\n * @returns Feature texture data\n */\nfunction getPropertyDataFromTexture(\n scenegraph: GLTFScenegraph,\n featureTextureProperty: GLTF_EXT_feature_metadata_TextureAccessor,\n attributeName: string\n): number[] {\n const json = scenegraph.gltf.json;\n if (!json.meshes) {\n return [];\n }\n const featureTextureTable: number[] = [];\n for (const mesh of json.meshes) {\n for (const primitive of mesh.primitives) {\n processPrimitiveTextures(\n scenegraph,\n attributeName,\n featureTextureProperty,\n featureTextureTable,\n primitive\n );\n }\n }\n return featureTextureTable;\n}\n\n/**\n * Processes data encoded in the texture associated with the primitive. This data will be accessible through the attributes.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param attributeName\n * @param featureTextureProperty\n * @param featureTextureTable\n * @param primitive\n */\nfunction processPrimitiveTextures(\n scenegraph: GLTFScenegraph,\n attributeName: string,\n featureTextureProperty: GLTF_EXT_feature_metadata_TextureAccessor,\n featureTextureTable: number[],\n primitive: GLTFMeshPrimitive\n): void {\n const textureInfoTopLevel: GLTFTextureInfoMetadata = {\n channels: featureTextureProperty.channels,\n ...featureTextureProperty.texture\n };\n const propertyData: number[] | null = getPrimitiveTextureData(\n scenegraph,\n textureInfoTopLevel,\n primitive\n );\n if (!propertyData) {\n return;\n }\n primitivePropertyDataToAttributes(\n scenegraph,\n attributeName,\n propertyData,\n featureTextureTable,\n primitive\n );\n}\n"],"mappings":"AAcA,SAAQA,cAAc,QAAO,2BAA2B;AAGxD,SACEC,+BAA+B,EAC/BC,uBAAuB,EACvBC,iCAAiC,EACjCC,uBAAuB,EAEvBC,qBAAqB,EACrBC,+BAA+B,EAC/BC,4BAA4B,EAC5BC,qBAAqB,QAChB,yBAAyB;AAGhC,MAAM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AU,EACVoD,aAAa,EACb0C,YAAY,EACZP,mBAAmB,EACnBE,SACF,CAAC;AACH"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"KHR_lights_punctual.js","names":["assert","GLTFScenegraph","KHR_LIGHTS_PUNCTUAL","name","decode","gltfData","gltfScenegraph","json","extension","getExtension","lights","removeExtension","node","nodes","nodeExtension","getObjectExtension","light","removeObjectExtension","encode","addExtension","addObjectExtension"],"sources":["../../../../../src/lib/extensions/deprecated/KHR_lights_punctual.ts"],"sourcesContent":["// GLTF EXTENSION: KHR_lights_punctual\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual\n\nimport type {GLTF} from '../../types/gltf-json-schema';\n\nimport {assert} from '../../utils/assert';\nimport {GLTFScenegraph} from '../../api/gltf-scenegraph';\n\nconst KHR_LIGHTS_PUNCTUAL = 'KHR_lights_punctual';\n\nexport const name = KHR_LIGHTS_PUNCTUAL;\n\nexport async function decode(gltfData: {json: GLTF}): Promise<void> {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const {json} = gltfScenegraph;\n\n // Move the light array out of the extension and remove the extension\n const extension = gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);\n if (extension) {\n // @ts-ignore\n gltfScenegraph.json.lights = extension.lights;\n gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);\n }\n\n // Any nodes that have the extension, add lights field pointing to light object\n // and remove the extension\n for (const node of json.nodes || []) {\n const nodeExtension = gltfScenegraph.getObjectExtension(node, KHR_LIGHTS_PUNCTUAL);\n if (nodeExtension) {\n // @ts-ignore\n node.light = nodeExtension.light;\n }\n gltfScenegraph.removeObjectExtension(node, KHR_LIGHTS_PUNCTUAL);\n }\n}\n\n// Move the light ar ray out of the extension and remove the extension\nexport async function encode(gltfData): Promise<void> {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const {json} = gltfScenegraph;\n\n // @ts-ignore\n if (json.lights) {\n const extension = gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);\n // @ts-ignore\n assert(!extension.lights);\n // @ts-ignore\n extension.lights = json.lights;\n // @ts-ignore\n delete json.lights;\n }\n\n // Any nodes that have lights field pointing to light object\n // add the extension\n // @ts-ignore\n if (gltfScenegraph.json.lights) {\n // @ts-ignore\n for (const light of gltfScenegraph.json.lights) {\n const node = light.node;\n gltfScenegraph.addObjectExtension(node, KHR_LIGHTS_PUNCTUAL, light);\n }\n // @ts-ignore\n delete gltfScenegraph.json.lights;\n }\n}\n"],"mappings":"AAKA,SAAQA,MAAM,QAAO,oBAAoB;AACzC,SAAQC,cAAc,QAAO,2BAA2B;AAExD,MAAMC,mBAAmB,GAAG,qBAAqB;AAEjD,OAAO,MAAMC,IAAI,GAAGD,mBAAmB;AAEvC,OAAO,eAAeE,MAAMA,CAACC,QAAsB,EAAiB;EAClE,MAAMC,cAAc,GAAG,IAAIL,cAAc,CAACI,QAAQ,CAAC;EACnD,MAAM;IAACE;EAAI,CAAC,GAAGD,cAAc;EAG7B,MAAME,SAAS,GAAGF,cAAc,CAACG,YAAY,CAACP,mBAAmB,CAAC;EAClE,IAAIM,SAAS,EAAE;IAEbF,cAAc,CAACC,IAAI,CAACG,MAAM,GAAGF,SAAS,CAACE,MAAM;IAC7CJ,cAAc,CAACK,eAAe,CAACT,mBAAmB,CAAC;EACrD;EAIA,KAAK,MAAMU,IAAI,IAAIL,IAAI,CAACM,KAAK,IAAI,EAAE,EAAE;IACnC,MAAMC,aAAa,GAAGR,cAAc,CAACS,kBAAkB,CAACH,IAAI,EAAEV,mBAAmB,CAAC;IAClF,IAAIY,aAAa,EAAE;MAEjBF,IAAI,CAACI,KAAK,GAAGF,aAAa,CAACE,KAAK;IAClC;IACAV,cAAc,CAACW,qBAAqB,CAACL,IAAI,EAAEV,mBAAmB,CAAC;EACjE;AACF;AAGA,OAAO,eAAegB,MAAMA,CAACb,QAAQ,EAAiB;EACpD,MAAMC,cAAc,GAAG,IAAIL,cAAc,CAACI,QAAQ,CAAC;EACnD,MAAM;IAACE;EAAI,CAAC,GAAGD,cAAc;EAG7B,IAAIC,IAAI,CAACG,MAAM,EAAE;IACf,MAAMF,SAAS,GAAGF,cAAc,CAACa,YAAY,CAACjB,mBAAmB,CAAC;IAElEF,MAAM,CAAC,CAACQ,SAAS,CAACE,MAAM,CAAC;IAEzBF,SAAS,CAACE,MAAM,GAAGH,IAAI,CAACG,MAAM;IAE9B,OAAOH,IAAI,CAACG,MAAM;EACpB;EAKA,IAAIJ,cAAc,CAACC,IAAI,CAACG,MAAM,EAAE;IAE9B,KAAK,MAAMM,KAAK,IAAIV,cAAc,CAACC,IAAI,CAACG,MAAM,EAAE;MAC9C,MAAME,IAAI,GAAGI,KAAK,CAACJ,IAAI;MACvBN,cAAc,CAACc,kBAAkB,CAACR,IAAI,EAAEV,mBAAmB,EAAEc,KAAK,CAAC;IACrE;IAEA,OAAOV,cAAc,CAACC,IAAI,CAACG,MAAM;EACnC;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"KHR_materials_unlit.js","names":["GLTFScenegraph","KHR_MATERIALS_UNLIT","name","decode","gltfData","gltfScenegraph","json","material","materials","extension","extensions","KHR_materials_unlit","unlit","removeObjectExtension","removeExtension","encode","addObjectExtension","addExtension"],"sources":["../../../../../src/lib/extensions/deprecated/KHR_materials_unlit.ts"],"sourcesContent":["// GLTF EXTENSION: KHR_materials_unlit\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit\n\nimport type {GLTF} from '../../types/gltf-json-schema';\n\nimport {GLTFScenegraph} from '../../api/gltf-scenegraph';\n\nconst KHR_MATERIALS_UNLIT = 'KHR_materials_unlit';\n\nexport const name = KHR_MATERIALS_UNLIT;\n\nexport async function decode(gltfData: {json: GLTF}): Promise<void> {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const {json} = gltfScenegraph;\n\n // Any nodes that have the extension, add lights field pointing to light object\n // and remove the extension\n for (const material of json.materials || []) {\n const extension = material.extensions && material.extensions.KHR_materials_unlit;\n if (extension) {\n // @ts-ignore TODO\n material.unlit = true;\n }\n gltfScenegraph.removeObjectExtension(material, KHR_MATERIALS_UNLIT);\n }\n\n // Remove the top-level extension\n gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);\n}\n\nexport function encode(gltfData) {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const {json} = gltfScenegraph;\n\n // Any nodes that have lights field pointing to light object\n // add the extension\n // @ts-ignore\n if (gltfScenegraph.materials) {\n for (const material of json.materials || []) {\n // @ts-ignore\n if (material.unlit) {\n // @ts-ignore\n delete material.unlit;\n gltfScenegraph.addObjectExtension(material, KHR_MATERIALS_UNLIT, {});\n gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);\n }\n }\n }\n}\n"],"mappings":"AAKA,SAAQA,cAAc,QAAO,2BAA2B;AAExD,MAAMC,mBAAmB,GAAG,qBAAqB;AAEjD,OAAO,MAAMC,IAAI,GAAGD,mBAAmB;AAEvC,OAAO,eAAeE,MAAMA,CAACC,QAAsB,EAAiB;EAClE,MAAMC,cAAc,GAAG,IAAIL,cAAc,CAACI,QAAQ,CAAC;EACnD,MAAM;IAACE;EAAI,CAAC,GAAGD,cAAc;EAI7B,KAAK,MAAME,QAAQ,IAAID,IAAI,CAACE,SAAS,IAAI,EAAE,EAAE;IAC3C,MAAMC,SAAS,GAAGF,QAAQ,CAACG,UAAU,IAAIH,QAAQ,CAACG,UAAU,CAACC,mBAAmB;IAChF,IAAIF,SAAS,EAAE;MAEbF,QAAQ,CAACK,KAAK,GAAG,IAAI;IACvB;IACAP,cAAc,CAACQ,qBAAqB,CAACN,QAAQ,EAAEN,mBAAmB,CAAC;EACrE;EAGAI,cAAc,CAACS,eAAe,CAACb,mBAAmB,CAAC;AACrD;AAEA,OAAO,SAASc,MAAMA,CAACX,QAAQ,EAAE;EAC/B,MAAMC,cAAc,GAAG,IAAIL,cAAc,CAACI,QAAQ,CAAC;EACnD,MAAM;IAACE;EAAI,CAAC,GAAGD,cAAc;EAK7B,IAAIA,cAAc,CAACG,SAAS,EAAE;IAC5B,KAAK,MAAMD,QAAQ,IAAID,IAAI,CAACE,SAAS,IAAI,EAAE,EAAE;MAE3C,IAAID,QAAQ,CAACK,KAAK,EAAE;QAElB,OAAOL,QAAQ,CAACK,KAAK;QACrBP,cAAc,CAACW,kBAAkB,CAACT,QAAQ,EAAEN,mBAAmB,EAAE,CAAC,CAAC,CAAC;QACpEI,cAAc,CAACY,YAAY,CAAChB,mBAAmB,CAAC;MAClD;IACF;EACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"KHR_techniques_webgl.js","names":["GLTFScenegraph","KHR_TECHNIQUES_WEBGL","name","decode","gltfData","gltfScenegraph","json","extension","getExtension","techniques","resolveTechniques","material","materials","materialExtension","getObjectExtension","technique","Object","assign","values","resolveValues","removeObjectExtension","removeExtension","encode","options","techniquesExtension","programs","shaders","textDecoder","TextDecoder","forEach","shader","Number","isFinite","bufferView","code","getTypedArrayForBufferView","Error","program","fragmentShader","vertexShader","keys","uniforms","uniform","value","index","undefined","texture","getTexture"],"sources":["../../../../../src/lib/extensions/deprecated/KHR_techniques_webgl.ts"],"sourcesContent":["// GLTF EXTENSION: KHR_techniques_webgl\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_techniques_webgl\n\nimport type {GLTF} from '../../types/gltf-json-schema';\n\nimport {GLTFScenegraph} from '../../api/gltf-scenegraph';\n\nconst KHR_TECHNIQUES_WEBGL = 'KHR_techniques_webgl';\n\nexport const name = KHR_TECHNIQUES_WEBGL;\n\nexport async function decode(gltfData: {json: GLTF}): Promise<void> {\n const gltfScenegraph = new GLTFScenegraph(gltfData);\n const {json} = gltfScenegraph;\n\n const extension = gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);\n if (extension) {\n const techniques = resolveTechniques(extension, gltfScenegraph);\n\n for (const material of json.materials || []) {\n const materialExtension = gltfScenegraph.getObjectExtension(material, KHR_TECHNIQUES_WEBGL);\n if (materialExtension) {\n // @ts-ignore TODO\n material.technique = Object.assign(\n {},\n materialExtension,\n // @ts-ignore\n techniques[materialExtension.technique]\n );\n // @ts-ignore TODO\n material.technique.values = resolveValues(material.technique, gltfScenegraph);\n }\n gltfScenegraph.removeObjectExtension(material, KHR_TECHNIQUES_WEBGL);\n }\n\n // Remove the top-level extension\n gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);\n }\n}\n// eslint-disable-next-line\nexport async function encode(gltfData, options): Promise<void> {\n // TODO\n}\n\nfunction resolveTechniques(\n techniquesExtension: {[key: string]: any},\n // programs: {[key: string]: any}[],\n // shaders: {[key: string]: any}[],\n // techniques: {[key: string]: any}[]\n gltfScenegraph\n) {\n const {programs = [], shaders = [], techniques = []} = techniquesExtension;\n const textDecoder = new TextDecoder();\n\n shaders.forEach((shader) => {\n if (Number.isFinite(shader.bufferView)) {\n shader.code = textDecoder.decode(\n gltfScenegraph.getTypedArrayForBufferView(shader.bufferView)\n );\n } else {\n // TODO: handle URI shader\n throw new Error('KHR_techniques_webgl: no shader code');\n }\n });\n\n programs.forEach((program) => {\n program.fragmentShader = shaders[program.fragmentShader];\n program.vertexShader = shaders[program.vertexShader];\n });\n\n techniques.forEach((technique) => {\n technique.program = programs[technique.program];\n });\n\n return techniques;\n}\n\nfunction resolveValues(technique, gltfScenegraph) {\n const values = Object.assign({}, technique.values);\n\n // merge values from uniforms\n Object.keys(technique.uniforms || {}).forEach((uniform) => {\n if (technique.uniforms[uniform].value && !(uniform in values)) {\n values[uniform] = technique.uniforms[uniform].value;\n }\n });\n\n // resolve textures\n Object.keys(values).forEach((uniform) => {\n if (typeof values[uniform] === 'object' && values[uniform].index !== undefined) {\n // Assume this is a texture\n // TODO: find if there are any other types that can be referenced\n values[uniform].texture = gltfScenegraph.getTexture(values[uniform].index);\n }\n });\n\n return values;\n}\n"],"mappings":"AAKA,SAAQA,cAAc,QAAO,2BAA2B;AAExD,MAAMC,oBAAoB,GAAG,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,OAAOxB,MAAM,CAACwB,OAAO,CAAC,KAAK,QAAQ,IAAIxB,MAAM,CAACwB,OAAO,CAAC,CAACE,KAAK,KAAKC,SAAS,EAAE;MAG9E3B,MAAM,CAACwB,OAAO,CAAC,CAACI,OAAO,GAAGzC,cAAc,CAAC0C,UAAU,CAAC7B,MAAM,CAACwB,OAAO,CAAC,CAACE,KAAK,CAAC;IAC5E;EACF,CAAC,CAAC;EAEF,OAAO1B,MAAM;AACf"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"3d-tiles-utils.js","names":["getComponentTypeFromArray","getFloat32ArrayForAccessor","getImageData","emod","ATTRIBUTE_TYPE_TO_COMPONENTS","SCALAR","VEC2","VEC3","VEC4","MAT2","MAT3","MAT4","BOOLEAN","STRING","ENUM","ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY","INT8","Int8Array","UINT8","Uint8Array","INT16","Int16Array","UINT16","Uint16Array","INT32","Int32Array","UINT32","Uint32Array","INT64","BigInt64Array","UINT64","BigUint64Array","FLOAT32","Float32Array","FLOAT64","Float64Array","ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE","getArrayElementByteSize","attributeType","componentType","getOffsetsForProperty","scenegraph","bufferViewIndex","offsetType","numberOfElements","arrayOffsetsBytes","getTypedArrayForBufferView","arrayOffsets","convertRawBufferToMetadataArray","data","elementCount","arguments","length","undefined","numberOfComponents","ArrayType","size","byteLength","buffer","offset","byteOffset","bufferArray","slice","getPrimitiveTextureData","textureInfo","primitive","_json$textures","_json$textures$textur","json","gltf","texCoordAccessorKey","concat","texCoord","texCoordAccessorIndex","attributes","textureCoordinates","textureIndex","index","imageIndex","textures","source","_json$images","_json$images$imageInd","_scenegraph$gltf$imag","mimeType","images","parsedImage","width","textureData","value","getImageValueByCoordinates","channels","push","primitivePropertyDataToAttributes","attributeName","propertyData","featureTable","featureIndices","texelData","findIndex","item","typedArray","bufferIndex","buffers","arrayBuffer","addBufferView","accessorIndex","addAccessor","count","CHANNELS_MAP","r","shift","g","b","a","u","v","components","indexOf","coordinatesToOffset","c","map","Object","values","imageOffset","imageData","Error","imageValue","componentsCount","w","iX","indX","Math","round","h","height","iY","indY","parseVariableLengthArrayNumeric","valuesData","valuesDataBytesLength","valueSize","attributeValueArray","arrayOffset","arrayByteSize","typedArrayOffset","parseFixedLengthArrayNumeric","arrayCount","elementOffset","getPropertyDataString","valuesDataBytes","stringOffsets","stringsArray","textDecoder","TextDecoder","stringOffset","stringByteSize","stringData","subarray","stringAttribute","decode"],"sources":["../../../../../src/lib/extensions/utils/3d-tiles-utils.ts"],"sourcesContent":["/**\n * loaders.gl, MIT license\n *\n * Shared code for 3DTiles extensions:\n * * EXT_feature_metadata\n * * EXT_mesh_features\n * * EXT_structural_metadata\n */\n\nimport type {GLTFTextureInfoMetadata, GLTFMeshPrimitive} from '../../types/gltf-json-schema';\nimport type {BigTypedArray, TypedArray} from '@loaders.gl/schema';\nimport type {ImageType} from '@loaders.gl/images';\n\nimport {GLTFScenegraph} from '../../api/gltf-scenegraph';\nimport {getComponentTypeFromArray, getFloat32ArrayForAccessor} from '../../gltf-utils/gltf-utils';\nimport {getImageData} from '@loaders.gl/images';\nimport {emod} from '@loaders.gl/math';\n\nexport type NumericComponentType =\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64';\n\nconst ATTRIBUTE_TYPE_TO_COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16,\n BOOLEAN: 1,\n STRING: 1,\n ENUM: 1\n};\n\nconst ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {\n INT8: Int8Array,\n UINT8: Uint8Array,\n INT16: Int16Array,\n UINT16: Uint16Array,\n INT32: Int32Array,\n UINT32: Uint32Array,\n INT64: BigInt64Array,\n UINT64: BigUint64Array,\n FLOAT32: Float32Array,\n FLOAT64: Float64Array\n};\n\nconst ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {\n INT8: 1,\n UINT8: 1,\n INT16: 2,\n UINT16: 2,\n INT32: 4,\n UINT32: 4,\n INT64: 8,\n UINT64: 8,\n FLOAT32: 4,\n FLOAT64: 8\n};\n\nexport function getArrayElementByteSize(attributeType, componentType): number {\n return (\n ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType] *\n ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType]\n );\n}\n\n/**\n * Gets offset array from `arrayOffsets` or `stringOffsets`.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param bufferViewIndex - Buffer view index\n * @param offsetType - The type of values in `arrayOffsets` or `stringOffsets`.\n * @param numberOfElements - The number of elements in each property array.\n * @returns Array of values offsets. The number of offsets in the array is equal to `numberOfElements` plus one.\n */\nexport function getOffsetsForProperty(\n scenegraph: GLTFScenegraph,\n bufferViewIndex: number,\n offsetType: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string,\n numberOfElements: number\n): TypedArray | null {\n if (\n offsetType !== 'UINT8' &&\n offsetType !== 'UINT16' &&\n offsetType !== 'UINT32' &&\n offsetType !== 'UINT64'\n ) {\n return null;\n }\n const arrayOffsetsBytes = scenegraph.getTypedArrayForBufferView(bufferViewIndex);\n const arrayOffsets = convertRawBufferToMetadataArray(\n arrayOffsetsBytes,\n 'SCALAR', // offsets consist of ONE component\n offsetType,\n numberOfElements + 1 // The number of offsets is equal to the property table `count` plus one.\n );\n\n // We don't support BigInt offsets at the moment. It requires additional logic and potential issues in Safari\n if (arrayOffsets instanceof BigInt64Array || arrayOffsets instanceof BigUint64Array) {\n return null;\n }\n return arrayOffsets;\n}\n\n/**\n * Converts raw bytes that are in the buffer to an array of the type defined by the schema.\n * @param data - Raw bytes in the buffer.\n * @param attributeType - SCALAR, VECN, MATN.\n * @param componentType - Type of the component in elements, e.g. 'UINT8' or 'FLOAT32'.\n * @param elementCount - Number of elements in the array. Default value is 1.\n * @returns Data array\n */\nexport function convertRawBufferToMetadataArray(\n data: Uint8Array,\n attributeType: string,\n componentType: NumericComponentType,\n elementCount: number = 1\n): BigTypedArray {\n const numberOfComponents = ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType];\n const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[componentType];\n const size = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType];\n const length = elementCount * numberOfComponents;\n const byteLength = length * size;\n let buffer = data.buffer;\n let offset = data.byteOffset;\n if (offset % size !== 0) {\n const bufferArray = new Uint8Array(buffer);\n buffer = bufferArray.slice(offset, offset + byteLength).buffer;\n offset = 0;\n }\n return new ArrayType(buffer, offset, length);\n}\n\n/**\n * Processes data encoded in the texture associated with the primitive.\n * @param scenegraph - Instance of the class for structured access to GLTF data.\n * @param textureInfo - Reference to the texture where extension data are stored.\n * @param primitive - Primitive object in the mesh.\n * @returns Array of data taken. Null if data can't be taken from the texture.\n */\nexport function getPrimitiveTextureData(\n scenegraph: GLTFScenegraph,\n textureInfo: GLTFTextureInfoMetadata,\n primitive: GLTFMeshPrimitive\n): number[] | null {\n /*\n texture.index is an index for the \"textures\" array.\n The texture object referenced by this index looks like this:\n {\n \"sampler\": 0,\n \"source\": 0\n }\n \"sampler\" is an index for the \"samplers\" array\n \"source\" is an index for the \"images\" array that contains data. These data are stored in rgba channels of the image.\n\n texture.texCoord is a number-suffix (like 1) for an attribute like \"TEXCOORD_1\" in meshes.primitives\n The value of \"TEXCOORD_1\" is an accessor that is used to get coordinates. These coordinates are being used to get data from the image.\n */\n const json = scenegraph.gltf.json;\n\n const texCoordAccessorKey = `TEXCOORD_${textureInfo.texCoord || 0}`;\n const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];\n\n const textureCoordinates: Float32Array | null = getFloat32ArrayForAccessor(\n scenegraph.gltf,\n texCoordAccessorIndex\n );\n if (!textureCoordinates) {\n return null;\n }\n\n const textureIndex: number = textureInfo.index;\n const imageIndex = json.textures?.[textureIndex]?.source;\n if (typeof imageIndex !== 'undefined') {\n const mimeType = json.images?.[imageIndex]?.mimeType;\n const parsedImage = scenegraph.gltf.images?.[imageIndex];\n // Checking for width is to prevent handling Un-processed images (e.g. [analyze] stage, where loadImages option is set to false)\n if (parsedImage && typeof parsedImage.width !== 'undefined') {\n const textureData: number[] = [];\n for (let index = 0; index < textureCoordinates.length; index += 2) {\n const value = getImageValueByCoordinates(\n parsedImage,\n mimeType,\n textureCoordinates,\n index,\n textureInfo.channels\n );\n textureData.push(value);\n }\n return textureData;\n }\n }\n return null;\n}\n\n/**\n * Puts property data to attributes.\n * It creates corresponding buffer, bufferView and accessor\n * so the data can be accessed like regular data stored in buffers.\n * @param scenegraph - Scenegraph object.\n * @param attributeName - Name of the attribute.\n * @param propertyData - Property data to store.\n * @param featureTable - Array where unique data from the property data are being stored.\n * @param primitive - Primitive object.\n */\nexport function primitivePropertyDataToAttributes(\n scenegraph: GLTFScenegraph,\n attributeName: string,\n propertyData: number[],\n featureTable: number[],\n primitive: GLTFMeshPrimitive\n): void {\n // No reason to create an empty buffer if there is no property data to store.\n if (!propertyData?.length) {\n return;\n }\n /*\n featureTable will contain unique values, e.g.\n propertyData = [24, 35, 28, 24]\n featureTable = [24, 35, 28]\n featureIndices will contain indices that refer featureTextureTable, e.g.\n featureIndices = [0, 1, 2, 0]\n */\n const featureIndices: number[] = [];\n for (const texelData of propertyData) {\n let index = featureTable.findIndex((item) => item === texelData);\n if (index === -1) {\n index = featureTable.push(texelData) - 1;\n }\n featureIndices.push(index);\n }\n const typedArray = new Uint32Array(featureIndices);\n const bufferIndex =\n scenegraph.gltf.buffers.push({\n arrayBuffer: typedArray.buffer,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n }) - 1;\n const bufferViewIndex = scenegraph.addBufferView(typedArray, bufferIndex, 0);\n const accessorIndex = scenegraph.addAccessor(bufferViewIndex, {\n size: 1,\n componentType: getComponentTypeFromArray(typedArray),\n count: typedArray.length\n });\n primitive.attributes[attributeName] = accessorIndex;\n}\n\n/**\n * Gets the value from the texture by coordinates provided.\n * @param parsedImage - Image where the data are stored.\n * @param mimeType - MIME type.\n * @param textureCoordinates - uv coordinates to access data in the image.\n * @param index - Index of uv coordinates in the array textureCoordinates.\n * @param channels - Image channels where data are stored. Channels of an RGBA texture are numbered 0..3 respectively.\n * @returns Value taken from the image.\n */\nfunction getImageValueByCoordinates(\n parsedImage: ImageType,\n mimeType: string | undefined,\n textureCoordinates: Float32Array,\n index: number,\n channels: number[] | string = [0]\n) {\n const CHANNELS_MAP = {\n r: {offset: 0, shift: 0},\n g: {offset: 1, shift: 8},\n b: {offset: 2, shift: 16},\n a: {offset: 3, shift: 24}\n };\n\n const u = textureCoordinates[index];\n const v = textureCoordinates[index + 1];\n\n let components = 1;\n if (mimeType && (mimeType.indexOf('image/jpeg') !== -1 || mimeType.indexOf('image/png') !== -1))\n components = 4;\n const offset = coordinatesToOffset(u, v, parsedImage, components);\n let value: number = 0;\n for (const c of channels) {\n /*\n According to the EXT_feature_metadata extension specification:\n Channels are labeled by rgba and are swizzled with a string of 1-4 characters.\n According to the EXT_mesh_features extension specification:\n The channels array contains non-negative integer values corresponding to channels of the source texture that the feature ID consists of.\n Channels of an RGBA texture are numbered 0–3 respectively.\n Function getImageValueByCoordinates is used to process both extensions. \n So, there should be possible to get the element of CHANNELS_MAP by either index (0, 1, 2, 3) or key (r, g, b, a).\n */\n const map = typeof c === 'number' ? Object.values(CHANNELS_MAP)[c] : CHANNELS_MAP[c];\n const imageOffset = offset + map.offset;\n const imageData = getImageData(parsedImage);\n if (imageData.data.length <= imageOffset) {\n throw new Error(`${imageData.data.length} <= ${imageOffset}`);\n }\n const imageValue = imageData.data[imageOffset];\n value |= imageValue << map.shift;\n }\n return value;\n}\n\n/**\n * Retrieves the offset in the image where the data are stored.\n * @param u - u-coordinate.\n * @param v - v-coordinate.\n * @param parsedImage - Image where the data are stored.\n * @param componentsCount - Number of components the data consists of.\n * @returns Offset in the image where the data are stored.\n */\nfunction coordinatesToOffset(\n u: number,\n v: number,\n parsedImage: any,\n componentsCount: number = 1\n): number {\n const w = parsedImage.width;\n const iX = emod(u) * (w - 1);\n const indX = Math.round(iX);\n\n const h = parsedImage.height;\n const iY = emod(v) * (h - 1);\n const indY = Math.round(iY);\n const components = parsedImage.components ? parsedImage.components : componentsCount;\n // components is a number of channels in the image\n const offset = (indY * w + indX) * components;\n return offset;\n}\n\n/**\n * Parses variable-length array data.\n * In this case every value of the property in the table will be an array\n * of arbitrary length.\n * @param valuesData - Values in a flat typed array.\n * @param numberOfElements - Number of rows in the property table.\n * @param arrayOffsets - Offsets of nested arrays in the flat values array.\n * @param valuesDataBytesLength - Data byte length.\n * @param valueSize - Value size in bytes.\n * @returns Array of typed arrays.\n */\nexport function parseVariableLengthArrayNumeric(\n valuesData: BigTypedArray,\n numberOfElements: number,\n arrayOffsets: TypedArray,\n valuesDataBytesLength: number,\n valueSize: number\n): BigTypedArray[] {\n const attributeValueArray: BigTypedArray[] = [];\n for (let index = 0; index < numberOfElements; index++) {\n const arrayOffset = arrayOffsets[index];\n const arrayByteSize = arrayOffsets[index + 1] - arrayOffsets[index];\n if (arrayByteSize + arrayOffset > valuesDataBytesLength) {\n break;\n }\n const typedArrayOffset = arrayOffset / valueSize;\n const elementCount = arrayByteSize / valueSize;\n attributeValueArray.push(valuesData.slice(typedArrayOffset, typedArrayOffset + elementCount));\n }\n return attributeValueArray;\n}\n\n/**\n * Parses fixed-length array data.\n * In this case every value of the property in the table will be an array\n * of constant length equal to `arrayCount`.\n * @param valuesData - Values in a flat typed array.\n * @param numberOfElements - Number of rows in the property table.\n * @param arrayCount - Nested arrays length.\n * @returns Array of typed arrays.\n */\nexport function parseFixedLengthArrayNumeric(\n valuesData: BigTypedArray,\n numberOfElements: number,\n arrayCount: number\n): BigTypedArray[] {\n const attributeValueArray: BigTypedArray[] = [];\n for (let index = 0; index < numberOfElements; index++) {\n const elementOffset = index * arrayCount;\n attributeValueArray.push(valuesData.slice(elementOffset, elementOffset + arrayCount));\n }\n return attributeValueArray;\n}\n\n/**\n * Decodes properties of string type from binary source.\n * @param numberOfElements - The number of elements in each property array that propertyTableProperty contains. It's a number of rows in the table.\n * @param valuesDataBytes - Data taken from values property of the property table property.\n * @param arrayOffsets - Offsets for variable-length arrays. It's null for fixed-length arrays or scalar types.\n * @param stringOffsets - Index of the buffer view containing offsets for strings. It should be available for string type.\n * @returns String property values\n */\nexport function getPropertyDataString(\n numberOfElements: number,\n valuesDataBytes: Uint8Array,\n arrayOffsets: TypedArray | null,\n stringOffsets: TypedArray | null\n): string[] | string[][] {\n if (arrayOffsets) {\n // TODO: implement it as soon as we have the corresponding tileset\n throw new Error('Not implemented - arrayOffsets for strings is specified');\n }\n\n if (stringOffsets) {\n const stringsArray: string[] = [];\n const textDecoder = new TextDecoder('utf8');\n\n let stringOffset = 0;\n for (let index = 0; index < numberOfElements; index++) {\n const stringByteSize = stringOffsets[index + 1] - stringOffsets[index];\n\n if (stringByteSize + stringOffset <= valuesDataBytes.length) {\n const stringData = valuesDataBytes.subarray(stringOffset, stringByteSize + stringOffset);\n const stringAttribute = textDecoder.decode(stringData);\n\n stringsArray.push(stringAttribute);\n stringOffset += stringByteSize;\n }\n }\n\n return stringsArray;\n }\n return [];\n}\n"],"mappings":"AAcA,SAAQA,yBAAyB,EAAEC,0BAA0B,QAAO,6BAA6B;AACjG,SAAQC,YAAY,QAAO,oBAAoB;AAC/C,SAAQC,IAAI,QAAO,kBAAkB;AAcrC,MAAMC,4BAA4B,GAAG;EACnCC,MAAM,EAAE,CAAC;EACTC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,EAAE;EACRC,OAAO,EAAE,CAAC;EACVC,MAAM,EAAE,CAAC;EACTC,IAAI,EA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3C,IAAIC,YAAY,GAAG,CAAC;IACpB,KAAK,IAAI9E,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGjC,gBAAgB,EAAEiC,KAAK,EAAE,EAAE;MACrD,MAAM+E,cAAc,GAAGL,aAAa,CAAC1E,KAAK,GAAG,CAAC,CAAC,GAAG0E,aAAa,CAAC1E,KAAK,CAAC;MAEtE,IAAI+E,cAAc,GAAGD,YAAY,IAAIL,eAAe,CAAClG,MAAM,EAAE;QAC3D,MAAMyG,UAAU,GAAGP,eAAe,CAACQ,QAAQ,CAACH,YAAY,EAAEC,cAAc,GAAGD,YAAY,CAAC;QACxF,MAAMI,eAAe,GAAGN,WAAW,CAACO,MAAM,CAACH,UAAU,CAAC;QAEtDL,YAAY,CAAC5D,IAAI,CAACmE,eAAe,CAAC;QAClCJ,YAAY,IAAIC,cAAc;MAChC;IACF;IAEA,OAAOJ,YAAY;EACrB;EACA,OAAO,EAAE;AACX"}
@@ -1,16 +0,0 @@
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);
10
- }
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);
15
- }
16
- //# sourceMappingURL=get-typed-array.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-typed-array.js","names":["assert","getTypedArrayForBufferView","json","buffers","bufferViewIndex","bufferView","bufferViews","bufferIndex","buffer","binChunk","byteOffset","Uint8Array","arrayBuffer","byteLength","getTypedArrayForImageData","imageIndex","image","images"],"sources":["../../../../src/lib/gltf-utils/get-typed-array.ts"],"sourcesContent":["// TODO - GLTFScenegraph should use these\nimport {assert} from '../utils/assert';\n\n// accepts buffer view index or buffer view object\n// returns a `Uint8Array`\nexport function getTypedArrayForBufferView(json, buffers, bufferViewIndex) {\n const bufferView = json.bufferViews[bufferViewIndex];\n assert(bufferView);\n\n // Get hold of the arrayBuffer\n const bufferIndex = bufferView.buffer;\n const binChunk = buffers[bufferIndex];\n assert(binChunk);\n\n const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;\n return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);\n}\n\n// accepts accessor index or accessor object\n// returns a `Uint8Array`\nexport function getTypedArrayForImageData(json, buffers, imageIndex) {\n const image = json.images[imageIndex];\n const bufferViewIndex = json.bufferViews[image.bufferView];\n return getTypedArrayForBufferView(json, buffers, bufferViewIndex);\n}\n\n/*\n// accepts accessor index or accessor object\n// returns a typed array with type that matches the types\nexport function getTypedArrayForAccessor(accessor) {\n accessor = this.getAccessor(accessor);\n const bufferView = this.getBufferView(accessor.bufferView);\n const buffer = this.getBuffer(bufferView.buffer);\n const arrayBuffer = buffer.data;\n\n // Create a new typed array as a view into the combined buffer\n const {ArrayType, length} = getAccessorArrayTypeAndLength(accessor, bufferView);\n const byteOffset = bufferView.byteOffset + accessor.byteOffset;\n return new ArrayType(arrayBuffer, byteOffset, length);\n}\n*/\n"],"mappings":"AACA,SAAQA,MAAM,QAAO,iBAAiB;AAItC,OAAO,SAASC,0BAA0BA,CAACC,IAAI,EAAEC,OAAO,EAAEC,eAAe,EAAE;EACzE,MAAMC,UAAU,GAAGH,IAAI,CAACI,WAAW,CAACF,eAAe,CAAC;EACpDJ,MAAM,CAACK,UAAU,CAAC;EAGlB,MAAME,WAAW,GAAGF,UAAU,CAACG,MAAM;EACrC,MAAMC,QAAQ,GAAGN,OAAO,CAACI,WAAW,CAAC;EACrCP,MAAM,CAACS,QAAQ,CAAC;EAEhB,MAAMC,UAAU,GAAG,CAACL,UAAU,CAACK,UAAU,IAAI,CAAC,IAAID,QAAQ,CAACC,UAAU;EACrE,OAAO,IAAIC,UAAU,CAACF,QAAQ,CAACG,WAAW,EAAEF,UAAU,EAAEL,UAAU,CAACQ,UAAU,CAAC;AAChF;AAIA,OAAO,SAASC,yBAAyBA,CAACZ,IAAI,EAAEC,OAAO,EAAEY,UAAU,EAAE;EACnE,MAAMC,KAAK,GAAGd,IAAI,CAACe,MAAM,CAACF,UAAU,CAAC;EACrC,MAAMX,eAAe,GAAGF,IAAI,CAACI,WAAW,CAACU,KAAK,CAACX,UAAU,CAAC;EAC1D,OAAOJ,0BAA0B,CAACC,IAAI,EAAEC,OAAO,EAAEC,eAAe,CAAC;AACnE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"gltf-attribute-utils.js","names":["getAccessorTypeFromSize","getComponentTypeFromArray","getGLTFAccessors","attributes","accessors","name","attribute","glTFAccessor","getGLTFAccessor","buffer","size","count","getAccessorData","value","byteOffset","type","componentType","ArrayBuffer","isView","toTypedArray","Float32Array","length","array","ArrayType","convertTypedArrays","arguments","undefined","Array","isArray"],"sources":["../../../../src/lib/gltf-utils/gltf-attribute-utils.ts"],"sourcesContent":["// import type {TypedArray} from '../types/loader-utils';\nimport type {GLTFAccessor} from '../types/gltf-json-schema';\n// TODO - remove\nimport {getAccessorTypeFromSize, getComponentTypeFromArray} from './gltf-utils';\n\n// Returns a fresh attributes object with glTF-standardized attributes names\n// Attributes that cannot be identified will not be included\n// Removes `indices` if present, as it should be stored separately from the attributes\nexport function getGLTFAccessors(attributes): {[key: string]: GLTFAccessor} {\n const accessors = {};\n for (const name in attributes) {\n const attribute = attributes[name];\n if (name !== 'indices') {\n const glTFAccessor = getGLTFAccessor(attribute);\n accessors[name] = glTFAccessor;\n }\n }\n return accessors;\n}\n\n// Fix up a single accessor.\n// Input: typed array or a partial accessor object\n// Return: accessor object\nexport function getGLTFAccessor(attribute) {\n const {buffer, size, count} = getAccessorData(attribute);\n\n const glTFAccessor: GLTFAccessor = {\n // glTF Accessor values\n // TODO: Instead of a bufferView index we could have an actual buffer (typed array)\n // bufferView: null,\n // TODO: Deprecate `value` in favor of bufferView?\n // @ts-ignore\n value: buffer,\n size, // Decoded `type` (e.g. SCALAR)\n\n byteOffset: 0,\n count,\n type: getAccessorTypeFromSize(size),\n componentType: getComponentTypeFromArray(buffer)\n };\n\n return glTFAccessor;\n}\n\n// export function getGLTFAttribute(data, gltfAttributeName): GLTFAccessor {\n// return data.attributes[data.glTFAttributeMap[gltfAttributeName]];\n// }\n\nfunction getAccessorData(attribute) {\n let buffer = attribute;\n let size = 1;\n let count = 0;\n\n if (attribute && attribute.value) {\n buffer = attribute.value;\n size = attribute.size || 1;\n }\n\n if (buffer) {\n if (!ArrayBuffer.isView(buffer)) {\n buffer = toTypedArray(buffer, Float32Array);\n }\n count = buffer.length / size;\n }\n\n return {buffer, size, count};\n}\n\n// Convert non-typed arrays to arrays of specified format\nfunction toTypedArray(array, ArrayType, convertTypedArrays = false) {\n if (!array) {\n return null;\n }\n if (Array.isArray(array)) {\n return new ArrayType(array);\n }\n if (convertTypedArrays && !(array instanceof ArrayType)) {\n return new ArrayType(array);\n }\n return array;\n}\n"],"mappings":"AAGA,SAAQA,uBAAuB,EAAEC,yBAAyB,QAAO,cAAc;AAK/E,OAAO,SAASC,gBAAgBA,CAACC,UAAU,EAAiC;EAC1E,MAAMC,SAAS,GAAG,CAAC,CAAC;EACpB,KAAK,MAAMC,IAAI,IAAIF,UAAU,EAAE;IAC7B,MAAMG,SAAS,GAAGH,UAAU,CAACE,IAAI,CAAC;IAClC,IAAIA,IAAI,KAAK,SAAS,EAAE;MACtB,MAAME,YAAY,GAAGC,eAAe,CAACF,SAAS,CAAC;MAC/CF,SAAS,CAACC,IAAI,CAAC,GAAGE,YAAY;IAChC;EACF;EACA,OAAOH,SAAS;AAClB;AAKA,OAAO,SAASI,eAAeA,CAACF,SAAS,EAAE;EACzC,MAAM;IAACG,MAAM;IAAE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IA,SAAS,CAACD,KAAK,CAAC;EAC7B;EACA,OAAOA,KAAK;AACd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"gltf-constants.js","names":["COMPONENTS","SCALAR","VEC2","VEC3","VEC4","MAT2","MAT3","MAT4","BYTES","getBytesFromComponentType","componentType","getSizeFromAccessorType","type","getGLEnumFromSamplerParameter","parameter","GL_TEXTURE_MAG_FILTER","GL_TEXTURE_MIN_FILTER","GL_TEXTURE_WRAP_S","GL_TEXTURE_WRAP_T","PARAMETER_MAP","magFilter","minFilter","wrapS","wrapT"],"sources":["../../../../src/lib/gltf-utils/gltf-constants.ts"],"sourcesContent":["export const COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\n\nexport const BYTES = {\n 5120: 1, // BYTE\n 5121: 1, // UNSIGNED_BYTE\n 5122: 2, // SHORT\n 5123: 2, // UNSIGNED_SHORT\n 5125: 4, // UNSIGNED_INT\n 5126: 4 // FLOAT\n};\n\n// ENUM LOOKUP\n\nexport function getBytesFromComponentType(componentType) {\n return BYTES[componentType];\n}\n\nexport function getSizeFromAccessorType(type) {\n return COMPONENTS[type];\n}\n\nexport function getGLEnumFromSamplerParameter(parameter) {\n const GL_TEXTURE_MAG_FILTER = 0x2800;\n const GL_TEXTURE_MIN_FILTER = 0x2801;\n const GL_TEXTURE_WRAP_S = 0x2802;\n const GL_TEXTURE_WRAP_T = 0x2803;\n\n const PARAMETER_MAP = {\n magFilter: GL_TEXTURE_MAG_FILTER,\n minFilter: GL_TEXTURE_MIN_FILTER,\n wrapS: GL_TEXTURE_WRAP_S,\n wrapT: GL_TEXTURE_WRAP_T\n };\n\n return PARAMETER_MAP[parameter];\n}\n"],"mappings":"AAAA,OAAO,MAAMA,UAAU,GAAG;EACxBC,MAAM,EAAE,CAAC;EACTC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE,CAAC;EACPC,IAAI,EAAE;AACR,CAAC;AAED,OAAO,MAAMC,KAAK,GAAG;EACnB,IAAI,EAAE,CAAC;EACP,IAAI,EAAE,CAAC;EACP,IAAI,EAAE,CAAC;EACP,IAAI,EAAE,CAAC;EACP,IAAI,EAAE,CAAC;EACP,IAAI,EAAE;AACR,CAAC;AAID,OAAO,SAASC,yBAAyBA,CAACC,aAAa,EAAE;EACvD,OAAOF,KAAK,CAACE,aAAa,CAAC;AAC7B;AAEA,OAAO,SAASC,uBAAuBA,CAACC,IAAI,EAAE;EAC5C,OAAOZ,UAAU,CAACY,IAAI,CAAC;AACzB;AAEA,OAAO,SAASC,6BAA6BA,CAACC,SAAS,EAAE;EACvD,MAAMC,qBAAqB,GAAG,MAAM;EACpC,MAAMC,qBAAqB,GAAG,MAAM;EACpC,MAAMC,iBAAiB,GAAG,MAAM;EAChC,MAAMC,iBAAiB,GAAG,MAAM;EAEhC,MAAMC,aAAa,GAAG;IACpBC,SAAS,EAAEL,qBAAqB;IAChCM,SAAS,EAAEL,qBAAqB;IAChCM,KAAK,EAAEL,iBAAiB;IACxBM,KAAK,EAAEL;EACT,CAAC;EAED,OAAOC,aAAa,CAACL,SAAS,CAAC;AACjC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"gltf-utils.js","names":["assert","BYTES","COMPONENTS","MIPMAP_FACTOR","TYPES","ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT","Int8Array","Uint8Array","Int16Array","Uint16Array","Uint32Array","Float32Array","Float64Array","ARRAY_TO_COMPONENT_TYPE","Map","ATTRIBUTE_TYPE_TO_COMPONENTS","SCALAR","VEC2","VEC3","VEC4","MAT2","MAT3","MAT4","ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE","ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY","getAccessorTypeFromSize","size","type","getComponentTypeFromArray","typedArray","componentType","get","constructor","Error","getAccessorArrayTypeAndLength","accessor","bufferView","ArrayType","components","bytesPerComponent","length","count","byteLength","getFloat32ArrayForAccessor","gltfData","texCoordAccessor","_gltfData$json$access","json","accessors","_gltfData$json$buffer","bufferViews","arrayBuffer","byteOffset","bufferByteOffset","buffers","buffer","bytes","elementAddressScale","byteStride","result","i","uv","set","getMemoryUsageGLTF","gltf","images","imageBufferViews","map","filter","view","includes","bufferMemory","reduce","acc","pixelCount","image","width","height","Math","ceil"],"sources":["../../../../src/lib/gltf-utils/gltf-utils.ts"],"sourcesContent":["import {assert} from '../utils/assert';\n\nimport type {GLTFWithBuffers} from '../types/gltf-types';\nimport type {GLTFPostprocessed} from '../types/gltf-postprocessed-schema';\nimport {BYTES, COMPONENTS} from '../gltf-utils/gltf-constants';\n\n/**\n * Memory needed to store texture and all mipmap levels 1 + 1/4 + 1/16 + 1/64 + ...\n * Minimum 1.33, but due to GPU layout may be 1.5\n */\nconst MIPMAP_FACTOR = 1.33;\n\nconst TYPES = ['SCALAR', 'VEC2', 'VEC3', 'VEC4'];\n\ntype TypedArrayConstructor =\n | Int8ArrayConstructor\n | Uint8ArrayConstructor\n | Int16ArrayConstructor\n | Uint16ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Int32ArrayConstructor\n | Uint32ArrayConstructor\n | Float32ArrayConstructor\n | Float64ArrayConstructor;\n\nconst ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT: [TypedArrayConstructor, number][] = [\n [Int8Array, 5120],\n [Uint8Array, 5121],\n [Int16Array, 5122],\n [Uint16Array, 5123],\n [Uint32Array, 5125],\n [Float32Array, 5126],\n [Float64Array, 5130]\n];\nconst ARRAY_TO_COMPONENT_TYPE = new Map<TypedArrayConstructor, number>(\n ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT\n);\n\nconst ATTRIBUTE_TYPE_TO_COMPONENTS = {\n SCALAR: 1,\n VEC2: 2,\n VEC3: 3,\n VEC4: 4,\n MAT2: 4,\n MAT3: 9,\n MAT4: 16\n};\n\nconst ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {\n 5120: 1,\n 5121: 1,\n 5122: 2,\n 5123: 2,\n 5125: 4,\n 5126: 4\n};\n\nconst ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {\n 5120: Int8Array,\n 5121: Uint8Array,\n 5122: Int16Array,\n 5123: Uint16Array,\n 5125: Uint32Array,\n 5126: Float32Array\n};\n\nexport function getAccessorTypeFromSize(size) {\n const type = TYPES[size - 1];\n return type || TYPES[0];\n}\n\nexport function getComponentTypeFromArray(typedArray) {\n const componentType = ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);\n if (!componentType) {\n throw new Error('Illegal typed array');\n }\n return componentType;\n}\n\nexport function getAccessorArrayTypeAndLength(accessor, bufferView) {\n const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];\n const components = ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];\n const bytesPerComponent = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];\n const length = accessor.count * components;\n const byteLength = accessor.count * components * bytesPerComponent;\n assert(byteLength >= 0 && byteLength <= bufferView.byteLength);\n return {ArrayType, length, byteLength};\n}\n\nexport function getFloat32ArrayForAccessor(\n gltfData: GLTFWithBuffers,\n texCoordAccessor: number\n): Float32Array | null {\n const accessor = gltfData.json.accessors?.[texCoordAccessor];\n if (accessor && typeof accessor.bufferView !== 'undefined') {\n // Get `bufferView` of the `accessor`\n const bufferView = gltfData.json.bufferViews?.[accessor.bufferView];\n if (bufferView) {\n // Get `arrayBuffer` the `bufferView` look at\n const {arrayBuffer, byteOffset: bufferByteOffset} = gltfData.buffers[bufferView.buffer];\n // Resulting byteOffset is sum of the buffer, accessor and bufferView byte offsets\n const byteOffset =\n (bufferByteOffset || 0) + (accessor.byteOffset || 0) + (bufferView.byteOffset || 0);\n // Deduce TypedArray type and its length from `accessor` and `bufferView` data\n const {ArrayType, length} = getAccessorArrayTypeAndLength(accessor, bufferView);\n // Number of bytes each component occupies\n const bytes = BYTES[accessor.componentType];\n // Number of components. For the `TEXCOORD_0` with `VEC2` type, it must return 2\n const components = COMPONENTS[accessor.type];\n // Multiplier to calculate the address of the `TEXCOORD_0` element in the arrayBuffer\n const elementAddressScale = bufferView.byteStride || bytes * components;\n // Data transform to Float32Array\n const result = new Float32Array(length);\n for (let i = 0; i < accessor.count; i++) {\n // Take [u, v] couple from the arrayBuffer\n const uv = new ArrayType(arrayBuffer, byteOffset + i * elementAddressScale, 2);\n result.set(uv, i * components);\n }\n return result;\n }\n }\n return null;\n}\n\n/**\n * Calculate the GPU memory used by a GLTF tile, for both buffer and texture memory\n * @param gltf - the gltf content of a GLTF tile\n * @returns - total memory usage in bytes\n */\nexport function getMemoryUsageGLTF(gltf: GLTFPostprocessed): number {\n let {images, bufferViews} = gltf;\n images = images || [];\n bufferViews = bufferViews || [];\n const imageBufferViews = images.map((i) => i.bufferView);\n bufferViews = bufferViews.filter((view) => !imageBufferViews.includes(view as any));\n\n const bufferMemory = bufferViews.reduce((acc, view) => acc + view.byteLength, 0);\n\n // Assume each pixel of the texture is 4 channel with mimmaps (which add 33%)\n // TODO correctly handle compressed textures\n const pixelCount = images.reduce((acc, image) => {\n // @ts-ignore\n const {width, height} = (image as any).image;\n return acc + width * height;\n }, 0);\n return bufferMemory + Math.ceil(4 * pixelCount * MIPMAP_FACTOR);\n}\n"],"mappings":"AAAA,SAAQA,MAAM,QAAO,iBAAiB;AAItC,SAAQC,KAAK,EAAEC,UAAU,QAAO,8BAA8B;AAM9D,MAAMC,aAAa,GAAG,IAAI;AAE1B,MAAMC,KAAK,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;AAchD,MAAMC,mCAAsE,GAAG,CAC7E,CAACC,SAAS,EAAE,IAAI,CAAC,EACjB,CAACC,UAAU,EAAE,IAAI,CAAC,EAClB,CAACC,UAAU,EAAE,IAAI,CAAC,EAClB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MgC,UAAU,GAAGT,MAAM,CAACO,MAAM,CAAC,CAACC,GAAG,EAAEE,KAAK,KAAK;IAE/C,MAAM;MAACC,KAAK;MAAEC;IAAM,CAAC,GAAIF,KAAK,CAASA,KAAK;IAC5C,OAAOF,GAAG,GAAGG,KAAK,GAAGC,MAAM;EAC7B,CAAC,EAAE,CAAC,CAAC;EACL,OAAON,YAAY,GAAGO,IAAI,CAACC,IAAI,CAAC,CAAC,GAAGL,UAAU,GAAGvE,aAAa,CAAC;AACjE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-url.js","names":["resolveUrl","url","options","absolute","startsWith","baseUrl","baseUri","uri","Error","concat","substr","lastIndexOf"],"sources":["../../../../src/lib/gltf-utils/resolve-url.ts"],"sourcesContent":["// Resolves a relative url against a baseUrl\n// If url is absolute, return it unchanged\nexport function resolveUrl(url, options) {\n // TODO: Use better logic to handle all protocols plus not delay on data\n const absolute = url.startsWith('data:') || url.startsWith('http:') || url.startsWith('https:');\n if (absolute) {\n return url;\n }\n const baseUrl = options.baseUri || options.uri;\n if (!baseUrl) {\n throw new Error(`'baseUri' must be provided to resolve relative url ${url}`);\n }\n return baseUrl.substr(0, baseUrl.lastIndexOf('/') + 1) + url;\n}\n"],"mappings":"AAEA,OAAO,SAASA,UAAUA,CAACC,GAAG,EAAEC,OAAO,EAAE;EAEvC,MAAMC,QAAQ,GAAGF,GAAG,CAACG,UAAU,CAAC,OAAO,CAAC,IAAIH,GAAG,CAACG,UAAU,CAAC,OAAO,CAAC,IAAIH,GAAG,CAACG,UAAU,CAAC,QAAQ,CAAC;EAC/F,IAAID,QAAQ,EAAE;IACZ,OAAOF,GAAG;EACZ;EACA,MAAMI,OAAO,GAAGH,OAAO,CAACI,OAAO,IAAIJ,OAAO,CAACK,GAAG;EAC9C,IAAI,CAACF,OAAO,EAAE;IACZ,MAAM,IAAIG,KAAK,uDAAAC,MAAA,CAAuDR,GAAG,CAAE,CAAC;EAC9E;EACA,OAAOI,OAAO,CAACK,MAAM,CAAC,CAAC,EAAEL,OAAO,CAACM,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGV,GAAG;AAC9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-glb.js","names":["padToNBytes","assert","LITTLE_ENDIAN","MAGIC_glTF","GLB_FILE_HEADER_SIZE","GLB_CHUNK_HEADER_SIZE","GLB_CHUNK_TYPE_JSON","GLB_CHUNK_TYPE_BIN","GLB_V1_CONTENT_FORMAT_JSON","GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED","GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED","getMagicString","dataView","byteOffset","arguments","length","undefined","concat","String","fromCharCode","getUint8","isGLB","arrayBuffer","options","DataView","magic","magic1","getUint32","parseGLBSync","glb","type","version","byteLength","Object","assign","header","hasBinChunk","json","binChunks","parseGLBV1","parseGLBV2","Error","contentLength","contentFormat","parseJSONChunk","parseBINChunk","parseGLBChunksSync","chunkLength","chunkFormat","strict","jsonChunk","Uint8Array","buffer","textDecoder","TextDecoder","jsonText","decode","JSON","parse","push"],"sources":["../../../../src/lib/parsers/parse-glb.ts"],"sourcesContent":["/* eslint-disable camelcase, max-statements */\n// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#glb-file-format-specification\n// https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Khronos/KHR_binary_glTF\nimport type {GLB} from '../types/glb-types';\nimport {padToNBytes, assert} from '@loaders.gl/loader-utils';\n\n/** Options for parsing a GLB */\nexport type ParseGLBOptions = {\n /** @deprecated This option was used by XVIZ protocol to define a non-standard magic number */\n magic?: number;\n /** @deprecated This option was used by XVIZ protocol to embed non-standard chunks */\n strict?: boolean;\n};\n\n/** Binary GLTF is little endian. */\nconst LITTLE_ENDIAN = true;\n\n/** 'glTF' in Big-Endian ASCII */\nconst MAGIC_glTF = 0x676c5446;\nconst GLB_FILE_HEADER_SIZE = 12;\nconst GLB_CHUNK_HEADER_SIZE = 8;\nconst GLB_CHUNK_TYPE_JSON = 0x4e4f534a;\nconst GLB_CHUNK_TYPE_BIN = 0x004e4942;\nconst GLB_V1_CONTENT_FORMAT_JSON = 0x0;\n\n/** @deprecated - Backward compatibility for old xviz files */\nconst GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED = 0;\n/** @deprecated - Backward compatibility for old xviz files */\nconst GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED = 1;\n\nfunction getMagicString(dataView, byteOffset = 0) {\n return `\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 0))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 1))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 2))}\\\n${String.fromCharCode(dataView.getUint8(byteOffset + 3))}`;\n}\n\n/** Check if the contents of an array buffer contains GLB byte markers */\nexport function isGLB(\n arrayBuffer: ArrayBuffer,\n byteOffset: number = 0,\n options: ParseGLBOptions = {}\n): boolean {\n const dataView = new DataView(arrayBuffer);\n // Check that GLB Header starts with the magic number\n const {magic = MAGIC_glTF} = options;\n const magic1 = dataView.getUint32(byteOffset, false);\n return magic1 === magic || magic1 === MAGIC_glTF;\n}\n\n/**\n * Synchronously parse a GLB\n * @param glb - Target, Output is stored there\n * @param arrayBuffer - Input data\n * @param byteOffset - Offset into arrayBuffer to start parsing from (for \"embedded\" GLBs, e.g. in 3D tiles)\n * @param options\n * @returns\n */\nexport function parseGLBSync(\n glb: GLB,\n arrayBuffer: ArrayBuffer,\n byteOffset: number = 0,\n options: ParseGLBOptions = {}\n) {\n // Check that GLB Header starts with the magic number\n const dataView = new DataView(arrayBuffer);\n\n // Compare format with GLBLoader documentation\n const type = getMagicString(dataView, byteOffset + 0);\n const version = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Version 2 of binary glTF container format\n const byteLength = dataView.getUint32(byteOffset + 8, LITTLE_ENDIAN); // Total byte length of binary file\n\n Object.assign(glb, {\n // Put less important stuff in a header, to avoid clutter\n header: {\n byteOffset, // Byte offset into the initial arrayBuffer\n byteLength,\n hasBinChunk: false\n },\n\n type,\n version,\n\n json: {},\n binChunks: []\n } as GLB);\n\n byteOffset += GLB_FILE_HEADER_SIZE;\n\n switch (glb.version) {\n case 1:\n return parseGLBV1(glb, dataView, byteOffset);\n case 2:\n return parseGLBV2(glb, dataView, byteOffset, (options = {}));\n default:\n throw new Error(`Invalid GLB version ${glb.version}. Only supports version 1 and 2.`);\n }\n}\n\n/**\n * Parse a V1 GLB\n * @param glb - target, output is stored in this object\n * @param dataView - Input, memory to be parsed\n * @param byteOffset - Offset of first byte of GLB data in the data view\n * @returns Number of bytes parsed (there could be additional non-GLB data after the GLB)\n */\nfunction parseGLBV1(glb: GLB, dataView: DataView, byteOffset: number): number {\n // Sanity: ensure file is big enough to hold at least the headers\n assert(glb.header.byteLength > GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE);\n\n // Explanation of GLB structure:\n // https://cloud.githubusercontent.com/assets/3479527/22600725/36b87122-ea55-11e6-9d40-6fd42819fcab.png\n const contentLength = dataView.getUint32(byteOffset + 0, LITTLE_ENDIAN); // Byte length of chunk\n const contentFormat = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Chunk format as uint32\n byteOffset += GLB_CHUNK_HEADER_SIZE;\n\n // GLB v1 only supports a single chunk type\n assert(contentFormat === GLB_V1_CONTENT_FORMAT_JSON);\n\n parseJSONChunk(glb, dataView, byteOffset, contentLength);\n // No need to call the function padToBytes() from parseJSONChunk()\n byteOffset += contentLength;\n byteOffset += parseBINChunk(glb, dataView, byteOffset, glb.header.byteLength);\n\n return byteOffset;\n}\n\n/**\n * Parse a V2 GLB\n * @param glb - target, output is stored in this object\n * @param dataView - Input, memory to be parsed\n * @param byteOffset - Offset of first byte of GLB data in the data view\n * @returns Number of bytes parsed (there could be additional non-GLB data after the GLB)\n */\nfunction parseGLBV2(\n glb: GLB,\n dataView: DataView,\n byteOffset: number,\n options: ParseGLBOptions\n): number {\n // Sanity: ensure file is big enough to hold at least the first chunk header\n assert(glb.header.byteLength > GLB_FILE_HEADER_SIZE + GLB_CHUNK_HEADER_SIZE);\n\n parseGLBChunksSync(glb, dataView, byteOffset, options);\n\n return byteOffset + glb.header.byteLength;\n}\n\n/** Iterate over GLB chunks and parse them */\nfunction parseGLBChunksSync(\n glb: GLB,\n dataView: DataView,\n byteOffset: number,\n options: ParseGLBOptions\n) {\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n // Iterate as long as there is space left for another chunk header\n while (byteOffset + 8 <= glb.header.byteLength) {\n const chunkLength = dataView.getUint32(byteOffset + 0, LITTLE_ENDIAN); // Byte length of chunk\n const chunkFormat = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN); // Chunk format as uint32\n byteOffset += GLB_CHUNK_HEADER_SIZE;\n\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n switch (chunkFormat) {\n case GLB_CHUNK_TYPE_JSON:\n parseJSONChunk(glb, dataView, byteOffset, chunkLength);\n break;\n case GLB_CHUNK_TYPE_BIN:\n parseBINChunk(glb, dataView, byteOffset, chunkLength);\n break;\n\n // Backward compatibility for very old xviz files\n case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:\n if (!options.strict) {\n parseJSONChunk(glb, dataView, byteOffset, chunkLength);\n }\n break;\n case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:\n if (!options.strict) {\n parseBINChunk(glb, dataView, byteOffset, chunkLength);\n }\n break;\n\n default:\n // Ignore, per spec\n // console.warn(`Unknown GLB chunk type`); // eslint-disable-line\n break;\n }\n\n byteOffset += padToNBytes(chunkLength, 4);\n }\n\n return byteOffset;\n}\n\n/* Parse a GLB JSON chunk */\nfunction parseJSONChunk(glb: GLB, dataView: DataView, byteOffset: number, chunkLength: number) {\n // 1. Create a \"view\" of the binary encoded JSON data inside the GLB\n const jsonChunk = new Uint8Array(dataView.buffer, byteOffset, chunkLength);\n\n // 2. Decode the JSON binary array into clear text\n const textDecoder = new TextDecoder('utf8');\n const jsonText = textDecoder.decode(jsonChunk);\n\n // 3. Parse the JSON text into a JavaScript data structure\n glb.json = JSON.parse(jsonText);\n\n return padToNBytes(chunkLength, 4);\n}\n\n/** Parse a GLB BIN chunk */\nfunction parseBINChunk(glb: GLB, dataView, byteOffset, chunkLength) {\n // Note: BIN chunk can be optional\n glb.header.hasBinChunk = true;\n glb.binChunks.push({\n byteOffset,\n byteLength: chunkLength,\n arrayBuffer: dataView.buffer\n // TODO - copy, or create typed array view?\n });\n\n return padToNBytes(chunkLength, 4);\n}\n"],"mappings":"AAIA,SAAQA,WAAW,EAAEC,MAAM,QAAO,0BAA0B;AAW5D,MAAMC,aAAa,GAAG,IAAI;AAG1B,MAAMC,UAAU,GAAG,UAAU;AAC7B,MAAMC,oBAAoB,GAAG,EAAE;AAC/B,MAAMC,qBAAqB,GAAG,CAAC;AAC/B,MAAMC,mBAAmB,GAAG,UAAU;AACtC,MAAMC,kBAAkB,GAAG,UAAU;AACrC,MAAMC,0BAA0B,GAAG,GAAG;AAGtC,MAAMC,mCAAmC,GAAG,CAAC;AAE7C,MAAMC,kCAAkC,GAAG,CAAC;AAE5C,SAASC,cAAcA,CAACC,QAAQ,EAAkB;EAAA,IAAhBC,UAAU,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC9C,UAAAG,MAAA,CACAC,MAAM,CAACC,YAAY,CAACP,QAAQ,CAACQ,QAAQ,CAACP,UAAU,GAAG,CAAC,CAAC,CAAC,EAAAI,MAAA,CACtDC,MAAM,CAACC,YAAY,CAACP,QAAQ,CAACQ,QAAQ,CAACP,UAAU,GAAG,CAAC,CAAC,CAAC,EAAAI,MAAA,CACtDC,MAAM,CAACC,YAAY,CAACP,QAAQ,CAACQ,QAAQ,CAACP,UAAU,GAAG,CAAC,CAAC,CAAC,EAAAI,MAAA,CACtDC,MAAM,CAACC,YAAY,CAACP,QAAQ,CAACQ,QAAQ,CAACP,UAAU,GAAG,CA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C;EAEA,OAAOlC,UAAU;AACnB;AAGA,SAAS+B,cAAcA,CAACf,GAAQ,EAAEjB,QAAkB,EAAEC,UAAkB,EAAEkC,WAAmB,EAAE;EAE7F,MAAMG,SAAS,GAAG,IAAIC,UAAU,CAACvC,QAAQ,CAACwC,MAAM,EAAEvC,UAAU,EAAEkC,WAAW,CAAC;EAG1E,MAAMM,WAAW,GAAG,IAAIC,WAAW,CAAC,MAAM,CAAC;EAC3C,MAAMC,QAAQ,GAAGF,WAAW,CAACG,MAAM,CAACN,SAAS,CAAC;EAG9CrB,GAAG,CAACQ,IAAI,GAAGoB,IAAI,CAACC,KAAK,CAACH,QAAQ,CAAC;EAE/B,OAAOvD,WAAW,CAAC+C,WAAW,EAAE,CAAC,CAAC;AACpC;AAGA,SAASF,aAAaA,CAAChB,GAAQ,EAAEjB,QAAQ,EAAEC,UAAU,EAAEkC,WAAW,EAAE;EAElElB,GAAG,CAACM,MAAM,CAACC,WAAW,GAAG,IAAI;EAC7BP,GAAG,CAACS,SAAS,CAACqB,IAAI,CAAC;IACjB9C,UAAU;IACVmB,UAAU,EAAEe,WAAW;IACvBzB,WAAW,EAAEV,QAAQ,CAACwC;EAExB,CAAC,CAAC;EAEF,OAAOpD,WAAW,CAAC+C,WAAW,EAAE,CAAC,CAAC;AACpC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse-gltf.js","names":["parseJSON","sliceArrayBuffer","parseFromContext","ImageLoader","BasisLoader","selectSupportedBasisFormat","assert","isGLB","parseGLBSync","resolveUrl","getTypedArrayForBufferView","preprocessExtensions","decodeExtensions","normalizeGLTFV1","isGLTF","arrayBuffer","options","byteOffset","parseGLTF","gltf","arrayBufferOrString","_options$gltf","_options$gltf2","_options$gltf3","arguments","length","undefined","context","parseGLTFContainerSync","normalize","loadBuffers","json","buffers","loadImages","data","uri","baseUri","ArrayBuffer","textDecoder","TextDecoder","decode","glb","type","concat","_glb","Array","fill","header","hasBinChunk","binChunks","byteLength","images","i","buffer","_context$fetch","_response$arrayBuffer","fetch","response","call","imageIndices","getReferencesImageIndices","promises","imageIndex","push","loadImage","Promise","all","Set","textures","texture","source","add","from","sort","image","index","hasOwnProperty","bufferView","Number","isFinite","array","parsedImage","mimeType","basis","format","compressed","mipmaps","width","height"],"sources":["../../../../src/lib/parsers/parse-gltf.ts"],"sourcesContent":["/* eslint-disable camelcase, max-statements, no-restricted-globals */\nimport type {LoaderContext} from '@loaders.gl/loader-utils';\nimport type {GLTFLoaderOptions} from '../../gltf-loader';\nimport type {GLTFWithBuffers} from '../types/gltf-types';\nimport type {GLB} from '../types/glb-types';\nimport type {ParseGLBOptions} from './parse-glb';\n\nimport type {ImageType, TextureLevel} from '@loaders.gl/schema';\nimport {parseJSON, sliceArrayBuffer, parseFromContext} from '@loaders.gl/loader-utils';\nimport {ImageLoader} from '@loaders.gl/images';\nimport {BasisLoader, selectSupportedBasisFormat} from '@loaders.gl/textures';\n\nimport {assert} from '../utils/assert';\nimport {isGLB, parseGLBSync} from './parse-glb';\nimport {resolveUrl} from '../gltf-utils/resolve-url';\nimport {getTypedArrayForBufferView} from '../gltf-utils/get-typed-array';\nimport {preprocessExtensions, decodeExtensions} from '../api/gltf-extensions';\nimport {normalizeGLTFV1} from '../api/normalize-gltf-v1';\n\n/** */\nexport type ParseGLTFOptions = ParseGLBOptions & {\n normalize?: boolean;\n loadImages?: boolean;\n loadBuffers?: boolean;\n decompressMeshes?: boolean;\n excludeExtensions?: string[];\n\n /** @deprecated not supported in v4. `postProcessGLTF()` must be called by the application */\n postProcess?: false;\n};\n\n/** Check if an array buffer appears to contain GLTF data */\nexport function isGLTF(arrayBuffer: ArrayBuffer, options?: ParseGLTFOptions): boolean {\n const byteOffset = 0;\n return isGLB(arrayBuffer, byteOffset, options);\n}\n\nexport async function parseGLTF(\n gltf: GLTFWithBuffers,\n arrayBufferOrString,\n byteOffset = 0,\n options: GLTFLoaderOptions,\n context: LoaderContext\n): Promise<GLTFWithBuffers> {\n parseGLTFContainerSync(gltf, arrayBufferOrString, byteOffset, options);\n\n normalizeGLTFV1(gltf, {normalize: options?.gltf?.normalize});\n\n preprocessExtensions(gltf, options, context);\n\n // Load linked buffers asynchronously and decodes base64 buffers in parallel\n if (options?.gltf?.loadBuffers && gltf.json.buffers) {\n await loadBuffers(gltf, options, context);\n }\n\n // loadImages and decodeExtensions should not be running in parallel, because\n // decodeExtensions uses data from images taken during the loadImages call.\n if (options?.gltf?.loadImages) {\n await loadImages(gltf, options, context);\n }\n\n await decodeExtensions(gltf, options, context);\n\n return gltf;\n}\n\n/**\n *\n * @param gltf\n * @param data - can be ArrayBuffer (GLB), ArrayBuffer (Binary JSON), String (JSON), or Object (parsed JSON)\n * @param byteOffset\n * @param options\n */\nfunction parseGLTFContainerSync(gltf, data, byteOffset, options) {\n // Initialize gltf container\n if (options.uri) {\n gltf.baseUri = options.uri;\n }\n\n // If data is binary and starting with magic bytes, assume binary JSON text, convert to string\n if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options)) {\n const textDecoder = new TextDecoder();\n data = textDecoder.decode(data);\n }\n\n if (typeof data === 'string') {\n // If string, try to parse as JSON\n gltf.json = parseJSON(data);\n } else if (data instanceof ArrayBuffer) {\n // If still ArrayBuffer, parse as GLB container\n const glb: GLB = {} as GLB;\n byteOffset = parseGLBSync(glb, data, byteOffset, options.glb);\n\n assert(glb.type === 'glTF', `Invalid GLB magic string ${glb.type}`);\n\n gltf._glb = glb;\n gltf.json = glb.json;\n } else {\n assert(false, 'GLTF: must be ArrayBuffer or string');\n }\n\n // Populate buffers\n // Create an external buffers array to hold binary data\n const buffers = gltf.json.buffers || [];\n gltf.buffers = new Array(buffers.length).fill(null);\n\n // Populates JSON and some bin chunk info\n if (gltf._glb && gltf._glb.header.hasBinChunk) {\n const {binChunks} = gltf._glb;\n gltf.buffers[0] = {\n arrayBuffer: binChunks[0].arrayBuffer,\n byteOffset: binChunks[0].byteOffset,\n byteLength: binChunks[0].byteLength\n };\n\n // TODO - this modifies JSON and is a post processing thing\n // gltf.json.buffers[0].data = gltf.buffers[0].arrayBuffer;\n // gltf.json.buffers[0].byteOffset = gltf.buffers[0].byteOffset;\n }\n\n // Populate images\n const images = gltf.json.images || [];\n gltf.images = new Array(images.length).fill({});\n}\n\n/** Asynchronously fetch and parse buffers, store in buffers array outside of json\n * TODO - traverse gltf and determine which buffers are actually needed\n */\nasync function loadBuffers(gltf: GLTFWithBuffers, options, context: LoaderContext) {\n // TODO\n const buffers = gltf.json.buffers || [];\n for (let i = 0; i < buffers.length; ++i) {\n const buffer = buffers[i];\n if (buffer.uri) {\n const {fetch} = context;\n assert(fetch);\n\n const uri = resolveUrl(buffer.uri, options);\n const response = await context?.fetch?.(uri);\n const arrayBuffer = await response?.arrayBuffer?.();\n\n gltf.buffers[i] = {\n arrayBuffer,\n byteOffset: 0,\n byteLength: arrayBuffer.byteLength\n };\n\n delete buffer.uri;\n } else if (gltf.buffers[i] === null) {\n gltf.buffers[i] = {\n arrayBuffer: new ArrayBuffer(buffer.byteLength),\n byteOffset: 0,\n byteLength: buffer.byteLength\n };\n }\n }\n}\n\n/**\n * Loads all images\n * TODO - traverse gltf and determine which images are actually needed\n * @param gltf\n * @param options\n * @param context\n * @returns\n */\nasync function loadImages(gltf: GLTFWithBuffers, options, context: LoaderContext) {\n const imageIndices = getReferencesImageIndices(gltf);\n\n const images = gltf.json.images || [];\n\n const promises: Promise<any>[] = [];\n for (const imageIndex of imageIndices) {\n promises.push(loadImage(gltf, images[imageIndex], imageIndex, options, context));\n }\n\n return await Promise.all(promises);\n}\n\n/** Make sure we only load images that are actually referenced by textures */\nfunction getReferencesImageIndices(gltf: GLTFWithBuffers): number[] {\n const imageIndices = new Set<number>();\n\n const textures = gltf.json.textures || [];\n for (const texture of textures) {\n if (texture.source !== undefined) {\n imageIndices.add(texture.source);\n }\n }\n\n return Array.from(imageIndices).sort();\n}\n\n/** Asynchronously fetches and parses one image, store in images array outside of json */\nasync function loadImage(\n gltf: GLTFWithBuffers,\n image,\n index: number,\n options,\n context: LoaderContext\n) {\n let arrayBuffer;\n\n if (image.uri && !image.hasOwnProperty('bufferView')) {\n const uri = resolveUrl(image.uri, options);\n\n const {fetch} = context;\n const response = await fetch(uri);\n\n arrayBuffer = await response.arrayBuffer();\n image.bufferView = {\n data: arrayBuffer\n };\n }\n\n if (Number.isFinite(image.bufferView)) {\n const array = getTypedArrayForBufferView(gltf.json, gltf.buffers, image.bufferView);\n arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);\n }\n\n assert(arrayBuffer, 'glTF image has no data');\n\n // Call `parse`\n let parsedImage = (await parseFromContext(\n arrayBuffer,\n [ImageLoader, BasisLoader],\n {\n ...options,\n mimeType: image.mimeType,\n basis: options.basis || {format: selectSupportedBasisFormat()}\n },\n context\n )) as ImageType | TextureLevel[][];\n\n if (parsedImage && parsedImage[0]) {\n parsedImage = {\n compressed: true,\n // @ts-expect-error\n mipmaps: false,\n width: parsedImage[0].width,\n height: parsedImage[0].height,\n data: parsedImage[0]\n };\n }\n // TODO making sure ImageLoader is overridable by using array of loaders\n // const parsedImage = await parse(arrayBuffer, [ImageLoader]);\n\n // Store the loaded image\n gltf.images = gltf.images || [];\n // @ts-expect-error TODO - sort out image typing asap\n gltf.images[index] = parsedImage;\n}\n"],"mappings":"AAQA,SAAQA,SAAS,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAO,0BAA0B;AACtF,SAAQC,WAAW,QAAO,oBAAoB;AAC9C,SAAQC,WAAW,EAAEC,0BAA0B,QAAO,sBAAsB;AAE5E,SAAQC,MAAM,QAAO,iBAAiB;AACtC,SAAQC,KAAK,EAAEC,YAAY,QAAO,aAAa;AAC/C,SAAQC,UAAU,QAAO,2BAA2B;AACpD,SAAQC,0BAA0B,QAAO,+BAA+B;AACxE,SAAQC,oBAAoB,EAAEC,gBAAgB,QAAO,wBAAwB;AAC7E,SAAQC,eAAe,QAAO,0BAA0B;AAexD,OAAO,SAASC,MAAMA,CAACC,WAAwB,EAAEC,OAA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E,gBAAgB,CACvCa,WAAW,EACX,CAACZ,WAAW,EAAEC,WAAW,CAAC,EAC1B;IACE,GAAGY,OAAO;IACVkE,QAAQ,EAAER,KAAK,CAACQ,QAAQ;IACxBC,KAAK,EAAEnE,OAAO,CAACmE,KAAK,IAAI;MAACC,MAAM,EAAE/E,0BAA0B,CAAC;IAAC;EAC/D,CAAC,EACDsB,OACF,CAAkC;EAElC,IAAIsD,WAAW,IAAIA,WAAW,CAAC,CAAC,CAAC,EAAE;IACjCA,WAAW,GAAG;MACZI,UAAU,EAAE,IAAI;MAEhBC,OAAO,EAAE,KAAK;MACdC,KAAK,EAAEN,WAAW,CAAC,CAAC,CAAC,CAACM,KAAK;MAC3BC,MAAM,EAAEP,WAAW,CAAC,CAAC,CAAC,CAACO,MAAM;MAC7BtD,IAAI,EAAE+C,WAAW,CAAC,CAAC;IACrB,CAAC;EACH;EAKA9D,IAAI,CAACgC,MAAM,GAAGhC,IAAI,CAACgC,MAAM,IAAI,EAAE;EAE/BhC,IAAI,CAACgC,MAAM,CAACwB,KAAK,CAAC,GAAGM,WAAW;AAClC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"glb-types.js","names":[],"sources":["../../../../src/lib/types/glb-types.ts"],"sourcesContent":["export type GLBBinChunk = {\n byteOffset: number;\n byteLength: number;\n arrayBuffer: ArrayBuffer;\n};\n\nexport type GLB = {\n type: string;\n version: number; // Version 2 of binary glTF container format\n\n // Put less important stuff in a header, to avoid clutter\n header: {\n byteOffset: number; // Byte offset into the initial arrayBuffer\n byteLength: number;\n hasBinChunk: boolean;\n };\n\n // Per spec we must iterate over chunks, ignoring all except JSON and BIN\n json: Record<string, any>;\n binChunks: GLBBinChunk[];\n};\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"gltf-ext-feature-metadata-schema.js","names":[],"sources":["../../../../src/lib/types/gltf-ext-feature-metadata-schema.ts"],"sourcesContent":["import {GLTFTextureInfo} from './gltf-json-schema';\n\n/* eslint-disable camelcase */\n\n/**\n * EXT_feature_metadata extension types\n * This extension has glTF-level metadata and primitive-level feature indexing and segmentation metadata\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata\n *\n * glTF-level metadata\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#gltf-extension-1\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata/schema/glTF.EXT_feature_metadata.schema.json\n */\nexport type GLTF_EXT_feature_metadata_GLTF = {\n /** An object defining classes and enums. */\n schema?: GLTF_EXT_feature_metadata_Schema;\n /** A uri to an external schema file. */\n schemaUri?: string;\n /** An object containing statistics about features. */\n statistics?: GLTF_EXT_feature_metadata_Statistics;\n /** A dictionary, where each key is a feature table ID and each value is an object defining the feature table. */\n featureTables?: {\n [key: string]: GLTF_EXT_feature_metadata_FeatureTable;\n };\n /** A dictionary, where each key is a feature texture ID and each value is an object defining the feature texture. */\n featureTextures?: {\n [key: string]: GLTF_EXT_feature_metadata_FeatureTexture;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * An object defining classes and enums.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#schema\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/schema.schema.json\n */\nexport type GLTF_EXT_feature_metadata_Schema = {\n /** The name of the schema. */\n name?: string;\n /** The description of the schema. */\n description?: string;\n /** Application-specific version of the schema. */\n version?: string;\n /** A dictionary, where each key is a class ID and each value is an object defining the class. */\n classes?: {\n [key: string]: GLTF_EXT_feature_metadata_Class;\n };\n /** A dictionary, where each key is an enum ID and each value is an object defining the values for the enum. */\n enums?: {\n [key: string]: GLTF_EXT_feature_metadata_Enum;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * A class containing a set of properties.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/class.schema.json\n */\nexport type GLTF_EXT_feature_metadata_Class = {\n /** The name of the class, e.g. for display purposes. */\n name?: string;\n /** The description of the class. */\n description?: string;\n /** A dictionary, where each key is a property ID and each value is an object defining the property. */\n properties: {\n [key: string]: GLTF_EXT_feature_metadata_ClassProperty;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * A class property.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class-property\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/class.property.schema.json\n */\nexport type GLTF_EXT_feature_metadata_ClassProperty = {\n /** The name of the property, e.g. for display purposes. */\n name?: string;\n /** The description of the property. */\n description?: string;\n /**\n * The property type. If ENUM is used, then enumType must also be specified.\n * If ARRAY is used, then componentType must also be specified.\n * ARRAY is a fixed-length array when componentCount is defined, and variable-length otherwise.\n */\n type:\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64'\n | 'BOOLEAN'\n | 'STRING'\n | 'ENUM'\n | 'ARRAY'\n | string;\n /**\n * An enum ID as declared in the enums dictionary.\n * This value must be specified when type or componentType is ENUM.\n */\n enumType?: string;\n /**\n * When type is ARRAY this indicates the type of each component of the array.\n * If ENUM is used, then enumType must also be specified.\n */\n componentType?:\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64'\n | 'BOOLEAN'\n | 'STRING'\n | 'ENUM'\n | string;\n /** The number of components per element for ARRAY elements. */\n componentCount?: number;\n /**\n * Specifies whether integer values are normalized.\n * This applies both when type is an integer type, or when type is ARRAY with a componentType that is an integer type.\n * For unsigned integer types, values are normalized between [0.0, 1.0].\n * For signed integer types, values are normalized between [-1.0, 1.0].\n * For all other types, this property is ignored.\n */\n normalized: boolean;\n /**\n * Maximum allowed values for property values.\n * Only applicable for numeric types and fixed-length arrays of numeric types.\n * For numeric types this is a single number.\n * For fixed-length arrays this is an array with componentCount number of elements.\n * The normalized property has no effect on these values: they always correspond to the integer values.\n */\n max?: number | number[];\n /**\n * Minimum allowed values for property values.\n * Only applicable for numeric types and fixed-length arrays of numeric types.\n * For numeric types this is a single number.\n * For fixed-length arrays this is an array with componentCount number of elements.\n * The normalized property has no effect on these values: they always correspond to the integer values.\n */\n min?: number | number[];\n /**\n * A default value to use when the property value is not defined.\n * If used, optional must be set to true.\n * The type of the default value must match the property definition: For BOOLEAN use true or false.\n * For STRING use a JSON string. For a numeric type use a JSON number.\n * For ENUM use the enum name, not the integer value.\n * For ARRAY use a JSON array containing values matching the componentType.\n */\n default?: boolean | number | string | number[];\n /** If true, this property is optional. */\n optional?: boolean; // default false;\n /**\n * An identifier that describes how this property should be interpreted.\n * The semantic cannot be used by other properties in the class.\n */\n semantic?: string;\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * An object defining the values of an enum.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#enum\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata/schema/enum.schema.json\n */\nexport type GLTF_EXT_feature_metadata_Enum = {\n /** The name of the enum, e.g. for display purposes. */\n name?: string;\n /** The description of the enum. */\n description?: string;\n /** The type of the integer enum value. */\n valueType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64'; // default: \"UINT16\"\n /** An array of enum values. Duplicate names or duplicate integer values are not allowed. */\n values: GLTF_EXT_feature_metadata_EnumValue[];\n extensions?: Record<string, unknown>;\n extras?: unknown;\n [key: string]: unknown;\n};\n\n/**\n * An enum value.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#enum-value\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata/schema/enum.value.schema.json\n */\nexport type GLTF_EXT_feature_metadata_EnumValue = {\n /** The name of the enum value. */\n name: string;\n /** The description of the enum value. */\n description?: string;\n /** The integer enum value. */\n value: number; // default: \"UINT16\"\n extensions?: Record<string, unknown>;\n extras?: unknown;\n [key: string]: unknown;\n};\n\n/**\n * A feature table defined by a class and property values stored in arrays.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-table\n * JSON Schenma - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTable.schema.json\n */\nexport type GLTF_EXT_feature_metadata_FeatureTable = {\n /** The class that property values conform to. The value must be a class ID declared in the classes dictionary. */\n class?: string;\n /** The number of features, as well as the number of elements in each property array. */\n count: number;\n /**\n * A dictionary, where each key corresponds to a property ID in the class properties dictionary\n * and each value is an object describing where property values are stored.\n * Optional properties may be excluded from this dictionary.\n */\n properties?: {\n [key: string]: GLTF_EXT_feature_metadata_FeatureTableProperty;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * An array of binary property values.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-table-property\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTable.property.schema.json\n */\nexport type GLTF_EXT_feature_metadata_FeatureTableProperty = {\n /**\n * The index of the buffer view containing property values.\n * The data type of property values is determined by the property definition:\n * When type is BOOLEAN values are packed into a bitfield.\n * When type is STRING values are stored as byte sequences and decoded as UTF-8 strings.\n * When type is a numeric type values are stored as the provided type.\n * When type is ENUM values are stored as the enum's valueType.\n * Each enum value in the buffer must match one of the allowed values in the enum definition.\n * When type is ARRAY elements are packed tightly together and the data type is based on the componentType following the same rules as above.\n * arrayOffsetBufferView is required for variable-size arrays\n * and stringOffsetBufferView is required for strings (for variable-length arrays of strings, both are required)\n * The buffer view byteOffset must be aligned to a multiple of 8 bytes.\n * If the buffer view's buffer is the GLB-stored BIN chunk the byte offset is measured relative to the beginning of the GLB.\n * Otherwise it is measured relative to the beginning of the buffer.\n */\n bufferView: number;\n\n /** The type of values in arrayOffsetBufferView and stringOffsetBufferView. */\n offsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string; // default: \"UINT32\"\n /**\n * The index of the buffer view containing offsets for variable-length arrays.\n * The number of offsets is equal to the feature table count plus one.\n * The offsets represent the start positions of each array, with the last offset representing the position after the last array.\n * The array length is computed using the difference between the current offset and the subsequent offset.\n * If componentType is STRING the offsets index into the string offsets array (stored in stringOffsetBufferView),\n * otherwise they index into the property array (stored in bufferView).\n * The data type of these offsets is determined by offsetType.\n * The buffer view byteOffset must be aligned to a multiple of 8 bytes in the same manner as the main bufferView\n */\n arrayOffsetBufferView?: number;\n /**\n * The index of the buffer view containing offsets for strings.\n * The number of offsets is equal to the number of string components plus one.\n * The offsets represent the byte offsets of each string in the main bufferView,\n * with the last offset representing the byte offset after the last string.\n * The string byte length is computed using the difference between the current offset and the subsequent offset.\n * The data type of these offsets is determined by offsetType.\n * The buffer view byteOffset must be aligned to a multiple of 8 bytes in the same manner as the main bufferView.\n */\n stringOffsetBufferView?: number;\n extensions?: Record<string, unknown>;\n extras?: unknown;\n /** This is not part of the spec. GLTFLoader loads feature tables data into this property */\n data: unknown;\n};\n\n/**\n * Features whose property values are stored directly in texture channels. This is not to be confused with feature ID textures which store feature IDs for use with a feature table.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-texture\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTexture.schema.json\n */\nexport type GLTF_EXT_feature_metadata_FeatureTexture = {\n /** The class this feature texture conforms to. The value must be a class ID declared in the classes dictionary. */\n class: string;\n /**\n * A dictionary, where each key corresponds to a property ID in the class properties dictionary\n * and each value describes the texture channels containing property values.\n */\n properties: {\n [key: string]: GLTF_EXT_feature_metadata_TextureAccessor;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * A description of how to access property values from the color channels of a texture.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#texture-accessor\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/textureAccessor.schema.json\n */\nexport type GLTF_EXT_feature_metadata_TextureAccessor = {\n /** Texture channels containing property values. Channels are labeled by rgba and are swizzled with a string of 1-4 characters. */\n channels: string;\n /** The glTF texture and texture coordinates to use. */\n texture: GLTFTextureInfo;\n extensions?: Record<string, unknown>;\n extras?: unknown;\n /** This is not part of the spec. GLTFLoader loads feature tables data into this property */\n data: unknown;\n};\n\n/**\n * Statistics about features.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#statistics-1\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/statistics.schema.json\n */\nexport type GLTF_EXT_feature_metadata_Statistics = {\n /**\n * A dictionary, where each key is a class ID declared in the classes dictionary\n * and each value is an object containing statistics about features that conform to the class.\n */\n classes?: {\n [key: string]: GLTF_EXT_feature_metadata_StatisticsClass;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * Statistics about features that conform to the class.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class-statistics\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/statistics.class.property.schema.json\n */\nexport type GLTF_EXT_feature_metadata_StatisticsClass = {\n /** The number of features that conform to the class. */\n count?: number;\n /**\n * A dictionary, where each key is a class ID declared in the classes dictionary\n * and each value is an object containing statistics about property values.\n */\n properties?: {\n [key: string]: GLTF_EXT_feature_metadata_StatisticsClassProperty;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * min, max, mean, median, standardDeviation, variance, sum are\n * only applicable for numeric types and fixed-length arrays of numeric types.\n * For numeric types this is a single number.\n * For fixed-length arrays this is an array with componentCount number of elements.\n * The normalized property has no effect on these values.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#property-statistics\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/statistics.class.property.schema.json\n */\nexport type GLTF_EXT_feature_metadata_StatisticsClassProperty = {\n /** The minimum property value. */\n min?: number | number[];\n /** The maximum property value. */\n max?: number | number[];\n /** The arithmetic mean of the property values. */\n mean?: number | number[];\n /** The median of the property values. */\n median?: number | number[];\n /** The standard deviation of the property values. */\n standardDeviation?: number | number[];\n /** The variance of the property values. */\n variance?: number | number[];\n /** The sum of the property values. */\n sum?: number | number[];\n /**\n * A dictionary, where each key corresponds to an enum name and each value is the number of occurrences of that enum.\n * Only applicable when type or componentType is ENUM.\n * For fixed-length arrays, this is an array with componentCount number of elements.\n */\n occurrences: {\n [key: string]: number | number[];\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * EXT_feature_metadata extension types\n * This extension has glTF-level metadata and primitive-level (feature indexing and segmentation) metadata\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata\n *\n * primitive-level metadata\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#primitive-extension\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/mesh.primitive.EXT_feature_metadata.schema.json\n */\nexport type GLTF_EXT_feature_metadata_Primitive = {\n /** Feature ids definition in attributes */\n featureIdAttributes?: GLTF_EXT_feature_metadata_FeatureIdAttribute[];\n /** Feature ids definition in textures */\n featureIdTextures?: GLTF_EXT_feature_metadata_FeatureIdTexture[];\n /** An array of IDs of feature textures from the root EXT_feature_metadata object. */\n featureTextures?: string[];\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * Attribute which described featureIds definition.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-id-attribute\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureIdAttribute.schema.json\n */\nexport type GLTF_EXT_feature_metadata_FeatureIdAttribute = {\n /** Name of feature table */\n featureTable: string;\n /** Described how feature ids are defined */\n featureIds: GLTF_EXT_feature_metadata_FeatureIdAttributeFeatureIds;\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * Defining featureIds by attributes or implicitly.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#primitive-extensionfeatureidattributes\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureIdAttribute.featureIds.schema.json\n */\nexport type GLTF_EXT_feature_metadata_FeatureIdAttributeFeatureIds = {\n /** Name of attribute where featureIds are defined */\n attribute?: string;\n /** Sets a constant feature ID for each vertex. The default is 0. */\n constant?: number;\n /** Sets the rate at which feature IDs increment.\n * If divisor is zero then constant is used.\n * If divisor is greater than zero the feature ID increments once per divisor sets of vertices, starting at constant.\n * The default is 0\n */\n divisor?: number;\n};\n\n/**\n * An object describing a texture used for storing per-texel feature IDs.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-id-texture\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureIdTexture.schema.json\n */\nexport type GLTF_EXT_feature_metadata_FeatureIdTexture = {\n /** The ID of the feature table in the model's root `EXT_feature_metadata.featureTables` dictionary. */\n featureTable: string;\n /** A description of the texture and channel to use for feature IDs. The `channels` property must have a single channel. Furthermore,\n * feature IDs must be whole numbers in the range `[0, count - 1]` (inclusive), where `count` is the total number of features\n * in the feature table. Texel values must be read as integers. Texture filtering should be disabled when fetching feature IDs.\n */\n featureIds: GLTF_EXT_feature_metadata_FeatureIdTextureAccessor;\n};\n\n/**\n * A description of how to access property values from the color channels of a texture.\n * Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#featureidtexturefeatureids\n * JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/textureAccessor.schema.json\n */\nexport type GLTF_EXT_feature_metadata_FeatureIdTextureAccessor = {\n /** gLTF textureInfo object - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/specification/2.0/schema/textureInfo.schema.json */\n texture: GLTFTextureInfo;\n /** Must be a single channel (\"r\", \"g\", \"b\", or \"a\") */\n channels: 'r' | 'g' | 'b' | 'a';\n};\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"gltf-ext-mesh-features-schema.js","names":[],"sources":["../../../../src/lib/types/gltf-ext-mesh-features-schema.ts"],"sourcesContent":["import {GLTFTextureInfoMetadata} from './gltf-json-schema';\n/* eslint-disable camelcase */\n\n/**\n * EXT_mesh_features extension types\n * This is a primitive-level extension.\n * An object describing feature IDs for a mesh primitive.\n * @see https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features\n * or https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/mesh.primitive.EXT_mesh_features.schema.json\n */\nexport type GLTF_EXT_mesh_features = {\n /** An array of feature ID sets. */\n featureIds: GLTF_EXT_mesh_features_featureId[];\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * Feature IDs stored in an attribute or texture.\n * @see https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/featureId.schema.json\n */\nexport type GLTF_EXT_mesh_features_featureId = {\n /** The number of unique features in the attribute or texture. */\n featureCount: number;\n /** A value that indicates that no feature is associated with this vertex or texel. */\n nullFeatureId?: number;\n /** A label assigned to this feature ID set. Labels must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`. */\n label?: string;\n /**\n * An attribute containing feature IDs.\n * When `attribute` and `texture` are omitted the feature IDs are assigned to vertices by their index.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features/schema/featureIdAttribute.schema.json\n * An integer value used to construct a string in the format `_FEATURE_ID_<set index>` which is a reference to a key in `mesh.primitives.attributes`\n * (e.g. a value of `0` corresponds to `_FEATURE_ID_0`).\n */\n attribute?: number;\n /** A texture containing feature IDs. */\n texture?: GLTFTextureInfoMetadata;\n /** The index of the property table containing per-feature property values. Only applicable when using the `EXT_structural_metadata` extension. */\n propertyTable?: number;\n extensions?: Record<string, unknown>;\n extras?: unknown;\n\n /** This is not part of the spec. GLTFLoader loads feature tables data into this property */\n data?: unknown;\n};\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"gltf-ext-structural-metadata-schema.js","names":[],"sources":["../../../../src/lib/types/gltf-ext-structural-metadata-schema.ts"],"sourcesContent":["import {GLTFTextureInfoMetadata} from './gltf-json-schema';\n\n/* eslint-disable camelcase */\n\n/**\n * glTF extension that provides structural metadata about vertices, texels, and features in a glTF asset.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/glTF.EXT_structural_metadata.schema.json\n */\nexport type GLTF_EXT_structural_metadata_GLTF = {\n /** An object defining classes and enums. */\n schema?: GLTF_EXT_structural_metadata_Schema;\n /** A uri to an external schema file. */\n schemaUri?: string;\n /** An array of property table definitions, which may be referenced by index. */\n propertyTables?: GLTF_EXT_structural_metadata_PropertyTable[];\n /** An array of property texture definitions, which may be referenced by index. */\n propertyTextures?: GLTF_EXT_structural_metadata_PropertyTexture[];\n /** \"An array of property attribute definitions, which may be referenced by index. */\n propertyAttributes?: GLTF_EXT_structural_metadata_PropertyAttribute[];\n /** This is not part of the spec. GLTFLoader loads names of attributes crated into this property */\n dataAttributeNames?: string[];\n};\n\n/**\n * An object defining classes and enums.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/schema.schema.json\n */\nexport type GLTF_EXT_structural_metadata_Schema = {\n /** Unique identifier for the schema. Schema IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`. */\n id: string;\n /** The name of the schema. */\n name?: string;\n /** The description of the schema. */\n description?: string;\n /** Application-specific version of the schema. */\n version?: string;\n /** A dictionary, where each key is a class ID and each value is an object defining the class. */\n classes?: {\n [key: string]: GLTF_EXT_structural_metadata_Class;\n };\n /** A dictionary, where each key is an enum ID and each value is an object defining the values for the enum. */\n enums?: {\n [key: string]: GLTF_EXT_structural_metadata_Enum;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * An object defining the values of an enum.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/enum.schema.json\n */\nexport type GLTF_EXT_structural_metadata_Enum = {\n /** The name of the enum, e.g. for display purposes. */\n name?: string;\n /** The description of the enum. */\n description?: string;\n /**\n * The type of the integer enum value.\n * Default value is 'UINT16'\n */\n valueType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64';\n /** An array of enum values. Duplicate names or duplicate integer values are not allowed. */\n values: GLTF_EXT_structural_metadata_EnumValue[];\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * An enum value.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/enum.value.schema.json\n */\nexport type GLTF_EXT_structural_metadata_EnumValue = {\n /** The name of the enum value. */\n name: string;\n /** The description of the enum value. */\n description?: string;\n /** The integer enum value. */\n value: number;\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * A class containing a set of properties.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/class.schema.json\n */\nexport type GLTF_EXT_structural_metadata_Class = {\n /** The name of the class, e.g. for display purposes. */\n name?: string;\n /** The description of the class. */\n description?: string;\n /**\n * A dictionary, where each key is a property ID and each value is an object defining the property.\n * Property IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.\n */\n properties: {\n [key: string]: GLTF_EXT_structural_metadata_ClassProperty;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * A class property.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/class.property.schema.json\n */\nexport type GLTF_EXT_structural_metadata_ClassProperty = {\n /** The name of the property, e.g. for display purposes. */\n name?: string;\n\n /** The description of the property. */\n description?: string;\n\n /** The element type. */\n type:\n | 'SCALAR'\n | 'VEC2'\n | 'VEC3'\n | 'VEC4'\n | 'MAT2'\n | 'MAT3'\n | 'MAT4'\n | 'BOOLEAN'\n | 'STRING'\n | 'ENUM'\n | string;\n\n /** The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types. */\n componentType?:\n | 'INT8'\n | 'UINT8'\n | 'INT16'\n | 'UINT16'\n | 'INT32'\n | 'UINT32'\n | 'INT64'\n | 'UINT64'\n | 'FLOAT32'\n | 'FLOAT64'\n | string;\n\n /** Enum ID as declared in the `enums` dictionary. Required when `type` is `ENUM`. */\n enumType?: string;\n\n /**\n * Whether the property is an array.\n * When `count` is defined the property is a fixed-length array. Otherwise the property is a variable-length array.\n */\n array?: boolean;\n\n /** The number of array elements. May only be defined when `array` is true. */\n count?: number;\n\n /**\n * Specifies whether integer values are normalized.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types with integer component types.\n * For unsigned integer component types, values are normalized between `[0.0, 1.0]`.\n * For signed integer component types, values are normalized between `[-1.0, 1.0]`.\n * For all other component types, this property must be false.\n */\n normalized?: boolean;\n\n /**\n * An offset to apply to property values.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.\n */\n offset?: number | number[];\n\n /**\n * A scale to apply to property values.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.\n */\n scale?: number | number[];\n\n /**\n * Maximum allowed value for the property.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n * This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.\n */\n max?: number | number[];\n\n /**\n * Minimum allowed value for the property.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n * This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.\n */\n min?: number | number[];\n\n default?: boolean | number | string | number[];\n /**\n * If required, the property must be present in every entity conforming to the class.\n * If not required, individual entities may include `noData` values, or the entire property may be omitted.\n * As a result, `noData` has no effect on a required property.\n * Client implementations may use required properties to make performance optimizations.\n * Default value is false.\n */\n required?: boolean;\n\n /**\n * A `noData` value represents missing data — also known as a sentinel value — wherever it appears.\n * `BOOLEAN` properties may not specify `noData` values.\n * This is given as the plain property value, without the transforms from the `normalized`, `offset`, and `scale` properties.\n * Must not be defined if `required` is true.\n */\n noData?: number | string | number[] | string[];\n\n /**\n * An identifier that describes how this property should be interpreted.\n * The semantic cannot be used by other properties in the class.\n */\n semantic?: string;\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * Properties conforming to a class, organized as property values stored in binary columnar arrays.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.schema.json\n */\nexport type GLTF_EXT_structural_metadata_PropertyTable = {\n /** The name of the property table, e.g. for display purposes. */\n name?: string;\n /** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */\n class: string;\n /** The number of elements in each property array. */\n count: number;\n /**\n * A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary\n * and each value is an object describing where property values are stored.\n * Required properties must be included in this dictionary.\n */\n properties?: {\n [key: string]: GLTF_EXT_structural_metadata_PropertyTable_Property;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * An array of binary property values.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json\n */\nexport type GLTF_EXT_structural_metadata_PropertyTable_Property = {\n /**\n * The index of the buffer view containing property values.\n * The data type of property values is determined by the property definition:\n * When `type` is `BOOLEAN` values are packed into a bitstream.\n * When `type` is `STRING` values are stored as byte sequences and decoded as UTF-8 strings.\n * When `type` is `SCALAR`, `VECN`, or `MATN` the values are stored as the provided `componentType`\n * and the buffer view `byteOffset` must be aligned to a multiple of the `componentType` size.\n * When `type` is `ENUM` values are stored as the enum's `valueType`\n * and the buffer view `byteOffset` must be aligned to a multiple of the `valueType` size.\n * Each enum value in the array must match one of the allowed values in the enum definition.\n * `arrayOffsets` is required for variable-length arrays and `stringOffsets` is required for strings (for variable-length arrays of strings, both are required).\n */\n values: number;\n /**\n * The index of the buffer view containing offsets for variable-length arrays.\n * The number of offsets is equal to the property table `count` plus one.\n * The offsets represent the start positions of each array, with the last offset representing the position after the last array.\n * The array length is computed using the difference between the subsequent offset and the current offset.\n * If `type` is `STRING` the offsets index into the string offsets array (stored in `stringOffsets`), otherwise they index into the property array (stored in `values`).\n * The data type of these offsets is determined by `arrayOffsetType`.\n * The buffer view `byteOffset` must be aligned to a multiple of the `arrayOffsetType` size.\n */\n arrayOffsets?: number;\n /**\n * The index of the buffer view containing offsets for strings.\n * The number of offsets is equal to the number of string elements plus one.\n * The offsets represent the byte offsets of each string in the property array (stored in `values`), with the last offset representing the byte offset after the last string.\n * The string byte length is computed using the difference between the subsequent offset and the current offset.\n * The data type of these offsets is determined by `stringOffsetType`.\n * The buffer view `byteOffset` must be aligned to a multiple of the `stringOffsetType` size.\n */\n stringOffsets?: number;\n /**\n * The type of values in `arrayOffsets`.\n * Default value is 'UINT32'\n */\n arrayOffsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string;\n\n /**\n * The type of values in `stringOffsets`.\n * Default value is 'UINT32'\n */\n stringOffsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string;\n /**\n * An offset to apply to property values.\n * Only applicable when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.\n * Overrides the class property's `offset` if both are defined.\n */\n offset?: number | number[];\n /**\n * A scale to apply to property values.\n * Only applicable when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.\n * Overrides the class property's `scale` if both are defined.\n */\n scale?: number | number[];\n /**\n * Maximum value present in the property values.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n * This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.\n */\n max?: number | number[];\n /**\n * Minimum value present in the property values.\n * Only applicable to `SCALAR`, `VECN`, and `MATN` types.\n * This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.\n */\n min?: number | number[];\n extensions?: Record<string, unknown>;\n extras?: unknown;\n /** This is not part of the spec. GLTFLoader loads feature tables data into this property */\n data?: unknown;\n};\n\n/**\n * Properties conforming to a class, organized as property values stored in textures.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTexture.schema.json\n */\nexport type GLTF_EXT_structural_metadata_PropertyTexture = {\n /** The name of the property texture, e.g. for display purposes. */\n name?: string;\n /** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */\n class: string;\n /**\n * A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary\n * and each value is an object describing where property values are stored.\n * Required properties must be included in this dictionary.\n *\n * https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata\n * Each property that is defined in the propertyTexture object extends the glTF textureInfo object.\n * The texCoord specifies a texture coordinate set in the referring primitive.\n * The index is the index of the glTF texture object that stores the actual data. Additionally,\n * each property specifies an array of channels, which are the indices of the texture channels providing data for the respective property.\n * Channels of an RGBA texture are numbered 0..3 respectively.\n */\n properties?: {\n [key: string]: GLTFTextureInfoMetadata;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * Properties conforming to a class, organized as property values stored in attributes.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyAttribute.schema.json\n */\nexport type GLTF_EXT_structural_metadata_PropertyAttribute = {\n /** The name of the property attribute, e.g. for display purposes. */\n name?: string;\n /** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */\n class: string;\n /**\n * \"A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary\n * and each value is an object describing where property values are stored.\n * Required properties must be included in this dictionary.\n */\n properties?: {\n [key: string]: unknown;\n };\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n\n/**\n * Structural metadata about a glTF primitive.\n * @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/mesh.primitive.EXT_structural_metadata.schema.json\n */\nexport type GLTF_EXT_structural_metadata_Primitive = {\n /** An array of indexes of property textures in the root `EXT_structural_metadata` object. */\n propertyTextures?: number[];\n /** An array of indexes of property attributes in the root `EXT_structural_metadata` object. */\n propertyAttributes?: number[];\n extensions?: Record<string, unknown>;\n extras?: unknown;\n};\n"],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"gltf-json-schema.js","names":[],"sources":["../../../../src/lib/types/gltf-json-schema.ts"],"sourcesContent":["// Types forked from https://github.com/bwasty/gltf-loader-ts under MIT license\n// Generated from official JSON schema using `npm run generate-interface` on 2018-02-24\n\nexport type GLTFId = number;\n\n/**\n * Indices of those attributes that deviate from their initialization value.\n */\nexport type GLTFAccessorSparseIndices = {\n /**\n * The index of the bufferView with sparse indices. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.\n */\n bufferView: GLTFId;\n /**\n * The offset relative to the start of the bufferView in bytes. Must be aligned.\n */\n byteOffset?: number;\n /**\n * The indices data type.\n */\n componentType: 5121 | 5123 | 5125 | number;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Array of size `accessor.sparse.count` times number of components storing the displaced accessor attributes pointed by `accessor.sparse.indices`.\n */\nexport type GLTFAccessorSparseValues = {\n /**\n * The index of the bufferView with sparse values. Referenced bufferView can't have ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target.\n */\n bufferView: GLTFId;\n /**\n * The offset relative to the start of the bufferView in bytes. Must be aligned.\n */\n byteOffset?: number;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Sparse storage of attributes that deviate from their initialization value.\n */\nexport type GLTFAccessorSparse = {\n /**\n * Number of entries stored in the sparse array.\n */\n count: number;\n /**\n * Index array of size `count` that points to those accessor attributes that deviate from their initialization value. Indices must strictly increase.\n */\n indices: GLTFAccessorSparseIndices;\n /**\n * Array of size `count` times number of components, storing the displaced accessor attributes pointed by `indices`. Substituted values must have the same `componentType` and number of components as the base accessor.\n */\n values: GLTFAccessorSparseValues;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A typed view into a bufferView. A bufferView contains raw binary data. An accessor provides a typed view into a bufferView or a subset of a bufferView similar to how WebGL's `vertexAttribPointer()` defines an attribute in a buffer.\n */\nexport type GLTFAccessor = {\n /**\n * The index of the bufferView.\n */\n bufferView?: GLTFId;\n /**\n * The offset relative to the start of the bufferView in bytes.\n */\n byteOffset?: number;\n /**\n * The datatype of components in the attribute.\n */\n componentType: 5120 | 5121 | 5122 | 5123 | 5125 | 5126 | number;\n /**\n * Specifies whether integer data values should be normalized.\n */\n normalized?: boolean;\n /**\n * The number of attributes referenced by this accessor.\n */\n count: number;\n /**\n * Specifies if the attribute is a scalar, vector, or matrix.\n */\n type: 'SCALAR' | 'VEC2' | 'VEC3' | 'VEC4' | 'MAT2' | 'MAT3' | 'MAT4' | string;\n /**\n * Maximum value of each component in this attribute.\n */\n max?: number[];\n /**\n * Minimum value of each component in this attribute.\n */\n min?: number[];\n /**\n * Sparse storage of attributes that deviate from their initialization value.\n */\n sparse?: GLTFAccessorSparse;\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * The index of the node and TRS property that an animation channel targets.\n */\nexport type GLTFAnimationChannelTarget = {\n /**\n * The index of the node to target.\n */\n node?: GLTFId;\n /**\n * The name of the node's TRS property to modify, or the \"weights\" of the Morph Targets it instantiates. For the \"translation\" property, the values that are provided by the sampler are the translation along the x, y, and z axes. For the \"rotation\" property, the values are a quaternion in the order (x, y, z, w), where w is the scalar. For the \"scale\" property, the values are the scaling factors along the x, y, and z axes.\n */\n path: 'translation' | 'rotation' | 'scale' | 'weights' | string;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Targets an animation's sampler at a node's property.\n */\nexport type GLTFAnimationChannel = {\n /**\n * The index of a sampler in this animation used to compute the value for the target.\n */\n sampler: GLTFId;\n /**\n * The index of the node and TRS property to target.\n */\n target: GLTFAnimationChannelTarget;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).\n */\nexport type GLTFAnimationSampler = {\n /**\n * The index of an accessor containing keyframe input values, e.g., time.\n */\n input: GLTFId;\n /**\n * Interpolation algorithm.\n */\n interpolation?: 'LINEAR' | 'STEP' | 'CUBICSPLINE' | string;\n /**\n * The index of an accessor, containing keyframe output values.\n */\n output: GLTFId;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A keyframe animation.\n */\nexport type GLTFAnimation = {\n /**\n * An array of channels, each of which targets an animation's sampler at a node's property. Different channels of the same animation can't have equal targets.\n */\n channels: GLTFAnimationChannel[];\n /**\n * An array of samplers that combines input and output accessors with an interpolation algorithm to define a keyframe graph (but not its target).\n */\n samplers: GLTFAnimationSampler[];\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Metadata about the glTF asset.\n */\nexport type GLTFAsset = {\n /**\n * A copyright message suitable for display to credit the content creator.\n */\n copyright?: string;\n /**\n * Tool that generated this glTF model. Useful for debugging.\n */\n generator?: string;\n /**\n * The glTF version that this asset targets.\n */\n version: string;\n /**\n * The minimum glTF version that this asset targets.\n */\n minVersion?: string;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A buffer points to binary geometry, animation, or skins.\n */\nexport type GLTFBuffer = {\n /**\n * The uri of the buffer.\n */\n uri?: string;\n /**\n * The length of the buffer in bytes.\n */\n byteLength: number;\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A view into a buffer generally representing a subset of the buffer.\n */\nexport type GLTFBufferView = {\n /**\n * The index of the buffer.\n */\n buffer: GLTFId;\n /**\n * The offset into the buffer in bytes.\n */\n byteOffset?: number;\n /**\n * The length of the bufferView in bytes.\n */\n byteLength: number;\n /**\n * The stride, in bytes.\n */\n byteStride?: number;\n /**\n * The target that the GPU buffer should be bound to.\n */\n target?: 34962 | 34963 | number;\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * An orthographic camera containing properties to create an orthographic projection matrix.\n */\nexport type GLTFCameraOrthographic = {\n /**\n * The floating-point horizontal magnification of the view. Must not be zero.\n */\n xmag: number;\n /**\n * The floating-point vertical magnification of the view. Must not be zero.\n */\n ymag: number;\n /**\n * The floating-point distance to the far clipping plane. `zfar` must be greater than `znear`.\n */\n zfar: number;\n /**\n * The floating-point distance to the near clipping plane.\n */\n znear: number;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A perspective camera containing properties to create a perspective projection matrix.\n */\nexport type GLTFCameraPerspective = {\n /**\n * The floating-point aspect ratio of the field of view.\n */\n aspectRatio?: number;\n /**\n * The floating-point vertical field of view in radians.\n */\n yfov: number;\n /**\n * The floating-point distance to the far clipping plane.\n */\n zfar?: number;\n /**\n * The floating-point distance to the near clipping plane.\n */\n znear: number;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A camera's projection. A node can reference a camera to apply a transform to place the camera in the scene.\n */\nexport type GLTFCamera = {\n /**\n * An orthographic camera containing properties to create an orthographic projection matrix.\n */\n orthographic?: GLTFCameraOrthographic;\n /**\n * A perspective camera containing properties to create a perspective projection matrix.\n */\n perspective?: GLTFCameraPerspective;\n /**\n * Specifies if the camera uses a perspective or orthographic projection.\n */\n type: 'perspective' | 'orthographic' | string;\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Image data used to create a texture. Image can be referenced by URI or `bufferView` index. `mimeType` is required in the latter case.\n */\nexport type GLTFImage = {\n /**\n * The uri of the image.\n */\n uri?: string;\n /**\n * The image's MIME type.\n */\n mimeType?: 'image/jpeg' | 'image/png' | string;\n /**\n * The index of the bufferView that contains the image. Use this instead of the image's uri property.\n */\n bufferView?: GLTFId;\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Reference to a texture.\n */\nexport type GLTFTextureInfo = {\n /**\n * The index of the texture.\n */\n index: GLTFId;\n /**\n * The set index of texture's TEXCOORD attribute used for texture coordinate mapping.\n */\n texCoord?: number;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Extended GLTFTextureInfo that is used in EXT_structural_metadata and EXT_mesh_features\n * https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata\n * https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features\n */\nexport type GLTFTextureInfoMetadata = GLTFTextureInfo & {\n channels: number[] | string;\n /** For internal usage */\n data?: unknown;\n};\n\n/**\n * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.\n */\nexport type GLTFMaterialPbrMetallicRoughness = {\n /**\n * The material's base color factor.\n */\n baseColorFactor?: number[];\n /**\n * The base color texture.\n */\n baseColorTexture?: GLTFTextureInfo;\n /**\n * The metalness of the material.\n */\n metallicFactor?: number;\n /**\n * The roughness of the material.\n */\n roughnessFactor?: number;\n /**\n * The metallic-roughness texture.\n */\n metallicRoughnessTexture?: GLTFTextureInfo;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\nexport type GLTFMaterialNormalTextureInfo = {\n index: any;\n texCoord?: any;\n /**\n * The scalar multiplier applied to each normal vector of the normal texture.\n */\n scale?: number;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\nexport type GLTFMaterialOcclusionTextureInfo = {\n index: any;\n texCoord?: any;\n /**\n * A scalar multiplier controlling the amount of occlusion applied.\n */\n strength?: number;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * The material appearance of a primitive.\n */\nexport type GLTFMaterial = {\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n /**\n * A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology. When not specified, all the default values of `pbrMetallicRoughness` apply.\n */\n pbrMetallicRoughness?: GLTFMaterialPbrMetallicRoughness;\n /**\n * The normal map texture.\n */\n normalTexture?: GLTFMaterialNormalTextureInfo;\n /**\n * The occlusion map texture.\n */\n occlusionTexture?: GLTFMaterialOcclusionTextureInfo;\n /**\n * The emissive map texture.\n */\n emissiveTexture?: GLTFTextureInfo;\n /**\n * The emissive color of the material.\n */\n emissiveFactor?: number[];\n /**\n * The alpha rendering mode of the material.\n */\n alphaMode?: 'OPAQUE' | 'MASK' | 'BLEND' | string;\n /**\n * The alpha cutoff value of the material.\n */\n alphaCutoff?: number;\n /**\n * Specifies whether the material is double sided.\n */\n doubleSided?: boolean;\n // [k: string]: any;\n};\n\n/**\n * Geometry to be rendered with the given material.\n */\nexport type GLTFMeshPrimitive = {\n /**\n * A dictionary object, where each key corresponds to mesh attribute semantic and each value is the index of the accessor containing attribute's data.\n */\n attributes: {\n [k: string]: GLTFId;\n };\n /**\n * The index of the accessor that contains the indices.\n */\n indices?: GLTFId;\n /**\n * The index of the material to apply to this primitive when rendering.\n */\n material?: GLTFId;\n /**\n * The type of primitives to render.\n */\n mode?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | number;\n /**\n * An array of Morph Targets, each Morph Target is a dictionary mapping attributes (only `POSITION`, `NORMAL`, and `TANGENT` supported) to their deviations in the Morph Target.\n */\n targets?: {\n [k: string]: GLTFId;\n }[];\n extensions?: Record<string, unknown>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A set of primitives to be rendered. A node can contain one mesh. A node's transform places the mesh in the scene.\n */\n\nexport type GLTFMesh = {\n id?: string;\n /**\n * An array of primitives, each defining geometry to be rendered with a material.\n */\n primitives: GLTFMeshPrimitive[];\n /**\n * Array of weights to be applied to the Morph Targets.\n */\n weights?: number[];\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A node in the node hierarchy. When the node contains `skin`, all `mesh.primitives` must contain `JOINTS_0` and `WEIGHTS_0` attributes. A node can have either a `matrix` or any combination of `translation`/`rotation`/`scale` (TRS) properties. TRS properties are converted to matrices and postmultiplied in the `T * R * S` order to compose the transformation matrix; first the scale is applied to the vertices, then the rotation, and then the translation. If none are provided, the transform is the identity. When a node is targeted for animation (referenced by an animation.channel.target), only TRS properties may be present; `matrix` will not be present.\n */\nexport type GLTFNode = {\n /**\n * The index of the camera referenced by this node.\n */\n camera?: GLTFId;\n /**\n * The indices of this node's children.\n */\n children?: GLTFId[];\n /**\n * The index of the skin referenced by this node.\n */\n skin?: GLTFId;\n /**\n * A floating-point 4x4 transformation matrix stored in column-major order.\n */\n matrix?: number[];\n /**\n * The index of the mesh in this node.\n */\n mesh?: GLTFId;\n /**\n * The node's unit quaternion rotation in the order (x, y, z, w), where w is the scalar.\n */\n rotation?: number[];\n /**\n * The node's non-uniform scale, given as the scaling factors along the x, y, and z axes.\n */\n scale?: number[];\n /**\n * The node's translation along the x, y, and z axes.\n */\n translation?: number[];\n /**\n * The weights of the instantiated Morph Target. Number of elements must match number of Morph Targets of used mesh.\n */\n weights?: number[];\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Texture sampler properties for filtering and wrapping modes.\n */\nexport type GLTFSampler = {\n /**\n * Magnification filter.\n */\n magFilter?: 9728 | 9729 | number;\n /**\n * Minification filter.\n */\n minFilter?: 9728 | 9729 | 9984 | 9985 | 9986 | 9987 | number;\n /**\n * s wrapping mode.\n */\n wrapS?: 33071 | 33648 | 10497 | number;\n /**\n * t wrapping mode.\n */\n wrapT?: 33071 | 33648 | 10497 | number;\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * The root nodes of a scene.\n */\nexport type GLTFScene = {\n /**\n * The indices of each root node.\n */\n nodes?: GLTFId[];\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * Joints and matrices defining a skin.\n */\nexport type GLTFSkin = {\n id?: string;\n /**\n * The index of the accessor containing the floating-point 4x4 inverse-bind matrices. The default is that each matrix is a 4x4 identity matrix, which implies that inverse-bind matrices were pre-applied.\n */\n inverseBindMatrices?: GLTFId;\n /**\n * The index of the node used as a skeleton root. When undefined, joints transforms resolve to scene root.\n */\n skeleton?: GLTFId;\n /** Indices of skeleton nodes, used as joints in this skin. */\n joints: GLTFId[];\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * A texture and its sampler.\n */\nexport type GLTFTexture = {\n /** The index of the sampler used by this texture. When undefined, a sampler with repeat wrapping and auto filtering should be used. */\n sampler?: GLTFId;\n /** The index of the image used by this texture. */\n source?: GLTFId;\n name?: any;\n extensions?: Record<string, any>;\n extras?: any;\n // [k: string]: any;\n};\n\n/**\n * The root object for a glTF asset.\n */\nexport type GLTF = {\n /**\n * Names of glTF extensions used somewhere in this asset.\n */\n extensionsUsed?: string[];\n /**\n * Names of glTF extensions required to properly load this asset.\n */\n extensionsRequired?: string[];\n /**\n * An array of accessors.\n */\n accessors?: GLTFAccessor[];\n /**\n * An array of keyframe animations.\n */\n animations?: GLTFAnimation[];\n /**\n * Metadata about the glTF asset.\n */\n asset: GLTFAsset;\n /**\n * An array of buffers.\n */\n buffers?: GLTFBuffer[];\n /**\n * An array of bufferViews.\n */\n bufferViews?: GLTFBufferView[];\n /**\n * An array of cameras.\n */\n cameras?: GLTFCamera[];\n /**\n * An array of images.\n */\n images?: GLTFImage[];\n /**\n * An array of materials.\n */\n materials?: GLTFMaterial[];\n /**\n * An array of meshes.\n */\n meshes?: GLTFMesh[];\n /**\n * An array of nodes.\n */\n nodes?: GLTFNode[];\n /**\n * An array of samplers.\n */\n samplers?: GLTFSampler[];\n /**\n * The index of the default scene.\n */\n scene?: GLTFId;\n /**\n * An array of scenes.\n */\n scenes?: GLTFScene[];\n /**\n * An array of skins.\n */\n skins?: GLTFSkin[];\n /**\n * An array of textures.\n */\n textures?: GLTFTexture[];\n extensions?: Record<string, unknown>;\n extras?: unknown;\n [k: string]: unknown;\n};\n\nexport type GLTFObject =\n | GLTFAccessor\n | GLTFBuffer\n | GLTFBufferView\n | GLTFMeshPrimitive\n | GLTFMesh\n | GLTFNode\n | GLTFMaterial\n | GLTFSampler\n | GLTFScene\n | GLTFSkin\n | GLTFTexture\n | GLTFImage;\n\n// GLTF Extensions\n/* eslint-disable camelcase */\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/1.0/Khronos/KHR_binary_glTF\n * TODO - this can be used on both images and shaders\n */\nexport type GLTF_KHR_binary_glTF = {\n bufferView: number;\n // required for images but not shaders\n mimeType?: string;\n height?: number;\n width?: number;\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression\n */\nexport type GLTF_KHR_draco_mesh_compression = {\n bufferView: GLTFId;\n attributes: {[name: string]: number};\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_texture_basisu\n */\nexport type GLTF_KHR_texture_basisu = {\n source: GLTFId;\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_meshopt_compression\n * buffer: number; //\tThe index of the buffer with compressed data.\t✅ Required\n * byteOffset\tinteger\tThe offset into the buffer in bytes.\tDefault: 0\n * byteLength\tinteger\tThe length of the compressed data in bytes.\t✅ Required\n * byteStride\tinteger\tThe stride, in bytes.\t✅ Required\n * count\tinteger\tThe number of elements.\t✅ Required\n * mode\tstring\tThe compression mode.\t✅ Required\n * filter\tstring\tThe compression filter.\tDefault: \"NONE\"\n */\nexport type GLTF_EXT_meshopt_compression = {\n buffer: number;\n byteOffset?: number;\n byteLength: number;\n byteStride: number;\n count: number;\n mode: 'ATTRIBUTES' | 'TRIANGLES' | 'INDICES';\n filter?: 'NONE' | 'OCTAHEDRAL' | 'QUATERNION' | 'EXPONENTIAL';\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/EXT_texture_webp\n */\nexport type GLTF_EXT_texture_webp = {\n source: GLTFId;\n extras?: any;\n};\n\n/**\n * @see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds\n */\nexport type GLTF_MSFT_texture_dds = {\n source: GLTFId;\n extras?: any;\n};\n"],"mappings":""}