@cesium/engine 11.0.0 → 11.1.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 (748) hide show
  1. package/Build/Workers/{chunk-SIZXFNJY.js → chunk-26GA3JAM.js} +5 -5
  2. package/Build/Workers/{chunk-QGT2GMOK.js → chunk-27HUZ7SA.js} +4 -4
  3. package/Build/Workers/{chunk-BJ3WF5RW.js → chunk-2ZGOQXYU.js} +6 -6
  4. package/Build/Workers/{chunk-54VC7SCM.js → chunk-3Q2L65QU.js} +7 -7
  5. package/Build/Workers/{chunk-2MKRG7L7.js → chunk-472HQ3EH.js} +5 -5
  6. package/Build/Workers/{chunk-BZXF3GNX.js → chunk-5ODQSF26.js} +2 -2
  7. package/Build/Workers/{chunk-JYUCC5NV.js → chunk-5OOFQLKF.js} +6 -6
  8. package/Build/Workers/{chunk-6FFGOENI.js → chunk-5PTXS2GO.js} +46 -23
  9. package/Build/Workers/{chunk-T4MB73MC.js → chunk-6CHGCNMW.js} +2 -2
  10. package/Build/Workers/{chunk-IXLNNST6.js → chunk-76BYBWHP.js} +4 -4
  11. package/Build/Workers/{chunk-6PJIHPQB.js → chunk-7BMOHCPM.js} +13 -13
  12. package/Build/Workers/{chunk-HFMJM3SX.js → chunk-7JO7GPJN.js} +1 -1
  13. package/Build/Workers/{chunk-4TK5YR6Q.js → chunk-7KTQP4VB.js} +5 -5
  14. package/Build/Workers/{chunk-SRZJCF7G.js → chunk-7O373FFS.js} +8 -34
  15. package/Build/Workers/{chunk-OC4MYPVW.js → chunk-AD63PIY6.js} +2 -2
  16. package/Build/Workers/{chunk-HO2NTC7I.js → chunk-BHQJ2NT7.js} +6 -6
  17. package/Build/Workers/{chunk-IBG5FVXC.js → chunk-C6YYBQXW.js} +4 -4
  18. package/Build/Workers/{chunk-FJT3ERV7.js → chunk-CKY7HOHV.js} +9 -9
  19. package/Build/Workers/{chunk-4NBRIKB3.js → chunk-DHYHSFFJ.js} +2 -2
  20. package/Build/Workers/{chunk-KKAEXHDY.js → chunk-DI5NGJUP.js} +2 -2
  21. package/Build/Workers/{chunk-2RZYNSMR.js → chunk-E27BLMDD.js} +7 -9
  22. package/Build/Workers/{chunk-2EDC3QGH.js → chunk-E63IIM5T.js} +1 -1
  23. package/Build/Workers/{chunk-AI3O7UN2.js → chunk-E6V6SQZW.js} +6 -6
  24. package/Build/Workers/{chunk-RJF5ZP76.js → chunk-EJZTDTUH.js} +4 -4
  25. package/Build/Workers/{chunk-OOA6GXKD.js → chunk-FDOV2LBJ.js} +7 -7
  26. package/Build/Workers/{chunk-HBZSCVZC.js → chunk-FIGIZHAQ.js} +11 -11
  27. package/Build/Workers/{chunk-TTI2SUWJ.js → chunk-GESF4OXQ.js} +2 -2
  28. package/Build/Workers/{chunk-AUM45VEG.js → chunk-GGZJN2TI.js} +15 -15
  29. package/Build/Workers/{chunk-5IY5BXCT.js → chunk-GNBFYG7F.js} +83 -79
  30. package/Build/Workers/{chunk-6ZREIBKS.js → chunk-GWCFU2SA.js} +7 -7
  31. package/Build/Workers/{chunk-BUOFSNFW.js → chunk-I2ITFFPX.js} +1 -1
  32. package/Build/Workers/{chunk-AS7P4BHI.js → chunk-IBLIYJZR.js} +6 -6
  33. package/Build/Workers/{chunk-L6FARMF6.js → chunk-JW4FOI6M.js} +7 -7
  34. package/Build/Workers/{chunk-VSFFJGTA.js → chunk-K4GQUNB5.js} +5 -5
  35. package/Build/Workers/{chunk-BH5ZEN4I.js → chunk-M3GMB5OP.js} +10 -10
  36. package/Build/Workers/{chunk-HFPMX5L2.js → chunk-MXIZJAPH.js} +1 -1
  37. package/Build/Workers/{chunk-RFQYEYAL.js → chunk-N5KJGGCM.js} +18 -20
  38. package/Build/Workers/{chunk-WXDGOYTT.js → chunk-NGPPMXRM.js} +7 -7
  39. package/Build/Workers/{chunk-N3BIL6WA.js → chunk-O3E4OAOE.js} +13 -13
  40. package/Build/Workers/{chunk-DVAIU7A4.js → chunk-PGRPDNHG.js} +19 -23
  41. package/Build/Workers/{chunk-VHJ5ESXF.js → chunk-PRGYLLJT.js} +1 -1
  42. package/Build/Workers/{chunk-O5SSW3B3.js → chunk-S6MRMMQU.js} +6 -6
  43. package/Build/Workers/{chunk-XLCZE6DD.js → chunk-SMDOP47J.js} +10 -10
  44. package/Build/Workers/{chunk-WQRXRDCZ.js → chunk-TGONEMZO.js} +11 -11
  45. package/Build/Workers/{chunk-BBO6BGLC.js → chunk-TKVT5GQM.js} +13 -13
  46. package/Build/Workers/{chunk-KFW4UNQH.js → chunk-U72QNFOJ.js} +15 -25
  47. package/Build/Workers/{chunk-HZPMWR4H.js → chunk-VJZB3WAV.js} +7 -7
  48. package/Build/Workers/{chunk-OSCHEWSG.js → chunk-VU2MNO7L.js} +7 -7
  49. package/Build/Workers/{chunk-HA6TZ3XT.js → chunk-XY4BATBS.js} +4 -4
  50. package/Build/Workers/{chunk-DJXXI7UF.js → chunk-YFXQECWV.js} +5 -5
  51. package/Build/Workers/{chunk-GOHDOWU5.js → chunk-YSGTGQQO.js} +14 -14
  52. package/Build/Workers/{chunk-HC7RYWPZ.js → chunk-YZ733KKS.js} +12 -12
  53. package/Build/Workers/combineGeometry.js +23 -25
  54. package/Build/Workers/createBoxGeometry.js +16 -16
  55. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  56. package/Build/Workers/createCircleGeometry.js +24 -24
  57. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  60. package/Build/Workers/createCorridorGeometry.js +27 -27
  61. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  62. package/Build/Workers/createCylinderGeometry.js +18 -18
  63. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  64. package/Build/Workers/createEllipseGeometry.js +24 -24
  65. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  68. package/Build/Workers/createFrustumGeometry.js +16 -16
  69. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  70. package/Build/Workers/createGeometry.js +25 -26
  71. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  72. package/Build/Workers/createPlaneGeometry.js +14 -14
  73. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  74. package/Build/Workers/createPolygonGeometry.js +36 -40
  75. package/Build/Workers/createPolygonOutlineGeometry.js +40 -48
  76. package/Build/Workers/createPolylineGeometry.js +23 -23
  77. package/Build/Workers/createPolylineVolumeGeometry.js +32 -31
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  79. package/Build/Workers/createRectangleGeometry.js +28 -30
  80. package/Build/Workers/createRectangleOutlineGeometry.js +19 -19
  81. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  82. package/Build/Workers/createSphereGeometry.js +17 -17
  83. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  86. package/Build/Workers/createVectorTileGeometries.js +22 -22
  87. package/Build/Workers/createVectorTilePoints.js +12 -12
  88. package/Build/Workers/createVectorTilePolygons.js +20 -20
  89. package/Build/Workers/createVectorTilePolylines.js +13 -13
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -26
  91. package/Build/Workers/createVerticesFromHeightmap.js +22 -26
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +42 -32
  93. package/Build/Workers/createWallGeometry.js +22 -22
  94. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  95. package/Build/Workers/decodeDraco.js +11 -11
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +7 -7
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  101. package/Source/Core/ApproximateTerrainHeights.js +15 -15
  102. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +33 -35
  103. package/Source/Core/AttributeCompression.js +12 -12
  104. package/Source/Core/AxisAlignedBoundingBox.js +2 -2
  105. package/Source/Core/BingMapsGeocoderService.js +1 -1
  106. package/Source/Core/BoundingRectangle.js +3 -3
  107. package/Source/Core/BoundingSphere.js +44 -44
  108. package/Source/Core/BoxGeometry.js +6 -6
  109. package/Source/Core/BoxOutlineGeometry.js +3 -3
  110. package/Source/Core/Cartesian2.js +7 -7
  111. package/Source/Core/Cartesian3.js +20 -20
  112. package/Source/Core/Cartesian4.js +8 -8
  113. package/Source/Core/Cartographic.js +6 -6
  114. package/Source/Core/CatmullRomSpline.js +6 -6
  115. package/Source/Core/CesiumTerrainProvider.js +66 -68
  116. package/Source/Core/Check.d.ts +3 -3
  117. package/Source/Core/Check.js +11 -11
  118. package/Source/Core/CircleGeometry.js +6 -6
  119. package/Source/Core/CircleOutlineGeometry.js +4 -4
  120. package/Source/Core/Clock.js +4 -4
  121. package/Source/Core/Color.js +11 -8
  122. package/Source/Core/ColorGeometryInstanceAttribute.js +1 -1
  123. package/Source/Core/ComponentDatatype.js +4 -4
  124. package/Source/Core/CompressedTextureBuffer.js +2 -2
  125. package/Source/Core/ConstantSpline.js +1 -1
  126. package/Source/Core/CoplanarPolygonGeometry.js +44 -41
  127. package/Source/Core/CoplanarPolygonGeometryLibrary.js +5 -5
  128. package/Source/Core/CoplanarPolygonOutlineGeometry.js +6 -6
  129. package/Source/Core/CorridorGeometry.js +77 -77
  130. package/Source/Core/CorridorGeometryLibrary.js +45 -45
  131. package/Source/Core/CorridorOutlineGeometry.js +16 -16
  132. package/Source/Core/CullingVolume.js +4 -4
  133. package/Source/Core/CustomHeightmapTerrainProvider.js +13 -13
  134. package/Source/Core/CylinderGeometry.js +8 -8
  135. package/Source/Core/CylinderGeometryLibrary.js +1 -1
  136. package/Source/Core/CylinderOutlineGeometry.js +4 -4
  137. package/Source/Core/DeveloperError.js +1 -1
  138. package/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js +20 -21
  139. package/Source/Core/DoubleEndedPriorityQueue.js +2 -2
  140. package/Source/Core/EarthOrientationParameters.js +21 -25
  141. package/Source/Core/EarthOrientationParametersSample.js +1 -1
  142. package/Source/Core/EllipseGeometry.js +54 -55
  143. package/Source/Core/EllipseGeometryLibrary.js +12 -12
  144. package/Source/Core/EllipseOutlineGeometry.js +19 -19
  145. package/Source/Core/Ellipsoid.js +25 -33
  146. package/Source/Core/EllipsoidGeodesic.js +17 -16
  147. package/Source/Core/EllipsoidGeometry.js +9 -8
  148. package/Source/Core/EllipsoidOutlineGeometry.js +4 -4
  149. package/Source/Core/EllipsoidRhumbLine.js +33 -32
  150. package/Source/Core/EllipsoidTangentPlane.js +16 -16
  151. package/Source/Core/EllipsoidTerrainProvider.js +11 -10
  152. package/Source/Core/EllipsoidalOccluder.js +110 -130
  153. package/Source/Core/FeatureDetection.js +4 -4
  154. package/Source/Core/FrustumGeometry.js +14 -14
  155. package/Source/Core/FrustumOutlineGeometry.js +4 -4
  156. package/Source/Core/GeographicTilingScheme.js +6 -6
  157. package/Source/Core/Geometry.js +15 -17
  158. package/Source/Core/GeometryAttribute.js +4 -9
  159. package/Source/Core/GeometryAttributes.js +6 -6
  160. package/Source/Core/GeometryInstance.js +3 -4
  161. package/Source/Core/GeometryInstanceAttribute.js +1 -6
  162. package/Source/Core/GeometryPipeline.js +133 -137
  163. package/Source/Core/GoogleEarthEnterpriseMetadata.js +19 -20
  164. package/Source/Core/GoogleEarthEnterpriseTerrainData.js +25 -24
  165. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +17 -21
  166. package/Source/Core/GoogleEarthEnterpriseTileInformation.js +2 -2
  167. package/Source/Core/GoogleMaps.js +1 -1
  168. package/Source/Core/GregorianDate.js +4 -4
  169. package/Source/Core/GroundPolylineGeometry.js +104 -104
  170. package/Source/Core/HeadingPitchRoll.js +7 -7
  171. package/Source/Core/HeightmapTerrainData.js +58 -54
  172. package/Source/Core/HeightmapTessellator.js +22 -23
  173. package/Source/Core/HermitePolynomialApproximation.js +8 -8
  174. package/Source/Core/HermiteSpline.js +11 -11
  175. package/Source/Core/HilbertOrder.js +1 -1
  176. package/Source/Core/Iau2006XysData.js +6 -6
  177. package/Source/Core/IauOrientationAxes.js +2 -2
  178. package/Source/Core/IauOrientationParameters.js +1 -1
  179. package/Source/Core/IndexDatatype.js +5 -5
  180. package/Source/Core/IntersectionTests.js +36 -78
  181. package/Source/Core/Intersections2D.js +3 -3
  182. package/Source/Core/Ion.js +1 -1
  183. package/Source/Core/IonGeocoderService.js +2 -2
  184. package/Source/Core/IonResource.js +5 -5
  185. package/Source/Core/Iso8601.js +3 -3
  186. package/Source/Core/JulianDate.js +23 -33
  187. package/Source/Core/KTX2Transcoder.js +2 -2
  188. package/Source/Core/LagrangePolynomialApproximation.js +1 -1
  189. package/Source/Core/LinearApproximation.js +4 -4
  190. package/Source/Core/LinearSpline.js +2 -2
  191. package/Source/Core/Math.js +4 -4
  192. package/Source/Core/Matrix2.js +3 -3
  193. package/Source/Core/Matrix3.js +16 -16
  194. package/Source/Core/Matrix4.js +31 -31
  195. package/Source/Core/MorphWeightSpline.js +2 -2
  196. package/Source/Core/NearFarScalar.js +1 -1
  197. package/Source/Core/Occluder.js +52 -56
  198. package/Source/Core/OpenCageGeocoderService.js +2 -2
  199. package/Source/Core/OrientedBoundingBox.js +52 -51
  200. package/Source/Core/OrthographicFrustum.js +11 -11
  201. package/Source/Core/OrthographicOffCenterFrustum.js +17 -17
  202. package/Source/Core/PeliasGeocoderService.js +1 -1
  203. package/Source/Core/PerspectiveFrustum.js +61 -55
  204. package/Source/Core/PerspectiveOffCenterFrustum.js +58 -59
  205. package/Source/Core/PinBuilder.js +1 -1
  206. package/Source/Core/PixelFormat.js +6 -6
  207. package/Source/Core/Plane.js +9 -9
  208. package/Source/Core/PlaneGeometry.js +1 -1
  209. package/Source/Core/PolygonGeometry.js +95 -94
  210. package/Source/Core/PolygonGeometryLibrary.js +49 -51
  211. package/Source/Core/PolygonOutlineGeometry.js +49 -51
  212. package/Source/Core/PolygonPipeline.js +31 -31
  213. package/Source/Core/PolylineGeometry.js +10 -10
  214. package/Source/Core/PolylinePipeline.js +25 -25
  215. package/Source/Core/PolylineVolumeGeometry.js +9 -9
  216. package/Source/Core/PolylineVolumeGeometryLibrary.js +51 -51
  217. package/Source/Core/PolylineVolumeOutlineGeometry.js +6 -6
  218. package/Source/Core/QuadraticRealPolynomial.js +1 -1
  219. package/Source/Core/QuantizedMeshTerrainData.js +28 -28
  220. package/Source/Core/QuarticRealPolynomial.js +1 -1
  221. package/Source/Core/Quaternion.js +19 -19
  222. package/Source/Core/QuaternionSpline.js +2 -2
  223. package/Source/Core/Rectangle.js +34 -13
  224. package/Source/Core/RectangleCollisionChecker.js +3 -3
  225. package/Source/Core/RectangleGeometry.js +55 -56
  226. package/Source/Core/RectangleGeometryLibrary.js +8 -8
  227. package/Source/Core/RectangleOutlineGeometry.js +20 -20
  228. package/Source/Core/RequestScheduler.js +6 -6
  229. package/Source/Core/Resource.js +24 -24
  230. package/Source/Core/S2Cell.js +16 -80
  231. package/Source/Core/ScreenSpaceEventHandler.js +54 -53
  232. package/Source/Core/Simon1994PlanetaryPositions.js +13 -13
  233. package/Source/Core/SimplePolylineGeometry.js +7 -7
  234. package/Source/Core/SphereGeometry.js +2 -2
  235. package/Source/Core/SphereOutlineGeometry.js +3 -3
  236. package/Source/Core/Spline.js +1 -1
  237. package/Source/Core/SteppedSpline.js +1 -1
  238. package/Source/Core/Stereographic.js +9 -9
  239. package/Source/Core/TaskProcessor.js +13 -13
  240. package/Source/Core/TerrainEncoding.js +33 -38
  241. package/Source/Core/TerrainMesh.js +1 -1
  242. package/Source/Core/TerrainProvider.js +12 -12
  243. package/Source/Core/TileAvailability.js +28 -28
  244. package/Source/Core/TileProviderError.js +5 -5
  245. package/Source/Core/TilingScheme.js +1 -1
  246. package/Source/Core/TimeInterval.js +4 -4
  247. package/Source/Core/TimeIntervalCollection.js +16 -15
  248. package/Source/Core/Tipsify.js +2 -2
  249. package/Source/Core/Transforms.js +52 -54
  250. package/Source/Core/TranslationRotationScale.js +1 -1
  251. package/Source/Core/TridiagonalSystemSolver.js +4 -4
  252. package/Source/Core/VRTheWorldTerrainProvider.js +28 -26
  253. package/Source/Core/VertexFormat.js +6 -6
  254. package/Source/Core/VerticalExaggeration.js +4 -4
  255. package/Source/Core/VideoSynchronizer.js +1 -1
  256. package/Source/Core/WallGeometry.js +18 -18
  257. package/Source/Core/WallGeometryLibrary.js +7 -7
  258. package/Source/Core/WallOutlineGeometry.js +8 -8
  259. package/Source/Core/WebMercatorProjection.js +5 -6
  260. package/Source/Core/WebMercatorTilingScheme.js +13 -13
  261. package/Source/Core/WireframeIndexGenerator.js +8 -8
  262. package/Source/Core/arrayRemoveDuplicates.js +1 -1
  263. package/Source/Core/buildModuleUrl.js +2 -2
  264. package/Source/Core/decodeGoogleEarthEnterpriseData.js +3 -3
  265. package/Source/Core/decodeVectorPolylinePositions.js +4 -4
  266. package/Source/Core/destroyObject.js +1 -1
  267. package/Source/Core/getJsonFromTypedArray.js +1 -1
  268. package/Source/Core/getMagic.js +1 -1
  269. package/Source/Core/loadImageFromTypedArray.js +2 -2
  270. package/Source/Core/loadKTX2.js +1 -1
  271. package/Source/Core/pointInsideTriangle.js +1 -1
  272. package/Source/Core/resizeImageToNextPowerOfTwo.js +1 -1
  273. package/Source/Core/sampleTerrain.js +7 -7
  274. package/Source/Core/sampleTerrainMostDetailed.js +7 -7
  275. package/Source/Core/scaleToGeodeticSurface.js +3 -3
  276. package/Source/Core/srgbToLinear.js +1 -1
  277. package/Source/Core/writeTextToCanvas.js +1 -1
  278. package/Source/DataSources/BillboardGraphics.js +13 -13
  279. package/Source/DataSources/BillboardVisualizer.js +24 -24
  280. package/Source/DataSources/BoxGeometryUpdater.js +33 -32
  281. package/Source/DataSources/BoxGraphics.js +3 -3
  282. package/Source/DataSources/CallbackPositionProperty.js +173 -0
  283. package/Source/DataSources/Cesium3DTilesetGraphics.js +1 -1
  284. package/Source/DataSources/Cesium3DTilesetVisualizer.js +6 -6
  285. package/Source/DataSources/CheckerboardMaterialProperty.js +2 -2
  286. package/Source/DataSources/ColorMaterialProperty.js +1 -1
  287. package/Source/DataSources/CompositeEntityCollection.js +14 -15
  288. package/Source/DataSources/CompositeMaterialProperty.js +5 -7
  289. package/Source/DataSources/CompositePositionProperty.js +4 -5
  290. package/Source/DataSources/CompositeProperty.js +2 -2
  291. package/Source/DataSources/ConstantPositionProperty.js +2 -2
  292. package/Source/DataSources/CorridorGeometryUpdater.js +61 -56
  293. package/Source/DataSources/CorridorGraphics.js +6 -6
  294. package/Source/DataSources/CylinderGeometryUpdater.js +42 -40
  295. package/Source/DataSources/CylinderGraphics.js +4 -4
  296. package/Source/DataSources/CzmlDataSource.js +365 -368
  297. package/Source/DataSources/DataSourceCollection.js +1 -1
  298. package/Source/DataSources/DataSourceDisplay.js +23 -23
  299. package/Source/DataSources/DynamicGeometryBatch.js +2 -2
  300. package/Source/DataSources/DynamicGeometryUpdater.js +14 -18
  301. package/Source/DataSources/EllipseGeometryUpdater.js +67 -63
  302. package/Source/DataSources/EllipseGraphics.js +7 -7
  303. package/Source/DataSources/EllipsoidGeometryUpdater.js +88 -86
  304. package/Source/DataSources/EllipsoidGraphics.js +5 -5
  305. package/Source/DataSources/Entity.js +13 -13
  306. package/Source/DataSources/EntityCluster.js +29 -27
  307. package/Source/DataSources/EntityCollection.js +7 -7
  308. package/Source/DataSources/EntityView.js +23 -23
  309. package/Source/DataSources/GeoJsonDataSource.js +25 -25
  310. package/Source/DataSources/GeometryUpdater.js +9 -10
  311. package/Source/DataSources/GeometryUpdaterSet.js +3 -3
  312. package/Source/DataSources/GeometryVisualizer.js +65 -71
  313. package/Source/DataSources/GpxDataSource.js +10 -10
  314. package/Source/DataSources/GridMaterialProperty.js +5 -5
  315. package/Source/DataSources/GroundGeometryUpdater.js +6 -6
  316. package/Source/DataSources/ImageMaterialProperty.js +2 -2
  317. package/Source/DataSources/KmlDataSource.js +212 -212
  318. package/Source/DataSources/LabelGraphics.js +14 -14
  319. package/Source/DataSources/LabelVisualizer.js +24 -24
  320. package/Source/DataSources/ModelGraphics.js +37 -17
  321. package/Source/DataSources/ModelVisualizer.js +41 -32
  322. package/Source/DataSources/NodeTransformationProperty.js +3 -3
  323. package/Source/DataSources/PathGraphics.js +2 -2
  324. package/Source/DataSources/PathVisualizer.js +99 -35
  325. package/Source/DataSources/PlaneGeometryUpdater.js +38 -37
  326. package/Source/DataSources/PlaneGraphics.js +2 -2
  327. package/Source/DataSources/PointGraphics.js +8 -8
  328. package/Source/DataSources/PointVisualizer.js +29 -29
  329. package/Source/DataSources/PolygonGeometryUpdater.js +68 -64
  330. package/Source/DataSources/PolygonGraphics.js +9 -9
  331. package/Source/DataSources/PolylineArrowMaterialProperty.js +1 -1
  332. package/Source/DataSources/PolylineDashMaterialProperty.js +4 -4
  333. package/Source/DataSources/PolylineGeometryUpdater.js +39 -44
  334. package/Source/DataSources/PolylineGlowMaterialProperty.js +3 -3
  335. package/Source/DataSources/PolylineGraphics.js +4 -4
  336. package/Source/DataSources/PolylineOutlineMaterialProperty.js +3 -3
  337. package/Source/DataSources/PolylineVisualizer.js +39 -43
  338. package/Source/DataSources/PolylineVolumeGeometryUpdater.js +70 -68
  339. package/Source/DataSources/PolylineVolumeGraphics.js +2 -2
  340. package/Source/DataSources/PositionProperty.js +4 -3
  341. package/Source/DataSources/PositionPropertyArray.js +3 -3
  342. package/Source/DataSources/Property.js +1 -1
  343. package/Source/DataSources/PropertyArray.js +1 -1
  344. package/Source/DataSources/PropertyBag.js +5 -5
  345. package/Source/DataSources/RectangleGeometryUpdater.js +68 -63
  346. package/Source/DataSources/RectangleGraphics.js +6 -6
  347. package/Source/DataSources/ReferenceProperty.js +6 -6
  348. package/Source/DataSources/Rotation.js +2 -2
  349. package/Source/DataSources/SampledPositionProperty.js +6 -6
  350. package/Source/DataSources/SampledProperty.js +16 -16
  351. package/Source/DataSources/ScaledPositionProperty.js +2 -2
  352. package/Source/DataSources/StaticGeometryColorBatch.js +41 -41
  353. package/Source/DataSources/StaticGeometryPerMaterialBatch.js +40 -40
  354. package/Source/DataSources/StaticGroundGeometryColorBatch.js +26 -27
  355. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +46 -44
  356. package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +44 -43
  357. package/Source/DataSources/StaticOutlineGeometryBatch.js +28 -29
  358. package/Source/DataSources/StripeMaterialProperty.js +2 -2
  359. package/Source/DataSources/TerrainOffsetProperty.js +11 -11
  360. package/Source/DataSources/TimeIntervalCollectionPositionProperty.js +28 -30
  361. package/Source/DataSources/TimeIntervalCollectionProperty.js +1 -1
  362. package/Source/DataSources/VelocityOrientationProperty.js +3 -3
  363. package/Source/DataSources/VelocityVectorProperty.js +4 -4
  364. package/Source/DataSources/WallGeometryUpdater.js +25 -25
  365. package/Source/DataSources/WallGraphics.js +4 -4
  366. package/Source/DataSources/createPropertyDescriptor.js +3 -3
  367. package/Source/DataSources/exportKml.js +90 -86
  368. package/Source/DataSources/getElement.js +1 -1
  369. package/Source/DataSources/heightReferenceOnEntityPropertyChanged.js +4 -4
  370. package/Source/Renderer/AutomaticUniforms.js +1 -1
  371. package/Source/Renderer/Buffer.js +18 -18
  372. package/Source/Renderer/ClearCommand.js +1 -1
  373. package/Source/Renderer/ComputeEngine.js +1 -1
  374. package/Source/Renderer/Context.js +40 -40
  375. package/Source/Renderer/CubeMap.js +20 -20
  376. package/Source/Renderer/CubeMapFace.js +19 -19
  377. package/Source/Renderer/DrawCommand.js +50 -5
  378. package/Source/Renderer/Framebuffer.js +48 -49
  379. package/Source/Renderer/FramebufferManager.js +40 -34
  380. package/Source/Renderer/MultisampleFramebuffer.js +35 -14
  381. package/Source/Renderer/RenderState.js +36 -36
  382. package/Source/Renderer/Renderbuffer.js +3 -3
  383. package/Source/Renderer/Sampler.js +2 -2
  384. package/Source/Renderer/ShaderBuilder.js +8 -8
  385. package/Source/Renderer/ShaderCache.js +11 -15
  386. package/Source/Renderer/ShaderFunction.js +1 -1
  387. package/Source/Renderer/ShaderProgram.js +15 -15
  388. package/Source/Renderer/ShaderSource.js +40 -40
  389. package/Source/Renderer/Texture.js +74 -63
  390. package/Source/Renderer/UniformState.js +65 -58
  391. package/Source/Renderer/VertexArray.js +20 -20
  392. package/Source/Renderer/VertexArrayFacade.js +15 -16
  393. package/Source/Renderer/createUniform.js +1 -1
  394. package/Source/Renderer/createUniformArray.js +4 -4
  395. package/Source/Renderer/demodernizeShader.js +5 -5
  396. package/Source/Renderer/loadCubeMap.js +1 -1
  397. package/Source/Scene/ArcGisMapServerImageryProvider.js +39 -45
  398. package/Source/Scene/ArcGisMapService.js +4 -7
  399. package/Source/Scene/AutoExposure.js +4 -5
  400. package/Source/Scene/Axis.js +6 -6
  401. package/Source/Scene/B3dmParser.js +9 -9
  402. package/Source/Scene/BatchTable.js +7 -7
  403. package/Source/Scene/BatchTableHierarchy.js +62 -59
  404. package/Source/Scene/BatchTexture.js +2 -2
  405. package/Source/Scene/Billboard.js +45 -43
  406. package/Source/Scene/BillboardCollection.js +81 -83
  407. package/Source/Scene/BingMapsImageryProvider.js +13 -13
  408. package/Source/Scene/BoundingVolumeSemantics.js +10 -10
  409. package/Source/Scene/BoxEmitter.js +1 -1
  410. package/Source/Scene/BufferLoader.js +1 -1
  411. package/Source/Scene/Camera.js +161 -164
  412. package/Source/Scene/CameraEventAggregator.js +18 -18
  413. package/Source/Scene/CameraFlightPath.js +25 -25
  414. package/Source/Scene/Cesium3DTile.js +89 -95
  415. package/Source/Scene/Cesium3DTileBatchTable.js +61 -61
  416. package/Source/Scene/Cesium3DTileContentFactory.js +7 -7
  417. package/Source/Scene/Cesium3DTileFeature.js +1 -1
  418. package/Source/Scene/Cesium3DTileFeatureTable.js +8 -8
  419. package/Source/Scene/Cesium3DTileOptimizations.js +1 -1
  420. package/Source/Scene/Cesium3DTilePointFeature.js +11 -11
  421. package/Source/Scene/Cesium3DTileStyle.js +26 -24
  422. package/Source/Scene/Cesium3DTilesVoxelProvider.js +14 -20
  423. package/Source/Scene/Cesium3DTileset.js +81 -83
  424. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +8 -16
  425. package/Source/Scene/Cesium3DTilesetCache.js +2 -2
  426. package/Source/Scene/Cesium3DTilesetHeatmap.js +5 -5
  427. package/Source/Scene/Cesium3DTilesetMetadata.js +2 -2
  428. package/Source/Scene/Cesium3DTilesetMostDetailedTraversal.js +2 -2
  429. package/Source/Scene/Cesium3DTilesetSkipTraversal.js +8 -12
  430. package/Source/Scene/Cesium3DTilesetStatistics.js +1 -1
  431. package/Source/Scene/Cesium3DTilesetTraversal.js +8 -10
  432. package/Source/Scene/ClassificationPrimitive.js +70 -69
  433. package/Source/Scene/ClippingPlaneCollection.js +39 -41
  434. package/Source/Scene/ClippingPolygon.js +8 -8
  435. package/Source/Scene/ClippingPolygonCollection.js +62 -63
  436. package/Source/Scene/CloudCollection.js +3 -10
  437. package/Source/Scene/Composite3DTileContent.js +6 -6
  438. package/Source/Scene/ConditionsExpression.js +5 -5
  439. package/Source/Scene/ContentMetadata.js +4 -4
  440. package/Source/Scene/CreditDisplay.js +8 -8
  441. package/Source/Scene/CumulusCloud.js +4 -4
  442. package/Source/Scene/DebugAppearance.js +2 -2
  443. package/Source/Scene/DebugCameraPrimitive.js +2 -2
  444. package/Source/Scene/DebugInspector.js +3 -3
  445. package/Source/Scene/DebugModelMatrixPrimitive.js +4 -4
  446. package/Source/Scene/DepthPlane.js +7 -7
  447. package/Source/Scene/DerivedCommand.js +422 -238
  448. package/Source/Scene/DiscardMissingTileImagePolicy.js +1 -1
  449. package/Source/Scene/DracoLoader.js +3 -3
  450. package/Source/Scene/EllipsoidPrimitive.js +7 -7
  451. package/Source/Scene/EllipsoidSurfaceAppearance.js +3 -3
  452. package/Source/Scene/Empty3DTileContent.js +1 -1
  453. package/Source/Scene/Expression.js +91 -91
  454. package/Source/Scene/Fog.js +8 -41
  455. package/Source/Scene/FrameRateMonitor.js +22 -22
  456. package/Source/Scene/FrameState.js +31 -0
  457. package/Source/Scene/Geometry3DTileContent.js +20 -20
  458. package/Source/Scene/GetFeatureInfoFormat.js +15 -14
  459. package/Source/Scene/Globe.js +32 -27
  460. package/Source/Scene/GlobeDepth.js +95 -66
  461. package/Source/Scene/GlobeSurfaceShaderSet.js +12 -10
  462. package/Source/Scene/GlobeSurfaceTile.js +33 -33
  463. package/Source/Scene/GlobeSurfaceTileProvider.js +127 -124
  464. package/Source/Scene/GlobeTranslucency.js +4 -4
  465. package/Source/Scene/GlobeTranslucencyFramebuffer.js +9 -9
  466. package/Source/Scene/GlobeTranslucencyState.js +53 -55
  467. package/Source/Scene/GltfBufferViewLoader.js +2 -2
  468. package/Source/Scene/GltfIndexBufferLoader.js +5 -5
  469. package/Source/Scene/GltfJsonLoader.js +2 -2
  470. package/Source/Scene/GltfLoader.js +177 -100
  471. package/Source/Scene/GltfStructuralMetadataLoader.js +9 -8
  472. package/Source/Scene/GltfTextureLoader.js +5 -5
  473. package/Source/Scene/GltfVertexBufferLoader.js +12 -13
  474. package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +9 -9
  475. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +9 -9
  476. package/Source/Scene/GridImageryProvider.js +2 -2
  477. package/Source/Scene/GroundPolylinePrimitive.js +38 -39
  478. package/Source/Scene/GroundPrimitive.js +47 -45
  479. package/Source/Scene/GroupMetadata.js +4 -4
  480. package/Source/Scene/I3SDataProvider.js +12 -12
  481. package/Source/Scene/I3SDecoder.js +7 -8
  482. package/Source/Scene/I3SField.js +8 -8
  483. package/Source/Scene/I3SGeometry.js +14 -14
  484. package/Source/Scene/I3SLayer.js +26 -20
  485. package/Source/Scene/I3SNode.js +17 -17
  486. package/Source/Scene/I3SSublayer.js +4 -4
  487. package/Source/Scene/I3SSymbology.js +8 -8
  488. package/Source/Scene/I3dmParser.js +9 -9
  489. package/Source/Scene/ImageBasedLighting.js +25 -23
  490. package/Source/Scene/Imagery.js +3 -3
  491. package/Source/Scene/ImageryLayer.js +64 -66
  492. package/Source/Scene/ImageryLayerCollection.js +13 -15
  493. package/Source/Scene/ImageryLayerFeatureInfo.js +19 -20
  494. package/Source/Scene/ImageryProvider.js +1 -1
  495. package/Source/Scene/Implicit3DTileContent.js +34 -37
  496. package/Source/Scene/ImplicitAvailabilityBitstream.js +2 -2
  497. package/Source/Scene/ImplicitMetadataView.js +2 -2
  498. package/Source/Scene/ImplicitSubtree.js +29 -30
  499. package/Source/Scene/ImplicitSubtreeCache.js +1 -1
  500. package/Source/Scene/ImplicitSubtreeMetadata.js +5 -5
  501. package/Source/Scene/ImplicitTileCoordinates.js +11 -11
  502. package/Source/Scene/ImplicitTileset.js +2 -2
  503. package/Source/Scene/InvertClassification.js +7 -7
  504. package/Source/Scene/IonImageryProvider.js +6 -6
  505. package/Source/Scene/JobScheduler.js +4 -4
  506. package/Source/Scene/Label.js +29 -29
  507. package/Source/Scene/LabelCollection.js +17 -15
  508. package/Source/Scene/MapboxImageryProvider.js +3 -3
  509. package/Source/Scene/MapboxStyleImageryProvider.js +4 -4
  510. package/Source/Scene/Material.js +26 -27
  511. package/Source/Scene/MaterialAppearance.js +4 -4
  512. package/Source/Scene/Megatexture.js +21 -24
  513. package/Source/Scene/MetadataClassProperty.js +11 -11
  514. package/Source/Scene/MetadataComponentType.js +1 -1
  515. package/Source/Scene/MetadataEntity.js +8 -8
  516. package/Source/Scene/MetadataEnum.js +1 -1
  517. package/Source/Scene/MetadataPicking.js +305 -0
  518. package/Source/Scene/MetadataSchemaLoader.js +1 -1
  519. package/Source/Scene/MetadataTable.js +2 -2
  520. package/Source/Scene/MetadataTableProperty.js +22 -22
  521. package/Source/Scene/Model/AlphaPipelineStage.js +2 -2
  522. package/Source/Scene/Model/AtmospherePipelineStage.js +3 -3
  523. package/Source/Scene/Model/B3dmLoader.js +8 -8
  524. package/Source/Scene/Model/BatchTexturePipelineStage.js +2 -2
  525. package/Source/Scene/Model/CPUStylingPipelineStage.js +4 -4
  526. package/Source/Scene/Model/ClassificationModelDrawCommand.js +8 -8
  527. package/Source/Scene/Model/ClassificationPipelineStage.js +5 -5
  528. package/Source/Scene/Model/CustomShader.js +9 -9
  529. package/Source/Scene/Model/CustomShaderPipelineStage.js +37 -38
  530. package/Source/Scene/Model/DequantizationPipelineStage.js +5 -5
  531. package/Source/Scene/Model/Extensions/Gpm/AnchorPointDirect.js +61 -0
  532. package/Source/Scene/Model/Extensions/Gpm/AnchorPointIndirect.js +77 -0
  533. package/Source/Scene/Model/Extensions/Gpm/CorrelationGroup.js +81 -0
  534. package/Source/Scene/Model/Extensions/Gpm/GltfGpmLoader.js +248 -0
  535. package/Source/Scene/Model/Extensions/Gpm/GltfGpmLocal.js +179 -0
  536. package/Source/Scene/Model/Extensions/Gpm/GltfMeshPrimitiveGpmLoader.js +548 -0
  537. package/Source/Scene/Model/Extensions/Gpm/MeshPrimitiveGpmLocal.js +28 -0
  538. package/Source/Scene/Model/Extensions/Gpm/PpeMetadata.js +79 -0
  539. package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +75 -0
  540. package/Source/Scene/Model/Extensions/Gpm/PpeTexture.js +127 -0
  541. package/Source/Scene/Model/Extensions/Gpm/Spdcf.js +103 -0
  542. package/Source/Scene/Model/Extensions/Gpm/StorageType.js +30 -0
  543. package/Source/Scene/Model/FeatureIdPipelineStage.js +40 -40
  544. package/Source/Scene/Model/GeoJsonLoader.js +17 -17
  545. package/Source/Scene/Model/GeometryPipelineStage.js +23 -24
  546. package/Source/Scene/Model/I3dmLoader.js +36 -36
  547. package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +15 -15
  548. package/Source/Scene/Model/InstancingPipelineStage.js +86 -86
  549. package/Source/Scene/Model/LightingPipelineStage.js +4 -4
  550. package/Source/Scene/Model/MaterialPipelineStage.js +78 -93
  551. package/Source/Scene/Model/MetadataPickingPipelineStage.js +96 -0
  552. package/Source/Scene/Model/MetadataPipelineStage.js +39 -47
  553. package/Source/Scene/Model/Model.js +134 -54
  554. package/Source/Scene/Model/Model3DTileContent.js +32 -13
  555. package/Source/Scene/Model/ModelAnimationChannel.js +2 -2
  556. package/Source/Scene/Model/ModelAnimationCollection.js +9 -9
  557. package/Source/Scene/Model/ModelArticulation.js +2 -2
  558. package/Source/Scene/Model/ModelArticulationStage.js +4 -4
  559. package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +11 -11
  560. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +6 -6
  561. package/Source/Scene/Model/ModelColorPipelineStage.js +12 -13
  562. package/Source/Scene/Model/ModelDrawCommand.js +5 -5
  563. package/Source/Scene/Model/{buildDrawCommand.js → ModelDrawCommands.js} +85 -28
  564. package/Source/Scene/Model/ModelFeatureTable.js +5 -5
  565. package/Source/Scene/Model/ModelMatrixUpdateStage.js +24 -12
  566. package/Source/Scene/Model/ModelRenderResources.js +1 -1
  567. package/Source/Scene/Model/ModelRuntimeNode.js +15 -15
  568. package/Source/Scene/Model/ModelRuntimePrimitive.js +8 -5
  569. package/Source/Scene/Model/ModelSceneGraph.js +42 -43
  570. package/Source/Scene/Model/ModelSilhouettePipelineStage.js +4 -4
  571. package/Source/Scene/Model/ModelSkin.js +4 -4
  572. package/Source/Scene/Model/ModelSplitterPipelineStage.js +8 -9
  573. package/Source/Scene/Model/ModelUtility.js +5 -5
  574. package/Source/Scene/Model/MorphTargetsPipelineStage.js +18 -18
  575. package/Source/Scene/Model/NodeRenderResources.js +1 -1
  576. package/Source/Scene/Model/NodeStatisticsPipelineStage.js +1 -1
  577. package/Source/Scene/Model/PickingPipelineStage.js +5 -5
  578. package/Source/Scene/Model/PntsLoader.js +7 -7
  579. package/Source/Scene/Model/PointCloudStylingPipelineStage.js +22 -23
  580. package/Source/Scene/Model/PrimitiveOutlineGenerator.js +6 -6
  581. package/Source/Scene/Model/PrimitiveOutlinePipelineStage.js +7 -7
  582. package/Source/Scene/Model/PrimitiveRenderResources.js +3 -3
  583. package/Source/Scene/Model/PrimitiveStatisticsPipelineStage.js +1 -1
  584. package/Source/Scene/Model/SceneMode2DPipelineStage.js +23 -23
  585. package/Source/Scene/Model/SelectedFeatureIdPipelineStage.js +10 -14
  586. package/Source/Scene/Model/SkinningPipelineStage.js +5 -5
  587. package/Source/Scene/Model/StyleCommandsNeeded.js +1 -1
  588. package/Source/Scene/Model/TextureManager.js +2 -2
  589. package/Source/Scene/Model/TextureUniform.js +3 -3
  590. package/Source/Scene/Model/TilesetPipelineStage.js +2 -2
  591. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -4
  592. package/Source/Scene/Model/WireframePipelineStage.js +7 -7
  593. package/Source/Scene/Model/pickModel.js +26 -26
  594. package/Source/Scene/ModelComponents.js +13 -4
  595. package/Source/Scene/Moon.js +6 -5
  596. package/Source/Scene/Multiple3DTileContent.js +15 -14
  597. package/Source/Scene/OIT.js +48 -97
  598. package/Source/Scene/OpenStreetMapImageryProvider.js +8 -7
  599. package/Source/Scene/OrderedGroundPrimitiveCollection.js +2 -2
  600. package/Source/Scene/Particle.js +3 -3
  601. package/Source/Scene/ParticleEmitter.js +1 -1
  602. package/Source/Scene/ParticleSystem.js +32 -32
  603. package/Source/Scene/PerInstanceColorAppearance.js +1 -1
  604. package/Source/Scene/PickDepth.js +16 -4
  605. package/Source/Scene/PickDepthFramebuffer.js +1 -1
  606. package/Source/Scene/PickFramebuffer.js +24 -12
  607. package/Source/Scene/PickedMetadataInfo.js +39 -0
  608. package/Source/Scene/Picking.js +270 -120
  609. package/Source/Scene/PntsParser.js +28 -28
  610. package/Source/Scene/PointCloud.js +39 -38
  611. package/Source/Scene/PointCloudEyeDomeLighting.js +6 -6
  612. package/Source/Scene/PointCloudShading.js +3 -3
  613. package/Source/Scene/PointPrimitive.js +31 -28
  614. package/Source/Scene/PointPrimitiveCollection.js +34 -33
  615. package/Source/Scene/Polyline.js +9 -9
  616. package/Source/Scene/PolylineCollection.js +55 -57
  617. package/Source/Scene/PolylineColorAppearance.js +3 -3
  618. package/Source/Scene/PolylineMaterialAppearance.js +3 -3
  619. package/Source/Scene/PostProcessStage.js +95 -115
  620. package/Source/Scene/PostProcessStageCollection.js +35 -41
  621. package/Source/Scene/PostProcessStageComposite.js +2 -2
  622. package/Source/Scene/PostProcessStageLibrary.js +5 -5
  623. package/Source/Scene/PostProcessStageTextureCache.js +10 -10
  624. package/Source/Scene/Primitive.js +93 -93
  625. package/Source/Scene/PrimitiveCollection.js +1 -1
  626. package/Source/Scene/PrimitiveLoadPlan.js +1 -1
  627. package/Source/Scene/PrimitivePipeline.js +30 -30
  628. package/Source/Scene/PropertyTable.js +5 -5
  629. package/Source/Scene/PropertyTextureProperty.js +36 -7
  630. package/Source/Scene/QuadtreePrimitive.js +56 -58
  631. package/Source/Scene/QuadtreeTile.js +4 -4
  632. package/Source/Scene/QuadtreeTileProvider.js +1 -1
  633. package/Source/Scene/ResourceCache.js +7 -7
  634. package/Source/Scene/ResourceCacheKey.js +15 -15
  635. package/Source/Scene/Scene.js +879 -657
  636. package/Source/Scene/SceneFramebuffer.js +2 -2
  637. package/Source/Scene/SceneTransforms.js +30 -30
  638. package/Source/Scene/SceneTransitioner.js +47 -47
  639. package/Source/Scene/ScreenSpaceCameraController.js +160 -153
  640. package/Source/Scene/SensorVolumePortionToDisplay.js +1 -1
  641. package/Source/Scene/ShadowMap.js +71 -72
  642. package/Source/Scene/ShadowMapShader.js +9 -9
  643. package/Source/Scene/ShadowVolumeAppearance.js +39 -39
  644. package/Source/Scene/SingleTileImageryProvider.js +3 -3
  645. package/Source/Scene/SkyAtmosphere.js +8 -8
  646. package/Source/Scene/SkyBox.js +7 -8
  647. package/Source/Scene/SpatialNode.js +13 -13
  648. package/Source/Scene/SphereEmitter.js +1 -1
  649. package/Source/Scene/StructuralMetadata.js +1 -1
  650. package/Source/Scene/StyleExpression.js +1 -1
  651. package/Source/Scene/Sun.js +11 -7
  652. package/Source/Scene/SunPostProcess.js +6 -6
  653. package/Source/Scene/TerrainFillMesh.js +157 -156
  654. package/Source/Scene/TextureAtlas.js +11 -11
  655. package/Source/Scene/TileBoundingRegion.js +31 -31
  656. package/Source/Scene/TileBoundingS2Cell.js +37 -40
  657. package/Source/Scene/TileBoundingSphere.js +2 -2
  658. package/Source/Scene/TileCoordinatesImageryProvider.js +3 -3
  659. package/Source/Scene/TileImagery.js +7 -11
  660. package/Source/Scene/TileMapServiceImageryProvider.js +26 -25
  661. package/Source/Scene/TileMetadata.js +4 -4
  662. package/Source/Scene/TileOrientedBoundingBox.js +6 -6
  663. package/Source/Scene/Tileset3DTileContent.js +1 -1
  664. package/Source/Scene/TilesetMetadata.js +4 -4
  665. package/Source/Scene/TimeDynamicImagery.js +3 -3
  666. package/Source/Scene/TimeDynamicPointCloud.js +9 -9
  667. package/Source/Scene/TranslucentTileClassification.js +48 -58
  668. package/Source/Scene/TweenCollection.js +9 -9
  669. package/Source/Scene/UrlTemplateImageryProvider.js +23 -23
  670. package/Source/Scene/Vector3DTileClampedPolylines.js +21 -21
  671. package/Source/Scene/Vector3DTileContent.js +38 -39
  672. package/Source/Scene/Vector3DTileGeometry.js +11 -8
  673. package/Source/Scene/Vector3DTilePoints.js +18 -22
  674. package/Source/Scene/Vector3DTilePolygons.js +6 -6
  675. package/Source/Scene/Vector3DTilePolylines.js +8 -8
  676. package/Source/Scene/Vector3DTilePrimitive.js +30 -31
  677. package/Source/Scene/View.js +111 -80
  678. package/Source/Scene/VoxelBoxShape.js +34 -34
  679. package/Source/Scene/VoxelCell.js +7 -7
  680. package/Source/Scene/VoxelContent.js +1 -1
  681. package/Source/Scene/VoxelCylinderShape.js +48 -48
  682. package/Source/Scene/VoxelEllipsoidShape.js +83 -97
  683. package/Source/Scene/VoxelPrimitive.js +80 -80
  684. package/Source/Scene/VoxelRenderResources.js +13 -13
  685. package/Source/Scene/VoxelTraversal.js +41 -41
  686. package/Source/Scene/WebMapServiceImageryProvider.js +12 -12
  687. package/Source/Scene/WebMapTileServiceImageryProvider.js +8 -8
  688. package/Source/Scene/buildVoxelDrawCommands.js +10 -14
  689. package/Source/Scene/computeFlyToLocationForRectangle.js +7 -5
  690. package/Source/Scene/createBillboardPointCallback.js +2 -2
  691. package/Source/Scene/createElevationBandMaterial.js +8 -8
  692. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
  693. package/Source/Scene/createOsmBuildingsAsync.js +1 -1
  694. package/Source/Scene/createTangentSpaceDebugPrimitive.js +7 -7
  695. package/Source/Scene/findContentMetadata.js +2 -2
  696. package/Source/Scene/findTileMetadata.js +2 -2
  697. package/Source/Scene/getBinaryAccessor.js +1 -1
  698. package/Source/Scene/getClipAndStyleCode.js +1 -1
  699. package/Source/Scene/getClippingFunction.js +1 -1
  700. package/Source/Scene/getMetadataClassProperty.js +43 -0
  701. package/Source/Scene/parseBatchTable.js +21 -24
  702. package/Source/Scene/parseFeatureMetadataLegacy.js +3 -3
  703. package/Source/Scene/parseStructuralMetadata.js +3 -3
  704. package/Source/Scene/processVoxelProperties.js +28 -33
  705. package/Source/Shaders/Builtin/Functions/packDepth.glsl +2 -2
  706. package/Source/Shaders/Builtin/Functions/packDepth.js +2 -2
  707. package/Source/Shaders/Builtin/Functions/unpackDepth.glsl +3 -3
  708. package/Source/Shaders/Builtin/Functions/unpackDepth.js +3 -3
  709. package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +1 -1
  710. package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +1 -1
  711. package/Source/Shaders/Builtin/Functions/writeLogDepth.glsl +2 -2
  712. package/Source/Shaders/Builtin/Functions/writeLogDepth.js +2 -2
  713. package/Source/Shaders/DepthPlaneVS.glsl +1 -1
  714. package/Source/Shaders/DepthPlaneVS.js +1 -1
  715. package/Source/Shaders/Model/ModelFS.glsl +26 -0
  716. package/Source/Shaders/Model/ModelFS.js +26 -0
  717. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +59 -59
  718. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +60 -60
  719. package/Source/Widget/CesiumWidget.js +9 -8
  720. package/Source/Workers/combineGeometry.js +3 -4
  721. package/Source/Workers/createCircleGeometry.js +2 -2
  722. package/Source/Workers/createCircleOutlineGeometry.js +2 -2
  723. package/Source/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
  724. package/Source/Workers/createCorridorOutlineGeometry.js +2 -2
  725. package/Source/Workers/createEllipsoidOutlineGeometry.js +1 -1
  726. package/Source/Workers/createGeometry.js +4 -5
  727. package/Source/Workers/createGroundPolylineGeometry.js +1 -1
  728. package/Source/Workers/createPolylineVolumeGeometry.js +2 -2
  729. package/Source/Workers/createPolylineVolumeOutlineGeometry.js +4 -4
  730. package/Source/Workers/createRectangleOutlineGeometry.js +1 -1
  731. package/Source/Workers/createSimplePolylineGeometry.js +2 -2
  732. package/Source/Workers/createTaskProcessorWorker.js +1 -1
  733. package/Source/Workers/createVectorTileClampedPolylines.js +30 -30
  734. package/Source/Workers/createVectorTileGeometries.js +18 -18
  735. package/Source/Workers/createVectorTilePoints.js +3 -3
  736. package/Source/Workers/createVectorTilePolygons.js +11 -11
  737. package/Source/Workers/createVectorTilePolylines.js +7 -7
  738. package/Source/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +29 -30
  739. package/Source/Workers/createVerticesFromQuantizedTerrainMesh.js +60 -60
  740. package/Source/Workers/decodeDraco.js +23 -23
  741. package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +3 -3
  742. package/Source/Workers/decodeI3S.js +53 -53
  743. package/Source/Workers/transcodeKTX2.js +9 -9
  744. package/Source/Workers/transferTypedArrayTest.js +1 -1
  745. package/Source/Workers/upsampleQuantizedTerrainMesh.js +37 -36
  746. package/index.d.ts +503 -35
  747. package/index.js +76 -59
  748. package/package.json +2 -2
