sorry about monster commit

This commit is contained in:
galister
2025-09-20 15:28:23 +09:00
parent c6a32f4109
commit cfb733de09
32 changed files with 1208 additions and 289 deletions

View File

@@ -12,9 +12,9 @@ use crate::{
config::AStrSetExt,
overlays::{
anchor::create_anchor,
keyboard::{KEYBOARD_NAME, builder::create_keyboard},
keyboard::{builder::create_keyboard, KEYBOARD_NAME},
screen::create_screens,
watch::{WATCH_NAME, create_watch},
watch::{create_watch, WATCH_NAME},
},
state::AppState,
};
@@ -61,19 +61,19 @@ where
if let Some((_, s, _)) = data.screens.first() {
show_screens.arc_set(s.name.clone());
}
for (meta, mut state, backend) in data.screens {
if show_screens.arc_get(state.name.as_ref()) {
state.show_hide = true;
}
overlays.insert(
state.id.0,
OverlayData::<T> {
state,
..OverlayData::from_backend(backend)
},
);
app.screens.push(meta);
}
for (meta, mut state, backend) in data.screens {
if show_screens.arc_get(state.name.as_ref()) {
state.show_hide = true;
}
overlays.insert(
state.id.0,
OverlayData::<T> {
state,
..OverlayData::from_backend(backend)
},
);
app.screens.push(meta);
}
maybe_keymap = keymap;

View File

@@ -11,5 +11,6 @@ pub mod openxr;
pub mod wayvr;
pub mod overlay;
pub mod set;
pub mod task;

View File

@@ -2,18 +2,18 @@ use std::{
collections::VecDeque,
ops::Add,
sync::{
Arc,
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc,
},
time::{Duration, Instant},
};
use anyhow::{Result, anyhow};
use anyhow::{anyhow, Result};
use ovr_overlay::{
TrackedDeviceIndex,
sys::{ETrackedDeviceProperty, EVRApplicationType, EVREventType},
TrackedDeviceIndex,
};
use vulkano::{Handle, VulkanObject, device::physical::PhysicalDevice};
use vulkano::{device::physical::PhysicalDevice, Handle, VulkanObject};
use crate::{
backend::{
@@ -21,7 +21,7 @@ use crate::{
input::interact,
openvr::{
helpers::adjust_gain,
input::{OpenVrInputSource, set_action_manifest},
input::{set_action_manifest, OpenVrInputSource},
lines::LinePool,
manifest::{install_manifest, uninstall_manifest},
overlay::OpenVrOverlayData,
@@ -29,10 +29,10 @@ use crate::{
overlay::{OverlayData, ShouldRender},
task::{SystemTask, TaskType},
},
graphics::{CommandBuffers, init_openvr_graphics},
graphics::{init_openvr_graphics, CommandBuffers},
overlays::{
toast::{Toast, ToastTopic},
watch::{WATCH_NAME, watch_fade},
watch::{watch_fade, WATCH_NAME},
},
state::AppState,
subsystem::notifications::NotificationManager,
@@ -110,8 +110,8 @@ pub fn openvr_run(
TrackedDeviceIndex::HMD,
ETrackedDeviceProperty::Prop_UserIpdMeters_Float,
) {
state.input_state.ipd = (ipd * 10000.0).round() * 0.1;
log::info!("IPD: {:.1} mm", state.input_state.ipd);
state.input_state.ipd = (ipd * 1000.0).round();
log::info!("IPD: {:.0} mm", state.input_state.ipd);
}
let _ = install_manifest(&mut app_mgr);
@@ -182,7 +182,7 @@ pub fn openvr_run(
TrackedDeviceIndex::HMD,
ETrackedDeviceProperty::Prop_UserIpdMeters_Float,
) {
let ipd = (ipd * 10000.0).round() * 0.1;
let ipd = (ipd * 1000.0).round();
if (ipd - state.input_state.ipd).abs() > 0.05 {
log::info!("IPD: {:.1} mm -> {:.1} mm", state.input_state.ipd, ipd);
Toast::new(ToastTopic::IpdChange, "IPD".into(), format!("{ipd:.1} mm"))

View File

@@ -2,8 +2,8 @@ use std::{
collections::VecDeque,
ops::Add,
sync::{
Arc,
atomic::{AtomicBool, AtomicUsize, Ordering},
Arc,
},
time::{Duration, Instant},
};
@@ -23,10 +23,10 @@ use crate::{
overlay::{OverlayData, ShouldRender},
task::{SystemTask, TaskType},
},
graphics::{CommandBuffers, init_openxr_graphics},
graphics::{init_openxr_graphics, CommandBuffers},
overlays::{
toast::{Toast, ToastTopic},
watch::{WATCH_NAME, watch_fade},
watch::{watch_fade, WATCH_NAME},
},
state::AppState,
subsystem::notifications::NotificationManager,
@@ -327,7 +327,7 @@ pub fn openxr_run(
)?;
let ipd = helpers::ipd_from_views(&views);
if (app.input_state.ipd - ipd).abs() > 0.01 {
if (app.input_state.ipd - ipd).abs() > 0.05 {
log::info!("IPD changed: {} -> {}", app.input_state.ipd, ipd);
app.input_state.ipd = ipd;
Toast::new(ToastTopic::IpdChange, "IPD".into(), format!("{ipd:.1} mm"))

View File

@@ -329,10 +329,10 @@ pub trait OverlayBackend {
#[derive(Clone, Copy, Debug, Default)]
pub enum Positioning {
/// Stays in place unless recentered, recenters relative to HMD
/// Stays in place, recenters relative to HMD
#[default]
Floating,
/// Stays in place unless recentered, recenters relative to anchor
/// Stays in place, recenters relative to anchor
Anchored,
/// Following HMD
FollowHead { lerp: f32 },

View File

@@ -0,0 +1,9 @@
use glam::Affine3A;
use std::sync::Arc;
pub struct OverlaySetItem {
name: Arc<str>,
transform: Affine3A,
}
pub struct OverlaySet {}