@cesium/engine 10.1.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 (845) hide show
  1. package/Build/Workers/{chunk-EB7PNZTK.js → chunk-26GA3JAM.js} +6 -5
  2. package/Build/Workers/{chunk-RZLZWKFN.js → chunk-27HUZ7SA.js} +4 -4
  3. package/Build/Workers/{chunk-A5CODJ4M.js → chunk-2ZGOQXYU.js} +6 -6
  4. package/Build/Workers/{chunk-TF776XCO.js → chunk-3Q2L65QU.js} +7 -7
  5. package/Build/Workers/{chunk-NVOABL76.js → chunk-472HQ3EH.js} +5 -5
  6. package/Build/Workers/{chunk-QX5XS4LC.js → chunk-5ODQSF26.js} +2 -2
  7. package/Build/Workers/{chunk-4YSNMHZ4.js → chunk-5OOFQLKF.js} +6 -6
  8. package/Build/Workers/{chunk-OXALEQPI.js → chunk-5PTXS2GO.js} +49 -23
  9. package/Build/Workers/{chunk-T77JILCU.js → chunk-6CHGCNMW.js} +2 -2
  10. package/Build/Workers/{chunk-FEVVHITK.js → chunk-76BYBWHP.js} +4 -4
  11. package/Build/Workers/{chunk-65MZOUNU.js → chunk-7BMOHCPM.js} +13 -13
  12. package/Build/Workers/{chunk-VE7BFUIX.js → chunk-7JO7GPJN.js} +1 -1
  13. package/Build/Workers/{chunk-5BLJ5ZM6.js → chunk-7KTQP4VB.js} +5 -5
  14. package/Build/Workers/{chunk-G5V4GPZE.js → chunk-7O373FFS.js} +8 -34
  15. package/Build/Workers/{chunk-S3PI2KFM.js → chunk-AD63PIY6.js} +2 -2
  16. package/Build/Workers/{chunk-6D66DPRV.js → chunk-BHQJ2NT7.js} +6 -6
  17. package/Build/Workers/{chunk-I2RC4XVN.js → chunk-C6YYBQXW.js} +4 -4
  18. package/Build/Workers/{chunk-X2ZQ7RJR.js → chunk-CKY7HOHV.js} +9 -9
  19. package/Build/Workers/{chunk-TO2PVHKI.js → chunk-DHYHSFFJ.js} +2 -2
  20. package/Build/Workers/{chunk-R6B7UCQB.js → chunk-DI5NGJUP.js} +2 -2
  21. package/Build/Workers/{chunk-X23FRWHJ.js → chunk-E27BLMDD.js} +7 -9
  22. package/Build/Workers/{chunk-N4QEHO3U.js → chunk-E63IIM5T.js} +1 -1
  23. package/Build/Workers/{chunk-BY3E4ONI.js → chunk-E6V6SQZW.js} +6 -6
  24. package/Build/Workers/{chunk-LSSWVB2X.js → chunk-EJZTDTUH.js} +4 -4
  25. package/Build/Workers/{chunk-XLTOBCDI.js → chunk-FDOV2LBJ.js} +7 -7
  26. package/Build/Workers/{chunk-ACRTCBN5.js → chunk-FIGIZHAQ.js} +11 -11
  27. package/Build/Workers/{chunk-4RMIRG6T.js → chunk-GESF4OXQ.js} +2 -2
  28. package/Build/Workers/{chunk-PNFHVBSF.js → chunk-GGZJN2TI.js} +16 -15
  29. package/Build/Workers/{chunk-KV4EQHK4.js → chunk-GNBFYG7F.js} +83 -79
  30. package/Build/Workers/{chunk-FOZWUH4T.js → chunk-GWCFU2SA.js} +7 -7
  31. package/Build/Workers/{chunk-Q55ECN3Y.js → chunk-I2ITFFPX.js} +1 -1
  32. package/Build/Workers/{chunk-XQI7XZHX.js → chunk-IBLIYJZR.js} +6 -6
  33. package/Build/Workers/{chunk-D2U4RI64.js → chunk-JW4FOI6M.js} +7 -7
  34. package/Build/Workers/{chunk-2J3JKXCP.js → chunk-K4GQUNB5.js} +9 -5
  35. package/Build/Workers/{chunk-POSRARY7.js → chunk-M3GMB5OP.js} +10 -10
  36. package/Build/Workers/{chunk-OOK53QUQ.js → chunk-MXIZJAPH.js} +1 -1
  37. package/Build/Workers/{chunk-OWGTMVDB.js → chunk-N5KJGGCM.js} +18 -20
  38. package/Build/Workers/{chunk-J7MQUQJY.js → chunk-NGPPMXRM.js} +12 -7
  39. package/Build/Workers/{chunk-OOMCT7OL.js → chunk-O3E4OAOE.js} +13 -13
  40. package/Build/Workers/{chunk-C3Z23UUJ.js → chunk-PGRPDNHG.js} +19 -23
  41. package/Build/Workers/{chunk-4VFBBNQ3.js → chunk-PRGYLLJT.js} +1 -1
  42. package/Build/Workers/{chunk-XZZNKIEV.js → chunk-S6MRMMQU.js} +6 -6
  43. package/Build/Workers/{chunk-76BYYG7N.js → chunk-SMDOP47J.js} +10 -10
  44. package/Build/Workers/{chunk-ZU334IDQ.js → chunk-TGONEMZO.js} +11 -11
  45. package/Build/Workers/{chunk-VRZ46QZ5.js → chunk-TKVT5GQM.js} +13 -13
  46. package/Build/Workers/{chunk-FDCLACT5.js → chunk-U72QNFOJ.js} +15 -25
  47. package/Build/Workers/{chunk-F3NDOSTZ.js → chunk-VJZB3WAV.js} +7 -7
  48. package/Build/Workers/{chunk-GPJR7MPQ.js → chunk-VU2MNO7L.js} +7 -7
  49. package/Build/Workers/{chunk-R4OIEIPE.js → chunk-XY4BATBS.js} +4 -4
  50. package/Build/Workers/{chunk-T6LPN7RI.js → chunk-YFXQECWV.js} +5 -5
  51. package/Build/Workers/{chunk-UCIPJSZX.js → chunk-YSGTGQQO.js} +14 -14
  52. package/Build/Workers/{chunk-BGE4QVG7.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 +26 -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 +28 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +19 -18
  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 +13 -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 +11 -18
  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 +7 -21
  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/CallbackProperty.js +8 -2
  284. package/Source/DataSources/Cesium3DTilesetGraphics.js +1 -1
  285. package/Source/DataSources/Cesium3DTilesetVisualizer.js +6 -6
  286. package/Source/DataSources/CheckerboardMaterialProperty.js +9 -3
  287. package/Source/DataSources/ColorMaterialProperty.js +8 -2
  288. package/Source/DataSources/CompositeEntityCollection.js +14 -15
  289. package/Source/DataSources/CompositeMaterialProperty.js +10 -11
  290. package/Source/DataSources/CompositePositionProperty.js +11 -6
  291. package/Source/DataSources/CompositeProperty.js +7 -7
  292. package/Source/DataSources/ConstantPositionProperty.js +9 -3
  293. package/Source/DataSources/CorridorGeometryUpdater.js +61 -56
  294. package/Source/DataSources/CorridorGraphics.js +6 -6
  295. package/Source/DataSources/CylinderGeometryUpdater.js +42 -40
  296. package/Source/DataSources/CylinderGraphics.js +4 -4
  297. package/Source/DataSources/CzmlDataSource.js +365 -368
  298. package/Source/DataSources/DataSourceCollection.js +1 -1
  299. package/Source/DataSources/DataSourceDisplay.js +23 -23
  300. package/Source/DataSources/DynamicGeometryBatch.js +2 -2
  301. package/Source/DataSources/DynamicGeometryUpdater.js +14 -18
  302. package/Source/DataSources/EllipseGeometryUpdater.js +67 -63
  303. package/Source/DataSources/EllipseGraphics.js +7 -7
  304. package/Source/DataSources/EllipsoidGeometryUpdater.js +88 -86
  305. package/Source/DataSources/EllipsoidGraphics.js +5 -5
  306. package/Source/DataSources/Entity.js +14 -14
  307. package/Source/DataSources/EntityCluster.js +29 -27
  308. package/Source/DataSources/EntityCollection.js +7 -7
  309. package/Source/DataSources/EntityView.js +23 -23
  310. package/Source/DataSources/GeoJsonDataSource.js +25 -25
  311. package/Source/DataSources/GeometryUpdater.js +9 -10
  312. package/Source/DataSources/GeometryUpdaterSet.js +3 -3
  313. package/Source/DataSources/GeometryVisualizer.js +65 -71
  314. package/Source/DataSources/GpxDataSource.js +10 -10
  315. package/Source/DataSources/GridMaterialProperty.js +12 -6
  316. package/Source/DataSources/GroundGeometryUpdater.js +6 -6
  317. package/Source/DataSources/ImageMaterialProperty.js +10 -3
  318. package/Source/DataSources/KmlDataSource.js +212 -212
  319. package/Source/DataSources/LabelGraphics.js +14 -14
  320. package/Source/DataSources/LabelVisualizer.js +24 -24
  321. package/Source/DataSources/MaterialProperty.js +7 -1
  322. package/Source/DataSources/ModelGraphics.js +37 -17
  323. package/Source/DataSources/ModelVisualizer.js +41 -32
  324. package/Source/DataSources/NodeTransformationProperty.js +10 -4
  325. package/Source/DataSources/PathGraphics.js +2 -2
  326. package/Source/DataSources/PathVisualizer.js +99 -35
  327. package/Source/DataSources/PlaneGeometryUpdater.js +38 -37
  328. package/Source/DataSources/PlaneGraphics.js +2 -2
  329. package/Source/DataSources/PointGraphics.js +8 -8
  330. package/Source/DataSources/PointVisualizer.js +29 -29
  331. package/Source/DataSources/PolygonGeometryUpdater.js +68 -64
  332. package/Source/DataSources/PolygonGraphics.js +9 -9
  333. package/Source/DataSources/PolylineArrowMaterialProperty.js +8 -2
  334. package/Source/DataSources/PolylineDashMaterialProperty.js +11 -5
  335. package/Source/DataSources/PolylineGeometryUpdater.js +39 -44
  336. package/Source/DataSources/PolylineGlowMaterialProperty.js +10 -4
  337. package/Source/DataSources/PolylineGraphics.js +4 -4
  338. package/Source/DataSources/PolylineOutlineMaterialProperty.js +10 -4
  339. package/Source/DataSources/PolylineVisualizer.js +39 -43
  340. package/Source/DataSources/PolylineVolumeGeometryUpdater.js +70 -68
  341. package/Source/DataSources/PolylineVolumeGraphics.js +2 -2
  342. package/Source/DataSources/PositionProperty.js +5 -4
  343. package/Source/DataSources/PositionPropertyArray.js +10 -4
  344. package/Source/DataSources/Property.js +2 -2
  345. package/Source/DataSources/PropertyArray.js +6 -6
  346. package/Source/DataSources/PropertyBag.js +10 -9
  347. package/Source/DataSources/RectangleGeometryUpdater.js +68 -63
  348. package/Source/DataSources/RectangleGraphics.js +6 -6
  349. package/Source/DataSources/ReferenceProperty.js +13 -7
  350. package/Source/DataSources/Rotation.js +2 -2
  351. package/Source/DataSources/SampledPositionProperty.js +13 -7
  352. package/Source/DataSources/SampledProperty.js +22 -20
  353. package/Source/DataSources/ScaledPositionProperty.js +8 -2
  354. package/Source/DataSources/StaticGeometryColorBatch.js +41 -41
  355. package/Source/DataSources/StaticGeometryPerMaterialBatch.js +40 -40
  356. package/Source/DataSources/StaticGroundGeometryColorBatch.js +26 -27
  357. package/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js +46 -44
  358. package/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js +44 -43
  359. package/Source/DataSources/StaticOutlineGeometryBatch.js +28 -29
  360. package/Source/DataSources/StripeMaterialProperty.js +9 -3
  361. package/Source/DataSources/TerrainOffsetProperty.js +20 -11
  362. package/Source/DataSources/TimeIntervalCollectionPositionProperty.js +35 -31
  363. package/Source/DataSources/TimeIntervalCollectionProperty.js +6 -6
  364. package/Source/DataSources/VelocityOrientationProperty.js +9 -4
  365. package/Source/DataSources/VelocityVectorProperty.js +7 -9
  366. package/Source/DataSources/WallGeometryUpdater.js +25 -25
  367. package/Source/DataSources/WallGraphics.js +4 -4
  368. package/Source/DataSources/createPropertyDescriptor.js +3 -3
  369. package/Source/DataSources/exportKml.js +90 -86
  370. package/Source/DataSources/getElement.js +1 -1
  371. package/Source/DataSources/heightReferenceOnEntityPropertyChanged.js +4 -4
  372. package/Source/Renderer/AutomaticUniforms.js +3 -18
  373. package/Source/Renderer/Buffer.js +18 -18
  374. package/Source/Renderer/ClearCommand.js +1 -1
  375. package/Source/Renderer/ComputeEngine.js +1 -1
  376. package/Source/Renderer/Context.js +55 -40
  377. package/Source/Renderer/CubeMap.js +332 -354
  378. package/Source/Renderer/CubeMapFace.js +43 -65
  379. package/Source/Renderer/DrawCommand.js +50 -5
  380. package/Source/Renderer/Framebuffer.js +48 -49
  381. package/Source/Renderer/FramebufferManager.js +40 -34
  382. package/Source/Renderer/MultisampleFramebuffer.js +35 -14
  383. package/Source/Renderer/PixelDatatype.js +23 -0
  384. package/Source/Renderer/RenderState.js +36 -36
  385. package/Source/Renderer/Renderbuffer.js +3 -3
  386. package/Source/Renderer/Sampler.js +9 -15
  387. package/Source/Renderer/ShaderBuilder.js +8 -8
  388. package/Source/Renderer/ShaderCache.js +11 -15
  389. package/Source/Renderer/ShaderFunction.js +1 -1
  390. package/Source/Renderer/ShaderProgram.js +22 -15
  391. package/Source/Renderer/ShaderSource.js +40 -40
  392. package/Source/Renderer/Texture.js +455 -380
  393. package/Source/Renderer/UniformState.js +68 -80
  394. package/Source/Renderer/VertexArray.js +20 -20
  395. package/Source/Renderer/VertexArrayFacade.js +15 -16
  396. package/Source/Renderer/createUniform.js +1 -1
  397. package/Source/Renderer/createUniformArray.js +4 -4
  398. package/Source/Renderer/demodernizeShader.js +7 -5
  399. package/Source/Renderer/loadCubeMap.js +3 -8
  400. package/Source/Scene/ArcGisMapServerImageryProvider.js +39 -45
  401. package/Source/Scene/ArcGisMapService.js +4 -7
  402. package/Source/Scene/AutoExposure.js +4 -5
  403. package/Source/Scene/Axis.js +6 -6
  404. package/Source/Scene/B3dmParser.js +9 -9
  405. package/Source/Scene/BatchTable.js +7 -7
  406. package/Source/Scene/BatchTableHierarchy.js +62 -59
  407. package/Source/Scene/BatchTexture.js +2 -2
  408. package/Source/Scene/Billboard.js +45 -43
  409. package/Source/Scene/BillboardCollection.js +81 -83
  410. package/Source/Scene/BingMapsImageryProvider.js +13 -13
  411. package/Source/Scene/BoundingVolumeSemantics.js +10 -10
  412. package/Source/Scene/BoxEmitter.js +1 -1
  413. package/Source/Scene/BufferLoader.js +1 -1
  414. package/Source/Scene/Camera.js +161 -164
  415. package/Source/Scene/CameraEventAggregator.js +67 -23
  416. package/Source/Scene/CameraFlightPath.js +25 -25
  417. package/Source/Scene/Cesium3DTile.js +89 -95
  418. package/Source/Scene/Cesium3DTileBatchTable.js +61 -61
  419. package/Source/Scene/Cesium3DTileContentFactory.js +7 -7
  420. package/Source/Scene/Cesium3DTileFeature.js +1 -1
  421. package/Source/Scene/Cesium3DTileFeatureTable.js +8 -8
  422. package/Source/Scene/Cesium3DTileOptimizations.js +1 -1
  423. package/Source/Scene/Cesium3DTilePointFeature.js +11 -11
  424. package/Source/Scene/Cesium3DTileStyle.js +26 -24
  425. package/Source/Scene/Cesium3DTilesVoxelProvider.js +14 -20
  426. package/Source/Scene/Cesium3DTileset.js +81 -83
  427. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +8 -16
  428. package/Source/Scene/Cesium3DTilesetCache.js +2 -2
  429. package/Source/Scene/Cesium3DTilesetHeatmap.js +5 -5
  430. package/Source/Scene/Cesium3DTilesetMetadata.js +2 -2
  431. package/Source/Scene/Cesium3DTilesetMostDetailedTraversal.js +2 -2
  432. package/Source/Scene/Cesium3DTilesetSkipTraversal.js +8 -12
  433. package/Source/Scene/Cesium3DTilesetStatistics.js +1 -1
  434. package/Source/Scene/Cesium3DTilesetTraversal.js +8 -10
  435. package/Source/Scene/ClassificationPrimitive.js +70 -69
  436. package/Source/Scene/ClippingPlaneCollection.js +39 -41
  437. package/Source/Scene/ClippingPolygon.js +8 -8
  438. package/Source/Scene/ClippingPolygonCollection.js +62 -63
  439. package/Source/Scene/CloudCollection.js +3 -10
  440. package/Source/Scene/Composite3DTileContent.js +6 -6
  441. package/Source/Scene/ConditionsExpression.js +5 -5
  442. package/Source/Scene/ContentMetadata.js +4 -4
  443. package/Source/Scene/CreditDisplay.js +8 -8
  444. package/Source/Scene/CumulusCloud.js +4 -4
  445. package/Source/Scene/DebugAppearance.js +2 -2
  446. package/Source/Scene/DebugCameraPrimitive.js +2 -2
  447. package/Source/Scene/DebugInspector.js +3 -3
  448. package/Source/Scene/DebugModelMatrixPrimitive.js +4 -4
  449. package/Source/Scene/DepthPlane.js +7 -7
  450. package/Source/Scene/DerivedCommand.js +422 -238
  451. package/Source/Scene/DiscardMissingTileImagePolicy.js +1 -1
  452. package/Source/Scene/DracoLoader.js +3 -3
  453. package/Source/Scene/EllipsoidPrimitive.js +7 -7
  454. package/Source/Scene/EllipsoidSurfaceAppearance.js +3 -3
  455. package/Source/Scene/Empty3DTileContent.js +1 -1
  456. package/Source/Scene/Expression.js +91 -91
  457. package/Source/Scene/Fog.js +8 -41
  458. package/Source/Scene/FrameRateMonitor.js +22 -22
  459. package/Source/Scene/FrameState.js +31 -0
  460. package/Source/Scene/Geometry3DTileContent.js +20 -20
  461. package/Source/Scene/GetFeatureInfoFormat.js +15 -14
  462. package/Source/Scene/Globe.js +33 -28
  463. package/Source/Scene/GlobeDepth.js +95 -66
  464. package/Source/Scene/GlobeSurfaceShaderSet.js +41 -34
  465. package/Source/Scene/GlobeSurfaceTile.js +33 -33
  466. package/Source/Scene/GlobeSurfaceTileProvider.js +132 -127
  467. package/Source/Scene/GlobeTranslucency.js +4 -4
  468. package/Source/Scene/GlobeTranslucencyFramebuffer.js +9 -9
  469. package/Source/Scene/GlobeTranslucencyState.js +53 -55
  470. package/Source/Scene/GltfBufferViewLoader.js +2 -2
  471. package/Source/Scene/GltfIndexBufferLoader.js +5 -5
  472. package/Source/Scene/GltfJsonLoader.js +2 -2
  473. package/Source/Scene/GltfLoader.js +177 -100
  474. package/Source/Scene/GltfStructuralMetadataLoader.js +9 -8
  475. package/Source/Scene/GltfTextureLoader.js +5 -5
  476. package/Source/Scene/GltfVertexBufferLoader.js +12 -13
  477. package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +9 -9
  478. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +9 -9
  479. package/Source/Scene/GridImageryProvider.js +2 -2
  480. package/Source/Scene/GroundPolylinePrimitive.js +38 -39
  481. package/Source/Scene/GroundPrimitive.js +47 -45
  482. package/Source/Scene/GroupMetadata.js +4 -4
  483. package/Source/Scene/I3SDataProvider.js +12 -12
  484. package/Source/Scene/I3SDecoder.js +7 -8
  485. package/Source/Scene/I3SField.js +8 -8
  486. package/Source/Scene/I3SGeometry.js +14 -14
  487. package/Source/Scene/I3SLayer.js +26 -20
  488. package/Source/Scene/I3SNode.js +17 -17
  489. package/Source/Scene/I3SSublayer.js +4 -4
  490. package/Source/Scene/I3SSymbology.js +8 -8
  491. package/Source/Scene/I3dmParser.js +9 -9
  492. package/Source/Scene/ImageBasedLighting.js +58 -56
  493. package/Source/Scene/Imagery.js +3 -3
  494. package/Source/Scene/ImageryLayer.js +64 -66
  495. package/Source/Scene/ImageryLayerCollection.js +13 -15
  496. package/Source/Scene/ImageryLayerFeatureInfo.js +19 -20
  497. package/Source/Scene/ImageryProvider.js +1 -1
  498. package/Source/Scene/Implicit3DTileContent.js +34 -37
  499. package/Source/Scene/ImplicitAvailabilityBitstream.js +2 -2
  500. package/Source/Scene/ImplicitMetadataView.js +2 -2
  501. package/Source/Scene/ImplicitSubtree.js +29 -30
  502. package/Source/Scene/ImplicitSubtreeCache.js +1 -1
  503. package/Source/Scene/ImplicitSubtreeMetadata.js +5 -5
  504. package/Source/Scene/ImplicitTileCoordinates.js +11 -11
  505. package/Source/Scene/ImplicitTileset.js +2 -2
  506. package/Source/Scene/InvertClassification.js +7 -7
  507. package/Source/Scene/IonImageryProvider.js +6 -6
  508. package/Source/Scene/JobScheduler.js +4 -4
  509. package/Source/Scene/Label.js +31 -31
  510. package/Source/Scene/LabelCollection.js +17 -15
  511. package/Source/Scene/MapboxImageryProvider.js +3 -3
  512. package/Source/Scene/MapboxStyleImageryProvider.js +4 -4
  513. package/Source/Scene/Material.js +50 -29
  514. package/Source/Scene/MaterialAppearance.js +4 -4
  515. package/Source/Scene/Megatexture.js +21 -24
  516. package/Source/Scene/MetadataClassProperty.js +11 -11
  517. package/Source/Scene/MetadataComponentType.js +1 -1
  518. package/Source/Scene/MetadataEntity.js +8 -8
  519. package/Source/Scene/MetadataEnum.js +1 -1
  520. package/Source/Scene/MetadataPicking.js +305 -0
  521. package/Source/Scene/MetadataSchemaLoader.js +1 -1
  522. package/Source/Scene/MetadataTable.js +2 -2
  523. package/Source/Scene/MetadataTableProperty.js +22 -22
  524. package/Source/Scene/Model/AlphaPipelineStage.js +2 -2
  525. package/Source/Scene/Model/AtmospherePipelineStage.js +3 -3
  526. package/Source/Scene/Model/B3dmLoader.js +8 -8
  527. package/Source/Scene/Model/BatchTexturePipelineStage.js +2 -2
  528. package/Source/Scene/Model/CPUStylingPipelineStage.js +4 -4
  529. package/Source/Scene/Model/ClassificationModelDrawCommand.js +8 -8
  530. package/Source/Scene/Model/ClassificationPipelineStage.js +5 -5
  531. package/Source/Scene/Model/CustomShader.js +9 -9
  532. package/Source/Scene/Model/CustomShaderPipelineStage.js +37 -38
  533. package/Source/Scene/Model/DequantizationPipelineStage.js +5 -5
  534. package/Source/Scene/Model/Extensions/Gpm/AnchorPointDirect.js +61 -0
  535. package/Source/Scene/Model/Extensions/Gpm/AnchorPointIndirect.js +77 -0
  536. package/Source/Scene/Model/Extensions/Gpm/CorrelationGroup.js +81 -0
  537. package/Source/Scene/Model/Extensions/Gpm/GltfGpmLoader.js +248 -0
  538. package/Source/Scene/Model/Extensions/Gpm/GltfGpmLocal.js +179 -0
  539. package/Source/Scene/Model/Extensions/Gpm/GltfMeshPrimitiveGpmLoader.js +548 -0
  540. package/Source/Scene/Model/Extensions/Gpm/MeshPrimitiveGpmLocal.js +28 -0
  541. package/Source/Scene/Model/Extensions/Gpm/PpeMetadata.js +79 -0
  542. package/Source/Scene/Model/Extensions/Gpm/PpeSource.js +75 -0
  543. package/Source/Scene/Model/Extensions/Gpm/PpeTexture.js +127 -0
  544. package/Source/Scene/Model/Extensions/Gpm/Spdcf.js +103 -0
  545. package/Source/Scene/Model/Extensions/Gpm/StorageType.js +30 -0
  546. package/Source/Scene/Model/FeatureIdPipelineStage.js +40 -40
  547. package/Source/Scene/Model/GeoJsonLoader.js +17 -17
  548. package/Source/Scene/Model/GeometryPipelineStage.js +23 -24
  549. package/Source/Scene/Model/I3dmLoader.js +36 -36
  550. package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +22 -30
  551. package/Source/Scene/Model/InstancingPipelineStage.js +86 -86
  552. package/Source/Scene/Model/LightingPipelineStage.js +4 -4
  553. package/Source/Scene/Model/MaterialPipelineStage.js +78 -93
  554. package/Source/Scene/Model/MetadataPickingPipelineStage.js +96 -0
  555. package/Source/Scene/Model/MetadataPipelineStage.js +39 -47
  556. package/Source/Scene/Model/Model.js +134 -54
  557. package/Source/Scene/Model/Model3DTileContent.js +32 -13
  558. package/Source/Scene/Model/ModelAnimationChannel.js +2 -2
  559. package/Source/Scene/Model/ModelAnimationCollection.js +9 -9
  560. package/Source/Scene/Model/ModelArticulation.js +2 -2
  561. package/Source/Scene/Model/ModelArticulationStage.js +4 -4
  562. package/Source/Scene/Model/ModelClippingPlanesPipelineStage.js +11 -11
  563. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +6 -6
  564. package/Source/Scene/Model/ModelColorPipelineStage.js +12 -13
  565. package/Source/Scene/Model/ModelDrawCommand.js +5 -5
  566. package/Source/Scene/Model/{buildDrawCommand.js → ModelDrawCommands.js} +85 -28
  567. package/Source/Scene/Model/ModelFeatureTable.js +5 -5
  568. package/Source/Scene/Model/ModelMatrixUpdateStage.js +24 -12
  569. package/Source/Scene/Model/ModelRenderResources.js +1 -1
  570. package/Source/Scene/Model/ModelRuntimeNode.js +15 -15
  571. package/Source/Scene/Model/ModelRuntimePrimitive.js +8 -5
  572. package/Source/Scene/Model/ModelSceneGraph.js +42 -43
  573. package/Source/Scene/Model/ModelSilhouettePipelineStage.js +4 -4
  574. package/Source/Scene/Model/ModelSkin.js +4 -4
  575. package/Source/Scene/Model/ModelSplitterPipelineStage.js +8 -9
  576. package/Source/Scene/Model/ModelUtility.js +5 -5
  577. package/Source/Scene/Model/MorphTargetsPipelineStage.js +18 -18
  578. package/Source/Scene/Model/NodeRenderResources.js +1 -1
  579. package/Source/Scene/Model/NodeStatisticsPipelineStage.js +1 -1
  580. package/Source/Scene/Model/PickingPipelineStage.js +5 -5
  581. package/Source/Scene/Model/PntsLoader.js +7 -7
  582. package/Source/Scene/Model/PointCloudStylingPipelineStage.js +22 -23
  583. package/Source/Scene/Model/PrimitiveOutlineGenerator.js +6 -6
  584. package/Source/Scene/Model/PrimitiveOutlinePipelineStage.js +7 -7
  585. package/Source/Scene/Model/PrimitiveRenderResources.js +3 -3
  586. package/Source/Scene/Model/PrimitiveStatisticsPipelineStage.js +1 -1
  587. package/Source/Scene/Model/SceneMode2DPipelineStage.js +23 -23
  588. package/Source/Scene/Model/SelectedFeatureIdPipelineStage.js +10 -14
  589. package/Source/Scene/Model/SkinningPipelineStage.js +5 -5
  590. package/Source/Scene/Model/StyleCommandsNeeded.js +1 -1
  591. package/Source/Scene/Model/TextureManager.js +2 -2
  592. package/Source/Scene/Model/TextureUniform.js +3 -3
  593. package/Source/Scene/Model/TilesetPipelineStage.js +2 -2
  594. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -4
  595. package/Source/Scene/Model/WireframePipelineStage.js +7 -7
  596. package/Source/Scene/Model/pickModel.js +26 -26
  597. package/Source/Scene/ModelComponents.js +13 -4
  598. package/Source/Scene/Moon.js +6 -5
  599. package/Source/Scene/Multiple3DTileContent.js +15 -14
  600. package/Source/Scene/OIT.js +48 -97
  601. package/Source/Scene/OpenStreetMapImageryProvider.js +8 -7
  602. package/Source/Scene/OrderedGroundPrimitiveCollection.js +2 -2
  603. package/Source/Scene/Particle.js +3 -3
  604. package/Source/Scene/ParticleEmitter.js +1 -1
  605. package/Source/Scene/ParticleSystem.js +32 -32
  606. package/Source/Scene/PerInstanceColorAppearance.js +1 -1
  607. package/Source/Scene/PickDepth.js +16 -4
  608. package/Source/Scene/PickDepthFramebuffer.js +1 -1
  609. package/Source/Scene/PickFramebuffer.js +24 -12
  610. package/Source/Scene/PickedMetadataInfo.js +39 -0
  611. package/Source/Scene/Picking.js +270 -120
  612. package/Source/Scene/PntsParser.js +28 -28
  613. package/Source/Scene/PointCloud.js +39 -38
  614. package/Source/Scene/PointCloudEyeDomeLighting.js +6 -6
  615. package/Source/Scene/PointCloudShading.js +3 -3
  616. package/Source/Scene/PointPrimitive.js +31 -28
  617. package/Source/Scene/PointPrimitiveCollection.js +34 -33
  618. package/Source/Scene/Polyline.js +9 -9
  619. package/Source/Scene/PolylineCollection.js +55 -57
  620. package/Source/Scene/PolylineColorAppearance.js +3 -3
  621. package/Source/Scene/PolylineMaterialAppearance.js +3 -3
  622. package/Source/Scene/PostProcessStage.js +95 -115
  623. package/Source/Scene/PostProcessStageCollection.js +73 -49
  624. package/Source/Scene/PostProcessStageComposite.js +2 -2
  625. package/Source/Scene/PostProcessStageLibrary.js +30 -4
  626. package/Source/Scene/PostProcessStageTextureCache.js +10 -10
  627. package/Source/Scene/Primitive.js +93 -93
  628. package/Source/Scene/PrimitiveCollection.js +1 -1
  629. package/Source/Scene/PrimitiveLoadPlan.js +1 -1
  630. package/Source/Scene/PrimitivePipeline.js +30 -30
  631. package/Source/Scene/PropertyTable.js +5 -5
  632. package/Source/Scene/PropertyTextureProperty.js +36 -7
  633. package/Source/Scene/QuadtreePrimitive.js +56 -58
  634. package/Source/Scene/QuadtreeTile.js +4 -4
  635. package/Source/Scene/QuadtreeTileProvider.js +1 -1
  636. package/Source/Scene/ResourceCache.js +7 -7
  637. package/Source/Scene/ResourceCacheKey.js +15 -15
  638. package/Source/Scene/Scene.js +897 -677
  639. package/Source/Scene/SceneFramebuffer.js +2 -2
  640. package/Source/Scene/SceneTransforms.js +30 -92
  641. package/Source/Scene/SceneTransitioner.js +47 -47
  642. package/Source/Scene/ScreenSpaceCameraController.js +171 -157
  643. package/Source/Scene/SensorVolumePortionToDisplay.js +1 -1
  644. package/Source/Scene/ShadowMap.js +71 -72
  645. package/Source/Scene/ShadowMapShader.js +9 -9
  646. package/Source/Scene/ShadowVolumeAppearance.js +39 -39
  647. package/Source/Scene/SingleTileImageryProvider.js +3 -3
  648. package/Source/Scene/SkyAtmosphere.js +8 -8
  649. package/Source/Scene/SkyBox.js +17 -24
  650. package/Source/Scene/SpatialNode.js +13 -13
  651. package/Source/Scene/SpecularEnvironmentCubeMap.js +240 -0
  652. package/Source/Scene/SphereEmitter.js +1 -1
  653. package/Source/Scene/StructuralMetadata.js +1 -1
  654. package/Source/Scene/StyleExpression.js +1 -1
  655. package/Source/Scene/Sun.js +11 -7
  656. package/Source/Scene/SunPostProcess.js +6 -6
  657. package/Source/Scene/TerrainFillMesh.js +157 -156
  658. package/Source/Scene/TextureAtlas.js +11 -11
  659. package/Source/Scene/TileBoundingRegion.js +31 -31
  660. package/Source/Scene/TileBoundingS2Cell.js +37 -40
  661. package/Source/Scene/TileBoundingSphere.js +2 -2
  662. package/Source/Scene/TileCoordinatesImageryProvider.js +3 -3
  663. package/Source/Scene/TileImagery.js +7 -11
  664. package/Source/Scene/TileMapServiceImageryProvider.js +26 -25
  665. package/Source/Scene/TileMetadata.js +4 -4
  666. package/Source/Scene/TileOrientedBoundingBox.js +6 -6
  667. package/Source/Scene/Tileset3DTileContent.js +1 -1
  668. package/Source/Scene/TilesetMetadata.js +4 -4
  669. package/Source/Scene/TimeDynamicImagery.js +3 -3
  670. package/Source/Scene/TimeDynamicPointCloud.js +9 -9
  671. package/Source/Scene/Tonemapper.js +35 -23
  672. package/Source/Scene/TranslucentTileClassification.js +48 -58
  673. package/Source/Scene/TweenCollection.js +9 -9
  674. package/Source/Scene/UrlTemplateImageryProvider.js +23 -23
  675. package/Source/Scene/Vector3DTileClampedPolylines.js +21 -21
  676. package/Source/Scene/Vector3DTileContent.js +38 -39
  677. package/Source/Scene/Vector3DTileGeometry.js +11 -8
  678. package/Source/Scene/Vector3DTilePoints.js +18 -22
  679. package/Source/Scene/Vector3DTilePolygons.js +6 -6
  680. package/Source/Scene/Vector3DTilePolylines.js +8 -8
  681. package/Source/Scene/Vector3DTilePrimitive.js +30 -31
  682. package/Source/Scene/View.js +111 -80
  683. package/Source/Scene/VoxelBoxShape.js +34 -34
  684. package/Source/Scene/VoxelCell.js +7 -7
  685. package/Source/Scene/VoxelContent.js +1 -1
  686. package/Source/Scene/VoxelCylinderShape.js +48 -48
  687. package/Source/Scene/VoxelEllipsoidShape.js +83 -97
  688. package/Source/Scene/VoxelPrimitive.js +80 -109
  689. package/Source/Scene/VoxelRenderResources.js +13 -16
  690. package/Source/Scene/VoxelTraversal.js +41 -41
  691. package/Source/Scene/WebMapServiceImageryProvider.js +12 -12
  692. package/Source/Scene/WebMapTileServiceImageryProvider.js +8 -8
  693. package/Source/Scene/buildVoxelDrawCommands.js +10 -14
  694. package/Source/Scene/computeFlyToLocationForRectangle.js +7 -5
  695. package/Source/Scene/createBillboardPointCallback.js +2 -2
  696. package/Source/Scene/createElevationBandMaterial.js +8 -8
  697. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -1
  698. package/Source/Scene/createOsmBuildingsAsync.js +1 -1
  699. package/Source/Scene/createTangentSpaceDebugPrimitive.js +7 -7
  700. package/Source/Scene/findContentMetadata.js +2 -2
  701. package/Source/Scene/findTileMetadata.js +2 -2
  702. package/Source/Scene/getBinaryAccessor.js +1 -1
  703. package/Source/Scene/getClipAndStyleCode.js +1 -1
  704. package/Source/Scene/getClippingFunction.js +1 -1
  705. package/Source/Scene/getMetadataClassProperty.js +43 -0
  706. package/Source/Scene/parseBatchTable.js +21 -24
  707. package/Source/Scene/parseFeatureMetadataLegacy.js +3 -3
  708. package/Source/Scene/parseStructuralMetadata.js +3 -3
  709. package/Source/Scene/processVoxelProperties.js +28 -33
  710. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -2
  711. package/Source/Shaders/Builtin/Functions/packDepth.glsl +2 -2
  712. package/Source/Shaders/Builtin/Functions/packDepth.js +2 -2
  713. package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +2 -2
  714. package/Source/Shaders/Builtin/Functions/pbrLighting.js +2 -2
  715. package/Source/Shaders/Builtin/Functions/pbrNeutralTonemapping.glsl +23 -0
  716. package/Source/Shaders/Builtin/Functions/pbrNeutralTonemapping.js +25 -0
  717. package/Source/Shaders/Builtin/Functions/textureCube.glsl +21 -2
  718. package/Source/Shaders/Builtin/Functions/textureCube.js +21 -2
  719. package/Source/Shaders/Builtin/Functions/unpackDepth.glsl +3 -3
  720. package/Source/Shaders/Builtin/Functions/unpackDepth.js +3 -3
  721. package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +1 -1
  722. package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +1 -1
  723. package/Source/Shaders/Builtin/Functions/writeLogDepth.glsl +2 -2
  724. package/Source/Shaders/Builtin/Functions/writeLogDepth.js +2 -2
  725. package/Source/Shaders/Builtin/Structs/materialInput.glsl +2 -0
  726. package/Source/Shaders/Builtin/Structs/materialInput.js +2 -0
  727. package/Source/Shaders/DepthPlaneVS.glsl +1 -1
  728. package/Source/Shaders/DepthPlaneVS.js +1 -1
  729. package/Source/Shaders/GlobeFS.glsl +10 -4
  730. package/Source/Shaders/GlobeFS.js +10 -4
  731. package/Source/Shaders/Materials/WaterMaskMaterial.glsl +15 -0
  732. package/Source/Shaders/Materials/WaterMaskMaterial.js +17 -0
  733. package/Source/Shaders/Model/AtmosphereStageFS.glsl +1 -1
  734. package/Source/Shaders/Model/AtmosphereStageFS.js +1 -1
  735. package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +40 -29
  736. package/Source/Shaders/Model/ImageBasedLightingStageFS.js +40 -29
  737. package/Source/Shaders/Model/LightingStageFS.glsl +2 -2
  738. package/Source/Shaders/Model/LightingStageFS.js +2 -2
  739. package/Source/Shaders/Model/ModelFS.glsl +26 -0
  740. package/Source/Shaders/Model/ModelFS.js +26 -0
  741. package/Source/Shaders/PostProcessStages/AcesTonemappingStage.glsl +4 -0
  742. package/Source/Shaders/PostProcessStages/AcesTonemappingStage.js +4 -0
  743. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +59 -59
  744. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +60 -60
  745. package/Source/Shaders/PostProcessStages/FilmicTonemapping.glsl +4 -0
  746. package/Source/Shaders/PostProcessStages/FilmicTonemapping.js +4 -0
  747. package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.glsl +4 -0
  748. package/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.js +4 -0
  749. package/Source/Shaders/PostProcessStages/PbrNeutralTonemapping.glsl +25 -0
  750. package/Source/Shaders/PostProcessStages/PbrNeutralTonemapping.js +27 -0
  751. package/Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl +4 -0
  752. package/Source/Shaders/PostProcessStages/ReinhardTonemapping.js +4 -0
  753. package/Source/Shaders/SkyAtmosphereFS.glsl +1 -1
  754. package/Source/Shaders/SkyAtmosphereFS.js +1 -1
  755. package/Source/Widget/CesiumWidget.js +10 -9
  756. package/Source/Workers/combineGeometry.js +3 -4
  757. package/Source/Workers/createCircleGeometry.js +2 -2
  758. package/Source/Workers/createCircleOutlineGeometry.js +2 -2
  759. package/Source/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
  760. package/Source/Workers/createCorridorOutlineGeometry.js +2 -2
  761. package/Source/Workers/createEllipsoidOutlineGeometry.js +1 -1
  762. package/Source/Workers/createGeometry.js +4 -5
  763. package/Source/Workers/createGroundPolylineGeometry.js +1 -1
  764. package/Source/Workers/createPolylineVolumeGeometry.js +2 -2
  765. package/Source/Workers/createPolylineVolumeOutlineGeometry.js +4 -4
  766. package/Source/Workers/createRectangleOutlineGeometry.js +1 -1
  767. package/Source/Workers/createSimplePolylineGeometry.js +2 -2
  768. package/Source/Workers/createTaskProcessorWorker.js +1 -1
  769. package/Source/Workers/createVectorTileClampedPolylines.js +30 -30
  770. package/Source/Workers/createVectorTileGeometries.js +18 -18
  771. package/Source/Workers/createVectorTilePoints.js +3 -3
  772. package/Source/Workers/createVectorTilePolygons.js +11 -11
  773. package/Source/Workers/createVectorTilePolylines.js +7 -7
  774. package/Source/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +29 -30
  775. package/Source/Workers/createVerticesFromQuantizedTerrainMesh.js +60 -60
  776. package/Source/Workers/decodeDraco.js +23 -23
  777. package/Source/Workers/decodeGoogleEarthEnterprisePacket.js +3 -3
  778. package/Source/Workers/decodeI3S.js +53 -53
  779. package/Source/Workers/transcodeKTX2.js +9 -9
  780. package/Source/Workers/transferTypedArrayTest.js +1 -1
  781. package/Source/Workers/upsampleQuantizedTerrainMesh.js +37 -36
  782. package/index.d.ts +620 -136
  783. package/index.js +221 -205
  784. package/package.json +3 -3
  785. package/Build/Workers/chunk-2GEAGYUY.js +0 -1477
  786. package/Build/Workers/chunk-3WUV74WM.js +0 -1800
  787. package/Build/Workers/chunk-4MSUJ4I7.js +0 -456
  788. package/Build/Workers/chunk-5KWHSZYL.js +0 -834
  789. package/Build/Workers/chunk-5O6JWQ4E.js +0 -398
  790. package/Build/Workers/chunk-6OFDHMHR.js +0 -1258
  791. package/Build/Workers/chunk-AA4GZKOT.js +0 -75
  792. package/Build/Workers/chunk-B75IEX2S.js +0 -390
  793. package/Build/Workers/chunk-BAVI3ZS2.js +0 -39
  794. package/Build/Workers/chunk-BBDZYSZB.js +0 -287
  795. package/Build/Workers/chunk-C45MU4GZ.js +0 -220
  796. package/Build/Workers/chunk-CF7P7K7E.js +0 -684
  797. package/Build/Workers/chunk-D4K27X2M.js +0 -305
  798. package/Build/Workers/chunk-DKVHRNFY.js +0 -100
  799. package/Build/Workers/chunk-ELI4BUOT.js +0 -963
  800. package/Build/Workers/chunk-FQPSOOPH.js +0 -258
  801. package/Build/Workers/chunk-GNHZH7HP.js +0 -37
  802. package/Build/Workers/chunk-GWT64LKY.js +0 -171
  803. package/Build/Workers/chunk-HGEEOMSC.js +0 -157
  804. package/Build/Workers/chunk-IUROUBPA.js +0 -300
  805. package/Build/Workers/chunk-JNLWLSTP.js +0 -476
  806. package/Build/Workers/chunk-JYQNWIQQ.js +0 -44
  807. package/Build/Workers/chunk-KUN2ZA5X.js +0 -138
  808. package/Build/Workers/chunk-LXQ5QAEJ.js +0 -196
  809. package/Build/Workers/chunk-MBZH7YZ7.js +0 -945
  810. package/Build/Workers/chunk-MKXWJTFQ.js +0 -781
  811. package/Build/Workers/chunk-MMV6TO3P.js +0 -101
  812. package/Build/Workers/chunk-MSKXMXJI.js +0 -500
  813. package/Build/Workers/chunk-OAPA2RTG.js +0 -239
  814. package/Build/Workers/chunk-OE4MCOC7.js +0 -421
  815. package/Build/Workers/chunk-OJF4RTJG.js +0 -634
  816. package/Build/Workers/chunk-OXSI7N4C.js +0 -768
  817. package/Build/Workers/chunk-PYHLO636.js +0 -2857
  818. package/Build/Workers/chunk-QD4KM3GO.js +0 -138
  819. package/Build/Workers/chunk-QMLTCCYG.js +0 -55
  820. package/Build/Workers/chunk-QYQIVZBU.js +0 -117
  821. package/Build/Workers/chunk-R3TKLC6E.js +0 -1075
  822. package/Build/Workers/chunk-R4ZEWO4I.js +0 -122
  823. package/Build/Workers/chunk-RCK55EDX.js +0 -691
  824. package/Build/Workers/chunk-RHBWXX7C.js +0 -629
  825. package/Build/Workers/chunk-SAPFXU5X.js +0 -102
  826. package/Build/Workers/chunk-TBBFDFCS.js +0 -368
  827. package/Build/Workers/chunk-TGY6H6N6.js +0 -163
  828. package/Build/Workers/chunk-UOEUCKKU.js +0 -59
  829. package/Build/Workers/chunk-VFBNELXB.js +0 -353
  830. package/Build/Workers/chunk-VYWUFRRR.js +0 -1052
  831. package/Build/Workers/chunk-WVSELU6O.js +0 -2716
  832. package/Build/Workers/chunk-X43SJLQL.js +0 -10364
  833. package/Build/Workers/chunk-XUOJCLOH.js +0 -511
  834. package/Build/Workers/chunk-YLYBLJ3Y.js +0 -73
  835. package/Build/Workers/chunk-ZEE2EIFD.js +0 -430
  836. package/Build/Workers/chunk-ZIKGV7EL.js +0 -58
  837. package/Source/Scene/OctahedralProjectedCubeMap.js +0 -444
  838. package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.glsl +0 -78
  839. package/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js +0 -80
  840. package/Source/Shaders/OctahedralProjectionAtlasFS.glsl +0 -89
  841. package/Source/Shaders/OctahedralProjectionAtlasFS.js +0 -91
  842. package/Source/Shaders/OctahedralProjectionFS.glsl +0 -14
  843. package/Source/Shaders/OctahedralProjectionFS.js +0 -16
  844. package/Source/Shaders/OctahedralProjectionVS.glsl +0 -10
  845. package/Source/Shaders/OctahedralProjectionVS.js +0 -12
@@ -57,7 +57,6 @@ import GlobeTranslucencyState from "./GlobeTranslucencyState.js";
57
57
  import InvertClassification from "./InvertClassification.js";
58
58
  import JobScheduler from "./JobScheduler.js";
59
59
  import MapMode2D from "./MapMode2D.js";
60
- import OctahedralProjectedCubeMap from "./OctahedralProjectedCubeMap.js";
61
60
  import PerformanceDisplay from "./PerformanceDisplay.js";
62
61
  import PerInstanceColorAppearance from "./PerInstanceColorAppearance.js";
63
62
  import Picking from "./Picking.js";
@@ -69,6 +68,7 @@ import SceneTransforms from "./SceneTransforms.js";
69
68
  import SceneTransitioner from "./SceneTransitioner.js";
70
69
  import ScreenSpaceCameraController from "./ScreenSpaceCameraController.js";
71
70
  import ShadowMap from "./ShadowMap.js";
71
+ import SpecularEnvironmentCubeMap from "./SpecularEnvironmentCubeMap.js";
72
72
  import StencilConstants from "./StencilConstants.js";
73
73
  import SunLight from "./SunLight.js";
74
74
  import SunPostProcess from "./SunPostProcess.js";
@@ -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 () {
@@ -107,7 +109,7 @@ const requestRenderAfterFrame = function (scene) {
107
109
  * @param {boolean} [options.requestRenderMode=false] If true, rendering a frame will only occur when needed as determined by changes within the scene. Enabling improves performance of the application, but requires using {@link Scene#requestRender} to render a new frame explicitly in this mode. This will be necessary in many cases after making changes to the scene in other parts of the API. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
108
110
  * @param {number} [options.maximumRenderTimeChange=0.0] If requestRenderMode is true, this value defines the maximum change in simulation time allowed before a render is requested. See {@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|Improving Performance with Explicit Rendering}.
109
111
  * @param {number} [options.depthPlaneEllipsoidOffset=0.0] Adjust the DepthPlane to address rendering artefacts below ellipsoid zero elevation.
110
- * @param {number} [options.msaaSamples=1] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets.
112
+ * @param {number} [options.msaaSamples=4] If provided, this value controls the rate of multisample antialiasing. Typical multisampling rates are 2, 4, and sometimes 8 samples per pixel. Higher sampling rates of MSAA may impact performance in exchange for improved visual quality. This value only applies to WebGL2 contexts that support multisample render targets. Set to 1 to disable MSAA.
111
113
  *
112
114
  * @see CesiumWidget
113
115
  * @see {@link http://www.khronos.org/registry/webgl/specs/latest/#5.2|WebGLContextAttributes}
@@ -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);
@@ -228,7 +236,7 @@ function Scene(options) {
228
236
  this._minimumDisableDepthTestDistance = 0.0;
229
237
  this._debugInspector = new DebugInspector();
230
238
 
231
- this._msaaSamples = defaultValue(options.msaaSamples, 1);
239
+ this._msaaSamples = defaultValue(options.msaaSamples, 4);
232
240
 
233
241
  /**
234
242
  * Exceptions occurring in <code>render</code> are always caught in order to raise the
@@ -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
 
@@ -738,7 +748,7 @@ function Scene(options) {
738
748
  * @type {string}
739
749
  */
740
750
  this.specularEnvironmentMaps = undefined;
741
- this._specularEnvironmentMapAtlas = undefined;
751
+ this._specularEnvironmentCubeMap = undefined;
742
752
 
743
753
  /**
744
754
  * The light source for shading. Defaults to a directional light from the Sun.
@@ -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;
@@ -927,7 +937,7 @@ Object.defineProperties(Scene.prototype, {
927
937
  */
928
938
  specularEnvironmentMapsSupported: {
929
939
  get: function () {
930
- return OctahedralProjectedCubeMap.isSupported(this._context);
940
+ return SpecularEnvironmentCubeMap.isSupported(this._context);
931
941
  },
932
942
  },
933
943
 
@@ -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');
@@ -1630,7 +1639,7 @@ Object.defineProperties(Scene.prototype, {
1630
1639
  * The sample rate of multisample antialiasing (values greater than 1 enable MSAA).
1631
1640
  * @memberof Scene.prototype
1632
1641
  * @type {number}
1633
- * @default 1
1642
+ * @default 4
1634
1643
  */
1635
1644
  msaaSamples: {
1636
1645
  get: function () {
@@ -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
- defined(this._specularEnvironmentMapAtlas) &&
1968
- this._specularEnvironmentMapAtlas.ready
2009
+ defined(this._specularEnvironmentCubeMap) &&
2010
+ this._specularEnvironmentCubeMap.ready
1969
2011
  ) {
1970
- frameState.specularEnvironmentMaps = this._specularEnvironmentMapAtlas.texture;
1971
- frameState.specularEnvironmentMapsMaximumLOD = this._specularEnvironmentMapAtlas.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;
2452
+ }
2453
+ return executeTranslucentCommandsFrontToBack;
2454
+ }
2455
+
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);
2418
2562
  }
2419
2563
 
2420
- const frustumCommandsList = view.frustumCommandsList;
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
- }
2680
-
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
- );
2793
+ performTranslucentPass(scene, passState, frustumCommands);
2691
2794
 
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);
2866
+
2867
+ if (defined(environmentState.skyBoxCommand)) {
2868
+ executeCommand(environmentState.skyBoxCommand, scene, passState);
2869
+ }
2870
+
2871
+ if (environmentState.isSkyAtmosphereVisible) {
2872
+ executeCommand(environmentState.skyAtmosphereCommand, scene, passState);
2873
+ }
2783
2874
 
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);
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,31 +3457,29 @@ 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;
3331
- let envMapAtlas = this._specularEnvironmentMapAtlas;
3332
- if (
3333
- defined(envMaps) &&
3334
- (!defined(envMapAtlas) || envMapAtlas.url !== envMaps)
3335
- ) {
3336
- envMapAtlas = envMapAtlas && envMapAtlas.destroy();
3337
- this._specularEnvironmentMapAtlas = new OctahedralProjectedCubeMap(envMaps);
3338
- } else if (!defined(envMaps) && defined(envMapAtlas)) {
3339
- envMapAtlas.destroy();
3340
- this._specularEnvironmentMapAtlas = undefined;
3471
+ let specularEnvironmentCubeMap = this._specularEnvironmentCubeMap;
3472
+ if (defined(envMaps) && specularEnvironmentCubeMap?.url !== envMaps) {
3473
+ specularEnvironmentCubeMap =
3474
+ specularEnvironmentCubeMap && specularEnvironmentCubeMap.destroy();
3475
+ this._specularEnvironmentCubeMap = new SpecularEnvironmentCubeMap(envMaps);
3476
+ } else if (!defined(envMaps) && defined(specularEnvironmentCubeMap)) {
3477
+ specularEnvironmentCubeMap.destroy();
3478
+ this._specularEnvironmentCubeMap = undefined;
3341
3479
  }
3342
3480
 
3343
- if (defined(this._specularEnvironmentMapAtlas)) {
3344
- this._specularEnvironmentMapAtlas.update(frameState);
3481
+ if (defined(this._specularEnvironmentCubeMap)) {
3482
+ this._specularEnvironmentCubeMap.update(frameState);
3345
3483
  }
3346
3484
  };
3347
3485
 
@@ -3368,21 +3506,21 @@ function updateDebugFrustumPlanes(scene) {
3368
3506
 
3369
3507
  function updateShadowMaps(scene) {
3370
3508
  const frameState = scene._frameState;
3371
- const shadowMaps = frameState.shadowMaps;
3509
+ const { passes, shadowState, shadowMaps } = frameState;
3372
3510
  const length = shadowMaps.length;
3373
3511
 
3374
3512
  const shadowsEnabled =
3375
3513
  length > 0 &&
3376
- !frameState.passes.pick &&
3377
- !frameState.passes.pickVoxel &&
3514
+ !passes.pick &&
3515
+ !passes.pickVoxel &&
3378
3516
  scene.mode === SceneMode.SCENE3D;
3379
- if (shadowsEnabled !== frameState.shadowState.shadowsEnabled) {
3517
+ if (shadowsEnabled !== shadowState.shadowsEnabled) {
3380
3518
  // Update derived commands when shadowsEnabled changes
3381
- ++frameState.shadowState.lastDirtyTime;
3382
- frameState.shadowState.shadowsEnabled = shadowsEnabled;
3519
+ ++shadowState.lastDirtyTime;
3520
+ shadowState.shadowsEnabled = shadowsEnabled;
3383
3521
  }
3384
3522
 
3385
- frameState.shadowState.lightShadowsEnabled = false;
3523
+ shadowState.lightShadowsEnabled = false;
3386
3524
 
3387
3525
  if (!shadowsEnabled) {
3388
3526
  return;
@@ -3391,28 +3529,28 @@ function updateShadowMaps(scene) {
3391
3529
  // Check if the shadow maps are different than the shadow maps last frame.
3392
3530
  // If so, the derived commands need to be updated.
3393
3531
  for (let j = 0; j < length; ++j) {
3394
- if (shadowMaps[j] !== frameState.shadowState.shadowMaps[j]) {
3395
- ++frameState.shadowState.lastDirtyTime;
3532
+ if (shadowMaps[j] !== shadowState.shadowMaps[j]) {
3533
+ ++shadowState.lastDirtyTime;
3396
3534
  break;
3397
3535
  }
3398
3536
  }
3399
3537
 
3400
- frameState.shadowState.shadowMaps.length = 0;
3401
- frameState.shadowState.lightShadowMaps.length = 0;
3538
+ shadowState.shadowMaps.length = 0;
3539
+ shadowState.lightShadowMaps.length = 0;
3402
3540
 
3403
3541
  for (let i = 0; i < length; ++i) {
3404
3542
  const shadowMap = shadowMaps[i];
3405
3543
  shadowMap.update(frameState);
3406
3544
 
3407
- frameState.shadowState.shadowMaps.push(shadowMap);
3545
+ shadowState.shadowMaps.push(shadowMap);
3408
3546
 
3409
3547
  if (shadowMap.fromLightSource) {
3410
- frameState.shadowState.lightShadowMaps.push(shadowMap);
3411
- frameState.shadowState.lightShadowsEnabled = true;
3548
+ shadowState.lightShadowMaps.push(shadowMap);
3549
+ shadowState.lightShadowsEnabled = true;
3412
3550
  }
3413
3551
 
3414
3552
  if (shadowMap.dirty) {
3415
- ++frameState.shadowState.lastDirtyTime;
3553
+ ++shadowState.lastDirtyTime;
3416
3554
  shadowMap.dirty = false;
3417
3555
  }
3418
3556
  }
@@ -3438,7 +3576,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3438
3576
  const environmentState = scene._environmentState;
3439
3577
  const view = scene._view;
3440
3578
 
3441
- const passes = scene._frameState.passes;
3579
+ const passes = frameState.passes;
3442
3580
  const picking = passes.pick || passes.pickVoxel;
3443
3581
  if (defined(view.globeDepth)) {
3444
3582
  view.globeDepth.picking = picking;
@@ -3469,9 +3607,8 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3469
3607
 
3470
3608
  // Update globe depth rendering based on the current context and clear the globe depth framebuffer.
3471
3609
  // Globe depth is copied for the pick pass to support picking batched geometries in GroundPrimitives.
3472
- const useGlobeDepthFramebuffer = (environmentState.useGlobeDepthFramebuffer = defined(
3473
- view.globeDepth
3474
- ));
3610
+ const useGlobeDepthFramebuffer = (environmentState.useGlobeDepthFramebuffer =
3611
+ defined(view.globeDepth));
3475
3612
  if (useGlobeDepthFramebuffer) {
3476
3613
  view.globeDepth.update(
3477
3614
  context,
@@ -3479,7 +3616,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3479
3616
  view.viewport,
3480
3617
  scene.msaaSamples,
3481
3618
  scene._hdr,
3482
- environmentState.clearGlobeDepth
3619
+ environmentState.clearGlobeDepth,
3483
3620
  );
3484
3621
  view.globeDepth.clear(context, passState, clearColor);
3485
3622
  }
@@ -3494,7 +3631,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3494
3631
  passState,
3495
3632
  view.globeDepth.colorFramebufferManager,
3496
3633
  scene._hdr,
3497
- scene.msaaSamples
3634
+ scene.msaaSamples,
3498
3635
  );
3499
3636
  oit.clear(context, passState, clearColor);
3500
3637
  environmentState.useOIT = oit.isSupported();
@@ -3514,7 +3651,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3514
3651
  context,
3515
3652
  view.viewport,
3516
3653
  scene._hdr,
3517
- scene.msaaSamples
3654
+ scene.msaaSamples,
3518
3655
  );
3519
3656
  view.sceneFramebuffer.clear(context, passState, clearColor);
3520
3657
 
@@ -3543,8 +3680,8 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3543
3680
  !picking && defined(passState.framebuffer) && scene.invertClassification);
3544
3681
  if (useInvertClassification) {
3545
3682
  let depthFramebuffer;
3546
- if (scene.frameState.invertClassificationColor.alpha === 1.0) {
3547
- if (environmentState.useGlobeDepthFramebuffer) {
3683
+ if (frameState.invertClassificationColor.alpha === 1.0) {
3684
+ if (useGlobeDepthFramebuffer) {
3548
3685
  depthFramebuffer = view.globeDepth.framebuffer;
3549
3686
  }
3550
3687
  }
@@ -3554,17 +3691,17 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3554
3691
  scene._invertClassification.update(
3555
3692
  context,
3556
3693
  scene.msaaSamples,
3557
- view.globeDepth.colorFramebufferManager
3694
+ view.globeDepth.colorFramebufferManager,
3558
3695
  );
3559
3696
  scene._invertClassification.clear(context, passState);
3560
3697
 
3561
- if (scene.frameState.invertClassificationColor.alpha < 1.0 && useOIT) {
3698
+ if (frameState.invertClassificationColor.alpha < 1.0 && useOIT) {
3562
3699
  const command = scene._invertClassification.unclassifiedCommand;
3563
3700
  const derivedCommands = command.derivedCommands;
3564
3701
  derivedCommands.oit = oit.createDerivedCommands(
3565
3702
  command,
3566
3703
  context,
3567
- derivedCommands.oit
3704
+ derivedCommands.oit,
3568
3705
  );
3569
3706
  }
3570
3707
  } else {
@@ -3577,7 +3714,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3577
3714
  scene._hdr,
3578
3715
  view.viewport,
3579
3716
  context,
3580
- passState
3717
+ passState,
3581
3718
  );
3582
3719
  }
3583
3720
  }
@@ -3589,16 +3726,18 @@ Scene.prototype.resolveFramebuffers = function (passState) {
3589
3726
  const context = this._context;
3590
3727
  const environmentState = this._environmentState;
3591
3728
  const view = this._view;
3592
- const globeDepth = view.globeDepth;
3729
+ const { globeDepth, translucentTileClassification } = view;
3593
3730
  if (defined(globeDepth)) {
3594
3731
  globeDepth.prepareColorTextures(context);
3595
3732
  }
3596
3733
 
3597
- const useOIT = environmentState.useOIT;
3598
- const useGlobeDepthFramebuffer = environmentState.useGlobeDepthFramebuffer;
3599
- const usePostProcess = environmentState.usePostProcess;
3734
+ const {
3735
+ useOIT,
3736
+ useGlobeDepthFramebuffer,
3737
+ usePostProcess,
3738
+ originalFramebuffer,
3739
+ } = environmentState;
3600
3740
 
3601
- const defaultFramebuffer = environmentState.originalFramebuffer;
3602
3741
  const globeFramebuffer = useGlobeDepthFramebuffer
3603
3742
  ? globeDepth.colorFramebufferManager
3604
3743
  : undefined;
@@ -3608,11 +3747,10 @@ Scene.prototype.resolveFramebuffers = function (passState) {
3608
3747
  if (useOIT) {
3609
3748
  passState.framebuffer = usePostProcess
3610
3749
  ? sceneFramebuffer.framebuffer
3611
- : defaultFramebuffer;
3750
+ : originalFramebuffer;
3612
3751
  view.oit.execute(context, passState);
3613
3752
  }
3614
3753
 
3615
- const translucentTileClassification = view.translucentTileClassification;
3616
3754
  if (
3617
3755
  translucentTileClassification.hasTranslucentDepth &&
3618
3756
  translucentTileClassification.isSupported()
@@ -3632,14 +3770,14 @@ Scene.prototype.resolveFramebuffers = function (passState) {
3632
3770
  const idTexture = idFramebuffer.getColorTexture(0);
3633
3771
  const depthTexture = defaultValue(
3634
3772
  globeFramebuffer,
3635
- sceneFramebuffer
3773
+ sceneFramebuffer,
3636
3774
  ).getDepthStencilTexture();
3637
3775
  postProcess.execute(context, colorTexture, depthTexture, idTexture);
3638
- postProcess.copy(context, defaultFramebuffer);
3776
+ postProcess.copy(context, originalFramebuffer);
3639
3777
  }
3640
3778
 
3641
3779
  if (!useOIT && !usePostProcess && useGlobeDepthFramebuffer) {
3642
- passState.framebuffer = defaultFramebuffer;
3780
+ passState.framebuffer = originalFramebuffer;
3643
3781
  globeDepth.executeCopyColor(context, passState);
3644
3782
  }
3645
3783
  };
@@ -3648,7 +3786,7 @@ function callAfterRenderFunctions(scene) {
3648
3786
  // Functions are queued up during primitive update and executed here in case
3649
3787
  // the function modifies scene state that should remain constant over the frame.
3650
3788
  const functions = scene._frameState.afterRender;
3651
- for (let i = 0, length = functions.length; i < length; ++i) {
3789
+ for (let i = 0; i < functions.length; ++i) {
3652
3790
  const shouldRequestRender = functions[i]();
3653
3791
  if (shouldRequestRender) {
3654
3792
  scene.requestRender();
@@ -3662,9 +3800,7 @@ function getGlobeHeight(scene) {
3662
3800
  if (scene.mode === SceneMode.MORPHING) {
3663
3801
  return;
3664
3802
  }
3665
-
3666
- const camera = scene.camera;
3667
- const cartographic = camera.positionCartographic;
3803
+ const cartographic = scene.camera.positionCartographic;
3668
3804
  return scene.getHeight(cartographic);
3669
3805
  }
3670
3806
 
@@ -3742,7 +3878,7 @@ const updateHeightScratchCartographic = new Cartographic();
3742
3878
  Scene.prototype.updateHeight = function (
3743
3879
  cartographic,
3744
3880
  callback,
3745
- heightReference
3881
+ heightReference,
3746
3882
  ) {
3747
3883
  //>>includeStart('debug', pragmas.debug);
3748
3884
  Check.typeOf.func("callback", callback);
@@ -3770,7 +3906,7 @@ Scene.prototype.updateHeight = function (
3770
3906
  if (!ignoreTerrain && defined(this.globe)) {
3771
3907
  terrainRemoveCallback = this.globe._surface.updateHeight(
3772
3908
  cartographic,
3773
- callbackWrapper
3909
+ callbackWrapper,
3774
3910
  );
3775
3911
  }
3776
3912
 
@@ -3788,7 +3924,7 @@ Scene.prototype.updateHeight = function (
3788
3924
  const tilesetRemoveCallback = primitive.updateHeight(
3789
3925
  cartographic,
3790
3926
  callbackWrapper,
3791
- ellipsoid
3927
+ ellipsoid,
3792
3928
  );
3793
3929
  tilesetRemoveCallbacks[primitive.id] = tilesetRemoveCallback;
3794
3930
  };
@@ -3802,10 +3938,10 @@ Scene.prototype.updateHeight = function (
3802
3938
  }
3803
3939
 
3804
3940
  const removeAddedListener = this.primitives.primitiveAdded.addEventListener(
3805
- createPrimitiveEventListener
3941
+ createPrimitiveEventListener,
3806
3942
  );
3807
- const removeRemovedListener = this.primitives.primitiveRemoved.addEventListener(
3808
- (primitive) => {
3943
+ const removeRemovedListener =
3944
+ this.primitives.primitiveRemoved.addEventListener((primitive) => {
3809
3945
  if (primitive.isDestroyed() || !primitive.isCesium3DTileset) {
3810
3946
  return;
3811
3947
  }
@@ -3813,13 +3949,12 @@ Scene.prototype.updateHeight = function (
3813
3949
  tilesetRemoveCallbacks[primitive.id]();
3814
3950
  }
3815
3951
  delete tilesetRemoveCallbacks[primitive.id];
3816
- }
3817
- );
3952
+ });
3818
3953
 
3819
3954
  const removeCallback = () => {
3820
3955
  terrainRemoveCallback = terrainRemoveCallback && terrainRemoveCallback();
3821
3956
  Object.values(tilesetRemoveCallbacks).forEach((tilesetRemoveCallback) =>
3822
- tilesetRemoveCallback()
3957
+ tilesetRemoveCallback(),
3823
3958
  );
3824
3959
  tilesetRemoveCallbacks = {};
3825
3960
  removeAddedListener();
@@ -3884,7 +4019,7 @@ Scene.prototype.initializeFrame = function () {
3884
4019
  }
3885
4020
 
3886
4021
  this._globeHeight = updatedCartographic.height;
3887
- }
4022
+ },
3888
4023
  );
3889
4024
  }
3890
4025
  this._cameraUnderground = isCameraUnderground(this);
@@ -3920,7 +4055,7 @@ function updateDebugShowFramesPerSecond(scene, renderedThisFrame) {
3920
4055
  scene._performanceDisplay =
3921
4056
  scene._performanceDisplay && scene._performanceDisplay.destroy();
3922
4057
  scene._performanceContainer.parentNode.removeChild(
3923
- scene._performanceContainer
4058
+ scene._performanceContainer,
3924
4059
  );
3925
4060
  }
3926
4061
  }
@@ -3929,8 +4064,7 @@ function prePassesUpdate(scene) {
3929
4064
  scene._jobScheduler.resetBudgets();
3930
4065
 
3931
4066
  const frameState = scene._frameState;
3932
- const primitives = scene.primitives;
3933
- primitives.prePassesUpdate(frameState);
4067
+ scene.primitives.prePassesUpdate(frameState);
3934
4068
 
3935
4069
  if (defined(scene.globe)) {
3936
4070
  scene.globe.update(frameState);
@@ -3941,20 +4075,23 @@ function prePassesUpdate(scene) {
3941
4075
  }
3942
4076
 
3943
4077
  function postPassesUpdate(scene) {
3944
- const frameState = scene._frameState;
3945
- const primitives = scene.primitives;
3946
- primitives.postPassesUpdate(frameState);
3947
-
4078
+ scene.primitives.postPassesUpdate(scene._frameState);
3948
4079
  RequestScheduler.update();
3949
4080
  }
3950
4081
 
3951
4082
  const scratchBackgroundColor = new Color();
3952
4083
 
4084
+ /**
4085
+ * Render the scene
4086
+ *
4087
+ * @param {Scene} scene
4088
+ * @private
4089
+ */
3953
4090
  function render(scene) {
3954
4091
  const frameState = scene._frameState;
3955
4092
 
3956
4093
  const context = scene.context;
3957
- const us = context.uniformState;
4094
+ const { uniformState } = context;
3958
4095
 
3959
4096
  const view = scene._defaultView;
3960
4097
  scene._view = view;
@@ -3976,13 +4113,16 @@ function render(scene) {
3976
4113
  frameState.atmosphere = scene.atmosphere;
3977
4114
  scene.fog.update(frameState);
3978
4115
 
3979
- us.update(frameState);
4116
+ uniformState.update(frameState);
3980
4117
 
3981
4118
  const shadowMap = scene.shadowMap;
3982
4119
  if (defined(shadowMap) && shadowMap.enabled) {
3983
4120
  if (!defined(scene.light) || scene.light instanceof SunLight) {
3984
4121
  // Negate the sun direction so that it is from the Sun, not to the Sun
3985
- Cartesian3.negate(us.sunDirectionWC, scene._shadowMapCamera.direction);
4122
+ Cartesian3.negate(
4123
+ uniformState.sunDirectionWC,
4124
+ scene._shadowMapCamera.direction,
4125
+ );
3986
4126
  } else {
3987
4127
  Cartesian3.clone(scene.light.direction, scene._shadowMapCamera.direction);
3988
4128
  }
@@ -4081,7 +4221,7 @@ Scene.prototype.render = function (time) {
4081
4221
  defined(this._lastRenderTime)
4082
4222
  ) {
4083
4223
  const difference = Math.abs(
4084
- JulianDate.secondsDifference(this._lastRenderTime, time)
4224
+ JulianDate.secondsDifference(this._lastRenderTime, time),
4085
4225
  );
4086
4226
  shouldRender = shouldRender || difference > this.maximumRenderTimeChange;
4087
4227
  }
@@ -4095,7 +4235,7 @@ Scene.prototype.render = function (time) {
4095
4235
  const frameNumber = CesiumMath.incrementWrap(
4096
4236
  frameState.frameNumber,
4097
4237
  15000000.0,
4098
- 1.0
4238
+ 1.0,
4099
4239
  );
4100
4240
  updateFrameNumber(this, frameNumber, time);
4101
4241
  frameState.newFrame = true;
@@ -4104,9 +4244,7 @@ Scene.prototype.render = function (time) {
4104
4244
  tryAndCatchError(this, prePassesUpdate);
4105
4245
 
4106
4246
  /**
4107
- *
4108
4247
  * Passes update. Add any passes here
4109
- *
4110
4248
  */
4111
4249
  if (this.primitives.show) {
4112
4250
  tryAndCatchError(this, updateMostDetailedRayPicks);
@@ -4126,14 +4264,13 @@ Scene.prototype.render = function (time) {
4126
4264
  }
4127
4265
 
4128
4266
  /**
4129
- *
4130
4267
  * Post passes update. Execute any pass invariant code that should run after the passes here.
4131
- *
4132
4268
  */
4133
4269
  updateDebugShowFramesPerSecond(this, shouldRender);
4134
4270
  tryAndCatchError(this, postPassesUpdate);
4135
4271
 
4136
- // 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.
4137
4274
  // We don't want those events to resolve during the render loop because the events might add new primitives
4138
4275
  callAfterRenderFunctions(this);
4139
4276
 
@@ -4171,7 +4308,7 @@ Scene.prototype.requestRender = function () {
4171
4308
  Scene.prototype.clampLineWidth = function (width) {
4172
4309
  return Math.max(
4173
4310
  ContextLimits.minimumAliasedLineWidth,
4174
- Math.min(width, ContextLimits.maximumAliasedLineWidth)
4311
+ Math.min(width, ContextLimits.maximumAliasedLineWidth),
4175
4312
  );
4176
4313
  };
4177
4314
 
@@ -4234,7 +4371,7 @@ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4234
4371
  this,
4235
4372
  windowPosition,
4236
4373
  width,
4237
- height
4374
+ height,
4238
4375
  );
4239
4376
  // Look up the keyframeNode containing this picked cell
4240
4377
  const tileIndex = 255 * voxelCoordinate[0] + voxelCoordinate[1];
@@ -4250,10 +4387,94 @@ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4250
4387
  voxelPrimitive,
4251
4388
  tileIndex,
4252
4389
  sampleIndex,
4253
- keyframeNode
4390
+ keyframeNode,
4254
4391
  );
4255
4392
  };
4256
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,
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;
4476
+ };
4477
+
4257
4478
  /**
4258
4479
  * Returns the cartesian position reconstructed from the depth buffer and window position.
4259
4480
  * The returned position is in world coordinates. Used internally by camera functions to
@@ -4273,12 +4494,12 @@ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4273
4494
  */
4274
4495
  Scene.prototype.pickPositionWorldCoordinates = function (
4275
4496
  windowPosition,
4276
- result
4497
+ result,
4277
4498
  ) {
4278
4499
  return this._picking.pickPositionWorldCoordinates(
4279
4500
  this,
4280
4501
  windowPosition,
4281
- result
4502
+ result,
4282
4503
  );
4283
4504
  };
4284
4505
 
@@ -4355,7 +4576,7 @@ function updateRequestRenderModeDeferCheckPass(scene) {
4355
4576
  // Check if any ignored requests are ready to go (to wake rendering up again)
4356
4577
  scene.primitives.updateForPass(
4357
4578
  scene._frameState,
4358
- requestRenderModeDeferCheckPassState
4579
+ requestRenderModeDeferCheckPassState,
4359
4580
  );
4360
4581
  }
4361
4582
 
@@ -4407,14 +4628,14 @@ Scene.prototype.drillPickFromRay = function (
4407
4628
  ray,
4408
4629
  limit,
4409
4630
  objectsToExclude,
4410
- width
4631
+ width,
4411
4632
  ) {
4412
4633
  return this._picking.drillPickFromRay(
4413
4634
  this,
4414
4635
  ray,
4415
4636
  limit,
4416
4637
  objectsToExclude,
4417
- width
4638
+ width,
4418
4639
  );
4419
4640
  };
4420
4641
 
@@ -4434,13 +4655,13 @@ Scene.prototype.drillPickFromRay = function (
4434
4655
  Scene.prototype.pickFromRayMostDetailed = function (
4435
4656
  ray,
4436
4657
  objectsToExclude,
4437
- width
4658
+ width,
4438
4659
  ) {
4439
4660
  return this._picking.pickFromRayMostDetailed(
4440
4661
  this,
4441
4662
  ray,
4442
4663
  objectsToExclude,
4443
- width
4664
+ width,
4444
4665
  );
4445
4666
  };
4446
4667
 
@@ -4462,14 +4683,14 @@ Scene.prototype.drillPickFromRayMostDetailed = function (
4462
4683
  ray,
4463
4684
  limit,
4464
4685
  objectsToExclude,
4465
- width
4686
+ width,
4466
4687
  ) {
4467
4688
  return this._picking.drillPickFromRayMostDetailed(
4468
4689
  this,
4469
4690
  ray,
4470
4691
  limit,
4471
4692
  objectsToExclude,
4472
- width
4693
+ width,
4473
4694
  );
4474
4695
  };
4475
4696
 
@@ -4534,14 +4755,14 @@ Scene.prototype.clampToHeight = function (
4534
4755
  cartesian,
4535
4756
  objectsToExclude,
4536
4757
  width,
4537
- result
4758
+ result,
4538
4759
  ) {
4539
4760
  return this._picking.clampToHeight(
4540
4761
  this,
4541
4762
  cartesian,
4542
4763
  objectsToExclude,
4543
4764
  width,
4544
- result
4765
+ result,
4545
4766
  );
4546
4767
  };
4547
4768
 
@@ -4576,13 +4797,13 @@ Scene.prototype.clampToHeight = function (
4576
4797
  Scene.prototype.sampleHeightMostDetailed = function (
4577
4798
  positions,
4578
4799
  objectsToExclude,
4579
- width
4800
+ width,
4580
4801
  ) {
4581
4802
  return this._picking.sampleHeightMostDetailed(
4582
4803
  this,
4583
4804
  positions,
4584
4805
  objectsToExclude,
4585
- width
4806
+ width,
4586
4807
  );
4587
4808
  };
4588
4809
 
@@ -4616,13 +4837,13 @@ Scene.prototype.sampleHeightMostDetailed = function (
4616
4837
  Scene.prototype.clampToHeightMostDetailed = function (
4617
4838
  cartesians,
4618
4839
  objectsToExclude,
4619
- width
4840
+ width,
4620
4841
  ) {
4621
4842
  return this._picking.clampToHeightMostDetailed(
4622
4843
  this,
4623
4844
  cartesians,
4624
4845
  objectsToExclude,
4625
- width
4846
+ width,
4626
4847
  );
4627
4848
  };
4628
4849
 
@@ -4696,15 +4917,14 @@ function setTerrain(scene, terrain) {
4696
4917
  }
4697
4918
  // Otherwise, set a placeholder
4698
4919
  scene.globe.terrainProvider = undefined;
4699
- scene._removeTerrainProviderReadyListener = terrain.readyEvent.addEventListener(
4700
- (provider) => {
4920
+ scene._removeTerrainProviderReadyListener =
4921
+ terrain.readyEvent.addEventListener((provider) => {
4701
4922
  if (defined(scene) && defined(scene.globe)) {
4702
4923
  scene.globe.terrainProvider = provider;
4703
4924
  }
4704
4925
 
4705
4926
  scene._removeTerrainProviderReadyListener();
4706
- }
4707
- );
4927
+ });
4708
4928
  }
4709
4929
 
4710
4930
  /**
@@ -4814,7 +5034,7 @@ Scene.prototype.destroy = function () {
4814
5034
  this._performanceDisplay =
4815
5035
  this._performanceDisplay && this._performanceDisplay.destroy();
4816
5036
  this._performanceContainer.parentNode.removeChild(
4817
- this._performanceContainer
5037
+ this._performanceContainer,
4818
5038
  );
4819
5039
  }
4820
5040