@cesium/engine 2.4.1 → 3.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 (88) hide show
  1. package/Build/Workers/cesiumWorkerBootstrapper.js +1 -1
  2. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +0 -22
  3. package/Build/Workers/package.js +1 -1
  4. package/Build/Workers/transferTypedArrayTest.js +1 -1
  5. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +0 -75
  6. package/Source/Core/CesiumTerrainProvider.js +0 -75
  7. package/Source/Core/CustomHeightmapTerrainProvider.js +0 -38
  8. package/Source/Core/EllipsoidTerrainProvider.js +0 -37
  9. package/Source/Core/GoogleEarthEnterpriseMetadata.js +0 -53
  10. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -101
  11. package/Source/Core/GoogleMaps.js +1 -1
  12. package/Source/Core/Ion.js +1 -2
  13. package/Source/Core/TerrainProvider.js +0 -22
  14. package/Source/Core/VRTheWorldTerrainProvider.js +0 -59
  15. package/Source/Core/sampleTerrain.js +0 -7
  16. package/Source/Core/sampleTerrainMostDetailed.js +0 -7
  17. package/Source/DataSources/Cesium3DTilesetVisualizer.js +6 -5
  18. package/Source/DataSources/KmlTour.js +1 -12
  19. package/Source/DataSources/ModelVisualizer.js +0 -12
  20. package/Source/Renderer/Context.js +10 -2
  21. package/Source/Scene/ArcGisMapServerImageryProvider.js +7 -335
  22. package/Source/Scene/ArcGisMapService.js +1 -1
  23. package/Source/Scene/Billboard.js +7 -0
  24. package/Source/Scene/BingMapsImageryProvider.js +0 -326
  25. package/Source/Scene/Camera.js +1 -1
  26. package/Source/Scene/Cesium3DTile.js +4 -5
  27. package/Source/Scene/Cesium3DTileContent.js +0 -16
  28. package/Source/Scene/Cesium3DTilesVoxelProvider.js +0 -123
  29. package/Source/Scene/Cesium3DTileset.js +183 -184
  30. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +1 -1
  31. package/Source/Scene/Cesium3DTilesetCache.js +1 -3
  32. package/Source/Scene/Cesium3DTilesetSkipTraversal.js +5 -2
  33. package/Source/Scene/Cesium3DTilesetTraversal.js +2 -2
  34. package/Source/Scene/ClassificationPrimitive.js +5 -43
  35. package/Source/Scene/Composite3DTileContent.js +0 -27
  36. package/Source/Scene/CreditDisplay.js +0 -54
  37. package/Source/Scene/DerivedCommand.js +15 -10
  38. package/Source/Scene/Empty3DTileContent.js +0 -21
  39. package/Source/Scene/Geometry3DTileContent.js +0 -29
  40. package/Source/Scene/Globe.js +1 -9
  41. package/Source/Scene/GlobeSurfaceTile.js +13 -8
  42. package/Source/Scene/GlobeSurfaceTileProvider.js +8 -60
  43. package/Source/Scene/GltfPipeline/removeUnusedElements.js +27 -0
  44. package/Source/Scene/GltfPipeline/updateVersion.js +21 -4
  45. package/Source/Scene/GoogleEarthEnterpriseImageryProvider.js +1 -339
  46. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +0 -326
  47. package/Source/Scene/GridImageryProvider.js +0 -274
  48. package/Source/Scene/GroundPolylinePrimitive.js +5 -38
  49. package/Source/Scene/GroundPrimitive.js +5 -43
  50. package/Source/Scene/I3SDataProvider.js +4 -99
  51. package/Source/Scene/I3SLayer.js +15 -22
  52. package/Source/Scene/Imagery.js +1 -9
  53. package/Source/Scene/ImageryLayer.js +1 -40
  54. package/Source/Scene/ImageryProvider.js +0 -138
  55. package/Source/Scene/Implicit3DTileContent.js +0 -23
  56. package/Source/Scene/IonImageryProvider.js +1 -369
  57. package/Source/Scene/MapboxImageryProvider.js +0 -276
  58. package/Source/Scene/MapboxStyleImageryProvider.js +0 -274
  59. package/Source/Scene/Model/Model.js +6 -249
  60. package/Source/Scene/Model/Model3DTileContent.js +0 -50
  61. package/Source/Scene/Model/ModelAnimationCollection.js +1 -1
  62. package/Source/Scene/Model/PointCloudStylingPipelineStage.js +1 -1
  63. package/Source/Scene/Multiple3DTileContent.js +0 -27
  64. package/Source/Scene/Primitive.js +10 -38
  65. package/Source/Scene/QuadtreePrimitive.js +3 -5
  66. package/Source/Scene/QuadtreeTileProvider.js +0 -10
  67. package/Source/Scene/Scene.js +3 -3
  68. package/Source/Scene/ScreenSpaceCameraController.js +5 -5
  69. package/Source/Scene/SingleTileImageryProvider.js +6 -302
  70. package/Source/Scene/TileCoordinatesImageryProvider.js +0 -273
  71. package/Source/Scene/TileMapServiceImageryProvider.js +3 -48
  72. package/Source/Scene/Tileset3DTileContent.js +0 -22
  73. package/Source/Scene/TimeDynamicPointCloud.js +0 -28
  74. package/Source/Scene/UrlTemplateImageryProvider.js +0 -375
  75. package/Source/Scene/Vector3DTileContent.js +0 -29
  76. package/Source/Scene/VoxelPrimitive.js +9 -49
  77. package/Source/Scene/VoxelProvider.js +0 -24
  78. package/Source/Scene/WebMapServiceImageryProvider.js +0 -274
  79. package/Source/Scene/WebMapTileServiceImageryProvider.js +0 -274
  80. package/Source/Scene/computeFlyToLocationForRectangle.js +0 -6
  81. package/Source/Scene/createGooglePhotorealistic3DTileset.js +5 -0
  82. package/Source/Widget/CesiumWidget.js +2 -19
  83. package/index.d.ts +62 -1183
  84. package/index.js +54 -57
  85. package/package.json +2 -2
  86. package/Source/Core/createWorldTerrain.js +0 -61
  87. package/Source/Scene/createOsmBuildings.js +0 -82
  88. package/Source/Scene/createWorldImagery.js +0 -47
