diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/data/coarena.rs | 2 | ||||
| -rw-r--r-- | src/data/pubsub.rs | 2 | ||||
| -rw-r--r-- | src/dynamics/ccd/ccd_solver.rs | 6 | ||||
| -rw-r--r-- | src/dynamics/island_manager.rs | 2 | ||||
| -rw-r--r-- | src/dynamics/joint/joint_set.rs | 2 | ||||
| -rw-r--r-- | src/dynamics/rigid_body.rs | 6 | ||||
| -rw-r--r-- | src/dynamics/rigid_body_set.rs | 2 | ||||
| -rw-r--r-- | src/dynamics/solver/island_solver.rs | 6 | ||||
| -rw-r--r-- | src/dynamics/solver/parallel_island_solver.rs | 6 | ||||
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/broad_phase.rs | 6 | ||||
| -rw-r--r-- | src/geometry/broad_phase_multi_sap/sap_proxy.rs | 6 | ||||
| -rw-r--r-- | src/geometry/collider_set.rs | 2 | ||||
| -rw-r--r-- | src/geometry/interaction_graph.rs | 6 | ||||
| -rw-r--r-- | src/geometry/narrow_phase.rs | 6 | ||||
| -rw-r--r-- | src/pipeline/collision_pipeline.rs | 6 |
15 files changed, 60 insertions, 6 deletions
diff --git a/src/data/coarena.rs b/src/data/coarena.rs index 549c5f2..124d85a 100644 --- a/src/data/coarena.rs +++ b/src/data/coarena.rs @@ -1,7 +1,7 @@ use crate::data::arena::Index; #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] -#[derive(Clone, Debug)] +#[derive(Clone, Debug, Default)] /// A container for data associated to item existing into another Arena. pub struct Coarena<T> { data: Vec<(u32, T)>, diff --git a/src/data/pubsub.rs b/src/data/pubsub.rs index 80fb3a2..8c5f41c 100644 --- a/src/data/pubsub.rs +++ b/src/data/pubsub.rs @@ -38,7 +38,7 @@ impl PubSubCursor { /// A pub-sub queue. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] -#[derive(Clone)] +#[derive(Clone, Default)] pub struct PubSub<T> { deleted_messages: u32, deleted_offsets: u32, diff --git a/src/dynamics/ccd/ccd_solver.rs b/src/dynamics/ccd/ccd_solver.rs index 7e95f08..b3a1608 100644 --- a/src/dynamics/ccd/ccd_solver.rs +++ b/src/dynamics/ccd/ccd_solver.rs @@ -29,6 +29,12 @@ pub struct CCDSolver { query_pipeline: QueryPipeline, } +impl Default for CCDSolver { + fn default() -> Self { + Self::new() + } +} + impl CCDSolver { /// Initializes a new CCD solver pub fn new() -> Self { diff --git a/src/dynamics/island_manager.rs b/src/dynamics/island_manager.rs index 4046329..10ac0f8 100644 --- a/src/dynamics/island_manager.rs +++ b/src/dynamics/island_manager.rs @@ -9,7 +9,7 @@ use crate::math::Real; /// Structure responsible for maintaining the set of active rigid-bodies, and /// putting non-moving rigid-bodies to sleep to save computation times. #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] -#[derive(Clone)] +#[derive(Clone, Default)] pub struct IslandManager { pub(crate) active_dynamic_set: Vec<RigidBodyHandle>, pub(crate) active_kinematic_set: Vec<RigidBodyHandle>, diff --git a/src/dynamics/joint/joint_set.rs b/src/dynamics/joint/joint_set.rs index 01e0d27..aba2aa8 100644 --- a/src/dynamics/joint/joint_set.rs +++ b/src/dynamics/joint/joint_set.rs @@ -37,7 +37,7 @@ pub(crate) type JointIndex = usize; pub(crate) type JointGraphEdge = crate::data::graph::Edge<Joint>; #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] -#[derive(Clone)] +#[derive(Clone, Default)] /// A set of joints that can be handled by a physics `World`. pub struct JointSet { rb_graph_ids: Coarena<RigidBodyGraphIndex>, diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 2086839..1687c5e 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -36,6 +36,12 @@ pub struct RigidBody { pub user_data: u128, } +impl Default for RigidBody { + fn default() -> Self { + Self::new() + } +} + impl RigidBody { fn new() -> Self { Self { diff --git a/src/dynamics/rigid_body_set.rs b/src/dynamics/rigid_body_set.rs index ceb31e4..607f7ff 100644 --- a/src/dynamics/rigid_body_set.rs +++ b/src/dynamics/rigid_body_set.rs @@ -28,7 +28,7 @@ impl BodyPair { } #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] -#[derive(Clone)] +#[derive(Clone, Default)] /// A set of rigid bodies that can be handled by a physics pipeline. pub struct RigidBodySet { // NOTE: the pub(crate) are needed by the broad phase diff --git a/src/dynamics/solver/island_solver.rs b/src/dynamics/solver/island_solver.rs index 0c4c323..912fe1d 100644 --- a/src/dynamics/solver/island_solver.rs +++ b/src/dynamics/solver/island_solver.rs @@ -19,6 +19,12 @@ pub struct IslandSolver { position_solver: PositionSolver, } +impl Default for IslandSolver { + fn default() -> Self { + Self::new() + } +} + impl IslandSolver { pub fn new() -> Self { Self { diff --git a/src/dynamics/solver/parallel_island_solver.rs b/src/dynamics/solver/parallel_island_solver.rs index be7ea6d..bd6fc5d 100644 --- a/src/dynamics/solver/parallel_island_solver.rs +++ b/src/dynamics/solver/parallel_island_solver.rs @@ -133,6 +133,12 @@ pub struct ParallelIslandSolver { thread: ThreadContext, } +impl Default for ParallelIslandSolver { + fn default() -> Self { + Self::new() + } +} + impl ParallelIslandSolver { pub fn new() -> Self { Self { diff --git a/src/geometry/broad_phase_multi_sap/broad_phase.rs b/src/geometry/broad_phase_multi_sap/broad_phase.rs index 76d48fe..0ed12b6 100644 --- a/src/geometry/broad_phase_multi_sap/broad_phase.rs +++ b/src/geometry/broad_phase_multi_sap/broad_phase.rs @@ -116,6 +116,12 @@ pub struct BroadPhase { reporting: HashMap<(u32, u32), bool>, // Workspace } +impl Default for BroadPhase { + fn default() -> Self { + Self::new() + } +} + impl BroadPhase { /// Create a new empty broad-phase. pub fn new() -> Self { diff --git a/src/geometry/broad_phase_multi_sap/sap_proxy.rs b/src/geometry/broad_phase_multi_sap/sap_proxy.rs index ed834bd..dff46ff 100644 --- a/src/geometry/broad_phase_multi_sap/sap_proxy.rs +++ b/src/geometry/broad_phase_multi_sap/sap_proxy.rs @@ -87,6 +87,12 @@ pub struct SAPProxies { pub first_free: SAPProxyIndex, } +impl Default for SAPProxies { + fn default() -> Self { + Self::new() + } +} + impl SAPProxies { pub fn new() -> Self { Self { diff --git a/src/geometry/collider_set.rs b/src/geometry/collider_set.rs index 9584015..556d190 100644 --- a/src/geometry/collider_set.rs +++ b/src/geometry/collider_set.rs @@ -9,7 +9,7 @@ use crate::geometry::{ColliderChanges, ColliderHandle}; use std::ops::{Index, IndexMut}; #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] -#[derive(Clone)] +#[derive(Clone, Default)] /// A set of colliders that can be handled by a physics `World`. pub struct ColliderSet { pub(crate) colliders: Arena<Collider>, diff --git a/src/geometry/interaction_graph.rs b/src/geometry/interaction_graph.rs index e2cc218..b535fa5 100644 --- a/src/geometry/interaction_graph.rs +++ b/src/geometry/interaction_graph.rs @@ -14,6 +14,12 @@ pub struct InteractionGraph<N, E> { pub(crate) graph: Graph<N, E>, } +impl<N: Copy, E> Default for InteractionGraph<N, E> { + fn default() -> Self { + Self::new() + } +} + impl<N: Copy, E> InteractionGraph<N, E> { /// Creates a new empty collection of collision objects. pub fn new() -> Self { diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index 18900b9..adaf219 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -62,6 +62,12 @@ pub struct NarrowPhase { pub(crate) type ContactManifoldIndex = usize; +impl Default for NarrowPhase { + fn default() -> Self { + Self::new() + } +} + impl NarrowPhase { /// Creates a new empty narrow-phase. pub fn new() -> Self { diff --git a/src/pipeline/collision_pipeline.rs b/src/pipeline/collision_pipeline.rs index 83db4ac..0106ba6 100644 --- a/src/pipeline/collision_pipeline.rs +++ b/src/pipeline/collision_pipeline.rs @@ -33,6 +33,12 @@ fn check_pipeline_send_sync() { do_test::<CollisionPipeline>(); } +impl Default for CollisionPipeline { + fn default() -> Self { + Self::new() + } +} + impl CollisionPipeline { /// Initializes a new physics pipeline. pub fn new() -> CollisionPipeline { |
