mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
refactor(satellites): Cesium rendering behind a renderer interface
Move native points, synchronous orbit primitives, tracked entities, follow and picking into the Cesium renderer. Use appClock for satellite physical epochs and isolate the unchanged CelestialRing ephemeris. Synthetic core/dense and ISS/MEO/GEO snapshots match the baseline exactly; all gates pass. The pointer-ownership source assertion follows scene.pick into render/cesium.js; registry and import-boundary assertions now reflect the migrated satellite layer.
This commit is contained in:
1 parent
83fbe6949f
commit
000ef99464
27 files changed
+459
-196
No files matched your search
@@ -8,6 +8,7 @@
|
||||
// military:synthetic[:count] readsb rows, `count` aircraft (1 000); the
|
||||
// first 25 are also synthetic civil flights
|
||||
// vessels:fixture 12 000 AIS rows, or those within an area
|
||||
// satellites:fixture 839 core TLEs + 6000 dense points
|
||||
// local-adsb:fixture the local receivers' answer (server format,
|
||||
// /api/local-receivers/aircraft): 40 aircraft
|
||||
// near JFK, 1090 MHz and 978 MHz UAT
|
||||
@@ -23,12 +24,15 @@ import {
|
||||
syntheticMilitary,
|
||||
syntheticVessels,
|
||||
} from '../../bench/w1Feeds.js';
|
||||
import { satelliteFixture } from '../../bench/satelliteFixture.js';
|
||||
import { createSatelliteSource } from '../../layers/satellites/source.js';
|
||||
import { createLocalReceiverFeeds } from '../../layers/localAdsb/feeds.js';
|
||||
|
||||
const KINDS = Object.freeze({
|
||||
flights: new Set(['synthetic']),
|
||||
military: new Set(['synthetic']),
|
||||
vessels: new Set(['fixture']),
|
||||
satellites: new Set(['fixture']),
|
||||
'local-adsb': new Set(['fixture']),
|
||||
});
|
||||
|
||||
@@ -44,7 +48,7 @@ export function parseQaFeed(search = '') {
|
||||
(count !== null && !(Number.isInteger(count) && count > 0))
|
||||
)
|
||||
throw new TypeError(
|
||||
`qaFeed: unknown entry "${item}" (flights:synthetic[:count], military:synthetic[:count], vessels:fixture, local-adsb:fixture)`,
|
||||
`qaFeed: unknown entry "${item}" (flights:synthetic[:count], military:synthetic[:count], vessels:fixture, satellites:fixture, local-adsb:fixture)`,
|
||||
);
|
||||
return { layer, kind, count };
|
||||
});
|
||||
@@ -60,6 +64,11 @@ const json = (payload) =>
|
||||
export function createQaSources(entries, { now = () => Date.now() } = {}) {
|
||||
const sources = {};
|
||||
for (const { layer, count } of entries) {
|
||||
if (layer === 'satellites')
|
||||
sources.satellites = createSatelliteSource({
|
||||
fetchImpl: async (url) =>
|
||||
new Response(satelliteFixture(String(url).split('/').at(-1))),
|
||||
});
|
||||
if (layer === 'flights')
|
||||
sources.flights = createFlightSource({
|
||||
now,
|
||||
|
||||
@@ -27,6 +27,7 @@ import { APPLICATION_LAYER_DIRECTORY } from './directory.js';
|
||||
import { createFlightsCesiumRenderer } from '../../layers/flights/render/cesium.js';
|
||||
import { createMilitaryCesiumRenderer } from '../../layers/military/render/cesium.js';
|
||||
import { createLocalAdsbCesiumRenderer } from '../../layers/localAdsb/render/cesium.js';
|
||||
import { createSatellitesCesiumRenderer } from '../../layers/satellites/render/cesium.js';
|
||||
import { createVesselsCesiumRenderer } from '../../layers/vessels/render/cesium.js';
|
||||
|
||||
const ENGINE_KINDS = new Set(['cesium', 'navara']);
|
||||
@@ -87,6 +88,7 @@ export const layerAvailableOn = (layerId, engineKind) =>
|
||||
|
||||
/** Cesium renderers extracted from their layers (render/cesium.js). */
|
||||
export const CESIUM_LAYER_RENDERERS = Object.freeze({
|
||||
satellites: createSatellitesCesiumRenderer,
|
||||
flights: createFlightsCesiumRenderer,
|
||||
military: createMilitaryCesiumRenderer,
|
||||
'local-adsb': createLocalAdsbCesiumRenderer,
|
||||
|
||||
@@ -56,8 +56,9 @@ test('the default registry: every layer on Cesium, none yet on Navara', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('the aircraft layers and vessels have extracted Cesium renderers; the others still draw themselves', () => {
|
||||
test('the aircraft, vessels and satellites have extracted Cesium renderers; the others still draw themselves', () => {
|
||||
assert.deepEqual(Object.keys(CESIUM_LAYER_RENDERERS), [
|
||||
'satellites',
|
||||
'flights',
|
||||
'military',
|
||||
'local-adsb',
|
||||
@@ -78,7 +79,7 @@ test('the aircraft layers and vessels have extracted Cesium renderers; the other
|
||||
const military = rendererFor('military', { kind: 'cesium' }, { viewer });
|
||||
assert.equal(military.kind, 'cesium');
|
||||
assert.equal(military.viewer, viewer);
|
||||
assert.equal(rendererFor('satellites', { kind: 'cesium' }), null);
|
||||
assert.equal(rendererFor('satellites', { kind: 'cesium' }).kind, 'cesium');
|
||||
});
|
||||
|
||||
test('the layer availability API: engine, isAvailable, available, unavailable', () => {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { rendererFor } from './renderers.js';
|
||||
import { createSatellitesCesiumRenderer } from '../../layers/satellites/render/cesium.js';
|
||||
import { createSatellitesLayer } from '../../layers/satellites/index.js';
|
||||
import * as picking from '../../data/pickRegistry.js';
|
||||
import * as focus from '../../data/focusDeemphasis.js';
|
||||
@@ -8,10 +10,19 @@ import * as render from '../../renderGovernor.js';
|
||||
import * as layerState from '../../data/layerState.js';
|
||||
|
||||
/** Construct one layer using the application scene owners and a supplied source. */
|
||||
export function createApplicationSatellites({ source }) {
|
||||
export function createApplicationSatellites({
|
||||
source,
|
||||
renderer = {
|
||||
create: ({ engine = null, ...options }) =>
|
||||
engine
|
||||
? rendererFor('satellites', engine, options)
|
||||
: createSatellitesCesiumRenderer(null, options),
|
||||
},
|
||||
}) {
|
||||
return createSatellitesLayer({
|
||||
source,
|
||||
services: {
|
||||
renderer,
|
||||
picking,
|
||||
focus,
|
||||
readout,
|
||||
|
||||
Reference in new issue
Block a user