Basic XRFrame interface

This commit is contained in:
Manish Goregaokar 2018-12-19 15:16:01 -08:00
parent ebf9ccc9de
commit 29e9672d4d
7 changed files with 154 additions and 0 deletions

View file

@ -518,4 +518,7 @@ pub mod xmlhttprequest;
pub mod xmlhttprequesteventtarget;
pub mod xmlhttprequestupload;
pub mod xr;
pub mod xrframe;
pub mod xrlayer;
pub mod xrsession;
pub mod xrwebgllayer;

View file

@ -0,0 +1,12 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://immersive-web.github.io/webxr/#xrframe-interface
[SecureContext, Exposed=Window] interface XRFrame {
// readonly attribute XRSession session;
// XRViewerPose? getViewerPose(optional XRReferenceSpace referenceSpace);
// XRInputPose? getInputPose(XRInputSource inputSource, optional XRReferenceSpace referenceSpace);
};

View file

@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://immersive-web.github.io/webxr/#xrlayer-interface
[SecureContext, Exposed=Window] interface XRLayer {};

View file

@ -0,0 +1,41 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://immersive-web.github.io/webxr/#xrwebgllayer-interface
typedef (WebGLRenderingContext or
WebGL2RenderingContext) XRWebGLRenderingContext;
dictionary XRWebGLLayerInit {
boolean antialias = true;
boolean depth = true;
boolean stencil = false;
boolean alpha = true;
double framebufferScaleFactor = 1.0;
};
[SecureContext, Exposed=Window]
// [Constructor(XRSession session,
// XRWebGLRenderingContext context,
// optional XRWebGLLayerInit layerInit)]
interface XRWebGLLayer : XRLayer {
// // Attributes
// readonly attribute XRWebGLRenderingContext context;
// readonly attribute boolean antialias;
// readonly attribute boolean depth;
// readonly attribute boolean stencil;
// readonly attribute boolean alpha;
// readonly attribute WebGLFramebuffer framebuffer;
// readonly attribute unsigned long framebufferWidth;
// readonly attribute unsigned long framebufferHeight;
// // Methods
// XRViewport? getViewport(XRView view);
// void requestViewportScaling(double viewportScaleFactor);
// // Static Methods
// static double getNativeFramebufferScaleFactor(XRSession session);
};

View file

@ -0,0 +1,30 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::XRFrameBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
#[dom_struct]
pub struct XRFrame {
reflector_: Reflector,
}
impl XRFrame {
fn new_inherited() -> XRFrame {
XRFrame {
reflector_: Reflector::new(),
}
}
pub fn new(global: &GlobalScope) -> DomRoot<XRFrame> {
reflect_dom_object(
Box::new(XRFrame::new_inherited()),
global,
XRFrameBinding::Wrap,
)
}
}

View file

@ -0,0 +1,30 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::XRLayerBinding;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use dom_struct::dom_struct;
#[dom_struct]
pub struct XRLayer {
reflector_: Reflector,
}
impl XRLayer {
pub fn new_inherited() -> XRLayer {
XRLayer {
reflector_: Reflector::new(),
}
}
pub fn new(global: &GlobalScope) -> DomRoot<XRLayer> {
reflect_dom_object(
Box::new(XRLayer::new_inherited()),
global,
XRLayerBinding::Wrap,
)
}
}

View file

@ -0,0 +1,31 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::dom::bindings::codegen::Bindings::XRWebGLLayerBinding;
use crate::dom::bindings::reflector::reflect_dom_object;
use crate::dom::bindings::root::DomRoot;
use crate::dom::globalscope::GlobalScope;
use crate::dom::xrlayer::XRLayer;
use dom_struct::dom_struct;
#[dom_struct]
pub struct XRWebGLLayer {
xrlayer: XRLayer,
}
impl XRWebGLLayer {
pub fn new_inherited() -> XRWebGLLayer {
XRWebGLLayer {
xrlayer: XRLayer::new_inherited(),
}
}
pub fn new(global: &GlobalScope) -> DomRoot<XRWebGLLayer> {
reflect_dom_object(
Box::new(XRWebGLLayer::new_inherited()),
global,
XRWebGLLayerBinding::Wrap,
)
}
}