Fix 2D compilation.

This commit is contained in:
Crozet Sébastien
2021-01-06 12:53:26 +01:00
parent d1ed279c4e
commit 261ed1ebed
14 changed files with 48 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
use crate::math::{AngVector, Real, Vector};
use crate::math::{AngVector, Vector};
use na::{Scalar, SimdRealField};
#[derive(Copy, Clone, Debug)]

View File

@@ -2,7 +2,7 @@ use crate::dynamics::{BodyPair, JointGraphEdge, JointIndex, RigidBodySet};
use crate::geometry::{ContactManifold, ContactManifoldIndex};
#[cfg(feature = "simd-is-enabled")]
use {
crate::math::{Real, SIMD_LAST_INDEX, SIMD_WIDTH},
crate::math::{SIMD_LAST_INDEX, SIMD_WIDTH},
vec_map::VecMap,
};

View File

@@ -1,8 +1,6 @@
use super::{FixedPositionConstraint, FixedPositionGroundConstraint};
use crate::dynamics::{FixedJoint, IntegrationParameters, JointIndex, RigidBody};
use crate::math::{AngularInertia, Isometry, Point, Real, Rotation, Vector, SIMD_WIDTH};
use crate::utils::WAngularInertia;
use na::Unit;
use crate::dynamics::{FixedJoint, IntegrationParameters, RigidBody};
use crate::math::{Isometry, Real, SIMD_WIDTH};
// TODO: this does not uses SIMD optimizations yet.
#[derive(Debug)]

View File

@@ -1,8 +1,6 @@
use super::{PrismaticPositionConstraint, PrismaticPositionGroundConstraint};
use crate::dynamics::{IntegrationParameters, JointIndex, PrismaticJoint, RigidBody};
use crate::math::{AngularInertia, Isometry, Point, Real, Rotation, Vector, SIMD_WIDTH};
use crate::utils::WAngularInertia;
use na::Unit;
use crate::dynamics::{IntegrationParameters, PrismaticJoint, RigidBody};
use crate::math::{Isometry, Real, SIMD_WIDTH};
// TODO: this does not uses SIMD optimizations yet.
#[derive(Debug)]

View File

@@ -1,5 +1,5 @@
use crate::dynamics::{BodyPair, RigidBodySet};
use crate::geometry::{Collider, ColliderPair, ContactManifold};
use crate::geometry::{ColliderPair, ContactManifold};
use crate::math::{Point, Real, Vector};
use cdl::query::ContactManifoldsWorkspace;

View File

