aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrozet Sébastien <developer@crozet.re>2021-05-16 17:49:20 +0200
committerCrozet Sébastien <developer@crozet.re>2021-05-16 17:49:20 +0200
commit1a84bf2af34176508bdda8d0f2ad2e46dc5c4df9 (patch)
treeb3f2ccf2ee0490eb59e4b84223446aa494d18c94
parentf350ac35d9889085af3f51a1894e2cc87173cb98 (diff)
downloadrapier-1a84bf2af34176508bdda8d0f2ad2e46dc5c4df9.tar.gz
rapier-1a84bf2af34176508bdda8d0f2ad2e46dc5c4df9.tar.bz2
rapier-1a84bf2af34176508bdda8d0f2ad2e46dc5c4df9.zip
Replace Kiss3d by Bevy for the testbed renderer.
-rw-r--r--Cargo.toml1
-rw-r--r--assets/FiraSans-Bold.ttfbin0 -> 438028 bytes
-rw-r--r--benchmarks3d/all_benchmarks3.rs6
-rw-r--r--benchmarks3d/balls3.rs5
-rw-r--r--benchmarks3d/boxes3.rs5
-rw-r--r--benchmarks3d/capsules3.rs5
-rw-r--r--benchmarks3d/ccd3.rs5
-rw-r--r--benchmarks3d/compound3.rs5
-rw-r--r--benchmarks3d/convex_polyhedron3.rs5
-rw-r--r--benchmarks3d/heightfield3.rs5
-rw-r--r--benchmarks3d/joint_ball3.rs5
-rw-r--r--benchmarks3d/joint_fixed3.rs5
-rw-r--r--benchmarks3d/joint_prismatic3.rs5
-rw-r--r--benchmarks3d/joint_revolute3.rs5
-rw-r--r--benchmarks3d/keva3.rs9
-rw-r--r--benchmarks3d/pyramid3.rs5
-rw-r--r--benchmarks3d/stacks3.rs5
-rw-r--r--benchmarks3d/trimesh3.rs5
-rw-r--r--build/rapier_testbed2d/Cargo.toml13
-rw-r--r--build/rapier_testbed3d/Cargo.toml15
-rw-r--r--examples2d/add_remove2.rs15
-rw-r--r--examples2d/all_examples2.rs4
-rw-r--r--examples2d/ccd2.rs7
-rw-r--r--examples2d/collision_groups2.rs11
-rw-r--r--examples2d/convex_polygons2.rs5
-rw-r--r--examples2d/debug_box_ball2.rs8
-rw-r--r--examples2d/heightfield2.rs5
-rw-r--r--examples2d/joints2.rs5
-rw-r--r--examples2d/locked_rotations2.rs5
-rw-r--r--examples2d/one_way_platforms2.rs11
-rw-r--r--examples2d/platform2.rs7
-rw-r--r--examples2d/polyline2.rs5
-rw-r--r--examples2d/pyramid2.rs5
-rw-r--r--examples2d/restitution2.rs5
-rw-r--r--examples2d/sensor2.rs11
-rw-r--r--examples2d/trimesh2.rs5
-rw-r--r--examples3d/Cargo.toml8
-rw-r--r--examples3d/all_examples3.rs5
-rw-r--r--examples3d/all_examples3_wasm.rs136
-rw-r--r--examples3d/ccd3.rs19
-rw-r--r--examples3d/collision_groups3.rs11
-rw-r--r--examples3d/compound3.rs5
-rw-r--r--examples3d/convex_decomposition3.rs67
-rw-r--r--examples3d/convex_polyhedron3.rs5
-rw-r--r--examples3d/debug_add_remove_collider3.rs14
-rw-r--r--examples3d/debug_big_colliders3.rs5
-rw-r--r--examples3d/debug_boxes3.rs5
-rw-r--r--examples3d/debug_cylinder3.rs5
-rw-r--r--examples3d/debug_dynamic_collider_add3.rs19
-rw-r--r--examples3d/debug_friction3.rs7
-rw-r--r--examples3d/debug_infinite_fall3.rs5
-rw-r--r--examples3d/debug_prismatic3.rs5
-rw-r--r--examples3d/debug_rollback3.rs7
-rw-r--r--examples3d/debug_shape_modification3.rs7
-rw-r--r--examples3d/debug_triangle3.rs5
-rw-r--r--examples3d/debug_trimesh3.rs18
-rw-r--r--examples3d/domino3.rs7
-rw-r--r--examples3d/fountain3.rs15
-rw-r--r--examples3d/heightfield3.rs5
-rw-r--r--examples3d/joints3.rs5
-rw-r--r--examples3d/keva3.rs9
-rw-r--r--examples3d/locked_rotations3.rs5
-rw-r--r--examples3d/one_way_platforms3.rs11
-rw-r--r--examples3d/platform3.rs7
-rw-r--r--examples3d/primitives3.rs5
-rw-r--r--examples3d/restitution3.rs5
-rw-r--r--examples3d/sensor3.rs11
-rw-r--r--examples3d/trimesh3.rs5
-rw-r--r--src_testbed/camera.rs94
-rw-r--r--src_testbed/engine.rs712
-rw-r--r--src_testbed/graphics.rs400
-rw-r--r--src_testbed/harness/mod.rs59
-rw-r--r--src_testbed/lib.rs9
-rw-r--r--src_testbed/objects/ball.rs76
-rw-r--r--src_testbed/objects/box_node.rs76
-rw-r--r--src_testbed/objects/capsule.rs77
-rw-r--r--src_testbed/objects/cone.rs77
-rw-r--r--src_testbed/objects/convex.rs96
-rw-r--r--src_testbed/objects/cylinder.rs77
-rw-r--r--src_testbed/objects/heightfield.rs128
-rw-r--r--src_testbed/objects/mesh.rs111
-rw-r--r--src_testbed/objects/mod.rs12
-rw-r--r--src_testbed/objects/node.rs547
-rw-r--r--src_testbed/objects/plane.rs132
-rw-r--r--src_testbed/objects/polyline.rs67
-rw-r--r--src_testbed/plugin.rs12
-rw-r--r--src_testbed/testbed.rs1928
-rw-r--r--src_testbed/ui.rs719
88 files changed, 2236 insertions, 3849 deletions
diff --git a/Cargo.toml b/Cargo.toml
index de3add6..7021ade 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,7 @@
[workspace]
members = [ "build/rapier2d", "build/rapier2d-f64", "build/rapier_testbed2d", "examples2d", "benchmarks2d",
"build/rapier3d", "build/rapier3d-f64", "build/rapier_testbed3d", "examples3d", "benchmarks3d" ]
+resolver = "2"
[patch.crates-io]
#wrapped2d = { git = "https://github.com/Bastacyclop/rust_box2d.git" }
diff --git a/assets/FiraSans-Bold.ttf b/assets/FiraSans-Bold.ttf
new file mode 100644
index 0000000..95e1660
--- /dev/null
+++ b/assets/FiraSans-Bold.ttf
Binary files differ
diff --git a/benchmarks3d/all_benchmarks3.rs b/benchmarks3d/all_benchmarks3.rs
index 38d71cd..d62c72c 100644
--- a/benchmarks3d/all_benchmarks3.rs
+++ b/benchmarks3d/all_benchmarks3.rs
@@ -7,7 +7,7 @@ use wasm_bindgen::prelude::*;
use inflector::Inflector;
-use rapier_testbed3d::Testbed;
+use rapier_testbed3d::{Testbed, TestbedApp};
use std::cmp::Ordering;
mod balls3;
@@ -80,12 +80,12 @@ pub fn main() {
.iter()
.position(|builder| builder.0.to_camel_case().as_str() == demo.as_str())
{
- Testbed::from_builders(0, vec![builders[i]]).run()
+ TestbedApp::from_builders(0, vec![builders[i]]).run()
} else {
eprintln!("Invalid example to run provided: '{}'", demo);
}
}
- Command::RunAll => Testbed::from_builders(0, builders).run(),
+ Command::RunAll => TestbedApp::from_builders(0, builders).run(),
Command::List => {
for builder in &builders {
println!("{}", builder.0.to_camel_case())
diff --git a/benchmarks3d/balls3.rs b/benchmarks3d/balls3.rs
index 1f0f1df..492aeac 100644
--- a/benchmarks3d/balls3.rs
+++ b/benchmarks3d/balls3.rs
@@ -51,8 +51,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Balls", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/boxes3.rs b/benchmarks3d/boxes3.rs
index 0eb31f5..86213af 100644
--- a/benchmarks3d/boxes3.rs
+++ b/benchmarks3d/boxes3.rs
@@ -61,8 +61,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/capsules3.rs b/benchmarks3d/capsules3.rs
index 0e8ad94..edd6d57 100644
--- a/benchmarks3d/capsules3.rs
+++ b/benchmarks3d/capsules3.rs
@@ -62,8 +62,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/ccd3.rs b/benchmarks3d/ccd3.rs
index f1831e7..a496648 100644
--- a/benchmarks3d/ccd3.rs
+++ b/benchmarks3d/ccd3.rs
@@ -78,8 +78,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/compound3.rs b/benchmarks3d/compound3.rs
index a8a9939..3f82ca0 100644
--- a/benchmarks3d/compound3.rs
+++ b/benchmarks3d/compound3.rs
@@ -69,8 +69,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/convex_polyhedron3.rs b/benchmarks3d/convex_polyhedron3.rs
index 30d77ac..0e14782 100644
--- a/benchmarks3d/convex_polyhedron3.rs
+++ b/benchmarks3d/convex_polyhedron3.rs
@@ -76,8 +76,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/heightfield3.rs b/benchmarks3d/heightfield3.rs
index fc64856..062e7c5 100644
--- a/benchmarks3d/heightfield3.rs
+++ b/benchmarks3d/heightfield3.rs
@@ -75,8 +75,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/joint_ball3.rs b/benchmarks3d/joint_ball3.rs
index 12b62a9..e7b3e3d 100644
--- a/benchmarks3d/joint_ball3.rs
+++ b/benchmarks3d/joint_ball3.rs
@@ -63,8 +63,3 @@ pub fn init_world(testbed: &mut Testbed) {
Point3::new(54.0, -38.0, 29.0),
);
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Joints", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/joint_fixed3.rs b/benchmarks3d/joint_fixed3.rs
index 9839e38..0475258 100644
--- a/benchmarks3d/joint_fixed3.rs
+++ b/benchmarks3d/joint_fixed3.rs
@@ -85,8 +85,3 @@ pub fn init_world(testbed: &mut Testbed) {
Point3::new(46.0, 12.0, 23.0),
);
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Joints", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/joint_prismatic3.rs b/benchmarks3d/joint_prismatic3.rs
index 3267ada..afc18fb 100644
--- a/benchmarks3d/joint_prismatic3.rs
+++ b/benchmarks3d/joint_prismatic3.rs
@@ -74,8 +74,3 @@ pub fn init_world(testbed: &mut Testbed) {
Point3::new(101.0, 4.0, -3.0),
);
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Joints", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/joint_revolute3.rs b/benchmarks3d/joint_revolute3.rs
index 040fc3e..0c647a6 100644
--- a/benchmarks3d/joint_revolute3.rs
+++ b/benchmarks3d/joint_revolute3.rs
@@ -82,8 +82,3 @@ pub fn init_world(testbed: &mut Testbed) {
Point3::new(134.0, 83.0, -116.0),
);
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Joints", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/keva3.rs b/benchmarks3d/keva3.rs
index 6862f25..9e6807a 100644
--- a/benchmarks3d/keva3.rs
+++ b/benchmarks3d/keva3.rs
@@ -51,7 +51,7 @@ pub fn build_block(
let collider = ColliderBuilder::cuboid(dim.x, dim.y, dim.z).build();
colliders.insert(collider, handle, bodies);
- testbed.set_body_color(handle, color0);
+ testbed.set_initial_body_color(handle, color0);
std::mem::swap(&mut color0, &mut color1);
}
}
@@ -73,7 +73,7 @@ pub fn build_block(
let handle = bodies.insert(rigid_body);
let collider = ColliderBuilder::cuboid(dim.x, dim.y, dim.z).build();
colliders.insert(collider, handle, bodies);
- testbed.set_body_color(handle, color0);
+ testbed.set_initial_body_color(handle, color0);
std::mem::swap(&mut color0, &mut color1);
}
}
@@ -137,8 +137,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/pyramid3.rs b/benchmarks3d/pyramid3.rs
index 5b6f34e..3b31eac 100644
--- a/benchmarks3d/pyramid3.rs
+++ b/benchmarks3d/pyramid3.rs
@@ -76,8 +76,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/stacks3.rs b/benchmarks3d/stacks3.rs
index 435dcb5..31dff0a 100644
--- a/benchmarks3d/stacks3.rs
+++ b/benchmarks3d/stacks3.rs
@@ -184,8 +184,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/benchmarks3d/trimesh3.rs b/benchmarks3d/trimesh3.rs
index e0701f1..0501d6f 100644
--- a/benchmarks3d/trimesh3.rs
+++ b/benchmarks3d/trimesh3.rs
@@ -80,8 +80,3 @@ pub fn init_world(testbed: &mut Testbed) {
testbed.set_world(bodies, colliders, joints);
testbed.look_at(Point3::new(100.0, 100.0, 100.0), Point3::origin());
}
-
-fn main() {
- let testbed = Testbed::from_builders(0, vec![("Boxes", init_world)]);
- testbed.run()
-}
diff --git a/build/rapier_testbed2d/Cargo.toml b/build/rapier_testbed2d/Cargo.toml
index eb713aa..b501a1f 100644
--- a/build/rapier_testbed2d/Cargo.toml
+++ b/build/rapier_testbed2d/Cargo.toml
@@ -27,7 +27,6 @@ other-backends = [ "wrapped2d", "nphysics2d" ]
[dependencies]
nalgebra = { version = "0.26", features = [ "rand" ] }
-kiss3d = { version = "0.31", features = [ "conrod" ] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = [ "web-sys", "now" ]}
@@ -42,6 +41,18 @@ bincode = "1"
Inflector = "0.11"
md5 = "0.7"
+bevy_egui = "0.4"
+bevy-orbit-controls = "2"
+
+# Dependencies for native only.
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+bevy = {version = "0.5", default-features = false, features = ["bevy_wgpu", "bevy_winit", "render", "x11"]}
+
+# Dependencies for WASM only.
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+bevy = {version = "0.5", default-features = false, features = ["bevy_winit", "render"]}
+bevy_webgl2 = "0.5"
+
[dependencies.rapier2d]
path = "../rapier2d"
version = "0.8"
diff --git a/build/rapier_testbed3d/Cargo.toml b/build/rapier_testbed3d/Cargo.toml
index ea10307..0038fa8 100644
--- a/build/rapier_testbed3d/Cargo.toml
+++ b/build/rapier_testbed3d/Cargo.toml
@@ -26,7 +26,6 @@ other-backends = [ "physx", "physx-sys", "glam", "nphysics3d" ]
[dependencies]
nalgebra = { version = "0.26", features = [ "rand" ] }
-kiss3d = { version = "0.31", features = [ "conrod" ] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = [ "web-sys", "now" ]}
@@ -44,7 +43,19 @@ md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = [ "derive" ] }
+bevy_egui = "0.4"
+bevy-orbit-controls = "2"
+
+# Dependencies for native only.
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+bevy = {version = "0.5", default-features = false, features = ["bevy_wgpu", "bevy_winit", "render", "x11"]}
+
+# Dependencies for WASM only.
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+bevy = {version = "0.5", default-features = false, features = ["bevy_winit", "render"]}
+bevy_webgl2 = "0.5"
+
[dependencies.rapier3d]
path = "../rapier3d"
version = "0.8"
-features = [ "serde-serialize" ]
+features = [ "serde-serialize" ] \ No newline at end of file
diff --git a/examples2d/add_remove2.rs b/examples2d/add_remove2.rs
index 826d5c9..9f9f65a 100644
--- a/