feat(main): disable hands/controllers args
This commit is contained in:
14
src/main.rs
14
src/main.rs
@@ -43,6 +43,13 @@ struct CliArgs {
|
|||||||
#[clap(short, long, action)]
|
#[clap(short, long, action)]
|
||||||
flatscreen: bool,
|
flatscreen: bool,
|
||||||
|
|
||||||
|
/// If monado insists on emulating them, set this flag...we want the raw input
|
||||||
|
#[clap(long)]
|
||||||
|
disable_controllers: bool,
|
||||||
|
/// If monado insists on emulating , set this flag...we want the raw input
|
||||||
|
#[clap(long)]
|
||||||
|
disable_hands: bool,
|
||||||
|
|
||||||
/// Run Stardust XR as an overlay with given priority
|
/// Run Stardust XR as an overlay with given priority
|
||||||
#[clap(id = "PRIORITY", short = 'o', long = "overlay", action)]
|
#[clap(id = "PRIORITY", short = 'o', long = "overlay", action)]
|
||||||
overlay_priority: Option<u32>,
|
overlay_priority: Option<u32>,
|
||||||
@@ -216,7 +223,12 @@ fn stereokit_loop(
|
|||||||
sk_ready_notifier.notify_waiters();
|
sk_ready_notifier.notify_waiters();
|
||||||
info!("Stardust ready!");
|
info!("Stardust ready!");
|
||||||
|
|
||||||
let mut objects = ServerObjects::new(dbus_connection.clone(), &sk);
|
let mut objects = ServerObjects::new(
|
||||||
|
dbus_connection.clone(),
|
||||||
|
&sk,
|
||||||
|
args.disable_controllers,
|
||||||
|
args.disable_hands,
|
||||||
|
);
|
||||||
|
|
||||||
let mut last_frame_delta = Duration::ZERO;
|
let mut last_frame_delta = Duration::ZERO;
|
||||||
let mut sleep_duration = Duration::ZERO;
|
let mut sleep_duration = Duration::ZERO;
|
||||||
|
|||||||
@@ -46,9 +46,16 @@ pub struct ServerObjects {
|
|||||||
hmd: (Arc<Spatial>, ObjectHandle<SpatialRef>),
|
hmd: (Arc<Spatial>, ObjectHandle<SpatialRef>),
|
||||||
play_space: Option<(Arc<Spatial>, ObjectHandle<SpatialRef>)>,
|
play_space: Option<(Arc<Spatial>, ObjectHandle<SpatialRef>)>,
|
||||||
inputs: Inputs,
|
inputs: Inputs,
|
||||||
|
disable_controllers: bool,
|
||||||
|
disable_hands: bool,
|
||||||
}
|
}
|
||||||
impl ServerObjects {
|
impl ServerObjects {
|
||||||
pub fn new(connection: Connection, sk: &Sk) -> ServerObjects {
|
pub fn new(
|
||||||
|
connection: Connection,
|
||||||
|
sk: &Sk,
|
||||||
|
disable_controllers: bool,
|
||||||
|
disable_hands: bool,
|
||||||
|
) -> ServerObjects {
|
||||||
let hmd = SpatialRef::create(&connection, "/org/stardustxr/HMD");
|
let hmd = SpatialRef::create(&connection, "/org/stardustxr/HMD");
|
||||||
|
|
||||||
let play_space = (World::has_bounds()
|
let play_space = (World::has_bounds()
|
||||||
@@ -100,6 +107,8 @@ impl ServerObjects {
|
|||||||
hmd,
|
hmd,
|
||||||
play_space,
|
play_space,
|
||||||
inputs,
|
inputs,
|
||||||
|
disable_controllers,
|
||||||
|
disable_hands,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,10 +158,14 @@ impl ServerObjects {
|
|||||||
hand_right,
|
hand_right,
|
||||||
eye_pointer,
|
eye_pointer,
|
||||||
} => {
|
} => {
|
||||||
controller_left.update(token);
|
if !self.disable_controllers {
|
||||||
controller_right.update(token);
|
controller_left.update(token);
|
||||||
hand_left.update(sk, token);
|
controller_right.update(token);
|
||||||
hand_right.update(sk, token);
|
}
|
||||||
|
if !self.disable_hands {
|
||||||
|
hand_left.update(sk, token);
|
||||||
|
hand_right.update(sk, token);
|
||||||
|
}
|
||||||
if let Some(eye_pointer) = eye_pointer {
|
if let Some(eye_pointer) = eye_pointer {
|
||||||
eye_pointer.update();
|
eye_pointer.update();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user