bevy/crates/bevy_text/src
Rob Parrett 05c87f3c01
Fix text2d view-visibility (#10100)
# Objective

Fixes #9676
Possible alternative to #9708

`Text2dBundles` are not currently drawn because the render-world-only
entities for glyphs that are created in `extract_text2d_sprite` are not
tracked by the per-view `VisibleEntities`.

## Solution

Add an `Option<Entity>` to `ExtractedSprite` that keeps track of the
original entity that caused a "glyph entity" to be created.

Use that in `queue_sprites` if it exists when checking view visibility.

## Benchmarks

Quick benchmarks. Average FPS over 1500 frames.

| bench | before fps | after fps | diff |
|-|-|-|-|
|many_sprites|884.93|879.00|🟡 -0.7%|
|bevymark -- --benchmark --waves 100 --per-wave 1000 --mode
sprite|75.99|75.93|🟡 -0.1%|
|bevymark -- --benchmark --waves 50 --per-wave 1000 --mode
mesh2d|32.85|32.58|🟡 -0.8%|
2023-10-13 19:14:31 +00:00
..
error.rs Remove TextError::ExceedMaxTextAtlases(usize) variant (#6796) 2022-12-05 23:23:16 +00:00
FiraMono-subset.ttf add a default font (#8445) 2023-04-21 22:30:18 +00:00
font_atlas_set.rs register TextLayoutInfo and TextFlags type. (#9919) 2023-09-25 18:59:29 +00:00
font_atlas.rs
font_loader.rs Removed anyhow (#10003) 2023-10-06 07:20:13 +00:00
font.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
glyph_brush.rs register TextLayoutInfo and TextFlags type. (#9919) 2023-09-25 18:59:29 +00:00
lib.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
pipeline.rs Updates for rust 1.73 (#10035) 2023-10-06 00:31:10 +00:00
text2d.rs Fix text2d view-visibility (#10100) 2023-10-13 19:14:31 +00:00
text.rs impl From<String> and From<&str> for TextSection (#8856) 2023-09-11 19:00:50 +00:00