@loaders.gl/tiles 3.4.0-alpha.3 → 3.4.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -1
- package/dist/dist.min.js +240 -440
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/tileset/format-i3s/i3s-pending-tiles-register.js.map +1 -1
- package/dist/es5/tileset/format-i3s/i3s-tile-manager.js.map +1 -1
- package/dist/es5/tileset/format-i3s/i3s-tileset-traverser.js.map +1 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +1 -1
- package/dist/es5/tileset/helpers/bounding-volume.js.map +1 -1
- package/dist/es5/tileset/helpers/frame-state.js.map +1 -1
- package/dist/es5/tileset/helpers/i3s-lod.js.map +1 -1
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +1 -1
- package/dist/es5/tileset/helpers/transform-utils.js.map +1 -1
- package/dist/es5/tileset/helpers/zoom.js.map +1 -1
- package/dist/es5/tileset/tile-3d.js +41 -71
- package/dist/es5/tileset/tile-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-3d.js +68 -102
- package/dist/es5/tileset/tileset-3d.js.map +1 -1
- package/dist/es5/tileset/tileset-cache.js +4 -7
- package/dist/es5/tileset/tileset-cache.js.map +1 -1
- package/dist/es5/tileset/tileset-traverser.js +12 -22
- package/dist/es5/tileset/tileset-traverser.js.map +1 -1
- package/dist/es5/utils/managed-array.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/tileset/format-i3s/i3s-pending-tiles-register.js.map +1 -1
- package/dist/esm/tileset/format-i3s/i3s-tile-manager.js.map +1 -1
- package/dist/esm/tileset/format-i3s/i3s-tileset-traverser.js.map +1 -1
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +1 -1
- package/dist/esm/tileset/helpers/bounding-volume.js.map +1 -1
- package/dist/esm/tileset/helpers/frame-state.js.map +1 -1
- package/dist/esm/tileset/helpers/i3s-lod.js.map +1 -1
- package/dist/esm/tileset/helpers/tiles-3d-lod.js.map +1 -1
- package/dist/esm/tileset/helpers/transform-utils.js.map +1 -1
- package/dist/esm/tileset/helpers/zoom.js.map +1 -1
- package/dist/esm/tileset/tile-3d.js +39 -71
- package/dist/esm/tileset/tile-3d.js.map +1 -1
- package/dist/esm/tileset/tileset-3d.js +64 -94
- package/dist/esm/tileset/tileset-3d.js.map +1 -1
- package/dist/esm/tileset/tileset-cache.js +4 -7
- package/dist/esm/tileset/tileset-cache.js.map +1 -1
- package/dist/esm/tileset/tileset-traverser.js +9 -19
- package/dist/esm/tileset/tileset-traverser.js.map +1 -1
- package/dist/esm/utils/managed-array.js.map +1 -1
- package/dist/tileset/helpers/3d-tiles-options.d.ts +3 -2
- package/dist/tileset/helpers/3d-tiles-options.d.ts.map +1 -1
- package/dist/tileset/tile-3d.d.ts +36 -21
- package/dist/tileset/tile-3d.d.ts.map +1 -1
- package/dist/tileset/tile-3d.js +58 -43
- package/dist/tileset/tileset-3d.d.ts +90 -43
- package/dist/tileset/tileset-3d.d.ts.map +1 -1
- package/dist/tileset/tileset-3d.js +108 -127
- package/dist/tileset/tileset-cache.d.ts +5 -4
- package/dist/tileset/tileset-cache.d.ts.map +1 -1
- package/dist/tileset/tileset-cache.js +4 -10
- package/dist/tileset/tileset-traverser.d.ts +32 -21
- package/dist/tileset/tileset-traverser.d.ts.map +1 -1
- package/dist/tileset/tileset-traverser.js +23 -35
- package/package.json +4 -4
- package/src/constants.ts +18 -0
- package/src/tileset/helpers/3d-tiles-options.ts +3 -1
- package/src/tileset/tile-3d.ts +70 -109
- package/src/tileset/tileset-3d.ts +178 -216
- package/src/tileset/tileset-cache.ts +20 -15
- package/src/tileset/tileset-traverser.ts +52 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tiles",
|
|
3
|
-
"version": "3.4.0-alpha.
|
|
3
|
+
"version": "3.4.0-alpha.5",
|
|
4
4
|
"description": "Common components for different tiles loaders.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@loaders.gl/loader-utils": "3.4.0-alpha.
|
|
37
|
-
"@loaders.gl/math": "3.4.0-alpha.
|
|
36
|
+
"@loaders.gl/loader-utils": "3.4.0-alpha.5",
|
|
37
|
+
"@loaders.gl/math": "3.4.0-alpha.5",
|
|
38
38
|
"@math.gl/core": "^3.5.1",
|
|
39
39
|
"@math.gl/culling": "^3.5.1",
|
|
40
40
|
"@math.gl/geospatial": "^3.5.1",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@loaders.gl/core": "^3.2.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "686929f85b3420c15df051eab769942b260dd242"
|
|
48
48
|
}
|
package/src/constants.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
// loaders.gl, MIT license
|
|
2
2
|
|
|
3
|
+
export type TileContentState =
|
|
4
|
+
| 'unloaded' // Has never been requested
|
|
5
|
+
| 'loading' // Is waiting on a pending request
|
|
6
|
+
| 'processing' // Request received. Contents are being processed for rendering. Depending on the content, it might make its own requests for external data.
|
|
7
|
+
| 'ready' // Ready to render.
|
|
8
|
+
| 'expired' // Is expired and will be unloaded once new content is loaded.
|
|
9
|
+
| 'failed'; // Request failed.
|
|
10
|
+
|
|
3
11
|
export const TILE_CONTENT_STATE = {
|
|
4
12
|
UNLOADED: 0, // Has never been requested
|
|
5
13
|
LOADING: 1, // Is waiting on a pending request
|
|
@@ -9,11 +17,15 @@ export const TILE_CONTENT_STATE = {
|
|
|
9
17
|
FAILED: 5 // Request failed.
|
|
10
18
|
};
|
|
11
19
|
|
|
20
|
+
export type TileRefinement = 'add' | 'replace';
|
|
21
|
+
|
|
12
22
|
export const TILE_REFINEMENT = {
|
|
13
23
|
ADD: 1, // Render tile and, if screen space error exceeded, also refine to its children.
|
|
14
24
|
REPLACE: 2 // Render tile or, if screen space error exceeded, refine to its descendants instead.
|
|
15
25
|
};
|
|
16
26
|
|
|
27
|
+
export type TileType = 'empty' | 'scenegraph' | 'pointcloud' | 'mesh';
|
|
28
|
+
|
|
17
29
|
export const TILE_TYPE = {
|
|
18
30
|
EMPTY: 'empty',
|
|
19
31
|
SCENEGRAPH: 'scenegraph',
|
|
@@ -21,17 +33,23 @@ export const TILE_TYPE = {
|
|
|
21
33
|
MESH: 'mesh'
|
|
22
34
|
};
|
|
23
35
|
|
|
36
|
+
export type TilesetType = 'I3S' | 'TILES3D';
|
|
37
|
+
|
|
24
38
|
export const TILESET_TYPE = {
|
|
25
39
|
I3S: 'I3S',
|
|
26
40
|
TILES3D: 'TILES3D'
|
|
27
41
|
};
|
|
28
42
|
|
|
43
|
+
export type LODMetricType = 'geometricError' | 'maxScreenThreshold';
|
|
44
|
+
|
|
29
45
|
export const LOD_METRIC_TYPE = {
|
|
30
46
|
GEOMETRIC_ERROR: 'geometricError',
|
|
31
47
|
MAX_SCREEN_THRESHOLD: 'maxScreenThreshold'
|
|
32
48
|
};
|
|
33
49
|
|
|
34
50
|
// Cesium 3D Tiles Specific
|
|
51
|
+
export type Tile3DOptimizationHint = 'NOT_COMPUTED' | 'USE_OPTIMIZATION' | 'SKIP_OPTIMIZATION';
|
|
52
|
+
|
|
35
53
|
export const TILE3D_OPTIMIZATION_HINT = {
|
|
36
54
|
NOT_COMPUTED: -1,
|
|
37
55
|
USE_OPTIMIZATION: 1,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import type {Tileset3D} from '../tileset-3d';
|
|
2
|
+
|
|
3
|
+
export function get3dTilesOptions(tileset: Tileset3D): {assetGltfUpAxis: 'X' | 'Y' | 'Z'} {
|
|
2
4
|
return {
|
|
3
5
|
assetGltfUpAxis: (tileset.asset && tileset.asset.gltfUpAxis) || 'Y'
|
|
4
6
|
};
|
package/src/tileset/tile-3d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {load} from '@loaders.gl/core';
|
|
|
10
10
|
|
|
11
11
|
// Note: circular dependency
|
|
12
12
|
import type {Tileset3D} from './tileset-3d';
|
|
13
|
+
import type {DoublyLinkedListNode} from '../utils/doubly-linked-list-node';
|
|
13
14
|
import {TILE_REFINEMENT, TILE_CONTENT_STATE, TILESET_TYPE} from '../constants';
|
|
14
15
|
|
|
15
16
|
import {FrameState} from './helpers/frame-state';
|
|
@@ -54,73 +55,80 @@ export class Tile3D {
|
|
|
54
55
|
id: string;
|
|
55
56
|
url: string;
|
|
56
57
|
parent: Tile3D;
|
|
58
|
+
/* Specifies the type of refine that is used when traversing this tile for rendering. */
|
|
57
59
|
refine: number;
|
|
58
60
|
type: string;
|
|
59
61
|
contentUrl: string;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
/** Different refinement algorithms used by I3S and 3D tiles */
|
|
63
|
+
lodMetricType: 'geometricError' | 'maxScreenThreshold' = 'geometricError';
|
|
64
|
+
/** The error, in meters, introduced if this tile is rendered and its children are not. */
|
|
65
|
+
lodMetricValue: number = 0;
|
|
66
|
+
|
|
67
|
+
/** @todo math.gl is not exporting BoundingVolume base type? */
|
|
68
|
+
boundingVolume: any = null;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The tile's content. This represents the actual tile's payload,
|
|
72
|
+
* not the content's metadata in the tileset JSON file.
|
|
73
|
+
*/
|
|
74
|
+
content: any = null;
|
|
75
|
+
contentState: number = TILE_CONTENT_STATE.UNLOADED;
|
|
76
|
+
gpuMemoryUsageInBytes: number = 0;
|
|
77
|
+
|
|
78
|
+
/** The tile's children - an array of Tile3D objects. */
|
|
79
|
+
children: Tile3D[] = [];
|
|
80
|
+
depth: number = 0;
|
|
81
|
+
viewportIds: any[] = [];
|
|
82
|
+
transform = new Matrix4();
|
|
83
|
+
extensions: any = null;
|
|
84
|
+
/** TODO Cesium 3d tiles specific */
|
|
85
|
+
implicitTiling?: any = null;
|
|
86
|
+
|
|
87
|
+
/** Container to store application specific data */
|
|
88
|
+
userData: Record<string, any> = {};
|
|
89
|
+
|
|
75
90
|
computedTransform: any;
|
|
76
|
-
hasEmptyContent: boolean;
|
|
77
|
-
hasTilesetContent: boolean;
|
|
91
|
+
hasEmptyContent: boolean = false;
|
|
92
|
+
hasTilesetContent: boolean = false;
|
|
78
93
|
|
|
79
|
-
traverser
|
|
94
|
+
traverser = new TilesetTraverser({});
|
|
95
|
+
|
|
96
|
+
/** Used by TilesetCache */
|
|
97
|
+
_cacheNode: DoublyLinkedListNode | null = null;
|
|
98
|
+
|
|
99
|
+
private _frameNumber: any = null;
|
|
80
100
|
|
|
81
|
-
// @ts-ignore
|
|
82
|
-
private _cacheNode: any;
|
|
83
|
-
private _frameNumber: any;
|
|
84
|
-
// TODO i3s specific, needs to remove
|
|
85
|
-
// @ts-ignore
|
|
86
|
-
private _lodJudge: any;
|
|
87
101
|
// TODO Cesium 3d tiles specific
|
|
88
|
-
private _expireDate: any;
|
|
89
|
-
private _expiredContent: any;
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
private _shouldRefine: boolean;
|
|
102
|
+
private _expireDate: any = null;
|
|
103
|
+
private _expiredContent: any = null;
|
|
92
104
|
|
|
93
105
|
private _boundingBox?: CartographicBounds;
|
|
94
106
|
|
|
95
|
-
|
|
96
|
-
public _distanceToCamera: number;
|
|
97
|
-
|
|
98
|
-
private _centerZDepth: number;
|
|
99
|
-
private _screenSpaceError: number;
|
|
107
|
+
/** updated every frame for tree traversal and rendering optimizations: */
|
|
108
|
+
public _distanceToCamera: number = 0;
|
|
109
|
+
_screenSpaceError: number = 0;
|
|
100
110
|
private _visibilityPlaneMask: any;
|
|
101
|
-
private _visible
|
|
102
|
-
private _inRequestVolume: boolean;
|
|
103
|
-
|
|
104
|
-
// @ts-ignore
|
|
105
|
-
private _stackLength: number;
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
private _selectionDepth: number;
|
|
108
|
-
|
|
109
|
-
// @ts-ignore
|
|
110
|
-
private _touchedFrame: number;
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
private _visitedFrame: number;
|
|
113
|
-
private _selectedFrame: number;
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
private _requestedFrame: number;
|
|
116
|
-
|
|
117
|
-
// @ts-ignore
|
|
118
|
-
private _priority: number;
|
|
111
|
+
private _visible: boolean | undefined = undefined;
|
|
119
112
|
|
|
120
113
|
private _contentBoundingVolume: any;
|
|
121
114
|
private _viewerRequestVolume: any;
|
|
122
115
|
|
|
123
|
-
_initialTransform: Matrix4;
|
|
116
|
+
_initialTransform: Matrix4 = new Matrix4();
|
|
117
|
+
|
|
118
|
+
// Used by traverser, cannot be marked private
|
|
119
|
+
_priority: number = 0;
|
|
120
|
+
_selectedFrame: number = 0;
|
|
121
|
+
_requestedFrame: number = 0;
|
|
122
|
+
_selectionDepth: number = 0;
|
|
123
|
+
_touchedFrame: number = 0;
|
|
124
|
+
_centerZDepth: number = 0;
|
|
125
|
+
_shouldRefine: boolean = false;
|
|
126
|
+
_stackLength: number = 0;
|
|
127
|
+
_visitedFrame: number = 0;
|
|
128
|
+
_inRequestVolume: boolean = false;
|
|
129
|
+
|
|
130
|
+
// TODO i3s specific, needs to remove
|
|
131
|
+
// private _lodJudge: any = null;
|
|
124
132
|
|
|
125
133
|
/**
|
|
126
134
|
* @constructs
|
|
@@ -154,69 +162,12 @@ export class Tile3D {
|
|
|
154
162
|
this.type = header.type;
|
|
155
163
|
this.contentUrl = header.contentUrl;
|
|
156
164
|
|
|
157
|
-
// The error, in meters, introduced if this tile is rendered and its children are not.
|
|
158
|
-
this.lodMetricType = 'geometricError';
|
|
159
|
-
this.lodMetricValue = 0;
|
|
160
|
-
|
|
161
|
-
// Specifies the type of refine that is used when traversing this tile for rendering.
|
|
162
|
-
this.boundingVolume = null;
|
|
163
|
-
|
|
164
|
-
// The tile's content. This represents the actual tile's payload,
|
|
165
|
-
// not the content's metadata in the tileset JSON file.
|
|
166
|
-
this.content = null;
|
|
167
|
-
this.contentState = TILE_CONTENT_STATE.UNLOADED;
|
|
168
|
-
this.gpuMemoryUsageInBytes = 0;
|
|
169
|
-
|
|
170
|
-
// The tile's children - an array of Tile3D objects.
|
|
171
|
-
this.children = [];
|
|
172
|
-
|
|
173
|
-
this.hasEmptyContent = false;
|
|
174
|
-
this.hasTilesetContent = false;
|
|
175
|
-
|
|
176
|
-
this.depth = 0;
|
|
177
|
-
this.viewportIds = [];
|
|
178
|
-
|
|
179
|
-
// Container to store application specific data
|
|
180
|
-
this.userData = {};
|
|
181
|
-
this.extensions = null;
|
|
182
|
-
|
|
183
|
-
// PRIVATE MEMBERS
|
|
184
|
-
this._priority = 0;
|
|
185
|
-
this._touchedFrame = 0;
|
|
186
|
-
this._visitedFrame = 0;
|
|
187
|
-
this._selectedFrame = 0;
|
|
188
|
-
this._requestedFrame = 0;
|
|
189
|
-
this._screenSpaceError = 0;
|
|
190
|
-
|
|
191
|
-
this._cacheNode = null;
|
|
192
|
-
this._frameNumber = null;
|
|
193
|
-
this._cacheNode = null;
|
|
194
|
-
|
|
195
|
-
this.traverser = new TilesetTraverser({});
|
|
196
|
-
this._shouldRefine = false;
|
|
197
|
-
this._distanceToCamera = 0;
|
|
198
|
-
this._centerZDepth = 0;
|
|
199
|
-
this._visible = undefined;
|
|
200
|
-
this._inRequestVolume = false;
|
|
201
|
-
this._stackLength = 0;
|
|
202
|
-
this._selectionDepth = 0;
|
|
203
|
-
this._initialTransform = new Matrix4();
|
|
204
|
-
this.transform = new Matrix4();
|
|
205
|
-
|
|
206
165
|
this._initializeLodMetric(header);
|
|
207
166
|
this._initializeTransforms(header);
|
|
208
167
|
this._initializeBoundingVolumes(header);
|
|
209
168
|
this._initializeContent(header);
|
|
210
169
|
this._initializeRenderingState(header);
|
|
211
170
|
|
|
212
|
-
// TODO i3s specific, needs to remove
|
|
213
|
-
this._lodJudge = null;
|
|
214
|
-
|
|
215
|
-
// TODO Cesium 3d tiles specific
|
|
216
|
-
this._expireDate = null;
|
|
217
|
-
this._expiredContent = null;
|
|
218
|
-
this.implicitTiling = null;
|
|
219
|
-
|
|
220
171
|
Object.seal(this);
|
|
221
172
|
}
|
|
222
173
|
|
|
@@ -341,6 +292,13 @@ export class Tile3D {
|
|
|
341
292
|
this._selectedFrame = 0;
|
|
342
293
|
}
|
|
343
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Memory usage of tile on GPU
|
|
297
|
+
*/
|
|
298
|
+
_getGpuMemoryUsageInBytes(): number {
|
|
299
|
+
return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0;
|
|
300
|
+
}
|
|
301
|
+
|
|
344
302
|
/*
|
|
345
303
|
* If skipLevelOfDetail is off try to load child tiles as soon as possible so that their parent can refine sooner.
|
|
346
304
|
* Tiles are prioritized by screen space error.
|
|
@@ -424,6 +382,7 @@ export class Tile3D {
|
|
|
424
382
|
const options = {
|
|
425
383
|
...this.tileset.loadOptions,
|
|
426
384
|
[loader.id]: {
|
|
385
|
+
// @ts-expect-error
|
|
427
386
|
...this.tileset.loadOptions[loader.id],
|
|
428
387
|
isTileset: this.type === 'json',
|
|
429
388
|
...this._getLoaderSpecificOptions(loader.id)
|
|
@@ -734,6 +693,8 @@ export class Tile3D {
|
|
|
734
693
|
// The content may be tileset json
|
|
735
694
|
if (this._isTileset()) {
|
|
736
695
|
this.hasTilesetContent = true;
|
|
696
|
+
} else {
|
|
697
|
+
this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes();
|
|
737
698
|
}
|
|
738
699
|
}
|
|
739
700
|
|