@rings-webgpu/core 1.0.31 → 1.0.32

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.30";
42149
+ const version = "1.0.31";
42150
42150
 
42151
42151
  class Engine3D {
42152
42152
  /**
@@ -64864,6 +64864,8 @@ class TilesRenderer {
64864
64864
  _root = null;
64865
64865
  // Active and visible tiles set
64866
64866
  _activeTiles = /* @__PURE__ */ new Set();
64867
+ // Tiles that should be hidden but are delayed due to children loading
64868
+ _delayedHideTiles = /* @__PURE__ */ new Set();
64867
64869
  // Rings-specific: Scene group
64868
64870
  group;
64869
64871
  // Rings-specific: Camera management
@@ -64980,6 +64982,7 @@ class TilesRenderer {
64980
64982
  _usedSet.forEach((tile) => lruCache.markUnused(tile));
64981
64983
  _usedSet.clear();
64982
64984
  this.updateCameraInfo();
64985
+ this._checkDelayedHideTiles();
64983
64986
  markUsedTiles(root, this);
64984
64987
  markUsedSetLeaves(root, this);
64985
64988
  markVisibleTiles(root, this);
@@ -65449,6 +65452,9 @@ class TilesRenderer {
65449
65452
  setTileActive(tile, active) {
65450
65453
  if (active) {
65451
65454
  this._activeTiles.add(tile);
65455
+ if (this._delayedHideTiles.has(tile)) {
65456
+ this._delayedHideTiles.delete(tile);
65457
+ }
65452
65458
  } else {
65453
65459
  this._activeTiles.delete(tile);
65454
65460
  }
@@ -65468,7 +65474,42 @@ class TilesRenderer {
65468
65474
  }
65469
65475
  scene.transform.enable = true;
65470
65476
  } else {
65471
- scene.transform.enable = false;
65477
+ if (!this._delayedHideTiles.has(tile)) {
65478
+ this._delayedHideTiles.add(tile);
65479
+ }
65480
+ }
65481
+ }
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
+ /**
65501
+ * Check and process delayed hide tiles when a child finishes loading
65502
+ */
65503
+ _checkDelayedHideTiles() {
65504
+ 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
+ }
65512
+ }
65472
65513
  }
65473
65514
  }
65474
65515
  /**
@@ -65477,6 +65518,9 @@ class TilesRenderer {
65477
65518
  setTileVisible(tile, visible) {
65478
65519
  if (visible) {
65479
65520
  this._visibleTiles.add(tile);
65521
+ if (this._delayedHideTiles.has(tile)) {
65522
+ this._delayedHideTiles.delete(tile);
65523
+ }
65480
65524
  } else {
65481
65525
  this._visibleTiles.delete(tile);
65482
65526
  }
@@ -65484,7 +65528,13 @@ class TilesRenderer {
65484
65528
  if (!scene) {
65485
65529
  return;
65486
65530
  }
65487
- scene.transform.enable = visible;
65531
+ if (visible) {
65532
+ scene.transform.enable = true;
65533
+ } else {
65534
+ if (!this._delayedHideTiles.has(tile)) {
65535
+ this._delayedHideTiles.add(tile);
65536
+ }
65537
+ }
65488
65538
  }
65489
65539
  /**
65490
65540
  * Add tile to download queue