Skip to content

Commit

Permalink
Replace ComputedVisibility
Browse files Browse the repository at this point in the history
… according to bevyengine/bevy#9497
  • Loading branch information
TristanCacqueray committed Nov 4, 2023
1 parent b69f937 commit 8faa3c8
Showing 1 changed file with 8 additions and 7 deletions.
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 8faa3c8

Please sign in to comment.