i128 not necessary in this case and use glam

This commit is contained in:
Quaternions 2023-09-10 14:03:29 -07:00
parent 6ada08ef6f
commit c7da64cc64

View File

@ -58,18 +58,13 @@ impl MouseInterpolationState {
match self.interpolation {
MouseInterpolation::First => self.mouse0,
MouseInterpolation::Lerp => {
//a 5 hour run uses 45 bits of TIME
//mouse positions may accumulate on a map where the player spins, especially for high dpi...
let x0=self.mouse0.x as i128;
let y0=self.mouse0.y as i128;
let x1=self.mouse1.x as i128;
let y1=self.mouse1.y as i128;
let t1t=(self.time1-time) as i128;
let tt0=(time-self.time0) as i128;
let dt=(self.time1-self.time0) as i128;
glam::ivec2(
((x0*t1t+x1*tt0)/dt) as i32,
((y0*t1t+y1*tt0)/dt) as i32)
let m0=self.mouse0.as_i64vec2();
let m1=self.mouse1.as_i64vec2();
//these are deltas
let t1t=(self.time1-time) as i64;
let tt0=(time-self.time0) as i64;
let dt=(self.time1-self.time0) as i64;
((m0*t1t+m1*tt0)/dt).as_ivec2()
}
}
}