@hztxi/cesium-engine 25.0.7 → 26.2.2
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/Workers/chunk-2FNKHQL3.js +754 -0
- package/Build/Workers/chunk-2NCNUVAT.js +56 -0
- package/Build/Workers/chunk-2ZYRUVVU.js +301 -0
- package/Build/Workers/chunk-36IU7N4V.js +1284 -0
- package/Build/Workers/chunk-3BDLET5S.js +198 -0
- package/Build/Workers/chunk-3JZXI44G.js +3822 -0
- package/Build/Workers/chunk-3N2UNLWJ.js +101 -0
- package/Build/Workers/chunk-3NCG2YYR.js +58 -0
- package/Build/Workers/chunk-3PRHI4KX.js +241 -0
- package/Build/Workers/chunk-3R6E2SH4.js +672 -0
- package/Build/Workers/chunk-3ZKKXEXL.js +415 -0
- package/Build/Workers/chunk-47KVKPTO.js +415 -0
- package/Build/Workers/chunk-4FFIJ7ZV.js +56 -0
- package/Build/Workers/chunk-4N227IPR.js +973 -0
- package/Build/Workers/chunk-4P6OAPBM.js +97 -0
- package/Build/Workers/chunk-4XR3K4GD.js +280 -0
- package/Build/Workers/chunk-4Z2JINRS.js +519 -0
- package/Build/Workers/chunk-4ZOLEPZK.js +519 -0
- package/Build/Workers/chunk-5EF3WWQG.js +352 -0
- package/Build/Workers/chunk-5I76476T.js +288 -0
- package/Build/Workers/chunk-5PBZKBAP.js +511 -0
- package/Build/Workers/chunk-5RVAAW26.js +82 -0
- package/Build/Workers/chunk-5VWK76PO.js +511 -0
- package/Build/Workers/chunk-6SEICASZ.js +241 -0
- package/Build/Workers/chunk-77DBX23X.js +455 -0
- package/Build/Workers/chunk-7C2D3DTI.js +959 -0
- package/Build/Workers/chunk-7GQOWCSN.js +959 -0
- package/Build/Workers/chunk-7J2ONMKC.js +198 -0
- package/Build/Workers/chunk-7MHUHXZZ.js +219 -0
- package/Build/Workers/chunk-7MQPHOAS.js +455 -0
- package/Build/Workers/chunk-7NJ5O7TP.js +387 -0
- package/Build/Workers/chunk-7T4MW2W4.js +368 -0
- package/Build/Workers/chunk-7UXZUGUZ.js +82 -0
- package/Build/Workers/chunk-7Y642MCO.js +352 -0
- package/Build/Workers/chunk-7ZFKBLUE.js +1054 -0
- package/Build/Workers/chunk-A2UHPWPL.js +38 -0
- package/Build/Workers/chunk-A7LGY5XS.js +140 -0
- package/Build/Workers/chunk-AN2NVYL6.js +1483 -0
- package/Build/Workers/chunk-AS2QC7H2.js +219 -0
- package/Build/Workers/chunk-AVOLMIGJ.js +57 -0
- package/Build/Workers/chunk-B7PT2VL5.js +630 -0
- package/Build/Workers/chunk-BHRHMUDM.js +147 -0
- package/Build/Workers/chunk-BUWAHRK5.js +672 -0
- package/Build/Workers/chunk-C5ET5HON.js +198 -0
- package/Build/Workers/chunk-C6XQGBPV.js +476 -0
- package/Build/Workers/chunk-C7B672RR.js +73 -0
- package/Build/Workers/chunk-CAEC5DA2.js +57 -0
- package/Build/Workers/chunk-CBCOHH5O.js +837 -0
- package/Build/Workers/chunk-CEMXKBQO.js +1800 -0
- package/Build/Workers/chunk-CKW3STKA.js +1067 -0
- package/Build/Workers/chunk-CV5RICKT.js +1992 -0
- package/Build/Workers/chunk-DBWSISJT.js +56 -0
- package/Build/Workers/chunk-DCMOBPLG.js +352 -0
- package/Build/Workers/chunk-DSBSPPPJ.js +1344 -0
- package/Build/Workers/chunk-DSGLDRTI.js +278 -0
- package/Build/Workers/chunk-DXD7OPSP.js +1992 -0
- package/Build/Workers/chunk-DXECZBSA.js +368 -0
- package/Build/Workers/chunk-DZIRO6ZK.js +682 -0
- package/Build/Workers/chunk-E4CRPGX5.js +140 -0
- package/Build/Workers/chunk-E4IVMEBH.js +52 -0
- package/Build/Workers/chunk-E6IPM6HP.js +56 -0
- package/Build/Workers/chunk-EB2HAHRY.js +1054 -0
- package/Build/Workers/chunk-ECDCQXCO.js +1992 -0
- package/Build/Workers/chunk-ECN3VUMA.js +73 -0
- package/Build/Workers/chunk-ECSKVHUB.js +476 -0
- package/Build/Workers/chunk-EIENGLA5.js +278 -0
- package/Build/Workers/chunk-EK5CWDW2.js +476 -0
- package/Build/Workers/chunk-EL4B5CSQ.js +162 -0
- package/Build/Workers/chunk-EUCUBIEZ.js +97 -0
- package/Build/Workers/chunk-FAYBQGKO.js +219 -0
- package/Build/Workers/chunk-FGCXPEZM.js +3201 -0
- package/Build/Workers/chunk-FHCRXPA6.js +44 -0
- package/Build/Workers/chunk-FM6EQUFX.js +1800 -0
- package/Build/Workers/chunk-FPFGGQ4X.js +301 -0
- package/Build/Workers/chunk-FQ42MT7M.js +58 -0
- package/Build/Workers/chunk-FQDYQG4P.js +1284 -0
- package/Build/Workers/chunk-FQTV6W3I.js +973 -0
- package/Build/Workers/chunk-FTCBY5HH.js +138 -0
- package/Build/Workers/chunk-GI5RWJAY.js +101 -0
- package/Build/Workers/chunk-GNLMSDRO.js +945 -0
- package/Build/Workers/chunk-GTA727KQ.js +140 -0
- package/Build/Workers/chunk-GVUJ6O3R.js +73 -0
- package/Build/Workers/chunk-GXTM7AG3.js +1483 -0
- package/Build/Workers/chunk-HAXQB2FS.js +2719 -0
- package/Build/Workers/chunk-HCGU7OCG.js +97 -0
- package/Build/Workers/chunk-HRIPVWSC.js +58 -0
- package/Build/Workers/chunk-IC3BR6SC.js +102 -0
- package/Build/Workers/chunk-IEPPOHF3.js +44 -0
- package/Build/Workers/chunk-IU3YAYPT.js +1344 -0
- package/Build/Workers/chunk-J3AXZ4WC.js +124 -0
- package/Build/Workers/chunk-J7MZR7B2.js +1483 -0
- package/Build/Workers/chunk-KBNW776Q.js +305 -0
- package/Build/Workers/chunk-KBSWXVSY.js +837 -0
- package/Build/Workers/chunk-KEYTLNVK.js +1067 -0
- package/Build/Workers/chunk-KN3RQWUA.js +3201 -0
- package/Build/Workers/chunk-KSIEJYNL.js +3822 -0
- package/Build/Workers/chunk-KT3GG7AW.js +754 -0
- package/Build/Workers/chunk-KYCEM22I.js +1800 -0
- package/Build/Workers/chunk-L2TFZKN6.js +455 -0
- package/Build/Workers/chunk-LHKE2VUR.js +945 -0
- package/Build/Workers/chunk-LJTQW46H.js +57 -0
- package/Build/Workers/chunk-LMQGYJME.js +672 -0
- package/Build/Workers/chunk-LOBYJQA4.js +76 -0
- package/Build/Workers/chunk-LOF32O7F.js +163 -0
- package/Build/Workers/chunk-LOTIJA7D.js +124 -0
- package/Build/Workers/chunk-M7Z3MPAX.js +973 -0
- package/Build/Workers/chunk-MHNLTQHO.js +3201 -0
- package/Build/Workers/chunk-MICPAD7R.js +398 -0
- package/Build/Workers/chunk-ML7OMD72.js +2342 -0
- package/Build/Workers/chunk-MPJ73WMH.js +138 -0
- package/Build/Workers/chunk-MUTHG7T7.js +171 -0
- package/Build/Workers/chunk-NBTGXEMT.js +945 -0
- package/Build/Workers/chunk-NQZC37F7.js +38 -0
- package/Build/Workers/chunk-O3X3D2Z3.js +352 -0
- package/Build/Workers/chunk-OBUIHPKF.js +352 -0
- package/Build/Workers/chunk-PAEWNYIV.js +138 -0
- package/Build/Workers/chunk-PANJ7YH6.js +102 -0
- package/Build/Workers/chunk-PCL3Y7H5.js +82 -0
- package/Build/Workers/chunk-PHUELDXQ.js +76 -0
- package/Build/Workers/chunk-PIIUGRQD.js +387 -0
- package/Build/Workers/chunk-POKD22OT.js +2719 -0
- package/Build/Workers/chunk-PQMA7MFS.js +9237 -0
- package/Build/Workers/chunk-PQZW2QZG.js +163 -0
- package/Build/Workers/chunk-PURIPUSY.js +682 -0
- package/Build/Workers/chunk-QQZPPXY4.js +3822 -0
- package/Build/Workers/chunk-QXLQLGL2.js +1067 -0
- package/Build/Workers/chunk-R2JQAAU7.js +630 -0
- package/Build/Workers/chunk-RC4YC3VU.js +278 -0
- package/Build/Workers/chunk-RGNNWVR6.js +171 -0
- package/Build/Workers/chunk-RUOETBWP.js +288 -0
- package/Build/Workers/chunk-RV4EPLBO.js +2342 -0
- package/Build/Workers/chunk-SBBIEHYT.js +44 -0
- package/Build/Workers/chunk-SBEQLEO5.js +352 -0
- package/Build/Workers/chunk-SGC2GT3Y.js +1284 -0
- package/Build/Workers/chunk-SKLK4CBL.js +162 -0
- package/Build/Workers/chunk-SWVZTU6X.js +305 -0
- package/Build/Workers/chunk-T3EUPM5A.js +454 -0
- package/Build/Workers/chunk-TA6IU2XL.js +171 -0
- package/Build/Workers/chunk-TLSGD5TR.js +280 -0
- package/Build/Workers/chunk-TNDQT5AB.js +682 -0
- package/Build/Workers/chunk-TOXDLWKZ.js +368 -0
- package/Build/Workers/chunk-TZBM6TAB.js +124 -0
- package/Build/Workers/chunk-U2OY6MX6.js +398 -0
- package/Build/Workers/chunk-UCY4B5EV.js +288 -0
- package/Build/Workers/chunk-V52FEPCV.js +754 -0
- package/Build/Workers/chunk-VBEXZBG5.js +147 -0
- package/Build/Workers/chunk-VC76B6GM.js +959 -0
- package/Build/Workers/chunk-VCUOYHWC.js +519 -0
- package/Build/Workers/chunk-VDBQVKTF.js +387 -0
- package/Build/Workers/chunk-VJIL5H6K.js +2719 -0
- package/Build/Workers/chunk-VJLDRHKN.js +511 -0
- package/Build/Workers/chunk-VMF7KOGY.js +162 -0
- package/Build/Workers/chunk-W3X2ZAEJ.js +52 -0
- package/Build/Workers/chunk-W5OCKMPJ.js +101 -0
- package/Build/Workers/chunk-X4VZ33YL.js +454 -0
- package/Build/Workers/chunk-XDM5A6C4.js +102 -0
- package/Build/Workers/chunk-XHT5SVP4.js +52 -0
- package/Build/Workers/chunk-XITBARMZ.js +2342 -0
- package/Build/Workers/chunk-XLQZNQ4Z.js +163 -0
- package/Build/Workers/chunk-XZ6HDXKM.js +76 -0
- package/Build/Workers/chunk-Y6AQK4FY.js +1344 -0
- package/Build/Workers/chunk-Y7NDFEQ3.js +398 -0
- package/Build/Workers/chunk-YBBQDYX2.js +301 -0
- package/Build/Workers/chunk-YHPYPVAB.js +837 -0
- package/Build/Workers/chunk-YJBPRW4A.js +415 -0
- package/Build/Workers/chunk-YNKK6BXY.js +454 -0
- package/Build/Workers/chunk-YRAJ74HR.js +305 -0
- package/Build/Workers/chunk-YULTZK5O.js +147 -0
- package/Build/Workers/chunk-YUNQYP3Z.js +9237 -0
- package/Build/Workers/chunk-YX2FOQMF.js +9237 -0
- package/Build/Workers/chunk-Z7BONRW2.js +241 -0
- package/Build/Workers/chunk-ZK2R3DEJ.js +1054 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +18 -18
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +39 -39
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +33 -33
- package/Build/Workers/createCorridorGeometry.js +36 -37
- package/Build/Workers/createCorridorOutlineGeometry.js +34 -35
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +20 -20
- 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 +20 -20
- package/Build/Workers/createGeometry.js +25 -24
- package/Build/Workers/createGroundPolylineGeometry.js +26 -26
- package/Build/Workers/createMvtTile.js +111 -19
- package/Build/Workers/createPlaneGeometry.js +18 -18
- package/Build/Workers/createPlaneOutlineGeometry.js +17 -17
- package/Build/Workers/createPolygonGeometry.js +36 -36
- package/Build/Workers/createPolygonOutlineGeometry.js +33 -33
- package/Build/Workers/createPolylineGeometry.js +28 -28
- package/Build/Workers/createPolylineVolumeGeometry.js +38 -36
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +32 -31
- package/Build/Workers/createRectangleGeometry.js +29 -29
- package/Build/Workers/createRectangleOutlineGeometry.js +23 -23
- package/Build/Workers/createSimplePolylineGeometry.js +26 -26
- 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 +26 -26
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
- package/Build/Workers/createVerticesFromHeightmap.js +23 -23
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
- package/Build/Workers/createWallGeometry.js +26 -26
- package/Build/Workers/createWallOutlineGeometry.js +26 -26
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +993 -2334
- 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 +23 -23
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
- package/Source/Core/BoundingRectangle.js +6 -8
- package/Source/Core/BoundingSphere.js +0 -3
- package/Source/Core/Cartesian2.js +1 -1
- package/Source/Core/Cartesian3.js +1 -1
- package/Source/Core/Cartesian4.js +1 -1
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
- package/Source/Core/Color.js +1 -0
- package/Source/Core/ComponentDatatype.js +35 -0
- 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/Heap.js +1 -1
- package/Source/Core/HermitePolynomialApproximation.js +215 -179
- package/Source/Core/InterpolationAlgorithm.js +58 -50
- package/Source/Core/Ion.js +1 -1
- package/Source/Core/JulianDate.js +1 -1
- package/Source/Core/LagrangePolynomialApproximation.js +55 -52
- package/Source/Core/LinearApproximation.js +69 -66
- package/Source/Core/MapProjection.js +1 -0
- package/Source/Core/Math.js +59 -0
- package/Source/Core/Matrix2.js +3 -3
- package/Source/Core/Matrix3.js +3 -3
- package/Source/Core/Matrix4.js +1 -1
- 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/Resource.js +1 -1
- package/Source/Core/ScreenSpaceEventHandler.js +51 -41
- package/Source/Core/SimplePolylineGeometry.js +1 -1
- package/Source/Core/TerrainEncoding.js +2 -2
- package/Source/Core/TerrainMesh.js +3 -3
- package/Source/Core/TerrainPicker.js +180 -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 +1117 -0
- package/Source/Core/VectorProvider.js +429 -0
- package/Source/Core/WallOutlineGeometry.js +1 -1
- package/Source/Core/createColorRamp.js +37 -0
- package/Source/Core/getTimestamp.js +4 -2
- package/Source/Core/globalTypes.js +25 -0
- package/Source/Core/writeTextToCanvas.js +1 -0
- package/Source/DataSources/CompositeEntityCollection.js +0 -1
- package/Source/DataSources/CzmlDataSource.js +14 -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 +529 -557
- package/Source/DataSources/PathGraphics.js +8 -1
- package/Source/DataSources/PathMode.js +27 -0
- package/Source/DataSources/PathVisualizer.js +298 -1
- package/Source/DataSources/PolylineVisualizer.js +1 -1
- package/Source/DataSources/StaticOutlineGeometryBatch.js +1 -1
- package/Source/Renderer/AutomaticUniforms.js +23 -0
- 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 -9
- package/Source/Renderer/Texture.js +12 -1
- package/Source/Renderer/UniformState.js +7 -0
- package/Source/Renderer/VertexArray.js +1 -1
- package/Source/Renderer/createUniform.js +346 -239
- package/Source/Renderer/createUniformArray.js +494 -381
- 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 +15 -5
- package/Source/Scene/BillboardTexture.js +5 -3
- package/Source/Scene/BufferPointCollection.js +11 -1
- package/Source/Scene/BufferPolygonCollection.js +26 -0
- package/Source/Scene/BufferPolylineCollection.js +2 -0
- package/Source/Scene/BufferPrimitiveCollection.js +105 -32
- package/Source/Scene/Camera.js +85 -9
- package/Source/Scene/CameraEventAggregator.js +30 -18
- package/Source/Scene/CameraFlightPath.js +7 -4
- package/Source/Scene/Cesium3DTile.js +102 -4
- package/Source/Scene/Cesium3DTileContent.js +195 -254
- package/Source/Scene/Cesium3DTileContentFactory.js +10 -2
- package/Source/Scene/Cesium3DTileOptimizations.js +4 -6
- package/Source/Scene/Cesium3DTileStyle.js +40 -0
- package/Source/Scene/Cesium3DTileset.js +213 -8
- package/Source/Scene/Cesium3DTilesetTraversal.js +14 -0
- package/Source/Scene/ClippingPlaneCollection.js +4 -4
- package/Source/Scene/ClippingPolygon.js +2 -0
- package/Source/Scene/ClippingPolygonCollection.js +2 -2
- package/Source/Scene/Composite3DTileContent.js +254 -292
- 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/DerivedCommand.js +98 -0
- package/Source/Scene/EdgeDisplayMode.js +50 -0
- package/Source/Scene/EdgeFramebuffer.js +1 -5
- package/Source/Scene/Empty3DTileContent.js +100 -132
- package/Source/Scene/Expression.js +6 -8
- package/Source/Scene/FrameState.js +17 -0
- package/Source/Scene/GaussianSplat3DTileContent.js +436 -478
- package/Source/Scene/GeoJsonPrimitive.js +874 -0
- package/Source/Scene/Geometry3DTileContent.js +151 -185
- package/Source/Scene/Globe.js +22 -1
- package/Source/Scene/GlobeDepth.js +27 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +637 -540
- package/Source/Scene/GlobeSurfaceTile.js +575 -398
- package/Source/Scene/GlobeSurfaceTileProvider.js +1412 -1184
- package/Source/Scene/GltfBufferViewLoader.js +3 -3
- package/Source/Scene/GltfLoader.js +146 -3
- package/Source/Scene/GltfLoaderUtil.js +20 -4
- package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +10 -0
- package/Source/Scene/GltfPipeline/removeUnusedElements.js +21 -11
- package/Source/Scene/GltfSpzLoader.js +1 -1
- package/Source/Scene/GltfVertexBufferLoader.js +6 -3
- package/Source/Scene/I3SDataProvider.js +1 -1
- package/Source/Scene/I3SLayer.js +1 -1
- package/Source/Scene/I3SNode.js +2 -2
- package/Source/Scene/ImageryLayer.js +2 -2
- package/Source/Scene/ImageryLayerCollection.js +190 -6
- package/Source/Scene/Implicit3DTileContent.js +192 -216
- package/Source/Scene/ImplicitTileCoordinates.js +17 -0
- package/Source/Scene/IonImageryProvider.js +1 -5
- package/Source/Scene/Label.js +4 -4
- package/Source/Scene/LabelCollection.js +4 -1
- package/Source/Scene/MVTDataProvider.js +555 -0
- package/Source/Scene/Material.js +1 -0
- package/Source/Scene/Model/B3dmLoader.js +1 -2
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +82 -312
- package/Source/Scene/Model/Extensions/Gpm/GltfGpmLoader.js +4 -0
- 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 +45 -10
- package/Source/Scene/Model/Model3DTileContent.js +424 -458
- package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
- package/Source/Scene/Model/ModelDrawCommand.js +180 -8
- package/Source/Scene/Model/ModelDrawCommands.js +4 -0
- package/Source/Scene/Model/ModelSceneGraph.js +21 -0
- package/Source/Scene/Model/ModelUtility.js +5 -0
- package/Source/Scene/Model/PickingPipelineStage.js +29 -0
- package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
- package/Source/Scene/Model/createVectorTileBuffersFromModelComponents.js +645 -153
- package/Source/Scene/ModelComponents.js +112 -0
- package/Source/Scene/Multiple3DTileContent.js +291 -334
- package/Source/Scene/MvtLabelCandidates.js +295 -0
- package/Source/Scene/MvtLabelManager.js +1069 -0
- package/Source/Scene/Picking.js +19 -3
- package/Source/Scene/PlanarFillIdFramebuffer.js +172 -0
- package/Source/Scene/PntsParser.js +1 -1
- package/Source/Scene/PolylineCollection.js +5 -3
- package/Source/Scene/PostProcessStage.js +4 -2
- package/Source/Scene/QuadtreePrimitive.js +3 -2
- package/Source/Scene/ResourceCache.js +7 -4
- package/Source/Scene/ResourceCacheKey.js +21 -18
- package/Source/Scene/Scene.js +237 -11
- package/Source/Scene/SceneTransforms.js +6 -5
- 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 +184 -0
- package/Source/Scene/TerrainFillMesh.js +3 -2
- package/Source/Scene/Tileset3DTileContent.js +113 -146
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +543 -0
- package/Source/Scene/Vector3DTileContent.js +207 -237
- package/Source/Scene/VectorGltf3DTileContent.js +185 -45
- package/Source/Scene/View.js +10 -8
- package/Source/Scene/VoxelPrimitive.js +159 -175
- package/Source/Scene/VoxelProvider.js +64 -91
- package/Source/Scene/VoxelTraversal.js +1 -1
- package/Source/Scene/buildVectorGltfFromMVT.js +1208 -0
- package/Source/Scene/buildVoxelCustomShader.js +199 -0
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/decodeMVT.js +877 -0
- package/Source/Scene/findMeshoptExtension.js +23 -0
- package/Source/Scene/renderBufferPointCollection.js +114 -64
- package/Source/Scene/renderBufferPolygonCollection.js +245 -53
- package/Source/Scene/renderBufferPolylineCollection.js +271 -145
- package/Source/Shaders/BillboardCollectionVS.glsl +23 -25
- package/Source/Shaders/BillboardCollectionVS.js +23 -25
- package/Source/Shaders/BufferPointMaterialFS.glsl +1 -0
- package/Source/Shaders/BufferPointMaterialFS.js +1 -0
- package/Source/Shaders/BufferPointMaterialVS.glsl +19 -9
- package/Source/Shaders/BufferPointMaterialVS.js +20 -10
- package/Source/Shaders/BufferPolygonMaterialFS.glsl +13 -0
- package/Source/Shaders/BufferPolygonMaterialFS.js +13 -0
- package/Source/Shaders/BufferPolygonMaterialVS.glsl +22 -4
- package/Source/Shaders/BufferPolygonMaterialVS.js +23 -5
- package/Source/Shaders/BufferPolylineMaterialVS.glsl +16 -2
- package/Source/Shaders/BufferPolylineMaterialVS.js +17 -3
- 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/passCesium3DTileEdgesDirect.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTileEdgesDirect.js +11 -0
- 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/passOverlay.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOverlay.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 -0
- package/Source/Shaders/GlobeFS.glsl +10 -6
- package/Source/Shaders/GlobeFS.js +10 -6
- package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.glsl +0 -1
- package/Source/Shaders/Model/EdgeVisibilityStageVS.js +0 -1
- package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
- package/Source/Shaders/Model/MaterialStageFS.js +8 -2
- package/Source/Shaders/Model/ModelFS.glsl +105 -0
- package/Source/Shaders/Model/ModelFS.js +105 -0
- package/Source/Shaders/VectorCommon.glsl +178 -0
- package/Source/Shaders/VectorCommon.js +180 -0
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Widget/CesiumWidget.js +30 -0
- package/Source/Workers/createMvtTile.js +39 -0
- package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2
- package/Source/Workers/incrementallyBuildTerrainPicker.js +2 -0
- package/index.js +214 -184
- package/package.json +13 -13
|
@@ -53,1053 +53,1438 @@ import TerrainState from "./TerrainState.js";
|
|
|
53
53
|
import TileBoundingRegion from "./TileBoundingRegion.js";
|
|
54
54
|
import TileSelectionResult from "./TileSelectionResult.js";
|
|
55
55
|
|
|
56
|
+
/** @import Context from "../Renderer/Context.js"; */
|
|
57
|
+
/** @import EllipsoidalOccluder from "../Core/EllipsoidalOccluder.js"; */
|
|
58
|
+
/** @import FrameState from "./FrameState.js"; */
|
|
59
|
+
/** @import GlobeSurfaceShaderSet from "./GlobeSurfaceShaderSet.js"; */
|
|
60
|
+
/** @import ImageryLayerCollection from "./ImageryLayerCollection.js"; */
|
|
61
|
+
/** @import QuadtreeOccluders from "./QuadtreeOccluders.js"; */
|
|
62
|
+
/** @import QuadtreePrimitive from "./QuadtreePrimitive.js"; */
|
|
63
|
+
/** @import QuadtreeTile from "./QuadtreeTile.js"; */
|
|
64
|
+
/** @import TerrainMesh from "../Core/TerrainMesh.js"; */
|
|
65
|
+
/** @import TerrainProvider from "../Core/TerrainProvider.js"; */
|
|
66
|
+
/** @import TilingScheme from "../Core/TilingScheme.js"; */
|
|
67
|
+
/** @import VectorProvider, { VectorTileData } from "../Core/VectorProvider.js"; */
|
|
68
|
+
/** @import { GlobeSurfaceShaderSetOptions } from "./GlobeSurfaceShaderSet.js"; */
|
|
69
|
+
|
|
56
70
|
/**
|
|
57
71
|
* Provides quadtree tiles representing the surface of the globe. This type is intended to be used
|
|
58
72
|
* with {@link QuadtreePrimitive}.
|
|
59
73
|
*
|
|
60
|
-
* @alias GlobeSurfaceTileProvider
|
|
61
|
-
* @constructor
|
|
62
|
-
*
|
|
63
|
-
* @param {TerrainProvider} options.terrainProvider The terrain provider that describes the surface geometry.
|
|
64
|
-
* @param {ImageryLayerCollection} option.imageryLayers The collection of imagery layers describing the shading of the surface.
|
|
65
|
-
* @param {GlobeSurfaceShaderSet} options.surfaceShaderSet The set of shaders used to render the surface.
|
|
66
|
-
*
|
|
67
74
|
* @private
|
|
68
75
|
*/
|
|
69
|
-
|
|
70
|
-
//>>includeStart('debug', pragmas.debug);
|
|
71
|
-
if (!defined(options)) {
|
|
72
|
-
throw new DeveloperError("options is required.");
|
|
73
|
-
}
|
|
74
|
-
if (!defined(options.terrainProvider)) {
|
|
75
|
-
throw new DeveloperError("options.terrainProvider is required.");
|
|
76
|
-
} else if (!defined(options.imageryLayers)) {
|
|
77
|
-
throw new DeveloperError("options.imageryLayers is required.");
|
|
78
|
-
} else if (!defined(options.surfaceShaderSet)) {
|
|
79
|
-
throw new DeveloperError("options.surfaceShaderSet is required.");
|
|
80
|
-
}
|
|
81
|
-
//>>includeEnd('debug');
|
|
82
|
-
|
|
83
|
-
this.lightingFadeOutDistance = 6500000.0;
|
|
84
|
-
this.lightingFadeInDistance = 9000000.0;
|
|
85
|
-
this.hasWaterMask = false;
|
|
86
|
-
this.showWaterEffect = false;
|
|
87
|
-
this.oceanNormalMap = undefined;
|
|
88
|
-
this.zoomedOutOceanSpecularIntensity = 0.5;
|
|
89
|
-
this.enableLighting = false;
|
|
90
|
-
this.dynamicAtmosphereLighting = false;
|
|
91
|
-
this.dynamicAtmosphereLightingFromSun = false;
|
|
92
|
-
this.showGroundAtmosphere = false;
|
|
93
|
-
this.shadows = ShadowMode.RECEIVE_ONLY;
|
|
94
|
-
this.vertexShadowDarkness = 0.3;
|
|
95
|
-
|
|
76
|
+
class GlobeSurfaceTileProvider {
|
|
96
77
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* @
|
|
102
|
-
* @default undefined
|
|
78
|
+
* @param {object} options
|
|
79
|
+
* @param {TerrainProvider} options.terrainProvider The terrain provider that describes the surface geometry.
|
|
80
|
+
* @param {ImageryLayerCollection} options.imageryLayers The collection of imagery layers describing the shading of the surface.
|
|
81
|
+
* @param {GlobeSurfaceShaderSet} options.surfaceShaderSet The set of shaders used to render the surface.
|
|
82
|
+
* @param {VectorProvider} options.vectorProvider
|
|
103
83
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
84
|
+
constructor(options) {
|
|
85
|
+
//>>includeStart('debug', pragmas.debug);
|
|
86
|
+
if (!defined(options)) {
|
|
87
|
+
throw new DeveloperError("options is required.");
|
|
88
|
+
}
|
|
89
|
+
if (!defined(options.terrainProvider)) {
|
|
90
|
+
throw new DeveloperError("options.terrainProvider is required.");
|
|
91
|
+
} else if (!defined(options.imageryLayers)) {
|
|
92
|
+
throw new DeveloperError("options.imageryLayers is required.");
|
|
93
|
+
} else if (!defined(options.surfaceShaderSet)) {
|
|
94
|
+
throw new DeveloperError("options.surfaceShaderSet is required.");
|
|
95
|
+
} else if (!defined(options.vectorProvider)) {
|
|
96
|
+
throw new DeveloperError("options.vectorProvider is required.");
|
|
97
|
+
}
|
|
98
|
+
//>>includeEnd('debug');
|
|
99
|
+
|
|
100
|
+
this.lightingFadeOutDistance = 6500000.0;
|
|
101
|
+
this.lightingFadeInDistance = 9000000.0;
|
|
102
|
+
this.hasWaterMask = false;
|
|
103
|
+
this.showWaterEffect = false;
|
|
104
|
+
this.oceanNormalMap = undefined;
|
|
105
|
+
this.zoomedOutOceanSpecularIntensity = 0.5;
|
|
106
|
+
this.enableLighting = false;
|
|
107
|
+
this.dynamicAtmosphereLighting = false;
|
|
108
|
+
this.dynamicAtmosphereLightingFromSun = false;
|
|
109
|
+
this.showGroundAtmosphere = false;
|
|
110
|
+
this.shadows = ShadowMode.RECEIVE_ONLY;
|
|
111
|
+
this.vertexShadowDarkness = 0.3;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The color to use to highlight terrain fill tiles. If undefined, fill tiles are not
|
|
115
|
+
* highlighted at all. The alpha value is used to alpha blend with the tile's
|
|
116
|
+
* actual color. Because terrain fill tiles do not represent the actual terrain surface,
|
|
117
|
+
* it may be useful in some applications to indicate visually that they are not to be trusted.
|
|
118
|
+
* @type {Color}
|
|
119
|
+
* @default undefined
|
|
120
|
+
*/
|
|
121
|
+
this.fillHighlightColor = undefined;
|
|
122
|
+
|
|
123
|
+
this.hueShift = 0.0;
|
|
124
|
+
this.saturationShift = 0.0;
|
|
125
|
+
this.brightnessShift = 0.0;
|
|
126
|
+
|
|
127
|
+
this.showSkirts = true;
|
|
128
|
+
this.backFaceCulling = true;
|
|
129
|
+
this.undergroundColor = undefined;
|
|
130
|
+
this.undergroundColorAlphaByDistance = undefined;
|
|
131
|
+
|
|
132
|
+
this.lambertDiffuseMultiplier = 0.0;
|
|
133
|
+
|
|
134
|
+
this.materialUniformMap = undefined;
|
|
135
|
+
this._materialUniformMap = undefined;
|
|
136
|
+
|
|
137
|
+
this._quadtree = undefined;
|
|
138
|
+
this._terrainProvider = options.terrainProvider;
|
|
139
|
+
this._vectorProvider = options.vectorProvider;
|
|
140
|
+
this._imageryLayers = options.imageryLayers;
|
|
141
|
+
this._surfaceShaderSet = options.surfaceShaderSet;
|
|
142
|
+
|
|
143
|
+
this._renderState = undefined;
|
|
144
|
+
this._blendRenderState = undefined;
|
|
145
|
+
this._disableCullingRenderState = undefined;
|
|
146
|
+
this._disableCullingBlendRenderState = undefined;
|
|
147
|
+
|
|
148
|
+
this._errorEvent = new Event();
|
|
149
|
+
|
|
150
|
+
this._removeLayerAddedListener =
|
|
151
|
+
this._imageryLayers.layerAdded.addEventListener(
|
|
152
|
+
GlobeSurfaceTileProvider.prototype._onLayerAdded,
|
|
153
|
+
this,
|
|
154
|
+
);
|
|
155
|
+
this._removeLayerRemovedListener =
|
|
156
|
+
this._imageryLayers.layerRemoved.addEventListener(
|
|
157
|
+
GlobeSurfaceTileProvider.prototype._onLayerRemoved,
|
|
158
|
+
this,
|
|
159
|
+
);
|
|
160
|
+
this._removeLayerMovedListener =
|
|
161
|
+
this._imageryLayers.layerMoved.addEventListener(
|
|
162
|
+
GlobeSurfaceTileProvider.prototype._onLayerMoved,
|
|
163
|
+
this,
|
|
164
|
+
);
|
|
165
|
+
this._removeLayerShownListener =
|
|
166
|
+
this._imageryLayers.layerShownOrHidden.addEventListener(
|
|
167
|
+
GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,
|
|
168
|
+
this,
|
|
169
|
+
);
|
|
170
|
+
this._imageryLayersUpdatedEvent = new Event();
|
|
124
171
|
|
|
125
|
-
|
|
126
|
-
this._blendRenderState = undefined;
|
|
127
|
-
this._disableCullingRenderState = undefined;
|
|
128
|
-
this._disableCullingBlendRenderState = undefined;
|
|
172
|
+
this._layerOrderChanged = false;
|
|
129
173
|
|
|
130
|
-
|
|
174
|
+
/** @type {QuadtreeTile[][]} */
|
|
175
|
+
this._tilesToRenderByTextureCount = [];
|
|
131
176
|
|
|
132
|
-
|
|
133
|
-
this.
|
|
134
|
-
GlobeSurfaceTileProvider.prototype._onLayerAdded,
|
|
135
|
-
this,
|
|
136
|
-
);
|
|
137
|
-
this._removeLayerRemovedListener =
|
|
138
|
-
this._imageryLayers.layerRemoved.addEventListener(
|
|
139
|
-
GlobeSurfaceTileProvider.prototype._onLayerRemoved,
|
|
140
|
-
this,
|
|
141
|
-
);
|
|
142
|
-
this._removeLayerMovedListener =
|
|
143
|
-
this._imageryLayers.layerMoved.addEventListener(
|
|
144
|
-
GlobeSurfaceTileProvider.prototype._onLayerMoved,
|
|
145
|
-
this,
|
|
146
|
-
);
|
|
147
|
-
this._removeLayerShownListener =
|
|
148
|
-
this._imageryLayers.layerShownOrHidden.addEventListener(
|
|
149
|
-
GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,
|
|
150
|
-
this,
|
|
151
|
-
);
|
|
152
|
-
this._imageryLayersUpdatedEvent = new Event();
|
|
177
|
+
/** @type {DrawCommand[]} */
|
|
178
|
+
this._drawCommands = [];
|
|
153
179
|
|
|
154
|
-
|
|
180
|
+
/** @type {object[]} */
|
|
181
|
+
this._uniformMaps = [];
|
|
155
182
|
|
|
156
|
-
|
|
157
|
-
this._drawCommands = [];
|
|
158
|
-
this._uniformMaps = [];
|
|
159
|
-
this._usedDrawCommands = 0;
|
|
183
|
+
this._usedDrawCommands = 0;
|
|
160
184
|
|
|
161
|
-
|
|
185
|
+
/** @type {VertexArray[]} */
|
|
186
|
+
this._vertexArraysToDestroy = [];
|
|
162
187
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
188
|
+
this._debug = {
|
|
189
|
+
wireframe: false,
|
|
190
|
+
boundingSphereTile: undefined,
|
|
191
|
+
tilesRendered: 0,
|
|
192
|
+
texturesRendered: 0,
|
|
193
|
+
};
|
|
167
194
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
195
|
+
this._baseColor = undefined;
|
|
196
|
+
this._firstPassInitialColor = undefined;
|
|
197
|
+
this.baseColor = new Color(0.0, 0.0, 0.5, 1.0);
|
|
171
198
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
199
|
+
/**
|
|
200
|
+
* A property specifying a {@link ClippingPlaneCollection} used to selectively disable rendering on the outside of each plane.
|
|
201
|
+
* @type {ClippingPlaneCollection}
|
|
202
|
+
* @ignore
|
|
203
|
+
*/
|
|
204
|
+
this._clippingPlanes = undefined;
|
|
178
205
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
206
|
+
/**
|
|
207
|
+
* A property specifying a {@link ClippingPolygonCollection} used to selectively disable rendering inside or outside a list of polygons.
|
|
208
|
+
* @type {ClippingPolygonCollection}
|
|
209
|
+
* @ignore
|
|
210
|
+
*/
|
|
211
|
+
this._clippingPolygons = undefined;
|
|
185
212
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
213
|
+
/**
|
|
214
|
+
* A property specifying a {@link Rectangle} used to selectively limit terrain and imagery rendering.
|
|
215
|
+
* @type {Rectangle}
|
|
216
|
+
*/
|
|
217
|
+
this.cartographicLimitRectangle = Rectangle.clone(Rectangle.MAX_VALUE);
|
|
191
218
|
|
|
192
|
-
|
|
193
|
-
|
|
219
|
+
this._hasLoadedTilesThisFrame = false;
|
|
220
|
+
this._hasFillTilesThisFrame = false;
|
|
194
221
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
222
|
+
this._oldVerticalExaggeration = undefined;
|
|
223
|
+
this._oldVerticalExaggerationRelativeHeight = undefined;
|
|
224
|
+
this._oldSceneMode = SceneMode.SCENE3D;
|
|
225
|
+
}
|
|
199
226
|
|
|
200
|
-
Object.defineProperties(GlobeSurfaceTileProvider.prototype, {
|
|
201
227
|
/**
|
|
202
228
|
* Gets or sets the color of the globe when no imagery is available.
|
|
203
|
-
* @memberof GlobeSurfaceTileProvider.prototype
|
|
204
229
|
* @type {Color}
|
|
205
230
|
*/
|
|
206
|
-
baseColor
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
231
|
+
get baseColor() {
|
|
232
|
+
return this._baseColor;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
set baseColor(value) {
|
|
236
|
+
//>>includeStart('debug', pragmas.debug);
|
|
237
|
+
if (!defined(value)) {
|
|
238
|
+
throw new DeveloperError("value is required.");
|
|
239
|
+
}
|
|
240
|
+
//>>includeEnd('debug');
|
|
241
|
+
|
|
242
|
+
this._baseColor = value;
|
|
243
|
+
this._firstPassInitialColor = Cartesian4.fromColor(
|
|
244
|
+
value,
|
|
245
|
+
this._firstPassInitialColor,
|
|
246
|
+
);
|
|
247
|
+
}
|
|
216
248
|
|
|
217
|
-
this._baseColor = value;
|
|
218
|
-
this._firstPassInitialColor = Cartesian4.fromColor(
|
|
219
|
-
value,
|
|
220
|
-
this._firstPassInitialColor,
|
|
221
|
-
);
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
249
|
/**
|
|
225
250
|
* Gets or sets the {@link QuadtreePrimitive} for which this provider is
|
|
226
251
|
* providing tiles. This property may be undefined if the provider is not yet associated
|
|
227
252
|
* with a {@link QuadtreePrimitive}.
|
|
228
|
-
* @memberof GlobeSurfaceTileProvider.prototype
|
|
229
253
|
* @type {QuadtreePrimitive}
|
|
230
254
|
*/
|
|
231
|
-
quadtree
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
},
|
|
235
|
-
set: function (value) {
|
|
236
|
-
//>>includeStart('debug', pragmas.debug);
|
|
237
|
-
if (!defined(value)) {
|
|
238
|
-
throw new DeveloperError("value is required.");
|
|
239
|
-
}
|
|
240
|
-
//>>includeEnd('debug');
|
|
255
|
+
get quadtree() {
|
|
256
|
+
return this._quadtree;
|
|
257
|
+
}
|
|
241
258
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
259
|
+
set quadtree(value) {
|
|
260
|
+
//>>includeStart('debug', pragmas.debug);
|
|
261
|
+
if (!defined(value)) {
|
|
262
|
+
throw new DeveloperError("value is required.");
|
|
263
|
+
}
|
|
264
|
+
//>>includeEnd('debug');
|
|
265
|
+
|
|
266
|
+
this._quadtree = value;
|
|
267
|
+
}
|
|
245
268
|
|
|
246
269
|
/**
|
|
247
270
|
* Gets the tiling scheme used by the provider.
|
|
248
|
-
* @memberof GlobeSurfaceTileProvider.prototype
|
|
249
271
|
* @type {TilingScheme}
|
|
250
272
|
*/
|
|
251
|
-
tilingScheme
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}
|
|
273
|
+
get tilingScheme() {
|
|
274
|
+
if (!defined(this._terrainProvider)) {
|
|
275
|
+
return undefined;
|
|
276
|
+
}
|
|
256
277
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
278
|
+
// @ts-expect-error Missing types.
|
|
279
|
+
return this._terrainProvider.tilingScheme;
|
|
280
|
+
}
|
|
260
281
|
|
|
261
282
|
/**
|
|
262
283
|
* Gets an event that is raised when the geometry provider encounters an asynchronous error. By subscribing
|
|
263
284
|
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
|
|
264
285
|
* are passed an instance of {@link TileProviderError}.
|
|
265
|
-
* @
|
|
266
|
-
* @type {Event}
|
|
286
|
+
* @type {Event<*>}
|
|
267
287
|
*/
|
|
268
|
-
errorEvent
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
},
|
|
272
|
-
},
|
|
288
|
+
get errorEvent() {
|
|
289
|
+
return this._errorEvent;
|
|
290
|
+
}
|
|
273
291
|
|
|
274
292
|
/**
|
|
275
293
|
* Gets an event that is raised when an imagery layer is added, shown, hidden, moved, or removed.
|
|
276
|
-
* @
|
|
277
|
-
* @type {Event}
|
|
294
|
+
* @type {Event<*>}
|
|
278
295
|
*/
|
|
279
|
-
imageryLayersUpdatedEvent
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
},
|
|
283
|
-
},
|
|
296
|
+
get imageryLayersUpdatedEvent() {
|
|
297
|
+
return this._imageryLayersUpdatedEvent;
|
|
298
|
+
}
|
|
284
299
|
|
|
285
300
|
/**
|
|
286
301
|
* Gets or sets the terrain provider that describes the surface geometry.
|
|
287
|
-
* @memberof GlobeSurfaceTileProvider.prototype
|
|
288
302
|
* @type {TerrainProvider}
|
|
289
303
|
*/
|
|
290
|
-
terrainProvider
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
304
|
+
get terrainProvider() {
|
|
305
|
+
return this._terrainProvider;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
set terrainProvider(terrainProvider) {
|
|
309
|
+
if (this._terrainProvider === terrainProvider) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
298
312
|
|
|
299
|
-
|
|
313
|
+
this._terrainProvider = terrainProvider;
|
|
314
|
+
|
|
315
|
+
if (defined(this._quadtree)) {
|
|
316
|
+
this._quadtree.invalidateAllTiles();
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/** @type {VectorProvider} */
|
|
321
|
+
get vectorProvider() {
|
|
322
|
+
return this._vectorProvider;
|
|
323
|
+
}
|
|
300
324
|
|
|
301
|
-
if (defined(this._quadtree)) {
|
|
302
|
-
this._quadtree.invalidateAllTiles();
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
},
|
|
306
325
|
/**
|
|
307
326
|
* The {@link ClippingPlaneCollection} used to selectively disable rendering.
|
|
308
327
|
*
|
|
309
328
|
* @type {ClippingPlaneCollection}
|
|
310
329
|
*
|
|
311
|
-
* @
|
|
330
|
+
* @ignore
|
|
312
331
|
*/
|
|
313
|
-
clippingPlanes
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
},
|
|
332
|
+
get clippingPlanes() {
|
|
333
|
+
return this._clippingPlanes;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
set clippingPlanes(value) {
|
|
337
|
+
ClippingPlaneCollection.setOwner(value, this, "_clippingPlanes");
|
|
338
|
+
}
|
|
321
339
|
|
|
322
340
|
/**
|
|
323
341
|
* The {@link ClippingPolygonCollection} used to selectively disable rendering inside or outside a list of polygons.
|
|
324
342
|
*
|
|
325
343
|
* @type {ClippingPolygonCollection}
|
|
326
344
|
*
|
|
327
|
-
* @
|
|
345
|
+
* @ignore
|
|
328
346
|
*/
|
|
329
|
-
clippingPolygons
|
|
330
|
-
|
|
331
|
-
return this._clippingPolygons;
|
|
332
|
-
},
|
|
333
|
-
set: function (value) {
|
|
334
|
-
ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
function sortTileImageryByLayerIndex(a, b) {
|
|
340
|
-
let aImagery = a.loadingImagery;
|
|
341
|
-
if (!defined(aImagery)) {
|
|
342
|
-
aImagery = a.readyImagery;
|
|
347
|
+
get clippingPolygons() {
|
|
348
|
+
return this._clippingPolygons;
|
|
343
349
|
}
|
|
344
350
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
bImagery = b.readyImagery;
|
|
351
|
+
set clippingPolygons(value) {
|
|
352
|
+
ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
|
|
348
353
|
}
|
|
349
354
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
// update collection: imagery indices, base layers, raise layer show/hide event
|
|
358
|
-
this._imageryLayers._update();
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
function updateCredits(surface, frameState) {
|
|
362
|
-
const creditDisplay = frameState.creditDisplay;
|
|
363
|
-
const terrainProvider = surface._terrainProvider;
|
|
364
|
-
if (defined(terrainProvider) && defined(terrainProvider.credit)) {
|
|
365
|
-
creditDisplay.addCreditToNextFrame(terrainProvider.credit);
|
|
355
|
+
/**
|
|
356
|
+
* Make updates to the tile provider that are not involved in rendering. Called before the render update cycle.
|
|
357
|
+
* @param {FrameState} frameState
|
|
358
|
+
*/
|
|
359
|
+
update(frameState) {
|
|
360
|
+
// update collection: imagery indices, base layers, raise layer show/hide event
|
|
361
|
+
this._imageryLayers._update();
|
|
366
362
|
}
|
|
367
363
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
364
|
+
/**
|
|
365
|
+
* Called at the beginning of each render frame, before {@link QuadtreeTileProvider#showTileThisFrame}
|
|
366
|
+
* @param {FrameState} frameState The frame state.
|
|
367
|
+
*/
|
|
368
|
+
initialize(frameState) {
|
|
369
|
+
// update each layer for texture reprojection.
|
|
370
|
+
this._imageryLayers.queueReprojectionCommands(frameState);
|
|
371
|
+
|
|
372
|
+
if (this._layerOrderChanged) {
|
|
373
|
+
this._layerOrderChanged = false;
|
|
374
|
+
|
|
375
|
+
// Sort the TileImagery instances in each tile by the layer index.
|
|
376
|
+
this._quadtree.forEachLoadedTile(
|
|
377
|
+
/** @param {QuadtreeTile} tile */
|
|
378
|
+
function (tile) {
|
|
379
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
380
|
+
surfaceTile.imagery.sort(sortTileImageryByLayerIndex);
|
|
381
|
+
},
|
|
382
|
+
);
|
|
373
383
|
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Called at the beginning of each render frame, before {@link QuadtreeTileProvider#showTileThisFrame}
|
|
379
|
-
* @param {FrameState} frameState The frame state.
|
|
380
|
-
*/
|
|
381
|
-
GlobeSurfaceTileProvider.prototype.initialize = function (frameState) {
|
|
382
|
-
// update each layer for texture reprojection.
|
|
383
|
-
this._imageryLayers.queueReprojectionCommands(frameState);
|
|
384
|
-
|
|
385
|
-
if (this._layerOrderChanged) {
|
|
386
|
-
this._layerOrderChanged = false;
|
|
387
384
|
|
|
388
|
-
//
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
385
|
+
// Record regions dirtied by changed collections, re-bake overlapping
|
|
386
|
+
// tiles, and build vector data for new surface tiles.
|
|
387
|
+
const vectorProvider = this._vectorProvider;
|
|
388
|
+
vectorProvider.update();
|
|
389
|
+
this._quadtree.forEachRenderedTile(
|
|
390
|
+
/** @param {QuadtreeTile} tile */
|
|
391
|
+
(tile) => {
|
|
392
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
393
|
+
|
|
394
|
+
if (defined(surfaceTile.vectorData)) {
|
|
395
|
+
surfaceTile.vectorData = vectorProvider.updateTileData(
|
|
396
|
+
tile.x,
|
|
397
|
+
tile.y,
|
|
398
|
+
tile.level,
|
|
399
|
+
frameState.context,
|
|
400
|
+
surfaceTile.vectorData,
|
|
401
|
+
);
|
|
402
|
+
} else {
|
|
403
|
+
surfaceTile.vectorData = vectorProvider.requestTileData(
|
|
404
|
+
tile.x,
|
|
405
|
+
tile.y,
|
|
406
|
+
tile.level,
|
|
407
|
+
frameState.context,
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
);
|
|
412
|
+
vectorProvider.makeClean();
|
|
393
413
|
|
|
394
|
-
|
|
395
|
-
|
|
414
|
+
// Add credits for terrain and imagery providers.
|
|
415
|
+
updateCredits(this, frameState);
|
|
396
416
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
417
|
+
const vertexArraysToDestroy = this._vertexArraysToDestroy;
|
|
418
|
+
const length = vertexArraysToDestroy.length;
|
|
419
|
+
for (let j = 0; j < length; ++j) {
|
|
420
|
+
GlobeSurfaceTile._freeVertexArray(vertexArraysToDestroy[j]);
|
|
421
|
+
}
|
|
422
|
+
vertexArraysToDestroy.length = 0;
|
|
401
423
|
}
|
|
402
|
-
vertexArraysToDestroy.length = 0;
|
|
403
|
-
};
|
|
404
424
|
|
|
405
|
-
/**
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
425
|
+
/**
|
|
426
|
+
* Called at the beginning of the update cycle for each render frame, before {@link QuadtreeTileProvider#showTileThisFrame}
|
|
427
|
+
* or any other functions.
|
|
428
|
+
*
|
|
429
|
+
* @param {FrameState} frameState The frame state.
|
|
430
|
+
*/
|
|
431
|
+
beginUpdate(frameState) {
|
|
432
|
+
const tilesToRenderByTextureCount = this._tilesToRenderByTextureCount;
|
|
433
|
+
for (let i = 0, len = tilesToRenderByTextureCount.length; i < len; ++i) {
|
|
434
|
+
const tiles = tilesToRenderByTextureCount[i];
|
|
435
|
+
if (defined(tiles)) {
|
|
436
|
+
tiles.length = 0;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
// update clipping planes
|
|
440
|
+
const clippingPlanes = this._clippingPlanes;
|
|
441
|
+
// @ts-expect-error Missing types.
|
|
442
|
+
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
443
|
+
clippingPlanes.update(frameState);
|
|
417
444
|
}
|
|
418
|
-
}
|
|
419
|
-
// update clipping planes
|
|
420
|
-
const clippingPlanes = this._clippingPlanes;
|
|
421
|
-
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
422
|
-
clippingPlanes.update(frameState);
|
|
423
|
-
}
|
|
424
445
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
446
|
+
// update clipping polygons
|
|
447
|
+
const clippingPolygons = this._clippingPolygons;
|
|
448
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
449
|
+
// @ts-expect-error Missing types.
|
|
450
|
+
clippingPolygons.update(frameState);
|
|
451
|
+
// @ts-expect-error Missing types.
|
|
452
|
+
clippingPolygons.queueCommands(frameState);
|
|
453
|
+
}
|
|
431
454
|
|
|
432
|
-
|
|
455
|
+
this._usedDrawCommands = 0;
|
|
433
456
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
457
|
+
this._hasLoadedTilesThisFrame = false;
|
|
458
|
+
this._hasFillTilesThisFrame = false;
|
|
459
|
+
}
|
|
437
460
|
|
|
438
|
-
/**
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
461
|
+
/**
|
|
462
|
+
* Called at the end of the update cycle for each render frame, after {@link QuadtreeTileProvider#showTileThisFrame}
|
|
463
|
+
* and any other functions.
|
|
464
|
+
*
|
|
465
|
+
* @param {FrameState} frameState The frame state.
|
|
466
|
+
*/
|
|
467
|
+
endUpdate(frameState) {
|
|
468
|
+
if (!defined(this._renderState)) {
|
|
469
|
+
this._renderState = RenderState.fromCache({
|
|
470
|
+
// Write color and depth
|
|
471
|
+
cull: {
|
|
472
|
+
enabled: true,
|
|
473
|
+
},
|
|
474
|
+
depthTest: {
|
|
475
|
+
enabled: true,
|
|
476
|
+
func: DepthFunction.LESS,
|
|
477
|
+
},
|
|
478
|
+
});
|
|
456
479
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
480
|
+
this._blendRenderState = RenderState.fromCache({
|
|
481
|
+
// Write color and depth
|
|
482
|
+
cull: {
|
|
483
|
+
enabled: true,
|
|
484
|
+
},
|
|
485
|
+
depthTest: {
|
|
486
|
+
enabled: true,
|
|
487
|
+
func: DepthFunction.LESS_OR_EQUAL,
|
|
488
|
+
},
|
|
489
|
+
blending: BlendingState.ALPHA_BLEND,
|
|
490
|
+
});
|
|
468
491
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
492
|
+
let rs = /** @type {RenderState} */ (clone(this._renderState, true));
|
|
493
|
+
rs.cull.enabled = false;
|
|
494
|
+
this._disableCullingRenderState = RenderState.fromCache(rs);
|
|
472
495
|
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
496
|
+
rs = /** @type {RenderState} */ (clone(this._blendRenderState, true));
|
|
497
|
+
rs.cull.enabled = false;
|
|
498
|
+
this._disableCullingBlendRenderState = RenderState.fromCache(rs);
|
|
499
|
+
}
|
|
477
500
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
501
|
+
// If this frame has a mix of loaded and fill tiles, we need to propagate
|
|
502
|
+
// loaded heights to the fill tiles.
|
|
503
|
+
if (this._hasFillTilesThisFrame && this._hasLoadedTilesThisFrame) {
|
|
504
|
+
TerrainFillMesh.updateFillTiles(
|
|
505
|
+
this,
|
|
506
|
+
this._quadtree._tilesToRender,
|
|
507
|
+
frameState,
|
|
508
|
+
this._vertexArraysToDestroy,
|
|
509
|
+
);
|
|
510
|
+
}
|
|
488
511
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
512
|
+
// When vertical exaggeration changes, all of the loaded tiles need to generate
|
|
513
|
+
// geodetic surface normals so they can scale properly when rendered.
|
|
514
|
+
// When exaggeration is reset, geodetic surface normals are removed to decrease
|
|
515
|
+
// memory usage. Some tiles might have been constructed with the correct
|
|
516
|
+
// exaggeration already, so skip over them.
|
|
494
517
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
518
|
+
// If the geodetic surface normals can't be created because the tile doesn't
|
|
519
|
+
// have a mesh, keep checking until the tile does have a mesh. This can happen
|
|
520
|
+
// if the tile's mesh starts construction in a worker thread right before the
|
|
521
|
+
// exaggeration changes.
|
|
499
522
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
// Keep track of the next time there is a change in exaggeration
|
|
509
|
-
this._oldVerticalExaggeration = exaggeration;
|
|
510
|
-
this._oldVerticalExaggerationRelativeHeight = exaggerationRelativeHeight;
|
|
511
|
-
|
|
512
|
-
if (exaggerationChanged) {
|
|
513
|
-
quadtree.forEachLoadedTile(function (tile) {
|
|
514
|
-
const surfaceTile = tile.data;
|
|
515
|
-
surfaceTile.updateExaggeration(tile, frameState, quadtree);
|
|
516
|
-
});
|
|
517
|
-
}
|
|
523
|
+
const quadtree = this.quadtree;
|
|
524
|
+
const exaggeration = frameState.verticalExaggeration;
|
|
525
|
+
const exaggerationRelativeHeight =
|
|
526
|
+
frameState.verticalExaggerationRelativeHeight;
|
|
527
|
+
const exaggerationChanged =
|
|
528
|
+
this._oldVerticalExaggeration !== exaggeration ||
|
|
529
|
+
this._oldVerticalExaggerationRelativeHeight !==
|
|
530
|
+
exaggerationRelativeHeight;
|
|
518
531
|
|
|
519
|
-
|
|
520
|
-
|
|
532
|
+
// Keep track of the next time there is a change in exaggeration
|
|
533
|
+
this._oldVerticalExaggeration = exaggeration;
|
|
534
|
+
this._oldVerticalExaggerationRelativeHeight = exaggerationRelativeHeight;
|
|
535
|
+
|
|
536
|
+
if (exaggerationChanged) {
|
|
537
|
+
quadtree.forEachLoadedTile(
|
|
538
|
+
/** @param {QuadtreeTile} tile */
|
|
539
|
+
function (tile) {
|
|
540
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
541
|
+
surfaceTile.updateExaggeration(tile, frameState, quadtree);
|
|
542
|
+
},
|
|
543
|
+
);
|
|
544
|
+
}
|
|
521
545
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
const surfaceTile = tile.data;
|
|
525
|
-
surfaceTile.updateSceneMode(frameState.mode);
|
|
526
|
-
});
|
|
527
|
-
}
|
|
546
|
+
const sceneModeChanged = this._oldSceneMode !== frameState.mode;
|
|
547
|
+
this._oldSceneMode = frameState.mode;
|
|
528
548
|
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
const tilesToRender = tilesToRenderByTextureCount[textureCountIndex];
|
|
538
|
-
if (!defined(tilesToRender)) {
|
|
539
|
-
continue;
|
|
549
|
+
if (sceneModeChanged) {
|
|
550
|
+
quadtree.forEachLoadedTile(
|
|
551
|
+
/** @param {QuadtreeTile} tile */
|
|
552
|
+
function (tile) {
|
|
553
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
554
|
+
surfaceTile.updateSceneMode(frameState.mode);
|
|
555
|
+
},
|
|
556
|
+
);
|
|
540
557
|
}
|
|
541
558
|
|
|
559
|
+
// Add the tile render commands to the command list, sorted by texture count.
|
|
560
|
+
const tilesToRenderByTextureCount = this._tilesToRenderByTextureCount;
|
|
542
561
|
for (
|
|
543
|
-
let
|
|
544
|
-
|
|
545
|
-
|
|
562
|
+
let textureCountIndex = 0,
|
|
563
|
+
textureCountLength = tilesToRenderByTextureCount.length;
|
|
564
|
+
textureCountIndex < textureCountLength;
|
|
565
|
+
++textureCountIndex
|
|
546
566
|
) {
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
567
|
+
const tilesToRender = tilesToRenderByTextureCount[textureCountIndex];
|
|
568
|
+
if (!defined(tilesToRender)) {
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
for (
|
|
573
|
+
let tileIndex = 0, tileLength = tilesToRender.length;
|
|
574
|
+
tileIndex < tileLength;
|
|
575
|
+
++tileIndex
|
|
576
|
+
) {
|
|
577
|
+
const tile = tilesToRender[tileIndex];
|
|
578
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
579
|
+
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
580
|
+
addDrawCommandsForTile(this, tile, frameState);
|
|
581
|
+
frameState.minimumTerrainHeight = Math.min(
|
|
582
|
+
frameState.minimumTerrainHeight,
|
|
583
|
+
tileBoundingRegion.minimumHeight,
|
|
584
|
+
);
|
|
585
|
+
}
|
|
554
586
|
}
|
|
555
587
|
}
|
|
556
|
-
};
|
|
557
588
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
)
|
|
567
|
-
|
|
568
|
-
|
|
589
|
+
/**
|
|
590
|
+
* Adds draw commands for tiles rendered in the previous frame for a pick pass.
|
|
591
|
+
*
|
|
592
|
+
* @param {FrameState} frameState The frame state.
|
|
593
|
+
*/
|
|
594
|
+
updateForPick(frameState) {
|
|
595
|
+
// Add the tile pick commands from the tiles drawn last frame.
|
|
596
|
+
const drawCommands = this._drawCommands;
|
|
597
|
+
for (let i = 0, length = this._usedDrawCommands; i < length; ++i) {
|
|
598
|
+
pushCommand(drawCommands[i], frameState);
|
|
599
|
+
}
|
|
569
600
|
}
|
|
570
|
-
}
|
|
571
601
|
|
|
572
|
-
/**
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
GlobeSurfaceTileProvider.prototype.updateForPick = function (frameState) {
|
|
578
|
-
// Add the tile pick commands from the tiles drawn last frame.
|
|
579
|
-
const drawCommands = this._drawCommands;
|
|
580
|
-
for (let i = 0, length = this._usedDrawCommands; i < length; ++i) {
|
|
581
|
-
pushCommand(drawCommands[i], frameState);
|
|
602
|
+
/**
|
|
603
|
+
* Cancels any imagery re-projections in the queue.
|
|
604
|
+
*/
|
|
605
|
+
cancelReprojections() {
|
|
606
|
+
this._imageryLayers.cancelReprojections();
|
|
582
607
|
}
|
|
583
|
-
};
|
|
584
608
|
|
|
585
|
-
/**
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
609
|
+
/**
|
|
610
|
+
* Gets the maximum geometric error allowed in a tile at a given level, in meters.
|
|
611
|
+
*
|
|
612
|
+
* @param {number} level The tile level for which to get the maximum geometric error.
|
|
613
|
+
* @returns {number} The maximum geometric error in meters.
|
|
614
|
+
*/
|
|
615
|
+
getLevelMaximumGeometricError(level) {
|
|
616
|
+
if (!defined(this._terrainProvider)) {
|
|
617
|
+
return 0;
|
|
618
|
+
}
|
|
591
619
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
*
|
|
595
|
-
* @param {number} level The tile level for which to get the maximum geometric error.
|
|
596
|
-
* @returns {number} The maximum geometric error in meters.
|
|
597
|
-
*/
|
|
598
|
-
GlobeSurfaceTileProvider.prototype.getLevelMaximumGeometricError = function (
|
|
599
|
-
level,
|
|
600
|
-
) {
|
|
601
|
-
if (!defined(this._terrainProvider)) {
|
|
602
|
-
return 0;
|
|
620
|
+
// @ts-expect-error Missing types.
|
|
621
|
+
return this._terrainProvider.getLevelMaximumGeometricError(level);
|
|
603
622
|
}
|
|
604
623
|
|
|
605
|
-
|
|
606
|
-
|
|
624
|
+
/**
|
|
625
|
+
* Loads, or continues loading, a given tile. This function will continue to be called
|
|
626
|
+
* until {@link QuadtreeTile#state} is no longer {@link QuadtreeTileLoadState#LOADING}.
|
|
627
|
+
*
|
|
628
|
+
* @param {FrameState} frameState The frame state.
|
|
629
|
+
* @param {QuadtreeTile} tile The tile to load.
|
|
630
|
+
*/
|
|
631
|
+
loadTile(frameState, tile) {
|
|
632
|
+
// We don't want to load imagery until we're certain that the terrain tiles are actually visible.
|
|
633
|
+
// So if our bounding volume isn't accurate because it came from another tile, load terrain only
|
|
634
|
+
// initially. If we load some terrain and suddenly have a more accurate bounding volume and the
|
|
635
|
+
// tile is _still_ visible, give the tile a chance to load imagery immediately rather than
|
|
636
|
+
// waiting for next frame.
|
|
637
|
+
|
|
638
|
+
let surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
639
|
+
let terrainOnly = true;
|
|
640
|
+
let terrainStateBefore;
|
|
641
|
+
if (defined(surfaceTile)) {
|
|
642
|
+
terrainOnly =
|
|
643
|
+
surfaceTile.boundingVolumeSourceTile !== tile ||
|
|
644
|
+
tile._lastSelectionResult === TileSelectionResult.CULLED_BUT_NEEDED;
|
|
645
|
+
terrainStateBefore = surfaceTile.terrainState;
|
|
646
|
+
}
|
|
607
647
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
// initially. If we load some terrain and suddenly have a more accurate bounding volume and the
|
|
619
|
-
// tile is _still_ visible, give the tile a chance to load imagery immediately rather than
|
|
620
|
-
// waiting for next frame.
|
|
621
|
-
|
|
622
|
-
let surfaceTile = tile.data;
|
|
623
|
-
let terrainOnly = true;
|
|
624
|
-
let terrainStateBefore;
|
|
625
|
-
if (defined(surfaceTile)) {
|
|
626
|
-
terrainOnly =
|
|
627
|
-
surfaceTile.boundingVolumeSourceTile !== tile ||
|
|
628
|
-
tile._lastSelectionResult === TileSelectionResult.CULLED_BUT_NEEDED;
|
|
629
|
-
terrainStateBefore = surfaceTile.terrainState;
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
GlobeSurfaceTile.processStateMachine(
|
|
633
|
-
tile,
|
|
634
|
-
frameState,
|
|
635
|
-
this.terrainProvider,
|
|
636
|
-
this._imageryLayers,
|
|
637
|
-
this.quadtree,
|
|
638
|
-
this._vertexArraysToDestroy,
|
|
639
|
-
terrainOnly,
|
|
640
|
-
);
|
|
648
|
+
GlobeSurfaceTile.processStateMachine(
|
|
649
|
+
tile,
|
|
650
|
+
frameState,
|
|
651
|
+
this.terrainProvider,
|
|
652
|
+
this.vectorProvider,
|
|
653
|
+
this._imageryLayers,
|
|
654
|
+
this.quadtree,
|
|
655
|
+
this._vertexArraysToDestroy,
|
|
656
|
+
terrainOnly,
|
|
657
|
+
);
|
|
641
658
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
tile
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
659
|
+
surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
660
|
+
if (terrainOnly && terrainStateBefore !== surfaceTile.terrainState) {
|
|
661
|
+
// Terrain state changed. If:
|
|
662
|
+
// a) The tile is visible, and
|
|
663
|
+
// b) The bounding volume is accurate (updated as a side effect of computing visibility)
|
|
664
|
+
// Then we'll load imagery, too.
|
|
665
|
+
if (
|
|
666
|
+
this.computeTileVisibility(
|
|
667
|
+
tile,
|
|
668
|
+
frameState,
|
|
669
|
+
// @ts-expect-error Missing types.
|
|
670
|
+
this.quadtree.occluders,
|
|
671
|
+
) !== Visibility.NONE &&
|
|
672
|
+
surfaceTile.boundingVolumeSourceTile === tile
|
|
673
|
+
) {
|
|
674
|
+
terrainOnly = false;
|
|
675
|
+
GlobeSurfaceTile.processStateMachine(
|
|
676
|
+
tile,
|
|
677
|
+
frameState,
|
|
678
|
+
this.terrainProvider,
|
|
679
|
+
this.vectorProvider,
|
|
680
|
+
this._imageryLayers,
|
|
681
|
+
this.quadtree,
|
|
682
|
+
this._vertexArraysToDestroy,
|
|
683
|
+
terrainOnly,
|
|
684
|
+
);
|
|
685
|
+
}
|
|
663
686
|
}
|
|
664
687
|
}
|
|
665
|
-
};
|
|
666
688
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
)
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
+
/**
|
|
690
|
+
* Determines the visibility of a given tile. The tile may be fully visible, partially visible, or not
|
|
691
|
+
* visible at all. Tiles that are renderable and are at least partially visible will be shown by a call
|
|
692
|
+
* to {@link GlobeSurfaceTileProvider#showTileThisFrame}.
|
|
693
|
+
*
|
|
694
|
+
* @param {QuadtreeTile} tile The tile instance.
|
|
695
|
+
* @param {FrameState} frameState The state information about the current frame.
|
|
696
|
+
* @param {QuadtreeOccluders} occluders The objects that may occlude this tile.
|
|
697
|
+
*
|
|
698
|
+
* @returns {Visibility} Visibility.NONE if the tile is not visible,
|
|
699
|
+
* Visibility.PARTIAL if the tile is partially visible, or
|
|
700
|
+
* Visibility.FULL if the tile is fully visible.
|
|
701
|
+
*/
|
|
702
|
+
computeTileVisibility(tile, frameState, occluders) {
|
|
703
|
+
const distance = this.computeDistanceToTile(tile, frameState);
|
|
704
|
+
tile._distance = distance;
|
|
705
|
+
|
|
706
|
+
// Translated Columbus-world copies may be visible even when the tile's
|
|
707
|
+
// primary position is not. Resolve them up front so fog and frustum tests
|
|
708
|
+
// account for every copy, and use the nearest copy for LOD distance.
|
|
709
|
+
let columbusOffsets;
|
|
710
|
+
if (isColumbusRepeatActive(frameState)) {
|
|
711
|
+
columbusOffsets = computeColumbusTileWorldOffsets(this, tile, frameState);
|
|
712
|
+
if (defined(columbusOffsets)) {
|
|
713
|
+
if (columbusOffsets.length === 0) {
|
|
714
|
+
return Visibility.NONE;
|
|
715
|
+
}
|
|
716
|
+
tile._distance = nearestColumbusSphereDistance(
|
|
717
|
+
frameState.camera.positionWC,
|
|
718
|
+
columbusTileSphereScratch,
|
|
719
|
+
columbusOffsets,
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
689
723
|
|
|
690
|
-
|
|
691
|
-
if (frameState.cameraUnderground) {
|
|
692
|
-
return true;
|
|
693
|
-
}
|
|
724
|
+
const undergroundVisible = isUndergroundVisible(this, frameState);
|
|
694
725
|
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
726
|
+
if (frameState.fog.enabled && !undergroundVisible) {
|
|
727
|
+
if (CesiumMath.fog(tile._distance, frameState.fog.density) >= 1.0) {
|
|
728
|
+
// Tile is completely in fog so return that it is not visible.
|
|
729
|
+
return Visibility.NONE;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
698
732
|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}
|
|
733
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
734
|
+
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
702
735
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
736
|
+
if (surfaceTile.boundingVolumeSourceTile === undefined) {
|
|
737
|
+
// We have no idea where this tile is, so let's just call it partially visible.
|
|
738
|
+
return Visibility.PARTIAL;
|
|
739
|
+
}
|
|
707
740
|
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
}
|
|
741
|
+
const cullingVolume = frameState.cullingVolume;
|
|
742
|
+
// @ts-expect-error Missing types.
|
|
743
|
+
let boundingVolume = tileBoundingRegion.boundingVolume;
|
|
712
744
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
)
|
|
718
|
-
) {
|
|
719
|
-
return true;
|
|
720
|
-
}
|
|
745
|
+
if (!defined(boundingVolume)) {
|
|
746
|
+
// @ts-expect-error Missing types.
|
|
747
|
+
boundingVolume = tileBoundingRegion.boundingSphere;
|
|
748
|
+
}
|
|
721
749
|
|
|
722
|
-
|
|
723
|
-
|
|
750
|
+
// Check if the tile is outside the limit area in cartographic space
|
|
751
|
+
surfaceTile.clippedByBoundaries = false;
|
|
752
|
+
const clippedCartographicLimitRectangle = clipRectangleAntimeridian(
|
|
753
|
+
tile.rectangle,
|
|
754
|
+
this.cartographicLimitRectangle,
|
|
755
|
+
);
|
|
756
|
+
const areaLimitIntersection = Rectangle.simpleIntersection(
|
|
757
|
+
clippedCartographicLimitRectangle,
|
|
758
|
+
tile.rectangle,
|
|
759
|
+
rectangleIntersectionScratch,
|
|
760
|
+
);
|
|
761
|
+
if (!defined(areaLimitIntersection)) {
|
|
762
|
+
return Visibility.NONE;
|
|
763
|
+
}
|
|
764
|
+
if (!Rectangle.equals(areaLimitIntersection, tile.rectangle)) {
|
|
765
|
+
surfaceTile.clippedByBoundaries = true;
|
|
766
|
+
}
|
|
724
767
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
768
|
+
if (frameState.mode !== SceneMode.SCENE3D) {
|
|
769
|
+
boundingVolume = boundingSphereScratch;
|
|
770
|
+
BoundingSphere.fromRectangleWithHeights2D(
|
|
771
|
+
tile.rectangle,
|
|
772
|
+
frameState.mapProjection,
|
|
773
|
+
tileBoundingRegion.minimumHeight,
|
|
774
|
+
tileBoundingRegion.maximumHeight,
|
|
775
|
+
boundingVolume,
|
|
776
|
+
);
|
|
777
|
+
Cartesian3.fromElements(
|
|
778
|
+
boundingVolume.center.z,
|
|
779
|
+
boundingVolume.center.x,
|
|
780
|
+
boundingVolume.center.y,
|
|
781
|
+
boundingVolume.center,
|
|
782
|
+
);
|
|
783
|
+
|
|
784
|
+
if (
|
|
785
|
+
frameState.mode === SceneMode.MORPHING &&
|
|
786
|
+
defined(surfaceTile.renderedMesh)
|
|
787
|
+
) {
|
|
788
|
+
boundingVolume = BoundingSphere.union(
|
|
789
|
+
// @ts-expect-error Missing types.
|
|
790
|
+
tileBoundingRegion.boundingSphere,
|
|
791
|
+
boundingVolume,
|
|
792
|
+
boundingVolume,
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
if (!defined(boundingVolume)) {
|
|
798
|
+
return Visibility.PARTIAL;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
const clippingPlanes = this._clippingPlanes;
|
|
802
|
+
// @ts-expect-error Missing types.
|
|
803
|
+
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
804
|
+
const planeIntersection =
|
|
805
|
+
clippingPlanes.computeIntersectionWithBoundingVolume(boundingVolume);
|
|
806
|
+
// @ts-expect-error Possibly an error? isClipped is defined on surfaceTile, not tile.
|
|
807
|
+
tile.isClipped = planeIntersection !== Intersect.INSIDE;
|
|
808
|
+
if (planeIntersection === Intersect.OUTSIDE) {
|
|
758
809
|
return Visibility.NONE;
|
|
759
810
|
}
|
|
760
|
-
tile._distance = nearestColumbusSphereDistance(
|
|
761
|
-
frameState.camera.positionWC,
|
|
762
|
-
columbusTileSphereScratch,
|
|
763
|
-
columbusOffsets,
|
|
764
|
-
);
|
|
765
811
|
}
|
|
766
|
-
}
|
|
767
812
|
|
|
768
|
-
|
|
813
|
+
const clippingPolygons = this._clippingPolygons;
|
|
814
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
815
|
+
const polygonIntersection =
|
|
816
|
+
clippingPolygons.computeIntersectionWithBoundingVolume(
|
|
817
|
+
tileBoundingRegion,
|
|
818
|
+
);
|
|
819
|
+
// @ts-expect-error Possibly an error? isClipped is defined on surfaceTile, not tile.
|
|
820
|
+
tile.isClipped = polygonIntersection !== Intersect.OUTSIDE;
|
|
821
|
+
// Polygon clipping intersections are determined by outer rectangles, therefore we cannot
|
|
822
|
+
// preemptively determine if a tile is completely clipped or not here.
|
|
823
|
+
}
|
|
769
824
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
825
|
+
let visibility;
|
|
826
|
+
const intersection = cullingVolume.computeVisibility(boundingVolume);
|
|
827
|
+
|
|
828
|
+
if (intersection === Intersect.OUTSIDE) {
|
|
829
|
+
visibility = Visibility.NONE;
|
|
830
|
+
} else if (intersection === Intersect.INTERSECTING) {
|
|
831
|
+
visibility = Visibility.PARTIAL;
|
|
832
|
+
} else if (intersection === Intersect.INSIDE) {
|
|
833
|
+
visibility = Visibility.FULL;
|
|
774
834
|
}
|
|
775
|
-
}
|
|
776
835
|
|
|
777
|
-
|
|
778
|
-
|
|
836
|
+
if (
|
|
837
|
+
visibility === Visibility.NONE &&
|
|
838
|
+
defined(columbusOffsets) &&
|
|
839
|
+
columbusOffsets.length > 0
|
|
840
|
+
) {
|
|
841
|
+
// The primary tile is outside the frustum, but a translated copy is visible.
|
|
842
|
+
visibility = Visibility.PARTIAL;
|
|
843
|
+
}
|
|
779
844
|
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
}
|
|
845
|
+
if (visibility === Visibility.NONE) {
|
|
846
|
+
return visibility;
|
|
847
|
+
}
|
|
784
848
|
|
|
785
|
-
|
|
786
|
-
|
|
849
|
+
const ortho3D =
|
|
850
|
+
frameState.mode === SceneMode.SCENE3D &&
|
|
851
|
+
frameState.camera.frustum instanceof OrthographicFrustum;
|
|
852
|
+
if (
|
|
853
|
+
frameState.mode === SceneMode.SCENE3D &&
|
|
854
|
+
!ortho3D &&
|
|
855
|
+
defined(occluders) &&
|
|
856
|
+
!undergroundVisible
|
|
857
|
+
) {
|
|
858
|
+
const occludeePointInScaledSpace = surfaceTile.occludeePointInScaledSpace;
|
|
859
|
+
if (!defined(occludeePointInScaledSpace)) {
|
|
860
|
+
return visibility;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
if (
|
|
864
|
+
occluders.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(
|
|
865
|
+
occludeePointInScaledSpace,
|
|
866
|
+
tileBoundingRegion.minimumHeight,
|
|
867
|
+
)
|
|
868
|
+
) {
|
|
869
|
+
return visibility;
|
|
870
|
+
}
|
|
787
871
|
|
|
788
|
-
|
|
789
|
-
|
|
872
|
+
return Visibility.NONE;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
return visibility;
|
|
790
876
|
}
|
|
791
877
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
)
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
tile.
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
878
|
+
/**
|
|
879
|
+
* Determines if the given tile can be refined
|
|
880
|
+
* @param {QuadtreeTile} tile The tile to check.
|
|
881
|
+
* @returns {boolean} True if the tile can be refined, false if it cannot.
|
|
882
|
+
*/
|
|
883
|
+
canRefine(tile) {
|
|
884
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
885
|
+
|
|
886
|
+
// Only allow refinement it we know whether or not the children of this tile exist.
|
|
887
|
+
// For a tileset with `availability`, we'll always be able to refine.
|
|
888
|
+
// We can ask for availability of _any_ child tile because we only need to confirm
|
|
889
|
+
// that we get a yes or no answer, it doesn't matter what the answer is.
|
|
890
|
+
if (defined(surfaceTile.terrainData)) {
|
|
891
|
+
return true;
|
|
892
|
+
}
|
|
893
|
+
const childAvailable = this.terrainProvider.getTileDataAvailable(
|
|
894
|
+
// @ts-expect-error Missing types.
|
|
895
|
+
tile.x * 2,
|
|
896
|
+
tile.y * 2,
|
|
897
|
+
tile.level + 1,
|
|
898
|
+
);
|
|
899
|
+
return childAvailable !== undefined;
|
|
805
900
|
}
|
|
806
|
-
|
|
807
|
-
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Determines if the given not-fully-loaded tile can be rendered without losing detail that
|
|
904
|
+
* was present last frame as a result of rendering descendant tiles. This method will only be
|
|
905
|
+
* called if this tile's descendants were rendered last frame. If the tile is fully loaded,
|
|
906
|
+
* it is assumed that this method will return true and it will not be called.
|
|
907
|
+
* @param {QuadtreeTile} tile The tile to check.
|
|
908
|
+
* @returns {boolean} True if the tile can be rendered without losing detail.
|
|
909
|
+
*/
|
|
910
|
+
canRenderWithoutLosingDetail(tile) {
|
|
911
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
912
|
+
|
|
913
|
+
const readyImagery = readyImageryScratch;
|
|
914
|
+
// @ts-expect-error Missing types.
|
|
915
|
+
readyImagery.length = this._imageryLayers.length;
|
|
916
|
+
|
|
917
|
+
let terrainReady = false;
|
|
918
|
+
let initialImageryState = false;
|
|
919
|
+
let imagery;
|
|
920
|
+
|
|
921
|
+
if (defined(surfaceTile)) {
|
|
922
|
+
// We can render even with non-ready terrain as long as all our rendered descendants
|
|
923
|
+
// are missing terrain geometry too. i.e. if we rendered fills for more detailed tiles
|
|
924
|
+
// last frame, it's ok to render a fill for this tile this frame.
|
|
925
|
+
terrainReady = surfaceTile.terrainState === TerrainState.READY;
|
|
926
|
+
|
|
927
|
+
// Initially assume all imagery layers are ready, unless imagery hasn't been initialized at all.
|
|
928
|
+
initialImageryState = true;
|
|
929
|
+
|
|
930
|
+
imagery = surfaceTile.imagery;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
let i;
|
|
934
|
+
let len;
|
|
935
|
+
|
|
936
|
+
for (i = 0, len = readyImagery.length; i < len; ++i) {
|
|
937
|
+
readyImagery[i] = initialImageryState;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
if (defined(imagery)) {
|
|
941
|
+
for (i = 0, len = imagery.length; i < len; ++i) {
|
|
942
|
+
const tileImagery = imagery[i];
|
|
943
|
+
const loadingImagery = tileImagery.loadingImagery;
|
|
944
|
+
const isReady =
|
|
945
|
+
!defined(loadingImagery) ||
|
|
946
|
+
loadingImagery.state === ImageryState.FAILED ||
|
|
947
|
+
loadingImagery.state === ImageryState.INVALID;
|
|
948
|
+
const layerIndex = (
|
|
949
|
+
tileImagery.loadingImagery || tileImagery.readyImagery
|
|
950
|
+
).imageryLayer._layerIndex;
|
|
951
|
+
|
|
952
|
+
// For a layer to be ready, all tiles belonging to that layer must be ready.
|
|
953
|
+
readyImagery[layerIndex] = isReady && readyImagery[layerIndex];
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
const lastFrame = this.quadtree._lastSelectionFrameNumber;
|
|
958
|
+
|
|
959
|
+
// Traverse the descendants looking for one with terrain or imagery that is not loaded on this tile.
|
|
960
|
+
const stack = canRenderTraversalStack;
|
|
961
|
+
stack.length = 0;
|
|
962
|
+
stack.push(
|
|
963
|
+
tile.southwestChild,
|
|
964
|
+
tile.southeastChild,
|
|
965
|
+
tile.northwestChild,
|
|
966
|
+
tile.northeastChild,
|
|
967
|
+
);
|
|
968
|
+
|
|
969
|
+
while (stack.length > 0) {
|
|
970
|
+
const descendant = stack.pop();
|
|
971
|
+
const lastFrameSelectionResult =
|
|
972
|
+
descendant._lastSelectionResultFrame === lastFrame
|
|
973
|
+
? descendant._lastSelectionResult
|
|
974
|
+
: TileSelectionResult.NONE;
|
|
975
|
+
|
|
976
|
+
if (lastFrameSelectionResult === TileSelectionResult.RENDERED) {
|
|
977
|
+
const descendantSurface = descendant.data;
|
|
978
|
+
|
|
979
|
+
if (!defined(descendantSurface)) {
|
|
980
|
+
// Descendant has no data, so it can't block rendering.
|
|
981
|
+
continue;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
if (
|
|
985
|
+
!terrainReady &&
|
|
986
|
+
descendant.data.terrainState === TerrainState.READY
|
|
987
|
+
) {
|
|
988
|
+
// Rendered descendant has real terrain, but we don't. Rendering is blocked.
|
|
989
|
+
return false;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
const descendantImagery = descendant.data.imagery;
|
|
993
|
+
for (i = 0, len = descendantImagery.length; i < len; ++i) {
|
|
994
|
+
const descendantTileImagery = descendantImagery[i];
|
|
995
|
+
const descendantLoadingImagery = descendantTileImagery.loadingImagery;
|
|
996
|
+
const descendantIsReady =
|
|
997
|
+
!defined(descendantLoadingImagery) ||
|
|
998
|
+
descendantLoadingImagery.state === ImageryState.FAILED ||
|
|
999
|
+
descendantLoadingImagery.state === ImageryState.INVALID;
|
|
1000
|
+
const descendantLayerIndex = (
|
|
1001
|
+
descendantTileImagery.loadingImagery ||
|
|
1002
|
+
descendantTileImagery.readyImagery
|
|
1003
|
+
).imageryLayer._layerIndex;
|
|
1004
|
+
|
|
1005
|
+
// If this imagery tile of a descendant is ready but the layer isn't ready in this tile,
|
|
1006
|
+
// then rendering is blocked.
|
|
1007
|
+
if (descendantIsReady && !readyImagery[descendantLayerIndex]) {
|
|
1008
|
+
return false;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
} else if (lastFrameSelectionResult === TileSelectionResult.REFINED) {
|
|
1012
|
+
stack.push(
|
|
1013
|
+
descendant.southwestChild,
|
|
1014
|
+
descendant.southeastChild,
|
|
1015
|
+
descendant.northwestChild,
|
|
1016
|
+
descendant.northeastChild,
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
return true;
|
|
808
1022
|
}
|
|
809
1023
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1024
|
+
/**
|
|
1025
|
+
* Determines the priority for loading this tile. Lower priority values load sooner.
|
|
1026
|
+
* @param {QuadtreeTile} tile The tile.
|
|
1027
|
+
* @param {FrameState} frameState The frame state.
|
|
1028
|
+
* @returns {number} The load priority value.
|
|
1029
|
+
*/
|
|
1030
|
+
computeTileLoadPriority(tile, frameState) {
|
|
1031
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1032
|
+
if (surfaceTile === undefined) {
|
|
1033
|
+
return 0.0;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
const obb = surfaceTile.tileBoundingRegion.boundingVolume;
|
|
1037
|
+
if (obb === undefined) {
|
|
1038
|
+
return 0.0;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
const cameraPosition = frameState.camera.positionWC;
|
|
1042
|
+
const cameraDirection = frameState.camera.directionWC;
|
|
1043
|
+
const tileDirection = Cartesian3.subtract(
|
|
1044
|
+
obb.center,
|
|
1045
|
+
cameraPosition,
|
|
1046
|
+
tileDirectionScratch,
|
|
818
1047
|
);
|
|
819
|
-
Cartesian3.
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
1048
|
+
const magnitude = Cartesian3.magnitude(tileDirection);
|
|
1049
|
+
if (magnitude < CesiumMath.EPSILON5) {
|
|
1050
|
+
return 0.0;
|
|
1051
|
+
}
|
|
1052
|
+
Cartesian3.divideByScalar(tileDirection, magnitude, tileDirection);
|
|
1053
|
+
return (
|
|
1054
|
+
(1.0 - Cartesian3.dot(tileDirection, cameraDirection)) * tile._distance
|
|
824
1055
|
);
|
|
1056
|
+
}
|
|
825
1057
|
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
1058
|
+
/**
|
|
1059
|
+
* Shows a specified tile in this frame. The provider can cause the tile to be shown by adding
|
|
1060
|
+
* render commands to the commandList, or use any other method as appropriate. The tile is not
|
|
1061
|
+
* expected to be visible next frame as well, unless this method is called next frame, too.
|
|
1062
|
+
*
|
|
1063
|
+
* @param {QuadtreeTile} tile The tile instance.
|
|
1064
|
+
* @param {FrameState} frameState The state information of the current rendering frame.
|
|
1065
|
+
*/
|
|
1066
|
+
showTileThisFrame(tile, frameState) {
|
|
1067
|
+
let readyTextureCount = 0;
|
|
1068
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1069
|
+
const tileImageryCollection = surfaceTile.imagery;
|
|
1070
|
+
for (let i = 0, len = tileImageryCollection.length; i < len; ++i) {
|
|
1071
|
+
const tileImagery = tileImageryCollection[i];
|
|
1072
|
+
if (
|
|
1073
|
+
defined(tileImagery.readyImagery) &&
|
|
1074
|
+
tileImagery.readyImagery.imageryLayer.alpha !== 0.0
|
|
1075
|
+
) {
|
|
1076
|
+
++readyTextureCount;
|
|
1077
|
+
}
|
|
835
1078
|
}
|
|
836
|
-
}
|
|
837
1079
|
|
|
838
|
-
|
|
839
|
-
|
|
1080
|
+
let tileSet = this._tilesToRenderByTextureCount[readyTextureCount];
|
|
1081
|
+
if (!defined(tileSet)) {
|
|
1082
|
+
tileSet = [];
|
|
1083
|
+
this._tilesToRenderByTextureCount[readyTextureCount] = tileSet;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
tileSet.push(tile);
|
|
1087
|
+
|
|
1088
|
+
if (!defined(surfaceTile.vertexArray)) {
|
|
1089
|
+
this._hasFillTilesThisFrame = true;
|
|
1090
|
+
} else {
|
|
1091
|
+
this._hasLoadedTilesThisFrame = true;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
const debug = this._debug;
|
|
1095
|
+
++debug.tilesRendered;
|
|
1096
|
+
debug.texturesRendered += readyTextureCount;
|
|
840
1097
|
}
|
|
841
1098
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
1099
|
+
/**
|
|
1100
|
+
* Gets the distance from the camera to the closest point on the tile. This is used for level-of-detail selection.
|
|
1101
|
+
*
|
|
1102
|
+
* @param {QuadtreeTile} tile The tile instance.
|
|
1103
|
+
* @param {FrameState} frameState The state information of the current rendering frame.
|
|
1104
|
+
*
|
|
1105
|
+
* @returns {number} The distance from the camera to the closest point on the tile, in meters.
|
|
1106
|
+
*/
|
|
1107
|
+
computeDistanceToTile(tile, frameState) {
|
|
1108
|
+
// The distance should be:
|
|
1109
|
+
// 1. the actual distance to the tight-fitting bounding volume, or
|
|
1110
|
+
// 2. a distance that is equal to or greater than the actual distance to the tight-fitting bounding volume.
|
|
1111
|
+
//
|
|
1112
|
+
// When we don't know the min/max heights for a tile, but we do know the min/max of an ancestor tile, we can
|
|
1113
|
+
// build a tight-fitting bounding volume horizontally, but not vertically. The min/max heights from the
|
|
1114
|
+
// ancestor will likely form a volume that is much bigger than it needs to be. This means that the volume may
|
|
1115
|
+
// be deemed to be much closer to the camera than it really is, causing us to select tiles that are too detailed.
|
|
1116
|
+
// Loading too-detailed tiles is super expensive, so we don't want to do that. We don't know where the child
|
|
1117
|
+
// tile really lies within the parent range of heights, but we _do_ know the child tile can't be any closer than
|
|
1118
|
+
// the ancestor height surface (min or max) that is _farthest away_ from the camera. So if we compute distance
|
|
1119
|
+
// based on that conservative metric, we may end up loading tiles that are not detailed enough, but that's much
|
|
1120
|
+
// better (faster) than loading tiles that are too detailed.
|
|
1121
|
+
|
|
1122
|
+
updateTileBoundingRegion(tile, this, frameState);
|
|
1123
|
+
|
|
1124
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1125
|
+
const boundingVolumeSourceTile = surfaceTile.boundingVolumeSourceTile;
|
|
1126
|
+
if (boundingVolumeSourceTile === undefined) {
|
|
1127
|
+
// Can't find any min/max heights anywhere? Ok, let's just say the
|
|
1128
|
+
// tile is really far away so we'll load and render it rather than
|
|
1129
|
+
// refining.
|
|
1130
|
+
return 9999999999.0;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
1134
|
+
const min = tileBoundingRegion.minimumHeight;
|
|
1135
|
+
const max = tileBoundingRegion.maximumHeight;
|
|
1136
|
+
|
|
1137
|
+
if (surfaceTile.boundingVolumeSourceTile !== tile) {
|
|
1138
|
+
const cameraHeight = frameState.camera.positionCartographic.height;
|
|
1139
|
+
const distanceToMin = Math.abs(cameraHeight - min);
|
|
1140
|
+
const distanceToMax = Math.abs(cameraHeight - max);
|
|
1141
|
+
if (distanceToMin > distanceToMax) {
|
|
1142
|
+
tileBoundingRegion.minimumHeight = min;
|
|
1143
|
+
tileBoundingRegion.maximumHeight = min;
|
|
1144
|
+
} else {
|
|
1145
|
+
tileBoundingRegion.minimumHeight = max;
|
|
1146
|
+
tileBoundingRegion.maximumHeight = max;
|
|
1147
|
+
}
|
|
849
1148
|
}
|
|
1149
|
+
|
|
1150
|
+
const result = tileBoundingRegion.distanceToCamera(frameState);
|
|
1151
|
+
|
|
1152
|
+
tileBoundingRegion.minimumHeight = min;
|
|
1153
|
+
tileBoundingRegion.maximumHeight = max;
|
|
1154
|
+
|
|
1155
|
+
return result;
|
|
850
1156
|
}
|
|
851
1157
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
1158
|
+
/**
|
|
1159
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
1160
|
+
* <br /><br />
|
|
1161
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
1162
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
1163
|
+
*
|
|
1164
|
+
* @returns {boolean} True if this object was destroyed; otherwise, false.
|
|
1165
|
+
*
|
|
1166
|
+
* @see GlobeSurfaceTileProvider#destroy
|
|
1167
|
+
*/
|
|
1168
|
+
isDestroyed() {
|
|
1169
|
+
return false;
|
|
861
1170
|
}
|
|
862
1171
|
|
|
863
|
-
|
|
864
|
-
|
|
1172
|
+
/**
|
|
1173
|
+
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
1174
|
+
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
1175
|
+
* <br /><br />
|
|
1176
|
+
* Once an object is destroyed, it should not be used; calling any function other than
|
|
1177
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
1178
|
+
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
1179
|
+
*
|
|
1180
|
+
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
1181
|
+
*
|
|
1182
|
+
*
|
|
1183
|
+
* @example
|
|
1184
|
+
* provider = provider && provider.destroy();
|
|
1185
|
+
*
|
|
1186
|
+
* @see GlobeSurfaceTileProvider#isDestroyed
|
|
1187
|
+
*/
|
|
1188
|
+
destroy() {
|
|
1189
|
+
this._tileProvider = this._tileProvider && this._tileProvider.destroy();
|
|
1190
|
+
this._clippingPlanes =
|
|
1191
|
+
this._clippingPlanes && this._clippingPlanes.destroy();
|
|
1192
|
+
this._clippingPolygons =
|
|
1193
|
+
this._clippingPolygons && this._clippingPolygons.destroy();
|
|
1194
|
+
this._removeLayerAddedListener =
|
|
1195
|
+
this._removeLayerAddedListener && this._removeLayerAddedListener();
|
|
1196
|
+
this._removeLayerRemovedListener =
|
|
1197
|
+
this._removeLayerRemovedListener && this._removeLayerRemovedListener();
|
|
1198
|
+
this._removeLayerMovedListener =
|
|
1199
|
+
this._removeLayerMovedListener && this._removeLayerMovedListener();
|
|
1200
|
+
this._removeLayerShownListener =
|
|
1201
|
+
this._removeLayerShownListener && this._removeLayerShownListener();
|
|
1202
|
+
|
|
1203
|
+
return destroyObject(this);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
_onLayerAdded(layer, index) {
|
|
1207
|
+
if (this.isDestroyed()) {
|
|
1208
|
+
return;
|
|
1209
|
+
}
|
|
865
1210
|
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
1211
|
+
if (layer.show) {
|
|
1212
|
+
const terrainProvider = this._terrainProvider;
|
|
1213
|
+
|
|
1214
|
+
const that = this;
|
|
1215
|
+
const tileImageryUpdatedEvent = this._imageryLayersUpdatedEvent;
|
|
1216
|
+
const reloadFunction = function () {
|
|
1217
|
+
// Clear the layer's cache
|
|
1218
|
+
layer._imageryCache = {};
|
|
1219
|
+
|
|
1220
|
+
that._quadtree.forEachLoadedTile(function (tile) {
|
|
1221
|
+
// If this layer is still waiting to for the loaded callback, just return
|
|
1222
|
+
if (defined(tile._loadedCallbacks[layer._layerIndex])) {
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
let i;
|
|
1227
|
+
|
|
1228
|
+
// Figure out how many TileImageries we will need to remove and where to insert new ones
|
|
1229
|
+
const tileImageryCollection = tile.data.imagery;
|
|
1230
|
+
const length = tileImageryCollection.length;
|
|
1231
|
+
let startIndex = -1;
|
|
1232
|
+
let tileImageriesToFree = 0;
|
|
1233
|
+
for (i = 0; i < length; ++i) {
|
|
1234
|
+
const tileImagery = tileImageryCollection[i];
|
|
1235
|
+
const imagery =
|
|
1236
|
+
tileImagery.readyImagery ?? tileImagery.loadingImagery;
|
|
1237
|
+
if (imagery.imageryLayer === layer) {
|
|
1238
|
+
if (startIndex === -1) {
|
|
1239
|
+
startIndex = i;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
++tileImageriesToFree;
|
|
1243
|
+
} else if (startIndex !== -1) {
|
|
1244
|
+
// iterated past the section of TileImageries belonging to this layer, no need to continue.
|
|
1245
|
+
break;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
if (startIndex === -1) {
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// Insert immediately after existing TileImageries
|
|
1254
|
+
const insertionPoint = startIndex + tileImageriesToFree;
|
|
1255
|
+
|
|
1256
|
+
// Create new TileImageries for all loaded tiles
|
|
1257
|
+
if (
|
|
1258
|
+
layer._createTileImagerySkeletons(
|
|
1259
|
+
tile,
|
|
1260
|
+
terrainProvider,
|
|
1261
|
+
insertionPoint,
|
|
1262
|
+
)
|
|
1263
|
+
) {
|
|
1264
|
+
// Add callback to remove old TileImageries when the new TileImageries are ready
|
|
1265
|
+
tile._loadedCallbacks[layer._layerIndex] = getTileReadyCallback(
|
|
1266
|
+
tileImageriesToFree,
|
|
1267
|
+
layer,
|
|
1268
|
+
terrainProvider,
|
|
1269
|
+
);
|
|
1270
|
+
|
|
1271
|
+
tile.state = QuadtreeTileLoadState.LOADING;
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
};
|
|
1275
|
+
|
|
1276
|
+
if (layer.ready) {
|
|
1277
|
+
const imageryProvider = layer.imageryProvider;
|
|
1278
|
+
imageryProvider._reload = reloadFunction;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
// create TileImageries for this layer for all previously loaded tiles
|
|
1282
|
+
this._quadtree.forEachLoadedTile(function (tile) {
|
|
1283
|
+
if (layer._createTileImagerySkeletons(tile, terrainProvider)) {
|
|
1284
|
+
tile.state = QuadtreeTileLoadState.LOADING;
|
|
1285
|
+
|
|
1286
|
+
// Tiles that are not currently being rendered need to load the new layer before they're renderable.
|
|
1287
|
+
// We don't mark the rendered tiles non-renderable, though, because that would make the globe disappear.
|
|
1288
|
+
if (
|
|
1289
|
+
tile.level !== 0 &&
|
|
1290
|
+
(tile._lastSelectionResultFrame !==
|
|
1291
|
+
that.quadtree._lastSelectionFrameNumber ||
|
|
1292
|
+
tile._lastSelectionResult !== TileSelectionResult.RENDERED)
|
|
1293
|
+
) {
|
|
1294
|
+
tile.renderable = false;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
this._layerOrderChanged = true;
|
|
1300
|
+
tileImageryUpdatedEvent.raiseEvent();
|
|
1301
|
+
}
|
|
872
1302
|
}
|
|
873
1303
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
1304
|
+
_onLayerRemoved(layer, index) {
|
|
1305
|
+
// destroy TileImagerys for this layer for all previously loaded tiles
|
|
1306
|
+
this._quadtree.forEachLoadedTile(function (tile) {
|
|
1307
|
+
const tileImageryCollection = tile.data.imagery;
|
|
1308
|
+
|
|
1309
|
+
let startIndex = -1;
|
|
1310
|
+
let numDestroyed = 0;
|
|
1311
|
+
for (let i = 0, len = tileImageryCollection.length; i < len; ++i) {
|
|
1312
|
+
const tileImagery = tileImageryCollection[i];
|
|
1313
|
+
let imagery = tileImagery.loadingImagery;
|
|
1314
|
+
if (!defined(imagery)) {
|
|
1315
|
+
imagery = tileImagery.readyImagery;
|
|
1316
|
+
}
|
|
1317
|
+
if (imagery.imageryLayer === layer) {
|
|
1318
|
+
if (startIndex === -1) {
|
|
1319
|
+
startIndex = i;
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
tileImagery.freeResources();
|
|
1323
|
+
++numDestroyed;
|
|
1324
|
+
} else if (startIndex !== -1) {
|
|
1325
|
+
// iterated past the section of TileImagerys belonging to this layer, no need to continue.
|
|
1326
|
+
break;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
if (startIndex !== -1) {
|
|
1331
|
+
tileImageryCollection.splice(startIndex, numDestroyed);
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
if (defined(layer.imageryProvider)) {
|
|
1336
|
+
layer.imageryProvider._reload = undefined;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
this._imageryLayersUpdatedEvent.raiseEvent();
|
|
882
1340
|
}
|
|
883
1341
|
|
|
884
|
-
|
|
885
|
-
|
|
1342
|
+
_onLayerMoved(layer, newIndex, oldIndex) {
|
|
1343
|
+
this._layerOrderChanged = true;
|
|
1344
|
+
this._imageryLayersUpdatedEvent.raiseEvent();
|
|
886
1345
|
}
|
|
887
1346
|
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
!ortho3D &&
|
|
894
|
-
defined(occluders) &&
|
|
895
|
-
!undergroundVisible
|
|
896
|
-
) {
|
|
897
|
-
const occludeePointInScaledSpace = surfaceTile.occludeePointInScaledSpace;
|
|
898
|
-
if (!defined(occludeePointInScaledSpace)) {
|
|
899
|
-
return visibility;
|
|
1347
|
+
_onLayerShownOrHidden(layer, index, show) {
|
|
1348
|
+
if (show) {
|
|
1349
|
+
this._onLayerAdded(layer, index);
|
|
1350
|
+
} else {
|
|
1351
|
+
this._onLayerRemoved(layer, index);
|
|
900
1352
|
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
901
1355
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
1356
|
+
function sortTileImageryByLayerIndex(a, b) {
|
|
1357
|
+
let aImagery = a.loadingImagery;
|
|
1358
|
+
if (!defined(aImagery)) {
|
|
1359
|
+
aImagery = a.readyImagery;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
let bImagery = b.loadingImagery;
|
|
1363
|
+
if (!defined(bImagery)) {
|
|
1364
|
+
bImagery = b.readyImagery;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
return aImagery.imageryLayer._layerIndex - bImagery.imageryLayer._layerIndex;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* @param {GlobeSurfaceTileProvider} surface
|
|
1372
|
+
* @param {FrameState} frameState
|
|
1373
|
+
* @ignore
|
|
1374
|
+
*/
|
|
1375
|
+
function updateCredits(surface, frameState) {
|
|
1376
|
+
const creditDisplay = frameState.creditDisplay;
|
|
1377
|
+
const terrainProvider = surface._terrainProvider;
|
|
1378
|
+
// @ts-expect-error Missing types.
|
|
1379
|
+
if (defined(terrainProvider) && defined(terrainProvider.credit)) {
|
|
1380
|
+
// @ts-expect-error Missing types.
|
|
1381
|
+
creditDisplay.addCreditToNextFrame(terrainProvider.credit);
|
|
1382
|
+
}
|
|
1383
|
+
|
|
1384
|
+
const imageryLayers = surface._imageryLayers;
|
|
1385
|
+
// @ts-expect-error Missing types.
|
|
1386
|
+
for (let i = 0, len = imageryLayers.length; i < len; ++i) {
|
|
1387
|
+
const layer = imageryLayers.get(i);
|
|
1388
|
+
// @ts-expect-error Missing types.
|
|
1389
|
+
if (layer.ready && layer.show && defined(layer.imageryProvider.credit)) {
|
|
1390
|
+
// @ts-expect-error Missing types.
|
|
1391
|
+
creditDisplay.addCreditToNextFrame(layer.imageryProvider.credit);
|
|
909
1392
|
}
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
910
1395
|
|
|
911
|
-
|
|
1396
|
+
/**
|
|
1397
|
+
* @param {DrawCommand} command
|
|
1398
|
+
* @param {FrameState} frameState
|
|
1399
|
+
* @ignore
|
|
1400
|
+
*/
|
|
1401
|
+
function pushCommand(command, frameState) {
|
|
1402
|
+
const globeTranslucencyState = frameState.globeTranslucencyState;
|
|
1403
|
+
if (globeTranslucencyState.translucent) {
|
|
1404
|
+
// @ts-expect-error Missing types.
|
|
1405
|
+
const isBlendCommand = command.renderState.blending.enabled;
|
|
1406
|
+
globeTranslucencyState.pushDerivedCommands(
|
|
1407
|
+
command,
|
|
1408
|
+
isBlendCommand,
|
|
1409
|
+
frameState,
|
|
1410
|
+
);
|
|
1411
|
+
} else {
|
|
1412
|
+
frameState.commandList.push(command);
|
|
912
1413
|
}
|
|
1414
|
+
}
|
|
913
1415
|
|
|
914
|
-
|
|
915
|
-
|
|
1416
|
+
const boundingSphereScratch = new BoundingSphere();
|
|
1417
|
+
const rectangleIntersectionScratch = new Rectangle();
|
|
1418
|
+
const splitCartographicLimitRectangleScratch = new Rectangle();
|
|
1419
|
+
const rectangleCenterScratch = new Cartographic();
|
|
916
1420
|
|
|
917
1421
|
/**
|
|
918
|
-
*
|
|
919
|
-
* @param {
|
|
920
|
-
* @
|
|
1422
|
+
* @param {Rectangle} tileRectangle
|
|
1423
|
+
* @param {Rectangle} cartographicLimitRectangle
|
|
1424
|
+
* @ignore
|
|
921
1425
|
*/
|
|
922
|
-
|
|
923
|
-
//
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
// that we get a yes or no answer, it doesn't matter what the answer is.
|
|
927
|
-
if (defined(tile.data.terrainData)) {
|
|
928
|
-
return true;
|
|
1426
|
+
function clipRectangleAntimeridian(tileRectangle, cartographicLimitRectangle) {
|
|
1427
|
+
// cartographicLimitRectangle may span the IDL, but tiles never will.
|
|
1428
|
+
if (cartographicLimitRectangle.west < cartographicLimitRectangle.east) {
|
|
1429
|
+
return cartographicLimitRectangle;
|
|
929
1430
|
}
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
tile.level + 1,
|
|
1431
|
+
const splitRectangle = Rectangle.clone(
|
|
1432
|
+
cartographicLimitRectangle,
|
|
1433
|
+
splitCartographicLimitRectangleScratch,
|
|
934
1434
|
);
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
1435
|
+
const tileCenter = Rectangle.center(tileRectangle, rectangleCenterScratch);
|
|
1436
|
+
if (tileCenter.longitude > 0.0) {
|
|
1437
|
+
splitRectangle.east = CesiumMath.PI;
|
|
1438
|
+
} else {
|
|
1439
|
+
splitRectangle.west = -CesiumMath.PI;
|
|
1440
|
+
}
|
|
1441
|
+
return splitRectangle;
|
|
1442
|
+
}
|
|
940
1443
|
|
|
941
1444
|
/**
|
|
942
|
-
*
|
|
943
|
-
*
|
|
944
|
-
*
|
|
945
|
-
* it is assumed that this method will return true and it will not be called.
|
|
946
|
-
* @param {QuadtreeTile} tile The tile to check.
|
|
947
|
-
* @returns {boolean} True if the tile can be rendered without losing detail.
|
|
1445
|
+
* @param {GlobeSurfaceTileProvider} tileProvider
|
|
1446
|
+
* @param {FrameState} frameState
|
|
1447
|
+
* @ignore
|
|
948
1448
|
*/
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
) {
|
|
953
|
-
const surfaceTile = tile.data;
|
|
954
|
-
|
|
955
|
-
const readyImagery = readyImageryScratch;
|
|
956
|
-
readyImagery.length = this._imageryLayers.length;
|
|
957
|
-
|
|
958
|
-
let terrainReady = false;
|
|
959
|
-
let initialImageryState = false;
|
|
960
|
-
let imagery;
|
|
961
|
-
|
|
962
|
-
if (defined(surfaceTile)) {
|
|
963
|
-
// We can render even with non-ready terrain as long as all our rendered descendants
|
|
964
|
-
// are missing terrain geometry too. i.e. if we rendered fills for more detailed tiles
|
|
965
|
-
// last frame, it's ok to render a fill for this tile this frame.
|
|
966
|
-
terrainReady = surfaceTile.terrainState === TerrainState.READY;
|
|
967
|
-
|
|
968
|
-
// Initially assume all imagery layers are ready, unless imagery hasn't been initialized at all.
|
|
969
|
-
initialImageryState = true;
|
|
970
|
-
|
|
971
|
-
imagery = surfaceTile.imagery;
|
|
1449
|
+
function isUndergroundVisible(tileProvider, frameState) {
|
|
1450
|
+
if (frameState.cameraUnderground) {
|
|
1451
|
+
return true;
|
|
972
1452
|
}
|
|
973
1453
|
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
for (i = 0, len = readyImagery.length; i < len; ++i) {
|
|
978
|
-
readyImagery[i] = initialImageryState;
|
|
1454
|
+
if (frameState.globeTranslucencyState.translucent) {
|
|
1455
|
+
return true;
|
|
979
1456
|
}
|
|
980
1457
|
|
|
981
|
-
if (
|
|
982
|
-
|
|
983
|
-
const tileImagery = imagery[i];
|
|
984
|
-
const loadingImagery = tileImagery.loadingImagery;
|
|
985
|
-
const isReady =
|
|
986
|
-
!defined(loadingImagery) ||
|
|
987
|
-
loadingImagery.state === ImageryState.FAILED ||
|
|
988
|
-
loadingImagery.state === ImageryState.INVALID;
|
|
989
|
-
const layerIndex = (
|
|
990
|
-
tileImagery.loadingImagery || tileImagery.readyImagery
|
|
991
|
-
).imageryLayer._layerIndex;
|
|
992
|
-
|
|
993
|
-
// For a layer to be ready, all tiles belonging to that layer must be ready.
|
|
994
|
-
readyImagery[layerIndex] = isReady && readyImagery[layerIndex];
|
|
995
|
-
}
|
|
1458
|
+
if (tileProvider.backFaceCulling) {
|
|
1459
|
+
return false;
|
|
996
1460
|
}
|
|
997
1461
|
|
|
998
|
-
const
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
const stack = canRenderTraversalStack;
|
|
1002
|
-
stack.length = 0;
|
|
1003
|
-
stack.push(
|
|
1004
|
-
tile.southwestChild,
|
|
1005
|
-
tile.southeastChild,
|
|
1006
|
-
tile.northwestChild,
|
|
1007
|
-
tile.northeastChild,
|
|
1008
|
-
);
|
|
1009
|
-
|
|
1010
|
-
while (stack.length > 0) {
|
|
1011
|
-
const descendant = stack.pop();
|
|
1012
|
-
const lastFrameSelectionResult =
|
|
1013
|
-
descendant._lastSelectionResultFrame === lastFrame
|
|
1014
|
-
? descendant._lastSelectionResult
|
|
1015
|
-
: TileSelectionResult.NONE;
|
|
1016
|
-
|
|
1017
|
-
if (lastFrameSelectionResult === TileSelectionResult.RENDERED) {
|
|
1018
|
-
const descendantSurface = descendant.data;
|
|
1019
|
-
|
|
1020
|
-
if (!defined(descendantSurface)) {
|
|
1021
|
-
// Descendant has no data, so it can't block rendering.
|
|
1022
|
-
continue;
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
if (
|
|
1026
|
-
!terrainReady &&
|
|
1027
|
-
descendant.data.terrainState === TerrainState.READY
|
|
1028
|
-
) {
|
|
1029
|
-
// Rendered descendant has real terrain, but we don't. Rendering is blocked.
|
|
1030
|
-
return false;
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
const descendantImagery = descendant.data.imagery;
|
|
1034
|
-
for (i = 0, len = descendantImagery.length; i < len; ++i) {
|
|
1035
|
-
const descendantTileImagery = descendantImagery[i];
|
|
1036
|
-
const descendantLoadingImagery = descendantTileImagery.loadingImagery;
|
|
1037
|
-
const descendantIsReady =
|
|
1038
|
-
!defined(descendantLoadingImagery) ||
|
|
1039
|
-
descendantLoadingImagery.state === ImageryState.FAILED ||
|
|
1040
|
-
descendantLoadingImagery.state === ImageryState.INVALID;
|
|
1041
|
-
const descendantLayerIndex = (
|
|
1042
|
-
descendantTileImagery.loadingImagery ||
|
|
1043
|
-
descendantTileImagery.readyImagery
|
|
1044
|
-
).imageryLayer._layerIndex;
|
|
1045
|
-
|
|
1046
|
-
// If this imagery tile of a descendant is ready but the layer isn't ready in this tile,
|
|
1047
|
-
// then rendering is blocked.
|
|
1048
|
-
if (descendantIsReady && !readyImagery[descendantLayerIndex]) {
|
|
1049
|
-
return false;
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
} else if (lastFrameSelectionResult === TileSelectionResult.REFINED) {
|
|
1053
|
-
stack.push(
|
|
1054
|
-
descendant.southwestChild,
|
|
1055
|
-
descendant.southeastChild,
|
|
1056
|
-
descendant.northwestChild,
|
|
1057
|
-
descendant.northeastChild,
|
|
1058
|
-
);
|
|
1059
|
-
}
|
|
1462
|
+
const clippingPlanes = tileProvider._clippingPlanes;
|
|
1463
|
+
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
1464
|
+
return true;
|
|
1060
1465
|
}
|
|
1061
1466
|
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
const tileDirectionScratch = new Cartesian3();
|
|
1066
|
-
|
|
1067
|
-
/**
|
|
1068
|
-
* Determines the priority for loading this tile. Lower priority values load sooner.
|
|
1069
|
-
* @param {QuadtreeTile} tile The tile.
|
|
1070
|
-
* @param {FrameState} frameState The frame state.
|
|
1071
|
-
* @returns {number} The load priority value.
|
|
1072
|
-
*/
|
|
1073
|
-
GlobeSurfaceTileProvider.prototype.computeTileLoadPriority = function (
|
|
1074
|
-
tile,
|
|
1075
|
-
frameState,
|
|
1076
|
-
) {
|
|
1077
|
-
const surfaceTile = tile.data;
|
|
1078
|
-
if (surfaceTile === undefined) {
|
|
1079
|
-
return 0.0;
|
|
1467
|
+
const clippingPolygons = tileProvider._clippingPolygons;
|
|
1468
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
1469
|
+
return true;
|
|
1080
1470
|
}
|
|
1081
1471
|
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1472
|
+
if (
|
|
1473
|
+
!Rectangle.equals(
|
|
1474
|
+
tileProvider.cartographicLimitRectangle,
|
|
1475
|
+
Rectangle.MAX_VALUE,
|
|
1476
|
+
)
|
|
1477
|
+
) {
|
|
1478
|
+
return true;
|
|
1085
1479
|
}
|
|
1086
1480
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
const magnitude = Cartesian3.magnitude(tileDirection);
|
|
1095
|
-
if (magnitude < CesiumMath.EPSILON5) {
|
|
1096
|
-
return 0.0;
|
|
1097
|
-
}
|
|
1098
|
-
Cartesian3.divideByScalar(tileDirection, magnitude, tileDirection);
|
|
1099
|
-
return (
|
|
1100
|
-
(1.0 - Cartesian3.dot(tileDirection, cameraDirection)) * tile._distance
|
|
1101
|
-
);
|
|
1102
|
-
};
|
|
1481
|
+
return false;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
const readyImageryScratch = [];
|
|
1485
|
+
const canRenderTraversalStack = [];
|
|
1486
|
+
|
|
1487
|
+
const tileDirectionScratch = new Cartesian3();
|
|
1103
1488
|
|
|
1104
1489
|
const modifiedModelViewScratch = new Matrix4();
|
|
1105
1490
|
const modifiedModelViewProjectionScratch = new Matrix4();
|
|
@@ -1123,15 +1508,16 @@ const DEFAULT_COLUMBUS_WORLD_OFFSETS = [0.0];
|
|
|
1123
1508
|
const COLUMBUS_VISIBILITY_WORLD_OFFSETS = [];
|
|
1124
1509
|
|
|
1125
1510
|
/**
|
|
1126
|
-
* Whether
|
|
1127
|
-
*
|
|
1511
|
+
* Whether repeat worlds are enabled for this frame. Supported in 2D and
|
|
1512
|
+
* Columbus View; other modes never repeat.
|
|
1128
1513
|
*
|
|
1129
1514
|
* @private
|
|
1130
1515
|
*/
|
|
1131
1516
|
function isColumbusRepeatActive(frameState) {
|
|
1132
1517
|
return (
|
|
1133
1518
|
frameState.columbusRepeatWorlds === true &&
|
|
1134
|
-
frameState.mode === SceneMode.
|
|
1519
|
+
(frameState.mode === SceneMode.SCENE2D ||
|
|
1520
|
+
frameState.mode === SceneMode.COLUMBUS_VIEW)
|
|
1135
1521
|
);
|
|
1136
1522
|
}
|
|
1137
1523
|
|
|
@@ -1247,50 +1633,6 @@ function computeColumbusTileWorldOffsets(tileProvider, tile, frameState) {
|
|
|
1247
1633
|
);
|
|
1248
1634
|
}
|
|
1249
1635
|
|
|
1250
|
-
/**
|
|
1251
|
-
* Shows a specified tile in this frame. The provider can cause the tile to be shown by adding
|
|
1252
|
-
* render commands to the commandList, or use any other method as appropriate. The tile is not
|
|
1253
|
-
* expected to be visible next frame as well, unless this method is called next frame, too.
|
|
1254
|
-
*
|
|
1255
|
-
* @param {QuadtreeTile} tile The tile instance.
|
|
1256
|
-
* @param {FrameState} frameState The state information of the current rendering frame.
|
|
1257
|
-
*/
|
|
1258
|
-
GlobeSurfaceTileProvider.prototype.showTileThisFrame = function (
|
|
1259
|
-
tile,
|
|
1260
|
-
frameState,
|
|
1261
|
-
) {
|
|
1262
|
-
let readyTextureCount = 0;
|
|
1263
|
-
const tileImageryCollection = tile.data.imagery;
|
|
1264
|
-
for (let i = 0, len = tileImageryCollection.length; i < len; ++i) {
|
|
1265
|
-
const tileImagery = tileImageryCollection[i];
|
|
1266
|
-
if (
|
|
1267
|
-
defined(tileImagery.readyImagery) &&
|
|
1268
|
-
tileImagery.readyImagery.imageryLayer.alpha !== 0.0
|
|
1269
|
-
) {
|
|
1270
|
-
++readyTextureCount;
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
let tileSet = this._tilesToRenderByTextureCount[readyTextureCount];
|
|
1275
|
-
if (!defined(tileSet)) {
|
|
1276
|
-
tileSet = [];
|
|
1277
|
-
this._tilesToRenderByTextureCount[readyTextureCount] = tileSet;
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
tileSet.push(tile);
|
|
1281
|
-
|
|
1282
|
-
const surfaceTile = tile.data;
|
|
1283
|
-
if (!defined(surfaceTile.vertexArray)) {
|
|
1284
|
-
this._hasFillTilesThisFrame = true;
|
|
1285
|
-
} else {
|
|
1286
|
-
this._hasLoadedTilesThisFrame = true;
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
const debug = this._debug;
|
|
1290
|
-
++debug.tilesRendered;
|
|
1291
|
-
debug.texturesRendered += readyTextureCount;
|
|
1292
|
-
};
|
|
1293
|
-
|
|
1294
1636
|
const cornerPositionsScratch = [
|
|
1295
1637
|
new Cartesian3(),
|
|
1296
1638
|
new Cartesian3(),
|
|
@@ -1306,7 +1648,9 @@ function computeOccludeePoint(
|
|
|
1306
1648
|
maximumHeight,
|
|
1307
1649
|
result,
|
|
1308
1650
|
) {
|
|
1651
|
+
/** @type {EllipsoidalOccluder} */
|
|
1309
1652
|
const ellipsoidalOccluder = tileProvider.quadtree._occluders.ellipsoid;
|
|
1653
|
+
// @ts-expect-error Missing types.
|
|
1310
1654
|
const ellipsoid = ellipsoidalOccluder.ellipsoid;
|
|
1311
1655
|
|
|
1312
1656
|
const cornerPositions = cornerPositionsScratch;
|
|
@@ -1348,69 +1692,13 @@ function computeOccludeePoint(
|
|
|
1348
1692
|
}
|
|
1349
1693
|
|
|
1350
1694
|
/**
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1353
|
-
* @param {
|
|
1354
|
-
* @
|
|
1355
|
-
*
|
|
1356
|
-
* @returns {number} The distance from the camera to the closest point on the tile, in meters.
|
|
1695
|
+
* @param {QuadtreeTile} tile
|
|
1696
|
+
* @param {GlobeSurfaceTileProvider} tileProvider
|
|
1697
|
+
* @param {FrameState} frameState
|
|
1698
|
+
* @ignore
|
|
1357
1699
|
*/
|
|
1358
|
-
GlobeSurfaceTileProvider.prototype.computeDistanceToTile = function (
|
|
1359
|
-
tile,
|
|
1360
|
-
frameState,
|
|
1361
|
-
) {
|
|
1362
|
-
// The distance should be:
|
|
1363
|
-
// 1. the actual distance to the tight-fitting bounding volume, or
|
|
1364
|
-
// 2. a distance that is equal to or greater than the actual distance to the tight-fitting bounding volume.
|
|
1365
|
-
//
|
|
1366
|
-
// When we don't know the min/max heights for a tile, but we do know the min/max of an ancestor tile, we can
|
|
1367
|
-
// build a tight-fitting bounding volume horizontally, but not vertically. The min/max heights from the
|
|
1368
|
-
// ancestor will likely form a volume that is much bigger than it needs to be. This means that the volume may
|
|
1369
|
-
// be deemed to be much closer to the camera than it really is, causing us to select tiles that are too detailed.
|
|
1370
|
-
// Loading too-detailed tiles is super expensive, so we don't want to do that. We don't know where the child
|
|
1371
|
-
// tile really lies within the parent range of heights, but we _do_ know the child tile can't be any closer than
|
|
1372
|
-
// the ancestor height surface (min or max) that is _farthest away_ from the camera. So if we compute distance
|
|
1373
|
-
// based on that conservative metric, we may end up loading tiles that are not detailed enough, but that's much
|
|
1374
|
-
// better (faster) than loading tiles that are too detailed.
|
|
1375
|
-
|
|
1376
|
-
updateTileBoundingRegion(tile, this, frameState);
|
|
1377
|
-
|
|
1378
|
-
const surfaceTile = tile.data;
|
|
1379
|
-
const boundingVolumeSourceTile = surfaceTile.boundingVolumeSourceTile;
|
|
1380
|
-
if (boundingVolumeSourceTile === undefined) {
|
|
1381
|
-
// Can't find any min/max heights anywhere? Ok, let's just say the
|
|
1382
|
-
// tile is really far away so we'll load and render it rather than
|
|
1383
|
-
// refining.
|
|
1384
|
-
return 9999999999.0;
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
1388
|
-
const min = tileBoundingRegion.minimumHeight;
|
|
1389
|
-
const max = tileBoundingRegion.maximumHeight;
|
|
1390
|
-
|
|
1391
|
-
if (surfaceTile.boundingVolumeSourceTile !== tile) {
|
|
1392
|
-
const cameraHeight = frameState.camera.positionCartographic.height;
|
|
1393
|
-
const distanceToMin = Math.abs(cameraHeight - min);
|
|
1394
|
-
const distanceToMax = Math.abs(cameraHeight - max);
|
|
1395
|
-
if (distanceToMin > distanceToMax) {
|
|
1396
|
-
tileBoundingRegion.minimumHeight = min;
|
|
1397
|
-
tileBoundingRegion.maximumHeight = min;
|
|
1398
|
-
} else {
|
|
1399
|
-
tileBoundingRegion.minimumHeight = max;
|
|
1400
|
-
tileBoundingRegion.maximumHeight = max;
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
const result = tileBoundingRegion.distanceToCamera(frameState);
|
|
1405
|
-
|
|
1406
|
-
tileBoundingRegion.minimumHeight = min;
|
|
1407
|
-
tileBoundingRegion.maximumHeight = max;
|
|
1408
|
-
|
|
1409
|
-
return result;
|
|
1410
|
-
};
|
|
1411
|
-
|
|
1412
1700
|
function updateTileBoundingRegion(tile, tileProvider, frameState) {
|
|
1413
|
-
let surfaceTile = tile.data;
|
|
1701
|
+
let surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1414
1702
|
if (surfaceTile === undefined) {
|
|
1415
1703
|
surfaceTile = tile.data = new GlobeSurfaceTile();
|
|
1416
1704
|
}
|
|
@@ -1460,7 +1748,9 @@ function updateTileBoundingRegion(tile, tileProvider, frameState) {
|
|
|
1460
1748
|
|
|
1461
1749
|
let ancestorTile = tile.parent;
|
|
1462
1750
|
while (ancestorTile !== undefined) {
|
|
1463
|
-
const ancestorSurfaceTile =
|
|
1751
|
+
const ancestorSurfaceTile = /** @type {GlobeSurfaceTile} */ (
|
|
1752
|
+
ancestorTile.data
|
|
1753
|
+
);
|
|
1464
1754
|
if (ancestorSurfaceTile !== undefined) {
|
|
1465
1755
|
const ancestorMesh = ancestorSurfaceTile.mesh;
|
|
1466
1756
|
const ancestorTerrainData = ancestorSurfaceTile.terrainData;
|
|
@@ -1562,53 +1852,6 @@ function updateTileBoundingRegion(tile, tileProvider, frameState) {
|
|
|
1562
1852
|
}
|
|
1563
1853
|
}
|
|
1564
1854
|
|
|
1565
|
-
/**
|
|
1566
|
-
* Returns true if this object was destroyed; otherwise, false.
|
|
1567
|
-
* <br /><br />
|
|
1568
|
-
* If this object was destroyed, it should not be used; calling any function other than
|
|
1569
|
-
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
1570
|
-
*
|
|
1571
|
-
* @returns {boolean} True if this object was destroyed; otherwise, false.
|
|
1572
|
-
*
|
|
1573
|
-
* @see GlobeSurfaceTileProvider#destroy
|
|
1574
|
-
*/
|
|
1575
|
-
GlobeSurfaceTileProvider.prototype.isDestroyed = function () {
|
|
1576
|
-
return false;
|
|
1577
|
-
};
|
|
1578
|
-
|
|
1579
|
-
/**
|
|
1580
|
-
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
1581
|
-
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
1582
|
-
* <br /><br />
|
|
1583
|
-
* Once an object is destroyed, it should not be used; calling any function other than
|
|
1584
|
-
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
1585
|
-
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
1586
|
-
*
|
|
1587
|
-
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
1588
|
-
*
|
|
1589
|
-
*
|
|
1590
|
-
* @example
|
|
1591
|
-
* provider = provider && provider();
|
|
1592
|
-
*
|
|
1593
|
-
* @see GlobeSurfaceTileProvider#isDestroyed
|
|
1594
|
-
*/
|
|
1595
|
-
GlobeSurfaceTileProvider.prototype.destroy = function () {
|
|
1596
|
-
this._tileProvider = this._tileProvider && this._tileProvider.destroy();
|
|
1597
|
-
this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
|
|
1598
|
-
this._clippingPolygons =
|
|
1599
|
-
this._clippingPolygons && this._clippingPolygons.destroy();
|
|
1600
|
-
this._removeLayerAddedListener =
|
|
1601
|
-
this._removeLayerAddedListener && this._removeLayerAddedListener();
|
|
1602
|
-
this._removeLayerRemovedListener =
|
|
1603
|
-
this._removeLayerRemovedListener && this._removeLayerRemovedListener();
|
|
1604
|
-
this._removeLayerMovedListener =
|
|
1605
|
-
this._removeLayerMovedListener && this._removeLayerMovedListener();
|
|
1606
|
-
this._removeLayerShownListener =
|
|
1607
|
-
this._removeLayerShownListener && this._removeLayerShownListener();
|
|
1608
|
-
|
|
1609
|
-
return destroyObject(this);
|
|
1610
|
-
};
|
|
1611
|
-
|
|
1612
1855
|
function getTileReadyCallback(tileImageriesToFree, layer, terrainProvider) {
|
|
1613
1856
|
return function (tile) {
|
|
1614
1857
|
let tileImagery;
|
|
@@ -1653,165 +1896,14 @@ function getTileReadyCallback(tileImageriesToFree, layer, terrainProvider) {
|
|
|
1653
1896
|
};
|
|
1654
1897
|
}
|
|
1655
1898
|
|
|
1656
|
-
GlobeSurfaceTileProvider.prototype._onLayerAdded = function (layer, index) {
|
|
1657
|
-
if (this.isDestroyed()) {
|
|
1658
|
-
return;
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
if (layer.show) {
|
|
1662
|
-
const terrainProvider = this._terrainProvider;
|
|
1663
|
-
|
|
1664
|
-
const that = this;
|
|
1665
|
-
const tileImageryUpdatedEvent = this._imageryLayersUpdatedEvent;
|
|
1666
|
-
const reloadFunction = function () {
|
|
1667
|
-
// Clear the layer's cache
|
|
1668
|
-
layer._imageryCache = {};
|
|
1669
|
-
|
|
1670
|
-
that._quadtree.forEachLoadedTile(function (tile) {
|
|
1671
|
-
// If this layer is still waiting to for the loaded callback, just return
|
|
1672
|
-
if (defined(tile._loadedCallbacks[layer._layerIndex])) {
|
|
1673
|
-
return;
|
|
1674
|
-
}
|
|
1675
|
-
|
|
1676
|
-
let i;
|
|
1677
|
-
|
|
1678
|
-
// Figure out how many TileImageries we will need to remove and where to insert new ones
|
|
1679
|
-
const tileImageryCollection = tile.data.imagery;
|
|
1680
|
-
const length = tileImageryCollection.length;
|
|
1681
|
-
let startIndex = -1;
|
|
1682
|
-
let tileImageriesToFree = 0;
|
|
1683
|
-
for (i = 0; i < length; ++i) {
|
|
1684
|
-
const tileImagery = tileImageryCollection[i];
|
|
1685
|
-
const imagery =
|
|
1686
|
-
tileImagery.readyImagery ?? tileImagery.loadingImagery;
|
|
1687
|
-
if (imagery.imageryLayer === layer) {
|
|
1688
|
-
if (startIndex === -1) {
|
|
1689
|
-
startIndex = i;
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
++tileImageriesToFree;
|
|
1693
|
-
} else if (startIndex !== -1) {
|
|
1694
|
-
// iterated past the section of TileImageries belonging to this layer, no need to continue.
|
|
1695
|
-
break;
|
|
1696
|
-
}
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
if (startIndex === -1) {
|
|
1700
|
-
return;
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
// Insert immediately after existing TileImageries
|
|
1704
|
-
const insertionPoint = startIndex + tileImageriesToFree;
|
|
1705
|
-
|
|
1706
|
-
// Create new TileImageries for all loaded tiles
|
|
1707
|
-
if (
|
|
1708
|
-
layer._createTileImagerySkeletons(
|
|
1709
|
-
tile,
|
|
1710
|
-
terrainProvider,
|
|
1711
|
-
insertionPoint,
|
|
1712
|
-
)
|
|
1713
|
-
) {
|
|
1714
|
-
// Add callback to remove old TileImageries when the new TileImageries are ready
|
|
1715
|
-
tile._loadedCallbacks[layer._layerIndex] = getTileReadyCallback(
|
|
1716
|
-
tileImageriesToFree,
|
|
1717
|
-
layer,
|
|
1718
|
-
terrainProvider,
|
|
1719
|
-
);
|
|
1720
|
-
|
|
1721
|
-
tile.state = QuadtreeTileLoadState.LOADING;
|
|
1722
|
-
}
|
|
1723
|
-
});
|
|
1724
|
-
};
|
|
1725
|
-
|
|
1726
|
-
if (layer.ready) {
|
|
1727
|
-
const imageryProvider = layer.imageryProvider;
|
|
1728
|
-
imageryProvider._reload = reloadFunction;
|
|
1729
|
-
}
|
|
1730
|
-
|
|
1731
|
-
// create TileImageries for this layer for all previously loaded tiles
|
|
1732
|
-
this._quadtree.forEachLoadedTile(function (tile) {
|
|
1733
|
-
if (layer._createTileImagerySkeletons(tile, terrainProvider)) {
|
|
1734
|
-
tile.state = QuadtreeTileLoadState.LOADING;
|
|
1735
|
-
|
|
1736
|
-
// Tiles that are not currently being rendered need to load the new layer before they're renderable.
|
|
1737
|
-
// We don't mark the rendered tiles non-renderable, though, because that would make the globe disappear.
|
|
1738
|
-
if (
|
|
1739
|
-
tile.level !== 0 &&
|
|
1740
|
-
(tile._lastSelectionResultFrame !==
|
|
1741
|
-
that.quadtree._lastSelectionFrameNumber ||
|
|
1742
|
-
tile._lastSelectionResult !== TileSelectionResult.RENDERED)
|
|
1743
|
-
) {
|
|
1744
|
-
tile.renderable = false;
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
});
|
|
1748
|
-
|
|
1749
|
-
this._layerOrderChanged = true;
|
|
1750
|
-
tileImageryUpdatedEvent.raiseEvent();
|
|
1751
|
-
}
|
|
1752
|
-
};
|
|
1753
|
-
|
|
1754
|
-
GlobeSurfaceTileProvider.prototype._onLayerRemoved = function (layer, index) {
|
|
1755
|
-
// destroy TileImagerys for this layer for all previously loaded tiles
|
|
1756
|
-
this._quadtree.forEachLoadedTile(function (tile) {
|
|
1757
|
-
const tileImageryCollection = tile.data.imagery;
|
|
1758
|
-
|
|
1759
|
-
let startIndex = -1;
|
|
1760
|
-
let numDestroyed = 0;
|
|
1761
|
-
for (let i = 0, len = tileImageryCollection.length; i < len; ++i) {
|
|
1762
|
-
const tileImagery = tileImageryCollection[i];
|
|
1763
|
-
let imagery = tileImagery.loadingImagery;
|
|
1764
|
-
if (!defined(imagery)) {
|
|
1765
|
-
imagery = tileImagery.readyImagery;
|
|
1766
|
-
}
|
|
1767
|
-
if (imagery.imageryLayer === layer) {
|
|
1768
|
-
if (startIndex === -1) {
|
|
1769
|
-
startIndex = i;
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
tileImagery.freeResources();
|
|
1773
|
-
++numDestroyed;
|
|
1774
|
-
} else if (startIndex !== -1) {
|
|
1775
|
-
// iterated past the section of TileImagerys belonging to this layer, no need to continue.
|
|
1776
|
-
break;
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
if (startIndex !== -1) {
|
|
1781
|
-
tileImageryCollection.splice(startIndex, numDestroyed);
|
|
1782
|
-
}
|
|
1783
|
-
});
|
|
1784
|
-
|
|
1785
|
-
if (defined(layer.imageryProvider)) {
|
|
1786
|
-
layer.imageryProvider._reload = undefined;
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
this._imageryLayersUpdatedEvent.raiseEvent();
|
|
1790
|
-
};
|
|
1791
|
-
|
|
1792
|
-
GlobeSurfaceTileProvider.prototype._onLayerMoved = function (
|
|
1793
|
-
layer,
|
|
1794
|
-
newIndex,
|
|
1795
|
-
oldIndex,
|
|
1796
|
-
) {
|
|
1797
|
-
this._layerOrderChanged = true;
|
|
1798
|
-
this._imageryLayersUpdatedEvent.raiseEvent();
|
|
1799
|
-
};
|
|
1800
|
-
|
|
1801
|
-
GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden = function (
|
|
1802
|
-
layer,
|
|
1803
|
-
index,
|
|
1804
|
-
show,
|
|
1805
|
-
) {
|
|
1806
|
-
if (show) {
|
|
1807
|
-
this._onLayerAdded(layer, index);
|
|
1808
|
-
} else {
|
|
1809
|
-
this._onLayerRemoved(layer, index);
|
|
1810
|
-
}
|
|
1811
|
-
};
|
|
1812
|
-
|
|
1813
1899
|
const scratchClippingPlanesMatrix = new Matrix4();
|
|
1814
1900
|
const scratchInverseTransposeClippingPlanesMatrix = new Matrix4();
|
|
1901
|
+
|
|
1902
|
+
/**
|
|
1903
|
+
* @param {FrameState} frameState
|
|
1904
|
+
* @param {GlobeSurfaceTileProvider} globeSurfaceTileProvider
|
|
1905
|
+
* @ignore
|
|
1906
|
+
*/
|
|
1815
1907
|
function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
1816
1908
|
const uniformMap = {
|
|
1817
1909
|
u_initialColor: function () {
|
|
@@ -2022,6 +2114,7 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
2022
2114
|
return frameState.context.defaultTexture;
|
|
2023
2115
|
},
|
|
2024
2116
|
u_clippingExtents: function () {
|
|
2117
|
+
// @ts-expect-error Missing types.
|
|
2025
2118
|
const texture = globeSurfaceTileProvider._clippingPolygons.extentsTexture;
|
|
2026
2119
|
if (defined(texture)) {
|
|
2027
2120
|
return texture;
|
|
@@ -2058,6 +2151,52 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
2058
2151
|
u_vertexShadowDarkness: function () {
|
|
2059
2152
|
return this.properties.vertexShadowDarkness;
|
|
2060
2153
|
},
|
|
2154
|
+
u_vectorSegmentTexture: function () {
|
|
2155
|
+
return (
|
|
2156
|
+
this.properties.vectorSegmentTexture ??
|
|
2157
|
+
frameState.context.defaultTexture
|
|
2158
|
+
);
|
|
2159
|
+
},
|
|
2160
|
+
u_vectorWidthTexture: function () {
|
|
2161
|
+
return (
|
|
2162
|
+
this.properties.vectorWidthTexture ?? frameState.context.defaultTexture
|
|
2163
|
+
);
|
|
2164
|
+
},
|
|
2165
|
+
u_vectorColorTexture: function () {
|
|
2166
|
+
return (
|
|
2167
|
+
this.properties.vectorColorTexture ?? frameState.context.defaultTexture
|
|
2168
|
+
);
|
|
2169
|
+
},
|
|
2170
|
+
u_vectorSegmentPrimitiveIndicesTexture: function () {
|
|
2171
|
+
return (
|
|
2172
|
+
this.properties.vectorSegmentPrimitiveIndicesTexture ??
|
|
2173
|
+
frameState.context.defaultTexture
|
|
2174
|
+
);
|
|
2175
|
+
},
|
|
2176
|
+
u_vectorGridCellIndicesTexture: function () {
|
|
2177
|
+
return (
|
|
2178
|
+
this.properties.vectorGridCellIndicesTexture ??
|
|
2179
|
+
frameState.context.defaultTexture
|
|
2180
|
+
);
|
|
2181
|
+
},
|
|
2182
|
+
u_vectorPolygonEdgeTexture: function () {
|
|
2183
|
+
return (
|
|
2184
|
+
this.properties.vectorPolygonEdgeTexture ??
|
|
2185
|
+
frameState.context.defaultTexture
|
|
2186
|
+
);
|
|
2187
|
+
},
|
|
2188
|
+
u_vectorPolygonEdgePrimitiveIndicesTexture: function () {
|
|
2189
|
+
return (
|
|
2190
|
+
this.properties.vectorPolygonEdgePrimitiveIndicesTexture ??
|
|
2191
|
+
frameState.context.defaultTexture
|
|
2192
|
+
);
|
|
2193
|
+
},
|
|
2194
|
+
u_vectorPolygonGridCellIndicesTexture: function () {
|
|
2195
|
+
return (
|
|
2196
|
+
this.properties.vectorPolygonGridCellIndicesTexture ??
|
|
2197
|
+
frameState.context.defaultTexture
|
|
2198
|
+
);
|
|
2199
|
+
},
|
|
2061
2200
|
|
|
2062
2201
|
// make a separate object so that changes to the properties are seen on
|
|
2063
2202
|
// derived commands that combine another uniform map with this one.
|
|
@@ -2130,6 +2269,15 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
2130
2269
|
undergroundColorAlphaByDistance: new Cartesian4(),
|
|
2131
2270
|
lambertDiffuseMultiplier: 0.0,
|
|
2132
2271
|
vertexShadowDarkness: 0.0,
|
|
2272
|
+
|
|
2273
|
+
vectorSegmentTexture: undefined,
|
|
2274
|
+
vectorWidthTexture: undefined,
|
|
2275
|
+
vectorColorTexture: undefined,
|
|
2276
|
+
vectorSegmentPrimitiveIndicesTexture: undefined,
|
|
2277
|
+
vectorGridCellIndicesTexture: undefined,
|
|
2278
|
+
vectorPolygonEdgeTexture: undefined,
|
|
2279
|
+
vectorPolygonEdgePrimitiveIndicesTexture: undefined,
|
|
2280
|
+
vectorPolygonGridCellIndicesTexture: undefined,
|
|
2133
2281
|
},
|
|
2134
2282
|
};
|
|
2135
2283
|
|
|
@@ -2140,8 +2288,13 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
2140
2288
|
return uniformMap;
|
|
2141
2289
|
}
|
|
2142
2290
|
|
|
2143
|
-
|
|
2144
|
-
|
|
2291
|
+
/**
|
|
2292
|
+
* @param {Context} context
|
|
2293
|
+
* @param {QuadtreeTile} tile
|
|
2294
|
+
* @ignore
|
|
2295
|
+
*/
|
|
2296
|
+
function createWireframeVertexArrayIfNecessary(context, tile) {
|
|
2297
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
2145
2298
|
|
|
2146
2299
|
let mesh;
|
|
2147
2300
|
let vertexArray;
|
|
@@ -2215,8 +2368,22 @@ function createWireframeVertexArray(context, vertexArray, terrainMesh) {
|
|
|
2215
2368
|
});
|
|
2216
2369
|
}
|
|
2217
2370
|
|
|
2371
|
+
/**
|
|
2372
|
+
* @type {Function}
|
|
2373
|
+
* @ignore
|
|
2374
|
+
*/
|
|
2218
2375
|
let getDebugOrientedBoundingBox;
|
|
2376
|
+
|
|
2377
|
+
/**
|
|
2378
|
+
* @type {Function}
|
|
2379
|
+
* @ignore
|
|
2380
|
+
*/
|
|
2219
2381
|
let getDebugBoundingSphere;
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* @type {VoidFunction}
|
|
2385
|
+
* @ignore
|
|
2386
|
+
*/
|
|
2220
2387
|
let debugDestroyPrimitive;
|
|
2221
2388
|
|
|
2222
2389
|
(function () {
|
|
@@ -2229,9 +2396,15 @@ let debugDestroyPrimitive;
|
|
|
2229
2396
|
geometry: new SphereOutlineGeometry({ radius: 1.0 }),
|
|
2230
2397
|
});
|
|
2231
2398
|
let modelMatrix = new Matrix4();
|
|
2399
|
+
/** @type {OrientedBoundingBox|BoundingSphere} */
|
|
2232
2400
|
let previousVolume;
|
|
2401
|
+
/** @type {Primitive} */
|
|
2233
2402
|
let primitive;
|
|
2234
2403
|
|
|
2404
|
+
/**
|
|
2405
|
+
* @param {unknown} instance
|
|
2406
|
+
* @returns {Primitive}
|
|
2407
|
+
*/
|
|
2235
2408
|
function createDebugPrimitive(instance) {
|
|
2236
2409
|
return new Primitive({
|
|
2237
2410
|
geometryInstances: instance,
|
|
@@ -2243,6 +2416,10 @@ let debugDestroyPrimitive;
|
|
|
2243
2416
|
});
|
|
2244
2417
|
}
|
|
2245
2418
|
|
|
2419
|
+
/**
|
|
2420
|
+
* @param {OrientedBoundingBox} obb
|
|
2421
|
+
* @param {Color} color
|
|
2422
|
+
*/
|
|
2246
2423
|
getDebugOrientedBoundingBox = function (obb, color) {
|
|
2247
2424
|
if (obb === previousVolume) {
|
|
2248
2425
|
return primitive;
|
|
@@ -2257,6 +2434,7 @@ let debugDestroyPrimitive;
|
|
|
2257
2434
|
);
|
|
2258
2435
|
|
|
2259
2436
|
instanceOBB.modelMatrix = modelMatrix;
|
|
2437
|
+
// @ts-expect-error Missing types.
|
|
2260
2438
|
instanceOBB.attributes.color =
|
|
2261
2439
|
ColorGeometryInstanceAttribute.fromColor(color);
|
|
2262
2440
|
|
|
@@ -2264,6 +2442,11 @@ let debugDestroyPrimitive;
|
|
|
2264
2442
|
return primitive;
|
|
2265
2443
|
};
|
|
2266
2444
|
|
|
2445
|
+
/**
|
|
2446
|
+
* @param {BoundingSphere} sphere
|
|
2447
|
+
* @param {Color} color
|
|
2448
|
+
* @returns {Primitive}
|
|
2449
|
+
*/
|
|
2267
2450
|
getDebugBoundingSphere = function (sphere, color) {
|
|
2268
2451
|
if (sphere === previousVolume) {
|
|
2269
2452
|
return primitive;
|
|
@@ -2279,6 +2462,7 @@ let debugDestroyPrimitive;
|
|
|
2279
2462
|
);
|
|
2280
2463
|
|
|
2281
2464
|
instanceSphere.modelMatrix = modelMatrix;
|
|
2465
|
+
// @ts-expect-error Missing types.
|
|
2282
2466
|
instanceSphere.attributes.color =
|
|
2283
2467
|
ColorGeometryInstanceAttribute.fromColor(color);
|
|
2284
2468
|
|
|
@@ -2296,6 +2480,11 @@ let debugDestroyPrimitive;
|
|
|
2296
2480
|
})();
|
|
2297
2481
|
|
|
2298
2482
|
const otherPassesInitialColor = new Cartesian4(0.0, 0.0, 0.0, 0.0);
|
|
2483
|
+
|
|
2484
|
+
/**
|
|
2485
|
+
* @type {GlobeSurfaceShaderSetOptions}
|
|
2486
|
+
* @ignore
|
|
2487
|
+
*/
|
|
2299
2488
|
const surfaceShaderSetOptionsScratch = {
|
|
2300
2489
|
frameState: undefined,
|
|
2301
2490
|
surfaceTile: undefined,
|
|
@@ -2305,6 +2494,9 @@ const surfaceShaderSetOptionsScratch = {
|
|
|
2305
2494
|
applyHue: undefined,
|
|
2306
2495
|
applySaturation: undefined,
|
|
2307
2496
|
applyGamma: undefined,
|
|
2497
|
+
applyToneMatch: undefined,
|
|
2498
|
+
applyToneMatchEdge: undefined,
|
|
2499
|
+
applyToneMatchCross: undefined,
|
|
2308
2500
|
applyAlpha: undefined,
|
|
2309
2501
|
applyDayNightAlpha: undefined,
|
|
2310
2502
|
applySplit: undefined,
|
|
@@ -2437,8 +2629,14 @@ function getNeighborImageryLevel(neighborTile, imageryLayer) {
|
|
|
2437
2629
|
// filled; reused across units and tiles every frame.
|
|
2438
2630
|
const edgeNeighborLevelsScratch = new Array(4);
|
|
2439
2631
|
|
|
2632
|
+
/**
|
|
2633
|
+
* @param {GlobeSurfaceTileProvider} tileProvider
|
|
2634
|
+
* @param {QuadtreeTile} tile
|
|
2635
|
+
* @param {FrameState} frameState
|
|
2636
|
+
* @ignore
|
|
2637
|
+
*/
|
|
2440
2638
|
function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
2441
|
-
const surfaceTile = tile.data;
|
|
2639
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
2442
2640
|
|
|
2443
2641
|
if (!defined(surfaceTile.vertexArray)) {
|
|
2444
2642
|
if (surfaceTile.fill === undefined) {
|
|
@@ -2464,6 +2662,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2464
2662
|
}
|
|
2465
2663
|
}
|
|
2466
2664
|
|
|
2665
|
+
// @ts-expect-error Missing types.
|
|
2467
2666
|
let maxTextures = ContextLimits.maximumTextureImageUnits;
|
|
2468
2667
|
|
|
2469
2668
|
let waterMaskTexture = surfaceTile.waterMaskTexture;
|
|
@@ -2505,14 +2704,17 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2505
2704
|
const showOceanWaves = showReflectiveOcean && defined(oceanNormalMap);
|
|
2506
2705
|
const terrainProvider = tileProvider.terrainProvider;
|
|
2507
2706
|
const hasVertexNormals =
|
|
2707
|
+
// @ts-expect-error Missing types.
|
|
2508
2708
|
defined(terrainProvider) && tileProvider.terrainProvider.hasVertexNormals;
|
|
2509
2709
|
const enableFog =
|
|
2510
2710
|
frameState.fog.enabled && frameState.fog.renderable && !cameraUnderground;
|
|
2511
2711
|
const showGroundAtmosphere =
|
|
2512
2712
|
tileProvider.showGroundAtmosphere && frameState.mode === SceneMode.SCENE3D;
|
|
2513
2713
|
const castShadows =
|
|
2714
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/issues/13420
|
|
2514
2715
|
ShadowMode.castShadows(tileProvider.shadows) && !translucent;
|
|
2515
2716
|
const receiveShadows =
|
|
2717
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/issues/13420
|
|
2516
2718
|
ShadowMode.receiveShadows(tileProvider.shadows) && !translucent;
|
|
2517
2719
|
|
|
2518
2720
|
const hueShift = tileProvider.hueShift;
|
|
@@ -2546,6 +2748,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2546
2748
|
}
|
|
2547
2749
|
if (
|
|
2548
2750
|
defined(tileProvider.clippingPlanes) &&
|
|
2751
|
+
// @ts-expect-error Missing types.
|
|
2549
2752
|
tileProvider.clippingPlanes.enabled
|
|
2550
2753
|
) {
|
|
2551
2754
|
--maxTextures;
|
|
@@ -2611,10 +2814,11 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2611
2814
|
}
|
|
2612
2815
|
|
|
2613
2816
|
if (
|
|
2614
|
-
frameState.mode === SceneMode.SCENE2D
|
|
2817
|
+
(frameState.mode === SceneMode.SCENE2D ||
|
|
2818
|
+
frameState.mode === SceneMode.COLUMBUS_VIEW) &&
|
|
2615
2819
|
encoding.quantization === TerrainQuantization.BITS12
|
|
2616
2820
|
) {
|
|
2617
|
-
// In 2D, the texture coordinates of the tile are interpolated over the rectangle to get the position in the vertex shader.
|
|
2821
|
+
// In 2D and Columbus View, the texture coordinates of the tile are interpolated over the rectangle to get the position in the vertex shader.
|
|
2618
2822
|
// When the texture coordinates are quantized, error is introduced. This can be seen through the 1px wide cracking
|
|
2619
2823
|
// between the quantized tiles in 2D. To compensate for the error, move the expand the rectangle in each direction by
|
|
2620
2824
|
// half the error amount.
|
|
@@ -2765,11 +2969,12 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2765
2969
|
}
|
|
2766
2970
|
|
|
2767
2971
|
command.owner = tile;
|
|
2768
|
-
|
|
2769
2972
|
++tileProvider._usedDrawCommands;
|
|
2770
2973
|
|
|
2771
2974
|
if (tile === tileProvider._debug.boundingSphereTile) {
|
|
2975
|
+
// @ts-expect-error Missing types.
|
|
2772
2976
|
const obb = tileBoundingRegion.boundingVolume;
|
|
2977
|
+
// @ts-expect-error Missing types.
|
|
2773
2978
|
const boundingSphere = tileBoundingRegion.boundingSphere;
|
|
2774
2979
|
// If a debug primitive already exists for this tile, it will not be
|
|
2775
2980
|
// re-created, to avoid allocation every frame. If it were possible
|
|
@@ -3389,10 +3594,32 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
3389
3594
|
uniformMapProperties.clippingPlanesEdgeWidth = clippingPlanes.edgeWidth;
|
|
3390
3595
|
}
|
|
3391
3596
|
|
|
3597
|
+
// update vector collections clamped to terrain
|
|
3598
|
+
const vectorData = surfaceTile.vectorData;
|
|
3599
|
+
if (defined(vectorData)) {
|
|
3600
|
+
uniformMapProperties.vectorSegmentTexture =
|
|
3601
|
+
vectorData.polylineSegmentTexture;
|
|
3602
|
+
uniformMapProperties.vectorWidthTexture = vectorData.widthTexture;
|
|
3603
|
+
uniformMapProperties.vectorColorTexture = vectorData.colorTexture;
|
|
3604
|
+
uniformMapProperties.vectorSegmentPrimitiveIndicesTexture =
|
|
3605
|
+
vectorData.polylineSegmentPrimitiveIndicesTexture;
|
|
3606
|
+
uniformMapProperties.vectorGridCellIndicesTexture =
|
|
3607
|
+
vectorData.polylineGridCellIndicesTexture;
|
|
3608
|
+
uniformMapProperties.vectorPolygonEdgeTexture =
|
|
3609
|
+
vectorData.polygonEdgeTexture;
|
|
3610
|
+
uniformMapProperties.vectorPolygonEdgePrimitiveIndicesTexture =
|
|
3611
|
+
vectorData.polygonEdgePrimitiveIndicesTexture;
|
|
3612
|
+
uniformMapProperties.vectorPolygonGridCellIndicesTexture =
|
|
3613
|
+
vectorData.polygonGridCellIndicesTexture;
|
|
3614
|
+
}
|
|
3615
|
+
|
|
3392
3616
|
// update clipping polygons
|
|
3393
3617
|
const clippingPolygons = tileProvider._clippingPolygons;
|
|
3394
3618
|
const clippingPolygonsEnabled =
|
|
3395
|
-
defined(clippingPolygons) &&
|
|
3619
|
+
defined(clippingPolygons) &&
|
|
3620
|
+
clippingPolygons.enabled &&
|
|
3621
|
+
clippingPolygons.length > 0 &&
|
|
3622
|
+
tile.isClipped;
|
|
3396
3623
|
|
|
3397
3624
|
surfaceShaderSetOptions.numberOfDayTextures = numberOfDayTextures;
|
|
3398
3625
|
surfaceShaderSetOptions.applyBrightness = applyBrightness;
|
|
@@ -3437,7 +3664,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
3437
3664
|
command.pass = Pass.GLOBE;
|
|
3438
3665
|
|
|
3439
3666
|
if (tileProvider._debug.wireframe) {
|
|
3440
|
-
createWireframeVertexArrayIfNecessary(context,
|
|
3667
|
+
createWireframeVertexArrayIfNecessary(context, tile);
|
|
3441
3668
|
if (defined(surfaceTile.wireframeVertexArray)) {
|
|
3442
3669
|
command.vertexArray = surfaceTile.wireframeVertexArray;
|
|
3443
3670
|
command.primitiveType = PrimitiveType.LINES;
|
|
@@ -3502,4 +3729,5 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
3502
3729
|
} while (imageryIndex < imageryLen);
|
|
3503
3730
|
} // for worldIndex (Columbus repeat-world copies)
|
|
3504
3731
|
}
|
|
3732
|
+
|
|
3505
3733
|
export default GlobeSurfaceTileProvider;
|