@woosh/meep-engine 2.86.5 → 2.86.7

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.
package/build/meep.cjs CHANGED
@@ -54284,13 +54284,6 @@ Color.black = Object.freeze(new Color(0, 0, 0));
54284
54284
  */
54285
54285
  Color.transparent = Object.freeze(new Color(0, 0, 0, 0));
54286
54286
 
54287
- /**
54288
- * No-operation function. Does nothing. Useful when a callback is required to avoid checks for a missing function.
54289
- * @param {*} arguments
54290
- */
54291
- function noop() {
54292
- }
54293
-
54294
54287
  /**
54295
54288
  * Returns true if two 1D lines overlap, touch is not considered overlap
54296
54289
  * Parameters are assumed to be ordered, a1 > a0, b1 > b0
@@ -58338,25 +58331,20 @@ class TerrainTileManager {
58338
58331
 
58339
58332
  const tiles = this.tiles;
58340
58333
 
58341
- const self = this;
58342
-
58343
- function ensureBuilt(x, y) {
58344
- return function (resolve) {
58345
- self.obtain(x, y).then(resolve);
58346
- }
58347
- }
58348
-
58349
58334
  //populate tiles
58350
- for (let y = 0; y < gridSize.y; y++) {
58335
+ const tile_resolution_y = gridSize.y;
58336
+ const tile_resolution_x = gridSize.x;
58337
+
58338
+ for (let y = 0; y < tile_resolution_y; y++) {
58351
58339
 
58352
- const tY = y < gridSize.y - 1 ? time_size.y : (total_size.y - time_size.y * y);
58340
+ const tY = y < tile_resolution_y - 1 ? time_size.y : (total_size.y - time_size.y * y);
58353
58341
 
58354
- for (let x = 0; x < gridSize.x; x++) {
58342
+ for (let x = 0; x < tile_resolution_x; x++) {
58355
58343
 
58356
- const tX = x < gridSize.x - 1 ? time_size.x : (total_size.x - time_size.x * x);
58344
+ const tX = x < tile_resolution_x - 1 ? time_size.x : (total_size.x - time_size.x * x);
58357
58345
 
58358
58346
  const tile = new TerrainTile();
58359
- const index = y * gridSize.x + x;
58347
+ const index = y * tile_resolution_x + x;
58360
58348
  tiles[index] = tile;
58361
58349
 
58362
58350
  this.assignTileMaterial(tile);
@@ -58371,9 +58359,6 @@ class TerrainTileManager {
58371
58359
  tile.setInitialHeightBounds(this.heightRange.min, this.heightRange.max);
58372
58360
  tile.computeBoundingBox();
58373
58361
 
58374
- //hook for building
58375
- tile.ensureBuilt = ensureBuilt(x, y);
58376
-
58377
58362
  tile.external_bvh.link(this.bvh, index);
58378
58363
  }
58379
58364
  }
@@ -58479,16 +58464,16 @@ class TerrainTileManager {
58479
58464
  return Promise.resolve(tile);
58480
58465
 
58481
58466
  } else {
58482
- const promise = new Promise((resolve, reject) => {
58483
- tile.onBuilt.addOne(resolve);
58484
- tile.onDestroyed.addOne(reject);
58485
- });
58486
58467
 
58487
58468
  if (!tile.isBuildInProgress) {
58488
- this.build(x, y, noop, noop);
58469
+ return new Promise((resolve, reject) => this.build(x, y, resolve, reject));
58470
+ } else {
58471
+ return new Promise((resolve, reject) => {
58472
+ tile.onBuilt.addOne(resolve);
58473
+ tile.onDestroyed.addOne(reject);
58474
+ });
58489
58475
  }
58490
58476
 
58491
- return promise;
58492
58477
  }
58493
58478
 
58494
58479
  }
@@ -58604,7 +58589,7 @@ class TerrainTileManager {
58604
58589
 
58605
58590
  const tile = this.tiles[tile_index];
58606
58591
 
58607
- if(!tile.isBuilt){
58592
+ if (!tile.isBuilt) {
58608
58593
  continue;
58609
58594
  }
58610
58595
 
@@ -58701,6 +58686,8 @@ class TerrainTileManager {
58701
58686
  // console.timeEnd(processName);
58702
58687
 
58703
58688
  this.on.tileBuilt.send1(tile);
58689
+
58690
+ resolve(tile);
58704
58691
  }, reject);
58705
58692
  }
58706
58693
  }
@@ -63659,6 +63646,13 @@ function array_push_if_unique(array, element) {
63659
63646
  return false;
63660
63647
  }
63661
63648
 
63649
+ /**
63650
+ * No-operation function. Does nothing. Useful when a callback is required to avoid checks for a missing function.
63651
+ * @param {*} arguments
63652
+ */
63653
+ function noop() {
63654
+ }
63655
+
63662
63656
  /**
63663
63657
  * Created by Alex on 25/08/2016.
63664
63658
  */
@@ -65121,8 +65115,10 @@ class Terrain {
65121
65115
  const promisedTiles = [];
65122
65116
 
65123
65117
  tiles.traverse(function (tile) {
65124
- const x = tile.gridPosition.x;
65125
- const y = tile.gridPosition.y;
65118
+ const position = tile.gridPosition;
65119
+
65120
+ const x = position.x;
65121
+ const y = position.y;
65126
65122
 
65127
65123
  const tilePromise = tiles.obtain(x, y);
65128
65124