安全上下文
此特征只可用于
安全上下文
(HTTPS),在某些或所有
支持浏览器
.
XRWebGLLayerInit
dictionary's Boolean
ignoreDepthValues
property can be provided in the options passed into the
XRWebGLLayer()
constructor to indicate that the depth buffer, if it exists, should be ignored while composing the scene.
The depth buffer is typically used to assist in ordering vertices and, by extension, polygons while compositing, to ensure that the scene is correctly composited, with objects the correct distance away and with clipping and other distance-related computations performed as accurately as possible. Without the depth buffer, these computations must rely entirely on the coordinates of each pixel.
This property differs from
depth
in that
depth
requests a WebGL layer that does not have a depth buffer at all, while
ignoreDepthValues
merely asks that the depth layer be ignored.
let layerInit = {
ignoreDepthValues: boolValue
};
let glLayer = new XRWebGLLayer(xrSession, gl, layerInit);
let glLayer = new XRWebGLLayer(xrSession, gl, { ignoreDepthValues: boolValue });
A Boolean value which can be set to
true
to disable the use of the depth buffer by the WebGL rendering layer created by the
XRWebGLLayer()
constructor. The default value,
false
, means the depth buffer
will
be used, if available.
若
ignoreDepthValues
is
true
, the WebXR compositor will ignore the contents of the depth buffer, if it exists, while compositing and rendering the scene. If
false
, the depth buffer's contents are used, if one is present.
Using a depth buffer while compositing allows the XR compositor to help ensure the compositing is done as accurately as possible. Each entry in the depth buffer corresponds to the depth of the fragment whose color is at the same location in the color buffer, and must have a value between 0.0 and 1.0, where 0.0 corresponds to the distance specified in the
XRSession
对象的
renderState
record's
depthNear
and 1.0 represents the distance given by
depthFar
.
Ignoring depth values causes the compositor to rely solely upon the relative position of objects to establish depth, and may result in less effective and less comfortable 3D effects. The default is
false
(depth values are used by default).
In this example, a new
XRWebGLLayer
is created for a WebXR session,
xrSession
. It's configured to ignore depth values or an alpha channel.
xrSession.updateRenderState({
baseLayer: new XRWebGLLayer(xrSession, gl, {
alpha: false,
ignoredepthValues: true
});
});
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebXR 设备 API
The definition of 'XRWebGLLayerInit.ignoreDepthValues' in that specification. |
工作草案 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
完整支持
不支持
XRWebGLLayerInit
alpha
antialias
depth
framebufferScaleFactor
ignoreDepthValues
stencil
Navigator.xr
WebGLRenderingContext.makeXRCompatible()
XR
XRBoundedReferenceSpace
XRFrame
XRInputSource
XRInputSourceArray
XRInputSourceEvent
XRInputSourcesChangeEvent
XRPose
XRReferenceSpace
XRReferenceSpaceEvent
XRRenderState
XRRigidTransform
XRSession
XRSessionEvent
XRSpace
XRView
XRViewerPose
XRViewport
XRWebGLLayer