@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
|
@@ -1719,20 +1719,25 @@ function createCastDerivedCommand(
|
|
|
1719
1719
|
const isPointLight = shadowMap._isPointLight;
|
|
1720
1720
|
const usesDepthTexture = shadowMap._usesDepthTexture;
|
|
1721
1721
|
|
|
1722
|
+
const vertexShaderSource = shaderProgram.vertexShaderSource;
|
|
1723
|
+
const fragmentShaderSource = shaderProgram.fragmentShaderSource;
|
|
1724
|
+
|
|
1725
|
+
const hasClipping =
|
|
1726
|
+
isOpaque &&
|
|
1727
|
+
ShadowMapShader.hasClippingForShadowCast(fragmentShaderSource);
|
|
1728
|
+
|
|
1722
1729
|
const keyword = ShadowMapShader.getShadowCastShaderKeyword(
|
|
1723
1730
|
isPointLight,
|
|
1724
1731
|
isTerrain,
|
|
1725
1732
|
usesDepthTexture,
|
|
1726
1733
|
isOpaque,
|
|
1734
|
+
hasClipping,
|
|
1727
1735
|
);
|
|
1728
1736
|
castShader = context.shaderCache.getDerivedShaderProgram(
|
|
1729
1737
|
shaderProgram,
|
|
1730
1738
|
keyword,
|
|
1731
1739
|
);
|
|
1732
1740
|
if (!defined(castShader)) {
|
|
1733
|
-
const vertexShaderSource = shaderProgram.vertexShaderSource;
|
|
1734
|
-
const fragmentShaderSource = shaderProgram.fragmentShaderSource;
|
|
1735
|
-
|
|
1736
1741
|
const castVS = ShadowMapShader.createShadowCastVertexShader(
|
|
1737
1742
|
vertexShaderSource,
|
|
1738
1743
|
isPointLight,
|
|
@@ -1743,6 +1748,7 @@ function createCastDerivedCommand(
|
|
|
1743
1748
|
isPointLight,
|
|
1744
1749
|
usesDepthTexture,
|
|
1745
1750
|
isOpaque,
|
|
1751
|
+
hasClipping,
|
|
1746
1752
|
);
|
|
1747
1753
|
|
|
1748
1754
|
castShader = context.shaderCache.createDerivedShaderProgram(
|
|
@@ -6,13 +6,48 @@ import ShaderSource from "../Renderer/ShaderSource.js";
|
|
|
6
6
|
*/
|
|
7
7
|
function ShadowMapShader() {}
|
|
8
8
|
|
|
9
|
+
const clippingDefines = {
|
|
10
|
+
HAS_CLIPPING_PLANES: true,
|
|
11
|
+
ENABLE_CLIPPING_POLYGONS: true,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns true if the fragment shader clips fragments via a
|
|
16
|
+
* ClippingPlaneCollection or ClippingPolygonCollection, in which case the
|
|
17
|
+
* shadow cast pass must run the original main so that clipped fragments
|
|
18
|
+
* are discarded and do not cast shadows.
|
|
19
|
+
*
|
|
20
|
+
* @param {ShaderSource} fragmentShaderSource
|
|
21
|
+
* @returns {boolean}
|
|
22
|
+
*/
|
|
23
|
+
ShadowMapShader.hasClippingForShadowCast = function (fragmentShaderSource) {
|
|
24
|
+
const defines = fragmentShaderSource.defines;
|
|
25
|
+
return (
|
|
26
|
+
defined(defines) &&
|
|
27
|
+
defines.some(function (define) {
|
|
28
|
+
return clippingDefines[define] === true;
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {boolean} isPointLight
|
|
35
|
+
* @param {boolean} isTerrain
|
|
36
|
+
* @param {boolean} usesDepthTexture
|
|
37
|
+
* @param {boolean} isOpaque
|
|
38
|
+
* @param {boolean} hasClipping True if the fragment shader discards clipped
|
|
39
|
+
* fragments. Differentiates cached shader variants so that a shader that
|
|
40
|
+
* must call czm_shadow_cast_main() is never reused for one that does not.
|
|
41
|
+
* @returns {string}
|
|
42
|
+
*/
|
|
9
43
|
ShadowMapShader.getShadowCastShaderKeyword = function (
|
|
10
44
|
isPointLight,
|
|
11
45
|
isTerrain,
|
|
12
46
|
usesDepthTexture,
|
|
13
47
|
isOpaque,
|
|
48
|
+
hasClipping,
|
|
14
49
|
) {
|
|
15
|
-
return `castShadow ${isPointLight} ${isTerrain} ${usesDepthTexture} ${isOpaque}`;
|
|
50
|
+
return `castShadow ${isPointLight} ${isTerrain} ${usesDepthTexture} ${isOpaque} ${hasClipping}`;
|
|
16
51
|
};
|
|
17
52
|
|
|
18
53
|
ShadowMapShader.createShadowCastVertexShader = function (
|
|
@@ -54,11 +89,22 @@ ShadowMapShader.createShadowCastVertexShader = function (
|
|
|
54
89
|
});
|
|
55
90
|
};
|
|
56
91
|
|
|
92
|
+
/**
|
|
93
|
+
* @param {ShaderSource} fs
|
|
94
|
+
* @param {boolean} isPointLight
|
|
95
|
+
* @param {boolean} usesDepthTexture
|
|
96
|
+
* @param {boolean} opaque
|
|
97
|
+
* @param {boolean} hasClipping True if the fragment shader discards clipped
|
|
98
|
+
* fragments. When true, czm_shadow_cast_main() (the renamed original main)
|
|
99
|
+
* is called first so that clipping discards execute during the shadow cast pass.
|
|
100
|
+
* @returns {ShaderSource}
|
|
101
|
+
*/
|
|
57
102
|
ShadowMapShader.createShadowCastFragmentShader = function (
|
|
58
103
|
fs,
|
|
59
104
|
isPointLight,
|
|
60
105
|
usesDepthTexture,
|
|
61
106
|
opaque,
|
|
107
|
+
hasClipping,
|
|
62
108
|
) {
|
|
63
109
|
const defines = fs.defines.slice(0);
|
|
64
110
|
const sources = fs.sources.slice(0);
|
|
@@ -85,7 +131,9 @@ ShadowMapShader.createShadowCastFragmentShader = function (
|
|
|
85
131
|
fsSource += "uniform vec4 shadowMap_lightPositionEC; \n";
|
|
86
132
|
}
|
|
87
133
|
|
|
88
|
-
if (opaque) {
|
|
134
|
+
if (opaque && hasClipping) {
|
|
135
|
+
fsSource += "void main() \n" + "{ \n" + " czm_shadow_cast_main(); \n";
|
|
136
|
+
} else if (opaque) {
|
|
89
137
|
fsSource += "void main() \n" + "{ \n";
|
|
90
138
|
} else {
|
|
91
139
|
fsSource +=
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import BoundingRectangle from "../Core/BoundingRectangle.js";
|
|
2
|
+
import defined from "../Core/defined.js";
|
|
3
|
+
import destroyObject from "../Core/destroyObject.js";
|
|
4
|
+
import PixelFormat from "../Core/PixelFormat.js";
|
|
5
|
+
import FramebufferManager from "../Renderer/FramebufferManager.js";
|
|
6
|
+
import PassState from "../Renderer/PassState.js";
|
|
7
|
+
import PixelDatatype from "../Renderer/PixelDatatype.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
function SnapFramebuffer(context) {
|
|
13
|
+
const passState = new PassState(context);
|
|
14
|
+
passState.blendingEnabled = false;
|
|
15
|
+
passState.scissorTest = {
|
|
16
|
+
enabled: true,
|
|
17
|
+
rectangle: new BoundingRectangle(),
|
|
18
|
+
};
|
|
19
|
+
passState.viewport = new BoundingRectangle();
|
|
20
|
+
|
|
21
|
+
this._context = context;
|
|
22
|
+
this._fb = new FramebufferManager({
|
|
23
|
+
depthStencil: true,
|
|
24
|
+
pixelDatatype: PixelDatatype.FLOAT,
|
|
25
|
+
pixelFormat: PixelFormat.RGBA,
|
|
26
|
+
});
|
|
27
|
+
this._passState = passState;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getSnapObjectsFromPixels(context, pixels, width, height) {
|
|
31
|
+
const max = Math.max(width, height);
|
|
32
|
+
const length = max * max;
|
|
33
|
+
const halfWidth = Math.floor(width * 0.5);
|
|
34
|
+
const halfHeight = Math.floor(height * 0.5);
|
|
35
|
+
|
|
36
|
+
let x = 0;
|
|
37
|
+
let y = 0;
|
|
38
|
+
let dx = 0;
|
|
39
|
+
let dy = -1;
|
|
40
|
+
|
|
41
|
+
const results = [];
|
|
42
|
+
for (let i = 0; i < length; ++i) {
|
|
43
|
+
if (
|
|
44
|
+
-halfWidth <= x &&
|
|
45
|
+
x <= halfWidth &&
|
|
46
|
+
-halfHeight <= y &&
|
|
47
|
+
y <= halfHeight
|
|
48
|
+
) {
|
|
49
|
+
const index = 4 * ((halfHeight - y) * width + x + halfWidth);
|
|
50
|
+
|
|
51
|
+
const pickColor = pixels[index];
|
|
52
|
+
const object = context.getObjectByPickColor(pickColor);
|
|
53
|
+
if (defined(object)) {
|
|
54
|
+
results.push({
|
|
55
|
+
object: object,
|
|
56
|
+
isEdge: pixels[index + 1] > 0.0,
|
|
57
|
+
depth: pixels[index + 2],
|
|
58
|
+
x: x,
|
|
59
|
+
y: y,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (x === y || (x < 0 && -x === y) || (x > 0 && x === 1 - y)) {
|
|
65
|
+
const temp = dx;
|
|
66
|
+
dx = -dy;
|
|
67
|
+
dy = temp;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
x += dx;
|
|
71
|
+
y += dy;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return results;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
SnapFramebuffer.prototype.begin = function (screenSpaceRectangle, viewport) {
|
|
78
|
+
const context = this._context;
|
|
79
|
+
const { width, height } = viewport;
|
|
80
|
+
|
|
81
|
+
BoundingRectangle.clone(
|
|
82
|
+
screenSpaceRectangle,
|
|
83
|
+
this._passState.scissorTest.rectangle,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
this._fb.update(context, width, height);
|
|
87
|
+
this._passState.framebuffer = this._fb.framebuffer;
|
|
88
|
+
|
|
89
|
+
this._passState.viewport.width = width;
|
|
90
|
+
this._passState.viewport.height = height;
|
|
91
|
+
|
|
92
|
+
return this._passState;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
SnapFramebuffer.prototype.end = function (screenSpaceRectangle) {
|
|
96
|
+
const width = screenSpaceRectangle.width ?? 1.0;
|
|
97
|
+
const height = screenSpaceRectangle.height ?? 1.0;
|
|
98
|
+
|
|
99
|
+
const context = this._context;
|
|
100
|
+
const pixels = context.readPixels({
|
|
101
|
+
x: screenSpaceRectangle.x,
|
|
102
|
+
y: screenSpaceRectangle.y,
|
|
103
|
+
width: width,
|
|
104
|
+
height: height,
|
|
105
|
+
pixelDatatype: PixelDatatype.FLOAT,
|
|
106
|
+
framebuffer: this._fb.framebuffer,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return getSnapObjectsFromPixels(context, pixels, width, height);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
SnapFramebuffer.prototype.isDestroyed = function () {
|
|
113
|
+
return false;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
SnapFramebuffer.prototype.destroy = function () {
|
|
117
|
+
this._fb.destroy();
|
|
118
|
+
return destroyObject(this);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default SnapFramebuffer;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import BoundingRectangle from "../Core/BoundingRectangle.js";
|
|
2
|
+
import Cartesian2 from "../Core/Cartesian2.js";
|
|
3
|
+
import Cartesian3 from "../Core/Cartesian3.js";
|
|
4
|
+
import Check from "../Core/Check.js";
|
|
5
|
+
import defined from "../Core/defined.js";
|
|
6
|
+
import oneTimeWarning from "../Core/oneTimeWarning.js";
|
|
7
|
+
import Ray from "../Core/Ray.js";
|
|
8
|
+
import { pickBegin, pickEnd } from "./Picking.js";
|
|
9
|
+
import SnapFramebuffer from "./SnapFramebuffer.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Implementation of {@link Scene#snap}: snap-to-geometry picking.
|
|
13
|
+
*
|
|
14
|
+
* A snapping pass is an offscreen pick render (it reuses the pick render
|
|
15
|
+
* machinery via <code>pickBegin</code>/<code>pickEnd</code>) that targets a
|
|
16
|
+
* dedicated RGBA32F framebuffer instead of the RGBA8 pick framebuffer. Each
|
|
17
|
+
* pixel carries a fuller payload than a pick color:
|
|
18
|
+
* <ul>
|
|
19
|
+
* <li>R: pick ID (uint32)</li>
|
|
20
|
+
* <li>G: isEdge flag (0.0/1.0)</li>
|
|
21
|
+
* <li>B: linear eye-space depth (meters)</li>
|
|
22
|
+
* <li>A: unused</li>
|
|
23
|
+
* </ul>
|
|
24
|
+
* The payload expression is built in PickingPipelineStage (DrawCommand.snapId)
|
|
25
|
+
* and compiled into a snap-derived shader by
|
|
26
|
+
* DerivedCommand.createSnapDerivedCommand. Only commands with a
|
|
27
|
+
* <code>snapId</code> (i.e. Model-pipeline primitives) render during a
|
|
28
|
+
* snapping pass.
|
|
29
|
+
*
|
|
30
|
+
* @namespace Snapping
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
const Snapping = {};
|
|
35
|
+
|
|
36
|
+
const scratchRectangle = new BoundingRectangle(0.0, 0.0, 3.0, 3.0);
|
|
37
|
+
const scratchSnapCoord = new Cartesian2();
|
|
38
|
+
const scratchSurfaceCoord = new Cartesian2();
|
|
39
|
+
const scratchSnapRay = new Ray();
|
|
40
|
+
const scratchSnapOffset = new Cartesian3();
|
|
41
|
+
|
|
42
|
+
// Radius around the crosshair, in pixels, used to sample the nearest surface
|
|
43
|
+
// (the occluder the cursor is on).
|
|
44
|
+
const SNAP_OCCLUDER_RADIUS_PIXELS = 3.0;
|
|
45
|
+
|
|
46
|
+
// An edge more than this fraction deeper than that surface is treated as
|
|
47
|
+
// occluded by it (the edge is only visible because it pokes through a gap in a
|
|
48
|
+
// nearer silhouette), so snap doesn't punch through to geometry behind the
|
|
49
|
+
// object the cursor is on.
|
|
50
|
+
const SNAP_OCCLUSION_TOLERANCE = 0.1;
|
|
51
|
+
|
|
52
|
+
// Width of the region, centered on a winning edge hit, read to find the
|
|
53
|
+
// adjacent surface fragment for surfacePosition. Deliberately centered on the
|
|
54
|
+
// edge hit rather than the cursor: the cursor-centered snap region can clip
|
|
55
|
+
// away the object's surface, potentially causing the server-side backend to
|
|
56
|
+
// give a mismatched snap.
|
|
57
|
+
const SNAP_SURFACE_REGION_WIDTH = 9.0;
|
|
58
|
+
|
|
59
|
+
function cursorDist(hit) {
|
|
60
|
+
return Math.sqrt(hit.x * hit.x + hit.y * hit.y);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function selectBestHit(hits) {
|
|
64
|
+
// Depth of the nearest surface under the crosshair; edges well behind it are
|
|
65
|
+
// occluded by the object the cursor is on and must not win.
|
|
66
|
+
let occluderDepth = Number.POSITIVE_INFINITY;
|
|
67
|
+
for (const hit of hits) {
|
|
68
|
+
if (!hit.isEdge && cursorDist(hit) <= SNAP_OCCLUDER_RADIUS_PIXELS) {
|
|
69
|
+
occluderDepth = Math.min(occluderDepth, hit.depth);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const maxEdgeDepth = occluderDepth * (1.0 + SNAP_OCCLUSION_TOLERANCE);
|
|
73
|
+
|
|
74
|
+
// Edges outrank surfaces, but only edges in front of (or at) the occluder;
|
|
75
|
+
// otherwise fall back to the closest surface. Within the chosen group the
|
|
76
|
+
// hit closest to the crosshair wins.
|
|
77
|
+
const visible = hits.filter(
|
|
78
|
+
(hit) => !hit.isEdge || hit.depth <= maxEdgeDepth,
|
|
79
|
+
);
|
|
80
|
+
const wantEdge = visible.some((hit) => hit.isEdge);
|
|
81
|
+
const group = visible.filter((hit) => hit.isEdge === wantEdge);
|
|
82
|
+
return group.reduce((best, hit) =>
|
|
83
|
+
cursorDist(hit) < cursorDist(best) ? hit : best,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Find the surface hit belonging to the same object that lies closest to the
|
|
88
|
+
// region center, if any. Unlike an edge hit, whose position lies exactly on
|
|
89
|
+
// the object's silhouette, this point is unambiguously on the object.
|
|
90
|
+
function nearestSurfaceHit(hits, object) {
|
|
91
|
+
let best;
|
|
92
|
+
let bestDist = Number.POSITIVE_INFINITY;
|
|
93
|
+
for (const hit of hits) {
|
|
94
|
+
if (hit.isEdge || hit.object !== object) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const dist = hit.x * hit.x + hit.y * hit.y;
|
|
98
|
+
if (dist < bestDist) {
|
|
99
|
+
best = hit;
|
|
100
|
+
bestDist = dist;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return best;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Unproject a snap hit's eye-space depth (channel B of the snap framebuffer,
|
|
107
|
+
// written by the snap shader at the edge fragment itself) into a world
|
|
108
|
+
// position.
|
|
109
|
+
function snapHitToWorld(scene, windowPosition, hit) {
|
|
110
|
+
const coords = scratchSnapCoord;
|
|
111
|
+
coords.x = windowPosition.x + hit.x;
|
|
112
|
+
coords.y = windowPosition.y + hit.y;
|
|
113
|
+
|
|
114
|
+
const ray = scene.camera.getPickRay(coords, scratchSnapRay);
|
|
115
|
+
if (!defined(ray)) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// hit.depth is perpendicular distance from the camera plane along the view
|
|
120
|
+
// direction; convert to distance along the (non-axis-aligned) pick ray.
|
|
121
|
+
const cos = Cartesian3.dot(ray.direction, scene.camera.directionWC);
|
|
122
|
+
if (cos <= 0.0) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const t = hit.depth / cos;
|
|
126
|
+
|
|
127
|
+
const offset = Cartesian3.multiplyByScalar(
|
|
128
|
+
ray.direction,
|
|
129
|
+
t,
|
|
130
|
+
scratchSnapOffset,
|
|
131
|
+
);
|
|
132
|
+
return Cartesian3.add(ray.origin, offset, new Cartesian3());
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Returns the best snap target in a screen-space region around
|
|
137
|
+
* <code>windowPosition</code>. See {@link Scene#snap} for the public API.
|
|
138
|
+
*
|
|
139
|
+
* @param {Scene} scene
|
|
140
|
+
* @param {Cartesian2} windowPosition Window coordinates at the center of the search region.
|
|
141
|
+
* @param {object} [options] Object with the following properties:
|
|
142
|
+
* @param {number} [options.width=25] Width of the search region in pixels.
|
|
143
|
+
* @param {number} [options.height=options.width] Height of the search region in pixels.
|
|
144
|
+
* @returns {SceneSnapResult | undefined}
|
|
145
|
+
*
|
|
146
|
+
* @private
|
|
147
|
+
*/
|
|
148
|
+
Snapping.snap = function (scene, windowPosition, options) {
|
|
149
|
+
//>>includeStart('debug', pragmas.debug);
|
|
150
|
+
Check.defined("windowPosition", windowPosition);
|
|
151
|
+
//>>includeEnd('debug');
|
|
152
|
+
|
|
153
|
+
const width = options?.width ?? 25;
|
|
154
|
+
const height = options?.height ?? width;
|
|
155
|
+
|
|
156
|
+
const { context, defaultView } = scene;
|
|
157
|
+
|
|
158
|
+
// The snap framebuffer is RGBA32F; rendering to it requires float color
|
|
159
|
+
// attachment support.
|
|
160
|
+
if (!context.colorBufferFloat) {
|
|
161
|
+
oneTimeWarning(
|
|
162
|
+
"snap-color-buffer-float",
|
|
163
|
+
"Scene.snap requires the EXT_color_buffer_float extension, which is not supported on this platform.",
|
|
164
|
+
);
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Created lazily so applications that never snap pay no framebuffer cost.
|
|
169
|
+
if (!defined(defaultView.snapFramebuffer)) {
|
|
170
|
+
defaultView.snapFramebuffer = new SnapFramebuffer(context);
|
|
171
|
+
}
|
|
172
|
+
const snapFramebuffer = defaultView.snapFramebuffer;
|
|
173
|
+
|
|
174
|
+
const drawingBufferRectangle = scratchRectangle;
|
|
175
|
+
pickBegin(scene, windowPosition, drawingBufferRectangle, width, height, {
|
|
176
|
+
framebuffer: snapFramebuffer,
|
|
177
|
+
snap: true,
|
|
178
|
+
});
|
|
179
|
+
const hits = snapFramebuffer.end(drawingBufferRectangle);
|
|
180
|
+
pickEnd(scene);
|
|
181
|
+
|
|
182
|
+
if (hits.length === 0) {
|
|
183
|
+
return undefined;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const best = selectBestHit(hits);
|
|
187
|
+
if (!defined(best)) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const position = snapHitToWorld(scene, windowPosition, best);
|
|
192
|
+
if (!defined(position)) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// For edge hits, also unproject the nearest same-object surface fragment so
|
|
197
|
+
// consumers have a seed point that is on the object but off its silhouette.
|
|
198
|
+
// Found with a read centered on the edge hit itself, so the seed does not
|
|
199
|
+
// depend on where in the snap region the cursor was.
|
|
200
|
+
let surfacePosition = position;
|
|
201
|
+
if (best.isEdge) {
|
|
202
|
+
const surfaceOrigin = scratchSurfaceCoord;
|
|
203
|
+
surfaceOrigin.x = windowPosition.x + best.x;
|
|
204
|
+
surfaceOrigin.y = windowPosition.y + best.y;
|
|
205
|
+
pickBegin(
|
|
206
|
+
scene,
|
|
207
|
+
surfaceOrigin,
|
|
208
|
+
drawingBufferRectangle,
|
|
209
|
+
SNAP_SURFACE_REGION_WIDTH,
|
|
210
|
+
SNAP_SURFACE_REGION_WIDTH,
|
|
211
|
+
{
|
|
212
|
+
framebuffer: snapFramebuffer,
|
|
213
|
+
snap: true,
|
|
214
|
+
},
|
|
215
|
+
);
|
|
216
|
+
const surfaceHits = snapFramebuffer.end(drawingBufferRectangle);
|
|
217
|
+
pickEnd(scene);
|
|
218
|
+
const surfaceHit = nearestSurfaceHit(surfaceHits, best.object);
|
|
219
|
+
surfacePosition = defined(surfaceHit)
|
|
220
|
+
? snapHitToWorld(scene, surfaceOrigin, surfaceHit)
|
|
221
|
+
: undefined;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
object: best.object,
|
|
226
|
+
isEdge: best.isEdge,
|
|
227
|
+
position: position,
|
|
228
|
+
surfacePosition: surfacePosition,
|
|
229
|
+
screenPosition: new Cartesian2(
|
|
230
|
+
windowPosition.x + best.x,
|
|
231
|
+
windowPosition.y + best.y,
|
|
232
|
+
),
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// Exposed for testing.
|
|
237
|
+
Snapping._selectBestHit = selectBestHit;
|
|
238
|
+
Snapping._nearestSurfaceHit = nearestSurfaceHit;
|
|
239
|
+
Snapping._snapHitToWorld = snapHitToWorld;
|
|
240
|
+
|
|
241
|
+
export default Snapping;
|
|
@@ -823,6 +823,7 @@ function createFillMesh(tileProvider, frameState, tile, vertexArraysToDestroy) {
|
|
|
823
823
|
GlobeSurfaceTile.initialize(
|
|
824
824
|
tile,
|
|
825
825
|
tileProvider.terrainProvider,
|
|
826
|
+
tileProvider.vectorProvider,
|
|
826
827
|
tileProvider._imageryLayers,
|
|
827
828
|
);
|
|
828
829
|
|
|
@@ -1243,7 +1244,7 @@ function createFillMesh(tileProvider, frameState, tile, vertexArraysToDestroy) {
|
|
|
1243
1244
|
|
|
1244
1245
|
indices[indexOut++] = centerIndex;
|
|
1245
1246
|
indices[indexOut++] = i;
|
|
1246
|
-
indices[indexOut
|
|
1247
|
+
indices[indexOut] = 0;
|
|
1247
1248
|
|
|
1248
1249
|
const westIndicesSouthToNorth = [];
|
|
1249
1250
|
for (i = southwestIndex; i >= northwestIndex; --i) {
|
|
@@ -1800,7 +1801,7 @@ function addEdgeMesh(
|
|
|
1800
1801
|
heightRange,
|
|
1801
1802
|
) {
|
|
1802
1803
|
// Handle copying edges across the anti-meridian.
|
|
1803
|
-
let sourceRectangle
|
|
1804
|
+
let sourceRectangle;
|
|
1804
1805
|
if (tileEdge === TileEdge.EAST && terrainFillMesh.tile.x === 0) {
|
|
1805
1806
|
sourceRectangle = Rectangle.clone(
|
|
1806
1807
|
edgeTile.rectangle,
|
|
@@ -13,7 +13,9 @@ import destroyObject from "../Core/destroyObject.js";
|
|
|
13
13
|
import CesiumMath from "../Core/Math.js";
|
|
14
14
|
|
|
15
15
|
/** @import FrameState from "./FrameState.js"; */
|
|
16
|
+
/** @import HeightReference from "./HeightReference.js"; */
|
|
16
17
|
/** @import PassState from "../Renderer/PassState.js"; */
|
|
18
|
+
/** @import Scene from "./Scene.js"; */
|
|
17
19
|
/** @import TilingScheme from "../Core/TilingScheme.js"; */
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -41,7 +43,7 @@ const scratchIntersectionRectangle = new Rectangle();
|
|
|
41
43
|
* Base provider for URL-template vector sources that are rendered through a
|
|
42
44
|
* runtime-generated 3D Tiles tileset.
|
|
43
45
|
*
|
|
44
|
-
* @
|
|
46
|
+
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
|
|
45
47
|
*/
|
|
46
48
|
class UrlTemplate3DTilesDataProvider {
|
|
47
49
|
/**
|
|
@@ -51,6 +53,10 @@ class UrlTemplate3DTilesDataProvider {
|
|
|
51
53
|
* @param {number} [options.maxZoom=14] Maximum zoom level represented in the generated tileset.
|
|
52
54
|
* @param {Rectangle} [options.extent] Optional geographic extent in radians to constrain the generated tile tree.
|
|
53
55
|
* @param {string} [options.featureIdProperty] Feature property name to use as feature ID when supported by content decoding.
|
|
56
|
+
* @param {HeightReference} [options.heightReference] Drapes the vector content onto the surfaces selected by the
|
|
57
|
+
* value. Requires <code>options.scene</code>.
|
|
58
|
+
* @param {Scene} [options.scene] The scene the generated tileset is rendered in, required when
|
|
59
|
+
* <code>options.heightReference</code> is a clamping value.
|
|
54
60
|
*/
|
|
55
61
|
constructor(urlTemplate, options) {
|
|
56
62
|
options = options ?? {};
|
|
@@ -61,6 +67,8 @@ class UrlTemplate3DTilesDataProvider {
|
|
|
61
67
|
this._minZoom = options.minZoom ?? DEFAULT_MIN_ZOOM;
|
|
62
68
|
this._maxZoom = options.maxZoom ?? DEFAULT_MAX_ZOOM;
|
|
63
69
|
this._featureIdProperty = options.featureIdProperty;
|
|
70
|
+
this._heightReference = options.heightReference;
|
|
71
|
+
this._scene = options.scene;
|
|
64
72
|
this._show = true;
|
|
65
73
|
this._tileset = undefined;
|
|
66
74
|
this._tilesetJsonUrl = undefined;
|
|
@@ -149,7 +157,10 @@ class UrlTemplate3DTilesDataProvider {
|
|
|
149
157
|
* @returns {object}
|
|
150
158
|
*/
|
|
151
159
|
_createTilesetLoadOptions() {
|
|
152
|
-
return {
|
|
160
|
+
return {
|
|
161
|
+
heightReference: this._heightReference,
|
|
162
|
+
scene: this._scene,
|
|
163
|
+
};
|
|
153
164
|
}
|
|
154
165
|
|
|
155
166
|
/**
|
|
@@ -402,8 +402,8 @@ function initialize(content, arrayBuffer, byteOffset) {
|
|
|
402
402
|
byteOffset += sizeOfUint32;
|
|
403
403
|
const polylinePositionByteLength = view.getUint32(byteOffset, true);
|
|
404
404
|
byteOffset += sizeOfUint32;
|
|
405
|
-
|
|
406
|
-
byteOffset += sizeOfUint32;
|
|
405
|
+
// Ignore pointsPositionByteLength
|
|
406
|
+
byteOffset += sizeOfUint32; // For pointsPositionByteLength
|
|
407
407
|
|
|
408
408
|
const featureTableJson = getJsonFromTypedArray(
|
|
409
409
|
uint8Array,
|
|
@@ -687,7 +687,6 @@ function initialize(content, arrayBuffer, byteOffset) {
|
|
|
687
687
|
byteOffset,
|
|
688
688
|
numberOfPoints * 3,
|
|
689
689
|
);
|
|
690
|
-
byteOffset += pointsPositionByteLength;
|
|
691
690
|
content._points = new Vector3DTilePoints({
|
|
692
691
|
positions: pointPositions,
|
|
693
692
|
batchIds: batchIds.points,
|
|
@@ -14,10 +14,12 @@ import Matrix4 from "../Core/Matrix4.js";
|
|
|
14
14
|
import Model from "./Model/Model.js";
|
|
15
15
|
import ModelUtility from "./Model/ModelUtility.js";
|
|
16
16
|
import Pass from "../Renderer/Pass.js";
|
|
17
|
+
import VectorProvider from "../Core/VectorProvider.js";
|
|
17
18
|
import createVectorTileBuffersFromModelComponents from "./Model/createVectorTileBuffersFromModelComponents.js";
|
|
18
19
|
import defined from "../Core/defined.js";
|
|
19
20
|
import destroyObject from "../Core/destroyObject.js";
|
|
20
21
|
import DeveloperError from "../Core/DeveloperError.js";
|
|
22
|
+
import { isHeightReferenceClamp } from "./HeightReference.js";
|
|
21
23
|
|
|
22
24
|
/** @import BufferPrimitive from "./BufferPrimitive.js"; */
|
|
23
25
|
/** @import BufferPrimitiveCollection from "./BufferPrimitiveCollection.js"; */
|
|
@@ -319,6 +321,9 @@ class VectorGltf3DTileContent {
|
|
|
319
321
|
* @param {FrameState} frameState
|
|
320
322
|
*/
|
|
321
323
|
update(_tileset, frameState) {
|
|
324
|
+
const tileset = this._tileset;
|
|
325
|
+
const vectorProvider = tileset._scene?.vectorProvider;
|
|
326
|
+
|
|
322
327
|
if (defined(this._model) && !this._ready) {
|
|
323
328
|
const model = this._model;
|
|
324
329
|
model.modelMatrix = this._tile.computedTransform;
|
|
@@ -337,13 +342,31 @@ class VectorGltf3DTileContent {
|
|
|
337
342
|
scratchTileModelMatrix,
|
|
338
343
|
);
|
|
339
344
|
|
|
345
|
+
// Only bake collections selected to render this frame (avoids duplicates).
|
|
346
|
+
const isSelected =
|
|
347
|
+
defined(vectorProvider) &&
|
|
348
|
+
this._tile._selectedFrame === frameState.frameNumber;
|
|
349
|
+
|
|
340
350
|
for (let i = 0; i < this._collections.length; i++) {
|
|
351
|
+
const collection = this._collections[i];
|
|
341
352
|
Matrix4.multiplyTransformation(
|
|
342
353
|
scratchTileModelMatrix,
|
|
343
354
|
this._collectionLocalMatrices[i],
|
|
344
|
-
|
|
355
|
+
collection.modelMatrix,
|
|
345
356
|
);
|
|
346
|
-
|
|
357
|
+
|
|
358
|
+
if (
|
|
359
|
+
!isHeightReferenceClamp(tileset._heightReference) ||
|
|
360
|
+
!VectorProvider.isSupported(collection)
|
|
361
|
+
) {
|
|
362
|
+
collection.update(frameState);
|
|
363
|
+
} else if (isSelected) {
|
|
364
|
+
vectorProvider.markForFrame(
|
|
365
|
+
collection,
|
|
366
|
+
frameState.frameNumber,
|
|
367
|
+
tileset._heightReference,
|
|
368
|
+
);
|
|
369
|
+
}
|
|
347
370
|
}
|
|
348
371
|
}
|
|
349
372
|
|
|
@@ -362,9 +385,14 @@ class VectorGltf3DTileContent {
|
|
|
362
385
|
}
|
|
363
386
|
|
|
364
387
|
destroy() {
|
|
388
|
+
const vectorProvider = this._tileset._scene?.vectorProvider;
|
|
389
|
+
|
|
365
390
|
this._model?.destroy();
|
|
366
391
|
this._model = undefined;
|
|
367
|
-
|
|
392
|
+
for (const collection of this._collections) {
|
|
393
|
+
vectorProvider?.remove(collection);
|
|
394
|
+
collection.destroy();
|
|
395
|
+
}
|
|
368
396
|
this._collections.length = 0;
|
|
369
397
|
return destroyObject(this);
|
|
370
398
|
}
|