From 70e04f3ead6e8ae84c8c007ff509c8e9728acb53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 2 Oct 2022 16:50:07 +0200 Subject: [PATCH] Fix no-std build --- src/query/default_query_dispatcher.rs | 63 ++++++++++++++------------- src/query/time_of_impact/mod.rs | 20 +++++---- 2 files changed, 44 insertions(+), 39 deletions(-) diff --git a/src/query/default_query_dispatcher.rs b/src/query/default_query_dispatcher.rs index c1367723..f4344299 100644 --- a/src/query/default_query_dispatcher.rs +++ b/src/query/default_query_dispatcher.rs @@ -8,7 +8,7 @@ use crate::query::{ contact_manifolds::ContactManifoldsWorkspace, query_dispatcher::PersistentQueryDispatcher, ContactManifold, }; -use crate::shape::{HalfSpace, HeightField, Segment, Shape, ShapeType}; +use crate::shape::{HalfSpace, Segment, Shape, ShapeType}; /// A dispatcher that exposes built-in queries #[derive(Debug, Clone)] @@ -306,38 +306,39 @@ impl QueryDispatcher for DefaultQueryDispatcher { max_toi, stop_at_penetration, )) - } else if let Some(heightfield1) = shape1.as_shape::() { - query::details::time_of_impact_heightfield_shape( - self, - pos12, - local_vel12, - heightfield1, - shape2, - max_toi, - stop_at_penetration, - ) - } else if let Some(heightfield2) = shape1.as_shape::() { - query::details::time_of_impact_shape_heightfield( - self, - pos12, - local_vel12, - shape1, - heightfield2, - max_toi, - stop_at_penetration, - ) - } else if let (Some(s1), Some(s2)) = (shape1.as_support_map(), shape2.as_support_map()) { - Ok(query::details::time_of_impact_support_map_support_map( - pos12, - local_vel12, - s1, - s2, - max_toi, - stop_at_penetration, - )) } else { #[cfg(feature = "std")] - if let Some(c1) = shape1.as_composite_shape() { + if let Some(heightfield1) = shape1.as_heightfield() { + return query::details::time_of_impact_heightfield_shape( + self, + pos12, + local_vel12, + heightfield1, + shape2, + max_toi, + stop_at_penetration, + ); + } else if let Some(heightfield2) = shape1.as_heightfield() { + return query::details::time_of_impact_shape_heightfield( + self, + pos12, + local_vel12, + shape1, + heightfield2, + max_toi, + stop_at_penetration, + ); + } else if let (Some(s1), Some(s2)) = (shape1.as_support_map(), shape2.as_support_map()) + { + return Ok(query::details::time_of_impact_support_map_support_map( + pos12, + local_vel12, + s1, + s2, + max_toi, + stop_at_penetration, + )); + } else if let Some(c1) = shape1.as_composite_shape() { return Ok(query::details::time_of_impact_composite_shape_shape( self, pos12, diff --git a/src/query/time_of_impact/mod.rs b/src/query/time_of_impact/mod.rs index 97ea2b4c..915c0c0d 100644 --- a/src/query/time_of_impact/mod.rs +++ b/src/query/time_of_impact/mod.rs @@ -2,23 +2,27 @@ pub use self::time_of_impact::{time_of_impact, TOIStatus, TOI}; pub use self::time_of_impact_ball_ball::time_of_impact_ball_ball; -#[cfg(feature = "std")] -pub use self::time_of_impact_composite_shape_shape::{ - time_of_impact_composite_shape_shape, time_of_impact_shape_composite_shape, - TOICompositeShapeShapeBestFirstVisitor, -}; pub use self::time_of_impact_halfspace_support_map::{ time_of_impact_halfspace_support_map, time_of_impact_support_map_halfspace, }; -pub use self::time_of_impact_heightfield_shape::{ - time_of_impact_heightfield_shape, time_of_impact_shape_heightfield, +#[cfg(feature = "std")] +pub use self::{ + time_of_impact_composite_shape_shape::{ + time_of_impact_composite_shape_shape, time_of_impact_shape_composite_shape, + TOICompositeShapeShapeBestFirstVisitor, + }, + time_of_impact_heightfield_shape::{ + time_of_impact_heightfield_shape, time_of_impact_shape_heightfield, + }, + time_of_impact_support_map_support_map::time_of_impact_support_map_support_map, }; -pub use self::time_of_impact_support_map_support_map::time_of_impact_support_map_support_map; mod time_of_impact; mod time_of_impact_ball_ball; #[cfg(feature = "std")] mod time_of_impact_composite_shape_shape; mod time_of_impact_halfspace_support_map; +#[cfg(feature = "std")] mod time_of_impact_heightfield_shape; +#[cfg(feature = "std")] mod time_of_impact_support_map_support_map;