1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
//! A simple, performant, and customizable procedural noise generation library.
//!
//! Libnoise provides utilities to generate coherent noise and customize them
//! by applying a variety of operations which modify and combine generators.
//! With a focus on customizability, the library allows users to create custom
//! generators and modifiers.
//!
//! Most immediately relevant documentation can be found in [`Source`] and
//! [`Generator`].
//!
//! # Quickstart
//!
//! To get started easily, create a source generator using one of the many
//! sources found in [`Source`], and apply adapters documented in [`Generator`].
//!
//! ```
//! use libnoise::prelude::*;
//!
//! // build a simplex noise generator seeded with 42
//! let generator = Source::simplex(42);
//!
//! // sample the generator for input point [0.2, 0.5]
//! let value = generator.sample([0.2, 0.5]);
//! ```
//!
//! Note how the dimensionality, which is internally represented as a constant
//! generic argument, is automatically inferred by sampling the generator with
//! a 2-dimensional input point.
//!
//! Naturally, we can create more interesting complex generators:
//!
//! ```
//! use libnoise::prelude::*;
//!
//! // build a generator
//! let generator = Source::simplex(42) // start with simplex noise
//! .fbm(5, 0.013, 2.0, 0.5) // apply fractal brownian motion
//! .blend( // apply blending...
//! Source::worley(43).scale([0.05, 0.05]), // ...with scaled worley noise
//! Source::worley(44).scale([0.02, 0.02])) // ...controlled by other worley noise
//! .lambda(|f| (f * 2.0).sin() * 0.3 + f * 0.7 ); // apply a closure to the noise
//!
//! // sample the generator for input point [0.2, 0.5]
//! let value = generator.sample([0.2, 0.5]);
//! ```
//!
//! We can also use [`NoiseBuffer`] for efficiently filling n-dimensional arrays
//! with noise, and [`Visualizer`] to get a visual representation of a given
//! generator. The above generator produces the following image, when sampled for
//! every pixel position:
//!
//! 
//!
//! It is common to interpret the 3rd or 4th dimension as time, allowing us to
//! produce space-time noise such as:
//!
//! 
mod core;
pub mod prelude;
pub use crate::core::adapters::*;
#[cfg(feature = "dev-tools")]
pub use crate::core::devtools;
pub use crate::core::generator::*;
pub use crate::core::source::Source;
pub use crate::core::sources::*;
pub use crate::core::utils::noisebuf::NoiseBuffer;
#[cfg(feature = "image")]
pub use crate::core::utils::visualizer::Visualizer;