| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>XRButton - 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">XRButton</h1>
- <section>
- <header>
- <div class="class-description"><p>A utility class for creating a button that allows to initiate
- immersive XR sessions based on WebXR. The button can be created
- with a factory method and then appended ot the website's DOM.</p>
- <p>Compared to <a href="ARButton.html">ARButton</a> and <a href="VRButton.html">VRButton</a>, this class will
- try to offer an immersive AR session first. If the device does not
- support this type of session, it uses an immersive VR session.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">document.body.appendChild( XRButton.createButton( renderer ) );
- </code></pre></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">XRButton</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank">Installation#Addons</a>.</p>
- <pre><code class="language-js">import { XRButton } from 'three/addons/webxr/XRButton.js';</code></pre>
- <div class="container-overview">
- <div class="method">
- </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">WebGLRenderer | WebGPURenderer</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 XR button.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name"><code>renderer</code></td>
- <td class="description last"><p>The renderer.</p></td>
- </tr>
- <tr>
- <td class="name"><code>sessionInit</code></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 WebXR isn't supported.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/webxr/XRButton.js" target="_blank" rel="noopener" translate="no">examples/jsm/webxr/XRButton.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|