@cesium/engine 6.1.1 → 7.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 (229) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
  2. package/Build/Workers/{chunk-FRG2Z7DE.js → chunk-2HJWSU7B.js} +4 -4
  3. package/Build/Workers/{chunk-ZTYE74E2.js → chunk-46UD5ABS.js} +4 -4
  4. package/Build/Workers/{chunk-VODWDCX6.js → chunk-4EBHOMFX.js} +18 -20
  5. package/Build/Workers/{chunk-N7TYCDTR.js → chunk-5HDYHG3F.js} +13 -13
  6. package/Build/Workers/{chunk-C53JYYKX.js → chunk-5M3U6ZMA.js} +1 -1
  7. package/Build/Workers/{chunk-GTEXWEAP.js → chunk-5WQ523AW.js} +5 -5
  8. package/Build/Workers/{chunk-SEFDWMCW.js → chunk-5YLJ77FF.js} +31 -21
  9. package/Build/Workers/{chunk-VNRUVNIK.js → chunk-6HZQPRUS.js} +1 -1
  10. package/Build/Workers/{chunk-PB7BIXHI.js → chunk-6VJVYK2V.js} +2 -2
  11. package/Build/Workers/{chunk-PHQVHDVI.js → chunk-72SANQJV.js} +325 -5
  12. package/Build/Workers/{chunk-D325WRAY.js → chunk-7XEAYGZK.js} +35 -11
  13. package/Build/Workers/{chunk-FGUP2QEP.js → chunk-AIPU2VSX.js} +6 -6
  14. package/Build/Workers/{chunk-QUXSQQEF.js → chunk-AR5DNBJ4.js} +6 -6
  15. package/Build/Workers/{chunk-ZVUAJKAL.js → chunk-BZP4T2JJ.js} +11 -13
  16. package/Build/Workers/{chunk-K6Q5IRBK.js → chunk-DTAIXKTO.js} +6 -6
  17. package/Build/Workers/{chunk-D4YHO4NZ.js → chunk-F6SE42BK.js} +133 -101
  18. package/Build/Workers/{chunk-QY2WY5XJ.js → chunk-FP6GYBFX.js} +11 -11
  19. package/Build/Workers/{chunk-Z6LPXA7S.js → chunk-GEJTYLCO.js} +5 -5
  20. package/Build/Workers/{chunk-VKTKOIYG.js → chunk-GV56Q4LU.js} +11 -11
  21. package/Build/Workers/{chunk-KUB2HQXR.js → chunk-IQBYFRVW.js} +8 -8
  22. package/Build/Workers/{chunk-235MRXLH.js → chunk-IX2JCCNM.js} +1 -1
  23. package/Build/Workers/{chunk-3FCUUN6M.js → chunk-JCNXK6EL.js} +11 -11
  24. package/Build/Workers/{chunk-364TQORK.js → chunk-JJ4VBOQ3.js} +5 -7
  25. package/Build/Workers/{chunk-66CXKODF.js → chunk-JXDC723O.js} +2 -2
  26. package/Build/Workers/{chunk-OTBRPBCC.js → chunk-JY5YEZFA.js} +9 -9
  27. package/Build/Workers/{chunk-LSGUCCKJ.js → chunk-L2ZN645J.js} +6 -6
  28. package/Build/Workers/{chunk-VLDDXYKI.js → chunk-LZ7JIV3K.js} +18 -18
  29. package/Build/Workers/{chunk-36ESDRIZ.js → chunk-LZGHD6NY.js} +16 -16
  30. package/Build/Workers/{chunk-PXLFBN2Q.js → chunk-MY3VNFGQ.js} +7 -7
  31. package/Build/Workers/{chunk-W7F5VTH6.js → chunk-NKPBIX7F.js} +1 -1
  32. package/Build/Workers/{chunk-XBZSOW3F.js → chunk-NY3K4IM3.js} +12 -12
  33. package/Build/Workers/{chunk-AI3KSNM6.js → chunk-ODW7WYM4.js} +2 -2
  34. package/Build/Workers/{chunk-6PWSSCRA.js → chunk-OVLG3FRS.js} +6 -6
  35. package/Build/Workers/{chunk-MOLGJDJV.js → chunk-PNBGBETF.js} +11 -11
  36. package/Build/Workers/{chunk-T73B27DG.js → chunk-PTQQUQC3.js} +13 -13
  37. package/Build/Workers/{chunk-RSWBNJPT.js → chunk-QZAD5O7I.js} +8 -304
  38. package/Build/Workers/{chunk-I6TVJ6T7.js → chunk-R5X4OQT4.js} +8 -8
  39. package/Build/Workers/{chunk-DTNN3ODA.js → chunk-RAEV7K66.js} +5 -5
  40. package/Build/Workers/{chunk-IZED7ODV.js → chunk-RV7ZYPFT.js} +4 -4
  41. package/Build/Workers/{chunk-7FEGZO3D.js → chunk-S4MAZ3SS.js} +2 -2
  42. package/Build/Workers/{chunk-J3U6Z5YQ.js → chunk-S6SKF6DT.js} +5 -5
  43. package/Build/Workers/{chunk-CHDJ66UM.js → chunk-U2VCRRQW.js} +6 -6
  44. package/Build/Workers/{chunk-R22RQAAM.js → chunk-UAEW6HKG.js} +13 -13
  45. package/Build/Workers/{chunk-S7IBK36I.js → chunk-UDO6BFSF.js} +14 -16
  46. package/Build/Workers/{chunk-YS4KPNLC.js → chunk-UGK3FCDY.js} +1 -1
  47. package/Build/Workers/{chunk-SJDXMQSP.js → chunk-VK3EJHWI.js} +2 -2
  48. package/Build/Workers/{chunk-HEROVJML.js → chunk-VRGFV2UO.js} +7 -7
  49. package/Build/Workers/{chunk-VOAZN4IP.js → chunk-WBQCVXR3.js} +4 -4
  50. package/Build/Workers/{chunk-HSW63JN4.js → chunk-WZU2YLWG.js} +3 -3
  51. package/Build/Workers/{chunk-4EYB62WJ.js → chunk-XWXM2O2R.js} +6 -6
  52. package/Build/Workers/{chunk-ZGMOBRTG.js → chunk-YUCVWAY6.js} +7 -7
  53. package/Build/Workers/{chunk-CLVEIRXT.js → chunk-ZK5JOS3D.js} +15 -17
  54. package/Build/Workers/{chunk-5NZTU5YL.js → chunk-ZUA2UUNV.js} +2 -2
  55. package/Build/Workers/combineGeometry.js +23 -23
  56. package/Build/Workers/createBoxGeometry.js +17 -17
  57. package/Build/Workers/createBoxOutlineGeometry.js +15 -15
  58. package/Build/Workers/createCircleGeometry.js +25 -25
  59. package/Build/Workers/createCircleOutlineGeometry.js +18 -18
  60. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
  61. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +30 -30
  62. package/Build/Workers/createCorridorGeometry.js +28 -29
  63. package/Build/Workers/createCorridorOutlineGeometry.js +27 -28
  64. package/Build/Workers/createCylinderGeometry.js +19 -19
  65. package/Build/Workers/createCylinderOutlineGeometry.js +18 -19
  66. package/Build/Workers/createEllipseGeometry.js +25 -25
  67. package/Build/Workers/createEllipseOutlineGeometry.js +18 -18
  68. package/Build/Workers/createEllipsoidGeometry.js +18 -18
  69. package/Build/Workers/createEllipsoidOutlineGeometry.js +17 -17
  70. package/Build/Workers/createFrustumGeometry.js +17 -17
  71. package/Build/Workers/createFrustumOutlineGeometry.js +17 -17
  72. package/Build/Workers/createGeometry.js +23 -23
  73. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  74. package/Build/Workers/createPlaneGeometry.js +15 -15
  75. package/Build/Workers/createPlaneOutlineGeometry.js +14 -14
  76. package/Build/Workers/createPolygonGeometry.js +32 -167
  77. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  78. package/Build/Workers/createPolylineGeometry.js +24 -24
  79. package/Build/Workers/createPolylineVolumeGeometry.js +32 -35
  80. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -29
  81. package/Build/Workers/createRectangleGeometry.js +27 -27
  82. package/Build/Workers/createRectangleOutlineGeometry.js +21 -23
  83. package/Build/Workers/createSimplePolylineGeometry.js +22 -22
  84. package/Build/Workers/createSphereGeometry.js +18 -18
  85. package/Build/Workers/createSphereOutlineGeometry.js +17 -17
  86. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  87. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  88. package/Build/Workers/createVectorTileGeometries.js +23 -23
  89. package/Build/Workers/createVectorTilePoints.js +12 -12
  90. package/Build/Workers/createVectorTilePolygons.js +21 -21
  91. package/Build/Workers/createVectorTilePolylines.js +14 -14
  92. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  93. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  94. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -19
  95. package/Build/Workers/createWallGeometry.js +23 -23
  96. package/Build/Workers/createWallOutlineGeometry.js +22 -22
  97. package/Build/Workers/decodeDraco.js +11 -11
  98. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  99. package/Build/Workers/decodeI3S.js +9 -9
  100. package/Build/Workers/transcodeKTX2.js +7 -7
  101. package/Build/Workers/transferTypedArrayTest.js +1 -1
  102. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  103. package/LICENSE.md +1 -1
  104. package/Source/Assets/approximateTerrainHeights.json +1 -1
  105. package/Source/Core/Ellipsoid.js +45 -0
  106. package/Source/Core/GregorianDate.js +85 -0
  107. package/Source/Core/HeadingPitchRange.js +2 -2
  108. package/Source/Core/Ion.js +1 -1
  109. package/Source/Core/PolygonGeometry.js +0 -169
  110. package/Source/Core/Quaternion.js +6 -2
  111. package/Source/Core/RectangleOutlineGeometry.js +2 -4
  112. package/Source/Core/RequestScheduler.js +3 -9
  113. package/Source/Core/Resource.js +30 -69
  114. package/Source/Core/TerrainEncoding.js +2 -2
  115. package/Source/Core/Transforms.js +27 -18
  116. package/Source/Core/VerticalExaggeration.js +69 -0
  117. package/Source/Core/createWorldBathymetryAsync.js +45 -0
  118. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
  119. package/Source/DataSources/Entity.js +8 -5
  120. package/Source/DataSources/EntityCollection.js +1 -2
  121. package/Source/DataSources/GeometryUpdater.js +1 -2
  122. package/Source/DataSources/GroundGeometryUpdater.js +6 -3
  123. package/Source/DataSources/ModelVisualizer.js +19 -98
  124. package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
  125. package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
  126. package/Source/DataSources/TerrainOffsetProperty.js +15 -23
  127. package/Source/Renderer/AutomaticUniforms.js +173 -0
  128. package/Source/Renderer/UniformState.js +246 -1
  129. package/Source/Scene/ArcGisMapService.js +1 -1
  130. package/Source/Scene/Atmosphere.js +127 -0
  131. package/Source/Scene/Billboard.js +29 -26
  132. package/Source/Scene/BillboardCollection.js +3 -3
  133. package/Source/Scene/Camera.js +1 -1
  134. package/Source/Scene/Cesium3DTile.js +123 -10
  135. package/Source/Scene/Cesium3DTileContent.js +14 -0
  136. package/Source/Scene/Cesium3DTileset.js +326 -45
  137. package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
  138. package/Source/Scene/Composite3DTileContent.js +42 -0
  139. package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
  140. package/Source/Scene/Empty3DTileContent.js +4 -0
  141. package/Source/Scene/Fog.js +1 -0
  142. package/Source/Scene/FrameState.js +13 -5
  143. package/Source/Scene/Geometry3DTileContent.js +4 -0
  144. package/Source/Scene/Globe.js +69 -21
  145. package/Source/Scene/GlobeSurfaceTile.js +4 -4
  146. package/Source/Scene/GlobeSurfaceTileProvider.js +24 -22
  147. package/Source/Scene/GltfLoader.js +15 -5
  148. package/Source/Scene/GroundPrimitive.js +5 -5
  149. package/Source/Scene/HeightReference.js +59 -2
  150. package/Source/Scene/ImageryLayer.js +3 -3
  151. package/Source/Scene/Implicit3DTileContent.js +4 -0
  152. package/Source/Scene/LabelCollection.js +2 -2
  153. package/Source/Scene/MapboxImageryProvider.js +2 -2
  154. package/Source/Scene/Megatexture.js +1 -1
  155. package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
  156. package/Source/Scene/Model/B3dmLoader.js +4 -0
  157. package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
  158. package/Source/Scene/Model/I3dmLoader.js +4 -0
  159. package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
  160. package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
  161. package/Source/Scene/Model/Model.js +93 -32
  162. package/Source/Scene/Model/Model3DTileContent.js +31 -0
  163. package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
  164. package/Source/Scene/Model/ModelRuntimePrimitive.js +6 -0
  165. package/Source/Scene/Model/ModelSceneGraph.js +6 -0
  166. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +60 -0
  167. package/Source/Scene/Model/pickModel.js +408 -0
  168. package/Source/Scene/Multiple3DTileContent.js +42 -0
  169. package/Source/Scene/QuadtreePrimitive.js +1 -1
  170. package/Source/Scene/Scene.js +226 -19
  171. package/Source/Scene/ScreenSpaceCameraController.js +14 -25
  172. package/Source/Scene/SkyAtmosphere.js +5 -6
  173. package/Source/Scene/Terrain.js +49 -0
  174. package/Source/Scene/TerrainFillMesh.js +2 -2
  175. package/Source/Scene/TileBoundingS2Cell.js +2 -2
  176. package/Source/Scene/TileOrientedBoundingBox.js +1 -1
  177. package/Source/Scene/Tileset3DTileContent.js +4 -0
  178. package/Source/Scene/Vector3DTileContent.js +4 -0
  179. package/Source/Scene/VoxelPrimitive.js +73 -2
  180. package/Source/Shaders/AtmosphereCommon.glsl +3 -11
  181. package/Source/Shaders/AtmosphereCommon.js +3 -11
  182. package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
  183. package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
  184. package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
  185. package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
  186. package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
  187. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
  188. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
  189. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
  190. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
  191. package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
  192. package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
  193. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
  194. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
  195. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
  196. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
  197. package/Source/Shaders/GlobeFS.glsl +16 -25
  198. package/Source/Shaders/GlobeFS.js +16 -25
  199. package/Source/Shaders/GlobeVS.glsl +4 -4
  200. package/Source/Shaders/GlobeVS.js +4 -4
  201. package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
  202. package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
  203. package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
  204. package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
  205. package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
  206. package/Source/Shaders/Model/GeometryStageFS.js +1 -1
  207. package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
  208. package/Source/Shaders/Model/GeometryStageVS.js +4 -4
  209. package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
  210. package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
  211. package/Source/Shaders/Model/ModelFS.glsl +4 -0
  212. package/Source/Shaders/Model/ModelFS.js +4 -0
  213. package/Source/Shaders/Model/ModelVS.glsl +13 -4
  214. package/Source/Shaders/Model/ModelVS.js +13 -4
  215. package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +39 -0
  216. package/Source/Shaders/Model/VerticalExaggerationStageVS.js +41 -0
  217. package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
  218. package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
  219. package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
  220. package/Source/Shaders/SkyAtmosphereFS.js +5 -10
  221. package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
  222. package/Source/Shaders/SkyAtmosphereVS.js +3 -2
  223. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  224. package/Source/ThirdParty/draco_decoder.wasm +0 -0
  225. package/index.d.ts +318 -83
  226. package/index.js +77 -62
  227. package/package.json +3 -3
  228. package/Build/Workers/chunk-7ONRI7T4.js +0 -55
  229. package/Source/Core/TerrainExaggeration.js +0 -49
