bevy/crates/bevy_sprite
JoshValjosh 8d78c37ce9
Use FloatOrd for sprite Z comparison and ignore sprites with NaN (#15267)
# Objective

Fixes #15258

## Solution

If my understanding is correct, sprites with NaN anywhere in their
transform won't even get onto the screen, so should not generate pick
events. This PR filters sprites with NaN in their transforms before
sorting by depth, then uses `FloatOrd` to simplify the comparison. Since
we're guaranteed to not have NaN values, it's technically unnecessary,
and we could instead sort with `a.partial_cmp(&b).unwrap()`, or even
`unwrap_unchecked()`.

## Testing

I ran the picking example to ensure Z sorting was working as intended.
2024-09-17 23:27:53 +00:00
..
src Use FloatOrd for sprite Z comparison and ignore sprites with NaN (#15267) 2024-09-17 23:27:53 +00:00
Cargo.toml Add bevy_picking sprite backend (#14757) 2024-08-26 18:01:32 +00:00
README.md Add README.md to all crates (#13184) 2024-05-02 18:56:00 +00:00

Bevy Sprite

License Crates.io Downloads Docs Discord