@cesium/engine 6.1.1 → 6.2.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 (138) hide show
  1. package/Build/Workers/{chunk-RSWBNJPT.js → chunk-3PW6ZBN4.js} +8 -304
  2. package/Build/Workers/{chunk-PB7BIXHI.js → chunk-434ZTTFX.js} +2 -2
  3. package/Build/Workers/{chunk-HSW63JN4.js → chunk-4KP73B43.js} +3 -3
  4. package/Build/Workers/{chunk-36ESDRIZ.js → chunk-52VSIKEA.js} +16 -16
  5. package/Build/Workers/{chunk-VLDDXYKI.js → chunk-5GDBZTHX.js} +18 -18
  6. package/Build/Workers/{chunk-7FEGZO3D.js → chunk-5HLGKKG3.js} +2 -2
  7. package/Build/Workers/{chunk-HEROVJML.js → chunk-5IRLXUTA.js} +7 -7
  8. package/Build/Workers/{chunk-I6TVJ6T7.js → chunk-5SK36PU4.js} +8 -8
  9. package/Build/Workers/{chunk-Z6LPXA7S.js → chunk-ARPTYYKS.js} +5 -5
  10. package/Build/Workers/{chunk-7ONRI7T4.js → chunk-ATB2I7OS.js} +4 -4
  11. package/Build/Workers/{chunk-XBZSOW3F.js → chunk-AXFRNOVC.js} +12 -12
  12. package/Build/Workers/{chunk-IZED7ODV.js → chunk-BP467WX3.js} +4 -4
  13. package/Build/Workers/{chunk-ZVUAJKAL.js → chunk-BUZDZBUH.js} +11 -13
  14. package/Build/Workers/{chunk-N7TYCDTR.js → chunk-CDGHUKQ4.js} +13 -13
  15. package/Build/Workers/{chunk-CLVEIRXT.js → chunk-CSIZ3BGT.js} +15 -17
  16. package/Build/Workers/{chunk-C53JYYKX.js → chunk-CWJQGBWT.js} +1 -1
  17. package/Build/Workers/{chunk-DTNN3ODA.js → chunk-DMCSY5BU.js} +5 -5
  18. package/Build/Workers/{chunk-T73B27DG.js → chunk-DR5XZ6K5.js} +13 -13
  19. package/Build/Workers/{chunk-ZGMOBRTG.js → chunk-FWGNCYP6.js} +7 -7
  20. package/Build/Workers/{chunk-LSGUCCKJ.js → chunk-GF5TNNKP.js} +6 -6
  21. package/Build/Workers/{chunk-VODWDCX6.js → chunk-GVL5I7TC.js} +18 -20
  22. package/Build/Workers/{chunk-3FCUUN6M.js → chunk-H5DUXHCV.js} +11 -11
  23. package/Build/Workers/{chunk-S7IBK36I.js → chunk-HFKSAB5K.js} +14 -16
  24. package/Build/Workers/{chunk-D4YHO4NZ.js → chunk-HOT2SNXP.js} +15 -20
  25. package/Build/Workers/{chunk-5NZTU5YL.js → chunk-HPH5HSFE.js} +2 -2
  26. package/Build/Workers/{chunk-KUB2HQXR.js → chunk-HPP4JLNH.js} +8 -8
  27. package/Build/Workers/{chunk-CHDJ66UM.js → chunk-HUPNRBWW.js} +6 -6
  28. package/Build/Workers/{chunk-VOAZN4IP.js → chunk-JGG36SQV.js} +4 -4
  29. package/Build/Workers/{chunk-PHQVHDVI.js → chunk-LGJUI2CE.js} +325 -5
  30. package/Build/Workers/{chunk-4EYB62WJ.js → chunk-LGL4P5KL.js} +6 -6
  31. package/Build/Workers/{chunk-J3U6Z5YQ.js → chunk-LX6XV4DK.js} +5 -5
  32. package/Build/Workers/{chunk-W7F5VTH6.js → chunk-MN34FIF5.js} +1 -1
  33. package/Build/Workers/{chunk-AI3KSNM6.js → chunk-MW3CJYLX.js} +2 -2
  34. package/Build/Workers/{chunk-SEFDWMCW.js → chunk-NE4JNU6H.js} +31 -21
  35. package/Build/Workers/{chunk-235MRXLH.js → chunk-O43GWBSF.js} +1 -1
  36. package/Build/Workers/{chunk-SJDXMQSP.js → chunk-PIXK6KHB.js} +2 -2
  37. package/Build/Workers/{chunk-QUXSQQEF.js → chunk-PZ2WJWUG.js} +6 -6
  38. package/Build/Workers/{chunk-FRG2Z7DE.js → chunk-QRBRVGZC.js} +4 -4
  39. package/Build/Workers/{chunk-D325WRAY.js → chunk-QTZQZY2C.js} +9 -9
  40. package/Build/Workers/{chunk-OTBRPBCC.js → chunk-R3HUGXBH.js} +9 -9
  41. package/Build/Workers/{chunk-6PWSSCRA.js → chunk-R4OZKBXH.js} +6 -6
  42. package/Build/Workers/{chunk-PXLFBN2Q.js → chunk-RH4N2ONY.js} +7 -7
  43. package/Build/Workers/{chunk-66CXKODF.js → chunk-RIDPF7PO.js} +2 -2
  44. package/Build/Workers/{chunk-R22RQAAM.js → chunk-SNN7WOC2.js} +13 -13
  45. package/Build/Workers/{chunk-364TQORK.js → chunk-SQVTYRZY.js} +5 -7
  46. package/Build/Workers/{chunk-VNRUVNIK.js → chunk-SV7DDPAC.js} +1 -1
  47. package/Build/Workers/{chunk-QY2WY5XJ.js → chunk-TIXXVKUY.js} +11 -11
  48. package/Build/Workers/{chunk-MOLGJDJV.js → chunk-TMPVBFJQ.js} +11 -11
  49. package/Build/Workers/{chunk-VKTKOIYG.js → chunk-XUTVA4K5.js} +11 -11
  50. package/Build/Workers/{chunk-GTEXWEAP.js → chunk-Y4OJ4B23.js} +5 -5
  51. package/Build/Workers/{chunk-YS4KPNLC.js → chunk-YBKFS53K.js} +1 -1
  52. package/Build/Workers/{chunk-K6Q5IRBK.js → chunk-Z2SIPUKB.js} +6 -6
  53. package/Build/Workers/{chunk-FGUP2QEP.js → chunk-Z4JUBRHP.js} +6 -6
  54. package/Build/Workers/{chunk-ZTYE74E2.js → chunk-ZQRZBHYI.js} +4 -4
  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 +29 -29
  63. package/Build/Workers/createCorridorOutlineGeometry.js +28 -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 +34 -34
  77. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  78. package/Build/Workers/createPolylineGeometry.js +24 -24
  79. package/Build/Workers/createPolylineVolumeGeometry.js +32 -33
  80. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +28 -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/Source/Core/Ellipsoid.js +45 -0
  104. package/Source/Core/Ion.js +1 -1
  105. package/Source/Core/Quaternion.js +6 -2
  106. package/Source/Core/RectangleOutlineGeometry.js +2 -4
  107. package/Source/Core/RequestScheduler.js +3 -9
  108. package/Source/Core/TerrainEncoding.js +2 -2
  109. package/Source/Core/VerticalExaggeration.js +69 -0
  110. package/Source/Renderer/AutomaticUniforms.js +53 -0
  111. package/Source/Renderer/UniformState.js +119 -1
  112. package/Source/Scene/Cesium3DTile.js +122 -10
  113. package/Source/Scene/FrameState.js +4 -4
  114. package/Source/Scene/Globe.js +66 -19
  115. package/Source/Scene/GlobeSurfaceTile.js +4 -4
  116. package/Source/Scene/GlobeSurfaceTileProvider.js +21 -21
  117. package/Source/Scene/GroundPrimitive.js +5 -5
  118. package/Source/Scene/ImageryLayer.js +3 -3
  119. package/Source/Scene/MapboxImageryProvider.js +2 -2
  120. package/Source/Scene/Megatexture.js +1 -1
  121. package/Source/Scene/Model/Model.js +11 -0
  122. package/Source/Scene/Model/ModelRuntimePrimitive.js +6 -0
  123. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +60 -0
  124. package/Source/Scene/Scene.js +28 -3
  125. package/Source/Scene/ScreenSpaceCameraController.js +12 -19
  126. package/Source/Scene/TerrainFillMesh.js +2 -2
  127. package/Source/Scene/TileOrientedBoundingBox.js +1 -1
  128. package/Source/Scene/VoxelPrimitive.js +73 -2
  129. package/Source/Shaders/GlobeVS.glsl +3 -3
  130. package/Source/Shaders/GlobeVS.js +3 -3
  131. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  132. package/Source/Shaders/Model/ModelVS.js +4 -0
  133. package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +39 -0
  134. package/Source/Shaders/Model/VerticalExaggerationStageVS.js +41 -0
  135. package/index.d.ts +35 -18
  136. package/index.js +199 -197
  137. package/package.json +1 -1
  138. package/Source/Core/TerrainExaggeration.js +0 -49
@@ -939,6 +939,59 @@ const AutomaticUniforms = {
939
939
  },
940
940
  }),
941
941
 
942
+ /**
943
+ * An automatic GLSL uniform containing the ellipsoid surface normal
944
+ * at the position below the eye (camera), in eye coordinates.
945
+ * This uniform is only valid when the {@link SceneMode} is <code>SCENE3D</code>.
946
+ */
947
+ czm_eyeEllipsoidNormalEC: new AutomaticUniform({
948
+ size: 1,
949
+ datatype: WebGLConstants.FLOAT_VEC3,
950
+ getValue: function (uniformState) {
951
+ return uniformState.eyeEllipsoidNormalEC;
952
+ },
953
+ }),
954
+
955
+ /**
956
+ * An automatic GLSL uniform containing the ellipsoid radii of curvature at the camera position.
957
+ * The .x component is the prime vertical radius, .y is the meridional.
958
+ * This uniform is only valid when the {@link SceneMode} is <code>SCENE3D</code>.
959
+ */
960
+ czm_eyeEllipsoidCurvature: new AutomaticUniform({
961
+ size: 1,
962
+ datatype: WebGLConstants.FLOAT_VEC2,
963
+ getValue: function (uniformState) {
964
+ return uniformState.eyeEllipsoidCurvature;
965
+ },
966
+ }),
967
+
968
+ /**
969
+ * An automatic GLSL uniform containing the transform from model coordinates
970
+ * to an east-north-up coordinate system centered at the position on the
971
+ * ellipsoid below the camera.
972
+ * This uniform is only valid when the {@link SceneMode} is <code>SCENE3D</code>.
973
+ */
974
+ czm_modelToEnu: new AutomaticUniform({
975
+ size: 1,
976
+ datatype: WebGLConstants.FLOAT_MAT4,
977
+ getValue: function (uniformState) {
978
+ return uniformState.modelToEnu;
979
+ },
980
+ }),
981
+
982
+ /**
983
+ * An automatic GLSL uniform containing the the inverse of
984
+ * {@link AutomaticUniforms.czm_modelToEnu}.
985
+ * This uniform is only valid when the {@link SceneMode} is <code>SCENE3D</code>.
986
+ */
987
+ czm_enuToModel: new AutomaticUniform({
988
+ size: 1,
989
+ datatype: WebGLConstants.FLOAT_MAT4,
990
+ getValue: function (uniformState) {
991
+ return uniformState.enuToModel;
992
+ },
993
+ }),
994
+
942
995
  /**
943
996
  * An automatic GLSL uniform containing the near distance (<code>x</code>) and the far distance (<code>y</code>)
944
997
  * of the frustum defined by the camera. This is the largest possible frustum, not an individual
@@ -144,6 +144,10 @@ function UniformState() {
144
144
  this._frustum2DWidth = 0.0;
145
145
  this._eyeHeight = 0.0;
146
146
  this._eyeHeight2D = new Cartesian2();
147
+ this._eyeEllipsoidNormalEC = new Cartesian3();
148
+ this._eyeEllipsoidCurvature = new Cartesian2();
149
+ this._modelToEnu = new Matrix4();
150
+ this._enuToModel = new Matrix4();
147
151
  this._pixelRatio = 1.0;
148
152
  this._orthographicIn3D = false;
149
153
  this._backgroundColor = new Color();
@@ -696,6 +700,52 @@ Object.defineProperties(UniformState.prototype, {
696
700
  },
697
701
  },
698
702
 
703
+ /**
704
+ * The ellipsoid surface normal at the camera position, in model coordinates.
705
+ * @memberof UniformState.prototype
706
+ * @type {Cartesian3}
707
+ */
708
+ eyeEllipsoidNormalEC: {
709
+ get: function () {
710
+ return this._eyeEllipsoidNormalEC;
711
+ },
712
+ },
713
+
714
+ /**
715
+ * The ellipsoid radii of curvature at the camera position.
716
+ * The .x component is the prime vertical radius, .y is the meridional.
717
+ * @memberof UniformState.prototype
718
+ * @type {Cartesian2}
719
+ */
720
+ eyeEllipsoidCurvature: {
721
+ get: function () {
722
+ return this._eyeEllipsoidCurvature;
723
+ },
724
+ },
725
+
726
+ /**
727
+ * A transform from model coordinates to an east-north-up coordinate system
728
+ * centered at the position on the ellipsoid below the camera
729
+ * @memberof UniformState.prototype
730
+ * @type {Matrix4}
731
+ */
732
+ modelToEnu: {
733
+ get: function () {
734
+ return this._modelToEnu;
735
+ },
736
+ },
737
+
738
+ /**
739
+ * The inverse of {@link UniformState.prototype.modelToEnu}
740
+ * @memberof UniformState.prototype
741
+ * @type {Matrix4}
742
+ */
743
+ enuToModel: {
744
+ get: function () {
745
+ return this._enuToModel;
746
+ },
747
+ },
748
+
699
749
  /**
700
750
  * The sun position in 3D world coordinates at the current scene time.
701
751
  * @memberof UniformState.prototype
@@ -1068,20 +1118,88 @@ function setInfiniteProjection(uniformState, matrix) {
1068
1118
  uniformState._modelViewInfiniteProjectionDirty = true;
1069
1119
  }
1070
1120
 
1121
+ const surfacePositionScratch = new Cartesian3();
1122
+ const enuTransformScratch = new Matrix4();
1123
+
1071
1124
  function setCamera(uniformState, camera) {
1072
1125
  Cartesian3.clone(camera.positionWC, uniformState._cameraPosition);
1073
1126
  Cartesian3.clone(camera.directionWC, uniformState._cameraDirection);
1074
1127
  Cartesian3.clone(camera.rightWC, uniformState._cameraRight);
1075
1128
  Cartesian3.clone(camera.upWC, uniformState._cameraUp);
1076
1129
 
1130
+ const ellipsoid = uniformState._ellipsoid;
1131
+ let surfacePosition;
1132
+
1077
1133
  const positionCartographic = camera.positionCartographic;
1078
1134
  if (!defined(positionCartographic)) {
1079
- uniformState._eyeHeight = -uniformState._ellipsoid.maximumRadius;
1135
+ uniformState._eyeHeight = -ellipsoid.maximumRadius;
1136
+ if (Cartesian3.magnitude(camera.positionWC) > 0.0) {
1137
+ uniformState._eyeEllipsoidNormalEC = Cartesian3.normalize(
1138
+ camera.positionWC,
1139
+ uniformState._eyeEllipsoidNormalEC
1140
+ );
1141
+ }
1142
+ surfacePosition = ellipsoid.scaleToGeodeticSurface(
1143
+ camera.positionWC,
1144
+ surfacePositionScratch
1145
+ );
1080
1146
  } else {
1081
1147
  uniformState._eyeHeight = positionCartographic.height;
1148
+ uniformState._eyeEllipsoidNormalEC = ellipsoid.geodeticSurfaceNormalCartographic(
1149
+ positionCartographic,
1150
+ uniformState._eyeEllipsoidNormalEC
1151
+ );
1152
+ surfacePosition = Cartesian3.fromRadians(
1153
+ positionCartographic.longitude,
1154
+ positionCartographic.latitude,
1155
+ 0.0,
1156
+ ellipsoid,
1157
+ surfacePositionScratch
1158
+ );
1082
1159
  }
1083
1160
 
1084
1161
  uniformState._encodedCameraPositionMCDirty = true;
1162
+
1163
+ if (!defined(surfacePosition)) {
1164
+ return;
1165
+ }
1166
+
1167
+ uniformState._eyeEllipsoidNormalEC = Matrix3.multiplyByVector(
1168
+ uniformState._viewRotation,
1169
+ uniformState._eyeEllipsoidNormalEC,
1170
+ uniformState._eyeEllipsoidNormalEC
1171
+ );
1172
+
1173
+ const enuToWorld = Transforms.eastNorthUpToFixedFrame(
1174
+ surfacePosition,
1175
+ ellipsoid,
1176
+ enuTransformScratch
1177
+ );
1178
+ uniformState._enuToModel = Matrix4.multiplyTransformation(
1179
+ uniformState.inverseModel,
1180
+ enuToWorld,
1181
+ uniformState._enuToModel
1182
+ );
1183
+ uniformState._modelToEnu = Matrix4.inverseTransformation(
1184
+ uniformState._enuToModel,
1185
+ uniformState._modelToEnu
1186
+ );
1187
+
1188
+ if (
1189
+ !CesiumMath.equalsEpsilon(
1190
+ ellipsoid._radii.x,
1191
+ ellipsoid._radii.y,
1192
+ CesiumMath.EPSILON15
1193
+ )
1194
+ ) {
1195
+ // Ellipsoid curvature calculations assume radii.x === radii.y as is true for WGS84
1196
+ return;
1197
+ }
1198
+
1199
+ uniformState._eyeEllipsoidCurvature = ellipsoid.getLocalCurvature(
1200
+ surfacePosition,
1201
+ uniformState._eyeEllipsoidCurvature
1202
+ );
1085
1203
  }
1086
1204
 
1087
1205
  let transformMatrix = new Matrix3();
@@ -43,6 +43,7 @@ import TileBoundingS2Cell from "./TileBoundingS2Cell.js";
43
43
  import TileBoundingSphere from "./TileBoundingSphere.js";
44
44
  import TileOrientedBoundingBox from "./TileOrientedBoundingBox.js";
45
45
  import Pass from "../Renderer/Pass.js";
46
+ import VerticalExaggeration from "../Core/VerticalExaggeration.js";
46
47
 
47
48
  /**
48
49
  * A tile in a {@link Cesium3DTileset}. When a tile is first created, its content is not loaded;
@@ -119,6 +120,9 @@ function Cesium3DTile(tileset, baseResource, header, parent) {
119
120
  */
