use crate::Float;
use crate::core::texture::{TextureEvalContext, TextureMapping3D};
use crate::utils::noise::turbulence;

#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct WrinkledTexture {
    pub mapping: TextureMapping3D,
    pub octaves: u32,
    pub omega: Float,
}

impl WrinkledTexture {
    pub fn evaluate(&self, ctx: &TextureEvalContext) -> Float {
        let c = self.mapping.map(ctx);
        turbulence(c.p, c.dpdx, c.dpdy, self.omega, self.octaves)
    }
}
