@cesium/engine 4.0.0 → 5.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 (126) hide show
  1. package/Build/Workers/{chunk-LGSGX2RH.js → chunk-2U6EBIRX.js} +10 -10
  2. package/Build/Workers/{chunk-FVDTKX3F.js → chunk-2ZI7FZ3Q.js} +2 -2
  3. package/Build/Workers/{chunk-DJUTBX6A.js → chunk-3TSHZWOZ.js} +2 -2
  4. package/Build/Workers/{chunk-FYHCAKU6.js → chunk-44B6FQSJ.js} +11 -11
  5. package/Build/Workers/{chunk-4VWUFKYW.js → chunk-4AJR66C5.js} +12 -12
  6. package/Build/Workers/{chunk-PWDYKCNC.js → chunk-4HN3N5SE.js} +4 -4
  7. package/Build/Workers/{chunk-I5MQWHBR.js → chunk-4QGPYV3W.js} +4 -4
  8. package/Build/Workers/{chunk-C6MRR5YL.js → chunk-4RKE4B3G.js} +7 -7
  9. package/Build/Workers/{chunk-P4M4QUNQ.js → chunk-5E3V7Y4R.js} +6 -6
  10. package/Build/Workers/{chunk-UN7AK64D.js → chunk-6EHT6GS3.js} +2 -2
  11. package/Build/Workers/{chunk-PGB3EFR7.js → chunk-6I22NWKQ.js} +6 -6
  12. package/Build/Workers/{chunk-7IMAWM6A.js → chunk-7N67FBLW.js} +229 -17
  13. package/Build/Workers/{chunk-LQRFWCNX.js → chunk-AQQGAFKX.js} +5 -5
  14. package/Build/Workers/{chunk-TF5D2H7B.js → chunk-CROU4RHL.js} +5 -5
  15. package/Build/Workers/{chunk-KAFF2QX3.js → chunk-CTJCECTX.js} +5 -5
  16. package/Build/Workers/{chunk-FKHRSGKP.js → chunk-DWJZFZ67.js} +13 -13
  17. package/Build/Workers/{chunk-V2LKNJGT.js → chunk-EHJQEARC.js} +5 -5
  18. package/Build/Workers/{chunk-VSCXSFHE.js → chunk-EVLKHUAE.js} +13 -13
  19. package/Build/Workers/{chunk-YLAFWVOW.js → chunk-FOOYJER7.js} +10 -10
  20. package/Build/Workers/{chunk-F7P2HCYZ.js → chunk-GLCRFDOB.js} +2 -2
  21. package/Build/Workers/{chunk-BT6YIL2N.js → chunk-GPO47TW4.js} +1 -1
  22. package/Build/Workers/{chunk-AXGQUPXA.js → chunk-H5Q2JKIA.js} +17 -17
  23. package/Build/Workers/{chunk-XJCTFTBM.js → chunk-HIDSEUWS.js} +5 -5
  24. package/Build/Workers/{chunk-UGZGTV5K.js → chunk-HV67ARO7.js} +8 -8
  25. package/Build/Workers/{chunk-H52L6U76.js → chunk-IC7G4BX2.js} +11 -11
  26. package/Build/Workers/{chunk-2C65EKYA.js → chunk-IQN2LMGD.js} +1 -1
  27. package/Build/Workers/chunk-J2FHYK2Z.js +55 -0
  28. package/Build/Workers/{chunk-4V6RCTVH.js → chunk-K3VEWONC.js} +10 -10
  29. package/Build/Workers/{chunk-RDCDRNJ7.js → chunk-KZFXE35V.js} +6 -6
  30. package/Build/Workers/{chunk-SGRWJKNO.js → chunk-MG2TXIO5.js} +15 -15
  31. package/Build/Workers/{chunk-2NLMZNJI.js → chunk-MRCFDEKH.js} +4 -4
  32. package/Build/Workers/{chunk-PW5CA4MJ.js → chunk-MYDS6HBL.js} +7 -7
  33. package/Build/Workers/{chunk-H6MBQ4W4.js → chunk-OCIX2CQ7.js} +4 -4
  34. package/Build/Workers/{chunk-HCZR75II.js → chunk-P32XMW4I.js} +15 -15
  35. package/Build/Workers/{chunk-G3MOT7BZ.js → chunk-PEVZYZBQ.js} +6 -6
  36. package/Build/Workers/{chunk-EQ6ZAP37.js → chunk-PMDLIBEQ.js} +7 -7
  37. package/Build/Workers/{chunk-RDM3BKNC.js → chunk-QDUOGCCO.js} +11 -11
  38. package/Build/Workers/{chunk-P7PWX5HR.js → chunk-QUCJGBCK.js} +7 -7
  39. package/Build/Workers/{chunk-RRUPTJ6P.js → chunk-RCI7BSOM.js} +6 -6
  40. package/Build/Workers/{chunk-NRETMGYL.js → chunk-SVTSC7FX.js} +13 -13
  41. package/Build/Workers/{chunk-QVJ6IRKV.js → chunk-TXOGSFHZ.js} +1 -1
  42. package/Build/Workers/{chunk-527JG4D7.js → chunk-TXYJOVQK.js} +1 -1
  43. package/Build/Workers/{chunk-QIS3NB7U.js → chunk-UFIT5XDI.js} +7 -7
  44. package/Build/Workers/{chunk-FE2XG3SS.js → chunk-ULLMQNFQ.js} +3 -3
  45. package/Build/Workers/{chunk-U5LKG6LX.js → chunk-UM7FIUQW.js} +2 -2
  46. package/Build/Workers/{chunk-A6EA6KIE.js → chunk-UMLTOPAE.js} +1 -1
  47. package/Build/Workers/{chunk-5U4UHRZ2.js → chunk-V5S5N2IS.js} +10 -10
  48. package/Build/Workers/{chunk-TVYIHH4V.js → chunk-VN2IHJKM.js} +14 -14
  49. package/Build/Workers/{chunk-YMJPANZZ.js → chunk-VWSD2XV5.js} +10 -34
  50. package/Build/Workers/{chunk-XZVQMPWG.js → chunk-X2KIWBTW.js} +5 -5
  51. package/Build/Workers/{chunk-7CZEWQWE.js → chunk-Y24CDOJC.js} +6 -6
  52. package/Build/Workers/{chunk-N5MMDSD2.js → chunk-YLMDWSXO.js} +2 -2
  53. package/Build/Workers/{chunk-27R2KRIK.js → chunk-YNZ4DMR7.js} +6 -6
  54. package/Build/Workers/{chunk-YLS3FX3U.js → chunk-Z2MP3UBE.js} +7 -7
  55. package/Build/Workers/combineGeometry.js +23 -23
  56. package/Build/Workers/createBoxGeometry.js +17 -17
  57. package/Build/Workers/createBoxOutlineGeometry.js +15 -15
  58. package/Build/Workers/createCircleGeometry.js +25 -25
  59. package/Build/Workers/createCircleOutlineGeometry.js +18 -18
  60. package/Build/Workers/createCoplanarPolygonGeometry.js +32 -32
  61. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +30 -30
  62. package/Build/Workers/createCorridorGeometry.js +29 -28
  63. package/Build/Workers/createCorridorOutlineGeometry.js +28 -27
  64. package/Build/Workers/createCylinderGeometry.js +19 -19
  65. package/Build/Workers/createCylinderOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipseGeometry.js +25 -25
  67. package/Build/Workers/createEllipseOutlineGeometry.js +18 -18
  68. package/Build/Workers/createEllipsoidGeometry.js +18 -18
  69. package/Build/Workers/createEllipsoidOutlineGeometry.js +17 -17
  70. package/Build/Workers/createFrustumGeometry.js +17 -17
  71. package/Build/Workers/createFrustumOutlineGeometry.js +17 -17
  72. package/Build/Workers/createGeometry.js +23 -23
  73. package/Build/Workers/createGroundPolylineGeometry.js +21 -21
  74. package/Build/Workers/createPlaneGeometry.js +15 -15
  75. package/Build/Workers/createPlaneOutlineGeometry.js +14 -14
  76. package/Build/Workers/createPolygonGeometry.js +469 -60
  77. package/Build/Workers/createPolygonOutlineGeometry.js +29 -29
  78. package/Build/Workers/createPolylineGeometry.js +24 -24
  79. package/Build/Workers/createPolylineVolumeGeometry.js +33 -31
  80. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -26
  81. package/Build/Workers/createRectangleGeometry.js +26 -26
  82. package/Build/Workers/createRectangleOutlineGeometry.js +19 -19
  83. package/Build/Workers/createSimplePolylineGeometry.js +22 -22
  84. package/Build/Workers/createSphereGeometry.js +18 -18
  85. package/Build/Workers/createSphereOutlineGeometry.js +17 -17
  86. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  87. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  88. package/Build/Workers/createVectorTileGeometries.js +23 -23
  89. package/Build/Workers/createVectorTilePoints.js +12 -12
  90. package/Build/Workers/createVectorTilePolygons.js +21 -21
  91. package/Build/Workers/createVectorTilePolylines.js +14 -14
  92. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +21 -21
  93. package/Build/Workers/createVerticesFromHeightmap.js +21 -21
  94. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +18 -18
  95. package/Build/Workers/createWallGeometry.js +23 -23
  96. package/Build/Workers/createWallOutlineGeometry.js +22 -22
  97. package/Build/Workers/decodeDraco.js +11 -11
  98. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  99. package/Build/Workers/decodeI3S.js +9 -9
  100. package/Build/Workers/transcodeKTX2.js +7 -7
  101. package/Build/Workers/transferTypedArrayTest.js +1 -1
  102. package/Build/Workers/upsampleQuantizedTerrainMesh.js +21 -21
  103. package/Source/Core/Credit.js +7 -1
  104. package/Source/Core/GoogleMaps.js +1 -2
  105. package/Source/Core/Ion.js +1 -2
  106. package/Source/Core/PolygonGeometry.js +340 -27
  107. package/Source/Core/PolygonGeometryLibrary.js +302 -1
  108. package/Source/Core/Stereographic.js +247 -0
  109. package/Source/Core/TaskProcessor.js +53 -40
  110. package/Source/Core/buildModuleUrl.js +1 -1
  111. package/Source/Core/sampleTerrain.js +43 -10
  112. package/Source/Core/sampleTerrainMostDetailed.js +27 -3
  113. package/Source/Scene/ArcGisMapService.js +1 -2
  114. package/Source/Scene/Billboard.js +7 -0
  115. package/Source/Scene/Cesium3DTilePass.js +1 -1
  116. package/Source/Scene/Cesium3DTileset.js +38 -81
  117. package/Source/Scene/CreditDisplay.js +2 -2
  118. package/Source/Scene/LabelCollection.js +3 -1
  119. package/Source/Scene/Model/Model.js +16 -22
  120. package/Source/Scene/PostProcessStageLibrary.js +3 -3
  121. package/Source/Scene/PrimitiveCollection.js +39 -0
  122. package/Source/Scene/Scene.js +3 -0
  123. package/Source/Widget/CesiumWidget.js +2 -1
  124. package/index.d.ts +53 -28
  125. package/index.js +108 -107
  126. package/package.json +1 -1
