From fefe11bc39c0b0e6e5768319caa697dd24545bf9 Mon Sep 17 00:00:00 2001 From: Adrian Solberg Date: Fri, 26 Sep 2025 14:00:04 +0200 Subject: [PATCH] fix(#9): hide globe when camera is below surface --- src/cameraSync.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cameraSync.js b/src/cameraSync.js index c2ca8b6..39ca0fc 100644 --- a/src/cameraSync.js +++ b/src/cameraSync.js @@ -23,7 +23,12 @@ export function syncCameras(potreeViewer, cesiumViewer) { const cUp = Cesium.Cartesian3.normalize( Cesium.Cartesian3.subtract(cUpTarget, cPos, new Cesium.Cartesian3()), new Cesium.Cartesian3() - ) + ) + + // Hide globe when camera is below surface + const camHeight = Cesium.Cartographic.fromCartesian(cPos).height + cesiumViewer.scene.globe.show = camHeight >= 0; + cesiumViewer.scene.skyAtmosphere.show = camHeight >= 0; cesiumViewer.camera.setView({ destination: cPos, @@ -41,4 +46,4 @@ export function syncCameras(potreeViewer, cesiumViewer) { const fovx = Math.atan(Math.tan(0.5 * fovy) * aspect) * 2 cesiumViewer.camera.frustum.fov = fovx } -} +} \ No newline at end of file