@cesium/engine 6.1.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
  2. package/Build/Workers/{chunk-FRG2Z7DE.js → chunk-2HJWSU7B.js} +4 -4
  3. package/Build/Workers/{chunk-ZTYE74E2.js → chunk-46UD5ABS.js} +4 -4
  4. package/Build/Workers/{chunk-VODWDCX6.js → chunk-4EBHOMFX.js} +18 -20
  5. package/Build/Workers/{chunk-N7TYCDTR.js → chunk-5HDYHG3F.js} +13 -13
  6. package/Build/Workers/{chunk-C53JYYKX.js → chunk-5M3U6ZMA.js} +1 -1
  7. package/Build/Workers/{chunk-GTEXWEAP.js → chunk-5WQ523AW.js} +5 -5
  8. package/Build/Workers/{chunk-SEFDWMCW.js → chunk-5YLJ77FF.js} +31 -21
  9. package/Build/Workers/{chunk-VNRUVNIK.js → chunk-6HZQPRUS.js} +1 -1
  10. package/Build/Workers/{chunk-PB7BIXHI.js → chunk-6VJVYK2V.js} +2 -2
  11. package/Build/Workers/{chunk-PHQVHDVI.js → chunk-72SANQJV.js} +325 -5
  12. package/Build/Workers/{chunk-D325WRAY.js → chunk-7XEAYGZK.js} +35 -11
  13. package/Build/Workers/{chunk-FGUP2QEP.js → chunk-AIPU2VSX.js} +6 -6
  14. package/Build/Workers/{chunk-QUXSQQEF.js → chunk-AR5DNBJ4.js} +6 -6
  15. package/Build/Workers/{chunk-ZVUAJKAL.js → chunk-BZP4T2JJ.js} +11 -13
  16. package/Build/Workers/{chunk-K6Q5IRBK.js → chunk-DTAIXKTO.js} +6 -6
  17. package/Build/Workers/{chunk-D4YHO4NZ.js → chunk-F6SE42BK.js} +133 -101
  18. package/Build/Workers/{chunk-QY2WY5XJ.js → chunk-FP6GYBFX.js} +11 -11
  19. package/Build/Workers/{chunk-Z6LPXA7S.js → chunk-GEJTYLCO.js} +5 -5
  20. package/Build/Workers/{chunk-VKTKOIYG.js → chunk-GV56Q4LU.js} +11 -11
  21. package/Build/Workers/{chunk-KUB2HQXR.js → chunk-IQBYFRVW.js} +8 -8
  22. package/Build/Workers/{chunk-235MRXLH.js → chunk-IX2JCCNM.js} +1 -1
  23. package/Build/Workers/{chunk-3FCUUN6M.js → chunk-JCNXK6EL.js} +11 -11
  24. package/Build/Workers/{chunk-364TQORK.js → chunk-JJ4VBOQ3.js} +5 -7
  25. package/Build/Workers/{chunk-66CXKODF.js → chunk-JXDC723O.js} +2 -2
  26. package/Build/Workers/{chunk-OTBRPBCC.js → chunk-JY5YEZFA.js} +9 -9
  27. package/Build/Workers/{chunk-LSGUCCKJ.js → chunk-L2ZN645J.js} +6 -6
  28. package/Build/Workers/{chunk-VLDDXYKI.js → chunk-LZ7JIV3K.js} +18 -18
  29. package/Build/Workers/{chunk-36ESDRIZ.js → chunk-LZGHD6NY.js} +16 -16
  30. package/Build/Workers/{chunk-PXLFBN2Q.js → chunk-MY3VNFGQ.js} +7 -7
  31. package/Build/Workers/{chunk-W7F5VTH6.js → chunk-NKPBIX7F.js} +1 -1
  32. package/Build/Workers/{chunk-XBZSOW3F.js → chunk-NY3K4IM3.js} +12 -12
  33. package/Build/Workers/{chunk-AI3KSNM6.js → chunk-ODW7WYM4.js} +2 -2
  34. package/Build/Workers/{chunk-6PWSSCRA.js → chunk-OVLG3FRS.js} +6 -6
  35. package/Build/Workers/{chunk-MOLGJDJV.js → chunk-PNBGBETF.js} +11 -11
  36. package/Build/Workers/{chunk-T73B27DG.js → chunk-PTQQUQC3.js} +13 -13
  37. package/Build/Workers/{chunk-RSWBNJPT.js → chunk-QZAD5O7I.js} +8 -304
  38. package/Build/Workers/{chunk-I6TVJ6T7.js → chunk-R5X4OQT4.js} +8 -8
  39. package/Build/Workers/{chunk-DTNN3ODA.js → chunk-RAEV7K66.js} +5 -5
  40. package/Build/Workers/{chunk-IZED7ODV.js → chunk-RV7ZYPFT.js} +4 -4
  41. package/Build/Workers/{chunk-7FEGZO3D.js → chunk-S4MAZ3SS.js} +2 -2
  42. package/Build/Workers/{chunk-J3U6Z5YQ.js → chunk-S6SKF6DT.js} +5 -5
  43. package/Build/Workers/{chunk-CHDJ66UM.js → chunk-U2VCRRQW.js} +6 -6
  44. package/Build/Workers/{chunk-R22RQAAM.js → chunk-UAEW6HKG.js} +13 -13
  45. package/Build/Workers/{chunk-S7IBK36I.js → chunk-UDO6BFSF.js} +14 -16
  46. package/Build/Workers/{chunk-YS4KPNLC.js → chunk-UGK3FCDY.js} +1 -1
  47. package/Build/Workers/{chunk-SJDXMQSP.js → chunk-VK3EJHWI.js} +2 -2
  48. package/Build/Workers/{chunk-HEROVJML.js → chunk-VRGFV2UO.js} +7 -7
  49. package/Build/Workers/{chunk-VOAZN4IP.js → chunk-WBQCVXR3.js} +4 -4
  50. package/Build/Workers/{chunk-HSW63JN4.js → chunk-WZU2YLWG.js} +3 -3
  51. package/Build/Workers/{chunk-4EYB62WJ.js → chunk-XWXM2O2R.js} +6 -6
  52. package/Build/Workers/{chunk-ZGMOBRTG.js → chunk-YUCVWAY6.js} +7 -7
  53. package/Build/Workers/{chunk-CLVEIRXT.js → chunk-ZK5JOS3D.js} +15 -17
  54. package/Build/Workers/{chunk-5NZTU5YL.js → chunk-ZUA2UUNV.js} +2 -2
  55. package/Build/Workers/combineGeometry.js +23 -23
  56. package/Build/Workers/createBoxGeometry.js +17 -17
  57. package/Build/Workers/createBoxOutlineGeometry.js +15 -15
  58. package/Build/Workers/createCircleGeometry.js +25 -25
  59. package/Build/Workers/createCircleOutlineGeometry.js +18 -18
  60. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
  61. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +30 -30
  62. package/Build/Workers/createCorridorGeometry.js +28 -29
  63. package/Build/Workers/createCorridorOutlineGeometry.js +27 -28
  64. package/Build/Workers/createCylinderGeometry.js +19 -19
  65. package/Build/Workers/createCylinderOutlineGeometry.js +18 -19
  66. package/Build/Workers/createEllipseGeometry.js +25 -25
  67. package/Build/Workers/createEllipseOutlineGeometry.js +18 -18
  68. package/Build/Workers/createEllipsoidGeometry.js +18 -18
  69. package/Build/Workers/createEllipsoidOutlineGeometry.js +17 -17
  70. package/Build/Workers/createFrustumGeometry.js +17 -17
  71. package/Build/Workers/createFrustumOutlineGeometry.js +17 -17
  72. package/Build/Workers/createGeometry.js +23 -23
  73. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  74. package/Build/Workers/createPlaneGeometry.js +15 -15
  75. package/Build/Workers/createPlaneOutlineGeometry.js +14 -14
  76. package/Build/Workers/createPolygonGeometry.js +32 -167
  77. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  78. package/Build/Workers/createPolylineGeometry.js +24 -24
  79. package/Build/Workers/createPolylineVolumeGeometry.js +32 -35
  80. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -29
  81. package/Build/Workers/createRectangleGeometry.js +27 -27
  82. package/Build/Workers/createRectangleOutlineGeometry.js +21 -23
  83. package/Build/Workers/createSimplePolylineGeometry.js +22 -22
  84. package/Build/Workers/createSphereGeometry.js +18 -18
  85. package/Build/Workers/createSphereOutlineGeometry.js +17 -17
  86. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  87. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  88. package/Build/Workers/createVectorTileGeometries.js +23 -23
  89. package/Build/Workers/createVectorTilePoints.js +12 -12
  90. package/Build/Workers/createVectorTilePolygons.js +21 -21
  91. package/Build/Workers/createVectorTilePolylines.js +14 -14
  92. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  93. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  94. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -19
  95. package/Build/Workers/createWallGeometry.js +23 -23
  96. package/Build/Workers/createWallOutlineGeometry.js +22 -22
  97. package/Build/Workers/decodeDraco.js +11 -11
  98. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  99. package/Build/Workers/decodeI3S.js +9 -9
  100. package/Build/Workers/transcodeKTX2.js +7 -7
  101. package/Build/Workers/transferTypedArrayTest.js +1 -1
  102. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  103. package/LICENSE.md +1 -1
  104. package/Source/Assets/approximateTerrainHeights.json +1 -1
  105. package/Source/Core/Ellipsoid.js +45 -0
  106. package/Source/Core/GregorianDate.js +85 -0
  107. package/Source/Core/HeadingPitchRange.js +2 -2
  108. package/Source/Core/Ion.js +1 -1
  109. package/Source/Core/PolygonGeometry.js +0 -169
  110. package/Source/Core/Quaternion.js +6 -2
  111. package/Source/Core/RectangleOutlineGeometry.js +2 -4
  112. package/Source/Core/RequestScheduler.js +3 -9
  113. package/Source/Core/Resource.js +30 -69
  114. package/Source/Core/TerrainEncoding.js +2 -2
  115. package/Source/Core/Transforms.js +27 -18
  116. package/Source/Core/VerticalExaggeration.js +69 -0
  117. package/Source/Core/createWorldBathymetryAsync.js +45 -0
  118. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
  119. package/Source/DataSources/Entity.js +8 -5
  120. package/Source/DataSources/EntityCollection.js +1 -2
  121. package/Source/DataSources/GeometryUpdater.js +1 -2
  122. package/Source/DataSources/GroundGeometryUpdater.js +6 -3
  123. package/Source/DataSources/ModelVisualizer.js +19 -98
  124. package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
  125. package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
  126. package/Source/DataSources/TerrainOffsetProperty.js +15 -23
  127. package/Source/Renderer/AutomaticUniforms.js +173 -0
  128. package/Source/Renderer/UniformState.js +246 -1
  129. package/Source/Scene/ArcGisMapService.js +1 -1
  130. package/Source/Scene/Atmosphere.js +127 -0
  131. package/Source/Scene/Billboard.js +29 -26
  132. package/Source/Scene/BillboardCollection.js +3 -3
  133. package/Source/Scene/Camera.js +1 -1
  134. package/Source/Scene/Cesium3DTile.js +123 -10
  135. package/Source/Scene/Cesium3DTileContent.js +14 -0
  136. package/Source/Scene/Cesium3DTileset.js +326 -45
  137. package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
  138. package/Source/Scene/Composite3DTileContent.js +42 -0
  139. package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
  140. package/Source/Scene/Empty3DTileContent.js +4 -0
  141. package/Source/Scene/Fog.js +1 -0
  142. package/Source/Scene/FrameState.js +13 -5
  143. package/Source/Scene/Geometry3DTileContent.js +4 -0
  144. package/Source/Scene/Globe.js +69 -21
  145. package/Source/Scene/GlobeSurfaceTile.js +4 -4
  146. package/Source/Scene/GlobeSurfaceTileProvider.js +24 -22
  147. package/Source/Scene/GltfLoader.js +15 -5
  148. package/Source/Scene/GroundPrimitive.js +5 -5
  149. package/Source/Scene/HeightReference.js +59 -2
  150. package/Source/Scene/ImageryLayer.js +3 -3
  151. package/Source/Scene/Implicit3DTileContent.js +4 -0
  152. package/Source/Scene/LabelCollection.js +2 -2
  153. package/Source/Scene/MapboxImageryProvider.js +2 -2
  154. package/Source/Scene/Megatexture.js +1 -1
  155. package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
  156. package/Source/Scene/Model/B3dmLoader.js +4 -0
  157. package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
  158. package/Source/Scene/Model/I3dmLoader.js +4 -0
  159. package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
  160. package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
  161. package/Source/Scene/Model/Model.js +93 -32
  162. package/Source/Scene/Model/Model3DTileContent.js +31 -0
  163. package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
  164. package/Source/Scene/Model/ModelRuntimePrimitive.js +6 -0
  165. package/Source/Scene/Model/ModelSceneGraph.js +6 -0
  166. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +60 -0
  167. package/Source/Scene/Model/pickModel.js +408 -0
  168. package/Source/Scene/Multiple3DTileContent.js +42 -0
  169. package/Source/Scene/QuadtreePrimitive.js +1 -1
  170. package/Source/Scene/Scene.js +226 -19
  171. package/Source/Scene/ScreenSpaceCameraController.js +14 -25
  172. package/Source/Scene/SkyAtmosphere.js +5 -6
  173. package/Source/Scene/Terrain.js +49 -0
  174. package/Source/Scene/TerrainFillMesh.js +2 -2
  175. package/Source/Scene/TileBoundingS2Cell.js +2 -2
  176. package/Source/Scene/TileOrientedBoundingBox.js +1 -1
  177. package/Source/Scene/Tileset3DTileContent.js +4 -0
  178. package/Source/Scene/Vector3DTileContent.js +4 -0
  179. package/Source/Scene/VoxelPrimitive.js +73 -2
  180. package/Source/Shaders/AtmosphereCommon.glsl +3 -11
  181. package/Source/Shaders/AtmosphereCommon.js +3 -11
  182. package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
  183. package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
  184. package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
  185. package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
  186. package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
  187. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
  188. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
  189. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
  190. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
  191. package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
  192. package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
  193. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
  194. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
  195. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
  196. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
  197. package/Source/Shaders/GlobeFS.glsl +16 -25
  198. package/Source/Shaders/GlobeFS.js +16 -25
  199. package/Source/Shaders/GlobeVS.glsl +4 -4
  200. package/Source/Shaders/GlobeVS.js +4 -4
  201. package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
  202. package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
  203. package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
  204. package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
  205. package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
  206. package/Source/Shaders/Model/GeometryStageFS.js +1 -1
  207. package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
  208. package/Source/Shaders/Model/GeometryStageVS.js +4 -4
  209. package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
  210. package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
  211. package/Source/Shaders/Model/ModelFS.glsl +4 -0
  212. package/Source/Shaders/Model/ModelFS.js +4 -0
  213. package/Source/Shaders/Model/ModelVS.glsl +13 -4
  214. package/Source/Shaders/Model/ModelVS.js +13 -4
  215. package/Source/Shaders/Model/VerticalExaggerationStageVS.glsl +39 -0
  216. package/Source/Shaders/Model/VerticalExaggerationStageVS.js +41 -0
  217. package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
  218. package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
  219. package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
  220. package/Source/Shaders/SkyAtmosphereFS.js +5 -10
  221. package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
  222. package/Source/Shaders/SkyAtmosphereVS.js +3 -2
  223. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  224. package/Source/ThirdParty/draco_decoder.wasm +0 -0
  225. package/index.d.ts +318 -83
  226. package/index.js +77 -62
  227. package/package.json +3 -3
  228. package/Build/Workers/chunk-7ONRI7T4.js +0 -55
  229. package/Source/Core/TerrainExaggeration.js +0 -49
@@ -10,10 +10,13 @@ import defaultValue from "../Core/defaultValue.js";
10
10
  import defined from "../Core/defined.js";
11
11
  import DeveloperError from "../Core/DeveloperError.js";
12
12
  import DistanceDisplayCondition from "../Core/DistanceDisplayCondition.js";
13
+ import Ellipsoid from "../Core/Ellipsoid.js";
13
14
  import Matrix4 from "../Core/Matrix4.js";
14
15
  import NearFarScalar from "../Core/NearFarScalar.js";
15
16
  import Resource from "../Core/Resource.js";
16
- import HeightReference from "./HeightReference.js";
17
+ import HeightReference, {
18
+ isHeightReferenceRelative,
19
+ } from "./HeightReference.js";
17
20
  import HorizontalOrigin from "./HorizontalOrigin.js";
18
21
  import SceneMode from "./SceneMode.js";
19
22
  import SceneTransforms from "./SceneTransforms.js";
@@ -1056,15 +1059,13 @@ Billboard.prototype._updateClamping = function () {
1056
1059
  };
1057
1060
 
1058
1061
  const scratchCartographic = new Cartographic();
1059
- const scratchPosition = new Cartesian3();
1060
-
1061
1062
  Billboard._updateClamping = function (collection, owner) {
1062
1063
  const scene = collection._scene;
1063
- if (!defined(scene) || !defined(scene.globe)) {
1064
+ if (!defined(scene)) {
1064
1065
  //>>includeStart('debug', pragmas.debug);
1065
1066
  if (owner._heightReference !== HeightReference.NONE) {
1066
1067
  throw new DeveloperError(
1067
- "Height reference is not supported without a scene and globe."
1068
+ "Height reference is not supported without a scene."
1068
1069
  );
1069
1070
  }
1070
1071
  //>>includeEnd('debug');
@@ -1072,8 +1073,7 @@ Billboard._updateClamping = function (collection, owner) {
1072
1073
  }
1073
1074
 
1074
1075
  const globe = scene.globe;
1075
- const ellipsoid = globe.ellipsoid;
1076
- const surface = globe._surface;
1076
+ const ellipsoid = defaultValue(globe?.ellipsoid, Ellipsoid.WGS84);
1077
1077
 
1078
1078
  const mode = scene.frameState.mode;
1079
1079
 
@@ -1096,45 +1096,48 @@ Billboard._updateClamping = function (collection, owner) {
1096
1096
  return;
1097
1097
  }
1098
1098
 
1099
+ if (defined(owner._removeCallbackFunc)) {
1100
+ owner._removeCallbackFunc();
1101
+ }
1102
+
1099
1103
  const position = ellipsoid.cartesianToCartographic(owner._position);
1100
1104
  if (!defined(position)) {
1101
1105
  owner._actualClampedPosition = undefined;
1102
1106
  return;
1103
1107
  }
1104
1108
 
1105
- if (defined(owner._removeCallbackFunc)) {
1106
- owner._removeCallbackFunc();
1107
- }
1108
-
1109
1109
  function updateFunction(clampedPosition) {
1110
- if (owner._heightReference === HeightReference.RELATIVE_TO_GROUND) {
1110
+ owner._clampedPosition = ellipsoid.cartographicToCartesian(
1111
+ clampedPosition,
1112
+ owner._clampedPosition
1113
+ );
1114
+
1115
+ if (isHeightReferenceRelative(owner._heightReference)) {
1111
1116
  if (owner._mode === SceneMode.SCENE3D) {
1112
- const clampedCart = ellipsoid.cartesianToCartographic(
1117
+ clampedPosition.height += position.height;
1118
+ ellipsoid.cartographicToCartesian(
1113
1119
  clampedPosition,
1114
- scratchCartographic
1120
+ owner._clampedPosition
1115
1121
  );
1116
- clampedCart.height += position.height;
1117
- ellipsoid.cartographicToCartesian(clampedCart, clampedPosition);
1118
1122
  } else {
1119
- clampedPosition.x += position.height;
1123
+ owner._clampedPosition.x += position.height;
1120
1124
  }
1121
1125
  }
1122
- owner._clampedPosition = Cartesian3.clone(
1123
- clampedPosition,
1124
- owner._clampedPosition
1125
- );
1126
1126
  }
1127
- owner._removeCallbackFunc = surface.updateHeight(position, updateFunction);
1127
+
1128
+ owner._removeCallbackFunc = scene.updateHeight(
1129
+ position,
1130
+ updateFunction,
1131
+ owner._heightReference
1132
+ );
1128
1133
 
1129
1134
  Cartographic.clone(position, scratchCartographic);
1130
- const height = globe.getHeight(position);
1135
+ const height = scene.getHeight(position, owner._heightReference);
1131
1136
  if (defined(height)) {
1132
1137
  scratchCartographic.height = height;
1133
1138
  }
1134
1139
 
1135
- ellipsoid.cartographicToCartesian(scratchCartographic, scratchPosition);
1136
-
1137
- updateFunction(scratchPosition);
1140
+ updateFunction(scratchCartographic);
1138
1141
  };
1139
1142
 
1140
1143
  Billboard.prototype._loadImage = function () {
@@ -28,7 +28,7 @@ import BillboardCollectionVS from "../Shaders/BillboardCollectionVS.js";
28
28
  import Billboard from "./Billboard.js";
29
29
  import BlendingState from "./BlendingState.js";
30
30
  import BlendOption from "./BlendOption.js";
31
- import HeightReference from "./HeightReference.js";
31
+ import HeightReference, { isHeightReferenceClamp } from "./HeightReference.js";
32
32
  import HorizontalOrigin from "./HorizontalOrigin.js";
33
33
  import SceneMode from "./SceneMode.js";
34
34
  import SDFSettings from "./SDFSettings.js";
@@ -1375,7 +1375,7 @@ function writeCompressedAttribute3(
1375
1375
 
1376
1376
  let disableDepthTestDistance = billboard.disableDepthTestDistance;
1377
1377
  const clampToGround =
1378
- billboard.heightReference === HeightReference.CLAMP_TO_GROUND &&
1378
+ isHeightReferenceClamp(billboard.heightReference) &&
1379
1379
  frameState.context.depthTexture;
1380
1380
  if (!defined(disableDepthTestDistance)) {
1381
1381
  disableDepthTestDistance = clampToGround ? 5000.0 : 0.0;
@@ -1448,7 +1448,7 @@ function writeTextureCoordinateBoundsOrLabelTranslate(
1448
1448
  vafWriters,
1449
1449
  billboard
1450
1450
  ) {
1451
- if (billboard.heightReference === HeightReference.CLAMP_TO_GROUND) {
1451
+ if (isHeightReferenceClamp(billboard.heightReference)) {
1452
1452
  const scene = billboardCollection._scene;
1453
1453
  const context = frameState.context;
1454
1454
  const globeTranslucent = frameState.globeTranslucencyState.translucent;
@@ -197,7 +197,7 @@ function Camera(scene) {
197
197
  this.defaultZoomAmount = 100000.0;
198
198
  /**
199
199
  * If set, the camera will not be able to rotate past this axis in either direction.
200
- * @type {Cartesian3}
200
+ * @type {Cartesian3 | undefined}
201
201
  * @default undefined
202
202
  */
203
203
  this.constrainedAxis = undefined;
@@ -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)
@@ -470,6 +474,7 @@ function Cesium3DTile(tileset, baseResource, header, parent) {
470
474
  this._touchedFrame = 0;
471
475
  this._visitedFrame = 0;
472
476
  this._selectedFrame = 0;
477
+ this._wasSelectedLastFrame = false;
473
478
  this._requestedFrame = 0;
474
479
  this._ancestorWithContent = undefined;
475
480
  this._ancestorWithContentAvailable = undefined;
@@ -1018,7 +1023,7 @@ Cesium3DTile.prototype.updateVisibility = function (frameState) {
1018
1023
  const parentVisibilityPlaneMask = defined(parent)
1019
1024
  ? parent._visibilityPlaneMask
1020
1025
  : CullingVolume.MASK_INDETERMINATE;
1021
- this.updateTransform(parentTransform);
1026
+ this.updateTransform(parentTransform, frameState);
1022
1027
  this._distanceToCamera = this.distanceToTile(frameState);
1023
1028
  this._centerZDepth = this.distanceToTileCenter(frameState);
1024
1029
  this._screenSpaceError = this.getScreenSpaceError(frameState, false);
@@ -1709,12 +1714,18 @@ function createRegion(region, transform, initialTransform, result) {
1709
1714
  );
1710
1715
  }
1711
1716
 
1717
+ const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);
1718
+
1712
1719
  if (defined(result)) {
1720
+ result.rectangle = Rectangle.clone(rectangleRegion, result.rectangle);
1721
+ result.minimumHeight = region[4];
1722
+ result.maximumHeight = region[5];
1723
+ // The TileBoundingRegion was already constructed with the default
1724
+ // WGS84 ellipsoid, so keep it consistent when updating.
1725
+ result.computeBoundingVolumes(Ellipsoid.WGS84);
1713
1726
  return result;
1714
1727
  }
1715
1728
 
1716
- const rectangleRegion = Rectangle.unpack(region, 0, scratchRectangle);
1717
-
1718
1729
  return new TileBoundingRegion({
1719
1730
  rectangle: rectangleRegion,
1720
1731
  minimumHeight: region[4],
@@ -1793,26 +1804,117 @@ Cesium3DTile.prototype.createBoundingVolume = function (
1793
1804
 
1794
1805
  const { box, region, sphere } = boundingVolumeHeader;
1795
1806
  if (defined(box)) {
1796
- return createBox(box, transform, result);
1807
+ const tileOrientedBoundingBox = createBox(box, transform, result);
1808
+ if (this._verticalExaggeration !== 1.0) {
1809
+ exaggerateBoundingBox(
1810
+ tileOrientedBoundingBox,
1811
+ this._verticalExaggeration,
1812
+ this._verticalExaggerationRelativeHeight
1813
+ );
1814
+ }
1815
+ return tileOrientedBoundingBox;
1797
1816
  }
1798
1817
  if (defined(region)) {
1799
- return createRegion(region, transform, this._initialTransform, result);
1818
+ const tileBoundingVolume = createRegion(
1819
+ region,
1820
+ transform,
1821
+ this._initialTransform,
1822
+ result
1823
+ );
1824
+ if (this._verticalExaggeration === 1.0) {
1825
+ return tileBoundingVolume;
1826
+ }
1827
+ if (tileBoundingVolume instanceof TileOrientedBoundingBox) {
1828
+ exaggerateBoundingBox(
1829
+ tileBoundingVolume,
1830
+ this._verticalExaggeration,
1831
+ this._verticalExaggerationRelativeHeight
1832
+ );
1833
+ } else {
1834
+ tileBoundingVolume.minimumHeight = VerticalExaggeration.getHeight(
1835
+ tileBoundingVolume.minimumHeight,
1836
+ this._verticalExaggeration,
1837
+ this._verticalExaggerationRelativeHeight
1838
+ );
1839
+ tileBoundingVolume.maximumHeight = VerticalExaggeration.getHeight(
1840
+ tileBoundingVolume.maximumHeight,
1841
+ this._verticalExaggeration,
1842
+ this._verticalExaggerationRelativeHeight
1843
+ );
1844
+ tileBoundingVolume.computeBoundingVolumes(Ellipsoid.WGS84);
1845
+ }
1846
+ return tileBoundingVolume;
1800
1847
  }
1801
1848
  if (defined(sphere)) {
1802
- return createSphere(sphere, transform, result);
1849
+ const tileBoundingSphere = createSphere(sphere, transform, result);
1850
+ if (this._verticalExaggeration !== 1.0) {
1851
+ const exaggeratedCenter = VerticalExaggeration.getPosition(
1852
+ tileBoundingSphere.center,
1853
+ Ellipsoid.WGS84,
1854
+ this._verticalExaggeration,
1855
+ this._verticalExaggerationRelativeHeight,
1856
+ scratchCenter
1857
+ );
1858
+ const exaggeratedRadius =
1859
+ tileBoundingSphere.radius * this._verticalExaggeration;
1860
+ tileBoundingSphere.update(exaggeratedCenter, exaggeratedRadius);
1861
+ }
1862
+ return tileBoundingSphere;
1803
1863
  }
1804
1864
  throw new RuntimeError(
1805
1865
  "boundingVolume must contain a sphere, region, or box"
1806
1866
  );
1807
1867
  };
1808
1868
 
1869
+ const scratchExaggeratedCorners = Cartesian3.unpackArray(
1870
+ new Array(8 * 3).fill(0)
1871
+ );
1872
+
1873
+ /**
1874
+ * Exaggerates the bounding box of a tile based on the provided exaggeration factors.
1875
+ *
1876
+ * @private
1877
+ * @param {TileOrientedBoundingBox} tileOrientedBoundingBox - The oriented bounding box of the tile.
1878
+ * @param {number} exaggeration - The exaggeration factor to apply to the tile's bounding box.
1879
+ * @param {number} exaggerationRelativeHeight - The height relative to which exaggeration will be applied.
1880
+ */
1881
+ function exaggerateBoundingBox(
1882
+ tileOrientedBoundingBox,
1883
+ exaggeration,
1884
+ exaggerationRelativeHeight
1885
+ ) {
1886
+ const exaggeratedCorners = tileOrientedBoundingBox.boundingVolume
1887
+ .computeCorners(scratchExaggeratedCorners)
1888
+ .map((corner) =>
1889
+ VerticalExaggeration.getPosition(
1890
+ corner,
1891
+ Ellipsoid.WGS84,
1892
+ exaggeration,
1893
+ exaggerationRelativeHeight,
1894
+ corner
1895
+ )
1896
+ );
1897
+ const exaggeratedBox = OrientedBoundingBox.fromPoints(
1898
+ exaggeratedCorners,
1899
+ scratchOrientedBoundingBox
1900
+ );
1901
+ tileOrientedBoundingBox.update(
1902
+ exaggeratedBox.center,
1903
+ exaggeratedBox.halfAxes
1904
+ );
1905
+ }
1906
+
1809
1907
  /**
1810
1908
  * Update the tile's transform. The transform is applied to the tile's bounding volumes.
1811
1909
  *
1812
1910
  * @private
1813
1911
  * @param {Matrix4} parentTransform
1912
+ * @param {FrameState} [frameState]
1814
1913
  */
1815
- Cesium3DTile.prototype.updateTransform = function (parentTransform) {
1914
+ Cesium3DTile.prototype.updateTransform = function (
1915
+ parentTransform,
1916
+ frameState
1917
+ ) {
1816
1918
  parentTransform = defaultValue(parentTransform, Matrix4.IDENTITY);
1817
1919
  const computedTransform = Matrix4.multiplyTransformation(
1818
1920
  parentTransform,
@@ -1823,12 +1925,23 @@ Cesium3DTile.prototype.updateTransform = function (parentTransform) {
1823
1925
  computedTransform,
1824
1926
  this.computedTransform
1825
1927
  );
1928
+ const exaggerationChanged =
1929
+ defined(frameState) &&
1930
+ (this._verticalExaggeration !== frameState.verticalExaggeration ||
1931
+ this._verticalExaggerationRelativeHeight !==
1932
+ frameState.verticalExaggerationRelativeHeight);
1826
1933
 
1827
- if (!transformChanged) {
1934
+ if (!transformChanged && !exaggerationChanged) {
1828
1935
  return;
1829
1936
  }
1830
-
1831
- Matrix4.clone(computedTransform, this.computedTransform);
1937
+ if (transformChanged) {
1938
+ Matrix4.clone(computedTransform, this.computedTransform);
1939
+ }
1940
+ if (exaggerationChanged) {
1941
+ this._verticalExaggeration = frameState.verticalExaggeration;
1942
+ this._verticalExaggerationRelativeHeight =
1943
+ frameState.verticalExaggerationRelativeHeight;
1944
+ }
1832
1945
 
1833
1946
  // Update the bounding volumes
1834
1947
  const header = this._header;
@@ -350,6 +350,20 @@ Cesium3DTileContent.prototype.update = function (tileset, frameState) {
350
350
  DeveloperError.throwInstantiationError();
351
351
  };
352
352
 
353
+ /**
354
+ * Find an intersection between a ray and the tile content surface that was rendered. The ray must be given in world coordinates.
355
+ *
356
+ * @param {Ray} ray The ray to test for intersection.
357
+ * @param {FrameState} frameState The frame state.
358
+ * @param {Cartesian3|undefined} [result] The intersection or <code>undefined</code> if none was found.
359
+ * @returns {Cartesian3|undefined} The intersection or <code>undefined</code> if none was found.
360
+ *
361
+ * @private
362
+ */
363
+ Cesium3DTileContent.prototype.pick = function (ray, frameState, result) {
364
+ DeveloperError.throwInstantiationError();
365
+ };
366
+
353
367
  /**
354
368
  * Returns true if this object was destroyed; otherwise, false.
355
369
  * <br /><br />