xr resources code

This commit is contained in:
awtterpip
2024-02-17 17:34:18 -06:00
parent cea1d58a15
commit 08e98dd051
14 changed files with 1771 additions and 61 deletions

25
src/webxr/resources.rs Normal file
View File

@@ -0,0 +1,25 @@
use bevy::prelude::{Deref, DerefMut};
use web_sys::WebGlFramebuffer;
#[derive(Deref, DerefMut, Clone)]
pub struct XrSession(#[deref] pub(crate) web_sys::XrSession);
#[derive(Deref, DerefMut, Clone)]
pub struct XrReferenceSpace(#[deref] pub(crate) web_sys::XrReferenceSpace);
#[derive(Deref, DerefMut, Clone)]
pub struct XrFrame(#[deref] pub(crate) web_sys::XrFrame);
#[derive(Deref, DerefMut, Clone)]
pub struct XrWebGlLayer(#[deref] pub(crate) web_sys::XrWebGlLayer);
impl XrWebGlLayer {
pub(crate) fn framebuffer_unwrapped(&self) -> WebGlFramebuffer {
js_sys::Reflect::get(&self, &"framebuffer".into())
.unwrap()
.into()
}
}
#[derive(Clone)]
pub struct XrView(pub(crate) web_sys::XrView);