Outsource the contact manifold, SAT, and some shapes.
This commit is contained in:
@@ -1,17 +1,11 @@
|
||||
//! Structures related to geometry: colliders, shapes, etc.
|
||||
|
||||
pub use self::broad_phase_multi_sap::BroadPhase;
|
||||
pub use self::capsule::Capsule;
|
||||
pub use self::collider::{Collider, ColliderBuilder, ColliderShape};
|
||||
pub use self::collider_set::{ColliderHandle, ColliderSet};
|
||||
pub use self::contact::{
|
||||
Contact, ContactKinematics, ContactManifold, ContactPair, KinematicsCategory, SolverFlags,
|
||||
};
|
||||
pub use self::contact::{ContactData, ContactManifoldData};
|
||||
pub use self::contact::{ContactPair, SolverFlags};
|
||||
pub use self::contact_generator::{ContactDispatcher, DefaultContactDispatcher};
|
||||
#[cfg(feature = "dim2")]
|
||||
pub(crate) use self::cuboid_feature2d::{CuboidFeature, CuboidFeatureFace};
|
||||
#[cfg(feature = "dim3")]
|
||||
pub(crate) use self::cuboid_feature3d::{CuboidFeature, CuboidFeatureFace};
|
||||
pub use self::interaction_graph::{
|
||||
ColliderGraphIndex, InteractionGraph, RigidBodyGraphIndex, TemporaryInteractionIndex,
|
||||
};
|
||||
@@ -23,36 +17,87 @@ pub use self::proximity_detector::{DefaultProximityDispatcher, ProximityDispatch
|
||||
pub use self::round_cylinder::RoundCylinder;
|
||||
pub use self::trimesh::Trimesh;
|
||||
pub use self::user_callbacks::{ContactPairFilter, PairFilterContext, ProximityPairFilter};
|
||||
pub use ncollide::query::Proximity;
|
||||
pub use buckler::query::Proximity;
|
||||
|
||||
pub use buckler::query::{KinematicsCategory, TrackedContact};
|
||||
|
||||
pub type Contact = buckler::query::TrackedContact<ContactData>;
|
||||
pub type ContactManifold = buckler::query::ContactManifold<ContactManifoldData, ContactData>;
|
||||
/// A segment shape.
|
||||
pub type Segment = ncollide::shape::Segment<f32>;
|
||||
pub type Segment = buckler::shape::Segment;
|
||||
/// A cuboid shape.
|
||||
pub type Cuboid = ncollide::shape::Cuboid<f32>;
|
||||
pub type Cuboid = buckler::shape::Cuboid;
|
||||
/// A triangle shape.
|
||||
pub type Triangle = ncollide::shape::Triangle<f32>;
|
||||
pub type Triangle = buckler::shape::Triangle;
|
||||
/// A ball shape.
|
||||
pub type Ball = ncollide::shape::Ball<f32>;
|
||||
pub type Ball = buckler::shape::Ball;
|
||||
/// A capsule shape.
|
||||
pub type Capsule = buckler::shape::Capsule;
|
||||
/// A heightfield shape.
|
||||
pub type HeightField = ncollide::shape::HeightField<f32>;
|
||||
pub type HeightField = buckler::shape::HeightField;
|
||||
/// A cylindrical shape.
|
||||
#[cfg(feature = "dim3")]
|
||||
pub type Cylinder = ncollide::shape::Cylinder<f32>;
|
||||
pub type Cylinder = buckler::shape::Cylinder;
|
||||
/// A cone shape.
|
||||
#[cfg(feature = "dim3")]
|
||||
pub type Cone = ncollide::shape::Cone<f32>;
|
||||
pub type Cone = buckler::shape::Cone;
|
||||
/// An axis-aligned bounding box.
|
||||
pub type AABB = ncollide::bounding_volume::AABB<f32>;
|
||||
/// Event triggered when two non-sensor colliders start or stop being in contact.
|
||||
pub type ContactEvent = ncollide::pipeline::ContactEvent<ColliderHandle>;
|
||||
/// Event triggered when a sensor collider starts or stop being in proximity with another collider (sensor or not).
|
||||
pub type ProximityEvent = ncollide::pipeline::ProximityEvent<ColliderHandle>;
|
||||
pub type AABB = buckler::bounding_volume::AABB;
|
||||
/// A ray that can be cast against colliders.
|
||||
pub type Ray = ncollide::query::Ray<f32>;
|
||||
pub type Ray = buckler::query::Ray;
|
||||
/// The intersection between a ray and a collider.
|
||||
pub type RayIntersection = ncollide::query::RayIntersection<f32>;
|
||||
pub type RayIntersection = buckler::query::RayIntersection;
|
||||
/// The the projection of a point on a collider.
|
||||
pub type PointProjection = ncollide::query::PointProjection<f32>;
|
||||
pub type PointProjection = buckler::query::PointProjection;
|
||||
|
||||
#[derive(Copy, Clone, Hash, Debug)]
|
||||
/// Events occurring when two collision objects start or stop being in contact (or penetration).
|
||||
pub enum ContactEvent {
|
||||
/// Event occurring when two collision objects start being in contact.
|
||||
///
|
||||
/// This event is generated whenever the narrow-phase finds a contact between two collision objects that did not have any contact at the last update.
|
||||
Started(ColliderHandle, ColliderHandle),
|
||||
/// Event occurring when two collision objects stop being in contact.
|
||||
///
|
||||
/// This event is generated whenever the narrow-phase fails to find any contact between two collision objects that did have at least one contact at the last update.
|
||||
Stopped(ColliderHandle, ColliderHandle),
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
/// Events occurring when two collision objects start or stop being in close proximity, contact, or disjoint.
|
||||
pub struct ProximityEvent {
|
||||
/// The first collider to which the proximity event applies.
|
||||
pub collider1: ColliderHandle,
|
||||
/// The second collider to which the proximity event applies.
|
||||
pub collider2: ColliderHandle,
|
||||
/// The previous state of proximity between the two collision objects.
|
||||
pub prev_status: Proximity,
|
||||
/// The new state of proximity between the two collision objects.
|
||||
pub new_status: Proximity,
|
||||
}
|
||||
|
||||
impl ProximityEvent {
|
||||
/// Instantiates a new proximity event.
|
||||
///
|
||||
/// Panics if `prev_status` is equal to `new_status`.
|
||||
pub fn new(
|
||||
collider1: ColliderHandle,
|
||||
collider2: ColliderHandle,
|
||||
prev_status: Proximity,
|
||||
new_status: Proximity,
|
||||
) -> Self {
|
||||
assert_ne!(
|
||||
prev_status, new_status,
|
||||
"The previous and new status of a proximity event must not be the same."
|
||||
);
|
||||
Self {
|
||||
collider1,
|
||||
collider2,
|
||||
prev_status,
|
||||
new_status,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "simd-is-enabled")]
|
||||
pub(crate) use self::ball::WBall;
|
||||
@@ -60,14 +105,7 @@ pub(crate) use self::broad_phase_multi_sap::{BroadPhasePairEvent, ColliderPair};
|
||||
pub(crate) use self::collider_set::RemovedCollider;
|
||||
#[cfg(feature = "simd-is-enabled")]
|
||||
pub(crate) use self::contact::WContact;
|
||||
pub(crate) use self::contact_generator::clip_segments;
|
||||
#[cfg(feature = "dim2")]
|
||||
pub(crate) use self::contact_generator::clip_segments_with_normal;
|
||||
pub(crate) use self::narrow_phase::ContactManifoldIndex;
|
||||
#[cfg(feature = "dim3")]
|
||||
pub(crate) use self::polygonal_feature_map::PolygonalFeatureMap;
|
||||
#[cfg(feature = "dim3")]
|
||||
pub(crate) use self::polyhedron_feature3d::PolyhedronFace;
|
||||
pub(crate) use self::waabb::{WRay, WAABB};
|
||||
pub(crate) use self::wquadtree::WQuadtree;
|
||||
//pub(crate) use self::z_order::z_cmp_floats;
|
||||
@@ -80,16 +118,9 @@ mod collider;
|
||||
mod collider_set;
|
||||
mod contact;
|
||||
mod contact_generator;
|
||||
pub(crate) mod cuboid;
|
||||
#[cfg(feature = "dim2")]
|
||||
mod cuboid_feature2d;
|
||||
#[cfg(feature = "dim3")]
|
||||
mod cuboid_feature3d;
|
||||
mod interaction_graph;
|
||||
mod narrow_phase;
|
||||
mod polygon;
|
||||
#[cfg(feature = "dim3")]
|
||||
mod polyhedron_feature3d;
|
||||
mod proximity;
|
||||
mod proximity_detector;
|
||||
pub(crate) mod sat;
|
||||
@@ -98,11 +129,8 @@ mod trimesh;
|
||||
mod waabb;
|
||||
mod wquadtree;
|
||||
//mod z_order;
|
||||
mod capsule;
|
||||
mod interaction_groups;
|
||||
#[cfg(feature = "dim3")]
|
||||
mod polygonal_feature_map;
|
||||
#[cfg(feature = "dim3")]
|
||||
mod round_cylinder;
|
||||
mod shape;
|
||||
mod user_callbacks;
|
||||
|
||||
Reference in New Issue
Block a user