mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
The flights and military layers now reach the renderer only through its ports: motion, queries, state, tracking, enrichment, evidence and policy read the camera pose, project through the query port, request and suspend frames through the frame port, and key per-frame caches on the frames drawn rather than the scene's frame number. Policy is plain data, the enrichment view test is pose-based, and the tracked aircraft is an icon in a draw-port set with a plain holder standing in for the entity that Cockpit, the tracked card and share links read. The mesh floor sampler can sample through the query port, excluding named draw sets, and both layers use it that way. A pick of another layer's tracked icon is never taken for one of a layer's own contacts. Twelve layer files leave the Cesium allow-list.
30 lines
988 B
JavaScript
30 lines
988 B
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { bindRenderer } from '../render/rendererOf.js';
|
|
import { renderedFrames } from './renderedFrames.js';
|
|
|
|
test('the key changes once per drawn frame, after it is drawn', () => {
|
|
const viewer = {};
|
|
const listeners = { postRender: new Set() };
|
|
bindRenderer(viewer, {
|
|
frame: {
|
|
on(phase, cb) {
|
|
listeners[phase].add(cb);
|
|
return () => listeners[phase].delete(cb);
|
|
},
|
|
},
|
|
});
|
|
assert.equal(renderedFrames(viewer), 0);
|
|
assert.equal(renderedFrames(viewer), 0, 'reading does not advance it');
|
|
assert.equal(listeners.postRender.size, 1);
|
|
for (const cb of listeners.postRender) cb({});
|
|
assert.equal(renderedFrames(viewer), 1);
|
|
renderedFrames(viewer);
|
|
assert.equal(listeners.postRender.size, 1, 'one listener per frame port');
|
|
});
|
|
|
|
test('without a frame port the key is -1', () => {
|
|
assert.equal(renderedFrames(null), -1);
|
|
assert.equal(renderedFrames({}), -1);
|
|
});
|