3dtiles-inspector 0.2.3 → 0.2.4
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/CHANGELOG.md +16 -0
- package/dist/inspector-assets/viewer/app.js +595 -51
- package/package.json +1 -1
- package/src/server/viewerHtml.js +1 -1
- package/src/viewer/app.js +7 -2
- package/src/viewer/navigation/cameraFlyTo.js +730 -0
- package/src/viewer/navigation/flyTo.js +78 -16
- package/src/viewer/scene/cameraController.js +2 -2
- package/src/viewer/scene/sceneSetup.js +3 -6
|
@@ -45136,10 +45136,10 @@ function createGeoCameraController({
|
|
|
45136
45136
|
const right = new Vector3();
|
|
45137
45137
|
const backward = new Vector3();
|
|
45138
45138
|
const quaternion = new Quaternion();
|
|
45139
|
-
function
|
|
45139
|
+
function isCenterModePosition2(value) {
|
|
45140
45140
|
return value.lengthSq() <= centerModeDistanceSq;
|
|
45141
45141
|
}
|
|
45142
|
-
function
|
|
45142
|
+
function getLocalFrame2(referencePoint) {
|
|
45143
45143
|
const ellipsoid = getActiveEllipsoid();
|
|
45144
45144
|
ellipsoid.getPositionToCartographic(referencePoint, cartographicTarget);
|
|
45145
45145
|
ellipsoid.getEastNorthUpFrame(
|
|
@@ -45186,7 +45186,7 @@ function createGeoCameraController({
|
|
|
45186
45186
|
if (referencePoint.lengthSq() < centerModeDistanceSq || !getActiveEllipsoid()) {
|
|
45187
45187
|
return target.identity();
|
|
45188
45188
|
}
|
|
45189
|
-
|
|
45189
|
+
getLocalFrame2(referencePoint);
|
|
45190
45190
|
basis.makeBasis(east, north, up);
|
|
45191
45191
|
return target.setFromRotationMatrix(basis);
|
|
45192
45192
|
}
|
|
@@ -45201,7 +45201,7 @@ function createGeoCameraController({
|
|
|
45201
45201
|
);
|
|
45202
45202
|
return Math.max(radius / Math.sin(limitingHalfFov), 1);
|
|
45203
45203
|
}
|
|
45204
|
-
function
|
|
45204
|
+
function getCenterModeHeadingPitchRollForward2(heading, pitch) {
|
|
45205
45205
|
const cosPitch = Math.cos(pitch);
|
|
45206
45206
|
forward.set(
|
|
45207
45207
|
Math.sin(heading) * cosPitch,
|
|
@@ -45210,14 +45210,14 @@ function createGeoCameraController({
|
|
|
45210
45210
|
);
|
|
45211
45211
|
return forward.normalize();
|
|
45212
45212
|
}
|
|
45213
|
-
function
|
|
45214
|
-
if (
|
|
45215
|
-
return
|
|
45213
|
+
function getHeadingPitchRollForward2(referencePoint, heading, pitch) {
|
|
45214
|
+
if (isCenterModePosition2(referencePoint)) {
|
|
45215
|
+
return getCenterModeHeadingPitchRollForward2(heading, pitch);
|
|
45216
45216
|
}
|
|
45217
45217
|
if (referencePoint.lengthSq() < 1e-6) {
|
|
45218
45218
|
return forward.set(0, 0, -1);
|
|
45219
45219
|
}
|
|
45220
|
-
|
|
45220
|
+
getLocalFrame2(referencePoint);
|
|
45221
45221
|
const cosPitch = Math.cos(pitch);
|
|
45222
45222
|
const sinPitch = Math.sin(pitch);
|
|
45223
45223
|
const cosHeading = Math.cos(heading);
|
|
@@ -45225,8 +45225,8 @@ function createGeoCameraController({
|
|
|
45225
45225
|
forward.copy(north).multiplyScalar(cosHeading * cosPitch).addScaledVector(east, sinHeading * cosPitch).addScaledVector(up, sinPitch).normalize();
|
|
45226
45226
|
return forward;
|
|
45227
45227
|
}
|
|
45228
|
-
function
|
|
45229
|
-
|
|
45228
|
+
function getCenterModeHeadingPitchRollBasis2(heading, pitch, roll) {
|
|
45229
|
+
getCenterModeHeadingPitchRollForward2(heading, pitch);
|
|
45230
45230
|
right.copy(WORLD_RIGHT).multiplyScalar(Math.cos(heading)).addScaledVector(CENTER_NORTH, -Math.sin(heading)).normalize();
|
|
45231
45231
|
up.crossVectors(right, forward).normalize();
|
|
45232
45232
|
if (roll !== 0) {
|
|
@@ -45235,14 +45235,14 @@ function createGeoCameraController({
|
|
|
45235
45235
|
}
|
|
45236
45236
|
backward.copy(forward).negate();
|
|
45237
45237
|
}
|
|
45238
|
-
function
|
|
45239
|
-
if (
|
|
45240
|
-
|
|
45238
|
+
function getHeadingPitchRollQuaternion2(referencePoint, heading, pitch, roll) {
|
|
45239
|
+
if (isCenterModePosition2(referencePoint)) {
|
|
45240
|
+
getCenterModeHeadingPitchRollBasis2(heading, pitch, roll);
|
|
45241
45241
|
} else if (referencePoint.lengthSq() < 1e-6) {
|
|
45242
45242
|
quaternion.identity();
|
|
45243
45243
|
return quaternion;
|
|
45244
45244
|
} else {
|
|
45245
|
-
|
|
45245
|
+
getHeadingPitchRollForward2(referencePoint, heading, pitch);
|
|
45246
45246
|
right.copy(east).multiplyScalar(Math.cos(heading)).addScaledVector(north, -Math.sin(heading)).normalize();
|
|
45247
45247
|
up.crossVectors(right, forward).normalize();
|
|
45248
45248
|
if (roll !== 0) {
|
|
@@ -45254,7 +45254,7 @@ function createGeoCameraController({
|
|
|
45254
45254
|
basis.makeBasis(right, up, backward);
|
|
45255
45255
|
return quaternion.setFromRotationMatrix(basis);
|
|
45256
45256
|
}
|
|
45257
|
-
function
|
|
45257
|
+
function getBoundingSphereFlyToPosition2(target, range, options) {
|
|
45258
45258
|
const { heading, pitch } = options;
|
|
45259
45259
|
if (heading === void 0 && pitch === void 0) {
|
|
45260
45260
|
const direction = target.lengthSq() > 1e-6 ? position.copy(target).normalize() : camera.position.lengthSq() > 1e-6 ? position.copy(camera.position).normalize() : position.set(0, -1, 0);
|
|
@@ -45262,15 +45262,15 @@ function createGeoCameraController({
|
|
|
45262
45262
|
}
|
|
45263
45263
|
const resolvedHeading = heading ?? 0;
|
|
45264
45264
|
const resolvedPitch = pitch ?? -Math.PI / 2;
|
|
45265
|
-
const centerForward =
|
|
45265
|
+
const centerForward = getCenterModeHeadingPitchRollForward2(
|
|
45266
45266
|
resolvedHeading,
|
|
45267
45267
|
resolvedPitch
|
|
45268
45268
|
);
|
|
45269
45269
|
const centerPosition = position.copy(target).addScaledVector(centerForward, -range);
|
|
45270
|
-
if (
|
|
45270
|
+
if (isCenterModePosition2(centerPosition)) {
|
|
45271
45271
|
return centerPosition;
|
|
45272
45272
|
}
|
|
45273
|
-
const resolvedForward =
|
|
45273
|
+
const resolvedForward = getHeadingPitchRollForward2(
|
|
45274
45274
|
target,
|
|
45275
45275
|
resolvedHeading,
|
|
45276
45276
|
resolvedPitch
|
|
@@ -45291,13 +45291,13 @@ function createGeoCameraController({
|
|
|
45291
45291
|
} else {
|
|
45292
45292
|
offsetDistance = getCameraDistanceForBoundingSphere(safeRadius);
|
|
45293
45293
|
}
|
|
45294
|
-
const nextPosition =
|
|
45294
|
+
const nextPosition = getBoundingSphereFlyToPosition2(
|
|
45295
45295
|
target,
|
|
45296
45296
|
offsetDistance,
|
|
45297
45297
|
options
|
|
45298
45298
|
);
|
|
45299
|
-
const nextQuaternion =
|
|
45300
|
-
|
|
45299
|
+
const nextQuaternion = getHeadingPitchRollQuaternion2(
|
|
45300
|
+
isCenterModePosition2(nextPosition) ? nextPosition : target,
|
|
45301
45301
|
options.heading ?? 0,
|
|
45302
45302
|
options.pitch ?? -Math.PI / 2,
|
|
45303
45303
|
options.roll ?? 0
|
|
@@ -65854,7 +65854,7 @@ var init_cameraController = __esm({
|
|
|
65854
65854
|
const minScale = 0;
|
|
65855
65855
|
metrics.distanceScale = baseScale;
|
|
65856
65856
|
metrics.transitionWeight = 0;
|
|
65857
|
-
if (!__privateGet(this, _ellipsoid)) {
|
|
65857
|
+
if (!__privateGet(this, _ellipsoid) || __privateMethod(this, _CameraController_instances, isCameraCenterMode_fn).call(this)) {
|
|
65858
65858
|
return metrics;
|
|
65859
65859
|
}
|
|
65860
65860
|
const taperStartRadius = __privateGet(this, _ellipsoidMaxRadius) * 1.5;
|
|
@@ -65903,7 +65903,7 @@ var init_cameraController = __esm({
|
|
|
65903
65903
|
const source = _vec4.copy(__privateGet(this, _camera3).position);
|
|
65904
65904
|
let distanceScale = 1;
|
|
65905
65905
|
let transitionWeight = 0;
|
|
65906
|
-
if (zoomAmount < 0 && __privateGet(this, _ellipsoid)) {
|
|
65906
|
+
if (zoomAmount < 0 && __privateGet(this, _ellipsoid) && !__privateMethod(this, _CameraController_instances, isCameraCenterMode_fn).call(this)) {
|
|
65907
65907
|
const metrics = __privateMethod(this, _CameraController_instances, getZoomOutMetrics_fn).call(this, source, hit.virtual ? null : hit);
|
|
65908
65908
|
distanceScale = metrics.distanceScale;
|
|
65909
65909
|
transitionWeight = metrics.transitionWeight;
|
|
@@ -66096,9 +66096,9 @@ function createViewerScene({
|
|
|
66096
66096
|
60,
|
|
66097
66097
|
window.innerWidth / window.innerHeight,
|
|
66098
66098
|
1,
|
|
66099
|
-
|
|
66099
|
+
12e6
|
|
66100
66100
|
);
|
|
66101
|
-
camera.position.set(0, 0,
|
|
66101
|
+
camera.position.set(0, 0, 12e6);
|
|
66102
66102
|
camera.updateMatrixWorld(true);
|
|
66103
66103
|
const contentGroup = new Group();
|
|
66104
66104
|
scene.add(contentGroup);
|
|
@@ -67650,6 +67650,505 @@ var init_setPositionController = __esm({
|
|
|
67650
67650
|
}
|
|
67651
67651
|
});
|
|
67652
67652
|
|
|
67653
|
+
// src/viewer/navigation/cameraFlyTo.js
|
|
67654
|
+
function eastNorthUpToFixedFrame(origin) {
|
|
67655
|
+
_geoUp.copy(origin).multiply(_oneOverRadiiSquared).normalize();
|
|
67656
|
+
_geoEast.set(0, 0, 1).cross(_geoUp).normalize();
|
|
67657
|
+
_geoNorth.copy(_geoUp).cross(_geoEast).normalize();
|
|
67658
|
+
return _matrix3.set(
|
|
67659
|
+
_geoEast.x,
|
|
67660
|
+
_geoNorth.x,
|
|
67661
|
+
_geoUp.x,
|
|
67662
|
+
origin.x,
|
|
67663
|
+
_geoEast.y,
|
|
67664
|
+
_geoNorth.y,
|
|
67665
|
+
_geoUp.y,
|
|
67666
|
+
origin.y,
|
|
67667
|
+
_geoEast.z,
|
|
67668
|
+
_geoNorth.z,
|
|
67669
|
+
_geoUp.z,
|
|
67670
|
+
origin.z,
|
|
67671
|
+
0,
|
|
67672
|
+
0,
|
|
67673
|
+
0,
|
|
67674
|
+
1
|
|
67675
|
+
);
|
|
67676
|
+
}
|
|
67677
|
+
function createCameraFlight(camera, position, target, options = {}) {
|
|
67678
|
+
const duration = options.duration ?? 2500;
|
|
67679
|
+
const endPosition = position.clone();
|
|
67680
|
+
const endQuaternion = getEndQuaternion(endPosition, target, options);
|
|
67681
|
+
const endPose = getUprightHeadingPitchAtPose(endPosition, endQuaternion);
|
|
67682
|
+
const endRoll = getRollAtPose(endPosition, endQuaternion);
|
|
67683
|
+
const endZoom = camera instanceof OrthographicCamera ? Math.max(options.endZoom ?? camera.zoom, 1e-6) : null;
|
|
67684
|
+
return buildFlightState(camera, {
|
|
67685
|
+
duration,
|
|
67686
|
+
endPosition,
|
|
67687
|
+
endQuaternion,
|
|
67688
|
+
endZoom,
|
|
67689
|
+
endHeading: endPose.heading,
|
|
67690
|
+
endPitch: endPose.pitch,
|
|
67691
|
+
endRoll
|
|
67692
|
+
});
|
|
67693
|
+
}
|
|
67694
|
+
function getFlyToParamsFromBoundingSphere(camera, target, radius, options = {}) {
|
|
67695
|
+
const safeRadius = Math.max(radius, 1);
|
|
67696
|
+
let offsetDistance = safeRadius;
|
|
67697
|
+
let endZoom = options.endZoom;
|
|
67698
|
+
if (camera instanceof PerspectiveCamera) {
|
|
67699
|
+
const verticalFov = MathUtils.degToRad(camera.fov);
|
|
67700
|
+
const horizontalFov = 2 * Math.atan(Math.tan(verticalFov / 2) * camera.aspect);
|
|
67701
|
+
const minHalfFov = Math.max(0.1, Math.min(verticalFov, horizontalFov) / 2);
|
|
67702
|
+
offsetDistance = safeRadius / Math.sin(minHalfFov) + safeRadius * 0.75;
|
|
67703
|
+
} else if (camera instanceof OrthographicCamera) {
|
|
67704
|
+
const visibleHeight = Math.max(safeRadius * 2.8, 1);
|
|
67705
|
+
endZoom = (camera.top - camera.bottom) / visibleHeight;
|
|
67706
|
+
offsetDistance = Math.max(safeRadius * 2, visibleHeight * 0.5);
|
|
67707
|
+
}
|
|
67708
|
+
const position = getBoundingSphereFlyToPosition(
|
|
67709
|
+
camera,
|
|
67710
|
+
target,
|
|
67711
|
+
offsetDistance,
|
|
67712
|
+
options
|
|
67713
|
+
);
|
|
67714
|
+
return {
|
|
67715
|
+
position,
|
|
67716
|
+
target: target.clone(),
|
|
67717
|
+
options: {
|
|
67718
|
+
...options,
|
|
67719
|
+
endZoom
|
|
67720
|
+
}
|
|
67721
|
+
};
|
|
67722
|
+
}
|
|
67723
|
+
function flyTo(camera, flight, time) {
|
|
67724
|
+
if (flight.startTime === null) {
|
|
67725
|
+
flight.startTime = time;
|
|
67726
|
+
}
|
|
67727
|
+
const rawT = MathUtils.clamp(
|
|
67728
|
+
(time - flight.startTime) / flight.duration,
|
|
67729
|
+
0,
|
|
67730
|
+
1
|
|
67731
|
+
);
|
|
67732
|
+
const easedT = rawT < 0.5 ? 4 * rawT * rawT * rawT : 1 - Math.pow(-2 * rawT + 2, 3) / 2;
|
|
67733
|
+
const position = getFlyToPosition(flight, easedT);
|
|
67734
|
+
const quaternion = flight.maintainUpright ? getUprightInterpolatedQuaternion(flight, position, easedT) : _flyQuaternion.slerpQuaternions(
|
|
67735
|
+
flight.startQuaternion,
|
|
67736
|
+
flight.endQuaternion,
|
|
67737
|
+
easedT
|
|
67738
|
+
);
|
|
67739
|
+
const zoom = flight.startZoom !== null && flight.endZoom !== null ? MathUtils.lerp(flight.startZoom, flight.endZoom, easedT) : null;
|
|
67740
|
+
applyFlyToPose(camera, position, quaternion, zoom);
|
|
67741
|
+
return rawT === 1;
|
|
67742
|
+
}
|
|
67743
|
+
function getFlyToPosition(flight, t2) {
|
|
67744
|
+
const { startPosition, endPosition, arcHeight } = flight;
|
|
67745
|
+
const startLength = startPosition.length();
|
|
67746
|
+
const endLength = endPosition.length();
|
|
67747
|
+
if (startLength < 1e-6 || endLength < 1e-6) {
|
|
67748
|
+
return _flyDirection.lerpVectors(startPosition, endPosition, t2);
|
|
67749
|
+
}
|
|
67750
|
+
_flyDirectionStart.copy(startPosition).divideScalar(startLength);
|
|
67751
|
+
_flyDirectionEnd.copy(endPosition).divideScalar(endLength);
|
|
67752
|
+
const angle = _flyDirectionStart.angleTo(_flyDirectionEnd);
|
|
67753
|
+
if (angle > 1e-5) {
|
|
67754
|
+
if (angle < Math.PI - 1e-5) {
|
|
67755
|
+
_flyAxis.crossVectors(_flyDirectionStart, _flyDirectionEnd).normalize();
|
|
67756
|
+
} else {
|
|
67757
|
+
_flyAxis.crossVectors(_flyDirectionStart, _flyWorldUp);
|
|
67758
|
+
if (_flyAxis.lengthSq() < 1e-6) {
|
|
67759
|
+
_flyAxis.crossVectors(_flyDirectionStart, _flyWorldNorth);
|
|
67760
|
+
}
|
|
67761
|
+
_flyAxis.normalize();
|
|
67762
|
+
}
|
|
67763
|
+
_flyDirection.copy(_flyDirectionStart).applyAxisAngle(_flyAxis, angle * t2).normalize();
|
|
67764
|
+
} else {
|
|
67765
|
+
_flyDirection.copy(_flyDirectionStart);
|
|
67766
|
+
}
|
|
67767
|
+
const radius = MathUtils.lerp(startLength, endLength, t2) + Math.sin(Math.PI * t2) * arcHeight;
|
|
67768
|
+
return _flyDirection.multiplyScalar(radius);
|
|
67769
|
+
}
|
|
67770
|
+
function getUprightInterpolatedQuaternion(flight, position, t2) {
|
|
67771
|
+
const heading = lerpAngle(flight.startHeading, flight.endHeading, t2);
|
|
67772
|
+
const pitch = MathUtils.lerp(flight.startPitch, flight.endPitch, t2);
|
|
67773
|
+
return getHeadingPitchRollQuaternion(position, heading, pitch, 0);
|
|
67774
|
+
}
|
|
67775
|
+
function buildFlightState(camera, {
|
|
67776
|
+
duration,
|
|
67777
|
+
endPosition,
|
|
67778
|
+
endQuaternion,
|
|
67779
|
+
endZoom,
|
|
67780
|
+
endHeading,
|
|
67781
|
+
endPitch,
|
|
67782
|
+
endRoll
|
|
67783
|
+
}) {
|
|
67784
|
+
const startPosition = camera.position.clone();
|
|
67785
|
+
const startQuaternion = camera.quaternion.clone();
|
|
67786
|
+
const startPose = getUprightHeadingPitchAtPose(
|
|
67787
|
+
startPosition,
|
|
67788
|
+
startQuaternion
|
|
67789
|
+
);
|
|
67790
|
+
const startRoll = getRollAtPose(startPosition, startQuaternion);
|
|
67791
|
+
const startZoom = camera instanceof OrthographicCamera ? camera.zoom : null;
|
|
67792
|
+
if (isImmediateFlight(
|
|
67793
|
+
duration,
|
|
67794
|
+
startPosition,
|
|
67795
|
+
endPosition,
|
|
67796
|
+
startQuaternion,
|
|
67797
|
+
endQuaternion,
|
|
67798
|
+
startZoom,
|
|
67799
|
+
endZoom
|
|
67800
|
+
)) {
|
|
67801
|
+
applyFlyToPose(camera, endPosition, endQuaternion, endZoom);
|
|
67802
|
+
return null;
|
|
67803
|
+
}
|
|
67804
|
+
return {
|
|
67805
|
+
startTime: null,
|
|
67806
|
+
duration,
|
|
67807
|
+
startPosition,
|
|
67808
|
+
endPosition,
|
|
67809
|
+
startQuaternion,
|
|
67810
|
+
endQuaternion,
|
|
67811
|
+
startZoom,
|
|
67812
|
+
endZoom,
|
|
67813
|
+
arcHeight: getArcHeight(startPosition, endPosition),
|
|
67814
|
+
maintainUpright: shouldMaintainUpright(startRoll, endRoll),
|
|
67815
|
+
startHeading: startPose.heading,
|
|
67816
|
+
endHeading,
|
|
67817
|
+
startPitch: startPose.pitch,
|
|
67818
|
+
endPitch
|
|
67819
|
+
};
|
|
67820
|
+
}
|
|
67821
|
+
function isImmediateFlight(duration, startPosition, endPosition, startQuaternion, endQuaternion, startZoom, endZoom) {
|
|
67822
|
+
return duration <= 0 || startPosition.distanceToSquared(endPosition) < 1e-6 && startQuaternion.angleTo(endQuaternion) < 1e-6 && (startZoom === null || endZoom === null || Math.abs(startZoom - endZoom) < 1e-6);
|
|
67823
|
+
}
|
|
67824
|
+
function getArcHeight(startPosition, endPosition) {
|
|
67825
|
+
const chordLength = startPosition.distanceTo(endPosition);
|
|
67826
|
+
return Math.max(
|
|
67827
|
+
chordLength * 0.35,
|
|
67828
|
+
Math.abs(endPosition.length() - startPosition.length()) * 0.5,
|
|
67829
|
+
500
|
|
67830
|
+
);
|
|
67831
|
+
}
|
|
67832
|
+
function shouldMaintainUpright(startRoll, endRoll) {
|
|
67833
|
+
return Math.abs(startRoll) <= UPRIGHT_ROLL_THRESHOLD && Math.abs(endRoll) <= UPRIGHT_ROLL_THRESHOLD;
|
|
67834
|
+
}
|
|
67835
|
+
function getLookAtQuaternion(position, target) {
|
|
67836
|
+
if (isCenterModePosition(position)) {
|
|
67837
|
+
_matrix3.lookAt(position, target, _flyCenterUp);
|
|
67838
|
+
return new Quaternion().setFromRotationMatrix(_matrix3);
|
|
67839
|
+
}
|
|
67840
|
+
_flyUp.copy(target);
|
|
67841
|
+
if (_flyUp.lengthSq() < 1e-6) {
|
|
67842
|
+
_flyUp.copy(_flyWorldUp);
|
|
67843
|
+
} else {
|
|
67844
|
+
_flyUp.normalize();
|
|
67845
|
+
}
|
|
67846
|
+
_flyEast.crossVectors(_flyWorldNorth, _flyUp);
|
|
67847
|
+
if (_flyEast.lengthSq() < 1e-6) {
|
|
67848
|
+
_flyEast.crossVectors(_flyWorldUp, _flyUp);
|
|
67849
|
+
}
|
|
67850
|
+
if (_flyEast.lengthSq() < 1e-6) {
|
|
67851
|
+
_flyEast.set(1, 0, 0);
|
|
67852
|
+
}
|
|
67853
|
+
_flyEast.normalize();
|
|
67854
|
+
_flyUp.crossVectors(_flyUp, _flyEast).normalize();
|
|
67855
|
+
_matrix3.lookAt(position, target, _flyUp);
|
|
67856
|
+
return new Quaternion().setFromRotationMatrix(_matrix3);
|
|
67857
|
+
}
|
|
67858
|
+
function getForwardFromQuaternion(quaternion, target) {
|
|
67859
|
+
return target.set(0, 0, -1).applyQuaternion(quaternion).normalize();
|
|
67860
|
+
}
|
|
67861
|
+
function getUprightHeadingPitchAtPose(position, quaternion) {
|
|
67862
|
+
if (isCenterModePosition(position)) {
|
|
67863
|
+
const forward2 = getForwardFromQuaternion(quaternion, _flyForward);
|
|
67864
|
+
_flyCameraRight.set(1, 0, 0).applyQuaternion(quaternion);
|
|
67865
|
+
_flyReferenceRight.copy(_flyCameraRight).projectOnPlane(_flyCenterUp);
|
|
67866
|
+
let heading2 = 0;
|
|
67867
|
+
if (_flyReferenceRight.lengthSq() > HEADING_RIGHT_DEGENERATE_EPSILON) {
|
|
67868
|
+
_flyReferenceRight.normalize();
|
|
67869
|
+
heading2 = Math.atan2(
|
|
67870
|
+
-_flyReferenceRight.dot(_flyCenterNorth),
|
|
67871
|
+
_flyReferenceRight.dot(_flyWorldRight)
|
|
67872
|
+
);
|
|
67873
|
+
} else {
|
|
67874
|
+
const horizontalForward = _flyDirection.copy(forward2).projectOnPlane(_flyCenterUp);
|
|
67875
|
+
if (horizontalForward.lengthSq() > HEADING_RIGHT_DEGENERATE_EPSILON) {
|
|
67876
|
+
horizontalForward.normalize();
|
|
67877
|
+
heading2 = Math.atan2(
|
|
67878
|
+
horizontalForward.dot(_flyWorldRight),
|
|
67879
|
+
horizontalForward.dot(_flyCenterNorth)
|
|
67880
|
+
);
|
|
67881
|
+
}
|
|
67882
|
+
}
|
|
67883
|
+
return {
|
|
67884
|
+
heading: heading2,
|
|
67885
|
+
pitch: Math.asin(MathUtils.clamp(forward2.dot(_flyCenterUp), -1, 1))
|
|
67886
|
+
};
|
|
67887
|
+
}
|
|
67888
|
+
if (position.lengthSq() < 1e-6) {
|
|
67889
|
+
return {
|
|
67890
|
+
heading: 0,
|
|
67891
|
+
pitch: 0
|
|
67892
|
+
};
|
|
67893
|
+
}
|
|
67894
|
+
const forward = getForwardFromQuaternion(quaternion, _flyForward);
|
|
67895
|
+
getLocalFrame(position);
|
|
67896
|
+
_flyCameraRight.set(1, 0, 0).applyQuaternion(quaternion);
|
|
67897
|
+
_flyReferenceRight.copy(_flyCameraRight).projectOnPlane(_flyUp);
|
|
67898
|
+
let heading = 0;
|
|
67899
|
+
if (_flyReferenceRight.lengthSq() > HEADING_RIGHT_DEGENERATE_EPSILON) {
|
|
67900
|
+
_flyReferenceRight.normalize();
|
|
67901
|
+
heading = Math.atan2(
|
|
67902
|
+
-_flyReferenceRight.dot(_flyNorth),
|
|
67903
|
+
_flyReferenceRight.dot(_flyEast)
|
|
67904
|
+
);
|
|
67905
|
+
} else {
|
|
67906
|
+
const horizontalForward = _flyDirection.copy(forward).projectOnPlane(_flyUp);
|
|
67907
|
+
if (horizontalForward.lengthSq() > HEADING_RIGHT_DEGENERATE_EPSILON) {
|
|
67908
|
+
horizontalForward.normalize();
|
|
67909
|
+
heading = Math.atan2(
|
|
67910
|
+
horizontalForward.dot(_flyEast),
|
|
67911
|
+
horizontalForward.dot(_flyNorth)
|
|
67912
|
+
);
|
|
67913
|
+
}
|
|
67914
|
+
}
|
|
67915
|
+
return {
|
|
67916
|
+
heading,
|
|
67917
|
+
pitch: Math.asin(MathUtils.clamp(forward.dot(_flyUp), -1, 1))
|
|
67918
|
+
};
|
|
67919
|
+
}
|
|
67920
|
+
function getRollAtPose(position, quaternion) {
|
|
67921
|
+
const forward = getForwardFromQuaternion(quaternion, _flyForward);
|
|
67922
|
+
if (isCenterModePosition(position)) {
|
|
67923
|
+
if (Math.abs(forward.dot(_flyCenterUp)) >= ROLL_UNDEFINED_DOT_THRESHOLD) {
|
|
67924
|
+
return 0;
|
|
67925
|
+
}
|
|
67926
|
+
getReferenceBasis(
|
|
67927
|
+
forward,
|
|
67928
|
+
_flyWorldRight,
|
|
67929
|
+
_flyCenterUp,
|
|
67930
|
+
_flyReferenceRight,
|
|
67931
|
+
_flyReferenceUp
|
|
67932
|
+
);
|
|
67933
|
+
} else {
|
|
67934
|
+
if (position.lengthSq() < 1e-6) {
|
|
67935
|
+
return 0;
|
|
67936
|
+
}
|
|
67937
|
+
getLocalFrame(position);
|
|
67938
|
+
if (Math.abs(forward.dot(_flyUp)) >= ROLL_UNDEFINED_DOT_THRESHOLD) {
|
|
67939
|
+
return 0;
|
|
67940
|
+
}
|
|
67941
|
+
getReferenceBasis(
|
|
67942
|
+
forward,
|
|
67943
|
+
_flyEast,
|
|
67944
|
+
_flyUp,
|
|
67945
|
+
_flyReferenceRight,
|
|
67946
|
+
_flyReferenceUp
|
|
67947
|
+
);
|
|
67948
|
+
}
|
|
67949
|
+
_flyReferenceUp.projectOnPlane(forward);
|
|
67950
|
+
_flyCameraUp.set(0, 1, 0).applyQuaternion(quaternion).projectOnPlane(forward);
|
|
67951
|
+
if (_flyReferenceUp.lengthSq() < 1e-6 || _flyCameraUp.lengthSq() < 1e-6) {
|
|
67952
|
+
return 0;
|
|
67953
|
+
}
|
|
67954
|
+
_flyReferenceUp.normalize();
|
|
67955
|
+
_flyCameraUp.normalize();
|
|
67956
|
+
return Math.atan2(
|
|
67957
|
+
_flyDirection.crossVectors(_flyReferenceUp, _flyCameraUp).dot(forward),
|
|
67958
|
+
_flyReferenceUp.dot(_flyCameraUp)
|
|
67959
|
+
);
|
|
67960
|
+
}
|
|
67961
|
+
function getEndQuaternion(position, target, options) {
|
|
67962
|
+
const { heading, pitch, roll } = options;
|
|
67963
|
+
if (heading === void 0 && pitch === void 0 && roll === void 0) {
|
|
67964
|
+
return getLookAtQuaternion(position, target);
|
|
67965
|
+
}
|
|
67966
|
+
if (heading === void 0 && pitch === void 0) {
|
|
67967
|
+
const quaternion = getLookAtQuaternion(position, target);
|
|
67968
|
+
if (roll) {
|
|
67969
|
+
_flyForward.subVectors(target, position).normalize();
|
|
67970
|
+
quaternion.multiply(_flyQuaternion.setFromAxisAngle(_flyForward, roll));
|
|
67971
|
+
}
|
|
67972
|
+
return quaternion;
|
|
67973
|
+
}
|
|
67974
|
+
return getHeadingPitchRollQuaternion(
|
|
67975
|
+
isCenterModePosition(position) ? position : target,
|
|
67976
|
+
heading ?? 0,
|
|
67977
|
+
pitch ?? -Math.PI / 2,
|
|
67978
|
+
roll ?? 0
|
|
67979
|
+
);
|
|
67980
|
+
}
|
|
67981
|
+
function getBoundingSphereFlyToPosition(camera, target, range, options) {
|
|
67982
|
+
const { heading, pitch } = options;
|
|
67983
|
+
if (heading === void 0 && pitch === void 0) {
|
|
67984
|
+
const direction = target.lengthSq() > 1e-6 ? _flyDirection.copy(target).normalize() : camera.position.lengthSq() > 1e-6 ? _flyDirection.copy(camera.position).normalize() : _flyDirection.set(0, -1, 0);
|
|
67985
|
+
return direction.multiplyScalar(range).add(target);
|
|
67986
|
+
}
|
|
67987
|
+
const resolvedHeading = heading ?? 0;
|
|
67988
|
+
const resolvedPitch = pitch ?? -Math.PI / 2;
|
|
67989
|
+
const centerForward = getCenterModeHeadingPitchRollForward(
|
|
67990
|
+
resolvedHeading,
|
|
67991
|
+
resolvedPitch
|
|
67992
|
+
);
|
|
67993
|
+
const centerPosition = _flyDirection.copy(target).addScaledVector(centerForward, -range);
|
|
67994
|
+
if (isCenterModePosition(centerPosition)) {
|
|
67995
|
+
return centerPosition;
|
|
67996
|
+
}
|
|
67997
|
+
const forward = getHeadingPitchRollForward(
|
|
67998
|
+
target,
|
|
67999
|
+
resolvedHeading,
|
|
68000
|
+
resolvedPitch
|
|
68001
|
+
);
|
|
68002
|
+
return _flyDirection.copy(target).addScaledVector(forward, -range);
|
|
68003
|
+
}
|
|
68004
|
+
function getHeadingPitchRollQuaternion(referencePoint, heading, pitch, roll) {
|
|
68005
|
+
if (isCenterModePosition(referencePoint)) {
|
|
68006
|
+
getCenterModeHeadingPitchRollBasis(heading, pitch, roll);
|
|
68007
|
+
_matrix1.makeBasis(_flyRight, _flyUp, _flyBackward);
|
|
68008
|
+
return new Quaternion().setFromRotationMatrix(_matrix1);
|
|
68009
|
+
}
|
|
68010
|
+
if (referencePoint.lengthSq() < 1e-6) {
|
|
68011
|
+
return new Quaternion();
|
|
68012
|
+
}
|
|
68013
|
+
getHeadingPitchRollBasis(referencePoint, heading, pitch, roll);
|
|
68014
|
+
_matrix1.makeBasis(_flyRight, _flyUp, _flyBackward);
|
|
68015
|
+
return new Quaternion().setFromRotationMatrix(_matrix1);
|
|
68016
|
+
}
|
|
68017
|
+
function getHeadingPitchRollForward(referencePoint, heading, pitch) {
|
|
68018
|
+
if (isCenterModePosition(referencePoint)) {
|
|
68019
|
+
return getCenterModeHeadingPitchRollForward(heading, pitch);
|
|
68020
|
+
}
|
|
68021
|
+
if (referencePoint.lengthSq() < 1e-6) {
|
|
68022
|
+
return _flyForward.set(0, 0, -1);
|
|
68023
|
+
}
|
|
68024
|
+
getLocalFrame(referencePoint);
|
|
68025
|
+
const cosPitch = Math.cos(pitch);
|
|
68026
|
+
const sinPitch = Math.sin(pitch);
|
|
68027
|
+
const cosHeading = Math.cos(heading);
|
|
68028
|
+
const sinHeading = Math.sin(heading);
|
|
68029
|
+
_flyForward.copy(_flyNorth).multiplyScalar(cosHeading * cosPitch).addScaledVector(_flyEast, sinHeading * cosPitch).addScaledVector(_flyUp, sinPitch).normalize();
|
|
68030
|
+
return _flyForward;
|
|
68031
|
+
}
|
|
68032
|
+
function getCenterModeHeadingPitchRollForward(heading, pitch) {
|
|
68033
|
+
const cosPitch = Math.cos(pitch);
|
|
68034
|
+
const sinPitch = Math.sin(pitch);
|
|
68035
|
+
const cosHeading = Math.cos(heading);
|
|
68036
|
+
const sinHeading = Math.sin(heading);
|
|
68037
|
+
_flyForward.set(
|
|
68038
|
+
sinHeading * cosPitch,
|
|
68039
|
+
cosHeading * cosPitch,
|
|
68040
|
+
sinPitch
|
|
68041
|
+
);
|
|
68042
|
+
return _flyForward.normalize();
|
|
68043
|
+
}
|
|
68044
|
+
function getHeadingPitchRollBasis(referencePoint, heading, pitch, roll) {
|
|
68045
|
+
if (isCenterModePosition(referencePoint)) {
|
|
68046
|
+
getCenterModeHeadingPitchRollBasis(heading, pitch, roll);
|
|
68047
|
+
return;
|
|
68048
|
+
}
|
|
68049
|
+
getHeadingPitchRollForward(referencePoint, heading, pitch);
|
|
68050
|
+
_flyRight.copy(_flyEast).multiplyScalar(Math.cos(heading)).addScaledVector(_flyNorth, -Math.sin(heading)).normalize();
|
|
68051
|
+
_flyUp.crossVectors(_flyRight, _flyForward).normalize();
|
|
68052
|
+
if (roll !== 0) {
|
|
68053
|
+
_flyRight.applyAxisAngle(_flyForward, roll).normalize();
|
|
68054
|
+
_flyUp.applyAxisAngle(_flyForward, roll).normalize();
|
|
68055
|
+
}
|
|
68056
|
+
_flyBackward.copy(_flyForward).negate();
|
|
68057
|
+
}
|
|
68058
|
+
function getCenterModeHeadingPitchRollBasis(heading, pitch, roll) {
|
|
68059
|
+
getCenterModeHeadingPitchRollForward(heading, pitch);
|
|
68060
|
+
_flyRight.copy(_flyWorldRight).multiplyScalar(Math.cos(heading)).addScaledVector(_flyCenterNorth, -Math.sin(heading)).normalize();
|
|
68061
|
+
_flyUp.crossVectors(_flyRight, _flyForward).normalize();
|
|
68062
|
+
if (roll !== 0) {
|
|
68063
|
+
_flyRight.applyAxisAngle(_flyForward, roll).normalize();
|
|
68064
|
+
_flyUp.applyAxisAngle(_flyForward, roll).normalize();
|
|
68065
|
+
}
|
|
68066
|
+
_flyBackward.copy(_flyForward).negate();
|
|
68067
|
+
}
|
|
68068
|
+
function getLocalFrame(target) {
|
|
68069
|
+
_matrix1.copy(eastNorthUpToFixedFrame(target));
|
|
68070
|
+
_flyEast.setFromMatrixColumn(_matrix1, 0).normalize();
|
|
68071
|
+
_flyNorth.setFromMatrixColumn(_matrix1, 1).normalize();
|
|
68072
|
+
_flyUp.setFromMatrixColumn(_matrix1, 2).normalize();
|
|
68073
|
+
}
|
|
68074
|
+
function isCenterModePosition(position) {
|
|
68075
|
+
return position.lengthSq() <= CAMERA_CENTER_MODE_DISTANCE_SQ;
|
|
68076
|
+
}
|
|
68077
|
+
function getReferenceBasis(forward, east, up, rightTarget, upTarget) {
|
|
68078
|
+
rightTarget.crossVectors(forward, up);
|
|
68079
|
+
if (rightTarget.lengthSq() < 1e-6) {
|
|
68080
|
+
rightTarget.copy(east).projectOnPlane(forward);
|
|
68081
|
+
if (rightTarget.lengthSq() < 1e-6) {
|
|
68082
|
+
rightTarget.set(1, 0, 0).projectOnPlane(forward);
|
|
68083
|
+
}
|
|
68084
|
+
}
|
|
68085
|
+
rightTarget.normalize();
|
|
68086
|
+
upTarget.crossVectors(rightTarget, forward).normalize();
|
|
68087
|
+
}
|
|
68088
|
+
function lerpAngle(start, end, t2) {
|
|
68089
|
+
let delta = end - start;
|
|
68090
|
+
if (delta > Math.PI) {
|
|
68091
|
+
delta -= Math.PI * 2;
|
|
68092
|
+
} else if (delta < -Math.PI) {
|
|
68093
|
+
delta += Math.PI * 2;
|
|
68094
|
+
}
|
|
68095
|
+
return start + delta * t2;
|
|
68096
|
+
}
|
|
68097
|
+
function applyFlyToPose(camera, position, quaternion, zoom = null) {
|
|
68098
|
+
camera.position.copy(position);
|
|
68099
|
+
camera.quaternion.copy(quaternion);
|
|
68100
|
+
if (camera instanceof OrthographicCamera && zoom !== null) {
|
|
68101
|
+
camera.zoom = Math.max(zoom, 1e-6);
|
|
68102
|
+
camera.updateProjectionMatrix();
|
|
68103
|
+
}
|
|
68104
|
+
camera.updateMatrixWorld();
|
|
68105
|
+
}
|
|
68106
|
+
var _matrix3, _matrix1, _flyDirectionStart, _flyDirectionEnd, _flyDirection, _flyAxis, _flyWorldNorth, _flyWorldRight, _flyCenterNorth, _flyCenterUp, _flyWorldUp, _flyUp, _flyEast, _flyNorth, _flyForward, _flyRight, _flyBackward, _flyCameraUp, _flyCameraRight, _flyReferenceUp, _flyReferenceRight, _flyQuaternion, _ellipsoidRadii, _oneOverRadiiSquared, _geoEast, _geoNorth, _geoUp, UPRIGHT_ROLL_THRESHOLD, ROLL_UNDEFINED_DOT_THRESHOLD, HEADING_RIGHT_DEGENERATE_EPSILON;
|
|
68107
|
+
var init_cameraFlyTo = __esm({
|
|
68108
|
+
"src/viewer/navigation/cameraFlyTo.js"() {
|
|
68109
|
+
init_three_module();
|
|
68110
|
+
init_config();
|
|
68111
|
+
_matrix3 = new Matrix4();
|
|
68112
|
+
_matrix1 = new Matrix4();
|
|
68113
|
+
_flyDirectionStart = new Vector3();
|
|
68114
|
+
_flyDirectionEnd = new Vector3();
|
|
68115
|
+
_flyDirection = new Vector3();
|
|
68116
|
+
_flyAxis = new Vector3();
|
|
68117
|
+
_flyWorldNorth = new Vector3(0, 0, 1);
|
|
68118
|
+
_flyWorldRight = new Vector3(1, 0, 0);
|
|
68119
|
+
_flyCenterNorth = new Vector3(0, 1, 0);
|
|
68120
|
+
_flyCenterUp = new Vector3(0, 0, 1);
|
|
68121
|
+
_flyWorldUp = new Vector3(0, 1, 0);
|
|
68122
|
+
_flyUp = new Vector3();
|
|
68123
|
+
_flyEast = new Vector3();
|
|
68124
|
+
_flyNorth = new Vector3();
|
|
68125
|
+
_flyForward = new Vector3();
|
|
68126
|
+
_flyRight = new Vector3();
|
|
68127
|
+
_flyBackward = new Vector3();
|
|
68128
|
+
_flyCameraUp = new Vector3();
|
|
68129
|
+
_flyCameraRight = new Vector3();
|
|
68130
|
+
_flyReferenceUp = new Vector3();
|
|
68131
|
+
_flyReferenceRight = new Vector3();
|
|
68132
|
+
_flyQuaternion = new Quaternion();
|
|
68133
|
+
_ellipsoidRadii = new Vector3(
|
|
68134
|
+
6378137,
|
|
68135
|
+
6378137,
|
|
68136
|
+
6356752314245179e-9
|
|
68137
|
+
);
|
|
68138
|
+
_oneOverRadiiSquared = new Vector3(
|
|
68139
|
+
1 / (_ellipsoidRadii.x * _ellipsoidRadii.x),
|
|
68140
|
+
1 / (_ellipsoidRadii.y * _ellipsoidRadii.y),
|
|
68141
|
+
1 / (_ellipsoidRadii.z * _ellipsoidRadii.z)
|
|
68142
|
+
);
|
|
68143
|
+
_geoEast = new Vector3();
|
|
68144
|
+
_geoNorth = new Vector3();
|
|
68145
|
+
_geoUp = new Vector3();
|
|
68146
|
+
UPRIGHT_ROLL_THRESHOLD = MathUtils.degToRad(5);
|
|
68147
|
+
ROLL_UNDEFINED_DOT_THRESHOLD = Math.cos(MathUtils.degToRad(5));
|
|
68148
|
+
HEADING_RIGHT_DEGENERATE_EPSILON = 1e-6;
|
|
68149
|
+
}
|
|
68150
|
+
});
|
|
68151
|
+
|
|
67653
68152
|
// src/viewer/navigation/flyTo.js
|
|
67654
68153
|
function createFlyToController({
|
|
67655
68154
|
camera,
|
|
@@ -67669,6 +68168,8 @@ function createFlyToController({
|
|
|
67669
68168
|
const pickRaycaster = new Raycaster();
|
|
67670
68169
|
const pickTargets = [];
|
|
67671
68170
|
const sphere = new Sphere();
|
|
68171
|
+
let activeCameraFlight = null;
|
|
68172
|
+
let activeCameraFlightStatus = "";
|
|
67672
68173
|
function getActiveEllipsoid() {
|
|
67673
68174
|
return getTiles()?.ellipsoid || globeController.getEllipsoid();
|
|
67674
68175
|
}
|
|
@@ -67710,6 +68211,43 @@ function createFlyToController({
|
|
|
67710
68211
|
}
|
|
67711
68212
|
return geoCamera.getCartographicFromWorldPosition(coordinateWorldPosition);
|
|
67712
68213
|
}
|
|
68214
|
+
function startCameraFlight(position, target, options = {}, { activeStatus = "Moving camera.", doneStatus = "Moved camera." } = {}) {
|
|
68215
|
+
cameraController.setCamera(camera);
|
|
68216
|
+
activeCameraFlight = createCameraFlight(camera, position, target, options);
|
|
68217
|
+
activeCameraFlightStatus = doneStatus;
|
|
68218
|
+
if (!activeCameraFlight) {
|
|
68219
|
+
cameraController.setCamera(camera);
|
|
68220
|
+
setStatus(doneStatus);
|
|
68221
|
+
return;
|
|
68222
|
+
}
|
|
68223
|
+
setStatus(activeStatus);
|
|
68224
|
+
}
|
|
68225
|
+
function startBoundingSphereFlight(target, radius, options = {}, status = {}) {
|
|
68226
|
+
const flyToParams = getFlyToParamsFromBoundingSphere(
|
|
68227
|
+
camera,
|
|
68228
|
+
target,
|
|
68229
|
+
radius,
|
|
68230
|
+
options
|
|
68231
|
+
);
|
|
68232
|
+
startCameraFlight(
|
|
68233
|
+
flyToParams.position,
|
|
68234
|
+
flyToParams.target,
|
|
68235
|
+
flyToParams.options,
|
|
68236
|
+
status
|
|
68237
|
+
);
|
|
68238
|
+
}
|
|
68239
|
+
function update(time = performance.now()) {
|
|
68240
|
+
if (!activeCameraFlight) {
|
|
68241
|
+
return false;
|
|
68242
|
+
}
|
|
68243
|
+
const done = flyTo(camera, activeCameraFlight, time);
|
|
68244
|
+
if (done) {
|
|
68245
|
+
activeCameraFlight = null;
|
|
68246
|
+
setStatus(activeCameraFlightStatus);
|
|
68247
|
+
activeCameraFlightStatus = "";
|
|
68248
|
+
}
|
|
68249
|
+
return true;
|
|
68250
|
+
}
|
|
67713
68251
|
async function applyTilesSetPositionFromPointerEvent(event) {
|
|
67714
68252
|
const coordinate = pickCoordinateFromPointerEvent(event);
|
|
67715
68253
|
if (!coordinate) {
|
|
@@ -67731,27 +68269,29 @@ function createFlyToController({
|
|
|
67731
68269
|
return null;
|
|
67732
68270
|
}
|
|
67733
68271
|
}
|
|
67734
|
-
function frameTileset(
|
|
68272
|
+
function frameTileset({
|
|
68273
|
+
activeStatus = "Moving camera to the tileset.",
|
|
68274
|
+
doneStatus = "Moved camera to the tileset."
|
|
68275
|
+
} = {}) {
|
|
67735
68276
|
if (!getTilesetBoundingSphere(sphere)) {
|
|
67736
68277
|
return false;
|
|
67737
68278
|
}
|
|
67738
|
-
|
|
68279
|
+
startBoundingSphereFlight(
|
|
67739
68280
|
sphere.center,
|
|
67740
|
-
sphere.radius,
|
|
67741
|
-
moveToTilesPose
|
|
68281
|
+
sphere.radius / 2,
|
|
68282
|
+
moveToTilesPose,
|
|
68283
|
+
{
|
|
68284
|
+
activeStatus,
|
|
68285
|
+
doneStatus
|
|
68286
|
+
}
|
|
67742
68287
|
);
|
|
67743
|
-
camera.position.copy(pose.position);
|
|
67744
|
-
camera.quaternion.copy(pose.quaternion);
|
|
67745
|
-
camera.updateMatrixWorld(true);
|
|
67746
|
-
cameraController.setCamera(camera);
|
|
67747
68288
|
return true;
|
|
67748
68289
|
}
|
|
67749
68290
|
function moveCameraToTiles() {
|
|
67750
68291
|
if (frameTileset()) {
|
|
67751
|
-
|
|
67752
|
-
} else {
|
|
67753
|
-
setStatus("Tileset is not ready to frame yet.", true);
|
|
68292
|
+
return;
|
|
67754
68293
|
}
|
|
68294
|
+
setStatus("Tileset is not ready to frame yet.", true);
|
|
67755
68295
|
}
|
|
67756
68296
|
function moveCameraToCoordinate(coordinate) {
|
|
67757
68297
|
geoCamera.getCoordinateWorldPosition(
|
|
@@ -67760,16 +68300,15 @@ function createFlyToController({
|
|
|
67760
68300
|
coordinate.height,
|
|
67761
68301
|
coordinateWorldPosition
|
|
67762
68302
|
);
|
|
67763
|
-
|
|
68303
|
+
startBoundingSphereFlight(
|
|
67764
68304
|
coordinateWorldPosition,
|
|
67765
68305
|
moveToCoordinateRadius,
|
|
67766
|
-
moveToTilesPose
|
|
68306
|
+
moveToTilesPose,
|
|
68307
|
+
{
|
|
68308
|
+
activeStatus: "Moving camera to the specified coordinate.",
|
|
68309
|
+
doneStatus: "Moved camera to the specified coordinate."
|
|
68310
|
+
}
|
|
67767
68311
|
);
|
|
67768
|
-
camera.position.copy(pose.position);
|
|
67769
|
-
camera.quaternion.copy(pose.quaternion);
|
|
67770
|
-
camera.updateMatrixWorld(true);
|
|
67771
|
-
cameraController.setCamera(camera);
|
|
67772
|
-
setStatus("Moved camera to the specified coordinate.");
|
|
67773
68312
|
}
|
|
67774
68313
|
return {
|
|
67775
68314
|
applyTilesSetPositionFromPointerEvent,
|
|
@@ -67777,12 +68316,14 @@ function createFlyToController({
|
|
|
67777
68316
|
getActiveEllipsoid,
|
|
67778
68317
|
moveCameraToCoordinate,
|
|
67779
68318
|
moveCameraToTiles,
|
|
67780
|
-
pickCoordinateFromPointerEvent
|
|
68319
|
+
pickCoordinateFromPointerEvent,
|
|
68320
|
+
update
|
|
67781
68321
|
};
|
|
67782
68322
|
}
|
|
67783
68323
|
var init_flyTo = __esm({
|
|
67784
68324
|
"src/viewer/navigation/flyTo.js"() {
|
|
67785
68325
|
init_three_module();
|
|
68326
|
+
init_cameraFlyTo();
|
|
67786
68327
|
init_utils();
|
|
67787
68328
|
}
|
|
67788
68329
|
});
|
|
@@ -70686,7 +71227,7 @@ var require_app = __commonJS({
|
|
|
70686
71227
|
var geoCamera = createGeoCameraController({
|
|
70687
71228
|
camera,
|
|
70688
71229
|
centerModeDistanceSq: CAMERA_CENTER_MODE_DISTANCE_SQ,
|
|
70689
|
-
getActiveEllipsoid: () =>
|
|
71230
|
+
getActiveEllipsoid: () => flyTo2.getActiveEllipsoid()
|
|
70690
71231
|
});
|
|
70691
71232
|
var geometricError = createGeometricErrorController({
|
|
70692
71233
|
defaultErrorTarget: DEFAULT_ERROR_TARGET,
|
|
@@ -70705,7 +71246,7 @@ var require_app = __commonJS({
|
|
|
70705
71246
|
target.radius *= editableGroup.matrixWorld.getMaxScaleOnAxis();
|
|
70706
71247
|
return true;
|
|
70707
71248
|
}
|
|
70708
|
-
var
|
|
71249
|
+
var flyTo2 = createFlyToController({
|
|
70709
71250
|
camera,
|
|
70710
71251
|
cameraController,
|
|
70711
71252
|
domElement: renderer.domElement,
|
|
@@ -70727,7 +71268,7 @@ var require_app = __commonJS({
|
|
|
70727
71268
|
syncTransformControlsState: () => transformModeController.syncControls(),
|
|
70728
71269
|
transformControls,
|
|
70729
71270
|
applyTilesPlacementFromPointerEvent: async (event) => {
|
|
70730
|
-
const coordinate = await
|
|
71271
|
+
const coordinate = await flyTo2.applyTilesSetPositionFromPointerEvent(event);
|
|
70731
71272
|
if (coordinate) {
|
|
70732
71273
|
updateCoordinateInputs(
|
|
70733
71274
|
coordinate.latitude,
|
|
@@ -70815,7 +71356,7 @@ var require_app = __commonJS({
|
|
|
70815
71356
|
transformModeController.setMode(null);
|
|
70816
71357
|
function moveCameraToTiles() {
|
|
70817
71358
|
cancelPositionPickModes();
|
|
70818
|
-
|
|
71359
|
+
flyTo2.moveCameraToTiles();
|
|
70819
71360
|
}
|
|
70820
71361
|
function moveCameraToCoordinate() {
|
|
70821
71362
|
cancelPositionPickModes();
|
|
@@ -70823,7 +71364,7 @@ var require_app = __commonJS({
|
|
|
70823
71364
|
if (!coordinate) {
|
|
70824
71365
|
return;
|
|
70825
71366
|
}
|
|
70826
|
-
|
|
71367
|
+
flyTo2.moveCameraToCoordinate(coordinate);
|
|
70827
71368
|
}
|
|
70828
71369
|
async function moveTilesToCoordinate() {
|
|
70829
71370
|
cancelPositionPickModes();
|
|
@@ -70898,9 +71439,11 @@ var require_app = __commonJS({
|
|
|
70898
71439
|
if (framed) {
|
|
70899
71440
|
return;
|
|
70900
71441
|
}
|
|
70901
|
-
if (
|
|
71442
|
+
if (flyTo2.frameTileset({
|
|
71443
|
+
activeStatus: "Framing tileset...",
|
|
71444
|
+
doneStatus: "Tileset ready."
|
|
71445
|
+
})) {
|
|
70902
71446
|
framed = true;
|
|
70903
|
-
setStatus("Tileset ready.");
|
|
70904
71447
|
}
|
|
70905
71448
|
};
|
|
70906
71449
|
next.addEventListener(
|
|
@@ -71021,6 +71564,7 @@ var require_app = __commonJS({
|
|
|
71021
71564
|
loadTileset(TILESET_URL);
|
|
71022
71565
|
function frame() {
|
|
71023
71566
|
cameraController.update();
|
|
71567
|
+
flyTo2.update();
|
|
71024
71568
|
rootTransform.flush();
|
|
71025
71569
|
globeController.update();
|
|
71026
71570
|
tiles?.update();
|