File tree Expand file tree Collapse file tree 5 files changed +12
-1
lines changed Expand file tree Collapse file tree 5 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,7 @@ pub fn prepare_core_views_system(
398398) {
399399 let mut textures = HashMap :: default ( ) ;
400400 for ( entity, view, camera) in views_3d. iter ( ) {
401+ let mut render_on_top = false ;
401402 let mut get_cached_texture = || {
402403 texture_cache. get (
403404 & render_device,
@@ -418,6 +419,7 @@ pub fn prepare_core_views_system(
418419 )
419420 } ;
420421 let cached_texture = if let Some ( camera) = camera {
422+ render_on_top = camera. render_on_top ;
421423 textures
422424 . entry ( camera. target . clone ( ) )
423425 . or_insert_with ( get_cached_texture)
@@ -428,6 +430,7 @@ pub fn prepare_core_views_system(
428430 commands. entity ( entity) . insert ( ViewDepthTexture {
429431 texture : cached_texture. texture ,
430432 view : cached_texture. default_view ,
433+ render_on_top,
431434 } ) ;
432435 }
433436}
Original file line number Diff line number Diff line change @@ -68,7 +68,11 @@ impl Node for MainPass3dNode {
6868 view : & depth. view ,
6969 // NOTE: The opaque main pass loads the depth buffer and possibly overwrites it
7070 depth_ops : Some ( Operations {
71- load : LoadOp :: Load ,
71+ load : if depth. render_on_top {
72+ LoadOp :: Clear ( 0.0 )
73+ } else {
74+ LoadOp :: Load
75+ } ,
7276 store : true ,
7377 } ) ,
7478 stencil_ops : None ,
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ pub struct Camera {
2727 pub name : Option < String > ,
2828 #[ reflect( ignore) ]
2929 pub target : RenderTarget ,
30+ pub render_on_top : bool ,
3031 #[ reflect( ignore) ]
3132 pub depth_calculation : DepthCalculation ,
3233 pub near : f32 ,
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ pub struct ExtractedCamera {
7474 pub target : RenderTarget ,
7575 pub name : Option < String > ,
7676 pub physical_size : Option < UVec2 > ,
77+ pub render_on_top : bool ,
7778}
7879
7980fn extract_cameras (
@@ -96,6 +97,7 @@ fn extract_cameras(
9697 target : camera. target . clone ( ) ,
9798 name : camera. name . clone ( ) ,
9899 physical_size : camera. target . get_physical_size ( & windows, & images) ,
100+ render_on_top : camera. render_on_top ,
99101 } ,
100102 ExtractedView {
101103 projection : camera. projection_matrix ,
Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ impl ViewTarget {
137137pub struct ViewDepthTexture {
138138 pub texture : Texture ,
139139 pub view : TextureView ,
140+ pub render_on_top : bool ,
140141}
141142
142143fn prepare_view_uniforms (
You can’t perform that action at this time.
0 commit comments