@woosh/meep-engine 3.78.4 → 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 (121) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/package.json +1 -1
  3. package/src/engine/asset/GameAssetType.d.ts +2 -0
  4. package/src/engine/asset/GameAssetType.js +10 -0
  5. package/src/engine/asset/guessAssetType.d.ts.map +1 -1
  6. package/src/engine/asset/guessAssetType.js +4 -0
  7. package/src/engine/asset/load_model_scene_bundle.d.ts +1 -1
  8. package/src/engine/asset/load_model_scene_bundle.js +2 -2
  9. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts +42 -0
  10. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts.map +1 -0
  11. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.js +83 -0
  12. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts +36 -0
  13. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts.map +1 -0
  14. package/src/engine/asset/loaders/MTFTextureAssetLoader.js +78 -0
  15. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts +6 -1
  16. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts.map +1 -1
  17. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +8 -2
  18. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  19. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  20. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  21. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  22. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts +33 -0
  23. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts.map +1 -0
  24. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js +196 -0
  25. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts +25 -0
  26. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts.map +1 -0
  27. package/src/shade/renderer/animation/SkinSerializationAdapter.js +85 -0
  28. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  29. package/src/shade/renderer/hair/GPUHairSystem.js +16 -7
  30. package/src/shade/renderer/hair/HAIR.d.ts +5 -3
  31. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
  32. package/src/shade/renderer/hair/HAIR.js +6 -4
  33. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +10 -10
  34. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -1
  35. package/src/shade/renderer/hair/hair_shadow_draw.js +21 -17
  36. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
  37. package/src/shade/renderer/hair/shader_hair_cull.js +6 -2
  38. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +5 -4
  39. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -1
  40. package/src/shade/renderer/hair/shader_hair_shadow_list.js +10 -12
  41. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts +38 -0
  42. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts.map +1 -0
  43. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.js +198 -0
  44. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts +88 -0
  45. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts.map +1 -0
  46. package/src/shade/renderer/loader/mtf/MTFTexture.js +159 -0
  47. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts +30 -0
  48. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts.map +1 -0
  49. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.js +136 -0
  50. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts +7 -0
  51. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts.map +1 -0
  52. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.js +6 -0
  53. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts +8 -0
  54. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts.map +1 -0
  55. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js +7 -0
  56. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts +7 -0
  57. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts.map +1 -0
  58. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.js +6 -0
  59. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts +7 -0
  60. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts.map +1 -0
  61. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js +6 -0
  62. package/src/shade/renderer/loader/mtf/load_mtf.d.ts +41 -0
  63. package/src/shade/renderer/loader/mtf/load_mtf.d.ts.map +1 -0
  64. package/src/shade/renderer/loader/mtf/load_mtf.js +73 -0
  65. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts +19 -0
  66. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts.map +1 -0
  67. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.js +57 -0
  68. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +9 -0
  69. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -0
  70. package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +78 -0
  71. package/src/shade/renderer/loader/mtf/mtf_export.d.ts +45 -0
  72. package/src/shade/renderer/loader/mtf/mtf_export.d.ts.map +1 -0
  73. package/src/shade/renderer/loader/mtf/mtf_export.js +161 -0
  74. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts +9 -0
  75. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts.map +1 -0
  76. package/src/shade/renderer/loader/mtf/mtf_is_texture.js +12 -0
  77. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts +24 -0
  78. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts.map +1 -0
  79. package/src/shade/renderer/loader/mtf/mtf_read_collection.js +37 -0
  80. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts +27 -0
  81. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts.map +1 -0
  82. package/src/shade/renderer/loader/mtf/mtf_read_scene.js +121 -0
  83. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts +18 -0
  84. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts.map +1 -0
  85. package/src/shade/renderer/loader/mtf/mtf_read_textures.js +51 -0
  86. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts +21 -0
  87. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts.map +1 -0
  88. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.js +98 -0
  89. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts +25 -0
  90. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts.map +1 -0
  91. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.js +51 -0
  92. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts +20 -0
  93. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts.map +1 -0
  94. package/src/shade/renderer/loader/mtf/mtf_texture_read.js +80 -0
  95. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts +24 -0
  96. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts.map +1 -0
  97. package/src/shade/renderer/loader/mtf/mtf_texture_select.js +42 -0
  98. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts +31 -0
  99. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts.map +1 -0
  100. package/src/shade/renderer/loader/mtf/mtf_texture_write.js +87 -0
  101. package/src/shade/renderer/loader/mtf/mtf_write.d.ts +36 -0
  102. package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -0
  103. package/src/shade/renderer/loader/mtf/mtf_write.js +161 -0
  104. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts +39 -0
  105. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts.map +1 -0
  106. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.js +207 -0
  107. package/src/shade/renderer/scene/optimization/source_to_sampler2d.d.ts.map +1 -1
  108. package/src/shade/renderer/scene/optimization/source_to_sampler2d.js +3 -1
  109. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.d.ts +5 -5
  110. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.js +5 -5
  111. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
  112. package/src/shade/renderer/scene/serialization/deserialize_scene.js +491 -528
  113. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +0 -10
  114. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
  115. package/src/shade/renderer/scene/serialization/serialize_scene.js +15 -71
  116. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts +11 -0
  117. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts.map +1 -0
  118. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.js +14 -0
  119. package/src/shade/renderer/texture/texture_role_image_quality.d.ts +10 -0
  120. package/src/shade/renderer/texture/texture_role_image_quality.d.ts.map +1 -0
  121. package/src/shade/renderer/texture/texture_role_image_quality.js +29 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### MTF: a model package in the engine's own form
