// src/data/aircraftIcons.js /** * Nose-up white aircraft silhouettes, one per classifyAircraft() kind, as SVG * data URIs for Cesium billboards. * * FIDELITY NOTE (2026-07-02): redrawn at a 96×96 viewBox (glyph centered at * 48,48) instead of the old 32×32. The billboards themselves are still added at * width/height 20 (24 tracked) in flights.js / militaryFlights.js, so Cesium * DOWN-samples this larger, higher-precision source to the same on-screen * footprint — crisp anti-aliased edges instead of an upscaled 32px bitmap. The * on-screen size is unchanged (the billboard's explicit width/height, not the * SVG's, sets the pixel size — the intrinsic SVG size only controls raster * fidelity). * * All glyphs are nose-up (nose toward -Y at rotation 0; the screen-projected * rotation pipeline in iconOrientation.js spins the whole glyph). Fill is white * with a subtle dark hairline stroke so the tint pipeline (billboard.color = * white / cyan-tracked / amber-military, plus .withAlpha fades) keeps working — * no per-glyph hardcoded colors that would fight the tint. * * MIXED-SET UPDATE (2026-08-15, owner Hangar picks): airliner/widebody/ * turboprop/helicopter use the "refined" recognition-chart redraw; * quadjet/glider use the "bold" chart-symbol redraw; light/fastjet keep the * original drawings. Raster fidelity doubled (192px source, same 96 coords). * * The helicopter is a top-down body under a four-blade rotor drawn in three * frames (`aircraftIcon('helicopter', px, frame)`, turned by * `rotorFrames.js`). Two kinds are not aircraft: `vehicle`, one sprite for * every airport vehicle, and `station`, a mast for ground stations, drawn * upright. * * Silhouette language follows skylight's type-aware glyphs (MIT, * https://github.com/cpaczek/skylight): slender fuselages, swept wings for * jets, long high-aspect wings for the glider, straight wings + prop discs for * props, a rotor disc + tail boom + tail-rotor for the helicopter, and a delta * for the fast jet. Each class has a DISTINCT planform so it reads at ~20px by * shape alone: every glyph is fitted to the same extent, so none is bigger * than another. */ const VIEW = 96; const C = VIEW / 2; // 48 — glyph centre // Hairline dark edge (scaled for the 96 box: ~1.5u ≈ the old 0.5u at 32). const STROKE = 'stroke="rgba(0,0,0,0.32)" stroke-width="1.4" stroke-linejoin="round"'; // Heavier edge for the chart-symbol ("bold") glyphs adopted 2026-08-15. const STROKE_BOLD = 'stroke="rgba(0,0,0,0.38)" stroke-width="2" stroke-linejoin="round"'; // Softer white for translucent detail (prop discs, rotor disc) — still white so // the tint multiplies cleanly; only the alpha differs. const DISC = 'fill="white" fill-opacity="0.5"'; // Each body is drawn in a centred coordinate frame (origin 0,0 = glyph centre), // nose toward -Y. Numbers are in the 96-unit space (half-extent up to ~45). const BODIES = { // ── Airliner: slender swept-wing narrow-body, two underwing engine pods, // swept tailplane. The canonical jet; everything else reads against it. airliner: ` `, // ── Widebody: same swept jet but noticeably BIGGER span + fatter fuselage, // twin engines set further out. Reads as a heavier airliner. widebody: ` `, // ── Quadjet: the widest swept jet, with FOUR bold underwing engine pods (two // per wing) that hang well below the trailing edge — the wing reads as a // 4-lumped bar even when the individual pods blur together at ~20px. quadjet: ` `, // ── Turboprop: bold STRAIGHT (unswept) wings — thicker chord than a jet — two // fat nacelles that jut ahead of the leading edge, each capped by a solid // prop disc. Reads as "straight wing with two lumps + discs" at ~20px. turboprop: ` `, // ── Light GA: small and CHUNKY — short, DEEP-chord straight wings and a fat // stubby fuselage make it read as a solid little block (not a thin cross), // with a bold nose prop disc. The short deep wing is the anti-glider cue. light: ` `, // ── Glider: VERY long, high-aspect TAPERED wings (fat root → thin tips) on a // slim fuselage with a T-tail. The extreme span is the whole identity — it // reads as "the wide skinny one" against light's short stubby wings. glider: ` `, // ── Fast jet: sharp delta/cropped-delta with a pointed nose, LERX root // blend, and twin tail fins. Aggressive, all-wing. fastjet: ` `, // 2026-08-15 additions: two NEW classes (bizjet, uav). Same contract as // the set above: 96×96 nose-up, // white fill, hairline stroke, tint-safe. // Business jet — slender fuselage, modest swept wing, aft engines, T-tail. bizjet: ` `, // ── TR-3B (hidden 9th kind, Easter egg — NOT a classifyAircraft() output). // The canonical black-triangle silhouette: a dark isosceles delta with a // light at each corner and a dimmer one at the centre. Reached only by // explicit user conversion (see tr3bRegistry.js), never by classification. // // DELIBERATE BREAK from the white-fill contract above: this glyph is a // SHADOW, so it carries its own near-black fill. The billboard tint still // multiplies (white fleet / cyan tracked / amber military), which darkens // rather than lightens — the triangle stays a silhouette in every layer, // and the corner lights pick the tint up as their hue. tr3b: ` `, // ── TR-3B, thermal-reactive variant. Same cold airframe, but the three // corner emitters + the centre one render HOT: near-white cores inside a // baked radial glow, so the FLIR/NVG luminance mapping (and any bloom) // lights them up while the hull stays cold. Selected by the layers // whenever their `irBoost` style param is on (surveillance/thermal/nvg). tr3bHot: ` `, // Large UAV (Reaper-class) — bulbous sensor nose, very long slender // straight wings, slim tail boom, canted V-tail. uav: ` `, // ── Airport vehicle (type ZVEH, emitter C1/C2): one service van seen from // above, front up, for every kind (fire truck, tug, car, de-icer). A // boxy body, a dark windscreen band and a roof light bar; the layer // tints it amber so it reads apart from aircraft. vehicle: ` `, // ── Ground station or obstacle (type GRND, emitter C3–C5): a radio mast // with two pairs of signal arcs, drawn upright on screen, never turned. station: ` `, }; /** * The helicopter, seen from above: a cabin, tail boom and tail plane under a * four-blade main rotor. The rotor turns in {@link ROTOR_FRAMES} frames 30° * apart; four blades repeat every 90°, so the third frame steps back onto * the first and the loop is seamless. The middle frame (blades as an X) is * the still one. */ const HELI_ROTOR_CENTRE_Y = -11.2; const HELI_DISC = ``; const HELI_BODY = ` `; /** Main-rotor blade angle of each frame, degrees clockwise. */ const ROTOR_ANGLES_DEG = [15, 45, 75]; /** How many rotor frames the helicopter turns through. */ export const ROTOR_FRAMES = ROTOR_ANGLES_DEG.length; /** The frame a helicopter holds when its rotor does not turn. */ export const ROTOR_STILL_FRAME = 1; /** One rotor frame: the disc, two crossed blades at `angle`, the body over them. */ function helicopterBody(frame) { const angle = ROTOR_ANGLES_DEG[frame] ?? ROTOR_ANGLES_DEG[ROTOR_STILL_FRAME]; const blade = (deg) => ``; return `${HELI_DISC}${blade(angle)}${blade(angle + 90)}${HELI_BODY}`; } /** * Every sprite draws at one size. The bodies were drawn at different spans * (a light aircraft's half-extent is 32.8 units, a quadjet's 47), so each is * scaled until its farthest painted edge, stroke included, sits * {@link GLYPH_HALF_EXTENT} units from the centre. Values are each body's * measured half-extent; aircraftIcons.test.mjs re-measures the rasters. */ const GLYPH_HALF_EXTENT = 44; const BODY_HALF_EXTENT = { airliner: 42.7, widebody: 45.7, quadjet: 47.0, turboprop: 40.7, light: 32.8, glider: 46.0, fastjet: 44.7, bizjet: 42.7, uav: 43.7, helicopter: 44.0, vehicle: 40.7, station: 47.1, tr3b: 40.8, tr3bHot: 42.3, }; const _iconCache = new Map(); const _b64 = (s) => typeof btoa === 'function' ? btoa(s) : Buffer.from(s, 'utf8').toString('base64'); /** Fleet raster: billboards render at ~40–58 DEVICE px (width 20–24 CSS × * Retina × class scale). Cesium's billboard atlas has no mipmaps, so a big * texture gets GPU-minified into mush (192 px ÷ 40 = 4.8× — the owner's * "soft" glyphs; the pre-2026-08-15 96 px raster aliased instead). Rastering * NEAR the display size lets the browser's SVG AA do the work: crisp AND * smooth. 64 covers the 40–58 px fleet band with ≤1.6× minification. */ const FLEET_RASTER_PX = 64; /** Raster size of the default fleet glyph. */ export const FLEET_ICON_PX = FLEET_RASTER_PX; /** Tracked raster: the tracked billboard is the one SUSTAINED large 2D glyph * (close-zoom fleet flybys hand off to 3D models). Keep the 192 px texture so * it stays crisp at its biggest on-screen sizes. */ const TRACKED_RASTER_PX = 192; /** Raster size of the tracked glyph and every glyph's near image. */ export const TRACKED_ICON_PX = TRACKED_RASTER_PX; /** * Data URI for a class silhouette (lazily built, cached per kind, size and * frame). The default size serves the fleet; pass * `aircraftIcon(kind, TRACKED_ICON_PX)` for the near image. * @param {string} kind A `classifyAircraft()` class, or a TR-3B kind. * @param {number} [px] Raster size. * @param {number} [frame] A helicopter's rotor frame, 0 to `ROTOR_FRAMES - 1` * (the still frame by default); other kinds have one image. * @returns {string} */ export function aircraftIcon(kind, px = FLEET_RASTER_PX, frame) { const heli = kind === 'helicopter'; const k = heli || BODIES[kind] ? kind : 'airliner'; const f = heli ? Number.isInteger(frame) && frame >= 0 && frame < ROTOR_FRAMES ? frame : ROTOR_STILL_FRAME : 0; const key = `${k}@${px}#${f}`; let uri = _iconCache.get(key); if (!uri) { const body = heli ? helicopterBody(f) : BODIES[k]; const fit = +(GLYPH_HALF_EXTENT / BODY_HALF_EXTENT[k]).toFixed(4); const svg = `${body}`; uri = 'data:image/svg+xml;base64,' + _b64(svg); _iconCache.set(key, uri); } return uri; }