From 69ecf77edb37951a20c50cd64ab87cb6477a6306 Mon Sep 17 00:00:00 2001 From: aviac Date: Tue, 20 Feb 2024 16:36:00 +0100 Subject: [PATCH 1/3] fix(tests): QueryFilter fixed to be in filter position Authored-by: RobWalt --- src/immediate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/immediate.rs b/src/immediate.rs index 315baaf..9b7fa94 100644 --- a/src/immediate.rs +++ b/src/immediate.rs @@ -122,7 +122,7 @@ type MeshFilter = With>; /// # use bevy::prelude::*; /// # #[derive(Component)] /// # struct Foo; -/// fn raycast_system(mut raycast: Raycast, foo_query: Query>) { +/// fn raycast_system(mut raycast: Raycast, foo_query: Query<(), With>) { /// let ray = Ray3d::new(Vec3::ZERO, Vec3::X); /// /// // Only raycast against entities with the `Foo` component. From bdc16769013cb1ad14c3c059e08661b255cfbdd2 Mon Sep 17 00:00:00 2001 From: aviac Date: Wed, 21 Feb 2024 08:10:50 +0100 Subject: [PATCH 2/3] chore(cleanup): remove unneeded `Mesh::from` Authored-by: RobWalt --- examples/minimal.rs | 2 +- examples/minimal_deferred.rs | 2 +- examples/mouse_picking_deferred.rs | 2 +- examples/simplified_mesh.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/minimal.rs b/examples/minimal.rs index 088e2c4..c9ad3e7 100644 --- a/examples/minimal.rs +++ b/examples/minimal.rs @@ -32,7 +32,7 @@ fn setup( commands.spawn(Camera3dBundle::default()); commands.spawn(PointLightBundle::default()); commands.spawn(PbrBundle { - mesh: meshes.add(Mesh::from(Capsule3d::default())), + mesh: meshes.add(Capsule3d::default()), material: materials.add(Color::rgb(1.0, 1.0, 1.0)), transform: Transform::from_translation(RAY_DIST), ..default() diff --git a/examples/minimal_deferred.rs b/examples/minimal_deferred.rs index 04d8c9d..f9ec6a6 100644 --- a/examples/minimal_deferred.rs +++ b/examples/minimal_deferred.rs @@ -47,7 +47,7 @@ fn setup( )); commands.spawn(( PbrBundle { - mesh: meshes.add(Mesh::from(Capsule3d::default())), + mesh: meshes.add(Capsule3d::default()), material: materials.add(Color::rgb(1.0, 1.0, 1.0)), transform: Transform::from_translation(RAY_DIST), ..default() diff --git a/examples/mouse_picking_deferred.rs b/examples/mouse_picking_deferred.rs index 489912e..48c9e31 100644 --- a/examples/mouse_picking_deferred.rs +++ b/examples/mouse_picking_deferred.rs @@ -28,7 +28,7 @@ fn setup( commands.spawn(PointLightBundle::default()); commands.spawn(( PbrBundle { - mesh: meshes.add(Mesh::from(Sphere::default())), + mesh: meshes.add(Sphere::default()), material: materials.add(Color::GRAY), transform: Transform::from_xyz(0.0, 0.0, -5.0), ..default() diff --git a/examples/simplified_mesh.rs b/examples/simplified_mesh.rs index 755281b..fff089a 100644 --- a/examples/simplified_mesh.rs +++ b/examples/simplified_mesh.rs @@ -137,7 +137,7 @@ fn manage_simplified_mesh( if let Ok(mut text) = status_query.get_single_mut() { if simplified_mesh.is_none() { commands.entity(entity).insert(SimplifiedMesh { - mesh: meshes.add(Mesh::from(Sphere::default())), + mesh: meshes.add(Sphere::default()), }); text.sections[1].value = "ON".to_string(); text.sections[1].style.color = Color::GREEN; From d132da3978aed2a574693f17d7d60677bf1949c6 Mon Sep 17 00:00:00 2001 From: aviac Date: Wed, 21 Feb 2024 08:13:43 +0100 Subject: [PATCH 3/3] chore(cleanup): use Direction3D API directly Ok to be fair this doesn't change a lot. It saves one indirection through the `TryFrom` trait which might even gets optimized away in the first place. Nevertheless it is a bit more explicit which will help newer people to understand the code and develop good habits. Authored-by: RobWalt --- examples/reflecting_laser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/reflecting_laser.rs b/examples/reflecting_laser.rs index fc5fbaf..625876e 100644 --- a/examples/reflecting_laser.rs +++ b/examples/reflecting_laser.rs @@ -54,7 +54,7 @@ fn bounce_ray(mut ray: Ray3d, raycast: &mut Raycast, gizmos: &mut Gizmos, color: let ray_dir = ray.direction; // reflect the ray let proj = (ray_dir.dot(hit.normal()) / hit.normal().dot(hit.normal())) * hit.normal(); - ray.direction = (*ray_dir - 2.0 * proj).try_into().unwrap(); + ray.direction = Direction3d::new(*ray_dir - 2.0 * proj).unwrap(); ray.origin = hit.position() + ray.direction * 1e-6; } else { break;