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:
François 2022-08-08 21:58:20 +00:00
parent 992681b59b
commit b80636b330
2 changed files with 5 additions and 0 deletions

View File

@ -379,6 +379,7 @@ impl Color {
} }
/// Get alpha. /// Get alpha.
#[inline(always)]
pub fn a(&self) -> f32 { pub fn a(&self) -> f32 {
match self { match self {
Color::Rgba { alpha, .. } Color::Rgba { alpha, .. }

View File

@ -197,6 +197,10 @@ pub fn extract_uinodes(
if !images.contains(&image) { if !images.contains(&image) {
continue; continue;
} }
// Skip completely transparent nodes
if color.0.a() == 0.0 {
continue;
}
extracted_uinodes.uinodes.push(ExtractedUiNode { extracted_uinodes.uinodes.push(ExtractedUiNode {
transform: transform.compute_matrix(), transform: transform.compute_matrix(),
color: color.0, color: color.0,