NoiseConfig

Struct NoiseConfig 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn analyze(&self, amount: i32)

Outputs data on a noise configuration. This feature is incomplete. Please suggest more analysis data on Github.

Source

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);
}
Source

pub fn output_1d(&self, length: i32, height: i32)

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);

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V