-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior
Description
Bevy version
current main (bc4fe9b)
Operating system & version
MacOS 10.15.7
What you did
- Set the clear color to red
- Display a sprite that covers everything black as a children of another entity
- Display a sprite from a transparent png
use bevy::prelude::*;
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.insert_resource(ClearColor(Color::RED))
.add_startup_system(setup.system())
.add_system(cycle.system())
.run();
}
fn setup(commands: &mut Commands, mut materials: ResMut<Assets<ColorMaterial>>) {
commands
.spawn(OrthographicCameraBundle::new_2d())
.spawn((GlobalTransform::default(), Transform::default()))
.with_children(|p| {
p.spawn(SpriteBundle {
material: materials.add(Color::BLACK.into()),
sprite: Sprite {
size: Vec2::new(10000., 10000.),
..Default::default()
},
..Default::default()
});
});
}
struct ShouldTransparent;
fn cycle(
commands: &mut Commands,
mut cycle: Local<u32>,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<ColorMaterial>>,
) {
*cycle = (*cycle + 1) % 20;
if *cycle == 0 {
let texture_handle = asset_server.load("branding/icon.png");
for x in -1..=1 {
for y in -1..=1 {
commands.spawn(SpriteBundle {
material: materials.add(texture_handle.clone().into()),
transform: Transform {
translation: Vec3::new(x as f32 * 256., y as f32 * 256., 0.1),
scale: Vec3::one(),
rotation: Quat::default(),
},
..Default::default()
});
// .with(ShouldTransparent);
}
}
}
}
What you expected to happen
No transparency issue
What actually happened
The red clear color leaks through for a frame
Additional information
If I remove the hierarchy for the black background, there are no transparency issue.
If I add the tag component ShouldTransparent
to my sprites, there are no transparency issue.
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behavior