From 682ff61f94931ef205a9f81e7d00417ac88537c1 Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 6 Oct 2020 15:23:48 +0200 Subject: Don't let the PubSub internal offsets overflow + fix some warnings. --- src/geometry/broad_phase_multi_sap.rs | 6 +++--- src/geometry/collider_set.rs | 2 +- src/geometry/narrow_phase.rs | 8 ++++---- src/geometry/waabb.rs | 6 +----- src/geometry/wquadtree.rs | 3 +++ 5 files changed, 12 insertions(+), 13 deletions(-) (limited to 'src/geometry') diff --git a/src/geometry/broad_phase_multi_sap.rs b/src/geometry/broad_phase_multi_sap.rs index 0add089..d85eae3 100644 --- a/src/geometry/broad_phase_multi_sap.rs +++ b/src/geometry/broad_phase_multi_sap.rs @@ -1,6 +1,6 @@ -use crate::data::pubsub::PubSubCursor; +use crate::data::pubsub::Subscription; use crate::dynamics::RigidBodySet; -use crate::geometry::{Collider, ColliderHandle, ColliderSet, RemovedCollider}; +use crate::geometry::{ColliderHandle, ColliderSet, RemovedCollider}; use crate::math::{Point, Vector, DIM}; #[cfg(feature = "enhanced-determinism")] use crate::utils::FxHashMap32 as HashMap; @@ -417,7 +417,7 @@ impl SAPRegion { pub struct BroadPhase { proxies: Proxies, regions: HashMap, SAPRegion>, - removed_colliders: Option>, + removed_colliders: Option>, deleted_any: bool, // We could think serializing this workspace is useless. // It turns out is is important to serialize at least its capacity diff --git a/src/geometry/collider_set.rs b/src/geometry/collider_set.rs index dbdd2a4..5ac9658 100644 --- a/src/geometry/collider_set.rs +++ b/src/geometry/collider_set.rs @@ -83,7 +83,7 @@ impl ColliderSet { /* * Delete the collider from its parent body. */ - if let Some(mut parent) = bodies.get_mut_internal(collider.parent) { + if let Some(parent) = bodies.get_mut_internal(collider.parent) { parent.remove_collider_internal(handle, &collider); bodies.wake_up(collider.parent, true); } diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index 60c5e1a..ebe0a79 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -14,13 +14,13 @@ use crate::geometry::proximity_detector::{ // proximity_detector::ProximityDetectionContextSimd, WBall, //}; use crate::geometry::{ - BroadPhasePairEvent, Collider, ColliderGraphIndex, ColliderHandle, ContactEvent, - ProximityEvent, ProximityPair, RemovedCollider, + BroadPhasePairEvent, ColliderGraphIndex, ColliderHandle, ContactEvent, ProximityEvent, + ProximityPair, RemovedCollider, }; use crate::geometry::{ColliderSet, ContactManifold, ContactPair, InteractionGraph}; //#[cfg(feature = "simd-is-enabled")] //use crate::math::{SimdFloat, SIMD_WIDTH}; -use crate::data::pubsub::PubSubCursor; +use crate::data::pubsub::Subscription; use crate::ncollide::query::Proximity; use crate::pipeline::EventHandler; use std::collections::HashMap; @@ -31,7 +31,7 @@ use std::collections::HashMap; pub struct NarrowPhase { contact_graph: InteractionGraph, proximity_graph: InteractionGraph, - removed_colliders: Option>, + removed_colliders: Option>, // ball_ball: Vec, // Workspace: Vec<*mut ContactPair>, // shape_shape: Vec, // Workspace: Vec<*mut ContactPair>, // ball_ball_prox: Vec, // Workspace: Vec<*mut ProximityPair>, diff --git a/src/geometry/waabb.rs b/src/geometry/waabb.rs index cc420d9..645ac04 100644 --- a/src/geometry/waabb.rs +++ b/src/geometry/waabb.rs @@ -93,10 +93,6 @@ impl<'de> serde::Deserialize<'de> for WAABB { } impl WAABB { - pub fn new(mins: Point, maxs: Point) -> Self { - Self { mins, maxs } - } - pub fn new_invalid() -> Self { Self::splat(AABB::new_invalid()) } @@ -132,7 +128,7 @@ impl WAABB { for i in 0usize..DIM { let is_not_zero = ray.dir[i].simd_ne(_0); let is_zero_test = - (ray.origin[i].simd_ge(self.mins[i]) & ray.origin[i].simd_le(self.maxs[i])); + ray.origin[i].simd_ge(self.mins[i]) & ray.origin[i].simd_le(self.maxs[i]); let is_not_zero_test = { let denom = _1 / ray.dir[i]; let mut inter_with_near_plane = diff --git a/src/geometry/wquadtree.rs b/src/geometry/wquadtree.rs index fe1ba2a..233ebd1 100644 --- a/src/geometry/wquadtree.rs +++ b/src/geometry/wquadtree.rs @@ -379,11 +379,13 @@ impl WQuadtree { } } +#[allow(dead_code)] struct WQuadtreeIncrementalBuilderStep { range: Range, parent: NodeIndex, } +#[allow(dead_code)] struct WQuadtreeIncrementalBuilder { quadtree: WQuadtree, to_insert: Vec, @@ -391,6 +393,7 @@ struct WQuadtreeIncrementalBuilder { indices: Vec, } +#[allow(dead_code)] impl WQuadtreeIncrementalBuilder { pub fn new() -> Self { Self { -- cgit