120
121
  this.metadata = findTileMetadata(tileset, header);
121
122
 
123
+ this._verticalExaggeration = 1.0;
124
+ this._verticalExaggerationRelativeHeight = 0.0;
125
+
122
126
  // Important: tile metadata must be parsed before this line so that the
123
127
  // metadata semantics TILE_BOUNDING_BOX, TILE_BOUNDING_REGION, or TILE_BOUNDING_SPHERE
124
128
  // can override header.boundingVolume (if necessary)
@@ -1018,7 +1022,7 @@ Cesium3DTile.prototype.updateVisibility = function (frameState) {
1018
1022
  const parentVisibilityPlaneMask = defined(parent)
1019
1023
  ? parent._visibilityPlaneMask
1020
1024
  : CullingVolume.MASK_INDETERMINATE;
1021
- this.updateTransform(parentTransform);
1025
+ this.updateTransform(parentTransform, frameState);
1022
1026
  this._distanceToCamera = this.distanceToTile(frameState);
1023
1027
  this._centerZDepth = this.distanceToTileCenter(frameState);
1024
1028
  this._screenSpaceError = this.getScreenSpaceError(frameState, false);
@@ -1709,12 +1713,18 @@ function createRegion(region, transform, initialTransform, result) {
1709
1713
  );
1710
1714
  }
