Skip to content

Commit

Permalink
Upgrade bevy 0.15 (#758)
Browse files Browse the repository at this point in the history
* upgrade bevy 0.15

* use crate dependencies

* use puffin pr dependency

* suppress needless lifetimes

* fix compiler error due to merge

---------

Co-authored-by: Sébastien Crozet <[email protected]>
  • Loading branch information
Vrixyz and sebcrozet authored Jan 8, 2025
1 parent 564f7b7 commit 2ed1934
Show file tree
Hide file tree
Showing 12 changed files with 105 additions and 93 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ members = [
]
resolver = "2"

[workspace.lints.clippy]
needless_lifetimes = "allow"

[patch.crates-io]
#wrapped2d = { git = "https://github.com/Bastacyclop/rust_box2d.git" }
#xurdf = { path = "../xurdf/xurdf" }
Expand All @@ -38,6 +41,10 @@ resolver = "2"
#parry2d-f64 = { git = "https://github.com/dimforge/parry", branch = "master" }
#parry3d-f64 = { git = "https://github.com/dimforge/parry", branch = "master" }

# See https://github.com/EmbarkStudios/puffin/pull/234
puffin_egui = { git = "https://github.com/tedsteen/puffin.git", rev = "11771ebe00fd257aedbb545df3339ad597b1cc34" }


# # For feature unstable-puffin-pr-235
# # See https://github.com/dimforge/rapier/issues/760.
# puffin_egui = { version = "0.29", optional = true, git = "https://github.com/Vrixyz/puffin.git", branch = "expose_ui_options" }
Expand Down
1 change: 1 addition & 0 deletions crates/rapier2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ maintenance = { status = "actively-developed" }
rust.unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("dim3", "f64"))',
] }
clippy = { needless_lifetimes = "allow" }

[features]
default = ["dim2", "f32"]
Expand Down
2 changes: 2 additions & 0 deletions crates/rapier3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ maintenance = { status = "actively-developed" }
rust.unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("dim2", "f64"))',
] }
clippy = { needless_lifetimes = "allow" }


[features]
default = ["dim3", "f32"]
Expand Down
22 changes: 11 additions & 11 deletions crates/rapier_testbed2d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ required-features = ["dim2"]
rust.unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("dim3", "f32"))',
] }
clippy = { needless_lifetimes = "allow" }

[features]
default = ["dim2"]
Expand All @@ -41,11 +42,8 @@ unstable-puffin-pr-235 = []
[package.metadata.docs.rs]
features = ["parallel", "profiler_ui"]

[lints.clippy]
needless_lifetimes = "allow"

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
nalgebra = { version = "0.33", features = ["rand", "glam029"] }
rand = "0.8"
rand_pcg = "0.3"
web-time = { version = "1.1" }
Expand All @@ -56,19 +54,20 @@ crossbeam = "0.8"
bincode = "1"
Inflector = "0.11"
md5 = "0.7"
bevy_egui = "0.29"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
bevy_egui = "0.31"
bevy_ecs = "0.15"
bevy_core_pipeline = "0.15"
bevy_pbr = "0.15"
bevy_sprite = "0.15"
profiling = "1.0"
puffin_egui = { version = "0.29", optional = true }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_asset",
"bevy_winit",
"bevy_window",
"x11",
"tonemapping_luts",
"ktx2",
Expand All @@ -80,9 +79,10 @@ bevy = { version = "0.14", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_asset",
"bevy_winit",
"bevy_window",
"tonemapping_luts",
"ktx2",
"zstd",
Expand Down
22 changes: 11 additions & 11 deletions crates/rapier_testbed2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ required-features = ["dim2"]
rust.unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("dim3", "f64"))',
] }
clippy = { needless_lifetimes = "allow" }

[features]
default = ["dim2"]
Expand All @@ -41,11 +42,8 @@ unstable-puffin-pr-235 = []
[package.metadata.docs.rs]
features = ["parallel", "other-backends", "profiler_ui"]

