@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
@@ -0,0 +1,69 @@
1
+ import Cartesian3 from "./Cartesian3.js";
2
+ import DeveloperError from "./DeveloperError.js";
3
+ import defined from "./defined.js";
4
+
5
+ /**
6
+ * @private
7
+ */
8
+ const VerticalExaggeration = {};
9
+
10
+ /**
11
+ * Scales a height relative to an offset.
12
+ *
13
+ * @param {number} height The height.
14
+ * @param {number} scale A scalar used to exaggerate the terrain. If the value is 1.0 there will be no effect.
15
+ * @param {number} relativeHeight The height relative to which terrain is exaggerated. If the value is 0.0 terrain will be exaggerated relative to the ellipsoid surface.
16
+ */
17
+ VerticalExaggeration.getHeight = function (height, scale, relativeHeight) {
18
+ //>>includeStart('debug', pragmas.debug);
19
+ if (!Number.isFinite(scale)) {
20
+ throw new DeveloperError("scale must be a finite number.");
21
+ }
22
+ if (!Number.isFinite(relativeHeight)) {
23
+ throw new DeveloperError("relativeHeight must be a finite number.");
24
+ }
25
+ //>>includeEnd('debug')
26
+ return (height - relativeHeight) * scale + relativeHeight;
27
+ };
28
+
29
+ const scratchCartographic = new Cartesian3();
30
+
31
+ /**
32
+ * Scales a position by exaggeration.
33
+ *
34
+ * @param {Cartesian3} position The position.
35
+ * @param {Ellipsoid} ellipsoid The ellipsoid.
36
+ * @param {number} verticalExaggeration A scalar used to exaggerate the terrain. If the value is 1.0 there will be no effect.
37
+ * @param {number} verticalExaggerationRelativeHeight The height relative to which terrain is exaggerated. If the value is 0.0 terrain will be exaggerated relative to the ellipsoid surface.
38
+ * @param {Cartesian3} [result] The object onto which to store the result.
39
+ */
40
+ VerticalExaggeration.getPosition = function (
41
+ position,
42
+ ellipsoid,
43
+ verticalExaggeration,
44
+ verticalExaggerationRelativeHeight,
45
+ result
46
+ ) {
47
+ const cartographic = ellipsoid.cartesianToCartographic(
48
+ position,
49
+ scratchCartographic
50
+ );
51
+ // If the position is too near the center of the ellipsoid, exaggeration is undefined.
52
+ if (!defined(cartographic)) {
53
+ return Cartesian3.clone(position, result);
54
+ }
55
+ const newHeight = VerticalExaggeration.getHeight(
56
+ cartographic.height,
57
+ verticalExaggeration,
58
+ verticalExaggerationRelativeHeight
59
+ );
60
+ return Cartesian3.fromRadians(
61
+ cartographic.longitude,
62
+ cartographic.latitude,
63
+ newHeight,
64
+ ellipsoid,
65
+ result
66
+ );
67
+ };
68
+
69
+ export default VerticalExaggeration;
@@ -0,0 +1,45 @@
1
+ import CesiumTerrainProvider from "./CesiumTerrainProvider.js";
2
+ import defaultValue from "./defaultValue.js";
3
+
4
+ /**
5
+ * Creates a {@link CesiumTerrainProvider} instance for the {@link https://cesium.com/content/#cesium-world-bathymetry|Cesium World Bathymetry}.
6
+ *
7
+ * @function
8
+ *
9
+ * @param {Object} [options] Object with the following properties:
10
+ * @param {Boolean} [options.requestVertexNormals=false] Flag that indicates if the client should request additional lighting information from the server if available.
11
+ * @returns {Promise<CesiumTerrainProvider>} A promise that resolves to the created CesiumTerrainProvider
12
+ *
13
+ * @see Ion
14
+ *
15
+ * @example
16
+ * // Create Cesium World Bathymetry with default settings
17
+ * try {
18
+ * const viewer = new Cesium.Viewer("cesiumContainer", {
19
+ * terrainProvider: await Cesium.createWorldBathymetryAsync();
20
+ * });
21
+ * } catch (error) {
22
+ * console.log(error);
23
+ * }
24
+ *
25
+ * @example
26
+ * // Create Cesium World Bathymetry with normals.
27
+ * try {
28
+ * const viewer1 = new Cesium.Viewer("cesiumContainer", {
29
+ * terrainProvider: await Cesium.createWorldBathymetryAsync({
30
+ * requestVertexNormals: true
31
+ * });
32
+ * });
33
+ * } catch (error) {
34
+ * console.log(error);
35
+ * }
36
+ *
37
+ */
38
+ function createWorldBathymetryAsync(options) {
39
+ options = defaultValue(options, defaultValue.EMPTY_OBJECT);
40
+
41
+ return CesiumTerrainProvider.fromIonAssetId(2426648, {
42
+ requestVertexNormals: defaultValue(options.requestVertexNormals, false),
43
+ });
44
+ }
45
+ export default createWorldBathymetryAsync;
@@ -547,11 +547,10 @@ DynamicEllipsoidGeometryUpdater.prototype.update = function (time) {
547
547
  options.radii = Cartesian3.clone(in3D ? unitSphere : radii, options.radii);
548
548
  if (defined(innerRadii)) {
549
549
  if (in3D) {
550
- const mag = Cartesian3.magnitude(radii);
551
550
  options.innerRadii = Cartesian3.fromElements(
552
- innerRadii.x / mag,
553
- innerRadii.y / mag,
554
- innerRadii.z / mag,
551
+ innerRadii.x / radii.x,
552
+ innerRadii.y / radii.y,
553
+ innerRadii.z / radii.z,
555
554
  options.innerRadii
556
555
  );
557
556
  } else {
@@ -13,7 +13,9 @@ import Quaternion from "../Core/Quaternion.js";
13
13
  import Transforms from "../Core/Transforms.js";
14
14
  import GroundPolylinePrimitive from "../Scene/GroundPolylinePrimitive.js";
15
15
  import GroundPrimitive from "../Scene/GroundPrimitive.js";
16
- import HeightReference from "../Scene/HeightReference.js";
16
+ import HeightReference, {
17
+ isHeightReferenceClamp,
18
+ } from "../Scene/HeightReference.js";
17
19
  import BillboardGraphics from "./BillboardGraphics.js";
18
20
  import BoxGraphics from "./BoxGraphics.js";
19
21
  import ConstantPositionProperty from "./ConstantPositionProperty.js";
@@ -71,8 +73,8 @@ function createPropertyTypeDescriptor(name, Type) {
71
73
  * @property {boolean} [show] A boolean value indicating if the entity and its children are displayed.
72
74
  * @property {Property | string} [description] A string Property specifying an HTML description for this entity.
73
75
  * @property {PositionProperty | Cartesian3} [position] A Property specifying the entity position.
74
- * @property {Property} [orientation] A Property specifying the entity orientation.
75
- * @property {Property} [viewFrom] A suggested initial offset for viewing this object.
76
+ * @property {Property | Quaternion} [orientation=Transforms.eastNorthUpToFixedFrame(position)] A Property specifying the entity orientation in respect to Earth-fixed-Earth-centered (ECEF). If undefined, east-north-up at entity position is used.
77
+ * @property {Property | Cartesian3} [viewFrom] A suggested initial offset for viewing this object.
76
78
  * @property {Entity} [parent] A parent entity to associate with this entity.
77
79
  * @property {BillboardGraphics | BillboardGraphics.ConstructorOptions} [billboard] A billboard to associate with this entity.
78
80
  * @property {BoxGraphics | BoxGraphics.ConstructorOptions} [box] A box to associate with this entity.
@@ -413,7 +415,8 @@ Object.defineProperties(Entity.prototype, {
413
415
  */
414
416
  tileset: createPropertyTypeDescriptor("tileset", Cesium3DTilesetGraphics),
415
417
  /**
416
- * Gets or sets the orientation.
418
+ * Gets or sets the orientation in respect to Earth-fixed-Earth-centered (ECEF).
419
+ * Defaults to east-north-up at entity position.
417
420
  * @memberof Entity.prototype
418
421
  * @type {Property|undefined}
419
422
  */
@@ -706,7 +709,7 @@ Entity.prototype.computeModelMatrixForHeightReference = function (
706
709
  }
707
710
 
708
711
  const carto = ellipsoid.cartesianToCartographic(position, cartoScratch);
709
- if (heightReference === HeightReference.CLAMP_TO_GROUND) {
712
+ if (isHeightReferenceClamp(heightReference)) {
710
713
  carto.height = heightOffset;
711
714
  } else {
712
715
  carto.height += heightOffset;
@@ -5,7 +5,6 @@ import DeveloperError from "../Core/DeveloperError.js";
5
5
  import Event from "../Core/Event.js";
6
6
  import Iso8601 from "../Core/Iso8601.js";
7
7
  import JulianDate from "../Core/JulianDate.js";
8
- import RuntimeError from "../Core/RuntimeError.js";
9
8
  import TimeInterval from "../Core/TimeInterval.js";
10
9
  import Entity from "./Entity.js";
11
10
 
@@ -281,7 +280,7 @@ EntityCollection.prototype.add = function (entity) {
281
280
  const id = entity.id;
282
281
  const entities = this._entities;
283
282
  if (entities.contains(id)) {
284
- throw new RuntimeError(
283
+ throw new DeveloperError(
285
284
  `An entity with id ${id} already exists in this collection.`
286
285
  );
287
286
  }
@@ -233,8 +233,7 @@ Object.defineProperties(GeometryUpdater.prototype, {
233
233
  },
234
234
  /**
235
235
  * Gets a value indicating if the geometry is time-varying.
236
- * If true, all visualization is delegated to a DynamicGeometryUpdater
237
- * returned by GeometryUpdater#createDynamicUpdater.
236
+ *
238
237
  * @memberof GeometryUpdater.prototype
239
238
  *
240
239
  * @type {boolean}
@@ -5,7 +5,9 @@ import DeveloperError from "../Core/DeveloperError.js";
5
5
  import GeometryOffsetAttribute from "../Core/GeometryOffsetAttribute.js";
6
6
  import oneTimeWarning from "../Core/oneTimeWarning.js";
7
7
  import GroundPrimitive from "../Scene/GroundPrimitive.js";
8
- import HeightReference from "../Scene/HeightReference.js";
8
+ import HeightReference, {
9
+ isHeightReferenceClamp,
10
+ } from "../Scene/HeightReference.js";
9
11
  import CallbackProperty from "./CallbackProperty.js";
10
12
  import ConstantProperty from "./ConstantProperty.js";
11
13
  import GeometryUpdater from "./GeometryUpdater.js";
@@ -164,9 +166,10 @@ GroundGeometryUpdater.getGeometryHeight = function (height, heightReference) {
164
166
  return;
165
167
  }
166
168
 
167
- if (heightReference !== HeightReference.CLAMP_TO_GROUND) {
169
+ if (!isHeightReferenceClamp(heightReference)) {
168
170
  return height;
169
171
  }
172
+
170
173
  return 0.0;
171
174
  };
172
175
 
@@ -186,7 +189,7 @@ GroundGeometryUpdater.getGeometryExtrudedHeight = function (
186
189
  }
187
190
  return;
188
191
  }
189
- if (extrudedHeightReference !== HeightReference.CLAMP_TO_GROUND) {
192
+ if (!isHeightReferenceClamp(extrudedHeightReference)) {
190
193
  return extrudedHeight;
191
194
  }
192
195
 
@@ -4,19 +4,22 @@ import Cartesian2 from "../Core/Cartesian2.js";
4
4
  import Cartesian3 from "../Core/Cartesian3.js";
5
5
  import Check from "../Core/Check.js";
6
6
  import Color from "../Core/Color.js";
7
+ import defaultValue from "../Core/defaultValue.js";
7
8
  import defined from "../Core/defined.js";
8
9
  import destroyObject from "../Core/destroyObject.js";
9
10
  import DeveloperError from "../Core/DeveloperError.js";
11
+ import Ellipsoid from "../Core/Ellipsoid.js";
10
12
  import Matrix4 from "../Core/Matrix4.js";
11
13
  import Resource from "../Core/Resource.js";
12
14
  import ColorBlendMode from "../Scene/ColorBlendMode.js";
13
- import HeightReference from "../Scene/HeightReference.js";
15
+ import HeightReference, {
16
+ isHeightReferenceClamp,
17
+ } from "../Scene/HeightReference.js";
14
18
  import Model from "../Scene/Model/Model.js";
15
19
  import ModelAnimationLoop from "../Scene/ModelAnimationLoop.js";
16
20
  import ShadowMode from "../Scene/ShadowMode.js";
17
21
  import BoundingSphereState from "./BoundingSphereState.js";
18
22
  import Property from "./Property.js";
19
- import sampleTerrainMostDetailed from "../Core/sampleTerrainMostDetailed.js";
20
23
  import Cartographic from "../Core/Cartographic.js";
21
24
 
22
25
  const defaultScale = 1.0;
@@ -172,9 +175,6 @@ ModelVisualizer.prototype.update = function (time) {
172
175
  articulationsScratch: {},
173
176
  loadFailed: false,
174
177
  modelUpdated: false,
175
- awaitingSampleTerrain: false,
176
- clampedBoundingSphere: undefined,
177
- sampleTerrainFailed: false,
178
178
  };
179
179
  modelHash[entity.id] = modelData;
180
180
 
@@ -399,9 +399,6 @@ ModelVisualizer.prototype.destroy = function () {
399
399
  return destroyObject(this);
400
400
  };
401
401
 
402
- // Used for testing.
403
- ModelVisualizer._sampleTerrainMostDetailed = sampleTerrainMostDetailed;
404
-
405
402
  const scratchPosition = new Cartesian3();
406
403
  const scratchCartographic = new Cartographic();
407
404
  /**
@@ -445,106 +442,30 @@ ModelVisualizer.prototype.getBoundingSphere = function (entity, result) {
445
442
 
446
443
  const scene = this._scene;
447
444
  const globe = scene.globe;
445
+ const ellipsoid = defaultValue(globe?.ellipsoid, Ellipsoid.WGS84);
448
446
 
449
- // cannot access a terrain provider if there is no globe; formally set to undefined
450
- const terrainProvider = defined(globe) ? globe.terrainProvider : undefined;
451
447
  const hasHeightReference = model.heightReference !== HeightReference.NONE;
452
- if (defined(globe) && hasHeightReference) {
453
- const ellipsoid = globe.ellipsoid;
448
+ if (hasHeightReference) {
454
449
  const modelMatrix = model.modelMatrix;
455
450
  scratchPosition.x = modelMatrix[12];
456
451
  scratchPosition.y = modelMatrix[13];
457
452
  scratchPosition.z = modelMatrix[14];
458
- const cartoPosition = ellipsoid.cartesianToCartographic(scratchPosition);
459
-
460
- // For a terrain provider that does not have availability, like the EllipsoidTerrainProvider,
461
- // we can directly assign the bounding sphere's center from model matrix's translation.
462
- if (!defined(terrainProvider.availability)) {
463
- // Regardless of what the original model's position is set to, for CLAMP_TO_GROUND, we reset it to 0
464
- // when computing the position to zoom/fly to.
465
- if (model.heightReference === HeightReference.CLAMP_TO_GROUND) {
466
- cartoPosition.height = 0;
467
- }
468
-
469
- const scratchPosition = ellipsoid.cartographicToCartesian(cartoPosition);
470
- BoundingSphere.clone(model.boundingSphere, result);
471
- result.center = scratchPosition;
472
-
473
- return BoundingSphereState.DONE;
474
- }
475
-
476
- // Otherwise, in the case of terrain providers with availability,
477
- // since the model's bounding sphere may be clamped to a lower LOD tile if
478
- // the camera is initially far away, we use sampleTerrainMostDetailed to estimate
479
- // where the bounding sphere should be and set that as the target bounding sphere
480
- // for the camera.
481
- let clampedBoundingSphere = this._modelHash[entity.id]
482
- .clampedBoundingSphere;
483
-
484
- // Check if the sample terrain function has failed.
485
- const sampleTerrainFailed = this._modelHash[entity.id].sampleTerrainFailed;
486
- if (sampleTerrainFailed) {
487
- this._modelHash[entity.id].sampleTerrainFailed = false;
488
- return BoundingSphereState.FAILED;
489
- }
453
+ const cartoPosition = ellipsoid.cartesianToCartographic(
454
+ scratchPosition,
455
+ scratchCartographic
456
+ );
490
457
 
491
- if (!defined(clampedBoundingSphere)) {
492
- clampedBoundingSphere = new BoundingSphere();
493
-
494
- // Since this function is called per-frame, we set a flag when sampleTerrainMostDetailed
495
- // is called and check for it to avoid calling it again.
496
- const awaitingSampleTerrain = this._modelHash[entity.id]
497
- .awaitingSampleTerrain;
498
- if (!awaitingSampleTerrain) {
499
- Cartographic.clone(cartoPosition, scratchCartographic);
500
- this._modelHash[entity.id].awaitingSampleTerrain = true;
501
- ModelVisualizer._sampleTerrainMostDetailed(terrainProvider, [
502
- scratchCartographic,
503
- ])
504
- .then((result) => {
505
- if (this.isDestroyed()) {
506
- return;
507
- }
508
-
509
- this._modelHash[entity.id].awaitingSampleTerrain = false;
510
-
511
- const updatedCartographic = result[0];
512
- if (model.heightReference === HeightReference.RELATIVE_TO_GROUND) {
513
- updatedCartographic.height += cartoPosition.height;
514
- }
515
- ellipsoid.cartographicToCartesian(
516
- updatedCartographic,
517
- scratchPosition
518
- );
519
-
520
- // Update the bounding sphere with the updated position.
521
- BoundingSphere.clone(model.boundingSphere, clampedBoundingSphere);
522
- clampedBoundingSphere.center = scratchPosition;
523
-
524
- this._modelHash[
525
- entity.id
526
- ].clampedBoundingSphere = BoundingSphere.clone(
527
- clampedBoundingSphere
528
- );
529
- })
530
- .catch((e) => {
531
- if (this.isDestroyed()) {
532
- return;
533
- }
534
-
535
- this._modelHash[entity.id].sampleTerrainFailed = true;
536
- this._modelHash[entity.id].awaitingSampleTerrain = false;
537
- });
458
+ const height = scene.getHeight(cartoPosition, model.heightReference);
459
+ if (defined(height)) {
460
+ if (isHeightReferenceClamp(model.heightReference)) {
461
+ cartoPosition.height = height;
462
+ } else {
463
+ cartoPosition.height += height;
538
464
  }
539
-
540
- // We will return the state as pending until the clamped bounding sphere is defined,
541
- // which happens when the sampleTerrainMostDetailed promise returns.
542
- return BoundingSphereState.PENDING;
543
465
  }
544
466
 
545
- BoundingSphere.clone(clampedBoundingSphere, result);
546
- // Reset the clamped bounding sphere.
547
- this._modelHash[entity.id].clampedBoundingSphere = undefined;
467
+ BoundingSphere.clone(model.boundingSphere, result);
468
+ result.center = ellipsoid.cartographicToCartesian(cartoPosition);
548
469
  return BoundingSphereState.DONE;
549
470
  }
550
471
 
@@ -418,8 +418,14 @@ PolygonGeometryUpdater.prototype._setStaticOptions = function (
418
418
  extrudedHeightReferenceValue
419
419
  );
420
420
  if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
421
+ const rectangle = PolygonGeometry.computeRectangleFromPositions(
422
+ options.polygonHierarchy.positions,
423
+ options.ellipsoid,
424
+ options.arcType,
425
+ scratchRectangle
426
+ );
421
427
  extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(
422
- PolygonGeometry.computeRectangle(options, scratchRectangle)
428
+ rectangle
423
429
  ).minimumTerrainHeight;
424
430
  }
425
431
 
@@ -565,8 +571,14 @@ DyanmicPolygonGeometryUpdater.prototype._setOptions = function (
565
571
  extrudedHeightReferenceValue
566
572
  );
567
573
  if (extrudedHeightValue === GroundGeometryUpdater.CLAMP_TO_GROUND) {
574
+ const rectangle = PolygonGeometry.computeRectangleFromPositions(
575
+ options.polygonHierarchy.positions,
576
+ options.ellipsoid,
577
+ options.arcType,
578
+ scratchRectangle
579
+ );
568
580
  extrudedHeightValue = ApproximateTerrainHeights.getMinimumMaximumHeights(
569
- PolygonGeometry.computeRectangle(options, scratchRectangle)
581
+ rectangle
570
582
  ).minimumTerrainHeight;
571
583
  }
572
584
 
@@ -249,8 +249,7 @@ Object.defineProperties(PolylineGeometryUpdater.prototype, {
249
249
  },
250
250
  /**
251
251
  * Gets a value indicating if the geometry is time-varying.
252
- * If true, all visualization is delegated to the {@link DynamicGeometryUpdater}
253
- * returned by GeometryUpdater#createDynamicUpdater.
252
+ *
254
253
  * @memberof PolylineGeometryUpdater.prototype
255
254
  *
256
255
  * @type {boolean}
@@ -661,12 +660,13 @@ function getLine(dynamicGeometryUpdater) {
661
660
  return dynamicGeometryUpdater._line;
662
661
  }
663
662
 
664
- const sceneId = dynamicGeometryUpdater._geometryUpdater._scene.id;
665
- let polylineCollection = polylineCollections[sceneId];
666
663
  const primitives = dynamicGeometryUpdater._primitives;
664
+ const polylineCollectionId =
665
+ dynamicGeometryUpdater._geometryUpdater._scene.id + primitives._guid;
666
+ let polylineCollection = polylineCollections[polylineCollectionId];
667
667
  if (!defined(polylineCollection) || polylineCollection.isDestroyed()) {
668
668
  polylineCollection = new PolylineCollection();
669
- polylineCollections[sceneId] = polylineCollection;
669
+ polylineCollections[polylineCollectionId] = polylineCollection;
670
670
  primitives.add(polylineCollection);
671
671
  } else if (!primitives.contains(polylineCollection)) {
672
672
  primitives.add(polylineCollection);
@@ -869,13 +869,14 @@ DynamicGeometryUpdater.prototype.isDestroyed = function () {
869
869
 
870
870
  DynamicGeometryUpdater.prototype.destroy = function () {
871
871
  const geometryUpdater = this._geometryUpdater;
872
- const sceneId = geometryUpdater._scene.id;
873
- const polylineCollection = polylineCollections[sceneId];
872
+ const polylineCollectionId =
873
+ geometryUpdater._scene.id + this._primitives._guid;
874
+ const polylineCollection = polylineCollections[polylineCollectionId];
874
875
  if (defined(polylineCollection)) {
875
876
  polylineCollection.remove(this._line);
876
877
  if (polylineCollection.length === 0) {
877
878
  this._primitives.removeAndDestroy(polylineCollection);
878
- delete polylineCollections[sceneId];
879
+ delete polylineCollections[polylineCollectionId];
879
880
  }
880
881
  }
881
882
  if (defined(this._groundPolylinePrimitive)) {
@@ -6,12 +6,12 @@ import destroyObject from "../Core/destroyObject.js";
6
6
  import Event from "../Core/Event.js";
7
7
  import Iso8601 from "../Core/Iso8601.js";
8
8
  import CesiumMath from "../Core/Math.js";
9
- import HeightReference from "../Scene/HeightReference.js";
10
- import SceneMode from "../Scene/SceneMode.js";
9
+ import HeightReference, {
10
+ isHeightReferenceRelative,
11
+ } from "../Scene/HeightReference.js";
11
12
  import Property from "./Property.js";
12
13
 
13
14
  const scratchPosition = new Cartesian3();
14
- const scratchCarto = new Cartographic();
15
15
 
16
16
  /**
17
17
  * @private
@@ -118,40 +118,32 @@ TerrainOffsetProperty.prototype._updateClamping = function () {
118
118
  const globe = scene.globe;
119
119
  const position = this._position;
120
120
 
121
- if (!defined(globe) || Cartesian3.equals(position, Cartesian3.ZERO)) {
121
+ if (Cartesian3.equals(position, Cartesian3.ZERO)) {
122
122
  this._terrainHeight = 0;
123
123
  return;
124
124
  }
125
125
  const ellipsoid = globe.ellipsoid;
126
- const surface = globe._surface;
127
-
128
- const that = this;
129
126
  const cartographicPosition = ellipsoid.cartesianToCartographic(
130
127
  position,
131
128
  this._cartographicPosition
132
129
  );
133
- const height = globe.getHeight(cartographicPosition);
130
+
131
+ const height = scene.getHeight(cartographicPosition, this._heightReference);
134
132
  if (defined(height)) {
135
133
  this._terrainHeight = height;
136
134
  } else {
137
135
  this._terrainHeight = 0;
138
136
  }
139
137
 
140
- function updateFunction(clampedPosition) {
141
- if (scene.mode === SceneMode.SCENE3D) {
142
- const carto = ellipsoid.cartesianToCartographic(
143
- clampedPosition,
144
- scratchCarto
145
- );
146
- that._terrainHeight = carto.height;
147
- } else {
148
- that._terrainHeight = clampedPosition.x;
149
- }
150
- that.definitionChanged.raiseEvent();
151
- }
152
- this._removeCallbackFunc = surface.updateHeight(
138
+ const updateFunction = (clampedPosition) => {
139
+ this._terrainHeight = clampedPosition.height;
140
+ this.definitionChanged.raiseEvent();
141
+ };
142
+
143
+ this._removeCallbackFunc = scene.updateHeight(
153
144
  cartographicPosition,
154
- updateFunction
145
+ updateFunction,
146
+ this._heightReference
155
147
  );
156
148
  };
157
149
 
@@ -174,7 +166,7 @@ TerrainOffsetProperty.prototype.getValue = function (time, result) {
174
166
 
175
167
  if (
176
168
  heightReference === HeightReference.NONE &&
177
- extrudedHeightReference !== HeightReference.RELATIVE_TO_GROUND
169
+ !isHeightReferenceRelative(extrudedHeightReference)
178
170
  ) {
179
171
  this._position = Cartesian3.clone(Cartesian3.ZERO, this._position);
180
172
  return Cartesian3.clone(Cartesian3.ZERO, result);