diff options
Diffstat (limited to 'src/pipeline')
| -rw-r--r-- | src/pipeline/collision_pipeline.rs | 2 | ||||
| -rw-r--r-- | src/pipeline/debug_render_pipeline/debug_render_backend.rs | 10 | ||||
| -rw-r--r-- | src/pipeline/debug_render_pipeline/debug_render_pipeline.rs | 9 | ||||
| -rw-r--r-- | src/pipeline/debug_render_pipeline/mod.rs | 2 | ||||
| -rw-r--r-- | src/pipeline/debug_render_pipeline/outlines.rs | 1 | ||||
| -rw-r--r-- | src/pipeline/physics_hooks.rs | 2 | ||||
| -rw-r--r-- | src/pipeline/physics_pipeline.rs | 13 | ||||
| -rw-r--r-- | src/pipeline/query_pipeline.rs | 9 | ||||
| -rw-r--r-- | src/pipeline/user_changes.rs | 14 |
9 files changed, 32 insertions, 30 deletions
diff --git a/src/pipeline/collision_pipeline.rs b/src/pipeline/collision_pipeline.rs index 796cc84..03396ed 100644 --- a/src/pipeline/collision_pipeline.rs +++ b/src/pipeline/collision_pipeline.rs @@ -149,7 +149,7 @@ impl CollisionPipeline { bodies, colliders, &modified_colliders[..], - &mut removed_colliders, + &removed_colliders, hooks, events, true, diff --git a/src/pipeline/debug_render_pipeline/debug_render_backend.rs b/src/pipeline/debug_render_pipeline/debug_render_backend.rs index cddf204..664bf46 100644 --- a/src/pipeline/debug_render_pipeline/debug_render_backend.rs +++ b/src/pipeline/debug_render_pipeline/debug_render_backend.rs @@ -79,12 +79,10 @@ pub trait DebugRenderBackend { self.draw_line(object, a, b, color); } - if closed { - if vertices.len() > 2 { - let a = transform * (Scale::from(*scale) * vertices[0]); - let b = transform * (Scale::from(*scale) * vertices.last().unwrap()); - self.draw_line(object, a, b, color); - } + if closed && vertices.len() > 2 { + let a = transform * (Scale::from(*scale) * vertices[0]); + let b = transform * (Scale::from(*scale) * vertices.last().unwrap()); + self.draw_line(object, a, b, color); } } } diff --git a/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs b/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs index 927470a..b429c90 100644 --- a/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs +++ b/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs @@ -41,12 +41,17 @@ impl Default for DebugRenderMode { } } +#[cfg(feature = "dim2")] +type InstancesMap = HashMap<TypeId, Vec<Point<Real>>>; +#[cfg(feature = "dim3")] +type InstancesMap = HashMap<TypeId, (Vec<Point<Real>>, Vec<[u32; 2]>)>; + /// Pipeline responsible for rendering the state of the physics engine for debugging purpose. pub struct DebugRenderPipeline { #[cfg(feature = "dim2")] - instances: HashMap<TypeId, Vec<Point<Real>>>, + instances: InstancesMap, #[cfg(feature = "dim3")] - instances: HashMap<TypeId, (Vec<Point<Real>>, Vec<[u32; 2]>)>, + instances: InstancesMap, /// The style used to compute the line colors for each element /// to render. pub style: DebugRenderStyle, diff --git a/src/pipeline/debug_render_pipeline/mod.rs b/src/pipeline/debug_render_pipeline/mod.rs index 104fd9f..7757344 100644 --- a/src/pipeline/debug_render_pipeline/mod.rs +++ b/src/pipeline/debug_render_pipeline/mod.rs @@ -5,4 +5,4 @@ pub use self::debug_render_style::{DebugColor, DebugRenderStyle}; mod debug_render_backend; mod debug_render_pipeline; mod debug_render_style; -pub(self) mod outlines; +mod outlines; diff --git a/src/pipeline/debug_render_pipeline/outlines.rs b/src/pipeline/debug_render_pipeline/outlines.rs index 01a441e..cd0b6ed 100644 --- a/src/pipeline/debug_render_pipeline/outlines.rs +++ b/src/pipeline/debug_render_pipeline/outlines.rs @@ -17,6 +17,7 @@ pub fn instances(nsubdivs: u32) -> HashMap<TypeId, Vec<Point<Real>>> { } #[cfg(feature = "dim3")] +#[allow(clippy::type_complexity)] pub fn instances(nsubdivs: u32) -> HashMap<TypeId, (Vec<Point<Real>>, Vec<[u32; 2]>)> { let mut result = HashMap::new(); result.insert( diff --git a/src/pipeline/physics_hooks.rs b/src/pipeline/physics_hooks.rs index a391808..11166b5 100644 --- a/src/pipeline/physics_hooks.rs +++ b/src/pipeline/physics_hooks.rs @@ -69,7 +69,7 @@ impl<'a> ContactModificationContext<'a> { // Test the allowed normal with the local-space contact normal that // points towards the exterior of context.collider1. - let contact_is_ok = self.manifold.local_n1.dot(&allowed_local_n1) >= cang; + let contact_is_ok = self.manifold.local_n1.dot(allowed_local_n1) >= cang; match *self.user_data { CONTACT_CONFIGURATION_UNKNOWN => { diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index 5ff78fd..6dbc4e5 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -212,7 +212,7 @@ impl PhysicsPipeline { rb.mprops.update_world_mass_properties(&rb.pos.position); let effective_mass = rb.mprops.effective_mass(); rb.forces - .compute_effective_force_and_torque(&gravity, &effective_mass); + .compute_effective_force_and_torque(gravity, &effective_mass); } self.counters.stages.update_time.pause(); @@ -270,14 +270,13 @@ impl PhysicsPipeline { .enumerate() .for_each(|(island_id, solver)| { let bodies: &mut RigidBodySet = - unsafe { std::mem::transmute(bodies.load(Ordering::Relaxed)) }; + unsafe { &mut *bodies.load(Ordering::Relaxed) }; let manifolds: &mut Vec<&mut ContactManifold> = - unsafe { std::mem::transmute(manifolds.load(Ordering::Relaxed)) }; + unsafe { &mut *manifolds.load(Ordering::Relaxed) }; let impulse_joints: &mut Vec<JointGraphEdge> = - unsafe { std::mem::transmute(impulse_joints.load(Ordering::Relaxed)) }; - let multibody_joints: &mut MultibodyJointSet = unsafe { - std::mem::transmute(multibody_joints.load(Ordering::Relaxed)) - }; + unsafe { &mut *impulse_joints.load(Ordering::Relaxed) }; + let multibody_joints: &mut MultibodyJointSet = + unsafe { &mut *multibody_joints.load(Ordering::Relaxed) }; let mut counters = Counters::new(false); solver.init_and_solve( diff --git a/src/pipeline/query_pipeline.rs b/src/pipeline/query_pipeline.rs index 99ab964..4dc5652 100644 --- a/src/pipeline/query_pipeline.rs +++ b/src/pipeline/query_pipeline.rs @@ -114,6 +114,7 @@ pub struct QueryFilter<'a> { /// If set, any collider attached to this rigid-body will be excluded from the scene query. pub exclude_rigid_body: Option<RigidBodyHandle>, /// If set, any collider for which this closure returns false will be excluded from the scene query. + #[allow(clippy::type_complexity)] // Type doesn’t look really complex? pub predicate: Option<&'a dyn Fn(ColliderHandle, &Collider) -> bool>, } @@ -668,10 +669,10 @@ impl QueryPipeline { /// the shape is penetrating another shape at its starting point **and** its trajectory is such /// that it’s on a path to exist that penetration state. /// * `filter`: set of rules used to determine which collider is taken into account by this scene query. - pub fn cast_shape<'a>( + pub fn cast_shape( &self, bodies: &RigidBodySet, - colliders: &'a ColliderSet, + colliders: &ColliderSet, shape_pos: &Isometry<Real>, shape_vel: &Vector<Real>, shape: &dyn Shape, @@ -746,10 +747,10 @@ impl QueryPipeline { /// * `shape` - The shape to test. /// * `filter`: set of rules used to determine which collider is taken into account by this scene query. /// * `callback` - A function called with the handles of each collider intersecting the `shape`. - pub fn intersections_with_shape<'a>( + pub fn intersections_with_shape( &self, bodies: &RigidBodySet, - colliders: &'a ColliderSet, + colliders: &ColliderSet, shape_pos: &Isometry<Real>, shape: &dyn Shape, filter: QueryFilter, diff --git a/src/pipeline/user_changes.rs b/src/pipeline/user_changes.rs index a047256..7c3f1ac 100644 --- a/src/pipeline/user_changes.rs +++ b/src/pipeline/user_changes.rs @@ -111,15 +111,13 @@ pub(crate) fn handle_user_changes_to_rigid_bodies( } // Update the active kinematic set. - if changes.contains(RigidBodyChanges::POSITION) - || changes.contains(RigidBodyChanges::COLLIDERS) + if (changes.contains(RigidBodyChanges::POSITION) + || changes.contains(RigidBodyChanges::COLLIDERS)) + && rb.is_kinematic() + && islands.active_kinematic_set.get(ids.active_set_id) != Some(handle) { - if rb.is_kinematic() - && islands.active_kinematic_set.get(ids.active_set_id) != Some(handle) - { - ids.active_set_id = islands.active_kinematic_set.len(); - islands.active_kinematic_set.push(*handle); - } + ids.active_set_id = islands.active_kinematic_set.len(); + islands.active_kinematic_set.push(*handle); } // Push the body to the active set if it is not |
