@loaders.gl/tiles 5.0.0-alpha.1 → 5.0.0-alpha.2
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/LICENSE +14 -3
- package/dist/dist.dev.js +2396 -274
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +2763 -337
- package/dist/index.cjs.map +3 -4
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/point-cloud/point-cloud-tile.d.ts.map +1 -1
- package/dist/point-cloud/point-cloud-tile.js +3 -0
- package/dist/point-cloud/point-cloud-tile.js.map +1 -1
- package/dist/point-cloud/point-cloud-tileset.d.ts.map +1 -1
- package/dist/point-cloud/point-cloud-tileset.js +3 -0
- package/dist/point-cloud/point-cloud-tileset.js.map +1 -1
- package/dist/point-cloud/types.d.ts.map +1 -1
- package/dist/point-cloud/types.js +3 -0
- package/dist/point-cloud/types.js.map +1 -1
- package/dist/raster-set.d.ts +35 -29
- package/dist/raster-set.d.ts.map +1 -1
- package/dist/raster-set.js +7 -1
- package/dist/raster-set.js.map +1 -1
- package/dist/tileset-3d/common/tile-3d.d.ts +98 -3
- package/dist/tileset-3d/common/tile-3d.d.ts.map +1 -1
- package/dist/tileset-3d/common/tile-3d.js +229 -15
- package/dist/tileset-3d/common/tile-3d.js.map +1 -1
- package/dist/tileset-3d/common/tileset-3d.d.ts +143 -3
- package/dist/tileset-3d/common/tileset-3d.d.ts.map +1 -1
- package/dist/tileset-3d/common/tileset-3d.js +257 -16
- package/dist/tileset-3d/common/tileset-3d.js.map +1 -1
- package/dist/tileset-3d/common/tileset-cache.d.ts +11 -1
- package/dist/tileset-3d/common/tileset-cache.d.ts.map +1 -1
- package/dist/tileset-3d/common/tileset-cache.js +11 -3
- package/dist/tileset-3d/common/tileset-cache.js.map +1 -1
- package/dist/tileset-3d/common/tileset-source.d.ts +18 -0
- package/dist/tileset-3d/common/tileset-source.d.ts.map +1 -1
- package/dist/tileset-3d/common/tileset-source.js.map +1 -1
- package/dist/tileset-3d/common/tileset-traverser.d.ts +13 -0
- package/dist/tileset-3d/common/tileset-traverser.d.ts.map +1 -1
- package/dist/tileset-3d/common/tileset-traverser.js +28 -1
- package/dist/tileset-3d/common/tileset-traverser.js.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts +111 -0
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.d.ts.map +1 -0
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js +340 -0
- package/dist/tileset-3d/format-3d-tiles/implicit-tiling.js.map +1 -0
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts +92 -3
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.d.ts.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js +211 -13
- package/dist/tileset-3d/format-3d-tiles/tiles-3d-source.js.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts +36 -0
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.d.ts.map +1 -1
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js +66 -0
- package/dist/tileset-3d/format-3d-tiles/tileset-3d-traverser.js.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.d.ts.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js +3 -0
- package/dist/tileset-3d/format-i3s/i3s-pending-tiles-register.js.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-tile-manager.d.ts.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-tile-manager.js +3 -0
- package/dist/tileset-3d/format-i3s/i3s-tile-manager.js.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.d.ts.map +1 -1
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js +3 -0
- package/dist/tileset-3d/format-i3s/i3s-tileset-traverser.js.map +1 -1
- package/dist/tileset-3d/helpers/3d-tiles-options.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/3d-tiles-options.js +3 -0
- package/dist/tileset-3d/helpers/3d-tiles-options.js.map +1 -1
- package/dist/tileset-3d/helpers/bounding-volume.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/bounding-volume.js +1 -0
- package/dist/tileset-3d/helpers/bounding-volume.js.map +1 -1
- package/dist/tileset-3d/helpers/frame-state.d.ts +59 -1
- package/dist/tileset-3d/helpers/frame-state.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/frame-state.js +84 -9
- package/dist/tileset-3d/helpers/frame-state.js.map +1 -1
- package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts +61 -9
- package/dist/tileset-3d/helpers/tiles-3d-lod.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/tiles-3d-lod.js +198 -93
- package/dist/tileset-3d/helpers/tiles-3d-lod.js.map +1 -1
- package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts +134 -0
- package/dist/tileset-3d/helpers/tiles-3d-request-priority.d.ts.map +1 -0
- package/dist/tileset-3d/helpers/tiles-3d-request-priority.js +179 -0
- package/dist/tileset-3d/helpers/tiles-3d-request-priority.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/doubly-linked-list.d.ts.map +1 -1
- package/dist/utils/doubly-linked-list.js +1 -0
- package/dist/utils/doubly-linked-list.js.map +1 -1
- package/dist/utils/managed-array.d.ts.map +1 -1
- package/dist/utils/managed-array.js +1 -0
- package/dist/utils/managed-array.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +19 -0
- package/src/point-cloud/point-cloud-tile.ts +4 -0
- package/src/point-cloud/point-cloud-tileset.ts +4 -0
- package/src/point-cloud/types.ts +4 -0
- package/src/raster-set.ts +81 -43
- package/src/tileset-3d/common/tile-3d.ts +285 -21
- package/src/tileset-3d/common/tileset-3d.ts +368 -17
- package/src/tileset-3d/common/tileset-cache.ts +15 -7
- package/src/tileset-3d/common/tileset-source.ts +21 -0
- package/src/tileset-3d/common/tileset-traverser.ts +29 -1
- package/src/tileset-3d/format-3d-tiles/implicit-tiling.ts +534 -0
- package/src/tileset-3d/format-3d-tiles/tiles-3d-source.ts +266 -13
- package/src/tileset-3d/format-3d-tiles/tileset-3d-traverser.ts +77 -0
- package/src/tileset-3d/format-i3s/i3s-pending-tiles-register.ts +4 -0
- package/src/tileset-3d/format-i3s/i3s-tile-manager.ts +4 -0
- package/src/tileset-3d/format-i3s/i3s-tileset-traverser.ts +4 -0
- package/src/tileset-3d/helpers/3d-tiles-options.ts +4 -0
- package/src/tileset-3d/helpers/bounding-volume.ts +2 -0
- package/src/tileset-3d/helpers/frame-state.ts +139 -11
- package/src/tileset-3d/helpers/tiles-3d-lod.ts +291 -112
- package/src/tileset-3d/helpers/tiles-3d-request-priority.ts +301 -0
- package/src/types.ts +6 -0
- package/src/utils/doubly-linked-list.ts +2 -0
- package/src/utils/managed-array.ts +2 -0
|
@@ -2,7 +2,8 @@ import { Matrix4, Vector3 } from '@math.gl/core';
|
|
|
2
2
|
import { Stats } from '@probe.gl/stats';
|
|
3
3
|
import { RequestScheduler, LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
4
4
|
import { TilesetCache } from "./tileset-cache.js";
|
|
5
|
-
import { FrameState } from "../helpers/frame-state.js";
|
|
5
|
+
import type { FrameState } from "../helpers/frame-state.js";
|
|
6
|
+
import type { FoveatedInterpolationCallback } from "../helpers/tiles-3d-request-priority.js";
|
|
6
7
|
import type { Viewport } from "../../types.js";
|
|
7
8
|
import { Tile3D } from "./tile-3d.js";
|
|
8
9
|
import { TILESET_TYPE } from "../../constants.js";
|
|
@@ -15,7 +16,28 @@ export type Tileset3DProps = {
|
|
|
15
16
|
loadOptions?: LoaderOptions;
|
|
16
17
|
loadTiles?: boolean;
|
|
17
18
|
basePath?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Soft target, in bytes, for cached tile content that is not required by the current frame.
|
|
21
|
+
* The listed default applies to 3D Tiles; I3S retains its existing 32 MiB default.
|
|
22
|
+
* @default 536870912
|
|
23
|
+
*/
|
|
24
|
+
cacheBytes?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Additional bytes that the current-frame working set may use before memory-adjusted SSE rises.
|
|
27
|
+
* The listed default applies to 3D Tiles; I3S retains its existing 1 MiB default.
|
|
28
|
+
* @default 536870912
|
|
29
|
+
*/
|
|
30
|
+
maximumCacheOverflowBytes?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Soft cache target in mebibytes.
|
|
33
|
+
* @deprecated Use {@link Tileset3DProps.cacheBytes}; when both are supplied, `cacheBytes` wins.
|
|
34
|
+
*/
|
|
18
35
|
maximumMemoryUsage?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Cache overflow headroom in mebibytes.
|
|
38
|
+
* @deprecated Use {@link Tileset3DProps.maximumCacheOverflowBytes}; when both are supplied, the
|
|
39
|
+
* byte-native option wins.
|
|
40
|
+
*/
|
|
19
41
|
memoryCacheOverflow?: number;
|
|
20
42
|
maximumTilesSelected?: number;
|
|
21
43
|
debounceTime?: number;
|
|
@@ -24,10 +46,34 @@ export type Tileset3DProps = {
|
|
|
24
46
|
ellipsoid?: object;
|
|
25
47
|
modelMatrix?: Matrix4;
|
|
26
48
|
maximumScreenSpaceError?: number;
|
|
49
|
+
/** Enables perspective dynamic SSE to reduce distant, horizon-facing refinement. */
|
|
50
|
+
dynamicScreenSpaceError?: boolean;
|
|
51
|
+
/** Base dynamic SSE fog density in inverse meters. */
|
|
52
|
+
dynamicScreenSpaceErrorDensity?: number;
|
|
53
|
+
/** Maximum dynamic SSE reduction in logical/CSS pixels. */
|
|
54
|
+
dynamicScreenSpaceErrorFactor?: number;
|
|
55
|
+
/** Fraction of tileset height at which dynamic SSE begins to fade, clamped to `[0, 1]`. */
|
|
56
|
+
dynamicScreenSpaceErrorHeightFalloff?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Enables adaptive LOD reduction when estimated tile memory exceeds the overflow ceiling.
|
|
59
|
+
* Defaults to `true` for 3D Tiles and retains the existing `false` default for I3S.
|
|
60
|
+
*/
|
|
27
61
|
memoryAdjustedScreenSpaceError?: boolean;
|
|
28
62
|
viewportTraversersMap?: any;
|
|
29
63
|
updateTransforms?: boolean;
|
|
30
64
|
viewDistanceScale?: number;
|
|
65
|
+
/** Reduced viewport-height fraction used to prioritize coarse initial coverage; `0` disables it. */
|
|
66
|
+
progressiveResolutionHeightFraction?: number;
|
|
67
|
+
/** Whether requests nearer the center of a perspective viewport receive higher priority. */
|
|
68
|
+
foveatedScreenSpaceError?: boolean;
|
|
69
|
+
/** Fraction of the perspective field of view that receives no foveated SSE relaxation. */
|
|
70
|
+
foveatedConeSize?: number;
|
|
71
|
+
/** Minimum logical-pixel SSE relaxation immediately outside the foveated cone. */
|
|
72
|
+
foveatedMinimumScreenSpaceErrorRelaxation?: number;
|
|
73
|
+
/** Function that increases SSE relaxation from the foveated cone toward the viewport edge. */
|
|
74
|
+
foveatedInterpolationCallback?: FoveatedInterpolationCallback;
|
|
75
|
+
/** Seconds peripheral requests may wait after the camera moves. */
|
|
76
|
+
foveatedTimeDelay?: number;
|
|
31
77
|
onTileLoad?: (tile: Tile3D) => any;
|
|
32
78
|
onTileUnload?: (tile: Tile3D) => any;
|
|
33
79
|
onTileError?: (tile: Tile3D, message: string, url: string) => any;
|
|
@@ -45,7 +91,13 @@ type Props = {
|
|
|
45
91
|
modelMatrix: Matrix4;
|
|
46
92
|
throttleRequests: boolean;
|
|
47
93
|
maxRequests: number;
|
|
94
|
+
/** Soft target, in bytes, for evictable cached tile content. */
|
|
95
|
+
cacheBytes: number;
|
|
96
|
+
/** Current-frame headroom, in bytes, before memory-adjusted SSE rises. */
|
|
97
|
+
maximumCacheOverflowBytes: number;
|
|
98
|
+
/** @deprecated Byte-native code should use `cacheBytes`. */
|
|
48
99
|
maximumMemoryUsage: number;
|
|
100
|
+
/** @deprecated Byte-native code should use `maximumCacheOverflowBytes`. */
|
|
49
101
|
memoryCacheOverflow: number;
|
|
50
102
|
maximumTilesSelected: number;
|
|
51
103
|
debounceTime: number;
|
|
@@ -57,6 +109,15 @@ type Props = {
|
|
|
57
109
|
onTraversalComplete: (selectedTiles: Tile3D[]) => Tile3D[];
|
|
58
110
|
onUpdate: () => void;
|
|
59
111
|
maximumScreenSpaceError: number;
|
|
112
|
+
/** Whether perspective dynamic SSE is enabled. */
|
|
113
|
+
dynamicScreenSpaceError: boolean;
|
|
114
|
+
/** Base dynamic SSE fog density in inverse meters. */
|
|
115
|
+
dynamicScreenSpaceErrorDensity: number;
|
|
116
|
+
/** Maximum dynamic SSE reduction in logical/CSS pixels. */
|
|
117
|
+
dynamicScreenSpaceErrorFactor: number;
|
|
118
|
+
/** Fraction of tileset height at which dynamic SSE begins to fade. */
|
|
119
|
+
dynamicScreenSpaceErrorHeightFalloff: number;
|
|
120
|
+
/** Whether cache pressure may adapt the active SSE threshold. */
|
|
60
121
|
memoryAdjustedScreenSpaceError: boolean;
|
|
61
122
|
viewportTraversersMap: Record<string, any> | null;
|
|
62
123
|
attributions: string[];
|
|
@@ -64,6 +125,18 @@ type Props = {
|
|
|
64
125
|
loadOptions: LoaderOptions;
|
|
65
126
|
updateTransforms: boolean;
|
|
66
127
|
viewDistanceScale: number;
|
|
128
|
+
/** Reduced viewport-height fraction used to prioritize coarse initial coverage. */
|
|
129
|
+
progressiveResolutionHeightFraction: number;
|
|
130
|
+
/** Whether perspective requests are prioritized around the viewport center. */
|
|
131
|
+
foveatedScreenSpaceError: boolean;
|
|
132
|
+
/** Fraction of the perspective field of view with no foveated SSE relaxation. */
|
|
133
|
+
foveatedConeSize: number;
|
|
134
|
+
/** Minimum logical-pixel SSE relaxation outside the foveated cone. */
|
|
135
|
+
foveatedMinimumScreenSpaceErrorRelaxation: number;
|
|
136
|
+
/** Function used to interpolate foveated SSE relaxation. */
|
|
137
|
+
foveatedInterpolationCallback: FoveatedInterpolationCallback;
|
|
138
|
+
/** Seconds eligible peripheral requests wait after camera movement. */
|
|
139
|
+
foveatedTimeDelay: number;
|
|
67
140
|
basePath: string;
|
|
68
141
|
contentLoader?: (tile: Tile3D) => Promise<void>;
|
|
69
142
|
i3s: Record<string, any>;
|
|
@@ -102,12 +175,14 @@ export declare class Tileset3D {
|
|
|
102
175
|
cartesianCenter: Vector3 | null;
|
|
103
176
|
zoom: number;
|
|
104
177
|
boundingVolume: any;
|
|
178
|
+
/** Effective dynamic SSE density calculated for the most recently traversed viewport. */
|
|
105
179
|
dynamicScreenSpaceErrorComputedDensity: number;
|
|
106
|
-
|
|
180
|
+
/** Estimated bytes currently retained by loaded tile content. */
|
|
107
181
|
gpuMemoryUsageInBytes: number;
|
|
182
|
+
/** Active SSE threshold after optional cache-pressure adjustment, in logical/CSS pixels. */
|
|
108
183
|
memoryAdjustedScreenSpaceError: number;
|
|
109
184
|
private _cacheBytes;
|
|
110
|
-
private
|
|
185
|
+
private _maximumCacheOverflowBytes;
|
|
111
186
|
_frameNumber: number;
|
|
112
187
|
private _tiles;
|
|
113
188
|
private _pendingCount;
|
|
@@ -118,6 +193,10 @@ export declare class Tileset3D {
|
|
|
118
193
|
private _requestedTiles;
|
|
119
194
|
private _emptyTiles;
|
|
120
195
|
private frameStateData;
|
|
196
|
+
/** Last camera pose retained independently for each viewport. */
|
|
197
|
+
private _cameraMotionStates;
|
|
198
|
+
/** Pending traversal that releases requests after camera motion settles. */
|
|
199
|
+
private _deferredTraversalTimeout;
|
|
121
200
|
_traverser: TilesetTraverser;
|
|
122
201
|
_cache: TilesetCache;
|
|
123
202
|
_requestScheduler: RequestScheduler;
|
|
@@ -134,14 +213,65 @@ export declare class Tileset3D {
|
|
|
134
213
|
isLoaded(): boolean;
|
|
135
214
|
get tiles(): object[];
|
|
136
215
|
get frameNumber(): number;
|
|
216
|
+
/**
|
|
217
|
+
* Gets or sets the soft target, in bytes, for cached tile content not needed this frame.
|
|
218
|
+
*
|
|
219
|
+
* Current-frame tiles remain protected even when their estimated memory exceeds this target.
|
|
220
|
+
* Reducing the value makes unused least-recently-used tiles eligible for eviction on the next
|
|
221
|
+
* traversal.
|
|
222
|
+
* @default 536870912 for 3D Tiles; 33554432 for I3S
|
|
223
|
+
*/
|
|
224
|
+
get cacheBytes(): number;
|
|
225
|
+
set cacheBytes(value: number);
|
|
226
|
+
/**
|
|
227
|
+
* Gets or sets the additional current-frame headroom, in bytes, before memory-adjusted SSE rises.
|
|
228
|
+
*
|
|
229
|
+
* The pressure ceiling is `cacheBytes + maximumCacheOverflowBytes`. This value does not change
|
|
230
|
+
* the base target used to evict tiles that were not touched in the current frame.
|
|
231
|
+
* @default 536870912 for 3D Tiles; 1048576 for I3S
|
|
232
|
+
*/
|
|
233
|
+
get maximumCacheOverflowBytes(): number;
|
|
234
|
+
set maximumCacheOverflowBytes(value: number);
|
|
235
|
+
/**
|
|
236
|
+
* Gets or sets the soft cache target in mebibytes.
|
|
237
|
+
* @deprecated Use {@link Tileset3D.cacheBytes}. Assignments remain synchronized for compatibility.
|
|
238
|
+
*/
|
|
239
|
+
get maximumMemoryUsage(): number;
|
|
240
|
+
set maximumMemoryUsage(value: number);
|
|
137
241
|
get queryParams(): string;
|
|
242
|
+
/**
|
|
243
|
+
* Updates traversal and runtime options, synchronizing byte-native and deprecated cache values.
|
|
244
|
+
*
|
|
245
|
+
* For each budget, the byte-native option takes precedence when both unit forms are supplied.
|
|
246
|
+
* Unspecified budgets retain their current byte values, avoiding repeated MiB conversion.
|
|
247
|
+
*
|
|
248
|
+
* @param props - Partial runtime options to apply.
|
|
249
|
+
*/
|
|
138
250
|
setProps(props: Tileset3DProps): void;
|
|
139
251
|
getTileUrl(tilePath: string): string;
|
|
140
252
|
hasExtension(extensionName: string): boolean;
|
|
141
253
|
update(viewports?: Viewport[] | Viewport | null): void;
|
|
142
254
|
selectTiles(viewports?: Viewport[] | Viewport | null): Promise<number>;
|
|
255
|
+
/**
|
|
256
|
+
* Moves the active LOD threshold toward the configured SSE or away from cache pressure.
|
|
257
|
+
*
|
|
258
|
+
* Usage below {@link Tileset3D.cacheBytes} restores quality in two-percent steps. Usage above
|
|
259
|
+
* `cacheBytes + maximumCacheOverflowBytes` reduces refinement in two-percent steps. Values in
|
|
260
|
+
* the overflow window leave the threshold unchanged, preventing rapid load/evict oscillation.
|
|
261
|
+
*/
|
|
143
262
|
adjustScreenSpaceError(): void;
|
|
144
263
|
private doUpdate;
|
|
264
|
+
/**
|
|
265
|
+
* Schedules one follow-up traversal when the moving-camera deferral window expires.
|
|
266
|
+
*
|
|
267
|
+
* Replacing an existing timer ensures continuing camera movement pushes the retry window forward
|
|
268
|
+
* instead of creating a queue of redundant traversals.
|
|
269
|
+
*
|
|
270
|
+
* @param delayInSeconds - Remaining stationary delay before deferred requests become eligible.
|
|
271
|
+
*/
|
|
272
|
+
private _scheduleDeferredTraversal;
|
|
273
|
+
/** Clears a pending moving-camera follow-up traversal. */
|
|
274
|
+
private _clearDeferredTraversal;
|
|
145
275
|
_needTraverse(viewportId: string): boolean;
|
|
146
276
|
_onTraversalEnd(frameState: FrameState): void;
|
|
147
277
|
_updateTiles(): void;
|
|
@@ -155,6 +285,16 @@ export declare class Tileset3D {
|
|
|
155
285
|
_initializeTraverser(): TilesetTraverser;
|
|
156
286
|
_destroyTileHeaders(parentTile: Tile3D): void;
|
|
157
287
|
_loadTile(tile: Tile3D): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Loads a source-managed lazy child-header group and reports failures through tile callbacks.
|
|
290
|
+
*
|
|
291
|
+
* Subtree metadata shares the normal loading counters but is not reported as render content and
|
|
292
|
+
* is not added to the GPU cache. Traversal is notified separately after the promise settles.
|
|
293
|
+
*
|
|
294
|
+
* @param tile - Runtime tile that owns the lazy subtree reference.
|
|
295
|
+
* @param frameState - View state that made the subtree eligible for refinement.
|
|
296
|
+
*/
|
|
297
|
+
_loadTileChildren(tile: Tile3D, frameState: FrameState): Promise<void>;
|
|
158
298
|
_onTileLoadError(tile: Tile3D, error: Error): void;
|
|
159
299
|
_onSourceError(error: Error, tile?: Tile3D | null): void;
|
|
160
300
|
_onTilesetError(error: Error): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tileset-3d.d.ts","sourceRoot":"","sources":["../../../src/tileset-3d/common/tileset-3d.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAC,YAAY,EAAC,2BAAwB;
|
|
1
|
+
{"version":3,"file":"tileset-3d.d.ts","sourceRoot":"","sources":["../../../src/tileset-3d/common/tileset-3d.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAG7C,OAAO,KAAK,EAAoB,UAAU,EAAC,kCAA+B;AAM1E,OAAO,KAAK,EAAC,6BAA6B,EAAC,gDAA6C;AAExF,OAAO,KAAK,EAAqB,QAAQ,EAAC,uBAAoB;AAC9D,OAAO,EAAC,MAAM,EAAC,qBAAkB;AACjC,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAE7C,OAAO,EAAC,gBAAgB,EAAC,+BAA4B;AACrD,OAAO,EAEL,qBAAqB,EACrB,qBAAqB,EACrB,WAAW,EACX,eAAe,EAEhB,4BAAyB;AAE1B,YAAY,EAAC,WAAW,EAAC,4BAAyB;AAElD,MAAM,MAAM,cAAc,GAAG;IAC3B,gBAAgB,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AS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe5C;;;;;;;;OAQG;IACG,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAa5E,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IASlD,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAE,MAAM,GAAG,IAAW,GAAG,IAAI;IAI9D,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAInC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,qBAAqB,GAAG,IAAI,GAAG,IAAI;IAsBzE,mBAAmB,IAAI,IAAI;IAK3B,iBAAiB,IAAI,IAAI;IAKzB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAInC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAYrC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAW/B,QAAQ,IAAI,IAAI;IAmBhB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAenC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMhC,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,eAAe;IAgBvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;CAO3B"}
|
|
@@ -8,16 +8,76 @@ import { Stats } from '@probe.gl/stats';
|
|
|
8
8
|
import { RequestScheduler } from '@loaders.gl/loader-utils';
|
|
9
9
|
import { TilesetCache } from "./tileset-cache.js";
|
|
10
10
|
import { calculateTransformProps } from "../helpers/transform-utils.js";
|
|
11
|
-
import { getFrameState, limitSelectedTiles } from "../helpers/frame-state.js";
|
|
11
|
+
import { getFrameState, limitSelectedTiles, updateCameraMotionState } from "../helpers/frame-state.js";
|
|
12
|
+
import { calculateDynamicScreenSpaceErrorDensity, updateRootTransformForDynamicScreenSpaceError } from "../helpers/tiles-3d-lod.js";
|
|
13
|
+
import { interpolateLinearly } from "../helpers/tiles-3d-request-priority.js";
|
|
14
|
+
import { TILESET_TYPE } from "../../constants.js";
|
|
12
15
|
import { isTileset3DSource } from "./tileset-source.js";
|
|
16
|
+
const BYTES_PER_MEBIBYTE = 1024 * 1024;
|
|
17
|
+
const DEFAULT_CACHE_BYTES = 512 * BYTES_PER_MEBIBYTE;
|
|
18
|
+
const DEFAULT_MAXIMUM_CACHE_OVERFLOW_BYTES = 512 * BYTES_PER_MEBIBYTE;
|
|
19
|
+
const DEFAULT_I3S_CACHE_BYTES = 32 * BYTES_PER_MEBIBYTE;
|
|
20
|
+
const DEFAULT_I3S_MAXIMUM_CACHE_OVERFLOW_BYTES = BYTES_PER_MEBIBYTE;
|
|
21
|
+
/**
|
|
22
|
+
* Validates a byte-based tile-cache budget.
|
|
23
|
+
*
|
|
24
|
+
* Fractions are accepted because JavaScript memory estimates are numbers, but negative, infinite,
|
|
25
|
+
* and `NaN` values cannot define a stable cache threshold.
|
|
26
|
+
*
|
|
27
|
+
* @param value - Proposed cache budget in bytes.
|
|
28
|
+
* @param optionName - Public option name used in an actionable error message.
|
|
29
|
+
* @returns The validated byte budget.
|
|
30
|
+
*/
|
|
31
|
+
function validateCacheByteLength(value, optionName) {
|
|
32
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
33
|
+
throw new Error(`${optionName} must be a finite number greater than or equal to 0`);
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolves the base cache target from byte-native or deprecated mebibyte options.
|
|
39
|
+
*
|
|
40
|
+
* The byte-native option takes precedence so mixed migration configurations are deterministic.
|
|
41
|
+
* The fallback is already expressed in bytes and is used for both construction and runtime updates.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Options that may contain byte-native or deprecated cache values.
|
|
44
|
+
* @param fallbackCacheBytes - Existing or default cache target in bytes.
|
|
45
|
+
* @returns The resolved and validated cache target in bytes.
|
|
46
|
+
*/
|
|
47
|
+
function resolveCacheBytes(options, fallbackCacheBytes) {
|
|
48
|
+
const cacheBytes = options.cacheBytes ??
|
|
49
|
+
(options.maximumMemoryUsage !== undefined
|
|
50
|
+
? options.maximumMemoryUsage * BYTES_PER_MEBIBYTE
|
|
51
|
+
: fallbackCacheBytes);
|
|
52
|
+
return validateCacheByteLength(cacheBytes, 'cacheBytes');
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolves cache overflow headroom from byte-native or deprecated mebibyte options.
|
|
56
|
+
*
|
|
57
|
+
* The byte-native option takes precedence so callers can migrate the two cache controls
|
|
58
|
+
* independently without unit ambiguity.
|
|
59
|
+
*
|
|
60
|
+
* @param options - Options that may contain byte-native or deprecated overflow values.
|
|
61
|
+
* @param fallbackOverflowBytes - Existing or default overflow headroom in bytes.
|
|
62
|
+
* @returns The resolved and validated overflow headroom in bytes.
|
|
63
|
+
*/
|
|
64
|
+
function resolveMaximumCacheOverflowBytes(options, fallbackOverflowBytes) {
|
|
65
|
+
const maximumCacheOverflowBytes = options.maximumCacheOverflowBytes ??
|
|
66
|
+
(options.memoryCacheOverflow !== undefined
|
|
67
|
+
? options.memoryCacheOverflow * BYTES_PER_MEBIBYTE
|
|
68
|
+
: fallbackOverflowBytes);
|
|
69
|
+
return validateCacheByteLength(maximumCacheOverflowBytes, 'maximumCacheOverflowBytes');
|
|
70
|
+
}
|
|
13
71
|
const DEFAULT_PROPS = {
|
|
14
72
|
description: '',
|
|
15
73
|
ellipsoid: Ellipsoid.WGS84,
|
|
16
74
|
modelMatrix: new Matrix4(),
|
|
17
75
|
throttleRequests: true,
|
|
18
76
|
maxRequests: 64,
|
|
19
|
-
|
|
20
|
-
|
|
77
|
+
cacheBytes: DEFAULT_CACHE_BYTES,
|
|
78
|
+
maximumCacheOverflowBytes: DEFAULT_MAXIMUM_CACHE_OVERFLOW_BYTES,
|
|
79
|
+
maximumMemoryUsage: DEFAULT_CACHE_BYTES / BYTES_PER_MEBIBYTE,
|
|
80
|
+
memoryCacheOverflow: DEFAULT_MAXIMUM_CACHE_OVERFLOW_BYTES / BYTES_PER_MEBIBYTE,
|
|
21
81
|
maximumTilesSelected: 0,
|
|
22
82
|
debounceTime: 0,
|
|
23
83
|
onTileLoad: () => { },
|
|
@@ -29,8 +89,18 @@ const DEFAULT_PROPS = {
|
|
|
29
89
|
onUpdate: () => { },
|
|
30
90
|
contentLoader: undefined,
|
|
31
91
|
viewDistanceScale: 1.0,
|
|
92
|
+
progressiveResolutionHeightFraction: 0.3,
|
|
93
|
+
foveatedScreenSpaceError: true,
|
|
94
|
+
foveatedConeSize: 0.1,
|
|
95
|
+
foveatedMinimumScreenSpaceErrorRelaxation: 0,
|
|
96
|
+
foveatedInterpolationCallback: interpolateLinearly,
|
|
97
|
+
foveatedTimeDelay: 0.2,
|
|
32
98
|
maximumScreenSpaceError: 8,
|
|
33
|
-
|
|
99
|
+
dynamicScreenSpaceError: true,
|
|
100
|
+
dynamicScreenSpaceErrorDensity: 2.0e-4,
|
|
101
|
+
dynamicScreenSpaceErrorFactor: 24,
|
|
102
|
+
dynamicScreenSpaceErrorHeightFalloff: 0.25,
|
|
103
|
+
memoryAdjustedScreenSpaceError: true,
|
|
34
104
|
loadTiles: true,
|
|
35
105
|
updateTransforms: true,
|
|
36
106
|
viewportTraversersMap: null,
|
|
@@ -84,12 +154,14 @@ export class Tileset3D {
|
|
|
84
154
|
cartesianCenter = null;
|
|
85
155
|
zoom = 1;
|
|
86
156
|
boundingVolume = null;
|
|
87
|
-
|
|
88
|
-
|
|
157
|
+
/** Effective dynamic SSE density calculated for the most recently traversed viewport. */
|
|
158
|
+
dynamicScreenSpaceErrorComputedDensity = 0;
|
|
159
|
+
/** Estimated bytes currently retained by loaded tile content. */
|
|
89
160
|
gpuMemoryUsageInBytes = 0;
|
|
161
|
+
/** Active SSE threshold after optional cache-pressure adjustment, in logical/CSS pixels. */
|
|
90
162
|
memoryAdjustedScreenSpaceError = 0.0;
|
|
91
|
-
_cacheBytes =
|
|
92
|
-
|
|
163
|
+
_cacheBytes = DEFAULT_CACHE_BYTES;
|
|
164
|
+
_maximumCacheOverflowBytes = DEFAULT_MAXIMUM_CACHE_OVERFLOW_BYTES;
|
|
93
165
|
_frameNumber = 0;
|
|
94
166
|
_tiles = {};
|
|
95
167
|
_pendingCount = 0;
|
|
@@ -100,6 +172,10 @@ export class Tileset3D {
|
|
|
100
172
|
_requestedTiles = [];
|
|
101
173
|
_emptyTiles = [];
|
|
102
174
|
frameStateData = {};
|
|
175
|
+
/** Last camera pose retained independently for each viewport. */
|
|
176
|
+
_cameraMotionStates = {};
|
|
177
|
+
/** Pending traversal that releases requests after camera motion settles. */
|
|
178
|
+
_deferredTraversalTimeout = null;
|
|
103
179
|
_traverser;
|
|
104
180
|
_cache = new TilesetCache();
|
|
105
181
|
_requestScheduler;
|
|
@@ -112,11 +188,29 @@ export class Tileset3D {
|
|
|
112
188
|
* @param options Traversal and runtime options.
|
|
113
189
|
*/
|
|
114
190
|
constructor(source, options) {
|
|
115
|
-
this.options = { ...DEFAULT_PROPS, ...options };
|
|
116
|
-
this.loadOptions = this.options.loadOptions || {};
|
|
117
191
|
if (!isTileset3DSource(source)) {
|
|
118
192
|
throw new Error('Tileset3D requires a Tileset3DSource instance');
|
|
119
193
|
}
|
|
194
|
+
const suppliedOptions = options || {};
|
|
195
|
+
const usesTiles3DCacheDefaults = source.type === TILESET_TYPE.TILES3D;
|
|
196
|
+
const defaultCacheBytes = usesTiles3DCacheDefaults
|
|
197
|
+
? DEFAULT_PROPS.cacheBytes
|
|
198
|
+
: DEFAULT_I3S_CACHE_BYTES;
|
|
199
|
+
const defaultMaximumCacheOverflowBytes = usesTiles3DCacheDefaults
|
|
200
|
+
? DEFAULT_PROPS.maximumCacheOverflowBytes
|
|
201
|
+
: DEFAULT_I3S_MAXIMUM_CACHE_OVERFLOW_BYTES;
|
|
202
|
+
const cacheBytes = resolveCacheBytes(suppliedOptions, defaultCacheBytes);
|
|
203
|
+
const maximumCacheOverflowBytes = resolveMaximumCacheOverflowBytes(suppliedOptions, defaultMaximumCacheOverflowBytes);
|
|
204
|
+
this.options = {
|
|
205
|
+
...DEFAULT_PROPS,
|
|
206
|
+
...suppliedOptions,
|
|
207
|
+
cacheBytes,
|
|
208
|
+
maximumCacheOverflowBytes,
|
|
209
|
+
maximumMemoryUsage: cacheBytes / BYTES_PER_MEBIBYTE,
|
|
210
|
+
memoryCacheOverflow: maximumCacheOverflowBytes / BYTES_PER_MEBIBYTE,
|
|
211
|
+
memoryAdjustedScreenSpaceError: suppliedOptions.memoryAdjustedScreenSpaceError ?? usesTiles3DCacheDefaults
|
|
212
|
+
};
|
|
213
|
+
this.loadOptions = this.options.loadOptions || {};
|
|
120
214
|
this.source = source;
|
|
121
215
|
this.tileset = null;
|
|
122
216
|
this.loader = this.source.loader;
|
|
@@ -135,13 +229,15 @@ export class Tileset3D {
|
|
|
135
229
|
maxRequests: this.options.maxRequests
|
|
136
230
|
});
|
|
137
231
|
this.memoryAdjustedScreenSpaceError = this.options.maximumScreenSpaceError;
|
|
138
|
-
this._cacheBytes =
|
|
139
|
-
this.
|
|
232
|
+
this._cacheBytes = cacheBytes;
|
|
233
|
+
this._maximumCacheOverflowBytes = maximumCacheOverflowBytes;
|
|
140
234
|
this.stats = new Stats({ id: this.url });
|
|
141
235
|
this._initializeStats();
|
|
142
236
|
this.tilesetInitializationPromise = this._initializeTileSet();
|
|
143
237
|
}
|
|
144
238
|
destroy() {
|
|
239
|
+
this._clearDeferredTraversal();
|
|
240
|
+
this.source.destroy?.();
|
|
145
241
|
this._destroy();
|
|
146
242
|
}
|
|
147
243
|
isLoaded() {
|
|
@@ -153,13 +249,73 @@ export class Tileset3D {
|
|
|
153
249
|
get frameNumber() {
|
|
154
250
|
return this._frameNumber;
|
|
155
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Gets or sets the soft target, in bytes, for cached tile content not needed this frame.
|
|
254
|
+
*
|
|
255
|
+
* Current-frame tiles remain protected even when their estimated memory exceeds this target.
|
|
256
|
+
* Reducing the value makes unused least-recently-used tiles eligible for eviction on the next
|
|
257
|
+
* traversal.
|
|
258
|
+
* @default 536870912 for 3D Tiles; 33554432 for I3S
|
|
259
|
+
*/
|
|
260
|
+
get cacheBytes() {
|
|
261
|
+
return this._cacheBytes;
|
|
262
|
+
}
|
|
263
|
+
set cacheBytes(value) {
|
|
264
|
+
this._cacheBytes = validateCacheByteLength(value, 'cacheBytes');
|
|
265
|
+
this.options.cacheBytes = this._cacheBytes;
|
|
266
|
+
this.options.maximumMemoryUsage = this._cacheBytes / BYTES_PER_MEBIBYTE;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Gets or sets the additional current-frame headroom, in bytes, before memory-adjusted SSE rises.
|
|
270
|
+
*
|
|
271
|
+
* The pressure ceiling is `cacheBytes + maximumCacheOverflowBytes`. This value does not change
|
|
272
|
+
* the base target used to evict tiles that were not touched in the current frame.
|
|
273
|
+
* @default 536870912 for 3D Tiles; 1048576 for I3S
|
|
274
|
+
*/
|
|
275
|
+
get maximumCacheOverflowBytes() {
|
|
276
|
+
return this._maximumCacheOverflowBytes;
|
|
277
|
+
}
|
|
278
|
+
set maximumCacheOverflowBytes(value) {
|
|
279
|
+
this._maximumCacheOverflowBytes = validateCacheByteLength(value, 'maximumCacheOverflowBytes');
|
|
280
|
+
this.options.maximumCacheOverflowBytes = this._maximumCacheOverflowBytes;
|
|
281
|
+
this.options.memoryCacheOverflow = this._maximumCacheOverflowBytes / BYTES_PER_MEBIBYTE;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Gets or sets the soft cache target in mebibytes.
|
|
285
|
+
* @deprecated Use {@link Tileset3D.cacheBytes}. Assignments remain synchronized for compatibility.
|
|
286
|
+
*/
|
|
287
|
+
get maximumMemoryUsage() {
|
|
288
|
+
return this.cacheBytes / BYTES_PER_MEBIBYTE;
|
|
289
|
+
}
|
|
290
|
+
set maximumMemoryUsage(value) {
|
|
291
|
+
this.cacheBytes = validateCacheByteLength(value * BYTES_PER_MEBIBYTE, 'maximumMemoryUsage');
|
|
292
|
+
}
|
|
156
293
|
get queryParams() {
|
|
157
294
|
const rootUrl = this.source.getTileUrl(this.url);
|
|
158
295
|
const queryIndex = rootUrl.indexOf('?');
|
|
159
296
|
return queryIndex >= 0 ? rootUrl.slice(queryIndex + 1) : '';
|
|
160
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Updates traversal and runtime options, synchronizing byte-native and deprecated cache values.
|
|
300
|
+
*
|
|
301
|
+
* For each budget, the byte-native option takes precedence when both unit forms are supplied.
|
|
302
|
+
* Unspecified budgets retain their current byte values, avoiding repeated MiB conversion.
|
|
303
|
+
*
|
|
304
|
+
* @param props - Partial runtime options to apply.
|
|
305
|
+
*/
|
|
161
306
|
setProps(props) {
|
|
162
|
-
|
|
307
|
+
const cacheBytes = resolveCacheBytes(props, this.cacheBytes);
|
|
308
|
+
const maximumCacheOverflowBytes = resolveMaximumCacheOverflowBytes(props, this.maximumCacheOverflowBytes);
|
|
309
|
+
this.options = {
|
|
310
|
+
...this.options,
|
|
311
|
+
...props,
|
|
312
|
+
cacheBytes,
|
|
313
|
+
maximumCacheOverflowBytes,
|
|
314
|
+
maximumMemoryUsage: cacheBytes / BYTES_PER_MEBIBYTE,
|
|
315
|
+
memoryCacheOverflow: maximumCacheOverflowBytes / BYTES_PER_MEBIBYTE
|
|
316
|
+
};
|
|
317
|
+
this._cacheBytes = cacheBytes;
|
|
318
|
+
this._maximumCacheOverflowBytes = maximumCacheOverflowBytes;
|
|
163
319
|
}
|
|
164
320
|
getTileUrl(tilePath) {
|
|
165
321
|
return this.source.getTileUrl(tilePath);
|
|
@@ -198,11 +354,18 @@ export class Tileset3D {
|
|
|
198
354
|
}
|
|
199
355
|
return this.updatePromise;
|
|
200
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Moves the active LOD threshold toward the configured SSE or away from cache pressure.
|
|
359
|
+
*
|
|
360
|
+
* Usage below {@link Tileset3D.cacheBytes} restores quality in two-percent steps. Usage above
|
|
361
|
+
* `cacheBytes + maximumCacheOverflowBytes` reduces refinement in two-percent steps. Values in
|
|
362
|
+
* the overflow window leave the threshold unchanged, preventing rapid load/evict oscillation.
|
|
363
|
+
*/
|
|
201
364
|
adjustScreenSpaceError() {
|
|
202
|
-
if (this.gpuMemoryUsageInBytes < this.
|
|
365
|
+
if (this.gpuMemoryUsageInBytes < this.cacheBytes) {
|
|
203
366
|
this.memoryAdjustedScreenSpaceError = Math.max(this.memoryAdjustedScreenSpaceError / 1.02, this.options.maximumScreenSpaceError);
|
|
204
367
|
}
|
|
205
|
-
else if (this.gpuMemoryUsageInBytes > this.
|
|
368
|
+
else if (this.gpuMemoryUsageInBytes > this.cacheBytes + this.maximumCacheOverflowBytes) {
|
|
206
369
|
this.memoryAdjustedScreenSpaceError *= 1.02;
|
|
207
370
|
}
|
|
208
371
|
}
|
|
@@ -217,6 +380,8 @@ export class Tileset3D {
|
|
|
217
380
|
this._cache.reset();
|
|
218
381
|
this._frameNumber++;
|
|
219
382
|
this.traverseCounter = preparedViewports.length;
|
|
383
|
+
const currentTime = Date.now();
|
|
384
|
+
let minimumDeferredTraversalDelay = Number.POSITIVE_INFINITY;
|
|
220
385
|
const viewportsToTraverse = [];
|
|
221
386
|
for (const viewport of preparedViewports) {
|
|
222
387
|
const id = viewport.id;
|
|
@@ -236,7 +401,57 @@ export class Tileset3D {
|
|
|
236
401
|
continue;
|
|
237
402
|
}
|
|
238
403
|
const frameState = getFrameState(viewport, this._frameNumber);
|
|
239
|
-
this.
|
|
404
|
+
const root = this.roots[id];
|
|
405
|
+
const cameraMotionUpdate = updateCameraMotionState(this._cameraMotionStates[id], frameState.camera.position, frameState.camera.direction, currentTime);
|
|
406
|
+
this._cameraMotionStates[id] = cameraMotionUpdate.state;
|
|
407
|
+
frameState.camera.timeSinceMovement = cameraMotionUpdate.timeSinceMovement;
|
|
408
|
+
// Dynamic SSE reads the root's inverse computed transform before traversal updates tile
|
|
409
|
+
// visibility. Refresh it from the current tileset model matrix here so animated local
|
|
410
|
+
// box/sphere tilesets never calculate their height falloff one transform behind the frame.
|
|
411
|
+
updateRootTransformForDynamicScreenSpaceError(root, this.modelMatrix);
|
|
412
|
+
frameState.dynamicScreenSpaceErrorDensity =
|
|
413
|
+
this.type === TILESET_TYPE.TILES3D &&
|
|
414
|
+
this.options.dynamicScreenSpaceError &&
|
|
415
|
+
!frameState.viewport.orthographic
|
|
416
|
+
? calculateDynamicScreenSpaceErrorDensity(root, frameState, this.options)
|
|
417
|
+
: 0;
|
|
418
|
+
// Keep the legacy diagnostic field, but traversal reads the per-viewport frame value above.
|
|
419
|
+
this.dynamicScreenSpaceErrorComputedDensity = frameState.dynamicScreenSpaceErrorDensity;
|
|
420
|
+
this._traverser.traverse(root, frameState, this.options);
|
|
421
|
+
if (Object.keys(this._traverser.deferredTiles).length > 0) {
|
|
422
|
+
minimumDeferredTraversalDelay = Math.min(minimumDeferredTraversalDelay, Math.max(this.options.foveatedTimeDelay - cameraMotionUpdate.timeSinceMovement, 0));
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
if (Number.isFinite(minimumDeferredTraversalDelay)) {
|
|
426
|
+
this._scheduleDeferredTraversal(minimumDeferredTraversalDelay);
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
this._clearDeferredTraversal();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Schedules one follow-up traversal when the moving-camera deferral window expires.
|
|
434
|
+
*
|
|
435
|
+
* Replacing an existing timer ensures continuing camera movement pushes the retry window forward
|
|
436
|
+
* instead of creating a queue of redundant traversals.
|
|
437
|
+
*
|
|
438
|
+
* @param delayInSeconds - Remaining stationary delay before deferred requests become eligible.
|
|
439
|
+
*/
|
|
440
|
+
_scheduleDeferredTraversal(delayInSeconds) {
|
|
441
|
+
this._clearDeferredTraversal();
|
|
442
|
+
this._deferredTraversalTimeout = setTimeout(() => {
|
|
443
|
+
this._deferredTraversalTimeout = null;
|
|
444
|
+
this.selectTiles().catch((error) => {
|
|
445
|
+
const traversalError = error instanceof Error ? error : new Error(String(error));
|
|
446
|
+
this._onTilesetError(traversalError);
|
|
447
|
+
});
|
|
448
|
+
}, Math.max(delayInSeconds * 1000, 0));
|
|
449
|
+
}
|
|
450
|
+
/** Clears a pending moving-camera follow-up traversal. */
|
|
451
|
+
_clearDeferredTraversal() {
|
|
452
|
+
if (this._deferredTraversalTimeout !== null) {
|
|
453
|
+
clearTimeout(this._deferredTraversalTimeout);
|
|
454
|
+
this._deferredTraversalTimeout = null;
|
|
240
455
|
}
|
|
241
456
|
}
|
|
242
457
|
_needTraverse(viewportId) {
|
|
@@ -337,6 +552,9 @@ export class Tileset3D {
|
|
|
337
552
|
}
|
|
338
553
|
_unloadTiles() {
|
|
339
554
|
this._cache.unloadTiles(this, (tileset, tile) => tileset._unloadTile(tile));
|
|
555
|
+
if (this.options.memoryAdjustedScreenSpaceError) {
|
|
556
|
+
this.adjustScreenSpaceError();
|
|
557
|
+
}
|
|
340
558
|
}
|
|
341
559
|
_updateStats() {
|
|
342
560
|
let tilesRenderable = 0;
|
|
@@ -425,6 +643,29 @@ export class Tileset3D {
|
|
|
425
643
|
this._onTileLoad(tile, loadResult);
|
|
426
644
|
}
|
|
427
645
|
}
|
|
646
|
+
/**
|
|
647
|
+
* Loads a source-managed lazy child-header group and reports failures through tile callbacks.
|
|
648
|
+
*
|
|
649
|
+
* Subtree metadata shares the normal loading counters but is not reported as render content and
|
|
650
|
+
* is not added to the GPU cache. Traversal is notified separately after the promise settles.
|
|
651
|
+
*
|
|
652
|
+
* @param tile - Runtime tile that owns the lazy subtree reference.
|
|
653
|
+
* @param frameState - View state that made the subtree eligible for refinement.
|
|
654
|
+
*/
|
|
655
|
+
async _loadTileChildren(tile, frameState) {
|
|
656
|
+
try {
|
|
657
|
+
this._onStartTileLoading();
|
|
658
|
+
await tile.loadChildren(frameState);
|
|
659
|
+
}
|
|
660
|
+
catch (error) {
|
|
661
|
+
const tileError = error instanceof Error ? error : new Error('subtree load failed');
|
|
662
|
+
this._onSourceError(tileError, tile);
|
|
663
|
+
this._onTileLoadError(tile, tileError);
|
|
664
|
+
}
|
|
665
|
+
finally {
|
|
666
|
+
this._onEndTileLoading();
|
|
667
|
+
}
|
|
668
|
+
}
|
|
428
669
|
_onTileLoadError(tile, error) {
|
|
429
670
|
this.stats.get(TILES_LOAD_FAILED).incrementCount();
|
|
430
671
|
const message = error.message || error.toString();
|