Commit dca740e
authored
Fix clear color in
# Objective
Split off from #23803, Fix `ClearColor` with `CompositingSpace::Srgb`.
## Solution
Convert clear color to Srgb
## Testing
Code from
#9213 (comment):
```rs
//!
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.insert_resource(ClearColor(Color::srgba(0., 0.5, 0., 1.)))
.add_systems(Startup, |mut commands: Commands| {
commands.spawn((Camera2d, CompositingSpace::Srgb));
commands.spawn((
Sprite::from_color(Color::WHITE.with_alpha(0.5), Vec2::new(512., 512.)),
Transform::from_xyz(-256., 0., 0.),
));
commands.spawn((
Sprite::from_color(Color::BLACK.with_alpha(0.5), Vec2::new(512., 512.)),
Transform::from_xyz(256., 0., 0.),
));
})
.run();
}
```
Before:
<img width="1410" height="878" alt="屏幕截图_20260414_120259"
src="https://github.com/user-attachments/assets/199e2832-d0ba-46fe-835a-8775c2a4adc6"
/>
After:
<img width="1410" height="878" alt="屏幕截图_20260414_115624"
src="https://github.com/user-attachments/assets/f4b26170-3a78-44f1-917d-8f061da83ad5"
/>CompositingSpace::Srgb (#23963)1 parent dd27fe7 commit dca740e
3 files changed
Lines changed: 22 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
415 | 415 | | |
416 | 416 | | |
417 | 417 | | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
418 | 430 | | |
419 | 431 | | |
420 | 432 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
1177 | 1177 | | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
1192 | | - | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
1193 | 1187 | | |
1194 | 1188 | | |
1195 | 1189 | | |
| |||
0 commit comments