mirror of https://github.com/CesiumGS/cesium.git
Second round PR feedback
This commit is contained in:
parent
4e99c91511
commit
f1baff4e30
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
##### Additions :tada:
|
||||
|
||||
- Added `Cesium3DTileset.cacheBytes` and `Cesium3DTileset.maximumCacheOverflowBytes` to better control memory usage. To replicate previous behavior, change `maximumMemoryUsage` to `cacheBytes`, and set `maximumCacheOverflowBytes = Number.MAX_VALUE`
|
||||
- Added `Cesium3DTileset.cacheBytes` and `Cesium3DTileset.maximumCacheOverflowBytes` to better control memory usage. To replicate previous behavior, convert `maximumMemoryUsage` from MB to bytes, assign the value to `cacheBytes`, and set `maximumCacheOverflowBytes = Number.MAX_VALUE`
|
||||
|
||||
##### Fixes :wrench:
|
||||
|
||||
|
|
|
|||
|
|
@ -3434,6 +3434,77 @@ describe(
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// Cache replacement tests
|
||||
|
||||
it("Unload all cached tiles not required to meet SSE using maximumMemoryUsage", function () {
|
||||
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function (
|
||||
tileset
|
||||
) {
|
||||
tileset.maximumMemoryUsage = 0;
|
||||
|
||||
// Render parent and four children (using additive refinement)
|
||||
viewAllTiles();
|
||||
scene.renderForSpecs();
|
||||
|
||||
const statistics = tileset._statistics;
|
||||
expect(statistics.numberOfCommands).toEqual(5);
|
||||
expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
|
||||
expect(tileset.totalMemoryUsageInBytes).toEqual(37200); // Specific to this tileset
|
||||
|
||||
// Zoom out so only root tile is needed to meet SSE. This unloads
|
||||
// the four children since the maximum memory usage is zero.
|
||||
viewRootOnly();
|
||||
scene.renderForSpecs();
|
||||
|
||||
expect(statistics.numberOfCommands).toEqual(1);
|
||||
expect(statistics.numberOfTilesWithContentReady).toEqual(1);
|
||||
expect(tileset.totalMemoryUsageInBytes).toEqual(7440); // Specific to this tileset
|
||||
|
||||
// Zoom back in so all four children are re-requested.
|
||||
viewAllTiles();
|
||||
|
||||
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(
|
||||
function () {
|
||||
expect(statistics.numberOfCommands).toEqual(5);
|
||||
expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
|
||||
expect(tileset.totalMemoryUsageInBytes).toEqual(37200); // Specific to this tileset
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("Unload some cached tiles not required to meet SSE using maximumMemoryUsage", function () {
|
||||
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function (
|
||||
tileset
|
||||
) {
|
||||
tileset.maximumMemoryUsage = 0.025; // Just enough memory to allow 3 tiles to remain
|
||||
// Render parent and four children (using additive refinement)
|
||||
viewAllTiles();
|
||||
scene.renderForSpecs();
|
||||
|
||||
const statistics = tileset._statistics;
|
||||
expect(statistics.numberOfCommands).toEqual(5);
|
||||
expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
|
||||
|
||||
// Zoom out so only root tile is needed to meet SSE. This unloads
|
||||
// two of the four children so three tiles are still loaded (the
|
||||
// root and two children) since the maximum memory usage is sufficient.
|
||||
viewRootOnly();
|
||||
scene.renderForSpecs();
|
||||
|
||||
expect(statistics.numberOfCommands).toEqual(1);
|
||||
expect(statistics.numberOfTilesWithContentReady).toEqual(3);
|
||||
|
||||
// Zoom back in so the two children are re-requested.
|
||||
viewAllTiles();
|
||||
|
||||
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(
|
||||
function () {
|
||||
expect(statistics.numberOfCommands).toEqual(5);
|
||||
expect(statistics.numberOfTilesWithContentReady).toEqual(5); // Five loaded tiles
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("Unload all cached tiles not required to meet SSE using cacheBytes", function () {
|
||||
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function (
|
||||
tileset
|
||||
|
|
|
|||
Loading…
Reference in New Issue