diff options
Diffstat (limited to 'files/zh-cn/web/api/vrdisplay')
-rw-r--r-- | files/zh-cn/web/api/vrdisplay/index.html | 136 | ||||
-rw-r--r-- | files/zh-cn/web/api/vrdisplay/requestanimationframe/index.html | 109 |
2 files changed, 245 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/vrdisplay/index.html b/files/zh-cn/web/api/vrdisplay/index.html new file mode 100644 index 0000000000..60f52c60cf --- /dev/null +++ b/files/zh-cn/web/api/vrdisplay/index.html @@ -0,0 +1,136 @@ +--- +title: VRDisplay +slug: Web/API/VRDisplay +translation_of: Web/API/VRDisplay +--- +<div>{{APIRef("WebVR API")}}{{SeeCompatTable}}</div> + +<p><a href="/en-US/docs/Web/API/WebVR_API">WebVR API</a> 中的 <strong><code>VRDisplay </code></strong>代表任何支持此 API 的 VR 设备。它包括了设备 ID、描述信息等诸如此类的通用信息,以及用于开始呈现 VR 场景、检索眼睛参数和显示能力以及其他重要的功能和方法。</p> + +<p>可以通过调用 {{domxref("Navigator.getVRDisplays()")}} 方法得到所有连接的 VR 设备数组。</p> + +<h2 id="属性">属性</h2> + +<dl> + <dt>{{domxref("VRDisplay.capabilities")}} {{readonlyInline}}</dt> + <dd>返回一个 {{domxref("VRDisplayCapabilities")}} 对象,用于指示 VRDisplay 的各种功能。</dd> + <dt>{{domxref("VRDisplay.depthFar")}}</dt> + <dd>获取或设置<a href="https://en.wikipedia.org/wiki/Viewing_frustum">眼睛可视锥</a>的最远深度。</dd> + <dt>{{domxref("VRDisplay.depthNear")}}</dt> + <dd>获取或设置<a href="https://en.wikipedia.org/wiki/Viewing_frustum">眼睛可视锥</a>的最近深度。</dd> + <dt>{{domxref("VRDisplay.displayId")}} {{readonlyInline}}</dt> + <dd>返回此 VRDisplay 的标识符,它也用作与 <a href="/en-US/docs/Web/API/Gamepad_API">Gamepad API</a> 的关联(详见 {{domxref("Gamepad.displayId")}})。</dd> + <dt>{{domxref("VRDisplay.displayName")}} {{readonlyInline}}</dt> + <dd>返回一个不反人类的名称来标识此 <code>VRDisplay。</code></dd> + <dt>{{domxref("VRDisplay.isConnected")}} {{readonlyInline}}</dt> + <dd>返回一个 {{domxref("Boolean")}} 值,指示 <code>VRDisplay</code> 是否连接到计算机。</dd> + <dt>{{domxref("VRDisplay.isPresenting")}} {{readonlyInline}}</dt> + <dd>返回一个 {{domxref("Boolean")}} 值,指示 <code>VRDisplay</code> 当前是否由内容被呈现。</dd> + <dt>{{domxref("VRDisplay.stageParameters")}} {{readonlyInline}}</dt> + <dd>如果 VR 设备支持房间规模测验,则返回一个包含房间尺寸参数的 {{domxref("VRStageParameters")}} 对象。</dd> +</dl> + +<h2 id="方法">方法</h2> + +<dl> + <dt>{{domxref("VRDisplay.getEyeParameters()")}}</dt> + <dd>返回指定一侧眼睛参数的 {{domxref("VREyeParameters")}} 对象。</dd> + <dt>{{domxref("VRDisplay.getLayers()")}}</dt> + <dd>返回 VRDisplay 当前显示的图层。</dd> + <dt>{{domxref("VRDisplay.getPose()")}}</dt> + <dd>Returns a {{domxref("VRPose")}} object defining the future predicted pose of the <code>VRDisplay</code> as it will be when the current frame is actually presented.</dd> + <dt>{{domxref("VRDisplay.getImmediatePose()")}}</dt> + <dd>Returns a {{domxref("VRPose")}} object defining the current pose of the <code>VRDisplay</code>, with no prediction applied.</dd> + <dt>{{domxref("VRDisplay.resetPose()")}}</dt> + <dd>Resets the pose for this <code>VRDisplay</code>, treating its current {{domxref("VRPose.position")}} and {{domxref("VRPose.orientation")}} as the "origin/zero" values.</dd> + <dt>{{domxref("VRDisplay.cancelAnimationFrame()")}}</dt> + <dd>A special implementation of {{domxref("Window.cancelAnimationFrame")}} that allows callbacks registered with {{domxref("VRDisplay.requestAnimationFrame()")}} to be unregistered.</dd> + <dt>{{domxref("VRDisplay.requestAnimationFrame()")}}</dt> + <dd>A special implementation of {{domxref("Window.requestAnimationFrame")}} containing a callback function that will be called every time a new frame of the <code>VRDisplay</code> presentation is rendered.</dd> + <dt>{{domxref("VRDisplay.requestPresent()")}}</dt> + <dd>Starts the <code>VRDisplay</code> presenting a scene.</dd> + <dt>{{domxref("VRDisplay.exitPresent()")}}</dt> + <dd>Stops the <code>VRDisplay</code> presenting a scene.</dd> + <dt>{{domxref("VRDisplay.submitFrame()")}}</dt> + <dd>Captures the current state of the {{domxref("VRLayer")}} currently being presented and displays it on the <code>VRDisplay</code>.</dd> +</dl> + +<h2 id="示例">示例</h2> + +<pre>TBD.</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('WebVR', '#interface-vrdisplay', 'VRDisplay')}}</td> + <td>{{Spec2('WebVR')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="另请参见">另请参见</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/WebVR_API">WebVR API 主页</a>。</li> + <li><a href="http://mozvr.com/">MozVr.com</a> — 来源于 Mozilla VR 团队的演示、下载以及其他资源。</li> +</ul> diff --git a/files/zh-cn/web/api/vrdisplay/requestanimationframe/index.html b/files/zh-cn/web/api/vrdisplay/requestanimationframe/index.html new file mode 100644 index 0000000000..31d04f4956 --- /dev/null +++ b/files/zh-cn/web/api/vrdisplay/requestanimationframe/index.html @@ -0,0 +1,109 @@ +--- +title: VRDisplay.requestAnimationFrame() +slug: Web/API/VRDisplay/requestAnimationFrame +translation_of: Web/API/VRDisplay/requestAnimationFrame +--- +<div>{{APIRef("WebVR API")}}{{SeeCompatTable}}</div> + +<p>The <code><strong>requestAnimationFrame()</strong></code> method of the {{domxref("VRDisplay")}} interface is a special implementation of {{domxref("Window.requestAnimationFrame")}} containing a callback function that will be called every time a new frame of the <code>VRDisplay</code> presentation is rendered:</p> + +<ul> + <li>When the <code>VRDisplay</code> is not presenting a scene, this is functionally equivalent to {{domxref("Window.requestAnimationFrame")}}.</li> + <li>When the VRDisplay is presenting, the callback is called at the native refresh rate of the <code>VRDisplay</code>.</li> +</ul> + +<h2 id="Syntax">Syntax</h2> + +<pre class="brush: js">var handle = vrDisplayInstance.requestAnimationFrame(<em>callback</em>); +</pre> + +<h3 id="Parameters">Parameters</h3> + +<dl> + <dt>callback</dt> + <dd>A callback function that will be called every time a new frame of the <code>VRDisplay</code> presentation is rendered.</dd> +</dl> + +<h3 id="Return_value">Return value</h3> + +<p>A long representing the handle of the <code>requestAnimationFrame()</code> call. This can then be passed to a {{domxref("VRDisplay.cancelAnimationFrame()")}} call to unregister the callback.</p> + +<h2 id="Examples">Examples</h2> + +<pre>TBD.</pre> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('WebVR', '#dom-vrdisplay-requestanimationframe', 'requestAnimationFrame()')}}</td> + <td>{{Spec2('WebVR')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/WebVR_API">WebVR API homepage</a>.</li> + <li><a href="http://mozvr.com/">MozVr.com</a> — demos, downloads, and other resources from the Mozilla VR team.</li> +</ul> |