[lints.clippy]
needless_lifetimes = "allow"

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
nalgebra = { version = "0.33", features = ["rand", "glam029"] }
rand = "0.8"
rand_pcg = "0.3"
web-time = { version = "1.1" }
Expand All @@ -56,19 +54,20 @@ crossbeam = "0.8"
bincode = "1"
Inflector = "0.11"
md5 = "0.7"
bevy_egui = "0.29"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
bevy_egui = "0.31"
bevy_ecs = "0.15"
bevy_core_pipeline = "0.15"
bevy_pbr = "0.15"
bevy_sprite = "0.15"
profiling = "1.0"
puffin_egui = { version = "0.29", optional = true }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_sprite",
"bevy_winit",
"bevy_window",
"x11",
"tonemapping_luts",
"ktx2",
Expand All @@ -80,9 +79,10 @@ bevy = { version = "0.14", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_sprite",
"bevy_winit",
"bevy_window",
"tonemapping_luts",
"ktx2",
"zstd",
Expand Down
23 changes: 12 additions & 11 deletions crates/rapier_testbed3d-f64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [
# but easier to just ignore it here.
'cfg(feature, values("other-backends"))',
] }
clippy = { needless_lifetimes = "allow" }

[features]
default = ["dim3"]
Expand All @@ -43,11 +44,8 @@ unstable-puffin-pr-235 = []
[package.metadata.docs.rs]
features = ["parallel", "profiler_ui"]

[lints.clippy]
needless_lifetimes = "allow"

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
nalgebra = { version = "0.33", features = ["rand", "glam029"] }
rand = "0.8"
rand_pcg = "0.3"
web-time = { version = "1.1" }
Expand All @@ -58,18 +56,19 @@ bincode = "1"
md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = ["derive"] }
bevy_egui = "0.29"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
bevy_egui = "0.31"
bevy_ecs = "0.15"
bevy_core_pipeline = "0.15"
bevy_pbr = "0.15"
bevy_sprite = "0.15"
profiling = "1.0"
puffin_egui = { version = "0.29", optional = true, git = "https://github.com/Vrixyz/puffin.git", branch = "expose_ui_options" }

# Dependencies for native only.
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_winit",
"bevy_window",
"x11",
"tonemapping_luts",
"ktx2",
Expand All @@ -81,8 +80,10 @@ bevy = { version = "0.14", default-features = false, features = [

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_winit",
"bevy_window",
"bevy_window",
"tonemapping_luts",
"ktx2",
"zstd",
Expand Down
21 changes: 10 additions & 11 deletions crates/rapier_testbed3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ required-features = ["dim3"]
rust.unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("dim2", "f64"))',
] }
clippy = { needless_lifetimes = "allow" }

[features]
default = ["dim3"]
Expand All @@ -41,11 +42,8 @@ unstable-puffin-pr-235 = []
[package.metadata.docs.rs]
features = ["parallel", "other-backends", "profiler_ui"]

[lints.clippy]
needless_lifetimes = "allow"

[dependencies]
nalgebra = { version = "0.33", features = ["rand", "glam027"] }
nalgebra = { version = "0.33", features = ["rand", "glam029"] }
rand = "0.8"
rand_pcg = "0.3"
web-time = { version = "1.1" }
Expand All @@ -59,18 +57,19 @@ bincode = "1"
md5 = "0.7"
Inflector = "0.11"
serde = { version = "1", features = ["derive"] }
bevy_egui = "0.29"
bevy_ecs = "0.14"
bevy_core_pipeline = "0.14"
bevy_pbr = "0.14"
bevy_sprite = "0.14"
bevy_egui = "0.31"
bevy_ecs = "0.15"
bevy_core_pipeline = "0.15"
bevy_pbr = "0.15"
bevy_sprite = "0.15"
profiling = "1.0"
puffin_egui = { version = "0.29", optional = true }

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