@@ -61,14 +61,15 @@ import Cesium3DTilesetSkipTraversal from "./Cesium3DTilesetSkipTraversal.js";
61
61
  *
62
62
  * Initialization options for the Cesium3DTileset constructor
63
63
  *
64
- * @property {Resource|string|Promise<Resource>|Promise<string>} [.url] The url to a tileset JSON file. Deprecated.
65
64
  * @property {boolean} [show=true] Determines if the tileset will be shown.
66
65
  * @property {Matrix4} [modelMatrix=Matrix4.IDENTITY] A 4x4 transformation matrix that transforms the tileset's root tile.
67
66
  * @property {Axis} [modelUpAxis=Axis.Y] Which axis is considered up when loading models for tile contents.
68
67
  * @property {Axis} [modelForwardAxis=Axis.X] Which axis is considered forward when loading models for tile contents.
69
68
  * @property {ShadowMode} [shadows=ShadowMode.ENABLED] Determines whether the tileset casts or receives shadows from light sources.
70
69
  * @property {number} [maximumScreenSpaceError=16] The maximum screen space error used to drive level of detail refinement.
71
- * @property {number} [maximumMemoryUsage=512] The maximum amount of memory in MB that can be used by the tileset.
70
+ * @property {number} [maximumMemoryUsage=512] The maximum amount of memory in MB that can be used by the tileset. Deprecated.
71
+ * @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
+ * @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.
72
73
  * @property {boolean} [cullWithChildrenBounds=true] Optimization option. Whether to cull tiles using the union of their children bounding volumes.
73
74
  * @property {boolean} [cullRequestsWhileMoving=true] Optimization option. Don't request tiles that will likely be unused when they come back because of the camera's movement. This optimization only applies to stationary tilesets.
74
75
  * @property {number} [cullRequestsWhileMovingMultiplier=60.0] Optimization option. Multiplier used in culling requests while moving. Larger is more aggressive culling, smaller less aggressive culling.
@@ -221,7 +222,33 @@ function Cesium3DTileset(options) {
221
222
  options.maximumScreenSpaceError,
222
223
  16
223
224
  );
224
- this._maximumMemoryUsage = defaultValue(options.maximumMemoryUsage, 512);
225
+ this._memoryAdjustedScreenSpaceError = this._maximumScreenSpaceError;
226
+
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);
236
+ //>>includeStart('debug', pragmas.debug);
237
+ Check.typeOf.number.greaterThanOrEquals("cacheBytes", this._cacheBytes, 0);
238
+ //>>includeEnd('debug');
239
+
240
+ const maximumCacheOverflowBytes = defaultValue(
241
+ options.maximumCacheOverflowBytes,
242
+ 512 * 1024 * 1024
243
+ );
244
+ //>>includeStart('debug', pragmas.debug);
245
+ Check.typeOf.number.greaterThanOrEquals(
246
+ "maximumCacheOverflowBytes",
247
+ maximumCacheOverflowBytes,
248
+ 0
249
+ );
250
+ //>>includeEnd('debug');
251
+ this._maximumCacheOverflowBytes = maximumCacheOverflowBytes;
225
252
 
