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.
#[inline(always)]
pub fn a(&self) -> f32 {
match self {
Color::Rgba { alpha, .. }

View file

@ -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,