@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.
- package/dist/rings.es.js +159 -159
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +29 -34
- package/dist/rings.umd.js +155 -155
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +29 -34
- package/dist/types/loader/parser/tileRenderer/TilesRenderer.d.ts +6 -0
- package/dist/types/loader/parser/tileRenderer/utils/PriorityQueue.d.ts +3 -10
- package/package.json +1 -1
package/dist/rings.umd.max.js
CHANGED
|
@@ -42153,7 +42153,7 @@ else if (typeof exports === 'object')
|
|
|
42153
42153
|
}
|
|
42154
42154
|
}
|
|
42155
42155
|
|
|
42156
|
-
const version = "1.0.
|
|
42156
|
+
const version = "1.0.32";
|
|
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
|
-
*
|
|
64153
|
+
* Update queue - process pending tasks
|
|
64154
|
+
* Should be called by TilesRenderer in its update() method
|
|
64172
64155
|
*/
|
|
64173
|
-
|
|
64174
|
-
|
|
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) {
|
|
@@ -65486,6 +65462,9 @@ fn frag(){
|
|
|
65486
65462
|
}
|
|
65487
65463
|
}
|
|
65488
65464
|
}
|
|
65465
|
+
_checkIsLoadingTileWillBeActive(tile) {
|
|
65466
|
+
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;
|
|
65467
|
+
}
|
|
65489
65468
|
/**
|
|
65490
65469
|
* Get children tiles that are loading and will be active
|
|
65491
65470
|
* Check if child is used in current frame (will be displayed) but not yet loaded
|
|
@@ -65495,7 +65474,7 @@ fn frag(){
|
|
|
65495
65474
|
const children = tile.children;
|
|
65496
65475
|
for (let i = 0, l = children.length; i < l; i++) {
|
|
65497
65476
|
const child = children[i];
|
|
65498
|
-
if (
|
|
65477
|
+
if (this._checkIsLoadingTileWillBeActive(child)) {
|
|
65499
65478
|
loadingChildren.push(child);
|
|
65500
65479
|
}
|
|
65501
65480
|
if (child.children && child.children.length > 0) {
|
|
@@ -65504,12 +65483,28 @@ fn frag(){
|
|
|
65504
65483
|
}
|
|
65505
65484
|
return loadingChildren;
|
|
65506
65485
|
}
|
|
65486
|
+
/**
|
|
65487
|
+
* Get parents tiles that are loading and will be active
|
|
65488
|
+
* Check if parent is used in current frame (will be displayed) but not yet loaded
|
|
65489
|
+
*/
|
|
65490
|
+
_getLoadingParentsThatWillBeActive(tile) {
|
|
65491
|
+
const loadingParents = [];
|
|
65492
|
+
const parent = tile.parent;
|
|
65493
|
+
if (parent) {
|
|
65494
|
+
if (this._checkIsLoadingTileWillBeActive(parent)) {
|
|
65495
|
+
loadingParents.push(parent);
|
|
65496
|
+
}
|
|
65497
|
+
}
|
|
65498
|
+
return loadingParents;
|
|
65499
|
+
}
|
|
65507
65500
|
/**
|
|
65508
65501
|
* Check and process delayed hide tiles when a child finishes loading
|
|
65509
65502
|
*/
|
|
65510
65503
|
_checkDelayedHideTiles() {
|
|
65511
65504
|
for (const tile of this._delayedHideTiles) {
|
|
65512
|
-
const
|
|
65505
|
+
const stillLoadingChildren = this._getLoadingChildrenThatWillBeActive(tile);
|
|
65506
|
+
const stillLoadingParents = this._getLoadingParentsThatWillBeActive(tile);
|
|
65507
|
+
const stillLoading = [...stillLoadingChildren, ...stillLoadingParents];
|
|
65513
65508
|
if (stillLoading.length === 0) {
|
|
65514
65509
|
this._delayedHideTiles.delete(tile);
|
|
65515
65510
|
const scene = tile.cached.scene;
|
|
@@ -207,11 +207,17 @@ export declare class TilesRenderer {
|
|
|
207
207
|
* Set tile active state
|
|
208
208
|
*/
|
|
209
209
|
setTileActive(tile: Tile, active: boolean): void;
|
|
210
|
+
private _checkIsLoadingTileWillBeActive;
|
|
210
211
|
/**
|
|
211
212
|
* Get children tiles that are loading and will be active
|
|
212
213
|
* Check if child is used in current frame (will be displayed) but not yet loaded
|
|
213
214
|
*/
|
|
214
215
|
private _getLoadingChildrenThatWillBeActive;
|
|
216
|
+
/**
|
|
217
|
+
* Get parents tiles that are loading and will be active
|
|
218
|
+
* Check if parent is used in current frame (will be displayed) but not yet loaded
|
|
219
|
+
*/
|
|
220
|
+
private _getLoadingParentsThatWillBeActive;
|
|
215
221
|
/**
|
|
216
222
|
* Check and process delayed hide tiles when a child finishes loading
|
|
217
223
|
*/
|
|
@@ -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
|
-
*
|
|
46
|
+
* Update queue - process pending tasks
|
|
47
|
+
* Should be called by TilesRenderer in its update() method
|
|
55
48
|
*/
|
|
56
|
-
|
|
49
|
+
update(): void;
|
|
57
50
|
/**
|
|
58
51
|
* Try to run tasks
|
|
59
52
|
*/
|