fix keyboard scaling, fix openvr spawn
This commit is contained in:
@@ -63,7 +63,6 @@ impl LinePool {
|
||||
state: OverlayState {
|
||||
name: Arc::from(format!("wlx-line{}", id)),
|
||||
show_hide: true,
|
||||
spawn_scale: 0.002,
|
||||
size: (0, 0),
|
||||
..Default::default()
|
||||
},
|
||||
@@ -73,6 +72,10 @@ impl LinePool {
|
||||
}),
|
||||
..Default::default()
|
||||
}),
|
||||
data: OpenVrOverlayData {
|
||||
width: 0.002,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
data.data.sort_order = 69;
|
||||
|
||||
@@ -12,16 +12,15 @@ use crate::{
|
||||
state::AppState,
|
||||
};
|
||||
|
||||
const WIDTH: f32 = 1.0;
|
||||
|
||||
#[derive(Default)]
|
||||
pub(super) struct OpenVrOverlayData {
|
||||
handle: Option<OverlayHandle>,
|
||||
last_image: Option<u64>,
|
||||
pub(super) handle: Option<OverlayHandle>,
|
||||
pub(super) last_image: Option<u64>,
|
||||
pub(super) visible: bool,
|
||||
pub(super) color: Vec4,
|
||||
pub(super) curvature: f32,
|
||||
pub(super) sort_order: u32,
|
||||
pub(crate) width: f32,
|
||||
pub(super) relative_to: RelativeTo,
|
||||
}
|
||||
|
||||
@@ -49,6 +48,11 @@ impl OverlayData<OpenVrOverlayData> {
|
||||
self.data.color = Vec4::ONE;
|
||||
|
||||
self.init(app);
|
||||
self.upload_transform(overlay);
|
||||
|
||||
if self.data.width < f32::EPSILON {
|
||||
self.data.width = 1.0;
|
||||
}
|
||||
|
||||
self.upload_width(overlay);
|
||||
self.upload_color(overlay);
|
||||
@@ -125,7 +129,7 @@ impl OverlayData<OpenVrOverlayData> {
|
||||
log::debug!("{}: No overlay handle", self.state.name);
|
||||
return;
|
||||
};
|
||||
if let Err(e) = overlay.set_width(handle, WIDTH) {
|
||||
if let Err(e) = overlay.set_width(handle, self.data.width) {
|
||||
panic!("Failed to set overlay width: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,16 +98,14 @@ impl OverlayState {
|
||||
}
|
||||
}
|
||||
pub fn reset(&mut self, app: &mut AppState) {
|
||||
if let RelativeTo::None = self.relative_to {
|
||||
let translation = app.input_state.hmd.transform_point3a(self.spawn_point);
|
||||
self.transform = Affine3A::from_scale_rotation_translation(
|
||||
Vec3::ONE * self.spawn_scale,
|
||||
Quat::IDENTITY,
|
||||
translation.into(),
|
||||
);
|
||||
let translation = app.input_state.hmd.transform_point3a(self.spawn_point);
|
||||
self.transform = Affine3A::from_scale_rotation_translation(
|
||||
Vec3::ONE * self.spawn_scale,
|
||||
Quat::IDENTITY,
|
||||
translation.into(),
|
||||
);
|
||||
|
||||
self.realign(&app.input_state.hmd);
|
||||
}
|
||||
self.realign(&app.input_state.hmd);
|
||||
}
|
||||
pub fn realign(&mut self, hmd: &Affine3A) {
|
||||
let to_hmd = hmd.translation - self.transform.translation;
|
||||
|
||||
Reference in New Issue
Block a user