@woosh/meep-engine 2.104.0 → 2.106.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 (30) 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 +131 -85
  4. package/build/meep.min.js +1 -1
  5. package/build/meep.module.js +131 -85
  6. package/editor/tools/v2/BlenderCameraOrientationGizmo.js +1 -1
  7. package/package.json +1 -1
  8. package/src/core/assert.d.ts.map +1 -1
  9. package/src/core/assert.js +3 -1
  10. package/src/core/bvh2/bvh3/build_triangle_morton_codes.d.ts +1 -1
  11. package/src/core/bvh2/bvh3/build_triangle_morton_codes.d.ts.map +1 -1
  12. package/src/core/bvh2/bvh3/build_triangle_morton_codes.js +3 -1
  13. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts +1 -0
  14. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.d.ts.map +1 -1
  15. package/src/core/bvh2/bvh3/ebvh_build_hierarchy.js +3 -2
  16. package/src/core/cache/Cache.d.ts +2 -1
  17. package/src/core/cache/Cache.d.ts.map +1 -1
  18. package/src/core/cache/Cache.js +68 -41
  19. package/src/core/cache/Cache.spec.js +42 -0
  20. package/src/core/cache/CacheElement.d.ts +1 -0
  21. package/src/core/cache/CacheElement.d.ts.map +1 -1
  22. package/src/core/cache/CacheElement.js +4 -0
  23. package/src/core/codegen/LineBuilder.d.ts +1 -24
  24. package/src/core/codegen/LineBuilder.d.ts.map +1 -1
  25. package/src/core/codegen/LineBuilder.js +19 -15
  26. package/src/core/collection/map/HashMap.d.ts.map +1 -1
  27. package/src/core/collection/map/HashMap.js +48 -30
  28. package/src/core/model/node-graph/NodeGraph.js +2 -2
  29. package/src/engine/graphics/ecs/mesh/Mesh.js +1 -1
  30. package/src/engine/graphics/geometry/buffered/query/GeometrySpatialQueryAccelerator.js +1 -1
