mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
render: make ClearColor a tuple struct
This commit is contained in:
parent
a4afa4e7f3
commit
1e614e41f1
3 changed files with 4 additions and 17 deletions
|
@ -19,25 +19,12 @@ impl TextureAttachment {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ClearColor {
|
||||
pub color: Color,
|
||||
}
|
||||
|
||||
impl ClearColor {
|
||||
pub fn new(color: Color) -> Self {
|
||||
ClearColor {
|
||||
color,
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct ClearColor(pub Color);
|
||||
|
||||
impl Default for ClearColor {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
color: Color::rgb(0.1, 0.1, 0.1),
|
||||
}
|
||||
Self(Color::rgb(0.1, 0.1, 0.1))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
|
@ -111,7 +111,7 @@ impl Node for PassNode {
|
|||
for (i, color_attachment) in self.descriptor.color_attachments.iter_mut().enumerate() {
|
||||
if self.default_clear_color_inputs.contains(&i) {
|
||||
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] {
|
||||
|
|
|
@ -2,7 +2,7 @@ use bevy::prelude::*;
|
|||
|
||||
fn main() {
|
||||
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()
|
||||
.run();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue