Skip to content

Commit

Permalink
Fix example colors (bevyengine#672)
Browse files Browse the repository at this point in the history
  • Loading branch information
cart authored Oct 12, 2020
1 parent 930eba4 commit 5e7c36d
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 38 deletions.
4 changes: 4 additions & 0 deletions crates/bevy_render/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ impl Plugin for RenderPlugin {
app.add_asset_loader::<Texture, HdrTextureLoader>();
}

if app.resources().get::<ClearColor>().is_none() {
app.resources_mut().insert(ClearColor::default());
}

app.add_stage_after(bevy_asset::stage::ASSET_EVENTS, stage::RENDER_RESOURCE)
.add_stage_after(stage::RENDER_RESOURCE, stage::RENDER_GRAPH_SYSTEMS)
.add_stage_after(stage::RENDER_GRAPH_SYSTEMS, stage::DRAW)
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/pass/pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct ClearColor(pub Color);

impl Default for ClearColor {
fn default() -> Self {
Self(Color::rgb(0.1, 0.1, 0.1))
Self(Color::rgb(0.4, 0.4, 0.4))
}
}

Expand Down
14 changes: 2 additions & 12 deletions examples/3d/3d_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,16 @@ fn setup(
// plane
.spawn(PbrComponents {
mesh: meshes.add(Mesh::from(shape::Plane { size: 10.0 })),
material: materials.add(Color::rgb(0.1, 0.2, 0.1).into()),
material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()),
..Default::default()
})
// cube
.spawn(PbrComponents {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
material: materials.add(Color::rgb(0.5, 0.4, 0.3).into()),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
transform: Transform::from_translation(Vec3::new(0.0, 1.0, 0.0)),
..Default::default()
})
// sphere
.spawn(PbrComponents {
mesh: meshes.add(Mesh::from(shape::Icosphere {
subdivisions: 4,
radius: 0.5,
})),
material: materials.add(Color::rgb(0.1, 0.4, 0.8).into()),
transform: Transform::from_translation(Vec3::new(1.5, 1.5, 1.5)),
..Default::default()
})
// light
.spawn(LightComponents {
transform: Transform::from_translation(Vec3::new(4.0, 8.0, 4.0)),
Expand Down
4 changes: 2 additions & 2 deletions examples/3d/load_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn setup(
.load("assets/models/monkey/Monkey.gltf")
.unwrap(),
// create a material for the mesh
material: materials.add(Color::rgb(0.5, 0.4, 0.3).into()),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
transform: Transform::from_translation(Vec3::new(-1.5, 0.0, 0.0)),
..Default::default()
})
Expand All @@ -33,7 +33,7 @@ fn setup(
.load("assets/models/monkey/Monkey.glb")
.unwrap(),
// create a material for the mesh
material: materials.add(Color::rgb(0.5, 0.4, 0.3).into()),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
transform: Transform::from_translation(Vec3::new(1.5, 0.0, 0.0)),
..Default::default()
})
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/msaa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn setup(
// cube
.spawn(PbrComponents {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
material: materials.add(Color::rgb(0.5, 0.4, 0.3).into()),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
..Default::default()
})
// light
Expand Down
2 changes: 1 addition & 1 deletion examples/3d/parenting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn setup(
) {
let cube_handle = meshes.add(Mesh::from(shape::Cube { size: 1.0 }));
let cube_material_handle = materials.add(StandardMaterial {
albedo: Color::rgb(0.5, 0.4, 0.3),
albedo: Color::rgb(0.8, 0.7, 0.6),
..Default::default()
});

Expand Down
2 changes: 1 addition & 1 deletion examples/asset/asset_loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn setup(

// You can also add assets directly to their Assets<T> storage:
let material_handle = materials.add(StandardMaterial {
albedo: Color::rgb(0.5, 0.4, 0.3),
albedo: Color::rgb(0.8, 0.7, 0.6),
..Default::default()
});

Expand Down
2 changes: 1 addition & 1 deletion examples/asset/hot_asset_reloading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn setup(

// Create a material for the mesh:
let material_handle = materials.add(StandardMaterial {
albedo: Color::rgb(0.5, 0.4, 0.3),
albedo: Color::rgb(0.8, 0.7, 0.6),
..Default::default()
});

Expand Down
14 changes: 7 additions & 7 deletions examples/game/breakout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
App::build()
.add_default_plugins()
.add_resource(Scoreboard { score: 0 })
.add_resource(ClearColor(Color::rgb(0.7, 0.7, 0.7)))
.add_resource(ClearColor(Color::rgb(0.9, 0.9, 0.9)))
.add_startup_system(setup.system())
.add_system(paddle_movement_system.system())
.add_system(ball_collision_system.system())
Expand Down Expand Up @@ -47,7 +47,7 @@ fn setup(
.spawn(UiCameraComponents::default())
// paddle
.spawn(SpriteComponents {
material: materials.add(Color::rgb(0.2, 0.2, 0.8).into()),
material: materials.add(Color::rgb(0.5, 0.5, 1.0).into()),
transform: Transform::from_translation(Vec3::new(0.0, -215.0, 0.0)),
sprite: Sprite::new(Vec2::new(120.0, 30.0)),
..Default::default()
Expand All @@ -56,7 +56,7 @@ fn setup(
.with(Collider::Solid)
// ball
.spawn(SpriteComponents {
material: materials.add(Color::rgb(0.8, 0.2, 0.2).into()),
material: materials.add(Color::rgb(1.0, 0.5, 0.5).into()),
transform: Transform::from_translation(Vec3::new(0.0, -50.0, 1.0)),
sprite: Sprite::new(Vec2::new(30.0, 30.0)),
..Default::default()
Expand All @@ -70,7 +70,7 @@ fn setup(
font: asset_server.load("assets/fonts/FiraSans-Bold.ttf").unwrap(),
value: "Score:".to_string(),
style: TextStyle {
color: Color::rgb(0.2, 0.2, 0.8),
color: Color::rgb(0.5, 0.5, 1.0),
font_size: 40.0,
},
},
Expand All @@ -87,7 +87,7 @@ fn setup(
});

// Add walls
let wall_material = materials.add(Color::rgb(0.5, 0.5, 0.5).into());
let wall_material = materials.add(Color::rgb(0.8, 0.8, 0.8).into());
let wall_thickness = 10.0;
let bounds = Vec2::new(900.0, 600.0);

Expand Down Expand Up @@ -133,7 +133,7 @@ fn setup(
let bricks_width = brick_columns as f32 * (brick_size.x() + brick_spacing) - brick_spacing;
// center the bricks and move them up a bit
let bricks_offset = Vec3::new(-(bricks_width - brick_size.x()) / 2.0, 100.0, 0.0);

let brick_material = materials.add(Color::rgb(0.5, 0.5, 1.0).into());
for row in 0..brick_rows {
let y_position = row as f32 * (brick_size.y() + brick_spacing);
for column in 0..brick_columns {
Expand All @@ -145,7 +145,7 @@ fn setup(
commands
// brick
.spawn(SpriteComponents {
material: materials.add(Color::rgb(0.2, 0.2, 0.8).into()),
material: brick_material,
sprite: Sprite::new(brick_size),
transform: Transform::from_translation(brick_position),
..Default::default()
Expand Down
8 changes: 4 additions & 4 deletions examples/ui/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ impl FromResources for ButtonMaterials {
fn from_resources(resources: &Resources) -> Self {
let mut materials = resources.get_mut::<Assets<ColorMaterial>>().unwrap();
ButtonMaterials {
normal: materials.add(Color::rgb(0.02, 0.02, 0.02).into()),
hovered: materials.add(Color::rgb(0.05, 0.05, 0.05).into()),
pressed: materials.add(Color::rgb(0.1, 0.5, 0.1).into()),
normal: materials.add(Color::rgb(0.15, 0.15, 0.15).into()),
hovered: materials.add(Color::rgb(0.25, 0.25, 0.25).into()),
pressed: materials.add(Color::rgb(0.35, 0.75, 0.35).into()),
}
}
}
Expand Down Expand Up @@ -85,7 +85,7 @@ fn setup(
font: asset_server.load("assets/fonts/FiraSans-Bold.ttf").unwrap(),
style: TextStyle {
font_size: 40.0,
color: Color::rgb(0.8, 0.8, 0.8),
color: Color::rgb(0.9, 0.9, 0.9),
},
},
..Default::default()
Expand Down
10 changes: 5 additions & 5 deletions examples/ui/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn setup(
border: Rect::all(Val::Px(2.0)),
..Default::default()
},
material: materials.add(Color::rgb(0.4, 0.4, 0.4).into()),
material: materials.add(Color::rgb(0.65, 0.65, 0.65).into()),
..Default::default()
})
.with_children(|parent| {
Expand All @@ -47,7 +47,7 @@ fn setup(
align_items: AlignItems::FlexEnd,
..Default::default()
},
material: materials.add(Color::rgb(0.02, 0.02, 0.02).into()),
material: materials.add(Color::rgb(0.15, 0.15, 0.15).into()),
..Default::default()
})
.with_children(|parent| {
Expand Down Expand Up @@ -77,7 +77,7 @@ fn setup(
size: Size::new(Val::Px(200.0), Val::Percent(100.0)),
..Default::default()
},
material: materials.add(Color::rgb(0.02, 0.02, 0.02).into()),
material: materials.add(Color::rgb(0.15, 0.15, 0.15).into()),
..Default::default()
})
// absolute positioning
Expand All @@ -93,7 +93,7 @@ fn setup(
border: Rect::all(Val::Px(20.0)),
..Default::default()
},
material: materials.add(Color::rgb(0.1, 0.1, 1.0).into()),
material: materials.add(Color::rgb(0.4, 0.4, 1.0).into()),
..Default::default()
})
.with_children(|parent| {
Expand All @@ -102,7 +102,7 @@ fn setup(
size: Size::new(Val::Percent(100.0), Val::Percent(100.0)),
..Default::default()
},
material: materials.add(Color::rgb(0.6, 0.6, 1.0).into()),
material: materials.add(Color::rgb(0.8, 0.8, 1.0).into()),
..Default::default()
});
})
Expand Down
2 changes: 1 addition & 1 deletion examples/window/clear_color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use bevy::{prelude::*, render::pass::ClearColor};

fn main() {
App::build()
.add_resource(ClearColor(Color::rgb(0.2, 0.2, 0.8)))
.add_resource(ClearColor(Color::rgb(0.5, 0.5, 0.9)))
.add_default_plugins()
.run();
}
4 changes: 2 additions & 2 deletions examples/window/multiple_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn setup(
TextureAttachment::Input("color_attachment".to_string()),
TextureAttachment::Input("color_resolve_target".to_string()),
Operations {
load: LoadOp::Clear(Color::rgb(0.1, 0.1, 0.3)),
load: LoadOp::Clear(Color::rgb(0.5, 0.5, 0.8)),
store: true,
},
)],
Expand Down Expand Up @@ -159,7 +159,7 @@ fn setup(

// create a material for the mesh
let material_handle = materials.add(StandardMaterial {
albedo: Color::rgb(0.5, 0.4, 0.3),
albedo: Color::rgb(0.8, 0.7, 0.6),
..Default::default()
});

Expand Down

0 comments on commit 5e7c36d

Please sign in to comment.