大网数据广告活动
Web 标准与前端开发

VRDisplay

· 52CE 我爱测

WebVR API 中的 **`VRDisplay`** 代表任何支持此 API 的 VR 设备。它包括了设备 ID、描述信息等诸如此类的通用信息,以及用于开始呈现 VR 场景、检索眼睛参数和显示能力以及其他重要的功能和方法。

WebVR API

WebVR API 中的 VRDisplay 代表任何支持此 API 的 VR 设备。它包括了设备 ID、描述信息等诸如此类的通用信息,以及用于开始呈现 VR 场景、检索眼睛参数和显示能力以及其他重要的功能和方法。

可以通过调用 Navigator.getVRDisplays() 方法得到所有连接的 VR 设备数组。

属性

  • VRDisplay.capabilities
    • : 返回一个 VRDisplayCapabilities 对象,用于指示 VRDisplay 的各种功能。
  • VRDisplay.depthFar
  • VRDisplay.depthNear
  • VRDisplay.displayId
    • : 返回此 VRDisplay 的标识符,它也用作与 Gamepad API 的关联(详见 Gamepad.displayId)。
  • VRDisplay.displayName
    • : 返回一个不反人类的名称来标识此 VRDisplay。
  • VRDisplay.isConnected
    • : 返回一个 Boolean 值,指示 VRDisplay 是否连接到计算机。
  • VRDisplay.isPresenting
    • : 返回一个 Boolean 值,指示 VRDisplay 当前是否由内容被呈现。
  • VRDisplay.stageParameters
    • : 如果 VR 设备支持房间规模测验,则返回一个包含房间尺寸参数的 VRStageParameters 对象。

方法

  • VRDisplay.getEyeParameters()
    • : 返回指定一侧眼睛参数的 VREyeParameters 对象。
  • VRDisplay.getLayers()
    • : 返回 VRDisplay 当前显示的图层。
  • VRDisplay.getPose()
    • : Returns a VRPose object defining the future predicted pose of the VRDisplay as it will be when the current frame is actually presented.
  • VRDisplay.getImmediatePose()
    • : Returns a VRPose object defining the current pose of the VRDisplay, with no prediction applied.
  • VRDisplay.resetPose()
    • : Resets the pose for this VRDisplay, treating its current VRPose.position and VRPose.orientation as the "origin/zero" values.
  • VRDisplay.cancelAnimationFrame()
    • : A special implementation of Window.cancelAnimationFrame that allows callbacks registered with VRDisplay.requestAnimationFrame() to be unregistered.
  • VRDisplay.requestAnimationFrame()
    • : A special implementation of Window.requestAnimationFrame containing a callback function that will be called every time a new frame of the VRDisplay presentation is rendered.
  • VRDisplay.requestPresent()
    • : Starts the VRDisplay presenting a scene.
  • VRDisplay.exitPresent()
    • : Stops the VRDisplay presenting a scene.
  • VRDisplay.submitFrame()
    • : Captures the current state of the VRLayer currently being presented and displays it on the VRDisplay.

示例

TBD.

规范

该 API 在旧的 WebVR API(已被 WebXR Device API 取代)中定义。它不再有望成为标准。

在所有浏览器都实现新的 WebXR API 之前,建议使用框架(如:A-Frame、Babylon.js 或 Three.js)或 polyfill 来开发适用于所有浏览器的 WebXR 应用程序。[1]

浏览器兼容性

参见

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。