feat(globe): engine members and the viewer bridge for the shell

Contract: camera.position(result?) and camera.height() for per-frame
readers, render.request(reason?), maps.releasePhotorealTiles, sources
with a caller-owned ready provider, isGlobeEngine. engine.maps now hides
every tileset it has shown, lets the last imagery/photoreal call win, and
setPhotorealTiles(null) restores the last base imagery and its credit
instead of leaving the photoreal credit on a bare globe.

Cesium engine: reads the Viewer camera/canvas aliases, detaches bridged
events through the remover Cesium returns, raises frame timestamps
without allocating, re-aims the horizon occluder only when the camera
moved, and renders the scene directly when the governor governs another
viewer (or none yet). engineFromViewer returns the registered scene
engine of a viewer, else builds and caches one. The render governor stays
the Cesium render backend under engine.render and gains
isRenderGovernorInstalled.
This commit is contained in:
German Khokhlov committed 2026-10-15 18:18:19 +04:00
1 parent a5c98c6b07
commit 58a196374f
26 files changed
+657 -45

No files matched your search

+32
View File
@@ -61,3 +61,35 @@ test('detach drops the Cesium subscription for good', () => {
assert.equal(source.numberOfListeners, 0);
source.raiseEvent();
});
test('a bridge detaches through the remover the source returned', () => {
// Cesium.Event.addEventListener returns a remover; the bridge relies on it
// alone, so event-like sources without removeEventListener work too.
const listeners = new Set();
const source = {
addEventListener(fn) {
listeners.add(fn);
return () => listeners.delete(fn);
},
};
const { event, detach } = bridgeEvent(source);
const remove = event.addEventListener(() => {});
assert.equal(listeners.size, 1);
remove();
assert.equal(listeners.size, 0);
event.addEventListener(() => {});
detach();
assert.equal(listeners.size, 0);
});
test('a unary bridge raises one mapped value', () => {
const source = new Cesium.Event();
const { event, detach } = bridgeEvent(source, null, {
unary: (scene, time) => time * 2,
});
const seen = [];
event.addEventListener((...values) => seen.push(values));
source.raiseEvent({}, 4);
assert.deepEqual(seen, [[8]]);
detach();
});