@woosh/meep-engine 2.109.20 → 2.109.22

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 (65) hide show
  1. package/build/bundle-worker-image-decoder.js +1 -1
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/build/meep.cjs +66 -33
  4. package/build/meep.min.js +1 -1
  5. package/build/meep.module.js +66 -33
  6. package/package.json +1 -1
  7. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray_segment.js +1 -1
  8. package/src/core/bvh2/bvh3/query/bvh_query_user_data_ray_segment.js +1 -1
  9. package/src/core/collection/array/isArrayEqualStrict.d.ts.map +1 -1
  10. package/src/core/collection/array/isArrayEqualStrict.js +1 -3
  11. package/src/core/collection/array/isArraysEqualWithComparator.d.ts.map +1 -1
  12. package/src/core/collection/array/isArraysEqualWithComparator.js +3 -2
  13. package/src/core/collection/array/typed/is_typed_array_equals.d.ts +1 -1
  14. package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
  15. package/src/core/collection/array/typed/is_typed_array_equals.js +8 -2
  16. package/src/core/geom/3d/aabb/aabb3_array_near_distance_to_intersection_ray_segment.d.ts +16 -0
  17. package/src/core/geom/3d/aabb/aabb3_array_near_distance_to_intersection_ray_segment.d.ts.map +1 -0
  18. package/src/core/geom/3d/aabb/aabb3_array_near_distance_to_intersection_ray_segment.js +30 -0
  19. package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.d.ts +4 -5
  20. package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.d.ts.map +1 -1
  21. package/src/core/geom/3d/aabb/aabb3_intersects_ray_segment.js +6 -9
  22. package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.d.ts +20 -0
  23. package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.d.ts.map +1 -0
  24. package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js +67 -0
  25. package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.d.ts.map +1 -1
  26. package/src/core/geom/3d/line/line3_compute_nearest_point_to_point.js +15 -1
  27. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts +2 -1
  28. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.d.ts.map +1 -1
  29. package/src/core/geom/3d/normal/octahedron/decode_octahedron_to_unit.js +6 -1
  30. package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.d.ts +20 -0
  31. package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.d.ts.map +1 -0
  32. package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.js +147 -0
  33. package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.spec.d.ts +2 -0
  34. package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.spec.d.ts.map +1 -0
  35. package/src/core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.spec.js +100 -0
  36. package/src/core/geom/octahedral_uv_crease_distance.d.ts +8 -0
  37. package/src/core/geom/octahedral_uv_crease_distance.d.ts.map +1 -0
  38. package/src/core/geom/octahedral_uv_crease_distance.js +26 -0
  39. package/src/core/math/random/generate_halton_jitter.js +2 -2
  40. package/src/core/math/statistics/generate_hammersley_jitter.d.ts +7 -0
  41. package/src/core/math/statistics/generate_hammersley_jitter.d.ts.map +1 -0
  42. package/src/core/math/statistics/generate_hammersley_jitter.js +16 -0
  43. package/src/core/math/statistics/hammersley_sequence_2d.js +2 -1
  44. package/src/core/model/object/objectDeepEquals.d.ts +1 -1
  45. package/src/core/model/object/objectDeepEquals.d.ts.map +1 -1
  46. package/src/core/model/object/objectDeepEquals.js +54 -26
  47. package/src/engine/graphics/geometry/buffered/computeGeometryEquality.d.ts.map +1 -1
  48. package/src/engine/graphics/geometry/buffered/computeGeometryEquality.js +4 -0
  49. package/src/engine/graphics/sh3/gi/material/common.glsl +1 -1
  50. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +0 -7
  51. package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
  52. package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +0 -11
  53. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts +7 -0
  54. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.d.ts.map +1 -1
  55. package/src/engine/graphics/sh3/lpv/LightProbeVolumeBaker.js +39 -25
  56. package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +1 -1
  57. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
  58. package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +34 -35
  59. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts +18 -0
  60. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.d.ts.map +1 -1
  61. package/src/engine/graphics/sh3/path_tracer/BufferedGeometryBVH.js +421 -21
  62. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +1 -1
  63. package/src/engine/graphics/sh3/path_tracer/prototypePathTracer.js +4 -4
  64. package/src/engine/graphics/sh3/prototypeSH3Probe.js +4 -2
  65. package/src/engine/graphics/texture/virtual/prototype.js +3 -1
package/build/meep.cjs CHANGED
@@ -14,9 +14,7 @@ function isArrayEqualStrict(a, b) {
14
14
  return false;
15
15
  }
16
16
 
