@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
@@ -255,6 +255,8 @@ function ScreenSpaceCameraController(scene) {
255
255
  this._globe = undefined;
256
256
  this._ellipsoid = undefined;
257
257
 
258
+ this._lastGlobeHeight = 0.0;
259
+
258
260
  this._aggregator = new CameraEventAggregator(scene.canvas);
259
261
 
260
262
  this._lastInertiaSpinMovement = undefined;
@@ -1645,7 +1647,7 @@ function rotateCVOnTerrain(controller, startPosition, movement) {
1645
1647
  );
1646
1648
 
1647
1649
  if (controller.enableCollisionDetection) {
1648
- adjustHeightForTerrain(controller);
1650
+ adjustHeightForTerrain(controller, true);
1649
1651
  }
1650
1652
 
1651
1653
  if (!Cartesian3.equals(camera.positionWC, originalPosition)) {
@@ -2651,7 +2653,7 @@ function tilt3DOnTerrain(controller, startPosition, movement) {
2651
2653
  );
2652
2654
 
2653
2655
  if (controller.enableCollisionDetection) {
2654
- adjustHeightForTerrain(controller);
2656
+ adjustHeightForTerrain(controller, true);
2655
2657
  }
2656
2658
 
2657
2659
  if (!Cartesian3.equals(camera.positionWC, originalPosition)) {
@@ -2854,23 +2856,19 @@ function update3D(controller) {
2854
2856
  const scratchAdjustHeightTransform = new Matrix4();
2855
2857
  const scratchAdjustHeightCartographic = new Cartographic();
2856
2858
 
2857
- function adjustHeightForTerrain(controller) {
2859
+ function adjustHeightForTerrain(controller, cameraChanged) {
2858
2860
  controller._adjustedHeightForTerrain = true;
2859
2861
 
2860
2862
  const scene = controller._scene;
2861
2863
  const mode = scene.mode;
2862
2864
  const globe = scene.globe;
2863
2865
 
2864
- if (
2865
- !defined(globe) ||
2866
- mode === SceneMode.SCENE2D ||
2867
- mode === SceneMode.MORPHING
2868
- ) {
2866
+ if (mode === SceneMode.SCENE2D || mode === SceneMode.MORPHING) {
2869
2867
  return;
2870
2868
  }
2871
2869
 
2872
2870
  const camera = scene.camera;
2873
- const ellipsoid = globe.ellipsoid;
2871
+ const ellipsoid = defaultValue(globe?.ellipsoid, Ellipsoid.WGS84);
2874
2872
  const projection = scene.mapProjection;
2875
2873
 
2876
2874
  let transform;
@@ -2893,7 +2891,15 @@ function adjustHeightForTerrain(controller) {
2893
2891
  const globeHeight = controller._scene.globeHeight;
2894
2892
  if (defined(globeHeight)) {
2895
2893
  const height = globeHeight + controller.minimumZoomDistance;
2896
- if (cartographic.height < height) {
2894
+ const difference = globeHeight - controller._lastGlobeHeight;
2895
+ const percentDifference = difference / controller._lastGlobeHeight;
2896
+
2897
+ // Unless the camera has been moved by user input, to avoid big jumps during tile loads
2898
+ // only make height updates when the globe height has been fairly stable across several frames
2899
+ if (
2900
+ cartographic.height < height &&
2901
+ (cameraChanged || Math.abs(percentDifference) <= 0.1)
2902
+ ) {
2897
2903
  cartographic.height = height;
2898
2904
  if (mode === SceneMode.SCENE3D) {
2899
2905
  ellipsoid.cartographicToCartesian(cartographic, camera.position);
@@ -2902,6 +2908,12 @@ function adjustHeightForTerrain(controller) {
2902
2908
  }
2903
2909
  heightUpdated = true;
2904
2910
  }
2911
+
2912
+ if (cameraChanged || Math.abs(percentDifference) <= 0.1) {
2913
+ controller._lastGlobeHeight = globeHeight;
2914
+ } else {
2915
+ controller._lastGlobeHeight += difference * 0.1;
2916
+ }
2905
2917
  }
2906
2918
  }
2907
2919
 
@@ -3008,9 +3020,7 @@ ScreenSpaceCameraController.prototype.update = function () {
3008
3020
  const cameraChanged =
3009
3021
  !Cartesian3.equals(previousPosition, camera.positionWC) ||
3010
3022
  !Cartesian3.equals(previousDirection, camera.directionWC);
3011
- if (cameraChanged) {
3012
- adjustHeightForTerrain(this);
3013
- }
3023
+ adjustHeightForTerrain(this, cameraChanged);
3014
3024
  }
3015
3025
 
3016
3026
  this._aggregator.reset();
@@ -0,0 +1,69 @@
1
+ import { DeveloperError } from "@cesium/engine";
2
+
3
+ /**
4
+ * Constants used to indicated what part of the sensor volume to display.
5
+ *
6
+ * @enum {Number}
7
+ */
8
+ const SensorVolumePortionToDisplay = {
9
+ /**
10
+ * 0x0000. Display the complete sensor volume.
11
+ *
12
+ * @type {Number}
13
+ * @constant
14
+ */
15
+ COMPLETE: 0x0000,
16
+ /**
17
+ * 0x0001. Display the portion of the sensor volume that lies below the true horizon of the ellipsoid.
18
+ *
19
+ * @type {Number}
20
+ * @constant
21
+ */
22
+ BELOW_ELLIPSOID_HORIZON: 0x0001,
23
+ /**
24
+ * 0x0002. Display the portion of the sensor volume that lies above the true horizon of the ellipsoid.
25
+ *
26
+ * @type {Number}
27
+ * @constant
28
+ */
29
+ ABOVE_ELLIPSOID_HORIZON: 0x0002,
30
+ };
31
+
32
+ /**
33
+ * Validates that the provided value is a valid {@link SensorVolumePortionToDisplay} enumeration value.
34
+ *
35
+ * @param {SensorVolumePortionToDisplay} portionToDisplay The value to validate.
36
+ *
37
+ * @returns {Boolean} <code>true</code> if the provided value is a valid enumeration value; otherwise, <code>false</code>.
38
+ */
39
+ SensorVolumePortionToDisplay.validate = function (portionToDisplay) {
40
+ return (
41
+ portionToDisplay === SensorVolumePortionToDisplay.COMPLETE ||
42
+ portionToDisplay === SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON ||
43
+ portionToDisplay === SensorVolumePortionToDisplay.ABOVE_ELLIPSOID_HORIZON
44
+ );
45
+ };
46
+
47
+ /**
48
+ * Converts the provided value to its corresponding enumeration string.
49
+ *
50
+ * @param {SensorVolumePortionToDisplay} portionToDisplay The value to be converted to its corresponding enumeration string.
51
+ *
52
+ * @returns {String} The enumeration string corresponding to the value.
53
+ */
54
+ SensorVolumePortionToDisplay.toString = function (portionToDisplay) {
55
+ switch (portionToDisplay) {
56
+ case SensorVolumePortionToDisplay.COMPLETE:
57
+ return "COMPLETE";
58
+ case SensorVolumePortionToDisplay.BELOW_ELLIPSOID_HORIZON:
59
+ return "BELOW_ELLIPSOID_HORIZON";
60
+ case SensorVolumePortionToDisplay.ABOVE_ELLIPSOID_HORIZON:
61
+ return "ABOVE_ELLIPSOID_HORIZON";
62
+ default:
63
+ throw new DeveloperError(
64
+ "SensorVolumePortionToDisplay value is not valid and cannot be converted to a String."
65
+ );
66
+ }
67
+ };
68
+
69
+ export default SensorVolumePortionToDisplay;
@@ -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();
@@ -23,7 +23,6 @@ import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
23
23
  */
24
24
  function SpatialNode(level, x, y, z, parent, shape, voxelDimensions) {
25
25
  /**
26
- * @ignore
27
26
  * @type {SpatialNode[]}
28
27
  */
29
28
  this.children = undefined;
@@ -35,24 +34,24 @@ function SpatialNode(level, x, y, z, parent, shape, voxelDimensions) {
35
34
  this.z = z;
36
35
 
37
36
  /**
38
- * @ignore
37
+ * @type {Cartesian3}
38
+ */
39
+ this.dimensions = Cartesian3.clone(voxelDimensions);
40
+ /**
39
41
  * @type {KeyframeNode[]}
40
42
  */
41
43
  this.keyframeNodes = [];
42
44
  /**
43
- * @ignore
44
45
  * @type {KeyframeNode[]}
45
46
  */
46
47
  this.renderableKeyframeNodes = [];
47
48
 
48
49
  this.renderableKeyframeNodeLerp = 0.0;
49
50
  /**
50
- * @ignore
51
51
  * @type {KeyframeNode}
52
52
  */
53
53
  this.renderableKeyframeNodePrevious = undefined;
54
54
  /**
55
- * @ignore
56
55
  * @type {KeyframeNode}
57
56
  */
58
57
  this.renderableKeyframeNodeNext = undefined;
@@ -62,19 +61,15 @@ function SpatialNode(level, x, y, z, parent, shape, voxelDimensions) {
62
61
  this.screenSpaceError = 0.0;
63
62
  this.visitedFrameNumber = -1;
64
63
 
65
- this.computeBoundingVolumes(shape, voxelDimensions);
64
+ this.computeBoundingVolumes(shape);
66
65
  }
67
66
 
68
67
  const scratchObbHalfScale = new Cartesian3();
69
68
 
70
69
  /**
71
70
  * @param {VoxelShape} shape
72
- * @param {Cartesian3} voxelDimensions
73
71
  */
74
- SpatialNode.prototype.computeBoundingVolumes = function (
75
- shape,
76
- voxelDimensions
77
- ) {
72
+ SpatialNode.prototype.computeBoundingVolumes = function (shape) {
78
73
  this.orientedBoundingBox = shape.computeOrientedBoundingBoxForTile(
79
74
  this.level,
80
75
  this.x,
@@ -89,15 +84,14 @@ SpatialNode.prototype.computeBoundingVolumes = function (
89
84
  );
90
85
  const maximumScale = 2.0 * Cartesian3.maximumComponent(halfScale);
91
86
  this.approximateVoxelSize =
92
- maximumScale / Cartesian3.minimumComponent(voxelDimensions);
87
+ maximumScale / Cartesian3.minimumComponent(this.dimensions);
93
88
  };
94
89
 
95
90
  /**
96
91
  * @param {VoxelShape} shape The shape of the parent VoxelPrimitive
97
- * @param {Cartesian3} voxelDimensions
98
92
  * @private
99
93
  */
100
- SpatialNode.prototype.constructChildNodes = function (shape, voxelDimensions) {
94
+ SpatialNode.prototype.constructChildNodes = function (shape) {
101
95
  const { level, x, y, z } = this;
102
96
  const xMin = x * 2;
103
97
  const yMin = y * 2;
@@ -119,7 +113,7 @@ SpatialNode.prototype.constructChildNodes = function (shape, voxelDimensions) {
119
113
  ];
120
114
 
121
115
  this.children = childCoords.map(([level, x, y, z]) => {
122
- return new SpatialNode(level, x, y, z, this, shape, voxelDimensions);
116
+ return new SpatialNode(level, x, y, z, this, shape, this.dimensions);
123
117
  });
124
118
  };
125
119
 
@@ -328,7 +322,7 @@ SpatialNode.prototype.destroyKeyframeNode = function (
328
322
 
329
323
  keyframeNode.spatialNode = undefined;
330
324
  keyframeNode.state = KeyframeNode.LoadState.UNLOADED;
331
- keyframeNode.metadatas = {};
325
+ keyframeNode.metadata = {};
332
326
  keyframeNode.megatextureIndex = -1;
333
327
  keyframeNode.priority = -Number.MAX_VALUE;
334
328
  keyframeNode.highPriorityFrameNumber = -1;
@@ -345,15 +339,14 @@ SpatialNode.prototype.addKeyframeNodeToMegatextures = function (
345
339
  if (
346
340
  keyframeNode.state !== KeyframeNode.LoadState.RECEIVED ||
347
341
  keyframeNode.megatextureIndex !== -1 ||
348
- keyframeNode.metadatas.length !== megatextures.length
342
+ keyframeNode.metadata.length !== megatextures.length
349
343
  ) {
350
344
  throw new DeveloperError("Keyframe node cannot be added to megatexture");
351
345
  }
352
346
 
353
347
  for (let i = 0; i < megatextures.length; i++) {
354
348
  const megatexture = megatextures[i];
355
- keyframeNode.megatextureIndex = megatexture.add(keyframeNode.metadatas[i]);
356
- keyframeNode.metadatas[i] = undefined; // data is in megatexture so no need to hold onto it
349
+ keyframeNode.megatextureIndex = megatexture.add(keyframeNode.metadata[i]);
357
350
  }
358
351
 
359
352
  keyframeNode.state = KeyframeNode.LoadState.LOADED;
@@ -5,7 +5,7 @@ import defined from "../Core/defined.js";
5
5
  /**
6
6
  * An object containing structural metadata.
7
7
  * <p>
8
- * See the {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadatas|EXT_structural_metadata Extension} as well as the
8
+ * See the {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata|EXT_structural_metadata Extension} as well as the
9
9
  * previous {@link https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata|EXT_feature_metadata Extension} for glTF.
10
10
  * </p>
11
11
  *
@@ -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);
@@ -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
@@ -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)) {
@@ -351,6 +351,82 @@ VoxelBoxShape.prototype.computeOrientedBoundingBoxForTile = function (
351
351
  );
352
352
  };
353
353
 
354
+ const sampleSizeScratch = new Cartesian3();
355
+
356
+ /**
357
+ * Computes an oriented bounding box for a specified sample within a specified tile.
358
+ * The update function must be called before calling this function.
359
+ *
360
+ * @param {SpatialNode} spatialNode The spatial node containing the sample
361
+ * @param {Cartesian3} tileDimensions The size of the tile in number of samples, before padding
362
+ * @param {Cartesian3} tileUv The sample coordinate within the tile
363
+ * @param {OrientedBoundingBox} result The oriented bounding box that will be set to enclose the specified sample
364
+ * @returns {OrientedBoundingBox} The oriented bounding box.
365
+ */
366
+ VoxelBoxShape.prototype.computeOrientedBoundingBoxForSample = function (
367
+ spatialNode,
368
+ tileDimensions,
369
+ tileUv,
370
+ result
371
+ ) {
372
+ //>>includeStart('debug', pragmas.debug);
373
+ Check.typeOf.object("spatialNode", spatialNode);
374
+ Check.typeOf.object("tileDimensions", tileDimensions);
375
+ Check.typeOf.object("tileUv", tileUv);
376
+ Check.typeOf.object("result", result);
377
+ //>>includeEnd('debug');
378
+
379
+ const tileSizeAtLevel = 1.0 / Math.pow(2, spatialNode.level);
380
+ const sampleSize = Cartesian3.divideComponents(
381
+ Cartesian3.ONE,
382
+ tileDimensions,
383
+ sampleSizeScratch
384
+ );
385
+ const sampleSizeAtLevel = Cartesian3.multiplyByScalar(
386
+ sampleSize,
387
+ tileSizeAtLevel,
388
+ sampleSizeScratch
389
+ );
390
+
391
+ const minLerp = Cartesian3.multiplyByScalar(
392
+ Cartesian3.fromElements(
393
+ spatialNode.x + tileUv.x,
394
+ spatialNode.y + tileUv.y,
395
+ spatialNode.z + tileUv.z,
396
+ scratchTileMinBounds
397
+ ),
398
+ tileSizeAtLevel,
399
+ scratchTileMinBounds
400
+ );
401
+ const maxLerp = Cartesian3.add(
402
+ minLerp,
403
+ sampleSizeAtLevel,
404
+ scratchTileMaxBounds
405
+ );
406
+
407
+ const minBounds = this._minBounds;
408
+ const maxBounds = this._maxBounds;
409
+ const sampleMinBounds = Cartesian3.fromElements(
410
+ CesiumMath.lerp(minBounds.x, maxBounds.x, minLerp.x),
411
+ CesiumMath.lerp(minBounds.y, maxBounds.y, minLerp.y),
412
+ CesiumMath.lerp(minBounds.z, maxBounds.z, minLerp.z),
413
+ scratchTileMinBounds
414
+ );
415
+ const sampleMaxBounds = Cartesian3.fromElements(
416
+ CesiumMath.lerp(minBounds.x, maxBounds.x, maxLerp.x),
417
+ CesiumMath.lerp(minBounds.y, maxBounds.y, maxLerp.y),
418
+ CesiumMath.lerp(minBounds.z, maxBounds.z, maxLerp.z),
419
+ scratchTileMaxBounds
420
+ );
421
+
422
+ return getBoxChunkObb(
423
+ sampleMinBounds,
424
+ sampleMaxBounds,
425
+ this.shapeTransform,
426
+ result
427
+ );
428
+ };
429
+
354
430
  /**
355
431
  * Computes an approximate step size for raymarching the root tile of a voxel grid.
356
432
  * The update function must be called before calling this function.