pub struct TurbulenceForce {
pub strength: f32,
pub frequency: f32,
pub time_offset: f32,
}Expand description
Pseudo-random turbulence force using a curl-noise-like field.
Uses a deterministic hash to approximate a divergence-free velocity field, giving swirling motion without requiring full Perlin noise.
Fields§
§strength: f32Turbulence strength (max velocity perturbation per second).
frequency: f32Spatial frequency of the noise field.
time_offset: f32Time offset (varies the noise over time).
Implementations§
Source§impl TurbulenceForce
impl TurbulenceForce
Sourcepub fn curl_at(&self, pos: [f32; 3]) -> [f32; 3]
pub fn curl_at(&self, pos: [f32; 3]) -> [f32; 3]
Compute curl-noise-like perturbation at a world position.
Approximates curl(noise_field) using finite differences.
Sourcepub fn apply(&self, particle: &mut GpuParticle, dt: f32)
pub fn apply(&self, particle: &mut GpuParticle, dt: f32)
Apply turbulence to a single particle.
Sourcepub fn apply_all(&self, particles: &mut [GpuParticle], dt: f32)
pub fn apply_all(&self, particles: &mut [GpuParticle], dt: f32)
Apply turbulence to all alive particles.
Trait Implementations§
Source§impl Clone for TurbulenceForce
impl Clone for TurbulenceForce
Source§fn clone(&self) -> TurbulenceForce
fn clone(&self) -> TurbulenceForce
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TurbulenceForce
impl Debug for TurbulenceForce
impl Copy for TurbulenceForce
Auto Trait Implementations§
impl Freeze for TurbulenceForce
impl RefUnwindSafe for TurbulenceForce
impl Send for TurbulenceForce
impl Sync for TurbulenceForce
impl Unpin for TurbulenceForce
impl UnsafeUnpin for TurbulenceForce
impl UnwindSafe for TurbulenceForce
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 more