安全上下文
此特征只可用于 安全上下文 (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.
工作草案 初始定义。

浏览器兼容性

The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
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

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: