Skip to content

Commit

Permalink
Bevy 0.12 (#100)
Browse files Browse the repository at this point in the history
* Bump bevy to 0.12

* Replace ComputedVisibility

… according to bevyengine/bevy#9497
  • Loading branch information
TristanCacqueray authored Nov 10, 2023
1 parent 401bcf9 commit 66691a5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_mod_raycast"
version = "0.15.0"
version = "0.16.0"
authors = ["Aevyrie <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -11,14 +11,14 @@ categories = ["game-engines", "rendering"]
resolver = "2"

[dependencies]
bevy = { version = "0.11", default-features = false, features = [
bevy = { version = "0.12", default-features = false, features = [
"bevy_render",
"bevy_asset",
] }
crossbeam-channel = "0.5"

[dev-dependencies]
bevy = { version = "0.11", default-features = true, features = [
bevy = { version = "0.12", default-features = true, features = [
"default_font",
"ktx2",
"tonemapping_luts",
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ fn my_raycast_system(mut raycast: Raycast) {

<details>
<summary><h2>Bevy Version Support</h2></summary>
I intend to track the `main` branch of Bevy. PRs supporting this are welcome!
I intend to track the `main` branch of Bevy. PRs supporting this are welcome!

| bevy | bevy_mod_raycast |
| ---- | ---------------- |
| 0.12 | 0.16 |
| 0.11 | 0.9 - 0.15 |
| 0.10 | 0.8 |
| 0.9 | 0.7 |
Expand Down
15 changes: 8 additions & 7 deletions src/immediate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ pub struct Raycast<'w, 's> {
'w,
's,
(
Read<ComputedVisibility>,
Read<InheritedVisibility>,
Read<ViewVisibility>,
Read<Aabb>,
Read<GlobalTransform>,
Entity,
Expand Down Expand Up @@ -232,13 +233,12 @@ impl<'w, 's> Raycast<'w, 's> {
// of entities that are in the path of the ray.
let (aabb_hits_tx, aabb_hits_rx) = crossbeam_channel::unbounded::<(FloatOrd, Entity)>();
let visibility_setting = settings.visibility;
self.culling_query
.par_iter()
.for_each(|(visibility, aabb, transform, entity)| {
self.culling_query.par_iter().for_each(
|(inherited_visibility, view_visibility, aabb, transform, entity)| {
let should_raycast = match visibility_setting {
RaycastVisibility::Ignore => true,
RaycastVisibility::MustBeVisible => visibility.is_visible_in_hierarchy(),
RaycastVisibility::MustBeVisibleAndInView => visibility.is_visible_in_view(),
RaycastVisibility::MustBeVisible => inherited_visibility.get(),
RaycastVisibility::MustBeVisibleAndInView => view_visibility.get(),
};
if should_raycast {
if let Some([near, _]) = ray
Expand All @@ -248,7 +248,8 @@ impl<'w, 's> Raycast<'w, 's> {
aabb_hits_tx.send((FloatOrd(near), entity)).ok();
}
}
});
},
);
*self.culled_list = aabb_hits_rx.try_iter().collect();
self.culled_list.sort_by_key(|(aabb_near, _)| *aabb_near);
drop(ray_cull_guard);
Expand Down

0 comments on commit 66691a5

Please sign in to comment.