@woosh/meep-engine 2.110.2 → 2.110.5

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 (89) hide show
  1. package/build/meep.cjs +147 -124
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +148 -122
  4. package/package.json +1 -1
  5. package/src/core/events/signal/Signal.d.ts.map +1 -1
  6. package/src/core/events/signal/Signal.js +3 -98
  7. package/src/core/events/signal/dispatchViaProxy.d.ts +7 -0
  8. package/src/core/events/signal/dispatchViaProxy.d.ts.map +1 -0
  9. package/src/core/events/signal/dispatchViaProxy.js +60 -0
  10. package/src/core/events/signal/findSignalHandlerIndexByHandle.d.ts +9 -0
  11. package/src/core/events/signal/findSignalHandlerIndexByHandle.d.ts.map +1 -0
  12. package/src/core/events/signal/findSignalHandlerIndexByHandle.js +26 -0
  13. package/src/core/events/signal/findSignalHandlerIndexByHandleAndContext.d.ts +9 -0
  14. package/src/core/events/signal/findSignalHandlerIndexByHandleAndContext.d.ts.map +1 -0
  15. package/src/core/events/signal/findSignalHandlerIndexByHandleAndContext.js +21 -0
  16. package/src/core/fsm/simple/SimpleStateMachine.d.ts.map +1 -1
  17. package/src/core/fsm/simple/SimpleStateMachine.js +2 -1
  18. package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.d.ts +2 -2
  19. package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.d.ts.map +1 -1
  20. package/src/core/geom/3d/normal/octahedron/encode_unit_to_octahedron.js +1 -1
  21. package/src/core/geom/3d/sphere/sphere_fibonacci_point.d.ts +18 -0
  22. package/src/core/geom/3d/sphere/sphere_fibonacci_point.d.ts.map +1 -0
  23. package/src/core/geom/3d/sphere/sphere_fibonacci_point.js +51 -0
  24. package/src/core/model/object/ObjectPoolFactory.d.ts +17 -10
  25. package/src/core/model/object/ObjectPoolFactory.d.ts.map +1 -1
  26. package/src/core/model/object/ObjectPoolFactory.js +33 -16
  27. package/src/engine/animation/clip/AnimationClip.d.ts.map +1 -1
  28. package/src/engine/animation/clip/AnimationClip.js +4 -0
  29. package/src/engine/animation/clip/AnimationInterpolationKind.d.ts +7 -0
  30. package/src/engine/animation/clip/AnimationInterpolationKind.d.ts.map +1 -0
  31. package/src/engine/animation/clip/AnimationInterpolationKind.js +9 -0
  32. package/src/engine/animation/clip/AnimationTrack.d.ts +12 -0
  33. package/src/engine/animation/clip/AnimationTrack.d.ts.map +1 -1
  34. package/src/engine/animation/clip/AnimationTrack.js +20 -1
  35. package/src/engine/animation/clip/AnimationTrackBinding.d.ts.map +1 -1
  36. package/src/engine/animation/clip/AnimationTrackBinding.js +12 -0
  37. package/src/engine/animation/clip/bind_property_writer.d.ts +9 -0
  38. package/src/engine/animation/clip/bind_property_writer.d.ts.map +1 -0
  39. package/src/engine/animation/clip/bind_property_writer.js +118 -0
  40. package/src/engine/animation/clip/curve_from_track_data.d.ts +12 -0
  41. package/src/engine/animation/clip/curve_from_track_data.d.ts.map +1 -0
  42. package/src/engine/animation/clip/curve_from_track_data.js +27 -0
  43. package/src/engine/animation/clip/curve_from_track_data_cubic_tangents.d.ts +10 -0
  44. package/src/engine/animation/clip/curve_from_track_data_cubic_tangents.d.ts.map +1 -0
  45. package/src/engine/animation/clip/curve_from_track_data_cubic_tangents.js +33 -0
  46. package/src/engine/animation/clip/curve_from_track_data_discrete.d.ts +10 -0
  47. package/src/engine/animation/clip/curve_from_track_data_discrete.d.ts.map +1 -0
  48. package/src/engine/animation/clip/curve_from_track_data_discrete.js +30 -0
  49. package/src/engine/animation/clip/curve_from_track_data_linear.d.ts +10 -0
  50. package/src/engine/animation/clip/curve_from_track_data_linear.d.ts.map +1 -0
  51. package/src/engine/animation/clip/curve_from_track_data_linear.js +25 -0
  52. package/src/engine/animation/clip/ecd_bind_animation_curve.d.ts.map +1 -1
  53. package/src/engine/animation/clip/ecd_bind_animation_curve.js +14 -239
  54. package/src/engine/animation/curve/AnimationCurve.d.ts +17 -17
  55. package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
  56. package/src/engine/animation/curve/AnimationCurve.js +30 -20
  57. package/src/engine/animation/curve/Keyframe.d.ts +5 -0
  58. package/src/engine/animation/curve/Keyframe.d.ts.map +1 -1
  59. package/src/engine/animation/curve/Keyframe.js +6 -0
  60. package/src/engine/animation/curve/binding/BoundValueWriter.d.ts +7 -0
  61. package/src/engine/animation/curve/binding/BoundValueWriter.d.ts.map +1 -1
  62. package/src/engine/animation/curve/binding/BoundValueWriter.js +9 -1
  63. package/src/engine/animation/curve/compute_curve_aabb.d.ts +1 -1
  64. package/src/engine/animation/curve/compute_curve_aabb.js +1 -1
  65. package/src/engine/ecs/EntityComponentDataset.d.ts.map +1 -1
  66. package/src/engine/ecs/EntityComponentDataset.js +4 -3
  67. package/src/engine/ecs/parent/EntityNode.d.ts.map +1 -1
  68. package/src/engine/ecs/parent/EntityNode.js +2 -1
  69. package/src/engine/graphics/geometry/buffered/makeGeometryIndexed.d.ts +2 -1
  70. package/src/engine/graphics/geometry/buffered/makeGeometryIndexed.d.ts.map +1 -1
  71. package/src/engine/graphics/geometry/buffered/makeGeometryIndexed.js +4 -1
  72. package/src/engine/graphics/sh3/gi/material/common.glsl +3 -3
  73. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
  74. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +4 -3
  75. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts +2 -1
  76. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
  77. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +6 -30
  78. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map_fibonacci.d.ts +13 -0
  79. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map_fibonacci.d.ts.map +1 -0
  80. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map_fibonacci.js +163 -0
  81. package/src/engine/graphics/sh3/prototypeSH3Probe.js +2 -2
  82. package/src/engine/graphics/trail/x/RibbonXMaterialSpec.d.ts.map +1 -1
  83. package/src/engine/graphics/trail/x/RibbonXMaterialSpec.js +10 -2
  84. package/src/engine/graphics/trail/x/RibbonXPlugin.d.ts.map +1 -1
  85. package/src/engine/graphics/trail/x/RibbonXPlugin.js +7 -5
  86. package/src/engine/simulation/Ticker.d.ts +9 -0
  87. package/src/core/model/object/SimpleObjectPoolFactory.d.ts +0 -25
  88. package/src/core/model/object/SimpleObjectPoolFactory.d.ts.map +0 -1
  89. package/src/core/model/object/SimpleObjectPoolFactory.js +0 -42
