by webkike · 4y ago · 0 comments
A Rust trait with an associated const would help with this:
trait TimeDependentFn {
const PERIOD: f32;
type Output;
fn call(&self, dt: f32) -> Self::Output;
}so you're stuck doing it from scratch every pixel. that's fine, shaders are fast.
at most it might make sense to calculate a truncated time globally per frame and provide that as a uniform.