mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32: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
@@ -123,6 +123,8 @@ export function createIcons({ flightState, services, parts }) {
|
||||
icons._planIcon(icao24, { fromCourseDeg: set.course(icao24, t) });
|
||||
return;
|
||||
}
|
||||
// Following the clock, not drawn at a time before it was there.
|
||||
set.setUnseen(icao24, flightState._drUnseen);
|
||||
const planned = set.expires(icao24) !== -Infinity;
|
||||
const prev = planned ? set.course(icao24, t) : null;
|
||||
// The pin holds the position; the renderer glides the course onto the
|
||||
|
||||
@@ -5,6 +5,14 @@ import { createFlightState } from './state.js';
|
||||
import { createIcons } from './icons.js';
|
||||
import { createContactIcons } from '../../data/aircraftIconLayer.js';
|
||||
import { layerPlacement } from '../../data/placementProvider.js';
|
||||
import {
|
||||
aircraftMotionRegime,
|
||||
createMotionRegime,
|
||||
fixEpochMs,
|
||||
} from '../../data/aircraftMotionRegime.js';
|
||||
import { mergeAircraftTimelineFixes } from '../../data/timelineHistory.js';
|
||||
import { julianFromEpochMs } from '../../geo/julian.js';
|
||||
import { TIMELINE_UNSEEN_MS } from '../../time/timelineFixes.js';
|
||||
|
||||
function services(focus = {}) {
|
||||
return {
|
||||
@@ -300,3 +308,110 @@ test('a live contact a placement places is drawn along where it places it', (t)
|
||||
icons._planIcon('p');
|
||||
assert.deepEqual(asked, []);
|
||||
});
|
||||
|
||||
/**
|
||||
* A layer following the world clock at `world.ms`, its contacts placed by
|
||||
* the shared regime on their own fixes around the time.
|
||||
*/
|
||||
function clockSetup(world) {
|
||||
const fields = { speed: 'velocity', track: 'true_track' };
|
||||
const { flightState, icons, set } = setup({
|
||||
motion: {
|
||||
_displayTimeAt: (ms) => julianFromEpochMs(ms),
|
||||
_fixEpochMs: fixEpochMs,
|
||||
_deadReckon: () => null,
|
||||
_motionRegime: (history, info, renderTime) =>
|
||||
aircraftMotionRegime(
|
||||
history,
|
||||
info,
|
||||
renderTime,
|
||||
fields,
|
||||
createMotionRegime(),
|
||||
),
|
||||
},
|
||||
});
|
||||
flightState.timeline = { active: () => true };
|
||||
flightState.now = () => world.ms;
|
||||
return { flightState, icons, set };
|
||||
}
|
||||
|
||||
/** A contact's row, never planned, and its own fixes at `times` (ms). */
|
||||
function onFixes(flightState, set, id, times) {
|
||||
set.put(
|
||||
{
|
||||
id,
|
||||
pos: { x: 0, y: 0, z: 0 },
|
||||
motion: { kind: 'hold', courseDeg: 0 },
|
||||
course: 0,
|
||||
size: [20, 20],
|
||||
show: true,
|
||||
focus: 1,
|
||||
meta: { layer: 'flights', id },
|
||||
},
|
||||
{ expiresAt: -Infinity },
|
||||
);
|
||||
flightState.records.data.set(id, { velocity: 100 });
|
||||
const history = mergeAircraftTimelineFixes(
|
||||
[],
|
||||
{
|
||||
fixes: times.map((atMs, i) => ({
|
||||
atMs,
|
||||
lat: 30,
|
||||
lon: i * 0.05,
|
||||
altitudeM: null,
|
||||
})),
|
||||
},
|
||||
{ renderAltitudeM: 3_000 },
|
||||
100,
|
||||
times[0],
|
||||
);
|
||||
flightState._positionHistory.set(id, history);
|
||||
return history;
|
||||
}
|
||||
|
||||
test('following the clock, a contact is not drawn before it was there, and is from its warm-up on', () => {
|
||||
const first = Date.UTC(2026, 10, 9, 12);
|
||||
const world = { ms: first - 10 * 60_000 };
|
||||
const { flightState, icons, set } = clockSetup(world);
|
||||
onFixes(flightState, set, 'c', [first, first + 60_000]);
|
||||
icons._planIcon('c');
|
||||
assert.equal(set.shown('c'), false, 'ten minutes before its first fix');
|
||||
assert.equal(set.expires('c'), first - TIMELINE_UNSEEN_MS);
|
||||
|
||||
// Half a minute before its first fix it is drawn, reaching it.
|
||||
world.ms = first - 30_000;
|
||||
icons._replanExpired(world.ms);
|
||||
assert.equal(set.shown('c'), true);
|
||||
|
||||
// The clock moved back: not there yet again.
|
||||
world.ms = first - 5 * 60_000;
|
||||
icons._replanExpired(world.ms);
|
||||
assert.equal(set.shown('c'), false);
|
||||
});
|
||||
|
||||
test('following the clock, a move back within the fixes draws a contact where it was then', () => {
|
||||
const t0 = Date.UTC(2026, 10, 9, 12);
|
||||
const world = { ms: t0 + 100_000 };
|
||||
const { flightState, icons, set } = clockSetup(world);
|
||||
const history = onFixes(flightState, set, 'c', [
|
||||
t0,
|
||||
t0 + 60_000,
|
||||
t0 + 120_000,
|
||||
]);
|
||||
icons._planIcon('c');
|
||||
icons._replanExpired(world.ms);
|
||||
// Back to half way between the first two fixes.
|
||||
world.ms = t0 + 30_000;
|
||||
icons._replanExpired(world.ms);
|
||||
const drawn = set.position('c', world.ms);
|
||||
const half = Cesium.Cartesian3.distance(
|
||||
history[0].position,
|
||||
history[1].position,
|
||||
);
|
||||
for (const fix of history.slice(0, 2))
|
||||
assert.ok(
|
||||
Math.abs(Cesium.Cartesian3.distance(drawn, fix.position) - half / 2) <
|
||||
half * 0.05,
|
||||
'half way between its first two fixes',
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user