Update default ClearColor to better match Bevy's branding (#10339)

# Objective

- Changes the default clear color to match the code block color on
Bevy's website.

## Solution

- Changed the clear color, updated text in examples to ensure adequate
contrast. Inconsistent usage of white text color set to use the default
color instead, which is already white.
- Additionally, updated the `3d_scene` example to make it look a bit
better, and use bevy's branding colors.


![image](https://github.com/bevyengine/bevy/assets/2632925/540a22c0-826c-4c33-89aa-34905e3e313a)
This commit is contained in:
Aevyrie 2023-11-03 05:57:38 -07:00 committed by GitHub
parent c376954b87
commit 1918608b02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 234 additions and 96 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
sodipodi:docname="icon.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
id="svg2321"
version="1.1"
viewBox="0 0 53.039624 53.039623"
height="53.039623mm"
width="53.039623mm"
inkscape:export-filename="/home/carter/code/cart-bevy/assets/branding/icon.png"
inkscape:export-xdpi="122.6"
inkscape:export-ydpi="122.6"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#">
<defs
id="defs2315" />
<sodipodi:namedview
fit-margin-bottom="0"
fit-margin-right="0"
fit-margin-left="0"
fit-margin-top="0"
inkscape:window-maximized="0"
inkscape:window-y="0"
inkscape:window-x="1720"
inkscape:window-height="1440"
inkscape:window-width="1720"
showgrid="false"
inkscape:document-rotation="0"
inkscape:current-layer="layer1"
inkscape:document-units="mm"
inkscape:cy="-244.96199"
inkscape:cx="-37.375644"
inkscape:zoom="0.9899495"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#ffffff"
id="base"
inkscape:pagecheckerboard="0"
inkscape:showpageshadow="2"
inkscape:deskcolor="#d1d1d1" />
<metadata
id="metadata2318">
<rdf:RDF>
<cc:Work
rdf:about="" />
</rdf:RDF>
</metadata>
<g
transform="translate(-32.430742,-116.62322)"
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1">
<g
id="g1911-8-3-9-3-2-8"
transform="translate(-517.96199,-278.01119)"
inkscape:export-filename="/home/carter/code/bevy/assets/bevy_logo_dark.png"
inkscape:export-xdpi="81.422768"
inkscape:export-ydpi="81.422768"
style="opacity:1;fill:#787878;fill-opacity:1;stroke-width:0.755906;stroke-miterlimit:4;stroke-dasharray:none">
<g
transform="matrix(-0.40426719,-0.17438247,-0.17438247,0.40426719,678.77611,389.84765)"
style="fill:#787878;fill-opacity:1"
id="g1121-3-8-8-2-8-7-1-2-8-3-9-6-0-1"
inkscape:export-filename="/home/carter/code/bevy/assets/temp_bevy_logo.png"
inkscape:export-xdpi="81.422768"
inkscape:export-ydpi="81.422768">
<path
inkscape:connector-curvature="0"
id="path819-1-94-5-3-1-9-6-4-90-0-8-9-5-8-6-1-6-2"
style="fill:#787878;fill-opacity:1;stroke:none;stroke-width:0.559814px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 2246.0312,2340.1914 v 0 c -0.016,3e-4 -0.031,0 -0.047,0 -0.9804,3.0675 -1.7386,6.3997 -1.8828,10.1953 -0.2712,7.1263 0.453,11.4639 -0.3672,16.0801 -0.8202,4.6163 -3.2453,9.161 -9.4141,16.2871 -7.3424,8.482 -18.9789,15.0453 -32.4199,17.2637 -2.5015,1.5971 -5.1421,3.0609 -7.9199,4.3633 10.4618,3.9385 21.4025,4.1531 30.0761,1.3066 15.2793,-5.0141 14.0962,-8.6155 20.9434,-19.1074 2.1569,-3.3051 4.6474,-5.8282 7.1484,-7.9004 7.1248,3.1068 14.1431,5.1015 18.5157,4.6074 2.351,-5.4505 -0.057,-11.7712 -4.0586,-17.7461 3.2821,-10.196 -1.6986,-20.4059 -12.7305,-24.0156 -2.8775,-0.9415 -5.4633,-1.3844 -7.8438,-1.3379 z m 8.2754,14.9707 a 4.1668789,4.2454995 48.679502 0 1 3.1973,1.3965 4.1668789,4.2454995 48.679502 0 1 -0.4375,5.9336 4.1668789,4.2454995 48.679502 0 1 -5.9394,-0.3262 4.1668789,4.2454995 48.679502 0 1 0.4375,-5.9336 4.1668789,4.2454995 48.679502 0 1 2.7421,-1.0703 z m -68.375,45.3789 c 0.1273,0.075 0.2572,0.1408 0.3848,0.2149 0.131,-0.049 0.2642,-0.1009 0.3945,-0.1504 -0.2598,-0.023 -0.5188,-0.039 -0.7793,-0.064 z"
transform="matrix(-0.55180403,-0.23802315,-0.23802315,0.55180403,1946.7322,-620.612)" />
</g>
</g>
<g
id="g1051-1-2-0-8-6-0-8-1-5-6-9-6-8-9"
transform="matrix(-0.45399624,0.36689705,0.36689705,0.45399624,73.527335,10.816805)"
style="opacity:1;fill:#ececec;fill-opacity:1;stroke:none;stroke-width:0.755906;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-filename="/home/carter/code/bevy/assets/bevy_logo_dark.png"
inkscape:export-xdpi="81.422768"
inkscape:export-ydpi="81.422768">
<g
id="g3029-3-9-3"
transform="matrix(-0.35254083,0.28490586,0.28490586,0.35254083,477.11004,-1021.7666)"
style="opacity:1;fill:#ececec;fill-opacity:1">
<path
inkscape:connector-curvature="0"
id="path3031-2-2-9"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#ececec;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.02362;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="m 2191.1465,2276.7832 c -5.9729,-0.035 -12.0979,2.348 -17.3613,7.459 -6.9129,6.7127 -9.0602,12.7555 -7.8477,20.2949 l 0.332,2.0684 -2.0664,-0.336 c -15.1877,-2.4609 -33.9847,-1.2178 -55.3711,7.4336 6.2868,2.6948 17.8259,7.1926 30.6309,13.3418 l 4.0605,1.9512 -4.414,0.8945 c -16.9087,3.4274 -36.9729,13.3275 -55.2989,34.9336 8.1981,-0.6372 24.9531,-2.6089 42.4278,-2.582 9.7138,0.015 19.2869,0.687 27.0859,2.709 7.7991,2.022 14.8874,6.6498 15.8861,10.0406 0.9987,3.3908 0.432,5.1761 -0.5519,7.8285 -0.9839,2.6524 -4.0098,6.6817 -8.1953,9.3418 -4.1855,2.6601 -9.4961,4.9849 -15.0137,6.9609 -11.0352,3.9521 -22.7798,6.4773 -27.9648,6.959 -1.1021,0.1024 -1.5421,0.4983 -1.9668,1.2696 -0.4247,0.7712 -0.659,1.9824 -0.6934,3.25 -0.046,1.6926 0.217,2.576 0.6949,3.246 0.4779,0.67 1.2243,0.9381 1.9934,0.9902 32.5822,2.2052 56.9441,-5.9907 74.6379,-13.0116 20.3508,-9.3311 33.2134,-27.7577 36.0058,-44.3477 1.7499,-10.395 1.3746,-15.4894 -0.3124,-19.8281 -1.6873,-4.3387 -4.9223,-8.1914 -9.0254,-15.5488 -2.6368,-4.7281 -4.1077,-9.367 -5.0196,-13.6875 l -0.1933,-0.9102 0.7265,-0.582 c 7.5403,-6.0446 13.6809,-12.6444 15.9102,-17.4492 -4.5742,-4.8648 -12.4787,-5.893 -21.3223,-4.9473 l -0.7265,0.076 -0.5118,-0.5215 c -4.7125,-4.8006 -10.5615,-7.2614 -16.5351,-7.2969 z m 2.6484,11.2324 c 2.593,-0.041 4.8808,1.7566 5.502,4.3223 0.7307,3.0216 -1.0812,6.0525 -4.0469,6.7695 -2.9656,0.7176 -5.9625,-1.1502 -6.6934,-4.1719 -0.7307,-3.0216 1.0812,-6.0525 4.0469,-6.7695 0.3902,-0.094 0.7897,-0.1445 1.1914,-0.1504 z"
transform="translate(5.0092774e-5,-757.87625)"
sodipodi:nodetypes="cccccccccccczzzcscczscccsccccccccccccccc" />
</g>
</g>
<g
style="opacity:1;fill:#b2b2b2;fill-opacity:1;stroke-width:0.755906;stroke-miterlimit:4;stroke-dasharray:none"
id="g1051-1-1-8-8-4-9-4-0-4-6-4-7-6-6-0"
transform="matrix(-0.50509374,0.06754889,0.06754889,0.50509374,156.75523,55.243465)"
inkscape:export-filename="/home/carter/code/bevy/assets/bevy_logo_dark.png"
inkscape:export-xdpi="81.422768"
inkscape:export-ydpi="81.422768">
<g
style="fill:#b2b2b2;fill-opacity:1"
id="g1129-5-9-8-0-7-2-7-3-8-61-1-6-8"
transform="translate(-20.244579,-6.1209206)">
<g
style="fill:#b2b2b2;fill-opacity:1"
id="g1344-1-3-9-3-8-8-8-3-5-4-8"
transform="translate(61.54776,-5.6726683)">
<g
id="g1121-7-7-2-3-3-7-4-5-8-2-5-9-5"
style="fill:#b2b2b2;fill-opacity:1">
<g
id="g3006-4-5-0"
transform="matrix(-0.514626,0.06882369,0.06882369,0.514626,1184.3644,-811.9091)"
style="opacity:1;fill:#b2b2b2;fill-opacity:1">
<path
inkscape:connector-curvature="0"
id="path3008-7-0-9"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#b2b2b2;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.02362;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1"
d="m 2230.8945,2301.1738 c -1.9108,-0.039 -3.9117,0.162 -5.9785,0.6328 -0.1394,0.032 -0.2613,0.071 -0.3984,0.1036 -2.274,2.2481 -4.8127,4.5047 -7.5293,6.7168 0.8746,3.8597 2.1735,7.8829 4.4707,12.0019 3.9872,7.1495 7.2742,10.9657 9.2031,15.9258 1.9289,4.9601 2.2639,10.7945 0.4746,21.4238 -2.2183,13.178 -10.2404,27.1324 -22.959,37.4336 9.8717,-2.8792 18.2866,-8.1915 23.8575,-14.6269 6.0132,-6.9464 8.0191,-10.8762 8.7226,-14.836 0.7036,-3.9598 0.044,-8.2997 0.3242,-15.664 0.1805,-4.7447 1.1911,-8.8958 2.4766,-12.545 l 0.3086,-0.875 0.9219,-0.1211 c 8.2284,-1.0673 15.6654,-3.167 19.5097,-5.6484 -1.2349,-5.5522 -6.4807,-9.8603 -13.4277,-13.1348 l -0.6621,-0.3125 -0.166,-0.7129 c -2.2034,-9.4614 -9.5905,-15.5632 -19.1485,-15.7617 z m 4.7832,11.6856 a 4.8229105,4.9139092 17.729059 0 1 1.4473,0.2246 4.8229105,4.9139092 17.729059 0 1 3.0977,6.1484 4.8229105,4.9139092 17.729059 0 1 -6.0899,3.2129 4.8229105,4.9139092 17.729059 0 1 -3.0976,-6.1484 4.8229105,4.9139092 17.729059 0 1 4.6425,-3.4375 z"
transform="translate(1.2499985e-4,-757.87627)" />
</g>
</g>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -27,8 +27,9 @@ pub enum ClearColorConfig {
#[reflect(Resource)] #[reflect(Resource)]
pub struct ClearColor(pub Color); pub struct ClearColor(pub Color);
/// Match the dark gray bevy website code block color by default.
impl Default for ClearColor { impl Default for ClearColor {
fn default() -> Self { fn default() -> Self {
Self(Color::rgb(0.4, 0.4, 0.4)) Self(Color::rgb_u8(43, 44, 47))
} }
} }

View file

@ -0,0 +1 @@
(exit_after: Some(250))

View file

@ -11,7 +11,6 @@ use bevy::{
fn main() { fn main() {
App::new() App::new()
.insert_resource(ClearColor(Color::DARK_GRAY))
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_systems(Startup, setup) .add_systems(Startup, setup)
.add_systems(Update, update_bloom_settings) .add_systems(Update, update_bloom_settings)
@ -38,7 +37,7 @@ fn setup(
// Sprite // Sprite
commands.spawn(SpriteBundle { commands.spawn(SpriteBundle {
texture: asset_server.load("branding/icon.png"), texture: asset_server.load("branding/bevy_bird_light.png"),
sprite: Sprite { sprite: Sprite {
color: Color::rgb(5.0, 5.0, 5.0), // 4. Put something bright in a dark environment to see the effect color: Color::rgb(5.0, 5.0, 5.0), // 4. Put something bright in a dark environment to see the effect
custom_size: Some(Vec2::splat(160.0)), custom_size: Some(Vec2::splat(160.0)),

View file

@ -12,7 +12,7 @@ fn main() {
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default()); commands.spawn(Camera2dBundle::default());
commands.spawn(SpriteBundle { commands.spawn(SpriteBundle {
texture: asset_server.load("branding/icon.png"), texture: asset_server.load("branding/bevy_bird_light.png"),
..default() ..default()
}); });
} }

View file

@ -12,7 +12,7 @@ fn main() {
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(Camera2dBundle::default()); commands.spawn(Camera2dBundle::default());
commands.spawn(SpriteBundle { commands.spawn(SpriteBundle {
texture: asset_server.load("branding/icon.png"), texture: asset_server.load("branding/bevy_bird_light.png"),
sprite: Sprite { sprite: Sprite {
// Flip the logo to the left // Flip the logo to the left
flip_x: true, flip_x: true,

View file

@ -15,16 +15,17 @@ fn setup(
mut meshes: ResMut<Assets<Mesh>>, mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>, mut materials: ResMut<Assets<StandardMaterial>>,
) { ) {
// plane // circular base
commands.spawn(PbrBundle { commands.spawn(PbrBundle {
mesh: meshes.add(shape::Plane::from_size(5.0).into()), mesh: meshes.add(shape::Circle::new(4.0).into()),
material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), material: materials.add(Color::WHITE.into()),
transform: Transform::from_rotation(Quat::from_rotation_x(-std::f32::consts::FRAC_PI_2)),
..default() ..default()
}); });
// cube // cube
commands.spawn(PbrBundle { commands.spawn(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })), mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()), material: materials.add(Color::rgb_u8(124, 144, 255).into()),
transform: Transform::from_xyz(0.0, 0.5, 0.0), transform: Transform::from_xyz(0.0, 0.5, 0.0),
..default() ..default()
}); });
@ -40,7 +41,7 @@ fn setup(
}); });
// camera // camera
commands.spawn(Camera3dBundle { commands.spawn(Camera3dBundle {
transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y), transform: Transform::from_xyz(-2.5, 4.5, 9.0).looking_at(Vec3::ZERO, Vec3::Y),
..default() ..default()
}); });
} }

View file

@ -263,8 +263,8 @@ fn setup(
) { ) {
// Plane // Plane
commands.spawn(PbrBundle { commands.spawn(PbrBundle {
mesh: meshes.add(shape::Plane::from_size(5.0).into()), mesh: meshes.add(shape::Plane::from_size(50.0).into()),
material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()), material: materials.add(Color::GRAY.into()),
..default() ..default()
}); });
@ -325,6 +325,18 @@ fn setup(
enabled: false, enabled: false,
..default() ..default()
}, },
EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
},
FogSettings {
color: Color::rgba_u8(43, 44, 47, 255),
falloff: FogFalloff::Linear {
start: 1.0,
end: 4.0,
},
..default()
},
)); ));
// example instructions // example instructions

