@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
@@ -1,6 +1,8 @@
1
1
  // @ts-check
2
2
 
3
3
  import defined from "../Core/defined.js";
4
+ import DeveloperError from "../Core/DeveloperError.js";
5
+ import Frozen from "../Core/Frozen.js";
4
6
  import BufferPrimitiveCollection from "./BufferPrimitiveCollection.js";
5
7
  import BufferPolyline from "./BufferPolyline.js";
6
8
  import renderPolylines from "./renderBufferPolylineCollection.js";
@@ -8,7 +10,12 @@ import BufferPolylineMaterial from "./BufferPolylineMaterial.js";
8
10
 
9
11
  /** @import { TypedArray } from "../Core/globalTypes.js"; */
10
12
  /** @import Matrix4 from "../Core/Matrix4.js"; */
13
+ /** @import BoundingSphere from "../Core/BoundingSphere.js"; */
14
+ /** @import ComponentDatatype from "../Core/ComponentDatatype.js"; */
15
+ /** @import BlendOption from "./BlendOption.js"; */
16
+ /** @import HeightReference from "./HeightReference.js"; */
11
17
  /** @import FrameState from "./FrameState.js" */
18
+ /** @import { BufferPrimitiveCollectionOptions } from "./BufferPrimitiveCollection.js"; */
12
19
 
13
20
  /**
14
21
  * @typedef {object} BufferPolylineOptions
@@ -57,6 +64,55 @@ import BufferPolylineMaterial from "./BufferPolylineMaterial.js";
57
64
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
58
65
  */
