| <!doctype html> |
| <!-- |
| Copyright 2018 The Immersive Web Community Group |
| |
| Permission is hereby granted, free of charge, to any person obtaining a copy of |
| this software and associated documentation files (the "Software"), to deal in |
| the Software without restriction, including without limitation the rights to |
| use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| the Software, and to permit persons to whom the Software is furnished to do so, |
| subject to the following conditions: |
| |
| The above copyright notice and this permission notice shall be included in all |
| copies or substantial portions of the Software. |
| |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| --> |
| <html> |
| <head> |
| <meta charset='utf-8'> |
| <meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no'> |
| <meta name='mobile-web-app-capable' content='yes'> |
| <meta name='apple-mobile-web-app-capable' content='yes'> |
| <link rel='icon' type='image/png' sizes='32x32' href='../favicon-32x32.png'> |
| <link rel='icon' type='image/png' sizes='96x96' href='../favicon-96x96.png'> |
| <link rel='stylesheet' href='../css/common.css'> |
| |
| <title>Exit Button</title> |
| </head> |
| <body> |
| <header> |
| <details open> |
| <summary>Exit Button</summary> |
| <p> |
| A VR scene that has an in-world exit button that ends the session. |
| <a class="back" href="./">Back</a> |
| </p> |
| </details> |
| </header> |
| <script type="module"> |
| import {WebXRSampleApp} from '../js/webxr-sample-app.js'; |
| import {Gltf2Node} from '../js/render/nodes/gltf2.js'; |
| import {UrlTexture} from '../js/render/core/texture.js'; |
| import {ButtonNode} from '../js/render/nodes/button.js'; |
| import {QueryArgs} from '../js/util/query-args.js'; |
| |
| // If requested, use the polyfill to provide support for mobile devices |
| // and devices which only support WebVR. |
| import WebXRPolyfill from '../js/third-party/webxr-polyfill/build/webxr-polyfill.module.js'; |
| if (QueryArgs.getBool('usePolyfill', true)) { |
| let polyfill = new WebXRPolyfill(); |
| } |
| |
| // WebXR sample app setup |
| let app = new WebXRSampleApp({ |
| referenceSpace: 'local-floor' |
| }); |
| document.querySelector('header').appendChild(app.xrButton.domElement); |
| |
| let exitTexture = new UrlTexture('../media/textures/x-button.png'); |
| let exitButton = new ButtonNode(exitTexture, () => { |
| if (app.session) { |
| app.session.end(); |
| } |
| }); |
| exitButton.translation = [0, 1.2, -0.65]; |
| app.scene.addNode(exitButton); |
| |
| app.scene.addNode(new Gltf2Node({url: '../media/gltf/cube-room/cube-room.gltf'})); |
| |
| app.scene.standingStats(true); |
| |
| // Start the XR application. |
| app.run(); |
| </script> |
| </body> |
| </html> |