View file

@ -99,7 +99,6 @@ fn setup_instructions(mut commands: Commands) {
"Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence.", "Press Spacebar to Toggle Atmospheric Fog.\nPress S to Toggle Directional Light Fog Influence.",
TextStyle { TextStyle {
font_size: 20.0, font_size: 20.0,
color: Color::WHITE,
..default() ..default()
}, },
) )

View file

@ -188,7 +188,7 @@ fn setup(
let text_style = TextStyle { let text_style = TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf"), font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 18.0, font_size: 18.0,
color: Color::BLACK, ..default()
}; };
let label_text_style = TextStyle { let label_text_style = TextStyle {

View file

@ -14,7 +14,6 @@ use std::{
fn main() { fn main() {
App::new() App::new()
.insert_resource(ClearColor(Color::DARK_GRAY))
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_systems(Startup, setup_scene) .add_systems(Startup, setup_scene)
.add_systems(Update, (update_bloom_settings, bounce_spheres)) .add_systems(Update, (update_bloom_settings, bounce_spheres))

View file

@ -52,7 +52,7 @@ fn setup(
..default() ..default()
}, },
FogSettings { FogSettings {
color: Color::rgba(0.25, 0.25, 0.25, 1.0), color: Color::rgba_u8(43, 44, 47, 255),
falloff: FogFalloff::Linear { falloff: FogFalloff::Linear {
start: 1.0, start: 1.0,
end: 8.0, end: 8.0,
@ -93,11 +93,11 @@ fn setup(
}); });
commands.spawn(SceneBundle { commands.spawn(SceneBundle {
scene: helmet_scene, scene: helmet_scene,
transform: Transform::from_xyz(-3.0, 0.0, -3.0), transform: Transform::from_xyz(-4.0, 0.0, -3.0),
..default() ..default()
}); });
let mut forward_mat: StandardMaterial = Color::rgb(0.1, 0.2, 0.1).into(); let mut forward_mat: StandardMaterial = Color::GRAY.into();
forward_mat.opaque_render_method = OpaqueRendererMethod::Forward; forward_mat.opaque_render_method = OpaqueRendererMethod::Forward;
let forward_mat_h = materials.add(forward_mat); let forward_mat_h = materials.add(forward_mat);
@ -216,7 +216,6 @@ fn setup(
"", "",
TextStyle { TextStyle {
font_size: 18.0, font_size: 18.0,
color: Color::WHITE,
..default() ..default()
}, },
) )

View file

@ -8,10 +8,6 @@ use std::f32::consts::*;
fn main() { fn main() {
App::new() App::new()
.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 1.0 / 5.0f32,
})
.insert_resource(DirectionalLightShadowMap { size: 4096 }) .insert_resource(DirectionalLightShadowMap { size: 4096 })
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_systems(Startup, setup) .add_systems(Startup, setup)

View file

@ -74,7 +74,6 @@ fn setup(
"Perceptual Roughness", "Perceptual Roughness",
TextStyle { TextStyle {
font_size: 36.0, font_size: 36.0,
color: Color::WHITE,
..default() ..default()
}, },
) )
@ -91,7 +90,6 @@ fn setup(
"Metallic", "Metallic",
TextStyle { TextStyle {
font_size: 36.0, font_size: 36.0,
color: Color::WHITE,
..default() ..default()
}, },
), ),

View file

@ -4,7 +4,6 @@ use bevy::prelude::*;
fn main() { fn main() {
App::new() App::new()
.insert_resource(ClearColor(Color::BLACK))
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_systems(Startup, setup) .add_systems(Startup, setup)
.run(); .run();

View file

@ -9,10 +9,15 @@ use rand::{rngs::StdRng, Rng, SeedableRng};
fn main() { fn main() {
App::new() App::new()
.insert_resource(AmbientLight {
brightness: 0.02,
..default()
})
.add_plugins(( .add_plugins((
DefaultPlugins, DefaultPlugins,
FrameTimeDiagnosticsPlugin, FrameTimeDiagnosticsPlugin,
LogDiagnosticsPlugin::default(), LogDiagnosticsPlugin::default(),
bevy_internal::core_pipeline::experimental::taa::TemporalAntiAliasPlugin,
)) ))
.add_systems(Startup, setup) .add_systems(Startup, setup)
.add_systems(Update, (light_sway, movement)) .add_systems(Update, (light_sway, movement))
@ -31,21 +36,14 @@ fn setup(
// ground plane // ground plane
commands.spawn(PbrBundle { commands.spawn(PbrBundle {
mesh: meshes.add(shape::Plane::from_size(100.0).into()), mesh: meshes.add(shape::Plane::from_size(100.0).into()),
material: materials.add(StandardMaterial { material: materials.add(Color::WHITE.into()),
base_color: Color::GREEN,
perceptual_roughness: 1.0,
..default()
}),
..default() ..default()
}); });
// cubes // cubes
let mut rng = StdRng::seed_from_u64(19878367467713); let mut rng = StdRng::seed_from_u64(19878367467713);
let cube_mesh = meshes.add(Mesh::from(shape::Cube { size: 0.5 })); let cube_mesh = meshes.add(Mesh::from(shape::Cube { size: 0.5 }));
let blue = materials.add(StandardMaterial { let blue = materials.add(Color::rgb_u8(124, 144, 255).into());
base_color: Color::BLUE,
..default()
});
for _ in 0..40 { for _ in 0..40 {
let x = rng.gen_range(-5.0..5.0); let x = rng.gen_range(-5.0..5.0);
let y = rng.gen_range(0.0..3.0); let y = rng.gen_range(0.0..3.0);
@ -61,12 +59,6 @@ fn setup(
)); ));
} }
// ambient light
commands.insert_resource(AmbientLight {
color: Color::rgb(0.0, 1.0, 1.0),
brightness: 0.14,
});
let sphere_mesh = meshes.add(Mesh::from(shape::UVSphere { let sphere_mesh = meshes.add(Mesh::from(shape::UVSphere {
radius: 0.05, radius: 0.05,
..default() ..default()
@ -124,10 +116,14 @@ fn setup(
} }
// camera // camera
commands.spawn(Camera3dBundle { commands.spawn((Camera3dBundle {
camera: Camera {
hdr: true,
..default()
},
transform: Transform::from_xyz(-4.0, 5.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y), transform: Transform::from_xyz(-4.0, 5.0, 10.0).looking_at(Vec3::ZERO, Vec3::Y),
..default() ..default()
}); },));
} }
fn light_sway(time: Res<Time>, mut query: Query<(&mut Transform, &mut SpotLight)>) { fn light_sway(time: Res<Time>, mut query: Query<(&mut Transform, &mut SpotLight)>) {

View file

@ -107,7 +107,7 @@ fn setup(
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf"), font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 26.0, font_size: 26.0,
color: Color::BLACK, ..default()
}, },
) )
.with_style(Style { .with_style(Style {

View file

@ -64,6 +64,14 @@ fn setup(
transform: camera_transform.0, transform: camera_transform.0,
..default() ..default()
}, },
FogSettings {
color: Color::rgba_u8(43, 44, 47, 255),
falloff: FogFalloff::Linear {
start: 1.0,
end: 8.0,
},
..default()
},
EnvironmentMapLight { EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"), diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"), specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
@ -76,7 +84,6 @@ fn setup(
"", "",
TextStyle { TextStyle {
font_size: 18.0, font_size: 18.0,
color: Color::WHITE,
..default() ..default()
}, },
) )
@ -99,15 +106,8 @@ fn setup_basic_scene(
// plane // plane
commands.spawn(( commands.spawn((
PbrBundle { PbrBundle {
mesh: meshes.add(Mesh::from(shape::Plane { mesh: meshes.add(shape::Plane::from_size(50.0).into()),
size: 5.0, material: materials.add(Color::GRAY.into()),
..default()
})),
material: materials.add(StandardMaterial {
base_color: Color::rgb(0.3, 0.5, 0.3),
perceptual_roughness: 0.5,
..default()
}),
..default() ..default()
}, },
SceneNumber(1), SceneNumber(1),

View file

@ -5,6 +5,7 @@ use bevy::prelude::*;
fn main() { fn main() {
App::new() App::new()
.insert_resource(bevy_internal::pbr::DirectionalLightShadowMap { size: 4096 })
.add_plugins(DefaultPlugins) .add_plugins(DefaultPlugins)
.add_systems(Startup, setup) .add_systems(Startup, setup)
.add_systems(Update, move_scene_entities) .add_systems(Update, move_scene_entities)
@ -15,19 +16,29 @@ fn main() {
struct MovedScene; struct MovedScene;
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
commands.spawn(PointLightBundle { commands.spawn(DirectionalLightBundle {
transform: Transform::from_xyz(4.0, 5.0, 4.0), transform: Transform::from_xyz(4.0, 25.0, 8.0).looking_at(Vec3::ZERO, Vec3::Y),
..default() directional_light: DirectionalLight {
}); shadows_enabled: true,
commands.spawn(Camera3dBundle { ..default()
transform: Transform::from_xyz(1.05, 0.9, 1.5) },
.looking_at(Vec3::new(0.0, 0.3, 0.0), Vec3::Y),
..default() ..default()
}); });
commands.spawn((
Camera3dBundle {
transform: Transform::from_xyz(-0.5, 0.9, 1.5)
.looking_at(Vec3::new(-0.5, 0.3, 0.0), Vec3::Y),
..default()
},
EnvironmentMapLight {
diffuse_map: asset_server.load("environment_maps/pisa_diffuse_rgb9e5_zstd.ktx2"),
specular_map: asset_server.load("environment_maps/pisa_specular_rgb9e5_zstd.ktx2"),
},
));
// Spawn the scene as a child of this entity at the given transform // Spawn the scene as a child of this entity at the given transform
commands.spawn(SceneBundle { commands.spawn(SceneBundle {
transform: Transform::from_xyz(0.0, 0.0, -1.0), transform: Transform::from_xyz(-1.0, 0.0, 0.0),
scene: asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"), scene: asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"),
..default() ..default()
}); });
@ -58,7 +69,7 @@ fn move_scene_entities(
0., 0.,
time.elapsed_seconds().cos() / 20., time.elapsed_seconds().cos() / 20.,
); );
offset += 1.0; offset += 0.5;
} }
} }
} }

View file

@ -149,13 +149,13 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 60.0, font_size: 60.0,
color: Color::WHITE, ..default()
}, },
), ),
TextSection::from_style(TextStyle { TextSection::from_style(TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 60.0, font_size: 60.0,
color: Color::WHITE, ..default()
}), }),
]) ])
.with_style(Style { .with_style(Style {

View file

@ -39,7 +39,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
style: TextStyle { style: TextStyle {
font: font.clone_weak(), font: font.clone_weak(),
font_size: 20.0, font_size: 20.0,
color: Color::WHITE, ..default()
}, },
}, },
TextSection { TextSection {
@ -47,7 +47,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
style: TextStyle { style: TextStyle {
font: font.clone_weak(), font: font.clone_weak(),
font_size: 30.0, font_size: 30.0,
color: Color::WHITE, ..default()
}, },
}, },
TextSection { TextSection {
@ -55,7 +55,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
style: TextStyle { style: TextStyle {
font: font.clone_weak(), font: font.clone_weak(),
font_size: 20.0, font_size: 20.0,
color: Color::WHITE, ..default()
}, },
}, },
TextSection { TextSection {
@ -63,7 +63,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
style: TextStyle { style: TextStyle {
font: font.clone_weak(), font: font.clone_weak(),
font_size: 30.0, font_size: 30.0,
color: Color::WHITE, ..default()
}, },
}, },
TextSection { TextSection {
@ -71,7 +71,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
style: TextStyle { style: TextStyle {
font: font.clone_weak(), font: font.clone_weak(),
font_size: 18.0, font_size: 18.0,
color: Color::WHITE, ..default()
}, },
}, },
TextSection { TextSection {
@ -79,7 +79,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
style: TextStyle { style: TextStyle {
font, font,
font_size: 25.0, font_size: 25.0,
color: Color::WHITE, ..default()
}, },
}, },
]) ])
@ -97,7 +97,7 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf"), font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 100.0, font_size: 100.0,
color: Color::WHITE, ..default()
}, },
), ),
..default() ..default()

