@woosh/meep-engine 2.113.1 → 2.113.3

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 (34) 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 +39 -17
  4. package/build/meep.min.js +1 -1
  5. package/build/meep.module.js +39 -17
  6. package/package.json +1 -1
  7. package/src/core/binary/BinaryBuffer.d.ts +6 -0
  8. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  9. package/src/core/binary/BinaryBuffer.js +15 -0
  10. package/src/core/binary/type/DataTypeIndices.d.ts +1 -0
  11. package/src/core/binary/type/DataTypeIndices.d.ts.map +1 -1
  12. package/src/core/binary/type/DataTypeIndices.js +2 -1
  13. package/src/core/collection/CuckooFilter.d.ts +3 -0
  14. package/src/core/collection/CuckooFilter.d.ts.map +1 -1
  15. package/src/core/collection/CuckooFilter.js +8 -5
  16. package/src/core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js +1 -1
  17. package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
  18. package/src/core/collection/array/typed/is_typed_array_equals.js +32 -15
  19. package/src/core/collection/array/typed/sparse_typed_array_hash.d.ts +10 -0
  20. package/src/core/collection/array/typed/sparse_typed_array_hash.d.ts.map +1 -0
  21. package/src/core/collection/array/typed/sparse_typed_array_hash.js +26 -0
  22. package/src/core/collection/queue/Deque.d.ts.map +1 -1
  23. package/src/core/collection/queue/Deque.js +4 -1
  24. package/src/core/collection/table/RowFirstTableSpec.d.ts +2 -2
  25. package/src/core/collection/table/RowFirstTableSpec.d.ts.map +1 -1
  26. package/src/core/collection/table/RowFirstTableSpec.js +11 -7
  27. package/src/core/geom/3d/compute_triangle_normal.d.ts +5 -5
  28. package/src/core/geom/3d/compute_triangle_normal.d.ts.map +1 -1
  29. package/src/core/geom/3d/compute_triangle_normal.js +4 -4
  30. package/src/core/math/random/roundFair.js +1 -1
  31. package/src/engine/asset/AssetManager.d.ts.map +1 -1
  32. package/src/engine/asset/AssetManager.js +2 -0
  33. package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.d.ts.map +1 -1
  34. package/src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js +2 -13
package/build/meep.cjs CHANGED
@@ -48985,6 +48985,14 @@ function is_typed_array_equals(a, b) {
48985
48985
  return false;
48986
48986
  }
48987
48987
 
