mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
clearpass: also clear views without depth (2d) (#3286)
# Objective - after #3209, 2d examples background were not cleared <img width="912" alt="Screenshot 2021-12-10 at 00 48 04" src="https://user-images.githubusercontent.com/8672791/145494415-d4b7a149-6f9a-4036-9ac5-3d1227b4de69.png"> ## Solution - Change the query to also work when there isn't a `ViewDepthTexture`
This commit is contained in:
parent
a2f0fe24e8
commit
cf48132efd
1 changed files with 3 additions and 2 deletions
|
@ -8,7 +8,8 @@ use bevy_render2::{
|
|||
};
|
||||
|
||||
pub struct ClearPassNode {
|
||||
query: QueryState<(&'static ViewTarget, &'static ViewDepthTexture), With<ExtractedView>>,
|
||||
query:
|
||||
QueryState<(&'static ViewTarget, Option<&'static ViewDepthTexture>), With<ExtractedView>>,
|
||||
}
|
||||
|
||||
impl ClearPassNode {
|
||||
|
@ -43,7 +44,7 @@ impl Node for ClearPassNode {
|
|||
load: LoadOp::Clear(clear_color.0.into()),
|
||||
store: true,
|
||||
})],
|
||||
depth_stencil_attachment: Some(RenderPassDepthStencilAttachment {
|
||||
depth_stencil_attachment: depth.map(|depth| RenderPassDepthStencilAttachment {
|
||||
view: &depth.view,
|
||||
depth_ops: Some(Operations {
|
||||
load: LoadOp::Clear(0.0),
|
||||
|
|
Loading…
Reference in a new issue