mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
a5c98c6b07
commit
58a196374f
26 files changed
+657
-45
No files matched your search
@@ -65,3 +65,24 @@ test('the debug handle exposes the engine beside the viewer', () => {
|
||||
);
|
||||
assert.match(tools, /window\.__godsEyeView = \{\n\s+viewer,\n\s+engine,/);
|
||||
});
|
||||
|
||||
test('the scene engine is the one engineFromViewer returns for its viewer until teardown', async () => {
|
||||
const { engineFromViewer } =
|
||||
await import('../globe/cesium/engineFromViewer.js');
|
||||
const { createFakeEngine } = await import('../globe/testing/fakeEngine.js');
|
||||
const viewer = { name: 'viewer' };
|
||||
const cleanups = [];
|
||||
const engine = createSceneEngine(viewer, {
|
||||
tilesetRef: null,
|
||||
defer: (dispose) => cleanups.push(dispose),
|
||||
createEngine: () => createFakeEngine(),
|
||||
});
|
||||
assert.equal(engineFromViewer(viewer), engine);
|
||||
for (const cleanup of cleanups.reverse()) cleanup();
|
||||
assert.equal(engine.fake.destroyed, true);
|
||||
assert.throws(
|
||||
() => engineFromViewer(viewer),
|
||||
/createCesiumEngine needs a viewer/,
|
||||
'no longer registered: a fresh one would be built',
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user