@@ -249,7 +249,9 @@ class InMemoryDescriptor extends BaseDescription {
249
249
 
250
250
  function equal(a, b, m) {
251
251
  if (a !== b) {
252
- const message = m !== undefined ? m : `${a} !== ${b}`;
252
+ const details = `${a} !== ${b}`;
253
+
254
+ const message = (m !== undefined && m !== "") ? `${m}. ${details}` : details;
253
255
  throw new Error(message);
254
256
  }
255
257
  }
@@ -60003,28 +60005,6 @@ const RESERVED_HASH_SUBSTITUTE = 0;
60003
60005
  const UNDEFINED_BIN_INDEX = ~0;
60004
60006
 
60005
60007
 
60006
- /**
60007
- * @template K,V
60008
- * @param {HashMapEntry<K,V>} record
60009
- * @param {number} hash
60010
- * @param {K} key
60011
- * @param {function(a:K,b:K):boolean} equality_op
60012
- */
60013
- function entry_equality_check(record, hash, key, equality_op) {
60014
- if (record.hash !== hash) {
60015
- return false;
60016
- }
60017
-
60018
- if (record.key === key) {
60019
- return true;
60020
- }
60021
-
60022
- const result = equality_op(record.key, key);
60023
-
60024
- return result;
60025
- }
60026
-
60027
-
60028
60008
  const EMPTY_BINS = new Uint32Array(0);
60029
60009
 
60030
60010
  /**
@@ -60092,6 +60072,10 @@ class HashMap {
60092
60072
  */
60093
60073
  #load_factor = DEFAULT_LOAD_FACTOR;
60094
60074
 
60075
+ /**
60076
+ * Used to track modifications to prevent concurrent changes during iteration
60077
+ * @type {number}
60078
+ */
60095
60079
  #version = 0;
60096
60080
 
60097
60081
  /**
@@ -60157,6 +60141,8 @@ class HashMap {
60157
60141
  this.#bin_count = 2 ** this.#bin_count_power_of_two;
60158
60142
  this.#bin_count_mask = this.#bin_count - 1;
60159
60143
 
60144
+ const old_entry_allocation_count = this.#entries_allocated_count;
60145
+
60160
60146
  this.#entries_allocated_count = 2 ** this.#entries_count_power_of_two;
60161
60147
 
60162
60148
  const BinsArray = UintArrayForCount(this.#entries_allocated_count + ENTRY_BASE);
@@ -60168,7 +60154,7 @@ class HashMap {
60168
60154
 
60169
60155
  this.#entries = new_entries;
60170
60156
 
60171
- array_copy(old_entries, 0, new_entries, 0, min2(old_entries.length, this.#entries_allocated_count));
60157
+ array_copy(old_entries, 0, new_entries, 0, min2(old_entry_allocation_count, this.#entries_allocated_count));
60172
60158
 
60173
60159
  if (this.#size > 0) {
60174
60160
  // re-hash
@@ -60204,6 +60190,25 @@ class HashMap {
60204
60190
  return original === RESERVED_HASH ? RESERVED_HASH_SUBSTITUTE : original;
60205
60191
  }
60206
60192
 
60193
+ /**
60194
+ * @param {HashMapEntry<K,V>} record
60195
+ * @param {number} hash
60196
+ * @param {K} key
60197
+ */
60198
+ #entry_equality_check(record, hash, key) {
60199
+ if (record.hash !== hash) {
60200
+ return false;
60201
+ }
60202
+
60203
+ if (record.key === key) {
60204
+ return true;
60205
+ }
60206
+
60207
+ const result = this.keyEqualityFunction(record.key, key);
60208
+
60209
+ return result;
60210
+ }
60211
+
60207
60212
  /**
60208
60213
  *
60209
60214
  * @param {K} k
@@ -60219,6 +60224,7 @@ class HashMap {
60219
60224
 
60220
60225
  if (this.#entries[i] !== undefined) {
60221
60226
  const entry = this.#entries[i];
60227
+
60222
60228
  entry.hash = hash;
60223
60229
  entry.key = k;
60224
60230
  entry.value = v;
@@ -60279,11 +60285,12 @@ class HashMap {
60279
60285
  // check if it's the entry that we're looking for
60280
60286
  const entry = this.#entries[bin - ENTRY_BASE];
60281
60287
 
60282
- if (entry_equality_check(entry, raw_hash, key, this.keyEqualityFunction)) {
60288
+ if (this.#entry_equality_check(entry, raw_hash, key)) {
60283
60289
  // found the right entry
60284
60290
  entry.value = value;
60285
60291
  return;
60286
60292
  }
60293
+
60287
60294
  } else if (bin === BIN_RESERVED_VALUE_EMPTY) {
60288
60295
  // bin is empty
60289
60296
 
@@ -60294,7 +60301,9 @@ class HashMap {
60294
60301
 
60295
60302
  const entry_index = this.#allocate_entry(key, value, raw_hash);
60296
60303
 
60297
- this.#bins[bin_index] = entry_index + ENTRY_BASE;
60304
+ const bin_value = entry_index + ENTRY_BASE;
60305
+
60306
+ this.#bins[bin_index] = bin_value;
60298
60307
 
60299
60308
  break;
60300
60309
 
@@ -60342,7 +60351,7 @@ class HashMap {
60342
60351
  // check if the entry is what we're looking for
60343
60352
  const entry = this.#entries[bin - ENTRY_BASE];
60344
60353
 
60345
- if (entry_equality_check(entry, raw_hash, key, this.keyEqualityFunction)) {
60354
+ if (this.#entry_equality_check(entry, raw_hash, key)) {
60346
60355
  // found the right entry
60347
60356
  return entry.value;
60348
60357
  }
@@ -60442,7 +60451,7 @@ class HashMap {
60442
60451
  const entry_index = bin - ENTRY_BASE;
60443
60452
  const entry = entries[entry_index];
60444
60453
 
60445
- if (entry_equality_check(entry, raw_hash, key, this.keyEqualityFunction)) {
60454
+ if (this.#entry_equality_check(entry, raw_hash, key)) {
60446
60455
  // found the right entry
60447
60456
 
60448
60457
  // record entry as dead
@@ -60524,7 +60533,11 @@ class HashMap {
60524
60533
 
60525
60534
  let written_entries = 0;
60526
60535
 
60527
- for (let existing_entry_index = this.#entries_start; existing_entry_index < entries_bound; existing_entry_index++) {
60536
+ for (
60537
+ let existing_entry_index = this.#entries_start;
60538
+ existing_entry_index < entries_bound;
60539
+ existing_entry_index++
60540
+ ) {
60528
60541
  const entry = entries[existing_entry_index];
60529
60542
 
60530
60543
  const hash = entry.hash;
@@ -60776,16 +60789,27 @@ class CacheElement {
60776
60789
  next.previous = previous;
60777
60790
  }
60778
60791
  }
60792
+
60793
+ toString() {
60794
+ return `CacheElement{ hasNext:${this.next !== null}, hasPrevious:${this.previous !== null}, weight:${this.weight}, key:${this.key}, value:${this.value} }`;
60795
+ }
60779
60796
  }
60780
60797
 
60781
- // TODO validate hashes of held elements to keep them up to date. Keys are assumed to be immutable, but this assumption may be broken by users
60782
-
60783
60798
  /**
60784
60799
  * Hash-based cache, uses LRU (least-recently-used) eviction policy
60800
+ * Make sure that keys being used are truly immutable when it comes to hash and equality calculation, otherwise cache corruption is inevitable
60785
60801
  * @template Key, Value
60786
60802
  * @extends Map<Key,Value>
60787
60803
  */
