use sfzenith_core::{fov, projection}; use std::cell::Cell; use wasm_bindgen::prelude::*; use wasm_bindgen::closure::Closure; use wasm_bindgen_futures::JsFuture; use web_sys::{ CanvasRenderingContext2d, DeviceOrientationEvent, HtmlAnchorElement, HtmlCanvasElement, HtmlVideoElement, MediaStreamConstraints, }; thread_local! { static CURRENT_HEADING: Cell = Cell::new(-1.0); static CURRENT_TILT: Cell = Cell::new(0.0); // Raw, unsmoothed absolute (alpha, beta, gamma) for spherical reprojection. // Component-wise smoothing would corrupt it (0/360 wrap, gimbal coupling). static CURRENT_ORIENTATION: Cell> = Cell::new(None); } /// Install panic hook for readable error messages in the browser console. #[wasm_bindgen(start)] pub fn main() { console_error_panic_hook::set_once(); } /// Request camera access and attach the stream to the