impl From<Color> for ClearColorConfig (#10734)
# Objective I tried setting `ClearColorConfig` in my app via `Color::FOO.into()` expecting it to work, but the impl was missing. ## Solution - Add `impl From<Color> for ClearColorConfig` - Change examples to use this impl ## Changelog ### Added - `ClearColorConfig` can be constructed via `.into()` on a `Color` --------- Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com> Co-authored-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
This commit is contained in:
parent
4788315fd0
commit
73bb310304
@ -19,6 +19,12 @@ pub enum ClearColorConfig {
|
|||||||
None,
|
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.
|
/// 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,
|
/// This color appears as the "background" color for simple apps,
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
core_pipeline::clear_color::ClearColorConfig,
|
|
||||||
prelude::*,
|
prelude::*,
|
||||||
render::{
|
render::{
|
||||||
camera::RenderTarget,
|
camera::RenderTarget,
|
||||||
@ -97,7 +96,7 @@ fn setup(
|
|||||||
commands.spawn((
|
commands.spawn((
|
||||||
Camera3dBundle {
|
Camera3dBundle {
|
||||||
camera_3d: Camera3d {
|
camera_3d: Camera3d {
|
||||||
clear_color: ClearColorConfig::Custom(Color::WHITE),
|
clear_color: Color::WHITE.into(),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
camera: Camera {
|
camera: Camera {
|
||||||
|
@ -6,10 +6,7 @@
|
|||||||
//! This is a fairly low level example and assumes some familiarity with rendering concepts and wgpu.
|
//! This is a fairly low level example and assumes some familiarity with rendering concepts and wgpu.
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
core_pipeline::{
|
core_pipeline::{core_3d, fullscreen_vertex_shader::fullscreen_shader_vertex_state},
|
||||||
clear_color::ClearColorConfig, core_3d,
|
|
||||||
fullscreen_vertex_shader::fullscreen_shader_vertex_state,
|
|
||||||
},
|
|
||||||
ecs::query::QueryItem,
|
ecs::query::QueryItem,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
render::{
|
render::{
|
||||||
@ -330,7 +327,7 @@ fn setup(
|
|||||||
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 5.0))
|
transform: Transform::from_translation(Vec3::new(0.0, 0.0, 5.0))
|
||||||
.looking_at(Vec3::default(), Vec3::Y),
|
.looking_at(Vec3::default(), Vec3::Y),
|
||||||
camera_3d: Camera3d {
|
camera_3d: Camera3d {
|
||||||
clear_color: ClearColorConfig::Custom(Color::WHITE),
|
clear_color: Color::WHITE.into(),
|
||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
..default()
|
..default()
|
||||||
|
Loading…
Reference in New Issue
Block a user