@woosh/meep-engine 3.78.4 → 3.80.0

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 (421) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +1 -1
  3. package/package.json +1 -1
  4. package/src/engine/asset/GameAssetType.d.ts +2 -0
  5. package/src/engine/asset/GameAssetType.js +10 -0
  6. package/src/engine/asset/guessAssetType.d.ts.map +1 -1
  7. package/src/engine/asset/guessAssetType.js +4 -0
  8. package/src/engine/asset/load_model_scene_bundle.d.ts +1 -1
  9. package/src/engine/asset/load_model_scene_bundle.js +2 -2
  10. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts +42 -0
  11. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts.map +1 -0
  12. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.js +83 -0
  13. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts +36 -0
  14. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts.map +1 -0
  15. package/src/engine/asset/loaders/MTFTextureAssetLoader.js +78 -0
  16. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts +6 -1
  17. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts.map +1 -1
  18. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +8 -2
  19. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  20. package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts +45 -0
  21. package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts.map +1 -0
  22. package/src/format/image/webp/vp8/VP8BoolDecoder.js +137 -0
  23. package/src/format/image/webp/vp8/vp8_decode.d.ts +21 -0
  24. package/src/format/image/webp/vp8/vp8_decode.d.ts.map +1 -0
  25. package/src/format/image/webp/vp8/vp8_decode.js +756 -0
  26. package/src/format/image/webp/vp8/vp8_loop_filter.d.ts +31 -0
  27. package/src/format/image/webp/vp8/vp8_loop_filter.d.ts.map +1 -0
  28. package/src/format/image/webp/vp8/vp8_loop_filter.js +189 -0
  29. package/src/format/image/webp/vp8/vp8_predict.d.ts +48 -0
  30. package/src/format/image/webp/vp8/vp8_predict.d.ts.map +1 -0
  31. package/src/format/image/webp/vp8/vp8_predict.js +290 -0
  32. package/src/format/image/webp/vp8/vp8_tables.d.ts +34 -0
  33. package/src/format/image/webp/vp8/vp8_tables.d.ts.map +1 -0
  34. package/src/format/image/webp/vp8/vp8_tables.js +350 -0
  35. package/src/format/image/webp/vp8/vp8_transform.d.ts +22 -0
  36. package/src/format/image/webp/vp8/vp8_transform.d.ts.map +1 -0
  37. package/src/format/image/webp/vp8/vp8_transform.js +114 -0
  38. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts +23 -0
  39. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts.map +1 -0
  40. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.js +133 -0
  41. package/src/format/image/webp/vp8l/VP8LBitReader.d.ts +47 -0
  42. package/src/format/image/webp/vp8l/VP8LBitReader.d.ts.map +1 -0
  43. package/src/format/image/webp/vp8l/VP8LBitReader.js +84 -0
  44. package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts +27 -0
  45. package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts.map +1 -0
  46. package/src/format/image/webp/vp8l/VP8LPrefixCode.js +184 -0
  47. package/src/format/image/webp/vp8l/vp8l_decode.d.ts +28 -0
  48. package/src/format/image/webp/vp8l/vp8l_decode.d.ts.map +1 -0
  49. package/src/format/image/webp/vp8l/vp8l_decode.js +261 -0
  50. package/src/format/image/webp/vp8l/vp8l_distance.d.ts +22 -0
  51. package/src/format/image/webp/vp8l/vp8l_distance.d.ts.map +1 -0
  52. package/src/format/image/webp/vp8l/vp8l_distance.js +62 -0
  53. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts +50 -0
  54. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts.map +1 -0
  55. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.js +267 -0
  56. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts +14 -0
  57. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts.map +1 -0
  58. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.js +99 -0
  59. package/src/format/image/webp/webp_decode.d.ts +23 -0
  60. package/src/format/image/webp/webp_decode.d.ts.map +1 -0
  61. package/src/format/image/webp/webp_decode.js +179 -0
  62. package/src/format/image/webp/webp_decode_alpha.d.ts +18 -0
  63. package/src/format/image/webp/webp_decode_alpha.d.ts.map +1 -0
  64. package/src/format/image/webp/webp_decode_alpha.js +84 -0
  65. package/src/format/texture/{basis → astc}/astc_block.d.ts +41 -0
  66. package/src/format/texture/astc/astc_block.d.ts.map +1 -0
  67. package/src/format/texture/{basis → astc}/astc_block.js +284 -164
  68. package/src/format/texture/astc/astc_decode_block.d.ts +68 -0
  69. package/src/format/texture/astc/astc_decode_block.d.ts.map +1 -0
  70. package/src/format/texture/astc/astc_decode_block.js +1119 -0
  71. package/src/format/texture/astc/astc_encode_block_4x4.d.ts +32 -0
  72. package/src/format/texture/astc/astc_encode_block_4x4.d.ts.map +1 -0
  73. package/src/format/texture/astc/astc_encode_block_4x4.js +181 -0
  74. package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts +32 -0
  75. package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts.map +1 -0
  76. package/src/format/texture/astc/astc_encode_block_4x4_rgba.js +337 -0
  77. package/src/format/texture/astc/astc_integer_sequence.d.ts.map +1 -0
  78. package/src/format/texture/{basis → astc}/astc_integer_sequence.js +251 -251
  79. package/src/format/texture/astc/astc_partition.d.ts.map +1 -0
  80. package/src/format/texture/{basis → astc}/astc_partition.js +199 -199
  81. package/src/format/texture/basis/transcode/etc1s_to_astc.js +329 -329
  82. package/src/format/texture/basis/transcode/etc1s_to_etc2.d.ts.map +1 -1
  83. package/src/format/texture/basis/transcode/etc1s_to_etc2.js +305 -332
  84. package/src/format/texture/basis/transcode/fit_endpoints.d.ts.map +1 -1
  85. package/src/format/texture/basis/transcode/fit_endpoints.js +14 -27
  86. package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts +66 -0
  87. package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts.map +1 -0
  88. package/src/format/texture/basis/uastc/uastc_bc7_tables.js +148 -0
  89. package/src/format/texture/basis/uastc/uastc_decode_block.js +463 -463
  90. package/src/format/texture/basis/uastc/uastc_to_astc.js +421 -421
  91. package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts +1 -6
  92. package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts.map +1 -1
  93. package/src/format/texture/basis/uastc/uastc_to_bc5.js +48 -115
  94. package/src/format/texture/basis/uastc/uastc_to_bc7.d.ts.map +1 -1
  95. package/src/format/texture/basis/uastc/uastc_to_bc7.js +604 -602
  96. package/src/format/texture/bc/bc1_decode_block.d.ts +19 -0
  97. package/src/format/texture/bc/bc1_decode_block.d.ts.map +1 -0
  98. package/src/format/texture/bc/bc1_decode_block.js +22 -0
  99. package/src/format/texture/bc/bc1_decode_colors.d.ts +27 -0
  100. package/src/format/texture/bc/bc1_decode_colors.d.ts.map +1 -0
  101. package/src/format/texture/bc/bc1_decode_colors.js +100 -0
  102. package/src/format/texture/bc/bc2_decode_block.d.ts +18 -0
  103. package/src/format/texture/bc/bc2_decode_block.d.ts.map +1 -0
  104. package/src/format/texture/bc/bc2_decode_block.js +28 -0
  105. package/src/format/texture/bc/bc3_decode_block.d.ts +18 -0
  106. package/src/format/texture/bc/bc3_decode_block.d.ts.map +1 -0
  107. package/src/format/texture/bc/bc3_decode_block.js +23 -0
  108. package/src/format/texture/bc/bc4_decode_channel.d.ts +56 -0
  109. package/src/format/texture/bc/bc4_decode_channel.d.ts.map +1 -0
  110. package/src/format/texture/bc/bc4_decode_channel.js +138 -0
  111. package/src/format/texture/bc/bc4_encode_block.d.ts +43 -0
  112. package/src/format/texture/bc/bc4_encode_block.d.ts.map +1 -0
  113. package/src/format/texture/bc/bc4_encode_block.js +324 -0
  114. package/src/format/texture/bc/bc4_snorm_decode_block.d.ts +18 -0
  115. package/src/format/texture/bc/bc4_snorm_decode_block.d.ts.map +1 -0
  116. package/src/format/texture/bc/bc4_snorm_decode_block.js +27 -0
  117. package/src/format/texture/bc/bc4_unorm_decode_block.d.ts +17 -0
  118. package/src/format/texture/bc/bc4_unorm_decode_block.d.ts.map +1 -0
  119. package/src/format/texture/bc/bc4_unorm_decode_block.js +26 -0
  120. package/src/format/texture/bc/bc5_encode_block.d.ts +25 -0
  121. package/src/format/texture/bc/bc5_encode_block.d.ts.map +1 -0
  122. package/src/format/texture/bc/bc5_encode_block.js +34 -0
  123. package/src/format/texture/bc/bc5_snorm_decode_block.d.ts +18 -0
  124. package/src/format/texture/bc/bc5_snorm_decode_block.d.ts.map +1 -0
  125. package/src/format/texture/bc/bc5_snorm_decode_block.js +27 -0
  126. package/src/format/texture/bc/bc5_unorm_decode_block.d.ts +17 -0
  127. package/src/format/texture/bc/bc5_unorm_decode_block.d.ts.map +1 -0
  128. package/src/format/texture/bc/bc5_unorm_decode_block.js +26 -0
  129. package/src/format/texture/bc/bc6h_decode_texels.d.ts +30 -0
  130. package/src/format/texture/bc/bc6h_decode_texels.d.ts.map +1 -0
  131. package/src/format/texture/bc/bc6h_decode_texels.js +430 -0
  132. package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts +20 -0
  133. package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts.map +1 -0
  134. package/src/format/texture/bc/bc6h_sfloat_decode_block.js +23 -0
  135. package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts +18 -0
  136. package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts.map +1 -0
  137. package/src/format/texture/bc/bc6h_ufloat_decode_block.js +21 -0
  138. package/src/format/texture/bc/bc7_decode_block.d.ts +30 -0
  139. package/src/format/texture/bc/bc7_decode_block.d.ts.map +1 -0
  140. package/src/format/texture/bc/bc7_decode_block.js +232 -0
  141. package/src/format/texture/bc/bc7_encode_block.d.ts +39 -0
  142. package/src/format/texture/bc/bc7_encode_block.d.ts.map +1 -0
  143. package/src/format/texture/bc/bc7_encode_block.js +423 -0
  144. package/src/format/texture/bc/bc7_tables.d.ts +126 -0
  145. package/src/format/texture/bc/bc7_tables.d.ts.map +1 -0
  146. package/src/format/texture/{basis/uastc → bc}/bc7_tables.js +225 -276
  147. package/src/format/texture/bc/bc7_write_block.d.ts +65 -0
  148. package/src/format/texture/bc/bc7_write_block.d.ts.map +1 -0
  149. package/src/format/texture/{basis/uastc → bc}/bc7_write_block.js +185 -227
  150. package/src/format/texture/etc/eac_decode_channel.d.ts +50 -0
  151. package/src/format/texture/etc/eac_decode_channel.d.ts.map +1 -0
  152. package/src/format/texture/etc/eac_decode_channel.js +142 -0
  153. package/src/format/texture/etc/eac_modifiers.d.ts +15 -0
  154. package/src/format/texture/etc/eac_modifiers.d.ts.map +1 -0
  155. package/src/format/texture/etc/eac_modifiers.js +31 -0
  156. package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts +21 -0
  157. package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts.map +1 -0
  158. package/src/format/texture/etc/eac_r11_snorm_decode_block.js +30 -0
  159. package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts +20 -0
  160. package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts.map +1 -0
  161. package/src/format/texture/etc/eac_r11_unorm_decode_block.js +29 -0
  162. package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts +19 -0
  163. package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts.map +1 -0
  164. package/src/format/texture/etc/eac_rg11_snorm_decode_block.js +28 -0
  165. package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts +19 -0
  166. package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts.map +1 -0
  167. package/src/format/texture/etc/eac_rg11_unorm_decode_block.js +28 -0
  168. package/src/format/texture/etc/etc2_decode_color.d.ts +25 -0
  169. package/src/format/texture/etc/etc2_decode_color.d.ts.map +1 -0
  170. package/src/format/texture/etc/etc2_decode_color.js +370 -0
  171. package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts +18 -0
  172. package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts.map +1 -0
  173. package/src/format/texture/etc/etc2_rgb8_decode_block.js +21 -0
  174. package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts +21 -0
  175. package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts.map +1 -0
  176. package/src/format/texture/etc/etc2_rgb8a1_decode_block.js +24 -0
  177. package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts +18 -0
  178. package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts.map +1 -0
  179. package/src/format/texture/etc/etc2_rgba8_decode_block.js +24 -0
  180. package/src/format/texture/fit/fit_line.d.ts +23 -0
  181. package/src/format/texture/fit/fit_line.d.ts.map +1 -0
  182. package/src/format/texture/fit/fit_line.js +123 -0
  183. package/src/format/texture/fit/fit_line_refine.d.ts +21 -0
  184. package/src/format/texture/fit/fit_line_refine.d.ts.map +1 -0
  185. package/src/format/texture/fit/fit_line_refine.js +69 -0
  186. package/src/format/texture/fit/fit_line_solve.d.ts +23 -0
  187. package/src/format/texture/fit/fit_line_solve.d.ts.map +1 -0
  188. package/src/format/texture/fit/fit_line_solve.js +71 -0
  189. package/src/format/texture/texel_decode_image.d.ts +44 -0
  190. package/src/format/texture/texel_decode_image.d.ts.map +1 -0
  191. package/src/format/texture/texel_decode_image.js +251 -0
  192. package/src/format/texture/texel_encode_image.d.ts +77 -0
  193. package/src/format/texture/texel_encode_image.d.ts.map +1 -0
  194. package/src/format/texture/texel_encode_image.js +187 -0
  195. package/src/shade/renderer/ShadeIndirectLightingMode.js +2 -0
  196. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  197. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  198. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  199. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts +33 -0
  200. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts.map +1 -0
  201. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js +196 -0
  202. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts +25 -0
  203. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts.map +1 -0
  204. package/src/shade/renderer/animation/SkinSerializationAdapter.js +85 -0
  205. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  206. package/src/shade/renderer/hair/GPUHairSystem.js +16 -7
  207. package/src/shade/renderer/hair/HAIR.d.ts +5 -3
  208. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
  209. package/src/shade/renderer/hair/HAIR.js +6 -4
  210. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +10 -10
  211. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -1
  212. package/src/shade/renderer/hair/hair_shadow_draw.js +21 -17
  213. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
  214. package/src/shade/renderer/hair/shader_hair_cull.js +6 -2
  215. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +5 -4
  216. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -1
  217. package/src/shade/renderer/hair/shader_hair_shadow_list.js +10 -12
  218. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts +38 -0
  219. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts.map +1 -0
  220. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.js +198 -0
  221. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts +88 -0
  222. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts.map +1 -0
  223. package/src/shade/renderer/loader/mtf/MTFTexture.js +159 -0
  224. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts +30 -0
  225. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts.map +1 -0
  226. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.js +136 -0
  227. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts +7 -0
  228. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts.map +1 -0
  229. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.js +6 -0
  230. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts +8 -0
  231. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts.map +1 -0
  232. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js +7 -0
  233. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts +7 -0
  234. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts.map +1 -0
  235. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.js +6 -0
  236. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts +7 -0
  237. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts.map +1 -0
  238. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js +6 -0
  239. package/src/shade/renderer/loader/mtf/load_mtf.d.ts +41 -0
  240. package/src/shade/renderer/loader/mtf/load_mtf.d.ts.map +1 -0
  241. package/src/shade/renderer/loader/mtf/load_mtf.js +73 -0
  242. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts +19 -0
  243. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts.map +1 -0
  244. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.js +57 -0
  245. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +10 -0
  246. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -0
  247. package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +152 -0
  248. package/src/shade/renderer/loader/mtf/mtf_export.d.ts +45 -0
  249. package/src/shade/renderer/loader/mtf/mtf_export.d.ts.map +1 -0
  250. package/src/shade/renderer/loader/mtf/mtf_export.js +161 -0
  251. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts +9 -0
  252. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts.map +1 -0
  253. package/src/shade/renderer/loader/mtf/mtf_is_texture.js +12 -0
  254. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts +24 -0
  255. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts.map +1 -0
  256. package/src/shade/renderer/loader/mtf/mtf_read_collection.js +37 -0
  257. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts +27 -0
  258. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts.map +1 -0
  259. package/src/shade/renderer/loader/mtf/mtf_read_scene.js +121 -0
  260. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts +18 -0
  261. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts.map +1 -0
  262. package/src/shade/renderer/loader/mtf/mtf_read_textures.js +51 -0
  263. package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts +19 -0
  264. package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts.map +1 -0
  265. package/src/shade/renderer/loader/mtf/mtf_replace_textures.js +60 -0
  266. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts +21 -0
  267. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts.map +1 -0
  268. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.js +98 -0
  269. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts +25 -0
  270. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts.map +1 -0
  271. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.js +51 -0
  272. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts +20 -0
  273. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts.map +1 -0
  274. package/src/shade/renderer/loader/mtf/mtf_texture_read.js +80 -0
  275. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts +24 -0
  276. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts.map +1 -0
  277. package/src/shade/renderer/loader/mtf/mtf_texture_select.js +42 -0
  278. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts +31 -0
  279. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts.map +1 -0
  280. package/src/shade/renderer/loader/mtf/mtf_texture_write.js +87 -0
  281. package/src/shade/renderer/loader/mtf/mtf_write.d.ts +36 -0
  282. package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -0
  283. package/src/shade/renderer/loader/mtf/mtf_write.js +137 -0
  284. package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts +23 -0
  285. package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts.map +1 -0
  286. package/src/shade/renderer/loader/mtf/mtf_write_collection.js +36 -0
  287. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts +39 -0
  288. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts.map +1 -0
  289. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.js +207 -0
  290. package/src/shade/renderer/scene/optimization/source_to_sampler2d.d.ts.map +1 -1
  291. package/src/shade/renderer/scene/optimization/source_to_sampler2d.js +3 -1
  292. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.d.ts +5 -5
  293. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.js +5 -5
  294. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
  295. package/src/shade/renderer/scene/serialization/deserialize_scene.js +491 -528
  296. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +0 -10
  297. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
  298. package/src/shade/renderer/scene/serialization/serialize_scene.js +15 -71
  299. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts +13 -0
  300. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts.map +1 -0
  301. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.js +39 -0
  302. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts +3 -2
  303. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  304. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +6 -21
  305. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts +42 -0
  306. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts.map +1 -0
  307. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.js +612 -0
  308. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +5 -4
  309. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  310. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +8 -25
  311. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  312. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +3 -19
  313. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +14 -4
  314. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -1
  315. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +65 -54
  316. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +2 -2
  317. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  318. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +5 -22
  319. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +1 -1
  320. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts +27 -0
  321. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts.map +1 -0
  322. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.js +147 -0
  323. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts +3 -4
  324. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts.map +1 -1
  325. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js +6 -13
  326. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts +13 -0
  327. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts.map +1 -0
  328. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.js +66 -0
  329. package/src/shade/renderer/texture/encode/texture_encode.d.ts +28 -1
  330. package/src/shade/renderer/texture/encode/texture_encode.d.ts.map +1 -1
  331. package/src/shade/renderer/texture/encode/texture_encode.js +202 -168
  332. package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts +13 -1
  333. package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts.map +1 -1
  334. package/src/shade/renderer/texture/encode/texture_encode_shader.js +146 -108
  335. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts +11 -0
  336. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts.map +1 -0
  337. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.js +14 -0
  338. package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts +20 -0
  339. package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts.map +1 -0
  340. package/src/shade/renderer/texture/format/texture_formats_to_build.js +98 -0
  341. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts.map +1 -1
  342. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +4 -23
  343. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts +53 -0
  344. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts.map +1 -0
  345. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.js +76 -0
  346. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts +40 -0
  347. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts.map +1 -0
  348. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.js +43 -0
  349. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts +17 -0
  350. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts.map +1 -0
  351. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.js +29 -0
  352. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts +21 -0
  353. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts.map +1 -0
  354. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.js +91 -0
  355. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts +32 -0
  356. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts.map +1 -0
  357. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.js +216 -0
  358. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts +30 -0
  359. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts.map +1 -0
  360. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.js +134 -0
  361. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts +16 -0
  362. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts.map +1 -0
  363. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.js +33 -0
  364. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts +18 -0
  365. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts.map +1 -0
  366. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.js +71 -0
  367. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts +20 -0
  368. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts.map +1 -0
  369. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.js +57 -0
  370. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts +18 -0
  371. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts.map +1 -0
  372. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.js +111 -0
  373. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts +16 -0
  374. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts.map +1 -0
  375. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.js +33 -0
  376. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts +18 -0
  377. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts.map +1 -0
  378. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.js +128 -0
  379. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts +21 -0
  380. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts.map +1 -0
  381. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.js +169 -0
  382. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts +21 -0
  383. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts.map +1 -0
  384. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.js +119 -0
  385. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts +16 -0
  386. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts.map +1 -0
  387. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.js +19 -0
  388. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts +24 -0
  389. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts.map +1 -0
  390. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.js +41 -0
  391. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts +24 -0
  392. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts.map +1 -0
  393. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.js +140 -0
  394. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts +21 -0
  395. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts.map +1 -0
  396. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.js +35 -0
  397. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts +19 -0
  398. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts.map +1 -0
  399. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.js +27 -0
  400. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_catmull_rom.js +4 -4
  401. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts +13 -0
  402. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts.map +1 -1
  403. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.js +54 -4
  404. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mitchell.js +4 -4
  405. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.d.ts.map +1 -1
  406. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.js +9 -13
  407. package/src/shade/renderer/texture/texture_block_encodings.d.ts +33 -0
  408. package/src/shade/renderer/texture/texture_block_encodings.d.ts.map +1 -0
  409. package/src/shade/renderer/texture/texture_block_encodings.js +89 -0
  410. package/src/shade/renderer/texture/texture_role_image_quality.d.ts +10 -0
  411. package/src/shade/renderer/texture/texture_role_image_quality.d.ts.map +1 -0
  412. package/src/shade/renderer/texture/texture_role_image_quality.js +29 -0
  413. package/src/format/texture/basis/astc_block.d.ts.map +0 -1
  414. package/src/format/texture/basis/astc_integer_sequence.d.ts.map +0 -1
  415. package/src/format/texture/basis/astc_partition.d.ts.map +0 -1
  416. package/src/format/texture/basis/uastc/bc7_tables.d.ts +0 -111
  417. package/src/format/texture/basis/uastc/bc7_tables.d.ts.map +0 -1
  418. package/src/format/texture/basis/uastc/bc7_write_block.d.ts +0 -124
  419. package/src/format/texture/basis/uastc/bc7_write_block.d.ts.map +0 -1
  420. /package/src/format/texture/{basis → astc}/astc_integer_sequence.d.ts +0 -0
  421. /package/src/format/texture/{basis → astc}/astc_partition.d.ts +0 -0
