@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.
@@ -42153,7 +42153,7 @@ else if (typeof exports === 'object')
42153
42153
  }
42154
42154
  }
42155
42155
 
42156
- const version = "1.0.30";
42156
+ const version = "1.0.31";
42157
42157
 
42158
42158
  class Engine3D {
42159
42159
  /**
@@ -64871,6 +64871,8 @@ fn frag(){
64871
64871
  _root = null;
64872
64872
  // Active and visible tiles set
64873
64873
  _activeTiles = /* @__PURE__ */ new Set();
64874
+ // Tiles that should be hidden but are delayed due to children loading
64875
+ _delayedHideTiles = /* @__PURE__ */ new Set();
64874
64876
  // Rings-specific: Scene group
64875
64877
  group;
64876
64878
  // Rings-specific: Camera management
@@ -64987,6 +64989,7 @@ fn frag(){
64987
64989
  _usedSet.forEach((tile) => lruCache.markUnused(tile));
64988
64990
  _usedSet.clear();
64989
64991
  this.updateCameraInfo();
64992
+ this._checkDelayedHideTiles();
64990
64993
  markUsedTiles(root, this);
64991
64994
  markUsedSetLeaves(root, this);
64992
64995
  markVisibleTiles(root, this);
@@ -65456,6 +65459,9 @@ fn frag(){
65456
65459
  setTileActive(tile, active) {
65457
65460
  if (active) {
65458
65461
  this._activeTiles.add(tile);
65462
+ if (this._delayedHideTiles.has(tile)) {
65463
+ this._delayedHideTiles.delete(tile);
65464
+ }
65459
65465
  } else {
65460
65466
  this._activeTiles.delete(tile);
65461
65467
  }
@@ -65475,7 +65481,42 @@ fn frag(){
65475
65481
  }
65476
65482
  scene.transform.enable = true;
65477
65483
  } else {
65478
- scene.transform.enable = false;
65484
+ if (!this._delayedHideTiles.has(tile)) {
65485
+ this._delayedHideTiles.add(tile);
65486
+ }
65487
+ }
65488
+ }
65489
+ /**
65490
+ * Get children tiles that are loading and will be active
65491
+ * Check if child is used in current frame (will be displayed) but not yet loaded
65492
+ */
65493
+ _getLoadingChildrenThatWillBeActive(tile) {
65494
+ const loadingChildren = [];
65495
+ const children = tile.children;
65496
+ for (let i = 0, l = children.length; i < l; i++) {
65497
+ const child = children[i];
65498
+ if (child.loadingState !== LOADED && child.loadingState !== FAILED) {
65499
+ loadingChildren.push(child);
65500
+ }
65501
+ if (child.children && child.children.length > 0) {
65502
+ loadingChildren.push(...this._getLoadingChildrenThatWillBeActive(child));
65503
+ }
65504
+ }
65505
+ return loadingChildren;
65506
+ }
65507
+ /**
65508
+ * Check and process delayed hide tiles when a child finishes loading
65509
+ */
65510
+ _checkDelayedHideTiles() {
65511
+ for (const tile of this._delayedHideTiles) {
65512
+ const stillLoading = this._getLoadingChildrenThatWillBeActive(tile);
65513
+ if (stillLoading.length === 0) {
65514
+ this._delayedHideTiles.delete(tile);
65515
+ const scene = tile.cached.scene;
65516
+ if (scene) {
65517
+ scene.transform.enable = false;
65518
+ }
65519
+ }
65479
65520
  }
65480
65521
  }
65481
65522
  /**
@@ -65484,6 +65525,9 @@ fn frag(){
65484
65525
  setTileVisible(tile, visible) {
65485
65526
  if (visible) {
65486
65527
  this._visibleTiles.add(tile);
65528
+ if (this._delayedHideTiles.has(tile)) {
65529
+ this._delayedHideTiles.delete(tile);
65530
+ }
65487
65531
  } else {
65488
65532
  this._visibleTiles.delete(tile);
65489
65533
  }
@@ -65491,7 +65535,13 @@ fn frag(){
65491
65535
  if (!scene) {
65492
65536
  return;
65493
65537
  }
65494
- scene.transform.enable = visible;
65538
+ if (visible) {
65539
+ scene.transform.enable = true;
65540
+ } else {
65541
+ if (!this._delayedHideTiles.has(tile)) {
65542
+ this._delayedHideTiles.add(tile);
65543
+ }
65544
+ }
65495
65545
  }
65496
65546
  /**
65497
65547
  * Add tile to download queue
@@ -123,6 +123,7 @@ export declare class TilesRenderer {
123
123
  protected rtcOffset: Vector3 | null;
124
124
  protected _root: Tile | null;
125
125
  protected _activeTiles: Set<Tile>;
126
+ protected _delayedHideTiles: Set<Tile>;
126
127
  readonly group: Object3D;
127
128
  cameras: Camera3D[];
128
129
  private _cameraMap;
@@ -206,6 +207,15 @@ export declare class TilesRenderer {
206
207
  * Set tile active state
207
208
  */
208
209
  setTileActive(tile: Tile, active: boolean): void;
210
+ /**
211
+ * Get children tiles that are loading and will be active
212
+ * Check if child is used in current frame (will be displayed) but not yet loaded
213
+ */
214
+ private _getLoadingChildrenThatWillBeActive;
215
+ /**
216
+ * Check and process delayed hide tiles when a child finishes loading
217
+ */
218
+ private _checkDelayedHideTiles;
209
219
  /**
210
220
  * Set tile visibility
211
221
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rings-webgpu/core",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "Rings webgpu Engine",
5
5
  "main": "index.js",
6
6
  "exports": {