@spacexr/3d-tiles-runtime 0.0.0-stage → 0.1.0
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 +201 -0
- package/README.md +93 -2
- package/dist/chunk-AI6NWGCA.js +316 -0
- package/dist/chunk-AI6NWGCA.js.map +1 -0
- package/dist/chunk-G7YVZYMR.js +24 -0
- package/dist/chunk-G7YVZYMR.js.map +1 -0
- package/dist/chunk-PJIVVIOF.js +205 -0
- package/dist/chunk-PJIVVIOF.js.map +1 -0
- package/dist/chunk-Q2AL6LWU.js +3 -0
- package/dist/chunk-Q2AL6LWU.js.map +1 -0
- package/dist/chunk-Q35HKP5V.js +249 -0
- package/dist/chunk-Q35HKP5V.js.map +1 -0
- package/dist/chunk-URZDM4BH.js +488 -0
- package/dist/chunk-URZDM4BH.js.map +1 -0
- package/dist/implicit/index.d.ts +64 -0
- package/dist/implicit/index.js +4 -0
- package/dist/implicit/index.js.map +1 -0
- package/dist/index-CNnPRQZc.d.ts +350 -0
- package/dist/index.d.ts +713 -0
- package/dist/index.js +3074 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata/index.d.ts +12 -0
- package/dist/metadata/index.js +3 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/pipeline/index.d.ts +5 -0
- package/dist/pipeline/index.js +3 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/ports/index.d.ts +62 -0
- package/dist/ports/index.js +4 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/resource-DH72MRMN.d.ts +34 -0
- package/dist/spatial/index.d.ts +402 -0
- package/dist/spatial/index.js +3 -0
- package/dist/spatial/index.js.map +1 -0
- package/dist/spatial-3IDPbyv4.d.ts +28 -0
- package/dist/types-Dn5i8Uqg.d.ts +78 -0
- package/dist/types-ri64XfSE.d.ts +237 -0
- package/package.json +102 -5
- package/src/implicit/availability.ts +55 -0
- package/src/implicit/coordinates.ts +193 -0
- package/src/implicit/dense-subtree-loader.ts +23 -0
- package/src/implicit/index.ts +6 -0
- package/src/implicit/standard-subtree-loader.ts +71 -0
- package/src/implicit/tile-data-source.ts +120 -0
- package/src/implicit/types.ts +156 -0
- package/src/index.ts +6 -0
- package/src/metadata/index.ts +2 -0
- package/src/metadata/metadata-resolver.ts +308 -0
- package/src/metadata/types.ts +91 -0
- package/src/pipeline/index.ts +4 -0
- package/src/pipeline/metadata-store.ts +44 -0
- package/src/pipeline/ports.ts +62 -0
- package/src/pipeline/states.ts +56 -0
- package/src/pipeline/tile-3d.ts +165 -0
- package/src/ports/camera.ts +12 -0
- package/src/ports/content.ts +71 -0
- package/src/ports/glyph.ts +13 -0
- package/src/ports/index.ts +32 -0
- package/src/ports/resource.ts +54 -0
- package/src/ports/spatial.ts +28 -0
- package/src/ports/telemetry.ts +44 -0
- package/src/runtime/cache.ts +112 -0
- package/src/runtime/contracts.ts +77 -0
- package/src/runtime/events.ts +57 -0
- package/src/runtime/hooks.ts +99 -0
- package/src/runtime/index.ts +7 -0
- package/src/runtime/instrumentation.ts +163 -0
- package/src/runtime/priority-scheduler.ts +88 -0
- package/src/runtime/quadtree-balance.ts +215 -0
- package/src/runtime/tile-runtime.ts +3508 -0
- package/src/spatial/bounding-volumes.ts +159 -0
- package/src/spatial/ecef-types.ts +110 -0
- package/src/spatial/ecef.ts +196 -0
- package/src/spatial/index.ts +6 -0
- package/src/spatial/utm-bounds.ts +151 -0
- package/src/spatial/utm-types.ts +83 -0
- package/src/spatial/vertical-scale.ts +125 -0
- package/src/spatial/view-metrics.ts +132 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
export { DenseImplicitSubtreeLoader, FetchByteResourceLoader, FetchFunction, IByteResourceLoadRequest, IByteResourceLoader, IStandardImplicitSubtreeLoaderOptions, LoadedSubtreeAvailability, StandardImplicitSubtreeLoader, SubtreeAvailabilityError, computeImplicitTile, expandImplicitTemplate, implicitAvailabilityIndex, implicitBranchingFactor, implicitChildCoordinates, implicitLevelOffset, implicitLocalCoordinates, implicitMortonIndex, subdivideImplicitBoundingVolume } from './implicit/index.js';
|
|
2
|
+
import { c as IRuntimeImplicitSubtree, d as ILoadedImplicitSubtree, e as ITileAddress, C as CameraChangeFlags } from './types-ri64XfSE.js';
|
|
3
|
+
export { f as IImplicitCoordinates, g as IImplicitMetadataDecodeRequest, h as IImplicitMetadataDecodeResult, b as IImplicitMetadataDecoder, i as IImplicitSubtreeGraft, j as IImplicitSubtreeLoadRequest, I as IImplicitSubtreeLoader, k as IImplicitTileAddressContext, l as IImplicitTileOverride, m as IImplicitTileResolveContext, a as IImplicitTileResolver, n as IImplicitTilesetDecoratorOptions, o as IRuntimeImplicitContext, p as IRuntimeImplicitTile, q as ISubtreeAvailability, r as ITileDataSource, s as ITileDataSourceTile, t as ImplicitSubtreeStatus, u as ImplicitTilesetDecorator, M as MetadataHandle, N as NO_METADATA, T as TileContentKind, v as TileMetadataState, w as TilePresentationState, x as TileReadinessState, y as TileRefinementMode, z as TileSelectionState } from './types-ri64XfSE.js';
|
|
4
|
+
export { DEFAULT_METADATA_SCOPE_ORDER, MetadataResolver } from './metadata/index.js';
|
|
5
|
+
import { I as IMetadataSnapshot } from './types-Dn5i8Uqg.js';
|
|
6
|
+
export { a as IMetadataAncestorInput, b as IMetadataDiagnostic, c as IMetadataDocumentContext, d as IMetadataResolutionInput, e as IResolvedMetadataEntity, f as IResolvedMetadataProperty, g as IRuntimeFeatureMetadata, M as MetadataDiagnosticSeverity, h as MetadataScopeKind, i as MetadataScopeOrder } from './types-Dn5i8Uqg.js';
|
|
7
|
+
import { f as IRuntimeTilesetDocument, g as IRuntimeFrameResult, h as IRuntimeTile, i as IRuntimeContent, j as IRuntimeCacheEviction, k as IRuntimeQuadtreeImbalance, C as ContentLoadResult, l as IRuntimeCacheCounters, m as IResolvedRuntimeCacheOptions, n as IRuntimeCacheOptions, R as RuntimeMetadataStore, o as RuntimeTilePredicate } from './index-CNnPRQZc.js';
|
|
8
|
+
export { D as DEFAULT_RUNTIME_CACHE_OPTIONS, d as IContentLoadContext, e as IContentPresentationContext, p as IMetadataStore, q as IRuntimeResourceCost, r as ITile3DInitialization, b as ITileActivationAdapter, s as ITileActivationContext, a as ITileContentAdapter, I as ITileContext, t as ITileDeactivationContext, c as ITilePresentationAdapter, u as ITilePresentationContext, v as ITilePresentationResource, w as ITileReadinessPort, x as RuntimeCacheEvictionReason, y as RuntimeCacheResourceKind, z as RuntimeContentKind, A as RuntimeContentStatus, T as Tile3D, B as Tile3DContent, E as resolveRuntimeCacheOptions } from './index-CNnPRQZc.js';
|
|
9
|
+
import { IRuntimeMetric, RuntimeMetricName, IRuntimeAdapter } from './ports/index.js';
|
|
10
|
+
export { ICameraEventSource, ICameraFrameSource, IGlyphPublicationContext, IGlyphPublisher, IRuntimeSubscription, IRuntimeTelemetry } from './ports/index.js';
|
|
11
|
+
import { c as ILoadedTileset } from './resource-DH72MRMN.js';
|
|
12
|
+
export { d as IMetadataSchemaLoadRequest, a as IMetadataSchemaLoader, b as IRuntimeUriResolver, e as ITilesetLoadRequest, I as ITilesetLoader, S as StandardUriResolver } from './resource-DH72MRMN.js';
|
|
13
|
+
import { ITileTopology } from '@spacexr/tiles';
|
|
14
|
+
import { IContent } from '@spacexr/3d-tiles-core';
|
|
15
|
+
import { VerticalScale } from './spatial/index.js';
|
|
16
|
+
export { EcefSpatialMetric, GeoidUndulationModel, HorizontalDatumResolver, IAxisAlignedBox, IBoundingSphere3, IEcefCameraFrame, IEcefSpatialMetricOptions, IEcefSpatialState, IHorizontalDatumTransformation, IPlane, IProjectionFallback, IUtmBounds, IUtmPlacement, IUtmPlacementOptions, IVector3, IVerticalFrame, IVerticalPlacement, IViewMetrics, IViewMetricsOptions, UtmPlacementStatus, UtmVerticalOrigin, boundsFromUtm, defaultHorizontalDatumResolver, describeView, ellipsoidalHeightRange, geodeticVerticalFrame, metresPerPixel, placeVertically, radialVerticalFrame, verticalDisplacement } from './spatial/index.js';
|
|
17
|
+
export { a as IScreenSpaceErrorContext, b as ISpatialDerivationContext, I as ISpatialMetric } from './spatial-3IDPbyv4.js';
|
|
18
|
+
import '@spacexr/geodesy';
|
|
19
|
+
import '@spacexr/geometry';
|
|
20
|
+
|
|
21
|
+
type RuntimeEvent<TSpatial, TContentHandle, TGlyphHandle> = {
|
|
22
|
+
type: "tileset-ready";
|
|
23
|
+
document: IRuntimeTilesetDocument;
|
|
24
|
+
} | {
|
|
25
|
+
type: "frame";
|
|
26
|
+
result: IRuntimeFrameResult<TSpatial, TContentHandle, TGlyphHandle>;
|
|
27
|
+
} | {
|
|
28
|
+
type: "tile-selected";
|
|
29
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
30
|
+
} | {
|
|
31
|
+
type: "tile-deselected";
|
|
32
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
33
|
+
} | {
|
|
34
|
+
type: "tile-activated";
|
|
35
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
36
|
+
} | {
|
|
37
|
+
type: "tile-deactivated";
|
|
38
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The tile spatial state was re-derived: from a volume measured on its own content (`content`), or from the
|
|
42
|
+
* implicit resolver again once the parent content became ready (`parent-content`).
|
|
43
|
+
*/
|
|
44
|
+
| {
|
|
45
|
+
type: "tile-bounds-refined";
|
|
46
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
47
|
+
origin: "content" | "parent-content" | "vertical-scale";
|
|
48
|
+
} | {
|
|
49
|
+
type: "content-state";
|
|
50
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
51
|
+
content: IRuntimeContent<TContentHandle>;
|
|
52
|
+
} | {
|
|
53
|
+
type: "subtree-state";
|
|
54
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
55
|
+
subtree: IRuntimeImplicitSubtree;
|
|
56
|
+
} | {
|
|
57
|
+
type: "metadata-resolved";
|
|
58
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
59
|
+
snapshot: IMetadataSnapshot;
|
|
60
|
+
} | {
|
|
61
|
+
type: "cache-eviction";
|
|
62
|
+
eviction: IRuntimeCacheEviction;
|
|
63
|
+
}
|
|
64
|
+
/** The selected cut still joins levels two or more apart on some edges; see `IRuntimeFrameResult.unbalanced`. */
|
|
65
|
+
| {
|
|
66
|
+
type: "quadtree-imbalance";
|
|
67
|
+
frame: number;
|
|
68
|
+
imbalances: readonly IRuntimeQuadtreeImbalance<TSpatial, TContentHandle, TGlyphHandle>[];
|
|
69
|
+
} | {
|
|
70
|
+
type: "error";
|
|
71
|
+
phase: string;
|
|
72
|
+
error: unknown;
|
|
73
|
+
tileId?: string;
|
|
74
|
+
contentId?: string;
|
|
75
|
+
};
|
|
76
|
+
type RuntimeEventListener<TSpatial, TContentHandle, TGlyphHandle> = (event: RuntimeEvent<TSpatial, TContentHandle, TGlyphHandle>) => void;
|
|
77
|
+
declare class RuntimeEventHub<TSpatial, TContentHandle, TGlyphHandle> {
|
|
78
|
+
private readonly listeners;
|
|
79
|
+
subscribe(listener: RuntimeEventListener<TSpatial, TContentHandle, TGlyphHandle>): () => void;
|
|
80
|
+
emit(event: RuntimeEvent<TSpatial, TContentHandle, TGlyphHandle>): void;
|
|
81
|
+
clear(): void;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type HookResult = void | Promise<void>;
|
|
85
|
+
interface ITilesetLoadHookContext {
|
|
86
|
+
runtimeId: string;
|
|
87
|
+
uri: string;
|
|
88
|
+
parentDocumentUri?: string;
|
|
89
|
+
}
|
|
90
|
+
interface ITilesetLoadedHookContext extends ITilesetLoadHookContext {
|
|
91
|
+
loaded: ILoadedTileset;
|
|
92
|
+
document?: IRuntimeTilesetDocument;
|
|
93
|
+
}
|
|
94
|
+
interface IFrameHookContext<TCamera, TSpatial, TContentHandle, TGlyphHandle> {
|
|
95
|
+
runtimeId: string;
|
|
96
|
+
frame: number;
|
|
97
|
+
camera: TCamera;
|
|
98
|
+
result?: IRuntimeFrameResult<TSpatial, TContentHandle, TGlyphHandle>;
|
|
99
|
+
}
|
|
100
|
+
interface ITileHookContext<TSpatial, TContentHandle, TGlyphHandle> {
|
|
101
|
+
runtimeId: string;
|
|
102
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
103
|
+
}
|
|
104
|
+
interface IContentHookContext<TSpatial, TContentHandle, TGlyphHandle> extends ITileHookContext<TSpatial, TContentHandle, TGlyphHandle> {
|
|
105
|
+
content: IRuntimeContent<TContentHandle>;
|
|
106
|
+
result?: ContentLoadResult<TContentHandle>;
|
|
107
|
+
metadata?: IMetadataSnapshot;
|
|
108
|
+
}
|
|
109
|
+
interface ISubtreeHookContext<TSpatial, TContentHandle, TGlyphHandle> extends ITileHookContext<TSpatial, TContentHandle, TGlyphHandle> {
|
|
110
|
+
subtree: IRuntimeImplicitSubtree;
|
|
111
|
+
loaded?: ILoadedImplicitSubtree;
|
|
112
|
+
}
|
|
113
|
+
interface IMetadataHookContext<TSpatial, TContentHandle, TGlyphHandle> extends ITileHookContext<TSpatial, TContentHandle, TGlyphHandle> {
|
|
114
|
+
snapshot: IMetadataSnapshot;
|
|
115
|
+
}
|
|
116
|
+
interface IRuntimeErrorHookContext<TSpatial, TContentHandle, TGlyphHandle> {
|
|
117
|
+
runtimeId: string;
|
|
118
|
+
phase: string;
|
|
119
|
+
error: unknown;
|
|
120
|
+
tile?: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
121
|
+
content?: IRuntimeContent<TContentHandle>;
|
|
122
|
+
}
|
|
123
|
+
interface ICacheEvictionHookContext<TSpatial, TContentHandle, TGlyphHandle> {
|
|
124
|
+
runtimeId: string;
|
|
125
|
+
eviction: IRuntimeCacheEviction;
|
|
126
|
+
tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
|
|
127
|
+
content?: IRuntimeContent<TContentHandle>;
|
|
128
|
+
subtree?: IRuntimeImplicitSubtree;
|
|
129
|
+
}
|
|
130
|
+
interface IRuntimeHooks<TCamera, TSpatial, TContentHandle, TGlyphHandle> {
|
|
131
|
+
beforeTilesetLoad?(context: ITilesetLoadHookContext): HookResult;
|
|
132
|
+
afterTilesetLoad?(context: ITilesetLoadedHookContext): HookResult;
|
|
133
|
+
beforeFrame?(context: IFrameHookContext<TCamera, TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
134
|
+
afterFrame?(context: IFrameHookContext<TCamera, TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
135
|
+
beforeContentLoad?(context: IContentHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
136
|
+
afterContentLoad?(context: IContentHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
137
|
+
beforeSubtreeLoad?(context: ISubtreeHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
138
|
+
afterSubtreeLoad?(context: ISubtreeHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
139
|
+
beforeContentAttach?(context: IContentHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
140
|
+
afterContentAttach?(context: IContentHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
141
|
+
beforeContentDetach?(context: IContentHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
142
|
+
afterContentDetach?(context: IContentHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
143
|
+
beforeMetadataResolve?(context: ITileHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
144
|
+
afterMetadataResolve?(context: IMetadataHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
145
|
+
beforeGlyphPublish?(context: ITileHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
146
|
+
afterGlyphPublish?(context: ITileHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
147
|
+
beforeGlyphRevoke?(context: ITileHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
148
|
+
afterGlyphRevoke?(context: ITileHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
149
|
+
onTileSelected?(context: ITileHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
150
|
+
onTileDeselected?(context: ITileHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
151
|
+
beforeCacheEviction?(context: ICacheEvictionHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
152
|
+
afterCacheEviction?(context: ICacheEvictionHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
153
|
+
onError?(context: IRuntimeErrorHookContext<TSpatial, TContentHandle, TGlyphHandle>): HookResult;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
interface IRuntimeInstrumentationOptions {
|
|
157
|
+
enabled?: boolean;
|
|
158
|
+
}
|
|
159
|
+
interface IRuntimeMetricAggregate {
|
|
160
|
+
count: number;
|
|
161
|
+
sum: number;
|
|
162
|
+
min: number;
|
|
163
|
+
max: number;
|
|
164
|
+
latest: number;
|
|
165
|
+
unit: IRuntimeMetric["unit"];
|
|
166
|
+
}
|
|
167
|
+
interface IRuntimeNodeStatistics {
|
|
168
|
+
total: number;
|
|
169
|
+
explicit: number;
|
|
170
|
+
implicit: number;
|
|
171
|
+
selected: number;
|
|
172
|
+
visible: number;
|
|
173
|
+
/** Selected tiles next to a tile coarser than `maxLevelDifference` allows in the last frame, with `quadtreeBalance`. */
|
|
174
|
+
unbalanced: number;
|
|
175
|
+
}
|
|
176
|
+
interface IRuntimeContentStatistics {
|
|
177
|
+
total: number;
|
|
178
|
+
idle: number;
|
|
179
|
+
queued: number;
|
|
180
|
+
loading: number;
|
|
181
|
+
ready: number;
|
|
182
|
+
error: number;
|
|
183
|
+
cancelled: number;
|
|
184
|
+
attached: number;
|
|
185
|
+
cached: number;
|
|
186
|
+
cpuBytes: number;
|
|
187
|
+
gpuBytes: number;
|
|
188
|
+
networkBytes: number;
|
|
189
|
+
}
|
|
190
|
+
interface IRuntimeSubtreeStatistics {
|
|
191
|
+
total: number;
|
|
192
|
+
idle: number;
|
|
193
|
+
queued: number;
|
|
194
|
+
loading: number;
|
|
195
|
+
ready: number;
|
|
196
|
+
error: number;
|
|
197
|
+
cancelled: number;
|
|
198
|
+
cached: number;
|
|
199
|
+
bytes: number;
|
|
200
|
+
}
|
|
201
|
+
interface IRuntimeCacheStatistics extends IRuntimeCacheCounters {
|
|
202
|
+
enabled: boolean;
|
|
203
|
+
limits: IResolvedRuntimeCacheOptions;
|
|
204
|
+
}
|
|
205
|
+
interface IRuntimeStateStatistics {
|
|
206
|
+
frame: number;
|
|
207
|
+
pendingLoads: number;
|
|
208
|
+
nodes: IRuntimeNodeStatistics;
|
|
209
|
+
contents: IRuntimeContentStatistics;
|
|
210
|
+
subtrees: IRuntimeSubtreeStatistics;
|
|
211
|
+
cache: IRuntimeCacheStatistics;
|
|
212
|
+
}
|
|
213
|
+
interface IRuntimeStatisticsSnapshot extends IRuntimeStateStatistics {
|
|
214
|
+
runtimeId: string;
|
|
215
|
+
timestamp: number;
|
|
216
|
+
collectionStartedAt: number;
|
|
217
|
+
metrics: Readonly<Partial<Record<RuntimeMetricName, IRuntimeMetricAggregate>>>;
|
|
218
|
+
}
|
|
219
|
+
type RuntimeStatisticsListener = (snapshot: IRuntimeStatisticsSnapshot) => void;
|
|
220
|
+
declare class RuntimeInstrumentation {
|
|
221
|
+
private readonly runtimeId;
|
|
222
|
+
private readonly stateProvider;
|
|
223
|
+
private collectionEnabled;
|
|
224
|
+
private collectionStartedAt;
|
|
225
|
+
private readonly aggregates;
|
|
226
|
+
private readonly listeners;
|
|
227
|
+
constructor(options: boolean | IRuntimeInstrumentationOptions | undefined, runtimeId: string, stateProvider: () => IRuntimeStateStatistics);
|
|
228
|
+
get enabled(): boolean;
|
|
229
|
+
get hasSubscribers(): boolean;
|
|
230
|
+
setEnabled(enabled: boolean): void;
|
|
231
|
+
reset(): void;
|
|
232
|
+
record(metric: IRuntimeMetric): void;
|
|
233
|
+
snapshot(): IRuntimeStatisticsSnapshot;
|
|
234
|
+
subscribe(listener: RuntimeStatisticsListener): () => void;
|
|
235
|
+
publish(): void;
|
|
236
|
+
clear(): void;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Address of a quadtree tile within a namespace: one implicit tileset, or a pyramid shared by several. */
|
|
240
|
+
interface IQuadtreeTileLocation {
|
|
241
|
+
/** Prefix shared by the tiles that can be neighbours. */
|
|
242
|
+
namespace: string;
|
|
243
|
+
address: ITileAddress;
|
|
244
|
+
/** Wraps columns around the antimeridian, for pyramids covering every longitude. */
|
|
245
|
+
wrapX: boolean;
|
|
246
|
+
/** How the tiles connect, for example across configured roots, in place of `wrapX`. */
|
|
247
|
+
topology?: ITileTopology;
|
|
248
|
+
}
|
|
249
|
+
declare function quadtreeTileKey(namespace: string, address: ITileAddress): string;
|
|
250
|
+
/**
|
|
251
|
+
* Whether a tile is the neighbour of one of some tiles: it touches one of them, by an edge or a corner, that is at its
|
|
252
|
+
* level or coarser. A tile coarser than the one it touches is not its neighbour.
|
|
253
|
+
*
|
|
254
|
+
* @param location - The tile.
|
|
255
|
+
* @param tiles - Keys built with {@link quadtreeTileKey}.
|
|
256
|
+
*/
|
|
257
|
+
declare function quadtreeTouches(location: IQuadtreeTileLocation, tiles: ReadonlySet<string>): boolean;
|
|
258
|
+
/** A displayed tile next to a displayed tile more levels coarser than allowed. */
|
|
259
|
+
interface IQuadtreeImbalance<T> {
|
|
260
|
+
fine: T;
|
|
261
|
+
/** Level of the coarser neighbour. */
|
|
262
|
+
coarseLod: number;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Pairs of displayed tiles sharing an edge whose levels differ by more than `maxLevelDifference`, reported from the
|
|
266
|
+
* finer tile.
|
|
267
|
+
*
|
|
268
|
+
* @param displayed - Displayed tiles with their location and a value returned in the result.
|
|
269
|
+
* @param maxLevelDifference - Largest difference allowed between edge neighbours. Defaults to 1, the 2:1 balance.
|
|
270
|
+
*/
|
|
271
|
+
declare function quadtreeImbalances<T>(displayed: Iterable<{
|
|
272
|
+
location: IQuadtreeTileLocation;
|
|
273
|
+
value: T;
|
|
274
|
+
}>, maxLevelDifference?: number): IQuadtreeImbalance<T>[];
|
|
275
|
+
/**
|
|
276
|
+
* Tiles that must refine so that every displayed tile has its edge neighbours within `maxLevelDifference` levels of
|
|
277
|
+
* detail: one by default, the 2:1 balance. For each displayed tile of level `L` and each edge neighbour at level `L`,
|
|
278
|
+
* every ancestor of that neighbour at level `L - maxLevelDifference - 1` or coarser must refine: such an ancestor would
|
|
279
|
+
* otherwise be displayed next to the tile, too many levels apart. Diagonal neighbours do not matter, because tile
|
|
280
|
+
* corners exist at every level.
|
|
281
|
+
*
|
|
282
|
+
* @returns Keys built with {@link quadtreeTileKey}.
|
|
283
|
+
*/
|
|
284
|
+
declare function quadtreeBalanceRefinements(displayed: Iterable<IQuadtreeTileLocation>, maxLevelDifference?: number): Set<string>;
|
|
285
|
+
/** A leaf of a ready quadtree cut. */
|
|
286
|
+
interface IQuadtreeCutTile<T> {
|
|
287
|
+
location: IQuadtreeTileLocation;
|
|
288
|
+
value: T;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Admits a ready cut exclusively by refining incompatible coarse neighbours. Existing fine leaves never coarsen.
|
|
292
|
+
* Each successful split strictly increases depth; only its front and the fine leaf return to the local queue.
|
|
293
|
+
* A cold front is requested once, and makes the whole transaction inadmissible without publishing a partial cut.
|
|
294
|
+
*
|
|
295
|
+
* @param blocked - Receives, for each edge a cold front leaves more than `maxLevelDifference` levels apart, the tiles
|
|
296
|
+
* of `displayed` that led to it: the coarse tile, or the one it was split from, and the fine tile with every tile split
|
|
297
|
+
* for it.
|
|
298
|
+
* @param maxLevelDifference - Largest difference allowed between edge neighbours. Defaults to 1, the 2:1 balance.
|
|
299
|
+
*/
|
|
300
|
+
declare function refineQuadtreeCut<T>(displayed: Iterable<IQuadtreeCutTile<T>>, refine: (coarse: IQuadtreeCutTile<T>) => readonly IQuadtreeCutTile<T>[] | undefined, blocked?: (involved: readonly IQuadtreeCutTile<T>[]) => void, maxLevelDifference?: number): IQuadtreeCutTile<T>[] | undefined;
|
|
301
|
+
|
|
302
|
+
interface ITileRuntimeOptions<TCamera, TSpatial, TContentHandle, TGlyphHandle> {
|
|
303
|
+
id: string;
|
|
304
|
+
uri: string;
|
|
305
|
+
adapter: IRuntimeAdapter<TCamera, TSpatial, TContentHandle, TGlyphHandle>;
|
|
306
|
+
/**
|
|
307
|
+
* Selection policy shared by every content type and renderer. The base policy traverses visible tiles only,
|
|
308
|
+
* waits for the replacement front, and closes its ready quadtree cut before presentation. The active policy is
|
|
309
|
+
* retained for integrations not yet migrated. Defaults to active.
|
|
310
|
+
*/
|
|
311
|
+
selectionStrategy?: "base" | "active";
|
|
312
|
+
/**
|
|
313
|
+
* How a tile with nothing to present refines. With "always", such a tile is a structural node: it refines whatever its
|
|
314
|
+
* screen-space error. With "geometric-error", its geometric error applies, as 3D Tiles 1.1 does for every tile: an
|
|
315
|
+
* explicit tile whose contents are all known empty and ready, a tile without content included, refines only when its
|
|
316
|
+
* screen-space error requires it. Otherwise it presents nothing, its descendants are not loaded, and under REPLACE it
|
|
317
|
+
* still completes the replacement of its parent. A tile with an external tileset, with a content not loaded yet, or an
|
|
318
|
+
* implicit tile always refines. Defaults to "always".
|
|
319
|
+
*/
|
|
320
|
+
emptyTileRefinement?: "always" | "geometric-error";
|
|
321
|
+
maxScreenSpaceError?: number;
|
|
322
|
+
maxScreenSpaceErrorForDepth?: (depth: number, defaultValue: number) => number;
|
|
323
|
+
/**
|
|
324
|
+
* Fraction of the SSE threshold retained while coarsening. A value of
|
|
325
|
+
* `0.1` refines above the configured threshold and coarsens only below
|
|
326
|
+
* 90 percent of it. This prevents LOD oscillation near the threshold.
|
|
327
|
+
*/
|
|
328
|
+
refinementHysteresisRatio?: number;
|
|
329
|
+
/**
|
|
330
|
+
* Factor on the threshold above which a tile not yet refined refines, read at each frame, at least 1. A renderer can
|
|
331
|
+
* raise it while its camera moves fast: tiles already refined still coarsen against the threshold itself, and a
|
|
332
|
+
* refinement required by the quadtree balance always happens, so that it only holds back new detail. When the factor
|
|
333
|
+
* drops while the camera is still, call {@link TileRuntime.requestFrame}. Defaults to 1.
|
|
334
|
+
*/
|
|
335
|
+
refinementThresholdScale?: () => number;
|
|
336
|
+
/**
|
|
337
|
+
* Time a refined tile stays refined once nothing requires its refinement any more, neither its screen-space error
|
|
338
|
+
* nor the quadtree balance, without interruption. A refinement then survives a neighbour leaving the view for a
|
|
339
|
+
* moment, or a screen-space error dipping under the threshold while the camera turns. When it expires,
|
|
340
|
+
* {@link TileRuntime.hasPendingWork} asks for a frame, even with a still camera. Defaults to 300; 0 coarsens at once.
|
|
341
|
+
*/
|
|
342
|
+
coarseningDelayMilliseconds?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Keeps already selected descendants while their coarser replacement is
|
|
345
|
+
* loading, or as a last-resort fallback when no ready renderable ancestor
|
|
346
|
+
* exists. Correct visual coverage never depends on the cache. Defaults to
|
|
347
|
+
* true.
|
|
348
|
+
*/
|
|
349
|
+
stableReplacementCut?: boolean;
|
|
350
|
+
/**
|
|
351
|
+
* Loads the children of a refined tile that lie outside the view, with a
|
|
352
|
+
* lower priority than visible tiles. A refined tile is replaced by its
|
|
353
|
+
* children only once every visible child is ready; without preloading, a
|
|
354
|
+
* child entering the view as the camera turns is not ready, and the whole
|
|
355
|
+
* refined area falls back to the coarser tile until it loads. Defaults to
|
|
356
|
+
* true; false saves the loads of tiles that may never enter the view.
|
|
357
|
+
*/
|
|
358
|
+
preloadSiblings?: boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Keeps the displayed tiles of implicit QUADTREE tilesets within one level
|
|
361
|
+
* of detail of their edge neighbours (2:1 balance), or within
|
|
362
|
+
* `maxLevelDifference` levels. A tile that would be displayed further from
|
|
363
|
+
* a neighbour is refined in the same frame, even when its screen-space
|
|
364
|
+
* error does not require it, and the loads it needs come first. While they
|
|
365
|
+
* load, the displayed finer tiles are kept, and a refinement that the
|
|
366
|
+
* neighbour cannot follow yet waits. Terrain grids can then connect every
|
|
367
|
+
* edge with junctions of that many levels.
|
|
368
|
+
*
|
|
369
|
+
* Neighbours are found across implicit tilesets when the implicit resolver
|
|
370
|
+
* provides `addressOf`; `wrapX` then also connects the antimeridian of a
|
|
371
|
+
* global pyramid. Defaults to false.
|
|
372
|
+
*/
|
|
373
|
+
quadtreeBalance?: boolean | IQuadtreeBalanceOptions;
|
|
374
|
+
/** Vertical scale of the scene. Its changes derive the spatial state of every tile again. */
|
|
375
|
+
verticalScale?: VerticalScale;
|
|
376
|
+
maxConcurrentLoads?: number;
|
|
377
|
+
maxLoadAttempts?: number;
|
|
378
|
+
cache?: IRuntimeCacheOptions | false;
|
|
379
|
+
/** Clock of the cache retention, in milliseconds. Defaults to `performance.now`. */
|
|
380
|
+
clock?: () => number;
|
|
381
|
+
instrumentation?: boolean | IRuntimeInstrumentationOptions;
|
|
382
|
+
hooks?: readonly IRuntimeHooks<TCamera, TSpatial, TContentHandle, TGlyphHandle>[];
|
|
383
|
+
}
|
|
384
|
+
interface IQuadtreeBalanceOptions {
|
|
385
|
+
/** Wraps columns around the antimeridian for addresses from `IImplicitTileResolver.addressOf`. Defaults to false. */
|
|
386
|
+
wrapX?: boolean;
|
|
387
|
+
/** How addresses from `IImplicitTileResolver.addressOf` connect, for example across configured local frames, in place of `wrapX`. */
|
|
388
|
+
topology?: ITileTopology;
|
|
389
|
+
/**
|
|
390
|
+
* Largest difference of level allowed between edge neighbours. Defaults to 1, the 2:1 balance. A renderer whose
|
|
391
|
+
* junctions join tiles further apart, for example by moving the edge vertices of the fine tile onto the coarse edge,
|
|
392
|
+
* may allow 2 or more: the balance then refines fewer tiles.
|
|
393
|
+
*/
|
|
394
|
+
maxLevelDifference?: number;
|
|
395
|
+
}
|
|
396
|
+
declare class TileRuntime<TCamera, TSpatial, TContentHandle = unknown, TGlyphHandle = unknown> {
|
|
397
|
+
readonly id: string;
|
|
398
|
+
readonly uri: string;
|
|
399
|
+
readonly adapter: IRuntimeAdapter<TCamera, TSpatial, TContentHandle, TGlyphHandle>;
|
|
400
|
+
readonly events: RuntimeEventHub<TSpatial, TContentHandle, TGlyphHandle>;
|
|
401
|
+
readonly instrumentation: RuntimeInstrumentation;
|
|
402
|
+
readonly metadataStore: RuntimeMetadataStore;
|
|
403
|
+
private readonly selectionStrategy;
|
|
404
|
+
private readonly emptyTileRefinement;
|
|
405
|
+
private readonly maxScreenSpaceError;
|
|
406
|
+
private readonly maxScreenSpaceErrorForDepth;
|
|
407
|
+
private readonly refinementHysteresisRatio;
|
|
408
|
+
private readonly refinementThresholdScale;
|
|
409
|
+
private readonly stableReplacementCut;
|
|
410
|
+
private readonly preloadSiblings;
|
|
411
|
+
private readonly coarseningDelayMilliseconds;
|
|
412
|
+
/** Since when each refined tile has no longer required its refinement, and the last frame that saw it so. */
|
|
413
|
+
private readonly coarseningSince;
|
|
414
|
+
/** When the first delayed coarsening of the last frame expires. */
|
|
415
|
+
private nextCoarseningAt;
|
|
416
|
+
/** Priority asked in the current frame for each queued load, whose passes may ask several. */
|
|
417
|
+
private readonly queuedPriorities;
|
|
418
|
+
private queuedPrioritiesFrame;
|
|
419
|
+
private readonly quadtreeBalance;
|
|
420
|
+
/** Keys of the tiles that must refine to keep the quadtree balanced in the current frame. */
|
|
421
|
+
private balanceRefinements;
|
|
422
|
+
/**
|
|
423
|
+
* Refinements the balance of the last published cut required, from which the next frame starts: a tile refined by the
|
|
424
|
+
* balance alone stays required from the first pass, instead of starting a coarsening delay that a later pass cancels.
|
|
425
|
+
*/
|
|
426
|
+
private publishedBalanceRefinements;
|
|
427
|
+
/** Visible selected quadtree tiles of the last traversal, whose neighbours stay active. */
|
|
428
|
+
private visibleTiles;
|
|
429
|
+
/** Tiles whose refinement waits in the current frame, because a neighbour cannot follow yet. */
|
|
430
|
+
private readonly balanceHolds;
|
|
431
|
+
private unbalancedCount;
|
|
432
|
+
private readonly maxLoadAttempts;
|
|
433
|
+
private readonly cacheOptions;
|
|
434
|
+
private readonly cacheCounters;
|
|
435
|
+
private readonly hooks;
|
|
436
|
+
private readonly uriResolver;
|
|
437
|
+
private readonly metadataResolver;
|
|
438
|
+
private readonly scheduler;
|
|
439
|
+
private readonly lifecycleController;
|
|
440
|
+
private readonly nodes;
|
|
441
|
+
/** Latest invalidation of each stale content, and the failed reloads since. */
|
|
442
|
+
private readonly staleContents;
|
|
443
|
+
private readonly refreshes;
|
|
444
|
+
/** Ready contents reported as provisional: stale, and reloaded only while their tile is a leaf of the cut. */
|
|
445
|
+
private readonly provisionalContents;
|
|
446
|
+
private invalidations;
|
|
447
|
+
private readonly refiningNodes;
|
|
448
|
+
private readonly replacementFrontNodes;
|
|
449
|
+
private readonly activeThisFrame;
|
|
450
|
+
private selectedAtFrameStart;
|
|
451
|
+
private baseReplacementBlocked;
|
|
452
|
+
private rootNode?;
|
|
453
|
+
private rootDocument?;
|
|
454
|
+
private cameraSubscription;
|
|
455
|
+
private startPromise?;
|
|
456
|
+
private updateChain;
|
|
457
|
+
private lastCamera?;
|
|
458
|
+
private pendingCamera;
|
|
459
|
+
private pendingCameraChanges;
|
|
460
|
+
private currentCameraChanges;
|
|
461
|
+
private readonly unsubscribeVerticalScale;
|
|
462
|
+
private spatialStale;
|
|
463
|
+
private cameraDirty;
|
|
464
|
+
private frame;
|
|
465
|
+
/** Start time of the recent frames, oldest first; older frames are beyond the cache retention. */
|
|
466
|
+
private readonly frameTimes;
|
|
467
|
+
private readonly clock;
|
|
468
|
+
private disposed;
|
|
469
|
+
private refreshNeeded;
|
|
470
|
+
constructor(options: ITileRuntimeOptions<TCamera, TSpatial, TContentHandle, TGlyphHandle>);
|
|
471
|
+
get root(): IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle> | undefined;
|
|
472
|
+
get document(): IRuntimeTilesetDocument | undefined;
|
|
473
|
+
get pendingLoads(): number;
|
|
474
|
+
/** True when settled asynchronous state still needs a caller-driven frame. */
|
|
475
|
+
get hasPendingWork(): boolean;
|
|
476
|
+
get selectedTiles(): readonly IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>[];
|
|
477
|
+
get cameraChanges(): CameraChangeFlags;
|
|
478
|
+
/** Immediately applies cache budgets. With force=true, every inactive cache entry is released. */
|
|
479
|
+
trimCache(force?: boolean): Promise<void>;
|
|
480
|
+
/**
|
|
481
|
+
* Marks the loaded contents of the tiles a predicate selects as stale, such as the tiles whose region crosses an
|
|
482
|
+
* area whose data changed, and reloads them. Each keeps its current handle presented until its reload is ready:
|
|
483
|
+
* the swap happens between two frames, so the view never shows a hole. Stale contents reload while their tile is
|
|
484
|
+
* in the working set; the others reload when it comes back, and meanwhile still serve as they are.
|
|
485
|
+
*
|
|
486
|
+
* The reload goes through the activation adapter, with `refresh` set, or through the legacy content adapter.
|
|
487
|
+
*
|
|
488
|
+
* @returns The number of tiles invalidated.
|
|
489
|
+
*/
|
|
490
|
+
invalidate(predicate: RuntimeTilePredicate<TSpatial, TContentHandle, TGlyphHandle>): Promise<number>;
|
|
491
|
+
start(): Promise<void>;
|
|
492
|
+
update(camera: TCamera): Promise<IRuntimeFrameResult<TSpatial, TContentHandle, TGlyphHandle>>;
|
|
493
|
+
private enqueueUpdate;
|
|
494
|
+
/** Asks for one more frame with the latest camera, when something the selection reads has changed. */
|
|
495
|
+
requestFrame(): void;
|
|
496
|
+
/** Stores the latest immutable camera frame without starting a traversal. */
|
|
497
|
+
onCameraChanged(camera: TCamera, changes?: CameraChangeFlags): void;
|
|
498
|
+
/** Consumes the latest camera snapshot and runs at most one serialized pipeline frame. */
|
|
499
|
+
processFrame(): Promise<IRuntimeFrameResult<TSpatial, TContentHandle, TGlyphHandle>>;
|
|
500
|
+
whenIdle(): Promise<void>;
|
|
501
|
+
dispose(): Promise<void>;
|
|
502
|
+
protected performUpdate(camera: TCamera): Promise<IRuntimeFrameResult<TSpatial, TContentHandle, TGlyphHandle>>;
|
|
503
|
+
/** Visible traversal shared by explicit tiles, implicit tiles and both rendering backends. */
|
|
504
|
+
private visitBase;
|
|
505
|
+
/**
|
|
506
|
+
* Loads a tile of the periphery of the view, and its descendants down to the threshold, without selecting them: a
|
|
507
|
+
* place that enters the view then finds its tile ready.
|
|
508
|
+
*/
|
|
509
|
+
private preloadBasePeriphery;
|
|
510
|
+
private touchBaseTile;
|
|
511
|
+
private collectBaseReplacementFront;
|
|
512
|
+
private hasSelectedReplacementAncestor;
|
|
513
|
+
private selectBaseTile;
|
|
514
|
+
private selectBaseCoverage;
|
|
515
|
+
private closeBaseQuadtreeCut;
|
|
516
|
+
private baseQuadtreeEntries;
|
|
517
|
+
private refineBaseQuadtreeCut;
|
|
518
|
+
/**
|
|
519
|
+
* Gives back the place of a new tile to what was displayed there: the displayed ancestor that it refines, or the
|
|
520
|
+
* displayed tiles under it that it would coarsen. A place that displayed nothing stays empty until it is ready.
|
|
521
|
+
*/
|
|
522
|
+
private keepDisplayedInPlaceOf;
|
|
523
|
+
private retainBaseCut;
|
|
524
|
+
private protectBaseCoverageAncestors;
|
|
525
|
+
protected visit(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>, camera: TCamera, desired: Map<string, IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>>, requested: IRuntimeContent<TContentHandle>[]): void;
|
|
526
|
+
protected collectReplacementFront(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>, camera: TCamera, requested: IRuntimeContent<TContentHandle>[], priorityFloor?: number): boolean;
|
|
527
|
+
/**
|
|
528
|
+
* Loads a child outside the view in the background, so that it is ready when the camera turns towards it. It
|
|
529
|
+
* never blocks the replacement of its parent, and its descendants are not loaded.
|
|
530
|
+
*/
|
|
531
|
+
private preloadSibling;
|
|
532
|
+
/** Screen-space error above which a tile refines: lowered by the hysteresis once refined, scaled by the factor before. */
|
|
533
|
+
private refinementThreshold;
|
|
534
|
+
/**
|
|
535
|
+
* Whether a tile is explicit and every content it has, if any, is known empty and ready. A tile with an external
|
|
536
|
+
* tileset, with a content not loaded yet, or an implicit tile is not.
|
|
537
|
+
*/
|
|
538
|
+
private isKnownEmpty;
|
|
539
|
+
/** Whether a tile with nothing to present refines by its screen-space error, see `emptyTileRefinement`. */
|
|
540
|
+
private obeysGeometricError;
|
|
541
|
+
/** Whether a known empty tile that obeys its error stays under its threshold, with its error of the current frame. */
|
|
542
|
+
private isSatisfiedEmpty;
|
|
543
|
+
/** Whether a refined tile that no longer requires its refinement still waits before coarsening. */
|
|
544
|
+
private isCoarseningDelayed;
|
|
545
|
+
/** Location of an implicit quadtree tile for balancing, or `undefined` when balancing does not apply. */
|
|
546
|
+
private quadtreeLocation;
|
|
547
|
+
private isBalanceRefinementRequired;
|
|
548
|
+
/**
|
|
549
|
+
* Adds the refinements that balance a selection. Refinements only
|
|
550
|
+
* accumulate within a frame, so repeating the traversal converges: each
|
|
551
|
+
* pass can only make the cut finer, and a refinement that unbalances
|
|
552
|
+
* further neighbours is resolved by the next pass.
|
|
553
|
+
*
|
|
554
|
+
* @returns Whether a refinement was added, which requires another pass.
|
|
555
|
+
*/
|
|
556
|
+
private extendQuadtreeBalance;
|
|
557
|
+
/** Visible selected quadtree tiles: a tile outside the view, even active, neither requires nor holds back what the camera sees. */
|
|
558
|
+
private visibleQuadtreeLocations;
|
|
559
|
+
/** Visible selected quadtree tiles next to a visible selected tile coarser by more than `maxLevelDifference` levels. */
|
|
560
|
+
private findImbalances;
|
|
561
|
+
/**
|
|
562
|
+
* Holds the refinement that brought a tile next to a neighbour coarser by
|
|
563
|
+
* more than `maxLevelDifference` levels, when that neighbour cannot refine
|
|
564
|
+
* yet. An ancestor of the fine tile stays displayed instead: the finest one
|
|
565
|
+
* within `maxLevelDifference` levels of the neighbour that is ready. The
|
|
566
|
+
* refinement resumes once the neighbour's children load.
|
|
567
|
+
*
|
|
568
|
+
* Only new refinements are held. A refinement already displayed at the
|
|
569
|
+
* start of the frame is kept, because coarsening it would flicker: the
|
|
570
|
+
* neighbour typically comes into view while the camera turns, and its
|
|
571
|
+
* children load first since the balance requires them. The edge stays
|
|
572
|
+
* reported as unbalanced meanwhile.
|
|
573
|
+
*
|
|
574
|
+
* @returns Whether a refinement was held, which requires another pass.
|
|
575
|
+
*/
|
|
576
|
+
private holdUnbalancedRefinements;
|
|
577
|
+
private isNodePresentationReady;
|
|
578
|
+
private selectReadyCoverageAncestor;
|
|
579
|
+
/**
|
|
580
|
+
* Updates whether a tile is visible and active. A visible tile is always active. An active tile need not be visible: it
|
|
581
|
+
* may lie in the periphery of the view or, with `preloadSiblings`, be the neighbour of a visible tile. It refines and
|
|
582
|
+
* merges like a visible one, and stays selected when it leaves the view, so that the selection does not change with
|
|
583
|
+
* each small move of the camera. The traversal stops at a tile that is not active: its whole hierarchy goes with it,
|
|
584
|
+
* and its ancestors do not depend on it.
|
|
585
|
+
*
|
|
586
|
+
* @returns Whether the tile is active.
|
|
587
|
+
*/
|
|
588
|
+
private updateActivity;
|
|
589
|
+
private isNeighbourOfVisible;
|
|
590
|
+
/** Keeps the visible selected tiles of a frame, for their neighbours in the next one. It asks for that frame when they changed. */
|
|
591
|
+
private updateVisibleTiles;
|
|
592
|
+
/** What the camera sees loads first. */
|
|
593
|
+
private loadPriority;
|
|
594
|
+
/** Whether the tiles selected at the start of the frame cover every visible part of a tile. */
|
|
595
|
+
private selectedDescendantsCover;
|
|
596
|
+
private retainVisibleSelectedDescendants;
|
|
597
|
+
private isDescendantOf;
|
|
598
|
+
private setRefinementState;
|
|
599
|
+
/** What a frame really changed: refinements and coarsenings once its passes are over, and tiles of the cut. */
|
|
600
|
+
private recordCutChanges;
|
|
601
|
+
protected selectNode(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>, desired: Map<string, IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>>, requested: IRuntimeContent<TContentHandle>[]): void;
|
|
602
|
+
protected requestNodeContents(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>, priority: number, requested: IRuntimeContent<TContentHandle>[]): void;
|
|
603
|
+
/** A waiting load follows the priority of the current frame, up or down: the highest its balance passes asked. */
|
|
604
|
+
private followQueuedPriority;
|
|
605
|
+
private requestPipelineActivation;
|
|
606
|
+
private activatePipelineTile;
|
|
607
|
+
private refreshKey;
|
|
608
|
+
/**
|
|
609
|
+
* Reloads the stale ready contents of a tile of the working set, one reload of a tile at a time. Provisional
|
|
610
|
+
* contents reload only for a leaf of the cut: a tile the descent goes through never loads its own content.
|
|
611
|
+
*/
|
|
612
|
+
private requestRefresh;
|
|
613
|
+
/** Stops the reload of the provisional contents of a tile that refines again: its children replace it. */
|
|
614
|
+
private cancelProvisionalRefresh;
|
|
615
|
+
/** Stops the reloads of a tile leaving the working set; the results already reported are still swapped in. */
|
|
616
|
+
private cancelRefresh;
|
|
617
|
+
private refreshTile;
|
|
618
|
+
/** Clears the stale flag, unless the content was invalidated again after its reload started. */
|
|
619
|
+
private markFresh;
|
|
620
|
+
/** Swaps the reloaded handles in, before the traversal of a frame. */
|
|
621
|
+
private applyRefreshes;
|
|
622
|
+
/**
|
|
623
|
+
* Replaces the handle of a content with its reload. A presented content is hidden and released, then the tile is
|
|
624
|
+
* presented again with the new handle, all before the next render: the view never shows a hole.
|
|
625
|
+
*/
|
|
626
|
+
private swapContent;
|
|
627
|
+
/** Releases a handle of a content that is not, or no longer, its current handle. */
|
|
628
|
+
private releaseHandle;
|
|
629
|
+
private contentSnapshot;
|
|
630
|
+
private pipelineActivationKey;
|
|
631
|
+
private deactivatePipelineTilesOutsideWorkingSet;
|
|
632
|
+
protected loadContent(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>, content: IRuntimeContent<TContentHandle>, signal: AbortSignal): Promise<void>;
|
|
633
|
+
protected acceptContentResult(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>, content: IRuntimeContent<TContentHandle>, result: ContentLoadResult<TContentHandle>): Promise<void>;
|
|
634
|
+
/**
|
|
635
|
+
* Re-derives the spatial state of a tile from a bounding volume measured on its content.
|
|
636
|
+
* The serialized tile stays unchanged; only the runtime state uses the measured volume.
|
|
637
|
+
*/
|
|
638
|
+
private refineTileBoundingVolume;
|
|
639
|
+
/**
|
|
640
|
+
* Resolves the bounding volumes of materialized implicit children again once their parent content is ready.
|
|
641
|
+
*
|
|
642
|
+
* An implicit resolver may derive child volumes from the parent content, for example the quadrant height ranges
|
|
643
|
+
* of a DEM. Children materialized before that content arrived would otherwise keep their initial volume, be culled
|
|
644
|
+
* and never load. Children whose own content already reported a measured volume are left unchanged.
|
|
645
|
+
*/
|
|
646
|
+
private refreshImplicitChildBounds;
|
|
647
|
+
/** Derives every tile again, parents first, after a change of the vertical scale. */
|
|
648
|
+
private refreshSpatialStates;
|
|
649
|
+
private refreshNodeReadiness;
|
|
650
|
+
protected activateNode(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>): Promise<void>;
|
|
651
|
+
protected deactivateNode(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>): Promise<void>;
|
|
652
|
+
protected resolveMetadata(node: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>, content?: IContent, features?: IRuntimeContent<TContentHandle>["featureMetadata"]): Promise<IMetadataSnapshot>;
|
|
653
|
+
private initializeRoot;
|
|
654
|
+
private createDocument;
|
|
655
|
+
private createNode;
|
|
656
|
+
private createImplicitSubtree;
|
|
657
|
+
private createImplicitTileSource;
|
|
658
|
+
private implicitContents;
|
|
659
|
+
private applyImplicitContents;
|
|
660
|
+
private requestImplicitSubtree;
|
|
661
|
+
private materializeImplicitChildren;
|
|
662
|
+
/** Resolver of the tiles of an implicit context: the resolver of its registered subtree, or that of the adapter. */
|
|
663
|
+
private implicitResolver;
|
|
664
|
+
/**
|
|
665
|
+
* Creates the root of a registered implicit subtree in place of an implicit tile: a new implicit context with
|
|
666
|
+
* the tiling, contents, resolver and subtree loader of the subtree, rooted at the tile.
|
|
667
|
+
*/
|
|
668
|
+
private createGraftedNode;
|
|
669
|
+
private tileContext;
|
|
670
|
+
private contentLoadContext;
|
|
671
|
+
private presentationContext;
|
|
672
|
+
private pipelinePresentationContext;
|
|
673
|
+
private glyphContext;
|
|
674
|
+
private revokeGlyphs;
|
|
675
|
+
private sweepCache;
|
|
676
|
+
private sweepContentCache;
|
|
677
|
+
/** Records the start time of a frame and forgets the frames older than the cache retention. */
|
|
678
|
+
private recordFrameTime;
|
|
679
|
+
/**
|
|
680
|
+
* Whether a resource last used in a frame has been unused for longer than the cache retention: the retention time,
|
|
681
|
+
* or the deprecated frame count when the application set one. A frame no longer recorded is older than the
|
|
682
|
+
* retention time.
|
|
683
|
+
*/
|
|
684
|
+
private isUnusedTooLong;
|
|
685
|
+
/** Budget of content entries, grown to what the view selects when the budgets are adaptive. */
|
|
686
|
+
private contentEntryBudget;
|
|
687
|
+
/** Budget of materialized tiles, grown to what the traversal visits when the budgets are adaptive. */
|
|
688
|
+
private materializedTileBudget;
|
|
689
|
+
private contentEvictionReason;
|
|
690
|
+
private evictContent;
|
|
691
|
+
private sweepSubtreeCache;
|
|
692
|
+
private isSubtreeProtected;
|
|
693
|
+
private evictSubtree;
|
|
694
|
+
private sweepImplicitBranches;
|
|
695
|
+
private isImplicitBranchRoot;
|
|
696
|
+
private oldestChildFrame;
|
|
697
|
+
private branchDescendants;
|
|
698
|
+
private isBranchProtected;
|
|
699
|
+
private pruneImplicitBranch;
|
|
700
|
+
private disposeNodeContent;
|
|
701
|
+
private disposeContentHandle;
|
|
702
|
+
private estimateSubtreeBytes;
|
|
703
|
+
private collectStatistics;
|
|
704
|
+
private startTiming;
|
|
705
|
+
private elapsed;
|
|
706
|
+
private recordDuration;
|
|
707
|
+
private recordMetric;
|
|
708
|
+
private markDirty;
|
|
709
|
+
private invokeHooks;
|
|
710
|
+
private reportError;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
export { CameraChangeFlags, ContentLoadResult, type HookResult, type ICacheEvictionHookContext, type IContentHookContext, type IFrameHookContext, ILoadedImplicitSubtree, ILoadedTileset, type IMetadataHookContext, IMetadataSnapshot, type IQuadtreeBalanceOptions, type IQuadtreeCutTile, type IQuadtreeImbalance, type IQuadtreeTileLocation, IResolvedRuntimeCacheOptions, IRuntimeAdapter, IRuntimeCacheCounters, IRuntimeCacheEviction, IRuntimeCacheOptions, type IRuntimeCacheStatistics, IRuntimeContent, type IRuntimeContentStatistics, type IRuntimeErrorHookContext, IRuntimeFrameResult, type IRuntimeHooks, IRuntimeImplicitSubtree, type IRuntimeInstrumentationOptions, IRuntimeMetric, type IRuntimeMetricAggregate, type IRuntimeNodeStatistics, IRuntimeQuadtreeImbalance, type IRuntimeStateStatistics, type IRuntimeStatisticsSnapshot, type IRuntimeSubtreeStatistics, IRuntimeTile, IRuntimeTilesetDocument, type ISubtreeHookContext, ITileAddress, type ITileHookContext, type ITileRuntimeOptions, type ITilesetLoadHookContext, type ITilesetLoadedHookContext, type RuntimeEvent, RuntimeEventHub, type RuntimeEventListener, RuntimeInstrumentation, RuntimeMetadataStore, RuntimeMetricName, type RuntimeStatisticsListener, RuntimeTilePredicate, TileRuntime, VerticalScale, quadtreeBalanceRefinements, quadtreeImbalances, quadtreeTileKey, quadtreeTouches, refineQuadtreeCut };
|