@cesium/engine 26.1.0 → 26.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +764 -520
  2. package/Build/Workers/{chunk-HS6AD4P2.js → chunk-2DKJSPYF.js} +14 -14
  3. package/Build/Workers/{chunk-QVLAFFJY.js → chunk-2PWVICP6.js} +1 -1
  4. package/Build/Workers/{chunk-ILME5BXA.js → chunk-2YY724ZX.js} +8 -8
  5. package/Build/Workers/{chunk-ENNFMWDW.js → chunk-4DMAXPKB.js} +12 -12
  6. package/Build/Workers/{chunk-CDJDJ5LK.js → chunk-4LRFYRBX.js} +2 -2
  7. package/Build/Workers/{chunk-76FDC45O.js → chunk-5JCZHJUU.js} +13 -13
  8. package/Build/Workers/{chunk-5LSOO2KD.js → chunk-5KG7KDDW.js} +7 -7
  9. package/Build/Workers/{chunk-A6X24AZI.js → chunk-6BSNYZZG.js} +5 -5
  10. package/Build/Workers/{chunk-IGAZBTFZ.js → chunk-6R6SGKYN.js} +6 -6
  11. package/Build/Workers/{chunk-SS5ABQGY.js → chunk-6V2KDEHL.js} +4 -4
  12. package/Build/Workers/{chunk-ZMBHFYOX.js → chunk-75BC2IHI.js} +7 -7
  13. package/Build/Workers/{chunk-LGNDTZVX.js → chunk-7SESBH2I.js} +4 -4
  14. package/Build/Workers/{chunk-CLCTQVVL.js → chunk-7WXBTNRV.js} +8 -8
  15. package/Build/Workers/{chunk-WBSY7HDY.js → chunk-A7SMPV6B.js} +12 -12
  16. package/Build/Workers/{chunk-CEEZE3YZ.js → chunk-ATSXKJ3L.js} +7 -7
  17. package/Build/Workers/{chunk-AHWAZRBV.js → chunk-B4AVL7VI.js} +1 -1
  18. package/Build/Workers/{chunk-6HK6IXK2.js → chunk-B7Q2WF6Q.js} +4 -4
  19. package/Build/Workers/{chunk-YKU2Q3A2.js → chunk-BNDSDQ7D.js} +9 -12
  20. package/Build/Workers/{chunk-R4FPNAZ2.js → chunk-CKK6CUXK.js} +9 -9
  21. package/Build/Workers/{chunk-FCP2QY4G.js → chunk-COKOYTRS.js} +5 -5
  22. package/Build/Workers/{chunk-7D2HZKH7.js → chunk-CQ4TZXAT.js} +7 -7
  23. package/Build/Workers/{chunk-TVZD72WJ.js → chunk-DKSANM4A.js} +12 -12
  24. package/Build/Workers/{chunk-FDK4K5IA.js → chunk-DZK34ZVD.js} +1 -1
  25. package/Build/Workers/{chunk-N7CCOFLX.js → chunk-E7G32DWL.js} +1 -1
  26. package/Build/Workers/{chunk-XDWCTQCZ.js → chunk-EDETO6NY.js} +2 -2
  27. package/Build/Workers/{chunk-2EFYUSUY.js → chunk-F34TJJLA.js} +16 -16
  28. package/Build/Workers/{chunk-GXWQZBAI.js → chunk-GLHDTTTO.js} +2 -2
  29. package/Build/Workers/{chunk-T5QBPLE3.js → chunk-GS7RY2DH.js} +11 -11
  30. package/Build/Workers/{chunk-C7JQVRLM.js → chunk-HDD3RFLT.js} +25 -3
  31. package/Build/Workers/{chunk-E7NZJOK7.js → chunk-HDPNFEPP.js} +121 -93
  32. package/Build/Workers/{chunk-VAL7DYNR.js → chunk-JBJ6BRIM.js} +4 -4
  33. package/Build/Workers/{chunk-XQ3SKCMM.js → chunk-JKTWW7IO.js} +5 -5
  34. package/Build/Workers/{chunk-UVO6COT2.js → chunk-JL4NWWQY.js} +5 -5
  35. package/Build/Workers/{chunk-DBD5WWG2.js → chunk-JMUUAW4X.js} +10 -10
  36. package/Build/Workers/{chunk-UEY73NRN.js → chunk-KBGAHN5R.js} +1 -1
  37. package/Build/Workers/{chunk-LD64RPYV.js → chunk-KEWK6VZL.js} +12 -12
  38. package/Build/Workers/{chunk-JW6OZT4R.js → chunk-L73K5UPP.js} +10 -10
  39. package/Build/Workers/{chunk-DIGUUD6G.js → chunk-LL2SGJYH.js} +6 -6
  40. package/Build/Workers/{chunk-XLXSDIP5.js → chunk-LYJUL4XQ.js} +6 -6
  41. package/Build/Workers/{chunk-SM2CDCYF.js → chunk-M6W46OAP.js} +7 -7
  42. package/Build/Workers/{chunk-EHTS2YPT.js → chunk-MDDKCLMF.js} +17 -17
  43. package/Build/Workers/{chunk-FGQFQHN5.js → chunk-MUW4DJV7.js} +18 -18
  44. package/Build/Workers/{chunk-HHV3MCGV.js → chunk-N5YK44FS.js} +5 -5
  45. package/Build/Workers/{chunk-RG4F5R57.js → chunk-NZQUP52G.js} +9 -9
  46. package/Build/Workers/{chunk-B4CQSLZJ.js → chunk-PKZA44LH.js} +6 -6
  47. package/Build/Workers/{chunk-OBEU25PI.js → chunk-Q2JS5LCB.js} +17 -17
  48. package/Build/Workers/{chunk-KGXSYGBG.js → chunk-QTAEVUED.js} +13 -13
  49. package/Build/Workers/{chunk-NIWITKQK.js → chunk-SEJIXZZ4.js} +11 -11
  50. package/Build/Workers/{chunk-SGRGNDOD.js → chunk-SL2HCFYW.js} +10 -10
  51. package/Build/Workers/{chunk-SF6K72D7.js → chunk-SLHK3KAR.js} +5 -5
  52. package/Build/Workers/{chunk-JKXV6PG5.js → chunk-UZY5XRL2.js} +1 -1
  53. package/Build/Workers/{chunk-LNSQVXFH.js → chunk-VRECSMG3.js} +2 -2
  54. package/Build/Workers/{chunk-A3O6EDBK.js → chunk-X27HKF5E.js} +2 -2
  55. package/Build/Workers/{chunk-7KVKHY7O.js → chunk-XBY3354M.js} +6 -6
  56. package/Build/Workers/{chunk-GSWMAFTE.js → chunk-XRZCS3HE.js} +23 -16
  57. package/Build/Workers/{chunk-6YR6JBMY.js → chunk-XSIUYAT6.js} +2 -2
  58. package/Build/Workers/{chunk-ZSGUV73H.js → chunk-Z2DW5NM2.js} +6 -6
  59. package/Build/Workers/combineGeometry.js +24 -24
  60. package/Build/Workers/createBoxGeometry.js +18 -18
  61. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  62. package/Build/Workers/createCircleGeometry.js +26 -26
  63. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  64. package/Build/Workers/createCoplanarPolygonGeometry.js +35 -35
  65. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  66. package/Build/Workers/createCorridorGeometry.js +31 -33
  67. package/Build/Workers/createCorridorOutlineGeometry.js +29 -31
  68. package/Build/Workers/createCylinderGeometry.js +20 -20
  69. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  70. package/Build/Workers/createEllipseGeometry.js +26 -26
  71. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  73. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  74. package/Build/Workers/createFrustumGeometry.js +18 -18
  75. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  76. package/Build/Workers/createGeometry.js +24 -24
  77. package/Build/Workers/createGroundPolylineGeometry.js +24 -24
  78. package/Build/Workers/createPlaneGeometry.js +16 -16
  79. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  80. package/Build/Workers/createPolygonGeometry.js +34 -34
  81. package/Build/Workers/createPolygonOutlineGeometry.js +31 -31
  82. package/Build/Workers/createPolylineGeometry.js +26 -26
  83. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  84. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  85. package/Build/Workers/createRectangleGeometry.js +27 -27
  86. package/Build/Workers/createRectangleOutlineGeometry.js +21 -21
  87. package/Build/Workers/createSimplePolylineGeometry.js +24 -24
  88. package/Build/Workers/createSphereGeometry.js +19 -19
  89. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  90. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  91. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  92. package/Build/Workers/createVectorTileGeometries.js +24 -24
  93. package/Build/Workers/createVectorTilePoints.js +13 -13
  94. package/Build/Workers/createVectorTilePolygons.js +22 -22
  95. package/Build/Workers/createVectorTilePolylines.js +14 -14
  96. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  97. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  98. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  99. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  100. package/Build/Workers/createWallGeometry.js +24 -24
  101. package/Build/Workers/createWallOutlineGeometry.js +24 -24
  102. package/Build/Workers/decodeDraco.js +10 -10
  103. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  104. package/Build/Workers/decodeI3S.js +10 -10
  105. package/Build/Workers/gaussianSplatSorter.js +4 -4
  106. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  107. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  108. package/Build/Workers/transcodeKTX2.js +6 -6
  109. package/Build/Workers/transferTypedArrayTest.js +1 -1
  110. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  111. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  112. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +1 -5
  113. package/Source/Core/BoundingSphere.js +0 -3
  114. package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +3 -4
  115. package/Source/Core/CoplanarPolygonGeometry.js +2 -2
  116. package/Source/Core/CorridorGeometry.js +2 -4
  117. package/Source/Core/CorridorOutlineGeometry.js +1 -3
  118. package/Source/Core/EarthOrientationParameters.js +2 -2
  119. package/Source/Core/EllipseGeometryLibrary.js +2 -2
  120. package/Source/Core/EllipsoidGeodesic.js +3 -3
  121. package/Source/Core/EllipsoidRhumbLine.js +1 -1
  122. package/Source/Core/GroundPolylineGeometry.js +2 -2
  123. package/Source/Core/Heap.js +1 -1
  124. package/Source/Core/HermitePolynomialApproximation.js +215 -179
  125. package/Source/Core/InterpolationAlgorithm.js +1 -0
  126. package/Source/Core/Ion.js +1 -1
  127. package/Source/Core/IonResource.js +5 -0
  128. package/Source/Core/IonSnapGeometryType.js +59 -0
  129. package/Source/Core/IonSnapHeat.js +33 -0
  130. package/Source/Core/IonSnapMode.js +45 -0
  131. package/Source/Core/IonSnapParentGeometryType.js +52 -0
  132. package/Source/Core/IonSnapService.js +369 -0
  133. package/Source/Core/JulianDate.js +1 -1
  134. package/Source/Core/LagrangePolynomialApproximation.js +55 -52
  135. package/Source/Core/LinearApproximation.js +69 -66
  136. package/Source/Core/Math.js +59 -0
  137. package/Source/Core/Matrix2.js +2 -2
  138. package/Source/Core/Matrix3.js +2 -2
  139. package/Source/Core/OrthographicFrustum.js +1 -1
  140. package/Source/Core/PerspectiveFrustum.js +1 -1
  141. package/Source/Core/PolygonGeometry.js +2 -2
  142. package/Source/Core/PolygonGeometryLibrary.js +1 -1
  143. package/Source/Core/PolygonOutlineGeometry.js +1 -1
  144. package/Source/Core/PolylineGeometry.js +1 -1
  145. package/Source/Core/PolylineVolumeGeometryLibrary.js +1 -1
  146. package/Source/Core/Rectangle.js +7 -1
  147. package/Source/Core/RectangleOutlineGeometry.js +1 -1
  148. package/Source/Core/SimplePolylineGeometry.js +1 -1
  149. package/Source/Core/SnapService.js +63 -0
  150. package/Source/Core/TerrainEncoding.js +2 -2
  151. package/Source/Core/TerrainPicker.js +179 -168
  152. package/Source/Core/TimeIntervalCollection.js +1 -3
  153. package/Source/Core/Tipsify.js +1 -1
  154. package/Source/Core/Transforms.js +5 -1
  155. package/Source/Core/VectorPipeline.js +1211 -0
  156. package/Source/Core/VectorProvider.js +669 -0
  157. package/Source/Core/WallOutlineGeometry.js +1 -1
  158. package/Source/Core/getTimestamp.js +4 -2
  159. package/Source/DataSources/CompositeEntityCollection.js +0 -1
  160. package/Source/DataSources/CzmlDataSource.js +2 -0
  161. package/Source/DataSources/DataSourceDisplay.js +1 -1
  162. package/Source/DataSources/GeoJsonDataSource.js +0 -1
  163. package/Source/DataSources/GeometryVisualizer.js +1 -1
  164. package/Source/DataSources/KmlDataSource.js +1 -2
  165. package/Source/DataSources/PolylineVisualizer.js +1 -1
  166. package/Source/DataSources/StaticOutlineGeometryBatch.js +1 -1
  167. package/Source/Renderer/AutomaticUniforms.js +67 -2
  168. package/Source/Renderer/Context.js +9 -3
  169. package/Source/Renderer/DrawCommand.js +22 -0
  170. package/Source/Renderer/Framebuffer.js +4 -0
  171. package/Source/Renderer/Pass.js +11 -10
  172. package/Source/Renderer/ShaderBuilder.js +1 -1
  173. package/Source/Renderer/Texture.js +11 -0
  174. package/Source/Renderer/UniformState.js +54 -1
  175. package/Source/Renderer/VertexArray.js +0 -1
  176. package/Source/Scene/ArcGisMapServerImageryProvider.js +0 -5
  177. package/Source/Scene/ArcGisMapService.js +1 -1
  178. package/Source/Scene/Billboard.js +2 -1
  179. package/Source/Scene/BillboardCollection.js +7 -3
  180. package/Source/Scene/BufferPointCollection.js +4 -7
  181. package/Source/Scene/BufferPolygonCollection.js +56 -27
  182. package/Source/Scene/BufferPolylineCollection.js +61 -8
  183. package/Source/Scene/BufferPolylineMaterial.js +6 -5
  184. package/Source/Scene/BufferPrimitiveCollection.js +226 -34
  185. package/Source/Scene/Camera.js +71 -5
  186. package/Source/Scene/Cesium3DTile.js +12 -0
  187. package/Source/Scene/Cesium3DTileset.js +62 -9
  188. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +15 -3
  189. package/Source/Scene/Cesium3DTilesetCache.js +15 -0
  190. package/Source/Scene/ClippingPlaneCollection.js +2 -2
  191. package/Source/Scene/ClippingPolygon.js +154 -100
  192. package/Source/Scene/ClippingPolygonCollection.js +352 -694
  193. package/Source/Scene/Controllers/Controller.js +63 -0
  194. package/Source/Scene/Controllers/ControllerHost.js +78 -0
  195. package/Source/Scene/Controllers/HybridScreenSpacePanCameraController.js +106 -0
  196. package/Source/Scene/Controllers/MouseButton.js +32 -0
  197. package/Source/Scene/Controllers/ScreenSpaceElevatorCameraController.js +295 -0
  198. package/Source/Scene/Controllers/ScreenSpaceInputBindings.js +154 -0
  199. package/Source/Scene/Controllers/ScreenSpaceMapCameraController.js +310 -0
  200. package/Source/Scene/Controllers/ScreenSpaceTiltOrbitCameraController.js +642 -0
  201. package/Source/Scene/Controllers/ScreenSpaceZoomCameraController.js +431 -0
  202. package/Source/Scene/Controllers/defaultPickWorldPosition.js +84 -0
  203. package/Source/Scene/CreditDisplay.js +62 -0
  204. package/Source/Scene/DerivedCommand.js +94 -0
  205. package/Source/Scene/EdgeFramebuffer.js +1 -5
  206. package/Source/Scene/FrameState.js +17 -0
  207. package/Source/Scene/GeoJsonPrimitive.js +114 -24
  208. package/Source/Scene/Globe.js +20 -0
  209. package/Source/Scene/GlobeDepth.js +27 -1
  210. package/Source/Scene/GlobeSurfaceShaderSet.js +42 -53
  211. package/Source/Scene/GlobeSurfaceTile.js +61 -10
  212. package/Source/Scene/GlobeSurfaceTileProvider.js +351 -26
  213. package/Source/Scene/GltfLoader.js +88 -9
  214. package/Source/Scene/GltfSpzLoader.js +1 -1
  215. package/Source/Scene/GltfVertexBufferLoader.js +6 -3
  216. package/Source/Scene/HeightReference.js +1 -1
  217. package/Source/Scene/I3SDataProvider.js +1 -1
  218. package/Source/Scene/I3SLayer.js +1 -1
  219. package/Source/Scene/I3SNode.js +2 -2
  220. package/Source/Scene/ImageryLayerCollection.js +188 -4
  221. package/Source/Scene/IonImageryProvider.js +1 -5
  222. package/Source/Scene/Label.js +4 -4
  223. package/Source/Scene/LabelCollection.js +1 -1
  224. package/Source/Scene/MVTDataProvider.js +11 -0
  225. package/Source/Scene/Model/B3dmLoader.js +1 -2
  226. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +10 -8
  227. package/Source/Scene/Model/I3dmLoader.js +1 -1
  228. package/Source/Scene/Model/InstancingPipelineStage.js +4 -7
  229. package/Source/Scene/Model/MaterialPipelineStage.js +124 -1
  230. package/Source/Scene/Model/Model.js +250 -26
  231. package/Source/Scene/Model/Model3DTileContent.js +5 -0
  232. package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +28 -1
  233. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +54 -19
  234. package/Source/Scene/Model/ModelDrawCommand.js +160 -16
  235. package/Source/Scene/Model/ModelDrawCommands.js +4 -0
  236. package/Source/Scene/Model/ModelRenderResources.js +2 -3
  237. package/Source/Scene/Model/ModelSceneGraph.js +31 -1
  238. package/Source/Scene/Model/ModelVectorLookupPipelineStage.js +205 -0
  239. package/Source/Scene/Model/PickingPipelineStage.js +33 -0
  240. package/Source/Scene/Model/PrimitiveRenderResources.js +24 -0
  241. package/Source/Scene/ModelComponents.js +71 -0
  242. package/Source/Scene/Picking.js +16 -5
  243. package/Source/Scene/PlanarFillIdFramebuffer.js +172 -0
  244. package/Source/Scene/PntsParser.js +0 -1
  245. package/Source/Scene/PolylineCollection.js +1 -1
  246. package/Source/Scene/PostProcessStage.js +26 -5
  247. package/Source/Scene/ResourceCache.js +7 -4
  248. package/Source/Scene/ResourceCacheKey.js +16 -13
  249. package/Source/Scene/Scene.js +258 -6
  250. package/Source/Scene/ScreenSpaceCameraController.js +1 -2
  251. package/Source/Scene/ShadowMap.js +9 -3
  252. package/Source/Scene/ShadowMapShader.js +50 -2
  253. package/Source/Scene/SnapFramebuffer.js +121 -0
  254. package/Source/Scene/Snapping.js +241 -0
  255. package/Source/Scene/TerrainFillMesh.js +3 -2
  256. package/Source/Scene/UrlTemplate3DTilesDataProvider.js +13 -2
  257. package/Source/Scene/Vector3DTileContent.js +2 -3
  258. package/Source/Scene/VectorGltf3DTileContent.js +31 -3
  259. package/Source/Scene/View.js +10 -8
  260. package/Source/Scene/VoxelTraversal.js +1 -1
  261. package/Source/Scene/WebMapServiceImageryProvider.js +5 -1
  262. package/Source/Scene/WebMapTileServiceImageryProvider.js +6 -1
  263. package/Source/Scene/createElevationBandMaterial.js +1 -1
  264. package/Source/Scene/renderBufferPointCollection.js +1 -2
  265. package/Source/Scene/renderBufferPolygonCollection.js +1 -2
  266. package/Source/Scene/renderBufferPolylineCollection.js +6 -3
  267. package/Source/Shaders/BufferPolylineMaterialVS.glsl +14 -2
  268. package/Source/Shaders/BufferPolylineMaterialVS.js +14 -2
  269. package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
  270. package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
  271. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
  272. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
  273. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
  274. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
  275. package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.glsl +9 -0
  276. package/Source/Shaders/Builtin/Constants/passCesium3DTilePlanarFillId.js +11 -0
  277. package/Source/Shaders/Builtin/Constants/passClassification.glsl +1 -1
  278. package/Source/Shaders/Builtin/Constants/passClassification.js +1 -1
  279. package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
  280. package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
  281. package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
  282. package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
  283. package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
  284. package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
  285. package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
  286. package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
  287. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -4
  288. package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.glsl +74 -0
  289. package/Source/Shaders/Builtin/Functions/eyeToCartographicDelta.js +76 -0
  290. package/Source/Shaders/GlobeFS.glsl +20 -14
  291. package/Source/Shaders/GlobeFS.js +20 -14
  292. package/Source/Shaders/GlobeVS.glsl +0 -32
  293. package/Source/Shaders/GlobeVS.js +0 -32
  294. package/Source/Shaders/Materials/PolylineGlowMaterial.glsl +1 -1
  295. package/Source/Shaders/Materials/PolylineGlowMaterial.js +1 -1
  296. package/Source/Shaders/Model/MaterialStageFS.glsl +8 -2
  297. package/Source/Shaders/Model/MaterialStageFS.js +8 -2
  298. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +15 -3
  299. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +15 -3
  300. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +20 -24
  301. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +20 -24
  302. package/Source/Shaders/Model/ModelFS.glsl +109 -0
  303. package/Source/Shaders/Model/ModelFS.js +109 -0
  304. package/Source/Shaders/Model/ModelVS.glsl +7 -2
  305. package/Source/Shaders/Model/ModelVS.js +7 -2
  306. package/Source/Shaders/Model/ModelVectorLookupStageFS.glsl +6 -0
  307. package/Source/Shaders/Model/ModelVectorLookupStageFS.js +8 -0
  308. package/Source/Shaders/Model/ModelVectorLookupStageVS.glsl +15 -0
  309. package/Source/Shaders/Model/ModelVectorLookupStageVS.js +17 -0
  310. package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +9 -10
  311. package/Source/Shaders/Model/VerticalExaggerationStageVS.js +9 -11
  312. package/Source/Shaders/VectorCommon.glsl +305 -0
  313. package/Source/Shaders/VectorCommon.js +307 -0
  314. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
  315. package/Source/ThirdParty/zip-module.wasm +0 -0
  316. package/Source/Widget/CesiumWidget.js +30 -0
  317. package/index.d.ts +1326 -65
  318. package/index.js +179 -155
  319. package/package.json +6 -6
  320. package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +0 -37
  321. package/Source/Shaders/Builtin/Functions/clipPolygons.js +0 -39
  322. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +0 -14
  323. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +0 -15
  324. package/Source/Shaders/PolygonSignedDistanceFS.glsl +0 -131
  325. package/Source/Shaders/PolygonSignedDistanceFS.js +0 -132
