mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +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
@@ -21,7 +21,7 @@ import {
|
||||
} from './cameraGoldens.js';
|
||||
import { createCesiumCamera } from './camera.js';
|
||||
import { createCesiumPorts } from './ports.js';
|
||||
import { cameraOf } from '../rendererOf.js';
|
||||
import { bindRenderer, cameraOf } from '../rendererOf.js';
|
||||
|
||||
/** Records the headless scene cannot answer: they need the query port. */
|
||||
const QUERY_RECORDS = new Set([
|
||||
@@ -78,6 +78,7 @@ function headlessHarness(clock, { input = false } = {}) {
|
||||
clock.now += FRAME_MS;
|
||||
scene.tweens.update();
|
||||
if (input) scene.screenSpaceCameraController.update();
|
||||
scene.preUpdate.raiseEvent(scene);
|
||||
scene.postUpdate.raiseEvent(scene);
|
||||
},
|
||||
scene,
|
||||
@@ -287,6 +288,55 @@ test('a Cesium viewer with no renderer bound gets a camera port over its own cam
|
||||
});
|
||||
});
|
||||
|
||||
test('the camera port gives the clock its own tick back as it goes', () => {
|
||||
const ownTick = Cesium.Clock.prototype.tick;
|
||||
// A viewer with no renderer bound: its port goes when a renderer is bound.
|
||||
{
|
||||
const { scene, camera } = headlessCamera();
|
||||
scene.postUpdate = new Cesium.Event();
|
||||
scene.requestRender = () => {};
|
||||
const viewer = { scene, camera, clock: new Cesium.Clock() };
|
||||
cameraOf(viewer);
|
||||
assert.notEqual(viewer.clock.tick, ownTick, 'measured as the tick starts');
|
||||
bindRenderer(viewer, {});
|
||||
assert.equal(viewer.clock.tick, ownTick, 'its own tick once unbound');
|
||||
assert.equal(Object.hasOwn(viewer.clock, 'tick'), false);
|
||||
}
|
||||
// Wrapped again after the port: disposing leaves the later wrapper, and
|
||||
// the port's own part of the tick measures nothing more.
|
||||
{
|
||||
const { scene, camera } = headlessCamera();
|
||||
scene.postUpdate = new Cesium.Event();
|
||||
scene.requestRender = () => {};
|
||||
const clock = new Cesium.Clock();
|
||||
const part = createCesiumCamera({
|
||||
scene,
|
||||
camera,
|
||||
report: () => {},
|
||||
widget: { clock },
|
||||
});
|
||||
const wrapped = clock.tick;
|
||||
let later = 0;
|
||||
clock.tick = function (...args) {
|
||||
later += 1;
|
||||
return wrapped.apply(this, args);
|
||||
};
|
||||
part.dispose();
|
||||
let reads = 0;
|
||||
const frustum = camera.frustum;
|
||||
Object.defineProperty(camera, 'frustum', {
|
||||
get: () => {
|
||||
reads += 1;
|
||||
return frustum;
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
clock.tick();
|
||||
assert.equal(later, 1, 'the later wrapper still runs');
|
||||
assert.equal(reads, 0, 'the disposed port reads nothing');
|
||||
}
|
||||
});
|
||||
|
||||
test('setFov holds the vertical angle across resizes, and waits for a first one', () => {
|
||||
const { scene, camera } = headlessCamera();
|
||||
scene.postUpdate = new Cesium.Event();
|
||||
|
||||
Reference in new issue
Block a user