@woosh/meep-engine 3.14.2 → 3.14.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 (1252) hide show
  1. package/editor/prototypeEditorShell.js +6 -0
  2. package/package.json +1 -1
  3. package/src/CODEC_LAYOUT_VERIFICATION.md +420 -0
  4. package/src/core/binary/zstd/ZstdReverseBitReader.d.ts +76 -0
  5. package/src/core/binary/zstd/ZstdReverseBitReader.d.ts.map +1 -0
  6. package/src/core/binary/zstd/ZstdReverseBitReader.js +223 -0
  7. package/src/core/binary/zstd/zstd_decompress.d.ts +31 -0
  8. package/src/core/binary/zstd/zstd_decompress.d.ts.map +1 -0
  9. package/src/core/binary/zstd/zstd_decompress.js +628 -0
  10. package/src/core/binary/zstd/zstd_fse.d.ts +83 -0
  11. package/src/core/binary/zstd/zstd_fse.d.ts.map +1 -0
  12. package/src/core/binary/zstd/zstd_fse.js +265 -0
  13. package/src/core/binary/zstd/zstd_huffman.d.ts +56 -0
  14. package/src/core/binary/zstd/zstd_huffman.d.ts.map +1 -0
  15. package/src/core/binary/zstd/zstd_huffman.js +244 -0
  16. package/src/core/binary/zstd/zstd_sequence_tables.d.ts +62 -0
  17. package/src/core/binary/zstd/zstd_sequence_tables.d.ts.map +1 -0
  18. package/src/core/binary/zstd/zstd_sequence_tables.js +98 -0
  19. package/src/core/color/COLOR_REVIEW_2026_08_28.md +1 -1
  20. package/src/core/color/PQ/PQ_constants.d.ts +1 -1
  21. package/src/core/color/PQ/PQ_constants.js +1 -1
  22. package/src/engine/Engine.d.ts.map +1 -1
  23. package/src/engine/Engine.js +733 -726
  24. package/src/engine/asset/GameAssetType.d.ts +1 -0
  25. package/src/engine/asset/GameAssetType.js +8 -0
  26. package/src/engine/asset/codec/DecodedImage.d.ts +39 -0
  27. package/src/engine/asset/codec/DecodedImage.d.ts.map +1 -0
  28. package/src/engine/asset/codec/DecodedImage.js +26 -0
  29. package/src/engine/asset/guessAssetType.d.ts.map +1 -1
  30. package/src/engine/asset/guessAssetType.js +10 -0
  31. package/src/engine/asset/load_model_scene_bundle.d.ts +1 -1
  32. package/src/engine/asset/load_model_scene_bundle.d.ts.map +1 -1
  33. package/src/engine/asset/load_model_scene_bundle.js +6 -2
  34. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.d.ts +37 -0
  35. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.d.ts.map +1 -0
  36. package/src/engine/asset/loaders/USDSceneBundleAssetLoader.js +104 -0
  37. package/src/engine/asset/loaders/image/IMAGE_CODEC_REVIEW_2026_08_28.md +83 -71
  38. package/src/engine/asset/loaders/image/ImageDecoderWorker.js +2 -2
  39. package/src/engine/asset/loaders/image/ImageRGBADataLoader.d.ts +8 -9
  40. package/src/engine/asset/loaders/image/ImageRGBADataLoader.d.ts.map +1 -1
  41. package/src/engine/asset/loaders/image/ImageRGBADataLoader.js +12 -3
  42. package/src/engine/asset/loaders/image/avif/encode_image_source.d.ts +70 -0
  43. package/src/engine/asset/loaders/image/avif/encode_image_source.d.ts.map +1 -0
  44. package/src/engine/asset/loaders/image/avif/encode_image_source.js +117 -0
  45. package/src/engine/asset/loaders/image/avif/encoder_worker.d.ts.map +1 -0
  46. package/src/engine/asset/loaders/image/avif/threaded_image_encoder.d.ts.map +1 -0
  47. package/src/engine/asset/loaders/image/codec/AvifCodec.d.ts +34 -0
  48. package/src/engine/asset/loaders/image/codec/AvifCodec.d.ts.map +1 -0
  49. package/src/engine/asset/loaders/image/codec/AvifCodec.js +85 -0
  50. package/src/engine/asset/loaders/image/codec/JpegCodec.d.ts +26 -0
  51. package/src/engine/asset/loaders/image/codec/JpegCodec.d.ts.map +1 -0
  52. package/src/engine/asset/loaders/image/codec/JpegCodec.js +66 -0
  53. package/src/engine/asset/loaders/image/codec/NativeImageDecoder.d.ts +4 -16
  54. package/src/engine/asset/loaders/image/codec/NativeImageDecoder.d.ts.map +1 -1
  55. package/src/engine/asset/loaders/image/codec/NativeImageDecoder.js +2 -2
  56. package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.d.ts +21 -1
  57. package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.d.ts.map +1 -1
  58. package/src/engine/asset/loaders/image/codec/ThreadedImageDecoder.js +21 -1
  59. package/src/engine/asset/loaders/image/prototypePNG.d.ts.map +1 -0
  60. package/src/engine/asset/loaders/image/prototypePNG.js +37 -0
  61. package/src/engine/asset/preloader/extractAssetListFromManager.d.ts.map +1 -1
  62. package/src/engine/asset/preloader/extractAssetListFromManager.js +2 -1
  63. package/src/engine/graphics/ecs/mesh/assetTypeByPath.d.ts.map +1 -1
  64. package/src/engine/graphics/ecs/mesh/assetTypeByPath.js +6 -0
  65. package/src/engine/graphics/texture/sampler/avif_to_sampler2d.d.ts +25 -0
  66. package/src/engine/graphics/texture/sampler/avif_to_sampler2d.d.ts.map +1 -0
  67. package/src/engine/graphics/texture/sampler/avif_to_sampler2d.js +42 -0
  68. package/src/engine/graphics/texture/sampler/compare/sampler2d_compare.d.ts.map +1 -0
  69. package/src/engine/graphics/texture/sampler/compare/sampler2d_compare.js +94 -0
  70. package/src/engine/graphics/texture/sampler/compare/sampler2d_max_absolute_difference.d.ts +19 -0
  71. package/src/engine/graphics/texture/sampler/compare/sampler2d_max_absolute_difference.d.ts.map +1 -0
  72. package/src/engine/graphics/texture/sampler/compare/sampler2d_max_absolute_difference.js +62 -0
  73. package/src/engine/graphics/texture/sampler/compare/sampler2d_psnr.d.ts +30 -0
  74. package/src/engine/graphics/texture/sampler/compare/sampler2d_psnr.d.ts.map +1 -0
  75. package/src/engine/graphics/texture/sampler/compare/sampler2d_psnr.js +115 -0
  76. package/src/engine/graphics/texture/sampler/sampler2d_to_avif.d.ts.map +1 -0
  77. package/src/engine/graphics/texture/sampler/sampler2d_to_avif.js +108 -0
  78. package/src/engine/graphics/texture/sampler/sampler2d_to_f16.d.ts +7 -1
  79. package/src/engine/graphics/texture/sampler/sampler2d_to_f16.d.ts.map +1 -1
  80. package/src/engine/graphics/texture/sampler/sampler2d_to_f16.js +28 -21
  81. package/src/engine/graphics/texture/sampler/sampler2d_to_uint8_RGBA.d.ts.map +1 -1
  82. package/src/engine/graphics/texture/sampler/sampler2d_to_uint8_RGBA.js +3 -0
  83. package/src/engine/network/NetworkSession.d.ts +24 -4
  84. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  85. package/src/engine/network/NetworkSession.js +28 -4
  86. package/src/engine/network/orchestrator/NetworkPeer.d.ts +47 -6
  87. package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
  88. package/src/engine/network/orchestrator/NetworkPeer.js +184 -56
  89. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +97 -11
  90. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  91. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +304 -22
  92. package/src/engine/network/replication/Replicator.d.ts +14 -1
  93. package/src/engine/network/replication/Replicator.d.ts.map +1 -1
  94. package/src/engine/network/replication/Replicator.js +44 -3
  95. package/src/engine/network/sim/ActionLog.d.ts +21 -3
  96. package/src/engine/network/sim/ActionLog.d.ts.map +1 -1
  97. package/src/engine/network/sim/ActionLog.js +24 -3
  98. package/src/engine/network/sim/SimAction.d.ts +15 -0
  99. package/src/engine/network/sim/SimAction.d.ts.map +1 -1
  100. package/src/engine/network/sim/SimAction.js +15 -0
  101. package/src/engine/network/sim/SimActionExecutor.d.ts +51 -1
  102. package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
  103. package/src/engine/network/sim/SimActionExecutor.js +73 -5
  104. package/src/engine/network/transport/Channel.d.ts +1 -1
  105. package/src/engine/network/transport/Channel.js +1 -1
  106. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  107. package/src/engine/simulation/Ticker.d.ts.map +1 -1
  108. package/src/engine/simulation/Ticker.js +4 -1
  109. package/src/engine/ui/GUIEngine.d.ts.map +1 -1
  110. package/src/engine/ui/GUIEngine.js +6 -0
  111. package/src/format/image/avif/DECISIONS.md +545 -0
  112. package/src/format/image/avif/api/AvifDecoder.d.ts.map +1 -0
  113. package/src/format/image/avif/api/apply_transformations.d.ts.map +1 -0
  114. package/src/format/image/avif/api/convert_to_rgba.d.ts.map +1 -0
  115. package/src/format/image/avif/api/convert_to_rgba.js +204 -0
  116. package/src/format/image/avif/api/decode_avif.d.ts.map +1 -0
  117. package/src/format/image/avif/api/decode_image_item.d.ts.map +1 -0
  118. package/src/format/image/avif/api/encode_avif.d.ts.map +1 -0
  119. package/src/format/image/avif/av1/decode/Av1FrameContext.d.ts.map +1 -0
  120. package/src/format/image/avif/av1/decode/block_decoded.d.ts.map +1 -0
  121. package/src/format/image/avif/av1/decode/decode_av1_still.d.ts.map +1 -0
  122. package/src/format/image/avif/av1/decode/decode_coefficients.d.ts.map +1 -0
  123. package/src/format/image/avif/av1/decode/decode_palette.d.ts.map +1 -0
  124. package/src/format/image/avif/av1/decode/decode_palette.js +442 -0
  125. package/src/format/image/avif/av1/decode/decode_tile.d.ts.map +1 -0
  126. package/src/format/image/avif/av1/decode/decode_tile.js +1213 -0
  127. package/src/format/image/avif/av1/decode/get_scan.d.ts.map +1 -0
  128. package/src/format/image/avif/av1/decode/read_lr.d.ts.map +1 -0
  129. package/src/format/image/avif/av1/decode/read_lr.js +277 -0
  130. package/src/format/image/avif/av1/decode/read_transform_type.d.ts.map +1 -0
  131. package/src/format/image/avif/av1/decode/read_transform_type.js +92 -0
  132. package/src/format/image/avif/av1/decode/reconstruct.d.ts.map +1 -0
  133. package/src/format/image/avif/av1/decode/reconstruct.js +241 -0
  134. package/src/format/image/avif/av1/decode/transform_type.d.ts.map +1 -0
  135. package/src/format/image/avif/av1/encode/Av1BlockSnapshot.d.ts.map +1 -0
  136. package/src/format/image/avif/av1/encode/Av1EncodeContext.d.ts.map +1 -0
  137. package/src/format/image/avif/av1/encode/build_headers.d.ts.map +1 -0
  138. package/src/format/image/avif/av1/encode/choose_chroma_alpha.d.ts.map +1 -0
  139. package/src/format/image/avif/av1/encode/choose_filters.d.ts.map +1 -0
  140. package/src/format/image/avif/av1/encode/choose_restoration.d.ts.map +1 -0
  141. package/src/format/image/avif/av1/encode/choose_restoration.js +616 -0
  142. package/src/format/image/avif/av1/encode/decode_effort.d.ts.map +1 -0
  143. package/src/format/image/avif/av1/encode/encode_av1_still.d.ts.map +1 -0
  144. package/src/format/image/avif/av1/encode/encode_effort.d.ts.map +1 -0
  145. package/src/format/image/avif/av1/encode/encode_tile.d.ts.map +1 -0
  146. package/src/format/image/avif/av1/encode/encode_tile.js +2331 -0
  147. package/src/format/image/avif/av1/encode/quantise.d.ts.map +1 -0
  148. package/src/format/image/avif/av1/encode/write_coefficients.d.ts.map +1 -0
  149. package/src/format/image/avif/av1/encode/write_lr.d.ts.map +1 -0
  150. package/src/format/image/avif/av1/encode/write_transform_type.d.ts.map +1 -0
  151. package/src/format/image/avif/av1/entropy/CdfContext.d.ts.map +1 -0
  152. package/src/format/image/avif/av1/entropy/SymbolReader.d.ts.map +1 -0
  153. package/src/format/image/avif/av1/entropy/SymbolWriter.d.ts.map +1 -0
  154. package/src/format/image/avif/av1/entropy/coefficient_context.d.ts.map +1 -0
  155. package/src/format/image/avif/av1/entropy/partition_cdf.d.ts.map +1 -0
  156. package/src/format/image/avif/av1/entropy/symbol_cost.d.ts.map +1 -0
  157. package/src/format/image/avif/av1/filter/cdef.d.ts.map +1 -0
  158. package/src/format/image/avif/av1/filter/cdef.js +313 -0
  159. package/src/format/image/avif/av1/filter/loop_filter.d.ts.map +1 -0
  160. package/src/format/image/avif/av1/filter/loop_filter.js +377 -0
  161. package/src/format/image/avif/av1/filter/loop_restoration.d.ts.map +1 -0
  162. package/src/format/image/avif/av1/filter/loop_restoration.js +451 -0
  163. package/src/format/image/avif/av1/filter/superres.d.ts.map +1 -0
  164. package/src/format/image/avif/av1/filter/superres.js +86 -0
  165. package/src/format/image/avif/av1/grain/FilmGrainState.d.ts.map +1 -0
  166. package/src/format/image/avif/av1/grain/film_grain.d.ts.map +1 -0
  167. package/src/format/image/avif/av1/grain/film_grain.js +623 -0
  168. package/src/format/image/avif/av1/obu/FrameHeader.d.ts.map +1 -0
  169. package/src/format/image/avif/av1/obu/ObuHeader.d.ts.map +1 -0
  170. package/src/format/image/avif/av1/obu/SequenceHeader.d.ts.map +1 -0
  171. package/src/format/image/avif/av1/obu/for_each_obu.d.ts.map +1 -0
  172. package/src/format/image/avif/av1/obu/parse_frame_header.d.ts.map +1 -0
  173. package/src/format/image/avif/av1/obu/parse_frame_header.js +841 -0
  174. package/src/format/image/avif/av1/obu/parse_obu_header.d.ts.map +1 -0
  175. package/src/format/image/avif/av1/obu/parse_sequence_header.d.ts.map +1 -0
  176. package/src/format/image/avif/av1/obu/write_frame_header.d.ts.map +1 -0
  177. package/src/format/image/avif/av1/obu/write_sequence_header.d.ts.map +1 -0
  178. package/src/format/image/avif/av1/predict/IntraPredictionState.d.ts.map +1 -0
  179. package/src/format/image/avif/av1/predict/intra_filter_type.d.ts.map +1 -0
  180. package/src/format/image/avif/av1/predict/predict_chroma_from_luma.d.ts.map +1 -0
  181. package/src/format/image/avif/av1/predict/predict_chroma_from_luma.js +153 -0
  182. package/src/format/image/avif/av1/predict/predict_intra.d.ts.map +1 -0
  183. package/src/format/image/avif/av1/predict/predict_intra.js +803 -0
  184. package/src/format/image/avif/av1/predict/predict_palette.d.ts.map +1 -0
  185. package/src/format/image/avif/av1/tables/av1_symbols.d.ts.map +1 -0
  186. package/src/format/image/avif/av1/tables/av1_symbols.js +419 -0
  187. package/src/format/image/avif/av1/tables/block_tables.d.ts.map +1 -0
  188. package/src/format/image/avif/av1/tables/block_tables.js +270 -0
  189. package/src/format/image/avif/av1/tables/cdf_tables.d.ts.map +1 -0
  190. package/src/format/image/avif/av1/tables/cdf_tables.js +1893 -0
  191. package/src/format/image/avif/av1/tables/coefficient_tables.d.ts.map +1 -0
  192. package/src/format/image/avif/av1/tables/coefficient_tables.js +82 -0
  193. package/src/format/image/avif/av1/tables/derived_block_tables.d.ts.map +1 -0
  194. package/src/format/image/avif/av1/tables/filter_tables.d.ts.map +1 -0
  195. package/src/format/image/avif/av1/tables/filter_tables.js +313 -0
  196. package/src/format/image/avif/av1/tables/grain_tables.d.ts.map +1 -0
  197. package/src/format/image/avif/av1/tables/grain_tables.js +190 -0
  198. package/src/format/image/avif/av1/tables/prediction_tables.d.ts.map +1 -0
  199. package/src/format/image/avif/av1/tables/prediction_tables.js +223 -0
  200. package/src/format/image/avif/av1/tables/quantizer_matrix_tables.d.ts.map +1 -0
  201. package/src/format/image/avif/av1/tables/quantizer_matrix_tables.js +38 -0
  202. package/src/format/image/avif/av1/tables/quantizer_tables.d.ts.map +1 -0
  203. package/src/format/image/avif/av1/tables/quantizer_tables.js +160 -0
  204. package/src/format/image/avif/av1/tables/scan_tables.d.ts.map +1 -0
  205. package/src/format/image/avif/av1/tables/scan_tables.js +727 -0
  206. package/src/format/image/avif/av1/tables/segmentation_tables.d.ts.map +1 -0
  207. package/src/format/image/avif/av1/tables/segmentation_tables.js +48 -0
  208. package/src/format/image/avif/av1/tables/transform_tables.d.ts.map +1 -0
  209. package/src/format/image/avif/av1/tables/transform_tables.js +140 -0
  210. package/src/format/image/avif/av1/tables/unpack_table.d.ts.map +1 -0
  211. package/src/format/image/avif/av1/tables/unpack_table.js +73 -0
  212. package/src/format/image/avif/av1/transform/forward_transform_2d.d.ts.map +1 -0
  213. package/src/format/image/avif/av1/transform/inverse_transform_1d.d.ts.map +1 -0
  214. package/src/format/image/avif/av1/transform/inverse_transform_1d.js +590 -0
  215. package/src/format/image/avif/av1/transform/inverse_transform_2d.d.ts.map +1 -0
  216. package/src/format/image/avif/av1/transform/inverse_transform_2d.js +180 -0
  217. package/src/format/image/avif/av1/util/ceil_log2.d.ts.map +1 -0
  218. package/src/format/image/avif/av1/util/floor_log2.d.ts +20 -0
  219. package/src/format/image/avif/av1/util/floor_log2.d.ts.map +1 -0
  220. package/src/format/image/avif/av1/util/floor_log2.js +20 -0
  221. package/src/format/image/avif/av1/util/round2.d.ts.map +1 -0
  222. package/src/format/image/avif/av1/util/round2_signed.d.ts.map +1 -0
  223. package/src/format/image/avif/av1/util/tile_log2.d.ts.map +1 -0
  224. package/src/format/image/avif/bitstream/BitReader.d.ts.map +1 -0
  225. package/src/format/image/avif/bitstream/BitWriter.d.ts.map +1 -0
  226. package/src/format/image/avif/color/ColourTransform.d.ts.map +1 -0
  227. package/src/format/image/avif/color/YuvImage.d.ts.map +1 -0
  228. package/src/format/image/avif/color/clamp_sample.d.ts.map +1 -0
  229. package/src/format/image/avif/color/linear_to_transfer.d.ts.map +1 -0
  230. package/src/format/image/avif/color/linear_to_transfer.js +126 -0
  231. package/src/format/image/avif/color/primaries.d.ts.map +1 -0
  232. package/src/format/image/avif/color/rgb_row_to_ycbcr.d.ts.map +1 -0
  233. package/src/format/image/avif/color/transfer_to_linear.d.ts.map +1 -0
  234. package/src/format/image/avif/color/transfer_to_linear.js +171 -0
  235. package/src/format/image/avif/color/upsample_chroma_row.d.ts.map +1 -0
  236. package/src/format/image/avif/color/upsample_chroma_row.js +89 -0
  237. package/src/format/image/avif/color/ycbcr_row_to_rgb.d.ts.map +1 -0
  238. package/src/format/image/avif/color/ycbcr_row_to_rgb.js +78 -0
  239. package/src/format/image/avif/heif/AvifFile.d.ts.map +1 -0
  240. package/src/format/image/avif/heif/ItemProperty.d.ts.map +1 -0
  241. package/src/format/image/avif/heif/find_item_property.d.ts.map +1 -0
  242. package/src/format/image/avif/heif/find_item_references.d.ts.map +1 -0
  243. package/src/format/image/avif/heif/find_items_referencing.d.ts.map +1 -0
  244. package/src/format/image/avif/heif/parse_avif_file.d.ts.map +1 -0
  245. package/src/format/image/avif/heif/parse_avif_file.js +384 -0
  246. package/src/format/image/avif/heif/parse_image_grid.d.ts.map +1 -0
  247. package/src/format/image/avif/heif/parse_image_grid.js +49 -0
  248. package/src/format/image/avif/heif/parse_item_property.d.ts.map +1 -0
  249. package/src/format/image/avif/heif/read_item_data.d.ts.map +1 -0
  250. package/src/format/image/avif/heif/write_avif_file.d.ts.map +1 -0
  251. package/src/format/image/avif/heif/write_item_property.d.ts.map +1 -0
  252. package/src/format/image/avif/index.d.ts +12 -0
  253. package/src/format/image/avif/index.d.ts.map +1 -0
  254. package/src/format/image/avif/index.js +58 -0
  255. package/src/format/image/avif/isobmff/BoxHeader.d.ts.map +1 -0
  256. package/src/format/image/avif/isobmff/BoxWriter.d.ts +118 -0
  257. package/src/format/image/avif/isobmff/BoxWriter.d.ts.map +1 -0
  258. package/src/format/image/avif/isobmff/BoxWriter.js +264 -0
  259. package/src/format/image/avif/isobmff/for_each_box.d.ts.map +1 -0
  260. package/src/format/image/avif/isobmff/read_box_header.d.ts.map +1 -0
  261. package/src/format/image/avif/isobmff/read_full_box_header.d.ts.map +1 -0
  262. package/src/format/image/jpeg/JpegFrame.d.ts.map +1 -0
  263. package/src/format/image/jpeg/JpegFrameComponent.d.ts.map +1 -0
  264. package/src/format/image/jpeg/JpegImage.d.ts.map +1 -0
  265. package/src/format/image/jpeg/JpegImage.js +664 -0
  266. package/src/format/image/jpeg/buildComponentData.d.ts.map +1 -0
  267. package/src/format/image/jpeg/buildHuffmanTable.d.ts.map +1 -0
  268. package/src/format/image/jpeg/decodeScan.d.ts.map +1 -0
  269. package/src/format/image/jpeg/idct8x8_float.d.ts.map +1 -0
  270. package/src/format/image/jpeg/idct8x8_float.js +31 -0
  271. package/src/format/image/jpeg/jpeg_component_row.d.ts.map +1 -0
  272. package/src/format/image/jpeg/jpeg_decode.d.ts.map +1 -0
  273. package/src/format/image/png/PNG.d.ts.map +1 -0
  274. package/src/format/image/png/PNGReader.d.ts +158 -0
  275. package/src/format/image/png/PNGReader.d.ts.map +1 -0
  276. package/src/format/image/png/PNGReader.js +656 -0
  277. package/src/format/image/png/PNG_HEADER_BYTES.d.ts.map +1 -0
  278. package/src/format/image/png/chunk/png_chunk_decode_iTXt.d.ts.map +1 -0
  279. package/src/format/image/png/chunk/png_chunk_decode_iTXt.js +53 -0
  280. package/src/format/image/png/chunk/png_chunk_decode_zTXt.d.ts.map +1 -0
  281. package/src/format/image/png/chunk/png_chunk_decode_zTXt.js +42 -0
  282. package/src/format/image/png/crc32.d.ts +2 -0
  283. package/src/format/image/png/crc32.d.ts.map +1 -0
  284. package/src/format/image/png/crc32.js +8 -0
  285. package/src/format/image/png/filter/png_filter_unFilterAverage.d.ts.map +1 -0
  286. package/src/format/image/png/filter/png_filter_unFilterNone.d.ts.map +1 -0
  287. package/src/format/image/png/filter/png_filter_unFilterPaeth.d.ts.map +1 -0
  288. package/src/format/image/png/filter/png_filter_unFilterSub.d.ts.map +1 -0
  289. package/src/format/image/png/filter/png_filter_unFilterUp.d.ts.map +1 -0
  290. package/src/format/image/png/filter/png_unfilter.d.ts.map +1 -0
  291. package/src/format/image/png/filter/png_unfilter.js +68 -0
  292. package/src/format/image/png/png_inflate.d.ts.map +1 -0
  293. package/src/format/image/png/png_unpack_samples.d.ts.map +1 -0
  294. package/src/format/scene/gltf/GLTF_PRIMITIVE_MODE.d.ts.map +1 -0
  295. package/src/format/scene/gltf/MESHOPT_COMPRESSION_PLAN.md +793 -0
  296. package/src/format/scene/gltf/coalesce_array_duplicates.d.ts.map +1 -0
  297. package/src/format/scene/gltf/ext/GltfBufferViewExtension.d.ts.map +1 -0
  298. package/src/format/scene/gltf/ext/GltfBufferViewExtensionSet.d.ts.map +1 -0
  299. package/src/format/scene/gltf/ext/GltfBufferViewExtensionSet.js +109 -0
  300. package/src/format/scene/gltf/ext/gltf_apply_buffer_view_extensions.d.ts.map +1 -0
  301. package/src/format/scene/gltf/ext/gltf_buffer_view_extensions.d.ts.map +1 -0
  302. package/src/format/scene/gltf/ext/gltf_geometry_extensions.d.ts.map +1 -0
  303. package/src/format/scene/gltf/ext/meshopt/MeshoptBufferViewExtension.d.ts.map +1 -0
  304. package/src/format/scene/gltf/ext/meshopt/MeshoptBufferViewExtension.js +301 -0
  305. package/src/format/scene/gltf/gltf_component_type.d.ts.map +1 -0
  306. package/src/format/scene/gltf/gltf_node_world_matrices.d.ts.map +1 -0
  307. package/src/format/scene/gltf/gltf_node_world_matrices.js +137 -0
  308. package/src/format/scene/gltf/gltf_parse_container.d.ts.map +1 -0
  309. package/src/format/scene/gltf/gltf_read_accessor.d.ts.map +1 -0
  310. package/src/format/scene/gltf/gltf_read_accessor.js +294 -0
  311. package/src/format/scene/gltf/gltf_used_image_indices.d.ts +51 -0
  312. package/src/format/scene/gltf/gltf_used_image_indices.d.ts.map +1 -0
  313. package/src/format/scene/gltf/gltf_used_image_indices.js +122 -0
  314. package/src/format/scene/usd/UsdError.d.ts.map +1 -0
  315. package/src/format/scene/usd/parse_usda.d.ts.map +1 -0
  316. package/src/format/scene/usd/unpack_usdz.d.ts.map +1 -0
  317. package/src/format/scene/usd/unpack_usdz.js +106 -0
  318. package/src/format/scene/usd/usd_compose_transform.d.ts.map +1 -0
  319. package/src/format/scene/usd/usd_compose_transform.js +258 -0
  320. package/src/format/scene/usd/usd_lz4.d.ts.map +1 -0
  321. package/src/format/scene/usd/usd_lz4.js +182 -0
  322. package/src/format/scene/usd/usd_triangulate.d.ts.map +1 -0
  323. package/src/format/texture/TexelPayload.d.ts +55 -0
  324. package/src/format/texture/TexelPayload.d.ts.map +1 -0
  325. package/src/format/texture/TexelPayload.js +39 -0
  326. package/src/format/texture/basis/BasisBitReader.d.ts +77 -0
  327. package/src/format/texture/basis/BasisBitReader.d.ts.map +1 -0
  328. package/src/format/texture/basis/BasisBitReader.js +231 -0
  329. package/src/format/texture/basis/BasisHuffmanTable.d.ts.map +1 -0
  330. package/src/format/texture/basis/astc_block.d.ts +92 -0
  331. package/src/format/texture/basis/astc_block.d.ts.map +1 -0
  332. package/src/format/texture/basis/astc_block.js +164 -0
  333. package/src/format/texture/basis/astc_integer_sequence.d.ts +59 -0
  334. package/src/format/texture/basis/astc_integer_sequence.d.ts.map +1 -0
  335. package/src/format/texture/basis/astc_integer_sequence.js +251 -0
  336. package/src/format/texture/basis/astc_partition.d.ts +56 -0
  337. package/src/format/texture/basis/astc_partition.d.ts.map +1 -0
  338. package/src/format/texture/basis/astc_partition.js +199 -0
  339. package/src/format/texture/basis/basis_read_huffman_table.d.ts.map +1 -0
  340. package/src/format/texture/basis/etc1s/Etc1sSelectorHistory.d.ts.map +1 -0
  341. package/src/format/texture/basis/etc1s/etc1s_block_colors.d.ts.map +1 -0
  342. package/src/format/texture/basis/etc1s/etc1s_decode_slice.d.ts.map +1 -0
  343. package/src/format/texture/basis/etc1s/etc1s_decode_slice.js +290 -0
  344. package/src/format/texture/basis/etc1s/etc1s_read_endpoint_codebook.d.ts.map +1 -0
  345. package/src/format/texture/basis/etc1s/etc1s_read_selector_codebook.d.ts.map +1 -0
  346. package/src/format/texture/basis/etc1s/etc1s_read_slice_tables.d.ts.map +1 -0
  347. package/src/format/texture/basis/transcode/build_range_plan.d.ts +46 -0
  348. package/src/format/texture/basis/transcode/build_range_plan.d.ts.map +1 -0
  349. package/src/format/texture/basis/transcode/etc1s_to_astc.d.ts +30 -0
  350. package/src/format/texture/basis/transcode/etc1s_to_astc.d.ts.map +1 -0
  351. package/src/format/texture/basis/transcode/etc1s_to_astc.js +328 -0
  352. package/src/format/texture/basis/transcode/etc1s_to_bc1.d.ts +34 -0
  353. package/src/format/texture/basis/transcode/etc1s_to_bc1.d.ts.map +1 -0
  354. package/src/format/texture/basis/transcode/etc1s_to_bc1.js +486 -0
  355. package/src/format/texture/basis/transcode/etc1s_to_bc7.d.ts +27 -0
  356. package/src/format/texture/basis/transcode/etc1s_to_bc7.d.ts.map +1 -0
  357. package/src/format/texture/basis/transcode/etc1s_to_etc2.d.ts +31 -0
  358. package/src/format/texture/basis/transcode/etc1s_to_etc2.d.ts.map +1 -0
  359. package/src/format/texture/basis/transcode/etc1s_to_etc2.js +332 -0
  360. package/src/format/texture/basis/transcode/etc1s_to_rgba8.d.ts +39 -0
  361. package/src/format/texture/basis/transcode/etc1s_to_rgba8.d.ts.map +1 -0
  362. package/src/format/texture/basis/transcode/etc1s_to_rgba8.js +115 -0
  363. package/src/format/texture/basis/transcode/fit_endpoints.d.ts +79 -0
  364. package/src/format/texture/basis/transcode/fit_endpoints.d.ts.map +1 -0
  365. package/src/format/texture/basis/transcode/fit_endpoints.js +297 -0
  366. package/src/format/texture/basis/transcode_basis.d.ts +109 -0
  367. package/src/format/texture/basis/transcode_basis.d.ts.map +1 -0
  368. package/src/format/texture/basis/transcode_basis.js +250 -0
  369. package/src/format/texture/basis/transcode_uastc.d.ts +55 -0
  370. package/src/format/texture/basis/transcode_uastc.d.ts.map +1 -0
  371. package/src/format/texture/basis/transcode_uastc.js +117 -0
  372. package/src/format/texture/basis/uastc/bc7_tables.d.ts +111 -0
  373. package/src/format/texture/basis/uastc/bc7_tables.d.ts.map +1 -0
  374. package/src/format/texture/basis/uastc/bc7_tables.js +276 -0
  375. package/src/format/texture/basis/uastc/bc7_write_block.d.ts +124 -0
  376. package/src/format/texture/basis/uastc/bc7_write_block.d.ts.map +1 -0
  377. package/src/format/texture/basis/uastc/bc7_write_block.js +227 -0
  378. package/src/format/texture/basis/uastc/uastc_decode_block.d.ts +105 -0
  379. package/src/format/texture/basis/uastc/uastc_decode_block.d.ts.map +1 -0
  380. package/src/format/texture/basis/uastc/uastc_decode_block.js +480 -0
  381. package/src/format/texture/basis/uastc/uastc_tables.d.ts +240 -0
  382. package/src/format/texture/basis/uastc/uastc_tables.d.ts.map +1 -0
  383. package/src/format/texture/basis/uastc/uastc_tables.js +383 -0
  384. package/src/format/texture/basis/uastc/uastc_to_astc.d.ts +30 -0
  385. package/src/format/texture/basis/uastc/uastc_to_astc.d.ts.map +1 -0
  386. package/src/format/texture/basis/uastc/uastc_to_astc.js +421 -0
  387. package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts +26 -0
  388. package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts.map +1 -0
  389. package/src/format/texture/basis/uastc/uastc_to_bc5.js +115 -0
  390. package/src/format/texture/basis/uastc/uastc_to_bc7.d.ts +36 -0
  391. package/src/format/texture/basis/uastc/uastc_to_bc7.d.ts.map +1 -0
  392. package/src/format/texture/basis/uastc/uastc_to_bc7.js +602 -0
  393. package/src/format/texture/basis/uastc/uastc_to_rgba8.d.ts +37 -0
  394. package/src/format/texture/basis/uastc/uastc_to_rgba8.d.ts.map +1 -0
  395. package/src/format/texture/basis/uastc/uastc_to_rgba8.js +87 -0
  396. package/src/format/texture/bc/bc1_write_block.d.ts +28 -0
  397. package/src/format/texture/bc/bc1_write_block.d.ts.map +1 -0
  398. package/src/format/texture/bc/bc1_write_block.js +41 -0
  399. package/src/format/texture/bc/bc4_write_block.d.ts +32 -0
  400. package/src/format/texture/bc/bc4_write_block.d.ts.map +1 -0
  401. package/src/format/texture/bc/bc4_write_block.js +50 -0
  402. package/src/format/texture/bc/bc6h_write_block_mode11.d.ts +30 -0
  403. package/src/format/texture/bc/bc6h_write_block_mode11.d.ts.map +1 -0
  404. package/src/format/texture/bc/bc6h_write_block_mode11.js +62 -0
  405. package/src/format/texture/ktx2/KTX2_IDENTIFIER.d.ts.map +1 -0
  406. package/src/format/texture/ktx2/KhrDfModel.d.ts.map +1 -0
  407. package/src/format/texture/ktx2/SupercompressionScheme.d.ts.map +1 -0
  408. package/src/format/texture/ktx2/ktx2_read.d.ts +105 -0
  409. package/src/format/texture/ktx2/ktx2_read.d.ts.map +1 -0
  410. package/src/format/texture/ktx2/ktx2_read.js +909 -0
  411. package/src/format/texture/ktx2/ktx2_read_basis_lz_global_data.d.ts +27 -0
  412. package/src/format/texture/ktx2/ktx2_read_basis_lz_global_data.d.ts.map +1 -0
  413. package/src/format/texture/ktx2/ktx2_read_basis_lz_global_data.js +189 -0
  414. package/src/format/texture/ktx2/vk_format_to_texture_format.d.ts +55 -0
  415. package/src/format/texture/ktx2/vk_format_to_texture_format.d.ts.map +1 -0
  416. package/src/format/texture/ktx2/vk_format_to_texture_format.js +290 -0
  417. package/src/shade/descriptor/texture/format/gpu_texture_format_feature.d.ts +16 -0
  418. package/src/shade/descriptor/texture/format/gpu_texture_format_feature.d.ts.map +1 -0
  419. package/src/shade/descriptor/texture/format/gpu_texture_format_feature.js +44 -0
  420. package/src/shade/descriptor/texture/format/gpu_texture_format_info.d.ts +16 -0
  421. package/src/shade/descriptor/texture/format/gpu_texture_format_info.d.ts.map +1 -1
  422. package/src/shade/descriptor/texture/format/gpu_texture_format_info.js +24 -0
  423. package/src/shade/descriptor/texture/format/gpu_texture_format_srgb.d.ts +19 -0
  424. package/src/shade/descriptor/texture/format/gpu_texture_format_srgb.d.ts.map +1 -0
  425. package/src/shade/descriptor/texture/format/gpu_texture_format_srgb.js +50 -0
  426. package/src/shade/device/COPY_BYTES_PER_ROW_ALIGNMENT.d.ts +14 -0
  427. package/src/shade/device/COPY_BYTES_PER_ROW_ALIGNMENT.d.ts.map +1 -0
  428. package/src/shade/device/COPY_BYTES_PER_ROW_ALIGNMENT.js +13 -0
  429. package/src/shade/device/mock/SoftwareGPUDevice.d.ts.map +1 -1
  430. package/src/shade/device/mock/SoftwareGPUDevice.js +37 -3
  431. package/src/shade/device/mock/SoftwareGPUTexture.d.ts +4 -2
  432. package/src/shade/device/mock/SoftwareGPUTexture.d.ts.map +1 -1
  433. package/src/shade/device/mock/SoftwareGPUTexture.js +39 -3
  434. package/src/shade/device/mock/SoftwareGPUTextureView.d.ts +7 -0
  435. package/src/shade/device/mock/SoftwareGPUTextureView.d.ts.map +1 -1
  436. package/src/shade/device/mock/SoftwareGPUTextureView.js +8 -0
  437. package/src/shade/device/mock/texture_copy.d.ts.map +1 -1
  438. package/src/shade/device/mock/texture_copy.js +74 -12
  439. package/src/shade/playground/basis_textures/README.md +105 -0
  440. package/src/shade/playground/basis_textures/index.html +141 -0
  441. package/src/shade/playground/basis_textures/main.d.ts +8 -0
  442. package/src/shade/playground/basis_textures/main.d.ts.map +1 -0
  443. package/src/shade/playground/basis_textures/main.js +351 -0
  444. package/src/shade/playground/basis_textures/make_basis_gltf.d.mts +2 -0
  445. package/src/shade/playground/basis_textures/make_basis_gltf.d.mts.map +1 -0
  446. package/src/shade/playground/basis_textures/make_basis_gltf.mjs +197 -0
  447. package/src/shade/playground/basis_textures/node_modules/basis_universal/bin/basisu.exe +0 -0
  448. package/src/shade/playground/basis_textures/texture_inventory.d.ts +28 -0
  449. package/src/shade/playground/basis_textures/texture_inventory.d.ts.map +1 -0
  450. package/src/shade/playground/basis_textures/texture_inventory.js +98 -0
  451. package/src/shade/playground/image_decode_bench/README.md +42 -0
  452. package/src/shade/playground/image_decode_bench/decode_worker.d.ts +2 -0
  453. package/src/shade/playground/image_decode_bench/decode_worker.d.ts.map +1 -0
  454. package/src/shade/playground/image_decode_bench/decode_worker.js +19 -0
  455. package/src/shade/playground/image_decode_bench/index.html +34 -0
  456. package/src/shade/playground/image_decode_bench/main.d.ts +2 -0
  457. package/src/shade/playground/image_decode_bench/main.d.ts.map +1 -0
  458. package/src/shade/playground/image_decode_bench/main.js +211 -0
  459. package/src/shade/playground/particle_system/README.md +98 -0
  460. package/src/shade/playground/particle_system/index.html +124 -0
  461. package/src/shade/playground/particle_system/main.d.ts +2 -0
  462. package/src/shade/playground/particle_system/main.d.ts.map +1 -0
  463. package/src/shade/playground/particle_system/main.js +180 -0
  464. package/src/shade/playground/particle_system/particle_scene.d.ts +52 -0
  465. package/src/shade/playground/particle_system/particle_scene.d.ts.map +1 -0
  466. package/src/shade/playground/particle_system/particle_scene.js +552 -0
  467. package/src/shade/playground/skinned_blas_refit/README.md +1 -1
  468. package/src/shade/playground/skinned_blas_refit/index.html +15 -1
  469. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  470. package/src/shade/playground/skinned_blas_refit/main.js +339 -3
  471. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts +8 -1
  472. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.d.ts.map +1 -1
  473. package/src/shade/playground/skinned_blas_refit/shader_blas_audit_leaf_triangles.js +27 -5
  474. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts +27 -0
  475. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.d.ts.map +1 -0
  476. package/src/shade/playground/skinned_blas_refit/verify_clone_leaves.js +127 -0
  477. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.d.ts.map +1 -1
  478. package/src/shade/playground/skinned_blas_refit/verify_leaf_triangles.js +3 -3
  479. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.d.ts.map +1 -1
  480. package/src/shade/playground/skinned_blas_refit/verify_skinned_blas_refit.js +10 -8
  481. package/src/shade/playground/skinned_mesh_soup/README.md +122 -0
  482. package/src/shade/playground/skinned_mesh_soup/index.html +199 -0
  483. package/src/shade/playground/skinned_mesh_soup/main.d.ts +7 -0
  484. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -0
  485. package/src/shade/playground/skinned_mesh_soup/main.js +564 -0
  486. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts +23 -0
  487. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts.map +1 -0
  488. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +409 -0
  489. package/src/shade/playground/texture_encode/README.md +109 -0
  490. package/src/shade/playground/texture_encode/index.html +133 -0
  491. package/src/shade/playground/texture_encode/main.d.ts +24 -0
  492. package/src/shade/playground/texture_encode/main.d.ts.map +1 -0
  493. package/src/shade/playground/texture_encode/main.js +1430 -0
  494. package/src/shade/playground/texture_encode/panel_view.d.ts +118 -0
  495. package/src/shade/playground/texture_encode/panel_view.d.ts.map +1 -0
  496. package/src/shade/playground/texture_encode/panel_view.js +363 -0
  497. package/src/shade/renderer/Renderer.js +2 -2
  498. package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
  499. package/src/shade/renderer/animation/GPUAnimationManager.js +49 -5
  500. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
  501. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +32 -14
  502. package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
  503. package/src/shade/renderer/geometry/GPUGeometryManager.js +591 -497
  504. package/src/shade/renderer/geometry/GPUGeometryMetadata.d.ts +9 -0
  505. package/src/shade/renderer/geometry/GPUGeometryMetadata.d.ts.map +1 -1
  506. package/src/shade/renderer/geometry/GPUGeometryMetadata.js +10 -0
  507. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_BATCH_PLAN.md +606 -0
  508. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts +17 -0
  509. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.d.ts.map +1 -0
  510. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_TARGET_STRUCT.js +44 -0
  511. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts +58 -0
  512. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.d.ts.map +1 -0
  513. package/src/shade/renderer/geometry/bvh/GPUBLASRefitBatch.js +362 -0
  514. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts +38 -0
  515. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
  516. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +730 -617
  517. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts +15 -2
  518. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.d.ts.map +1 -1
  519. package/src/shade/renderer/geometry/bvh/GPUGeometryMeshletsBVH.js +15 -1
  520. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts +39 -0
  521. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.d.ts.map +1 -0
  522. package/src/shade/renderer/geometry/bvh/shader_blas_refit_batch.js +134 -0
  523. package/src/shade/renderer/geometry/virtual/build/gltf/gltf_collect_geometries.js +3 -3
  524. package/src/shade/renderer/geometry/virtual/build/gltf/gltf_open_document.js +3 -3
  525. package/src/shade/renderer/geometry/virtual/build/gltf/gltf_read_geometry.js +1 -1
  526. package/src/shade/renderer/gpu_primitive/bvh/BVH_NODE_LAYOUT_DEFINITION.d.ts +17 -0
  527. package/src/shade/renderer/gpu_primitive/bvh/BVH_NODE_LAYOUT_DEFINITION.d.ts.map +1 -0
  528. package/src/shade/renderer/gpu_primitive/bvh/BVH_NODE_LAYOUT_DEFINITION.js +30 -0
  529. package/src/shade/renderer/gpu_primitive/bvh/GPU_BVH_BUILD_PLAN.md +8 -1
  530. package/src/shade/renderer/gpu_primitive/bvh/chunk_bvh_refit_climb.d.ts +34 -0
  531. package/src/shade/renderer/gpu_primitive/bvh/chunk_bvh_refit_climb.d.ts.map +1 -0
  532. package/src/shade/renderer/gpu_primitive/bvh/chunk_bvh_refit_climb.js +102 -0
  533. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_refit.d.ts +11 -9
  534. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_refit.d.ts.map +1 -1
  535. package/src/shade/renderer/gpu_primitive/bvh/shader_bvh_refit.js +24 -86
  536. package/src/shade/renderer/loader/gltf/gltf_create_texture.d.ts +18 -0
  537. package/src/shade/renderer/loader/gltf/gltf_create_texture.d.ts.map +1 -0
  538. package/src/shade/renderer/loader/gltf/gltf_create_texture.js +103 -0
  539. package/src/shade/renderer/loader/gltf/gltf_image_roles.d.ts +26 -0
  540. package/src/shade/renderer/loader/gltf/gltf_image_roles.d.ts.map +1 -0
  541. package/src/shade/renderer/loader/gltf/gltf_image_roles.js +108 -0
  542. package/src/shade/renderer/loader/gltf/load_gltf.d.ts +10 -3
  543. package/src/shade/renderer/loader/gltf/load_gltf.d.ts.map +1 -1
  544. package/src/shade/renderer/loader/gltf/load_gltf.js +1179 -1253
  545. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +18 -1
  546. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts.map +1 -1
  547. package/src/shade/renderer/loader/gltf/tiny-gltf.js +837 -646
  548. package/src/shade/renderer/loader/usd/load_usd.js +3 -3
  549. package/src/shade/renderer/loader/usd/usd_build_scene.js +2 -2
  550. package/src/shade/renderer/loader/usd/usd_decode_image.d.ts +6 -5
  551. package/src/shade/renderer/loader/usd/usd_decode_image.d.ts.map +1 -1
  552. package/src/shade/renderer/loader/usd/usd_decode_image.js +197 -384
  553. package/src/shade/renderer/particles/cull/chunk_particle_cull.d.ts.map +1 -1
  554. package/src/shade/renderer/particles/cull/chunk_particle_cull.js +3 -1
  555. package/src/shade/renderer/particles/data/chunk_particle_emitter.js +1 -1
  556. package/src/shade/renderer/particles/graph/compile_particle_graph.d.ts +1 -1
  557. package/src/shade/renderer/particles/graph/compile_particle_graph.d.ts.map +1 -1
  558. package/src/shade/renderer/particles/isa/InstructionStream.d.ts +89 -0
  559. package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -0
  560. package/src/shade/renderer/particles/isa/InstructionStream.js +162 -0
  561. package/src/shade/renderer/particles/isa/ParticleAssembler.d.ts +1 -48
  562. package/src/shade/renderer/particles/isa/ParticleAssembler.d.ts.map +1 -1
  563. package/src/shade/renderer/particles/isa/ParticleAssembler.js +25 -114
  564. package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.d.ts.map +1 -1
  565. package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.js +4 -2
  566. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts +4 -4
  567. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.d.ts.map +1 -1
  568. package/src/shade/renderer/particles/shaders/chunk_particle_lighting.js +7 -5
  569. package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts.map +1 -1
  570. package/src/shade/renderer/particles/shaders/chunk_particle_render_math.js +3 -1
  571. package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
  572. package/src/shade/renderer/particles/shaders/shader_particle_emit.js +3 -1
  573. package/src/shade/renderer/particles/shaders/shader_particle_finalize.d.ts.map +1 -1
  574. package/src/shade/renderer/particles/shaders/shader_particle_finalize.js +5 -2
  575. package/src/shade/renderer/particles/shaders/shader_particle_render.d.ts.map +1 -1
  576. package/src/shade/renderer/particles/shaders/shader_particle_render.js +9 -2
  577. package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
  578. package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +3 -1
  579. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  580. package/src/shade/renderer/postprocess/taa/TAA.d.ts +3 -3
  581. package/src/shade/renderer/postprocess/taa/TAA.d.ts.map +1 -1
  582. package/src/shade/renderer/postprocess/taa/TAA.js +2 -6
  583. package/src/shade/renderer/postprocess/taa/chunk_depth_clip_offset_codec.d.ts +18 -0
  584. package/src/shade/renderer/postprocess/taa/chunk_depth_clip_offset_codec.d.ts.map +1 -0
  585. package/src/shade/renderer/postprocess/taa/chunk_depth_clip_offset_codec.js +36 -0
  586. package/src/shade/renderer/postprocess/taa/chunk_taa_history_color_bounding_box_YCoCg.d.ts.map +1 -1
  587. package/src/shade/renderer/postprocess/taa/chunk_taa_history_color_bounding_box_YCoCg.js +4 -1
  588. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.d.ts.map +1 -1
  589. package/src/shade/renderer/postprocess/taa/shader_depth_occlusion_clip.js +13 -8
  590. package/src/shade/renderer/postprocess/taa/shader_taa.d.ts +1 -1
  591. package/src/shade/renderer/postprocess/taa/shader_taa.d.ts.map +1 -1
  592. package/src/shade/renderer/postprocess/taa/shader_taa.js +52 -38
  593. package/src/shade/renderer/restir/di/chunk_restir_temporal_reuse.d.ts +4 -2
  594. package/src/shade/renderer/restir/di/chunk_restir_temporal_reuse.d.ts.map +1 -1
  595. package/src/shade/renderer/restir/di/chunk_restir_temporal_reuse.js +9 -6
  596. package/src/shade/renderer/scene/optimization/deduplicate_images.js +93 -93
  597. package/src/shade/renderer/scene/optimization/downscale_images.js +216 -216
  598. package/src/shade/renderer/scene/serialization/decode_image_source_hdr.js +1 -1
  599. package/src/shade/renderer/scene/serialization/deserialize_scene.js +1 -1
  600. package/src/shade/renderer/scene/serialization/write_image_source.js +1 -1
  601. package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_eotf_st2084.d.ts +1 -1
  602. package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_eotf_st2084.js +1 -1
  603. package/src/shade/renderer/shader/chunk/texture/sample/chunk_texture_sample_catmullrom_hardware_5tap_uv.d.ts +2 -1
  604. package/src/shade/renderer/shader/chunk/texture/sample/chunk_texture_sample_catmullrom_hardware_5tap_uv.d.ts.map +1 -1
  605. package/src/shade/renderer/shader/chunk/texture/sample/chunk_texture_sample_catmullrom_hardware_5tap_uv.js +2 -1
  606. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +893 -10
  607. package/src/shade/renderer/texture/encode/ENCODE_NOTES_2026_09_02.md +462 -0
  608. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts +33 -0
  609. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -0
  610. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +310 -0
  611. package/src/shade/renderer/texture/encode/chunk_astc_pack_4x4_rgb.d.ts +17 -0
  612. package/src/shade/renderer/texture/encode/chunk_astc_pack_4x4_rgb.d.ts.map +1 -0
  613. package/src/shade/renderer/texture/encode/chunk_astc_pack_4x4_rgb.js +51 -0
  614. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +42 -0
  615. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -0
  616. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +375 -0
  617. package/src/shade/renderer/texture/encode/chunk_bc1_pack_block.d.ts +12 -0
  618. package/src/shade/renderer/texture/encode/chunk_bc1_pack_block.d.ts.map +1 -0
  619. package/src/shade/renderer/texture/encode/chunk_bc1_pack_block.js +24 -0
  620. package/src/shade/renderer/texture/encode/chunk_bc4_encode_block.d.ts +45 -0
  621. package/src/shade/renderer/texture/encode/chunk_bc4_encode_block.d.ts.map +1 -0
  622. package/src/shade/renderer/texture/encode/chunk_bc4_encode_block.js +348 -0
  623. package/src/shade/renderer/texture/encode/chunk_bc4_pack_block.d.ts +16 -0
  624. package/src/shade/renderer/texture/encode/chunk_bc4_pack_block.d.ts.map +1 -0
  625. package/src/shade/renderer/texture/encode/chunk_bc4_pack_block.js +33 -0
  626. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts +32 -0
  627. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -0
  628. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +346 -0
  629. package/src/shade/renderer/texture/encode/chunk_bc6h_pack_mode11.d.ts +10 -0
  630. package/src/shade/renderer/texture/encode/chunk_bc6h_pack_mode11.d.ts.map +1 -0
  631. package/src/shade/renderer/texture/encode/chunk_bc6h_pack_mode11.js +54 -0
  632. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +36 -0
  633. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -0
  634. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +327 -0
  635. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts +22 -0
  636. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.d.ts.map +1 -0
  637. package/src/shade/renderer/texture/encode/chunk_bc7_pack_mode6.js +71 -0
  638. package/src/shade/renderer/texture/encode/chunk_texture_encode_level.d.ts +20 -0
  639. package/src/shade/renderer/texture/encode/chunk_texture_encode_level.d.ts.map +1 -0
  640. package/src/shade/renderer/texture/encode/chunk_texture_encode_level.js +73 -0
  641. package/src/shade/renderer/texture/encode/chunk_texture_encode_load_block.d.ts +16 -0
  642. package/src/shade/renderer/texture/encode/chunk_texture_encode_load_block.d.ts.map +1 -0
  643. package/src/shade/renderer/texture/encode/chunk_texture_encode_load_block.js +36 -0
  644. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts +13 -0
  645. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts.map +1 -0
  646. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js +63 -0
  647. package/src/shade/renderer/texture/encode/shader_texture_encode_bc1.d.ts +12 -0
  648. package/src/shade/renderer/texture/encode/shader_texture_encode_bc1.d.ts.map +1 -0
  649. package/src/shade/renderer/texture/encode/shader_texture_encode_bc1.js +60 -0
  650. package/src/shade/renderer/texture/encode/shader_texture_encode_bc4.d.ts +28 -0
  651. package/src/shade/renderer/texture/encode/shader_texture_encode_bc4.d.ts.map +1 -0
  652. package/src/shade/renderer/texture/encode/shader_texture_encode_bc4.js +76 -0
  653. package/src/shade/renderer/texture/encode/shader_texture_encode_bc4_snorm.d.ts +16 -0
  654. package/src/shade/renderer/texture/encode/shader_texture_encode_bc4_snorm.d.ts.map +1 -0
  655. package/src/shade/renderer/texture/encode/shader_texture_encode_bc4_snorm.js +64 -0
  656. package/src/shade/renderer/texture/encode/shader_texture_encode_bc5.d.ts +14 -0
  657. package/src/shade/renderer/texture/encode/shader_texture_encode_bc5.d.ts.map +1 -0
  658. package/src/shade/renderer/texture/encode/shader_texture_encode_bc5.js +67 -0
  659. package/src/shade/renderer/texture/encode/shader_texture_encode_bc5_snorm.d.ts +10 -0
  660. package/src/shade/renderer/texture/encode/shader_texture_encode_bc5_snorm.d.ts.map +1 -0
  661. package/src/shade/renderer/texture/encode/shader_texture_encode_bc5_snorm.js +63 -0
  662. package/src/shade/renderer/texture/encode/shader_texture_encode_bc6h.d.ts +12 -0
  663. package/src/shade/renderer/texture/encode/shader_texture_encode_bc6h.d.ts.map +1 -0
  664. package/src/shade/renderer/texture/encode/shader_texture_encode_bc6h.js +62 -0
  665. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts +14 -0
  666. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.d.ts.map +1 -0
  667. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7.js +58 -0
  668. package/src/shade/renderer/texture/encode/texture_encode.d.ts +84 -0
  669. package/src/shade/renderer/texture/encode/texture_encode.d.ts.map +1 -0
  670. package/src/shade/renderer/texture/encode/texture_encode.js +168 -0
  671. package/src/shade/renderer/texture/encode/texture_encode_layout.d.ts +196 -0
  672. package/src/shade/renderer/texture/encode/texture_encode_layout.d.ts.map +1 -0
  673. package/src/shade/renderer/texture/encode/texture_encode_layout.js +248 -0
  674. package/src/shade/renderer/texture/encode/texture_encode_resources.d.ts +15 -0
  675. package/src/shade/renderer/texture/encode/texture_encode_resources.d.ts.map +1 -0
  676. package/src/shade/renderer/texture/encode/texture_encode_resources.js +25 -0
  677. package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts +30 -0
  678. package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts.map +1 -0
  679. package/src/shade/renderer/texture/encode/texture_encode_shader.js +108 -0
  680. package/src/shade/renderer/texture/format/gpu_texture_compression_support.d.ts +3 -1
  681. package/src/shade/renderer/texture/format/gpu_texture_compression_support.d.ts.map +1 -1
  682. package/src/shade/renderer/texture/format/gpu_texture_compression_support.js +8 -25
  683. package/src/shade/renderer/texture/format/texture_format_from_shade_image.d.ts.map +1 -1
  684. package/src/shade/renderer/texture/format/texture_format_from_shade_image.js +26 -2
  685. package/src/shade/renderer/texture/source/texel_data_from_ktx2.d.ts +32 -0
  686. package/src/shade/renderer/texture/source/texel_data_from_ktx2.d.ts.map +1 -0
  687. package/src/shade/renderer/texture/source/texel_data_from_ktx2.js +48 -0
  688. package/src/shade/renderer/texture/texture_write_level.d.ts.map +1 -1
  689. package/src/shade/renderer/texture/texture_write_level.js +11 -1
  690. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.d.ts.map +1 -1
  691. package/src/shade/renderer/volumetrics/GPUViewVolumetrics.js +20 -0
  692. package/src/shade/renderer/volumetrics/NOTES.md +28 -0
  693. package/src/shade/renderer/volumetrics/taa/chunk_volumetric_history_bounding_box.d.ts.map +1 -1
  694. package/src/shade/renderer/volumetrics/taa/chunk_volumetric_history_bounding_box.js +7 -2
  695. package/src/shade/renderer/volumetrics/taa/chunk_volumetrics_taa_reproject.d.ts +17 -0
  696. package/src/shade/renderer/volumetrics/taa/chunk_volumetrics_taa_reproject.d.ts.map +1 -0
  697. package/src/shade/renderer/volumetrics/taa/chunk_volumetrics_taa_reproject.js +168 -0
  698. package/src/shade/renderer/volumetrics/taa/chunk_volumetrics_taa_resolve.d.ts +13 -0
  699. package/src/shade/renderer/volumetrics/taa/chunk_volumetrics_taa_resolve.d.ts.map +1 -0
  700. package/src/shade/renderer/volumetrics/taa/chunk_volumetrics_taa_resolve.js +56 -0
  701. package/src/shade/renderer/volumetrics/taa/shader_volumetrics_taa.d.ts.map +1 -1
  702. package/src/shade/renderer/volumetrics/taa/shader_volumetrics_taa.js +134 -334
  703. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.d.ts.map +1 -1
  704. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +49 -21
  705. package/src/avif/encode_image_source.d.ts +0 -70
  706. package/src/avif/encode_image_source.d.ts.map +0 -1
  707. package/src/avif/encode_image_source.js +0 -117
  708. package/src/avif/encoder_worker.d.ts.map +0 -1
  709. package/src/avif/index.d.ts +0 -5
  710. package/src/avif/index.d.ts.map +0 -1
  711. package/src/avif/index.js +0 -21
  712. package/src/avif/native/DECISIONS.md +0 -545
  713. package/src/avif/native/api/AvifDecoder.d.ts.map +0 -1
  714. package/src/avif/native/api/apply_transformations.d.ts.map +0 -1
  715. package/src/avif/native/api/avif_to_sampler2d.d.ts +0 -25
  716. package/src/avif/native/api/avif_to_sampler2d.d.ts.map +0 -1
  717. package/src/avif/native/api/avif_to_sampler2d.js +0 -42
  718. package/src/avif/native/api/convert_to_rgba.d.ts.map +0 -1
  719. package/src/avif/native/api/convert_to_rgba.js +0 -204
  720. package/src/avif/native/api/decode_avif.d.ts.map +0 -1
  721. package/src/avif/native/api/decode_image_item.d.ts.map +0 -1
  722. package/src/avif/native/api/encode_avif.d.ts.map +0 -1
  723. package/src/avif/native/api/sampler2d_to_avif.d.ts.map +0 -1
  724. package/src/avif/native/api/sampler2d_to_avif.js +0 -108
  725. package/src/avif/native/av1/decode/Av1FrameContext.d.ts.map +0 -1
  726. package/src/avif/native/av1/decode/block_decoded.d.ts.map +0 -1
  727. package/src/avif/native/av1/decode/decode_av1_still.d.ts.map +0 -1
  728. package/src/avif/native/av1/decode/decode_coefficients.d.ts.map +0 -1
  729. package/src/avif/native/av1/decode/decode_palette.d.ts.map +0 -1
  730. package/src/avif/native/av1/decode/decode_palette.js +0 -442
  731. package/src/avif/native/av1/decode/decode_tile.d.ts.map +0 -1
  732. package/src/avif/native/av1/decode/decode_tile.js +0 -1213
  733. package/src/avif/native/av1/decode/get_scan.d.ts.map +0 -1
  734. package/src/avif/native/av1/decode/read_lr.d.ts.map +0 -1
  735. package/src/avif/native/av1/decode/read_lr.js +0 -277
  736. package/src/avif/native/av1/decode/read_transform_type.d.ts.map +0 -1
  737. package/src/avif/native/av1/decode/read_transform_type.js +0 -92
  738. package/src/avif/native/av1/decode/reconstruct.d.ts.map +0 -1
  739. package/src/avif/native/av1/decode/reconstruct.js +0 -241
  740. package/src/avif/native/av1/decode/transform_type.d.ts.map +0 -1
  741. package/src/avif/native/av1/encode/Av1BlockSnapshot.d.ts.map +0 -1
  742. package/src/avif/native/av1/encode/Av1EncodeContext.d.ts.map +0 -1
  743. package/src/avif/native/av1/encode/build_headers.d.ts.map +0 -1
  744. package/src/avif/native/av1/encode/choose_chroma_alpha.d.ts.map +0 -1
  745. package/src/avif/native/av1/encode/choose_filters.d.ts.map +0 -1
  746. package/src/avif/native/av1/encode/choose_restoration.d.ts.map +0 -1
  747. package/src/avif/native/av1/encode/choose_restoration.js +0 -616
  748. package/src/avif/native/av1/encode/decode_effort.d.ts.map +0 -1
  749. package/src/avif/native/av1/encode/encode_av1_still.d.ts.map +0 -1
  750. package/src/avif/native/av1/encode/encode_effort.d.ts.map +0 -1
  751. package/src/avif/native/av1/encode/encode_tile.d.ts.map +0 -1
  752. package/src/avif/native/av1/encode/encode_tile.js +0 -2331
  753. package/src/avif/native/av1/encode/quantise.d.ts.map +0 -1
  754. package/src/avif/native/av1/encode/write_coefficients.d.ts.map +0 -1
  755. package/src/avif/native/av1/encode/write_lr.d.ts.map +0 -1
  756. package/src/avif/native/av1/encode/write_transform_type.d.ts.map +0 -1
  757. package/src/avif/native/av1/entropy/CdfContext.d.ts.map +0 -1
  758. package/src/avif/native/av1/entropy/SymbolReader.d.ts.map +0 -1
  759. package/src/avif/native/av1/entropy/SymbolWriter.d.ts.map +0 -1
  760. package/src/avif/native/av1/entropy/coefficient_context.d.ts.map +0 -1
  761. package/src/avif/native/av1/entropy/partition_cdf.d.ts.map +0 -1
  762. package/src/avif/native/av1/entropy/symbol_cost.d.ts.map +0 -1
  763. package/src/avif/native/av1/filter/cdef.d.ts.map +0 -1
  764. package/src/avif/native/av1/filter/cdef.js +0 -313
  765. package/src/avif/native/av1/filter/loop_filter.d.ts.map +0 -1
  766. package/src/avif/native/av1/filter/loop_filter.js +0 -377
  767. package/src/avif/native/av1/filter/loop_restoration.d.ts.map +0 -1
  768. package/src/avif/native/av1/filter/loop_restoration.js +0 -451
  769. package/src/avif/native/av1/filter/superres.d.ts.map +0 -1
  770. package/src/avif/native/av1/filter/superres.js +0 -86
  771. package/src/avif/native/av1/grain/FilmGrainState.d.ts.map +0 -1
  772. package/src/avif/native/av1/grain/film_grain.d.ts.map +0 -1
  773. package/src/avif/native/av1/grain/film_grain.js +0 -623
  774. package/src/avif/native/av1/obu/FrameHeader.d.ts.map +0 -1
  775. package/src/avif/native/av1/obu/ObuHeader.d.ts.map +0 -1
  776. package/src/avif/native/av1/obu/SequenceHeader.d.ts.map +0 -1
  777. package/src/avif/native/av1/obu/for_each_obu.d.ts.map +0 -1
  778. package/src/avif/native/av1/obu/parse_frame_header.d.ts.map +0 -1
  779. package/src/avif/native/av1/obu/parse_frame_header.js +0 -841
  780. package/src/avif/native/av1/obu/parse_obu_header.d.ts.map +0 -1
  781. package/src/avif/native/av1/obu/parse_sequence_header.d.ts.map +0 -1
  782. package/src/avif/native/av1/obu/write_frame_header.d.ts.map +0 -1
  783. package/src/avif/native/av1/obu/write_sequence_header.d.ts.map +0 -1
  784. package/src/avif/native/av1/predict/IntraPredictionState.d.ts.map +0 -1
  785. package/src/avif/native/av1/predict/intra_filter_type.d.ts.map +0 -1
  786. package/src/avif/native/av1/predict/predict_chroma_from_luma.d.ts.map +0 -1
  787. package/src/avif/native/av1/predict/predict_chroma_from_luma.js +0 -153
  788. package/src/avif/native/av1/predict/predict_intra.d.ts.map +0 -1
  789. package/src/avif/native/av1/predict/predict_intra.js +0 -803
  790. package/src/avif/native/av1/predict/predict_palette.d.ts.map +0 -1
  791. package/src/avif/native/av1/tables/av1_symbols.d.ts.map +0 -1
  792. package/src/avif/native/av1/tables/av1_symbols.js +0 -419
  793. package/src/avif/native/av1/tables/block_tables.d.ts.map +0 -1
  794. package/src/avif/native/av1/tables/block_tables.js +0 -270
  795. package/src/avif/native/av1/tables/cdf_tables.d.ts.map +0 -1
  796. package/src/avif/native/av1/tables/cdf_tables.js +0 -1893
  797. package/src/avif/native/av1/tables/coefficient_tables.d.ts.map +0 -1
  798. package/src/avif/native/av1/tables/coefficient_tables.js +0 -82
  799. package/src/avif/native/av1/tables/derived_block_tables.d.ts.map +0 -1
  800. package/src/avif/native/av1/tables/filter_tables.d.ts.map +0 -1
  801. package/src/avif/native/av1/tables/filter_tables.js +0 -313
  802. package/src/avif/native/av1/tables/grain_tables.d.ts.map +0 -1
  803. package/src/avif/native/av1/tables/grain_tables.js +0 -190
  804. package/src/avif/native/av1/tables/prediction_tables.d.ts.map +0 -1
  805. package/src/avif/native/av1/tables/prediction_tables.js +0 -223
  806. package/src/avif/native/av1/tables/quantizer_matrix_tables.d.ts.map +0 -1
  807. package/src/avif/native/av1/tables/quantizer_matrix_tables.js +0 -38
  808. package/src/avif/native/av1/tables/quantizer_tables.d.ts.map +0 -1
  809. package/src/avif/native/av1/tables/quantizer_tables.js +0 -160
  810. package/src/avif/native/av1/tables/scan_tables.d.ts.map +0 -1
  811. package/src/avif/native/av1/tables/scan_tables.js +0 -727
  812. package/src/avif/native/av1/tables/segmentation_tables.d.ts.map +0 -1
  813. package/src/avif/native/av1/tables/segmentation_tables.js +0 -48
  814. package/src/avif/native/av1/tables/transform_tables.d.ts.map +0 -1
  815. package/src/avif/native/av1/tables/transform_tables.js +0 -140
  816. package/src/avif/native/av1/tables/unpack_table.d.ts.map +0 -1
  817. package/src/avif/native/av1/tables/unpack_table.js +0 -73
  818. package/src/avif/native/av1/transform/forward_transform_2d.d.ts.map +0 -1
  819. package/src/avif/native/av1/transform/inverse_transform_1d.d.ts.map +0 -1
  820. package/src/avif/native/av1/transform/inverse_transform_1d.js +0 -590
  821. package/src/avif/native/av1/transform/inverse_transform_2d.d.ts.map +0 -1
  822. package/src/avif/native/av1/transform/inverse_transform_2d.js +0 -180
  823. package/src/avif/native/av1/util/ceil_log2.d.ts.map +0 -1
  824. package/src/avif/native/av1/util/floor_log2.d.ts +0 -20
  825. package/src/avif/native/av1/util/floor_log2.d.ts.map +0 -1
  826. package/src/avif/native/av1/util/floor_log2.js +0 -20
  827. package/src/avif/native/av1/util/round2.d.ts.map +0 -1
  828. package/src/avif/native/av1/util/round2_signed.d.ts.map +0 -1
  829. package/src/avif/native/av1/util/tile_log2.d.ts.map +0 -1
  830. package/src/avif/native/bitstream/BitReader.d.ts.map +0 -1
  831. package/src/avif/native/bitstream/BitWriter.d.ts.map +0 -1
  832. package/src/avif/native/color/ColourTransform.d.ts.map +0 -1
  833. package/src/avif/native/color/YuvImage.d.ts.map +0 -1
  834. package/src/avif/native/color/clamp_sample.d.ts.map +0 -1
  835. package/src/avif/native/color/linear_to_transfer.d.ts.map +0 -1
  836. package/src/avif/native/color/linear_to_transfer.js +0 -126
  837. package/src/avif/native/color/primaries.d.ts.map +0 -1
  838. package/src/avif/native/color/rgb_row_to_ycbcr.d.ts.map +0 -1
  839. package/src/avif/native/color/transfer_to_linear.d.ts.map +0 -1
  840. package/src/avif/native/color/transfer_to_linear.js +0 -171
  841. package/src/avif/native/color/upsample_chroma_row.d.ts.map +0 -1
  842. package/src/avif/native/color/upsample_chroma_row.js +0 -89
  843. package/src/avif/native/color/ycbcr_row_to_rgb.d.ts.map +0 -1
  844. package/src/avif/native/color/ycbcr_row_to_rgb.js +0 -78
  845. package/src/avif/native/heif/AvifFile.d.ts.map +0 -1
  846. package/src/avif/native/heif/ItemProperty.d.ts.map +0 -1
  847. package/src/avif/native/heif/find_item_property.d.ts.map +0 -1
  848. package/src/avif/native/heif/find_item_references.d.ts.map +0 -1
  849. package/src/avif/native/heif/find_items_referencing.d.ts.map +0 -1
  850. package/src/avif/native/heif/parse_avif_file.d.ts.map +0 -1
  851. package/src/avif/native/heif/parse_avif_file.js +0 -384
  852. package/src/avif/native/heif/parse_image_grid.d.ts.map +0 -1
  853. package/src/avif/native/heif/parse_image_grid.js +0 -49
  854. package/src/avif/native/heif/parse_item_property.d.ts.map +0 -1
  855. package/src/avif/native/heif/read_item_data.d.ts.map +0 -1
  856. package/src/avif/native/heif/write_avif_file.d.ts.map +0 -1
  857. package/src/avif/native/heif/write_item_property.d.ts.map +0 -1
  858. package/src/avif/native/index.d.ts +0 -14
  859. package/src/avif/native/index.d.ts.map +0 -1
  860. package/src/avif/native/index.js +0 -56
  861. package/src/avif/native/isobmff/BoxHeader.d.ts.map +0 -1
  862. package/src/avif/native/isobmff/BoxWriter.d.ts +0 -118
  863. package/src/avif/native/isobmff/BoxWriter.d.ts.map +0 -1
  864. package/src/avif/native/isobmff/BoxWriter.js +0 -264
  865. package/src/avif/native/isobmff/for_each_box.d.ts.map +0 -1
  866. package/src/avif/native/isobmff/read_box_header.d.ts.map +0 -1
  867. package/src/avif/native/isobmff/read_full_box_header.d.ts.map +0 -1
  868. package/src/avif/threaded_image_encoder.d.ts.map +0 -1
  869. package/src/basis/BasisBitReader.d.ts +0 -77
  870. package/src/basis/BasisBitReader.d.ts.map +0 -1
  871. package/src/basis/BasisBitReader.js +0 -231
  872. package/src/basis/BasisHuffmanTable.d.ts.map +0 -1
  873. package/src/basis/basis_read_huffman_table.d.ts.map +0 -1
  874. package/src/basis/etc1s/Etc1sSelectorHistory.d.ts.map +0 -1
  875. package/src/basis/etc1s/etc1s_block_colors.d.ts.map +0 -1
  876. package/src/basis/etc1s/etc1s_decode_slice.d.ts.map +0 -1
  877. package/src/basis/etc1s/etc1s_decode_slice.js +0 -258
  878. package/src/basis/etc1s/etc1s_read_endpoint_codebook.d.ts.map +0 -1
  879. package/src/basis/etc1s/etc1s_read_selector_codebook.d.ts.map +0 -1
  880. package/src/basis/etc1s/etc1s_read_slice_tables.d.ts.map +0 -1
  881. package/src/basis/transcode/etc1s_to_bc1.d.ts +0 -24
  882. package/src/basis/transcode/etc1s_to_bc1.d.ts.map +0 -1
  883. package/src/basis/transcode/etc1s_to_bc1.js +0 -205
  884. package/src/basis/transcode/etc1s_to_bc7.d.ts +0 -30
  885. package/src/basis/transcode/etc1s_to_bc7.d.ts.map +0 -1
  886. package/src/basis/transcode/fit_endpoints.d.ts +0 -59
  887. package/src/basis/transcode/fit_endpoints.d.ts.map +0 -1
  888. package/src/basis/transcode/fit_endpoints.js +0 -226
  889. package/src/engine/asset/loaders/gltf/computeObjectBoundingSphere.d.ts +0 -8
  890. package/src/engine/asset/loaders/gltf/computeObjectBoundingSphere.d.ts.map +0 -1
  891. package/src/engine/asset/loaders/gltf/computeObjectBoundingSphere.js +0 -70
  892. package/src/engine/asset/loaders/gltf/isMesh.d.ts +0 -7
  893. package/src/engine/asset/loaders/gltf/isMesh.d.ts.map +0 -1
  894. package/src/engine/asset/loaders/gltf/isMesh.js +0 -8
  895. package/src/engine/asset/loaders/image/jpeg/JpegFrame.d.ts.map +0 -1
  896. package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.d.ts.map +0 -1
  897. package/src/engine/asset/loaders/image/jpeg/JpegImage.d.ts.map +0 -1
  898. package/src/engine/asset/loaders/image/jpeg/JpegImage.js +0 -664
  899. package/src/engine/asset/loaders/image/jpeg/buildComponentData.d.ts.map +0 -1
  900. package/src/engine/asset/loaders/image/jpeg/buildHuffmanTable.d.ts.map +0 -1
  901. package/src/engine/asset/loaders/image/jpeg/decodeScan.d.ts.map +0 -1
  902. package/src/engine/asset/loaders/image/jpeg/idct8x8_float.d.ts.map +0 -1
  903. package/src/engine/asset/loaders/image/jpeg/idct8x8_float.js +0 -31
  904. package/src/engine/asset/loaders/image/jpeg/jpeg_component_row.d.ts.map +0 -1
  905. package/src/engine/asset/loaders/image/jpeg/jpeg_decode.d.ts.map +0 -1
  906. package/src/engine/asset/loaders/image/png/PNG.d.ts.map +0 -1
  907. package/src/engine/asset/loaders/image/png/PNGReader.d.ts +0 -158
  908. package/src/engine/asset/loaders/image/png/PNGReader.d.ts.map +0 -1
  909. package/src/engine/asset/loaders/image/png/PNGReader.js +0 -656
  910. package/src/engine/asset/loaders/image/png/PNG_HEADER_BYTES.d.ts.map +0 -1
  911. package/src/engine/asset/loaders/image/png/chunk/png_chunk_decode_iTXt.d.ts.map +0 -1
  912. package/src/engine/asset/loaders/image/png/chunk/png_chunk_decode_iTXt.js +0 -53
  913. package/src/engine/asset/loaders/image/png/chunk/png_chunk_decode_zTXt.d.ts.map +0 -1
  914. package/src/engine/asset/loaders/image/png/chunk/png_chunk_decode_zTXt.js +0 -42
  915. package/src/engine/asset/loaders/image/png/crc32.d.ts +0 -2
  916. package/src/engine/asset/loaders/image/png/crc32.d.ts.map +0 -1
  917. package/src/engine/asset/loaders/image/png/crc32.js +0 -8
  918. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterAverage.d.ts.map +0 -1
  919. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.d.ts.map +0 -1
  920. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterPaeth.d.ts.map +0 -1
  921. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterSub.d.ts.map +0 -1
  922. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterUp.d.ts.map +0 -1
  923. package/src/engine/asset/loaders/image/png/filter/png_unfilter.d.ts.map +0 -1
  924. package/src/engine/asset/loaders/image/png/filter/png_unfilter.js +0 -68
  925. package/src/engine/asset/loaders/image/png/png_inflate.d.ts.map +0 -1
  926. package/src/engine/asset/loaders/image/png/png_unpack_samples.d.ts.map +0 -1
  927. package/src/engine/asset/loaders/image/png/prototypePNG.d.ts.map +0 -1
  928. package/src/engine/asset/loaders/image/png/prototypePNG.js +0 -37
  929. package/src/ktx2/KTX2_IDENTIFIER.d.ts.map +0 -1
  930. package/src/ktx2/KhrDfModel.d.ts.map +0 -1
  931. package/src/ktx2/SupercompressionScheme.d.ts.map +0 -1
  932. package/src/ktx2/ktx2_read.d.ts +0 -71
  933. package/src/ktx2/ktx2_read.d.ts.map +0 -1
  934. package/src/ktx2/ktx2_read.js +0 -581
  935. package/src/ktx2/ktx2_read_basis_lz_global_data.d.ts +0 -27
  936. package/src/ktx2/ktx2_read_basis_lz_global_data.d.ts.map +0 -1
  937. package/src/ktx2/ktx2_read_basis_lz_global_data.js +0 -189
  938. package/src/ktx2/vk_format_to_texture_format.d.ts +0 -55
  939. package/src/ktx2/vk_format_to_texture_format.d.ts.map +0 -1
  940. package/src/ktx2/vk_format_to_texture_format.js +0 -290
  941. package/src/shade/renderer/geometry/bvh/record_blas_refit.d.ts +0 -25
  942. package/src/shade/renderer/geometry/bvh/record_blas_refit.d.ts.map +0 -1
  943. package/src/shade/renderer/geometry/bvh/record_blas_refit.js +0 -102
  944. package/src/shade/renderer/geometry/bvh/shader_blas_refit_leaf_bounds.d.ts +0 -30
  945. package/src/shade/renderer/geometry/bvh/shader_blas_refit_leaf_bounds.d.ts.map +0 -1
  946. package/src/shade/renderer/geometry/bvh/shader_blas_refit_leaf_bounds.js +0 -125
  947. package/src/shade/renderer/loader/gltf/GLTF_PRIMITIVE_MODE.d.ts.map +0 -1
  948. package/src/shade/renderer/loader/gltf/MESHOPT_COMPRESSION_PLAN.md +0 -793
  949. package/src/shade/renderer/loader/gltf/coalesce_array_duplicates.d.ts.map +0 -1
  950. package/src/shade/renderer/loader/gltf/ext/GltfBufferViewExtension.d.ts.map +0 -1
  951. package/src/shade/renderer/loader/gltf/ext/GltfBufferViewExtensionSet.d.ts.map +0 -1
  952. package/src/shade/renderer/loader/gltf/ext/GltfBufferViewExtensionSet.js +0 -109
  953. package/src/shade/renderer/loader/gltf/ext/gltf_apply_buffer_view_extensions.d.ts.map +0 -1
  954. package/src/shade/renderer/loader/gltf/ext/gltf_buffer_view_extensions.d.ts.map +0 -1
  955. package/src/shade/renderer/loader/gltf/ext/gltf_geometry_extensions.d.ts.map +0 -1
  956. package/src/shade/renderer/loader/gltf/ext/meshopt/MeshoptBufferViewExtension.d.ts.map +0 -1
  957. package/src/shade/renderer/loader/gltf/ext/meshopt/MeshoptBufferViewExtension.js +0 -301
  958. package/src/shade/renderer/loader/gltf/gltf_component_type.d.ts.map +0 -1
  959. package/src/shade/renderer/loader/gltf/gltf_node_world_matrices.d.ts.map +0 -1
  960. package/src/shade/renderer/loader/gltf/gltf_node_world_matrices.js +0 -137
  961. package/src/shade/renderer/loader/gltf/gltf_parse_container.d.ts.map +0 -1
  962. package/src/shade/renderer/loader/gltf/gltf_read_accessor.d.ts.map +0 -1
  963. package/src/shade/renderer/loader/gltf/gltf_read_accessor.js +0 -294
  964. package/src/shade/renderer/loader/gltf/gltf_used_image_indices.d.ts +0 -25
  965. package/src/shade/renderer/loader/gltf/gltf_used_image_indices.d.ts.map +0 -1
  966. package/src/shade/renderer/loader/gltf/gltf_used_image_indices.js +0 -49
  967. package/src/shade/renderer/loader/usd/UsdError.d.ts.map +0 -1
  968. package/src/shade/renderer/loader/usd/parse_usda.d.ts.map +0 -1
  969. package/src/shade/renderer/loader/usd/unpack_usdz.d.ts.map +0 -1
  970. package/src/shade/renderer/loader/usd/unpack_usdz.js +0 -106
  971. package/src/shade/renderer/loader/usd/usd_compose_transform.d.ts.map +0 -1
  972. package/src/shade/renderer/loader/usd/usd_compose_transform.js +0 -258
  973. package/src/shade/renderer/loader/usd/usd_lz4.d.ts.map +0 -1
  974. package/src/shade/renderer/loader/usd/usd_lz4.js +0 -182
  975. package/src/shade/renderer/loader/usd/usd_triangulate.d.ts.map +0 -1
  976. package/src/shade/renderer/particles/prototypeParticleSystem.d.ts +0 -2
  977. package/src/shade/renderer/particles/prototypeParticleSystem.d.ts.map +0 -1
  978. package/src/shade/renderer/particles/prototypeParticleSystem.js +0 -448
  979. package/src/shade/renderer/postprocess/taa/chunk_taa_sample_history_color.d.ts +0 -2
  980. package/src/shade/renderer/postprocess/taa/chunk_taa_sample_history_color.d.ts.map +0 -1
  981. package/src/shade/renderer/postprocess/taa/chunk_taa_sample_history_color.js +0 -43
  982. package/src/shade/renderer/scene/optimization/sampler2d_compare.d.ts.map +0 -1
  983. package/src/shade/renderer/scene/optimization/sampler2d_compare.js +0 -94
  984. /package/src/{avif → engine/asset/loaders/image/avif}/encoder_worker.d.ts +0 -0
  985. /package/src/{avif → engine/asset/loaders/image/avif}/encoder_worker.js +0 -0
  986. /package/src/{avif → engine/asset/loaders/image/avif}/threaded_image_encoder.d.ts +0 -0
  987. /package/src/{avif → engine/asset/loaders/image/avif}/threaded_image_encoder.js +0 -0
  988. /package/src/engine/asset/loaders/image/{png/prototypePNG.d.ts → prototypePNG.d.ts} +0 -0
  989. /package/src/{shade/renderer/scene/optimization → engine/graphics/texture/sampler/compare}/sampler2d_compare.d.ts +0 -0
  990. /package/src/{avif/native/api → engine/graphics/texture/sampler}/sampler2d_to_avif.d.ts +0 -0
  991. /package/src/{avif/native → format/image/avif}/NOTICE.md +0 -0
  992. /package/src/{avif/native → format/image/avif}/api/AvifDecoder.d.ts +0 -0
  993. /package/src/{avif/native → format/image/avif}/api/AvifDecoder.js +0 -0
  994. /package/src/{avif/native → format/image/avif}/api/apply_transformations.d.ts +0 -0
  995. /package/src/{avif/native → format/image/avif}/api/apply_transformations.js +0 -0
  996. /package/src/{avif/native → format/image/avif}/api/convert_to_rgba.d.ts +0 -0
  997. /package/src/{avif/native → format/image/avif}/api/decode_avif.d.ts +0 -0
  998. /package/src/{avif/native → format/image/avif}/api/decode_avif.js +0 -0
  999. /package/src/{avif/native → format/image/avif}/api/decode_image_item.d.ts +0 -0
  1000. /package/src/{avif/native → format/image/avif}/api/decode_image_item.js +0 -0
  1001. /package/src/{avif/native → format/image/avif}/api/encode_avif.d.ts +0 -0
  1002. /package/src/{avif/native → format/image/avif}/api/encode_avif.js +0 -0
  1003. /package/src/{avif/native → format/image/avif}/av1/decode/Av1FrameContext.d.ts +0 -0
  1004. /package/src/{avif/native → format/image/avif}/av1/decode/Av1FrameContext.js +0 -0
  1005. /package/src/{avif/native → format/image/avif}/av1/decode/block_decoded.d.ts +0 -0
  1006. /package/src/{avif/native → format/image/avif}/av1/decode/block_decoded.js +0 -0
  1007. /package/src/{avif/native → format/image/avif}/av1/decode/decode_av1_still.d.ts +0 -0
  1008. /package/src/{avif/native → format/image/avif}/av1/decode/decode_av1_still.js +0 -0
  1009. /package/src/{avif/native → format/image/avif}/av1/decode/decode_coefficients.d.ts +0 -0
  1010. /package/src/{avif/native → format/image/avif}/av1/decode/decode_coefficients.js +0 -0
  1011. /package/src/{avif/native → format/image/avif}/av1/decode/decode_palette.d.ts +0 -0
  1012. /package/src/{avif/native → format/image/avif}/av1/decode/decode_tile.d.ts +0 -0
  1013. /package/src/{avif/native → format/image/avif}/av1/decode/get_scan.d.ts +0 -0
  1014. /package/src/{avif/native → format/image/avif}/av1/decode/get_scan.js +0 -0
  1015. /package/src/{avif/native → format/image/avif}/av1/decode/read_lr.d.ts +0 -0
  1016. /package/src/{avif/native → format/image/avif}/av1/decode/read_transform_type.d.ts +0 -0
  1017. /package/src/{avif/native → format/image/avif}/av1/decode/reconstruct.d.ts +0 -0
  1018. /package/src/{avif/native → format/image/avif}/av1/decode/transform_type.d.ts +0 -0
  1019. /package/src/{avif/native → format/image/avif}/av1/decode/transform_type.js +0 -0
  1020. /package/src/{avif/native → format/image/avif}/av1/encode/Av1BlockSnapshot.d.ts +0 -0
  1021. /package/src/{avif/native → format/image/avif}/av1/encode/Av1BlockSnapshot.js +0 -0
  1022. /package/src/{avif/native → format/image/avif}/av1/encode/Av1EncodeContext.d.ts +0 -0
  1023. /package/src/{avif/native → format/image/avif}/av1/encode/Av1EncodeContext.js +0 -0
  1024. /package/src/{avif/native → format/image/avif}/av1/encode/build_headers.d.ts +0 -0
  1025. /package/src/{avif/native → format/image/avif}/av1/encode/build_headers.js +0 -0
  1026. /package/src/{avif/native → format/image/avif}/av1/encode/choose_chroma_alpha.d.ts +0 -0
  1027. /package/src/{avif/native → format/image/avif}/av1/encode/choose_chroma_alpha.js +0 -0
  1028. /package/src/{avif/native → format/image/avif}/av1/encode/choose_filters.d.ts +0 -0
  1029. /package/src/{avif/native → format/image/avif}/av1/encode/choose_filters.js +0 -0
  1030. /package/src/{avif/native → format/image/avif}/av1/encode/choose_restoration.d.ts +0 -0
  1031. /package/src/{avif/native → format/image/avif}/av1/encode/decode_effort.d.ts +0 -0
  1032. /package/src/{avif/native → format/image/avif}/av1/encode/decode_effort.js +0 -0
  1033. /package/src/{avif/native → format/image/avif}/av1/encode/encode_av1_still.d.ts +0 -0
  1034. /package/src/{avif/native → format/image/avif}/av1/encode/encode_av1_still.js +0 -0
  1035. /package/src/{avif/native → format/image/avif}/av1/encode/encode_effort.d.ts +0 -0
  1036. /package/src/{avif/native → format/image/avif}/av1/encode/encode_effort.js +0 -0
  1037. /package/src/{avif/native → format/image/avif}/av1/encode/encode_tile.d.ts +0 -0
  1038. /package/src/{avif/native → format/image/avif}/av1/encode/quantise.d.ts +0 -0
  1039. /package/src/{avif/native → format/image/avif}/av1/encode/quantise.js +0 -0
  1040. /package/src/{avif/native → format/image/avif}/av1/encode/write_coefficients.d.ts +0 -0
  1041. /package/src/{avif/native → format/image/avif}/av1/encode/write_coefficients.js +0 -0
  1042. /package/src/{avif/native → format/image/avif}/av1/encode/write_lr.d.ts +0 -0
  1043. /package/src/{avif/native → format/image/avif}/av1/encode/write_lr.js +0 -0
  1044. /package/src/{avif/native → format/image/avif}/av1/encode/write_transform_type.d.ts +0 -0
  1045. /package/src/{avif/native → format/image/avif}/av1/encode/write_transform_type.js +0 -0
  1046. /package/src/{avif/native → format/image/avif}/av1/entropy/CdfContext.d.ts +0 -0
  1047. /package/src/{avif/native → format/image/avif}/av1/entropy/CdfContext.js +0 -0
  1048. /package/src/{avif/native → format/image/avif}/av1/entropy/SymbolReader.d.ts +0 -0
  1049. /package/src/{avif/native → format/image/avif}/av1/entropy/SymbolReader.js +0 -0
  1050. /package/src/{avif/native → format/image/avif}/av1/entropy/SymbolWriter.d.ts +0 -0
  1051. /package/src/{avif/native → format/image/avif}/av1/entropy/SymbolWriter.js +0 -0
  1052. /package/src/{avif/native → format/image/avif}/av1/entropy/coefficient_context.d.ts +0 -0
  1053. /package/src/{avif/native → format/image/avif}/av1/entropy/coefficient_context.js +0 -0
  1054. /package/src/{avif/native → format/image/avif}/av1/entropy/partition_cdf.d.ts +0 -0
  1055. /package/src/{avif/native → format/image/avif}/av1/entropy/partition_cdf.js +0 -0
  1056. /package/src/{avif/native → format/image/avif}/av1/entropy/symbol_cost.d.ts +0 -0
  1057. /package/src/{avif/native → format/image/avif}/av1/entropy/symbol_cost.js +0 -0
  1058. /package/src/{avif/native → format/image/avif}/av1/filter/cdef.d.ts +0 -0
  1059. /package/src/{avif/native → format/image/avif}/av1/filter/loop_filter.d.ts +0 -0
  1060. /package/src/{avif/native → format/image/avif}/av1/filter/loop_restoration.d.ts +0 -0
  1061. /package/src/{avif/native → format/image/avif}/av1/filter/superres.d.ts +0 -0
  1062. /package/src/{avif/native → format/image/avif}/av1/grain/FilmGrainState.d.ts +0 -0
  1063. /package/src/{avif/native → format/image/avif}/av1/grain/FilmGrainState.js +0 -0
  1064. /package/src/{avif/native → format/image/avif}/av1/grain/film_grain.d.ts +0 -0
  1065. /package/src/{avif/native → format/image/avif}/av1/obu/FrameHeader.d.ts +0 -0
  1066. /package/src/{avif/native → format/image/avif}/av1/obu/FrameHeader.js +0 -0
  1067. /package/src/{avif/native → format/image/avif}/av1/obu/ObuHeader.d.ts +0 -0
  1068. /package/src/{avif/native → format/image/avif}/av1/obu/ObuHeader.js +0 -0
  1069. /package/src/{avif/native → format/image/avif}/av1/obu/SequenceHeader.d.ts +0 -0
  1070. /package/src/{avif/native → format/image/avif}/av1/obu/SequenceHeader.js +0 -0
  1071. /package/src/{avif/native → format/image/avif}/av1/obu/for_each_obu.d.ts +0 -0
  1072. /package/src/{avif/native → format/image/avif}/av1/obu/for_each_obu.js +0 -0
  1073. /package/src/{avif/native → format/image/avif}/av1/obu/parse_frame_header.d.ts +0 -0
  1074. /package/src/{avif/native → format/image/avif}/av1/obu/parse_obu_header.d.ts +0 -0
  1075. /package/src/{avif/native → format/image/avif}/av1/obu/parse_obu_header.js +0 -0
  1076. /package/src/{avif/native → format/image/avif}/av1/obu/parse_sequence_header.d.ts +0 -0
  1077. /package/src/{avif/native → format/image/avif}/av1/obu/parse_sequence_header.js +0 -0
  1078. /package/src/{avif/native → format/image/avif}/av1/obu/write_frame_header.d.ts +0 -0
  1079. /package/src/{avif/native → format/image/avif}/av1/obu/write_frame_header.js +0 -0
  1080. /package/src/{avif/native → format/image/avif}/av1/obu/write_sequence_header.d.ts +0 -0
  1081. /package/src/{avif/native → format/image/avif}/av1/obu/write_sequence_header.js +0 -0
  1082. /package/src/{avif/native → format/image/avif}/av1/predict/IntraPredictionState.d.ts +0 -0
  1083. /package/src/{avif/native → format/image/avif}/av1/predict/IntraPredictionState.js +0 -0
  1084. /package/src/{avif/native → format/image/avif}/av1/predict/intra_filter_type.d.ts +0 -0
  1085. /package/src/{avif/native → format/image/avif}/av1/predict/intra_filter_type.js +0 -0
  1086. /package/src/{avif/native → format/image/avif}/av1/predict/predict_chroma_from_luma.d.ts +0 -0
  1087. /package/src/{avif/native → format/image/avif}/av1/predict/predict_intra.d.ts +0 -0
  1088. /package/src/{avif/native → format/image/avif}/av1/predict/predict_palette.d.ts +0 -0
  1089. /package/src/{avif/native → format/image/avif}/av1/predict/predict_palette.js +0 -0
  1090. /package/src/{avif/native → format/image/avif}/av1/tables/av1_symbols.d.ts +0 -0
  1091. /package/src/{avif/native → format/image/avif}/av1/tables/block_tables.d.ts +0 -0
  1092. /package/src/{avif/native → format/image/avif}/av1/tables/cdf_tables.d.ts +0 -0
  1093. /package/src/{avif/native → format/image/avif}/av1/tables/coefficient_tables.d.ts +0 -0
  1094. /package/src/{avif/native → format/image/avif}/av1/tables/derived_block_tables.d.ts +0 -0
  1095. /package/src/{avif/native → format/image/avif}/av1/tables/derived_block_tables.js +0 -0
  1096. /package/src/{avif/native → format/image/avif}/av1/tables/filter_tables.d.ts +0 -0
  1097. /package/src/{avif/native → format/image/avif}/av1/tables/grain_tables.d.ts +0 -0
  1098. /package/src/{avif/native → format/image/avif}/av1/tables/prediction_tables.d.ts +0 -0
  1099. /package/src/{avif/native → format/image/avif}/av1/tables/quantizer_matrix_tables.d.ts +0 -0
  1100. /package/src/{avif/native → format/image/avif}/av1/tables/quantizer_tables.d.ts +0 -0
  1101. /package/src/{avif/native → format/image/avif}/av1/tables/scan_tables.d.ts +0 -0
  1102. /package/src/{avif/native → format/image/avif}/av1/tables/segmentation_tables.d.ts +0 -0
  1103. /package/src/{avif/native → format/image/avif}/av1/tables/transform_tables.d.ts +0 -0
  1104. /package/src/{avif/native → format/image/avif}/av1/tables/unpack_table.d.ts +0 -0
  1105. /package/src/{avif/native → format/image/avif}/av1/transform/forward_transform_2d.d.ts +0 -0
  1106. /package/src/{avif/native → format/image/avif}/av1/transform/forward_transform_2d.js +0 -0
  1107. /package/src/{avif/native → format/image/avif}/av1/transform/inverse_transform_1d.d.ts +0 -0
  1108. /package/src/{avif/native → format/image/avif}/av1/transform/inverse_transform_2d.d.ts +0 -0
  1109. /package/src/{avif/native → format/image/avif}/av1/util/ceil_log2.d.ts +0 -0
  1110. /package/src/{avif/native → format/image/avif}/av1/util/ceil_log2.js +0 -0
  1111. /package/src/{avif/native → format/image/avif}/av1/util/round2.d.ts +0 -0
  1112. /package/src/{avif/native → format/image/avif}/av1/util/round2.js +0 -0
  1113. /package/src/{avif/native → format/image/avif}/av1/util/round2_signed.d.ts +0 -0
  1114. /package/src/{avif/native → format/image/avif}/av1/util/round2_signed.js +0 -0
  1115. /package/src/{avif/native → format/image/avif}/av1/util/tile_log2.d.ts +0 -0
  1116. /package/src/{avif/native → format/image/avif}/av1/util/tile_log2.js +0 -0
  1117. /package/src/{avif/native → format/image/avif}/bitstream/BitReader.d.ts +0 -0
  1118. /package/src/{avif/native → format/image/avif}/bitstream/BitReader.js +0 -0
  1119. /package/src/{avif/native → format/image/avif}/bitstream/BitWriter.d.ts +0 -0
  1120. /package/src/{avif/native → format/image/avif}/bitstream/BitWriter.js +0 -0
  1121. /package/src/{avif/native → format/image/avif}/color/ColourTransform.d.ts +0 -0
  1122. /package/src/{avif/native → format/image/avif}/color/ColourTransform.js +0 -0
  1123. /package/src/{avif/native → format/image/avif}/color/YuvImage.d.ts +0 -0
  1124. /package/src/{avif/native → format/image/avif}/color/YuvImage.js +0 -0
  1125. /package/src/{avif/native → format/image/avif}/color/clamp_sample.d.ts +0 -0
  1126. /package/src/{avif/native → format/image/avif}/color/clamp_sample.js +0 -0
  1127. /package/src/{avif/native → format/image/avif}/color/linear_to_transfer.d.ts +0 -0
  1128. /package/src/{avif/native → format/image/avif}/color/primaries.d.ts +0 -0
  1129. /package/src/{avif/native → format/image/avif}/color/primaries.js +0 -0
  1130. /package/src/{avif/native → format/image/avif}/color/rgb_row_to_ycbcr.d.ts +0 -0
  1131. /package/src/{avif/native → format/image/avif}/color/rgb_row_to_ycbcr.js +0 -0
  1132. /package/src/{avif/native → format/image/avif}/color/transfer_to_linear.d.ts +0 -0
  1133. /package/src/{avif/native → format/image/avif}/color/upsample_chroma_row.d.ts +0 -0
  1134. /package/src/{avif/native → format/image/avif}/color/ycbcr_row_to_rgb.d.ts +0 -0
  1135. /package/src/{avif/native → format/image/avif}/heif/AvifFile.d.ts +0 -0
  1136. /package/src/{avif/native → format/image/avif}/heif/AvifFile.js +0 -0
  1137. /package/src/{avif/native → format/image/avif}/heif/ItemProperty.d.ts +0 -0
  1138. /package/src/{avif/native → format/image/avif}/heif/ItemProperty.js +0 -0
  1139. /package/src/{avif/native → format/image/avif}/heif/find_item_property.d.ts +0 -0
  1140. /package/src/{avif/native → format/image/avif}/heif/find_item_property.js +0 -0
  1141. /package/src/{avif/native → format/image/avif}/heif/find_item_references.d.ts +0 -0
  1142. /package/src/{avif/native → format/image/avif}/heif/find_item_references.js +0 -0
  1143. /package/src/{avif/native → format/image/avif}/heif/find_items_referencing.d.ts +0 -0
  1144. /package/src/{avif/native → format/image/avif}/heif/find_items_referencing.js +0 -0
  1145. /package/src/{avif/native → format/image/avif}/heif/parse_avif_file.d.ts +0 -0
  1146. /package/src/{avif/native → format/image/avif}/heif/parse_image_grid.d.ts +0 -0
  1147. /package/src/{avif/native → format/image/avif}/heif/parse_item_property.d.ts +0 -0
  1148. /package/src/{avif/native → format/image/avif}/heif/parse_item_property.js +0 -0
  1149. /package/src/{avif/native → format/image/avif}/heif/read_item_data.d.ts +0 -0
  1150. /package/src/{avif/native → format/image/avif}/heif/read_item_data.js +0 -0
  1151. /package/src/{avif/native → format/image/avif}/heif/write_avif_file.d.ts +0 -0
  1152. /package/src/{avif/native → format/image/avif}/heif/write_avif_file.js +0 -0
  1153. /package/src/{avif/native → format/image/avif}/heif/write_item_property.d.ts +0 -0
  1154. /package/src/{avif/native → format/image/avif}/heif/write_item_property.js +0 -0
  1155. /package/src/{avif/native → format/image/avif}/isobmff/BoxHeader.d.ts +0 -0
  1156. /package/src/{avif/native → format/image/avif}/isobmff/BoxHeader.js +0 -0
  1157. /package/src/{avif/native → format/image/avif}/isobmff/for_each_box.d.ts +0 -0
  1158. /package/src/{avif/native → format/image/avif}/isobmff/for_each_box.js +0 -0
  1159. /package/src/{avif/native → format/image/avif}/isobmff/read_box_header.d.ts +0 -0
  1160. /package/src/{avif/native → format/image/avif}/isobmff/read_box_header.js +0 -0
  1161. /package/src/{avif/native → format/image/avif}/isobmff/read_full_box_header.d.ts +0 -0
  1162. /package/src/{avif/native → format/image/avif}/isobmff/read_full_box_header.js +0 -0
  1163. /package/src/{engine/asset/loaders → format}/image/jpeg/JpegFrame.d.ts +0 -0
  1164. /package/src/{engine/asset/loaders → format}/image/jpeg/JpegFrame.js +0 -0
  1165. /package/src/{engine/asset/loaders → format}/image/jpeg/JpegFrameComponent.d.ts +0 -0
  1166. /package/src/{engine/asset/loaders → format}/image/jpeg/JpegFrameComponent.js +0 -0
  1167. /package/src/{engine/asset/loaders → format}/image/jpeg/JpegImage.d.ts +0 -0
  1168. /package/src/{engine/asset/loaders → format}/image/jpeg/NOTES.md +0 -0
  1169. /package/src/{engine/asset/loaders → format}/image/jpeg/buildComponentData.d.ts +0 -0
  1170. /package/src/{engine/asset/loaders → format}/image/jpeg/buildComponentData.js +0 -0
  1171. /package/src/{engine/asset/loaders → format}/image/jpeg/buildHuffmanTable.d.ts +0 -0
  1172. /package/src/{engine/asset/loaders → format}/image/jpeg/buildHuffmanTable.js +0 -0
  1173. /package/src/{engine/asset/loaders → format}/image/jpeg/decodeScan.d.ts +0 -0
  1174. /package/src/{engine/asset/loaders → format}/image/jpeg/decodeScan.js +0 -0
  1175. /package/src/{engine/asset/loaders → format}/image/jpeg/idct8x8_float.d.ts +0 -0
  1176. /package/src/{engine/asset/loaders → format}/image/jpeg/jpeg_component_row.d.ts +0 -0
  1177. /package/src/{engine/asset/loaders → format}/image/jpeg/jpeg_component_row.js +0 -0
  1178. /package/src/{engine/asset/loaders → format}/image/jpeg/jpeg_decode.d.ts +0 -0
  1179. /package/src/{engine/asset/loaders → format}/image/jpeg/jpeg_decode.js +0 -0
  1180. /package/src/{engine/asset/loaders → format}/image/png/PNG.d.ts +0 -0
  1181. /package/src/{engine/asset/loaders → format}/image/png/PNG.js +0 -0
  1182. /package/src/{engine/asset/loaders → format}/image/png/PNG_HEADER_BYTES.d.ts +0 -0
  1183. /package/src/{engine/asset/loaders → format}/image/png/PNG_HEADER_BYTES.js +0 -0
  1184. /package/src/{engine/asset/loaders → format}/image/png/chunk/png_chunk_decode_iTXt.d.ts +0 -0
  1185. /package/src/{engine/asset/loaders → format}/image/png/chunk/png_chunk_decode_zTXt.d.ts +0 -0
  1186. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterAverage.d.ts +0 -0
  1187. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterAverage.js +0 -0
  1188. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterNone.d.ts +0 -0
  1189. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterNone.js +0 -0
  1190. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterPaeth.d.ts +0 -0
  1191. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterPaeth.js +0 -0
  1192. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterSub.d.ts +0 -0
  1193. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterSub.js +0 -0
  1194. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterUp.d.ts +0 -0
  1195. /package/src/{engine/asset/loaders → format}/image/png/filter/png_filter_unFilterUp.js +0 -0
  1196. /package/src/{engine/asset/loaders → format}/image/png/filter/png_unfilter.d.ts +0 -0
  1197. /package/src/{engine/asset/loaders → format}/image/png/png_inflate.d.ts +0 -0
  1198. /package/src/{engine/asset/loaders → format}/image/png/png_inflate.js +0 -0
  1199. /package/src/{engine/asset/loaders → format}/image/png/png_unpack_samples.d.ts +0 -0
  1200. /package/src/{engine/asset/loaders → format}/image/png/png_unpack_samples.js +0 -0
  1201. /package/src/{shade/renderer/loader → format/scene}/gltf/GLTF_PRIMITIVE_MODE.d.ts +0 -0
  1202. /package/src/{shade/renderer/loader → format/scene}/gltf/GLTF_PRIMITIVE_MODE.js +0 -0
  1203. /package/src/{shade/renderer/loader → format/scene}/gltf/coalesce_array_duplicates.d.ts +0 -0
  1204. /package/src/{shade/renderer/loader → format/scene}/gltf/coalesce_array_duplicates.js +0 -0
  1205. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/GltfBufferViewExtension.d.ts +0 -0
  1206. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/GltfBufferViewExtension.js +0 -0
  1207. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/GltfBufferViewExtensionSet.d.ts +0 -0
  1208. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/gltf_apply_buffer_view_extensions.d.ts +0 -0
  1209. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/gltf_apply_buffer_view_extensions.js +0 -0
  1210. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/gltf_buffer_view_extensions.d.ts +0 -0
  1211. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/gltf_buffer_view_extensions.js +0 -0
  1212. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/gltf_geometry_extensions.d.ts +0 -0
  1213. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/gltf_geometry_extensions.js +0 -0
  1214. /package/src/{shade/renderer/loader → format/scene}/gltf/ext/meshopt/MeshoptBufferViewExtension.d.ts +0 -0
  1215. /package/src/{shade/renderer/loader → format/scene}/gltf/gltf_component_type.d.ts +0 -0
  1216. /package/src/{shade/renderer/loader → format/scene}/gltf/gltf_component_type.js +0 -0
  1217. /package/src/{shade/renderer/loader → format/scene}/gltf/gltf_node_world_matrices.d.ts +0 -0
  1218. /package/src/{shade/renderer/loader → format/scene}/gltf/gltf_parse_container.d.ts +0 -0
  1219. /package/src/{shade/renderer/loader → format/scene}/gltf/gltf_parse_container.js +0 -0
  1220. /package/src/{shade/renderer/loader → format/scene}/gltf/gltf_read_accessor.d.ts +0 -0
  1221. /package/src/{shade/renderer/loader → format/scene}/usd/UsdError.d.ts +0 -0
  1222. /package/src/{shade/renderer/loader → format/scene}/usd/UsdError.js +0 -0
  1223. /package/src/{shade/renderer/loader → format/scene}/usd/parse_usda.d.ts +0 -0
  1224. /package/src/{shade/renderer/loader → format/scene}/usd/parse_usda.js +0 -0
  1225. /package/src/{shade/renderer/loader → format/scene}/usd/unpack_usdz.d.ts +0 -0
  1226. /package/src/{shade/renderer/loader → format/scene}/usd/usd_compose_transform.d.ts +0 -0
  1227. /package/src/{shade/renderer/loader → format/scene}/usd/usd_lz4.d.ts +0 -0
  1228. /package/src/{shade/renderer/loader → format/scene}/usd/usd_triangulate.d.ts +0 -0
  1229. /package/src/{shade/renderer/loader → format/scene}/usd/usd_triangulate.js +0 -0
  1230. /package/src/{basis → format/texture/basis}/BasisHuffmanTable.d.ts +0 -0
  1231. /package/src/{basis → format/texture/basis}/BasisHuffmanTable.js +0 -0
  1232. /package/src/{basis → format/texture/basis}/basis_read_huffman_table.d.ts +0 -0
  1233. /package/src/{basis → format/texture/basis}/basis_read_huffman_table.js +0 -0
  1234. /package/src/{basis → format/texture/basis}/etc1s/Etc1sSelectorHistory.d.ts +0 -0
  1235. /package/src/{basis → format/texture/basis}/etc1s/Etc1sSelectorHistory.js +0 -0
  1236. /package/src/{basis → format/texture/basis}/etc1s/etc1s_block_colors.d.ts +0 -0
  1237. /package/src/{basis → format/texture/basis}/etc1s/etc1s_block_colors.js +0 -0
  1238. /package/src/{basis → format/texture/basis}/etc1s/etc1s_decode_slice.d.ts +0 -0
  1239. /package/src/{basis → format/texture/basis}/etc1s/etc1s_read_endpoint_codebook.d.ts +0 -0
  1240. /package/src/{basis → format/texture/basis}/etc1s/etc1s_read_endpoint_codebook.js +0 -0
  1241. /package/src/{basis → format/texture/basis}/etc1s/etc1s_read_selector_codebook.d.ts +0 -0
  1242. /package/src/{basis → format/texture/basis}/etc1s/etc1s_read_selector_codebook.js +0 -0
  1243. /package/src/{basis → format/texture/basis}/etc1s/etc1s_read_slice_tables.d.ts +0 -0
  1244. /package/src/{basis → format/texture/basis}/etc1s/etc1s_read_slice_tables.js +0 -0
  1245. /package/src/{basis → format/texture/basis}/transcode/build_range_plan.js +0 -0
  1246. /package/src/{basis → format/texture/basis}/transcode/etc1s_to_bc7.js +0 -0
  1247. /package/src/{ktx2 → format/texture/ktx2}/KTX2_IDENTIFIER.d.ts +0 -0
  1248. /package/src/{ktx2 → format/texture/ktx2}/KTX2_IDENTIFIER.js +0 -0
  1249. /package/src/{ktx2 → format/texture/ktx2}/KhrDfModel.d.ts +0 -0
  1250. /package/src/{ktx2 → format/texture/ktx2}/KhrDfModel.js +0 -0
  1251. /package/src/{ktx2 → format/texture/ktx2}/SupercompressionScheme.d.ts +0 -0
  1252. /package/src/{ktx2 → format/texture/ktx2}/SupercompressionScheme.js +0 -0
