render: make ClearColor a tuple struct
This commit is contained in:
parent
a4afa4e7f3
commit
1e614e41f1
@ -19,25 +19,12 @@ impl TextureAttachment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct ClearColor {
|
pub struct ClearColor(pub Color);
|
||||||
pub color: Color,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ClearColor {
|
|
||||||
pub fn new(color: Color) -> Self {
|
|
||||||
ClearColor {
|
|
||||||
color,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for ClearColor {
|
impl Default for ClearColor {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self(Color::rgb(0.1, 0.1, 0.1))
|
||||||
color: Color::rgb(0.1, 0.1, 0.1),
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -111,7 +111,7 @@ impl Node for PassNode {
|
|||||||
for (i, color_attachment) in self.descriptor.color_attachments.iter_mut().enumerate() {
|
for (i, color_attachment) in self.descriptor.color_attachments.iter_mut().enumerate() {
|
||||||
if self.default_clear_color_inputs.contains(&i) {
|
if self.default_clear_color_inputs.contains(&i) {
|
||||||
if let Some(default_clear_color) = resources.get::<ClearColor>() {
|
if let Some(default_clear_color) = resources.get::<ClearColor>() {
|
||||||
color_attachment.clear_color = default_clear_color.color;
|
color_attachment.clear_color = default_clear_color.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(input_index) = self.color_attachment_input_indices[i] {
|
if let Some(input_index) = self.color_attachment_input_indices[i] {
|
||||||
|
@ -2,7 +2,7 @@ use bevy::prelude::*;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::build()
|
App::build()
|
||||||
.add_resource(ClearColor::new(Color::rgb(0.2, 0.2, 0.8)))
|
.add_resource(ClearColor(Color::rgb(0.2, 0.2, 0.8)))
|
||||||
.add_default_plugins()
|
.add_default_plugins()
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user