1711
1715
 
1716
+ const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);
1717
+
1712
1718
  if (defined(result)) {
1719
+ result.rectangle = Rectangle.clone(rectangleRegion, result.rectangle);
1720
+ result.minimumHeight = region[4];
1721
+ result.maximumHeight = region[5];
1722
+ // The TileBoundingRegion was already constructed with the default
1723
+ // WGS84 ellipsoid, so keep it consistent when updating.
1724
+ result.computeBoundingVolumes(Ellipsoid.WGS84);
1713
1725
  return result;
1714
1726
  }
1715
1727
 
1716
- const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);
1717
-
1718
1728
  return new TileBoundingRegion({
1719
1729
  rectangle: rectangleRegion,
1720
1730
  minimumHeight: region[4],
@@ -1793,26 +1803,117 @@ Cesium3DTile.prototype.createBoundingVolume = function (
1793
1803
 
1794
1804
  const { box, region, sphere } = boundingVolumeHeader;
1795
1805
  if (defined(box)) {
1796
- return createBox(box, transform, result);
1806
+ const tileOrientedBoundingBox = createBox(box, transform, result);
1807
+ if (this._verticalExaggeration !== 1.0) {
1808
+ exaggerateBoundingBox(
1809
+ tileOrientedBoundingBox,
1810
+ this._verticalExaggeration,
1811
+ this._verticalExaggerationRelativeHeight
1812
+ );
1813
+ }
1814
+ return tileOrientedBoundingBox;
1797
1815
  }
1798
1816
  if (defined(region)) {
1799
- return createRegion(region, transform, this._initialTransform, result);
1817
+ const tileBoundingVolume = createRegion(
1818
+ region,
1819
+ transform,
1820
+ this._initialTransform,
1821
+ result
1822
+ );
1823
+ if (this._verticalExaggeration === 1.0) {
1824
+ return tileBoundingVolume;
1825
+ }
1826
+ if (tileBoundingVolume instanceof TileOrientedBoundingBox) {
1827
+ exaggerateBoundingBox(
1828
+ tileBoundingVolume,
1829
+ this._verticalExaggeration,
1830
+ this._verticalExaggerationRelativeHeight
1831
+ );
1832
+ } else {
1833
+ tileBoundingVolume.minimumHeight = VerticalExaggeration.getHeight(
1834
+ tileBoundingVolume.minimumHeight,
1835
+ this._verticalExaggeration,
1836
+ this._verticalExaggerationRelativeHeight
1837
+ );
1838
+ tileBoundingVolume.maximumHeight = VerticalExaggeration.getHeight(
1839
+ tileBoundingVolume.maximumHeight,
1840
+ this._verticalExaggeration,
1841
+ this._verticalExaggerationRelativeHeight
1842
+ );
1843
+ tileBoundingVolume.computeBoundingVolumes(Ellipsoid.WGS84);
1844
+ }
1845
+ return tileBoundingVolume;
1800
1846
  }
1801
1847
  if (defined(sphere)) {
1802
- return createSphere(sphere, transform, result);
1848
+ const tileBoundingSphere = createSphere(sphere, transform, result);
1849
+ if (this._verticalExaggeration !== 1.0) {
1850
+ const exaggeratedCenter = VerticalExaggeration.getPosition(
1851
+ tileBoundingSphere.center,
1852
+ Ellipsoid.WGS84,
1853
+ this._verticalExaggeration,
1854
+ this._verticalExaggerationRelativeHeight,
1855
+ scratchCenter
1856
+ );
1857
+ const exaggeratedRadius =
1858
+ tileBoundingSphere.radius * this._verticalExaggeration;
1859
+ tileBoundingSphere.update(exaggeratedCenter, exaggeratedRadius);
1860
+ }
1861
+ return tileBoundingSphere;
1803
1862
  }
1804
1863
  throw new RuntimeError(
1805
1864
  "boundingVolume must contain a sphere, region, or box"
1806
1865
  );
1807
1866
  };
1808
1867
 
1868
+ const scratchExaggeratedCorners = Cartesian3.unpackArray(
1869
+ new Array(8 * 3).fill(0)
1870
+ );
1871
+
1872
+ /**
1873
+ * Exaggerates the bounding box of a tile based on the provided exaggeration factors.
1874
+ *
1875
+ * @private
1876
+ * @param {TileOrientedBoundingBox} tileOrientedBoundingBox - The oriented bounding box of the tile.
1877
+ * @param {number} exaggeration - The exaggeration factor to apply to the tile's bounding box.
1878
+ * @param {number} exaggerationRelativeHeight - The height relative to which exaggeration will be applied.
1879
+ */
1880
+ function exaggerateBoundingBox(
1881
+ tileOrientedBoundingBox,
1882
+ exaggeration,
1883
+ exaggerationRelativeHeight
1884
+ ) {
1885
+ const exaggeratedCorners = tileOrientedBoundingBox.boundingVolume
1886
+ .computeCorners(scratchExaggeratedCorners)
1887
+ .map((corner) =>
1888
+ VerticalExaggeration.getPosition(
1889
+ corner,
1890
+ Ellipsoid.WGS84,
1891
+ exaggeration,
1892
+ exaggerationRelativeHeight,
1893
+ corner
1894
+ )
1895
+ );
1896
+ const exaggeratedBox = OrientedBoundingBox.fromPoints(
1897
+ exaggeratedCorners,
1898
+ scratchOrientedBoundingBox
1899
+ );
1900
+ tileOrientedBoundingBox.update(
1901
+ exaggeratedBox.center,
1902
+ exaggeratedBox.halfAxes
1903
+ );
1904
+ }
1905
+
1809
1906
  /**
1810
1907
  * Update the tile's transform. The transform is applied to the tile's bounding volumes.
1811
1908
  *
1812
1909
  * @private
1813
1910
  * @param {Matrix4} parentTransform
1911
+ * @param {FrameState} [frameState]
1814
1912
  */
1815
- Cesium3DTile.prototype.updateTransform = function (parentTransform) {
1913
+ Cesium3DTile.prototype.updateTransform = function (
1914
+ parentTransform,
1915
+ frameState
1916
+ ) {
1816
1917
  parentTransform = defaultValue(parentTransform, Matrix4.IDENTITY);
1817
1918
  const computedTransform = Matrix4.multiplyTransformation(
1818
1919
  parentTransform,
@@ -1823,12 +1924,23 @@ Cesium3DTile.prototype.updateTransform = function (parentTransform) {
1823
1924
  computedTransform,
1824
1925
  this.computedTransform
1825
1926
  );
1927
+ const exaggerationChanged =
1928
+ defined(frameState) &&
1929
+ (this._verticalExaggeration !== frameState.verticalExaggeration ||
1930
+ this._verticalExaggerationRelativeHeight !==
1931
+ frameState.verticalExaggerationRelativeHeight);
1826
1932
 
1827
- if (!transformChanged) {
1933
+ if (!transformChanged && !exaggerationChanged) {
1828
1934
  return;
1829
1935
  }
1830
-
1831
- Matrix4.clone(computedTransform, this.computedTransform);
1936
+ if (transformChanged) {
1937
+ Matrix4.clone(computedTransform, this.computedTransform);
1938
+ }
1939
+ if (exaggerationChanged) {
1940
+ this._verticalExaggeration = frameState.verticalExaggeration;
1941
+ this._verticalExaggerationRelativeHeight =
1942
+ frameState.verticalExaggerationRelativeHeight;
1943
+ }
1832
1944
 
1833
1945
  // Update the bounding volumes
1834
1946
  const header = this._header;
@@ -275,18 +275,18 @@ function FrameState(context, creditDisplay, jobScheduler) {
275
275
  };
276
276
 
277
277
  /**
278
- * A scalar used to exaggerate the terrain.
278
+ * A scalar used to vertically exaggerate the scene
279
279
  * @type {number}
280
280
  * @default 1.0
281
281
  */
282
- this.terrainExaggeration = 1.0;
282
+ this.verticalExaggeration = 1.0;
283
283
 
284
284
  /**
285
- * The height relative to which terrain is exaggerated.
285
+ * The height relative to which the scene is vertically exaggerated.
286
286
  * @type {number}
287
287
  * @default 0.0
288
288
  */
289
- this.terrainExaggerationRelativeHeight = 0.0;
289
+ this.verticalExaggerationRelativeHeight = 0.0;
290
290
 
291
291
  /**
292
292
  * @typedef FrameState.ShadowState
@@ -28,6 +28,7 @@ import ImageryLayerCollection from "./ImageryLayerCollection.js";
28
28
  import QuadtreePrimitive from "./QuadtreePrimitive.js";
29
29
  import SceneMode from "./SceneMode.js";
30
30
  import ShadowMode from "./ShadowMode.js";
31
+ import deprecationWarning from "../Core/deprecationWarning.js";
31
32
 
32
33
  /**
33
34
  * The globe rendered in the scene, including its terrain ({@link Globe#terrainProvider})
@@ -340,25 +341,9 @@ function Globe(ellipsoid) {
340
341
  */
341
342
  this.atmosphereBrightnessShift = 0.0;
342
343
 
343
- /**
344
- * A scalar used to exaggerate the terrain. Defaults to <code>1.0</code> (no exaggeration).
345
- * A value of <code>2.0</code> scales the terrain by 2x.
346
- * A value of <code>0.0</code> makes the terrain completely flat.
347
- * Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.
348
- * @type {number}
349
- * @default 1.0
350
- */
351
- this.terrainExaggeration = 1.0;
352
-
353
- /**
354
- * The height from which terrain is exaggerated. Defaults to <code>0.0</code> (scaled relative to ellipsoid surface).
355
- * Terrain that is above this height will scale upwards and terrain that is below this height will scale downwards.
356
- * Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.
357
- * If {@link Globe#terrainExaggeration} is <code>1.0</code> this value will have no effect.
358
- * @type {number}
359
- * @default 0.0
360
- */
361
- this.terrainExaggerationRelativeHeight = 0.0;
344
+ this._terrainExaggerationChanged = false;
345
+ this._terrainExaggeration = 1.0;
346
+ this._terrainExaggerationRelativeHeight = 0.0;
362
347
 
363
348
  /**
364
349
  * Whether to show terrain skirts. Terrain skirts are geometry extending downwards from a tile's edges used to hide seams between neighboring tiles.
@@ -538,6 +523,68 @@ Object.defineProperties(Globe.prototype, {
538
523
  return this._terrainProviderChanged;
539
524
  },
540
525
  },
526
+ /**
527
+ * A scalar used to exaggerate the terrain. Defaults to <code>1.0</code> (no exaggeration).
528
+ * A value of <code>2.0</code> scales the terrain by 2x.
529
+ * A value of <code>0.0</code> makes the terrain completely flat.
530
+ * Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.
531
+ *
532
+ * @memberof Globe.prototype
533
+ * @type {number}
534
+ * @default 1.0
535
+ *
536
+ * @deprecated
537
+ */
538
+ terrainExaggeration: {
539
+ get: function () {
540
+ deprecationWarning(
541
+ "Globe.terrainExaggeration",
542
+ "Globe.terrainExaggeration was deprecated in CesiumJS 1.113. It will be removed in CesiumJS 1.116. Use Scene.verticalExaggeration instead."
543
+ );
544
+ return this._terrainExaggeration;
545
+ },
546
+ set: function (value) {
547
+ deprecationWarning(
548
+ "Globe.terrainExaggeration",
549
+ "Globe.terrainExaggeration was deprecated in CesiumJS 1.113. It will be removed in CesiumJS 1.116. Use Scene.verticalExaggeration instead."
550
+ );
551
+ if (value !== this._terrainExaggeration) {
552
+ this._terrainExaggeration = value;
553
+ this._terrainExaggerationChanged = true;
554
+ }
555
+ },
556
+ },
557
+ /**
558
+ * The height from which terrain is exaggerated. Defaults to <code>0.0</code> (scaled relative to ellipsoid surface).
559
+ * Terrain that is above this height will scale upwards and terrain that is below this height will scale downwards.
560
+ * Note that terrain exaggeration will not modify any other primitive as they are positioned relative to the ellipsoid.
561
+ * If {@link Globe#terrainExaggeration} is <code>1.0</code> this value will have no effect.
562
+ *
563
+ * @memberof Globe.prototype
564
+ * @type {number}
565
+ * @default 0.0
566
+ *
567
+ * @deprecated
568
+ */
569
+ terrainExaggerationRelativeHeight: {
570
+ get: function () {
571
+ deprecationWarning(
572
+ "Globe.terrainExaggerationRelativeHeight",
573
+ "Globe.terrainExaggerationRelativeHeight was deprecated in CesiumJS 1.113. It will be removed in CesiumJS 1.116. Use Scene.verticalExaggerationRelativeHeight instead."
574
+ );
575
+ return this._terrainExaggerationRelativeHeight;
576
+ },
577
+ set: function (value) {
578
+ deprecationWarning(
579
+ "Globe.terrainExaggerationRelativeHeight",
580
+ "Globe.terrainExaggerationRelativeHeight was deprecated in CesiumJS 1.113. It will be removed in CesiumJS 1.116. Use Scene.verticalExaggerationRelativeHeight instead."
581
+ );
582
+ if (value !== this._terrainExaggerationRelativeHeight) {
583
+ this._terrainExaggerationRelativeHeight = value;
584
+ this._terrainExaggerationChanged = true;
585
+ }
586
+ },
587
+ },
541
588
  /**
542
589
  * Gets an event that's raised when the length of the tile load queue has changed since the last render frame. When the load queue is empty,
543
590
  * all terrain and imagery for the current view have been loaded. The event passes the new length of the tile load queue.
@@ -463,9 +463,9 @@ GlobeSurfaceTile.prototype.updateExaggeration = function (
463
463
  }
464
464
 
465
465
  // Check the tile's terrain encoding to see if it has been exaggerated yet
466
- const exaggeration = frameState.terrainExaggeration;
466
+ const exaggeration = frameState.verticalExaggeration;
467
467
  const exaggerationRelativeHeight =
468
- frameState.terrainExaggerationRelativeHeight;
468
+ frameState.verticalExaggerationRelativeHeight;
469
469
  const hasExaggerationScale = exaggeration !== 1.0;
470
470
 
471
471
  const encoding = mesh.encoding;
@@ -790,9 +790,9 @@ function transform(surfaceTile, frameState, terrainProvider, x, y, level) {
790
790
  createMeshOptions.x = x;
791
791
  createMeshOptions.y = y;
792
792
  createMeshOptions.level = level;
793
- createMeshOptions.exaggeration = frameState.terrainExaggeration;
793
+ createMeshOptions.exaggeration = frameState.verticalExaggeration;
794
794
  createMeshOptions.exaggerationRelativeHeight =
795
- frameState.terrainExaggerationRelativeHeight;
795
+ frameState.verticalExaggerationRelativeHeight;
796
796
  createMeshOptions.throttle = true;
797
797
 
798
798
  const terrainData = surfaceTile.terrainData;
@@ -25,7 +25,7 @@ import OrthographicFrustum from "../Core/OrthographicFrustum.js";
25
25
  import PrimitiveType from "../Core/PrimitiveType.js";
26
26
  import Rectangle from "../Core/Rectangle.js";
27
27
  import SphereOutlineGeometry from "../Core/SphereOutlineGeometry.js";
28
- import TerrainExaggeration from "../Core/TerrainExaggeration.js";
28
+ import VerticalExaggeration from "../Core/VerticalExaggeration.js";
29
29
  import TerrainQuantization from "../Core/TerrainQuantization.js";
30
30
  import Visibility from "../Core/Visibility.js";
31
31
  import WebMercatorProjection from "../Core/WebMercatorProjection.js";
@@ -179,8 +179,8 @@ function GlobeSurfaceTileProvider(options) {
179
179
  this._hasLoadedTilesThisFrame = false;
180
180
  this._hasFillTilesThisFrame = false;
181
181
 
182
- this._oldTerrainExaggeration = undefined;
183
- this._oldTerrainExaggerationRelativeHeight = undefined;
182
+ this._oldVerticalExaggeration = undefined;
183
+ this._oldVerticalExaggerationRelativeHeight = undefined;
184
184
  }
185
185
 
186
186
  Object.defineProperties(GlobeSurfaceTileProvider.prototype, {
@@ -448,7 +448,7 @@ GlobeSurfaceTileProvider.prototype.endUpdate = function (frameState) {
448
448
  );
449
449
  }
450
450
 
451
- // When terrain exaggeration changes, all of the loaded tiles need to generate
451
+ // When vertical exaggeration changes, all of the loaded tiles need to generate
452
452
  // geodetic surface normals so they can scale properly when rendered.
453
453
  // When exaggeration is reset, geodetic surface normals are removed to decrease
454
454
  // memory usage. Some tiles might have been constructed with the correct
@@ -460,16 +460,16 @@ GlobeSurfaceTileProvider.prototype.endUpdate = function (frameState) {
460
460
  // exaggeration changes.
461
461
 
462
462
  const quadtree = this.quadtree;
463
- const exaggeration = frameState.terrainExaggeration;
463
+ const exaggeration = frameState.verticalExaggeration;
464
464
  const exaggerationRelativeHeight =
465
- frameState.terrainExaggerationRelativeHeight;
465
+ frameState.verticalExaggerationRelativeHeight;
466
466
  const exaggerationChanged =
467
- this._oldTerrainExaggeration !== exaggeration ||
468
- this._oldTerrainExaggerationRelativeHeight !== exaggerationRelativeHeight;
467
+ this._oldVerticalExaggeration !== exaggeration ||
468
+ this._oldVerticalExaggerationRelativeHeight !== exaggerationRelativeHeight;
469
469
 
470
470
  // Keep track of the next time there is a change in exaggeration
471
- this._oldTerrainExaggeration = exaggeration;
472
- this._oldTerrainExaggerationRelativeHeight = exaggerationRelativeHeight;
471
+ this._oldVerticalExaggeration = exaggeration;
472
+ this._oldVerticalExaggerationRelativeHeight = exaggerationRelativeHeight;
473
473
 
474
474
  if (exaggerationChanged) {
475
475
  quadtree.forEachLoadedTile(function (tile) {
@@ -1258,18 +1258,18 @@ function updateTileBoundingRegion(tile, tileProvider, frameState) {
1258
1258
 
1259
1259
  // Update bounding regions from the min and max heights
1260
1260
  if (sourceTile !== undefined) {
1261
- const exaggeration = frameState.terrainExaggeration;
1261
+ const exaggeration = frameState.verticalExaggeration;
1262
1262
  const exaggerationRelativeHeight =
1263
- frameState.terrainExaggerationRelativeHeight;
1263
+ frameState.verticalExaggerationRelativeHeight;
1264
1264
  const hasExaggeration = exaggeration !== 1.0;
1265
1265
  if (hasExaggeration) {
1266
1266
  hasBoundingVolumesFromMesh = false;
1267
- tileBoundingRegion.minimumHeight = TerrainExaggeration.getHeight(
1267
+ tileBoundingRegion.minimumHeight = VerticalExaggeration.getHeight(
1268
1268
  tileBoundingRegion.minimumHeight,
1269
1269
  exaggeration,
1270
1270
  exaggerationRelativeHeight
1271
1271
  );
1272
- tileBoundingRegion.maximumHeight = TerrainExaggeration.getHeight(
1272
+ tileBoundingRegion.maximumHeight = VerticalExaggeration.getHeight(
1273
1273
  tileBoundingRegion.maximumHeight,
1274
1274
  exaggeration,
1275
1275
  exaggerationRelativeHeight
@@ -1625,8 +1625,8 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
1625
1625
  u_center3D: function () {
1626
1626
  return this.properties.center3D;
1627
1627
  },
1628
- u_terrainExaggerationAndRelativeHeight: function () {
1629
- return this.properties.terrainExaggerationAndRelativeHeight;
1628
+ u_verticalExaggerationAndRelativeHeight: function () {
1629
+ return this.properties.verticalExaggerationAndRelativeHeight;
1630
1630
  },
1631
1631
  u_tileRectangle: function () {
1632
1632
  return this.properties.tileRectangle;
@@ -1808,7 +1808,7 @@ function createTileUniformMap(frameState, globeSurfaceTileProvider) {
1808
1808
  modifiedModelView: new Matrix4(),
1809
1809
  tileRectangle: new Cartesian4(),
1810
1810
 
1811
- terrainExaggerationAndRelativeHeight: new Cartesian2(1.0, 0.0),
1811
+ verticalExaggerationAndRelativeHeight: new Cartesian2(1.0, 0.0),
1812
1812
 
1813
1813
  dayTextures: [],
1814
1814
  dayTextureTranslationAndScale: [],
@@ -2174,9 +2174,9 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
2174
2174
  const encoding = mesh.encoding;
2175
2175
  const tileBoundingRegion = surfaceTile.tileBoundingRegion;
2176
2176
 
2177
- const exaggeration = frameState.terrainExaggeration;
2177
+ const exaggeration = frameState.verticalExaggeration;
2178
2178
  const exaggerationRelativeHeight =
2179
- frameState.terrainExaggerationRelativeHeight;
2179
+ frameState.verticalExaggerationRelativeHeight;
2180
2180
  const hasExaggeration = exaggeration !== 1.0;
2181
2181
  const hasGeodeticSurfaceNormals = encoding.hasGeodeticSurfaceNormals;
2182
2182
 
@@ -2431,8 +2431,8 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
2431
2431
  );
2432
2432
  }
2433
2433
 
2434
- uniformMapProperties.terrainExaggerationAndRelativeHeight.x = exaggeration;
2435
- uniformMapProperties.terrainExaggerationAndRelativeHeight.y = exaggerationRelativeHeight;
2434
+ uniformMapProperties.verticalExaggerationAndRelativeHeight.x = exaggeration;
2435
+ uniformMapProperties.verticalExaggerationAndRelativeHeight.y = exaggerationRelativeHeight;
2436
2436
 
2437
2437
  uniformMapProperties.center3D = mesh.center;
2438
2438
  Cartesian3.clone(rtc, uniformMapProperties.rtc);