6
+
7
+ - **Added:** MTF, meep transfer format (`shade/renderer/loader/mtf/DESIGN.md`). A package, `.mtf`, holds a model
8
+ as the engine uses it: nodes, meshlet geometry with its tree, materials, skins and animation clips, each written
9
+ by a `BinaryClassSerializationAdapter` in a `BinaryCollectionSerializer` collection, so a package written at an
10
+ earlier version of a class is brought up to date on read. Textures are files outside the package, named by URI
11
+ and shared by any number of packages: one file a GPU format (`.mtt`, the texels as a device takes them, mip
12
+ levels coarsest first) and a fallback that may be any image. A device fetches the one file it can sample.
13
+ - **Added:** `load_mtf(url, { assetManager, scope, texture_support })`, and `MTFSceneBundleAssetLoader` for
14
+ `GameAssetType.ModelMTF`, constructed with `gpu_texture_compression_support(device)`. It registers
15
+ `MTFTextureAssetLoader` (`GameAssetType.TextureMTF`) itself. `guessAssetType` knows `.mtf` and `.mtt`, and
16
+ `load_model_scene_bundle` takes a package.
17
+ - **Added:** `mtf_write(bundle, texture_variants)` and `mtf_texture_write(texel_data)`, and over them
18
+ `mtf_export({ bundle, name, optimize, encode_texture })`, which returns every file of a model by its path.
19
+ `optimize` runs `scene_optimize` on the bundle first. `encode_texture` builds a texture's files; the default
20
+ writes an AVIF fallback for decoded pixels, a texture file for texels every device samples, and no block formats.
21
+ - **Added:** `StandardShadeMaterialSerializationAdapter`, `SceneNodeSerializationAdapter`,
22
+ `SkinSerializationAdapter` and `ShadeAnimationClipSerializationAdapter`. A clip's record holds each curve once
23
+ and its channels name curves by index, so curves shared between components stay shared.
24
+ - **Changed:** a SHADE scene's materials are written and read through `StandardShadeMaterialSerializationAdapter`.
25
+ The bytes are the same. `material_write_standard` is no longer exported from `serialize_scene.js`, and a scene
26
+ whose material names a texture the file does not hold is now refused on read.
27
+ - **Fixed:** `scene_optimize` threw `ImageBitmap is not defined` outside a browser when a material's texture was
28
+ already texels in a GPU format.
29
+ - **Added:** `BinaryCollectionSerializer.initialize({ dictionary })`. `false` writes every value whole. The
30
+ dictionary, still on by default, writes a value equal to an earlier one as a reference to it, which loses
31
+ whatever the class's `equals` does not look at; a package is written with it off.
32
+ - **Added:** `gpu_texture_format_without_srgb(format)`: the name stored texels go under.
33
+ - **Added:** `@woosh/gltf2mtf`, a package of its own beside the engine (`packages/gltf2mtf`): a command that
34
+ converts glTF and GLB models to MTF, `npx @woosh/gltf2mtf <models> --out <folder>`. The textures of every model
35
+ go to one folder the packages share, a file named by a digest of what it holds, so models that use the same image
36
+ share one file, in one run and across runs. Images are written as AVIF on every core but one, or copied with
37
+ `--images copy`. The scene optimizer runs over each model first, unless `--no-optimize` is given.
38
+
5
39
  ### Generation: wave function collapse over a grid
6
40
 
7
41
  - **Added:** `GridTaskWaveFunctionCollapse`, a grid task that lays the tiles of a `GridWFCTileSet` over the whole
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "Advanced 3D game engine",
7
7
  "type": "module",
