From dc4bd24da869cfa8143c3ee9a98cdec662db289e Mon Sep 17 00:00:00 2001 From: Thierry Berger Date: Wed, 8 Jan 2025 17:16:34 +0100 Subject: Update to Parry 0.18 (#770) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update to parry ~main * use traverse_depth_first * add example to test intersection * rely on upstream PR rather than local * re-enable profiler_ui for examples * rely on official parry repository * chore: switch back to the published version of parry * chore: update changelog * chore: remove dead code * fix compilation of rapier3d-meshloader and rapier3d-urdf * chore: cargo fmt --------- Co-authored-by: Sébastien Crozet --- crates/rapier2d-f64/Cargo.toml | 2 +- crates/rapier2d/Cargo.toml | 2 +- crates/rapier3d-f64/Cargo.toml | 2 +- crates/rapier3d-meshloader/Cargo.toml | 2 +- crates/rapier3d-urdf/Cargo.toml | 8 +++++--- crates/rapier3d-urdf/src/lib.rs | 13 +++++++++---- crates/rapier3d/Cargo.toml | 2 +- crates/rapier_testbed2d-f64/Cargo.toml | 4 ++-- crates/rapier_testbed2d/Cargo.toml | 4 ++-- crates/rapier_testbed3d-f64/Cargo.toml | 4 ++-- crates/rapier_testbed3d/Cargo.toml | 4 ++-- 11 files changed, 27 insertions(+), 20 deletions(-) (limited to 'crates') diff --git a/crates/rapier2d-f64/Cargo.toml b/crates/rapier2d-f64/Cargo.toml index bd3a90c..04465ad 100644 --- a/crates/rapier2d-f64/Cargo.toml +++ b/crates/rapier2d-f64/Cargo.toml @@ -68,7 +68,7 @@ vec_map = { version = "0.8", optional = true } web-time = { version = "1.1", optional = true } num-traits = "0.2" nalgebra = "0.33" -parry2d-f64 = "0.17.0" +parry2d-f64 = "0.18.0" simba = "0.9" approx = "0.5" rayon = { version = "1", optional = true } diff --git a/crates/rapier2d/Cargo.toml b/crates/rapier2d/Cargo.toml index 9757186..c4de36a 100644 --- a/crates/rapier2d/Cargo.toml +++ b/crates/rapier2d/Cargo.toml @@ -68,7 +68,7 @@ vec_map = { version = "0.8", optional = true } web-time = { version = "1.1", optional = true } num-traits = "0.2" nalgebra = "0.33" -parry2d = "0.17.0" +parry2d = "0.18.0" simba = "0.9" approx = "0.5" rayon = { version = "1", optional = true } diff --git a/crates/rapier3d-f64/Cargo.toml b/crates/rapier3d-f64/Cargo.toml index 5923828..0d2ce4d 100644 --- a/crates/rapier3d-f64/Cargo.toml +++ b/crates/rapier3d-f64/Cargo.toml @@ -71,7 +71,7 @@ vec_map = { version = "0.8", optional = true } web-time = { version = "1.1", optional = true } num-traits = "0.2" nalgebra = "0.33" -parry3d-f64 = "0.17.0" +parry3d-f64 = "0.18.0" simba = "0.9" approx = "0.5" rayon = { version = "1", optional = true } diff --git a/crates/rapier3d-meshloader/Cargo.toml b/crates/rapier3d-meshloader/Cargo.toml index 211cea0..5505c63 100644 --- a/crates/rapier3d-meshloader/Cargo.toml +++ b/crates/rapier3d-meshloader/Cargo.toml @@ -27,6 +27,6 @@ wavefront = ["mesh-loader/obj"] [dependencies] thiserror = "1.0.61" profiling = "1.0" -mesh-loader = { version = "0.1.12", optional = true } +mesh-loader = "0.1.12" rapier3d = { version = "0.22", path = "../rapier3d" } diff --git a/crates/rapier3d-urdf/Cargo.toml b/crates/rapier3d-urdf/Cargo.toml index df45749..386b6f2 100644 --- a/crates/rapier3d-urdf/Cargo.toml +++ b/crates/rapier3d-urdf/Cargo.toml @@ -19,9 +19,11 @@ license = "Apache-2.0" edition = "2021" [features] -stl = ["dep:rapier3d-meshloader", "rapier3d-meshloader/stl"] -collada = ["dep:rapier3d-meshloader", "rapier3d-meshloader/collada"] -wavefront = ["dep:rapier3d-meshloader", "rapier3d-meshloader/wavefront"] +stl = ["dep:rapier3d-meshloader", "rapier3d-meshloader/stl", "__meshloader_is_enabled"] +collada = ["dep:rapier3d-meshloader", "rapier3d-meshloader/collada", "__meshloader_is_enabled"] +wavefront = ["dep:rapier3d-meshloader", "rapier3d-meshloader/wavefront", "__meshloader_is_enabled"] +## Private feature for detecting when meshloader is enabled by any of the file type features above. +__meshloader_is_enabled = [] [dependencies] log = "0.4" diff --git a/crates/rapier3d-urdf/src/lib.rs b/crates/rapier3d-urdf/src/lib.rs index 1f93fc7..dc4614b 100644 --- a/crates/rapier3d-urdf/src/lib.rs +++ b/crates/rapier3d-urdf/src/lib.rs @@ -37,7 +37,6 @@ use rapier3d::{ geometry::{Collider, ColliderBuilder, ColliderHandle, ColliderSet, SharedShape, TriMeshFlags}, math::{Isometry, Point, Real, Vector}, na, - prelude::MeshConverter, }; use std::collections::HashMap; use std::path::Path; @@ -462,7 +461,7 @@ fn urdf_to_rigid_body(options: &UrdfLoaderOptions, inertial: &Inertial) -> Rigid fn urdf_to_colliders( options: &UrdfLoaderOptions, - mesh_dir: &Path, + _mesh_dir: &Path, // Unused if none of the meshloader features is enabled. geometry: &Geometry, origin: &Pose, ) -> Vec { @@ -496,14 +495,20 @@ fn urdf_to_colliders( Geometry::Sphere { radius } => { colliders.push(SharedShape::ball(*radius as Real)); } + #[cfg(not(feature = "__meshloader_is_enabled"))] + Geometry::Mesh { .. } => { + log::error!("Mesh loading is disabled by default. Enable one of the format features (`stl`, `collada`, `wavefront`) of `rapier3d-urdf` for mesh support."); + } + #[cfg(feature = "__meshloader_is_enabled")] Geometry::Mesh { filename, scale } => { - let full_path = mesh_dir.join(filename); + let full_path = _mesh_dir.join(filename); let scale = scale .map(|s| Vector::new(s[0] as Real, s[1] as Real, s[2] as Real)) .unwrap_or_else(|| Vector::::repeat(1.0)); + let Ok(loaded_mesh) = rapier3d_meshloader::load_from_path( full_path, - &MeshConverter::TriMeshWithFlags(options.trimesh_flags), + &rapier3d::prelude::MeshConverter::TriMeshWithFlags(options.trimesh_flags), scale, ) else { return Vec::new(); diff --git a/crates/rapier3d/Cargo.toml b/crates/rapier3d/Cargo.toml index 7f8b4f3..77621ba 100644 --- a/crates/rapier3d/Cargo.toml +++ b/crates/rapier3d/Cargo.toml @@ -71,7 +71,7 @@ vec_map = { version = "0.8", optional = true } web-time = { version = "1.1", optional = true } num-traits = "0.2" nalgebra = "0.33" -parry3d = "0.17.0" +parry3d = "0.18.0" simba = "0.9" approx = "0.5" rayon = { version = "1", optional = true } diff --git a/crates/rapier_testbed2d-f64/Cargo.toml b/crates/rapier_testbed2d-f64/Cargo.toml index c3e5455..7a8fa3b 100644 --- a/crates/rapier_testbed2d-f64/Cargo.toml +++ b/crates/rapier_testbed2d-f64/Cargo.toml @@ -34,12 +34,12 @@ default = ["dim2"] dim2 = [] parallel = ["rapier/parallel", "num_cpus"] other-backends = ["wrapped2d"] -profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"] +profiler_ui = ["dep:puffin_egui", "profiling/profile-with-puffin"] # See https://github.com/dimforge/rapier/issues/760. unstable-puffin-pr-235 = [] [package.metadata.docs.rs] -features = ["parallel", "profiling"] +features = ["parallel", "profiler_ui"] [lints.clippy] needless_lifetimes = "allow" diff --git a/crates/rapier_testbed2d/Cargo.toml b/crates/rapier_testbed2d/Cargo.toml index bbfe385..2d6ccef 100644 --- a/crates/rapier_testbed2d/Cargo.toml +++ b/crates/rapier_testbed2d/Cargo.toml @@ -34,12 +34,12 @@ default = ["dim2"] dim2 = [] parallel = ["rapier/parallel", "num_cpus"] other-backends = ["wrapped2d"] -profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"] +profiler_ui = ["dep:puffin_egui", "profiling/profile-with-puffin"] # See https://github.com/dimforge/rapier/issues/760. unstable-puffin-pr-235 = [] [package.metadata.docs.rs] -features = ["parallel", "other-backends", "profiling"] +features = ["parallel", "other-backends", "profiler_ui"] [lints.clippy] needless_lifetimes = "allow" diff --git a/crates/rapier_testbed3d-f64/Cargo.toml b/crates/rapier_testbed3d-f64/Cargo.toml index f698e21..367c2a5 100644 --- a/crates/rapier_testbed3d-f64/Cargo.toml +++ b/crates/rapier_testbed3d-f64/Cargo.toml @@ -36,12 +36,12 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [ default = ["dim3"] dim3 = [] parallel = ["rapier/parallel", "num_cpus"] -profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"] +profiler_ui = ["dep:puffin_egui", "profiling/profile-with-puffin"] # See https://github.com/dimforge/rapier/issues/760. unstable-puffin-pr-235 = [] [package.metadata.docs.rs] -features = ["parallel", "profiling"] +features = ["parallel", "profiler_ui"] [lints.clippy] needless_lifetimes = "allow" diff --git a/crates/rapier_testbed3d/Cargo.toml b/crates/rapier_testbed3d/Cargo.toml index 0fa5944..e87d8ec 100644 --- a/crates/rapier_testbed3d/Cargo.toml +++ b/crates/rapier_testbed3d/Cargo.toml @@ -34,12 +34,12 @@ default = ["dim3"] dim3 = [] parallel = ["rapier/parallel", "num_cpus"] other-backends = ["physx", "physx-sys", "glam"] -profiling = ["dep:puffin_egui", "profiling/profile-with-puffin"] +profiler_ui = ["dep:puffin_egui", "profiling/profile-with-puffin"] # See https://github.com/dimforge/rapier/issues/760. unstable-puffin-pr-235 = [] [package.metadata.docs.rs] -features = ["parallel", "other-backends", "profiling"] +features = ["parallel", "other-backends", "profiler_ui"] [lints.clippy] needless_lifetimes = "allow" -- cgit