View file

@ -151,7 +151,6 @@ fn infotext_system(mut commands: Commands) {
"Nothing to see in this window! Check the console output!", "Nothing to see in this window! Check the console output!",
TextStyle { TextStyle {
font_size: 50.0, font_size: 50.0,
color: Color::WHITE,
..default() ..default()
}, },
) )

View file

@ -135,7 +135,6 @@ fn setup(
let style = TextStyle { let style = TextStyle {
font_size: 18.0, font_size: 18.0,
color: Color::WHITE,
..default() ..default()
}; };

View file

@ -43,7 +43,6 @@ fn setup(mut commands: Commands) {
value: "0123456789".repeat(10_000), value: "0123456789".repeat(10_000),
style: TextStyle { style: TextStyle {
font_size: 4., font_size: 4.,
color: Color::WHITE,
..default() ..default()
}, },
}], }],

View file

@ -257,7 +257,7 @@ fn detect_morphs(
let style = TextStyle { let style = TextStyle {
font: asset_server.load("assets/fonts/FiraMono-Medium.ttf"), font: asset_server.load("assets/fonts/FiraMono-Medium.ttf"),
font_size: 13.0, font_size: 13.0,
color: Color::WHITE, ..default()
}; };
let mut sections = vec![ let mut sections = vec![
TextSection::new("Morph Target Controls\n", style.clone()), TextSection::new("Morph Target Controls\n", style.clone()),

View file

@ -76,7 +76,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let text_style = TextStyle { let text_style = TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 24.0, font_size: 24.0,
color: Color::WHITE, ..default()
}; };
commands.spawn(Camera2dBundle::default()); commands.spawn(Camera2dBundle::default());
@ -151,7 +151,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let text_style = TextStyle { let text_style = TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 20.0, font_size: 20.0,
color: Color::WHITE, ..default()
}; };
builder.spawn(TextBundle { builder.spawn(TextBundle {

View file

@ -144,7 +144,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 24.0, font_size: 24.0,
color: Color::WHITE, ..default()
}, },
)); ));
builder.spawn(TextBundle::from_section( builder.spawn(TextBundle::from_section(
@ -152,7 +152,7 @@ fn spawn_layout(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 16.0, font_size: 16.0,
color: Color::WHITE, ..default()
}, },
)); ));
builder.spawn(NodeBundle::default()); builder.spawn(NodeBundle::default());

View file

@ -17,7 +17,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let text_style = TextStyle { let text_style = TextStyle {
font: asset_server.load("fonts/FiraMono-Medium.ttf"), font: asset_server.load("fonts/FiraMono-Medium.ttf"),
font_size: 20.0, font_size: 20.0,
color: Color::WHITE, ..default()
}; };
let image = asset_server.load("branding/icon.png"); let image = asset_server.load("branding/icon.png");

View file

@ -110,7 +110,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 18.0, font_size: 18.0,
color: Color::WHITE, ..default()
}, },
)); ));
}); });
@ -185,7 +185,7 @@ fn spawn_text(
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 120.0, font_size: 120.0,
color: Color::WHITE, ..default()
}, },
)); ));
}); });

View file

@ -37,7 +37,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// This font is loaded and will be used instead of the default font. // This font is loaded and will be used instead of the default font.
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 100.0, font_size: 100.0,
color: Color::WHITE, ..default()
}, },
) // Set the alignment of the Text ) // Set the alignment of the Text
.with_text_alignment(TextAlignment::Center) .with_text_alignment(TextAlignment::Center)
@ -61,7 +61,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
// This font is loaded and will be used instead of the default font. // This font is loaded and will be used instead of the default font.
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 60.0, font_size: 60.0,
color: Color::WHITE, ..default()
}, },
), ),
TextSection::from_style(if cfg!(feature = "default_font") { TextSection::from_style(if cfg!(feature = "default_font") {

View file

@ -35,7 +35,7 @@ fn infotext_system(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: font.clone(), font: font.clone(),
font_size: 50.0, font_size: 50.0,
color: Color::WHITE, ..default()
}, },
) )
.with_style(Style { .with_style(Style {

View file

@ -46,7 +46,7 @@ fn spawn(mut commands: Commands, asset_server: Res<AssetServer>) {
let text_style = TextStyle { let text_style = TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 14.0, font_size: 14.0,
color: Color::WHITE, ..default()
}; };
let root = commands let root = commands

View file

@ -66,7 +66,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 30.0, font_size: 30.0,
color: Color::WHITE, ..default()
}, },
) )
.with_style(Style { .with_style(Style {
@ -101,7 +101,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 25., font_size: 25.,
color: Color::WHITE, ..default()
}, },
), ),
Label, Label,
@ -144,7 +144,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
font: asset_server font: asset_server
.load("fonts/FiraSans-Bold.ttf"), .load("fonts/FiraSans-Bold.ttf"),
font_size: 20., font_size: 20.,
color: Color::WHITE, ..default()
}, },
), ),
Label, Label,

