Skip to content

Commit

Permalink
update testbeds to bevy 0.14 (#723)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vrixyz authored Sep 6, 2024
1 parent bedb12b commit 04058a1
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 41 deletions.
16 changes: 8 additions & 8 deletions crates/rapier_testbed2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ other-backends = ["wrapped2d"]
features = ["parallel", "other-backends"]

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam025"] }
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = ["web-sys", "now"] }
Expand All @@ -51,16 +51,16 @@ bincode = "1"
Inflector = "0.11"
md5 = "0.7"

bevy_egui = "0.26"
bevy_ecs = "0.13"
bevy_core_pipeline = "0.13"
bevy_pbr = "0.13"
bevy_sprite = "0.13"
bevy_egui = "0.29"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
#bevy_prototype_debug_lines = "0.7"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_asset",
"bevy_winit",
"x11",
Expand All @@ -74,7 +74,7 @@ bevy = { version = "0.13", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_asset",
"bevy_winit",
"tonemapping_luts",
Expand Down
16 changes: 8 additions & 8 deletions crates/rapier_testbed2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ other-backends = ["wrapped2d"]
features = ["parallel", "other-backends"]

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam025"] }
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = ["web-sys", "now"] }
Expand All @@ -51,16 +51,16 @@ bincode = "1"
Inflector = "0.11"
md5 = "0.7"

bevy_egui = "0.26"
bevy_ecs = "0.13"
bevy_core_pipeline = "0.13"
bevy_pbr = "0.13"
bevy_sprite = "0.13"
bevy_egui = "0.29"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
#bevy_prototype_debug_lines = "0.7"

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_sprite",
"bevy_winit",
"x11",
Expand All @@ -74,7 +74,7 @@ bevy = { version = "0.13", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_sprite",
"bevy_winit",
"tonemapping_luts",
Expand Down
16 changes: 8 additions & 8 deletions crates/rapier_testbed3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ parallel = ["rapier/parallel", "num_cpus"]
features = ["parallel"]

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam025"] }
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = ["web-sys", "now"] }
Expand All @@ -53,16 +53,16 @@ md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = ["derive"] }

bevy_egui = "0.26"
bevy_ecs = "0.13"
bevy_core_pipeline = "0.13"
bevy_pbr = "0.13"
bevy_sprite = "0.13"
bevy_egui = "0.29"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
#bevy_prototype_debug_lines = { version = "0.7", features = [ "3d" ] }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_winit",
"x11",
"tonemapping_luts",
Expand All @@ -75,7 +75,7 @@ bevy = { version = "0.13", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_winit",
"tonemapping_luts",
"ktx2",
Expand Down
18 changes: 9 additions & 9 deletions crates/rapier_testbed3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ other-backends = ["physx", "physx-sys", "glam"]
features = ["parallel", "other-backends"]

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam025"] }
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
rand = "0.8"
rand_pcg = "0.3"
instant = { version = "0.1", features = ["web-sys", "now"] }
bitflags = "2"
glam = { version = "0.24", optional = true } # For Physx
glam = { version = "0.27", optional = true } # For Physx
num_cpus = { version = "1", optional = true }
physx = { version = "0.19", features = ["glam"], optional = true }
physx-sys = { version = "0.11", optional = true }
Expand All @@ -54,16 +54,16 @@ md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = ["derive"] }

bevy_egui = "0.26"
bevy_ecs = "0.13"
bevy_core_pipeline = "0.13"
bevy_pbr = "0.13"
bevy_sprite = "0.13"
bevy_egui = "0.29"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
#bevy_prototype_debug_lines = { version = "0.7", features = [ "3d" ] }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_winit",
"x11",
"tonemapping_luts",
Expand All @@ -76,7 +76,7 @@ bevy = { version = "0.13", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.13", default-features = false, features = [
bevy = { version = "0.14", default-features = false, features = [
"bevy_winit",
"tonemapping_luts",
"ktx2",
Expand Down
2 changes: 1 addition & 1 deletion src_testbed/mouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn track_mouse_state(
- Vec2::ONE)
* Vec2::new(1.0, -1.0);
let ndc_to_world =
camera_transform.compute_matrix() * camera.projection_matrix().inverse();
camera_transform.compute_matrix() * camera.clip_from_view().inverse();
let ray_pt1 =
ndc_to_world.project_point3(Vec3::new(ndc_cursor.x, ndc_cursor.y, -1.0));

Expand Down
11 changes: 6 additions & 5 deletions src_testbed/objects/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ impl EntityWithGraphics {

#[cfg(feature = "dim2")]
let selection_material = ColorMaterial {
color: Color::rgb(1.0, 0.0, 0.0),
color: Color::from(Srgba::rgb(1.0, 0.0, 0.0)),
texture: None,
};
#[cfg(feature = "dim3")]
let selection_material = StandardMaterial {
metallic: 0.5,
perceptual_roughness: 0.5,
double_sided: true, // TODO: this doesn't do anything?
..StandardMaterial::from(Color::rgb(1.0, 0.0, 0.0))
..StandardMaterial::from(Color::from(Srgba::rgb(1.0, 0.0, 0.0)))
};

instanced_materials.insert(
Expand Down Expand Up @@ -85,7 +85,7 @@ impl EntityWithGraphics {
.or_else(|| generate_collider_mesh(shape).map(|m| meshes.add(m)));

let opacity = 1.0;
let bevy_color = Color::rgba(color.x, color.y, color.z, opacity);
let bevy_color = Color::from(Srgba::new(color.x, color.y, color.z, opacity));
let shape_pos = collider_pos * delta;
let mut transform = Transform::from_scale(scale);
transform.translation.x = shape_pos.translation.vector.x as f32;
Expand Down Expand Up @@ -169,11 +169,12 @@ impl EntityWithGraphics {
if let Some(material) = materials.get_mut(&self.material) {
#[cfg(feature = "dim2")]
{
material.color = Color::rgba(color.x, color.y, color.z, self.opacity);
material.color = Color::from(Srgba::new(color.x, color.y, color.z, self.opacity));
}
#[cfg(feature = "dim3")]
{
material.base_color = Color::rgba(color.x, color.y, color.z, self.opacity);
material.base_color =
Color::from(Srgba::new(color.x, color.y, color.z, self.opacity));
}
}
self.color = color;
Expand Down
4 changes: 2 additions & 2 deletions src_testbed/testbed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl TestbedApp {
};

let mut app = App::new();
app.insert_resource(ClearColor(Color::rgb(0.15, 0.15, 0.15)))
app.insert_resource(ClearColor(Color::from(Srgba::rgb(0.15, 0.15, 0.15))))
.insert_resource(Msaa::Sample4)
.insert_resource(AmbientLight {
brightness: 0.3,
Expand Down Expand Up @@ -1600,7 +1600,7 @@ fn highlight_hovered_body(
cursor.x / window.width() * 2.0 - 1.0,
1.0 - cursor.y / window.height() * 2.0,
);
let ndc_to_world = camera_transform.compute_matrix() * camera.projection_matrix().inverse();
let ndc_to_world = camera_transform.compute_matrix() * camera.clip_from_view().inverse();
let ray_pt1 = ndc_to_world.project_point3(Vec3::new(ndc_cursor.x, ndc_cursor.y, -1.0));
let ray_pt2 = ndc_to_world.project_point3(Vec3::new(ndc_cursor.x, ndc_cursor.y, 1.0));
let ray_dir = ray_pt2 - ray_pt1;
Expand Down

0 comments on commit 04058a1

Please sign in to comment.