17
- let i = 0;
18
-
19
- for (; i < il; i++) {
17
+ for (let i = 0; i < il; i++) {
20
18
 
21
19
  if (a[i] !== b[i]) {
22
20
  return false;
@@ -49016,7 +49014,7 @@ function compute_typed_array_constructor_from_data_type(dt) {
49016
49014
  //
49017
49015
 
49018
49016
  /**
49019
- *
49017
+ * Optimized equality method for typed arrays, typically significantly faster than `isArrayEqualStrict`, especially for larger arrays
49020
49018
  * @param {Uint8Array|Uint32Array} a
49021
49019
  * @param {Uint8Array|Uint32Array} b
49022
49020
  * @returns {boolean}
@@ -49034,7 +49032,12 @@ function is_typed_array_equals(a, b) {
49034
49032
  return false;
49035
49033
  }
49036
49034
 
49037
- if (a_length < 128) {
49035
+ if (a_length === 0) {
49036
+ // both arrays are empty
49037
+ return true;
49038
+ }
49039
+
49040
+ if (a_length < 128) { // size is determined empirically, nothing special about the number itself
49038
49041
  // small array, do direct compare
49039
49042
  return isArrayEqualStrict(a, b);
49040
49043
  }
@@ -49073,6 +49076,7 @@ function is_typed_array_equals(a, b) {
49073
49076
  a_proxy = new Uint32Array(a_buffer, a.byteOffset, byte_length / 4);
49074
49077
  b_proxy = new Uint32Array(b_buffer, b.byteOffset, byte_length / 4);
49075
49078
  } else if (bytes_per_element < 2 && byte_length % 2 === 0) {
49079
+ // 2 byte alignment, can use uint16
49076
49080
  a_proxy = new Uint16Array(a_buffer, a.byteOffset, byte_length / 2);
49077
49081
  b_proxy = new Uint16Array(b_buffer, b.byteOffset, byte_length / 2);
49078
49082
  }
@@ -76724,9 +76728,10 @@ function planesEqual(a, b) {
76724
76728
  * @param {T[]} a
76725
76729
  * @param {T[]} b
76726
76730
  * @param {function(T,T):boolean} elements_equal
76731
+ * @param {*} [element_equal_context]
76727
76732
  * @returns {boolean}
76728
76733
  */
76729
- function isArraysEqualWithComparator(a, b, elements_equal) {
76734
+ function isArraysEqualWithComparator(a, b, elements_equal, element_equal_context) {
76730
76735
  if (a === b) {
76731
76736
  // same object
76732
76737
  return true;
@@ -76747,7 +76752,7 @@ function isArraysEqualWithComparator(a, b, elements_equal) {
76747
76752
  const aE = a[i];
76748
76753
  const bE = b[i];
76749
76754
 
76750
- if (!elements_equal(aE, bE)) {
76755
+ if (!elements_equal.call(element_equal_context, aE, bE)) {
76751
76756
  return false;
76752
76757
  }
76753
76758
  }
@@ -102533,9 +102538,16 @@ function easeInOutQuad(t) {
102533
102538
  * @template A,B
102534
102539
  * @param {A} a
102535
102540
  * @param {B} b
102541
+ * @param {function(a:A, b:B):boolean} [value_equality_function] allows you to insert custom element comparison function
102542
+ * @param {*} [value_equality_function_context]
102536
102543
  * @returns {boolean}
102537
102544
  */
102538
- function objectDeepEquals(a, b) {
102545
+ function objectDeepEquals(
102546
+ a, b,
102547
+ value_equality_function = objectDeepEquals,
102548
+ value_equality_function_context = null
102549
+ ) {
102550
+
102539
102551
  if (a === b) {
102540
102552
  // identity shortcut
102541
102553
  return true;
@@ -102551,43 +102563,64 @@ function objectDeepEquals(a, b) {
102551
102563
  if (tA !== "object") {
102552
102564
  // primitive types, identity equality already checked
102553
102565
  return false;
102554
- } else {
102566
+ }
102567
+
102568
+ if (a === null || b === null) {
102569
+ // we know that A and B are not the same, so if one of them is a null - there is no possible equality
102570
+ return false;
102571
+ }
102555
102572
 
102556
- if (a === null || b === null) {
102557
- // we know that A and B are not the same, so if one of them is a null - there is no possible equality
102573
+ if (Array.isArray(a)) {
102574
+ // special fast path for arrays
102575
+ if (!Array.isArray(b)) {
102576
+ // one is an array, the other is not
102558
102577
  return false;
102559
102578
  }
102579
+ return isArraysEqualWithComparator(a, b, value_equality_function, value_equality_function_context);
102580
+ }
102560
102581
 
102561
- if (Array.isArray(a)) {
102562
- // special fast path for arrays
102563
- if (!Array.isArray(b)) {
102564
- // one is an array, the other is not
102565
- return false;
102566
- }
102567
- return isArraysEqualWithComparator(a, b, objectDeepEquals);
102568
- }
102582
+ // try equals function
102583
+ if (
102584
+ typeof a.equals === "function"
102585
+ && typeof b.equals === "function"
102586
+ ) {
102587
+ return a.equals(b);
102588
+ }
102569
102589
 
102570
- const keys_a = Object.keys(a);
102571
- const keys_b = Object.keys(b);
102590
+ const keys_a = Object.keys(a);
102591
+ const keys_b = Object.keys(b);
102572
102592
 
102573
- if (!isArrayEqualStrict(keys_a, keys_b)) {
102574
- // different fields
102575
- return false;
102576
- }
102593
+ // sort keys to eliminate ordering concerns
102594
+ keys_a.sort();
102595
+ keys_b.sort();
102577
102596
 
102578
- const key_count = keys_a.length;
102597
+ if (!isArrayEqualStrict(keys_a, keys_b)) {
102598
+ // different fields
102599
+ return false;
102600
+ }
102579
102601
 
102580
- for (let i = 0; i < key_count; i++) {
102581
- const key = keys_a[i];
102602
+ const key_count = keys_a.length;
102582
102603
 
102583
- if (!objectDeepEquals(a[key], b[key])) {
102584
- return false;
102585
- }
102586
- }
102604
+ for (let i = 0; i < key_count; i++) {
102605
+ const key = keys_a[i];
102587
102606
 
102588
- return true;
102607
+ const a_value = a[key];
102608
+ const b_value = b[key];
102589
102609
 
102610
+ const values_are_equal = value_equality_function.call(
102611
+ value_equality_function_context,
102612
+ a_value,
102613
+ b_value
102614
+ );
102615
+
102616
+ if (!values_are_equal) {
102617
+ return false;
102618
+ }
102590
102619
  }
102620
+
102621
+ // looks like we have equality
102622
+ return true;
102623
+
102591
102624
  }
102592
102625
 
102593
102626
  /**