@woosh/meep-engine 2.101.0 → 2.103.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 (112) hide show
  1. package/build/meep.cjs +149 -127
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +149 -127
  4. package/package.json +1 -1
  5. package/src/core/__module.d.ts +4 -0
  6. package/src/core/__module.js +4 -0
  7. package/src/core/geom/2d/circle/Circle.d.ts +0 -8
  8. package/src/core/geom/2d/circle/Circle.d.ts.map +1 -1
  9. package/src/core/geom/2d/circle/Circle.js +85 -85
  10. package/src/core/geom/3d/cone/computeConePlaneSide.js +1 -1
  11. package/src/core/geom/3d/mat4/{allocate_transform_m4.d.ts → allocate_m4.d.ts} +2 -2
  12. package/src/core/geom/3d/mat4/allocate_m4.d.ts.map +1 -0
  13. package/src/core/geom/3d/mat4/{allocate_transform_m4.js → allocate_m4.js} +1 -1
  14. package/src/core/geom/ConicRay.d.ts +3 -1
  15. package/src/core/geom/ConicRay.d.ts.map +1 -1
  16. package/src/core/geom/ConicRay.js +7 -5
  17. package/src/core/geom/Vector1.d.ts.map +1 -1
  18. package/src/core/geom/Vector1.js +3 -0
  19. package/src/core/geom/Vector2.d.ts.map +1 -1
  20. package/src/core/geom/Vector2.js +6 -3
  21. package/src/core/geom/Vector3.js +1 -1
  22. package/src/core/geom/Vector4.d.ts.map +1 -1
  23. package/src/core/geom/Vector4.js +13 -92
  24. package/src/core/geom/vec3/v3_angle_cos_between.spec.d.ts +2 -0
  25. package/src/core/geom/vec3/v3_angle_cos_between.spec.d.ts.map +1 -0
  26. package/src/core/geom/vec3/v3_angle_cos_between.spec.js +124 -0
  27. package/src/core/geom/vec3/v3_distance_above_plane.d.ts +13 -4
  28. package/src/core/geom/vec3/v3_distance_sqr.d.ts +12 -1
  29. package/src/core/geom/vec3/v3_length.d.ts +9 -1
  30. package/src/core/geom/vec4/v4_distance_sqr.d.ts +14 -0
  31. package/src/core/geom/vec4/v4_distance_sqr.d.ts.map +1 -0
  32. package/src/core/geom/vec4/v4_distance_sqr.js +20 -0
  33. package/src/core/geom/vec4/v4_dot.d.ts +14 -0
  34. package/src/core/geom/vec4/v4_dot.d.ts.map +1 -0
  35. package/src/core/geom/vec4/v4_dot.js +19 -0
  36. package/src/core/geom/vec4/v4_length_sqr.d.ts +10 -0
  37. package/src/core/geom/vec4/v4_length_sqr.d.ts.map +1 -0
  38. package/src/core/geom/vec4/v4_length_sqr.js +11 -0
  39. package/src/core/geom/vec4/v4_multiply_mat4.d.ts +8 -0
  40. package/src/core/geom/vec4/v4_multiply_mat4.d.ts.map +1 -0
  41. package/src/core/geom/vec4/v4_multiply_mat4.js +42 -0
  42. package/src/core/lang/reactive/compileReactiveExpression.d.ts.map +1 -1
  43. package/src/core/lang/reactive/compileReactiveExpression.js +1 -3
  44. package/src/core/lang/reactive/pegjs/ReactivePegCompiler.d.ts.map +1 -1
  45. package/src/core/lang/reactive/pegjs/ReactivePegCompiler.js +11 -5
  46. package/src/core/math/PI_RECIPROCAL.d.ts +6 -0
  47. package/src/core/math/PI_RECIPROCAL.d.ts.map +1 -0
  48. package/src/core/math/PI_RECIPROCAL.js +5 -0
  49. package/src/core/math/newton_solver_1d.d.ts +4 -3
  50. package/src/core/math/newton_solver_1d.d.ts.map +1 -1
  51. package/src/core/math/newton_solver_1d.js +4 -3
  52. package/src/core/math/physics/brdf/D_GGX.d.ts.map +1 -1
  53. package/src/core/math/physics/brdf/D_GGX.js +4 -1
  54. package/src/core/math/physics/brdf/brdf_burley.d.ts.map +1 -1
  55. package/src/core/math/physics/brdf/brdf_burley.js +5 -1
  56. package/src/core/math/physics/irradiance/interpolate_irradiance_smith.d.ts.map +1 -1
  57. package/src/core/math/physics/irradiance/interpolate_irradiance_smith.js +3 -3
  58. package/src/core/primitives/strings/insert_after.spec.d.ts +2 -0
  59. package/src/core/primitives/strings/insert_after.spec.d.ts.map +1 -0
  60. package/src/core/primitives/strings/insert_after.spec.js +16 -0
  61. package/src/core/primitives/strings/insert_before.spec.d.ts +2 -0
  62. package/src/core/primitives/strings/insert_before.spec.d.ts.map +1 -0
  63. package/src/core/primitives/strings/insert_before.spec.js +16 -0
  64. package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
  65. package/src/core/process/executor/ConcurrentExecutor.js +10 -4
  66. package/src/core/time/current_time_in_seconds.d.ts.map +1 -1
  67. package/src/core/time/current_time_in_seconds.js +1 -1
  68. package/src/engine/animation/curve/compute_curve_aabb.d.ts.map +1 -1
  69. package/src/engine/animation/curve/compute_curve_aabb.js +19 -16
  70. package/src/engine/ecs/fow/FogOfWar.d.ts.map +1 -1
  71. package/src/engine/ecs/fow/FogOfWar.js +12 -12
  72. package/src/engine/ecs/fow/FogOfWar.spec.js +5 -6
  73. package/src/engine/ecs/transform/Transform.d.ts.map +1 -1
  74. package/src/engine/ecs/transform/Transform.js +2 -2
  75. package/src/engine/google/loadGTAG.d.ts +7 -0
  76. package/src/engine/google/loadGTAG.d.ts.map +1 -0
  77. package/src/engine/google/loadGTAG.js +32 -0
  78. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.d.ts.map +1 -1
  79. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js +6 -1
  80. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.d.ts.map +1 -1
  81. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.js +17 -1
  82. package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.d.ts +4 -0
  83. package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.d.ts.map +1 -1
  84. package/src/engine/graphics/texture/virtual/tile/VirtualTextureTile.js +4 -0
  85. package/src/engine/graphics/trail/x/NOTES.md +3 -0
  86. package/src/engine/graphics/trail/x/RibbonMaterialX.d.ts +11 -2
  87. package/src/engine/graphics/trail/x/RibbonMaterialX.d.ts.map +1 -1
  88. package/src/engine/graphics/trail/x/RibbonMaterialX.js +28 -13
  89. package/src/engine/graphics/util/projectSphere.js +4 -4
  90. package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts +2 -1
  91. package/src/engine/metrics/GoogleAnalyticsMetrics.d.ts.map +1 -1
  92. package/src/engine/metrics/GoogleAnalyticsMetrics.js +4 -39
  93. package/src/engine/notify/NotificationLog.d.ts +1 -2
  94. package/src/engine/notify/NotificationLog.d.ts.map +1 -1
  95. package/src/engine/notify/NotificationLog.js +33 -32
  96. package/src/core/geom/3d/mat4/allocate_transform_m4.d.ts.map +0 -1
  97. package/src/core/lang/reactive/nearley/Reactive.ne +0 -87
  98. package/src/engine/compression/CompressionService.d.ts +0 -19
  99. package/src/engine/compression/CompressionService.d.ts.map +0 -1
  100. package/src/engine/compression/CompressionService.js +0 -144
  101. package/src/engine/graphics/trail/CodeflowTrailMaterial.d.ts +0 -4
  102. package/src/engine/graphics/trail/CodeflowTrailMaterial.d.ts.map +0 -1
  103. package/src/engine/graphics/trail/CodeflowTrailMaterial.js +0 -134
  104. package/src/engine/graphics/trail/TemporalPath.d.ts +0 -39
  105. package/src/engine/graphics/trail/TemporalPath.d.ts.map +0 -1
  106. package/src/engine/graphics/trail/TemporalPath.js +0 -129
  107. package/src/engine/graphics/trail/TemporalPath.spec.d.ts +0 -2
  108. package/src/engine/graphics/trail/TemporalPath.spec.d.ts.map +0 -1
  109. package/src/engine/graphics/trail/TemporalPath.spec.js +0 -5
  110. package/src/engine/graphics/util/composeMatrix4RotationScale.d.ts +0 -9
  111. package/src/engine/graphics/util/composeMatrix4RotationScale.d.ts.map +0 -1
  112. package/src/engine/graphics/util/composeMatrix4RotationScale.js +0 -14
