Minor clear color doc improvements (#19514)

This commit is contained in:
SpecificProtagonist 2025-06-09 21:56:58 +02:00 committed by GitHub
parent 5279863c42
commit 437c4d5b25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 3 deletions

View File

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

View File

@ -6,7 +6,9 @@ use bevy_reflect::prelude::*;
use derive_more::derive::From; use derive_more::derive::From;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// For a camera, specifies the color used to clear the viewport before rendering. /// For a camera, specifies the color used to clear the viewport
/// [before rendering](crate::camera::Camera::clear_color)
/// or when [writing to the final render target texture](crate::camera::Camera::output_mode).
#[derive(Reflect, Serialize, Deserialize, Copy, Clone, Debug, Default, From)] #[derive(Reflect, Serialize, Deserialize, Copy, Clone, Debug, Default, From)]
#[reflect(Serialize, Deserialize, Default, Clone)] #[reflect(Serialize, Deserialize, Default, Clone)]
pub enum ClearColorConfig { pub enum ClearColorConfig {
@ -21,10 +23,15 @@ pub enum ClearColorConfig {
None, None,
} }
/// A [`Resource`] that stores the color that is used to clear the screen between frames. /// A [`Resource`] that stores the default color that cameras use to clear the screen between frames.
/// ///
/// This color appears as the "background" color for simple apps, /// This color appears as the "background" color for simple apps,
/// when there are portions of the screen with nothing rendered. /// when there are portions of the screen with nothing rendered.
///
/// Individual cameras may use [`Camera.clear_color`] to specify a different
/// clear color or opt out of clearing their viewport.
///
/// [`Camera.clear_color`]: crate::camera::Camera::clear_color
#[derive(Resource, Clone, Debug, Deref, DerefMut, ExtractResource, Reflect)] #[derive(Resource, Clone, Debug, Deref, DerefMut, ExtractResource, Reflect)]
#[reflect(Resource, Default, Debug, Clone)] #[reflect(Resource, Default, Debug, Clone)]
pub struct ClearColor(pub Color); pub struct ClearColor(pub Color);