View file

@ -26,7 +26,6 @@ fn setup(
commands.spawn(Camera2dBundle::default()); commands.spawn(Camera2dBundle::default());
let text_style = TextStyle { let text_style = TextStyle {
color: Color::ANTIQUE_WHITE,
font_size: 20., font_size: 20.,
..default() ..default()
}; };

View file

@ -34,7 +34,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
TextStyle { TextStyle {
font: asset_server.load("fonts/FiraSans-Bold.ttf"), font: asset_server.load("fonts/FiraSans-Bold.ttf"),
font_size: 100.0, // Nice and big so you can see it! font_size: 100.0, // Nice and big so you can see it!
color: Color::WHITE, ..default()
}, },
) )
// Set the style of the TextBundle itself. // Set the style of the TextBundle itself.

View file

@ -177,7 +177,6 @@ pub(crate) mod test_setup {
"Press spacebar to cycle modes\n", "Press spacebar to cycle modes\n",
TextStyle { TextStyle {
font_size: 50.0, font_size: 50.0,
color: Color::WHITE,
..default() ..default()
}, },
), ),

View file

@ -53,7 +53,6 @@ fn setup(mut commands: Commands) {
"Example text", "Example text",
TextStyle { TextStyle {
font_size: 30.0, font_size: 30.0,
color: Color::WHITE,
..default() ..default()
}, },
) )

View file

@ -67,7 +67,6 @@ fn setup(
"Press <spacebar> to save a screenshot to disk", "Press <spacebar> to save a screenshot to disk",
TextStyle { TextStyle {
font_size: 25.0, font_size: 25.0,
color: Color::WHITE,
..default() ..default()
}, },
) )

View file

@ -48,7 +48,6 @@ fn setup_ui(mut cmd: Commands) {
"Resolution", "Resolution",
TextStyle { TextStyle {
font_size: 50.0, font_size: 50.0,
color: Color::BLACK,
..default() ..default()
}, },
), ),