mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 03:32:19 +00:00
The renderer seam: clicks go to the newest tool, recession and display groups through the contract, drawing at parity with Cesium
- Clicks: when two tools want the globe's clicks, the newest takes them and the older is told and turns itself off; a click is decided when it arrives, and ambient selection fires only when no tool holds the pointer. The "map is busy" paths and their strings are removed. - Recession: the limb fade is shared (src/render/recession.js) and reaches icon and model sets through SetSpec.recede; tuning applies on the next frame. - Display panel groups are published through src/ui/displayGroups.js; the Weather group and src/viewWeather.js are removed. - Draw port: a set whose icons only move is moved in place, and models that did not change are not restyled each frame, so moving fleets cost what they did when drawn directly; an untinted, fully opaque model is drawn without a colour. - Conformance: input.lease.lost checks the new lease inside onLost and reports a throwing onLost; draw.sets.recede covers model sets. - QA scripts read the renderer host instead of internals the seam replaced.
This commit is contained in:
1 parent
a0d299523d
commit
0ab31d4fb8
130 files changed
+5438
-1674
No files matched your search
@@ -193,7 +193,7 @@ test('the application’s loop ticks at the idle rate while nothing moves, and a
|
||||
renderer.destroy();
|
||||
});
|
||||
|
||||
test('work pending at destroy settles and lets go of the scene', async (t) => {
|
||||
test('work pending at destroy is rejected and lets go of the scene', async (t) => {
|
||||
withDocument(t, fakeDocument());
|
||||
const viewers = [];
|
||||
const plugin = createCesiumRendererPlugin({
|
||||
@@ -207,9 +207,10 @@ test('work pending at destroy settles and lets go of the scene', async (t) => {
|
||||
const renderer = await plugin.create({ container: {} });
|
||||
const rendered = renderer.frame.renderOnce();
|
||||
renderer.destroy();
|
||||
await rendered;
|
||||
await assert.rejects(rendered, /renderer destroyed/, 'the one waiting');
|
||||
assert.equal(viewers[0].listeners.size, 0, 'no one-shot render stays');
|
||||
await renderer.frame.renderOnce();
|
||||
await assert.rejects(renderer.frame.renderOnce(), /renderer destroyed/);
|
||||
await assert.rejects(renderer.capture(), /renderer destroyed/);
|
||||
|
||||
const waiting = await plugin.create({ container: {} });
|
||||
const standing = viewers[1].listeners.size;
|
||||
@@ -325,3 +326,61 @@ test('only renderers this plugin made reach a Cesium viewer', () => {
|
||||
});
|
||||
|
||||
const EXPECTED_MISSING = [];
|
||||
|
||||
test('the plugin makes its viewer with the creation options, and sets the sky, time and clock before the first frame', async (t) => {
|
||||
const doc = fakeDocument();
|
||||
withDocument(t, doc);
|
||||
const log = [];
|
||||
let given;
|
||||
let viewer;
|
||||
const plugin = createCesiumRendererPlugin({
|
||||
createViewer(options) {
|
||||
given = options;
|
||||
viewer = fakeViewer(log);
|
||||
for (const phase of [
|
||||
'preUpdate',
|
||||
'postUpdate',
|
||||
'preRender',
|
||||
'postRender',
|
||||
])
|
||||
viewer.scene[phase] = new Cesium.Event();
|
||||
viewer.scene.skyAtmosphere = { show: true };
|
||||
viewer.scene.fog = { enabled: true };
|
||||
viewer.clock = { currentTime: Cesium.JulianDate.now() };
|
||||
return viewer;
|
||||
},
|
||||
});
|
||||
const time = Date.UTC(2030, 5, 21, 12);
|
||||
const clock = { now: () => 1234.5, date: () => time + 60_000 };
|
||||
const renderer = await plugin.create({
|
||||
container: { tag: 'container' },
|
||||
signal: new AbortController().signal,
|
||||
msaa: 2,
|
||||
sky: { atmosphere: false, fog: false },
|
||||
time,
|
||||
clock,
|
||||
});
|
||||
assert.equal(given.msaa, 2, 'multisampling');
|
||||
assert.equal(viewer.scene.skyAtmosphere.show, false, 'the sky, set');
|
||||
assert.equal(viewer.scene.fog.enabled, false);
|
||||
assert.equal(renderer.globe.sky.get().fog, false);
|
||||
assert.equal(
|
||||
Cesium.JulianDate.toDate(viewer.clock.currentTime).getTime(),
|
||||
time,
|
||||
'the scene time',
|
||||
);
|
||||
const ticks = [];
|
||||
renderer.frame.on('preUpdate', (tick) => ticks.push(tick.now));
|
||||
viewer.scene.preUpdate.raiseEvent(viewer.scene, viewer.clock.currentTime);
|
||||
assert.deepEqual(ticks, [1234.5], 'ticks read the clock given');
|
||||
renderer.destroy();
|
||||
|
||||
// Not given, the viewer is made as it always was.
|
||||
await plugin
|
||||
.create({
|
||||
container: { tag: 'container' },
|
||||
signal: new AbortController().signal,
|
||||
})
|
||||
.then((r) => r.destroy());
|
||||
assert.equal(given.msaa, undefined);
|
||||
});
|
||||
Reference in new issue
Block a user