Struct simple_simplex::NoiseConfig [−][src]
pub struct NoiseConfig {
pub octaves: i32,
pub x_frequency: f32,
pub y_frequency: f32,
pub amplitude: f32,
pub lacunarity: f32,
pub gain: f32,
pub range: (f32, f32),
pub seed: u64,
pub permutation: [u16; 512],
}
Expand description
The Noise Configuration
The Centerpiece of Simple-Simplex. Once you’ve created a Noise Configuration, you can start generating values. Each variable of the NoiseConfig will affect the outputted value. Call the NoiseConfig::new() constructor to set it up.
Fields
octaves: i32
x_frequency: f32
y_frequency: f32
amplitude: f32
lacunarity: f32
gain: f32
range: (f32, f32)
seed: u64
permutation: [u16; 512]
Implementations
Creates and new Noise Configuration and Defines FBM Values.
Examples:
use simple_simplex::NoiseConfig;
let config = NoiseConfig::new(
3, // octaves
0.01, // x_freq
0.01, // y_freq
0.05, // amplitude
2.5, // lacunarity
0.5, // gain
(256.0, 255), // outputted range (max, min)
67893402, // Seed
);
For more information on what these values mean, please read the GitHub Documentation.
Generates a range of values generated with Simplex Noise, and enhanced with Fractal Brownian Motion. Returns a simplex noise value WITH Fractal Brownian Motion (FBM) applied. This value is also converted into a range.
Generates Simplex Noise Values, and then applies Fractal Brownian Motion. Returns a Simplex Noise value WITH FBM applied. This is NOT converted into a range.
Generates raw simplex values. DOES NOT apply FBM. Converts return value to the range specified in the NoiseConfig.
generates raw values, with no FBM or range conversion. returns a simplex noise value WITHOUT Fractal Brownian Motion and IS NOT converted into the specified range.
Outputs data on a noise configuration. This feature is incomplete. Please suggest more analysis data on Github.
Output generates noise values to terminal. Width should not be wider than your terminal can handle.
Note: The range
of the noise config you output must correlate with theh length of the vector
of characters used.
Examples:
use simple_simplex::NoiseConfig;
fn main() {
let vector: Vec<char> = vec![' ',' ', ' ', '.', '-', '=', 'z','X', '#'];
let config: NoiseConfig = NoiseConfig::new(
3, // Octaves
0.01, // X-Frequency
0.01, // Y-Frequency
0.05, // Amplitude
2.5, // Lacunarity
0.5, // Gain
(0.0, (vector.len() - 1) as f32), // range, must be 0, vector.len() -1 when using output.
97838586 // seed
);
config.output(150, &vector);
}
Outputs a noisemap onto Terminal in 1d form.
The length
is the width of the outputted map. For starters,
try 100.
The Height
is the height of the map. For starters, try 30
.
Examples
// Create a noise config called `config`
config.output_1d(30, 100);