@woosh/meep-engine 2.70.0 → 2.71.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 (31) hide show
  1. package/build/meep.cjs +109 -120
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +109 -120
  4. package/package.json +1 -1
  5. package/src/core/geom/3d/quaternion/quat_encode_to_uint32.js +2 -3
  6. package/src/core/math/remap.js +5 -1
  7. package/src/core/math/statistics/computeStatisticalPartialMedian.js +1 -1
  8. package/src/core/process/task/Task.js +53 -34
  9. package/src/engine/achievements/AchievementManager.js +19 -19
  10. package/src/engine/animation/curve/compression/prototypeCurveCompression.js +6 -6
  11. package/src/engine/animation/curve/draw/build_plot_entity_from_array.js +11 -6
  12. package/src/engine/ecs/dynamic_actions/DynamicActor.js +5 -10
  13. package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +82 -89
  14. package/src/engine/ecs/dynamic_actions/RuleExecution.js +10 -12
  15. package/src/engine/ecs/gui/GUIElement.js +44 -61
  16. package/src/engine/ecs/gui/GUIElementSystem.js +26 -24
  17. package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +12 -15
  18. package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +15 -15
  19. package/src/engine/ecs/gui/parallax/GuiElementParallax.js +3 -3
  20. package/src/engine/ecs/gui/parallax/GuiElementParallaxSystem.js +2 -2
  21. package/src/engine/ecs/gui/position/ViewportPosition.js +5 -50
  22. package/src/engine/ecs/gui/position/ViewportPositionSerializationAdapter.js +42 -0
  23. package/src/engine/ecs/transform/TransformSerializationAdapter.js +5 -10
  24. package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +20 -20
  25. package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +12 -12
  26. package/src/engine/navigation/ecs/components/PathSerializationAdapter.js +1 -4
  27. package/src/core/binary/ValidatingBitSetWrapper.js +0 -81
  28. package/src/core/binary/jsonToStringToByteArray.js +0 -27
  29. package/src/engine/ecs/components/AreaOfEffect.js +0 -12
  30. package/src/engine/ecs/components/Mortality.js +0 -27
  31. package/src/engine/ecs/systems/AreaOfEffectSystem.js +0 -48
