Move the scene-reading icon orientation helpers into the Cesium adapter

screenProjectedRotation, perspectiveProjectedRotation, horizonOccluder and
cameraPoseSignature read a Cesium scene or camera, so they move unchanged
to src/render/cesium/iconOrientation.js, where the CCTV, radio and transit
rendering (still Cesium-bound) load them. src/data/iconOrientation.js keeps
the label backdrop test and the rotation deadband, and leaves the Cesium
allow-list. Local ADS-B computes its rotation from the camera port's axes
with courseScreenRotation directly, the same answer without a stand-in
scene.

The ./aircraft package entry re-exports src/data/iconOrientation.js, so it
no longer carries the four moved helpers or the PERSPECTIVE_* constants.
This commit is contained in:
Sameh Khamis committed 2026-11-08 05:49:05 -08:00
1 parent d8d6db4389
commit b6e94b8d93
14 files changed
+224 -206

No files matched your search

+2 -2
View File
@@ -62,8 +62,8 @@ export function createLifecycle({
if (!layerState.enabled) return;
const now = Date.now();
// "Did the camera move" uses the same quantization as the fleet
// rotation pass's iconOrientation.cameraPoseSignature (keep the two
// in step), read from the camera port's pose, rather than
// rotation pass's cameraPoseSignature (render/cesium/iconOrientation;
// keep the two in step), read from the camera port's pose, rather than
// camera.changed, whose granularity is globally degraded by other layers
// mutating camera.percentageChanged.
const poseSig = cameraMotionSignature(layerState.viewer);
+1 -1
View File
@@ -21,7 +21,7 @@ import { writeHoldSegment } from '../../data/iconSegment.js';
import { IconSetPrimitive } from '../../render/cesium/iconSetPrimitive.js';
import { iconAtlas } from '../../data/iconAtlas.js';
import { cctvPicks } from './pickState.js';
import { horizonOccluder } from '../../data/iconOrientation.js';
import { horizonOccluder } from '../../render/cesium/iconOrientation.js';
import { frustumVolumeGeometryData } from '../../data/cctvViewshed.js';
import { entityRecord } from '../../data/entityRecords.js';
import { toColor } from '../../render/cesium/draw.js';
+4 -6
View File
@@ -1,9 +1,9 @@
import { CLASS_SCALE_2D } from '../../data/aircraftClass.js';
import { aircraftIcon } from '../../data/aircraftIcons.js';
import {
screenProjectedRotation,
courseScreenRotation,
stabilizeScreenRotation,
} from '../../data/iconOrientation.js';
} from '../../data/screenRotation.js';
import { fromDegreesInto, toLonLatH } from '../../geo/ellipsoid.js';
import { hexColor } from '../../render/color.js';
import {
@@ -200,14 +200,12 @@ export function createLocalAdsbLayer({
*/
function cameraBasis() {
const pose = viewer ? findCamera(viewer)?.pose() : null;
return pose?.right && pose?.up
? { camera: { rightWC: pose.right, upWC: pose.up } }
: null;
return pose?.right && pose?.up ? { right: pose.right, up: pose.up } : null;
}
function markerRotation(marker, basis = cameraBasis()) {
if (!basis || !marker.position) return marker.lastRotation;
const projected = screenProjectedRotation(
const projected = courseScreenRotation(
basis,
marker.position,
marker.courseDeg ?? 0,
+1 -1
View File
@@ -3,7 +3,7 @@ import * as Cesium from 'cesium';
// renderer bound, the layer's flights and camera reads find a camera port.
import '../../render/cesium/camera.js';
import { clusterPointCollection as clusterPointsOf } from '../../render/cesium/internals.js';
import { horizonOccluder } from '../../data/iconOrientation.js';
import { horizonOccluder } from '../../render/cesium/iconOrientation.js';
import {
MARKER_LIFT_M,
RADIO_PREFIX,
+1 -1
View File
@@ -10,7 +10,7 @@ import {
import {
cameraPoseSignature,
perspectiveProjectedRotation,
} from '../../data/iconOrientation.js';
} from '../../render/cesium/iconOrientation.js';
import {
updatePlayback,
applyDisplayCourse,