@@ -21,7 +21,7 @@ use bevy_camera::{
2121 visibility:: { self , RenderLayers , VisibleEntities } ,
2222 Camera , Camera2d , Camera3d , CameraMainTextureUsages , CameraOutputMode , CameraUpdateSystems ,
2323 ClearColor , ClearColorConfig , Exposure , ManualTextureViewHandle , NormalizedRenderTarget ,
24- Projection , RenderTargetInfo , Viewport ,
24+ Projection , RenderTarget , RenderTargetInfo , Viewport ,
2525} ;
2626use bevy_derive:: { Deref , DerefMut } ;
2727use bevy_ecs:: {
@@ -311,7 +311,7 @@ pub fn camera_system(
311311 windows : Query < ( Entity , & Window ) > ,
312312 images : Res < Assets < Image > > ,
313313 manual_texture_views : Res < ManualTextureViews > ,
314- mut cameras : Query < ( & mut Camera , & mut Projection ) > ,
314+ mut cameras : Query < ( & mut Camera , & RenderTarget , & mut Projection ) > ,
315315) -> Result < ( ) , BevyError > {
316316 let primary_window = primary_window. iter ( ) . next ( ) ;
317317
@@ -332,13 +332,13 @@ pub fn camera_system(
332332 } )
333333 . collect ( ) ;
334334
335- for ( mut camera, mut camera_projection) in & mut cameras {
335+ for ( mut camera, render_target , mut camera_projection) in & mut cameras {
336336 let mut viewport_size = camera
337337 . viewport
338338 . as_ref ( )
339339 . map ( |viewport| viewport. physical_size ) ;
340340
341- if let Some ( normalized_target) = & camera . target . normalize ( primary_window)
341+ if let Some ( normalized_target) = render_target . normalize ( primary_window)
342342 && ( normalized_target. is_changed ( & changed_window_ids, & changed_image_handles)
343343 || camera. is_added ( )
344344 || camera_projection. is_changed ( )
@@ -422,18 +422,21 @@ pub fn extract_cameras(
422422 Entity ,
423423 RenderEntity ,
424424 & Camera ,
425+ & RenderTarget ,
425426 & CameraRenderGraph ,
426427 & GlobalTransform ,
427428 & VisibleEntities ,
428429 & Frustum ,
429- Has < Hdr > ,
430- Option < & ColorGrading > ,
431- Option < & Exposure > ,
432- Option < & TemporalJitter > ,
433- Option < & MipBias > ,
434- Option < & RenderLayers > ,
435- Option < & Projection > ,
436- Has < NoIndirectDrawing > ,
430+ (
431+ Has < Hdr > ,
432+ Option < & ColorGrading > ,
433+ Option < & Exposure > ,
434+ Option < & TemporalJitter > ,
435+ Option < & MipBias > ,
436+ Option < & RenderLayers > ,
437+ Option < & Projection > ,
438+ Has < NoIndirectDrawing > ,
439+ ) ,
437440 ) > ,
438441 > ,
439442 primary_window : Extract < Query < Entity , With < PrimaryWindow > > > ,
@@ -456,18 +459,21 @@ pub fn extract_cameras(
456459 main_entity,
457460 render_entity,
458461 camera,
462+ render_target,
459463 camera_render_graph,
460464 transform,
461465 visible_entities,
462466 frustum,
463- hdr,
464- color_grading,
465- exposure,
466- temporal_jitter,
467- mip_bias,
468- render_layers,
469- projection,
470- no_indirect_drawing,
467+ (
468+ hdr,
469+ color_grading,
470+ exposure,
471+ temporal_jitter,
472+ mip_bias,
473+ render_layers,
474+ projection,
475+ no_indirect_drawing,
476+ ) ,
471477 ) in query. iter ( )
472478 {
473479 if !camera. is_active {
@@ -522,7 +528,7 @@ pub fn extract_cameras(
522528 let mut commands = commands. entity ( render_entity) ;
523529 commands. insert ( (
524530 ExtractedCamera {
525- target : camera . target . normalize ( primary_window) ,
531+ target : render_target . normalize ( primary_window) ,
526532 viewport : camera. viewport . clone ( ) ,
527533 physical_viewport_size : Some ( viewport_size) ,
528534 physical_target_size : Some ( target_size) ,
0 commit comments