@@ -58,7 +58,7 @@ impl<'a> TypedSimdCompositeShape for QueryPipelineAsCompositeShape<'a> {
fn map_untyped_part_at(
&self,
shape_id: Self::PartId,
mut f: impl FnMut(Option<&Isometry<Real>>, &Self::PartShape),
f: impl FnMut(Option<&Isometry<Real>>, &Self::PartShape),
) {
self.map_typed_part_at(shape_id, f);
}
@@ -216,7 +216,7 @@ impl QueryPipeline {
}
/// Find up to one collider intersecting the given shape.
fn intersection_with_shape(
pub fn intersection_with_shape(
&self,
colliders: &ColliderSet,
shape_pos: &Isometry<Real>,
@@ -237,7 +237,7 @@ impl QueryPipeline {
}
/// Projects a point on the scene.
fn project_point(
pub fn project_point(
&self,
colliders: &ColliderSet,
point: &Point<Real>,
@@ -279,7 +279,7 @@ impl QueryPipeline {
}
/// Projects a point on the scene and get
fn project_point_and_get_feature(
pub fn project_point_and_get_feature(
&self,
colliders: &ColliderSet,
point: &Point<Real>,

View File

@@ -1,20 +1,21 @@
use crate::objects::node::{self, GraphicsNode};
use kiss3d::window::Window;
use na::{Isometry3, Point3};
use na::Point3;
use rapier::geometry::{ColliderHandle, ColliderSet};
use rapier::math::Isometry;
pub struct Ball {
color: Point3<f32>,
base_color: Point3<f32>,
gfx: GraphicsNode,
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
}
impl Ball {
pub fn new(
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
radius: f32,
color: Point3<f32>,
window: &mut Window,

View File

@@ -1,21 +1,21 @@
use crate::objects::node::{self, GraphicsNode};
use kiss3d::window;
use na::{Isometry3, Point3};
use na::Point3;
use rapier::geometry::{ColliderHandle, ColliderSet};
use rapier::math::Vector;
use rapier::math::{Isometry, Vector};
pub struct Box {
color: Point3<f32>,
base_color: Point3<f32>,
gfx: GraphicsNode,
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
}
impl Box {
pub fn new(
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
half_extents: Vector<f32>,
color: Point3<f32>,
window: &mut window::Window,

View File

@@ -1,20 +1,21 @@
use crate::objects::node::{self, GraphicsNode};
use kiss3d::window;
use na::{Isometry3, Point3};
use na::Point3;
use rapier::geometry::{self, ColliderHandle, ColliderSet};
use rapier::math::Isometry;
pub struct Capsule {
color: Point3<f32>,
base_color: Point3<f32>,
gfx: GraphicsNode,
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
}
impl Capsule {
pub fn new(
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
capsule: &geometry::Capsule,
color: Point3<f32>,
window: &mut window::Window,

View File

@@ -1,20 +1,21 @@
use crate::objects::node::{self, GraphicsNode};
use kiss3d::window::Window;
use na::{Isometry3, Point3};
use na::Point3;
use rapier::geometry::{ColliderHandle, ColliderSet};
use rapier::math::Isometry;
pub struct Cone {
color: Point3<f32>,
base_color: Point3<f32>,
gfx: GraphicsNode,
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
}
impl Cone {
pub fn new(
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
half_height: f32,
radius: f32,
color: Point3<f32>,

View File

@@ -5,7 +5,7 @@ use crate::math::Vector;
use crate::math::{Isometry, Point};
use crate::objects::node::{self, GraphicsNode};
use kiss3d::window::Window;
use na::{Isometry3, Point3};
use na::Point3;
use rapier::geometry::{ColliderHandle, ColliderSet};
pub struct Convex {
@@ -13,13 +13,13 @@ pub struct Convex {
base_color: Point3<f32>,
gfx: GraphicsNode,
body: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
}
impl Convex {
pub fn new(
body: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
vertices: Vec<Point<f32>>,
#[cfg(feature = "dim3")] indices: Vec<Point<u32>>,
color: Point3<f32>,

View File

@@ -1,20 +1,21 @@
use crate::objects::node::{self, GraphicsNode};
use kiss3d::window::Window;
use na::{Isometry3, Point3};
use na::Point3;
use rapier::geometry::{ColliderHandle, ColliderSet};
use rapier::math::Isometry;
pub struct Cylinder {
color: Point3<f32>,
base_color: Point3<f32>,
gfx: GraphicsNode,
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
}
impl Cylinder {
pub fn new(
collider: ColliderHandle,
delta: Isometry3<f32>,
delta: Isometry<f32>,
half_height: f32,
radius: f32,
color: Point3<f32>,

View File

@@ -1,15 +1,16 @@
#[cfg(feature = "dim3")]
use crate::objects::node::{self, GraphicsNode};
use cdl::shape;
use kiss3d::resource::Mesh;
use kiss3d::window::Window;
use na::{self, Point3};
use rapier::geometry::{ColliderHandle, ColliderSet};
#[cfg(feature = "dim2")]
use rapier::math::Point;
#[cfg(feature = "dim3")]
use rapier::math::Vector;
use std::cell::RefCell;
use {
crate::objects::node::{self, GraphicsNode},
kiss3d::resource::Mesh,
rapier::math::Vector,
std::cell::RefCell,
};
pub struct HeightField {
color: Point3<f32>,

View File

@@ -17,14 +17,14 @@ use kiss3d::planar_camera::PlanarCamera;
use kiss3d::post_processing::PostProcessingEffect;
use kiss3d::text::Font;
use kiss3d::window::{State, Window};
use na::{self, Isometry3, Point2, Point3, Vector3};
use na::{self, Point2, Point3, Vector3};
use rapier::dynamics::{
ActivationStatus, IntegrationParameters, JointSet, RigidBodyHandle, RigidBodySet,
};
use rapier::geometry::{BroadPhase, ColliderHandle, ColliderSet, NarrowPhase};
#[cfg(feature = "dim3")]
use rapier::geometry::{InteractionGroups, Ray};
use rapier::math::Vector;
use rapier::math::{Isometry, Vector};
use rapier::pipeline::{ChannelEventCollector, PhysicsPipeline, QueryPipeline};
#[cfg(all(feature = "dim2", feature = "other-backends"))]
@@ -1126,8 +1126,9 @@ impl State for Testbed {
if self.state.selected_example != prev_example {
self.physics.integration_parameters = IntegrationParameters::default();
if self.state.selected_backend == PHYSX_BACKEND_PATCH_FRICTION
|| self.state.selected_backend == PHYSX_BACKEND_TWO_FRICTION_DIR
if cfg!(feature = "dim3")
&& (self.state.selected_backend == PHYSX_BACKEND_PATCH_FRICTION
|| self.state.selected_backend == PHYSX_BACKEND_TWO_FRICTION_DIR)
{
std::mem::swap(
&mut self.physics.integration_parameters.max_velocity_iterations,
@@ -1534,11 +1535,11 @@ fn draw_contacts(window: &mut Window, nf: &NarrowPhase, colliders: &ColliderSet)
let pos1 = colliders[pair.pair.collider1].position();
let pos2 = colliders[pair.pair.collider2].position();
let start =
pos1 * manifold.subshape_pos1.unwrap_or(Isometry3::identity()) * pt.local_p1;
pos1 * manifold.subshape_pos1.unwrap_or(Isometry::identity()) * pt.local_p1;
let end =
pos2 * manifold.subshape_pos2.unwrap_or(Isometry3::identity()) * pt.local_p2;
pos2 * manifold.subshape_pos2.unwrap_or(Isometry::identity()) * pt.local_p2;
let n = pos1
* manifold.subshape_pos1.unwrap_or(Isometry3::identity())
* manifold.subshape_pos1.unwrap_or(Isometry::identity())
* manifold.local_n1;
use crate::engine::GraphicsWindow;