aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/arena.rs8
-rw-r--r--src/data/graph.rs2
-rw-r--r--src/dynamics/joint/fixed_joint.rs6
-rw-r--r--src/dynamics/joint/multibody_joint/multibody.rs8
-rw-r--r--src/dynamics/joint/multibody_joint/multibody_joint_set.rs1
-rw-r--r--src/dynamics/joint/spherical_joint.rs6
-rw-r--r--src/dynamics/rigid_body_components.rs2
-rw-r--r--src/dynamics/solver/delta_vel.rs2
-rw-r--r--src/dynamics/solver/joint_constraint/joint_generic_velocity_constraint.rs11
-rw-r--r--src/geometry/broad_phase_multi_sap/broad_phase_pair_event.rs6
-rw-r--r--src/geometry/collider_components.rs2
-rw-r--r--src/geometry/narrow_phase.rs2
12 files changed, 46 insertions, 10 deletions
diff --git a/src/data/arena.rs b/src/data/arena.rs
index b14737e..d114339 100644
--- a/src/data/arena.rs
+++ b/src/data/arena.rs
@@ -52,10 +52,16 @@ pub struct Index {
generation: u32,
}
-impl IndexedData for Index {
+impl Default for Index {
fn default() -> Self {
Self::from_raw_parts(crate::INVALID_U32, crate::INVALID_U32)
}
+}
+
+impl IndexedData for Index {
+ fn default() -> Self {
+ Default::default()
+ }
fn index(&self) -> usize {
self.into_raw_parts().0 as usize
diff --git a/src/data/graph.rs b/src/data/graph.rs
index 2dc7fbf..ea76bd9 100644
--- a/src/data/graph.rs
+++ b/src/data/graph.rs
@@ -125,7 +125,7 @@ impl<E> Edge<E> {
}
}
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug,Default)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
pub struct Graph<N, E> {
pub(crate) nodes: Vec<Node<N>>,
diff --git a/src/dynamics/joint/fixed_joint.rs b/src/dynamics/joint/fixed_joint.rs
index 10c4d7e..6082938 100644
--- a/src/dynamics/joint/fixed_joint.rs
+++ b/src/dynamics/joint/fixed_joint.rs
@@ -6,7 +6,11 @@ use crate::math::{Isometry, Point, Real};
pub struct FixedJoint {
data: JointData,
}
-
+impl Default for FixedJoint{
+ fn default() -> Self {
+ FixedJoint::new()
+ }
+}
impl FixedJoint {
pub fn new() -> Self {
#[cfg(feature = "dim2")]
diff --git a/src/dynamics/joint/multibody_joint/multibody.rs b/src/dynamics/joint/multibody_joint/multibody.rs
index e31a333..5779b3e 100644
--- a/src/dynamics/joint/multibody_joint/multibody.rs
+++ b/src/dynamics/joint/multibody_joint/multibody.rs
@@ -18,7 +18,7 @@ use na::{
};
#[repr(C)]
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Debug,Default)]
struct Force {
linear: Vector<Real>,
angular: AngVector<Real>,
@@ -91,7 +91,11 @@ pub struct Multibody {
coriolis_w: Vec<OMatrix<Real, AngDim, Dynamic>>,
i_coriolis_dt: Jacobian<Real>,
}
-
+impl Default for Multibody{
+ fn default() -> Self {
+ Multibody::new()
+ }
+}
impl Multibody {
/// Creates a new multibody with no link.
pub fn new() -> Self {
diff --git a/src/dynamics/joint/multibody_joint/multibody_joint_set.rs b/src/dynamics/joint/multibody_joint/multibody_joint_set.rs
index 24b329f..3e786e2 100644
--- a/src/dynamics/joint/multibody_joint/multibody_joint_set.rs
+++ b/src/dynamics/joint/multibody_joint/multibody_joint_set.rs
@@ -75,6 +75,7 @@ impl Default for MultibodyJointLink {
}
}
+#[derive(Default)]
/// A set of rigid bodies that can be handled by a physics pipeline.
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[derive(Clone)]
diff --git a/src/dynamics/joint/spherical_joint.rs b/src/dynamics/joint/spherical_joint.rs
index 581b959..19fbd6f 100644
--- a/src/dynamics/joint/spherical_joint.rs
+++ b/src/dynamics/joint/spherical_joint.rs
@@ -7,7 +7,11 @@ use crate::math::{Point, Real};
pub struct SphericalJoint {
data: JointData,
}
-
+impl Default for SphericalJoint{
+ fn default() -> Self {
+ SphericalJoint::new()
+ }
+}
impl SphericalJoint {
pub fn new() -> Self {
let data =
diff --git a/src/dynamics/rigid_body_components.rs b/src/dynamics/rigid_body_components.rs
index fdbd33f..c7542d1 100644
--- a/src/dynamics/rigid_body_components.rs
+++ b/src/dynamics/rigid_body_components.rs
@@ -12,7 +12,7 @@ use crate::utils::{WAngularInertia, WCross, WDot};
use num::Zero;
/// The unique handle of a rigid body added to a `RigidBodySet`.
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Default)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[repr(transparent)]
pub struct RigidBodyHandle(pub crate::data::arena::Index);
diff --git a/src/dynamics/solver/delta_vel.rs b/src/dynamics/solver/delta_vel.rs
index 697fd24..73f3c91 100644
--- a/src/dynamics/solver/delta_vel.rs
+++ b/src/dynamics/solver/delta_vel.rs
@@ -3,7 +3,7 @@ use na::{DVectorSlice, DVectorSliceMut};
use na::{Scalar, SimdRealField};
use std::ops::{AddAssign, Sub};
-#[derive(Copy, Clone, Debug)]
+#[derive(Copy, Clone, Debug, Default)]
#[repr(C)]
//#[repr(align(64))]
pub struct DeltaVel<N: Scalar + Copy> {
diff --git a/src/dynamics/solver/joint_constraint/joint_generic_velocity_constraint.rs b/src/dynamics/solver/joint_constraint/joint_generic_velocity_constraint.rs
index 2646fe8..795009f 100644
--- a/src/dynamics/solver/joint_constraint/joint_generic_velocity_constraint.rs
+++ b/src/dynamics/solver/joint_constraint/joint_generic_velocity_constraint.rs
@@ -29,6 +29,12 @@ pub struct JointGenericVelocityConstraint {
pub writeback_id: WritebackId,
}
+impl Default for JointGenericVelocityConstraint {
+ fn default() -> Self {
+ JointGenericVelocityConstraint::invalid()
+ }
+}
+
impl JointGenericVelocityConstraint {
pub fn invalid() -> Self {
Self {
@@ -313,6 +319,11 @@ pub struct JointGenericVelocityGroundConstraint {
pub writeback_id: WritebackId,
}
+impl Default for JointGenericVelocityGroundConstraint{
+ fn default() -> Self {
+ JointGenericVelocityGroundConstraint::invalid()
+ }
+}
impl JointGenericVelocityGroundConstraint {
pub fn invalid() -> Self {
diff --git a/src/geometry/broad_phase_multi_sap/broad_phase_pair_event.rs b/src/geometry/broad_phase_multi_sap/broad_phase_pair_event.rs
index f72d1df..99bab1e 100644
--- a/src/geometry/broad_phase_multi_sap/broad_phase_pair_event.rs
+++ b/src/geometry/broad_phase_multi_sap/broad_phase_pair_event.rs
@@ -33,6 +33,12 @@ impl ColliderPair {
}
}
+impl Default for ColliderPair{
+ fn default() -> Self {
+ ColliderPair::zero()
+ }
+}
+
/// An event emitted by the broad-phase.
pub enum BroadPhasePairEvent {
/// A potential new collision pair has been detected by the broad-phase.
diff --git a/src/geometry/collider_components.rs b/src/geometry/collider_components.rs
index 1c737dd..fe2961f 100644
--- a/src/geometry/collider_components.rs
+++ b/src/geometry/collider_components.rs
@@ -6,7 +6,7 @@ use crate::pipeline::{ActiveEvents, ActiveHooks};
use std::ops::{Deref, DerefMut};
/// The unique identifier of a collider added to a collider set.
-#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Default)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
#[repr(transparent)]
pub struct ColliderHandle(pub crate::data::arena::Index);
diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs
index 643b584..df49aa9 100644
--- a/src/geometry/narrow_phase.rs
+++ b/src/geometry/narrow_phase.rs
@@ -24,7 +24,7 @@ use std::collections::HashMap;
use std::sync::Arc;
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
-#[derive(Copy, Clone, Debug, PartialEq, Eq)]
+#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
struct ColliderGraphIndices {
contact_graph_index: ColliderGraphIndex,
intersection_graph_index: ColliderGraphIndex,