package/build/meep.cjs CHANGED
@@ -899,13 +899,6 @@ function m4_multiply(out, a, b) {
899
899
  out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33;
900
900
  }
901
901
 
902
- const SignalFlags = {
903
- /**
904
- * If set - signal will not invoke handlers when dispatched
905
- */
906
- Silent: 1
907
- };
908
-
909
902
  /**
910
903
  *
911
904
  * @enum {number}
@@ -984,6 +977,118 @@ class SignalHandler {
984
977
  */
985
978
  SignalHandler.prototype.isSignalHandler = true;
986
979
 
980
+ /**
981
+ * Common dispatch stack
982
+ * @readonly
983
+ * @type {SignalHandler[]}
984
+ */
985
+ const dispatch_stack$1 = [];
986
+ let dispatch_stack_top$1 = 0;
987
+
988
+ /**
989
+ *
990
+ * @param {function} f
991
+ * @param {*} context
992
+ * @param {Array} args
993
+ */
994
+ function dispatchCallback(f, context, args) {
995
+
996
+ try {
997
+ f.apply(context, args);
998
+ } catch (e) {
999
+ }
1000
+ }
1001
+
1002
+ /**
1003
+ *
1004
+ * @param {SignalHandler[]} handlers
1005
+ * @param {Array} [args]
1006
+ */
1007
+ function dispatchViaProxy(handlers, args) {
1008
+ const length = handlers.length;
1009
+
1010
+ const stack_pointer = dispatch_stack_top$1;
1011
+ const stack_frame_end = stack_pointer + length;
1012
+ dispatch_stack_top$1 = stack_frame_end;
1013
+
1014
+ let i, h;
1015
+ for (i = 0; i < length; i++) {
1016
+ //copy to proxy
1017
+ dispatch_stack$1[stack_pointer + i] = handlers[length - (i + 1)];
1018
+ }
1019
+
1020
+ for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
1021
+ h = dispatch_stack$1[i];
1022
+
1023
+ if (h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
1024
+ //handler should be cut
1025
+ const p = handlers.indexOf(h);
1026
+ handlers.splice(p, 1);
1027
+ }
1028
+
1029
+ dispatchCallback(h.handle, h.context, args);
1030
+ }
1031
+
1032
+ //drop stack frame
1033
+ dispatch_stack_top$1 = stack_pointer;
1034
+ }
1035
+
1036
+ /**
1037
+ *
1038
+ * @param {SignalHandler[]} handlers
1039
+ * @param {function} f
1040
+ * @param {*} [thisArg]
1041
+ * @returns {number} index of the handler, or -1 if not found
1042
+ */
1043
+ function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
1044
+ const l = handlers.length;
1045
+
1046
+ for (let i = 0; i < l; i++) {
1047
+ const signalHandler = handlers[i];
1048
+
1049
+ if (signalHandler.handle === f) {
1050
+
1051
+ if (thisArg !== undefined && thisArg !== signalHandler.context) {
1052
+ //context variable doesn't match
1053
+ continue;
1054
+ }
1055
+
1056
+ return i;
1057
+ }
1058
+ }
1059
+
1060
+ return -1;
1061
+ }
1062
+
1063
+ /**
1064
+ *
1065
+ * @param {SignalHandler[]} handlers
1066
+ * @param {function} f
1067
+ * @param {*} ctx
1068
+ * @returns {number} index of the handler, or -1 if not found
1069
+ */
1070
+ function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
1071
+ const l = handlers.length;
1072
+
1073
+ for (let i = 0; i < l; i++) {
1074
+ const handler = handlers[i];
1075
+
1076
+ if (handler.handle === f && handler.context === ctx) {
1077
+ return i;
1078
+ }
1079
+
1080
+ }
1081
+
1082
+ return -1;
1083
+ }
1084
+
1085
+ const SignalFlags = {
1086
+ /**
1087
+ * If set - signal will not invoke handlers when dispatched
1088
+ */
1089
+ Silent: 1
1090
+ };
1091
+
987
1092
  /**
988
1093
  * Common dispatch stack
989
1094
  * @readonly
@@ -1562,55 +1667,6 @@ class Signal {
1562
1667
  */
