@cesium/engine 6.2.0 → 8.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 (268) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
  2. package/Build/Workers/{chunk-RH4N2ONY.js → chunk-23UFSGND.js} +7 -7
  3. package/Build/Workers/{chunk-HPP4JLNH.js → chunk-2A75IWRS.js} +7 -7
  4. package/Build/Workers/{chunk-5IRLXUTA.js → chunk-2FRVPMCS.js} +10 -10
  5. package/Build/Workers/{chunk-ZQRZBHYI.js → chunk-2FWRMUTY.js} +4 -4
  6. package/Build/Workers/{chunk-Z2SIPUKB.js → chunk-2UPKWTMJ.js} +6 -6
  7. package/Build/Workers/{chunk-434ZTTFX.js → chunk-34FXV7D7.js} +2 -2
  8. package/Build/Workers/{chunk-MW3CJYLX.js → chunk-3VAZEH7M.js} +2 -2
  9. package/Build/Workers/{chunk-HUPNRBWW.js → chunk-4DO5W5XZ.js} +6 -6
  10. package/Build/Workers/{chunk-PIXK6KHB.js → chunk-4H7PY4U5.js} +2 -2
  11. package/Build/Workers/{chunk-BP467WX3.js → chunk-5QULIR53.js} +4 -4
  12. package/Build/Workers/{chunk-R3HUGXBH.js → chunk-7TC63SJW.js} +8 -8
  13. package/Build/Workers/{chunk-SQVTYRZY.js → chunk-7ZFGPDJA.js} +4 -4
  14. package/Build/Workers/{chunk-TIXXVKUY.js → chunk-A5DWLWCY.js} +10 -10
  15. package/Build/Workers/{chunk-CWJQGBWT.js → chunk-BBWDMCVU.js} +1 -1
  16. package/Build/Workers/{chunk-4KP73B43.js → chunk-BG4UCVXN.js} +3 -3
  17. package/Build/Workers/{chunk-Y4OJ4B23.js → chunk-BIKA3NRA.js} +5 -5
  18. package/Build/Workers/{chunk-DR5XZ6K5.js → chunk-BROJAZRZ.js} +13 -13
  19. package/Build/Workers/{chunk-FWGNCYP6.js → chunk-DDUQAJ4P.js} +7 -7
  20. package/Build/Workers/{chunk-QRBRVGZC.js → chunk-EERJKOAF.js} +4 -4
  21. package/Build/Workers/{chunk-52VSIKEA.js → chunk-EG6PTBY2.js} +15 -15
  22. package/Build/Workers/{chunk-O43GWBSF.js → chunk-EHWHNOEX.js} +1 -1
  23. package/Build/Workers/{chunk-MN34FIF5.js → chunk-F3YA3Y2Z.js} +1 -1
  24. package/Build/Workers/{chunk-GF5TNNKP.js → chunk-F4HFJMGM.js} +6 -6
  25. package/Build/Workers/{chunk-HOT2SNXP.js → chunk-FJKNFAKQ.js} +133 -553
  26. package/Build/Workers/{chunk-TMPVBFJQ.js → chunk-FNIRWHJB.js} +10 -10
  27. package/Build/Workers/{chunk-DMCSY5BU.js → chunk-FZRIVR7Y.js} +5 -5
  28. package/Build/Workers/{chunk-Z4JUBRHP.js → chunk-G43QFN4Q.js} +6 -6
  29. package/Build/Workers/{chunk-HPH5HSFE.js → chunk-GATZHF3K.js} +2 -2
  30. package/Build/Workers/{chunk-CSIZ3BGT.js → chunk-GRC2ZTAF.js} +14 -14
  31. package/Build/Workers/{chunk-NE4JNU6H.js → chunk-HU6N6EXB.js} +10 -10
  32. package/Build/Workers/{chunk-GVL5I7TC.js → chunk-I46ZRR5W.js} +17 -17
  33. package/Build/Workers/{chunk-5GDBZTHX.js → chunk-JURN7NPV.js} +17 -17
  34. package/Build/Workers/{chunk-H5DUXHCV.js → chunk-KKCR2YOP.js} +11 -11
  35. package/Build/Workers/{chunk-LX6XV4DK.js → chunk-LPR3YNP2.js} +5 -5
  36. package/Build/Workers/{chunk-HFKSAB5K.js → chunk-M7ERACJJ.js} +13 -13
  37. package/Build/Workers/{chunk-BUZDZBUH.js → chunk-MDWEGWPA.js} +10 -10
  38. package/Build/Workers/{chunk-LGJUI2CE.js → chunk-OGXZVPPM.js} +9 -5
  39. package/Build/Workers/{chunk-PZ2WJWUG.js → chunk-PGSJK77E.js} +6 -6
  40. package/Build/Workers/{chunk-ARPTYYKS.js → chunk-PPH7OFP3.js} +5 -5
  41. package/Build/Workers/{chunk-R4OZKBXH.js → chunk-SH5USDPI.js} +6 -6
  42. package/Build/Workers/{chunk-SV7DDPAC.js → chunk-SOWMRMWA.js} +1 -1
  43. package/Build/Workers/{chunk-RIDPF7PO.js → chunk-STW2DGFI.js} +2 -2
  44. package/Build/Workers/{chunk-CDGHUKQ4.js → chunk-T3XIFPYR.js} +13 -13
  45. package/Build/Workers/chunk-TTUZP4BO.js +501 -0
  46. package/Build/Workers/{chunk-QTZQZY2C.js → chunk-UEXTBDBE.js} +34 -10
  47. package/Build/Workers/{chunk-XUTVA4K5.js → chunk-VOXYEYJT.js} +11 -11
  48. package/Build/Workers/{chunk-AXFRNOVC.js → chunk-X4356LRH.js} +12 -12
  49. package/Build/Workers/{chunk-5HLGKKG3.js → chunk-XGI5BXZY.js} +2 -2
  50. package/Build/Workers/{chunk-SNN7WOC2.js → chunk-Y2ME2IJV.js} +13 -13
  51. package/Build/Workers/{chunk-LGL4P5KL.js → chunk-Y5UQJLYE.js} +6 -6
  52. package/Build/Workers/{chunk-3PW6ZBN4.js → chunk-YJEBABKH.js} +7 -7
  53. package/Build/Workers/{chunk-YBKFS53K.js → chunk-YWTJ2B4B.js} +1 -1
  54. package/Build/Workers/{chunk-5SK36PU4.js → chunk-Z3TIFFGF.js} +7 -7
  55. package/Build/Workers/{chunk-JGG36SQV.js → chunk-ZT7KWISZ.js} +4 -4
  56. package/Build/Workers/combineGeometry.js +24 -23
  57. package/Build/Workers/createBoxGeometry.js +18 -17
  58. package/Build/Workers/createBoxOutlineGeometry.js +16 -15
  59. package/Build/Workers/createCircleGeometry.js +26 -25
  60. package/Build/Workers/createCircleOutlineGeometry.js +19 -18
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
  63. package/Build/Workers/createCorridorGeometry.js +29 -29
  64. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  65. package/Build/Workers/createCylinderGeometry.js +20 -19
  66. package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
  67. package/Build/Workers/createEllipseGeometry.js +26 -25
  68. package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
  69. package/Build/Workers/createEllipsoidGeometry.js +19 -18
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
  71. package/Build/Workers/createFrustumGeometry.js +18 -17
  72. package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
  73. package/Build/Workers/createGeometry.js +54 -33
  74. package/Build/Workers/createGroundPolylineGeometry.js +22 -21
  75. package/Build/Workers/createPlaneGeometry.js +16 -15
  76. package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
  77. package/Build/Workers/createPolygonGeometry.js +32 -166
  78. package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
  79. package/Build/Workers/createPolylineGeometry.js +25 -24
  80. package/Build/Workers/createPolylineVolumeGeometry.js +32 -33
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  82. package/Build/Workers/createRectangleGeometry.js +27 -26
  83. package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
  84. package/Build/Workers/createSimplePolylineGeometry.js +23 -22
  85. package/Build/Workers/createSphereGeometry.js +19 -18
  86. package/Build/Workers/createSphereOutlineGeometry.js +18 -17
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  89. package/Build/Workers/createVectorTileGeometries.js +24 -23
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +22 -21
  92. package/Build/Workers/createVectorTilePolylines.js +14 -14
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
  94. package/Build/Workers/createVerticesFromHeightmap.js +22 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
  96. package/Build/Workers/createWallGeometry.js +24 -23
  97. package/Build/Workers/createWallOutlineGeometry.js +23 -22
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  100. package/Build/Workers/decodeI3S.js +601 -92
  101. package/Build/Workers/transcodeKTX2.js +7 -7
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
  104. package/LICENSE.md +1 -1
  105. package/Source/Assets/approximateTerrainHeights.json +1 -1
  106. package/Source/Core/Ellipsoid.js +6 -0
  107. package/Source/Core/GregorianDate.js +85 -0
  108. package/Source/Core/HeadingPitchRange.js +2 -2
  109. package/Source/Core/IntersectionTests.js +6 -3
  110. package/Source/Core/Ion.js +1 -1
  111. package/Source/Core/PixelFormat.js +5 -0
  112. package/Source/Core/PolygonGeometry.js +0 -169
  113. package/Source/Core/Resource.js +30 -69
  114. package/Source/Core/Transforms.js +30 -18
  115. package/Source/Core/createWorldBathymetryAsync.js +45 -0
  116. package/Source/Core/srgbToLinear.js +32 -0
  117. package/Source/DataSources/CzmlDataSource.js +51 -23
  118. package/Source/DataSources/DataSourceDisplay.js +27 -0
  119. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
  120. package/Source/DataSources/Entity.js +28 -7
  121. package/Source/DataSources/EntityCollection.js +1 -2
  122. package/Source/DataSources/GeometryUpdater.js +1 -2
  123. package/Source/DataSources/GeometryUpdaterSet.js +114 -0
  124. package/Source/DataSources/GeometryVisualizer.js +19 -83
  125. package/Source/DataSources/GroundGeometryUpdater.js +6 -3
  126. package/Source/DataSources/ModelVisualizer.js +19 -98
  127. package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
  128. package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
  129. package/Source/DataSources/TerrainOffsetProperty.js +15 -23
  130. package/Source/Renderer/AutomaticUniforms.js +121 -1
  131. package/Source/Renderer/Context.js +10 -0
  132. package/Source/Renderer/ContextLimits.js +2 -0
  133. package/Source/Renderer/UniformState.js +127 -0
  134. package/Source/Renderer/demodernizeShader.js +4 -1
  135. package/Source/Scene/ArcGisMapService.js +1 -1
  136. package/Source/Scene/Atmosphere.js +127 -0
  137. package/Source/Scene/Axis.js +12 -7
  138. package/Source/Scene/Billboard.js +29 -26
  139. package/Source/Scene/BillboardCollection.js +3 -3
  140. package/Source/Scene/Camera.js +47 -5
  141. package/Source/Scene/Cesium3DTile.js +1 -0
  142. package/Source/Scene/Cesium3DTileContent.js +14 -0
  143. package/Source/Scene/Cesium3DTileset.js +364 -45
  144. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
  145. package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
  146. package/Source/Scene/Composite3DTileContent.js +42 -0
  147. package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
  148. package/Source/Scene/Empty3DTileContent.js +4 -0
  149. package/Source/Scene/Fog.js +1 -0
  150. package/Source/Scene/FrameState.js +14 -1
  151. package/Source/Scene/Geometry3DTileContent.js +4 -0
  152. package/Source/Scene/Globe.js +3 -2
  153. package/Source/Scene/GlobeSurfaceTileProvider.js +3 -1
  154. package/Source/Scene/GlobeTranslucencyState.js +1 -1
  155. package/Source/Scene/GltfLoader.js +15 -5
  156. package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
  157. package/Source/Scene/HeightReference.js +59 -2
  158. package/Source/Scene/I3SDataProvider.js +270 -53
  159. package/Source/Scene/I3SDecoder.js +8 -1
  160. package/Source/Scene/I3SFeature.js +2 -5
  161. package/Source/Scene/I3SField.js +136 -31
  162. package/Source/Scene/I3SGeometry.js +70 -2
  163. package/Source/Scene/I3SLayer.js +55 -10
  164. package/Source/Scene/I3SNode.js +175 -18
  165. package/Source/Scene/I3SStatistics.js +94 -0
  166. package/Source/Scene/I3SSublayer.js +176 -0
  167. package/Source/Scene/I3SSymbology.js +337 -0
  168. package/Source/Scene/Implicit3DTileContent.js +4 -0
  169. package/Source/Scene/KeyframeNode.js +1 -1
  170. package/Source/Scene/LabelCollection.js +2 -2
  171. package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
  172. package/Source/Scene/Model/B3dmLoader.js +4 -0
  173. package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
  174. package/Source/Scene/Model/I3dmLoader.js +4 -0
  175. package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
  176. package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
  177. package/Source/Scene/Model/Model.js +82 -32
  178. package/Source/Scene/Model/Model3DTileContent.js +31 -0
  179. package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
  180. package/Source/Scene/Model/ModelSceneGraph.js +6 -0
  181. package/Source/Scene/Model/pickModel.js +426 -0
  182. package/Source/Scene/Multiple3DTileContent.js +42 -0
  183. package/Source/Scene/PickFramebuffer.js +37 -2
  184. package/Source/Scene/Picking.js +113 -39
  185. package/Source/Scene/Primitive.js +6 -2
  186. package/Source/Scene/QuadtreePrimitive.js +1 -1
  187. package/Source/Scene/Scene.js +312 -46
  188. package/Source/Scene/ScreenSpaceCameraController.js +23 -13
  189. package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
  190. package/Source/Scene/SkyAtmosphere.js +5 -6
  191. package/Source/Scene/SpatialNode.js +12 -19
  192. package/Source/Scene/StructuralMetadata.js +1 -1
  193. package/Source/Scene/Terrain.js +49 -0
  194. package/Source/Scene/TileBoundingS2Cell.js +2 -2
  195. package/Source/Scene/Tileset3DTileContent.js +4 -0
  196. package/Source/Scene/Vector3DTileContent.js +4 -0
  197. package/Source/Scene/VoxelBoxShape.js +76 -0
  198. package/Source/Scene/VoxelCell.js +273 -0
  199. package/Source/Scene/VoxelCylinderShape.js +114 -43
  200. package/Source/Scene/VoxelEllipsoidShape.js +158 -116
  201. package/Source/Scene/VoxelPrimitive.js +3 -1
  202. package/Source/Scene/VoxelRenderResources.js +3 -0
  203. package/Source/Scene/VoxelShape.js +13 -0
  204. package/Source/Scene/VoxelTraversal.js +76 -54
  205. package/Source/Scene/buildVoxelDrawCommands.js +23 -0
  206. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
  207. package/Source/Scene/processVoxelProperties.js +2 -0
  208. package/Source/Shaders/AtmosphereCommon.glsl +3 -11
  209. package/Source/Shaders/AtmosphereCommon.js +3 -11
  210. package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
  211. package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
  212. package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
  213. package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
  214. package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
  215. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
  216. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
  217. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
  218. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
  219. package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
  220. package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
  221. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
  222. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
  223. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
  224. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
  225. package/Source/Shaders/GlobeFS.glsl +16 -25
  226. package/Source/Shaders/GlobeFS.js +16 -25
  227. package/Source/Shaders/GlobeVS.glsl +1 -1
  228. package/Source/Shaders/GlobeVS.js +1 -1
  229. package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
  230. package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
  231. package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
  232. package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
  233. package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
  234. package/Source/Shaders/Model/GeometryStageFS.js +1 -1
  235. package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
  236. package/Source/Shaders/Model/GeometryStageVS.js +4 -4
  237. package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
  238. package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
  239. package/Source/Shaders/Model/ModelFS.glsl +4 -0
  240. package/Source/Shaders/Model/ModelFS.js +4 -0
  241. package/Source/Shaders/Model/ModelVS.glsl +9 -4
  242. package/Source/Shaders/Model/ModelVS.js +9 -4
  243. package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
  244. package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
  245. package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
  246. package/Source/Shaders/SkyAtmosphereFS.js +5 -10
  247. package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
  248. package/Source/Shaders/SkyAtmosphereVS.js +3 -2
  249. package/Source/Shaders/Voxels/IntersectCylinder.glsl +14 -111
  250. package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
  251. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
  252. package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
  253. package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
  254. package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
  255. package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
  256. package/Source/Shaders/Voxels/VoxelFS.js +39 -1
  257. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
  258. package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
  259. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
  260. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
  261. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  262. package/Source/ThirdParty/draco_decoder.wasm +0 -0
  263. package/Source/Workers/createGeometry.js +40 -11
  264. package/Source/Workers/decodeI3S.js +720 -94
  265. package/index.d.ts +574 -71
  266. package/index.js +217 -196
  267. package/package.json +3 -3
  268. package/Build/Workers/chunk-ATB2I7OS.js +0 -55
