@woosh/meep-engine 2.131.22 → 2.131.24

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 (43) hide show
  1. package/package.json +1 -1
  2. package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
  3. package/src/core/geom/2d/aabb/AABB2.js +1 -2
  4. package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.d.ts +9 -0
  5. package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.d.ts.map +1 -0
  6. package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.js +48 -0
  7. package/src/core/geom/3d/octahedra/octahedral_uv_crease_distance.d.ts.map +1 -0
  8. package/src/core/geom/3d/octahedra/octahedral_uv_to_direction.d.ts +9 -0
  9. package/src/core/geom/3d/octahedra/octahedral_uv_to_direction.d.ts.map +1 -0
  10. package/src/core/geom/3d/octahedra/octahedral_uv_to_direction.js +39 -0
  11. package/src/core/geom/3d/octahedra/octahedral_uv_wrap.d.ts +30 -0
  12. package/src/core/geom/3d/octahedra/octahedral_uv_wrap.d.ts.map +1 -0
  13. package/src/core/geom/3d/octahedra/octahedral_uv_wrap.js +71 -0
  14. package/src/core/geom/vec2/v2_array_normalize.d.ts +9 -0
  15. package/src/core/geom/vec2/v2_array_normalize.d.ts.map +1 -0
  16. package/src/core/geom/vec2/v2_array_normalize.js +30 -0
  17. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts +5 -3
  18. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.d.ts.map +1 -1
  19. package/src/core/math/physics/mie/compute_mie_particle_properties_rgb.js +8 -6
  20. package/src/engine/animation/curve/AnimationCurve.d.ts +2 -1
  21. package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
  22. package/src/engine/animation/curve/AnimationCurve.js +2 -1
  23. package/src/engine/asset/AssetManager.d.ts.map +1 -1
  24. package/src/engine/asset/AssetManager.js +6 -1
  25. package/src/engine/asset/preloader/AssetLoadSpec.d.ts +39 -0
  26. package/src/engine/asset/preloader/AssetLoadSpec.d.ts.map +1 -0
  27. package/src/engine/asset/preloader/AssetLoadSpec.js +47 -0
  28. package/src/engine/asset/preloader/AssetPreloader.d.ts +18 -44
  29. package/src/engine/asset/preloader/AssetPreloader.d.ts.map +1 -1
  30. package/src/engine/asset/preloader/AssetPreloader.js +199 -146
  31. package/src/engine/ecs/gui/GUIElementSystem.js +1 -1
  32. package/src/engine/ecs/gui/menu/radial/updateAnimationState.d.ts +1 -1
  33. package/src/engine/ecs/gui/menu/radial/updateAnimationState.d.ts.map +1 -1
  34. package/src/engine/ecs/gui/menu/radial/updateAnimationState.js +2 -1
  35. package/src/engine/ecs/gui/position/ViewportPositionSystem.js +1 -1
  36. package/src/engine/ecs/speaker/VoiceSystem.js +1 -1
  37. package/src/engine/ecs/systems/AnimationSystem.d.ts.map +1 -1
  38. package/src/engine/ecs/systems/AnimationSystem.js +1 -0
  39. package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.d.ts.map +1 -1
  40. package/src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js +4 -46
  41. package/src/core/geom/octahedral_uv_crease_distance.d.ts.map +0 -1
  42. /package/src/core/geom/{octahedral_uv_crease_distance.d.ts → 3d/octahedra/octahedral_uv_crease_distance.d.ts} +0 -0
  43. /package/src/core/geom/{octahedral_uv_crease_distance.js → 3d/octahedra/octahedral_uv_crease_distance.js} +0 -0
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Pure JavaScript game engine. Fully featured and production ready.",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.131.22",
8
+ "version": "2.131.24",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"AABB2.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/AABB2.js"],"names":[],"mappings":";AAaA;;;GAGG;AACH;IACI;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":"AABB2.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/aabb/AABB2.js"],"names":[],"mappings":";AAaA;;;GAGG;AACH;IACI;;;;;OAKG;IACH,iBALW,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,EAsChB;IApBG;;;OAGG;IACH,IAFU,MAAM,CAEJ;IACZ;;;OAGG;IACH,IAFU,MAAM,CAEJ;IACZ;;;OAGG;IACH,IAFU,MAAM,CAEJ;IACZ;;;OAGG;IACH,IAFU,MAAM,CAEJ;IA8ChB;;OAEG;IACH,mBAEC;IAtCD;;;OAGG;IACH,gBAEC;IAkCD;;OAEG;IACH,mBAEC;IArCD;;;OAGG;IACH,gBAEC;IAiCD;;OAEG;IACH,mBAEC;IApCD;;;OAGG;IACH,gBAEC;IAgCD;;OAEG;IACH,mBAEC;IAnCD;;;OAGG;IACH,gBAEC;IA+BD;;;OAGG;IACH,gBAFW,MAAM,QAQhB;IAED;;;OAGG;IACH,iBAFW,MAAM,QAQhB;IAED;;;OAGG;IACH,WAFW,MAAM,QAMhB;IAED;;;OAGG;IACH,aAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QA8BlB;IAED;;;OAGG;IACH,sBAFW,MAAM,QAShB;IAED;;;;;OAKG;IACH,sBAJW,KAAK,UACL,KAAK,GACH,OAAO,CAcnB;IAED;;;;OAIG;IACH,qBAHW,KAAK,GACH,OAAO,CAcnB;IAED;;;;;;;OAOG;IACH,0EAMC;IAED;;;;OAIG;IACH,qBAHW,MAAM,KACN,MAAM,QAKhB;IAED;;;;;;OAMG;IACH,0BALW,OAAO,MACP,OAAO,UACP,OAAO,GACL,OAAO,CA0BnB;IAED;;;;OAIG;IACH,kCAHW,OAAO,UACP,OAAO,QAmBjB;IAED;;;;OAIG;IACH,wBAHW,KAAK,GACH,MAAM,CAIlB;IAED;;;;;;;OAOG;IACH,sBANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,MAAM,CA4BlB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AAkB;AAqsBtC;;;;;;;GAOG;AACH,gDANW,KAAK,MACL,KAAK,MACL,OAAO,MACP,OAAO,GACL,OAAO,CAsBnB"}
@@ -21,7 +21,6 @@ class AABB2 {
21
21
  * @param {number} [y0=0]
22
22
  * @param {number} [x1=0]
23
23
  * @param {number} [y1=0]
24
- * @constructor
25
24
  */
26
25
  constructor(
27
26
  x0 = 0,
@@ -673,7 +672,7 @@ class AABB2 {
673
672
  }
674
673
 
675
674
  /**
676
- * returns {AABB2}
675
+ * @returns {this}
677
676
  */
678
677
  setNegativelyInfiniteBounds() {
679
678
  return this.set(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);
@@ -0,0 +1,9 @@
1
+ /**
2
+ *
3
+ * @param {number[]} out_uv
4
+ * @param {number} out_offset
5
+ * @param {number[]} in_direction
6
+ * @param {number} in_offset
7
+ */
8
+ export function octahedral_direction_to_uv(out_uv: number[], out_offset: number, in_direction: number[], in_offset: number): void;
9
+ //# sourceMappingURL=octahedral_direction_to_uv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"octahedral_direction_to_uv.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/octahedra/octahedral_direction_to_uv.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,mDALW,MAAM,EAAE,cACR,MAAM,gBACN,MAAM,EAAE,aACR,MAAM,QAsChB"}
@@ -0,0 +1,48 @@
1
+ import { assert } from "../../../assert.js";
2
+ import { sign_not_zero } from "../../../math/sign_not_zero.js";
3
+ import { v3_dot } from "../../vec3/v3_dot.js";
4
+
5
+ /**
6
+ *
7
+ * @param {number[]} out_uv
8
+ * @param {number} out_offset
9
+ * @param {number[]} in_direction
10
+ * @param {number} in_offset
11
+ */
12
+ export function octahedral_direction_to_uv(
13
+ out_uv, out_offset,
14
+ in_direction, in_offset
15
+ ) {
16
+
17
+ assert.isNonNegativeInteger(out_offset, 'out_offset');
18
+ assert.isNonNegativeInteger(in_offset, 'in_offset');
19
+
20
+ const input_x = in_direction[in_offset + 0];
21
+ const input_y = in_direction[in_offset + 1];
22
+ const input_z = in_direction[in_offset + 2];
23
+
24
+ const octant_x = sign_not_zero(input_x);
25
+ const octant_y = sign_not_zero(input_y);
26
+ const octant_z = sign_not_zero(input_z);
27
+
28
+ // |x| + |y| + |z| = 1
29
+ const sum = v3_dot(
30
+ input_x, input_y, input_z,
31
+ octant_x, octant_y, octant_z
32
+ );
33
+
34
+ let octahedron_x = input_x / sum;
35
+ const octahedron_y = input_y / sum;
36
+ let octahedron_z = input_z / sum;
37
+
38
+ if (octahedron_y < 0) {
39
+ const absolute_x = Math.abs(octahedron_x);
40
+ const absolute_z = Math.abs(octahedron_z);
41
+
42
+ octahedron_x = octant_x * (1 - absolute_z);
43
+ octahedron_z = octant_z * (1 - absolute_x);
44
+ }
45
+
46
+ out_uv[out_offset + 0] = octahedron_x;
47
+ out_uv[out_offset + 1] = octahedron_z;
48
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"octahedral_uv_crease_distance.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/octahedra/octahedral_uv_crease_distance.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,iDAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAqBlB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ *
3
+ * @param {number[]} out_direction This is where the normalized direction vector will be written to
4
+ * @param {number} out_offset Where to start writing in the output
5
+ * @param {number[]} in_uv in the 0..1 range
6
+ * @param {number} in_offset where to start reading in the input
7
+ */
8
+ export function octahedral_uv_to_direction(out_direction: number[], out_offset: number, in_uv: number[], in_offset: number): void;
9
+ //# sourceMappingURL=octahedral_uv_to_direction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"octahedral_uv_to_direction.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/octahedra/octahedral_uv_to_direction.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,0DALW,MAAM,EAAE,cACR,MAAM,SACN,MAAM,EAAE,aACR,MAAM,QA4BhB"}
@@ -0,0 +1,39 @@
1
+ import { assert } from "../../../assert.js";
2
+ import { sign_not_zero } from "../../../math/sign_not_zero.js";
3
+ import { v3_array_normalize } from "../../vec3/v3_array_normalize.js";
4
+
5
+ /**
6
+ *
7
+ * @param {number[]} out_direction This is where the normalized direction vector will be written to
8
+ * @param {number} out_offset Where to start writing in the output
9
+ * @param {number[]} in_uv in the 0..1 range
10
+ * @param {number} in_offset where to start reading in the input
11
+ */
12
+ export function octahedral_uv_to_direction(
13
+ out_direction, out_offset,
14
+ in_uv, in_offset
15
+ ) {
16
+
17
+ assert.isNonNegativeInteger(out_offset, 'out_offset');
18
+ assert.isNonNegativeInteger(in_offset, 'in_offset');
19
+
20
+ let px = in_uv[in_offset + 0] * 2 - 1;
21
+ let pz = in_uv[in_offset + 1] * 2 - 1;
22
+
23
+ const abs_x = Math.abs(px);
24
+ const abs_z = Math.abs(pz);
25
+ const py = 1 - abs_x - abs_z;
26
+
27
+ if (py < 0) {
28
+ px = sign_not_zero(px) * (1 - abs_z);
29
+ pz = sign_not_zero(pz) * (1 - abs_x);
30
+ }
31
+
32
+ out_direction[out_offset + 0] = px;
33
+ out_direction[out_offset + 1] = py;
34
+ out_direction[out_offset + 2] = pz;
35
+
36
+ v3_array_normalize(out_direction, out_offset, out_direction, out_offset);
37
+
38
+ }
39
+
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Octahedral UV wrapping.
3
+ * Full winding support without breaking octahedral seam rules.
4
+ *
5
+ * ```
6
+ * +-----+-----+
7
+ * | 6 /|\ 5 |
8
+ * | / | \ |
9
+ * | / | \ |
10
+ * | / 2 | 1 \ |
11
+ * |/ | \|
12
+ * +-----+-----+
13
+ * |\ 3 | 4 /|
14
+ * | \ | / |
15
+ * | \ | / |
16
+ * | \ | / |
17
+ * | 7 \|/ 8 |
18
+ * +-----+-----+
19
+ *```
20
+ *
21
+ * @param {number[]} out_uv - Array to write the wrapped UVs into
22
+ * @param {number} out_offset - Index to start writing at
23
+ * @param {number[]} in_uv - Input UV array (can be outside 0..1)
24
+ * @param {number} in_offset - Index to start reading from
25
+ *
26
+ * @author Alex Goldring
27
+ * @copyright Company Named Limited (c) 2025
28
+ */
29
+ export function octahedral_uv_wrap(out_uv: number[], out_offset: number, in_uv: number[], in_offset: number): void;
30
+ //# sourceMappingURL=octahedral_uv_wrap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"octahedral_uv_wrap.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/octahedra/octahedral_uv_wrap.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,2CARW,MAAM,EAAE,cACR,MAAM,SACN,MAAM,EAAE,aACR,MAAM,QAwChB"}
@@ -0,0 +1,71 @@
1
+
2
+ function reduce_even_wrap(x) {
3
+ // reduces to the range [-1, 3] by removing *even* windings:
4
+ // ... -3, -1, 1, 3, 5 ... → cycle every 2
5
+ return x - 2 * Math.floor((x + 1) * 0.5);
6
+ }
7
+
8
+ /**
9
+ * Octahedral UV wrapping.
10
+ * Full winding support without breaking octahedral seam rules.
11
+ *
12
+ * ```
13
+ * +-----+-----+
14
+ * | 6 /|\ 5 |
15
+ * | / | \ |
16
+ * | / | \ |
17
+ * | / 2 | 1 \ |
18
+ * |/ | \|
19
+ * +-----+-----+
20
+ * |\ 3 | 4 /|
21
+ * | \ | / |
22
+ * | \ | / |
23
+ * | \ | / |
24
+ * | 7 \|/ 8 |
25
+ * +-----+-----+
26
+ *```
27
+ *
28
+ * @param {number[]} out_uv - Array to write the wrapped UVs into
29
+ * @param {number} out_offset - Index to start writing at
30
+ * @param {number[]} in_uv - Input UV array (can be outside 0..1)
31
+ * @param {number} in_offset - Index to start reading from
32
+ *
33
+ * @author Alex Goldring
34
+ * @copyright Company Named Limited (c) 2025
35
+ */
36
+ export function octahedral_uv_wrap(
37
+ out_uv, out_offset,
38
+ in_uv, in_offset
39
+ ) {
40
+ let u = in_uv[in_offset];
41
+ let v = in_uv[in_offset + 1];
42
+
43
+ // First collapse infinite windings into [-1, 1] range.
44
+ u = reduce_even_wrap(u);
45
+ v = reduce_even_wrap(v);
46
+
47
+ // Left side (u < 0)
48
+ if (u < 0) {
49
+ u = -u;
50
+ v = 1 - v;
51
+ }
52
+ // Right side (u > 1)
53
+ else if (u > 1) {
54
+ u = 2 - u;
55
+ v = 1 - v;
56
+ }
57
+
58
+ // Top (v < 0)
59
+ if (v < 0) {
60
+ v = -v;
61
+ u = 1 - u;
62
+ }
63
+ // Bottom (v > 1)
64
+ else if (v > 1) {
65
+ v = 2 - v;
66
+ u = 1 - u;
67
+ }
68
+
69
+ out_uv[out_offset] = u;
70
+ out_uv[out_offset + 1] = v;
71
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ *
3
+ * @param {number[]|Float32Array} output
4
+ * @param {number} output_offset
5
+ * @param {number[]|Float32Array} input
6
+ * @param {number} input_offset
7
+ */
8
+ export function v2_array_normalize(output: number[] | Float32Array, output_offset: number, input: number[] | Float32Array, input_offset: number): void;
9
+ //# sourceMappingURL=v2_array_normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v2_array_normalize.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/vec2/v2_array_normalize.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,2CALW,MAAM,EAAE,GAAC,YAAY,iBACrB,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,gBACrB,MAAM,QAsBhB"}
@@ -0,0 +1,30 @@
1
+ import { v2_length_sqr } from "./v2_length_sqr.js";
2
+
3
+ /**
4
+ *
5
+ * @param {number[]|Float32Array} output
6
+ * @param {number} output_offset
7
+ * @param {number[]|Float32Array} input
8
+ * @param {number} input_offset
9
+ */
10
+ export function v2_array_normalize(
11
+ output, output_offset,
12
+ input, input_offset,
13
+ ) {
14
+
15
+
16
+ // extract vector components
17
+ const x = input[input_offset];
18
+ const y = input[input_offset + 1];
19
+
20
+ // compute vector inverse magnitude
21
+ const length_sqr = v2_length_sqr(x, y);
22
+
23
+ // avoid division by 0
24
+ const n = length_sqr !== 0 ? 1.0 / Math.sqrt(length_sqr) : 1;
25
+
26
+ // write back
27
+ output[output_offset] = x * n;
28
+ output[output_offset + 1] = y * n;
29
+
30
+ }
@@ -1,11 +1,13 @@
1
1
  /**
2
- * Compute scattering and extinction for a given particle/medium configuration
3
- * @param {number} radius
2
+ * Compute scattering and extinction for a given particle/medium configuration.
3
+ * Performs full wide visible spectrum sweep.
4
+ * Energy is relative to D65 illuminant (standard for rec709 and sRGB).
5
+ * @param {number} radius_m Particle radius in meters.
4
6
  * @param {function(result:number[], wavelength_nm:number)} n_p Particle Refraction Index. function of wavelength, Complex number.
5
7
  * @param {function(result:number[], wavelength_nm:number)} n_med Medium Refraction Index. function of wavelength, Complex number.
6
8
  * @param {number} [step_size_nm] In nanometers. Controls step size in spectral integration steps, smaller steps = more accurate. Use 1, or multiples of 5
7
9
  */
8
- export function compute_mie_particle_properties_rgb(radius: number, n_p: any, n_med: any, step_size_nm?: number): {
10
+ export function compute_mie_particle_properties_rgb(radius_m: number, n_p: any, n_med: any, step_size_nm?: number): {
9
11
  scattering_coefficients: number[];
10
12
  extinction_coefficients: number[];
11
13
  extinction_intercept: number[];
@@ -1 +1 @@
1
- {"version":3,"file":"compute_mie_particle_properties_rgb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/mie/compute_mie_particle_properties_rgb.js"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,4DALW,MAAM,uCAGN,MAAM;;;;;;EAwIhB"}
1
+ {"version":3,"file":"compute_mie_particle_properties_rgb.d.ts","sourceRoot":"","sources":["../../../../../../src/core/math/physics/mie/compute_mie_particle_properties_rgb.js"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,8DALW,MAAM,uCAGN,MAAM;;;;;;EAwIhB"}
@@ -5,23 +5,25 @@ import { xyz_to_rgb } from "../../../color/xyz/xyz_to_rgb.js";
5
5
  import { compute_lorenz_mie_optical_properties } from "./compute_lorenz_mie_optical_properties.js";
6
6
 
7
7
  /**
8
- * Compute scattering and extinction for a given particle/medium configuration
9
- * @param {number} radius
8
+ * Compute scattering and extinction for a given particle/medium configuration.
9
+ * Performs full wide visible spectrum sweep.
10
+ * Energy is relative to D65 illuminant (standard for rec709 and sRGB).
11
+ * @param {number} radius_m Particle radius in meters.
10
12
  * @param {function(result:number[], wavelength_nm:number)} n_p Particle Refraction Index. function of wavelength, Complex number.
11
13
  * @param {function(result:number[], wavelength_nm:number)} n_med Medium Refraction Index. function of wavelength, Complex number.
12
14
  * @param {number} [step_size_nm] In nanometers. Controls step size in spectral integration steps, smaller steps = more accurate. Use 1, or multiples of 5
13
15
  */
14
16
  export function compute_mie_particle_properties_rgb(
15
- radius,
17
+ radius_m,
16
18
  n_p,
17
19
  n_med,
18
20
  step_size_nm = 5
19
21
  ) {
20
22
 
23
+ assert.isFinite(radius_m, 'radius');
24
+ assert.greaterThan(radius_m, 0, 'radius_m must be positive');
21
25
  assert.isFunction(n_p, 'n_p');
22
26
  assert.isFunction(n_med, 'n_med');
23
- assert.isFinite(radius, 'radius');
24
- assert.greaterThan(radius, 0, 'radius must be positive');
25
27
  assert.isNonNegativeInteger(step_size_nm, 'step_size_nm');
26
28
 
27
29
  const cmf = [0, 0, 0];
@@ -65,7 +67,7 @@ export function compute_mie_particle_properties_rgb(
65
67
 
66
68
  const properties = compute_lorenz_mie_optical_properties(
67
69
  wavelength_m,
68
- radius,
70
+ radius_m,
69
71
  ir_particle,
70
72
  ir_medium,
71
73
  );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Describes change of a numeric value over time.
3
3
  * Values are stored in {@link Keyframe}s, interpolation is defined by tangents on {@link Keyframe}s.
4
- * The curve is a cubic Hermite spline, see https://en.wikipedia.org/wiki/Cubic_Hermite_spline.
4
+ * The curve is a cubic Hermite spline.
5
5
  *
6
6
  * @example
7
7
  * const jump_curve = AnimationCurve.from([
@@ -19,6 +19,7 @@
19
19
  *
20
20
  * @implements Iterable<Keyframe>
21
21
  *
22
+ * @see https://en.wikipedia.org/wiki/Cubic_Hermite_spline.
22
23
  * @author Alex Goldring
23
24
  * @copyright Company Named Limited (c) 2025
24
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AnimationCurve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/AnimationCurve.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,gDALwB,QAAQ;IAqZ5B;;;;OAIG;IACH,kBAHW,QAAQ,EAAE,GACR,cAAc,CAQ1B;IAED;;;;;;;;;OASG;IACH,6BANW,MAAM,eACN,MAAM,YACN,MAAM,aACN,MAAM,GACL,cAAc,CAUzB;IAED;;;;;;OAMG;IACH,4BALW,MAAM,YACN,MAAM,UACN,MAAM,GACL,cAAc,CAOzB;IAED;;;;;;;OAOG;IACH,0BANW,MAAM,eACN,MAAM,YACN,MAAM,aACN,MAAM,GACL,cAAc,CAezB;IAndD;;;;;OAKG;IACH,eAFU,QAAQ,EAAE,CAEV;IAEV;;;;;OAKG;IACH,SAHW,QAAQ,GACN,MAAM,CAuClB;IAED;;;OAGG;IACH,cAFW,QAAQ,EAAE,QAUpB;IAED;;;;OAIG;IACH,YAHW,QAAQ,GACN,OAAO,CAYnB;IAED;;OAEG;IACH,cAEC;IAGD;;;OAGG;IACH,WAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,qBAEC;IAED;;;;OAIG;IACH,yBAUC;IAED;;;;OAIG;IACH,uBAUC;IAED;;;;OAIG;IACH,uBAcC;IAED;;;;;;OAMG;IACH,qBAHW,MAAM,GACJ,MAAM,CAmDlB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACL,MAAM,CAoCjB;IAED;;;;OAIG;IACH,qBAFW,MAAM,QAmChB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAWhB;IAED,0BAKC;IAGD;;;OAGG;IACH,YAFW,cAAc,QAIxB;IAED;;;OAGG;IACH,SAFY,cAAc,CAQzB;IAED;;;;OAIG;IACH,cAHW,cAAc,GACb,OAAO,CAIlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;MAIC;IAED;;aAkBC;IAoFL;;;;OAIG;IACH,2BAFU,OAAO,CAEwB;IAGzC;;OAEG;IACH,0BA3Te,MAAM,KACJ,MAAM,CA0TmB;IA7FtC,wDAQC;CAuEJ;yBA/ewB,eAAe"}
1
+ {"version":3,"file":"AnimationCurve.d.ts","sourceRoot":"","sources":["../../../../../src/engine/animation/curve/AnimationCurve.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,gDANwB,QAAQ;IAsZ5B;;;;OAIG;IACH,kBAHW,QAAQ,EAAE,GACR,cAAc,CAQ1B;IAED;;;;;;;;;OASG;IACH,6BANW,MAAM,eACN,MAAM,YACN,MAAM,aACN,MAAM,GACL,cAAc,CAUzB;IAED;;;;;;OAMG;IACH,4BALW,MAAM,YACN,MAAM,UACN,MAAM,GACL,cAAc,CAOzB;IAED;;;;;;;OAOG;IACH,0BANW,MAAM,eACN,MAAM,YACN,MAAM,aACN,MAAM,GACL,cAAc,CAezB;IAndD;;;;;OAKG;IACH,eAFU,QAAQ,EAAE,CAEV;IAEV;;;;;OAKG;IACH,SAHW,QAAQ,GACN,MAAM,CAuClB;IAED;;;OAGG;IACH,cAFW,QAAQ,EAAE,QAUpB;IAED;;;;OAIG;IACH,YAHW,QAAQ,GACN,OAAO,CAYnB;IAED;;OAEG;IACH,cAEC;IAGD;;;OAGG;IACH,WAFY,OAAO,CAIlB;IAED;;;OAGG;IACH,qBAEC;IAED;;;;OAIG;IACH,yBAUC;IAED;;;;OAIG;IACH,uBAUC;IAED;;;;OAIG;IACH,uBAcC;IAED;;;;;;OAMG;IACH,qBAHW,MAAM,GACJ,MAAM,CAmDlB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACL,MAAM,CAoCjB;IAED;;;;OAIG;IACH,qBAFW,MAAM,QAmChB;IAED;;;;OAIG;IACH,sBAHW,MAAM,UACN,MAAM,QAWhB;IAED,0BAKC;IAGD;;;OAGG;IACH,YAFW,cAAc,QAIxB;IAED;;;OAGG;IACH,SAFY,cAAc,CAQzB;IAED;;;;OAIG;IACH,cAHW,cAAc,GACb,OAAO,CAIlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;MAIC;IAED;;aAkBC;IAoFL;;;;OAIG;IACH,2BAFU,OAAO,CAEwB;IAGzC;;OAEG;IACH,0BA3Te,MAAM,KACJ,MAAM,CA0TmB;IA7FtC,wDAQC;CAuEJ;yBAhfwB,eAAe"}
@@ -11,7 +11,7 @@ import { Keyframe } from "./Keyframe.js";
11
11
  /**
12
12
  * Describes change of a numeric value over time.
13
13
  * Values are stored in {@link Keyframe}s, interpolation is defined by tangents on {@link Keyframe}s.
14
- * The curve is a cubic Hermite spline, see https://en.wikipedia.org/wiki/Cubic_Hermite_spline.
14
+ * The curve is a cubic Hermite spline.
15
15
  *
16
16
  * @example
17
17
  * const jump_curve = AnimationCurve.from([
@@ -29,6 +29,7 @@ import { Keyframe } from "./Keyframe.js";
29
29
  *
30
30
  * @implements Iterable<Keyframe>
31
31
  *
32
+ * @see https://en.wikipedia.org/wiki/Cubic_Hermite_spline.
32
33
  * @author Alex Goldring
33
34
  * @copyright Company Named Limited (c) 2025
34
35
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/AssetManager.js"],"names":[],"mappings":"AA8CA;;;;GAIG;AACH;IAmII;;;;;OAKG;IACH,oCAJW,GAAG,EAYb;IAhJD;;;;OAIG;IACH,eAEG;IAEH;;;OAGG;IACH,aAFU,YAAY,gBAAgB,EAAE,YAAY,CAAC,CAER;IAe7C;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IA4B5B;;;;OAIG;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ACH,mBAJW,MAAM,QACN,MAAM,QACN,MAAM,QAUhB;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;;CANpC;4BApgC2B,0CAA0C;iCAOrC,uBAAuB;6BAM3B,mBAAmB;kCAFd,6BAA6B;kCAD7B,wBAAwB;4BAE9B,0BAA0B"}
1
+ {"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/AssetManager.js"],"names":[],"mappings":"AA8CA;;;;GAIG;AACH;IAmII;;;;;OAKG;IACH,oCAJW,GAAG,EAYb;IAhJD;;;;OAIG;IACH,eAEG;IAEH;;;OAGG;IACH,aAFU,YAAY,gBAAgB,EAAE,YAAY,CAAC,CAER;IAe7C;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IA4B5B;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,mBAFU,iBAAiB,CAEiB;IAwE5C,gBAQC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACL,QAAQ,IAAI,CAAC,CAexB;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAOnB;IAED;;OAEG;IACH,cAEC;IAED,8BAEC;IAED;;;;;;OAMG;IACH,4DAJW,iBAAiB,GAEf,cAAc,CAY1B;IAED;;;;;;;;;OASG;IACH,qFA2CC;IAED;;;;;;;OAOG;IACH,gBAJW,MAAM,QACN,MAAM,GACL,OAAO,CAKlB;IAGD;;;;;;OAMG;IACH,eALW,MAAM,QACN,MAAM,GACJ,OAAO,CAOnB;IAED;;;;;;;OAOG;IACH,eAJW,MAAM,QACN,MAAM,GACL,OAAO,CAMlB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,uBAZW,MAAM,QACN,MAAM,gBAEJ,mBAAiB,CAgE7B;IAED;;;;;;;;OAQG;IACH,kBAJW,MAAM,QACN,MAAM,2BAqChB;IAiRD;;;;;OAKG;IACH,sBA2BC;IAGD;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,CAIlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,wBAAY,SAAS,CAMjC;IAaD;;;;;;;;;;OAUG;IACH,+BALW,MAAM,uCAEJ,IAAI,CAqBhB;IAED;;;;;;OAMG;IACH,iCALW,MAAM,uCAEJ,OAAO,CAyBnB;IAED;;;;;;OAMG;IACH,6BAJW,MAAM,kCAEJ,QAAQ,OAAO,CAAC,CAU5B;IAED;;;;;OAKG;IACH,0BAJW,MAAM,iEAwChB;IAED;;;OAGG;IACH,uBAFW,MAAM,iBAkBhB;IAED;;;;;;;OAOG;IACH,yCAFa,aAAS,IAAI,CAYzB;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACL,mBAAiB,CAa5B;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACL,gBAAgB,GAAC,SAAS,CAQrC;IAED;;;;;OAKG;IACH,mBAJW,MAAM,QACN,MAAM,QACN,MAAM,QAUhB;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;;CANpC;4BAzgC2B,0CAA0C;iCAOrC,uBAAuB;6BAM3B,mBAAmB;kCAFd,6BAA6B;kCAD7B,wBAAwB;4BAE9B,0BAA0B"}
@@ -274,7 +274,7 @@ export class AssetManager {
274
274
  * @param {String} path
275
275
  * @param {String} type
276
276
  * @param {function(asset:Asset<T>)} [callback] success callback
277
- * @param {function(*)} [failure]
277
+ * @param {function(reason:*)} [failure]
278
278
  * @param {function(loaded:number, total:number)} [progress]
279
279
  * @param {boolean} [skip_queue]
280
280
  * @param {AssetRequestScope} [scope]
@@ -306,8 +306,12 @@ export class AssetManager {
306
306
  const asset = this.assets.get(assetDescription);
307
307
 
308
308
  if (asset !== undefined) {
309
+
310
+ // already exists, dispatch callback immediately
309
311
  callback(asset);
312
+
310
313
  } else {
314
+
311
315
  //create request object
312
316
  const assetRequest = new AssetRequest(callback, failure, progress);
313
317
 
@@ -316,6 +320,7 @@ export class AssetManager {
316
320
 
317
321
  //submit request
318
322
  this.submitRequest(assetDescription, assetRequest);
323
+
319
324
  }
320
325
  }
321
326
 
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Definition of a single asset to be loaded
3
+ */
4
+ export class AssetLoadSpec {
5
+ /**
6
+ *
7
+ * @param data
8
+ * @return {AssetLoadSpec}
9
+ */
10
+ static fromJSON(data: any): AssetLoadSpec;
11
+ /**
12
+ * Path to the asset
13
+ * @type {String}
14
+ */
15
+ uri: string;
16
+ /**
17
+ * Type of the asset
18
+ * @type {String}
19
+ */
20
+ type: string;
21
+ /**
22
+ *
23
+ * @type {number|AssetLevel}
24
+ */
25
+ level: number | AssetLevel;
26
+ /**
27
+ * Priority within the level group (see {@link level})
28
+ * @type {number}
29
+ */
30
+ priority: number;
31
+ fromJSON({ uri, type, level, priority }: {
32
+ uri: any;
33
+ type: any;
34
+ level?: number;
35
+ priority?: number;
36
+ }): void;
37
+ }
38
+ import AssetLevel from "./AssetLevel.js";
39
+ //# sourceMappingURL=AssetLoadSpec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssetLoadSpec.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/preloader/AssetLoadSpec.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IA6BI;;;;OAIG;IACH,4BAFY,aAAa,CAQxB;IAvCD;;;OAGG;IACH,YAAW;IACX;;;OAGG;IACH,aAAY;IACZ;;;OAGG;IACH,OAFU,MAAM,GAAC,UAAU,CAEC;IAC5B;;;OAGG;IACH,UAFU,MAAM,CAEH;IAEb;;;;;aAKC;CAcJ;uBA9CsB,iBAAiB"}
@@ -0,0 +1,47 @@
1
+ import AssetLevel from "./AssetLevel.js";
2
+
3
+ /**
4
+ * Definition of a single asset to be loaded
5
+ */
6
+ export class AssetLoadSpec {
7
+ /**
8
+ * Path to the asset
9
+ * @type {String}
10
+ */
11
+ uri = null;
12
+ /**
13
+ * Type of the asset
14
+ * @type {String}
15
+ */
16
+ type = null;
17
+ /**
18
+ *
19
+ * @type {number|AssetLevel}
20
+ */
21
+ level = AssetLevel.OPTIONAL;
22
+ /**
23
+ * Priority within the level group (see {@link level})
24
+ * @type {number}
25
+ */
26
+ priority = 0;
27
+
28
+ fromJSON({ uri, type, level = AssetLevel.OPTIONAL, priority = 0 }) {
29
+ this.uri = uri;
30
+ this.type = type;
31
+ this.level = level;
32
+ this.priority = priority;
33
+ }
34
+
35
+ /**
36
+ *
37
+ * @param data
38
+ * @return {AssetLoadSpec}
39
+ */
40
+ static fromJSON(data) {
41
+ const r = new AssetLoadSpec();
42
+
43
+ r.fromJSON(data);
44
+
45
+ return r;
46
+ }
47
+ }
@@ -19,9 +19,14 @@
19
19
  export class AssetPreloader {
20
20
  /**
21
21
  *
22
- * @type {number}
22
+ * @return {number}
23
23
  */
24
- totalAssetCount: number;
24
+ get totalAssetCount(): number;
25
+ /**
26
+ *
27
+ * @return {boolean}
28
+ */
29
+ get isResolved(): boolean;
25
30
  /**
26
31
  * @readonly
27
32
  * @type {AssetLoadSpec[][]}
@@ -56,7 +61,13 @@ export class AssetPreloader {
56
61
  * An asset has failed to load
57
62
  */
58
63
  error: Signal<any, any, any, any, any, any, any, any>;
59
- started: Signal<any, any, any, any, any, any, any, any>;
64
+ /**
65
+ * @type {Signal<{level:number, count:number}[]>}
66
+ */
67
+ started: Signal<{
68
+ level: number;
69
+ count: number;
70
+ }[]>;
60
71
  /**
61
72
  * Dispatched when all scheduled assets have been successfully loaded (no errors).
62
73
  * @type {Signal<number>}
@@ -90,53 +101,16 @@ export class AssetPreloader {
90
101
  /**
91
102
  *
92
103
  * @param {AssetManager} assetManager
93
- * @return {AssetPreloader}
104
+ * @return {this}
94
105
  */
95
- load(assetManager: AssetManager): AssetPreloader;
106
+ load(assetManager: AssetManager): this;
107
+ #private;
96
108
  }
97
109
  /**
98
110
  * @deprecated use {@link AssetPreloader} import instead. Renamed in v2.131.7
99
111
  * @type {AssetPreloader}
100
112
  */
101
113
  export const Preloader: AssetPreloader;
102
- /**
103
- * Definition of a single asset to be loaded
104
- */
105
- declare class AssetLoadSpec {
106
- /**
107
- *
108
- * @param data
109
- * @return {AssetLoadSpec}
110
- */
111
- static fromJSON(data: any): AssetLoadSpec;
112
- /**
113
- * Path to the asset
114
- * @type {String}
115
- */
116
- uri: string;
117
- /**
118
- * Type of the asset
119
- * @type {String}
120
- */
121
- type: string;
122
- /**
123
- *
124
- * @type {number|AssetLevel}
125
- */
126
- level: number | AssetLevel;
127
- /**
128
- * Priority within the level group (see {@link level})
129
- * @type {number}
130
- */
131
- priority: number;
132
- fromJSON({ uri, type, level, priority }: {
133
- uri: any;
134
- type: any;
135
- level?: number;
136
- priority?: number;
137
- }): void;
138
- }
114
+ import { AssetLoadSpec } from "./AssetLoadSpec.js";
139
115
  import Signal from "../../../core/events/signal/Signal.js";
140
- import AssetLevel from "./AssetLevel.js";
141
- export {};
142
116
  //# sourceMappingURL=AssetPreloader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AssetPreloader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/preloader/AssetPreloader.js"],"names":[],"mappings":"AAoDA;;;;;;;;;;;;;;;;;GAiBG;AACH;IACI;;;OAGG;IACH,iBAFU,MAAM,CAEI;IAEpB;;;OAGG;IACH,iBAFU,aAAa,EAAE,EAAE,CAEf;IAEZ;;OAEG;IACH;QACI;;WAEG;eADO,OAAO,aAAa,EAAC,MAAM,CAAC;QAGtC;;;;WAIG;kBADO,OAAO;YAAC,QAAO;gBAAC,OAAO,EAAC,MAAM,CAAC;gBAAC,KAAK,EAAC,MAAM,CAAC;gBAAC,QAAQ,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC;QAG3E;;;WAGG;uBADO,MAAM;QAGhB;;WAEG;;;QAGH;;;WAGG;mBADO,OAAO,MAAM,CAAC;QAGxB;;;;WAIG;kBADO,OAAO,MAAM,EAAC,MAAM,CAAC;MAGjC;IAaF;;;;;;;OAOG;IACH,SANW,MAAM,QACN,MAAM,UACN,MAAM,aACN,MAAM,GACL,cAAc,CAqCzB;IAED;;;OAGG;IACH,aAFW;QAAC,GAAG,EAAC,MAAM,CAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAC,KAAK,CAAC,EAAC,MAAM,CAAA;KAAC,EAAE,QAQpD;IAED;;;;OAIG;IACH,kCAFY,cAAc,CAkKzB;CACJ;AAED;;;GAGG;AACH,wBAFU,cAAc,CAEgB;AAlWxC;;GAEG;AACH;IA6BI;;;;OAIG;IACH,4BAFY,aAAa,CAQxB;IAvCD;;;OAGG;IACH,YAAW;IACX;;;OAGG;IACH,aAAY;IACZ;;;OAGG;IACH,OAFU,MAAM,GAAC,UAAU,CAEC;IAC5B;;;OAGG;IACH,UAFU,MAAM,CAEH;IAEb;;;;;aAKC;CAcJ;mBAhDkB,uCAAuC;uBAEnC,iBAAiB"}
1
+ {"version":3,"file":"AssetPreloader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/asset/preloader/AssetPreloader.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAEI;;;OAGG;IACH,8BAEC;IA+BD;;;OAGG;IACH,0BAEC;IAED;;;OAGG;IACH,iBAFU,aAAa,EAAE,EAAE,CAEf;IAEZ;;OAEG;IACH;QACI;;WAEG;eADO,OAAO,aAAa,EAAC,MAAM,CAAC;QAGtC;;;;WAIG;kBADO,OAAO;YAAC,QAAO;gBAAC,OAAO,EAAC,MAAM,CAAC;gBAAC,KAAK,EAAC,MAAM,CAAC;gBAAC,QAAQ,EAAE,MAAM,CAAA;aAAC,CAAA;SAAC,CAAC;QAG3E;;;WAGG;uBADO,MAAM;QAGhB;;WAEG;;QAEH;;WAEG;iBADO,OAAO;YAAC,KAAK,EAAC,MAAM,CAAC;YAAC,KAAK,EAAC,MAAM,CAAA;SAAC,EAAE,CAAC;QAGhD;;;WAGG;mBADO,OAAO,MAAM,CAAC;QAGxB;;;;WAIG;kBADO,OAAO,MAAM,EAAC,MAAM,CAAC;MAGjC;IAaF;;;;;;;OAOG;IACH,SANW,MAAM,QACN,MAAM,UACN,MAAM,aACN,MAAM,GACL,cAAc,CA0CzB;IAED;;;OAGG;IACH,aAFW;QAAC,GAAG,EAAC,MAAM,CAAC;QAAC,IAAI,EAAC,MAAM,CAAC;QAAC,KAAK,CAAC,EAAC,MAAM,CAAA;KAAC,EAAE,QAQpD;IA8HD;;;;OAIG;IACH,kCAFY,IAAI,CA6Ef;;CACJ;AAED;;;GAGG;AACH,wBAFU,cAAc,CAEgB;8BAtZV,oBAAoB;mBAL/B,uCAAuC"}
@@ -1,53 +1,19 @@
1
1
  import { assert } from "../../../core/assert.js";
2
2
  import { array_push_if_unique } from "../../../core/collection/array/array_push_if_unique.js";
3
3
  import Signal from "../../../core/events/signal/Signal.js";
4
+ import { IllegalStateException } from "../../../core/fsm/exceptions/IllegalStateException.js";
4
5
  import { clamp01 } from "../../../core/math/clamp01.js";
6
+ import { objectKeyByValue } from "../../../core/model/object/objectKeyByValue.js";
5
7
  import AssetLevel from "./AssetLevel.js";
8
+ import { AssetLoadSpec } from "./AssetLoadSpec.js";
6
9
 
7
10
  /**
8
- * Definition of a single asset to be loaded
11
+ * @enum {number}
9
12
  */
10
- class AssetLoadSpec {
11
- /**
12
- * Path to the asset
13
- * @type {String}
14
- */
15
- uri = null;
16
- /**
17
- * Type of the asset
18
- * @type {String}
19
- */
20
- type = null;
21
- /**
22
- *
23
- * @type {number|AssetLevel}
24
- */
25
- level = AssetLevel.OPTIONAL;
26
- /**
27
- * Priority within the level group (see {@link level})
28
- * @type {number}
29
- */
30
- priority = 0;
31
-
32
- fromJSON({ uri, type, level = AssetLevel.OPTIONAL, priority = 0 }) {
33
- this.uri = uri;
34
- this.type = type;
35
- this.level = level;
36
- this.priority = priority;
37
- }
38
-
39
- /**
40
- *
41
- * @param data
42
- * @return {AssetLoadSpec}
43
- */
44
- static fromJSON(data) {
45
- const r = new AssetLoadSpec();
46
-
47
- r.fromJSON(data);
48
-
49
- return r;
50
- }
13
+ const StateKind = {
14
+ INITIAL: 0,
15
+ LOADING: 1,
16
+ RESOLVED: 2,
51
17
  }
52
18
 
53
19
  /**
@@ -69,11 +35,51 @@ class AssetLoadSpec {
69
35
  * loader.load(assetManager);
70
36
  */
71
37
  export class AssetPreloader {
38
+
39
+ /**
40
+ *
41
+ * @return {number}
42
+ */
43
+ get totalAssetCount() {
44
+ return this.#asset_count++;
45
+ }
46
+
47
+ /**
48
+ *
49
+ * @type {number}
50
+ */
51
+ #asset_count = 0;
52
+
53
+ /**
54
+ *
55
+ * @type {number}
56
+ */
57
+ #asset_count_loaded = 0;
72
58
  /**
73
59
  *
74
60
  * @type {number}
75
61
  */
76
- totalAssetCount = 0;
62
+ #asset_count_failed = 0;
63
+
64
+ /**
65
+ *
66
+ * @type {AssetManager}
67
+ */
68
+ #asset_manager;
69
+
70
+ /**
71
+ *
72
+ * @type {StateKind}
73
+ */
74
+ #state = StateKind.INITIAL;
75
+
76
+ /**
77
+ *
78
+ * @return {boolean}
79
+ */
80
+ get isResolved() {
81
+ return this.#state === StateKind.RESOLVED;
82
+ }
77
83
 
78
84
  /**
79
85
  * @readonly
@@ -104,6 +110,9 @@ export class AssetPreloader {
104
110
  * An asset has failed to load
105
111
  */
106
112
  error: new Signal(),
113
+ /**
114
+ * @type {Signal<{level:number, count:number}[]>}
115
+ */
107
116
  started: new Signal(),
108
117
  /**
109
118
  * Dispatched when all scheduled assets have been successfully loaded (no errors).
@@ -149,6 +158,10 @@ export class AssetPreloader {
149
158
  assert.isNumber(level, 'level');
150
159
  assert.isNumber(priority, 'priority');
151
160
 
161
+ if (this.#state !== StateKind.INITIAL) {
162
+ throw new IllegalStateException(`Can only .add in initial state. Actual state = ${objectKeyByValue(StateKind, this.#state)}`)
163
+ }
164
+
152
165
  const assets = this.assets;
153
166
 
154
167
  //asset definition
@@ -168,7 +181,8 @@ export class AssetPreloader {
168
181
 
169
182
  assets[_level].push(def);
170
183
 
171
- this.totalAssetCount++;
184
+ this.#asset_count++;
185
+
172
186
  this.on.added.send2(def, _level);
173
187
 
174
188
  return this;
@@ -186,136 +200,162 @@ export class AssetPreloader {
186
200
  }
187
201
  }
188
202
 
189
- /**
190
- *
191
- * @param {AssetManager} assetManager
192
- * @return {AssetPreloader}
193
- */
194
- load(assetManager) {
195
- assert.defined(assetManager, 'assetManager');
196
- assert.equal(assetManager.isAssetManager, true, 'assetManager.isAssetManager !== true');
197
203
 
198
- const on = this.on;
204
+ #try_finish() {
205
+ if (this.#state === StateKind.RESOLVED) {
206
+ // nothing to do
207
+ return;
208
+ }
199
209
 
200
- //current level being processed
201
- const assets = this.assets;
210
+ const loaded = this.#asset_count_loaded;
211
+ const failed = this.#asset_count_failed;
202
212
 
203
- //dispatch init event
204
- const initEvent = assets.map(function (batch, level) {
205
- return {
206
- level: level,
207
- count: batch.length
208
- };
209
- });
213
+ const total_processed = loaded + failed;
210
214
 
211
- on.started.send1(initEvent);
212
- const numAssets = this.totalAssetCount;
215
+ if (total_processed < this.#asset_count) {
216
+ // not done yet
217
+ return;
218
+ }
213
219
 
214
- let numAssetsLoaded = 0;
215
- let numAssetsFailed = 0;
220
+ this.#state = StateKind.RESOLVED;
221
+ // discard reference to asset manager
222
+ this.#asset_manager = undefined;
216
223
 
217
- let finished = false;
224
+ if (failed === 0) {
225
+ this.on.succeeded.send1(loaded);
226
+ }
218
227
 
219
- function try_finish() {
220
- if (finished) {
221
- // already done
222
- return;
223
- }
228
+ this.on.resolved.send2(loaded, failed);
229
+ }
224
230
 
225
- const totalProcessed = numAssetsLoaded + numAssetsFailed;
231
+ /**
232
+ * submit requests in batches in order of importance
233
+ * @param {AssetLevel|number} level
234
+ */
235
+ #load_level(level) {
236
+ assert.enum(level, AssetLevel, "level");
226
237
 
227
- if (totalProcessed < numAssets) {
228
- // not done yet
229
- return;
230
- }
238
+ // filter out assets of the specified level
239
+ const batch = this.assets[level];
231
240
 
232
- if (numAssetsFailed === 0) {
233
- on.succeeded.send1(numAssetsLoaded);
234
- }
241
+ const batch_size = batch.length;
235
242
 
236
- on.resolved.send2(numAssetsLoaded, numAssetsFailed);
243
+ if (batch_size === 0) {
237
244
 
238
- finished = true;
245
+ // a batch of 0 elements.
246
+ // dispatch completion event
247
+ this.on.levelFinished.dispatch(level);
248
+
249
+ //early exit
250
+ return;
239
251
  }
240
252
 
253
+ let batchElementLoadedCount = 0;
254
+ let batchElementFailedCount = 0;
255
+
241
256
  /**
242
- * submit requests in batches in order of importance
243
- * @param {number} level
257
+ *
258
+ * @param {Asset} asset
244
259
  */
245
- function load_level(level) {
246
- // filter out assets of the specified level
247
- const batch = assets[level];
248
-
249
- const batchElementCount = batch.length;
260
+ const assetLoadSuccess = (asset) => {
261
+ batchElementLoadedCount++;
262
+ this.#asset_count_loaded++;
263
+
264
+ let total_ratio = this.#asset_count > 0 ? clamp01(this.#asset_count_loaded / this.#asset_count) : 1;
265
+
266
+ const level_ratio = batch_size > 0 ? clamp01(batchElementLoadedCount / batch_size) : 1;
267
+
268
+ //dispatch progress
269
+ this.on.progress.send1({
270
+ level: {
271
+ id: level,
272
+ current: batchElementLoadedCount,
273
+ total: batch_size,
274
+ progress: level_ratio,
275
+ },
276
+ global: {
277
+ current: this.#asset_count_loaded,
278
+ total: this.#asset_count,
279
+ progress: total_ratio
280
+ }
281
+ });
250
282
 
251
- if (batchElementCount === 0) {
252
- // a batch of 0 elements.
253
- // dispatch completion event
254
- on.levelFinished.dispatch(level);
255
- //early exit
256
- return;
283
+ //monitor completion
284
+ if ((batchElementLoadedCount + batchElementFailedCount) >= batch_size) {
285
+ this.on.levelFinished.dispatch(level);
257
286
  }
258
287
 
259
- let batchElementLoadedCount = 0;
260
- let batchElementFailedCount = 0;
261
-
262
- function assetLoadSuccess(asset) {
263
- batchElementLoadedCount++;
264
- numAssetsLoaded++;
265
-
266
- let total_ratio = numAssets > 0 ? clamp01(numAssetsLoaded / numAssets) : 1;
267
-
268
- const level_ratio = batchElementCount > 0 ? clamp01(batchElementLoadedCount / batchElementCount) : 1;
269
-
270
- //dispatch progress
271
- on.progress.send1({
272
- level: {
273
- id: level,
274
- current: batchElementLoadedCount,
275
- total: batchElementCount,
276
- progress: level_ratio,
277
- },
278
- global: {
279
- current: numAssetsLoaded,
280
- total: numAssets,
281
- progress: total_ratio
282
- }
283
- });
288
+ this.#try_finish();
289
+ }
284
290
 
285
- //monitor completion
286
- if ((batchElementLoadedCount + batchElementFailedCount) >= batchElementCount) {
287
- on.levelFinished.dispatch(level);
288
- }
291
+ const assetLoadFailed = (e) => {
292
+ this.#asset_count_failed++;
293
+ batchElementFailedCount++;
289
294
 
290
- try_finish();
291
- }
295
+ this.on.error.dispatch(e);
292
296
 
293
- function assetLoadFailed(e) {
294
- numAssetsFailed++;
295
- batchElementFailedCount++;
297
+ this.#try_finish();
298
+ }
296
299
 
297
- on.error.dispatch(e);
300
+ //sort batch by priority
301
+ batch.sort((a, b) => {
302
+ return b.priority - a.priority;
303
+ });
298
304
 
299
- try_finish();
300
- }
305
+ const am = this.#asset_manager;
301
306
 
302
- //sort batch by priority
303
- batch.sort((a, b) => {
304
- return b.priority - a.priority;
305
- });
307
+ for (const def of batch) {
306
308
 
307
- for (const def of batch) {
309
+ try {
308
310
 
309
- assetManager.get({
311
+ am.get({
310
312
  path: def.uri,
311
313
  type: def.type,
312
314
  callback: assetLoadSuccess,
313
315
  failure: assetLoadFailed
314
316
  });
315
317
 
318
+ } catch (e) {
319
+
320
+ assetLoadFailed(e);
321
+
316
322
  }
323
+
324
+ }
325
+ }
326
+
327
+ /**
328
+ *
329
+ * @param {AssetManager} assetManager
330
+ * @return {this}
331
+ */
332
+ load(assetManager) {
333
+ assert.defined(assetManager, 'assetManager');
334
+ assert.equal(assetManager.isAssetManager, true, 'assetManager.isAssetManager !== true');
335
+
336
+ if (this.#state !== StateKind.INITIAL) {
337
+ throw new IllegalStateException(`Expected initial state. Actual state = ${objectKeyByValue(StateKind, this.#state)}`);
317
338
  }
318
339
 
340
+ this.#asset_manager = assetManager;
341
+
342
+ this.#state = StateKind.LOADING;
343
+
344
+ const on = this.on;
345
+
346
+ //current level being processed
347
+ const assets = this.assets;
348
+
349
+ //dispatch init event
350
+ const initEvent = assets.map((batch, level) => {
351
+ return {
352
+ level: level,
353
+ count: batch.length
354
+ };
355
+ });
356
+
357
+ on.started.send1(initEvent);
358
+
319
359
  /**
320
360
  *
321
361
  * @type {number[]}
@@ -323,26 +363,39 @@ export class AssetPreloader {
323
363
  const levels = [];
324
364
 
325
365
  for (let level in assets) {
326
- array_push_if_unique(levels, level);
366
+
367
+ const batch = assets[level];
368
+
369
+ if (batch === undefined || batch.length === 0) {
370
+ // batch is empty, skip
371
+ continue;
372
+ }
373
+
374
+ let level_i = parseInt(level);
375
+
376
+ array_push_if_unique(levels, level_i);
327
377
  }
328
378
 
329
- let lastLoadedLevel = 0;
379
+ let last_level_cursor = 0;
330
380
 
331
- function prod() {
381
+ const prod = () => {
332
382
 
333
- if (lastLoadedLevel < levels.length) {
383
+ if (last_level_cursor < levels.length) {
334
384
 
335
385
  // load next
336
386
 
337
- const levelToLoad = lastLoadedLevel;
338
- lastLoadedLevel++;
339
- on.levelFinished.addOne(prod);
387
+ const level_to_load = levels[last_level_cursor];
388
+
389
+ last_level_cursor++;
390
+
391
+ this.on.levelFinished.addOne(prod);
340
392
 
341
- load_level(levelToLoad);
393
+ this.#load_level(level_to_load);
342
394
 
343
395
  } else {
344
396
 
345
397
  // we're done
398
+ this.#try_finish();
346
399
 
347
400
  }
348
401
 
@@ -5,7 +5,7 @@ import GUIElement, { GUIElementFlag } from './GUIElement.js';
5
5
  import { GUIElementEvent } from "./GUIElementEvent.js";
6
6
 
7
7
  /**
8
- * @this {{el:GUIElement, system:GUIElementSystem, entity: number}}
8
+ * @this {el:GUIElement, system:GUIElementSystem, entity: number}
9
9
  * @param {boolean} v
10
10
  * @ignore
11
11
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @this {View}
2
+ * @this View
3
3
  * @param {number} alpha
4
4
  * @param {number} scale
5
5
  * @ignore
@@ -1 +1 @@
1
- {"version":3,"file":"updateAnimationState.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/gui/menu/radial/updateAnimationState.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wDAJW,MAAM,SACN,MAAM,QAWhB"}
1
+ {"version":3,"file":"updateAnimationState.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/ecs/gui/menu/radial/updateAnimationState.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wDAJW,MAAM,SACN,MAAM,QAYhB"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @this {View}
2
+ * @this View
3
3
  * @param {number} alpha
4
4
  * @param {number} scale
5
5
  * @ignore
@@ -9,6 +9,7 @@ export function updateAnimationState(alpha, scale) {
9
9
  /**
10
10
  *
11
11
  * @type {Element|NodeDescription|null}
12
+ * @ignore
12
13
  */
13
14
  const el = this.el;
14
15
  el.style.opacity = alpha;
@@ -12,7 +12,7 @@ import ViewportPosition from './ViewportPosition.js';
12
12
  const CSS_CLASS = 'ecs-viewport-position-component';
13
13
 
14
14
  /**
15
- * @this {{system:ViewportPositionSystem, vp: ViewportPosition, el: GUIElement}}
15
+ * @this {system:ViewportPositionSystem, vp: ViewportPosition, el: GUIElement}
16
16
  * @ignore
17
17
  */
18
18
  function updatePosition() {
@@ -147,7 +147,7 @@ SPEECH_BUBBLE_ANIMATION_OUTRO.addKey(0.2, [0]);
147
147
  SPEECH_BUBBLE_ANIMATION_OUTRO.addTransition(0, TransitionFunctions.CubicEaseIn);
148
148
 
149
149
  /**
150
- * @this {View}
150
+ * @this View
151
151
  * @param {number} alpha
152
152
  * @ignore
153
153
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AnimationSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/systems/AnimationSystem.js"],"names":[],"mappings":"AAwJA;;;;GAIG;AACH,wCAHW,mBAAmB,aACnB,MAAM,QAehB;;sDArKM,OAAO;AA4Kd;IACI;;;;OAIG;IACH,mCAMC;IAHG,iDAAqC;IAErC,sBAAgC;IAGpC;;;;;OAKG;IACH,gBAJW,SAAS,gCAkBnB;IAED;;;;;OAKG;IACH,kBAJW,SAAS,gCAanB;CAsJJ;uBAtWsB,cAAc;iBAPpB,iCAAiC;0BAIxB,2BAA2B"}
1
+ {"version":3,"file":"AnimationSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ecs/systems/AnimationSystem.js"],"names":[],"mappings":"AAyJA;;;;GAIG;AACH,wCAHW,mBAAmB,aACnB,MAAM,QAehB;;sDAtKM,OAAO;AA6Kd;IACI;;;;OAIG;IACH,mCAMC;IAHG,iDAAqC;IAErC,sBAAgC;IAGpC;;;;;OAKG;IACH,gBAJW,SAAS,gCAkBnB;IAED;;;;;OAKG;IACH,kBAJW,SAAS,gCAanB;CAsJJ;uBAvWsB,cAAc;iBAPpB,iCAAiC;0BAIxB,2BAA2B"}
@@ -103,6 +103,7 @@ function startClip(component, clip) {
103
103
  /**
104
104
  *
105
105
  * @param {Animation} component
106
+ * @ignore
106
107
  */
107
108
  function updateAnimationState(component) {
108
109
  const clips = component.clips;
@@ -1 +1 @@
1
- {"version":3,"file":"OctahedralUvEncoder.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js"],"names":[],"mappings":"AAKA;IACI,0CAkBC;IAED,0CA2BC;CACJ;0BAnDyB,gBAAgB"}
1
+ {"version":3,"file":"OctahedralUvEncoder.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/impostors/octahedral/grid/OctahedralUvEncoder.js"],"names":[],"mappings":"AAIA;IACI,0CAEC;IAED,0CAEC;CACJ;0BAVyB,gBAAgB"}
@@ -1,55 +1,13 @@
1
- import { vec3 } from "gl-matrix";
2
- import { v3_dot } from "../../../../../core/geom/vec3/v3_dot.js";
3
- import { sign_not_zero } from "../../../../../core/math/sign_not_zero.js";
1
+ import { octahedral_direction_to_uv } from "../../../../../core/geom/3d/octahedra/octahedral_direction_to_uv.js";
2
+ import { octahedral_uv_to_direction } from "../../../../../core/geom/3d/octahedra/octahedral_uv_to_direction.js";
4
3
  import { UvEncoder } from "./UvEncoder.js";
5
4
 
6
5
  export class OctahedralUvEncoder extends UvEncoder {
7
6
  uv_to_unit(output, input) {
8
- let px = input[0] * 2 - 1;
9
- let pz = input[1] * 2 - 1;
10
-
11
- const abs_x = Math.abs(px);
12
- const abs_z = Math.abs(pz);
13
- const py = 1 - abs_x - abs_z;
14
-
15
- if (py < 0) {
16
- px = sign_not_zero(px) * (1 - abs_z);
17
- pz = sign_not_zero(pz) * (1 - abs_x);
18
- }
19
-
20
- output[0] = px;
21
- output[1] = py;
22
- output[2] = pz;
23
-
24
- vec3.normalize(output, output);
7
+ octahedral_uv_to_direction(output, 0, input, 0);
25
8
  }
26
9
 
27
10
  unit_to_uv(output, input) {
28
-
29
- const input_x = input[0];
30
- const input_y = input[1];
31
- const input_z = input[2];
32
-
33
- const octant_x = sign_not_zero(input_x);
34
- const octant_y = sign_not_zero(input_y);
35
- const octant_z = sign_not_zero(input_z);
36
-
37
- // |x| + |y| + |z| = 1
38
- const sum = v3_dot(input_x, input_y, input_z, octant_x, octant_y, octant_z);
39
-
40
- let octahedron_x = input_x / sum;
41
- const octahedron_y = input_y / sum;
42
- let octahedron_z = input_z / sum;
43
-
44
- if (octahedron_y < 0) {
45
- const absolute_x = Math.abs(octahedron_x);
46
- const absolute_z = Math.abs(octahedron_z);
47
-
48
- octahedron_x = octant_x * (1 - absolute_z);
49
- octahedron_z = octant_z * (1 - absolute_x);
50
- }
51
-
52
- output[0] = octahedron_x;
53
- output[1] = octahedron_z;
11
+ octahedral_direction_to_uv(output, 0, input, 0);
54
12
  }
55
13
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"octahedral_uv_crease_distance.d.ts","sourceRoot":"","sources":["../../../../src/core/geom/octahedral_uv_crease_distance.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,iDAJW,MAAM,KACN,MAAM,GACJ,MAAM,CAqBlB"}