openxr: click/grab/altclick sensitivity option
This commit is contained in:
@@ -5,7 +5,7 @@ use openxr as xr;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::input::{Haptics, Pointer},
|
backend::input::{Haptics, Pointer},
|
||||||
state::AppState,
|
state::{AppSession, AppState},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::XrState;
|
use super::XrState;
|
||||||
@@ -98,12 +98,7 @@ impl OpenXrInputSource {
|
|||||||
xr.session.sync_actions(&[(&self.action_set).into()])?;
|
xr.session.sync_actions(&[(&self.action_set).into()])?;
|
||||||
|
|
||||||
for i in 0..2 {
|
for i in 0..2 {
|
||||||
self.hands[i].update(
|
self.hands[i].update(&mut state.input_state.pointers[i], xr, &state.session)?;
|
||||||
&mut state.input_state.pointers[i],
|
|
||||||
&xr.stage,
|
|
||||||
&xr.session,
|
|
||||||
xr.predicted_display_time,
|
|
||||||
)?;
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -123,11 +118,10 @@ impl OpenXrHand {
|
|||||||
pub(super) fn update(
|
pub(super) fn update(
|
||||||
&self,
|
&self,
|
||||||
pointer: &mut Pointer,
|
pointer: &mut Pointer,
|
||||||
stage: &xr::Space,
|
xr: &XrState,
|
||||||
session: &XrSession,
|
session: &AppSession,
|
||||||
time: xr::Time,
|
|
||||||
) -> Result<(), xr::sys::Result> {
|
) -> Result<(), xr::sys::Result> {
|
||||||
let location = self.space.locate(stage, time)?;
|
let location = self.space.locate(&xr.stage, xr.predicted_display_time)?;
|
||||||
if location
|
if location
|
||||||
.location_flags
|
.location_flags
|
||||||
.contains(xr::SpaceLocationFlags::ORIENTATION_VALID)
|
.contains(xr::SpaceLocationFlags::ORIENTATION_VALID)
|
||||||
@@ -140,46 +134,46 @@ impl OpenXrHand {
|
|||||||
pointer.now.click = self
|
pointer.now.click = self
|
||||||
.source
|
.source
|
||||||
.action_click
|
.action_click
|
||||||
.state(session, xr::Path::NULL)?
|
.state(&xr.session, xr::Path::NULL)?
|
||||||
.current_state
|
.current_state
|
||||||
> 0.7;
|
> session.config.xr_click_sensitivity;
|
||||||
|
|
||||||
pointer.now.grab = self
|
pointer.now.grab = self
|
||||||
.source
|
.source
|
||||||
.action_grab
|
.action_grab
|
||||||
.state(session, xr::Path::NULL)?
|
.state(&xr.session, xr::Path::NULL)?
|
||||||
.current_state
|
.current_state
|
||||||
> 0.7;
|
> session.config.xr_grab_sensitivity;
|
||||||
|
|
||||||
pointer.now.scroll = self
|
pointer.now.scroll = self
|
||||||
.source
|
.source
|
||||||
.action_scroll
|
.action_scroll
|
||||||
.state(session, xr::Path::NULL)?
|
.state(&xr.session, xr::Path::NULL)?
|
||||||
.current_state;
|
.current_state;
|
||||||
|
|
||||||
pointer.now.alt_click = self
|
pointer.now.alt_click = self
|
||||||
.source
|
.source
|
||||||
.action_alt_click
|
.action_alt_click
|
||||||
.state(session, xr::Path::NULL)?
|
.state(&xr.session, xr::Path::NULL)?
|
||||||
.current_state
|
.current_state
|
||||||
> 0.7;
|
> session.config.xr_alt_click_sensitivity;
|
||||||
|
|
||||||
pointer.now.show_hide = self
|
pointer.now.show_hide = self
|
||||||
.source
|
.source
|
||||||
.action_show_hide
|
.action_show_hide
|
||||||
.state(session, xr::Path::NULL)?
|
.state(&xr.session, xr::Path::NULL)?
|
||||||
.current_state;
|
.current_state;
|
||||||
|
|
||||||
pointer.now.click_modifier_right = self
|
pointer.now.click_modifier_right = self
|
||||||
.source
|
.source
|
||||||
.action_click_modifier_right
|
.action_click_modifier_right
|
||||||
.state(session, xr::Path::NULL)?
|
.state(&xr.session, xr::Path::NULL)?
|
||||||
.current_state;
|
.current_state;
|
||||||
|
|
||||||
pointer.now.click_modifier_middle = self
|
pointer.now.click_modifier_middle = self
|
||||||
.source
|
.source
|
||||||
.action_click_modifier_middle
|
.action_click_modifier_middle
|
||||||
.state(session, xr::Path::NULL)?
|
.state(&xr.session, xr::Path::NULL)?
|
||||||
.current_state;
|
.current_state;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -117,6 +117,15 @@ pub struct GeneralConfig {
|
|||||||
|
|
||||||
#[serde(default = "def_auto")]
|
#[serde(default = "def_auto")]
|
||||||
pub capture_method: Arc<str>,
|
pub capture_method: Arc<str>,
|
||||||
|
|
||||||
|
#[serde(default = "def_point7")]
|
||||||
|
pub xr_grab_sensitivity: f32,
|
||||||
|
|
||||||
|
#[serde(default = "def_point7")]
|
||||||
|
pub xr_click_sensitivity: f32,
|
||||||
|
|
||||||
|
#[serde(default = "def_point7")]
|
||||||
|
pub xr_alt_click_sensitivity: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GeneralConfig {
|
impl GeneralConfig {
|
||||||
|
|||||||
Reference in New Issue
Block a user