mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
The renderer contract is what the application asks of a 3D renderer. It is nine ports (frame, globe, draw, camera, query, input, effects, credits, quality) plus the renderer itself, one strict .d.ts per port in src/render/contract/. PORTS lists every member at run time, and a TypeScript-compiler test fails when the list and the types disagree on one member. An optional member exists only with its capability; a required one answers null or empty without it. Nothing in the application uses the contract yet. The stub renderer (src/render/stub/) implements every port in memory and draws nothing. Its camera is a port of the default camera's maths: views, lookAt, flights with their height arc and easing, rectangle framing on the geodesic midpoint, the view rectangle with its horizon and pole cases, changed thresholds, follows, and flights that finish inside the call. The conformance suite (src/render/conformance/) runs 59 checks against a renderer through the contract alone, in Node or in a browser page. The camera checks compare traces recorded from Cesium's own Camera, headless on a virtual clock (scripts/record-camera-goldens.mjs), to 1 mm, 1e-9 and 1e-3 px. The other checks cover listener rules on every subscription, the frame loop, draw sets, picks, motion clocks, heights, leases, imagery, styles, credits and quality knobs. The stub passes all of them but the model check, which needs a glTF asset. Reference scenes draw one scene per primitive family, a city and a calibration path from orbit to the street, from contract calls only and with no network. /dev/conformance/ draws them on the Cesium scene renderer (src/render/cesium/sceneRenderer.js), records references through a dev-server-only, loopback-only endpoint, and compares captures with pixelmatch's antialias detection plus a solid-pixel count. Measured on Cesium: every MSAA setting passes, and a dropped 4 px point, a dropped 2 px line and a 1 px shift of the view fail. visual.js states the limits. The package exports ./render/contract, ./render/stub and ./render/conformance. Documented in docs/RENDERER-CONTRACT.md, docs/CODE-BOUNDARIES.md and docs/CURRENT-STATE.md.
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
/**
|
|
* The renderer contract: what the application asks of a renderer, typed
|
|
* than the default one can draw the same application.
|
|
*/
|
|
export * from './common';
|
|
export * from './renderer';
|
|
export * from './frame';
|
|
export * from './globe';
|
|
export * from './draw';
|
|
export * from './camera';
|
|
export * from './query';
|
|
export * from './input';
|
|
export * from './effects';
|
|
export * from './credits';
|
|
export * from './quality';
|
|
|
|
/** Every capability a renderer may list. */
|
|
export declare const CAPABILITIES: readonly import('./common').Capability[];
|
|
|
|
/** The contract version this module describes. */
|
|
export declare const CONTRACT_VERSION: import('./renderer').ContractVersion;
|
|
|
|
/** One port's members: null when required, else the capability that adds it. */
|
|
export type PortDescriptor = Readonly<
|
|
Record<string, import('./common').Capability | null>
|
|
>;
|
|
|
|
/** Every port's members, by port name. */
|
|
export declare const PORTS: Readonly<Record<string, PortDescriptor>>;
|
|
|
|
/** Every quality setting a renderer may support. */
|
|
export declare const QUALITY_KEYS: readonly import('./quality').QualityKey[];
|
|
|
|
/** The phases and steps of one frame, in order. */
|
|
export declare const FRAME_STEPS: readonly import('./frame').FrameStep[];
|
|
|
|
/**
|
|
* What a renderer is missing against the contract: each required member it
|
|
* lacks, and each capability-gated member present without its capability.
|
|
*/
|
|
export declare function checkRendererShape(renderer: unknown): string[];
|
|
|
|
/** What one port (or handed-out shape) is missing against its descriptor. */
|
|
export declare function checkPortShape(
|
|
target: object,
|
|
port: string,
|
|
capabilities: ReadonlySet<string>,
|
|
): string[];
|