1563
1668
  Signal.prototype.isSignal = true;
1564
1669
 
1565
- /**
1566
- *
1567
- * @param {SignalHandler[]} handlers
1568
- * @param {function} f
1569
- * @param {*} [thisArg]
1570
- * @returns {number} index of the handler, or -1 if not found
1571
- */
1572
- function findSignalHandlerIndexByHandle(handlers, f, thisArg) {
1573
- const l = handlers.length;
1574
-
1575
- for (let i = 0; i < l; i++) {
1576
- const signalHandler = handlers[i];
1577
-
1578
- if (signalHandler.handle === f) {
1579
-
1580
- if (thisArg !== undefined && thisArg !== signalHandler.context) {
1581
- //context variable doesn't match
1582
- continue;
1583
- }
1584
-
1585
- return i;
1586
- }
1587
- }
1588
-
1589
- return -1;
1590
- }
1591
-
1592
- /**
1593
- *
1594
- * @param {SignalHandler[]} handlers
1595
- * @param {function} f
1596
- * @param {*} ctx
1597
- * @returns {number} index of the handler, or -1 if not found
1598
- */
1599
- function findSignalHandlerIndexByHandleAndContext(handlers, f, ctx) {
1600
- const l = handlers.length;
1601
-
1602
- for (let i = 0; i < l; i++) {
1603
- const handler = handlers[i];
1604
-
1605
- if (handler.handle === f && handler.context === ctx) {
1606
- return i;
1607
- }
1608
-
1609
- }
1610
-
1611
- return -1;
1612
- }
1613
-
1614
1670
  /**
1615
1671
  *
1616
1672
  * @param {Signal} signal
@@ -1646,54 +1702,6 @@ function removeHandlerByHandlerAndContext(signal, h, ctx) {
1646
1702
  }
1647
1703
 
1648
1704
  return false;
1649
- }
1650
-
1651
- /**
1652
- *
1653
- * @param {function} f
1654
- * @param {*} context
1655
- * @param {Array} args
1656
- */
1657
- function dispatchCallback(f, context, args) {
1658
-
1659
- try {
1660
- f.apply(context, args);
1661
- } catch (e) {
1662
- }
1663
- }
1664
-
1665
- /**
1666
- *
1667
- * @param {SignalHandler[]} handlers
1668
- * @param {Array} [args]
1669
- */
1670
- function dispatchViaProxy(handlers, args) {
1671
- const length = handlers.length;
1672
-
1673
- const stack_pointer = dispatch_stack_top;
1674
- const stack_frame_end = stack_pointer + length;
1675
- dispatch_stack_top = stack_frame_end;
1676
-
1677
- let i, h;
1678
- for (i = 0; i < length; i++) {
1679
- //copy to proxy
1680
- dispatch_stack[stack_pointer + i] = handlers[length - (i + 1)];
1681
- }
1682
-
1683
- for (i = stack_frame_end - 1; i >= stack_pointer; i--) {
1684
- h = dispatch_stack[i];
1685
-
1686
- if (h.getFlag(SignalHandlerFlags.RemoveAfterExecution)) {
1687
- //handler should be cut
1688
- const p = handlers.indexOf(h);
1689
- handlers.splice(p, 1);
1690
- }
1691
-
1692
- dispatchCallback(h.handle, h.context, args);
1693
- }
1694
-
1695
- //drop stack frame
1696
- dispatch_stack_top = stack_pointer;
1697
1705
  }
