@cesium/engine 26.0.0 → 26.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Build/ThirdParty/Workers/zip-web-worker.js +586 -480
- package/Build/Workers/{chunk-7J2HKPRH.js → chunk-27FWRTJI.js} +9 -9
- package/Build/Workers/{chunk-EF2QYXGA.js → chunk-2EFYUSUY.js} +14 -14
- package/Build/Workers/chunk-2H5264K7.js +1284 -0
- package/Build/Workers/{chunk-DOBXCNC3.js → chunk-2H73KDBM.js} +13 -13
- package/Build/Workers/chunk-2RGJPWQX.js +1284 -0
- package/Build/Workers/chunk-2Z4ZLVOD.js +352 -0
- package/Build/Workers/{chunk-F6QDY6HU.js → chunk-2ZKH2QZB.js} +13 -13
- package/Build/Workers/chunk-36NI5E6W.js +3820 -0
- package/Build/Workers/{chunk-ZK3CF7ZD.js → chunk-37SW7SYS.js} +12 -12
- package/Build/Workers/chunk-3GHVJ3SO.js +455 -0
- package/Build/Workers/chunk-3LB4UVPU.js +387 -0
- package/Build/Workers/chunk-3PONLKEL.js +778 -0
- package/Build/Workers/{chunk-Y57HREW5.js → chunk-3PSS3T43.js} +4 -4
- package/Build/Workers/chunk-3QR662HH.js +3820 -0
- package/Build/Workers/{chunk-QN67VG36.js → chunk-3SX2WYSO.js} +6 -6
- package/Build/Workers/{chunk-G7PXZRVF.js → chunk-3UDN6LYX.js} +7 -7
- package/Build/Workers/chunk-47MCBSXI.js +9237 -0
- package/Build/Workers/{chunk-KKOSKAZB.js → chunk-4E626OCE.js} +17 -17
- package/Build/Workers/chunk-4NW2MJKH.js +455 -0
- package/Build/Workers/{chunk-DBOEKL43.js → chunk-52YK5BSN.js} +7 -7
- package/Build/Workers/{chunk-KFSTQKNM.js → chunk-5LSOO2KD.js} +7 -7
- package/Build/Workers/chunk-5RNAQZK6.js +9234 -0
- package/Build/Workers/chunk-5YPQBFRD.js +519 -0
- package/Build/Workers/{chunk-S4MCOY6I.js → chunk-6FHT43QR.js} +5 -5
- package/Build/Workers/chunk-6FZDPMTO.js +455 -0
- package/Build/Workers/{chunk-VQYETPWC.js → chunk-6HK6IXK2.js} +4 -4
- package/Build/Workers/chunk-6R5X2GUA.js +1284 -0
- package/Build/Workers/{chunk-AYKR4VBR.js → chunk-6YR6JBMY.js} +2 -2
- package/Build/Workers/chunk-76FDC45O.js +511 -0
- package/Build/Workers/chunk-7A2OGDHT.js +305 -0
- package/Build/Workers/chunk-7CGEQUM2.js +305 -0
- package/Build/Workers/{chunk-54I6Y66F.js → chunk-7D2HZKH7.js} +6 -6
- package/Build/Workers/{chunk-3VFEWOBI.js → chunk-7I325HV6.js} +7 -7
- package/Build/Workers/{chunk-4MGMYHOO.js → chunk-7KVKHY7O.js} +6 -6
- package/Build/Workers/chunk-7MM3N2VE.js +1067 -0
- package/Build/Workers/chunk-7TKLTCZW.js +219 -0
- package/Build/Workers/chunk-7UUKBDH6.js +1054 -0
- package/Build/Workers/chunk-7W6DUHAB.js +693 -0
- package/Build/Workers/{chunk-DDWSZVMY.js → chunk-7XM5JK5F.js} +5 -5
- package/Build/Workers/chunk-7YG3ND3P.js +454 -0
- package/Build/Workers/{chunk-IRBKFCEJ.js → chunk-A3O6EDBK.js} +2 -2
- package/Build/Workers/chunk-A62YI6S6.js +305 -0
- package/Build/Workers/{chunk-V7VQKN6N.js → chunk-A6X24AZI.js} +5 -5
- package/Build/Workers/chunk-A7TTWVTF.js +2719 -0
- package/Build/Workers/chunk-ACTVJHSP.js +519 -0
- package/Build/Workers/chunk-ADX3CBKD.js +9234 -0
- package/Build/Workers/{chunk-52JDLOEM.js → chunk-AF7DTMJ7.js} +14 -14
- package/Build/Workers/{chunk-ZP7JMQV4.js → chunk-AHWAZRBV.js} +6 -2
- package/Build/Workers/chunk-AJSFRY4U.js +1344 -0
- package/Build/Workers/{chunk-EBSIOBXY.js → chunk-ARZICEEP.js} +8 -8
- package/Build/Workers/chunk-B3QHNA4A.js +147 -0
- package/Build/Workers/{chunk-YLY7NKAB.js → chunk-B4CQSLZJ.js} +4 -4
- package/Build/Workers/chunk-BKPQFCXH.js +511 -0
- package/Build/Workers/{chunk-O3EA5HS7.js → chunk-BSPCI2LO.js} +10 -10
- package/Build/Workers/chunk-BUJWSX5S.js +301 -0
- package/Build/Workers/{chunk-J6BWOHUF.js → chunk-C7JQVRLM.js} +3 -3
- package/Build/Workers/chunk-C7QDUNI3.js +138 -0
- package/Build/Workers/{chunk-KSSWJIZW.js → chunk-CDJDJ5LK.js} +2 -2
- package/Build/Workers/chunk-CEEZE3YZ.js +476 -0
- package/Build/Workers/chunk-CIV5DJOQ.js +778 -0
- package/Build/Workers/{chunk-INUEEEQA.js → chunk-CLCTQVVL.js} +8 -8
- package/Build/Workers/{chunk-C6J67V5A.js → chunk-CQNFIAZU.js} +1 -1
- package/Build/Workers/chunk-CRCGE4J4.js +9237 -0
- package/Build/Workers/{chunk-SMQZZOW6.js → chunk-CUTRKXUQ.js} +10 -10
- package/Build/Workers/{chunk-Q3PY526V.js → chunk-D6AY775A.js} +6 -6
- package/Build/Workers/chunk-DBD5WWG2.js +959 -0
- package/Build/Workers/{chunk-E7VQ76KE.js → chunk-DIGUUD6G.js} +6 -6
- package/Build/Workers/{chunk-P3CK7MCY.js → chunk-DSGLDRTI.js} +4 -4
- package/Build/Workers/chunk-DZBQUULR.js +138 -0
- package/Build/Workers/chunk-DZUFEE4L.js +140 -0
- package/Build/Workers/chunk-E2NKV5YT.js +3820 -0
- package/Build/Workers/{chunk-424RNO3D.js → chunk-E7NZJOK7.js} +196 -22
- package/Build/Workers/{chunk-UOOIQ3KX.js → chunk-EB3Y5P3A.js} +12 -12
- package/Build/Workers/{chunk-ACXQXN46.js → chunk-EHTS2YPT.js} +16 -16
- package/Build/Workers/{chunk-EPYXRCDB.js → chunk-ELE6SC2C.js} +12 -12
- package/Build/Workers/{chunk-VWV2IJRB.js → chunk-ENNFMWDW.js} +11 -11
- package/Build/Workers/chunk-EOWDZN5S.js +288 -0
- package/Build/Workers/chunk-ERKUET22.js +3201 -0
- package/Build/Workers/chunk-EZGQPOIG.js +162 -0
- package/Build/Workers/chunk-F2IMBMZY.js +241 -0
- package/Build/Workers/chunk-F4CSNRZO.js +219 -0
- package/Build/Workers/chunk-FBP4DUQJ.js +693 -0
- package/Build/Workers/{chunk-FRQZECAO.js → chunk-FCP2QY4G.js} +5 -5
- package/Build/Workers/{chunk-ZZ46LWL6.js → chunk-FDK4K5IA.js} +1 -1
- package/Build/Workers/{chunk-C6KNZ7T4.js → chunk-FGQFQHN5.js} +17 -17
- package/Build/Workers/chunk-FJWZMGOQ.js +1992 -0
- package/Build/Workers/{chunk-Y5BF6AFU.js → chunk-FQ42MT7M.js} +2 -2
- package/Build/Workers/chunk-FU4BGABC.js +398 -0
- package/Build/Workers/chunk-FX3VEAIU.js +2719 -0
- package/Build/Workers/chunk-GGNWQWSB.js +301 -0
- package/Build/Workers/chunk-GHXVQVUM.js +1344 -0
- package/Build/Workers/{chunk-CZEYZU4N.js → chunk-GNKXEN4C.js} +10 -10
- package/Build/Workers/{chunk-MYP774IS.js → chunk-GSWMAFTE.js} +8 -8
- package/Build/Workers/chunk-GVA7XQI2.js +368 -0
- package/Build/Workers/chunk-GXDHRC4J.js +1344 -0
- package/Build/Workers/chunk-GXWQZBAI.js +58 -0
- package/Build/Workers/chunk-GYSYP6PC.js +1067 -0
- package/Build/Workers/chunk-H2WCFXLP.js +241 -0
- package/Build/Workers/chunk-HDL4HOXZ.js +778 -0
- package/Build/Workers/chunk-HHV3MCGV.js +162 -0
- package/Build/Workers/chunk-HLW2ZRVK.js +368 -0
- package/Build/Workers/chunk-HS6AD4P2.js +398 -0
- package/Build/Workers/chunk-HT6FASOT.js +973 -0
- package/Build/Workers/chunk-I74ZH5LK.js +959 -0
- package/Build/Workers/{chunk-7WM2PX4V.js → chunk-IDVHUDZT.js} +5 -5
- package/Build/Workers/chunk-IGAZBTFZ.js +3201 -0
- package/Build/Workers/chunk-IJZJMIUY.js +789 -0
- package/Build/Workers/chunk-ILME5BXA.js +301 -0
- package/Build/Workers/chunk-IMBVP57H.js +44 -0
- package/Build/Workers/chunk-IOO7Z2AV.js +57 -0
- package/Build/Workers/chunk-IUIFLOYO.js +44 -0
- package/Build/Workers/chunk-J73T2VOY.js +171 -0
- package/Build/Workers/chunk-JALGQYDY.js +288 -0
- package/Build/Workers/chunk-JKXV6PG5.js +56 -0
- package/Build/Workers/chunk-JW6OZT4R.js +288 -0
- package/Build/Workers/{chunk-CXOYE2WM.js → chunk-JXYLJCTC.js} +5 -5
- package/Build/Workers/{chunk-CFQP6LYM.js → chunk-K27QOAW6.js} +4 -4
- package/Build/Workers/chunk-KGXSYGBG.js +387 -0
- package/Build/Workers/chunk-KMV25A63.js +789 -0
- package/Build/Workers/chunk-KP5QD7WU.js +693 -0
- package/Build/Workers/chunk-KZWFWJML.js +2719 -0
- package/Build/Workers/chunk-LCXRRALY.js +387 -0
- package/Build/Workers/chunk-LD64RPYV.js +368 -0
- package/Build/Workers/{chunk-U3ZA64U7.js → chunk-LDRQSYBN.js} +2 -2
- package/Build/Workers/chunk-LGNDTZVX.js +97 -0
- package/Build/Workers/chunk-LNSQVXFH.js +1800 -0
- package/Build/Workers/chunk-M4JZ6TSZ.js +959 -0
- package/Build/Workers/chunk-M6QKXVAU.js +1054 -0
- package/Build/Workers/chunk-MAAHFYPC.js +198 -0
- package/Build/Workers/chunk-MCJDRDJQ.js +102 -0
- package/Build/Workers/chunk-MEENMEAH.js +198 -0
- package/Build/Workers/{chunk-TKKIREQ6.js → chunk-N7CCOFLX.js} +1 -1
- package/Build/Workers/chunk-NAWU5RF4.js +162 -0
- package/Build/Workers/{chunk-M3B5JKSM.js → chunk-NCL22ZUX.js} +1 -1
- package/Build/Workers/chunk-NEFDMMLY.js +241 -0
- package/Build/Workers/{chunk-UA25D5MX.js → chunk-NIWITKQK.js} +10 -10
- package/Build/Workers/chunk-NJVBJG63.js +124 -0
- package/Build/Workers/chunk-NLLCQBX3.js +73 -0
- package/Build/Workers/chunk-NSKZ6SBK.js +1483 -0
- package/Build/Workers/chunk-NXGQBQWE.js +837 -0
- package/Build/Workers/chunk-O3DKEX7Q.js +352 -0
- package/Build/Workers/chunk-O3XFXGPZ.js +476 -0
- package/Build/Workers/chunk-OA6MYL2C.js +837 -0
- package/Build/Workers/chunk-OBEU25PI.js +1067 -0
- package/Build/Workers/chunk-OHP4ELS7.js +198 -0
- package/Build/Workers/chunk-OZGPS7FB.js +138 -0
- package/Build/Workers/chunk-PCL3Y7H5.js +82 -0
- package/Build/Workers/chunk-PD4GK4EM.js +57 -0
- package/Build/Workers/chunk-PEDU33QG.js +2342 -0
- package/Build/Workers/chunk-PRWUMCXF.js +682 -0
- package/Build/Workers/chunk-PVTSNNVI.js +288 -0
- package/Build/Workers/chunk-QFSSCLLZ.js +973 -0
- package/Build/Workers/chunk-QHPZH22L.js +241 -0
- package/Build/Workers/chunk-QIZDWZK6.js +301 -0
- package/Build/Workers/chunk-QV6DG2YX.js +1483 -0
- package/Build/Workers/chunk-QVLAFFJY.js +56 -0
- package/Build/Workers/{chunk-6YEE6JDR.js → chunk-R4FPNAZ2.js} +6 -6
- package/Build/Workers/chunk-R4K7EHOU.js +171 -0
- package/Build/Workers/chunk-R7JGHDD6.js +789 -0
- package/Build/Workers/chunk-RASQEYD4.js +1483 -0
- package/Build/Workers/chunk-RG4F5R57.js +454 -0
- package/Build/Workers/chunk-RW6ITX7Q.js +3820 -0
- package/Build/Workers/chunk-RYSQVJR6.js +398 -0
- package/Build/Workers/chunk-S6RJU5NM.js +1054 -0
- package/Build/Workers/chunk-SA2A2AN5.js +2342 -0
- package/Build/Workers/chunk-SDFHDNS4.js +147 -0
- package/Build/Workers/chunk-SF6K72D7.js +124 -0
- package/Build/Workers/chunk-SGRGNDOD.js +682 -0
- package/Build/Workers/{chunk-QRWGUWI6.js → chunk-SJYSIOEM.js} +11 -11
- package/Build/Workers/chunk-SM2CDCYF.js +198 -0
- package/Build/Workers/chunk-SMTGMFBL.js +97 -0
- package/Build/Workers/chunk-SS5ABQGY.js +102 -0
- package/Build/Workers/{chunk-IYOUHCZB.js → chunk-SXSP3JHS.js} +1 -1
- package/Build/Workers/chunk-T5QBPLE3.js +414 -0
- package/Build/Workers/chunk-TN35HP5B.js +1067 -0
- package/Build/Workers/chunk-TNWKJNUZ.js +454 -0
- package/Build/Workers/chunk-TOAF47AQ.js +102 -0
- package/Build/Workers/chunk-TQ4QCOXT.js +2719 -0
- package/Build/Workers/chunk-TSDSILQB.js +124 -0
- package/Build/Workers/chunk-TVZD72WJ.js +778 -0
- package/Build/Workers/chunk-U5LV3F3Z.js +1054 -0
- package/Build/Workers/chunk-UAZUP4I5.js +1992 -0
- package/Build/Workers/chunk-UEY73NRN.js +38 -0
- package/Build/Workers/chunk-UF46SZEZ.js +789 -0
- package/Build/Workers/chunk-UNRTMCET.js +398 -0
- package/Build/Workers/chunk-UTB7U3O6.js +1992 -0
- package/Build/Workers/chunk-UVO6COT2.js +352 -0
- package/Build/Workers/chunk-V46YGZE6.js +352 -0
- package/Build/Workers/chunk-VAL7DYNR.js +278 -0
- package/Build/Workers/chunk-VDGOCROW.js +57 -0
- package/Build/Workers/chunk-VFWSSBPT.js +511 -0
- package/Build/Workers/chunk-VVYMXI3I.js +1284 -0
- package/Build/Workers/chunk-VXWHPYQM.js +837 -0
- package/Build/Workers/chunk-VXYUBRSB.js +219 -0
- package/Build/Workers/chunk-VZLDLEWI.js +387 -0
- package/Build/Workers/{chunk-4S7IE3LB.js → chunk-W5OCKMPJ.js} +2 -2
- package/Build/Workers/chunk-WBSY7HDY.js +837 -0
- package/Build/Workers/chunk-WN3F4CVG.js +3201 -0
- package/Build/Workers/chunk-WPRUWXGV.js +693 -0
- package/Build/Workers/chunk-WTO2ERBP.js +414 -0
- package/Build/Workers/chunk-WVHMDVG4.js +959 -0
- package/Build/Workers/chunk-XCBZVTIV.js +280 -0
- package/Build/Workers/chunk-XDWCTQCZ.js +101 -0
- package/Build/Workers/chunk-XGA23TAX.js +73 -0
- package/Build/Workers/chunk-XLQZNQ4Z.js +163 -0
- package/Build/Workers/chunk-XLXSDIP5.js +973 -0
- package/Build/Workers/chunk-XQ3SKCMM.js +140 -0
- package/Build/Workers/chunk-XQH66YJC.js +147 -0
- package/Build/Workers/chunk-XTA7BXJG.js +682 -0
- package/Build/Workers/chunk-XTIDAFRS.js +476 -0
- package/Build/Workers/chunk-XUEDWBUD.js +682 -0
- package/Build/Workers/chunk-XYFLRH3H.js +124 -0
- package/Build/Workers/chunk-Y7JRTRTO.js +305 -0
- package/Build/Workers/chunk-Y7QSMDCJ.js +352 -0
- package/Build/Workers/chunk-YCB5TYTR.js +1483 -0
- package/Build/Workers/chunk-YEYOSTJX.js +219 -0
- package/Build/Workers/chunk-YGFVAGYF.js +630 -0
- package/Build/Workers/chunk-YIIACKQO.js +368 -0
- package/Build/Workers/chunk-YJGSP6PE.js +511 -0
- package/Build/Workers/{chunk-XZMBNNDX.js → chunk-YKU2Q3A2.js} +9 -9
- package/Build/Workers/chunk-Z4LR5EHE.js +454 -0
- package/Build/Workers/chunk-Z66EVE2A.js +44 -0
- package/Build/Workers/chunk-ZHIHHHTB.js +414 -0
- package/Build/Workers/chunk-ZMBHFYOX.js +1344 -0
- package/Build/Workers/chunk-ZNWHFSLE.js +171 -0
- package/Build/Workers/chunk-ZQLZG4IN.js +2342 -0
- package/Build/Workers/chunk-ZRTSMUZ2.js +414 -0
- package/Build/Workers/{chunk-MPZHGZU6.js → chunk-ZSGUV73H.js} +4 -4
- package/Build/Workers/chunk-ZZUVT5BM.js +476 -0
- package/Build/Workers/combineGeometry.js +24 -24
- package/Build/Workers/createBoxGeometry.js +18 -18
- package/Build/Workers/createBoxOutlineGeometry.js +16 -16
- package/Build/Workers/createCircleGeometry.js +26 -26
- package/Build/Workers/createCircleOutlineGeometry.js +19 -19
- package/Build/Workers/createCoplanarPolygonGeometry.js +35 -35
- package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createCorridorGeometry.js +31 -33
- package/Build/Workers/createCorridorOutlineGeometry.js +29 -31
- package/Build/Workers/createCylinderGeometry.js +20 -20
- package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
- package/Build/Workers/createEllipseGeometry.js +26 -26
- package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
- package/Build/Workers/createEllipsoidGeometry.js +19 -19
- package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
- package/Build/Workers/createFrustumGeometry.js +18 -18
- package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
- package/Build/Workers/createGeometry.js +24 -24
- package/Build/Workers/createGroundPolylineGeometry.js +24 -24
- package/Build/Workers/createPlaneGeometry.js +16 -16
- package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
- package/Build/Workers/createPolygonGeometry.js +34 -34
- package/Build/Workers/createPolygonOutlineGeometry.js +31 -31
- package/Build/Workers/createPolylineGeometry.js +26 -26
- package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
- package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
- package/Build/Workers/createRectangleGeometry.js +27 -27
- package/Build/Workers/createRectangleOutlineGeometry.js +21 -21
- package/Build/Workers/createSimplePolylineGeometry.js +24 -24
- package/Build/Workers/createSphereGeometry.js +19 -19
- package/Build/Workers/createSphereOutlineGeometry.js +18 -18
- package/Build/Workers/createTaskProcessorWorker.js +3 -3
- package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
- package/Build/Workers/createVectorTileGeometries.js +24 -24
- package/Build/Workers/createVectorTilePoints.js +13 -13
- package/Build/Workers/createVectorTilePolygons.js +22 -22
- package/Build/Workers/createVectorTilePolylines.js +14 -14
- package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
- package/Build/Workers/createVerticesFromHeightmap.js +22 -22
- package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
- package/Build/Workers/createWallGeometry.js +24 -24
- package/Build/Workers/createWallOutlineGeometry.js +24 -24
- package/Build/Workers/decodeDraco.js +10 -10
- package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +987 -2320
- package/Build/Workers/decodeI3S.js +10 -10
- package/Build/Workers/gaussianSplatSorter.js +4 -4
- package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
- package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
- package/Build/Workers/transcodeKTX2.js +6 -6
- package/Build/Workers/transferTypedArrayTest.js +1 -1
- package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
- package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
- package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
- package/Source/Core/BoundingRectangle.js +6 -8
- package/Source/Core/BoundingSphere.js +0 -3
- package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
- package/Source/Core/Color.js +1 -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/GroundPolylineGeometry.js +2 -2
- 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/Math.js +59 -0
- package/Source/Core/Matrix2.js +2 -2
- package/Source/Core/Matrix3.js +2 -2
- package/Source/Core/OrthographicFrustum.js +1 -1
- package/Source/Core/PerspectiveFrustum.js +1 -1
- package/Source/Core/PolygonGeometry.js +2 -2
- package/Source/Core/PolygonGeometryLibrary.js +1 -1
- package/Source/Core/PolygonOutlineGeometry.js +1 -1
- package/Source/Core/PolylineGeometry.js +1 -1
- package/Source/Core/PolylineVolumeGeometryLibrary.js +1 -1
- package/Source/Core/Rectangle.js +7 -1
- package/Source/Core/RectangleOutlineGeometry.js +1 -1
- package/Source/Core/SimplePolylineGeometry.js +1 -1
- package/Source/Core/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/getTimestamp.js +4 -2
- 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 -10
- package/Source/Renderer/Texture.js +12 -1
- package/Source/Renderer/UniformState.js +7 -0
- package/Source/Renderer/VertexArray.js +1 -1
- package/Source/Scene/ArcGisMapServerImageryProvider.js +0 -5
- package/Source/Scene/ArcGisMapService.js +1 -1
- package/Source/Scene/Billboard.js +2 -1
- package/Source/Scene/BillboardCollection.js +7 -3
- package/Source/Scene/BillboardTexture.js +5 -3
- package/Source/Scene/BufferPrimitiveCollection.js +27 -5
- package/Source/Scene/Camera.js +71 -5
- package/Source/Scene/Cesium3DTileOptimizations.js +4 -6
- package/Source/Scene/Cesium3DTileset.js +1 -1
- package/Source/Scene/ClippingPlaneCollection.js +4 -4
- package/Source/Scene/ClippingPolygon.js +2 -0
- package/Source/Scene/ClippingPolygonCollection.js +2 -2
- 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/EdgeFramebuffer.js +1 -5
- package/Source/Scene/Expression.js +6 -8
- package/Source/Scene/FrameState.js +17 -0
- package/Source/Scene/Globe.js +20 -0
- package/Source/Scene/GlobeDepth.js +27 -1
- package/Source/Scene/GlobeSurfaceShaderSet.js +511 -409
- package/Source/Scene/GlobeSurfaceTile.js +575 -398
- package/Source/Scene/GlobeSurfaceTileProvider.js +1382 -1151
- package/Source/Scene/GltfBufferViewLoader.js +3 -3
- package/Source/Scene/GltfLoader.js +33 -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/IonImageryProvider.js +1 -5
- package/Source/Scene/Label.js +4 -4
- package/Source/Scene/LabelCollection.js +1 -1
- package/Source/Scene/MVTDataProvider.js +2 -0
- package/Source/Scene/Material.js +1 -0
- package/Source/Scene/Model/B3dmLoader.js +1 -2
- package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +10 -8
- 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 +11 -10
- package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
- package/Source/Scene/Model/ModelDrawCommand.js +160 -16
- package/Source/Scene/Model/ModelDrawCommands.js +4 -0
- package/Source/Scene/Model/ModelSceneGraph.js +21 -0
- package/Source/Scene/Model/ModelUtility.js +1 -0
- package/Source/Scene/Model/PickingPipelineStage.js +29 -0
- package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
- package/Source/Scene/ModelComponents.js +71 -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 +1 -1
- 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 +203 -5
- package/Source/Scene/ScreenSpaceCameraController.js +1 -2
- package/Source/Scene/ShadowMap.js +9 -3
- package/Source/Scene/ShadowMapShader.js +50 -2
- package/Source/Scene/SnapFramebuffer.js +121 -0
- package/Source/Scene/Snapping.js +184 -0
- package/Source/Scene/TerrainFillMesh.js +3 -2
- package/Source/Scene/UrlTemplate3DTilesDataProvider.js +1 -1
- package/Source/Scene/Vector3DTileContent.js +2 -3
- package/Source/Scene/VectorGltf3DTileContent.js +23 -3
- package/Source/Scene/View.js +10 -8
- package/Source/Scene/VoxelTraversal.js +1 -1
- package/Source/Scene/createElevationBandMaterial.js +1 -1
- package/Source/Scene/findMeshoptExtension.js +23 -0
- package/Source/Scene/renderBufferPointCollection.js +14 -10
- package/Source/Scene/renderBufferPolygonCollection.js +10 -15
- package/Source/Scene/renderBufferPolylineCollection.js +121 -194
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.glsl +9 -0
- package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.js +11 -0
- package/Source/Shaders/Builtin/Constants/passClassification.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passClassification.js +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
- package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
- package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
- package/Source/Shaders/GlobeFS.glsl +10 -5
- package/Source/Shaders/GlobeFS.js +9 -5
- package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
- package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
- package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
- package/Source/Shaders/Model/MaterialStageFS.js +8 -2
- package/Source/Shaders/Model/ModelFS.glsl +105 -0
- package/Source/Shaders/Model/ModelFS.js +105 -0
- package/Source/Shaders/VectorCommon.glsl +178 -0
- package/Source/Shaders/VectorCommon.js +75 -0
- package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
- package/Source/ThirdParty/zip-module.wasm +0 -0
- package/Source/Widget/CesiumWidget.js +30 -0
- package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2
- package/Source/Workers/incrementallyBuildTerrainPicker.js +2 -0
- package/index.d.ts +825 -260
- package/index.js +29 -10
- package/package.json +4 -4
|
@@ -52,1021 +52,1411 @@ import TerrainState from "./TerrainState.js";
|
|
|
52
52
|
import TileBoundingRegion from "./TileBoundingRegion.js";
|
|
53
53
|
import TileSelectionResult from "./TileSelectionResult.js";
|
|
54
54
|
|
|
55
|
+
/** @import Context from "../Renderer/Context.js"; */
|
|
56
|
+
/** @import EllipsoidalOccluder from "../Core/EllipsoidalOccluder.js"; */
|
|
57
|
+
/** @import FrameState from "./FrameState.js"; */
|
|
58
|
+
/** @import GlobeSurfaceShaderSet from "./GlobeSurfaceShaderSet.js"; */
|
|
59
|
+
/** @import ImageryLayerCollection from "./ImageryLayerCollection.js"; */
|
|
60
|
+
/** @import QuadtreeOccluders from "./QuadtreeOccluders.js"; */
|
|
61
|
+
/** @import QuadtreePrimitive from "./QuadtreePrimitive.js"; */
|
|
62
|
+
/** @import QuadtreeTile from "./QuadtreeTile.js"; */
|
|
63
|
+
/** @import TerrainMesh from "../Core/TerrainMesh.js"; */
|
|
64
|
+
/** @import TerrainProvider from "../Core/TerrainProvider.js"; */
|
|
65
|
+
/** @import TilingScheme from "../Core/TilingScheme.js"; */
|
|
66
|
+
/** @import VectorProvider, { VectorTileData } from "../Core/VectorProvider.js"; */
|
|
67
|
+
/** @import { GlobeSurfaceShaderSetOptions } from "./GlobeSurfaceShaderSet.js"; */
|
|
68
|
+
|
|
55
69
|
/**
|
|
56
70
|
* Provides quadtree tiles representing the surface of the globe. This type is intended to be used
|
|
57
71
|
* with {@link QuadtreePrimitive}.
|
|
58
72
|
*
|
|
59
|
-
* @alias GlobeSurfaceTileProvider
|
|
60
|
-
* @constructor
|
|
61
|
-
*
|
|
62
|
-
* @param {TerrainProvider} options.terrainProvider The terrain provider that describes the surface geometry.
|
|
63
|
-
* @param {ImageryLayerCollection} option.imageryLayers The collection of imagery layers describing the shading of the surface.
|
|
64
|
-
* @param {GlobeSurfaceShaderSet} options.surfaceShaderSet The set of shaders used to render the surface.
|
|
65
|
-
*
|
|
66
73
|
* @private
|
|
67
74
|
*/
|
|
68
|
-
|
|
69
|
-
//>>includeStart('debug', pragmas.debug);
|
|
70
|
-
if (!defined(options)) {
|
|
71
|
-
throw new DeveloperError("options is required.");
|
|
72
|
-
}
|
|
73
|
-
if (!defined(options.terrainProvider)) {
|
|
74
|
-
throw new DeveloperError("options.terrainProvider is required.");
|
|
75
|
-
} else if (!defined(options.imageryLayers)) {
|
|
76
|
-
throw new DeveloperError("options.imageryLayers is required.");
|
|
77
|
-
} else if (!defined(options.surfaceShaderSet)) {
|
|
78
|
-
throw new DeveloperError("options.surfaceShaderSet is required.");
|
|
79
|
-
}
|
|
80
|
-
//>>includeEnd('debug');
|
|
81
|
-
|
|
82
|
-
this.lightingFadeOutDistance = 6500000.0;
|
|
83
|
-
this.lightingFadeInDistance = 9000000.0;
|
|
84
|
-
this.hasWaterMask = false;
|
|
85
|
-
this.showWaterEffect = false;
|
|
86
|
-
this.oceanNormalMap = undefined;
|
|
87
|
-
this.zoomedOutOceanSpecularIntensity = 0.5;
|
|
88
|
-
this.enableLighting = false;
|
|
89
|
-
this.dynamicAtmosphereLighting = false;
|
|
90
|
-
this.dynamicAtmosphereLightingFromSun = false;
|
|
91
|
-
this.showGroundAtmosphere = false;
|
|
92
|
-
this.shadows = ShadowMode.RECEIVE_ONLY;
|
|
93
|
-
this.vertexShadowDarkness = 0.3;
|
|
94
|
-
|
|
75
|
+
class GlobeSurfaceTileProvider {
|
|
95
76
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @
|
|
101
|
-
* @default undefined
|
|
77
|
+
* @param {object} options
|
|
78
|
+
* @param {TerrainProvider} options.terrainProvider The terrain provider that describes the surface geometry.
|
|
79
|
+
* @param {ImageryLayerCollection} options.imageryLayers The collection of imagery layers describing the shading of the surface.
|
|
80
|
+
* @param {GlobeSurfaceShaderSet} options.surfaceShaderSet The set of shaders used to render the surface.
|
|
81
|
+
* @param {VectorProvider} options.vectorProvider
|
|
102
82
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
83
|
+
constructor(options) {
|
|
84
|
+
//>>includeStart('debug', pragmas.debug);
|
|
85
|
+
if (!defined(options)) {
|
|
86
|
+
throw new DeveloperError("options is required.");
|
|
87
|
+
}
|
|
88
|
+
if (!defined(options.terrainProvider)) {
|
|
89
|
+
throw new DeveloperError("options.terrainProvider is required.");
|
|
90
|
+
} else if (!defined(options.imageryLayers)) {
|
|
91
|
+
throw new DeveloperError("options.imageryLayers is required.");
|
|
92
|
+
} else if (!defined(options.surfaceShaderSet)) {
|
|
93
|
+
throw new DeveloperError("options.surfaceShaderSet is required.");
|
|
94
|
+
} else if (!defined(options.vectorProvider)) {
|
|
95
|
+
throw new DeveloperError("options.vectorProvider is required.");
|
|
96
|
+
}
|
|
97
|
+
//>>includeEnd('debug');
|
|
98
|
+
|
|
99
|
+
this.lightingFadeOutDistance = 6500000.0;
|
|
100
|
+
this.lightingFadeInDistance = 9000000.0;
|
|
101
|
+
this.hasWaterMask = false;
|
|
102
|
+
this.showWaterEffect = false;
|
|
103
|
+
this.oceanNormalMap = undefined;
|
|
104
|
+
this.zoomedOutOceanSpecularIntensity = 0.5;
|
|
105
|
+
this.enableLighting = false;
|
|
106
|
+
this.dynamicAtmosphereLighting = false;
|
|
107
|
+
this.dynamicAtmosphereLightingFromSun = false;
|
|
108
|
+
this.showGroundAtmosphere = false;
|
|
109
|
+
this.shadows = ShadowMode.RECEIVE_ONLY;
|
|
110
|
+
this.vertexShadowDarkness = 0.3;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The color to use to highlight terrain fill tiles. If undefined, fill tiles are not
|
|
114
|
+
* highlighted at all. The alpha value is used to alpha blend with the tile's
|
|
115
|
+
* actual color. Because terrain fill tiles do not represent the actual terrain surface,
|
|
116
|
+
* it may be useful in some applications to indicate visually that they are not to be trusted.
|
|
117
|
+
* @type {Color}
|
|
118
|
+
* @default undefined
|
|
119
|
+
*/
|
|
120
|
+
this.fillHighlightColor = undefined;
|
|
121
|
+
|
|
122
|
+
this.hueShift = 0.0;
|
|
123
|
+
this.saturationShift = 0.0;
|
|
124
|
+
this.brightnessShift = 0.0;
|
|
125
|
+
|
|
126
|
+
this.showSkirts = true;
|
|
127
|
+
this.backFaceCulling = true;
|
|
128
|
+
this.undergroundColor = undefined;
|
|
129
|
+
this.undergroundColorAlphaByDistance = undefined;
|
|
130
|
+
|
|
131
|
+
this.lambertDiffuseMultiplier = 0.0;
|
|
132
|
+
|
|
133
|
+
this.materialUniformMap = undefined;
|
|
134
|
+
this._materialUniformMap = undefined;
|
|
135
|
+
|
|
136
|
+
this._quadtree = undefined;
|
|
137
|
+
this._terrainProvider = options.terrainProvider;
|
|
138
|
+
this._vectorProvider = options.vectorProvider;
|
|
139
|
+
this._imageryLayers = options.imageryLayers;
|
|
140
|
+
this._surfaceShaderSet = options.surfaceShaderSet;
|
|
141
|
+
|
|
142
|
+
this._renderState = undefined;
|
|
143
|
+
this._blendRenderState = undefined;
|
|
144
|
+
this._disableCullingRenderState = undefined;
|
|
145
|
+
this._disableCullingBlendRenderState = undefined;
|
|
146
|
+
|
|
147
|
+
this._errorEvent = new Event();
|
|
148
|
+
|
|
149
|
+
this._removeLayerAddedListener =
|
|
150
|
+
this._imageryLayers.layerAdded.addEventListener(
|
|
151
|
+
GlobeSurfaceTileProvider.prototype._onLayerAdded,
|
|
152
|
+
this,
|
|
153
|
+
);
|
|
154
|
+
this._removeLayerRemovedListener =
|
|
155
|
+
this._imageryLayers.layerRemoved.addEventListener(
|
|
156
|
+
GlobeSurfaceTileProvider.prototype._onLayerRemoved,
|
|
157
|
+
this,
|
|
158
|
+
);
|
|
159
|
+
this._removeLayerMovedListener =
|
|
160
|
+
this._imageryLayers.layerMoved.addEventListener(
|
|
161
|
+
GlobeSurfaceTileProvider.prototype._onLayerMoved,
|
|
162
|
+
this,
|
|
163
|
+
);
|
|
164
|
+
this._removeLayerShownListener =
|
|
165
|
+
this._imageryLayers.layerShownOrHidden.addEventListener(
|
|
166
|
+
GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,
|
|
167
|
+
this,
|
|
168
|
+
);
|
|
169
|
+
this._imageryLayersUpdatedEvent = new Event();
|
|
123
170
|
|
|
124
|
-
|
|
125
|
-
this._blendRenderState = undefined;
|
|
126
|
-
this._disableCullingRenderState = undefined;
|
|
127
|
-
this._disableCullingBlendRenderState = undefined;
|
|
171
|
+
this._layerOrderChanged = false;
|
|
128
172
|
|
|
129
|
-
|
|
173
|
+
/** @type {QuadtreeTile[][]} */
|
|
174
|
+
this._tilesToRenderByTextureCount = [];
|
|
130
175
|
|
|
131
|
-
|
|
132
|
-
this.
|
|
133
|
-
GlobeSurfaceTileProvider.prototype._onLayerAdded,
|
|
134
|
-
this,
|
|
135
|
-
);
|
|
136
|
-
this._removeLayerRemovedListener =
|
|
137
|
-
this._imageryLayers.layerRemoved.addEventListener(
|
|
138
|
-
GlobeSurfaceTileProvider.prototype._onLayerRemoved,
|
|
139
|
-
this,
|
|
140
|
-
);
|
|
141
|
-
this._removeLayerMovedListener =
|
|
142
|
-
this._imageryLayers.layerMoved.addEventListener(
|
|
143
|
-
GlobeSurfaceTileProvider.prototype._onLayerMoved,
|
|
144
|
-
this,
|
|
145
|
-
);
|
|
146
|
-
this._removeLayerShownListener =
|
|
147
|
-
this._imageryLayers.layerShownOrHidden.addEventListener(
|
|
148
|
-
GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,
|
|
149
|
-
this,
|
|
150
|
-
);
|
|
151
|
-
this._imageryLayersUpdatedEvent = new Event();
|
|
176
|
+
/** @type {DrawCommand[]} */
|
|
177
|
+
this._drawCommands = [];
|
|
152
178
|
|
|
153
|
-
|
|
179
|
+
/** @type {object[]} */
|
|
180
|
+
this._uniformMaps = [];
|
|
154
181
|
|
|
155
|
-
|
|
156
|
-
this._drawCommands = [];
|
|
157
|
-
this._uniformMaps = [];
|
|
158
|
-
this._usedDrawCommands = 0;
|
|
182
|
+
this._usedDrawCommands = 0;
|
|
159
183
|
|
|
160
|
-
|
|
184
|
+
/** @type {VertexArray[]} */
|
|
185
|
+
this._vertexArraysToDestroy = [];
|
|
161
186
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
187
|
+
this._debug = {
|
|
188
|
+
wireframe: false,
|
|
189
|
+
boundingSphereTile: undefined,
|
|
190
|
+
tilesRendered: 0,
|
|
191
|
+
texturesRendered: 0,
|
|
192
|
+
};
|
|
166
193
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
194
|
+
this._baseColor = undefined;
|
|
195
|
+
this._firstPassInitialColor = undefined;
|
|
196
|
+
this.baseColor = new Color(0.0, 0.0, 0.5, 1.0);
|
|
170
197
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
198
|
+
/**
|
|
199
|
+
* A property specifying a {@link ClippingPlaneCollection} used to selectively disable rendering on the outside of each plane.
|
|
200
|
+
* @type {ClippingPlaneCollection}
|
|
201
|
+
* @ignore
|
|
202
|
+
*/
|
|
203
|
+
this._clippingPlanes = undefined;
|
|
177
204
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
205
|
+
/**
|
|
206
|
+
* A property specifying a {@link ClippingPolygonCollection} used to selectively disable rendering inside or outside a list of polygons.
|
|
207
|
+
* @type {ClippingPolygonCollection}
|
|
208
|
+
* @ignore
|
|
209
|
+
*/
|
|
210
|
+
this._clippingPolygons = undefined;
|
|
184
211
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
212
|
+
/**
|
|
213
|
+
* A property specifying a {@link Rectangle} used to selectively limit terrain and imagery rendering.
|
|
214
|
+
* @type {Rectangle}
|
|
215
|
+
*/
|
|
216
|
+
this.cartographicLimitRectangle = Rectangle.clone(Rectangle.MAX_VALUE);
|
|
190
217
|
|
|
191
|
-
|
|
192
|
-
|
|
218
|
+
this._hasLoadedTilesThisFrame = false;
|
|
219
|
+
this._hasFillTilesThisFrame = false;
|
|
193
220
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
221
|
+
this._oldVerticalExaggeration = undefined;
|
|
222
|
+
this._oldVerticalExaggerationRelativeHeight = undefined;
|
|
223
|
+
this._oldSceneMode = SceneMode.SCENE3D;
|
|
224
|
+
}
|
|
198
225
|
|
|
199
|
-
Object.defineProperties(GlobeSurfaceTileProvider.prototype, {
|
|
200
226
|
/**
|
|
201
227
|
* Gets or sets the color of the globe when no imagery is available.
|
|
202
|
-
* @memberof GlobeSurfaceTileProvider.prototype
|
|
203
228
|
* @type {Color}
|
|
204
229
|
*/
|
|
205
|
-
baseColor
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
230
|
+
get baseColor() {
|
|
231
|
+
return this._baseColor;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
set baseColor(value) {
|
|
235
|
+
//>>includeStart('debug', pragmas.debug);
|
|
236
|
+
if (!defined(value)) {
|
|
237
|
+
throw new DeveloperError("value is required.");
|
|
238
|
+
}
|
|
239
|
+
//>>includeEnd('debug');
|
|
240
|
+
|
|
241
|
+
this._baseColor = value;
|
|
242
|
+
this._firstPassInitialColor = Cartesian4.fromColor(
|
|
243
|
+
value,
|
|
244
|
+
this._firstPassInitialColor,
|
|
245
|
+
);
|
|
246
|
+
}
|
|
215
247
|
|
|
216
|
-
this._baseColor = value;
|
|
217
|
-
this._firstPassInitialColor = Cartesian4.fromColor(
|
|
218
|
-
value,
|
|
219
|
-
this._firstPassInitialColor,
|
|
220
|
-
);
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
248
|
/**
|
|
224
249
|
* Gets or sets the {@link QuadtreePrimitive} for which this provider is
|
|
225
250
|
* providing tiles. This property may be undefined if the provider is not yet associated
|
|
226
251
|
* with a {@link QuadtreePrimitive}.
|
|
227
|
-
* @memberof GlobeSurfaceTileProvider.prototype
|
|
228
252
|
* @type {QuadtreePrimitive}
|
|
229
253
|
*/
|
|
230
|
-
quadtree
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
set: function (value) {
|
|
235
|
-
//>>includeStart('debug', pragmas.debug);
|
|
236
|
-
if (!defined(value)) {
|
|
237
|
-
throw new DeveloperError("value is required.");
|
|
238
|
-
}
|
|
239
|
-
//>>includeEnd('debug');
|
|
254
|
+
get quadtree() {
|
|
255
|
+
return this._quadtree;
|
|
256
|
+
}
|
|
240
257
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
258
|
+
set quadtree(value) {
|
|
259
|
+
//>>includeStart('debug', pragmas.debug);
|
|
260
|
+
if (!defined(value)) {
|
|
261
|
+
throw new DeveloperError("value is required.");
|
|
262
|
+
}
|
|
263
|
+
//>>includeEnd('debug');
|
|
264
|
+
|
|
265
|
+
this._quadtree = value;
|
|
266
|
+
}
|
|
244
267
|
|
|
245
268
|
/**
|
|
246
269
|
* Gets the tiling scheme used by the provider.
|
|
247
|
-
* @memberof GlobeSurfaceTileProvider.prototype
|
|
248
270
|
* @type {TilingScheme}
|
|
249
271
|
*/
|
|
250
|
-
tilingScheme
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
272
|
+
get tilingScheme() {
|
|
273
|
+
if (!defined(this._terrainProvider)) {
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
255
276
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
277
|
+
// @ts-expect-error Missing types.
|
|
278
|
+
return this._terrainProvider.tilingScheme;
|
|
279
|
+
}
|
|
259
280
|
|
|
260
281
|
/**
|
|
261
282
|
* Gets an event that is raised when the geometry provider encounters an asynchronous error. By subscribing
|
|
262
283
|
* to the event, you will be notified of the error and can potentially recover from it. Event listeners
|
|
263
284
|
* are passed an instance of {@link TileProviderError}.
|
|
264
|
-
* @
|
|
265
|
-
* @type {Event}
|
|
285
|
+
* @type {Event<*>}
|
|
266
286
|
*/
|
|
267
|
-
errorEvent
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
},
|
|
271
|
-
},
|
|
287
|
+
get errorEvent() {
|
|
288
|
+
return this._errorEvent;
|
|
289
|
+
}
|
|
272
290
|
|
|
273
291
|
/**
|
|
274
292
|
* Gets an event that is raised when an imagery layer is added, shown, hidden, moved, or removed.
|
|
275
|
-
* @
|
|
276
|
-
* @type {Event}
|
|
293
|
+
* @type {Event<*>}
|
|
277
294
|
*/
|
|
278
|
-
imageryLayersUpdatedEvent
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
},
|
|
282
|
-
},
|
|
295
|
+
get imageryLayersUpdatedEvent() {
|
|
296
|
+
return this._imageryLayersUpdatedEvent;
|
|
297
|
+
}
|
|
283
298
|
|
|
284
299
|
/**
|
|
285
300
|
* Gets or sets the terrain provider that describes the surface geometry.
|
|
286
|
-
* @memberof GlobeSurfaceTileProvider.prototype
|
|
287
301
|
* @type {TerrainProvider}
|
|
288
302
|
*/
|
|
289
|
-
terrainProvider
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
},
|
|
293
|
-
set: function (terrainProvider) {
|
|
294
|
-
if (this._terrainProvider === terrainProvider) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
303
|
+
get terrainProvider() {
|
|
304
|
+
return this._terrainProvider;
|
|
305
|
+
}
|
|
297
306
|
|
|
298
|
-
|
|
307
|
+
set terrainProvider(terrainProvider) {
|
|
308
|
+
if (this._terrainProvider === terrainProvider) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
this._terrainProvider = terrainProvider;
|
|
313
|
+
|
|
314
|
+
if (defined(this._quadtree)) {
|
|
315
|
+
this._quadtree.invalidateAllTiles();
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** @type {VectorProvider} */
|
|
320
|
+
get vectorProvider() {
|
|
321
|
+
return this._vectorProvider;
|
|
322
|
+
}
|
|
299
323
|
|
|
300
|
-
if (defined(this._quadtree)) {
|
|
301
|
-
this._quadtree.invalidateAllTiles();
|
|
302
|
-
}
|
|
303
|
-
},
|
|
304
|
-
},
|
|
305
324
|
/**
|
|
306
325
|
* The {@link ClippingPlaneCollection} used to selectively disable rendering.
|
|
307
326
|
*
|
|
308
327
|
* @type {ClippingPlaneCollection}
|
|
309
328
|
*
|
|
310
|
-
* @
|
|
329
|
+
* @ignore
|
|
311
330
|
*/
|
|
312
|
-
clippingPlanes
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
},
|
|
331
|
+
get clippingPlanes() {
|
|
332
|
+
return this._clippingPlanes;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
set clippingPlanes(value) {
|
|
336
|
+
ClippingPlaneCollection.setOwner(value, this, "_clippingPlanes");
|
|
337
|
+
}
|
|
320
338
|
|
|
321
339
|
/**
|
|
322
340
|
* The {@link ClippingPolygonCollection} used to selectively disable rendering inside or outside a list of polygons.
|
|
323
341
|
*
|
|
324
342
|
* @type {ClippingPolygonCollection}
|
|
325
343
|
*
|
|
326
|
-
* @
|
|
344
|
+
* @ignore
|
|
327
345
|
*/
|
|
328
|
-
clippingPolygons
|
|
329
|
-
|
|
330
|
-
return this._clippingPolygons;
|
|
331
|
-
},
|
|
332
|
-
set: function (value) {
|
|
333
|
-
ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
|
|
334
|
-
},
|
|
335
|
-
},
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
function sortTileImageryByLayerIndex(a, b) {
|
|
339
|
-
let aImagery = a.loadingImagery;
|
|
340
|
-
if (!defined(aImagery)) {
|
|
341
|
-
aImagery = a.readyImagery;
|
|
346
|
+
get clippingPolygons() {
|
|
347
|
+
return this._clippingPolygons;
|
|
342
348
|
}
|
|
343
349
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
bImagery = b.readyImagery;
|
|
350
|
+
set clippingPolygons(value) {
|
|
351
|
+
ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
|
|
347
352
|
}
|
|
348
353
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
// update collection: imagery indices, base layers, raise layer show/hide event
|
|
357
|
-
this._imageryLayers._update();
|
|
358
|
-
};
|
|
359
|
-
|
|
360
|
-
function updateCredits(surface, frameState) {
|
|
361
|
-
const creditDisplay = frameState.creditDisplay;
|
|
362
|
-
const terrainProvider = surface._terrainProvider;
|
|
363
|
-
if (defined(terrainProvider) && defined(terrainProvider.credit)) {
|
|
364
|
-
creditDisplay.addCreditToNextFrame(terrainProvider.credit);
|
|
354
|
+
/**
|
|
355
|
+
* Make updates to the tile provider that are not involved in rendering. Called before the render update cycle.
|
|
356
|
+
* @param {FrameState} frameState
|
|
357
|
+
*/
|
|
358
|
+
update(frameState) {
|
|
359
|
+
// update collection: imagery indices, base layers, raise layer show/hide event
|
|
360
|
+
this._imageryLayers._update();
|
|
365
361
|
}
|
|
366
362
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Called at the beginning of each render frame, before {@link QuadtreeTileProvider#showTileThisFrame}
|
|
365
|
+
* @param {FrameState} frameState The frame state.
|
|
366
|
+
*/
|
|
367
|
+
initialize(frameState) {
|
|
368
|
+
// update each layer for texture reprojection.
|
|
369
|
+
this._imageryLayers.queueReprojectionCommands(frameState);
|
|
370
|
+
|
|
371
|
+
if (this._layerOrderChanged) {
|
|
372
|
+
this._layerOrderChanged = false;
|
|
373
|
+
|
|
374
|
+
// Sort the TileImagery instances in each tile by the layer index.
|
|
375
|
+
this._quadtree.forEachLoadedTile(
|
|
376
|
+
/** @param {QuadtreeTile} tile */
|
|
377
|
+
function (tile) {
|
|
378
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
379
|
+
surfaceTile.imagery.sort(sortTileImageryByLayerIndex);
|
|
380
|
+
},
|
|
381
|
+
);
|
|
372
382
|
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/**
|
|
377
|
-
* Called at the beginning of each render frame, before {@link QuadtreeTileProvider#showTileThisFrame}
|
|
378
|
-
* @param {FrameState} frameState The frame state.
|
|
379
|
-
*/
|
|
380
|
-
GlobeSurfaceTileProvider.prototype.initialize = function (frameState) {
|
|
381
|
-
// update each layer for texture reprojection.
|
|
382
|
-
this._imageryLayers.queueReprojectionCommands(frameState);
|
|
383
|
-
|
|
384
|
-
if (this._layerOrderChanged) {
|
|
385
|
-
this._layerOrderChanged = false;
|
|
386
|
-
|
|
387
|
-
// Sort the TileImagery instances in each tile by the layer index.
|
|
388
|
-
this._quadtree.forEachLoadedTile(function (tile) {
|
|
389
|
-
tile.data.imagery.sort(sortTileImageryByLayerIndex);
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
383
|
|
|
393
|
-
|
|
394
|
-
|
|
384
|
+
// Record regions dirtied by changed collections, re-bake overlapping
|
|
385
|
+
// tiles, and build vector data for new surface tiles.
|
|
386
|
+
const vectorProvider = this._vectorProvider;
|
|
387
|
+
vectorProvider.update();
|
|
388
|
+
this._quadtree.forEachRenderedTile(
|
|
389
|
+
/** @param {QuadtreeTile} tile */
|
|
390
|
+
(tile) => {
|
|
391
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
392
|
+
|
|
393
|
+
if (defined(surfaceTile.vectorData)) {
|
|
394
|
+
surfaceTile.vectorData = vectorProvider.updateTileData(
|
|
395
|
+
tile.x,
|
|
396
|
+
tile.y,
|
|
397
|
+
tile.level,
|
|
398
|
+
frameState.context,
|
|
399
|
+
surfaceTile.vectorData,
|
|
400
|
+
);
|
|
401
|
+
} else {
|
|
402
|
+
surfaceTile.vectorData = vectorProvider.requestTileData(
|
|
403
|
+
tile.x,
|
|
404
|
+
tile.y,
|
|
405
|
+
tile.level,
|
|
406
|
+
frameState.context,
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
);
|
|
411
|
+
vectorProvider.makeClean();
|
|
395
412
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
for (let j = 0; j < length; ++j) {
|
|
399
|
-
GlobeSurfaceTile._freeVertexArray(vertexArraysToDestroy[j]);
|
|
400
|
-
}
|
|
401
|
-
vertexArraysToDestroy.length = 0;
|
|
402
|
-
};
|
|
413
|
+
// Add credits for terrain and imagery providers.
|
|
414
|
+
updateCredits(this, frameState);
|
|
403
415
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
* @param {FrameState} frameState The frame state.
|
|
409
|
-
*/
|
|
410
|
-
GlobeSurfaceTileProvider.prototype.beginUpdate = function (frameState) {
|
|
411
|
-
const tilesToRenderByTextureCount = this._tilesToRenderByTextureCount;
|
|
412
|
-
for (let i = 0, len = tilesToRenderByTextureCount.length; i < len; ++i) {
|
|
413
|
-
const tiles = tilesToRenderByTextureCount[i];
|
|
414
|
-
if (defined(tiles)) {
|
|
415
|
-
tiles.length = 0;
|
|
416
|
+
const vertexArraysToDestroy = this._vertexArraysToDestroy;
|
|
417
|
+
const length = vertexArraysToDestroy.length;
|
|
418
|
+
for (let j = 0; j < length; ++j) {
|
|
419
|
+
GlobeSurfaceTile._freeVertexArray(vertexArraysToDestroy[j]);
|
|
416
420
|
}
|
|
417
|
-
|
|
418
|
-
// update clipping planes
|
|
419
|
-
const clippingPlanes = this._clippingPlanes;
|
|
420
|
-
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
421
|
-
clippingPlanes.update(frameState);
|
|
421
|
+
vertexArraysToDestroy.length = 0;
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Called at the beginning of the update cycle for each render frame, before {@link QuadtreeTileProvider#showTileThisFrame}
|
|
426
|
+
* or any other functions.
|
|
427
|
+
*
|
|
428
|
+
* @param {FrameState} frameState The frame state.
|
|
429
|
+
*/
|
|
430
|
+
beginUpdate(frameState) {
|
|
431
|
+
const tilesToRenderByTextureCount = this._tilesToRenderByTextureCount;
|
|
432
|
+
for (let i = 0, len = tilesToRenderByTextureCount.length; i < len; ++i) {
|
|
433
|
+
const tiles = tilesToRenderByTextureCount[i];
|
|
434
|
+
if (defined(tiles)) {
|
|
435
|
+
tiles.length = 0;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
// update clipping planes
|
|
439
|
+
const clippingPlanes = this._clippingPlanes;
|
|
440
|
+
// @ts-expect-error Missing types.
|
|
441
|
+
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
442
|
+
clippingPlanes.update(frameState);
|
|
443
|
+
}
|
|
430
444
|
|
|
431
|
-
|
|
445
|
+
// update clipping polygons
|
|
446
|
+
const clippingPolygons = this._clippingPolygons;
|
|
447
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
448
|
+
// @ts-expect-error Missing types.
|
|
449
|
+
clippingPolygons.update(frameState);
|
|
450
|
+
// @ts-expect-error Missing types.
|
|
451
|
+
clippingPolygons.queueCommands(frameState);
|
|
452
|
+
}
|
|
432
453
|
|
|
433
|
-
|
|
434
|
-
this._hasFillTilesThisFrame = false;
|
|
435
|
-
};
|
|
454
|
+
this._usedDrawCommands = 0;
|
|
436
455
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
*
|
|
441
|
-
* @param {FrameState} frameState The frame state.
|
|
442
|
-
*/
|
|
443
|
-
GlobeSurfaceTileProvider.prototype.endUpdate = function (frameState) {
|
|
444
|
-
if (!defined(this._renderState)) {
|
|
445
|
-
this._renderState = RenderState.fromCache({
|
|
446
|
-
// Write color and depth
|
|
447
|
-
cull: {
|
|
448
|
-
enabled: true,
|
|
449
|
-
},
|
|
450
|
-
depthTest: {
|
|
451
|
-
enabled: true,
|
|
452
|
-
func: DepthFunction.LESS,
|
|
453
|
-
},
|
|
454
|
-
});
|
|
456
|
+
this._hasLoadedTilesThisFrame = false;
|
|
457
|
+
this._hasFillTilesThisFrame = false;
|
|
458
|
+
}
|
|
455
459
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Called at the end of the update cycle for each render frame, after {@link QuadtreeTileProvider#showTileThisFrame}
|
|
462
|
+
* and any other functions.
|
|
463
|
+
*
|
|
464
|
+
* @param {FrameState} frameState The frame state.
|
|
465
|
+
*/
|
|
466
|
+
endUpdate(frameState) {
|
|
467
|
+
if (!defined(this._renderState)) {
|
|
468
|
+
this._renderState = RenderState.fromCache({
|
|
469
|
+
// Write color and depth
|
|
470
|
+
cull: {
|
|
471
|
+
enabled: true,
|
|
472
|
+
},
|
|
473
|
+
depthTest: {
|
|
474
|
+
enabled: true,
|
|
475
|
+
func: DepthFunction.LESS,
|
|
476
|
+
},
|
|
477
|
+
});
|
|
467
478
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
479
|
+
this._blendRenderState = RenderState.fromCache({
|
|
480
|
+
// Write color and depth
|
|
481
|
+
cull: {
|
|
482
|
+
enabled: true,
|
|
483
|
+
},
|
|
484
|
+
depthTest: {
|
|
485
|
+
enabled: true,
|
|
486
|
+
func: DepthFunction.LESS_OR_EQUAL,
|
|
487
|
+
},
|
|
488
|
+
blending: BlendingState.ALPHA_BLEND,
|
|
489
|
+
});
|
|
471
490
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
491
|
+
let rs = /** @type {RenderState} */ (clone(this._renderState, true));
|
|
492
|
+
rs.cull.enabled = false;
|
|
493
|
+
this._disableCullingRenderState = RenderState.fromCache(rs);
|
|
476
494
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
this,
|
|
482
|
-
this._quadtree._tilesToRender,
|
|
483
|
-
frameState,
|
|
484
|
-
this._vertexArraysToDestroy,
|
|
485
|
-
);
|
|
486
|
-
}
|
|
495
|
+
rs = /** @type {RenderState} */ (clone(this._blendRenderState, true));
|
|
496
|
+
rs.cull.enabled = false;
|
|
497
|
+
this._disableCullingBlendRenderState = RenderState.fromCache(rs);
|
|
498
|
+
}
|
|
487
499
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
500
|
+
// If this frame has a mix of loaded and fill tiles, we need to propagate
|
|
501
|
+
// loaded heights to the fill tiles.
|
|
502
|
+
if (this._hasFillTilesThisFrame && this._hasLoadedTilesThisFrame) {
|
|
503
|
+
TerrainFillMesh.updateFillTiles(
|
|
504
|
+
this,
|
|
505
|
+
this._quadtree._tilesToRender,
|
|
506
|
+
frameState,
|
|
507
|
+
this._vertexArraysToDestroy,
|
|
508
|
+
);
|
|
509
|
+
}
|
|
493
510
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
511
|
+
// When vertical exaggeration changes, all of the loaded tiles need to generate
|
|
512
|
+
// geodetic surface normals so they can scale properly when rendered.
|
|
513
|
+
// When exaggeration is reset, geodetic surface normals are removed to decrease
|
|
514
|
+
// memory usage. Some tiles might have been constructed with the correct
|
|
515
|
+
// exaggeration already, so skip over them.
|
|
498
516
|
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
const exaggerationChanged =
|
|
504
|
-
this._oldVerticalExaggeration !== exaggeration ||
|
|
505
|
-
this._oldVerticalExaggerationRelativeHeight !== exaggerationRelativeHeight;
|
|
506
|
-
|
|
507
|
-
// Keep track of the next time there is a change in exaggeration
|
|
508
|
-
this._oldVerticalExaggeration = exaggeration;
|
|
509
|
-
this._oldVerticalExaggerationRelativeHeight = exaggerationRelativeHeight;
|
|
510
|
-
|
|
511
|
-
if (exaggerationChanged) {
|
|
512
|
-
quadtree.forEachLoadedTile(function (tile) {
|
|
513
|
-
const surfaceTile = tile.data;
|
|
514
|
-
surfaceTile.updateExaggeration(tile, frameState, quadtree);
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
+
// If the geodetic surface normals can't be created because the tile doesn't
|
|
518
|
+
// have a mesh, keep checking until the tile does have a mesh. This can happen
|
|
519
|
+
// if the tile's mesh starts construction in a worker thread right before the
|
|
520
|
+
// exaggeration changes.
|
|
517
521
|
|
|
518
|
-
|
|
519
|
-
|
|
522
|
+
const quadtree = this.quadtree;
|
|
523
|
+
const exaggeration = frameState.verticalExaggeration;
|
|
524
|
+
const exaggerationRelativeHeight =
|
|
525
|
+
frameState.verticalExaggerationRelativeHeight;
|
|
526
|
+
const exaggerationChanged =
|
|
527
|
+
this._oldVerticalExaggeration !== exaggeration ||
|
|
528
|
+
this._oldVerticalExaggerationRelativeHeight !==
|
|
529
|
+
exaggerationRelativeHeight;
|
|
530
|
+
|
|
531
|
+
// Keep track of the next time there is a change in exaggeration
|
|
532
|
+
this._oldVerticalExaggeration = exaggeration;
|
|
533
|
+
this._oldVerticalExaggerationRelativeHeight = exaggerationRelativeHeight;
|
|
534
|
+
|
|
535
|
+
if (exaggerationChanged) {
|
|
536
|
+
quadtree.forEachLoadedTile(
|
|
537
|
+
/** @param {QuadtreeTile} tile */
|
|
538
|
+
function (tile) {
|
|
539
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
540
|
+
surfaceTile.updateExaggeration(tile, frameState, quadtree);
|
|
541
|
+
},
|
|
542
|
+
);
|
|
543
|
+
}
|
|
520
544
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const surfaceTile = tile.data;
|
|
524
|
-
surfaceTile.updateSceneMode(frameState.mode);
|
|
525
|
-
});
|
|
526
|
-
}
|
|
545
|
+
const sceneModeChanged = this._oldSceneMode !== frameState.mode;
|
|
546
|
+
this._oldSceneMode = frameState.mode;
|
|
527
547
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
const tilesToRender = tilesToRenderByTextureCount[textureCountIndex];
|
|
537
|
-
if (!defined(tilesToRender)) {
|
|
538
|
-
continue;
|
|
548
|
+
if (sceneModeChanged) {
|
|
549
|
+
quadtree.forEachLoadedTile(
|
|
550
|
+
/** @param {QuadtreeTile} tile */
|
|
551
|
+
function (tile) {
|
|
552
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
553
|
+
surfaceTile.updateSceneMode(frameState.mode);
|
|
554
|
+
},
|
|
555
|
+
);
|
|
539
556
|
}
|
|
540
557
|
|
|
558
|
+
// Add the tile render commands to the command list, sorted by texture count.
|
|
559
|
+
const tilesToRenderByTextureCount = this._tilesToRenderByTextureCount;
|
|
541
560
|
for (
|
|
542
|
-
let
|
|
543
|
-
|
|
544
|
-
|
|
561
|
+
let textureCountIndex = 0,
|
|
562
|
+
textureCountLength = tilesToRenderByTextureCount.length;
|
|
563
|
+
textureCountIndex < textureCountLength;
|
|
564
|
+
++textureCountIndex
|
|
545
565
|
) {
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
566
|
+
const tilesToRender = tilesToRenderByTextureCount[textureCountIndex];
|
|
567
|
+
if (!defined(tilesToRender)) {
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
for (
|
|
572
|
+
let tileIndex = 0, tileLength = tilesToRender.length;
|
|
573
|
+
tileIndex < tileLength;
|
|
574
|
+
++tileIndex
|
|
575
|
+
) {
|
|
576
|
+
const tile = tilesToRender[tileIndex];
|
|
577
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
578
|
+
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
579
|
+
addDrawCommandsForTile(this, tile, frameState);
|
|
580
|
+
frameState.minimumTerrainHeight = Math.min(
|
|
581
|
+
frameState.minimumTerrainHeight,
|
|
582
|
+
tileBoundingRegion.minimumHeight,
|
|
583
|
+
);
|
|
584
|
+
}
|
|
553
585
|
}
|
|
554
586
|
}
|
|
555
|
-
};
|
|
556
587
|
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
)
|
|
566
|
-
|
|
567
|
-
|
|
588
|
+
/**
|
|
589
|
+
* Adds draw commands for tiles rendered in the previous frame for a pick pass.
|
|
590
|
+
*
|
|
591
|
+
* @param {FrameState} frameState The frame state.
|
|
592
|
+
*/
|
|
593
|
+
updateForPick(frameState) {
|
|
594
|
+
// Add the tile pick commands from the tiles drawn last frame.
|
|
595
|
+
const drawCommands = this._drawCommands;
|
|
596
|
+
for (let i = 0, length = this._usedDrawCommands; i < length; ++i) {
|
|
597
|
+
pushCommand(drawCommands[i], frameState);
|
|
598
|
+
}
|
|
568
599
|
}
|
|
569
|
-
}
|
|
570
600
|
|
|
571
|
-
/**
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
GlobeSurfaceTileProvider.prototype.updateForPick = function (frameState) {
|
|
577
|
-
// Add the tile pick commands from the tiles drawn last frame.
|
|
578
|
-
const drawCommands = this._drawCommands;
|
|
579
|
-
for (let i = 0, length = this._usedDrawCommands; i < length; ++i) {
|
|
580
|
-
pushCommand(drawCommands[i], frameState);
|
|
601
|
+
/**
|
|
602
|
+
* Cancels any imagery re-projections in the queue.
|
|
603
|
+
*/
|
|
604
|
+
cancelReprojections() {
|
|
605
|
+
this._imageryLayers.cancelReprojections();
|
|
581
606
|
}
|
|
582
|
-
};
|
|
583
607
|
|
|
584
|
-
/**
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
608
|
+
/**
|
|
609
|
+
* Gets the maximum geometric error allowed in a tile at a given level, in meters.
|
|
610
|
+
*
|
|
611
|
+
* @param {number} level The tile level for which to get the maximum geometric error.
|
|
612
|
+
* @returns {number} The maximum geometric error in meters.
|
|
613
|
+
*/
|
|
614
|
+
getLevelMaximumGeometricError(level) {
|
|
615
|
+
if (!defined(this._terrainProvider)) {
|
|
616
|
+
return 0;
|
|
617
|
+
}
|
|
590
618
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
*
|
|
594
|
-
* @param {number} level The tile level for which to get the maximum geometric error.
|
|
595
|
-
* @returns {number} The maximum geometric error in meters.
|
|
596
|
-
*/
|
|
597
|
-
GlobeSurfaceTileProvider.prototype.getLevelMaximumGeometricError = function (
|
|
598
|
-
level,
|
|
599
|
-
) {
|
|
600
|
-
if (!defined(this._terrainProvider)) {
|
|
601
|
-
return 0;
|
|
619
|
+
// @ts-expect-error Missing types.
|
|
620
|
+
return this._terrainProvider.getLevelMaximumGeometricError(level);
|
|
602
621
|
}
|
|
603
622
|
|
|
604
|
-
|
|
605
|
-
|
|
623
|
+
/**
|
|
624
|
+
* Loads, or continues loading, a given tile. This function will continue to be called
|
|
625
|
+
* until {@link QuadtreeTile#state} is no longer {@link QuadtreeTileLoadState#LOADING}.
|
|
626
|
+
*
|
|
627
|
+
* @param {FrameState} frameState The frame state.
|
|
628
|
+
* @param {QuadtreeTile} tile The tile to load.
|
|
629
|
+
*/
|
|
630
|
+
loadTile(frameState, tile) {
|
|
631
|
+
// We don't want to load imagery until we're certain that the terrain tiles are actually visible.
|
|
632
|
+
// So if our bounding volume isn't accurate because it came from another tile, load terrain only
|
|
633
|
+
// initially. If we load some terrain and suddenly have a more accurate bounding volume and the
|
|
634
|
+
// tile is _still_ visible, give the tile a chance to load imagery immediately rather than
|
|
635
|
+
// waiting for next frame.
|
|
636
|
+
|
|
637
|
+
let surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
638
|
+
let terrainOnly = true;
|
|
639
|
+
let terrainStateBefore;
|
|
640
|
+
if (defined(surfaceTile)) {
|
|
641
|
+
terrainOnly =
|
|
642
|
+
surfaceTile.boundingVolumeSourceTile !== tile ||
|
|
643
|
+
tile._lastSelectionResult === TileSelectionResult.CULLED_BUT_NEEDED;
|
|
644
|
+
terrainStateBefore = surfaceTile.terrainState;
|
|
645
|
+
}
|
|
606
646
|
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
// initially. If we load some terrain and suddenly have a more accurate bounding volume and the
|
|
618
|
-
// tile is _still_ visible, give the tile a chance to load imagery immediately rather than
|
|
619
|
-
// waiting for next frame.
|
|
620
|
-
|
|
621
|
-
let surfaceTile = tile.data;
|
|
622
|
-
let terrainOnly = true;
|
|
623
|
-
let terrainStateBefore;
|
|
624
|
-
if (defined(surfaceTile)) {
|
|
625
|
-
terrainOnly =
|
|
626
|
-
surfaceTile.boundingVolumeSourceTile !== tile ||
|
|
627
|
-
tile._lastSelectionResult === TileSelectionResult.CULLED_BUT_NEEDED;
|
|
628
|
-
terrainStateBefore = surfaceTile.terrainState;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
GlobeSurfaceTile.processStateMachine(
|
|
632
|
-
tile,
|
|
633
|
-
frameState,
|
|
634
|
-
this.terrainProvider,
|
|
635
|
-
this._imageryLayers,
|
|
636
|
-
this.quadtree,
|
|
637
|
-
this._vertexArraysToDestroy,
|
|
638
|
-
terrainOnly,
|
|
639
|
-
);
|
|
647
|
+
GlobeSurfaceTile.processStateMachine(
|
|
648
|
+
tile,
|
|
649
|
+
frameState,
|
|
650
|
+
this.terrainProvider,
|
|
651
|
+
this.vectorProvider,
|
|
652
|
+
this._imageryLayers,
|
|
653
|
+
this.quadtree,
|
|
654
|
+
this._vertexArraysToDestroy,
|
|
655
|
+
terrainOnly,
|
|
656
|
+
);
|
|
640
657
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
tile
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
658
|
+
surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
659
|
+
if (terrainOnly && terrainStateBefore !== surfaceTile.terrainState) {
|
|
660
|
+
// Terrain state changed. If:
|
|
661
|
+
// a) The tile is visible, and
|
|
662
|
+
// b) The bounding volume is accurate (updated as a side effect of computing visibility)
|
|
663
|
+
// Then we'll load imagery, too.
|
|
664
|
+
if (
|
|
665
|
+
this.computeTileVisibility(
|
|
666
|
+
tile,
|
|
667
|
+
frameState,
|
|
668
|
+
// @ts-expect-error Missing types.
|
|
669
|
+
this.quadtree.occluders,
|
|
670
|
+
) !== Visibility.NONE &&
|
|
671
|
+
surfaceTile.boundingVolumeSourceTile === tile
|
|
672
|
+
) {
|
|
673
|
+
terrainOnly = false;
|
|
674
|
+
GlobeSurfaceTile.processStateMachine(
|
|
675
|
+
tile,
|
|
676
|
+
frameState,
|
|
677
|
+
this.terrainProvider,
|
|
678
|
+
this.vectorProvider,
|
|
679
|
+
this._imageryLayers,
|
|
680
|
+
this.quadtree,
|
|
681
|
+
this._vertexArraysToDestroy,
|
|
682
|
+
terrainOnly,
|
|
683
|
+
);
|
|
684
|
+
}
|
|
662
685
|
}
|
|
663
686
|
}
|
|
664
|
-
};
|
|
665
687
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
688
|
+
/**
|
|
689
|
+
* Determines the visibility of a given tile. The tile may be fully visible, partially visible, or not
|
|
690
|
+
* visible at all. Tiles that are renderable and are at least partially visible will be shown by a call
|
|
691
|
+
* to {@link GlobeSurfaceTileProvider#showTileThisFrame}.
|
|
692
|
+
*
|
|
693
|
+
* @param {QuadtreeTile} tile The tile instance.
|
|
694
|
+
* @param {FrameState} frameState The state information about the current frame.
|
|
695
|
+
* @param {QuadtreeOccluders} occluders The objects that may occlude this tile.
|
|
696
|
+
*
|
|
697
|
+
* @returns {Visibility} Visibility.NONE if the tile is not visible,
|
|
698
|
+
* Visibility.PARTIAL if the tile is partially visible, or
|
|
699
|
+
* Visibility.FULL if the tile is fully visible.
|
|
700
|
+
*/
|
|
701
|
+
computeTileVisibility(tile, frameState, occluders) {
|
|
702
|
+
const distance = this.computeDistanceToTile(tile, frameState);
|
|
703
|
+
tile._distance = distance;
|
|
670
704
|
|
|
671
|
-
|
|
672
|
-
function clipRectangleAntimeridian(tileRectangle, cartographicLimitRectangle) {
|
|
673
|
-
if (cartographicLimitRectangle.west < cartographicLimitRectangle.east) {
|
|
674
|
-
return cartographicLimitRectangle;
|
|
675
|
-
}
|
|
676
|
-
const splitRectangle = Rectangle.clone(
|
|
677
|
-
cartographicLimitRectangle,
|
|
678
|
-
splitCartographicLimitRectangleScratch,
|
|
679
|
-
);
|
|
680
|
-
const tileCenter = Rectangle.center(tileRectangle, rectangleCenterScratch);
|
|
681
|
-
if (tileCenter.longitude > 0.0) {
|
|
682
|
-
splitRectangle.east = CesiumMath.PI;
|
|
683
|
-
} else {
|
|
684
|
-
splitRectangle.west = -CesiumMath.PI;
|
|
685
|
-
}
|
|
686
|
-
return splitRectangle;
|
|
687
|
-
}
|
|
705
|
+
const undergroundVisible = isUndergroundVisible(this, frameState);
|
|
688
706
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
707
|
+
if (frameState.fog.enabled && !undergroundVisible) {
|
|
708
|
+
if (CesiumMath.fog(distance, frameState.fog.density) >= 1.0) {
|
|
709
|
+
// Tile is completely in fog so return that it is not visible.
|
|
710
|
+
return Visibility.NONE;
|
|
711
|
+
}
|
|
712
|
+
}
|
|
693
713
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
714
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
715
|
+
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
697
716
|
|
|
698
|
-
|
|
699
|
-
|
|
717
|
+
if (surfaceTile.boundingVolumeSourceTile === undefined) {
|
|
718
|
+
// We have no idea where this tile is, so let's just call it partially visible.
|
|
719
|
+
return Visibility.PARTIAL;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
const cullingVolume = frameState.cullingVolume;
|
|
723
|
+
// @ts-expect-error Missing types.
|
|
724
|
+
let boundingVolume = tileBoundingRegion.boundingVolume;
|
|
725
|
+
|
|
726
|
+
if (!defined(boundingVolume)) {
|
|
727
|
+
// @ts-expect-error Missing types.
|
|
728
|
+
boundingVolume = tileBoundingRegion.boundingSphere;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// Check if the tile is outside the limit area in cartographic space
|
|
732
|
+
surfaceTile.clippedByBoundaries = false;
|
|
733
|
+
const clippedCartographicLimitRectangle = clipRectangleAntimeridian(
|
|
734
|
+
tile.rectangle,
|
|
735
|
+
this.cartographicLimitRectangle,
|
|
736
|
+
);
|
|
737
|
+
const areaLimitIntersection = Rectangle.simpleIntersection(
|
|
738
|
+
clippedCartographicLimitRectangle,
|
|
739
|
+
tile.rectangle,
|
|
740
|
+
rectangleIntersectionScratch,
|
|
741
|
+
);
|
|
742
|
+
if (!defined(areaLimitIntersection)) {
|
|
743
|
+
return Visibility.NONE;
|
|
744
|
+
}
|
|
745
|
+
if (!Rectangle.equals(areaLimitIntersection, tile.rectangle)) {
|
|
746
|
+
surfaceTile.clippedByBoundaries = true;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
if (frameState.mode !== SceneMode.SCENE3D) {
|
|
750
|
+
boundingVolume = boundingSphereScratch;
|
|
751
|
+
BoundingSphere.fromRectangleWithHeights2D(
|
|
752
|
+
tile.rectangle,
|
|
753
|
+
frameState.mapProjection,
|
|
754
|
+
tileBoundingRegion.minimumHeight,
|
|
755
|
+
tileBoundingRegion.maximumHeight,
|
|
756
|
+
boundingVolume,
|
|
757
|
+
);
|
|
758
|
+
Cartesian3.fromElements(
|
|
759
|
+
boundingVolume.center.z,
|
|
760
|
+
boundingVolume.center.x,
|
|
761
|
+
boundingVolume.center.y,
|
|
762
|
+
boundingVolume.center,
|
|
763
|
+
);
|
|
764
|
+
|
|
765
|
+
if (
|
|
766
|
+
frameState.mode === SceneMode.MORPHING &&
|
|
767
|
+
defined(surfaceTile.renderedMesh)
|
|
768
|
+
) {
|
|
769
|
+
boundingVolume = BoundingSphere.union(
|
|
770
|
+
// @ts-expect-error Missing types.
|
|
771
|
+
tileBoundingRegion.boundingSphere,
|
|
772
|
+
boundingVolume,
|
|
773
|
+
boundingVolume,
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
if (!defined(boundingVolume)) {
|
|
779
|
+
return Visibility.PARTIAL;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
const clippingPlanes = this._clippingPlanes;
|
|
783
|
+
// @ts-expect-error Missing types.
|
|
784
|
+
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
785
|
+
const planeIntersection =
|
|
786
|
+
clippingPlanes.computeIntersectionWithBoundingVolume(boundingVolume);
|
|
787
|
+
// @ts-expect-error Possibly an error? isClipped is defined on surfaceTile, not tile.
|
|
788
|
+
tile.isClipped = planeIntersection !== Intersect.INSIDE;
|
|
789
|
+
if (planeIntersection === Intersect.OUTSIDE) {
|
|
790
|
+
return Visibility.NONE;
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
const clippingPolygons = this._clippingPolygons;
|
|
795
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
796
|
+
const polygonIntersection =
|
|
797
|
+
clippingPolygons.computeIntersectionWithBoundingVolume(
|
|
798
|
+
tileBoundingRegion,
|
|
799
|
+
);
|
|
800
|
+
// @ts-expect-error Possibly an error? isClipped is defined on surfaceTile, not tile.
|
|
801
|
+
tile.isClipped = polygonIntersection !== Intersect.OUTSIDE;
|
|
802
|
+
// Polygon clipping intersections are determined by outer rectangles, therefore we cannot
|
|
803
|
+
// preemptively determine if a tile is completely clipped or not here.
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
let visibility;
|
|
807
|
+
const intersection = cullingVolume.computeVisibility(boundingVolume);
|
|
808
|
+
|
|
809
|
+
if (intersection === Intersect.OUTSIDE) {
|
|
810
|
+
visibility = Visibility.NONE;
|
|
811
|
+
} else if (intersection === Intersect.INTERSECTING) {
|
|
812
|
+
visibility = Visibility.PARTIAL;
|
|
813
|
+
} else if (intersection === Intersect.INSIDE) {
|
|
814
|
+
visibility = Visibility.FULL;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
if (visibility === Visibility.NONE) {
|
|
818
|
+
return visibility;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
const ortho3D =
|
|
822
|
+
frameState.mode === SceneMode.SCENE3D &&
|
|
823
|
+
frameState.camera.frustum instanceof OrthographicFrustum;
|
|
824
|
+
if (
|
|
825
|
+
frameState.mode === SceneMode.SCENE3D &&
|
|
826
|
+
!ortho3D &&
|
|
827
|
+
defined(occluders) &&
|
|
828
|
+
!undergroundVisible
|
|
829
|
+
) {
|
|
830
|
+
const occludeePointInScaledSpace = surfaceTile.occludeePointInScaledSpace;
|
|
831
|
+
if (!defined(occludeePointInScaledSpace)) {
|
|
832
|
+
return visibility;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
if (
|
|
836
|
+
occluders.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(
|
|
837
|
+
occludeePointInScaledSpace,
|
|
838
|
+
tileBoundingRegion.minimumHeight,
|
|
839
|
+
)
|
|
840
|
+
) {
|
|
841
|
+
return visibility;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
return Visibility.NONE;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
return visibility;
|
|
700
848
|
}
|
|
701
849
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
850
|
+
/**
|
|
851
|
+
* Determines if the given tile can be refined
|
|
852
|
+
* @param {QuadtreeTile} tile The tile to check.
|
|
853
|
+
* @returns {boolean} True if the tile can be refined, false if it cannot.
|
|
854
|
+
*/
|
|
855
|
+
canRefine(tile) {
|
|
856
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
857
|
+
|
|
858
|
+
// Only allow refinement it we know whether or not the children of this tile exist.
|
|
859
|
+
// For a tileset with `availability`, we'll always be able to refine.
|
|
860
|
+
// We can ask for availability of _any_ child tile because we only need to confirm
|
|
861
|
+
// that we get a yes or no answer, it doesn't matter what the answer is.
|
|
862
|
+
if (defined(surfaceTile.terrainData)) {
|
|
863
|
+
return true;
|
|
864
|
+
}
|
|
865
|
+
const childAvailable = this.terrainProvider.getTileDataAvailable(
|
|
866
|
+
// @ts-expect-error Missing types.
|
|
867
|
+
tile.x * 2,
|
|
868
|
+
tile.y * 2,
|
|
869
|
+
tile.level + 1,
|
|
870
|
+
);
|
|
871
|
+
return childAvailable !== undefined;
|
|
705
872
|
}
|
|
706
873
|
|
|
707
|
-
|
|
708
|
-
|
|
874
|
+
/**
|
|
875
|
+
* Determines if the given not-fully-loaded tile can be rendered without losing detail that
|
|
876
|
+
* was present last frame as a result of rendering descendant tiles. This method will only be
|
|
877
|
+
* called if this tile's descendants were rendered last frame. If the tile is fully loaded,
|
|
878
|
+
* it is assumed that this method will return true and it will not be called.
|
|
879
|
+
* @param {QuadtreeTile} tile The tile to check.
|
|
880
|
+
* @returns {boolean} True if the tile can be rendered without losing detail.
|
|
881
|
+
*/
|
|
882
|
+
canRenderWithoutLosingDetail(tile) {
|
|
883
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
884
|
+
|
|
885
|
+
const readyImagery = readyImageryScratch;
|
|
886
|
+
// @ts-expect-error Missing types.
|
|
887
|
+
readyImagery.length = this._imageryLayers.length;
|
|
888
|
+
|
|
889
|
+
let terrainReady = false;
|
|
890
|
+
let initialImageryState = false;
|
|
891
|
+
let imagery;
|
|
892
|
+
|
|
893
|
+
if (defined(surfaceTile)) {
|
|
894
|
+
// We can render even with non-ready terrain as long as all our rendered descendants
|
|
895
|
+
// are missing terrain geometry too. i.e. if we rendered fills for more detailed tiles
|
|
896
|
+
// last frame, it's ok to render a fill for this tile this frame.
|
|
897
|
+
terrainReady = surfaceTile.terrainState === TerrainState.READY;
|
|
898
|
+
|
|
899
|
+
// Initially assume all imagery layers are ready, unless imagery hasn't been initialized at all.
|
|
900
|
+
initialImageryState = true;
|
|
901
|
+
|
|
902
|
+
imagery = surfaceTile.imagery;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
let i;
|
|
906
|
+
let len;
|
|
907
|
+
|
|
908
|
+
for (i = 0, len = readyImagery.length; i < len; ++i) {
|
|
909
|
+
readyImagery[i] = initialImageryState;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
if (defined(imagery)) {
|
|
913
|
+
for (i = 0, len = imagery.length; i < len; ++i) {
|
|
914
|
+
const tileImagery = imagery[i];
|
|
915
|
+
const loadingImagery = tileImagery.loadingImagery;
|
|
916
|
+
const isReady =
|
|
917
|
+
!defined(loadingImagery) ||
|
|
918
|
+
loadingImagery.state === ImageryState.FAILED ||
|
|
919
|
+
loadingImagery.state === ImageryState.INVALID;
|
|
920
|
+
const layerIndex = (
|
|
921
|
+
tileImagery.loadingImagery || tileImagery.readyImagery
|
|
922
|
+
).imageryLayer._layerIndex;
|
|
923
|
+
|
|
924
|
+
// For a layer to be ready, all tiles belonging to that layer must be ready.
|
|
925
|
+
readyImagery[layerIndex] = isReady && readyImagery[layerIndex];
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
const lastFrame = this.quadtree._lastSelectionFrameNumber;
|
|
930
|
+
|
|
931
|
+
// Traverse the descendants looking for one with terrain or imagery that is not loaded on this tile.
|
|
932
|
+
const stack = canRenderTraversalStack;
|
|
933
|
+
stack.length = 0;
|
|
934
|
+
stack.push(
|
|
935
|
+
tile.southwestChild,
|
|
936
|
+
tile.southeastChild,
|
|
937
|
+
tile.northwestChild,
|
|
938
|
+
tile.northeastChild,
|
|
939
|
+
);
|
|
940
|
+
|
|
941
|
+
while (stack.length > 0) {
|
|
942
|
+
const descendant = stack.pop();
|
|
943
|
+
const lastFrameSelectionResult =
|
|
944
|
+
descendant._lastSelectionResultFrame === lastFrame
|
|
945
|
+
? descendant._lastSelectionResult
|
|
946
|
+
: TileSelectionResult.NONE;
|
|
947
|
+
|
|
948
|
+
if (lastFrameSelectionResult === TileSelectionResult.RENDERED) {
|
|
949
|
+
const descendantSurface = descendant.data;
|
|
950
|
+
|
|
951
|
+
if (!defined(descendantSurface)) {
|
|
952
|
+
// Descendant has no data, so it can't block rendering.
|
|
953
|
+
continue;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
if (
|
|
957
|
+
!terrainReady &&
|
|
958
|
+
descendant.data.terrainState === TerrainState.READY
|
|
959
|
+
) {
|
|
960
|
+
// Rendered descendant has real terrain, but we don't. Rendering is blocked.
|
|
961
|
+
return false;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
const descendantImagery = descendant.data.imagery;
|
|
965
|
+
for (i = 0, len = descendantImagery.length; i < len; ++i) {
|
|
966
|
+
const descendantTileImagery = descendantImagery[i];
|
|
967
|
+
const descendantLoadingImagery = descendantTileImagery.loadingImagery;
|
|
968
|
+
const descendantIsReady =
|
|
969
|
+
!defined(descendantLoadingImagery) ||
|
|
970
|
+
descendantLoadingImagery.state === ImageryState.FAILED ||
|
|
971
|
+
descendantLoadingImagery.state === ImageryState.INVALID;
|
|
972
|
+
const descendantLayerIndex = (
|
|
973
|
+
descendantTileImagery.loadingImagery ||
|
|
974
|
+
descendantTileImagery.readyImagery
|
|
975
|
+
).imageryLayer._layerIndex;
|
|
976
|
+
|
|
977
|
+
// If this imagery tile of a descendant is ready but the layer isn't ready in this tile,
|
|
978
|
+
// then rendering is blocked.
|
|
979
|
+
if (descendantIsReady && !readyImagery[descendantLayerIndex]) {
|
|
980
|
+
return false;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
} else if (lastFrameSelectionResult === TileSelectionResult.REFINED) {
|
|
984
|
+
stack.push(
|
|
985
|
+
descendant.southwestChild,
|
|
986
|
+
descendant.southeastChild,
|
|
987
|
+
descendant.northwestChild,
|
|
988
|
+
descendant.northeastChild,
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
709
993
|
return true;
|
|
710
994
|
}
|
|
711
995
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
996
|
+
/**
|
|
997
|
+
* Determines the priority for loading this tile. Lower priority values load sooner.
|
|
998
|
+
* @param {QuadtreeTile} tile The tile.
|
|
999
|
+
* @param {FrameState} frameState The frame state.
|
|
1000
|
+
* @returns {number} The load priority value.
|
|
1001
|
+
*/
|
|
1002
|
+
computeTileLoadPriority(tile, frameState) {
|
|
1003
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1004
|
+
if (surfaceTile === undefined) {
|
|
1005
|
+
return 0.0;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
const obb = surfaceTile.tileBoundingRegion.boundingVolume;
|
|
1009
|
+
if (obb === undefined) {
|
|
1010
|
+
return 0.0;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1013
|
+
const cameraPosition = frameState.camera.positionWC;
|
|
1014
|
+
const cameraDirection = frameState.camera.directionWC;
|
|
1015
|
+
const tileDirection = Cartesian3.subtract(
|
|
1016
|
+
obb.center,
|
|
1017
|
+
cameraPosition,
|
|
1018
|
+
tileDirectionScratch,
|
|
1019
|
+
);
|
|
1020
|
+
const magnitude = Cartesian3.magnitude(tileDirection);
|
|
1021
|
+
if (magnitude < CesiumMath.EPSILON5) {
|
|
1022
|
+
return 0.0;
|
|
1023
|
+
}
|
|
1024
|
+
Cartesian3.divideByScalar(tileDirection, magnitude, tileDirection);
|
|
1025
|
+
return (
|
|
1026
|
+
(1.0 - Cartesian3.dot(tileDirection, cameraDirection)) * tile._distance
|
|
1027
|
+
);
|
|
719
1028
|
}
|
|
720
1029
|
|
|
721
|
-
|
|
722
|
-
|
|
1030
|
+
/**
|
|
1031
|
+
* Shows a specified tile in this frame. The provider can cause the tile to be shown by adding
|
|
1032
|
+
* render commands to the commandList, or use any other method as appropriate. The tile is not
|
|
1033
|
+
* expected to be visible next frame as well, unless this method is called next frame, too.
|
|
1034
|
+
*
|
|
1035
|
+
* @param {QuadtreeTile} tile The tile instance.
|
|
1036
|
+
* @param {FrameState} frameState The state information of the current rendering frame.
|
|
1037
|
+
*/
|
|
1038
|
+
showTileThisFrame(tile, frameState) {
|
|
1039
|
+
let readyTextureCount = 0;
|
|
1040
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1041
|
+
const tileImageryCollection = surfaceTile.imagery;
|
|
1042
|
+
for (let i = 0, len = tileImageryCollection.length; i < len; ++i) {
|
|
1043
|
+
const tileImagery = tileImageryCollection[i];
|
|
1044
|
+
if (
|
|
1045
|
+
defined(tileImagery.readyImagery) &&
|
|
1046
|
+
tileImagery.readyImagery.imageryLayer.alpha !== 0.0
|
|
1047
|
+
) {
|
|
1048
|
+
++readyTextureCount;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
723
1051
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
* @param {QuadtreeTile} tile The tile instance.
|
|
730
|
-
* @param {FrameState} frameState The state information about the current frame.
|
|
731
|
-
* @param {QuadtreeOccluders} occluders The objects that may occlude this tile.
|
|
732
|
-
*
|
|
733
|
-
* @returns {Visibility} Visibility.NONE if the tile is not visible,
|
|
734
|
-
* Visibility.PARTIAL if the tile is partially visible, or
|
|
735
|
-
* Visibility.FULL if the tile is fully visible.
|
|
736
|
-
*/
|
|
737
|
-
GlobeSurfaceTileProvider.prototype.computeTileVisibility = function (
|
|
738
|
-
tile,
|
|
739
|
-
frameState,
|
|
740
|
-
occluders,
|
|
741
|
-
) {
|
|
742
|
-
const distance = this.computeDistanceToTile(tile, frameState);
|
|
743
|
-
tile._distance = distance;
|
|
1052
|
+
let tileSet = this._tilesToRenderByTextureCount[readyTextureCount];
|
|
1053
|
+
if (!defined(tileSet)) {
|
|
1054
|
+
tileSet = [];
|
|
1055
|
+
this._tilesToRenderByTextureCount[readyTextureCount] = tileSet;
|
|
1056
|
+
}
|
|
744
1057
|
|
|
745
|
-
|
|
1058
|
+
tileSet.push(tile);
|
|
746
1059
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
1060
|
+
if (!defined(surfaceTile.vertexArray)) {
|
|
1061
|
+
this._hasFillTilesThisFrame = true;
|
|
1062
|
+
} else {
|
|
1063
|
+
this._hasLoadedTilesThisFrame = true;
|
|
751
1064
|
}
|
|
1065
|
+
|
|
1066
|
+
const debug = this._debug;
|
|
1067
|
+
++debug.tilesRendered;
|
|
1068
|
+
debug.texturesRendered += readyTextureCount;
|
|
752
1069
|
}
|
|
753
1070
|
|
|
754
|
-
|
|
755
|
-
|
|
1071
|
+
/**
|
|
1072
|
+
* Gets the distance from the camera to the closest point on the tile. This is used for level-of-detail selection.
|
|
1073
|
+
*
|
|
1074
|
+
* @param {QuadtreeTile} tile The tile instance.
|
|
1075
|
+
* @param {FrameState} frameState The state information of the current rendering frame.
|
|
1076
|
+
*
|
|
1077
|
+
* @returns {number} The distance from the camera to the closest point on the tile, in meters.
|
|
1078
|
+
*/
|
|
1079
|
+
computeDistanceToTile(tile, frameState) {
|
|
1080
|
+
// The distance should be:
|
|
1081
|
+
// 1. the actual distance to the tight-fitting bounding volume, or
|
|
1082
|
+
// 2. a distance that is equal to or greater than the actual distance to the tight-fitting bounding volume.
|
|
1083
|
+
//
|
|
1084
|
+
// 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
|
|
1085
|
+
// build a tight-fitting bounding volume horizontally, but not vertically. The min/max heights from the
|
|
1086
|
+
// ancestor will likely form a volume that is much bigger than it needs to be. This means that the volume may
|
|
1087
|
+
// be deemed to be much closer to the camera than it really is, causing us to select tiles that are too detailed.
|
|
1088
|
+
// Loading too-detailed tiles is super expensive, so we don't want to do that. We don't know where the child
|
|
1089
|
+
// tile really lies within the parent range of heights, but we _do_ know the child tile can't be any closer than
|
|
1090
|
+
// the ancestor height surface (min or max) that is _farthest away_ from the camera. So if we compute distance
|
|
1091
|
+
// based on that conservative metric, we may end up loading tiles that are not detailed enough, but that's much
|
|
1092
|
+
// better (faster) than loading tiles that are too detailed.
|
|
1093
|
+
|
|
1094
|
+
updateTileBoundingRegion(tile, this, frameState);
|
|
1095
|
+
|
|
1096
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1097
|
+
const boundingVolumeSourceTile = surfaceTile.boundingVolumeSourceTile;
|
|
1098
|
+
if (boundingVolumeSourceTile === undefined) {
|
|
1099
|
+
// Can't find any min/max heights anywhere? Ok, let's just say the
|
|
1100
|
+
// tile is really far away so we'll load and render it rather than
|
|
1101
|
+
// refining.
|
|
1102
|
+
return 9999999999.0;
|
|
1103
|
+
}
|
|
756
1104
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
1105
|
+
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
1106
|
+
const min = tileBoundingRegion.minimumHeight;
|
|
1107
|
+
const max = tileBoundingRegion.maximumHeight;
|
|
1108
|
+
|
|
1109
|
+
if (surfaceTile.boundingVolumeSourceTile !== tile) {
|
|
1110
|
+
const cameraHeight = frameState.camera.positionCartographic.height;
|
|
1111
|
+
const distanceToMin = Math.abs(cameraHeight - min);
|
|
1112
|
+
const distanceToMax = Math.abs(cameraHeight - max);
|
|
1113
|
+
if (distanceToMin > distanceToMax) {
|
|
1114
|
+
tileBoundingRegion.minimumHeight = min;
|
|
1115
|
+
tileBoundingRegion.maximumHeight = min;
|
|
1116
|
+
} else {
|
|
1117
|
+
tileBoundingRegion.minimumHeight = max;
|
|
1118
|
+
tileBoundingRegion.maximumHeight = max;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
761
1121
|
|
|
762
|
-
|
|
763
|
-
let boundingVolume = tileBoundingRegion.boundingVolume;
|
|
1122
|
+
const result = tileBoundingRegion.distanceToCamera(frameState);
|
|
764
1123
|
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
1124
|
+
tileBoundingRegion.minimumHeight = min;
|
|
1125
|
+
tileBoundingRegion.maximumHeight = max;
|
|
768
1126
|
|
|
769
|
-
|
|
770
|
-
surfaceTile.clippedByBoundaries = false;
|
|
771
|
-
const clippedCartographicLimitRectangle = clipRectangleAntimeridian(
|
|
772
|
-
tile.rectangle,
|
|
773
|
-
this.cartographicLimitRectangle,
|
|
774
|
-
);
|
|
775
|
-
const areaLimitIntersection = Rectangle.simpleIntersection(
|
|
776
|
-
clippedCartographicLimitRectangle,
|
|
777
|
-
tile.rectangle,
|
|
778
|
-
rectangleIntersectionScratch,
|
|
779
|
-
);
|
|
780
|
-
if (!defined(areaLimitIntersection)) {
|
|
781
|
-
return Visibility.NONE;
|
|
1127
|
+
return result;
|
|
782
1128
|
}
|
|
783
|
-
|
|
784
|
-
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* Returns true if this object was destroyed; otherwise, false.
|
|
1132
|
+
* <br /><br />
|
|
1133
|
+
* If this object was destroyed, it should not be used; calling any function other than
|
|
1134
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
1135
|
+
*
|
|
1136
|
+
* @returns {boolean} True if this object was destroyed; otherwise, false.
|
|
1137
|
+
*
|
|
1138
|
+
* @see GlobeSurfaceTileProvider#destroy
|
|
1139
|
+
*/
|
|
1140
|
+
isDestroyed() {
|
|
1141
|
+
return false;
|
|
785
1142
|
}
|
|
786
1143
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
1144
|
+
/**
|
|
1145
|
+
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
1146
|
+
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
1147
|
+
* <br /><br />
|
|
1148
|
+
* Once an object is destroyed, it should not be used; calling any function other than
|
|
1149
|
+
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
1150
|
+
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
1151
|
+
*
|
|
1152
|
+
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
1153
|
+
*
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* provider = provider && provider.destroy();
|
|
1157
|
+
*
|
|
1158
|
+
* @see GlobeSurfaceTileProvider#isDestroyed
|
|
1159
|
+
*/
|
|
1160
|
+
destroy() {
|
|
1161
|
+
this._tileProvider = this._tileProvider && this._tileProvider.destroy();
|
|
1162
|
+
this._clippingPlanes =
|
|
1163
|
+
this._clippingPlanes && this._clippingPlanes.destroy();
|
|
1164
|
+
this._clippingPolygons =
|
|
1165
|
+
this._clippingPolygons && this._clippingPolygons.destroy();
|
|
1166
|
+
this._removeLayerAddedListener =
|
|
1167
|
+
this._removeLayerAddedListener && this._removeLayerAddedListener();
|
|
1168
|
+
this._removeLayerRemovedListener =
|
|
1169
|
+
this._removeLayerRemovedListener && this._removeLayerRemovedListener();
|
|
1170
|
+
this._removeLayerMovedListener =
|
|
1171
|
+
this._removeLayerMovedListener && this._removeLayerMovedListener();
|
|
1172
|
+
this._removeLayerShownListener =
|
|
1173
|
+
this._removeLayerShownListener && this._removeLayerShownListener();
|
|
1174
|
+
|
|
1175
|
+
return destroyObject(this);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
_onLayerAdded(layer, index) {
|
|
1179
|
+
if (this.isDestroyed()) {
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
802
1182
|
|
|
803
|
-
if (
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
1183
|
+
if (layer.show) {
|
|
1184
|
+
const terrainProvider = this._terrainProvider;
|
|
1185
|
+
|
|
1186
|
+
const that = this;
|
|
1187
|
+
const tileImageryUpdatedEvent = this._imageryLayersUpdatedEvent;
|
|
1188
|
+
const reloadFunction = function () {
|
|
1189
|
+
// Clear the layer's cache
|
|
1190
|
+
layer._imageryCache = {};
|
|
1191
|
+
|
|
1192
|
+
that._quadtree.forEachLoadedTile(function (tile) {
|
|
1193
|
+
// If this layer is still waiting to for the loaded callback, just return
|
|
1194
|
+
if (defined(tile._loadedCallbacks[layer._layerIndex])) {
|
|
1195
|
+
return;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
let i;
|
|
1199
|
+
|
|
1200
|
+
// Figure out how many TileImageries we will need to remove and where to insert new ones
|
|
1201
|
+
const tileImageryCollection = tile.data.imagery;
|
|
1202
|
+
const length = tileImageryCollection.length;
|
|
1203
|
+
let startIndex = -1;
|
|
1204
|
+
let tileImageriesToFree = 0;
|
|
1205
|
+
for (i = 0; i < length; ++i) {
|
|
1206
|
+
const tileImagery = tileImageryCollection[i];
|
|
1207
|
+
const imagery =
|
|
1208
|
+
tileImagery.readyImagery ?? tileImagery.loadingImagery;
|
|
1209
|
+
if (imagery.imageryLayer === layer) {
|
|
1210
|
+
if (startIndex === -1) {
|
|
1211
|
+
startIndex = i;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
++tileImageriesToFree;
|
|
1215
|
+
} else if (startIndex !== -1) {
|
|
1216
|
+
// iterated past the section of TileImageries belonging to this layer, no need to continue.
|
|
1217
|
+
break;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
if (startIndex === -1) {
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// Insert immediately after existing TileImageries
|
|
1226
|
+
const insertionPoint = startIndex + tileImageriesToFree;
|
|
1227
|
+
|
|
1228
|
+
// Create new TileImageries for all loaded tiles
|
|
1229
|
+
if (
|
|
1230
|
+
layer._createTileImagerySkeletons(
|
|
1231
|
+
tile,
|
|
1232
|
+
terrainProvider,
|
|
1233
|
+
insertionPoint,
|
|
1234
|
+
)
|
|
1235
|
+
) {
|
|
1236
|
+
// Add callback to remove old TileImageries when the new TileImageries are ready
|
|
1237
|
+
tile._loadedCallbacks[layer._layerIndex] = getTileReadyCallback(
|
|
1238
|
+
tileImageriesToFree,
|
|
1239
|
+
layer,
|
|
1240
|
+
terrainProvider,
|
|
1241
|
+
);
|
|
1242
|
+
|
|
1243
|
+
tile.state = QuadtreeTileLoadState.LOADING;
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
if (layer.ready) {
|
|
1249
|
+
const imageryProvider = layer.imageryProvider;
|
|
1250
|
+
imageryProvider._reload = reloadFunction;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// create TileImageries for this layer for all previously loaded tiles
|
|
1254
|
+
this._quadtree.forEachLoadedTile(function (tile) {
|
|
1255
|
+
if (layer._createTileImagerySkeletons(tile, terrainProvider)) {
|
|
1256
|
+
tile.state = QuadtreeTileLoadState.LOADING;
|
|
1257
|
+
|
|
1258
|
+
// Tiles that are not currently being rendered need to load the new layer before they're renderable.
|
|
1259
|
+
// We don't mark the rendered tiles non-renderable, though, because that would make the globe disappear.
|
|
1260
|
+
if (
|
|
1261
|
+
tile.level !== 0 &&
|
|
1262
|
+
(tile._lastSelectionResultFrame !==
|
|
1263
|
+
that.quadtree._lastSelectionFrameNumber ||
|
|
1264
|
+
tile._lastSelectionResult !== TileSelectionResult.RENDERED)
|
|
1265
|
+
) {
|
|
1266
|
+
tile.renderable = false;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
});
|
|
1270
|
+
|
|
1271
|
+
this._layerOrderChanged = true;
|
|
1272
|
+
tileImageryUpdatedEvent.raiseEvent();
|
|
812
1273
|
}
|
|
813
1274
|
}
|
|
814
1275
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
1276
|
+
_onLayerRemoved(layer, index) {
|
|
1277
|
+
// destroy TileImagerys for this layer for all previously loaded tiles
|
|
1278
|
+
this._quadtree.forEachLoadedTile(function (tile) {
|
|
1279
|
+
const tileImageryCollection = tile.data.imagery;
|
|
1280
|
+
|
|
1281
|
+
let startIndex = -1;
|
|
1282
|
+
let numDestroyed = 0;
|
|
1283
|
+
for (let i = 0, len = tileImageryCollection.length; i < len; ++i) {
|
|
1284
|
+
const tileImagery = tileImageryCollection[i];
|
|
1285
|
+
let imagery = tileImagery.loadingImagery;
|
|
1286
|
+
if (!defined(imagery)) {
|
|
1287
|
+
imagery = tileImagery.readyImagery;
|
|
1288
|
+
}
|
|
1289
|
+
if (imagery.imageryLayer === layer) {
|
|
1290
|
+
if (startIndex === -1) {
|
|
1291
|
+
startIndex = i;
|
|
1292
|
+
}
|
|
818
1293
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
1294
|
+
tileImagery.freeResources();
|
|
1295
|
+
++numDestroyed;
|
|
1296
|
+
} else if (startIndex !== -1) {
|
|
1297
|
+
// iterated past the section of TileImagerys belonging to this layer, no need to continue.
|
|
1298
|
+
break;
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
if (startIndex !== -1) {
|
|
1303
|
+
tileImageryCollection.splice(startIndex, numDestroyed);
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
|
|
1307
|
+
if (defined(layer.imageryProvider)) {
|
|
1308
|
+
layer.imageryProvider._reload = undefined;
|
|
826
1309
|
}
|
|
1310
|
+
|
|
1311
|
+
this._imageryLayersUpdatedEvent.raiseEvent();
|
|
827
1312
|
}
|
|
828
1313
|
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
clippingPolygons.computeIntersectionWithBoundingVolume(
|
|
833
|
-
tileBoundingRegion,
|
|
834
|
-
);
|
|
835
|
-
tile.isClipped = polygonIntersection !== Intersect.OUTSIDE;
|
|
836
|
-
// Polygon clipping intersections are determined by outer rectangles, therefore we cannot
|
|
837
|
-
// preemptively determine if a tile is completely clipped or not here.
|
|
1314
|
+
_onLayerMoved(layer, newIndex, oldIndex) {
|
|
1315
|
+
this._layerOrderChanged = true;
|
|
1316
|
+
this._imageryLayersUpdatedEvent.raiseEvent();
|
|
838
1317
|
}
|
|
839
1318
|
|
|
840
|
-
|
|
841
|
-
|
|
1319
|
+
_onLayerShownOrHidden(layer, index, show) {
|
|
1320
|
+
if (show) {
|
|
1321
|
+
this._onLayerAdded(layer, index);
|
|
1322
|
+
} else {
|
|
1323
|
+
this._onLayerRemoved(layer, index);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
842
1327
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
} else if (intersection === Intersect.INSIDE) {
|
|
848
|
-
visibility = Visibility.FULL;
|
|
1328
|
+
function sortTileImageryByLayerIndex(a, b) {
|
|
1329
|
+
let aImagery = a.loadingImagery;
|
|
1330
|
+
if (!defined(aImagery)) {
|
|
1331
|
+
aImagery = a.readyImagery;
|
|
849
1332
|
}
|
|
850
1333
|
|
|
851
|
-
|
|
852
|
-
|
|
1334
|
+
let bImagery = b.loadingImagery;
|
|
1335
|
+
if (!defined(bImagery)) {
|
|
1336
|
+
bImagery = b.readyImagery;
|
|
853
1337
|
}
|
|
854
1338
|
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
frameState.camera.frustum instanceof OrthographicFrustum;
|
|
858
|
-
if (
|
|
859
|
-
frameState.mode === SceneMode.SCENE3D &&
|
|
860
|
-
!ortho3D &&
|
|
861
|
-
defined(occluders) &&
|
|
862
|
-
!undergroundVisible
|
|
863
|
-
) {
|
|
864
|
-
const occludeePointInScaledSpace = surfaceTile.occludeePointInScaledSpace;
|
|
865
|
-
if (!defined(occludeePointInScaledSpace)) {
|
|
866
|
-
return visibility;
|
|
867
|
-
}
|
|
1339
|
+
return aImagery.imageryLayer._layerIndex - bImagery.imageryLayer._layerIndex;
|
|
1340
|
+
}
|
|
868
1341
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1342
|
+
/**
|
|
1343
|
+
* @param {GlobeSurfaceTileProvider} surface
|
|
1344
|
+
* @param {FrameState} frameState
|
|
1345
|
+
* @ignore
|
|
1346
|
+
*/
|
|
1347
|
+
function updateCredits(surface, frameState) {
|
|
1348
|
+
const creditDisplay = frameState.creditDisplay;
|
|
1349
|
+
const terrainProvider = surface._terrainProvider;
|
|
1350
|
+
// @ts-expect-error Missing types.
|
|
1351
|
+
if (defined(terrainProvider) && defined(terrainProvider.credit)) {
|
|
1352
|
+
// @ts-expect-error Missing types.
|
|
1353
|
+
creditDisplay.addCreditToNextFrame(terrainProvider.credit);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
const imageryLayers = surface._imageryLayers;
|
|
1357
|
+
// @ts-expect-error Missing types.
|
|
1358
|
+
for (let i = 0, len = imageryLayers.length; i < len; ++i) {
|
|
1359
|
+
const layer = imageryLayers.get(i);
|
|
1360
|
+
// @ts-expect-error Missing types.
|
|
1361
|
+
if (layer.ready && layer.show && defined(layer.imageryProvider.credit)) {
|
|
1362
|
+
// @ts-expect-error Missing types.
|
|
1363
|
+
creditDisplay.addCreditToNextFrame(layer.imageryProvider.credit);
|
|
876
1364
|
}
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
877
1367
|
|
|
878
|
-
|
|
1368
|
+
/**
|
|
1369
|
+
* @param {DrawCommand} command
|
|
1370
|
+
* @param {FrameState} frameState
|
|
1371
|
+
* @ignore
|
|
1372
|
+
*/
|
|
1373
|
+
function pushCommand(command, frameState) {
|
|
1374
|
+
const globeTranslucencyState = frameState.globeTranslucencyState;
|
|
1375
|
+
if (globeTranslucencyState.translucent) {
|
|
1376
|
+
// @ts-expect-error Missing types.
|
|
1377
|
+
const isBlendCommand = command.renderState.blending.enabled;
|
|
1378
|
+
globeTranslucencyState.pushDerivedCommands(
|
|
1379
|
+
command,
|
|
1380
|
+
isBlendCommand,
|
|
1381
|
+
frameState,
|
|
1382
|
+
);
|
|
1383
|
+
} else {
|
|
1384
|
+
frameState.commandList.push(command);
|
|
879
1385
|
}
|
|
1386
|
+
}
|
|
880
1387
|
|
|
881
|
-
|
|
882
|
-
|
|
1388
|
+
const boundingSphereScratch = new BoundingSphere();
|
|
1389
|
+
const rectangleIntersectionScratch = new Rectangle();
|
|
1390
|
+
const splitCartographicLimitRectangleScratch = new Rectangle();
|
|
1391
|
+
const rectangleCenterScratch = new Cartographic();
|
|
883
1392
|
|
|
884
1393
|
/**
|
|
885
|
-
*
|
|
886
|
-
* @param {
|
|
887
|
-
* @
|
|
1394
|
+
* @param {Rectangle} tileRectangle
|
|
1395
|
+
* @param {Rectangle} cartographicLimitRectangle
|
|
1396
|
+
* @ignore
|
|
888
1397
|
*/
|
|
889
|
-
|
|
890
|
-
//
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
// that we get a yes or no answer, it doesn't matter what the answer is.
|
|
894
|
-
if (defined(tile.data.terrainData)) {
|
|
895
|
-
return true;
|
|
1398
|
+
function clipRectangleAntimeridian(tileRectangle, cartographicLimitRectangle) {
|
|
1399
|
+
// cartographicLimitRectangle may span the IDL, but tiles never will.
|
|
1400
|
+
if (cartographicLimitRectangle.west < cartographicLimitRectangle.east) {
|
|
1401
|
+
return cartographicLimitRectangle;
|
|
896
1402
|
}
|
|
897
|
-
const
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
tile.level + 1,
|
|
1403
|
+
const splitRectangle = Rectangle.clone(
|
|
1404
|
+
cartographicLimitRectangle,
|
|
1405
|
+
splitCartographicLimitRectangleScratch,
|
|
901
1406
|
);
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1407
|
+
const tileCenter = Rectangle.center(tileRectangle, rectangleCenterScratch);
|
|
1408
|
+
if (tileCenter.longitude > 0.0) {
|
|
1409
|
+
splitRectangle.east = CesiumMath.PI;
|
|
1410
|
+
} else {
|
|
1411
|
+
splitRectangle.west = -CesiumMath.PI;
|
|
1412
|
+
}
|
|
1413
|
+
return splitRectangle;
|
|
1414
|
+
}
|
|
907
1415
|
|
|
908
1416
|
/**
|
|
909
|
-
*
|
|
910
|
-
*
|
|
911
|
-
*
|
|
912
|
-
* it is assumed that this method will return true and it will not be called.
|
|
913
|
-
* @param {QuadtreeTile} tile The tile to check.
|
|
914
|
-
* @returns {boolean} True if the tile can be rendered without losing detail.
|
|
1417
|
+
* @param {GlobeSurfaceTileProvider} tileProvider
|
|
1418
|
+
* @param {FrameState} frameState
|
|
1419
|
+
* @ignore
|
|
915
1420
|
*/
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
) {
|
|
920
|
-
const surfaceTile = tile.data;
|
|
921
|
-
|
|
922
|
-
const readyImagery = readyImageryScratch;
|
|
923
|
-
readyImagery.length = this._imageryLayers.length;
|
|
924
|
-
|
|
925
|
-
let terrainReady = false;
|
|
926
|
-
let initialImageryState = false;
|
|
927
|
-
let imagery;
|
|
928
|
-
|
|
929
|
-
if (defined(surfaceTile)) {
|
|
930
|
-
// We can render even with non-ready terrain as long as all our rendered descendants
|
|
931
|
-
// are missing terrain geometry too. i.e. if we rendered fills for more detailed tiles
|
|
932
|
-
// last frame, it's ok to render a fill for this tile this frame.
|
|
933
|
-
terrainReady = surfaceTile.terrainState === TerrainState.READY;
|
|
934
|
-
|
|
935
|
-
// Initially assume all imagery layers are ready, unless imagery hasn't been initialized at all.
|
|
936
|
-
initialImageryState = true;
|
|
937
|
-
|
|
938
|
-
imagery = surfaceTile.imagery;
|
|
1421
|
+
function isUndergroundVisible(tileProvider, frameState) {
|
|
1422
|
+
if (frameState.cameraUnderground) {
|
|
1423
|
+
return true;
|
|
939
1424
|
}
|
|
940
1425
|
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
for (i = 0, len = readyImagery.length; i < len; ++i) {
|
|
945
|
-
readyImagery[i] = initialImageryState;
|
|
1426
|
+
if (frameState.globeTranslucencyState.translucent) {
|
|
1427
|
+
return true;
|
|
946
1428
|
}
|
|
947
1429
|
|
|
948
|
-
if (
|
|
949
|
-
|
|
950
|
-
const tileImagery = imagery[i];
|
|
951
|
-
const loadingImagery = tileImagery.loadingImagery;
|
|
952
|
-
const isReady =
|
|
953
|
-
!defined(loadingImagery) ||
|
|
954
|
-
loadingImagery.state === ImageryState.FAILED ||
|
|
955
|
-
loadingImagery.state === ImageryState.INVALID;
|
|
956
|
-
const layerIndex = (
|
|
957
|
-
tileImagery.loadingImagery || tileImagery.readyImagery
|
|
958
|
-
).imageryLayer._layerIndex;
|
|
959
|
-
|
|
960
|
-
// For a layer to be ready, all tiles belonging to that layer must be ready.
|
|
961
|
-
readyImagery[layerIndex] = isReady && readyImagery[layerIndex];
|
|
962
|
-
}
|
|
1430
|
+
if (tileProvider.backFaceCulling) {
|
|
1431
|
+
return false;
|
|
963
1432
|
}
|
|
964
1433
|
|
|
965
|
-
const
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
const stack = canRenderTraversalStack;
|
|
969
|
-
stack.length = 0;
|
|
970
|
-
stack.push(
|
|
971
|
-
tile.southwestChild,
|
|
972
|
-
tile.southeastChild,
|
|
973
|
-
tile.northwestChild,
|
|
974
|
-
tile.northeastChild,
|
|
975
|
-
);
|
|
976
|
-
|
|
977
|
-
while (stack.length > 0) {
|
|
978
|
-
const descendant = stack.pop();
|
|
979
|
-
const lastFrameSelectionResult =
|
|
980
|
-
descendant._lastSelectionResultFrame === lastFrame
|
|
981
|
-
? descendant._lastSelectionResult
|
|
982
|
-
: TileSelectionResult.NONE;
|
|
983
|
-
|
|
984
|
-
if (lastFrameSelectionResult === TileSelectionResult.RENDERED) {
|
|
985
|
-
const descendantSurface = descendant.data;
|
|
986
|
-
|
|
987
|
-
if (!defined(descendantSurface)) {
|
|
988
|
-
// Descendant has no data, so it can't block rendering.
|
|
989
|
-
continue;
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
if (
|
|
993
|
-
!terrainReady &&
|
|
994
|
-
descendant.data.terrainState === TerrainState.READY
|
|
995
|
-
) {
|
|
996
|
-
// Rendered descendant has real terrain, but we don't. Rendering is blocked.
|
|
997
|
-
return false;
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
const descendantImagery = descendant.data.imagery;
|
|
1001
|
-
for (i = 0, len = descendantImagery.length; i < len; ++i) {
|
|
1002
|
-
const descendantTileImagery = descendantImagery[i];
|
|
1003
|
-
const descendantLoadingImagery = descendantTileImagery.loadingImagery;
|
|
1004
|
-
const descendantIsReady =
|
|
1005
|
-
!defined(descendantLoadingImagery) ||
|
|
1006
|
-
descendantLoadingImagery.state === ImageryState.FAILED ||
|
|
1007
|
-
descendantLoadingImagery.state === ImageryState.INVALID;
|
|
1008
|
-
const descendantLayerIndex = (
|
|
1009
|
-
descendantTileImagery.loadingImagery ||
|
|
1010
|
-
descendantTileImagery.readyImagery
|
|
1011
|
-
).imageryLayer._layerIndex;
|
|
1012
|
-
|
|
1013
|
-
// If this imagery tile of a descendant is ready but the layer isn't ready in this tile,
|
|
1014
|
-
// then rendering is blocked.
|
|
1015
|
-
if (descendantIsReady && !readyImagery[descendantLayerIndex]) {
|
|
1016
|
-
return false;
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
} else if (lastFrameSelectionResult === TileSelectionResult.REFINED) {
|
|
1020
|
-
stack.push(
|
|
1021
|
-
descendant.southwestChild,
|
|
1022
|
-
descendant.southeastChild,
|
|
1023
|
-
descendant.northwestChild,
|
|
1024
|
-
descendant.northeastChild,
|
|
1025
|
-
);
|
|
1026
|
-
}
|
|
1434
|
+
const clippingPlanes = tileProvider._clippingPlanes;
|
|
1435
|
+
if (defined(clippingPlanes) && clippingPlanes.enabled) {
|
|
1436
|
+
return true;
|
|
1027
1437
|
}
|
|
1028
1438
|
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
const tileDirectionScratch = new Cartesian3();
|
|
1033
|
-
|
|
1034
|
-
/**
|
|
1035
|
-
* Determines the priority for loading this tile. Lower priority values load sooner.
|
|
1036
|
-
* @param {QuadtreeTile} tile The tile.
|
|
1037
|
-
* @param {FrameState} frameState The frame state.
|
|
1038
|
-
* @returns {number} The load priority value.
|
|
1039
|
-
*/
|
|
1040
|
-
GlobeSurfaceTileProvider.prototype.computeTileLoadPriority = function (
|
|
1041
|
-
tile,
|
|
1042
|
-
frameState,
|
|
1043
|
-
) {
|
|
1044
|
-
const surfaceTile = tile.data;
|
|
1045
|
-
if (surfaceTile === undefined) {
|
|
1046
|
-
return 0.0;
|
|
1439
|
+
const clippingPolygons = tileProvider._clippingPolygons;
|
|
1440
|
+
if (defined(clippingPolygons) && clippingPolygons.enabled) {
|
|
1441
|
+
return true;
|
|
1047
1442
|
}
|
|
1048
1443
|
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1444
|
+
if (
|
|
1445
|
+
!Rectangle.equals(
|
|
1446
|
+
tileProvider.cartographicLimitRectangle,
|
|
1447
|
+
Rectangle.MAX_VALUE,
|
|
1448
|
+
)
|
|
1449
|
+
) {
|
|
1450
|
+
return true;
|
|
1052
1451
|
}
|
|
1053
1452
|
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
const magnitude = Cartesian3.magnitude(tileDirection);
|
|
1062
|
-
if (magnitude < CesiumMath.EPSILON5) {
|
|
1063
|
-
return 0.0;
|
|
1064
|
-
}
|
|
1065
|
-
Cartesian3.divideByScalar(tileDirection, magnitude, tileDirection);
|
|
1066
|
-
return (
|
|
1067
|
-
(1.0 - Cartesian3.dot(tileDirection, cameraDirection)) * tile._distance
|
|
1068
|
-
);
|
|
1069
|
-
};
|
|
1453
|
+
return false;
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
const readyImageryScratch = [];
|
|
1457
|
+
const canRenderTraversalStack = [];
|
|
1458
|
+
|
|
1459
|
+
const tileDirectionScratch = new Cartesian3();
|
|
1070
1460
|
|
|
1071
1461
|
const modifiedModelViewScratch = new Matrix4();
|
|
1072
1462
|
const modifiedModelViewProjectionScratch = new Matrix4();
|
|
@@ -1078,50 +1468,6 @@ const centerEyeScratch = new Cartesian3();
|
|
|
1078
1468
|
const southwestScratch = new Cartesian3();
|
|
1079
1469
|
const northeastScratch = new Cartesian3();
|
|
1080
1470
|
|
|
1081
|
-
/**
|
|
1082
|
-
* Shows a specified tile in this frame. The provider can cause the tile to be shown by adding
|
|
1083
|
-
* render commands to the commandList, or use any other method as appropriate. The tile is not
|
|
1084
|
-
* expected to be visible next frame as well, unless this method is called next frame, too.
|
|
1085
|
-
*
|
|
1086
|
-
* @param {QuadtreeTile} tile The tile instance.
|
|
1087
|
-
* @param {FrameState} frameState The state information of the current rendering frame.
|
|
1088
|
-
*/
|
|
1089
|
-
GlobeSurfaceTileProvider.prototype.showTileThisFrame = function (
|
|
1090
|
-
tile,
|
|
1091
|
-
frameState,
|
|
1092
|
-
) {
|
|
1093
|
-
let readyTextureCount = 0;
|
|
1094
|
-
const tileImageryCollection = tile.data.imagery;
|
|
1095
|
-
for (let i = 0, len = tileImageryCollection.length; i < len; ++i) {
|
|
1096
|
-
const tileImagery = tileImageryCollection[i];
|
|
1097
|
-
if (
|
|
1098
|
-
defined(tileImagery.readyImagery) &&
|
|
1099
|
-
tileImagery.readyImagery.imageryLayer.alpha !== 0.0
|
|
1100
|
-
) {
|
|
1101
|
-
++readyTextureCount;
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
let tileSet = this._tilesToRenderByTextureCount[readyTextureCount];
|
|
1106
|
-
if (!defined(tileSet)) {
|
|
1107
|
-
tileSet = [];
|
|
1108
|
-
this._tilesToRenderByTextureCount[readyTextureCount] = tileSet;
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
tileSet.push(tile);
|
|
1112
|
-
|
|
1113
|
-
const surfaceTile = tile.data;
|
|
1114
|
-
if (!defined(surfaceTile.vertexArray)) {
|
|
1115
|
-
this._hasFillTilesThisFrame = true;
|
|
1116
|
-
} else {
|
|
1117
|
-
this._hasLoadedTilesThisFrame = true;
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
const debug = this._debug;
|
|
1121
|
-
++debug.tilesRendered;
|
|
1122
|
-
debug.texturesRendered += readyTextureCount;
|
|
1123
|
-
};
|
|
1124
|
-
|
|
1125
1471
|
const cornerPositionsScratch = [
|
|
1126
1472
|
new Cartesian3(),
|
|
1127
1473
|
new Cartesian3(),
|
|
@@ -1137,7 +1483,9 @@ function computeOccludeePoint(
|
|
|
1137
1483
|
maximumHeight,
|
|
1138
1484
|
result,
|
|
1139
1485
|
) {
|
|
1486
|
+
/** @type {EllipsoidalOccluder} */
|
|
1140
1487
|
const ellipsoidalOccluder = tileProvider.quadtree._occluders.ellipsoid;
|
|
1488
|
+
// @ts-expect-error Missing types.
|
|
1141
1489
|
const ellipsoid = ellipsoidalOccluder.ellipsoid;
|
|
1142
1490
|
|
|
1143
1491
|
const cornerPositions = cornerPositionsScratch;
|
|
@@ -1179,69 +1527,13 @@ function computeOccludeePoint(
|
|
|
1179
1527
|
}
|
|
1180
1528
|
|
|
1181
1529
|
/**
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1184
|
-
* @param {
|
|
1185
|
-
* @
|
|
1186
|
-
*
|
|
1187
|
-
* @returns {number} The distance from the camera to the closest point on the tile, in meters.
|
|
1530
|
+
* @param {QuadtreeTile} tile
|
|
1531
|
+
* @param {GlobeSurfaceTileProvider} tileProvider
|
|
1532
|
+
* @param {FrameState} frameState
|
|
1533
|
+
* @ignore
|
|
1188
1534
|
*/
|
|
1189
|
-
GlobeSurfaceTileProvider.prototype.computeDistanceToTile = function (
|
|
1190
|
-
tile,
|
|
1191
|
-
frameState,
|
|
1192
|
-
) {
|
|
1193
|
-
// The distance should be:
|
|
1194
|
-
// 1. the actual distance to the tight-fitting bounding volume, or
|
|
1195
|
-
// 2. a distance that is equal to or greater than the actual distance to the tight-fitting bounding volume.
|
|
1196
|
-
//
|
|
1197
|
-
// 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
|
|
1198
|
-
// build a tight-fitting bounding volume horizontally, but not vertically. The min/max heights from the
|
|
1199
|
-
// ancestor will likely form a volume that is much bigger than it needs to be. This means that the volume may
|
|
1200
|
-
// be deemed to be much closer to the camera than it really is, causing us to select tiles that are too detailed.
|
|
1201
|
-
// Loading too-detailed tiles is super expensive, so we don't want to do that. We don't know where the child
|
|
1202
|
-
// tile really lies within the parent range of heights, but we _do_ know the child tile can't be any closer than
|
|
1203
|
-
// the ancestor height surface (min or max) that is _farthest away_ from the camera. So if we compute distance
|
|
1204
|
-
// based on that conservative metric, we may end up loading tiles that are not detailed enough, but that's much
|
|
1205
|
-
// better (faster) than loading tiles that are too detailed.
|
|
1206
|
-
|
|
1207
|
-
updateTileBoundingRegion(tile, this, frameState);
|
|
1208
|
-
|
|
1209
|
-
const surfaceTile = tile.data;
|
|
1210
|
-
const boundingVolumeSourceTile = surfaceTile.boundingVolumeSourceTile;
|
|
1211
|
-
if (boundingVolumeSourceTile === undefined) {
|
|
1212
|
-
// Can't find any min/max heights anywhere? Ok, let's just say the
|
|
1213
|
-
// tile is really far away so we'll load and render it rather than
|
|
1214
|
-
// refining.
|
|
1215
|
-
return 9999999999.0;
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
const tileBoundingRegion = surfaceTile.tileBoundingRegion;
|
|
1219
|
-
const min = tileBoundingRegion.minimumHeight;
|
|
1220
|
-
const max = tileBoundingRegion.maximumHeight;
|
|
1221
|
-
|
|
1222
|
-
if (surfaceTile.boundingVolumeSourceTile !== tile) {
|
|
1223
|
-
const cameraHeight = frameState.camera.positionCartographic.height;
|
|
1224
|
-
const distanceToMin = Math.abs(cameraHeight - min);
|
|
1225
|
-
const distanceToMax = Math.abs(cameraHeight - max);
|
|
1226
|
-
if (distanceToMin > distanceToMax) {
|
|
1227
|
-
tileBoundingRegion.minimumHeight = min;
|
|
1228
|
-
tileBoundingRegion.maximumHeight = min;
|
|
1229
|
-
} else {
|
|
1230
|
-
tileBoundingRegion.minimumHeight = max;
|
|
1231
|
-
tileBoundingRegion.maximumHeight = max;
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
const result = tileBoundingRegion.distanceToCamera(frameState);
|
|
1236
|
-
|
|
1237
|
-
tileBoundingRegion.minimumHeight = min;
|
|
1238
|
-
tileBoundingRegion.maximumHeight = max;
|
|
1239
|
-
|
|
1240
|
-
return result;
|
|
1241
|
-
};
|
|
1242
|
-
|
|
1243
1535
|
function updateTileBoundingRegion(tile, tileProvider, frameState) {
|
|
1244
|
-
let surfaceTile = tile.data;
|
|
1536
|
+
let surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1245
1537
|
if (surfaceTile === undefined) {
|
|
1246
1538
|
surfaceTile = tile.data = new GlobeSurfaceTile();
|
|
1247
1539
|
}
|
|
@@ -1291,7 +1583,9 @@ function updateTileBoundingRegion(tile, tileProvider, frameState) {
|
|
|
1291
1583
|
|
|
1292
1584
|
let ancestorTile = tile.parent;
|
|
1293
1585
|
while (ancestorTile !== undefined) {
|
|
1294
|
-
const ancestorSurfaceTile =
|
|
1586
|
+
const ancestorSurfaceTile = /** @type {GlobeSurfaceTile} */ (
|
|
1587
|
+
ancestorTile.data
|
|
1588
|
+
);
|
|
1295
1589
|
if (ancestorSurfaceTile !== undefined) {
|
|
1296
1590
|
const ancestorMesh = ancestorSurfaceTile.mesh;
|
|
1297
1591
|
const ancestorTerrainData = ancestorSurfaceTile.terrainData;
|
|
@@ -1393,53 +1687,6 @@ function updateTileBoundingRegion(tile, tileProvider, frameState) {
|
|
|
1393
1687
|
}
|
|
1394
1688
|
}
|
|
1395
1689
|
|
|
1396
|
-
/**
|
|
1397
|
-
* Returns true if this object was destroyed; otherwise, false.
|
|
1398
|
-
* <br /><br />
|
|
1399
|
-
* If this object was destroyed, it should not be used; calling any function other than
|
|
1400
|
-
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
|
|
1401
|
-
*
|
|
1402
|
-
* @returns {boolean} True if this object was destroyed; otherwise, false.
|
|
1403
|
-
*
|
|
1404
|
-
* @see GlobeSurfaceTileProvider#destroy
|
|
1405
|
-
*/
|
|
1406
|
-
GlobeSurfaceTileProvider.prototype.isDestroyed = function () {
|
|
1407
|
-
return false;
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
/**
|
|
1411
|
-
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
|
|
1412
|
-
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
|
|
1413
|
-
* <br /><br />
|
|
1414
|
-
* Once an object is destroyed, it should not be used; calling any function other than
|
|
1415
|
-
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
|
|
1416
|
-
* assign the return value (<code>undefined</code>) to the object as done in the example.
|
|
1417
|
-
*
|
|
1418
|
-
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
|
|
1419
|
-
*
|
|
1420
|
-
*
|
|
1421
|
-
* @example
|
|
1422
|
-
* provider = provider && provider();
|
|
1423
|
-
*
|
|
1424
|
-
* @see GlobeSurfaceTileProvider#isDestroyed
|
|
1425
|
-
*/
|
|
1426
|
-
GlobeSurfaceTileProvider.prototype.destroy = function () {
|
|
1427
|
-
this._tileProvider = this._tileProvider && this._tileProvider.destroy();
|
|
1428
|
-
this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
|
|
1429
|
-
this._clippingPolygons =
|
|
1430
|
-
this._clippingPolygons && this._clippingPolygons.destroy();
|
|
1431
|
-
this._removeLayerAddedListener =
|
|
1432
|
-
this._removeLayerAddedListener && this._removeLayerAddedListener();
|
|
1433
|
-
this._removeLayerRemovedListener =
|
|
1434
|
-
this._removeLayerRemovedListener && this._removeLayerRemovedListener();
|
|
1435
|
-
this._removeLayerMovedListener =
|
|
1436
|
-
this._removeLayerMovedListener && this._removeLayerMovedListener();
|
|
1437
|
-
this._removeLayerShownListener =
|
|
1438
|
-
this._removeLayerShownListener && this._removeLayerShownListener();
|
|
1439
|
-
|
|
1440
|
-
return destroyObject(this);
|
|
1441
|
-
};
|
|
1442
|
-
|
|
1443
1690
|
function getTileReadyCallback(tileImageriesToFree, layer, terrainProvider) {
|
|
1444
1691
|
return function (tile) {
|
|
1445
1692
|
let tileImagery;
|
|
@@ -1484,165 +1731,14 @@ function getTileReadyCallback(tileImageriesToFree, layer, terrainProvider) {
|
|
|
1484
1731
|
};
|
|
1485
1732
|
}
|
|
1486
1733
|
|
|
1487
|
-
GlobeSurfaceTileProvider.prototype._onLayerAdded = function (layer, index) {
|
|
1488
|
-
if (this.isDestroyed()) {
|
|
1489
|
-
return;
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
|
-
if (layer.show) {
|
|
1493
|
-
const terrainProvider = this._terrainProvider;
|
|
1494
|
-
|
|
1495
|
-
const that = this;
|
|
1496
|
-
const tileImageryUpdatedEvent = this._imageryLayersUpdatedEvent;
|
|
1497
|
-
const reloadFunction = function () {
|
|
1498
|
-
// Clear the layer's cache
|
|
1499
|
-
layer._imageryCache = {};
|
|
1500
|
-
|
|
1501
|
-
that._quadtree.forEachLoadedTile(function (tile) {
|
|
1502
|
-
// If this layer is still waiting to for the loaded callback, just return
|
|
1503
|
-
if (defined(tile._loadedCallbacks[layer._layerIndex])) {
|
|
1504
|
-
return;
|
|
1505
|
-
}
|
|
1506
|
-
|
|
1507
|
-
let i;
|
|
1508
|
-
|
|
1509
|
-
// Figure out how many TileImageries we will need to remove and where to insert new ones
|
|
1510
|
-
const tileImageryCollection = tile.data.imagery;
|
|
1511
|
-
const length = tileImageryCollection.length;
|
|
1512
|
-
let startIndex = -1;
|
|
1513
|
-
let tileImageriesToFree = 0;
|
|
1514
|
-
for (i = 0; i < length; ++i) {
|
|
1515
|
-
const tileImagery = tileImageryCollection[i];
|
|
1516
|
-
const imagery =
|
|
1517
|
-
tileImagery.readyImagery ?? tileImagery.loadingImagery;
|
|
1518
|
-
if (imagery.imageryLayer === layer) {
|
|
1519
|
-
if (startIndex === -1) {
|
|
1520
|
-
startIndex = i;
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
++tileImageriesToFree;
|
|
1524
|
-
} else if (startIndex !== -1) {
|
|
1525
|
-
// iterated past the section of TileImageries belonging to this layer, no need to continue.
|
|
1526
|
-
break;
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
|
|
1530
|
-
if (startIndex === -1) {
|
|
1531
|
-
return;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
// Insert immediately after existing TileImageries
|
|
1535
|
-
const insertionPoint = startIndex + tileImageriesToFree;
|
|
1536
|
-
|
|
1537
|
-
// Create new TileImageries for all loaded tiles
|
|
1538
|
-
if (
|
|
1539
|
-
layer._createTileImagerySkeletons(
|
|
1540
|
-
tile,
|
|
1541
|
-
terrainProvider,
|
|
1542
|
-
insertionPoint,
|
|
1543
|
-
)
|
|
1544
|
-
) {
|
|
1545
|
-
// Add callback to remove old TileImageries when the new TileImageries are ready
|
|
1546
|
-
tile._loadedCallbacks[layer._layerIndex] = getTileReadyCallback(
|
|
1547
|
-
tileImageriesToFree,
|
|
1548
|
-
layer,
|
|
1549
|
-
terrainProvider,
|
|
1550
|
-
);
|
|
1551
|
-
|
|
1552
|
-
tile.state = QuadtreeTileLoadState.LOADING;
|
|
1553
|
-
}
|
|
1554
|
-
});
|
|
1555
|
-
};
|
|
1556
|
-
|
|
1557
|
-
if (layer.ready) {
|
|
1558
|
-
const imageryProvider = layer.imageryProvider;
|
|
1559
|
-
imageryProvider._reload = reloadFunction;
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
// create TileImageries for this layer for all previously loaded tiles
|
|
1563
|
-
this._quadtree.forEachLoadedTile(function (tile) {
|
|
1564
|
-
if (layer._createTileImagerySkeletons(tile, terrainProvider)) {
|
|
1565
|
-
tile.state = QuadtreeTileLoadState.LOADING;
|
|
1566
|
-
|
|
1567
|
-
// Tiles that are not currently being rendered need to load the new layer before they're renderable.
|
|
1568
|
-
// We don't mark the rendered tiles non-renderable, though, because that would make the globe disappear.
|
|
1569
|
-
if (
|
|
1570
|
-
tile.level !== 0 &&
|
|
1571
|
-
(tile._lastSelectionResultFrame !==
|
|
1572
|
-
that.quadtree._lastSelectionFrameNumber ||
|
|
1573
|
-
tile._lastSelectionResult !== TileSelectionResult.RENDERED)
|
|
1574
|
-
) {
|
|
1575
|
-
tile.renderable = false;
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
});
|
|
1579
|
-
|
|
1580
|
-
this._layerOrderChanged = true;
|
|
1581
|
-
tileImageryUpdatedEvent.raiseEvent();
|
|
1582
|
-
}
|
|
1583
|
-
};
|
|
1584
|
-
|
|
1585
|
-
GlobeSurfaceTileProvider.prototype._onLayerRemoved = function (layer, index) {
|
|
1586
|
-
// destroy TileImagerys for this layer for all previously loaded tiles
|
|
1587
|
-
this._quadtree.forEachLoadedTile(function (tile) {
|
|
1588
|
-
const tileImageryCollection = tile.data.imagery;
|
|
1589
|
-
|
|
1590
|
-
let startIndex = -1;
|
|
1591
|
-
let numDestroyed = 0;
|
|
1592
|
-
for (let i = 0, len = tileImageryCollection.length; i < len; ++i) {
|
|
1593
|
-
const tileImagery = tileImageryCollection[i];
|
|
1594
|
-
let imagery = tileImagery.loadingImagery;
|
|
1595
|
-
if (!defined(imagery)) {
|
|
1596
|
-
imagery = tileImagery.readyImagery;
|
|
1597
|
-
}
|
|
1598
|
-
if (imagery.imageryLayer === layer) {
|
|
1599
|
-
if (startIndex === -1) {
|
|
1600
|
-
startIndex = i;
|
|
1601
|
-
}
|
|
1602
|
-
|
|
1603
|
-
tileImagery.freeResources();
|
|
1604
|
-
++numDestroyed;
|
|
1605
|
-
} else if (startIndex !== -1) {
|
|
1606
|
-
// iterated past the section of TileImagerys belonging to this layer, no need to continue.
|
|
1607
|
-
break;
|
|
1608
|
-
}
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
|
-
if (startIndex !== -1) {
|
|
1612
|
-
tileImageryCollection.splice(startIndex, numDestroyed);
|
|
1613
|
-
}
|
|
1614
|
-
});
|
|
1615
|
-
|
|
1616
|
-
if (defined(layer.imageryProvider)) {
|
|
1617
|
-
layer.imageryProvider._reload = undefined;
|
|
1618
|
-
}
|
|
1619
|
-
|
|
1620
|
-
this._imageryLayersUpdatedEvent.raiseEvent();
|
|
1621
|
-
};
|
|
1622
|
-
|
|
1623
|
-
GlobeSurfaceTileProvider.prototype._onLayerMoved = function (
|
|
1624
|
-
layer,
|
|
1625
|
-
newIndex,
|
|
1626
|
-
oldIndex,
|
|
1627
|
-
) {
|
|
1628
|
-
this._layerOrderChanged = true;
|
|
1629
|
-
this._imageryLayersUpdatedEvent.raiseEvent();
|
|
1630
|
-
};
|
|
1631
|
-
|
|
1632
|
-
GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden = function (
|
|
1633
|
-
layer,
|
|
1634
|
-
index,
|
|
1635
|
-
show,
|
|
1636
|
-
) {
|
|
1637
|
-
if (show) {
|
|
1638
|
-
this._onLayerAdded(layer, index);
|
|
1639
|
-
} else {
|
|
1640
|
-
this._onLayerRemoved(layer, index);
|
|
1641
|
-
}
|
|
1642
|
-
};
|
|
1643
|
-
|
|
1644
1734
|
const scratchClippingPlanesMatrix = new Matrix4();
|
|
1645
1735
|
const scratchInverseTransposeClippingPlanesMatrix = new Matrix4();
|
|
1736
|
+
|
|
1737
|
+
/**
|
|
1738
|
+
* @param {FrameState} frameState
|
|
1739
|
+
* @param {GlobeSurfaceTileProvider} globeSurfaceTileProvider
|
|
1740
|
+
* @ignore
|
|
1741
|
+
*/
|
|
1646
1742
|
function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
1647
1743
|
const uniformMap = {
|
|
1648
1744
|
u_initialColor: function () {
|
|
@@ -1823,6 +1919,7 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
1823
1919
|
return frameState.context.defaultTexture;
|
|
1824
1920
|
},
|
|
1825
1921
|
u_clippingExtents: function () {
|
|
1922
|
+
// @ts-expect-error Missing types.
|
|
1826
1923
|
const texture = globeSurfaceTileProvider._clippingPolygons.extentsTexture;
|
|
1827
1924
|
if (defined(texture)) {
|
|
1828
1925
|
return texture;
|
|
@@ -1859,6 +1956,52 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
1859
1956
|
u_vertexShadowDarkness: function () {
|
|
1860
1957
|
return this.properties.vertexShadowDarkness;
|
|
1861
1958
|
},
|
|
1959
|
+
u_vectorSegmentTexture: function () {
|
|
1960
|
+
return (
|
|
1961
|
+
this.properties.vectorSegmentTexture ??
|
|
1962
|
+
frameState.context.defaultTexture
|
|
1963
|
+
);
|
|
1964
|
+
},
|
|
1965
|
+
u_vectorWidthTexture: function () {
|
|
1966
|
+
return (
|
|
1967
|
+
this.properties.vectorWidthTexture ?? frameState.context.defaultTexture
|
|
1968
|
+
);
|
|
1969
|
+
},
|
|
1970
|
+
u_vectorColorTexture: function () {
|
|
1971
|
+
return (
|
|
1972
|
+
this.properties.vectorColorTexture ?? frameState.context.defaultTexture
|
|
1973
|
+
);
|
|
1974
|
+
},
|
|
1975
|
+
u_vectorSegmentPrimitiveIndicesTexture: function () {
|
|
1976
|
+
return (
|
|
1977
|
+
this.properties.vectorSegmentPrimitiveIndicesTexture ??
|
|
1978
|
+
frameState.context.defaultTexture
|
|
1979
|
+
);
|
|
1980
|
+
},
|
|
1981
|
+
u_vectorGridCellIndicesTexture: function () {
|
|
1982
|
+
return (
|
|
1983
|
+
this.properties.vectorGridCellIndicesTexture ??
|
|
1984
|
+
frameState.context.defaultTexture
|
|
1985
|
+
);
|
|
1986
|
+
},
|
|
1987
|
+
u_vectorPolygonEdgeTexture: function () {
|
|
1988
|
+
return (
|
|
1989
|
+
this.properties.vectorPolygonEdgeTexture ??
|
|
1990
|
+
frameState.context.defaultTexture
|
|
1991
|
+
);
|
|
1992
|
+
},
|
|
1993
|
+
u_vectorPolygonEdgePrimitiveIndicesTexture: function () {
|
|
1994
|
+
return (
|
|
1995
|
+
this.properties.vectorPolygonEdgePrimitiveIndicesTexture ??
|
|
1996
|
+
frameState.context.defaultTexture
|
|
1997
|
+
);
|
|
1998
|
+
},
|
|
1999
|
+
u_vectorPolygonGridCellIndicesTexture: function () {
|
|
2000
|
+
return (
|
|
2001
|
+
this.properties.vectorPolygonGridCellIndicesTexture ??
|
|
2002
|
+
frameState.context.defaultTexture
|
|
2003
|
+
);
|
|
2004
|
+
},
|
|
1862
2005
|
|
|
1863
2006
|
// make a separate object so that changes to the properties are seen on
|
|
1864
2007
|
// derived commands that combine another uniform map with this one.
|
|
@@ -1921,6 +2064,15 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
1921
2064
|
undergroundColorAlphaByDistance: new Cartesian4(),
|
|
1922
2065
|
lambertDiffuseMultiplier: 0.0,
|
|
1923
2066
|
vertexShadowDarkness: 0.0,
|
|
2067
|
+
|
|
2068
|
+
vectorSegmentTexture: undefined,
|
|
2069
|
+
vectorWidthTexture: undefined,
|
|
2070
|
+
vectorColorTexture: undefined,
|
|
2071
|
+
vectorSegmentPrimitiveIndicesTexture: undefined,
|
|
2072
|
+
vectorGridCellIndicesTexture: undefined,
|
|
2073
|
+
vectorPolygonEdgeTexture: undefined,
|
|
2074
|
+
vectorPolygonEdgePrimitiveIndicesTexture: undefined,
|
|
2075
|
+
vectorPolygonGridCellIndicesTexture: undefined,
|
|
1924
2076
|
},
|
|
1925
2077
|
};
|
|
1926
2078
|
|
|
@@ -1931,8 +2083,13 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
|
|
|
1931
2083
|
return uniformMap;
|
|
1932
2084
|
}
|
|
1933
2085
|
|
|
1934
|
-
|
|
1935
|
-
|
|
2086
|
+
/**
|
|
2087
|
+
* @param {Context} context
|
|
2088
|
+
* @param {QuadtreeTile} tile
|
|
2089
|
+
* @ignore
|
|
2090
|
+
*/
|
|
2091
|
+
function createWireframeVertexArrayIfNecessary(context, tile) {
|
|
2092
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
1936
2093
|
|
|
1937
2094
|
let mesh;
|
|
1938
2095
|
let vertexArray;
|
|
@@ -2006,8 +2163,22 @@ function createWireframeVertexArray(context, vertexArray, terrainMesh) {
|
|
|
2006
2163
|
});
|
|
2007
2164
|
}
|
|
2008
2165
|
|
|
2166
|
+
/**
|
|
2167
|
+
* @type {Function}
|
|
2168
|
+
* @ignore
|
|
2169
|
+
*/
|
|
2009
2170
|
let getDebugOrientedBoundingBox;
|
|
2171
|
+
|
|
2172
|
+
/**
|
|
2173
|
+
* @type {Function}
|
|
2174
|
+
* @ignore
|
|
2175
|
+
*/
|
|
2010
2176
|
let getDebugBoundingSphere;
|
|
2177
|
+
|
|
2178
|
+
/**
|
|
2179
|
+
* @type {VoidFunction}
|
|
2180
|
+
* @ignore
|
|
2181
|
+
*/
|
|
2011
2182
|
let debugDestroyPrimitive;
|
|
2012
2183
|
|
|
2013
2184
|
(function () {
|
|
@@ -2020,9 +2191,15 @@ let debugDestroyPrimitive;
|
|
|
2020
2191
|
geometry: new SphereOutlineGeometry({ radius: 1.0 }),
|
|
2021
2192
|
});
|
|
2022
2193
|
let modelMatrix = new Matrix4();
|
|
2194
|
+
/** @type {OrientedBoundingBox|BoundingSphere} */
|
|
2023
2195
|
let previousVolume;
|
|
2196
|
+
/** @type {Primitive} */
|
|
2024
2197
|
let primitive;
|
|
2025
2198
|
|
|
2199
|
+
/**
|
|
2200
|
+
* @param {unknown} instance
|
|
2201
|
+
* @returns {Primitive}
|
|
2202
|
+
*/
|
|
2026
2203
|
function createDebugPrimitive(instance) {
|
|
2027
2204
|
return new Primitive({
|
|
2028
2205
|
geometryInstances: instance,
|
|
@@ -2034,6 +2211,10 @@ let debugDestroyPrimitive;
|
|
|
2034
2211
|
});
|
|
2035
2212
|
}
|
|
2036
2213
|
|
|
2214
|
+
/**
|
|
2215
|
+
* @param {OrientedBoundingBox} obb
|
|
2216
|
+
* @param {Color} color
|
|
2217
|
+
*/
|
|
2037
2218
|
getDebugOrientedBoundingBox = function (obb, color) {
|
|
2038
2219
|
if (obb === previousVolume) {
|
|
2039
2220
|
return primitive;
|
|
@@ -2048,6 +2229,7 @@ let debugDestroyPrimitive;
|
|
|
2048
2229
|
);
|
|
2049
2230
|
|
|
2050
2231
|
instanceOBB.modelMatrix = modelMatrix;
|
|
2232
|
+
// @ts-expect-error Missing types.
|
|
2051
2233
|
instanceOBB.attributes.color =
|
|
2052
2234
|
ColorGeometryInstanceAttribute.fromColor(color);
|
|
2053
2235
|
|
|
@@ -2055,6 +2237,11 @@ let debugDestroyPrimitive;
|
|
|
2055
2237
|
return primitive;
|
|
2056
2238
|
};
|
|
2057
2239
|
|
|
2240
|
+
/**
|
|
2241
|
+
* @param {BoundingSphere} sphere
|
|
2242
|
+
* @param {Color} color
|
|
2243
|
+
* @returns {Primitive}
|
|
2244
|
+
*/
|
|
2058
2245
|
getDebugBoundingSphere = function (sphere, color) {
|
|
2059
2246
|
if (sphere === previousVolume) {
|
|
2060
2247
|
return primitive;
|
|
@@ -2070,6 +2257,7 @@ let debugDestroyPrimitive;
|
|
|
2070
2257
|
);
|
|
2071
2258
|
|
|
2072
2259
|
instanceSphere.modelMatrix = modelMatrix;
|
|
2260
|
+
// @ts-expect-error Missing types.
|
|
2073
2261
|
instanceSphere.attributes.color =
|
|
2074
2262
|
ColorGeometryInstanceAttribute.fromColor(color);
|
|
2075
2263
|
|
|
@@ -2087,6 +2275,11 @@ let debugDestroyPrimitive;
|
|
|
2087
2275
|
})();
|
|
2088
2276
|
|
|
2089
2277
|
const otherPassesInitialColor = new Cartesian4(0.0, 0.0, 0.0, 0.0);
|
|
2278
|
+
|
|
2279
|
+
/**
|
|
2280
|
+
* @type {GlobeSurfaceShaderSetOptions}
|
|
2281
|
+
* @ignore
|
|
2282
|
+
*/
|
|
2090
2283
|
const surfaceShaderSetOptionsScratch = {
|
|
2091
2284
|
frameState: undefined,
|
|
2092
2285
|
surfaceTile: undefined,
|
|
@@ -2124,8 +2317,14 @@ const surfaceShaderSetOptionsScratch = {
|
|
|
2124
2317
|
const defaultUndergroundColor = Color.TRANSPARENT;
|
|
2125
2318
|
const defaultUndergroundColorAlphaByDistance = new NearFarScalar();
|
|
2126
2319
|
|
|
2320
|
+
/**
|
|
2321
|
+
* @param {GlobeSurfaceTileProvider} tileProvider
|
|
2322
|
+
* @param {QuadtreeTile} tile
|
|
2323
|
+
* @param {FrameState} frameState
|
|
2324
|
+
* @ignore
|
|
2325
|
+
*/
|
|
2127
2326
|
function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
2128
|
-
const surfaceTile = tile.data;
|
|
2327
|
+
const surfaceTile = /** @type {GlobeSurfaceTile} */ (tile.data);
|
|
2129
2328
|
|
|
2130
2329
|
if (!defined(surfaceTile.vertexArray)) {
|
|
2131
2330
|
if (surfaceTile.fill === undefined) {
|
|
@@ -2151,6 +2350,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2151
2350
|
}
|
|
2152
2351
|
}
|
|
2153
2352
|
|
|
2353
|
+
// @ts-expect-error Missing types.
|
|
2154
2354
|
let maxTextures = ContextLimits.maximumTextureImageUnits;
|
|
2155
2355
|
|
|
2156
2356
|
let waterMaskTexture = surfaceTile.waterMaskTexture;
|
|
@@ -2192,14 +2392,17 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2192
2392
|
const showOceanWaves = showReflectiveOcean && defined(oceanNormalMap);
|
|
2193
2393
|
const terrainProvider = tileProvider.terrainProvider;
|
|
2194
2394
|
const hasVertexNormals =
|
|
2395
|
+
// @ts-expect-error Missing types.
|
|
2195
2396
|
defined(terrainProvider) && tileProvider.terrainProvider.hasVertexNormals;
|
|
2196
2397
|
const enableFog =
|
|
2197
2398
|
frameState.fog.enabled && frameState.fog.renderable && !cameraUnderground;
|
|
2198
2399
|
const showGroundAtmosphere =
|
|
2199
2400
|
tileProvider.showGroundAtmosphere && frameState.mode === SceneMode.SCENE3D;
|
|
2200
2401
|
const castShadows =
|
|
2402
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/issues/13420
|
|
2201
2403
|
ShadowMode.castShadows(tileProvider.shadows) && !translucent;
|
|
2202
2404
|
const receiveShadows =
|
|
2405
|
+
// @ts-expect-error https://github.com/CesiumGS/cesium/issues/13420
|
|
2203
2406
|
ShadowMode.receiveShadows(tileProvider.shadows) && !translucent;
|
|
2204
2407
|
|
|
2205
2408
|
const hueShift = tileProvider.hueShift;
|
|
@@ -2233,6 +2436,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2233
2436
|
}
|
|
2234
2437
|
if (
|
|
2235
2438
|
defined(tileProvider.clippingPlanes) &&
|
|
2439
|
+
// @ts-expect-error Missing types.
|
|
2236
2440
|
tileProvider.clippingPlanes.enabled
|
|
2237
2441
|
) {
|
|
2238
2442
|
--maxTextures;
|
|
@@ -2426,7 +2630,9 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2426
2630
|
++tileProvider._usedDrawCommands;
|
|
2427
2631
|
|
|
2428
2632
|
if (tile === tileProvider._debug.boundingSphereTile) {
|
|
2633
|
+
// @ts-expect-error Missing types.
|
|
2429
2634
|
const obb = tileBoundingRegion.boundingVolume;
|
|
2635
|
+
// @ts-expect-error Missing types.
|
|
2430
2636
|
const boundingSphere = tileBoundingRegion.boundingSphere;
|
|
2431
2637
|
// If a debug primitive already exists for this tile, it will not be
|
|
2432
2638
|
// re-created, to avoid allocation every frame. If it were possible
|
|
@@ -2806,10 +3012,32 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2806
3012
|
uniformMapProperties.clippingPlanesEdgeWidth = clippingPlanes.edgeWidth;
|
|
2807
3013
|
}
|
|
2808
3014
|
|
|
3015
|
+
// update vector collections clamped to terrain
|
|
3016
|
+
const vectorData = surfaceTile.vectorData;
|
|
3017
|
+
if (defined(vectorData)) {
|
|
3018
|
+
uniformMapProperties.vectorSegmentTexture =
|
|
3019
|
+
vectorData.polylineSegmentTexture;
|
|
3020
|
+
uniformMapProperties.vectorWidthTexture = vectorData.widthTexture;
|
|
3021
|
+
uniformMapProperties.vectorColorTexture = vectorData.colorTexture;
|
|
3022
|
+
uniformMapProperties.vectorSegmentPrimitiveIndicesTexture =
|
|
3023
|
+
vectorData.polylineSegmentPrimitiveIndicesTexture;
|
|
3024
|
+
uniformMapProperties.vectorGridCellIndicesTexture =
|
|
3025
|
+
vectorData.polylineGridCellIndicesTexture;
|
|
3026
|
+
uniformMapProperties.vectorPolygonEdgeTexture =
|
|
3027
|
+
vectorData.polygonEdgeTexture;
|
|
3028
|
+
uniformMapProperties.vectorPolygonEdgePrimitiveIndicesTexture =
|
|
3029
|
+
vectorData.polygonEdgePrimitiveIndicesTexture;
|
|
3030
|
+
uniformMapProperties.vectorPolygonGridCellIndicesTexture =
|
|
3031
|
+
vectorData.polygonGridCellIndicesTexture;
|
|
3032
|
+
}
|
|
3033
|
+
|
|
2809
3034
|
// update clipping polygons
|
|
2810
3035
|
const clippingPolygons = tileProvider._clippingPolygons;
|
|
2811
3036
|
const clippingPolygonsEnabled =
|
|
2812
|
-
defined(clippingPolygons) &&
|
|
3037
|
+
defined(clippingPolygons) &&
|
|
3038
|
+
clippingPolygons.enabled &&
|
|
3039
|
+
clippingPolygons.length > 0 &&
|
|
3040
|
+
tile.isClipped;
|
|
2813
3041
|
|
|
2814
3042
|
surfaceShaderSetOptions.numberOfDayTextures = numberOfDayTextures;
|
|
2815
3043
|
surfaceShaderSetOptions.applyBrightness = applyBrightness;
|
|
@@ -2851,7 +3079,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2851
3079
|
command.pass = Pass.GLOBE;
|
|
2852
3080
|
|
|
2853
3081
|
if (tileProvider._debug.wireframe) {
|
|
2854
|
-
createWireframeVertexArrayIfNecessary(context,
|
|
3082
|
+
createWireframeVertexArrayIfNecessary(context, tile);
|
|
2855
3083
|
if (defined(surfaceTile.wireframeVertexArray)) {
|
|
2856
3084
|
command.vertexArray = surfaceTile.wireframeVertexArray;
|
|
2857
3085
|
command.primitiveType = PrimitiveType.LINES;
|
|
@@ -2859,7 +3087,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2859
3087
|
}
|
|
2860
3088
|
}
|
|
2861
3089
|
|
|
2862
|
-
|
|
3090
|
+
const boundingVolume = command.boundingVolume;
|
|
2863
3091
|
const orientedBoundingBox = command.orientedBoundingBox;
|
|
2864
3092
|
|
|
2865
3093
|
if (frameState.mode !== SceneMode.SCENE3D) {
|
|
@@ -2878,7 +3106,8 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2878
3106
|
);
|
|
2879
3107
|
|
|
2880
3108
|
if (frameState.mode === SceneMode.MORPHING) {
|
|
2881
|
-
|
|
3109
|
+
BoundingSphere.union(
|
|
3110
|
+
// @ts-expect-error Missing types.
|
|
2882
3111
|
tileBoundingRegion.boundingSphere,
|
|
2883
3112
|
boundingVolume,
|
|
2884
3113
|
boundingVolume,
|
|
@@ -2886,10 +3115,12 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
|
|
|
2886
3115
|
}
|
|
2887
3116
|
} else {
|
|
2888
3117
|
command.boundingVolume = BoundingSphere.clone(
|
|
3118
|
+
// @ts-expect-error Missing types.
|
|
2889
3119
|
tileBoundingRegion.boundingSphere,
|
|
2890
3120
|
boundingVolume,
|
|
2891
3121
|
);
|
|
2892
3122
|
command.orientedBoundingBox = OrientedBoundingBox.clone(
|
|
3123
|
+
// @ts-expect-error Missing types.
|
|
2893
3124
|
tileBoundingRegion.boundingVolume,
|
|
2894
3125
|
orientedBoundingBox,
|
|
2895
3126
|
);
|