From 865ce8a8e5301b23ca474adaaffe8b43e725803e Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 20 Oct 2020 11:55:33 +0200 Subject: Collider shape: use a trait-object instead of an enum. --- src/geometry/trimesh.rs | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) (limited to 'src/geometry/trimesh.rs') diff --git a/src/geometry/trimesh.rs b/src/geometry/trimesh.rs index b6e23e7..38ce0a3 100644 --- a/src/geometry/trimesh.rs +++ b/src/geometry/trimesh.rs @@ -1,13 +1,9 @@ -use crate::geometry::{Triangle, WQuadtree}; +use crate::geometry::{PointProjection, Ray, RayIntersection, Triangle, WQuadtree}; use crate::math::{Isometry, Point}; use na::Point3; use ncollide::bounding_volume::{HasBoundingVolume, AABB}; - -#[cfg(feature = "dim3")] -use { - crate::geometry::{Ray, RayIntersection}, - ncollide::query::RayCast, -}; +use ncollide::query::{PointQuery, RayCast}; +use ncollide::shape::FeatureId; #[derive(Clone)] #[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))] @@ -110,6 +106,41 @@ impl Trimesh { } } +impl PointQuery for Trimesh { + fn project_point(&self, m: &Isometry, pt: &Point, solid: bool) -> PointProjection { + // TODO + unimplemented!() + } + + fn project_point_with_feature( + &self, + m: &Isometry, + pt: &Point, + ) -> (PointProjection, FeatureId) { + // TODO + unimplemented!() + } +} + +#[cfg(feature = "dim2")] +impl RayCast for Trimesh { + fn toi_and_normal_with_ray( + &self, + m: &Isometry, + ray: &Ray, + max_toi: f32, + solid: bool, + ) -> Option { + // TODO + None + } + + fn intersects_ray(&self, m: &Isometry, ray: &Ray, max_toi: f32) -> bool { + // TODO + false + } +} + #[cfg(feature = "dim3")] impl RayCast for Trimesh { fn toi_and_normal_with_ray( -- cgit From 949e3f5384a366c3bff5415c5db4635e811a580e Mon Sep 17 00:00:00 2001 From: Crozet Sébastien Date: Tue, 20 Oct 2020 16:22:53 +0200 Subject: Fix many warnings. --- src/geometry/trimesh.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/geometry/trimesh.rs') diff --git a/src/geometry/trimesh.rs b/src/geometry/trimesh.rs index 38ce0a3..b4e8518 100644 --- a/src/geometry/trimesh.rs +++ b/src/geometry/trimesh.rs @@ -107,15 +107,15 @@ impl Trimesh { } impl PointQuery for Trimesh { - fn project_point(&self, m: &Isometry, pt: &Point, solid: bool) -> PointProjection { + fn project_point(&self, _m: &Isometry, _pt: &Point, _solid: bool) -> PointProjection { // TODO unimplemented!() } fn project_point_with_feature( &self, - m: &Isometry, - pt: &Point, + _m: &Isometry, + _pt: &Point, ) -> (PointProjection, FeatureId) { // TODO unimplemented!() @@ -126,16 +126,16 @@ impl PointQuery for Trimesh { impl RayCast for Trimesh { fn toi_and_normal_with_ray( &self, - m: &Isometry, - ray: &Ray, - max_toi: f32, - solid: bool, + _m: &Isometry, + _ray: &Ray, + _max_toi: f32, + _solid: bool, ) -> Option { // TODO None } - fn intersects_ray(&self, m: &Isometry, ray: &Ray, max_toi: f32) -> bool { + fn intersects_ray(&self, _m: &Isometry, _ray: &Ray, _max_toi: f32) -> bool { // TODO false } -- cgit