diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e206845..0fc0980 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -13,7 +13,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - name: build run: cargo build --verbose @@ -21,7 +21,7 @@ jobs: build_features: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - name: all features run: cargo build --verbose --all-features @@ -31,7 +31,7 @@ jobs: build_examples: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - name: build baloon example run: cargo clippy --example balloon @@ -39,6 +39,8 @@ jobs: run: cargo clippy --example flag - name: build moving example run: cargo clippy --example moving + - name: build rapier example + run: cargo clippy --features xpbd_collisions --example xpbd_collision - name: build rapier example run: cargo clippy --features rapier_collisions --example rapier_collision - name: build anchors example @@ -47,7 +49,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - name: tests run: cargo test --tests @@ -57,7 +59,7 @@ jobs: fmt: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@nightly with: components: "rustfmt" @@ -67,17 +69,21 @@ jobs: clippy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - name: Cargo clippy installation run: rustup component add clippy - - name: Cargo clippy check + - name: Default clippy check + run: cargo clippy --all --tests -- -D warnings + - name: Full clippy check run: cargo clippy --all-features --all --tests -- -D warnings + - name: Minimal clippy check + run: cargo clippy --no-default-features --all --tests -- -D warnings rustdoc: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - name: rustdoc run: cargo rustdoc --all-features -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index 419836f..315f638 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,29 +22,30 @@ xpbd_collisions = ["bevy_xpbd_3d"] thiserror = "1.0" [dependencies.bevy] -version = "0.12" +version = "0.13" default-features = false features = ["bevy_render", "bevy_asset"] [dependencies.bevy_rapier3d] -version = "0.23" +version = "0.25" optional = true default-features = false features = ["dim3", "async-collider"] [dependencies.bevy_xpbd_3d] -version = "0.3" +version = "0.4" optional = true default-features = false -features = ["3d", "f32", "async-collider"] +features = ["3d", "f32", "async-collider", "default-collider", "parry-f32"] [dev-dependencies] -bevy-inspector-egui = "0.21" -bevy_rapier3d = "0.23" +bevy-inspector-egui = "0.23" rand = "0.8" +bevy_xpbd_3d = "0.4" +bevy_rapier3d = "0.25" [dev-dependencies.bevy] -version = "0.12" +version = "0.13" features = [ "bevy_asset", "bevy_winit", @@ -54,9 +55,6 @@ features = [ "bevy_sprite", "png", "x11", - # The following features are required because of https://github.com/bevyengine/bevy/discussions/9100 - "ktx2", - "zstd", "tonemapping_luts", ] default-features = false diff --git a/examples/anchors_example.rs b/examples/anchors_example.rs index 6b151a8..395990e 100644 --- a/examples/anchors_example.rs +++ b/examples/anchors_example.rs @@ -8,7 +8,7 @@ fn main() { App::new() .insert_resource(AmbientLight { color: Color::WHITE, - brightness: 1.0, + brightness: 500.0, }) .add_plugins(DefaultPlugins) .add_plugins(ResourceInspectorPlugin::::new()) @@ -28,7 +28,7 @@ fn setup( transform: Transform::from_rotation(Quat::from_rotation_y(5.0)), ..Default::default() }); - let mesh_handle = meshes.add(shape::Cube::new(1.0).into()); + let mesh_handle = meshes.add(Cuboid::default()); [ (Color::BLUE, [-10.0, 0.0]), (Color::GREEN, [10.0, 0.0]), @@ -39,11 +39,7 @@ fn setup( commands.spawn(PbrBundle { mesh: mesh_handle.clone(), transform: Transform::from_xyz(x, 1.0, z), - material: materials.add(StandardMaterial { - base_color: color, - double_sided: true, - ..Default::default() - }), + material: materials.add(color), ..Default::default() }); }); @@ -58,12 +54,12 @@ fn spawn_cloth( let flag_texture = asset_server.load("Bevy.png"); let (size_x, size_y) = (60, 40); - let anchor_mesh = meshes.add(shape::Cube::new(1.0).into()); + let anchor_mesh = meshes.add(Cuboid::default()); let entity_a = commands .spawn(( PbrBundle { mesh: anchor_mesh.clone(), - material: materials.add(Color::RED.into()), + material: materials.add(Color::RED), transform: Transform::from_xyz(-15.0, 15.0, 15.0), ..Default::default() }, @@ -74,7 +70,7 @@ fn spawn_cloth( .spawn(( PbrBundle { mesh: anchor_mesh, - material: materials.add(Color::GREEN.into()), + material: materials.add(Color::GREEN), transform: Transform::from_xyz(15.0, 15.0, 15.0), ..Default::default() }, diff --git a/examples/balloon_example.rs b/examples/balloon_example.rs index 9f29e3b..23605fb 100644 --- a/examples/balloon_example.rs +++ b/examples/balloon_example.rs @@ -8,7 +8,7 @@ fn main() { App::new() .insert_resource(AmbientLight { color: Color::WHITE, - brightness: 1.0, + brightness: 100.0, }) .add_plugins(DefaultPlugins) .add_plugins(WorldInspectorPlugin::default()) @@ -29,7 +29,7 @@ fn setup( mut meshes: ResMut>, ) { commands.spawn(DirectionalLightBundle::default()); - let mesh_handle = meshes.add(shape::Cube::new(1.0).into()); + let mesh_handle = meshes.add(Cuboid::default()); [ (Color::BLUE, [-10.0, 0.0]), (Color::GREEN, [10.0, 0.0]), @@ -57,15 +57,8 @@ fn spawn_cloth( ) { commands.spawn(( PbrBundle { - mesh: meshes.add( - shape::Icosphere { - radius: 5.0, - subdivisions: 10, - } - .try_into() - .unwrap(), - ), - material: materials.add(Color::YELLOW.into()), + mesh: meshes.add(Sphere::new(5.).mesh().ico(10).unwrap()), + material: materials.add(Color::YELLOW), transform: Transform::from_xyz(0.0, 2.0, 0.0), ..Default::default() }, diff --git a/examples/camera_plugin.rs b/examples/camera_plugin.rs index 21c21e8..52186e4 100644 --- a/examples/camera_plugin.rs +++ b/examples/camera_plugin.rs @@ -6,57 +6,63 @@ use bevy::{ pub struct CameraPlugin; +#[derive(Debug, Component)] +pub struct OrbitController; + #[derive(Debug, Component)] pub struct CameraController; impl Plugin for CameraPlugin { fn build(&self, app: &mut App) { app.add_systems(Startup, setup) - .add_systems(PostUpdate, handle_camera); + .add_systems(PostUpdate, (handle_rotation, handle_zoom)); log::info!("Camera Plugin loaded"); } } pub fn setup(mut commands: Commands) { - commands.spawn(( - Camera3dBundle { - transform: Transform::from_xyz(-30.0, 30.0, -30.0).looking_at(Vec3::ZERO, Vec3::Y), - ..default() - }, - CameraController, - )); + commands + .spawn(( + TransformBundle::from_transform(Transform::from_rotation(Quat::from_rotation_z(-1.0))), + OrbitController, + )) + .with_children(|b| { + b.spawn(( + Camera3dBundle { + transform: Transform::from_xyz(0.0, 30.0, 0.0).looking_at(Vec3::ZERO, Vec3::Y), + ..default() + }, + CameraController, + )); + }); } -pub fn handle_camera( - mut cam_controls: Query<&mut Transform, With>, +pub fn handle_rotation( + mut cam_controls: Query<&mut Transform, With>, mut motion_evr: EventReader, - mut scroll_evr: EventReader, - buttons: Res>, + buttons: Res>, time: Res