package/build/meep.cjs CHANGED
@@ -1893,7 +1893,7 @@ function quat_encode_to_uint32(x, y, z, w) {
1893
1893
  const absZ = Math.abs(z);
1894
1894
  const absW = Math.abs(w);
1895
1895
 
1896
- let max = 0;
1896
+ let v0, v1, v2, dropped, max;
1897
1897
 
1898
1898
  //pick max component
1899
1899
  if (absY > absX) {
@@ -1924,7 +1924,6 @@ function quat_encode_to_uint32(x, y, z, w) {
1924
1924
  max = 3;
1925
1925
  }
1926
1926
 
1927
- let v0, v1, v2, dropped;
1928
1927
 
1929
1928
  //max will be dropped
1930
1929
  if (max === 0) {
@@ -1964,7 +1963,7 @@ function quat_encode_to_uint32(x, y, z, w) {
1964
1963
  v2 = -v2;
1965
1964
  }
1966
1965
 
1967
- const l = Math.sqrt(x * x + y * y + z * z + w * w);
1966
+ const l = Math.hypot(v0, v1, v2, dropped);
1968
1967
  const m = 511 / (l * Math.SQRT1_2);
1969
1968
 
1970
1969
  //re-normalize the remaining components to 10 bit UINT value
@@ -65419,6 +65418,23 @@ const TaskSignal = {
65419
65418
  Yield: 3
65420
65419
  };
65421
65420
 
65421
+ /**
65422
+ * @template T
65423
+ * @param {T[]} array
65424
+ * @param {T} element
65425
+ * @return {boolean}
65426
+ */
65427
+ function array_push_if_unique(array, element) {
65428
+ const i = array.indexOf(element);
65429
+
65430
+ if (i === -1) {
65431
+ array.push(element);
65432
+ return true;
65433
+ }
65434
+
65435
+ return false;
65436
+ }
65437
+
65422
65438
  /**
65423
65439
  * Created by Alex on 22/05/2016.
65424
65440
  */
@@ -65441,8 +65457,44 @@ const TaskState = {
65441
65457
  * Created by Alex on 22/05/2016.
65442
65458
  */
65443
65459
 
65460
+ /**
65461
+ *
65462
+ * @type {number}
65463
+ */
65464
+ let id_counter$3 = 0;
65444
65465
 
65445
65466
  class Task {
65467
+ /**
65468
+ * @readonly
65469
+ * @type {number}
65470
+ */
65471
+ id = id_counter$3++;
65472
+
65473
+ on = {
65474
+ started: new Signal(),
65475
+ completed: new Signal(),
65476
+ failed: new Signal()
65477
+ };
65478
+
65479
+ /**
65480
+ *
65481
+ * @type {ObservedInteger}
65482
+ */
65483
+ state = new ObservedInteger(TaskState.INITIAL);
65484
+
65485
+ /**
65486
+ * amount of time spent running this task in milliseconds
65487
+ * @type {number}
65488
+ * @public
65489
+ */
65490
+ __executedCpuTime = 0;
65491
+ /**
65492
+ * number of time task's cycle function was executed
65493
+ * @type {number}
65494
+ * @public
65495
+ */
65496
+ __executedCycleCount = 0;
65497
+
65446
65498
  /**
65447
65499
  *
65448
65500
  * @param {string} [name] useful for identifying the task later on, for various UI and debug purposes
@@ -65467,9 +65519,16 @@ class Task {
65467
65519
  assert.isFunction(cycleFunction, 'cycleFunction');
65468
65520
  assert.isNumber(estimatedDuration, 'estimatedDuration');
65469
65521
 
65470
-
65522
+ /**
65523
+ *
65524
+ * @type {Task[]}
65525
+ */
65471
65526
  this.dependencies = dependencies;
65472
65527
 
65528
+ /**
65529
+ *
65530
+ * @type {number}
65531
+ */
65473
65532
  this.estimatedDuration = estimatedDuration;
65474
65533
 
65475
65534
  /**
@@ -65497,30 +65556,6 @@ class Task {
65497
65556
 
65498
65557
  }
65499
65558
 
65500
- this.on = {
65501
- started: new Signal(),
65502
- completed: new Signal(),
65503
- failed: new Signal()
65504
- };
65505
-
65506
- /**
65507
- *
65508
- * @type {ObservedInteger}
65509
- */
65510
- this.state = new ObservedInteger(TaskState.INITIAL);
65511
-
65512
- /**
65513
- * amount of time spent running this task in milliseconds
65514
- * @type {number}
65515
- * @public
65516
- */
65517
- this.__executedCpuTime = 0;
65518
- /**
65519
- * number of time task's cycle function was executed
65520
- * @type {number}
65521
- * @public
65522
- */
65523
- this.__executedCycleCount = 0;
65524
65559
  }
65525
65560
 
65526
65561
  computeProgress() {
@@ -65565,11 +65600,7 @@ class Task {
65565
65600
  } else if (task.isTask) {
65566
65601
 
65567
65602
  //check that the dependency is not registered yet
65568
- if (this.dependencies.indexOf(task) === -1) {
65569
-
65570
- this.dependencies.push(task);
65571
-
65572
- }
65603
+ array_push_if_unique(this.dependencies, task);
65573
65604
 
65574
65605
  } else {
65575
65606
  throw new Error('Expected a Task or a TaskGroup, got something else');
@@ -65583,11 +65614,14 @@ class Task {
65583
65614
  * @param {Array<(Task|TaskGroup)>} tasks
65584
65615
  */
65585
65616
  addDependencies(tasks) {
65586
- if (!Array.isArray(tasks)) {
65587
- throw new Error(`argument 'tasks' is not an Array`);
65588
- }
65617
+ assert.isArray(tasks, 'tasks');
65618
+
65619
+ const task_count = tasks.length;
65589
65620
 
65590
- tasks.forEach(t => this.addDependency(t));
65621
+ for (let i = 0; i < task_count; i++) {
65622
+ const task = tasks[i];
65623
+ this.addDependency(task);
65624
+ }
65591
65625
  }
65592
65626
 
65593
65627
  toString() {
@@ -69927,23 +69961,6 @@ function array_copy_unique(source, source_position, destination, destination_pos
69927
69961
  return j - destination_position;
69928
69962
  }
69929
69963
 
69930
- /**
69931
- * @template T
69932
- * @param {T[]} array
69933
- * @param {T} element
69934
- * @return {boolean}
69935
- */
69936
- function array_push_if_unique(array, element) {
69937
- const i = array.indexOf(element);
69938
-
69939
- if (i === -1) {
69940
- array.push(element);
69941
- return true;
69942
- }
69943
-
69944
- return false;
69945
- }
69946
-
69947
69964
  /**
69948
69965
  * Created by Alex on 01/04/2014.
69949
69966
  */
@@ -87870,7 +87887,7 @@ function computeStatisticalPartialMedian(values, start, end) {
87870
87887
 
87871
87888
  const range = end - start;
87872
87889
 
87873
- const position = (start + range / 2) | 0;
87890
+ const position = (start + range) >> 1;
87874
87891
 
87875
87892
  return copy[position];
87876
87893
  }
@@ -98777,13 +98794,6 @@ function playTrackRealTime(track, ecd) {
98777
98794
  return entity;
98778
98795
  }
98779
98796
 
98780
- /**
98781
- * Magic field that can be added to an individual component to control serialization on level of individual components
98782
- * @readonly
98783
- * @type {string}
98784
- */
98785
- const COMPONENT_SERIALIZATION_TRANSIENT_FIELD = '@serialization_transient';
98786
-
98787
98797
  /**
98788
98798
  * @template A,B
98789
98799
  * @param {A} a
@@ -98855,64 +98865,48 @@ const GUIElementFlag = {
98855
98865
  class GUIElement {
98856
98866
  /**
98857
98867
  *
98858
- * @param {View} [view] parameter is deprecated
98859
- * @constructor
98868
+ * @type {View}
98860
98869
  */
98861
- constructor(view) {
98862
- /**
98863
- *
98864
- * @type {View}
98865
- */
98866
- this.view = null;
98867
-
98868
- /**
98869
- *
98870
- * @type {String}
98871
- */
98872
- this.klass = null;
98873
-
98874
- /**
98875
- *
98876
- * @type {Object}
98877
- */
98878
- this.parameters = {};
98879
-
98880
- /**
98881
- * ranges from 0..1 in both X and Y, controls anchor point of element positioning
98882
- * @type {Vector2}
98883
- */
98884
- this.anchor = new Vector2(0, 0);
98870
+ view = null;
98885
98871
 
98886
- /**
98887
- * Used for visual grouping of elements, system will create and manage named containers to group elements together
98888
- * @readonly
98889
- * @type {String|null}
98890
- */
98891
- this.group = null;
98872
+ /**
98873
+ *
98874
+ * @type {String}
98875
+ */
98876
+ klass = null;
98892
98877
 
98893
- /**
98894
- * @private
98895
- * @type {number}
98896
- */
98897
- this.flags = GUIElementFlag.Managed;
98878
+ /**
98879
+ *
98880
+ * @type {Object}
98881
+ */
98882
+ parameters = {};
98898
98883
 
98884
+ /**
98885
+ * ranges from 0..1 in both X and Y, controls anchor point of element positioning
98886
+ * @type {Vector2}
98887
+ */
98888
+ anchor = new Vector2(0, 0);
98899
98889
 
98900
- /**
98901
- *
98902
- * @type {ObservedBoolean}
98903
- */
98904
- this.visible = new ObservedBoolean(true);
98890
+ /**
98891
+ * Used for visual grouping of elements, system will create and manage named containers to group elements together
98892
+ * @readonly
98893
+ * @type {String|null}
98894
+ */
98895
+ group = null;
98905
98896
 
98897
+ /**
98898
+ * @private
98899
+ * @type {number}
98900
+ */
98901
+ flags = GUIElementFlag.Managed;
98906
98902
 
98907
- if (view !== undefined) {
98908
- console.warn('constructor parameters are deprecated');
98909
- this.view = view;
98910
98903
 
98911
- //set non-serializable flag
98912
- this[COMPONENT_SERIALIZATION_TRANSIENT_FIELD] = true;
98913
- }
98904
+ /**
98905
+ *
98906
+ * @type {ObservedBoolean}
98907
+ */
98908
+ visible = new ObservedBoolean(true);
98914
98909
 
98915
- }
98916
98910
 
98917
98911
  /**
98918
98912
  *
@@ -99069,11 +99063,9 @@ GUIElement.serializable = true;
99069
99063
  class ViewportPosition {
99070
99064
  /**
99071
99065
  *
99072
- * @param {Vector2} [position]
99073
- * @param {Vector2} [offset]
99074
99066
  * @constructor
99075
99067
  */
99076
- constructor({ position, offset } = {}) {
99068
+ constructor(options) {
99077
99069
  /**
99078
99070
  * Clip-scale position, on-screen values are in range of 0 to 1
99079
99071
  * @type {Vector2}
@@ -99119,12 +99111,9 @@ class ViewportPosition {
99119
99111
  */
99120
99112
  this.enabled = new ObservedBoolean(true);
99121
99113
 
99122
- if (position !== void 0) {
99123
- this.position.copy(position);
99124
- }
99125
-
99126
- if (offset !== void 0) {
99127
- this.offset.copy(offset);
99114
+ if (options !== undefined) {
99115
+ console.warn("ViewportPosition constructor options is deprecated, please use static fromJSON method instead if you need similar functionality");
99116
+ this.fromJSON(options);
99128
99117
  }
99129
99118
  }
99130
99119