@cesium/engine 9.1.0 → 10.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 (255) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +108 -210
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +466 -568
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +54 -104
  4. package/Build/Workers/{chunk-TMMOULW3.js → chunk-2J3JKXCP.js} +5 -5
  5. package/Build/Workers/{chunk-ZDP32RQI.js → chunk-3WUV74WM.js} +95 -155
  6. package/Build/Workers/{chunk-FOZQIHZK.js → chunk-4BAE4PWO.js} +6 -6
  7. package/Build/Workers/{chunk-CYAJYEKW.js → chunk-4MSUJ4I7.js} +8 -8
  8. package/Build/Workers/{chunk-KPY4F4BW.js → chunk-4YSNMHZ4.js} +6 -6
  9. package/Build/Workers/{chunk-66E3H2KU.js → chunk-5S7OLEPK.js} +12 -12
  10. package/Build/Workers/{chunk-4AJGCQFX.js → chunk-7XGC6YB2.js} +14 -14
  11. package/Build/Workers/{chunk-BDUJXBVF.js → chunk-AA4GZKOT.js} +3 -5
  12. package/Build/Workers/{chunk-7LPEGKOF.js → chunk-AD5HBJ2F.js} +11 -8
  13. package/Build/Workers/{chunk-XHLDDE65.js → chunk-AVI4IUWC.js} +11 -11
  14. package/Build/Workers/{chunk-MWYZ64MH.js → chunk-BCL4PHHT.js} +10 -10
  15. package/Build/Workers/{chunk-PWF3YJJ5.js → chunk-BDFNKFOE.js} +13 -13
  16. package/Build/Workers/{chunk-7VZNXIKG.js → chunk-BJF5LOWE.js} +7 -7
  17. package/Build/Workers/{chunk-3S2MFY4B.js → chunk-C2CGMAIU.js} +13 -13
  18. package/Build/Workers/{chunk-UAJEGIWA.js → chunk-COYFZ5VA.js} +6 -6
  19. package/Build/Workers/{chunk-ZWPIM77Q.js → chunk-DGS5QNIO.js} +13 -13
  20. package/Build/Workers/{chunk-V7JB576Q.js → chunk-DKVHRNFY.js} +5 -5
  21. package/Build/Workers/{chunk-NI2R52QD.js → chunk-DOXCPOG4.js} +11 -9
  22. package/Build/Workers/{chunk-XWML5Y7N.js → chunk-FXIHSF7O.js} +9 -9
  23. package/Build/Workers/{chunk-LW7WGHEU.js → chunk-G3YR53LY.js} +13 -13
  24. package/Build/Workers/{chunk-34DGOKCO.js → chunk-GR3CDLCP.js} +7 -7
  25. package/Build/Workers/{chunk-AOIKO5Y7.js → chunk-GRAT5GE7.js} +5 -5
  26. package/Build/Workers/{chunk-AOFMPKUB.js → chunk-I2RC4XVN.js} +4 -4
  27. package/Build/Workers/{chunk-PK7TEP3J.js → chunk-JYAHOGGL.js} +15 -15
  28. package/Build/Workers/{chunk-4KIUON73.js → chunk-KUN2ZA5X.js} +4 -4
  29. package/Build/Workers/{chunk-POLFRINT.js → chunk-L6RTJ3RE.js} +14 -14
  30. package/Build/Workers/{chunk-LVJCR7DH.js → chunk-LCLJJ2MZ.js} +18 -18
  31. package/Build/Workers/{chunk-3RZK5NNV.js → chunk-LEABCTLP.js} +4 -4
  32. package/Build/Workers/{chunk-QKF7XXEQ.js → chunk-MDHQR3ZS.js} +10 -8
  33. package/Build/Workers/{chunk-4PHPQRSH.js → chunk-MSKXMXJI.js} +5 -6
  34. package/Build/Workers/{chunk-GIFJ77E4.js → chunk-NTXTUNEF.js} +4 -4
  35. package/Build/Workers/{chunk-I5TDPPC4.js → chunk-O3JCMSS3.js} +17 -17
  36. package/Build/Workers/{chunk-PEABJLCK.js → chunk-OOK53QUQ.js} +1 -1
  37. package/Build/Workers/{chunk-PS6AEMBR.js → chunk-OORVMGDU.js} +7 -7
  38. package/Build/Workers/{chunk-JI2445T5.js → chunk-PCP4YQST.js} +11 -11
  39. package/Build/Workers/{chunk-C5CE4OG6.js → chunk-PYHLO636.js} +42 -13
  40. package/Build/Workers/{chunk-S4XDCPKD.js → chunk-Q55ECN3Y.js} +1 -1
  41. package/Build/Workers/{chunk-WWP3I7R5.js → chunk-QD4KM3GO.js} +5 -5
  42. package/Build/Workers/{chunk-YLZTCEBJ.js → chunk-QMLTCCYG.js} +1 -1
  43. package/Build/Workers/{chunk-IBXGK4WV.js → chunk-QX5XS4LC.js} +2 -2
  44. package/Build/Workers/{chunk-RL73GOEF.js → chunk-R6B7UCQB.js} +2 -2
  45. package/Build/Workers/{chunk-RR7EOKGZ.js → chunk-RJYML24O.js} +48 -85
  46. package/Build/Workers/{chunk-U4IMCOF5.js → chunk-S3PI2KFM.js} +2 -2
  47. package/Build/Workers/{chunk-6HCAQOVK.js → chunk-STBBMQGG.js} +6 -6
  48. package/Build/Workers/{chunk-CE6GTZ4I.js → chunk-SYCPRK3D.js} +10 -10
  49. package/Build/Workers/{chunk-WFICTTOE.js → chunk-T77JILCU.js} +2 -2
  50. package/Build/Workers/{chunk-ZC4AGBZK.js → chunk-TO2PVHKI.js} +2 -2
  51. package/Build/Workers/{chunk-UCPPWV64.js → chunk-VE7BFUIX.js} +1 -1
  52. package/Build/Workers/{chunk-2CSEEWHN.js → chunk-VFBNELXB.js} +7 -7
  53. package/Build/Workers/{chunk-A6NCZSL3.js → chunk-VO3ACQB2.js} +19 -19
  54. package/Build/Workers/{chunk-WEGCQ5DY.js → chunk-X23FRWHJ.js} +6 -6
  55. package/Build/Workers/{chunk-G7CJQKKD.js → chunk-XD445VDH.js} +7 -7
  56. package/Build/Workers/combineGeometry.js +22 -22
  57. package/Build/Workers/createBoxGeometry.js +16 -16
  58. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  59. package/Build/Workers/createCircleGeometry.js +29 -25
  60. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +32 -32
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  63. package/Build/Workers/createCorridorGeometry.js +29 -29
  64. package/Build/Workers/createCorridorOutlineGeometry.js +27 -27
  65. package/Build/Workers/createCylinderGeometry.js +18 -18
  66. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  67. package/Build/Workers/createEllipseGeometry.js +24 -24
  68. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  69. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  71. package/Build/Workers/createFrustumGeometry.js +16 -16
  72. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  73. package/Build/Workers/createGeometry.js +22 -22
  74. package/Build/Workers/createGroundPolylineGeometry.js +24 -24
  75. package/Build/Workers/createPlaneGeometry.js +14 -14
  76. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  77. package/Build/Workers/createPolygonGeometry.js +32 -32
  78. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  79. package/Build/Workers/createPolylineGeometry.js +24 -24
  80. package/Build/Workers/createPolylineVolumeGeometry.js +30 -30
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +26 -26
  82. package/Build/Workers/createRectangleGeometry.js +27 -27
  83. package/Build/Workers/createRectangleOutlineGeometry.js +19 -19
  84. package/Build/Workers/createSimplePolylineGeometry.js +22 -22
  85. package/Build/Workers/createSphereGeometry.js +17 -17
  86. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  89. package/Build/Workers/createVectorTileGeometries.js +22 -22
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +20 -20
  92. package/Build/Workers/createVectorTilePolylines.js +13 -13
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  94. package/Build/Workers/createVerticesFromHeightmap.js +21 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  96. package/Build/Workers/createWallGeometry.js +23 -23
  97. package/Build/Workers/createWallOutlineGeometry.js +22 -22
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
  100. package/Build/Workers/decodeI3S.js +10 -10
  101. package/Build/Workers/transcodeKTX2.js +43 -79
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  104. package/Source/Core/ApproximateTerrainHeights.js +4 -4
  105. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +12 -8
  106. package/Source/Core/BoundingRectangle.js +2 -0
  107. package/Source/Core/BoundingSphere.js +4 -2
  108. package/Source/Core/Cartesian3.js +13 -10
  109. package/Source/Core/Cartographic.js +11 -8
  110. package/Source/Core/CesiumTerrainProvider.js +3 -2
  111. package/Source/Core/CircleGeometry.js +6 -2
  112. package/Source/Core/CircleOutlineGeometry.js +1 -1
  113. package/Source/Core/CoplanarPolygonGeometry.js +3 -3
  114. package/Source/Core/CorridorGeometry.js +4 -4
  115. package/Source/Core/CorridorOutlineGeometry.js +2 -2
  116. package/Source/Core/Credit.js +3 -2
  117. package/Source/Core/CustomHeightmapTerrainProvider.js +17 -3
  118. package/Source/Core/EllipseGeometry.js +4 -4
  119. package/Source/Core/EllipseOutlineGeometry.js +2 -2
  120. package/Source/Core/Ellipsoid.js +34 -0
  121. package/Source/Core/EllipsoidGeodesic.js +2 -2
  122. package/Source/Core/EllipsoidRhumbLine.js +4 -4
  123. package/Source/Core/EllipsoidTangentPlane.js +3 -3
  124. package/Source/Core/EllipsoidTerrainProvider.js +3 -3
  125. package/Source/Core/GeographicProjection.js +4 -3
  126. package/Source/Core/GeographicTilingScheme.js +3 -3
  127. package/Source/Core/GeometryPipeline.js +2 -2
  128. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -1
  129. package/Source/Core/GoogleMaps.js +1 -1
  130. package/Source/Core/GroundPolylineGeometry.js +1 -1
  131. package/Source/Core/HeightmapTessellator.js +2 -2
  132. package/Source/Core/Ion.js +1 -1
  133. package/Source/Core/Math.js +0 -5
  134. package/Source/Core/Occluder.js +3 -3
  135. package/Source/Core/OrientedBoundingBox.js +2 -2
  136. package/Source/Core/PolygonGeometry.js +4 -4
  137. package/Source/Core/PolygonGeometryLibrary.js +1 -1
  138. package/Source/Core/PolygonOutlineGeometry.js +3 -3
  139. package/Source/Core/PolygonPipeline.js +2 -2
  140. package/Source/Core/PolylineGeometry.js +2 -2
  141. package/Source/Core/PolylinePipeline.js +6 -6
  142. package/Source/Core/PolylineVolumeGeometry.js +2 -2
  143. package/Source/Core/PolylineVolumeOutlineGeometry.js +2 -2
  144. package/Source/Core/Rectangle.js +6 -6
  145. package/Source/Core/RectangleGeometry.js +6 -6
  146. package/Source/Core/RectangleGeometryLibrary.js +3 -0
  147. package/Source/Core/RectangleOutlineGeometry.js +2 -2
  148. package/Source/Core/Simon1994PlanetaryPositions.js +3 -2
  149. package/Source/Core/SimplePolylineGeometry.js +2 -2
  150. package/Source/Core/Stereographic.js +2 -2
  151. package/Source/Core/TaskProcessor.js +19 -3
  152. package/Source/Core/Transforms.js +17 -17
  153. package/Source/Core/VRTheWorldTerrainProvider.js +2 -2
  154. package/Source/Core/WallGeometry.js +3 -3
  155. package/Source/Core/WallOutlineGeometry.js +3 -3
  156. package/Source/Core/WebMercatorTilingScheme.js +3 -3
  157. package/Source/Core/createWorldTerrainAsync.js +2 -0
  158. package/Source/Core/sampleTerrain.js +3 -3
  159. package/Source/DataSources/BoxGeometryUpdater.js +2 -2
  160. package/Source/DataSources/CylinderGeometryUpdater.js +2 -2
  161. package/Source/DataSources/CzmlDataSource.js +8 -8
  162. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -3
  163. package/Source/DataSources/EntityCluster.js +1 -1
  164. package/Source/DataSources/EntityView.js +2 -2
  165. package/Source/DataSources/KmlDataSource.js +4 -4
  166. package/Source/DataSources/ModelVisualizer.js +1 -2
  167. package/Source/DataSources/PolygonGeometryUpdater.js +1 -1
  168. package/Source/DataSources/PolylineGeometryUpdater.js +3 -2
  169. package/Source/DataSources/RectangleGeometryUpdater.js +1 -1
  170. package/Source/DataSources/ScaledPositionProperty.js +2 -2
  171. package/Source/DataSources/TerrainOffsetProperty.js +3 -7
  172. package/Source/DataSources/VelocityOrientationProperty.js +2 -2
  173. package/Source/DataSources/exportKml.js +2 -2
  174. package/Source/Renderer/UniformState.js +1 -1
  175. package/Source/Scene/ArcGisMapServerImageryProvider.js +2 -2
  176. package/Source/Scene/ArcGisMapService.js +1 -1
  177. package/Source/Scene/Billboard.js +8 -6
  178. package/Source/Scene/BingMapsImageryProvider.js +1 -1
  179. package/Source/Scene/Camera.js +16 -10
  180. package/Source/Scene/Cesium3DTileset.js +1 -1
  181. package/Source/Scene/ClippingPolygon.js +2 -2
  182. package/Source/Scene/ClippingPolygonCollection.js +1 -1
  183. package/Source/Scene/CreditDisplay.js +94 -104
  184. package/Source/Scene/Globe.js +16 -13
  185. package/Source/Scene/GltfLoader.js +458 -435
  186. package/Source/Scene/GltfLoaderUtil.js +5 -16
  187. package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
  188. package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
  189. package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +1 -1
  190. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +1 -1
  191. package/Source/Scene/GridImageryProvider.js +2 -2
  192. package/Source/Scene/ImageryLayerCollection.js +2 -2
  193. package/Source/Scene/Label.js +1 -1
  194. package/Source/Scene/MapboxImageryProvider.js +1 -1
  195. package/Source/Scene/MapboxStyleImageryProvider.js +1 -1
  196. package/Source/Scene/MetadataSemantic.js +4 -4
  197. package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
  198. package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
  199. package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
  200. package/Source/Scene/Model/InstancingPipelineStage.js +3 -3
  201. package/Source/Scene/Model/LightingPipelineStage.js +2 -4
  202. package/Source/Scene/Model/MaterialPipelineStage.js +395 -29
  203. package/Source/Scene/Model/Model.js +15 -7
  204. package/Source/Scene/Model/ModelSceneGraph.js +1 -1
  205. package/Source/Scene/Model/ModelUtility.js +3 -0
  206. package/Source/Scene/Model/SceneMode2DPipelineStage.js +3 -3
  207. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
  208. package/Source/Scene/Model/pickModel.js +2 -2
  209. package/Source/Scene/ModelComponents.js +178 -1
  210. package/Source/Scene/PickDepth.js +23 -15
  211. package/Source/Scene/Picking.js +4 -13
  212. package/Source/Scene/PointPrimitive.js +5 -2
  213. package/Source/Scene/ResourceCache.js +41 -50
  214. package/Source/Scene/ResourceCacheKey.js +41 -53
  215. package/Source/Scene/Scene.js +39 -31
  216. package/Source/Scene/SceneTransforms.js +78 -20
  217. package/Source/Scene/SceneTransitioner.js +2 -2
  218. package/Source/Scene/ScreenSpaceCameraController.js +29 -19
  219. package/Source/Scene/SkyBox.js +26 -0
  220. package/Source/Scene/Sun.js +1 -1
  221. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -10
  222. package/Source/Shaders/Builtin/Functions/ellipsoidTextureCoordinates.glsl +10 -0
  223. package/Source/Shaders/Builtin/Functions/{ellipsoidWgs84TextureCoordinates.js → ellipsoidTextureCoordinates.js} +3 -3
  224. package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
  225. package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
  226. package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
  227. package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
  228. package/Source/Shaders/Builtin/Structs/materialInput.glsl +1 -1
  229. package/Source/Shaders/Builtin/Structs/materialInput.js +1 -1
  230. package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +16 -0
  231. package/Source/Shaders/Builtin/Structs/modelMaterial.js +16 -0
  232. package/Source/Shaders/EllipsoidFS.glsl +1 -1
  233. package/Source/Shaders/EllipsoidFS.js +1 -1
  234. package/Source/Shaders/GlobeFS.glsl +3 -3
  235. package/Source/Shaders/GlobeFS.js +3 -3
  236. package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
  237. package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
  238. package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
  239. package/Source/Shaders/Model/LightingStageFS.js +113 -48
  240. package/Source/Shaders/Model/MaterialStageFS.glsl +407 -136
  241. package/Source/Shaders/Model/MaterialStageFS.js +407 -136
  242. package/Source/Widget/CesiumWidget.css +0 -5
  243. package/Source/Widget/CesiumWidget.js +29 -28
  244. package/index.d.ts +184 -116
  245. package/index.js +92 -95
  246. package/package.json +2 -2
  247. package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
  248. package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
  249. package/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.glsl +0 -10
  250. package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
  251. package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
  252. package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
  253. package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
  254. package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
  255. package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
