@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
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
export default "\n\
|
|
3
3
|
precision highp float;\n\
|
|
4
4
|
\n\
|
|
5
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
6
|
+
// BENTLEY_materials_planar_fill constants\n\
|
|
7
|
+
//\n\
|
|
8
|
+
// These factors scale gl_FragDepth AFTER czm_writeLogDepth has run, so\n\
|
|
9
|
+
// they are proportional offsets in log-depth space. The corresponding\n\
|
|
10
|
+
// eye-space offset therefore varies with the fragment's distance from\n\
|
|
11
|
+
// the camera (growing with distance). This is the intended behavior: it\n\
|
|
12
|
+
// matches the proportional depth comparison tolerance used by the edge\n\
|
|
13
|
+
// visibility system, so fills and edges stay consistently ordered at all\n\
|
|
14
|
+
// viewing distances.\n\
|
|
15
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
16
|
+
// Depth pull factor for all planar fills: scales log depth by 0.9995,\n\
|
|
17
|
+
// i.e. a 0.05% pull toward the camera in log-depth space.\n\
|
|
18
|
+
const float PLANAR_DEPTH_PULL = 0.9995;\n\
|
|
19
|
+
// Depth push factor for behind fills: scales log depth by 1.0002, i.e. a\n\
|
|
20
|
+
// 0.02% push away from the camera in log-depth space, so behind fills sit\n\
|
|
21
|
+
// behind same-object siblings.\n\
|
|
22
|
+
const float BEHIND_DEPTH_PUSH = 1.0002;\n\
|
|
23
|
+
// Tolerance for comparing feature IDs stored as floats (integer equality).\n\
|
|
24
|
+
const float FEATURE_ID_TOLERANCE = 0.5;\n\
|
|
25
|
+
// Offset added to feature IDs so 0 means \"no planar fill\" in the texture.\n\
|
|
26
|
+
const float FEATURE_ID_OFFSET = 1.0;\n\
|
|
27
|
+
\n\
|
|
5
28
|
czm_modelMaterial defaultModelMaterial()\n\
|
|
6
29
|
{\n\
|
|
7
30
|
czm_modelMaterial material;\n\
|
|
@@ -41,6 +64,10 @@ void lineStyleStage()\n\
|
|
|
41
64
|
\n\
|
|
42
65
|
SelectedFeature selectedFeature;\n\
|
|
43
66
|
\n\
|
|
67
|
+
// Set by edge-pass fragments below; consumed by the snapId expression built\n\
|
|
68
|
+
// in PickingPipelineStage (see Scene#snap).\n\
|
|
69
|
+
bool isEdge = false;\n\
|
|
70
|
+
\n\
|
|
44
71
|
void main()\n\
|
|
45
72
|
{\n\
|
|
46
73
|
#if defined(PRIMITIVE_TYPE_POINTS) && defined(HAS_POINT_DIAMETER)\n\
|
|
@@ -69,6 +96,26 @@ void main()\n\
|
|
|
69
96
|
\n\
|
|
70
97
|
FeatureIds featureIds;\n\
|
|
71
98
|
featureIdStage(featureIds, attributes);\n\
|
|
99
|
+
\n\
|
|
100
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
101
|
+
// BENTLEY_materials_planar_fill: Feature-ID pre-pass output.\n\
|
|
102
|
+
//\n\
|
|
103
|
+
// When HAS_PLANAR_FILL_ID_PASS is defined this command is being rendered\n\
|
|
104
|
+
// into the planar fill ID framebuffer. Non-behind planar geometry writes\n\
|
|
105
|
+
// its feature ID + 1 into the R channel (0 = no feature) and returns.\n\
|
|
106
|
+
// No material / lighting / post-process stages are needed.\n\
|
|
107
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
108
|
+
#ifdef HAS_PLANAR_FILL_ID_PASS\n\
|
|
109
|
+
if (u_isPlanarFillIdPass) {\n\
|
|
110
|
+
float fid = float(featureIds.PLANAR_FILL_FEATURE_ID) + FEATURE_ID_OFFSET;\n\
|
|
111
|
+
out_FragColor = vec4(fid, 0.0, 0.0, 1.0);\n\
|
|
112
|
+
// Still need to write log depth so the depth buffer is correct.\n\
|
|
113
|
+
#ifdef LOG_DEPTH\n\
|
|
114
|
+
czm_writeLogDepth();\n\
|
|
115
|
+
#endif\n\
|
|
116
|
+
return;\n\
|
|
117
|
+
}\n\
|
|
118
|
+
#endif\n\
|
|
72
119
|
\n\
|
|
73
120
|
Metadata metadata;\n\
|
|
74
121
|
MetadataClass metadataClass;\n\
|
|
@@ -130,6 +177,10 @@ void main()\n\
|
|
|
130
177
|
#ifdef ENABLE_CLIPPING_POLYGONS\n\
|
|
131
178
|
modelClippingPolygonsStage();\n\
|
|
132
179
|
#endif\n\
|
|
180
|
+
\n\
|
|
181
|
+
#ifdef HAS_VECTOR_LOOKUP\n\
|
|
182
|
+
modelVectorLookupStage(color);\n\
|
|
183
|
+
#endif\n\
|
|
133
184
|
\n\
|
|
134
185
|
//========================================================================\n\
|
|
135
186
|
// When not picking metadata START\n\
|
|
@@ -146,6 +197,12 @@ void main()\n\
|
|
|
146
197
|
#ifdef HAS_EDGE_VISIBILITY\n\
|
|
147
198
|
edgeVisibilityStage(color, featureIds);\n\
|
|
148
199
|
edgeDetectionStage(color, featureIds);\n\
|
|
200
|
+
// Edge-pass fragments rasterize the edge band itself. Flag them so the\n\
|
|
201
|
+
// snap payload (see Scene#snap) can distinguish edges from surfaces;\n\
|
|
202
|
+
// surface fragments leave isEdge false.\n\
|
|
203
|
+
if (u_isEdgePass) {\n\
|
|
204
|
+
isEdge = true;\n\
|
|
205
|
+
}\n\
|
|
149
206
|
#endif\n\
|
|
150
207
|
\n\
|
|
151
208
|
#endif\n\
|
|
@@ -153,6 +210,58 @@ void main()\n\
|
|
|
153
210
|
//========================================================================\n\
|
|
154
211
|
\n\
|
|
155
212
|
out_FragColor = color;\n\
|
|
213
|
+
\n\
|
|
214
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
215
|
+
// Explicit log-depth write.\n\
|
|
216
|
+
//\n\
|
|
217
|
+
// DerivedCommand.getLogDepthShaderProgram auto-wraps only when the raw\n\
|
|
218
|
+
// source does NOT already mention czm_writeLogDepth. We mention it\n\
|
|
219
|
+
// above in the HAS_PLANAR_FILL_ID_PASS block, so we must also handle\n\
|
|
220
|
+
// the normal code path ourselves. The LOG_DEPTH define is injected by\n\
|
|
221
|
+
// that same auto-wrapper, so this block is active exactly when needed.\n\
|
|
222
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
223
|
+
#ifdef LOG_DEPTH\n\
|
|
224
|
+
czm_writeLogDepth();\n\
|
|
225
|
+
#endif\n\
|
|
226
|
+
\n\
|
|
227
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
228
|
+
// BENTLEY_materials_planar_fill: Proportional depth adjustment.\n\
|
|
229
|
+
//\n\
|
|
230
|
+
// Per the spec, planar primitives must render in front of non-planar\n\
|
|
231
|
+
// geometry. We use proportional depth scaling (similar to edge visibility)\n\
|
|
232
|
+
// which scales naturally with logarithmic depth at all viewing distances.\n\
|
|
233
|
+
//\n\
|
|
234
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
235
|
+
#ifdef HAS_PLANAR_FILL_DEPTH\n\
|
|
236
|
+
gl_FragDepth *= PLANAR_DEPTH_PULL;\n\
|
|
237
|
+
#endif\n\
|
|
238
|
+
\n\
|
|
239
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
240
|
+
// BENTLEY_materials_planar_fill: Behind fill depth adjustment.\n\
|
|
241
|
+
//\n\
|
|
242
|
+
// After the proportional depth pull has been applied, sample the planar\n\
|
|
243
|
+
// fill ID texture. If the pixel already belongs to the same feature,\n\
|
|
244
|
+
// apply a small proportional push so this \"behind\" fill sits behind its\n\
|
|
245
|
+
// non-behind sibling. If the pixel has no stored feature, the base pull\n\
|
|
246
|
+
// still keeps us in front of non-planar geometry.\n\
|
|
247
|
+
//\n\
|
|
248
|
+
// ──────────────────────────────────────────────────────────────────────\n\
|
|
249
|
+
#ifdef HAS_PLANAR_FILL_BEHIND\n\
|
|
250
|
+
{\n\
|
|
251
|
+
vec2 screenCoord = gl_FragCoord.xy / czm_viewport.zw;\n\
|
|
252
|
+
float storedEncoded = texture(czm_planarFillIdTexture, screenCoord).r;\n\
|
|
253
|
+
float storedFeatureId = storedEncoded - FEATURE_ID_OFFSET;\n\
|
|
254
|
+
float myFeatureId = float(featureIds.PLANAR_FILL_FEATURE_ID);\n\
|
|
255
|
+
\n\
|
|
256
|
+
// storedFeatureId < 0 means \"no planar fill at this pixel\".\n\
|
|
257
|
+
if (storedFeatureId >= 0.0 && abs(storedFeatureId - myFeatureId) < FEATURE_ID_TOLERANCE) {\n\
|
|
258
|
+
// Proportional push: multiply by >1 to move away from camera.\n\
|
|
259
|
+
// Net effect: PLANAR_DEPTH_PULL * BEHIND_DEPTH_PUSH ≈ 0.9997,\n\
|
|
260
|
+
// still in front of non-planar but behind same-feature non-behind fills.\n\
|
|
261
|
+
gl_FragDepth *= BEHIND_DEPTH_PUSH;\n\
|
|
262
|
+
}\n\
|
|
263
|
+
}\n\
|
|
264
|
+
#endif\n\
|
|
156
265
|
}\n\
|
|
157
266
|
\n\
|
|
158
267
|
";
|
|
@@ -110,6 +110,11 @@ void main()
|
|
|
110
110
|
// This returns the value that will be assigned to gl_Position.
|
|
111
111
|
vec4 positionClip = geometryStage(attributes, modelView, normal);
|
|
112
112
|
|
|
113
|
+
// Must go after the geometry stage, which computes v_positionEC.
|
|
114
|
+
#ifdef ENABLE_CLIPPING_POLYGONS
|
|
115
|
+
modelClippingPolygonsStage();
|
|
116
|
+
#endif
|
|
117
|
+
|
|
113
118
|
#if defined(HAS_LINE_CUMULATIVE_DISTANCE) || defined(HAS_LINE_PATTERN)
|
|
114
119
|
lineStyleStageVS(attributes);
|
|
115
120
|
#endif
|
|
@@ -119,8 +124,8 @@ void main()
|
|
|
119
124
|
atmosphereStage(attributes);
|
|
120
125
|
#endif
|
|
121
126
|
|
|
122
|
-
#ifdef
|
|
123
|
-
|
|
127
|
+
#ifdef HAS_VECTOR_LOOKUP
|
|
128
|
+
modelVectorLookupStage(attributes);
|
|
124
129
|
#endif
|
|
125
130
|
|
|
126
131
|
#ifdef HAS_SILHOUETTE
|
|
@@ -110,6 +110,11 @@ void main()\n\
|
|
|
110
110
|
// Compute the final position in each coordinate system needed.\n\
|
|
111
111
|
// This returns the value that will be assigned to gl_Position.\n\
|
|
112
112
|
vec4 positionClip = geometryStage(attributes, modelView, normal);\n\
|
|
113
|
+
\n\
|
|
114
|
+
// Must go after the geometry stage, which computes v_positionEC.\n\
|
|
115
|
+
#ifdef ENABLE_CLIPPING_POLYGONS\n\
|
|
116
|
+
modelClippingPolygonsStage();\n\
|
|
117
|
+
#endif\n\
|
|
113
118
|
\n\
|
|
114
119
|
#if defined(HAS_LINE_CUMULATIVE_DISTANCE) || defined(HAS_LINE_PATTERN)\n\
|
|
115
120
|
lineStyleStageVS(attributes);\n\
|
|
@@ -120,8 +125,8 @@ void main()\n\
|
|
|
120
125
|
atmosphereStage(attributes);\n\
|
|
121
126
|
#endif\n\
|
|
122
127
|
\n\
|
|
123
|
-
#ifdef
|
|
124
|
-
|
|
128
|
+
#ifdef HAS_VECTOR_LOOKUP\n\
|
|
129
|
+
modelVectorLookupStage(attributes);\n\
|
|
125
130
|
#endif\n\
|
|
126
131
|
\n\
|
|
127
132
|
#ifdef HAS_SILHOUETTE\n\
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//This file is automatically rebuilt by the Cesium build process.
|
|
2
|
+
export default "void modelVectorLookupStage(inout vec4 color)\n\
|
|
3
|
+
{\n\
|
|
4
|
+
// Fills composite before strokes. Both no-op against 1x1 placeholder textures.\n\
|
|
5
|
+
color = vectorPolygonRender(v_vectorUv, color);\n\
|
|
6
|
+
color = vectorPolylineRender(v_vectorUv, color);\n\
|
|
7
|
+
}\n\
|
|
8
|
+
";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives each vertex's UV within the rectangle the lookup textures were baked for, where [0,1] spans the rectangle.
|
|
3
|
+
* {@link ModelVectorLookupStageFS.glsl} samples those textures with it.
|
|
4
|
+
*
|
|
5
|
+
* v_positionWC is unusable here: it is 32-bit and too large to resolve a geodetic position precisely, and splitting it
|
|
6
|
+
* into hi/lo components would still not support the trigonometry needed to derive longitude and latitude. Instead,
|
|
7
|
+
* {@link czm_eyeToCartographicDelta} returns a geodetic delta from the camera to the vertex, a small quantity that
|
|
8
|
+
* grows more precise as the camera approaches. Adding it to the camera's own UV, computed on the CPU in double
|
|
9
|
+
* precision, keeps the result precise across the rectangle.
|
|
10
|
+
*/
|
|
11
|
+
void modelVectorLookupStage(ProcessedAttributes attributes)
|
|
12
|
+
{
|
|
13
|
+
vec2 delta = czm_eyeToCartographicDelta(v_positionEC).xy;
|
|
14
|
+
v_vectorUv = u_vectorCameraUv + delta * u_vectorRectangleInverseSize;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//This file is automatically rebuilt by the Cesium build process.
|
|
2
|
+
export default "/**\n\
|
|
3
|
+
* Derives each vertex's UV within the rectangle the lookup textures were baked for, where [0,1] spans the rectangle.\n\
|
|
4
|
+
* {@link ModelVectorLookupStageFS.glsl} samples those textures with it.\n\
|
|
5
|
+
*\n\
|
|
6
|
+
* v_positionWC is unusable here: it is 32-bit and too large to resolve a geodetic position precisely, and splitting it\n\
|
|
7
|
+
* into hi/lo components would still not support the trigonometry needed to derive longitude and latitude. Instead,\n\
|
|
8
|
+
* {@link czm_eyeToCartographicDelta} returns a geodetic delta from the camera to the vertex, a small quantity that\n\
|
|
9
|
+
* grows more precise as the camera approaches. Adding it to the camera's own UV, computed on the CPU in double\n\
|
|
10
|
+
* precision, keeps the result precise across the rectangle.\n\
|
|
11
|
+
*/\n\
|
|
12
|
+
void modelVectorLookupStage(ProcessedAttributes attributes)\n\
|
|
13
|
+
{\n\
|
|
14
|
+
vec2 delta = czm_eyeToCartographicDelta(v_positionEC).xy;\n\
|
|
15
|
+
v_vectorUv = u_vectorCameraUv + delta * u_vectorRectangleInverseSize;\n\
|
|
16
|
+
}\n\
|
|
17
|
+
";
|
|
@@ -12,28 +12,27 @@ void verticalExaggerationStage(
|
|
|
12
12
|
// Uses a circular approximation for the Earth curvature along the geodesic.
|
|
13
13
|
vec3 vertexPositionEC = (czm_modelView * vec4(attributes.positionMC, 1.0)).xyz;
|
|
14
14
|
vec3 centerToVertex = eyeToCenter * czm_eyeEllipsoidNormalEC + vertexPositionEC;
|
|
15
|
-
vec3
|
|
15
|
+
vec3 vertexEllipsoidNormalEC = normalize(centerToVertex);
|
|
16
16
|
|
|
17
|
-
// Estimate the (sine of the) angle between the camera direction and the
|
|
17
|
+
// Estimate the (sine of the) angle between the camera direction and the ellipsoid normal.
|
|
18
18
|
float verticalDistance = dot(vertexPositionEC, czm_eyeEllipsoidNormalEC);
|
|
19
19
|
float horizontalDistance = length(vertexPositionEC - verticalDistance * czm_eyeEllipsoidNormalEC);
|
|
20
20
|
float sinTheta = horizontalDistance / (eyeToCenter + verticalDistance);
|
|
21
21
|
bool isSmallAngle = clamp(sinTheta, 0.0, 0.05) == sinTheta;
|
|
22
22
|
|
|
23
23
|
// Approximate the change in height above the ellipsoid, from camera to vertex position.
|
|
24
|
-
float exactVersine = 1.0 - dot(czm_eyeEllipsoidNormalEC,
|
|
24
|
+
float exactVersine = 1.0 - dot(czm_eyeEllipsoidNormalEC, vertexEllipsoidNormalEC);
|
|
25
25
|
float smallAngleVersine = 0.5 * sinTheta * sinTheta;
|
|
26
26
|
float versine = isSmallAngle ? smallAngleVersine : exactVersine;
|
|
27
|
-
float dHeight = dot(vertexPositionEC,
|
|
27
|
+
float dHeight = dot(vertexPositionEC, vertexEllipsoidNormalEC) - eyeToCenter * versine;
|
|
28
28
|
float vertexHeight = czm_eyeHeight + dHeight;
|
|
29
29
|
|
|
30
|
-
// Transform the approximate
|
|
31
|
-
vec3
|
|
32
|
-
vertexNormalMC = normalize(vertexNormalMC);
|
|
30
|
+
// Transform the approximate ellipsoid normal to model coordinates.
|
|
31
|
+
vec3 exaggerationDirectionScaledMC = (czm_inverseModelView * vec4(vertexEllipsoidNormalEC, 0.0)).xyz;
|
|
33
32
|
|
|
34
|
-
// Compute the exaggeration and apply it along the
|
|
33
|
+
// Compute the exaggeration and apply it along the exaggeration direction in model coordinates.
|
|
35
34
|
float stretch = u_verticalExaggerationAndRelativeHeight.x;
|
|
36
35
|
float shift = u_verticalExaggerationAndRelativeHeight.y;
|
|
37
36
|
float exaggeration = (vertexHeight - shift) * (stretch - 1.0);
|
|
38
|
-
attributes.positionMC += exaggeration *
|
|
39
|
-
}
|
|
37
|
+
attributes.positionMC += exaggeration * exaggerationDirectionScaledMC;
|
|
38
|
+
}
|
|
@@ -13,29 +13,27 @@ export default "void verticalExaggerationStage(\n\
|
|
|
13
13
|
// Uses a circular approximation for the Earth curvature along the geodesic.\n\
|
|
14
14
|
vec3 vertexPositionEC = (czm_modelView * vec4(attributes.positionMC, 1.0)).xyz;\n\
|
|
15
15
|
vec3 centerToVertex = eyeToCenter * czm_eyeEllipsoidNormalEC + vertexPositionEC;\n\
|
|
16
|
-
vec3
|
|
16
|
+
vec3 vertexEllipsoidNormalEC = normalize(centerToVertex);\n\
|
|
17
17
|
\n\
|
|
18
|
-
// Estimate the (sine of the) angle between the camera direction and the
|
|
18
|
+
// Estimate the (sine of the) angle between the camera direction and the ellipsoid normal.\n\
|
|
19
19
|
float verticalDistance = dot(vertexPositionEC, czm_eyeEllipsoidNormalEC);\n\
|
|
20
20
|
float horizontalDistance = length(vertexPositionEC - verticalDistance * czm_eyeEllipsoidNormalEC);\n\
|
|
21
21
|
float sinTheta = horizontalDistance / (eyeToCenter + verticalDistance);\n\
|
|
22
22
|
bool isSmallAngle = clamp(sinTheta, 0.0, 0.05) == sinTheta;\n\
|
|
23
23
|
\n\
|
|
24
24
|
// Approximate the change in height above the ellipsoid, from camera to vertex position.\n\
|
|
25
|
-
float exactVersine = 1.0 - dot(czm_eyeEllipsoidNormalEC,
|
|
25
|
+
float exactVersine = 1.0 - dot(czm_eyeEllipsoidNormalEC, vertexEllipsoidNormalEC);\n\
|
|
26
26
|
float smallAngleVersine = 0.5 * sinTheta * sinTheta;\n\
|
|
27
27
|
float versine = isSmallAngle ? smallAngleVersine : exactVersine;\n\
|
|
28
|
-
float dHeight = dot(vertexPositionEC,
|
|
28
|
+
float dHeight = dot(vertexPositionEC, vertexEllipsoidNormalEC) - eyeToCenter * versine;\n\
|
|
29
29
|
float vertexHeight = czm_eyeHeight + dHeight;\n\
|
|
30
30
|
\n\
|
|
31
|
-
// Transform the approximate
|
|
32
|
-
vec3
|
|
33
|
-
vertexNormalMC = normalize(vertexNormalMC);\n\
|
|
31
|
+
// Transform the approximate ellipsoid normal to model coordinates.\n\
|
|
32
|
+
vec3 exaggerationDirectionScaledMC = (czm_inverseModelView * vec4(vertexEllipsoidNormalEC, 0.0)).xyz;\n\
|
|
34
33
|
\n\
|
|
35
|
-
// Compute the exaggeration and apply it along the
|
|
34
|
+
// Compute the exaggeration and apply it along the exaggeration direction in model coordinates.\n\
|
|
36
35
|
float stretch = u_verticalExaggerationAndRelativeHeight.x;\n\
|
|
37
36
|
float shift = u_verticalExaggerationAndRelativeHeight.y;\n\
|
|
38
37
|
float exaggeration = (vertexHeight - shift) * (stretch - 1.0);\n\
|
|
39
|
-
attributes.positionMC += exaggeration *
|
|
40
|
-
}
|
|
41
|
-
";
|
|
38
|
+
attributes.positionMC += exaggeration * exaggerationDirectionScaledMC;\n\
|
|
39
|
+
}";
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
uniform highp sampler2D u_vectorColorTexture;
|
|
2
|
+
uniform highp sampler2D u_vectorPickColorTexture;
|
|
3
|
+
|
|
4
|
+
// Primitive index of the topmost vector draped over this fragment, or -1 for none.
|
|
5
|
+
int vectorPickPrimitiveIndex = -1;
|
|
6
|
+
|
|
7
|
+
#ifdef HAS_VECTOR_POLYLINES
|
|
8
|
+
uniform highp sampler2D u_vectorSegmentTexture;
|
|
9
|
+
uniform highp sampler2D u_vectorWidthTexture;
|
|
10
|
+
uniform highp sampler2D u_vectorSegmentPrimitiveIndicesTexture;
|
|
11
|
+
uniform highp sampler2D u_vectorGridCellIndicesTexture;
|
|
12
|
+
#ifdef VECTOR_WIDTH_IN_METERS
|
|
13
|
+
// Ground size, in meters, of the tile's UV domain.
|
|
14
|
+
uniform vec2 u_vectorMetersPerUv;
|
|
15
|
+
#endif
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#ifdef HAS_VECTOR_POLYGONS
|
|
19
|
+
uniform highp sampler2D u_vectorPolygonEdgeTexture;
|
|
20
|
+
uniform highp sampler2D u_vectorPolygonEdgePrimitiveIndicesTexture;
|
|
21
|
+
uniform highp sampler2D u_vectorPolygonGridCellIndicesTexture;
|
|
22
|
+
#endif
|
|
23
|
+
|
|
24
|
+
uniform highp sampler2D u_clippingEdgeTexture;
|
|
25
|
+
uniform highp sampler2D u_clippingEdgePrimitiveIndicesTexture;
|
|
26
|
+
uniform highp sampler2D u_clippingGridCellIndicesTexture;
|
|
27
|
+
|
|
28
|
+
// UV-space offset from the closest point on the segment to p.
|
|
29
|
+
vec2 vectorOffsetToLine(vec2 p, vec4 line)
|
|
30
|
+
{
|
|
31
|
+
vec2 a = line.xy;
|
|
32
|
+
vec2 b = line.zw;
|
|
33
|
+
vec2 ab = b - a;
|
|
34
|
+
float abLengthSquared = dot(ab, ab);
|
|
35
|
+
if (abLengthSquared < 1.0e-8)
|
|
36
|
+
{
|
|
37
|
+
return p - a;
|
|
38
|
+
}
|
|
39
|
+
float t = clamp(dot(p - a, ab) / abLengthSquared, 0.0, 1.0);
|
|
40
|
+
return p - (a + t * ab);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
ivec2 vectorIndexToUv(int index, ivec2 size)
|
|
44
|
+
{
|
|
45
|
+
int v = index / size.x;
|
|
46
|
+
int u = index - v * size.x;
|
|
47
|
+
return ivec2(u, v);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Returns [start, end) index range for the grid cell containing uv. An empty
|
|
51
|
+
// range (start == end == 0) means a placeholder grid, so callers loop zero times.
|
|
52
|
+
ivec2 vectorCellRange(vec2 uv, highp sampler2D gridCellIndicesTexture)
|
|
53
|
+
{
|
|
54
|
+
ivec2 headerSize = textureSize(gridCellIndicesTexture, 0);
|
|
55
|
+
if (headerSize.x * headerSize.y < 3)
|
|
56
|
+
{
|
|
57
|
+
return ivec2(0);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
int gridWidth = int(texelFetch(gridCellIndicesTexture, vectorIndexToUv(0, headerSize), 0).r);
|
|
61
|
+
int gridHeight = int(texelFetch(gridCellIndicesTexture, vectorIndexToUv(1, headerSize), 0).r);
|
|
62
|
+
int cellX = clamp(int(uv.x * float(gridWidth)), 0, gridWidth - 1);
|
|
63
|
+
int cellY = clamp(int(uv.y * float(gridHeight)), 0, gridHeight - 1);
|
|
64
|
+
int cellIndex = cellX + cellY * gridWidth;
|
|
65
|
+
|
|
66
|
+
int indexEnd = int(texelFetch(gridCellIndicesTexture, vectorIndexToUv(cellIndex + 2, headerSize), 0).r);
|
|
67
|
+
int indexStart = cellIndex == 0
|
|
68
|
+
? 0
|
|
69
|
+
: int(texelFetch(gridCellIndicesTexture, vectorIndexToUv(cellIndex + 1, headerSize), 0).r);
|
|
70
|
+
|
|
71
|
+
return ivec2(indexStart, indexEnd);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#ifdef VECTOR_ANTIALIAS
|
|
75
|
+
// Half-pixel band across a line's edge over which coverage fades.
|
|
76
|
+
const float vectorCoverageRadius = 0.5;
|
|
77
|
+
#else
|
|
78
|
+
const float vectorCoverageRadius = 0.0;
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
// Drape vector polylines onto the terrain surface. The fragment's
|
|
82
|
+
// tile UV picks a grid cell, then only that cell's line segments (packed in
|
|
83
|
+
// tile-local UV space) are tested for proximity. Within the line width, the
|
|
84
|
+
// vector color is alpha-composited over the terrain (no discard).
|
|
85
|
+
vec4 vectorPolylineRender(vec2 vectorUv, vec4 baseColor)
|
|
86
|
+
{
|
|
87
|
+
#ifdef HAS_VECTOR_POLYLINES
|
|
88
|
+
// Inverse UV-per-pixel Jacobian: measures line distance in screen pixels so
|
|
89
|
+
// width stays constant under anisotropic (oblique) foreshortening.
|
|
90
|
+
// Computed unconditionally so the derivatives stay in uniform control flow.
|
|
91
|
+
mat2 screenFromUv = inverse(mat2(dFdx(vectorUv), dFdy(vectorUv)));
|
|
92
|
+
|
|
93
|
+
#ifdef VECTOR_WIDTH_IN_METERS
|
|
94
|
+
mat2 metersFromUv = mat2(u_vectorMetersPerUv.x, 0.0, 0.0, u_vectorMetersPerUv.y);
|
|
95
|
+
// Edge distances are always compared in pixels, whatever unit a width was authored in,
|
|
96
|
+
// so ground meters are converted using the coarser of the two screen axes.
|
|
97
|
+
// Computed unconditionally so the derivatives stay in uniform control flow.
|
|
98
|
+
float pixelsPerMeter = 1.0 / max(
|
|
99
|
+
length(metersFromUv * dFdx(vectorUv)),
|
|
100
|
+
length(metersFromUv * dFdy(vectorUv)));
|
|
101
|
+
#endif
|
|
102
|
+
|
|
103
|
+
// A tile without polylines binds a 1x1 placeholder; a real grid header
|
|
104
|
+
// [gridWidth, gridHeight, ...] is at least 3 texels.
|
|
105
|
+
ivec2 headerSize = textureSize(u_vectorGridCellIndicesTexture, 0);
|
|
106
|
+
if (headerSize.x * headerSize.y < 3)
|
|
107
|
+
{
|
|
108
|
+
return baseColor;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
ivec2 range = vectorCellRange(vectorUv, u_vectorGridCellIndicesTexture);
|
|
112
|
+
ivec2 segmentTextureSize = textureSize(u_vectorSegmentTexture, 0);
|
|
113
|
+
ivec2 primitiveTextureSize = textureSize(u_vectorWidthTexture, 0);
|
|
114
|
+
|
|
115
|
+
// Signed distance to the nearest edge, negative inside the line. Consecutive
|
|
116
|
+
// segments overlap at their shared vertex, so only the nearest is composited;
|
|
117
|
+
// compositing each in turn would darken the joints.
|
|
118
|
+
float nearestEdgeDistance = 1.0e30;
|
|
119
|
+
int nearestPrimitiveIndex = -1;
|
|
120
|
+
|
|
121
|
+
for (int i = range.x; i < range.y; i++)
|
|
122
|
+
{
|
|
123
|
+
ivec2 segmentUv = vectorIndexToUv(i, segmentTextureSize);
|
|
124
|
+
vec4 segment = texelFetch(u_vectorSegmentTexture, segmentUv, 0);
|
|
125
|
+
|
|
126
|
+
int primitiveIndex = int(texelFetch(u_vectorSegmentPrimitiveIndicesTexture, segmentUv, 0).r);
|
|
127
|
+
ivec2 primitiveUv = vectorIndexToUv(primitiveIndex, primitiveTextureSize);
|
|
128
|
+
|
|
129
|
+
float width = texelFetch(u_vectorWidthTexture, primitiveUv, 0).r;
|
|
130
|
+
float halfWidth = abs(width) * 0.5;
|
|
131
|
+
vec2 offsetToLine = vectorOffsetToLine(vectorUv, segment);
|
|
132
|
+
|
|
133
|
+
#if defined(VECTOR_WIDTH_MIXED_UNITS)
|
|
134
|
+
// A negative width marks a width in meters; see VectorPipeline.
|
|
135
|
+
float edgeDistance = width < 0.0
|
|
136
|
+
? (length(metersFromUv * offsetToLine) - halfWidth) * pixelsPerMeter
|
|
137
|
+
: length(screenFromUv * offsetToLine) - halfWidth;
|
|
138
|
+
#elif defined(VECTOR_WIDTH_IN_METERS)
|
|
139
|
+
float edgeDistance = (length(metersFromUv * offsetToLine) - halfWidth) * pixelsPerMeter;
|
|
140
|
+
#else
|
|
141
|
+
float edgeDistance = length(screenFromUv * offsetToLine) - halfWidth;
|
|
142
|
+
#endif
|
|
143
|
+
|
|
144
|
+
if (edgeDistance < nearestEdgeDistance)
|
|
145
|
+
{
|
|
146
|
+
nearestEdgeDistance = edgeDistance;
|
|
147
|
+
nearestPrimitiveIndex = primitiveIndex;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Coverage is saturated; no further segment can raise it. Only the nearest
|
|
151
|
+
// segment supplies the color, so overlapping translucent lines do not blend.
|
|
152
|
+
if (nearestEdgeDistance <= -vectorCoverageRadius)
|
|
153
|
+
{
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (nearestEdgeDistance > vectorCoverageRadius)
|
|
159
|
+
{
|
|
160
|
+
return baseColor;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
#ifdef VECTOR_ANTIALIAS
|
|
164
|
+
float coverage = 1.0 - smoothstep(-vectorCoverageRadius, vectorCoverageRadius, nearestEdgeDistance);
|
|
165
|
+
#else
|
|
166
|
+
float coverage = 1.0;
|
|
167
|
+
#endif
|
|
168
|
+
|
|
169
|
+
vectorPickPrimitiveIndex = nearestPrimitiveIndex;
|
|
170
|
+
|
|
171
|
+
// Alpha-composite vector over terrain.
|
|
172
|
+
ivec2 primitiveUv = vectorIndexToUv(nearestPrimitiveIndex, primitiveTextureSize);
|
|
173
|
+
vec4 vectorColor = texelFetch(u_vectorColorTexture, primitiveUv, 0);
|
|
174
|
+
vectorColor.a *= coverage;
|
|
175
|
+
return vectorColor * vec4(vectorColor.aaa, 1.0) + baseColor * (1.0 - vectorColor.a);
|
|
176
|
+
#else
|
|
177
|
+
return baseColor;
|
|
178
|
+
#endif
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Composites a polygon's fill over baseColor when the pixel is inside it. A
|
|
182
|
+
// negative index (empty cell or first iteration) or an outside pixel is a
|
|
183
|
+
// no-op.
|
|
184
|
+
vec4 vectorCompositePolygonFill(vec4 baseColor, int primitiveIndex, bool inside, ivec2 primitiveTextureSize)
|
|
185
|
+
{
|
|
186
|
+
if (!inside || primitiveIndex < 0)
|
|
187
|
+
{
|
|
188
|
+
return baseColor;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
vectorPickPrimitiveIndex = primitiveIndex;
|
|
192
|
+
|
|
193
|
+
ivec2 primitiveUv = vectorIndexToUv(primitiveIndex, primitiveTextureSize);
|
|
194
|
+
vec4 fillColor = texelFetch(u_vectorColorTexture, primitiveUv, 0);
|
|
195
|
+
return fillColor * vec4(fillColor.aaa, 1.0) + baseColor * (1.0 - fillColor.a);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// True if a horizontal +x ray from p crosses the edge. The half-open interval
|
|
199
|
+
// (> vs <=) counts a ray through a shared vertex exactly once.
|
|
200
|
+
bool vectorEdgeCrossesRay(vec4 edge, vec2 p)
|
|
201
|
+
{
|
|
202
|
+
if ((edge.y > p.y) == (edge.w > p.y))
|
|
203
|
+
{
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
float t = (p.y - edge.y) / (edge.w - edge.y);
|
|
208
|
+
float xIntersect = edge.x + t * (edge.z - edge.x);
|
|
209
|
+
return p.x < xIntersect;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Drape vector polygon fills onto the terrain surface. The fragment's
|
|
213
|
+
// tile UV picks a grid cell whose edges were clipped to the cell on the CPU,
|
|
214
|
+
// forming closed loops, so an even-odd horizontal ray cast within the cell
|
|
215
|
+
// decides coverage. Edges arrive grouped by primitive; each covering
|
|
216
|
+
// primitive's fill color is alpha-composited in primitive order (no discard).
|
|
217
|
+
vec4 vectorPolygonRender(vec2 vectorUv, vec4 baseColor)
|
|
218
|
+
{
|
|
219
|
+
#ifdef HAS_VECTOR_POLYGONS
|
|
220
|
+
ivec2 range = vectorCellRange(vectorUv, u_vectorPolygonGridCellIndicesTexture);
|
|
221
|
+
ivec2 edgeTextureSize = textureSize(u_vectorPolygonEdgeTexture, 0);
|
|
222
|
+
ivec2 primitiveTextureSize = textureSize(u_vectorColorTexture, 0);
|
|
223
|
+
|
|
224
|
+
int currentPrimitive = -1;
|
|
225
|
+
bool inside = false;
|
|
226
|
+
|
|
227
|
+
for (int i = range.x; i < range.y; i++)
|
|
228
|
+
{
|
|
229
|
+
ivec2 edgeUv = vectorIndexToUv(i, edgeTextureSize);
|
|
230
|
+
vec4 edge = texelFetch(u_vectorPolygonEdgeTexture, edgeUv, 0);
|
|
231
|
+
int primitiveIndex = int(texelFetch(u_vectorPolygonEdgePrimitiveIndicesTexture, edgeUv, 0).r);
|
|
232
|
+
|
|
233
|
+
// A new primitive means the previous group is complete: composite it,
|
|
234
|
+
// then start counting the new one fresh.
|
|
235
|
+
if (primitiveIndex != currentPrimitive)
|
|
236
|
+
{
|
|
237
|
+
baseColor = vectorCompositePolygonFill(baseColor, currentPrimitive, inside, primitiveTextureSize);
|
|
238
|
+
currentPrimitive = primitiveIndex;
|
|
239
|
+
inside = false;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (vectorEdgeCrossesRay(edge, vectorUv))
|
|
243
|
+
{
|
|
244
|
+
inside = !inside;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// The last primitive group has no trailing edge to trigger its composite.
|
|
249
|
+
baseColor = vectorCompositePolygonFill(baseColor, currentPrimitive, inside, primitiveTextureSize);
|
|
250
|
+
|
|
251
|
+
return baseColor;
|
|
252
|
+
#else
|
|
253
|
+
return baseColor;
|
|
254
|
+
#endif
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Pick color of the vector draped over this fragment, or the surface's own where none is.
|
|
258
|
+
vec4 vectorPickColorOver(vec4 surfacePickColor)
|
|
259
|
+
{
|
|
260
|
+
if (vectorPickPrimitiveIndex < 0)
|
|
261
|
+
{
|
|
262
|
+
return surfacePickColor;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
ivec2 primitiveTextureSize = textureSize(u_vectorPickColorTexture, 0);
|
|
266
|
+
return texelFetch(u_vectorPickColorTexture, vectorIndexToUv(vectorPickPrimitiveIndex, primitiveTextureSize), 0);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Returns true if uv is inside any polygon in its grid cell
|
|
270
|
+
// If performing inverse-clipping, it is up to the caller to negate the result.
|
|
271
|
+
bool vectorClip(vec2 uv)
|
|
272
|
+
{
|
|
273
|
+
// Clamp to [0, 1] to address small interpolation precision error that can occur at the boundaries of tiles
|
|
274
|
+
uv = clamp(uv, vec2(0.0), vec2(1.0));
|
|
275
|
+
ivec2 range = vectorCellRange(uv, u_clippingGridCellIndicesTexture);
|
|
276
|
+
ivec2 edgeTextureSize = textureSize(u_clippingEdgeTexture, 0);
|
|
277
|
+
|
|
278
|
+
int currentPrimitive = -1;
|
|
279
|
+
bool inside = false;
|
|
280
|
+
|
|
281
|
+
for (int i = range.x; i < range.y; i++)
|
|
282
|
+
{
|
|
283
|
+
ivec2 edgeUv = vectorIndexToUv(i, edgeTextureSize);
|
|
284
|
+
int primitiveIndex = int(texelFetch(u_clippingEdgePrimitiveIndicesTexture, edgeUv, 0).r);
|
|
285
|
+
|
|
286
|
+
// New primitive: the previous group is complete, check if it was inside and return early if so.
|
|
287
|
+
if (primitiveIndex != currentPrimitive)
|
|
288
|
+
{
|
|
289
|
+
if (inside)
|
|
290
|
+
{
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
currentPrimitive = primitiveIndex;
|
|
294
|
+
inside = false;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
vec4 edge = texelFetch(u_clippingEdgeTexture, edgeUv, 0);
|
|
298
|
+
if (vectorEdgeCrossesRay(edge, uv))
|
|
299
|
+
{
|
|
300
|
+
inside = !inside;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return inside; // last group
|
|
305
|
+
}
|