noise #
noise
This module aims to to implement noise algorithms.
It uses the rand
module in vlib to generate random numbers, so you may seed the generator as you see fit.
fn Generator.new #
fn Generator.new() Generator
new is a function that return a new Generator struct
struct Generator #
struct Generator {
mut:
perm []int = rand.shuffle_clone(permutations) or { panic(err) }
}
Generator is a struct holding the permutation table used in perlin and simplex noise
fn (Generator) perlin2d #
fn (generator Generator) perlin2d(x f64, y f64) f64
perlin2d is a function that return a single value of perlin noise for a given 2d position
fn (Generator) perlin3d #
fn (generator Generator) perlin3d(x f64, y f64, z f64) f64
perlin3d is a function that return a single value of perlin noise for a given 3d position
fn (Generator) randomize #
fn (mut generator Generator) randomize()
randomize is a function that shuffle the permutation set inside the Generator struct will not shuffle if rand.seed is not changed
fn (Generator) simplex_1d #
fn (generator Generator) simplex_1d(x f64) f64
simplex_1d returns a simplex noise value for a given x position
fn (Generator) simplex_2d #
fn (generator Generator) simplex_2d(x f64, y f64) f64
simplex_2d returns a simplex noise value for a given x, y position
fn (Generator) simplex_3d #
fn (generator Generator) simplex_3d(x f64, y f64, z f64) f64
simplex_3d returns a simplex noise value for a given x, y, z position
fn (Generator) simplex_4d #
fn (generator Generator) simplex_4d(x f64, y f64, z f64, w f64) f64
simplex_4d returns a simplex noise value for a given x, y, z, w position