@@ -686,23 +686,17 @@ pub fn check_visibility(
686686 }
687687}
688688
689- /// Marks any entities that weren't judged visible this frame as invisible.
690- ///
691- /// As visibility-determining systems run, they remove entities that they judge
692- /// visible from [`PreviousVisibleEntities`]. At the end of visibility
693- /// determination, all entities that remain in [`PreviousVisibleEntities`] must
694- /// be invisible. This system goes through those entities and marks them newly
695- /// invisible (which sets the change flag for them).
689+ /// The last step in the visibility pipeline. Looks at entities that were visible last frame but not
690+ /// marked as visible this frame ([`WasVisibleNowHidden`]), and marks them as hidden by setting the
691+ /// [`ViewVisibility`]. This process is needed to ensure we only trigger change detection on
692+ /// [`ViewVisibility`] when necessary. See the docs on [`WasVisibleNowHidden`] for more details.
696693fn mark_newly_hidden_entities_invisible (
697- mut view_visibilities : Query < ( & mut ViewVisibility , & mut WasVisibleNowHidden ) > ,
694+ mut view_visibilities : Query < ( & mut ViewVisibility , & WasVisibleNowHidden ) > ,
698695) {
699- // Whatever previous visible entities are left are entities that were
700- // visible last frame but just became invisible.
701696 view_visibilities
702697 . par_iter_mut ( )
703- . for_each ( |( mut view_visibility, mut previously_visible) | {
698+ . for_each ( |( mut view_visibility, previously_visible) | {
704699 if * * previously_visible {
705- * * previously_visible = false ;
706700 * view_visibility = ViewVisibility :: HIDDEN ;
707701 }
708702 } ) ;
0 commit comments