mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Supersedes #218 by @spcpza, ported onto the current component layout with fixes from review. Verified before merge: format, package boundaries, unit suite, build, and the browser tracking suite; a browser harness for the change where one applies; adversarial review applied. Contributor: @spcpza. His original commit is the base of this branch, and his own re-port onto main (2026-09-15, `5b69011`) was consulted while finishing the height work. That port reads every vehicle's surface from the app's shared ground-floor system (`cachedGroundFloor` / `warmGroundFloor` / `GROUND_FLOOR_LIFT_M`) rather than sampling the scene per layer, keeps a vehicle hidden until its cell answers, warms a bounded batch per poll on a timer instead of per frame, and renders at the ellipsoid above the altitude gate. That is the sounder primitive — one floor system for the app, with the rooftop-versus-street question already settled against a datum-correct DEM prior — and this branch's height work was rebuilt on it, replacing a bespoke cell cache, ground prior and rooftop rule written here. Credit for that direction is his. Future work (not in this PR), both written up in docs/CURRENT-STATE.md: - Readable route names. The realtime feeds carry only `route_id`; `route_short_name` / `route_long_name` live in each operator's static GTFS `routes.txt`, and headsigns in `trips.txt`. Doing it properly wants a server-side metadata loader beside the transit proxy with fixed registered static sources, bounded indexes built once and persisted, a slow conditional refresh, and a versioned route dictionary the browser caches. Shipped here: ids are never rewritten, and a cut one carries an ellipsis instead of reading as a typo. - Below-ground rendering. Subway vehicles are drawn on the surface directly above themselves, because the feeds carry no depth and a train nobody can see is not worth drawing; the card says so plainly. Real treatment wants OSM tunnel geometry per city and a ghosted sprite tethered to the surface. The owner recorded it and left it. Round four and after (2026-09-15). The owner tested round three under FLIR and NVG, and then asked for the design to be taken further: elegant in performance, beautiful on camera, trails with a cache for public transport, Cesium-native, and a core other moving layers can adopt. Codex Astra reviewed the plan (it confirmed the speed fault: a glide started from the drawn position at receipt time but spanned the gap between report times, so with MBTA reporting every ~10 s against a 15 s poll every second glide ran at 1.5x; it rejected a queued-segment patch), then wrote the design, then implemented it in commit-sized passes with adversarial review between them and real-browser harness runs by the integrator. What this PR now contains beyond the contributor's original port: - Delayed playback in a contact-agnostic core (`src/data/contactPlayback.js`): each vehicle keeps a typed, bounded fix history and a display clock that runs at one second per second through it, a feed-derived lag behind real time, holding at its newest fix rather than extrapolating and never sprinting to catch up. Marker, course, motion word, card and trail all read the same displayed sample. The clock has an explicit time-offset and seek API so a rewind is a later feature, not a rewrite; flights and vessels are untouched. - A selected-vehicle trail (`src/data/contactTrailRenderer.js`, `src/layers/transit/trails.js`): the retained history drawn with batched Cesium primitives, clipped at display time so the head is exactly the sprite, faded by age, in the mode colour (white under sensor presets), on the same surface path as the marker. - Bounded proxy-side history (`server/providers/transitHistory.js`): fifteen minutes and at most 128 fixes per vehicle with hard byte ceilings, MBTA only for now (opt-in per feed), served by a small endpoint that never fetches upstream, so a selected trail survives a browser reload while the server keeps running. - Scene work bounded to what is visible and moving, an occluder, cached DETECT candidates, holds on the render loop only while something visible moves. - Sensor presets: white-hot haloed sprites under NVG/FLIR/noir (black-hot inverts), saturated mode colours under CRT, per-mode bracket tiers in every theme, the selected card keeping its mode colour. - A discriminating browser harness (`scripts/qa-transit.mjs`) that samples postRender frames, reads the real card anchor, and measures fleet budgets at 800 and 3,000 vehicles. Not built, recorded as follow-ups: curated route display names (lowest priority per the owner), fleet-wide tails, route snapping, a rewind UI, adoption of the playback core by flights and vessels. Verified at merge (2026-09-15 morning): unit suite 3,896 passing, build clean, format and boundary gates clean, tracking regression 109/109, browser harness keyless 200 pass / 0 fail (13 sensor checks unexercised because the live view offered fewer than six isolated sprites; every judged sprite passed), keyed on Google 3D tiles 198 pass with the per-frame allocation gate as the only failure. Follow-ups recorded: the keyed build's playback sampler still allocates per frame (CPU and frame time stay within budget; the 3,000-vehicle metro view sits at a 27.6 ms frame interval against a 25 ms budget), the shared detection overlay's per-paint allocation, friendlier route names, fleet-wide tails, a rewind UI, and adopting the playback core for vessels and flights. Co-authored-by: spcpza <[email protected]>
225 lines
7.9 KiB
JavaScript
225 lines
7.9 KiB
JavaScript
/**
|
|
* @module worldOverlayTokens
|
|
* @description Visual constants shared by the world-overlay host, painters,
|
|
* and source presentation bridges. Keep source selection and data semantics in
|
|
* their owning modules; this file is the single home for cross-source canvas
|
|
* presentation values.
|
|
*/
|
|
|
|
/** Shared visual tokens used by every world-overlay source. */
|
|
export const WORLD_OVERLAY_STYLE = Object.freeze({
|
|
background: 'rgba(4, 12, 16, 0.82)',
|
|
selectedBackground: 'rgba(5, 18, 24, 0.94)',
|
|
border: 'rgba(190, 232, 242, 0.18)',
|
|
selectedBorder: 'rgba(107, 232, 255, 0.72)',
|
|
title: 'rgba(232, 240, 244, 0.96)',
|
|
detail: 'rgba(147, 161, 173, 0.92)',
|
|
leader: 'rgba(147, 213, 228, 0.58)',
|
|
accent: '#6be8ff',
|
|
fontLabel: '500 10px "JetBrains Mono", monospace',
|
|
fontTrack: '600 10px "JetBrains Mono", monospace',
|
|
fontTitle: '600 12px "JetBrains Mono", monospace',
|
|
fontDetail: '500 10.5px "JetBrains Mono", monospace',
|
|
fontSelected: '600 13px "JetBrains Mono", monospace',
|
|
fontTrackedTitle: '600 13px "JetBrains Mono", monospace',
|
|
fontTrackedDetail: '500 11px "JetBrains Mono", monospace',
|
|
radius: 4,
|
|
});
|
|
|
|
/** CCTV's field-tested thumbnail-card overrides on top of shared card chrome. */
|
|
export const CCTV_THUMBNAIL_STYLE = Object.freeze({
|
|
padding: 4,
|
|
titleHeight: 13,
|
|
titleChars: 15,
|
|
background: WORLD_OVERLAY_STYLE.background,
|
|
titleColor: 'rgba(210, 236, 244, 0.95)',
|
|
titleFont: '600 10px "JetBrains Mono", monospace',
|
|
accent: 'rgb(107, 232, 255)',
|
|
leader: 'rgba(107, 232, 255, 0.6)',
|
|
rule: 'rgba(107, 232, 255, 0.95)',
|
|
ruleHeight: 2,
|
|
radius: 4,
|
|
});
|
|
|
|
/** Detection fonts and compositor glow retained exactly from the source renderer. */
|
|
export const DETECTION_STYLE = Object.freeze({
|
|
font: '10px JetBrains Mono, monospace',
|
|
microFont: '9px JetBrains Mono, monospace',
|
|
glowPx: 3,
|
|
});
|
|
|
|
/**
|
|
* Alpha of the tracked readout card's backing plate — the legibility reference
|
|
* every other backing is measured against. Derived from
|
|
* `WORLD_OVERLAY_STYLE.background` and asserted against it in unit tests, so a
|
|
* future retune of the card cannot silently desynchronize the ambient family.
|
|
*/
|
|
export const CARD_PLATE_ALPHA = 0.82;
|
|
|
|
/**
|
|
* Ambient detection callouts carry a LIGHTER member of the card's backing
|
|
* family: enough plate to hold small mono text against sunlit imagery, not so
|
|
* much that a field of them reads as a wall of boxes. `calloutPlate` sits at
|
|
* ~58% of `CARD_PLATE_ALPHA`; `calloutPlateSpace` is the owner-requested
|
|
* "slightly higher opacity so the text pops" for space-tier (satellite)
|
|
* contacts, which sit over the high-albedo lit Earth disc more often than
|
|
* aircraft do.
|
|
*
|
|
* These are DARK plates painted with NORMAL blending, which makes them
|
|
* self-adapting: over night terrain or space a dark plate on a dark scene is
|
|
* nearly invisible, while over bright ground it does the full darkening job.
|
|
* That is the same mechanism the tracked card uses, and the reason it survives
|
|
* every style — see `PLATE_ALPHA_BAND` in the tests.
|
|
*/
|
|
export const DETECTION_PLATE_BAND = Object.freeze({ min: 0.5, max: 0.62 });
|
|
|
|
/**
|
|
* What survives of a callout plate when SKY, not ground, is behind the label.
|
|
*
|
|
* The plate exists to hold small mono text against sunlit imagery. Against the
|
|
* horizon it has no job to do — there is nothing bright and busy to separate
|
|
* the text from — and at full strength it reads as a row of dark boxes pasted
|
|
* on an empty sky, which is the one place the pre-plate bare-text look was
|
|
* already better (owner field call, 2026-08-21).
|
|
*
|
|
* So the plate is SCALED here rather than replaced: every theme keeps its own
|
|
* hue and its own relative weight, and the sky case lands at a whisper that is
|
|
* visually the old bare text while still catching a bright cloud. Which case a
|
|
* given label is in comes from `skyBackdropFactor`, blended across a band so
|
|
* contacts crossing the horizon fade instead of popping.
|
|
*/
|
|
export const SKY_PLATE_SCALE = 0.22;
|
|
|
|
/**
|
|
* Sensor-style palettes for the host-owned detection paint lane.
|
|
*
|
|
* `labelBg` is the SCANLINE wash colour and stays on the screen-blended sensor
|
|
* surface. `calloutPlate`/`calloutPlateSpace` are the callout backings and are
|
|
* painted on the shared normal-blend canvas; they are deliberately separate
|
|
* tokens so retuning label legibility can never shift the scanline wash.
|
|
* Each keeps its theme's hue so a plate reads as amber/green/thermal chrome
|
|
* rather than a neutral box dropped on top of the sensor image.
|
|
*/
|
|
export const DETECTION_THEME_MAP = Object.freeze({
|
|
retro: {
|
|
line: 'rgba(255, 176, 56, 0.88)',
|
|
label: 'rgba(255, 216, 128, 0.95)',
|
|
labelBg: 'rgba(30, 12, 0, 0.72)',
|
|
calloutPlate: 'rgba(30, 12, 0, 0.48)',
|
|
calloutPlateSpace: 'rgba(30, 12, 0, 0.56)',
|
|
glow: 'rgba(255, 176, 56, 0.45)',
|
|
dim: 'rgba(230, 190, 140, 0.62)',
|
|
cardBorder: 'rgba(255, 210, 150, 0.16)',
|
|
blend: 'screen',
|
|
filter: 'contrast(1.08) saturate(1.04)',
|
|
scanline: 0.085,
|
|
tiers: {
|
|
civil: '#ffd27a',
|
|
military: '#ff8a3c',
|
|
sea: '#ffc06a',
|
|
space: '#ffe0a0',
|
|
vehicle: '#d0a060',
|
|
veh_jam: '#ff3b30',
|
|
veh_slow: '#ffb300',
|
|
veh_free: '#00ff66',
|
|
veh_nodata: '#c9c9c9',
|
|
transit_bus: '#5EF08A',
|
|
transit_tram: '#FFC24A',
|
|
transit_subway: '#FF4538',
|
|
transit_rail: '#D9A6FF',
|
|
transit_ferry: '#5FD6FF',
|
|
transit_unknown: '#D8DDE5',
|
|
},
|
|
},
|
|
surveillance: {
|
|
line: 'rgba(120, 255, 130, 0.9)',
|
|
label: 'rgba(225, 255, 210, 0.97)',
|
|
labelBg: 'rgba(6, 16, 6, 0.78)',
|
|
calloutPlate: 'rgba(6, 16, 6, 0.48)',
|
|
calloutPlateSpace: 'rgba(6, 16, 6, 0.56)',
|
|
glow: 'rgba(120, 255, 120, 0.42)',
|
|
dim: 'rgba(170, 205, 160, 0.62)',
|
|
cardBorder: 'rgba(190, 255, 190, 0.18)',
|
|
blend: 'screen',
|
|
filter: 'contrast(1.12) saturate(1.12)',
|
|
scanline: 0.09,
|
|
tiers: {
|
|
civil: '#8fe89a',
|
|
military: '#ff5a47',
|
|
sea: '#a6f0c0',
|
|
space: '#9fe8ff',
|
|
vehicle: '#ffc24a',
|
|
veh_jam: '#ff4538',
|
|
veh_slow: '#ffc24a',
|
|
veh_free: '#45d8ff',
|
|
veh_nodata: '#dcdcdc',
|
|
transit_bus: '#5EF08A',
|
|
transit_tram: '#FFC24A',
|
|
transit_subway: '#FF4538',
|
|
transit_rail: '#D9A6FF',
|
|
transit_ferry: '#5FD6FF',
|
|
transit_unknown: '#D8DDE5',
|
|
},
|
|
},
|
|
thermal: {
|
|
line: 'rgba(255, 224, 170, 0.95)',
|
|
label: 'rgba(255, 236, 208, 0.98)',
|
|
labelBg: 'rgba(20, 20, 20, 0.66)',
|
|
calloutPlate: 'rgba(20, 20, 20, 0.46)',
|
|
calloutPlateSpace: 'rgba(20, 20, 20, 0.54)',
|
|
glow: 'rgba(255, 224, 170, 0.42)',
|
|
dim: 'rgba(245, 222, 196, 0.74)',
|
|
cardBorder: 'rgba(255, 255, 255, 0.15)',
|
|
blend: 'screen',
|
|
filter: 'contrast(1.1) saturate(1.08)',
|
|
scanline: 0.04,
|
|
tiers: {
|
|
civil: '#ffffff',
|
|
military: '#ff7a5c',
|
|
sea: '#ffd0b0',
|
|
space: '#d0e0ff',
|
|
vehicle: '#ffcf9f',
|
|
veh_jam: '#ff4538',
|
|
veh_slow: '#ffc24a',
|
|
veh_free: '#2ecc71',
|
|
veh_nodata: '#d8d8d8',
|
|
transit_bus: '#5EF08A',
|
|
transit_tram: '#FFC24A',
|
|
transit_subway: '#FF4538',
|
|
transit_rail: '#D9A6FF',
|
|
transit_ferry: '#5FD6FF',
|
|
transit_unknown: '#D8DDE5',
|
|
},
|
|
},
|
|
_default: {
|
|
line: 'rgba(0, 244, 255, 0.9)',
|
|
label: 'rgba(200, 250, 255, 0.97)',
|
|
labelBg: 'rgba(2, 18, 26, 0.66)',
|
|
calloutPlate: 'rgba(2, 18, 26, 0.46)',
|
|
calloutPlateSpace: 'rgba(2, 18, 26, 0.54)',
|
|
glow: 'rgba(0, 244, 255, 0.4)',
|
|
dim: 'rgba(150, 200, 215, 0.66)',
|
|
cardBorder: 'rgba(255, 255, 255, 0.12)',
|
|
blend: 'screen',
|
|
filter: 'contrast(1.05) saturate(1.05)',
|
|
scanline: 0.05,
|
|
tiers: {
|
|
civil: '#22e0ff',
|
|
military: '#ffb347',
|
|
sea: '#3fe0c8',
|
|
space: '#bda4ff',
|
|
vehicle: '#8fa6b4',
|
|
veh_jam: '#e05252',
|
|
veh_slow: '#f0b23e',
|
|
veh_free: '#2ecc71',
|
|
veh_nodata: '#c9c9c9',
|
|
transit_bus: '#5EF08A',
|
|
transit_tram: '#FFC24A',
|
|
transit_subway: '#FF4538',
|
|
transit_rail: '#D9A6FF',
|
|
transit_ferry: '#5FD6FF',
|
|
transit_unknown: '#D8DDE5',
|
|
},
|
|
},
|
|
});
|