@woosh/meep-engine 2.115.0 → 2.116.1

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 (74) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/build/meep.cjs +204 -177
  3. package/build/meep.min.js +1 -1
  4. package/build/meep.module.js +204 -177
  5. package/editor/view/ecs/HierarchicalEntityListView.js +2 -2
  6. package/package.json +1 -1
  7. package/src/core/collection/array/{compareArrays.d.ts → array_compare.d.ts} +2 -2
  8. package/src/core/collection/array/array_compare.d.ts.map +1 -0
  9. package/src/core/collection/array/{compareArrays.js → array_compare.js} +5 -1
  10. package/src/core/collection/array/{arrayIndexByEquality.d.ts → array_index_by_equality.d.ts} +2 -2
  11. package/src/core/collection/array/array_index_by_equality.d.ts.map +1 -0
  12. package/src/core/collection/array/{arrayIndexByEquality.js → array_index_by_equality.js} +1 -1
  13. package/src/core/collection/array/array_pick_best_element.d.ts.map +1 -0
  14. package/src/core/collection/array/{arrayPickBestElement.js → array_pick_best_element.js} +2 -2
  15. package/src/core/collection/array/array_pick_best_elements.d.ts +8 -0
  16. package/src/core/collection/array/array_pick_best_elements.d.ts.map +1 -0
  17. package/src/core/collection/array/{arrayPickBestElements.js → array_pick_best_elements.js} +1 -1
  18. package/src/core/collection/array/array_replace_all.d.ts +2 -1
  19. package/src/core/collection/array/array_replace_all.d.ts.map +1 -1
  20. package/src/core/collection/array/array_replace_all.js +3 -0
  21. package/src/core/collection/array/{arraySetDiff.d.ts → array_set_diff.d.ts} +3 -3
  22. package/src/core/collection/array/array_set_diff.d.ts.map +1 -0
  23. package/src/core/collection/array/{arraySetDiff.js → array_set_diff.js} +4 -4
  24. package/src/core/collection/array/{arraySetSortingDiff.d.ts → array_set_diff_sorting.d.ts} +2 -2
  25. package/src/core/collection/array/array_set_diff_sorting.d.ts.map +1 -0
  26. package/src/core/collection/array/{arraySetSortingDiff.js → array_set_diff_sorting.js} +1 -1
  27. package/src/core/collection/list/FilteredListProjection.d.ts.map +1 -1
  28. package/src/core/collection/list/FilteredListProjection.js +2 -2
  29. package/src/core/collection/list/List.d.ts.map +1 -1
  30. package/src/core/collection/list/List.js +8 -11
  31. package/src/core/collection/set/ArraySet.d.ts.map +1 -1
  32. package/src/core/collection/set/ArraySet.js +11 -1
  33. package/src/core/geom/3d/topology/expandConnectivityByLocality.js +2 -2
  34. package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
  35. package/src/core/math/physics/brdf/brdf_burley.js +3 -14
  36. package/src/core/math/physics/bsdf/bsdf_schlick.js +1 -1
  37. package/src/core/math/physics/pdf/pdf_normal.d.ts +8 -0
  38. package/src/core/math/physics/pdf/pdf_normal.d.ts.map +1 -0
  39. package/src/core/math/physics/pdf/pdf_normal.js +11 -0
  40. package/src/core/math/physics/reflectivity_to_ior.d.ts.map +1 -1
  41. package/src/core/math/physics/reflectivity_to_ior.js +3 -1
  42. package/src/core/model/object/compareValues.js +3 -3
  43. package/src/core/primitives/strings/computeStringHash.d.ts +9 -1
  44. package/src/core/primitives/strings/computeStringHash.d.ts.map +1 -1
  45. package/src/core/primitives/strings/computeStringHash.js +10 -5
  46. package/src/engine/ecs/EntityComponentDataset.js +3 -3
  47. package/src/engine/graphics/ecs/mesh/SkeletonUtils.js +2 -2
  48. package/src/engine/graphics/sh3/gi/material/common.glsl +3 -2
  49. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
  50. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +4 -3
  51. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.d.ts.map +1 -1
  52. package/src/engine/graphics/sh3/lpv/build_probes_for_scene.js +6 -3
  53. package/src/engine/graphics/sh3/prototypeSH3Probe.js +16 -12
  54. package/src/engine/graphics/shaders/DenoiseShader.d.ts.map +1 -1
  55. package/src/engine/graphics/shaders/DenoiseShader.js +3 -12
  56. package/src/engine/input/ecs/components/InputBinding.d.ts.map +1 -1
  57. package/src/engine/input/ecs/components/InputBinding.js +3 -2
  58. package/src/engine/input/ecs/components/InputController.d.ts.map +1 -1
  59. package/src/engine/input/ecs/components/InputController.js +18 -1
  60. package/src/engine/input/ecs/controllers/KeyboardCameraController.js +9 -9
  61. package/src/engine/platform/WebEnginePlatform.d.ts.map +1 -1
  62. package/src/engine/platform/WebEnginePlatform.js +4 -4
  63. package/src/engine/save/GameStateLoader.js +2 -2
  64. package/src/engine/ui/cursor/CursorCoalescence.d.ts.map +1 -1
  65. package/src/engine/ui/cursor/CursorCoalescence.js +2 -2
  66. package/src/view/elements/radial/RadialMenu.js +2 -2
  67. package/src/core/collection/array/arrayIndexByEquality.d.ts.map +0 -1
  68. package/src/core/collection/array/arrayPickBestElement.d.ts.map +0 -1
  69. package/src/core/collection/array/arrayPickBestElements.d.ts +0 -8
  70. package/src/core/collection/array/arrayPickBestElements.d.ts.map +0 -1
  71. package/src/core/collection/array/arraySetDiff.d.ts.map +0 -1
  72. package/src/core/collection/array/arraySetSortingDiff.d.ts.map +0 -1
  73. package/src/core/collection/array/compareArrays.d.ts.map +0 -1
  74. /package/src/core/collection/array/{arrayPickBestElement.d.ts → array_pick_best_element.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"DenoiseShader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shaders/DenoiseShader.js"],"names":[],"mappings":"AAuEA;;;;;GAKG;AACH,sCAJW,MAAM,qBACN,MAAM;;;;;;;;YAyBD;;eAEG;;;;;;;;;;;;;;;;;EAiBlB;;IA/CD;;;;;OAKG;IACH,oBAJW,MAAM,qBACN,MAAM,EA4ChB;;wBAtHuB,OAAO"}
