noise_functions/
noise_fn.rs1use crate::{Noise, Sample};
2
3pub struct NoiseFn<F, const WITH_SEED: bool>(pub F);
7
8impl<F, const WITH_SEED: bool> Noise for NoiseFn<F, WITH_SEED> {}
9
10impl<const DIM: usize, Point, F> Sample<DIM, Point> for NoiseFn<F, false>
11where
12 F: Fn(Point) -> f32,
13{
14 fn sample_with_seed(&self, point: Point, _seed: i32) -> f32 {
15 self.0(point)
16 }
17}
18
19impl<const DIM: usize, Point, F> Sample<DIM, Point> for NoiseFn<F, true>
20where
21 F: Fn(Point, i32) -> f32,
22{
23 fn sample_with_seed(&self, point: Point, seed: i32) -> f32 {
24 self.0(point, seed)
25 }
26}