aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Crozet <sebcrozet@dimforge.com>2024-03-17 21:20:18 +0100
committerSébastien Crozet <sebcrozet@dimforge.com>2024-03-17 21:24:28 +0100
commitecd308338b189ab569816a38a03e3f8b89669dde (patch)
treefa612abff2f23ea6a5ff04c64c07296d9fb065c8
parentda92e5c2837b27433286cf0dd9d887fd44dda254 (diff)
downloadrapier-bevy-glam.tar.gz
rapier-bevy-glam.tar.bz2
rapier-bevy-glam.zip
feat: start experimenting with a glam/bevy versionbevy-glam
-rw-r--r--Cargo.toml21
-rw-r--r--crates/rapier2d/Cargo.toml46
-rw-r--r--crates/rapier3d/Cargo.toml48
-rw-r--r--crates/rapier_testbed3d/Cargo.toml2
-rw-r--r--examples3d/Cargo.toml2
-rw-r--r--examples3d/ccd3.rs4
-rw-r--r--examples3d/convex_polyhedron3.rs2
-rw-r--r--examples3d/debug_deserialize3.rs2
-rw-r--r--examples3d/debug_prismatic3.rs2
-rw-r--r--examples3d/joints3.rs18
-rw-r--r--examples3d/keva3.rs4
-rw-r--r--src/control/character_controller.rs112
-rw-r--r--src/control/ray_cast_vehicle_controller.rs114
-rw-r--r--src/data/arena.rs2
-rw-r--r--src/data/coarena.rs21
-rw-r--r--src/data/entity_arena.rs145
-rw-r--r--src/data/mod.rs6
-rw-r--r--src/dynamics/ccd/ccd_solver.rs55
-rw-r--r--src/dynamics/ccd/toi_entry.rs12
-rw-r--r--src/dynamics/coefficient_combine_rule.rs10
-rw-r--r--src/dynamics/integration_parameters.rs2
-rw-r--r--src/dynamics/island_manager.rs10
-rw-r--r--src/dynamics/joint/fixed_joint.rs26
-rw-r--r--src/dynamics/joint/generic_joint.rs65
-rw-r--r--src/dynamics/joint/impulse_joint/impulse_joint.rs4
-rw-r--r--src/dynamics/joint/impulse_joint/impulse_joint_set.rs107
-rw-r--r--src/dynamics/joint/motor_model.rs2
-rw-r--r--src/dynamics/joint/multibody_joint/multibody.rs80
-rw-r--r--src/dynamics/joint/multibody_joint/multibody_joint.rs47
-rw-r--r--src/dynamics/joint/multibody_joint/multibody_joint_set.rs111
-rw-r--r--src/dynamics/joint/multibody_joint/multibody_link.rs28
-rw-r--r--src/dynamics/joint/multibody_joint/multibody_workspace.rs8
-rw-r--r--src/dynamics/joint/multibody_joint/unit_multibody_joint.rs2
-rw-r--r--src/dynamics/joint/prismatic_joint.rs30
-rw-r--r--src/dynamics/joint/revolute_joint.rs21
-rw-r--r--src/dynamics/joint/rope_joint.rs14
-rw-r--r--src/dynamics/joint/spherical_joint.rs26
-rw-r--r--src/dynamics/joint/spring_joint.rs14
-rw-r--r--src/dynamics/rigid_body.rs178
-rw-r--r--src/dynamics/rigid_body_components.rs302
-rw-r--r--src/dynamics/rigid_body_set.rs61
-rw-r--r--src/dynamics/solver/categorization.rs4
-rw-r--r--src/dynamics/solver/contact_constraint/contact_constraints_set.rs14
-rw-r--r--src/dynamics/solver/contact_constraint/generic_one_body_constraint.rs28
-rw-r--r--src/dynamics/solver/contact_constraint/generic_one_body_constraint_element.rs17
-rw-r--r--src/dynamics/solver/contact_constraint/generic_two_body_constraint.rs48
-rw-r--r--src/dynamics/solver/contact_constraint/generic_two_body_constraint_element.rs75
-rw-r--r--src/dynamics/solver/contact_constraint/one_body_constraint.rs64
-rw-r--r--src/dynamics/solver/contact_constraint/one_body_constraint_element.rs107
-rw-r--r--src/dynamics/solver/contact_constraint/one_body_constraint_simd.rs86
-rw-r--r--src/dynamics/solver/contact_constraint/two_body_constraint.rs112
-rw-r--r--src/dynamics/solver/contact_constraint/two_body_constraint_element.rs143
-rw-r--r--src/dynamics/solver/contact_constraint/two_body_constraint_simd.rs88
-rw-r--r--src/dynamics/solver/island_solver.rs2
-rw-r--r--src/dynamics/solver/joint_constraint/any_joint_constraint.rs2
-rw-r--r--src/dynamics/solver/joint_constraint/joint_constraint_builder.rs1096
-rw-r--r--src/dynamics/solver/joint_constraint/joint_constraint_helper.rs141
-rw-r--r--src/dynamics/solver/joint_constraint/joint_constraint_helper_simd.rs19
-rw-r--r--src/dynamics/solver/joint_constraint/joint_constraint_helper_template.rs966
-rw-r--r--src/dynamics/solver/joint_constraint/joint_generic_constraint.rs24
-rw-r--r--src/dynamics/solver/joint_constraint/joint_generic_constraint_builder.rs110
-rw-r--r--src/dynamics/solver/joint_constraint/joint_velocity_constraint.rs106
-rw-r--r--src/dynamics/solver/joint_constraint/mod.rs8
-rw-r--r--src/dynamics/solver/parallel_island_solver.rs2
-rw-r--r--src/dynamics/solver/parallel_solver_constraints.rs2
-rw-r--r--src/dynamics/solver/parallel_velocity_solver.rs2
-rw-r--r--src/dynamics/solver/solver_body.rs39
-rw-r--r--src/dynamics/solver/solver_constraints_set.rs2
-rw-r--r--src/dynamics/solver/solver_vel.rs25
-rw-r--r--src/dynamics/solver/velocity_solver.rs14
-rw-r--r--src/geometry/broad_phase_multi_sap/broad_phase.rs6
-rw-r--r--src/geometry/broad_phase_multi_sap/broad_phase_pair_event.rs8
-rw-r--r--src/geometry/broad_phase_multi_sap/sap_axis.rs2
-rw-r--r--src/geometry/broad_phase_multi_sap/sap_endpoint.rs2
-rw-r--r--src/geometry/broad_phase_multi_sap/sap_layer.rs36
-rw-r--r--src/geometry/broad_phase_multi_sap/sap_utils.rs18
-rw-r--r--src/geometry/broad_phase_qbvh.rs2
-rw-r--r--src/geometry/collider.rs171
-rw-r--r--src/geometry/collider_components.rs160
-rw-r--r--src/geometry/collider_set.rs95
-rw-r--r--src/geometry/contact_pair.rs27
-rw-r--r--src/geometry/interaction_groups.rs10
-rw-r--r--src/geometry/mod.rs24
-rw-r--r--src/geometry/narrow_phase.rs61
-rw-r--r--src/lib.rs42
-rw-r--r--src/linalg/linalg_glam.rs279
-rw-r--r--src/linalg/linalg_glam_simd.rs262
-rw-r--r--src/linalg/linalg_nalgebra.rs459
-rw-r--r--src/linalg/mod.rs5
-rw-r--r--src/pipeline/debug_render_pipeline/debug_render_backend.rs44
-rw-r--r--src/pipeline/debug_render_pipeline/debug_render_pipeline.rs29
-rw-r--r--src/pipeline/debug_render_pipeline/outlines.rs6
-rw-r--r--src/pipeline/event_handler.rs8
-rw-r--r--src/pipeline/physics_hooks.rs20
-rw-r--r--src/pipeline/physics_pipeline.rs7
-rw-r--r--src/pipeline/query_pipeline.rs26
-rw-r--r--src/utils.rs534
-rw-r--r--src_testbed/debug_render.rs4
-rw-r--r--src_testbed/graphics.rs6
-rw-r--r--src_testbed/harness/mod.rs2
-rw-r--r--src_testbed/objects/node.rs8
-rw-r--r--src_testbed/physics/mod.rs2
-rw-r--r--src_testbed/testbed.rs4
103 files changed, 4350 insertions, 3131 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 023432e..195f5e4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[workspace]
-members = [ "crates/rapier2d", "crates/rapier2d-f64", "crates/rapier_testbed2d", "crates/rapier_testbed2d-f64", "examples2d", "benchmarks2d",
- "crates/rapier3d", "crates/rapier3d-f64", "crates/rapier_testbed3d", "crates/rapier_testbed3d-f64", "examples3d", "examples3d-f64", "benchmarks3d" ]
+members = ["crates/rapier2d", "crates/rapier2d-f64", "crates/rapier_testbed2d", "crates/rapier_testbed2d-f64", "examples2d", "benchmarks2d",
+ "crates/rapier3d", "crates/rapier3d-f64", "crates/rapier_testbed3d", "crates/rapier_testbed3d-f64", "examples3d", "examples3d-f64", "benchmarks3d"]
resolver = "2"
[patch.crates-io]
@@ -12,15 +12,14 @@ resolver = "2"
#parry3d = { path = "../parry/crates/parry3d" }
#parry2d-f64 = { path = "../parry/crates/parry2d-f64" }
#parry3d-f64 = { path = "../parry/crates/parry3d-f64" }
-# nalgebra = { path = "../nalgebra" }
-
-
-#kiss3d = { git = "https://github.com/sebcrozet/kiss3d" }
-#nalgebra = { git = "https://github.com/dimforge/nalgebra", branch = "dev" }
-#parry2d = { git = "https://github.com/dimforge/parry", branch = "master" }
-#parry3d = { git = "https://github.com/dimforge/parry", branch = "master" }
-#parry2d-f64 = { git = "https://github.com/dimforge/parry", branch = "master" }
-#parry3d-f64 = { git = "https://github.com/dimforge/parry", branch = "master" }
+#nalgebra = { path = "../nalgebra" }
+
+simba = { git = "https://github.com/dimforge/simba", rev = "7b50b3eb568e9c551431286a95c913a7057de58f" }
+nalgebra = { git = "https://github.com/dimforge/nalgebra", rev = "25032f089bb2e8a8bd2c1d419f1613911a042895" }
+parry2d = { git = "https://github.com/dimforge/parry", rev = "c0e6f8032396396f93b5ad687504bed9d676aaee" }
+parry3d = { git = "https://github.com/dimforge/parry", rev = "c0e6f8032396396f93b5ad687504bed9d676aaee" }
+parry2d-f64 = { git = "https://github.com/dimforge/parry", rev = "c0e6f8032396396f93b5ad687504bed9d676aaee" }
+parry3d-f64 = { git = "https://github.com/dimforge/parry", rev = "c0e6f8032396396f93b5ad687504bed9d676aaee" }
[profile.release]
#debug = true
diff --git a/crates/rapier2d/Cargo.toml b/crates/rapier2d/Cargo.toml
index 0d8bc24..f73107d 100644
--- a/crates/rapier2d/Cargo.toml
+++ b/crates/rapier2d/Cargo.toml
@@ -1,14 +1,14 @@
[package]
-name = "rapier2d"
+name = "rapier2d"
version = "0.18.0"
-authors = [ "Sébastien Crozet <developer@crozet.re>" ]
+authors = ["Sébastien Crozet <developer@crozet.re>"]
description = "2-dimensional physics engine in Rust."
documentation = "https://docs.rs/rapier2d"
homepage = "https://rapier.rs"
repository = "https://github.com/dimforge/rapier"
readme = "README.md"
-categories = [ "science", "game-development", "mathematics", "simulation", "wasm"]
-keywords = [ "physics", "dynamics", "rigid", "real-time", "impulse_joints" ]
+categories = ["science", "game-development", "mathematics", "simulation", "wasm"]
+keywords = ["physics", "dynamics", "rigid", "real-time", "impulse_joints"]
license = "Apache-2.0"
edition = "2021"
@@ -16,23 +16,26 @@ edition = "2021"
maintenance = { status = "actively-developed" }
[features]
-default = [ "dim2", "f32" ]
-dim2 = [ ]
-f32 = [ ]
-parallel = [ "rayon" ]
-simd-stable = [ "simba/wide", "simd-is-enabled" ]
-simd-nightly = [ "simba/packed_simd", "simd-is-enabled" ]
+default = ["dim2", "f32"]
+dim2 = []
+f32 = []
+linalg-nalgebra = ["parry2d/linalg-nalgebra"]
+linalg-glam = ["parry2d/linalg-glam", "glam"]
+
+parallel = ["rayon"]
+simd-stable = ["simba/wide", "simd-is-enabled"]
+simd-nightly = ["simba/packed_simd", "simd-is-enabled"]
# Do not enable this feature directly. It is automatically
# enabled with the "simd-stable" or "simd-nightly" feature.
-simd-is-enabled = [ "vec_map" ]
-wasm-bindgen = [ "instant/wasm-bindgen" ]
-serde-serialize = [ "nalgebra/serde-serialize", "parry2d/serde-serialize", "serde", "bit-vec/serde", "arrayvec/serde" ]
-enhanced-determinism = [ "simba/libm_force", "parry2d/enhanced-determinism" ]
-debug-render = [ ]
-profiler = [ "instant" ] # Enables the internal profiler.
+simd-is-enabled = ["vec_map"]
+wasm-bindgen = ["instant/wasm-bindgen"]
+serde-serialize = ["nalgebra/serde-serialize", "parry2d/serde-serialize", "serde", "bit-vec/serde", "arrayvec/serde"]
+enhanced-determinism = ["simba/libm_force", "parry2d/enhanced-determinism"]
+debug-render = []
+profiler = ["instant"] # Enables the internal profiler.
# Feature used for debugging only.
-debug-disable-legitimate-fe-exceptions = [ ]
+debug-disable-legitimate-fe-exceptions = []
# Feature used for development and debugging only.
# Do not enable this unless you are working on the engine internals.
@@ -44,12 +47,12 @@ features = ["parallel", "simd-stable", "serde-serialize", "debug-render"]
[lib]
name = "rapier2d"
path = "../../src/lib.rs"
-required-features = [ "dim2", "f32" ]
+required-features = ["dim2", "f32"]
[dependencies]
vec_map = { version = "0.8", optional = true }
-instant = { version = "0.1", features = [ "now" ], optional = true }
+instant = { version = "0.1", features = ["now"], optional = true }
num-traits = "0.2"
nalgebra = "0.32"
parry2d = "0.13.1"
@@ -60,11 +63,12 @@ crossbeam = "0.8"
arrayvec = "0.7"
bit-vec = "0.6"
rustc-hash = "1"
-serde = { version = "1", features = [ "derive" ], optional = true }
+serde = { version = "1", features = ["derive"], optional = true }
downcast-rs = "1.2"
num-derive = "0.4"
bitflags = "1"
+glam = { version = "0.25", optional = true }
[dev-dependencies]
bincode = "1"
-serde = { version = "1", features = [ "derive" ] }
+serde = { version = "1", features = ["derive"] }
diff --git a/crates/rapier3d/Cargo.toml b/crates/rapier3d/Cargo.toml
index 1d3605b..dbe15f5 100644
--- a/crates/rapier3d/Cargo.toml
+++ b/crates/rapier3d/Cargo.toml
@@ -1,14 +1,14 @@
[package]
-name = "rapier3d"
+name = "rapier3d"
version = "0.18.0"
-authors = [ "Sébastien Crozet <developer@crozet.re>" ]
+authors = ["Sébastien Crozet <developer@crozet.re>"]
description = "3-dimensional physics engine in Rust."
documentation = "https://docs.rs/rapier3d"
homepage = "https://rapier.rs"
repository = "https://github.com/dimforge/rapier"
readme = "README.md"
-categories = [ "science", "game-development", "mathematics", "simulation", "wasm"]
-keywords = [ "physics", "dynamics", "rigid", "real-time", "impulse_joints" ]
+categories = ["science", "game-development", "mathematics", "simulation", "wasm"]
+keywords = ["physics", "dynamics", "rigid", "real-time", "impulse_joints"]
license = "Apache-2.0"
edition = "2021"
@@ -16,23 +16,26 @@ edition = "2021"
maintenance = { status = "actively-developed" }
[features]
-default = [ "dim3", "f32" ]
-dim3 = [ ]
-f32 = [ ]
-parallel = [ "rayon" ]
-simd-stable = [ "parry3d/simd-stable", "simba/wide", "simd-is-enabled" ]
-simd-nightly = [ "parry3d/simd-nightly", "simba/packed_simd", "simd-is-enabled" ]
+default = ["dim3", "f32"]
+dim3 = []
+f32 = []
+linalg-nalgebra = ["parry3d/linalg-nalgebra"]
+linalg-glam = ["parry3d/linalg-glam", "glam", "bevy"] # FIXME: don’t enable bevy by default
+
+parallel = ["rayon"]
+simd-stable = ["parry3d/simd-stable", "simba/wide", "simd-is-enabled"]
+simd-nightly = ["parry3d/simd-nightly", "simba/packed_simd", "simd-is-enabled"]
# Do not enable this feature directly. It is automatically
# enabled with the "simd-stable" or "simd-nightly" feature.
-simd-is-enabled = [ "vec_map" ]
-wasm-bindgen = [ "instant/wasm-bindgen" ]
-serde-serialize = [ "nalgebra/serde-serialize", "parry3d/serde-serialize", "serde", "bit-vec/serde" ]
-enhanced-determinism = [ "simba/libm_force", "parry3d/enhanced-determinism" ]
-debug-render = [ ]
-profiler = [ "instant" ] # Enables the internal profiler.
+simd-is-enabled = ["vec_map"]
+wasm-bindgen = ["instant/wasm-bindgen"]
+serde-serialize = ["nalgebra/serde-serialize", "parry3d/serde-serialize", "serde", "bit-vec/serde"]
+enhanced-determinism = ["simba/libm_force", "parry3d/enhanced-determinism"]
+debug-render = []
+profiler = ["instant"] # Enables the internal profiler.
# Feature used for debugging only.
-debug-disable-legitimate-fe-exceptions = [ ]
+debug-disable-legitimate-fe-exceptions = []
# Feature used for development and debugging only.
# Do not enable this unless you are working on the engine internals.
@@ -44,12 +47,12 @@ features = ["parallel", "simd-stable", "serde-serialize", "debug-render"]
[lib]
name = "rapier3d"
path = "../../src/lib.rs"
-required-features = [ "dim3", "f32" ]
+required-features = ["dim3", "f32"]
[dependencies]
vec_map = { version = "0.8", optional = true }
-instant = { version = "0.1", features = [ "now" ], optional = true }
+instant = { version = "0.1", features = ["now"], optional = true }
num-traits = "0.2"
nalgebra = "0.32"
parry3d = "0.13.1"
@@ -60,11 +63,14 @@ crossbeam = "0.8"
arrayvec = "0.7"
bit-vec = "0.6"
rustc-hash = "1"
-serde = { version = "1", features = [ "derive" ], optional = true }
+serde = { version = "1", features = ["derive"], optional = true }
downcast-rs = "1.2"
num-derive = "0.4"
bitflags = "1"
+glam = { version = "0.25", optional = true }
+
+bevy = { version = "0.13", default-features = false, optional = true } # FIXME: depend on bevy-ecs only?
[dev-dependencies]
bincode = "1"
-serde = { version = "1", features = [ "derive" ] }
+serde = { version = "1", features = ["derive"] }
diff --git a/crates/rapier_testbed3d/Cargo.toml b/crates/rapier_testbed3d/Cargo.toml
index 3b3bdeb..e8de12f 100644
--- a/crates/rapier_testbed3d/Cargo.toml
+++ b/crates/rapier_testbed3d/Cargo.toml
@@ -21,6 +21,8 @@ required-features = [ "dim3" ]
[features]
default = [ "dim3" ]
dim3 = [ ]
+linalg-nalgebra = [ "rapier/linalg-nalgebra" ]
+linalg-glam = [ "rapier/linalg-glam" ]
parallel = [ "rapier/parallel", "num_cpus" ]
other-backends = [ "physx", "physx-sys", "glam" ]
diff --git a/examples3d/Cargo.toml b/examples3d/Cargo.toml
index 1e44b3d..1edf6fe 100644
--- a/examples3d/Cargo.toml
+++ b/