226
253
  this._styleEngine = new Cesium3DTileStyleEngine();
227
254
  this._styleApplied = false;
@@ -590,7 +617,7 @@ function Cesium3DTileset(options) {
590
617
  * console.log('A tile was unloaded from the cache.');
591
618
  * });
592
619
  *
593
- * @see Cesium3DTileset#maximumMemoryUsage
620
+ * @see Cesium3DTileset#cacheBytes
594
621
  * @see Cesium3DTileset#trimLoadedTiles
595
622
  */
596
623
  this.tileUnload = new Event();
@@ -990,124 +1017,6 @@ function Cesium3DTileset(options) {
990
1017
  instanceFeatureIdLabel = `instanceFeatureId_${instanceFeatureIdLabel}`;
991
1018
  }
992
1019
  this._instanceFeatureIdLabel = instanceFeatureIdLabel;
993
-
994
- if (defined(options.url)) {
995
- deprecationWarning(
996
- "Cesium3DTileset options.url",
997
- "Cesium3DTileset constructor parameter options.url was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTileset.fromUrl instead."
998
- );
999
- const that = this;
1000
- let resource;
1001
- this._readyPromise = Promise.resolve(options.url)
1002
- .then(function (url) {
1003
- let basePath;
1004
- resource = Resource.createIfNeeded(url);
1005
- that._resource = resource;
1006
-
1007
- // ion resources have a credits property we can use for additional attribution.
1008
- that._credits = resource.credits;
1009
-
1010
- if (resource.extension === "json") {
1011
- basePath = resource.getBaseUri(true);
1012
- } else if (resource.isDataUri) {
1013
- basePath = "";
1014
- }
1015
-
1016
- that._url = resource.url;
1017
- that._basePath = basePath;
1018
-
1019
- return Cesium3DTileset.loadJson(resource);
1020
- })
1021
- .then(function (tilesetJson) {
1022
- if (that.isDestroyed()) {
1023
- return;
1024
- }
1025
-
1026
- // This needs to be called before loadTileset() so tile metadata
1027
- // can be initialized synchronously in the Cesium3DTile constructor
1028
- return processMetadataExtension(resource, tilesetJson).then(
1029
- (metadata) => {
1030
- that._metadataExtension = metadata;
1031
- return tilesetJson;
1032
- }
1033
- );
1034
- })
1035
- .then(function (tilesetJson) {
1036
- if (that.isDestroyed()) {
1037
- return;
1038
- }
1039
-
1040
- // Set these before loading the tileset since _geometricError
1041
- // and _scaledGeometricError get accessed during tile creation
1042
- that._geometricError = tilesetJson.geometricError;
1043
- that._scaledGeometricError = tilesetJson.geometricError;
1044
-
1045
- that._root = that.loadTileset(resource, tilesetJson);
1046
-
1047
- // Handle legacy gltfUpAxis option
1048
- const gltfUpAxis = defined(tilesetJson.asset.gltfUpAxis)
1049
- ? Axis.fromName(tilesetJson.asset.gltfUpAxis)
1050
- : Axis.Y;
1051
- const modelUpAxis = defaultValue(options.modelUpAxis, gltfUpAxis);
1052
- const modelForwardAxis = defaultValue(options.modelForwardAxis, Axis.X);
1053
-
1054
- const asset = tilesetJson.asset;
1055
- that._asset = asset;
1056
- that._properties = tilesetJson.properties;
1057
- that._extensionsUsed = tilesetJson.extensionsUsed;
1058
- that._extensions = tilesetJson.extensions;
1059
- that._modelUpAxis = modelUpAxis;
1060
- that._modelForwardAxis = modelForwardAxis;
1061
- that._extras = tilesetJson.extras;
1062
-
1063
- const extras = asset.extras;
1064
- if (
1065
- defined(extras) &&
1066
- defined(extras.cesium) &&
1067
- defined(extras.cesium.credits)
1068
- ) {
1069
- const extraCredits = extras.cesium.credits;
1070
- let credits = that._credits;
1071
- if (!defined(credits)) {
1072
- credits = [];
1073
- that._credits = credits;
1074
- }
1075
- for (let i = 0; i < extraCredits.length; ++i) {
1076
- const credit = extraCredits[i];
1077
- credits.push(new Credit(credit.html, that._showCreditsOnScreen));
1078
- }
1079
- }
1080
-
1081
- // Save the original, untransformed bounding volume position so we can apply
1082
- // the tile transform and model matrix at run time
1083
- const boundingVolume = that._root.createBoundingVolume(
1084
- tilesetJson.root.boundingVolume,
1085
- Matrix4.IDENTITY
1086
- );
1087
- const clippingPlanesOrigin = boundingVolume.boundingSphere.center;
1088
- // If this origin is above the surface of the earth
1089
- // we want to apply an ENU orientation as our best guess of orientation.
1090
- // Otherwise, we assume it gets its position/orientation completely from the
1091
- // root tile transform and the tileset's model matrix
1092
- const originCartographic = that._ellipsoid.cartesianToCartographic(
1093
- clippingPlanesOrigin
1094
- );
1095
- if (
1096
- defined(originCartographic) &&
1097
- originCartographic.height >
1098
- ApproximateTerrainHeights._defaultMinTerrainHeight
1099
- ) {
1100
- that._initialClippingPlanesOriginMatrix = Transforms.eastNorthUpToFixedFrame(
1101
- clippingPlanesOrigin
1102
- );
1103
- }
1104
- that._clippingPlanesOriginMatrix = Matrix4.clone(
1105
- that._initialClippingPlanesOriginMatrix
1106
- );
1107
-
1108
- return that;
1109
- });
1110
- }
1111
1020
  }
