@cesium/engine 2.2.0 → 2.3.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 (137) hide show
  1. package/Build/Workers/{AttributeCompression-8a5a065e.js → AttributeCompression-f9f6c717.js} +1 -1
  2. package/Build/Workers/{AxisAlignedBoundingBox-379015ef.js → AxisAlignedBoundingBox-31fadcf0.js} +1 -1
  3. package/Build/Workers/{BoundingRectangle-57f2b24f.js → BoundingRectangle-995f0079.js} +1 -1
  4. package/Build/Workers/{BoxGeometry-ecabfc78.js → BoxGeometry-7eb1af60.js} +1 -1
  5. package/Build/Workers/{Color-14d1a36d.js → Color-2dc49658.js} +1 -1
  6. package/Build/Workers/{CoplanarPolygonGeometryLibrary-048c3c14.js → CoplanarPolygonGeometryLibrary-d7d972d6.js} +1 -1
  7. package/Build/Workers/{CorridorGeometryLibrary-520c8619.js → CorridorGeometryLibrary-1f5ef7b3.js} +1 -1
  8. package/Build/Workers/{CylinderGeometry-119068b8.js → CylinderGeometry-23c67a6c.js} +1 -1
  9. package/Build/Workers/{CylinderGeometryLibrary-135b0858.js → CylinderGeometryLibrary-7bf291b4.js} +1 -1
  10. package/Build/Workers/{EllipseGeometry-2dfc3523.js → EllipseGeometry-37014da4.js} +1 -1
  11. package/Build/Workers/{EllipseGeometryLibrary-0a1e0170.js → EllipseGeometryLibrary-92ab6b1e.js} +1 -1
  12. package/Build/Workers/{EllipseOutlineGeometry-c5251669.js → EllipseOutlineGeometry-12b6fef5.js} +1 -1
  13. package/Build/Workers/{EllipsoidGeodesic-dcff5cbd.js → EllipsoidGeodesic-5b3623dc.js} +1 -1
  14. package/Build/Workers/{EllipsoidGeometry-d10a5221.js → EllipsoidGeometry-508da15c.js} +1 -1
  15. package/Build/Workers/{EllipsoidOutlineGeometry-7039a0ae.js → EllipsoidOutlineGeometry-40d97455.js} +1 -1
  16. package/Build/Workers/{EllipsoidRhumbLine-b672d507.js → EllipsoidRhumbLine-ef872433.js} +1 -1
  17. package/Build/Workers/{EllipsoidTangentPlane-857186be.js → EllipsoidTangentPlane-46d4d9c2.js} +1 -1
  18. package/Build/Workers/{EncodedCartesian3-e8bbca36.js → EncodedCartesian3-57415c8a.js} +1 -1
  19. package/Build/Workers/{FrustumGeometry-400fa1b7.js → FrustumGeometry-38605e69.js} +31 -3
  20. package/Build/Workers/{GeometryAttribute-7a2de5c6.js → GeometryAttribute-a466e9c7.js} +1 -1
  21. package/Build/Workers/{GeometryInstance-3fb607b7.js → GeometryInstance-34d9e21e.js} +1 -1
  22. package/Build/Workers/{GeometryPipeline-916636fa.js → GeometryPipeline-dcf79306.js} +1 -1
  23. package/Build/Workers/{IndexDatatype-b8f3e09d.js → IndexDatatype-2643aa47.js} +1 -1
  24. package/Build/Workers/{IntersectionTests-b4d02d4d.js → IntersectionTests-88c49b2e.js} +1 -1
  25. package/Build/Workers/{Math-dad82b4d.js → Math-0a2ac845.js} +12 -2
  26. package/Build/Workers/{Matrix2-1e403d0e.js → Matrix2-e1298525.js} +1 -1
  27. package/Build/Workers/{Matrix3-fa806b97.js → Matrix3-41c58dde.js} +1 -1
  28. package/Build/Workers/{OrientedBoundingBox-96fe1752.js → OrientedBoundingBox-2dd47921.js} +1 -1
  29. package/Build/Workers/{Plane-c27e1ac6.js → Plane-4c3d403b.js} +1 -1
  30. package/Build/Workers/{PolygonGeometryLibrary-931f1ec6.js → PolygonGeometryLibrary-59126025.js} +1 -1
  31. package/Build/Workers/PolygonPipeline-1fe328c0.js +1344 -0
  32. package/Build/Workers/{PolylinePipeline-6d5c63e5.js → PolylinePipeline-896735cc.js} +1 -1
  33. package/Build/Workers/{PolylineVolumeGeometryLibrary-f068c1fb.js → PolylineVolumeGeometryLibrary-9c0639f7.js} +1 -1
  34. package/Build/Workers/{PrimitivePipeline-879f996a.js → PrimitivePipeline-fc1a47ff.js} +1 -1
  35. package/Build/Workers/{RectangleGeometryLibrary-2d6f36f3.js → RectangleGeometryLibrary-a23c9ebe.js} +1 -1
  36. package/Build/Workers/{TerrainEncoding-82882059.js → TerrainEncoding-51b8b33b.js} +1 -1
  37. package/Build/Workers/Transforms-bc45e707.js +14699 -0
  38. package/Build/Workers/{WallGeometryLibrary-db7a64fb.js → WallGeometryLibrary-007e9883.js} +1 -1
  39. package/Build/Workers/{WebMercatorProjection-76a3fcc0.js → WebMercatorProjection-13ed1a6e.js} +1 -1
  40. package/Build/Workers/{arrayRemoveDuplicates-fac118a8.js → arrayRemoveDuplicates-d2061e85.js} +1 -1
  41. package/Build/Workers/cesiumWorkerBootstrapper.js +1 -1
  42. package/Build/Workers/combineGeometry.js +1 -1
  43. package/Build/Workers/createBoxGeometry.js +1 -1
  44. package/Build/Workers/createBoxOutlineGeometry.js +1 -1
  45. package/Build/Workers/createCircleGeometry.js +1 -1
  46. package/Build/Workers/createCircleOutlineGeometry.js +1 -1
  47. package/Build/Workers/createCoplanarPolygonGeometry.js +1 -1
  48. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +1 -1
  49. package/Build/Workers/createCorridorGeometry.js +1 -1
  50. package/Build/Workers/createCorridorOutlineGeometry.js +1 -1
  51. package/Build/Workers/createCylinderGeometry.js +1 -1
  52. package/Build/Workers/createCylinderOutlineGeometry.js +1 -1
  53. package/Build/Workers/createEllipseGeometry.js +1 -1
  54. package/Build/Workers/createEllipseOutlineGeometry.js +1 -1
  55. package/Build/Workers/createEllipsoidGeometry.js +1 -1
  56. package/Build/Workers/createEllipsoidOutlineGeometry.js +1 -1
  57. package/Build/Workers/createFrustumGeometry.js +1 -1
  58. package/Build/Workers/createFrustumOutlineGeometry.js +1 -1
  59. package/Build/Workers/createGeometry.js +1 -1
  60. package/Build/Workers/createGroundPolylineGeometry.js +1 -1
  61. package/Build/Workers/createPlaneGeometry.js +1 -1
  62. package/Build/Workers/createPlaneOutlineGeometry.js +1 -1
  63. package/Build/Workers/createPolygonGeometry.js +1 -1
  64. package/Build/Workers/createPolygonOutlineGeometry.js +1 -1
  65. package/Build/Workers/createPolylineGeometry.js +1 -1
  66. package/Build/Workers/createPolylineVolumeGeometry.js +1 -1
  67. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +1 -1
  68. package/Build/Workers/createRectangleGeometry.js +1 -1
  69. package/Build/Workers/createRectangleOutlineGeometry.js +1 -1
  70. package/Build/Workers/createSimplePolylineGeometry.js +1 -1
  71. package/Build/Workers/createSphereGeometry.js +1 -1
  72. package/Build/Workers/createSphereOutlineGeometry.js +1 -1
  73. package/Build/Workers/createVectorTileClampedPolylines.js +1 -1
  74. package/Build/Workers/createVectorTileGeometries.js +1 -1
  75. package/Build/Workers/createVectorTilePoints.js +1 -1
  76. package/Build/Workers/createVectorTilePolygons.js +1 -1
  77. package/Build/Workers/createVectorTilePolylines.js +1 -1
  78. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +1 -1
  79. package/Build/Workers/createVerticesFromHeightmap.js +5 -8
  80. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +1 -1
  81. package/Build/Workers/createWallGeometry.js +1 -1
  82. package/Build/Workers/createWallOutlineGeometry.js +1 -1
  83. package/Build/Workers/decodeDraco.js +1 -1
  84. package/Build/Workers/decodeI3S.js +1 -1
  85. package/Build/Workers/package.js +1 -1
  86. package/Build/Workers/transferTypedArrayTest.js +1 -1
  87. package/Build/Workers/upsampleQuantizedTerrainMesh.js +1 -1
  88. package/Source/Core/BingMapsGeocoderService.js +19 -1
  89. package/Source/Core/CartographicGeocoderService.js +15 -0
  90. package/Source/Core/Credit.js +1 -1
  91. package/Source/Core/FrustumGeometry.js +3 -2
  92. package/Source/Core/GeocoderService.js +32 -1
  93. package/Source/Core/Ion.js +1 -1
  94. package/Source/Core/IonGeocoderService.js +17 -2
  95. package/Source/Core/OpenCageGeocoderService.js +18 -1
  96. package/Source/Core/OrthographicFrustum.js +13 -0
  97. package/Source/Core/PeliasGeocoderService.js +14 -1
  98. package/Source/Core/PerspectiveFrustum.js +14 -0
  99. package/Source/Core/Request.js +3 -2
  100. package/Source/Core/RequestScheduler.js +9 -4
  101. package/Source/Core/Resource.js +228 -234
  102. package/Source/DataSources/DataSourceDisplay.js +2 -2
  103. package/Source/DataSources/EntityCluster.js +126 -128
  104. package/Source/DataSources/ModelVisualizer.js +5 -3
  105. package/Source/Renderer/UniformState.js +3 -2
  106. package/Source/Renderer/demodernizeShader.js +5 -5
  107. package/Source/Scene/ArcGisBaseMapType.js +12 -0
  108. package/Source/Scene/ArcGisMapServerImageryProvider.js +162 -20
  109. package/Source/Scene/ArcGisMapService.js +83 -0
  110. package/Source/Scene/Camera.js +8 -7
  111. package/Source/Scene/Cesium3DTile.js +4 -3
  112. package/Source/Scene/Cesium3DTileset.js +4 -4
  113. package/Source/Scene/CreditDisplay.js +112 -16
  114. package/Source/Scene/GlobeSurfaceTileProvider.js +4 -4
  115. package/Source/Scene/GltfJsonLoader.js +12 -0
  116. package/Source/Scene/GltfLoader.js +6 -37
  117. package/Source/Scene/IonImageryProvider.js +11 -11
  118. package/Source/Scene/Model/MaterialPipelineStage.js +12 -12
  119. package/Source/Scene/Model/Model.js +85 -44
  120. package/Source/Scene/Model/UniformType.js +1 -1
  121. package/Source/Scene/Picking.js +3 -2
  122. package/Source/Scene/QuadtreePrimitive.js +3 -2
  123. package/Source/Scene/SceneTransforms.js +3 -2
  124. package/Source/Scene/ScreenSpaceCameraController.js +1 -1
  125. package/Source/Scene/Vector3DTilePoints.js +25 -13
  126. package/Source/Shaders/AtmosphereCommon.glsl +51 -8
  127. package/Source/Shaders/AtmosphereCommon.js +51 -8
  128. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.glsl +1 -1
  129. package/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js +1 -1
  130. package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.glsl +3 -3
  131. package/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js +3 -3
  132. package/Source/Widget/CesiumWidget.js +12 -0
  133. package/index.d.ts +207 -16
  134. package/index.js +286 -284
  135. package/package.json +4 -4
  136. package/Build/Workers/PolygonPipeline-32fc92cc.js +0 -1345
  137. package/Build/Workers/Transforms-9052372a.js +0 -14715