60788
60804
  class Cache {
60805
+ #maxWeight = Number.POSITIVE_INFINITY;
60806
+ /**
60807
+ *
60808
+ * @type {number}
60809
+ * @private
60810
+ */
60811
+ #weight = 0;
60812
+
60789
60813
  /**
60790
60814
  * @param {number} [maxWeight=Number.POSITIVE_INFINITY]
60791
60815
  * @param {function(key:Key):number} [keyWeigher= key=>0]
@@ -60809,14 +60833,8 @@ class Cache {
60809
60833
  * @type {number}
60810
60834
  * @private
60811
60835
  */
60812
- this.maxWeight = maxWeight;
60836
+ this.#maxWeight = maxWeight;
60813
60837
 
60814
- /**
60815
- *
60816
- * @type {number}
60817
- * @private
60818
- */
60819
- this.weight = 0;
60820
60838
 
60821
60839
  /**
60822
60840
  *
@@ -60917,18 +60935,37 @@ class Cache {
60917
60935
  return this.data.size;
60918
60936
  }
60919
60937
 
60938
+ /**
60939
+ * @deprecated use {@link maxWeight} directly instead
60940
+ */
60941
+ setMaxWeight(value) {
60942
+ this.maxWeight = value;
60943
+ }
60944
+
60945
+ /**
60946
+ * Total weight of all elements currently in the cache
60947
+ * @returns {number}
60948
+ */
60949
+ get weight() {
60950
+ return this.#weight;
60951
+ }
60952
+
60920
60953
  /**
60921
60954
  * Will cause evictions if current weight is smaller than what we're setting
60922
60955
  * @param {number} value
60923
60956
  */
60924
- setMaxWeight(value) {
60957
+ set maxWeight(value) {
60925
60958
  if (typeof value !== "number" || value < 0) {
60926
60959
  throw new Error(`Weight must be a non-negative number, instead was '${value}'`);
60927
60960
  }
60928
60961
 
60929
- this.maxWeight = value;
60962
+ this.#maxWeight = value;
60930
60963
 
60931
- this.evictUntilWeight(this.maxWeight);
60964
+ this.evictUntilWeight(this.#maxWeight);
60965
+ }
60966
+
60967
+ get maxWeight() {
60968
+ return this.#maxWeight;
60932
60969
  }
60933
60970
 
60934
60971
  /**
@@ -60947,7 +60984,8 @@ class Cache {
60947
60984
  result += weight;
60948
60985
  }
60949
60986
 
60950
- this.weight = result;
60987
+ this.#weight = result;
60988
+ this.evictUntilWeight(this.#maxWeight);
60951
60989
  }
60952
60990
 
60953
60991
  /**
@@ -60977,13 +61015,13 @@ class Cache {
60977
61015
 
60978
61016
  const delta_weight = new_weight - old_weight;
60979
61017
 
60980
- this.weight += delta_weight;
61018
+ this.#weight += delta_weight;
60981
61019
 
60982
61020
  if (
60983
- this.weight > this.maxWeight
60984
- && new_weight <= this.maxWeight //make it less likely to drop entire cache
61021
+ this.#weight > this.#maxWeight
61022
+ && new_weight <= this.#maxWeight //make it less likely to drop entire cache
60985
61023
  ) {
60986
- this.evictUntilWeight(this.maxWeight);
61024
+ this.evictUntilWeight(this.#maxWeight);
60987
61025
  }
60988
61026
 
60989
61027
  return true;
@@ -61039,7 +61077,7 @@ class Cache {
61039
61077
 
61040
61078
  const target = Math.max(targetWeight, 0);
61041
61079
 
61042
- while (this.weight > target) {
61080
+ while (this.#weight > target) {
61043
61081
  this.evictOne();
61044
61082
  }
61045
61083
  }
@@ -61053,6 +61091,22 @@ class Cache {
61053
61091
  let element = this.data.get(key);
61054
61092
 
61055
61093
  if (element === undefined) {
61094
+ //compute weight
61095
+ const elementWeight = this.computeElementWeight(key, value);
61096
+
61097
+ /**
61098
+ * It's possible that element being added is larger than cache's capacity,
61099
+ * in which case entire cache will be evicted, but there still won't be enough space
61100
+ * @type {number}
61101
+ */
61102
+ const weightTarget = this.#maxWeight - elementWeight;
61103
+
61104
+ if (weightTarget < 0) {
61105
+ // Special case
61106
+ // element does not fit into cache, attempting to insert it forcibly would result in a full flush and overflow
61107
+ return;
61108
+ }
61109
+
61056
61110
  element = new CacheElement();
61057
61111
 
61058
61112
  element.key = key;
@@ -61070,25 +61124,8 @@ class Cache {
61070
61124
  this.__last = element;
61071
61125
  }
61072
61126
 
61073
- //compute weight
61074
- const elementWeight = this.computeElementWeight(key, value);
61075
-
61076
61127
  element.weight = elementWeight;
61077
61128
 
61078
-
61079
- /**
61080
- * It's possible that element being added is larger than cache's capacity,
61081
- * in which case entire cache will be evicted, but there still won't be enough space
61082
- * @type {number}
61083
- */
61084
- const weightTarget = this.maxWeight - elementWeight;
61085
-
61086
- if (weightTarget < 0) {
61087
- // Special case
61088
- // element does not fit into cache, attempting to insert it forcibly would result in a full flush and overflow
61089
- return;
61090
- }
61091
-
61092
61129
  //evict elements until there is enough space for the element
61093
61130
  this.evictUntilWeight(weightTarget);
61094
61131
 
@@ -61096,14 +61133,19 @@ class Cache {
61096
61133
  this.data.set(key, element);
61097
61134
 
61098
61135
  //update weight
61099
- this.weight += elementWeight;
61136
+ this.#weight += elementWeight;
61100
61137
  } else {
61101
61138
  // check if value is the same
61102
61139
  if (value === element.value) ; else {
61103
61140
  // replace value, adjust weight
61104
- this.weight -= this.valueWeigher(element.value);
61105
- this.weight += this.valueWeigher(value);
61141
+ this.#weight -= element.weight;
61106
61142
 
61143
+ const elementWeight = this.computeElementWeight(key, value);
61144
+
61145
+ this.#weight += elementWeight;
61146
+
61147
+ // assign new values
61148
+ element.weight = elementWeight;
61107
61149
  element.value = value;
61108
61150
  }
61109
61151
 
@@ -61188,7 +61230,7 @@ class Cache {
61188
61230
  this.data.delete(key);
61189
61231
 
61190
61232
  //update weight
61191
- this.weight -= element.weight;
61233
+ this.#weight -= element.weight;
61192
61234
  }
61193
61235
 
61194
61236
  /**
@@ -61260,7 +61302,7 @@ class Cache {
61260
61302
  this.__first = null;
61261
61303
  this.__last = null;
61262
61304
 
61263
- this.weight = 0;
61305
+ this.#weight = 0;
61264
61306
  }
61265
61307
 
61266
61308
  /**
@@ -63121,12 +63163,14 @@ class LineBuilder {
63121
63163
  *
63122
63164
  * @type {Line[]}
63123
63165
  */
63124
- lines = [];
63166
+ #lines = [];
63167
+
63125
63168
  /**
63126
63169
  *
63127
63170
  * @type {number}
63128
63171
  */
63129
- indentation = 0;
63172
+ #indentation = 0;
63173
+
63130
63174
  /**
63131
63175
  *
63132
63176
  * @type {number}
@@ -63138,7 +63182,7 @@ class LineBuilder {
63138
63182
  * @return {number}
63139
63183
  */
63140
63184
  get count() {
63141
- return this.lines.length;
63185
+ return this.#lines.length;
63142
63186
  }
63143
63187
 
63144
63188
  /**
@@ -63147,7 +63191,7 @@ class LineBuilder {
63147
63191
  * @param {string} term
63148
63192
  */
63149
63193
  containsSubstring(term) {
63150
- const lines = this.lines;
63194
+ const lines = this.#lines;
63151
63195
  const n = lines.length;
63152
63196
  for (let i = 0; i < n; i++) {
63153
63197
  const line = lines[i];
@@ -63167,7 +63211,7 @@ class LineBuilder {
63167
63211
  * @returns {LineBuilder}
63168
63212
  */
63169
63213
  indent() {
63170
- this.indentation++;
63214
+ this.#indentation++;
63171
63215
  return this;
63172
63216
  }
63173
63217
 
@@ -63176,7 +63220,7 @@ class LineBuilder {
63176
63220
  * @returns {LineBuilder}
63177
63221
  */
63178
63222
  dedent() {
63179
- this.indentation--;
63223
+ this.#indentation--;
63180
63224
  return this;
63181
63225
  }
63182
63226
 
@@ -63187,9 +63231,9 @@ class LineBuilder {
63187
63231
  */
63188
63232
  add(line_text) {
63189
63233
 
63190
- const line = new Line(line_text, this.indentation);
63234
+ const line = new Line(line_text, this.#indentation);
63191
63235
 
63192
- this.lines.push(line);
63236
+ this.#lines.push(line);
63193
63237
 
63194
63238
  return this;
63195
63239
  }
@@ -63200,23 +63244,23 @@ class LineBuilder {
63200
63244
  */
63201
63245
  addLines(lines) {
63202
63246
 
63203
- const other_lines = lines.lines;
63247
+ const other_lines = lines.#lines;
63204
63248
 
63205
63249
  const other_line_count = other_lines.length;
63206
63250
 
63207
63251
  for (let i = 0; i < other_line_count; i++) {
63208
63252
  const otherLine = other_lines[i];
63209
63253
 
63210
- const line = new Line(otherLine.text, otherLine.indentation + this.indentation);
63254
+ const line = new Line(otherLine.text, otherLine.indentation + this.#indentation);
63211
63255
 
63212
- this.lines.push(line);
63256
+ this.#lines.push(line);
63213
63257
  }
63214
63258
 
63215
63259
  }
63216
63260
 
63217
63261
  clear() {
63218
- this.lines = [];
63219
- this.indentation = 0;
63262
+ this.#lines = [];
63263
+ this.#indentation = 0;
63220
63264
  }
63221
63265
 
63222
63266
  /**
@@ -63228,7 +63272,7 @@ class LineBuilder {
63228
63272
 
63229
63273
  let i, j, l;
63230
63274
 
63231
- const lines = this.lines;
63275
+ const lines = this.#lines;
63232
63276
 
63233
63277
  for (i = 0, l = lines.length; i < l; i++) {
63234
63278
  const line = lines[i];
@@ -63261,7 +63305,9 @@ class LineBuilder {
63261
63305
 
63262
63306
  for (let i = 0; i < n; i++) {
63263
63307
 
63264
- r.add(lines[i]);
63308
+ const line_text = lines[i];
63309
+
63310
+ r.add(line_text);
63265
63311
 
63266
63312
  }
63267
63313
 
@@ -66275,7 +66321,7 @@ class GeometrySpatialQueryAccelerator {
66275
66321
  * @param {number} value in bytes
66276
66322
  */
66277
66323
  set cache_size(value) {
66278
- this.cache.setMaxWeight(value);
66324
+ this.cache.maxWeight = value;
66279
66325
  }
66280
66326
 
66281
66327
  /**
@@ -208,7 +208,7 @@ export class BlenderCameraOrientationGizmo extends CanvasView {
208
208
  direction: new Vector3(0, 0, -1),
209
209
  size: this.options.bubbleSizeSecondary,
210
210
  style: this.options.axisStyles.nz,
211
- label: "-Y",
211
+ label: "-Z",
212
212
  labelHideUnselected: true,
213
213
  primary: false
214
214
  },
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.104.0",
8
+ "version": "2.106.0",
9
9
  "main": "build/meep.module.js",
10
10
  "module": "build/meep.module.js",
11
11
  "exports": {
@@ -1 +1 @@
1
- {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/core/assert.js"],"names":[],"mappings":"AA6BA,6CAIC;;IAsJD;;;;;OAKG;IACH,kEAQC;;;;;;;;;;;;;;;IAmBD;;;;;;OAMG;IACH,uGAGC;IAGD;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,2DAMC;IAED;;;;OAIG;IACH,4DAMC;IAED;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,2DAMC;IAED;;;;OAIG;IACH,sEAMC;IAED;;;;OAIG;IACH,4DAKC;IAED;;;;OAIG;IACH,+EAKC;IAGD;;;;OAIG;IACH,yDAMC;IAED;;;;OAIG;IACH,wDAIC;IAED;;;;OAIG;IACH,yDAMC;IAED;;;;OAIG;IACH,2DAIC;IAED;;;;OAIG;IACH,mEAIC;IAED;;;;;OAKG;IACH,2EAgBC;;AA/ZD,wDAEC;AAED,6CAEC;AAbD,qDAKC;AAUD;;;;;GAKG;AACH,kCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAIhB;AAQD;;;;;GAKG;AACH,gCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAyBD;;;;;GAKG;AACH,uCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AA5CD;;;;;GAKG;AACH,6BAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAyBD;;;;;GAKG;AACH,oCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAKD;;;;;GAKG;AACH,0CAHW,MAAM,cACN,MAAM,QAehB;AAED;;;;;GAKG;AACH,iEAFW,MAAM,QAIhB;AAED;;;;;GAKG;AACH,mEAFW,MAAM,QAIhB;AAED;;;;;GAKG;AACH,+IAFW,MAAM,QAMhB"}
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/core/assert.js"],"names":[],"mappings":"AA+BA,6CAIC;;IAsJD;;;;;OAKG;IACH,kEAQC;;;;;;;;;;;;;;;IAmBD;;;;;;OAMG;IACH,uGAGC;IAGD;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,2DAMC;IAED;;;;OAIG;IACH,4DAMC;IAED;;;;OAIG;IACH,0DAMC;IAED;;;;OAIG;IACH,2DAMC;IAED;;;;OAIG;IACH,sEAMC;IAED;;;;OAIG;IACH,4DAKC;IAED;;;;OAIG;IACH,+EAKC;IAGD;;;;OAIG;IACH,yDAMC;IAED;;;;OAIG;IACH,wDAIC;IAED;;;;OAIG;IACH,yDAMC;IAED;;;;OAIG;IACH,2DAIC;IAED;;;;OAIG;IACH,mEAIC;IAED;;;;;OAKG;IACH,2EAgBC;;AA/ZD,wDAEC;AAED,6CAEC;AAfD,qDAOC;AAUD;;;;;GAKG;AACH,kCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAIhB;AAQD;;;;;GAKG;AACH,gCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAyBD;;;;;GAKG;AACH,uCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AA5CD;;;;;GAKG;AACH,6BAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAyBD;;;;;GAKG;AACH,oCAJW,MAAM,KACN,MAAM,MACN,MAAM,QAiBhB;AAKD;;;;;GAKG;AACH,0CAHW,MAAM,cACN,MAAM,QAehB;AAED;;;;;GAKG;AACH,iEAFW,MAAM,QAIhB;AAED;;;;;GAKG;AACH,mEAFW,MAAM,QAIhB;AAED;;;;;GAKG;AACH,+IAFW,MAAM,QAMhB"}
@@ -4,7 +4,9 @@ import { InMemoryDescriptor } from "./debug/InMemoryDescriptor.js";
4
4
 
5
5
  function equal(a, b, m) {
6
6
  if (a !== b) {
7
- const message = m !== undefined ? m : `${a} !== ${b}`;
7
+ const details = `${a} !== ${b}`;
8
+
9
+ const message = (m !== undefined && m !== "") ? `${m}. ${details}` : details;
8
10
  throw new Error(message);
9
11
  }
10
12
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Compute morton codes for each triangle
3
- * @param {number[]|Uint32Array} morton_codes
3
+ * @param {number[]|Uint32Array} morton_codes output where the morton codes are to be written to, matching order in {@link index_array}
4
4
  * @param {number} tri_count
5
5
  * @param {number[]|Uint8Array|Uint16Array|Uint32Array} index_array
6
6
  * @param {number[]|Float32Array} position_array
@@ -1 +1 @@
1
- {"version":3,"file":"build_triangle_morton_codes.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/build_triangle_morton_codes.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,0DAXW,MAAM,EAAE,GAAC,WAAW,aACpB,MAAM,eACN,MAAM,EAAE,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,kBAC3C,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,QA4DhB"}
1
+ {"version":3,"file":"build_triangle_morton_codes.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/build_triangle_morton_codes.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,0DAXW,MAAM,EAAE,GAAC,WAAW,aACpB,MAAM,eACN,MAAM,EAAE,GAAC,UAAU,GAAC,WAAW,GAAC,WAAW,kBAC3C,MAAM,EAAE,GAAC,YAAY,WACrB,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,WACN,MAAM,QA8DhB"}
@@ -2,7 +2,7 @@ import morton from "../../geom/3d/morton/Morton.js";
2
2
 
3
3
  /**
4
4
  * Compute morton codes for each triangle
5
- * @param {number[]|Uint32Array} morton_codes
5
+ * @param {number[]|Uint32Array} morton_codes output where the morton codes are to be written to, matching order in {@link index_array}
6
6
  * @param {number} tri_count
7
7
  * @param {number[]|Uint8Array|Uint16Array|Uint32Array} index_array
8
8
  * @param {number[]|Float32Array} position_array
@@ -37,10 +37,12 @@ export function build_triangle_morton_codes(
37
37
 
38
38
  const i3 = i * 3;
39
39
 
40
+ // read indices
40
41
  const a = index_array[i3];
41
42
  const b = index_array[i3 + 1];
42
43
  const c = index_array[i3 + 2];
43
44
 
45
+ // read vertex positions
44
46
  const a_address = a * 3;
45
47
  const ax = position_array[a_address];
46
48
  const ay = position_array[a_address + 1];
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * Given a set of leaves, build intermediate node hierarchy on top, all the way up to the root
2
3
  * Assumes nodes are spatially sorted
3
4
  * NOTE: {@link unprocessed_nodes} will be modified during execution to save memory
4
5
  * @param {BVH} bvh
@@ -1 +1 @@
1
- {"version":3,"file":"ebvh_build_hierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_hierarchy.js"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,kEANW,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,aACN,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,GACJ,MAAM,CAyDlB"}
1
+ {"version":3,"file":"ebvh_build_hierarchy.d.ts","sourceRoot":"","sources":["../../../../../src/core/bvh2/bvh3/ebvh_build_hierarchy.js"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,kEANW,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,aACN,MAAM,EAAE,GAAC,WAAW,oBACpB,MAAM,GACJ,MAAM,CAyDlB"}
@@ -2,6 +2,7 @@ import { assert } from "../../assert.js";
2
2
  import { max2 } from "../../math/max2.js";
3
3
 
4
4
  /**
5
+ * Given a set of leaves, build intermediate node hierarchy on top, all the way up to the root
5
6
  * Assumes nodes are spatially sorted
6
7
  * NOTE: {@link unprocessed_nodes} will be modified during execution to save memory
7
8
  * @param {BVH} bvh
@@ -19,8 +20,8 @@ export function ebvh_build_hierarchy(
19
20
  node_pool_offset
20
21
  ) {
21
22
 
22
- assert.isNonNegativeInteger(input_node_count,'input_node_count');
23
- assert.isNonNegativeInteger(node_pool_offset,'node_pool_offset');
23
+ assert.isNonNegativeInteger(input_node_count, 'input_node_count');
24
+ assert.isNonNegativeInteger(node_pool_offset, 'node_pool_offset');
24
25
 
25
26
  let used_index = node_pool_offset;
26
27
 
@@ -21,7 +21,8 @@ export class Cache<K, V> {
21
21
  readonly onRemoved: Signal<K, V>
22
22
 
23
23
  readonly weight: number
24
- readonly maxWeight: number
24
+
25
+ maxWeight: number
25
26
 
26
27
  size(): number
27
28
 
@@ -1 +1 @@
1
- {"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../../src/core/cache/Cache.js"],"names":[],"mappings":"AAWA;;;;GAIG;AACH;IACI;;;;;;;;OAQG;IACH,sGARW,MAAM,EA6FhB;IAtEG;;;;OAIG;IACH,kBAA0B;IAE1B;;;;OAIG;IACH,eAAe;IAEf;;;;OAIG;IACH,mBAA4B;IAE5B;;;;OAIG;IACH,qBAAgC;IAEhC;;;;OAIG;IACH,gBAAmB;IACnB;;;;OAIG;IACH,eAAkB;IAGlB;;;;OAIG;IACH,aAIE;IAEF;;;OAGG;IACH,WAFU,OAAO,GAAG,EAAC,KAAK,CAAC,CAEE;IAE7B;;;OAGG;IACH,WAFU,OAAO,GAAG,EAAC,KAAK,CAAC,CAEE;IAE7B;;;OAGG;IACH,OAFU,OAAO,GAAG,EAAC,KAAK,CAAC,CAEF;IAG7B;;;;;OAKG;IACH,kBAyBC;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;OAGG;IACH,oBAFW,MAAM,QAUhB;IAED;;;;OAIG;IACH,wBAYC;IAED;;;;;;OAMG;IACH,yBAHW,GAAG,GACD,OAAO,CAgCnB;IAED;;;;;OAKG;IACH,6BAUC;IAED;;;OAGG;IACH,sBAFa,aAAa,GAAG,EAAC,KAAK,CAAC,GAAC,IAAI,CAIxC;IAED;;;OAGG;IACH,YAFa,OAAO,CAgBnB;IAED;;;OAGG;IACH,+BAFW,MAAM,QAWhB;IAED;;;;OAIG;IACH,SAHW,GAAG,SACH,KAAK,QAoEf;IAED;;;;OAIG;IACH,cAHW,GAAG,GACD,OAAO,CAInB;IAED;;;;OAIG;IACH,SAHW,GAAG,GACD,KAAK,GAAC,IAAI,CAYtB;IAGD;;;;;;OAMG;IACH,kBALW,GAAG,kBACM,GAAG,KAAE,KAAK,0BAElB,KAAK,CAchB;IAED;;;;OAIG;IACH,wBAqBC;IAED;;;;OAIG;IACH,YAHW,GAAG,GACD,OAAO,CAgBnB;IAED;;;;;OAKG;IACH,kBAHW,GAAG,GACD,OAAO,CAanB;IAED;;OAEG;IACH,cAcC;IAED;;;OAGG;IACH,aAOC;IAED;;;;;OAKG;IACH,wCAFa,OAAO,CAMnB;IAGL;;;OAGG;IACH,6CAAmB;IAEnB;;;OAGG;IACH,+BA5FiB,OAAO,CA4FF;IAEtB;;;OAGG;IACH,4BA9KiB,OAAO,CA8KL;CAlBlB;mBApgBkB,4BAA4B;6BAIlB,mBAAmB"}
1
+ {"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../../../src/core/cache/Cache.js"],"names":[],"mappings":"AASA;;;;;GAKG;AACH;IASI;;;;;;;;OAQG;IACH,sGARW,MAAM,EAuFhB;IAxDG;;;;OAIG;IACH,mBAA4B;IAE5B;;;;OAIG;IACH,qBAAgC;IAEhC;;;;OAIG;IACH,gBAAmB;IACnB;;;;OAIG;IACH,eAAkB;IAGlB;;;;OAIG;IACH,aAIE;IAEF;;;OAGG;IACH,WAFU,OAAO,GAAG,EAAC,KAAK,CAAC,CAEE;IAE7B;;;OAGG;IACH,WAFU,OAAO,GAAG,EAAC,KAAK,CAAC,CAEE;IAE7B;;;OAGG;IACH,OAFU,OAAO,GAAG,EAAC,KAAK,CAAC,CAEF;IAG7B;;;;;OAKG;IACH,kBAyBC;IAED;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;OAEG;IACH,+BAEC;IAUD;;;OAGG;IACH,2BAQC;IAED,wBAEC;IAxBD;;;OAGG;IACH,qBAEC;IAoBD;;;;OAIG;IACH,wBAaC;IAED;;;;;;OAMG;IACH,yBAHW,GAAG,GACD,OAAO,CAgCnB;IAED;;;;;OAKG;IACH,6BAUC;IAED;;;OAGG;IACH,sBAFa,aAAa,GAAG,EAAC,KAAK,CAAC,GAAC,IAAI,CAIxC;IAED;;;OAGG;IACH,YAFa,OAAO,CAkBnB;IAED;;;OAGG;IACH,+BAFW,MAAM,QAWhB;IAED;;;;OAIG;IACH,SAHW,GAAG,SACH,KAAK,QAwEf;IAED;;;;OAIG;IACH,cAHW,GAAG,GACD,OAAO,CAInB;IAED;;;;OAIG;IACH,SAHW,GAAG,GACD,KAAK,GAAC,IAAI,CAYtB;IAGD;;;;;;OAMG;IACH,kBALW,GAAG,kBACM,GAAG,KAAE,KAAK,0BAElB,KAAK,CAchB;IAED;;;;OAIG;IACH,wBAqBC;IAED;;;;OAIG;IACH,YAHW,GAAG,GACD,OAAO,CAgBnB;IAED;;;;;OAKG;IACH,kBAHW,GAAG,GACD,OAAO,CAanB;IAED;;OAEG;IACH,cAcC;IAED;;;OAGG;IACH,aAOC;IAED;;;;;OAKG;IACH,wCAFa,OAAO,CAMnB;IAGL;;;OAGG;IACH,6CAAmB;IAEnB;;;OAGG;IACH,+BA5FiB,OAAO,CA4FF;IAEtB;;;OAGG;IACH,4BA9KiB,OAAO,CA8KL;;CAlBlB;mBA/hBkB,4BAA4B;6BAIlB,mBAAmB"}