Fix 2D compilation.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
use crate::math::{AngVector, Real, Vector};
|
use crate::math::{AngVector, Vector};
|
||||||
use na::{Scalar, SimdRealField};
|
use na::{Scalar, SimdRealField};
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use crate::dynamics::{BodyPair, JointGraphEdge, JointIndex, RigidBodySet};
|
|||||||
use crate::geometry::{ContactManifold, ContactManifoldIndex};
|
use crate::geometry::{ContactManifold, ContactManifoldIndex};
|
||||||
#[cfg(feature = "simd-is-enabled")]
|
#[cfg(feature = "simd-is-enabled")]
|
||||||
use {
|
use {
|
||||||
crate::math::{Real, SIMD_LAST_INDEX, SIMD_WIDTH},
|
crate::math::{SIMD_LAST_INDEX, SIMD_WIDTH},
|
||||||
vec_map::VecMap,
|
vec_map::VecMap,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
use super::{FixedPositionConstraint, FixedPositionGroundConstraint};
|
use super::{FixedPositionConstraint, FixedPositionGroundConstraint};
|
||||||
use crate::dynamics::{FixedJoint, IntegrationParameters, JointIndex, RigidBody};
|
use crate::dynamics::{FixedJoint, IntegrationParameters, RigidBody};
|
||||||
use crate::math::{AngularInertia, Isometry, Point, Real, Rotation, Vector, SIMD_WIDTH};
|
use crate::math::{Isometry, Real, SIMD_WIDTH};
|
||||||
use crate::utils::WAngularInertia;
|
|
||||||
use na::Unit;
|
|
||||||
|
|
||||||
// TODO: this does not uses SIMD optimizations yet.
|
// TODO: this does not uses SIMD optimizations yet.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
use super::{PrismaticPositionConstraint, PrismaticPositionGroundConstraint};
|
use super::{PrismaticPositionConstraint, PrismaticPositionGroundConstraint};
|
||||||
use crate::dynamics::{IntegrationParameters, JointIndex, PrismaticJoint, RigidBody};
|
use crate::dynamics::{IntegrationParameters, PrismaticJoint, RigidBody};
|
||||||
use crate::math::{AngularInertia, Isometry, Point, Real, Rotation, Vector, SIMD_WIDTH};
|
use crate::math::{Isometry, Real, SIMD_WIDTH};
|
||||||
use crate::utils::WAngularInertia;
|
|
||||||
use na::Unit;
|
|
||||||
|
|
||||||
// TODO: this does not uses SIMD optimizations yet.
|
// TODO: this does not uses SIMD optimizations yet.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::dynamics::{BodyPair, RigidBodySet};
|
use crate::dynamics::{BodyPair, RigidBodySet};
|
||||||
use crate::geometry::{Collider, ColliderPair, ContactManifold};
|
use crate::geometry::{ColliderPair, ContactManifold};
|
||||||
use crate::math::{Point, Real, Vector};
|
use crate::math::{Point, Real, Vector};
|
||||||
use cdl::query::ContactManifoldsWorkspace;
|
use cdl::query::ContactManifoldsWorkspace;
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ impl<'a> TypedSimdCompositeShape for QueryPipelineAsCompositeShape<'a> {
|
|||||||
fn map_untyped_part_at(
|
fn map_untyped_part_at(
|
||||||
&self,
|
&self,
|
||||||
shape_id: Self::PartId,
|
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);
|
self.map_typed_part_at(shape_id, f);
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ impl QueryPipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Find up to one collider intersecting the given shape.
|
/// Find up to one collider intersecting the given shape.
|
||||||
fn intersection_with_shape(
|
pub fn intersection_with_shape(
|
||||||
&self,
|
&self,
|
||||||
colliders: &ColliderSet,
|
colliders: &ColliderSet,
|
||||||
shape_pos: &Isometry<Real>,
|
shape_pos: &Isometry<Real>,
|
||||||
@@ -237,7 +237,7 @@ impl QueryPipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Projects a point on the scene.
|
/// Projects a point on the scene.
|
||||||
fn project_point(
|
pub fn project_point(
|
||||||
&self,
|
&self,
|
||||||
colliders: &ColliderSet,
|
colliders: &ColliderSet,
|
||||||
point: &Point<Real>,
|
point: &Point<Real>,
|
||||||
@@ -279,7 +279,7 @@ impl QueryPipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Projects a point on the scene and get
|
/// Projects a point on the scene and get
|
||||||
fn project_point_and_get_feature(
|
pub fn project_point_and_get_feature(
|
||||||
&self,
|
&self,
|
||||||
colliders: &ColliderSet,
|
colliders: &ColliderSet,
|
||||||
point: &Point<Real>,
|
point: &Point<Real>,
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
use crate::objects::node::{self, GraphicsNode};
|
use crate::objects::node::{self, GraphicsNode};
|
||||||
use kiss3d::window::Window;
|
use kiss3d::window::Window;
|
||||||
use na::{Isometry3, Point3};
|
use na::Point3;
|
||||||
use rapier::geometry::{ColliderHandle, ColliderSet};
|
use rapier::geometry::{ColliderHandle, ColliderSet};
|
||||||
|
use rapier::math::Isometry;
|
||||||
|
|
||||||
pub struct Ball {
|
pub struct Ball {
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
base_color: Point3<f32>,
|
base_color: Point3<f32>,
|
||||||
gfx: GraphicsNode,
|
gfx: GraphicsNode,
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ball {
|
impl Ball {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
radius: f32,
|
radius: f32,
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
|
|||||||
@@ -1,21 +1,21 @@
|
|||||||
use crate::objects::node::{self, GraphicsNode};
|
use crate::objects::node::{self, GraphicsNode};
|
||||||
use kiss3d::window;
|
use kiss3d::window;
|
||||||
use na::{Isometry3, Point3};
|
use na::Point3;
|
||||||
use rapier::geometry::{ColliderHandle, ColliderSet};
|
use rapier::geometry::{ColliderHandle, ColliderSet};
|
||||||
use rapier::math::Vector;
|
use rapier::math::{Isometry, Vector};
|
||||||
|
|
||||||
pub struct Box {
|
pub struct Box {
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
base_color: Point3<f32>,
|
base_color: Point3<f32>,
|
||||||
gfx: GraphicsNode,
|
gfx: GraphicsNode,
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Box {
|
impl Box {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
half_extents: Vector<f32>,
|
half_extents: Vector<f32>,
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
window: &mut window::Window,
|
window: &mut window::Window,
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
use crate::objects::node::{self, GraphicsNode};
|
use crate::objects::node::{self, GraphicsNode};
|
||||||
use kiss3d::window;
|
use kiss3d::window;
|
||||||
use na::{Isometry3, Point3};
|
use na::Point3;
|
||||||
use rapier::geometry::{self, ColliderHandle, ColliderSet};
|
use rapier::geometry::{self, ColliderHandle, ColliderSet};
|
||||||
|
use rapier::math::Isometry;
|
||||||
|
|
||||||
pub struct Capsule {
|
pub struct Capsule {
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
base_color: Point3<f32>,
|
base_color: Point3<f32>,
|
||||||
gfx: GraphicsNode,
|
gfx: GraphicsNode,
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Capsule {
|
impl Capsule {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
capsule: &geometry::Capsule,
|
capsule: &geometry::Capsule,
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
window: &mut window::Window,
|
window: &mut window::Window,
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
use crate::objects::node::{self, GraphicsNode};
|
use crate::objects::node::{self, GraphicsNode};
|
||||||
use kiss3d::window::Window;
|
use kiss3d::window::Window;
|
||||||
use na::{Isometry3, Point3};
|
use na::Point3;
|
||||||
use rapier::geometry::{ColliderHandle, ColliderSet};
|
use rapier::geometry::{ColliderHandle, ColliderSet};
|
||||||
|
use rapier::math::Isometry;
|
||||||
|
|
||||||
pub struct Cone {
|
pub struct Cone {
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
base_color: Point3<f32>,
|
base_color: Point3<f32>,
|
||||||
gfx: GraphicsNode,
|
gfx: GraphicsNode,
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Cone {
|
impl Cone {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
half_height: f32,
|
half_height: f32,
|
||||||
radius: f32,
|
radius: f32,
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ use crate::math::Vector;
|
|||||||
use crate::math::{Isometry, Point};
|
use crate::math::{Isometry, Point};
|
||||||
use crate::objects::node::{self, GraphicsNode};
|
use crate::objects::node::{self, GraphicsNode};
|
||||||
use kiss3d::window::Window;
|
use kiss3d::window::Window;
|
||||||
use na::{Isometry3, Point3};
|
use na::Point3;
|
||||||
use rapier::geometry::{ColliderHandle, ColliderSet};
|
use rapier::geometry::{ColliderHandle, ColliderSet};
|
||||||
|
|
||||||
pub struct Convex {
|
pub struct Convex {
|
||||||
@@ -13,13 +13,13 @@ pub struct Convex {
|
|||||||
base_color: Point3<f32>,
|
base_color: Point3<f32>,
|
||||||
gfx: GraphicsNode,
|
gfx: GraphicsNode,
|
||||||
body: ColliderHandle,
|
body: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Convex {
|
impl Convex {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
body: ColliderHandle,
|
body: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
vertices: Vec<Point<f32>>,
|
vertices: Vec<Point<f32>>,
|
||||||
#[cfg(feature = "dim3")] indices: Vec<Point<u32>>,
|
#[cfg(feature = "dim3")] indices: Vec<Point<u32>>,
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
use crate::objects::node::{self, GraphicsNode};
|
use crate::objects::node::{self, GraphicsNode};
|
||||||
use kiss3d::window::Window;
|
use kiss3d::window::Window;
|
||||||
use na::{Isometry3, Point3};
|
use na::Point3;
|
||||||
use rapier::geometry::{ColliderHandle, ColliderSet};
|
use rapier::geometry::{ColliderHandle, ColliderSet};
|
||||||
|
use rapier::math::Isometry;
|
||||||
|
|
||||||
pub struct Cylinder {
|
pub struct Cylinder {
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
base_color: Point3<f32>,
|
base_color: Point3<f32>,
|
||||||
gfx: GraphicsNode,
|
gfx: GraphicsNode,
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Cylinder {
|
impl Cylinder {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
collider: ColliderHandle,
|
collider: ColliderHandle,
|
||||||
delta: Isometry3<f32>,
|
delta: Isometry<f32>,
|
||||||
half_height: f32,
|
half_height: f32,
|
||||||
radius: f32,
|
radius: f32,
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
#[cfg(feature = "dim3")]
|
|
||||||
use crate::objects::node::{self, GraphicsNode};
|
|
||||||
use cdl::shape;
|
use cdl::shape;
|
||||||
use kiss3d::resource::Mesh;
|
|
||||||
use kiss3d::window::Window;
|
use kiss3d::window::Window;
|
||||||
use na::{self, Point3};
|
use na::{self, Point3};
|
||||||
use rapier::geometry::{ColliderHandle, ColliderSet};
|
use rapier::geometry::{ColliderHandle, ColliderSet};
|
||||||
#[cfg(feature = "dim2")]
|
#[cfg(feature = "dim2")]
|
||||||
use rapier::math::Point;
|
use rapier::math::Point;
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
use rapier::math::Vector;
|
use {
|
||||||
use std::cell::RefCell;
|
crate::objects::node::{self, GraphicsNode},
|
||||||
|
kiss3d::resource::Mesh,
|
||||||
|
rapier::math::Vector,
|
||||||
|
std::cell::RefCell,
|
||||||
|
};
|
||||||
|
|
||||||
pub struct HeightField {
|
pub struct HeightField {
|
||||||
color: Point3<f32>,
|
color: Point3<f32>,
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ use kiss3d::planar_camera::PlanarCamera;
|
|||||||
use kiss3d::post_processing::PostProcessingEffect;
|
use kiss3d::post_processing::PostProcessingEffect;
|
||||||
use kiss3d::text::Font;
|
use kiss3d::text::Font;
|
||||||
use kiss3d::window::{State, Window};
|
use kiss3d::window::{State, Window};
|
||||||
use na::{self, Isometry3, Point2, Point3, Vector3};
|
use na::{self, Point2, Point3, Vector3};
|
||||||
use rapier::dynamics::{
|
use rapier::dynamics::{
|
||||||
ActivationStatus, IntegrationParameters, JointSet, RigidBodyHandle, RigidBodySet,
|
ActivationStatus, IntegrationParameters, JointSet, RigidBodyHandle, RigidBodySet,
|
||||||
};
|
};
|
||||||
use rapier::geometry::{BroadPhase, ColliderHandle, ColliderSet, NarrowPhase};
|
use rapier::geometry::{BroadPhase, ColliderHandle, ColliderSet, NarrowPhase};
|
||||||
#[cfg(feature = "dim3")]
|
#[cfg(feature = "dim3")]
|
||||||
use rapier::geometry::{InteractionGroups, Ray};
|
use rapier::geometry::{InteractionGroups, Ray};
|
||||||
use rapier::math::Vector;
|
use rapier::math::{Isometry, Vector};
|
||||||
use rapier::pipeline::{ChannelEventCollector, PhysicsPipeline, QueryPipeline};
|
use rapier::pipeline::{ChannelEventCollector, PhysicsPipeline, QueryPipeline};
|
||||||
|
|
||||||
#[cfg(all(feature = "dim2", feature = "other-backends"))]
|
#[cfg(all(feature = "dim2", feature = "other-backends"))]
|
||||||
@@ -1126,8 +1126,9 @@ impl State for Testbed {
|
|||||||
|
|
||||||
if self.state.selected_example != prev_example {
|
if self.state.selected_example != prev_example {
|
||||||
self.physics.integration_parameters = IntegrationParameters::default();
|
self.physics.integration_parameters = IntegrationParameters::default();
|
||||||
if self.state.selected_backend == PHYSX_BACKEND_PATCH_FRICTION
|
if cfg!(feature = "dim3")
|
||||||
|| self.state.selected_backend == PHYSX_BACKEND_TWO_FRICTION_DIR
|
&& (self.state.selected_backend == PHYSX_BACKEND_PATCH_FRICTION
|
||||||
|
|| self.state.selected_backend == PHYSX_BACKEND_TWO_FRICTION_DIR)
|
||||||
{
|
{
|
||||||
std::mem::swap(
|
std::mem::swap(
|
||||||
&mut self.physics.integration_parameters.max_velocity_iterations,
|
&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 pos1 = colliders[pair.pair.collider1].position();
|
||||||
let pos2 = colliders[pair.pair.collider2].position();
|
let pos2 = colliders[pair.pair.collider2].position();
|
||||||
let start =
|
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 =
|
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
|
let n = pos1
|
||||||
* manifold.subshape_pos1.unwrap_or(Isometry3::identity())
|
* manifold.subshape_pos1.unwrap_or(Isometry::identity())
|
||||||
* manifold.local_n1;
|
* manifold.local_n1;
|
||||||
|
|
||||||
use crate::engine::GraphicsWindow;
|
use crate::engine::GraphicsWindow;
|
||||||
|
|||||||
Reference in New Issue
Block a user