mirror of https://github.com/wayvr-org/wayvr.git
Merge pull request #450 from openglfreak/feat-grid-opacity
add option for grid opacity
This commit is contained in:
commit
de6047107e
|
|
@ -107,6 +107,8 @@
|
|||
"USE_PASSTHROUGH_HELP": "Allow passthrough if the XR runtime supports it",
|
||||
"USE_SKYBOX": "Enable skybox",
|
||||
"USE_SKYBOX_HELP": "Show a skybox if there's no scene app or passthrough",
|
||||
"GRID_OPACITY": "Skybox grid opacity",
|
||||
"GRID_OPACITY_HELP": "Opacity of the floor grid when the skybox is enabled",
|
||||
"XR_CLICK_SENSITIVITY": "XR click sensitivity",
|
||||
"XR_CLICK_SENSITIVITY_HELP": "Analog trigger sensitivity",
|
||||
"XR_CLICK_SENSITIVITY_RELEASE": "XR release sensitivity",
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ enum SettingType {
|
|||
UprightScreenFix,
|
||||
UsePassthrough,
|
||||
UseSkybox,
|
||||
GridOpacity,
|
||||
XrClickSensitivity,
|
||||
XrClickSensitivityRelease,
|
||||
XwaylandByDefault,
|
||||
|
|
@ -294,6 +295,7 @@ impl SettingType {
|
|||
Self::XrClickSensitivityRelease => &mut config.xr_click_sensitivity_release,
|
||||
Self::SpaceDragMultiplier => &mut config.space_drag_multiplier,
|
||||
Self::PointerLerpFactor => &mut config.pointer_lerp_factor,
|
||||
Self::GridOpacity => &mut config.grid_opacity,
|
||||
_ => panic!("Requested f32 for non-f32 SettingType"),
|
||||
}
|
||||
}
|
||||
|
|
@ -368,6 +370,7 @@ impl SettingType {
|
|||
Self::Clock12h => Ok("APP_SETTINGS.CLOCK_12H"),
|
||||
Self::DoubleCursorFix => Ok("APP_SETTINGS.DOUBLE_CURSOR_FIX"),
|
||||
Self::FocusFollowsMouseMode => Ok("APP_SETTINGS.FOCUS_FOLLOWS_MOUSE_MODE"),
|
||||
Self::GridOpacity => Ok("APP_SETTINGS.GRID_OPACITY"),
|
||||
Self::HandsfreePointer => Ok("APP_SETTINGS.HANDSFREE_POINTER"),
|
||||
Self::HideGrabHelp => Ok("APP_SETTINGS.HIDE_GRAB_HELP"),
|
||||
Self::HideUsername => Ok("APP_SETTINGS.HIDE_USERNAME"),
|
||||
|
|
@ -408,6 +411,7 @@ impl SettingType {
|
|||
Self::BlockPosesOnKbdInteraction => Some("APP_SETTINGS.BLOCK_POSES_ON_KBD_INTERACTION_HELP"),
|
||||
Self::CaptureMethod => Some("APP_SETTINGS.CAPTURE_METHOD_HELP"),
|
||||
Self::DoubleCursorFix => Some("APP_SETTINGS.DOUBLE_CURSOR_FIX_HELP"),
|
||||
Self::GridOpacity => Some("APP_SETTINGS.GRID_OPACITY_HELP"),
|
||||
Self::HandsfreePointer => Some("APP_SETTINGS.HANDSFREE_POINTER_HELP"),
|
||||
Self::KeyboardMiddleClick => Some("APP_SETTINGS.KEYBOARD_MIDDLE_CLICK_HELP"),
|
||||
Self::LeftHandedMouse => Some("APP_SETTINGS.LEFT_HANDED_MOUSE_HELP"),
|
||||
|
|
@ -795,6 +799,7 @@ impl<T> TabSettings<T> {
|
|||
slider_f32!(mp, c, SettingType::UiRoundMultiplier, 0.5, 5.0, 0.1);
|
||||
checkbox!(mp, c, SettingType::SetsOnWatch);
|
||||
checkbox!(mp, c, SettingType::UseSkybox);
|
||||
slider_f32!(mp, c, SettingType::GridOpacity, 0.0, 1.0, 0.05); // min, max, step
|
||||
checkbox!(mp, c, SettingType::UsePassthrough);
|
||||
checkbox!(mp, c, SettingType::Clock12h);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,13 +161,17 @@ impl Skybox {
|
|||
.into_iter()
|
||||
.next()
|
||||
.unwrap();
|
||||
let set0 = pipeline.uniform_buffer_upload(
|
||||
0,
|
||||
vec![app.session.config.grid_opacity * app.session.config.grid_opacity],
|
||||
)?;
|
||||
let pass = pipeline.create_pass(
|
||||
tgt.extent_f32(),
|
||||
[0.0, 0.0],
|
||||
app.gfx_extras.quad_verts.clone(),
|
||||
0..4,
|
||||
0..1,
|
||||
vec![],
|
||||
vec![set0],
|
||||
&Default::default(),
|
||||
)?;
|
||||
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@ pub struct AutoSettings {
|
|||
pub block_poses_on_kbd_interaction: bool,
|
||||
pub space_drag_multiplier: f32,
|
||||
pub use_skybox: bool,
|
||||
pub grid_opacity: f32,
|
||||
pub use_passthrough: bool,
|
||||
pub screen_render_down: bool,
|
||||
pub pointer_lerp_factor: f32,
|
||||
|
|
@ -180,6 +181,7 @@ pub fn save_settings(config: &GeneralConfig) -> anyhow::Result<()> {
|
|||
block_poses_on_kbd_interaction: config.block_poses_on_kbd_interaction,
|
||||
space_drag_multiplier: config.space_drag_multiplier,
|
||||
use_skybox: config.use_skybox,
|
||||
grid_opacity: config.grid_opacity,
|
||||
use_passthrough: config.use_passthrough,
|
||||
screen_render_down: config.screen_render_down,
|
||||
pointer_lerp_factor: config.pointer_lerp_factor,
|
||||
|
|
|
|||
|
|
@ -125,6 +125,9 @@
|
|||
## If disabled, there will be no background rendered (solid black).
|
||||
#use_skybox: true
|
||||
|
||||
## Monado/WiVRn only. Opacity of the floor grid if use_skybox is enabled.
|
||||
#grid_opacity: true
|
||||
|
||||
## Hide the help popup that appears on your hand while grabbing an overlay
|
||||
#hide_grab_help: false
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ precision highp float;
|
|||
layout (location = 0) in vec2 in_uv;
|
||||
layout (location = 0) out vec4 out_color;
|
||||
|
||||
layout (set = 0, binding = 0) uniform OpacityBlock {
|
||||
uniform float opacity;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
float fade = max(1.0 - 2.0 * length(in_uv.xy + vec2(-0.5, -0.5)), 0.0);
|
||||
|
|
@ -14,6 +18,6 @@ void main()
|
|||
} else {
|
||||
grid = 0.0;
|
||||
}
|
||||
out_color = vec4(1.0, 1.0, 1.0, grid * fade);
|
||||
out_color = vec4(1.0, 1.0, 1.0, grid * fade * opacity);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -324,4 +324,7 @@ pub struct GeneralConfig {
|
|||
|
||||
#[serde(default)]
|
||||
pub handsfree_pointer: HandsfreePointer,
|
||||
|
||||
#[serde(default = "def_one")]
|
||||
pub grid_opacity: f32,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue