@rings-webgpu/core 1.0.39 → 1.0.40

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.
@@ -42292,7 +42292,7 @@ else if (typeof exports === 'object')
42292
42292
  }
42293
42293
  }
42294
42294
 
42295
- const version = "1.0.38";
42295
+ const version = "1.0.39";
42296
42296
 
42297
42297
  class Engine3D {
42298
42298
  /**
@@ -55178,7 +55178,7 @@ fn frag(){
55178
55178
  * Update node before rendering
55179
55179
  */
55180
55180
  nodeUpdate(view, passType, renderPassState, clusterLightingBuffer) {
55181
- if (this._validCount > 0 && view?.camera) {
55181
+ if (this._validCount > 0 && view?.camera && this._frameCount >= 60) {
55182
55182
  if (view.camera.viewMatrix) {
55183
55183
  this.scheduleOrder(view.camera.viewMatrix);
55184
55184
  }
@@ -65924,11 +65924,11 @@ fn frag(){
65924
65924
  const wasVisible = tile.__wasSetVisible;
65925
65925
  const wasActive = tile.__wasSetActive;
65926
65926
  if (wasActive !== setActive) {
65927
- renderer.setTileActive(tile, setActive);
65927
+ renderer.setTileDelayedActive(tile, setActive);
65928
65928
  tile.__wasSetActive = setActive;
65929
65929
  }
65930
65930
  if (wasVisible !== setVisible) {
65931
- renderer.setTileVisible(tile, setVisible);
65931
+ renderer.setTileDelayedVisible(tile, setVisible);
65932
65932
  tile.__wasSetVisible = setVisible;
65933
65933
  }
65934
65934
  }
@@ -66301,6 +66301,8 @@ fn frag(){
66301
66301
  _activeTiles = /* @__PURE__ */ new Set();
66302
66302
  // Tiles that should be hidden but are delayed due to children loading
66303
66303
  _delayedHideTiles = /* @__PURE__ */ new Set();
66304
+ _delayedVisibleTiles = /* @__PURE__ */ new Set();
66305
+ _delayedActiveTiles = /* @__PURE__ */ new Set();
66304
66306
  // Rings-specific: Scene group
66305
66307
  group;
66306
66308
  // Rings-specific: Camera management
@@ -66419,6 +66421,8 @@ fn frag(){
66419
66421
  _usedSet.clear();
66420
66422
  this.updateCameraInfo();
66421
66423
  this._checkDelayedHideTiles();
66424
+ this._checkDelayedActiveTiles();
66425
+ this._checkDelayedVisibleTiles();
66422
66426
  markUsedTiles(root, this);
66423
66427
  markUsedSetLeaves(root, this);
66424
66428
  markVisibleTiles(root, this);
@@ -66852,7 +66856,6 @@ fn frag(){
66852
66856
  }
66853
66857
  if (scene) {
66854
66858
  tile.cached.scene = scene;
66855
- tile.loadingState = LOADED;
66856
66859
  const bytesUsed = this._estimateBytesUsed(scene);
66857
66860
  this._bytesUsed.set(scene, bytesUsed);
66858
66861
  this.lruCache.setMemoryUsage(tile, bytesUsed);
@@ -66870,10 +66873,21 @@ fn frag(){
66870
66873
  });
66871
66874
  }
66872
66875
  {
66873
- this.setTileActive(tile, true);
66876
+ this.setTileImmediateActive(tile);
66874
66877
  tile.active = true;
66878
+ tile.__wasSetActive = true;
66875
66879
  this.stats.active++;
66876
66880
  }
66881
+ {
66882
+ this.setTileImmediateVisible(tile);
66883
+ tile.visible = true;
66884
+ tile.__wasSetVisible = true;
66885
+ this.stats.visible++;
66886
+ }
66887
+ tile.loadingState = LOADED;
66888
+ tile.usedLastFrame = true;
66889
+ markVisibleTiles(tile, this);
66890
+ toggleTiles(tile, this);
66877
66891
  } else {
66878
66892
  tile.loadingState = FAILED;
66879
66893
  this.stats.failed++;
@@ -66889,33 +66903,46 @@ fn frag(){
66889
66903
  /**
66890
66904
  * Set tile active state
66891
66905
  */
66892
- setTileActive(tile, active) {
66906
+ setTileDelayedActive(tile, active) {
66893
66907
  if (active) {
66894
66908
  this._activeTiles.add(tile);
66895
66909
  if (this._delayedHideTiles.has(tile)) {
66896
66910
  this._delayedHideTiles.delete(tile);
66897
66911
  }
66912
+ if (!this._delayedActiveTiles.has(tile)) {
66913
+ this._delayedActiveTiles.add(tile);
66914
+ }
66898
66915
  } else {
66899
66916
  this._activeTiles.delete(tile);
66917
+ if (!this._delayedHideTiles.has(tile)) {
66918
+ this._delayedHideTiles.add(tile);
66919
+ }
66920
+ if (this._delayedActiveTiles.has(tile)) {
66921
+ this._delayedActiveTiles.delete(tile);
66922
+ }
66900
66923
  }
66901
- const scene = tile.cached.scene;
66902
- if (!scene) {
66903
- return;
66904
- }
66905
- if (active) {
66906
- if (!this.group.entityChildren.includes(scene)) {
66907
- if (scene.parent) {
66908
- scene.parent.object3D.removeChild(scene);
66924
+ }
66925
+ setTileImmediateActive(tile) {
66926
+ if (tile.hasRenderableContent) {
66927
+ const scene = tile.cached.scene;
66928
+ if (scene) {
66929
+ if (!this.group.entityChildren.includes(scene)) {
66930
+ if (scene.parent) {
66931
+ scene.parent.object3D.removeChild(scene);
66932
+ }
66933
+ this.group.addChild(scene);
66934
+ }
66935
+ if (tile.cached.worldTransform) {
66936
+ this._applyWorldTransform(scene.transform, tile.cached.worldTransform);
66909
66937
  }
66910
- this.group.addChild(scene);
66911
- }
66912
- if (tile.cached.worldTransform) {
66913
- this._applyWorldTransform(scene.transform, tile.cached.worldTransform);
66914
66938
  }
66915
- scene.transform.enable = true;
66916
- } else {
66917
- if (!this._delayedHideTiles.has(tile)) {
66918
- this._delayedHideTiles.add(tile);
66939
+ }
66940
+ }
66941
+ setTileImmediateVisible(tile) {
66942
+ if (tile.hasRenderableContent) {
66943
+ const scene = tile.cached.scene;
66944
+ if (scene) {
66945
+ scene.transform.enable = true;
66919
66946
  }
66920
66947
  }
66921
66948
  }
@@ -66927,35 +66954,67 @@ fn frag(){
66927
66954
  return;
66928
66955
  }
66929
66956
  for (const tile of this._delayedHideTiles) {
66930
- this._delayedHideTiles.delete(tile);
66931
66957
  const scene = tile.cached.scene;
66932
66958
  if (scene) {
66933
66959
  scene.transform.enable = false;
66960
+ this._delayedHideTiles.delete(tile);
66961
+ }
66962
+ }
66963
+ }
66964
+ _checkDelayedActiveTiles() {
66965
+ for (const tile of this._delayedActiveTiles) {
66966
+ if (tile.hasRenderableContent) {
66967
+ const scene = tile.cached.scene;
66968
+ if (scene) {
66969
+ if (!this.group.entityChildren.includes(scene)) {
66970
+ if (scene.parent) {
66971
+ scene.parent.object3D.removeChild(scene);
66972
+ }
66973
+ this.group.addChild(scene);
66974
+ }
66975
+ if (tile.cached.worldTransform) {
66976
+ this._applyWorldTransform(scene.transform, tile.cached.worldTransform);
66977
+ }
66978
+ this._delayedActiveTiles.delete(tile);
66979
+ }
66980
+ } else {
66981
+ this._delayedActiveTiles.delete(tile);
66982
+ }
66983
+ }
66984
+ }
66985
+ _checkDelayedVisibleTiles() {
66986
+ for (const tile of this._delayedVisibleTiles) {
66987
+ if (tile.hasRenderableContent) {
66988
+ const scene = tile.cached.scene;
66989
+ if (scene) {
66990
+ scene.transform.enable = true;
66991
+ this._delayedVisibleTiles.delete(tile);
66992
+ }
66993
+ } else {
66994
+ this._delayedVisibleTiles.delete(tile);
66934
66995
  }
66935
66996
  }
66936
66997
  }
66937
66998
  /**
66938
66999
  * Set tile visibility
66939
67000
  */
66940
- setTileVisible(tile, visible) {
67001
+ setTileDelayedVisible(tile, visible) {
66941
67002
  if (visible) {
66942
67003
  this._visibleTiles.add(tile);
66943
67004
  if (this._delayedHideTiles.has(tile)) {
66944
67005
  this._delayedHideTiles.delete(tile);
66945
67006
  }
67007
+ if (!this._delayedVisibleTiles.has(tile)) {
67008
+ this._delayedVisibleTiles.add(tile);
67009
+ }
66946
67010
  } else {
66947
67011
  this._visibleTiles.delete(tile);
66948
- }
66949
- const scene = tile.cached.scene;
66950
- if (!scene) {
66951
- return;
66952
- }
66953
- if (visible) {
66954
- scene.transform.enable = true;
66955
- } else {
66956
67012
  if (!this._delayedHideTiles.has(tile)) {
66957
67013
  this._delayedHideTiles.add(tile);
66958
67014
  }
67015
+ if (this._delayedVisibleTiles.has(tile)) {
67016
+ this._delayedVisibleTiles.delete(tile);
67017
+ }
66959
67018
  }
66960
67019
  }
66961
67020
  /**
@@ -124,6 +124,8 @@ export declare class TilesRenderer {
124
124
  protected _root: Tile | null;
125
125
  protected _activeTiles: Set<Tile>;
126
126
  protected _delayedHideTiles: Set<Tile>;
127
+ protected _delayedVisibleTiles: Set<Tile>;
128
+ protected _delayedActiveTiles: Set<Tile>;
127
129
  readonly group: Object3D;
128
130
  cameras: Camera3D[];
129
131
  private _cameraMap;
@@ -206,15 +208,19 @@ export declare class TilesRenderer {
206
208
  /**
207
209
  * Set tile active state
208
210
  */
209
- setTileActive(tile: Tile, active: boolean): void;
211
+ setTileDelayedActive(tile: Tile, active: boolean): void;
212
+ setTileImmediateActive(tile: Tile): void;
213
+ setTileImmediateVisible(tile: Tile): void;
210
214
  /**
211
215
  * Check and process delayed hide tiles when a child finishes loading
212
216
  */
213
217
  private _checkDelayedHideTiles;
218
+ private _checkDelayedActiveTiles;
219
+ private _checkDelayedVisibleTiles;
214
220
  /**
215
221
  * Set tile visibility
216
222
  */
217
- setTileVisible(tile: Tile, visible: boolean): void;
223
+ setTileDelayedVisible(tile: Tile, visible: boolean): void;
218
224
  /**
219
225
  * Add tile to download queue
220
226
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rings-webgpu/core",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "description": "Rings webgpu Engine",
5
5
  "main": "index.js",
6
6
  "exports": {