mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Checks that read drawn pixels no longer skip when nothing is drawn: a harness says pixels: false when its renderer draws only models into pixels, as the stub, and a renderer that draws an icon, an outlined line or a raster shell as nothing fails. The shell's patch is read where the ground below projects, in the units readPixels crops in. The contract notes what changed in version 0 besides additions, and loses two stale lines.
36 lines
1.2 KiB
JavaScript
36 lines
1.2 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') {
|
|
return {
|
|
name,
|
|
create: async ({ viewport, capabilities }) =>
|
|
createStubRenderer({ viewport, capabilities }),
|
|
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`,
|
|
},
|
|
};
|
|
}
|