48988
+ const a_constructor = a.constructor;
48989
+ const b_constructor = b.constructor;
48990
+
48991
+ if (a_constructor !== b_constructor) {
48992
+ // incompatible constructors
48993
+ return false;
48994
+ }
48995
+
48988
48996
  if (a_length === 0) {
48989
48997
  // both arrays are empty
48990
48998
  return true;
@@ -49001,20 +49009,15 @@ function is_typed_array_equals(a, b) {
49001
49009
  return false;
49002
49010
  }
49003
49011
 
49004
- const a_constructor = a.constructor;
49005
- const b_constructor = b.constructor;
49006
-
49007
- if (a_constructor !== b_constructor) {
49008
- // incompatible constructors
49009
- return false;
49010
- }
49011
-
49012
49012
 
49013
49013
  const a_buffer = a.buffer;
49014
49014
  const b_buffer = b.buffer;
49015
49015
 
49016
49016
  // check if buffers are the same
49017
- if (a_buffer === b_buffer && a.byteOffset === b.byteOffset) {
49017
+ const a_offset = a.byteOffset;
49018
+ const b_offset = b.byteOffset;
49019
+
49020
+ if (a_buffer === b_buffer && a_offset === b_offset) {
49018
49021
  // using the same buffer and pointing to the same range within it
49019
49022
  return true;
49020
49023
  }
@@ -49024,14 +49027,28 @@ function is_typed_array_equals(a, b) {
49024
49027
 
49025
49028
  const bytes_per_element = a_constructor.BYTES_PER_ELEMENT;
49026
49029
 
49027
- if (bytes_per_element < 4 && byte_length % 4 === 0) {
49030
+ if (
49031
+ bytes_per_element < 4
49032
+ && byte_length % 4 === 0
49033
+ && a_offset % 4 === 0
49034
+ && b_offset % 4 === 0
49035
+ ) {
49036
+
49028
49037
  // 4 byte alignment, can use uint32
49029
- a_proxy = new Uint32Array(a_buffer, a.byteOffset, byte_length / 4);
49030
- b_proxy = new Uint32Array(b_buffer, b.byteOffset, byte_length / 4);
49031
- } else if (bytes_per_element < 2 && byte_length % 2 === 0) {
49038
+ a_proxy = new Uint32Array(a_buffer, a_offset, byte_length >>> 2);
49039
+ b_proxy = new Uint32Array(b_buffer, b_offset, byte_length >>> 2);
49040
+
49041
+ } else if (
49042
+ bytes_per_element < 2
49043
+ && byte_length % 2 === 0
49044
+ && a_offset % 2 === 0
49045
+ && b_offset % 2 === 0
49046
+ ) {
49047
+
49032
49048
  // 2 byte alignment, can use uint16
49033
- a_proxy = new Uint16Array(a_buffer, a.byteOffset, byte_length / 2);
49034
- b_proxy = new Uint16Array(b_buffer, b.byteOffset, byte_length / 2);
49049
+ a_proxy = new Uint16Array(a_buffer, a_offset, byte_length >>> 1);
49050
+ b_proxy = new Uint16Array(b_buffer, b_offset, byte_length >>> 1);
49051
+
49035
49052
  }
49036
49053
 
49037
49054
  return isArrayEqualStrict(a_proxy, b_proxy);
@@ -53059,7 +53076,7 @@ class BVH {
53059
53076
  * @readonly
53060
53077
  * @type {Uint32Array|{pointer:number}}
53061
53078
  */
53062
- const SCRATCH_UINT32_TRAVERSAL_STACK = new Uint32Array(781250);
53079
+ const SCRATCH_UINT32_TRAVERSAL_STACK = new Uint32Array(781250); // size is fairly arbitrary
53063
53080
 
53064
53081
  /**
53065
53082
  * Pointer used to track current top of the stack, make sure to unwind once your traversal is done
@@ -84987,7 +85004,7 @@ class Deque {
84987
85004
  /**
84988
85005
  * Using static array allocator to preserve data locality.
84989
85006
  * Initialization via "[]" would give us a dynamically sized array,
84990
- * but it would have unpredictable locality as array may or may not have it's elements stored next to each other in memory
85007
+ * but it would have unpredictable locality as array may or may not have its elements stored next to each other in memory
84991
85008
  * @type {T[]}
84992
85009
  * @private
84993
85010
  */
@@ -85076,9 +85093,11 @@ class Deque {
85076
85093
  const length = this.#data.length;
85077
85094
 
85078
85095
  if (UINT32_MAX === length) {
85096
+ // array is already as big as it can get
85079
85097
  throw new Error('Maximum array size exceeded');
85080
85098
  }
85081
85099
 
85100
+ // double existing length
85082
85101
  let new_length = length * 2;
85083
85102
 
85084
85103
  if (new_length > UINT32_MAX) {
@@ -85133,6 +85152,7 @@ class Deque {
85133
85152
  }
85134
85153
 
85135
85154
  /**
85155
+ * Number of elements in the collection
85136
85156
  * @returns {number}
85137
85157
  */
85138
85158
  size() {
@@ -86080,6 +86100,8 @@ function get_pending_asset_priority_score(pending_asset) {
86080
86100
  }
86081
86101
 
86082
86102
 
86103
+ // TODO handle 429 HTTP error gracefully
86104
+
86083
86105
  /**
86084
86106
  * Handles loading/generating assets
86085
86107
  * @template CTX