Crate noise_functions

source ·
Expand description

Fast and lightweight noise algorithm implementations.

Check out the live demo!

use noise_functions::{ Perlin, OpenSimplex2s, Sample2, SampleFn };

let point = [1.0, 2.0];

let value = Perlin.sample2(point);
let value = Perlin.seed(42).sample2(point);
let value = Perlin.fbm(3, 0.5, 3.0).sample2(point);
let value = Perlin.fbm(3, 0.5, 3.0).seed(42).sample2(point);

let warped_noise = |pos: [f32; 2]| {
    let warp_x = OpenSimplex2s.seed(1).sample2(pos);
    let warp_y = OpenSimplex2s.seed(2).sample2(pos);
    let warped = [pos[0] + warp_x, pos[1] + warp_y];
    OpenSimplex2s.sample2(warped)
};

let value = warped_noise(point);

The implementation of these noise functions are from FastNoiseLite (github/crate).

Modules§

Structs§

Traits§

  • Helper trait that provides sample2 as a shorthand for Sample<2, [f32; 2]>::sample.
  • Sample2anightly-simd
    Helper trait that provides sample2a as a shorthand for Sample<2, f32x2>::sample.
  • Helper trait that provides sample3 as a shorthand for Sample<3, [f32; 3]>::sample.
  • Sample3anightly-simd
    Helper trait that provides sample3a as a shorthand for Sample<3, f32x4>::sample.

Functions§