59
66
  class BufferPolylineCollection extends BufferPrimitiveCollection {
67
+ /**
68
+ * @param {object} [options]
69
+ * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] Transforms geometry from model to world coordinates.
70
+ * @param {number} [options.primitiveCountMax=BufferPrimitiveCollection.DEFAULT_CAPACITY]
71
+ * @param {number} [options.vertexCountMax=BufferPrimitiveCollection.DEFAULT_CAPACITY]
72
+ * @param {boolean} [options.show=true]
73
+ * @param {ComponentDatatype} [options.positionDatatype=ComponentDatatype.DOUBLE]
74
+ * @param {boolean} [options.positionNormalized=false]
75
+ * @param {boolean} [options.allowPicking=false] When <code>true</code>, primitives are pickable with {@link Scene#pick}. When <code>false</code>, memory and initialization cost are lower.
76
+ * @param {BoundingSphere} [options.boundingVolume] Bounding volume, in world space, for the collection.
77
+ * @param {boolean} [options.debugShowBoundingVolume=false]
78
+ * @param {BlendOption} [options.blendOption=BlendOption.TRANSLUCENT]
79
+ * @param {HeightReference} [options.heightReference=HeightReference.NONE]
80
+ * @param {"pixels"|"meters"} [options.widthUnits="pixels"] Unit of polyline widths in this collection:
81
+ * <code>"pixels"</code> on the screen, or <code>"meters"</code> in world space. A clamped
82
+ * {@link HeightReference} measures those meters on the ellipsoid surface, so elevation and terrain
83
+ * slope stretch the drawn width.
84
+ */
85
+ constructor(options = Frozen.EMPTY_OBJECT) {
86
+ super(options);
87
+
88
+ const widthUnits = options.widthUnits ?? "pixels";
89
+
90
+ //>>includeStart('debug', pragmas.debug);
91
+ if (widthUnits !== "pixels" && widthUnits !== "meters") {
92
+ throw new DeveloperError(
93
+ 'options.widthUnits must be "pixels" or "meters".',
94
+ );
95
+ }
96
+ //>>includeEnd('debug');
97
+
98
+ /**
99
+ * @type {"pixels"|"meters"}
100
+ * @private
101
+ */
102
+ this._widthUnits = widthUnits;
103
+ }
104
+
105
+ /**
106
+ * Unit of polyline widths in this collection: <code>"pixels"</code> on the screen, or
107
+ * <code>"meters"</code> in world space, measured on the ellipsoid surface when clamped.
108
+ *
109
+ * @type {"pixels"|"meters"}
110
+ * @readonly
111
+ */
112
+ get widthUnits() {
113
+ return this._widthUnits;
114
+ }
115
+
60
116
  _getCollectionClass() {
61
117
  return BufferPolylineCollection;
62
118
  }
@@ -73,17 +129,15 @@ class BufferPolylineCollection extends BufferPrimitiveCollection {
73
129
  // COLLECTION LIFECYCLE
74
130
 
75
131
  /**
76
- * @param {BufferPolylineCollection} collection
132
+ * @param {BufferPrimitiveCollectionOptions} [options]
77
133
  * @returns {BufferPolylineCollection}
78
134
  * @override
79
135
  * @ignore
80
136
  */
81
- static _cloneEmpty(collection) {
137
+ _cloneEmpty(options = Frozen.EMPTY_OBJECT) {
82
138
  return new BufferPolylineCollection({
83
- primitiveCountMax: collection.primitiveCountMax,
84
- vertexCountMax: collection.vertexCountMax,
85
- positionDatatype: collection.positionDatatype,
86
- positionNormalized: collection.positionNormalized,
139
+ widthUnits: this._widthUnits,
140
+ ...this._cloneEmptyBaseArgs(options),
87
141
  });
88
142
  }
89
143
 
@@ -126,8 +180,7 @@ class BufferPolylineCollection extends BufferPrimitiveCollection {
126
180
  update(frameState) {
127
181
  super.update(frameState);
128
182
 
129
- const passes = frameState.passes;
130
- if (this.show && (passes.render || passes.pick)) {
183
+ if (this._isRendered(frameState)) {
131
184
  this._renderContext = renderPolylines(
132
185
  this,
133
186
  frameState,
@@ -11,7 +11,8 @@ import BufferPrimitiveMaterial from "./BufferPrimitiveMaterial.js";
11
11
  * @property {Color} [color=Color.WHITE] Color of fill.
12
12
  * @property {Color} [outlineColor=Color.WHITE] Color of outline.
13
13
  * @property {number} [outlineWidth=0.0] Width of outline, 0-255px.
14
- * @property {number} [width=1.0] Width of line, 0-255px.
14
+ * @property {number} [width=1.0] Width of line, in the unit selected by
15
+ * {@link BufferPolylineCollection#widthUnits}.
15
16
  */
16
17
 
17
18
  /**
@@ -28,7 +29,7 @@ class BufferPolylineMaterial extends BufferPrimitiveMaterial {
28
29
  /** @ignore */
29
30
  static Layout = {
30
31
  ...BufferPrimitiveMaterial.Layout,
31
- WIDTH_U8: BufferPrimitiveMaterial.Layout.__BYTE_LENGTH,
32
+ WIDTH_F32: BufferPrimitiveMaterial.Layout.__BYTE_LENGTH,
32
33
  __BYTE_LENGTH: BufferPrimitiveMaterial.Layout.__BYTE_LENGTH + 4,
33
34
  };
34
35
 
@@ -45,7 +46,7 @@ class BufferPolylineMaterial extends BufferPrimitiveMaterial {
45
46
  super(options);
46
47
 
47
48
  /**
48
- * Width of polyline, 0–255px.
49
+ * Width of polyline, in the unit selected by {@link BufferPolylineCollection#widthUnits}.
49
50
  * @type {number}
50
51
  */
51
52
  this.width = options.width ?? 1;
@@ -59,7 +60,7 @@ class BufferPolylineMaterial extends BufferPrimitiveMaterial {
59
60
  */
60
61
  static pack(material, view, byteOffset) {
61
62
  super.pack(material, view, byteOffset);
62
- view.setUint8(this.Layout.WIDTH_U8 + byteOffset, material.width);
63
+ view.setFloat32(this.Layout.WIDTH_F32 + byteOffset, material.width, true);
63
64
  }
64
65
 
65
66
  /**
@@ -71,7 +72,7 @@ class BufferPolylineMaterial extends BufferPrimitiveMaterial {
71
72
  */
72
73
  static unpack(view, byteOffset, result) {
73
74
  super.unpack(view, byteOffset, result);
74
- result.width = view.getUint8(this.Layout.WIDTH_U8 + byteOffset);
75
+ result.width = view.getFloat32(this.Layout.WIDTH_F32 + byteOffset, true);
75
76
  return result;
76
77
  }
77
78
 
@@ -14,6 +14,7 @@ import SceneMode from "./SceneMode.js";
14
14
  import AttributeType from "./AttributeType.js";
15
15
  import oneTimeWarning from "../Core/oneTimeWarning.js";
16
16
  import BlendOption from "../Scene/BlendOption.js";
17
+ import HeightReference, { isHeightReferenceClamp } from "./HeightReference.js";
17
18
 
18
19
  /** @import { Destroyable, TypedArray, TypedArrayConstructor } from "../Core/globalTypes.js"; */
19
20
  /** @import Context from "../Renderer/Context.js"; */
@@ -32,6 +33,31 @@ import BlendOption from "../Scene/BlendOption.js";
32
33
  * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
33
34
  */
34
35
 
36
+ /**
37
+ * @typedef {object} BufferPrimitiveCollectionOptions
38
+ * @property {Matrix4} [modelMatrix=Matrix4.IDENTITY] Transforms geometry from model to world coordinates.
39
+ * @property {number} [primitiveCountMax=BufferPrimitiveCollection.DEFAULT_CAPACITY] Maximum number of primitives.
40
+ * @property {number} [vertexCountMax=BufferPrimitiveCollection.DEFAULT_CAPACITY] Maximum number of vertices.
41
+ * @property {boolean} [show=true]
42
+ * @property {ComponentDatatype} [positionDatatype=ComponentDatatype.DOUBLE] The component datatype used to store position values.
43
+ * @property {boolean} [positionNormalized=false] When <code>true</code>, integer position values are treated as normalized,
44
+ * where the full integer range maps to [-1, 1] (signed) or [0, 1] (unsigned). Only relevant for integer position datatypes
45
+ * (BYTE, UNSIGNED_BYTE, SHORT, UNSIGNED_SHORT).
46
+ * @property {boolean} [allowPicking=false] When <code>true</code>, primitives are pickable with {@link Scene#pick}. When <code>false</code>, memory and initialization cost are lower.
47
+ * @property {BoundingSphere} [boundingVolume] Bounding volume, in world space, for the collection. When
48
+ * unspecified, a bounding volume is computed automatically and updated when primitive positions change. When
49
+ * specified, users are responsible for updating bounding volume as needed. Pre-computing the bounding volume
50
+ * manually, and updating it only as needed, will improve performance for larger dynamic collections.
51
+ * @property {boolean} [debugShowBoundingVolume=false]
52
+ * @property {BlendOption} [blendOption=BlendOption.TRANSLUCENT]
53
+ * @property {HeightReference} [options.heightReference=HeightReference.NONE] When set to a clamping value, the
54
+ * collection is draped onto the surfaces selected by the value: {@link HeightReference.CLAMP_TO_TERRAIN} drapes
55
+ * onto the globe, {@link HeightReference.CLAMP_TO_3D_TILE} drapes onto 3D Tiles, and
56
+ * {@link HeightReference.CLAMP_TO_GROUND} drapes onto both. Only {@link BufferPolylineCollection} and
57
+ * {@link BufferPolygonCollection} support draping, and only once the collection has been added to
58
+ * {@link Scene#primitives}. A draped collection is not also drawn as geometry of its own.
59
+ */
60
+
35
61
  /**
36
62
  * Collection of primitives held in ArrayBuffer storage for performance and memory optimization.
37
63
  *
@@ -71,22 +97,7 @@ class BufferPrimitiveCollection {
71
97
  _renderContext = null;
72
98
 
73
99
  /**
74
- * @param {object} options
75
- * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] Transforms geometry from model to world coordinates.
76
- * @param {number} [options.primitiveCountMax=BufferPrimitiveCollection.DEFAULT_CAPACITY]
77
- * @param {number} [options.vertexCountMax=BufferPrimitiveCollection.DEFAULT_CAPACITY]
78
- * @param {boolean} [options.show=true]
79
- * @param {ComponentDatatype} [options.positionDatatype=ComponentDatatype.DOUBLE]
80
- * @param {boolean} [options.positionNormalized=false] When <code>true</code>, integer position values are treated as normalized,
81
- * where the full integer range maps to [-1, 1] (signed) or [0, 1] (unsigned). Only relevant for integer position datatypes
82
- * (BYTE, UNSIGNED_BYTE, SHORT, UNSIGNED_SHORT).
83
- * @param {boolean} [options.allowPicking=false] When <code>true</code>, primitives are pickable with {@link Scene#pick}. When <code>false</code>, memory and initialization cost are lower.
84
- * @param {BoundingSphere} [options.boundingVolume] Bounding volume, in world space, for the collection. When
85
- * unspecified, a bounding volume is computed automatically and updated when primitive positions change. When
86
- * specified, users are responsible for updating bounding volume as needed. Pre-computing the bounding volume
87
- * manually, and updating it only as needed, will improve performance for larger dynamic collections.
88
- * @param {boolean} [options.debugShowBoundingVolume=false]
89
- * @param {BlendOption} [options.blendOption=BlendOption.TRANSLUCENT]
100
+ * @param {BufferPrimitiveCollectionOptions} [options]
90
101
  */
91
102
  constructor(options = Frozen.EMPTY_OBJECT) {
92
103
  /**
@@ -96,6 +107,13 @@ class BufferPrimitiveCollection {
96
107
  */
97
108
  this.show = options.show ?? true;
98
109
 
110
+ /**
111
+ * @type {HeightReference}
112
+ * @readonly
113
+ * @protected
114
+ */
115
+ this._heightReference = options.heightReference ?? HeightReference.NONE;
116
+
99
117
  /**
100
118
  * Collection blend option; must be OPAQUE or TRANSLUCENT.
101
119
  * @type {BlendOption}
@@ -148,11 +166,14 @@ class BufferPrimitiveCollection {
148
166
  this._pickIds = new Map();
149
167
 
150
168
  /**
169
+ * User-defined pick objects. Primitives without custom pick objects will have default
170
+ * pick objects assigned instead.
171
+ *
151
172
  * @type {object[]}
152
173
  * @readonly
153
174
  * @ignore
154
175
  */
155
- this._pickObjects = [];
176
+ this._customPickObjects = [];
156
177
 
157
178
  /**
158
179
  * This property is for debugging only; it is not for production use nor is it optimized.
@@ -194,7 +215,6 @@ class BufferPrimitiveCollection {
194
215
 
195
216
  /**
196
217
  * @type {number}
197
- * @protected
198
218
  * @ignore
199
219
  */
200
220
  this._positionCountMax =
@@ -249,6 +269,13 @@ class BufferPrimitiveCollection {
249
269
  */
250
270
  this._dirtyBoundingVolume = false;
251
271
 
272
+ /**
273
+ * Monotonically increasing counter, bumped each time collection is marked "clean".
274
+ * @type {number}
275
+ * @ignore
276
+ */
277
+ this._version = 0;
278
+
252
279
  this._allocatePrimitiveBuffer();
253
280
  this._allocatePositionBuffer();
254
281
  this._allocateMaterialBuffer();
@@ -336,7 +363,7 @@ class BufferPrimitiveCollection {
336
363
 
337
364
  /** Destroys collection and its GPU resources. */
338
365
  destroy() {
339
- this._pickObjects.length = 0;
366
+ this._customPickObjects.length = 0;
340
367
 
341
368
  for (const contextPickIds of this._pickIds.values()) {
342
369
  for (const pickId of contextPickIds) {
@@ -388,7 +415,7 @@ class BufferPrimitiveCollection {
388
415
  }
389
416
 
390
417
  // Copy primitives to temporary collection, in sort order.
391
- const tmp = CollectionClass._cloneEmpty(this);
418
+ const tmp = this._cloneEmpty();
392
419
  for (let i = 0; i < primitiveCount; i++) {
393
420
  const src = this.get(dstSrcMap[i], a);
394
421
  const dst = tmp.add({}, b);
@@ -418,9 +445,14 @@ class BufferPrimitiveCollection {
418
445
  *
419
446
  * @param {BufferPrimitiveCollection<T>} collection
420
447
  * @param {BufferPrimitiveCollection<T>} result
448
+ * @param {function(BufferPrimitive, number): boolean} [predicate] When provided, only primitives for which this returns <code>true</code> are copied. Surviving primitives are compacted into contiguous indices.
421
449
  * @template T extends BufferPrimitive
422
450
  */
423
- static clone(collection, result) {
451
+ static clone(collection, result, predicate) {
452
+ if (defined(predicate)) {
453
+ return this._cloneFiltered(collection, result, predicate);
454
+ }
455
+
424
456
  //>>includeStart('debug', pragmas.debug);
425
457
  const { ERR_CAPACITY } = BufferPrimitiveCollection.Error;
426
458
  assert(collection.primitiveCount <= result.primitiveCountMax, ERR_CAPACITY);
@@ -449,14 +481,19 @@ class BufferPrimitiveCollection {
449
481
  collection.primitiveCount * MaterialClass.packedLength,
450
482
  );
451
483
 
452
- result.show = collection.show;
453
- result.debugShowBoundingVolume = collection.debugShowBoundingVolume;
484
+ // Collection-level display flags (show, debugShowBoundingVolume) are carried
485
+ // by the constructor, so they are intentionally not copied here.
454
486
  result._primitiveCount = collection._primitiveCount;
455
487
  result._positionCount = collection._positionCount;
456
488
 
457
- // Unset PickIds.
489
+ // Copy per-primitive pick objects and unset each GPU PickId.
490
+ // PickIds are regenerated for the result collection on next render.
491
+ const srcPickObjects = collection._customPickObjects;
492
+ const dstPickObjects = result._customPickObjects;
493
+ dstPickObjects.length = 0;
458
494
  const primitive = new PrimitiveClass();
459
495
  for (let i = 0, il = result.primitiveCount; i < il; i++) {
496
+ dstPickObjects[i] = srcPickObjects[i];
460
497
  result.get(i, primitive)._pickId = 0;
461
498
  }
462
499
 
@@ -469,17 +506,123 @@ class BufferPrimitiveCollection {
469
506
  }
470
507
 
471
508
  /**
472
- * Returns an empty collection with the same buffer sizes as this collection.
473
- * Internal utility for operations requiring a working copy of memory.
509
+ * Filtered variant of {@link BufferPrimitiveCollection.clone}. Copies
510
+ * primitive-by-primitive via {@link BufferPrimitive.clone}, so it handles
511
+ * subclass data generically and needs no per-subclass override.
474
512
  *
475
513
  * @param {BufferPrimitiveCollection<T>} collection
514
+ * @param {BufferPrimitiveCollection<T>} result
515
+ * @param {function(BufferPrimitive, number): boolean} predicate
516
+ * @template T extends BufferPrimitive
517
+ * @protected
518
+ * @ignore
519
+ */
520
+ static _cloneFiltered(collection, result, predicate) {
521
+ const PrimitiveClass = collection._getPrimitiveClass();
522
+ const src = new PrimitiveClass();
523
+ const dst = new PrimitiveClass();
524
+
525
+ const srcPickObjects = collection._customPickObjects;
526
+ const dstPickObjects = result._customPickObjects;
527
+ dstPickObjects.length = 0;
528
+
529
+ for (let i = 0, il = collection._primitiveCount; i < il; i++) {
530
+ collection.get(i, src);
531
+ if (!predicate(src, i)) {
532
+ continue;
533
+ }
534
+
535
+ const dstIndex = result._primitiveCount;
536
+ PrimitiveClass.clone(src, result.add({}, dst));
537
+
538
+ if (defined(srcPickObjects[i])) {
539
+ dstPickObjects[dstIndex] = srcPickObjects[i];
540
+ }
541
+ }
542
+
543
+ return result;
544
+ }
545
+
546
+ /**
547
+ * Returns a copy of the given collection, overriding any constructor options
548
+ * provided. Omitted options are inherited from the source collection. Any
549
+ * resized buffers must be large enough to hold every primitive.
550
+ *
551
+ * <p>Collection-level state (model matrix, blend option, picking, bounding-volume
552
+ * mode, etc.) is carried over, but GPU resources are not: the source collection
553
+ * retains ownership of its renderer resources, so the caller is responsible for
554
+ * calling {@link BufferPrimitiveCollection#destroy} on the source once it is no
555
+ * longer needed.</p>
556
+ *
557
+ * @example
558
+ * const grown = BufferPrimitiveCollection.fromCollection(collection, {
559
+ * primitiveCountMax: collection.primitiveCountMax * 2,
560
+ * vertexCountMax: collection.vertexCountMax * 2,
561
+ * });
562
+ * collection.destroy(); // release the source collection's GPU resources
563
+ *
564
+ * @example
565
+ * // Grow while dropping hidden primitives.
566
+ * const compacted = BufferPrimitiveCollection.fromCollection(
567
+ * collection,
568
+ * { primitiveCountMax: collection.primitiveCountMax * 2 },
569
+ * (primitive) => primitive.show,
570
+ * );
571
+ *
572
+ * @param {BufferPrimitiveCollection<T>} collection Source collection to copy.
573
+ * @param {BufferPrimitiveCollectionOptions} [options] Constructor options to override. Omitted options are inherited from the source collection.
574
+ * @param {function(BufferPrimitive, number): boolean} [predicate] When provided, only primitives for which this returns <code>true</code> are copied. Surviving primitives are compacted into contiguous indices.
476
575
  * @returns {BufferPrimitiveCollection<T>}
477
576
  * @template T extends BufferPrimitive
577
+ */
578
+ static fromCollection(collection, options = Frozen.EMPTY_OBJECT, predicate) {
579
+ const result = collection._cloneEmpty(options);
580
+ collection._getCollectionClass().clone(collection, result, predicate);
581
+ return result;
582
+ }
583
+
584
+ /**
585
+ * Base constructor arguments that carry over collection-level state to an
586
+ * empty copy created by {@link BufferPrimitiveCollection.fromCollection}.
587
+ * Subclasses should spread the result into their constructor arguments,
588
+ * adding any type-specific options. Provided options override inherited
589
+ * state; omitted options are inherited from this collection.
590
+ *
591
+ * @param {BufferPrimitiveCollectionOptions} options
592
+ * @returns {object}
593
+ * @protected
594
+ * @ignore
595
+ */
596
+ _cloneEmptyBaseArgs(options) {
597
+ return {
598
+ primitiveCountMax: this.primitiveCountMax,
599
+ vertexCountMax: this.vertexCountMax,
600
+ positionDatatype: this.positionDatatype,
601
+ positionNormalized: this.positionNormalized,
602
+ modelMatrix: this._modelMatrix,
603
+ show: this.show,
604
+ debugShowBoundingVolume: this.debugShowBoundingVolume,
605
+ blendOption: this._blendOption,
606
+ allowPicking: this._allowPicking,
607
+ boundingVolume: this._boundingVolumeAutoUpdate
608
+ ? undefined
609
+ : this._boundingVolume,
610
+ ...options,
611
+ };
612
+ }
613
+
614
+ /**
615
+ * Returns an empty collection with the same structure as this one, overriding
616
+ * any constructor options provided. Omitted options are inherited from this
617
+ * collection.
618
+ *
619
+ * @param {BufferPrimitiveCollectionOptions} [options]
620
+ * @returns {BufferPrimitiveCollection<T>}
478
621
  * @protected
479
622
  * @abstract
480
623
  * @ignore
481
624
  */
482
- static _cloneEmpty(collection) {
625
+ _cloneEmpty(options) {
483
626
  DeveloperError.throwInstantiationError();
484
627
  }
485
628
 
@@ -524,13 +667,14 @@ class BufferPrimitiveCollection {
524
667
  vertices,
525
668
  Cartesian3.ZERO,
526
669
  3,
527
- this.boundingVolume,
670
+ this._boundingVolume,
528
671
  );
529
672
  BoundingSphere.transform(
530
- this.boundingVolume,
531
- this.modelMatrix,
532
- this.boundingVolume,
673
+ this._boundingVolume,
674
+ this._modelMatrix,
675
+ this._boundingVolume,
533
676
  );
677
+
534
678
  this._dirtyBoundingVolume = false;
535
679
  }
536
680
 
@@ -559,7 +703,7 @@ class BufferPrimitiveCollection {
559
703
  for (let i = pickIds.length, il = this._primitiveCount; i < il; i++) {
560
704
  this.get(i, primitive);
561
705
 
562
- const pickObject = this._pickObjects[i] || {
706
+ const pickObject = this._customPickObjects[i] || {
563
707
  collection: this,
564
708
  index: i,
565
709
  get primitive() {
@@ -637,7 +781,7 @@ class BufferPrimitiveCollection {
637
781
  result._dirty = true;
638
782
 
639
783
  if (defined(options.pickObject)) {
640
- this._pickObjects[index] = options.pickObject;
784
+ this._customPickObjects[index] = options.pickObject;
641
785
  }
642
786
 
643
787
  return result;
@@ -660,6 +804,18 @@ class BufferPrimitiveCollection {
660
804
  }
661
805
  }
662
806
 
807
+ /**
808
+ * Marks all primitives 'clean', and updates version counter.
809
+ * @ignore
810
+ */
811
+ _makeClean() {
812
+ if (this._dirtyCount > 0) {
813
+ this._dirtyCount = 0;
814
+ this._dirtyOffset = 0;
815
+ this._version++;
816
+ }
817
+ }
818
+
663
819
  /**
664
820
  * Marks collection bounding volume as 'dirty', to be updated on next render,
665
821
  * if automatic bounding volume updates are enabled.
@@ -686,11 +842,31 @@ class BufferPrimitiveCollection {
686
842
  if (this._dirtyBoundingVolume) {
687
843
  this._updateBoundingVolume();
688
844
  }
689
- if (this._allowPicking && this._dirtyCount > 0) {
845
+ // Not gated on the dirty count: a draped collection is packed by a surface,
846
+ // which may read the ids and mark the collection clean before this runs.
847
+ if (this._allowPicking) {
690
848
  this._updatePickIds(/** @type {FrameState} */ (frameState).context);
691
849
  }
692
850
  }
693
851
 
852
+ /**
853
+ * Whether the collection draws itself this frame. A draped collection is
854
+ * rendered by the surface it is draped onto.
855
+ *
856
+ * @param {FrameState} frameState
857
+ * @returns {boolean}
858
+ * @protected
859
+ * @ignore
860
+ */
861
+ _isRendered(frameState) {
862
+ const passes = frameState.passes;
863
+ return (
864
+ this.show &&
865
+ !isHeightReferenceClamp(this._heightReference) &&
866
+ (passes.render || passes.pick)
867
+ );
868
+ }
869
+
694
870
  /////////////////////////////////////////////////////////////////////////////
695
871
  // ACCESSORS
696
872
 
@@ -771,6 +947,9 @@ class BufferPrimitiveCollection {
771
947
  * @readonly
772
948
  */
773
949
  get boundingVolume() {
950
+ if (this._dirtyBoundingVolume) {
951
+ this._updateBoundingVolume();
952
+ }
774
953
  return this._boundingVolume;
775
954
  }
776
955
 
@@ -794,6 +973,19 @@ class BufferPrimitiveCollection {
794
973
  return this._positionNormalized;
795
974
  }
796
975
 
976
+ /**
977
+ * Determines which surfaces the collection is draped onto, in addition to
978
+ * being drawn as standalone geometry. Draping requires that the collection
979
+ * has been added to {@link Scene#primitives}.
980
+ *
981
+ * @type {HeightReference}
982
+ * @readonly
983
+ * @default HeightReference.NONE
984
+ */
985
+ get heightReference() {
986
+ return this._heightReference;
987
+ }
988
+
797
989
  /////////////////////////////////////////////////////////////////////////////
798
990
  // UTILS
799
991
 
@@ -3,6 +3,7 @@ import Cartesian2 from "../Core/Cartesian2.js";
3
3
  import Cartesian3 from "../Core/Cartesian3.js";
4
4
  import Cartesian4 from "../Core/Cartesian4.js";
5
5
  import Cartographic from "../Core/Cartographic.js";
6
+ import Check from "../Core/Check.js";
6
7
  import Frozen from "../Core/Frozen.js";
7
8
  import defined from "../Core/defined.js";
8
9
  import DeveloperError from "../Core/DeveloperError.js";
@@ -2356,7 +2357,7 @@ const scratchLookAtHeadingPitchRangeQuaternion1 = new Quaternion();
2356
2357
  const scratchLookAtHeadingPitchRangeQuaternion2 = new Quaternion();
2357
2358
  const scratchHeadingPitchRangeMatrix3 = new Matrix3();
2358
2359
 
2359
- function offsetFromHeadingPitchRange(heading, pitch, range) {
2360
+ function offsetFromHeadingPitchRange(heading, pitch, range, result) {
2360
2361
  pitch = CesiumMath.clamp(
2361
2362
  pitch,
2362
2363
  -CesiumMath.PI_OVER_TWO,
@@ -2380,10 +2381,7 @@ function offsetFromHeadingPitchRange(heading, pitch, range) {
2380
2381
  scratchHeadingPitchRangeMatrix3,
2381
2382
  );
2382
2383
 
2383
- const offset = Cartesian3.clone(
2384
- Cartesian3.UNIT_X,
2385
- scratchLookAtHeadingPitchRangeOffset,
2386
- );
2384
+ const offset = Cartesian3.clone(Cartesian3.UNIT_X, result);
2387
2385
  Matrix3.multiplyByVector(rotMatrix, offset, offset);
2388
2386
  Cartesian3.negate(offset, offset);
2389
2387
  Cartesian3.multiplyByScalar(offset, range, offset);
@@ -2441,6 +2439,7 @@ Camera.prototype.lookAtTransform = function (transform, offset) {
2441
2439
  offset.heading,
2442
2440
  offset.pitch,
2443
2441
  offset.range,
2442
+ scratchLookAtHeadingPitchRangeOffset,
2444
2443
  );
2445
2444
  } else {
2446
2445
  cartesianOffset = offset;
@@ -2492,6 +2491,72 @@ Camera.prototype.lookAtTransform = function (transform, offset) {
2492
2491
  this._adjustOrthographicFrustum(true);
2493
2492
  };
2494
2493
 
2494
+ const scratchLookAtWorldPositionTransform = new Matrix4();
2495
+ const scratchLookAtWorldPositionDirection = new Cartesian3();
2496
+ const scratchLookAtWorldPositionWorldUp = new Cartesian3();
2497
+ const scratchLookAtWorldPositionRight = new Cartesian3();
2498
+
2499
+ /**
2500
+ * Sets the camera orientation to look at a target position in world coordinates. The camera's up vector will be oriented to the world up vector at the target position.
2501
+ * If the camera is at the target position, the camera will be oriented to the world up vector at the target position.
2502
+ * @param {Cartesian3} target The target position in world coordinates.
2503
+ * @param {Ellipsoid} [ellipsoid=Ellipsoid.default] The ellipsoid to use for determining the world up.
2504
+ */
2505
+ Camera.prototype.lookAtWorldPosition = function (
2506
+ target,
2507
+ ellipsoid = Ellipsoid.default,
2508
+ ) {
2509
+ //>>includeStart('debug', pragmas.debug);
2510
+ Check.typeOf.object("target", target);
2511
+ Check.typeOf.object("ellipsoid", ellipsoid);
2512
+ //>>includeEnd('debug');
2513
+
2514
+ const transform = Matrix4.clone(
2515
+ this._transform,
2516
+ scratchLookAtWorldPositionTransform,
2517
+ );
2518
+
2519
+ this._setTransform(Matrix4.IDENTITY);
2520
+
2521
+ // Get direction to look at target
2522
+ let direction = Cartesian3.subtract(
2523
+ target,
2524
+ this.positionWC,
2525
+ scratchLookAtWorldPositionDirection,
2526
+ );
2527
+
2528
+ // If the camera is at the target position, we can't look at it, but we should still continue to re-orient the camera to the world up vector at the target position.
2529
+ if (Cartesian3.magnitudeSquared(direction) < CesiumMath.EPSILON8) {
2530
+ direction = Cartesian3.clone(
2531
+ this.directionWC,
2532
+ scratchLookAtWorldPositionDirection,
2533
+ );
2534
+ }
2535
+
2536
+ direction = Cartesian3.normalize(direction, this.direction);
2537
+
2538
+ // Orient the camera to the world up vector at the target position
2539
+ const worldUp = ellipsoid.geodeticSurfaceNormal(
2540
+ target,
2541
+ scratchLookAtWorldPositionWorldUp,
2542
+ );
2543
+
2544
+ let right = Cartesian3.cross(
2545
+ direction,
2546
+ worldUp,
2547
+ scratchLookAtWorldPositionRight,
2548
+ );
2549
+ if (Cartesian3.magnitudeSquared(right) < CesiumMath.EPSILON8) {
2550
+ right = Cartesian3.clone(this.rightWC, scratchLookAtWorldPositionRight);
2551
+ }
2552
+ Cartesian3.normalize(right, this.right);
2553
+
2554
+ const up = Cartesian3.cross(right, direction, this.up);
2555
+ Cartesian3.normalize(up, this.up);
2556
+
2557
+ this._setTransform(transform);
2558
+ };
2559
+
2495
2560
  const viewRectangle3DCartographic1 = new Cartographic();
2496
2561
  const viewRectangle3DCartographic2 = new Cartographic();
2497
2562
  const viewRectangle3DNorthEast = new Cartesian3();
@@ -3621,6 +3686,7 @@ Camera.prototype.flyToBoundingSphere = function (boundingSphere, options) {
3621
3686
  offset.heading,
3622
3687
  offset.pitch,
3623
3688
  offset.range,
3689
+ scratchflyToBoundingSphereDestination,
3624
3690
  );
3625
3691
  }
3626
3692