Name the surface heights answer against: globe.surfaceVersion and the surface settle kind

A new capability, surfaceIdentity, adds globe.surfaceVersion(): a number
that changes whenever what surface heights answer against changes (base,
terrain or photoreal swapped, the globe shown or hidden) and never on
camera moves or tile loads, so the app can key cached heights by it. The
settle kind 'surface' says whether that surface has loaded what is in
view: the terrain while the globe is shown, otherwise the drawn tiles,
false with neither; a renderer without the capability answers it as base.

The Cesium globe port reads both off the scene, so a base changed around
the port counts too; its versions come from one counter shared by every
port. The stub bumps on real base, terrain, photoreal and visibility
changes. A conformance check and a globe port test cover them.
This commit is contained in:
Sameh Khamis committed 2026-11-08 13:31:03 -08:00
1 parent e15cfb3e32
commit 456645f291
11 files changed
+165 -3

No files matched your search

+27
View File
@@ -602,3 +602,30 @@ test('a provider that fails to build is told as an error of its root tile', asyn
assert.deepEqual(errors, [{ tile: { x: 0, y: 0, level: 0 } }]);
layer.remove();
});
test('surfaceVersion follows what heights answer against; surface settles on it', () => {
const { scene, port } = setup(new Set([...ALL, 'surfaceIdentity']));
const first = port.surfaceVersion();
assert.equal(port.surfaceVersion(), first, 'steady while nothing changes');
assert.equal(port.isSettled('surface'), true, 'the globe has loaded');
scene.globe.tilesLoaded = false;
assert.equal(port.isSettled('surface'), false, 'the globe still loading');
assert.equal(port.surfaceVersion(), first, 'tile loads are not a change');
scene.globe.show = false;
const hidden = port.surfaceVersion();
assert.notEqual(hidden, first, 'the globe hidden');
assert.equal(port.isSettled('surface'), false, 'no globe and no tiles');
const tileset = fakeTileset();
scene.primitives.add(tileset);
const tiled = port.surfaceVersion();
assert.notEqual(tiled, hidden, 'tiles shown');
assert.equal(port.isSettled('surface'), true, 'the tiles have loaded');
scene.globe.show = true;
scene.globe.terrainProvider = {};
assert.notEqual(port.surfaceVersion(), tiled, 'new terrain under the globe');
// Without the capability there is no version and surface answers as base.
const plain = setup();
assert.equal(plain.port.surfaceVersion, undefined);
plain.scene.globe.show = false;
assert.equal(plain.port.isSettled('surface'), plain.port.isSettled('base'));
});