pub struct GpuBroadphase {
pub bodies: Vec<GpuRigidBody>,
pub radii: Vec<f32>,
}Expand description
Broadphase collision detection for GPU rigid bodies using a sweep-and-prune (SAP) approach.
Each body is approximated by a sphere; overlapping sphere AABBs are reported as candidate pairs.
Fields§
§bodies: Vec<GpuRigidBody>Bodies to test.
radii: Vec<f32>Bounding sphere radii, one per body.
Implementations§
Source§impl GpuBroadphase
impl GpuBroadphase
Sourcepub fn add_body(&mut self, body: GpuRigidBody, radius: f32)
pub fn add_body(&mut self, body: GpuRigidBody, radius: f32)
Add a body with its bounding sphere radius.
Sourcepub fn compute_pairs_sap(&self) -> Vec<BroadphasePairGpu>
pub fn compute_pairs_sap(&self) -> Vec<BroadphasePairGpu>
Run a sort-and-sweep on the X axis and return overlapping pairs.
Only pairs whose AABBs overlap on all three axes are returned.
Trait Implementations§
Source§impl Clone for GpuBroadphase
impl Clone for GpuBroadphase
Source§fn clone(&self) -> GpuBroadphase
fn clone(&self) -> GpuBroadphase
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 GpuBroadphase
impl Debug for GpuBroadphase
Source§impl Default for GpuBroadphase
impl Default for GpuBroadphase
Source§fn default() -> GpuBroadphase
fn default() -> GpuBroadphase
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GpuBroadphase
impl RefUnwindSafe for GpuBroadphase
impl Send for GpuBroadphase
impl Sync for GpuBroadphase
impl Unpin for GpuBroadphase
impl UnsafeUnpin for GpuBroadphase
impl UnwindSafe for GpuBroadphase
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