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

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

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