use crate::math::{Isometry, Real};
use crate::partitioning::{IndexedData, Qbvh};
use crate::query::details::NormalConstraints;
use crate::shape::Shape;
#[cfg(feature = "std")]
pub trait SimdCompositeShape {
fn map_part_at(
&self,
shape_id: u32,
f: &mut dyn FnMut(Option<&Isometry<Real>>, &dyn Shape, Option<&dyn NormalConstraints>),
);
fn qbvh(&self) -> &Qbvh<u32>;
}
#[cfg(feature = "std")]
pub trait TypedSimdCompositeShape {
type PartShape: ?Sized + Shape;
type PartNormalConstraints: ?Sized + NormalConstraints;
type PartId: IndexedData;
fn map_typed_part_at(
&self,
shape_id: Self::PartId,
f: impl FnMut(Option<&Isometry<Real>>, &Self::PartShape, Option<&Self::PartNormalConstraints>),
);
fn map_untyped_part_at(
&self,
shape_id: Self::PartId,
f: impl FnMut(Option<&Isometry<Real>>, &dyn Shape, Option<&dyn NormalConstraints>),
);
fn typed_qbvh(&self) -> &Qbvh<Self::PartId>;
}
#[cfg(feature = "std")]
impl<'a> TypedSimdCompositeShape for dyn SimdCompositeShape + 'a {
type PartShape = dyn Shape;
type PartNormalConstraints = dyn NormalConstraints;
type PartId = u32;
fn map_typed_part_at(
&self,
shape_id: u32,
mut f: impl FnMut(
Option<&Isometry<Real>>,
&Self::PartShape,
Option<&Self::PartNormalConstraints>,
),
) {
self.map_part_at(shape_id, &mut f)
}
fn map_untyped_part_at(
&self,
shape_id: u32,
mut f: impl FnMut(Option<&Isometry<Real>>, &dyn Shape, Option<&dyn NormalConstraints>),
) {
self.map_part_at(shape_id, &mut f)
}
fn typed_qbvh(&self) -> &Qbvh<Self::PartId> {
self.qbvh()
}
}