1
0
Fork 0
forked from wry/wry

metal: commit 1.5ms before the next page flip

This commit is contained in:
Julian Orth 2024-09-10 14:28:06 +02:00
parent a37ce1acda
commit 87d60d267e
4 changed files with 105 additions and 9 deletions

View file

@ -7,7 +7,6 @@ pub struct GeometricDecay {
}
impl GeometricDecay {
#[expect(dead_code)]
pub fn new(mut p1: f64, reset: u64) -> Self {
if p1.is_nan() || p1 < 0.01 {
p1 = 0.01;
@ -23,17 +22,14 @@ impl GeometricDecay {
}
}
#[expect(dead_code)]
pub fn reset(&self, v: u64) {
self.v.set(v as f64 / self.p1);
}
#[expect(dead_code)]
pub fn get(&self) -> u64 {
(self.p1 * self.v.get()) as u64
}
#[expect(dead_code)]
pub fn add(&self, n: u64) {
let v = n as f64 + self.p2 * self.v.get();
self.v.set(v);