add defaults for the several structs
This commit is contained in:
committed by
Sébastien Crozet
parent
1608a1323e
commit
536122e080
@@ -52,10 +52,16 @@ pub struct Index {
|
|||||||
generation: u32,
|
generation: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IndexedData for Index {
|
impl Default for Index {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::from_raw_parts(crate::INVALID_U32, crate::INVALID_U32)
|
Self::from_raw_parts(crate::INVALID_U32, crate::INVALID_U32)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl IndexedData for Index {
|
||||||
|
fn default() -> Self {
|
||||||
|
Default::default()
|
||||||
|
}
|
||||||
|
|
||||||
fn index(&self) -> usize {
|
fn index(&self) -> usize {
|
||||||
self.into_raw_parts().0 as usize
|
self.into_raw_parts().0 as usize
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ impl<E> Edge<E> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug,Default)]
|
||||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||||
pub struct Graph<N, E> {
|
pub struct Graph<N, E> {
|
||||||
pub(crate) nodes: Vec<Node<N>>,
|
pub(crate) nodes: Vec<Node<N>>,
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ use crate::math::{Isometry, Point, Real};
|
|||||||
pub struct FixedJoint {
|
pub struct FixedJoint {
|
||||||
data: JointData,
|
data: JointData,
|
||||||
}
|
}
|
||||||
|
impl Default for FixedJoint{
|
||||||
|
fn default() -> Self {
|
||||||
|
FixedJoint::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
impl FixedJoint {
|
impl FixedJoint {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use na::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug,Default)]
|
||||||
struct Force {
|
struct Force {
|
||||||
linear: Vector<Real>,
|
linear: Vector<Real>,
|
||||||
angular: AngVector<Real>,
|
angular: AngVector<Real>,
|
||||||
@@ -91,7 +91,11 @@ pub struct Multibody {
|
|||||||
coriolis_w: Vec<OMatrix<Real, AngDim, Dynamic>>,
|
coriolis_w: Vec<OMatrix<Real, AngDim, Dynamic>>,
|
||||||
i_coriolis_dt: Jacobian<Real>,
|
i_coriolis_dt: Jacobian<Real>,
|
||||||
}
|
}
|
||||||
|
impl Default for Multibody{
|
||||||
|
fn default() -> Self {
|
||||||
|
Multibody::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
impl Multibody {
|
impl Multibody {
|
||||||
/// Creates a new multibody with no link.
|
/// Creates a new multibody with no link.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ impl Default for MultibodyJointLink {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
/// A set of rigid bodies that can be handled by a physics pipeline.
|
/// A set of rigid bodies that can be handled by a physics pipeline.
|
||||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ use crate::math::{Point, Real};
|
|||||||
pub struct SphericalJoint {
|
pub struct SphericalJoint {
|
||||||
data: JointData,
|
data: JointData,
|
||||||
}
|
}
|
||||||
|
impl Default for SphericalJoint{
|
||||||
|
fn default() -> Self {
|
||||||
|
SphericalJoint::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
impl SphericalJoint {
|
impl SphericalJoint {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let data =
|
let data =
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ use crate::utils::{WAngularInertia, WCross, WDot};
|
|||||||
use num::Zero;
|
use num::Zero;
|
||||||
|
|
||||||
/// The unique handle of a rigid body added to a `RigidBodySet`.
|
/// 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))]
|
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct RigidBodyHandle(pub crate::data::arena::Index);
|
pub struct RigidBodyHandle(pub crate::data::arena::Index);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use na::{DVectorSlice, DVectorSliceMut};
|
|||||||
use na::{Scalar, SimdRealField};
|
use na::{Scalar, SimdRealField};
|
||||||
use std::ops::{AddAssign, Sub};
|
use std::ops::{AddAssign, Sub};
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug, Default)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
//#[repr(align(64))]
|
//#[repr(align(64))]
|
||||||
pub struct DeltaVel<N: Scalar + Copy> {
|
pub struct DeltaVel<N: Scalar + Copy> {
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ pub struct JointGenericVelocityConstraint {
|
|||||||
pub writeback_id: WritebackId,
|
pub writeback_id: WritebackId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for JointGenericVelocityConstraint {
|
||||||
|
fn default() -> Self {
|
||||||
|
JointGenericVelocityConstraint::invalid()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl JointGenericVelocityConstraint {
|
impl JointGenericVelocityConstraint {
|
||||||
pub fn invalid() -> Self {
|
pub fn invalid() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@@ -313,6 +319,11 @@ pub struct JointGenericVelocityGroundConstraint {
|
|||||||
|
|
||||||
pub writeback_id: WritebackId,
|
pub writeback_id: WritebackId,
|
||||||
}
|
}
|
||||||
|
impl Default for JointGenericVelocityGroundConstraint{
|
||||||
|
fn default() -> Self {
|
||||||
|
JointGenericVelocityGroundConstraint::invalid()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl JointGenericVelocityGroundConstraint {
|
impl JointGenericVelocityGroundConstraint {
|
||||||
pub fn invalid() -> Self {
|
pub fn invalid() -> Self {
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ impl ColliderPair {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ColliderPair{
|
||||||
|
fn default() -> Self {
|
||||||
|
ColliderPair::zero()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// An event emitted by the broad-phase.
|
/// An event emitted by the broad-phase.
|
||||||
pub enum BroadPhasePairEvent {
|
pub enum BroadPhasePairEvent {
|
||||||
/// A potential new collision pair has been detected by the broad-phase.
|
/// A potential new collision pair has been detected by the broad-phase.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use crate::pipeline::{ActiveEvents, ActiveHooks};
|
|||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
/// The unique identifier of a collider added to a collider set.
|
/// 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))]
|
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
pub struct ColliderHandle(pub crate::data::arena::Index);
|
pub struct ColliderHandle(pub crate::data::arena::Index);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ use std::collections::HashMap;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
|
||||||
struct ColliderGraphIndices {
|
struct ColliderGraphIndices {
|
||||||
contact_graph_index: ColliderGraphIndex,
|
contact_graph_index: ColliderGraphIndex,
|
||||||
intersection_graph_index: ColliderGraphIndex,
|
intersection_graph_index: ColliderGraphIndex,
|
||||||
|
|||||||
Reference in New Issue
Block a user