Support for webxr layer management

This commit is contained in:
Alan Jeffrey 2020-04-15 18:04:32 -05:00
parent af110ac21f
commit 349619ed2d
34 changed files with 949 additions and 642 deletions

View file

@ -8,6 +8,8 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::webgltexture::WebGLTexture;
use crate::dom::xrsubimage::XRSubImage;
use dom_struct::dom_struct;
use euclid::Size2D;
use webxr_api::Viewport;
#[dom_struct]
pub struct XRWebGLSubImage {
@ -15,6 +17,7 @@ pub struct XRWebGLSubImage {
color_texture: Dom<WebGLTexture>,
depth_stencil_texture: Option<Dom<WebGLTexture>>,
image_index: Option<u32>,
size: Size2D<u32, Viewport>,
}
impl XRWebGLSubImageMethods for XRWebGLSubImage {
@ -32,4 +35,14 @@ impl XRWebGLSubImageMethods for XRWebGLSubImage {
fn GetImageIndex(&self) -> Option<u32> {
self.image_index
}
/// https://immersive-web.github.io/layers/#dom-xrwebglsubimage-texturewidth
fn TextureWidth(&self) -> u32 {
self.size.width
}
/// https://immersive-web.github.io/layers/#dom-xrwebglsubimage-textureheight
fn TextureHeight(&self) -> u32 {
self.size.height
}
}