From e7ec5f74f0705a401e545a954be6cd3c9182c1ac Mon Sep 17 00:00:00 2001 From: "dmitry.lukichev" Date: Tue, 12 Nov 2024 22:30:54 +0100 Subject: [PATCH 1/3] Update to bevy 0.15 --- .gitignore | 1 + CHANGELOG.md | 4 +++ Cargo.toml | 6 ++-- README.md | 7 ++-- examples/advanced.rs | 31 ++++++++---------- examples/animate.rs | 41 +++++++++++------------- examples/basic.rs | 35 +++++++++----------- examples/egui.rs | 35 +++++++++----------- examples/follow_target.rs | 37 ++++++++++------------ examples/keyboard_controls.rs | 57 +++++++++++++++------------------ examples/multiple_viewports.rs | 51 +++++++++++++----------------- examples/multiple_windows.rs | 45 +++++++++++--------------- examples/orthographic.rs | 56 +++++++++++++------------------- examples/render_to_texture.rs | 58 +++++++++++++++------------------- src/lib.rs | 8 ++--- src/touch.rs | 8 ++--- 16 files changed, 211 insertions(+), 269 deletions(-) diff --git a/.gitignore b/.gitignore index 4fffb2f..c41a2b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.idea /target /Cargo.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index 90729b2..4eec5d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.21 + +- Update to Bevy 0.15 + ## 0.20 - Change `zoom_lower_limit` from `Option` to `f32`, defaulting to `0.05`, and remove the hard coded lower zoom limit of `0.05`. diff --git a/Cargo.toml b/Cargo.toml index 806442f..e8891c7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_panorbit_camera" -version = "0.20.0" +version = "0.21.0-rc.3" authors = ["Plonq"] edition = "2021" description = "A basic pan and orbit camera in Bevy" @@ -15,13 +15,13 @@ readme = "README.md" bevy_egui = ["dep:bevy_egui"] [dependencies] -bevy = { version = "0.14", default-features = false, features = [ +bevy = { version = "0.15.0-rc.3", default-features = false, features = [ "bevy_render", ] } bevy_egui = { version = "0.30", optional = true, default-features = false } [dev-dependencies] -bevy = { version = "0.14" } +bevy = { version = "0.15.0-rc.3" } float-cmp = "0.9.0" bevy_egui = { version = "0.30", default-features = false, features = [ "render", diff --git a/README.md b/README.md index b8a6b0e..c9896a1 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,8 @@ Add `PanOrbitCamera` to a camera: ```rust ignore commands.spawn(( - Camera3dBundle { - transform: Transform::from_translation(Vec3::new(0.0, 1.5, 5.0)), - ..default() - }, + Camera3d::default(), + Transform::from_translation(Vec3::new(0.0, 1.5, 5.0)), PanOrbitCamera::default(), )); ``` @@ -71,6 +69,7 @@ all the possible configuration options. | bevy | bevy_panorbit_camera | |------|----------------------| +| 0.15 | 0.21 | | 0.14 | 0.19-0.20 | | 0.13 | 0.14-0.18 | | 0.12 | 0.9-0.13 | diff --git a/examples/advanced.rs b/examples/advanced.rs index 65c9a17..1dbf8a6 100644 --- a/examples/advanced.rs +++ b/examples/advanced.rs @@ -25,32 +25,29 @@ fn setup( mut materials: ResMut>, ) { // Ground - commands.spawn(PbrBundle { - mesh: meshes.add(Plane3d::default().mesh().size(5.0, 5.0)), - material: materials.add(Color::srgb(0.3, 0.5, 0.3)), - ..default() - }); + commands.spawn(( + Mesh3d(meshes.add(Plane3d::default().mesh().size(5.0, 5.0))), + MeshMaterial3d(materials.add(Color::srgb(0.3, 0.5, 0.3))), + )); // Cube - commands.spawn(PbrBundle { - mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)), - material: materials.add(Color::srgb(0.8, 0.7, 0.6)), - transform: Transform::from_xyz(0.0, 0.5, 0.0), - ..default() - }); + commands.spawn(( + Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))), + MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))), + Transform::from_xyz(0.0, 0.5, 0.0), + )); // Light - commands.spawn(PointLightBundle { - point_light: PointLight { + commands.spawn(( + PointLight { shadows_enabled: true, ..default() }, - transform: Transform::from_xyz(4.0, 8.0, 4.0), - ..default() - }); + Transform::from_xyz(4.0, 8.0, 4.0), + )); // Camera commands.spawn(( // Note we're setting the initial position below with yaw, pitch, and radius, hence // we don't set transform on the camera. - Camera3dBundle::default(), + Camera3d::default(), PanOrbitCamera { // Set focal point (what the camera should look at) focus: Vec3::new(0.0, 1.0, 0.0), diff --git a/examples/animate.rs b/examples/animate.rs index 192d9e1..e14b56c 100644 --- a/examples/animate.rs +++ b/examples/animate.rs @@ -19,33 +19,28 @@ fn setup( mut materials: ResMut>, ) { // Ground - commands.spawn(PbrBundle { - mesh: meshes.add(Plane3d::default().mesh().size(5.0, 5.0)), - material: materials.add(Color::srgb(0.3, 0.5, 0.3)), - ..default() - }); + commands.spawn(( + Mesh3d(meshes.add(Plane3d::default().mesh().size(5.0, 5.0))), + MeshMaterial3d(materials.add(Color::srgb(0.3, 0.5, 0.3))), + )); // Cube - commands.spawn(PbrBundle { - mesh: meshes.add(Cuboid::new(1.0, 1.0, 1.0)), - material: materials.add(Color::srgb(0.8, 0.7, 0.6)), - transform: Transform::from_xyz(0.0, 0.5, 0.0), - ..default() - }); + commands.spawn(( + Mesh3d(meshes.add(Cuboid::new(1.0, 1.0, 1.0))), + MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))), + Transform::from_xyz(0.0, 0.5, 0.0), + )); // Light - commands.spawn(PointLightBundle { - point_light: PointLight { + commands.spawn(( + PointLight { shadows_enabled: true, ..default() }, - transform: Transform::from_xyz(4.0, 8.0, 4.0), - ..default() - }); + Transform::from_xyz(4.0, 8.0, 4.0), + )); // Camera commands.spawn(( - Camera3dBundle { - transform: Transform::from_translation(Vec3::new(0.0, 1.5, 5.0)), - ..default() - }, + Camera3d::default(), + Transform::from_translation(Vec3::new(0.0, 1.5, 5.0)), PanOrbitCamera { // Disable smoothing, since the animation takes care of that orbit_smoothness: 0.0, @@ -60,10 +55,10 @@ fn setup( fn animate(time: Res