@@ -804,7 +804,7 @@ const MATRIX_BYTE_SIZE = 4 * 16;
804
804
  * custom Float32Array allocator, allocated memory in continuous chunks
805
805
  * @returns {Float32Array}
806
806
  */
807
- function allocate_transform_m4() {
807
+ function allocate_m4() {
808
808
  if (transform_bucket_cursor >= TRANSFORM_ALLOCATOR_BUCKET_CAPACITY) {
809
809
  transform_bucket = new ArrayBuffer(TRANSFORM_ALLOCATOR_BUCKET_CAPACITY * MATRIX_BYTE_SIZE);
810
810
  transform_bucket_cursor = 0;
@@ -2476,7 +2476,7 @@ let Vector3$1 = class Vector3 {
2476
2476
  }
2477
2477
 
2478
2478
  /**
2479
- * @param {number} [squaredError=0.01]
2479
+ * @param {number} [squaredError]
2480
2480
  * @return {boolean}
2481
2481
  */
2482
2482
  isNormalized(squaredError = 0.01) {
@@ -4703,7 +4703,7 @@ class Transform {
4703
4703
  * @readonly
4704
4704
  * @type {Float32Array}
4705
4705
  */
4706
- matrix = allocate_transform_m4();
4706
+ matrix = allocate_m4();
4707
4707
 
4708
4708
  /**
4709
4709
  * Various bit flags, see {@link TransformFlags}
@@ -47472,10 +47472,8 @@ function v2_dot(x0, y0, x1, y1) {
47472
47472
  class Vector2 {
47473
47473
  /**
47474
47474
  *
47475
- * @param {number} [x=0
47475
+ * @param {number} [x=0]
47476
47476
  * @param {number} [y=0]
47477
- * @property {number} x
47478
- * @property {number} y
47479
47477
  * @constructor
47480
47478
  */
47481
47479
  constructor(x = 0, y = 0) {
@@ -50396,6 +50394,7 @@ class Vector1 extends Number {
50396
50394
  * @param {number} x
50397
50395
  */
50398
50396
  setSilent(x) {
50397
+
50399
50398
  this.x = x;
50400
50399
  }
50401
50400
 
@@ -50635,93 +50634,6 @@ function computeHashIntegerArray(...value) {
50635
50634
  */
50636
50635
 
50637
50636
 
50638
- /**
50639
- *
50640
- * @param {number[]} result
50641
- * @param {number[]} input
50642
- * @param {number[]} mat4
50643
- */
50644
- function v4_applyMatrix4(result, input, mat4) {
50645
- const a0 = mat4[0];
50646
- const a1 = mat4[1];
50647
- const a2 = mat4[2];
50648
- const a3 = mat4[3];
50649
-
50650
- const b0 = mat4[4];
50651
- const b1 = mat4[5];
50652
- const b2 = mat4[6];
50653
- const b3 = mat4[7];
50654
-
50655
- const c0 = mat4[8];
50656
- const c1 = mat4[9];
50657
- const c2 = mat4[10];
50658
- const c3 = mat4[11];
50659
-
50660
- const d0 = mat4[12];
50661
- const d1 = mat4[13];
50662
- const d2 = mat4[14];
50663
- const d3 = mat4[15];
50664
-
50665
- const _x = input[0];
50666
- const _y = input[1];
50667
- const _z = input[2];
50668
- const _w = input[3];
50669
-
50670
- const x = a0 * _x + b0 * _y + c0 * _z + d0 * _w;
50671
- const y = a1 * _x + b1 * _y + c1 * _z + d1 * _w;
50672
- const z = a2 * _x + b2 * _y + c2 * _z + d2 * _w;
50673
- const w = a3 * _x + b3 * _y + c3 * _z + d3 * _w;
50674
-
50675
- result[0] = x;
50676
- result[1] = y;
50677
- result[2] = z;
50678
- result[3] = w;
50679
- }
50680
-
50681
- /**
50682
- *
50683
- * @param {number} x0
50684
- * @param {number} y0
50685
- * @param {number} z0
50686
- * @param {number} w0
50687
- * @param {number} x1
50688
- * @param {number} y1
50689
- * @param {number} z1
50690
- * @param {number} w1
50691
- * @returns {number}
50692
- */
50693
- function v4_dot(x0, y0, z0, w0, x1, y1, z1, w1) {
50694
- return (x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1);
50695
- }
50696
-
50697
- /**
50698
- *
50699
- * @param {number} x
50700
- * @param {number} y
50701
- * @param {number} z
50702
- * @param {number} w
50703
- * @returns {number}
50704
- */
50705
- function v4_length_sqr(x, y, z, w) {
50706
- return x * x + y * y + z * z + w * w;
50707
- }
50708
-
50709
- /**
50710
- *
50711
- * @param {number} x0
50712
- * @param {number} y0
50713
- * @param {number} z0
50714
- * @param {number} w0
50715
- * @param {number} x1
50716
- * @param {number} y1
50717
- * @param {number} z1
50718
- * @param {number} w1
50719
- * @returns {number}
50720
- */
50721
- function v4_distance_sqr(x0, y0, z0, w0, x1, y1, z1, w1) {
50722
- return v4_length_sqr(x0 - x1, y0 - y1, z0 - z1, w0 - w1);
50723
- }
50724
-
50725
50637
  class Vector4 {
50726
50638
  /**
50727
50639
  *
@@ -50806,7 +50718,10 @@ class Vector4 {
50806
50718
  this.w = w;
50807
50719
 
50808
50720
  if (this.onChanged.hasHandlers()) {
50809
- this.onChanged.dispatch(x, y, z, w, _x, _y, _z, _w);
50721
+ this.onChanged.send8(
50722
+ x, y, z, w,
50723
+ _x, _y, _z, _w
50724
+ );
50810
50725
  }
50811
50726
  }
50812
50727
 
@@ -50890,7 +50805,12 @@ class Vector4 {
50890
50805
  * @returns {Vector4}
50891
50806
  */
50892
50807
  add3(v3) {
50893
- return this.set(this.x + v3.x, this.y + v3.y, this.z + v3.z, this.w);
50808
+ return this.set(
50809
+ this.x + v3.x,
50810
+ this.y + v3.y,
50811
+ this.z + v3.z,
50812
+ this.w
50813
+ );
50894
50814
  }
50895
50815
 
50896
50816
  /**
@@ -83483,7 +83403,7 @@ class ModuleRegistry {
83483
83403
  * @param {TaskGroup|Task} t
83484
83404
  * @returns {boolean}
83485
83405
  */
83486
- function isGroup(t) {
83406
+ function isGroupTask(t) {
83487
83407
  return t.children instanceof Array;
83488
83408
  }
83489
83409
 
@@ -83491,7 +83411,12 @@ function isGroup(t) {
83491
83411
  * @class
83492
83412
  */
83493
83413
  class ConcurrentExecutor {
83414
+ /**
83415
+ * How many time-slice cycles have been executed this far. This is a monotonically increasing counter
83416
+ * @type {number}
83417
+ */
83494
83418
  #cycle_count = 0;
83419
+
83495
83420
  /**
83496
83421
  * Handle of the last scheduled `setTimeout`
83497
83422
  * @type {number}
@@ -83603,7 +83528,7 @@ class ConcurrentExecutor {
83603
83528
  const child = children[i];
83604
83529
  child.on.completed.add(subTaskCompleted);
83605
83530
  child.on.failed.add(subTaskFailed);
83606
- if (isGroup(child)) {
83531
+ if (isGroupTask(child)) {
83607
83532
  this.runGroup(child);
83608
83533
  } else {
83609
83534
  this.run(child);
@@ -83626,7 +83551,7 @@ class ConcurrentExecutor {
83626
83551
  for (let i = 0; i < n; i++) {
83627
83552
  const child = children[i];
83628
83553
 
83629
- if (isGroup(child)) {
83554
+ if (isGroupTask(child)) {
83630
83555
  this.removeGroup(child);
83631
83556
  } else {
83632
83557
  this.removeTask(child);
@@ -83723,7 +83648,7 @@ class ConcurrentExecutor {
83723
83648
  }
83724
83649
 
83725
83650
  /**
83726
- * Go through unresolved queue and move tasks who's dependencies have been completed to ready queue or fail them
83651
+ * Go through unresolved queue and move tasks whose dependencies have been completed to ready queue or fail them
83727
83652
  */
83728
83653
  resolveTasks() {
83729
83654
  const queueUnresolved = this.queueUnresolved;
@@ -83760,6 +83685,7 @@ class ConcurrentExecutor {
83760
83685
  /**
83761
83686
  *
83762
83687
  * @param {Task} task
83688
+ * @returns {boolean}
83763
83689
  */
83764
83690
  contains(task) {
83765
83691
  if (this.queueUnresolved.indexOf(task) !== -1) {
@@ -96290,6 +96216,7 @@ const source = typeof performance === "undefined" ? Date : performance;
96290
96216
  * @returns {number}
96291
96217
  */
96292
96218
  function current_time_in_seconds() {
96219
+ // time source produces value in milliseconds, we need to scale to seconds
96293
96220
  return source.now() * 1e-3;
96294
96221
  }
96295
96222
 
@@ -102794,50 +102721,51 @@ Notification.prototype.isNotification = true;
102794
102721
  */
102795
102722
 
102796
102723
 
102797
- function NotificationLog() {
102724
+ class NotificationLog {
102798
102725
  /**
102799
102726
  * @readonly
102800
102727
  * @type {List<Notification>}
102801
102728
  */
102802
- this.elements = new List();
102729
+ elements = new List();
102803
102730
 
102804
102731
  /**
102805
102732
  * Once number of entries in the log reaches this amount, the earliest entries will be removed to make space for new ones
102806
102733
  * @type {number}
102807
102734
  */
102808
- this.maxLength = 1000;
102809
- }
102735
+ maxLength = 1000;
102810
102736
 
102811
- /**
102812
- *
102813
- * @param {{}} options See Notification.constructor for details
102814
- * @returns {Notification}
102815
- */
102816
- NotificationLog.prototype.add = function (options) {
102817
- const notification = new Notification(options);
102737
+ /**
102738
+ *
102739
+ * @param {{}} options See {@link Notification.constructor} for details
102740
+ * @returns {Notification}
102741
+ */
102742
+ add(options) {
102743
+ const notification = new Notification(options);
102818
102744
 
102819
- this.addNotification(notification);
102745
+ this.addNotification(notification);
102820
102746
 
102821
- return notification;
102822
- };
102747
+ return notification;
102748
+ }
102823
102749
 
102824
- /**
102825
- *
102826
- * @param {Notification} notification
102827
- */
102828
- NotificationLog.prototype.addNotification = function (notification) {
102750
+ /**
102751
+ *
102752
+ * @param {Notification} notification
102753
+ */
102754
+ addNotification(notification) {
102829
102755
 
102830
- // Crop notification log to size
102831
- const length = this.elements.length;
102756
+ // Crop notification log to size
102757
+ const length = this.elements.length;
102832
102758
 
102833
- const target = this.maxLength - 1;
102759
+ const target = this.maxLength - 1;
102834
102760
 
102835
- if (length > target) {
102836
- this.elements.crop(length - target, length);
102837
- }
102761
+ if (length > target) {
102762
+ // too many elements, drop some
102763
+ this.elements.crop(length - target, length);
102764
+ }
102838
102765
 
102839
- this.elements.add(notification);
102840
- };
102766
+ this.elements.add(notification);
102767
+ }
102768
+ }
102841
102769
 
102842
102770
  class LogDisplay {
102843
102771
  /**
@@ -117805,4 +117733,98 @@ function v2_angle_between(x0, y0, x1, y1) {
117805
117733
  return Math.acos(theta);
117806
117734
  }
117807
117735
 
117808
- export { AmbientOcclusionPostProcessEffect, Behavior, BehaviorStatus, Blackboard, Cache, EngineConfiguration, EngineHarness, ForwardPlusRenderingPlugin, HashMap, Light, ParallelBehavior, ParallelBehaviorPolicy, SGMesh, SGMeshSystem, SelectorBehavior, SequenceBehavior, ShadedGeometry, ShadedGeometrySystem, Signal, SignalBinding, Transform, dispatchViaProxy, findSignalHandlerIndexByHandle, findSignalHandlerIndexByHandleAndContext, find_path_on_grid_astar, quat3_createFromAxisAngle, v2_angle_between, v2_bearing_angle_towards, v2_distance, v2_dot, v2_length_sqr, v2_magnitude, v4_applyMatrix4, v4_distance_sqr, v4_dot, v4_length_sqr };
117736
+ /**
117737
+ *
117738
+ * @param {number[]} result
117739
+ * @param {number[]} input
117740
+ * @param {number[]} mat4
117741
+ */
117742
+ function v4_multiply_mat4(result, input, mat4) {
117743
+ const a0 = mat4[0];
117744
+ const a1 = mat4[1];
117745
+ const a2 = mat4[2];
117746
+ const a3 = mat4[3];
117747
+
117748
+ const b0 = mat4[4];
117749
+ const b1 = mat4[5];
117750
+ const b2 = mat4[6];
117751
+ const b3 = mat4[7];
117752
+
117753
+ const c0 = mat4[8];
117754
+ const c1 = mat4[9];
117755
+ const c2 = mat4[10];
117756
+ const c3 = mat4[11];
117757
+
117758
+ const d0 = mat4[12];
117759
+ const d1 = mat4[13];
117760
+ const d2 = mat4[14];
117761
+ const d3 = mat4[15];
117762
+
117763
+ const _x = input[0];
117764
+ const _y = input[1];
117765
+ const _z = input[2];
117766
+ const _w = input[3];
117767
+
117768
+ const x = a0 * _x + b0 * _y + c0 * _z + d0 * _w;
117769
+ const y = a1 * _x + b1 * _y + c1 * _z + d1 * _w;
117770
+ const z = a2 * _x + b2 * _y + c2 * _z + d2 * _w;
117771
+ const w = a3 * _x + b3 * _y + c3 * _z + d3 * _w;
117772
+
117773
+ result[0] = x;
117774
+ result[1] = y;
117775
+ result[2] = z;
117776
+ result[3] = w;
117777
+ }
117778
+
117779
+ /**
117780
+ *
117781
+ * @param {number} x0
117782
+ * @param {number} y0
117783
+ * @param {number} z0
117784
+ * @param {number} w0
117785
+ * @param {number} x1
117786
+ * @param {number} y1
117787
+ * @param {number} z1
117788
+ * @param {number} w1
117789
+ * @returns {number}
117790
+ */
117791
+ function v4_dot(
117792
+ x0, y0, z0, w0,
117793
+ x1, y1, z1, w1
117794
+ ) {
117795
+
117796
+ return (x0 * x1 + y0 * y1 + z0 * z1 + w0 * w1);
117797
+ }
117798
+
117799
+ /**
117800
+ *
117801
+ * @param {number} x
117802
+ * @param {number} y
117803
+ * @param {number} z
117804
+ * @param {number} w
117805
+ * @returns {number}
117806
+ */
117807
+ function v4_length_sqr(x, y, z, w) {
117808
+ return x * x + y * y + z * z + w * w;
117809
+ }
117810
+
117811
+ /**
117812
+ *
117813
+ * @param {number} x0
117814
+ * @param {number} y0
117815
+ * @param {number} z0
117816
+ * @param {number} w0
117817
+ * @param {number} x1
117818
+ * @param {number} y1
117819
+ * @param {number} z1
117820
+ * @param {number} w1
117821
+ * @returns {number}
117822
+ */
117823
+ function v4_distance_sqr(
117824
+ x0, y0, z0, w0,
117825
+ x1, y1, z1, w1
117826
+ ) {
117827
+ return v4_length_sqr(x0 - x1, y0 - y1, z0 - z1, w0 - w1);
117828
+ }
117829
+
117830
+ export { AmbientOcclusionPostProcessEffect, Behavior, BehaviorStatus, Blackboard, Cache, EngineConfiguration, EngineHarness, ForwardPlusRenderingPlugin, HashMap, Light, ParallelBehavior, ParallelBehaviorPolicy, SGMesh, SGMeshSystem, SelectorBehavior, SequenceBehavior, ShadedGeometry, ShadedGeometrySystem, Signal, SignalBinding, Transform, dispatchViaProxy, findSignalHandlerIndexByHandle, findSignalHandlerIndexByHandleAndContext, find_path_on_grid_astar, quat3_createFromAxisAngle, v2_angle_between, v2_bearing_angle_towards, v2_distance, v2_dot, v2_length_sqr, v2_magnitude, v4_distance_sqr, v4_dot, v4_length_sqr, v4_multiply_mat4 };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "description": "Fully featured ECS game engine written in JavaScript",
6
6
  "type": "module",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.101.0",
8
+ "version": "2.103.0",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -14,4 +14,8 @@ export { v2_length_sqr } from "./geom/vec2/v2_length_sqr.js";
14
14
  export { v2_dot } from "./geom/vec2/v2_dot.js";
15
15
  export { v2_bearing_angle_towards } from "./geom/vec2/v2_bearing_angle_towards.js";
16
16
  export { v2_angle_between } from "./geom/vec2/v2_angle_between.js";
17
+ export { v4_multiply_mat4 } from "./geom/vec4/v4_multiply_mat4.js";
18
+ export { v4_dot } from "./geom/vec4/v4_dot.js";
19
+ export { v4_length_sqr } from "./geom/vec4/v4_length_sqr.js";
20
+ export { v4_distance_sqr } from "./geom/vec4/v4_distance_sqr.js";
17
21
  //# sourceMappingURL=__module.d.ts.map
@@ -16,3 +16,7 @@ export { v2_length_sqr } from "./geom/vec2/v2_length_sqr.js";
16
16
  export { v2_dot } from "./geom/vec2/v2_dot.js";
17
17
  export { v2_bearing_angle_towards } from "./geom/vec2/v2_bearing_angle_towards.js";
18
18
  export { v2_angle_between } from "./geom/vec2/v2_angle_between.js";
19
+ export { v4_multiply_mat4 } from "./geom/vec4/v4_multiply_mat4.js";
20
+ export { v4_dot } from "./geom/vec4/v4_dot.js";
21
+ export { v4_length_sqr } from "./geom/vec4/v4_length_sqr.js";
22
+ export { v4_distance_sqr } from "./geom/vec4/v4_distance_sqr.js";
@@ -1,12 +1,4 @@
1
1
  export default Circle;
2
- /**
3
- * A circle or a 2-dimensional sphere. Represented as a position (x,y) and radius (r)
4
- * @param {Number} [x=0]
5
- * @param {Number} [y=0]
6
- * @param {Number} [r=0]
7
- * @constructor
8
- */
9
- declare function Circle(x?: number, y?: number, r?: number): void;
10
2
  declare class Circle {
11
3
  /**
12
4
  * A circle or a 2-dimensional sphere. Represented as a position (x,y) and radius (r)
@@ -1 +1 @@
1
- {"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/circle/Circle.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH,kEAkBC;;IAzBD;;;;;;OAMG;IACH,gDAkBC;IAjBG;;;OAGG;IACH,UAAU;IAEV;;;OAGG;IACH,UAAU;IAEV;;;OAGG;IACH,UAAU;IAGd;;;OAGG;IACH,oCAEC;IAED;;;;OAIG;IACH,2CAGC;IAED;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAYnB;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,KACN,MAAM,QAOhB;IAED;;;OAGG;IACH,YAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,SAFa,MAAM,CAMlB"}
1
+ {"version":3,"file":"Circle.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/2d/circle/Circle.js"],"names":[],"mappings":";AAEA;IACI;;;;;;OAMG;IACH,gDAkBC;IAjBG;;;OAGG;IACH,UAAU;IAEV;;;OAGG;IACH,UAAU;IAEV;;;OAGG;IACH,UAAU;IAGd;;;OAGG;IACH,oCAEC;IAED;;;;OAIG;IACH,2CAGC;IAED;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAYnB;IAED;;;;OAIG;IACH,cAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;OAKG;IACH,OAJW,MAAM,KACN,MAAM,KACN,MAAM,QAOhB;IAED;;;OAGG;IACH,YAFW,MAAM,QAIhB;IAED;;;OAGG;IACH,SAFa,MAAM,CAIlB;CACJ"}
@@ -1,105 +1,105 @@
1
1
  import { circle_intersects_circle } from "./circle_intersects_circle.js";
2
2
 
3
- /**
4
- * A circle or a 2-dimensional sphere. Represented as a position (x,y) and radius (r)
5
- * @param {Number} [x=0]
6
- * @param {Number} [y=0]
7
- * @param {Number} [r=0]
8
- * @constructor
9
- */
10
- function Circle(x = 0, y = 0, r = 0) {
3
+ class Circle {
11
4
  /**
12
- * Position along X axis
13
- * @type {Number}
5
+ * A circle or a 2-dimensional sphere. Represented as a position (x,y) and radius (r)
6
+ * @param {Number} [x=0]
7
+ * @param {Number} [y=0]
8
+ * @param {Number} [r=0]
9
+ * @constructor
14
10
  */
15
- this.x = x;
11
+ constructor(x = 0, y = 0, r = 0) {
12
+ /**
13
+ * Position along X axis
14
+ * @type {Number}
15
+ */
16
+ this.x = x;
17
+
18
+ /**
19
+ * Position along Y axis
20
+ * @type {Number}
21
+ */
22
+ this.y = y;
23
+
24
+ /**
25
+ * Radius
26
+ * @type {Number}
27
+ */
28
+ this.r = r;
29
+ }
16
30
 
17
31
  /**
18
- * Position along Y axis
19
- * @type {Number}
32
+ *
33
+ * @param {Vector2} target
20
34
  */
21
- this.y = y;
35
+ readPosition(target) {
36
+ target.set(this.x, this.y);
37
+ }
22
38
 
23
39
  /**
24
- * Radius
25
- * @type {Number}
40
+ *
41
+ * @param {Number} deltaX
42
+ * @param {Number} deltaY
26
43
  */
27
- this.r = r;
28
- }
29
-
30
- /**
31
- *
32
- * @param {Vector2} target
33
- */
34
- Circle.prototype.readPosition = function (target) {
35
- target.set(this.x, this.y);
36
- };
37
-
38
- /**
39
- *
40
- * @param {Number} deltaX
41
- * @param {Number} deltaY
42
- */
43
- Circle.prototype.move = function (deltaX, deltaY) {
44
- this.x += deltaX;
45
- this.y += deltaY;
46
- };
44
+ move(deltaX, deltaY) {
45
+ this.x += deltaX;
46
+ this.y += deltaY;
47
+ }
47
48
 
48
- /**
49
- *
50
- * @param {Circle} other
51
- * @returns {boolean}
52
- */
53
- Circle.prototype.overlaps = function (other) {
54
- const x0 = this.x;
55
- const y0 = this.y;
56
- const r0 = this.r;
57
-
58
- const x1 = other.x;
59
- const y1 = other.y;
60
- const r1 = other.r;
49
+ /**
50
+ *
51
+ * @param {Circle} other
52
+ * @returns {boolean}
53
+ */
54
+ overlaps(other) {
55
+ const x0 = this.x;
56
+ const y0 = this.y;
57
+ const r0 = this.r;
61
58
 
62
- return circle_intersects_circle(x0, y0, r0, x1, y1, r1);
63
- };
59
+ const x1 = other.x;
60
+ const y1 = other.y;
61
+ const r1 = other.r;
64
62
 
65
- /**
66
- *
67
- * @param {Circle} other
68
- * @returns {boolean}
69
- */
70
- Circle.prototype.equals = function (other) {
71
- return this.x === other.x && this.y === other.y && this.r === other.r;
72
- };
63
+ return circle_intersects_circle(x0, y0, r0, x1, y1, r1);
64
+ }
73
65
 
74
- /**
75
- *
76
- * @param {number} x
77
- * @param {number} y
78
- * @param {number} r
79
- */
80
- Circle.prototype.set = function (x, y, r) {
81
- this.x = x;
82
- this.y = y;
66
+ /**
67
+ *
68
+ * @param {Circle} other
69
+ * @returns {boolean}
70
+ */
71
+ equals(other) {
72
+ return this.x === other.x && this.y === other.y && this.r === other.r;
73
+ }
83
74
 
84
- this.r = r;
85
- };
75
+ /**
76
+ *
77
+ * @param {number} x
78
+ * @param {number} y
79
+ * @param {number} r
80
+ */
81
+ set(x, y, r) {
82
+ this.x = x;
83
+ this.y = y;
86
84
 
87
- /**
88
- *
89
- * @param {Circle} other
90
- */
91
- Circle.prototype.copy = function (other) {
92
- this.set(other.x, other.y, other.r);
93
- };
85
+ this.r = r;
86
+ }
94
87
 
95
- /**
96
- *
97
- * @returns {Circle}
98
- */
99
- Circle.prototype.clone = function () {
100
- const result = new Circle(this.x, this.y, this.r);
88
+ /**
89
+ *
90
+ * @param {Circle} other
91
+ */
92
+ copy(other) {
93
+ this.set(other.x, other.y, other.r);
94
+ }
101
95
 
102
- return result;
103
- };
96
+ /**
97
+ *
98
+ * @returns {Circle}
99
+ */
100
+ clone() {
101
+ return new Circle(this.x, this.y, this.r);
102
+ }
103
+ }
104
104
 
105
105
  export default Circle;
@@ -1,5 +1,5 @@
1
+ import { v4_dot } from "../../vec4/v4_dot.js";
1
2
  import Vector3 from "../../Vector3.js";
2
- import { v4_dot } from "../../Vector4.js";
3
3
 
4
4
  const V1 = new Vector3();
5
5
  const V2 = new Vector3();
@@ -2,5 +2,5 @@
2
2
  * custom Float32Array allocator, allocated memory in continuous chunks
3
3
  * @returns {Float32Array}
4
4
  */
5
- export function allocate_transform_m4(): Float32Array;
6
- //# sourceMappingURL=allocate_transform_m4.d.ts.map
5
+ export function allocate_m4(): Float32Array;
6
+ //# sourceMappingURL=allocate_m4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allocate_m4.d.ts","sourceRoot":"","sources":["../../../../../../src/core/geom/3d/mat4/allocate_m4.js"],"names":[],"mappings":"AAuBA;;;GAGG;AACH,+BAFa,YAAY,CAgBxB"}
@@ -25,7 +25,7 @@ const MATRIX_BYTE_SIZE = 4 * 16;
25
25
  * custom Float32Array allocator, allocated memory in continuous chunks
26
26
  * @returns {Float32Array}
27
27
  */
28
- export function allocate_transform_m4() {
28
+ export function allocate_m4() {
29
29
  if (transform_bucket_cursor >= TRANSFORM_ALLOCATOR_BUCKET_CAPACITY) {
30
30
  transform_bucket = new ArrayBuffer(TRANSFORM_ALLOCATOR_BUCKET_CAPACITY * MATRIX_BYTE_SIZE);
31
31
  transform_bucket_cursor = 0;