bevy/crates/bevy_sprite/src
KDecay 544b6dfb86 Change default ColorMaterial color to white (#3981)
# Context

I wanted to add a `texture` to my `ColorMaterial` without explicitly adding a `color`. To do this I used `..Default::default()` which in turn gave me unexpected results. I was expecting that my texture would render without any color modifications, but to my surprise it got rendered in a purple tint (`Color::rgb(1.0, 0.0, 1.0)`). To fix this I had to explicitly define the `color` using `color: Color::WHITE`.

## What I wanted to use

```rust
commands
    .spawn_bundle(MaterialMesh2dBundle {
        mesh: mesh_handle.clone().into(),
        transform: Transform::default().with_scale(Vec3::splat(8.)),
        material: materials.add(ColorMaterial {
            texture: Some(texture_handle.clone()),
            ..Default::default() // here
        }),
        ..Default::default()
    })
```

![image](https://user-images.githubusercontent.com/75334794/154765141-4a8161ce-4ec8-4687-b7d5-18ddf1b58660.png)

## What I had to use instead

```rust
commands
    .spawn_bundle(MaterialMesh2dBundle {
        mesh: mesh_handle.clone().into(),
        transform: Transform::default().with_scale(Vec3::splat(8.)),
        material: materials.add(ColorMaterial {
            texture: Some(texture_handle.clone()),
            color: Color::WHITE, // here
        }),
        ..Default::default()
    })
```

![image](https://user-images.githubusercontent.com/75334794/154765225-f1508b41-9d5b-4f0c-af7b-e89c1a82d85b.png)
2022-02-19 22:12:13 +00:00
..
mesh2d Change default ColorMaterial color to white (#3981) 2022-02-19 22:12:13 +00:00
render Fix SetSpriteTextureBindGroup to use index (#3896) 2022-02-08 23:18:11 +00:00
bundle.rs Add 2d meshes and materials (#3460) 2022-01-08 01:29:08 +00:00
collide_aabb.rs Add the Inside version to the Collision enum (#2489) 2022-02-01 22:40:25 +00:00
dynamic_texture_atlas_builder.rs Replace old renderer with new renderer (#3312) 2021-12-14 03:58:23 +00:00
lib.rs Add headless mode (#3439) 2022-01-08 10:39:43 +00:00
rect.rs Implement the Overflow::Hidden style property for UI (#3296) 2021-12-19 05:44:28 +00:00
sprite.rs only use unique type UUIDs (#3579) 2022-02-12 19:58:02 +00:00
texture_atlas_builder.rs small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00
texture_atlas.rs small and mostly pointless refactoring (#2934) 2022-02-13 22:33:55 +00:00