@@ -0,0 +1,98 @@
1
+ /**
2
+ * A URI that says where it is on its own: it opens with a scheme.
3
+ *
4
+ * @type {RegExp}
5
+ */
6
+ const HAS_SCHEME = /^[a-z][a-z0-9+.-]*:/i;
7
+
8
+ /**
9
+ * The part of a URL that is not path: a scheme and a host, or a host alone.
10
+ *
11
+ * @type {RegExp}
12
+ */
13
+ const AUTHORITY = /^(?:[a-z][a-z0-9+.-]*:)?\/\/[^/?#]*/i;
14
+
15
+ /**
16
+ * Where a path ends and a query or a fragment begins.
17
+ *
18
+ * @type {RegExp}
19
+ */
20
+ const AFTER_PATH = /[?#]/;
21
+
22
+ /**
23
+ * Where a file an MTF package names is: the URI as the package holds it, resolved against the package's own URL
24
+ * the way a browser resolves a link against the page it is on.
25
+ *
26
+ * The result has no `.` or `..` left in it wherever the package's URL allows, and that is the point of doing it
27
+ * here rather than leaving it to the fetch: a texture is shared by being asked for under one name. Two packages
28
+ * in different folders reach the same file by different relative URIs, and an asset manager that keyed on the
29
+ * unresolved forms would fetch it twice and hold two images.
30
+ *
31
+ * Characters are left as they are. Nothing is percent-encoded or decoded, so a path that names a file comes back
32
+ * as a path that names it.
33
+ *
34
+ * @param {string} uri relative to the package, from a root, or whole
35
+ * @param {string} package_url what the package was asked for by: a URL, or a path
36
+ * @returns {string}
37
+ *
38
+ * @author Alex Goldring
39
+ * @copyright Company Named Limited (c) 2026
40
+ */
41
+ export function mtf_resolve_uri(uri, package_url) {
42
+ if (HAS_SCHEME.test(uri) || uri.startsWith("//")) {
43
+ return uri;
44
+ }
45
+
46
+ const authority = AUTHORITY.exec(package_url);
47
+ const prefix = authority === null ? "" : authority[0];
48
+
49
+ if (uri.startsWith("/")) {
50
+ return prefix + uri;
51
+ }
52
+
53
+ let base_path = package_url.substring(prefix.length);
54
+
55
+ const base_end = base_path.search(AFTER_PATH);
56
+
57
+ if (base_end !== -1) {
58
+ base_path = base_path.substring(0, base_end);
59
+ }
60
+
61
+ const uri_end = uri.search(AFTER_PATH);
62
+ const uri_path = uri_end === -1 ? uri : uri.substring(0, uri_end);
63
+ const uri_rest = uri_end === -1 ? "" : uri.substring(uri_end);
64
+
65
+ const segments = base_path.split("/");
66
+
67
+ // the package's own name
68
+ segments.pop();
69
+
70
+ // a path from a root opens with an empty segment, which is the root: nothing climbs above it
71
+ const rooted = prefix.length > 0 || base_path.startsWith("/");
72
+ const floor = rooted && segments.length > 0 && segments[0] === "" ? 1 : 0;
73
+
74
+ const parts = uri_path.split("/");
75
+
76
+ for (let i = 0; i < parts.length; i++) {
77
+ const part = parts[i];
78
+
79
+ if (part === ".") {
80
+ continue;
81
+ }
82
+
83
+ if (part !== "..") {
84
+ segments.push(part);
85
+
86
+ continue;
87
+ }
88
+
89
+ if (segments.length > floor && segments[segments.length - 1] !== "..") {
90
+ segments.pop();
91
+ } else if (!rooted) {
92
+ // a relative path may be climbed out of: where that leads is whoever resolves it next to say
93
+ segments.push("..");
94
+ }
95
+ }
96
+
97
+ return prefix + segments.join("/") + uri_rest;
98
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The adapters an MTF package is written and read with, and the upgraders that bring a collection written at an
3
+ * earlier version of its class up to the one the adapter reads. A new registry a call: the adapters that resolve
4
+ * indices hold the lists they resolve against while a collection is being written or read.
5
+ *
6
+ * A class that gains a version registers its upgrader here, and every package ever written keeps reading.
7
+ *
8
+ * @returns {BinarySerializationRegistry}
9
+ *
10
+ * @author Alex Goldring
11
+ * @copyright Company Named Limited (c) 2026
12
+ */
13
+ export function mtf_serialization_registry(): BinarySerializationRegistry;
14
+ /**
15
+ * The names an MTF package's collections carry, in the order a package holds them. A name is what the file says
16
+ * its elements are, and what the reader finds their adapter and its upgraders by.
17
+ */
18
+ export const MTF_CLASS_TEXTURE: "MTFTexture";
19
+ export const MTF_CLASS_MATERIAL: "StandardShadeMaterial";
20
+ export const MTF_CLASS_GEOMETRY: "MeshletGeometry";
21
+ export const MTF_CLASS_NODE: "SceneNode";
22
+ export const MTF_CLASS_SKIN: "Skin";
23
+ export const MTF_CLASS_CLIP: "ShadeAnimationClip";
24
+ import { BinarySerializationRegistry } from "../../../../engine/ecs/storage/binary/BinarySerializationRegistry.js";
25
+ //# sourceMappingURL=mtf_serialization_registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_serialization_registry.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_serialization_registry.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;GAWG;AACH,8CALa,2BAA2B,CAuBvC;AAzCD;;;GAGG;AACH,6CAA8C;AAC9C,yDAA0D;AAC1D,mDAAoD;AACpD,yCAA0C;AAC1C,oCAAqC;AACrC,kDAAmD;4CAlBP,sEAAsE"}
@@ -0,0 +1,51 @@
1
+ import { BinarySerializationRegistry } from "../../../../engine/ecs/storage/binary/BinarySerializationRegistry.js";
2
+ import { ShadeAnimationClipSerializationAdapter } from "../../animation/ShadeAnimationClipSerializationAdapter.js";
3
+ import { SkinSerializationAdapter } from "../../animation/SkinSerializationAdapter.js";
4
+ import { MeshletGeometrySerializationAdapter } from "../../geometry/MeshletGeometrySerializationAdapter.js";
5
+ import { MeshletGeometrySerializationUpgrader_0_1 } from "../../geometry/MeshletGeometrySerializationUpgrader_0_1.js";
6
+ import { StandardShadeMaterialSerializationAdapter } from "../../material/StandardShadeMaterialSerializationAdapter.js";
7
+ import { SceneNodeSerializationAdapter } from "../SceneNodeSerializationAdapter.js";
8
+ import { MTFTextureSerializationAdapter } from "./MTFTextureSerializationAdapter.js";
9
+
10
+ /**
11
+ * The names an MTF package's collections carry, in the order a package holds them. A name is what the file says
12
+ * its elements are, and what the reader finds their adapter and its upgraders by.
13
+ */
14
+ export const MTF_CLASS_TEXTURE = "MTFTexture";
15
+ export const MTF_CLASS_MATERIAL = "StandardShadeMaterial";
16
+ export const MTF_CLASS_GEOMETRY = "MeshletGeometry";
17
+ export const MTF_CLASS_NODE = "SceneNode";
18
+ export const MTF_CLASS_SKIN = "Skin";
19
+ export const MTF_CLASS_CLIP = "ShadeAnimationClip";
20
+
21
+ /**
22
+ * The adapters an MTF package is written and read with, and the upgraders that bring a collection written at an
23
+ * earlier version of its class up to the one the adapter reads. A new registry a call: the adapters that resolve
24
+ * indices hold the lists they resolve against while a collection is being written or read.
25
+ *
26
+ * A class that gains a version registers its upgrader here, and every package ever written keeps reading.
27
+ *
28
+ * @returns {BinarySerializationRegistry}
29
+ *
30
+ * @author Alex Goldring
31
+ * @copyright Company Named Limited (c) 2026
32
+ */
33
+ export function mtf_serialization_registry() {
34
+ const registry = new BinarySerializationRegistry();
35
+
36
+ registry.registerAdapter(new MTFTextureSerializationAdapter(), MTF_CLASS_TEXTURE);
37
+ registry.registerAdapter(new StandardShadeMaterialSerializationAdapter(), MTF_CLASS_MATERIAL);
38
+
39
+ // with its tree: a package is read without building anything
40
+ const geometry = new MeshletGeometrySerializationAdapter();
41
+ geometry.serialize_bvh = true;
42
+
43
+ registry.registerAdapter(geometry, MTF_CLASS_GEOMETRY);
44
+ registry.registerUpgrader(MTF_CLASS_GEOMETRY, new MeshletGeometrySerializationUpgrader_0_1());
45
+
46
+ registry.registerAdapter(new SceneNodeSerializationAdapter(), MTF_CLASS_NODE);
47
+ registry.registerAdapter(new SkinSerializationAdapter(), MTF_CLASS_SKIN);
48
+ registry.registerAdapter(new ShadeAnimationClipSerializationAdapter(), MTF_CLASS_CLIP);
49
+
50
+ return registry;
51
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The texture an MTF texture file holds, as {@link mtf_texture_write} wrote it.
3
+ *
4
+ * Its levels are views of `data`, not copies: a level goes to the device from the file it arrived in, and the file
5
+ * lives as long as the texels do.
6
+ *
7
+ * Every refusal is a thrown error and none is an assert: a file is outside data, and a wrong one has to be refused
8
+ * in a build with asserts stripped too.
9
+ *
10
+ * @param {ArrayBuffer} data the whole file
11
+ * @returns {ShadeTexelData}
12
+ * @throws {Error} if the bytes are not a texture file, are of a version newer than {@link MTF_TEXTURE_VERSION},
13
+ * name a format the engine does not know, or are not exactly as long as their levels
14
+ *
15
+ * @author Alex Goldring
16
+ * @copyright Company Named Limited (c) 2026
17
+ */
18
+ export function mtf_texture_read(data: ArrayBuffer): ShadeTexelData;
19
+ import { ShadeTexelData } from "../../texture/source/ShadeTexelData.js";
20
+ //# sourceMappingURL=mtf_texture_read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_texture_read.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_texture_read.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;GAgBG;AACH,uCARW,WAAW,GACT,cAAc,CA+D1B;+BA7E8B,wCAAwC"}
@@ -0,0 +1,80 @@
1
+ import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
2
+ import { gpu_texture_format_without_srgb } from "../../texture/format/gpu_texture_format_without_srgb.js";
3
+ import { ShadeTexelData } from "../../texture/source/ShadeTexelData.js";
4
+ import { mtf_is_texture } from "./mtf_is_texture.js";
5
+ import { MTF_TEXTURE_VERSION } from "./MTF_TEXTURE_VERSION.js";
6
+
7
+ /**
8
+ * The texture an MTF texture file holds, as {@link mtf_texture_write} wrote it.
9
+ *
10
+ * Its levels are views of `data`, not copies: a level goes to the device from the file it arrived in, and the file
11
+ * lives as long as the texels do.
12
+ *
13
+ * Every refusal is a thrown error and none is an assert: a file is outside data, and a wrong one has to be refused
14
+ * in a build with asserts stripped too.
15
+ *
16
+ * @param {ArrayBuffer} data the whole file
17
+ * @returns {ShadeTexelData}
18
+ * @throws {Error} if the bytes are not a texture file, are of a version newer than {@link MTF_TEXTURE_VERSION},
19
+ * name a format the engine does not know, or are not exactly as long as their levels
20
+ *
21
+ * @author Alex Goldring
22
+ * @copyright Company Named Limited (c) 2026
23
+ */
24
+ export function mtf_texture_read(data) {
25
+ if (!mtf_is_texture(data)) {
26
+ throw new Error("not an MTF texture file: it does not open with 'MTFT'");
27
+ }
28
+
29
+ const buffer = BinaryBuffer.fromArrayBuffer(data);
30
+
31
+ // the magic
32
+ buffer.skip(4);
33
+
34
+ const version = buffer.readUint32();
35
+
36
+ if (version > MTF_TEXTURE_VERSION) {
37
+ throw new Error(`an MTF texture file of version ${version}, newer than this engine reads (${MTF_TEXTURE_VERSION})`);
38
+ }
39
+
40
+ // a file that names the sRGB one of a pair holds the same bytes: read as the other, as this engine writes it
41
+ const format = gpu_texture_format_without_srgb(buffer.readUTF8String());
42
+
43
+ const width = buffer.readUint32();
44
+ const height = buffer.readUint32();
45
+ const depth = buffer.readUint32();
46
+
47
+ const level_count = buffer.readUint8();
48
+
49
+ if (width === 0 || height === 0 || depth === 0 || level_count === 0) {
50
+ throw new Error(`an MTF texture file of ${width}x${height}x${depth} texels and ${level_count} levels holds no texture`);
51
+ }
52
+
53
+ const file_bytes = buffer.raw_bytes;
54
+ const file_length = data.byteLength;
55
+
56
+ /** @type {Uint8Array[]} */
57
+ const levels = new Array(level_count);
58
+
59
+ let position = buffer.position;
60
+
61
+ for (let level = level_count - 1; level >= 0; level--) {
62
+ // throws for a name that is not a format
63
+ const length = ShadeTexelData.level_byte_length(format, width, height, depth, level);
64
+
65
+ if (position + length > file_length) {
66
+ throw new Error(`the MTF texture file is cut short: level ${level} of the ${width}x${height}x${depth} '${format}' texture is ${length} bytes from ${position}, and the file is ${file_length} bytes long`);
67
+ }
68
+
69
+ levels[level] = file_bytes.subarray(position, position + length);
70
+
71
+ position += length;
72
+ }
73
+
74
+ if (position !== file_length) {
75
+ throw new Error(`the MTF texture file holds ${file_length - position} bytes after its last level`);
76
+ }
77
+
78
+ // refuses a chain that is neither one level nor whole
79
+ return new ShadeTexelData(format, width, height, depth, levels);
80
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @typedef {import("../../texture/TextureVariantSet.js").TextureVariantSet} TextureVariantSet
3
+ * @typedef {import("../../texture/TextureRole.js").TextureRole} TextureRole
4
+ */
5
+ /**
6
+ * Which of a texture's files a device fetches.
7
+ *
8
+ * First the engine's own choice: the best format for the role that was built and that the device samples
9
+ * ({@link texture_variant_select}). Where none of those was built, any format that was and that the device samples,
10
+ * in the order the record lists them, which is the order whoever built them chose. The fallback only when the
11
+ * device samples nothing that was built: texels a device takes as they are come before an image it has to decode.
12
+ *
13
+ * @param {TextureVariantSet} variants what was built for the texture
14
+ * @param {TextureRole|number} role what the texture is for
15
+ * @param {Set<GPUTextureFormat>} support what the device can sample
16
+ * @returns {string} the URI to fetch, as the record holds it
17
+ *
18
+ * @author Alex Goldring
19
+ * @copyright Company Named Limited (c) 2026
20
+ */
21
+ export function mtf_texture_select(variants: TextureVariantSet, role: TextureRole | number, support: Set<GPUTextureFormat>): string;
22
+ export type TextureVariantSet = import("../../texture/TextureVariantSet.js").TextureVariantSet;
23
+ export type TextureRole = import("../../texture/TextureRole.js").TextureRole;
24
+ //# sourceMappingURL=mtf_texture_select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_texture_select.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_texture_select.js"],"names":[],"mappings":"AAEA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,6CARW,iBAAiB,QACjB,WAAW,GAAC,MAAM,WAClB,qBAAqB,GACnB,MAAM,CAuBlB;gCAtCY,OAAO,oCAAoC,EAAE,iBAAiB;0BAC9D,OAAO,8BAA8B,EAAE,WAAW"}
@@ -0,0 +1,42 @@
1
+ import { texture_variant_select } from "../../texture/format/texture_variant_select.js";
2
+
3
+ /**
4
+ * @typedef {import("../../texture/TextureVariantSet.js").TextureVariantSet} TextureVariantSet
5
+ * @typedef {import("../../texture/TextureRole.js").TextureRole} TextureRole
6
+ */
7
+
8
+ /**
9
+ * Which of a texture's files a device fetches.
10
+ *
11
+ * First the engine's own choice: the best format for the role that was built and that the device samples
12
+ * ({@link texture_variant_select}). Where none of those was built, any format that was and that the device samples,
13
+ * in the order the record lists them, which is the order whoever built them chose. The fallback only when the
14
+ * device samples nothing that was built: texels a device takes as they are come before an image it has to decode.
15
+ *
16
+ * @param {TextureVariantSet} variants what was built for the texture
17
+ * @param {TextureRole|number} role what the texture is for
18
+ * @param {Set<GPUTextureFormat>} support what the device can sample
19
+ * @returns {string} the URI to fetch, as the record holds it
20
+ *
21
+ * @author Alex Goldring
22
+ * @copyright Company Named Limited (c) 2026
23
+ */
24
+ export function mtf_texture_select(variants, role, support) {
25
+ const preferred = texture_variant_select(variants, role, support);
26
+
27
+ if (preferred !== variants.fallback) {
28
+ return preferred;
29
+ }
30
+
31
+ const formats = variants.formats;
32
+
33
+ for (let i = 0; i < formats.length; i++) {
34
+ const format = formats[i];
35
+
36
+ if (support.has(format)) {
37
+ return variants.path(format);
38
+ }
39
+ }
40
+
41
+ return variants.fallback;
42
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * One texture in one GPU format, as an MTF texture file:
3
+ *
4
+ * <pre>
5
+ * u32 magic {@link MTF_TEXTURE_MAGIC}
6
+ * u32 version {@link MTF_TEXTURE_VERSION}
7
+ * UTF8 format the WebGPU name the payload states
8
+ * u32 width texels of the base level
9
+ * u32 height
10
+ * u32 depth
11
+ * u8 level_count
12
+ * levels coarsest first, the base level last
13
+ * </pre>
14
+ *
15
+ * A level is the payload's own bytes, rows of blocks with no padding, and its length is not written: it follows
16
+ * from the format and the size ({@link ShadeTexelData.level_byte_length}). Coarsest first puts a usable texture at
17
+ * the head of the file.
18
+ *
19
+ * What the bytes mean is the producer's to have settled: colour that carries opacity is premultiplied, and the
20
+ * format named is the non-sRGB one of its pair.
21
+ *
22
+ * @param {ShadeTexelData} texel_data every level present
23
+ * @returns {ArrayBuffer} the file
24
+ * @throws {Error} if a level has not arrived
25
+ *
26
+ * @author Alex Goldring
27
+ * @copyright Company Named Limited (c) 2026
28
+ */
29
+ export function mtf_texture_write(texel_data: ShadeTexelData): ArrayBuffer;
30
+ export type ShadeTexelData = import("../../texture/source/ShadeTexelData.js").ShadeTexelData;
31
+ //# sourceMappingURL=mtf_texture_write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_texture_write.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_texture_write.js"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,8CAPW,cAAc,GACZ,WAAW,CAgDvB;6BAhFY,OAAO,wCAAwC,EAAE,cAAc"}
@@ -0,0 +1,87 @@
1
+ import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
2
+ import { gpu_texture_format_without_srgb } from "../../texture/format/gpu_texture_format_without_srgb.js";
3
+ import { MTF_TEXTURE_MAGIC } from "./MTF_TEXTURE_MAGIC.js";
4
+ import { MTF_TEXTURE_VERSION } from "./MTF_TEXTURE_VERSION.js";
5
+
6
+ /**
7
+ * @typedef {import("../../texture/source/ShadeTexelData.js").ShadeTexelData} ShadeTexelData
8
+ */
9
+
10
+ /**
11
+ * More than the bytes of a texture file ahead of its levels: two words, a format name, three extents and a count.
12
+ *
13
+ * @type {number}
14
+ */
15
+ const HEADER_RESERVE = 128;
16
+
17
+ /**
18
+ * One texture in one GPU format, as an MTF texture file:
19
+ *
20
+ * <pre>
21
+ * u32 magic {@link MTF_TEXTURE_MAGIC}
22
+ * u32 version {@link MTF_TEXTURE_VERSION}
23
+ * UTF8 format the WebGPU name the payload states
24
+ * u32 width texels of the base level
25
+ * u32 height
26
+ * u32 depth
27
+ * u8 level_count
28
+ * levels coarsest first, the base level last
29
+ * </pre>
30
+ *
31
+ * A level is the payload's own bytes, rows of blocks with no padding, and its length is not written: it follows
32
+ * from the format and the size ({@link ShadeTexelData.level_byte_length}). Coarsest first puts a usable texture at
33
+ * the head of the file.
34
+ *
35
+ * What the bytes mean is the producer's to have settled: colour that carries opacity is premultiplied, and the
36
+ * format named is the non-sRGB one of its pair.
37
+ *
38
+ * @param {ShadeTexelData} texel_data every level present
39
+ * @returns {ArrayBuffer} the file
40
+ * @throws {Error} if a level has not arrived
41
+ *
42
+ * @author Alex Goldring
43
+ * @copyright Company Named Limited (c) 2026
44
+ */
45
+ export function mtf_texture_write(texel_data) {
46
+ const levels = texel_data.levels;
47
+ const level_count = levels.length;
48
+
49
+ let level_bytes = 0;
50
+
51
+ for (let level = 0; level < level_count; level++) {
52
+ const bytes = levels[level];
53
+
54
+ if (bytes === undefined) {
55
+ throw new Error(`level ${level} of the ${texel_data.width}x${texel_data.height}x${texel_data.depth} '${texel_data.format}' payload has not arrived, and a texture file holds every level`);
56
+ }
57
+
58
+ level_bytes += bytes.byteLength;
59
+ }
60
+
61
+ const buffer = new BinaryBuffer();
62
+
63
+ // once, rather than by growth: a base level is megabytes
64
+ buffer.ensureCapacity(HEADER_RESERVE + level_bytes);
65
+
66
+ buffer.writeUint32(MTF_TEXTURE_MAGIC);
67
+ buffer.writeUint32(MTF_TEXTURE_VERSION);
68
+
69
+ // the pair's two names are the same bytes: which of them a texture is, is its record's to say
70
+ buffer.writeUTF8String(gpu_texture_format_without_srgb(texel_data.format));
71
+
72
+ buffer.writeUint32(texel_data.width);
73
+ buffer.writeUint32(texel_data.height);
74
+ buffer.writeUint32(texel_data.depth);
75
+
76
+ buffer.writeUint8(level_count);
77
+
78
+ for (let level = level_count - 1; level >= 0; level--) {
79
+ const bytes = levels[level];
80
+
81
+ buffer.writeBytes(bytes, 0, bytes.byteLength);
82
+ }
83
+
84
+ buffer.trim();
85
+
86
+ return buffer.data;
87
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A model as an MTF package: a header, then six collections in the order each needs the ones before it.
3
+ *
4
+ * <pre>
5
+ * u32 magic {@link MTF_PACKAGE_MAGIC}
6
+ * u32 version {@link MTF_PACKAGE_VERSION}
7
+ * collection of {@link MTFTexture} one a texture the materials name
8
+ * collection of {@link StandardShadeMaterial} one a material the nodes draw with
9
+ * collection of {@link MeshletGeometry} one a geometry the nodes draw, with its tree
10
+ * collection of {@link SceneNode} the bundle's nodes, in their order
11
+ * collection of {@link Skin}
12
+ * collection of {@link ShadeAnimationClip}
13
+ * </pre>
14
+ *
15
+ * A collection is what {@link BinaryCollectionSerializer} writes: its class's name and version, a count, and each
16
+ * element by its adapter. The package holds no texels. A texture's record says where its files are
17
+ * (`texture_variants`), and whoever wrote those files is who knows.
18
+ *
19
+ * The bundle is read and not changed.
20
+ *
21
+ * @param {SceneBundle} bundle
22
+ * @param {Map<ShadeTexture, TextureVariantSet>} texture_variants for every texture of {@link mtf_bundle_textures},
23
+ * the encodings built for it and the URI of each, relative to where the package will be or absolute
24
+ * @returns {ArrayBuffer} the package
25
+ * @throws {Error} if a texture has no entry in `texture_variants`, a node draws with a material that is not a
26
+ * {@link StandardShadeMaterial} or a geometry whose meshlets are not in memory, or the bundle carries lights or
27
+ * foliage wind rigs
28
+ *
29
+ * @author Alex Goldring
30
+ * @copyright Company Named Limited (c) 2026
31
+ */
32
+ export function mtf_write(bundle: SceneBundle, texture_variants: Map<ShadeTexture, TextureVariantSet>): ArrayBuffer;
33
+ export type SceneBundle = import("../SceneBundle.js").SceneBundle;
34
+ export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
35
+ export type TextureVariantSet = import("../../texture/TextureVariantSet.js").TextureVariantSet;
36
+ //# sourceMappingURL=mtf_write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_write.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_write.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,kCAXW,WAAW,oBACX,IAAI,YAAY,EAAE,iBAAiB,CAAC,GAElC,WAAW,CAwFvB;0BAtHY,OAAO,mBAAmB,EAAE,WAAW;2BACvC,OAAO,+BAA+B,EAAE,YAAY;gCACpD,OAAO,oCAAoC,EAAE,iBAAiB"}
@@ -0,0 +1,137 @@
1
+ import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
2
+ import { BinaryCollectionSerializer } from "../../../../engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js";
3
+ import { mtf_bundle_textures } from "./mtf_bundle_textures.js";
4
+ import { MTF_PACKAGE_MAGIC } from "./MTF_PACKAGE_MAGIC.js";
5
+ import { MTF_PACKAGE_VERSION } from "./MTF_PACKAGE_VERSION.js";
6
+ import {
7
+ MTF_CLASS_CLIP,
8
+ MTF_CLASS_GEOMETRY,
9
+ MTF_CLASS_MATERIAL,
10
+ MTF_CLASS_NODE,
11
+ MTF_CLASS_SKIN,
12
+ MTF_CLASS_TEXTURE,
13
+ mtf_serialization_registry
14
+ } from "./mtf_serialization_registry.js";
15
+ import { mtf_write_collection } from "./mtf_write_collection.js";
16
+ import { MTFTexture } from "./MTFTexture.js";
17
+
18
+ /**
19
+ * @typedef {import("../SceneBundle.js").SceneBundle} SceneBundle
20
+ * @typedef {import("../../texture/ShadeTexture.js").ShadeTexture} ShadeTexture
21
+ * @typedef {import("../../texture/TextureVariantSet.js").TextureVariantSet} TextureVariantSet
22
+ */
23
+
24
+ const NO_OPTIONS = [];
25
+
26
+ /**
27
+ * A model as an MTF package: a header, then six collections in the order each needs the ones before it.
28
+ *
29
+ * <pre>
30
+ * u32 magic {@link MTF_PACKAGE_MAGIC}
31
+ * u32 version {@link MTF_PACKAGE_VERSION}
32
+ * collection of {@link MTFTexture} one a texture the materials name
33
+ * collection of {@link StandardShadeMaterial} one a material the nodes draw with
34
+ * collection of {@link MeshletGeometry} one a geometry the nodes draw, with its tree
35
+ * collection of {@link SceneNode} the bundle's nodes, in their order
36
+ * collection of {@link Skin}
37
+ * collection of {@link ShadeAnimationClip}
38
+ * </pre>
39
+ *
40
+ * A collection is what {@link BinaryCollectionSerializer} writes: its class's name and version, a count, and each
41
+ * element by its adapter. The package holds no texels. A texture's record says where its files are
42
+ * (`texture_variants`), and whoever wrote those files is who knows.
43
+ *
44
+ * The bundle is read and not changed.
45
+ *
46
+ * @param {SceneBundle} bundle
47
+ * @param {Map<ShadeTexture, TextureVariantSet>} texture_variants for every texture of {@link mtf_bundle_textures},
48
+ * the encodings built for it and the URI of each, relative to where the package will be or absolute
49
+ * @returns {ArrayBuffer} the package
50
+ * @throws {Error} if a texture has no entry in `texture_variants`, a node draws with a material that is not a
51
+ * {@link StandardShadeMaterial} or a geometry whose meshlets are not in memory, or the bundle carries lights or
52
+ * foliage wind rigs
53
+ *
54
+ * @author Alex Goldring
55
+ * @copyright Company Named Limited (c) 2026
56
+ */
57
+ export function mtf_write(bundle, texture_variants) {
58
+ const nodes = bundle.nodes;
59
+
60
+ // what a bundle can carry and a package of this version cannot: said, rather than left out without a word
61
+ if (bundle.lights.length > 0) {
62
+ throw new Error(`the model carries ${bundle.lights.length} light(s), which an MTF package of version ${MTF_PACKAGE_VERSION} does not hold: take them off the bundle to write it without them`);
63
+ }
64
+
65
+ if (bundle.foliage_rigs.length > 0) {
66
+ throw new Error(`the model carries ${bundle.foliage_rigs.length} foliage wind rig(s), which an MTF package of version ${MTF_PACKAGE_VERSION} does not hold: take them off the bundle to write it without them`);
67
+ }
68
+
69
+ // in the order nodes first name them; a Set keeps that order
70
+ const geometry_set = new Set();
71
+ const material_set = new Set();
72
+
73
+ for (let i = 0; i < nodes.length; i++) {
74
+ const node = nodes[i];
75
+
76
+ if (node.geometry === null) {
77
+ continue;
78
+ }
79
+
80
+ const material = node.material;
81
+
82
+ if (material.isStandardShadeMaterial !== true) {
83
+ throw new Error(`node '${node.name}' draws with material '${material.name}', which is not a StandardShadeMaterial: an MTF package of version ${MTF_PACKAGE_VERSION} holds no other kind`);
84
+ }
85
+
86
+ const geometry = node.geometry;
87
+
88
+ if (geometry.meshlets.count === 0 && geometry.primitive_count > 0) {
89
+ // a geometry streamed in pages holds its meshlets elsewhere, and would be written as one that draws nothing
90
+ throw new Error(`node '${node.name}' draws geometry '${geometry.name}', whose ${geometry.primitive_count} triangles are not held in memory as meshlets: an MTF package of version ${MTF_PACKAGE_VERSION} holds a geometry whole`);
91
+ }
92
+
93
+ geometry_set.add(geometry);
94
+ material_set.add(material);
95
+ }
96
+
97
+ const geometries = Array.from(geometry_set);
98
+ const materials = Array.from(material_set);
99
+
100
+ /** @type {ShadeTexture[]} */
101
+ const textures = [];
102
+
103
+ /** @type {MTFTexture[]} */
104
+ const records = [];
105
+
106
+ for (const [texture, role] of mtf_bundle_textures(bundle)) {
107
+ const variants = texture_variants.get(texture);
108
+
109
+ if (variants === undefined) {
110
+ throw new Error(`texture '${texture.label}' has no files given for it: every texture a material names needs the set of its encodings`);
111
+ }
112
+
113
+ textures.push(texture);
114
+ records.push(MTFTexture.from(texture, role, variants));
115
+ }
116
+
117
+ const buffer = new BinaryBuffer();
118
+
119
+ buffer.writeUint32(MTF_PACKAGE_MAGIC);
120
+ buffer.writeUint32(MTF_PACKAGE_VERSION);
121
+
122
+ const serializer = new BinaryCollectionSerializer();
123
+
124
+ serializer.setRegistry(mtf_serialization_registry());
125
+ serializer.setBuffer(buffer);
126
+
127
+ mtf_write_collection(serializer, MTF_CLASS_TEXTURE, records, NO_OPTIONS);
128
+ mtf_write_collection(serializer, MTF_CLASS_MATERIAL, materials, [textures]);
129
+ mtf_write_collection(serializer, MTF_CLASS_GEOMETRY, geometries, NO_OPTIONS);
130
+ mtf_write_collection(serializer, MTF_CLASS_NODE, nodes, [geometries, materials]);
131
+ mtf_write_collection(serializer, MTF_CLASS_SKIN, bundle.skins, NO_OPTIONS);
132
+ mtf_write_collection(serializer, MTF_CLASS_CLIP, bundle.clips, NO_OPTIONS);
133
+
134
+ buffer.trim();
135
+
136
+ return buffer.data;
137
+ }