WebXR 设备 API
's
XRWebGLLayerInit
dictionary is used to provide configuration options when creating a new
XRWebGLLayer
对象采用
XRWebGLLayer()
构造函数。
The constructor's optional
layerInit
parameter takes an object which must conform to this dictionary.
alpha
可选
alpha
Boolean property is
true
. Otherwise, the color buffer will not have an alpha channel. The default value is
true
.
antialias
可选
true
if anti-aliasing is to be used when rendering in the context; otherwise
false
. The browser selects the anti-aliasing method to use; there is no support for requesting a specific mode yet. The default value is
true
.
depth
可选
true
, requests that the new layer have a depth buffer; otherwise, no depth layer is allocated. The default is
true
.
framebufferScaleFactor
可选
XRWebGLLayer
function
XRWebGLLayer.getNativeFramebufferScaleFactor()
returns the scale that would result in a 1:1 pixel ratio, thereby ensuring that the rendering is occurring at the device's native resolution. The default is 1.0.
ignoreDepthValues
可选
false
.
stencil
可选
true
, requests that the new layer include a stencil buffer. Otherwise, no stencil buffer is allocated. The default is
false
.
Given an
XRSession
,
xrSession
, and a WebGL rendering context,
gl
, this snippet sets the rendering layer for the session, specifying the
ignoreDepthValues
option, indicating that the depth buffer should not be used (or should not exist at all), and that the only source for distance information of any given point is its position relative to the viewer.
const layerOptions = {
ignoreDepthValues: true
};
xrSession.updateRenderState({
baseLayer: new XRWebGLLayer(xrSession, gl, layerOptions);
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebXR 设备 API
The definition of 'XRWebGLLayerInit' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
XRWebGLLayerInit
|
Chrome 79 | Edge 79 | Firefox No | IE No | Opera No | Safari No | WebView Android 79 | Chrome Android 79 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.2 |
alpha
|
Chrome 79 | Edge 79 | Firefox No | IE No | Opera No | Safari No | WebView Android 79 | Chrome Android 79 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.2 |
antialias
|
Chrome 79 | Edge 79 | Firefox No | IE No | Opera No | Safari No | WebView Android 79 | Chrome Android 79 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.2 |
depth
|
Chrome 79 | Edge 79 | Firefox No | IE No | Opera No | Safari No | WebView Android 79 | Chrome Android 79 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.2 |
framebufferScaleFactor
|
Chrome 79 | Edge 79 | Firefox No | IE No | Opera No | Safari No | WebView Android 79 | Chrome Android 79 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.2 |
ignoreDepthValues
|
Chrome 79 | Edge 79 | Firefox No | IE No | Opera No | Safari No | WebView Android 79 | Chrome Android 79 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.2 |
stencil
|
Chrome 79 | Edge 79 | Firefox No | IE No | Opera No | Safari No | WebView Android 79 | Chrome Android 79 | Firefox Android No | Opera Android No | Safari iOS No | Samsung Internet Android 11.2 |
完整支持
不支持
XRWebGLLayerInit
Navigator.xr
WebGLRenderingContext.makeXRCompatible()
XR
XRBoundedReferenceSpace
XRFrame
XRInputSource
XRInputSourceArray
XRInputSourceEvent
XRInputSourcesChangeEvent
XRPose
XRReferenceSpace
XRReferenceSpaceEvent
XRRenderState
XRRigidTransform
XRSession
XRSessionEvent
XRSpace
XRView
XRViewerPose
XRViewport
XRWebGLLayer