@loaders.gl/tiles 3.4.0-alpha.4 → 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 +171 -151
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/tileset/helpers/3d-tiles-options.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/esm/constants.js.map +1 -1
- package/dist/esm/tileset/helpers/3d-tiles-options.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/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/dist/constants.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type TileContentState = 'unloaded' | 'loading' | 'processing' | 'ready' | 'expired' | 'failed';
|
|
1
2
|
export declare const TILE_CONTENT_STATE: {
|
|
2
3
|
UNLOADED: number;
|
|
3
4
|
LOADING: number;
|
|
@@ -6,24 +7,29 @@ export declare const TILE_CONTENT_STATE: {
|
|
|
6
7
|
EXPIRED: number;
|
|
7
8
|
FAILED: number;
|
|
8
9
|
};
|
|
10
|
+
export type TileRefinement = 'add' | 'replace';
|
|
9
11
|
export declare const TILE_REFINEMENT: {
|
|
10
12
|
ADD: number;
|
|
11
13
|
REPLACE: number;
|
|
12
14
|
};
|
|
15
|
+
export type TileType = 'empty' | 'scenegraph' | 'pointcloud' | 'mesh';
|
|
13
16
|
export declare const TILE_TYPE: {
|
|
14
17
|
EMPTY: string;
|
|
15
18
|
SCENEGRAPH: string;
|
|
16
19
|
POINTCLOUD: string;
|
|
17
20
|
MESH: string;
|
|
18
21
|
};
|
|
22
|
+
export type TilesetType = 'I3S' | 'TILES3D';
|
|
19
23
|
export declare const TILESET_TYPE: {
|
|
20
24
|
I3S: string;
|
|
21
25
|
TILES3D: string;
|
|
22
26
|
};
|
|
27
|
+
export type LODMetricType = 'geometricError' | 'maxScreenThreshold';
|
|
23
28
|
export declare const LOD_METRIC_TYPE: {
|
|
24
29
|
GEOMETRIC_ERROR: string;
|
|
25
30
|
MAX_SCREEN_THRESHOLD: string;
|
|
26
31
|
};
|
|
32
|
+
export type Tile3DOptimizationHint = 'NOT_COMPUTED' | 'USE_OPTIMIZATION' | 'SKIP_OPTIMIZATION';
|
|
27
33
|
export declare const TILE3D_OPTIMIZATION_HINT: {
|
|
28
34
|
NOT_COMPUTED: number;
|
|
29
35
|
USE_OPTIMIZATION: number;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;;;;CAO9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAEF,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAGF,eAAO,MAAM,wBAAwB;;;;CAIpC,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GACxB,UAAU,GACV,SAAS,GACT,YAAY,GACZ,OAAO,GACP,SAAS,GACT,QAAQ,CAAC;AAEb,eAAO,MAAM,kBAAkB;;;;;;;CAO9B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,SAAS,CAAC;AAE/C,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,YAAY,GAAG,MAAM,CAAC;AAEtE,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,SAAS,CAAC;AAE5C,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,oBAAoB,CAAC;AAEpE,eAAO,MAAM,eAAe;;;CAG3B,CAAC;AAGF,MAAM,MAAM,sBAAsB,GAAG,cAAc,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAE/F,eAAO,MAAM,wBAAwB;;;;CAIpC,CAAC"}
|
package/dist/constants.js
CHANGED
package/dist/dist.min.js
CHANGED
|
@@ -4669,9 +4669,6 @@
|
|
|
4669
4669
|
});
|
|
4670
4670
|
|
|
4671
4671
|
// src/tileset/tileset-cache.ts
|
|
4672
|
-
function defined(x) {
|
|
4673
|
-
return x !== void 0 && x !== null;
|
|
4674
|
-
}
|
|
4675
4672
|
var TilesetCache;
|
|
4676
4673
|
var init_tileset_cache = __esm({
|
|
4677
4674
|
"src/tileset/tileset-cache.ts"() {
|
|
@@ -4687,12 +4684,12 @@
|
|
|
4687
4684
|
}
|
|
4688
4685
|
touch(tile) {
|
|
4689
4686
|
const node2 = tile._cacheNode;
|
|
4690
|
-
if (
|
|
4687
|
+
if (node2) {
|
|
4691
4688
|
this._list.splice(this._sentinel, node2);
|
|
4692
4689
|
}
|
|
4693
4690
|
}
|
|
4694
4691
|
add(tileset, tile, addCallback) {
|
|
4695
|
-
if (!
|
|
4692
|
+
if (!tile._cacheNode) {
|
|
4696
4693
|
tile._cacheNode = this._list.add(tile);
|
|
4697
4694
|
if (addCallback) {
|
|
4698
4695
|
addCallback(tileset, tile);
|
|
@@ -4701,11 +4698,11 @@
|
|
|
4701
4698
|
}
|
|
4702
4699
|
unloadTile(tileset, tile, unloadCallback) {
|
|
4703
4700
|
const node2 = tile._cacheNode;
|
|
4704
|
-
if (!
|
|
4701
|
+
if (!node2) {
|
|
4705
4702
|
return;
|
|
4706
4703
|
}
|
|
4707
4704
|
this._list.remove(node2);
|
|
4708
|
-
tile._cacheNode =
|
|
4705
|
+
tile._cacheNode = null;
|
|
4709
4706
|
if (unloadCallback) {
|
|
4710
4707
|
unloadCallback(tileset, tile);
|
|
4711
4708
|
}
|
|
@@ -5531,39 +5528,60 @@
|
|
|
5531
5528
|
}
|
|
5532
5529
|
});
|
|
5533
5530
|
|
|
5531
|
+
// ../core/src/lib/utils/url-utils.ts
|
|
5532
|
+
function extractQueryString(url) {
|
|
5533
|
+
const matches3 = url.match(QUERY_STRING_PATTERN);
|
|
5534
|
+
return matches3 && matches3[0];
|
|
5535
|
+
}
|
|
5536
|
+
function stripQueryString(url) {
|
|
5537
|
+
return url.replace(QUERY_STRING_PATTERN, "");
|
|
5538
|
+
}
|
|
5539
|
+
var QUERY_STRING_PATTERN;
|
|
5540
|
+
var init_url_utils = __esm({
|
|
5541
|
+
"../core/src/lib/utils/url-utils.ts"() {
|
|
5542
|
+
QUERY_STRING_PATTERN = /\?.*/;
|
|
5543
|
+
}
|
|
5544
|
+
});
|
|
5545
|
+
|
|
5534
5546
|
// ../core/src/lib/utils/resource-utils.ts
|
|
5535
|
-
function
|
|
5547
|
+
function getResourceUrl(resource) {
|
|
5536
5548
|
if (isResponse(resource)) {
|
|
5537
|
-
const
|
|
5538
|
-
|
|
5539
|
-
return {
|
|
5540
|
-
url,
|
|
5541
|
-
type: parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(url)
|
|
5542
|
-
};
|
|
5549
|
+
const response = resource;
|
|
5550
|
+
return response.url;
|
|
5543
5551
|
}
|
|
5544
5552
|
if (isBlob(resource)) {
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
type: resource.type || ""
|
|
5548
|
-
};
|
|
5553
|
+
const blob = resource;
|
|
5554
|
+
return blob.name || "";
|
|
5549
5555
|
}
|
|
5550
5556
|
if (typeof resource === "string") {
|
|
5551
|
-
return
|
|
5552
|
-
url: stripQueryString(resource),
|
|
5553
|
-
type: parseMIMETypeFromURL(resource)
|
|
5554
|
-
};
|
|
5557
|
+
return resource;
|
|
5555
5558
|
}
|
|
5556
|
-
return
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5559
|
+
return "";
|
|
5560
|
+
}
|
|
5561
|
+
function getResourceMIMEType(resource) {
|
|
5562
|
+
if (isResponse(resource)) {
|
|
5563
|
+
const response = resource;
|
|
5564
|
+
const contentTypeHeader = response.headers.get("content-type") || "";
|
|
5565
|
+
const noQueryUrl = stripQueryString(response.url);
|
|
5566
|
+
return parseMIMEType(contentTypeHeader) || parseMIMETypeFromURL(noQueryUrl);
|
|
5567
|
+
}
|
|
5568
|
+
if (isBlob(resource)) {
|
|
5569
|
+
const blob = resource;
|
|
5570
|
+
return blob.type || "";
|
|
5571
|
+
}
|
|
5572
|
+
if (typeof resource === "string") {
|
|
5573
|
+
return parseMIMETypeFromURL(resource);
|
|
5574
|
+
}
|
|
5575
|
+
return "";
|
|
5560
5576
|
}
|
|
5561
5577
|
function getResourceContentLength(resource) {
|
|
5562
5578
|
if (isResponse(resource)) {
|
|
5563
|
-
|
|
5579
|
+
const response = resource;
|
|
5580
|
+
return response.headers["content-length"] || -1;
|
|
5564
5581
|
}
|
|
5565
5582
|
if (isBlob(resource)) {
|
|
5566
|
-
|
|
5583
|
+
const blob = resource;
|
|
5584
|
+
return blob.size;
|
|
5567
5585
|
}
|
|
5568
5586
|
if (typeof resource === "string") {
|
|
5569
5587
|
return resource.length;
|
|
@@ -5576,15 +5594,11 @@
|
|
|
5576
5594
|
}
|
|
5577
5595
|
return -1;
|
|
5578
5596
|
}
|
|
5579
|
-
function stripQueryString(url) {
|
|
5580
|
-
return url.replace(QUERY_STRING_PATTERN, "");
|
|
5581
|
-
}
|
|
5582
|
-
var QUERY_STRING_PATTERN;
|
|
5583
5597
|
var init_resource_utils = __esm({
|
|
5584
5598
|
"../core/src/lib/utils/resource-utils.ts"() {
|
|
5585
5599
|
init_is_type();
|
|
5586
5600
|
init_mime_type_utils();
|
|
5587
|
-
|
|
5601
|
+
init_url_utils();
|
|
5588
5602
|
}
|
|
5589
5603
|
});
|
|
5590
5604
|
|
|
@@ -5598,7 +5612,8 @@
|
|
|
5598
5612
|
if (contentLength >= 0) {
|
|
5599
5613
|
headers["content-length"] = String(contentLength);
|
|
5600
5614
|
}
|
|
5601
|
-
const
|
|
5615
|
+
const url = getResourceUrl(resource);
|
|
5616
|
+
const type = getResourceMIMEType(resource);
|
|
5602
5617
|
if (type) {
|
|
5603
5618
|
headers["content-type"] = type;
|
|
5604
5619
|
}
|
|
@@ -6584,8 +6599,9 @@
|
|
|
6584
6599
|
return loader;
|
|
6585
6600
|
}
|
|
6586
6601
|
function selectLoaderInternal(data, loaders, options, context) {
|
|
6587
|
-
const
|
|
6588
|
-
const
|
|
6602
|
+
const url = getResourceUrl(data);
|
|
6603
|
+
const type = getResourceMIMEType(data);
|
|
6604
|
+
const testUrl = stripQueryString(url) || context?.url;
|
|
6589
6605
|
let loader = null;
|
|
6590
6606
|
let reason = "";
|
|
6591
6607
|
if (options?.mimeType) {
|
|
@@ -6614,7 +6630,8 @@
|
|
|
6614
6630
|
return true;
|
|
6615
6631
|
}
|
|
6616
6632
|
function getNoValidLoaderMessage(data) {
|
|
6617
|
-
const
|
|
6633
|
+
const url = getResourceUrl(data);
|
|
6634
|
+
const type = getResourceMIMEType(data);
|
|
6618
6635
|
let message = "No valid loader found (";
|
|
6619
6636
|
message += url ? `${path_exports.filename(url)}, ` : "no url provided, ";
|
|
6620
6637
|
message += `MIME type: ${type ? `"${type}"` : "not provided"}, `;
|
|
@@ -6733,6 +6750,7 @@
|
|
|
6733
6750
|
init_resource_utils();
|
|
6734
6751
|
init_register_loaders();
|
|
6735
6752
|
init_is_type();
|
|
6753
|
+
init_url_utils();
|
|
6736
6754
|
EXT_PATTERN = /\.([^.]+)$/;
|
|
6737
6755
|
}
|
|
6738
6756
|
});
|
|
@@ -6945,18 +6963,25 @@
|
|
|
6945
6963
|
});
|
|
6946
6964
|
|
|
6947
6965
|
// ../core/src/lib/loader-utils/loader-context.ts
|
|
6948
|
-
function getLoaderContext(context, options,
|
|
6949
|
-
if (
|
|
6950
|
-
return
|
|
6966
|
+
function getLoaderContext(context, options, parentContext) {
|
|
6967
|
+
if (parentContext) {
|
|
6968
|
+
return parentContext;
|
|
6951
6969
|
}
|
|
6952
|
-
const
|
|
6970
|
+
const newContext = {
|
|
6953
6971
|
fetch: getFetchFunction(options, context),
|
|
6954
6972
|
...context
|
|
6955
6973
|
};
|
|
6956
|
-
if (
|
|
6957
|
-
|
|
6974
|
+
if (newContext.url) {
|
|
6975
|
+
const baseUrl = stripQueryString(newContext.url);
|
|
6976
|
+
newContext.baseUrl = baseUrl;
|
|
6977
|
+
newContext.queryString = extractQueryString(newContext.url);
|
|
6978
|
+
newContext.filename = path_exports.filename(baseUrl);
|
|
6979
|
+
newContext.baseUrl = path_exports.dirname(baseUrl);
|
|
6958
6980
|
}
|
|
6959
|
-
|
|
6981
|
+
if (!Array.isArray(newContext.loaders)) {
|
|
6982
|
+
newContext.loaders = null;
|
|
6983
|
+
}
|
|
6984
|
+
return newContext;
|
|
6960
6985
|
}
|
|
6961
6986
|
function getLoadersFromContext(loaders, context) {
|
|
6962
6987
|
if (!context && loaders && !Array.isArray(loaders)) {
|
|
@@ -6975,6 +7000,8 @@
|
|
|
6975
7000
|
var init_loader_context = __esm({
|
|
6976
7001
|
"../core/src/lib/loader-utils/loader-context.ts"() {
|
|
6977
7002
|
init_get_fetch_function();
|
|
7003
|
+
init_url_utils();
|
|
7004
|
+
init_src2();
|
|
6978
7005
|
}
|
|
6979
7006
|
});
|
|
6980
7007
|
|
|
@@ -6988,7 +7015,7 @@
|
|
|
6988
7015
|
}
|
|
6989
7016
|
data = await data;
|
|
6990
7017
|
options = options || {};
|
|
6991
|
-
const
|
|
7018
|
+
const url = getResourceUrl(data);
|
|
6992
7019
|
const typedLoaders = loaders;
|
|
6993
7020
|
const candidateLoaders = getLoadersFromContext(typedLoaders, context);
|
|
6994
7021
|
const loader = await selectLoader(data, candidateLoaders, options);
|
|
@@ -6996,7 +7023,7 @@
|
|
|
6996
7023
|
return null;
|
|
6997
7024
|
}
|
|
6998
7025
|
options = normalizeOptions(options, loader, candidateLoaders, url);
|
|
6999
|
-
context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context);
|
|
7026
|
+
context = getLoaderContext({ url, parse, loaders: candidateLoaders }, options, context || null);
|
|
7000
7027
|
return await parseWithLoader(loader, data, options, context);
|
|
7001
7028
|
}
|
|
7002
7029
|
async function parseWithLoader(loader, data, options, context) {
|
|
@@ -7110,7 +7137,7 @@
|
|
|
7110
7137
|
});
|
|
7111
7138
|
|
|
7112
7139
|
// src/tileset/helpers/bounding-volume.ts
|
|
7113
|
-
function
|
|
7140
|
+
function defined(x) {
|
|
7114
7141
|
return x !== void 0 && x !== null;
|
|
7115
7142
|
}
|
|
7116
7143
|
function createBoundingVolume(boundingVolumeHeader, transform, result) {
|
|
@@ -7182,7 +7209,7 @@
|
|
|
7182
7209
|
zAxis[1],
|
|
7183
7210
|
zAxis[2]
|
|
7184
7211
|
]);
|
|
7185
|
-
if (
|
|
7212
|
+
if (defined(result)) {
|
|
7186
7213
|
result.center = center;
|
|
7187
7214
|
result.halfAxes = halfAxes;
|
|
7188
7215
|
return result;
|
|
@@ -7195,7 +7222,7 @@
|
|
|
7195
7222
|
const scale5 = transform.getScale(scratchScale);
|
|
7196
7223
|
const uniformScale = Math.max(Math.max(scale5[0], scale5[1]), scale5[2]);
|
|
7197
7224
|
const radius = sphere[3] * uniformScale;
|
|
7198
|
-
if (
|
|
7225
|
+
if (defined(result)) {
|
|
7199
7226
|
result.center = center;
|
|
7200
7227
|
result.radius = radius;
|
|
7201
7228
|
return result;
|
|
@@ -7497,16 +7524,16 @@
|
|
|
7497
7524
|
};
|
|
7498
7525
|
TilesetTraverser = class {
|
|
7499
7526
|
constructor(options) {
|
|
7527
|
+
this.root = null;
|
|
7528
|
+
this.selectedTiles = {};
|
|
7529
|
+
this.requestedTiles = {};
|
|
7530
|
+
this.emptyTiles = {};
|
|
7500
7531
|
this.lastUpdate = new Date().getTime();
|
|
7501
7532
|
this.updateDebounceTime = 1e3;
|
|
7502
|
-
this.options = { ...DEFAULT_PROPS3, ...options };
|
|
7503
7533
|
this._traversalStack = new ManagedArray();
|
|
7504
7534
|
this._emptyTraversalStack = new ManagedArray();
|
|
7505
7535
|
this._frameNumber = null;
|
|
7506
|
-
this.
|
|
7507
|
-
this.selectedTiles = {};
|
|
7508
|
-
this.requestedTiles = {};
|
|
7509
|
-
this.emptyTiles = {};
|
|
7536
|
+
this.options = { ...DEFAULT_PROPS3, ...options };
|
|
7510
7537
|
}
|
|
7511
7538
|
traversalFinished(frameState) {
|
|
7512
7539
|
return true;
|
|
@@ -7520,9 +7547,6 @@
|
|
|
7520
7547
|
this.executeTraversal(root, frameState);
|
|
7521
7548
|
}
|
|
7522
7549
|
reset() {
|
|
7523
|
-
this.requestedTiles = {};
|
|
7524
|
-
this.selectedTiles = {};
|
|
7525
|
-
this.emptyTiles = {};
|
|
7526
7550
|
this._traversalStack.reset();
|
|
7527
7551
|
this._emptyTraversalStack.reset();
|
|
7528
7552
|
}
|
|
@@ -7569,7 +7593,6 @@
|
|
|
7569
7593
|
for (const child of children) {
|
|
7570
7594
|
this.updateTile(child, frameState);
|
|
7571
7595
|
}
|
|
7572
|
-
return true;
|
|
7573
7596
|
}
|
|
7574
7597
|
updateAndPushChildren(tile, frameState, stack, depth) {
|
|
7575
7598
|
const { loadSiblings, skipLevelOfDetail } = this.options;
|
|
@@ -7648,7 +7671,7 @@
|
|
|
7648
7671
|
shouldSelectTile(tile) {
|
|
7649
7672
|
return tile.contentAvailable && !this.options.skipLevelOfDetail;
|
|
7650
7673
|
}
|
|
7651
|
-
shouldRefine(tile, frameState, useParentMetric) {
|
|
7674
|
+
shouldRefine(tile, frameState, useParentMetric = false) {
|
|
7652
7675
|
let screenSpaceError = tile._screenSpaceError;
|
|
7653
7676
|
if (useParentMetric) {
|
|
7654
7677
|
screenSpaceError = tile.getScreenSpaceError(frameState, true);
|
|
@@ -7711,7 +7734,7 @@
|
|
|
7711
7734
|
});
|
|
7712
7735
|
|
|
7713
7736
|
// src/tileset/tile-3d.ts
|
|
7714
|
-
function
|
|
7737
|
+
function defined2(x) {
|
|
7715
7738
|
return x !== void 0 && x !== null;
|
|
7716
7739
|
}
|
|
7717
7740
|
var scratchVector9, Tile3D;
|
|
@@ -7729,14 +7752,6 @@
|
|
|
7729
7752
|
scratchVector9 = new Vector3();
|
|
7730
7753
|
Tile3D = class {
|
|
7731
7754
|
constructor(tileset, header, parentHeader, extendedId = "") {
|
|
7732
|
-
this.header = header;
|
|
7733
|
-
this.tileset = tileset;
|
|
7734
|
-
this.id = extendedId || header.id;
|
|
7735
|
-
this.url = header.url;
|
|
7736
|
-
this.parent = parentHeader;
|
|
7737
|
-
this.refine = this._getRefine(header.refine);
|
|
7738
|
-
this.type = header.type;
|
|
7739
|
-
this.contentUrl = header.contentUrl;
|
|
7740
7755
|
this.lodMetricType = "geometricError";
|
|
7741
7756
|
this.lodMetricValue = 0;
|
|
7742
7757
|
this.boundingVolume = null;
|
|
@@ -7744,40 +7759,46 @@
|
|
|
7744
7759
|
this.contentState = TILE_CONTENT_STATE.UNLOADED;
|
|
7745
7760
|
this.gpuMemoryUsageInBytes = 0;
|
|
7746
7761
|
this.children = [];
|
|
7747
|
-
this.hasEmptyContent = false;
|
|
7748
|
-
this.hasTilesetContent = false;
|
|
7749
7762
|
this.depth = 0;
|
|
7750
7763
|
this.viewportIds = [];
|
|
7751
|
-
this.
|
|
7764
|
+
this.transform = new Matrix4();
|
|
7752
7765
|
this.extensions = null;
|
|
7753
|
-
this.
|
|
7754
|
-
this.
|
|
7755
|
-
this.
|
|
7756
|
-
this.
|
|
7757
|
-
this.
|
|
7758
|
-
this._screenSpaceError = 0;
|
|
7766
|
+
this.implicitTiling = null;
|
|
7767
|
+
this.userData = {};
|
|
7768
|
+
this.hasEmptyContent = false;
|
|
7769
|
+
this.hasTilesetContent = false;
|
|
7770
|
+
this.traverser = new TilesetTraverser({});
|
|
7759
7771
|
this._cacheNode = null;
|
|
7760
7772
|
this._frameNumber = null;
|
|
7761
|
-
this.
|
|
7762
|
-
this.
|
|
7763
|
-
this._shouldRefine = false;
|
|
7773
|
+
this._expireDate = null;
|
|
7774
|
+
this._expiredContent = null;
|
|
7764
7775
|
this._distanceToCamera = 0;
|
|
7765
|
-
this.
|
|
7776
|
+
this._screenSpaceError = 0;
|
|
7766
7777
|
this._visible = void 0;
|
|
7767
|
-
this._inRequestVolume = false;
|
|
7768
|
-
this._stackLength = 0;
|
|
7769
|
-
this._selectionDepth = 0;
|
|
7770
7778
|
this._initialTransform = new Matrix4();
|
|
7771
|
-
this.
|
|
7779
|
+
this._priority = 0;
|
|
7780
|
+
this._selectedFrame = 0;
|
|
7781
|
+
this._requestedFrame = 0;
|
|
7782
|
+
this._selectionDepth = 0;
|
|
7783
|
+
this._touchedFrame = 0;
|
|
7784
|
+
this._centerZDepth = 0;
|
|
7785
|
+
this._shouldRefine = false;
|
|
7786
|
+
this._stackLength = 0;
|
|
7787
|
+
this._visitedFrame = 0;
|
|
7788
|
+
this._inRequestVolume = false;
|
|
7789
|
+
this.header = header;
|
|
7790
|
+
this.tileset = tileset;
|
|
7791
|
+
this.id = extendedId || header.id;
|
|
7792
|
+
this.url = header.url;
|
|
7793
|
+
this.parent = parentHeader;
|
|
7794
|
+
this.refine = this._getRefine(header.refine);
|
|
7795
|
+
this.type = header.type;
|
|
7796
|
+
this.contentUrl = header.contentUrl;
|
|
7772
7797
|
this._initializeLodMetric(header);
|
|
7773
7798
|
this._initializeTransforms(header);
|
|
7774
7799
|
this._initializeBoundingVolumes(header);
|
|
7775
7800
|
this._initializeContent(header);
|
|
7776
7801
|
this._initializeRenderingState(header);
|
|
7777
|
-
this._lodJudge = null;
|
|
7778
|
-
this._expireDate = null;
|
|
7779
|
-
this._expiredContent = null;
|
|
7780
|
-
this.implicitTiling = null;
|
|
7781
7802
|
Object.seal(this);
|
|
7782
7803
|
}
|
|
7783
7804
|
destroy() {
|
|
@@ -7844,6 +7865,9 @@
|
|
|
7844
7865
|
unselect() {
|
|
7845
7866
|
this._selectedFrame = 0;
|
|
7846
7867
|
}
|
|
7868
|
+
_getGpuMemoryUsageInBytes() {
|
|
7869
|
+
return this.content.gpuMemoryUsageInBytes || this.content.byteLength || 0;
|
|
7870
|
+
}
|
|
7847
7871
|
_getPriority() {
|
|
7848
7872
|
const traverser = this.tileset._traverser;
|
|
7849
7873
|
const { skipLevelOfDetail } = traverser.options;
|
|
@@ -7960,7 +7984,7 @@
|
|
|
7960
7984
|
return !viewerRequestVolume || viewerRequestVolume.distanceSquaredTo(frameState.camera.position) <= 0;
|
|
7961
7985
|
}
|
|
7962
7986
|
updateExpiration() {
|
|
7963
|
-
if (
|
|
7987
|
+
if (defined2(this._expireDate) && this.contentReady && !this.hasEmptyContent) {
|
|
7964
7988
|
const now = Date.now();
|
|
7965
7989
|
if (Date.lessThan(this._expireDate, now)) {
|
|
7966
7990
|
this.contentState = TILE_CONTENT_STATE.EXPIRED;
|
|
@@ -8043,6 +8067,8 @@
|
|
|
8043
8067
|
}
|
|
8044
8068
|
if (this._isTileset()) {
|
|
8045
8069
|
this.hasTilesetContent = true;
|
|
8070
|
+
} else {
|
|
8071
|
+
this.gpuMemoryUsageInBytes = this._getGpuMemoryUsageInBytes();
|
|
8046
8072
|
}
|
|
8047
8073
|
}
|
|
8048
8074
|
_updateBoundingVolume(header) {
|
|
@@ -8312,20 +8338,6 @@
|
|
|
8312
8338
|
});
|
|
8313
8339
|
|
|
8314
8340
|
// src/tileset/tileset-3d.ts
|
|
8315
|
-
function getQueryParamString(queryParams) {
|
|
8316
|
-
const queryParamStrings = [];
|
|
8317
|
-
for (const key of Object.keys(queryParams)) {
|
|
8318
|
-
queryParamStrings.push(`${key}=${queryParams[key]}`);
|
|
8319
|
-
}
|
|
8320
|
-
switch (queryParamStrings.length) {
|
|
8321
|
-
case 0:
|
|
8322
|
-
return "";
|
|
8323
|
-
case 1:
|
|
8324
|
-
return `?${queryParamStrings[0]}`;
|
|
8325
|
-
default:
|
|
8326
|
-
return `?${queryParamStrings.join("&")}`;
|
|
8327
|
-
}
|
|
8328
|
-
}
|
|
8329
8341
|
var DEFAULT_PROPS4, TILES_TOTAL, TILES_IN_MEMORY, TILES_IN_VIEW, TILES_RENDERABLE, TILES_LOADED, TILES_LOADING, TILES_UNLOADED, TILES_LOAD_FAILED, POINTS_COUNT, TILES_GPU_MEMORY, Tileset3D;
|
|
8330
8342
|
var init_tileset_3d = __esm({
|
|
8331
8343
|
"src/tileset/tileset-3d.ts"() {
|
|
@@ -8380,57 +8392,56 @@
|
|
|
8380
8392
|
POINTS_COUNT = "Points/Vertices";
|
|
8381
8393
|
TILES_GPU_MEMORY = "Tile Memory Use";
|
|
8382
8394
|
Tileset3D = class {
|
|
8383
|
-
constructor(
|
|
8384
|
-
this.contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
|
|
8385
|
-
this.updatePromise = null;
|
|
8386
|
-
assert2(json);
|
|
8387
|
-
this.options = { ...DEFAULT_PROPS4, ...options };
|
|
8388
|
-
this.tileset = json;
|
|
8389
|
-
this.loader = json.loader;
|
|
8390
|
-
this.type = json.type;
|
|
8391
|
-
this.url = json.url;
|
|
8392
|
-
this.basePath = json.basePath || path_exports.dirname(this.url);
|
|
8393
|
-
this.modelMatrix = this.options.modelMatrix;
|
|
8394
|
-
this.ellipsoid = this.options.ellipsoid;
|
|
8395
|
-
this.lodMetricType = json.lodMetricType;
|
|
8396
|
-
this.lodMetricValue = json.lodMetricValue;
|
|
8397
|
-
this.refine = json.root.refine;
|
|
8398
|
-
this.loadOptions = this.options.loadOptions || {};
|
|
8395
|
+
constructor(tileset, options) {
|
|
8399
8396
|
this.root = null;
|
|
8400
8397
|
this.roots = {};
|
|
8398
|
+
this.asset = {};
|
|
8399
|
+
this.description = "";
|
|
8400
|
+
this.extras = null;
|
|
8401
|
+
this.attributions = {};
|
|
8402
|
+
this.credits = {};
|
|
8403
|
+
this.contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
|
|
8401
8404
|
this.cartographicCenter = null;
|
|
8402
8405
|
this.cartesianCenter = null;
|
|
8403
8406
|
this.zoom = 1;
|
|
8404
8407
|
this.boundingVolume = null;
|
|
8408
|
+
this.dynamicScreenSpaceErrorComputedDensity = 0;
|
|
8409
|
+
this.maximumMemoryUsage = 32;
|
|
8410
|
+
this.gpuMemoryUsageInBytes = 0;
|
|
8411
|
+
this._frameNumber = 0;
|
|
8412
|
+
this._queryParams = {};
|
|
8413
|
+
this._extensionsUsed = [];
|
|
8414
|
+
this._tiles = {};
|
|
8415
|
+
this._pendingCount = 0;
|
|
8416
|
+
this.selectedTiles = [];
|
|
8405
8417
|
this.traverseCounter = 0;
|
|
8406
8418
|
this.geometricError = 0;
|
|
8407
|
-
this.
|
|
8419
|
+
this.lastUpdatedVieports = null;
|
|
8420
|
+
this._requestedTiles = [];
|
|
8421
|
+
this._emptyTiles = [];
|
|
8422
|
+
this.frameStateData = {};
|
|
8408
8423
|
this._cache = new TilesetCache();
|
|
8424
|
+
this.updatePromise = null;
|
|
8425
|
+
this.options = { ...DEFAULT_PROPS4, ...options };
|
|
8426
|
+
this.tileset = tileset;
|
|
8427
|
+
this.loader = tileset.loader;
|
|
8428
|
+
this.type = tileset.type;
|
|
8429
|
+
this.url = tileset.url;
|
|
8430
|
+
this.basePath = tileset.basePath || path_exports.dirname(this.url);
|
|
8431
|
+
this.modelMatrix = this.options.modelMatrix;
|
|
8432
|
+
this.ellipsoid = this.options.ellipsoid;
|
|
8433
|
+
this.lodMetricType = tileset.lodMetricType;
|
|
8434
|
+
this.lodMetricValue = tileset.lodMetricValue;
|
|
8435
|
+
this.refine = tileset.root.refine;
|
|
8436
|
+
this.loadOptions = this.options.loadOptions || {};
|
|
8437
|
+
this._traverser = this._initializeTraverser();
|
|
8409
8438
|
this._requestScheduler = new RequestScheduler({
|
|
8410
8439
|
throttleRequests: this.options.throttleRequests,
|
|
8411
8440
|
maxRequests: this.options.maxRequests
|
|
8412
8441
|
});
|
|
8413
|
-
this._frameNumber = 0;
|
|
8414
|
-
this._pendingCount = 0;
|
|
8415
|
-
this._tiles = {};
|
|
8416
|
-
this.selectedTiles = [];
|
|
8417
|
-
this._emptyTiles = [];
|
|
8418
|
-
this._requestedTiles = [];
|
|
8419
|
-
this.frameStateData = {};
|
|
8420
|
-
this.lastUpdatedVieports = null;
|
|
8421
|
-
this._queryParams = {};
|
|
8422
|
-
this._queryParamsString = "";
|
|
8423
|
-
this.maximumMemoryUsage = this.options.maximumMemoryUsage || 32;
|
|
8424
|
-
this.gpuMemoryUsageInBytes = 0;
|
|
8425
8442
|
this.stats = new Stats({ id: this.url });
|
|
8426
8443
|
this._initializeStats();
|
|
8427
|
-
this.
|
|
8428
|
-
this.dynamicScreenSpaceErrorComputedDensity = 0;
|
|
8429
|
-
this.extras = null;
|
|
8430
|
-
this.asset = {};
|
|
8431
|
-
this.credits = {};
|
|
8432
|
-
this.description = this.options.description || "";
|
|
8433
|
-
this.tilesetInitializationPromise = this._initializeTileSet(json);
|
|
8444
|
+
this.tilesetInitializationPromise = this._initializeTileSet(tileset);
|
|
8434
8445
|
}
|
|
8435
8446
|
destroy() {
|
|
8436
8447
|
this._destroy();
|
|
@@ -8445,10 +8456,8 @@
|
|
|
8445
8456
|
return this._frameNumber;
|
|
8446
8457
|
}
|
|
8447
8458
|
get queryParams() {
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
}
|
|
8451
|
-
return this._queryParamsString;
|
|
8459
|
+
const search = new URLSearchParams(this._queryParams).toString();
|
|
8460
|
+
return search ? `?${search}` : "";
|
|
8452
8461
|
}
|
|
8453
8462
|
setProps(props) {
|
|
8454
8463
|
this.options = { ...this.options, ...props };
|
|
@@ -8461,10 +8470,10 @@
|
|
|
8461
8470
|
if (isDataUrl) {
|
|
8462
8471
|
return tilePath;
|
|
8463
8472
|
}
|
|
8464
|
-
return `${tilePath}${this.queryParams}`;
|
|
8473
|
+
return `${tilePath}${tilePath.includes("?") ? "&" : "?"}${this.queryParams}`;
|
|
8465
8474
|
}
|
|
8466
8475
|
hasExtension(extensionName) {
|
|
8467
|
-
return Boolean(this._extensionsUsed
|
|
8476
|
+
return Boolean(this._extensionsUsed.indexOf(extensionName) > -1);
|
|
8468
8477
|
}
|
|
8469
8478
|
update(viewports = null) {
|
|
8470
8479
|
this.tilesetInitializationPromise.then(() => {
|
|
@@ -8651,7 +8660,6 @@
|
|
|
8651
8660
|
}
|
|
8652
8661
|
calculateViewPropsTiles3D() {
|
|
8653
8662
|
const root = this.root;
|
|
8654
|
-
assert2(root);
|
|
8655
8663
|
const { center } = root.boundingVolume;
|
|
8656
8664
|
if (!center) {
|
|
8657
8665
|
console.warn("center was not pre-calculated for the root tile");
|
|
@@ -8694,6 +8702,13 @@
|
|
|
8694
8702
|
const children = tile.header.children || [];
|
|
8695
8703
|
for (const childHeader of children) {
|
|
8696
8704
|
const childTile = new Tile3D(this, childHeader, tile);
|
|
8705
|
+
if (childTile.contentUrl?.includes("?session=")) {
|
|
8706
|
+
const url = new URL(childTile.contentUrl);
|
|
8707
|
+
const session = url.searchParams.get("session");
|
|
8708
|
+
if (session) {
|
|
8709
|
+
this._queryParams.session = session;
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8697
8712
|
tile.children.push(childTile);
|
|
8698
8713
|
childTile.depth = tile.depth + 1;
|
|
8699
8714
|
stack.push(childTile);
|
|
@@ -8729,7 +8744,7 @@
|
|
|
8729
8744
|
this._onStartTileLoading();
|
|
8730
8745
|
loaded = await tile.loadContent();
|
|
8731
8746
|
} catch (error) {
|
|
8732
|
-
this._onTileLoadError(tile, error);
|
|
8747
|
+
this._onTileLoadError(tile, error instanceof Error ? error : new Error("load failed"));
|
|
8733
8748
|
} finally {
|
|
8734
8749
|
this._onEndTileLoading();
|
|
8735
8750
|
this._onTileLoad(tile, loaded);
|
|
@@ -8799,11 +8814,11 @@
|
|
|
8799
8814
|
_updateCacheStats(tile) {
|
|
8800
8815
|
this.stats.get(TILES_LOADED).incrementCount();
|
|
8801
8816
|
this.stats.get(TILES_IN_MEMORY).incrementCount();
|
|
8802
|
-
this.gpuMemoryUsageInBytes += tile.
|
|
8817
|
+
this.gpuMemoryUsageInBytes += tile.gpuMemoryUsageInBytes || 0;
|
|
8803
8818
|
this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
|
|
8804
8819
|
}
|
|
8805
8820
|
_unloadTile(tile) {
|
|
8806
|
-
this.gpuMemoryUsageInBytes -= tile.
|
|
8821
|
+
this.gpuMemoryUsageInBytes -= tile.gpuMemoryUsageInBytes || 0;
|
|
8807
8822
|
this.stats.get(TILES_IN_MEMORY).decrementCount();
|
|
8808
8823
|
this.stats.get(TILES_UNLOADED).incrementCount();
|
|
8809
8824
|
this.stats.get(TILES_GPU_MEMORY).count = this.gpuMemoryUsageInBytes;
|
|
@@ -8845,6 +8860,11 @@
|
|
|
8845
8860
|
tile.destroy();
|
|
8846
8861
|
}
|
|
8847
8862
|
_initializeTiles3DTileset(tilesetJson) {
|
|
8863
|
+
if (tilesetJson.queryString) {
|
|
8864
|
+
const searchParams = new URLSearchParams(tilesetJson.queryString);
|
|
8865
|
+
const queryParams = Object.fromEntries(searchParams.entries());
|
|
8866
|
+
this._queryParams = { ...this._queryParams, ...queryParams };
|
|
8867
|
+
}
|
|
8848
8868
|
this.asset = tilesetJson.asset;
|
|
8849
8869
|
if (!this.asset) {
|
|
8850
8870
|
throw new Error("Tileset must have an asset property.");
|
|
@@ -8861,7 +8881,7 @@
|
|
|
8861
8881
|
this.description = this.options.description || "";
|
|
8862
8882
|
this.properties = tilesetJson.properties;
|
|
8863
8883
|
this.geometricError = tilesetJson.geometricError;
|
|
8864
|
-
this._extensionsUsed = tilesetJson.extensionsUsed;
|
|
8884
|
+
this._extensionsUsed = tilesetJson.extensionsUsed || [];
|
|
8865
8885
|
this.extras = tilesetJson.extras;
|
|
8866
8886
|
}
|
|
8867
8887
|
_initializeI3STileset() {
|