@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
@@ -0,0 +1,669 @@
1
+ // @ts-check
2
+
3
+ import BufferPolygonCollection from "../Scene/BufferPolygonCollection.js";
4
+ import BufferPolylineCollection from "../Scene/BufferPolylineCollection.js";
5
+ import DeveloperError from "./DeveloperError.js";
6
+ import HeightReference, {
7
+ isHeightReferenceClamp,
8
+ } from "../Scene/HeightReference.js";
9
+ import Cartesian2 from "./Cartesian2.js";
10
+ import Rectangle from "./Rectangle.js";
11
+ import defined from "./defined.js";
12
+ import VectorPipeline from "./VectorPipeline.js";
13
+
14
+ /** @import BufferPrimitive from "../Scene/BufferPrimitive.js"; */
15
+ /** @import BufferPrimitiveCollection from "../Scene/BufferPrimitiveCollection.js"; */
16
+ /** @import Context from "../Renderer/Context.js"; */
17
+ /** @import Ellipsoid from "./Ellipsoid.js"; */
18
+ /** @import TilingScheme from "./TilingScheme.js"; */
19
+ /** @import { VectorCollectionData, VectorTileData } from "./VectorPipeline.js"; */
20
+
21
+ /** @ignore */
22
+ const scratchTileRectangle = new Rectangle();
23
+ const scratchCollectionRectangle = new Rectangle();
24
+ const scratchIntersectRectangle = new Rectangle();
25
+
26
+ /**
27
+ * Extracts a collection's snapshot of projected positions and per-primitive
28
+ * material properties.
29
+ *
30
+ * @callback PackCollectionData
31
+ * @param {*} collection
32
+ * @param {Ellipsoid} ellipsoid
33
+ * @param {VectorCollectionData} [result]
34
+ * @returns {VectorCollectionData}
35
+ * @private
36
+ */
37
+
38
+ /**
39
+ * Packs a collection's primitives into a tile's vector data.
40
+ *
41
+ * @callback PackTilePrimitives
42
+ * @param {*} collection
43
+ * @param {VectorCollectionData} collectionData
44
+ * @param {Rectangle} rectangle
45
+ * @param {VectorTileData} result
46
+ * @returns {void}
47
+ * @private
48
+ */
49
+
50
+ /**
51
+ * Packing functions for a collection type.
52
+ *
53
+ * @typedef {object} CollectionPacker
54
+ * @property {PackCollectionData} packCollectionData Extracts the per-collection snapshot.
55
+ * @property {PackTilePrimitives} packTilePrimitives Packs the collection's primitives into a tile.
56
+ * @private
57
+ */
58
+
59
+ /**
60
+ * Per-type packing functions, keyed by collection class.
61
+ * @type {Map<Function, CollectionPacker>}
62
+ * @private
63
+ */
64
+ const collectionPackers = new Map();
65
+ collectionPackers.set(BufferPolylineCollection, {
66
+ packCollectionData: VectorPipeline.packPolylineCollectionData,
67
+ packTilePrimitives: VectorPipeline.packPolylineSegments,
68
+ });
69
+ collectionPackers.set(BufferPolygonCollection, {
70
+ packCollectionData: VectorPipeline.packPolygonCollectionData,
71
+ packTilePrimitives: VectorPipeline.packPolygonRings,
72
+ });
73
+
74
+ /**
75
+ * @typedef {object} VectorProviderConstructorOptions
76
+ * @property {TilingScheme} tilingScheme
77
+ * @property {boolean} [antialias=true] Whether to fade draped polyline edges over the pixel
78
+ * straddling them. Disabling this is faster but leaves the edges aliased.
79
+ * @property {number} [minimumTileScreenPixels=256] Lower bound on the screen size, in pixels, of
80
+ * a tile baked by this provider.
81
+ * @private
82
+ */
83
+
84
+ /**
85
+ * @ignore
86
+ */
87
+ class VectorProvider {
88
+ /** @param {VectorProviderConstructorOptions} options */
89
+ constructor(options) {
90
+ /** @private */
91
+ this._tilingScheme = options.tilingScheme;
92
+
93
+ /**
94
+ * Whether to fade draped polyline edges over the pixel straddling them.
95
+ * Disabling this is faster but leaves the edges aliased.
96
+ *
97
+ * @type {boolean}
98
+ * @default true
99
+ */
100
+ this.antialias = options.antialias ?? true;
101
+
102
+ /**
103
+ * Lower bound on the screen size, in pixels, of a tile baked by this provider. Line widths are
104
+ * in screen pixels but baking has no camera, so this is what converts them to tile UV. The
105
+ * surface consuming the tiles is expected to derive it from its own refinement criterion.
106
+ *
107
+ * @type {number}
108
+ * @default 256
109
+ */
110
+ this.minimumTileScreenPixels = options.minimumTileScreenPixels ?? 256.0;
111
+
112
+ /**
113
+ * Marked collections, mapped to the {@link HeightReference} they were marked
114
+ * with, which determines the surfaces they are draped onto.
115
+ * @type {Map<BufferPrimitiveCollection<BufferPrimitive>, HeightReference>}
116
+ * @private
117
+ */
118
+ this._heightReferenceByCollection = new Map();
119
+
120
+ /**
121
+ * Per-collection snapshot of projected positions and per-primitive
122
+ * material properties, keyed by collection version.
123
+ * @type {WeakMap<BufferPrimitiveCollection<BufferPrimitive>, VectorCollectionData>}
124
+ * @private
125
+ */
126
+ this._collectionDataCache = new WeakMap();
127
+
128
+ /**
129
+ * Collections marked this frame (only these are baked).
130
+ * @type {Set<BufferPrimitiveCollection<BufferPrimitive>>}
131
+ * @private
132
+ */
133
+ this._markedThisFrame = new Set();
134
+
135
+ /** @private */
136
+ this._markedFrameNumber = -1;
137
+
138
+ /**
139
+ * Cartographic regions changed since the last
140
+ * {@link VectorProvider#makeClean}, so only overlapping terrain
141
+ * tiles are re-baked.
142
+ * @type {Rectangle[]}
143
+ * @private
144
+ */
145
+ this._dirtyRectangles = [];
146
+ }
147
+
148
+ /** @type {TilingScheme} */
149
+ get tilingScheme() {
150
+ return this._tilingScheme;
151
+ }
152
+
153
+ set tilingScheme(value) {
154
+ this._tilingScheme = value;
155
+ }
156
+
157
+ /** @type {Ellipsoid} */
158
+ get ellipsoid() {
159
+ return this._tilingScheme.ellipsoid;
160
+ }
161
+
162
+ /**
163
+ * Drops a collection immediately, rather than waiting for it to be pruned by
164
+ * the next {@link VectorProvider#update}. Call when a collection is destroyed,
165
+ * so that it is never draped after its buffers are released.
166
+ *
167
+ * @param {BufferPrimitiveCollection<BufferPrimitive>} collection
168
+ */
169
+ remove(collection) {
170
+ this._markedThisFrame.delete(collection);
171
+ if (this._heightReferenceByCollection.delete(collection)) {
172
+ this._markCollectionRegionDirty(collection);
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Whether a collection is currently being draped, that is, whether it has
178
+ * been marked and not yet pruned or removed.
179
+ *
180
+ * @param {BufferPrimitiveCollection<BufferPrimitive>} collection
181
+ * @returns {boolean}
182
+ */
183
+ has(collection) {
184
+ return this._heightReferenceByCollection.has(collection);
185
+ }
186
+
187
+ /**
188
+ * Whether draping is supported for the given collection's type. Callers must
189
+ * render unsupported collections themselves.
190
+ *
191
+ * @param {BufferPrimitiveCollection<BufferPrimitive>} collection
192
+ * @returns {boolean}
193
+ */
194
+ static isSupported(collection) {
195
+ return collectionPackers.has(collection.constructor);
196
+ }
197
+
198
+ /**
199
+ * Marks a collection as draped for this frame; collections not marked are
200
+ * pruned next frame, keeping the draped set aligned with the rendered LOD.
201
+ *
202
+ * @param {BufferPrimitiveCollection<BufferPrimitive>} collection
203
+ * @param {number} frameNumber
204
+ * @param {HeightReference} heightReference The surfaces the collection is
205
+ * draped onto: {@link HeightReference.CLAMP_TO_TERRAIN} for the globe,
206
+ * {@link HeightReference.CLAMP_TO_3D_TILE} for 3D Tiles, or
207
+ * {@link HeightReference.CLAMP_TO_GROUND} for both.
208
+ */
209
+ markForFrame(collection, frameNumber, heightReference) {
210
+ //>>includeStart('debug', pragmas.debug);
211
+ if (!VectorProvider.isSupported(collection)) {
212
+ throw new DeveloperError(
213
+ `Draping is not supported for ${collection.constructor.name}. Check VectorProvider.isSupported before marking a collection.`,
214
+ );
215
+ }
216
+ if (!isHeightReferenceClamp(heightReference)) {
217
+ throw new DeveloperError(
218
+ "heightReference must be CLAMP_TO_GROUND, CLAMP_TO_TERRAIN, or CLAMP_TO_3D_TILE.",
219
+ );
220
+ }
221
+ //>>includeEnd('debug');
222
+
223
+ this._beginFrame(frameNumber);
224
+ this._markedThisFrame.add(collection);
225
+
226
+ if (!this._heightReferenceByCollection.has(collection)) {
227
+ this._markCollectionRegionDirty(collection);
228
+ }
229
+
230
+ this._heightReferenceByCollection.set(collection, heightReference);
231
+ }
232
+
233
+ /**
234
+ * Prunes the previous frame's unmarked collections when a new frame begins.
235
+ * Called both from {@link VectorProvider#markForFrame} and once per frame
236
+ * from {@link VectorProvider#update}, so that a frame in which nothing is
237
+ * marked still prunes the collections left over from the frame before it.
238
+ *
239
+ * @param {number} frameNumber
240
+ * @private
241
+ */
242
+ _beginFrame(frameNumber) {
243
+ if (frameNumber === this._markedFrameNumber) {
244
+ return;
245
+ }
246
+
247
+ for (const collection of this._heightReferenceByCollection.keys()) {
248
+ if (!this._markedThisFrame.has(collection)) {
249
+ this._heightReferenceByCollection.delete(collection);
250
+ this._markCollectionRegionDirty(collection);
251
+ }
252
+ }
253
+ this._markedThisFrame.clear();
254
+
255
+ this._markedFrameNumber = frameNumber;
256
+ }
257
+
258
+ /**
259
+ * Records a changed collection's region(s) so the next re-bake only touches
260
+ * overlapping tiles.
261
+ * @param {BufferPrimitiveCollection<BufferPrimitive>} collection
262
+ * @private
263
+ */
264
+ _markCollectionRegionDirty(collection) {
265
+ const collectionRectangle = Rectangle.fromBoundingSphere(
266
+ collection.boundingVolume,
267
+ this._tilingScheme.ellipsoid,
268
+ new Rectangle(),
269
+ );
270
+ this._dirtyRectangles.push(collectionRectangle);
271
+ }
272
+
273
+ /**
274
+ * @param {number} x
275
+ * @param {number} y
276
+ * @param {number} level
277
+ * @param {Context} context
278
+ * @param {HeightReference} targetHeightReference The kind of
279
+ * surface the data is baked for, either {@link HeightReference.CLAMP_TO_TERRAIN} or
280
+ * {@link HeightReference.CLAMP_TO_3D_TILE}. Only collections draped onto that surface are
281
+ * included.
282
+ * @returns {VectorTileData}
283
+ */
284
+ requestTileData(x, y, level, context, targetHeightReference) {
285
+ const tileRectangle = this._tilingScheme.tileXYToRectangle(
286
+ x,
287
+ y,
288
+ level,
289
+ scratchTileRectangle,
290
+ );
291
+ return this.requestDataForRectangle(
292
+ tileRectangle,
293
+ context,
294
+ targetHeightReference,
295
+ );
296
+ }
297
+
298
+ /**
299
+ * Bakes vector lookup data for an arbitrary cartographic rectangle, such as
300
+ * a 3D Tiles content's bounding region.
301
+ *
302
+ * @param {Rectangle} rectangle
303
+ * @param {Context} context
304
+ * @param {HeightReference} targetHeightReference The kind of
305
+ * surface the data is baked for, either {@link HeightReference.CLAMP_TO_TERRAIN} or
306
+ * {@link HeightReference.CLAMP_TO_3D_TILE}. Only collections draped onto that surface are
307
+ * included.
308
+ * @returns {VectorTileData}
309
+ */
310
+ requestDataForRectangle(rectangle, context, targetHeightReference) {
311
+ const tilingScheme = this._tilingScheme;
312
+ const heightReferenceByCollection = this._heightReferenceByCollection;
313
+
314
+ /** @type {VectorTileData} */
315
+ const result = {
316
+ show: true,
317
+ hasPolylines: false,
318
+ hasPolygons: false,
319
+ rectangle: Rectangle.clone(rectangle),
320
+ collectionVersions: new Map(),
321
+ minimumTileScreenPixels: this.minimumTileScreenPixels,
322
+ metersPerUv: computeMetersPerUv(rectangle, tilingScheme.ellipsoid),
323
+ };
324
+
325
+ for (const [collection, heightReference] of heightReferenceByCollection) {
326
+ if (!targetsSurface(heightReference, targetHeightReference)) {
327
+ continue;
328
+ }
329
+
330
+ const collectionRectangle = Rectangle.fromBoundingSphere(
331
+ collection.boundingVolume,
332
+ tilingScheme.ellipsoid,
333
+ scratchCollectionRectangle,
334
+ );
335
+
336
+ const isIntersected = !!Rectangle.intersection(
337
+ rectangle,
338
+ collectionRectangle,
339
+ scratchIntersectRectangle,
340
+ );
341
+
342
+ if (!isIntersected) {
343
+ continue;
344
+ }
345
+
346
+ // Guaranteed by the VectorProvider.isSupported check in markForFrame.
347
+ const packer = /** @type {CollectionPacker} */ (
348
+ collectionPackers.get(collection.constructor)
349
+ );
350
+
351
+ const collectionData = this._getCollectionDataCached(
352
+ collection,
353
+ packer.packCollectionData,
354
+ );
355
+ result.collectionVersions.set(collection, collectionData.version);
356
+ packer.packTilePrimitives(collection, collectionData, rectangle, result);
357
+ }
358
+
359
+ const hasPolylines =
360
+ defined(result.polylineSegments) && result.polylineSegments.length > 0;
361
+ const hasPolygons =
362
+ defined(result.polygonRings) && result.polygonRings.length > 0;
363
+ result.hasPolylines = hasPolylines;
364
+ result.hasPolygons = hasPolygons;
365
+
366
+ if (!hasPolylines && !hasPolygons) {
367
+ result.show = false;
368
+ return result;
369
+ }
370
+
371
+ if (hasPolylines) {
372
+ VectorPipeline.packPolylineGrid(result);
373
+ VectorPipeline.packPolylineTextures(context, result);
374
+ }
375
+
376
+ if (hasPolygons) {
377
+ VectorPipeline.packPolygonGrid(result);
378
+ VectorPipeline.packPolygonTextures(context, result);
379
+ }
380
+
381
+ VectorPipeline.packPrimitiveTextures(context, result);
382
+
383
+ return result;
384
+ }
385
+
386
+ /**
387
+ * @param {VectorTileData} data
388
+ */
389
+ releaseTileData(data) {
390
+ VectorPipeline.freeResources(data);
391
+ }
392
+
393
+ /**
394
+ * Re-bakes a tile's vector data if the tile overlaps a region changed since
395
+ * the last {@link VectorProvider#makeClean}, releasing the previous data.
396
+ * Returns the current data unchanged when the tile is outside every changed
397
+ * region.
398
+ *
399
+ * @param {number} x
400
+ * @param {number} y
401
+ * @param {number} level
402
+ * @param {Context} context
403
+ * @param {VectorTileData} currentData
404
+ * @param {HeightReference} targetHeightReference Either
405
+ * {@link HeightReference.CLAMP_TO_TERRAIN} or {@link HeightReference.CLAMP_TO_3D_TILE}.
406
+ * @returns {VectorTileData}
407
+ */
408
+ updateTileData(x, y, level, context, currentData, targetHeightReference) {
409
+ const dirtyRectangles = this._dirtyRectangles;
410
+ const tilingScheme = this._tilingScheme;
411
+ if (!intersectRectangles(x, y, level, dirtyRectangles, tilingScheme)) {
412
+ return currentData;
413
+ }
414
+
415
+ this.releaseTileData(currentData);
416
+
417
+ return this.requestTileData(x, y, level, context, targetHeightReference);
418
+ }
419
+
420
+ /**
421
+ * Re-bakes vector data for an arbitrary rectangle when the collections it was
422
+ * baked from have changed. Unlike {@link VectorProvider#updateTileData}, this
423
+ * does not consult {@link VectorProvider#_dirtyRectangles} — they are cleared
424
+ * each frame by {@link VectorProvider#makeClean}, which consumers outside the
425
+ * terrain pass cannot rely on observing — so staleness is instead detected by
426
+ * comparing the collection versions recorded when the data was baked.
427
+ *
428
+ * @param {Rectangle} rectangle
429
+ * @param {Context} context
430
+ * @param {VectorTileData} currentData
431
+ * @param {HeightReference} targetHeightReference Either
432
+ * {@link HeightReference.CLAMP_TO_TERRAIN} or {@link HeightReference.CLAMP_TO_3D_TILE}.
433
+ * @returns {VectorTileData}
434
+ */
435
+ updateDataForRectangle(
436
+ rectangle,
437
+ context,
438
+ currentData,
439
+ targetHeightReference,
440
+ ) {
441
+ if (!this._isStale(currentData, rectangle, targetHeightReference)) {
442
+ return currentData;
443
+ }
444
+
445
+ this.releaseTileData(currentData);
446
+
447
+ return this.requestDataForRectangle(
448
+ rectangle,
449
+ context,
450
+ targetHeightReference,
451
+ );
452
+ }
453
+
454
+ /**
455
+ * Whether baked data no longer reflects the collections overlapping its
456
+ * rectangle. Stale when a collection it was baked from has changed, when a
457
+ * collection has left the rectangle or been pruned, or when a collection has
458
+ * moved into the rectangle since the bake.
459
+ *
460
+ * @param {VectorTileData} data
461
+ * @param {Rectangle} rectangle
462
+ * @param {HeightReference} targetHeightReference
463
+ * @returns {boolean}
464
+ * @private
465
+ */
466
+ _isStale(data, rectangle, targetHeightReference) {
467
+ // The rectangle itself can change, such as when a model moves.
468
+ if (!Rectangle.equals(data.rectangle, rectangle)) {
469
+ return true;
470
+ }
471
+
472
+ const bakedVersions = data.collectionVersions;
473
+ const heightReferenceByCollection = this._heightReferenceByCollection;
474
+ let bakedVersionsVisited = 0;
475
+
476
+ for (const [collection, heightReference] of heightReferenceByCollection) {
477
+ if (!targetsSurface(heightReference, targetHeightReference)) {
478
+ continue;
479
+ }
480
+
481
+ const collectionRectangle = Rectangle.fromBoundingSphere(
482
+ collection.boundingVolume,
483
+ this._tilingScheme.ellipsoid,
484
+ scratchCollectionRectangle,
485
+ );
486
+ const isIntersected = !!Rectangle.intersection(
487
+ rectangle,
488
+ collectionRectangle,
489
+ scratchIntersectRectangle,
490
+ );
491
+ const bakedVersion = bakedVersions.get(collection);
492
+
493
+ if (!isIntersected) {
494
+ // Left the rectangle since the bake.
495
+ if (defined(bakedVersion)) {
496
+ return true;
497
+ }
498
+ continue;
499
+ }
500
+
501
+ // Moved into the rectangle since the bake.
502
+ if (!defined(bakedVersion)) {
503
+ return true;
504
+ }
505
+
506
+ bakedVersionsVisited++;
507
+
508
+ if (collection._dirtyCount > 0 || bakedVersion !== collection._version) {
509
+ return true;
510
+ }
511
+ }
512
+
513
+ // A collection the data was baked from is no longer marked.
514
+ return bakedVersionsVisited !== bakedVersions.size;
515
+ }
516
+
517
+ /**
518
+ * Clears the regions recorded as changed. Call once after a re-bake pass has
519
+ * updated the overlapping tiles via {@link VectorProvider#updateTileData}.
520
+ */
521
+ makeClean() {
522
+ this._dirtyRectangles.length = 0;
523
+ }
524
+
525
+ /**
526
+ * Prunes the previous frame's unmarked collections and records dirty regions
527
+ * for collections whose content has changed since their last extraction, so
528
+ * overlapping tiles are re-baked. Call once per frame, before
529
+ * {@link VectorProvider#updateTileData}.
530
+ *
531
+ * @param {number} [frameNumber] The current frame number. When omitted, the
532
+ * marked set is left untouched and only dirty regions are recorded.
533
+ */
534
+ update(frameNumber) {
535
+ if (defined(frameNumber)) {
536
+ this._beginFrame(frameNumber);
537
+ }
538
+
539
+ for (const collection of this._heightReferenceByCollection.keys()) {
540
+ const cache = this._collectionDataCache.get(collection);
541
+ if (!defined(cache)) {
542
+ // Never extracted; new tiles bake on request.
543
+ continue;
544
+ }
545
+ const changed =
546
+ collection._dirtyCount > 0 || cache.version !== collection._version;
547
+ if (!changed) {
548
+ continue;
549
+ }
550
+ // Re-bake both the previously baked region (content may have moved
551
+ // away from it) and the collection's current region.
552
+ if (defined(cache.rectangle)) {
553
+ this._dirtyRectangles.push(Rectangle.clone(cache.rectangle));
554
+ }
555
+ this._markCollectionRegionDirty(collection);
556
+ }
557
+ }
558
+
559
+ /**
560
+ * Returns the collection's {@link VectorCollectionData} snapshot,
561
+ * re-extracted when the collection has changed. The collection is marked
562
+ * clean only after everything has been read back.
563
+ *
564
+ * @param {BufferPrimitiveCollection<BufferPrimitive>} collection
565
+ * @param {PackCollectionData} packCollectionData
566
+ * @returns {VectorCollectionData}
567
+ * @private
568
+ */
569
+ _getCollectionDataCached(collection, packCollectionData) {
570
+ const cache = this._collectionDataCache.get(collection);
571
+ const dirty = collection._dirtyCount > 0;
572
+ const outdated = cache?.version !== collection._version;
573
+
574
+ if (defined(cache) && !dirty && !outdated) {
575
+ return cache;
576
+ }
577
+
578
+ const ellipsoid = this.ellipsoid;
579
+ const data = packCollectionData(collection, ellipsoid, cache);
580
+
581
+ // If dirty, the version increments +1 when marked clean below.
582
+ data.version = collection._version + (dirty ? 1 : 0);
583
+ data.rectangle = Rectangle.fromBoundingSphere(
584
+ collection.boundingVolume,
585
+ ellipsoid,
586
+ data.rectangle,
587
+ );
588
+ this._collectionDataCache.set(collection, data);
589
+
590
+ collection._makeClean();
591
+
592
+ return data;
593
+ }
594
+ }
595
+
596
+ /**
597
+ * Whether a collection draped with <code>collectionHeightReference</code> lands
598
+ * on a surface of kind <code>targetHeightReference</code>.
599
+ *
600
+ * @param {HeightReference} collectionHeightReference
601
+ * @param {HeightReference} targetHeightReference Either
602
+ * {@link HeightReference.CLAMP_TO_TERRAIN} or {@link HeightReference.CLAMP_TO_3D_TILE}.
603
+ * @returns {boolean}
604
+ * @private
605
+ */
606
+ function targetsSurface(collectionHeightReference, targetHeightReference) {
607
+ return (
608
+ collectionHeightReference === HeightReference.CLAMP_TO_GROUND ||
609
+ collectionHeightReference === targetHeightReference
610
+ );
611
+ }
612
+
613
+ /**
614
+ * Ground size, in meters, of a rectangle's UV domain. Evaluated at the center latitude, so the
615
+ * east-west scale drifts toward the northern and southern edges.
616
+ *
617
+ * @param {Rectangle} rectangle
618
+ * @param {Ellipsoid} ellipsoid
619
+ * @returns {Cartesian2}
620
+ * @private
621
+ */
622
+ function computeMetersPerUv(rectangle, ellipsoid) {
623
+ const radius = ellipsoid.maximumRadius;
624
+ const centerLatitude = (rectangle.south + rectangle.north) * 0.5;
625
+ return new Cartesian2(
626
+ rectangle.width * radius * Math.cos(centerLatitude),
627
+ rectangle.height * radius,
628
+ );
629
+ }
630
+
631
+ /**
632
+ * @param {number} x
633
+ * @param {number} y
634
+ * @param {number} level
635
+ * @param {Rectangle[]} rectangles
636
+ * @param {TilingScheme} tilingScheme
637
+ * @returns {boolean}
638
+ * @private
639
+ */
640
+ function intersectRectangles(x, y, level, rectangles, tilingScheme) {
641
+ // No dirty regions recorded — nothing to re-bake. A caller needing a full
642
+ // re-bake should record Rectangle.MAX_VALUE instead.
643
+ if (rectangles.length === 0) {
644
+ return false;
645
+ }
646
+
647
+ const tileRectangle = tilingScheme.tileXYToRectangle(
648
+ x,
649
+ y,
650
+ level,
651
+ scratchTileRectangle,
652
+ );
653
+
654
+ for (let i = 0; i < rectangles.length; i++) {
655
+ const isIntersected = Rectangle.intersection(
656
+ tileRectangle,
657
+ rectangles[i],
658
+ scratchIntersectRectangle,
659
+ );
660
+
661
+ if (isIntersected) {
662
+ return true;
663
+ }
664
+ }
665
+
666
+ return false;
667
+ }
668
+
669
+ export default VectorProvider;
@@ -419,7 +419,7 @@ WallOutlineGeometry.createGeometry = function (wallGeometry) {
419
419
  }
420
420
 
421
421
  indices[edgeIndex++] = numVertices - 2;
422
- indices[edgeIndex++] = numVertices - 1;
422
+ indices[edgeIndex] = numVertices - 1;
423
423
 
424
424
  return new Geometry({
425
425
  attributes: attributes,
@@ -1,11 +1,12 @@
1
+ // @ts-check
2
+
1
3
  /**
2
4
  * Gets a timestamp that can be used in measuring the time between events. Timestamps
3
5
  * are expressed in milliseconds, but it is not specified what the milliseconds are
4
6
  * measured from. This function uses performance.now() if it is available, or Date.now()
5
7
  * otherwise.
6
- *
8
+ * @type {Function}
7
9
  * @function getTimestamp
8
- *
9
10
  * @returns {number} The timestamp in milliseconds since some unspecified reference time.
10
11
  */
11
12
  let getTimestamp;
@@ -23,4 +24,5 @@ if (
23
24
  return Date.now();
24
25
  };
25
26
  }
27
+
26
28
  export default getTimestamp;
@@ -218,7 +218,6 @@ CompositeEntityCollection.prototype.addCollection = function (
218
218
  //>>includeEnd('debug');
219
219
 
220
220
  if (!hasIndex) {
221
- index = this._collections.length;
222
221
  this._collections.push(collection);
223
222
  } else {
224
223
  this._collections.splice(index, 0, collection);