pub struct ClothRopeManager {
pub cloths: Vec<(ClothId, ClothStrip)>,
pub ropes: Vec<(RopeId, RopeChain)>,
pub soft_bodies: Vec<(SoftBodyId, SoftBodyBlob)>,
/* private fields */
}Expand description
Central manager owning all active cloth, rope, and soft body instances. Steps all each frame, removes expired ones, and provides render data.
Fields§
§cloths: Vec<(ClothId, ClothStrip)>§ropes: Vec<(RopeId, RopeChain)>§soft_bodies: Vec<(SoftBodyId, SoftBodyBlob)>Implementations§
Source§impl ClothRopeManager
impl ClothRopeManager
pub fn new() -> Self
Sourcepub fn add_cloth(&mut self, cloth: ClothStrip) -> Option<ClothId>
pub fn add_cloth(&mut self, cloth: ClothStrip) -> Option<ClothId>
Add a cloth strip. Returns None if the limit is reached.
Sourcepub fn add_rope(&mut self, rope: RopeChain) -> Option<RopeId>
pub fn add_rope(&mut self, rope: RopeChain) -> Option<RopeId>
Add a rope chain. Returns None if the limit is reached.
Sourcepub fn add_soft_body(&mut self, blob: SoftBodyBlob) -> Option<SoftBodyId>
pub fn add_soft_body(&mut self, blob: SoftBodyBlob) -> Option<SoftBodyId>
Add a soft body blob. Returns None if the limit is reached.
pub fn remove_cloth(&mut self, id: ClothId)
pub fn remove_rope(&mut self, id: RopeId)
pub fn remove_soft_body(&mut self, id: SoftBodyId)
pub fn get_cloth_mut(&mut self, id: ClothId) -> Option<&mut ClothStrip>
pub fn get_rope_mut(&mut self, id: RopeId) -> Option<&mut RopeChain>
pub fn get_soft_body_mut(&mut self, id: SoftBodyId) -> Option<&mut SoftBodyBlob>
Sourcepub fn step_all(&mut self, dt: f32)
pub fn step_all(&mut self, dt: f32)
Step all active cloth, rope, and soft body instances, then remove any that have expired.
Sourcepub fn cloth_render_data(&self) -> Vec<(ClothId, Vec<[f32; 3]>)>
pub fn cloth_render_data(&self) -> Vec<(ClothId, Vec<[f32; 3]>)>
Collect render data for all cloth strips.
Sourcepub fn soft_body_render_data(&self) -> Vec<(SoftBodyId, Vec<Vec3>)>
pub fn soft_body_render_data(&self) -> Vec<(SoftBodyId, Vec<Vec3>)>
Collect render data for all soft bodies.
pub fn cloth_count(&self) -> usize
pub fn rope_count(&self) -> usize
pub fn soft_body_count(&self) -> usize
pub fn total_count(&self) -> usize
Sourcepub fn total_point_count(&self) -> usize
pub fn total_point_count(&self) -> usize
Total number of simulated points across all instances.
Trait Implementations§
Source§impl Clone for ClothRopeManager
impl Clone for ClothRopeManager
Source§fn clone(&self) -> ClothRopeManager
fn clone(&self) -> ClothRopeManager
Returns a duplicate of the value. Read more
1.0.0 · 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 ClothRopeManager
impl Debug for ClothRopeManager
Auto Trait Implementations§
impl Freeze for ClothRopeManager
impl RefUnwindSafe for ClothRopeManager
impl Send for ClothRopeManager
impl Sync for ClothRopeManager
impl Unpin for ClothRopeManager
impl UnsafeUnpin for ClothRopeManager
impl UnwindSafe for ClothRopeManager
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> 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.