@@ -41,7 +41,7 @@ function getCesiumBaseUrl() {
41
41
  let baseUrlString;
42
42
  if (typeof CESIUM_BASE_URL !== "undefined") {
43
43
  baseUrlString = CESIUM_BASE_URL;
44
- } else if (defined(import.meta) && defined(import.meta.url)) {
44
+ } else if (defined(import.meta?.url)) {
45
45
  // ESM
46
46
  baseUrlString = getAbsoluteUri(".", import.meta.url);
47
47
  } else if (
@@ -20,6 +20,7 @@ import defined from "./defined.js";
20
20
  * @param {TerrainProvider} terrainProvider The terrain provider from which to query heights.
21
21
  * @param {number} level The terrain level-of-detail from which to query terrain heights.
22
22
  * @param {Cartographic[]} positions The positions to update with terrain heights.
23
+ * @param {boolean} [rejectOnTileFail=false] If true, for a failed terrain tile request the promise will be rejected. If false, returned heights will be undefined.
23
24
  * @returns {Promise<Cartographic[]>} A promise that resolves to the provided list of positions when terrain the query has completed.
24
25
  *
25
26
  * @see sampleTerrainMostDetailed
@@ -34,26 +35,43 @@ import defined from "./defined.js";
34
35
  * const updatedPositions = await Cesium.sampleTerrain(terrainProvider, 11, positions);
35
36
  * // positions[0].height and positions[1].height have been updated.
36
37
  * // updatedPositions is just a reference to positions.
38
+ *
39
+ * // To handle tile errors, pass true for the rejectOnTileFail parameter.
40
+ * try {
41
+ * const updatedPositions = await Cesium.sampleTerrain(terrainProvider, 11, positions, true);
42
+ * } catch (error) {
43
+ * // A tile request error occurred.
44
+ * }
37
45
  */
38
- async function sampleTerrain(terrainProvider, level, positions) {
46
+ async function sampleTerrain(
47
+ terrainProvider,
48
+ level,
49
+ positions,
50
+ rejectOnTileFail
51
+ ) {
52
+ if (!defined(rejectOnTileFail)) {
53
+ rejectOnTileFail = false;
54
+ }
39
55
  //>>includeStart('debug', pragmas.debug);
40
56
  Check.typeOf.object("terrainProvider", terrainProvider);
41
57
  Check.typeOf.number("level", level);
58
+ Check.typeOf.bool("rejectOnTileFail", rejectOnTileFail);
42
59
  Check.defined("positions", positions);
43
60
  //>>includeEnd('debug');
44
61
 
45
- return doSampling(terrainProvider, level, positions);
62
+ return doSampling(terrainProvider, level, positions, rejectOnTileFail);
46
63
  }
47
64
 
48
65
  /**
49
66
  * @param {object[]} tileRequests The mutated list of requests, the first one will be attempted
50
67
  * @param {Array<Promise<void>>} results The list to put the result promises into
68
+ * @param {boolean} rejectOnTileFail If true, the promise will be rejected. If false, returned heights will be undefined.
51
69
  * @returns {boolean} true if the request was made, and we are okay to attempt the next item immediately,
52
70
  * or false if we were throttled and should wait awhile before retrying.
53
71
  *
54
72
  * @private
55
73
  */
56
- function attemptConsumeNextQueueItem(tileRequests, results) {
74
+ function attemptConsumeNextQueueItem(tileRequests, results, rejectOnTileFail) {
57
75
  const tileRequest = tileRequests[0];
58
76
  const requestPromise = tileRequest.terrainProvider.requestTileGeometry(
59
77
  tileRequest.x,
@@ -66,9 +84,15 @@ function attemptConsumeNextQueueItem(tileRequests, results) {
66
84
  return false;
67
85
  }
68
86
 
69
- const promise = requestPromise
70
- .then(createInterpolateFunction(tileRequest))
71
- .catch(createMarkFailedFunction(tileRequest));
87
+ let promise;
88
+
89
+ if (rejectOnTileFail) {
90
+ promise = requestPromise.then(createInterpolateFunction(tileRequest));
91
+ } else {
92
+ promise = requestPromise
93
+ .then(createInterpolateFunction(tileRequest))
94
+ .catch(createMarkFailedFunction(tileRequest));
95
+ }
72
96
 
73
97
  // remove the request we've just done from the queue
74
98
  // and add its promise result to the result list
@@ -95,11 +119,12 @@ function delay(ms) {
95
119
  * and a Promise of each result has been put into the results list
96
120
  * @param {object[]} tileRequests The list of requests desired to be made
97
121
  * @param {Array<Promise<void>>} results The list to put all the result promises into
122
+ * @param {boolean} rejectOnTileFail If true, the promise will be rejected. If false, returned heights will be undefined.
98
123
  * @returns {Promise<void>} A promise which resolves once all requests have been started
99
124
  *
100
125
  * @private
101
126
  */
102
- function drainTileRequestQueue(tileRequests, results) {
127
+ function drainTileRequestQueue(tileRequests, results, rejectOnTileFail) {
103
128
  // nothing left to do
104
129
  if (!tileRequests.length) {
105
130
  return Promise.resolve();
@@ -108,7 +133,11 @@ function drainTileRequestQueue(tileRequests, results) {
108
133
  // consume an item from the queue, which will
109
134
  // mutate the request and result lists, and return true if we should
110
135
  // immediately attempt to consume the next item as well
111
- const success = attemptConsumeNextQueueItem(tileRequests, results);
136
+ const success = attemptConsumeNextQueueItem(
137
+ tileRequests,
138
+ results,
139
+ rejectOnTileFail
140
+ );
112
141
  if (success) {
113
142
  return drainTileRequestQueue(tileRequests, results);
114
143
  }
@@ -119,7 +148,7 @@ function drainTileRequestQueue(tileRequests, results) {
119
148
  });
120
149
  }
121
150
 
122
- function doSampling(terrainProvider, level, positions) {
151
+ function doSampling(terrainProvider, level, positions, rejectOnTileFail) {
123
152
  const tilingScheme = terrainProvider.tilingScheme;
124
153
 
125
154
  let i;
@@ -155,7 +184,11 @@ function doSampling(terrainProvider, level, positions) {
155
184
 
156
185
  // create our list of result promises to be filled
157
186
  const tilePromises = [];
158
- return drainTileRequestQueue(tileRequests, tilePromises).then(function () {
187
+ return drainTileRequestQueue(
188
+ tileRequests,
189
+ tilePromises,
190
+ rejectOnTileFail
191
+ ).then(function () {
159
192
  // now all the required requests have been started
160
193
  // we just wait for them all to finish
161
194
  return Promise.all(tilePromises).then(function () {
@@ -12,6 +12,7 @@ const scratchCartesian2 = new Cartesian2();
12
12
  *
13
13
  * @param {TerrainProvider} terrainProvider The terrain provider from which to query heights.
14
14
  * @param {Cartographic[]} positions The positions to update with terrain heights.
15
+ * @param {boolean} [rejectOnTileFail=false] If true, for a failed terrain tile request the promise will be rejected. If false, returned heights will be undefined.
15
16
  * @returns {Promise<Cartographic[]>} A promise that resolves to the provided list of positions when terrain the query has completed. This
16
17
  * promise will reject if the terrain provider's `availability` property is undefined.
17
18
  *
@@ -25,8 +26,22 @@ const scratchCartesian2 = new Cartesian2();
25
26
  * const updatedPositions = await Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
26
27
  * // positions[0].height and positions[1].height have been updated.
27
28
  * // updatedPositions is just a reference to positions.
29
+ *
30
+ * // To handle tile errors, pass true for the rejectOnTileFail parameter.
31
+ * try {
32
+ * const updatedPositions = await Cesium.sampleTerrainMostDetailed(terrainProvider, positions, true);
33
+ * } catch (error) {
34
+ * // A tile request error occurred.
35
+ * }
28
36
  */
29
- async function sampleTerrainMostDetailed(terrainProvider, positions) {
37
+ async function sampleTerrainMostDetailed(
38
+ terrainProvider,
39
+ positions,
40
+ rejectOnTileFail
41
+ ) {
42
+ if (!defined(rejectOnTileFail)) {
43
+ rejectOnTileFail = false;
44
+ }
30
45
  //>>includeStart('debug', pragmas.debug);
31
46
  if (!defined(terrainProvider)) {
32
47
  throw new DeveloperError("terrainProvider is required.");
@@ -84,7 +99,12 @@ async function sampleTerrainMostDetailed(terrainProvider, positions) {
84
99
  await Promise.all(
85
100
  byLevel.map(function (positionsAtLevel, index) {
86
101
  if (defined(positionsAtLevel)) {
87
- return sampleTerrain(terrainProvider, index, positionsAtLevel);
102
+ return sampleTerrain(
103
+ terrainProvider,
104
+ index,
105
+ positionsAtLevel,
106
+ rejectOnTileFail
107
+ );
88
108
  }
89
109
  })
90
110
  );
@@ -100,7 +120,11 @@ async function sampleTerrainMostDetailed(terrainProvider, positions) {
100
120
  }
101
121
 
102
122
  if (changedPositions.length > 0) {
103
- await sampleTerrainMostDetailed(terrainProvider, changedPositions);
123
+ await sampleTerrainMostDetailed(
124
+ terrainProvider,
125
+ changedPositions,
126
+ rejectOnTileFail
127
+ );
104
128
  }
105
129
 
106
130
  return positions;
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "AAPK101bfb95c8624cafa30b55ec1709f9e65mp_hzhcQWdW-Km2L7Gukj--gHqZ8PQIEfih4Wa00sxBZyuTpBisCt5aJNvQm32h";
7
+ "AAPK4db83df15a06415e9b7d45d826eec992u0REAmuLmykhOFOk_4e61HgsO_e3C_qGUgiWNGElpjpiMfO9_Qg5ZRyy8POvB5EF";
8
8
  /**
9
9
  * Default options for accessing the ArcGIS image tile service.
10
10
  *
@@ -76,7 +76,6 @@ ArcGisMapService.getDefaultTokenCredit = function (providedKey) {
76
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
77
 
78
78
  defaultTokenCredit = new Credit(defaultTokenMessage, true);
79
- defaultTokenCredit._isDefaultToken = true;
80
79
  }
81
80
 
82
81
  return defaultTokenCredit;
@@ -1166,6 +1166,13 @@ Billboard.prototype._loadImage = function () {
1166
1166
  that._image = undefined;
1167
1167
  that._imageIndexPromise = undefined;
1168
1168
  makeDirty(that, IMAGE_INDEX_INDEX);
1169
+
1170
+ const scene = that._billboardCollection._scene;
1171
+ if (!defined(scene)) {
1172
+ return;
1173
+ }
1174
+ // Request a new render in request render mode
1175
+ scene.frameState.afterRender.push(() => true);
1169
1176
  }
1170
1177
 
1171
1178
  if (defined(image)) {
@@ -39,7 +39,7 @@ passOptions[Cesium3DTilePass.SHADOW] = Object.freeze({
39
39
  });
40
40
 
41
41
  passOptions[Cesium3DTilePass.PRELOAD] = Object.freeze({
42
- pass: Cesium3DTilePass.SHADOW,
42
+ pass: Cesium3DTilePass.PRELOAD,
43
43
  isRender: false,
44
44
  requestTiles: true,
45
45
  ignoreCommands: true,
@@ -67,7 +67,6 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
67
67
  * @property {Axis} [modelForwardAxis=Axis.X] Which axis is considered forward when loading models for tile contents.
68
68
  * @property {ShadowMode} [shadows=ShadowMode.ENABLED] Determines whether the tileset casts or receives shadows from light sources.
69
69
  * @property {number} [maximumScreenSpaceError=16] The maximum screen space error used to drive level of detail refinement.
70
- * @property {number} [maximumMemoryUsage=512] The maximum amount of memory in MB that can be used by the tileset. Deprecated.
71
70
  * @property {number} [cacheBytes=536870912] The size (in bytes) to which the tile cache will be trimmed, if the cache contains tiles not needed for the current view.
72
71
  * @property {number} [maximumCacheOverflowBytes=536870912] The maximum additional memory (in bytes) to allow for cache headroom, if more than {@link Cesium3DTileset#cacheBytes} are needed for the current view.
73
72
  * @property {boolean} [cullWithChildrenBounds=true] Optimization option. Whether to cull tiles using the union of their children bounding volumes.
@@ -224,15 +223,7 @@ function Cesium3DTileset(options) {
224
223
  );
225
224
  this._memoryAdjustedScreenSpaceError = this._maximumScreenSpaceError;
226
225
 
227
- let defaultCacheBytes = 512 * 1024 * 1024;
228
- if (defined(options.maximumMemoryUsage)) {
229
- deprecationWarning(
230
- "Cesium3DTileset.maximumMemoryUsage",
231
- "Cesium3DTileset.maximumMemoryUsage was deprecated in CesiumJS 1.107. It will be removed in CesiumJS 1.110. Use Cesium3DTileset.cacheBytes instead."
232
- );
233
- defaultCacheBytes = options.maximumMemoryUsage * 1024 * 1024;
234
- }
235
- this._cacheBytes = defaultValue(options.cacheBytes, defaultCacheBytes);
226
+ this._cacheBytes = defaultValue(options.cacheBytes, 512 * 1024 * 1024);
236
227
  //>>includeStart('debug', pragmas.debug);
237
228
  Check.typeOf.number.greaterThanOrEquals("cacheBytes", this._cacheBytes, 0);
238
229
  //>>includeEnd('debug');
@@ -1376,57 +1367,6 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1376
1367
  },
1377
1368
  },
1378
1369
 
1379
- /**
1380
- * The maximum amount of GPU memory (in MB) that may be used to cache tiles. This value is estimated from
1381
- * geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also
1382
- * includes per-point metadata.
1383
- * <p>
1384
- * Tiles not in view are unloaded to enforce this.
1385
- * </p>
1386
- * <p>
1387
- * If decreasing this value results in unloading tiles, the tiles are unloaded the next frame.
1388
- * </p>
1389
- * <p>
1390
- * If tiles sized more than <code>maximumMemoryUsage</code> are needed
1391
- * to meet the desired screen space error, determined by {@link Cesium3DTileset#maximumScreenSpaceError},
1392
- * for the current view, then the memory usage of the tiles loaded will exceed
1393
- * <code>maximumMemoryUsage</code>. For example, if the maximum is 256 MB, but
1394
- * 300 MB of tiles are needed to meet the screen space error, then 300 MB of tiles may be loaded. When
1395
- * these tiles go out of view, they will be unloaded.
1396
- * </p>
1397
- *
1398
- * @memberof Cesium3DTileset.prototype
1399
- *
1400
- * @type {number}
1401
- * @default 512
1402
- *
1403
- * @exception {DeveloperError} <code>maximumMemoryUsage</code> must be greater than or equal to zero.
1404
- * @see Cesium3DTileset#totalMemoryUsageInBytes
1405
- *
1406
- * @deprecated
1407
- */
1408
- maximumMemoryUsage: {
1409
- get: function () {
1410
- deprecationWarning(
1411
- "Cesium3DTileset.maximumMemoryUsage",
1412
- "Cesium3DTileset.maximumMemoryUsage was deprecated in CesiumJS 1.107. It will be removed in CesiumJS 1.110. Use Cesium3DTileset.cacheBytes instead."
1413
- );
1414
- return this._maximumMemoryUsage;
1415
- },
1416
- set: function (value) {
1417
- deprecationWarning(
1418
- "Cesium3DTileset.maximumMemoryUsage",
1419
- "Cesium3DTileset.maximumMemoryUsage was deprecated in CesiumJS 1.107. It will be removed in CesiumJS 1.110. Use Cesium3DTileset.cacheBytes instead."
1420
- );
1421
- //>>includeStart('debug', pragmas.debug);
1422
- Check.typeOf.number.greaterThanOrEquals("value", value, 0);
1423
- //>>includeEnd('debug');
1424
-
1425
- this._maximumMemoryUsage = value;
1426
- this._cacheBytes = value * 1024 * 1024;
1427
- },
1428
- },
1429
-
1430
1370
  /**
1431
1371
  * The amount of GPU memory (in bytes) used to cache tiles. This memory usage is estimated from
1432
1372
  * geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also
@@ -1880,6 +1820,7 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1880
1820
  },
1881
1821
  set: function (value) {
1882
1822
  this._showCreditsOnScreen = value;
1823
+ createCredits(this);
1883
1824
  },
1884
1825
  },
1885
1826
 
@@ -2068,24 +2009,7 @@ Cesium3DTileset.fromUrl = async function (url, options) {
2068
2009
  tileset._asset = asset;
2069
2010
  tileset._extras = tilesetJson.extras;
2070
2011
 
2071
- let credits = resource.credits;
2072
- if (!defined(credits)) {
2073
- credits = [];
2074
- }
2075
-
2076
- const assetExtras = asset.extras;
2077
- if (
2078
- defined(assetExtras) &&
2079
- defined(assetExtras.cesium) &&
2080
- defined(assetExtras.cesium.credits)
2081
- ) {
2082
- const extraCredits = assetExtras.cesium.credits;
2083
- for (let i = 0; i < extraCredits.length; ++i) {
2084
- const credit = extraCredits[i];
2085
- credits.push(new Credit(credit.html, tileset._showCreditsOnScreen));
2086
- }
2087
- }
2088
- tileset._credits = credits;
2012
+ createCredits(tileset);
2089
2013
 
2090
2014
  // Handle legacy gltfUpAxis option
2091
2015
  const gltfUpAxis = defined(tilesetJson.asset.gltfUpAxis)
@@ -3210,8 +3134,6 @@ function update(tileset, frameState, passStatistics, passOptions) {
3210
3134
  if (defined(credits) && statistics.selected !== 0) {
3211
3135
  for (let i = 0; i < credits.length; ++i) {
3212
3136
  const credit = credits[i];
3213
- credit.showOnScreen =
3214
- tileset._showCreditsOnScreen || credit._isDefaultToken;
3215
3137
  frameState.creditDisplay.addCreditToNextFrame(credit);
3216
3138
  }
3217
3139
  }
@@ -3220,6 +3142,41 @@ function update(tileset, frameState, passStatistics, passOptions) {
3220
3142
  return ready;
3221
3143
  }
3222
3144
 
3145
+ function createCredits(tileset) {
3146
+ let credits = tileset._credits;
3147
+ if (!defined(credits)) {
3148
+ credits = [];
3149
+ }
3150
+ credits.length = 0;
3151
+
3152
+ if (defined(tileset.resource.credits)) {
3153
+ tileset.resource.credits.forEach((credit) => {
3154
+ credits.push(Credit.clone(credit));
3155
+ });
3156
+ }
3157
+
3158
+ const assetExtras = tileset.asset.extras;
3159
+ if (
3160
+ defined(assetExtras) &&
3161
+ defined(assetExtras.cesium) &&
3162
+ defined(assetExtras.cesium.credits)
3163
+ ) {
3164
+ const extraCredits = assetExtras.cesium.credits;
3165
+ for (let i = 0; i < extraCredits.length; ++i) {
3166
+ const credit = extraCredits[i];
3167
+ credits.push(new Credit(credit.html));
3168
+ }
3169
+ }
3170
+
3171
+ credits.forEach(
3172
+ (credit) =>
3173
+ (credit.showOnScreen =
3174
+ credit.showOnScreen || tileset._showCreditsOnScreen)
3175
+ );
3176
+
3177
+ tileset._credits = credits;
3178
+ }
3179
+
3223
3180
  /**
3224
3181
  * @private
3225
3182
  * @param {object} passOptions
@@ -437,7 +437,7 @@ CreditDisplay.prototype.addCreditToNextFrame = function (credit) {
437
437
  Check.defined("credit", credit);
438
438
  //>>includeEnd('debug');
439
439
 
440
- if (credit._isIon) {
440
+ if (credit.isIon()) {
441
441
  // If this is the an ion logo credit from the ion server
442
442
  // Just use the default credit (which is identical) to avoid blinking
443
443
  if (!defined(this._defaultCredit)) {
@@ -546,7 +546,7 @@ CreditDisplay.prototype.beginFrame = function () {
546
546
  : lightboxCredits;
547
547
 
548
548
  if (
549
- staticCredit._isIon &&
549
+ staticCredit.isIon() &&
550
550
  Credit.equals(CreditDisplay.cesiumCredit, this._cesiumCredit)
551
551
  ) {
552
552
  // If this is an ion logo credit from the ion server,
@@ -56,7 +56,7 @@ function addWhitePixelCanvas(textureAtlas) {
56
56
 
57
57
  // Canvas operations take a frame to draw. Use the asynchronous add function which resolves a promise and allows the draw to complete,
58
58
  // but there's no need to wait on the promise before operation can continue
59
- textureAtlas.addImage(whitePixelCanvasId, canvas);
59
+ return textureAtlas.addImage(whitePixelCanvasId, canvas);
60
60
  }
61
61
 
62
62
  // reusable object for calling writeTextToCanvas
@@ -911,6 +911,8 @@ LabelCollection.prototype.update = function (frameState) {
911
911
  initialSize: whitePixelSize,
912
912
  });
913
913
  backgroundBillboardCollection.textureAtlas = this._backgroundTextureAtlas;
914
+
915
+ // Request a new render in request render mode after the next frame renders
914
916
  addWhitePixelCanvas(this._backgroundTextureAtlas);
915
917
  }
916
918
 
@@ -408,6 +408,7 @@ function Model(options) {
408
408
  credit = new Credit(credit);
409
409
  }
410
410
 
411
+ this._credits = [];
411
412
  this._credit = credit;
412
413
 
413
414
  // Credits to be added from the Resource (if it is an IonResource)
@@ -2258,24 +2259,29 @@ function updateShowCreditsOnScreen(model) {
2258
2259
  return;
2259
2260
  }
2260
2261
  model._showCreditsOnScreenDirty = false;
2262
+ model._credits.length = 0;
2261
2263
 
2262
2264
  const showOnScreen = model._showCreditsOnScreen;
2263
2265
  if (defined(model._credit)) {
2264
- model._credit.showOnScreen = showOnScreen || model._credit._isDefaultToken;
2266
+ const credit = Credit.clone(model._credit);
2267
+ credit.showOnScreen = credit.showOnScreen || showOnScreen;
2268
+ model._credits.push(credit);
2265
2269
  }
2266
2270
 
2267
2271
  const resourceCredits = model._resourceCredits;
2268
2272
  const resourceCreditsLength = resourceCredits.length;
2269
2273
  for (let i = 0; i < resourceCreditsLength; i++) {
2270
- resourceCredits[i].showOnScreen =
2271
- showOnScreen || resourceCredits[i]._isDefaultToken;
2274
+ const credit = Credit.clone(resourceCredits[i]);
2275
+ credit.showOnScreen = credit.showOnScreen || showOnScreen;
2276
+ model._credits.push(credit);
2272
2277
  }
2273
2278
 
2274
2279
  const gltfCredits = model._gltfCredits;
2275
2280
  const gltfCreditsLength = gltfCredits.length;
2276
2281
  for (let i = 0; i < gltfCreditsLength; i++) {
2277
- gltfCredits[i].showOnScreen =
2278
- showOnScreen || gltfCredits[i]._isDefaultToken;
2282
+ const credit = Credit.clone(gltfCredits[i]);
2283
+ credit.showOnScreen = credit.showOnScreen || showOnScreen;
2284
+ model._credits.push(credit);
2279
2285
  }
2280
2286
  }
2281
2287
 
@@ -2385,22 +2391,10 @@ function passesDistanceDisplayCondition(model, frameState) {
2385
2391
 
2386
2392
  function addCreditsToCreditDisplay(model, frameState) {
2387
2393
  const creditDisplay = frameState.creditDisplay;
2388
- // Add all credits to the credit display.
2389
- const credit = model._credit;
2390
- if (defined(credit)) {
2391
- creditDisplay.addCreditToNextFrame(credit);
2392
- }
2393
-
2394
- const resourceCredits = model._resourceCredits;
2395
- const resourceCreditsLength = resourceCredits.length;
2396
- for (let c = 0; c < resourceCreditsLength; c++) {
2397
- creditDisplay.addCreditToNextFrame(resourceCredits[c]);
2398
- }
2399
-
2400
- const gltfCredits = model._gltfCredits;
2401
- const gltfCreditsLength = gltfCredits.length;
2402
- for (let c = 0; c < gltfCreditsLength; c++) {
2403
- creditDisplay.addCreditToNextFrame(gltfCredits[c]);
2394
+ const credits = model._credits;
2395
+ const creditsLength = credits.length;
2396
+ for (let c = 0; c < creditsLength; c++) {
2397
+ creditDisplay.addCreditToNextFrame(credits[c]);
2404
2398
  }
2405
2399
  }
2406
2400
 
@@ -2795,7 +2789,7 @@ Model.fromGltfAsync = async function (options) {
2795
2789
  if (defined(resourceCredits)) {
2796
2790
  const length = resourceCredits.length;
2797
2791
  for (let i = 0; i < length; i++) {
2798
- model._resourceCredits.push(resourceCredits[i]);
2792
+ model._resourceCredits.push(Credit.clone(resourceCredits[i]));
2799
2793
  }
2800
2794
  }
2801
2795
 
@@ -226,16 +226,16 @@ PostProcessStageLibrary.isDepthOfFieldSupported = function (scene) {
226
226
  *
227
227
  * @example
228
228
  * // multiple silhouette effects
229
- * const yellowEdge = Cesium.PostProcessLibrary.createEdgeDetectionStage();
229
+ * const yellowEdge = Cesium.PostProcessStageLibrary.createEdgeDetectionStage();
230
230
  * yellowEdge.uniforms.color = Cesium.Color.YELLOW;
231
231
  * yellowEdge.selected = [feature0];
232
232
  *
233
- * const greenEdge = Cesium.PostProcessLibrary.createEdgeDetectionStage();
233
+ * const greenEdge = Cesium.PostProcessStageLibrary.createEdgeDetectionStage();
234
234
  * greenEdge.uniforms.color = Cesium.Color.LIME;
235
235
  * greenEdge.selected = [feature1];
236
236
  *
237
237
  * // draw edges around feature0 and feature1
238
- * postProcessStages.add(Cesium.PostProcessLibrary.createSilhouetteStage([yellowEdge, greenEdge]);
238
+ * postProcessStages.add(Cesium.PostProcessStageLibrary.createSilhouetteStage([yellowEdge, greenEdge]);
239
239
  */
240
240
  PostProcessStageLibrary.createEdgeDetectionStage = function () {
241
241
  // unique name generated on call so more than one effect can be added
@@ -3,6 +3,7 @@ import defaultValue from "../Core/defaultValue.js";
3
3
  import defined from "../Core/defined.js";
4
4
  import destroyObject from "../Core/destroyObject.js";
5
5
  import DeveloperError from "../Core/DeveloperError.js";
6
+ import Event from "../Core/Event.js";
6
7
 
7
8
  /**
8
9
  * A collection of primitives. This is most often used with {@link Scene#primitives},
@@ -31,6 +32,8 @@ function PrimitiveCollection(options) {
31
32
 
32
33
  this._primitives = [];
33
34
  this._guid = createGuid();
35
+ this._primitiveAdded = new Event();
36
+ this._primitiveRemoved = new Event();
34
37
 
35
38
  // Used by the OrderedGroundPrimitiveCollection
36
39
  this._zIndex = undefined;
@@ -84,6 +87,35 @@ Object.defineProperties(PrimitiveCollection.prototype, {
84
87
  return this._primitives.length;
85
88
  },
86
89
  },
90
+
91
+ /**
92
+ * An event that is raised when a primitive is added to the collection.
93
+ * Event handlers are passed the primitive that was added.
94
+ * @memberof PrimitiveCollection.prototype
95
+ * @type {Event}
96
+ * @readonly
97
+ */
98
+ primitiveAdded: {
99
+ get: function () {
100
+ return this._primitiveAdded;
101
+ },
102
+ },
103
+
104
+ /**
105
+ * An event that is raised when a primitive is removed from the collection.
106
+ * Event handlers are passed the primitive that was removed.
107
+ * <p>
108
+ * Note: Depending on the destroyPrimitives constructor option, the primitive may already be destroyed.
109
+ * </p>
110
+ * @memberof PrimitiveCollection.prototype
111
+ * @type {Event}
112
+ * @readonly
113
+ */
114
+ primitiveRemoved: {
115
+ get: function () {
116
+ return this._primitiveRemoved;
117
+ },
118
+ },
87
119
  });
88
120
 
89
121
  /**
@@ -128,6 +160,8 @@ PrimitiveCollection.prototype.add = function (primitive, index) {
128
160
  this._primitives.splice(index, 0, primitive);
129
161
  }
130
162
 
163
+ this._primitiveAdded.raiseEvent(primitive);
164
+
131
165
  return primitive;
132
166
  };
133
167
 
@@ -159,6 +193,8 @@ PrimitiveCollection.prototype.remove = function (primitive) {
159
193
  primitive.destroy();
160
194
  }
161
195
 
196
+ this._primitiveRemoved.raiseEvent(primitive);
197
+
162
198
  return true;
163
199
  }
164
200
  // else ... this is not possible, I swear.
@@ -191,9 +227,12 @@ PrimitiveCollection.prototype.removeAll = function () {
191
227
  const length = primitives.length;
192
228
  for (let i = 0; i < length; ++i) {
193
229
  delete primitives[i]._external._composites[this._guid];
230
+
194
231
  if (this.destroyPrimitives) {
195
232
  primitives[i].destroy();
196
233
  }
234
+
235
+ this._primitiveRemoved.raiseEvent(primitives[i]);
197
236
  }
198
237
  this._primitives = [];
199
238
  };
@@ -3166,7 +3166,10 @@ Scene.prototype.updateEnvironment = function () {
3166
3166
  );
3167
3167
  environmentState.isReadyForAtmosphere =
3168
3168
  environmentState.isReadyForAtmosphere ||
3169
+ !globe.show ||
3169
3170
  globe._surface._tilesToRender.length > 0;
3171
+ } else {
3172
+ environmentState.isReadyForAtmosphere = true;
3170
3173
  }
3171
3174
  environmentState.skyAtmosphereCommand = skyAtmosphere.update(
3172
3175
  frameState,
@@ -132,7 +132,7 @@ function configureCameraFrustum(widget) {
132
132
  * @param {boolean} [options.scene3DOnly=false] When <code>true</code>, each geometry instance will only be rendered in 3D to save GPU memory.
133
133
  * @param {boolean} [options.orderIndependentTranslucency=true] If true and the configuration supports it, use order independent translucency.
134
134
  * @param {MapProjection} [options.mapProjection=new GeographicProjection()] The map projection to use in 2D and Columbus View modes.
135
- * @param {Globe | false} [options.globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set to <code>false</code>, no globe will be added.
135
+ * @param {Globe | false} [options.globe=new Globe(mapProjection.ellipsoid)] The globe to use in the scene. If set to <code>false</code>, no globe will be added and the sky atmosphere will be hidden by default.
136
136
  * @param {boolean} [options.useDefaultRenderLoop=true] True if this widget should control the render loop, false otherwise.
137
137
  * @param {boolean} [options.useBrowserRecommendedResolution=true] If true, render at the browser's recommended resolution and ignore <code>window.devicePixelRatio</code>.
138
138
  * @param {number} [options.targetFrameRate] The target frame rate when using the default render loop.
@@ -336,6 +336,7 @@ function CesiumWidget(container, options) {
336
336
  let skyAtmosphere = options.skyAtmosphere;
337
337
  if (!defined(skyAtmosphere)) {
338
338
  skyAtmosphere = new SkyAtmosphere(ellipsoid);
339
+ skyAtmosphere.show = options.globe !== false && globe.show;
339
340
  }
340
341
  if (skyAtmosphere !== false) {
341
342
  scene.skyAtmosphere = skyAtmosphere;