#![cfg_attr(target_arch = "spirv", no_std)]
#![allow(unexpected_cfgs)]

pub use spirv_std::glam;

#[cfg(feature = "ema")]
pub mod ema;

#[cfg(feature = "msme")]
pub mod msme;

#[cfg(feature = "sm")]
pub mod sm;

///Shared Estimator trait, generic over the type of [Estimator::Val].
pub trait Estimator {
    ///The data type of what is being estimated.
    type Val;
    fn push(&mut self, new: Self::Val) -> Self::Val;
}

pub fn smoothstep(edge0: f32, edge1: f32, x: f32) -> f32 {
    let t = ((x - edge0) / (edge1 - edge0)).clamp(0.0, 1.0);
    t * t * (3.0 - 2.0 * t)
}
