mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
refactor: separate military-flight records and rendering
This commit is contained in:
1 parent
d01b69118e
commit
9e84b03c5e
23 files changed
+928
-665
No files matched your search
@@ -133,7 +133,7 @@ export function createRendering({
|
||||
}
|
||||
|
||||
function _militaryBillboardScale(icao24) {
|
||||
const meta = flightState._flightData.get(icao24);
|
||||
const meta = flightState.records.data.get(icao24);
|
||||
return (
|
||||
BILLBOARD_SCALE *
|
||||
(CLASS_SCALE_2D[meta?.klass] || 1) *
|
||||
@@ -162,7 +162,7 @@ export function createRendering({
|
||||
return;
|
||||
}
|
||||
|
||||
const meta = flightState._flightData.get(icao24);
|
||||
const meta = flightState.records.data.get(icao24);
|
||||
bb.image = aircraftIcon(
|
||||
_iconKind(icao24, meta?.klass),
|
||||
bb._gevIconLarge ? TRACKED_ICON_PX : undefined,
|
||||
@@ -280,7 +280,7 @@ export function createRendering({
|
||||
* outage inside groundSnap's drift bound, so taxiing does not pop it back to 2D. */
|
||||
|
||||
function _modelDisplayPosition(icao24, pos, result) {
|
||||
const meta = flightState._flightData.get(icao24);
|
||||
const meta = flightState.records.data.get(icao24);
|
||||
if (!meta || !meta.onGround) return pos;
|
||||
const h = flightState._groundSnap.heightFor(
|
||||
flightState._viewer,
|
||||
@@ -332,7 +332,7 @@ export function createRendering({
|
||||
displayPos,
|
||||
course,
|
||||
model.modelMatrix,
|
||||
_modelSpec(flightState._flightData.get(icao24)?.klass).headingOffsetDeg,
|
||||
_modelSpec(flightState.records.data.get(icao24)?.klass).headingOffsetDeg,
|
||||
);
|
||||
if (!model.ready) {
|
||||
model.show = false; // not loaded yet → keep the 2D icon, no half-model flash
|
||||
@@ -380,7 +380,7 @@ export function createRendering({
|
||||
* fleet billboard FIRST (gap-proof) and covering the tracked standalone. */
|
||||
|
||||
function _syncModelToClass(icao24) {
|
||||
const key = _specKeyFor(flightState._flightData.get(icao24)?.klass);
|
||||
const key = _specKeyFor(flightState.records.data.get(icao24)?.klass);
|
||||
const current = flightState._models.get(icao24);
|
||||
if (
|
||||
(current && current._gevSpecKey !== key) ||
|
||||
@@ -450,10 +450,10 @@ 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._flightData.get(icao24)?.klass);
|
||||
const specKey = _specKeyFor(flightState.records.data.get(icao24)?.klass);
|
||||
const loadIrBoost = flightState._irBoost;
|
||||
try {
|
||||
const spec = _modelSpec(flightState._flightData.get(icao24)?.klass);
|
||||
const spec = _modelSpec(flightState.records.data.get(icao24)?.klass);
|
||||
model = await Cesium.Model.fromGltfAsync({
|
||||
url: resolveAsset(spec.url),
|
||||
asynchronous: false,
|
||||
@@ -498,12 +498,12 @@ export function createRendering({
|
||||
!_modelRegimeActive() ||
|
||||
!flightState._modelCollection ||
|
||||
flightState._modelCollection.isDestroyed() ||
|
||||
!flightState._flightData.has(icao24) ||
|
||||
!flightState.records.data.has(icao24) ||
|
||||
icao24 === flightState._trackedIcao ||
|
||||
flightState._models.has(icao24) ||
|
||||
flightState._models.size >= _modelCap() ||
|
||||
// Class reclassified mid-load → this GLB/scale is for the OLD class.
|
||||
_specKeyFor(flightState._flightData.get(icao24)?.klass) !== specKey ||
|
||||
_specKeyFor(flightState.records.data.get(icao24)?.klass) !== specKey ||
|
||||
// IR boost flipped mid-load → this model baked the wrong shader/tint.
|
||||
flightState._irBoost !== loadIrBoost;
|
||||
if (stale) {
|
||||
@@ -651,10 +651,10 @@ export function createRendering({
|
||||
flightState._trackedModelLoading = true;
|
||||
const gen = flightState._trackedModelGen;
|
||||
const trackedSpec = _modelSpec(
|
||||
flightState._flightData.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
);
|
||||
const trackedKey = _specKeyFor(
|
||||
flightState._flightData.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
);
|
||||
const trackedIrBoost = flightState._irBoost;
|
||||
Cesium.Model.fromGltfAsync({
|
||||
@@ -691,7 +691,7 @@ export function createRendering({
|
||||
// _trackedModel was still null): drop the stale asset; driver reloads.
|
||||
if (
|
||||
_specKeyFor(
|
||||
flightState._flightData.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
) !== trackedKey ||
|
||||
flightState._irBoost !== trackedIrBoost
|
||||
) {
|
||||
@@ -760,7 +760,7 @@ export function createRendering({
|
||||
return;
|
||||
}
|
||||
const spec = _modelSpec(
|
||||
flightState._flightData.get(flightState._trackedIcao)?.klass,
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
);
|
||||
_modelMatrix(
|
||||
displayPos,
|
||||
@@ -933,7 +933,7 @@ export function createRendering({
|
||||
// ellipsoid (mirror of flights.js — sub-ellipsoid points near the limb
|
||||
// read "beyond the horizon" and would hide low contacts awaiting floors).
|
||||
const beyondHorizon = !occluder.isPointVisible(
|
||||
flightState._flightData.get(icao24)?.cullPosition || bb.position,
|
||||
flightState.records.data.get(icao24)?.cullPosition || bb.position,
|
||||
);
|
||||
// A billboard flipping INTO view (horizon reveal while the camera idles)
|
||||
// gets its rotation refreshed THIS tick even without a pose change —
|
||||
@@ -950,7 +950,7 @@ export function createRendering({
|
||||
continue;
|
||||
}
|
||||
|
||||
const info = flightState._flightData.get(icao24);
|
||||
const info = flightState.records.data.get(icao24);
|
||||
|
||||
// One sprite-owned write site composes freshness × focus × limb haze and
|
||||
// base class/ground scale × limb taper. The locked NearFarScalar remains
|
||||
@@ -983,7 +983,7 @@ export function createRendering({
|
||||
flightState._cockpitContactMode && !isCockpitNear
|
||||
? 1
|
||||
: _militaryBillboardScale(icao24),
|
||||
baseAlpha: flightState._missingPolls.get(icao24) ? 0.45 : 1,
|
||||
baseAlpha: flightState.records.missingPolls.get(icao24) ? 0.45 : 1,
|
||||
baseColor: MIL_ICON_COLOR,
|
||||
focusFactor: focus.factor,
|
||||
cameraDistanceM,
|
||||
@@ -1003,7 +1003,7 @@ export function createRendering({
|
||||
if (wantLarge !== !!bb._gevIconLarge) {
|
||||
bb._gevIconLarge = wantLarge;
|
||||
bb.image = aircraftIcon(
|
||||
_iconKind(icao24, flightState._flightData.get(icao24)?.klass),
|
||||
_iconKind(icao24, flightState.records.data.get(icao24)?.klass),
|
||||
wantLarge ? TRACKED_ICON_PX : undefined,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user