8
8
  "author": "Alexander Goldring",
9
- "version": "3.78.4",
9
+ "version": "3.79.0",
10
10
  "exports": {
11
11
  "./build/*": "./build/*",
12
12
  "./src/*": "./src/*",
@@ -6,6 +6,8 @@ export namespace GameAssetType {
6
6
  let ModelGLTF: string;
7
7
  let ModelGLTF_JSON: string;
8
8
  let ModelUSD: string;
9
+ let ModelMTF: string;
10
+ let TextureMTF: string;
9
11
  let ArrayBuffer: string;
10
12
  let Texture: string;
11
13
  let DeferredTexture: string;
@@ -13,6 +13,16 @@ export const GameAssetType = {
13
13
  * bytes do.
14
14
  */
15
15
  ModelUSD: "model/vnd.usd",
16
+ /**
17
+ * An MTF package, `.mtf`: a model in the engine's own form (`load_mtf`). Its textures are files outside it,
18
+ * each a {@link GameAssetType.TextureMTF}.
19
+ */
20
+ ModelMTF: "x-meep/mtf",
21
+ /**
22
+ * One encoding of a texture an MTF package names, as a `ShadeImage`: an MTF texture file, `.mtt`, or any
23
+ * image, told apart by the file's first bytes.
24
+ */
25
+ TextureMTF: "x-meep/mtf-texture",
16
26
  ArrayBuffer: "arraybuffer",
17
27
  /**
18
28
  * No loader produces one. Both texture types meant a three `Texture` — a renderer's own object
@@ -1 +1 @@
1
- {"version":3,"file":"guessAssetType.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/guessAssetType.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAkDvB"}
1
+ {"version":3,"file":"guessAssetType.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/guessAssetType.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,oCAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAsDvB"}
@@ -41,6 +41,10 @@ export function guessAssetType(url) {
41
41
  case 'usdc':
42
42
  case 'usdz':
43
43
  return 'model/vnd.usd';
44
+ case 'mtf':
45
+ return 'x-meep/mtf';
46
+ case 'mtt':
47
+ return 'x-meep/mtf-texture';
44
48
  case "jpg":
45
49
  case "jpeg":
46
50
  case "png":
@@ -8,7 +8,7 @@
8
8
  * preload filled.
9
9
  *
10
10
  * @param {AssetManager} assetManager
11
- * @param {string} url `.gltf`, `.glb`, or any USD flavour — `.usd`, `.usda`, `.usdz`
11
+ * @param {string} url `.gltf`, `.glb`, any USD flavour — `.usd`, `.usda`, `.usdz` — or an MTF package, `.mtf`
12
12
  * @returns {Promise<SceneBundle>} the loaded model itself, shared by every caller — see
13
13
  * {@link GLTFSceneBundleAssetLoader}
14
14
  */
@@ -12,7 +12,7 @@ import { guessAssetType } from "./guessAssetType.js";
12
12
  * preload filled.
13
13
  *
14
14
  * @param {AssetManager} assetManager
15
- * @param {string} url `.gltf`, `.glb`, or any USD flavour — `.usd`, `.usda`, `.usdz`
15
+ * @param {string} url `.gltf`, `.glb`, any USD flavour — `.usd`, `.usda`, `.usdz` — or an MTF package, `.mtf`
16
16
  * @returns {Promise<SceneBundle>} the loaded model itself, shared by every caller — see
17
17
  * {@link GLTFSceneBundleAssetLoader}
18
18
  */
@@ -21,7 +21,7 @@ export async function load_model_scene_bundle(assetManager, url) {
21
21
 
22
22
  assert.isOneOf(
23
23
  type,
24
- [GameAssetType.ModelGLTF, GameAssetType.ModelGLTF_JSON, GameAssetType.ModelUSD],
24
+ [GameAssetType.ModelGLTF, GameAssetType.ModelGLTF_JSON, GameAssetType.ModelUSD, GameAssetType.ModelMTF],
25
25
  `asset type of '${url}'`
26
26
  );
27
27
 
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @typedef {import("../../../shade/renderer/loader/SceneBundle.js").SceneBundle} SceneBundle
3
+ * @typedef {import("../AssetRequestScope.js").AssetRequestScope} AssetRequestScope
4
+ */
5
+ /**
6
+ * An MTF package — `.mtf` — as the {@link SceneBundle} it holds ({@link GameAssetType.ModelMTF}): its nodes,
7
+ * geometries and materials, with its skins and clips.
8
+ *
9
+ * The asset hands out **that same bundle** to every caller, as the glTF and USD loaders do: a bundle is the model
10
+ * as loaded, and a placement is made from the prefab compiled from it.
11
+ *
12
+ * The package's textures are requested back through the manager under this load's scope, one file a texture:
13
+ * the encoding this loader's device can sample. They are cached, counted and cancelled like everything else, and
14
+ * a texture several packages name is loaded once.
15
+ *
16
+ * @extends AssetLoader<*, SceneBundle>
17
+ *
18
+ * @author Alex Goldring
19
+ * @copyright Company Named Limited (c) 2026
20
+ */
21
+ export class MTFSceneBundleAssetLoader extends AssetLoader<any, import("../../../shade/renderer/loader/SceneBundle.js").SceneBundle> {
22
+ /**
23
+ * @param {Set<GPUTextureFormat>} texture_support what the device can sample, from
24
+ * `gpu_texture_compression_support(device)`. An empty set loads every texture from its fallback
25
+ */
26
+ constructor(texture_support: Set<GPUTextureFormat>);
27
+ /**
28
+ * @param {AssetRequestScope} scope
29
+ * @param {string} path
30
+ * @param {function(Asset): void} success
31
+ * @param {function} failure
32
+ * @param {function(number, number): void} progress
33
+ * @returns {Promise<Asset>}
34
+ */
35
+ load(scope: AssetRequestScope, path: string, success: (arg0: Asset<any>) => void, failure: Function, progress: (arg0: number, arg1: number) => void): Promise<Asset<any>>;
36
+ #private;
37
+ }
38
+ export type SceneBundle = import("../../../shade/renderer/loader/SceneBundle.js").SceneBundle;
39
+ export type AssetRequestScope = import("../AssetRequestScope.js").AssetRequestScope;
40
+ import { AssetLoader } from "./AssetLoader.js";
41
+ import { Asset } from "../Asset.js";
42
+ //# sourceMappingURL=MTFSceneBundleAssetLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MTFSceneBundleAssetLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/MTFSceneBundleAssetLoader.js"],"names":[],"mappings":"AAOA;;;GAGG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;IAMI;;;OAGG;IACH,6BAHW,qBAAqB,EAU/B;IAcD;;;;;;;OAOG;IACH,YAPW,iBAAiB,QACjB,MAAM,iCACW,IAAI,sCAEZ,MAAM,QAAE,MAAM,KAAG,IAAI,GAC5B,mBAAc,CAgB1B;;CACJ;0BA1EY,OAAO,+CAA+C,EAAE,WAAW;gCACnE,OAAO,yBAAyB,EAAE,iBAAiB;4BALpC,kBAAkB;sBAFxB,aAAa"}
@@ -0,0 +1,83 @@
1
+ import { assert } from "../../../core/assert.js";
2
+ import { load_mtf } from "../../../shade/renderer/loader/mtf/load_mtf.js";
3
+ import { Asset } from "../Asset.js";
4
+ import { GameAssetType } from "../GameAssetType.js";
5
+ import { AssetLoader } from "./AssetLoader.js";
6
+ import { MTFTextureAssetLoader } from "./MTFTextureAssetLoader.js";
7
+
8
+ /**
9
+ * @typedef {import("../../../shade/renderer/loader/SceneBundle.js").SceneBundle} SceneBundle
10
+ * @typedef {import("../AssetRequestScope.js").AssetRequestScope} AssetRequestScope
11
+ */
12
+
13
+ /**
14
+ * An MTF package — `.mtf` — as the {@link SceneBundle} it holds ({@link GameAssetType.ModelMTF}): its nodes,
15
+ * geometries and materials, with its skins and clips.
16
+ *
17
+ * The asset hands out **that same bundle** to every caller, as the glTF and USD loaders do: a bundle is the model
18
+ * as loaded, and a placement is made from the prefab compiled from it.
19
+ *
20
+ * The package's textures are requested back through the manager under this load's scope, one file a texture:
21
+ * the encoding this loader's device can sample. They are cached, counted and cancelled like everything else, and
22
+ * a texture several packages name is loaded once.
23
+ *
24
+ * @extends AssetLoader<*, SceneBundle>
25
+ *
26
+ * @author Alex Goldring
27
+ * @copyright Company Named Limited (c) 2026
28
+ */
29
+ export class MTFSceneBundleAssetLoader extends AssetLoader {
30
+ /**
31
+ * @type {Set<GPUTextureFormat>}
32
+ */
33
+ #texture_support;
34
+
35
+ /**
36
+ * @param {Set<GPUTextureFormat>} texture_support what the device can sample, from
37
+ * `gpu_texture_compression_support(device)`. An empty set loads every texture from its fallback
38
+ */
39
+ constructor(texture_support) {
40
+ super();
41
+
42
+ assert.defined(texture_support, 'texture_support');
43
+ assert.notNull(texture_support, 'texture_support');
44
+
45
+ this.#texture_support = texture_support;
46
+ }
47
+
48
+ /**
49
+ * @param {import("../AssetManager.js").AssetManager} assetManager
50
+ * @param {*} context
51
+ */
52
+ async link(assetManager, context) {
53
+ if (assetManager.getLoaderByType(GameAssetType.TextureMTF) === undefined) {
54
+ await assetManager.registerLoader(GameAssetType.TextureMTF, new MTFTextureAssetLoader());
55
+ }
56
+
57
+ await super.link(assetManager, context);
58
+ }
59
+
60
+ /**
61
+ * @param {AssetRequestScope} scope
62
+ * @param {string} path
63
+ * @param {function(Asset): void} success
64
+ * @param {function} failure
65
+ * @param {function(number, number): void} progress
66
+ * @returns {Promise<Asset>}
67
+ */
68
+ async load(scope, path, success, failure, progress) {
69
+ // the path goes on un-resolved, as every path derived from it does: the manager keys its cache on it
70
+ const bundle = await load_mtf(path, {
71
+ assetManager: this.assetManager,
72
+ scope,
73
+ texture_support: this.#texture_support,
74
+ });
75
+
76
+ // no honest byte size, as for every other model: see GLTFSceneBundleAssetLoader
77
+ const asset = new Asset(() => bundle, 1);
78
+
79
+ success(asset);
80
+
81
+ return asset;
82
+ }
83
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @typedef {import("../AssetRequestScope.js").AssetRequestScope} AssetRequestScope
3
+ */
4
+ /**
5
+ * One encoding of a texture an MTF package names, as the {@link ShadeImage} a texture is made over
6
+ * ({@link GameAssetType.TextureMTF}).
7
+ *
8
+ * What the file is, is told by how it opens and not by its name. An MTF texture file is read as the texels it
9
+ * holds, in the GPU format it states, its levels views of the fetched bytes. Anything else is an image — a
10
+ * texture's fallback may be any the platform decodes — and goes the way a glTF's images do, through
11
+ * {@link ImageBitmapAssetLoader}.
12
+ *
13
+ * The asset hands out the one image, so every package that names the file holds the same one.
14
+ *
15
+ * @extends AssetLoader<*, ShadeImage>
16
+ *
17
+ * @author Alex Goldring
18
+ * @copyright Company Named Limited (c) 2026
19
+ */
20
+ export class MTFTextureAssetLoader extends AssetLoader<any, ShadeImage> {
21
+ constructor();
22
+ /**
23
+ * @param {AssetRequestScope} scope
24
+ * @param {string} path
25
+ * @param {function(Asset): void} success
26
+ * @param {function} failure
27
+ * @param {function(number, number): void} progress
28
+ * @returns {Promise<Asset>}
29
+ */
30
+ load(scope: AssetRequestScope, path: string, success: (arg0: Asset<any>) => void, failure: Function, progress: (arg0: number, arg1: number) => void): Promise<Asset<any>>;
31
+ }
32
+ export type AssetRequestScope = import("../AssetRequestScope.js").AssetRequestScope;
33
+ import { ShadeImage } from "../../../shade/renderer/texture/source/ShadeImage.js";
34
+ import { AssetLoader } from "./AssetLoader.js";
35
+ import { Asset } from "../Asset.js";
36
+ //# sourceMappingURL=MTFTextureAssetLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MTFTextureAssetLoader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/loaders/MTFTextureAssetLoader.js"],"names":[],"mappings":"AASA;;GAEG;AAEH;;;;;;;;;;;;;;;GAeG;AACH;;IAiBI;;;;;;;OAOG;IACH,YAPW,iBAAiB,QACjB,MAAM,iCACW,IAAI,sCAEZ,MAAM,QAAE,MAAM,KAAG,IAAI,GAC5B,mBAAc,CAwB1B;CACJ;gCAnEY,OAAO,yBAAyB,EAAE,iBAAiB;2BARrC,sDAAsD;4BAIrD,kBAAkB;sBAHxB,aAAa"}
@@ -0,0 +1,78 @@
1
+ import { mtf_is_texture } from "../../../shade/renderer/loader/mtf/mtf_is_texture.js";
2
+ import { mtf_texture_read } from "../../../shade/renderer/loader/mtf/mtf_texture_read.js";
3
+ import { ShadeImage } from "../../../shade/renderer/texture/source/ShadeImage.js";
4
+ import { Asset } from "../Asset.js";
5
+ import { GameAssetType } from "../GameAssetType.js";
6
+ import { ArrayBufferLoader } from "./ArrayBufferLoader.js";
7
+ import { AssetLoader } from "./AssetLoader.js";
8
+ import { ImageBitmapAssetLoader } from "./image/ImageBitmapAssetLoader.js";
9
+
10
+ /**
11
+ * @typedef {import("../AssetRequestScope.js").AssetRequestScope} AssetRequestScope
12
+ */
13
+
14
+ /**
15
+ * One encoding of a texture an MTF package names, as the {@link ShadeImage} a texture is made over
16
+ * ({@link GameAssetType.TextureMTF}).
17
+ *
18
+ * What the file is, is told by how it opens and not by its name. An MTF texture file is read as the texels it
19
+ * holds, in the GPU format it states, its levels views of the fetched bytes. Anything else is an image — a
20
+ * texture's fallback may be any the platform decodes — and goes the way a glTF's images do, through
21
+ * {@link ImageBitmapAssetLoader}.
22
+ *
23
+ * The asset hands out the one image, so every package that names the file holds the same one.
24
+ *
25
+ * @extends AssetLoader<*, ShadeImage>
26
+ *
27
+ * @author Alex Goldring
28
+ * @copyright Company Named Limited (c) 2026
29
+ */
30
+ export class MTFTextureAssetLoader extends AssetLoader {
31
+ /**
32
+ * @param {import("../AssetManager.js").AssetManager} assetManager
33
+ * @param {*} context
34
+ */
35
+ async link(assetManager, context) {
36
+ if (assetManager.getLoaderByType(GameAssetType.ArrayBuffer) === undefined) {
37
+ await assetManager.registerLoader(GameAssetType.ArrayBuffer, new ArrayBufferLoader());
38
+ }
39
+
40
+ if (assetManager.getLoaderByType(GameAssetType.ImageBitmap) === undefined) {
41
+ await assetManager.registerLoader(GameAssetType.ImageBitmap, new ImageBitmapAssetLoader());
42
+ }
43
+
44
+ await super.link(assetManager, context);
45
+ }
46
+
47
+ /**
48
+ * @param {AssetRequestScope} scope
49
+ * @param {string} path
50
+ * @param {function(Asset): void} success
51
+ * @param {function} failure
52
+ * @param {function(number, number): void} progress
53
+ * @returns {Promise<Asset>}
54
+ */
55
+ async load(scope, path, success, failure, progress) {
56
+ const bytes = await this.assetManager.promise(path, GameAssetType.ArrayBuffer, { scope, progress });
57
+
58
+ /** @type {ArrayBuffer} */
59
+ const data = bytes.create();
60
+
61
+ let image;
62
+
63
+ if (mtf_is_texture(data)) {
64
+ image = ShadeImage.fromTexelData(mtf_texture_read(data));
65
+ } else {
66
+ // the same bytes, asked for again as a picture: the manager already holds them
67
+ const bitmap = await this.assetManager.promise(path, GameAssetType.ImageBitmap, { scope });
68
+
69
+ image = ShadeImage.fromImageBitmap(bitmap.create());
70
+ }
71
+
72
+ const asset = new Asset(() => image, data.byteLength);
73
+
74
+ success(asset);
75
+
76
+ return asset;
77
+ }
78
+ }
@@ -70,11 +70,16 @@ export class BinaryCollectionSerializer {
70
70
  * @param {Object} [options]
71
71
  * @param {function(string,Class, BinaryClassSerializationAdapter):[]} [options.adapterOptionsSupplier]
72
72
  * @param {function(string):*} [options.problemConsumer]
73
+ * @param {boolean} [options.dictionary] whether a value equal to one already written is written as a
74
+ * reference to it. On by default, for a class that has `hash` and `equals`; a reader makes of a reference a
75
+ * new value from the first one's bytes, so it is only safe where the class's `equals` sees everything its
76
+ * adapter writes. Turn it off where it does not, or where the caller already writes each value once
73
77
  * @returns {boolean}
74
78
  */
75
- initialize({ adapterOptionsSupplier, problemConsumer }?: {
79
+ initialize({ adapterOptionsSupplier, problemConsumer, dictionary }?: {
76
80
  adapterOptionsSupplier?: (arg0: string, arg1: Class, arg2: BinaryClassSerializationAdapter) => [];
77
81
  problemConsumer?: (arg0: string) => any;
82
+ dictionary?: boolean;
78
83
  }): boolean;
79
84
  finalize(): void;
80
85
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"BinaryCollectionSerializer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js"],"names":[],"mappings":"AAMA;IAEI;;;OAGG;IACH,iBAAgB;IAEhB;;;OAGG;IACH,eAAc;IAEd;;;OAGG;IACH,gBAAe;IAGf;;;OAGG;IACH,kBAAiB;IAEjB;;;;OAIG;IACH,4BAA4B;IAE5B;;;OAGG;IACH,qBAAiB;IAGjB;;;OAGG;IACH,qBAAiB;IAEjB;;;OAGG;IACH,sBAAkB;IAElB;;;OAGG;IACH,mBAEG;IAEH;;;OAGG;IACH,oBAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,yDAKC;IAGD;;;OAGG;IACH,sCAKC;IAED;;;OAGG;IACH,mBAFa,MAAM,CAIlB;IAED;;;;;;OAMG;IACH;QAJgF,sBAAsB,UAAlF,MAAM,yDAAyC,EAAE;QAC7B,eAAe,UAAnC,MAAM;QACb,OAAO,CA4DnB;IAED,iBA4BC;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,kBA4ChB;CAGJ"}
1
+ {"version":3,"file":"BinaryCollectionSerializer.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js"],"names":[],"mappings":"AAMA;IAEI;;;OAGG;IACH,iBAAgB;IAEhB;;;OAGG;IACH,eAAc;IAEd;;;OAGG;IACH,gBAAe;IAGf;;;OAGG;IACH,kBAAiB;IAEjB;;;;OAIG;IACH,4BAA4B;IAE5B;;;OAGG;IACH,qBAAiB;IAGjB;;;OAGG;IACH,qBAAiB;IAEjB;;;OAGG;IACH,sBAAkB;IAElB;;;OAGG;IACH,mBAEG;IAEH;;;OAGG;IACH,oBAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,yDAKC;IAGD;;;OAGG;IACH,sCAKC;IAED;;;OAGG;IACH,mBAFa,MAAM,CAIlB;IAED;;;;;;;;;;OAUG;IACH;QARgF,sBAAsB,UAAlF,MAAM,yDAAyC,EAAE;QAC7B,eAAe,UAAnC,MAAM;QACG,UAAU,GAA5B,OAAO;QAIL,OAAO,CA8DnB;IAED,iBA4BC;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,kBA4ChB;CAGJ"}
@@ -111,11 +111,16 @@ export class BinaryCollectionSerializer {
111
111
  * @param {Object} [options]
112
112
  * @param {function(string,Class, BinaryClassSerializationAdapter):[]} [options.adapterOptionsSupplier]
113
113
  * @param {function(string):*} [options.problemConsumer]
114
+ * @param {boolean} [options.dictionary] whether a value equal to one already written is written as a
115
+ * reference to it. On by default, for a class that has `hash` and `equals`; a reader makes of a reference a
116
+ * new value from the first one's bytes, so it is only safe where the class's `equals` sees everything its
117
+ * adapter writes. Turn it off where it does not, or where the caller already writes each value once
114
118
  * @returns {boolean}
115
119
  */
116
120
  initialize({
117
121
  adapterOptionsSupplier = returnEmptyArray,
118
- problemConsumer = console.warn
122
+ problemConsumer = console.warn,
123
+ dictionary = true
119
124
  } = {}) {
120
125
 
121
126
  assert.isFunction(adapterOptionsSupplier, 'adapterOptionsSupplier');
@@ -164,7 +169,8 @@ export class BinaryCollectionSerializer {
164
169
  const componentType = adapter.klass;
165
170
 
166
171
  //determine if dictionary can be used
167
- this.__dictionaryEnabled = typeof componentType.prototype.hash === "function"
172
+ this.__dictionaryEnabled = dictionary
173
+ && typeof componentType.prototype.hash === "function"
168
174
  && typeof componentType.prototype.equals === "function";
169
175
 
170
176
  //clear dictionary
@@ -67,11 +67,11 @@ export class FluidObstacleSystem extends System<any> {
67
67
  /**
68
68
  * @param {FluidComponent} fluid
69
69
  */
70
- static "__#527@#refresh_masks"(fluid: FluidComponent): void;
70
+ static "__#532@#refresh_masks"(fluid: FluidComponent): void;
71
71
  /**
72
72
  * @param {FluidComponent} fluid
73
73
  */
74
- static "__#527@#clear_field"(fluid: FluidComponent): void;
74
+ static "__#532@#clear_field"(fluid: FluidComponent): void;
75
75
  /**
76
76
  * Mark every cell of `fluid` whose centre lies within `inflation` of the
77
77
  * posed shape as solid. Iteration is clipped to the shape's world AABB
@@ -83,7 +83,7 @@ export class FluidObstacleSystem extends System<any> {
83
83
  * @param {number} inflation world-units SDF threshold
84
84
  * @param {Float64Array} point length-3 scratch
85
85
  */
86
- static "__#527@#voxelize"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array): void;
86
+ static "__#532@#voxelize"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array): void;
87
87
  /**
88
88
  * Write the obstacle's translation velocity onto every face of every cell
89
89
  * it voxelized — the moving-wall boundary condition. Runs AFTER the mask
@@ -103,7 +103,7 @@ export class FluidObstacleSystem extends System<any> {
103
103
  * @param {number} wvy
104
104
  * @param {number} wvz
105
105
  */
106
- static "__#527@#stamp_wall_velocity"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array, wvx: number, wvy: number, wvz: number): void;
106
+ static "__#532@#stamp_wall_velocity"(fluid: FluidComponent, posed: PosedShape3D, aabb: Float64Array, inflation: number, point: Float64Array, wvx: number, wvy: number, wvz: number): void;
107
107
  constructor();
108
108
  dependencies: (typeof FluidObstacle)[];
109
109
  components_used: (ResourceAccessSpecification<typeof Transform64> | ResourceAccessSpecification<typeof FluidObstacle> | ResourceAccessSpecification<typeof Collider> | ResourceAccessSpecification<typeof RigidBody> | ResourceAccessSpecification<typeof FluidComponent>)[];
@@ -55,7 +55,7 @@ export class GPUAcousticLattice {
55
55
  * @param {number} gz
56
56
  * @returns {number} the point's storage index: storage wraps, as the clipmaps' does
57
57
  */
58
- static "__#607@#storage"(c: number, gx: number, gy: number, gz: number): number;
58
+ static "__#612@#storage"(c: number, gx: number, gy: number, gz: number): number;
59
59
  /**
60
60
  * @param {GPUAcoustics} acoustics whose receivers the points are
61
61
  * @param {number} radius metres: the default source's, which the points stand for
@@ -49,7 +49,7 @@ export class GPUAcousticProbes {
49
49
  * @param {*} resources
50
50
  * @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
51
51
  */
52
- static "__#391@#execute"(pass: object, resources: any, context: {
52
+ static "__#396@#execute"(pass: object, resources: any, context: {
53
53
  encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
54
54
  }): void;
55
55
  /**
@@ -39,7 +39,7 @@ export class GPUAcoustics {
39
39
  * @param {*} resources
40
40
  * @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
41
41
  */
42
- static "__#606@#execute"(pass: object, resources: any, context: {
42
+ static "__#611@#execute"(pass: object, resources: any, context: {
43
43
  encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
44
44
  }): void;
45
45
  /**
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A {@link ShadeAnimationClip} on disk, as a loader's bundle holds it: a channel's target is a place in the
3
+ * bundle's nodes.
4
+ *
5
+ * <pre>
6
+ * UTF8 name
7
+ * UintVar curve count
8
+ * curves each as {@link serialize_animation_curve} writes one: a key count, then time, value, in tangent
9
+ * and out tangent of every key as float32s
10
+ * UintVar channel count
11
+ * channels each: u32 target, u8 property ({@link Node3DProperty}), then u32 x 4 for x, y, z and w: a curve's
12
+ * place in this clip's curves, or 0xFFFFFFFF for a component that is not animated
13
+ * </pre>
14
+ *
15
+ * A curve is in the record once however many components it drives, and a clip read back shares exactly the
16
+ * curves the clip written did: a uniform scale is one curve under three axes, and the animation manager uploads a
17
+ * curve once by which object it is.
18
+ *
19
+ * @extends BinaryClassSerializationAdapter<ShadeAnimationClip>
20
+ *
21
+ * @author Alex Goldring
22
+ * @copyright Company Named Limited (c) 2026
23
+ */
24
+ export class ShadeAnimationClipSerializationAdapter extends BinaryClassSerializationAdapter<ShadeAnimationClip> {
25
+ constructor();
26
+ klass: typeof ShadeAnimationClip;
27
+ #private;
28
+ }
29
+ export type BinaryBuffer = import("../../../core/binary/BinaryBuffer.js").BinaryBuffer;
30
+ export type AnimationCurve = import("../../../engine/animation/curve/AnimationCurve.js").AnimationCurve;
31
+ import { ShadeAnimationClip } from "./ShadeAnimationClip.js";
32
+ import { BinaryClassSerializationAdapter } from "../../../engine/ecs/storage/binary/BinaryClassSerializationAdapter.js";
33
+ //# sourceMappingURL=ShadeAnimationClipSerializationAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShadeAnimationClipSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js"],"names":[],"mappings":"AAqEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;;IACI,iCAA2B;;CAsG9B;2BA1LY,OAAO,sCAAsC,EAAE,YAAY;6BAC3D,OAAO,mDAAmD,EAAE,cAAc;mCAJpD,yBAAyB;gDAFZ,uEAAuE"}