mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Draw military flights from the shared GPU icon set
The flights icon planning and presentation move into `createAircraftIcons` (src/data/aircraftIconLayer.js), and the motion regime both layers dead-reckon from into src/data/aircraftMotionRegime.js. Flights keeps only its grounded-floor pass on top. Military now draws every contact as a row of that icon set, like flights: the billboards, the cull positions and the rotation-pass signature go. Tracking hides the row and untracking re-plans it from the tracked course. Queries read the drawn row position and judge the horizon as the shader does. Snapshots that arrive before init or after destroy are ignored, and per-contact lookups find no contact then instead of throwing. With about 120 live military contacts, preRender p95 drops from 0.7-0.8 ms to 0.2 ms on the same views. Render time and frame gaps are unchanged or slightly lower.
This commit is contained in:
1 parent
fa3a3a3bca
commit
b027bde6ad
33 files changed
+1256
-1376
No files matched your search
@@ -2,7 +2,7 @@ import * as Cesium from 'cesium';
|
||||
import { CYAN_TRANSPARENT } from './policy.js';
|
||||
import { mirrorModel } from '../../data/modelMirror.js';
|
||||
import { createIconSet } from '../../data/iconSet.js';
|
||||
import { writeHoldSegment } from '../../data/iconSegment.js';
|
||||
import { aircraftIconTestSeams } from '../../data/aircraftIconLayer.js';
|
||||
|
||||
export function createTesting({
|
||||
flightState,
|
||||
@@ -11,6 +11,8 @@ export function createTesting({
|
||||
layer,
|
||||
resolveAsset,
|
||||
}) {
|
||||
const { _seedIconForTest, _iconForTest, _setIconForTest } =
|
||||
aircraftIconTestSeams(flightState, parts, 'flights');
|
||||
/** Test seam for the display-floor clamp (unit-tested against real Cesium math
|
||||
* with seeded mesh cells — the drift mechanism is otherwise only reachable
|
||||
* through a live poll + render loop). */
|
||||
@@ -39,19 +41,6 @@ export function createTesting({
|
||||
flightState._displayFloorState.clear();
|
||||
}
|
||||
|
||||
/** Give a test contact an icon row held at `billboard.position`, shown as
|
||||
* `billboard.show` says (hidden by default while tracked). */
|
||||
|
||||
function _seedIconForTest(icao24, billboard, tracked) {
|
||||
const icons = flightState._icons;
|
||||
const row = icons.add(icao24, { layer: 'flights', id: icao24 });
|
||||
if (billboard?.position)
|
||||
writeHoldSegment(icons.segments, row, billboard.position, 0);
|
||||
icons.segmentWritten(row);
|
||||
icons.setShown(row, billboard?.show ?? !tracked);
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed only the mutable state needed to exercise tracked-card refreshes through
|
||||
* the production poll reconciler. Tests still call `flightsLayer.update()`;
|
||||
@@ -212,38 +201,12 @@ export function createTesting({
|
||||
);
|
||||
}
|
||||
|
||||
/** Where a contact's icon is drawn now and whether the layer shows it. */
|
||||
|
||||
function _iconForTest(icao24) {
|
||||
const position = parts.icons._iconPosition(icao24);
|
||||
return position
|
||||
? {
|
||||
position,
|
||||
shown: parts.icons._iconShown(icao24),
|
||||
course: parts.icons._iconCourse(icao24),
|
||||
}
|
||||
: null;
|
||||
}
|
||||
|
||||
/** Exercise the exact asynchronous fleet loader and return its admitted model. */
|
||||
|
||||
async function _ensureFleetModelForTest(icao24) {
|
||||
await parts.rendering._ensureModel(icao24);
|
||||
return flightState._models.get(icao24) || null;
|
||||
}
|
||||
/** Show or hide a contact's icon as a handoff would, or hold it somewhere. */
|
||||
|
||||
function _setIconForTest(icao24, { shown, position } = {}) {
|
||||
const icons = flightState._icons;
|
||||
const row = icons?.row(icao24) ?? -1;
|
||||
if (row < 0) return;
|
||||
if (shown !== undefined) icons.setShown(row, shown);
|
||||
if (position) {
|
||||
writeHoldSegment(icons.segments, row, position, 0);
|
||||
icons.segmentWritten(row);
|
||||
}
|
||||
}
|
||||
|
||||
/** Run the fleet tick's grounded floor pass once, at `renderTime`. */
|
||||
|
||||
function _floorGroundedIconsForTest(renderTime, cameraPosition) {
|
||||
|
||||
Reference in new issue
Block a user