@loaders.gl/tiles 4.0.0-alpha.4 → 4.0.0-alpha.6
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/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/constants.d.ts +32 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +30 -26
- package/dist/dist.min.js +8921 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/constants.js +44 -0
- package/dist/es5/constants.js.map +1 -0
- package/dist/es5/index.js +93 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/tileset/format-3d-tiles/tileset-3d-traverser.js +70 -0
- package/dist/es5/tileset/format-3d-tiles/tileset-3d-traverser.js.map +1 -0
- package/dist/es5/tileset/format-i3s/i3s-pending-tiles-register.js +45 -0
- package/dist/es5/tileset/format-i3s/i3s-pending-tiles-register.js.map +1 -0
- package/dist/es5/tileset/format-i3s/i3s-tile-manager.js +84 -0
- package/dist/es5/tileset/format-i3s/i3s-tile-manager.js.map +1 -0
- package/dist/es5/tileset/format-i3s/i3s-tileset-traverser.js +143 -0
- package/dist/es5/tileset/format-i3s/i3s-tileset-traverser.js.map +1 -0
- package/dist/es5/tileset/helpers/3d-tiles-options.js +12 -0
- package/dist/es5/tileset/helpers/3d-tiles-options.js.map +1 -0
- package/dist/es5/tileset/helpers/bounding-volume.js +176 -0
- package/dist/es5/tileset/helpers/bounding-volume.js.map +1 -0
- package/dist/es5/tileset/helpers/frame-state.js +129 -0
- package/dist/es5/tileset/helpers/frame-state.js.map +1 -0
- package/dist/es5/tileset/helpers/i3s-lod.js +60 -0
- package/dist/es5/tileset/helpers/i3s-lod.js.map +1 -0
- package/dist/es5/tileset/helpers/tiles-3d-lod.js +103 -0
- package/dist/es5/tileset/helpers/tiles-3d-lod.js.map +1 -0
- package/dist/es5/tileset/helpers/transform-utils.js +50 -0
- package/dist/es5/tileset/helpers/transform-utils.js.map +1 -0
- package/dist/es5/tileset/helpers/zoom.js +63 -0
- package/dist/es5/tileset/helpers/zoom.js.map +1 -0
- package/dist/es5/tileset/tile-3d.js +565 -0
- package/dist/es5/tileset/tile-3d.js.map +1 -0
- package/dist/es5/tileset/tileset-3d.js +890 -0
- package/dist/es5/tileset/tileset-3d.js.map +1 -0
- package/dist/es5/tileset/tileset-cache.js +85 -0
- package/dist/es5/tileset/tileset-cache.js.map +1 -0
- package/dist/es5/tileset/tileset-traverser.js +328 -0
- package/dist/es5/tileset/tileset-traverser.js.map +1 -0
- package/dist/es5/types.js +2 -0
- package/dist/es5/types.js.map +1 -0
- package/dist/es5/utils/doubly-linked-list-node.js +21 -0
- package/dist/es5/utils/doubly-linked-list-node.js.map +1 -0
- package/dist/es5/utils/doubly-linked-list.js +88 -0
- package/dist/es5/utils/doubly-linked-list.js.map +1 -0
- package/dist/es5/utils/managed-array.js +126 -0
- package/dist/es5/utils/managed-array.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/constants.js +32 -0
- package/dist/esm/constants.js.map +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/{tileset/traversers → esm/tileset/format-3d-tiles}/tileset-3d-traverser.js +2 -13
- package/dist/esm/tileset/format-3d-tiles/tileset-3d-traverser.js.map +1 -0
- package/dist/esm/tileset/format-i3s/i3s-pending-tiles-register.js +26 -0
- package/dist/esm/tileset/format-i3s/i3s-pending-tiles-register.js.map +1 -0
- package/dist/esm/tileset/format-i3s/i3s-tile-manager.js +79 -0
- package/dist/esm/tileset/format-i3s/i3s-tile-manager.js.map +1 -0
- package/dist/{tileset/traversers → esm/tileset/format-i3s}/i3s-tileset-traverser.js +16 -28
- package/dist/esm/tileset/format-i3s/i3s-tileset-traverser.js.map +1 -0
- package/dist/esm/tileset/helpers/3d-tiles-options.js +6 -0
- package/dist/esm/tileset/helpers/3d-tiles-options.js.map +1 -0
- package/dist/esm/tileset/helpers/bounding-volume.js +155 -0
- package/dist/esm/tileset/helpers/bounding-volume.js.map +1 -0
- package/dist/esm/tileset/helpers/frame-state.js +109 -0
- package/dist/esm/tileset/helpers/frame-state.js.map +1 -0
- package/dist/esm/tileset/helpers/i3s-lod.js +53 -0
- package/dist/esm/tileset/helpers/i3s-lod.js.map +1 -0
- package/dist/esm/tileset/helpers/tiles-3d-lod.js +100 -0
- package/dist/{tileset → esm/tileset}/helpers/tiles-3d-lod.js.map +1 -1
- package/dist/esm/tileset/helpers/transform-utils.js +50 -0
- package/dist/esm/tileset/helpers/transform-utils.js.map +1 -0
- package/dist/esm/tileset/helpers/zoom.js +55 -0
- package/dist/esm/tileset/helpers/zoom.js.map +1 -0
- package/dist/esm/tileset/tile-3d.js +445 -0
- package/dist/esm/tileset/tile-3d.js.map +1 -0
- package/dist/esm/tileset/tileset-3d.js +637 -0
- package/dist/esm/tileset/tileset-3d.js.map +1 -0
- package/dist/esm/tileset/tileset-cache.js +60 -0
- package/dist/esm/tileset/tileset-cache.js.map +1 -0
- package/dist/{tileset/traversers → esm/tileset}/tileset-traverser.js +20 -72
- package/dist/esm/tileset/tileset-traverser.js.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/doubly-linked-list-node.js +12 -0
- package/dist/esm/utils/doubly-linked-list-node.js.map +1 -0
- package/dist/esm/utils/doubly-linked-list.js +65 -0
- package/dist/esm/utils/doubly-linked-list.js.map +1 -0
- package/dist/esm/utils/managed-array.js +87 -0
- package/dist/esm/utils/managed-array.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -9
- package/dist/tileset/format-3d-tiles/tileset-3d-traverser.d.ts +7 -0
- package/dist/tileset/format-3d-tiles/tileset-3d-traverser.d.ts.map +1 -0
- package/dist/tileset/format-3d-tiles/tileset-3d-traverser.js +54 -0
- package/dist/tileset/format-i3s/i3s-pending-tiles-register.d.ts +27 -0
- package/dist/tileset/format-i3s/i3s-pending-tiles-register.d.ts.map +1 -0
- package/dist/tileset/format-i3s/i3s-pending-tiles-register.js +47 -0
- package/dist/tileset/format-i3s/i3s-tile-manager.d.ts +34 -0
- package/dist/tileset/format-i3s/i3s-tile-manager.d.ts.map +1 -0
- package/dist/tileset/format-i3s/i3s-tile-manager.js +80 -0
- package/dist/tileset/format-i3s/i3s-tileset-traverser.d.ts +25 -0
- package/dist/tileset/format-i3s/i3s-tileset-traverser.d.ts.map +1 -0
- package/dist/tileset/format-i3s/i3s-tileset-traverser.js +92 -0
- package/dist/tileset/helpers/3d-tiles-options.d.ts +4 -0
- package/dist/tileset/helpers/3d-tiles-options.d.ts.map +1 -0
- package/dist/tileset/helpers/3d-tiles-options.js +8 -5
- package/dist/tileset/helpers/bounding-volume.d.ts +19 -0
- package/dist/tileset/helpers/bounding-volume.d.ts.map +1 -0
- package/dist/tileset/helpers/bounding-volume.js +274 -69
- package/dist/tileset/helpers/frame-state.d.ts +28 -0
- package/dist/tileset/helpers/frame-state.d.ts.map +1 -0
- package/dist/tileset/helpers/frame-state.js +131 -49
- package/dist/tileset/helpers/i3s-lod.d.ts +20 -0
- package/dist/tileset/helpers/i3s-lod.d.ts.map +1 -0
- package/dist/tileset/helpers/i3s-lod.js +82 -105
- package/dist/tileset/helpers/tiles-3d-lod.d.ts +8 -0
- package/dist/tileset/helpers/tiles-3d-lod.d.ts.map +1 -0
- package/dist/tileset/helpers/tiles-3d-lod.js +112 -100
- package/dist/tileset/helpers/transform-utils.d.ts +2 -0
- package/dist/tileset/helpers/transform-utils.d.ts.map +1 -0
- package/dist/tileset/helpers/transform-utils.js +51 -56
- package/dist/tileset/helpers/zoom.d.ts +46 -0
- package/dist/tileset/helpers/zoom.d.ts.map +1 -0
- package/dist/tileset/helpers/zoom.js +83 -30
- package/dist/tileset/tile-3d.d.ts +206 -0
- package/dist/tileset/tile-3d.d.ts.map +1 -0
- package/dist/tileset/tile-3d.js +593 -531
- package/dist/tileset/tileset-3d.d.ts +217 -0
- package/dist/tileset/tileset-3d.d.ts.map +1 -0
- package/dist/tileset/tileset-3d.js +707 -648
- package/dist/tileset/tileset-cache.d.ts +18 -0
- package/dist/tileset/tileset-cache.d.ts.map +1 -0
- package/dist/tileset/tileset-cache.js +70 -71
- package/dist/tileset/tileset-traverser.d.ts +46 -0
- package/dist/tileset/tileset-traverser.d.ts.map +1 -0
- package/dist/tileset/tileset-traverser.js +309 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/utils/doubly-linked-list-node.d.ts +11 -0
- package/dist/utils/doubly-linked-list-node.d.ts.map +1 -0
- package/dist/utils/doubly-linked-list-node.js +17 -8
- package/dist/utils/doubly-linked-list.d.ts +30 -0
- package/dist/utils/doubly-linked-list.d.ts.map +1 -0
- package/dist/utils/doubly-linked-list.js +91 -72
- package/dist/utils/managed-array.d.ts +85 -0
- package/dist/utils/managed-array.d.ts.map +1 -0
- package/dist/utils/managed-array.js +144 -103
- package/package.json +10 -10
- package/src/constants.ts +2 -0
- package/src/index.ts +7 -4
- package/src/tileset/{traversers → format-3d-tiles}/tileset-3d-traverser.ts +4 -2
- package/src/tileset/format-i3s/i3s-pending-tiles-register.ts +44 -0
- package/src/tileset/format-i3s/i3s-tile-manager.ts +101 -0
- package/src/tileset/{traversers → format-i3s}/i3s-tileset-traverser.ts +27 -15
- package/src/tileset/helpers/bounding-volume.ts +136 -0
- package/src/tileset/helpers/frame-state.ts +102 -18
- package/src/tileset/helpers/i3s-lod.ts +75 -96
- package/src/tileset/helpers/tiles-3d-lod.ts +2 -0
- package/src/tileset/helpers/transform-utils.ts +2 -0
- package/src/tileset/helpers/zoom.ts +84 -9
- package/src/tileset/tile-3d.ts +77 -20
- package/src/tileset/tileset-3d.ts +205 -43
- package/src/tileset/tileset-cache.ts +6 -2
- package/src/tileset/{traversers/tileset-traverser.ts → tileset-traverser.ts} +29 -17
- package/src/types.ts +36 -0
- package/src/utils/{doubly-linked-list-node.js → doubly-linked-list-node.ts} +7 -2
- package/src/utils/{doubly-linked-list.js → doubly-linked-list.ts} +5 -8
- package/src/utils/{managed-array.js → managed-array.ts} +5 -2
- package/dist/bundle.js.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/index.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/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/traversers/i3s-tile-manager.js +0 -45
- package/dist/tileset/traversers/i3s-tile-manager.js.map +0 -1
- package/dist/tileset/traversers/i3s-tileset-traverser.js.map +0 -1
- package/dist/tileset/traversers/tileset-3d-traverser.js.map +0 -1
- package/dist/tileset/traversers/tileset-traverser.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/src/tileset/traversers/i3s-tile-manager.ts +0 -39
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Matrix4, Vector3, clamp } from '@math.gl/core';
|
|
2
|
+
const scratchPositionNormal = new Vector3();
|
|
3
|
+
const scratchCartographic = new Vector3();
|
|
4
|
+
const scratchMatrix = new Matrix4();
|
|
5
|
+
const scratchCenter = new Vector3();
|
|
6
|
+
const scratchPosition = new Vector3();
|
|
7
|
+
const scratchDirection = new Vector3();
|
|
8
|
+
export function calculateDynamicScreenSpaceError(root, _ref) {
|
|
9
|
+
let {
|
|
10
|
+
camera,
|
|
11
|
+
mapProjection
|
|
12
|
+
} = _ref;
|
|
13
|
+
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
14
|
+
const {
|
|
15
|
+
dynamicScreenSpaceErrorHeightFalloff = 0.25,
|
|
16
|
+
dynamicScreenSpaceErrorDensity = 0.00278
|
|
17
|
+
} = options;
|
|
18
|
+
let up;
|
|
19
|
+
let direction;
|
|
20
|
+
let height;
|
|
21
|
+
let minimumHeight;
|
|
22
|
+
let maximumHeight;
|
|
23
|
+
const tileBoundingVolume = root.contentBoundingVolume;
|
|
24
|
+
if (tileBoundingVolume instanceof TileBoundingRegion) {
|
|
25
|
+
up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);
|
|
26
|
+
direction = camera.directionWC;
|
|
27
|
+
height = camera.positionCartographic.height;
|
|
28
|
+
minimumHeight = tileBoundingVolume.minimumHeight;
|
|
29
|
+
maximumHeight = tileBoundingVolume.maximumHeight;
|
|
30
|
+
} else {
|
|
31
|
+
const transformLocal = Matrix4.inverseTransformation(root.computedTransform, scratchMatrix);
|
|
32
|
+
const ellipsoid = mapProjection.ellipsoid;
|
|
33
|
+
const boundingVolume = tileBoundingVolume.boundingVolume;
|
|
34
|
+
const centerLocal = Matrix4.multiplyByPoint(transformLocal, boundingVolume.center, scratchCenter);
|
|
35
|
+
if (Cartesian3.magnitude(centerLocal) > ellipsoid.minimumRadius) {
|
|
36
|
+
const centerCartographic = Cartographic.fromCartesian(centerLocal, ellipsoid, scratchCartographic);
|
|
37
|
+
up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);
|
|
38
|
+
direction = camera.directionWC;
|
|
39
|
+
height = camera.positionCartographic.height;
|
|
40
|
+
minimumHeight = 0.0;
|
|
41
|
+
maximumHeight = centerCartographic.height * 2.0;
|
|
42
|
+
} else {
|
|
43
|
+
const positionLocal = Matrix4.multiplyByPoint(transformLocal, camera.positionWC, scratchPosition);
|
|
44
|
+
up = Cartesian3.UNIT_Z;
|
|
45
|
+
direction = Matrix4.multiplyByPointAsVector(transformLocal, camera.directionWC, scratchDirection);
|
|
46
|
+
direction = Cartesian3.normalize(direction, direction);
|
|
47
|
+
height = positionLocal.z;
|
|
48
|
+
if (tileBoundingVolume instanceof TileOrientedBoundingBox) {
|
|
49
|
+
const boxHeight = root._header.boundingVolume.box[11];
|
|
50
|
+
minimumHeight = centerLocal.z - boxHeight;
|
|
51
|
+
maximumHeight = centerLocal.z + boxHeight;
|
|
52
|
+
} else if (tileBoundingVolume instanceof TileBoundingSphere) {
|
|
53
|
+
const radius = boundingVolume.radius;
|
|
54
|
+
minimumHeight = centerLocal.z - radius;
|
|
55
|
+
maximumHeight = centerLocal.z + radius;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const heightFalloff = dynamicScreenSpaceErrorHeightFalloff;
|
|
60
|
+
const heightClose = minimumHeight + (maximumHeight - minimumHeight) * heightFalloff;
|
|
61
|
+
const heightFar = maximumHeight;
|
|
62
|
+
const t = clamp((height - heightClose) / (heightFar - heightClose), 0.0, 1.0);
|
|
63
|
+
const dot = Math.abs(Cartesian3.dot(direction, up));
|
|
64
|
+
let horizonFactor = 1.0 - dot;
|
|
65
|
+
horizonFactor = horizonFactor * (1.0 - t);
|
|
66
|
+
return dynamicScreenSpaceErrorDensity * horizonFactor;
|
|
67
|
+
}
|
|
68
|
+
export function fog(distanceToCamera, density) {
|
|
69
|
+
const scalar = distanceToCamera * density;
|
|
70
|
+
return 1.0 - Math.exp(-(scalar * scalar));
|
|
71
|
+
}
|
|
72
|
+
export function getDynamicScreenSpaceError(tileset, distanceToCamera) {
|
|
73
|
+
if (tileset.dynamicScreenSpaceError && tileset.dynamicScreenSpaceErrorComputedDensity) {
|
|
74
|
+
const density = tileset.dynamicScreenSpaceErrorComputedDensity;
|
|
75
|
+
const factor = tileset.dynamicScreenSpaceErrorFactor;
|
|
76
|
+
const dynamicError = fog(distanceToCamera, density) * factor;
|
|
77
|
+
return dynamicError;
|
|
78
|
+
}
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
export function getTiles3DScreenSpaceError(tile, frameState, useParentLodMetric) {
|
|
82
|
+
const tileset = tile.tileset;
|
|
83
|
+
const parentLodMetricValue = tile.parent && tile.parent.lodMetricValue || tile.lodMetricValue;
|
|
84
|
+
const lodMetricValue = useParentLodMetric ? parentLodMetricValue : tile.lodMetricValue;
|
|
85
|
+
if (lodMetricValue === 0.0) {
|
|
86
|
+
return 0.0;
|
|
87
|
+
}
|
|
88
|
+
const distance = Math.max(tile._distanceToCamera, 1e-7);
|
|
89
|
+
const {
|
|
90
|
+
height,
|
|
91
|
+
sseDenominator
|
|
92
|
+
} = frameState;
|
|
93
|
+
const {
|
|
94
|
+
viewDistanceScale
|
|
95
|
+
} = tileset.options;
|
|
96
|
+
let error = lodMetricValue * height * (viewDistanceScale || 1.0) / (distance * sseDenominator);
|
|
97
|
+
error -= getDynamicScreenSpaceError(tileset, distance);
|
|
98
|
+
return error;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=tiles-3d-lod.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tileset/helpers/tiles-3d-lod.ts"],"names":["Matrix4","Vector3","clamp","scratchPositionNormal","scratchCartographic","scratchMatrix","scratchCenter","scratchPosition","scratchDirection","calculateDynamicScreenSpaceError","root","camera","mapProjection","options","dynamicScreenSpaceErrorHeightFalloff","dynamicScreenSpaceErrorDensity","up","direction","height","minimumHeight","maximumHeight","tileBoundingVolume","contentBoundingVolume","TileBoundingRegion","Cartesian3","normalize","positionWC","directionWC","positionCartographic","transformLocal","inverseTransformation","computedTransform","ellipsoid","boundingVolume","centerLocal","multiplyByPoint","center","magnitude","minimumRadius","centerCartographic","Cartographic","fromCartesian","positionLocal","UNIT_Z","multiplyByPointAsVector","z","TileOrientedBoundingBox","boxHeight","_header","box","TileBoundingSphere","radius","heightFalloff","heightClose","heightFar","t","dot","Math","abs","horizonFactor","fog","distanceToCamera","density","scalar","exp","getDynamicScreenSpaceError","tileset","dynamicScreenSpaceError","dynamicScreenSpaceErrorComputedDensity","factor","dynamicScreenSpaceErrorFactor","dynamicError","getTiles3DScreenSpaceError","tile","frameState","useParentLodMetric","parentLodMetricValue","parent","lodMetricValue","distance","max","_distanceToCamera","sseDenominator","viewDistanceScale","error"],"mappings":"AAQA,SAAQA,OAAR,EAAiBC,OAAjB,EAA0BC,KAA1B,QAAsC,eAAtC;AAEA,MAAMC,qBAAqB,GAAG,IAAIF,OAAJ,EAA9B;AACA,MAAMG,mBAAmB,GAAG,IAAIH,OAAJ,EAA5B;AACA,MAAMI,aAAa,GAAG,IAAIL,OAAJ,EAAtB;AACA,MAAMM,aAAa,GAAG,IAAIL,OAAJ,EAAtB;AACA,MAAMM,eAAe,GAAG,IAAIN,OAAJ,EAAxB;AACA,MAAMO,gBAAgB,GAAG,IAAIP,OAAJ,EAAzB;AAGA,OAAO,SAASQ,gCAAT,CAA0CC,IAA1C,EAAgD;AAACC,EAAAA,MAAD;AAASC,EAAAA;AAAT,CAAhD,EAAyEC,OAAO,GAAG,EAAnF,EAAuF;AAC5F,QAAM;AAACC,IAAAA,oCAAoC,GAAG,IAAxC;AAA8CC,IAAAA,8BAA8B,GAAG;AAA/E,MACJF,OADF;AAGA,MAAIG,EAAJ;AACA,MAAIC,SAAJ;AACA,MAAIC,MAAJ;AACA,MAAIC,aAAJ;AACA,MAAIC,aAAJ;AAEA,QAAMC,kBAAkB,GAAGX,IAAI,CAACY,qBAAhC;;AAEA,MAAID,kBAAkB,YAAYE,kBAAlC,EAAsD;AACpDP,IAAAA,EAAE,GAAGQ,UAAU,CAACC,SAAX,CAAqBd,MAAM,CAACe,UAA5B,EAAwCvB,qBAAxC,CAAL;AACAc,IAAAA,SAAS,GAAGN,MAAM,CAACgB,WAAnB;AACAT,IAAAA,MAAM,GAAGP,MAAM,CAACiB,oBAAP,CAA4BV,MAArC;AACAC,IAAAA,aAAa,GAAGE,kBAAkB,CAACF,aAAnC;AACAC,IAAAA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;AACD","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - Dynamic screen space error provides an optimization when looking at\n// tilesets from above\n\n/* eslint-disable */\n// @ts-nocheck\nimport {Matrix4, Vector3, clamp} from '@math.gl/core';\n\nconst scratchPositionNormal = new Vector3();\nconst scratchCartographic = new Vector3();\nconst scratchMatrix = new Matrix4();\nconst scratchCenter = new Vector3();\nconst scratchPosition = new Vector3();\nconst scratchDirection = new Vector3();\n\n// eslint-disable-next-line max-statements, complexity\nexport function calculateDynamicScreenSpaceError(root, {camera, mapProjection}, options = {}) {\n const {dynamicScreenSpaceErrorHeightFalloff = 0.25, dynamicScreenSpaceErrorDensity = 0.00278} =\n options;\n\n let up;\n let direction;\n let height;\n let minimumHeight;\n let maximumHeight;\n\n const tileBoundingVolume = root.contentBoundingVolume;\n\n if (tileBoundingVolume instanceof TileBoundingRegion) {\n up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);\n direction = camera.directionWC;\n height = camera.positionCartographic.height;\n minimumHeight = tileBoundingVolume.minimumHeight;\n maximumHeight = tileBoundingVolume.maximumHeight;\n } else {\n // Transform camera position and direction into the local coordinate system of the tileset\n const transformLocal = Matrix4.inverseTransformation(root.computedTransform, scratchMatrix);\n const ellipsoid = mapProjection.ellipsoid;\n const boundingVolume = tileBoundingVolume.boundingVolume;\n const centerLocal = Matrix4.multiplyByPoint(\n transformLocal,\n boundingVolume.center,\n scratchCenter\n );\n if (Cartesian3.magnitude(centerLocal) > ellipsoid.minimumRadius) {\n // The tileset is defined in WGS84. Approximate the minimum and maximum height.\n const centerCartographic = Cartographic.fromCartesian(\n centerLocal,\n ellipsoid,\n scratchCartographic\n );\n up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);\n direction = camera.directionWC;\n height = camera.positionCartographic.height;\n minimumHeight = 0.0;\n maximumHeight = centerCartographic.height * 2.0;\n } else {\n // The tileset is defined in local coordinates (z-up)\n const positionLocal = Matrix4.multiplyByPoint(\n transformLocal,\n camera.positionWC,\n scratchPosition\n );\n up = Cartesian3.UNIT_Z;\n direction = Matrix4.multiplyByPointAsVector(\n transformLocal,\n camera.directionWC,\n scratchDirection\n );\n direction = Cartesian3.normalize(direction, direction);\n height = positionLocal.z;\n if (tileBoundingVolume instanceof TileOrientedBoundingBox) {\n // Assuming z-up, the last component stores the half-height of the box\n const boxHeight = root._header.boundingVolume.box[11];\n minimumHeight = centerLocal.z - boxHeight;\n maximumHeight = centerLocal.z + boxHeight;\n } else if (tileBoundingVolume instanceof TileBoundingSphere) {\n const radius = boundingVolume.radius;\n minimumHeight = centerLocal.z - radius;\n maximumHeight = centerLocal.z + radius;\n }\n }\n }\n\n // The range where the density starts to lessen. Start at the quarter height of the tileset.\n const heightFalloff = dynamicScreenSpaceErrorHeightFalloff;\n const heightClose = minimumHeight + (maximumHeight - minimumHeight) * heightFalloff;\n const heightFar = maximumHeight;\n\n const t = clamp((height - heightClose) / (heightFar - heightClose), 0.0, 1.0);\n\n // Increase density as the camera tilts towards the horizon\n const dot = Math.abs(Cartesian3.dot(direction, up));\n\n let horizonFactor = 1.0 - dot;\n\n // Weaken the horizon factor as the camera height increases, implying the camera is further away from the tileset.\n // The goal is to increase density for the \"street view\", not when viewing the tileset from a distance.\n horizonFactor = horizonFactor * (1.0 - t);\n\n return dynamicScreenSpaceErrorDensity * horizonFactor;\n}\n\nexport function fog(distanceToCamera, density) {\n const scalar = distanceToCamera * density;\n return 1.0 - Math.exp(-(scalar * scalar));\n}\n\nexport function getDynamicScreenSpaceError(tileset, distanceToCamera) {\n if (tileset.dynamicScreenSpaceError && tileset.dynamicScreenSpaceErrorComputedDensity) {\n const density = tileset.dynamicScreenSpaceErrorComputedDensity;\n const factor = tileset.dynamicScreenSpaceErrorFactor;\n // TODO: Refined screen space error that minimizes tiles in non-first-person\n const dynamicError = fog(distanceToCamera, density) * factor;\n return dynamicError;\n }\n\n return 0;\n}\n\nexport function getTiles3DScreenSpaceError(tile, frameState, useParentLodMetric) {\n const tileset = tile.tileset;\n const parentLodMetricValue = (tile.parent && tile.parent.lodMetricValue) || tile.lodMetricValue;\n const lodMetricValue = useParentLodMetric ? parentLodMetricValue : tile.lodMetricValue;\n\n // Leaf tiles do not have any error so save the computation\n if (lodMetricValue === 0.0) {\n return 0.0;\n }\n\n // TODO: Orthographic Frustum needs special treatment?\n // this._getOrthograhicScreenSpaceError();\n\n // Avoid divide by zero when viewer is inside the tile\n const distance = Math.max(tile._distanceToCamera, 1e-7);\n const {height, sseDenominator} = frameState;\n const {viewDistanceScale} = tileset.options;\n let error = (lodMetricValue * height * (viewDistanceScale || 1.0)) / (distance * sseDenominator);\n\n error -= getDynamicScreenSpaceError(tileset, distance);\n\n return error;\n}\n"],"file":"tiles-3d-lod.js"}
|
|
1
|
+
{"version":3,"file":"tiles-3d-lod.js","names":["Matrix4","Vector3","clamp","scratchPositionNormal","scratchCartographic","scratchMatrix","scratchCenter","scratchPosition","scratchDirection","calculateDynamicScreenSpaceError","root","_ref","camera","mapProjection","options","arguments","length","undefined","dynamicScreenSpaceErrorHeightFalloff","dynamicScreenSpaceErrorDensity","up","direction","height","minimumHeight","maximumHeight","tileBoundingVolume","contentBoundingVolume","TileBoundingRegion","Cartesian3","normalize","positionWC","directionWC","positionCartographic","transformLocal","inverseTransformation","computedTransform","ellipsoid","boundingVolume","centerLocal","multiplyByPoint","center","magnitude","minimumRadius","centerCartographic","Cartographic","fromCartesian","positionLocal","UNIT_Z","multiplyByPointAsVector","z","TileOrientedBoundingBox","boxHeight","_header","box","TileBoundingSphere","radius","heightFalloff","heightClose","heightFar","t","dot","Math","abs","horizonFactor","fog","distanceToCamera","density","scalar","exp","getDynamicScreenSpaceError","tileset","dynamicScreenSpaceError","dynamicScreenSpaceErrorComputedDensity","factor","dynamicScreenSpaceErrorFactor","dynamicError","getTiles3DScreenSpaceError","tile","frameState","useParentLodMetric","parentLodMetricValue","parent","lodMetricValue","distance","max","_distanceToCamera","sseDenominator","viewDistanceScale","error"],"sources":["../../../../src/tileset/helpers/tiles-3d-lod.ts"],"sourcesContent":["// loaders.gl, MIT license\n\n// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\n// TODO - Dynamic screen space error provides an optimization when looking at\n// tilesets from above\n\n/* eslint-disable */\n// @ts-nocheck\nimport {Matrix4, Vector3, clamp} from '@math.gl/core';\n\nconst scratchPositionNormal = new Vector3();\nconst scratchCartographic = new Vector3();\nconst scratchMatrix = new Matrix4();\nconst scratchCenter = new Vector3();\nconst scratchPosition = new Vector3();\nconst scratchDirection = new Vector3();\n\n// eslint-disable-next-line max-statements, complexity\nexport function calculateDynamicScreenSpaceError(root, {camera, mapProjection}, options = {}) {\n const {dynamicScreenSpaceErrorHeightFalloff = 0.25, dynamicScreenSpaceErrorDensity = 0.00278} =\n options;\n\n let up;\n let direction;\n let height;\n let minimumHeight;\n let maximumHeight;\n\n const tileBoundingVolume = root.contentBoundingVolume;\n\n if (tileBoundingVolume instanceof TileBoundingRegion) {\n up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);\n direction = camera.directionWC;\n height = camera.positionCartographic.height;\n minimumHeight = tileBoundingVolume.minimumHeight;\n maximumHeight = tileBoundingVolume.maximumHeight;\n } else {\n // Transform camera position and direction into the local coordinate system of the tileset\n const transformLocal = Matrix4.inverseTransformation(root.computedTransform, scratchMatrix);\n const ellipsoid = mapProjection.ellipsoid;\n const boundingVolume = tileBoundingVolume.boundingVolume;\n const centerLocal = Matrix4.multiplyByPoint(\n transformLocal,\n boundingVolume.center,\n scratchCenter\n );\n if (Cartesian3.magnitude(centerLocal) > ellipsoid.minimumRadius) {\n // The tileset is defined in WGS84. Approximate the minimum and maximum height.\n const centerCartographic = Cartographic.fromCartesian(\n centerLocal,\n ellipsoid,\n scratchCartographic\n );\n up = Cartesian3.normalize(camera.positionWC, scratchPositionNormal);\n direction = camera.directionWC;\n height = camera.positionCartographic.height;\n minimumHeight = 0.0;\n maximumHeight = centerCartographic.height * 2.0;\n } else {\n // The tileset is defined in local coordinates (z-up)\n const positionLocal = Matrix4.multiplyByPoint(\n transformLocal,\n camera.positionWC,\n scratchPosition\n );\n up = Cartesian3.UNIT_Z;\n direction = Matrix4.multiplyByPointAsVector(\n transformLocal,\n camera.directionWC,\n scratchDirection\n );\n direction = Cartesian3.normalize(direction, direction);\n height = positionLocal.z;\n if (tileBoundingVolume instanceof TileOrientedBoundingBox) {\n // Assuming z-up, the last component stores the half-height of the box\n const boxHeight = root._header.boundingVolume.box[11];\n minimumHeight = centerLocal.z - boxHeight;\n maximumHeight = centerLocal.z + boxHeight;\n } else if (tileBoundingVolume instanceof TileBoundingSphere) {\n const radius = boundingVolume.radius;\n minimumHeight = centerLocal.z - radius;\n maximumHeight = centerLocal.z + radius;\n }\n }\n }\n\n // The range where the density starts to lessen. Start at the quarter height of the tileset.\n const heightFalloff = dynamicScreenSpaceErrorHeightFalloff;\n const heightClose = minimumHeight + (maximumHeight - minimumHeight) * heightFalloff;\n const heightFar = maximumHeight;\n\n const t = clamp((height - heightClose) / (heightFar - heightClose), 0.0, 1.0);\n\n // Increase density as the camera tilts towards the horizon\n const dot = Math.abs(Cartesian3.dot(direction, up));\n\n let horizonFactor = 1.0 - dot;\n\n // Weaken the horizon factor as the camera height increases, implying the camera is further away from the tileset.\n // The goal is to increase density for the \"street view\", not when viewing the tileset from a distance.\n horizonFactor = horizonFactor * (1.0 - t);\n\n return dynamicScreenSpaceErrorDensity * horizonFactor;\n}\n\nexport function fog(distanceToCamera, density) {\n const scalar = distanceToCamera * density;\n return 1.0 - Math.exp(-(scalar * scalar));\n}\n\nexport function getDynamicScreenSpaceError(tileset, distanceToCamera) {\n if (tileset.dynamicScreenSpaceError && tileset.dynamicScreenSpaceErrorComputedDensity) {\n const density = tileset.dynamicScreenSpaceErrorComputedDensity;\n const factor = tileset.dynamicScreenSpaceErrorFactor;\n // TODO: Refined screen space error that minimizes tiles in non-first-person\n const dynamicError = fog(distanceToCamera, density) * factor;\n return dynamicError;\n }\n\n return 0;\n}\n\nexport function getTiles3DScreenSpaceError(tile, frameState, useParentLodMetric) {\n const tileset = tile.tileset;\n const parentLodMetricValue = (tile.parent && tile.parent.lodMetricValue) || tile.lodMetricValue;\n const lodMetricValue = useParentLodMetric ? parentLodMetricValue : tile.lodMetricValue;\n\n // Leaf tiles do not have any error so save the computation\n if (lodMetricValue === 0.0) {\n return 0.0;\n }\n\n // TODO: Orthographic Frustum needs special treatment?\n // this._getOrthograhicScreenSpaceError();\n\n // Avoid divide by zero when viewer is inside the tile\n const distance = Math.max(tile._distanceToCamera, 1e-7);\n const {height, sseDenominator} = frameState;\n const {viewDistanceScale} = tileset.options;\n let error = (lodMetricValue * height * (viewDistanceScale || 1.0)) / (distance * sseDenominator);\n\n error -= getDynamicScreenSpaceError(tileset, distance);\n\n return error;\n}\n"],"mappings":"AAUA,SAAQA,OAAO,EAAEC,OAAO,EAAEC,KAAK,QAAO,eAAe;AAErD,MAAMC,qBAAqB,GAAG,IAAIF,OAAO,CAAC,CAAC;AAC3C,MAAMG,mBAAmB,GAAG,IAAIH,OAAO,CAAC,CAAC;AACzC,MAAMI,aAAa,GAAG,IAAIL,OAAO,CAAC,CAAC;AACnC,MAAMM,aAAa,GAAG,IAAIL,OAAO,CAAC,CAAC;AACnC,MAAMM,eAAe,GAAG,IAAIN,OAAO,CAAC,CAAC;AACrC,MAAMO,gBAAgB,GAAG,IAAIP,OAAO,CAAC,CAAC;AAGtC,OAAO,SAASQ,gCAAgCA,CAACC,IAAI,EAAAC,IAAA,EAAyC;EAAA,IAAvC;IAACC,MAAM;IAAEC;EAAa,CAAC,GAAAF,IAAA;EAAA,IAAEG,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC1F,MAAM;IAACG,oCAAoC,GAAG,IAAI;IAA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;IAAEgE;EAAc,CAAC,GAAGR,UAAU;EAC3C,MAAM;IAACS;EAAiB,CAAC,GAAGjB,OAAO,CAACxD,OAAO;EAC3C,IAAI0E,KAAK,GAAIN,cAAc,GAAG5D,MAAM,IAAIiE,iBAAiB,IAAI,GAAG,CAAC,IAAKJ,QAAQ,GAAGG,cAAc,CAAC;EAEhGE,KAAK,IAAInB,0BAA0B,CAACC,OAAO,EAAEa,QAAQ,CAAC;EAEtD,OAAOK,KAAK;AACd"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Ellipsoid } from '@math.gl/geospatial';
|
|
2
|
+
import { Matrix4, Vector3 } from '@math.gl/core';
|
|
3
|
+
import { assert } from '@loaders.gl/loader-utils';
|
|
4
|
+
export function calculateTransformProps(tileHeader, tile) {
|
|
5
|
+
assert(tileHeader);
|
|
6
|
+
assert(tile);
|
|
7
|
+
const {
|
|
8
|
+
rtcCenter,
|
|
9
|
+
gltfUpAxis
|
|
10
|
+
} = tile;
|
|
11
|
+
const {
|
|
12
|
+
computedTransform,
|
|
13
|
+
boundingVolume: {
|
|
14
|
+
center
|
|
15
|
+
}
|
|
16
|
+
} = tileHeader;
|
|
17
|
+
let modelMatrix = new Matrix4(computedTransform);
|
|
18
|
+
if (rtcCenter) {
|
|
19
|
+
modelMatrix.translate(rtcCenter);
|
|
20
|
+
}
|
|
21
|
+
switch (gltfUpAxis) {
|
|
22
|
+
case 'Z':
|
|
23
|
+
break;
|
|
24
|
+
case 'Y':
|
|
25
|
+
const rotationY = new Matrix4().rotateX(Math.PI / 2);
|
|
26
|
+
modelMatrix = modelMatrix.multiplyRight(rotationY);
|
|
27
|
+
break;
|
|
28
|
+
case 'X':
|
|
29
|
+
const rotationX = new Matrix4().rotateY(-Math.PI / 2);
|
|
30
|
+
modelMatrix = modelMatrix.multiplyRight(rotationX);
|
|
31
|
+
break;
|
|
32
|
+
default:
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
if (tile.isQuantized) {
|
|
36
|
+
modelMatrix.translate(tile.quantizedVolumeOffset).scale(tile.quantizedVolumeScale);
|
|
37
|
+
}
|
|
38
|
+
const cartesianOrigin = new Vector3(center);
|
|
39
|
+
tile.cartesianModelMatrix = modelMatrix;
|
|
40
|
+
tile.cartesianOrigin = cartesianOrigin;
|
|
41
|
+
const cartographicOrigin = Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new Vector3());
|
|
42
|
+
const fromFixedFrameMatrix = Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin);
|
|
43
|
+
const toFixedFrameMatrix = fromFixedFrameMatrix.invert();
|
|
44
|
+
tile.cartographicModelMatrix = toFixedFrameMatrix.multiplyRight(modelMatrix);
|
|
45
|
+
tile.cartographicOrigin = cartographicOrigin;
|
|
46
|
+
if (!tile.coordinateSystem) {
|
|
47
|
+
tile.modelMatrix = tile.cartographicModelMatrix;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=transform-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform-utils.js","names":["Ellipsoid","Matrix4","Vector3","assert","calculateTransformProps","tileHeader","tile","rtcCenter","gltfUpAxis","computedTransform","boundingVolume","center","modelMatrix","translate","rotationY","rotateX","Math","PI","multiplyRight","rotationX","rotateY","isQuantized","quantizedVolumeOffset","scale","quantizedVolumeScale","cartesianOrigin","cartesianModelMatrix","cartographicOrigin","WGS84","cartesianToCartographic","fromFixedFrameMatrix","eastNorthUpToFixedFrame","toFixedFrameMatrix","invert","cartographicModelMatrix","coordinateSystem"],"sources":["../../../../src/tileset/helpers/transform-utils.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {Matrix4, Vector3} from '@math.gl/core';\nimport {assert} from '@loaders.gl/loader-utils';\n\nexport function calculateTransformProps(tileHeader, tile) {\n assert(tileHeader);\n assert(tile);\n\n const {rtcCenter, gltfUpAxis} = tile;\n const {\n computedTransform,\n boundingVolume: {center}\n } = tileHeader;\n\n let modelMatrix = new Matrix4(computedTransform);\n\n // Translate if appropriate\n if (rtcCenter) {\n modelMatrix.translate(rtcCenter);\n }\n\n // glTF models need to be rotated from Y to Z up\n // https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#y-up-to-z-up\n switch (gltfUpAxis) {\n case 'Z':\n break;\n case 'Y':\n const rotationY = new Matrix4().rotateX(Math.PI / 2);\n modelMatrix = modelMatrix.multiplyRight(rotationY);\n break;\n case 'X':\n const rotationX = new Matrix4().rotateY(-Math.PI / 2);\n modelMatrix = modelMatrix.multiplyRight(rotationX);\n break;\n default:\n break;\n }\n\n // Scale/offset positions if normalized integers\n if (tile.isQuantized) {\n modelMatrix.translate(tile.quantizedVolumeOffset).scale(tile.quantizedVolumeScale);\n }\n\n // Option 1: Cartesian matrix and origin\n const cartesianOrigin = new Vector3(center);\n\n tile.cartesianModelMatrix = modelMatrix;\n tile.cartesianOrigin = cartesianOrigin;\n\n // Option 2: Cartographic matrix and origin\n const cartographicOrigin = Ellipsoid.WGS84.cartesianToCartographic(\n cartesianOrigin,\n new Vector3()\n );\n const fromFixedFrameMatrix = Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin);\n const toFixedFrameMatrix = fromFixedFrameMatrix.invert();\n\n tile.cartographicModelMatrix = toFixedFrameMatrix.multiplyRight(modelMatrix);\n tile.cartographicOrigin = cartographicOrigin;\n\n // Deprecated, drop\n if (!tile.coordinateSystem) {\n tile.modelMatrix = tile.cartographicModelMatrix;\n }\n}\n"],"mappings":"AAEA,SAAQA,SAAS,QAAO,qBAAqB;AAC7C,SAAQC,OAAO,EAAEC,OAAO,QAAO,eAAe;AAC9C,SAAQC,MAAM,QAAO,0BAA0B;AAE/C,OAAO,SAASC,uBAAuBA,CAACC,UAAU,EAAEC,IAAI,EAAE;EACxDH,MAAM,CAACE,UAAU,CAAC;EAClBF,MAAM,CAACG,IAAI,CAAC;EAEZ,MAAM;I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,CAAC,CAAC;EAExD3B,IAAI,CAAC4B,uBAAuB,GAAGF,kBAAkB,CAACd,aAAa,CAACN,WAAW,CAAC;EAC5EN,IAAI,CAACqB,kBAAkB,GAAGA,kBAAkB;EAG5C,IAAI,CAACrB,IAAI,CAAC6B,gBAAgB,EAAE;IAC1B7B,IAAI,CAACM,WAAW,GAAGN,IAAI,CAAC4B,uBAAuB;EACjD;AACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Vector3 } from '@math.gl/core';
|
|
2
|
+
import { BoundingSphere, OrientedBoundingBox } from '@math.gl/culling';
|
|
3
|
+
import { Ellipsoid } from '@math.gl/geospatial';
|
|
4
|
+
const WGS84_RADIUS_X = 6378137.0;
|
|
5
|
+
const WGS84_RADIUS_Y = 6378137.0;
|
|
6
|
+
const WGS84_RADIUS_Z = 6356752.3142451793;
|
|
7
|
+
const scratchVector = new Vector3();
|
|
8
|
+
export function getZoomFromBoundingVolume(boundingVolume, cartorgraphicCenter) {
|
|
9
|
+
if (boundingVolume instanceof OrientedBoundingBox) {
|
|
10
|
+
const {
|
|
11
|
+
halfAxes
|
|
12
|
+
} = boundingVolume;
|
|
13
|
+
const obbSize = getObbSize(halfAxes);
|
|
14
|
+
return Math.log2(WGS84_RADIUS_Z / (obbSize + cartorgraphicCenter[2]));
|
|
15
|
+
} else if (boundingVolume instanceof BoundingSphere) {
|
|
16
|
+
const {
|
|
17
|
+
radius
|
|
18
|
+
} = boundingVolume;
|
|
19
|
+
return Math.log2(WGS84_RADIUS_Z / (radius + cartorgraphicCenter[2]));
|
|
20
|
+
} else if (boundingVolume.width && boundingVolume.height) {
|
|
21
|
+
const {
|
|
22
|
+
width,
|
|
23
|
+
height
|
|
24
|
+
} = boundingVolume;
|
|
25
|
+
const zoomX = Math.log2(WGS84_RADIUS_X / width);
|
|
26
|
+
const zoomY = Math.log2(WGS84_RADIUS_Y / height);
|
|
27
|
+
return (zoomX + zoomY) / 2;
|
|
28
|
+
}
|
|
29
|
+
return 1;
|
|
30
|
+
}
|
|
31
|
+
export function getZoomFromFullExtent(fullExtent, cartorgraphicCenter, cartesianCenter) {
|
|
32
|
+
const extentVertex = Ellipsoid.WGS84.cartographicToCartesian([fullExtent.xmax, fullExtent.ymax, fullExtent.zmax], new Vector3());
|
|
33
|
+
const extentSize = Math.sqrt(Math.pow(extentVertex[0] - cartesianCenter[0], 2) + Math.pow(extentVertex[1] - cartesianCenter[1], 2) + Math.pow(extentVertex[2] - cartesianCenter[2], 2));
|
|
34
|
+
return Math.log2(WGS84_RADIUS_Z / (extentSize + cartorgraphicCenter[2]));
|
|
35
|
+
}
|
|
36
|
+
export function getZoomFromExtent(extent, cartorgraphicCenter, cartesianCenter) {
|
|
37
|
+
const [xmin, ymin, xmax, ymax] = extent;
|
|
38
|
+
return getZoomFromFullExtent({
|
|
39
|
+
xmin,
|
|
40
|
+
xmax,
|
|
41
|
+
ymin,
|
|
42
|
+
ymax,
|
|
43
|
+
zmin: 0,
|
|
44
|
+
zmax: 0
|
|
45
|
+
}, cartorgraphicCenter, cartesianCenter);
|
|
46
|
+
}
|
|
47
|
+
function getObbSize(halfAxes) {
|
|
48
|
+
halfAxes.getColumn(0, scratchVector);
|
|
49
|
+
const axeY = halfAxes.getColumn(1);
|
|
50
|
+
const axeZ = halfAxes.getColumn(2);
|
|
51
|
+
const farthestVertex = scratchVector.add(axeY).add(axeZ);
|
|
52
|
+
const size = farthestVertex.len();
|
|
53
|
+
return size;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=zoom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zoom.js","names":["Vector3","BoundingSphere","OrientedBoundingBox","Ellipsoid","WGS84_RADIUS_X","WGS84_RADIUS_Y","WGS84_RADIUS_Z","scratchVector","getZoomFromBoundingVolume","boundingVolume","cartorgraphicCenter","halfAxes","obbSize","getObbSize","Math","log2","radius","width","height","zoomX","zoomY","getZoomFromFullExtent","fullExtent","cartesianCenter","extentVertex","WGS84","cartographicToCartesian","xmax","ymax","zmax","extentSize","sqrt","pow","getZoomFromExtent","extent","xmin","ymin","zmin","getColumn","axeY","axeZ","farthestVertex","add","size","len"],"sources":["../../../../src/tileset/helpers/zoom.ts"],"sourcesContent":["// loaders.gl, MIT license\n\nimport {Vector3} from '@math.gl/core';\nimport {BoundingSphere, OrientedBoundingBox} from '@math.gl/culling';\nimport {Ellipsoid} from '@math.gl/geospatial';\nimport {BoundingRectangle} from '../../types';\n\nconst WGS84_RADIUS_X = 6378137.0;\nconst WGS84_RADIUS_Y = 6378137.0;\nconst WGS84_RADIUS_Z = 6356752.3142451793;\n\nconst scratchVector = new Vector3();\n\n/**\n * Calculate appropriate zoom value for a particular boundingVolume\n * @param boundingVolume - the instance of bounding volume\n * @param cartorgraphicCenter - cartographic center of the bounding volume\n * @returns {number} - zoom value\n */\nexport function getZoomFromBoundingVolume(\n boundingVolume: BoundingSphere | OrientedBoundingBox | BoundingRectangle,\n cartorgraphicCenter: Vector3\n) {\n if (boundingVolume instanceof OrientedBoundingBox) {\n // OrientedBoundingBox\n const {halfAxes} = boundingVolume;\n const obbSize = getObbSize(halfAxes);\n // Use WGS84_RADIUS_Z to allign with BoundingSphere algorithm\n // Add the tile elevation value for correct zooming to elevated tiles\n return Math.log2(WGS84_RADIUS_Z / (obbSize + cartorgraphicCenter[2]));\n } else if (boundingVolume instanceof BoundingSphere) {\n // BoundingSphere\n const {radius} = boundingVolume;\n // Add the tile elevation value for correct zooming to elevated tiles\n return Math.log2(WGS84_RADIUS_Z / (radius + cartorgraphicCenter[2]));\n } else if (boundingVolume.width && boundingVolume.height) {\n // BoundingRectangle\n const {width, height} = boundingVolume;\n const zoomX = Math.log2(WGS84_RADIUS_X / width);\n const zoomY = Math.log2(WGS84_RADIUS_Y / height);\n\n return (zoomX + zoomY) / 2;\n }\n\n return 1;\n}\n\n/**\n * Calculate initial zoom for the tileset from 3D `fullExtent` defined in\n * the tileset metadata\n * @param fullExtent - 3D extent of the tileset\n * @param fullExtent.xmin - minimal longitude in decimal degrees\n * @param fullExtent.xmax - maximal longitude in decimal degrees\n * @param fullExtent.ymin - minimal latitude in decimal degrees\n * @param fullExtent.ymax - maximal latitude in decimal degrees\n * @param fullExtent.zmin - minimal elevation in meters\n * @param fullExtent.zmax - maximal elevation in meters\n * @param cartorgraphicCenter - tileset center in cartographic coordinate system\n * @param cartesianCenter - tileset center in cartesian coordinate system\n * @returns - initial zoom for the tileset\n */\nexport function getZoomFromFullExtent(\n fullExtent: {\n xmin: number;\n xmax: number;\n ymin: number;\n ymax: number;\n zmin: number;\n zmax: number;\n },\n cartorgraphicCenter: Vector3,\n cartesianCenter: Vector3\n) {\n const extentVertex = Ellipsoid.WGS84.cartographicToCartesian(\n [fullExtent.xmax, fullExtent.ymax, fullExtent.zmax],\n new Vector3()\n );\n const extentSize = Math.sqrt(\n Math.pow(extentVertex[0] - cartesianCenter[0], 2) +\n Math.pow(extentVertex[1] - cartesianCenter[1], 2) +\n Math.pow(extentVertex[2] - cartesianCenter[2], 2)\n );\n return Math.log2(WGS84_RADIUS_Z / (extentSize + cartorgraphicCenter[2]));\n}\n\n/**\n * Calculate initial zoom for the tileset from 2D `extent` defined in\n * the tileset metadata\n * @param extent - 2D extent of the tileset. It is array of 4 elements [xmin, ymin, xmax, ymax]\n * @param extent[0] - minimal longitude in decimal degrees\n * @param extent[1] - minimal latitude in decimal degrees\n * @param extent[2] - maximal longitude in decimal degrees\n * @param extent[3] - maximal latitude in decimal degrees\n * @param cartorgraphicCenter - tileset center in cartographic coordinate system\n * @param cartesianCenter - tileset center in cartesian coordinate system\n * @returns - initial zoom for the tileset\n */\nexport function getZoomFromExtent(\n extent: [number, number, number, number],\n cartorgraphicCenter: Vector3,\n cartesianCenter: Vector3\n) {\n const [xmin, ymin, xmax, ymax] = extent;\n return getZoomFromFullExtent(\n {xmin, xmax, ymin, ymax, zmin: 0, zmax: 0},\n cartorgraphicCenter,\n cartesianCenter\n );\n}\n\nfunction getObbSize(halfAxes) {\n halfAxes.getColumn(0, scratchVector);\n const axeY = halfAxes.getColumn(1);\n const axeZ = halfAxes.getColumn(2);\n const farthestVertex = scratchVector.add(axeY).add(axeZ);\n const size = farthestVertex.len();\n return size;\n}\n"],"mappings":"AAEA,SAAQA,OAAO,QAAO,eAAe;AACrC,SAAQC,cAAc,EAAEC,mBAAmB,QAAO,kBAAkB;AACpE,SAAQC,SAAS,QAAO,qBAAqB;AAG7C,MAAMC,cAAc,GAAG,SAAS;AAChC,MAAMC,cAAc,GAAG,SAAS;AAChC,MAAMC,cAAc,GAAG,kBAAkB;AAEzC,MAAMC,aAAa,GAAG,IAAIP,OAAO,CAAC,CAAC;AAQnC,OAAO,SAASQ,yBAAyBA,CACvCC,cAAwE,EACxEC,mBAA4B,EAC5B;EACA,IAAID,cAAc,YAAYP,mBAAmB,EAAE;IAEjD,MAAM;MAACS;IAAQ,CAAC,GAAGF,cAAc;IACjC,MAAMG,OAAO,GAAGC,UAAU,CAACF,QAAQ,CAAC;IAGpC,OAAOG,IAAI,CAACC,IAAI,CAACT,cAAc,IAAIM,OAAO,GAAGF,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;EACvE,CAAC,MAAM,IAAID,cAAc,YAAYR,cAAc,EAAE;IAEnD,MAAM;MAACe;IAAM,CAAC,GAAGP,cAAc;IAE/B,OAAOK,IAAI,CAACC,IAAI,CAACT,cAAc,IAAIU,MAAM,GAAGN,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC;EACtE,CAAC,MAAM,IAAID,cAAc,CAACQ,KAAK,IAAIR,cAAc,CAACS,MAAM,EAAE;IAExD,MAAM;MAACD,KAAK;MAAEC;IAAM,CAAC,GAAGT,cAAc;IACtC,MAAMU,KAAK,GAAGL,IAAI,CAACC,IAAI,CAACX,cAAc,GAAGa,KAAK,CAAC;IAC/C,MAAMG,KAAK,GAAGN,IAAI,CAACC,IAAI,CAACV,cAAc,GAAGa,MAAM,CAAC;IAEhD,OAAO,CAACC,KAAK,G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