此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

XRDepthInformation:height 属性

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

实验性: 这是一项实验性技术
在将其用于生产之前,请仔细检查浏览器兼容性表格

安全上下文: 此特性仅在一些支持的浏览器安全上下文(HTTPS)中可用。

XRDepthInformation 接口的 height 只读属性返回深度缓冲区的高度(行数)。

无符号长整型。

示例

使用 XRFrame.getDepthInformation()(CPU)或 XRWebGLBinding.getDepthInformation()(WebGL)获取深度信息。返回的对象将包含深度缓冲区的 height,可用于进一步的计算。

js
const smallerDepthDimension = Math.min(depthInfo.width, depthInfo.height);
const largerDepthDimension = Math.max(depthInfo.width, depthInfo.height);

规范

Specification
WebXR Depth Sensing Module
# dom-xrdepthinformation-height

浏览器兼容性