mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Basic XRFrame interface
This commit is contained in:
parent
ebf9ccc9de
commit
29e9672d4d
7 changed files with 154 additions and 0 deletions
|
@ -518,4 +518,7 @@ pub mod xmlhttprequest;
|
||||||
pub mod xmlhttprequesteventtarget;
|
pub mod xmlhttprequesteventtarget;
|
||||||
pub mod xmlhttprequestupload;
|
pub mod xmlhttprequestupload;
|
||||||
pub mod xr;
|
pub mod xr;
|
||||||
|
pub mod xrframe;
|
||||||
|
pub mod xrlayer;
|
||||||
pub mod xrsession;
|
pub mod xrsession;
|
||||||
|
pub mod xrwebgllayer;
|
||||||
|
|
12
components/script/dom/webidls/XRFrame.webidl
Normal file
12
components/script/dom/webidls/XRFrame.webidl
Normal 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);
|
||||||
|
};
|
7
components/script/dom/webidls/XRLayer.webidl
Normal file
7
components/script/dom/webidls/XRLayer.webidl
Normal 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 {};
|
41
components/script/dom/webidls/XRWebGLLayer.webidl
Normal file
41
components/script/dom/webidls/XRWebGLLayer.webidl
Normal 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);
|
||||||
|
};
|
30
components/script/dom/xrframe.rs
Normal file
30
components/script/dom/xrframe.rs
Normal 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,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
30
components/script/dom/xrlayer.rs
Normal file
30
components/script/dom/xrlayer.rs
Normal 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,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
31
components/script/dom/xrwebgllayer.rs
Normal file
31
components/script/dom/xrwebgllayer.rs
Normal 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,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue