@loaders.gl/tiles 4.2.0-alpha.3 → 4.2.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.js +34 -32
- package/dist/dist.dev.js +723 -342
- package/dist/dist.min.js +9 -0
- package/dist/index.cjs +98 -240
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +10 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/tileset/format-3d-tiles/tileset-3d-traverser.d.ts +1 -1
- package/dist/tileset/format-3d-tiles/tileset-3d-traverser.d.ts.map +1 -1
- package/dist/tileset/format-3d-tiles/tileset-3d-traverser.js +45 -35
- package/dist/tileset/format-i3s/i3s-pending-tiles-register.js +40 -22
- package/dist/tileset/format-i3s/i3s-tile-manager.d.ts +1 -1
- package/dist/tileset/format-i3s/i3s-tile-manager.d.ts.map +1 -1
- package/dist/tileset/format-i3s/i3s-tile-manager.js +67 -69
- package/dist/tileset/format-i3s/i3s-tileset-traverser.d.ts +2 -2
- package/dist/tileset/format-i3s/i3s-tileset-traverser.d.ts.map +1 -1
- package/dist/tileset/format-i3s/i3s-tileset-traverser.js +78 -57
- package/dist/tileset/helpers/3d-tiles-options.d.ts +1 -1
- package/dist/tileset/helpers/3d-tiles-options.d.ts.map +1 -1
- package/dist/tileset/helpers/3d-tiles-options.js +3 -4
- package/dist/tileset/helpers/bounding-volume.js +269 -128
- package/dist/tileset/helpers/frame-state.d.ts +1 -1
- package/dist/tileset/helpers/frame-state.d.ts.map +1 -1
- package/dist/tileset/helpers/frame-state.js +114 -95
- package/dist/tileset/helpers/i3s-lod.d.ts +2 -2
- package/dist/tileset/helpers/i3s-lod.d.ts.map +1 -1
- package/dist/tileset/helpers/i3s-lod.js +68 -39
- package/dist/tileset/helpers/tiles-3d-lod.js +97 -85
- package/dist/tileset/helpers/transform-utils.js +45 -44
- package/dist/tileset/helpers/zoom.d.ts +1 -1
- package/dist/tileset/helpers/zoom.d.ts.map +1 -1
- package/dist/tileset/helpers/zoom.js +70 -40
- package/dist/tileset/tile-3d.d.ts +5 -5
- package/dist/tileset/tile-3d.d.ts.map +1 -1
- package/dist/tileset/tile-3d.js +595 -399
- package/dist/tileset/tileset-3d.d.ts +5 -5
- package/dist/tileset/tileset-3d.d.ts.map +1 -1
- package/dist/tileset/tileset-3d.js +721 -597
- package/dist/tileset/tileset-cache.d.ts +2 -2
- package/dist/tileset/tileset-cache.d.ts.map +1 -1
- package/dist/tileset/tileset-cache.js +62 -48
- package/dist/tileset/tileset-traverser.d.ts +3 -3
- package/dist/tileset/tileset-traverser.d.ts.map +1 -1
- package/dist/tileset/tileset-traverser.js +281 -220
- package/dist/types.js +0 -1
- package/dist/utils/doubly-linked-list-node.js +14 -9
- package/dist/utils/doubly-linked-list.d.ts +1 -1
- package/dist/utils/doubly-linked-list.d.ts.map +1 -1
- package/dist/utils/doubly-linked-list.js +85 -56
- package/dist/utils/managed-array.js +138 -76
- package/package.json +10 -9
- package/dist/constants.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/tileset/format-3d-tiles/tileset-3d-traverser.js.map +0 -1
- package/dist/tileset/format-i3s/i3s-pending-tiles-register.js.map +0 -1
- package/dist/tileset/format-i3s/i3s-tile-manager.js.map +0 -1
- package/dist/tileset/format-i3s/i3s-tileset-traverser.js.map +0 -1
- package/dist/tileset/helpers/3d-tiles-options.js.map +0 -1
- package/dist/tileset/helpers/bounding-volume.js.map +0 -1
- package/dist/tileset/helpers/frame-state.js.map +0 -1
- package/dist/tileset/helpers/i3s-lod.js.map +0 -1
- package/dist/tileset/helpers/tiles-3d-lod.js.map +0 -1
- package/dist/tileset/helpers/transform-utils.js.map +0 -1
- package/dist/tileset/helpers/zoom.js.map +0 -1
- package/dist/tileset/tile-3d.js.map +0 -1
- package/dist/tileset/tileset-3d.js.map +0 -1
- package/dist/tileset/tileset-cache.js.map +0 -1
- package/dist/tileset/tileset-traverser.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/doubly-linked-list-node.js.map +0 -1
- package/dist/utils/doubly-linked-list.js.map +0 -1
- package/dist/utils/managed-array.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
20
|
+
// dist/index.js
|
|
21
|
+
var dist_exports = {};
|
|
22
|
+
__export(dist_exports, {
|
|
23
23
|
LOD_METRIC_TYPE: () => LOD_METRIC_TYPE,
|
|
24
24
|
TILESET_TYPE: () => TILESET_TYPE,
|
|
25
25
|
TILE_CONTENT_STATE: () => TILE_CONTENT_STATE,
|
|
@@ -34,15 +34,15 @@ __export(src_exports, {
|
|
|
34
34
|
getFrameState: () => getFrameState,
|
|
35
35
|
getLodStatus: () => getLodStatus
|
|
36
36
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
37
|
+
module.exports = __toCommonJS(dist_exports);
|
|
38
38
|
|
|
39
|
-
//
|
|
39
|
+
// dist/tileset/tileset-3d.js
|
|
40
40
|
var import_core10 = require("@math.gl/core");
|
|
41
41
|
var import_geospatial6 = require("@math.gl/geospatial");
|
|
42
42
|
var import_stats = require("@probe.gl/stats");
|
|
43
43
|
var import_loader_utils4 = require("@loaders.gl/loader-utils");
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// dist/utils/doubly-linked-list-node.js
|
|
46
46
|
var DoublyLinkedListNode = class {
|
|
47
47
|
constructor(item, previous, next) {
|
|
48
48
|
this.item = item;
|
|
@@ -51,7 +51,7 @@ var DoublyLinkedListNode = class {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
//
|
|
54
|
+
// dist/utils/doubly-linked-list.js
|
|
55
55
|
var DoublyLinkedList = class {
|
|
56
56
|
constructor() {
|
|
57
57
|
this.head = null;
|
|
@@ -129,7 +129,7 @@ var DoublyLinkedList = class {
|
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
//
|
|
132
|
+
// dist/tileset/tileset-cache.js
|
|
133
133
|
var TilesetCache = class {
|
|
134
134
|
constructor() {
|
|
135
135
|
this._list = new DoublyLinkedList();
|
|
@@ -182,7 +182,7 @@ var TilesetCache = class {
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
//
|
|
185
|
+
// dist/tileset/helpers/transform-utils.js
|
|
186
186
|
var import_geospatial = require("@math.gl/geospatial");
|
|
187
187
|
var import_core = require("@math.gl/core");
|
|
188
188
|
var import_loader_utils = require("@loaders.gl/loader-utils");
|
|
@@ -190,10 +190,7 @@ function calculateTransformProps(tileHeader, tile) {
|
|
|
190
190
|
(0, import_loader_utils.assert)(tileHeader);
|
|
191
191
|
(0, import_loader_utils.assert)(tile);
|
|
192
192
|
const { rtcCenter, gltfUpAxis } = tile;
|
|
193
|
-
const {
|
|
194
|
-
computedTransform,
|
|
195
|
-
boundingVolume: { center }
|
|
196
|
-
} = tileHeader;
|
|
193
|
+
const { computedTransform, boundingVolume: { center } } = tileHeader;
|
|
197
194
|
let modelMatrix = new import_core.Matrix4(computedTransform);
|
|
198
195
|
if (rtcCenter) {
|
|
199
196
|
modelMatrix.translate(rtcCenter);
|
|
@@ -218,10 +215,7 @@ function calculateTransformProps(tileHeader, tile) {
|
|
|
218
215
|
const cartesianOrigin = new import_core.Vector3(center);
|
|
219
216
|
tile.cartesianModelMatrix = modelMatrix;
|
|
220
217
|
tile.cartesianOrigin = cartesianOrigin;
|
|
221
|
-
const cartographicOrigin = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(
|
|
222
|
-
cartesianOrigin,
|
|
223
|
-
new import_core.Vector3()
|
|
224
|
-
);
|
|
218
|
+
const cartographicOrigin = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new import_core.Vector3());
|
|
225
219
|
const fromFixedFrameMatrix = import_geospatial.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin);
|
|
226
220
|
const toFixedFrameMatrix = fromFixedFrameMatrix.invert();
|
|
227
221
|
tile.cartographicModelMatrix = toFixedFrameMatrix.multiplyRight(modelMatrix);
|
|
@@ -231,7 +225,7 @@ function calculateTransformProps(tileHeader, tile) {
|
|
|
231
225
|
}
|
|
232
226
|
}
|
|
233
227
|
|
|
234
|
-
//
|
|
228
|
+
// dist/tileset/helpers/frame-state.js
|
|
235
229
|
var import_core2 = require("@math.gl/core");
|
|
236
230
|
var import_culling = require("@math.gl/culling");
|
|
237
231
|
var import_geospatial2 = require("@math.gl/geospatial");
|
|
@@ -251,10 +245,7 @@ function getFrameState(viewport, frameNumber) {
|
|
|
251
245
|
const viewportCenterCartesian = worldToCartesian(viewport, viewport.center);
|
|
252
246
|
const enuToFixedTransform = import_geospatial2.Ellipsoid.WGS84.eastNorthUpToFixedFrame(viewportCenterCartesian);
|
|
253
247
|
const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);
|
|
254
|
-
const cameraPositionCartesian2 = import_geospatial2.Ellipsoid.WGS84.cartographicToCartesian(
|
|
255
|
-
cameraPositionCartographic,
|
|
256
|
-
new import_core2.Vector3()
|
|
257
|
-
);
|
|
248
|
+
const cameraPositionCartesian2 = import_geospatial2.Ellipsoid.WGS84.cartographicToCartesian(cameraPositionCartographic, new import_core2.Vector3());
|
|
258
249
|
const cameraDirectionCartesian = new import_core2.Vector3(
|
|
259
250
|
// @ts-ignore
|
|
260
251
|
enuToFixedTransform.transformAsVector(new import_core2.Vector3(cameraDirection).scale(metersPerUnit))
|
|
@@ -321,10 +312,7 @@ function commonSpacePlanesToWGS84(viewport) {
|
|
|
321
312
|
const nearCenterCartesian = worldToCartesian(viewport, nearCenterCommon);
|
|
322
313
|
const cameraCartesian = worldToCartesian(viewport, viewport.cameraPosition, scratchPosition);
|
|
323
314
|
let i = 0;
|
|
324
|
-
cullingVolume.planes[i++].fromPointNormal(
|
|
325
|
-
nearCenterCartesian,
|
|
326
|
-
scratchVector.copy(nearCenterCartesian).subtract(cameraCartesian)
|
|
327
|
-
);
|
|
315
|
+
cullingVolume.planes[i++].fromPointNormal(nearCenterCartesian, scratchVector.copy(nearCenterCartesian).subtract(cameraCartesian));
|
|
328
316
|
for (const dir in frustumPlanes) {
|
|
329
317
|
if (dir === "near") {
|
|
330
318
|
continue;
|
|
@@ -349,7 +337,7 @@ function worldToCartesian(viewport, point, out = new import_core2.Vector3()) {
|
|
|
349
337
|
return import_geospatial2.Ellipsoid.WGS84.cartographicToCartesian(cartographicPos, out);
|
|
350
338
|
}
|
|
351
339
|
|
|
352
|
-
//
|
|
340
|
+
// dist/tileset/helpers/zoom.js
|
|
353
341
|
var import_core3 = require("@math.gl/core");
|
|
354
342
|
var import_culling2 = require("@math.gl/culling");
|
|
355
343
|
var import_geospatial3 = require("@math.gl/geospatial");
|
|
@@ -374,22 +362,13 @@ function getZoomFromBoundingVolume(boundingVolume, cartorgraphicCenter) {
|
|
|
374
362
|
return 1;
|
|
375
363
|
}
|
|
376
364
|
function getZoomFromFullExtent(fullExtent, cartorgraphicCenter, cartesianCenter) {
|
|
377
|
-
import_geospatial3.Ellipsoid.WGS84.cartographicToCartesian(
|
|
378
|
-
|
|
379
|
-
scratchVector2
|
|
380
|
-
);
|
|
381
|
-
const extentSize = Math.sqrt(
|
|
382
|
-
Math.pow(scratchVector2[0] - cartesianCenter[0], 2) + Math.pow(scratchVector2[1] - cartesianCenter[1], 2) + Math.pow(scratchVector2[2] - cartesianCenter[2], 2)
|
|
383
|
-
);
|
|
365
|
+
import_geospatial3.Ellipsoid.WGS84.cartographicToCartesian([fullExtent.xmax, fullExtent.ymax, fullExtent.zmax], scratchVector2);
|
|
366
|
+
const extentSize = Math.sqrt(Math.pow(scratchVector2[0] - cartesianCenter[0], 2) + Math.pow(scratchVector2[1] - cartesianCenter[1], 2) + Math.pow(scratchVector2[2] - cartesianCenter[2], 2));
|
|
384
367
|
return Math.log2(WGS84_RADIUS_Z / (extentSize + cartorgraphicCenter[2]));
|
|
385
368
|
}
|
|
386
369
|
function getZoomFromExtent(extent, cartorgraphicCenter, cartesianCenter) {
|
|
387
370
|
const [xmin, ymin, xmax, ymax] = extent;
|
|
388
|
-
return getZoomFromFullExtent(
|
|
389
|
-
{ xmin, xmax, ymin, ymax, zmin: 0, zmax: 0 },
|
|
390
|
-
cartorgraphicCenter,
|
|
391
|
-
cartesianCenter
|
|
392
|
-
);
|
|
371
|
+
return getZoomFromFullExtent({ xmin, xmax, ymin, ymax, zmin: 0, zmax: 0 }, cartorgraphicCenter, cartesianCenter);
|
|
393
372
|
}
|
|
394
373
|
function getObbSize(halfAxes) {
|
|
395
374
|
halfAxes.getColumn(0, scratchVector2);
|
|
@@ -400,12 +379,12 @@ function getObbSize(halfAxes) {
|
|
|
400
379
|
return size;
|
|
401
380
|
}
|
|
402
381
|
|
|
403
|
-
//
|
|
382
|
+
// dist/tileset/tile-3d.js
|
|
404
383
|
var import_core7 = require("@math.gl/core");
|
|
405
384
|
var import_culling4 = require("@math.gl/culling");
|
|
406
385
|
var import_core8 = require("@loaders.gl/core");
|
|
407
386
|
|
|
408
|
-
//
|
|
387
|
+
// dist/constants.js
|
|
409
388
|
var TILE_CONTENT_STATE = {
|
|
410
389
|
UNLOADED: 0,
|
|
411
390
|
// Has never been requested
|
|
@@ -420,35 +399,35 @@ var TILE_CONTENT_STATE = {
|
|
|
420
399
|
FAILED: 5
|
|
421
400
|
// Request failed.
|
|
422
401
|
};
|
|
423
|
-
var TILE_REFINEMENT
|
|
402
|
+
var TILE_REFINEMENT;
|
|
403
|
+
(function(TILE_REFINEMENT2) {
|
|
424
404
|
TILE_REFINEMENT2[TILE_REFINEMENT2["ADD"] = 1] = "ADD";
|
|
425
405
|
TILE_REFINEMENT2[TILE_REFINEMENT2["REPLACE"] = 2] = "REPLACE";
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
406
|
+
})(TILE_REFINEMENT || (TILE_REFINEMENT = {}));
|
|
407
|
+
var TILE_TYPE;
|
|
408
|
+
(function(TILE_TYPE2) {
|
|
429
409
|
TILE_TYPE2["EMPTY"] = "empty";
|
|
430
410
|
TILE_TYPE2["SCENEGRAPH"] = "scenegraph";
|
|
431
411
|
TILE_TYPE2["POINTCLOUD"] = "pointcloud";
|
|
432
412
|
TILE_TYPE2["MESH"] = "mesh";
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
413
|
+
})(TILE_TYPE || (TILE_TYPE = {}));
|
|
414
|
+
var TILESET_TYPE;
|
|
415
|
+
(function(TILESET_TYPE2) {
|
|
436
416
|
TILESET_TYPE2["I3S"] = "I3S";
|
|
437
417
|
TILESET_TYPE2["TILES3D"] = "TILES3D";
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
418
|
+
})(TILESET_TYPE || (TILESET_TYPE = {}));
|
|
419
|
+
var LOD_METRIC_TYPE;
|
|
420
|
+
(function(LOD_METRIC_TYPE2) {
|
|
441
421
|
LOD_METRIC_TYPE2["GEOMETRIC_ERROR"] = "geometricError";
|
|
442
422
|
LOD_METRIC_TYPE2["MAX_SCREEN_THRESHOLD"] = "maxScreenThreshold";
|
|
443
|
-
|
|
444
|
-
})(LOD_METRIC_TYPE || {});
|
|
423
|
+
})(LOD_METRIC_TYPE || (LOD_METRIC_TYPE = {}));
|
|
445
424
|
var TILE3D_OPTIMIZATION_HINT = {
|
|
446
425
|
NOT_COMPUTED: -1,
|
|
447
426
|
USE_OPTIMIZATION: 1,
|
|
448
427
|
SKIP_OPTIMIZATION: 0
|
|
449
428
|
};
|
|
450
429
|
|
|
451
|
-
//
|
|
430
|
+
// dist/tileset/helpers/bounding-volume.js
|
|
452
431
|
var import_core4 = require("@math.gl/core");
|
|
453
432
|
var import_culling3 = require("@math.gl/culling");
|
|
454
433
|
var import_geospatial4 = require("@math.gl/geospatial");
|
|
@@ -550,37 +529,19 @@ function createSphere(sphere, transform, result) {
|
|
|
550
529
|
}
|
|
551
530
|
function createObbFromRegion(region) {
|
|
552
531
|
const [west, south, east, north, minHeight, maxHeight] = region;
|
|
553
|
-
const northWest = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
|
|
554
|
-
|
|
555
|
-
scratchNorthWest
|
|
556
|
-
);
|
|
557
|
-
const southEast = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
|
|
558
|
-
[(0, import_core4.degrees)(east), (0, import_core4.degrees)(south), maxHeight],
|
|
559
|
-
scratchSouthEast
|
|
560
|
-
);
|
|
532
|
+
const northWest = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([(0, import_core4.degrees)(west), (0, import_core4.degrees)(north), minHeight], scratchNorthWest);
|
|
533
|
+
const southEast = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([(0, import_core4.degrees)(east), (0, import_core4.degrees)(south), maxHeight], scratchSouthEast);
|
|
561
534
|
const centerInCartesian = new import_core4.Vector3().addVectors(northWest, southEast).multiplyByScalar(0.5);
|
|
562
535
|
import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(centerInCartesian, scratchCenter);
|
|
563
|
-
import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
scratchYAxis
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
[scratchCenter[0], scratchCenter[1], maxHeight],
|
|
573
|
-
scratchZAxis
|
|
574
|
-
);
|
|
575
|
-
return createBox(
|
|
576
|
-
[
|
|
577
|
-
...centerInCartesian,
|
|
578
|
-
...scratchXAxis.subtract(centerInCartesian),
|
|
579
|
-
...scratchYAxis.subtract(centerInCartesian),
|
|
580
|
-
...scratchZAxis.subtract(centerInCartesian)
|
|
581
|
-
],
|
|
582
|
-
new import_core4.Matrix4()
|
|
583
|
-
);
|
|
536
|
+
import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([(0, import_core4.degrees)(east), scratchCenter[1], scratchCenter[2]], scratchXAxis);
|
|
537
|
+
import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([scratchCenter[0], (0, import_core4.degrees)(north), scratchCenter[2]], scratchYAxis);
|
|
538
|
+
import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([scratchCenter[0], scratchCenter[1], maxHeight], scratchZAxis);
|
|
539
|
+
return createBox([
|
|
540
|
+
...centerInCartesian,
|
|
541
|
+
...scratchXAxis.subtract(centerInCartesian),
|
|
542
|
+
...scratchYAxis.subtract(centerInCartesian),
|
|
543
|
+
...scratchZAxis.subtract(centerInCartesian)
|
|
544
|
+
], new import_core4.Matrix4());
|
|
584
545
|
}
|
|
585
546
|
function orientedBoundingBoxToCartographicBounds(boundingVolume) {
|
|
586
547
|
const result = emptyCartographicBounds();
|
|
@@ -648,7 +609,7 @@ function addToCartographicBounds(target, cartesian) {
|
|
|
648
609
|
target[1][2] = Math.max(target[1][2], scratchPoint[2]);
|
|
649
610
|
}
|
|
650
611
|
|
|
651
|
-
//
|
|
612
|
+
// dist/tileset/helpers/tiles-3d-lod.js
|
|
652
613
|
var import_core5 = require("@math.gl/core");
|
|
653
614
|
var scratchPositionNormal = new import_core5.Vector3();
|
|
654
615
|
var scratchCartographic = new import_core5.Vector3();
|
|
@@ -684,7 +645,7 @@ function getTiles3DScreenSpaceError(tile, frameState, useParentLodMetric) {
|
|
|
684
645
|
return error;
|
|
685
646
|
}
|
|
686
647
|
|
|
687
|
-
//
|
|
648
|
+
// dist/tileset/helpers/i3s-lod.js
|
|
688
649
|
var import_core6 = require("@math.gl/core");
|
|
689
650
|
var import_geospatial5 = require("@math.gl/geospatial");
|
|
690
651
|
var cameraPositionCartesian = new import_core6.Vector3();
|
|
@@ -722,34 +683,28 @@ function getProjectedRadius(tile, frameState) {
|
|
|
722
683
|
import_geospatial5.Ellipsoid.WGS84.eastNorthUpToFixedFrame(mbsCenterCartesian, enuToCartesianMatrix);
|
|
723
684
|
cartesianToEnuMatrix.copy(enuToCartesianMatrix).invert();
|
|
724
685
|
cameraPositionEnu.copy(cameraPositionCartesian).transform(cartesianToEnuMatrix);
|
|
725
|
-
const projection = Math.sqrt(
|
|
726
|
-
cameraPositionEnu[0] * cameraPositionEnu[0] + cameraPositionEnu[1] * cameraPositionEnu[1]
|
|
727
|
-
);
|
|
686
|
+
const projection = Math.sqrt(cameraPositionEnu[0] * cameraPositionEnu[0] + cameraPositionEnu[1] * cameraPositionEnu[1]);
|
|
728
687
|
const extraZ = projection * projection / cameraPositionEnu[2];
|
|
729
688
|
extraVertexEnu.copy([cameraPositionEnu[0], cameraPositionEnu[1], extraZ]);
|
|
730
689
|
const extraVertexCartesian = extraVertexEnu.transform(enuToCartesianMatrix);
|
|
731
690
|
const extraVectorCartesian = extraVertexCartesian.subtract(mbsCenterCartesian).normalize();
|
|
732
691
|
const radiusVector = toEye.cross(extraVectorCartesian).normalize().scale(mbsR);
|
|
733
692
|
const sphereMbsBorderVertexCartesian = radiusVector.add(mbsCenterCartesian);
|
|
734
|
-
const sphereMbsBorderVertexCartographic = import_geospatial5.Ellipsoid.WGS84.cartesianToCartographic(
|
|
735
|
-
sphereMbsBorderVertexCartesian
|
|
736
|
-
);
|
|
693
|
+
const sphereMbsBorderVertexCartographic = import_geospatial5.Ellipsoid.WGS84.cartesianToCartographic(sphereMbsBorderVertexCartesian);
|
|
737
694
|
const projectedOrigin = viewport.project([mbsLon, mbsLat, mbsZ]);
|
|
738
|
-
const projectedMbsBorderVertex = viewport.project(
|
|
739
|
-
sphereMbsBorderVertexCartographic
|
|
740
|
-
);
|
|
695
|
+
const projectedMbsBorderVertex = viewport.project(sphereMbsBorderVertexCartographic);
|
|
741
696
|
const projectedRadius = projectedOriginVector.copy(projectedOrigin).subtract(projectedMbsBorderVertex).magnitude();
|
|
742
697
|
return projectedRadius;
|
|
743
698
|
}
|
|
744
699
|
|
|
745
|
-
//
|
|
700
|
+
// dist/tileset/helpers/3d-tiles-options.js
|
|
746
701
|
function get3dTilesOptions(tileset) {
|
|
747
702
|
return {
|
|
748
703
|
assetGltfUpAxis: tileset.asset && tileset.asset.gltfUpAxis || "Y"
|
|
749
704
|
};
|
|
750
705
|
}
|
|
751
706
|
|
|
752
|
-
//
|
|
707
|
+
// dist/utils/managed-array.js
|
|
753
708
|
var import_loader_utils3 = require("@loaders.gl/loader-utils");
|
|
754
709
|
var ManagedArray = class {
|
|
755
710
|
constructor(length = 0) {
|
|
@@ -888,7 +843,7 @@ var ManagedArray = class {
|
|
|
888
843
|
}
|
|
889
844
|
};
|
|
890
845
|
|
|
891
|
-
//
|
|
846
|
+
// dist/tileset/tileset-traverser.js
|
|
892
847
|
var DEFAULT_PROPS = {
|
|
893
848
|
loadSiblings: false,
|
|
894
849
|
skipLevelOfDetail: false,
|
|
@@ -899,29 +854,23 @@ var DEFAULT_PROPS = {
|
|
|
899
854
|
basePath: ""
|
|
900
855
|
};
|
|
901
856
|
var TilesetTraverser = class {
|
|
857
|
+
// RESULT
|
|
858
|
+
traversalFinished(frameState) {
|
|
859
|
+
return true;
|
|
860
|
+
}
|
|
902
861
|
// TODO nested props
|
|
903
862
|
constructor(options) {
|
|
904
|
-
// fulfill in traverse call
|
|
905
863
|
this.root = null;
|
|
906
|
-
// tiles should be rendered
|
|
907
864
|
this.selectedTiles = {};
|
|
908
|
-
// tiles should be loaded from server
|
|
909
865
|
this.requestedTiles = {};
|
|
910
|
-
// tiles does not have render content
|
|
911
866
|
this.emptyTiles = {};
|
|
912
867
|
this.lastUpdate = new Date().getTime();
|
|
913
868
|
this.updateDebounceTime = 1e3;
|
|
914
|
-
/** temporary storage to hold the traversed tiles during a traversal */
|
|
915
869
|
this._traversalStack = new ManagedArray();
|
|
916
870
|
this._emptyTraversalStack = new ManagedArray();
|
|
917
|
-
/** set in every traverse cycle */
|
|
918
871
|
this._frameNumber = null;
|
|
919
872
|
this.options = { ...DEFAULT_PROPS, ...options };
|
|
920
873
|
}
|
|
921
|
-
// RESULT
|
|
922
|
-
traversalFinished(frameState) {
|
|
923
|
-
return true;
|
|
924
|
-
}
|
|
925
874
|
// tiles should be visible
|
|
926
875
|
traverse(root, frameState, options) {
|
|
927
876
|
this.root = root;
|
|
@@ -957,12 +906,7 @@ var TilesetTraverser = class {
|
|
|
957
906
|
let shouldRefine = false;
|
|
958
907
|
if (this.canTraverse(tile, frameState)) {
|
|
959
908
|
this.updateChildTiles(tile, frameState);
|
|
960
|
-
shouldRefine = this.updateAndPushChildren(
|
|
961
|
-
tile,
|
|
962
|
-
frameState,
|
|
963
|
-
stack,
|
|
964
|
-
tile.hasRenderContent ? tile._selectionDepth + 1 : tile._selectionDepth
|
|
965
|
-
);
|
|
909
|
+
shouldRefine = this.updateAndPushChildren(tile, frameState, stack, tile.hasRenderContent ? tile._selectionDepth + 1 : tile._selectionDepth);
|
|
966
910
|
}
|
|
967
911
|
const parent = tile.parent;
|
|
968
912
|
const parentRefines = Boolean(!parent || parent._shouldRefine);
|
|
@@ -973,10 +917,10 @@ var TilesetTraverser = class {
|
|
|
973
917
|
if (stoppedRefining) {
|
|
974
918
|
this.selectTile(tile, frameState);
|
|
975
919
|
}
|
|
976
|
-
} else if (tile.refine ===
|
|
920
|
+
} else if (tile.refine === TILE_REFINEMENT.ADD) {
|
|
977
921
|
this.loadTile(tile, frameState);
|
|
978
922
|
this.selectTile(tile, frameState);
|
|
979
|
-
} else if (tile.refine ===
|
|
923
|
+
} else if (tile.refine === TILE_REFINEMENT.REPLACE) {
|
|
980
924
|
this.loadTile(tile, frameState);
|
|
981
925
|
if (stoppedRefining) {
|
|
982
926
|
this.selectTile(tile, frameState);
|
|
@@ -1002,7 +946,7 @@ var TilesetTraverser = class {
|
|
|
1002
946
|
const { loadSiblings, skipLevelOfDetail } = this.options;
|
|
1003
947
|
const children = tile.children;
|
|
1004
948
|
children.sort(this.compareDistanceToCamera.bind(this));
|
|
1005
|
-
const checkRefines = tile.refine ===
|
|
949
|
+
const checkRefines = tile.refine === TILE_REFINEMENT.REPLACE && tile.hasRenderContent && !skipLevelOfDetail;
|
|
1006
950
|
let hasVisibleChild = false;
|
|
1007
951
|
let refines = true;
|
|
1008
952
|
for (const child of children) {
|
|
@@ -1145,13 +1089,12 @@ var TilesetTraverser = class {
|
|
|
1145
1089
|
}
|
|
1146
1090
|
};
|
|
1147
1091
|
|
|
1148
|
-
//
|
|
1092
|
+
// dist/tileset/tile-3d.js
|
|
1149
1093
|
var scratchVector3 = new import_core7.Vector3();
|
|
1150
1094
|
function defined2(x) {
|
|
1151
1095
|
return x !== void 0 && x !== null;
|
|
1152
1096
|
}
|
|
1153
1097
|
var Tile3D = class {
|
|
1154
|
-
// TODO i3s specific, needs to remove
|
|
1155
1098
|
/**
|
|
1156
1099
|
* @constructs
|
|
1157
1100
|
* Create a Tile3D instance
|
|
@@ -1163,45 +1106,31 @@ var Tile3D = class {
|
|
|
1163
1106
|
*/
|
|
1164
1107
|
// eslint-disable-next-line max-statements
|
|
1165
1108
|
constructor(tileset, header, parentHeader, extendedId = "") {
|
|
1166
|
-
/** Different refinement algorithms used by I3S and 3D tiles */
|
|
1167
1109
|
this.lodMetricType = "geometricError";
|
|
1168
|
-
/** The error, in meters, introduced if this tile is rendered and its children are not. */
|
|
1169
1110
|
this.lodMetricValue = 0;
|
|
1170
|
-
/** @todo math.gl is not exporting BoundingVolume base type? */
|
|
1171
1111
|
this.boundingVolume = null;
|
|
1172
|
-
/**
|
|
1173
|
-
* The tile's content. This represents the actual tile's payload,
|
|
1174
|
-
* not the content's metadata in the tileset JSON file.
|
|
1175
|
-
*/
|
|
1176
1112
|
this.content = null;
|
|
1177
1113
|
this.contentState = TILE_CONTENT_STATE.UNLOADED;
|
|
1178
1114
|
this.gpuMemoryUsageInBytes = 0;
|
|
1179
|
-
/** The tile's children - an array of Tile3D objects. */
|
|
1180
1115
|
this.children = [];
|
|
1181
1116
|
this.depth = 0;
|
|
1182
1117
|
this.viewportIds = [];
|
|
1183
1118
|
this.transform = new import_core7.Matrix4();
|
|
1184
1119
|
this.extensions = null;
|
|
1185
|
-
/** TODO Cesium 3d tiles specific */
|
|
1186
1120
|
this.implicitTiling = null;
|
|
1187
|
-
/** Container to store application specific data */
|
|
1188
1121
|
this.userData = {};
|
|
1189
1122
|
this.hasEmptyContent = false;
|
|
1190
1123
|
this.hasTilesetContent = false;
|
|
1191
1124
|
this.traverser = new TilesetTraverser({});
|
|
1192
|
-
/** Used by TilesetCache */
|
|
1193
1125
|
this._cacheNode = null;
|
|
1194
1126
|
this._frameNumber = null;
|
|
1195
|
-
// TODO Cesium 3d tiles specific
|
|
1196
1127
|
this._expireDate = null;
|
|
1197
1128
|
this._expiredContent = null;
|
|
1198
1129
|
this._boundingBox = void 0;
|
|
1199
|
-
/** updated every frame for tree traversal and rendering optimizations: */
|
|
1200
1130
|
this._distanceToCamera = 0;
|
|
1201
1131
|
this._screenSpaceError = 0;
|
|
1202
1132
|
this._visible = void 0;
|
|
1203
1133
|
this._initialTransform = new import_core7.Matrix4();
|
|
1204
|
-
// Used by traverser, cannot be marked private
|
|
1205
1134
|
this._priority = 0;
|
|
1206
1135
|
this._selectedFrame = 0;
|
|
1207
1136
|
this._requestedFrame = 0;
|
|
@@ -1263,9 +1192,7 @@ var Tile3D = class {
|
|
|
1263
1192
|
* content is ready or if it has expired content this renders while new content loads; otherwise,
|
|
1264
1193
|
*/
|
|
1265
1194
|
get contentAvailable() {
|
|
1266
|
-
return Boolean(
|
|
1267
|
-
this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed
|
|
1268
|
-
);
|
|
1195
|
+
return Boolean(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed);
|
|
1269
1196
|
}
|
|
1270
1197
|
/** Returns true if tile has renderable content but it's unloaded */
|
|
1271
1198
|
get hasUnloadedContent() {
|
|
@@ -1315,9 +1242,9 @@ var Tile3D = class {
|
|
|
1315
1242
|
/** Get the tile's screen space error. */
|
|
1316
1243
|
getScreenSpaceError(frameState, useParentLodMetric) {
|
|
1317
1244
|
switch (this.tileset.type) {
|
|
1318
|
-
case
|
|
1245
|
+
case TILESET_TYPE.I3S:
|
|
1319
1246
|
return getProjectedRadius(this, frameState);
|
|
1320
|
-
case
|
|
1247
|
+
case TILESET_TYPE.TILES3D:
|
|
1321
1248
|
return getTiles3DScreenSpaceError(this, frameState, useParentLodMetric);
|
|
1322
1249
|
default:
|
|
1323
1250
|
throw new Error("Unsupported tileset type");
|
|
@@ -1344,7 +1271,7 @@ var Tile3D = class {
|
|
|
1344
1271
|
_getPriority() {
|
|
1345
1272
|
const traverser = this.tileset._traverser;
|
|
1346
1273
|
const { skipLevelOfDetail } = traverser.options;
|
|
1347
|
-
const maySkipTile = this.refine ===
|
|
1274
|
+
const maySkipTile = this.refine === TILE_REFINEMENT.ADD || skipLevelOfDetail;
|
|
1348
1275
|
if (maySkipTile && !this.isVisible && this._visible !== void 0) {
|
|
1349
1276
|
return -1;
|
|
1350
1277
|
}
|
|
@@ -1377,10 +1304,7 @@ var Tile3D = class {
|
|
|
1377
1304
|
this._expireDate = null;
|
|
1378
1305
|
}
|
|
1379
1306
|
this.contentState = TILE_CONTENT_STATE.LOADING;
|
|
1380
|
-
const requestToken = await this.tileset._requestScheduler.scheduleRequest(
|
|
1381
|
-
this.id,
|
|
1382
|
-
this._getPriority.bind(this)
|
|
1383
|
-
);
|
|
1307
|
+
const requestToken = await this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this));
|
|
1384
1308
|
if (!requestToken) {
|
|
1385
1309
|
this.contentState = TILE_CONTENT_STATE.UNLOADED;
|
|
1386
1310
|
return false;
|
|
@@ -1521,9 +1445,7 @@ var Tile3D = class {
|
|
|
1521
1445
|
this.lodMetricValue = header.lodMetricValue;
|
|
1522
1446
|
} else {
|
|
1523
1447
|
this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue;
|
|
1524
|
-
console.warn(
|
|
1525
|
-
"3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"
|
|
1526
|
-
);
|
|
1448
|
+
console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue");
|
|
1527
1449
|
}
|
|
1528
1450
|
}
|
|
1529
1451
|
_initializeTransforms(tileHeader) {
|
|
@@ -1570,7 +1492,7 @@ var Tile3D = class {
|
|
|
1570
1492
|
this._priority = 0;
|
|
1571
1493
|
}
|
|
1572
1494
|
_getRefine(refine) {
|
|
1573
|
-
return refine || this.parent && this.parent.refine ||
|
|
1495
|
+
return refine || this.parent && this.parent.refine || TILE_REFINEMENT.REPLACE;
|
|
1574
1496
|
}
|
|
1575
1497
|
_isTileset() {
|
|
1576
1498
|
return this.contentUrl.indexOf(".json") !== -1;
|
|
@@ -1590,28 +1512,16 @@ var Tile3D = class {
|
|
|
1590
1512
|
}
|
|
1591
1513
|
}
|
|
1592
1514
|
_updateBoundingVolume(header) {
|
|
1593
|
-
this.boundingVolume = createBoundingVolume(
|
|
1594
|
-
header.boundingVolume,
|
|
1595
|
-
this.computedTransform,
|
|
1596
|
-
this.boundingVolume
|
|
1597
|
-
);
|
|
1515
|
+
this.boundingVolume = createBoundingVolume(header.boundingVolume, this.computedTransform, this.boundingVolume);
|
|
1598
1516
|
const content = header.content;
|
|
1599
1517
|
if (!content) {
|
|
1600
1518
|
return;
|
|
1601
1519
|
}
|
|
1602
1520
|
if (content.boundingVolume) {
|
|
1603
|
-
this._contentBoundingVolume = createBoundingVolume(
|
|
1604
|
-
content.boundingVolume,
|
|
1605
|
-
this.computedTransform,
|
|
1606
|
-
this._contentBoundingVolume
|
|
1607
|
-
);
|
|
1521
|
+
this._contentBoundingVolume = createBoundingVolume(content.boundingVolume, this.computedTransform, this._contentBoundingVolume);
|
|
1608
1522
|
}
|
|
1609
1523
|
if (header.viewerRequestVolume) {
|
|
1610
|
-
this._viewerRequestVolume = createBoundingVolume(
|
|
1611
|
-
header.viewerRequestVolume,
|
|
1612
|
-
this.computedTransform,
|
|
1613
|
-
this._viewerRequestVolume
|
|
1614
|
-
);
|
|
1524
|
+
this._viewerRequestVolume = createBoundingVolume(header.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume);
|
|
1615
1525
|
}
|
|
1616
1526
|
}
|
|
1617
1527
|
// Update the tile's transform. The transform is applied to the tile's bounding volumes.
|
|
@@ -1654,7 +1564,7 @@ var Tile3D = class {
|
|
|
1654
1564
|
}
|
|
1655
1565
|
};
|
|
1656
1566
|
|
|
1657
|
-
//
|
|
1567
|
+
// dist/tileset/format-3d-tiles/tileset-3d-traverser.js
|
|
1658
1568
|
var Tileset3DTraverser = class extends TilesetTraverser {
|
|
1659
1569
|
compareDistanceToCamera(a, b) {
|
|
1660
1570
|
return b._distanceToCamera === 0 && a._distanceToCamera === 0 ? b._centerZDepth - a._centerZDepth : b._distanceToCamera - a._distanceToCamera;
|
|
@@ -1675,7 +1585,7 @@ var Tileset3DTraverser = class extends TilesetTraverser {
|
|
|
1675
1585
|
tile._visible = false;
|
|
1676
1586
|
return;
|
|
1677
1587
|
}
|
|
1678
|
-
const replace = tile.refine ===
|
|
1588
|
+
const replace = tile.refine === TILE_REFINEMENT.REPLACE;
|
|
1679
1589
|
const useOptimization = tile._optimChildrenWithinParent === TILE3D_OPTIMIZATION_HINT.USE_OPTIMIZATION;
|
|
1680
1590
|
if (replace && useOptimization && hasChildren) {
|
|
1681
1591
|
if (!this.anyChildrenVisible(tile, frameState)) {
|
|
@@ -1686,17 +1596,17 @@ var Tileset3DTraverser = class extends TilesetTraverser {
|
|
|
1686
1596
|
}
|
|
1687
1597
|
meetsScreenSpaceErrorEarly(tile, frameState) {
|
|
1688
1598
|
const { parent } = tile;
|
|
1689
|
-
if (!parent || parent.hasTilesetContent || parent.refine !==
|
|
1599
|
+
if (!parent || parent.hasTilesetContent || parent.refine !== TILE_REFINEMENT.ADD) {
|
|
1690
1600
|
return false;
|
|
1691
1601
|
}
|
|
1692
1602
|
return !this.shouldRefine(tile, frameState, true);
|
|
1693
1603
|
}
|
|
1694
1604
|
};
|
|
1695
1605
|
|
|
1696
|
-
//
|
|
1606
|
+
// dist/tileset/format-i3s/i3s-tileset-traverser.js
|
|
1697
1607
|
var import_core9 = require("@loaders.gl/core");
|
|
1698
1608
|
|
|
1699
|
-
//
|
|
1609
|
+
// dist/tileset/format-i3s/i3s-pending-tiles-register.js
|
|
1700
1610
|
var I3SPendingTilesRegister = class {
|
|
1701
1611
|
constructor() {
|
|
1702
1612
|
this.frameNumberMap = /* @__PURE__ */ new Map();
|
|
@@ -1738,7 +1648,7 @@ var I3SPendingTilesRegister = class {
|
|
|
1738
1648
|
}
|
|
1739
1649
|
};
|
|
1740
1650
|
|
|
1741
|
-
//
|
|
1651
|
+
// dist/tileset/format-i3s/i3s-tile-manager.js
|
|
1742
1652
|
var STATUS = {
|
|
1743
1653
|
REQUESTED: "REQUESTED",
|
|
1744
1654
|
COMPLETED: "COMPLETED",
|
|
@@ -1758,26 +1668,17 @@ var I3STileManager = class {
|
|
|
1758
1668
|
*/
|
|
1759
1669
|
add(request, key, callback, frameState) {
|
|
1760
1670
|
if (!this._statusMap[key]) {
|
|
1761
|
-
const {
|
|
1762
|
-
frameNumber,
|
|
1763
|
-
viewport: { id }
|
|
1764
|
-
} = frameState;
|
|
1671
|
+
const { frameNumber, viewport: { id } } = frameState;
|
|
1765
1672
|
this._statusMap[key] = { request, callback, key, frameState, status: STATUS.REQUESTED };
|
|
1766
1673
|
this.pendingTilesRegister.register(id, frameNumber);
|
|
1767
1674
|
request().then((data) => {
|
|
1768
1675
|
this._statusMap[key].status = STATUS.COMPLETED;
|
|
1769
|
-
const {
|
|
1770
|
-
frameNumber: actualFrameNumber,
|
|
1771
|
-
viewport: { id: id2 }
|
|
1772
|
-
} = this._statusMap[key].frameState;
|
|
1676
|
+
const { frameNumber: actualFrameNumber, viewport: { id: id2 } } = this._statusMap[key].frameState;
|
|
1773
1677
|
this.pendingTilesRegister.deregister(id2, actualFrameNumber);
|
|
1774
1678
|
this._statusMap[key].callback(data, frameState);
|
|
1775
1679
|
}).catch((error) => {
|
|
1776
1680
|
this._statusMap[key].status = STATUS.ERROR;
|
|
1777
|
-
const {
|
|
1778
|
-
frameNumber: actualFrameNumber,
|
|
1779
|
-
viewport: { id: id2 }
|
|
1780
|
-
} = this._statusMap[key].frameState;
|
|
1681
|
+
const { frameNumber: actualFrameNumber, viewport: { id: id2 } } = this._statusMap[key].frameState;
|
|
1781
1682
|
this.pendingTilesRegister.deregister(id2, actualFrameNumber);
|
|
1782
1683
|
callback(error);
|
|
1783
1684
|
});
|
|
@@ -1790,15 +1691,9 @@ var I3STileManager = class {
|
|
|
1790
1691
|
*/
|
|
1791
1692
|
update(key, frameState) {
|
|
1792
1693
|
if (this._statusMap[key]) {
|
|
1793
|
-
const {
|
|
1794
|
-
frameNumber,
|
|
1795
|
-
viewport: { id }
|
|
1796
|
-
} = this._statusMap[key].frameState;
|
|
1694
|
+
const { frameNumber, viewport: { id } } = this._statusMap[key].frameState;
|
|
1797
1695
|
this.pendingTilesRegister.deregister(id, frameNumber);
|
|
1798
|
-
const {
|
|
1799
|
-
frameNumber: newFrameNumber,
|
|
1800
|
-
viewport: { id: newViewportId }
|
|
1801
|
-
} = frameState;
|
|
1696
|
+
const { frameNumber: newFrameNumber, viewport: { id: newViewportId } } = frameState;
|
|
1802
1697
|
this.pendingTilesRegister.register(newViewportId, newFrameNumber);
|
|
1803
1698
|
this._statusMap[key].frameState = frameState;
|
|
1804
1699
|
}
|
|
@@ -1822,7 +1717,7 @@ var I3STileManager = class {
|
|
|
1822
1717
|
}
|
|
1823
1718
|
};
|
|
1824
1719
|
|
|
1825
|
-
//
|
|
1720
|
+
// dist/tileset/format-i3s/i3s-tileset-traverser.js
|
|
1826
1721
|
var I3STilesetTraverser = class extends TilesetTraverser {
|
|
1827
1722
|
constructor(options) {
|
|
1828
1723
|
super(options);
|
|
@@ -1854,12 +1749,7 @@ var I3STilesetTraverser = class extends TilesetTraverser {
|
|
|
1854
1749
|
if (tileset.tileset.nodePages) {
|
|
1855
1750
|
request = () => tileset.tileset.nodePagesTile.formTileFromNodePages(child.id);
|
|
1856
1751
|
}
|
|
1857
|
-
this._tileManager.add(
|
|
1858
|
-
request,
|
|
1859
|
-
extendedId,
|
|
1860
|
-
(header) => this._onTileLoad(header, tile, extendedId),
|
|
1861
|
-
frameState
|
|
1862
|
-
);
|
|
1752
|
+
this._tileManager.add(request, extendedId, (header) => this._onTileLoad(header, tile, extendedId), frameState);
|
|
1863
1753
|
} else {
|
|
1864
1754
|
this._tileManager.update(extendedId, frameState);
|
|
1865
1755
|
}
|
|
@@ -1900,7 +1790,7 @@ var I3STilesetTraverser = class extends TilesetTraverser {
|
|
|
1900
1790
|
}
|
|
1901
1791
|
};
|
|
1902
1792
|
|
|
1903
|
-
//
|
|
1793
|
+
// dist/tileset/tileset-3d.js
|
|
1904
1794
|
var DEFAULT_PROPS2 = {
|
|
1905
1795
|
description: "",
|
|
1906
1796
|
ellipsoid: import_geospatial6.Ellipsoid.WGS84,
|
|
@@ -1952,49 +1842,28 @@ var Tileset3D = class {
|
|
|
1952
1842
|
constructor(tileset, options) {
|
|
1953
1843
|
this.root = null;
|
|
1954
1844
|
this.roots = {};
|
|
1955
|
-
/** @todo any->unknown */
|
|
1956
1845
|
this.asset = {};
|
|
1957
|
-
// Metadata for the entire tileset
|
|
1958
1846
|
this.description = "";
|
|
1959
1847
|
this.extras = null;
|
|
1960
1848
|
this.attributions = {};
|
|
1961
1849
|
this.credits = {};
|
|
1962
|
-
/** flags that contain information about data types in nested tiles */
|
|
1963
1850
|
this.contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
|
|
1964
|
-
// view props
|
|
1965
1851
|
this.cartographicCenter = null;
|
|
1966
1852
|
this.cartesianCenter = null;
|
|
1967
1853
|
this.zoom = 1;
|
|
1968
1854
|
this.boundingVolume = null;
|
|
1969
|
-
/** Updated based on the camera position and direction */
|
|
1970
1855
|
this.dynamicScreenSpaceErrorComputedDensity = 0;
|
|
1971
|
-
// METRICS
|
|
1972
|
-
/**
|
|
1973
|
-
* The maximum amount of GPU memory (in MB) that may be used to cache tiles
|
|
1974
|
-
* Tiles not in view are unloaded to enforce private
|
|
1975
|
-
*/
|
|
1976
1856
|
this.maximumMemoryUsage = 32;
|
|
1977
|
-
/** The total amount of GPU memory in bytes used by the tileset. */
|
|
1978
1857
|
this.gpuMemoryUsageInBytes = 0;
|
|
1979
|
-
/**
|
|
1980
|
-
* If loading the level of detail required by maximumScreenSpaceError
|
|
1981
|
-
* results in the memory usage exceeding maximumMemoryUsage (GPU), level of detail refinement
|
|
1982
|
-
* will instead use this (larger) adjusted screen space error to achieve the
|
|
1983
|
-
* best possible visual quality within the available memory.
|
|
1984
|
-
*/
|
|
1985
1858
|
this.memoryAdjustedScreenSpaceError = 0;
|
|
1986
1859
|
this._cacheBytes = 0;
|
|
1987
1860
|
this._cacheOverflowBytes = 0;
|
|
1988
|
-
/** Update tracker. increase in each update cycle. */
|
|
1989
1861
|
this._frameNumber = 0;
|
|
1990
1862
|
this._queryParams = {};
|
|
1991
1863
|
this._extensionsUsed = [];
|
|
1992
1864
|
this._tiles = {};
|
|
1993
|
-
/** counter for tracking tiles requests */
|
|
1994
1865
|
this._pendingCount = 0;
|
|
1995
|
-
/** Hold traversal results */
|
|
1996
1866
|
this.selectedTiles = [];
|
|
1997
|
-
// TRAVERSAL
|
|
1998
1867
|
this.traverseCounter = 0;
|
|
1999
1868
|
this.geometricError = 0;
|
|
2000
1869
|
this.lastUpdatedVieports = null;
|
|
@@ -2002,7 +1871,6 @@ var Tileset3D = class {
|
|
|
2002
1871
|
this._emptyTiles = [];
|
|
2003
1872
|
this.frameStateData = {};
|
|
2004
1873
|
this._cache = new TilesetCache();
|
|
2005
|
-
// Promise tracking
|
|
2006
1874
|
this.updatePromise = null;
|
|
2007
1875
|
this.options = { ...DEFAULT_PROPS2, ...options };
|
|
2008
1876
|
this.tileset = tileset;
|
|
@@ -2114,10 +1982,7 @@ var Tileset3D = class {
|
|
|
2114
1982
|
}
|
|
2115
1983
|
adjustScreenSpaceError() {
|
|
2116
1984
|
if (this.gpuMemoryUsageInBytes < this._cacheBytes) {
|
|
2117
|
-
this.memoryAdjustedScreenSpaceError = Math.max(
|
|
2118
|
-
this.memoryAdjustedScreenSpaceError / 1.02,
|
|
2119
|
-
this.options.maximumScreenSpaceError
|
|
2120
|
-
);
|
|
1985
|
+
this.memoryAdjustedScreenSpaceError = Math.max(this.memoryAdjustedScreenSpaceError / 1.02, this.options.maximumScreenSpaceError);
|
|
2121
1986
|
} else if (this.gpuMemoryUsageInBytes > this._cacheBytes + this._cacheOverflowBytes) {
|
|
2122
1987
|
this.memoryAdjustedScreenSpaceError *= 1.02;
|
|
2123
1988
|
}
|
|
@@ -2185,11 +2050,7 @@ var Tileset3D = class {
|
|
|
2185
2050
|
}
|
|
2186
2051
|
const currentFrameStateData = this.frameStateData[id];
|
|
2187
2052
|
const selectedTiles = Object.values(this._traverser.selectedTiles);
|
|
2188
|
-
const [filteredSelectedTiles, unselectedTiles] = limitSelectedTiles(
|
|
2189
|
-
selectedTiles,
|
|
2190
|
-
frameState,
|
|
2191
|
-
this.options.maximumTilesSelected
|
|
2192
|
-
);
|
|
2053
|
+
const [filteredSelectedTiles, unselectedTiles] = limitSelectedTiles(selectedTiles, frameState, this.options.maximumTilesSelected);
|
|
2193
2054
|
currentFrameStateData.selectedTiles = filteredSelectedTiles;
|
|
2194
2055
|
for (const tile of unselectedTiles) {
|
|
2195
2056
|
tile.unselect();
|
|
@@ -2262,16 +2123,16 @@ var Tileset3D = class {
|
|
|
2262
2123
|
this.stats.get(MAXIMUM_SSE).count = this.memoryAdjustedScreenSpaceError;
|
|
2263
2124
|
}
|
|
2264
2125
|
async _initializeTileSet(tilesetJson) {
|
|
2265
|
-
if (this.type ===
|
|
2126
|
+
if (this.type === TILESET_TYPE.I3S) {
|
|
2266
2127
|
this.calculateViewPropsI3S();
|
|
2267
2128
|
tilesetJson.root = await tilesetJson.root;
|
|
2268
2129
|
}
|
|
2269
2130
|
this.root = this._initializeTileHeaders(tilesetJson, null);
|
|
2270
|
-
if (this.type ===
|
|
2131
|
+
if (this.type === TILESET_TYPE.TILES3D) {
|
|
2271
2132
|
this._initializeTiles3DTileset(tilesetJson);
|
|
2272
2133
|
this.calculateViewPropsTiles3D();
|
|
2273
2134
|
}
|
|
2274
|
-
if (this.type ===
|
|
2135
|
+
if (this.type === TILESET_TYPE.I3S) {
|
|
2275
2136
|
this._initializeI3STileset();
|
|
2276
2137
|
}
|
|
2277
2138
|
}
|
|
@@ -2286,11 +2147,7 @@ var Tileset3D = class {
|
|
|
2286
2147
|
const fullExtent = this.tileset.fullExtent;
|
|
2287
2148
|
if (fullExtent) {
|
|
2288
2149
|
const { xmin, xmax, ymin, ymax, zmin, zmax } = fullExtent;
|
|
2289
|
-
this.cartographicCenter = new import_core10.Vector3(
|
|
2290
|
-
xmin + (xmax - xmin) / 2,
|
|
2291
|
-
ymin + (ymax - ymin) / 2,
|
|
2292
|
-
zmin + (zmax - zmin) / 2
|
|
2293
|
-
);
|
|
2150
|
+
this.cartographicCenter = new import_core10.Vector3(xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2, zmin + (zmax - zmin) / 2);
|
|
2294
2151
|
this.cartesianCenter = new import_core10.Vector3();
|
|
2295
2152
|
import_geospatial6.Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter);
|
|
2296
2153
|
this.zoom = getZoomFromFullExtent(fullExtent, this.cartographicCenter, this.cartesianCenter);
|
|
@@ -2356,7 +2213,7 @@ var Tileset3D = class {
|
|
|
2356
2213
|
parentTileHeader.children.push(rootTile);
|
|
2357
2214
|
rootTile.depth = parentTileHeader.depth + 1;
|
|
2358
2215
|
}
|
|
2359
|
-
if (this.type ===
|
|
2216
|
+
if (this.type === TILESET_TYPE.TILES3D) {
|
|
2360
2217
|
const stack = [];
|
|
2361
2218
|
stack.push(rootTile);
|
|
2362
2219
|
while (stack.length > 0) {
|
|
@@ -2384,10 +2241,10 @@ var Tileset3D = class {
|
|
|
2384
2241
|
let TraverserClass;
|
|
2385
2242
|
const type = this.type;
|
|
2386
2243
|
switch (type) {
|
|
2387
|
-
case
|
|
2244
|
+
case TILESET_TYPE.TILES3D:
|
|
2388
2245
|
TraverserClass = Tileset3DTraverser;
|
|
2389
2246
|
break;
|
|
2390
|
-
case
|
|
2247
|
+
case TILESET_TYPE.I3S:
|
|
2391
2248
|
TraverserClass = I3STilesetTraverser;
|
|
2392
2249
|
break;
|
|
2393
2250
|
default:
|
|
@@ -2425,7 +2282,7 @@ var Tileset3D = class {
|
|
|
2425
2282
|
if (!loaded) {
|
|
2426
2283
|
return;
|
|
2427
2284
|
}
|
|
2428
|
-
if (this.type ===
|
|
2285
|
+
if (this.type === TILESET_TYPE.I3S) {
|
|
2429
2286
|
const nodesInNodePages = ((_b = (_a = this.tileset) == null ? void 0 : _a.nodePagesTile) == null ? void 0 : _b.nodesInNodePages) || 0;
|
|
2430
2287
|
this.stats.get(TILES_TOTAL).reset();
|
|
2431
2288
|
this.stats.get(TILES_TOTAL).addCount(nodesInNodePages);
|
|
@@ -2443,7 +2300,7 @@ var Tileset3D = class {
|
|
|
2443
2300
|
*/
|
|
2444
2301
|
updateContentTypes(tile) {
|
|
2445
2302
|
var _a;
|
|
2446
|
-
if (this.type ===
|
|
2303
|
+
if (this.type === TILESET_TYPE.I3S) {
|
|
2447
2304
|
if (tile.header.isDracoGeometry) {
|
|
2448
2305
|
this.contentFormats.draco = true;
|
|
2449
2306
|
}
|
|
@@ -2456,7 +2313,7 @@ var Tileset3D = class {
|
|
|
2456
2313
|
break;
|
|
2457
2314
|
default:
|
|
2458
2315
|
}
|
|
2459
|
-
} else if (this.type ===
|
|
2316
|
+
} else if (this.type === TILESET_TYPE.TILES3D) {
|
|
2460
2317
|
const { extensionsRemoved = [] } = ((_a = tile.content) == null ? void 0 : _a.gltf) || {};
|
|
2461
2318
|
if (extensionsRemoved.includes("KHR_draco_mesh_compression")) {
|
|
2462
2319
|
this.contentFormats.draco = true;
|
|
@@ -2564,3 +2421,4 @@ var Tileset3D = class {
|
|
|
2564
2421
|
}
|
|
2565
2422
|
}
|
|
2566
2423
|
};
|
|
2424
|
+
//# sourceMappingURL=index.cjs.map
|