Update post_processing example to not render UI with first pass camera (#6469)

# Objective

Make sure the post processing example won't render UI twice.

## Solution

Disable UI on the first pass camera with `UiCameraConfig`
This commit is contained in:
Jakub Arnold 2022-11-14 22:34:26 +00:00
parent dc09ee36e2
commit 4de4e54755

View File

@ -95,19 +95,24 @@ fn setup(
});
// Main camera, first to render
commands.spawn(Camera3dBundle {
camera_3d: Camera3d {
clear_color: ClearColorConfig::Custom(Color::WHITE),
commands.spawn((
Camera3dBundle {
camera_3d: Camera3d {
clear_color: ClearColorConfig::Custom(Color::WHITE),
..default()
},
camera: Camera {
target: RenderTarget::Image(image_handle.clone()),
..default()
},
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 15.0))
.looking_at(Vec3::default(), Vec3::Y),
..default()
},
camera: Camera {
target: RenderTarget::Image(image_handle.clone()),
..default()
},
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 15.0))
.looking_at(Vec3::default(), Vec3::Y),
..default()
});
// Disable UI rendering for the first pass camera. This prevents double rendering of UI at
// the cost of rendering the UI without any post processing effects.
UiCameraConfig { show_ui: false },
));
// This specifies the layer used for the post processing camera, which will be attached to the post processing camera and 2d quad.
let post_processing_pass_layer = RenderLayers::layer((RenderLayers::TOTAL_LAYERS - 1) as u8);