mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 15:14:50 +00:00
don't render completely transparent UI nodes (#5537)
# Objective - I often have UI nodes that are completely transparent and just for organisation - Don't render them - I doesn't bring a lot of improvements, but it doesn't add a lot of complexity either
This commit is contained in:
parent
992681b59b
commit
b80636b330
2 changed files with 5 additions and 0 deletions
|
@ -379,6 +379,7 @@ impl Color {
|
|||
}
|
||||
|
||||
/// Get alpha.
|
||||
#[inline(always)]
|
||||
pub fn a(&self) -> f32 {
|
||||
match self {
|
||||
Color::Rgba { alpha, .. }
|
||||
|
|
|
@ -197,6 +197,10 @@ pub fn extract_uinodes(
|
|||
if !images.contains(&image) {
|
||||
continue;
|
||||
}
|
||||
// Skip completely transparent nodes
|
||||
if color.0.a() == 0.0 {
|
||||
continue;
|
||||
}
|
||||
extracted_uinodes.uinodes.push(ExtractedUiNode {
|
||||
transform: transform.compute_matrix(),
|
||||
color: color.0,
|
||||
|
|
Loading…
Reference in a new issue