Pull out shared smoothFollow logic

This commit is contained in:
wheaney 2026-06-08 18:13:18 -07:00
parent 00ec9ed593
commit 254fff37ff
2 changed files with 2 additions and 12 deletions

@ -1 +1 @@
Subproject commit 65376ad92e0cecfc0bf77ced15ed0d32e33c6f82
Subproject commit f8e9aeb9a240a40d5c5608821847dc4dfccddfad

View File

@ -6,17 +6,7 @@ import Shell from 'gi://Shell';
import Globals from './globals.js';
import { degreeToRadian, diagonalToCrossFOVs, fovConversionFns } from './shared/math.js';
// these need to mirror the values in XRLinuxDriver
// https://github.com/wheaney/XRLinuxDriver/blob/main/src/plugins/smooth_follow.c#L31
export const SMOOTH_FOLLOW_SLERP_TIMELINE_MS = 1000;
const SMOOTH_FOLLOW_SLERP_FACTOR = Math.pow(1-0.999, 1/SMOOTH_FOLLOW_SLERP_TIMELINE_MS);
// this mirror's how the driver's slerp function progresses so our effect will match it
function smoothFollowSlerpProgress(elapsedMs) {
return 1 - Math.pow(SMOOTH_FOLLOW_SLERP_FACTOR, elapsedMs);
}
import { SMOOTH_FOLLOW_SLERP_TIMELINE_MS, smoothFollowSlerpProgress } from './shared/smoothFollow.js';
// how far to look ahead is how old the IMU data is plus a constant that is either the default for this device or an override
function lookAheadMS(imuDateMs, lookAheadCfg, override) {