VRDisplay
Experimental
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
WebVR API 中的 VRDisplay
代表任何支持此 API 的 VR 设备。它包括了设备 ID、描述信息等诸如此类的通用信息,以及用于开始呈现 VR 场景、检索眼睛参数和显示能力以及其他重要的功能和方法。
可以通过调用 Navigator.getVRDisplays()
(en-US) 方法得到所有连接的 VR 设备数组。
属性
VRDisplay.capabilities
(en-US) 只读- 返回一个
VRDisplayCapabilities
(en-US) 对象,用于指示 VRDisplay 的各种功能。 VRDisplay.depthFar
(en-US)- 获取或设置眼睛可视锥的最远深度。
VRDisplay.depthNear
(en-US)- 获取或设置眼睛可视锥的最近深度。
VRDisplay.displayId
(en-US) 只读- 返回此 VRDisplay 的标识符,它也用作与 Gamepad API 的关联(详见
Gamepad.displayId
(en-US))。 VRDisplay.displayName
(en-US) 只读- 返回一个不反人类的名称来标识此
VRDisplay。
VRDisplay.isConnected
(en-US) 只读- 返回一个
Boolean
(en-US) 值,指示VRDisplay
是否连接到计算机。 VRDisplay.isPresenting
(en-US) 只读- 返回一个
Boolean
(en-US) 值,指示VRDisplay
当前是否由内容被呈现。 VRDisplay.stageParameters
(en-US) 只读- 如果 VR 设备支持房间规模测验,则返回一个包含房间尺寸参数的
VRStageParameters
(en-US) 对象。
方法
VRDisplay.getEyeParameters()
(en-US)- 返回指定一侧眼睛参数的
VREyeParameters
(en-US) 对象。 VRDisplay.getLayers()
(en-US)- 返回 VRDisplay 当前显示的图层。
VRDisplay.getPose()
(en-US)- Returns a
VRPose
object defining the future predicted pose of theVRDisplay
as it will be when the current frame is actually presented. VRDisplay.getImmediatePose()
(en-US)- Returns a
VRPose
object defining the current pose of theVRDisplay
, with no prediction applied. VRDisplay.resetPose()
(en-US)- Resets the pose for this
VRDisplay
, treating its currentVRPose.position
(en-US) andVRPose.orientation
(en-US) as the "origin/zero" values. VRDisplay.cancelAnimationFrame()
(en-US)- A special implementation of
Window.cancelAnimationFrame
that allows callbacks registered withVRDisplay.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 theVRDisplay
presentation is rendered. VRDisplay.requestPresent()
(en-US)- Starts the
VRDisplay
presenting a scene. VRDisplay.exitPresent()
(en-US)- Stops the
VRDisplay
presenting a scene. VRDisplay.submitFrame()
(en-US)- Captures the current state of the
VRLayer
(en-US) currently being presented and displays it on theVRDisplay
.
示例
TBD.
规范
Specification | Status | Comment |
---|---|---|
Unknown VRDisplay |
Unknown | Initial definition |
浏览器兼容性
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help! (en-US)
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 未实现 | 未实现 | 未实现 |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|
Basic support | 未实现 | (Yes) | 未实现 | 未实现 | 未实现 | 未实现 |
另请参见
- WebVR API 主页。
- MozVr.com — 来源于 Mozilla VR 团队的演示、下载以及其他资源。