@@ -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";
@@ -164,6 +167,7 @@ function Scene(options) {
164
167
  this._groundPrimitives = new PrimitiveCollection();
165
168
 
166
169
  this._globeHeight = undefined;
170
+ this._globeHeightDirty = undefined;
167
171
  this._cameraUnderground = false;
168
172
 
169
173
  this._logDepthBuffer = context.fragmentDepth;
@@ -356,6 +360,24 @@ function Scene(options) {
356
360
  */
357
361
  this.nearToFarDistance2D = 1.75e6;
358
362
 
363
+ /**
364
+ * The vertical exaggeration of the scene.
365
+ * When set to 1.0, no exaggeration is applied.
366
+ *
367
+ * @type {number}
368
+ * @default 1.0
369
+ */
370
+ this.verticalExaggeration = 1.0;
371
+
372
+ /**
373
+ * The reference height for vertical exaggeration of the scene.
374
+ * When set to 0.0, the exaggeration is applied relative to the ellipsoid surface.
375
+ *
376
+ * @type {number}
377
+ * @default 0.0
378
+ */
379
+ this.verticalExaggerationRelativeHeight = 0.0;
380
+
359
381
  /**
360
382
  * This property is for debugging only; it is not for production use.
361
383
  * <p>
@@ -494,6 +516,14 @@ function Scene(options) {
494
516
  */
495
517
  this.cameraEventWaitTime = 500.0;
496
518
 
519
+ /**
520
+ * Settings for atmosphere lighting effects affecting 3D Tiles and model rendering. This is not to be confused with
521
+ * {@link Scene#skyAtmosphere} which is responsible for rendering the sky.
522
+ *
523
+ * @type {Atmosphere}
524
+ */
525
+ this.atmosphere = new Atmosphere();
526
+
497
527
  /**
498
528
  * Blends the atmosphere to geometry far from the camera for horizon views. Allows for additional
499
529
  * performance improvements by rendering less geometry and dispatching less terrain requests.
@@ -720,6 +750,11 @@ function updateGlobeListeners(scene, globe) {
720
750
  requestRenderAfterFrame(scene)
721
751
  )
722
752
  );
753
+ removeGlobeCallbacks.push(
754
+ globe.tileLoadProgressEvent.addEventListener(() => {
755
+ scene._globeHeightDirty = true;
756
+ })
757
+ );
723
758
  }
724
759
  scene._removeGlobeCallbacks = removeGlobeCallbacks;
725
760
  }
@@ -1880,10 +1915,17 @@ Scene.prototype.updateFrameState = function () {
1880
1915
  frameState.cameraUnderground = this._cameraUnderground;
1881
1916
  frameState.globeTranslucencyState = this._globeTranslucencyState;
1882
1917
 
1883
- if (defined(this.globe)) {
1884
- frameState.terrainExaggeration = this.globe.terrainExaggeration;
1885
- frameState.terrainExaggerationRelativeHeight = this.globe.terrainExaggerationRelativeHeight;
1918
+ const { globe } = this;
1919
+ if (defined(globe) && globe._terrainExaggerationChanged) {
1920
+ // Honor a user-set value for the old deprecated globe.terrainExaggeration.
1921
+ // This can be removed when Globe.terrainExaggeration is removed.
1922
+ this.verticalExaggeration = globe._terrainExaggeration;
1923
+ this.verticalExaggerationRelativeHeight =
1924
+ globe._terrainExaggerationRelativeHeight;
1925
+ globe._terrainExaggerationChanged = false;
1886
1926
  }
1927
+ frameState.verticalExaggeration = this.verticalExaggeration;
1928
+ frameState.verticalExaggerationRelativeHeight = this.verticalExaggerationRelativeHeight;
1887
1929
 
1888
1930
  if (
1889
1931
  defined(this._specularEnvironmentMapAtlas) &&
@@ -3142,6 +3184,7 @@ Scene.prototype.updateEnvironment = function () {
3142
3184
  const environmentState = this._environmentState;
3143
3185
  const renderPass = frameState.passes.render;
3144
3186
  const offscreenPass = frameState.passes.offscreen;
3187
+ const atmosphere = this.atmosphere;
3145
3188
  const skyAtmosphere = this.skyAtmosphere;
3146
3189
  const globe = this.globe;
3147
3190
  const globeTranslucencyState = this._globeTranslucencyState;
@@ -3160,17 +3203,19 @@ Scene.prototype.updateEnvironment = function () {
3160
3203
  } else {
3161
3204
  if (defined(skyAtmosphere)) {
3162
3205
  if (defined(globe)) {
3163
- skyAtmosphere.setDynamicAtmosphereColor(
3164
- globe.enableLighting && globe.dynamicAtmosphereLighting,
3165
- globe.dynamicAtmosphereLightingFromSun
3206
+ skyAtmosphere.setDynamicLighting(
3207
+ DynamicAtmosphereLightingType.fromGlobeFlags(globe)
3166
3208
  );
3167
3209
  environmentState.isReadyForAtmosphere =
3168
3210
  environmentState.isReadyForAtmosphere ||
3169
3211
  !globe.show ||
3170
3212
  globe._surface._tilesToRender.length > 0;
3171
3213
  } else {
3214
+ const dynamicLighting = atmosphere.dynamicLighting;
3215
+ skyAtmosphere.setDynamicLighting(dynamicLighting);
3172
3216
  environmentState.isReadyForAtmosphere = true;
3173
3217
  }
3218
+
3174
3219
  environmentState.skyAtmosphereCommand = skyAtmosphere.update(
3175
3220
  frameState,
3176
3221
  globe
@@ -3576,19 +3621,178 @@ function callAfterRenderFunctions(scene) {
3576
3621
  }
3577
3622
 
3578
3623
  function getGlobeHeight(scene) {
3579
- const globe = scene._globe;
3624
+ if (scene.mode === SceneMode.MORPHING) {
3625
+ return;
3626
+ }
3627
+
3580
3628
  const camera = scene.camera;
3581
3629
  const cartographic = camera.positionCartographic;
3582
- if (defined(globe) && globe.show && defined(cartographic)) {
3583
- return globe.getHeight(cartographic);
3630
+ return scene.getHeight(cartographic);
3631
+ }
3632
+
3633
+ /**
3634
+ * Gets the height of the loaded surface at the cartographic position.
3635
+ * @param {Cartographic} cartographic The cartographic position.
3636
+ * @param {HeightReference} [heightReference=CLAMP_TO_GROUND] Based on the height reference value, determines whether to ignore heights from 3D Tiles or terrain.
3637
+ * @private
3638
+ */
3639
+ Scene.prototype.getHeight = function (cartographic, heightReference) {
3640
+ if (!defined(cartographic)) {
3641
+ return undefined;
3642
+ }
3643
+
3644
+ const ignore3dTiles =
3645
+ heightReference === HeightReference.CLAMP_TO_TERRAIN ||
3646
+ heightReference === HeightReference.RELATIVE_TO_TERRAIN;
3647
+
3648
+ const ignoreTerrain =
3649
+ heightReference === HeightReference.CLAMP_TO_3D_TILE ||
3650
+ heightReference === HeightReference.RELATIVE_TO_3D_TILE;
3651
+
3652
+ if (!defined(cartographic)) {
3653
+ return;
3654
+ }
3655
+
3656
+ let maxHeight = Number.NEGATIVE_INFINITY;
3657
+
3658
+ if (!ignore3dTiles) {
3659
+ const length = this.primitives.length;
3660
+ for (let i = 0; i < length; ++i) {
3661
+ const primitive = this.primitives.get(i);
3662
+ if (
3663
+ !primitive.isCesium3DTileset ||
3664
+ !primitive.show ||
3665
+ primitive.disableCollision
3666
+ ) {
3667
+ continue;
3668
+ }
3669
+
3670
+ const result = primitive.getHeight(cartographic, this);
3671
+ if (defined(result) && result > maxHeight) {
3672
+ maxHeight = result;
3673
+ }
3674
+ }
3584
3675
  }
3676
+
3677
+ const globe = this._globe;
3678
+ if (!ignoreTerrain && defined(globe) && globe.show) {
3679
+ const result = globe.getHeight(cartographic);
3680
+ if (result > maxHeight) {
3681
+ maxHeight = result;
3682
+ }
3683
+ }
3684
+
3685
+ if (maxHeight > Number.NEGATIVE_INFINITY) {
3686
+ return maxHeight;
3687
+ }
3688
+
3585
3689
  return undefined;
3586
- }
3690
+ };
3691
+
3692
+ const updateHeightScratchCartographic = new Cartographic();
3693
+ /**
3694
+ * Calls the callback when a new tile is rendered that contains the given cartographic. The only parameter
3695
+ * is the cartesian position on the tile.
3696
+ *
3697
+ * @private
3698
+ *
3699
+ * @param {Cartographic} cartographic The cartographic position.
3700
+ * @param {Function} callback The function to be called when a new tile is loaded containing the updated cartographic.
3701
+ * @param {HeightReference} [heightReference=CLAMP_TO_GROUND] Based on the height reference value, determines whether to ignore heights from 3D Tiles or terrain.
3702
+ * @returns {Function} The function to remove this callback from the quadtree.
3703
+ */
3704
+ Scene.prototype.updateHeight = function (
3705
+ cartographic,
3706
+ callback,
3707
+ heightReference
3708
+ ) {
3709
+ //>>includeStart('debug', pragmas.debug);
3710
+ Check.typeOf.func("callback", callback);
3711
+ //>>includeEnd('debug');
3712
+
3713
+ const callbackWrapper = () => {
3714
+ Cartographic.clone(cartographic, updateHeightScratchCartographic);
3715
+
3716
+ const height = this.getHeight(cartographic, heightReference);
3717
+ if (defined(height)) {
3718
+ updateHeightScratchCartographic.height = height;
3719
+ callback(updateHeightScratchCartographic);
3720
+ }
3721
+ };
3722
+
3723
+ const ignore3dTiles =
3724
+ heightReference === HeightReference.CLAMP_TO_TERRAIN ||
3725
+ heightReference === HeightReference.RELATIVE_TO_TERRAIN;
3726
+
3727
+ const ignoreTerrain =
3728
+ heightReference === HeightReference.CLAMP_TO_3D_TILE ||
3729
+ heightReference === HeightReference.RELATIVE_TO_3D_TILE;
3730
+
3731
+ let terrainRemoveCallback;
3732
+ if (!ignoreTerrain && defined(this.globe)) {
3733
+ terrainRemoveCallback = this.globe._surface.updateHeight(
3734
+ cartographic,
3735
+ callbackWrapper
3736
+ );
3737
+ }
3738
+
3739
+ let tilesetRemoveCallbacks = {};
3740
+ const ellipsoid = this.globe?.ellipsoid;
3741
+ const createPrimitiveEventListener = (primitive) => {
3742
+ if (
3743
+ ignore3dTiles ||
3744
+ !primitive.isCesium3DTileset ||
3745
+ primitive.disableCollision
3746
+ ) {
3747
+ return;
3748
+ }
3749
+
3750
+ const tilesetRemoveCallback = primitive.updateHeight(
3751
+ cartographic,
3752
+ callbackWrapper,
3753
+ ellipsoid
3754
+ );
3755
+ tilesetRemoveCallbacks[primitive.id] = tilesetRemoveCallback;
3756
+ };
3757
+
3758
+ if (!ignore3dTiles) {
3759
+ const length = this.primitives.length;
3760
+ for (let i = 0; i < length; ++i) {
3761
+ const primitive = this.primitives.get(i);
3762
+ createPrimitiveEventListener(primitive);
3763
+ }
3764
+ }
3765
+
3766
+ const removeAddedListener = this.primitives.primitiveAdded.addEventListener(
3767
+ createPrimitiveEventListener
3768
+ );
3769
+ const removeRemovedListener = this.primitives.primitiveRemoved.addEventListener(
3770
+ (primitive) => {
3771
+ if (!primitive.isCesium3DTileset) {
3772
+ return;
3773
+ }
3774
+
3775
+ tilesetRemoveCallbacks[primitive.id]();
3776
+ delete tilesetRemoveCallbacks[primitive.id];
3777
+ }
3778
+ );
3779
+
3780
+ const removeCallback = () => {
3781
+ terrainRemoveCallback = terrainRemoveCallback && terrainRemoveCallback();
3782
+ Object.values(tilesetRemoveCallbacks).forEach((tilesetRemoveCallback) =>
3783
+ tilesetRemoveCallback()
3784
+ );
3785
+ tilesetRemoveCallbacks = {};
3786
+ removeAddedListener();
3787
+ removeRemovedListener();
3788
+ };
3789
+
3790
+ return removeCallback;
3791
+ };
3587
3792
 
3588
3793
  function isCameraUnderground(scene) {
3589
3794
  const camera = scene.camera;
3590
3795
  const mode = scene._mode;
3591
- const globe = scene.globe;
3592
3796
  const cameraController = scene._screenSpaceCameraController;
3593
3797
  const cartographic = camera.positionCartographic;
3594
3798
 
@@ -3602,12 +3806,7 @@ function isCameraUnderground(scene) {
3602
3806
  return true;
3603
3807
  }
3604
3808
 
3605
- if (
3606
- !defined(globe) ||
3607
- !globe.show ||
3608
- mode === SceneMode.SCENE2D ||
3609
- mode === SceneMode.MORPHING
3610
- ) {
3809
+ if (mode === SceneMode.SCENE2D || mode === SceneMode.MORPHING) {
3611
3810
  return false;
3612
3811
  }
3613
3812
 
@@ -3628,7 +3827,10 @@ Scene.prototype.initializeFrame = function () {
3628
3827
 
3629
3828
  this._tweens.update();
3630
3829
 
3631
- this._globeHeight = getGlobeHeight(this);
3830
+ if (this._globeHeightDirty) {
3831
+ this._globeHeight = getGlobeHeight(this);
3832
+ this._globeHeightDirty = false;
3833
+ }
3632
3834
  this._cameraUnderground = isCameraUnderground(this);
3633
3835
  this._globeTranslucencyState.update(this);
3634
3836
 
@@ -3715,6 +3917,7 @@ function render(scene) {
3715
3917
  }
3716
3918
  frameState.backgroundColor = backgroundColor;
3717
3919
 
3920
+ frameState.atmosphere = scene.atmosphere;
3718
3921
  scene.fog.update(frameState);
3719
3922
 
3720
3923
  us.update(frameState);
@@ -3803,8 +4006,12 @@ Scene.prototype.render = function (time) {
3803
4006
  time = JulianDate.now();
3804
4007
  }
3805
4008
 
3806
- // Determine if shouldRender
3807
4009
  const cameraChanged = this._view.checkForCameraUpdates(this);
4010
+ if (cameraChanged) {
4011
+ this._globeHeightDirty = true;
4012
+ }
4013
+
4014
+ // Determine if should render a new frame in request render mode
3808
4015
  let shouldRender =
3809
4016
  !this.requestRenderMode ||
3810
4017
  this._renderRequested ||
@@ -17,7 +17,7 @@ import OrthographicFrustum from "../Core/OrthographicFrustum.js";
17
17
  import Plane from "../Core/Plane.js";
18
18
  import Quaternion from "../Core/Quaternion.js";
19
19
  import Ray from "../Core/Ray.js";
20
- import TerrainExaggeration from "../Core/TerrainExaggeration.js";
20
+ import VerticalExaggeration from "../Core/VerticalExaggeration.js";
21
21
  import Transforms from "../Core/Transforms.js";
22
22
  import CameraEventAggregator from "./CameraEventAggregator.js";
23
23
  import CameraEventType from "./CameraEventType.js";
@@ -2861,16 +2861,12 @@ function adjustHeightForTerrain(controller) {
2861
2861
  const mode = scene.mode;
2862
2862
  const globe = scene.globe;
2863
2863
 
2864
- if (
2865
- !defined(globe) ||
2866
- mode === SceneMode.SCENE2D ||
2867
- mode === SceneMode.MORPHING
2868
- ) {
2864
+ if (mode === SceneMode.SCENE2D || mode === SceneMode.MORPHING) {
2869
2865
  return;
2870
2866
  }
2871
2867
 
2872
2868
  const camera = scene.camera;
2873
- const ellipsoid = globe.ellipsoid;
2869
+ const ellipsoid = defaultValue(globe?.ellipsoid, Ellipsoid.WGS84);
2874
2870
  const projection = scene.mapProjection;
2875
2871
 
2876
2872
  let transform;
@@ -2948,9 +2944,7 @@ const scratchPreviousDirection = new Cartesian3();
2948
2944
  */
2949
2945
  ScreenSpaceCameraController.prototype.update = function () {
2950
2946
  const scene = this._scene;
2951
- const camera = scene.camera;
2952
- const globe = scene.globe;
2953
- const mode = scene.mode;
2947
+ const { camera, globe, mode } = scene;
2954
2948
 
2955
2949
  if (!Matrix4.equals(camera.transform, Matrix4.IDENTITY)) {
2956
2950
  this._globe = undefined;
@@ -2962,26 +2956,21 @@ ScreenSpaceCameraController.prototype.update = function () {
2962
2956
  : scene.mapProjection.ellipsoid;
2963
2957
  }
2964
2958
 
2965
- const exaggeration = defined(this._globe)
2966
- ? this._globe.terrainExaggeration
2967
- : 1.0;
2968
- const exaggerationRelativeHeight = defined(this._globe)
2969
- ? this._globe.terrainExaggerationRelativeHeight
2970
- : 0.0;
2971
- this._minimumCollisionTerrainHeight = TerrainExaggeration.getHeight(
2959
+ const { verticalExaggeration, verticalExaggerationRelativeHeight } = scene;
2960
+ this._minimumCollisionTerrainHeight = VerticalExaggeration.getHeight(
2972
2961
  this.minimumCollisionTerrainHeight,
2973
- exaggeration,
2974
- exaggerationRelativeHeight
2962
+ verticalExaggeration,
2963
+ verticalExaggerationRelativeHeight
2975
2964
  );
2976
- this._minimumPickingTerrainHeight = TerrainExaggeration.getHeight(
2965
+ this._minimumPickingTerrainHeight = VerticalExaggeration.getHeight(
2977
2966
  this.minimumPickingTerrainHeight,
2978
- exaggeration,
2979
- exaggerationRelativeHeight
2967
+ verticalExaggeration,
2968
+ verticalExaggerationRelativeHeight
2980
2969
  );
2981
- this._minimumTrackBallHeight = TerrainExaggeration.getHeight(
2970
+ this._minimumTrackBallHeight = VerticalExaggeration.getHeight(
2982
2971
  this.minimumTrackBallHeight,
2983
- exaggeration,
2984
- exaggerationRelativeHeight
2972
+ verticalExaggeration,
2973
+ verticalExaggerationRelativeHeight
2985
2974
  );
2986
2975
 
2987
2976
  this._cameraUnderground = scene.cameraUnderground && defined(this._globe);
@@ -217,14 +217,13 @@ Object.defineProperties(SkyAtmosphere.prototype, {
217
217
  });
218
218
 
219
219
  /**
220
+ * Set the dynamic lighting enum value for the shader
221
+ * @param {DynamicAtmosphereLightingType} lightingEnum The enum that determines the dynamic atmosphere light source
222
+ *
220
223
  * @private
221
224
  */
222
- SkyAtmosphere.prototype.setDynamicAtmosphereColor = function (
223
- enableLighting,
224
- useSunDirection
225
- ) {
226
- const lightEnum = enableLighting ? (useSunDirection ? 2.0 : 1.0) : 0.0;
227
- this._radiiAndDynamicAtmosphereColor.z = lightEnum;
225
+ SkyAtmosphere.prototype.setDynamicLighting = function (lightingEnum) {
226
+ this._radiiAndDynamicAtmosphereColor.z = lightingEnum;
228
227
  };
229
228
 
230
229
  const scratchModelMatrix = new Matrix4();
@@ -1,5 +1,6 @@
1
1
  import Check from "../Core/Check.js";
2
2
  import Event from "../Core/Event.js";
3
+ import createWorldBathymetryAsync from "../Core/createWorldBathymetryAsync.js";
3
4
  import createWorldTerrainAsync from "../Core/createWorldTerrainAsync.js";
4
5
 
5
6
  /**
@@ -156,6 +157,54 @@ Terrain.fromWorldTerrain = function (options) {
156
157
  return new Terrain(createWorldTerrainAsync(options));
157
158
  };
158
159
 
160
+ /**
161
+ * Creates a {@link Terrain} instance for {@link https://cesium.com/content/#cesium-world-bathymetry|Cesium World Bathymetry}.
162
+ *
163
+ * @function
164
+ *
165
+ * @param {Object} [options] Object with the following properties:
166
+ * @param {Boolean} [options.requestVertexNormals=false] Flag that indicates if the client should request additional lighting information from the server if available.
167
+ * @returns {Terrain} An asynchronous helper object for a CesiumTerrainProvider
168
+ *
169
+ * @see Ion
170
+ * @see createWorldBathymetryAsync
171
+ *
172
+ * @example
173
+ * // Create Cesium World Bathymetry with default settings
174
+ * const viewer = new Cesium.Viewer("cesiumContainer", {
175
+ * terrain: Cesium.Terrain.fromWorldBathymetry)
176
+ * });
177
+ *
178
+ * @example
179
+ * // Create Cesium World Terrain with normals.
180
+ * const viewer1 = new Cesium.Viewer("cesiumContainer", {
181
+ * terrain: Cesium.Terrain.fromWorldBathymetry({
182
+ * requestVertexNormals: true
183
+ * });
184
+ * });
185
+ *
186
+ * @example
187
+ * // Handle loading events
188
+ * const bathymetry = Cesium.Terrain.fromWorldBathymetry();
189
+ *
190
+ * scene.setTerrain(bathymetry);
191
+ *
192
+ * bathymetry.readyEvent.addEventListener(provider => {
193
+ * scene.globe.enableLighting = true;
194
+ *
195
+ * bathymetry.provider.errorEvent.addEventListener(error => {
196
+ * alert(`Encountered an error while loading bathymetric terrain tiles! ${error}`);
197
+ * });
198
+ * });
199
+ *
200
+ * bathymetry.errorEvent.addEventListener(error => {
201
+ * alert(`Encountered an error while creating bathymetric terrain! ${error}`);
202
+ * });
203
+ */
204
+ Terrain.fromWorldBathymetry = function (options) {
205
+ return new Terrain(createWorldBathymetryAsync(options));
206
+ };
207
+
159
208
  function handleError(errorEvent, error) {
160
209
  if (errorEvent.numberOfListeners > 0) {
161
210
  errorEvent.raiseEvent(error);
@@ -830,9 +830,9 @@ function createFillMesh(tileProvider, frameState, tile, vertexArraysToDestroy) {
830
830
  const fill = surfaceTile.fill;
831
831
  const rectangle = tile.rectangle;
832
832
 
833
- const exaggeration = frameState.terrainExaggeration;
833
+ const exaggeration = frameState.verticalExaggeration;
834
834
  const exaggerationRelativeHeight =
835
- frameState.terrainExaggerationRelativeHeight;
835
+ frameState.verticalExaggerationRelativeHeight;
836
836
  const hasExaggeration = exaggeration !== 1.0;
837
837
 
838
838
  const ellipsoid = tile.tilingScheme.ellipsoid;
@@ -330,7 +330,7 @@ Object.defineProperties(TileBoundingS2Cell.prototype, {
330
330
  /**
331
331
  * The underlying bounding volume.
332
332
  *
333
- * @memberof TileOrientedBoundingBox.prototype
333
+ * @memberof TileBoundingS2Cell.prototype
334
334
  *
335
335
  * @type {object}
336
336
  * @readonly
@@ -343,7 +343,7 @@ Object.defineProperties(TileBoundingS2Cell.prototype, {
343
343
  /**
344
344
  * The underlying bounding sphere.
345
345
  *
346
- * @memberof TileOrientedBoundingBox.prototype
346
+ * @memberof TileBoundingS2Cell.prototype
347
347
  *
348
348
  * @type {BoundingSphere}
349
349
  * @readonly
@@ -106,7 +106,7 @@ Object.defineProperties(TileOrientedBoundingBox.prototype, {
106
106
  *
107
107
  * @memberof TileOrientedBoundingBox.prototype
108
108
  *
109
- * @type {object}
109
+ * @type {OrientedBoundingBox}
110
110
  * @readonly
111
111
  */
112
112
  boundingVolume: {
@@ -168,6 +168,10 @@ Tileset3DTileContent.prototype.applyStyle = function (style) {};
168
168
 
169
169
  Tileset3DTileContent.prototype.update = function (tileset, frameState) {};
170
170
 
171
+ Tileset3DTileContent.prototype.pick = function (ray, frameState, result) {
172
+ return undefined;
173
+ };
174
+
171
175
  Tileset3DTileContent.prototype.isDestroyed = function () {
172
176
  return false;
173
177
  };
@@ -727,6 +727,10 @@ Vector3DTileContent.prototype.update = function (tileset, frameState) {
727
727
  }
728
728
  };
729
729
 
730
+ Vector3DTileContent.prototype.pick = function (ray, frameState, result) {
731
+ return undefined;
732
+ };
733
+
730
734
  Vector3DTileContent.prototype.getPolylinePositions = function (batchId) {
731
735
  const polylines = this._polylines;
732
736
  if (!defined(polylines)) {