mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Added first-cut implementation of XR layers
This commit is contained in:
parent
7ae11588dc
commit
fda8da0e9d
19 changed files with 585 additions and 15 deletions
63
components/script/dom/webidls/XRLayer.webidl
Normal file
63
components/script/dom/webidls/XRLayer.webidl
Normal file
|
@ -0,0 +1,63 @@
|
|||
/* 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/layers/#xrlayertype
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
interface XRLayer {
|
||||
readonly attribute unsigned long pixelWidth;
|
||||
readonly attribute unsigned long pixelHeight;
|
||||
|
||||
// attribute boolean blendTextureSourceAlpha;
|
||||
// attribute boolean chromaticAberrationCorrection;
|
||||
|
||||
void destroy();
|
||||
};
|
||||
//
|
||||
// TODO: Implement the layer types
|
||||
//
|
||||
// [SecureContext, Exposed=Window, Pref="dom.webxr.enabled"]
|
||||
// interface XRProjectionLayer : XRLayer {
|
||||
// readonly attribute boolean ignoreDepthValues;
|
||||
// };
|
||||
//
|
||||
// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
// interface XRQuadLayer : XRLayer {
|
||||
// readonly attribute XRLayerLayout layout;
|
||||
// attribute XRRigidTransform transform;
|
||||
//
|
||||
// attribute float width;
|
||||
// attribute float height;
|
||||
// };
|
||||
//
|
||||
// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
// interface XRCylinderLayer : XRLayer {
|
||||
// readonly attribute XRLayerLayout layout;
|
||||
// attribute XRReferenceSpace referenceSpace;
|
||||
//
|
||||
// attribute XRRigidTransform transform;
|
||||
// attribute float radius;
|
||||
// attribute float centralAngle;
|
||||
// attribute float aspectRatio;
|
||||
// };
|
||||
//
|
||||
// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
// interface XREquirectLayer : XRLayer {
|
||||
// readonly attribute XRLayerLayout layout;
|
||||
// attribute XRReferenceSpace referenceSpace;
|
||||
//
|
||||
// attribute XRRigidTransform transform;
|
||||
// attribute float radius;
|
||||
// attribute float scaleX;
|
||||
// attribute float scaleY;
|
||||
// attribute float biasX;
|
||||
// attribute float biasY;
|
||||
// };
|
||||
//
|
||||
// [SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
// interface XRCubeLayer : XRLayer {
|
||||
// readonly attribute XRLayerLayout layout;
|
||||
// attribute XRReferenceSpace referenceSpace;
|
||||
//
|
||||
// attribute DOMPoint orientation;
|
||||
// };
|
18
components/script/dom/webidls/XRMediaBinding.webidl
Normal file
18
components/script/dom/webidls/XRMediaBinding.webidl
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* 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/layers/#xrmediabindingtype
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
interface XRMediaBinding {
|
||||
constructor(XRSession session);
|
||||
|
||||
// XRQuadLayer createQuadVideoLayer(HTMLVideoElement video, optional XRMediaLayerInit init = {});
|
||||
// XRCylinderLayer createCylinderVideoLayer(HTMLVideoElement video, optional XRMediaLayerInit init = {});
|
||||
// XREquirectLayer createEquirectVideoLayer(HTMLVideoElement video, optional XRMediaLayerInit init = {});
|
||||
};
|
||||
|
||||
dictionary XRMediaLayerInit {
|
||||
XRLayerLayout layout = "mono";
|
||||
boolean invertStereo = false;
|
||||
};
|
|
@ -2,6 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
typedef (XRWebGLLayer or XRLayer) XRGenericLayer;
|
||||
|
||||
// https://immersive-web.github.io/webxr/#xrrenderstate-interface
|
||||
|
||||
dictionary XRRenderStateInit {
|
||||
|
@ -9,6 +11,7 @@ dictionary XRRenderStateInit {
|
|||
double depthFar;
|
||||
double inlineVerticalFieldOfView;
|
||||
XRWebGLLayer baseLayer;
|
||||
sequence<XRGenericLayer> layers;
|
||||
};
|
||||
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.enabled"] interface XRRenderState {
|
||||
|
|
9
components/script/dom/webidls/XRSubImage.webidl
Normal file
9
components/script/dom/webidls/XRSubImage.webidl
Normal file
|
@ -0,0 +1,9 @@
|
|||
/* 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/layers/#xrsubimagetype
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
interface XRSubImage {
|
||||
readonly attribute XRViewport viewport;
|
||||
};
|
44
components/script/dom/webidls/XRWebGLBinding.webidl
Normal file
44
components/script/dom/webidls/XRWebGLBinding.webidl
Normal file
|
@ -0,0 +1,44 @@
|
|||
/* 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/layers/#XRWebGLBindingtype
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
interface XRWebGLBinding {
|
||||
constructor(XRSession session, XRWebGLRenderingContext context);
|
||||
|
||||
// readonly attribute double nativeProjectionScaleFactor;
|
||||
|
||||
// XRProjectionLayer createProjectionLayer(GLenum textureTarget, optional XRProjectionLayerInit init = {});
|
||||
// XRQuadLayer createQuadLayer(GLenum textureTarget, XRLayerInit init);
|
||||
// XRCylinderLayer createCylinderLayer(GLenum textureTarget, XRLayerInit init);
|
||||
// XREquirectLayer createEquirectLayer(GLenum textureTarget, XRLayerInit init);
|
||||
// XRCubeLayer createCubeLayer(XRLayerInit init);
|
||||
|
||||
XRWebGLSubImage? getSubImage(XRLayer layer, XRFrame frame); // for mono layers
|
||||
XRWebGLSubImage? getViewSubImage(XRLayer layer, XRView view); // for stereo layers
|
||||
};
|
||||
|
||||
dictionary XRProjectionLayerInit {
|
||||
boolean depth = true;
|
||||
boolean stencil = false;
|
||||
boolean alpha = true;
|
||||
double scaleFactor = 1.0;
|
||||
};
|
||||
|
||||
dictionary XRLayerInit {
|
||||
required unsigned long pixelWidth;
|
||||
required unsigned long pixelHeight;
|
||||
XRLayerLayout layout = "mono";
|
||||
boolean depth = false; // This is a change from typical WebGL initialization, but feels appropriate.
|
||||
boolean stencil = false;
|
||||
boolean alpha = true;
|
||||
};
|
||||
|
||||
enum XRLayerLayout {
|
||||
"mono",
|
||||
"stereo",
|
||||
"stereo-left-right",
|
||||
"stereo-top-bottom"
|
||||
};
|
||||
|
11
components/script/dom/webidls/XRWebGLSubImage.webidl
Normal file
11
components/script/dom/webidls/XRWebGLSubImage.webidl
Normal file
|
@ -0,0 +1,11 @@
|
|||
/* 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/layers/#xrwebglsubimagetype
|
||||
[SecureContext, Exposed=Window, Pref="dom.webxr.layers.enabled"]
|
||||
interface XRWebGLSubImage : XRSubImage {
|
||||
readonly attribute WebGLTexture colorTexture;
|
||||
readonly attribute WebGLTexture? depthStencilTexture;
|
||||
readonly attribute unsigned long? imageIndex;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue