aboutsummaryrefslogtreecommitdiff
path: root/src/geometry
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2020-10-06 15:49:22 +0200
committerCrozet Sébastien <developer@crozet.re>2020-10-06 15:49:22 +0200
commite87b73a2a20fee1ed333d564ba46dbf1c3ca75e2 (patch)
treea4031976bb6a9f8cf81880c8ed4e0d1c72e919cb /src/geometry
parentc5a8e03df7b3009b24e7c272fafcc49b4bc4e829 (diff)
downloadrapier-e87b73a2a20fee1ed333d564ba46dbf1c3ca75e2.tar.gz
rapier-e87b73a2a20fee1ed333d564ba46dbf1c3ca75e2.tar.bz2
rapier-e87b73a2a20fee1ed333d564ba46dbf1c3ca75e2.zip
Fix compilation in 2D.
Diffstat (limited to 'src/geometry')
-rw-r--r--src/geometry/collider.rs3
-rw-r--r--src/geometry/trimesh.rs10
-rw-r--r--src/geometry/wquadtree.rs6
3 files changed, 15 insertions, 4 deletions
diff --git a/src/geometry/collider.rs b/src/geometry/collider.rs
index 23345f7..7c293b6 100644
--- a/src/geometry/collider.rs
+++ b/src/geometry/collider.rs
@@ -124,7 +124,7 @@ impl Shape {
}
Shape::Cuboid(cuboid) => cuboid.toi_and_normal_with_ray(position, ray, max_toi, true),
#[cfg(feature = "dim2")]
- Shape::Triangle(triangle) => {
+ Shape::Triangle(_) | Shape::Trimesh(_) => {
// This is not implemented yet in 2D.
None
}
@@ -132,6 +132,7 @@ impl Shape {
Shape::Triangle(triangle) => {
triangle.toi_and_normal_with_ray(position, ray, max_toi, true)
}
+ #[cfg(feature = "dim3")]
Shape::Trimesh(trimesh) => {
trimesh.toi_and_normal_with_ray(position, ray, max_toi, true)
}
diff --git a/src/geometry/trimesh.rs b/src/geometry/trimesh.rs
index dd8cb4b..b6e23e7 100644
--- a/src/geometry/trimesh.rs
+++ b/src/geometry/trimesh.rs
@@ -1,9 +1,14 @@
-use crate::geometry::{Ray, RayIntersection, Triangle, WQuadtree};
+use crate::geometry::{Triangle, WQuadtree};
use crate::math::{Isometry, Point};
-use crate::ncollide::query::RayCast;
use na::Point3;
use ncollide::bounding_volume::{HasBoundingVolume, AABB};
+#[cfg(feature = "dim3")]
+use {
+ crate::geometry::{Ray, RayIntersection},
+ ncollide::query::RayCast,
+};
+
#[derive(Clone)]
#[cfg_attr(feature = "serde-serialize", derive(Serialize, Deserialize))]
/// A triangle mesh.
@@ -105,6 +110,7 @@ impl Trimesh {
}
}
+#[cfg(feature = "dim3")]
impl RayCast<f32> for Trimesh {
fn toi_and_normal_with_ray(
&self,
diff --git a/src/geometry/wquadtree.rs b/src/geometry/wquadtree.rs
index 233ebd1..fce04eb 100644
--- a/src/geometry/wquadtree.rs
+++ b/src/geometry/wquadtree.rs
@@ -1,6 +1,8 @@
use crate::geometry::{ColliderHandle, ColliderSet, Ray, AABB};
use crate::geometry::{WRay, WAABB};
-use crate::math::{Point, Vector};
+use crate::math::Point;
+#[cfg(feature = "dim3")]
+use crate::math::Vector;
use crate::simd::{SimdFloat, SIMD_WIDTH};
use ncollide::bounding_volume::BoundingVolume;
use simba::simd::{SimdBool, SimdValue};
@@ -252,6 +254,7 @@ impl<T: IndexedData> WQuadtree<T> {
// Find the axis with minimum variance. This is the axis along
// which we are **not** subdividing our set.
+ #[allow(unused_mut)] // Does not need to be mutable in 2D.
let mut subdiv_dims = [0, 1];
#[cfg(feature = "dim3")]
{
@@ -466,6 +469,7 @@ impl<T: IndexedData> WQuadtreeIncrementalBuilder<T> {
// Find the axis with minimum variance. This is the axis along
// which we are **not** subdividing our set.
+ #[allow(unused_mut)] // Does not need to be mutable in 2D.
let mut subdiv_dims = [0, 1];
#[cfg(feature = "dim3")]
{