@rings-webgpu/core 1.0.32 → 1.0.33

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.32";
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) {
@@ -65479,6 +65455,9 @@ class TilesRenderer {
65479
65455
  }
65480
65456
  }
65481
65457
  }
65458
+ _checkIsLoadingTileWillBeActive(tile) {
65459
+ return tile.used && (tile.loadingState === LOADING || tile.loadingState === PARSING || !this._activeTiles.has(tile) || !this._visibleTiles.has(tile)) && tile.loadingState !== UNLOADED && tile.loadingState !== FAILED && tile.hasRenderableContent;
65460
+ }
65482
65461
  /**
65483
65462
  * Get children tiles that are loading and will be active
65484
65463
  * Check if child is used in current frame (will be displayed) but not yet loaded
@@ -65488,7 +65467,7 @@ class TilesRenderer {
65488
65467
  const children = tile.children;
65489
65468
  for (let i = 0, l = children.length; i < l; i++) {
65490
65469
  const child = children[i];
65491
- if (child.loadingState !== LOADED && child.loadingState !== FAILED) {
65470
+ if (this._checkIsLoadingTileWillBeActive(child)) {
65492
65471
  loadingChildren.push(child);
65493
65472
  }
65494
65473
  if (child.children && child.children.length > 0) {
@@ -65497,12 +65476,28 @@ class TilesRenderer {
65497
65476
  }
65498
65477
  return loadingChildren;
65499
65478
  }
65479
+ /**
65480
+ * Get parents tiles that are loading and will be active
65481
+ * Check if parent is used in current frame (will be displayed) but not yet loaded
65482
+ */
65483
+ _getLoadingParentsThatWillBeActive(tile) {
65484
+ const loadingParents = [];
65485
+ const parent = tile.parent;
65486
+ if (parent) {
65487
+ if (this._checkIsLoadingTileWillBeActive(parent)) {
65488
+ loadingParents.push(parent);
65489
+ }
65490
+ }
65491
+ return loadingParents;
65492
+ }
65500
65493
  /**
65501
65494
  * Check and process delayed hide tiles when a child finishes loading
65502
65495
  */
65503
65496
  _checkDelayedHideTiles() {
65504
65497
  for (const tile of this._delayedHideTiles) {
65505
- const stillLoading = this._getLoadingChildrenThatWillBeActive(tile);
65498
+ const stillLoadingChildren = this._getLoadingChildrenThatWillBeActive(tile);
65499
+ const stillLoadingParents = this._getLoadingParentsThatWillBeActive(tile);
65500
+ const stillLoading = [...stillLoadingChildren, ...stillLoadingParents];
65506
65501
  if (stillLoading.length === 0) {
65507
65502
  this._delayedHideTiles.delete(tile);
65508
65503
  const scene = tile.cached.scene;