Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl From<Color> for ClearColorConfig #10734

Merged
merged 2 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/bevy_core_pipeline/src/clear_color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ pub enum ClearColorConfig {
None,
}

impl From<Color> for ClearColorConfig {
fn from(color: Color) -> Self {
Self::Custom(color)
}
}

/// A [`Resource`] that stores the color that is used to clear the screen between frames.
///
/// This color appears as the "background" color for simple apps,
Expand Down
3 changes: 1 addition & 2 deletions examples/3d/render_to_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::f32::consts::PI;

use bevy::{
core_pipeline::clear_color::ClearColorConfig,
prelude::*,
render::{
camera::RenderTarget,
Expand Down Expand Up @@ -97,7 +96,7 @@ fn setup(
commands.spawn((
Camera3dBundle {
camera_3d: Camera3d {
clear_color: ClearColorConfig::Custom(Color::WHITE),
clear_color: Color::WHITE.into(),
..default()
},
camera: Camera {
Expand Down
7 changes: 2 additions & 5 deletions examples/shader/post_processing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
//! This is a fairly low level example and assumes some familiarity with rendering concepts and wgpu.

use bevy::{
core_pipeline::{
clear_color::ClearColorConfig, core_3d,
fullscreen_vertex_shader::fullscreen_shader_vertex_state,
},
core_pipeline::{core_3d, fullscreen_vertex_shader::fullscreen_shader_vertex_state},
ecs::query::QueryItem,
prelude::*,
render::{
Expand Down Expand Up @@ -330,7 +327,7 @@ fn setup(
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 5.0))
.looking_at(Vec3::default(), Vec3::Y),
camera_3d: Camera3d {
clear_color: ClearColorConfig::Custom(Color::WHITE),
clear_color: Color::WHITE.into(),
..default()
},
..default()
Expand Down