@rings-webgpu/core 1.0.31 → 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 +156 -156
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +79 -34
- package/dist/rings.umd.js +155 -155
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +79 -34
- package/dist/types/loader/parser/tileRenderer/TilesRenderer.d.ts +16 -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++;
|
|
@@ -64871,6 +64844,8 @@ fn frag(){
|
|
|
64871
64844
|
_root = null;
|
|
64872
64845
|
// Active and visible tiles set
|
|
64873
64846
|
_activeTiles = /* @__PURE__ */ new Set();
|
|
64847
|
+
// Tiles that should be hidden but are delayed due to children loading
|
|
64848
|
+
_delayedHideTiles = /* @__PURE__ */ new Set();
|
|
64874
64849
|
// Rings-specific: Scene group
|
|
64875
64850
|
group;
|
|
64876
64851
|
// Rings-specific: Camera management
|
|
@@ -64939,6 +64914,7 @@ fn frag(){
|
|
|
64939
64914
|
basePath,
|
|
64940
64915
|
null
|
|
64941
64916
|
);
|
|
64917
|
+
this.queueTileForDownload(rootTile);
|
|
64942
64918
|
this._root = rootTile;
|
|
64943
64919
|
const boundingVolume = new BoundingVolume(rootTile.boundingVolume);
|
|
64944
64920
|
const sphere = new BoundingSphere();
|
|
@@ -64987,6 +64963,7 @@ fn frag(){
|
|
|
64987
64963
|
_usedSet.forEach((tile) => lruCache.markUnused(tile));
|
|
64988
64964
|
_usedSet.clear();
|
|
64989
64965
|
this.updateCameraInfo();
|
|
64966
|
+
this._checkDelayedHideTiles();
|
|
64990
64967
|
markUsedTiles(root, this);
|
|
64991
64968
|
markUsedSetLeaves(root, this);
|
|
64992
64969
|
markVisibleTiles(root, this);
|
|
@@ -64999,6 +64976,8 @@ fn frag(){
|
|
|
64999
64976
|
this.requestTileContents(queuedTiles[i]);
|
|
65000
64977
|
}
|
|
65001
64978
|
queuedTiles.length = 0;
|
|
64979
|
+
loadQueue.update();
|
|
64980
|
+
processNodeQueue.update();
|
|
65002
64981
|
lruCache.scheduleUnload();
|
|
65003
64982
|
const runningTasks = loadQueue.running || processNodeQueue.running;
|
|
65004
64983
|
if (runningTasks === false && this.isLoading === true) {
|
|
@@ -65456,6 +65435,9 @@ fn frag(){
|
|
|
65456
65435
|
setTileActive(tile, active) {
|
|
65457
65436
|
if (active) {
|
|
65458
65437
|
this._activeTiles.add(tile);
|
|
65438
|
+
if (this._delayedHideTiles.has(tile)) {
|
|
65439
|
+
this._delayedHideTiles.delete(tile);
|
|
65440
|
+
}
|
|
65459
65441
|
} else {
|
|
65460
65442
|
this._activeTiles.delete(tile);
|
|
65461
65443
|
}
|
|
@@ -65475,7 +65457,61 @@ fn frag(){
|
|
|
65475
65457
|
}
|
|
65476
65458
|
scene.transform.enable = true;
|
|
65477
65459
|
} else {
|
|
65478
|
-
|
|
65460
|
+
if (!this._delayedHideTiles.has(tile)) {
|
|
65461
|
+
this._delayedHideTiles.add(tile);
|
|
65462
|
+
}
|
|
65463
|
+
}
|
|
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
|
+
}
|
|
65468
|
+
/**
|
|
65469
|
+
* Get children tiles that are loading and will be active
|
|
65470
|
+
* Check if child is used in current frame (will be displayed) but not yet loaded
|
|
65471
|
+
*/
|
|
65472
|
+
_getLoadingChildrenThatWillBeActive(tile) {
|
|
65473
|
+
const loadingChildren = [];
|
|
65474
|
+
const children = tile.children;
|
|
65475
|
+
for (let i = 0, l = children.length; i < l; i++) {
|
|
65476
|
+
const child = children[i];
|
|
65477
|
+
if (this._checkIsLoadingTileWillBeActive(child)) {
|
|
65478
|
+
loadingChildren.push(child);
|
|
65479
|
+
}
|
|
65480
|
+
if (child.children && child.children.length > 0) {
|
|
65481
|
+
loadingChildren.push(...this._getLoadingChildrenThatWillBeActive(child));
|
|
65482
|
+
}
|
|
65483
|
+
}
|
|
65484
|
+
return loadingChildren;
|
|
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
|
+
}
|
|
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 stillLoadingChildren = this._getLoadingChildrenThatWillBeActive(tile);
|
|
65506
|
+
const stillLoadingParents = this._getLoadingParentsThatWillBeActive(tile);
|
|
65507
|
+
const stillLoading = [...stillLoadingChildren, ...stillLoadingParents];
|
|
65508
|
+
if (stillLoading.length === 0) {
|
|
65509
|
+
this._delayedHideTiles.delete(tile);
|
|
65510
|
+
const scene = tile.cached.scene;
|
|
65511
|
+
if (scene) {
|
|
65512
|
+
scene.transform.enable = false;
|
|
65513
|
+
}
|
|
65514
|
+
}
|
|
65479
65515
|
}
|
|
65480
65516
|
}
|
|
65481
65517
|
/**
|
|
@@ -65484,6 +65520,9 @@ fn frag(){
|
|
|
65484
65520
|
setTileVisible(tile, visible) {
|
|
65485
65521
|
if (visible) {
|
|
65486
65522
|
this._visibleTiles.add(tile);
|
|
65523
|
+
if (this._delayedHideTiles.has(tile)) {
|
|
65524
|
+
this._delayedHideTiles.delete(tile);
|
|
65525
|
+
}
|
|
65487
65526
|
} else {
|
|
65488
65527
|
this._visibleTiles.delete(tile);
|
|
65489
65528
|
}
|
|
@@ -65491,7 +65530,13 @@ fn frag(){
|
|
|
65491
65530
|
if (!scene) {
|
|
65492
65531
|
return;
|
|
65493
65532
|
}
|
|
65494
|
-
|
|
65533
|
+
if (visible) {
|
|
65534
|
+
scene.transform.enable = true;
|
|
65535
|
+
} else {
|
|
65536
|
+
if (!this._delayedHideTiles.has(tile)) {
|
|
65537
|
+
this._delayedHideTiles.add(tile);
|
|
65538
|
+
}
|
|
65539
|
+
}
|
|
65495
65540
|
}
|
|
65496
65541
|
/**
|
|
65497
65542
|
* 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,21 @@ export declare class TilesRenderer {
|
|
|
206
207
|
* Set tile active state
|
|
207
208
|
*/
|
|
208
209
|
setTileActive(tile: Tile, active: boolean): void;
|
|
210
|
+
private _checkIsLoadingTileWillBeActive;
|
|
211
|
+
/**
|
|
212
|
+
* Get children tiles that are loading and will be active
|
|
213
|
+
* Check if child is used in current frame (will be displayed) but not yet loaded
|
|
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;
|
|
221
|
+
/**
|
|
222
|
+
* Check and process delayed hide tiles when a child finishes loading
|
|
223
|
+
*/
|
|
224
|
+
private _checkDelayedHideTiles;
|
|
209
225
|
/**
|
|
210
226
|
* Set tile visibility
|
|
211
227
|
*/
|
|
@@ -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
|
*/
|