bevy/crates/bevy_sprite/src
Zicklag 89217171b4 Add Sprite Flipping (#1407)
OK, here's my attempt at sprite flipping. There are a couple of points that I need review/help on, but I think the UX is about ideal:

```rust
        .spawn(SpriteBundle {
            material: materials.add(texture_handle.into()),
            sprite: Sprite {
                // Flip the sprite along the x axis
                flip: SpriteFlip { x: true, y: false },
                ..Default::default()
            },
            ..Default::default()
        });
```

Now for the issues. The big issue is that for some reason, when flipping the UVs on the sprite, there is a light "bleeding" or whatever you call it where the UV tries to sample past the texture boundry and ends up clipping. This is only noticed when resizing the window, though. You can see a screenshot below.

![image](https://user-images.githubusercontent.com/25393315/107098172-397aaa00-67d4-11eb-8e02-c90c820cd70e.png)

I am quite baffled why the texture sampling is overrunning like it is and could use some guidance if anybody knows what might be wrong.

The other issue, which I just worked around, is that I had to remove the `#[render_resources(from_self)]` annotation from the Spritesheet because the `SpriteFlip` render resource wasn't being picked up properly in the shader when using it. I'm not sure what the cause of that was, but by removing the annotation and re-organizing the shader inputs accordingly the problem was fixed.

I'm not sure if this is the most efficient way to do this or if there is a better way, but I wanted to try it out if only for the learning experience. Let me know what you think!
2021-03-03 19:26:45 +00:00
..
render Add Sprite Flipping (#1407) 2021-03-03 19:26:45 +00:00
collide_aabb.rs Fix collision detection by calculating positive penetration depth. (#966) 2020-12-01 00:33:52 -08:00
color_material.rs Bevy Reflection (#926) 2020-11-27 16:39:59 -08:00
dynamic_texture_atlas_builder.rs Extend the Texture asset type to support 3D data (#903) 2020-11-22 12:04:47 -08:00
entity.rs Derive Clone for SpriteSheetBundle and SpriteBundle (#1177) 2021-01-01 14:52:09 -06:00
lib.rs Non-string labels (#1423 continued) (#1473) 2021-02-18 13:20:37 -08:00
rect.rs Misc cleanups (#879) 2020-11-17 13:40:18 -08:00
sprite.rs Add Sprite Flipping (#1407) 2021-03-03 19:26:45 +00:00
texture_atlas_builder.rs Texture atlas format and conversion (#1365) 2021-02-01 11:30:11 -08:00
texture_atlas.rs Add Sprite Flipping (#1407) 2021-03-03 19:26:45 +00:00