1112
1021
 
1113
1022
  Object.defineProperties(Cesium3DTileset.prototype, {
@@ -1196,59 +1105,6 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1196
1105
  },
1197
1106
  },
1198
1107
 
1199
- /**
1200
- * When <code>true</code>, the tileset's root tile is loaded and the tileset is ready to render.
1201
- *
1202
- * @memberof Cesium3DTileset.prototype
1203
- *
1204
- * @type {boolean}
1205
- * @readonly
1206
- *
1207
- * @default false
1208
- */
1209
- ready: {
1210
- get: function () {
1211
- deprecationWarning(
1212
- "Cesium3DTileset.ready",
1213
- "Cesium3DTileset.ready was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTileset.fromUrl instead."
1214
- );
1215
- return defined(this._root);
1216
- },
1217
- },
1218
-
1219
- /**
1220
- * Gets the promise that will be resolved when the tileset's root tile is loaded and the tileset is ready to render.
1221
- * <p>
1222
- * This promise is resolved at the end of the frame before the first frame the tileset is rendered in.
1223
- * </p>
1224
- *
1225
- * @memberof Cesium3DTileset.prototype
1226
- *
1227
- * @type {Promise<Cesium3DTileset>}
1228
- * @readonly
1229
- * @deprecated
1230
- *
1231
- * @example
1232
- * tileset.readyPromise.then(function(tileset) {
1233
- * // tile.properties is not defined until readyPromise resolves.
1234
- * const properties = tileset.properties;
1235
- * if (Cesium.defined(properties)) {
1236
- * for (const name in properties) {
1237
- * console.log(properties[name]);
1238
- * }
1239
- * }
1240
- * });
1241
- */
1242
- readyPromise: {
1243
- get: function () {
1244
- deprecationWarning(
1245
- "Cesium3DTileset.readyPromise",
1246
- "Cesium3DTileset.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Use Cesium3DTileset.fromUrl instead."
1247
- );
1248
- return this._readyPromise;
1249
- },
1250
- },
1251
-
1252
1108
  /**
1253
1109
  * When <code>true</code>, all tiles that meet the screen space error this frame are loaded. The tileset is
1254
1110
  * completely loaded for this view.
@@ -1516,6 +1372,7 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1516
1372
  //>>includeEnd('debug');
1517
1373
 
1518
1374
  this._maximumScreenSpaceError = value;
1375
+ this._memoryAdjustedScreenSpaceError = value;
1519
1376
  },
1520
1377
  },
1521
1378
 
@@ -1545,17 +1402,122 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1545
1402
  *
1546
1403
  * @exception {DeveloperError} <code>maximumMemoryUsage</code> must be greater than or equal to zero.
1547
1404
  * @see Cesium3DTileset#totalMemoryUsageInBytes
1405
+ *
1406
+ * @deprecated
1548
1407
  */
1549
1408
  maximumMemoryUsage: {
1550
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
+ );
1551
1414
  return this._maximumMemoryUsage;
1552
1415
  },
1553
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
+ );
1554
1421
  //>>includeStart('debug', pragmas.debug);
1555
1422
  Check.typeOf.number.greaterThanOrEquals("value", value, 0);
1556
1423
  //>>includeEnd('debug');
1557
1424
 
1558
1425
  this._maximumMemoryUsage = value;
1426
+ this._cacheBytes = value * 1024 * 1024;
1427
+ },
1428
+ },
1429
+
1430
+ /**
1431
+ * The amount of GPU memory (in bytes) used to cache tiles. This memory usage is estimated from
1432
+ * geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also
1433
+ * includes per-point metadata.
1434
+ * <p>
1435
+ * Tiles not in view are unloaded to enforce this.
1436
+ * </p>
1437
+ * <p>
1438
+ * If decreasing this value results in unloading tiles, the tiles are unloaded the next frame.
1439
+ * </p>
1440
+ * <p>
1441
+ * If tiles sized more than <code>cacheBytes</code> are needed to meet the
1442
+ * desired screen space error, determined by {@link Cesium3DTileset#maximumScreenSpaceError},
1443
+ * for the current view, then the memory usage of the tiles loaded will exceed
1444
+ * <code>cacheBytes</code> by up to <code>maximumCacheOverflowBytes</code>.
1445
+ * For example, if <code>cacheBytes</code> is 500000, but 600000 bytes
1446
+ * of tiles are needed to meet the screen space error, then 600000 bytes of tiles
1447
+ * may be loaded (if <code>maximumCacheOverflowBytes</code> is at least 100000).
1448
+ * When these tiles go out of view, they will be unloaded.
1449
+ * </p>
1450
+ *
1451
+ * @memberof Cesium3DTileset.prototype
1452
+ *
1453
+ * @type {number}
1454
+ * @default 536870912
1455
+ *
1456
+ * @exception {DeveloperError} <code>cacheBytes</code> must be typeof 'number' and greater than or equal to 0
1457
+ * @see Cesium3DTileset#totalMemoryUsageInBytes
1458
+ */
1459
+ cacheBytes: {
1460
+ get: function () {
1461
+ return this._cacheBytes;
1462
+ },
1463
+ set: function (value) {
1464
+ //>>includeStart('debug', pragmas.debug);
1465
+ Check.typeOf.number.greaterThanOrEquals("value", value, 0);
1466
+ //>>includeEnd('debug');
1467
+
1468
+ this._cacheBytes = value;
1469
+ },
1470
+ },
1471
+
1472
+ /**
1473
+ * The maximum additional amount of GPU memory (in bytes) that will be used to cache tiles.
1474
+ * <p>
1475
+ * If tiles sized more than <code>cacheBytes</code> plus <code>maximumCacheOverflowBytes</code>
1476
+ * are needed to meet the desired screen space error, determined by
1477
+ * {@link Cesium3DTileset#maximumScreenSpaceError} for the current view, then
1478
+ * {@link Cesium3DTileset#memoryAdjustedScreenSpaceError} will be adjusted
1479
+ * until the tiles required to meet the adjusted screen space error use less
1480
+ * than <code>cacheBytes</code> plus <code>maximumCacheOverflowBytes</code>.
1481
+ * </p>
1482
+ *
1483
+ * @memberof Cesium3DTileset.prototype
1484
+ *
1485
+ * @type {number}
1486
+ * @default 536870912
1487
+ *
1488
+ * @exception {DeveloperError} <code>maximumCacheOverflowBytes</code> must be typeof 'number' and greater than or equal to 0
1489
+ * @see Cesium3DTileset#totalMemoryUsageInBytes
1490
+ */
1491
+ maximumCacheOverflowBytes: {
1492
+ get: function () {
1493
+ return this._maximumCacheOverflowBytes;
1494
+ },
1495
+ set: function (value) {
1496
+ //>>includeStart('debug', pragmas.debug);
1497
+ Check.typeOf.number.greaterThanOrEquals("value", value, 0);
1498
+ //>>includeEnd('debug');
1499
+
1500
+ this._maximumCacheOverflowBytes = value;
1501
+ },
1502
+ },
1503
+
1504
+ /**
1505
+ * If loading the level of detail required by @{link Cesium3DTileset#maximumScreenSpaceError}
1506
+ * results in the memory usage exceeding @{link Cesium3DTileset#cacheBytes}
1507
+ * plus @{link Cesium3DTileset#maximumCacheOverflowBytes}, level of detail refinement
1508
+ * will instead use this (larger) adjusted screen space error to achieve the
1509
+ * best possible visual quality within the available memory
1510
+ *
1511
+ * @memberof Cesium3DTileset.prototype
1512
+ *
1513
+ * @type {number}
1514
+ * @readonly
1515
+ *
1516
+ * @private
1517
+ */
1518
+ memoryAdjustedScreenSpaceError: {
1519
+ get: function () {
1520
+ return this._memoryAdjustedScreenSpaceError;
1559
1521
  },
1560
1522
  },
