mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
refactor(vessels): Cesium rendering behind a renderer interface
src/layers/vessels/render/cesium.js holds the Cesium objects the layer built itself, one for one: the translucent BillboardCollection of chevrons (centred, screen-aligned, never depth-tested), the horizon occluder, window projection, canvas size, viewer.trackedEntityChanged, and the trail (data/trailRenderer's entity polyline, kept on Cesium: the engine.lines Primitive path did not draw below the photoreal mesh in round 6 — the plan's T13/T15 blocker; flights does the same). The logic imports no Cesium: geo math, Rgba WHITE, the chevron artwork in icons.js, clicks through the engine's selection dispatcher (own-rule owner, same rule). Registered as CESIUM_LAYER_RENDERERS['ais-live-vessels']; src/layers/vessels joins the boundary rule. W1 replay vs7c7422e2: vessels/flights/military/localAdsb counts, known objects, screen points, requests and shot sha256 identical. qa-vessel-cards --data synthetic 2/2 and qa-vessel-datum (?qaFeed= vessels:fixture) 4/4, the same as6eec8f6c. Tests moved with the code (same meaning): cameraHandoff (the click body is handleClick), inputOwnership (the guard precedes the click rule's read of the pick), renderers.test (vessels in the extracted list), importDirections (an unmoved example layer is satellites), the ownership services fixture (renderer service).
This commit is contained in:
1 parent
6b27b21cc4
commit
1fe8267550
23 files changed
+810
-198
No files matched your search
@@ -9,9 +9,22 @@ import * as sprites from '../../data/spriteOrder.js';
|
||||
import * as focus from '../../data/focusDeemphasis.js';
|
||||
import * as worldFocus from '../../worldFocus.js';
|
||||
import * as render from '../../renderGovernor.js';
|
||||
import * as selection from '../../data/selectionDispatcher.js';
|
||||
import { rendererFor } from './renderers.js';
|
||||
import { createVesselsCesiumRenderer } from '../../layers/vessels/render/cesium.js';
|
||||
|
||||
/** Construct one layer using the application scene owners and a supplied source. */
|
||||
export function createApplicationVessels({ source, options = {} }) {
|
||||
export function createApplicationVessels({
|
||||
source,
|
||||
options = {},
|
||||
// Test seam: the renderer factory (default: the engine's, from the registry).
|
||||
renderer = {
|
||||
create: ({ engine = null, ...rendererOptions }) =>
|
||||
engine
|
||||
? rendererFor('ais-live-vessels', engine, rendererOptions)
|
||||
: createVesselsCesiumRenderer(null, rendererOptions),
|
||||
},
|
||||
}) {
|
||||
return createVesselLayer({
|
||||
source,
|
||||
options,
|
||||
@@ -26,6 +39,10 @@ export function createApplicationVessels({ source, options = {} }) {
|
||||
focus,
|
||||
worldFocus,
|
||||
render,
|
||||
selection,
|
||||
// The engine's vessel renderer from the registry (render/cesium.js on
|
||||
// Cesium); a bare viewer without an engine (unit tests) draws on Cesium.
|
||||
renderer,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -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 { createVesselsCesiumRenderer } from '../../layers/vessels/render/cesium.js';
|
||||
|
||||
const ENGINE_KINDS = new Set(['cesium', 'navara']);
|
||||
|
||||
@@ -89,6 +90,7 @@ export const CESIUM_LAYER_RENDERERS = Object.freeze({
|
||||
flights: createFlightsCesiumRenderer,
|
||||
military: createMilitaryCesiumRenderer,
|
||||
'local-adsb': createLocalAdsbCesiumRenderer,
|
||||
'ais-live-vessels': createVesselsCesiumRenderer,
|
||||
});
|
||||
|
||||
// The other application layers still draw themselves on Cesium.
|
||||
|
||||
@@ -56,12 +56,21 @@ test('the default registry: every layer on Cesium, none yet on Navara', () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('the aircraft layers have extracted Cesium renderers; the others still draw themselves', () => {
|
||||
test('the aircraft layers and vessels have extracted Cesium renderers; the others still draw themselves', () => {
|
||||
assert.deepEqual(Object.keys(CESIUM_LAYER_RENDERERS), [
|
||||
'flights',
|
||||
'military',
|
||||
'local-adsb',
|
||||
'ais-live-vessels',
|
||||
]);
|
||||
const vessels = rendererFor(
|
||||
'ais-live-vessels',
|
||||
{ kind: 'cesium' },
|
||||
{
|
||||
viewer: { scene: {}, camera: {} },
|
||||
},
|
||||
);
|
||||
assert.equal(vessels.kind, 'cesium');
|
||||
const viewer = { scene: {}, camera: {} };
|
||||
const renderer = rendererFor('flights', { kind: 'cesium' }, { viewer });
|
||||
assert.equal(renderer.kind, 'cesium');
|
||||
|
||||
Reference in new issue
Block a user