Skip to content

Commit

Permalink
clippy things
Browse files Browse the repository at this point in the history
  • Loading branch information
Byteron committed Feb 21, 2021
1 parent e588275 commit 7f2f932
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions crates/bevy_sprite/src/frustum_culling.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::time::Instant;

use bevy_asset::{Assets, Handle};
use bevy_ecs::{Commands, Entity, Query, Res, With};
use bevy_math::Vec2;
Expand Down Expand Up @@ -58,14 +56,10 @@ pub fn frustum_culling_sprites(
size: sprite.size,
};

if rect.is_overlapping(sprite_rect) {
if let Err(_) = visible.get(entity) {
commands.insert_one(entity, Visible::default());
}
} else {
if let Ok(_) = visible.get(entity) {
commands.remove_one::<Visible>(entity);
}
if rect.is_overlapping(sprite_rect) && visible.get(entity).is_err() {
commands.insert_one(entity, Visible::default());
} else if visible.get(entity).is_ok() {
commands.remove_one::<Visible>(entity);
}
}
}
Expand Down Expand Up @@ -118,14 +112,10 @@ pub fn frustum_culling_atlases(
size,
};

if rect.is_overlapping(sprite_rect) {
if let Err(_) = visible.get(entity) {
commands.insert_one(entity, Visible::default());
}
} else {
if let Ok(_) = visible.get(entity) {
commands.remove_one::<Visible>(entity);
}
if rect.is_overlapping(sprite_rect) && visible.get(entity).is_err() {
commands.insert_one(entity, Visible::default());
} else if visible.get(entity).is_ok() {
commands.remove_one::<Visible>(entity);
}
}
}
Expand Down

0 comments on commit 7f2f932

Please sign in to comment.