pub struct SPHSimulator {
pub h: f32,
pub rest_density: f32,
pub stiffness: f32,
pub gamma: f32,
pub viscosity: f32,
pub surface_tension: f32,
pub gravity: Vec3,
/* private fields */
}Expand description
Simplified SPH solver tailored for the Chaos RPG game-layer fluid system.
Uses the cubic spline kernel from crate::physics::fluids, Tait equation
of state for pressure, artificial viscosity, simple surface tension via
colour-field gradient, and type-specific external forces (buoyancy, drag).
Fields§
§h: f32Smoothing radius h.
rest_density: f32Reference rest density.
stiffness: f32Tait stiffness B.
gamma: f32Tait gamma.
viscosity: f32Base viscosity coefficient (multiplied by per-particle viscosity).
surface_tension: f32Surface tension coefficient.
gravity: Vec3Global gravity.
Implementations§
Source§impl SPHSimulator
impl SPHSimulator
Sourcepub fn with_smoothing_radius(self, h: f32) -> Self
pub fn with_smoothing_radius(self, h: f32) -> Self
Create with a custom smoothing radius.
Sourcepub fn with_stiffness(self, b: f32) -> Self
pub fn with_stiffness(self, b: f32) -> Self
Create with custom stiffness.
Sourcepub fn step(&mut self, particles: &mut [FluidParticle], dt: f32)
pub fn step(&mut self, particles: &mut [FluidParticle], dt: f32)
Run one full SPH step: rebuild grid, find neighbours, compute forces, integrate.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SPHSimulator
impl RefUnwindSafe for SPHSimulator
impl Send for SPHSimulator
impl Sync for SPHSimulator
impl Unpin for SPHSimulator
impl UnsafeUnpin for SPHSimulator
impl UnwindSafe for SPHSimulator
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.