@woosh/meep-engine 3.78.3 → 3.79.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 (367) hide show
  1. package/CHANGELOG.md +80 -13
  2. package/editor/view/node-graph/NodeGraphView.d.ts +1 -1
  3. package/editor/view/node-graph/NodeGraphView.js +1 -1
  4. package/package.json +1 -1
  5. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts +2 -1
  6. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.d.ts.map +1 -1
  7. package/src/core/math/physics/brdf/fresnel_Schlick_optimized.js +2 -1
  8. package/src/core/math/snap_to_integer.d.ts +13 -0
  9. package/src/core/math/snap_to_integer.d.ts.map +1 -0
  10. package/src/core/math/snap_to_integer.js +20 -0
  11. package/src/core/model/node-graph/NodeGraph.d.ts +0 -1
  12. package/src/core/model/node-graph/NodeGraph.d.ts.map +1 -1
  13. package/src/core/model/node-graph/NodeGraph.js +0 -1
  14. package/src/engine/asset/GameAssetType.d.ts +2 -0
  15. package/src/engine/asset/GameAssetType.js +10 -0
  16. package/src/engine/asset/guessAssetType.d.ts.map +1 -1
  17. package/src/engine/asset/guessAssetType.js +4 -0
  18. package/src/engine/asset/load_model_scene_bundle.d.ts +1 -1
  19. package/src/engine/asset/load_model_scene_bundle.js +2 -2
  20. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts +42 -0
  21. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts.map +1 -0
  22. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.js +83 -0
  23. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts +36 -0
  24. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts.map +1 -0
  25. package/src/engine/asset/loaders/MTFTextureAssetLoader.js +78 -0
  26. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts +6 -1
  27. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts.map +1 -1
  28. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +8 -2
  29. package/src/engine/graphics/hair/groom_bind_to_mesh.d.ts +1 -1
  30. package/src/engine/graphics/hair/groom_bind_to_mesh.js +1 -1
  31. package/src/engine/graphics/hair/groom_build_guides.d.ts +1 -1
  32. package/src/engine/graphics/hair/groom_build_guides.js +1 -1
  33. package/src/engine/graphics/impostors/voxel/README.md +11 -11
  34. package/src/engine/physics/cloth/collider/ClothColliderKind.js +1 -1
  35. package/src/engine/physics/cloth/ecs/cloth_geodesic.d.ts +1 -1
  36. package/src/engine/physics/cloth/ecs/cloth_geodesic.js +1 -1
  37. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts +2 -3
  38. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.d.ts.map +1 -1
  39. package/src/engine/physics/cloth/solver/constraint/cloth_backstop_row.js +2 -3
  40. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  41. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.d.ts +0 -2
  42. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.d.ts.map +1 -1
  43. package/src/generation/filtering/numeric/sampling/AbstractCellFilterSampleGridLayer.js +0 -5
  44. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.d.ts.map +1 -1
  45. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerCubic.js +5 -3
  46. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.d.ts.map +1 -1
  47. package/src/generation/filtering/numeric/sampling/CellFilterSampleLayerLinear.js +5 -3
  48. package/src/generation/grid/coords/grid_to_texel.d.ts +7 -1
  49. package/src/generation/grid/coords/grid_to_texel.d.ts.map +1 -1
  50. package/src/generation/grid/coords/grid_to_texel.js +11 -1
  51. package/src/generation/grid/coords/grid_to_texel_span.d.ts +15 -0
  52. package/src/generation/grid/coords/grid_to_texel_span.d.ts.map +1 -0
  53. package/src/generation/grid/coords/grid_to_texel_span.js +38 -0
  54. package/src/generation/grid/coords/texel_to_grid.d.ts +2 -1
  55. package/src/generation/grid/coords/texel_to_grid.d.ts.map +1 -1
  56. package/src/generation/grid/coords/texel_to_grid.js +6 -1
  57. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts +32 -1
  58. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts.map +1 -1
  59. package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.js +114 -9
  60. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts +8 -0
  61. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.d.ts.map +1 -1
  62. package/src/generation/grid/generation/discrete/layer/GridTaskBuildSourceDistanceMap.js +91 -29
  63. package/src/generation/grid/layers/GridDataLayer.d.ts +21 -2
  64. package/src/generation/grid/layers/GridDataLayer.d.ts.map +1 -1
  65. package/src/generation/grid/layers/GridDataLayer.js +43 -4
  66. package/src/generation/placement/action/GridCellActionPlaceTags.d.ts +7 -1
  67. package/src/generation/placement/action/GridCellActionPlaceTags.d.ts.map +1 -1
  68. package/src/generation/placement/action/GridCellActionPlaceTags.js +42 -16
  69. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.d.ts +5 -0
  70. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.d.ts.map +1 -1
  71. package/src/generation/placement/action/GridCellActionWriteFilterToLayer.js +32 -9
  72. package/src/generation/rules/CellMatcherLayerBitMaskTest.d.ts.map +1 -1
  73. package/src/generation/rules/CellMatcherLayerBitMaskTest.js +6 -2
  74. package/src/generation/wfc/GridWFCCompiledTileSet.d.ts +4 -2
  75. package/src/generation/wfc/GridWFCCompiledTileSet.d.ts.map +1 -1
  76. package/src/generation/wfc/GridWFCCompiledTileSet.js +2 -2
  77. package/src/generation/wfc/GridWFCTileSet.d.ts +16 -7
  78. package/src/generation/wfc/GridWFCTileSet.d.ts.map +1 -1
  79. package/src/generation/wfc/GridWFCTileSet.js +32 -8
  80. package/src/shade/playground/contact_shadows/shader_contact_lab_composite.js +2 -2
  81. package/src/shade/playground/particle_editor/README.md +2 -2
  82. package/src/shade/playground/probe_clipmap/index.html +1 -1
  83. package/src/shade/playground/screen_probes/README.md +5 -5
  84. package/src/shade/playground/screen_probes/main.js +1 -1
  85. package/src/shade/playground/tonemap_sdr/README.md +3 -2
  86. package/src/shade/playground/vgeo_scene/README.md +1 -3
  87. package/src/shade/playground/vgeo_scene/main.js +3 -3
  88. package/src/shade/renderer/Renderer.d.ts +3 -3
  89. package/src/shade/renderer/Renderer.js +4 -4
  90. package/src/shade/renderer/ShadeIndirectLightingMode.js +1 -1
  91. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  92. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  93. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  94. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts +33 -0
  95. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts.map +1 -0
  96. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js +196 -0
  97. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts +25 -0
  98. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts.map +1 -0
  99. package/src/shade/renderer/animation/SkinSerializationAdapter.js +85 -0
  100. package/src/shade/renderer/camera/PerspectiveCamera.js +1 -1
  101. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +11 -13
  102. package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
  103. package/src/shade/renderer/deferred/tonemap/ColorGrade.js +11 -13
  104. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.d.ts.map +1 -1
  105. package/src/shade/renderer/deferred/tonemap/TONE_MAP_OPERATOR_ACES.js +6 -7
  106. package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +1 -1
  107. package/src/shade/renderer/deferred/tonemap/ToneMapper.js +1 -1
  108. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts +6 -8
  109. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.d.ts.map +1 -1
  110. package/src/shade/renderer/deferred/tonemap/m3_white_balance_rec709.js +7 -10
  111. package/src/shade/renderer/geometry/sdf/MESH_SDF.d.ts +1 -1
  112. package/src/shade/renderer/geometry/sdf/MESH_SDF.js +1 -1
  113. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.d.ts +1 -1
  114. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_classify.js +1 -1
  115. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.d.ts +1 -1
  116. package/src/shade/renderer/geometry/sdf/bake/shader_mesh_sdf_evaluate.js +1 -1
  117. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts +1 -2
  118. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.d.ts.map +1 -1
  119. package/src/shade/renderer/geometry/sdf/chunk_blas_query_band_sdf.js +1 -2
  120. package/src/shade/renderer/geometry/sdf/chunk_scene_point_query_volume_sign.d.ts.map +1 -1
  121. package/src/shade/renderer/geometry/sdf/chunk_scene_point_query_volume_sign.js +2 -1
  122. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.d.ts +1 -1
  123. package/src/shade/renderer/geometry/sdf/surface/MESH_SURFACE_BAKE.js +1 -1
  124. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster_graph.js +1 -1
  125. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.d.ts +2 -2
  126. package/src/shade/renderer/geometry/virtual/format/page/VGEO_DEFAULT_PAGE_SIZE.js +2 -2
  127. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.d.ts +2 -2
  128. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.js +4 -4
  129. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.d.ts +1 -1
  130. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.js +1 -1
  131. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.js +1 -1
  132. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.d.ts +3 -3
  133. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.js +3 -3
  134. package/src/shade/renderer/global_illumination/brick4/README.md +2 -1
  135. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +4 -6
  136. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  137. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +4 -6
  138. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_MOVERS.d.ts +1 -1
  139. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_MOVERS.js +1 -1
  140. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +1 -1
  141. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +2 -2
  142. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts +1 -1
  143. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.js +1 -1
  144. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +1 -1
  145. package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +1 -1
  146. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +28 -35
  147. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
  148. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +28 -35
  149. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +21 -24
  150. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
  151. package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +21 -24
  152. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.d.ts +8 -8
  153. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe.js +8 -8
  154. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.d.ts +4 -4
  155. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_brdf_density.js +4 -4
  156. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts +3 -5
  157. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_interpolate.js +3 -5
  159. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.d.ts +4 -4
  160. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_lighting_history.js +4 -4
  161. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts +2 -3
  162. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.d.ts.map +1 -1
  163. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_rough_specular.js +2 -3
  164. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.d.ts +4 -4
  165. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_screen_march.js +4 -4
  166. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts +2 -4
  167. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.d.ts.map +1 -1
  168. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_surface.js +2 -4
  169. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts +2 -4
  170. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -1
  171. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +2 -4
  172. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts +13 -17
  173. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.d.ts.map +1 -1
  174. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +13 -17
  175. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts +11 -14
  176. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.d.ts.map +1 -1
  177. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +11 -14
  178. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.d.ts +2 -2
  179. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_pick.js +2 -2
  180. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.d.ts +9 -9
  181. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_place.js +9 -9
  182. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts +15 -18
  183. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.d.ts.map +1 -1
  184. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_resolve.js +16 -19
  185. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts +10 -11
  186. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.d.ts.map +1 -1
  187. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_trace_screen.js +11 -12
  188. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  189. package/src/shade/renderer/hair/GPUHairSystem.js +16 -7
  190. package/src/shade/renderer/hair/HAIR.d.ts +5 -3
  191. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
  192. package/src/shade/renderer/hair/HAIR.js +6 -4
  193. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts +9 -8
  194. package/src/shade/renderer/hair/chunk_hair_bsdf.d.ts.map +1 -1
  195. package/src/shade/renderer/hair/chunk_hair_bsdf.js +10 -9
  196. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts +5 -6
  197. package/src/shade/renderer/hair/chunk_hair_dual_scattering.d.ts.map +1 -1
  198. package/src/shade/renderer/hair/chunk_hair_dual_scattering.js +5 -6
  199. package/src/shade/renderer/hair/hair_lighting.d.ts +3 -3
  200. package/src/shade/renderer/hair/hair_lighting.d.ts.map +1 -1
  201. package/src/shade/renderer/hair/hair_lighting.js +4 -5
  202. package/src/shade/renderer/hair/hair_scattering_lut.d.ts +5 -5
  203. package/src/shade/renderer/hair/hair_scattering_lut.js +5 -5
  204. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +10 -10
  205. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -1
  206. package/src/shade/renderer/hair/hair_shadow_draw.js +21 -17
  207. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
  208. package/src/shade/renderer/hair/shader_hair_cull.js +6 -2
  209. package/src/shade/renderer/hair/shader_hair_roots.d.ts +2 -2
  210. package/src/shade/renderer/hair/shader_hair_roots.js +2 -2
  211. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +5 -4
  212. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -1
  213. package/src/shade/renderer/hair/shader_hair_shadow_list.js +10 -12
  214. package/src/shade/renderer/light/environment/DEFINES.d.ts +1 -1
  215. package/src/shade/renderer/light/environment/DEFINES.js +1 -1
  216. package/src/shade/renderer/light/environment/shader_convolve_reflection_map_from_blurred.js +2 -2
  217. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts +38 -0
  218. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts.map +1 -0
  219. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.js +198 -0
  220. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts +88 -0
  221. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts.map +1 -0
  222. package/src/shade/renderer/loader/mtf/MTFTexture.js +159 -0
  223. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts +30 -0
  224. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts.map +1 -0
  225. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.js +136 -0
  226. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts +7 -0
  227. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts.map +1 -0
  228. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.js +6 -0
  229. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts +8 -0
  230. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts.map +1 -0
  231. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js +7 -0
  232. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts +7 -0
  233. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts.map +1 -0
  234. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.js +6 -0
  235. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts +7 -0
  236. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts.map +1 -0
  237. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js +6 -0
  238. package/src/shade/renderer/loader/mtf/load_mtf.d.ts +41 -0
  239. package/src/shade/renderer/loader/mtf/load_mtf.d.ts.map +1 -0
  240. package/src/shade/renderer/loader/mtf/load_mtf.js +73 -0
  241. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts +19 -0
  242. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts.map +1 -0
  243. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.js +57 -0
  244. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +9 -0
  245. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -0
  246. package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +78 -0
  247. package/src/shade/renderer/loader/mtf/mtf_export.d.ts +45 -0
  248. package/src/shade/renderer/loader/mtf/mtf_export.d.ts.map +1 -0
  249. package/src/shade/renderer/loader/mtf/mtf_export.js +161 -0
  250. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts +9 -0
  251. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts.map +1 -0
  252. package/src/shade/renderer/loader/mtf/mtf_is_texture.js +12 -0
  253. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts +24 -0
  254. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts.map +1 -0
  255. package/src/shade/renderer/loader/mtf/mtf_read_collection.js +37 -0
  256. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts +27 -0
  257. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts.map +1 -0
  258. package/src/shade/renderer/loader/mtf/mtf_read_scene.js +121 -0
  259. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts +18 -0
  260. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts.map +1 -0
  261. package/src/shade/renderer/loader/mtf/mtf_read_textures.js +51 -0
  262. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts +21 -0
  263. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts.map +1 -0
  264. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.js +98 -0
  265. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts +25 -0
  266. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts.map +1 -0
  267. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.js +51 -0
  268. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts +20 -0
  269. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts.map +1 -0
  270. package/src/shade/renderer/loader/mtf/mtf_texture_read.js +80 -0
  271. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts +24 -0
  272. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts.map +1 -0
  273. package/src/shade/renderer/loader/mtf/mtf_texture_select.js +42 -0
  274. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts +31 -0
  275. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts.map +1 -0
  276. package/src/shade/renderer/loader/mtf/mtf_texture_write.js +87 -0
  277. package/src/shade/renderer/loader/mtf/mtf_write.d.ts +36 -0
  278. package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -0
  279. package/src/shade/renderer/loader/mtf/mtf_write.js +161 -0
  280. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts +39 -0
  281. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts.map +1 -0
  282. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.js +207 -0
  283. package/src/shade/renderer/material/dispatch/MaterialDispatch.d.ts +1 -2
  284. package/src/shade/renderer/material/dispatch/MaterialDispatch.d.ts.map +1 -1
  285. package/src/shade/renderer/material/dispatch/MaterialDispatch.js +1 -2
  286. package/src/shade/renderer/material/standard/fragment_gbuffer.d.ts.map +1 -1
  287. package/src/shade/renderer/material/standard/fragment_gbuffer.js +2 -1
  288. package/src/shade/renderer/material/util/dielectric_specular_color.d.ts +1 -1
  289. package/src/shade/renderer/material/util/dielectric_specular_color.js +1 -1
  290. package/src/shade/renderer/postprocess/dof/gather/DOF2_CONFIG.d.ts +1 -1
  291. package/src/shade/renderer/postprocess/dof/gather/DOF2_CONFIG.js +1 -1
  292. package/src/shade/renderer/postprocess/dof/gather/DOF2_PRESETS.js +1 -1
  293. package/src/shade/renderer/postprocess/dof/gather/DOF2_SETTINGS_STRUCT.d.ts +1 -1
  294. package/src/shade/renderer/postprocess/dof/gather/DOF2_SETTINGS_STRUCT.js +1 -1
  295. package/src/shade/renderer/postprocess/dof/gather/DOF2_TEXTURE_FORMAT.d.ts +1 -1
  296. package/src/shade/renderer/postprocess/dof/gather/DOF2_TEXTURE_FORMAT.js +1 -1
  297. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts +3 -4
  298. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts.map +1 -1
  299. package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.js +3 -4
  300. package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.d.ts +1 -1
  301. package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.js +1 -1
  302. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +1 -1
  303. package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +1 -1
  304. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  305. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +2 -3
  306. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.d.ts +1 -2
  307. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.d.ts.map +1 -1
  308. package/src/shade/renderer/postprocess/motion_blur/MOTION_BLUR_CONFIG.js +1 -2
  309. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts +2 -3
  310. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.d.ts.map +1 -1
  311. package/src/shade/renderer/postprocess/taa/chunk_fsr2_compute_depth_clip.js +2 -3
  312. package/src/shade/renderer/postprocess/taa/filter_blackman_harris.d.ts +1 -1
  313. package/src/shade/renderer/postprocess/taa/filter_blackman_harris.js +1 -1
  314. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.d.ts +1 -1
  315. package/src/shade/renderer/rasterize/native/depth/shadow_cascade_rasterization_pass_descriptor.js +1 -1
  316. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_alpha_tested_pass_descriptor.js +1 -1
  317. package/src/shade/renderer/restir/di/ReSTIRDI.d.ts +3 -3
  318. package/src/shade/renderer/restir/di/ReSTIRDI.js +3 -3
  319. package/src/shade/renderer/restir/di/chunk_restir_trace_visibility.d.ts +1 -1
  320. package/src/shade/renderer/restir/di/chunk_restir_trace_visibility.js +1 -1
  321. package/src/shade/renderer/scene/optimization/source_to_sampler2d.d.ts.map +1 -1
  322. package/src/shade/renderer/scene/optimization/source_to_sampler2d.js +3 -1
  323. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.d.ts +5 -5
  324. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.js +5 -5
  325. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
  326. package/src/shade/renderer/scene/serialization/deserialize_scene.js +491 -528
  327. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +0 -10
  328. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
  329. package/src/shade/renderer/scene/serialization/serialize_scene.js +15 -71
  330. package/src/shade/renderer/shader/chunk/brdf/chunk_MIN_DIELECTRICS_F0.d.ts +1 -1
  331. package/src/shade/renderer/shader/chunk/brdf/chunk_MIN_DIELECTRICS_F0.js +1 -1
  332. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts +1 -2
  333. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.d.ts.map +1 -1
  334. package/src/shade/renderer/shader/chunk/brdf/chunk_shadowed_F90.js +1 -2
  335. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +4 -5
  336. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
  337. package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +4 -5
  338. package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +2 -2
  339. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.d.ts +2 -2
  340. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_aces_ue_matrices.js +2 -2
  341. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.d.ts +14 -17
  342. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.d.ts.map +1 -1
  343. package/src/shade/renderer/shader/chunk/color/tonemap/aces/chunk_tonemap_ue_filmic.js +18 -21
  344. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris.d.ts +1 -1
  345. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris.js +1 -1
  346. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris229.d.ts +1 -1
  347. package/src/shade/renderer/shader/chunk/filter/chunk_filter_blackman_harris229.js +1 -1
  348. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +3 -4
  349. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -1
  350. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +3 -4
  351. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.d.ts +1 -1
  352. package/src/shade/renderer/shader/chunk/material/chunk_re_direct_multiscatter.js +1 -1
  353. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +3 -3
  354. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts +6 -8
  355. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.d.ts.map +1 -1
  356. package/src/shade/renderer/shadow/map/shader/chunk_sample_shadowmap_cascade.js +8 -10
  357. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts +5 -7
  358. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.d.ts.map +1 -1
  359. package/src/shade/renderer/shadow/map/shader/chunk_shadow_caster_depth_bias.js +5 -7
  360. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts +11 -0
  361. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts.map +1 -0
  362. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.js +14 -0
  363. package/src/shade/renderer/texture/texture_role_image_quality.d.ts +10 -0
  364. package/src/shade/renderer/texture/texture_role_image_quality.d.ts.map +1 -0
  365. package/src/shade/renderer/texture/texture_role_image_quality.js +29 -0
  366. package/src/shade/renderer/texture/virtual/README.md +257 -257
  367. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +2 -2
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The version of the MTF texture file this engine writes, and the newest it reads.
3
+ *
4
+ * @type {number}
5
+ */
6
+ export const MTF_TEXTURE_VERSION: number;
7
+ //# sourceMappingURL=MTF_TEXTURE_VERSION.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MTF_TEXTURE_VERSION.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kCAFU,MAAM,CAEqB"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The version of the MTF texture file this engine writes, and the newest it reads.
3
+ *
4
+ * @type {number}
5
+ */
6
+ export const MTF_TEXTURE_VERSION = 0;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @typedef {import("../../../../engine/asset/AssetManager.js").AssetManager} AssetManager
3
+ * @typedef {import("../../../../engine/asset/AssetRequestScope.js").AssetRequestScope} AssetRequestScope
4
+ * @typedef {import("../SceneBundle.js").SceneBundle} SceneBundle
5
+ */
6
+ /**
7
+ * Loads an MTF package: the model it holds, as the {@link SceneBundle} every loader produces, with its skins and
8
+ * clips.
9
+ *
10
+ * Of each texture, one file is fetched: the best encoding built for it that this device can sample
11
+ * ({@link mtf_texture_select}), or its fallback where none is. Every file comes through the asset manager
12
+ * under its resolved URL ({@link mtf_resolve_uri}), so a texture two packages name is fetched once and both hold
13
+ * the same image.
14
+ *
15
+ * Nothing is built on the way. Geometry is read as it was written, tree included; texels from a texture file go
16
+ * to the device as they are; clips are read finished. A fallback that is an image is decoded, and has its mips
17
+ * generated, as any image's are.
18
+ *
19
+ * The bundle is ready when its textures are.
20
+ *
21
+ * @param {string} url un-resolved — the asset manager resolves network paths
22
+ * @param {object} options
23
+ * @param {AssetManager} options.assetManager where the package and its textures come from, with a loader
24
+ * registered for {@link GameAssetType.TextureMTF}
25
+ * @param {AssetRequestScope} [options.scope] the load these requests belong to
26
+ * @param {Set<GPUTextureFormat>} options.texture_support what the device can sample, from
27
+ * `gpu_texture_compression_support(device)`. An empty set asks for every texture's fallback
28
+ * @returns {Promise<SceneBundle>}
29
+ *
30
+ * @author Alex Goldring
31
+ * @copyright Company Named Limited (c) 2026
32
+ */
33
+ export function load_mtf(url: string, { assetManager, scope, texture_support }: {
34
+ assetManager: import("../../../../engine/asset/AssetManager.js").AssetManager<any>;
35
+ scope?: AssetRequestScope;
36
+ texture_support: Set<GPUTextureFormat>;
37
+ }): Promise<SceneBundle>;
38
+ export type AssetManager = import("../../../../engine/asset/AssetManager.js").AssetManager<any>;
39
+ export type AssetRequestScope = import("../../../../engine/asset/AssetRequestScope.js").AssetRequestScope;
40
+ export type SceneBundle = import("../SceneBundle.js").SceneBundle;
41
+ //# sourceMappingURL=load_mtf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load_mtf.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/load_mtf.js"],"names":[],"mappings":"AAQA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,8BAZW,MAAM;IAEgB,YAAY;IAEN,KAAK,GAAjC,iBAAiB;IACc,eAAe,EAA9C,qBAAqB;IAEnB,QAAQ,WAAW,CAAC,CAoChC;;gCA9DY,OAAO,+CAA+C,EAAE,iBAAiB;0BACzE,OAAO,mBAAmB,EAAE,WAAW"}
@@ -0,0 +1,73 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+ import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
3
+ import { GameAssetType } from "../../../../engine/asset/GameAssetType.js";
4
+ import { mtf_read_scene } from "./mtf_read_scene.js";
5
+ import { mtf_read_textures } from "./mtf_read_textures.js";
6
+ import { mtf_resolve_uri } from "./mtf_resolve_uri.js";
7
+ import { mtf_texture_select } from "./mtf_texture_select.js";
8
+
9
+ /**
10
+ * @typedef {import("../../../../engine/asset/AssetManager.js").AssetManager} AssetManager
11
+ * @typedef {import("../../../../engine/asset/AssetRequestScope.js").AssetRequestScope} AssetRequestScope
12
+ * @typedef {import("../SceneBundle.js").SceneBundle} SceneBundle
13
+ */
14
+
15
+ /**
16
+ * Loads an MTF package: the model it holds, as the {@link SceneBundle} every loader produces, with its skins and
17
+ * clips.
18
+ *
19
+ * Of each texture, one file is fetched: the best encoding built for it that this device can sample
20
+ * ({@link mtf_texture_select}), or its fallback where none is. Every file comes through the asset manager
21
+ * under its resolved URL ({@link mtf_resolve_uri}), so a texture two packages name is fetched once and both hold
22
+ * the same image.
23
+ *
24
+ * Nothing is built on the way. Geometry is read as it was written, tree included; texels from a texture file go
25
+ * to the device as they are; clips are read finished. A fallback that is an image is decoded, and has its mips
26
+ * generated, as any image's are.
27
+ *
28
+ * The bundle is ready when its textures are.
29
+ *
30
+ * @param {string} url un-resolved — the asset manager resolves network paths
31
+ * @param {object} options
32
+ * @param {AssetManager} options.assetManager where the package and its textures come from, with a loader
33
+ * registered for {@link GameAssetType.TextureMTF}
34
+ * @param {AssetRequestScope} [options.scope] the load these requests belong to
35
+ * @param {Set<GPUTextureFormat>} options.texture_support what the device can sample, from
36
+ * `gpu_texture_compression_support(device)`. An empty set asks for every texture's fallback
37
+ * @returns {Promise<SceneBundle>}
38
+ *
39
+ * @author Alex Goldring
40
+ * @copyright Company Named Limited (c) 2026
41
+ */
42
+ export async function load_mtf(url, { assetManager, scope, texture_support }) {
43
+ assert.isString(url, 'url');
44
+ assert.defined(assetManager, 'assetManager');
45
+ assert.defined(texture_support, 'texture_support');
46
+
47
+ const file = await assetManager.promise(url, GameAssetType.ArrayBuffer, { scope });
48
+
49
+ const buffer = BinaryBuffer.fromArrayBuffer(file.create());
50
+
51
+ const records = mtf_read_textures(buffer);
52
+ const count = records.length;
53
+
54
+ const requests = new Array(count);
55
+
56
+ for (let i = 0; i < count; i++) {
57
+ const record = records[i];
58
+
59
+ const uri = mtf_texture_select(record.variants, record.role, texture_support);
60
+
61
+ requests[i] = assetManager.promise(mtf_resolve_uri(uri, url), GameAssetType.TextureMTF, { scope });
62
+ }
63
+
64
+ const images = await Promise.all(requests);
65
+
66
+ const textures = new Array(count);
67
+
68
+ for (let i = 0; i < count; i++) {
69
+ textures[i] = records[i].to_shade_texture(images[i].create());
70
+ }
71
+
72
+ return mtf_read_scene(buffer, textures);
73
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The textures a bundle's materials name, each once, in the order an MTF package holds their records: nodes in
3
+ * their order, and for each material met for the first time its albedo, normal, occlusion-roughness-metalness
4
+ * and emissive slots.
5
+ *
6
+ * A texture's role is that of the first slot that names it. The role is what its encodings are chosen by, so one
7
+ * texture under two roles gets the encodings of the first.
8
+ *
9
+ * @param {SceneBundle} bundle
10
+ * @returns {Map<ShadeTexture, TextureRole|number>} texture to role, in record order
11
+ *
12
+ * @author Alex Goldring
13
+ * @copyright Company Named Limited (c) 2026
14
+ */
15
+ export function mtf_bundle_textures(bundle: SceneBundle): Map<ShadeTexture, TextureRole | number>;
16
+ export type SceneBundle = import("../SceneBundle.js").SceneBundle;
17
+ export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
18
+ import { TextureRole } from "../../texture/TextureRole.js";
19
+ //# sourceMappingURL=mtf_bundle_textures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_bundle_textures.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_bundle_textures.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;GAaG;AACH,4CANW,WAAW,GACT,IAAI,YAAY,EAAE,WAAW,GAAC,MAAM,CAAC,CA6BjD;0BArDY,OAAO,mBAAmB,EAAE,WAAW;2BACvC,OAAO,+BAA+B,EAAE,YAAY;4BAJrC,8BAA8B"}
@@ -0,0 +1,57 @@
1
+ import { TextureRole } from "../../texture/TextureRole.js";
2
+
3
+ /**
4
+ * @typedef {import("../SceneBundle.js").SceneBundle} SceneBundle
5
+ * @typedef {import("../../texture/ShadeTexture.js").ShadeTexture} ShadeTexture
6
+ */
7
+
8
+ /**
9
+ * @param {Map<ShadeTexture, number>} roles
10
+ * @param {ShadeTexture|undefined} texture
11
+ * @param {TextureRole|number} role
12
+ */
13
+ function note(roles, texture, role) {
14
+ if (texture !== undefined && texture !== null && !roles.has(texture)) {
15
+ roles.set(texture, role);
16
+ }
17
+ }
18
+
19
+ /**
20
+ * The textures a bundle's materials name, each once, in the order an MTF package holds their records: nodes in
21
+ * their order, and for each material met for the first time its albedo, normal, occlusion-roughness-metalness
22
+ * and emissive slots.
23
+ *
24
+ * A texture's role is that of the first slot that names it. The role is what its encodings are chosen by, so one
25
+ * texture under two roles gets the encodings of the first.
26
+ *
27
+ * @param {SceneBundle} bundle
28
+ * @returns {Map<ShadeTexture, TextureRole|number>} texture to role, in record order
29
+ *
30
+ * @author Alex Goldring
31
+ * @copyright Company Named Limited (c) 2026
32
+ */
33
+ export function mtf_bundle_textures(bundle) {
34
+ /** @type {Map<ShadeTexture, number>} */
35
+ const roles = new Map();
36
+
37
+ const seen = new Set();
38
+
39
+ const nodes = bundle.nodes;
40
+
41
+ for (let i = 0; i < nodes.length; i++) {
42
+ const material = nodes[i].material;
43
+
44
+ if (material === null || seen.has(material)) {
45
+ continue;
46
+ }
47
+
48
+ seen.add(material);
49
+
50
+ note(roles, material.texture_albedo, TextureRole.Albedo);
51
+ note(roles, material.texture_normal, TextureRole.Normal);
52
+ note(roles, material.texture_orm, TextureRole.Orm);
53
+ note(roles, material.texture_emissive, TextureRole.Emissive);
54
+ }
55
+
56
+ return roles;
57
+ }
@@ -0,0 +1,9 @@
1
+ export function mtf_encode_texture(texture: ShadeTexture, role: TextureRole | number, stem: string, files: Map<string, ArrayBuffer>): Promise<TextureVariantSet>;
2
+ export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
3
+ export type TextureRole = import("../../texture/TextureRole.js").TextureRole;
4
+ /**
5
+ * What {@link mtf_export } asks for the files of one texture.
6
+ */
7
+ export type MTFTextureEncoder = (texture: ShadeTexture, role: TextureRole | number, stem: string, files: Map<string, ArrayBuffer>) => Promise<TextureVariantSet>;
8
+ import { TextureVariantSet } from "../../texture/TextureVariantSet.js";
9
+ //# sourceMappingURL=mtf_encode_texture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_encode_texture.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_encode_texture.js"],"names":[],"mappings":"AAeG,4CACQ,YAAY,QACZ,WAAW,GAAC,MAAM,QAClB,MAAM,SAEN,IAAI,MAAM,EAAE,WAAW,CAAC,GAEtB,QAAQ,iBAAiB,CAAC,CACtC;2BAfY,OAAO,+BAA+B,EAAE,YAAY;0BACpD,OAAO,8BAA8B,EAAE,WAAW;;;;0CAOpD,YAAY,QACZ,WAAW,GAAC,MAAM,QAClB,MAAM,SAEN,IAAI,MAAM,EAAE,WAAW,CAAC,KAEtB,QAAQ,iBAAiB,CAAC;kCAlBL,oCAAoC"}
@@ -0,0 +1,78 @@
1
+ import { Sampler2D } from "../../../../engine/graphics/texture/sampler/Sampler2D.js";
2
+ import { gpu_texture_format_feature } from "../../../descriptor/texture/format/gpu_texture_format_feature.js";
3
+ import { write_image_source } from "../../scene/serialization/write_image_source.js";
4
+ import { texture_role_image_quality } from "../../texture/texture_role_image_quality.js";
5
+ import { TextureVariantSet } from "../../texture/TextureVariantSet.js";
6
+ import { mtf_texture_write } from "./mtf_texture_write.js";
7
+
8
+ /**
9
+ * @typedef {import("../../texture/ShadeTexture.js").ShadeTexture} ShadeTexture
10
+ * @typedef {import("../../texture/TextureRole.js").TextureRole} TextureRole
11
+ */
12
+
13
+ /**
14
+ * What {@link mtf_export} asks for the files of one texture.
15
+ *
16
+ * @callback MTFTextureEncoder
17
+ * @param {ShadeTexture} texture
18
+ * @param {TextureRole|number} role what the texture is for, which is what its encodings are chosen by
19
+ * @param {string} stem where its files go, relative to the package and without an extension. No two textures of
20
+ * an export are given the same one
21
+ * @param {Map<string, ArrayBuffer>} files the export's files by URI relative to the package; the encoder adds
22
+ * each file it writes
23
+ * @returns {Promise<TextureVariantSet>} which encodings it built, by the URIs it put them under
24
+ */
25
+
26
+ /**
27
+ * The files of a texture when nothing builds block formats for it: its fallback, and no formats.
28
+ *
29
+ * - Decoded pixels become an AVIF, at the quality its role calls for ({@link texture_role_image_quality}). The
30
+ * encoder is given a copy: it keeps what it is handed, and the model's own pixels are left as they were.
31
+ * - Texels in a format every device samples become a texture file, as they are.
32
+ *
33
+ * Texels in a block format are refused. A fallback is for a device that cannot sample them, and making one would
34
+ * take decoding them.
35
+ *
36
+ * A tool that builds block formats passes {@link mtf_export} its own {@link MTFTextureEncoder}.
37
+ *
38
+ * @type {MTFTextureEncoder}
39
+ *
40
+ * @author Alex Goldring
41
+ * @copyright Company Named Limited (c) 2026
42
+ */
43
+ export async function mtf_encode_texture(texture, role, stem, files) {
44
+ const source = texture.image.source;
45
+
46
+ if (source !== undefined && source !== null && source.isShadeTexelData === true) {
47
+ const format = source.format;
48
+
49
+ if (gpu_texture_format_feature(format) !== undefined) {
50
+ throw new Error(`texture '${texture.label}' brings only '${format}' texels, which not every device samples: a fallback cannot be made of them without decoding them. Give it an encoder that has its pixels`);
51
+ }
52
+
53
+ const uri = `${stem}.mtt`;
54
+
55
+ files.set(uri, mtf_texture_write(source));
56
+
57
+ return new TextureVariantSet(uri, []);
58
+ }
59
+
60
+ const is_pixels = source !== undefined && source !== null
61
+ && (source.isSampler2D === true || (typeof ImageBitmap !== "undefined" && source instanceof ImageBitmap));
62
+
63
+ if (!is_pixels) {
64
+ throw new Error(`texture '${texture.label}' is over an image that is neither texels nor decoded pixels, and nothing here encodes it`);
65
+ }
66
+
67
+ const uri = `${stem}.avif`;
68
+
69
+ // the encoder keeps what it is given: a copy, so the model is still whole after its files are written, and
70
+ // an image met under two roles can be encoded twice
71
+ const pixels = source.isSampler2D === true
72
+ ? new Sampler2D(source.data.slice(), source.itemSize, source.width, source.height)
73
+ : await createImageBitmap(source);
74
+
75
+ files.set(uri, await write_image_source(pixels, texture_role_image_quality(role)));
76
+
77
+ return new TextureVariantSet(uri, []);
78
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * A model as the files of an MTF export: its package, and beside it a folder of the files its textures are in.
3
+ *
4
+ * <pre>
5
+ * &lt;name&gt;.mtf
6
+ * &lt;name&gt;_textures/0000_&lt;label&gt;.avif
7
+ * &lt;name&gt;_textures/0001_&lt;label&gt;.mtt
8
+ * ...
9
+ * </pre>
10
+ *
11
+ * The steps, in order:
12
+ *
13
+ * 1. With `optimize`, {@link scene_optimize} first: geometries that are alike become one, pieces that repeat are
14
+ * shared, and images that are the same pixels become one image. **It rewrites the bundle in place**, so the
15
+ * bundle is the caller's to give away. A model with skins is refused: the optimizer does not carry skinning.
16
+ * 2. The files of each texture are asked of `encode_texture`, once for each image a role is met with: textures
17
+ * over one image share its files.
18
+ * 3. {@link mtf_write}.
19
+ *
20
+ * Nothing is put anywhere. What comes back is the files by where they go relative to one another, and writing
21
+ * them out is the caller's.
22
+ *
23
+ * @param {object} options
24
+ * @param {SceneBundle} options.bundle
25
+ * @param {string} options.name what the package's file is called, without a folder or an extension
26
+ * @param {boolean} [options.optimize] whether to optimize the bundle before it is written
27
+ * @param {MTFTextureEncoder} [options.encode_texture] what builds a texture's files. The default builds a
28
+ * fallback and no block formats ({@link mtf_encode_texture})
29
+ * @returns {Promise<Map<string, ArrayBuffer>>} every file by its path, the package first. A texture's path is
30
+ * the URI the package names it by
31
+ *
32
+ * @author Alex Goldring
33
+ * @copyright Company Named Limited (c) 2026
34
+ */
35
+ export function mtf_export({ bundle, name, optimize, encode_texture, }: {
36
+ bundle: SceneBundle;
37
+ name: string;
38
+ optimize?: boolean;
39
+ encode_texture?: MTFTextureEncoder;
40
+ }): Promise<Map<string, ArrayBuffer>>;
41
+ export type SceneBundle = import("../SceneBundle.js").SceneBundle;
42
+ export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
43
+ export type TextureVariantSet = import("../../texture/TextureVariantSet.js").TextureVariantSet;
44
+ export type MTFTextureEncoder = import("./mtf_encode_texture.js").MTFTextureEncoder;
45
+ //# sourceMappingURL=mtf_export.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_export.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_export.js"],"names":[],"mappings":"AAwCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH;IAXgC,MAAM,EAA3B,WAAW;IACK,IAAI,EAApB,MAAM;IACY,QAAQ,GAA1B,OAAO;IACqB,cAAc,GAA1C,iBAAiB;IAEf,QAAQ,IAAI,MAAM,EAAE,WAAW,CAAC,CAAC,CA4F7C;0BAzJY,OAAO,mBAAmB,EAAE,WAAW;2BACvC,OAAO,+BAA+B,EAAE,YAAY;gCACpD,OAAO,oCAAoC,EAAE,iBAAiB;gCAC9D,OAAO,yBAAyB,EAAE,iBAAiB"}
@@ -0,0 +1,161 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+ import { scene_optimize } from "../../scene/optimization/scene_optimize.js";
3
+ import { mtf_bundle_textures } from "./mtf_bundle_textures.js";
4
+ import { mtf_encode_texture } from "./mtf_encode_texture.js";
5
+ import { mtf_write } from "./mtf_write.js";
6
+
7
+ /**
8
+ * @typedef {import("../SceneBundle.js").SceneBundle} SceneBundle
9
+ * @typedef {import("../../texture/ShadeTexture.js").ShadeTexture} ShadeTexture
10
+ * @typedef {import("../../texture/TextureVariantSet.js").TextureVariantSet} TextureVariantSet
11
+ * @typedef {import("./mtf_encode_texture.js").MTFTextureEncoder} MTFTextureEncoder
12
+ */
13
+
14
+ /**
15
+ * What a file name may hold wherever it ends up: a file system, a URL, a shell.
16
+ *
17
+ * @type {RegExp}
18
+ */
19
+ const UNSAFE_IN_A_FILE_NAME = /[^A-Za-z0-9._-]/g;
20
+
21
+ /**
22
+ * How much of a texture's label goes into its file name. A label can be a whole path, and a name is for telling
23
+ * files apart by eye: the number in front of it is what makes it unique.
24
+ *
25
+ * @type {number}
26
+ */
27
+ const LABEL_IN_A_FILE_NAME = 48;
28
+
29
+ /**
30
+ * @param {number} index
31
+ * @param {string} label
32
+ * @returns {string} a file name, without an extension, that no other index gets
33
+ */
34
+ function texture_file_stem(index, label) {
35
+ const number = String(index).padStart(4, "0");
36
+ const safe = label.replace(UNSAFE_IN_A_FILE_NAME, () => "_").substring(0, LABEL_IN_A_FILE_NAME);
37
+
38
+ return safe.length === 0 ? number : `${number}_${safe}`;
39
+ }
40
+
41
+ /**
42
+ * A model as the files of an MTF export: its package, and beside it a folder of the files its textures are in.
43
+ *
44
+ * <pre>
45
+ * &lt;name&gt;.mtf
46
+ * &lt;name&gt;_textures/0000_&lt;label&gt;.avif
47
+ * &lt;name&gt;_textures/0001_&lt;label&gt;.mtt
48
+ * ...
49
+ * </pre>
50
+ *
51
+ * The steps, in order:
52
+ *
53
+ * 1. With `optimize`, {@link scene_optimize} first: geometries that are alike become one, pieces that repeat are
54
+ * shared, and images that are the same pixels become one image. **It rewrites the bundle in place**, so the
55
+ * bundle is the caller's to give away. A model with skins is refused: the optimizer does not carry skinning.
56
+ * 2. The files of each texture are asked of `encode_texture`, once for each image a role is met with: textures
57
+ * over one image share its files.
58
+ * 3. {@link mtf_write}.
59
+ *
60
+ * Nothing is put anywhere. What comes back is the files by where they go relative to one another, and writing
61
+ * them out is the caller's.
62
+ *
63
+ * @param {object} options
64
+ * @param {SceneBundle} options.bundle
65
+ * @param {string} options.name what the package's file is called, without a folder or an extension
66
+ * @param {boolean} [options.optimize] whether to optimize the bundle before it is written
67
+ * @param {MTFTextureEncoder} [options.encode_texture] what builds a texture's files. The default builds a
68
+ * fallback and no block formats ({@link mtf_encode_texture})
69
+ * @returns {Promise<Map<string, ArrayBuffer>>} every file by its path, the package first. A texture's path is
70
+ * the URI the package names it by
71
+ *
72
+ * @author Alex Goldring
73
+ * @copyright Company Named Limited (c) 2026
74
+ */
75
+ export async function mtf_export({
76
+ bundle,
77
+ name,
78
+ optimize = false,
79
+ encode_texture = mtf_encode_texture,
80
+ }) {
81
+ assert.defined(bundle, 'bundle');
82
+ assert.equal(bundle.isSceneBundle, true, 'bundle.isSceneBundle !== true');
83
+ assert.isString(name, 'name');
84
+ if (name.length === 0 || name.includes("/") || name.includes("\\")) {
85
+ // not an assert: a texture's URI is built from the name and resolved against the package's own folder, so
86
+ // a name with a folder in it writes a package whose textures are not where it says
87
+ throw new Error(`the package's name is a file's name without a folder or an extension, got '${name}'`);
88
+ }
89
+
90
+ assert.isBoolean(optimize, 'optimize');
91
+ assert.isFunction(encode_texture, 'encode_texture');
92
+
93
+ if (optimize) {
94
+ if (bundle.skins.length > 0) {
95
+ // the optimizer rebuilds the pieces it shares without their joints and weights, and makes a node it
96
+ // splits a parent of pieces while its skin still names the node
97
+ throw new Error(`the model has ${bundle.skins.length} skin(s), and scene optimization does not carry skinning: export it as it is`);
98
+ }
99
+
100
+ scene_optimize(bundle);
101
+ }
102
+
103
+ /** @type {Map<string, ArrayBuffer>} */
104
+ const files = new Map();
105
+
106
+ const package_path = `${name}.mtf`;
107
+
108
+ // its place is the first; its bytes come last, when every texture's files are known
109
+ files.set(package_path, null);
110
+
111
+ /** @type {ShadeTexture[]} */
112
+ const textures = [];
113
+
114
+ /** @type {Promise<TextureVariantSet>[]} one a texture, shared by textures over one image in one role */
115
+ const encodings = [];
116
+
117
+ /** @type {Map<*, Map<number, Promise<TextureVariantSet>>>} image source, then role */
118
+ const encoded = new Map();
119
+
120
+ let file_count = 0;
121
+
122
+ for (const [texture, role] of mtf_bundle_textures(bundle)) {
123
+ const source = texture.image.source;
124
+
125
+ let by_role = encoded.get(source);
126
+
127
+ if (by_role === undefined) {
128
+ by_role = new Map();
129
+
130
+ encoded.set(source, by_role);
131
+ }
132
+
133
+ let encoding = by_role.get(role);
134
+
135
+ if (encoding === undefined) {
136
+ const stem = `${name}_textures/${texture_file_stem(file_count, texture.label)}`;
137
+
138
+ file_count++;
139
+
140
+ encoding = encode_texture(texture, role, stem, files);
141
+
142
+ by_role.set(role, encoding);
143
+ }
144
+
145
+ textures.push(texture);
146
+ encodings.push(encoding);
147
+ }
148
+
149
+ const variant_sets = await Promise.all(encodings);
150
+
151
+ /** @type {Map<ShadeTexture, TextureVariantSet>} */
152
+ const texture_variants = new Map();
153
+
154
+ for (let i = 0; i < textures.length; i++) {
155
+ texture_variants.set(textures[i], variant_sets[i]);
156
+ }
157
+
158
+ files.set(package_path, mtf_write(bundle, texture_variants));
159
+
160
+ return files;
161
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Whether bytes are an MTF texture file, by how they open. What a texture's fallback is — a texture file or an
3
+ * image — is told this way and not from its URI.
4
+ *
5
+ * @param {ArrayBuffer} data
6
+ * @returns {boolean}
7
+ */
8
+ export function mtf_is_texture(data: ArrayBuffer): boolean;
9
+ //# sourceMappingURL=mtf_is_texture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_is_texture.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_is_texture.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,qCAHW,WAAW,GACT,OAAO,CAInB"}
@@ -0,0 +1,12 @@
1
+ import { MTF_TEXTURE_MAGIC } from "./MTF_TEXTURE_MAGIC.js";
2
+
3
+ /**
4
+ * Whether bytes are an MTF texture file, by how they open. What a texture's fallback is — a texture file or an
5
+ * image — is told this way and not from its URI.
6
+ *
7
+ * @param {ArrayBuffer} data
8
+ * @returns {boolean}
9
+ */
10
+ export function mtf_is_texture(data) {
11
+ return data.byteLength >= 4 && new DataView(data).getUint32(0, true) === MTF_TEXTURE_MAGIC;
12
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @typedef {import("../../../../core/binary/BinaryBuffer.js").BinaryBuffer} BinaryBuffer
3
+ * @typedef {import("../../../../engine/ecs/storage/binary/BinarySerializationRegistry.js").BinarySerializationRegistry} BinarySerializationRegistry
4
+ * @typedef {import("../../../../engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js").BinaryCollectionDeSerializer} BinaryCollectionDeSerializer
5
+ */
6
+ /**
7
+ * Read the collection at the deserializer's buffer position, which a package holds as its next one, and append
8
+ * its elements to `out` in the order they were written.
9
+ *
10
+ * A collection written at an earlier version of its class is brought up to this one by the registry's upgraders,
11
+ * element by element; one written at a later version is refused by the deserializer.
12
+ *
13
+ * @template T
14
+ * @param {BinaryCollectionDeSerializer} deserializer with its registry and buffer set
15
+ * @param {string} class_name what a package holds at this point
16
+ * @param {Array} adapter_options what the class's adapter is initialized with
17
+ * @param {T[]} out
18
+ * @throws {Error} if the collection is of another class
19
+ */
20
+ export function mtf_read_collection<T>(deserializer: BinaryCollectionDeSerializer, class_name: string, adapter_options: any[], out: T[]): void;
21
+ export type BinaryBuffer = import("../../../../core/binary/BinaryBuffer.js").BinaryBuffer;
22
+ export type BinarySerializationRegistry = import("../../../../engine/ecs/storage/binary/BinarySerializationRegistry.js").BinarySerializationRegistry;
23
+ export type BinaryCollectionDeSerializer = import("../../../../engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js").BinaryCollectionDeSerializer;
24
+ //# sourceMappingURL=mtf_read_collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_read_collection.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_read_collection.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;GAaG;AACH,qDANW,4BAA4B,cAC5B,MAAM,0CAqBhB;2BAnCY,OAAO,yCAAyC,EAAE,YAAY;0CAC9D,OAAO,sEAAsE,EAAE,2BAA2B;2CAC1G,OAAO,kFAAkF,EAAE,4BAA4B"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @typedef {import("../../../../core/binary/BinaryBuffer.js").BinaryBuffer} BinaryBuffer
3
+ * @typedef {import("../../../../engine/ecs/storage/binary/BinarySerializationRegistry.js").BinarySerializationRegistry} BinarySerializationRegistry
4
+ * @typedef {import("../../../../engine/ecs/storage/binary/collection/BinaryCollectionDeSerializer.js").BinaryCollectionDeSerializer} BinaryCollectionDeSerializer
5
+ */
6
+
7
+ /**
8
+ * Read the collection at the deserializer's buffer position, which a package holds as its next one, and append
9
+ * its elements to `out` in the order they were written.
10
+ *
11
+ * A collection written at an earlier version of its class is brought up to this one by the registry's upgraders,
12
+ * element by element; one written at a later version is refused by the deserializer.
13
+ *
14
+ * @template T
15
+ * @param {BinaryCollectionDeSerializer} deserializer with its registry and buffer set
16
+ * @param {string} class_name what a package holds at this point
17
+ * @param {Array} adapter_options what the class's adapter is initialized with
18
+ * @param {T[]} out
19
+ * @throws {Error} if the collection is of another class
20
+ */
21
+ export function mtf_read_collection(deserializer, class_name, adapter_options, out) {
22
+ const expected = deserializer.getRegistry().getAdapter(class_name);
23
+
24
+ deserializer.initialize({ adapterOptionsSupplier: () => adapter_options });
25
+
26
+ if (deserializer.getElementClass() !== expected.klass) {
27
+ throw new Error(`the MTF package holds a collection of another class where its '${class_name}' are due`);
28
+ }
29
+
30
+ const count = deserializer.getElementCount();
31
+
32
+ for (let i = 0; i < count; i++) {
33
+ out.push(deserializer.read().value);
34
+ }
35
+
36
+ deserializer.finalize();
37
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The second half of reading an MTF package: its materials, geometries, nodes, skins and clips, as the bundle
3
+ * every loader produces.
4
+ *
5
+ * A geometry or a material several nodes draw is one object in the bundle, as it is one record in the package.
6
+ * Nothing is built: a geometry comes back with the tree it was written with, and a clip with its curves as they
7
+ * were.
8
+ *
9
+ * Every refusal is a thrown error and none is an assert: a file is outside data.
10
+ *
11
+ * @param {BinaryBuffer} buffer where {@link mtf_read_textures} left it
12
+ * @param {ShadeTexture[]} textures one for each record {@link mtf_read_textures} returned, in that order
13
+ * @returns {SceneBundle}
14
+ * @throws {Error} if a record names something the package does not hold, a node comes before its parent, or
15
+ * bytes follow the last collection
16
+ *
17
+ * @author Alex Goldring
18
+ * @copyright Company Named Limited (c) 2026
19
+ */
20
+ export function mtf_read_scene(buffer: BinaryBuffer, textures: ShadeTexture[]): SceneBundle;
21
+ export type BinaryBuffer = import("../../../../core/binary/BinaryBuffer.js").BinaryBuffer;
22
+ export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
23
+ export type StandardShadeMaterial = import("../../material/StandardShadeMaterial.js").StandardShadeMaterial;
24
+ export type MeshletGeometry = import("../../geometry/MeshletGeometry.js").MeshletGeometry;
25
+ export type SceneNode = import("../SceneNode.js").SceneNode;
26
+ import { SceneBundle } from "../SceneBundle.js";
27
+ //# sourceMappingURL=mtf_read_scene.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mtf_read_scene.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_read_scene.js"],"names":[],"mappings":"AAqCA;;;;;;;;;;;;;;;;;;GAkBG;AACH,uCATW,YAAY,YACZ,YAAY,EAAE,GACZ,WAAW,CAuEvB;2BA3GY,OAAO,yCAAyC,EAAE,YAAY;2BAC9D,OAAO,+BAA+B,EAAE,YAAY;oCACpD,OAAO,yCAAyC,EAAE,qBAAqB;8BACvE,OAAO,mCAAmC,EAAE,eAAe;wBAC3D,OAAO,iBAAiB,EAAE,SAAS;4BAhBpB,mBAAmB"}