pub struct Noise {
pub kind: NoiseKind,
pub seed: u32,
pub frequency: f32,
pub octaves: u32,
pub lacunarity: f32,
pub gain: f32,
pub warp: f32,
}Expand description
Full-featured fractal noise. sample* return -1..1, sample01* return 0..1.
Fields§
§kind: NoiseKindBase noise family used for each octave.
seed: u32Deterministic lattice seed.
frequency: f32Features per world unit.
octaves: u32Number of layered octaves (1 = plain noise).
lacunarity: f32Frequency multiplier between octaves.
gain: f32Amplitude multiplier between octaves.
warp: f32Domain warp strength (0 = off): bends the lookup position with more noise.
Implementations§
Source§impl Noise
impl Noise
Sourcepub fn new(kind: NoiseKind) -> Self
pub fn new(kind: NoiseKind) -> Self
Creates fractal noise of the chosen family with default sampling parameters.
Sourcepub fn with_frequency(self, f: f32) -> Self
pub fn with_frequency(self, f: f32) -> Self
Builder: sets features per input unit.
Sourcepub fn with_octaves(self, o: u32) -> Self
pub fn with_octaves(self, o: u32) -> Self
Builder: sets the octave count; sampling clamps it to a bounded range.
Sourcepub fn sample3(&self, x: f32, y: f32, z: f32) -> f32
pub fn sample3(&self, x: f32, y: f32, z: f32) -> f32
Samples three-dimensional fractal noise, nominally in -1..1. Octaves are bounded to 1..32; non-finite inputs or results return zero.
Sourcepub fn sample2(&self, x: f32, y: f32) -> f32
pub fn sample2(&self, x: f32, y: f32) -> f32
Samples the XY plane of the three-dimensional noise at Z = 0.
Sourcepub fn sample01(&self, x: f32, y: f32, z: f32) -> f32
pub fn sample01(&self, x: f32, y: f32, z: f32) -> f32
Samples noise remapped and clamped into 0..1.
Sourcepub fn curl2(&self, x: f32, y: f32) -> Vec2
pub fn curl2(&self, x: f32, y: f32) -> Vec2
Divergence-free 2D flow field (for swirling particles, smoke, water).
Trait Implementations§
impl Copy for Noise
impl StructuralPartialEq for Noise
Auto Trait Implementations§
impl Freeze for Noise
impl RefUnwindSafe for Noise
impl Send for Noise
impl Sync for Noise
impl Unpin for Noise
impl UnsafeUnpin for Noise
impl UnwindSafe for Noise
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSync for T
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.