@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.
@@ -42153,7 +42153,7 @@ else if (typeof exports === 'object')
42153
42153
  }
42154
42154
  }
42155
42155
 
42156
- const version = "1.0.31";
42156
+ const version = "1.0.33";
42157
42157
 
42158
42158
  class Engine3D {
42159
42159
  /**
@@ -64074,25 +64074,10 @@ fn frag(){
64074
64074
  class PriorityQueue {
64075
64075
  maxJobs = 6;
64076
64076
  // Maximum concurrent tasks
64077
- autoUpdate = true;
64078
- // Auto update
64079
64077
  priorityCallback = null;
64080
64078
  _items = [];
64081
64079
  _callbacks = /* @__PURE__ */ new Map();
64082
64080
  _currJobs = 0;
64083
- _scheduled = false;
64084
- _schedulingCallback;
64085
- constructor() {
64086
- this._schedulingCallback = (func) => {
64087
- requestAnimationFrame(func);
64088
- };
64089
- }
64090
- /**
64091
- * Set scheduling callback (can be used to customize scheduling strategy)
64092
- */
64093
- set schedulingCallback(cb) {
64094
- this._schedulingCallback = cb;
64095
- }
64096
64081
  /**
64097
64082
  * Check if there are tasks running or queued
64098
64083
  */
@@ -64134,9 +64119,6 @@ fn frag(){
64134
64119
  };
64135
64120
  this._items.unshift(item);
64136
64121
  this._callbacks.set(item, data);
64137
- if (this.autoUpdate) {
64138
- this._scheduleJobRun();
64139
- }
64140
64122
  return promise;
64141
64123
  }
64142
64124
  /**
@@ -64168,17 +64150,11 @@ fn frag(){
64168
64150
  toRemove.forEach((item) => this.remove(item));
64169
64151
  }
64170
64152
  /**
64171
- * Schedule task run
64153
+ * Update queue - process pending tasks
64154
+ * Should be called by TilesRenderer in its update() method
64172
64155
  */
64173
- _scheduleJobRun() {
64174
- if (this._scheduled) {
64175
- return;
64176
- }
64177
- this._scheduled = true;
64178
- this._schedulingCallback(() => {
64179
- this._scheduled = false;
64180
- this._tryRunJobs();
64181
- });
64156
+ update() {
64157
+ this._tryRunJobs();
64182
64158
  }
64183
64159
  /**
64184
64160
  * Try to run tasks
@@ -64189,9 +64165,6 @@ fn frag(){
64189
64165
  let iterated = 0;
64190
64166
  const completedCallback = () => {
64191
64167
  this._currJobs--;
64192
- if (this.autoUpdate) {
64193
- this._scheduleJobRun();
64194
- }
64195
64168
  };
64196
64169
  while (maxJobs > this._currJobs && this._items.length > 0 && iterated < maxJobs) {
64197
64170
  this._currJobs++;
@@ -64941,6 +64914,7 @@ fn frag(){
64941
64914
  basePath,
64942
64915
  null
64943
64916
  );
64917
+ this.queueTileForDownload(rootTile);
64944
64918
  this._root = rootTile;
64945
64919
  const boundingVolume = new BoundingVolume(rootTile.boundingVolume);
64946
64920
  const sphere = new BoundingSphere();
@@ -65002,6 +64976,8 @@ fn frag(){
65002
64976
  this.requestTileContents(queuedTiles[i]);
65003
64977
  }
65004
64978
  queuedTiles.length = 0;
64979
+ loadQueue.update();
64980
+ processNodeQueue.update();
65005
64981
  lruCache.scheduleUnload();
65006
64982
  const runningTasks = loadQueue.running || processNodeQueue.running;
65007
64983
  if (runningTasks === false && this.isLoading === true) {
@@ -65438,8 +65414,10 @@ fn frag(){
65438
65414
  tileItem.loadingState = UNLOADED;
65439
65415
  });
65440
65416
  }
65441
- if (tile.active) {
65417
+ {
65442
65418
  this.setTileActive(tile, true);
65419
+ tile.active = true;
65420
+ this.stats.active++;
65443
65421
  }
65444
65422
  } else {
65445
65423
  tile.loadingState = FAILED;
@@ -65486,36 +65464,18 @@ fn frag(){
65486
65464
  }
65487
65465
  }
65488
65466
  }
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
65467
  /**
65508
65468
  * Check and process delayed hide tiles when a child finishes loading
65509
65469
  */
65510
65470
  _checkDelayedHideTiles() {
65471
+ if (this.stats.downloading !== 0) {
65472
+ return;
65473
+ }
65511
65474
  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
- }
65475
+ this._delayedHideTiles.delete(tile);
65476
+ const scene = tile.cached.scene;
65477
+ if (scene) {
65478
+ scene.transform.enable = false;
65519
65479
  }
65520
65480
  }
65521
65481
  }
@@ -207,11 +207,6 @@ export declare class TilesRenderer {
207
207
  * Set tile active state
208
208
  */
209
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
210
  /**
216
211
  * Check and process delayed hide tiles when a child finishes loading
217
212
  */
@@ -14,18 +14,10 @@ export type TaskCallback = (item: Tile) => Promise<void> | void;
14
14
  */
15
15
  export declare class PriorityQueue {
16
16
  maxJobs: number;
17
- autoUpdate: boolean;
18
17
  priorityCallback: PriorityCallback | null;
19
18
  private _items;
20
19
  private _callbacks;
21
20
  private _currJobs;
22
- private _scheduled;
23
- private _schedulingCallback;
24
- constructor();
25
- /**
26
- * Set scheduling callback (can be used to customize scheduling strategy)
27
- */
28
- set schedulingCallback(cb: (func: () => void) => void);
29
21
  /**
30
22
  * Check if there are tasks running or queued
31
23
  */
@@ -51,9 +43,10 @@ export declare class PriorityQueue {
51
43
  */
52
44
  removeByFilter(filter: (item: Tile) => boolean): void;
53
45
  /**
54
- * Schedule task run
46
+ * Update queue - process pending tasks
47
+ * Should be called by TilesRenderer in its update() method
55
48
  */
56
- private _scheduleJobRun;
49
+ update(): void;
57
50
  /**
58
51
  * Try to run tasks
59
52
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rings-webgpu/core",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Rings webgpu Engine",
5
5
  "main": "index.js",
6
6
  "exports": {