@rings-webgpu/core 1.0.32 → 1.0.34

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.
@@ -42146,7 +42146,7 @@ class PostProcessingComponent extends ComponentBase {
42146
42146
  }
42147
42147
  }
42148
42148
 
42149
- const version = "1.0.31";
42149
+ const version = "1.0.33";
42150
42150
 
42151
42151
  class Engine3D {
42152
42152
  /**
@@ -64067,25 +64067,10 @@ class LRUCache {
64067
64067
  class PriorityQueue {
64068
64068
  maxJobs = 6;
64069
64069
  // Maximum concurrent tasks
64070
- autoUpdate = true;
64071
- // Auto update
64072
64070
  priorityCallback = null;
64073
64071
  _items = [];
64074
64072
  _callbacks = /* @__PURE__ */ new Map();
64075
64073
  _currJobs = 0;
64076
- _scheduled = false;
64077
- _schedulingCallback;
64078
- constructor() {
64079
- this._schedulingCallback = (func) => {
64080
- requestAnimationFrame(func);
64081
- };
64082
- }
64083
- /**
64084
- * Set scheduling callback (can be used to customize scheduling strategy)
64085
- */
64086
- set schedulingCallback(cb) {
64087
- this._schedulingCallback = cb;
64088
- }
64089
64074
  /**
64090
64075
  * Check if there are tasks running or queued
64091
64076
  */
@@ -64127,9 +64112,6 @@ class PriorityQueue {
64127
64112
  };
64128
64113
  this._items.unshift(item);
64129
64114
  this._callbacks.set(item, data);
64130
- if (this.autoUpdate) {
64131
- this._scheduleJobRun();
64132
- }
64133
64115
  return promise;
64134
64116
  }
64135
64117
  /**
@@ -64161,17 +64143,11 @@ class PriorityQueue {
64161
64143
  toRemove.forEach((item) => this.remove(item));
64162
64144
  }
64163
64145
  /**
64164
- * Schedule task run
64146
+ * Update queue - process pending tasks
64147
+ * Should be called by TilesRenderer in its update() method
64165
64148
  */
64166
- _scheduleJobRun() {
64167
- if (this._scheduled) {
64168
- return;
64169
- }
64170
- this._scheduled = true;
64171
- this._schedulingCallback(() => {
64172
- this._scheduled = false;
64173
- this._tryRunJobs();
64174
- });
64149
+ update() {
64150
+ this._tryRunJobs();
64175
64151
  }
64176
64152
  /**
64177
64153
  * Try to run tasks
@@ -64182,9 +64158,6 @@ class PriorityQueue {
64182
64158
  let iterated = 0;
64183
64159
  const completedCallback = () => {
64184
64160
  this._currJobs--;
64185
- if (this.autoUpdate) {
64186
- this._scheduleJobRun();
64187
- }
64188
64161
  };
64189
64162
  while (maxJobs > this._currJobs && this._items.length > 0 && iterated < maxJobs) {
64190
64163
  this._currJobs++;
@@ -64934,6 +64907,7 @@ class TilesRenderer {
64934
64907
  basePath,
64935
64908
  null
64936
64909
  );
64910
+ this.queueTileForDownload(rootTile);
64937
64911
  this._root = rootTile;
64938
64912
  const boundingVolume = new BoundingVolume(rootTile.boundingVolume);
64939
64913
  const sphere = new BoundingSphere();
@@ -64995,6 +64969,8 @@ class TilesRenderer {
64995
64969
  this.requestTileContents(queuedTiles[i]);
64996
64970
  }
64997
64971
  queuedTiles.length = 0;
64972
+ loadQueue.update();
64973
+ processNodeQueue.update();
64998
64974
  lruCache.scheduleUnload();
64999
64975
  const runningTasks = loadQueue.running || processNodeQueue.running;
65000
64976
  if (runningTasks === false && this.isLoading === true) {
@@ -65431,8 +65407,10 @@ class TilesRenderer {
65431
65407
  tileItem.loadingState = UNLOADED;
65432
65408
  });
65433
65409
  }
65434
- if (tile.active) {
65410
+ {
65435
65411
  this.setTileActive(tile, true);
65412
+ tile.active = true;
65413
+ this.stats.active++;
65436
65414
  }
65437
65415
  } else {
65438
65416
  tile.loadingState = FAILED;
@@ -65479,36 +65457,18 @@ class TilesRenderer {
65479
65457
  }
65480
65458
  }
65481
65459
  }
65482
- /**
65483
- * Get children tiles that are loading and will be active
65484
- * Check if child is used in current frame (will be displayed) but not yet loaded
65485
- */
65486
- _getLoadingChildrenThatWillBeActive(tile) {
65487
- const loadingChildren = [];
65488
- const children = tile.children;
65489
- for (let i = 0, l = children.length; i < l; i++) {
65490
- const child = children[i];
65491
- if (child.loadingState !== LOADED && child.loadingState !== FAILED) {
65492
- loadingChildren.push(child);
65493
- }
65494
- if (child.children && child.children.length > 0) {
65495
- loadingChildren.push(...this._getLoadingChildrenThatWillBeActive(child));
65496
- }
65497
- }
65498
- return loadingChildren;
65499
- }
65500
65460
  /**
65501
65461
  * Check and process delayed hide tiles when a child finishes loading
65502
65462
  */
65503
65463
  _checkDelayedHideTiles() {
65464
+ if (this.stats.downloading !== 0) {
65465
+ return;
65466
+ }
65504
65467
  for (const tile of this._delayedHideTiles) {
65505
- const stillLoading = this._getLoadingChildrenThatWillBeActive(tile);
65506
- if (stillLoading.length === 0) {
65507
- this._delayedHideTiles.delete(tile);
65508
- const scene = tile.cached.scene;
65509
- if (scene) {
65510
- scene.transform.enable = false;
65511
- }
65468
+ this._delayedHideTiles.delete(tile);
65469
+ const scene = tile.cached.scene;
65470
+ if (scene) {
65471
+ scene.transform.enable = false;
65512
65472
  }
65513
65473
  }
65514
65474
  }