mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
Quantized-mesh terrain can supply its tiles through fetchTile, like imagery
A `quantizedMesh` terrain spec takes an optional `fetchTile`, called with the tile (rows from the north), its URL as Cesium resolved it and an abort signal. Cesium still reads `layer.json` at the url and schedules, cancels and decodes the tiles; only the bytes of each tile come from `fetchTile`. A `missing` tile draws its parent's terrain there and a deferred one is asked for again shortly.
This commit is contained in:
1 parent
d9d79ebc4d
commit
eebde0bdca
9 files changed
+390
-6
No files matched your search
@@ -491,6 +491,38 @@ test('terrain: quantized mesh at its url, asked again when its host is busy', as
|
||||
);
|
||||
});
|
||||
|
||||
test('terrain: quantized mesh tiles through fetchTile', async (t) => {
|
||||
const { scene, port } = setup();
|
||||
const made = new Cesium.EllipsoidTerrainProvider();
|
||||
const own = made.requestTileGeometry;
|
||||
const asked = [];
|
||||
t.mock.method(Cesium.CesiumTerrainProvider, 'fromUrl', async (...args) => {
|
||||
asked.push(args);
|
||||
return made;
|
||||
});
|
||||
const fetchTile = async () => ({ missing: true });
|
||||
await port.setTerrain({
|
||||
kind: 'quantizedMesh',
|
||||
url: 'https://terrain.example/mesh',
|
||||
fetchTile,
|
||||
});
|
||||
assert.equal(scene.terrainProvider, made);
|
||||
const [[resource]] = asked;
|
||||
assert.equal(resource.url, 'https://terrain.example/mesh');
|
||||
assert.ok(resource.retryAttempts > 0, 'layer.json keeps its retry policy');
|
||||
assert.ok(resource instanceof Cesium.Resource);
|
||||
assert.notEqual(resource.constructor, Cesium.Resource);
|
||||
assert.notEqual(made.requestTileGeometry, own, 'tile requests are tracked');
|
||||
await assert.rejects(
|
||||
port.setTerrain({
|
||||
kind: 'quantizedMesh',
|
||||
url: 'https://terrain.example/mesh',
|
||||
fetchTile: 'nope',
|
||||
}),
|
||||
/fetchTile is a function/,
|
||||
);
|
||||
});
|
||||
|
||||
test('setBase replaces the imagery and says what it drew', async () => {
|
||||
const { scene, port } = setup();
|
||||
const overlay = port.imagery.add({ kind: 'xyz', url: url('overlay') });
|
||||
|
||||
Reference in new issue
Block a user