@cesium/engine 26.1.0 → 26.3.0
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/Build/ThirdParty/Workers/zip-web-worker.js +764 -520
- package/Build/Workers/{chunk-HS6AD4P2.js → chunk-2DKJSPYF.js} +14 -14
- package/Build/Workers/{chunk-QVLAFFJY.js → chunk-2PWVICP6.js} +1 -1
- package/Build/Workers/{chunk-ILME5BXA.js → chunk-2YY724ZX.js} +8 -8
- package/Build/Workers/{chunk-ENNFMWDW.js → chunk-4DMAXPKB.js} +12 -12
- package/Build/Workers/{chunk-CDJDJ5LK.js → chunk-4LRFYRBX.js} +2 -2
- package/Build/Workers/{chunk-76FDC45O.js → chunk-5JCZHJUU.js} +13 -13
- package/Build/Workers/{chunk-5LSOO2KD.js → chunk-5KG7KDDW.js} +7 -7
- package/Build/Workers/{chunk-A6X24AZI.js → chunk-6BSNYZZG.js} +5 -5
- package/Build/Workers/{chunk-IGAZBTFZ.js → chunk-6R6SGKYN.js} +6 -6
- package/Build/Workers/{chunk-SS5ABQGY.js → chunk-6V2KDEHL.js} +4 -4
- package/Build/Workers/{chunk-ZMBHFYOX.js → chunk-75BC2IHI.js} +7 -7
- package/Build/Workers/{chunk-LGNDTZVX.js → chunk-7SESBH2I.js} +4 -4
- package/Build/Workers/{chunk-CLCTQVVL.js → chunk-7WXBTNRV.js} +8 -8
- package/Build/Workers/{chunk-WBSY7HDY.js → chunk-A7SMPV6B.js} +12 -12
- package/Build/Workers/{chunk-CEEZE3YZ.js → chunk-ATSXKJ3L.js} +7 -7
- package/Build/Workers/{chunk-AHWAZRBV.js → chunk-B4AVL7VI.js} +1 -1
- package/Build/Workers/{chunk-6HK6IXK2.js → chunk-B7Q2WF6Q.js} +4 -4
- package/Build/Workers/{chunk-YKU2Q3A2.js → chunk-BNDSDQ7D.js} +9 -12
- package/Build/Workers/{chunk-R4FPNAZ2.js → chunk-CKK6CUXK.js} +9 -9
- package/Build/Workers/{chunk-FCP2QY4G.js → chunk-COKOYTRS.js} +5 -5
- package/Build/Workers/{chunk-7D2HZKH7.js → chunk-CQ4TZXAT.js} +7 -7
- package/Build/Workers/{chunk-TVZD72WJ.js → chunk-DKSANM4A.js} +12 -12
- package/Build/Workers/{chunk-FDK4K5IA.js → chunk-DZK34ZVD.js} +1 -1
- package/Build/Workers/{chunk-N7CCOFLX.js → chunk-E7G32DWL.js} +1 -1
- package/Build/Workers/{chunk-XDWCTQCZ.js → chunk-EDETO6NY.js} +2 -2
- package/Build/Workers/{chunk-2EFYUSUY.js → chunk-F34TJJLA.js} +16 -16
- package/Build/Workers/{chunk-GXWQZBAI.js → chunk-GLHDTTTO.js} +2 -2
- package/Build/Workers/{chunk-T5QBPLE3.js → chunk-GS7RY2DH.js} +11 -11
- package/Build/Workers/{chunk-C7JQVRLM.js → chunk-HDD3RFLT.js} +25 -3
- package/Build/Workers/{chunk-E7NZJOK7.js → chunk-HDPNFEPP.js} +121 -93
- package/Build/Workers/{chunk-VAL7DYNR.js → chunk-JBJ6BRIM.js} +4 -4
- package/Build/Workers/{chunk-XQ3SKCMM.js → chunk-JKTWW7IO.js} +5 -5
- package/Build/Workers/{chunk-UVO6COT2.js → chunk-JL4NWWQY.js} +5 -5
- package/Build/Workers/{chunk-DBD5WWG2.js → chunk-JMUUAW4X.js} +10 -10
- package/Build/Workers/{chunk-UEY73NRN.js → chunk-KBGAHN5R.js} +1 -1
- package/Build/Workers/{chunk-LD64RPYV.js → chunk-KEWK6VZL.js} +12 -12
- package/Build/Workers/{chunk-JW6OZT4R.js → chunk-L73K5UPP.js} +10 -10
- package/Build/Workers/{chunk-DIGUUD6G.js → chunk-LL2SGJYH.js} +6 -6
- package/Build/Workers/{chunk-XLXSDIP5.js → chunk-LYJUL4XQ.js} +6 -6
- package/Build/Workers/{chunk-SM2CDCYF.js → chunk-M6W46OAP.js} +7 -7
- package/Build/Workers/{chunk-EHTS2YPT.js → chunk-MDDKCLMF.js} +17 -17
- package/Build/Workers/{chunk-FGQFQHN5.js → chunk-MUW4DJV7.js} +18 -18
- package/Build/Workers/{chunk-HHV3MCGV.js → chunk-N5YK44FS.js} +5 -5
- package/Build/Workers/{chunk-RG4F5R57.js → chunk-NZQUP52G.js} +9 -9
- package/Build/Workers/{chunk-B4CQSLZJ.js → chunk-PKZA44LH.js} +6 -6
- package/Build/Workers/{chunk-OBEU25PI.js → chunk-Q2JS5LCB.js} +17 -17
- package/Build/Workers/{chunk-KGXSYGBG.js → chunk-QTAEVUED.js} +13 -13
- package/Build/Workers/{chunk-NIWITKQK.js → chunk-SEJIXZZ4.js} +11 -11
- package/Build/Workers/{chunk-SGRGNDOD.js → chunk-SL2HCFYW.js} +10 -10
- package/Build/Workers/{chunk-SF6K72D7.js → chunk-SLHK3KAR.js} +5 -5
- package/Build/Workers/{chunk-JKXV6PG5.js → chunk-UZY5XRL2.js} +1 -1
- package/Build/Workers/{chunk-LNSQVXFH.js → chunk-VRECSMG3.js} +2 -2
- package/Build/Workers/{chunk-A3O6EDBK.js → chunk-X27HKF5E.js} +2 -2
- package/Build/Workers/{chunk-7KVKHY7O.js → chunk-XBY3354M.js} +6 -6
- package/Build/Workers/{chunk-GSWMAFTE.js → chunk-XRZCS3HE.js} +23 -16
- package/Build/Workers/{chunk-6YR6JBMY.js → chunk-XSIUYAT6.js} +2 -2
- package/Build/Workers/{chunk-ZSGUV73H.js → chunk-Z2DW5NM2.js} +6 -6
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +35 -35
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +31 -33
- package/Build/Workers/createCorridorOutlineGeometry.js +29 -31
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +24 -24
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +34 -34
- package/Build/Workers/createPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createPolylineGeometry.js +26 -26
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +21 -21
- package/Build/Workers/createSimplePolylineGeometry.js +24 -24
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +24 -24
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
- package/Source/Core/BoundingSphere.js +0 -3
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
- package/Source/Core/CoplanarPolygonGeometry.js +2 -2
- package/Source/Core/CorridorGeometry.js +2 -4
- package/Source/Core/CorridorOutlineGeometry.js +1 -3
- package/Source/Core/EarthOrientationParameters.js +2 -2
- package/Source/Core/EllipseGeometryLibrary.js +2 -2
- package/Source/Core/EllipsoidGeodesic.js +3 -3
- package/Source/Core/EllipsoidRhumbLine.js +1 -1
- package/Source/Core/GroundPolylineGeometry.js +2 -2
- package/Source/Core/Heap.js +1 -1
- package/Source/Core/HermitePolynomialApproximation.js +215 -179
- package/Source/Core/InterpolationAlgorithm.js +1 -0
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/IonResource.js +5 -0
- package/Source/Core/IonSnapGeometryType.js +59 -0
- package/Source/Core/IonSnapHeat.js +33 -0
- package/Source/Core/IonSnapMode.js +45 -0
- package/Source/Core/IonSnapParentGeometryType.js +52 -0
- package/Source/Core/IonSnapService.js +369 -0
- package/Source/Core/JulianDate.js +1 -1
- package/Source/Core/LagrangePolynomialApproximation.js +55 -52
- package/Source/Core/LinearApproximation.js +69 -66
- package/Source/Core/Math.js +59 -0
- package/Source/Core/Matrix2.js +2 -2
- package/Source/Core/Matrix3.js +2 -2
- package/Source/Core/OrthographicFrustum.js +1 -1
- package/Source/Core/PerspectiveFrustum.js +1 -1
- package/Source/Core/PolygonGeometry.js +2 -2
- package/Source/Core/PolygonGeometryLibrary.js +1 -1
- package/Source/Core/PolygonOutlineGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometryLibrary.js +1 -1
- package/Source/Core/Rectangle.js +7 -1
- package/Source/Core/RectangleOutlineGeometry.js +1 -1
- package/Source/Core/SimplePolylineGeometry.js +1 -1
- package/Source/Core/SnapService.js +63 -0
- package/Source/Core/TerrainEncoding.js +2 -2
- package/Source/Core/TerrainPicker.js +179 -168
- package/Source/Core/TimeIntervalCollection.js +1 -3
- package/Source/Core/Tipsify.js +1 -1
- package/Source/Core/Transforms.js +5 -1
- package/Source/Core/VectorPipeline.js +1211 -0
- package/Source/Core/VectorProvider.js +669 -0
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/getTimestamp.js +4 -2
- package/Source/DataSources/CompositeEntityCollection.js +0 -1
- package/Source/DataSources/CzmlDataSource.js +2 -0
- package/Source/DataSources/DataSourceDisplay.js +1 -1
- package/Source/DataSources/GeoJsonDataSource.js +0 -1
- package/Source/DataSources/GeometryVisualizer.js +1 -1
- package/Source/DataSources/KmlDataSource.js +1 -2
- package/Source/DataSources/PolylineVisualizer.js +1 -1
- package/Source/DataSources/StaticOutlineGeometryBatch.js +1 -1
- package/Source/Renderer/AutomaticUniforms.js +67 -2
- package/Source/Renderer/Context.js +9 -3
- package/Source/Renderer/DrawCommand.js +22 -0
- package/Source/Renderer/Framebuffer.js +4 -0
- package/Source/Renderer/Pass.js +11 -10
- package/Source/Renderer/ShaderBuilder.js +1 -1
- package/Source/Renderer/Texture.js +11 -0
- package/Source/Renderer/UniformState.js +54 -1
- package/Source/Renderer/VertexArray.js +0 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +0 -5
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +2 -1
- package/Source/Scene/BillboardCollection.js +7 -3
- package/Source/Scene/BufferPointCollection.js +4 -7
- package/Source/Scene/BufferPolygonCollection.js +56 -27
- package/Source/Scene/BufferPolylineCollection.js +61 -8
- package/Source/Scene/BufferPolylineMaterial.js +6 -5
- package/Source/Scene/BufferPrimitiveCollection.js +226 -34
- package/Source/Scene/Camera.js +71 -5
- package/Source/Scene/Cesium3DTile.js +12 -0
- package/Source/Scene/Cesium3DTileset.js +62 -9
- package/Source/Scene/Cesium3DTilesetBaseTraversal.js +15 -3
- package/Source/Scene/Cesium3DTilesetCache.js +15 -0
- package/Source/Scene/ClippingPlaneCollection.js +2 -2
- package/Source/Scene/ClippingPolygon.js +154 -100
- package/Source/Scene/ClippingPolygonCollection.js +352 -694
- package/Source/Scene/Controllers/Controller.js +63 -0
- package/Source/Scene/Controllers/ControllerHost.js +78 -0
- package/Source/Scene/Controllers/HybridScreenSpacePanCameraController.js +106 -0
- package/Source/Scene/Controllers/MouseButton.js +32 -0
- package/Source/Scene/Controllers/ScreenSpaceElevatorCameraController.js +295 -0
- package/Source/Scene/Controllers/ScreenSpaceInputBindings.js +154 -0
- package/Source/Scene/Controllers/ScreenSpaceMapCameraController.js +310 -0
- package/Source/Scene/Controllers/ScreenSpaceTiltOrbitCameraController.js +642 -0
- package/Source/Scene/Controllers/ScreenSpaceZoomCameraController.js +431 -0
- package/Source/Scene/Controllers/defaultPickWorldPosition.js +84 -0
- package/Source/Scene/CreditDisplay.js +62 -0
- package/Source/Scene/DerivedCommand.js +94 -0
- package/Source/Scene/EdgeFramebuffer.js +1 -5
- package/Source/Scene/FrameState.js +17 -0
- package/Source/Scene/GeoJsonPrimitive.js +114 -24
- package/Source/Scene/Globe.js +20 -0
- package/Source/Scene/GlobeDepth.js +27 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +42 -53
- package/Source/Scene/GlobeSurfaceTile.js +61 -10
- package/Source/Scene/GlobeSurfaceTileProvider.js +351 -26
- package/Source/Scene/GltfLoader.js +88 -9
- package/Source/Scene/GltfSpzLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +6 -3
- package/Source/Scene/HeightReference.js +1 -1
- package/Source/Scene/I3SDataProvider.js +1 -1
- package/Source/Scene/I3SLayer.js +1 -1
- package/Source/Scene/I3SNode.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +188 -4
- package/Source/Scene/IonImageryProvider.js +1 -5
- package/Source/Scene/Label.js +4 -4
- package/Source/Scene/LabelCollection.js +1 -1
- package/Source/Scene/MVTDataProvider.js +11 -0
- package/Source/Scene/Model/B3dmLoader.js +1 -2
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +10 -8
- package/Source/Scene/Model/I3dmLoader.js +1 -1
- package/Source/Scene/Model/InstancingPipelineStage.js +4 -7
- package/Source/Scene/Model/MaterialPipelineStage.js +124 -1
- package/Source/Scene/Model/Model.js +250 -26
- package/Source/Scene/Model/Model3DTileContent.js +5 -0
- package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
- package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +54 -19
- package/Source/Scene/Model/ModelDrawCommand.js +160 -16
- package/Source/Scene/Model/ModelDrawCommands.js +4 -0
- package/Source/Scene/Model/ModelRenderResources.js +2 -3
- package/Source/Scene/Model/ModelSceneGraph.js +31 -1
- package/Source/Scene/Model/ModelVectorLookupPipelineStage.js +205 -0
- package/Source/Scene/Model/PickingPipelineStage.js +33 -0
- package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
- package/Source/Scene/ModelComponents.js +71 -0
- package/Source/Scene/Picking.js +16 -5
- package/Source/Scene/PlanarFillIdFramebuffer.js +172 -0
- package/Source/Scene/PntsParser.js +0 -1
- package/Source/Scene/PolylineCollection.js +1 -1
- package/Source/Scene/PostProcessStage.js +26 -5
- package/Source/Scene/ResourceCache.js +7 -4
- package/Source/Scene/ResourceCacheKey.js +16 -13
- package/Source/Scene/Scene.js +258 -6
- package/Source/Scene/ScreenSpaceCameraController.js +1 -2
- package/Source/Scene/ShadowMap.js +9 -3
- package/Source/Scene/ShadowMapShader.js +50 -2
- package/Source/Scene/SnapFramebuffer.js +121 -0
- package/Source/Scene/Snapping.js +241 -0
- package/Source/Scene/TerrainFillMesh.js +3 -2
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +13 -2
- package/Source/Scene/Vector3DTileContent.js +2 -3
- package/Source/Scene/VectorGltf3DTileContent.js +31 -3
- package/Source/Scene/View.js +10 -8
- package/Source/Scene/VoxelTraversal.js +1 -1
- package/Source/Scene/WebMapServiceImageryProvider.js +5 -1
- package/Source/Scene/WebMapTileServiceImageryProvider.js +6 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/renderBufferPointCollection.js +1 -2
- package/Source/Scene/renderBufferPolygonCollection.js +1 -2
- package/Source/Scene/renderBufferPolylineCollection.js +6 -3
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +14 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +14 -2
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.js +11 -0
- package/Source/Shaders/Builtin/Constants/passClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +4 -4
- package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.glsl +74 -0
- package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.js +76 -0
- package/Source/Shaders/GlobeFS.glsl +20 -14
- package/Source/Shaders/GlobeFS.js +20 -14
- package/Source/Shaders/GlobeVS.glsl +0 -32
- package/Source/Shaders/GlobeVS.js +0 -32
- package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
- package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
- package/Source/Shaders/Model/MaterialStageFS.js +8 -2
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +15 -3
- package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +15 -3
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +20 -24
- package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +20 -24
- package/Source/Shaders/Model/ModelFS.glsl +109 -0
- package/Source/Shaders/Model/ModelFS.js +109 -0
- package/Source/Shaders/Model/ModelVS.glsl +7 -2
- package/Source/Shaders/Model/ModelVS.js +7 -2
- package/Source/Shaders/Model/ModelVectorLookupStageFS.glsl +6 -0
- package/Source/Shaders/Model/ModelVectorLookupStageFS.js +8 -0
- package/Source/Shaders/Model/ModelVectorLookupStageVS.glsl +15 -0
- package/Source/Shaders/Model/ModelVectorLookupStageVS.js +17 -0
- package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +9 -10
- package/Source/Shaders/Model/VerticalExaggerationStageVS.js +9 -11
- package/Source/Shaders/VectorCommon.glsl +305 -0
- package/Source/Shaders/VectorCommon.js +307 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Widget/CesiumWidget.js +30 -0
- package/index.d.ts +1326 -65
- package/index.js +179 -155
- package/package.json +6 -6
- package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +0 -37
- package/Source/Shaders/Builtin/Functions/clipPolygons.js +0 -39
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +0 -14
- package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +0 -15
- package/Source/Shaders/PolygonSignedDistanceFS.glsl +0 -131
- package/Source/Shaders/PolygonSignedDistanceFS.js +0 -132
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import DeveloperError from "../../Core/DeveloperError.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An interface for a camera controller that can be registered with the scene to handle input events, camera animations, and other interactions. Implementations of this interface are expected to be registered with the scene via a {@link ControllerHost}.
|
|
5
|
+
* This type describes an
|
|
6
|
+
* interface and is not intended to be instantiated directly.
|
|
7
|
+
* @class
|
|
8
|
+
* @abstract
|
|
9
|
+
* @see {@link HybridScreenSpacePanCameraController}
|
|
10
|
+
* @see {@link ScreenSpaceElevatorCameraController}
|
|
11
|
+
* @see {@link ScreenSpaceMapCameraController}
|
|
12
|
+
* @see {@link ScreenSpaceTiltOrbitCameraController}
|
|
13
|
+
*/
|
|
14
|
+
class Controller {
|
|
15
|
+
/**
|
|
16
|
+
* Determines if the controller is enabled and should be updated by the host scene.
|
|
17
|
+
* @type {boolean}
|
|
18
|
+
*/
|
|
19
|
+
get enabled() {
|
|
20
|
+
return DeveloperError.throwInstantiationError();
|
|
21
|
+
}
|
|
22
|
+
set enabled(value) {
|
|
23
|
+
DeveloperError.throwInstantiationError();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Invoked when the controller is added to the DOM. Implement <code>connectedCallback</code> to set up any DOM event listeners.
|
|
28
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
29
|
+
*/
|
|
30
|
+
connectedCallback(element) {
|
|
31
|
+
DeveloperError.throwInstantiationError();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Invoked when the controller is removed from the DOM. Implement <code>disconnectedCallback</code> to tear down any DOM event listeners.
|
|
36
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
37
|
+
*/
|
|
38
|
+
disconnectedCallback(element) {
|
|
39
|
+
DeveloperError.throwInstantiationError();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Invoked once per frame. Implement <code>update</code> to modify the camera or other parts of the scene.
|
|
44
|
+
* @see {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/#updaterender-cycle-events|Update/Render Cycle Events}
|
|
45
|
+
* @param {Scene} scene
|
|
46
|
+
* @param {JulianDate} time The current simulation time.
|
|
47
|
+
*/
|
|
48
|
+
update(scene, time) {
|
|
49
|
+
DeveloperError.throwInstantiationError();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Invoked when the controller is being updated the first time, immediately before <code>update</code> is called. Implement <code>firstUpdate</code> to perform one-time work after the relevant scene has begun its render loop. Some examples might include initializing simulation time values or adding a primitive to the scene.
|
|
54
|
+
* @see Controller#update
|
|
55
|
+
* @param {Scene} scene
|
|
56
|
+
* @param {JulianDate} time The current simulation time.
|
|
57
|
+
*/
|
|
58
|
+
firstUpdate(scene, time) {
|
|
59
|
+
DeveloperError.throwInstantiationError();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default Controller;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects an array of Controller objects that can be registered with the scene to handle input events, camera animations, and other interactions.
|
|
3
|
+
* @class
|
|
4
|
+
* @see {@link Controller}
|
|
5
|
+
* @see {@link Scene#controllerHost}
|
|
6
|
+
*/
|
|
7
|
+
class ControllerHost {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of a <code>ControllerHost</code>. Typically, a <code>ControllerHost</code> is created by the Scene constructor and accessed via {@link Scene#controllerHost}.
|
|
10
|
+
* @see {@link Scene#controllerHost}
|
|
11
|
+
*/
|
|
12
|
+
constructor() {
|
|
13
|
+
/**
|
|
14
|
+
* @type {Controller[]}
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
this._controllers = [];
|
|
18
|
+
this._needsUpdate = new Set();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The number of controllers registered to this host.
|
|
23
|
+
* @type {number}
|
|
24
|
+
* @readonly
|
|
25
|
+
*/
|
|
26
|
+
get controllerCount() {
|
|
27
|
+
return this._controllers.length;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Registers a controller implementation with this host.
|
|
32
|
+
* @param {Controller} controller An implementation of the Controller interface to register with this host.
|
|
33
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
34
|
+
* @param {number} [priority=0] An index, less than or equal to the current count of registed controllers, that defines the precedence of the new controller relative to those previously registered. A priority of <code>0</code> would mean the new controller would apply its updates before any other controller. As subsequent controllers are updated, their effects are applied on top of any previous update effects. If omitted, the new controller becomes the highest priority, i.e., its updates are applied after all other controllers.
|
|
35
|
+
*/
|
|
36
|
+
registerController(controller, element, priority) {
|
|
37
|
+
const index = priority ?? this.controllerCount;
|
|
38
|
+
this._controllers.splice(index, 0, controller);
|
|
39
|
+
this._needsUpdate.add(controller);
|
|
40
|
+
controller.connectedCallback(element);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Unregisters a controller implementation from this host.
|
|
45
|
+
* @param {Controller} controller An implementation of the Controller interface to unregister from this host.
|
|
46
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
47
|
+
*/
|
|
48
|
+
unregisterController(controller, element) {
|
|
49
|
+
const controllers = this._controllers;
|
|
50
|
+
const index = controllers.indexOf(controller);
|
|
51
|
+
if (index !== -1) {
|
|
52
|
+
controllers.splice(index, 1);
|
|
53
|
+
controller.disconnectedCallback(element);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Invoked once per frame by the host scene. Updates all registered controllers in order of their priority.
|
|
59
|
+
* @param {Scene} scene The host scene.
|
|
60
|
+
* @param {JulianDate} time The current simulation time.
|
|
61
|
+
*/
|
|
62
|
+
update(scene, time) {
|
|
63
|
+
for (const controller of this._controllers) {
|
|
64
|
+
if (!controller.enabled) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (this._needsUpdate.has(controller)) {
|
|
69
|
+
controller.firstUpdate(scene, time);
|
|
70
|
+
this._needsUpdate.delete(controller);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
controller.update(scene, time);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default ControllerHost;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import ScreenSpaceElevatorCameraController from "./ScreenSpaceElevatorCameraController.js";
|
|
2
|
+
import ScreenSpaceMapCameraController from "./ScreenSpaceMapCameraController.js";
|
|
3
|
+
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
4
|
+
import CesiumMath from "../../Core/Math.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A contextual camera controller that combines screenspace map panning and screenspace elevator panning. The controller automatically switches between the two based on the camera's angle relative to nadir. If the camera is looking mostly down (within angleThreshold of nadir), <code>ScreenSpaceMapCameraController</code> is used.
|
|
8
|
+
* If the camera is looking towards the horizon (beyond angleThreshold from nadir), the <code>ScreenSpaceElevatorCameraController</code> is used.
|
|
9
|
+
* @implements Controller
|
|
10
|
+
* @example
|
|
11
|
+
* viewer.scene.screenSpaceCameraController.enableInputs = false;
|
|
12
|
+
* viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
|
|
13
|
+
*
|
|
14
|
+
* const hybridController = new HybridScreenSpacePanCameraController();
|
|
15
|
+
* viewer.addController(hybridController);
|
|
16
|
+
*/
|
|
17
|
+
class HybridScreenSpacePanCameraController {
|
|
18
|
+
constructor() {
|
|
19
|
+
this._elevatorController = new ScreenSpaceElevatorCameraController();
|
|
20
|
+
this._mapController = new ScreenSpaceMapCameraController();
|
|
21
|
+
|
|
22
|
+
this._enabled = true;
|
|
23
|
+
this._ellipsoidNormal = new Cartesian3();
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The angle threshold in radians that determines which controller is used. If the camera is looking within this angle of nadir, the map controller is used. Otherwise, the elevator controller is used.
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @default CesiumMath.toRadians(125)
|
|
29
|
+
*/
|
|
30
|
+
this.angleThreshold = CesiumMath.toRadians(125);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get enabled() {
|
|
34
|
+
return this._enabled;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
set enabled(value) {
|
|
38
|
+
this._enabled = value;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The controller that is used when the camera is looking more horizontally (beyond angleThreshold from nadir).
|
|
43
|
+
* @type {ScreenSpaceElevatorCameraController}
|
|
44
|
+
* @readonly
|
|
45
|
+
*/
|
|
46
|
+
get elevatorController() {
|
|
47
|
+
return this._elevatorController;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The controller that is used when the camera is looking mostly down (within angleThreshold of nadir).
|
|
52
|
+
* @type {ScreenSpaceMapCameraController}
|
|
53
|
+
* @readonly
|
|
54
|
+
*/
|
|
55
|
+
get mapController() {
|
|
56
|
+
return this._mapController;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @inheritdoc
|
|
61
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
62
|
+
*/
|
|
63
|
+
connectedCallback(element) {
|
|
64
|
+
this._elevatorController.connectedCallback(element);
|
|
65
|
+
this._mapController.connectedCallback(element);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @inheritdoc
|
|
70
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
71
|
+
*/
|
|
72
|
+
disconnectedCallback(element) {
|
|
73
|
+
this._elevatorController.disconnectedCallback(element);
|
|
74
|
+
this._mapController.disconnectedCallback(element);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @inheritdoc
|
|
79
|
+
*/
|
|
80
|
+
firstUpdate() {
|
|
81
|
+
this._elevatorController.firstUpdate();
|
|
82
|
+
this._mapController.firstUpdate();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @inheritdoc
|
|
87
|
+
* @param {Scene} scene
|
|
88
|
+
*/
|
|
89
|
+
update(scene) {
|
|
90
|
+
const camera = scene.camera;
|
|
91
|
+
const normal = scene.ellipsoid.geodeticSurfaceNormal(
|
|
92
|
+
camera.positionWC,
|
|
93
|
+
this._ellipsoidNormal,
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
const angle = Math.abs(Cartesian3.angleBetween(normal, camera.directionWC));
|
|
97
|
+
const activeController =
|
|
98
|
+
angle < this.angleThreshold && angle > Math.PI - this.angleThreshold
|
|
99
|
+
? this._elevatorController
|
|
100
|
+
: this._mapController;
|
|
101
|
+
|
|
102
|
+
activeController.update(scene);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default HybridScreenSpacePanCameraController;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This enumerated type is for classifying mouse buttons: left, middle, and right.
|
|
5
|
+
* @enum {number}
|
|
6
|
+
*/
|
|
7
|
+
const MouseButton = {
|
|
8
|
+
/**
|
|
9
|
+
* Represents a mouse left button.
|
|
10
|
+
* @type {number}
|
|
11
|
+
* @constant
|
|
12
|
+
*/
|
|
13
|
+
LEFT: 0,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents a mouse middle button.
|
|
17
|
+
* @type {number}
|
|
18
|
+
* @constant
|
|
19
|
+
*/
|
|
20
|
+
MIDDLE: 1,
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Represents a mouse right button.
|
|
24
|
+
* @type {number}
|
|
25
|
+
* @constant
|
|
26
|
+
*/
|
|
27
|
+
RIGHT: 2,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
Object.freeze(MouseButton);
|
|
31
|
+
|
|
32
|
+
export default MouseButton;
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import Cartesian2 from "../../Core/Cartesian2.js";
|
|
2
|
+
import Cartesian3 from "../../Core/Cartesian3.js";
|
|
3
|
+
import defined from "../../Core/defined.js";
|
|
4
|
+
import Frozen from "../../Core/Frozen.js";
|
|
5
|
+
import getTimestamp from "../../Core/getTimestamp.js";
|
|
6
|
+
import CesiumMath from "../../Core/Math.js";
|
|
7
|
+
import ScreenSpaceEventHandler from "../../Core/ScreenSpaceEventHandler.js";
|
|
8
|
+
import TimeConstants from "../../Core/TimeConstants.js";
|
|
9
|
+
import defaultPickWorldPosition from "./defaultPickWorldPosition.js";
|
|
10
|
+
import ScreenSpaceInputBindings from "./ScreenSpaceInputBindings.js";
|
|
11
|
+
import MouseButton from "./MouseButton.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {object} ControllerOptions
|
|
15
|
+
* @memberof ScreenSpaceElevatorCameraController
|
|
16
|
+
* @property {ScreenSpaceInputBindings.InputBinding[]} [dragInputs] The drag input bindings that control panning.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A camera controller that allows panning the camera tangential to the ellipsoid, i.e., up and down relative to the ellipsoid normal, in screen space
|
|
21
|
+
* by clicking and dragging the mouse.
|
|
22
|
+
* @class
|
|
23
|
+
* @implements Controller
|
|
24
|
+
* @example
|
|
25
|
+
* viewer.scene.screenSpaceCameraController.enableInputs = false;
|
|
26
|
+
* viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
|
|
27
|
+
*
|
|
28
|
+
* const elevatorCameraController = new Cesium.ScreenSpaceElevatorCameraController();
|
|
29
|
+
* viewer.addController(elevatorCameraController);
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Configure the controller to use the right mouse button for panning instead of the default left mouse button.
|
|
33
|
+
* const elevatorCameraController = new Cesium.ScreenSpaceElevatorCameraController({
|
|
34
|
+
* dragInputs: [{ button: Cesium.MouseButton.RIGHT}]
|
|
35
|
+
* });
|
|
36
|
+
* viewer.addController(elevatorCameraController);
|
|
37
|
+
*/
|
|
38
|
+
class ScreenSpaceElevatorCameraController {
|
|
39
|
+
/**
|
|
40
|
+
* @private
|
|
41
|
+
* @returns {ScreenSpaceInputBindings.InputBinding[]} The default drag input bindings.
|
|
42
|
+
*/
|
|
43
|
+
static _getDefaultDragInputs() {
|
|
44
|
+
return [
|
|
45
|
+
Object.freeze({
|
|
46
|
+
button: MouseButton.LEFT,
|
|
47
|
+
}),
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Creates an instance of a ScreenSpaceElevatorCameraController.
|
|
53
|
+
* @param {ScreenSpaceElevatorCameraController.ControllerOptions} [options] The options for configuring the controller.
|
|
54
|
+
*/
|
|
55
|
+
constructor(options = Frozen.EMPTY_OBJECT) {
|
|
56
|
+
this._enabled = true;
|
|
57
|
+
this._handler = undefined;
|
|
58
|
+
this._lastUpdateTime = undefined;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The drag input bindings that control vertical panning. Each binding is a combination of the mouse button
|
|
62
|
+
* and an optional keyboard modifier.
|
|
63
|
+
* @type {ScreenSpaceInputBindings.InputBinding[]}
|
|
64
|
+
* @see ScreenSpaceEventHandler
|
|
65
|
+
*/
|
|
66
|
+
this.dragInputs =
|
|
67
|
+
options.dragInputs ??
|
|
68
|
+
ScreenSpaceElevatorCameraController._getDefaultDragInputs();
|
|
69
|
+
|
|
70
|
+
this._dragInputState = undefined;
|
|
71
|
+
this._panDelta = new Cartesian2();
|
|
72
|
+
this._panPosition = new Cartesian2();
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A callback function used to pick the world position from which to pan. The function is called with {@link Scene}, the {@link Cartesian2} screen space position, and a {@link Cartesian3} instance to store the result. The function should return the {@link Cartesian3} world position from which to pan, or <code>undefined</code> if no position could be picked. If <code>undefined</code> is returned, the camera will pan relative to the ellipsoid surface below the camera.
|
|
76
|
+
* @type {Function(Scene, Cartesian2, Cartesian3): Cartesian3|undefined}
|
|
77
|
+
* @default defaultPickWorldPosition
|
|
78
|
+
* @example
|
|
79
|
+
* const elevatorCameraController = new Cesium.ScreenSpaceElevatorCameraController();
|
|
80
|
+
* elevatorCameraController.pickWorldPosition = function (scene, windowPosition, result) {
|
|
81
|
+
* // Pick the world position from the depth buffer
|
|
82
|
+
* return scene.pickPosition(windowPosition, result);
|
|
83
|
+
* };
|
|
84
|
+
* viewer.addController(elevatorCameraController);
|
|
85
|
+
*/
|
|
86
|
+
this.pickWorldPosition = defaultPickWorldPosition;
|
|
87
|
+
|
|
88
|
+
this._ellipsoidNormal = new Cartesian3();
|
|
89
|
+
this._ellipsoidSurfacePosition = new Cartesian3();
|
|
90
|
+
this._panDirectionX = new Cartesian3();
|
|
91
|
+
this._panDirectionY = new Cartesian3();
|
|
92
|
+
this._pixelSize = new Cartesian2();
|
|
93
|
+
this._panVelocity = new Cartesian2();
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The speed in meters per pixel at which the camera pans.
|
|
97
|
+
* @type {number}
|
|
98
|
+
* @default 1.0
|
|
99
|
+
*/
|
|
100
|
+
this.panSpeed = 1.0;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Enable or disable inertia when panning. When enabled, the camera will continue to move after the user stops dragging, gradually slowing down based on {@link ScreenSpaceMapCameraController#inertialDecay}.
|
|
104
|
+
* @type {boolean}
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
this.inertiaEnabled = true;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The rate at which the camera's pan velocity decays over time.
|
|
111
|
+
* @type {number}
|
|
112
|
+
* @default 6.0
|
|
113
|
+
*/
|
|
114
|
+
this.inertialDecay = 6.0;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* A parameter in the range <code>[0, 1)</code> used to limit the range
|
|
118
|
+
* of inputs to a percentage of the window width/height per animation frame.
|
|
119
|
+
* This helps keep the camera under control in low-frame-rate situations.
|
|
120
|
+
* @type {number}
|
|
121
|
+
* @default 0.1
|
|
122
|
+
*/
|
|
123
|
+
this.maximumMovementRatio = 0.1;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @inheritdoc
|
|
128
|
+
*/
|
|
129
|
+
get enabled() {
|
|
130
|
+
return this._enabled;
|
|
131
|
+
}
|
|
132
|
+
set enabled(value) {
|
|
133
|
+
this._enabled = value;
|
|
134
|
+
|
|
135
|
+
if (value) {
|
|
136
|
+
this._lastUpdateTime = getTimestamp();
|
|
137
|
+
this._panDelta.x = 0;
|
|
138
|
+
this._panDelta.y = 0;
|
|
139
|
+
} else if (defined(this._dragInputState)) {
|
|
140
|
+
this._dragInputState.isDragging = false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
* @type {boolean}
|
|
147
|
+
*/
|
|
148
|
+
get isDragging() {
|
|
149
|
+
return defined(this._dragInputState) && this._dragInputState.isDragging;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @inheritdoc
|
|
154
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
155
|
+
*/
|
|
156
|
+
connectedCallback(element) {
|
|
157
|
+
const handler = new ScreenSpaceEventHandler(element);
|
|
158
|
+
this._handler = handler;
|
|
159
|
+
|
|
160
|
+
this._dragInputState = ScreenSpaceInputBindings.registerDragInputBindings(
|
|
161
|
+
handler,
|
|
162
|
+
this.dragInputs,
|
|
163
|
+
{
|
|
164
|
+
start: this._handleStartPan.bind(this),
|
|
165
|
+
change: this._handlePan.bind(this),
|
|
166
|
+
},
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @inheritdoc
|
|
172
|
+
* @param {HTMLElement} element The DOM element containing the Cesium scene.
|
|
173
|
+
*/
|
|
174
|
+
disconnectedCallback(element) {
|
|
175
|
+
const handler = this._handler;
|
|
176
|
+
if (defined(handler) && !handler.isDestroyed()) {
|
|
177
|
+
handler.destroy();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @inheritdoc
|
|
183
|
+
*/
|
|
184
|
+
firstUpdate() {
|
|
185
|
+
this._lastUpdateTime = getTimestamp();
|
|
186
|
+
this._panDelta.x = 0;
|
|
187
|
+
this._panDelta.y = 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @inheritdoc
|
|
192
|
+
* @param {any} scene
|
|
193
|
+
*/
|
|
194
|
+
update(scene) {
|
|
195
|
+
const dt =
|
|
196
|
+
(getTimestamp() - this._lastUpdateTime) *
|
|
197
|
+
TimeConstants.SECONDS_PER_MILLISECOND;
|
|
198
|
+
|
|
199
|
+
const { camera, ellipsoid, canvas } = scene;
|
|
200
|
+
|
|
201
|
+
let dx = -this._panDelta.x;
|
|
202
|
+
let dy = this._panDelta.y;
|
|
203
|
+
|
|
204
|
+
if (this.inertiaEnabled && !this.isDragging) {
|
|
205
|
+
const damping = Math.exp(-this.inertialDecay * dt);
|
|
206
|
+
this._panVelocity.x *= damping;
|
|
207
|
+
this._panVelocity.y *= damping;
|
|
208
|
+
|
|
209
|
+
dx = this._panVelocity.x * dt;
|
|
210
|
+
dy = this._panVelocity.y * dt;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const { clientWidth, clientHeight } = canvas;
|
|
214
|
+
if (
|
|
215
|
+
dt === 0 ||
|
|
216
|
+
clientWidth === 0 ||
|
|
217
|
+
clientHeight === 0 ||
|
|
218
|
+
(Math.abs(dx) <= CesiumMath.EPSILON3 &&
|
|
219
|
+
Math.abs(dy) <= CesiumMath.EPSILON3)
|
|
220
|
+
) {
|
|
221
|
+
// Reset for next frame
|
|
222
|
+
this._lastUpdateTime = getTimestamp();
|
|
223
|
+
this._panDelta.x = 0;
|
|
224
|
+
this._panDelta.y = 0;
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const windowPosition = this._panPosition;
|
|
229
|
+
let surface = this.pickWorldPosition(
|
|
230
|
+
scene,
|
|
231
|
+
windowPosition,
|
|
232
|
+
this._ellipsoidSurfacePosition,
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
if (!defined(surface)) {
|
|
236
|
+
surface = ellipsoid.scaleToGeodeticSurface(
|
|
237
|
+
camera.positionWC,
|
|
238
|
+
this._ellipsoidSurfacePosition,
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
let xAxis = Cartesian3.clone(camera.rightWC, this._panDirectionX);
|
|
243
|
+
xAxis = Cartesian3.normalize(xAxis, this._panDirectionX);
|
|
244
|
+
const zAxis = Cartesian3.normalize(surface, this._panDirectionY);
|
|
245
|
+
|
|
246
|
+
const distance = Cartesian3.distance(camera.positionWC, surface);
|
|
247
|
+
const { drawingBufferWidth, drawingBufferHeight, pixelRatio } = scene;
|
|
248
|
+
const pixelSize = camera.frustum.getPixelDimensions(
|
|
249
|
+
drawingBufferWidth,
|
|
250
|
+
drawingBufferHeight,
|
|
251
|
+
distance,
|
|
252
|
+
pixelRatio,
|
|
253
|
+
this._pixelSize,
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const maxPixels =
|
|
257
|
+
this.maximumMovementRatio * Math.max(clientWidth, clientHeight);
|
|
258
|
+
dx = CesiumMath.clamp(dx, -maxPixels, maxPixels);
|
|
259
|
+
this._panVelocity.x = dx / dt;
|
|
260
|
+
dx *= this.panSpeed * pixelSize.x;
|
|
261
|
+
|
|
262
|
+
dy = CesiumMath.clamp(dy, -maxPixels, maxPixels);
|
|
263
|
+
this._panVelocity.y = dy / dt;
|
|
264
|
+
dy *= this.panSpeed * pixelSize.y;
|
|
265
|
+
|
|
266
|
+
camera.move(xAxis, dx);
|
|
267
|
+
camera.move(zAxis, dy);
|
|
268
|
+
|
|
269
|
+
// Reset for next frame
|
|
270
|
+
this._lastUpdateTime = getTimestamp();
|
|
271
|
+
this._panDelta.x = 0;
|
|
272
|
+
this._panDelta.y = 0;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
_handleStartPan() {
|
|
276
|
+
if (!this.enabled) {
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
this._panDelta.x = 0;
|
|
281
|
+
this._panDelta.y = 0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @private
|
|
286
|
+
*/
|
|
287
|
+
_handlePan(event) {
|
|
288
|
+
this._panDelta.x += event.endPosition.x - event.startPosition.x;
|
|
289
|
+
this._panDelta.y += event.endPosition.y - event.startPosition.y;
|
|
290
|
+
this._panPosition.x = event.endPosition.x;
|
|
291
|
+
this._panPosition.y = event.endPosition.y;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export default ScreenSpaceElevatorCameraController;
|