1
+ {"version":3,"file":"DenoiseShader.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/shaders/DenoiseShader.js"],"names":[],"mappings":"AA8DA;;;;;GAKG;AACH,sCAJW,MAAM,qBACN,MAAM;;;;;;;;YAyBD;;eAEG;;;;;;;;;;;;;;;;;EAiBlB;;IA/CD;;;;;OAKG;IACH,oBAJW,MAAM,qBACN,MAAM,EA4ChB;;wBA7GuB,OAAO"}
@@ -1,4 +1,5 @@
1
1
  import { Vector2 } from "three";
2
+ import { pdf_normal } from "../../../core/math/physics/pdf/pdf_normal.js";
2
3
 
3
4
  const KERNEL_SIZE = 15;
4
5
 
@@ -59,16 +60,6 @@ void main(void) {
59
60
  }
60
61
  `;
61
62
 
62
- /**
63
- * Normal Probability Distribution Function
64
- * @param {number} x
65
- * @param {number} sigma
66
- * @return {number}
67
- */
68
- function normpdf(x, sigma) {
69
- return 0.39894 * Math.exp(-0.5 * x * x / (sigma * sigma)) / sigma;
70
- }
71
-
72
63
  /**
73
64
  *
74
65
  * @param {number} sigma
@@ -77,13 +68,13 @@ function normpdf(x, sigma) {
77
68
  */
78
69
  export function DenoiseShader(sigma = 10, filterSmoothness = 0.2) {
79
70
  // compute zNorm
80
- const zNorm = 1 / normpdf(0, filterSmoothness);
71
+ const zNorm = 1 / pdf_normal(0, filterSmoothness);
81
72
 
82
73
  // build kernel
83
74
  const kernel = new Float32Array(KERNEL_SIZE);
84
75
  const kSize = Math.floor((KERNEL_SIZE - 1) / 2);
85
76
  for (let i = 0; i <= kSize; i++) {
86
- const v = normpdf(i, sigma);
77
+ const v = pdf_normal(i, sigma);
87
78
 
88
79
  kernel[kSize + i] = v;
89
80
  kernel[kSize - i] = v;
@@ -1 +1 @@
1
- {"version":3,"file":"InputBinding.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputBinding.js"],"names":[],"mappings":"AAEA;IACI;;;;;OAKG;IACH,2CAJW,MAAM,EAuBhB;IAfG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAChB;;;OAGG;IACH,mBAAwB;IACxB;;;OAGG;IACH,WAFU,OAAO,CAES;CAEjC"}
1
+ {"version":3,"file":"InputBinding.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputBinding.js"],"names":[],"mappings":"AAEA;IACI;;;;;OAKG;IACH,2CAJW,MAAM,EAwBhB;IAfG;;;OAGG;IACH,MAFU,MAAM,CAEA;IAChB;;;OAGG;IACH,mBAAwB;IACxB;;;OAGG;IACH,WAFU,OAAO,CAES;CAEjC"}
@@ -8,8 +8,9 @@ export class InputBinding {
8
8
  * @param {boolean} [exclusive=false]
9
9
  */
10
10
  constructor({ path, listener, exclusive = false }) {
11
- assert.typeOf(path, 'string', 'path');
12
- assert.typeOf(listener, 'function', 'listener');
11
+ assert.isString(path, 'path');
12
+ assert.isFunction(listener, 'listener');
13
+ assert.isBoolean(exclusive, 'exclusive');
13
14
 
14
15
  /**
15
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"InputController.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputController.js"],"names":[],"mappings":";AAMA;IAoBI;;;OAGG;IACH,8CAaC;IApCD;;;;OAIG;IACH,8BAYC;IATG,mBAAyB;IAMzB;;MAEC;CAqBR;;;;;iBA3CgB,0CAA0C;mBACxC,0CAA0C"}
1
+ {"version":3,"file":"InputController.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/ecs/components/InputController.js"],"names":[],"mappings":";AAMA;IAqCI;;;OAGG;IACH,8CAaC;IArDD;;;;OAIG;IACH,8BAYC;IATG,mBAAyB;IAMzB;;MAEC;IAGL;;;;;OAKG;IACH,WAJW,MAAM,qBAEJ,YAAY,CAWxB;CAoBJ;;;;;iBA5DgB,0CAA0C;mBACxC,0CAA0C;6BAChC,mBAAmB"}
@@ -7,7 +7,7 @@ import { InputBinding } from "./InputBinding.js";
7
7
  class InputController {
8
8
  /**
9
9
  *
10
- * @param {Array} bindings
10
+ * @param {Array} [bindings]
11
11
  * @constructor
12
12
  */
13
13
  constructor(bindings = []) {
@@ -24,6 +24,23 @@ class InputController {
24
24
  };
25
25
  }
26
26
 
27
+ /**
28
+ *
29
+ * @param {string} path
30
+ * @param {function} action
31
+ * @returns {InputBinding}
32
+ */
33
+ bind(path, action) {
34
+ assert.isFunction(action, 'action');
35
+ assert.isString(path, 'path');
36
+
37
+ const binding = new InputBinding({ path, listener: action });
38
+
39
+ this.mapping.add(binding);
40
+
41
+ return binding;
42
+ }
43
+
27
44
  /**
28
45
  *
29
46
  * @param {Array} bindings
@@ -45,19 +45,19 @@ class KeyboardCameraController {
45
45
  function registerToggle(keys, object, propertyName) {
46
46
  keys.forEach((keyName) => {
47
47
 
48
- inputController.mapping.add({
49
- path: "keyboard/keys/" + keyName + "/down",
50
- listener: () => {
48
+ inputController.bind(
49
+ "keyboard/keys/" + keyName + "/down",
50
+ () => {
51
51
  object[propertyName] = true;
52
52
 
53
53
  //send interaction event
54
54
  ecd.sendEvent(cameraController.entity, 'user-input');
55
55
  }
56
- });
57
- inputController.mapping.add({
58
- path: "keyboard/keys/" + keyName + "/up",
59
- listener: () => object[propertyName] = false
60
- });
56
+ );
57
+ inputController.bind(
58
+ "keyboard/keys/" + keyName + "/up",
59
+ () => object[propertyName] = false
60
+ );
61
61
  });
62
62
  }
63
63
 
@@ -89,7 +89,7 @@ class KeyboardCameraController {
89
89
  return;
90
90
  }
91
91
 
92
- let displacement = cameraPanSpeed.clone().multiplyScalar(keyboardPanSpeed * timeDelta);
92
+ const displacement = cameraPanSpeed.clone().multiplyScalar(keyboardPanSpeed * timeDelta);
93
93
 
94
94
  const camera_transform = ecd.getComponent(cameraController.entity, Transform);
95
95
 
@@ -1 +1 @@
1
- {"version":3,"file":"WebEnginePlatform.d.ts","sourceRoot":"","sources":["../../../../src/engine/platform/WebEnginePlatform.js"],"names":[],"mappings":"AAMA;IACI;;OAiBC;IAZG;;;OAGG;IACH,SAFU,OAAO,CAE6C;IAG9D;;;OAGG;IACH,cAFU,yBAAyB,CAE4B;IAGnE,sBAEC;IAED,mDAEC;IAED,2CA+DC;CACJ;+BAlG8B,qBAAqB;0CAEV,sDAAsD"}
1
+ {"version":3,"file":"WebEnginePlatform.d.ts","sourceRoot":"","sources":["../../../../src/engine/platform/WebEnginePlatform.js"],"names":[],"mappings":"AAMA;IACI;;OAiBC;IAZG;;;OAGG;IACH,SAFU,OAAO,CAE6C;IAG9D;;;OAGG;IACH,cAFU,yBAAyB,CAE4B;IAGnE,sBAEC;IAED,mDAEC;IAED,2CA+DC;CACJ;+BA/F8B,qBAAqB;0CAFV,sDAAsD"}
@@ -1,7 +1,7 @@
1
- import { EnginePlatform } from "./EnginePlatform.js";
2
- import { IndexedDBStorage } from "../save/storage/IndexedDBStorage.js";
1
+ import { array_pick_best_element } from "../../core/collection/array/array_pick_best_element.js";
3
2
  import { StorageAchievementGateway } from "../achievements/gateway/StorageAchievementGateway.js";
4
- import { arrayPickBestElement } from "../../core/collection/array/arrayPickBestElement.js";
3
+ import { IndexedDBStorage } from "../save/storage/IndexedDBStorage.js";
4
+ import { EnginePlatform } from "./EnginePlatform.js";
5
5
  import { getURLHash } from "./GetURLHash.js";
6
6
 
7
7
  export class WebEnginePlatform extends EnginePlatform {
@@ -76,7 +76,7 @@ export class WebEnginePlatform extends EnginePlatform {
76
76
  };
77
77
  });
78
78
 
79
- const best = arrayPickBestElement(scoredKeys, o => o.score);
79
+ const best = array_pick_best_element(scoredKeys, o => o.score);
80
80
 
81
81
  if (best.score === 0) {
82
82
  return 'en-gb';
@@ -1,5 +1,5 @@
1
1
  import { GameSaveStateMetadata } from "../../../../view/game/save/GameSaveStateMetadata.js";
2
- import { arrayPickBestElement } from "../../core/collection/array/arrayPickBestElement.js";
2
+ import { array_pick_best_element } from "../../core/collection/array/array_pick_best_element.js";
3
3
  import { EnginePlugin } from "../plugin/EnginePlugin.js";
4
4
 
5
5
  class GameStateLoader extends EnginePlugin {
@@ -98,7 +98,7 @@ class GameStateLoader extends EnginePlugin {
98
98
  });
99
99
 
100
100
  //find most recent
101
- const mostRecent = arrayPickBestElement(matches, m => m.timestamp);
101
+ const mostRecent = array_pick_best_element(matches, m => m.timestamp);
102
102
 
103
103
 
104
104
  if (mostRecent === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"CursorCoalescence.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ui/cursor/CursorCoalescence.js"],"names":[],"mappings":"AAGA;IAGQ;;;OAGG;IACH,kBAFU,UAAU,EAAE,CAOrB;IAED,eAAiB;IAGrB;;;OAGG;IACH,0BAFW,UAAU,EAAE,QAItB;IAED,cAEC;IAED;;;OAGG;IACH,YAFW,UAAU,QAMpB;IAED;;OAEG;IACH,OAFa,UAAU,CAKtB;CACJ;2BAjD0B,iBAAiB"}
1
+ {"version":3,"file":"CursorCoalescence.d.ts","sourceRoot":"","sources":["../../../../../src/engine/ui/cursor/CursorCoalescence.js"],"names":[],"mappings":"AAGA;IAGQ;;;OAGG;IACH,kBAFU,UAAU,EAAE,CAOrB;IAED,eAAiB;IAGrB;;;OAGG;IACH,0BAFW,UAAU,EAAE,QAItB;IAED,cAEC;IAED;;;OAGG;IACH,YAFW,UAAU,QAMpB;IAED;;OAEG;IACH,OAFa,UAAU,CAKtB;CACJ;2BAhD0B,iBAAiB"}
@@ -1,5 +1,5 @@
1
+ import { array_pick_best_element } from "../../../core/collection/array/array_pick_best_element.js";
1
2
  import { CursorType } from "./CursorType.js";
2
- import { arrayPickBestElement } from "../../../core/collection/array/arrayPickBestElement.js";
3
3
 
4
4
  export class CursorCoalescence {
5
5
  constructor() {
@@ -45,6 +45,6 @@ export class CursorCoalescence {
45
45
  */
46
46
  get() {
47
47
  //pick best
48
- return arrayPickBestElement(this.cursors, c => this.cursorPriorities.indexOf(c));
48
+ return array_pick_best_element(this.cursors, c => this.cursorPriorities.indexOf(c));
49
49
  }
50
50
  }
@@ -1,4 +1,4 @@
1
- import { arraySetDiff } from "../../../core/collection/array/arraySetDiff.js";
1
+ import { array_set_diff } from "../../../core/collection/array/array_set_diff.js";
2
2
  import List from "../../../core/collection/list/List.js";
3
3
  import Vector2 from "../../../core/geom/Vector2.js";
4
4
  import SVG from "../../SVG.js";
@@ -366,7 +366,7 @@ class RadialMenu extends View {
366
366
  }
367
367
  }
368
368
 
369
- const diff = arraySetDiff(this.selected.asArray(), selected);
369
+ const diff = array_set_diff(this.selected.asArray(), selected);
370
370
 
371
371
  const removals = diff.uniqueA;
372
372
  const additions = diff.uniqueB;
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayIndexByEquality.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arrayIndexByEquality.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,8EAFa,MAAM,CAclB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayPickBestElement.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arrayPickBestElement.js"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,2EAkCC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * @template T
3
- * @param {T[]} array
4
- * @param {function(el:T, index:number):number} scoreFunction
5
- * @returns {T[]}
6
- */
7
- export function arrayPickBestElements<T>(array: T[], scoreFunction: any): T[];
8
- //# sourceMappingURL=arrayPickBestElements.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arrayPickBestElements.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arrayPickBestElements.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,8EA0CC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"arraySetDiff.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arraySetDiff.js"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH;;;;EAoCC;6BAhD4B,gCAAgC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"arraySetSortingDiff.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/arraySetSortingDiff.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH;;;;EAsDC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"compareArrays.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/array/compareArrays.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,qFAHyB,MAAM,GACnB,MAAM,CAwBjB"}