1561
1523
 
@@ -1665,7 +1627,7 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1665
1627
  * @type {number}
1666
1628
  * @readonly
1667
1629
  *
1668
- * @see Cesium3DTileset#maximumMemoryUsage
1630
+ * @see Cesium3DTileset#cacheBytes
1669
1631
  */
1670
1632
  totalMemoryUsageInBytes: {
1671
1633
  get: function () {
@@ -2167,8 +2129,6 @@ Cesium3DTileset.fromUrl = async function (url, options) {
2167
2129
  tileset._initialClippingPlanesOriginMatrix
2168
2130
  );
2169
2131
 
2170
- tileset._readyPromise = Promise.resolve(tileset);
2171
- tileset._ready = true;
2172
2132
  return tileset;
2173
2133
  };
2174
2134
 
@@ -2524,7 +2484,7 @@ function requestContent(tileset, tile) {
2524
2484
  tileset._requestedTilesInFlight.push(tile);
2525
2485
  }
2526
2486
 
2527
- function sortRequestByPriority(a, b) {
2487
+ function sortTilesByPriority(a, b) {
2528
2488
  return a._priority - b._priority;
2529
2489
  }
2530
2490
 
@@ -2627,7 +2587,7 @@ function cancelOutOfViewRequests(tileset, frameState) {
2627
2587
  */
2628
2588
  function requestTiles(tileset) {
2629
2589
  const requestedTiles = tileset._requestedTiles;
2630
- requestedTiles.sort(sortRequestByPriority);
2590
+ requestedTiles.sort(sortTilesByPriority);
2631
2591
  for (let i = 0; i < requestedTiles.length; ++i) {
2632
2592
  requestContent(tileset, requestedTiles[i]);
2633
2593
  }
@@ -2694,10 +2654,18 @@ function filterProcessingQueue(tileset) {
2694
2654
  function processTiles(tileset, frameState) {
2695
2655
  filterProcessingQueue(tileset);
2696
2656
  const tiles = tileset._processingQueue;
2697
- const statistics = tileset._statistics;
2698
- let tile;
2657
+
2658
+ const { cacheBytes, maximumCacheOverflowBytes, statistics } = tileset;
2659
+ const cacheByteLimit = cacheBytes + maximumCacheOverflowBytes;
2660
+
2661
+ let memoryExceeded = false;
2699
2662
  for (let i = 0; i < tiles.length; ++i) {
2700
- tile = tiles[i];
2663
+ if (tileset.totalMemoryUsageInBytes > cacheByteLimit) {
2664
+ memoryExceeded = true;
2665
+ break;
2666
+ }
2667
+
2668
+ const tile = tiles[i];
2701
2669
  try {
2702
2670
  tile.process(tileset, frameState);
2703
2671
 
@@ -2710,6 +2678,37 @@ function processTiles(tileset, frameState) {
2710
2678
  handleTileFailure(error, tileset, tile);
2711
2679
  }
2712
2680
  }
2681
+
2682
+ if (tileset.totalMemoryUsageInBytes < cacheBytes) {
2683
+ decreaseScreenSpaceError(tileset);
2684
+ } else if (memoryExceeded && tiles.length > 0) {
2685
+ increaseScreenSpaceError(tileset);
2686
+ }
2687
+ }
2688
+
2689
+ function increaseScreenSpaceError(tileset) {
2690
+ //>>includeStart('debug', pragmas.debug);
2691
+ oneTimeWarning(
2692
+ "increase-screenSpaceError",
2693
+ `The tiles needed to meet maximumScreenSpaceError would use more memory than allocated for this tileset.
2694
+ The tileset will be rendered with a larger screen space error (see memoryAdjustedScreenSpaceError).
2695
+ Consider using larger values for cacheBytes and maximumCacheOverflowBytes.`
2696
+ );
2697
+ //>>includeEnd('debug');
2698
+
2699
+ tileset._memoryAdjustedScreenSpaceError *= 1.02;
2700
+ const tiles = tileset._processingQueue;
2701
+ for (let i = 0; i < tiles.length; ++i) {
2702
+ tiles[i].updatePriority();
2703
+ }
2704
+ tiles.sort(sortTilesByPriority);
2705
+ }
2706
+
2707
+ function decreaseScreenSpaceError(tileset) {
2708
+ tileset._memoryAdjustedScreenSpaceError = Math.max(
2709
+ tileset.memoryAdjustedScreenSpaceError / 1.02,
2710
+ tileset.maximumScreenSpaceError
2711
+ );
2713
2712
  }
2714
2713
 
2715
2714
  const scratchCartesian = new Cartesian3();
@@ -3057,7 +3056,7 @@ function destroyTile(tileset, tile) {
3057
3056
  /**
3058
3057
  * Unloads all tiles that weren't selected the previous frame. This can be used to
3059
3058
  * explicitly manage the tile cache and reduce the total number of tiles loaded below
3060
- * {@link Cesium3DTileset#maximumMemoryUsage}.
3059
+ * {@link Cesium3DTileset#cacheBytes}.
3061
3060
  * <p>
3062
3061
  * Tile unloads occur at the next frame to keep all the WebGL delete calls
3063
3062
  * within the render loop.
@@ -53,7 +53,7 @@ Cesium3DTilesetBaseTraversal.selectTiles = function (tileset, frameState) {
53
53
 
54
54
  if (
55
55
  root.getScreenSpaceError(frameState, true) <=
56
- tileset._maximumScreenSpaceError
56
+ tileset.memoryAdjustedScreenSpaceError
57
57
  ) {
58
58
  return;
59
59
  }
@@ -58,8 +58,6 @@ Cesium3DTilesetCache.prototype.unloadTiles = function (
58
58
 
59
59
  const list = this._list;
60
60
 
61
- const maximumMemoryUsageInBytes = tileset.maximumMemoryUsage * 1024 * 1024;
62
-
63
61
  // Traverse the list only to the sentinel since tiles/nodes to the
64
62
  // right of the sentinel were used this frame.
65
63
  //
@@ -68,7 +66,7 @@ Cesium3DTilesetCache.prototype.unloadTiles = function (
68
66
  let node = list.head;
69
67
  while (
70
68
  node !== sentinel &&
71
- (tileset.totalMemoryUsageInBytes > maximumMemoryUsageInBytes || trimTiles)
69
+ (tileset.totalMemoryUsageInBytes > tileset.cacheBytes || trimTiles)
72
70
  ) {
73
71
  const tile = node.item;
74
72
  node = node.next;
@@ -61,7 +61,7 @@ Cesium3DTilesetSkipTraversal.selectTiles = function (tileset, frameState) {
61
61
 
62
62
  if (
63
63
  root.getScreenSpaceError(frameState, true) <=
64
- tileset._maximumScreenSpaceError
64
+ tileset.memoryAdjustedScreenSpaceError
65
65
  ) {
66
66
  return;
67
67
  }
@@ -267,7 +267,10 @@ function executeTraversal(root, frameState) {
267
267
  const { tileset } = root;
268
268
  const baseScreenSpaceError = tileset.immediatelyLoadDesiredLevelOfDetail
269
269
  ? Number.MAX_VALUE
270
- : Math.max(tileset.baseScreenSpaceError, tileset.maximumScreenSpaceError);
270
+ : Math.max(
271
+ tileset.baseScreenSpaceError,
272
+ tileset.memoryAdjustedScreenSpaceError
273
+ );
271
274
  const {
272
275
  canTraverse,
273
276
  loadTile,
@@ -64,7 +64,7 @@ Cesium3DTilesetTraversal.canTraverse = function (tile) {
64
64
  // Don't traverse if the subtree is expired because it will be destroyed
65
65
  return !tile.contentExpired;
66
66
  }
67
- return tile._screenSpaceError > tile.tileset._maximumScreenSpaceError;
67
+ return tile._screenSpaceError > tile.tileset.memoryAdjustedScreenSpaceError;
68
68
  };
69
69
 
70
70
  /**
@@ -260,7 +260,7 @@ function meetsScreenSpaceErrorEarly(tile, frameState) {
260
260
  // Use parent's geometric error with child's box to see if the tile already meet the SSE
261
261
  return (
262
262
  tile.getScreenSpaceError(frameState, true) <=
263
- tileset._maximumScreenSpaceError
263
+ tileset.memoryAdjustedScreenSpaceError
264
264
  );
265
265
  }
266
266
 
@@ -2,7 +2,6 @@ import ColorGeometryInstanceAttribute from "../Core/ColorGeometryInstanceAttribu
2
2
  import combine from "../Core/combine.js";
3
3
  import defaultValue from "../Core/defaultValue.js";
4
4
  import defined from "../Core/defined.js";
5
- import deprecationWarning from "../Core/deprecationWarning.js";
6
5
  import destroyObject from "../Core/destroyObject.js";
7
6
  import DeveloperError from "../Core/DeveloperError.js";
8
7
  import GeometryInstance from "../Core/GeometryInstance.js";
@@ -163,30 +162,6 @@ function ClassificationPrimitive(options) {
163
162
  this._commandsIgnoreShow = [];
164
163
 
165
164
  this._ready = false;
166
-
167
- const classificationPrimitive = this;
168
- // This is here for backwards compatibility. This promise wrapper can be removed once readyPromise is removed.
169
- this._readyPromise = new Promise((resolve, reject) => {
170
- classificationPrimitive._completeLoad = () => {
171
- if (this._ready) {
172
- return;
173
- }
174
-
175
- this._ready = true;
176
-
177
- if (this.releaseGeometryInstances) {
178
- this.geometryInstances = undefined;
179
- }
180
-
181
- const error = this._error;
182
- if (!defined(error)) {
183
- resolve(this);
184
- } else {
185
- reject(error);
186
- }
187
- };
188
- });
189
-
190
165
  this._primitive = undefined;
191
166
  this._pickPrimitive = options._pickPrimitive;
192
167
 
@@ -337,23 +312,6 @@ Object.defineProperties(ClassificationPrimitive.prototype, {
337
312
  },
338
313
  },
339
314
 
340
- /**
341
- * Gets a promise that resolves when the primitive is ready to render.
342
- * @memberof ClassificationPrimitive.prototype
343
- * @type {Promise<ClassificationPrimitive>}
344
- * @readonly
345
- * @deprecated
346
- */
347
- readyPromise: {
348
- get: function () {
349
- deprecationWarning(
350
- "ClassificationPrimitive.readyPromise",
351
- "ClassificationPrimitive.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Wait for ClassificationPrimitive.ready to return true instead."
352
- );
353
- return this._readyPromise;
354
- },
355
- },
356
-
357
315
  /**
358
316
  * Returns true if the ClassificationPrimitive needs a separate shader and commands for 2D.
359
317
  * This is because texture coordinates on ClassificationPrimitives are computed differently,
@@ -1359,7 +1317,11 @@ ClassificationPrimitive.prototype.update = function (frameState) {
1359
1317
 
1360
1318
  frameState.afterRender.push(() => {
1361
1319
  if (defined(this._primitive) && this._primitive.ready) {
1362
- this._completeLoad();
1320
+ this._ready = true;
1321
+
1322
+ if (this.releaseGeometryInstances) {
1323
+ this.geometryInstances = undefined;
1324
+ }
1363
1325
  }
1364
1326
  });
1365
1327
  };
@@ -1,6 +1,5 @@
1
1
  import defaultValue from "../Core/defaultValue.js";
2
2
  import defined from "../Core/defined.js";
3
- import deprecationWarning from "../Core/deprecationWarning.js";
4
3
  import destroyObject from "../Core/destroyObject.js";
5
4
  import getMagic from "../Core/getMagic.js";
6
5
  import RuntimeError from "../Core/RuntimeError.js";
@@ -31,11 +30,6 @@ function Composite3DTileContent(tileset, tile, resource, contents) {
31
30
  this._metadata = undefined;
32
31
  this._group = undefined;
33
32
  this._ready = false;
34
-
35
- this._resolveContent = undefined;
36
- this._readyPromise = new Promise((resolve) => {
37
- this._resolveContent = resolve;
38
- });
39
33
  }
40
34
 
41
35
  Object.defineProperties(Composite3DTileContent.prototype, {
@@ -147,26 +141,6 @@ Object.defineProperties(Composite3DTileContent.prototype, {
147
141
  },
148
142
  },
149
143
 
150
- /**
151
- * Gets the promise that will be resolved when the tile's content is ready to render.
152
- *
153
- * @memberof Composite3DTileContent.prototype
154
- *
155
- * @type {Promise<Composite3DTileContent>}
156
- * @readonly
157
- * @deprecated
158
- * @private
159
- */
160
- readyPromise: {
161
- get: function () {
162
- deprecationWarning(
163
- "Composite3DTileContent.readyPromise",
164
- "Composite3DTileContent.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Wait for Composite3DTileContent.ready to return true instead."
165
- );
166
- return this._readyPromise;
167
- },
168
- },
169
-
170
144
  tileset: {
171
145
  get: function () {
172
146
  return this._tileset;
@@ -370,7 +344,6 @@ Composite3DTileContent.prototype.update = function (tileset, frameState) {
370
344
 
371
345
  if (!this._ready && ready) {
372
346
  this._ready = true;
373
- this._resolveContent(this);
374
347
  }
375
348
  };
376
349