pub struct ClothSimulation {Show 22 fields
pub particles: Vec<ClothParticle>,
pub springs: Vec<ClothSpring>,
pub grid_width: usize,
pub grid_height: usize,
pub total_mass: f32,
pub stretch_stiffness: f32,
pub shear_stiffness: f32,
pub bend_stiffness: f32,
pub stretch_damping: f32,
pub shear_damping: f32,
pub bend_damping: f32,
pub gravity: Vec3,
pub wind_velocity: Vec3,
pub wind_turbulence: f32,
pub drag_coefficient: f32,
pub thickness: f32,
pub self_collision_enabled: bool,
pub self_collision_radius: f32,
pub tearing_enabled: bool,
pub global_tear_threshold: f32,
pub pinned_vertices: HashSet<usize>,
pub iterations: u32,
}Fields§
§particles: Vec<ClothParticle>§springs: Vec<ClothSpring>§grid_width: usize§grid_height: usize§total_mass: f32§stretch_stiffness: f32§shear_stiffness: f32§bend_stiffness: f32§stretch_damping: f32§shear_damping: f32§bend_damping: f32§gravity: Vec3§wind_velocity: Vec3§wind_turbulence: f32§drag_coefficient: f32§thickness: f32§self_collision_enabled: bool§self_collision_radius: f32§tearing_enabled: bool§global_tear_threshold: f32§pinned_vertices: HashSet<usize>§iterations: u32Implementations§
Source§impl ClothSimulation
impl ClothSimulation
pub fn new( width: usize, height: usize, cell_size: f32, mass_per_particle: f32, ) -> Self
pub fn pin_vertex(&mut self, idx: usize)
pub fn unpin_vertex(&mut self, idx: usize)
Sourcepub fn wind_force_on_triangle(
&self,
p0: Vec3,
p1: Vec3,
p2: Vec3,
time: f32,
) -> Vec3
pub fn wind_force_on_triangle( &self, p0: Vec3, p1: Vec3, p2: Vec3, time: f32, ) -> Vec3
Compute wind force on a triangle given its vertices
Sourcepub fn solve_springs(&mut self, dt: f32)
pub fn solve_springs(&mut self, dt: f32)
Solve spring constraints (Gauss-Seidel)
Sourcepub fn compute_normals(&mut self)
pub fn compute_normals(&mut self)
Compute vertex normals from mesh connectivity
Trait Implementations§
Source§impl Clone for ClothSimulation
impl Clone for ClothSimulation
Auto Trait Implementations§
impl Freeze for ClothSimulation
impl RefUnwindSafe for ClothSimulation
impl Send for ClothSimulation
impl Sync for ClothSimulation
impl Unpin for ClothSimulation
impl UnsafeUnpin for ClothSimulation
impl UnwindSafe for ClothSimulation
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.