Merge branch 'main' into fix/panel-speed-reported

This commit is contained in:
Sameh Khamis authored and GitHub committed 2026-11-17 16:42:58 -08:00
commit 3c3934582e
24 files changed
+542 -233

No files matched your search

+4 -6
View File
@@ -43,7 +43,6 @@ import {
import {
displayDelayMs,
followsClock,
MODEL_MIN_PX,
BILLBOARD_SCALE,
TRACKED_BILLBOARD_SCALE_BY_DISTANCE,
DR_CORRECTION_MS,
@@ -311,11 +310,11 @@ export function createMotion({
const spec = parts.rendering._modelSpec(
flightState.records.data.get(icao24),
);
// Drawn as the fleet draws it: its own size, never under MODEL_MIN_PX.
// Drawn as the fleet draws it: at its true size.
const focalLengthPx = viewportHeightPx / (2 * Math.tan(pose.fovy / 2));
const projectedDiameterPx =
(2 * spec.nativeRadiusM * spec.scale * focalLengthPx) / rangeM;
return Math.max(MODEL_MIN_PX, projectedDiameterPx);
return projectedDiameterPx;
}
const sprite = readEntityRecord(flightState._trackedEntity)?.sprite;
@@ -511,9 +510,8 @@ export function createMotion({
}
/** The tracked model's rendered bounding radius (m), or 0 when no model of this
* contact is drawing. Carries the scale it is drawn at, which may be
* above `scale` to satisfy its pixel floor — the trail head has to be judged
* against the size the operator SEES, not the nominal one. */
* contact is drawing, at the scale it is drawn at — the trail head has to
* be judged against the size the operator SEES. */
/** World-space origin of the tracked model, or null when no model of this
* contact is drawing. This is the centre the rendered bounding sphere is
* measured from, so the trail clip and the envelope agree on one frame. */
+27 -26
View File
@@ -61,21 +61,26 @@ export const MODEL_WHITE = rgba('#FFFFFF');
export const GROUND_SCALE = 0.8;
// --- 3D model rendering (mirrors flights.js) -----------------------------------------
// When enabled, military aircraft render as 3D glTF models once the camera is below
// MODEL_ALT_CEIL_M (zoomed in); higher up they stay flat billboards. Eligibility is
// FRUSTUM-based (on-screen), and the slots go to either the nearest planes ('proximity')
// or every in-view plane ('all'), each backed by a hard cap so a draw-call explosion
// can't tank the frame (no instancing yet). Each aircraft draws the fleet model of its
// type, as the flights layer does; the amber tint sets this layer apart.
// When enabled, a military aircraft draws as its 3D glTF model only within MODEL_ADD_M of the
// camera (eye to aircraft); farther away it stays its icon. Models are drawn at their true size,
// with no minimum pixel size. Eligibility is distance-based with on-screen priority, and the slots
// go to either the nearest planes ('proximity') or every in-range plane ('all'): the two modes share
// the radius and differ by their caps. Each aircraft draws the fleet model of its type, as the
// flights layer does; the amber tint sets this layer apart.
export const MODEL_ALT_CEIL_M = 800000;
// m: below this camera altitude, draw 3D models (raised so it's easy to trigger)
export const MODEL_ADD_M = 3000;
// model NEW planes within 3 km of the camera (mirror of flights.js)
export const MODEL_MIN_PX = 24;
// floor so distant models stay visible without ballooning into a min-pixel blob (mirror of flights.js)
export const MODEL_KEEP_M = 3600;
// KEEP modeled planes out to 3.6 km (hysteresis, mirror of flights.js)
// Per-mode caps + radii — mirror of flights.js. Modes differ by RADIUS (not just cap) so Proximity
// and All aren't identical when few planes are in range; on-screen planes win the cap (see flights.js).
export const MODEL_HIGHEST_CONTACT_M = 30000;
// m above the ellipsoid: no aircraft the layer draws flies higher (mirror of flights.js)
export const MODEL_ALT_CEIL_M = MODEL_HIGHEST_CONTACT_M + MODEL_KEEP_M;
// m: above this camera altitude no contact can be within MODEL_KEEP_M (mirror of flights.js)
// Per-mode caps — mirror of flights.js; on-screen planes win the cap (see flights.js).
export const MODEL_MAX = 150;
// 'proximity' cap
@@ -83,24 +88,20 @@ export const MODEL_MAX = 150;
export const MODEL_MAX_ALL = 350;
// 'all' cap
export const MODEL_PROX_ADD_M = 150000;
// proximity: model NEW planes within 150 km
export const MODEL_PROX_KEEP_M = 185000;
// proximity: KEEP modeled planes out to 185 km
// Cockpit keeps the standard Display radii but lowers the GLB budget. Contacts
// inside the selected band remain AIR silhouettes when they cannot own a model;
// contacts outside the band use compact dots.
export const COCKPIT_MODEL_MAX = 60;
// max concurrent GLBs in cockpit (never raises the map cap)
export const MODEL_ALL_ADD_M = 400000;
// all: model NEW planes within 400 km (~to the horizon)
// Cockpit's AIR band (mirror of flights.js): contacts inside it remain AIR
// silhouettes when they cannot own a model; contacts outside it use compact
// dots. Independent of the 3D model radius.
export const MODEL_ALL_KEEP_M = 450000;
// all: KEEP modeled planes out to 450 km
export const COCKPIT_AIR_PROX_ADD_M = 150000;
export const COCKPIT_AIR_PROX_KEEP_M = 185000;
export const COCKPIT_AIR_ALL_ADD_M = 400000;
export const COCKPIT_AIR_ALL_KEEP_M = 450000;
export const MODEL_HEADING_OFFSET_DEG = 180;
// every fleet model is nose -X: opposite Cesium heading 0
+4 -4
View File
@@ -250,11 +250,11 @@ export function createQueries({
/**
* Live layer params.
* `models3d` toggles 3D glTF jet-model rendering for the FLEET (altitude-gated): when on,
* surrounding military aircraft become 3D models once the camera is zoomed in past
* MODEL_ALT_CEIL_M. The TRACKED contact follows the same rule (`_trackedModelRegimeActive`),
* `models3d` toggles 3D glTF jet-model rendering for the FLEET: when on, military
* aircraft within MODEL_ADD_M (3 km) of the camera become 3D models, drawn at their true
* size. The TRACKED contact follows the same rule (`_trackedModelRegimeActive`),
* so selecting a contact never turns its icon into a model or its model into an icon.
* `models3dMode` is 'proximity' (nearest MODEL_MAX in view) or 'all' (every in-view plane).
* `models3dMode` is 'proximity' (cap MODEL_MAX) or 'all' (cap MODEL_MAX_ALL); both use the 3 km radius.
* @param {{models3d?: boolean, models3dMode?: 'proximity'|'all', selectedMilitaryTrackingId?: string|null}} params
*/
setParams(params = {}, { origin = 'programmatic' } = {}) {
+12 -5
View File
@@ -27,6 +27,10 @@ import {
} from '../../data/trackingClickGesture.js';
import { inputFor } from '../../input/dispatcher.js';
import {
COCKPIT_AIR_ALL_ADD_M,
COCKPIT_AIR_ALL_KEEP_M,
COCKPIT_AIR_PROX_ADD_M,
COCKPIT_AIR_PROX_KEEP_M,
TRAIL_MAX_POINTS,
displayDelayMs,
followsClock,
@@ -212,11 +216,13 @@ export function createTracking({
);
distancesSquared.push([icao24, distanceSquared(eye, position)]);
}
// The AIR band follows the 3D mode, not the 3D model radius.
const all = flightState._models3dMode === 'all';
const next = nextCockpitNearContacts(
previous,
distancesSquared,
parts.rendering._modelAddDistM(),
parts.rendering._modelKeepDistM(),
all ? COCKPIT_AIR_ALL_ADD_M : COCKPIT_AIR_PROX_ADD_M,
all ? COCKPIT_AIR_ALL_KEEP_M : COCKPIT_AIR_PROX_KEEP_M,
);
flightState._cockpitNearContacts = next;
for (const icao24 of previous)
@@ -923,10 +929,11 @@ export function createTracking({
flightState._trackedIcao = null;
// Hand the contact back to its icon only now, once it no longer reads as
// tracked (the settle plans it as a fleet contact).
if (flightState._icons?.has(clearedIcao)) {
flightState._icons.setShown(clearedIcao, true);
// Its fleet model, kept loaded while it was selected, takes it back in
// this frame; the icon shows only when there is no loaded one.
parts.rendering._handBackDeselected(clearedIcao);
if (flightState._icons?.has(clearedIcao))
parts.icons._settleIcon(clearedIcao, { fromCourseDeg: trackedCourseDeg });
}
parts.icons._applyIconPresentation(clearedIcao);
clearTrackedSubjectContext('military');
_emitAwarenessEvent('gev:awareness-subject-cleared', {