do not spend time drawing text with is_visible = false (#893)

do not draw text with is_visible = false
This commit is contained in:
marius851000 2020-11-22 20:57:52 +01:00 committed by GitHub
parent 1e9a0544bd
commit eb587b2f10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -153,6 +153,10 @@ pub fn draw_text_system(
let vertex_buffer_descriptor = font_quad.get_vertex_buffer_descriptor(); let vertex_buffer_descriptor = font_quad.get_vertex_buffer_descriptor();
for (entity, mut draw, text, node, global_transform) in query.iter_mut() { for (entity, mut draw, text, node, global_transform) in query.iter_mut() {
if !draw.is_visible {
continue;
}
if let Some(text_glyphs) = text_pipeline.get_glyphs(&entity) { if let Some(text_glyphs) = text_pipeline.get_glyphs(&entity) {
let position = global_transform.translation - (node.size / 2.0).extend(0.0); let position = global_transform.translation - (node.size / 2.0).extend(0.0);