bevy/crates/bevy_sprite/src/render
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
..
mod.rs Add Sprite Flipping (#1407) 2021-03-03 19:26:45 +00:00
sprite.frag sprite: use bevy_transform types in sprite entities 2020-06-22 12:14:40 -07:00
sprite.vert Add Sprite Flipping (#1407) 2021-03-03 19:26:45 +00:00
sprite_sheet.frag sprite: add color to TextureAtlasSprite and make Vec3 16 bytes again to account for glsl UBO layout 2020-06-21 17:43:36 -07:00
sprite_sheet.vert Add Sprite Flipping (#1407) 2021-03-03 19:26:45 +00:00