Skip to content

Commit 437c4d5

Browse files
Minor clear color doc improvements (#19514)
1 parent 5279863 commit 437c4d5

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

crates/bevy_render/src/camera/camera.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,12 +715,13 @@ impl Camera {
715715
}
716716
}
717717

718-
/// Control how this camera outputs once rendering is completed.
718+
/// Control how this [`Camera`] outputs once rendering is completed.
719719
#[derive(Debug, Clone, Copy)]
720720
pub enum CameraOutputMode {
721721
/// Writes the camera output to configured render target.
722722
Write {
723723
/// The blend state that will be used by the pipeline that writes the intermediate render textures to the final render target texture.
724+
/// If not set, the output will be written as-is, ignoring `clear_color` and the existing data in the final render target texture.
724725
blend_state: Option<BlendState>,
725726
/// The clear color operation to perform on the final render target texture.
726727
clear_color: ClearColorConfig,

crates/bevy_render/src/camera/clear_color.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ use bevy_reflect::prelude::*;
66
use derive_more::derive::From;
77
use serde::{Deserialize, Serialize};
88

9-
/// For a camera, specifies the color used to clear the viewport before rendering.
9+
/// For a camera, specifies the color used to clear the viewport
10+
/// [before rendering](crate::camera::Camera::clear_color)
11+
/// or when [writing to the final render target texture](crate::camera::Camera::output_mode).
1012
#[derive(Reflect, Serialize, Deserialize, Copy, Clone, Debug, Default, From)]
1113
#[reflect(Serialize, Deserialize, Default, Clone)]
1214
pub enum ClearColorConfig {
@@ -21,10 +23,15 @@ pub enum ClearColorConfig {
2123
None,
2224
}
2325

24-
/// A [`Resource`] that stores the color that is used to clear the screen between frames.
26+
/// A [`Resource`] that stores the default color that cameras use to clear the screen between frames.
2527
///
2628
/// This color appears as the "background" color for simple apps,
2729
/// when there are portions of the screen with nothing rendered.
30+
///
31+
/// Individual cameras may use [`Camera.clear_color`] to specify a different
32+
/// clear color or opt out of clearing their viewport.
33+
///
34+
/// [`Camera.clear_color`]: crate::camera::Camera::clear_color
2835
#[derive(Resource, Clone, Debug, Deref, DerefMut, ExtractResource, Reflect)]
2936
#[reflect(Resource, Default, Debug, Clone)]
3037
pub struct ClearColor(pub Color);

0 commit comments

Comments
 (0)