@@ -77,6 +77,8 @@ import View from "./View.js";
77
77
  import DebugInspector from "./DebugInspector.js";
78
78
  import VoxelCell from "./VoxelCell.js";
79
79
  import VoxelPrimitive from "./VoxelPrimitive.js";
80
+ import getMetadataClassProperty from "./getMetadataClassProperty.js";
81
+ import PickedMetadataInfo from "./PickedMetadataInfo.js";
80
82
 
81
83
  const requestRenderAfterFrame = function (scene) {
82
84
  return function () {
@@ -157,7 +159,7 @@ function Scene(options) {
157
159
  this._frameState = new FrameState(
158
160
  context,
159
161
  new CreditDisplay(creditContainer, "•", creditViewport),
160
- this._jobScheduler
162
+ this._jobScheduler,
161
163
  );
162
164
  this._frameState.scene3DOnly = defaultValue(options.scene3DOnly, false);
163
165
  this._removeCreditContainer = !hasCreditContainer;
@@ -191,6 +193,12 @@ function Scene(options) {
191
193
  this._overlayCommandList = [];
192
194
 
193
195
  this._useOIT = defaultValue(options.orderIndependentTranslucency, true);
196
+ /**
197
+ * The function that will be used for executing translucent commands when
198
+ * useOIT is true. This is created once in
199
+ * obtainTranslucentCommandExecutionFunction, then cached here.
200
+ * @private
201
+ */
194
202
  this._executeOITFunction = undefined;
195
203
 
196
204
  this._depthPlane = new DepthPlane(options.depthPlaneEllipsoidOffset);
@@ -547,7 +555,7 @@ function Scene(options) {
547
555
  -45.0,
548
556
  -45.0,
549
557
  45.0,
550
- 45.0
558
+ 45.0,
551
559
  );
552
560
  }
553
561
 
@@ -581,7 +589,7 @@ function Scene(options) {
581
589
  this.invertClassificationColor = Color.clone(Color.WHITE);
582
590
 
583
591
  this._actualInvertClassificationColor = Color.clone(
584
- this._invertClassificationColor
592
+ this._invertClassificationColor,
585
593
  );
586
594
  this._invertClassification = new InvertClassification();
587
595
 
@@ -677,17 +685,19 @@ function Scene(options) {
677
685
  */
678
686
  this.maximumRenderTimeChange = defaultValue(
679
687
  options.maximumRenderTimeChange,
680
- 0.0
688
+ 0.0,
681
689
  );
682
690
  this._lastRenderTime = undefined;
683
691
  this._frameRateMonitor = undefined;
684
692
 
685
- this._removeRequestListenerCallback = RequestScheduler.requestCompletedEvent.addEventListener(
686
- requestRenderAfterFrame(this)
687
- );
688
- this._removeTaskProcessorListenerCallback = TaskProcessor.taskCompletedEvent.addEventListener(
689
- requestRenderAfterFrame(this)
690
- );
693
+ this._removeRequestListenerCallback =
694
+ RequestScheduler.requestCompletedEvent.addEventListener(
695
+ requestRenderAfterFrame(this),
696
+ );
697
+ this._removeTaskProcessorListenerCallback =
698
+ TaskProcessor.taskCompletedEvent.addEventListener(
699
+ requestRenderAfterFrame(this),
700
+ );
691
701
  this._removeGlobeCallbacks = [];
692
702
  this._removeTerrainProviderReadyListener = undefined;
693
703
 
@@ -695,7 +705,7 @@ function Scene(options) {
695
705
  0,
696
706
  0,
697
707
  context.drawingBufferWidth,
698
- context.drawingBufferHeight
708
+ context.drawingBufferHeight,
699
709
  );
700
710
  const camera = new Camera(this);
701
711
 
@@ -768,13 +778,13 @@ function updateGlobeListeners(scene, globe) {
768
778
  if (defined(globe)) {
769
779
  removeGlobeCallbacks.push(
770
780
  globe.imageryLayersUpdatedEvent.addEventListener(
771
- requestRenderAfterFrame(scene)
772
- )
781
+ requestRenderAfterFrame(scene),
782
+ ),
773
783
  );
774
784
  removeGlobeCallbacks.push(
775
785
  globe.terrainProviderChanged.addEventListener(
776
- requestRenderAfterFrame(scene)
777
- )
786
+ requestRenderAfterFrame(scene),
787
+ ),
778
788
  );
779
789
  }
780
790
  scene._removeGlobeCallbacks = removeGlobeCallbacks;
@@ -1398,7 +1408,7 @@ Object.defineProperties(Scene.prototype, {
1398
1408
  //>>includeStart('debug', pragmas.debug);
1399
1409
  if (this.scene3DOnly && value !== SceneMode.SCENE3D) {
1400
1410
  throw new DeveloperError(
1401
- "Only SceneMode.SCENE3D is valid when scene3DOnly is true."
1411
+ "Only SceneMode.SCENE3D is valid when scene3DOnly is true.",
1402
1412
  );
1403
1413
  }
1404
1414
  //>>includeEnd('debug');
@@ -1411,7 +1421,7 @@ Object.defineProperties(Scene.prototype, {
1411
1421
  //>>includeStart('debug', pragmas.debug);
1412
1422
  } else {
1413
1423
  throw new DeveloperError(
1414
- "value must be a valid SceneMode enumeration."
1424
+ "value must be a valid SceneMode enumeration.",
1415
1425
  );
1416
1426
  //>>includeEnd('debug');
1417
1427
  }
@@ -1460,7 +1470,7 @@ Object.defineProperties(Scene.prototype, {
1460
1470
  //>>includeStart('debug', pragmas.debug);
1461
1471
  if (this.camera.frustum instanceof OrthographicFrustum) {
1462
1472
  throw new DeveloperError(
1463
- "VR is unsupported with an orthographic projection."
1473
+ "VR is unsupported with an orthographic projection.",
1464
1474
  );
1465
1475
  }
1466
1476
  //>>includeEnd('debug');
@@ -1469,9 +1479,8 @@ Object.defineProperties(Scene.prototype, {
1469
1479
  this._frameState.creditDisplay.container.style.visibility = "hidden";
1470
1480
  this._cameraVR = new Camera(this);
1471
1481
  if (!defined(this._deviceOrientationCameraController)) {
1472
- this._deviceOrientationCameraController = new DeviceOrientationCameraController(
1473
- this
1474
- );
1482
+ this._deviceOrientationCameraController =
1483
+ new DeviceOrientationCameraController(this);
1475
1484
  }
1476
1485
 
1477
1486
  this._aspectRatioVR = this.camera.frustum.aspectRatio;
@@ -1533,7 +1542,7 @@ Object.defineProperties(Scene.prototype, {
1533
1542
  //>>includeStart('debug', pragmas.debug);
1534
1543
  if (!defined(value) || value < 0.0) {
1535
1544
  throw new DeveloperError(
1536
- "minimumDisableDepthTestDistance must be greater than or equal to 0.0."
1545
+ "minimumDisableDepthTestDistance must be greater than or equal to 0.0.",
1537
1546
  );
1538
1547
  }
1539
1548
  //>>includeEnd('debug');
@@ -1714,12 +1723,28 @@ Scene.prototype.getCompressedTextureFormatSupported = function (format) {
1714
1723
  );
1715
1724
  };
1716
1725
 
1726
+ function pickedMetadataInfoChanged(command, frameState) {
1727
+ const oldPickedMetadataInfo = command.pickedMetadataInfo;
1728
+ const newPickedMetadataInfo = frameState.pickedMetadataInfo;
1729
+ if (oldPickedMetadataInfo?.schemaId !== newPickedMetadataInfo?.schemaId) {
1730
+ return true;
1731
+ }
1732
+ if (oldPickedMetadataInfo?.className !== newPickedMetadataInfo?.className) {
1733
+ return true;
1734
+ }
1735
+ if (
1736
+ oldPickedMetadataInfo?.propertyName !== newPickedMetadataInfo?.propertyName
1737
+ ) {
1738
+ return true;
1739
+ }
1740
+ return false;
1741
+ }
1742
+
1717
1743
  function updateDerivedCommands(scene, command, shadowsDirty) {
1718
1744
  const frameState = scene._frameState;
1719
1745
  const context = scene._context;
1720
1746
  const oit = scene._view.oit;
1721
- const lightShadowMaps = frameState.shadowState.lightShadowMaps;
1722
- const lightShadowsEnabled = frameState.shadowState.lightShadowsEnabled;
1747
+ const { lightShadowMaps, lightShadowsEnabled } = frameState.shadowState;
1723
1748
 
1724
1749
  let derivedCommands = command.derivedCommands;
1725
1750
 
@@ -1728,16 +1753,27 @@ function updateDerivedCommands(scene, command, shadowsDirty) {
1728
1753
  scene,
1729
1754
  command,
1730
1755
  context,
1731
- derivedCommands.picking
1756
+ derivedCommands.picking,
1732
1757
  );
1733
1758
  }
1734
-
1759
+ if (frameState.pickingMetadata && command.pickMetadataAllowed) {
1760
+ command.pickedMetadataInfo = frameState.pickedMetadataInfo;
1761
+ if (defined(command.pickedMetadataInfo)) {
1762
+ derivedCommands.pickingMetadata =
1763
+ DerivedCommand.createPickMetadataDerivedCommand(
1764
+ scene,
1765
+ command,
1766
+ context,
1767
+ derivedCommands.pickingMetadata,
1768
+ );
1769
+ }
1770
+ }
1735
1771
  if (!command.pickOnly) {
1736
1772
  derivedCommands.depth = DerivedCommand.createDepthOnlyDerivedCommand(
1737
1773
  scene,
1738
1774
  command,
1739
1775
  context,
1740
- derivedCommands.depth
1776
+ derivedCommands.depth,
1741
1777
  );
1742
1778
  }
1743
1779
 
@@ -1747,7 +1783,7 @@ function updateDerivedCommands(scene, command, shadowsDirty) {
1747
1783
  derivedCommands.hdr = DerivedCommand.createHdrCommand(
1748
1784
  command,
1749
1785
  context,
1750
- derivedCommands.hdr
1786
+ derivedCommands.hdr,
1751
1787
  );
1752
1788
  command = derivedCommands.hdr.command;
1753
1789
  derivedCommands = command.derivedCommands;
@@ -1759,7 +1795,7 @@ function updateDerivedCommands(scene, command, shadowsDirty) {
1759
1795
  command,
1760
1796
  shadowsDirty,
1761
1797
  context,
1762
- derivedCommands.shadows
1798
+ derivedCommands.shadows,
1763
1799
  );
1764
1800
  }
1765
1801
 
@@ -1771,13 +1807,13 @@ function updateDerivedCommands(scene, command, shadowsDirty) {
1771
1807
  derivedCommands.oit.shadows = oit.createDerivedCommands(
1772
1808
  derivedCommands.shadows.receiveCommand,
1773
1809
  context,
1774
- derivedCommands.oit.shadows
1810
+ derivedCommands.oit.shadows,
1775
1811
  );
1776
1812
  } else {
1777
1813
  derivedCommands.oit = oit.createDerivedCommands(
1778
1814
  command,
1779
1815
  context,
1780
- derivedCommands.oit
1816
+ derivedCommands.oit,
1781
1817
  );
1782
1818
  }
1783
1819
  }
@@ -1787,26 +1823,26 @@ function updateDerivedCommands(scene, command, shadowsDirty) {
1787
1823
  * @private
1788
1824
  */
1789
1825
  Scene.prototype.updateDerivedCommands = function (command) {
1790
- if (!defined(command.derivedCommands)) {
1826
+ const { derivedCommands } = command;
1827
+ if (!defined(derivedCommands)) {
1791
1828
  // Is not a DrawCommand
1792
1829
  return;
1793
1830
  }
1794
1831
 
1795
1832
  const frameState = this._frameState;
1833
+ const { shadowState, useLogDepth } = this._frameState;
1796
1834
  const context = this._context;
1797
1835
 
1798
1836
  // Update derived commands when any shadow maps become dirty
1799
1837
  let shadowsDirty = false;
1800
- const lastDirtyTime = frameState.shadowState.lastDirtyTime;
1838
+ const lastDirtyTime = shadowState.lastDirtyTime;
1801
1839
  if (command.lastDirtyTime !== lastDirtyTime) {
1802
1840
  command.lastDirtyTime = lastDirtyTime;
1803
1841
  command.dirty = true;
1804
1842
  shadowsDirty = true;
1805
1843
  }
1806
1844
 
1807
- const useLogDepth = frameState.useLogDepth;
1808
1845
  const useHdr = this._hdr;
1809
- const derivedCommands = command.derivedCommands;
1810
1846
  const hasLogDepthDerivedCommands = defined(derivedCommands.logDepth);
1811
1847
  const hasHdrCommands = defined(derivedCommands.hdr);
1812
1848
  const hasDerivedCommands = defined(derivedCommands.originalCommand);
@@ -1814,42 +1850,43 @@ Scene.prototype.updateDerivedCommands = function (command) {
1814
1850
  useLogDepth && !hasLogDepthDerivedCommands;
1815
1851
  const needsHdrCommands = useHdr && !hasHdrCommands;
1816
1852
  const needsDerivedCommands = (!useLogDepth || !useHdr) && !hasDerivedCommands;
1853
+ const needsUpdateForMetadataPicking =
1854
+ frameState.pickingMetadata &&
1855
+ pickedMetadataInfoChanged(command, frameState);
1817
1856
  command.dirty =
1818
1857
  command.dirty ||
1819
1858
  needsLogDepthDerivedCommands ||
1820
1859
  needsHdrCommands ||
1821
- needsDerivedCommands;
1860
+ needsDerivedCommands ||
1861
+ needsUpdateForMetadataPicking;
1822
1862
 
1823
- if (command.dirty) {
1824
- command.dirty = false;
1863
+ if (!command.dirty) {
1864
+ return;
1865
+ }
1825
1866
 
1826
- const shadowMaps = frameState.shadowState.shadowMaps;
1827
- const shadowsEnabled = frameState.shadowState.shadowsEnabled;
1828
- if (shadowsEnabled && command.castShadows) {
1829
- derivedCommands.shadows = ShadowMap.createCastDerivedCommand(
1830
- shadowMaps,
1831
- command,
1832
- shadowsDirty,
1833
- context,
1834
- derivedCommands.shadows
1835
- );
1836
- }
1867
+ command.dirty = false;
1837
1868
 
1838
- if (hasLogDepthDerivedCommands || needsLogDepthDerivedCommands) {
1839
- derivedCommands.logDepth = DerivedCommand.createLogDepthCommand(
1840
- command,
1841
- context,
1842
- derivedCommands.logDepth
1843
- );
1844
- updateDerivedCommands(
1845
- this,
1846
- derivedCommands.logDepth.command,
1847
- shadowsDirty
1848
- );
1849
- }
1850
- if (hasDerivedCommands || needsDerivedCommands) {
1851
- updateDerivedCommands(this, command, shadowsDirty);
1852
- }
1869
+ const { shadowsEnabled, shadowMaps } = shadowState;
1870
+ if (shadowsEnabled && command.castShadows) {
1871
+ derivedCommands.shadows = ShadowMap.createCastDerivedCommand(
1872
+ shadowMaps,
1873
+ command,
1874
+ shadowsDirty,
1875
+ context,
1876
+ derivedCommands.shadows,
1877
+ );
1878
+ }
1879
+
1880
+ if (hasLogDepthDerivedCommands || needsLogDepthDerivedCommands) {
1881
+ derivedCommands.logDepth = DerivedCommand.createLogDepthCommand(
1882
+ command,
1883
+ context,
1884
+ derivedCommands.logDepth,
1885
+ );
1886
+ updateDerivedCommands(this, derivedCommands.logDepth.command, shadowsDirty);
1887
+ }
1888
+ if (hasDerivedCommands || needsDerivedCommands) {
1889
+ updateDerivedCommands(this, command, shadowsDirty);
1853
1890
  }
1854
1891
  };
1855
1892
 
@@ -1871,31 +1908,34 @@ const requestRenderModeDeferCheckPassState = new Cesium3DTilePassState({
1871
1908
 
1872
1909
  const scratchOccluderBoundingSphere = new BoundingSphere();
1873
1910
  let scratchOccluder;
1874
-
1911
+ /**
1912
+ * Get the central body occluder for the scene.
1913
+ * Assumes only one central body occluder, the top-level globe.
1914
+ *
1915
+ * @param {Scene} scene
1916
+ * @returns {Occluder|undefined}
1917
+ *
1918
+ * @private
1919
+ */
1875
1920
  function getOccluder(scene) {
1876
- // TODO: The occluder is the top-level globe. When we add
1877
- // support for multiple central bodies, this should be the closest one.
1878
- const globe = scene.globe;
1879
1921
  if (
1880
- scene._mode === SceneMode.SCENE3D &&
1881
- defined(globe) &&
1882
- globe.show &&
1883
- !scene._cameraUnderground &&
1884
- !scene._globeTranslucencyState.translucent
1922
+ scene._mode !== SceneMode.SCENE3D ||
1923
+ !scene.globe?.show ||
1924
+ scene._cameraUnderground ||
1925
+ scene._globeTranslucencyState.translucent
1885
1926
  ) {
1886
- const ellipsoid = scene.ellipsoid;
1887
- const minimumTerrainHeight = scene.frameState.minimumTerrainHeight;
1888
- scratchOccluderBoundingSphere.radius =
1889
- ellipsoid.minimumRadius + minimumTerrainHeight;
1890
- scratchOccluder = Occluder.fromBoundingSphere(
1891
- scratchOccluderBoundingSphere,
1892
- scene.camera.positionWC,
1893
- scratchOccluder
1894
- );
1895
- return scratchOccluder;
1927
+ return undefined;
1896
1928
  }
1897
1929
 
1898
- return undefined;
1930
+ scratchOccluderBoundingSphere.radius =
1931
+ scene.ellipsoid.minimumRadius + scene.frameState.minimumTerrainHeight;
1932
+ scratchOccluder = Occluder.fromBoundingSphere(
1933
+ scratchOccluderBoundingSphere,
1934
+ scene.camera.positionWC,
1935
+ scratchOccluder,
1936
+ );
1937
+
1938
+ return scratchOccluder;
1899
1939
  }
1900
1940
 
1901
1941
  /**
@@ -1935,11 +1975,12 @@ Scene.prototype.updateFrameState = function () {
1935
1975
  frameState.cullingVolume = camera.frustum.computeCullingVolume(
1936
1976
  camera.positionWC,
1937
1977
  camera.directionWC,
1938
- camera.upWC
1978
+ camera.upWC,
1939
1979
  );
1940
1980
  frameState.occluder = getOccluder(this);
1941
1981
  frameState.minimumTerrainHeight = 0.0;
1942
- frameState.minimumDisableDepthTestDistance = this._minimumDisableDepthTestDistance;
1982
+ frameState.minimumDisableDepthTestDistance =
1983
+ this._minimumDisableDepthTestDistance;
1943
1984
  frameState.invertClassification = this.invertClassification;
1944
1985
  frameState.useLogDepth =
1945
1986
  this._logDepthBuffer &&
@@ -1961,14 +2002,17 @@ Scene.prototype.updateFrameState = function () {
1961
2002
  globe._terrainExaggerationChanged = false;
1962
2003
  }
1963
2004
  frameState.verticalExaggeration = this.verticalExaggeration;
1964
- frameState.verticalExaggerationRelativeHeight = this.verticalExaggerationRelativeHeight;
2005
+ frameState.verticalExaggerationRelativeHeight =
2006
+ this.verticalExaggerationRelativeHeight;
1965
2007
 
1966
2008
  if (
1967
2009
  defined(this._specularEnvironmentCubeMap) &&
1968
2010
  this._specularEnvironmentCubeMap.ready
1969
2011
  ) {
1970
- frameState.specularEnvironmentMaps = this._specularEnvironmentCubeMap.texture;
1971
- frameState.specularEnvironmentMapsMaximumLOD = this._specularEnvironmentCubeMap.maximumMipmapLevel;
2012
+ frameState.specularEnvironmentMaps =
2013
+ this._specularEnvironmentCubeMap.texture;
2014
+ frameState.specularEnvironmentMapsMaximumLOD =
2015
+ this._specularEnvironmentCubeMap.maximumMipmapLevel;
1972
2016
  } else {
1973
2017
  frameState.specularEnvironmentMaps = undefined;
1974
2018
  frameState.specularEnvironmentMapsMaximumLOD = undefined;
@@ -1978,7 +2022,7 @@ Scene.prototype.updateFrameState = function () {
1978
2022
 
1979
2023
  this._actualInvertClassificationColor = Color.clone(
1980
2024
  this.invertClassificationColor,
1981
- this._actualInvertClassificationColor
2025
+ this._actualInvertClassificationColor,
1982
2026
  );
1983
2027
  if (!InvertClassification.isTranslucencySupported(this._context)) {
1984
2028
  this._actualInvertClassificationColor.alpha = 1.0;
@@ -1998,18 +2042,31 @@ Scene.prototype.updateFrameState = function () {
1998
2042
  };
1999
2043
 
2000
2044
  /**
2045
+ * Check whether a draw command will render anything visible in the current Scene,
2046
+ * based on its bounding volume.
2047
+ *
2048
+ * @param {CullingVolume} cullingVolume The culling volume of the current Scene.
2049
+ * @param {DrawCommand} [command] The draw command
2050
+ * @param {Occluder} [occluder] An occluder that may be in front of the command's bounding volume.
2051
+ * @returns {boolean} <code>true</code> if the command's bounding volume is visible in the scene.
2052
+ *
2001
2053
  * @private
2002
2054
  */
2003
- Scene.prototype.isVisible = function (command, cullingVolume, occluder) {
2055
+ Scene.prototype.isVisible = function (cullingVolume, command, occluder) {
2056
+ if (!defined(command)) {
2057
+ return false;
2058
+ }
2059
+ const { boundingVolume } = command;
2060
+ if (!defined(boundingVolume) || !command.cull) {
2061
+ return true;
2062
+ }
2063
+ if (cullingVolume.computeVisibility(boundingVolume) === Intersect.OUTSIDE) {
2064
+ return false;
2065
+ }
2004
2066
  return (
2005
- defined(command) &&
2006
- (!defined(command.boundingVolume) ||
2007
- !command.cull ||
2008
- (cullingVolume.computeVisibility(command.boundingVolume) !==
2009
- Intersect.OUTSIDE &&
2010
- (!defined(occluder) ||
2011
- !command.occlude ||
2012
- !command.boundingVolume.isOccluded(occluder))))
2067
+ !defined(occluder) ||
2068
+ !command.occlude ||
2069
+ !boundingVolume.isOccluded(occluder)
2013
2070
  );
2014
2071
  };
2015
2072
 
@@ -2029,16 +2086,25 @@ let transformFrom2D = new Matrix4(
2029
2086
  0.0,
2030
2087
  0.0,
2031
2088
  0.0,
2032
- 1.0
2089
+ 1.0,
2033
2090
  );
2034
2091
  transformFrom2D = Matrix4.inverseTransformation(
2035
2092
  transformFrom2D,
2036
- transformFrom2D
2093
+ transformFrom2D,
2037
2094
  );
2038
2095
 
2096
+ /**
2097
+ * Debug code to draw bounding volume for command. Not optimized!
2098
+ * Assumes bounding volume is a bounding sphere or box.
2099
+ *
2100
+ * @param {DrawCommand} command The draw command for which to render the bounding volume.
2101
+ * @param {Scene} scene The scene.
2102
+ * @param {PassState} passState The state for the current render pass.
2103
+ * @param {Framebuffer} debugFramebuffer The framebuffer where the bounding volume will be rendered.
2104
+ *
2105
+ * @private
2106
+ */
2039
2107
  function debugShowBoundingVolume(command, scene, passState, debugFramebuffer) {
2040
- // Debug code to draw bounding volume for command. Not optimized!
2041
- // Assumes bounding volume is a bounding sphere or box
2042
2108
  const frameState = scene._frameState;
2043
2109
  const context = frameState.context;
2044
2110
  const boundingVolume = command.boundingVolume;
@@ -2047,8 +2113,6 @@ function debugShowBoundingVolume(command, scene, passState, debugFramebuffer) {
2047
2113
  scene._debugVolume.destroy();
2048
2114
  }
2049
2115
 
2050
- let geometry;
2051
-
2052
2116
  let center = Cartesian3.clone(boundingVolume.center);
2053
2117
  if (frameState.mode !== SceneMode.SCENE3D) {
2054
2118
  center = Matrix4.multiplyByPoint(transformFrom2D, center, center);
@@ -2057,63 +2121,44 @@ function debugShowBoundingVolume(command, scene, passState, debugFramebuffer) {
2057
2121
  center = projection.ellipsoid.cartographicToCartesian(centerCartographic);
2058
2122
  }
2059
2123
 
2060
- if (defined(boundingVolume.radius)) {
2061
- const radius = boundingVolume.radius;
2062
-
2063
- geometry = GeometryPipeline.toWireframe(
2064
- EllipsoidGeometry.createGeometry(
2065
- new EllipsoidGeometry({
2066
- radii: new Cartesian3(radius, radius, radius),
2067
- vertexFormat: PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
2068
- })
2069
- )
2070
- );
2071
-
2072
- scene._debugVolume = new Primitive({
2073
- geometryInstances: new GeometryInstance({
2074
- geometry: geometry,
2075
- modelMatrix: Matrix4.fromTranslation(center),
2076
- attributes: {
2077
- color: new ColorGeometryInstanceAttribute(1.0, 0.0, 0.0, 1.0),
2078
- },
2079
- }),
2080
- appearance: new PerInstanceColorAppearance({
2081
- flat: true,
2082
- translucent: false,
2124
+ let geometry;
2125
+ let modelMatrix;
2126
+ const { radius } = boundingVolume;
2127
+ if (defined(radius)) {
2128
+ geometry = EllipsoidGeometry.createGeometry(
2129
+ new EllipsoidGeometry({
2130
+ radii: new Cartesian3(radius, radius, radius),
2131
+ vertexFormat: PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
2083
2132
  }),
2084
- asynchronous: false,
2085
- });
2086
- } else {
2087
- const halfAxes = boundingVolume.halfAxes;
2088
-
2089
- geometry = GeometryPipeline.toWireframe(
2090
- BoxGeometry.createGeometry(
2091
- BoxGeometry.fromDimensions({
2092
- dimensions: new Cartesian3(2.0, 2.0, 2.0),
2093
- vertexFormat: PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
2094
- })
2095
- )
2096
2133
  );
2097
-
2098
- scene._debugVolume = new Primitive({
2099
- geometryInstances: new GeometryInstance({
2100
- geometry: geometry,
2101
- modelMatrix: Matrix4.fromRotationTranslation(
2102
- halfAxes,
2103
- center,
2104
- new Matrix4()
2105
- ),
2106
- attributes: {
2107
- color: new ColorGeometryInstanceAttribute(1.0, 0.0, 0.0, 1.0),
2108
- },
2109
- }),
2110
- appearance: new PerInstanceColorAppearance({
2111
- flat: true,
2112
- translucent: false,
2134
+ modelMatrix = Matrix4.fromTranslation(center);
2135
+ } else {
2136
+ geometry = BoxGeometry.createGeometry(
2137
+ BoxGeometry.fromDimensions({
2138
+ dimensions: new Cartesian3(2.0, 2.0, 2.0),
2139
+ vertexFormat: PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
2113
2140
  }),
2114
- asynchronous: false,
2115
- });
2141
+ );
2142
+ modelMatrix = Matrix4.fromRotationTranslation(
2143
+ boundingVolume.halfAxes,
2144
+ center,
2145
+ new Matrix4(),
2146
+ );
2116
2147
  }
2148
+ scene._debugVolume = new Primitive({
2149
+ geometryInstances: new GeometryInstance({
2150
+ geometry: GeometryPipeline.toWireframe(geometry),
2151
+ modelMatrix: modelMatrix,
2152
+ attributes: {
2153
+ color: new ColorGeometryInstanceAttribute(1.0, 0.0, 0.0, 1.0),
2154
+ },
2155
+ }),
2156
+ appearance: new PerInstanceColorAppearance({
2157
+ flat: true,
2158
+ translucent: false,
2159
+ }),
2160
+ asynchronous: false,
2161
+ });
2117
2162
 
2118
2163
  const savedCommandList = frameState.commandList;
2119
2164
  const commandList = (frameState.commandList = []);
@@ -2141,8 +2186,19 @@ function debugShowBoundingVolume(command, scene, passState, debugFramebuffer) {
2141
2186
  frameState.commandList = savedCommandList;
2142
2187
  }
2143
2188
 
2144
- function executeCommand(command, scene, context, passState, debugFramebuffer) {
2189
+ /**
2190
+ * Execute a single draw command, or one of its derived commands if appropriate for the current render state.
2191
+ *
2192
+ * @param {DrawCommand} command The command to execute.
2193
+ * @param {Scene} scene The scene.
2194
+ * @param {PassState} passState The state for the current render pass.
2195
+ * @param {Framebuffer} debugFramebuffer The framebuffer where debug QCs will be rendered.
2196
+ *
2197
+ * @private
2198
+ */
2199
+ function executeCommand(command, scene, passState, debugFramebuffer) {
2145
2200
  const frameState = scene._frameState;
2201
+ const context = scene._context;
2146
2202
 
2147
2203
  if (defined(scene.debugCommandFilter) && !scene.debugCommandFilter(command)) {
2148
2204
  return;
@@ -2174,14 +2230,23 @@ function executeCommand(command, scene, context, passState, debugFramebuffer) {
2174
2230
  }
2175
2231
 
2176
2232
  if (passes.pick || passes.depth) {
2177
- if (
2178
- passes.pick &&
2179
- !passes.depth &&
2180
- defined(command.derivedCommands.picking)
2181
- ) {
2182
- command = command.derivedCommands.picking.pickCommand;
2183
- command.execute(context, passState);
2184
- return;
2233
+ if (passes.pick && !passes.depth) {
2234
+ if (
2235
+ frameState.pickingMetadata &&
2236
+ defined(command.derivedCommands.pickingMetadata)
2237
+ ) {
2238
+ command = command.derivedCommands.pickingMetadata.pickMetadataCommand;
2239
+ command.execute(context, passState);
2240
+ return;
2241
+ }
2242
+ if (
2243
+ !frameState.pickingMetadata &&
2244
+ defined(command.derivedCommands.picking)
2245
+ ) {
2246
+ command = command.derivedCommands.picking.pickCommand;
2247
+ command.execute(context, passState);
2248
+ return;
2249
+ }
2185
2250
  } else if (defined(command.derivedCommands.depth)) {
2186
2251
  command = command.derivedCommands.depth.depthOnlyCommand;
2187
2252
  command.execute(context, passState);
@@ -2193,7 +2258,7 @@ function executeCommand(command, scene, context, passState, debugFramebuffer) {
2193
2258
  scene._debugInspector.executeDebugShowFrustumsCommand(
2194
2259
  scene,
2195
2260
  command,
2196
- passState
2261
+ passState,
2197
2262
  );
2198
2263
  return;
2199
2264
  }
@@ -2212,23 +2277,38 @@ function executeCommand(command, scene, context, passState, debugFramebuffer) {
2212
2277
  }
2213
2278
  }
2214
2279
 
2215
- function executeIdCommand(command, scene, context, passState) {
2216
- const frameState = scene._frameState;
2217
- let derivedCommands = command.derivedCommands;
2280
+ /**
2281
+ * Execute a single ID draw command, used to render information for picking.
2282
+ *
2283
+ * @param {DrawCommand} command The command to execute.
2284
+ * @param {Scene} scene The scene.
2285
+ * @param {PassState} passState The state for the current render pass.
2286
+ *
2287
+ * @private
2288
+ */
2289
+ function executeIdCommand(command, scene, passState) {
2290
+ const { derivedCommands } = command;
2218
2291
  if (!defined(derivedCommands)) {
2219
2292
  return;
2220
2293
  }
2221
2294
 
2295
+ const frameState = scene._frameState;
2296
+ const context = scene._context;
2297
+
2222
2298
  if (frameState.useLogDepth && defined(derivedCommands.logDepth)) {
2223
2299
  command = derivedCommands.logDepth.command;
2224
2300
  }
2225
2301
 
2226
- derivedCommands = command.derivedCommands;
2227
- if (defined(derivedCommands.picking)) {
2228
- command = derivedCommands.picking.pickCommand;
2302
+ const { picking, pickingMetadata, depth } = command.derivedCommands;
2303
+ if (defined(pickingMetadata)) {
2304
+ command = derivedCommands.pickingMetadata.pickMetadataCommand;
2229
2305
  command.execute(context, passState);
2230
- } else if (defined(derivedCommands.depth)) {
2231
- command = derivedCommands.depth.depthOnlyCommand;
2306
+ }
2307
+ if (defined(picking)) {
2308
+ command = picking.pickCommand;
2309
+ command.execute(context, passState);
2310
+ } else if (defined(depth)) {
2311
+ command = depth.depthOnlyCommand;
2232
2312
  command.execute(context, passState);
2233
2313
  }
2234
2314
  }
@@ -2254,24 +2334,16 @@ function executeTranslucentCommandsBackToFront(
2254
2334
  executeFunction,
2255
2335
  passState,
2256
2336
  commands,
2257
- invertClassification
2337
+ invertClassification,
2258
2338
  ) {
2259
- const context = scene.context;
2260
-
2261
2339
  mergeSort(commands, backToFront, scene.camera.positionWC);
2262
2340
 
2263
2341
  if (defined(invertClassification)) {
2264
- executeFunction(
2265
- invertClassification.unclassifiedCommand,
2266
- scene,
2267
- context,
2268
- passState
2269
- );
2342
+ executeFunction(invertClassification.unclassifiedCommand, scene, passState);
2270
2343
  }
2271
2344
 
2272
- const length = commands.length;
2273
- for (let i = 0; i < length; ++i) {
2274
- executeFunction(commands[i], scene, context, passState);
2345
+ for (let i = 0; i < commands.length; ++i) {
2346
+ executeFunction(commands[i], scene, passState);
2275
2347
  }
2276
2348
  }
2277
2349
 
@@ -2280,35 +2352,38 @@ function executeTranslucentCommandsFrontToBack(
2280
2352
  executeFunction,
2281
2353
  passState,
2282
2354
  commands,
2283
- invertClassification
2355
+ invertClassification,
2284
2356
  ) {
2285
- const context = scene.context;
2286
-
2287
2357
  mergeSort(commands, frontToBack, scene.camera.positionWC);
2288
2358
 
2289
2359
  if (defined(invertClassification)) {
2290
- executeFunction(
2291
- invertClassification.unclassifiedCommand,
2292
- scene,
2293
- context,
2294
- passState
2295
- );
2360
+ executeFunction(invertClassification.unclassifiedCommand, scene, passState);
2296
2361
  }
2297
2362
 
2298
- const length = commands.length;
2299
- for (let i = 0; i < length; ++i) {
2300
- executeFunction(commands[i], scene, context, passState);
2363
+ for (let i = 0; i < commands.length; ++i) {
2364
+ executeFunction(commands[i], scene, passState);
2301
2365
  }
2302
2366
  }
2303
2367
 
2304
- function executeVoxelCommands(scene, executeFunction, passState, commands) {
2305
- const context = scene.context;
2368
+ /**
2369
+ * Execute commands to render voxels in the scene.
2370
+ *
2371
+ * @param {Scene} scene The scene.
2372
+ * @param {PassState} passState The state for the current render pass.
2373
+ * @param {FrustumCommands} frustumCommands The draw commands for the current frustum.
2374
+ *
2375
+ * @private
2376
+ */
2377
+ function performVoxelsPass(scene, passState, frustumCommands) {
2378
+ scene.context.uniformState.updatePass(Pass.VOXELS);
2379
+
2380
+ const commands = frustumCommands.commands[Pass.VOXELS];
2381
+ commands.length = frustumCommands.indices[Pass.VOXELS];
2306
2382
 
2307
2383
  mergeSort(commands, backToFront, scene.camera.positionWC);
2308
2384
 
2309
- const length = commands.length;
2310
- for (let i = 0; i < length; ++i) {
2311
- executeFunction(commands[i], scene, context, passState);
2385
+ for (let i = 0; i < commands.length; ++i) {
2386
+ executeCommand(commands[i], scene, passState);
2312
2387
  }
2313
2388
  }
2314
2389
 
@@ -2316,89 +2391,49 @@ const scratchPerspectiveFrustum = new PerspectiveFrustum();
2316
2391
  const scratchPerspectiveOffCenterFrustum = new PerspectiveOffCenterFrustum();
2317
2392
  const scratchOrthographicFrustum = new OrthographicFrustum();
2318
2393
  const scratchOrthographicOffCenterFrustum = new OrthographicOffCenterFrustum();
2319
-
2320
- function executeCommands(scene, passState) {
2321
- const { camera, context, frameState } = scene;
2322
- const { uniformState } = context;
2323
-
2324
- uniformState.updateCamera(camera);
2325
-
2326
- // Create a working frustum from the original camera frustum.
2327
- let frustum;
2328
- if (defined(camera.frustum.fov)) {
2329
- frustum = camera.frustum.clone(scratchPerspectiveFrustum);
2330
- } else if (defined(camera.frustum.infiniteProjectionMatrix)) {
2331
- frustum = camera.frustum.clone(scratchPerspectiveOffCenterFrustum);
2332
- } else if (defined(camera.frustum.width)) {
2333
- frustum = camera.frustum.clone(scratchOrthographicFrustum);
2334
- } else {
2335
- frustum = camera.frustum.clone(scratchOrthographicOffCenterFrustum);
2394
+ /**
2395
+ * Create a working frustum from the original camera frustum.
2396
+ *
2397
+ * @param {Camera} camera The camera
2398
+ * @returns {PerspectiveFrustum|PerspectiveOffCenterFrustum|OrthographicFrustum|OrthographicOffCenterFrustum} The working frustum
2399
+ *
2400
+ * @private
2401
+ */
2402
+ function createWorkingFrustum(camera) {
2403
+ const { frustum } = camera;
2404
+ if (defined(frustum.fov)) {
2405
+ return frustum.clone(scratchPerspectiveFrustum);
2336
2406
  }
2337
-
2338
- // Ideally, we would render the sky box and atmosphere last for
2339
- // early-z, but we would have to draw it in each frustum
2340
- frustum.near = camera.frustum.near;
2341
- frustum.far = camera.frustum.far;
2342
- uniformState.updateFrustum(frustum);
2343
- uniformState.updatePass(Pass.ENVIRONMENT);
2344
-
2345
- const passes = frameState.passes;
2346
- const picking = passes.pick || passes.pickVoxel;
2347
- const environmentState = scene._environmentState;
2348
- const view = scene._view;
2349
- const renderTranslucentDepthForPick =
2350
- environmentState.renderTranslucentDepthForPick;
2351
- const useWebVR = environmentState.useWebVR;
2352
-
2353
- // Do not render environment primitives during a pick pass since they do not generate picking commands.
2354
- if (!picking) {
2355
- const skyBoxCommand = environmentState.skyBoxCommand;
2356
- if (defined(skyBoxCommand)) {
2357
- executeCommand(skyBoxCommand, scene, context, passState);
2358
- }
2359
-
2360
- if (environmentState.isSkyAtmosphereVisible) {
2361
- executeCommand(
2362
- environmentState.skyAtmosphereCommand,
2363
- scene,
2364
- context,
2365
- passState
2366
- );
2367
- }
2368
-
2369
- if (environmentState.isSunVisible) {
2370
- environmentState.sunDrawCommand.execute(context, passState);
2371
- if (scene.sunBloom && !useWebVR) {
2372
- let framebuffer;
2373
- if (environmentState.useGlobeDepthFramebuffer) {
2374
- framebuffer = view.globeDepth.framebuffer;
2375
- } else if (environmentState.usePostProcess) {
2376
- framebuffer = view.sceneFramebuffer.framebuffer;
2377
- } else {
2378
- framebuffer = environmentState.originalFramebuffer;
2379
- }
2380
- scene._sunPostProcess.execute(context);
2381
- scene._sunPostProcess.copy(context, framebuffer);
2382
- passState.framebuffer = framebuffer;
2383
- }
2384
- }
2385
-
2386
- // Moon can be seen through the atmosphere, since the sun is rendered after the atmosphere.
2387
- if (environmentState.isMoonVisible) {
2388
- environmentState.moonCommand.execute(context, passState);
2389
- }
2407
+ if (defined(frustum.infiniteProjectionMatrix)) {
2408
+ return frustum.clone(scratchPerspectiveOffCenterFrustum);
2409
+ }
2410
+ if (defined(frustum.width)) {
2411
+ return frustum.clone(scratchOrthographicFrustum);
2390
2412
  }
2413
+ return frustum.clone(scratchOrthographicOffCenterFrustum);
2414
+ }
2391
2415
 
2392
- // Determine how translucent surfaces will be handled.
2393
- let executeTranslucentCommands;
2394
- if (environmentState.useOIT) {
2416
+ /**
2417
+ * Determine how translucent surfaces will be handled.
2418
+ *
2419
+ * When OIT is enabled, then this will delegate to OIT.executeCommands.
2420
+ * Otherwise, it will just be executeTranslucentCommandsBackToFront
2421
+ * for render passes, or executeTranslucentCommandsFrontToBack for
2422
+ * other passes.
2423
+ *
2424
+ * @param {Scene} scene The scene.
2425
+ * @returns {Function} A function to execute translucent commands.
2426
+ */
2427
+ function obtainTranslucentCommandExecutionFunction(scene) {
2428
+ if (scene._environmentState.useOIT) {
2395
2429
  if (!defined(scene._executeOITFunction)) {
2430
+ const { view, context } = scene;
2396
2431
  scene._executeOITFunction = function (
2397
2432
  scene,
2398
2433
  executeFunction,
2399
2434
  passState,
2400
2435
  commands,
2401
- invertClassification
2436
+ invertClassification,
2402
2437
  ) {
2403
2438
  view.globeDepth.prepareColorTextures(context);
2404
2439
  view.oit.executeCommands(
@@ -2406,35 +2441,171 @@ function executeCommands(scene, passState) {
2406
2441
  executeFunction,
2407
2442
  passState,
2408
2443
  commands,
2409
- invertClassification
2444
+ invertClassification,
2410
2445
  );
2411
2446
  };
2412
2447
  }
2413
- executeTranslucentCommands = scene._executeOITFunction;
2414
- } else if (passes.render) {
2415
- executeTranslucentCommands = executeTranslucentCommandsBackToFront;
2416
- } else {
2417
- executeTranslucentCommands = executeTranslucentCommandsFrontToBack;
2448
+ return scene._executeOITFunction;
2449
+ }
2450
+ if (scene.frameState.passes.render) {
2451
+ return executeTranslucentCommandsBackToFront;
2418
2452
  }
2453
+ return executeTranslucentCommandsFrontToBack;
2454
+ }
2419
2455
 
2420
- const frustumCommandsList = view.frustumCommandsList;
2456
+ /**
2457
+ * Execute draw commands to render translucent objects in the scene.
2458
+ *
2459
+ * @param {Scene} scene The scene.
2460
+ * @param {PassState} passState The state for the current render pass.
2461
+ * @param {FrustumCommands} frustumCommands The draw commands for the current frustum.
2462
+ *
2463
+ * @private
2464
+ */
2465
+ function performTranslucentPass(scene, passState, frustumCommands) {
2466
+ const { frameState, context } = scene;
2467
+ const { pick, pickVoxel } = frameState.passes;
2468
+ const picking = pick || pickVoxel;
2469
+
2470
+ let invertClassification;
2471
+ if (
2472
+ !picking &&
2473
+ scene._environmentState.useInvertClassification &&
2474
+ frameState.invertClassificationColor.alpha < 1.0
2475
+ ) {
2476
+ // Fullscreen pass to copy unclassified fragments when alpha < 1.0.
2477
+ // Not executed when undefined.
2478
+ invertClassification = scene._invertClassification;
2479
+ }
2480
+
2481
+ const executeTranslucentCommands =
2482
+ obtainTranslucentCommandExecutionFunction(scene);
2483
+
2484
+ context.uniformState.updatePass(Pass.TRANSLUCENT);
2485
+ const commands = frustumCommands.commands[Pass.TRANSLUCENT];
2486
+ commands.length = frustumCommands.indices[Pass.TRANSLUCENT];
2487
+ executeTranslucentCommands(
2488
+ scene,
2489
+ executeCommand,
2490
+ passState,
2491
+ commands,
2492
+ invertClassification,
2493
+ );
2494
+ }
2495
+
2496
+ /**
2497
+ * Execute commands for classification of translucent 3D Tiles.
2498
+ *
2499
+ * @param {Scene} scene The scene.
2500
+ * @param {PassState} passState The state for the current render pass.
2501
+ * @param {FrustumCommands} frustumCommands The draw commands for the current frustum.
2502
+ *
2503
+ * @private
2504
+ */
2505
+ function performTranslucent3DTilesClassification(
2506
+ scene,
2507
+ passState,
2508
+ frustumCommands,
2509
+ ) {
2510
+ const { translucentTileClassification, globeDepth } = scene._view;
2511
+ const has3DTilesClassificationCommands =
2512
+ frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION] > 0;
2513
+ if (
2514
+ !has3DTilesClassificationCommands ||
2515
+ !translucentTileClassification.isSupported()
2516
+ ) {
2517
+ return;
2518
+ }
2519
+
2520
+ const commands = frustumCommands.commands[Pass.TRANSLUCENT];
2521
+ translucentTileClassification.executeTranslucentCommands(
2522
+ scene,
2523
+ executeCommand,
2524
+ passState,
2525
+ commands,
2526
+ globeDepth.depthStencilTexture,
2527
+ );
2528
+ translucentTileClassification.executeClassificationCommands(
2529
+ scene,
2530
+ executeCommand,
2531
+ passState,
2532
+ frustumCommands,
2533
+ );
2534
+ }
2535
+
2536
+ /**
2537
+ * Execute the draw commands for all the render passes.
2538
+ *
2539
+ * @param {Scene} scene
2540
+ * @param {PassState} passState
2541
+ *
2542
+ * @private
2543
+ */
2544
+ function executeCommands(scene, passState) {
2545
+ const { camera, context, frameState } = scene;
2546
+ const { uniformState } = context;
2547
+
2548
+ uniformState.updateCamera(camera);
2549
+
2550
+ const frustum = createWorkingFrustum(camera);
2551
+ frustum.near = camera.frustum.near;
2552
+ frustum.far = camera.frustum.far;
2553
+
2554
+ const passes = frameState.passes;
2555
+ const picking = passes.pick || passes.pickVoxel;
2556
+
2557
+ // Ideally, we would render the sky box and atmosphere last for
2558
+ // early-z, but we would have to draw it in each frustum.
2559
+ // Do not render environment primitives during a pick pass since they do not generate picking commands.
2560
+ if (!picking) {
2561
+ renderEnvironment(scene, passState);
2562
+ }
2563
+
2564
+ const {
2565
+ clearGlobeDepth,
2566
+ renderTranslucentDepthForPick,
2567
+ useDepthPlane,
2568
+ useGlobeDepthFramebuffer,
2569
+ useInvertClassification,
2570
+ usePostProcessSelected,
2571
+ } = scene._environmentState;
2572
+
2573
+ const {
2574
+ globeDepth,
2575
+ globeTranslucencyFramebuffer,
2576
+ sceneFramebuffer,
2577
+ frustumCommandsList,
2578
+ } = scene._view;
2421
2579
  const numFrustums = frustumCommandsList.length;
2422
2580
 
2423
- const clearGlobeDepth = environmentState.clearGlobeDepth;
2424
- const useDepthPlane = environmentState.useDepthPlane;
2425
2581
  const globeTranslucencyState = scene._globeTranslucencyState;
2426
- const globeTranslucent = globeTranslucencyState.translucent;
2427
- const globeTranslucencyFramebuffer = scene._view.globeTranslucencyFramebuffer;
2428
2582
  const clearDepth = scene._depthClearCommand;
2429
2583
  const clearStencil = scene._stencilClearCommand;
2430
2584
  const clearClassificationStencil = scene._classificationStencilClearCommand;
2431
2585
  const depthPlane = scene._depthPlane;
2432
- const usePostProcessSelected = environmentState.usePostProcessSelected;
2433
2586
 
2434
2587
  const height2D = camera.position.z;
2435
2588
 
2589
+ function performPass(frustumCommands, passId) {
2590
+ uniformState.updatePass(passId);
2591
+ const commands = frustumCommands.commands[passId];
2592
+ const commandCount = frustumCommands.indices[passId];
2593
+ for (let j = 0; j < commandCount; ++j) {
2594
+ executeCommand(commands[j], scene, passState);
2595
+ }
2596
+ return commandCount;
2597
+ }
2598
+
2599
+ function performIdPass(frustumCommands, passId) {
2600
+ uniformState.updatePass(passId);
2601
+ const commands = frustumCommands.commands[passId];
2602
+ const commandCount = frustumCommands.indices[passId];
2603
+ for (let j = 0; j < commandCount; ++j) {
2604
+ executeIdCommand(commands[j], scene, passState);
2605
+ }
2606
+ }
2607
+
2436
2608
  // Execute commands in each frustum in back to front order
2437
- let j;
2438
2609
  for (let i = 0; i < numFrustums; ++i) {
2439
2610
  const index = numFrustums - i - 1;
2440
2611
  const frustumCommands = frustumCommandsList[index];
@@ -2463,47 +2634,36 @@ function executeCommands(scene, passState) {
2463
2634
  clearStencil.execute(context, passState);
2464
2635
  }
2465
2636
 
2466
- uniformState.updatePass(Pass.GLOBE);
2467
- let commands = frustumCommands.commands[Pass.GLOBE];
2468
- let length = frustumCommands.indices[Pass.GLOBE];
2469
-
2470
- if (globeTranslucent) {
2637
+ if (globeTranslucencyState.translucent) {
2638
+ uniformState.updatePass(Pass.GLOBE);
2471
2639
  globeTranslucencyState.executeGlobeCommands(
2472
2640
  frustumCommands,
2473
2641
  executeCommand,
2474
2642
  globeTranslucencyFramebuffer,
2475
2643
  scene,
2476
- passState
2644
+ passState,
2477
2645
  );
2478
2646
  } else {
2479
- for (j = 0; j < length; ++j) {
2480
- executeCommand(commands[j], scene, context, passState);
2481
- }
2647
+ performPass(frustumCommands, Pass.GLOBE);
2482
2648
  }
2483
2649
 
2484
- const globeDepth = view.globeDepth;
2485
- if (defined(globeDepth) && environmentState.useGlobeDepthFramebuffer) {
2650
+ if (useGlobeDepthFramebuffer) {
2486
2651
  globeDepth.executeCopyDepth(context, passState);
2487
2652
  }
2488
2653
 
2489
2654
  // Draw terrain classification
2490
- if (!environmentState.renderTranslucentDepthForPick) {
2491
- uniformState.updatePass(Pass.TERRAIN_CLASSIFICATION);
2492
- commands = frustumCommands.commands[Pass.TERRAIN_CLASSIFICATION];
2493
- length = frustumCommands.indices[Pass.TERRAIN_CLASSIFICATION];
2494
-
2495
- if (globeTranslucent) {
2655
+ if (!renderTranslucentDepthForPick) {
2656
+ if (globeTranslucencyState.translucent) {
2657
+ uniformState.updatePass(Pass.TERRAIN_CLASSIFICATION);
2496
2658
  globeTranslucencyState.executeGlobeClassificationCommands(
2497
2659
  frustumCommands,
2498
2660
  executeCommand,
2499
2661
  globeTranslucencyFramebuffer,
2500
2662
  scene,
2501
- passState
2663
+ passState,
2502
2664
  );
2503
2665
  } else {
2504
- for (j = 0; j < length; ++j) {
2505
- executeCommand(commands[j], scene, context, passState);
2506
- }
2666
+ performPass(frustumCommands, Pass.TERRAIN_CLASSIFICATION);
2507
2667
  }
2508
2668
  }
2509
2669
 
@@ -2514,43 +2674,29 @@ function executeCommands(scene, passState) {
2514
2674
  }
2515
2675
  }
2516
2676
 
2517
- if (
2518
- !environmentState.useInvertClassification ||
2519
- picking ||
2520
- environmentState.renderTranslucentDepthForPick
2521
- ) {
2677
+ let commandCount;
2678
+ if (!useInvertClassification || picking || renderTranslucentDepthForPick) {
2522
2679
  // Common/fastest path. Draw 3D Tiles and classification normally.
2523
2680
 
2524
2681
  // Draw 3D Tiles
2525
- uniformState.updatePass(Pass.CESIUM_3D_TILE);
2526
- commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2527
- length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2528
- for (j = 0; j < length; ++j) {
2529
- executeCommand(commands[j], scene, context, passState);
2530
- }
2682
+ commandCount = performPass(frustumCommands, Pass.CESIUM_3D_TILE);
2531
2683
 
2532
- if (length > 0) {
2533
- if (defined(globeDepth) && environmentState.useGlobeDepthFramebuffer) {
2534
- // When clearGlobeDepth is true, executeUpdateDepth needs
2535
- // a globe depth texture with resolved stencil bits.
2684
+ if (commandCount > 0) {
2685
+ if (useGlobeDepthFramebuffer) {
2536
2686
  globeDepth.prepareColorTextures(context, clearGlobeDepth);
2537
2687
  globeDepth.executeUpdateDepth(
2538
2688
  context,
2539
2689
  passState,
2540
- clearGlobeDepth,
2541
- globeDepth.depthStencilTexture
2690
+ globeDepth.depthStencilTexture,
2542
2691
  );
2543
2692
  }
2544
2693
 
2545
2694
  // Draw classifications. Modifies 3D Tiles color.
2546
- if (!environmentState.renderTranslucentDepthForPick) {
2547
- uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2548
- commands =
2549
- frustumCommands.commands[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2550
- length = frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2551
- for (j = 0; j < length; ++j) {
2552
- executeCommand(commands[j], scene, context, passState);
2553
- }
2695
+ if (!renderTranslucentDepthForPick) {
2696
+ commandCount = performPass(
2697
+ frustumCommands,
2698
+ Pass.CESIUM_3D_TILE_CLASSIFICATION,
2699
+ );
2554
2700
  }
2555
2701
  }
2556
2702
  } else {
@@ -2592,34 +2738,22 @@ function executeCommands(scene, passState) {
2592
2738
  passState.framebuffer = scene._invertClassification._fbo.framebuffer;
2593
2739
 
2594
2740
  // Draw normally
2595
- uniformState.updatePass(Pass.CESIUM_3D_TILE);
2596
- commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2597
- length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2598
- for (j = 0; j < length; ++j) {
2599
- executeCommand(commands[j], scene, context, passState);
2600
- }
2741
+ commandCount = performPass(frustumCommands, Pass.CESIUM_3D_TILE);
2601
2742
 
2602
- if (defined(globeDepth) && environmentState.useGlobeDepthFramebuffer) {
2743
+ if (useGlobeDepthFramebuffer) {
2603
2744
  scene._invertClassification.prepareTextures(context);
2604
2745
  globeDepth.executeUpdateDepth(
2605
2746
  context,
2606
2747
  passState,
2607
- clearGlobeDepth,
2608
- scene._invertClassification._fbo.getDepthStencilTexture()
2748
+ scene._invertClassification._fbo.getDepthStencilTexture(),
2609
2749
  );
2610
2750
  }
2611
2751
 
2612
2752
  // Set stencil
2613
- uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW);
2614
- commands =
2615
- frustumCommands.commands[
2616
- Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW
2617
- ];
2618
- length =
2619
- frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW];
2620
- for (j = 0; j < length; ++j) {
2621
- executeCommand(commands[j], scene, context, passState);
2622
- }
2753
+ commandCount = performPass(
2754
+ frustumCommands,
2755
+ Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW,
2756
+ );
2623
2757
 
2624
2758
  passState.framebuffer = opaqueClassificationFramebuffer;
2625
2759
 
@@ -2631,35 +2765,24 @@ function executeCommands(scene, passState) {
2631
2765
  }
2632
2766
 
2633
2767
  // Clear stencil set by the classification for the next classification pass
2634
- if (length > 0 && context.stencilBuffer) {
2768
+ if (commandCount > 0 && context.stencilBuffer) {
2635
2769
  clearClassificationStencil.execute(context, passState);
2636
2770
  }
2637
2771
 
2638
2772
  // Draw style over classification.
2639
- uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2640
- commands = frustumCommands.commands[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2641
- length = frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2642
- for (j = 0; j < length; ++j) {
2643
- executeCommand(commands[j], scene, context, passState);
2644
- }
2773
+ commandCount = performPass(
2774
+ frustumCommands,
2775
+ Pass.CESIUM_3D_TILE_CLASSIFICATION,
2776
+ );
2645
2777
  }
2646
2778
 
2647
- if (length > 0 && context.stencilBuffer) {
2779
+ if (commandCount > 0 && context.stencilBuffer) {
2648
2780
  clearStencil.execute(context, passState);
2649
2781
  }
2650
2782
 
2651
- uniformState.updatePass(Pass.VOXELS);
2652
- commands = frustumCommands.commands[Pass.VOXELS];
2653
- length = frustumCommands.indices[Pass.VOXELS];
2654
- commands.length = length;
2655
- executeVoxelCommands(scene, executeCommand, passState, commands);
2656
-
2657
- uniformState.updatePass(Pass.OPAQUE);
2658
- commands = frustumCommands.commands[Pass.OPAQUE];
2659
- length = frustumCommands.indices[Pass.OPAQUE];
2660
- for (j = 0; j < length; ++j) {
2661
- executeCommand(commands[j], scene, context, passState);
2662
- }
2783
+ performVoxelsPass(scene, passState, frustumCommands);
2784
+
2785
+ performPass(frustumCommands, Pass.OPAQUE);
2663
2786
 
2664
2787
  if (index !== 0 && scene.mode !== SceneMode.SCENE2D) {
2665
2788
  // Do not overlap frustums in the translucent pass to avoid blending artifacts
@@ -2667,60 +2790,18 @@ function executeCommands(scene, passState) {
2667
2790
  uniformState.updateFrustum(frustum);
2668
2791
  }
2669
2792
 
2670
- let invertClassification;
2671
- if (
2672
- !picking &&
2673
- environmentState.useInvertClassification &&
2674
- frameState.invertClassificationColor.alpha < 1.0
2675
- ) {
2676
- // Fullscreen pass to copy unclassified fragments when alpha < 1.0.
2677
- // Not executed when undefined.
2678
- invertClassification = scene._invertClassification;
2679
- }
2793
+ performTranslucentPass(scene, passState, frustumCommands);
2680
2794
 
2681
- uniformState.updatePass(Pass.TRANSLUCENT);
2682
- commands = frustumCommands.commands[Pass.TRANSLUCENT];
2683
- commands.length = frustumCommands.indices[Pass.TRANSLUCENT];
2684
- executeTranslucentCommands(
2685
- scene,
2686
- executeCommand,
2687
- passState,
2688
- commands,
2689
- invertClassification
2690
- );
2691
-
2692
- // Classification for translucent 3D Tiles
2693
- const has3DTilesClassificationCommands =
2694
- frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION] > 0;
2695
- if (
2696
- has3DTilesClassificationCommands &&
2697
- view.translucentTileClassification.isSupported()
2698
- ) {
2699
- view.translucentTileClassification.executeTranslucentCommands(
2700
- scene,
2701
- executeCommand,
2702
- passState,
2703
- commands,
2704
- globeDepth.depthStencilTexture
2705
- );
2706
- view.translucentTileClassification.executeClassificationCommands(
2707
- scene,
2708
- executeCommand,
2709
- passState,
2710
- frustumCommands
2711
- );
2712
- }
2795
+ performTranslucent3DTilesClassification(scene, passState, frustumCommands);
2713
2796
 
2714
2797
  if (
2715
2798
  context.depthTexture &&
2716
2799
  scene.useDepthPicking &&
2717
- (environmentState.useGlobeDepthFramebuffer ||
2718
- renderTranslucentDepthForPick)
2800
+ (useGlobeDepthFramebuffer || renderTranslucentDepthForPick)
2719
2801
  ) {
2720
2802
  // PERFORMANCE_IDEA: Use MRT to avoid the extra copy.
2721
- const depthStencilTexture = globeDepth.depthStencilTexture;
2722
2803
  const pickDepth = scene._picking.getPickDepth(scene, index);
2723
- pickDepth.update(context, depthStencilTexture);
2804
+ pickDepth.update(context, globeDepth.depthStencilTexture);
2724
2805
  pickDepth.executeCopyDepth(context, passState);
2725
2806
  }
2726
2807
 
@@ -2729,7 +2810,7 @@ function executeCommands(scene, passState) {
2729
2810
  }
2730
2811
 
2731
2812
  const originalFramebuffer = passState.framebuffer;
2732
- passState.framebuffer = view.sceneFramebuffer.getIdFramebuffer();
2813
+ passState.framebuffer = sceneFramebuffer.getIdFramebuffer();
2733
2814
 
2734
2815
  // reset frustum
2735
2816
  frustum.near =
@@ -2739,22 +2820,17 @@ function executeCommands(scene, passState) {
2739
2820
  frustum.far = frustumCommands.far;
2740
2821
  uniformState.updateFrustum(frustum);
2741
2822
 
2742
- uniformState.updatePass(Pass.GLOBE);
2743
- commands = frustumCommands.commands[Pass.GLOBE];
2744
- length = frustumCommands.indices[Pass.GLOBE];
2745
-
2746
- if (globeTranslucent) {
2823
+ if (globeTranslucencyState.translucent) {
2824
+ uniformState.updatePass(Pass.GLOBE);
2747
2825
  globeTranslucencyState.executeGlobeCommands(
2748
2826
  frustumCommands,
2749
2827
  executeIdCommand,
2750
2828
  globeTranslucencyFramebuffer,
2751
2829
  scene,
2752
- passState
2830
+ passState,
2753
2831
  );
2754
2832
  } else {
2755
- for (j = 0; j < length; ++j) {
2756
- executeIdCommand(commands[j], scene, context, passState);
2757
- }
2833
+ performIdPass(frustumCommands, Pass.GLOBE);
2758
2834
  }
2759
2835
 
2760
2836
  if (clearGlobeDepth) {
@@ -2767,34 +2843,67 @@ function executeCommands(scene, passState) {
2767
2843
  depthPlane.execute(context, passState);
2768
2844
  }
2769
2845
 
2770
- uniformState.updatePass(Pass.CESIUM_3D_TILE);
2771
- commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2772
- length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2773
- for (j = 0; j < length; ++j) {
2774
- executeIdCommand(commands[j], scene, context, passState);
2775
- }
2846
+ performIdPass(frustumCommands, Pass.CESIUM_3D_TILE);
2847
+ performIdPass(frustumCommands, Pass.OPAQUE);
2848
+ performIdPass(frustumCommands, Pass.TRANSLUCENT);
2776
2849
 
2777
- uniformState.updatePass(Pass.OPAQUE);
2778
- commands = frustumCommands.commands[Pass.OPAQUE];
2779
- length = frustumCommands.indices[Pass.OPAQUE];
2780
- for (j = 0; j < length; ++j) {
2781
- executeIdCommand(commands[j], scene, context, passState);
2782
- }
2850
+ passState.framebuffer = originalFramebuffer;
2851
+ }
2852
+ }
2853
+
2854
+ /**
2855
+ * Render the sky, atmosphere, sun, and moon
2856
+ *
2857
+ * @param {Scene} scene The scene.
2858
+ * @param {PassState} passState The render state for the pass.
2859
+ *
2860
+ * @private
2861
+ */
2862
+ function renderEnvironment(scene, passState) {
2863
+ const { context, environmentState, view } = scene;
2864
+
2865
+ context.uniformState.updatePass(Pass.ENVIRONMENT);
2783
2866
 
2784
- uniformState.updatePass(Pass.TRANSLUCENT);
2785
- commands = frustumCommands.commands[Pass.TRANSLUCENT];
2786
- length = frustumCommands.indices[Pass.TRANSLUCENT];
2787
- for (j = 0; j < length; ++j) {
2788
- executeIdCommand(commands[j], scene, context, passState);
2867
+ if (defined(environmentState.skyBoxCommand)) {
2868
+ executeCommand(environmentState.skyBoxCommand, scene, passState);
2869
+ }
2870
+
2871
+ if (environmentState.isSkyAtmosphereVisible) {
2872
+ executeCommand(environmentState.skyAtmosphereCommand, scene, passState);
2873
+ }
2874
+
2875
+ if (environmentState.isSunVisible) {
2876
+ environmentState.sunDrawCommand.execute(context, passState);
2877
+ if (scene.sunBloom && !environmentState.useWebVR) {
2878
+ let framebuffer;
2879
+ if (environmentState.useGlobeDepthFramebuffer) {
2880
+ framebuffer = view.globeDepth.framebuffer;
2881
+ } else if (environmentState.usePostProcess) {
2882
+ framebuffer = view.sceneFramebuffer.framebuffer;
2883
+ } else {
2884
+ framebuffer = environmentState.originalFramebuffer;
2885
+ }
2886
+ scene._sunPostProcess.execute(context);
2887
+ scene._sunPostProcess.copy(context, framebuffer);
2888
+ passState.framebuffer = framebuffer;
2789
2889
  }
2890
+ }
2790
2891
 
2791
- passState.framebuffer = originalFramebuffer;
2892
+ // Moon can be seen through the atmosphere, since the sun is rendered after the atmosphere.
2893
+ if (environmentState.isMoonVisible) {
2894
+ environmentState.moonCommand.execute(context, passState);
2792
2895
  }
2793
2896
  }
2794
2897
 
2898
+ /**
2899
+ * Execute compute commands from the scene's environment state and computeCommandList
2900
+ *
2901
+ * @param {Scene} scene
2902
+ *
2903
+ * @private
2904
+ */
2795
2905
  function executeComputeCommands(scene) {
2796
- const us = scene.context.uniformState;
2797
- us.updatePass(Pass.COMPUTE);
2906
+ scene.context.uniformState.updatePass(Pass.COMPUTE);
2798
2907
 
2799
2908
  const sunComputeCommand = scene._environmentState.sunComputeCommand;
2800
2909
  if (defined(sunComputeCommand)) {
@@ -2802,114 +2911,130 @@ function executeComputeCommands(scene) {
2802
2911
  }
2803
2912
 
2804
2913
  const commandList = scene._computeCommandList;
2805
- const length = commandList.length;
2806
- for (let i = 0; i < length; ++i) {
2914
+ for (let i = 0; i < commandList.length; ++i) {
2807
2915
  commandList[i].execute(scene._computeEngine);
2808
2916
  }
2809
2917
  }
2810
2918
 
2919
+ /**
2920
+ * Execute the draw commands for overlays
2921
+ *
2922
+ * @param {Scene} scene
2923
+ * @param {PassState} passState
2924
+ *
2925
+ * @private
2926
+ */
2811
2927
  function executeOverlayCommands(scene, passState) {
2812
- const us = scene.context.uniformState;
2813
- us.updatePass(Pass.OVERLAY);
2928
+ scene.context.uniformState.updatePass(Pass.OVERLAY);
2814
2929
 
2815
2930
  const context = scene.context;
2816
2931
  const commandList = scene._overlayCommandList;
2817
- const length = commandList.length;
2818
- for (let i = 0; i < length; ++i) {
2932
+ for (let i = 0; i < commandList.length; ++i) {
2819
2933
  commandList[i].execute(context, passState);
2820
2934
  }
2821
2935
  }
2822
2936
 
2937
+ /**
2938
+ * Add the scene's draw commands into the shadow map passes.
2939
+ *
2940
+ * @param {Scene} scene
2941
+ * @param {DrawCommand[]} commandList
2942
+ * @param {ShadowMap} shadowMap
2943
+ *
2944
+ * @private
2945
+ */
2823
2946
  function insertShadowCastCommands(scene, commandList, shadowMap) {
2824
- const shadowVolume = shadowMap.shadowMapCullingVolume;
2825
- const isPointLight = shadowMap.isPointLight;
2826
- const passes = shadowMap.passes;
2947
+ const { shadowMapCullingVolume, isPointLight, passes } = shadowMap;
2827
2948
  const numberOfPasses = passes.length;
2828
2949
 
2829
- const length = commandList.length;
2830
- for (let i = 0; i < length; ++i) {
2950
+ const shadowedPasses = [
2951
+ Pass.GLOBE,
2952
+ Pass.CESIUM_3D_TILE,
2953
+ Pass.OPAQUE,
2954
+ Pass.TRANSLUCENT,
2955
+ ];
2956
+
2957
+ for (let i = 0; i < commandList.length; ++i) {
2831
2958
  const command = commandList[i];
2832
2959
  scene.updateDerivedCommands(command);
2833
2960
 
2834
2961
  if (
2835
- command.castShadows &&
2836
- (command.pass === Pass.GLOBE ||
2837
- command.pass === Pass.CESIUM_3D_TILE ||
2838
- command.pass === Pass.OPAQUE ||
2839
- command.pass === Pass.TRANSLUCENT)
2962
+ !command.castShadows ||
2963
+ shadowedPasses.indexOf(command.pass) < 0 ||
2964
+ !scene.isVisible(shadowMapCullingVolume, command)
2840
2965
  ) {
2841
- if (scene.isVisible(command, shadowVolume)) {
2842
- if (isPointLight) {
2843
- for (let k = 0; k < numberOfPasses; ++k) {
2844
- passes[k].commandList.push(command);
2845
- }
2846
- } else if (numberOfPasses === 1) {
2847
- passes[0].commandList.push(command);
2848
- } else {
2849
- let wasVisible = false;
2850
- // Loop over cascades from largest to smallest
2851
- for (let j = numberOfPasses - 1; j >= 0; --j) {
2852
- const cascadeVolume = passes[j].cullingVolume;
2853
- if (scene.isVisible(command, cascadeVolume)) {
2854
- passes[j].commandList.push(command);
2855
- wasVisible = true;
2856
- } else if (wasVisible) {
2857
- // If it was visible in the previous cascade but now isn't
2858
- // then there is no need to check any more cascades
2859
- break;
2860
- }
2861
- }
2966
+ continue;
2967
+ }
2968
+
2969
+ if (isPointLight) {
2970
+ for (let k = 0; k < numberOfPasses; ++k) {
2971
+ passes[k].commandList.push(command);
2972
+ }
2973
+ } else if (numberOfPasses === 1) {
2974
+ passes[0].commandList.push(command);
2975
+ } else {
2976
+ let wasVisible = false;
2977
+ // Loop over cascades from largest to smallest
2978
+ for (let j = numberOfPasses - 1; j >= 0; --j) {
2979
+ const cascadeVolume = passes[j].cullingVolume;
2980
+ if (scene.isVisible(cascadeVolume, command)) {
2981
+ passes[j].commandList.push(command);
2982
+ wasVisible = true;
2983
+ } else if (wasVisible) {
2984
+ // If it was visible in the previous cascade but now isn't
2985
+ // then there is no need to check any more cascades
2986
+ break;
2862
2987
  }
2863
2988
  }
2864
2989
  }
2865
2990
  }
2866
2991
  }
2867
2992
 
2993
+ /**
2994
+ * Execute the draw commands to cast shadows into the shadow maps.
2995
+ *
2996
+ * @param {Scene} scene
2997
+ *
2998
+ * @private
2999
+ */
2868
3000
  function executeShadowMapCastCommands(scene) {
2869
- const frameState = scene.frameState;
2870
- const shadowMaps = frameState.shadowState.shadowMaps;
2871
- const shadowMapLength = shadowMaps.length;
3001
+ const { shadowState, commandList } = scene.frameState;
3002
+ const { shadowsEnabled, shadowMaps } = shadowState;
2872
3003
 
2873
- if (!frameState.shadowState.shadowsEnabled) {
3004
+ if (!shadowsEnabled) {
2874
3005
  return;
2875
3006
  }
2876
3007
 
2877
- const context = scene.context;
2878
- const uniformState = context.uniformState;
3008
+ const { context } = scene;
3009
+ const { uniformState } = context;
2879
3010
 
2880
- for (let i = 0; i < shadowMapLength; ++i) {
3011
+ for (let i = 0; i < shadowMaps.length; ++i) {
2881
3012
  const shadowMap = shadowMaps[i];
2882
3013
  if (shadowMap.outOfView) {
2883
3014
  continue;
2884
3015
  }
2885
3016
 
2886
3017
  // Reset the command lists
2887
- const passes = shadowMap.passes;
2888
- const numberOfPasses = passes.length;
2889
- for (let j = 0; j < numberOfPasses; ++j) {
3018
+ const { passes } = shadowMap;
3019
+ for (let j = 0; j < passes.length; ++j) {
2890
3020
  passes[j].commandList.length = 0;
2891
3021
  }
2892
3022
 
2893
- // Insert the primitive/model commands into the command lists
2894
- const sceneCommands = scene.frameState.commandList;
2895
- insertShadowCastCommands(scene, sceneCommands, shadowMap);
3023
+ // Insert the primitive/model commands into the shadow map command lists
3024
+ insertShadowCastCommands(scene, commandList, shadowMap);
2896
3025
 
2897
- for (let j = 0; j < numberOfPasses; ++j) {
3026
+ for (let j = 0; j < passes.length; ++j) {
2898
3027
  const pass = shadowMap.passes[j];
2899
- uniformState.updateCamera(pass.camera);
3028
+ const { camera, commandList } = pass;
3029
+ uniformState.updateCamera(camera);
2900
3030
  shadowMap.updatePass(context, j);
2901
- const numberOfCommands = pass.commandList.length;
2902
- for (let k = 0; k < numberOfCommands; ++k) {
2903
- const command = pass.commandList[k];
3031
+ for (let k = 0; k < commandList.length; ++k) {
3032
+ const command = commandList[k];
2904
3033
  // Set the correct pass before rendering into the shadow map because some shaders
2905
3034
  // conditionally render based on whether the pass is translucent or opaque.
2906
3035
  uniformState.updatePass(command.pass);
2907
- executeCommand(
2908
- command.derivedCommands.shadows.castCommands[i],
2909
- scene,
2910
- context,
2911
- pass.passState
2912
- );
3036
+ const castCommand = command.derivedCommands.shadows.castCommands[i];
3037
+ executeCommand(castCommand, scene, pass.passState);
2913
3038
  }
2914
3039
  }
2915
3040
  }
@@ -2918,38 +3043,46 @@ function executeShadowMapCastCommands(scene) {
2918
3043
  const scratchEyeTranslation = new Cartesian3();
2919
3044
 
2920
3045
  /**
3046
+ * Update and clear framebuffers, and execute draw commands.
3047
+ *
3048
+ * @param {PassState} passState State specific to each render pass.
3049
+ * @param {Color} backgroundColor
3050
+ *
2921
3051
  * @private
2922
3052
  */
2923
3053
  Scene.prototype.updateAndExecuteCommands = function (
2924
3054
  passState,
2925
- backgroundColor
3055
+ backgroundColor,
2926
3056
  ) {
2927
- const frameState = this._frameState;
2928
- const mode = frameState.mode;
2929
- const useWebVR = this._environmentState.useWebVR;
3057
+ updateAndClearFramebuffers(this, passState, backgroundColor);
2930
3058
 
2931
- if (useWebVR) {
3059
+ if (this._environmentState.useWebVR) {
2932
3060
  executeWebVRCommands(this, passState, backgroundColor);
2933
3061
  } else if (
2934
- mode !== SceneMode.SCENE2D ||
3062
+ this._frameState.mode !== SceneMode.SCENE2D ||
2935
3063
  this._mapMode2D === MapMode2D.ROTATE
2936
3064
  ) {
2937
- executeCommandsInViewport(true, this, passState, backgroundColor);
3065
+ executeCommandsInViewport(true, this, passState);
2938
3066
  } else {
2939
- updateAndClearFramebuffers(this, passState, backgroundColor);
2940
3067
  execute2DViewportCommands(this, passState);
2941
3068
  }
2942
3069
  };
2943
3070
 
2944
- function executeWebVRCommands(scene, passState, backgroundColor) {
3071
+ /**
3072
+ * Execute the draw commands to render the scene into the stereo viewports of a WebVR application.
3073
+ *
3074
+ * @param {Scene} scene
3075
+ * @param {PassState} passState
3076
+ *
3077
+ * @private
3078
+ */
3079
+ function executeWebVRCommands(scene, passState) {
2945
3080
  const view = scene._view;
2946
3081
  const camera = view.camera;
2947
3082
  const environmentState = scene._environmentState;
2948
3083
  const renderTranslucentDepthForPick =
2949
3084
  environmentState.renderTranslucentDepthForPick;
2950
3085
 
2951
- updateAndClearFramebuffers(scene, passState, backgroundColor);
2952
-
2953
3086
  updateAndRenderPrimitives(scene);
2954
3087
 
2955
3088
  view.createPotentiallyVisibleSet(scene);
@@ -2976,7 +3109,7 @@ function executeWebVRCommands(scene, passState, backgroundColor) {
2976
3109
  const eyeTranslation = Cartesian3.multiplyByScalar(
2977
3110
  savedCamera.right,
2978
3111
  eyeSeparation * 0.5,
2979
- scratchEyeTranslation
3112
+ scratchEyeTranslation,
2980
3113
  );
2981
3114
 
2982
3115
  camera.frustum.aspectRatio = viewport.width / viewport.height;
@@ -3000,7 +3133,7 @@ function executeWebVRCommands(scene, passState, backgroundColor) {
3000
3133
 
3001
3134
  const scratch2DViewportCartographic = new Cartographic(
3002
3135
  Math.PI,
3003
- CesiumMath.PI_OVER_TWO
3136
+ CesiumMath.PI_OVER_TWO,
3004
3137
  );
3005
3138
  const scratch2DViewportMaxCoord = new Cartesian3();
3006
3139
  const scratch2DViewportSavedPosition = new Cartesian3();
@@ -3010,10 +3143,17 @@ const scratch2DViewportEyePoint = new Cartesian3();
3010
3143
  const scratch2DViewportWindowCoords = new Cartesian3();
3011
3144
  const scratch2DViewport = new BoundingRectangle();
3012
3145
 
3146
+ /**
3147
+ * Execute the draw commands to render into a 2D viewport.
3148
+ *
3149
+ * @param {Scene} scene
3150
+ * @param {PassState} passState
3151
+ *
3152
+ * @private
3153
+ */
3013
3154
  function execute2DViewportCommands(scene, passState) {
3014
- const context = scene.context;
3015
- const frameState = scene.frameState;
3016
- const camera = scene.camera;
3155
+ const { frameState, camera } = scene;
3156
+ const { uniformState } = scene.context;
3017
3157
 
3018
3158
  const originalViewport = passState.viewport;
3019
3159
  const viewport = BoundingRectangle.clone(originalViewport, scratch2DViewport);
@@ -3027,11 +3167,11 @@ function execute2DViewportCommands(scene, passState) {
3027
3167
 
3028
3168
  const position = Cartesian3.clone(
3029
3169
  camera.position,
3030
- scratch2DViewportSavedPosition
3170
+ scratch2DViewportSavedPosition,
3031
3171
  );
3032
3172
  const transform = Matrix4.clone(
3033
3173
  camera.transform,
3034
- scratch2DViewportCameraTransform
3174
+ scratch2DViewportCameraTransform,
3035
3175
  );
3036
3176
  const frustum = camera.frustum.clone();
3037
3177
 
@@ -3041,7 +3181,7 @@ function execute2DViewportCommands(scene, passState) {
3041
3181
  viewport,
3042
3182
  0.0,
3043
3183
  1.0,
3044
- scratch2DViewportTransform
3184
+ scratch2DViewportTransform,
3045
3185
  );
3046
3186
  const projectionMatrix = camera.frustum.projectionMatrix;
3047
3187
 
@@ -3050,13 +3190,13 @@ function execute2DViewportCommands(scene, passState) {
3050
3190
  CesiumMath.sign(x) * maxCoord.x - x,
3051
3191
  0.0,
3052
3192
  -camera.positionWC.x,
3053
- scratch2DViewportEyePoint
3193
+ scratch2DViewportEyePoint,
3054
3194
  );
3055
3195
  const windowCoordinates = Transforms.pointToGLWindowCoordinates(
3056
3196
  projectionMatrix,
3057
3197
  viewportTransformation,
3058
3198
  eyePoint,
3059
- scratch2DViewportWindowCoords
3199
+ scratch2DViewportWindowCoords,
3060
3200
  );
3061
3201
 
3062
3202
  windowCoordinates.x = Math.floor(windowCoordinates.x);
@@ -3082,9 +3222,9 @@ function execute2DViewportCommands(scene, passState) {
3082
3222
  frameState.cullingVolume = camera.frustum.computeCullingVolume(
3083
3223
  camera.positionWC,
3084
3224
  camera.directionWC,
3085
- camera.upWC
3225
+ camera.upWC,
3086
3226
  );
3087
- context.uniformState.update(frameState);
3227
+ uniformState.update(frameState);
3088
3228
 
3089
3229
  executeCommandsInViewport(true, scene, passState);
3090
3230
 
@@ -3098,9 +3238,9 @@ function execute2DViewportCommands(scene, passState) {
3098
3238
  frameState.cullingVolume = camera.frustum.computeCullingVolume(
3099
3239
  camera.positionWC,
3100
3240
  camera.directionWC,
3101
- camera.upWC
3241
+ camera.upWC,
3102
3242
  );
3103
- context.uniformState.update(frameState);
3243
+ uniformState.update(frameState);
3104
3244
 
3105
3245
  executeCommandsInViewport(false, scene, passState);
3106
3246
  } else if (windowCoordinates.x > viewportX + viewportWidth * 0.5) {
@@ -3112,9 +3252,9 @@ function execute2DViewportCommands(scene, passState) {
3112
3252
  frameState.cullingVolume = camera.frustum.computeCullingVolume(
3113
3253
  camera.positionWC,
3114
3254
  camera.directionWC,
3115
- camera.upWC
3255
+ camera.upWC,
3116
3256
  );
3117
- context.uniformState.update(frameState);
3257
+ uniformState.update(frameState);
3118
3258
 
3119
3259
  executeCommandsInViewport(true, scene, passState);
3120
3260
 
@@ -3129,9 +3269,9 @@ function execute2DViewportCommands(scene, passState) {
3129
3269
  frameState.cullingVolume = camera.frustum.computeCullingVolume(
3130
3270
  camera.positionWC,
3131
3271
  camera.directionWC,
3132
- camera.upWC
3272
+ camera.upWC,
3133
3273
  );
3134
- context.uniformState.update(frameState);
3274
+ uniformState.update(frameState);
3135
3275
 
3136
3276
  executeCommandsInViewport(false, scene, passState);
3137
3277
  } else {
@@ -3144,9 +3284,9 @@ function execute2DViewportCommands(scene, passState) {
3144
3284
  frameState.cullingVolume = camera.frustum.computeCullingVolume(
3145
3285
  camera.positionWC,
3146
3286
  camera.directionWC,
3147
- camera.upWC
3287
+ camera.upWC,
3148
3288
  );
3149
- context.uniformState.update(frameState);
3289
+ uniformState.update(frameState);
3150
3290
 
3151
3291
  executeCommandsInViewport(true, scene, passState);
3152
3292
 
@@ -3161,9 +3301,9 @@ function execute2DViewportCommands(scene, passState) {
3161
3301
  frameState.cullingVolume = camera.frustum.computeCullingVolume(
3162
3302
  camera.positionWC,
3163
3303
  camera.directionWC,
3164
- camera.upWC
3304
+ camera.upWC,
3165
3305
  );
3166
- context.uniformState.update(frameState);
3306
+ uniformState.update(frameState);
3167
3307
 
3168
3308
  executeCommandsInViewport(false, scene, passState);
3169
3309
  }
@@ -3174,16 +3314,19 @@ function execute2DViewportCommands(scene, passState) {
3174
3314
  passState.viewport = originalViewport;
3175
3315
  }
3176
3316
 
3177
- function executeCommandsInViewport(
3178
- firstViewport,
3179
- scene,
3180
- passState,
3181
- backgroundColor
3182
- ) {
3183
- const environmentState = scene._environmentState;
3317
+ /**
3318
+ * Execute the draw commands to render the scene into the viewport.
3319
+ * If this is the first viewport rendered, the framebuffers will be cleared to the background color.
3320
+ *
3321
+ * @param {boolean} firstViewport <code>true</code> if this is the first viewport rendered.
3322
+ * @param {Scene} scene
3323
+ * @param {PassState} passState
3324
+ *
3325
+ * @private
3326
+ */
3327
+ function executeCommandsInViewport(firstViewport, scene, passState) {
3184
3328
  const view = scene._view;
3185
- const renderTranslucentDepthForPick =
3186
- environmentState.renderTranslucentDepthForPick;
3329
+ const { renderTranslucentDepthForPick } = scene._environmentState;
3187
3330
 
3188
3331
  if (!firstViewport) {
3189
3332
  scene.frameState.commandList.length = 0;
@@ -3194,9 +3337,6 @@ function executeCommandsInViewport(
3194
3337
  view.createPotentiallyVisibleSet(scene);
3195
3338
 
3196
3339
  if (firstViewport) {
3197
- if (defined(backgroundColor)) {
3198
- updateAndClearFramebuffers(scene, passState, backgroundColor);
3199
- }
3200
3340
  executeComputeCommands(scene);
3201
3341
  if (!renderTranslucentDepthForPick) {
3202
3342
  executeShadowMapCastCommands(scene);
@@ -3239,7 +3379,7 @@ Scene.prototype.updateEnvironment = function () {
3239
3379
  if (defined(skyAtmosphere)) {
3240
3380
  if (defined(globe)) {
3241
3381
  skyAtmosphere.setDynamicLighting(
3242
- DynamicAtmosphereLightingType.fromGlobeFlags(globe)
3382
+ DynamicAtmosphereLightingType.fromGlobeFlags(globe),
3243
3383
  );
3244
3384
  environmentState.isReadyForAtmosphere =
3245
3385
  environmentState.isReadyForAtmosphere ||
@@ -3253,7 +3393,7 @@ Scene.prototype.updateEnvironment = function () {
3253
3393
 
3254
3394
  environmentState.skyAtmosphereCommand = skyAtmosphere.update(
3255
3395
  frameState,
3256
- globe
3396
+ globe,
3257
3397
  );
3258
3398
  if (defined(environmentState.skyAtmosphereCommand)) {
3259
3399
  this.updateDerivedCommands(environmentState.skyAtmosphereCommand);
@@ -3317,14 +3457,14 @@ Scene.prototype.updateEnvironment = function () {
3317
3457
  defined(environmentState.skyAtmosphereCommand) &&
3318
3458
  environmentState.isReadyForAtmosphere;
3319
3459
  environmentState.isSunVisible = this.isVisible(
3320
- environmentState.sunDrawCommand,
3321
3460
  cullingVolume,
3322
- occluder
3461
+ environmentState.sunDrawCommand,
3462
+ occluder,
3323
3463
  );
3324
3464
  environmentState.isMoonVisible = this.isVisible(
3325
- environmentState.moonCommand,
3326
3465
  cullingVolume,
3327
- occluder
3466
+ environmentState.moonCommand,
3467
+ occluder,
3328
3468
  );
3329
3469
 
3330
3470
  const envMaps = this.specularEnvironmentMaps;
@@ -3366,21 +3506,21 @@ function updateDebugFrustumPlanes(scene) {
3366
3506
 
3367
3507
  function updateShadowMaps(scene) {
3368
3508
  const frameState = scene._frameState;
3369
- const shadowMaps = frameState.shadowMaps;
3509
+ const { passes, shadowState, shadowMaps } = frameState;
3370
3510
  const length = shadowMaps.length;
3371
3511
 
3372
3512
  const shadowsEnabled =
3373
3513
  length > 0 &&
3374
- !frameState.passes.pick &&
3375
- !frameState.passes.pickVoxel &&
3514
+ !passes.pick &&
3515
+ !passes.pickVoxel &&
3376
3516
  scene.mode === SceneMode.SCENE3D;
3377
- if (shadowsEnabled !== frameState.shadowState.shadowsEnabled) {
3517
+ if (shadowsEnabled !== shadowState.shadowsEnabled) {
3378
3518
  // Update derived commands when shadowsEnabled changes
3379
- ++frameState.shadowState.lastDirtyTime;
3380
- frameState.shadowState.shadowsEnabled = shadowsEnabled;
3519
+ ++shadowState.lastDirtyTime;
3520
+ shadowState.shadowsEnabled = shadowsEnabled;
3381
3521
  }
3382
3522
 
3383
- frameState.shadowState.lightShadowsEnabled = false;
3523
+ shadowState.lightShadowsEnabled = false;
3384
3524
 
3385
3525
  if (!shadowsEnabled) {
3386
3526
  return;
@@ -3389,28 +3529,28 @@ function updateShadowMaps(scene) {
3389
3529
  // Check if the shadow maps are different than the shadow maps last frame.
3390
3530
  // If so, the derived commands need to be updated.
3391
3531
  for (let j = 0; j < length; ++j) {
3392
- if (shadowMaps[j] !== frameState.shadowState.shadowMaps[j]) {
3393
- ++frameState.shadowState.lastDirtyTime;
3532
+ if (shadowMaps[j] !== shadowState.shadowMaps[j]) {
3533
+ ++shadowState.lastDirtyTime;
3394
3534
  break;
3395
3535
  }
3396
3536
  }
3397
3537
 
3398
- frameState.shadowState.shadowMaps.length = 0;
3399
- frameState.shadowState.lightShadowMaps.length = 0;
3538
+ shadowState.shadowMaps.length = 0;
3539
+ shadowState.lightShadowMaps.length = 0;
3400
3540
 
3401
3541
  for (let i = 0; i < length; ++i) {
3402
3542
  const shadowMap = shadowMaps[i];
3403
3543
  shadowMap.update(frameState);
3404
3544
 
3405
- frameState.shadowState.shadowMaps.push(shadowMap);
3545
+ shadowState.shadowMaps.push(shadowMap);
3406
3546
 
3407
3547
  if (shadowMap.fromLightSource) {
3408
- frameState.shadowState.lightShadowMaps.push(shadowMap);
3409
- frameState.shadowState.lightShadowsEnabled = true;
3548
+ shadowState.lightShadowMaps.push(shadowMap);
3549
+ shadowState.lightShadowsEnabled = true;
3410
3550
  }
3411
3551
 
3412
3552
  if (shadowMap.dirty) {
3413
- ++frameState.shadowState.lastDirtyTime;
3553
+ ++shadowState.lastDirtyTime;
3414
3554
  shadowMap.dirty = false;
3415
3555
  }
3416
3556
  }
@@ -3436,7 +3576,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3436
3576
  const environmentState = scene._environmentState;
3437
3577
  const view = scene._view;
3438
3578
 
3439
- const passes = scene._frameState.passes;
3579
+ const passes = frameState.passes;
3440
3580
  const picking = passes.pick || passes.pickVoxel;
3441
3581
  if (defined(view.globeDepth)) {
3442
3582
  view.globeDepth.picking = picking;
@@ -3467,9 +3607,8 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3467
3607
 
3468
3608
  // Update globe depth rendering based on the current context and clear the globe depth framebuffer.
3469
3609
  // Globe depth is copied for the pick pass to support picking batched geometries in GroundPrimitives.
3470
- const useGlobeDepthFramebuffer = (environmentState.useGlobeDepthFramebuffer = defined(
3471
- view.globeDepth
3472
- ));
3610
+ const useGlobeDepthFramebuffer = (environmentState.useGlobeDepthFramebuffer =
3611
+ defined(view.globeDepth));
3473
3612
  if (useGlobeDepthFramebuffer) {
3474
3613
  view.globeDepth.update(
3475
3614
  context,
@@ -3477,7 +3616,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3477
3616
  view.viewport,
3478
3617
  scene.msaaSamples,
3479
3618
  scene._hdr,
3480
- environmentState.clearGlobeDepth
3619
+ environmentState.clearGlobeDepth,
3481
3620
  );
3482
3621
  view.globeDepth.clear(context, passState, clearColor);
3483
3622
  }
@@ -3492,7 +3631,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3492
3631
  passState,
3493
3632
  view.globeDepth.colorFramebufferManager,
3494
3633
  scene._hdr,
3495
- scene.msaaSamples
3634
+ scene.msaaSamples,
3496
3635
  );
3497
3636
  oit.clear(context, passState, clearColor);
3498
3637
  environmentState.useOIT = oit.isSupported();
@@ -3512,7 +3651,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3512
3651
  context,
3513
3652
  view.viewport,
3514
3653
  scene._hdr,
3515
- scene.msaaSamples
3654
+ scene.msaaSamples,
3516
3655
  );
3517
3656
  view.sceneFramebuffer.clear(context, passState, clearColor);
3518
3657
 
@@ -3541,8 +3680,8 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3541
3680
  !picking && defined(passState.framebuffer) && scene.invertClassification);
3542
3681
  if (useInvertClassification) {
3543
3682
  let depthFramebuffer;
3544
- if (scene.frameState.invertClassificationColor.alpha === 1.0) {
3545
- if (environmentState.useGlobeDepthFramebuffer) {
3683
+ if (frameState.invertClassificationColor.alpha === 1.0) {
3684
+ if (useGlobeDepthFramebuffer) {
3546
3685
  depthFramebuffer = view.globeDepth.framebuffer;
3547
3686
  }
3548
3687
  }
@@ -3552,17 +3691,17 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3552
3691
  scene._invertClassification.update(
3553
3692
  context,
3554
3693
  scene.msaaSamples,
3555
- view.globeDepth.colorFramebufferManager
3694
+ view.globeDepth.colorFramebufferManager,
3556
3695
  );
3557
3696
  scene._invertClassification.clear(context, passState);
3558
3697
 
3559
- if (scene.frameState.invertClassificationColor.alpha < 1.0 && useOIT) {
3698
+ if (frameState.invertClassificationColor.alpha < 1.0 && useOIT) {
3560
3699
  const command = scene._invertClassification.unclassifiedCommand;
3561
3700
  const derivedCommands = command.derivedCommands;
3562
3701
  derivedCommands.oit = oit.createDerivedCommands(
3563
3702
  command,
3564
3703
  context,
3565
- derivedCommands.oit
3704
+ derivedCommands.oit,
3566
3705
  );
3567
3706
  }
3568
3707
  } else {
@@ -3575,7 +3714,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3575
3714
  scene._hdr,
3576
3715
  view.viewport,
3577
3716
  context,
3578
- passState
3717
+ passState,
3579
3718
  );
3580
3719
  }
3581
3720
  }
@@ -3587,16 +3726,18 @@ Scene.prototype.resolveFramebuffers = function (passState) {
3587
3726
  const context = this._context;
3588
3727
  const environmentState = this._environmentState;
3589
3728
  const view = this._view;
3590
- const globeDepth = view.globeDepth;
3729
+ const { globeDepth, translucentTileClassification } = view;
3591
3730
  if (defined(globeDepth)) {
3592
3731
  globeDepth.prepareColorTextures(context);
3593
3732
  }
3594
3733
 
3595
- const useOIT = environmentState.useOIT;
3596
- const useGlobeDepthFramebuffer = environmentState.useGlobeDepthFramebuffer;
3597
- const usePostProcess = environmentState.usePostProcess;
3734
+ const {
3735
+ useOIT,
3736
+ useGlobeDepthFramebuffer,
3737
+ usePostProcess,
3738
+ originalFramebuffer,
3739
+ } = environmentState;
3598
3740
 
3599
- const defaultFramebuffer = environmentState.originalFramebuffer;
3600
3741
  const globeFramebuffer = useGlobeDepthFramebuffer
3601
3742
  ? globeDepth.colorFramebufferManager
3602
3743
  : undefined;
@@ -3606,11 +3747,10 @@ Scene.prototype.resolveFramebuffers = function (passState) {
3606
3747
  if (useOIT) {
3607
3748
  passState.framebuffer = usePostProcess
3608
3749
  ? sceneFramebuffer.framebuffer
3609
- : defaultFramebuffer;
3750
+ : originalFramebuffer;
3610
3751
  view.oit.execute(context, passState);
3611
3752
  }
3612
3753
 
3613
- const translucentTileClassification = view.translucentTileClassification;
3614
3754
  if (
3615
3755
  translucentTileClassification.hasTranslucentDepth &&
3616
3756
  translucentTileClassification.isSupported()
@@ -3630,14 +3770,14 @@ Scene.prototype.resolveFramebuffers = function (passState) {
3630
3770
  const idTexture = idFramebuffer.getColorTexture(0);
3631
3771
  const depthTexture = defaultValue(
3632
3772
  globeFramebuffer,
3633
- sceneFramebuffer
3773
+ sceneFramebuffer,
3634
3774
  ).getDepthStencilTexture();
3635
3775
  postProcess.execute(context, colorTexture, depthTexture, idTexture);
3636
- postProcess.copy(context, defaultFramebuffer);
3776
+ postProcess.copy(context, originalFramebuffer);
3637
3777
  }
3638
3778
 
3639
3779
  if (!useOIT && !usePostProcess && useGlobeDepthFramebuffer) {
3640
- passState.framebuffer = defaultFramebuffer;
3780
+ passState.framebuffer = originalFramebuffer;
3641
3781
  globeDepth.executeCopyColor(context, passState);
3642
3782
  }
3643
3783
  };
@@ -3646,7 +3786,7 @@ function callAfterRenderFunctions(scene) {
3646
3786
  // Functions are queued up during primitive update and executed here in case
3647
3787
  // the function modifies scene state that should remain constant over the frame.
3648
3788
  const functions = scene._frameState.afterRender;
3649
- for (let i = 0, length = functions.length; i < length; ++i) {
3789
+ for (let i = 0; i < functions.length; ++i) {
3650
3790
  const shouldRequestRender = functions[i]();
3651
3791
  if (shouldRequestRender) {
3652
3792
  scene.requestRender();
@@ -3660,9 +3800,7 @@ function getGlobeHeight(scene) {
3660
3800
  if (scene.mode === SceneMode.MORPHING) {
3661
3801
  return;
3662
3802
  }
3663
-
3664
- const camera = scene.camera;
3665
- const cartographic = camera.positionCartographic;
3803
+ const cartographic = scene.camera.positionCartographic;
3666
3804
  return scene.getHeight(cartographic);
3667
3805
  }
3668
3806
 
@@ -3740,7 +3878,7 @@ const updateHeightScratchCartographic = new Cartographic();
3740
3878
  Scene.prototype.updateHeight = function (
3741
3879
  cartographic,
3742
3880
  callback,
3743
- heightReference
3881
+ heightReference,
3744
3882
  ) {
3745
3883
  //>>includeStart('debug', pragmas.debug);
3746
3884
  Check.typeOf.func("callback", callback);
@@ -3768,7 +3906,7 @@ Scene.prototype.updateHeight = function (
3768
3906
  if (!ignoreTerrain && defined(this.globe)) {
3769
3907
  terrainRemoveCallback = this.globe._surface.updateHeight(
3770
3908
  cartographic,
3771
- callbackWrapper
3909
+ callbackWrapper,
3772
3910
  );
3773
3911
  }
3774
3912
 
@@ -3786,7 +3924,7 @@ Scene.prototype.updateHeight = function (
3786
3924
  const tilesetRemoveCallback = primitive.updateHeight(
3787
3925
  cartographic,
3788
3926
  callbackWrapper,
3789
- ellipsoid
3927
+ ellipsoid,
3790
3928
  );
3791
3929
  tilesetRemoveCallbacks[primitive.id] = tilesetRemoveCallback;
3792
3930
  };
@@ -3800,10 +3938,10 @@ Scene.prototype.updateHeight = function (
3800
3938
  }
3801
3939
 
3802
3940
  const removeAddedListener = this.primitives.primitiveAdded.addEventListener(
3803
- createPrimitiveEventListener
3941
+ createPrimitiveEventListener,
3804
3942
  );
3805
- const removeRemovedListener = this.primitives.primitiveRemoved.addEventListener(
3806
- (primitive) => {
3943
+ const removeRemovedListener =
3944
+ this.primitives.primitiveRemoved.addEventListener((primitive) => {
3807
3945
  if (primitive.isDestroyed() || !primitive.isCesium3DTileset) {
3808
3946
  return;
3809
3947
  }
@@ -3811,13 +3949,12 @@ Scene.prototype.updateHeight = function (
3811
3949
  tilesetRemoveCallbacks[primitive.id]();
3812
3950
  }
3813
3951
  delete tilesetRemoveCallbacks[primitive.id];
3814
- }
3815
- );
3952
+ });
3816
3953
 
3817
3954
  const removeCallback = () => {
3818
3955
  terrainRemoveCallback = terrainRemoveCallback && terrainRemoveCallback();
3819
3956
  Object.values(tilesetRemoveCallbacks).forEach((tilesetRemoveCallback) =>
3820
- tilesetRemoveCallback()
3957
+ tilesetRemoveCallback(),
3821
3958
  );
3822
3959
  tilesetRemoveCallbacks = {};
3823
3960
  removeAddedListener();
@@ -3882,7 +4019,7 @@ Scene.prototype.initializeFrame = function () {
3882
4019
  }
3883
4020
 
3884
4021
  this._globeHeight = updatedCartographic.height;
3885
- }
4022
+ },
3886
4023
  );
3887
4024
  }
3888
4025
  this._cameraUnderground = isCameraUnderground(this);
@@ -3918,7 +4055,7 @@ function updateDebugShowFramesPerSecond(scene, renderedThisFrame) {
3918
4055
  scene._performanceDisplay =
3919
4056
  scene._performanceDisplay && scene._performanceDisplay.destroy();
3920
4057
  scene._performanceContainer.parentNode.removeChild(
3921
- scene._performanceContainer
4058
+ scene._performanceContainer,
3922
4059
  );
3923
4060
  }
3924
4061
  }
@@ -3927,8 +4064,7 @@ function prePassesUpdate(scene) {
3927
4064
  scene._jobScheduler.resetBudgets();
3928
4065
 
3929
4066
  const frameState = scene._frameState;
3930
- const primitives = scene.primitives;
3931
- primitives.prePassesUpdate(frameState);
4067
+ scene.primitives.prePassesUpdate(frameState);
3932
4068
 
3933
4069
  if (defined(scene.globe)) {
3934
4070
  scene.globe.update(frameState);
@@ -3939,20 +4075,23 @@ function prePassesUpdate(scene) {
3939
4075
  }
3940
4076
 
3941
4077
  function postPassesUpdate(scene) {
3942
- const frameState = scene._frameState;
3943
- const primitives = scene.primitives;
3944
- primitives.postPassesUpdate(frameState);
3945
-
4078
+ scene.primitives.postPassesUpdate(scene._frameState);
3946
4079
  RequestScheduler.update();
3947
4080
  }
3948
4081
 
3949
4082
  const scratchBackgroundColor = new Color();
3950
4083
 
4084
+ /**
4085
+ * Render the scene
4086
+ *
4087
+ * @param {Scene} scene
4088
+ * @private
4089
+ */
3951
4090
  function render(scene) {
3952
4091
  const frameState = scene._frameState;
3953
4092
 
3954
4093
  const context = scene.context;
3955
- const us = context.uniformState;
4094
+ const { uniformState } = context;
3956
4095
 
3957
4096
  const view = scene._defaultView;
3958
4097
  scene._view = view;
@@ -3974,13 +4113,16 @@ function render(scene) {
3974
4113
  frameState.atmosphere = scene.atmosphere;
3975
4114
  scene.fog.update(frameState);
3976
4115
 
3977
- us.update(frameState);
4116
+ uniformState.update(frameState);
3978
4117
 
3979
4118
  const shadowMap = scene.shadowMap;
3980
4119
  if (defined(shadowMap) && shadowMap.enabled) {
3981
4120
  if (!defined(scene.light) || scene.light instanceof SunLight) {
3982
4121
  // Negate the sun direction so that it is from the Sun, not to the Sun
3983
- Cartesian3.negate(us.sunDirectionWC, scene._shadowMapCamera.direction);
4122
+ Cartesian3.negate(
4123
+ uniformState.sunDirectionWC,
4124
+ scene._shadowMapCamera.direction,
4125
+ );
3984
4126
  } else {
3985
4127
  Cartesian3.clone(scene.light.direction, scene._shadowMapCamera.direction);
3986
4128
  }
@@ -4079,7 +4221,7 @@ Scene.prototype.render = function (time) {
4079
4221
  defined(this._lastRenderTime)
4080
4222
  ) {
4081
4223
  const difference = Math.abs(
4082
- JulianDate.secondsDifference(this._lastRenderTime, time)
4224
+ JulianDate.secondsDifference(this._lastRenderTime, time),
4083
4225
  );
4084
4226
  shouldRender = shouldRender || difference > this.maximumRenderTimeChange;
4085
4227
  }
@@ -4093,7 +4235,7 @@ Scene.prototype.render = function (time) {
4093
4235
  const frameNumber = CesiumMath.incrementWrap(
4094
4236
  frameState.frameNumber,
4095
4237
  15000000.0,
4096
- 1.0
4238
+ 1.0,
4097
4239
  );
4098
4240
  updateFrameNumber(this, frameNumber, time);
4099
4241
  frameState.newFrame = true;
@@ -4102,9 +4244,7 @@ Scene.prototype.render = function (time) {
4102
4244
  tryAndCatchError(this, prePassesUpdate);
4103
4245
 
4104
4246
  /**
4105
- *
4106
4247
  * Passes update. Add any passes here
4107
- *
4108
4248
  */
4109
4249
  if (this.primitives.show) {
4110
4250
  tryAndCatchError(this, updateMostDetailedRayPicks);
@@ -4124,14 +4264,13 @@ Scene.prototype.render = function (time) {
4124
4264
  }
4125
4265
 
4126
4266
  /**
4127
- *
4128
4267
  * Post passes update. Execute any pass invariant code that should run after the passes here.
4129
- *
4130
4268
  */
4131
4269
  updateDebugShowFramesPerSecond(this, shouldRender);
4132
4270
  tryAndCatchError(this, postPassesUpdate);
4133
4271
 
4134
- // Often used to trigger events (so don't want in trycatch) that the user might be subscribed to. Things like the tile load events, promises, etc.
4272
+ // Often used to trigger events (so don't want in trycatch) that the user
4273
+ // might be subscribed to. Things like the tile load events, promises, etc.
4135
4274
  // We don't want those events to resolve during the render loop because the events might add new primitives
4136
4275
  callAfterRenderFunctions(this);
4137
4276
 
@@ -4169,7 +4308,7 @@ Scene.prototype.requestRender = function () {
4169
4308
  Scene.prototype.clampLineWidth = function (width) {
4170
4309
  return Math.max(
4171
4310
  ContextLimits.minimumAliasedLineWidth,
4172
- Math.min(width, ContextLimits.maximumAliasedLineWidth)
4311
+ Math.min(width, ContextLimits.maximumAliasedLineWidth),
4173
4312
  );
4174
4313
  };
4175
4314
 
@@ -4232,7 +4371,7 @@ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4232
4371
  this,
4233
4372
  windowPosition,
4234
4373
  width,
4235
- height
4374
+ height,
4236
4375
  );
4237
4376
  // Look up the keyframeNode containing this picked cell
4238
4377
  const tileIndex = 255 * voxelCoordinate[0] + voxelCoordinate[1];
@@ -4248,8 +4387,92 @@ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4248
4387
  voxelPrimitive,
4249
4388
  tileIndex,
4250
4389
  sampleIndex,
4251
- keyframeNode
4390
+ keyframeNode,
4391
+ );
4392
+ };
4393
+
4394
+ /**
4395
+ * Pick a metadata value at the given window position.
4396
+ *
4397
+ * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
4398
+ * @param {string|undefined} schemaId The ID of the metadata schema to pick values
4399
+ * from. If this is `undefined`, then it will pick the values from the object
4400
+ * that match the given class- and property name, regardless of the schema ID.
4401
+ * @param {string} className The name of the metadata class to pick
4402
+ * values from
4403
+ * @param {string} propertyName The name of the metadata property to pick
4404
+ * values from
4405
+ * @returns The metadata value
4406
+ *
4407
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
4408
+ */
4409
+ Scene.prototype.pickMetadata = function (
4410
+ windowPosition,
4411
+ schemaId,
4412
+ className,
4413
+ propertyName,
4414
+ ) {
4415
+ //>>includeStart('debug', pragmas.debug);
4416
+ Check.typeOf.object("windowPosition", windowPosition);
4417
+ Check.typeOf.string("className", className);
4418
+ Check.typeOf.string("propertyName", propertyName);
4419
+ //>>includeEnd('debug');
4420
+
4421
+ const pickedObject = this.pick(windowPosition);
4422
+ if (!defined(pickedObject)) {
4423
+ return undefined;
4424
+ }
4425
+
4426
+ // Check if the picked object is a model that has structural
4427
+ // metadata, with a schema that contains the specified
4428
+ // property.
4429
+ const schema = pickedObject.detail?.model?.structuralMetadata?.schema;
4430
+ const classProperty = getMetadataClassProperty(
4431
+ schema,
4432
+ schemaId,
4433
+ className,
4434
+ propertyName,
4435
+ );
4436
+ if (!defined(classProperty)) {
4437
+ return undefined;
4438
+ }
4439
+
4440
+ const pickedMetadataInfo = new PickedMetadataInfo(
4441
+ schemaId,
4442
+ className,
4443
+ propertyName,
4444
+ classProperty,
4445
+ );
4446
+
4447
+ const pickedMetadataValues = this._picking.pickMetadata(
4448
+ this,
4449
+ windowPosition,
4450
+ pickedMetadataInfo,
4252
4451
  );
4452
+
4453
+ return pickedMetadataValues;
4454
+ };
4455
+
4456
+ /**
4457
+ * Pick the schema of the metadata of the object at the given position
4458
+ *
4459
+ * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
4460
+ * @returns {MetadataSchema} The metadata schema, or `undefined` if there is no object with
4461
+ * associated metadata at the given position.
4462
+ *
4463
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
4464
+ */
4465
+ Scene.prototype.pickMetadataSchema = function (windowPosition) {
4466
+ //>>includeStart('debug', pragmas.debug);
4467
+ Check.typeOf.object("windowPosition", windowPosition);
4468
+ //>>includeEnd('debug');
4469
+
4470
+ const pickedObject = this.pick(windowPosition);
4471
+ if (!defined(pickedObject)) {
4472
+ return undefined;
4473
+ }
4474
+ const schema = pickedObject.detail?.model?.structuralMetadata?.schema;
4475
+ return schema;
4253
4476
  };
4254
4477
 
4255
4478
  /**
@@ -4271,12 +4494,12 @@ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4271
4494
  */
4272
4495
  Scene.prototype.pickPositionWorldCoordinates = function (
4273
4496
  windowPosition,
4274
- result
4497
+ result,
4275
4498
  ) {
4276
4499
  return this._picking.pickPositionWorldCoordinates(
4277
4500
  this,
4278
4501
  windowPosition,
4279
- result
4502
+ result,
4280
4503
  );
4281
4504
  };
4282
4505
 
@@ -4353,7 +4576,7 @@ function updateRequestRenderModeDeferCheckPass(scene) {
4353
4576
  // Check if any ignored requests are ready to go (to wake rendering up again)
4354
4577
  scene.primitives.updateForPass(
4355
4578
  scene._frameState,
4356
- requestRenderModeDeferCheckPassState
4579
+ requestRenderModeDeferCheckPassState,
4357
4580
  );
4358
4581
  }
4359
4582
 
@@ -4405,14 +4628,14 @@ Scene.prototype.drillPickFromRay = function (
4405
4628
  ray,
4406
4629
  limit,
4407
4630
  objectsToExclude,
4408
- width
4631
+ width,
4409
4632
  ) {
4410
4633
  return this._picking.drillPickFromRay(
4411
4634
  this,
4412
4635
  ray,
4413
4636
  limit,
4414
4637
  objectsToExclude,
4415
- width
4638
+ width,
4416
4639
  );
4417
4640
  };
4418
4641
 
@@ -4432,13 +4655,13 @@ Scene.prototype.drillPickFromRay = function (
4432
4655
  Scene.prototype.pickFromRayMostDetailed = function (
4433
4656
  ray,
4434
4657
  objectsToExclude,
4435
- width
4658
+ width,
4436
4659
  ) {
4437
4660
  return this._picking.pickFromRayMostDetailed(
4438
4661
  this,
4439
4662
  ray,
4440
4663
  objectsToExclude,
4441
- width
4664
+ width,
4442
4665
  );
4443
4666
  };
4444
4667
 
@@ -4460,14 +4683,14 @@ Scene.prototype.drillPickFromRayMostDetailed = function (
4460
4683
  ray,
4461
4684
  limit,
4462
4685
  objectsToExclude,
4463
- width
4686
+ width,
4464
4687
  ) {
4465
4688
  return this._picking.drillPickFromRayMostDetailed(
4466
4689
  this,
4467
4690
  ray,
4468
4691
  limit,
4469
4692
  objectsToExclude,
4470
- width
4693
+ width,
4471
4694
  );
4472
4695
  };
4473
4696
 
@@ -4532,14 +4755,14 @@ Scene.prototype.clampToHeight = function (
4532
4755
  cartesian,
4533
4756
  objectsToExclude,
4534
4757
  width,
4535
- result
4758
+ result,
4536
4759
  ) {
4537
4760
  return this._picking.clampToHeight(
4538
4761
  this,
4539
4762
  cartesian,
4540
4763
  objectsToExclude,
4541
4764
  width,
4542
- result
4765
+ result,
4543
4766
  );
4544
4767
  };
4545
4768
 
@@ -4574,13 +4797,13 @@ Scene.prototype.clampToHeight = function (
4574
4797
  Scene.prototype.sampleHeightMostDetailed = function (
4575
4798
  positions,
4576
4799
  objectsToExclude,
4577
- width
4800
+ width,
4578
4801
  ) {
4579
4802
  return this._picking.sampleHeightMostDetailed(
4580
4803
  this,
4581
4804
  positions,
4582
4805
  objectsToExclude,
4583
- width
4806
+ width,
4584
4807
  );
4585
4808
  };
4586
4809
 
@@ -4614,13 +4837,13 @@ Scene.prototype.sampleHeightMostDetailed = function (
4614
4837
  Scene.prototype.clampToHeightMostDetailed = function (
4615
4838
  cartesians,
4616
4839
  objectsToExclude,
4617
- width
4840
+ width,
4618
4841
  ) {
4619
4842
  return this._picking.clampToHeightMostDetailed(
4620
4843
  this,
4621
4844
  cartesians,
4622
4845
  objectsToExclude,
4623
- width
4846
+ width,
4624
4847
  );
4625
4848
  };
4626
4849
 
@@ -4694,15 +4917,14 @@ function setTerrain(scene, terrain) {
4694
4917
  }
4695
4918
  // Otherwise, set a placeholder
4696
4919
  scene.globe.terrainProvider = undefined;
4697
- scene._removeTerrainProviderReadyListener = terrain.readyEvent.addEventListener(
4698
- (provider) => {
4920
+ scene._removeTerrainProviderReadyListener =
4921
+ terrain.readyEvent.addEventListener((provider) => {
4699
4922
  if (defined(scene) && defined(scene.globe)) {
4700
4923
  scene.globe.terrainProvider = provider;
4701
4924
  }
4702
4925
 
4703
4926
  scene._removeTerrainProviderReadyListener();
4704
- }
4705
- );
4927
+ });
4706
4928
  }
4707
4929
 
4708
4930
  /**
@@ -4812,7 +5034,7 @@ Scene.prototype.destroy = function () {
4812
5034
  this._performanceDisplay =
4813
5035
  this._performanceDisplay && this._performanceDisplay.destroy();
4814
5036
  this._performanceContainer.parentNode.removeChild(
4815
- this._performanceContainer
5037
+ this._performanceContainer,
4816
5038
  );
4817
5039
  }
4818
5040