mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
Upstream's layers and changes are carried onto the ports, with no Cesium outside src/render and no reach into the viewer: - Shipwrecks draw as one icon set, clicked through the input dispatcher. - News draws through draw sets, the camera port and the input dispatcher; its beacons pulse each frame through the frame port. - The scene occlusion probe moves into src/render/cesium and reaches detection through a new application hook, createOcclusionProbe; its private Cesium reads go through internals.js. - Flight and military trails, the stale and SIGNAL LOST cue, coasting and following the world clock run on the draw and frame ports. GPU icons follow the scene clock while the world clock is followed, and fade when stale. A report that holds is not planned again every tick. - Vessels are keyed by their record id. The stub boot now enables military, shipwrecks and news as well.
66 lines
2.0 KiB
JavaScript
66 lines
2.0 KiB
JavaScript
/** Connect portable vessel reconciliation to scene and selection operations. */
|
|
|
|
export function createVesselSnapshotRenderer({
|
|
state,
|
|
records,
|
|
rendering,
|
|
tracking,
|
|
selection,
|
|
cards,
|
|
followsClock = () => false,
|
|
}) {
|
|
/** `replace`: the rows are the world at another time (see VesselRecords). */
|
|
function reconcileVessels(
|
|
viewer,
|
|
rows,
|
|
{ complete = true, replace = false } = {},
|
|
) {
|
|
rendering.ensureCollections(viewer);
|
|
const occluder = rendering.makeOccluder();
|
|
const follow = followsClock();
|
|
records.reconcile(
|
|
rows,
|
|
{
|
|
complete,
|
|
selectedRecord: state.selectedRecord,
|
|
cap: rendering.renderRowLimit(),
|
|
...(replace && { replace }),
|
|
...(follow && { follow }),
|
|
},
|
|
{
|
|
add(record) {
|
|
rendering.prepareRecordVisual(record);
|
|
rendering.addRecordPrimitives(record, occluder);
|
|
},
|
|
updated(record) {
|
|
const selected = record === state.selectedRecord;
|
|
rendering.prepareRecordVisual(record);
|
|
rendering.syncRecordIcon(record);
|
|
if (record.id === state.trailId)
|
|
tracking.appendSelectedVesselTrailFix(record);
|
|
if (selected) {
|
|
cards.updateSelectedVesselHud(record);
|
|
selection.registerSelectedContext(record);
|
|
}
|
|
},
|
|
remove(record, evicted) {
|
|
if (evicted) selection.clearVesselInspection({ evicted: true });
|
|
rendering.removeRecordPrimitives(record);
|
|
},
|
|
removed(id) {
|
|
if (state.trailId === id) tracking.clearSelectedVesselTrail();
|
|
},
|
|
staleSelected(record) {
|
|
cards.updateSelectedVesselHud(record);
|
|
},
|
|
},
|
|
);
|
|
// The selected vessel at the new time: its trail starts there.
|
|
if (replace && state.selectedRecord && state.trailId)
|
|
tracking.startSelectedVesselTrail(state.selectedRecord);
|
|
state.lastVisibilityUpdate = 0;
|
|
rendering.updateVisibility(true);
|
|
}
|
|
return { reconcileVessels };
|
|
}
|