mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Delete the billboard and model mirrors; models become layer-held records
Aircraft draw from GPU icon sets, so the billboard mirror, the billboard treatment and the aircraft visual-state module had no callers left. 3D models are now records the layer holds under the contact's id (modelRecord.js): show and placement are written through showModel/placeModel and read back from the record; renderer-measured values stay on record.model. The tracked-model click check only matches when a tracked model exists, so an id-only pick is never mistaken for a click on the tracked plane.
This commit is contained in:
1 parent
c9f1fcd425
commit
83ec9473b6
35 files changed
+391
-788
No files matched your search
@@ -21,7 +21,6 @@ import {
|
||||
COURSE_SLEW_DT_MAX_SEC,
|
||||
COURSE_MAX_DPS,
|
||||
} from './policy.js';
|
||||
import { modelState } from '../../data/modelMirror.js';
|
||||
import { readEntityRecord } from '../../data/entityRecords.js';
|
||||
import {
|
||||
aircraftMotionRegime,
|
||||
@@ -340,10 +339,10 @@ export function createMotion({
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
);
|
||||
return modelVisualAnchor(
|
||||
modelState(flightState._trackedModel).modelMatrix,
|
||||
flightState._trackedModel.matrix,
|
||||
spec.visualCenterNative,
|
||||
Number.isFinite(flightState._trackedModel.computedScale)
|
||||
? flightState._trackedModel.computedScale
|
||||
Number.isFinite(flightState._trackedModel.model.computedScale)
|
||||
? flightState._trackedModel.model.computedScale
|
||||
: spec.scale,
|
||||
flightState._trackedVisualPos,
|
||||
);
|
||||
@@ -367,7 +366,7 @@ export function createMotion({
|
||||
)
|
||||
return null;
|
||||
return Cesium.Matrix4.getTranslation(
|
||||
modelState(flightState._trackedModel).modelMatrix,
|
||||
flightState._trackedModel.matrix,
|
||||
flightState._scratchTrailClip,
|
||||
);
|
||||
}
|
||||
@@ -382,8 +381,8 @@ export function createMotion({
|
||||
const spec = parts.rendering._modelSpec(
|
||||
flightState.records.data.get(flightState._trackedIcao)?.klass,
|
||||
);
|
||||
const scale = Number.isFinite(flightState._trackedModel.computedScale)
|
||||
? flightState._trackedModel.computedScale
|
||||
const scale = Number.isFinite(flightState._trackedModel.model.computedScale)
|
||||
? flightState._trackedModel.model.computedScale
|
||||
: spec.scale;
|
||||
return spec.nativeRadiusM * scale;
|
||||
}
|
||||
|
||||
@@ -181,11 +181,11 @@ test('a newly seen military contact appears at its delayed position, not ahead o
|
||||
icao24: 'seed00',
|
||||
entity: null,
|
||||
meta: { rawLat: 0, rawLon: 0, onGround: false },
|
||||
billboard: {
|
||||
icon: {
|
||||
show: false,
|
||||
position: Cesium.Cartesian3.fromDegrees(0, 0, 0),
|
||||
},
|
||||
billboardCollection: { show: false },
|
||||
iconLayer: { show: false },
|
||||
viewer: { camera: { positionCartographic: null }, scene: {} },
|
||||
tracked: false,
|
||||
});
|
||||
@@ -246,8 +246,8 @@ test('a vanished military contact fades while position-less rows keep theirs', a
|
||||
icao24: 'seed00',
|
||||
entity: null,
|
||||
meta: { rawLat: 0, rawLon: 0, onGround: false },
|
||||
billboard: { show: false, position: Cesium.Cartesian3.fromDegrees(0, 0) },
|
||||
billboardCollection: { show: true, add: (options) => ({ ...options }) },
|
||||
icon: { show: false, position: Cesium.Cartesian3.fromDegrees(0, 0) },
|
||||
iconLayer: { show: true, add: (options) => ({ ...options }) },
|
||||
viewer,
|
||||
tracked: false,
|
||||
});
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
} from '../../data/contactMatch.js';
|
||||
import { LANDED_ALT_MAX_FT, LANDED_SPEED_MAX_MPS } from './policy.js';
|
||||
import { emergencyBroadcastPhrase } from '../../data/aircraftEmergency.js';
|
||||
import { modelState } from '../../data/modelMirror.js';
|
||||
|
||||
export function createQueries({
|
||||
flightState,
|
||||
@@ -450,7 +449,7 @@ export function createQueries({
|
||||
const isTracked = icao24 === flightState._trackedIcao;
|
||||
// Keep planes rendered as a 3D model (icon hidden) so the detection box
|
||||
// doesn't vanish on the 2D→3D handoff.
|
||||
const model = flightState._models.get(icao24);
|
||||
const record = flightState._models.get(icao24);
|
||||
const modelOwnsVisual = parts.rendering._modelOwnsVisual(icao24);
|
||||
if (!isTracked && !icons.shown(row) && !modelOwnsVisual) continue;
|
||||
const info = flightState.records.data.get(icao24);
|
||||
@@ -479,10 +478,10 @@ export function createQueries({
|
||||
icons.position(row, tau, object._iconPos)
|
||||
: modelOwnsVisual
|
||||
? modelVisualAnchor(
|
||||
modelState(model).modelMatrix,
|
||||
record.matrix,
|
||||
spec.visualCenterNative,
|
||||
Number.isFinite(model.computedScale)
|
||||
? model.computedScale
|
||||
Number.isFinite(record.model.computedScale)
|
||||
? record.model.computedScale
|
||||
: spec.scale,
|
||||
object._weldPos || (object._weldPos = new Cesium.Cartesian3()),
|
||||
)
|
||||
|
||||
@@ -186,8 +186,8 @@ export function createMilitarySnapshotRenderer({
|
||||
sampleMeshFloorCells(flightState._viewer?.scene, _floorWarmPoints, {
|
||||
excludeObjects: [
|
||||
...icons._iconIds(),
|
||||
...flightState._models.values(),
|
||||
flightState._trackedModel,
|
||||
...[...flightState._models.values()].map((record) => record.model),
|
||||
flightState._trackedModel?.model,
|
||||
].filter(Boolean),
|
||||
viewerLat: viewerCarto
|
||||
? Cesium.Math.toDegrees(viewerCarto.latitude)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { AMBER_TRANSPARENT, TRACKED_ICON_COLOR } from './policy.js';
|
||||
import { mirrorModel } from '../../data/modelMirror.js';
|
||||
import { createModelRecord } from '../../data/modelRecord.js';
|
||||
import { createIconSet } from '../../data/iconSet.js';
|
||||
import { aircraftIconTestSeams } from '../../data/aircraftIconLayer.js';
|
||||
|
||||
@@ -21,9 +21,9 @@ export function createTesting({
|
||||
* @param {string} state.icao24
|
||||
* @param {object} state.entity
|
||||
* @param {object} state.meta
|
||||
* @param {{position?: Cesium.Cartesian3, show?: boolean}} [state.billboard]
|
||||
* @param {{position?: Cesium.Cartesian3, show?: boolean}} [state.icon]
|
||||
* Where the contact's icon is held, and whether it is shown.
|
||||
* @param {{show?: boolean}} [state.billboardCollection] Layer visibility.
|
||||
* @param {{show?: boolean}} [state.iconLayer] Layer visibility.
|
||||
* @param {object} state.viewer
|
||||
* @param {Array<Object>} [state.history=[]]
|
||||
* @param {boolean} [state.tracked=true]
|
||||
@@ -35,8 +35,8 @@ export function createTesting({
|
||||
icao24,
|
||||
entity,
|
||||
meta,
|
||||
billboard,
|
||||
billboardCollection,
|
||||
icon,
|
||||
iconLayer,
|
||||
viewer,
|
||||
history = [],
|
||||
tracked = true,
|
||||
@@ -48,11 +48,11 @@ export function createTesting({
|
||||
flightState._icons = createIconSet({
|
||||
epoch: parts.icons._displayTime(new Cesium.JulianDate()),
|
||||
});
|
||||
flightState._icons.show = billboardCollection?.show ?? true;
|
||||
_seedIconForTest(icao24, billboard, tracked);
|
||||
flightState._icons.show = iconLayer?.show ?? true;
|
||||
_seedIconForTest(icao24, icon, tracked);
|
||||
flightState._models.clear();
|
||||
for (const [key, model] of models)
|
||||
flightState._models.set(key, mirrorModel(model));
|
||||
flightState._models.set(key, createModelRecord(model));
|
||||
flightState._detectionObjects = new Map();
|
||||
flightState.records.data = new Map([[icao24, meta]]);
|
||||
flightState._positionHistory = new Map([[icao24, history]]);
|
||||
@@ -93,10 +93,10 @@ export function createTesting({
|
||||
function _addMilitaryTrackingCandidateForTest({
|
||||
icao24,
|
||||
meta,
|
||||
billboard,
|
||||
icon,
|
||||
history = [],
|
||||
}) {
|
||||
_seedIconForTest(icao24, billboard, false);
|
||||
_seedIconForTest(icao24, icon, false);
|
||||
flightState.records.data.set(icao24, meta);
|
||||
flightState._positionHistory.set(icao24, history);
|
||||
}
|
||||
@@ -158,7 +158,7 @@ export function createTesting({
|
||||
|
||||
async function _ensureFleetModelForTest(icao24) {
|
||||
await parts.rendering._ensureModel(icao24);
|
||||
return flightState._models.get(icao24) || null;
|
||||
return flightState._models.get(icao24)?.model ?? null;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1098,7 +1098,8 @@ export function createTracking({
|
||||
const rawPick =
|
||||
typeof picked.id === 'string' ? picked.id : picked.primitive?.id;
|
||||
if (
|
||||
picked.primitive === flightState._trackedModel ||
|
||||
(flightState._trackedModel &&
|
||||
picked.primitive === flightState._trackedModel.model) ||
|
||||
rawPick === flightState._trackedIcao
|
||||
)
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user