diff options
| author | Sébastien Crozet <developer@crozet.re> | 2024-06-23 22:57:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-23 22:57:51 +0200 |
| commit | 3004a7d38da447e307e11d86528047bdb724c318 (patch) | |
| tree | c16924c62b12523525d95711e9773a6ba96e5271 /src | |
| parent | 3e8650f3a761422f0926300dc98f9870e5d92776 (diff) | |
| download | rapier-3004a7d38da447e307e11d86528047bdb724c318.tar.gz rapier-3004a7d38da447e307e11d86528047bdb724c318.tar.bz2 rapier-3004a7d38da447e307e11d86528047bdb724c318.zip | |
chore: update to nalgebra 0.33 and parry 0.16 (#664)
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynamics/joint/generic_joint.rs | 26 | ||||
| -rw-r--r-- | src/dynamics/rigid_body_components.rs | 6 | ||||
| -rw-r--r-- | src/geometry/collider_components.rs | 6 | ||||
| -rw-r--r-- | src/geometry/contact_pair.rs | 1 | ||||
| -rw-r--r-- | src/geometry/interaction_groups.rs | 3 | ||||
| -rw-r--r-- | src/geometry/mod.rs | 1 | ||||
| -rw-r--r-- | src/pipeline/debug_render_pipeline/debug_render_pipeline.rs | 3 | ||||
| -rw-r--r-- | src/pipeline/event_handler.rs | 1 | ||||
| -rw-r--r-- | src/pipeline/physics_hooks.rs | 1 | ||||
| -rw-r--r-- | src/pipeline/query_pipeline/mod.rs | 8 |
10 files changed, 34 insertions, 22 deletions
diff --git a/src/dynamics/joint/generic_joint.rs b/src/dynamics/joint/generic_joint.rs index 154c439..8d4066d 100644 --- a/src/dynamics/joint/generic_joint.rs +++ b/src/dynamics/joint/generic_joint.rs @@ -12,6 +12,7 @@ use crate::dynamics::SphericalJoint; bitflags::bitflags! { /// A bit mask identifying multiple degrees of freedom of a joint. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct JointAxesMask: u8 { /// The linear (translational) degree of freedom along the local X axis of a joint. const LIN_X = 1 << 0; @@ -26,21 +27,21 @@ bitflags::bitflags! { /// The angular degree of freedom along the local Z axis of a joint. const ANG_Z = 1 << 5; /// The set of degrees of freedom locked by a revolute joint. - const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_Y.bits | Self::ANG_Z.bits; + const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits(); /// The set of degrees of freedom locked by a prismatic joint. - const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits; + const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits() | Self::LIN_Z.bits() | Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits(); /// The set of degrees of freedom locked by a fixed joint. - const LOCKED_FIXED_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits | Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits; + const LOCKED_FIXED_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits() | Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits(); /// The set of degrees of freedom locked by a spherical joint. - const LOCKED_SPHERICAL_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::LIN_Z.bits; + const LOCKED_SPHERICAL_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits(); /// The set of degrees of freedom left free by a revolute joint. - const FREE_REVOLUTE_AXES = Self::ANG_X.bits; + const FREE_REVOLUTE_AXES = Self::ANG_X.bits(); /// The set of degrees of freedom left free by a prismatic joint. - const FREE_PRISMATIC_AXES = Self::LIN_X.bits; + const FREE_PRISMATIC_AXES = Self::LIN_X.bits(); /// The set of degrees of freedom left free by a fixed joint. const FREE_FIXED_AXES = 0; /// The set of degrees of freedom left free by a spherical joint. - const FREE_SPHERICAL_AXES = Self::ANG_X.bits | Self::ANG_Y.bits | Self::ANG_Z.bits; + const FREE_SPHERICAL_AXES = Self::ANG_X.bits() | Self::ANG_Y.bits() | Self::ANG_Z.bits(); /// The set of all translational degrees of freedom. const LIN_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::LIN_Z.bits(); /// The set of all angular degrees of freedom. @@ -52,6 +53,7 @@ bitflags::bitflags! { bitflags::bitflags! { /// A bit mask identifying multiple degrees of freedom of a joint. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct JointAxesMask: u8 { /// The linear (translational) degree of freedom along the local X axis of a joint. const LIN_X = 1 << 0; @@ -60,15 +62,15 @@ bitflags::bitflags! { /// The angular degree of freedom of a joint. const ANG_X = 1 << 2; /// The set of degrees of freedom locked by a revolute joint. - const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits | Self::LIN_Y.bits; + const LOCKED_REVOLUTE_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits(); /// The set of degrees of freedom locked by a prismatic joint. - const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits | Self::ANG_X.bits; + const LOCKED_PRISMATIC_AXES = Self::LIN_Y.bits() | Self::ANG_X.bits(); /// The set of degrees of freedom locked by a fixed joint. - const LOCKED_FIXED_AXES = Self::LIN_X.bits | Self::LIN_Y.bits | Self::ANG_X.bits; + const LOCKED_FIXED_AXES = Self::LIN_X.bits() | Self::LIN_Y.bits() | Self::ANG_X.bits(); /// The set of degrees of freedom left free by a revolute joint. - const FREE_REVOLUTE_AXES = Self::ANG_X.bits; + const FREE_REVOLUTE_AXES = Self::ANG_X.bits(); /// The set of degrees of freedom left free by a prismatic joint. - const FREE_PRISMATIC_AXES = Self::LIN_X.bits; + const FREE_PRISMATIC_AXES = Self::LIN_X.bits(); /// The set of degrees of freedom left free by a fixed joint. const FREE_FIXED_AXES = 0; /// The set of all translational degrees of freedom. diff --git a/src/dynamics/rigid_body_components.rs b/src/dynamics/rigid_body_components.rs index a391feb..641434c 100644 --- a/src/dynamics/rigid_body_components.rs +++ b/src/dynamics/rigid_body_components.rs @@ -96,6 +96,7 @@ impl RigidBodyType { bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug)] /// Flags describing how the rigid-body has been modified by the user. pub struct RigidBodyChanges: u32 { /// Flag indicating that any component of this rigid-body has been modified. @@ -204,6 +205,7 @@ where bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug)] /// Flags affecting the behavior of the constraints solver for a given contact manifold. // FIXME: rename this to LockedAxes pub struct LockedAxes: u8 { @@ -214,7 +216,7 @@ bitflags::bitflags! { /// Flag indicating that the rigid-body cannot translate along the `Z` axis. const TRANSLATION_LOCKED_Z = 1 << 2; /// Flag indicating that the rigid-body cannot translate along any direction. - const TRANSLATION_LOCKED = Self::TRANSLATION_LOCKED_X.bits | Self::TRANSLATION_LOCKED_Y.bits | Self::TRANSLATION_LOCKED_Z.bits; + const TRANSLATION_LOCKED = Self::TRANSLATION_LOCKED_X.bits() | Self::TRANSLATION_LOCKED_Y.bits() | Self::TRANSLATION_LOCKED_Z.bits(); /// Flag indicating that the rigid-body cannot rotate along the `X` axis. const ROTATION_LOCKED_X = 1 << 3; /// Flag indicating that the rigid-body cannot rotate along the `Y` axis. @@ -222,7 +224,7 @@ bitflags::bitflags! { /// Flag indicating that the rigid-body cannot rotate along the `Z` axis. const ROTATION_LOCKED_Z = 1 << 5; /// Combination of flags indicating that the rigid-body cannot rotate along any axis. - const ROTATION_LOCKED = Self::ROTATION_LOCKED_X.bits | Self::ROTATION_LOCKED_Y.bits | Self::ROTATION_LOCKED_Z.bits; + const ROTATION_LOCKED = Self::ROTATION_LOCKED_X.bits() | Self::ROTATION_LOCKED_Y.bits() | Self::ROTATION_LOCKED_Z.bits(); } } diff --git a/src/geometry/collider_components.rs b/src/geometry/collider_components.rs index 123e32c..efaccd0 100644 --- a/src/geometry/collider_components.rs +++ b/src/geometry/collider_components.rs @@ -43,6 +43,7 @@ impl IndexedData for ColliderHandle { bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug)] /// Flags describing how the collider has been modified by the user. pub struct ColliderChanges: u32 { /// Flag indicating that any component of the collider has been modified. @@ -301,6 +302,7 @@ impl Default for ColliderMaterial { bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] /// Flags affecting whether or not collision-detection happens between two colliders /// depending on the type of rigid-bodies they are attached to. pub struct ActiveCollisionTypes: u16 { @@ -364,8 +366,8 @@ impl ActiveCollisionTypes { // // Because that test must be symmetric, we perform two similar tests by swapping // rb_type1 and rb_type2. - ((self.bits >> (rb_type1 as u32 * 4)) & 0b0000_1111) & (1 << rb_type2 as u32) != 0 - || ((self.bits >> (rb_type2 as u32 * 4)) & 0b0000_1111) & (1 << rb_type1 as u32) != 0 + ((self.bits() >> (rb_type1 as u32 * 4)) & 0b0000_1111) & (1 << rb_type2 as u32) != 0 + || ((self.bits() >> (rb_type2 as u32 * 4)) & 0b0000_1111) & (1 << rb_type1 as u32) != 0 } } diff --git a/src/geometry/contact_pair.rs b/src/geometry/contact_pair.rs index c57f98a..8ff5dd6 100644 --- a/src/geometry/contact_pair.rs +++ b/src/geometry/contact_pair.rs @@ -9,6 +9,7 @@ use super::CollisionEvent; bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug)] /// Flags affecting the behavior of the constraints solver for a given contact manifold. pub struct SolverFlags: u32 { /// The constraint solver will take this contact manifold into diff --git a/src/geometry/interaction_groups.rs b/src/geometry/interaction_groups.rs index b07389c..f61de1a 100644 --- a/src/geometry/interaction_groups.rs +++ b/src/geometry/interaction_groups.rs @@ -80,6 +80,7 @@ use bitflags::bitflags; bitflags! { /// A bit mask identifying groups for interaction. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] pub struct Group: u32 { /// The group n°1. const GROUP_1 = 1 << 0; @@ -156,7 +157,7 @@ bitflags! { impl From<u32> for Group { #[inline] fn from(val: u32) -> Self { - unsafe { Self::from_bits_unchecked(val) } + Self::from_bits_retain(val) } } diff --git a/src/geometry/mod.rs b/src/geometry/mod.rs index e7f0da7..ea0c7fb 100644 --- a/src/geometry/mod.rs +++ b/src/geometry/mod.rs @@ -59,6 +59,7 @@ pub type DefaultBroadPhase = BroadPhaseMultiSap; bitflags::bitflags! { /// Flags providing more information regarding a collision event. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] pub struct CollisionEventFlags: u32 { /// Flag set if at least one of the colliders involved in the /// collision was a sensor when the event was fired. diff --git a/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs b/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs index 041862c..831f815 100644 --- a/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs +++ b/src/pipeline/debug_render_pipeline/debug_render_pipeline.rs @@ -16,6 +16,7 @@ use std::collections::HashMap; bitflags::bitflags! { /// Flags indicating what part of the physics engine should be rendered /// by the debug-renderer. + #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct DebugRenderMode: u32 { /// If this flag is set, the collider shapes will be rendered. const COLLIDER_SHAPES = 1 << 0; @@ -26,7 +27,7 @@ bitflags::bitflags! { /// If this flag is set, the impulse joints will be rendered. const IMPULSE_JOINTS = 1 << 3; /// If this flag is set, all the joints will be rendered. - const JOINTS = Self::MULTIBODY_JOINTS.bits | Self::IMPULSE_JOINTS.bits; + const JOINTS = Self::MULTIBODY_JOINTS.bits() | Self::IMPULSE_JOINTS.bits(); /// If this flag is set, the solver contacts will be rendered. const SOLVER_CONTACTS = 1 << 4; /// If this flag is set, the geometric contacts will be rendered. diff --git a/src/pipeline/event_handler.rs b/src/pipeline/event_handler.rs index 7957ccf..ab98434 100644 --- a/src/pipeline/event_handler.rs +++ b/src/pipeline/event_handler.rs @@ -5,6 +5,7 @@ use crossbeam::channel::Sender; bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] /// Flags affecting the events generated for this collider. pub struct ActiveEvents: u32 { /// If set, Rapier will call `EventHandler::handle_collision_event` diff --git a/src/pipeline/physics_hooks.rs b/src/pipeline/physics_hooks.rs index 11166b5..558962d 100644 --- a/src/pipeline/physics_hooks.rs +++ b/src/pipeline/physics_hooks.rs @@ -118,6 +118,7 @@ impl<'a> ContactModificationContext<'a> { bitflags::bitflags! { #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] + #[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)] /// Flags affecting the behavior of the constraints solver for a given contact manifold. pub struct ActiveHooks: u32 { /// If set, Rapier will call `PhysicsHooks::filter_contact_pair` whenever relevant. diff --git a/src/pipeline/query_pipeline/mod.rs b/src/pipeline/query_pipeline/mod.rs index cd8ae4c..18d7948 100644 --- a/src/pipeline/query_pipeline/mod.rs +++ b/src/pipeline/query_pipeline/mod.rs @@ -43,7 +43,7 @@ struct QueryPipelineAsCompositeShape<'a> { } bitflags::bitflags! { - #[derive(Default)] + #[derive(Copy, Clone, PartialEq, Eq, Debug, Default)] /// Flags for excluding whole sets of colliders from a scene query. pub struct QueryFilterFlags: u32 { /// Exclude from the query any collider attached to a fixed rigid-body and colliders with no rigid-body attached. @@ -57,12 +57,12 @@ bitflags::bitflags! { /// Exclude from the query any collider that is not a sensor. const EXCLUDE_SOLIDS = 1 << 5; /// Excludes all colliders not attached to a dynamic rigid-body. - const ONLY_DYNAMIC = Self::EXCLUDE_FIXED.bits | Self::EXCLUDE_KINEMATIC.bits; + const ONLY_DYNAMIC = Self::EXCLUDE_FIXED.bits() | Self::EXCLUDE_KINEMATIC.bits(); /// Excludes all colliders not attached to a kinematic rigid-body. - const ONLY_KINEMATIC = Self::EXCLUDE_DYNAMIC.bits | Self::EXCLUDE_FIXED.bits; + const ONLY_KINEMATIC = Self::EXCLUDE_DYNAMIC.bits() | Self::EXCLUDE_FIXED.bits(); /// Exclude all colliders attached to a non-fixed rigid-body /// (this will not exclude colliders not attached to any rigid-body). - const ONLY_FIXED = Self::EXCLUDE_DYNAMIC.bits | Self::EXCLUDE_KINEMATIC.bits; + const ONLY_FIXED = Self::EXCLUDE_DYNAMIC.bits() | Self::EXCLUDE_KINEMATIC.bits(); } } |
