@cesium/engine 6.1.0 → 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 (142) hide show
  1. package/Build/Workers/{chunk-IQCBK4CE.js → chunk-3PW6ZBN4.js} +8 -304
  2. package/Build/Workers/{chunk-U5O26DDO.js → chunk-434ZTTFX.js} +2 -2
  3. package/Build/Workers/{chunk-DNCKFFNR.js → chunk-4KP73B43.js} +3 -3
  4. package/Build/Workers/{chunk-TIEL2RYB.js → chunk-52VSIKEA.js} +16 -16
  5. package/Build/Workers/{chunk-6JRDO2JP.js → chunk-5GDBZTHX.js} +18 -18
  6. package/Build/Workers/{chunk-WYMW5NZB.js → chunk-5HLGKKG3.js} +2 -2
  7. package/Build/Workers/{chunk-R5NOUYKW.js → chunk-5IRLXUTA.js} +7 -7
  8. package/Build/Workers/{chunk-4EXWKTY2.js → chunk-5SK36PU4.js} +8 -8
  9. package/Build/Workers/{chunk-UJ76JVUZ.js → chunk-ARPTYYKS.js} +5 -5
  10. package/Build/Workers/{chunk-2GWOHAWL.js → chunk-ATB2I7OS.js} +4 -4
  11. package/Build/Workers/{chunk-6LG4PY2M.js → chunk-AXFRNOVC.js} +12 -12
  12. package/Build/Workers/{chunk-A3TYRSRJ.js → chunk-BP467WX3.js} +4 -4
  13. package/Build/Workers/{chunk-I5XKU3UZ.js → chunk-BUZDZBUH.js} +11 -13
  14. package/Build/Workers/{chunk-N3OQDJDV.js → chunk-CDGHUKQ4.js} +13 -13
  15. package/Build/Workers/{chunk-7ISAYW2A.js → chunk-CSIZ3BGT.js} +15 -17
  16. package/Build/Workers/{chunk-N73NY3KY.js → chunk-CWJQGBWT.js} +1 -1
  17. package/Build/Workers/{chunk-E5HIGWSZ.js → chunk-DMCSY5BU.js} +5 -5
  18. package/Build/Workers/{chunk-JY6WB2NK.js → chunk-DR5XZ6K5.js} +13 -13
  19. package/Build/Workers/{chunk-4MPXTOW6.js → chunk-FWGNCYP6.js} +7 -7
  20. package/Build/Workers/{chunk-LID3UUML.js → chunk-GF5TNNKP.js} +6 -6
  21. package/Build/Workers/{chunk-ULABUYF6.js → chunk-GVL5I7TC.js} +18 -20
  22. package/Build/Workers/{chunk-4JETNOH2.js → chunk-H5DUXHCV.js} +11 -11
  23. package/Build/Workers/{chunk-QX5ASOZZ.js → chunk-HFKSAB5K.js} +14 -16
  24. package/Build/Workers/{chunk-XKGSTUQO.js → chunk-HOT2SNXP.js} +15 -20
  25. package/Build/Workers/{chunk-ICD3BWBC.js → chunk-HPH5HSFE.js} +2 -2
  26. package/Build/Workers/{chunk-FNHGOHCI.js → chunk-HPP4JLNH.js} +8 -8
  27. package/Build/Workers/{chunk-HX5XY3NH.js → chunk-HUPNRBWW.js} +6 -6
  28. package/Build/Workers/{chunk-EEL3YC6V.js → chunk-JGG36SQV.js} +4 -4
  29. package/Build/Workers/{chunk-54GSYZWT.js → chunk-LGJUI2CE.js} +325 -5
  30. package/Build/Workers/{chunk-PNAD2XAN.js → chunk-LGL4P5KL.js} +6 -6
  31. package/Build/Workers/{chunk-CKOGHQ6J.js → chunk-LX6XV4DK.js} +5 -5
  32. package/Build/Workers/{chunk-ZERWARDV.js → chunk-MN34FIF5.js} +1 -1
  33. package/Build/Workers/{chunk-MMNPUV23.js → chunk-MW3CJYLX.js} +2 -2
  34. package/Build/Workers/{chunk-KFCTEEBD.js → chunk-NE4JNU6H.js} +31 -21
  35. package/Build/Workers/{chunk-DHO4HQHW.js → chunk-O43GWBSF.js} +1 -1
  36. package/Build/Workers/{chunk-EH2PEDWL.js → chunk-PIXK6KHB.js} +2 -2
  37. package/Build/Workers/{chunk-TDVU7NH7.js → chunk-PZ2WJWUG.js} +6 -6
  38. package/Build/Workers/{chunk-AEADHPUM.js → chunk-QRBRVGZC.js} +4 -4
  39. package/Build/Workers/{chunk-VIAGIVGP.js → chunk-QTZQZY2C.js} +9 -9
  40. package/Build/Workers/{chunk-3R5RPSYS.js → chunk-R3HUGXBH.js} +9 -9
  41. package/Build/Workers/{chunk-IDAL54EF.js → chunk-R4OZKBXH.js} +6 -6
  42. package/Build/Workers/{chunk-CHGQXPF3.js → chunk-RH4N2ONY.js} +7 -7
  43. package/Build/Workers/{chunk-YK5RU5AO.js → chunk-RIDPF7PO.js} +2 -2
  44. package/Build/Workers/{chunk-CZFGXAMG.js → chunk-SNN7WOC2.js} +13 -13
  45. package/Build/Workers/{chunk-F66GYWDZ.js → chunk-SQVTYRZY.js} +5 -7
  46. package/Build/Workers/{chunk-XNRYWRVT.js → chunk-SV7DDPAC.js} +1 -1
  47. package/Build/Workers/{chunk-P2BTKBVY.js → chunk-TIXXVKUY.js} +11 -11
  48. package/Build/Workers/{chunk-AI2FOC47.js → chunk-TMPVBFJQ.js} +11 -11
  49. package/Build/Workers/{chunk-4CHSBZNO.js → chunk-XUTVA4K5.js} +11 -11
  50. package/Build/Workers/{chunk-DD2PDL6D.js → chunk-Y4OJ4B23.js} +5 -5
  51. package/Build/Workers/{chunk-FMN2NHBU.js → chunk-YBKFS53K.js} +1 -1
  52. package/Build/Workers/{chunk-BLXANKPB.js → chunk-Z2SIPUKB.js} +6 -6
  53. package/Build/Workers/{chunk-5HUDPV54.js → chunk-Z4JUBRHP.js} +6 -6
  54. package/Build/Workers/{chunk-N7FIYNQV.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 +9 -9
  101. package/Build/Workers/transferTypedArrayTest.js +1 -1
  102. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  103. package/Source/Core/CesiumTerrainProvider.js +11 -4
  104. package/Source/Core/Ellipsoid.js +45 -0
  105. package/Source/Core/Ion.js +1 -1
  106. package/Source/Core/Quaternion.js +6 -2
  107. package/Source/Core/RectangleOutlineGeometry.js +2 -4
  108. package/Source/Core/RequestScheduler.js +3 -9
  109. package/Source/Core/TerrainEncoding.js +2 -2
  110. package/Source/Core/VerticalExaggeration.js +69 -0
  111. package/Source/Renderer/AutomaticUniforms.js +53 -0
  112. package/Source/Renderer/UniformState.js +119 -1
  113. package/Source/Scene/ArcGisMapService.js +1 -1
  114. package/Source/Scene/Cesium3DTile.js +122 -10
  115. package/Source/Scene/Cesium3DTileset.js +1 -1
  116. package/Source/Scene/FrameState.js +4 -4
  117. package/Source/Scene/Globe.js +66 -19
  118. package/Source/Scene/GlobeSurfaceTile.js +4 -4
  119. package/Source/Scene/GlobeSurfaceTileProvider.js +21 -21
  120. package/Source/Scene/GroundPrimitive.js +5 -5
  121. package/Source/Scene/ImageryLayer.js +3 -3
  122. package/Source/Scene/IonImageryProvider.js +1 -1
  123. package/Source/Scene/MapboxImageryProvider.js +2 -2
  124. package/Source/Scene/Megatexture.js +1 -1
  125. package/Source/Scene/Model/Model.js +11 -0
  126. package/Source/Scene/Model/ModelRuntimePrimitive.js +6 -0
  127. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +60 -0
  128. package/Source/Scene/Scene.js +28 -3
  129. package/Source/Scene/ScreenSpaceCameraController.js +12 -19
  130. package/Source/Scene/TerrainFillMesh.js +2 -2
  131. package/Source/Scene/TileOrientedBoundingBox.js +1 -1
  132. package/Source/Scene/VoxelPrimitive.js +73 -2
  133. package/Source/Shaders/GlobeVS.glsl +3 -3
  134. package/Source/Shaders/GlobeVS.js +3 -3
  135. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  136. package/Source/Shaders/Model/ModelVS.js +4 -0
  137. package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +39 -0
  138. package/Source/Shaders/Model/VerticalExaggerationStageVS.js +41 -0
  139. package/index.d.ts +39 -22
  140. package/index.js +590 -588
  141. package/package.json +2 -2
  142. 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();
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "AAPK72121c3f05244af285ad75999db084bfDGkWA0QECX6QWOdaQmarXC21i1ogkvj8XCctaZExrW8Hw1AT58yG7twH3VFzZl13";
7
+ "AAPK2b93071721df4cc78be0d8b3d79b1fd54YMocOcx2NxlbYTDkyO5gPk8XsDnguQgeMdFKepFwLwTgb8vHfPvSTdjy_KlMHlS";
8
8
  /**
9
9
  * Default options for accessing the ArcGIS image tile service.
10
10
  *
@@ -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;
@@ -1902,7 +1902,7 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1902
1902
  * used for streaming massive heterogeneous 3D geospatial datasets, from a Cesium ion asset ID.
1903
1903
  *
1904
1904
  * @param {number} assetId The Cesium ion asset id.
1905
- * @param {Cesium3DTileset.ConstructorOptions} options An object describing initialization options
1905
+ * @param {Cesium3DTileset.ConstructorOptions} [options] An object describing initialization options
1906
1906
  * @returns {Promise<Cesium3DTileset>}
1907
1907
  *
1908
1908
  * @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0.
@@ -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;