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§
Source§impl NoiseConfig
impl NoiseConfig
Sourcepub fn new(
octaves: i32,
x_frequency: f32,
y_frequency: f32,
amplitude: f32,
lacunarity: f32,
gain: f32,
range: (f32, f32),
seed: u64,
) -> Self
pub fn new( octaves: i32, x_frequency: f32, y_frequency: f32, amplitude: f32, lacunarity: f32, gain: f32, range: (f32, f32), seed: u64, ) -> Self
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.
Sourcepub fn generate_range(&self, x: f32, y: f32) -> f32
pub fn generate_range(&self, x: f32, y: f32) -> f32
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.
Sourcepub fn generate_rangeless(&self, x: f32, y: f32) -> f32
pub fn generate_rangeless(&self, x: f32, y: f32) -> f32
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.
Sourcepub fn generate_raw_range(&self, x: f32, y: f32) -> f32
pub fn generate_raw_range(&self, x: f32, y: f32) -> f32
Generates raw simplex values. DOES NOT apply FBM. Converts return value to the range specified in the NoiseConfig.
Sourcepub fn generate_raw(&self, x: f32, y: f32) -> f32
pub fn generate_raw(&self, x: f32, y: f32) -> f32
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.
Sourcepub fn analyze(&self, amount: i32)
pub fn analyze(&self, amount: i32)
Outputs data on a noise configuration. This feature is incomplete. Please suggest more analysis data on Github.
Sourcepub fn output(&self, size: i32, vector: &Vec<char>)
pub fn output(&self, size: i32, vector: &Vec<char>)
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);
}