@@ -13,6 +13,7 @@ import defaultValue from "../Core/defaultValue.js";
13
13
  import defined from "../Core/defined.js";
14
14
  import destroyObject from "../Core/destroyObject.js";
15
15
  import DeveloperError from "../Core/DeveloperError.js";
16
+ import Ellipsoid from "../Core/Ellipsoid.js";
16
17
  import EllipsoidGeometry from "../Core/EllipsoidGeometry.js";
17
18
  import Event from "../Core/Event.js";
18
19
  import GeographicProjection from "../Core/GeographicProjection.js";
@@ -29,6 +30,7 @@ import OrthographicFrustum from "../Core/OrthographicFrustum.js";
29
30
  import OrthographicOffCenterFrustum from "../Core/OrthographicOffCenterFrustum.js";
30
31
  import PerspectiveFrustum from "../Core/PerspectiveFrustum.js";
31
32
  import PerspectiveOffCenterFrustum from "../Core/PerspectiveOffCenterFrustum.js";
33
+ import Rectangle from "../Core/Rectangle.js";
32
34
  import RequestScheduler from "../Core/RequestScheduler.js";
33
35
  import TaskProcessor from "../Core/TaskProcessor.js";
34
36
  import Transforms from "../Core/Transforms.js";
@@ -96,7 +98,8 @@ const requestRenderAfterFrame = function (scene) {
96
98
  * @param {ContextOptions} [options.contextOptions] Context and WebGL creation properties.
97
99
  * @param {Element} [options.creditContainer] The HTML element in which the credits will be displayed.
98
100
  * @param {Element} [options.creditViewport] The HTML element in which to display the credit popup. If not specified, the viewport will be a added as a sibling of the canvas.
99
- * @param {MapProjection} [options.mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes.
101
+ * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.default] The default ellipsoid. If not specified, the default ellipsoid is used.
102
+ * @param {MapProjection} [options.mapProjection=new GeographicProjection(options.ellipsoid)] The map projection to use in 2D and Columbus View modes.
100
103
  * @param {boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency.
101
104
  * @param {boolean} [options.scene3DOnly=false] If true, optimizes memory use and performance for 3D mode but disables the ability to use 2D or Columbus View.
102
105
  * @param {boolean} [options.shadows=false] Determines if shadows are cast by light sources.
@@ -153,7 +156,7 @@ function Scene(options) {
153
156
  this._jobScheduler = new JobScheduler();
154
157
  this._frameState = new FrameState(
155
158
  context,
156
- new CreditDisplay(creditContainer, " ", creditViewport),
159
+ new CreditDisplay(creditContainer, "•", creditViewport),
157
160
  this._jobScheduler
158
161
  );
159
162
  this._frameState.scene3DOnly = defaultValue(options.scene3DOnly, false);
@@ -163,6 +166,8 @@ function Scene(options) {
163
166
  this._canvas = canvas;
164
167
  this._context = context;
165
168
  this._computeEngine = new ComputeEngine(context);
169
+
170
+ this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.default);
166
171
  this._globe = undefined;
167
172
  this._globeTranslucencyState = new GlobeTranslucencyState();
168
173
  this._primitives = new PrimitiveCollection();
@@ -316,7 +321,7 @@ function Scene(options) {
316
321
 
317
322
  this._mapProjection = defined(options.mapProjection)
318
323
  ? options.mapProjection
319
- : new GeographicProjection();
324
+ : new GeographicProjection(this._ellipsoid);
320
325
 
321
326
  /**
322
327
  * The current morph transition time between 2D/Columbus View and 3D,
@@ -530,9 +535,21 @@ function Scene(options) {
530
535
  /**
531
536
  * Blends the atmosphere to geometry far from the camera for horizon views. Allows for additional
532
537
  * performance improvements by rendering less geometry and dispatching less terrain requests.
538
+ *
539
+ * Disbaled by default if an ellipsoid other than WGS84 is used.
533
540
  * @type {Fog}
534
541
  */
535
542
  this.fog = new Fog();
543
+ this.fog.enabled = Ellipsoid.WGS84.equals(this._ellipsoid);
544
+
545
+ if (!Ellipsoid.WGS84.equals(this._ellipsoid)) {
546
+ Camera.DEFAULT_VIEW_RECTANGLE = Rectangle.fromDegrees(
547
+ -45.0,
548
+ -45.0,
549
+ 45.0,
550
+ 45.0
551
+ );
552
+ }
536
553
 
537
554
  this._shadowMapCamera = new Camera(this);
538
555
 
@@ -914,6 +931,19 @@ Object.defineProperties(Scene.prototype, {
914
931
  },
915
932
  },
916
933
 
934
+ /**
935
+ * The ellipsoid. If not specified, the default ellipsoid is used.
936
+ * @memberof Scene.prototype
937
+ *
938
+ * @type {Ellipsoid}
939
+ * @readonly
940
+ */
941
+ ellipsoid: {
942
+ get: function () {
943
+ return this._ellipsoid;
944
+ },
945
+ },
946
+
917
947
  /**
918
948
  * Gets or sets the depth-test ellipsoid.
919
949
  * @memberof Scene.prototype
@@ -1853,7 +1883,7 @@ function getOccluder(scene) {
1853
1883
  !scene._cameraUnderground &&
1854
1884
  !scene._globeTranslucencyState.translucent
1855
1885
  ) {
1856
- const ellipsoid = globe.ellipsoid;
1886
+ const ellipsoid = scene.ellipsoid;
1857
1887
  const minimumTerrainHeight = scene.frameState.minimumTerrainHeight;
1858
1888
  scratchOccluderBoundingSphere.radius =
1859
1889
  ellipsoid.minimumRadius + minimumTerrainHeight;
@@ -3745,7 +3775,7 @@ Scene.prototype.updateHeight = function (
3745
3775
  }
3746
3776
 
3747
3777
  let tilesetRemoveCallbacks = {};
3748
- const ellipsoid = this.globe?.ellipsoid;
3778
+ const ellipsoid = this._ellipsoid;
3749
3779
  const createPrimitiveEventListener = (primitive) => {
3750
3780
  if (
3751
3781
  ignore3dTiles ||
@@ -4607,7 +4637,6 @@ Scene.prototype.clampToHeightMostDetailed = function (
4607
4637
  * @example
4608
4638
  * // Output the canvas position of longitude/latitude (0, 0) every time the mouse moves.
4609
4639
  * const scene = widget.scene;
4610
- * const ellipsoid = scene.globe.ellipsoid;
4611
4640
  * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
4612
4641
  * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
4613
4642
  * handler.setInputAction(function(movement) {
@@ -4615,7 +4644,7 @@ Scene.prototype.clampToHeightMostDetailed = function (
4615
4644
  * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
4616
4645
  */
4617
4646
  Scene.prototype.cartesianToCanvasCoordinates = function (position, result) {
4618
- return SceneTransforms.wgs84ToWindowCoordinates(this, position, result);
4647
+ return SceneTransforms.worldToWindowCoordinates(this, position, result);
4619
4648
  };
4620
4649
 
4621
4650
  /**
@@ -4630,15 +4659,8 @@ Scene.prototype.completeMorph = function () {
4630
4659
  * @param {number} [duration=2.0] The amount of time, in seconds, for transition animations to complete.
4631
4660
  */
4632
4661
  Scene.prototype.morphTo2D = function (duration) {
4633
- let ellipsoid;
4634
- const globe = this.globe;
4635
- if (defined(globe)) {
4636
- ellipsoid = globe.ellipsoid;
4637
- } else {
4638
- ellipsoid = this.mapProjection.ellipsoid;
4639
- }
4640
4662
  duration = defaultValue(duration, 2.0);
4641
- this._transitioner.morphTo2D(duration, ellipsoid);
4663
+ this._transitioner.morphTo2D(duration, this._ellipsoid);
4642
4664
  };
4643
4665
 
4644
4666
  /**
@@ -4646,15 +4668,8 @@ Scene.prototype.morphTo2D = function (duration) {
4646
4668
  * @param {number} [duration=2.0] The amount of time, in seconds, for transition animations to complete.
4647
4669
  */
4648
4670
  Scene.prototype.morphToColumbusView = function (duration) {
4649
- let ellipsoid;
4650
- const globe = this.globe;
4651
- if (defined(globe)) {
4652
- ellipsoid = globe.ellipsoid;
4653
- } else {
4654
- ellipsoid = this.mapProjection.ellipsoid;
4655
- }
4656
4671
  duration = defaultValue(duration, 2.0);
4657
- this._transitioner.morphToColumbusView(duration, ellipsoid);
4672
+ this._transitioner.morphToColumbusView(duration, this._ellipsoid);
4658
4673
  };
4659
4674
 
4660
4675
  /**
@@ -4662,15 +4677,8 @@ Scene.prototype.morphToColumbusView = function (duration) {
4662
4677
  * @param {number} [duration=2.0] The amount of time, in seconds, for transition animations to complete.
4663
4678
  */
4664
4679
  Scene.prototype.morphTo3D = function (duration) {
4665
- let ellipsoid;
4666
- const globe = this.globe;
4667
- if (defined(globe)) {
4668
- ellipsoid = globe.ellipsoid;
4669
- } else {
4670
- ellipsoid = this.mapProjection.ellipsoid;
4671
- }
4672
4680
  duration = defaultValue(duration, 2.0);
4673
- this._transitioner.morphTo3D(duration, ellipsoid);
4681
+ this._transitioner.morphTo3D(duration, this._ellipsoid);
4674
4682
  };
4675
4683
 
4676
4684
  function setTerrain(scene, terrain) {
@@ -4,6 +4,7 @@ import Cartesian3 from "../Core/Cartesian3.js";
4
4
  import Cartesian4 from "../Core/Cartesian4.js";
5
5
  import Cartographic from "../Core/Cartographic.js";
6
6
  import defined from "../Core/defined.js";
7
+ import deprecationWarning from "../Core/deprecationWarning.js";
7
8
  import DeveloperError from "../Core/DeveloperError.js";
8
9
  import CesiumMath from "../Core/Math.js";
9
10
  import Matrix4 from "../Core/Matrix4.js";
@@ -26,6 +27,32 @@ const scratchViewport = new BoundingRectangle();
26
27
  const scratchWindowCoord0 = new Cartesian2();
27
28
  const scratchWindowCoord1 = new Cartesian2();
28
29
 
30
+ /**
31
+ * Transforms a position in world (WGS84 or alternative ellipsoid) coordinates to window coordinates. This is commonly used to place an
32
+ * HTML element at the same screen position as an object in the scene.
33
+ *
34
+ * @param {Scene} scene The scene.
35
+ * @param {Cartesian3} position The position in world (WGS84 or alternative ellipsoid) coordinates.
36
+ * @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates.
37
+ * @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
38
+ *
39
+ * @example
40
+ * // Output the window position of longitude/latitude (0, 0) every time the mouse moves.
41
+ * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
42
+ * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
43
+ * handler.setInputAction(function(movement) {
44
+ * console.log(Cesium.SceneTransforms.worldToWindowCoordinates(scene, position));
45
+ * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
46
+ */
47
+ SceneTransforms.worldToWindowCoordinates = function (scene, position, result) {
48
+ return SceneTransforms.worldWithEyeOffsetToWindowCoordinates(
49
+ scene,
50
+ position,
51
+ Cartesian3.ZERO,
52
+ result
53
+ );
54
+ };
55
+
29
56
  /**
30
57
  * Transforms a position in WGS84 coordinates to window coordinates. This is commonly used to place an
31
58
  * HTML element at the same screen position as an object in the scene.
@@ -33,12 +60,12 @@ const scratchWindowCoord1 = new Cartesian2();
33
60
  * @param {Scene} scene The scene.
34
61
  * @param {Cartesian3} position The position in WGS84 (world) coordinates.
35
62
  * @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates.
36
- * @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
63
+ * @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
37
64
  *
38
65
  * @example
39
66
  * // Output the window position of longitude/latitude (0, 0) every time the mouse moves.
40
67
  * const scene = widget.scene;
41
- * const ellipsoid = scene.globe.ellipsoid;
68
+ * const ellipsoid = scene.ellipsoid;
42
69
  * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
43
70
  * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
44
71
  * handler.setInputAction(function(movement) {
@@ -46,12 +73,11 @@ const scratchWindowCoord1 = new Cartesian2();
46
73
  * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
47
74
  */
48
75
  SceneTransforms.wgs84ToWindowCoordinates = function (scene, position, result) {
49
- return SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(
50
- scene,
51
- position,
52
- Cartesian3.ZERO,
53
- result
76
+ deprecationWarning(
77
+ "SceneTransforms.wgs84ToWindowCoordinates",
78
+ "SceneTransforms.wgs84ToWindowCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToWindowCoordinates instead."
54
79
  );
80
+ return SceneTransforms.worldToWindowCoordinates(scene, position, result);
55
81
  };
56
82
 
57
83
  const scratchCartesian4 = new Cartesian4();
@@ -98,7 +124,7 @@ const scratchCameraPosition = new Cartesian3();
98
124
  /**
99
125
  * @private
100
126
  */
101
- SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates = function (
127
+ SceneTransforms.worldWithEyeOffsetToWindowCoordinates = function (
102
128
  scene,
103
129
  position,
104
130
  eyeOffset,
@@ -115,7 +141,7 @@ SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates = function (
115
141
 
116
142
  // Transform for 3D, 2D, or Columbus view
117
143
  const frameState = scene.frameState;
118
- const actualPosition = SceneTransforms.computeActualWgs84Position(
144
+ const actualPosition = SceneTransforms.computeActualEllipsoidPosition(
119
145
  frameState,
120
146
  position,
121
147
  actualPositionScratch
@@ -265,30 +291,28 @@ SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates = function (
265
291
  };
266
292
 
267
293
  /**
268
- * Transforms a position in WGS84 coordinates to drawing buffer coordinates. This may produce different
269
- * results from SceneTransforms.wgs84ToWindowCoordinates when the browser zoom is not 100%, or on high-DPI displays.
294
+ * Transforms a position in world coordinates to drawing buffer coordinates. This may produce different
295
+ * results from SceneTransforms.worldToWindowCoordinates when the browser zoom is not 100%, or on high-DPI displays.
270
296
  *
271
297
  * @param {Scene} scene The scene.
272
- * @param {Cartesian3} position The position in WGS84 (world) coordinates.
298
+ * @param {Cartesian3} position The position in world (WGS84 or alternative ellipsoid) coordinates.
273
299
  * @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates.
274
- * @returns {Cartesian2} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
300
+ * @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
275
301
  *
276
302
  * @example
277
303
  * // Output the window position of longitude/latitude (0, 0) every time the mouse moves.
278
- * const scene = widget.scene;
279
- * const ellipsoid = scene.globe.ellipsoid;
280
304
  * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
281
305
  * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
282
306
  * handler.setInputAction(function(movement) {
283
- * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
307
+ * console.log(Cesium.SceneTransforms.worldToDrawingBufferCoordinates(scene, position));
284
308
  * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
285
309
  */
286
- SceneTransforms.wgs84ToDrawingBufferCoordinates = function (
310
+ SceneTransforms.worldToDrawingBufferCoordinates = function (
287
311
  scene,
288
312
  position,
289
313
  result
290
314
  ) {
291
- result = SceneTransforms.wgs84ToWindowCoordinates(scene, position, result);
315
+ result = SceneTransforms.worldToWindowCoordinates(scene, position, result);
292
316
  if (!defined(result)) {
293
317
  return undefined;
294
318
  }
@@ -296,13 +320,47 @@ SceneTransforms.wgs84ToDrawingBufferCoordinates = function (
296
320
  return SceneTransforms.transformWindowToDrawingBuffer(scene, result, result);
297
321
  };
298
322
 
323
+ /**
324
+ * Transforms a position in world coordinates to drawing buffer coordinates. This may produce different
325
+ * results from SceneTransforms.wgs84ToWindowCoordinates when the browser zoom is not 100%, or on high-DPI displays.
326
+ *
327
+ * @param {Scene} scene The scene.
328
+ * @param {Cartesian3} position The position in world (WGS84 or alternative ellipsoid) coordinates.
329
+ * @param {Cartesian2} [result] An optional object to return the input position transformed to window coordinates.
330
+ * @returns {Cartesian2|undefined} The modified result parameter or a new Cartesian2 instance if one was not provided. This may be <code>undefined</code> if the input position is near the center of the ellipsoid.
331
+ *
332
+ * @example
333
+ * // Output the window position of longitude/latitude (0, 0) every time the mouse moves.
334
+ * const position = Cesium.Cartesian3.fromDegrees(0.0, 0.0);
335
+ * const handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
336
+ * handler.setInputAction(function(movement) {
337
+ * console.log(Cesium.SceneTransforms.wgs84ToWindowCoordinates(scene, position));
338
+ * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
339
+ */
340
+ SceneTransforms.wgs84ToDrawingBufferCoordinates = function (
341
+ scene,
342
+ position,
343
+ result
344
+ ) {
345
+ deprecationWarning(
346
+ "SceneTransforms.wgs84ToDrawingBufferCoordinates",
347
+ "SceneTransforms.wgs84ToDrawingBufferCoordinates has been deprecated. It will be removed in 1.21. Use SceneTransforms.worldToDrawingBufferCoordinates instead."
348
+ );
349
+
350
+ return SceneTransforms.worldToDrawingBufferCoordinates(
351
+ scene,
352
+ position,
353
+ result
354
+ );
355
+ };
356
+
299
357
  const projectedPosition = new Cartesian3();
300
358
  const positionInCartographic = new Cartographic();
301
359
 
302
360
  /**
303
361
  * @private
304
362
  */
305
- SceneTransforms.computeActualWgs84Position = function (
363
+ SceneTransforms.computeActualEllipsoidPosition = function (
306
364
  frameState,
307
365
  position,
308
366
  result
@@ -398,7 +456,7 @@ const scratchWorldCoords = new Cartesian4();
398
456
  /**
399
457
  * @private
400
458
  */
401
- SceneTransforms.drawingBufferToWgs84Coordinates = function (
459
+ SceneTransforms.drawingBufferToWorldCoordinates = function (
402
460
  scene,
403
461
  drawingBufferPosition,
404
462
  depth,
@@ -627,7 +627,7 @@ function morphFromColumbusViewTo2D(transitioner, duration) {
627
627
 
628
628
  if (duration > 0.0) {
629
629
  Cartesian3.clone(Cartesian3.ZERO, scratchCVTo2DEndPos);
630
- endPos.z = 5.0 * scene.mapProjection.ellipsoid.maximumRadius;
630
+ endPos.z = 5.0 * scene.ellipsoid.maximumRadius;
631
631
  } else {
632
632
  Cartesian3.clone(startPos, scratchCVTo2DEndPos);
633
633
 
@@ -1050,7 +1050,7 @@ function complete2DCallback(camera2D) {
1050
1050
 
1051
1051
  const camera = scene.camera;
1052
1052
  Cartesian3.clone(camera2D.position, camera.position);
1053
- camera.position.z = scene.mapProjection.ellipsoid.maximumRadius * 2.0;
1053
+ camera.position.z = scene.ellipsoid.maximumRadius * 2.0;
1054
1054
  Cartesian3.clone(camera2D.direction, camera.direction);
1055
1055
  Cartesian3.clone(camera2D.up, camera.up);
1056
1056
  Cartesian3.cross(camera.direction, camera.up, camera.right);
@@ -216,33 +216,46 @@ function ScreenSpaceCameraController(scene) {
216
216
  eventType: CameraEventType.LEFT_DRAG,
217
217
  modifier: KeyboardEventModifier.SHIFT,
218
218
  };
219
+
220
+ const ellipsoid = defaultValue(scene.ellipsoid, Ellipsoid.default);
221
+
219
222
  /**
220
- * The minimum height the camera must be before picking the terrain or scene content instead of the ellipsoid.
223
+ * The minimum height the camera must be before picking the terrain or scene content instead of the ellipsoid. Defaults to scene.ellipsoid.minimumRadius * 0.025 when another ellipsoid than WGS84 is used.
221
224
  * @type {number}
222
- * @default 150000.0
225
+ * @default 150000.0 or scene.ellipsoid.minimumRadius * 0.025
223
226
  */
224
- this.minimumPickingTerrainHeight = 150000.0;
227
+ this.minimumPickingTerrainHeight = Ellipsoid.WGS84.equals(ellipsoid)
228
+ ? 150000.0
229
+ : ellipsoid.minimumRadius * 0.025;
225
230
  this._minimumPickingTerrainHeight = this.minimumPickingTerrainHeight;
226
231
  /**
227
- * The minimum distance the camera must be before testing for collision with terrain when zoom with inertia.
232
+ * The minimum distance the camera must be before testing for collision with terrain when zoom with inertia. Default to scene.ellipsoid.minimumRadius * 0.00063 when another ellipsoid than WGS84 is used.
228
233
  * @type {number}
229
- * @default 4000.0
234
+ * @default 4000.0 or scene.ellipsoid.minimumRadius * 0.00063
230
235
  */
231
- this.minimumPickingTerrainDistanceWithInertia = 4000.0;
236
+ this.minimumPickingTerrainDistanceWithInertia = Ellipsoid.WGS84.equals(
237
+ ellipsoid
238
+ )
239
+ ? 4000.0
240
+ : ellipsoid.minimumRadius * 0.00063;
232
241
  /**
233
- * The minimum height the camera must be before testing for collision with terrain.
242
+ * The minimum height the camera must be before testing for collision with terrain. Default to scene.ellipsoid.minimumRadius * 0.0025 when another ellipsoid than WGS84 is used.
234
243
  * @type {number}
235
- * @default 15000.0
244
+ * @default 15000.0 or scene.ellipsoid.minimumRadius * 0.0025.
236
245
  */
237
- this.minimumCollisionTerrainHeight = 15000.0;
246
+ this.minimumCollisionTerrainHeight = Ellipsoid.WGS84.equals(ellipsoid)
247
+ ? 15000.0
248
+ : ellipsoid.minimumRadius * 0.0025;
238
249
  this._minimumCollisionTerrainHeight = this.minimumCollisionTerrainHeight;
239
250
  /**
240
251
  * The minimum height the camera must be before switching from rotating a track ball to
241
- * free look when clicks originate on the sky or in space.
252
+ * free look when clicks originate on the sky or in space. Defaults to ellipsoid.minimumRadius * 1.175 when another ellipsoid than WGS84 is used.
242
253
  * @type {number}
243
- * @default 7500000.0
254
+ * @default 7500000.0 or scene.ellipsoid.minimumRadius * 1.175
244
255
  */
245
- this.minimumTrackBallHeight = 7500000.0;
256
+ this.minimumTrackBallHeight = Ellipsoid.WGS84.equals(ellipsoid)
257
+ ? 7500000.0
258
+ : ellipsoid.minimumRadius * 1.175;
246
259
  this._minimumTrackBallHeight = this.minimumTrackBallHeight;
247
260
  /**
248
261
  * When disabled, the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored.
@@ -253,7 +266,7 @@ function ScreenSpaceCameraController(scene) {
253
266
 
254
267
  this._scene = scene;
255
268
  this._globe = undefined;
256
- this._ellipsoid = undefined;
269
+ this._ellipsoid = ellipsoid;
257
270
 
258
271
  this._lastGlobeHeight = 0.0;
259
272
 
@@ -920,7 +933,7 @@ function handleZoom(
920
933
 
921
934
  if ((!sameStartPosition && zoomOnVector) || zoomingOnVector) {
922
935
  let ray;
923
- const zoomMouseStart = SceneTransforms.wgs84ToWindowCoordinates(
936
+ const zoomMouseStart = SceneTransforms.worldToWindowCoordinates(
924
937
  scene,
925
938
  object._zoomWorldPosition,
926
939
  scratchZoomOffset
@@ -2861,14 +2874,13 @@ function adjustHeightForTerrain(controller, cameraChanged) {
2861
2874
 
2862
2875
  const scene = controller._scene;
2863
2876
  const mode = scene.mode;
2864
- const globe = scene.globe;
2865
2877
 
2866
2878
  if (mode === SceneMode.SCENE2D || mode === SceneMode.MORPHING) {
2867
2879
  return;
2868
2880
  }
2869
2881
 
2870
2882
  const camera = scene.camera;
2871
- const ellipsoid = defaultValue(globe?.ellipsoid, Ellipsoid.WGS84);
2883
+ const ellipsoid = defaultValue(scene.ellipsoid, Ellipsoid.WGS84);
2872
2884
  const projection = scene.mapProjection;
2873
2885
 
2874
2886
  let transform;
@@ -2967,9 +2979,7 @@ ScreenSpaceCameraController.prototype.update = function () {
2967
2979
  this._ellipsoid = Ellipsoid.UNIT_SPHERE;
2968
2980
  } else {
2969
2981
  this._globe = globe;
2970
- this._ellipsoid = defined(this._globe)
2971
- ? this._globe.ellipsoid
2972
- : scene.mapProjection.ellipsoid;
2982
+ this._ellipsoid = defaultValue(scene.ellipsoid, Ellipsoid.default);
2973
2983
  }
2974
2984
 
2975
2985
  const { verticalExaggeration, verticalExaggerationRelativeHeight } = scene;
@@ -1,3 +1,4 @@
1
+ import buildModuleUrl from "../Core/buildModuleUrl.js";
1
2
  import BoxGeometry from "../Core/BoxGeometry.js";
2
3
  import Cartesian3 from "../Core/Cartesian3.js";
3
4
  import defaultValue from "../Core/defaultValue.js";
@@ -249,4 +250,29 @@ SkyBox.prototype.destroy = function () {
249
250
  this._cubeMap = this._cubeMap && this._cubeMap.destroy();
250
251
  return destroyObject(this);
251
252
  };
253
+
254
+ function getDefaultSkyBoxUrl(suffix) {
255
+ return buildModuleUrl(`Assets/Textures/SkyBox/tycho2t3_80_${suffix}.jpg`);
256
+ }
257
+
258
+ /**
259
+ * Creates a skybox instance with the default starmap for the Earth.
260
+ * @return {SkyBox} The default skybox for the Earth
261
+ *
262
+ * @example
263
+ * viewer.scene.skyBox = Cesium.SkyBox.createEarthSkyBox();
264
+ */
265
+ SkyBox.createEarthSkyBox = function () {
266
+ return new SkyBox({
267
+ sources: {
268
+ positiveX: getDefaultSkyBoxUrl("px"),
269
+ negativeX: getDefaultSkyBoxUrl("mx"),
270
+ positiveY: getDefaultSkyBoxUrl("py"),
271
+ negativeY: getDefaultSkyBoxUrl("my"),
272
+ positiveZ: getDefaultSkyBoxUrl("pz"),
273
+ negativeZ: getDefaultSkyBoxUrl("mz"),
274
+ },
275
+ });
276
+ };
277
+
252
278
  export default SkyBox;
@@ -267,7 +267,7 @@ Sun.prototype.update = function (frameState, passState, useHdr) {
267
267
  BoundingSphere.clone(boundingVolume2D, drawCommand.boundingVolume);
268
268
  }
269
269
 
270
- const position = SceneTransforms.computeActualWgs84Position(
270
+ const position = SceneTransforms.computeActualEllipsoidPosition(
271
271
  frameState,
272
272
  sunPosition,
273
273
  scratchCartesian4
@@ -42,7 +42,6 @@ import czm_material from './Structs/material.js'
42
42
  import czm_materialInput from './Structs/materialInput.js'
43
43
  import czm_modelMaterial from './Structs/modelMaterial.js'
44
44
  import czm_modelVertexOutput from './Structs/modelVertexOutput.js'
45
- import czm_pbrParameters from './Structs/pbrParameters.js'
46
45
  import czm_ray from './Structs/ray.js'
47
46
  import czm_raySegment from './Structs/raySegment.js'
48
47
  import czm_shadowParameters from './Structs/shadowParameters.js'
@@ -72,11 +71,10 @@ import czm_computePosition from './Functions/computePosition.js'
72
71
  import czm_computeScattering from './Functions/computeScattering.js'
73
72
  import czm_cosineAndSine from './Functions/cosineAndSine.js'
74
73
  import czm_decompressTextureCoordinates from './Functions/decompressTextureCoordinates.js'
75
- import czm_defaultPbrMaterial from './Functions/defaultPbrMaterial.js'
76
74
  import czm_depthClamp from './Functions/depthClamp.js'
77
75
  import czm_eastNorthUpToEyeCoordinates from './Functions/eastNorthUpToEyeCoordinates.js'
78
76
  import czm_ellipsoidContainsPoint from './Functions/ellipsoidContainsPoint.js'
79
- import czm_ellipsoidWgs84TextureCoordinates from './Functions/ellipsoidWgs84TextureCoordinates.js'
77
+ import czm_ellipsoidTextureCoordinates from './Functions/ellipsoidTextureCoordinates.js'
80
78
  import czm_equalsEpsilon from './Functions/equalsEpsilon.js'
81
79
  import czm_eyeOffset from './Functions/eyeOffset.js'
82
80
  import czm_eyeToWindowCoordinates from './Functions/eyeToWindowCoordinates.js'
@@ -97,6 +95,7 @@ import czm_latitudeToWebMercatorFraction from './Functions/latitudeToWebMercator
97
95
  import czm_lineDistance from './Functions/lineDistance.js'
98
96
  import czm_linearToSrgb from './Functions/linearToSrgb.js'
99
97
  import czm_luminance from './Functions/luminance.js'
98
+ import czm_maximumComponent from './Functions/maximumComponent.js'
100
99
  import czm_metersPerPixel from './Functions/metersPerPixel.js'
101
100
  import czm_modelToWindowCoordinates from './Functions/modelToWindowCoordinates.js'
102
101
  import czm_multiplyWithColorBalance from './Functions/multiplyWithColorBalance.js'
@@ -104,8 +103,6 @@ import czm_nearFarScalar from './Functions/nearFarScalar.js'
104
103
  import czm_octDecode from './Functions/octDecode.js'
105
104
  import czm_packDepth from './Functions/packDepth.js'
106
105
  import czm_pbrLighting from './Functions/pbrLighting.js'
107
- import czm_pbrMetallicRoughnessMaterial from './Functions/pbrMetallicRoughnessMaterial.js'
108
- import czm_pbrSpecularGlossinessMaterial from './Functions/pbrSpecularGlossinessMaterial.js'
109
106
  import czm_phong from './Functions/phong.js'
110
107
  import czm_planeDistance from './Functions/planeDistance.js'
111
108
  import czm_pointAlongRay from './Functions/pointAlongRay.js'
@@ -183,7 +180,6 @@ export default {
183
180
  czm_materialInput : czm_materialInput,
184
181
  czm_modelMaterial : czm_modelMaterial,
185
182
  czm_modelVertexOutput : czm_modelVertexOutput,
186
- czm_pbrParameters : czm_pbrParameters,
187
183
  czm_ray : czm_ray,
188
184
  czm_raySegment : czm_raySegment,
189
185
  czm_shadowParameters : czm_shadowParameters,
@@ -213,11 +209,10 @@ export default {
213
209
  czm_computeScattering : czm_computeScattering,
214
210
  czm_cosineAndSine : czm_cosineAndSine,
215
211
  czm_decompressTextureCoordinates : czm_decompressTextureCoordinates,
216
- czm_defaultPbrMaterial : czm_defaultPbrMaterial,
217
212
  czm_depthClamp : czm_depthClamp,
218
213
  czm_eastNorthUpToEyeCoordinates : czm_eastNorthUpToEyeCoordinates,
219
214
  czm_ellipsoidContainsPoint : czm_ellipsoidContainsPoint,
220
- czm_ellipsoidWgs84TextureCoordinates : czm_ellipsoidWgs84TextureCoordinates,
215
+ czm_ellipsoidTextureCoordinates : czm_ellipsoidTextureCoordinates,
221
216
  czm_equalsEpsilon : czm_equalsEpsilon,
222
217
  czm_eyeOffset : czm_eyeOffset,
223
218
  czm_eyeToWindowCoordinates : czm_eyeToWindowCoordinates,
@@ -238,6 +233,7 @@ export default {
238
233
  czm_lineDistance : czm_lineDistance,
239
234
  czm_linearToSrgb : czm_linearToSrgb,
240
235
  czm_luminance : czm_luminance,
236
+ czm_maximumComponent : czm_maximumComponent,
241
237
  czm_metersPerPixel : czm_metersPerPixel,
242
238
  czm_modelToWindowCoordinates : czm_modelToWindowCoordinates,
243
239
  czm_multiplyWithColorBalance : czm_multiplyWithColorBalance,
@@ -245,8 +241,6 @@ export default {
245
241
  czm_octDecode : czm_octDecode,
246
242
  czm_packDepth : czm_packDepth,
247
243
  czm_pbrLighting : czm_pbrLighting,
248
- czm_pbrMetallicRoughnessMaterial : czm_pbrMetallicRoughnessMaterial,
249
- czm_pbrSpecularGlossinessMaterial : czm_pbrSpecularGlossinessMaterial,
250
244
  czm_phong : czm_phong,
251
245
  czm_planeDistance : czm_planeDistance,
252
246
  czm_pointAlongRay : czm_pointAlongRay,
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Approximate uv coordinates based on the ellipsoid normal.
3
+ *
4
+ * @name czm_ellipsoidTextureCoordinates
5
+ * @glslFunction
6
+ */
7
+ vec2 czm_ellipsoidTextureCoordinates(vec3 normal)
8
+ {
9
+ return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);
10
+ }
@@ -1,11 +1,11 @@
1
1
  //This file is automatically rebuilt by the Cesium build process.
2
2
  export default "/**\n\
3
- * DOC_TBA\n\
3
+ * Approximate uv coordinates based on the ellipsoid normal.\n\
4
4
  *\n\
5
- * @name czm_ellipsoidWgs84TextureCoordinates\n\
5
+ * @name czm_ellipsoidTextureCoordinates\n\
6
6
  * @glslFunction\n\
7
7
  */\n\
8
- vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n\
8
+ vec2 czm_ellipsoidTextureCoordinates(vec3 normal)\n\
9
9
  {\n\
10
10
  return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n\
11
11
  }\n\
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Find the maximum component of a vector.
3
+ *
4
+ * @name czm_maximumComponent
5
+ * @glslFunction
6
+ *
7
+ * @param {vec2|vec3|vec4} v The input vector.
8
+ * @returns {float} The value of the largest component.
9
+ */
10
+ float czm_maximumComponent(vec2 v)
11
+ {
12
+ return max(v.x, v.y);
13
+ }
14
+ float czm_maximumComponent(vec3 v)
15
+ {
16
+ return max(max(v.x, v.y), v.z);
17
+ }
18
+ float czm_maximumComponent(vec4 v)
19
+ {
20
+ return max(max(max(v.x, v.y), v.z), v.w);
21
+ }