experimental battery display

This commit is contained in:
galister
2024-02-06 21:14:10 +01:00
parent c14fa4194b
commit fd2b96c0d6
9 changed files with 128 additions and 61 deletions

View File

@@ -1,8 +1,6 @@
use std::f32::consts::PI;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::thread::sleep;
use std::time::Duration;
use glam::{Affine3A, Vec3, Vec3A, Vec4};
use idmap::IdMap;
@@ -59,7 +57,7 @@ impl LinePool {
}
}
pub fn allocate(&mut self, overlay: &mut OverlayManager, app: &mut AppState) -> usize {
pub fn allocate(&mut self) -> usize {
let id = AUTO_INCREMENT.fetch_add(1, Ordering::Relaxed);
let mut data = OverlayData::<OpenVrOverlayData> {
@@ -147,7 +145,6 @@ impl LinePool {
data.after_input(overlay, app);
if data.state.want_visible {
if data.state.dirty {
data.initialize(overlay, app);
data.upload_texture(overlay, &app.graphics);
data.state.dirty = false;
}

View File

@@ -118,10 +118,7 @@ pub fn openvr_run(running: Arc<AtomicBool>) -> Result<(), BackendError> {
let mut due_tasks = VecDeque::with_capacity(4);
let mut lines = LinePool::new(state.graphics.clone());
let pointer_lines = [
lines.allocate(&mut overlay_mngr, &mut state),
lines.allocate(&mut overlay_mngr, &mut state),
];
let pointer_lines = [lines.allocate(), lines.allocate()];
'main_loop: loop {
if !running.load(Ordering::Relaxed) {

View File

@@ -34,6 +34,7 @@ impl OverlayData<OpenVrOverlayData> {
app: &mut AppState,
) -> OverlayHandle {
let key = format!("wlx-{}", self.state.name);
log::debug!("Create overlay with key: {}", &key);
let handle = match overlay.create_overlay(&key, &key) {
Ok(handle) => handle,
Err(e) => {