1698
1706
 
1699
1707
  /**
@@ -74519,7 +74527,8 @@ class EntityNode {
74519
74527
  // destroy children first
74520
74528
  const children = this.__children;
74521
74529
  const child_count = children.length;
74522
- for (let i = 0; i < child_count; i++) {
74530
+
74531
+ for (let i = child_count - 1; i >= 0; i--) {
74523
74532
  const child = children[i];
74524
74533
 
74525
74534
  child.destroy();
@@ -97941,9 +97950,22 @@ class ImmutableObjectPool {
97941
97950
  }
97942
97951
 
97943
97952
  /**
97953
+ * Object Pool pattern implementation.
97954
+ * Reuse objects instead of relying on garbage collector. Useful in cases where creating or destroying an object is costly, and objects are relatively short-lived
97944
97955
  * @template T
97945
97956
  */
97946
97957
  class ObjectPoolFactory {
97958
+ /**
97959
+ * @private
97960
+ * @type {Array<T>}
97961
+ */
97962
+ pool = [];
97963
+
97964
+ /**
97965
+ * @type {number}
97966
+ */
97967
+ maxSize = 256;
97968
+
97947
97969
  /**
97948
97970
  * @param {function():T} creator
97949
97971
  * @param {function(T)} destroyer
@@ -97960,36 +97982,31 @@ class ObjectPoolFactory {
97960
97982
  * @type {function(): T}
97961
97983
  */
97962
97984
  this.creator = creator;
97985
+
97963
97986
  /**
97964
97987
  * @private
97965
97988
  * @type {function(T)}
97966
97989
  */
97967
97990
  this.destroyer = destroyer;
97991
+
97968
97992
  /**
97969
97993
  * @private
97970
97994
  * @type {function(T)}
97971
97995
  */
97972
97996
  this.resetter = resetter;
97973
97997
 
97974
- /**
97975
- * @private
97976
- * @type {Array<T>}
97977
- */
97978
- this.pool = [];
97979
-
97980
- /**
97981
- * @type {number}
97982
- */
97983
- this.maxSize = 256;
97984
97998
  }
