mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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:
1 parent
8d9c907133
commit
9f4254e962
12 files changed
+380
-16
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import * as Cesium from 'cesium';
|
||||
import { trackedDisplayPositionForCamera } from '../data/trackedCamera.js';
|
||||
import { createFrameWait } from '../time/frameWait.js';
|
||||
import {
|
||||
SHARE_VIEW_ENTITY_KINDS,
|
||||
SHARE_VIEW_FOLLOW_RANGE_MAX_M,
|
||||
@@ -17,7 +18,8 @@ import {
|
||||
const KIND_BY_LAYER = new Map(
|
||||
SHARE_VIEW_ENTITY_KINDS.map((entry) => [entry.layerId, entry.kind]),
|
||||
);
|
||||
const MAX_FRAMES = 120;
|
||||
/** Drawn time (ms) to wait for the follow to frame the entity. */
|
||||
const MAX_FRAMING_WAIT_MS = 2_000;
|
||||
|
||||
/** `position`'s local east/north/up offset from `origin`, in metres. */
|
||||
function enuOffset(origin, position) {
|
||||
@@ -136,6 +138,7 @@ export function applyShareFollowOffset(viewer, entity, offset) {
|
||||
return () => {};
|
||||
const local = followOffsetToEnu(offset);
|
||||
let frames = 0;
|
||||
const framingWait = createFrameWait(MAX_FRAMING_WAIT_MS);
|
||||
let remove = null;
|
||||
const stop = () => {
|
||||
remove?.();
|
||||
@@ -160,7 +163,7 @@ export function applyShareFollowOffset(viewer, entity, offset) {
|
||||
)
|
||||
: null;
|
||||
if (!target) {
|
||||
if (frames >= MAX_FRAMES) stop();
|
||||
if (framingWait.tick()) stop();
|
||||
return;
|
||||
}
|
||||
// The offset is east/north/up at the entity; the follow's own frame may
|
||||
|
||||
Reference in new issue
Block a user