| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>VRButton - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <h1 translate="no">VRButton</h1>
- <section>
- <header>
- <div class="class-description"><p>A utility class for creating a button that allows to initiate
- immersive VR sessions based on WebXR. The button can be created
- with a factory method and then appended ot the website's DOM.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">document.body.appendChild( VRButton.createButton( renderer ) );
- </code></pre></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">VRButton</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
- <pre><code class="language-js">import { VRButton } from 'three/addons/webxr/VRButton.js';</code></pre>
- <div class="container-overview">
- <div class="method">
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id=".xrSessionIsGranted" translate="no">.<a href="#.xrSessionIsGranted">xrSessionIsGranted</a><span class="type-signature"> : boolean</span> </h3>
- <div class="description">
- <p>Whether a XR session has been granted or not.</p>
- <p>Default is <code>false</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Static Methods</h2>
- <h3 class="name name-method" id=".createButton" translate="no">.<a href="#.createButton">createButton</a><span class="signature">( renderer : <span class="param-type"><a href="WebGLRenderer.html">WebGLRenderer</a> | <a href="WebGPURenderer.html">WebGPURenderer</a></span>, sessionInit : <span class="param-type">XRSessionInit</span> )</span><span class="type-signature"> : HTMLElement</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new VR button.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>renderer</strong>
- </td>
- <td class="description last">
- <p>The renderer.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>sessionInit</strong>
- </td>
- <td class="description last">
- <p>The a configuration object for the AR session.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The button or an error message if <code>immersive-ar</code> isn't supported.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id=".registerSessionGrantedListener" translate="no">.<a href="#.registerSessionGrantedListener">registerSessionGrantedListener</a><span class="signature">()</span> </h3>
- <div class="method">
- <div class="description">
- <p>Registers a <code>sessiongranted</code> event listener. When a session is granted, the VRButton#xrSessionIsGranted
- flag will evaluate to <code>true</code>. This method is automatically called by the module itself so there
- should be no need to use it on app level.</p>
- </div>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/VRButton.js" translate="no" target="_blank" rel="noopener">examples/jsm/webxr/VRButton.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|