# Dependencies for WASM only.
[target.'cfg(target_arch = "wasm32")'.dependencies]
bevy = { version = "0.14", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_winit",
"tonemapping_luts",
"ktx2",
Expand Down
6 changes: 3 additions & 3 deletions src_testbed/camera3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ impl OrbitCameraPlugin {
}

if mouse_button_input.pressed(camera.rotate_button) {
camera.x -= delta.x * camera.rotate_sensitivity * time.delta_seconds();
camera.y -= delta.y * camera.rotate_sensitivity * time.delta_seconds();
camera.x -= delta.x * camera.rotate_sensitivity * time.delta_secs();
camera.y -= delta.y * camera.rotate_sensitivity * time.delta_secs();
camera.y = camera
.y
.max(*camera.pitch_range.start())
Expand All @@ -87,7 +87,7 @@ impl OrbitCameraPlugin {
let up_dir = transform.rotation * Vec3::Y;
let pan_vector = (delta.x * right_dir + delta.y * up_dir)
* camera.pan_sensitivity
* time.delta_seconds();
* time.delta_secs();
camera.center += pan_vector;
}
}
Expand Down
4 changes: 4 additions & 0 deletions src_testbed/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ use std::collections::HashMap;
pub type BevyMaterial = bevy_sprite::ColorMaterial;
#[cfg(feature = "dim3")]
pub type BevyMaterial = StandardMaterial;
#[cfg(feature = "dim2")]
pub type BevyMaterialComponent = MeshMaterial2d<BevyMaterial>;
#[cfg(feature = "dim3")]
pub type BevyMaterialComponent = MeshMaterial3d<BevyMaterial>;

pub type InstancedMaterials = HashMap<Point3<usize>, Handle<BevyMaterial>>;
pub const SELECTED_OBJECT_MATERIAL_KEY: Point3<usize> = point![42, 42, 42];
Expand Down
21 changes: 10 additions & 11 deletions src_testbed/objects/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use rapier::math::{Isometry, Real, Vector};
use crate::graphics::{BevyMaterial, InstancedMaterials, SELECTED_OBJECT_MATERIAL_KEY};
#[cfg(feature = "dim2")]
use {
bevy_sprite::MaterialMesh2dBundle,
na::{Point2, Vector2},
rapier::geometry::{Ball, Cuboid},
};
Expand Down Expand Up @@ -46,6 +45,7 @@ impl EntityWithGraphics {
let selection_material = bevy_sprite::ColorMaterial {
color: Color::from(Srgba::rgb(1.0, 0.0, 0.0)),
texture: None,
..default()
};
#[cfg(feature = "dim3")]
let selection_material = StandardMaterial {
Expand Down Expand Up @@ -112,6 +112,7 @@ impl EntityWithGraphics {
let material = bevy_sprite::ColorMaterial {
color: bevy_color,
texture: None,
..default()
};
#[cfg(feature = "dim3")]
let material = StandardMaterial {
Expand All @@ -127,19 +128,17 @@ impl EntityWithGraphics {

if let Some(mesh) = mesh {
#[cfg(feature = "dim2")]
let bundle = MaterialMesh2dBundle {
mesh: mesh.into(),
material: material_handle.clone_weak(),
let bundle = (
Mesh2d(mesh),
MeshMaterial2d(material_handle.clone_weak()),
transform,
..Default::default()
};
);
#[cfg(feature = "dim3")]
let bundle = PbrBundle {
mesh,
material: material_handle.clone_weak(),
let bundle = (
Mesh2d(mesh),
MeshMaterial3d(material_handle.clone_weak()),
transform,
..Default::default()
};
);

let mut entity_commands = commands.entity(entity);
entity_commands.insert(bundle);
Expand Down
Loading

0 comments on commit 2ed1934

Please sign in to comment.