@@ -1,646 +1,837 @@
1
- import { gltf_apply_buffer_view_extensions } from "./ext/gltf_apply_buffer_view_extensions.js";
2
- import { GLTF_BUFFER_VIEW_EXTENSIONS } from "./ext/gltf_buffer_view_extensions.js";
3
- import { gltf_node_world_matrices, gltf_root_nodes } from "./gltf_node_world_matrices.js";
4
- import { gltf_parse_container, gltf_require_supported_version } from "./gltf_parse_container.js";
5
- import { gltf_used_image_indices } from "./gltf_used_image_indices.js";
6
- /**
7
- * TinyGltf
8
- * Loads glTF 2.0 file, resolves buffer and image dependencies, and computes node world transforms and aabbs.
9
- * This is a VERY simplified glTF loader that avoids doing too much work for you.
10
- * It should generally not be used outside of simple tutorials or examples.
11
- *
12
- * What it adds over the container-level readers beside it is **resolution**: buffers and images are
13
- * fetched through the {@link AssetManager}, decoded, and written back into the document. Splitting
14
- * the container, reading an accessor and walking the node graph are all questions of the format
15
- * rather than of where the bytes come from, and live in their own modules so that a caller with no
16
- * asset framework - the virtual-geometry builder, running under node - can use them too.
17
- */
18
-
19
- import { assert } from "../../../../core/assert.js";
20
- import { aabb3_array_combine } from "../../../../core/geom/3d/aabb/aabb3_array_combine.js";
21
- import { aabb3_array_set } from "../../../../core/geom/3d/aabb/aabb3_array_set.js";
22
- import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
23
- import { m4_normal_matrix3 } from "../../../../core/geom/3d/mat4/m4_normal_matrix3.js";
24
- import { GameAssetType } from "../../../../engine/asset/GameAssetType.js";
25
-
26
- /**
27
- * glTF's default texture wrap mode, by its own number.
28
- * @type {number}
29
- */
30
- const GLTF_WRAP_REPEAT = 10497;
31
-
32
- /**
33
- * What a buffer the file never wrote resolves to - a placeholder some extension declares.
34
- * Zero length rather than the declared one: a well-formed file reads none of it, and a malformed one
35
- * fails loudly on the first accessor instead of quietly rendering a megabyte of zeroes.
36
- * @type {Uint8Array}
37
- */
38
- const EMPTY_BUFFER = new Uint8Array(0);
39
-
40
- const DEFAULT_TRANSLATION = [0, 0, 0];
41
- const DEFAULT_ROTATION = [0, 0, 0, 1];
42
- const DEFAULT_SCALE = [1, 1, 1];
43
-
44
- /**
45
- * A URI that names its own scheme, by RFC 3986's rule for one.
46
- *
47
- * Every scheme rather than the page's: built from `window.location.protocol`, this called an
48
- * `https:` asset on an `http:` page relative — and a `blob:` or a `data:` likewise — and answered it
49
- * with the model's own directory glued to the front.
50
- *
51
- * @type {RegExp}
52
- */
53
- const ABSOLUTE_URI = /^[a-z][a-z0-9+.-]*:/i;
54
-
55
- /**
56
- * Protocol-relative, which names no scheme and is absolute all the same.
57
- * @type {RegExp}
58
- */
59
- const PROTOCOL_RELATIVE_URI = /^\/\//;
60
-
61
- function resolveUri(uri, baseUrl) {
62
- if (ABSOLUTE_URI.test(uri) || PROTOCOL_RELATIVE_URI.test(uri)) {
63
- return uri;
64
- }
65
- return baseUrl + uri;
66
- }
67
-
68
- /**
69
- * A resolved buffer, in the form the document exposes it.
70
- *
71
- * `Uint8Array` rather than `ArrayBuffer` throughout: a buffer is a *range* of bytes, and a `.glb`'s
72
- * binary chunk is a range of the file it arrived in. Carrying the offset with the bytes is what lets
73
- * that chunk be handed on without copying it, and it is the only form an accessor can be read out of
74
- * without caring how the container happened to be aligned.
75
- *
76
- * @param {ArrayBuffer} array_buffer
77
- * @returns {Uint8Array}
78
- */
79
- function as_bytes(array_buffer) {
80
- return new Uint8Array(array_buffer);
81
- }
82
-
83
- /*
84
- Very simple AABB tracking so that we can position cameras sensibly.
85
-
86
- A box is six numbers — `[x0, y0, z0, x1, y1, z1]`, min before max — which is the layout every
87
- `aabb3_*` function in `core/geom/3d/aabb` reads and writes. There is no box object because nothing
88
- downstream asks for one: a mesh, a node and a scene each carry their bounds so that a camera can
89
- be pointed at the model, and the six numbers are the whole of that.
90
- */
91
-
92
- /**
93
- * Scratch for one accessor's authored bounds, read as a box.
94
- *
95
- * Module scope rather than per primitive: it is filled and consumed by two adjacent statements
96
- * of a walk that never awaits, so no second accessor can be in flight while one is being read.
97
- *
98
- * @type {Float64Array}
99
- */
100
- const ACCESSOR_BOUNDS_SCRATCH = new Float64Array(6);
101
-
102
- /**
103
- * A box that bounds nothing, so that the first union with it yields the other operand whole.
104
- *
105
- * The bounds are inverted for that: `+Infinity` min against `-Infinity` max. The class this replaced
106
- * seeded its max with `Number.MIN_VALUE`, which is the smallest *positive* double rather than the most
107
- * negative one a mesh living entirely below the origin came out of it with a max pinned near zero,
108
- * and a box that did not contain the mesh.
109
- *
110
- * `Float64Array` because glTF authors accessor bounds as JSON doubles, and these are combined and
111
- * transformed all the way up the node graph before anyone reads them.
112
- *
113
- * @returns {Float64Array} six numbers, `[x0, y0, z0, x1, y1, z1]`
114
- */
115
- function aabb3_allocate_empty() {
116
- const result = new Float64Array(6);
117
-
118
- aabb3_array_set(
119
- result, 0,
120
- Infinity, Infinity, Infinity,
121
- -Infinity, -Infinity, -Infinity
122
- );
123
-
124
- return result;
125
- }
126
-
127
- /**
128
- * Whether a box bounds anything at all, as opposed to being the empty one {@link aabb3_allocate_empty}
129
- * hands out.
130
- *
131
- * Worth asking before transforming one: the empty box's bounds are infinite, and an infinity met
132
- * by one of the matrix's zeroes is a NaN, which then spreads into every box above it in the graph.
133
- *
134
- * @param {Float64Array|number[]} box six numbers
135
- * @returns {boolean}
136
- */
137
- function aabb3_is_bounded(box) {
138
- return box[0] <= box[3] && box[1] <= box[4] && box[2] <= box[5];
139
- }
140
-
141
-
142
- /**
143
- * Give every node the graph reaches its world matrix and its normal matrix.
144
- *
145
- * @param {{nodes?:object[], scenes?:object[]}} gltf
146
- */
147
- function set_node_matrices(gltf) {
148
- const world_matrices = gltf_node_world_matrices(gltf);
149
-
150
- const nodes = gltf.nodes ?? [];
151
-
152
- for (let index = 0; index < nodes.length; index++) {
153
- const world = world_matrices[index];
154
-
155
- if (world === undefined) {
156
- // a node no root reaches is placed by nothing, and has no world transform to speak of
157
- continue;
158
- }
159
-
160
- const node = nodes[index];
161
-
162
- node.worldMatrix = world;
163
-
164
- /*
165
- The normal matrix — the one that carries a *normal* rather than a point, since a normal does
166
- not ride the transform itself wherever that transform is not a similarity: a non-uniform
167
- scale tilts a surface one way and its normal the other.
168
-
169
- Meep's own primitive, and a 3x3: the cofactor of the linear part, which points where the
170
- inverse transpose points without inverting anything. So it reads no translation (a direction
171
- has no position) and it has an answer for a transform with an axis scaled to nothing, where
172
- an inverse does not exist the gl-matrix code this replaced handed that case's `null`
173
- straight on to `mat4.transpose` and threw. Vectors come out of it unnormalized; that is the
174
- method, not a defect.
175
- */
176
- node.normalMatrix = new Float32Array(9);
177
-
178
- m4_normal_matrix3(node.normalMatrix, world);
179
- }
180
- }
181
-
182
- /**
183
- * The box a mesh's own vertices occupy, in model space, computed once and kept on the mesh.
184
- *
185
- * Read off the accessors' authored bounds rather than the vertex data: the spec requires them on a
186
- * POSITION accessor, and this runs before a single buffer has resolved.
187
- *
188
- * @param {{accessors?:object[]}} gltf
189
- * @param {{primitives:object[], aabb?:Float64Array}} mesh
190
- * @returns {Float64Array} six numbers, and unbounded when no primitive declared any
191
- */
192
- function mesh_bounds(gltf, mesh) {
193
- if (mesh.aabb !== undefined) {
194
- return mesh.aabb;
195
- }
196
-
197
- const result = aabb3_allocate_empty();
198
-
199
- mesh.aabb = result;
200
-
201
- for (const primitive of mesh.primitives) {
202
- const accessor = gltf.accessors[primitive.attributes.POSITION];
203
-
204
- const min = accessor?.min;
205
- const max = accessor?.max;
206
-
207
- /*
208
- The spec requires bounds on a POSITION accessor, and a file that omits them is one this can
209
- say nothing about. A primitive contributing no bounds is a better answer than six NaNs
210
- poisoning every box above it.
211
- */
212
- if (min === undefined || max === undefined || min.length < 3 || max.length < 3) {
213
- continue;
214
- }
215
-
216
- aabb3_array_set(
217
- ACCESSOR_BOUNDS_SCRATCH, 0,
218
- min[0], min[1], min[2],
219
- max[0], max[1], max[2]
220
- );
221
-
222
- aabb3_array_combine(result, 0, result, 0, ACCESSOR_BOUNDS_SCRATCH, 0);
223
- }
224
-
225
- return result;
226
- }
227
-
228
- /**
229
- * Grow whatever box `holder` carries so that it also holds `addition`, giving it one if it had none.
230
- *
231
- * @param {{aabb?:Float64Array}} holder a node or a scene
232
- * @param {Float64Array} addition six numbers
233
- */
234
- function absorb_bounds(holder, addition) {
235
- if (holder.aabb === undefined) {
236
- // a copy: a box aliased to a child's would grow with it
237
- holder.aabb = new Float64Array(addition);
238
-
239
- return;
240
- }
241
-
242
- aabb3_array_combine(holder.aabb, 0, holder.aabb, 0, addition, 0);
243
- }
244
-
245
- /**
246
- * Bound a node in world space by what it places, and by everything below it.
247
- *
248
- * A node reached twice keeps the box of its first visit, the same rule the world matrices follow —
249
- * so the second parent still spans the child, but does not re-walk the subtree under it.
250
- *
251
- * @param {{nodes:object[], meshes?:object[]}} gltf
252
- * @param {number} index
253
- * @param {Set<number>} visited
254
- */
255
- function set_node_bounds(gltf, index, visited) {
256
- if (visited.has(index)) {
257
- return;
258
- }
259
-
260
- visited.add(index);
261
-
262
- const node = gltf.nodes[index];
263
-
264
- if ('mesh' in node) {
265
- const bounds = mesh_bounds(gltf, gltf.meshes[node.mesh]);
266
-
267
- // a mesh whose primitives all declined to declare bounds leaves the node without any
268
- if (aabb3_is_bounded(bounds)) {
269
- // a fresh box, which is also what `aabb3_matrix4_project` requires: it may not alias its input
270
- node.aabb = new Float64Array(6);
271
-
272
- aabb3_matrix4_project(node.aabb, bounds, node.worldMatrix);
273
- }
274
- }
275
-
276
- for (const child_index of node.children ?? []) {
277
- set_node_bounds(gltf, child_index, visited);
278
-
279
- const child = gltf.nodes[child_index];
280
-
281
- if (child.aabb !== undefined) {
282
- absorb_bounds(node, child.aabb);
283
- }
284
- }
285
- }
286
-
287
- /**
288
- * Place every node, and bound every mesh, node and scene.
289
- *
290
- * @param {{nodes?:object[], meshes?:object[], scenes?:object[]}} gltf
291
- */
292
- function place_nodes(gltf) {
293
- set_node_matrices(gltf);
294
-
295
- const visited = new Set();
296
-
297
- // shared across the scenes, so a node two of them list is measured once and spans both
298
- for (const root of gltf_root_nodes(gltf)) {
299
- set_node_bounds(gltf, root, visited);
300
- }
301
-
302
- for (const scene of gltf.scenes ?? []) {
303
- for (const node_index of scene.nodes ?? []) {
304
- const node = gltf.nodes[node_index];
305
-
306
- if (node.aabb !== undefined) {
307
- absorb_bounds(scene, node.aabb);
308
- }
309
- }
310
- }
311
- }
312
-
313
- export class TinyGltf {
314
- loadImageSlots = undefined;
315
-
316
- /**
317
- * The bufferView extensions this parser will honour.
318
- *
319
- * Replaceable so that a caller can add a codec, or take one away, without a loader learning any
320
- * extension's name. The default is shared across the process; assign a
321
- * {@link GltfBufferViewExtensionSet} of your own rather than adding to it if that matters.
322
- *
323
- * @type {GltfBufferViewExtensionSet}
324
- */
325
- bufferViewExtensions = GLTF_BUFFER_VIEW_EXTENSIONS;
326
-
327
- /**
328
- * Optional map of relative file paths to Blob/File/ArrayBuffer objects.
329
- * When set, buffer and image URIs in the GLTF JSON are resolved from this map
330
- * before the asset framework is asked. Enables loading multi-file GLTF bundles from
331
- * drag-and-drop or other in-memory sources.
332
- *
333
- * Keys should match the URI strings in the GLTF JSON (e.g. "scene.bin", "textures/albedo.png").
334
- *
335
- * @type {Map<string, File|Blob|ArrayBuffer>|undefined}
336
- */
337
- fileMap = undefined;
338
-
339
- /**
340
- * Where every byte this parser reads comes from.
341
- *
342
- * A glTF is not one file: the container names buffers and images that live beside it, and a
343
- * level places models that share them. Asking the framework rather than the network is what
344
- * makes a texture two models use one download and one decode, records each request against the
345
- * load that caused it, and cancels the lot when the scene that asked goes away.
346
- *
347
- * @type {AssetManager}
348
- */
349
- #assetManager;
350
-
351
- /**
352
- * The load these requests belong to, or `null` for a caller that is not itself an asset load.
353
- *
354
- * @type {AssetRequestScope|null}
355
- */
356
- #scope;
357
-
358
- /**
359
- * @param {AssetManager} assetManager
360
- * @param {AssetRequestScope} [scope]
361
- */
362
- constructor(assetManager, scope = null) {
363
- assert.defined(assetManager, 'assetManager');
364
-
365
- this.#assetManager = assetManager;
366
- this.#scope = scope;
367
- }
368
-
369
- /**
370
- * The bytes of a file this asset needs, through the framework.
371
- *
372
- * @param {string} path un-resolved, as the manager takes it
373
- * @param {string} type see {@link GameAssetType}
374
- * @returns {Promise<*>}
375
- */
376
- async #read(path, type) {
377
- const asset = await this.#assetManager.promise(path, type, { scope: this.#scope });
378
-
379
- return asset.create();
380
- }
381
-
382
- /**
383
- * @param {string} url `.gltf` or `.glb`, un-resolved — the manager resolves network paths
384
- * @returns {Promise<TinyGltf>}
385
- */
386
- async loadFromUrl(url) {
387
- assert.isString(url, 'url');
388
-
389
- const i = url.lastIndexOf('/');
390
- const baseUrl = (i !== 0) ? url.substring(0, i + 1) : './';
391
-
392
- /*
393
- The container is read as bytes whatever it is called and told apart by its magic number,
394
- rather than by an extension. One path instead of three, and it is the only one that was ever
395
- correct for a `blob:` url — which is what drag-and-drop produces.
396
- */
397
- const buffer = await this.#read(url, GameAssetType.ArrayBuffer);
398
-
399
- return this.loadFromBinary(buffer, baseUrl);
400
- }
401
-
402
- /**
403
- * Load a container that is already in memory, whichever of the two forms it is in.
404
- *
405
- * @param {ArrayBuffer} arrayBuffer a `.glb`, or the bytes of a `.gltf`
406
- * @param {string} baseUrl
407
- * @return {Promise<{asset}|*>}
408
- */
409
- async loadFromBinary(arrayBuffer, baseUrl) {
410
- const container = gltf_parse_container(new Uint8Array(arrayBuffer));
411
-
412
- return this.loadFromJson(container.json, baseUrl, container.binary_chunk);
413
- }
414
-
415
- /**
416
- *
417
- * @param {{bufferViews,asset,accessors:[],nodes:[],samplers?:[],buffers:[],materials:[], textures:[], images:[],scenes:[]}} json
418
- * @param {string} baseUrl
419
- * @param {Uint8Array} [binaryChunk]
420
- * @return {Promise<{asset}|*>}
421
- */
422
- async loadFromJson(json, baseUrl, binaryChunk = null) {
423
- if (!baseUrl) {
424
- throw new Error('baseUrl must be specified.');
425
- }
426
-
427
- gltf_require_supported_version(json);
428
-
429
- // Resolve defaults for as many properties as we can.
430
- for (const accessor of json.accessors) {
431
- accessor.byteOffset = accessor.byteOffset ?? 0;
432
- accessor.normalized = accessor.normalized ?? false;
433
- }
434
-
435
- for (const bufferView of json.bufferViews) {
436
- bufferView.byteOffset = bufferView.byteOffset ?? 0;
437
- }
438
-
439
- for (const node of json.nodes) {
440
- if (!node.matrix) {
441
- node.rotation = node.rotation ?? DEFAULT_ROTATION;
442
- node.scale = node.scale ?? DEFAULT_SCALE;
443
- node.translation = node.translation ?? DEFAULT_TRANSLATION;
444
- }
445
- }
446
-
447
- if (json.samplers) {
448
- for (const sampler of json.samplers) {
449
- sampler.wrapS = sampler.wrapS ?? GLTF_WRAP_REPEAT;
450
- sampler.wrapT = sampler.wrapT ?? GLTF_WRAP_REPEAT;
451
- }
452
- }
453
-
454
- // Resolve buffers and images first, since these are the only external resources that the file
455
- // might reference.
456
- // Buffers will be exposed as Uint8Arrays.
457
- // Images will be exposed as ImageBitmaps.
458
-
459
- /**
460
- * Buffers
461
- * @type {Promise<Uint8Array>[]}
462
- */
463
- const pendingBuffers = [];
464
-
465
- const declaredBuffers = json.buffers ?? [];
466
-
467
- /*
468
- A .glb's buffer 0 is its binary chunk and names no URI. The buffers after it are ordinary,
469
- and are where an extension that produces its own bufferView bytes puts the placeholder those
470
- views point at - so the chunk is a special case of buffer 0, not a reason to stop looking at
471
- the rest.
472
- */
473
- const bufferCount = Math.max(declaredBuffers.length, binaryChunk ? 1 : 0);
474
-
475
- for (let index = 0; index < bufferCount; index++) {
476
- if (binaryChunk && index === 0) {
477
- pendingBuffers[index] = Promise.resolve(binaryChunk);
478
- continue;
479
- }
480
-
481
- const buffer = declaredBuffers[index];
482
-
483
- /*
484
- A buffer with no URI was never written. Asking for one produced a request for
485
- "<baseUrl>undefined", which is how a compressed .gltf with a fallback buffer - the shape
486
- gltfpack writes - failed before it read a single accessor.
487
- */
488
- if (buffer.uri === undefined || this.bufferViewExtensions.is_placeholder_buffer(buffer)) {
489
- pendingBuffers[index] = Promise.resolve(EMPTY_BUFFER);
490
- continue;
491
- }
492
-
493
- // Check fileMap first (enables loading from dropped files)
494
- if (this.fileMap) {
495
- const file = this.fileMap.get(buffer.uri);
496
-
497
- if (file !== undefined) {
498
- // File or Blob
499
- pendingBuffers[index] = (file instanceof ArrayBuffer)
500
- ? Promise.resolve(new Uint8Array(file))
501
- : file.arrayBuffer().then(as_bytes);
502
-
503
- continue;
504
- }
505
- }
506
-
507
- pendingBuffers[index] = this.#read(
508
- resolveUri(buffer.uri, baseUrl),
509
- GameAssetType.ArrayBuffer
510
- ).then(as_bytes);
511
- }
512
-
513
- // If the loader has been instructed to only load certain images (such as just baseColorTexture)
514
- // then scan through all the materials first and gather the image IDs for only those images.
515
- // (This feature really only makes sense for this specific set of samples.)
516
- let activeImageSet;
517
- if (this.loadImageSlots) {
518
- activeImageSet = new Set();
519
- for (const material of json.materials) {
520
- for (const imageChannel of this.loadImageSlots) {
521
- const texture = material[imageChannel] ?? material.pbrMetallicRoughness[imageChannel];
522
- if (texture !== undefined) {
523
- activeImageSet.add(json.textures[texture.index].source);
524
- }
525
- }
526
- }
527
- } else {
528
- /*
529
- Only the images something will actually sample. A texture may offer the same picture in
530
- several containers `source` plus an extension and fetching the ones this loader has
531
- already decided against is not merely wasted: `createImageBitmap` rejects on a container
532
- the browser cannot decode, and an image nothing was going to sample takes the whole model
533
- down with it. The game's level models each carry a DDS beside their PNG for exactly that
534
- reason, and not one of them loaded.
535
- */
536
- activeImageSet = gltf_used_image_indices(json);
537
- }
538
-
539
- /**
540
- * Images
541
- * @type {Promise<ImageBitmap>[]}
542
- */
543
- const pendingImages = [];
544
- for (let index = 0; index < json.images?.length || 0; ++index) {
545
- if (activeImageSet && !activeImageSet.has(index)) {
546
- continue;
547
- }
548
- const image = json.images[index];
549
-
550
- /**
551
- *
552
- * @param {Blob} blob
553
- * @return {Promise<ImageBitmap>}
554
- */
555
- function blob_to_bitmap(blob) {
556
- return createImageBitmap(blob, {
557
- // premultiplication is done during texture upload
558
- premultiplyAlpha: "none",
559
- })
560
- }
561
-
562
- if (image.uri) {
563
-
564
- // Check fileMap first (enables loading from dropped files)
565
- if (this.fileMap) {
566
- const file = this.fileMap.get(image.uri);
567
-
568
- if (file !== undefined) {
569
- const blob = (file instanceof Blob) ? file : new Blob([file]);
570
- pendingImages[index] = blob_to_bitmap(blob);
571
- continue;
572
- }
573
- }
574
-
575
- /*
576
- Decoded by the framework rather than here, which is what makes one texture shared
577
- by two models one decode instead of two — the expensive half of loading a model is
578
- its images, and a level places the same handful of them hundreds of times.
579
- */
580
- pendingImages[index] = this.#read(
581
- resolveUri(image.uri, baseUrl),
582
- GameAssetType.ImageBitmap
583
- );
584
-
585
- } else {
586
-
587
- const bufferView = json.bufferViews[image.bufferView];
588
-
589
- const claimed = this.bufferViewExtensions.claim(bufferView, image.bufferView);
590
-
591
- if (claimed !== null) {
592
- /*
593
- Legal to write and pointless to: the payload is a PNG or a JPEG, already
594
- compressed. Decoding it is not implemented, and the alternative to saying so is
595
- handing the image decoder a placeholder buffer's bytes.
596
- */
597
- throw new Error(
598
- `images[${index}] is sourced from a bufferView '${claimed.name}' produces,`
599
- + ` which is not supported`
600
- );
601
- }
602
-
603
- pendingImages[index] = pendingBuffers[bufferView.buffer].then((buffer) => {
604
-
605
- const blob = new Blob(
606
- [buffer.subarray(
607
- bufferView.byteOffset,
608
- bufferView.byteOffset + bufferView.byteLength
609
- )],
610
- { type: image.mimeType }
611
- );
612
-
613
- return blob_to_bitmap(blob);
614
- });
615
-
616
- }
617
- }
618
-
619
- // Place every node, and bound every mesh, node and scene, starting at the roots.
620
- place_nodes(json);
621
-
622
- // Replace the resolved resources in the JSON structure.
623
- const buffers = await Promise.all(pendingBuffers);
624
-
625
- /*
626
- Views that some extension produces the bytes for become ordinary ones here, over decoded
627
- buffers appended to the list, so that nothing downstream - accessors, sparse accessors, the
628
- mesh reader - has to know any of those extensions exist. Nor does this parser: it asks the
629
- set what claims a view, and the set is the one place that knows what is implemented.
630
-
631
- Per view, and guarded per view. A file nothing claims - which is nearly all of them - gets
632
- its own view objects back by identity and appends no buffer.
633
- */
634
- json.bufferViews = gltf_apply_buffer_view_extensions(
635
- json.bufferViews, buffers, this.bufferViewExtensions
636
- );
637
-
638
- json.buffers = buffers;
639
- json.images = await Promise.all(pendingImages);
640
-
641
- return json;
642
- }
643
-
644
-
645
- }
646
-
1
+ import { gltf_apply_buffer_view_extensions } from "../../../../format/scene/gltf/ext/gltf_apply_buffer_view_extensions.js";
2
+ import { GLTF_BUFFER_VIEW_EXTENSIONS } from "../../../../format/scene/gltf/ext/gltf_buffer_view_extensions.js";
3
+ import { gltf_node_world_matrices, gltf_root_nodes } from "../../../../format/scene/gltf/gltf_node_world_matrices.js";
4
+ import { gltf_parse_container, gltf_require_supported_version } from "../../../../format/scene/gltf/gltf_parse_container.js";
5
+ import { gltf_basisu_image_indices, gltf_used_image_indices } from "../../../../format/scene/gltf/gltf_used_image_indices.js";
6
+ /**
7
+ * TinyGltf
8
+ * Loads glTF 2.0 file, resolves buffer and image dependencies, and computes node world transforms and aabbs.
9
+ * This is a VERY simplified glTF loader that avoids doing too much work for you.
10
+ * It should generally not be used outside of simple tutorials or examples.
11
+ *
12
+ * What it adds over the container-level readers beside it is **resolution**: buffers and images are
13
+ * fetched through the {@link AssetManager}, decoded, and written back into the document. Splitting
14
+ * the container, reading an accessor and walking the node graph are all questions of the format
15
+ * rather than of where the bytes come from, and live in their own modules so that a caller with no
16
+ * asset framework - the virtual-geometry builder, running under node - can use them too.
17
+ */
18
+
19
+ import { assert } from "../../../../core/assert.js";
20
+ import { aabb3_array_combine } from "../../../../core/geom/3d/aabb/aabb3_array_combine.js";
21
+ import { aabb3_array_set } from "../../../../core/geom/3d/aabb/aabb3_array_set.js";
22
+ import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
23
+ import { m4_normal_matrix3 } from "../../../../core/geom/3d/mat4/m4_normal_matrix3.js";
24
+ import { GameAssetType } from "../../../../engine/asset/GameAssetType.js";
25
+ import { transcode_basis_formats } from "../../../../format/texture/basis/transcode_basis.js";
26
+ import { transcode_uastc_formats } from "../../../../format/texture/basis/transcode_uastc.js";
27
+ import { texture_format_preference } from "../../texture/format/texture_format_preference.js";
28
+ import { gltf_image_roles } from "./gltf_image_roles.js";
29
+ import { texel_data_from_ktx2 } from "../../texture/source/texel_data_from_ktx2.js";
30
+ import { TextureFormat } from "../../../descriptor/texture/format/TextureFormat.js";
31
+
32
+ /**
33
+ * glTF's default texture wrap mode, by its own number.
34
+ * @type {number}
35
+ */
36
+ const GLTF_WRAP_REPEAT = 10497;
37
+
38
+ /**
39
+ * The MIME type a KTX2 image declares.
40
+ *
41
+ * **A supplementary signal, not the authority.** `KHR_texture_basisu` requires it only inside a GLB,
42
+ * where the image comes from a bufferView; an image referenced by URI is merely permitted to declare
43
+ * it. So {@link gltf_basisu_image_indices} is what says which images are KTX2, and this catches an
44
+ * image that declares itself without an extension naming it. Neither is the uri, which a `blob:` url
45
+ * from a drag-and-drop has no extension on.
46
+ *
47
+ * @readonly
48
+ * @type {string}
49
+ */
50
+ const KTX2_MIME_TYPE = "image/ktx2";
51
+
52
+ /**
53
+ * What a buffer the file never wrote resolves to - a placeholder some extension declares.
54
+ * Zero length rather than the declared one: a well-formed file reads none of it, and a malformed one
55
+ * fails loudly on the first accessor instead of quietly rendering a megabyte of zeroes.
56
+ * @type {Uint8Array}
57
+ */
58
+ const EMPTY_BUFFER = new Uint8Array(0);
59
+
60
+ const DEFAULT_TRANSLATION = [0, 0, 0];
61
+ const DEFAULT_ROTATION = [0, 0, 0, 1];
62
+ const DEFAULT_SCALE = [1, 1, 1];
63
+
64
+ /**
65
+ * A URI that names its own scheme, by RFC 3986's rule for one.
66
+ *
67
+ * Every scheme rather than the page's: built from `window.location.protocol`, this called an
68
+ * `https:` asset on an `http:` page relative — and a `blob:` or a `data:` likewise — and answered it
69
+ * with the model's own directory glued to the front.
70
+ *
71
+ * @type {RegExp}
72
+ */
73
+ const ABSOLUTE_URI = /^[a-z][a-z0-9+.-]*:/i;
74
+
75
+ /**
76
+ * Protocol-relative, which names no scheme and is absolute all the same.
77
+ * @type {RegExp}
78
+ */
79
+ const PROTOCOL_RELATIVE_URI = /^\/\//;
80
+
81
+ function resolveUri(uri, baseUrl) {
82
+ if (ABSOLUTE_URI.test(uri) || PROTOCOL_RELATIVE_URI.test(uri)) {
83
+ return uri;
84
+ }
85
+ return baseUrl + uri;
86
+ }
87
+
88
+ /**
89
+ * A resolved buffer, in the form the document exposes it.
90
+ *
91
+ * `Uint8Array` rather than `ArrayBuffer` throughout: a buffer is a *range* of bytes, and a `.glb`'s
92
+ * binary chunk is a range of the file it arrived in. Carrying the offset with the bytes is what lets
93
+ * that chunk be handed on without copying it, and it is the only form an accessor can be read out of
94
+ * without caring how the container happened to be aligned.
95
+ *
96
+ * @param {ArrayBuffer} array_buffer
97
+ * @returns {Uint8Array}
98
+ */
99
+ function as_bytes(array_buffer) {
100
+ return new Uint8Array(array_buffer);
101
+ }
102
+
103
+ /*
104
+ Very simple AABB tracking so that we can position cameras sensibly.
105
+
106
+ A box is six numbers `[x0, y0, z0, x1, y1, z1]`, min before max — which is the layout every
107
+ `aabb3_*` function in `core/geom/3d/aabb` reads and writes. There is no box object because nothing
108
+ downstream asks for one: a mesh, a node and a scene each carry their bounds so that a camera can
109
+ be pointed at the model, and the six numbers are the whole of that.
110
+ */
111
+
112
+ /**
113
+ * Scratch for one accessor's authored bounds, read as a box.
114
+ *
115
+ * Module scope rather than per primitive: it is filled and consumed by two adjacent statements
116
+ * of a walk that never awaits, so no second accessor can be in flight while one is being read.
117
+ *
118
+ * @type {Float64Array}
119
+ */
120
+ const ACCESSOR_BOUNDS_SCRATCH = new Float64Array(6);
121
+
122
+ /**
123
+ * A box that bounds nothing, so that the first union with it yields the other operand whole.
124
+ *
125
+ * The bounds are inverted for that: `+Infinity` min against `-Infinity` max. The class this replaced
126
+ * seeded its max with `Number.MIN_VALUE`, which is the smallest *positive* double rather than the most
127
+ * negative one — a mesh living entirely below the origin came out of it with a max pinned near zero,
128
+ * and a box that did not contain the mesh.
129
+ *
130
+ * `Float64Array` because glTF authors accessor bounds as JSON doubles, and these are combined and
131
+ * transformed all the way up the node graph before anyone reads them.
132
+ *
133
+ * @returns {Float64Array} six numbers, `[x0, y0, z0, x1, y1, z1]`
134
+ */
135
+ function aabb3_allocate_empty() {
136
+ const result = new Float64Array(6);
137
+
138
+ aabb3_array_set(
139
+ result, 0,
140
+ Infinity, Infinity, Infinity,
141
+ -Infinity, -Infinity, -Infinity
142
+ );
143
+
144
+ return result;
145
+ }
146
+
147
+ /**
148
+ * Whether a box bounds anything at all, as opposed to being the empty one {@link aabb3_allocate_empty}
149
+ * hands out.
150
+ *
151
+ * Worth asking before transforming one: the empty box's bounds are infinite, and an infinity met
152
+ * by one of the matrix's zeroes is a NaN, which then spreads into every box above it in the graph.
153
+ *
154
+ * @param {Float64Array|number[]} box six numbers
155
+ * @returns {boolean}
156
+ */
157
+ function aabb3_is_bounded(box) {
158
+ return box[0] <= box[3] && box[1] <= box[4] && box[2] <= box[5];
159
+ }
160
+
161
+
162
+ /**
163
+ * Give every node the graph reaches its world matrix and its normal matrix.
164
+ *
165
+ * @param {{nodes?:object[], scenes?:object[]}} gltf
166
+ */
167
+ function set_node_matrices(gltf) {
168
+ const world_matrices = gltf_node_world_matrices(gltf);
169
+
170
+ const nodes = gltf.nodes ?? [];
171
+
172
+ for (let index = 0; index < nodes.length; index++) {
173
+ const world = world_matrices[index];
174
+
175
+ if (world === undefined) {
176
+ // a node no root reaches is placed by nothing, and has no world transform to speak of
177
+ continue;
178
+ }
179
+
180
+ const node = nodes[index];
181
+
182
+ node.worldMatrix = world;
183
+
184
+ /*
185
+ The normal matrix the one that carries a *normal* rather than a point, since a normal does
186
+ not ride the transform itself wherever that transform is not a similarity: a non-uniform
187
+ scale tilts a surface one way and its normal the other.
188
+
189
+ Meep's own primitive, and a 3x3: the cofactor of the linear part, which points where the
190
+ inverse transpose points without inverting anything. So it reads no translation (a direction
191
+ has no position) and it has an answer for a transform with an axis scaled to nothing, where
192
+ an inverse does not exist — the gl-matrix code this replaced handed that case's `null`
193
+ straight on to `mat4.transpose` and threw. Vectors come out of it unnormalized; that is the
194
+ method, not a defect.
195
+ */
196
+ node.normalMatrix = new Float32Array(9);
197
+
198
+ m4_normal_matrix3(node.normalMatrix, world);
199
+ }
200
+ }
201
+
202
+ /**
203
+ * The box a mesh's own vertices occupy, in model space, computed once and kept on the mesh.
204
+ *
205
+ * Read off the accessors' authored bounds rather than the vertex data: the spec requires them on a
206
+ * POSITION accessor, and this runs before a single buffer has resolved.
207
+ *
208
+ * @param {{accessors?:object[]}} gltf
209
+ * @param {{primitives:object[], aabb?:Float64Array}} mesh
210
+ * @returns {Float64Array} six numbers, and unbounded when no primitive declared any
211
+ */
212
+ function mesh_bounds(gltf, mesh) {
213
+ if (mesh.aabb !== undefined) {
214
+ return mesh.aabb;
215
+ }
216
+
217
+ const result = aabb3_allocate_empty();
218
+
219
+ mesh.aabb = result;
220
+
221
+ for (const primitive of mesh.primitives) {
222
+ const accessor = gltf.accessors[primitive.attributes.POSITION];
223
+
224
+ const min = accessor?.min;
225
+ const max = accessor?.max;
226
+
227
+ /*
228
+ The spec requires bounds on a POSITION accessor, and a file that omits them is one this can
229
+ say nothing about. A primitive contributing no bounds is a better answer than six NaNs
230
+ poisoning every box above it.
231
+ */
232
+ if (min === undefined || max === undefined || min.length < 3 || max.length < 3) {
233
+ continue;
234
+ }
235
+
236
+ aabb3_array_set(
237
+ ACCESSOR_BOUNDS_SCRATCH, 0,
238
+ min[0], min[1], min[2],
239
+ max[0], max[1], max[2]
240
+ );
241
+
242
+ aabb3_array_combine(result, 0, result, 0, ACCESSOR_BOUNDS_SCRATCH, 0);
243
+ }
244
+
245
+ return result;
246
+ }
247
+
248
+ /**
249
+ * Grow whatever box `holder` carries so that it also holds `addition`, giving it one if it had none.
250
+ *
251
+ * @param {{aabb?:Float64Array}} holder a node or a scene
252
+ * @param {Float64Array} addition six numbers
253
+ */
254
+ function absorb_bounds(holder, addition) {
255
+ if (holder.aabb === undefined) {
256
+ // a copy: a box aliased to a child's would grow with it
257
+ holder.aabb = new Float64Array(addition);
258
+
259
+ return;
260
+ }
261
+
262
+ aabb3_array_combine(holder.aabb, 0, holder.aabb, 0, addition, 0);
263
+ }
264
+
265
+ /**
266
+ * Bound a node in world space by what it places, and by everything below it.
267
+ *
268
+ * A node reached twice keeps the box of its first visit, the same rule the world matrices follow —
269
+ * so the second parent still spans the child, but does not re-walk the subtree under it.
270
+ *
271
+ * @param {{nodes:object[], meshes?:object[]}} gltf
272
+ * @param {number} index
273
+ * @param {Set<number>} visited
274
+ */
275
+ function set_node_bounds(gltf, index, visited) {
276
+ if (visited.has(index)) {
277
+ return;
278
+ }
279
+
280
+ visited.add(index);
281
+
282
+ const node = gltf.nodes[index];
283
+
284
+ if ('mesh' in node) {
285
+ const bounds = mesh_bounds(gltf, gltf.meshes[node.mesh]);
286
+
287
+ // a mesh whose primitives all declined to declare bounds leaves the node without any
288
+ if (aabb3_is_bounded(bounds)) {
289
+ // a fresh box, which is also what `aabb3_matrix4_project` requires: it may not alias its input
290
+ node.aabb = new Float64Array(6);
291
+
292
+ aabb3_matrix4_project(node.aabb, bounds, node.worldMatrix);
293
+ }
294
+ }
295
+
296
+ for (const child_index of node.children ?? []) {
297
+ set_node_bounds(gltf, child_index, visited);
298
+
299
+ const child = gltf.nodes[child_index];
300
+
301
+ if (child.aabb !== undefined) {
302
+ absorb_bounds(node, child.aabb);
303
+ }
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Place every node, and bound every mesh, node and scene.
309
+ *
310
+ * @param {{nodes?:object[], meshes?:object[], scenes?:object[]}} gltf
311
+ */
312
+ function place_nodes(gltf) {
313
+ set_node_matrices(gltf);
314
+
315
+ const visited = new Set();
316
+
317
+ // shared across the scenes, so a node two of them list is measured once and spans both
318
+ for (const root of gltf_root_nodes(gltf)) {
319
+ set_node_bounds(gltf, root, visited);
320
+ }
321
+
322
+ for (const scene of gltf.scenes ?? []) {
323
+ for (const node_index of scene.nodes ?? []) {
324
+ const node = gltf.nodes[node_index];
325
+
326
+ if (node.aabb !== undefined) {
327
+ absorb_bounds(scene, node.aabb);
328
+ }
329
+ }
330
+ }
331
+ }
332
+
333
+ export class TinyGltf {
334
+ loadImageSlots = undefined;
335
+
336
+ /**
337
+ * The bufferView extensions this parser will honour.
338
+ *
339
+ * Replaceable so that a caller can add a codec, or take one away, without a loader learning any
340
+ * extension's name. The default is shared across the process; assign a
341
+ * {@link GltfBufferViewExtensionSet} of your own rather than adding to it if that matters.
342
+ *
343
+ * @type {GltfBufferViewExtensionSet}
344
+ */
345
+ bufferViewExtensions = GLTF_BUFFER_VIEW_EXTENSIONS;
346
+
347
+ /**
348
+ * Optional map of relative file paths to Blob/File/ArrayBuffer objects.
349
+ * When set, buffer and image URIs in the GLTF JSON are resolved from this map
350
+ * before the asset framework is asked. Enables loading multi-file GLTF bundles from
351
+ * drag-and-drop or other in-memory sources.
352
+ *
353
+ * Keys should match the URI strings in the GLTF JSON (e.g. "scene.bin", "textures/albedo.png").
354
+ *
355
+ * @type {Map<string, File|Blob|ArrayBuffer>|undefined}
356
+ */
357
+ fileMap = undefined;
358
+
359
+ /**
360
+ * Where every byte this parser reads comes from.
361
+ *
362
+ * A glTF is not one file: the container names buffers and images that live beside it, and a
363
+ * level places models that share them. Asking the framework rather than the network is what
364
+ * makes a texture two models use one download and one decode, records each request against the
365
+ * load that caused it, and cancels the lot when the scene that asked goes away.
366
+ *
367
+ * @type {AssetManager}
368
+ */
369
+ #assetManager;
370
+
371
+ /**
372
+ * The load these requests belong to, or `null` for a caller that is not itself an asset load.
373
+ *
374
+ * @type {AssetRequestScope|null}
375
+ */
376
+ #scope;
377
+
378
+ /**
379
+ * Which compressed formats the device this model is being loaded for can sample, or `undefined`
380
+ * where the caller did not say.
381
+ *
382
+ * Only a `KHR_texture_basisu` image reads it — see {@link #basis_transcode_target}.
383
+ *
384
+ * @type {Set<GPUTextureFormat>|undefined}
385
+ */
386
+ #texture_support = undefined;
387
+
388
+ /**
389
+ * @param {AssetManager} assetManager
390
+ * @param {AssetRequestScope} [scope]
391
+ * @param {Set<GPUTextureFormat>} [texture_support] from `gpu_texture_compression_support(device)`
392
+ */
393
+ constructor(assetManager, scope = null, texture_support = undefined) {
394
+ assert.defined(assetManager, 'assetManager');
395
+
396
+ this.#assetManager = assetManager;
397
+ this.#scope = scope;
398
+ this.#texture_support = texture_support;
399
+ }
400
+
401
+ /**
402
+ * What a `KHR_texture_basisu` image is transcoded into when the device can sample no compressed
403
+ * format at all.
404
+ *
405
+ * `rgba8unorm` is the one format WebGPU makes mandatory, so it is the floor beneath every
406
+ * choice below — four bytes a texel where BC7 spends one, and the reason a model still loads on
407
+ * a device with no compression features rather than being refused.
408
+ *
409
+ * Not sRGB: the two spellings are the same bytes, and which one a texture is created with is
410
+ * decided from the image's colour space by `texture_format_from_shade_image`.
411
+ *
412
+ * @readonly
413
+ * @type {TextureFormat}
414
+ */
415
+ static #UNCOMPRESSED_TARGET = TextureFormat.RGBA8UNORM;
416
+
417
+ /**
418
+ * The format a `KHR_texture_basisu` image should be transcoded into.
419
+ *
420
+ * **The best one the transcoder writes that the device can sample.** That is the asset layer's
421
+ * job as §3.5 divides it: `texture_format_preference` says what would be good, and choosing from
422
+ * what is actually available is the caller's — here, "available" means a format
423
+ * {@link transcode_basis} can produce.
424
+ *
425
+ * **The texture's role does not enter yet, and saying so is more honest than pretending it
426
+ * does.** Every format the transcoder writes today is a four-channel BC colour format, so a
427
+ * normal map and an albedo map get the same answer and asking the role would be ceremony. It
428
+ * stops being ceremony the moment an ETC1S-to-BC5 or ETC1S-to-ASTC path lands, and that is where
429
+ * the role belongs.
430
+ *
431
+ * **A device that can sample nothing compressed still gets a picture.** Every compressed format
432
+ * is an optional WebGPU feature — `texture-compression-bc`, `-etc2` and `-astc` alike — so a
433
+ * device exposing none of them is allowed, and used to get a refusal. `rgba8unorm` is not
434
+ * optional, so it is the floor: four bytes a texel instead of one, and the model loads.
435
+ *
436
+ * @returns {TextureFormat[]} acceptable targets, best first, ending in the uncompressed floor
437
+ */
438
+ #basis_transcode_target(role) {
439
+ /*
440
+ Every *compressed* format either transcoder writes, which is what there is a choice between.
441
+ Which of the two transcoders will run is not known here — the encoding is in the file, and
442
+ the reader is what looks — so the list is the union, and the reader refuses a format its
443
+ encoding cannot produce.
444
+
445
+ The uncompressed target is held out rather than left in the list. It is not a candidate to
446
+ be ranked against the others: it is what happens when none of them can be had, and leaving
447
+ it in would make the answer depend on where it landed in the union's order.
448
+ */
449
+ const writable = [...new Set([...transcode_basis_formats(), ...transcode_uastc_formats()])]
450
+ .filter(format => format !== TinyGltf.#UNCOMPRESSED_TARGET);
451
+
452
+ /*
453
+ **What the engine would like for this role, put first — not used as a filter.** That is
454
+ §3.5's division: `texture_format_preference` answers what would be good and knows nothing
455
+ about transcoders, and choosing from what is available is the asset layer's. For a normal
456
+ map it answers BC5 first, which only the UASTC path writes, so a UASTC normal map gets BC5
457
+ and an ETC1S one falls through.
458
+
459
+ Ordering rather than filtering, because the preference for a role lists what is *good* and
460
+ not what is *acceptable*: BC1 is in no role's list, and a device that can sample only BC1
461
+ should still get a texture rather than a refusal.
462
+ */
463
+ const by_role = role === undefined
464
+ ? []
465
+ : texture_format_preference(role, new Set(writable));
466
+
467
+ const candidates = [...by_role, ...writable.filter(format => !by_role.includes(format))];
468
+
469
+ if (this.#texture_support === undefined) {
470
+ /*
471
+ No support set was given. Targeting the best available format is the assumption meep
472
+ already makes elsewhere — it targets desktop-grade hardware, where
473
+ `texture-compression-bc` is universal and it is an assumption rather than a default:
474
+ a caller that knows better passes its device's support and gets what that device can
475
+ actually hold.
476
+ */
477
+ return [candidates[0], TinyGltf.#UNCOMPRESSED_TARGET];
478
+ }
479
+
480
+ /*
481
+ `#texture_support` holds what `gpu_texture_compression_support` found, which is only ever
482
+ compressed formats — so the uncompressed floor is appended outright rather than looked up in
483
+ it. Asking whether the device supports `rgba8unorm` would be asking a question WebGPU
484
+ already answers: it is mandatory.
485
+
486
+ The whole ordered list goes back, not just its head. Whether this particular file carries
487
+ alpha is knowable only once something reads its descriptor, which happens inside
488
+ `ktx2_read` so the reader picks from these, and a three-channel target like ASTC or BC1
489
+ is passed over for a file that has alpha instead of being committed to and then refused.
490
+ */
491
+ return [
492
+ ...candidates.filter(format => this.#texture_support.has(format)),
493
+ TinyGltf.#UNCOMPRESSED_TARGET,
494
+ ];
495
+ }
496
+
497
+ /**
498
+ * Read a KTX2 image into texels, transcoding it where its payload is Basis.
499
+ *
500
+ * @param {ArrayBuffer|Uint8Array} bytes the whole file
501
+ * @returns {ShadeTexelData}
502
+ * @param {TextureRole} [role] what the image is for, which orders the candidate targets
503
+ * @throws {Error} naming the feature, for a container this reader does not read
504
+ */
505
+ #read_ktx2(bytes, role) {
506
+ return texel_data_from_ktx2(bytes, this.#basis_transcode_target(role));
507
+ }
508
+
509
+ /**
510
+ * The bytes of a file this asset needs, through the framework.
511
+ *
512
+ * @param {string} path un-resolved, as the manager takes it
513
+ * @param {string} type see {@link GameAssetType}
514
+ * @returns {Promise<*>}
515
+ */
516
+ async #read(path, type) {
517
+ const asset = await this.#assetManager.promise(path, type, { scope: this.#scope });
518
+
519
+ return asset.create();
520
+ }
521
+
522
+ /**
523
+ * @param {string} url `.gltf` or `.glb`, un-resolved — the manager resolves network paths
524
+ * @returns {Promise<TinyGltf>}
525
+ */
526
+ async loadFromUrl(url) {
527
+ assert.isString(url, 'url');
528
+
529
+ const i = url.lastIndexOf('/');
530
+ const baseUrl = (i !== 0) ? url.substring(0, i + 1) : './';
531
+
532
+ /*
533
+ The container is read as bytes whatever it is called and told apart by its magic number,
534
+ rather than by an extension. One path instead of three, and it is the only one that was ever
535
+ correct for a `blob:` url — which is what drag-and-drop produces.
536
+ */
537
+ const buffer = await this.#read(url, GameAssetType.ArrayBuffer);
538
+
539
+ return this.loadFromBinary(buffer, baseUrl);
540
+ }
541
+
542
+ /**
543
+ * Load a container that is already in memory, whichever of the two forms it is in.
544
+ *
545
+ * @param {ArrayBuffer} arrayBuffer a `.glb`, or the bytes of a `.gltf`
546
+ * @param {string} baseUrl
547
+ * @return {Promise<{asset}|*>}
548
+ */
549
+ async loadFromBinary(arrayBuffer, baseUrl) {
550
+ const container = gltf_parse_container(new Uint8Array(arrayBuffer));
551
+
552
+ return this.loadFromJson(container.json, baseUrl, container.binary_chunk);
553
+ }
554
+
555
+ /**
556
+ *
557
+ * @param {{bufferViews,asset,accessors:[],nodes:[],samplers?:[],buffers:[],materials:[], textures:[], images:[],scenes:[]}} json
558
+ * @param {string} baseUrl
559
+ * @param {Uint8Array} [binaryChunk]
560
+ * @return {Promise<{asset}|*>}
561
+ */
562
+ async loadFromJson(json, baseUrl, binaryChunk = null) {
563
+ if (!baseUrl) {
564
+ throw new Error('baseUrl must be specified.');
565
+ }
566
+
567
+ gltf_require_supported_version(json);
568
+
569
+ // Resolve defaults for as many properties as we can.
570
+ for (const accessor of json.accessors) {
571
+ accessor.byteOffset = accessor.byteOffset ?? 0;
572
+ accessor.normalized = accessor.normalized ?? false;
573
+ }
574
+
575
+ for (const bufferView of json.bufferViews) {
576
+ bufferView.byteOffset = bufferView.byteOffset ?? 0;
577
+ }
578
+
579
+ for (const node of json.nodes) {
580
+ if (!node.matrix) {
581
+ node.rotation = node.rotation ?? DEFAULT_ROTATION;
582
+ node.scale = node.scale ?? DEFAULT_SCALE;
583
+ node.translation = node.translation ?? DEFAULT_TRANSLATION;
584
+ }
585
+ }
586
+
587
+ if (json.samplers) {
588
+ for (const sampler of json.samplers) {
589
+ sampler.wrapS = sampler.wrapS ?? GLTF_WRAP_REPEAT;
590
+ sampler.wrapT = sampler.wrapT ?? GLTF_WRAP_REPEAT;
591
+ }
592
+ }
593
+
594
+ // Resolve buffers and images first, since these are the only external resources that the file
595
+ // might reference.
596
+ // Buffers will be exposed as Uint8Arrays.
597
+ // Images will be exposed as ImageBitmaps.
598
+
599
+ /**
600
+ * Buffers
601
+ * @type {Promise<Uint8Array>[]}
602
+ */
603
+ const pendingBuffers = [];
604
+
605
+ const declaredBuffers = json.buffers ?? [];
606
+
607
+ /*
608
+ A .glb's buffer 0 is its binary chunk and names no URI. The buffers after it are ordinary,
609
+ and are where an extension that produces its own bufferView bytes puts the placeholder those
610
+ views point at - so the chunk is a special case of buffer 0, not a reason to stop looking at
611
+ the rest.
612
+ */
613
+ const bufferCount = Math.max(declaredBuffers.length, binaryChunk ? 1 : 0);
614
+
615
+ for (let index = 0; index < bufferCount; index++) {
616
+ if (binaryChunk && index === 0) {
617
+ pendingBuffers[index] = Promise.resolve(binaryChunk);
618
+ continue;
619
+ }
620
+
621
+ const buffer = declaredBuffers[index];
622
+
623
+ /*
624
+ A buffer with no URI was never written. Asking for one produced a request for
625
+ "<baseUrl>undefined", which is how a compressed .gltf with a fallback buffer - the shape
626
+ gltfpack writes - failed before it read a single accessor.
627
+ */
628
+ if (buffer.uri === undefined || this.bufferViewExtensions.is_placeholder_buffer(buffer)) {
629
+ pendingBuffers[index] = Promise.resolve(EMPTY_BUFFER);
630
+ continue;
631
+ }
632
+
633
+ // Check fileMap first (enables loading from dropped files)
634
+ if (this.fileMap) {
635
+ const file = this.fileMap.get(buffer.uri);
636
+
637
+ if (file !== undefined) {
638
+ // File or Blob
639
+ pendingBuffers[index] = (file instanceof ArrayBuffer)
640
+ ? Promise.resolve(new Uint8Array(file))
641
+ : file.arrayBuffer().then(as_bytes);
642
+
643
+ continue;
644
+ }
645
+ }
646
+
647
+ pendingBuffers[index] = this.#read(
648
+ resolveUri(buffer.uri, baseUrl),
649
+ GameAssetType.ArrayBuffer
650
+ ).then(as_bytes);
651
+ }
652
+
653
+ // If the loader has been instructed to only load certain images (such as just baseColorTexture)
654
+ // then scan through all the materials first and gather the image IDs for only those images.
655
+ // (This feature really only makes sense for this specific set of samples.)
656
+ let activeImageSet;
657
+ if (this.loadImageSlots) {
658
+ activeImageSet = new Set();
659
+ for (const material of json.materials) {
660
+ for (const imageChannel of this.loadImageSlots) {
661
+ const texture = material[imageChannel] ?? material.pbrMetallicRoughness[imageChannel];
662
+ if (texture !== undefined) {
663
+ activeImageSet.add(json.textures[texture.index].source);
664
+ }
665
+ }
666
+ }
667
+ } else {
668
+ /*
669
+ Only the images something will actually sample. A texture may offer the same picture in
670
+ several containers — `source` plus an extension — and fetching the ones this loader has
671
+ already decided against is not merely wasted: `createImageBitmap` rejects on a container
672
+ the browser cannot decode, and an image nothing was going to sample takes the whole model
673
+ down with it. The game's level models each carry a DDS beside their PNG for exactly that
674
+ reason, and not one of them loaded.
675
+ */
676
+ activeImageSet = gltf_used_image_indices(json);
677
+ }
678
+
679
+ /**
680
+ * The images `KHR_texture_basisu` names, which are KTX2 containers whatever else the file
681
+ * says about them.
682
+ *
683
+ * @type {Set<number>}
684
+ */
685
+ const basisu_images = gltf_basisu_image_indices(json);
686
+
687
+ /**
688
+ * What each image is for, which is what picks its transcode target.
689
+ *
690
+ * @type {Map<number, TextureRole>}
691
+ */
692
+ const image_roles = gltf_image_roles(json);
693
+
694
+ /**
695
+ * Images
696
+ * @type {Promise<ImageBitmap|ShadeTexelData>[]}
697
+ */
698
+ const pendingImages = [];
699
+ for (let index = 0; index < json.images?.length || 0; ++index) {
700
+ if (activeImageSet && !activeImageSet.has(index)) {
701
+ continue;
702
+ }
703
+ const image = json.images[index];
704
+
705
+ /**
706
+ *
707
+ * @param {Blob} blob
708
+ * @return {Promise<ImageBitmap>}
709
+ */
710
+ function blob_to_bitmap(blob) {
711
+ return createImageBitmap(blob, {
712
+ // premultiplication is done during texture upload
713
+ premultiplyAlpha: "none",
714
+ })
715
+ }
716
+
717
+ /**
718
+ * A dropped file's bytes. `fileMap` holds whatever the drop handler put there.
719
+ *
720
+ * @param {File|Blob|ArrayBuffer} file
721
+ * @return {Promise<ArrayBuffer>}
722
+ */
723
+ function file_to_bytes(file) {
724
+ return file instanceof Blob ? file.arrayBuffer() : Promise.resolve(file);
725
+ }
726
+
727
+ /*
728
+ **A KTX2 image cannot go through `createImageBitmap`** — no browser decodes the
729
+ container, and handing it one is how an unsupported container took a whole level down
730
+ before. It is read here instead, into texels already in a device format, and what comes
731
+ out is a `ShadeTexelData` rather than an `ImageBitmap`. `load_gltf` tells the two apart
732
+ and wraps each in a `ShadeImage`, below which nothing knows the difference.
733
+
734
+ **Which images those are comes from the extension, not from the MIME type.**
735
+ `KHR_texture_basisu` only *requires* `image/ktx2` inside a GLB, where the image comes
736
+ from a bufferView; an image referenced by URI is merely *permitted* to declare it. So a
737
+ legal `.gltf` may say nothing but `{"uri": "wood.ktx2"}`, and going by MIME type alone
738
+ would send exactly that file to `createImageBitmap`. The type is still honoured where it
739
+ is present, since a GLB is required to carry it and an image may be reached by an
740
+ extension this loader does not read.
741
+ */
742
+ const ktx2 = basisu_images.has(index) || image.mimeType === KTX2_MIME_TYPE;
743
+
744
+ // which material slot this image fills, so a normal map can be asked for as BC5
745
+ const image_role = image_roles.get(index);
746
+
747
+ if (image.uri) {
748
+
749
+ // Check fileMap first (enables loading from dropped files)
750
+ if (this.fileMap) {
751
+ const file = this.fileMap.get(image.uri);
752
+
753
+ if (file !== undefined) {
754
+ pendingImages[index] = ktx2
755
+ ? file_to_bytes(file).then(bytes => this.#read_ktx2(bytes, image_role))
756
+ : blob_to_bitmap((file instanceof Blob) ? file : new Blob([file]));
757
+ continue;
758
+ }
759
+ }
760
+
761
+ /*
762
+ Decoded by the framework rather than here, which is what makes one texture shared
763
+ by two models one decode instead of two — the expensive half of loading a model is
764
+ its images, and a level places the same handful of them hundreds of times.
765
+
766
+ A KTX2 image asks for bytes instead. The framework has no decoder for the container
767
+ and would have nowhere to cache the result of one, since what a transcode produces
768
+ depends on the device it was chosen for.
769
+ */
770
+ pendingImages[index] = ktx2
771
+ ? this.#read(resolveUri(image.uri, baseUrl), GameAssetType.ArrayBuffer)
772
+ .then(buffer => this.#read_ktx2(buffer, image_role))
773
+ : this.#read(resolveUri(image.uri, baseUrl), GameAssetType.ImageBitmap);
774
+
775
+ } else {
776
+
777
+ const bufferView = json.bufferViews[image.bufferView];
778
+
779
+ const claimed = this.bufferViewExtensions.claim(bufferView, image.bufferView);
780
+
781
+ if (claimed !== null) {
782
+ /*
783
+ Legal to write and pointless to: the payload is a PNG or a JPEG, already
784
+ compressed. Decoding it is not implemented, and the alternative to saying so is
785
+ handing the image decoder a placeholder buffer's bytes.
786
+ */
787
+ throw new Error(
788
+ `images[${index}] is sourced from a bufferView '${claimed.name}' produces,`
789
+ + ` which is not supported`
790
+ );
791
+ }
792
+
793
+ pendingImages[index] = pendingBuffers[bufferView.buffer].then((buffer) => {
794
+
795
+ const bytes = buffer.subarray(
796
+ bufferView.byteOffset,
797
+ bufferView.byteOffset + bufferView.byteLength
798
+ );
799
+
800
+ if (ktx2) {
801
+ return this.#read_ktx2(bytes, image_role);
802
+ }
803
+
804
+ return blob_to_bitmap(new Blob([bytes], { type: image.mimeType }));
805
+ });
806
+
807
+ }
808
+ }
809
+
810
+ // Place every node, and bound every mesh, node and scene, starting at the roots.
811
+ place_nodes(json);
812
+
813
+ // Replace the resolved resources in the JSON structure.
814
+ const buffers = await Promise.all(pendingBuffers);
815
+
816
+ /*
817
+ Views that some extension produces the bytes for become ordinary ones here, over decoded
818
+ buffers appended to the list, so that nothing downstream - accessors, sparse accessors, the
819
+ mesh reader - has to know any of those extensions exist. Nor does this parser: it asks the
820
+ set what claims a view, and the set is the one place that knows what is implemented.
821
+
822
+ Per view, and guarded per view. A file nothing claims - which is nearly all of them - gets
823
+ its own view objects back by identity and appends no buffer.
824
+ */
825
+ json.bufferViews = gltf_apply_buffer_view_extensions(
826
+ json.bufferViews, buffers, this.bufferViewExtensions
827
+ );
828
+
829
+ json.buffers = buffers;
830
+ json.images = await Promise.all(pendingImages);
831
+
832
+ return json;
833
+ }
834
+
835
+
836
+ }
837
+