97985
97999
 
97986
98000
  /**
97987
98001
  *
97988
98002
  * @returns {T}
97989
98003
  */
97990
- create() {
97991
- if (this.pool.length > 0) {
97992
- const oldInstance = this.pool.pop();
98004
+ get() {
98005
+ const pool = this.pool;
98006
+
98007
+ if (pool.length > 0) {
98008
+
98009
+ const oldInstance = pool.pop();
97993
98010
 
97994
98011
  //reset the object
97995
98012
  this.resetter(oldInstance);
@@ -98012,7 +98029,9 @@ class ObjectPoolFactory {
98012
98029
  */
98013
98030
  release(object) {
98014
98031
 
98015
- if (this.pool.length >= this.maxSize) {
98032
+ const pool = this.pool;
98033
+
98034
+ if (pool.length >= this.maxSize) {
98016
98035
  //pool is too large, destroy and discard the object
98017
98036
  if (this.destroyer !== noop) {
98018
98037
  this.destroyer(object);
@@ -98022,11 +98041,18 @@ class ObjectPoolFactory {
98022
98041
  }
98023
98042
 
98024
98043
  //add it to the pool
98025
- this.pool.push(object);
98044
+ pool.push(object);
98026
98045
 
98027
98046
  return true;
98028
98047
  }
98029
- }
98048
+ }
98049
+
98050
+
98051
+ /**
98052
+ * @deprecated use `get` instead
98053
+ * @type {function(): T}
98054
+ */
98055
+ ObjectPoolFactory.prototype.create = ObjectPoolFactory.prototype.get;
98030
98056
 
98031
98057
  /**
98032
98058
  * Will invoke A.equals(B) on members if such exists
@@ -118152,9 +118178,6 @@ exports.ShadedGeometrySystem = ShadedGeometrySystem;
118152
118178
  exports.Signal = Signal;
118153
118179
  exports.SignalBinding = SignalBinding;
118154
118180
  exports.Transform = Transform;
118155
- exports.dispatchViaProxy = dispatchViaProxy;
118156
- exports.findSignalHandlerIndexByHandle = findSignalHandlerIndexByHandle;
118157
- exports.findSignalHandlerIndexByHandleAndContext = findSignalHandlerIndexByHandleAndContext;
118158
118181
  exports.find_path_on_grid_astar = find_path_on_grid_astar;
118159
118182
  exports.quat3_createFromAxisAngle = quat3_createFromAxisAngle;
118160
118183
  exports.three_update_shadow_camera_extents = three_update_shadow_camera_extents;