openvr watch
This commit is contained in:
@@ -304,7 +304,7 @@ where
|
|||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
log::trace!("Hit: {} {:?}", hovered.state.name, hit);
|
log::trace!("Hit: {} {:?}", hovered.state.name, hit);
|
||||||
|
|
||||||
if pointer.now.grab && !pointer.before.grab {
|
if pointer.now.grab && !pointer.before.grab && hovered.state.grabbable {
|
||||||
pointer.start_grab(hovered);
|
pointer.start_grab(hovered);
|
||||||
return hit.dist;
|
return hit.dist;
|
||||||
}
|
}
|
||||||
@@ -346,6 +346,9 @@ impl Pointer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(hit) = self.ray_test(overlay.state.id, &overlay.state.transform) {
|
if let Some(hit) = self.ray_test(overlay.state.id, &overlay.state.transform) {
|
||||||
|
if hit.dist.is_infinite() || hit.dist.is_nan() {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
hits.try_push(hit);
|
hits.try_push(hit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ impl OverlayData<OpenVrOverlayData> {
|
|||||||
self.data.color = Vec4::ONE;
|
self.data.color = Vec4::ONE;
|
||||||
|
|
||||||
self.init(app);
|
self.init(app);
|
||||||
self.upload_transform(overlay);
|
|
||||||
|
|
||||||
if self.data.width < f32::EPSILON {
|
if self.data.width < f32::EPSILON {
|
||||||
self.data.width = 1.0;
|
self.data.width = 1.0;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ impl Default for OverlayState {
|
|||||||
want_visible: false,
|
want_visible: false,
|
||||||
show_hide: false,
|
show_hide: false,
|
||||||
grabbable: false,
|
grabbable: false,
|
||||||
dirty: false,
|
dirty: true,
|
||||||
relative_to: RelativeTo::None,
|
relative_to: RelativeTo::None,
|
||||||
spawn_scale: 1.0,
|
spawn_scale: 1.0,
|
||||||
spawn_point: Vec3A::NEG_Z,
|
spawn_point: Vec3A::NEG_Z,
|
||||||
@@ -95,6 +95,7 @@ impl OverlayState {
|
|||||||
self.spawn_rotation,
|
self.spawn_rotation,
|
||||||
self.spawn_point.into(),
|
self.spawn_point.into(),
|
||||||
);
|
);
|
||||||
|
self.dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pub fn reset(&mut self, app: &mut AppState) {
|
pub fn reset(&mut self, app: &mut AppState) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use std::{sync::Arc, time::Instant};
|
use std::{sync::Arc, time::Instant};
|
||||||
|
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
|
use glam::{vec2, Affine2};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
backend::{
|
backend::{
|
||||||
@@ -158,6 +159,8 @@ where
|
|||||||
});
|
});
|
||||||
button_x += button_width;
|
button_x += button_width;
|
||||||
}
|
}
|
||||||
|
let interaction_transform =
|
||||||
|
Affine2::from_translation(vec2(0.5, 0.5)) * Affine2::from_scale(vec2(1., -2.0));
|
||||||
|
|
||||||
let relative_to = RelativeTo::Hand(state.session.watch_hand);
|
let relative_to = RelativeTo::Hand(state.session.watch_hand);
|
||||||
|
|
||||||
@@ -169,6 +172,7 @@ where
|
|||||||
spawn_scale: 0.065,
|
spawn_scale: 0.065,
|
||||||
spawn_point: state.session.watch_pos.into(),
|
spawn_point: state.session.watch_pos.into(),
|
||||||
spawn_rotation: state.session.watch_rot,
|
spawn_rotation: state.session.watch_rot,
|
||||||
|
interaction_transform,
|
||||||
relative_to,
|
relative_to,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ use crate::{
|
|||||||
shaders::{frag_color, frag_glyph, frag_screen, frag_sprite, frag_srgb, vert_common},
|
shaders::{frag_color, frag_glyph, frag_screen, frag_sprite, frag_srgb, vert_common},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const WATCH_DEFAULT_POS: Vec3 = Vec3::new(0., 0., 0.15);
|
pub const WATCH_DEFAULT_POS: Vec3 = Vec3::new(0.025, 0., 0.15);
|
||||||
pub const WATCH_DEFAULT_ROT: Quat = Quat::from_xyzw(0.7071066, 0., 0.7071066, 0.0007963);
|
pub const WATCH_DEFAULT_ROT: Quat = Quat::from_xyzw(0.7071066, 0., 0.7071066, 0.0007963);
|
||||||
|
|
||||||
pub struct AppState {
|
pub struct AppState {
|
||||||
@@ -127,7 +127,7 @@ impl AppSession {
|
|||||||
screen_max_res: [2560, 1440],
|
screen_max_res: [2560, 1440],
|
||||||
capture_method: "auto".to_string(),
|
capture_method: "auto".to_string(),
|
||||||
primary_hand: 1,
|
primary_hand: 1,
|
||||||
watch_hand: 1,
|
watch_hand: 0,
|
||||||
watch_pos: WATCH_DEFAULT_POS,
|
watch_pos: WATCH_DEFAULT_POS,
|
||||||
watch_rot: WATCH_DEFAULT_ROT,
|
watch_rot: WATCH_DEFAULT_ROT,
|
||||||
color_norm: Vec3 {
|
color_norm: Vec3 {
|
||||||
|
|||||||
Reference in New Issue
Block a user