@cesium/engine 6.2.0 → 8.0.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 (268) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
  2. package/Build/Workers/{chunk-RH4N2ONY.js → chunk-23UFSGND.js} +7 -7
  3. package/Build/Workers/{chunk-HPP4JLNH.js → chunk-2A75IWRS.js} +7 -7
  4. package/Build/Workers/{chunk-5IRLXUTA.js → chunk-2FRVPMCS.js} +10 -10
  5. package/Build/Workers/{chunk-ZQRZBHYI.js → chunk-2FWRMUTY.js} +4 -4
  6. package/Build/Workers/{chunk-Z2SIPUKB.js → chunk-2UPKWTMJ.js} +6 -6
  7. package/Build/Workers/{chunk-434ZTTFX.js → chunk-34FXV7D7.js} +2 -2
  8. package/Build/Workers/{chunk-MW3CJYLX.js → chunk-3VAZEH7M.js} +2 -2
  9. package/Build/Workers/{chunk-HUPNRBWW.js → chunk-4DO5W5XZ.js} +6 -6
  10. package/Build/Workers/{chunk-PIXK6KHB.js → chunk-4H7PY4U5.js} +2 -2
  11. package/Build/Workers/{chunk-BP467WX3.js → chunk-5QULIR53.js} +4 -4
  12. package/Build/Workers/{chunk-R3HUGXBH.js → chunk-7TC63SJW.js} +8 -8
  13. package/Build/Workers/{chunk-SQVTYRZY.js → chunk-7ZFGPDJA.js} +4 -4
  14. package/Build/Workers/{chunk-TIXXVKUY.js → chunk-A5DWLWCY.js} +10 -10
  15. package/Build/Workers/{chunk-CWJQGBWT.js → chunk-BBWDMCVU.js} +1 -1
  16. package/Build/Workers/{chunk-4KP73B43.js → chunk-BG4UCVXN.js} +3 -3
  17. package/Build/Workers/{chunk-Y4OJ4B23.js → chunk-BIKA3NRA.js} +5 -5
  18. package/Build/Workers/{chunk-DR5XZ6K5.js → chunk-BROJAZRZ.js} +13 -13
  19. package/Build/Workers/{chunk-FWGNCYP6.js → chunk-DDUQAJ4P.js} +7 -7
  20. package/Build/Workers/{chunk-QRBRVGZC.js → chunk-EERJKOAF.js} +4 -4
  21. package/Build/Workers/{chunk-52VSIKEA.js → chunk-EG6PTBY2.js} +15 -15
  22. package/Build/Workers/{chunk-O43GWBSF.js → chunk-EHWHNOEX.js} +1 -1
  23. package/Build/Workers/{chunk-MN34FIF5.js → chunk-F3YA3Y2Z.js} +1 -1
  24. package/Build/Workers/{chunk-GF5TNNKP.js → chunk-F4HFJMGM.js} +6 -6
  25. package/Build/Workers/{chunk-HOT2SNXP.js → chunk-FJKNFAKQ.js} +133 -553
  26. package/Build/Workers/{chunk-TMPVBFJQ.js → chunk-FNIRWHJB.js} +10 -10
  27. package/Build/Workers/{chunk-DMCSY5BU.js → chunk-FZRIVR7Y.js} +5 -5
  28. package/Build/Workers/{chunk-Z4JUBRHP.js → chunk-G43QFN4Q.js} +6 -6
  29. package/Build/Workers/{chunk-HPH5HSFE.js → chunk-GATZHF3K.js} +2 -2
  30. package/Build/Workers/{chunk-CSIZ3BGT.js → chunk-GRC2ZTAF.js} +14 -14
  31. package/Build/Workers/{chunk-NE4JNU6H.js → chunk-HU6N6EXB.js} +10 -10
  32. package/Build/Workers/{chunk-GVL5I7TC.js → chunk-I46ZRR5W.js} +17 -17
  33. package/Build/Workers/{chunk-5GDBZTHX.js → chunk-JURN7NPV.js} +17 -17
  34. package/Build/Workers/{chunk-H5DUXHCV.js → chunk-KKCR2YOP.js} +11 -11
  35. package/Build/Workers/{chunk-LX6XV4DK.js → chunk-LPR3YNP2.js} +5 -5
  36. package/Build/Workers/{chunk-HFKSAB5K.js → chunk-M7ERACJJ.js} +13 -13
  37. package/Build/Workers/{chunk-BUZDZBUH.js → chunk-MDWEGWPA.js} +10 -10
  38. package/Build/Workers/{chunk-LGJUI2CE.js → chunk-OGXZVPPM.js} +9 -5
  39. package/Build/Workers/{chunk-PZ2WJWUG.js → chunk-PGSJK77E.js} +6 -6
  40. package/Build/Workers/{chunk-ARPTYYKS.js → chunk-PPH7OFP3.js} +5 -5
  41. package/Build/Workers/{chunk-R4OZKBXH.js → chunk-SH5USDPI.js} +6 -6
  42. package/Build/Workers/{chunk-SV7DDPAC.js → chunk-SOWMRMWA.js} +1 -1
  43. package/Build/Workers/{chunk-RIDPF7PO.js → chunk-STW2DGFI.js} +2 -2
  44. package/Build/Workers/{chunk-CDGHUKQ4.js → chunk-T3XIFPYR.js} +13 -13
  45. package/Build/Workers/chunk-TTUZP4BO.js +501 -0
  46. package/Build/Workers/{chunk-QTZQZY2C.js → chunk-UEXTBDBE.js} +34 -10
  47. package/Build/Workers/{chunk-XUTVA4K5.js → chunk-VOXYEYJT.js} +11 -11
  48. package/Build/Workers/{chunk-AXFRNOVC.js → chunk-X4356LRH.js} +12 -12
  49. package/Build/Workers/{chunk-5HLGKKG3.js → chunk-XGI5BXZY.js} +2 -2
  50. package/Build/Workers/{chunk-SNN7WOC2.js → chunk-Y2ME2IJV.js} +13 -13
  51. package/Build/Workers/{chunk-LGL4P5KL.js → chunk-Y5UQJLYE.js} +6 -6
  52. package/Build/Workers/{chunk-3PW6ZBN4.js → chunk-YJEBABKH.js} +7 -7
  53. package/Build/Workers/{chunk-YBKFS53K.js → chunk-YWTJ2B4B.js} +1 -1
  54. package/Build/Workers/{chunk-5SK36PU4.js → chunk-Z3TIFFGF.js} +7 -7
  55. package/Build/Workers/{chunk-JGG36SQV.js → chunk-ZT7KWISZ.js} +4 -4
  56. package/Build/Workers/combineGeometry.js +24 -23
  57. package/Build/Workers/createBoxGeometry.js +18 -17
  58. package/Build/Workers/createBoxOutlineGeometry.js +16 -15
  59. package/Build/Workers/createCircleGeometry.js +26 -25
  60. package/Build/Workers/createCircleOutlineGeometry.js +19 -18
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
  63. package/Build/Workers/createCorridorGeometry.js +29 -29
  64. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  65. package/Build/Workers/createCylinderGeometry.js +20 -19
  66. package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
  67. package/Build/Workers/createEllipseGeometry.js +26 -25
  68. package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
  69. package/Build/Workers/createEllipsoidGeometry.js +19 -18
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
  71. package/Build/Workers/createFrustumGeometry.js +18 -17
  72. package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
  73. package/Build/Workers/createGeometry.js +54 -33
  74. package/Build/Workers/createGroundPolylineGeometry.js +22 -21
  75. package/Build/Workers/createPlaneGeometry.js +16 -15
  76. package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
  77. package/Build/Workers/createPolygonGeometry.js +32 -166
  78. package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
  79. package/Build/Workers/createPolylineGeometry.js +25 -24
  80. package/Build/Workers/createPolylineVolumeGeometry.js +32 -33
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  82. package/Build/Workers/createRectangleGeometry.js +27 -26
  83. package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
  84. package/Build/Workers/createSimplePolylineGeometry.js +23 -22
  85. package/Build/Workers/createSphereGeometry.js +19 -18
  86. package/Build/Workers/createSphereOutlineGeometry.js +18 -17
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  89. package/Build/Workers/createVectorTileGeometries.js +24 -23
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +22 -21
  92. package/Build/Workers/createVectorTilePolylines.js +14 -14
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
  94. package/Build/Workers/createVerticesFromHeightmap.js +22 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
  96. package/Build/Workers/createWallGeometry.js +24 -23
  97. package/Build/Workers/createWallOutlineGeometry.js +23 -22
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  100. package/Build/Workers/decodeI3S.js +601 -92
  101. package/Build/Workers/transcodeKTX2.js +7 -7
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
  104. package/LICENSE.md +1 -1
  105. package/Source/Assets/approximateTerrainHeights.json +1 -1
  106. package/Source/Core/Ellipsoid.js +6 -0
  107. package/Source/Core/GregorianDate.js +85 -0
  108. package/Source/Core/HeadingPitchRange.js +2 -2
  109. package/Source/Core/IntersectionTests.js +6 -3
  110. package/Source/Core/Ion.js +1 -1
  111. package/Source/Core/PixelFormat.js +5 -0
  112. package/Source/Core/PolygonGeometry.js +0 -169
  113. package/Source/Core/Resource.js +30 -69
  114. package/Source/Core/Transforms.js +30 -18
  115. package/Source/Core/createWorldBathymetryAsync.js +45 -0
  116. package/Source/Core/srgbToLinear.js +32 -0
  117. package/Source/DataSources/CzmlDataSource.js +51 -23
  118. package/Source/DataSources/DataSourceDisplay.js +27 -0
  119. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
  120. package/Source/DataSources/Entity.js +28 -7
  121. package/Source/DataSources/EntityCollection.js +1 -2
  122. package/Source/DataSources/GeometryUpdater.js +1 -2
  123. package/Source/DataSources/GeometryUpdaterSet.js +114 -0
  124. package/Source/DataSources/GeometryVisualizer.js +19 -83
  125. package/Source/DataSources/GroundGeometryUpdater.js +6 -3
  126. package/Source/DataSources/ModelVisualizer.js +19 -98
  127. package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
  128. package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
  129. package/Source/DataSources/TerrainOffsetProperty.js +15 -23
  130. package/Source/Renderer/AutomaticUniforms.js +121 -1
  131. package/Source/Renderer/Context.js +10 -0
  132. package/Source/Renderer/ContextLimits.js +2 -0
  133. package/Source/Renderer/UniformState.js +127 -0
  134. package/Source/Renderer/demodernizeShader.js +4 -1
  135. package/Source/Scene/ArcGisMapService.js +1 -1
  136. package/Source/Scene/Atmosphere.js +127 -0
  137. package/Source/Scene/Axis.js +12 -7
  138. package/Source/Scene/Billboard.js +29 -26
  139. package/Source/Scene/BillboardCollection.js +3 -3
  140. package/Source/Scene/Camera.js +47 -5
  141. package/Source/Scene/Cesium3DTile.js +1 -0
  142. package/Source/Scene/Cesium3DTileContent.js +14 -0
  143. package/Source/Scene/Cesium3DTileset.js +364 -45
  144. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
  145. package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
  146. package/Source/Scene/Composite3DTileContent.js +42 -0
  147. package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
  148. package/Source/Scene/Empty3DTileContent.js +4 -0
  149. package/Source/Scene/Fog.js +1 -0
  150. package/Source/Scene/FrameState.js +14 -1
  151. package/Source/Scene/Geometry3DTileContent.js +4 -0
  152. package/Source/Scene/Globe.js +3 -2
  153. package/Source/Scene/GlobeSurfaceTileProvider.js +3 -1
  154. package/Source/Scene/GlobeTranslucencyState.js +1 -1
  155. package/Source/Scene/GltfLoader.js +15 -5
  156. package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
  157. package/Source/Scene/HeightReference.js +59 -2
  158. package/Source/Scene/I3SDataProvider.js +270 -53
  159. package/Source/Scene/I3SDecoder.js +8 -1
  160. package/Source/Scene/I3SFeature.js +2 -5
  161. package/Source/Scene/I3SField.js +136 -31
  162. package/Source/Scene/I3SGeometry.js +70 -2
  163. package/Source/Scene/I3SLayer.js +55 -10
  164. package/Source/Scene/I3SNode.js +175 -18
  165. package/Source/Scene/I3SStatistics.js +94 -0
  166. package/Source/Scene/I3SSublayer.js +176 -0
  167. package/Source/Scene/I3SSymbology.js +337 -0
  168. package/Source/Scene/Implicit3DTileContent.js +4 -0
  169. package/Source/Scene/KeyframeNode.js +1 -1
  170. package/Source/Scene/LabelCollection.js +2 -2
  171. package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
  172. package/Source/Scene/Model/B3dmLoader.js +4 -0
  173. package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
  174. package/Source/Scene/Model/I3dmLoader.js +4 -0
  175. package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
  176. package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
  177. package/Source/Scene/Model/Model.js +82 -32
  178. package/Source/Scene/Model/Model3DTileContent.js +31 -0
  179. package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
  180. package/Source/Scene/Model/ModelSceneGraph.js +6 -0
  181. package/Source/Scene/Model/pickModel.js +426 -0
  182. package/Source/Scene/Multiple3DTileContent.js +42 -0
  183. package/Source/Scene/PickFramebuffer.js +37 -2
  184. package/Source/Scene/Picking.js +113 -39
  185. package/Source/Scene/Primitive.js +6 -2
  186. package/Source/Scene/QuadtreePrimitive.js +1 -1
  187. package/Source/Scene/Scene.js +312 -46
  188. package/Source/Scene/ScreenSpaceCameraController.js +23 -13
  189. package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
  190. package/Source/Scene/SkyAtmosphere.js +5 -6
  191. package/Source/Scene/SpatialNode.js +12 -19
  192. package/Source/Scene/StructuralMetadata.js +1 -1
  193. package/Source/Scene/Terrain.js +49 -0
  194. package/Source/Scene/TileBoundingS2Cell.js +2 -2
  195. package/Source/Scene/Tileset3DTileContent.js +4 -0
  196. package/Source/Scene/Vector3DTileContent.js +4 -0
  197. package/Source/Scene/VoxelBoxShape.js +76 -0
  198. package/Source/Scene/VoxelCell.js +273 -0
  199. package/Source/Scene/VoxelCylinderShape.js +114 -43
  200. package/Source/Scene/VoxelEllipsoidShape.js +158 -116
  201. package/Source/Scene/VoxelPrimitive.js +3 -1
  202. package/Source/Scene/VoxelRenderResources.js +3 -0
  203. package/Source/Scene/VoxelShape.js +13 -0
  204. package/Source/Scene/VoxelTraversal.js +76 -54
  205. package/Source/Scene/buildVoxelDrawCommands.js +23 -0
  206. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
  207. package/Source/Scene/processVoxelProperties.js +2 -0
  208. package/Source/Shaders/AtmosphereCommon.glsl +3 -11
  209. package/Source/Shaders/AtmosphereCommon.js +3 -11
  210. package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
  211. package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
  212. package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
  213. package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
  214. package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
  215. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
  216. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
  217. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
  218. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
  219. package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
  220. package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
  221. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
  222. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
  223. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
  224. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
  225. package/Source/Shaders/GlobeFS.glsl +16 -25
  226. package/Source/Shaders/GlobeFS.js +16 -25
  227. package/Source/Shaders/GlobeVS.glsl +1 -1
  228. package/Source/Shaders/GlobeVS.js +1 -1
  229. package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
  230. package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
  231. package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
  232. package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
  233. package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
  234. package/Source/Shaders/Model/GeometryStageFS.js +1 -1
  235. package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
  236. package/Source/Shaders/Model/GeometryStageVS.js +4 -4
  237. package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
  238. package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
  239. package/Source/Shaders/Model/ModelFS.glsl +4 -0
  240. package/Source/Shaders/Model/ModelFS.js +4 -0
  241. package/Source/Shaders/Model/ModelVS.glsl +9 -4
  242. package/Source/Shaders/Model/ModelVS.js +9 -4
  243. package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
  244. package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
  245. package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
  246. package/Source/Shaders/SkyAtmosphereFS.js +5 -10
  247. package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
  248. package/Source/Shaders/SkyAtmosphereVS.js +3 -2
  249. package/Source/Shaders/Voxels/IntersectCylinder.glsl +14 -111
  250. package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
  251. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
  252. package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
  253. package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
  254. package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
  255. package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
  256. package/Source/Shaders/Voxels/VoxelFS.js +39 -1
  257. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
  258. package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
  259. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
  260. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
  261. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  262. package/Source/ThirdParty/draco_decoder.wasm +0 -0
  263. package/Source/Workers/createGeometry.js +40 -11
  264. package/Source/Workers/decodeI3S.js +720 -94
  265. package/index.d.ts +574 -71
  266. package/index.js +217 -196
  267. package/package.json +3 -3
  268. package/Build/Workers/chunk-ATB2I7OS.js +0 -55
@@ -18,6 +18,7 @@ import Event from "../Core/Event.js";
18
18
  import GeographicProjection from "../Core/GeographicProjection.js";
19
19
  import GeometryInstance from "../Core/GeometryInstance.js";
20
20
  import GeometryPipeline from "../Core/GeometryPipeline.js";
21
+ import HeightReference from "./HeightReference.js";
21
22
  import Intersect from "../Core/Intersect.js";
22
23
  import JulianDate from "../Core/JulianDate.js";
23
24
  import CesiumMath from "../Core/Math.js";
@@ -37,6 +38,7 @@ import Context from "../Renderer/Context.js";
37
38
  import ContextLimits from "../Renderer/ContextLimits.js";
38
39
  import Pass from "../Renderer/Pass.js";
39
40
  import RenderState from "../Renderer/RenderState.js";
41
+ import Atmosphere from "./Atmosphere.js";
40
42
  import BrdfLutGenerator from "./BrdfLutGenerator.js";
41
43
  import Camera from "./Camera.js";
42
44
  import Cesium3DTilePass from "./Cesium3DTilePass.js";
@@ -46,6 +48,7 @@ import DebugCameraPrimitive from "./DebugCameraPrimitive.js";
46
48
  import DepthPlane from "./DepthPlane.js";
47
49
  import DerivedCommand from "./DerivedCommand.js";
48
50
  import DeviceOrientationCameraController from "./DeviceOrientationCameraController.js";
51
+ import DynamicAtmosphereLightingType from "./DynamicAtmosphereLightingType.js";
49
52
  import Fog from "./Fog.js";
50
53
  import FrameState from "./FrameState.js";
51
54
  import GlobeTranslucencyState from "./GlobeTranslucencyState.js";
@@ -70,6 +73,8 @@ import SunPostProcess from "./SunPostProcess.js";
70
73
  import TweenCollection from "./TweenCollection.js";
71
74
  import View from "./View.js";
72
75
  import DebugInspector from "./DebugInspector.js";
76
+ import VoxelCell from "./VoxelCell.js";
77
+ import VoxelPrimitive from "./VoxelPrimitive.js";
73
78
 
74
79
  const requestRenderAfterFrame = function (scene) {
75
80
  return function () {
@@ -164,9 +169,11 @@ function Scene(options) {
164
169
  this._groundPrimitives = new PrimitiveCollection();
165
170
 
166
171
  this._globeHeight = undefined;
172
+ this._globeHeightDirty = true;
167
173
  this._cameraUnderground = false;
174
+ this._removeUpdateHeightCallback = undefined;
168
175
 
169
- this._logDepthBuffer = context.fragmentDepth;
176
+ this._logDepthBuffer = Scene.defaultLogDepthBuffer && context.fragmentDepth;
170
177
  this._logDepthBufferDirty = true;
171
178
 
172
179
  this._tweens = new TweenCollection();
@@ -512,6 +519,14 @@ function Scene(options) {
512
519
  */
513
520
  this.cameraEventWaitTime = 500.0;
514
521
 
522
+ /**
523
+ * Settings for atmosphere lighting effects affecting 3D Tiles and model rendering. This is not to be confused with
524
+ * {@link Scene#skyAtmosphere} which is responsible for rendering the sky.
525
+ *
526
+ * @type {Atmosphere}
527
+ */
528
+ this.atmosphere = new Atmosphere();
529
+
515
530
  /**
516
531
  * Blends the atmosphere to geometry far from the camera for horizon views. Allows for additional
517
532
  * performance improvements by rendering less geometry and dispatching less terrain requests.
@@ -720,6 +735,12 @@ function Scene(options) {
720
735
  this.initializeFrame();
721
736
  }
722
737
 
738
+ /**
739
+ * Use this to set the default value for {@link Scene#logarithmicDepthBuffer} in newly constructed Scenes
740
+ * This property relies on fragmentDepth being supported.
741
+ */
742
+ Scene.defaultLogDepthBuffer = true;
743
+
723
744
  function updateGlobeListeners(scene, globe) {
724
745
  for (let i = 0; i < scene._removeGlobeCallbacks.length; ++i) {
725
746
  scene._removeGlobeCallbacks[i]();
@@ -1849,10 +1870,12 @@ function getOccluder(scene) {
1849
1870
 
1850
1871
  /**
1851
1872
  * @private
1873
+ * @param {FrameState.Passes} passes
1852
1874
  */
1853
1875
  Scene.prototype.clearPasses = function (passes) {
1854
1876
  passes.render = false;
1855
1877
  passes.pick = false;
1878
+ passes.pickVoxel = false;
1856
1879
  passes.depth = false;
1857
1880
  passes.postProcess = false;
1858
1881
  passes.offscreen = false;
@@ -2111,6 +2134,7 @@ function executeCommand(command, scene, context, passState, debugFramebuffer) {
2111
2134
  const passes = frameState.passes;
2112
2135
  if (
2113
2136
  !passes.pick &&
2137
+ !passes.pickVoxel &&
2114
2138
  !passes.depth &&
2115
2139
  scene._hdr &&
2116
2140
  defined(command.derivedCommands) &&
@@ -2264,12 +2288,10 @@ const scratchOrthographicFrustum = new OrthographicFrustum();
2264
2288
  const scratchOrthographicOffCenterFrustum = new OrthographicOffCenterFrustum();
2265
2289
 
2266
2290
  function executeCommands(scene, passState) {
2267
- const camera = scene.camera;
2268
- const context = scene.context;
2269
- const frameState = scene.frameState;
2270
- const us = context.uniformState;
2291
+ const { camera, context, frameState } = scene;
2292
+ const { uniformState } = context;
2271
2293
 
2272
- us.updateCamera(camera);
2294
+ uniformState.updateCamera(camera);
2273
2295
 
2274
2296
  // Create a working frustum from the original camera frustum.
2275
2297
  let frustum;
@@ -2287,11 +2309,11 @@ function executeCommands(scene, passState) {
2287
2309
  // early-z, but we would have to draw it in each frustum
2288
2310
  frustum.near = camera.frustum.near;
2289
2311
  frustum.far = camera.frustum.far;
2290
- us.updateFrustum(frustum);
2291
- us.updatePass(Pass.ENVIRONMENT);
2312
+ uniformState.updateFrustum(frustum);
2313
+ uniformState.updatePass(Pass.ENVIRONMENT);
2292
2314
 
2293
2315
  const passes = frameState.passes;
2294
- const picking = passes.pick;
2316
+ const picking = passes.pick || passes.pickVoxel;
2295
2317
  const environmentState = scene._environmentState;
2296
2318
  const view = scene._view;
2297
2319
  const renderTranslucentDepthForPick =
@@ -2393,8 +2415,8 @@ function executeCommands(scene, passState) {
2393
2415
  camera.position.z = height2D - frustumCommands.near + 1.0;
2394
2416
  frustum.far = Math.max(1.0, frustumCommands.far - frustumCommands.near);
2395
2417
  frustum.near = 1.0;
2396
- us.update(frameState);
2397
- us.updateFrustum(frustum);
2418
+ uniformState.update(frameState);
2419
+ uniformState.updateFrustum(frustum);
2398
2420
  } else {
2399
2421
  // Avoid tearing artifacts between adjacent frustums in the opaque passes
2400
2422
  frustum.near =
@@ -2402,7 +2424,7 @@ function executeCommands(scene, passState) {
2402
2424
  ? frustumCommands.near * scene.opaqueFrustumNearOffset
2403
2425
  : frustumCommands.near;
2404
2426
  frustum.far = frustumCommands.far;
2405
- us.updateFrustum(frustum);
2427
+ uniformState.updateFrustum(frustum);
2406
2428
  }
2407
2429
 
2408
2430
  clearDepth.execute(context, passState);
@@ -2411,7 +2433,7 @@ function executeCommands(scene, passState) {
2411
2433
  clearStencil.execute(context, passState);
2412
2434
  }
2413
2435
 
2414
- us.updatePass(Pass.GLOBE);
2436
+ uniformState.updatePass(Pass.GLOBE);
2415
2437
  let commands = frustumCommands.commands[Pass.GLOBE];
2416
2438
  let length = frustumCommands.indices[Pass.GLOBE];
2417
2439
 
@@ -2436,7 +2458,7 @@ function executeCommands(scene, passState) {
2436
2458
 
2437
2459
  // Draw terrain classification
2438
2460
  if (!environmentState.renderTranslucentDepthForPick) {
2439
- us.updatePass(Pass.TERRAIN_CLASSIFICATION);
2461
+ uniformState.updatePass(Pass.TERRAIN_CLASSIFICATION);
2440
2462
  commands = frustumCommands.commands[Pass.TERRAIN_CLASSIFICATION];
2441
2463
  length = frustumCommands.indices[Pass.TERRAIN_CLASSIFICATION];
2442
2464
 
@@ -2470,7 +2492,7 @@ function executeCommands(scene, passState) {
2470
2492
  // Common/fastest path. Draw 3D Tiles and classification normally.
2471
2493
 
2472
2494
  // Draw 3D Tiles
2473
- us.updatePass(Pass.CESIUM_3D_TILE);
2495
+ uniformState.updatePass(Pass.CESIUM_3D_TILE);
2474
2496
  commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2475
2497
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2476
2498
  for (j = 0; j < length; ++j) {
@@ -2492,7 +2514,7 @@ function executeCommands(scene, passState) {
2492
2514
 
2493
2515
  // Draw classifications. Modifies 3D Tiles color.
2494
2516
  if (!environmentState.renderTranslucentDepthForPick) {
2495
- us.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2517
+ uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2496
2518
  commands =
2497
2519
  frustumCommands.commands[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2498
2520
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION];
@@ -2540,7 +2562,7 @@ function executeCommands(scene, passState) {
2540
2562
  passState.framebuffer = scene._invertClassification._fbo.framebuffer;
2541
2563
 
2542
2564
  // Draw normally
2543
- us.updatePass(Pass.CESIUM_3D_TILE);
2565
+ uniformState.updatePass(Pass.CESIUM_3D_TILE);
2544
2566
  commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2545
2567
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2546
2568
  for (j = 0; j < length; ++j) {
@@ -2558,7 +2580,7 @@ function executeCommands(scene, passState) {
2558
2580
  }
2559
2581
 
2560
2582
  // Set stencil
2561
- us.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW);
2583
+ uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW);
2562
2584
  commands =
2563
2585
  frustumCommands.commands[
2564
2586
  Pass.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW
@@ -2584,7 +2606,7 @@ function executeCommands(scene, passState) {
2584
2606
  }
2585
2607
 
2586
2608
  // Draw style over classification.
2587
- us.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2609
+ uniformState.updatePass(Pass.CESIUM_3D_TILE_CLASSIFICATION);
2588
2610
  commands = frustumCommands.commands[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2589
2611
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE_CLASSIFICATION];
2590
2612
  for (j = 0; j < length; ++j) {
@@ -2596,13 +2618,13 @@ function executeCommands(scene, passState) {
2596
2618
  clearStencil.execute(context, passState);
2597
2619
  }
2598
2620
 
2599
- us.updatePass(Pass.VOXELS);
2621
+ uniformState.updatePass(Pass.VOXELS);
2600
2622
  commands = frustumCommands.commands[Pass.VOXELS];
2601
2623
  length = frustumCommands.indices[Pass.VOXELS];
2602
2624
  commands.length = length;
2603
2625
  executeVoxelCommands(scene, executeCommand, passState, commands);
2604
2626
 
2605
- us.updatePass(Pass.OPAQUE);
2627
+ uniformState.updatePass(Pass.OPAQUE);
2606
2628
  commands = frustumCommands.commands[Pass.OPAQUE];
2607
2629
  length = frustumCommands.indices[Pass.OPAQUE];
2608
2630
  for (j = 0; j < length; ++j) {
@@ -2612,7 +2634,7 @@ function executeCommands(scene, passState) {
2612
2634
  if (index !== 0 && scene.mode !== SceneMode.SCENE2D) {
2613
2635
  // Do not overlap frustums in the translucent pass to avoid blending artifacts
2614
2636
  frustum.near = frustumCommands.near;
2615
- us.updateFrustum(frustum);
2637
+ uniformState.updateFrustum(frustum);
2616
2638
  }
2617
2639
 
2618
2640
  let invertClassification;
@@ -2626,7 +2648,7 @@ function executeCommands(scene, passState) {
2626
2648
  invertClassification = scene._invertClassification;
2627
2649
  }
2628
2650
 
2629
- us.updatePass(Pass.TRANSLUCENT);
2651
+ uniformState.updatePass(Pass.TRANSLUCENT);
2630
2652
  commands = frustumCommands.commands[Pass.TRANSLUCENT];
2631
2653
  commands.length = frustumCommands.indices[Pass.TRANSLUCENT];
2632
2654
  executeTranslucentCommands(
@@ -2685,9 +2707,9 @@ function executeCommands(scene, passState) {
2685
2707
  ? frustumCommands.near * scene.opaqueFrustumNearOffset
2686
2708
  : frustumCommands.near;
2687
2709
  frustum.far = frustumCommands.far;
2688
- us.updateFrustum(frustum);
2710
+ uniformState.updateFrustum(frustum);
2689
2711
 
2690
- us.updatePass(Pass.GLOBE);
2712
+ uniformState.updatePass(Pass.GLOBE);
2691
2713
  commands = frustumCommands.commands[Pass.GLOBE];
2692
2714
  length = frustumCommands.indices[Pass.GLOBE];
2693
2715
 
@@ -2715,21 +2737,21 @@ function executeCommands(scene, passState) {
2715
2737
  depthPlane.execute(context, passState);
2716
2738
  }
2717
2739
 
2718
- us.updatePass(Pass.CESIUM_3D_TILE);
2740
+ uniformState.updatePass(Pass.CESIUM_3D_TILE);
2719
2741
  commands = frustumCommands.commands[Pass.CESIUM_3D_TILE];
2720
2742
  length = frustumCommands.indices[Pass.CESIUM_3D_TILE];
2721
2743
  for (j = 0; j < length; ++j) {
2722
2744
  executeIdCommand(commands[j], scene, context, passState);
2723
2745
  }
2724
2746
 
2725
- us.updatePass(Pass.OPAQUE);
2747
+ uniformState.updatePass(Pass.OPAQUE);
2726
2748
  commands = frustumCommands.commands[Pass.OPAQUE];
2727
2749
  length = frustumCommands.indices[Pass.OPAQUE];
2728
2750
  for (j = 0; j < length; ++j) {
2729
2751
  executeIdCommand(commands[j], scene, context, passState);
2730
2752
  }
2731
2753
 
2732
- us.updatePass(Pass.TRANSLUCENT);
2754
+ uniformState.updatePass(Pass.TRANSLUCENT);
2733
2755
  commands = frustumCommands.commands[Pass.TRANSLUCENT];
2734
2756
  length = frustumCommands.indices[Pass.TRANSLUCENT];
2735
2757
  for (j = 0; j < length; ++j) {
@@ -3167,6 +3189,7 @@ Scene.prototype.updateEnvironment = function () {
3167
3189
  const environmentState = this._environmentState;
3168
3190
  const renderPass = frameState.passes.render;
3169
3191
  const offscreenPass = frameState.passes.offscreen;
3192
+ const atmosphere = this.atmosphere;
3170
3193
  const skyAtmosphere = this.skyAtmosphere;
3171
3194
  const globe = this.globe;
3172
3195
  const globeTranslucencyState = this._globeTranslucencyState;
@@ -3185,17 +3208,19 @@ Scene.prototype.updateEnvironment = function () {
3185
3208
  } else {
3186
3209
  if (defined(skyAtmosphere)) {
3187
3210
  if (defined(globe)) {
3188
- skyAtmosphere.setDynamicAtmosphereColor(
3189
- globe.enableLighting && globe.dynamicAtmosphereLighting,
3190
- globe.dynamicAtmosphereLightingFromSun
3211
+ skyAtmosphere.setDynamicLighting(
3212
+ DynamicAtmosphereLightingType.fromGlobeFlags(globe)
3191
3213
  );
3192
3214
  environmentState.isReadyForAtmosphere =
3193
3215
  environmentState.isReadyForAtmosphere ||
3194
3216
  !globe.show ||
3195
3217
  globe._surface._tilesToRender.length > 0;
3196
3218
  } else {
3219
+ const dynamicLighting = atmosphere.dynamicLighting;
3220
+ skyAtmosphere.setDynamicLighting(dynamicLighting);
3197
3221
  environmentState.isReadyForAtmosphere = true;
3198
3222
  }
3223
+
3199
3224
  environmentState.skyAtmosphereCommand = skyAtmosphere.update(
3200
3225
  frameState,
3201
3226
  globe
@@ -3317,7 +3342,10 @@ function updateShadowMaps(scene) {
3317
3342
  const length = shadowMaps.length;
3318
3343
 
3319
3344
  const shadowsEnabled =
3320
- length > 0 && !frameState.passes.pick && scene.mode === SceneMode.SCENE3D;
3345
+ length > 0 &&
3346
+ !frameState.passes.pick &&
3347
+ !frameState.passes.pickVoxel &&
3348
+ scene.mode === SceneMode.SCENE3D;
3321
3349
  if (shadowsEnabled !== frameState.shadowState.shadowsEnabled) {
3322
3350
  // Update derived commands when shadowsEnabled changes
3323
3351
  ++frameState.shadowState.lastDirtyTime;
@@ -3381,7 +3409,7 @@ function updateAndClearFramebuffers(scene, passState, clearColor) {
3381
3409
  const view = scene._view;
3382
3410
 
3383
3411
  const passes = scene._frameState.passes;
3384
- const picking = passes.pick;
3412
+ const picking = passes.pick || passes.pickVoxel;
3385
3413
  if (defined(view.globeDepth)) {
3386
3414
  view.globeDepth.picking = picking;
3387
3415
  }
@@ -3601,19 +3629,179 @@ function callAfterRenderFunctions(scene) {
3601
3629
  }
3602
3630
 
3603
3631
  function getGlobeHeight(scene) {
3604
- const globe = scene._globe;
3632
+ if (scene.mode === SceneMode.MORPHING) {
3633
+ return;
3634
+ }
3635
+
3605
3636
  const camera = scene.camera;
3606
3637
  const cartographic = camera.positionCartographic;
3607
- if (defined(globe) && globe.show && defined(cartographic)) {
3608
- return globe.getHeight(cartographic);
3638
+ return scene.getHeight(cartographic);
3639
+ }
3640
+
3641
+ /**
3642
+ * Gets the height of the loaded surface at the cartographic position.
3643
+ * @param {Cartographic} cartographic The cartographic position.
3644
+ * @param {HeightReference} [heightReference=CLAMP_TO_GROUND] Based on the height reference value, determines whether to ignore heights from 3D Tiles or terrain.
3645
+ * @private
3646
+ */
3647
+ Scene.prototype.getHeight = function (cartographic, heightReference) {
3648
+ if (!defined(cartographic)) {
3649
+ return undefined;
3609
3650
  }
3651
+
3652
+ const ignore3dTiles =
3653
+ heightReference === HeightReference.CLAMP_TO_TERRAIN ||
3654
+ heightReference === HeightReference.RELATIVE_TO_TERRAIN;
3655
+
3656
+ const ignoreTerrain =
3657
+ heightReference === HeightReference.CLAMP_TO_3D_TILE ||
3658
+ heightReference === HeightReference.RELATIVE_TO_3D_TILE;
3659
+
3660
+ if (!defined(cartographic)) {
3661
+ return;
3662
+ }
3663
+
3664
+ let maxHeight = Number.NEGATIVE_INFINITY;
3665
+
3666
+ if (!ignore3dTiles) {
3667
+ const length = this.primitives.length;
3668
+ for (let i = 0; i < length; ++i) {
3669
+ const primitive = this.primitives.get(i);
3670
+ if (
3671
+ !primitive.isCesium3DTileset ||
3672
+ !primitive.show ||
3673
+ !primitive.enableCollision
3674
+ ) {
3675
+ continue;
3676
+ }
3677
+
3678
+ const result = primitive.getHeight(cartographic, this);
3679
+ if (defined(result) && result > maxHeight) {
3680
+ maxHeight = result;
3681
+ }
3682
+ }
3683
+ }
3684
+
3685
+ const globe = this._globe;
3686
+ if (!ignoreTerrain && defined(globe) && globe.show) {
3687
+ const result = globe.getHeight(cartographic);
3688
+ if (result > maxHeight) {
3689
+ maxHeight = result;
3690
+ }
3691
+ }
3692
+
3693
+ if (maxHeight > Number.NEGATIVE_INFINITY) {
3694
+ return maxHeight;
3695
+ }
3696
+
3610
3697
  return undefined;
3611
- }
3698
+ };
3699
+
3700
+ const updateHeightScratchCartographic = new Cartographic();
3701
+ /**
3702
+ * Calls the callback when a new tile is rendered that contains the given cartographic. The only parameter
3703
+ * is the cartesian position on the tile.
3704
+ *
3705
+ * @private
3706
+ *
3707
+ * @param {Cartographic} cartographic The cartographic position.
3708
+ * @param {Function} callback The function to be called when a new tile is loaded containing the updated cartographic.
3709
+ * @param {HeightReference} [heightReference=CLAMP_TO_GROUND] Based on the height reference value, determines whether to ignore heights from 3D Tiles or terrain.
3710
+ * @returns {Function} The function to remove this callback from the quadtree.
3711
+ */
3712
+ Scene.prototype.updateHeight = function (
3713
+ cartographic,
3714
+ callback,
3715
+ heightReference
3716
+ ) {
3717
+ //>>includeStart('debug', pragmas.debug);
3718
+ Check.typeOf.func("callback", callback);
3719
+ //>>includeEnd('debug');
3720
+
3721
+ const callbackWrapper = () => {
3722
+ Cartographic.clone(cartographic, updateHeightScratchCartographic);
3723
+
3724
+ const height = this.getHeight(cartographic, heightReference);
3725
+ if (defined(height)) {
3726
+ updateHeightScratchCartographic.height = height;
3727
+ callback(updateHeightScratchCartographic);
3728
+ }
3729
+ };
3730
+
3731
+ const ignore3dTiles =
3732
+ heightReference === HeightReference.CLAMP_TO_TERRAIN ||
3733
+ heightReference === HeightReference.RELATIVE_TO_TERRAIN;
3734
+
3735
+ const ignoreTerrain =
3736
+ heightReference === HeightReference.CLAMP_TO_3D_TILE ||
3737
+ heightReference === HeightReference.RELATIVE_TO_3D_TILE;
3738
+
3739
+ let terrainRemoveCallback;
3740
+ if (!ignoreTerrain && defined(this.globe)) {
3741
+ terrainRemoveCallback = this.globe._surface.updateHeight(
3742
+ cartographic,
3743
+ callbackWrapper
3744
+ );
3745
+ }
3746
+
3747
+ let tilesetRemoveCallbacks = {};
3748
+ const ellipsoid = this.globe?.ellipsoid;
3749
+ const createPrimitiveEventListener = (primitive) => {
3750
+ if (
3751
+ ignore3dTiles ||
3752
+ primitive.isDestroyed() ||
3753
+ !primitive.isCesium3DTileset
3754
+ ) {
3755
+ return;
3756
+ }
3757
+
3758
+ const tilesetRemoveCallback = primitive.updateHeight(
3759
+ cartographic,
3760
+ callbackWrapper,
3761
+ ellipsoid
3762
+ );
3763
+ tilesetRemoveCallbacks[primitive.id] = tilesetRemoveCallback;
3764
+ };
3765
+
3766
+ if (!ignore3dTiles) {
3767
+ const length = this.primitives.length;
3768
+ for (let i = 0; i < length; ++i) {
3769
+ const primitive = this.primitives.get(i);
3770
+ createPrimitiveEventListener(primitive);
3771
+ }
3772
+ }
3773
+
3774
+ const removeAddedListener = this.primitives.primitiveAdded.addEventListener(
3775
+ createPrimitiveEventListener
3776
+ );
3777
+ const removeRemovedListener = this.primitives.primitiveRemoved.addEventListener(
3778
+ (primitive) => {
3779
+ if (primitive.isDestroyed() || !primitive.isCesium3DTileset) {
3780
+ return;
3781
+ }
3782
+ if (defined(tilesetRemoveCallbacks[primitive.id])) {
3783
+ tilesetRemoveCallbacks[primitive.id]();
3784
+ }
3785
+ delete tilesetRemoveCallbacks[primitive.id];
3786
+ }
3787
+ );
3788
+
3789
+ const removeCallback = () => {
3790
+ terrainRemoveCallback = terrainRemoveCallback && terrainRemoveCallback();
3791
+ Object.values(tilesetRemoveCallbacks).forEach((tilesetRemoveCallback) =>
3792
+ tilesetRemoveCallback()
3793
+ );
3794
+ tilesetRemoveCallbacks = {};
3795
+ removeAddedListener();
3796
+ removeRemovedListener();
3797
+ };
3798
+
3799
+ return removeCallback;
3800
+ };
3612
3801
 
3613
3802
  function isCameraUnderground(scene) {
3614
3803
  const camera = scene.camera;
3615
3804
  const mode = scene._mode;
3616
- const globe = scene.globe;
3617
3805
  const cameraController = scene._screenSpaceCameraController;
3618
3806
  const cartographic = camera.positionCartographic;
3619
3807
 
@@ -3627,12 +3815,7 @@ function isCameraUnderground(scene) {
3627
3815
  return true;
3628
3816
  }
3629
3817
 
3630
- if (
3631
- !defined(globe) ||
3632
- !globe.show ||
3633
- mode === SceneMode.SCENE2D ||
3634
- mode === SceneMode.MORPHING
3635
- ) {
3818
+ if (mode === SceneMode.SCENE2D || mode === SceneMode.MORPHING) {
3636
3819
  return false;
3637
3820
  }
3638
3821
 
@@ -3653,7 +3836,27 @@ Scene.prototype.initializeFrame = function () {
3653
3836
 
3654
3837
  this._tweens.update();
3655
3838
 
3656
- this._globeHeight = getGlobeHeight(this);
3839
+ if (this._globeHeightDirty) {
3840
+ if (defined(this._removeUpdateHeightCallback)) {
3841
+ this._removeUpdateHeightCallback();
3842
+ this._removeUpdateHeightCallback = undefined;
3843
+ }
3844
+
3845
+ this._globeHeight = getGlobeHeight(this);
3846
+ this._globeHeightDirty = false;
3847
+
3848
+ const cartographic = this.camera.positionCartographic;
3849
+ this._removeUpdateHeightCallback = this.updateHeight(
3850
+ cartographic,
3851
+ (updatedCartographic) => {
3852
+ if (this.isDestroyed()) {
3853
+ return;
3854
+ }
3855
+
3856
+ this._globeHeight = updatedCartographic.height;
3857
+ }
3858
+ );
3859
+ }
3657
3860
  this._cameraUnderground = isCameraUnderground(this);
3658
3861
  this._globeTranslucencyState.update(this);
3659
3862
 
@@ -3740,6 +3943,7 @@ function render(scene) {
3740
3943
  }
3741
3944
  frameState.backgroundColor = backgroundColor;
3742
3945
 
3946
+ frameState.atmosphere = scene.atmosphere;
3743
3947
  scene.fog.update(frameState);
3744
3948
 
3745
3949
  us.update(frameState);
@@ -3828,8 +4032,12 @@ Scene.prototype.render = function (time) {
3828
4032
  time = JulianDate.now();
3829
4033
  }
3830
4034
 
3831
- // Determine if shouldRender
3832
4035
  const cameraChanged = this._view.checkForCameraUpdates(this);
4036
+ if (cameraChanged) {
4037
+ this._globeHeightDirty = true;
4038
+ }
4039
+
4040
+ // Determine if should render a new frame in request render mode
3833
4041
  let shouldRender =
3834
4042
  !this.requestRenderMode ||
3835
4043
  this._renderRequested ||
@@ -3963,6 +4171,59 @@ Scene.prototype.pick = function (windowPosition, width, height) {
3963
4171
  return this._picking.pick(this, windowPosition, width, height);
3964
4172
  };
3965
4173
 
4174
+ /**
4175
+ * Returns a {@link VoxelCell} for the voxel sample rendered at a particular window coordinate,
4176
+ * or undefined if no voxel is rendered at that position.
4177
+ *
4178
+ * @example
4179
+ * On left click, report the value of the "color" property at that voxel sample.
4180
+ * handler.setInputAction(function(movement) {
4181
+ * const voxelCell = scene.pickVoxel(movement.position);
4182
+ * if (defined(voxelCell)) {
4183
+ * console.log(voxelCell.getProperty("color"));
4184
+ * }
4185
+ * }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
4186
+ *
4187
+ * @param {Cartesian2} windowPosition Window coordinates to perform picking on.
4188
+ * @param {number} [width=3] Width of the pick rectangle.
4189
+ * @param {number} [height=3] Height of the pick rectangle.
4190
+ * @returns {VoxelCell|undefined} Information about the voxel cell rendered at the picked position.
4191
+ *
4192
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
4193
+ */
4194
+ Scene.prototype.pickVoxel = function (windowPosition, width, height) {
4195
+ const pickedObject = this.pick(windowPosition, width, height);
4196
+ if (!defined(pickedObject)) {
4197
+ return;
4198
+ }
4199
+ const voxelPrimitive = pickedObject.primitive;
4200
+ if (!(voxelPrimitive instanceof VoxelPrimitive)) {
4201
+ return;
4202
+ }
4203
+ const voxelCoordinate = this._picking.pickVoxelCoordinate(
4204
+ this,
4205
+ windowPosition,
4206
+ width,
4207
+ height
4208
+ );
4209
+ // Look up the keyframeNode containing this picked cell
4210
+ const tileIndex = 255 * voxelCoordinate[0] + voxelCoordinate[1];
4211
+ const keyframeNode = voxelPrimitive._traversal.findKeyframeNode(tileIndex);
4212
+ if (!defined(keyframeNode)) {
4213
+ // The tile rendered at the pick position has since been discarded by
4214
+ // a traversal update
4215
+ return;
4216
+ }
4217
+ // Look up the metadata for the picked cell
4218
+ const sampleIndex = 255 * voxelCoordinate[2] + voxelCoordinate[3];
4219
+ return VoxelCell.fromKeyframeNode(
4220
+ voxelPrimitive,
4221
+ tileIndex,
4222
+ sampleIndex,
4223
+ keyframeNode
4224
+ );
4225
+ };
4226
+
3966
4227
  /**
3967
4228
  * Returns the cartesian position reconstructed from the depth buffer and window position.
3968
4229
  * The returned position is in world coordinates. Used internally by camera functions to
@@ -4556,6 +4817,11 @@ Scene.prototype.destroy = function () {
4556
4817
  }
4557
4818
  this._removeGlobeCallbacks.length = 0;
4558
4819
 
4820
+ if (defined(this._removeUpdateHeightCallback)) {
4821
+ this._removeUpdateHeightCallback();
4822
+ this._removeUpdateHeightCallback = undefined;
4823
+ }
4824
+
4559
4825
  return destroyObject(this);
4560
4826
  };
4561
4827
  export default Scene;