@@ -438,6 +438,16 @@ function Cesium3DTile(tileset, baseResource, header, parent) {
438
438
  */
439
439
  this.clippingPolygonsDirty = false;
440
440
 
441
+ /**
442
+ * Tracks if the tileset's ClippingPolygonCollection's geometry changed (a polygon was added or removed),
443
+ * which requires the tile's content to rebake its clipping textures.
444
+ *
445
+ * @type {boolean}
446
+ *
447
+ * @private
448
+ */
449
+ this.clippingPolygonsNeedRebake = false;
450
+
441
451
  /**
442
452
  * Tracks if the tile's request should be deferred until all non-deferred
443
453
  * tiles load.
@@ -1483,6 +1493,7 @@ Cesium3DTile.prototype.unloadContent = function () {
1483
1493
  this._clippingPlanesState = 0;
1484
1494
  this.clippingPolygonsDirty = this._clippingPolygonsState === 0;
1485
1495
  this._clippingPolygonsState = 0;
1496
+ this.clippingPolygonsNeedRebake = false;
1486
1497
 
1487
1498
  this._debugColorizeTiles = false;
1488
1499
 
@@ -2315,6 +2326,7 @@ Cesium3DTile.prototype.update = function (tileset, frameState, passOptions) {
2315
2326
 
2316
2327
  this.clippingPlanesDirty = false; // reset after content update
2317
2328
  this.clippingPolygonsDirty = false;
2329
+ this.clippingPolygonsNeedRebake = false;
2318
2330
  };
2319
2331
 
2320
2332
  const scratchCommandList = [];
@@ -11,6 +11,7 @@ import Frozen from "../Core/Frozen.js";
11
11
  import defined from "../Core/defined.js";
12
12
  import deprecationWarning from "../Core/deprecationWarning.js";
13
13
  import destroyObject from "../Core/destroyObject.js";
14
+ import DeveloperError from "../Core/DeveloperError.js";
14
15
  import Ellipsoid from "../Core/Ellipsoid.js";
15
16
  import Event from "../Core/Event.js";
16
17
  import ImageBasedLighting from "./ImageBasedLighting.js";
@@ -44,6 +45,7 @@ import ClippingPlaneCollection from "./ClippingPlaneCollection.js";
44
45
  import ClippingPolygonCollection from "./ClippingPolygonCollection.js";
45
46
  import EdgeDisplayMode from "./EdgeDisplayMode.js";
46
47
  import hasExtension from "./hasExtension.js";
48
+ import { isHeightReferenceClamp } from "./HeightReference.js";
47
49
  import ImplicitTileset from "./ImplicitTileset.js";
48
50
  import ImplicitTileCoordinates from "./ImplicitTileCoordinates.js";
49
51
  import LabelCollection from "./LabelCollection.js";
@@ -103,7 +105,7 @@ import ImageryLayerCollection from "./ImageryLayerCollection.js";
103
105
  * @property {ClippingPlaneCollection} [clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the tileset.
104
106
  * @property {ClippingPolygonCollection} [clippingPolygons] The {@link ClippingPolygonCollection} used to selectively disable rendering the tileset.
105
107
  * @property {ClassificationType} [classificationType] Determines whether terrain, 3D Tiles or both will be classified by this tileset. See {@link Cesium3DTileset#classificationType} for details about restrictions and limitations.
106
- * @property {HeightReference} [heightReference] Sets the {@link HeightReference} for point features in vector tilesets.
108
+ * @property {HeightReference} [heightReference] Sets the {@link HeightReference} for features in vector tilesets.
107
109
  * @property {Scene} [scene] The {@link CesiumWidget#scene} that the tileset will be rendered in, required for tilesets that specify a {@link heightReference} value for clamping 3D Tiles vector data content- like points, lines, and labels- to terrain or 3D tiles.
108
110
  * @property {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid determining the size and shape of the globe.
109
111
  * @property {object} [pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation based on geometric error and lighting.
@@ -153,6 +155,7 @@ import ImageryLayerCollection from "./ImageryLayerCollection.js";
153
155
  * @param {Cesium3DTileset.ConstructorOptions} options An object describing initialization options
154
156
  *
155
157
  * @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0.
158
+ * @exception {DeveloperError} Height reference is not supported without a scene.
156
159
  *
157
160
  * @example
158
161
  * try {
@@ -343,6 +346,14 @@ function Cesium3DTileset(options) {
343
346
  this._heightReference = options.heightReference;
344
347
  this._scene = options.scene;
345
348
 
349
+ //>>includeStart('debug', pragmas.debug);
350
+ if (isHeightReferenceClamp(this._heightReference) && !defined(this._scene)) {
351
+ throw new DeveloperError(
352
+ "Height reference is not supported without a scene.",
353
+ );
354
+ }
355
+ //>>includeEnd('debug');
356
+
346
357
  this._ellipsoid = options.ellipsoid ?? Ellipsoid.WGS84;
347
358
 
348
359
  this._initialClippingPlanesOriginMatrix = Matrix4.IDENTITY; // Computed from the tileset JSON.
@@ -856,12 +867,16 @@ function Cesium3DTileset(options) {
856
867
  }
857
868
 
858
869
  this._clippingPolygons = undefined;
870
+ this._clippingPolygonsNeedRebake = false;
871
+ this._removeClippingPolygonAdded = undefined;
872
+ this._removeClippingPolygonRemoved = undefined;
859
873
  if (defined(options.clippingPolygons)) {
860
874
  ClippingPolygonCollection.setOwner(
861
875
  options.clippingPolygons,
862
876
  this,
863
877
  "_clippingPolygons",
864
878
  );
879
+ updateTilesetClippingPolygonListeners(this);
865
880
  }
866
881
 
867
882
  if (defined(options.imageBasedLighting)) {
@@ -1193,6 +1208,8 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1193
1208
  },
1194
1209
  set: function (value) {
1195
1210
  ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
1211
+ updateTilesetClippingPolygonListeners(this);
1212
+ this._clippingPolygonsNeedRebake = true;
1196
1213
  },
1197
1214
  },
1198
1215
 
@@ -2693,6 +2710,34 @@ Cesium3DTileset.prototype.postPassesUpdate = function (frameState) {
2693
2710
  this._styleApplied = false;
2694
2711
  };
2695
2712
 
2713
+ /**
2714
+ * Subscribes the owning tileset to its clipping polygon add/remove events so
2715
+ * tile content can rebake clipping textures when the geometry changes.
2716
+ * @private
2717
+ * @param {Cesium3DTileset} tileset
2718
+ */
2719
+ function updateTilesetClippingPolygonListeners(tileset) {
2720
+ tileset._removeClippingPolygonAdded =
2721
+ tileset._removeClippingPolygonAdded &&
2722
+ tileset._removeClippingPolygonAdded();
2723
+ tileset._removeClippingPolygonRemoved =
2724
+ tileset._removeClippingPolygonRemoved &&
2725
+ tileset._removeClippingPolygonRemoved();
2726
+
2727
+ const clippingPolygons = tileset._clippingPolygons;
2728
+ if (!defined(clippingPolygons)) {
2729
+ return;
2730
+ }
2731
+
2732
+ const markDirty = () => {
2733
+ tileset._clippingPolygonsNeedRebake = true;
2734
+ };
2735
+ tileset._removeClippingPolygonAdded =
2736
+ clippingPolygons.polygonAdded.addEventListener(markDirty);
2737
+ tileset._removeClippingPolygonRemoved =
2738
+ clippingPolygons.polygonRemoved.addEventListener(markDirty);
2739
+ }
2740
+
2696
2741
  /**
2697
2742
  * Perform any pass invariant tasks here. Called before any passes are executed.
2698
2743
  * @ignore
@@ -2718,6 +2763,15 @@ Cesium3DTileset.prototype.prePassesUpdate = function (frameState) {
2718
2763
  clippingPolygons.update(frameState);
2719
2764
  }
2720
2765
 
2766
+ // After a polygon add/remove, mark loaded tiles so their content rebakes
2767
+ // clipping textures. Done once per frame to dedupe multiple changes.
2768
+ if (this._clippingPolygonsNeedRebake) {
2769
+ this._clippingPolygonsNeedRebake = false;
2770
+ this._cache.forEachLoadedTile((tile) => {
2771
+ tile.clippingPolygonsNeedRebake = true;
2772
+ });
2773
+ }
2774
+
2721
2775
  if (!defined(this._loadTimestamp)) {
2722
2776
  this._loadTimestamp = JulianDate.clone(frameState.time);
2723
2777
  }
@@ -3579,12 +3633,6 @@ Cesium3DTileset.prototype.updateForPass = function (
3579
3633
  environmentMapManager.update(frameState);
3580
3634
  }
3581
3635
 
3582
- // Update clipping polygons
3583
- const clippingPolygons = this._clippingPolygons;
3584
- if (defined(clippingPolygons) && clippingPolygons.enabled) {
3585
- clippingPolygons.queueCommands(frameState);
3586
- }
3587
-
3588
3636
  const passStatistics = this._statisticsPerPass[pass];
3589
3637
 
3590
3638
  if (this.show || ignoreCommands) {
@@ -3652,9 +3700,14 @@ Cesium3DTileset.prototype.isDestroyed = function () {
3652
3700
  Cesium3DTileset.prototype.destroy = function () {
3653
3701
  this._tileDebugLabels =
3654
3702
  this._tileDebugLabels && this._tileDebugLabels.destroy();
3703
+
3704
+ this._removeClippingPolygonAdded =
3705
+ this._removeClippingPolygonAdded && this._removeClippingPolygonAdded();
3706
+ this._removeClippingPolygonRemoved =
3707
+ this._removeClippingPolygonRemoved && this._removeClippingPolygonRemoved();
3708
+
3655
3709
  this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
3656
- this._clippingPolygons =
3657
- this._clippingPolygons && this._clippingPolygons.destroy();
3710
+ this._clippingPolygons = undefined;
3658
3711
 
3659
3712
  // Traverse the tree and destroy all tiles
3660
3713
  if (defined(this._root)) {
@@ -247,6 +247,13 @@ function executeTraversal(root, frameState) {
247
247
  function executeEmptyTraversal(root, frameState) {
248
248
  const { canTraverse, updateTile, loadTile, touchTile } =
249
249
  Cesium3DTilesetTraversal;
250
+ // Vector tilesets opt into relaxed empty-tile refinement so empty regions reached
251
+ // through implicit or external placeholders do not block their content siblings.
252
+ // Note: it's likely we don't need to limit this behavior to vector tilesets. However,
253
+ // we are being cautious of breaking changes to existing tilesets.
254
+ const isVectorTileset = root.tileset.hasExtension(
255
+ "3DTILES_content_gltf_vector",
256
+ );
250
257
  let allDescendantsLoaded = true;
251
258
  const stack = emptyTraversal.stack;
252
259
  stack.push(root);
@@ -264,9 +271,14 @@ function executeEmptyTraversal(root, frameState) {
264
271
  // Only traverse if the tile is empty - traversal stops at descendants with content
265
272
  const traverse = !tile.hasRenderableContent && canTraverse(tile);
266
273
 
267
- // Traversal stops but the tile does not have content yet
268
- // There will be holes if the parent tries to refine to its children, so don't refine
269
- if (!traverse && !tile.contentAvailable) {
274
+ // For vector tilesets only unloaded renderable content blocks refinement, so an empty
275
+ // tile at its resolved level of detail does not hold back its content siblings,
276
+ // including across implicit or external placeholders. All other tilesets keep the
277
+ // original behavior of blocking whenever traversal stops without content available.
278
+ const blocksRefinement = isVectorTileset
279
+ ? tile.hasRenderableContent
280
+ : !traverse;
281
+ if (blocksRefinement && !tile.contentAvailable) {
270
282
  allDescendantsLoaded = false;
271
283
  }
272
284
 
@@ -34,6 +34,21 @@ Cesium3DTilesetCache.prototype.add = function (tile) {
34
34
  }
35
35
  };
36
36
 
37
+ /**
38
+ * Invokes the callback for each tile with loaded content in the cache.
39
+ *
40
+ * @param {Function} callback A function that takes a {@link Cesium3DTile}.
41
+ * @private
42
+ */
43
+ Cesium3DTilesetCache.prototype.forEachLoadedTile = function (callback) {
44
+ for (let node = this._list.head; defined(node); node = node.next) {
45
+ // The sentinel node has no item.
46
+ if (defined(node.item)) {
47
+ callback(node.item);
48
+ }
49
+ }
50
+ };
51
+
37
52
  Cesium3DTilesetCache.prototype.unloadTile = function (
38
53
  tileset,
39
54
  tile,
@@ -545,8 +545,8 @@ ClippingPlaneCollection.prototype.update = function (frameState) {
545
545
  }
546
546
  if (!this._multipleDirtyPlanes) {
547
547
  // partial updates possible
548
- let offsetX = 0;
549
- let offsetY = 0;
548
+ let offsetX;
549
+ let offsetY;
550
550
  if (useFloatTexture) {
551
551
  offsetY = Math.floor(dirtyIndex / clippingPlanesTexture.width);
552
552
  offsetX = Math.floor(dirtyIndex - offsetY * clippingPlanesTexture.width);
@@ -1,9 +1,8 @@
1
1
  import Check from "../Core/Check.js";
2
2
  import Cartesian3 from "../Core/Cartesian3.js";
3
- import Cartographic from "../Core/Cartographic.js";
4
3
  import defined from "../Core/defined.js";
4
+ import deprecationWarning from "../Core/deprecationWarning.js";
5
5
  import Ellipsoid from "../Core/Ellipsoid.js";
6
- import CesiumMath from "../Core/Math.js";
7
6
  import PolygonGeometry from "../Core/PolygonGeometry.js";
8
7
  import Rectangle from "../Core/Rectangle.js";
9
8
 
@@ -14,6 +13,7 @@ import Rectangle from "../Core/Rectangle.js";
14
13
  *
15
14
  * @param {object} options Object with the following properties:
16
15
  * @param {Cartesian3[]} options.positions A list of three or more Cartesian coordinates defining the outer ring of the clipping polygon.
16
+ * @param {Cartesian3[][]} [options.holes] An array of interior rings (holes), each a list of three or more Cartesian coordinates. Regions inside a hole are excluded from the polygon.
17
17
  * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.default]
18
18
  *
19
19
  * @example
@@ -33,6 +33,34 @@ import Rectangle from "../Core/Rectangle.js";
33
33
  * const polygon = new Cesium.ClippingPolygon({
34
34
  * positions: positions
35
35
  * });
36
+ *
37
+ * @example
38
+ * // A clipping polygon with two holes. Regions inside the holes are not clipped.
39
+ * const outerRing = Cesium.Cartesian3.fromDegreesArray([
40
+ * -100.0, 40.0,
41
+ * -90.0, 40.0,
42
+ * -90.0, 50.0,
43
+ * -100.0, 50.0,
44
+ * ]);
45
+ *
46
+ * const firstHole = Cesium.Cartesian3.fromDegreesArray([
47
+ * -98.0, 42.0,
48
+ * -96.0, 42.0,
49
+ * -96.0, 44.0,
50
+ * -98.0, 44.0,
51
+ * ]);
52
+ *
53
+ * const secondHole = Cesium.Cartesian3.fromDegreesArray([
54
+ * -94.0, 46.0,
55
+ * -92.0, 46.0,
56
+ * -92.0, 48.0,
57
+ * -94.0, 48.0,
58
+ * ]);
59
+ *
60
+ * const polygonWithHoles = new Cesium.ClippingPolygon({
61
+ * positions: outerRing,
62
+ * holes: [firstHole, secondHole],
63
+ * });
36
64
  */
37
65
  function ClippingPolygon(options) {
38
66
  //>>includeStart('debug', pragmas.debug);
@@ -43,35 +71,38 @@ function ClippingPolygon(options) {
43
71
  options.positions.length,
44
72
  3,
45
73
  );
74
+ if (defined(options.holes)) {
75
+ for (let i = 0; i < options.holes.length; i++) {
76
+ Check.typeOf.number.greaterThanOrEquals(
77
+ `options.holes[${i}].length`,
78
+ options.holes[i].length,
79
+ 3,
80
+ );
81
+ }
82
+ }
46
83
  //>>includeEnd('debug');
47
84
 
48
85
  this._ellipsoid = options.ellipsoid ?? Ellipsoid.default;
49
86
  this._positions = copyArrayCartesian3(options.positions);
87
+ this._holes = defined(options.holes)
88
+ ? options.holes.map(copyArrayCartesian3)
89
+ : [];
50
90
 
51
91
  /**
52
- * A copy of the input positions.
53
- *
54
- * This is used to detect modifications of the positions in
55
- * <code>coputeRectangle</code>: The rectangle only has
56
- * to be re-computed when these positions have changed.
92
+ * The cartographic rectangle enclosing the outer ring
57
93
  *
58
- * @type {Cartesian3[]|undefined}
94
+ * @type {Rectangle}
59
95
  * @private
60
96
  */
61
- this._cachedPositions = undefined;
97
+ this._rectangle = PolygonGeometry.computeRectangleFromPositions(
98
+ this._positions,
99
+ this._ellipsoid,
100
+ );
62
101
 
63
- /**
64
- * A cached version of the rectangle that is computed in
65
- * <code>computeRectangle</code>.
66
- *
67
- * This is only re-computed when the positions have changed, as
68
- * determined by comparing the <code>_positions</code> to the
69
- * <code>_cachedPositions</code>
70
- *
71
- * @type {Rectangle|undefined}
72
- * @private
73
- */
74
- this._cachedRectangle = undefined;
102
+ // Freeze the geometry so it cannot change after construction. To change a
103
+ // polygon, remove it from the collection and add a new one.
104
+ deepFreeze(this._positions);
105
+ deepFreezeHoles(this._holes);
75
106
  }
76
107
 
77
108
  /**
@@ -98,6 +129,35 @@ function copyArrayCartesian3(input) {
98
129
  return output;
99
130
  }
100
131
 
132
+ /**
133
+ * Freezes an array of positions and each Cartesian3 it contains, so that the
134
+ * polygon's geometry cannot be mutated in place. Returns the same array.
135
+ *
136
+ * @param {Cartesian3[]} positions The array to freeze
137
+ * @returns {Cartesian3[]} The frozen array
138
+ * @ignore
139
+ */
140
+ function deepFreeze(positions) {
141
+ for (let i = 0; i < positions.length; i++) {
142
+ Object.freeze(positions[i]);
143
+ }
144
+ return Object.freeze(positions);
145
+ }
146
+
147
+ /**
148
+ * Freezes an array of rings (holes) and their contents. Returns the same array.
149
+ *
150
+ * @param {Cartesian3[][]} holes The rings to freeze
151
+ * @returns {Cartesian3[][]} The frozen array
152
+ * @ignore
153
+ */
154
+ function deepFreezeHoles(holes) {
155
+ for (let i = 0; i < holes.length; i++) {
156
+ deepFreeze(holes[i]);
157
+ }
158
+ return Object.freeze(holes);
159
+ }
160
+
101
161
  /**
102
162
  * Returns whether the given arrays are component-wise equal.
103
163
  *
@@ -134,9 +194,29 @@ function equalsArrayCartesian3(a, b) {
134
194
  return true;
135
195
  }
136
196
 
197
+ /**
198
+ * Returns whether two arrays of rings are component-wise equal.
199
+ *
200
+ * @param {Cartesian3[][]} a The first array of rings
201
+ * @param {Cartesian3[][]} b The second array of rings
202
+ * @returns {boolean} Whether the ring arrays are equal
203
+ * @ignore
204
+ */
205
+ function equalsHoles(a, b) {
206
+ if (a.length !== b.length) {
207
+ return false;
208
+ }
209
+ for (let i = 0; i < a.length; i++) {
210
+ if (!equalsArrayCartesian3(a[i], b[i])) {
211
+ return false;
212
+ }
213
+ }
214
+ return true;
215
+ }
216
+
137
217
  Object.defineProperties(ClippingPolygon.prototype, {
138
218
  /**
139
- * Returns the total number of positions in the polygon, include any holes.
219
+ * Returns the total number of positions in the polygon, including any holes.
140
220
  *
141
221
  * @memberof ClippingPolygon.prototype
142
222
  * @type {number}
@@ -144,11 +224,17 @@ Object.defineProperties(ClippingPolygon.prototype, {
144
224
  */
145
225
  length: {
146
226
  get: function () {
147
- return this._positions.length;
227
+ let count = this._positions.length;
228
+ const holes = this._holes;
229
+ for (let i = 0; i < holes.length; i++) {
230
+ count += holes[i].length;
231
+ }
232
+ return count;
148
233
  },
149
234
  },
150
235
  /**
151
- * Returns the outer ring of positions.
236
+ * Returns the outer ring of positions. A ClippingPolygon's geometry is
237
+ * immutable; the returned array and its coordinates are frozen.
152
238
  *
153
239
  * @memberof ClippingPolygon.prototype
154
240
  * @type {Cartesian3[]}
@@ -159,6 +245,18 @@ Object.defineProperties(ClippingPolygon.prototype, {
159
245
  return this._positions;
160
246
  },
161
247
  },
248
+ /**
249
+ * Returns the interior rings (holes) of the polygon, each a list of positions.
250
+ *
251
+ * @memberof ClippingPolygon.prototype
252
+ * @type {Cartesian3[][]}
253
+ * @readonly
254
+ */
255
+ holes: {
256
+ get: function () {
257
+ return this._holes;
258
+ },
259
+ },
162
260
  /**
163
261
  * Returns the ellipsoid used to project the polygon onto surfaces when clipping.
164
262
  *
@@ -171,6 +269,20 @@ Object.defineProperties(ClippingPolygon.prototype, {
171
269
  return this._ellipsoid;
172
270
  },
173
271
  },
272
+ /**
273
+ * Returns the cartographic rectangle enclosing the polygon, computed once on
274
+ * construction. Since a ClippingPolygon's geometry is immutable, this rectangle
275
+ * never changes.
276
+ *
277
+ * @memberof ClippingPolygon.prototype
278
+ * @type {Rectangle}
279
+ * @readonly
280
+ */
281
+ rectangle: {
282
+ get: function () {
283
+ return this._rectangle;
284
+ },
285
+ },
174
286
  });
175
287
 
176
288
  /**
@@ -187,13 +299,20 @@ ClippingPolygon.clone = function (polygon, result) {
187
299
  if (!defined(result)) {
188
300
  return new ClippingPolygon({
189
301
  positions: polygon.positions,
302
+ holes: polygon.holes,
190
303
  ellipsoid: polygon.ellipsoid,
191
304
  });
192
305
  }
193
306
 
194
307
  result._ellipsoid = polygon.ellipsoid;
195
- result._positions.length = 0;
196
- result._positions.push(...polygon.positions);
308
+ result._positions = copyArrayCartesian3(polygon.positions);
309
+ result._holes = polygon.holes.map(copyArrayCartesian3);
310
+ result._rectangle = PolygonGeometry.computeRectangleFromPositions(
311
+ result._positions,
312
+ result._ellipsoid,
313
+ );
314
+ deepFreeze(result._positions);
315
+ deepFreezeHoles(result._holes);
197
316
  return result;
198
317
  };
199
318
 
@@ -212,7 +331,9 @@ ClippingPolygon.equals = function (left, right) {
212
331
  //>>includeEnd('debug');
213
332
 
214
333
  return (
215
- left.ellipsoid.equals(right.ellipsoid) && left.positions === right.positions
334
+ left.ellipsoid.equals(right.ellipsoid) &&
335
+ left.positions === right.positions &&
336
+ equalsHoles(left.holes, right.holes)
216
337
  );
217
338
  };
218
339
 
@@ -221,82 +342,15 @@ ClippingPolygon.equals = function (left, right) {
221
342
  *
222
343
  * @param {Rectangle} [result] An object in which to store the result.
223
344
  * @returns {Rectangle} The result rectangle
224
- */
225
- ClippingPolygon.prototype.computeRectangle = function (result) {
226
- if (equalsArrayCartesian3(this._positions, this._cachedPositions)) {
227
- return Rectangle.clone(this._cachedRectangle, result);
228
- }
229
- const rectangle = PolygonGeometry.computeRectangleFromPositions(
230
- this.positions,
231
- this.ellipsoid,
232
- undefined,
233
- result,
234
- );
235
- this._cachedPositions = copyArrayCartesian3(this._positions);
236
- this._cachedRectangle = Rectangle.clone(rectangle);
237
- return rectangle;
238
- };
239
-
240
- const scratchRectangle = new Rectangle();
241
- const spherePointScratch = new Cartesian3();
242
- /**
243
- * Computes a rectangle with the spherical extents that encloses the polygon defined by the list of positions, including cases over the international date line and the poles.
244
- *
245
- * @private
246
345
  *
247
- * @param {Rectangle} [result] An object in which to store the result.
248
- * @returns {Rectangle} The result rectangle with spherical extents.
346
+ * @deprecated This function is deprecated and will be removed in CesiumJS 1.147. Use {@link ClippingPolygon#rectangle} instead.
249
347
  */
250
- ClippingPolygon.prototype.computeSphericalExtents = function (result) {
251
- if (!defined(result)) {
252
- result = new Rectangle();
253
- }
254
-
255
- const rectangle = this.computeRectangle(scratchRectangle);
256
-
257
- let spherePoint = Cartographic.toCartesian(
258
- Rectangle.southwest(rectangle),
259
- this.ellipsoid,
260
- spherePointScratch,
261
- );
262
-
263
- // Project into plane with vertical for latitude
264
- let magXY = Math.sqrt(
265
- spherePoint.x * spherePoint.x + spherePoint.y * spherePoint.y,
266
- );
267
-
268
- // Use fastApproximateAtan2 for alignment with shader
269
- let sphereLatitude = CesiumMath.fastApproximateAtan2(magXY, spherePoint.z);
270
- let sphereLongitude = CesiumMath.fastApproximateAtan2(
271
- spherePoint.x,
272
- spherePoint.y,
273
- );
274
-
275
- result.south = sphereLatitude;
276
- result.west = sphereLongitude;
277
-
278
- spherePoint = Cartographic.toCartesian(
279
- Rectangle.northeast(rectangle),
280
- this.ellipsoid,
281
- spherePointScratch,
282
- );
283
-
284
- // Project into plane with vertical for latitude
285
- magXY = Math.sqrt(
286
- spherePoint.x * spherePoint.x + spherePoint.y * spherePoint.y,
287
- );
288
-
289
- // Use fastApproximateAtan2 for alignment with shader
290
- sphereLatitude = CesiumMath.fastApproximateAtan2(magXY, spherePoint.z);
291
- sphereLongitude = CesiumMath.fastApproximateAtan2(
292
- spherePoint.x,
293
- spherePoint.y,
348
+ ClippingPolygon.prototype.computeRectangle = function (result) {
349
+ deprecationWarning(
350
+ "ClippingPolygon.computeRectangle",
351
+ "ClippingPolygon.computeRectangle is deprecated as of CesiumJS 1.145 and will be removed in 1.147. Use the ClippingPolygon.rectangle property instead.",
294
352
  );
295
-
296
- result.north = sphereLatitude;
297
- result.east = sphereLongitude;
298
-
299
- return result;
353
+ return Rectangle.clone(this._rectangle, result);
300
354
  };
301
355
 
302
356
  export default ClippingPolygon;