@@ -363,6 +363,12 @@ Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function (
363
363
  * @returns {Cartesian3} The modified result parameter or a new Cartesian3 instance if none was provided, or undefined if a normal cannot be found.
364
364
  */
365
365
  Ellipsoid.prototype.geodeticSurfaceNormal = function (cartesian, result) {
366
+ //>>includeStart('debug', pragmas.debug);
367
+ Check.typeOf.object("cartesian", cartesian);
368
+ if (isNaN(cartesian.x) || isNaN(cartesian.y) || isNaN(cartesian.z)) {
369
+ throw new DeveloperError("cartesian has a NaN component");
370
+ }
371
+ //>>includeEnd('debug');
366
372
  if (
367
373
  Cartesian3.equalsEpsilon(cartesian, Cartesian3.ZERO, CesiumMath.EPSILON14)
368
374
  ) {
@@ -1,3 +1,10 @@
1
+ import Check from "./Check.js";
2
+ import defaultValue from "./defaultValue.js";
3
+ import DeveloperError from "./DeveloperError.js";
4
+ import isLeapYear from "./isLeapYear.js";
5
+
6
+ const daysInYear = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
7
+
1
8
  /**
2
9
  * Represents a Gregorian date in a more precise format than the JavaScript Date object.
3
10
  * In addition to submillisecond precision, this object can also represent leap seconds.
@@ -25,6 +32,27 @@ function GregorianDate(
25
32
  millisecond,
26
33
  isLeapSecond
27
34
  ) {
35
+ const minimumYear = 1;
36
+ const minimumMonth = 1;
37
+ const minimumDay = 1;
38
+ const minimumHour = 0;
39
+ const minimumMinute = 0;
40
+ const minimumSecond = 0;
41
+ const minimumMillisecond = 0;
42
+
43
+ year = defaultValue(year, minimumYear);
44
+ month = defaultValue(month, minimumMonth);
45
+ day = defaultValue(day, minimumDay);
46
+ hour = defaultValue(hour, minimumHour);
47
+ minute = defaultValue(minute, minimumMinute);
48
+ second = defaultValue(second, minimumSecond);
49
+ millisecond = defaultValue(millisecond, minimumMillisecond);
50
+ isLeapSecond = defaultValue(isLeapSecond, false);
51
+ //>>includeStart('debug', pragmas.debug);
52
+ validateRange();
53
+ validateDate();
54
+ //>>includeEnd('debug');
55
+
28
56
  /**
29
57
  * Gets or sets the year as a whole number.
30
58
  * @type {number}
@@ -65,5 +93,62 @@ function GregorianDate(
65
93
  * @type {boolean}
66
94
  */
67
95
  this.isLeapSecond = isLeapSecond;
96
+
97
+ function validateRange() {
98
+ const maximumYear = 9999;
99
+ const maximumMonth = 12;
100
+ const maximumDay = 31;
101
+ const maximumHour = 23;
102
+ const maximumMinute = 59;
103
+ const maximumSecond = 59;
104
+ const excludedMaximumMilisecond = 1000;
105
+
106
+ Check.typeOf.number.greaterThanOrEquals("Year", year, minimumYear);
107
+ Check.typeOf.number.lessThanOrEquals("Year", year, maximumYear);
108
+
109
+ Check.typeOf.number.greaterThanOrEquals("Month", month, minimumMonth);
110
+ Check.typeOf.number.lessThanOrEquals("Month", month, maximumMonth);
111
+
112
+ Check.typeOf.number.greaterThanOrEquals("Day", day, minimumDay);
113
+ Check.typeOf.number.lessThanOrEquals("Day", day, maximumDay);
114
+
115
+ Check.typeOf.number.greaterThanOrEquals("Hour", hour, minimumHour);
116
+ Check.typeOf.number.lessThanOrEquals("Hour", hour, maximumHour);
117
+
118
+ Check.typeOf.number.greaterThanOrEquals("Minute", minute, minimumMinute);
119
+ Check.typeOf.number.lessThanOrEquals("Minute", minute, maximumMinute);
120
+
121
+ Check.typeOf.bool("IsLeapSecond", isLeapSecond);
122
+
123
+ Check.typeOf.number.greaterThanOrEquals("Second", second, minimumSecond);
124
+ Check.typeOf.number.lessThanOrEquals(
125
+ "Second",
126
+ second,
127
+ isLeapSecond ? maximumSecond + 1 : maximumSecond
128
+ );
129
+
130
+ Check.typeOf.number.greaterThanOrEquals(
131
+ "Millisecond",
132
+ millisecond,
133
+ minimumMillisecond
134
+ );
135
+ Check.typeOf.number.lessThan(
136
+ "Millisecond",
137
+ millisecond,
138
+ excludedMaximumMilisecond
139
+ );
140
+ }
141
+
142
+ // Javascript date object supports only dates greater than 1901. Thus validating with custom logic
143
+ function validateDate() {
144
+ const daysInMonth =
145
+ month === 2 && isLeapYear(year)
146
+ ? daysInYear[month - 1] + 1
147
+ : daysInYear[month - 1];
148
+
149
+ if (day > daysInMonth) {
150
+ throw new DeveloperError("Month and Day represents invalid date");
151
+ }
152
+ }
68
153
  }
69
154
  export default GregorianDate;
@@ -3,7 +3,7 @@ import defined from "./defined.js";
3
3
 
4
4
  /**
5
5
  * Defines a heading angle, pitch angle, and range in a local frame.
6
- * Heading is the rotation from the local north direction where a positive angle is increasing eastward.
6
+ * Heading is the rotation from the local east direction where a positive angle is increasing southward.
7
7
  * Pitch is the rotation from the local xy-plane. Positive pitch angles are above the plane. Negative pitch
8
8
  * angles are below the plane. Range is the distance from the center of the frame.
9
9
  * @alias HeadingPitchRange
@@ -15,7 +15,7 @@ import defined from "./defined.js";
15
15
  */
16
16
  function HeadingPitchRange(heading, pitch, range) {
17
17
  /**
18
- * Heading is the rotation from the local north direction where a positive angle is increasing eastward.
18
+ * Heading is the rotation from the local east direction where a positive angle is increasing southward.
19
19
  * @type {number}
20
20
  * @default 0.0
21
21
  */
@@ -508,7 +508,10 @@ function addWithCancellationCheck(left, right, tolerance) {
508
508
  return difference;
509
509
  }
510
510
 
511
- function quadraticVectorExpression(A, b, c, x, w) {
511
+ /**
512
+ * @private
513
+ */
514
+ IntersectionTests.quadraticVectorExpression = function (A, b, c, x, w) {
512
515
  const xSquared = x * x;
513
516
  const wSquared = w * w;
514
517
 
@@ -634,7 +637,7 @@ function quadraticVectorExpression(A, b, c, x, w) {
634
637
  }
635
638
 
636
639
  return solutions;
637
- }
640
+ };
638
641
 
639
642
  const firstAxisScratch = new Cartesian3();
640
643
  const secondAxisScratch = new Cartesian3();
@@ -740,7 +743,7 @@ IntersectionTests.grazingAltitudeLocation = function (ray, ellipsoid) {
740
743
  const b = Matrix3.multiplyByVector(temp, position, bCart);
741
744
 
742
745
  // Solve for the solutions to the expression in standard form:
743
- const solutions = quadraticVectorExpression(
746
+ const solutions = IntersectionTests.quadraticVectorExpression(
744
747
  A,
745
748
  Cartesian3.negate(b, firstAxisScratch),
746
749
  0.0,
@@ -4,7 +4,7 @@ import Resource from "./Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJkNzEwOTRhMi05YmYyLTQyY2EtYTU2My04YTM1MWE2YjhjNjAiLCJpZCI6MjU5LCJpYXQiOjE3MDQyMTcxMzh9.rE7KTaFyZydhuP1Z7ohzClO3J1tMOvaHODzt3_5jo7s";
7
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2MThmZGJiNi1kMDRlLTQ4ZGMtYjU0Ny0yNTljMjM1NzliN2MiLCJpZCI6MjU5LCJpYXQiOjE3MDkzMDQzNjZ9.7gsbNN-OaPZJ7QwMDB2vdF2geQDd8lMBAEK77_5Qol4";
8
8
  /**
9
9
  * Default settings for accessing the Cesium ion API.
10
10
  *
@@ -402,6 +402,11 @@ PixelFormat.alignmentInBytes = function (pixelFormat, pixelDatatype, width) {
402
402
 
403
403
  /**
404
404
  * @private
405
+ * @param {PixelFormat} pixelFormat The pixel format.
406
+ * @param {PixelDatatype} pixelDatatype The pixel datatype.
407
+ * @param {Number} width The width of the texture.
408
+ * @param {Number} height The height of the texture.
409
+ * @returns {TypedArray} The typed array.
405
410
  */
406
411
  PixelFormat.createTypedArray = function (
407
412
  pixelFormat,
@@ -8,10 +8,8 @@ import Check from "./Check.js";
8
8
  import ComponentDatatype from "./ComponentDatatype.js";
9
9
  import defaultValue from "./defaultValue.js";
10
10
  import defined from "./defined.js";
11
- import deprecationWarning from "./deprecationWarning.js";
12
11
  import DeveloperError from "./DeveloperError.js";
13
12
  import Ellipsoid from "./Ellipsoid.js";
14
- import EllipsoidGeodesic from "./EllipsoidGeodesic.js";
15
13
  import EllipsoidTangentPlane from "./EllipsoidTangentPlane.js";
16
14
  import Geometry from "./Geometry.js";
17
15
  import GeometryAttribute from "./GeometryAttribute.js";
@@ -425,123 +423,6 @@ function computeAttributes(options) {
425
423
  return geometry;
426
424
  }
427
425
 
428
- const startCartographicScratch = new Cartographic();
429
- const endCartographicScratch = new Cartographic();
430
- const idlCross = {
431
- westOverIDL: 0.0,
432
- eastOverIDL: 0.0,
433
- };
434
- let ellipsoidGeodesic = new EllipsoidGeodesic();
435
- function computeRectangle(positions, ellipsoid, arcType, granularity, result) {
436
- result = defaultValue(result, new Rectangle());
437
- if (!defined(positions) || positions.length < 3) {
438
- result.west = 0.0;
439
- result.north = 0.0;
440
- result.south = 0.0;
441
- result.east = 0.0;
442
- return result;
443
- }
444
-
445
- if (arcType === ArcType.RHUMB) {
446
- return Rectangle.fromCartesianArray(positions, ellipsoid, result);
447
- }
448
-
449
- if (!ellipsoidGeodesic.ellipsoid.equals(ellipsoid)) {
450
- ellipsoidGeodesic = new EllipsoidGeodesic(undefined, undefined, ellipsoid);
451
- }
452
-
453
- result.west = Number.POSITIVE_INFINITY;
454
- result.east = Number.NEGATIVE_INFINITY;
455
- result.south = Number.POSITIVE_INFINITY;
456
- result.north = Number.NEGATIVE_INFINITY;
457
-
458
- idlCross.westOverIDL = Number.POSITIVE_INFINITY;
459
- idlCross.eastOverIDL = Number.NEGATIVE_INFINITY;
460
-
461
- const inverseChordLength =
462
- 1.0 / CesiumMath.chordLength(granularity, ellipsoid.maximumRadius);
463
- const positionsLength = positions.length;
464
- let endCartographic = ellipsoid.cartesianToCartographic(
465
- positions[0],
466
- endCartographicScratch
467
- );
468
- let startCartographic = startCartographicScratch;
469
- let swap;
470
-
471
- for (let i = 1; i < positionsLength; i++) {
472
- swap = startCartographic;
473
- startCartographic = endCartographic;
474
- endCartographic = ellipsoid.cartesianToCartographic(positions[i], swap);
475
- ellipsoidGeodesic.setEndPoints(startCartographic, endCartographic);
476
- interpolateAndGrowRectangle(
477
- ellipsoidGeodesic,
478
- inverseChordLength,
479
- result,
480
- idlCross
481
- );
482
- }
483
-
484
- swap = startCartographic;
485
- startCartographic = endCartographic;
486
- endCartographic = ellipsoid.cartesianToCartographic(positions[0], swap);
487
- ellipsoidGeodesic.setEndPoints(startCartographic, endCartographic);
488
- interpolateAndGrowRectangle(
489
- ellipsoidGeodesic,
490
- inverseChordLength,
491
- result,
492
- idlCross
493
- );
494
-
495
- if (result.east - result.west > idlCross.eastOverIDL - idlCross.westOverIDL) {
496
- result.west = idlCross.westOverIDL;
497
- result.east = idlCross.eastOverIDL;
498
-
499
- if (result.east > CesiumMath.PI) {
500
- result.east = result.east - CesiumMath.TWO_PI;
501
- }
502
- if (result.west > CesiumMath.PI) {
503
- result.west = result.west - CesiumMath.TWO_PI;
504
- }
505
- }
506
-
507
- return result;
508
- }
509
-
510
- const interpolatedCartographicScratch = new Cartographic();
511
- function interpolateAndGrowRectangle(
512
- ellipsoidGeodesic,
513
- inverseChordLength,
514
- result,
515
- idlCross
516
- ) {
517
- const segmentLength = ellipsoidGeodesic.surfaceDistance;
518
-
519
- const numPoints = Math.ceil(segmentLength * inverseChordLength);
520
- const subsegmentDistance =
521
- numPoints > 0 ? segmentLength / (numPoints - 1) : Number.POSITIVE_INFINITY;
522
- let interpolationDistance = 0.0;
523
-
524
- for (let i = 0; i < numPoints; i++) {
525
- const interpolatedCartographic = ellipsoidGeodesic.interpolateUsingSurfaceDistance(
526
- interpolationDistance,
527
- interpolatedCartographicScratch
528
- );
529
- interpolationDistance += subsegmentDistance;
530
- const longitude = interpolatedCartographic.longitude;
531
- const latitude = interpolatedCartographic.latitude;
532
-
533
- result.west = Math.min(result.west, longitude);
534
- result.east = Math.max(result.east, longitude);
535
- result.south = Math.min(result.south, latitude);
536
- result.north = Math.max(result.north, latitude);
537
-
538
- const lonAdjusted =
539
- longitude >= 0 ? longitude : longitude + CesiumMath.TWO_PI;
540
- idlCross.westOverIDL = Math.min(idlCross.westOverIDL, lonAdjusted);
541
- idlCross.eastOverIDL = Math.max(idlCross.eastOverIDL, lonAdjusted);
542
- }
543
- }
544
-
545
426
  const createGeometryFromPositionsExtrudedPositions = [];
546
427
 
547
428
  function createGeometryFromPositionsExtruded(
@@ -1264,56 +1145,6 @@ PolygonGeometry.computeRectangleFromPositions = function (
1264
1145
  return result;
1265
1146
  };
1266
1147
 
1267
- /**
1268
- * Returns the bounding rectangle given the provided options
1269
- *
1270
- * @param {object} options Object with the following properties:
1271
- * @param {PolygonHierarchy} options.polygonHierarchy A polygon hierarchy that can include holes.
1272
- * @param {number} [options.granularity=CesiumMath.RADIANS_PER_DEGREE] The distance, in radians, between each latitude and longitude. Determines the number of positions sampled.
1273
- * @param {ArcType} [options.arcType=ArcType.GEODESIC] The type of line the polygon edges must follow. Valid options are {@link ArcType.GEODESIC} and {@link ArcType.RHUMB}.
1274
- * @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid to be used as a reference.
1275
- * @param {Rectangle} [result] An object in which to store the result.
1276
- *
1277
- * @returns {Rectangle} The result rectangle
1278
- *
1279
- * @deprecated
1280
- */
1281
- PolygonGeometry.computeRectangle = function (options, result) {
1282
- //>>includeStart('debug', pragmas.debug);
1283
- Check.typeOf.object("options", options);
1284
- Check.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
1285
- //>>includeEnd('debug');
1286
-
1287
- deprecationWarning(
1288
- "PolygonGeometry.computeRectangle",
1289
- "PolygonGeometry.computeRectangle was deprecated in CesiumJS 1.110. It will be removed in CesiumJS 1.112. Use PolygonGeometry.computeRectangleFromPositions instead."
1290
- );
1291
-
1292
- const granularity = defaultValue(
1293
- options.granularity,
1294
- CesiumMath.RADIANS_PER_DEGREE
1295
- );
1296
- const arcType = defaultValue(options.arcType, ArcType.GEODESIC);
1297
- //>>includeStart('debug', pragmas.debug);
1298
- if (arcType !== ArcType.GEODESIC && arcType !== ArcType.RHUMB) {
1299
- throw new DeveloperError(
1300
- "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
1301
- );
1302
- }
1303
- //>>includeEnd('debug');
1304
-
1305
- const polygonHierarchy = options.polygonHierarchy;
1306
- const ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
1307
-
1308
- return computeRectangle(
1309
- polygonHierarchy.positions,
1310
- ellipsoid,
1311
- arcType,
1312
- granularity,
1313
- result
1314
- );
1315
- };
1316
-
1317
1148
  const scratchPolarForPlane = new Stereographic();
1318
1149
  function getTangentPlane(rectangle, positions, ellipsoid) {
1319
1150
  if (rectangle.height >= CesiumMath.PI || rectangle.width >= CesiumMath.PI) {
@@ -2045,17 +2045,6 @@ Resource.createImageBitmapFromBlob = function (blob, options) {
2045
2045
  });
2046
2046
  };
2047
2047
 
2048
- function decodeResponse(loadWithHttpResponse, responseType) {
2049
- switch (responseType) {
2050
- case "text":
2051
- return loadWithHttpResponse.toString("utf8");
2052
- case "json":
2053
- return JSON.parse(loadWithHttpResponse.toString("utf8"));
2054
- default:
2055
- return new Uint8Array(loadWithHttpResponse).buffer;
2056
- }
2057
- }
2058
-
2059
2048
  function loadWithHttpRequest(
2060
2049
  url,
2061
2050
  responseType,
@@ -2066,64 +2055,36 @@ function loadWithHttpRequest(
2066
2055
  overrideMimeType
2067
2056
  ) {
2068
2057
  // Note: only the 'json' and 'text' responseTypes transforms the loaded buffer
2069
- let URL;
2070
- let zlib;
2071
- Promise.all([import("url"), import("zlib")])
2072
- .then(([urlImport, zlibImport]) => {
2073
- URL = urlImport.parse(url);
2074
- zlib = zlibImport;
2075
-
2076
- return URL.protocol === "https:" ? import("https") : import("http");
2077
- })
2078
- .then((http) => {
2079
- const options = {
2080
- protocol: URL.protocol,
2081
- hostname: URL.hostname,
2082
- port: URL.port,
2083
- path: URL.path,
2084
- query: URL.query,
2085
- method: method,
2086
- headers: headers,
2087
- };
2088
- http
2089
- .request(options)
2090
- .on("response", function (res) {
2091
- if (res.statusCode < 200 || res.statusCode >= 300) {
2092
- deferred.reject(
2093
- new RequestErrorEvent(res.statusCode, res, res.headers)
2094
- );
2095
- return;
2096
- }
2097
-
2098
- const chunkArray = [];
2099
- res.on("data", function (chunk) {
2100
- chunkArray.push(chunk);
2101
- });
2058
+ fetch(url, {
2059
+ method,
2060
+ headers,
2061
+ })
2062
+ .then(async (response) => {
2063
+ if (!response.ok) {
2064
+ const responseHeaders = {};
2065
+ response.headers.forEach((value, key) => {
2066
+ responseHeaders[key] = value;
2067
+ });
2068
+ deferred.reject(
2069
+ new RequestErrorEvent(response.status, response, responseHeaders)
2070
+ );
2071
+ return;
2072
+ }
2102
2073
 
2103
- res.on("end", function () {
2104
- // eslint-disable-next-line no-undef
2105
- const result = Buffer.concat(chunkArray);
2106
- if (res.headers["content-encoding"] === "gzip") {
2107
- zlib.gunzip(result, function (error, resultUnzipped) {
2108
- if (error) {
2109
- deferred.reject(
2110
- new RuntimeError("Error decompressing response.")
2111
- );
2112
- } else {
2113
- deferred.resolve(
2114
- decodeResponse(resultUnzipped, responseType)
2115
- );
2116
- }
2117
- });
2118
- } else {
2119
- deferred.resolve(decodeResponse(result, responseType));
2120
- }
2121
- });
2122
- })
2123
- .on("error", function (e) {
2124
- deferred.reject(new RequestErrorEvent());
2125
- })
2126
- .end();
2074
+ switch (responseType) {
2075
+ case "text":
2076
+ deferred.resolve(response.text());
2077
+ break;
2078
+ case "json":
2079
+ deferred.resolve(response.json());
2080
+ break;
2081
+ default:
2082
+ deferred.resolve(new Uint8Array(await response.arrayBuffer()).buffer);
2083
+ break;
2084
+ }
2085
+ })
2086
+ .catch(() => {
2087
+ deferred.reject(new RequestErrorEvent());
2127
2088
  });
2128
2089
  }
2129
2090
 
@@ -2226,7 +2187,7 @@ Resource._Implementations.loadWithXhr = function (
2226
2187
  //or do not support the xhr.response property.
2227
2188
  if (xhr.status === 204) {
2228
2189
  // accept no content
2229
- deferred.resolve();
2190
+ deferred.resolve(undefined);
2230
2191
  } else if (
2231
2192
  defined(response) &&
2232
2193
  (!defined(responseType) || browserResponseType === responseType)
@@ -127,6 +127,9 @@ Transforms.localFrameToFixedFrameGenerator = function (firstAxis, secondAxis) {
127
127
  if (!defined(origin)) {
128
128
  throw new DeveloperError("origin is required.");
129
129
  }
130
+ if (isNaN(origin.x) || isNaN(origin.y) || isNaN(origin.z)) {
131
+ throw new DeveloperError("origin has a NaN component");
132
+ }
130
133
  //>>includeEnd('debug');
131
134
  if (!defined(result)) {
132
135
  result = new Matrix4();
@@ -360,7 +363,7 @@ const scratchHPRMatrix4 = new Matrix4();
360
363
 
361
364
  /**
362
365
  * Computes a 4x4 transformation matrix from a reference frame with axes computed from the heading-pitch-roll angles
363
- * centered at the provided origin to the provided ellipsoid's fixed reference frame. Heading is the rotation from the local north
366
+ * centered at the provided origin to the provided ellipsoid's fixed reference frame. Heading is the rotation from the local east
364
367
  * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles
365
368
  * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
366
369
  *
@@ -415,7 +418,7 @@ const scratchHPRMatrix3 = new Matrix3();
415
418
 
416
419
  /**
417
420
  * Computes a quaternion from a reference frame with axes computed from the heading-pitch-roll angles
418
- * centered at the provided origin. Heading is the rotation from the local north
421
+ * centered at the provided origin. Heading is the rotation from the local east
419
422
  * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles
420
423
  * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
421
424
  *
@@ -465,7 +468,7 @@ const hprTransformScratch = new Matrix4();
465
468
  const hprRotationScratch = new Matrix3();
466
469
  const hprQuaternionScratch = new Quaternion();
467
470
  /**
468
- * Computes heading-pitch-roll angles from a transform in a particular reference frame. Heading is the rotation from the local north
471
+ * Computes heading-pitch-roll angles from a transform in a particular reference frame. Heading is the rotation from the local east
469
472
  * direction where a positive angle is increasing eastward. Pitch is the rotation from the local east-north plane. Positive pitch angles
470
473
  * are above the plane. Negative pitch angles are below the plane. Roll is the first rotation applied about the local east axis.
471
474
  *
@@ -1045,21 +1048,30 @@ Transforms.basisTo2D = function (projection, matrix, result) {
1045
1048
  const rtcCenter = Matrix4.getTranslation(matrix, scratchCenter);
1046
1049
  const ellipsoid = projection.ellipsoid;
1047
1050
 
1048
- // Get the 2D Center
1049
- const cartographic = ellipsoid.cartesianToCartographic(
1050
- rtcCenter,
1051
- scratchCartographic
1052
- );
1053
- const projectedPosition = projection.project(
1054
- cartographic,
1055
- scratchCartesian3Projection
1056
- );
1057
- Cartesian3.fromElements(
1058
- projectedPosition.z,
1059
- projectedPosition.x,
1060
- projectedPosition.y,
1061
- projectedPosition
1062
- );
1051
+ let projectedPosition;
1052
+ if (Cartesian3.equals(rtcCenter, Cartesian3.ZERO)) {
1053
+ projectedPosition = Cartesian3.clone(
1054
+ Cartesian3.ZERO,
1055
+ scratchCartesian3Projection
1056
+ );
1057
+ } else {
1058
+ // Get the 2D Center
1059
+ const cartographic = ellipsoid.cartesianToCartographic(
1060
+ rtcCenter,
1061
+ scratchCartographic
1062
+ );
1063
+
1064
+ projectedPosition = projection.project(
1065
+ cartographic,
1066
+ scratchCartesian3Projection
1067
+ );
1068
+ Cartesian3.fromElements(
1069
+ projectedPosition.z,
1070
+ projectedPosition.x,
1071
+ projectedPosition.y,
1072
+ projectedPosition
1073
+ );
1074
+ }
1063
1075
 
1064
1076
  // Assuming the instance are positioned in WGS84, invert the WGS84 transform to get the local transform and then convert to 2D
1065
1077
  const fromENU = Transforms.eastNorthUpToFixedFrame(
@@ -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;
@@ -0,0 +1,32 @@
1
+ import Check from "./Check.js";
2
+
3
+ /**
4
+ * Converts the value from sRGB color space to linear color space.
5
+ *
6
+ * @function
7
+ *
8
+ * @param {number} value The color value in sRGB color space.
9
+ * @returns {number} Returns the color value in linear color space.
10
+ *
11
+ * @example
12
+ * const srgbColor = [0.5, 0.5, 0.5];
13
+ * const linearColor = srgbColor.map(function (c) {
14
+ * return Cesium.srgbToLinear(c);
15
+ * });
16
+ */
17
+ function srgbToLinear(value) {
18
+ //>>includeStart('debug', pragmas.debug);
19
+ Check.defined("value", value);
20
+ //>>includeEnd('debug');
21
+
22
+ if (value <= 0.04045) {
23
+ // eslint-disable-next-line no-loss-of-precision
24
+ return value * 0.07739938080495356037151702786378;
25
+ }
26
+ return Math.pow(
27
+ // eslint-disable-next-line no-loss-of-precision
28
+ (value + 0.055) * 0.94786729857819905213270142180095,
29
+ 2.4
30
+ );
31
+ }
32
+ export default srgbToLinear;