perf: draw at the display's refresh rate while anything moves

Remove the fixed 60 FPS cap. The render governor caps a parked scene at
60 ticks a second, since Cesium still runs the clock, data sources and update
listeners on every animation frame when it skips the draw, and holds
continuous render while the camera moves (moveStart to moveEnd, with pose
sampling for cameras that drift by rounding errors and never raise moveEnd).
Waits that counted frames (a tracked contact's first position, a shared
follow view, a trail's temporary copy) now count drawn time through
src/time/frameWait.js, so they last the same at any refresh rate.
This commit is contained in:
Sameh Khamis committed 2026-11-15 10:41:36 -08:00
1 parent 8d9c907133
commit 9f4254e962
12 files changed
+380 -16

No files matched your search

+5 -4
View File
@@ -1,6 +1,8 @@
import * as Cesium from 'cesium';
import { createFrameWait } from '../time/frameWait.js';
const MAX_FRAME_ATTEMPTS = 120;
/** Drawn time (ms) to wait for the tracked entity's first position. */
const MAX_POSITION_WAIT_MS = 2_000;
const MIN_TRACKED_RANGE_M = 150;
const ZOOM_INERTIA_STATES = new WeakMap();
@@ -154,7 +156,7 @@ export function clampTrackedCameraPosition(
*/
export function applyTrackedCameraFrame(viewer, entity, viewFrom) {
if (!viewer || !entity || !viewFrom) return;
let attempts = 0;
const positionWait = createFrameWait(MAX_POSITION_WAIT_MS);
const trackedTransform = new Cesium.Matrix4();
const trackedPosition = new Cesium.Cartesian3();
const resolvedViewFrom = new Cesium.Cartesian3();
@@ -184,7 +186,6 @@ export function applyTrackedCameraFrame(viewer, entity, viewFrom) {
stop();
return;
}
attempts += framed ? 0 : 1;
// Prefer the display cache exposed by the flight layer. Calling the
// CallbackProperty from preUpdate can advance dead reckoning again while
// Cesium's billboard/label still holds the prior visualizer sample. At a
@@ -198,7 +199,7 @@ export function applyTrackedCameraFrame(viewer, entity, viewFrom) {
trackedPosition,
);
if (!position) {
if (attempts >= MAX_FRAME_ATTEMPTS) stop();
if (positionWait.tick()) stop();
return;
}
const transform = Cesium.Transforms.eastNorthUpToFixedFrame(