mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
Consolidate controls and display in the same UI element
This commit is contained in:
parent
7231b0c6ff
commit
3b6a8cad15
1 changed files with 32 additions and 55 deletions
|
@ -2,19 +2,19 @@
|
||||||
//!
|
//!
|
||||||
//! ## Controls
|
//! ## Controls
|
||||||
//!
|
//!
|
||||||
//! | Key Binding | Action |
|
//! | Key Binding | Action |
|
||||||
//! |:-------------------|:------------------------------------------|
|
//! |:-------------------|:-----------------------------------------------------|
|
||||||
//! | `1` / `2` | Decrease / Increase Diffuse Transmission |
|
//! | `J`/`K`/`L`/`;` | Change Screen Space Transmission Quality |
|
||||||
//! | `Q` / `W` | Decrease / Increase Specular Transmission |
|
//! | `O` / `P` | Decrease / Increase Screen Space Transmission Steps |
|
||||||
//! | `A` / `S` | Decrease / Increase Thickness |
|
//! | `1` / `2` | Decrease / Increase Diffuse Transmission |
|
||||||
//! | `Z` / `X` | Decrease / Increase IOR |
|
//! | `Q` / `W` | Decrease / Increase Specular Transmission |
|
||||||
//! | `E` / `R` | Decrease / Increase Perceptual Roughness |
|
//! | `A` / `S` | Decrease / Increase Thickness |
|
||||||
//! | Arrow Keys | Control Camera |
|
//! | `Z` / `X` | Decrease / Increase IOR |
|
||||||
//! | `O` / `P` | Decrease / Increase Transmission Steps |
|
//! | `E` / `R` | Decrease / Increase Perceptual Roughness |
|
||||||
//! | `J`/`K`/`L`/`;` | Transmissive Quality |
|
//! | Arrow Keys | Control Camera |
|
||||||
//! | `H` | Toggle HDR |
|
//! | `C` | Randomize Colors |
|
||||||
//! | `D` | Toggle Depth Prepass (Also disables TAA) |
|
//! | `H` | Toggle HDR |
|
||||||
//! | `C` | Randomize Colors |
|
//! | `D` | Toggle Depth Prepass (Also disables TAA) |
|
||||||
|
|
||||||
use std::f32::consts::PI;
|
use std::f32::consts::PI;
|
||||||
|
|
||||||
|
@ -371,36 +371,11 @@ fn setup(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
commands.spawn(
|
|
||||||
TextBundle::from_section(
|
|
||||||
concat!(
|
|
||||||
"1 / 2 - Decrease / Increase Diffuse Transmission\n",
|
|
||||||
"Q / W - Decrease / Increase Transmission\n",
|
|
||||||
"A / S - Decrease / Increase Thickness\n",
|
|
||||||
"Z / X - Decrease / Increase IOR\n",
|
|
||||||
"E / R - Decrease / Increase Perceptual Roughness\n",
|
|
||||||
"Arrow Keys - Control Camera\n",
|
|
||||||
"O / P - Decrease / Increase Transmission Steps\n",
|
|
||||||
"J / K / L / ; - Transmissive Quality\n",
|
|
||||||
"H - Toggle HDR\n",
|
|
||||||
"D - Toggle Depth Prepass (Also disables TAA)\n",
|
|
||||||
"C - Randomize Colors",
|
|
||||||
),
|
|
||||||
text_style.clone(),
|
|
||||||
)
|
|
||||||
.with_style(Style {
|
|
||||||
position_type: PositionType::Absolute,
|
|
||||||
top: Val::Px(10.0),
|
|
||||||
left: Val::Px(10.0),
|
|
||||||
..default()
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
commands.spawn((
|
commands.spawn((
|
||||||
TextBundle::from_section("", text_style).with_style(Style {
|
TextBundle::from_section("", text_style).with_style(Style {
|
||||||
position_type: PositionType::Absolute,
|
position_type: PositionType::Absolute,
|
||||||
top: Val::Px(10.0),
|
top: Val::Px(10.0),
|
||||||
right: Val::Px(10.0),
|
left: Val::Px(10.0),
|
||||||
..default()
|
..default()
|
||||||
}),
|
}),
|
||||||
ExampleDisplay,
|
ExampleDisplay,
|
||||||
|
@ -584,16 +559,25 @@ fn example_control_system(
|
||||||
let mut display = display.single_mut();
|
let mut display = display.single_mut();
|
||||||
display.sections[0].value = format!(
|
display.sections[0].value = format!(
|
||||||
concat!(
|
concat!(
|
||||||
"HDR: {}\n",
|
" J / K / L / ; Screen Space Specular Transmissive Quality: {:?}\n",
|
||||||
"Depth Prepass+TAA: {}\n",
|
" O / P Screen Space Specular Transmissive Steps: {}\n",
|
||||||
"Diffuse Transmission: {:.2}\n",
|
" 1 / 2 Diffuse Transmission: {:.2}\n",
|
||||||
"Transmission: {:.2}\n",
|
" Q / W Specular Transmission: {:.2}\n",
|
||||||
"Thickness: {:.2}\n",
|
" A / S Thickness: {:.2}\n",
|
||||||
"IOR: {:.2}\n",
|
" Z / X IOR: {:.2}\n",
|
||||||
"Perceptual Roughness: {:.2}\n",
|
" E / R Perceptual Roughness: {:.2}\n",
|
||||||
"Transmissive Steps: {}\n",
|
" Arrow Keys Control Camera\n",
|
||||||
"Transmissive Quality: {:?}\n",
|
" C Randomize Colors\n",
|
||||||
|
" H HDR: {}\n",
|
||||||
|
" D Depth Prepass+TAA: {}\n",
|
||||||
),
|
),
|
||||||
|
camera_3d.screen_space_specular_transmission_quality,
|
||||||
|
camera_3d.screen_space_specular_transmission_steps,
|
||||||
|
state.diffuse_transmission,
|
||||||
|
state.specular_transmission,
|
||||||
|
state.thickness,
|
||||||
|
state.ior,
|
||||||
|
state.perceptual_roughness,
|
||||||
if camera.hdr { "ON " } else { "OFF" },
|
if camera.hdr { "ON " } else { "OFF" },
|
||||||
if cfg!(any(not(feature = "webgl2"), not(target_arch = "wasm32"))) {
|
if cfg!(any(not(feature = "webgl2"), not(target_arch = "wasm32"))) {
|
||||||
if depth_prepass.is_some() {
|
if depth_prepass.is_some() {
|
||||||
|
@ -604,13 +588,6 @@ fn example_control_system(
|
||||||
} else {
|
} else {
|
||||||
"N/A"
|
"N/A"
|
||||||
},
|
},
|
||||||
state.diffuse_transmission,
|
|
||||||
state.specular_transmission,
|
|
||||||
state.thickness,
|
|
||||||
state.ior,
|
|
||||||
state.perceptual_roughness,
|
|
||||||
camera_3d.screen_space_specular_transmission_steps,
|
|
||||||
camera_3d.screen_space_specular_transmission_quality,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue