Orbit, move, look and zoom through the camera port

The Cesium camera port gains move, look, rotateAround and zoom, and the
browser conformance run now checks them, the lookAt-frame commands, the
changed thresholds and moveEnd (timed by the clock, not a frame count).
Orbit, the Bhote Koshi focus and cinematic, the launch zoom anchor and
replay chase, the camera verbs' motion tick and roll levelling, and
voice zoom write through the port.
This commit is contained in:
Sameh Khamis committed 2026-11-06 10:21:04 -08:00
1 parent c722593791
commit 21d23034ec
19 files changed
+174 -112

No files matched your search

+17 -17
View File
@@ -1,6 +1,7 @@
import * as Cesium from 'cesium';
import { t } from '../../i18n/index.js';
import { cameraOf } from '../../render/cesium/camera.js';
import { findCamera } from '../../render/rendererOf.js';
import {
REPLAY_ASCENT_FALLBACK_SEC,
REPLAY_ASCENT_MIN_SEC,
@@ -315,9 +316,9 @@ export function createReplay({ state: layerState, services, parts, source }) {
layerState._replayCameraToken++;
if (layerState._replayCameraRemover) layerState._replayCameraRemover();
layerState._replayCameraRemover = null;
layerState._viewer?.camera?.cancelFlight();
if (layerState._viewer?.camera)
layerState._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
const camera = findCamera(layerState._viewer);
camera?.cancelFlight();
camera?.release();
layerState._replayCameraLaunchId = null;
layerState._replayPaused = false;
layerState._replayPausedAtMs = null;
@@ -354,7 +355,8 @@ export function createReplay({ state: layerState, services, parts, source }) {
parts.overlays.syncMissionOverlayEntries();
parts.policyHelpers.releaseAircraftTracking(layerState._dataManager);
layerState._viewer.trackedEntity = undefined;
cameraOf(layerState._viewer).cancelFlight();
const camera = cameraOf(layerState._viewer);
camera.cancelFlight();
layerState._animationStarts.set(
launchId,
Date.now() +
@@ -374,6 +376,9 @@ export function createReplay({ state: layerState, services, parts, source }) {
)
return;
const state = track.beginReplayFrame();
// Asked for each frame, not kept: a renderer bound meanwhile
// replaces the port.
const chaseCamera = cameraOf(layerState._viewer);
syncReplayCountdownButton(state);
if (!cameraReady) return;
const path = state.ascending
@@ -432,14 +437,11 @@ export function createReplay({ state: layerState, services, parts, source }) {
)
: cameraView.range;
if (state.ascending) {
layerState._viewer.camera.lookAt(
cameraTarget,
new Cesium.HeadingPitchRange(
track.lastCameraHeading,
cameraView.pitch,
cameraRange,
),
);
chaseCamera.lookAt(cameraTarget, {
heading: track.lastCameraHeading,
pitch: cameraView.pitch,
range: cameraRange,
});
} else {
const tangentStep = Math.max(
0.002,
@@ -464,12 +466,10 @@ export function createReplay({ state: layerState, services, parts, source }) {
);
if (orbitPose) {
if (!track.orbitCameraWorldFrame) {
layerState._viewer.camera.lookAtTransform(
Cesium.Matrix4.IDENTITY,
);
chaseCamera.release();
track.orbitCameraWorldFrame = true;
}
layerState._viewer.camera.setView({
chaseCamera.setView({
destination: orbitPose.destination,
orientation: {
direction: orbitPose.direction,
@@ -486,7 +486,7 @@ export function createReplay({ state: layerState, services, parts, source }) {
}
});
cameraOf(layerState._viewer).flyToBounds(
camera.flyToBounds(
{ center: track.ascentPath[0], radius: 0 },
{
offset: {
+8 -11
View File
@@ -1,6 +1,7 @@
import * as Cesium from 'cesium';
import { MISSION_GLOBE_VIEW_RANGE_M, MISSION_FOCUS_RANGE_M } from './policy.js';
import { cameraOf } from '../../render/cesium/camera.js';
import { findCamera } from '../../render/rendererOf.js';
export function createSelection({
state: layerState,
@@ -94,9 +95,8 @@ export function createSelection({
layerState._missionZoomAnchorRemover();
layerState._missionZoomAnchorRemover = null;
layerState._missionZoomAnchorId = null;
if (layerState._viewer?.camera && !layerState._replayCameraLaunchId) {
layerState._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
}
if (!layerState._replayCameraLaunchId)
findCamera(layerState._viewer)?.release();
}
function startMissionZoomAnchor(launch, initialRange) {
@@ -109,14 +109,11 @@ export function createSelection({
Number(initialRange) || MISSION_GLOBE_VIEW_RANGE_M,
);
layerState._missionZoomAnchorId = launch.id;
layerState._viewer.camera.lookAt(
target,
new Cesium.HeadingPitchRange(
0,
parts.camera.missionZoomPitch(range),
range,
),
);
cameraOf(layerState._viewer).lookAt(target, {
heading: 0,
pitch: parts.camera.missionZoomPitch(range),
range,
});
}
function focusMission(launch) {