@@ -0,0 +1,83 @@
1
+ import Credit from "../Core/Credit.js";
2
+ import defined from "../Core/defined.js";
3
+ import Resource from "../Core/Resource.js";
4
+
5
+ let defaultTokenCredit;
6
+ const defaultAccessToken =
7
+ "AAPKd815e334cb774973b7245e23a67f4d08Js7A8e8xvfBpgnZIzp1jbL3FWJTmx7AKG8wa87OwDcWEu4CxQCNiydpPbGpALiTf";
8
+ /**
9
+ * Default options for accessing the ArcGIS image tile service.
10
+ *
11
+ * An ArcGIS access token is required to access ArcGIS image tile layers.
12
+ * A default token is provided for evaluation purposes only.
13
+ * To obtain an access token, go to {@link https://developers.arcgis.com} and create a free account.
14
+ * More info can be found in the {@link https://developers.arcgis.com/documentation/mapping-apis-and-services/security/ | ArcGIS developer guide}.
15
+ *
16
+ * @see ArcGisMapServerImageryProvider
17
+ * @namespace ArcGisMapService
18
+ */
19
+
20
+ const ArcGisMapService = {};
21
+ /**
22
+ * Gets or sets the default ArcGIS access token.
23
+ *
24
+ * @type {string}
25
+ */
26
+ ArcGisMapService.defaultAccessToken = defaultAccessToken;
27
+
28
+ /**
29
+ * Gets or sets the URL of the ArcGIS World Imagery tile service.
30
+ *
31
+ * @type {string|Resource}
32
+ * @default https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer
33
+ */
34
+ ArcGisMapService.defaultWorldImageryServer = new Resource({
35
+ url:
36
+ "https://ibasemaps-api.arcgis.com/arcgis/rest/services/World_Imagery/MapServer",
37
+ });
38
+
39
+ /**
40
+ * Gets or sets the URL of the ArcGIS World Hillshade tile service.
41
+ *
42
+ * @type {string|Resource}
43
+ * @default https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer
44
+ */
45
+ ArcGisMapService.defaultWorldHillshadeServer = new Resource({
46
+ url:
47
+ "https://ibasemaps-api.arcgis.com/arcgis/rest/services/Elevation/World_Hillshade/MapServer",
48
+ });
49
+
50
+ /**
51
+ * Gets or sets the URL of the ArcGIS World Oceans tile service.
52
+ *
53
+ * @type {string|Resource}
54
+ * @default https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer
55
+ */
56
+ ArcGisMapService.defaultWorldOceanServer = new Resource({
57
+ url:
58
+ "https://ibasemaps-api.arcgis.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer",
59
+ });
60
+
61
+ /**
62
+ *
63
+ * @param {string} providedKey
64
+ * @return {string|undefined}
65
+ */
66
+ ArcGisMapService.getDefaultTokenCredit = function (providedKey) {
67
+ if (providedKey !== defaultAccessToken) {
68
+ return undefined;
69
+ }
70
+
71
+ if (!defined(defaultTokenCredit)) {
72
+ const defaultTokenMessage =
73
+ '<b> \
74
+ This application is using a default ArcGIS access token. Please assign <i>Cesium.ArcGisMapService.defaultAccessToken</i> \
75
+ with an API key from your ArcGIS Developer account before using the ArcGIS tile services. \
76
+ You can sign up for a free ArcGIS Developer account at <a href="https://developers.arcgis.com/">https://developers.arcgis.com/</a>.</b>';
77
+
78
+ defaultTokenCredit = new Credit(defaultTokenMessage, true);
79
+ }
80
+
81
+ return defaultTokenCredit;
82
+ };
83
+ export default ArcGisMapService;
@@ -2602,9 +2602,8 @@ function rectangleCameraPosition3D(camera, rectangle, result, updateCamera) {
2602
2602
 
2603
2603
  let rightScalar;
2604
2604
  let topScalar;
2605
- const ratio =
2606
- camera.frustum._offCenterFrustum.right /
2607
- camera.frustum._offCenterFrustum.top;
2605
+ const offCenterFrustum = camera.frustum._offCenterFrustum;
2606
+ const ratio = offCenterFrustum.right / offCenterFrustum.top;
2608
2607
  const heightRatio = height * ratio;
2609
2608
  if (width > heightRatio) {
2610
2609
  rightScalar = width;
@@ -2950,8 +2949,9 @@ function getPickRayOrthographic(camera, windowPosition, result) {
2950
2949
  const height = canvas.clientHeight;
2951
2950
 
2952
2951
  let frustum = camera.frustum;
2953
- if (defined(frustum._offCenterFrustum)) {
2954
- frustum = frustum._offCenterFrustum;
2952
+ const offCenterFrustum = frustum.offCenterFrustum;
2953
+ if (defined(offCenterFrustum)) {
2954
+ frustum = offCenterFrustum;
2955
2955
  }
2956
2956
  let x = (2.0 / width) * windowPosition.x - 1.0;
2957
2957
  x *= (frustum.right - frustum.left) * 0.5;
@@ -3440,8 +3440,9 @@ function distanceToBoundingSphere3D(camera, radius) {
3440
3440
 
3441
3441
  function distanceToBoundingSphere2D(camera, radius) {
3442
3442
  let frustum = camera.frustum;
3443
- if (defined(frustum._offCenterFrustum)) {
3444
- frustum = frustum._offCenterFrustum;
3443
+ const offCenterFrustum = frustum.offCenterFrustum;
3444
+ if (defined(offCenterFrustum)) {
3445
+ frustum = offCenterFrustum;
3445
3446
  }
3446
3447
 
3447
3448
  let right, top;
@@ -917,8 +917,9 @@ Cesium3DTile.prototype.getScreenSpaceError = function (
917
917
  frameState.mode === SceneMode.SCENE2D ||
918
918
  frustum instanceof OrthographicFrustum
919
919
  ) {
920
- if (defined(frustum._offCenterFrustum)) {
921
- frustum = frustum._offCenterFrustum;
920
+ const offCenterFrustum = frustum.offCenterFrustum;
921
+ if (defined(offCenterFrustum)) {
922
+ frustum = offCenterFrustum;
922
923
  }
923
924
  const pixelSize =
924
925
  Math.max(frustum.top - frustum.bottom, frustum.right - frustum.left) /
@@ -1796,7 +1797,7 @@ Cesium3DTile.prototype.createBoundingVolume = function (
1796
1797
  */
1797
1798
  Cesium3DTile.prototype.updateTransform = function (parentTransform) {
1798
1799
  parentTransform = defaultValue(parentTransform, Matrix4.IDENTITY);
1799
- const computedTransform = Matrix4.multiply(
1800
+ const computedTransform = Matrix4.multiplyTransformation(
1800
1801
  parentTransform,
1801
1802
  this.transform,
1802
1803
  scratchTransform
@@ -141,7 +141,7 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
141
141
  * try {
142
142
  * const tileset = await Cesium.Cesium3DTileset.fromUrl(
143
143
  * "http://localhost:8002/tilesets/Seattle/tileset.json"
144
- * });
144
+ * );
145
145
  * scene.primitives.add(tileset);
146
146
  * } catch (error) {
147
147
  * console.error(`Error creating tileset: ${error}`);
@@ -2029,7 +2029,7 @@ Cesium3DTileset.fromIonAssetId = async function (assetId, options) {
2029
2029
  * used for streaming massive heterogeneous 3D geospatial datasets.
2030
2030
  *
2031
2031
  * @param {Resource|string} url The url to a tileset JSON file.
2032
- * @param {Cesium3DTileset.ConstructorOptions} options An object describing initialization options
2032
+ * @param {Cesium3DTileset.ConstructorOptions} [options] An object describing initialization options
2033
2033
  * @returns {Promise<Cesium3DTileset>}
2034
2034
  *
2035
2035
  * @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0.
@@ -2040,7 +2040,7 @@ Cesium3DTileset.fromIonAssetId = async function (assetId, options) {
2040
2040
  * try {
2041
2041
  * const tileset = await Cesium.Cesium3DTileset.fromUrl(
2042
2042
  * "http://localhost:8002/tilesets/Seattle/tileset.json"
2043
- * });
2043
+ * );
2044
2044
  * scene.primitives.add(tileset);
2045
2045
  * } catch (error) {
2046
2046
  * console.error(`Error creating tileset: ${error}`);
@@ -3212,7 +3212,7 @@ function update(tileset, frameState, passStatistics, passOptions) {
3212
3212
  for (let i = 0; i < credits.length; ++i) {
3213
3213
  const credit = credits[i];
3214
3214
  credit.showOnScreen = tileset._showCreditsOnScreen;
3215
- frameState.creditDisplay.addCredit(credit);
3215
+ frameState.creditDisplay.addCreditToNextFrame(credit);
3216
3216
  }
3217
3217
  }
3218
3218
  }
@@ -4,6 +4,7 @@ import Check from "../Core/Check.js";
4
4
  import Credit from "../Core/Credit.js";
5
5
  import defaultValue from "../Core/defaultValue.js";
6
6
  import defined from "../Core/defined.js";
7
+ import deprecationWarning from "../Core/deprecationWarning.js";
7
8
  import destroyObject from "../Core/destroyObject.js";
8
9
  import Uri from "urijs";
9
10
 
@@ -303,7 +304,14 @@ function appendCss(container) {
303
304
  * @constructor
304
305
  *
305
306
  * @example
306
- * const creditDisplay = new Cesium.CreditDisplay(creditContainer);
307
+ * // Add a credit with a tooltip, image and link to display onscreen
308
+ * const credit = new Cesium.Credit(`<a href="https://cesium.com/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>`, true);
309
+ * viewer.creditDisplay.addStaticCredit(credit);
310
+ *
311
+ * @example
312
+ * // Add a credit with a plaintext link to display in the lightbox
313
+ * const credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">Cesium</a>');
314
+ * viewer.creditDisplay.addStaticCredit(credit);
307
315
  */
308
316
  function CreditDisplay(container, delimiter, viewport) {
309
317
  //>>includeStart('debug', pragmas.debug);
@@ -373,7 +381,7 @@ function CreditDisplay(container, delimiter, viewport) {
373
381
  this._hideLightbox = hideLightbox;
374
382
  this._expandLink = expandLink;
375
383
  this._expanded = false;
376
- this._defaultCredits = [];
384
+ this._staticCredits = [];
377
385
  this._cesiumCredit = cesiumCredit;
378
386
  this._previousCesiumCredit = undefined;
379
387
  this._currentCesiumCredit = cesiumCredit;
@@ -418,17 +426,36 @@ function setCredit(creditDisplay, credits, credit, count) {
418
426
  }
419
427
  /**
420
428
  * Adds a credit to the list of current credits to be displayed in the credit container
429
+ * for the next frame
421
430
  *
422
431
  * @param {Credit} credit The credit to display
432
+ * @deprecated
423
433
  */
424
434
  CreditDisplay.prototype.addCredit = function (credit) {
435
+ deprecationWarning(
436
+ "CreditDisplay.addCredit",
437
+ "CreditDisplay.addCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addCreditToNextFrame instead."
438
+ );
439
+
440
+ this.addCreditToNextFrame(credit);
441
+ };
442
+
443
+ /**
444
+ * Adds a {@link Credit} that will show on screen or in the lightbox until
445
+ * the next frame. This is mostly for internal use. Use {@link CreditDisplay.addStaticCredit} to add a persistent credit to the screen.
446
+ *
447
+ * @see CreditDisplay.addStaticCredit
448
+ *
449
+ * @param {Credit} credit The credit to display in the next frame.
450
+ */
451
+ CreditDisplay.prototype.addCreditToNextFrame = function (credit) {
425
452
  //>>includeStart('debug', pragmas.debug);
426
453
  Check.defined("credit", credit);
427
454
  //>>includeEnd('debug');
428
455
 
429
456
  if (credit._isIon) {
430
457
  // If this is the an ion logo credit from the ion server
431
- // Juse use the default credit (which is identical) to avoid blinking
458
+ // Just use the default credit (which is identical) to avoid blinking
432
459
  if (!defined(this._defaultCredit)) {
433
460
  this._defaultCredit = Credit.clone(getDefaultCredit());
434
461
  }
@@ -450,40 +477,94 @@ CreditDisplay.prototype.addCredit = function (credit) {
450
477
  * Adds credits that will persist until they are removed
451
478
  *
452
479
  * @param {Credit} credit The credit to added to defaults
480
+ *
481
+ * @deprecated
453
482
  */
454
483
  CreditDisplay.prototype.addDefaultCredit = function (credit) {
455
484
  //>>includeStart('debug', pragmas.debug);
456
485
  Check.defined("credit", credit);
457
486
  //>>includeEnd('debug');
458
487
 
459
- const defaultCredits = this._defaultCredits;
488
+ deprecationWarning(
489
+ "CreditDisplay.addDefaultCredit",
490
+ "CreditDisplay.addDefaultCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addStaticCredit instead."
491
+ );
492
+
493
+ const defaultCredits = this._staticCredits;
460
494
  if (!contains(defaultCredits, credit)) {
495
+ credit.showOnScreen = true;
461
496
  defaultCredits.push(credit);
462
497
  }
463
498
  };
464
499
 
465
500
  /**
466
- * Removes a default credit
501
+ * Adds a {@link Credit} that will show on screen or in the lightbox until removed with {@link CreditDisplay.removeStaticCredit}.
467
502
  *
468
- * @param {Credit} credit The credit to be removed from defaults
503
+ * @param {Credit} credit The credit to added
504
+ *
505
+ * @example
506
+ * // Add a credit with a tooltip, image and link to display onscreen
507
+ * const credit = new Cesium.Credit(`<a href="https://cesium.com/" target="_blank"><img src="/images/cesium_logo.png" title="Cesium"/></a>`, true);
508
+ * viewer.creditDisplay.addStaticCredit(credit);
509
+ *
510
+ * @example
511
+ * // Add a credit with a plaintext link to display in the lightbox
512
+ * const credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">Cesium</a>');
513
+ * viewer.creditDisplay.addStaticCredit(credit);
469
514
  */
470
- CreditDisplay.prototype.removeDefaultCredit = function (credit) {
515
+ CreditDisplay.prototype.addStaticCredit = function (credit) {
516
+ //>>includeStart('debug', pragmas.debug);
517
+ Check.defined("credit", credit);
518
+ //>>includeEnd('debug');
519
+
520
+ const staticCredits = this._staticCredits;
521
+ if (!contains(staticCredits, credit)) {
522
+ staticCredits.push(credit);
523
+ }
524
+ };
525
+
526
+ /**
527
+ * Removes a static credit shown on screen or in the lightbox.
528
+ *
529
+ * @param {Credit} credit The credit to be removed.
530
+ */
531
+ CreditDisplay.prototype.removeStaticCredit = function (credit) {
471
532
  //>>includeStart('debug', pragmas.debug);
472
533
  Check.defined("credit", credit);
473
534
  //>>includeEnd('debug');
474
535
 
475
- const defaultCredits = this._defaultCredits;
476
- const index = defaultCredits.indexOf(credit);
536
+ const staticCredits = this._staticCredits;
537
+ const index = staticCredits.indexOf(credit);
477
538
  if (index !== -1) {
478
- defaultCredits.splice(index, 1);
539
+ staticCredits.splice(index, 1);
479
540
  }
480
541
  };
481
542
 
543
+ /**
544
+ * Removes a default credit.
545
+ *
546
+ * @param {Credit} credit The credit to be removed from defaults
547
+ */
548
+ CreditDisplay.prototype.removeDefaultCredit = function (credit) {
549
+ deprecationWarning(
550
+ "CreditDisplay.removeDefaultCredit",
551
+ "CreditDisplay.removeDefaultCredit was deprecated in CesiumJS 1.105. It will be removed in CesiumJS 1.107. Use CreditDisplay.addStaticCredit instead."
552
+ );
553
+
554
+ this.removeStaticCredit(credit);
555
+ };
556
+
557
+ /**
558
+ * @private
559
+ */
482
560
  CreditDisplay.prototype.showLightbox = function () {
483
561
  this._lightbox.style.display = "block";
484
562
  this._expanded = true;
485
563
  };
486
564
 
565
+ /**
566
+ * @private
567
+ */
487
568
  CreditDisplay.prototype.hideLightbox = function () {
488
569
  this._lightbox.style.display = "none";
489
570
  this._expanded = false;
@@ -506,14 +587,29 @@ CreditDisplay.prototype.beginFrame = function () {
506
587
  this._creditDisplayElementPoolIndex = 0;
507
588
 
508
589
  const screenCredits = currentFrameCredits.screenCredits;
590
+ const lightboxCredits = currentFrameCredits.lightboxCredits;
591
+
509
592
  screenCredits.removeAll();
510
- const defaultCredits = this._defaultCredits;
511
- for (let i = 0; i < defaultCredits.length; ++i) {
512
- const defaultCredit = defaultCredits[i];
513
- setCredit(this, screenCredits, defaultCredit, Number.MAX_VALUE);
514
- }
593
+ lightboxCredits.removeAll();
515
594
 
516
- currentFrameCredits.lightboxCredits.removeAll();
595
+ const staticCredits = this._staticCredits;
596
+ for (let i = 0; i < staticCredits.length; ++i) {
597
+ const staticCredit = staticCredits[i];
598
+ const creditCollection = staticCredit.showOnScreen
599
+ ? screenCredits
600
+ : lightboxCredits;
601
+
602
+ if (
603
+ staticCredit._isIon &&
604
+ Credit.equals(CreditDisplay.cesiumCredit, this._cesiumCredit)
605
+ ) {
606
+ // If this is an ion logo credit from the ion server,
607
+ // make sure to de-duplicate with the default ion credit
608
+ continue;
609
+ }
610
+
611
+ setCredit(this, creditCollection, staticCredit, Number.MAX_VALUE);
612
+ }
517
613
 
518
614
  if (!Credit.equals(CreditDisplay.cesiumCredit, this._cesiumCredit)) {
519
615
  this._cesiumCredit = Credit.clone(CreditDisplay.cesiumCredit);
@@ -352,7 +352,7 @@ function updateCredits(surface, frameState) {
352
352
  surface._terrainProvider._ready &&
353
353
  defined(surface._terrainProvider.credit)
354
354
  ) {
355
- creditDisplay.addCredit(surface._terrainProvider.credit);
355
+ creditDisplay.addCreditToNextFrame(surface._terrainProvider.credit);
356
356
  }
357
357
 
358
358
  const imageryLayers = surface._imageryLayers;
@@ -364,7 +364,7 @@ function updateCredits(surface, frameState) {
364
364
  layer.imageryProvider._ready &&
365
365
  defined(layer.imageryProvider.credit)
366
366
  ) {
367
- creditDisplay.addCredit(layer.imageryProvider.credit);
367
+ creditDisplay.addCreditToNextFrame(layer.imageryProvider.credit);
368
368
  }
369
369
  }
370
370
  }
@@ -2098,7 +2098,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
2098
2098
  tileCreditIndex < tileCreditLength;
2099
2099
  ++tileCreditIndex
2100
2100
  ) {
2101
- creditDisplay.addCredit(tileCredits[tileCreditIndex]);
2101
+ creditDisplay.addCreditToNextFrame(tileCredits[tileCreditIndex]);
2102
2102
  }
2103
2103
  }
2104
2104
 
@@ -2719,7 +2719,7 @@ function addDrawCommandsForTile(tileProvider, tile, frameState) {
2719
2719
  creditIndex < creditLength;
2720
2720
  ++creditIndex
2721
2721
  ) {
2722
- creditDisplay.addCredit(credits[creditIndex]);
2722
+ creditDisplay.addCreditToNextFrame(credits[creditIndex]);
2723
2723
  }
2724
2724
  }
2725
2725
 
@@ -5,6 +5,7 @@ import getJsonFromTypedArray from "../Core/getJsonFromTypedArray.js";
5
5
  import getMagic from "../Core/getMagic.js";
6
6
  import isDataUri from "../Core/isDataUri.js";
7
7
  import Resource from "../Core/Resource.js";
8
+ import RuntimeError from "../Core/RuntimeError.js";
8
9
  import addDefaults from "./GltfPipeline/addDefaults.js";
9
10
  import addPipelineExtras from "./GltfPipeline/addPipelineExtras.js";
10
11
  import ForEach from "./GltfPipeline/ForEach.js";
@@ -14,6 +15,7 @@ import updateVersion from "./GltfPipeline/updateVersion.js";
14
15
  import usesExtension from "./GltfPipeline/usesExtension.js";
15
16
  import ResourceLoader from "./ResourceLoader.js";
16
17
  import ResourceLoaderState from "./ResourceLoaderState.js";
18
+ import ModelUtility from "./Model/ModelUtility.js";
17
19
 
18
20
  /**
19
21
  * Loads a glTF JSON from a glTF or glb.
@@ -242,6 +244,16 @@ async function processGltfJson(gltfJsonLoader, gltf) {
242
244
  await loadEmbeddedBuffers(gltfJsonLoader, gltf);
243
245
  removePipelineExtras(gltf);
244
246
 
247
+ const version = gltf.asset.version;
248
+ if (version !== "1.0" && version !== "2.0") {
249
+ throw new RuntimeError(`Unsupported glTF version: ${version}`);
250
+ }
251
+
252
+ const extensionsRequired = gltf.extensionsRequired;
253
+ if (defined(extensionsRequired)) {
254
+ ModelUtility.checkSupportedExtensions(extensionsRequired);
255
+ }
256
+
245
257
  gltfJsonLoader._gltf = gltf;
246
258
  gltfJsonLoader._state = ResourceLoaderState.READY;
247
259
  return gltfJsonLoader;
@@ -18,7 +18,6 @@ import getAccessorByteStride from "./GltfPipeline/getAccessorByteStride.js";
18
18
  import getComponentReader from "./GltfPipeline/getComponentReader.js";
19
19
  import numberOfComponentsForType from "./GltfPipeline/numberOfComponentsForType.js";
20
20
  import GltfStructuralMetadataLoader from "./GltfStructuralMetadataLoader.js";
21
- import ModelUtility from "./Model/ModelUtility.js";
22
21
  import AttributeType from "./AttributeType.js";
23
22
  import Axis from "./Axis.js";
24
23
  import GltfLoaderUtil from "./GltfLoaderUtil.js";
@@ -240,12 +239,6 @@ function GltfLoader(options) {
240
239
  this._loadForClassification = loadForClassification;
241
240
  this._renameBatchIdSemantic = renameBatchIdSemantic;
242
241
 
243
- // This flag will be set in parse() if the KHR_mesh_quantization extension is
244
- // present in extensionsRequired. This flag is used later when parsing
245
- // attributes. When the extension is present, attributes may be stored as
246
- // quantized integer values instead of floats.
247
- this._hasKhrMeshQuantization = false;
248
-
249
242
  // When loading EXT_feature_metadata, the feature tables and textures
250
243
  // are now stored as arrays like the newer EXT_structural_metadata extension.
251
244
  // This requires sorting the dictionary keys for a consistent ordering.
@@ -392,26 +385,6 @@ async function loadGltfJson(loader) {
392
385
  return;
393
386
  }
394
387
 
395
- const gltf = gltfJsonLoader.gltf;
396
- const version = gltf.asset.version;
397
- if (version !== "1.0" && version !== "2.0") {
398
- const url = loader._gltfResource.url;
399
- throw new RuntimeError(
400
- `Failed to load ${url}: \nUnsupported glTF version: ${version}`
401
- );
402
- }
403
-
404
- const extensionsRequired = gltf.extensionsRequired;
405
- if (defined(extensionsRequired)) {
406
- ModelUtility.checkSupportedExtensions(extensionsRequired);
407
-
408
- // Check for the KHR_mesh_quantization extension here, it will be used later
409
- // in loadAttribute().
410
- loader._hasKhrMeshQuantization = extensionsRequired.includes(
411
- "KHR_mesh_quantization"
412
- );
413
- }
414
-
415
388
  loader._state = GltfLoaderState.LOADED;
416
389
  loader._textureState = GltfLoaderState.LOADED;
417
390
 
@@ -1014,14 +987,7 @@ function setQuantizationFromWeb3dQuantizedAttributes(
1014
987
  attribute.quantization = quantization;
1015
988
  }
1016
989
 
1017
- function createAttribute(
1018
- gltf,
1019
- accessorId,
1020
- name,
1021
- semantic,
1022
- setIndex,
1023
- hasKhrMeshQuantization
1024
- ) {
990
+ function createAttribute(gltf, accessorId, name, semantic, setIndex) {
1025
991
  const accessor = gltf.accessors[accessorId];
1026
992
  const MathType = AttributeType.getMathType(accessor.type);
1027
993
  const normalized = defaultValue(accessor.normalized, false);
@@ -1057,6 +1023,10 @@ function createAttribute(
1057
1023
  // In the glTF 2.0 spec, min and max are not affected by the normalized flag.
1058
1024
  // However, for KHR_mesh_quantization, min and max must be dequantized for
1059
1025
  // normalized values, else the bounding sphere will be computed incorrectly.
1026
+ const hasKhrMeshQuantization = gltf.extensionsRequired?.includes(
1027
+ "KHR_mesh_quantization"
1028
+ );
1029
+
1060
1030
  if (hasKhrMeshQuantization && normalized && isQuantizable) {
1061
1031
  dequantizeMinMax(attribute, MathType);
1062
1032
  }
@@ -1197,8 +1167,7 @@ function loadAttribute(
1197
1167
  accessorId,
1198
1168
  name,
1199
1169
  modelSemantic,
1200
- setIndex,
1201
- loader._hasKhrMeshQuantization
1170
+ setIndex
1202
1171
  );
1203
1172
 
1204
1173
  if (!defined(draco) && !defined(bufferViewId)) {
@@ -296,18 +296,18 @@ Object.defineProperties(IonImageryProvider.prototype, {
296
296
  get: function () {
297
297
  return this._imageryProvider.hasAlphaChannel;
298
298
  },
299
+ },
299
300
 
300
- /**
301
- * Gets the proxy used by this provider.
302
- * @memberof IonImageryProvider.prototype
303
- * @type {Proxy}
304
- * @readonly
305
- * @default undefined
306
- */
307
- proxy: {
308
- get: function () {
309
- return undefined;
310
- },
301
+ /**
302
+ * Gets the proxy used by this provider.
303
+ * @memberof IonImageryProvider.prototype
304
+ * @type {Proxy}
305
+ * @readonly
306
+ * @default undefined
307
+ */
308
+ proxy: {
309
+ get: function () {
310
+ return undefined;
311
311
  },
312
312
  },
313
313
 
@@ -245,18 +245,6 @@ function processMaterialUniforms(
245
245
  defaultEmissiveTexture,
246
246
  disableTextures
247
247
  ) {
248
- const emissiveTexture = material.emissiveTexture;
249
- if (defined(emissiveTexture) && !disableTextures) {
250
- processTexture(
251
- shaderBuilder,
252
- uniformMap,
253
- emissiveTexture,
254
- "u_emissiveTexture",
255
- "EMISSIVE",
256
- defaultEmissiveTexture
257
- );
258
- }
259
-
260
248
  const emissiveFactor = material.emissiveFactor;
261
249
  if (
262
250
  defined(emissiveFactor) &&
@@ -275,6 +263,18 @@ function processMaterialUniforms(
275
263
  undefined,
276
264
  ShaderDestination.FRAGMENT
277
265
  );
266
+
267
+ const emissiveTexture = material.emissiveTexture;
268
+ if (defined(emissiveTexture) && !disableTextures) {
269
+ processTexture(
270
+ shaderBuilder,
271
+ uniformMap,
272
+ emissiveTexture,
273
+ "u_emissiveTexture",
274
+ "EMISSIVE",
275
+ defaultEmissiveTexture
276
+ );
277
+ }
278
278
  }
279
279
 
280
280
  const normalTexture = material.normalTexture;