Impl Default for a few structs

This commit is contained in:
Jamen Marz
2021-09-21 11:25:54 -06:00
committed by Sébastien Crozet
parent 936f655c67
commit 7aa94e994f
15 changed files with 60 additions and 6 deletions

View File

@@ -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 {

View File

@@ -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>,

View File

@@ -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>,

View File

@@ -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 {

View File

@@ -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

View File

@@ -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 {

View File

@@ -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 {