Draw the satellites layer through the renderer ports

The satellite dots, the tracked satellite's dot and the orbit rings now go
through the draw port instead of a raw point collection, an entity and
primitives, so the layer's rendering no longer drives Cesium and leaves the
Cesium allow-list.

- Dots are one points set, patched in place and sent once per frame.
- The tracked dot is its own set, drawn at the sample the follow camera
  framed (or after the frame's own sample when no camera read it).
- Rings are geodesic lines with a behind-the-globe colour, turned about the
  pole by the sidereal angle in the layer each second, since the port has no
  inertial frame. The orbit frame matrix is a plain 16-number array, and
  the launches layer now receives plain ECEF orbit positions.
- Clicks match the draw hit against the layer's own sets.
- The focus pass projects every dot in one batched call.
- Depth-fail lines in the Cesium draw port honour pickable: false.
This commit is contained in:
Sameh Khamis committed 2026-11-08 13:06:52 -08:00
1 parent 1bff078097
commit d513034f3d
17 files changed
+845 -415

No files matched your search

+4 -4
View File
@@ -114,10 +114,10 @@ assertResumeGate('CCTV', () => {
assertResumeGate('satellite', () => {
const point = {
position: { x: 1, y: 2, z: 3 },
pos: { x: 1, y: 2, z: 3 },
show: true,
pixelSize: 6,
color: color(),
color: [1, 1, 1, 1],
};
return {
pass: ({ nowMs, target: focusTarget, previousActiveCount }) =>
@@ -129,9 +129,9 @@ assertResumeGate('satellite', () => {
nowMs,
screenPositionFor: () => ({ x: 50, y: 50 }),
cameraDistanceFor: () => 1200,
baseColorFor: () => color(),
baseColorFor: () => [1, 1, 1, 1],
params,
}),
readAlpha: () => point.color.alpha,
readAlpha: () => point.color[3],
};
});
+3 -3
View File
@@ -96,7 +96,7 @@ test('satellite getAnalystRecords: disabled or empty catalog returns []', () =>
test('satellite getAnalystRecords: core rows beat dense extras under the cap', () => {
const satrec = twoline2satrec(ISS_L1, ISS_L2);
const point = {
position: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 420_000),
pos: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 420_000),
};
_setTrackedSatelliteRefreshStateForTest({
noradId: ISS_NORAD,
@@ -112,7 +112,7 @@ test('satellite getAnalystRecords: core rows beat dense extras under the cap', (
name: 'STARLINK-TEST',
satrec,
group: 'dense',
point: { position: Cesium.Cartesian3.fromDegrees(-90, 20, 550_000) },
point: { pos: Cesium.Cartesian3.fromDegrees(-90, 20, 550_000) },
},
{
noradId: 24876,
@@ -120,7 +120,7 @@ test('satellite getAnalystRecords: core rows beat dense extras under the cap', (
satrec,
group: 'gps-ops',
point: {
position: Cesium.Cartesian3.fromDegrees(-100, 10, 20_200_000),
pos: Cesium.Cartesian3.fromDegrees(-100, 10, 20_200_000),
},
},
],
+29 -40
View File
@@ -18,6 +18,7 @@ import {
} from './satellites.js';
import { followedOf } from './followed.js';
import { bindRenderer } from '../render/rendererOf.js';
import { fakeDrawPort } from '../testSupport/fakeDrawPort.mjs';
import satellitesLayer from './satellites.js';
import { createTrackedOverlayEntry } from './trackedReadout.js';
import { readEntityRecord, withEntityRecord } from './entityRecords.js';
@@ -110,23 +111,17 @@ test('satellite first update aborts every parallel catalog request', async () =>
test('selected satellite params survive delayed arrival and yield to newer explicit intent', (t) => {
const point = {
position: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 420_000),
pos: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 420_000),
show: true,
pixelSize: 12,
color: Cesium.Color.RED,
outlineColor: Cesium.Color.WHITE,
color: [1, 0, 0, 1],
outlineColor: [1, 1, 1, 1],
outlineWidth: 2,
disableDepthTestDistance: 0,
disableDepthTest: 0,
};
const viewer = {
entities: new Cesium.EntityCollection(),
trackedEntity: undefined,
scene: {
frameState: { frameNumber: 1 },
primitives: { remove() {} },
},
};
t.after(bindRenderer(viewer, { camera: followingPort() }));
const viewer = {};
const draw = fakeDrawPort();
t.after(bindRenderer(viewer, { camera: followingPort(), draw }));
_setSatelliteLabelLifecycleStateForTest({
viewer,
satrec: twoline2satrec(L1, L2),
@@ -215,13 +210,13 @@ test('a tracked docked cluster consolidates its companions onto one card', () =>
// consolidate them as secondary info on that card, and suppress only those
// members — never unrelated satellites that merely happen to be nearby.
const entity = withEntityRecord({}, { labelModel: { title: 'OLD', details: ['? km'] } });
const point = { position: new Cesium.Cartesian3() };
const point = { pos: new Cesium.Cartesian3() };
const viewer = { camera: null, scene: { frameState: { frameNumber: 1 } } };
let nowMs = Date.UTC(2008, 8, 20, 12, 30);
// The tracked satellite moves ~7.6 km/s, so neighbours are defined RELATIVE to
// wherever it is at scan time rather than pinned to a stale sample.
const near = (metres) => ({
get position() {
get pos() {
const tracked = _trackedFrameCartesianForTest();
return new Cesium.Cartesian3(tracked.x + metres, tracked.y, tracked.z);
},
@@ -246,7 +241,6 @@ test('a tracked docked cluster consolidates its companions onto one card', () =>
// The cluster scan is throttled, so advance past its interval before the frame
// that must observe the cluster.
nowMs += 2000;
viewer.scene.frameState.frameNumber = 2;
_runSatellitePreRenderForTest();
const details = readEntityRecord(entity)?.labelModel.details;
@@ -273,7 +267,7 @@ test('a tracked docked cluster consolidates its companions onto one card', () =>
});
test('satellite pre-render refreshes the tracked altitude on each propagated frame', () => {
const entity = withEntityRecord({}, { labelModel: { title: 'OLD', details: ['? km'] } });
const point = { position: new Cesium.Cartesian3() };
const point = { pos: new Cesium.Cartesian3() };
const viewer = {
camera: null,
scene: { frameState: { frameNumber: 1 } },
@@ -297,7 +291,6 @@ test('satellite pre-render refreshes the tracked altitude on each propagated fra
assert.equal(readEntityRecord(entity)?.labelModel.details[1], '353\u00a0km · NORAD 25544');
epochIndex = 1;
viewer.scene.frameState.frameNumber = 2;
_runSatellitePreRenderForTest();
assert.equal(readEntityRecord(entity)?.labelModel.details[1], '366\u00a0km · NORAD 25544');
assert.equal(
@@ -315,23 +308,17 @@ test('ISS ambient and tracked lifecycle uses cached host entries with no native
clearSource: (...args) => calls.push(['clear', ...args]),
};
const point = {
position: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 420_000),
pos: Cesium.Cartesian3.fromDegrees(-97.7, 30.2, 420_000),
show: true,
pixelSize: 12,
color: Cesium.Color.RED,
outlineColor: Cesium.Color.WHITE,
color: [1, 0, 0, 1],
outlineColor: [1, 1, 1, 1],
outlineWidth: 2,
disableDepthTestDistance: 0,
disableDepthTest: 0,
};
const viewer = {
entities: new Cesium.EntityCollection(),
trackedEntity: undefined,
scene: {
frameState: { frameNumber: 1 },
primitives: { remove() {} },
},
};
t.after(bindRenderer(viewer, { camera: followingPort() }));
const viewer = {};
const draw = fakeDrawPort();
t.after(bindRenderer(viewer, { camera: followingPort(), draw }));
let cleaned = false;
_setSatelliteLabelLifecycleStateForTest({
viewer,
@@ -348,7 +335,7 @@ test('ISS ambient and tracked lifecycle uses cached host entries with no native
assert.equal(ambient.title, 'ISS');
assert.equal(
ambient.position(),
point.position,
point.pos,
'ISS getter reads the existing point cache',
);
assert.equal(
@@ -359,16 +346,17 @@ test('ISS ambient and tracked lifecycle uses cached host entries with no native
const trackedEntity = _trackIssForTest();
assert.ok(trackedEntity);
const tracked = [...draw.sets.values()].find(
(set) => !set.disposed && /^satellites:\d+:tracked$/.test(set.spec.id),
);
assert.ok(tracked, 'the tracked dot has a set of its own');
_runSatellitePreRenderForTest();
assert.equal(
viewer.entities.values.length,
1,
'runtime guard requires a real tracked entity',
tracked.items.get('25544')?.pixelSize,
14,
'the tracked dot draws, as the follow camera frames it',
);
assert.equal(trackedEntity.label, undefined);
assert.ok(
trackedEntity.point,
'tracked dot remains on the entity for camera framing',
);
const trackedEntry = createTrackedOverlayEntry(trackedEntity);
assert.ok(trackedEntry);
assert.equal(trackedEntry.id, 'satellites:25544');
@@ -393,7 +381,8 @@ test('ISS ambient and tracked lifecycle uses cached host entries with no native
_clearSatelliteLabelLifecycleForTest();
cleaned = true;
assert.equal(viewer.entities.values.length, 0);
assert.equal(tracked.items.size, 0);
assert.ok(tracked.disposed);
assert.equal(
calls.filter(
([type, sourceId]) =>
+2 -3
View File
@@ -18,11 +18,11 @@ const L2 =
function run(locale) {
setLocale(locale);
const entity = withEntityRecord({}, { labelModel: { title: 'OLD', details: ['? km'] } });
const point = { position: new Cesium.Cartesian3() };
const point = { pos: new Cesium.Cartesian3() };
const viewer = { camera: null, scene: { frameState: { frameNumber: 1 } } };
let nowMs = Date.UTC(2008, 8, 20, 12, 30);
const near = (metres) => ({
get position() {
get pos() {
const tracked = _trackedFrameCartesianForTest();
return new Cesium.Cartesian3(tracked.x + metres, tracked.y, tracked.z);
},
@@ -42,7 +42,6 @@ function run(locale) {
});
_runSatellitePreRenderForTest();
nowMs += 2000;
viewer.scene.frameState.frameNumber = 2;
_runSatellitePreRenderForTest();
const details = readEntityRecord(entity)?.labelModel.details;
setLocale('en');