Files
gods-eye-view/src/render/stub/harness.js
T
Sameh Khamis 0ab31d4fb8 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.
2026-11-15 17:03:09 -08:00

54 lines
1.8 KiB
JavaScript

/**
* @module render/stub/harness
* @description The stub as the conformance suite's renderer under test, for
* the Node test and the browser page alike.
*/
import { DEFAULT_TOLERANCE } from '../conformance/index.js';
import { createStubRenderer, STUB_FAILING_MODEL_SCHEME } from './index.js';
import { toEcef } from './math.js';
/** @returns {import('../conformance/index.js').ConformanceHarness} */
export function createStubHarness(name = 'stub') {
// Each renderer's container: a stand-in that says its size, which the
// stub's `resize` follows.
const containers = new WeakMap();
return {
name,
create: async ({ viewport, capabilities }) => {
const container = {
clientWidth: viewport.width,
clientHeight: viewport.height,
};
const r = createStubRenderer({ viewport, capabilities, container });
containers.set(r, container);
return r;
},
resizeContainer: (r, { width, height }) => {
const container = containers.get(r);
if (!container) return;
container.clientWidth = width;
container.clientHeight = height;
},
frame: (r) => {
r.testing.tick();
},
now: (r) => r.testing.now(),
toEcef,
tolerance: DEFAULT_TOLERANCE,
flightPaths: 'trace',
// It draws only models into pixels.
pixels: false,
pointer: (r, type, x, y, extra) => r.testing.pointer(type, x, y, extra),
scriptHeights: (r, fn) => r.testing.setHeights(fn),
wallTime: (r) => r.testing.wallTime(),
// The stub loads nothing: any url is a model it draws, but one under
// its failing scheme.
assets: {
model: 'stub:model.glb',
missingModel: `${STUB_FAILING_MODEL_SCHEME}model.glb`,
// Any bytes: the stub parses none.
modelBytes: async () => new Uint8Array([0x67, 0x6c, 0x54, 0x46]),
},
};
}