@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
@@ -48983,6 +48983,14 @@ function is_typed_array_equals(a, b) {
48983
48983
  return false;
48984
48984
  }
48985
48985
 
48986
+ const a_constructor = a.constructor;
48987
+ const b_constructor = b.constructor;
48988
+
48989
+ if (a_constructor !== b_constructor) {
48990
+ // incompatible constructors
48991
+ return false;
48992
+ }
48993
+
48986
48994
  if (a_length === 0) {
48987
48995
  // both arrays are empty
48988
48996
  return true;
@@ -48999,20 +49007,15 @@ function is_typed_array_equals(a, b) {
48999
49007
  return false;
49000
49008
  }
49001
49009
 
49002
- const a_constructor = a.constructor;
49003
- const b_constructor = b.constructor;
49004
-
49005
- if (a_constructor !== b_constructor) {
49006
- // incompatible constructors
49007
- return false;
49008
- }
49009
-
49010
49010
 
49011
49011
  const a_buffer = a.buffer;
49012
49012
  const b_buffer = b.buffer;
49013
49013
 
49014
49014
  // check if buffers are the same
49015
- if (a_buffer === b_buffer && a.byteOffset === b.byteOffset) {
49015
+ const a_offset = a.byteOffset;
49016
+ const b_offset = b.byteOffset;
49017
+
49018
+ if (a_buffer === b_buffer && a_offset === b_offset) {
49016
49019
  // using the same buffer and pointing to the same range within it
49017
49020
  return true;
49018
49021
  }
@@ -49022,14 +49025,28 @@ function is_typed_array_equals(a, b) {
49022
49025
 
49023
49026
  const bytes_per_element = a_constructor.BYTES_PER_ELEMENT;
49024
49027
 
49025
- if (bytes_per_element < 4 && byte_length % 4 === 0) {
49028
+ if (
49029
+ bytes_per_element < 4
49030
+ && byte_length % 4 === 0
49031
+ && a_offset % 4 === 0
49032
+ && b_offset % 4 === 0
49033
+ ) {
49034
+
49026
49035
  // 4 byte alignment, can use uint32
49027
- a_proxy = new Uint32Array(a_buffer, a.byteOffset, byte_length / 4);
49028
- b_proxy = new Uint32Array(b_buffer, b.byteOffset, byte_length / 4);
49029
- } else if (bytes_per_element < 2 && byte_length % 2 === 0) {
49036
+ a_proxy = new Uint32Array(a_buffer, a_offset, byte_length >>> 2);
49037
+ b_proxy = new Uint32Array(b_buffer, b_offset, byte_length >>> 2);
49038
+
49039
+ } else if (
49040
+ bytes_per_element < 2
49041
+ && byte_length % 2 === 0
49042
+ && a_offset % 2 === 0
49043
+ && b_offset % 2 === 0
49044
+ ) {
49045
+
49030
49046
  // 2 byte alignment, can use uint16
49031
- a_proxy = new Uint16Array(a_buffer, a.byteOffset, byte_length / 2);
49032
- b_proxy = new Uint16Array(b_buffer, b.byteOffset, byte_length / 2);
49047
+ a_proxy = new Uint16Array(a_buffer, a_offset, byte_length >>> 1);
49048
+ b_proxy = new Uint16Array(b_buffer, b_offset, byte_length >>> 1);
49049
+
49033
49050
  }
49034
49051
 
49035
49052
  return isArrayEqualStrict(a_proxy, b_proxy);
@@ -53057,7 +53074,7 @@ class BVH {
53057
53074
  * @readonly
53058
53075
  * @type {Uint32Array|{pointer:number}}
53059
53076
  */
53060
- const SCRATCH_UINT32_TRAVERSAL_STACK = new Uint32Array(781250);
53077
+ const SCRATCH_UINT32_TRAVERSAL_STACK = new Uint32Array(781250); // size is fairly arbitrary
53061
53078
 
53062
53079
  /**
53063
53080
  * Pointer used to track current top of the stack, make sure to unwind once your traversal is done
@@ -84985,7 +85002,7 @@ class Deque {
84985
85002
  /**
84986
85003
  * Using static array allocator to preserve data locality.
84987
85004
  * Initialization via "[]" would give us a dynamically sized array,
84988
- * but it would have unpredictable locality as array may or may not have it's elements stored next to each other in memory
85005
+ * but it would have unpredictable locality as array may or may not have its elements stored next to each other in memory
84989
85006
  * @type {T[]}
84990
85007
  * @private
84991
85008
  */
@@ -85074,9 +85091,11 @@ class Deque {
85074
85091
  const length = this.#data.length;
85075
85092
 
85076
85093
  if (UINT32_MAX === length) {
85094
+ // array is already as big as it can get
85077
85095
  throw new Error('Maximum array size exceeded');
85078
85096
  }
85079
85097
 
85098
+ // double existing length
85080
85099
  let new_length = length * 2;
85081
85100
 
85082
85101
  if (new_length > UINT32_MAX) {
@@ -85131,6 +85150,7 @@ class Deque {
85131
85150
  }
85132
85151
 
85133
85152
  /**
85153
+ * Number of elements in the collection
85134
85154
  * @returns {number}
85135
85155
  */
85136
85156
  size() {
@@ -86078,6 +86098,8 @@ function get_pending_asset_priority_score(pending_asset) {
86078
86098
  }
86079
86099
 
86080
86100
 
86101
+ // TODO handle 429 HTTP error gracefully
86102
+
86081
86103
  /**
86082
86104
  * Handles loading/generating assets
86083
86105
  * @template CTX
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.113.1",
8
+ "version": "2.113.3",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -3,6 +3,12 @@
3
3
  * Mostly useful for serialization/deserialization tasks
4
4
  */
5
5
  export class BinaryBuffer {
6
+ /**
7
+ *
8
+ * @param {EndianType} type
9
+ * @return {BinaryBuffer}
10
+ */
11
+ static fromEndianness(type: EndianType): BinaryBuffer;
6
12
  /**
7
13
  *
8
14
  * @param {ArrayBuffer} v
@@ -1 +1 @@
1
- {"version":3,"file":"BinaryBuffer.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BinaryBuffer.js"],"names":[],"mappings":"AA4BA;;;GAGG;AACH;IA88BI;;;;OAIG;IACH,0BAHW,WAAW,GACV,YAAY,CAQvB;IAED;;;;;OAKG;IACH,8BAJW,YAAY,UACZ,YAAY,GACV,MAAM,CAQlB;IAED;;;;;OAKG;IACH,2BAJW,YAAY,UACZ,YAAY,GACV,MAAM,CAQlB;IAED;;;;;OAKG;IACH,yBAJW,YAAY,UACZ,YAAY,GACV,MAAM,CAQlB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,UACZ,YAAY,GACV,MAAM,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FW,MAAM,QAgBhB;IAED;;;;OAIG;IACH,oBAFW,MAAM,QAsBhB;IAED;;;OAGG;IACH,eAFa,MAAM,CAqBlB;IAED;;;OAGG;IACH,mBAFW,MAAM,QAShB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAShB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAShB;IAED;;;;;OAKG;IACH,yBAJW,WAAW,GAAC,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBACtC,MAAM,UACN,MAAM,QAMhB;IAED;;;;;OAKG;IACH,kBAJW,UAAU,GAAC,iBAAiB,iBAC5B,MAAM,UACN,MAAM,QAgChB;IAED;;;;;OAKG;IACH,uBAJW,UAAU,sBACV,MAAM,UACN,MAAM,QAiBhB;IAED;;;;OAIG;IACH,sCAgFC;IAED;;;;OAIG;IACH,yBAkEC;IAED;;;OAGG;IACH,yBAFW,MAAM,QAqBhB;IAED;;;;;OAKG;IACH,4BAJW,MAAM,oBACN,OAAO,GACL,MAAM,CAgBlB;IAkIL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;2BArmC0B,iBAAiB"}
1
+ {"version":3,"file":"BinaryBuffer.d.ts","sourceRoot":"","sources":["../../../../src/core/binary/BinaryBuffer.js"],"names":[],"mappings":"AA4BA;;;GAGG;AACH;IA88BI;;;;OAIG;IACH,4BAHW,UAAU,GACT,YAAY,CAUvB;IAED;;;;OAIG;IACH,0BAHW,WAAW,GACV,YAAY,CAQvB;IAED;;;;;OAKG;IACH,8BAJW,YAAY,UACZ,YAAY,GACV,MAAM,CAQlB;IAED;;;;;OAKG;IACH,2BAJW,YAAY,UACZ,YAAY,GACV,MAAM,CAQlB;IAED;;;;;OAKG;IACH,yBAJW,YAAY,UACZ,YAAY,GACV,MAAM,CAQlB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,UACZ,YAAY,GACV,MAAM,CAQlB;IAED;;;;;OAKG;IACH,0BAJW,YAAY,UACZ,YAAY,GACV,MAAM,CAQlB;IAED;;;;;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a,MAAM,CAqBlB;IAED;;;OAGG;IACH,mBAFW,MAAM,QAShB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAShB;IAED;;;OAGG;IACH,qBAFW,MAAM,QAShB;IAED;;;;;OAKG;IACH,yBAJW,WAAW,GAAC,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,iBACtC,MAAM,UACN,MAAM,QAMhB;IAED;;;;;OAKG;IACH,kBAJW,UAAU,GAAC,iBAAiB,iBAC5B,MAAM,UACN,MAAM,QAgChB;IAED;;;;;OAKG;IACH,uBAJW,UAAU,sBACV,MAAM,UACN,MAAM,QAiBhB;IAED;;;;OAIG;IACH,sCAgFC;IAED;;;;OAIG;IACH,yBAkEC;IAED;;;OAGG;IACH,yBAFW,MAAM,QAqBhB;IAED;;;;;OAKG;IACH,4BAJW,MAAM,oBACN,OAAO,GACL,MAAM,CAgBlB;IAiJL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;2BApnC0B,iBAAiB"}
@@ -1004,6 +1004,21 @@ export class BinaryBuffer {
1004
1004
  return result;
1005
1005
  }
1006
1006
 
1007
+ /**
1008
+ *
1009
+ * @param {EndianType} type
1010
+ * @return {BinaryBuffer}
1011
+ */
1012
+ static fromEndianness(type) {
1013
+ assert.enum(type, EndianType, 'type');
1014
+
1015
+ const r = new BinaryBuffer();
1016
+
1017
+ r.endianness = type;
1018
+
1019
+ return r;
1020
+ }
1021
+
1007
1022
  /**
1008
1023
  *
1009
1024
  * @param {ArrayBuffer} v
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * *
3
+ * Provides stable indices, mainly useful for serialization where other data is subject to change
3
4
  */
4
5
  export type DataTypeIndices = number;
5
6
  export namespace DataTypeIndices {
@@ -1 +1 @@
1
- {"version":3,"file":"DataTypeIndices.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/type/DataTypeIndices.js"],"names":[],"mappings":";;;8BAIU,MAAM"}
1
+ {"version":3,"file":"DataTypeIndices.d.ts","sourceRoot":"","sources":["../../../../../src/core/binary/type/DataTypeIndices.js"],"names":[],"mappings":";;;;8BAKU,MAAM"}
@@ -1,7 +1,8 @@
1
1
  import { BinaryDataType } from "./BinaryDataType.js";
2
2
 
3
3
  /***
4
- *
4
+ * Provides stable indices, mainly useful for serialization where other data is subject to change
5
+ * @readonly
5
6
  * @enum {number}
6
7
  */
7
8
  export const DataTypeIndices = {
@@ -1,4 +1,7 @@
1
1
  /**
2
+ * Space-efficient probabilistic data structure that allows testing whether a key is included in the set or not
3
+ * Provides definite "not in set" answer and a probabilistic "is in set" answer, certainty probability of which can be controlled
4
+ * @see https://en.wikipedia.org/wiki/Cuckoo_filter
2
5
  * @description Inspired by MGunlogson's CuckooFilter4J library
3
6
  */
4
7
  export class CuckooFilter {
@@ -1 +1 @@
1
- {"version":3,"file":"CuckooFilter.d.ts","sourceRoot":"","sources":["../../../../src/core/collection/CuckooFilter.js"],"names":[],"mappings":"AAqDA;;GAEG;AACH;IACI;;;;OAIG;IACH,+BAHW,MAAM,EA2ChB;IA5BG;;;OAGG;IACH,cAFU,MAAM,CAEgC;IAChD,sBAA8D;IAE9D;;;OAGG;IACH,cAFU,MAAM,CAE8C;IAE9D;;;OAGG;IACH,MAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,SAFU,MAAM,CAEA;IAEhB,yBAA4B;IAC5B,qBAAqB;IACrB,uBAAuB;IAG3B,oBAEC;IAED;;;;;;OAMG;IACH,uBAEC;IAED;;;;;;;;;OASG;IACH,mBAkBC;IAED;;;;;;OAMG;IACH,yBASC;IAED;;;;;;OAMG;IACH,0BAUC;IAED;;;;;OAKG;IACH,oBAIC;IAED;;;;;;OAMG;IACH,2BAUC;IAED;;;;;;;OAOG;IACH,2BALW,MAAM,kBACN,MAAM,OACN,MAAM,GACJ,MAAM,CAelB;IAED;;;;;;OAMG;IACH,0BALW,MAAM,kBACN,MAAM,OACN,MAAM,GACJ,OAAO,CAanB;IAED;;;;;;;;OAQG;IACH,wBAsBC;IAED;;;;;;;OAOG;IACH,gCAaC;IAED;;;;;OAKG;IACH,yCASC;IAED;;;;;;;;;;OAUG;IACH,mCAIC;IAED;;;;;OAKG;IACH,gCAWC;IAED;;;;;;;;;;;;;;;OAeG;IACH,aAJW,MAAM,GACJ,OAAO,CA8CnB;IAED,+BAcC;IAED;;;;;;;OAOG;IACH,sBAMC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,aAJW,MAAM,GACJ,OAAO,CA6BnB;IAGD;;;;;;OAMG;IACH,mBAHW,MAAM,GACJ,OAAO,CAUnB;CACJ;uBA5gBsB,qBAAqB"}
1
+ {"version":3,"file":"CuckooFilter.d.ts","sourceRoot":"","sources":["../../../../src/core/collection/CuckooFilter.js"],"names":[],"mappings":"AAqDA;;;;;GAKG;AACH;IACI;;;;OAIG;IACH,+BAHW,MAAM,EA2ChB;IA5BG;;;OAGG;IACH,cAFU,MAAM,CAEgC;IAChD,sBAA8D;IAE9D;;;OAGG;IACH,cAFU,MAAM,CAE8C;IAE9D;;;OAGG;IACH,MAFU,MAAM,CAEQ;IAExB;;;OAGG;IACH,SAFU,MAAM,CAEA;IAEhB,yBAA4B;IAC5B,qBAAqB;IACrB,uBAAuB;IAG3B,oBAEC;IAED;;;;;;OAMG;IACH,uBAEC;IAED;;;;;;;;;OASG;IACH,mBAkBC;IAED;;;;;;OAMG;IACH,yBASC;IAED;;;;;;OAMG;IACH,0BAUC;IAED;;;;;OAKG;IACH,oBAIC;IAED;;;;;;OAMG;IACH,2BAUC;IAED;;;;;;;OAOG;IACH,2BALW,MAAM,kBACN,MAAM,OACN,MAAM,GACJ,MAAM,CAelB;IAED;;;;;;OAMG;IACH,0BALW,MAAM,kBACN,MAAM,OACN,MAAM,GACJ,OAAO,CAanB;IAED;;;;;;;;OAQG;IACH,wBAsBC;IAED;;;;;;;OAOG;IACH,gCAaC;IAED;;;;;OAKG;IACH,yCASC;IAED;;;;;;;;;;OAUG;IACH,mCAIC;IAED;;;;;OAKG;IACH,gCAWC;IAED;;;;;;;;;;;;;;;OAeG;IACH,aAJW,MAAM,GACJ,OAAO,CA8CnB;IAED,+BAcC;IAED;;;;;;;OAOG;IACH,sBAMC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,aAJW,MAAM,GACJ,OAAO,CA6BnB;IAGD;;;;;;OAMG;IACH,mBAHW,MAAM,GACJ,OAAO,CAUnB;CACJ;uBA/gBsB,qBAAqB"}
@@ -52,6 +52,9 @@ function createMaskFromBitCount(count) {
52
52
  }
53
53
 
54
54
  /**
55
+ * Space-efficient probabilistic data structure that allows testing whether a key is included in the set or not
56
+ * Provides definite "not in set" answer and a probabilistic "is in set" answer, certainty probability of which can be controlled
57
+ * @see https://en.wikipedia.org/wiki/Cuckoo_filter
55
58
  * @description Inspired by MGunlogson's CuckooFilter4J library
56
59
  */
57
60
  export class CuckooFilter {
@@ -454,10 +457,10 @@ export class CuckooFilter {
454
457
  */
455
458
  __checkVictim(i1, i2, tag) {
456
459
  return this.__victim_tag === tag
457
- && (
458
- this.__victim_index === i1
459
- || this.__victim_index === i2
460
- );
460
+ && (
461
+ this.__victim_index === i1
462
+ || this.__victim_index === i2
463
+ );
461
464
  }
462
465
 
463
466
  /**
@@ -520,7 +523,7 @@ export class CuckooFilter {
520
523
  const i2 = this.__compute_alt_bucket_index(i1, tag);
521
524
 
522
525
  return this.__findTag(i1, i2, tag)
523
- || (this.__victim_exists && this.__victim_tag === tag && (this.__victim_index === i1 || this.__victim_index === i2)) //check the victim
526
+ || (this.__victim_exists && this.__victim_tag === tag && (this.__victim_index === i1 || this.__victim_index === i2)) //check the victim
524
527
  ;
525
528
  }
526
529
  }
@@ -4,7 +4,7 @@
4
4
  * @readonly
5
5
  * @type {Uint32Array|{pointer:number}}
6
6
  */
7
- export const SCRATCH_UINT32_TRAVERSAL_STACK = new Uint32Array(781250);
7
+ export const SCRATCH_UINT32_TRAVERSAL_STACK = new Uint32Array(781250); // size is fairly arbitrary
8
8
 
9
9
  /**
10
10
  * Pointer used to track current top of the stack, make sure to unwind once your traversal is done
@@ -1 +1 @@
1
- {"version":3,"file":"is_typed_array_equals.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/is_typed_array_equals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,yCAJW,UAAU,GAAC,WAAW,KACtB,UAAU,GAAC,WAAW,GACpB,OAAO,CAkEnB"}
1
+ {"version":3,"file":"is_typed_array_equals.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/is_typed_array_equals.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,yCAJW,UAAU,GAAC,WAAW,KACtB,UAAU,GAAC,WAAW,GACpB,OAAO,CAmFnB"}
@@ -21,6 +21,14 @@ export function is_typed_array_equals(a, b) {
21
21
  return false;
22
22
  }
23
23
 
24
+ const a_constructor = a.constructor;
25
+ const b_constructor = b.constructor;
26
+
27
+ if (a_constructor !== b_constructor) {
28
+ // incompatible constructors
29
+ return false;
30
+ }
31
+
24
32
  if (a_length === 0) {
25
33
  // both arrays are empty
26
34
  return true;
@@ -37,20 +45,15 @@ export function is_typed_array_equals(a, b) {
37
45
  return false;
38
46
  }
39
47
 
40
- const a_constructor = a.constructor;
41
- const b_constructor = b.constructor;
42
-
43
- if (a_constructor !== b_constructor) {
44
- // incompatible constructors
45
- return false;
46
- }
47
-
48
48
 
49
49
  const a_buffer = a.buffer;
50
50
  const b_buffer = b.buffer;
51
51
 
52
52
  // check if buffers are the same
53
- if (a_buffer === b_buffer && a.byteOffset === b.byteOffset) {
53
+ const a_offset = a.byteOffset;
54
+ const b_offset = b.byteOffset;
55
+
56
+ if (a_buffer === b_buffer && a_offset === b_offset) {
54
57
  // using the same buffer and pointing to the same range within it
55
58
  return true;
56
59
  }
@@ -60,14 +63,28 @@ export function is_typed_array_equals(a, b) {
60
63
 
61
64
  const bytes_per_element = a_constructor.BYTES_PER_ELEMENT;
62
65
 
63
- if (bytes_per_element < 4 && byte_length % 4 === 0) {
66
+ if (
67
+ bytes_per_element < 4
68
+ && byte_length % 4 === 0
69
+ && a_offset % 4 === 0
70
+ && b_offset % 4 === 0
71
+ ) {
72
+
64
73
  // 4 byte alignment, can use uint32
65
- a_proxy = new Uint32Array(a_buffer, a.byteOffset, byte_length / 4);
66
- b_proxy = new Uint32Array(b_buffer, b.byteOffset, byte_length / 4);
67
- } else if (bytes_per_element < 2 && byte_length % 2 === 0) {
74
+ a_proxy = new Uint32Array(a_buffer, a_offset, byte_length >>> 2);
75
+ b_proxy = new Uint32Array(b_buffer, b_offset, byte_length >>> 2);
76
+
77
+ } else if (
78
+ bytes_per_element < 2
79
+ && byte_length % 2 === 0
80
+ && a_offset % 2 === 0
81
+ && b_offset % 2 === 0
82
+ ) {
83
+
68
84
  // 2 byte alignment, can use uint16
69
- a_proxy = new Uint16Array(a_buffer, a.byteOffset, byte_length / 2);
70
- b_proxy = new Uint16Array(b_buffer, b.byteOffset, byte_length / 2);
85
+ a_proxy = new Uint16Array(a_buffer, a_offset, byte_length >>> 1);
86
+ b_proxy = new Uint16Array(b_buffer, b_offset, byte_length >>> 1);
87
+
71
88
  }
72
89
 
73
90
  return isArrayEqualStrict(a_proxy, b_proxy);
@@ -0,0 +1,10 @@
1
+ /**
2
+ *
3
+ * @param {Uint32Array} array
4
+ * @param {number} offset
5
+ * @param {number} length
6
+ * @param {number} [sample_limit]
7
+ * @returns {number}
8
+ */
9
+ export function sparse_typed_array_hash(array: Uint32Array, offset: number, length: number, sample_limit?: number): number;
10
+ //# sourceMappingURL=sparse_typed_array_hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sparse_typed_array_hash.d.ts","sourceRoot":"","sources":["../../../../../../src/core/collection/array/typed/sparse_typed_array_hash.js"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,+CANW,WAAW,UACX,MAAM,UACN,MAAM,iBACN,MAAM,GACJ,MAAM,CAelB"}
@@ -0,0 +1,26 @@
1
+ import { min2 } from "../../../math/min2.js";
2
+ import { computeStridedArrayHash } from "../../../primitives/array/computeStridedArrayHash.js";
3
+ import { computeHashFloat } from "../../../primitives/numbers/computeHashFloat.js";
4
+
5
+ /**
6
+ *
7
+ * @param {Uint32Array} array
8
+ * @param {number} offset
9
+ * @param {number} length
10
+ * @param {number} [sample_limit]
11
+ * @returns {number}
12
+ */
13
+ export function sparse_typed_array_hash(array, offset, length, sample_limit = 31) {
14
+ // limit hash evaluation to first 1k of the data to random memory access and keep CPU cache usage more coherent
15
+ const hash_evaluation_length = min2(length, 1024);
16
+
17
+ // compute stride so that we don't have to iterate over the entire buffer, instead picking at most X(509) values to consider
18
+ const stride = Math.max(1, Math.ceil(hash_evaluation_length / sample_limit));
19
+
20
+ // TODO implement fast dedicated float and int paths
21
+
22
+ return computeStridedArrayHash(
23
+ array, 0, hash_evaluation_length, stride,
24
+ computeHashFloat
25
+ );
26
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"Deque.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Deque.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IA8BI;;;OAGG;IACH,uBAFW,MAAM,EAUhB;IAqFD;;;OAGG;IACH,WAFY,OAAO,CAIlB;IAED,cAeC;IAED;;OAEG;IACH,QAFa,MAAM,CAalB;IA+CD;;;;OAIG;IACH,UAHW,CAAC,GACC,OAAO,CAYnB;IA4BD;;;;OAIG;IACH,WAFa,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,CAAC,QAOX;IAED;;;OAGG;IACH,eAFa,CAAC,GAAC,SAAS,CAQvB;IAED;;;OAGG;IACH,YAFa,CAAC,GAAC,SAAS,CAIvB;IAED;;;OAGG;IACH,WAFW,CAAC,QAOX;IAED;;;OAGG;IACH,cAFa,CAAC,CASb;IAGD;;;OAGG;IACH,WAFa,CAAC,GAAC,SAAS,CAKvB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,CAAC,GAAC,SAAS,CAmBvB;IAED;;;;;OAKG;IACH,iBAJW,CAAC,EAAE,kBACH,MAAM,GACJ,CAAC,EAAE,CAUf;IAoBL,gBAAoB;IACpB,uBAAoB;IACpB,eAAmB;IAEnB;;OAEG;IACH,sBAAmB;IAzBf;;;OAGG;IACH,qBAFa,UAAU,CAAC,EAAC,IAAI,CAAC,CAS7B;;CACJ"}
1
+ {"version":3,"file":"Deque.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/queue/Deque.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IA8BI;;;OAGG;IACH,uBAFW,MAAM,EAUhB;IAuFD;;;OAGG;IACH,WAFY,OAAO,CAIlB;IAED,cAeC;IAED;;;OAGG;IACH,QAFa,MAAM,CAalB;IA+CD;;;;OAIG;IACH,UAHW,CAAC,GACC,OAAO,CAYnB;IA4BD;;;;OAIG;IACH,WAFa,OAAO,CAInB;IAED;;;OAGG;IACH,YAFW,CAAC,QAOX;IAED;;;OAGG;IACH,eAFa,CAAC,GAAC,SAAS,CAQvB;IAED;;;OAGG;IACH,YAFa,CAAC,GAAC,SAAS,CAIvB;IAED;;;OAGG;IACH,WAFW,CAAC,QAOX;IAED;;;OAGG;IACH,cAFa,CAAC,CASb;IAGD;;;OAGG;IACH,WAFa,CAAC,GAAC,SAAS,CAKvB;IAED;;;;OAIG;IACH,yBAHW,MAAM,GACJ,CAAC,GAAC,SAAS,CAmBvB;IAED;;;;;OAKG;IACH,iBAJW,CAAC,EAAE,kBACH,MAAM,GACJ,CAAC,EAAE,CAUf;IAoBL,gBAAoB;IACpB,uBAAoB;IACpB,eAAmB;IAEnB;;OAEG;IACH,sBAAmB;IAzBf;;;OAGG;IACH,qBAFa,UAAU,CAAC,EAAC,IAAI,CAAC,CAS7B;;CACJ"}
@@ -21,7 +21,7 @@ export class Deque {
21
21
  /**
22
22
  * Using static array allocator to preserve data locality.
23
23
  * Initialization via "[]" would give us a dynamically sized array,
24
- * but it would have unpredictable locality as array may or may not have it's elements stored next to each other in memory
24
+ * but it would have unpredictable locality as array may or may not have its elements stored next to each other in memory
25
25
  * @type {T[]}
26
26
  * @private
27
27
  */
@@ -112,9 +112,11 @@ export class Deque {
112
112
  const length = this.#data.length;
113
113
 
114
114
  if (UINT32_MAX === length) {
115
+ // array is already as big as it can get
115
116
  throw new Error('Maximum array size exceeded');
116
117
  }
117
118
 
119
+ // double existing length
118
120
  let new_length = length * 2;
119
121
 
120
122
  if (new_length > UINT32_MAX) {
@@ -169,6 +171,7 @@ export class Deque {
169
171
  }
170
172
 
171
173
  /**
174
+ * Number of elements in the collection
172
175
  * @returns {number}
173
176
  */
174
177
  size() {
@@ -13,10 +13,10 @@ export class RowFirstTableSpec {
13
13
  /**
14
14
  *
15
15
  * @param {BinaryDataType[]} types
16
- * @param {EndianType} [endianType]
16
+ * @param {EndianType} [endianness]
17
17
  * @constructor
18
18
  */
19
- constructor(types: BinaryDataType[], endianType?: EndianType);
19
+ constructor(types: BinaryDataType[], endianness?: EndianType);
20
20
  /**
21
21
  * @readonly
22
22
  * @type {BinaryDataType[]}
@@ -1 +1 @@
1
- {"version":3,"file":"RowFirstTableSpec.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTableSpec.js"],"names":[],"mappings":"AA+HA;;;GAGG;AACH;IAwGI;;;;;OAKG;IACH,kBAJW,cAAc,EAAE,eAChB,UAAU,GACR,iBAAiB,CAmB7B;IA9HD;;;;;OAKG;IACH,mBAJW,cAAc,EAAE,eAChB,UAAU,EAiEpB;IAzDG;;;OAGG;IACH,gBAFU,cAAc,EAAE,CAER;IAElB;;;OAGG;IACH,qBAFU,UAAU,CAEQ;IAE5B;;;OAGG;IACH,wBAFU,WAAW,CAEyB;IAc9C;;;OAGG;IACH,yBAFU,MAAM,CAEgB;IAEhC;;;OAGG;IACH,+BAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEA;IAEpD;;;OAGG;IACH,gCAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEC;IAIrD,mBAAsC;IACtC,mBAAsC;IAQ1C;;;OAGG;IACH,kBAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,QAFY,MAAM,CAQjB;IAED;;;;OAIG;IACH,cAHW,iBAAiB,GACf,OAAO,CAQnB;IA4BL;;;OAGG;IACH,8BAFU,OAAO,CAE8B;CAN9C;+BA3P8B,qCAAqC;2BADzC,4BAA4B"}
1
+ {"version":3,"file":"RowFirstTableSpec.d.ts","sourceRoot":"","sources":["../../../../../src/core/collection/table/RowFirstTableSpec.js"],"names":[],"mappings":"AA+HA;;;GAGG;AACH;IA4GI;;;;;OAKG;IACH,kBAJW,cAAc,EAAE,eAChB,UAAU,GACR,iBAAiB,CAmB7B;IAlID;;;;;OAKG;IACH,mBAJW,cAAc,EAAE,eAChB,UAAU,EAqEpB;IA5DG;;;OAGG;IACH,gBAFU,cAAc,EAAE,CAER;IAElB;;;OAGG;IACH,qBAFU,UAAU,CAEQ;IAE5B;;;OAGG;IACH,wBAFU,WAAW,CAEyB;IAiB9C;;;OAGG;IACH,yBAFU,MAAM,CAEgB;IAEhC;;;OAGG;IACH,+BAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEA;IAEpD;;;OAGG;IACH,gCAFmB,QAAQ,QAAE,MAAM,QAAE,MAAM,EAAE,KAAG,IAAI,CAEC;IAIrD,mBAAsC;IACtC,mBAAsC;IAQ1C;;;OAGG;IACH,kBAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,QAFY,MAAM,CAQjB;IAED;;;;OAIG;IACH,cAHW,iBAAiB,GACf,OAAO,CAQnB;IA4BL;;;OAGG;IACH,8BAFU,OAAO,CAE8B;CAN9C;+BA/P8B,qCAAqC;2BADzC,4BAA4B"}
@@ -133,11 +133,12 @@ export class RowFirstTableSpec {
133
133
  /**
134
134
  *
135
135
  * @param {BinaryDataType[]} types
136
- * @param {EndianType} [endianType]
136
+ * @param {EndianType} [endianness]
137
137
  * @constructor
138
138
  */
139
- constructor(types, endianType = EndianType.BigEndian) {
139
+ constructor(types, endianness = EndianType.BigEndian) {
140
140
  assert.isArray(types, 'types');
141
+ assert.enum(endianness, EndianType, 'endianness');
141
142
 
142
143
  const numTypes = types.length;
143
144
 
@@ -151,7 +152,7 @@ export class RowFirstTableSpec {
151
152
  * @readonly
152
153
  * @type {EndianType}
153
154
  */
154
- this.endianType = endianType;
155
+ this.endianType = endianness;
155
156
 
156
157
  /**
157
158
  * @readonly
@@ -163,6 +164,9 @@ export class RowFirstTableSpec {
163
164
 
164
165
  for (let index = 0; index < numTypes; index++) {
165
166
  const type = types[index];
167
+
168
+ assert.enum(type, BinaryDataType, `type[${index}]`);
169
+
166
170
  this.columnOffsets[index] = byteOffset;
167
171
 
168
172
  const columnByteSize = DataTypeByteSizes[type];
@@ -181,13 +185,13 @@ export class RowFirstTableSpec {
181
185
  * @readonly
182
186
  * @type {function(DataView, number, number[]): void}
183
187
  */
184
- this.readRowMethod = genRowReader(types, endianType);
188
+ this.readRowMethod = genRowReader(types, endianness);
185
189
 
186
190
  /**
187
191
  * @readonly
188
192
  * @type {function(DataView, number, number[]): void}
189
193
  */
190
- this.writeRowMethod = genRowWriter(types, endianType);
194
+ this.writeRowMethod = genRowWriter(types, endianness);
191
195
 
192
196
 
193
197
  //generate cell readers/writers
@@ -195,8 +199,8 @@ export class RowFirstTableSpec {
195
199
  this.cellReaders = new Array(numTypes);
196
200
 
197
201
  for (let i = 0; i < numTypes; i++) {
198
- this.cellReaders[i] = compileDataViewValueReader(types[i], this.columnOffsets[i], endianType);
199
- this.cellWriters[i] = compileDataViewValueWriter(types[i], this.columnOffsets[i], endianType);
202
+ this.cellReaders[i] = compileDataViewValueReader(types[i], this.columnOffsets[i], endianness);
203
+ this.cellWriters[i] = compileDataViewValueWriter(types[i], this.columnOffsets[i], endianness);
200
204
  }
201
205
  }
202
206
 
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  *
3
- * @param {number[]|vec3} result
4
- * @param {number[]} vA
5
- * @param {number[]} vB
6
- * @param {number[]} vC
3
+ * @param {number[]|vec3|Float32Array|Float64Array} result
4
+ * @param {number[]|vec3|Float32Array|Float64Array} vA
5
+ * @param {number[]|vec3|Float32Array|Float64Array} vB
6
+ * @param {number[]|vec3|Float32Array|Float64Array} vC
7
7
  */
8
- export function compute_triangle_normal(result: number[] | vec3, vA: number[], vB: number[], vC: number[]): void;
8
+ export function compute_triangle_normal(result: number[] | vec3 | Float32Array | Float64Array, vA: number[] | vec3 | Float32Array | Float64Array, vB: number[] | vec3 | Float32Array | Float64Array, vC: number[] | vec3 | Float32Array | Float64Array): void;
9
9
  //# sourceMappingURL=compute_triangle_normal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compute_triangle_normal.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/compute_triangle_normal.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,gDALW,MAAM,EAAE,OAAK,MACb,MAAM,EAAE,MACR,MAAM,EAAE,MACR,MAAM,EAAE,QAiBlB"}
1
+ {"version":3,"file":"compute_triangle_normal.d.ts","sourceRoot":"","sources":["../../../../../src/core/geom/3d/compute_triangle_normal.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,gDALW,MAAM,EAAE,UAAM,YAAY,GAAC,YAAY,MACvC,MAAM,EAAE,UAAM,YAAY,GAAC,YAAY,MACvC,MAAM,EAAE,UAAM,YAAY,GAAC,YAAY,MACvC,MAAM,EAAE,UAAM,YAAY,GAAC,YAAY,QAiBjD"}
@@ -2,10 +2,10 @@ import { v3_compute_triangle_normal } from "./v3_compute_triangle_normal.js";
2
2
 
3
3
  /**
4
4
  *
5
- * @param {number[]|vec3} result
6
- * @param {number[]} vA
7
- * @param {number[]} vB
8
- * @param {number[]} vC
5
+ * @param {number[]|vec3|Float32Array|Float64Array} result
6
+ * @param {number[]|vec3|Float32Array|Float64Array} vA
7
+ * @param {number[]|vec3|Float32Array|Float64Array} vB
8
+ * @param {number[]|vec3|Float32Array|Float64Array} vC
9
9
  */
10
10
  export function compute_triangle_normal(result, vA, vB, vC) {
11
11
 
@@ -9,7 +9,7 @@ export function roundFair(number, random) {
9
9
  const mantissa = number % 1;
10
10
  const roll = random();
11
11
 
12
- if (roll < mantissa) {
12
+ if (roll > mantissa) {
13
13
  return Math.floor(number);
14
14
  } else {
15
15
  return Math.ceil(number);
@@ -1 +1 @@
1
- {"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/AssetManager.js"],"names":[],"mappings":"AA4CA;;;;GAIG;AACH;IAgII;;;;;OAKG;IACH,oCAJW,GAAG,EAYb;IA7ID;;;;OAIG;IACH,eAEG;IAEH;;;OAGG;IACH,aAFU,YAAY,gBAAgB,EAAE,YAAY,CAAC,CAER;IAe7C;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IAyB5B;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,mBAFU,iBAAiB,CAEiB;IAwE5C,gBAQC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACL,QAAQ,IAAI,CAAC,CAexB;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAOnB;IAED;;OAEG;IACH,cAEC;IAED,8BAEC;IAED;;;;;;OAMG;IACH,4DAJW,iBAAiB,GAEf,cAAc,CAY1B;IAED;;;;;;;;;OASG;IACH,qFAsCC;IAED;;;;;OAKG;IACH,aAJW,MAAM,QACN,MAAM,sBAehB;IA2QD;;;;;OAKG;IACH,sBA2BC;IAGD;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,CAIlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,wBAAY,SAAS,CAMjC;IAaD;;;;OAIG;IACH,+BAHW,MAAM,4CAqBhB;IAED;;;;OAIG;IACH,iCAHW,MAAM,+CAyBhB;IAED;;;;;;OAMG;IACH,6BAJW,MAAM,kCAEJ,QAAQ,OAAO,CAAC,CAU5B;IAED;;;;;OAKG;IACH,0BAJW,MAAM,iEAwChB;IAED;;;OAGG;IACH,uBAFW,MAAM,iBAkBhB;IAED;;;;;;OAMG;IACH,yCAFa,aAAS,IAAI,CAYzB;IAED;;;;;OAKG;IACH,eAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAMnB;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACL,mBAAiB,CAa5B;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACL,gBAAgB,GAAC,SAAS,CAQrC;IAED;;;;;OAKG;IACH,mBAJW,MAAM,QACN,MAAM,QACN,MAAM,QAUhB;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;;CANpC;4BA72B2B,0CAA0C;iCAOrC,uBAAuB;6BAM3B,mBAAmB;kCAFd,6BAA6B;kCAD7B,wBAAwB;4BAE9B,0BAA0B"}
1
+ {"version":3,"file":"AssetManager.d.ts","sourceRoot":"","sources":["../../../../src/engine/asset/AssetManager.js"],"names":[],"mappings":"AA8CA;;;;GAIG;AACH;IAgII;;;;;OAKG;IACH,oCAJW,GAAG,EAYb;IA7ID;;;;OAIG;IACH,eAEG;IAEH;;;OAGG;IACH,aAFU,YAAY,gBAAgB,EAAE,YAAY,CAAC,CAER;IAe7C;;;;;;OAMG;IACH,kBAFU,MAAM,CAEY;IAyB5B;;;;OAIG;IACH,iBAAc;IAEd;;;OAGG;IACH,mBAFU,iBAAiB,CAEiB;IAwE5C,gBAQC;IAED;;;;OAIG;IACH,qBAHW,MAAM,GACL,QAAQ,IAAI,CAAC,CAexB;IAED;;;;;OAKG;IACH,oCAFa,OAAO,CAOnB;IAED;;OAEG;IACH,cAEC;IAED,8BAEC;IAED;;;;;;OAMG;IACH,4DAJW,iBAAiB,GAEf,cAAc,CAY1B;IAED;;;;;;;;;OASG;IACH,qFAsCC;IAED;;;;;OAKG;IACH,aAJW,MAAM,QACN,MAAM,sBAehB;IA2QD;;;;;OAKG;IACH,sBA2BC;IAGD;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,CAIlB;IAED;;;;OAIG;IACH,sBAHW,MAAM,GACJ,wBAAY,SAAS,CAMjC;IAaD;;;;OAIG;IACH,+BAHW,MAAM,4CAqBhB;IAED;;;;OAIG;IACH,iCAHW,MAAM,+CAyBhB;IAED;;;;;;OAMG;IACH,6BAJW,MAAM,kCAEJ,QAAQ,OAAO,CAAC,CAU5B;IAED;;;;;OAKG;IACH,0BAJW,MAAM,iEAwChB;IAED;;;OAGG;IACH,uBAFW,MAAM,iBAkBhB;IAED;;;;;;OAMG;IACH,yCAFa,aAAS,IAAI,CAYzB;IAED;;;;;OAKG;IACH,eAJW,MAAM,QACN,MAAM,GACJ,OAAO,CAMnB;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACL,mBAAiB,CAa5B;IAED;;;;OAIG;IACH,oBAHW,MAAM,GACL,gBAAgB,GAAC,SAAS,CAQrC;IAED;;;;;OAKG;IACH,mBAJW,MAAM,QACN,MAAM,QACN,MAAM,QAUhB;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;;CANpC;4BA/2B2B,0CAA0C;iCAOrC,uBAAuB;6BAM3B,mBAAmB;kCAFd,6BAA6B;kCAD7B,wBAAwB;4BAE9B,0BAA0B"}
@@ -42,6 +42,8 @@ function get_pending_asset_priority_score(pending_asset) {
42
42
  }
43
43
 
44
44
 
45
+ // TODO handle 429 HTTP error gracefully
46
+
45
47
  /**
46
48
  * Handles loading/generating assets
47
49
  * @template CTX
@@ -1 +1 @@
1
- {"version":3,"file":"computeBufferAttributeHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,sDAHW,MAAM,eAAe,GACnB,MAAM,CAyBlB"}
1
+ {"version":3,"file":"computeBufferAttributeHash.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/geometry/buffered/computeBufferAttributeHash.js"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,sDAHW,MAAM,eAAe,GACnB,MAAM,CAgBlB"}
@@ -1,6 +1,4 @@
1
- import { min2 } from "../../../../core/math/min2.js";
2
- import { computeStridedArrayHash } from "../../../../core/primitives/array/computeStridedArrayHash.js";
3
- import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
1
+ import { sparse_typed_array_hash } from "../../../../core/collection/array/typed/sparse_typed_array_hash.js";
4
2
 
5
3
  /**
6
4
  *
@@ -16,16 +14,7 @@ export function computeBufferAttributeHash(attribute) {
16
14
 
17
15
  result += data_size;
18
16
 
19
- // limit hash evaluation to first 1k of the data to random memory access and keep CPU cache usage more coherent
20
- const hash_evaluation_length = min2(data_size, 1024);
21
-
22
- // compute stride so that we don't have to iterate over the entire buffer, instead picking at most X(509) values to consider
23
- const stride = Math.max(1, Math.ceil(hash_evaluation_length / 31));
24
-
25
- result ^= computeStridedArrayHash(
26
- data, 0, hash_evaluation_length, stride,
27
- computeHashFloat
28
- );
17
+ result ^= sparse_typed_array_hash(data, 0, data_size);
29
18
 
30
19
  }
31
20