Pull out shared smoothFollow logic
This commit is contained in:
parent
00ec9ed593
commit
254fff37ff
|
|
@ -1 +1 @@
|
||||||
Subproject commit 65376ad92e0cecfc0bf77ced15ed0d32e33c6f82
|
Subproject commit f8e9aeb9a240a40d5c5608821847dc4dfccddfad
|
||||||
|
|
@ -6,17 +6,7 @@ import Shell from 'gi://Shell';
|
||||||
|
|
||||||
import Globals from './globals.js';
|
import Globals from './globals.js';
|
||||||
import { degreeToRadian, diagonalToCrossFOVs, fovConversionFns } from './shared/math.js';
|
import { degreeToRadian, diagonalToCrossFOVs, fovConversionFns } from './shared/math.js';
|
||||||
|
import { SMOOTH_FOLLOW_SLERP_TIMELINE_MS, smoothFollowSlerpProgress } from './shared/smoothFollow.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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
// 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) {
|
function lookAheadMS(imuDateMs, lookAheadCfg, override) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue