mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Merge branch 'main' into denis/cockpit-subject-providers
This commit is contained in:
commit
546ac22708
217 files changed
+8983
-2470
No files matched your search
@@ -32,10 +32,7 @@ test('a FIRMS snapshot that ends at a set time names it instead of LIVE', (conte
|
||||
assert.equal(methods.getStats().at, at);
|
||||
assert.equal(methods.getStats().source, 'NASA FIRMS', 'the row drops LIVE');
|
||||
setLocale('de');
|
||||
assert.equal(
|
||||
methods.getStats().loadingLabel,
|
||||
'24 Std. bis 21.10. 15:00 UTC',
|
||||
);
|
||||
assert.equal(methods.getStats().loadingLabel, '24 h bis 21.10. 15:00 UTC');
|
||||
layerState._at = null;
|
||||
setLocale('en');
|
||||
assert.equal(methods.getStats().loadingLabel, 'LIVE · updated 2m ago');
|
||||
|
||||
@@ -164,10 +164,10 @@ export function createEnrichment({
|
||||
const bb = flightState._billboards.get(icao24);
|
||||
if (bb)
|
||||
parts.rendering._applyFleetBillboardPresentation(icao24, bb);
|
||||
// Hangar fleet: the class's GLB/scale may have changed — resync the
|
||||
// live model, any in-flight load, and the tracked standalone model.
|
||||
parts.rendering._syncModelToClass(icao24);
|
||||
}
|
||||
// The type picks the fleet model and its length — resync the live
|
||||
// model, any in-flight load, and the tracked standalone model.
|
||||
parts.rendering._syncModelToClass(icao24);
|
||||
}
|
||||
if (icao24 === flightState._trackedIcao && flightState._trackedEntity)
|
||||
parts.tracking._updateTrackedLabelModel(icao24);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { PLANE_MODEL_URL } from './policy.js';
|
||||
import { loadFleetModelSet } from '../../data/fleetModels.js';
|
||||
|
||||
export function createLifecycle({
|
||||
flightState,
|
||||
@@ -53,29 +53,19 @@ export function createLifecycle({
|
||||
registerSpriteCollection('flights', flightState._billboardCollection);
|
||||
flightState._modelCollection = new Cesium.PrimitiveCollection();
|
||||
viewer.scene.primitives.add(flightState._modelCollection);
|
||||
// Warm the glTF cache so the tracked plane's model instantiates instantly when first needed
|
||||
// (keeps the retained instance referenced; never rendered). Captured against this epoch so a
|
||||
// destroy/re-init mid-load doesn't flip the flag for a torn-down lifecycle.
|
||||
if (!flightState._preloadModel) {
|
||||
// Every fleet model loads once, up front, for every layer that draws
|
||||
// them (fleetModels.js), so no model is fetched while the session runs.
|
||||
// Captured against this epoch so a destroy/re-init mid-load doesn't flip
|
||||
// the flag for a torn-down lifecycle.
|
||||
{
|
||||
const epoch = flightState._modelEpoch;
|
||||
Cesium.Model.fromGltfAsync({
|
||||
url: resolveAsset(PLANE_MODEL_URL),
|
||||
asynchronous: false,
|
||||
})
|
||||
.then((m) => {
|
||||
if (epoch === flightState._modelEpoch) {
|
||||
flightState._preloadModel = m;
|
||||
loadFleetModelSet({ resolveAsset })
|
||||
.then(() => {
|
||||
if (epoch === flightState._modelEpoch)
|
||||
flightState._planeModelLoaded = true;
|
||||
} else {
|
||||
try {
|
||||
m.destroy();
|
||||
} catch {
|
||||
/* gone */
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
/* tracked plane just stays a billboard a beat longer */
|
||||
/* aircraft stay billboards */
|
||||
});
|
||||
}
|
||||
flightState._billboards = new Map();
|
||||
@@ -296,14 +286,6 @@ export function createLifecycle({
|
||||
flightState._modelEpoch += 1; // invalidate any in-flight load from this lifecycle (settles post-destroy)
|
||||
flightState._modelPending.clear();
|
||||
flightState._modelGen.clear();
|
||||
if (flightState._preloadModel) {
|
||||
try {
|
||||
flightState._preloadModel.destroy();
|
||||
} catch {
|
||||
/* gone */
|
||||
}
|
||||
flightState._preloadModel = null;
|
||||
}
|
||||
flightState._planeModelLoaded = false;
|
||||
flightState._billboards.clear();
|
||||
flightState._cullPositions.clear();
|
||||
|
||||
@@ -1,52 +1,70 @@
|
||||
import {
|
||||
CLASS_MODEL_REAL,
|
||||
CLASS_MODEL_URL,
|
||||
CLASS_SCALE_3D,
|
||||
} from '../../data/aircraftClass.js';
|
||||
import {
|
||||
trailAnchorForModel,
|
||||
visualCenterForModel,
|
||||
} from '../../data/modelVisualAnchor.js';
|
||||
import {
|
||||
MODEL_BELLY_OFFSET_NATIVE,
|
||||
MODEL_COLOR_BLEND_AMOUNT,
|
||||
MODEL_NATIVE_RADIUS_M,
|
||||
MODEL_SCALE,
|
||||
PLANE_MODEL_URL,
|
||||
} from './policy.js';
|
||||
import { aircraftModelSpec, fleetModelSet } from '../../data/fleetModels.js';
|
||||
import { MODEL_COLOR_BLEND_AMOUNT } from './policy.js';
|
||||
|
||||
/**
|
||||
* The glTF asset, scale and measured geometry a civil aircraft class renders
|
||||
* with. Real per-class GLBs are baked to real-world meters (scale 1, measured
|
||||
* belly and radius); classes without one share airplane.glb at the class's
|
||||
* 3D scale. Shared by the Flights layer and the Local ADS-B layer so both draw
|
||||
* the same model for the same class.
|
||||
* @param {string} klass Aircraft class from `classifyAircraft`.
|
||||
* @returns {{url:string, scale:number, nativeRadiusM:number, bellyM:number,
|
||||
* blendAmount:number, visualCenterNative:object, trailAnchorNative:object}}
|
||||
* What an aircraft draws with before the fleet model set has loaded: no
|
||||
* model (its billboard stays the visual), with neutral geometry for any
|
||||
* reader that asks.
|
||||
*/
|
||||
export function civilAircraftModelSpec(klass) {
|
||||
const real = CLASS_MODEL_REAL[klass];
|
||||
if (real) {
|
||||
return {
|
||||
url: real.url,
|
||||
scale: 1,
|
||||
nativeRadiusM: real.radiusM,
|
||||
bellyM: real.bellyM,
|
||||
export const UNLOADED_AIRCRAFT_MODEL_SPEC = Object.freeze({
|
||||
model: null,
|
||||
url: null,
|
||||
scale: 1,
|
||||
scaleXYZ: Object.freeze([1, 1, 1]),
|
||||
length: 0,
|
||||
nativeRadiusM: 20,
|
||||
clearanceM: 0,
|
||||
bellyM: 0,
|
||||
elevationM: 0,
|
||||
tinted: false,
|
||||
blendAmount: MODEL_COLOR_BLEND_AMOUNT,
|
||||
visualCenterNative: Object.freeze([0, 0, 0]),
|
||||
trailAnchorNative: Object.freeze([0, 0, 0]),
|
||||
key: 'unloaded',
|
||||
});
|
||||
|
||||
/**
|
||||
* The fleet model, life-size scale and measured geometry an aircraft draws
|
||||
* with, chosen by its ICAO type and emitter category (`fleetModels.js`).
|
||||
* Shared by the Flights, Military Flights and Local ADS-B layers so all three
|
||||
* draw the same model for the same aircraft. `bellyM` is the model's scaled
|
||||
* clearance: how far a grounded aircraft's origin stands above the ground.
|
||||
* @param {{typeCode?: string|null, type?: string|null,
|
||||
* category?: string|number|null}|null|undefined} aircraft
|
||||
* @param {object|null} [set] The loaded fleet model set.
|
||||
* @returns {object} The spec, or {@link UNLOADED_AIRCRAFT_MODEL_SPEC} before
|
||||
* the set has loaded.
|
||||
*/
|
||||
export function aircraftLayerModelSpec(aircraft, set = fleetModelSet()) {
|
||||
if (!set) return UNLOADED_AIRCRAFT_MODEL_SPEC;
|
||||
// Layers ask on every tick; each type and category is resolved once per set.
|
||||
let cache = specCaches.get(set);
|
||||
if (!cache) specCaches.set(set, (cache = new Map()));
|
||||
const key = aircraftModelSpecCacheKey(aircraft);
|
||||
let layerSpec = cache.get(key);
|
||||
if (!layerSpec) {
|
||||
const spec = aircraftModelSpec(set, {
|
||||
typeCode: aircraft?.typeCode ?? aircraft?.type ?? null,
|
||||
category: aircraft?.category ?? null,
|
||||
});
|
||||
layerSpec = Object.freeze({
|
||||
...spec,
|
||||
bellyM: spec.clearanceM,
|
||||
blendAmount: MODEL_COLOR_BLEND_AMOUNT,
|
||||
visualCenterNative: visualCenterForModel(real.url),
|
||||
trailAnchorNative: trailAnchorForModel(real.url),
|
||||
};
|
||||
});
|
||||
cache.set(key, layerSpec);
|
||||
}
|
||||
const scale = MODEL_SCALE * (CLASS_SCALE_3D[klass] || 1);
|
||||
const url = CLASS_MODEL_URL[klass] || PLANE_MODEL_URL;
|
||||
return {
|
||||
url,
|
||||
scale,
|
||||
nativeRadiusM: MODEL_NATIVE_RADIUS_M,
|
||||
bellyM: MODEL_BELLY_OFFSET_NATIVE * scale,
|
||||
blendAmount: MODEL_COLOR_BLEND_AMOUNT,
|
||||
visualCenterNative: visualCenterForModel(url),
|
||||
trailAnchorNative: trailAnchorForModel(url),
|
||||
};
|
||||
return layerSpec;
|
||||
}
|
||||
|
||||
/** @type {WeakMap<object, Map<string, object>>} set -> cache key -> spec */
|
||||
const specCaches = new WeakMap();
|
||||
|
||||
/**
|
||||
* Cache key of an aircraft's model spec: what selects its model.
|
||||
* @param {object|null|undefined} aircraft
|
||||
* @returns {string}
|
||||
*/
|
||||
export function aircraftModelSpecCacheKey(aircraft) {
|
||||
return `${aircraft?.typeCode ?? aircraft?.type ?? ''}|${aircraft?.category ?? ''}`;
|
||||
}
|
||||
@@ -431,7 +431,7 @@ export function createMotion({
|
||||
const rangeM = Cesium.Cartesian3.distance(camera.positionWC, position);
|
||||
if (parts.rendering._modelOwnsVisual(icao24)) {
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(icao24)?.klass,
|
||||
flightState.records.data.get(icao24),
|
||||
);
|
||||
const scale = trackedModelScaleForPixelCap({
|
||||
baseScale: spec.scale,
|
||||
@@ -614,7 +614,7 @@ export function createMotion({
|
||||
parts.rendering._modelOwnsVisual(flightState._trackedIcao)
|
||||
) {
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
return modelVisualAnchor(
|
||||
flightState._trackedModel.modelMatrix,
|
||||
@@ -659,7 +659,7 @@ export function createMotion({
|
||||
)
|
||||
return 0;
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
const scale = Number.isFinite(flightState._trackedModel.computedScale)
|
||||
? flightState._trackedModel.computedScale
|
||||
@@ -673,7 +673,7 @@ export function createMotion({
|
||||
parts.rendering._modelOwnsVisual(flightState._trackedIcao)
|
||||
) {
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
// Through the model's OWN render chain (modelVisualAnchor's hand-rolled
|
||||
// half-correction put this offset on the lateral axis — see
|
||||
|
||||
@@ -39,8 +39,6 @@ export const GROUND_SCALE = 0.8;
|
||||
// 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).
|
||||
|
||||
export const PLANE_MODEL_URL = '/models/airplane.glb';
|
||||
|
||||
export const MODEL_ALT_CEIL_M = 800000;
|
||||
// m: below this camera altitude, draw 3D models (raised so it's easy to trigger)
|
||||
|
||||
@@ -55,10 +53,6 @@ export const TRACKED_MODEL_MIN_PX = 40;
|
||||
export const TRACKED_MODEL_MAX_PX = 200;
|
||||
// owner-selected close-range tracked-target feel
|
||||
|
||||
export const MODEL_NATIVE_RADIUS_M = 34.41;
|
||||
|
||||
export const MODEL_SCALE = 1;
|
||||
// airplane.glb is transform-applied and baked to real-world meters
|
||||
// Per-mode caps. Each model is its own draw call (no instancing yet), so these bound the frame cost.
|
||||
|
||||
export const MODEL_MAX = 150;
|
||||
@@ -90,21 +84,12 @@ export const MODEL_ALL_KEEP_M = 450000;
|
||||
// all: KEEP modeled planes out to 450 km
|
||||
|
||||
export const MODEL_HEADING_OFFSET_DEG = 180;
|
||||
// airplane.glb nose is opposite Cesium heading-0
|
||||
// every fleet model is nose -X: opposite Cesium heading 0
|
||||
// Owner launch-polish direction: models should read as clean light silhouettes,
|
||||
// with only a weak diffuse contribution from the existing approved textures.
|
||||
// with only a weak diffuse contribution from the models' own colours.
|
||||
|
||||
export const MODEL_COLOR_BLEND_AMOUNT = 0.94;
|
||||
|
||||
// Grounded-model belly offset: airplane.glb's centred origin sits 6.719 m ABOVE its
|
||||
// lowest vertex (glTF Y-up scene AABB with node transforms applied — same reader as
|
||||
// modelScale.test.mjs, measured after its 24× transform bake). × class multiplier ≈ 5.0–9.7 m
|
||||
// of lift, so a ground-snapped model rests its lowest geometry (gear/belly) ON the sampled
|
||||
// tile skin instead of sinking to the fuselage-centerline origin. Locked against the GLB
|
||||
// by modelScale.test.mjs.
|
||||
|
||||
export const MODEL_BELLY_OFFSET_NATIVE = 6.719;
|
||||
|
||||
export const CYAN_TRANSPARENT = Cesium.Color.CYAN.withAlpha(0);
|
||||
|
||||
export const COCKPIT_CONTACT_SIZE_PX = 6;
|
||||
@@ -203,6 +188,24 @@ export const LANDED_SPEED_MAX_MPS = 23;
|
||||
|
||||
export const FLEET_DR_INTERVAL_MS = 80;
|
||||
|
||||
/**
|
||||
* The icon-to-model rules the aircraft layers follow, as the Vessels, Transit
|
||||
* and Rail layers take them (`createFleetModelLayer`): the same altitude
|
||||
* ceiling, minimum pixel size, proximity/all caps, add/keep radii and
|
||||
* eligibility cadence, so every layer turns icons into models at one distance.
|
||||
*/
|
||||
export const FLEET_MODEL_POLICY = Object.freeze({
|
||||
altitudeCeilingM: MODEL_ALT_CEIL_M,
|
||||
minimumPixelSize: MODEL_MIN_PX,
|
||||
cap: MODEL_MAX,
|
||||
capAll: MODEL_MAX_ALL,
|
||||
addM: MODEL_PROX_ADD_M,
|
||||
addAllM: MODEL_ALL_ADD_M,
|
||||
keepM: MODEL_PROX_KEEP_M,
|
||||
keepAllM: MODEL_ALL_KEEP_M,
|
||||
intervalMs: FLEET_DR_INTERVAL_MS,
|
||||
});
|
||||
|
||||
/** @constant {number} Max ms between rotation passes while the camera is idle. */
|
||||
|
||||
export const ROTATION_REFRESH_MS = 1000;
|
||||
|
||||
@@ -480,9 +480,7 @@ export function createQueries({
|
||||
// and rises only as the coarse ground-floor cell warms. Zero extra sampling and
|
||||
// no `_modelDisplayPosition` call from postRender. Sprite-owned contacts keep
|
||||
// `bb.position` — sprite and bracket are co-located there, so association holds.
|
||||
const spec = modelOwnsVisual
|
||||
? parts.rendering._modelSpec(info?.klass)
|
||||
: null;
|
||||
const spec = modelOwnsVisual ? parts.rendering._modelSpec(info) : null;
|
||||
const pos = isTracked
|
||||
? parts.motion._trackedVisualCached() || bb.position
|
||||
: modelOwnsVisual
|
||||
|
||||
@@ -2,7 +2,11 @@ import * as Cesium from 'cesium';
|
||||
import { julianAt } from '../../time/julian.js';
|
||||
import { cyberSonarBaseAlpha } from '../../cyberSonar.js';
|
||||
import { selectModelEligible } from '../../data/modelEligibility.js';
|
||||
import { civilAircraftModelSpec } from './modelSpec.js';
|
||||
import {
|
||||
aircraftLayerModelSpec,
|
||||
aircraftModelSpecCacheKey,
|
||||
} from './modelSpec.js';
|
||||
import { createFleetModel } from '../../data/fleetModelInstances.js';
|
||||
import { CLASS_SCALE_2D } from '../../data/aircraftClass.js';
|
||||
import { isEmergency } from '../../data/aircraftEmergency.js';
|
||||
import { cockpitContactDotImage } from '../../data/cockpitContactDot.js';
|
||||
@@ -115,11 +119,14 @@ export function createRendering({
|
||||
return Number.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
function _modelSpec(klass) {
|
||||
const cached = flightState._specCache.get(klass);
|
||||
/** The fleet model an aircraft draws with, by its type and emitter category. */
|
||||
function _modelSpec(meta) {
|
||||
const key = aircraftModelSpecCacheKey(meta);
|
||||
const cached = flightState._specCache.get(key);
|
||||
if (cached) return cached;
|
||||
const spec = civilAircraftModelSpec(klass);
|
||||
flightState._specCache.set(klass, spec);
|
||||
const spec = aircraftLayerModelSpec(meta);
|
||||
// Not cached before the model set loads: the answer changes once it has.
|
||||
if (spec.model) flightState._specCache.set(key, spec);
|
||||
return spec;
|
||||
}
|
||||
|
||||
@@ -309,7 +316,7 @@ export function createRendering({
|
||||
Cesium.Ellipsoid.WGS84,
|
||||
flightState._scratchGroundCarto,
|
||||
);
|
||||
carto.height = h + _modelSpec(meta.klass).bellyM;
|
||||
carto.height = h + _modelSpec(meta).bellyM;
|
||||
return Cesium.Cartesian3.fromRadians(
|
||||
carto.longitude,
|
||||
carto.latitude,
|
||||
@@ -416,16 +423,13 @@ export function createRendering({
|
||||
return !!model && model.ready === true && model.show === true;
|
||||
}
|
||||
|
||||
/** Spec identity for a LOADED model: URL and scale together (same-URL classes
|
||||
* differ by scale — airliner vs quadjet both ship airplane.glb). */
|
||||
/** Spec identity for a LOADED model: the model and its scale together (one
|
||||
* model draws several types, each at its own length). */
|
||||
|
||||
const _specKeyFor = (klass) => {
|
||||
const spec = _modelSpec(klass);
|
||||
return `${spec.url}@${spec.scale}`;
|
||||
};
|
||||
const _specKeyFor = (meta) => _modelSpec(meta).key;
|
||||
|
||||
/** Class-change model sync (enrichment AND poll-path klass updates): when the
|
||||
* aircraft's live model or in-flight load no longer matches its class's spec,
|
||||
/** Type-change model sync (enrichment AND poll-path type/category updates): when the
|
||||
* aircraft's live model or in-flight load no longer matches its type's spec,
|
||||
* drop it so the eligibility pass reloads the right asset at the right scale.
|
||||
* Gap-proof: the fleet billboard is re-shown BEFORE the release so the
|
||||
* contact never goes invisible for the tick gap; _releaseModel's generation
|
||||
@@ -433,7 +437,7 @@ export function createRendering({
|
||||
* the same rule (its billboard entity is always the fallback visual). */
|
||||
|
||||
function _syncModelToClass(icao24) {
|
||||
const key = _specKeyFor(flightState.records.data.get(icao24)?.klass);
|
||||
const key = _specKeyFor(flightState.records.data.get(icao24));
|
||||
const current = flightState._models.get(icao24);
|
||||
if (
|
||||
(current && current._gevSpecKey !== key) ||
|
||||
@@ -478,6 +482,11 @@ export function createRendering({
|
||||
flightState._irReloadQueue = null;
|
||||
}
|
||||
|
||||
/** A Cesium Model of `spec` from the fleet set loaded up front (no fetch mid-session). */
|
||||
function _createModel(spec, options) {
|
||||
return createFleetModel(spec, options, { resolveAsset });
|
||||
}
|
||||
|
||||
/** Lazily create the glTF model for an aircraft (fire-and-forget; billboard shows until ready). */
|
||||
|
||||
async function _ensureModel(icao24) {
|
||||
@@ -497,6 +506,8 @@ export function createRendering({
|
||||
_modelCap()
|
||||
)
|
||||
return;
|
||||
// Until the fleet model set has loaded the aircraft stays a billboard.
|
||||
if (!_modelSpec(flightState.records.data.get(icao24)).model) return;
|
||||
const epoch = flightState._modelEpoch; // lifecycle token: if destroy() bumps it, this load is dead
|
||||
const gen = flightState._modelGen.get(icao24) || 0; // capture; if it changes during the load, we're stale
|
||||
flightState._modelPending.add(icao24);
|
||||
@@ -505,12 +516,11 @@ export function createRendering({
|
||||
// aircraft mid-load, the post-await admission below rejects the stale asset.
|
||||
// Boost state likewise: the creation options bake it in, so a mid-load
|
||||
// toggle must reject too (the reload queue only covers ADMITTED models).
|
||||
const specKey = _specKeyFor(flightState.records.data.get(icao24)?.klass);
|
||||
const specKey = _specKeyFor(flightState.records.data.get(icao24));
|
||||
const loadIrBoost = flightState._irBoost;
|
||||
try {
|
||||
const spec = _modelSpec(flightState.records.data.get(icao24)?.klass);
|
||||
model = await Cesium.Model.fromGltfAsync({
|
||||
url: resolveAsset(spec.url),
|
||||
const spec = _modelSpec(flightState.records.data.get(icao24));
|
||||
model = await _createModel(spec, {
|
||||
asynchronous: false,
|
||||
environmentMapOptions: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS,
|
||||
minimumPixelSize: MODEL_MIN_PX,
|
||||
@@ -560,7 +570,7 @@ export function createRendering({
|
||||
flightState._models.has(icao24) ||
|
||||
flightState._models.size >= _modelCap() ||
|
||||
// Class reclassified mid-load → this GLB/scale is for the OLD class.
|
||||
_specKeyFor(flightState.records.data.get(icao24)?.klass) !== specKey ||
|
||||
_specKeyFor(flightState.records.data.get(icao24)) !== specKey ||
|
||||
// IR boost flipped mid-load → this model baked the wrong shader/tint.
|
||||
flightState._irBoost !== loadIrBoost;
|
||||
if (stale) {
|
||||
@@ -716,6 +726,9 @@ export function createRendering({
|
||||
return;
|
||||
}
|
||||
if (
|
||||
// Until the fleet model set has loaded the billboard carries it.
|
||||
_modelSpec(flightState.records.data.get(flightState._trackedIcao))
|
||||
.model &&
|
||||
!flightState._trackedModel &&
|
||||
!flightState._trackedModelLoading &&
|
||||
parts.tracking._trackedModelLoadAllowed()
|
||||
@@ -723,14 +736,13 @@ export function createRendering({
|
||||
flightState._trackedModelLoading = true;
|
||||
const gen = flightState._trackedModelGen;
|
||||
const trackedSpec = _modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
const trackedKey = _specKeyFor(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
const trackedIrBoost = flightState._irBoost;
|
||||
Cesium.Model.fromGltfAsync({
|
||||
url: resolveAsset(trackedSpec.url),
|
||||
_createModel(trackedSpec, {
|
||||
asynchronous: false,
|
||||
environmentMapOptions: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS,
|
||||
minimumPixelSize: TRACKED_MODEL_MIN_PX,
|
||||
@@ -766,7 +778,7 @@ export function createRendering({
|
||||
// _trackedModel was still null): drop the stale asset; driver reloads.
|
||||
if (
|
||||
_specKeyFor(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
) !== trackedKey ||
|
||||
flightState._irBoost !== trackedIrBoost
|
||||
) {
|
||||
@@ -840,7 +852,7 @@ export function createRendering({
|
||||
_applyTrackedModelFade(flightState._trackedModel);
|
||||
if (!flightState._trackedModel.ready) return;
|
||||
const spec = _modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
flightState._trackedModel.scale = trackedModelScaleForPixelCap({
|
||||
baseScale: spec.scale,
|
||||
|
||||
@@ -198,9 +198,14 @@ export function createFlightSnapshotRenderer({
|
||||
) {
|
||||
rendering._applyFleetBillboardPresentation(icao24, bb);
|
||||
}
|
||||
// Poll-path class change (category updates): same model resync rule
|
||||
// as the enrichment path — the class's GLB/scale may have changed.
|
||||
if (prevMeta?.klass !== meta.klass) rendering._syncModelToClass(icao24);
|
||||
// Poll-path type or category change: same model resync rule as the
|
||||
// enrichment path — the fleet model or its scale may have changed.
|
||||
if (
|
||||
prevMeta?.klass !== meta.klass ||
|
||||
prevMeta?.category !== meta.category ||
|
||||
prevMeta?.typeCode !== meta.typeCode
|
||||
)
|
||||
rendering._syncModelToClass(icao24);
|
||||
} else {
|
||||
// Start where the fleet pass will draw it: the fleet renders behind
|
||||
// real time, so a fresh contact's displayed position is its fix
|
||||
|
||||
@@ -20,17 +20,13 @@ export function createFlightState({ source, services }) {
|
||||
* layer); see followsClock and displayDelayMs in policy.js. */
|
||||
flightState.timeline = null;
|
||||
|
||||
/** Per-class model spec. Hangar-fleet classes (CLASS_MODEL_REAL) ship GLBs
|
||||
* vertex-baked to real-world METERS in the airplane.glb axis convention, so
|
||||
* they render at scale 1 with their own measured belly lift and bounding
|
||||
* radius. Every other class keeps the shared-airplane.glb formula
|
||||
* (MODEL_SCALE × CLASS_SCALE_3D). nativeRadiusM is PER SCALE UNIT — pixel-cap
|
||||
* math multiplies it by `scale`, so world radius = nativeRadiusM × scale in
|
||||
* both branches. The code-side MIX tint dominates every existing asset so
|
||||
* class silhouettes stay light without modifying third-party GLBs/textures. */
|
||||
/* Specs are static per class, and the detection weld now asks for one per
|
||||
* MODELED contact per frame (up to the fleet cap) on top of the 12 Hz fleet
|
||||
* pass — so this is memoized, as militaryFlights.js already does. */
|
||||
/** Model spec per aircraft type and emitter category (aircraftLayerModelSpec in
|
||||
* flights/modelSpec.js): the procedural fleet model that draws the type, life size,
|
||||
* with its measured clearance, bounding radius and trail anchor. nativeRadiusM is PER
|
||||
* SCALE UNIT — pixel-cap math multiplies it by `scale`. The code-side MIX tint dominates
|
||||
* every model so silhouettes stay light (and this layer's own colour). Memoized: the
|
||||
* detection weld asks for one per MODELED contact per frame on top of the 12 Hz fleet
|
||||
* pass. */
|
||||
|
||||
flightState._specCache = new Map();
|
||||
|
||||
@@ -79,16 +75,11 @@ export function createFlightState({ source, services }) {
|
||||
// throttle the "more planes in view than the cap" console notice
|
||||
// The tracked entity's billboard goes transparent (rather than hidden) once the model takes
|
||||
// over, so it keeps supplying a bounding sphere for follow-camera framing. We only drop its
|
||||
// alpha after the GLB is preloaded so the model is ready to render the instant the billboard
|
||||
// fades — no gap, no double-image. Preloaded once at init; the instance is retained (not
|
||||
// destroyed) purely to keep Cesium's glTF cache warm for fast tracked-model instantiation.
|
||||
// alpha after the fleet model set is loaded so the model is ready to render the instant the
|
||||
// billboard fades — no gap, no double-image. The set loads once at init (fleetModels.js).
|
||||
|
||||
flightState._planeModelLoaded = false;
|
||||
|
||||
/** @type {Cesium.Model|null} retained preload that keeps the glTF cache warm */
|
||||
|
||||
flightState._preloadModel = null;
|
||||
|
||||
flightState._scratchModelHpr = new Cesium.HeadingPitchRoll(0, 0, 0);
|
||||
|
||||
flightState._scratchModelMtx = new Cesium.Matrix4();
|
||||
|
||||
@@ -254,6 +254,9 @@ export function createLocalAdsbLayer({
|
||||
);
|
||||
marker.evidence = evidence;
|
||||
marker.klass = klass;
|
||||
// What picks its fleet model: the adsbdb type, else the emitter category.
|
||||
marker.typeCode = enrichment.get(marker.record.icao)?.typeCode || null;
|
||||
marker.category = marker.record.category || null;
|
||||
const billboard = marker.entity?.billboard;
|
||||
if (!billboard) return;
|
||||
if (marker.iconKind !== klass) {
|
||||
|
||||
@@ -12,6 +12,15 @@ import {
|
||||
localAdsbReceiverLine,
|
||||
localAdsbStatus,
|
||||
} from './index.js';
|
||||
import { loadFleetModelSet } from '../../data/fleetModels.js';
|
||||
import { aircraftLayerModelSpec } from '../flights/modelSpec.js';
|
||||
import { fetchPublicFile } from '../../testSupport/fleetGlb.mjs';
|
||||
|
||||
// The layer draws models only once the fleet model set has loaded; load it from disk.
|
||||
const realInfo = console.info;
|
||||
console.info = () => {};
|
||||
await loadFleetModelSet({ fetchImpl: fetchPublicFile });
|
||||
console.info = realInfo;
|
||||
|
||||
function fakeReceiver(initial = {}) {
|
||||
const state = {
|
||||
@@ -529,12 +538,14 @@ test('the DISPLAY 3D toggle gives local aircraft magenta class models', async (t
|
||||
await layer.update();
|
||||
assert.equal(loads.length, 1);
|
||||
const [model] = loads;
|
||||
const spec = aircraftLayerModelSpec({ category: 'A7' });
|
||||
assert.equal(
|
||||
model.url,
|
||||
'/models/bell206.glb',
|
||||
'the Flights helicopter model',
|
||||
model.basePath,
|
||||
'/models/fleet/helicopters/generic_heli.glb',
|
||||
'the Flights rotorcraft model',
|
||||
);
|
||||
assert.equal(model.scale, 1);
|
||||
assert.ok(model.gltf instanceof Uint8Array, 'built from the loaded set');
|
||||
assert.equal(model.scale, spec.scale, 'drawn life size');
|
||||
assert.equal(model.id, 'local-adsb:a0b702');
|
||||
assert.ok(
|
||||
Cesium.Color.equals(
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { horizonOccluder } from '../../data/iconOrientation.js';
|
||||
import { selectModelEligible } from '../../data/modelEligibility.js';
|
||||
import { civilAircraftModelSpec } from '../flights/modelSpec.js';
|
||||
import { aircraftLayerModelSpec } from '../flights/modelSpec.js';
|
||||
import { createFleetModel } from '../../data/fleetModelInstances.js';
|
||||
import { loadFleetModelSet } from '../../data/fleetModels.js';
|
||||
import {
|
||||
FLEET_DR_INTERVAL_MS,
|
||||
MODEL_ALL_ADD_M,
|
||||
@@ -16,19 +18,24 @@ import {
|
||||
} from '../flights/policy.js';
|
||||
import { AIRCRAFT_ENVIRONMENT_MAP_OPTIONS } from '../../data/aircraftModelLighting.js';
|
||||
|
||||
const specKey = (spec) => `${spec.url}@${spec.scale}`;
|
||||
const specOf = (marker) =>
|
||||
aircraftLayerModelSpec({
|
||||
typeCode: marker?.typeCode,
|
||||
category: marker?.category,
|
||||
});
|
||||
|
||||
/**
|
||||
* 3D models for Local ADS-B aircraft under the DISPLAY rail's 3D toggle.
|
||||
*
|
||||
* Mirrors the public Flights fleet: models only below the altitude ceiling,
|
||||
* the same proximity/all caps and add/keep radii, the same visible-first
|
||||
* eligibility (`selectModelEligible`), the same per-class asset and scale
|
||||
* (`civilAircraftModelSpec`) and the same tint path (a MIX colour blend, here
|
||||
* eligibility (`selectModelEligible`), the same fleet model per type, life
|
||||
* size (`aircraftLayerModelSpec`) and the same tint path (a MIX colour blend, here
|
||||
* magenta, as Flights tints military amber). Each model owns its matrix. A
|
||||
* billboard stays the visual until its model is loaded AND placed; a grounded
|
||||
* aircraft's model rides the one-shot ground snap plus the class belly
|
||||
* offset, and without a resolved ground it stays a billboard.
|
||||
* offset, and without a resolved ground it stays a billboard. Every fleet
|
||||
* model loads once, up front, when the layer starts (`loadFleetModelSet`).
|
||||
* @param {object} options
|
||||
* @param {object} options.viewer Cesium viewer.
|
||||
* @param {Cesium.Color} options.color Model tint.
|
||||
@@ -44,6 +51,9 @@ export function createLocalAdsbModels({
|
||||
groundSnap = null,
|
||||
loadModel = (options) => Cesium.Model.fromGltfAsync(options),
|
||||
}) {
|
||||
void loadFleetModelSet({ resolveAsset }).catch(() => {
|
||||
/* aircraft stay billboards */
|
||||
});
|
||||
const collection = new Cesium.PrimitiveCollection();
|
||||
viewer.scene.primitives.add(collection);
|
||||
/** @type {Map<string, object>} id -> admitted model */
|
||||
@@ -75,8 +85,9 @@ export function createLocalAdsbModels({
|
||||
}
|
||||
|
||||
async function ensure(id, marker, cap) {
|
||||
const spec = civilAircraftModelSpec(marker.klass);
|
||||
const key = specKey(spec);
|
||||
const spec = specOf(marker);
|
||||
if (!spec.model) return;
|
||||
const key = spec.key;
|
||||
const current = models.get(id);
|
||||
if (current && current._gevSpecKey === key) return;
|
||||
if (current) release(id);
|
||||
@@ -85,17 +96,20 @@ export function createLocalAdsbModels({
|
||||
pending.set(id, loadGeneration);
|
||||
let model;
|
||||
try {
|
||||
model = await loadModel({
|
||||
url: resolveAsset(spec.url),
|
||||
asynchronous: false,
|
||||
environmentMapOptions: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS,
|
||||
minimumPixelSize: MODEL_MIN_PX,
|
||||
scale: spec.scale,
|
||||
color,
|
||||
colorBlendMode: Cesium.ColorBlendMode.MIX,
|
||||
colorBlendAmount: spec.blendAmount,
|
||||
id,
|
||||
});
|
||||
model = await createFleetModel(
|
||||
spec,
|
||||
{
|
||||
asynchronous: false,
|
||||
environmentMapOptions: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS,
|
||||
minimumPixelSize: MODEL_MIN_PX,
|
||||
scale: spec.scale,
|
||||
color,
|
||||
colorBlendMode: Cesium.ColorBlendMode.MIX,
|
||||
colorBlendAmount: spec.blendAmount,
|
||||
id,
|
||||
},
|
||||
{ resolveAsset, load: loadModel },
|
||||
);
|
||||
} catch {
|
||||
if (pending.get(id) === loadGeneration) pending.delete(id);
|
||||
return;
|
||||
@@ -106,7 +120,7 @@ export function createLocalAdsbModels({
|
||||
generation !== loadGeneration ||
|
||||
!eligible.has(id) ||
|
||||
models.has(id) ||
|
||||
specKey(civilAircraftModelSpec(marker.klass)) !== key;
|
||||
specOf(marker).key !== key;
|
||||
if (pending.get(id) === loadGeneration) pending.delete(id);
|
||||
if (stale) {
|
||||
model.destroy?.();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { JET_MODEL_URL } from './policy.js';
|
||||
import { loadFleetModelSet } from '../../data/fleetModels.js';
|
||||
|
||||
export function createLifecycle({
|
||||
flightState,
|
||||
@@ -47,29 +47,19 @@ export function createLifecycle({
|
||||
registerSpriteCollection('military', flightState._billboardCollection);
|
||||
flightState._modelCollection = new Cesium.PrimitiveCollection();
|
||||
viewer.scene.primitives.add(flightState._modelCollection);
|
||||
// Warm the glTF cache so the tracked plane's model instantiates instantly when first needed
|
||||
// (keeps the retained instance referenced; never rendered). Captured against this epoch so a
|
||||
// destroy/re-init mid-load doesn't flip the flag for a torn-down lifecycle.
|
||||
if (!flightState._preloadModel) {
|
||||
// Every fleet model loads once, up front, for every layer that draws
|
||||
// them (fleetModels.js), so no model is fetched while the session runs.
|
||||
// Captured against this epoch so a destroy/re-init mid-load doesn't flip
|
||||
// the flag for a torn-down lifecycle.
|
||||
{
|
||||
const epoch = flightState._modelEpoch;
|
||||
Cesium.Model.fromGltfAsync({
|
||||
url: resolveAsset(JET_MODEL_URL),
|
||||
asynchronous: false,
|
||||
})
|
||||
.then((m) => {
|
||||
if (epoch === flightState._modelEpoch) {
|
||||
flightState._preloadModel = m;
|
||||
loadFleetModelSet({ resolveAsset })
|
||||
.then(() => {
|
||||
if (epoch === flightState._modelEpoch)
|
||||
flightState._planeModelLoaded = true;
|
||||
} else {
|
||||
try {
|
||||
m.destroy();
|
||||
} catch {
|
||||
/* gone */
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
/* tracked plane just stays a billboard a beat longer */
|
||||
/* aircraft stay billboards */
|
||||
});
|
||||
}
|
||||
flightState._billboards = new Map();
|
||||
@@ -269,14 +259,6 @@ export function createLifecycle({
|
||||
flightState._modelEpoch += 1; // invalidate any in-flight load from this lifecycle (settles post-destroy)
|
||||
flightState._modelPending.clear();
|
||||
flightState._modelGen.clear();
|
||||
if (flightState._preloadModel) {
|
||||
try {
|
||||
flightState._preloadModel.destroy();
|
||||
} catch {
|
||||
/* gone */
|
||||
}
|
||||
flightState._preloadModel = null;
|
||||
}
|
||||
flightState._planeModelLoaded = false;
|
||||
flightState._billboards.clear();
|
||||
flightState._cullPositions.clear();
|
||||
|
||||
@@ -301,7 +301,7 @@ export function createMotion({
|
||||
const rangeM = Cesium.Cartesian3.distance(camera.positionWC, position);
|
||||
if (parts.rendering._modelOwnsVisual(icao24)) {
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(icao24)?.klass,
|
||||
flightState.records.data.get(icao24),
|
||||
);
|
||||
const scale = trackedModelScaleForPixelCap({
|
||||
baseScale: spec.scale,
|
||||
@@ -459,7 +459,7 @@ export function createMotion({
|
||||
parts.rendering._modelOwnsVisual(flightState._trackedIcao)
|
||||
) {
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
return modelVisualAnchor(
|
||||
flightState._trackedModel.modelMatrix,
|
||||
@@ -502,7 +502,7 @@ export function createMotion({
|
||||
)
|
||||
return 0;
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
const scale = Number.isFinite(flightState._trackedModel.computedScale)
|
||||
? flightState._trackedModel.computedScale
|
||||
@@ -519,7 +519,7 @@ export function createMotion({
|
||||
parts.rendering._modelOwnsVisual(flightState._trackedIcao)
|
||||
) {
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
// Through the model's OWN render chain (modelVisualAnchor's hand-rolled
|
||||
// half-correction put this offset on the lateral axis — see
|
||||
|
||||
@@ -58,20 +58,18 @@ export const EMERGENCY_ICON_COLOR =
|
||||
export const GROUND_SCALE = 0.8;
|
||||
|
||||
// --- 3D model rendering (mirrors flights.js) -----------------------------------------
|
||||
// When enabled, military aircraft render as 3D glTF jet models once the camera is below
|
||||
// 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). Distinct asset + amber tint set this layer
|
||||
// apart from the commercial flights layer.
|
||||
|
||||
export const JET_MODEL_URL = '/models/jet.glb';
|
||||
// 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.
|
||||
|
||||
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_MIN_PX = 24;
|
||||
// floor so distant models stay visible without ballooning into a min-pixel blob (mirror of flights.js, whose models now share this layer's ~30 m world size)
|
||||
// floor so distant models stay visible without ballooning into a min-pixel blob (mirror of flights.js)
|
||||
|
||||
export const TRACKED_MODEL_MIN_PX = 40;
|
||||
// keep the glTF silhouette comparable to the selected 2D glyph at handoff
|
||||
@@ -79,17 +77,6 @@ export const TRACKED_MODEL_MIN_PX = 40;
|
||||
export const TRACKED_MODEL_MAX_PX = 200;
|
||||
// owner-selected close-range tracked-target feel
|
||||
|
||||
export const MODEL_NATIVE_RADIUS_M = 29.83;
|
||||
|
||||
// jet.glb is transform-applied at real-world scale — native bounding radius
|
||||
// 29.83 m at scale 1. ×1 → ~22–43 m aircraft across CLASS_SCALE_3D, matching
|
||||
// flights.js world sizes. At the old copied ×24, models rendered
|
||||
// 600–1000 m across (invisible at the ~6 km follow range where minimumPixelSize
|
||||
// dominates, but zoom under ~1 km put the camera INSIDE the plane). Locked by
|
||||
// modelScale.test.mjs.
|
||||
|
||||
export const MODEL_SCALE = 1;
|
||||
|
||||
// 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).
|
||||
|
||||
@@ -119,33 +106,12 @@ export const MODEL_ALL_KEEP_M = 450000;
|
||||
// all: KEEP modeled planes out to 450 km
|
||||
|
||||
export const MODEL_HEADING_OFFSET_DEG = 180;
|
||||
// every aircraft GLB is exported nose -X in the shared transform-applied convention
|
||||
// Preserve the layer's amber identity while reducing approved texture/livery
|
||||
// contribution to a weak diffuse hint, matching civilian launch presentation.
|
||||
// every fleet model is nose -X: opposite Cesium heading 0
|
||||
// Preserve the layer's amber identity while reducing the models' own colours
|
||||
// to a weak diffuse hint, matching civilian launch presentation.
|
||||
|
||||
export const MODEL_COLOR_BLEND_AMOUNT = 0.94;
|
||||
|
||||
// airplane.glb (the shared 747) constants for this layer's heavy classes. The
|
||||
// asset has its former 24× runtime calibration baked into transform-applied
|
||||
// meter-scale geometry; these values mirror flights.js and are regression-pinned.
|
||||
|
||||
export const PLANE_MODEL_URL = '/models/airplane.glb';
|
||||
|
||||
export const PLANE_MODEL_SCALE = 1;
|
||||
|
||||
export const PLANE_NATIVE_RADIUS_M = 34.41;
|
||||
|
||||
export const PLANE_BELLY_OFFSET_NATIVE = 6.719;
|
||||
|
||||
// Grounded-model belly offset: jet.glb's centred origin sits 5.631 native units (= meters — this
|
||||
// asset is real-world scale) ABOVE its lowest vertex (glTF Y-up scene AABB with node
|
||||
// transforms applied — same reader as modelScale.test.mjs, measured 2026-07-03).
|
||||
// × MODEL_SCALE(1) × class multiplier ≈ 4.4–8.6 m of lift, so a ground-snapped model
|
||||
// rests its lowest geometry (gear/belly) ON the sampled tile skin instead of sinking to
|
||||
// the fuselage-centerline origin. Locked against the GLB by modelScale.test.mjs.
|
||||
|
||||
export const MODEL_BELLY_OFFSET_NATIVE = 5.631;
|
||||
|
||||
/** Amber fade target for the tracked billboard once the model takes over (mirrors flights.js CYAN_TRANSPARENT). */
|
||||
|
||||
export const AMBER_TRANSPARENT = MIL_ICON_COLOR.withAlpha(0);
|
||||
|
||||
@@ -484,9 +484,7 @@ export function createQueries({
|
||||
// contacts read the translation the fleet tick already wrote into their
|
||||
// modelMatrix; sprite-owned contacts keep `bb.position`, where sprite and bracket
|
||||
// are co-located anyway.
|
||||
const spec = modelOwnsVisual
|
||||
? parts.rendering._modelSpec(info?.klass)
|
||||
: null;
|
||||
const spec = modelOwnsVisual ? parts.rendering._modelSpec(info) : null;
|
||||
const pos = isTracked
|
||||
? parts.motion._trackedVisualCached() || bb.position
|
||||
: modelOwnsVisual
|
||||
|
||||
@@ -181,6 +181,8 @@ export class MilitaryFlightRecords {
|
||||
newestFixMs: this._noteFix(icao24, prevMeta, fixEpochMs),
|
||||
callsign: stickyText(callsign, prevMeta?.callsign),
|
||||
type: stickyType,
|
||||
// The emitter category, kept for the fleet model a type-less row draws.
|
||||
category: aircraft?.category ?? prevMeta?.category ?? null,
|
||||
// Type outranks category automatically inside classifyAircraft.
|
||||
klass: classifyAircraft({
|
||||
typeCode: stickyType,
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { CLASS_SCALE_2D } from '../../data/aircraftClass.js';
|
||||
import {
|
||||
CLASS_MODEL_REAL,
|
||||
CLASS_SCALE_3D,
|
||||
CLASS_SCALE_2D,
|
||||
} from '../../data/aircraftClass.js';
|
||||
import {
|
||||
visualCenterForModel,
|
||||
trailAnchorForModel,
|
||||
} from '../../data/modelVisualAnchor.js';
|
||||
aircraftLayerModelSpec,
|
||||
aircraftModelSpecCacheKey,
|
||||
} from '../flights/modelSpec.js';
|
||||
import { createFleetModel } from '../../data/fleetModelInstances.js';
|
||||
import * as Cesium from 'cesium';
|
||||
import { selectModelEligible } from '../../data/modelEligibility.js';
|
||||
import { cyberSonarBaseAlpha } from '../../cyberSonar.js';
|
||||
@@ -20,14 +17,6 @@ import {
|
||||
import { limitCourseStep, courseSlewCapDps } from '../../data/motionModel.js';
|
||||
import { isEmergency } from '../../data/aircraftEmergency.js';
|
||||
import {
|
||||
PLANE_MODEL_SCALE,
|
||||
PLANE_MODEL_URL,
|
||||
PLANE_NATIVE_RADIUS_M,
|
||||
PLANE_BELLY_OFFSET_NATIVE,
|
||||
MODEL_SCALE,
|
||||
JET_MODEL_URL,
|
||||
MODEL_NATIVE_RADIUS_M,
|
||||
MODEL_BELLY_OFFSET_NATIVE,
|
||||
MODEL_HEADING_OFFSET_DEG,
|
||||
BILLBOARD_SCALE,
|
||||
GROUND_SCALE,
|
||||
@@ -83,48 +72,20 @@ export function createRendering({
|
||||
return Number.POSITIVE_INFINITY;
|
||||
}
|
||||
|
||||
function _modelSpec(klass) {
|
||||
let spec = flightState._specCache.get(klass);
|
||||
/** The fleet model an aircraft draws with, by its type and emitter category
|
||||
* (shared with flights.js), in this layer's own tint. */
|
||||
function _modelSpec(meta) {
|
||||
const key = aircraftModelSpecCacheKey(meta);
|
||||
let spec = flightState._specCache.get(key);
|
||||
if (spec) return spec;
|
||||
const real = CLASS_MODEL_REAL[klass];
|
||||
if (real) {
|
||||
spec = {
|
||||
url: real.url,
|
||||
scale: 1,
|
||||
nativeRadiusM: real.radiusM,
|
||||
bellyM: real.bellyM,
|
||||
headingOffsetDeg: 180,
|
||||
visualCenterNative: visualCenterForModel(real.url),
|
||||
trailAnchorNative: trailAnchorForModel(real.url),
|
||||
};
|
||||
} else if (
|
||||
klass === 'airliner' ||
|
||||
klass === 'quadjet' ||
|
||||
klass === 'glider'
|
||||
) {
|
||||
const scale = PLANE_MODEL_SCALE * (CLASS_SCALE_3D[klass] || 1);
|
||||
spec = {
|
||||
url: PLANE_MODEL_URL,
|
||||
scale,
|
||||
nativeRadiusM: PLANE_NATIVE_RADIUS_M,
|
||||
bellyM: PLANE_BELLY_OFFSET_NATIVE * scale,
|
||||
headingOffsetDeg: 180,
|
||||
visualCenterNative: visualCenterForModel(PLANE_MODEL_URL),
|
||||
trailAnchorNative: trailAnchorForModel(PLANE_MODEL_URL),
|
||||
};
|
||||
} else {
|
||||
const scale = MODEL_SCALE * (CLASS_SCALE_3D[klass] || 1);
|
||||
spec = {
|
||||
url: JET_MODEL_URL,
|
||||
scale,
|
||||
nativeRadiusM: MODEL_NATIVE_RADIUS_M,
|
||||
bellyM: MODEL_BELLY_OFFSET_NATIVE * scale,
|
||||
headingOffsetDeg: MODEL_HEADING_OFFSET_DEG,
|
||||
visualCenterNative: visualCenterForModel(JET_MODEL_URL),
|
||||
trailAnchorNative: trailAnchorForModel(JET_MODEL_URL),
|
||||
};
|
||||
}
|
||||
flightState._specCache.set(klass, spec);
|
||||
const base = aircraftLayerModelSpec(meta);
|
||||
spec = Object.freeze({
|
||||
...base,
|
||||
blendAmount: MODEL_COLOR_BLEND_AMOUNT,
|
||||
headingOffsetDeg: MODEL_HEADING_OFFSET_DEG,
|
||||
});
|
||||
// Not cached before the model set loads: the answer changes once it has.
|
||||
if (spec.model) flightState._specCache.set(key, spec);
|
||||
return spec;
|
||||
}
|
||||
|
||||
@@ -312,7 +273,7 @@ export function createRendering({
|
||||
Cesium.Ellipsoid.WGS84,
|
||||
flightState._scratchGroundCarto,
|
||||
);
|
||||
carto.height = h + _modelSpec(meta.klass).bellyM;
|
||||
carto.height = h + _modelSpec(meta).bellyM;
|
||||
return Cesium.Cartesian3.fromRadians(
|
||||
carto.longitude,
|
||||
carto.latitude,
|
||||
@@ -350,7 +311,7 @@ export function createRendering({
|
||||
displayPos,
|
||||
course,
|
||||
model.modelMatrix,
|
||||
_modelSpec(flightState.records.data.get(icao24)?.klass).headingOffsetDeg,
|
||||
_modelSpec(flightState.records.data.get(icao24)).headingOffsetDeg,
|
||||
);
|
||||
if (!model.ready) {
|
||||
model.show = false; // not loaded yet → keep the 2D icon, no half-model flash
|
||||
@@ -385,20 +346,17 @@ export function createRendering({
|
||||
return !!model && model.ready === true && model.show === true;
|
||||
}
|
||||
|
||||
/** Spec identity for a LOADED model — mirror of flights.js: URL and scale
|
||||
* together (same-URL classes differ by scale). */
|
||||
/** Spec identity for a LOADED model — mirror of flights.js: the model and
|
||||
* its scale together. */
|
||||
|
||||
const _specKeyFor = (klass) => {
|
||||
const spec = _modelSpec(klass);
|
||||
return `${spec.url}@${spec.scale}`;
|
||||
};
|
||||
const _specKeyFor = (meta) => _modelSpec(meta).key;
|
||||
|
||||
/** Class-change model sync — mirror of flights.js: drop a live model or
|
||||
* in-flight load whose spec no longer matches the class, re-showing the
|
||||
/** Type-change model sync — mirror of flights.js: drop a live model or
|
||||
* in-flight load whose spec no longer matches the type, re-showing the
|
||||
* fleet billboard FIRST (gap-proof) and covering the tracked standalone. */
|
||||
|
||||
function _syncModelToClass(icao24) {
|
||||
const key = _specKeyFor(flightState.records.data.get(icao24)?.klass);
|
||||
const key = _specKeyFor(flightState.records.data.get(icao24));
|
||||
const current = flightState._models.get(icao24);
|
||||
if (
|
||||
(current && current._gevSpecKey !== key) ||
|
||||
@@ -445,6 +403,11 @@ export function createRendering({
|
||||
|
||||
/** Lazily create the glTF model for an aircraft (fire-and-forget; billboard shows until ready). */
|
||||
|
||||
/** A Cesium Model of `spec` from the fleet set loaded up front (no fetch mid-session). */
|
||||
function _createModel(spec, options) {
|
||||
return createFleetModel(spec, options, { resolveAsset });
|
||||
}
|
||||
|
||||
async function _ensureModel(icao24) {
|
||||
// Never model the TRACKED aircraft — it owns a separate entity billboard, and the fleet
|
||||
// tick skips it, so a model here would be orphaned + double-rendered.
|
||||
@@ -461,6 +424,8 @@ export function createRendering({
|
||||
_modelCap()
|
||||
)
|
||||
return;
|
||||
// Until the fleet model set has loaded the aircraft stays a billboard.
|
||||
if (!_modelSpec(flightState.records.data.get(icao24)).model) return;
|
||||
const epoch = flightState._modelEpoch; // lifecycle token: if destroy() bumps it, this load is dead
|
||||
const gen = flightState._modelGen.get(icao24) || 0; // capture; if it changes during the load, we're stale
|
||||
flightState._modelPending.add(icao24);
|
||||
@@ -468,12 +433,11 @@ export function createRendering({
|
||||
// Spec identity captured at load START (mirror of flights.js): a mid-load
|
||||
// reclassification makes the post-await admission reject the stale asset.
|
||||
// Boost state likewise — creation options bake it in.
|
||||
const specKey = _specKeyFor(flightState.records.data.get(icao24)?.klass);
|
||||
const specKey = _specKeyFor(flightState.records.data.get(icao24));
|
||||
const loadIrBoost = flightState._irBoost;
|
||||
try {
|
||||
const spec = _modelSpec(flightState.records.data.get(icao24)?.klass);
|
||||
model = await Cesium.Model.fromGltfAsync({
|
||||
url: resolveAsset(spec.url),
|
||||
const spec = _modelSpec(flightState.records.data.get(icao24));
|
||||
model = await _createModel(spec, {
|
||||
asynchronous: false,
|
||||
environmentMapOptions: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS,
|
||||
minimumPixelSize: MODEL_MIN_PX,
|
||||
@@ -522,7 +486,7 @@ export function createRendering({
|
||||
flightState._models.has(icao24) ||
|
||||
flightState._models.size >= _modelCap() ||
|
||||
// Class reclassified mid-load → this GLB/scale is for the OLD class.
|
||||
_specKeyFor(flightState.records.data.get(icao24)?.klass) !== specKey ||
|
||||
_specKeyFor(flightState.records.data.get(icao24)) !== specKey ||
|
||||
// IR boost flipped mid-load → this model baked the wrong shader/tint.
|
||||
flightState._irBoost !== loadIrBoost;
|
||||
if (stale) {
|
||||
@@ -676,6 +640,9 @@ export function createRendering({
|
||||
return;
|
||||
}
|
||||
if (
|
||||
// Until the fleet model set has loaded the billboard carries it.
|
||||
_modelSpec(flightState.records.data.get(flightState._trackedIcao))
|
||||
.model &&
|
||||
!flightState._trackedModel &&
|
||||
!flightState._trackedModelLoading &&
|
||||
parts.tracking._trackedModelLoadAllowed()
|
||||
@@ -683,14 +650,13 @@ export function createRendering({
|
||||
flightState._trackedModelLoading = true;
|
||||
const gen = flightState._trackedModelGen;
|
||||
const trackedSpec = _modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
const trackedKey = _specKeyFor(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
const trackedIrBoost = flightState._irBoost;
|
||||
Cesium.Model.fromGltfAsync({
|
||||
url: resolveAsset(trackedSpec.url),
|
||||
_createModel(trackedSpec, {
|
||||
asynchronous: false,
|
||||
environmentMapOptions: AIRCRAFT_ENVIRONMENT_MAP_OPTIONS,
|
||||
minimumPixelSize: TRACKED_MODEL_MIN_PX,
|
||||
@@ -724,7 +690,7 @@ export function createRendering({
|
||||
// _trackedModel was still null): drop the stale asset; driver reloads.
|
||||
if (
|
||||
_specKeyFor(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
) !== trackedKey ||
|
||||
flightState._irBoost !== trackedIrBoost
|
||||
) {
|
||||
@@ -793,7 +759,7 @@ export function createRendering({
|
||||
return;
|
||||
}
|
||||
const spec = _modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao),
|
||||
);
|
||||
_modelMatrix(
|
||||
displayPos,
|
||||
|
||||
@@ -164,10 +164,15 @@ export function createMilitarySnapshotRenderer({
|
||||
) {
|
||||
rendering._applyFleetBillboardPresentation(icao24, bb);
|
||||
}
|
||||
// Per-class GLBs: a class change can mean a different asset OR scale —
|
||||
// resync the live model, any in-flight load, and the tracked
|
||||
// standalone (mirror of flights.js).
|
||||
if (prevMeta?.klass !== meta.klass) rendering._syncModelToClass(icao24);
|
||||
// Per-type fleet models: a type or category change can mean a
|
||||
// different model OR scale — resync the live model, any in-flight
|
||||
// load, and the tracked standalone (mirror of flights.js).
|
||||
if (
|
||||
prevMeta?.klass !== meta.klass ||
|
||||
prevMeta?.type !== meta.type ||
|
||||
prevMeta?.category !== meta.category
|
||||
)
|
||||
rendering._syncModelToClass(icao24);
|
||||
// Round 5: depth policy is uniform (always depth-test-free, see
|
||||
// _groundDepthDistance) — nothing to flip on landing/takeoff.
|
||||
} else {
|
||||
|
||||
@@ -19,15 +19,13 @@ export function createFlightState({ source, services }) {
|
||||
* layer); see followsClock and displayDelayMs in policy.js. */
|
||||
flightState.timeline = null;
|
||||
|
||||
/** Per-class model spec for THIS layer (2026-08-16, owner playtest ask:
|
||||
* military contacts should read as their WEIGHT CLASS, always in this layer's
|
||||
* amber). Real Hangar GLBs serve the classes they cover (meters, nose −X →
|
||||
* 180° offset); airliner/quadjet/glider get the shared 747 silhouette
|
||||
* (airplane.glb — C-5M/RC-135-style heavies stop rendering as bizjets);
|
||||
* fastjet and unknown keep jet.glb with the same 180° offset. The MIX tint stays
|
||||
* dominant everywhere — military is amber, tracked is TRACKED_ICON_COLOR,
|
||||
* and the tint must dominate any livery (owner: "stays yellow"). Specs are
|
||||
* static per class — memoized (the fleet pass asks at 12 Hz per model). */
|
||||
/** Model spec per aircraft type and emitter category (aircraftLayerModelSpec in
|
||||
* flights/modelSpec.js): the procedural fleet model that draws the type, life size,
|
||||
* with its measured clearance, bounding radius and trail anchor. nativeRadiusM is PER
|
||||
* SCALE UNIT — pixel-cap math multiplies it by `scale`. The code-side MIX tint dominates
|
||||
* every model so silhouettes stay light (and in this layer's own colour). Memoized: the
|
||||
* detection weld asks for one per MODELED contact per frame on top of the 12 Hz fleet
|
||||
* pass. */
|
||||
|
||||
flightState._specCache = new Map();
|
||||
|
||||
@@ -76,16 +74,11 @@ export function createFlightState({ source, services }) {
|
||||
// throttle the "more planes in view than the cap" console notice
|
||||
// The tracked entity's billboard goes transparent (rather than hidden) once the model takes
|
||||
// over, so it keeps supplying a bounding sphere for follow-camera framing. We only drop its
|
||||
// alpha after the GLB is preloaded so the model is ready to render the instant the billboard
|
||||
// fades — no gap, no double-image. Preloaded once at init; the instance is retained (not
|
||||
// destroyed) purely to keep Cesium's glTF cache warm for fast tracked-model instantiation.
|
||||
// alpha after the fleet model set is loaded so the model is ready to render the instant the
|
||||
// billboard fades — no gap, no double-image. The set loads once at init (fleetModels.js).
|
||||
|
||||
flightState._planeModelLoaded = false;
|
||||
|
||||
/** @type {Cesium.Model|null} retained preload that keeps the glTF cache warm */
|
||||
|
||||
flightState._preloadModel = null;
|
||||
|
||||
flightState._scratchModelHpr = new Cesium.HeadingPitchRoll(0, 0, 0);
|
||||
|
||||
flightState._scratchModelMtx = new Cesium.Matrix4();
|
||||
|
||||
@@ -95,6 +95,7 @@ export function createLifecycle({ state, services, parts, timetable }) {
|
||||
parts.rendering.onPreRender,
|
||||
);
|
||||
state._networkFade = -1;
|
||||
parts.rendering.startModels();
|
||||
parts.viewport.loadCatalog();
|
||||
parts.viewport.runProximityCheck();
|
||||
restoreSpriteOrder(viewer);
|
||||
@@ -129,6 +130,7 @@ export function createLifecycle({ state, services, parts, timetable }) {
|
||||
state._cockpitLostFeedId = null;
|
||||
state._feedStatus.clear();
|
||||
dropAllTrains();
|
||||
parts.rendering.stopModels();
|
||||
// Floor cells and track samples queued for trains now gone.
|
||||
parts.rendering.reset();
|
||||
parts.routes.hideAll();
|
||||
@@ -156,6 +158,7 @@ export function createLifecycle({ state, services, parts, timetable }) {
|
||||
/** Tear down the collection and release every shared registration. */
|
||||
destroy(viewer) {
|
||||
this.disable(viewer);
|
||||
parts.rendering.stopModels(true);
|
||||
parts.routes.destroy();
|
||||
if (state._markers) {
|
||||
unregisterSpriteCollection('rail', state._markers);
|
||||
|
||||
@@ -26,6 +26,22 @@ import {
|
||||
UNSELECTED_TRAIN_ALPHA,
|
||||
} from './policy.js';
|
||||
import { placeOnPath } from './pathBinding.js';
|
||||
import {
|
||||
fleetModelSet,
|
||||
loadFleetModelSet,
|
||||
transitModelSpec,
|
||||
} from '../../data/fleetModels.js';
|
||||
import { createFleetModelLayer } from '../../data/fleetModelInstances.js';
|
||||
|
||||
/** How often the trains near enough for a model are gathered again (wall ms). */
|
||||
const MODEL_CANDIDATES_MS = 500;
|
||||
/** Each category's colour, painted where a train model marks it. */
|
||||
const CATEGORY_TINTS = Object.fromEntries(
|
||||
Object.entries(RAIL_CATEGORY_COLORS).map(([category, css]) => [
|
||||
category,
|
||||
Cesium.Color.fromCssColorString(css),
|
||||
]),
|
||||
);
|
||||
|
||||
const SPRITE_PX = 64;
|
||||
/** Billboard tints; the setter copies, so sharing one instance is safe. */
|
||||
@@ -508,12 +524,16 @@ export function createRendering({ state, services, parts }) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the train's marker shows: its category is on, and no
|
||||
* Whether a train's icon is drawn: shown, not drawn by its model, and no
|
||||
* first-person view rides it (cockpitSubject.js). A held train keeps its
|
||||
* playback; only its marker hides.
|
||||
* playback; only its icon hides.
|
||||
*/
|
||||
function markerShown(entry) {
|
||||
return categoryShown(entry) && entry.key !== state._cockpitSubjectKey;
|
||||
return (
|
||||
categoryShown(entry) &&
|
||||
!entry.modelOwnsVisual &&
|
||||
entry.key !== state._cockpitSubjectKey
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -683,6 +703,132 @@ export function createRendering({ state, services, parts }) {
|
||||
function onPreRender() {
|
||||
advanceMoving();
|
||||
if (state._enabled && state._selectedKey !== null) cullSelected();
|
||||
if (state._enabled) updateModels();
|
||||
}
|
||||
|
||||
// Under the DISPLAY rail's 3D toggle, trains near the camera are drawn as
|
||||
// the project's procedural fleet models, chosen by category and mode,
|
||||
// painted in their category colour where the model marks it, on the
|
||||
// aircraft layers' icon-to-model rules (services.fleet). The fleet set
|
||||
// loads once, up front, when the layer starts.
|
||||
let fleetModels = null;
|
||||
/** Items drawn last frame, and the map the next frame's are gathered into. */
|
||||
let modelItems = new Map();
|
||||
let spareItems = new Map();
|
||||
let modelCandidatesAtMs = -Infinity;
|
||||
|
||||
/** Load the fleet set and create the layer's models (on enable). */
|
||||
function startModels() {
|
||||
const fleet = services.fleet;
|
||||
if (!fleet?.policy || !state._viewer) return;
|
||||
loadFleetModelSet({ resolveAsset: fleet.resolveAsset }).catch(() => {
|
||||
/* models stay off; trains keep their icons */
|
||||
});
|
||||
fleetModels ||= createFleetModelLayer({
|
||||
viewer: state._viewer,
|
||||
display: fleet.display,
|
||||
policy: fleet.policy,
|
||||
resolveAsset: fleet.resolveAsset,
|
||||
});
|
||||
}
|
||||
|
||||
/** Hand a train's visual back to its icon. */
|
||||
function handBack(entry) {
|
||||
if (!entry.modelOwnsVisual) return;
|
||||
entry.modelOwnsVisual = false;
|
||||
if (entry.marker) entry.marker.show = markerShown(entry);
|
||||
}
|
||||
|
||||
function modelItem(entry, set) {
|
||||
let item = modelItems.get(entry.key);
|
||||
if (!item || item.entry !== entry)
|
||||
item = {
|
||||
entry,
|
||||
pickId: entry.key,
|
||||
modelOwnsVisual: false,
|
||||
// Markers are drawn this far above the track; a model stands on it.
|
||||
groundLiftM: GROUND_FLOOR_LIFT_M,
|
||||
};
|
||||
const specKey = `${entry.category}|${entry.railMode}`;
|
||||
if (item.specKey !== specKey) {
|
||||
item.specKey = specKey;
|
||||
item.spec = transitModelSpec(set, {
|
||||
railCategory: entry.category,
|
||||
railMode: entry.railMode,
|
||||
});
|
||||
item.tint = CATEGORY_TINTS[entry.category] || CATEGORY_TINTS.local;
|
||||
}
|
||||
item.position = entry.marker.position;
|
||||
item.headingDeg = Number.isFinite(entry.courseDeg) ? entry.courseDeg : 0;
|
||||
item.show = categoryShown(entry);
|
||||
return item;
|
||||
}
|
||||
|
||||
function updateModels() {
|
||||
if (!fleetModels) return;
|
||||
if (!fleetModels.active() || state._trains.size === 0) {
|
||||
if (modelItems.size) {
|
||||
for (const item of modelItems.values()) handBack(item.entry);
|
||||
modelItems.clear();
|
||||
fleetModels.frame(modelItems, performance.now());
|
||||
}
|
||||
return;
|
||||
}
|
||||
const set = fleetModelSet();
|
||||
const now = performance.now();
|
||||
const next = spareItems;
|
||||
next.clear();
|
||||
if (now - modelCandidatesAtMs >= MODEL_CANDIDATES_MS) {
|
||||
modelCandidatesAtMs = now;
|
||||
const camera = state._viewer?.camera;
|
||||
const policy = services.fleet.policy;
|
||||
const keepM =
|
||||
services.fleet.display?.()?.models3dMode === 'all'
|
||||
? policy.keepAllM
|
||||
: policy.keepM;
|
||||
const limitSq = keepM * keepM * 1.44;
|
||||
if (camera?.positionWC)
|
||||
for (const entry of state._trains.values()) {
|
||||
if (!entry.marker || !categoryShown(entry)) continue;
|
||||
if (
|
||||
Cesium.Cartesian3.distanceSquared(
|
||||
camera.positionWC,
|
||||
entry.marker.position,
|
||||
) > limitSq
|
||||
)
|
||||
continue;
|
||||
next.set(entry.key, modelItem(entry, set));
|
||||
}
|
||||
} else {
|
||||
for (const [key, item] of modelItems)
|
||||
if (state._trains.get(key) === item.entry && item.entry.marker)
|
||||
next.set(key, modelItem(item.entry, set));
|
||||
}
|
||||
for (const [key, item] of modelItems)
|
||||
if (next.get(key) !== item) handBack(item.entry);
|
||||
spareItems = modelItems;
|
||||
modelItems = next;
|
||||
fleetModels.frame(modelItems, now);
|
||||
for (const item of modelItems.values()) {
|
||||
const entry = item.entry;
|
||||
if (item.modelOwnsVisual) {
|
||||
entry.modelOwnsVisual = true;
|
||||
entry.marker.show = false;
|
||||
} else handBack(entry);
|
||||
}
|
||||
if (fleetModels.settling) governorRequestRender('rail-models');
|
||||
}
|
||||
|
||||
/** Drop every model (layer disabled); `destroy` also removes the collection. */
|
||||
function stopModels(destroy = false) {
|
||||
for (const item of modelItems.values()) item.entry.modelOwnsVisual = false;
|
||||
modelItems.clear();
|
||||
spareItems.clear();
|
||||
modelCandidatesAtMs = -Infinity;
|
||||
if (destroy) {
|
||||
fleetModels?.destroy();
|
||||
fleetModels = null;
|
||||
} else fleetModels?.clear();
|
||||
}
|
||||
|
||||
function advanceMoving() {
|
||||
@@ -737,5 +883,7 @@ export function createRendering({ state, services, parts }) {
|
||||
applyCategoryVisibility,
|
||||
categoryShown,
|
||||
reset,
|
||||
startModels,
|
||||
stopModels,
|
||||
};
|
||||
}
|
||||
@@ -19,10 +19,15 @@ import { t } from '../../i18n/index.js';
|
||||
export function createSelection({ state, services, parts }) {
|
||||
const { governorRequestRender } = services.render;
|
||||
|
||||
/** The card's anchor: the marker's current position, read on every paint. */
|
||||
/**
|
||||
* The card's anchor: the marker's current position, read on every paint,
|
||||
* whether the train is drawn as its marker or as its 3D model.
|
||||
*/
|
||||
function anchorFor(entry) {
|
||||
return () => {
|
||||
const p = entry.marker?.show !== false ? entry.marker?.position : null;
|
||||
const drawn =
|
||||
entry.marker?.show !== false || entry.modelOwnsVisual === true;
|
||||
const p = drawn ? entry.marker?.position : null;
|
||||
return p && Number.isFinite(p.x) && Number.isFinite(p.y) ? p : null;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -196,6 +196,7 @@ export function createLifecycle({ state, services, parts }) {
|
||||
parts.rendering.onPreRender,
|
||||
);
|
||||
}
|
||||
parts.rendering.startModels();
|
||||
parts.viewport.runProximityCheck();
|
||||
restoreSpriteOrder(viewer);
|
||||
},
|
||||
@@ -243,6 +244,7 @@ export function createLifecycle({ state, services, parts }) {
|
||||
destroyTrack(entry.track);
|
||||
}
|
||||
state._vehicles.clear();
|
||||
parts.rendering.stopModels();
|
||||
parts.height.clear();
|
||||
state._markers?.removeAll();
|
||||
state._animatedMarkers?.removeAll();
|
||||
@@ -283,6 +285,7 @@ export function createLifecycle({ state, services, parts }) {
|
||||
*/
|
||||
destroy(viewer) {
|
||||
this.disable(viewer);
|
||||
parts.rendering.stopModels(true);
|
||||
if (state._markers) {
|
||||
unregisterSpriteCollection('transit', state._markers);
|
||||
viewer?.scene?.primitives?.remove(state._markers);
|
||||
|
||||
@@ -129,7 +129,9 @@ export function createQueries({ state, parts }) {
|
||||
const visible = [];
|
||||
for (const entry of state._visible) {
|
||||
const marker = entry.marker;
|
||||
if (!marker?.position || marker.show === false) continue;
|
||||
// A vehicle drawn as its 3D model is present though its marker is hidden.
|
||||
if (!marker?.position) continue;
|
||||
if (marker.show === false && entry.modelOwnsVisual !== true) continue;
|
||||
visible.push(entry);
|
||||
}
|
||||
let chosen = visible;
|
||||
|
||||
@@ -27,6 +27,12 @@ import {
|
||||
TRANSIT_MODE_COLORS,
|
||||
vehicleNearView,
|
||||
} from './policy.js';
|
||||
import {
|
||||
fleetModelSet,
|
||||
loadFleetModelSet,
|
||||
transitModelSpec,
|
||||
} from '../../data/fleetModels.js';
|
||||
import { createFleetModelLayer } from '../../data/fleetModelInstances.js';
|
||||
|
||||
export const MODE_CESIUM_COLORS = Object.fromEntries(
|
||||
Object.entries(TRANSIT_MODE_COLORS).map(([mode, css]) => [
|
||||
@@ -102,7 +108,10 @@ export function createRendering({ state, services, parts }) {
|
||||
entry.heightPending = !known;
|
||||
// A vehicle a first-person view rides keeps moving, unseen.
|
||||
entry.marker.show =
|
||||
!!known && vehicleInView(entry) && entry.key !== state._cockpitSubjectKey;
|
||||
!!known &&
|
||||
vehicleInView(entry) &&
|
||||
!entry.modelOwnsVisual &&
|
||||
entry.key !== state._cockpitSubjectKey;
|
||||
if (known) {
|
||||
entry.marker.position = state._scratchCartesian;
|
||||
entry.hasRendered = true;
|
||||
@@ -405,6 +414,7 @@ export function createRendering({ state, services, parts }) {
|
||||
const now = state.now();
|
||||
if (state._vehicles.size === 0) {
|
||||
state._moving.clear();
|
||||
updateModels();
|
||||
syncRenderHold();
|
||||
return;
|
||||
}
|
||||
@@ -452,9 +462,111 @@ export function createRendering({ state, services, parts }) {
|
||||
: 0;
|
||||
}
|
||||
if (state._heightDirty.size) governorRequestRender('transit-height-batch');
|
||||
updateModels();
|
||||
syncRenderHold();
|
||||
}
|
||||
|
||||
// Under the DISPLAY rail's 3D toggle, vehicles in view near the camera are
|
||||
// drawn as the project's procedural fleet models, chosen by mode, painted
|
||||
// in their mode colour where the model marks it, on the aircraft layers'
|
||||
// icon-to-model rules (services.fleet). The fleet set loads once, up front,
|
||||
// when the layer starts.
|
||||
let fleetModels = null;
|
||||
/** Items drawn last frame, and the map the next frame's are gathered into. */
|
||||
let modelItems = new Map();
|
||||
let spareItems = new Map();
|
||||
/** The lift icons are drawn with above the floor; a model stands on the floor. */
|
||||
const groundLiftM = services.ground?.GROUND_FLOOR_LIFT_M || 0;
|
||||
|
||||
/** Load the fleet set and create the layer's models (on enable). */
|
||||
function startModels() {
|
||||
const fleet = services.fleet;
|
||||
if (!fleet?.policy || !state._viewer) return;
|
||||
loadFleetModelSet({ resolveAsset: fleet.resolveAsset }).catch(() => {
|
||||
/* models stay off; vehicles keep their icons */
|
||||
});
|
||||
fleetModels ||= createFleetModelLayer({
|
||||
viewer: state._viewer,
|
||||
display: fleet.display,
|
||||
policy: fleet.policy,
|
||||
resolveAsset: fleet.resolveAsset,
|
||||
});
|
||||
}
|
||||
|
||||
/** Hand an entry's visual back to its icon. */
|
||||
function handBack(entry) {
|
||||
if (!entry.modelOwnsVisual) return;
|
||||
entry.modelOwnsVisual = false;
|
||||
if (entry.marker)
|
||||
entry.marker.show =
|
||||
vehicleInView(entry) &&
|
||||
!entry.heightPending &&
|
||||
entry.surfaceReady !== false;
|
||||
}
|
||||
|
||||
function updateModels() {
|
||||
if (!fleetModels) return;
|
||||
if (!fleetModels.active() || state._vehicles.size === 0) {
|
||||
if (modelItems.size) {
|
||||
for (const item of modelItems.values()) handBack(item.entry);
|
||||
modelItems.clear();
|
||||
fleetModels.frame(modelItems, performance.now());
|
||||
}
|
||||
return;
|
||||
}
|
||||
const set = fleetModelSet();
|
||||
const next = spareItems;
|
||||
next.clear();
|
||||
for (const entry of state._visible) {
|
||||
// A vehicle of no known mode keeps its icon: no model says what it is.
|
||||
if (!entry.marker || !entry.hasRendered || entry.mode === 'unknown')
|
||||
continue;
|
||||
let item = modelItems.get(entry.key);
|
||||
if (!item || item.entry !== entry) {
|
||||
item = {
|
||||
entry,
|
||||
pickId: entry.key,
|
||||
modelOwnsVisual: false,
|
||||
groundLiftM,
|
||||
};
|
||||
}
|
||||
if (item.mode !== entry.mode) {
|
||||
item.mode = entry.mode;
|
||||
item.spec = transitModelSpec(set, { mode: entry.mode });
|
||||
item.tint =
|
||||
MODE_CESIUM_COLORS[entry.mode] || MODE_CESIUM_COLORS.unknown;
|
||||
}
|
||||
item.position = entry.marker.position;
|
||||
item.headingDeg = Number.isFinite(entry.courseDeg) ? entry.courseDeg : 0;
|
||||
item.show = !entry.heightPending && entry.surfaceReady !== false;
|
||||
next.set(entry.key, item);
|
||||
}
|
||||
for (const [key, item] of modelItems)
|
||||
if (next.get(key) !== item) handBack(item.entry);
|
||||
spareItems = modelItems;
|
||||
modelItems = next;
|
||||
fleetModels.frame(modelItems, performance.now());
|
||||
for (const item of modelItems.values()) {
|
||||
const entry = item.entry;
|
||||
if (item.modelOwnsVisual) {
|
||||
entry.modelOwnsVisual = true;
|
||||
entry.marker.show = false;
|
||||
} else handBack(entry);
|
||||
}
|
||||
if (fleetModels.settling) governorRequestRender('transit-models');
|
||||
}
|
||||
|
||||
/** Drop every model (layer disabled); `destroy` also removes the collection. */
|
||||
function stopModels(destroy = false) {
|
||||
for (const item of modelItems.values()) item.entry.modelOwnsVisual = false;
|
||||
modelItems.clear();
|
||||
spareItems.clear();
|
||||
if (destroy) {
|
||||
fleetModels?.destroy();
|
||||
fleetModels = null;
|
||||
} else fleetModels?.clear();
|
||||
}
|
||||
|
||||
const occluder = new Cesium.EllipsoidalOccluder(Cesium.Ellipsoid.WGS84);
|
||||
const sphere = new Cesium.BoundingSphere(undefined, 5);
|
||||
const cameraPosition = new Cesium.Cartesian3();
|
||||
@@ -564,7 +676,8 @@ export function createRendering({ state, services, parts }) {
|
||||
!held &&
|
||||
visible &&
|
||||
!entry.heightPending &&
|
||||
entry.surfaceReady !== false;
|
||||
entry.surfaceReady !== false &&
|
||||
!entry.modelOwnsVisual;
|
||||
visibility.heightPending = !!entry.heightPending;
|
||||
visibility.surfaceReady = entry.surfaceReady ?? null;
|
||||
schedulePlayback(entry);
|
||||
@@ -629,5 +742,7 @@ export function createRendering({ state, services, parts }) {
|
||||
setStylePreset,
|
||||
onPreRender,
|
||||
syncRenderHold,
|
||||
startModels,
|
||||
stopModels,
|
||||
};
|
||||
}
|
||||
@@ -24,14 +24,16 @@ export function createSelection({ state, services, parts }) {
|
||||
* (the tracked-aircraft readout uses the same), so the anchor moves with the
|
||||
* sprite at frame rate, through poll arrivals, settling, a late floor and a
|
||||
* reset alike, with no per-frame work here. Null when there is nothing to
|
||||
* anchor to: a hidden or removed marker draws no card.
|
||||
* anchor to: a hidden or removed marker draws no card, unless the vehicle's
|
||||
* 3D model is drawing it in the marker's place.
|
||||
* @param {object} entry
|
||||
* @returns {() => Cesium.Cartesian3|null}
|
||||
*/
|
||||
function anchorFor(entry) {
|
||||
return () => {
|
||||
const marker = entry.marker;
|
||||
const p = marker?.show !== false ? marker?.position : null;
|
||||
const drawn = marker?.show !== false || entry.modelOwnsVisual === true;
|
||||
const p = drawn ? marker?.position : null;
|
||||
return p &&
|
||||
Number.isFinite(p.x) &&
|
||||
Number.isFinite(p.y) &&
|
||||
|
||||
@@ -213,6 +213,8 @@ export function createIngestion({
|
||||
imo: record.imo,
|
||||
type: record.type,
|
||||
destination: record.destination,
|
||||
length: record.lengthM ?? null,
|
||||
beam: record.beamM ?? null,
|
||||
speed: record.speedMps == null ? null : record.speedMps / 0.514444,
|
||||
course: record.courseDeg,
|
||||
heading: record.headingDeg,
|
||||
|
||||
@@ -248,6 +248,7 @@ export function createLifecycle({
|
||||
if (state.preRenderRemover) {
|
||||
state.preRenderRemover();
|
||||
}
|
||||
components.rendering.destroyModels();
|
||||
resetState();
|
||||
},
|
||||
};
|
||||
|
||||
@@ -664,7 +664,13 @@ export function createQueries({
|
||||
if ((idx - start) % stride !== 0) continue;
|
||||
const record = records[idx];
|
||||
const visual = components.rendering.getVisual(record);
|
||||
if (visual.billboard && !visual.billboard.show) continue;
|
||||
// A vessel drawn as its model is present though its chevron is hidden.
|
||||
if (
|
||||
visual.billboard &&
|
||||
!visual.billboard.show &&
|
||||
!visual.modelOwnsVisual
|
||||
)
|
||||
continue;
|
||||
const position = visual.billboard?.position || visual.position;
|
||||
if (!position) continue;
|
||||
result.push({
|
||||
|
||||
@@ -25,6 +25,9 @@ export function normalizeVessel(row) {
|
||||
imo: String(row.imo || ''),
|
||||
type: String(row.type || ''),
|
||||
destination: String(row.destination || ''),
|
||||
// Hull length and beam (metres), null when unreported.
|
||||
length: positiveNumber(row.length),
|
||||
beam: positiveNumber(row.beam),
|
||||
speed: finiteNumber(row.speed),
|
||||
course: finiteNumber(row.course),
|
||||
heading: finiteNumber(row.heading),
|
||||
@@ -46,6 +49,11 @@ function stampFix(record, receivedAtMs, feedLatestEpoch) {
|
||||
record.fixFeedEpoch = feedLatestEpoch;
|
||||
}
|
||||
|
||||
function positiveNumber(value) {
|
||||
const number = finiteNumber(value);
|
||||
return number !== null && number > 0 ? number : null;
|
||||
}
|
||||
|
||||
function finiteNumber(value) {
|
||||
if (value === null || value === undefined || value === '') return null;
|
||||
const number = Number(value);
|
||||
@@ -147,6 +155,8 @@ export class VesselRecords {
|
||||
record.imo = next.imo;
|
||||
record.type = next.type;
|
||||
record.destination = next.destination;
|
||||
record.length = next.length;
|
||||
record.beam = next.beam;
|
||||
record.speed = next.speed;
|
||||
record.course = next.course;
|
||||
record.heading = next.heading;
|
||||
|
||||
@@ -22,10 +22,19 @@ import {
|
||||
followsClock,
|
||||
} from './policy.js';
|
||||
import { vesselPositionAt } from './motion.js';
|
||||
import {
|
||||
fleetModelSet,
|
||||
loadFleetModelSet,
|
||||
vesselModelSpec,
|
||||
} from '../../data/fleetModels.js';
|
||||
import { createFleetModelLayer } from '../../data/fleetModelInstances.js';
|
||||
|
||||
/** How often vessels move on as the world clock plays (wall ms). */
|
||||
const FOLLOW_POSITION_MS = 250;
|
||||
|
||||
/** How often the vessels near enough for a model are gathered again (wall ms). */
|
||||
const MODEL_CANDIDATES_MS = 500;
|
||||
|
||||
export function createRendering({
|
||||
vesselState,
|
||||
services,
|
||||
@@ -56,6 +65,12 @@ export function createRendering({
|
||||
VESSEL_LIFT_M,
|
||||
);
|
||||
visual.position = Cesium.Cartesian3.fromDegrees(lon, lat, heightM);
|
||||
// A ship model's origin is its waterline: the sea surface, unlifted.
|
||||
visual.waterline = Cesium.Cartesian3.fromDegrees(
|
||||
lon,
|
||||
lat,
|
||||
heightM - VESSEL_LIFT_M,
|
||||
);
|
||||
visual.surfacePosition = Cesium.Cartesian3.fromDegrees(lon, lat, 0);
|
||||
visual.normal = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(
|
||||
visual.position,
|
||||
@@ -101,6 +116,7 @@ export function createRendering({
|
||||
}
|
||||
|
||||
function ensureCollections(viewer) {
|
||||
ensureModels(viewer);
|
||||
if (!viewer || state.billboardCollection) return;
|
||||
state.billboardCollection = new Cesium.BillboardCollection({
|
||||
blendOption: Cesium.BlendOption.TRANSLUCENT,
|
||||
@@ -203,6 +219,143 @@ export function createRendering({
|
||||
return icon;
|
||||
}
|
||||
|
||||
// Under the DISPLAY rail's 3D toggle, vessels near the camera are drawn as
|
||||
// the project's procedural fleet models at their reported length and beam,
|
||||
// on the aircraft layers' icon-to-model rules (services.fleet). The fleet
|
||||
// set loads once, up front, when the layer starts.
|
||||
let fleetModels = null;
|
||||
/** Items drawn last frame, and the map the next frame's are gathered into. */
|
||||
let modelItems = new Map();
|
||||
let spareItems = new Map();
|
||||
let modelCandidatesAtMs = -Infinity;
|
||||
const modelOccluder = new Cesium.EllipsoidalOccluder(Cesium.Ellipsoid.WGS84);
|
||||
|
||||
function ensureModels(viewer) {
|
||||
const fleet = services.fleet;
|
||||
if (!viewer || fleetModels || !fleet?.policy) return;
|
||||
loadFleetModelSet({ resolveAsset: fleet.resolveAsset }).catch(() => {
|
||||
/* models stay off; vessels keep their icons */
|
||||
});
|
||||
fleetModels = createFleetModelLayer({
|
||||
viewer,
|
||||
display: fleet.display,
|
||||
policy: fleet.policy,
|
||||
resolveAsset: fleet.resolveAsset,
|
||||
// A hull below the waterline would show through a plain globe.
|
||||
waterline: true,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a vessel's chevron is drawn: on the camera's side of the Earth,
|
||||
* not the bridge camera's own vessel, and not drawn by its model. The
|
||||
* visibility pass and the model handoff both decide by this.
|
||||
*/
|
||||
function billboardShown(record, occluder) {
|
||||
const visual = getVisual(record);
|
||||
return (
|
||||
isVisible(visual.surfacePosition, occluder) &&
|
||||
record.id !== state.cockpitSubjectId &&
|
||||
!visual.modelOwnsVisual
|
||||
);
|
||||
}
|
||||
|
||||
/** The model item for `record`, its spec rebuilt only when its type or size changes. */
|
||||
function modelItem(record, set) {
|
||||
let item = modelItems.get(record.id);
|
||||
if (!item || item.record !== record)
|
||||
item = { record, pickId: record, tint: null, modelOwnsVisual: false };
|
||||
const specKey = `${record.type}|${record.length}|${record.beam}|${record.name}`;
|
||||
if (item.specKey !== specKey) {
|
||||
item.specKey = specKey;
|
||||
item.spec = vesselModelSpec(set, record);
|
||||
}
|
||||
item.position = getVisual(record).waterline;
|
||||
item.headingDeg = vesselCourseDeg(record);
|
||||
item.show = record.id !== state.cockpitSubjectId;
|
||||
return item;
|
||||
}
|
||||
|
||||
/** Gather the vessels within the models' keep radius of the camera into `into`. */
|
||||
function gatherModelItems(set, into) {
|
||||
const camera = state.viewer?.camera;
|
||||
if (!camera?.positionWC) return;
|
||||
const policy = services.fleet.policy;
|
||||
const keepM =
|
||||
services.fleet.display?.()?.models3dMode === 'all'
|
||||
? policy.keepAllM
|
||||
: policy.keepM;
|
||||
const limitSq = keepM * keepM * 1.44;
|
||||
for (const record of state.records.all) {
|
||||
const waterline = getVisual(record).waterline;
|
||||
if (!waterline) continue;
|
||||
if (
|
||||
Cesium.Cartesian3.distanceSquared(camera.positionWC, waterline) >
|
||||
limitSq
|
||||
)
|
||||
continue;
|
||||
into.set(record.id, modelItem(record, set));
|
||||
}
|
||||
}
|
||||
|
||||
/** Give a vessel's chevron back when its model no longer draws it. */
|
||||
function handBackVisual(record, occluder) {
|
||||
const visual = getVisual(record);
|
||||
if (!visual.modelOwnsVisual) return;
|
||||
visual.modelOwnsVisual = false;
|
||||
if (visual.billboard)
|
||||
visual.billboard.show = billboardShown(record, occluder);
|
||||
}
|
||||
|
||||
function updateModels() {
|
||||
if (!fleetModels) return;
|
||||
const camera = state.viewer?.camera;
|
||||
const occluder = camera?.positionWC ? modelOccluder : null;
|
||||
if (occluder) occluder.cameraPosition = camera.positionWC;
|
||||
if (!fleetModels.active()) {
|
||||
if (modelItems.size) {
|
||||
modelItems.clear();
|
||||
fleetModels.frame(modelItems, performance.now());
|
||||
for (const record of state.records.all)
|
||||
handBackVisual(record, occluder);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const set = fleetModelSet();
|
||||
const now = performance.now();
|
||||
const next = spareItems;
|
||||
next.clear();
|
||||
if (now - modelCandidatesAtMs >= MODEL_CANDIDATES_MS) {
|
||||
modelCandidatesAtMs = now;
|
||||
gatherModelItems(set, next);
|
||||
} else {
|
||||
for (const [id, item] of modelItems)
|
||||
if (state.records.byId.get(id) === item.record)
|
||||
next.set(id, modelItem(item.record, set));
|
||||
}
|
||||
for (const [id, item] of modelItems)
|
||||
if (next.get(id) !== item) handBackVisual(item.record, occluder);
|
||||
spareItems = modelItems;
|
||||
modelItems = next;
|
||||
fleetModels.frame(modelItems, now);
|
||||
for (const item of modelItems.values()) {
|
||||
const visual = getVisual(item.record);
|
||||
if (item.modelOwnsVisual) {
|
||||
visual.modelOwnsVisual = true;
|
||||
if (visual.billboard) visual.billboard.show = false;
|
||||
} else handBackVisual(item.record, occluder);
|
||||
}
|
||||
if (fleetModels.settling) governorRequestRender('ais-vessels-models');
|
||||
}
|
||||
|
||||
function destroyModels() {
|
||||
fleetModels?.destroy();
|
||||
fleetModels = null;
|
||||
modelItems = new Map();
|
||||
spareItems = new Map();
|
||||
modelCandidatesAtMs = -Infinity;
|
||||
}
|
||||
|
||||
// Vessels move only when a poll lands, so the layer does not hold the
|
||||
// continuous render loop. Its passes run in preRender, which idle mode fires
|
||||
// only for rendered frames: a forced pass (new data, selection) requests its
|
||||
@@ -216,6 +369,7 @@ export function createRendering({
|
||||
state.preRenderRemover = viewer.scene.preRender.addEventListener(() => {
|
||||
if (followsClock(vesselState)) followClockPositions();
|
||||
updateVisibility();
|
||||
if (state.feed.enabled) updateModels();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -306,8 +460,11 @@ export function createRendering({
|
||||
const visible = isVisible(visual.surfacePosition, occluder);
|
||||
if (visual.billboard) {
|
||||
// The bridge camera sits on this sprite; showing it would fill the view.
|
||||
// The same rule as billboardShown, its horizon test already made.
|
||||
visual.billboard.show =
|
||||
visible && record.id !== state.cockpitSubjectId;
|
||||
visible &&
|
||||
record.id !== state.cockpitSubjectId &&
|
||||
!visual.modelOwnsVisual;
|
||||
if (visible && doRotations && scene) {
|
||||
const rot = screenProjectedRotation(
|
||||
scene,
|
||||
@@ -582,6 +739,13 @@ export function createRendering({
|
||||
if (state.billboardCollection) {
|
||||
state.billboardCollection.show = show;
|
||||
}
|
||||
fleetModels?.setVisible(show);
|
||||
if (!show && fleetModels) {
|
||||
fleetModels.clear();
|
||||
for (const item of modelItems.values())
|
||||
getVisual(item.record).modelOwnsVisual = false;
|
||||
modelItems.clear();
|
||||
}
|
||||
vesselState._vesselOverlayHost.setVisible(VESSEL_OVERLAY_SOURCE_ID, show);
|
||||
}
|
||||
return {
|
||||
@@ -607,5 +771,7 @@ export function createRendering({
|
||||
labelPriority,
|
||||
hasUsefulName,
|
||||
setVisible,
|
||||
updateModels,
|
||||
destroyModels,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user