diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..e90fd44 --- /dev/null +++ b/.babelrc @@ -0,0 +1,56 @@ +{ + /** + * When building, we do not want to transpile modules in Babel, and instead handle + * them via Rollup. When running tests, we want Babel to transpile and convert modules + * to commonjs, since they're run in Node, and do not use rollup, so we need to use + * a module import system that Node can understand. We need to make two environments + * since the options are merged with the top-level configuration. + */ + "env": { + "production": { + "presets": [ + ["env", { + "targets": { + "browsers": [ + ">1%", + "Firefox ESR", + ] + }, + "debug": true, + "modules": false, + // Disable polyfilling features for now, + // let consumer handle which features to support. Just + // handle transpiling of code for the UMD build. + // "useBuiltIns": "usage", + "exclude": [ + "web.dom.iterable", + "web.immediate", + "web.timers", + // Ignore @babel/preset-env's async/await transformations, + // we're using the `fast-async` plugin to reduce build size and + // not use Regenerator's runtime. + "transform-regenerator", + "transform-async-to-generator", + ], + }] + ], + "plugins": [ + ["fast-async", { + "spec": true, + "useRuntimeModule": false, + }], + "external-helpers", + ], + }, + "test": { + "presets": [ + ["env", { + "targets": { + "node": "8", + }, + "debug": true, + }] + ], + } + } +} diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..59d3a13 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,21 @@ +{ + "extends": ["eslint:recommended", "google"], + "rules": { + "max-len": ["error", { "code": 100 }], + "object-curly-spacing": ["error", "always"], + "arrow-parens": ["error", "as-needed"], + "no-console": ["error", { "allow": ["warn", "error"] }] + }, + "env": { + "browser": true, + "es6": true + }, + "globals": { + "THREE": false, + "VRFrameData": false + }, + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2ae17b --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +webvr2-samples +*.log +*.pid +*.seed +*.swp +*.un~ +*~ +.DS_Store +.netrwhist +.node_repl_history +.npm +Session.vim +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +logs +node_modules +pids diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..3bcd3a9 --- /dev/null +++ b/.npmignore @@ -0,0 +1,16 @@ +*.log +*.pid +*.seed +*.un~ +*~ +.DS_Store +.netrwhist +.node_repl_history +.npm +Session.vim +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +examples +logs +node_modules +pids diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9707151 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,55 @@ +## Developing + +If you're interested in developing and contributing on the polyfill itself, you'll need to +have [npm] installed and familiarize yourself with some commands below. For full list +of commands available, see `package.json` scripts. + +``` +$ git clone git@github.com:immersive-web/webxr-polyfill.git +$ cd webxr-polyfill/ + +# Install dependencies +$ npm install + +# Build transpiled ES5 script +$ npm run build-script + +# Build compressed ES5 script +$ npm run build-min + +# Build ES module +$ npm run build-module + +# Build all builds +$ npm run build + +# Run tests +$ npm test + +# Watch src/* directory and auto-rebuild on changes +$ npm watch +``` + +### Testing + +Right now there are some unit tests in the configuration and logic for how things get polyfilled. +Be sure to run tests before submitting any PRs, and bonus points for having new tests! + +``` +$ npm test +``` + +Due to the nature of the polyfill, be also sure to test the examples with your changes where appropriate. + +### Releasing a new version + +For maintainers only, to cut a new release for npm, use the [npm version] command. The `preversion`, `version` and `postversion` npm scripts will run tests, build, add built files and tag to git, push to github, and publish the new npm version. + +`npm version ` + +## License + +This program is free software for both commercial and non-commercial use, +distributed under the [Apache 2.0 License](LICENSE). + +[rollup]: https://rollupjs.org diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ef06025 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2017 Google Inc + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 7edbc96..64180f6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,114 @@ -# webxr-polyfill -Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard +# WebXR Polyfill + +[![Build Status](http://img.shields.io/travis/immersive-web/webxr-polyfill.svg?style=flat-square)](https://travis-ci.org/immersive-web/webxr-polyfill) +[![Build Status](http://img.shields.io/npm/v/webxr-polyfill.svg?style=flat-square)](https://www.npmjs.org/package/webxr-polyfill) + +A JavaScript implementation of the [WebXR Device API](webxr-spec). This polyfill allows developers to write against the latest specification, providing support when run on browsers that implement the [deprecated WebVR 1.1 spec](webvr-spec), or no WebVR/WebXR support at all. + +If you are writing code against the [WebVR 1.1 spec](webvr-spec), use [webvr-polyfill], which supports browsers with the 1.0 spec, or no implementation at all. It is recommended to write your code targeting the [WebXR Device API spec](webxr-spec) however and use this polyfill as browsers begin to implement the latest changes. + +Input will be added in the future. ([immersive-web/webxr#325](https://github.com/immersive-web/webxr/pull/325)). + +## Setup + +### Installing + +Download the build at [build/webxr-polyfill.js](build/webxr-polyfill.js) and include it as a script tag, +or use a CDN. You can also use the minified file in the same location as `webxr-polyfill.min.js`. + +```html + + + +``` + +Or if you're using a build tool like [browserify] or [webpack], install it via [npm]. + +``` +$ npm install --save webxr-polyfill +``` + +### Using + +The webxr-polyfill exposes a single constructor, `WebXRPolyfill` that takes an +object for configuration. See full configuration options at [API](#api). + +Be sure to instantiate the polyfill before calling any of your XR code! The +polyfill needs to patch the API if it does not exist so your content code can +assume that the WebXR API will just work. + +If using script tags, a `WebXRPolyfill` global constructor will exist. + +```js +var polyfill = new WebXRPolyfill(); +``` + +In a modular ES6 world, import and instantiate the constructor similarly. + +```js +import WebXRPolyfill from 'webxr-polyfill'; +const polyfill = new WebXRPolyfill(); +``` + +## API + +### new WebXRPolyfill(global, config) + +Takes a `global` object (usually `window`), as well as a `config` object with +the following options: + +* `webvr`: Whether or not there should be an attempt to fall back to a + WebVR 1.1 VRDisplay. (default: `true`). +* `cardboard`: Whether or not there should be an attempt to fall back to a + JavaScript implementation of the WebXR API only on mobile. (default: `true`) + +## Browser Support + +There are 3 builds provided: [build/webxr-polyfill.js], an ES5 transpiled build, its minified counterpart [build/webxr-polyfill.min.js], and an untranspiled [ES Modules] version [build/webxr-polyfill.module.js]. If using the transpiled ES5 build, its up to developers to decide which browser features to polyfill based on their support, as no extra polyfills are included. Some browser features this library uses include: + +* TypedArrays +* Object.assign +* Promise +* Symbol +* Map +* Array#includes + +Check the [.babelrc](.babelrc) configuration and ensure the polyfill runs in whatever browsers you choose to support. + +## Polyfilling Rules + +* If `'xr' in navigator === false`: + * WebXR classes (e.g. `XRDevice`, `XRSession`) will be added to the global + * `navigator.xr` will be polyfilled. + * If the platform has a `VRDisplay` from the [WebVR 1.1 spec](webvr-spec) available: + * `navigator.xr.requestDevice()` will return a polyfilled `XRDevice` wrapping the `VRDisplay`. + * If the platform does not have a `VRDisplay`, `config.cardboard === true`, and on mobile: + * `navigator.xr.requestDevice()` will return a polyfilled `XRDevice` based on [CardboardVRDisplay]. + * If `WebGLRenderingContext.prototype.setCompatibleXRDevice` is not a function: + * Polyfill all `WebGLRenderingContext.prototype.setCompatibleXRDevice` and a creation attribute +for `{ compatibleXrDevice }`. + * Polyfills `HTMLCanvasElement.prototype.getContext` to support a `xrpresent` type. Returns a polyfilled `XRPresentationContext` used for mirroring and magic window. +* If `'xr' in navigator === true`, `config.cardboard === true` and on mobile: + * Overwrite `navigator.xr.requestDevice` so that a native `XRDevice` is returned if it exists, and if not, return a polyfilled `XRDevice` based on [CardboardVRDisplay]. + +In the future, when the WebXR API is implemented on a platform but inconsistent with spec (due to new spec changes or inconsistencies), the polyfill will attempt to patch these differences without overwriting the native behavior. + +## Not supported/Caveats + +* A lot of objects should only be used in the frame they were retrieved; don't save and access a XRDevice's `poseModelMatrix` in a frame other than when it was created. +* `XRWebGLLayer.multiview` +* `XRWebGLLayer.framebufferScaleFactor` and `XRWebGLLayer.requestViewportScaling()` + +## License + +This program is free software for both commercial and non-commercial use, +distributed under the [Apache 2.0 License](LICENSE). + +[webxr-spec]: https://immersive-web.github.io/webxr/spec/latest/ +[webvr-spec]: https://immersive-web.github.io/webvr/spec/1.1/ +[webvr-polyfill]: https://github.com/immersive-web/webvr-polyfill +[npm]: https://www.npmjs.com +[browserify]: http://browserify.org/ +[webpack]: https://webpack.github.io/ +[ES Modules]: https://jakearchibald.com/2017/es-modules-in-browsers/ +[CardboardVRDisplay]: https://immersive-web.github.io/cardboard-vr-display diff --git a/build/webxr-polyfill.js b/build/webxr-polyfill.js new file mode 100644 index 0000000..af364ed --- /dev/null +++ b/build/webxr-polyfill.js @@ -0,0 +1,5015 @@ +/** + * @license + * webxr-polyfill + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * cardboard-vr-display + * Copyright (c) 2015-2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * webvr-polyfill-dpdb + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * wglu-preserve-state + * Copyright (c) 2016, Brandon Jones. + * + * 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. + */ + +/** + * @license + * nosleep.js + * Copyright (c) 2017, Rich Tibbett + * + * 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. + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global.WebXRPolyfill = factory()); +}(this, (function () { 'use strict'; + +var _global = typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : {}; + +var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; + +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); + + + + + + + + + +var inherits = function (subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; +}; + + + + + + + + + + + +var possibleConstructorReturn = function (self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; +}; + +var PRIVATE = Symbol('@@webxr-polyfill/EventTarget'); +var EventTarget = function () { + function EventTarget() { + classCallCheck(this, EventTarget); + this[PRIVATE] = { + listeners: new Map() + }; + } + createClass(EventTarget, [{ + key: 'addEventListener', + value: function addEventListener(type, listener) { + if (typeof type !== 'string') { + throw new Error('`type` must be a string'); + } + if (typeof listener !== 'function') { + throw new Error('`listener` must be a function'); + } + var typedListeners = this[PRIVATE].listeners.get(type) || []; + typedListeners.push(listener); + this[PRIVATE].listeners.set(type, typedListeners); + } + }, { + key: 'removeEventListener', + value: function removeEventListener(type, listener) { + if (typeof type !== 'string') { + throw new Error('`type` must be a string'); + } + if (typeof listener !== 'function') { + throw new Error('`listener` must be a function'); + } + var typedListeners = this[PRIVATE].listeners.get(type) || []; + for (var i = typedListeners.length; i >= 0; i--) { + if (typedListeners[i] === listener) { + typedListeners.pop(); + } + } + } + }, { + key: 'dispatchEvent', + value: function dispatchEvent(type, event) { + var typedListeners = this[PRIVATE].listeners.get(type) || []; + var queue = []; + for (var i = 0; i < typedListeners.length; i++) { + queue[i] = typedListeners[i]; + } + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + try { + for (var _iterator = queue[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var listener = _step.value; + listener(event); + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + if (typeof this['on' + type] === 'function') { + this['on' + type](event); + } + } + }]); + return EventTarget; +}(); + +var PRIVATE$1 = Symbol('@@webxr-polyfill/XR'); +var XR = function (_EventTarget) { + inherits(XR, _EventTarget); + function XR(device) { + classCallCheck(this, XR); + var _this = possibleConstructorReturn(this, (XR.__proto__ || Object.getPrototypeOf(XR)).call(this)); + _this[PRIVATE$1] = { + device: device + }; + return _this; + } + createClass(XR, [{ + key: 'requestDevice', + value: function requestDevice() { + return new Promise(function ($return, $error) { + var device; + return Promise.resolve(this[PRIVATE$1].device).then(function ($await_1) { + try { + device = $await_1; + if (device) { + return $return(device); + } + return $error(new Error('NotFoundError')); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this), $error); + }.bind(this)); + } + }]); + return XR; +}(EventTarget); + +var now = void 0; +if ('performance' in _global === false) { + var startTime = Date.now(); + now = function now() { + return Date.now() - startTime; + }; +} else { + now = function now() { + return performance.now(); + }; +} +var now$1 = now; + +var PRIVATE$2 = Symbol('@@webxr-polyfill/XRPresentationContext'); +var XRPresentationContext = function () { + function XRPresentationContext(canvas, ctx, glAttribs) { + classCallCheck(this, XRPresentationContext); + this[PRIVATE$2] = { canvas: canvas, ctx: ctx, glAttribs: glAttribs }; + Object.assign(this, ctx); + } + createClass(XRPresentationContext, [{ + key: 'canvas', + get: function get$$1() { + return this[PRIVATE$2].canvas; + } + }]); + return XRPresentationContext; +}(); + +function mat4_identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +} +function mat4_copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +} +function mat4_invert(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b00 = a00 * a11 - a01 * a10; + var b01 = a00 * a12 - a02 * a10; + var b02 = a00 * a13 - a03 * a10; + var b03 = a01 * a12 - a02 * a11; + var b04 = a01 * a13 - a03 * a11; + var b05 = a02 * a13 - a03 * a12; + var b06 = a20 * a31 - a21 * a30; + var b07 = a20 * a32 - a22 * a30; + var b08 = a20 * a33 - a23 * a30; + var b09 = a21 * a32 - a22 * a31; + var b10 = a21 * a33 - a23 * a31; + var b11 = a22 * a33 - a23 * a32; + var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1.0 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; +} +function mat4_fromRotationTranslation(out, q, v) { + var x = q[0], + y = q[1], + z = q[2], + w = q[3]; + var x2 = x + x; + var y2 = y + y; + var z2 = z + z; + var xx = x * x2; + var xy = x * y2; + var xz = x * z2; + var yy = y * y2; + var yz = y * z2; + var zz = z * z2; + var wx = w * x2; + var wy = w * y2; + var wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; +} +function mat4_multiply(out, a, b) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3]; + var a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7]; + var a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11]; + var a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15]; + var b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3]; + out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[4];b1 = b[5];b2 = b[6];b3 = b[7]; + out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[8];b1 = b[9];b2 = b[10];b3 = b[11]; + out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + b0 = b[12];b1 = b[13];b2 = b[14];b3 = b[15]; + out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30; + out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31; + out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32; + out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33; + return out; +} + +var PRIVATE$3 = Symbol('@@webxr-polyfill/XRDevicePose'); +var XRDevicePose = function () { + function XRDevicePose(polyfill) { + classCallCheck(this, XRDevicePose); + this[PRIVATE$3] = { + polyfill: polyfill, + leftViewMatrix: mat4_identity(new Float32Array(16)), + rightViewMatrix: mat4_identity(new Float32Array(16)), + poseModelMatrix: mat4_identity(new Float32Array(16)) + }; + } + createClass(XRDevicePose, [{ + key: 'getViewMatrix', + value: function getViewMatrix(view) { + switch (view.eye) { + case 'left': + return this[PRIVATE$3].leftViewMatrix; + case 'right': + return this[PRIVATE$3].rightViewMatrix; + } + throw new Error('view is not a valid XREye'); + } + }, { + key: 'updateFromFrameOfReference', + value: function updateFromFrameOfReference(frameOfRef) { + var pose = this[PRIVATE$3].polyfill.getBasePoseMatrix(); + var leftViewMatrix = this[PRIVATE$3].polyfill.getBaseViewMatrix('left'); + var rightViewMatrix = this[PRIVATE$3].polyfill.getBaseViewMatrix('right'); + if (pose) { + frameOfRef.transformBasePoseMatrix(this[PRIVATE$3].poseModelMatrix, pose); + } + if (leftViewMatrix && rightViewMatrix) { + frameOfRef.transformBaseViewMatrix(this[PRIVATE$3].leftViewMatrix, leftViewMatrix, this[PRIVATE$3].poseModelMatrix); + frameOfRef.transformBaseViewMatrix(this[PRIVATE$3].rightViewMatrix, rightViewMatrix, this[PRIVATE$3].poseModelMatrix); + } + } + }, { + key: 'poseModelMatrix', + get: function get$$1() { + return this[PRIVATE$3].poseModelMatrix; + } + }]); + return XRDevicePose; +}(); + +var PRIVATE$4 = Symbol('@@webxr-polyfill/XRViewport'); +var XRViewport = function () { + function XRViewport(target) { + classCallCheck(this, XRViewport); + this[PRIVATE$4] = { target: target }; + } + createClass(XRViewport, [{ + key: 'x', + get: function get$$1() { + return this[PRIVATE$4].target.x; + } + }, { + key: 'y', + get: function get$$1() { + return this[PRIVATE$4].target.y; + } + }, { + key: 'width', + get: function get$$1() { + return this[PRIVATE$4].target.width; + } + }, { + key: 'height', + get: function get$$1() { + return this[PRIVATE$4].target.height; + } + }]); + return XRViewport; +}(); + +var PRIVATE$5 = Symbol('@@webxr-polyfill/XRView'); +var XREyes = ['left', 'right']; +var XRView = function () { + function XRView(polyfill, eye, sessionId) { + classCallCheck(this, XRView); + if (!XREyes.includes(eye)) { + throw new Error('XREye must be one of: ' + XREyes); + } + var temp = Object.create(null); + var viewport = new XRViewport(temp); + this[PRIVATE$5] = { + polyfill: polyfill, + eye: eye, + viewport: viewport, + temp: temp, + sessionId: sessionId + }; + } + createClass(XRView, [{ + key: '_getViewport', + value: function _getViewport(layer) { + var viewport = this[PRIVATE$5].viewport; + if (this[PRIVATE$5].polyfill.getViewport(this[PRIVATE$5].sessionId, this.eye, layer, this[PRIVATE$5].temp)) { + return this[PRIVATE$5].viewport; + } + return undefined; + } + }, { + key: 'eye', + get: function get$$1() { + return this[PRIVATE$5].eye; + } + }, { + key: 'projectionMatrix', + get: function get$$1() { + return this[PRIVATE$5].polyfill.getProjectionMatrix(this.eye); + } + }]); + return XRView; +}(); + +var PRIVATE$6 = Symbol('@@webxr-polyfill/XRPresentationFrame'); +var XRPresentationFrame = function () { + function XRPresentationFrame(polyfill, session, sessionId) { + classCallCheck(this, XRPresentationFrame); + var devicePose = new XRDevicePose(polyfill); + var views = [new XRView(polyfill, 'left', sessionId)]; + if (session.exclusive) { + views.push(new XRView(polyfill, 'right', sessionId)); + } + this[PRIVATE$6] = { + polyfill: polyfill, + devicePose: devicePose, + views: views, + session: session + }; + } + createClass(XRPresentationFrame, [{ + key: 'getDevicePose', + value: function getDevicePose(coordinateSystem) { + this[PRIVATE$6].devicePose.updateFromFrameOfReference(coordinateSystem); + return this[PRIVATE$6].devicePose; + } + }, { + key: 'session', + get: function get$$1() { + return this[PRIVATE$6].session; + } + }, { + key: 'views', + get: function get$$1() { + return this[PRIVATE$6].views; + } + }]); + return XRPresentationFrame; +}(); + +var PRIVATE$7 = Symbol('@@webxr-polyfill/XRStageBoundsPoint'); +var XRStageBoundsPoint = function () { + function XRStageBoundsPoint(x, z) { + classCallCheck(this, XRStageBoundsPoint); + this[PRIVATE$7] = { x: x, z: z }; + } + createClass(XRStageBoundsPoint, [{ + key: 'x', + get: function get$$1() { + return this[PRIVATE$7].x; + } + }, { + key: 'z', + get: function get$$1() { + return this[PRIVATE$7].z; + } + }]); + return XRStageBoundsPoint; +}(); + +var PRIVATE$8 = Symbol('@@webxr-polyfill/XRStageBounds'); +var XRStageBounds = function () { + function XRStageBounds(boundsData) { + classCallCheck(this, XRStageBounds); + var geometry = []; + for (var i = 0; i < boundsData.length; i += 2) { + geometry.push(new XRStageBoundsPoint(boundsData[i], boundsData[i + 1])); + } + this[PRIVATE$8] = { geometry: geometry }; + } + createClass(XRStageBounds, [{ + key: 'geometry', + get: function get$$1() { + return this[PRIVATE$8].geometry; + } + }]); + return XRStageBounds; +}(); + +var XRCoordinateSystem = function () { + function XRCoordinateSystem() { + classCallCheck(this, XRCoordinateSystem); + } + createClass(XRCoordinateSystem, [{ + key: 'getTransformTo', + value: function getTransformTo(other) { + throw new Error('Not yet supported'); + } + }]); + return XRCoordinateSystem; +}(); + +var PRIVATE$9 = Symbol('@@webxr-polyfill/XRFrameOfReference'); +var DEFAULT_EMULATION_HEIGHT = 1.6; +var XRFrameOfReferenceTypes = ['headModel', 'eyeLevel', 'stage']; +var XRFrameOfReferenceOptions = Object.freeze({ + disableStageEmulation: false, + stageEmulationHeight: 0 +}); +var XRFrameOfReference = function (_XRCoordinateSystem) { + inherits(XRFrameOfReference, _XRCoordinateSystem); + function XRFrameOfReference(polyfill, type, options, transform, bounds) { + classCallCheck(this, XRFrameOfReference); + options = Object.assign({}, XRFrameOfReferenceOptions, options); + if (!XRFrameOfReferenceTypes.includes(type)) { + throw new Error('XRFrameOfReferenceType must be one of ' + XRFrameOfReferenceTypes); + } + var _this = possibleConstructorReturn(this, (XRFrameOfReference.__proto__ || Object.getPrototypeOf(XRFrameOfReference)).call(this)); + if (type === 'stage' && options.disableStageEmulation && !transform) { + throw new Error('XRFrameOfReference cannot use \'stage\' type, if disabling emulation and platform does not provide'); + } + var _options = options, + disableStageEmulation = _options.disableStageEmulation, + stageEmulationHeight = _options.stageEmulationHeight; + var emulatedHeight = 0; + if (type === 'stage' && !transform) { + emulatedHeight = stageEmulationHeight !== 0 ? stageEmulationHeight : DEFAULT_EMULATION_HEIGHT; + } + if (type === 'stage' && !transform) { + transform = mat4_identity(new Float32Array(16)); + transform[13] = emulatedHeight; + } + _this[PRIVATE$9] = { + disableStageEmulation: disableStageEmulation, + stageEmulationHeight: stageEmulationHeight, + emulatedHeight: emulatedHeight, + type: type, + transform: transform, + polyfill: polyfill, + bounds: bounds + }; + _this.onboundschange = undefined; + return _this; + } + createClass(XRFrameOfReference, [{ + key: 'transformBasePoseMatrix', + value: function transformBasePoseMatrix(out, pose) { + if (this[PRIVATE$9].transform) { + mat4_multiply(out, this[PRIVATE$9].transform, pose); + return; + } + switch (this.type) { + case 'headModel': + if (out !== pose) { + mat4_copy(out, pose); + } + out[12] = out[13] = out[14] = 0; + return; + case 'eyeLevel': + if (out !== pose) { + mat4_copy(out, pose); + } + return; + } + } + }, { + key: 'transformBaseViewMatrix', + value: function transformBaseViewMatrix(out, view) { + var frameOfRef = this[PRIVATE$9].transform; + if (frameOfRef) { + mat4_invert(out, frameOfRef); + mat4_multiply(out, view, out); + } + else if (this.type === 'headModel') { + mat4_invert(out, view); + out[12] = 0; + out[13] = 0; + out[14] = 0; + mat4_invert(out, out); + return out; + } + else { + mat4_copy(out, view); + } + return out; + } + }, { + key: 'bounds', + get: function get$$1() { + return this[PRIVATE$9].bounds; + } + }, { + key: 'emulatedHeight', + get: function get$$1() { + return this[PRIVATE$9].emulatedHeight; + } + }, { + key: 'type', + get: function get$$1() { + return this[PRIVATE$9].type; + } + }]); + return XRFrameOfReference; +}(XRCoordinateSystem); + +var PRIVATE$10 = Symbol('@@webxr-polyfill/XRSession'); +var XRSessionCreationOptions = Object.freeze({ + exclusive: false, + outputContext: undefined +}); +var validateSessionOptions = function validateSessionOptions(options) { + var exclusive = options.exclusive, + outputContext = options.outputContext; + if (!exclusive && !outputContext) { + return false; + } + if (outputContext !== undefined && !(outputContext instanceof XRPresentationContext)) { + return false; + } + return true; +}; +var XRSession = function (_EventTarget) { + inherits(XRSession, _EventTarget); + function XRSession(polyfill, device, sessionOptions, id) { + classCallCheck(this, XRSession); + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + var _this = possibleConstructorReturn(this, (XRSession.__proto__ || Object.getPrototypeOf(XRSession)).call(this)); + var _sessionOptions = sessionOptions, + exclusive = _sessionOptions.exclusive, + outputContext = _sessionOptions.outputContext; + _this[PRIVATE$10] = { + polyfill: polyfill, + device: device, + exclusive: exclusive, + outputContext: outputContext, + ended: false, + suspended: false, + suspendedCallback: null, + id: id + }; + var frame = new XRPresentationFrame(polyfill, _this, _this[PRIVATE$10].id); + _this[PRIVATE$10].frame = frame; + _this[PRIVATE$10].onPresentationEnd = function (sessionId) { + if (sessionId !== _this[PRIVATE$10].id) { + _this[PRIVATE$10].suspended = false; + _this.dispatchEvent('focus', { session: _this }); + var suspendedCallback = _this[PRIVATE$10].suspendedCallback; + _this[PRIVATE$10].suspendedCallback = null; + if (suspendedCallback) { + _this.requestAnimationFrame(suspendedCallback); + } + return; + } + _this[PRIVATE$10].ended = true; + polyfill.removeEventListener('@webvr-polyfill/vr-present-end', _this[PRIVATE$10].onPresentationEnd); + polyfill.removeEventListener('@webvr-polyfill/vr-present-start', _this[PRIVATE$10].onPresentationStart); + _this.dispatchEvent('end', { session: _this }); + }; + polyfill.addEventListener('@@webxr-polyfill/vr-present-end', _this[PRIVATE$10].onPresentationEnd); + _this[PRIVATE$10].onPresentationStart = function (sessionId) { + if (sessionId === _this[PRIVATE$10].id) { + return; + } + _this[PRIVATE$10].suspended = true; + _this.dispatchEvent('blur', { session: _this }); + }; + polyfill.addEventListener('@@webxr-polyfill/vr-present-start', _this[PRIVATE$10].onPresentationStart); + _this.onblur = undefined; + _this.onfocus = undefined; + _this.onresetpose = undefined; + _this.onend = undefined; + return _this; + } + createClass(XRSession, [{ + key: 'requestFrameOfReference', + value: function requestFrameOfReference(type) { + var $args = arguments;return new Promise(function ($return, $error) { + var options, transform, bounds; + options = $args.length > 1 && $args[1] !== undefined ? $args[1] : {}; + if (this[PRIVATE$10].ended) { + return $return(); + } + options = Object.assign({}, XRFrameOfReferenceOptions, options); + if (!XRFrameOfReferenceTypes.includes(type)) { + return $error(new Error('XRFrameOfReferenceType must be one of ' + XRFrameOfReferenceTypes)); + } + transform = null; + bounds = null; + var $Try_1_Post = function () { + try { + if (type === 'stage' && transform) { + bounds = this[PRIVATE$10].polyfill.requestStageBounds(); + if (bounds) { + bounds = new XRStageBounds(bounds); + } + } + return $return(new XRFrameOfReference(this[PRIVATE$10].polyfill, type, options, transform, bounds)); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this);var $Try_1_Catch = function (e) { + try { + if (type !== 'stage' || options.disableStageEmulation) { + throw e; + } + return $Try_1_Post(); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this); + try { + return Promise.resolve(this[PRIVATE$10].polyfill.requestFrameOfReferenceTransform(type, options)).then(function ($await_2) { + try { + transform = $await_2; + return $Try_1_Post(); + } catch ($boundEx) { + return $Try_1_Catch($boundEx); + } + }.bind(this), $Try_1_Catch); + } catch (e) { + $Try_1_Catch(e); + } + }.bind(this)); + } + }, { + key: 'requestAnimationFrame', + value: function requestAnimationFrame(callback) { + var _this2 = this; + if (this[PRIVATE$10].ended) { + return; + } + if (this[PRIVATE$10].suspended && this[PRIVATE$10].suspendedCallback) { + return; + } + if (this[PRIVATE$10].suspended && !this[PRIVATE$10].suspendedCallback) { + this[PRIVATE$10].suspendedCallback = callback; + } + return this[PRIVATE$10].polyfill.requestAnimationFrame(function () { + _this2[PRIVATE$10].polyfill.onFrameStart(); + callback(now$1(), _this2[PRIVATE$10].frame); + _this2[PRIVATE$10].polyfill.onFrameEnd(_this2[PRIVATE$10].id); + }); + } + }, { + key: 'cancelAnimationFrame', + value: function cancelAnimationFrame(handle) { + if (this[PRIVATE$10].ended) { + return; + } + this[PRIVATE$10].polyfill.cancelAnimationFrame(handle); + } + }, { + key: 'end', + value: function end() { + return new Promise(function ($return, $error) { + if (this[PRIVATE$10].ended) { + return $return(); + } + if (!this.exclusive) { + this[PRIVATE$10].ended = true; + this[PRIVATE$10].polyfill.removeEventListener('@@webvr-polyfill/vr-present-start', this[PRIVATE$10].onPresentationStart); + this[PRIVATE$10].polyfill.removeEventListener('@@webvr-polyfill/vr-present-end', this[PRIVATE$10].onPresentationEnd); + this.dispatchEvent('end', { session: this }); + } + return $return(this[PRIVATE$10].polyfill.endSession(this[PRIVATE$10].id)); + }.bind(this)); + } + }, { + key: 'device', + get: function get$$1() { + return this[PRIVATE$10].device; + } + }, { + key: 'exclusive', + get: function get$$1() { + return this[PRIVATE$10].exclusive; + } + }, { + key: 'outputContext', + get: function get$$1() { + return this[PRIVATE$10].outputContext; + } + }, { + key: 'depthNear', + get: function get$$1() { + return this[PRIVATE$10].polyfill.depthNear; + } + , + set: function set$$1(value) { + this[PRIVATE$10].polyfill.depthNear = value; + } + }, { + key: 'depthFar', + get: function get$$1() { + return this[PRIVATE$10].polyfill.depthFar; + } + , + set: function set$$1(value) { + this[PRIVATE$10].polyfill.depthFar = value; + } + }, { + key: 'baseLayer', + get: function get$$1() { + return this[PRIVATE$10].baseLayer; + } + , + set: function set$$1(value) { + if (this[PRIVATE$10].ended) { + return; + } + this[PRIVATE$10].baseLayer = value; + this[PRIVATE$10].polyfill.onBaseLayerSet(this[PRIVATE$10].id, value); + } + }]); + return XRSession; +}(EventTarget); + +var PRIVATE$11 = Symbol('@@webxr-polyfill/XRDevice'); +var XRDevice = function (_EventTarget) { + inherits(XRDevice, _EventTarget); + function XRDevice(polyfill) { + classCallCheck(this, XRDevice); + if (!polyfill) { + throw new Error('XRDevice must receive a PolyfilledXRDevice.'); + } + var _this = possibleConstructorReturn(this, (XRDevice.__proto__ || Object.getPrototypeOf(XRDevice)).call(this)); + _this[PRIVATE$11] = { + polyfill: polyfill, + exclusiveSession: null, + nonExclusiveSessions: new Set() + }; + _this.ondeactive = undefined; + return _this; + } + createClass(XRDevice, [{ + key: 'supportsSession', + value: function supportsSession() { + var $args = arguments;return new Promise(function ($return, $error) { + var sessionOptions = $args.length > 0 && $args[0] !== undefined ? $args[0] : {}; + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + if (!validateSessionOptions(sessionOptions)) { + return $return(Promise.reject(null)); + } + if (!this[PRIVATE$11].polyfill.supportsSession(sessionOptions)) { + return $return(Promise.reject(null)); + } + return $return(null); + }.bind(this)); + } + }, { + key: 'requestSession', + value: function requestSession(sessionOptions) { + return new Promise(function ($return, $error) { + var _this2, sessionId, session, onSessionEnd; + _this2 = this; + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + if (!validateSessionOptions(sessionOptions)) { + return $error(new Error('NotSupportedError')); + } + if (this[PRIVATE$11].exclusiveSession && sessionOptions.exclusive) { + return $error(new Error('InvalidStateError')); + } + return Promise.resolve(this[PRIVATE$11].polyfill.requestSession(sessionOptions)).then(function ($await_1) { + try { + sessionId = $await_1; + session = new XRSession(this[PRIVATE$11].polyfill, this, sessionOptions, sessionId); + if (sessionOptions.exclusive) { + this[PRIVATE$11].exclusiveSession = session; + } else { + this[PRIVATE$11].nonExclusiveSessions.add(session); + } + onSessionEnd = function onSessionEnd() { + if (session.exclusive) { + _this2[PRIVATE$11].exclusiveSession = null; + } else { + _this2[PRIVATE$11].nonExclusiveSessions.delete(session); + } + session.removeEventListener('end', onSessionEnd); + }; + session.addEventListener('end', onSessionEnd); + return $return(session); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this), $error); + }.bind(this)); + } + }]); + return XRDevice; +}(EventTarget); + +var XRLayer = function () { + function XRLayer() { + classCallCheck(this, XRLayer); + } + createClass(XRLayer, [{ + key: "getViewport", + value: function getViewport(view) { + return view._getViewport(this); + } + }]); + return XRLayer; +}(); + +var POLYFILLED_COMPATIBLE_XR_DEVICE = Symbol('@@webxr-polyfill/polyfilled-compatible-xr-device'); +var COMPATIBLE_XR_DEVICE = Symbol('@@webxr-polyfill/compatible-xr-device'); + +var PRIVATE$12 = Symbol('@@webxr-polyfill/XRWebGLLayer'); +var XRWebGLLayerInit = Object.freeze({ + antialias: true, + depth: false, + stencil: false, + alpha: true, + multiview: false, + framebufferScaleFactor: 0 +}); +var XRWebGLLayer = function (_XRLayer) { + inherits(XRWebGLLayer, _XRLayer); + function XRWebGLLayer(session, context) { + var layerInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + classCallCheck(this, XRWebGLLayer); + var config = Object.assign({}, XRWebGLLayerInit, layerInit); + if (!(session instanceof XRSession)) { + throw new Error('session must be a XRSession'); + } + if (session.ended) { + throw new Error('InvalidStateError'); + } + if (context[POLYFILLED_COMPATIBLE_XR_DEVICE]) { + if (context[COMPATIBLE_XR_DEVICE] !== session.device) { + throw new Error('InvalidStateError'); + } + } + var framebuffer = context.getParameter(context.FRAMEBUFFER_BINDING); + var _this = possibleConstructorReturn(this, (XRWebGLLayer.__proto__ || Object.getPrototypeOf(XRWebGLLayer)).call(this)); + _this[PRIVATE$12] = { + context: context, + config: config, + framebuffer: framebuffer + }; + return _this; + } + createClass(XRWebGLLayer, [{ + key: 'requestViewportScaling', + value: function requestViewportScaling(viewportScaleFactor) { + console.warn('requestViewportScaling is not yet implemented'); + } + }, { + key: 'context', + get: function get$$1() { + return this[PRIVATE$12].context; + } + }, { + key: 'antialias', + get: function get$$1() { + return this[PRIVATE$12].config.antialias; + } + }, { + key: 'depth', + get: function get$$1() { + return this[PRIVATE$12].config.depth; + } + }, { + key: 'stencil', + get: function get$$1() { + return this[PRIVATE$12].config.stencil; + } + }, { + key: 'alpha', + get: function get$$1() { + return this[PRIVATE$12].config.alpha; + } + }, { + key: 'multiview', + get: function get$$1() { + return false; + } + }, { + key: 'framebuffer', + get: function get$$1() { + return this[PRIVATE$12].framebuffer; + } + }, { + key: 'framebufferWidth', + get: function get$$1() { + return this[PRIVATE$12].context.drawingBufferWidth; + } + }, { + key: 'framebufferHeight', + get: function get$$1() { + return this[PRIVATE$12].context.drawingBufferHeight; + } + }]); + return XRWebGLLayer; +}(XRLayer); + +var API = { + XR: XR, + XRDevice: XRDevice, + XRSession: XRSession, + XRPresentationFrame: XRPresentationFrame, + XRView: XRView, + XRViewport: XRViewport, + XRDevicePose: XRDevicePose, + XRLayer: XRLayer, + XRWebGLLayer: XRWebGLLayer, + XRPresentationContext: XRPresentationContext, + XRCoordinateSystem: XRCoordinateSystem, + XRFrameOfReference: XRFrameOfReference, + XRStageBounds: XRStageBounds, + XRStageBoundsPoint: XRStageBoundsPoint +}; + +var extendContextCompatibleXRDevice = function extendContextCompatibleXRDevice(Context) { + if (typeof Context.prototype.setCompatibleXRDevice === 'function') { + return false; + } + Context.prototype.setCompatibleXRDevice = function (xrDevice) { + var _this = this; + return new Promise(function (resolve, reject) { + if (xrDevice && typeof xrDevice.requestSession === 'function') { + resolve(); + } else { + reject(); + } + }).then(function () { + return _this[COMPATIBLE_XR_DEVICE] = xrDevice; + }); + }; + return true; +}; +var extendGetContext = function extendGetContext(Canvas) { + var getContext = HTMLCanvasElement.prototype.getContext; + HTMLCanvasElement.prototype.getContext = function (contextType, glAttribs) { + if (contextType === 'xrpresent') { + var _ctx = getContext.call(this, '2d', glAttribs); + return new XRPresentationContext(this, _ctx, glAttribs); + } + var ctx = getContext.call(this, contextType, glAttribs); + ctx[POLYFILLED_COMPATIBLE_XR_DEVICE] = true; + if (glAttribs && 'compatibleXRDevice' in glAttribs) { + ctx[COMPATIBLE_XR_DEVICE] = glAttribs.compatibleXRDevice; + } + return ctx; + }; +}; + +var isMobile = function isMobile(global) { + var check = false; + (function (a) { + if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; + })(global.navigator.userAgent || global.navigator.vendor || global.opera); + return check; +}; +var applyCanvasStylesForMinimalRendering = function applyCanvasStylesForMinimalRendering(canvas) { + canvas.style.display = 'block'; + canvas.style.position = 'absolute'; + canvas.style.width = canvas.style.height = '1px'; + canvas.style.top = canvas.style.left = '0px'; +}; + +var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + + +function unwrapExports (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +var cardboardVrDisplay = createCommonjsModule(function (module, exports) { +(function (global, factory) { + module.exports = factory(); +}(commonjsGlobal, (function () { var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); +var slicedToArray = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + return _arr; + } + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; +}(); +var MIN_TIMESTEP = 0.001; +var MAX_TIMESTEP = 1; +var base64 = function base64(mimeType, _base) { + return 'data:' + mimeType + ';base64,' + _base; +}; +var lerp = function lerp(a, b, t) { + return a + (b - a) * t; +}; +var isIOS = function () { + var isIOS = /iPad|iPhone|iPod/.test(navigator.platform); + return function () { + return isIOS; + }; +}(); +var isWebViewAndroid = function () { + var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 && navigator.userAgent.indexOf('Android') !== -1 && navigator.userAgent.indexOf('Chrome') !== -1; + return function () { + return isWebViewAndroid; + }; +}(); +var isSafari = function () { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + return function () { + return isSafari; + }; +}(); +var isFirefoxAndroid = function () { + var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 && navigator.userAgent.indexOf('Android') !== -1; + return function () { + return isFirefoxAndroid; + }; +}(); +var getChromeVersion = function () { + var match = navigator.userAgent.match(/.*Chrome\/([0-9]+)/); + var value = match ? parseInt(match[1], 10) : null; + return function () { + return value; + }; +}(); +var isChromeWithoutDeviceMotion = function () { + var value = false; + if (getChromeVersion() === 65) { + var match = navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/); + if (match) { + var _match$1$split = match[1].split('.'), + _match$1$split2 = slicedToArray(_match$1$split, 4), + major = _match$1$split2[0], + minor = _match$1$split2[1], + branch = _match$1$split2[2], + build = _match$1$split2[3]; + value = parseInt(branch, 10) === 3325 && parseInt(build, 10) < 148; + } + } + return function () { + return value; + }; +}(); +var isR7 = function () { + var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1; + return function () { + return isR7; + }; +}(); +var isLandscapeMode = function isLandscapeMode() { + var rtn = window.orientation == 90 || window.orientation == -90; + return isR7() ? !rtn : rtn; +}; +var isTimestampDeltaValid = function isTimestampDeltaValid(timestampDeltaS) { + if (isNaN(timestampDeltaS)) { + return false; + } + if (timestampDeltaS <= MIN_TIMESTEP) { + return false; + } + if (timestampDeltaS > MAX_TIMESTEP) { + return false; + } + return true; +}; +var getScreenWidth = function getScreenWidth() { + return Math.max(window.screen.width, window.screen.height) * window.devicePixelRatio; +}; +var getScreenHeight = function getScreenHeight() { + return Math.min(window.screen.width, window.screen.height) * window.devicePixelRatio; +}; +var requestFullscreen = function requestFullscreen(element) { + if (isWebViewAndroid()) { + return false; + } + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else { + return false; + } + return true; +}; +var exitFullscreen = function exitFullscreen() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else { + return false; + } + return true; +}; +var getFullscreenElement = function getFullscreenElement() { + return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; +}; +var linkProgram = function linkProgram(gl, vertexSource, fragmentSource, attribLocationMap) { + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, vertexSource); + gl.compileShader(vertexShader); + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, fragmentSource); + gl.compileShader(fragmentShader); + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + for (var attribName in attribLocationMap) { + gl.bindAttribLocation(program, attribLocationMap[attribName], attribName); + }gl.linkProgram(program); + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + return program; +}; +var getProgramUniforms = function getProgramUniforms(gl, program) { + var uniforms = {}; + var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + var uniformName = ''; + for (var i = 0; i < uniformCount; i++) { + var uniformInfo = gl.getActiveUniform(program, i); + uniformName = uniformInfo.name.replace('[0]', ''); + uniforms[uniformName] = gl.getUniformLocation(program, uniformName); + } + return uniforms; +}; +var orthoMatrix = function orthoMatrix(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; +var isMobile = function isMobile() { + var check = false; + (function (a) { + if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; + })(navigator.userAgent || navigator.vendor || window.opera); + return check; +}; +var extend = function extend(dest, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dest[key] = src[key]; + } + } + return dest; +}; +var safariCssSizeWorkaround = function safariCssSizeWorkaround(canvas) { + if (isIOS()) { + var width = canvas.style.width; + var height = canvas.style.height; + canvas.style.width = parseInt(width) + 1 + 'px'; + canvas.style.height = parseInt(height) + 'px'; + setTimeout(function () { + canvas.style.width = width; + canvas.style.height = height; + }, 100); + } + window.canvas = canvas; +}; +var frameDataFromPose = function () { + var piOver180 = Math.PI / 180.0; + var rad45 = Math.PI * 0.25; + function mat4_perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov ? fov.upDegrees * piOver180 : rad45), + downTan = Math.tan(fov ? fov.downDegrees * piOver180 : rad45), + leftTan = Math.tan(fov ? fov.leftDegrees * piOver180 : rad45), + rightTan = Math.tan(fov ? fov.rightDegrees * piOver180 : rad45), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = far * near / (near - far); + out[15] = 0.0; + return out; + } + function mat4_fromRotationTranslation(out, q, v) { + var x = q[0], + y = q[1], + z = q[2], + w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + function mat4_translate(out, a, v) { + var x = v[0], + y = v[1], + z = v[2], + a00, + a01, + a02, + a03, + a10, + a11, + a12, + a13, + a20, + a21, + a22, + a23; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0];a01 = a[1];a02 = a[2];a03 = a[3]; + a10 = a[4];a11 = a[5];a12 = a[6];a13 = a[7]; + a20 = a[8];a21 = a[9];a22 = a[10];a23 = a[11]; + out[0] = a00;out[1] = a01;out[2] = a02;out[3] = a03; + out[4] = a10;out[5] = a11;out[6] = a12;out[7] = a13; + out[8] = a20;out[9] = a21;out[10] = a22;out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + function mat4_invert(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11], + a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15], + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1.0 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + var defaultOrientation = new Float32Array([0, 0, 0, 1]); + var defaultPosition = new Float32Array([0, 0, 0]); + function updateEyeMatrices(projection, view, pose, fov, offset, vrDisplay) { + mat4_perspectiveFromFieldOfView(projection, fov || null, vrDisplay.depthNear, vrDisplay.depthFar); + var orientation = pose.orientation || defaultOrientation; + var position = pose.position || defaultPosition; + mat4_fromRotationTranslation(view, orientation, position); + if (offset) mat4_translate(view, view, offset); + mat4_invert(view, view); + } + return function (frameData, pose, vrDisplay) { + if (!frameData || !pose) return false; + frameData.pose = pose; + frameData.timestamp = pose.timestamp; + updateEyeMatrices(frameData.leftProjectionMatrix, frameData.leftViewMatrix, pose, vrDisplay._getFieldOfView("left"), vrDisplay._getEyeOffset("left"), vrDisplay); + updateEyeMatrices(frameData.rightProjectionMatrix, frameData.rightViewMatrix, pose, vrDisplay._getFieldOfView("right"), vrDisplay._getEyeOffset("right"), vrDisplay); + return true; + }; +}(); +var isInsideCrossOriginIFrame = function isInsideCrossOriginIFrame() { + var isFramed = window.self !== window.top; + var refOrigin = getOriginFromUrl(document.referrer); + var thisOrigin = getOriginFromUrl(window.location.href); + return isFramed && refOrigin !== thisOrigin; +}; +var getOriginFromUrl = function getOriginFromUrl(url) { + var domainIdx; + var protoSepIdx = url.indexOf("://"); + if (protoSepIdx !== -1) { + domainIdx = protoSepIdx + 3; + } else { + domainIdx = 0; + } + var domainEndIdx = url.indexOf('/', domainIdx); + if (domainEndIdx === -1) { + domainEndIdx = url.length; + } + return url.substring(0, domainEndIdx); +}; +var getQuaternionAngle = function getQuaternionAngle(quat) { + if (quat.w > 1) { + console.warn('getQuaternionAngle: w > 1'); + return 0; + } + var angle = 2 * Math.acos(quat.w); + return angle; +}; +var warnOnce = function () { + var observedWarnings = {}; + return function (key, message) { + if (observedWarnings[key] === undefined) { + console.warn('webvr-polyfill: ' + message); + observedWarnings[key] = true; + } + }; +}(); +var deprecateWarning = function deprecateWarning(deprecated, suggested) { + var alternative = suggested ? 'Please use ' + suggested + ' instead.' : ''; + warnOnce(deprecated, deprecated + ' has been deprecated. ' + 'This may not work on native WebVR displays. ' + alternative); +}; +function WGLUPreserveGLState(gl, bindings, callback) { + if (!bindings) { + callback(gl); + return; + } + var boundValues = []; + var activeTexture = null; + for (var i = 0; i < bindings.length; ++i) { + var binding = bindings[i]; + switch (binding) { + case gl.TEXTURE_BINDING_2D: + case gl.TEXTURE_BINDING_CUBE_MAP: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) { + console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"); + boundValues.push(null, null); + break; + } + if (!activeTexture) { + activeTexture = gl.getParameter(gl.ACTIVE_TEXTURE); + } + gl.activeTexture(textureUnit); + boundValues.push(gl.getParameter(binding), null); + break; + case gl.ACTIVE_TEXTURE: + activeTexture = gl.getParameter(gl.ACTIVE_TEXTURE); + boundValues.push(null); + break; + default: + boundValues.push(gl.getParameter(binding)); + break; + } + } + callback(gl); + for (var i = 0; i < bindings.length; ++i) { + var binding = bindings[i]; + var boundValue = boundValues[i]; + switch (binding) { + case gl.ACTIVE_TEXTURE: + break; + case gl.ARRAY_BUFFER_BINDING: + gl.bindBuffer(gl.ARRAY_BUFFER, boundValue); + break; + case gl.COLOR_CLEAR_VALUE: + gl.clearColor(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.COLOR_WRITEMASK: + gl.colorMask(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.CURRENT_PROGRAM: + gl.useProgram(boundValue); + break; + case gl.ELEMENT_ARRAY_BUFFER_BINDING: + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, boundValue); + break; + case gl.FRAMEBUFFER_BINDING: + gl.bindFramebuffer(gl.FRAMEBUFFER, boundValue); + break; + case gl.RENDERBUFFER_BINDING: + gl.bindRenderbuffer(gl.RENDERBUFFER, boundValue); + break; + case gl.TEXTURE_BINDING_2D: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) + break; + gl.activeTexture(textureUnit); + gl.bindTexture(gl.TEXTURE_2D, boundValue); + break; + case gl.TEXTURE_BINDING_CUBE_MAP: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) + break; + gl.activeTexture(textureUnit); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, boundValue); + break; + case gl.VIEWPORT: + gl.viewport(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.BLEND: + case gl.CULL_FACE: + case gl.DEPTH_TEST: + case gl.SCISSOR_TEST: + case gl.STENCIL_TEST: + if (boundValue) { + gl.enable(binding); + } else { + gl.disable(binding); + } + break; + default: + console.log("No GL restore behavior for 0x" + binding.toString(16)); + break; + } + if (activeTexture) { + gl.activeTexture(activeTexture); + } + } +} +var glPreserveState = WGLUPreserveGLState; +var distortionVS = ['attribute vec2 position;', 'attribute vec3 texCoord;', 'varying vec2 vTexCoord;', 'uniform vec4 viewportOffsetScale[2];', 'void main() {', ' vec4 viewport = viewportOffsetScale[int(texCoord.z)];', ' vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;', ' gl_Position = vec4( position, 1.0, 1.0 );', '}'].join('\n'); +var distortionFS = ['precision mediump float;', 'uniform sampler2D diffuse;', 'varying vec2 vTexCoord;', 'void main() {', ' gl_FragColor = texture2D(diffuse, vTexCoord);', '}'].join('\n'); +function CardboardDistorter(gl, cardboardUI, bufferScale, dirtySubmitFrameBindings) { + this.gl = gl; + this.cardboardUI = cardboardUI; + this.bufferScale = bufferScale; + this.dirtySubmitFrameBindings = dirtySubmitFrameBindings; + this.ctxAttribs = gl.getContextAttributes(); + this.meshWidth = 20; + this.meshHeight = 20; + this.bufferWidth = gl.drawingBufferWidth; + this.bufferHeight = gl.drawingBufferHeight; + this.realBindFramebuffer = gl.bindFramebuffer; + this.realEnable = gl.enable; + this.realDisable = gl.disable; + this.realColorMask = gl.colorMask; + this.realClearColor = gl.clearColor; + this.realViewport = gl.viewport; + if (!isIOS()) { + this.realCanvasWidth = Object.getOwnPropertyDescriptor(gl.canvas.__proto__, 'width'); + this.realCanvasHeight = Object.getOwnPropertyDescriptor(gl.canvas.__proto__, 'height'); + } + this.isPatched = false; + this.lastBoundFramebuffer = null; + this.cullFace = false; + this.depthTest = false; + this.blend = false; + this.scissorTest = false; + this.stencilTest = false; + this.viewport = [0, 0, 0, 0]; + this.colorMask = [true, true, true, true]; + this.clearColor = [0, 0, 0, 0]; + this.attribs = { + position: 0, + texCoord: 1 + }; + this.program = linkProgram(gl, distortionVS, distortionFS, this.attribs); + this.uniforms = getProgramUniforms(gl, this.program); + this.viewportOffsetScale = new Float32Array(8); + this.setTextureBounds(); + this.vertexBuffer = gl.createBuffer(); + this.indexBuffer = gl.createBuffer(); + this.indexCount = 0; + this.renderTarget = gl.createTexture(); + this.framebuffer = gl.createFramebuffer(); + this.depthStencilBuffer = null; + this.depthBuffer = null; + this.stencilBuffer = null; + if (this.ctxAttribs.depth && this.ctxAttribs.stencil) { + this.depthStencilBuffer = gl.createRenderbuffer(); + } else if (this.ctxAttribs.depth) { + this.depthBuffer = gl.createRenderbuffer(); + } else if (this.ctxAttribs.stencil) { + this.stencilBuffer = gl.createRenderbuffer(); + } + this.patch(); + this.onResize(); +} +CardboardDistorter.prototype.destroy = function () { + var gl = this.gl; + this.unpatch(); + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); + gl.deleteBuffer(this.indexBuffer); + gl.deleteTexture(this.renderTarget); + gl.deleteFramebuffer(this.framebuffer); + if (this.depthStencilBuffer) { + gl.deleteRenderbuffer(this.depthStencilBuffer); + } + if (this.depthBuffer) { + gl.deleteRenderbuffer(this.depthBuffer); + } + if (this.stencilBuffer) { + gl.deleteRenderbuffer(this.stencilBuffer); + } + if (this.cardboardUI) { + this.cardboardUI.destroy(); + } +}; +CardboardDistorter.prototype.onResize = function () { + var gl = this.gl; + var self = this; + var glState = [gl.RENDERBUFFER_BINDING, gl.TEXTURE_BINDING_2D, gl.TEXTURE0]; + glPreserveState(gl, glState, function (gl) { + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, null); + if (self.scissorTest) { + self.realDisable.call(gl, gl.SCISSOR_TEST); + } + self.realColorMask.call(gl, true, true, true, true); + self.realViewport.call(gl, 0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + self.realClearColor.call(gl, 0, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.framebuffer); + gl.bindTexture(gl.TEXTURE_2D, self.renderTarget); + gl.texImage2D(gl.TEXTURE_2D, 0, self.ctxAttribs.alpha ? gl.RGBA : gl.RGB, self.bufferWidth, self.bufferHeight, 0, self.ctxAttribs.alpha ? gl.RGBA : gl.RGB, gl.UNSIGNED_BYTE, null); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, self.renderTarget, 0); + if (self.ctxAttribs.depth && self.ctxAttribs.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.depthStencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, self.depthStencilBuffer); + } else if (self.ctxAttribs.depth) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.depthBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, self.depthBuffer); + } else if (self.ctxAttribs.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.stencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.STENCIL_INDEX8, self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, self.stencilBuffer); + } + if (!gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE) { + console.error('Framebuffer incomplete!'); + } + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.lastBoundFramebuffer); + if (self.scissorTest) { + self.realEnable.call(gl, gl.SCISSOR_TEST); + } + self.realColorMask.apply(gl, self.colorMask); + self.realViewport.apply(gl, self.viewport); + self.realClearColor.apply(gl, self.clearColor); + }); + if (this.cardboardUI) { + this.cardboardUI.onResize(); + } +}; +CardboardDistorter.prototype.patch = function () { + if (this.isPatched) { + return; + } + var self = this; + var canvas = this.gl.canvas; + var gl = this.gl; + if (!isIOS()) { + canvas.width = getScreenWidth() * this.bufferScale; + canvas.height = getScreenHeight() * this.bufferScale; + Object.defineProperty(canvas, 'width', { + configurable: true, + enumerable: true, + get: function get() { + return self.bufferWidth; + }, + set: function set(value) { + self.bufferWidth = value; + self.realCanvasWidth.set.call(canvas, value); + self.onResize(); + } + }); + Object.defineProperty(canvas, 'height', { + configurable: true, + enumerable: true, + get: function get() { + return self.bufferHeight; + }, + set: function set(value) { + self.bufferHeight = value; + self.realCanvasHeight.set.call(canvas, value); + self.onResize(); + } + }); + } + this.lastBoundFramebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + if (this.lastBoundFramebuffer == null) { + this.lastBoundFramebuffer = this.framebuffer; + this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer); + } + this.gl.bindFramebuffer = function (target, framebuffer) { + self.lastBoundFramebuffer = framebuffer ? framebuffer : self.framebuffer; + self.realBindFramebuffer.call(gl, target, self.lastBoundFramebuffer); + }; + this.cullFace = gl.getParameter(gl.CULL_FACE); + this.depthTest = gl.getParameter(gl.DEPTH_TEST); + this.blend = gl.getParameter(gl.BLEND); + this.scissorTest = gl.getParameter(gl.SCISSOR_TEST); + this.stencilTest = gl.getParameter(gl.STENCIL_TEST); + gl.enable = function (pname) { + switch (pname) { + case gl.CULL_FACE: + self.cullFace = true;break; + case gl.DEPTH_TEST: + self.depthTest = true;break; + case gl.BLEND: + self.blend = true;break; + case gl.SCISSOR_TEST: + self.scissorTest = true;break; + case gl.STENCIL_TEST: + self.stencilTest = true;break; + } + self.realEnable.call(gl, pname); + }; + gl.disable = function (pname) { + switch (pname) { + case gl.CULL_FACE: + self.cullFace = false;break; + case gl.DEPTH_TEST: + self.depthTest = false;break; + case gl.BLEND: + self.blend = false;break; + case gl.SCISSOR_TEST: + self.scissorTest = false;break; + case gl.STENCIL_TEST: + self.stencilTest = false;break; + } + self.realDisable.call(gl, pname); + }; + this.colorMask = gl.getParameter(gl.COLOR_WRITEMASK); + gl.colorMask = function (r, g, b, a) { + self.colorMask[0] = r; + self.colorMask[1] = g; + self.colorMask[2] = b; + self.colorMask[3] = a; + self.realColorMask.call(gl, r, g, b, a); + }; + this.clearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE); + gl.clearColor = function (r, g, b, a) { + self.clearColor[0] = r; + self.clearColor[1] = g; + self.clearColor[2] = b; + self.clearColor[3] = a; + self.realClearColor.call(gl, r, g, b, a); + }; + this.viewport = gl.getParameter(gl.VIEWPORT); + gl.viewport = function (x, y, w, h) { + self.viewport[0] = x; + self.viewport[1] = y; + self.viewport[2] = w; + self.viewport[3] = h; + self.realViewport.call(gl, x, y, w, h); + }; + this.isPatched = true; + safariCssSizeWorkaround(canvas); +}; +CardboardDistorter.prototype.unpatch = function () { + if (!this.isPatched) { + return; + } + var gl = this.gl; + var canvas = this.gl.canvas; + if (!isIOS()) { + Object.defineProperty(canvas, 'width', this.realCanvasWidth); + Object.defineProperty(canvas, 'height', this.realCanvasHeight); + } + canvas.width = this.bufferWidth; + canvas.height = this.bufferHeight; + gl.bindFramebuffer = this.realBindFramebuffer; + gl.enable = this.realEnable; + gl.disable = this.realDisable; + gl.colorMask = this.realColorMask; + gl.clearColor = this.realClearColor; + gl.viewport = this.realViewport; + if (this.lastBoundFramebuffer == this.framebuffer) { + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + this.isPatched = false; + setTimeout(function () { + safariCssSizeWorkaround(canvas); + }, 1); +}; +CardboardDistorter.prototype.setTextureBounds = function (leftBounds, rightBounds) { + if (!leftBounds) { + leftBounds = [0, 0, 0.5, 1]; + } + if (!rightBounds) { + rightBounds = [0.5, 0, 0.5, 1]; + } + this.viewportOffsetScale[0] = leftBounds[0]; + this.viewportOffsetScale[1] = leftBounds[1]; + this.viewportOffsetScale[2] = leftBounds[2]; + this.viewportOffsetScale[3] = leftBounds[3]; + this.viewportOffsetScale[4] = rightBounds[0]; + this.viewportOffsetScale[5] = rightBounds[1]; + this.viewportOffsetScale[6] = rightBounds[2]; + this.viewportOffsetScale[7] = rightBounds[3]; +}; +CardboardDistorter.prototype.submitFrame = function () { + var gl = this.gl; + var self = this; + var glState = []; + if (!this.dirtySubmitFrameBindings) { + glState.push(gl.CURRENT_PROGRAM, gl.ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING, gl.TEXTURE_BINDING_2D, gl.TEXTURE0); + } + glPreserveState(gl, glState, function (gl) { + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, null); + if (self.cullFace) { + self.realDisable.call(gl, gl.CULL_FACE); + } + if (self.depthTest) { + self.realDisable.call(gl, gl.DEPTH_TEST); + } + if (self.blend) { + self.realDisable.call(gl, gl.BLEND); + } + if (self.scissorTest) { + self.realDisable.call(gl, gl.SCISSOR_TEST); + } + if (self.stencilTest) { + self.realDisable.call(gl, gl.STENCIL_TEST); + } + self.realColorMask.call(gl, true, true, true, true); + self.realViewport.call(gl, 0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + if (self.ctxAttribs.alpha || isIOS()) { + self.realClearColor.call(gl, 0, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + } + gl.useProgram(self.program); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, self.indexBuffer); + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.enableVertexAttribArray(self.attribs.position); + gl.enableVertexAttribArray(self.attribs.texCoord); + gl.vertexAttribPointer(self.attribs.position, 2, gl.FLOAT, false, 20, 0); + gl.vertexAttribPointer(self.attribs.texCoord, 3, gl.FLOAT, false, 20, 8); + gl.activeTexture(gl.TEXTURE0); + gl.uniform1i(self.uniforms.diffuse, 0); + gl.bindTexture(gl.TEXTURE_2D, self.renderTarget); + gl.uniform4fv(self.uniforms.viewportOffsetScale, self.viewportOffsetScale); + gl.drawElements(gl.TRIANGLES, self.indexCount, gl.UNSIGNED_SHORT, 0); + if (self.cardboardUI) { + self.cardboardUI.renderNoState(); + } + self.realBindFramebuffer.call(self.gl, gl.FRAMEBUFFER, self.framebuffer); + if (!self.ctxAttribs.preserveDrawingBuffer) { + self.realClearColor.call(gl, 0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + } + if (!self.dirtySubmitFrameBindings) { + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.lastBoundFramebuffer); + } + if (self.cullFace) { + self.realEnable.call(gl, gl.CULL_FACE); + } + if (self.depthTest) { + self.realEnable.call(gl, gl.DEPTH_TEST); + } + if (self.blend) { + self.realEnable.call(gl, gl.BLEND); + } + if (self.scissorTest) { + self.realEnable.call(gl, gl.SCISSOR_TEST); + } + if (self.stencilTest) { + self.realEnable.call(gl, gl.STENCIL_TEST); + } + self.realColorMask.apply(gl, self.colorMask); + self.realViewport.apply(gl, self.viewport); + if (self.ctxAttribs.alpha || !self.ctxAttribs.preserveDrawingBuffer) { + self.realClearColor.apply(gl, self.clearColor); + } + }); + if (isIOS()) { + var canvas = gl.canvas; + if (canvas.width != self.bufferWidth || canvas.height != self.bufferHeight) { + self.bufferWidth = canvas.width; + self.bufferHeight = canvas.height; + self.onResize(); + } + } +}; +CardboardDistorter.prototype.updateDeviceInfo = function (deviceInfo) { + var gl = this.gl; + var self = this; + var glState = [gl.ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING]; + glPreserveState(gl, glState, function (gl) { + var vertices = self.computeMeshVertices_(self.meshWidth, self.meshHeight, deviceInfo); + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + if (!self.indexCount) { + var indices = self.computeMeshIndices_(self.meshWidth, self.meshHeight); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, self.indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + self.indexCount = indices.length; + } + }); +}; +CardboardDistorter.prototype.computeMeshVertices_ = function (width, height, deviceInfo) { + var vertices = new Float32Array(2 * width * height * 5); + var lensFrustum = deviceInfo.getLeftEyeVisibleTanAngles(); + var noLensFrustum = deviceInfo.getLeftEyeNoLensTanAngles(); + var viewport = deviceInfo.getLeftEyeVisibleScreenRect(noLensFrustum); + var vidx = 0; + for (var e = 0; e < 2; e++) { + for (var j = 0; j < height; j++) { + for (var i = 0; i < width; i++, vidx++) { + var u = i / (width - 1); + var v = j / (height - 1); + var s = u; + var t = v; + var x = lerp(lensFrustum[0], lensFrustum[2], u); + var y = lerp(lensFrustum[3], lensFrustum[1], v); + var d = Math.sqrt(x * x + y * y); + var r = deviceInfo.distortion.distortInverse(d); + var p = x * r / d; + var q = y * r / d; + u = (p - noLensFrustum[0]) / (noLensFrustum[2] - noLensFrustum[0]); + v = (q - noLensFrustum[3]) / (noLensFrustum[1] - noLensFrustum[3]); + u = (viewport.x + u * viewport.width - 0.5) * 2.0; + v = (viewport.y + v * viewport.height - 0.5) * 2.0; + vertices[vidx * 5 + 0] = u; + vertices[vidx * 5 + 1] = v; + vertices[vidx * 5 + 2] = s; + vertices[vidx * 5 + 3] = t; + vertices[vidx * 5 + 4] = e; + } + } + var w = lensFrustum[2] - lensFrustum[0]; + lensFrustum[0] = -(w + lensFrustum[0]); + lensFrustum[2] = w - lensFrustum[2]; + w = noLensFrustum[2] - noLensFrustum[0]; + noLensFrustum[0] = -(w + noLensFrustum[0]); + noLensFrustum[2] = w - noLensFrustum[2]; + viewport.x = 1 - (viewport.x + viewport.width); + } + return vertices; +}; +CardboardDistorter.prototype.computeMeshIndices_ = function (width, height) { + var indices = new Uint16Array(2 * (width - 1) * (height - 1) * 6); + var halfwidth = width / 2; + var halfheight = height / 2; + var vidx = 0; + var iidx = 0; + for (var e = 0; e < 2; e++) { + for (var j = 0; j < height; j++) { + for (var i = 0; i < width; i++, vidx++) { + if (i == 0 || j == 0) continue; + if (i <= halfwidth == j <= halfheight) { + indices[iidx++] = vidx; + indices[iidx++] = vidx - width - 1; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx - width - 1; + indices[iidx++] = vidx; + indices[iidx++] = vidx - 1; + } else { + indices[iidx++] = vidx - 1; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx - 1; + indices[iidx++] = vidx - width - 1; + } + } + } + } + return indices; +}; +CardboardDistorter.prototype.getOwnPropertyDescriptor_ = function (proto, attrName) { + var descriptor = Object.getOwnPropertyDescriptor(proto, attrName); + if (descriptor.get === undefined || descriptor.set === undefined) { + descriptor.configurable = true; + descriptor.enumerable = true; + descriptor.get = function () { + return this.getAttribute(attrName); + }; + descriptor.set = function (val) { + this.setAttribute(attrName, val); + }; + } + return descriptor; +}; +var uiVS = ['attribute vec2 position;', 'uniform mat4 projectionMat;', 'void main() {', ' gl_Position = projectionMat * vec4( position, -1.0, 1.0 );', '}'].join('\n'); +var uiFS = ['precision mediump float;', 'uniform vec4 color;', 'void main() {', ' gl_FragColor = color;', '}'].join('\n'); +var DEG2RAD = Math.PI / 180.0; +var kAnglePerGearSection = 60; +var kOuterRimEndAngle = 12; +var kInnerRimBeginAngle = 20; +var kOuterRadius = 1; +var kMiddleRadius = 0.75; +var kInnerRadius = 0.3125; +var kCenterLineThicknessDp = 4; +var kButtonWidthDp = 28; +var kTouchSlopFactor = 1.5; +function CardboardUI(gl) { + this.gl = gl; + this.attribs = { + position: 0 + }; + this.program = linkProgram(gl, uiVS, uiFS, this.attribs); + this.uniforms = getProgramUniforms(gl, this.program); + this.vertexBuffer = gl.createBuffer(); + this.gearOffset = 0; + this.gearVertexCount = 0; + this.arrowOffset = 0; + this.arrowVertexCount = 0; + this.projMat = new Float32Array(16); + this.listener = null; + this.onResize(); +} +CardboardUI.prototype.destroy = function () { + var gl = this.gl; + if (this.listener) { + gl.canvas.removeEventListener('click', this.listener, false); + } + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); +}; +CardboardUI.prototype.listen = function (optionsCallback, backCallback) { + var canvas = this.gl.canvas; + this.listener = function (event) { + var midline = canvas.clientWidth / 2; + var buttonSize = kButtonWidthDp * kTouchSlopFactor; + if (event.clientX > midline - buttonSize && event.clientX < midline + buttonSize && event.clientY > canvas.clientHeight - buttonSize) { + optionsCallback(event); + } + else if (event.clientX < buttonSize && event.clientY < buttonSize) { + backCallback(event); + } + }; + canvas.addEventListener('click', this.listener, false); +}; +CardboardUI.prototype.onResize = function () { + var gl = this.gl; + var self = this; + var glState = [gl.ARRAY_BUFFER_BINDING]; + glPreserveState(gl, glState, function (gl) { + var vertices = []; + var midline = gl.drawingBufferWidth / 2; + var physicalPixels = Math.max(screen.width, screen.height) * window.devicePixelRatio; + var scalingRatio = gl.drawingBufferWidth / physicalPixels; + var dps = scalingRatio * window.devicePixelRatio; + var lineWidth = kCenterLineThicknessDp * dps / 2; + var buttonSize = kButtonWidthDp * kTouchSlopFactor * dps; + var buttonScale = kButtonWidthDp * dps / 2; + var buttonBorder = (kButtonWidthDp * kTouchSlopFactor - kButtonWidthDp) * dps; + vertices.push(midline - lineWidth, buttonSize); + vertices.push(midline - lineWidth, gl.drawingBufferHeight); + vertices.push(midline + lineWidth, buttonSize); + vertices.push(midline + lineWidth, gl.drawingBufferHeight); + self.gearOffset = vertices.length / 2; + function addGearSegment(theta, r) { + var angle = (90 - theta) * DEG2RAD; + var x = Math.cos(angle); + var y = Math.sin(angle); + vertices.push(kInnerRadius * x * buttonScale + midline, kInnerRadius * y * buttonScale + buttonScale); + vertices.push(r * x * buttonScale + midline, r * y * buttonScale + buttonScale); + } + for (var i = 0; i <= 6; i++) { + var segmentTheta = i * kAnglePerGearSection; + addGearSegment(segmentTheta, kOuterRadius); + addGearSegment(segmentTheta + kOuterRimEndAngle, kOuterRadius); + addGearSegment(segmentTheta + kInnerRimBeginAngle, kMiddleRadius); + addGearSegment(segmentTheta + (kAnglePerGearSection - kInnerRimBeginAngle), kMiddleRadius); + addGearSegment(segmentTheta + (kAnglePerGearSection - kOuterRimEndAngle), kOuterRadius); + } + self.gearVertexCount = vertices.length / 2 - self.gearOffset; + self.arrowOffset = vertices.length / 2; + function addArrowVertex(x, y) { + vertices.push(buttonBorder + x, gl.drawingBufferHeight - buttonBorder - y); + } + var angledLineWidth = lineWidth / Math.sin(45 * DEG2RAD); + addArrowVertex(0, buttonScale); + addArrowVertex(buttonScale, 0); + addArrowVertex(buttonScale + angledLineWidth, angledLineWidth); + addArrowVertex(angledLineWidth, buttonScale + angledLineWidth); + addArrowVertex(angledLineWidth, buttonScale - angledLineWidth); + addArrowVertex(0, buttonScale); + addArrowVertex(buttonScale, buttonScale * 2); + addArrowVertex(buttonScale + angledLineWidth, buttonScale * 2 - angledLineWidth); + addArrowVertex(angledLineWidth, buttonScale - angledLineWidth); + addArrowVertex(0, buttonScale); + addArrowVertex(angledLineWidth, buttonScale - lineWidth); + addArrowVertex(kButtonWidthDp * dps, buttonScale - lineWidth); + addArrowVertex(angledLineWidth, buttonScale + lineWidth); + addArrowVertex(kButtonWidthDp * dps, buttonScale + lineWidth); + self.arrowVertexCount = vertices.length / 2 - self.arrowOffset; + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); + }); +}; +CardboardUI.prototype.render = function () { + var gl = this.gl; + var self = this; + var glState = [gl.CULL_FACE, gl.DEPTH_TEST, gl.BLEND, gl.SCISSOR_TEST, gl.STENCIL_TEST, gl.COLOR_WRITEMASK, gl.VIEWPORT, gl.CURRENT_PROGRAM, gl.ARRAY_BUFFER_BINDING]; + glPreserveState(gl, glState, function (gl) { + gl.disable(gl.CULL_FACE); + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.BLEND); + gl.disable(gl.SCISSOR_TEST); + gl.disable(gl.STENCIL_TEST); + gl.colorMask(true, true, true, true); + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + self.renderNoState(); + }); +}; +CardboardUI.prototype.renderNoState = function () { + var gl = this.gl; + gl.useProgram(this.program); + gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer); + gl.enableVertexAttribArray(this.attribs.position); + gl.vertexAttribPointer(this.attribs.position, 2, gl.FLOAT, false, 8, 0); + gl.uniform4f(this.uniforms.color, 1.0, 1.0, 1.0, 1.0); + orthoMatrix(this.projMat, 0, gl.drawingBufferWidth, 0, gl.drawingBufferHeight, 0.1, 1024.0); + gl.uniformMatrix4fv(this.uniforms.projectionMat, false, this.projMat); + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); + gl.drawArrays(gl.TRIANGLE_STRIP, this.gearOffset, this.gearVertexCount); + gl.drawArrays(gl.TRIANGLE_STRIP, this.arrowOffset, this.arrowVertexCount); +}; +function Distortion(coefficients) { + this.coefficients = coefficients; +} +Distortion.prototype.distortInverse = function (radius) { + var r0 = 0; + var r1 = 1; + var dr0 = radius - this.distort(r0); + while (Math.abs(r1 - r0) > 0.0001 ) { + var dr1 = radius - this.distort(r1); + var r2 = r1 - dr1 * ((r1 - r0) / (dr1 - dr0)); + r0 = r1; + r1 = r2; + dr0 = dr1; + } + return r1; +}; +Distortion.prototype.distort = function (radius) { + var r2 = radius * radius; + var ret = 0; + for (var i = 0; i < this.coefficients.length; i++) { + ret = r2 * (ret + this.coefficients[i]); + } + return (ret + 1) * radius; +}; +var degToRad = Math.PI / 180; +var radToDeg = 180 / Math.PI; +var Vector3 = function Vector3(x, y, z) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; +}; +Vector3.prototype = { + constructor: Vector3, + set: function set(x, y, z) { + this.x = x; + this.y = y; + this.z = z; + return this; + }, + copy: function copy(v) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + return this; + }, + length: function length() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + }, + normalize: function normalize() { + var scalar = this.length(); + if (scalar !== 0) { + var invScalar = 1 / scalar; + this.multiplyScalar(invScalar); + } else { + this.x = 0; + this.y = 0; + this.z = 0; + } + return this; + }, + multiplyScalar: function multiplyScalar(scalar) { + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; + }, + applyQuaternion: function applyQuaternion(q) { + var x = this.x; + var y = this.y; + var z = this.z; + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; + this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; + this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; + this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; + return this; + }, + dot: function dot(v) { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + crossVectors: function crossVectors(a, b) { + var ax = a.x, + ay = a.y, + az = a.z; + var bx = b.x, + by = b.y, + bz = b.z; + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + return this; + } +}; +var Quaternion = function Quaternion(x, y, z, w) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w !== undefined ? w : 1; +}; +Quaternion.prototype = { + constructor: Quaternion, + set: function set(x, y, z, w) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + return this; + }, + copy: function copy(quaternion) { + this.x = quaternion.x; + this.y = quaternion.y; + this.z = quaternion.z; + this.w = quaternion.w; + return this; + }, + setFromEulerXYZ: function setFromEulerXYZ(x, y, z) { + var c1 = Math.cos(x / 2); + var c2 = Math.cos(y / 2); + var c3 = Math.cos(z / 2); + var s1 = Math.sin(x / 2); + var s2 = Math.sin(y / 2); + var s3 = Math.sin(z / 2); + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 + s1 * s2 * c3; + this.w = c1 * c2 * c3 - s1 * s2 * s3; + return this; + }, + setFromEulerYXZ: function setFromEulerYXZ(x, y, z) { + var c1 = Math.cos(x / 2); + var c2 = Math.cos(y / 2); + var c3 = Math.cos(z / 2); + var s1 = Math.sin(x / 2); + var s2 = Math.sin(y / 2); + var s3 = Math.sin(z / 2); + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 - s1 * s2 * c3; + this.w = c1 * c2 * c3 + s1 * s2 * s3; + return this; + }, + setFromAxisAngle: function setFromAxisAngle(axis, angle) { + var halfAngle = angle / 2, + s = Math.sin(halfAngle); + this.x = axis.x * s; + this.y = axis.y * s; + this.z = axis.z * s; + this.w = Math.cos(halfAngle); + return this; + }, + multiply: function multiply(q) { + return this.multiplyQuaternions(this, q); + }, + multiplyQuaternions: function multiplyQuaternions(a, b) { + var qax = a.x, + qay = a.y, + qaz = a.z, + qaw = a.w; + var qbx = b.x, + qby = b.y, + qbz = b.z, + qbw = b.w; + this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; + this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; + this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; + this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; + return this; + }, + inverse: function inverse() { + this.x *= -1; + this.y *= -1; + this.z *= -1; + this.normalize(); + return this; + }, + normalize: function normalize() { + var l = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + if (l === 0) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } else { + l = 1 / l; + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + return this; + }, + slerp: function slerp(qb, t) { + if (t === 0) return this; + if (t === 1) return this.copy(qb); + var x = this.x, + y = this.y, + z = this.z, + w = this.w; + var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z; + if (cosHalfTheta < 0) { + this.w = -qb.w; + this.x = -qb.x; + this.y = -qb.y; + this.z = -qb.z; + cosHalfTheta = -cosHalfTheta; + } else { + this.copy(qb); + } + if (cosHalfTheta >= 1.0) { + this.w = w; + this.x = x; + this.y = y; + this.z = z; + return this; + } + var halfTheta = Math.acos(cosHalfTheta); + var sinHalfTheta = Math.sqrt(1.0 - cosHalfTheta * cosHalfTheta); + if (Math.abs(sinHalfTheta) < 0.001) { + this.w = 0.5 * (w + this.w); + this.x = 0.5 * (x + this.x); + this.y = 0.5 * (y + this.y); + this.z = 0.5 * (z + this.z); + return this; + } + var ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, + ratioB = Math.sin(t * halfTheta) / sinHalfTheta; + this.w = w * ratioA + this.w * ratioB; + this.x = x * ratioA + this.x * ratioB; + this.y = y * ratioA + this.y * ratioB; + this.z = z * ratioA + this.z * ratioB; + return this; + }, + setFromUnitVectors: function () { + var v1, r; + var EPS = 0.000001; + return function (vFrom, vTo) { + if (v1 === undefined) v1 = new Vector3(); + r = vFrom.dot(vTo) + 1; + if (r < EPS) { + r = 0; + if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) { + v1.set(-vFrom.y, vFrom.x, 0); + } else { + v1.set(0, -vFrom.z, vFrom.y); + } + } else { + v1.crossVectors(vFrom, vTo); + } + this.x = v1.x; + this.y = v1.y; + this.z = v1.z; + this.w = r; + this.normalize(); + return this; + }; + }() +}; +function Device(params) { + this.width = params.width || getScreenWidth(); + this.height = params.height || getScreenHeight(); + this.widthMeters = params.widthMeters; + this.heightMeters = params.heightMeters; + this.bevelMeters = params.bevelMeters; +} +var DEFAULT_ANDROID = new Device({ + widthMeters: 0.110, + heightMeters: 0.062, + bevelMeters: 0.004 +}); +var DEFAULT_IOS = new Device({ + widthMeters: 0.1038, + heightMeters: 0.0584, + bevelMeters: 0.004 +}); +var Viewers = { + CardboardV1: new CardboardViewer({ + id: 'CardboardV1', + label: 'Cardboard I/O 2014', + fov: 40, + interLensDistance: 0.060, + baselineLensDistance: 0.035, + screenLensDistance: 0.042, + distortionCoefficients: [0.441, 0.156], + inverseCoefficients: [-0.4410035, 0.42756155, -0.4804439, 0.5460139, -0.58821183, 0.5733938, -0.48303202, 0.33299083, -0.17573841, 0.0651772, -0.01488963, 0.001559834] + }), + CardboardV2: new CardboardViewer({ + id: 'CardboardV2', + label: 'Cardboard I/O 2015', + fov: 60, + interLensDistance: 0.064, + baselineLensDistance: 0.035, + screenLensDistance: 0.039, + distortionCoefficients: [0.34, 0.55], + inverseCoefficients: [-0.33836704, -0.18162185, 0.862655, -1.2462051, 1.0560602, -0.58208317, 0.21609078, -0.05444823, 0.009177956, -9.904169E-4, 6.183535E-5, -1.6981803E-6] + }) +}; +function DeviceInfo(deviceParams) { + this.viewer = Viewers.CardboardV2; + this.updateDeviceParams(deviceParams); + this.distortion = new Distortion(this.viewer.distortionCoefficients); +} +DeviceInfo.prototype.updateDeviceParams = function (deviceParams) { + this.device = this.determineDevice_(deviceParams) || this.device; +}; +DeviceInfo.prototype.getDevice = function () { + return this.device; +}; +DeviceInfo.prototype.setViewer = function (viewer) { + this.viewer = viewer; + this.distortion = new Distortion(this.viewer.distortionCoefficients); +}; +DeviceInfo.prototype.determineDevice_ = function (deviceParams) { + if (!deviceParams) { + if (isIOS()) { + console.warn('Using fallback iOS device measurements.'); + return DEFAULT_IOS; + } else { + console.warn('Using fallback Android device measurements.'); + return DEFAULT_ANDROID; + } + } + var METERS_PER_INCH = 0.0254; + var metersPerPixelX = METERS_PER_INCH / deviceParams.xdpi; + var metersPerPixelY = METERS_PER_INCH / deviceParams.ydpi; + var width = getScreenWidth(); + var height = getScreenHeight(); + return new Device({ + widthMeters: metersPerPixelX * width, + heightMeters: metersPerPixelY * height, + bevelMeters: deviceParams.bevelMm * 0.001 + }); +}; +DeviceInfo.prototype.getDistortedFieldOfViewLeftEye = function () { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + var eyeToScreenDistance = viewer.screenLensDistance; + var outerDist = (device.widthMeters - viewer.interLensDistance) / 2; + var innerDist = viewer.interLensDistance / 2; + var bottomDist = viewer.baselineLensDistance - device.bevelMeters; + var topDist = device.heightMeters - bottomDist; + var outerAngle = radToDeg * Math.atan(distortion.distort(outerDist / eyeToScreenDistance)); + var innerAngle = radToDeg * Math.atan(distortion.distort(innerDist / eyeToScreenDistance)); + var bottomAngle = radToDeg * Math.atan(distortion.distort(bottomDist / eyeToScreenDistance)); + var topAngle = radToDeg * Math.atan(distortion.distort(topDist / eyeToScreenDistance)); + return { + leftDegrees: Math.min(outerAngle, viewer.fov), + rightDegrees: Math.min(innerAngle, viewer.fov), + downDegrees: Math.min(bottomAngle, viewer.fov), + upDegrees: Math.min(topAngle, viewer.fov) + }; +}; +DeviceInfo.prototype.getLeftEyeVisibleTanAngles = function () { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + var fovLeft = Math.tan(-degToRad * viewer.fov); + var fovTop = Math.tan(degToRad * viewer.fov); + var fovRight = Math.tan(degToRad * viewer.fov); + var fovBottom = Math.tan(-degToRad * viewer.fov); + var halfWidth = device.widthMeters / 4; + var halfHeight = device.heightMeters / 2; + var verticalLensOffset = viewer.baselineLensDistance - device.bevelMeters - halfHeight; + var centerX = viewer.interLensDistance / 2 - halfWidth; + var centerY = -verticalLensOffset; + var centerZ = viewer.screenLensDistance; + var screenLeft = distortion.distort((centerX - halfWidth) / centerZ); + var screenTop = distortion.distort((centerY + halfHeight) / centerZ); + var screenRight = distortion.distort((centerX + halfWidth) / centerZ); + var screenBottom = distortion.distort((centerY - halfHeight) / centerZ); + var result = new Float32Array(4); + result[0] = Math.max(fovLeft, screenLeft); + result[1] = Math.min(fovTop, screenTop); + result[2] = Math.min(fovRight, screenRight); + result[3] = Math.max(fovBottom, screenBottom); + return result; +}; +DeviceInfo.prototype.getLeftEyeNoLensTanAngles = function () { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + var result = new Float32Array(4); + var fovLeft = distortion.distortInverse(Math.tan(-degToRad * viewer.fov)); + var fovTop = distortion.distortInverse(Math.tan(degToRad * viewer.fov)); + var fovRight = distortion.distortInverse(Math.tan(degToRad * viewer.fov)); + var fovBottom = distortion.distortInverse(Math.tan(-degToRad * viewer.fov)); + var halfWidth = device.widthMeters / 4; + var halfHeight = device.heightMeters / 2; + var verticalLensOffset = viewer.baselineLensDistance - device.bevelMeters - halfHeight; + var centerX = viewer.interLensDistance / 2 - halfWidth; + var centerY = -verticalLensOffset; + var centerZ = viewer.screenLensDistance; + var screenLeft = (centerX - halfWidth) / centerZ; + var screenTop = (centerY + halfHeight) / centerZ; + var screenRight = (centerX + halfWidth) / centerZ; + var screenBottom = (centerY - halfHeight) / centerZ; + result[0] = Math.max(fovLeft, screenLeft); + result[1] = Math.min(fovTop, screenTop); + result[2] = Math.min(fovRight, screenRight); + result[3] = Math.max(fovBottom, screenBottom); + return result; +}; +DeviceInfo.prototype.getLeftEyeVisibleScreenRect = function (undistortedFrustum) { + var viewer = this.viewer; + var device = this.device; + var dist = viewer.screenLensDistance; + var eyeX = (device.widthMeters - viewer.interLensDistance) / 2; + var eyeY = viewer.baselineLensDistance - device.bevelMeters; + var left = (undistortedFrustum[0] * dist + eyeX) / device.widthMeters; + var top = (undistortedFrustum[1] * dist + eyeY) / device.heightMeters; + var right = (undistortedFrustum[2] * dist + eyeX) / device.widthMeters; + var bottom = (undistortedFrustum[3] * dist + eyeY) / device.heightMeters; + return { + x: left, + y: bottom, + width: right - left, + height: top - bottom + }; +}; +DeviceInfo.prototype.getFieldOfViewLeftEye = function (opt_isUndistorted) { + return opt_isUndistorted ? this.getUndistortedFieldOfViewLeftEye() : this.getDistortedFieldOfViewLeftEye(); +}; +DeviceInfo.prototype.getFieldOfViewRightEye = function (opt_isUndistorted) { + var fov = this.getFieldOfViewLeftEye(opt_isUndistorted); + return { + leftDegrees: fov.rightDegrees, + rightDegrees: fov.leftDegrees, + upDegrees: fov.upDegrees, + downDegrees: fov.downDegrees + }; +}; +DeviceInfo.prototype.getUndistortedFieldOfViewLeftEye = function () { + var p = this.getUndistortedParams_(); + return { + leftDegrees: radToDeg * Math.atan(p.outerDist), + rightDegrees: radToDeg * Math.atan(p.innerDist), + downDegrees: radToDeg * Math.atan(p.bottomDist), + upDegrees: radToDeg * Math.atan(p.topDist) + }; +}; +DeviceInfo.prototype.getUndistortedViewportLeftEye = function () { + var p = this.getUndistortedParams_(); + var viewer = this.viewer; + var device = this.device; + var eyeToScreenDistance = viewer.screenLensDistance; + var screenWidth = device.widthMeters / eyeToScreenDistance; + var screenHeight = device.heightMeters / eyeToScreenDistance; + var xPxPerTanAngle = device.width / screenWidth; + var yPxPerTanAngle = device.height / screenHeight; + var x = Math.round((p.eyePosX - p.outerDist) * xPxPerTanAngle); + var y = Math.round((p.eyePosY - p.bottomDist) * yPxPerTanAngle); + return { + x: x, + y: y, + width: Math.round((p.eyePosX + p.innerDist) * xPxPerTanAngle) - x, + height: Math.round((p.eyePosY + p.topDist) * yPxPerTanAngle) - y + }; +}; +DeviceInfo.prototype.getUndistortedParams_ = function () { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + var eyeToScreenDistance = viewer.screenLensDistance; + var halfLensDistance = viewer.interLensDistance / 2 / eyeToScreenDistance; + var screenWidth = device.widthMeters / eyeToScreenDistance; + var screenHeight = device.heightMeters / eyeToScreenDistance; + var eyePosX = screenWidth / 2 - halfLensDistance; + var eyePosY = (viewer.baselineLensDistance - device.bevelMeters) / eyeToScreenDistance; + var maxFov = viewer.fov; + var viewerMax = distortion.distortInverse(Math.tan(degToRad * maxFov)); + var outerDist = Math.min(eyePosX, viewerMax); + var innerDist = Math.min(halfLensDistance, viewerMax); + var bottomDist = Math.min(eyePosY, viewerMax); + var topDist = Math.min(screenHeight - eyePosY, viewerMax); + return { + outerDist: outerDist, + innerDist: innerDist, + topDist: topDist, + bottomDist: bottomDist, + eyePosX: eyePosX, + eyePosY: eyePosY + }; +}; +function CardboardViewer(params) { + this.id = params.id; + this.label = params.label; + this.fov = params.fov; + this.interLensDistance = params.interLensDistance; + this.baselineLensDistance = params.baselineLensDistance; + this.screenLensDistance = params.screenLensDistance; + this.distortionCoefficients = params.distortionCoefficients; + this.inverseCoefficients = params.inverseCoefficients; +} +DeviceInfo.Viewers = Viewers; +var format = 1; +var last_updated = "2017-09-12T18:54:02Z"; +var devices = [{"type":"android","rules":[{"mdmh":"asus/*/Nexus 7/*"},{"ua":"Nexus 7"}],"dpi":[320.8,323],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"asus/*/ASUS_Z00AD/*"},{"ua":"ASUS_Z00AD"}],"dpi":[403,404.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Google/*/Pixel XL/*"},{"ua":"Pixel XL"}],"dpi":[537.9,533],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Google/*/Pixel/*"},{"ua":"Pixel"}],"dpi":[432.6,436.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"HTC/*/HTC6435LVW/*"},{"ua":"HTC6435LVW"}],"dpi":[449.7,443.3],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"HTC/*/HTC One XL/*"},{"ua":"HTC One XL"}],"dpi":[315.3,314.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"htc/*/Nexus 9/*"},{"ua":"Nexus 9"}],"dpi":289,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"HTC/*/HTC One M9/*"},{"ua":"HTC One M9"}],"dpi":[442.5,443.3],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"HTC/*/HTC One_M8/*"},{"ua":"HTC One_M8"}],"dpi":[449.7,447.4],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"HTC/*/HTC One/*"},{"ua":"HTC One"}],"dpi":472.8,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Huawei/*/Nexus 6P/*"},{"ua":"Nexus 6P"}],"dpi":[515.1,518],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LENOVO/*/Lenovo PB2-690Y/*"},{"ua":"Lenovo PB2-690Y"}],"dpi":[457.2,454.713],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"LGE/*/Nexus 5X/*"},{"ua":"Nexus 5X"}],"dpi":[422,419.9],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/LGMS345/*"},{"ua":"LGMS345"}],"dpi":[221.7,219.1],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"LGE/*/LG-D800/*"},{"ua":"LG-D800"}],"dpi":[422,424.1],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"LGE/*/LG-D850/*"},{"ua":"LG-D850"}],"dpi":[537.9,541.9],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"LGE/*/VS985 4G/*"},{"ua":"VS985 4G"}],"dpi":[537.9,535.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/Nexus 5/*"},{"ua":"Nexus 5 B"}],"dpi":[442.4,444.8],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/Nexus 4/*"},{"ua":"Nexus 4"}],"dpi":[319.8,318.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/LG-P769/*"},{"ua":"LG-P769"}],"dpi":[240.6,247.5],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/LGMS323/*"},{"ua":"LGMS323"}],"dpi":[206.6,204.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/LGLS996/*"},{"ua":"LGLS996"}],"dpi":[403.4,401.5],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Micromax/*/4560MMX/*"},{"ua":"4560MMX"}],"dpi":[240,219.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Micromax/*/A250/*"},{"ua":"Micromax A250"}],"dpi":[480,446.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Micromax/*/Micromax AQ4501/*"},{"ua":"Micromax AQ4501"}],"dpi":240,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/G5/*"},{"ua":"Moto G (5) Plus"}],"dpi":[403.4,403],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/DROID RAZR/*"},{"ua":"DROID RAZR"}],"dpi":[368.1,256.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT830C/*"},{"ua":"XT830C"}],"dpi":[254,255.9],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1021/*"},{"ua":"XT1021"}],"dpi":[254,256.7],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1023/*"},{"ua":"XT1023"}],"dpi":[254,256.7],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1028/*"},{"ua":"XT1028"}],"dpi":[326.6,327.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1034/*"},{"ua":"XT1034"}],"dpi":[326.6,328.4],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1053/*"},{"ua":"XT1053"}],"dpi":[315.3,316.1],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1562/*"},{"ua":"XT1562"}],"dpi":[403.4,402.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/Nexus 6/*"},{"ua":"Nexus 6 B"}],"dpi":[494.3,489.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1063/*"},{"ua":"XT1063"}],"dpi":[295,296.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1064/*"},{"ua":"XT1064"}],"dpi":[295,295.6],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1092/*"},{"ua":"XT1092"}],"dpi":[422,424.1],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1095/*"},{"ua":"XT1095"}],"dpi":[422,423.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/G4/*"},{"ua":"Moto G (4)"}],"dpi":401,"bw":4,"ac":1000},{"type":"android","rules":[{"mdmh":"OnePlus/*/A0001/*"},{"ua":"A0001"}],"dpi":[403.4,401],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"OnePlus/*/ONE E1005/*"},{"ua":"ONE E1005"}],"dpi":[442.4,441.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"OnePlus/*/ONE A2005/*"},{"ua":"ONE A2005"}],"dpi":[391.9,405.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"OPPO/*/X909/*"},{"ua":"X909"}],"dpi":[442.4,444.1],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9082/*"},{"ua":"GT-I9082"}],"dpi":[184.7,185.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G360P/*"},{"ua":"SM-G360P"}],"dpi":[196.7,205.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/Nexus S/*"},{"ua":"Nexus S"}],"dpi":[234.5,229.8],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9300/*"},{"ua":"GT-I9300"}],"dpi":[304.8,303.9],"bw":5,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-T230NU/*"},{"ua":"SM-T230NU"}],"dpi":216,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SGH-T399/*"},{"ua":"SGH-T399"}],"dpi":[217.7,231.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SGH-M919/*"},{"ua":"SGH-M919"}],"dpi":[440.8,437.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N9005/*"},{"ua":"SM-N9005"}],"dpi":[386.4,387],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SAMSUNG-SM-N900A/*"},{"ua":"SAMSUNG-SM-N900A"}],"dpi":[386.4,387.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9500/*"},{"ua":"GT-I9500"}],"dpi":[442.5,443.3],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9505/*"},{"ua":"GT-I9505"}],"dpi":439.4,"bw":4,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G900F/*"},{"ua":"SM-G900F"}],"dpi":[415.6,431.6],"bw":5,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G900M/*"},{"ua":"SM-G900M"}],"dpi":[415.6,431.6],"bw":5,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G800F/*"},{"ua":"SM-G800F"}],"dpi":326.8,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G906S/*"},{"ua":"SM-G906S"}],"dpi":[562.7,572.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9300/*"},{"ua":"GT-I9300"}],"dpi":[306.7,304.8],"bw":5,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-T535/*"},{"ua":"SM-T535"}],"dpi":[142.6,136.4],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N920C/*"},{"ua":"SM-N920C"}],"dpi":[515.1,518.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N920P/*"},{"ua":"SM-N920P"}],"dpi":[386.3655,390.144],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N920W8/*"},{"ua":"SM-N920W8"}],"dpi":[515.1,518.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9300I/*"},{"ua":"GT-I9300I"}],"dpi":[304.8,305.8],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9195/*"},{"ua":"GT-I9195"}],"dpi":[249.4,256.7],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SPH-L520/*"},{"ua":"SPH-L520"}],"dpi":[249.4,255.9],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SAMSUNG-SGH-I717/*"},{"ua":"SAMSUNG-SGH-I717"}],"dpi":285.8,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SPH-D710/*"},{"ua":"SPH-D710"}],"dpi":[217.7,204.2],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-N7100/*"},{"ua":"GT-N7100"}],"dpi":265.1,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SCH-I605/*"},{"ua":"SCH-I605"}],"dpi":265.1,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/Galaxy Nexus/*"},{"ua":"Galaxy Nexus"}],"dpi":[315.3,314.2],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N910H/*"},{"ua":"SM-N910H"}],"dpi":[515.1,518],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N910C/*"},{"ua":"SM-N910C"}],"dpi":[515.2,520.2],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G130M/*"},{"ua":"SM-G130M"}],"dpi":[165.9,164.8],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G928I/*"},{"ua":"SM-G928I"}],"dpi":[515.1,518.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G920F/*"},{"ua":"SM-G920F"}],"dpi":580.6,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G920P/*"},{"ua":"SM-G920P"}],"dpi":[522.5,577],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G925F/*"},{"ua":"SM-G925F"}],"dpi":580.6,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G925V/*"},{"ua":"SM-G925V"}],"dpi":[522.5,576.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G930F/*"},{"ua":"SM-G930F"}],"dpi":576.6,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G935F/*"},{"ua":"SM-G935F"}],"dpi":533,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G950F/*"},{"ua":"SM-G950F"}],"dpi":[562.707,565.293],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G955U/*"},{"ua":"SM-G955U"}],"dpi":[522.514,525.762],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"Sony/*/C6903/*"},{"ua":"C6903"}],"dpi":[442.5,443.3],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"Sony/*/D6653/*"},{"ua":"D6653"}],"dpi":[428.6,427.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Sony/*/E6653/*"},{"ua":"E6653"}],"dpi":[428.6,425.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Sony/*/E6853/*"},{"ua":"E6853"}],"dpi":[403.4,401.9],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Sony/*/SGP321/*"},{"ua":"SGP321"}],"dpi":[224.7,224.1],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"TCT/*/ALCATEL ONE TOUCH Fierce/*"},{"ua":"ALCATEL ONE TOUCH Fierce"}],"dpi":[240,247.5],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"THL/*/thl 5000/*"},{"ua":"thl 5000"}],"dpi":[480,443.3],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"ZTE/*/ZTE Blade L2/*"},{"ua":"ZTE Blade L2"}],"dpi":240,"bw":3,"ac":500},{"type":"ios","rules":[{"res":[640,960]}],"dpi":[325.1,328.4],"bw":4,"ac":1000},{"type":"ios","rules":[{"res":[640,1136]}],"dpi":[317.1,320.2],"bw":3,"ac":1000},{"type":"ios","rules":[{"res":[750,1334]}],"dpi":326.4,"bw":4,"ac":1000},{"type":"ios","rules":[{"res":[1242,2208]}],"dpi":[453.6,458.4],"bw":4,"ac":1000},{"type":"ios","rules":[{"res":[1125,2001]}],"dpi":[410.9,415.4],"bw":4,"ac":1000}]; +var DPDB_CACHE = { + format: format, + last_updated: last_updated, + devices: devices +}; +function Dpdb(url, onDeviceParamsUpdated) { + this.dpdb = DPDB_CACHE; + this.recalculateDeviceParams_(); + if (url) { + this.onDeviceParamsUpdated = onDeviceParamsUpdated; + var xhr = new XMLHttpRequest(); + var obj = this; + xhr.open('GET', url, true); + xhr.addEventListener('load', function () { + obj.loading = false; + if (xhr.status >= 200 && xhr.status <= 299) { + obj.dpdb = JSON.parse(xhr.response); + obj.recalculateDeviceParams_(); + } else { + console.error('Error loading online DPDB!'); + } + }); + xhr.send(); + } +} +Dpdb.prototype.getDeviceParams = function () { + return this.deviceParams; +}; +Dpdb.prototype.recalculateDeviceParams_ = function () { + var newDeviceParams = this.calcDeviceParams_(); + if (newDeviceParams) { + this.deviceParams = newDeviceParams; + if (this.onDeviceParamsUpdated) { + this.onDeviceParamsUpdated(this.deviceParams); + } + } else { + console.error('Failed to recalculate device parameters.'); + } +}; +Dpdb.prototype.calcDeviceParams_ = function () { + var db = this.dpdb; + if (!db) { + console.error('DPDB not available.'); + return null; + } + if (db.format != 1) { + console.error('DPDB has unexpected format version.'); + return null; + } + if (!db.devices || !db.devices.length) { + console.error('DPDB does not have a devices section.'); + return null; + } + var userAgent = navigator.userAgent || navigator.vendor || window.opera; + var width = getScreenWidth(); + var height = getScreenHeight(); + if (!db.devices) { + console.error('DPDB has no devices section.'); + return null; + } + for (var i = 0; i < db.devices.length; i++) { + var device = db.devices[i]; + if (!device.rules) { + console.warn('Device[' + i + '] has no rules section.'); + continue; + } + if (device.type != 'ios' && device.type != 'android') { + console.warn('Device[' + i + '] has invalid type.'); + continue; + } + if (isIOS() != (device.type == 'ios')) continue; + var matched = false; + for (var j = 0; j < device.rules.length; j++) { + var rule = device.rules[j]; + if (this.matchRule_(rule, userAgent, width, height)) { + matched = true; + break; + } + } + if (!matched) continue; + var xdpi = device.dpi[0] || device.dpi; + var ydpi = device.dpi[1] || device.dpi; + return new DeviceParams({ xdpi: xdpi, ydpi: ydpi, bevelMm: device.bw }); + } + console.warn('No DPDB device match.'); + return null; +}; +Dpdb.prototype.matchRule_ = function (rule, ua, screenWidth, screenHeight) { + if (!rule.ua && !rule.res) return false; + if (rule.ua && ua.indexOf(rule.ua) < 0) return false; + if (rule.res) { + if (!rule.res[0] || !rule.res[1]) return false; + var resX = rule.res[0]; + var resY = rule.res[1]; + if (Math.min(screenWidth, screenHeight) != Math.min(resX, resY) || Math.max(screenWidth, screenHeight) != Math.max(resX, resY)) { + return false; + } + } + return true; +}; +function DeviceParams(params) { + this.xdpi = params.xdpi; + this.ydpi = params.ydpi; + this.bevelMm = params.bevelMm; +} +function SensorSample(sample, timestampS) { + this.set(sample, timestampS); +} +SensorSample.prototype.set = function (sample, timestampS) { + this.sample = sample; + this.timestampS = timestampS; +}; +SensorSample.prototype.copy = function (sensorSample) { + this.set(sensorSample.sample, sensorSample.timestampS); +}; +function ComplementaryFilter(kFilter, isDebug) { + this.kFilter = kFilter; + this.isDebug = isDebug; + this.currentAccelMeasurement = new SensorSample(); + this.currentGyroMeasurement = new SensorSample(); + this.previousGyroMeasurement = new SensorSample(); + if (isIOS()) { + this.filterQ = new Quaternion(-1, 0, 0, 1); + } else { + this.filterQ = new Quaternion(1, 0, 0, 1); + } + this.previousFilterQ = new Quaternion(); + this.previousFilterQ.copy(this.filterQ); + this.accelQ = new Quaternion(); + this.isOrientationInitialized = false; + this.estimatedGravity = new Vector3(); + this.measuredGravity = new Vector3(); + this.gyroIntegralQ = new Quaternion(); +} +ComplementaryFilter.prototype.addAccelMeasurement = function (vector, timestampS) { + this.currentAccelMeasurement.set(vector, timestampS); +}; +ComplementaryFilter.prototype.addGyroMeasurement = function (vector, timestampS) { + this.currentGyroMeasurement.set(vector, timestampS); + var deltaT = timestampS - this.previousGyroMeasurement.timestampS; + if (isTimestampDeltaValid(deltaT)) { + this.run_(); + } + this.previousGyroMeasurement.copy(this.currentGyroMeasurement); +}; +ComplementaryFilter.prototype.run_ = function () { + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + var deltaT = this.currentGyroMeasurement.timestampS - this.previousGyroMeasurement.timestampS; + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); + var invFilterQ = new Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); + var deltaQ = new Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); + if (this.isDebug) { + console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)', radToDeg * getQuaternionAngle(deltaQ), this.estimatedGravity.x.toFixed(1), this.estimatedGravity.y.toFixed(1), this.estimatedGravity.z.toFixed(1), this.measuredGravity.x.toFixed(1), this.measuredGravity.y.toFixed(1), this.measuredGravity.z.toFixed(1)); + } + var targetQ = new Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); + this.filterQ.slerp(targetQ, 1 - this.kFilter); + this.previousFilterQ.copy(this.filterQ); +}; +ComplementaryFilter.prototype.getOrientation = function () { + return this.filterQ; +}; +ComplementaryFilter.prototype.accelToQuaternion_ = function (accel) { + var normAccel = new Vector3(); + normAccel.copy(accel); + normAccel.normalize(); + var quat = new Quaternion(); + quat.setFromUnitVectors(new Vector3(0, 0, -1), normAccel); + quat.inverse(); + return quat; +}; +ComplementaryFilter.prototype.gyroToQuaternionDelta_ = function (gyro, dt) { + var quat = new Quaternion(); + var axis = new Vector3(); + axis.copy(gyro); + axis.normalize(); + quat.setFromAxisAngle(axis, gyro.length() * dt); + return quat; +}; +function PosePredictor(predictionTimeS, isDebug) { + this.predictionTimeS = predictionTimeS; + this.isDebug = isDebug; + this.previousQ = new Quaternion(); + this.previousTimestampS = null; + this.deltaQ = new Quaternion(); + this.outQ = new Quaternion(); +} +PosePredictor.prototype.getPrediction = function (currentQ, gyro, timestampS) { + if (!this.previousTimestampS) { + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return currentQ; + } + var axis = new Vector3(); + axis.copy(gyro); + axis.normalize(); + var angularSpeed = gyro.length(); + if (angularSpeed < degToRad * 20) { + if (this.isDebug) { + console.log('Moving slowly, at %s deg/s: no prediction', (radToDeg * angularSpeed).toFixed(1)); + } + this.outQ.copy(currentQ); + this.previousQ.copy(currentQ); + return this.outQ; + } + var predictAngle = angularSpeed * this.predictionTimeS; + this.deltaQ.setFromAxisAngle(axis, predictAngle); + this.outQ.copy(this.previousQ); + this.outQ.multiply(this.deltaQ); + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return this.outQ; +}; +function FusionPoseSensor(kFilter, predictionTime, yawOnly, isDebug) { + this.yawOnly = yawOnly; + this.accelerometer = new Vector3(); + this.gyroscope = new Vector3(); + this.filter = new ComplementaryFilter(kFilter, isDebug); + this.posePredictor = new PosePredictor(predictionTime, isDebug); + this.isFirefoxAndroid = isFirefoxAndroid(); + this.isIOS = isIOS(); + var chromeVersion = getChromeVersion(); + this.isDeviceMotionInRadians = !this.isIOS && chromeVersion && chromeVersion < 66; + this.isWithoutDeviceMotion = isChromeWithoutDeviceMotion(); + this.filterToWorldQ = new Quaternion(); + if (isIOS()) { + this.filterToWorldQ.setFromAxisAngle(new Vector3(1, 0, 0), Math.PI / 2); + } else { + this.filterToWorldQ.setFromAxisAngle(new Vector3(1, 0, 0), -Math.PI / 2); + } + this.inverseWorldToScreenQ = new Quaternion(); + this.worldToScreenQ = new Quaternion(); + this.originalPoseAdjustQ = new Quaternion(); + this.originalPoseAdjustQ.setFromAxisAngle(new Vector3(0, 0, 1), -window.orientation * Math.PI / 180); + this.setScreenTransform_(); + if (isLandscapeMode()) { + this.filterToWorldQ.multiply(this.inverseWorldToScreenQ); + } + this.resetQ = new Quaternion(); + this.orientationOut_ = new Float32Array(4); + this.start(); +} +FusionPoseSensor.prototype.getPosition = function () { + return null; +}; +FusionPoseSensor.prototype.getOrientation = function () { + var orientation = void 0; + if (this.isWithoutDeviceMotion && this._deviceOrientationQ) { + this.deviceOrientationFixQ = this.deviceOrientationFixQ || function () { + var z = new Quaternion().setFromAxisAngle(new Vector3(0, 0, -1), 0); + var y = new Quaternion(); + if (window.orientation === -90) { + y.setFromAxisAngle(new Vector3(0, 1, 0), Math.PI / -2); + } else { + y.setFromAxisAngle(new Vector3(0, 1, 0), Math.PI / 2); + } + return z.multiply(y); + }(); + this.deviceOrientationFilterToWorldQ = this.deviceOrientationFilterToWorldQ || function () { + var q = new Quaternion(); + q.setFromAxisAngle(new Vector3(1, 0, 0), -Math.PI / 2); + return q; + }(); + orientation = this._deviceOrientationQ; + var out = new Quaternion(); + out.copy(orientation); + out.multiply(this.deviceOrientationFilterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.worldToScreenQ); + out.multiplyQuaternions(this.deviceOrientationFixQ, out); + if (this.yawOnly) { + out.x = 0; + out.z = 0; + out.normalize(); + } + this.orientationOut_[0] = out.x; + this.orientationOut_[1] = out.y; + this.orientationOut_[2] = out.z; + this.orientationOut_[3] = out.w; + return this.orientationOut_; + } else { + var filterOrientation = this.filter.getOrientation(); + orientation = this.posePredictor.getPrediction(filterOrientation, this.gyroscope, this.previousTimestampS); + } + var out = new Quaternion(); + out.copy(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(orientation); + out.multiply(this.worldToScreenQ); + if (this.yawOnly) { + out.x = 0; + out.z = 0; + out.normalize(); + } + this.orientationOut_[0] = out.x; + this.orientationOut_[1] = out.y; + this.orientationOut_[2] = out.z; + this.orientationOut_[3] = out.w; + return this.orientationOut_; +}; +FusionPoseSensor.prototype.resetPose = function () { + this.resetQ.copy(this.filter.getOrientation()); + this.resetQ.x = 0; + this.resetQ.y = 0; + this.resetQ.z *= -1; + this.resetQ.normalize(); + if (isLandscapeMode()) { + this.resetQ.multiply(this.inverseWorldToScreenQ); + } + this.resetQ.multiply(this.originalPoseAdjustQ); +}; +FusionPoseSensor.prototype.onDeviceOrientation_ = function (e) { + this._deviceOrientationQ = this._deviceOrientationQ || new Quaternion(); + var alpha = e.alpha, + beta = e.beta, + gamma = e.gamma; + alpha = (alpha || 0) * Math.PI / 180; + beta = (beta || 0) * Math.PI / 180; + gamma = (gamma || 0) * Math.PI / 180; + this._deviceOrientationQ.setFromEulerYXZ(beta, alpha, -gamma); +}; +FusionPoseSensor.prototype.onDeviceMotion_ = function (deviceMotion) { + this.updateDeviceMotion_(deviceMotion); +}; +FusionPoseSensor.prototype.updateDeviceMotion_ = function (deviceMotion) { + var accGravity = deviceMotion.accelerationIncludingGravity; + var rotRate = deviceMotion.rotationRate; + var timestampS = deviceMotion.timeStamp / 1000; + var deltaS = timestampS - this.previousTimestampS; + if (deltaS < 0) { + warnOnce('fusion-pose-sensor:invalid:non-monotonic', 'Invalid timestamps detected: non-monotonic timestamp from devicemotion'); + this.previousTimestampS = timestampS; + return; + } else if (deltaS <= MIN_TIMESTEP || deltaS > MAX_TIMESTEP) { + warnOnce('fusion-pose-sensor:invalid:outside-threshold', 'Invalid timestamps detected: Timestamp from devicemotion outside expected range.'); + this.previousTimestampS = timestampS; + return; + } + this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); + if (isR7()) { + this.gyroscope.set(-rotRate.beta, rotRate.alpha, rotRate.gamma); + } else { + this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); + } + if (!this.isDeviceMotionInRadians) { + this.gyroscope.multiplyScalar(Math.PI / 180); + } + this.filter.addAccelMeasurement(this.accelerometer, timestampS); + this.filter.addGyroMeasurement(this.gyroscope, timestampS); + this.previousTimestampS = timestampS; +}; +FusionPoseSensor.prototype.onOrientationChange_ = function (screenOrientation) { + this.setScreenTransform_(); +}; +FusionPoseSensor.prototype.onMessage_ = function (event) { + var message = event.data; + if (!message || !message.type) { + return; + } + var type = message.type.toLowerCase(); + if (type !== 'devicemotion') { + return; + } + this.updateDeviceMotion_(message.deviceMotionEvent); +}; +FusionPoseSensor.prototype.setScreenTransform_ = function () { + this.worldToScreenQ.set(0, 0, 0, 1); + switch (window.orientation) { + case 0: + break; + case 90: + this.worldToScreenQ.setFromAxisAngle(new Vector3(0, 0, 1), -Math.PI / 2); + break; + case -90: + this.worldToScreenQ.setFromAxisAngle(new Vector3(0, 0, 1), Math.PI / 2); + break; + case 180: + break; + } + this.inverseWorldToScreenQ.copy(this.worldToScreenQ); + this.inverseWorldToScreenQ.inverse(); +}; +FusionPoseSensor.prototype.start = function () { + this.onDeviceMotionCallback_ = this.onDeviceMotion_.bind(this); + this.onOrientationChangeCallback_ = this.onOrientationChange_.bind(this); + this.onMessageCallback_ = this.onMessage_.bind(this); + this.onDeviceOrientationCallback_ = this.onDeviceOrientation_.bind(this); + if (isIOS() && isInsideCrossOriginIFrame()) { + window.addEventListener('message', this.onMessageCallback_); + } + window.addEventListener('orientationchange', this.onOrientationChangeCallback_); + if (this.isWithoutDeviceMotion) { + window.addEventListener('deviceorientation', this.onDeviceOrientationCallback_); + } else { + window.addEventListener('devicemotion', this.onDeviceMotionCallback_); + } +}; +FusionPoseSensor.prototype.stop = function () { + window.removeEventListener('devicemotion', this.onDeviceMotionCallback_); + window.removeEventListener('deviceorientation', this.onDeviceOrientationCallback_); + window.removeEventListener('orientationchange', this.onOrientationChangeCallback_); + window.removeEventListener('message', this.onMessageCallback_); +}; +var SENSOR_FREQUENCY = 60; +var X_AXIS = new Vector3(1, 0, 0); +var Z_AXIS = new Vector3(0, 0, 1); +var orientation = {}; +if (screen.orientation) { + orientation = screen.orientation; +} else if (screen.msOrientation) { + orientation = screen.msOrientation; +} else { + Object.defineProperty(orientation, 'angle', { + get: function get$$1() { + return window.orientation || 0; + } + }); +} +var SENSOR_TO_VR = new Quaternion(); +SENSOR_TO_VR.setFromAxisAngle(X_AXIS, -Math.PI / 2); +SENSOR_TO_VR.multiply(new Quaternion().setFromAxisAngle(Z_AXIS, Math.PI / 2)); +var PoseSensor = function () { + function PoseSensor(config) { + classCallCheck(this, PoseSensor); + this.config = config; + this.sensor = null; + this.fusionSensor = null; + this._out = new Float32Array(4); + this.api = null; + this.errors = []; + this._sensorQ = new Quaternion(); + this._worldToScreenQ = new Quaternion(); + this._outQ = new Quaternion(); + this._onSensorRead = this._onSensorRead.bind(this); + this._onSensorError = this._onSensorError.bind(this); + this._onOrientationChange = this._onOrientationChange.bind(this); + this._onOrientationChange(); + this.init(); + } + createClass(PoseSensor, [{ + key: 'init', + value: function init() { + var sensor = null; + try { + sensor = new RelativeOrientationSensor({ frequency: SENSOR_FREQUENCY }); + sensor.addEventListener('error', this._onSensorError); + } catch (error) { + this.errors.push(error); + if (error.name === 'SecurityError') { + console.error('Cannot construct sensors due to the Feature Policy'); + console.warn('Attempting to fall back using "devicemotion"; however this will ' + 'fail in the future without correct permissions.'); + this.useDeviceMotion(); + } else if (error.name === 'ReferenceError') { + this.useDeviceMotion(); + } else { + console.error(error); + } + } + if (sensor) { + this.api = 'sensor'; + this.sensor = sensor; + this.sensor.addEventListener('reading', this._onSensorRead); + this.sensor.start(); + } + window.addEventListener('orientationchange', this._onOrientationChange); + } + }, { + key: 'useDeviceMotion', + value: function useDeviceMotion() { + this.api = 'devicemotion'; + this.fusionSensor = new FusionPoseSensor(this.config.K_FILTER, this.config.PREDICTION_TIME_S, this.config.YAW_ONLY, this.config.DEBUG); + } + }, { + key: 'getOrientation', + value: function getOrientation() { + if (this.fusionSensor) { + return this.fusionSensor.getOrientation(); + } + if (!this.sensor || !this.sensor.quaternion) { + this._out[0] = this._out[1] = this._out[2] = 0; + this._out[3] = 1; + return this._out; + } + var q = this.sensor.quaternion; + this._sensorQ.set(q[0], q[1], q[2], q[3]); + var out = this._outQ; + out.copy(SENSOR_TO_VR); + out.multiply(this._sensorQ); + out.multiply(this._worldToScreenQ); + if (this.config.YAW_ONLY) { + out.x = out.z = 0; + out.normalize(); + } + this._out[0] = out.x; + this._out[1] = out.y; + this._out[2] = out.z; + this._out[3] = out.w; + return this._out; + } + }, { + key: '_onSensorError', + value: function _onSensorError(event) { + this.errors.push(event.error); + if (event.error.name === 'NotAllowedError') { + console.error('Permission to access sensor was denied'); + } else if (event.error.name === 'NotReadableError') { + console.error('Sensor could not be read'); + } else { + console.error(event.error); + } + } + }, { + key: '_onSensorRead', + value: function _onSensorRead() {} + }, { + key: '_onOrientationChange', + value: function _onOrientationChange() { + var angle = -orientation.angle * Math.PI / 180; + this._worldToScreenQ.setFromAxisAngle(Z_AXIS, angle); + } + }]); + return PoseSensor; +}(); +var rotateInstructionsAsset = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjE5OHB4IiBoZWlnaHQ9IjI0MHB4IiB2aWV3Qm94PSIwIDAgMTk4IDI0MCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWxuczpza2V0Y2g9Imh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaC9ucyI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDMuMy4zICgxMjA4MSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dHJhbnNpdGlvbjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHNrZXRjaDp0eXBlPSJNU1BhZ2UiPgogICAgICAgIDxnIGlkPSJ0cmFuc2l0aW9uIiBza2V0Y2g6dHlwZT0iTVNBcnRib2FyZEdyb3VwIj4KICAgICAgICAgICAgPGcgaWQ9IkltcG9ydGVkLUxheWVycy1Db3B5LTQtKy1JbXBvcnRlZC1MYXllcnMtQ29weS0rLUltcG9ydGVkLUxheWVycy1Db3B5LTItQ29weSIgc2tldGNoOnR5cGU9Ik1TTGF5ZXJHcm91cCI+CiAgICAgICAgICAgICAgIC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EwxMDYuNjM5LDk2Ljk4MiBMOTksMTAwLjMxNSBMMTEyLjM2OSwxMDMuOTYxIEwxMjUuNzM3LDg4LjY0NyIgaWQ9IkltcG9ydGVkLUxheWVycy1Db3B5LTIiIGZpbGw9IiM0NTVBNjQiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+'; +function RotateInstructions() { + this.loadIcon_(); + var overlay = document.createElement('div'); + var s = overlay.style; + s.position = 'fixed'; + s.top = 0; + s.right = 0; + s.bottom = 0; + s.left = 0; + s.backgroundColor = 'gray'; + s.fontFamily = 'sans-serif'; + s.zIndex = 1000000; + var img = document.createElement('img'); + img.src = this.icon; + var s = img.style; + s.marginLeft = '25%'; + s.marginTop = '25%'; + s.width = '50%'; + overlay.appendChild(img); + var text = document.createElement('div'); + var s = text.style; + s.textAlign = 'center'; + s.fontSize = '16px'; + s.lineHeight = '24px'; + s.margin = '24px 25%'; + s.width = '50%'; + text.innerHTML = 'Place your phone into your Cardboard viewer.'; + overlay.appendChild(text); + var snackbar = document.createElement('div'); + var s = snackbar.style; + s.backgroundColor = '#CFD8DC'; + s.position = 'fixed'; + s.bottom = 0; + s.width = '100%'; + s.height = '48px'; + s.padding = '14px 24px'; + s.boxSizing = 'border-box'; + s.color = '#656A6B'; + overlay.appendChild(snackbar); + var snackbarText = document.createElement('div'); + snackbarText.style.float = 'left'; + snackbarText.innerHTML = 'No Cardboard viewer?'; + var snackbarButton = document.createElement('a'); + snackbarButton.href = 'https://www.google.com/get/cardboard/get-cardboard/'; + snackbarButton.innerHTML = 'get one'; + snackbarButton.target = '_blank'; + var s = snackbarButton.style; + s.float = 'right'; + s.fontWeight = 600; + s.textTransform = 'uppercase'; + s.borderLeft = '1px solid gray'; + s.paddingLeft = '24px'; + s.textDecoration = 'none'; + s.color = '#656A6B'; + snackbar.appendChild(snackbarText); + snackbar.appendChild(snackbarButton); + this.overlay = overlay; + this.text = text; + this.hide(); +} +RotateInstructions.prototype.show = function (parent) { + if (!parent && !this.overlay.parentElement) { + document.body.appendChild(this.overlay); + } else if (parent) { + if (this.overlay.parentElement && this.overlay.parentElement != parent) this.overlay.parentElement.removeChild(this.overlay); + parent.appendChild(this.overlay); + } + this.overlay.style.display = 'block'; + var img = this.overlay.querySelector('img'); + var s = img.style; + if (isLandscapeMode()) { + s.width = '20%'; + s.marginLeft = '40%'; + s.marginTop = '3%'; + } else { + s.width = '50%'; + s.marginLeft = '25%'; + s.marginTop = '25%'; + } +}; +RotateInstructions.prototype.hide = function () { + this.overlay.style.display = 'none'; +}; +RotateInstructions.prototype.showTemporarily = function (ms, parent) { + this.show(parent); + this.timer = setTimeout(this.hide.bind(this), ms); +}; +RotateInstructions.prototype.disableShowTemporarily = function () { + clearTimeout(this.timer); +}; +RotateInstructions.prototype.update = function () { + this.disableShowTemporarily(); + if (!isLandscapeMode() && isMobile()) { + this.show(); + } else { + this.hide(); + } +}; +RotateInstructions.prototype.loadIcon_ = function () { + this.icon = base64('image/svg+xml', rotateInstructionsAsset); +}; +var DEFAULT_VIEWER = 'CardboardV1'; +var VIEWER_KEY = 'WEBVR_CARDBOARD_VIEWER'; +var CLASS_NAME = 'webvr-polyfill-viewer-selector'; +function ViewerSelector() { + try { + this.selectedKey = localStorage.getItem(VIEWER_KEY); + } catch (error) { + console.error('Failed to load viewer profile: %s', error); + } + if (!this.selectedKey) { + this.selectedKey = DEFAULT_VIEWER; + } + this.dialog = this.createDialog_(DeviceInfo.Viewers); + this.root = null; + this.onChangeCallbacks_ = []; +} +ViewerSelector.prototype.show = function (root) { + this.root = root; + root.appendChild(this.dialog); + var selected = this.dialog.querySelector('#' + this.selectedKey); + selected.checked = true; + this.dialog.style.display = 'block'; +}; +ViewerSelector.prototype.hide = function () { + if (this.root && this.root.contains(this.dialog)) { + this.root.removeChild(this.dialog); + } + this.dialog.style.display = 'none'; +}; +ViewerSelector.prototype.getCurrentViewer = function () { + return DeviceInfo.Viewers[this.selectedKey]; +}; +ViewerSelector.prototype.getSelectedKey_ = function () { + var input = this.dialog.querySelector('input[name=field]:checked'); + if (input) { + return input.id; + } + return null; +}; +ViewerSelector.prototype.onChange = function (cb) { + this.onChangeCallbacks_.push(cb); +}; +ViewerSelector.prototype.fireOnChange_ = function (viewer) { + for (var i = 0; i < this.onChangeCallbacks_.length; i++) { + this.onChangeCallbacks_[i](viewer); + } +}; +ViewerSelector.prototype.onSave_ = function () { + this.selectedKey = this.getSelectedKey_(); + if (!this.selectedKey || !DeviceInfo.Viewers[this.selectedKey]) { + console.error('ViewerSelector.onSave_: this should never happen!'); + return; + } + this.fireOnChange_(DeviceInfo.Viewers[this.selectedKey]); + try { + localStorage.setItem(VIEWER_KEY, this.selectedKey); + } catch (error) { + console.error('Failed to save viewer profile: %s', error); + } + this.hide(); +}; +ViewerSelector.prototype.createDialog_ = function (options) { + var container = document.createElement('div'); + container.classList.add(CLASS_NAME); + container.style.display = 'none'; + var overlay = document.createElement('div'); + var s = overlay.style; + s.position = 'fixed'; + s.left = 0; + s.top = 0; + s.width = '100%'; + s.height = '100%'; + s.background = 'rgba(0, 0, 0, 0.3)'; + overlay.addEventListener('click', this.hide.bind(this)); + var width = 280; + var dialog = document.createElement('div'); + var s = dialog.style; + s.boxSizing = 'border-box'; + s.position = 'fixed'; + s.top = '24px'; + s.left = '50%'; + s.marginLeft = -width / 2 + 'px'; + s.width = width + 'px'; + s.padding = '24px'; + s.overflow = 'hidden'; + s.background = '#fafafa'; + s.fontFamily = "'Roboto', sans-serif"; + s.boxShadow = '0px 5px 20px #666'; + dialog.appendChild(this.createH1_('Select your viewer')); + for (var id in options) { + dialog.appendChild(this.createChoice_(id, options[id].label)); + } + dialog.appendChild(this.createButton_('Save', this.onSave_.bind(this))); + container.appendChild(overlay); + container.appendChild(dialog); + return container; +}; +ViewerSelector.prototype.createH1_ = function (name) { + var h1 = document.createElement('h1'); + var s = h1.style; + s.color = 'black'; + s.fontSize = '20px'; + s.fontWeight = 'bold'; + s.marginTop = 0; + s.marginBottom = '24px'; + h1.innerHTML = name; + return h1; +}; +ViewerSelector.prototype.createChoice_ = function (id, name) { + var div = document.createElement('div'); + div.style.marginTop = '8px'; + div.style.color = 'black'; + var input = document.createElement('input'); + input.style.fontSize = '30px'; + input.setAttribute('id', id); + input.setAttribute('type', 'radio'); + input.setAttribute('value', id); + input.setAttribute('name', 'field'); + var label = document.createElement('label'); + label.style.marginLeft = '4px'; + label.setAttribute('for', id); + label.innerHTML = name; + div.appendChild(input); + div.appendChild(label); + return div; +}; +ViewerSelector.prototype.createButton_ = function (label, onclick) { + var button = document.createElement('button'); + button.innerHTML = label; + var s = button.style; + s.float = 'right'; + s.textTransform = 'uppercase'; + s.color = '#1094f7'; + s.fontSize = '14px'; + s.letterSpacing = 0; + s.border = 0; + s.background = 'none'; + s.marginTop = '16px'; + button.addEventListener('click', onclick); + return button; +}; +var commonjsGlobal$$1 = typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : {}; +function unwrapExports$$1 (x) { + return x && x.__esModule ? x['default'] : x; +} +function createCommonjsModule$$1(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} +var NoSleep = createCommonjsModule$$1(function (module, exports) { +(function webpackUniversalModuleDefinition(root, factory) { + module.exports = factory(); +})(commonjsGlobal$$1, function() { +return (function(modules) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if(installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module = installedModules[moduleId] = { + i: moduleId, + l: false, + exports: {} + }; + modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + module.l = true; + return module.exports; + } + __webpack_require__.m = modules; + __webpack_require__.c = installedModules; + __webpack_require__.d = function(exports, name, getter) { + if(!__webpack_require__.o(exports, name)) { + Object.defineProperty(exports, name, { + configurable: false, + enumerable: true, + get: getter + }); + } + }; + __webpack_require__.n = function(module) { + var getter = module && module.__esModule ? + function getDefault() { return module['default']; } : + function getModuleExports() { return module; }; + __webpack_require__.d(getter, 'a', getter); + return getter; + }; + __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; + __webpack_require__.p = ""; + return __webpack_require__(__webpack_require__.s = 0); + }) + ([ + (function(module, exports, __webpack_require__) { +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var mediaFile = __webpack_require__(1); +var oldIOS = typeof navigator !== 'undefined' && parseFloat(('' + (/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0, ''])[1]).replace('undefined', '3_2').replace('_', '.').replace('_', '')) < 10 && !window.MSStream; +var NoSleep = function () { + function NoSleep() { + _classCallCheck(this, NoSleep); + if (oldIOS) { + this.noSleepTimer = null; + } else { + this.noSleepVideo = document.createElement('video'); + this.noSleepVideo.setAttribute('playsinline', ''); + this.noSleepVideo.setAttribute('src', mediaFile); + this.noSleepVideo.addEventListener('timeupdate', function (e) { + if (this.noSleepVideo.currentTime > 0.5) { + this.noSleepVideo.currentTime = Math.random(); + } + }.bind(this)); + } + } + _createClass(NoSleep, [{ + key: 'enable', + value: function enable() { + if (oldIOS) { + this.disable(); + this.noSleepTimer = window.setInterval(function () { + window.location.href = '/'; + window.setTimeout(window.stop, 0); + }, 15000); + } else { + this.noSleepVideo.play(); + } + } + }, { + key: 'disable', + value: function disable() { + if (oldIOS) { + if (this.noSleepTimer) { + window.clearInterval(this.noSleepTimer); + this.noSleepTimer = null; + } + } else { + this.noSleepVideo.pause(); + } + } + }]); + return NoSleep; +}(); +module.exports = NoSleep; + }), + (function(module, exports, __webpack_require__) { +module.exports = 'data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyY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AAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA='; + }) + ]); +}); +}); +var NoSleep$1 = unwrapExports$$1(NoSleep); +var nextDisplayId = 1000; +var defaultLeftBounds = [0, 0, 0.5, 1]; +var defaultRightBounds = [0.5, 0, 0.5, 1]; +var raf = window.requestAnimationFrame; +var caf = window.cancelAnimationFrame; +function VRFrameData() { + this.leftProjectionMatrix = new Float32Array(16); + this.leftViewMatrix = new Float32Array(16); + this.rightProjectionMatrix = new Float32Array(16); + this.rightViewMatrix = new Float32Array(16); + this.pose = null; +} +function VRDisplayCapabilities(config) { + Object.defineProperties(this, { + hasPosition: { + writable: false, enumerable: true, value: config.hasPosition + }, + hasExternalDisplay: { + writable: false, enumerable: true, value: config.hasExternalDisplay + }, + canPresent: { + writable: false, enumerable: true, value: config.canPresent + }, + maxLayers: { + writable: false, enumerable: true, value: config.maxLayers + }, + hasOrientation: { + enumerable: true, get: function get() { + deprecateWarning('VRDisplayCapabilities.prototype.hasOrientation', 'VRDisplay.prototype.getFrameData'); + return config.hasOrientation; + } + } + }); +} +function VRDisplay(config) { + config = config || {}; + var USE_WAKELOCK = 'wakelock' in config ? config.wakelock : true; + this.isPolyfilled = true; + this.displayId = nextDisplayId++; + this.displayName = ''; + this.depthNear = 0.01; + this.depthFar = 10000.0; + this.isPresenting = false; + Object.defineProperty(this, 'isConnected', { + get: function get() { + deprecateWarning('VRDisplay.prototype.isConnected', 'VRDisplayCapabilities.prototype.hasExternalDisplay'); + return false; + } + }); + this.capabilities = new VRDisplayCapabilities({ + hasPosition: false, + hasOrientation: false, + hasExternalDisplay: false, + canPresent: false, + maxLayers: 1 + }); + this.stageParameters = null; + this.waitingForPresent_ = false; + this.layer_ = null; + this.originalParent_ = null; + this.fullscreenElement_ = null; + this.fullscreenWrapper_ = null; + this.fullscreenElementCachedStyle_ = null; + this.fullscreenEventTarget_ = null; + this.fullscreenChangeHandler_ = null; + this.fullscreenErrorHandler_ = null; + if (USE_WAKELOCK && isMobile()) { + this.wakelock_ = new NoSleep$1(); + } +} +VRDisplay.prototype.getFrameData = function (frameData) { + return frameDataFromPose(frameData, this._getPose(), this); +}; +VRDisplay.prototype.getPose = function () { + deprecateWarning('VRDisplay.prototype.getPose', 'VRDisplay.prototype.getFrameData'); + return this._getPose(); +}; +VRDisplay.prototype.resetPose = function () { + deprecateWarning('VRDisplay.prototype.resetPose'); + return this._resetPose(); +}; +VRDisplay.prototype.getImmediatePose = function () { + deprecateWarning('VRDisplay.prototype.getImmediatePose', 'VRDisplay.prototype.getFrameData'); + return this._getPose(); +}; +VRDisplay.prototype.requestAnimationFrame = function (callback) { + return raf(callback); +}; +VRDisplay.prototype.cancelAnimationFrame = function (id) { + return caf(id); +}; +VRDisplay.prototype.wrapForFullscreen = function (element) { + if (isIOS()) { + return element; + } + if (!this.fullscreenWrapper_) { + this.fullscreenWrapper_ = document.createElement('div'); + var cssProperties = ['height: ' + Math.min(screen.height, screen.width) + 'px !important', 'top: 0 !important', 'left: 0 !important', 'right: 0 !important', 'border: 0', 'margin: 0', 'padding: 0', 'z-index: 999999 !important', 'position: fixed']; + this.fullscreenWrapper_.setAttribute('style', cssProperties.join('; ') + ';'); + this.fullscreenWrapper_.classList.add('webvr-polyfill-fullscreen-wrapper'); + } + if (this.fullscreenElement_ == element) { + return this.fullscreenWrapper_; + } + if (this.fullscreenElement_) { + if (this.originalParent_) { + this.originalParent_.appendChild(this.fullscreenElement_); + } else { + this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_); + } + } + this.fullscreenElement_ = element; + this.originalParent_ = element.parentElement; + if (!this.originalParent_) { + document.body.appendChild(element); + } + if (!this.fullscreenWrapper_.parentElement) { + var parent = this.fullscreenElement_.parentElement; + parent.insertBefore(this.fullscreenWrapper_, this.fullscreenElement_); + parent.removeChild(this.fullscreenElement_); + } + this.fullscreenWrapper_.insertBefore(this.fullscreenElement_, this.fullscreenWrapper_.firstChild); + this.fullscreenElementCachedStyle_ = this.fullscreenElement_.getAttribute('style'); + var self = this; + function applyFullscreenElementStyle() { + if (!self.fullscreenElement_) { + return; + } + var cssProperties = ['position: absolute', 'top: 0', 'left: 0', 'width: ' + Math.max(screen.width, screen.height) + 'px', 'height: ' + Math.min(screen.height, screen.width) + 'px', 'border: 0', 'margin: 0', 'padding: 0']; + self.fullscreenElement_.setAttribute('style', cssProperties.join('; ') + ';'); + } + applyFullscreenElementStyle(); + return this.fullscreenWrapper_; +}; +VRDisplay.prototype.removeFullscreenWrapper = function () { + if (!this.fullscreenElement_) { + return; + } + var element = this.fullscreenElement_; + if (this.fullscreenElementCachedStyle_) { + element.setAttribute('style', this.fullscreenElementCachedStyle_); + } else { + element.removeAttribute('style'); + } + this.fullscreenElement_ = null; + this.fullscreenElementCachedStyle_ = null; + var parent = this.fullscreenWrapper_.parentElement; + this.fullscreenWrapper_.removeChild(element); + if (this.originalParent_ === parent) { + parent.insertBefore(element, this.fullscreenWrapper_); + } + else if (this.originalParent_) { + this.originalParent_.appendChild(element); + } + parent.removeChild(this.fullscreenWrapper_); + return element; +}; +VRDisplay.prototype.requestPresent = function (layers) { + var wasPresenting = this.isPresenting; + var self = this; + if (!(layers instanceof Array)) { + deprecateWarning('VRDisplay.prototype.requestPresent with non-array argument', 'an array of VRLayers as the first argument'); + layers = [layers]; + } + return new Promise(function (resolve, reject) { + if (!self.capabilities.canPresent) { + reject(new Error('VRDisplay is not capable of presenting.')); + return; + } + if (layers.length == 0 || layers.length > self.capabilities.maxLayers) { + reject(new Error('Invalid number of layers.')); + return; + } + var incomingLayer = layers[0]; + if (!incomingLayer.source) { + resolve(); + return; + } + var leftBounds = incomingLayer.leftBounds || defaultLeftBounds; + var rightBounds = incomingLayer.rightBounds || defaultRightBounds; + if (wasPresenting) { + var layer = self.layer_; + if (layer.source !== incomingLayer.source) { + layer.source = incomingLayer.source; + } + for (var i = 0; i < 4; i++) { + layer.leftBounds[i] = leftBounds[i]; + layer.rightBounds[i] = rightBounds[i]; + } + self.wrapForFullscreen(self.layer_.source); + self.updatePresent_(); + resolve(); + return; + } + self.layer_ = { + predistorted: incomingLayer.predistorted, + source: incomingLayer.source, + leftBounds: leftBounds.slice(0), + rightBounds: rightBounds.slice(0) + }; + self.waitingForPresent_ = false; + if (self.layer_ && self.layer_.source) { + var fullscreenElement = self.wrapForFullscreen(self.layer_.source); + var onFullscreenChange = function onFullscreenChange() { + var actualFullscreenElement = getFullscreenElement(); + self.isPresenting = fullscreenElement === actualFullscreenElement; + if (self.isPresenting) { + if (screen.orientation && screen.orientation.lock) { + screen.orientation.lock('landscape-primary').catch(function (error) { + console.error('screen.orientation.lock() failed due to', error.message); + }); + } + self.waitingForPresent_ = false; + self.beginPresent_(); + resolve(); + } else { + if (screen.orientation && screen.orientation.unlock) { + screen.orientation.unlock(); + } + self.removeFullscreenWrapper(); + self.disableWakeLock(); + self.endPresent_(); + self.removeFullscreenListeners_(); + } + self.fireVRDisplayPresentChange_(); + }; + var onFullscreenError = function onFullscreenError() { + if (!self.waitingForPresent_) { + return; + } + self.removeFullscreenWrapper(); + self.removeFullscreenListeners_(); + self.disableWakeLock(); + self.waitingForPresent_ = false; + self.isPresenting = false; + reject(new Error('Unable to present.')); + }; + self.addFullscreenListeners_(fullscreenElement, onFullscreenChange, onFullscreenError); + if (requestFullscreen(fullscreenElement)) { + self.enableWakeLock(); + self.waitingForPresent_ = true; + } else if (isIOS() || isWebViewAndroid()) { + self.enableWakeLock(); + self.isPresenting = true; + self.beginPresent_(); + self.fireVRDisplayPresentChange_(); + resolve(); + } + } + if (!self.waitingForPresent_ && !isIOS()) { + exitFullscreen(); + reject(new Error('Unable to present.')); + } + }); +}; +VRDisplay.prototype.exitPresent = function () { + var wasPresenting = this.isPresenting; + var self = this; + this.isPresenting = false; + this.layer_ = null; + this.disableWakeLock(); + return new Promise(function (resolve, reject) { + if (wasPresenting) { + if (!exitFullscreen() && isIOS()) { + self.endPresent_(); + self.fireVRDisplayPresentChange_(); + } + if (isWebViewAndroid()) { + self.removeFullscreenWrapper(); + self.removeFullscreenListeners_(); + self.endPresent_(); + self.fireVRDisplayPresentChange_(); + } + resolve(); + } else { + reject(new Error('Was not presenting to VRDisplay.')); + } + }); +}; +VRDisplay.prototype.getLayers = function () { + if (this.layer_) { + return [this.layer_]; + } + return []; +}; +VRDisplay.prototype.fireVRDisplayPresentChange_ = function () { + var event = new CustomEvent('vrdisplaypresentchange', { detail: { display: this } }); + window.dispatchEvent(event); +}; +VRDisplay.prototype.fireVRDisplayConnect_ = function () { + var event = new CustomEvent('vrdisplayconnect', { detail: { display: this } }); + window.dispatchEvent(event); +}; +VRDisplay.prototype.addFullscreenListeners_ = function (element, changeHandler, errorHandler) { + this.removeFullscreenListeners_(); + this.fullscreenEventTarget_ = element; + this.fullscreenChangeHandler_ = changeHandler; + this.fullscreenErrorHandler_ = errorHandler; + if (changeHandler) { + if (document.fullscreenEnabled) { + element.addEventListener('fullscreenchange', changeHandler, false); + } else if (document.webkitFullscreenEnabled) { + element.addEventListener('webkitfullscreenchange', changeHandler, false); + } else if (document.mozFullScreenEnabled) { + document.addEventListener('mozfullscreenchange', changeHandler, false); + } else if (document.msFullscreenEnabled) { + element.addEventListener('msfullscreenchange', changeHandler, false); + } + } + if (errorHandler) { + if (document.fullscreenEnabled) { + element.addEventListener('fullscreenerror', errorHandler, false); + } else if (document.webkitFullscreenEnabled) { + element.addEventListener('webkitfullscreenerror', errorHandler, false); + } else if (document.mozFullScreenEnabled) { + document.addEventListener('mozfullscreenerror', errorHandler, false); + } else if (document.msFullscreenEnabled) { + element.addEventListener('msfullscreenerror', errorHandler, false); + } + } +}; +VRDisplay.prototype.removeFullscreenListeners_ = function () { + if (!this.fullscreenEventTarget_) return; + var element = this.fullscreenEventTarget_; + if (this.fullscreenChangeHandler_) { + var changeHandler = this.fullscreenChangeHandler_; + element.removeEventListener('fullscreenchange', changeHandler, false); + element.removeEventListener('webkitfullscreenchange', changeHandler, false); + document.removeEventListener('mozfullscreenchange', changeHandler, false); + element.removeEventListener('msfullscreenchange', changeHandler, false); + } + if (this.fullscreenErrorHandler_) { + var errorHandler = this.fullscreenErrorHandler_; + element.removeEventListener('fullscreenerror', errorHandler, false); + element.removeEventListener('webkitfullscreenerror', errorHandler, false); + document.removeEventListener('mozfullscreenerror', errorHandler, false); + element.removeEventListener('msfullscreenerror', errorHandler, false); + } + this.fullscreenEventTarget_ = null; + this.fullscreenChangeHandler_ = null; + this.fullscreenErrorHandler_ = null; +}; +VRDisplay.prototype.enableWakeLock = function () { + if (this.wakelock_) { + this.wakelock_.enable(); + } +}; +VRDisplay.prototype.disableWakeLock = function () { + if (this.wakelock_) { + this.wakelock_.disable(); + } +}; +VRDisplay.prototype.beginPresent_ = function () { +}; +VRDisplay.prototype.endPresent_ = function () { +}; +VRDisplay.prototype.submitFrame = function (pose) { +}; +VRDisplay.prototype.getEyeParameters = function (whichEye) { + return null; +}; +var config = { + MOBILE_WAKE_LOCK: true, + DEBUG: false, + DPDB_URL: 'https://dpdb.webvr.rocks/dpdb.json', + K_FILTER: 0.98, + PREDICTION_TIME_S: 0.040, + CARDBOARD_UI_DISABLED: false, + ROTATE_INSTRUCTIONS_DISABLED: false, + YAW_ONLY: false, + BUFFER_SCALE: 0.5, + DIRTY_SUBMIT_FRAME_BINDINGS: false +}; +var Eye = { + LEFT: 'left', + RIGHT: 'right' +}; +function CardboardVRDisplay(config$$1) { + var defaults = extend({}, config); + config$$1 = extend(defaults, config$$1 || {}); + VRDisplay.call(this, { + wakelock: config$$1.MOBILE_WAKE_LOCK + }); + this.config = config$$1; + this.displayName = 'Cardboard VRDisplay'; + this.capabilities = new VRDisplayCapabilities({ + hasPosition: false, + hasOrientation: true, + hasExternalDisplay: false, + canPresent: true, + maxLayers: 1 + }); + this.stageParameters = null; + this.bufferScale_ = this.config.BUFFER_SCALE; + this.poseSensor_ = new PoseSensor(this.config); + this.distorter_ = null; + this.cardboardUI_ = null; + this.dpdb_ = new Dpdb(this.config.DPDB_URL, this.onDeviceParamsUpdated_.bind(this)); + this.deviceInfo_ = new DeviceInfo(this.dpdb_.getDeviceParams()); + this.viewerSelector_ = new ViewerSelector(); + this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)); + this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()); + if (!this.config.ROTATE_INSTRUCTIONS_DISABLED) { + this.rotateInstructions_ = new RotateInstructions(); + } + if (isIOS()) { + window.addEventListener('resize', this.onResize_.bind(this)); + } +} +CardboardVRDisplay.prototype = Object.create(VRDisplay.prototype); +CardboardVRDisplay.prototype._getPose = function () { + return { + position: null, + orientation: this.poseSensor_.getOrientation(), + linearVelocity: null, + linearAcceleration: null, + angularVelocity: null, + angularAcceleration: null + }; +}; +CardboardVRDisplay.prototype._resetPose = function () { + if (this.poseSensor_.resetPose) { + this.poseSensor_.resetPose(); + } +}; +CardboardVRDisplay.prototype._getFieldOfView = function (whichEye) { + var fieldOfView; + if (whichEye == Eye.LEFT) { + fieldOfView = this.deviceInfo_.getFieldOfViewLeftEye(); + } else if (whichEye == Eye.RIGHT) { + fieldOfView = this.deviceInfo_.getFieldOfViewRightEye(); + } else { + console.error('Invalid eye provided: %s', whichEye); + return null; + } + return fieldOfView; +}; +CardboardVRDisplay.prototype._getEyeOffset = function (whichEye) { + var offset; + if (whichEye == Eye.LEFT) { + offset = [this.deviceInfo_.viewer.interLensDistance * 0.5, 0.0, 0.0]; + } else if (whichEye == Eye.RIGHT) { + offset = [-this.deviceInfo_.viewer.interLensDistance * 0.5, 0.0, 0.0]; + } else { + console.error('Invalid eye provided: %s', whichEye); + return null; + } + return offset; +}; +CardboardVRDisplay.prototype.getEyeParameters = function (whichEye) { + var offset = this._getEyeOffset(whichEye); + var fieldOfView = this._getFieldOfView(whichEye); + var eyeParams = { + offset: offset, + renderWidth: this.deviceInfo_.device.width * 0.5 * this.bufferScale_, + renderHeight: this.deviceInfo_.device.height * this.bufferScale_ + }; + Object.defineProperty(eyeParams, 'fieldOfView', { + enumerable: true, + get: function get() { + deprecateWarning('VRFieldOfView', 'VRFrameData\'s projection matrices'); + return fieldOfView; + } + }); + return eyeParams; +}; +CardboardVRDisplay.prototype.onDeviceParamsUpdated_ = function (newParams) { + if (this.config.DEBUG) { + console.log('DPDB reported that device params were updated.'); + } + this.deviceInfo_.updateDeviceParams(newParams); + if (this.distorter_) { + this.distorter_.updateDeviceInfo(this.deviceInfo_); + } +}; +CardboardVRDisplay.prototype.updateBounds_ = function () { + if (this.layer_ && this.distorter_ && (this.layer_.leftBounds || this.layer_.rightBounds)) { + this.distorter_.setTextureBounds(this.layer_.leftBounds, this.layer_.rightBounds); + } +}; +CardboardVRDisplay.prototype.beginPresent_ = function () { + var gl = this.layer_.source.getContext('webgl'); + if (!gl) gl = this.layer_.source.getContext('experimental-webgl'); + if (!gl) gl = this.layer_.source.getContext('webgl2'); + if (!gl) return; + if (this.layer_.predistorted) { + if (!this.config.CARDBOARD_UI_DISABLED) { + gl.canvas.width = getScreenWidth() * this.bufferScale_; + gl.canvas.height = getScreenHeight() * this.bufferScale_; + this.cardboardUI_ = new CardboardUI(gl); + } + } else { + if (!this.config.CARDBOARD_UI_DISABLED) { + this.cardboardUI_ = new CardboardUI(gl); + } + this.distorter_ = new CardboardDistorter(gl, this.cardboardUI_, this.config.BUFFER_SCALE, this.config.DIRTY_SUBMIT_FRAME_BINDINGS); + this.distorter_.updateDeviceInfo(this.deviceInfo_); + } + if (this.cardboardUI_) { + this.cardboardUI_.listen(function (e) { + this.viewerSelector_.show(this.layer_.source.parentElement); + e.stopPropagation(); + e.preventDefault(); + }.bind(this), function (e) { + this.exitPresent(); + e.stopPropagation(); + e.preventDefault(); + }.bind(this)); + } + if (this.rotateInstructions_) { + if (isLandscapeMode() && isMobile()) { + this.rotateInstructions_.showTemporarily(3000, this.layer_.source.parentElement); + } else { + this.rotateInstructions_.update(); + } + } + this.orientationHandler = this.onOrientationChange_.bind(this); + window.addEventListener('orientationchange', this.orientationHandler); + this.vrdisplaypresentchangeHandler = this.updateBounds_.bind(this); + window.addEventListener('vrdisplaypresentchange', this.vrdisplaypresentchangeHandler); + this.fireVRDisplayDeviceParamsChange_(); +}; +CardboardVRDisplay.prototype.endPresent_ = function () { + if (this.distorter_) { + this.distorter_.destroy(); + this.distorter_ = null; + } + if (this.cardboardUI_) { + this.cardboardUI_.destroy(); + this.cardboardUI_ = null; + } + if (this.rotateInstructions_) { + this.rotateInstructions_.hide(); + } + this.viewerSelector_.hide(); + window.removeEventListener('orientationchange', this.orientationHandler); + window.removeEventListener('vrdisplaypresentchange', this.vrdisplaypresentchangeHandler); +}; +CardboardVRDisplay.prototype.updatePresent_ = function () { + this.endPresent_(); + this.beginPresent_(); +}; +CardboardVRDisplay.prototype.submitFrame = function (pose) { + if (this.distorter_) { + this.updateBounds_(); + this.distorter_.submitFrame(); + } else if (this.cardboardUI_ && this.layer_) { + var canvas = this.layer_.source.getContext('webgl').canvas; + if (canvas.width != this.lastWidth || canvas.height != this.lastHeight) { + this.cardboardUI_.onResize(); + } + this.lastWidth = canvas.width; + this.lastHeight = canvas.height; + this.cardboardUI_.render(); + } +}; +CardboardVRDisplay.prototype.onOrientationChange_ = function (e) { + this.viewerSelector_.hide(); + if (this.rotateInstructions_) { + this.rotateInstructions_.update(); + } + this.onResize_(); +}; +CardboardVRDisplay.prototype.onResize_ = function (e) { + if (this.layer_) { + var gl = this.layer_.source.getContext('webgl'); + var cssProperties = ['position: absolute', 'top: 0', 'left: 0', + 'width: 100vw', 'height: 100vh', 'border: 0', 'margin: 0', + 'padding: 0px', 'box-sizing: content-box']; + gl.canvas.setAttribute('style', cssProperties.join('; ') + ';'); + safariCssSizeWorkaround(gl.canvas); + } +}; +CardboardVRDisplay.prototype.onViewerChanged_ = function (viewer) { + this.deviceInfo_.setViewer(viewer); + if (this.distorter_) { + this.distorter_.updateDeviceInfo(this.deviceInfo_); + } + this.fireVRDisplayDeviceParamsChange_(); +}; +CardboardVRDisplay.prototype.fireVRDisplayDeviceParamsChange_ = function () { + var event = new CustomEvent('vrdisplaydeviceparamschange', { + detail: { + vrdisplay: this, + deviceInfo: this.deviceInfo_ + } + }); + window.dispatchEvent(event); +}; +CardboardVRDisplay.VRFrameData = VRFrameData; +CardboardVRDisplay.VRDisplay = VRDisplay; +return CardboardVRDisplay; +}))); +}); +var CardboardVRDisplay = unwrapExports(cardboardVrDisplay); + +var PolyfilledXRDevice = function (_EventTarget) { + inherits(PolyfilledXRDevice, _EventTarget); + function PolyfilledXRDevice(global) { + classCallCheck(this, PolyfilledXRDevice); + var _this = possibleConstructorReturn(this, (PolyfilledXRDevice.__proto__ || Object.getPrototypeOf(PolyfilledXRDevice)).call(this)); + _this.global = global; + _this.onWindowResize = _this.onWindowResize.bind(_this); + _this.global.window.addEventListener('resize', _this.onWindowResize); + return _this; + } + createClass(PolyfilledXRDevice, [{ + key: 'onBaseLayerSet', + value: function onBaseLayerSet(sessionId, layer) { + throw new Error('Not implemented'); + } + }, { + key: 'supportsSession', + value: function supportsSession() { + throw new Error('Not implemented'); + } + }, { + key: 'requestSession', + value: function requestSession() { + return new Promise(function ($return, $error) { + return $error(new Error('Not implemented')); + }.bind(this)); + } + }, { + key: 'requestAnimationFrame', + value: function requestAnimationFrame(callback) { + throw new Error('Not implemented'); + } + }, { + key: 'onFrameStart', + value: function onFrameStart() { + throw new Error('Not implemented'); + } + }, { + key: 'onFrameEnd', + value: function onFrameEnd(sessionId) { + throw new Error('Not implemented'); + } + }, { + key: 'requestStageBounds', + value: function requestStageBounds() { + throw new Error('Not implemented'); + } + }, { + key: 'requestFrameOfReferenceTransform', + value: function requestFrameOfReferenceTransform(type, options) { + return new Promise(function ($return, $error) { + return $return(undefined); + }.bind(this)); + } + }, { + key: 'cancelAnimationFrame', + value: function cancelAnimationFrame(handle) { + throw new Error('Not implemented'); + } + }, { + key: 'endSession', + value: function endSession(sessionId) { + throw new Error('Not implemented'); + } + }, { + key: 'getViewport', + value: function getViewport(sessionId, eye, layer, target) { + throw new Error('Not implemented'); + } + }, { + key: 'getProjectionMatrix', + value: function getProjectionMatrix(eye) { + throw new Error('Not implemented'); + } + }, { + key: 'getBasePoseMatrix', + value: function getBasePoseMatrix() { + throw new Error('Not implemented'); + } + }, { + key: 'getBaseViewMatrix', + value: function getBaseViewMatrix(eye) { + throw new Error('Not implemented'); + } + }, { + key: 'onWindowResize', + value: function onWindowResize() { + this.onWindowResize(); + } + }, { + key: 'depthNear', + get: function get$$1() { + throw new Error('Not implemented'); + } + , + set: function set$$1(val) { + throw new Error('Not implemented'); + } + }, { + key: 'depthFar', + get: function get$$1() { + throw new Error('Not implemented'); + } + , + set: function set$$1(val) { + throw new Error('Not implemented'); + } + }]); + return PolyfilledXRDevice; +}(EventTarget); + +var SESSION_ID = 0; +var Session = function Session(sessionOptions) { + classCallCheck(this, Session); + this.outputContext = sessionOptions.outputContext; + this.exclusive = sessionOptions.exclusive; + this.ended = null; + this.baseLayer = null; + this.id = ++SESSION_ID; + this.modifiedCanvasLayer = false; +}; + +var WebVRDevice = function (_PolyfilledXRDevice) { + inherits(WebVRDevice, _PolyfilledXRDevice); + function WebVRDevice(global, display) { + classCallCheck(this, WebVRDevice); + var canPresent = display.capabilities.canPresent; + var _this = possibleConstructorReturn(this, (WebVRDevice.__proto__ || Object.getPrototypeOf(WebVRDevice)).call(this, global)); + _this.display = display; + _this.frame = new global.VRFrameData(); + _this.sessions = new Map(); + _this.canPresent = canPresent; + _this.baseModelMatrix = mat4_identity(new Float32Array(16)); + _this.tempVec3 = new Float32Array(3); + _this.onVRDisplayPresentChange = _this.onVRDisplayPresentChange.bind(_this); + global.window.addEventListener('vrdisplaypresentchange', _this.onVRDisplayPresentChange); + return _this; + } + createClass(WebVRDevice, [{ + key: 'onBaseLayerSet', + value: function onBaseLayerSet(sessionId, layer) { + var _this2 = this; + var session = this.sessions.get(sessionId); + var canvas = layer.context.canvas; + if (session.exclusive) { + var left = this.display.getEyeParameters('left'); + var right = this.display.getEyeParameters('right'); + canvas.width = Math.max(left.renderWidth, right.renderWidth) * 2; + canvas.height = Math.max(left.renderHeight, right.renderHeight); + this.display.requestPresent([{ source: canvas }]).then(function () { + if ("production" !== 'test' && !_this2.global.document.body.contains(canvas)) { + session.modifiedCanvasLayer = true; + _this2.global.document.body.appendChild(canvas); + applyCanvasStylesForMinimalRendering(canvas); + } + session.baseLayer = layer; + }); + } + else if (session.outputContext) { + session.baseLayer = layer; + } + } + }, { + key: 'supportsSession', + value: function supportsSession() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + if (options.exclusive === true && this.canPresent === false) { + return false; + } + return true; + } + }, { + key: 'requestSession', + value: function requestSession() { + var $args = arguments;return new Promise(function ($return, $error) { + var options, canvas, ctx, session; + options = $args.length > 0 && $args[0] !== undefined ? $args[0] : {}; + if (!this.supportsSession(options)) { + return $return(Promise.reject()); + } + if (options.exclusive) { + canvas = this.global.document.createElement('canvas'); + { + ctx = canvas.getContext('webgl'); + } + return Promise.resolve(this.display.requestPresent([{ source: canvas }])).then(function ($await_2) { + try { + return $If_1.call(this); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this), $error); + } + function $If_1() { + session = new Session(options); + this.sessions.set(session.id, session); + if (options.exclusive) { + this.dispatchEvent('@@webxr-polyfill/vr-present-start', session.id); + } + return $return(Promise.resolve(session.id)); + } + return $If_1.call(this); + }.bind(this)); + } + }, { + key: 'requestAnimationFrame', + value: function requestAnimationFrame(callback) { + return this.display.requestAnimationFrame(callback); + } + }, { + key: 'onFrameStart', + value: function onFrameStart() { + this.display.getFrameData(this.frame); + } + }, { + key: 'onFrameEnd', + value: function onFrameEnd(sessionId) { + var session = this.sessions.get(sessionId); + if (session.ended || !session.baseLayer) { + return; + } + if (session.outputContext && !(session.exclusive && !this.display.capabilities.hasExternalDisplay)) { + var canvas = session.baseLayer.context.canvas; + var iWidth = canvas.width / 2; + var iHeight = canvas.height; + { + var outputCanvas = session.outputContext.canvas; + var outputContext = outputCanvas.getContext('2d'); + var oWidth = outputCanvas.width; + var oHeight = outputCanvas.height; + outputContext.drawImage(canvas, 0, 0, iWidth, iHeight, 0, 0, oWidth, oHeight); + } + } + if (session.exclusive && session.baseLayer) { + this.display.submitFrame(); + } + } + }, { + key: 'cancelAnimationFrame', + value: function cancelAnimationFrame(handle) { + this.display.cancelAnimationFrame(handle); + } + }, { + key: 'endSession', + value: function endSession(sessionId) { + return new Promise(function ($return, $error) { + var session = this.sessions.get(sessionId); + if (session.ended) { + return $return(); + } + if (session.exclusive) { + return $return(this.display.exitPresent()); + } else { + session.ended = true; + } + return $return(); + }.bind(this)); + } + }, { + key: 'requestStageBounds', + value: function requestStageBounds() { + if (this.display.stageParameters) { + var width = this.display.stageParameters.sizeX; + var depth = this.display.stageParameters.sizeZ; + var data = []; + data.push(-width / 2); + data.push(-depth / 2); + data.push(width / 2); + data.push(-depth / 2); + data.push(width / 2); + data.push(depth / 2); + data.push(-width / 2); + data.push(depth / 2); + return data; + } + return null; + } + }, { + key: 'requestFrameOfReferenceTransform', + value: function requestFrameOfReferenceTransform(type, options) { + return new Promise(function ($return, $error) { + if (type === 'stage' && this.display.stageParameters && this.display.stageParameters.sittingToStandingTransform) { + return $return(this.display.stageParameters.sittingToStandingTransform); + } + return $return(); + }.bind(this)); + } + }, { + key: 'getProjectionMatrix', + value: function getProjectionMatrix(eye) { + if (eye === 'left') { + return this.frame.leftProjectionMatrix; + } else if (eye === 'right') { + return this.frame.rightProjectionMatrix; + } else { + throw new Error('eye must be of type \'left\' or \'right\''); + } + } + }, { + key: 'getViewport', + value: function getViewport(sessionId, eye, layer, target) { + var session = this.sessions.get(sessionId); + var _layer$context$canvas = layer.context.canvas, + width = _layer$context$canvas.width, + height = _layer$context$canvas.height; + if (!session.exclusive) { + target.x = target.y = 0; + target.width = width; + target.height = height; + return true; + } + if (eye === 'left') { + target.x = 0; + } else if (eye === 'right') { + target.x = width / 2; + } else { + return false; + } + target.y = 0; + target.width = width / 2; + target.height = height; + return true; + } + }, { + key: 'getBasePoseMatrix', + value: function getBasePoseMatrix() { + var _frame$pose = this.frame.pose, + position = _frame$pose.position, + orientation = _frame$pose.orientation; + if (!position && !orientation) { + return this.baseModelMatrix; + } + if (!position) { + position = this.tempVec3; + position[0] = position[1] = position[2] = 0; + } + mat4_fromRotationTranslation(this.baseModelMatrix, orientation, position); + return this.baseModelMatrix; + } + }, { + key: 'getBaseViewMatrix', + value: function getBaseViewMatrix(eye) { + if (eye === 'left') { + return this.frame.leftViewMatrix; + } else if (eye === 'right') { + return this.frame.rightViewMatrix; + } else { + throw new Error('eye must be of type \'left\' or \'right\''); + } + } + }, { + key: 'onWindowResize', + value: function onWindowResize() {} + }, { + key: 'onVRDisplayPresentChange', + value: function onVRDisplayPresentChange(e) { + var _this3 = this; + if (!this.display.isPresenting) { + this.sessions.forEach(function (session) { + if (session.exclusive && !session.ended) { + if (session.modifiedCanvasLayer) { + var canvas = session.baseLayer.context.canvas; + document.body.removeChild(canvas); + canvas.setAttribute('style', ''); + } + _this3.dispatchEvent('@@webxr-polyfill/vr-present-end', session.id); + } + }); + } + } + }, { + key: 'depthNear', + get: function get$$1() { + return this.display.depthNear; + } + , + set: function set$$1(val) { + this.display.depthNear = val; + } + }, { + key: 'depthFar', + get: function get$$1() { + return this.display.depthFar; + } + , + set: function set$$1(val) { + this.display.depthFar = val; + } + }]); + return WebVRDevice; +}(PolyfilledXRDevice); + +var CardboardXRDevice = function (_WebVRDevice) { + inherits(CardboardXRDevice, _WebVRDevice); + function CardboardXRDevice(global) { + classCallCheck(this, CardboardXRDevice); + var display = new CardboardVRDisplay(); + var _this = possibleConstructorReturn(this, (CardboardXRDevice.__proto__ || Object.getPrototypeOf(CardboardXRDevice)).call(this, global, display)); + _this.display = display; + _this.frame = { + rightViewMatrix: new Float32Array(16), + leftViewMatrix: new Float32Array(16), + rightProjectionMatrix: new Float32Array(16), + leftProjectionMatrix: new Float32Array(16), + pose: null, + timestamp: null + }; + return _this; + } + return CardboardXRDevice; +}(WebVRDevice); + +var getXRDevice = function getXRDevice(global) { + return new Promise(function ($return, $error) { + var device; + device = null; + if ('xr' in global.navigator) { + var $Try_1_Post = function () { + try { + return $If_3.call(this); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this);var $Try_1_Catch = function (e) { + try { + return $Try_1_Post(); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this); + try { + return Promise.resolve(global.navigator.xr.requestDevice()).then(function ($await_6) { + try { + device = $await_6; + return $Try_1_Post(); + } catch ($boundEx) { + return $Try_1_Catch($boundEx); + } + }.bind(this), $Try_1_Catch); + } catch (e) { + $Try_1_Catch(e); + } + } + function $If_3() { + return $return(device); + } + return $If_3.call(this); + }.bind(this)); +}; +var getVRDisplay = function getVRDisplay(global) { + return new Promise(function ($return, $error) { + var device, displays; + device = null; + if ('getVRDisplays' in global.navigator) { + var $Try_2_Post = function () { + try { + return $If_4.call(this); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this);var $Try_2_Catch = function (e) { + try { + return $Try_2_Post(); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this); + try { + return Promise.resolve(global.navigator.getVRDisplays()).then(function ($await_7) { + try { + displays = $await_7; + if (displays && displays.length) { + device = new WebVRDevice(global, displays[0]); + } + return $Try_2_Post(); + } catch ($boundEx) { + return $Try_2_Catch($boundEx); + } + }.bind(this), $Try_2_Catch); + } catch (e) { + $Try_2_Catch(e); + } + } + function $If_4() { + return $return(device); + } + return $If_4.call(this); + }.bind(this)); +}; +var requestDevice = function requestDevice(global, config) { + return new Promise(function ($return, $error) { + var device; + return Promise.resolve(getXRDevice(global)).then(function ($await_8) { + try { + device = $await_8; + if (device) { + return $return(device); + } + if (config.webvr) { + return Promise.resolve(getVRDisplay(global)).then(function ($await_9) { + try { + device = $await_9; + if (device) { + return $return(new XRDevice(device)); + } + return $If_5.call(this); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this), $error); + } + function $If_5() { + if (config.cardboard && isMobile(global)) { + if (!global.VRFrameData) { + global.VRFrameData = function () { + this.rightViewMatrix = new Float32Array(16); + this.leftViewMatrix = new Float32Array(16); + this.rightProjectionMatrix = new Float32Array(16); + this.leftProjectionMatrix = new Float32Array(16); + this.pose = null; + }; + } + return $return(new XRDevice(new CardboardXRDevice(global))); + } + return $return(null); + } + return $If_5.call(this); + } catch ($boundEx) { + return $error($boundEx); + } + }.bind(this), $error); + }.bind(this)); +}; + +var CONFIG_DEFAULTS = { + webvr: true, + cardboard: true +}; +var partials = ['navigator', 'HTMLCanvasElement', 'WebGLRenderingContext']; +var WebXRPolyfill = function () { + function WebXRPolyfill(global) { + var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + classCallCheck(this, WebXRPolyfill); + this.global = global || _global; + this.config = Object.freeze(Object.assign({}, CONFIG_DEFAULTS, config)); + this.nativeWebXR = 'xr' in this.global.navigator; + this.injected = false; + if (!this.nativeWebXR) { + this._injectPolyfill(this.global); + } + else if (this.config.cardboard && isMobile(this.global)) { + this._patchRequestDevice(); + } + } + createClass(WebXRPolyfill, [{ + key: '_injectPolyfill', + value: function _injectPolyfill(global) { + if (!partials.every(function (iface) { + return !!global[iface]; + })) { + throw new Error('Global must have the following attributes : ' + partials); + } + var _iteratorNormalCompletion = true; + var _didIteratorError = false; + var _iteratorError = undefined; + try { + for (var _iterator = Object.keys(API)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { + var className = _step.value; + if (global[className] !== undefined) { + console.warn(className + ' already defined on global.'); + } else { + global[className] = API[className]; + } + } + } catch (err) { + _didIteratorError = true; + _iteratorError = err; + } finally { + try { + if (!_iteratorNormalCompletion && _iterator.return) { + _iterator.return(); + } + } finally { + if (_didIteratorError) { + throw _iteratorError; + } + } + } + { + var polyfilledCtx = extendContextCompatibleXRDevice(global.WebGLRenderingContext); + if (polyfilledCtx) { + extendGetContext(global.HTMLCanvasElement); + } + } + this.injected = true; + this._patchRequestDevice(); + } + }, { + key: '_patchRequestDevice', + value: function _patchRequestDevice() { + var device = requestDevice(this.global, this.config); + this.xr = new XR(device); + Object.defineProperty(this.global.navigator, 'xr', { + value: this.xr, + configurable: true + }); + } + }]); + return WebXRPolyfill; +}(); + +return WebXRPolyfill; + +}))); diff --git a/build/webxr-polyfill.min.js b/build/webxr-polyfill.min.js new file mode 100644 index 0000000..82b20da --- /dev/null +++ b/build/webxr-polyfill.min.js @@ -0,0 +1,95 @@ +/** + * @license + * webxr-polyfill + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * cardboard-vr-display + * Copyright (c) 2015-2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * webvr-polyfill-dpdb + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @license + * wglu-preserve-state + * Copyright (c) 2016, Brandon Jones. + * + * 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. + */ +/** + * @license + * nosleep.js + * Copyright (c) 2017, Rich Tibbett + * + * 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. + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.WebXRPolyfill=t()}(this,function(){"use strict";var e="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},i=function(){function e(e,t){for(var i=0;i=0;M--)i[M]===t&&i.pop()}},{key:"dispatchEvent",value:function(e,t){for(var i=this[s].listeners.get(e)||[],M=[],r=0;r1&&void 0!==t[1]?t[1]:{},this[U].ended)return i();if(r=Object.assign({},v,r),!k.includes(e))return M(new Error("XRFrameOfReferenceType must be one of "+k));s=null,n=null;var A=function(){try{return"stage"===e&&s&&(n=this[U].polyfill.requestStageBounds())&&(n=new p(n)),i(new b(this[U].polyfill,e,r,s,n))}catch(e){return M(e)}}.bind(this),u=function(t){try{if("stage"!==e||r.disableStageEmulation)throw t;return A()}catch(e){return M(e)}}.bind(this);try{return Promise.resolve(this[U].polyfill.requestFrameOfReferenceTransform(e,r)).then(function(e){try{return s=e,A()}catch(e){return u(e)}}.bind(this),u)}catch(e){u(e)}}.bind(this))}},{key:"requestAnimationFrame",value:function(e){var t=this;if(!(this[U].ended||this[U].suspended&&this[U].suspendedCallback))return this[U].suspended&&!this[U].suspendedCallback&&(this[U].suspendedCallback=e),this[U].polyfill.requestAnimationFrame(function(){t[U].polyfill.onFrameStart(),e(N(),t[U].frame),t[U].polyfill.onFrameEnd(t[U].id)})}},{key:"cancelAnimationFrame",value:function(e){this[U].ended||this[U].polyfill.cancelAnimationFrame(e)}},{key:"end",value:function(){return new Promise(function(e,t){return this[U].ended?e():(this.exclusive||(this[U].ended=!0,this[U].polyfill.removeEventListener("@@webvr-polyfill/vr-present-start",this[U].onPresentationStart),this[U].polyfill.removeEventListener("@@webvr-polyfill/vr-present-end",this[U].onPresentationEnd),this.dispatchEvent("end",{session:this})),e(this[U].polyfill.endSession(this[U].id)))}.bind(this))}},{key:"device",get:function(){return this[U].device}},{key:"exclusive",get:function(){return this[U].exclusive}},{key:"outputContext",get:function(){return this[U].outputContext}},{key:"depthNear",get:function(){return this[U].polyfill.depthNear},set:function(e){this[U].polyfill.depthNear=e}},{key:"depthFar",get:function(){return this[U].polyfill.depthFar},set:function(e){this[U].polyfill.depthFar=e}},{key:"baseLayer",get:function(){return this[U].baseLayer},set:function(e){this[U].ended||(this[U].baseLayer=e,this[U].polyfill.onBaseLayerSet(this[U].id,e))}}]),s}(),R=Symbol("@@webxr-polyfill/XRDevice"),G=function(e){function s(e){if(t(this,s),!e)throw new Error("XRDevice must receive a PolyfilledXRDevice.");var i=r(this,(s.__proto__||Object.getPrototypeOf(s)).call(this));return i[R]={polyfill:e,exclusiveSession:null,nonExclusiveSessions:new Set},i.ondeactive=void 0,i}return M(s,n),i(s,[{key:"supportsSession",value:function(){var e=arguments;return new Promise(function(t,i){var M=e.length>0&&void 0!==e[0]?e[0]:{};return M=Object.assign({},B,M),Y(M)&&this[R].polyfill.supportsSession(M)?t(null):t(Promise.reject(null))}.bind(this))}},{key:"requestSession",value:function(e){return new Promise(function(t,i){var M,r,s,n;return M=this,e=Object.assign({},B,e),Y(e)?this[R].exclusiveSession&&e.exclusive?i(new Error("InvalidStateError")):Promise.resolve(this[R].polyfill.requestSession(e)).then(function(A){try{return r=A,s=new _(this[R].polyfill,this,e,r),e.exclusive?this[R].exclusiveSession=s:this[R].nonExclusiveSessions.add(s),n=function e(){s.exclusive?M[R].exclusiveSession=null:M[R].nonExclusiveSessions.delete(s),s.removeEventListener("end",e)},s.addEventListener("end",n),t(s)}catch(e){return i(e)}}.bind(this),i):i(new Error("NotSupportedError"))}.bind(this))}}]),s}(),P=function(){function e(){t(this,e)}return i(e,[{key:"getViewport",value:function(e){return e._getViewport(this)}}]),e}(),F=Symbol("@@webxr-polyfill/polyfilled-compatible-xr-device"),W=Symbol("@@webxr-polyfill/compatible-xr-device"),Z=Symbol("@@webxr-polyfill/XRWebGLLayer"),H=Object.freeze({antialias:!0,depth:!1,stencil:!1,alpha:!0,multiview:!1,framebufferScaleFactor:0}),V=function(e){function s(e,i){var M=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t(this,s);var n=Object.assign({},H,M);if(!(e instanceof _))throw new Error("session must be a XRSession");if(e.ended)throw new Error("InvalidStateError");if(i[F]&&i[W]!==e.device)throw new Error("InvalidStateError");var A=i.getParameter(i.FRAMEBUFFER_BINDING),u=r(this,(s.__proto__||Object.getPrototypeOf(s)).call(this));return u[Z]={context:i,config:n,framebuffer:A},u}return M(s,P),i(s,[{key:"requestViewportScaling",value:function(e){console.warn("requestViewportScaling is not yet implemented")}},{key:"context",get:function(){return this[Z].context}},{key:"antialias",get:function(){return this[Z].config.antialias}},{key:"depth",get:function(){return this[Z].config.depth}},{key:"stencil",get:function(){return this[Z].config.stencil}},{key:"alpha",get:function(){return this[Z].config.alpha}},{key:"multiview",get:function(){return!1}},{key:"framebuffer",get:function(){return this[Z].framebuffer}},{key:"framebufferWidth",get:function(){return this[Z].context.drawingBufferWidth}},{key:"framebufferHeight",get:function(){return this[Z].context.drawingBufferHeight}}]),s}(),X={XR:u,XRDevice:G,XRSession:_,XRPresentationFrame:x,XRView:d,XRViewport:T,XRDevicePose:l,XRLayer:P,XRWebGLLayer:V,XRPresentationContext:g,XRCoordinateSystem:S,XRFrameOfReference:b,XRStageBounds:p,XRStageBoundsPoint:C},J=function(e){var t,i=!1;return t=e.navigator.userAgent||e.navigator.vendor||e.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(i=!0),i},q="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var K,$,ee=(function(e,t){e.exports=function(){var e,t,i,M=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},r=function(){function e(e,t){for(var i=0;ie.TEXTURE31){console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"),M.push(null,null);break}r||(r=e.getParameter(e.ACTIVE_TEXTURE)),e.activeTexture(A),M.push(e.getParameter(n),null);break;case e.ACTIVE_TEXTURE:r=e.getParameter(e.ACTIVE_TEXTURE),M.push(null);break;default:M.push(e.getParameter(n))}}i(e);for(var s=0;se.TEXTURE31)break;e.activeTexture(A),e.bindTexture(e.TEXTURE_2D,u);break;case e.TEXTURE_BINDING_CUBE_MAP:var A=t[++s];if(Ae.TEXTURE31)break;e.activeTexture(A),e.bindTexture(e.TEXTURE_CUBE_MAP,u);break;case e.VIEWPORT:e.viewport(u[0],u[1],u[2],u[3]);break;case e.BLEND:case e.CULL_FACE:case e.DEPTH_TEST:case e.SCISSOR_TEST:case e.STENCIL_TEST:u?e.enable(n):e.disable(n);break;default:console.log("No GL restore behavior for 0x"+n.toString(16))}r&&e.activeTexture(r)}}else i(e)},O=["attribute vec2 position;","attribute vec3 texCoord;","varying vec2 vTexCoord;","uniform vec4 viewportOffsetScale[2];","void main() {"," vec4 viewport = viewportOffsetScale[int(texCoord.z)];"," vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;"," gl_Position = vec4( position, 1.0, 1.0 );","}"].join("\n"),C=["precision mediump float;","uniform sampler2D diffuse;","varying vec2 vTexCoord;","void main() {"," gl_FragColor = texture2D(diffuse, vTexCoord);","}"].join("\n");function f(e,t,i,M){this.gl=e,this.cardboardUI=t,this.bufferScale=i,this.dirtySubmitFrameBindings=M,this.ctxAttribs=e.getContextAttributes(),this.meshWidth=20,this.meshHeight=20,this.bufferWidth=e.drawingBufferWidth,this.bufferHeight=e.drawingBufferHeight,this.realBindFramebuffer=e.bindFramebuffer,this.realEnable=e.enable,this.realDisable=e.disable,this.realColorMask=e.colorMask,this.realClearColor=e.clearColor,this.realViewport=e.viewport,A()||(this.realCanvasWidth=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"width"),this.realCanvasHeight=Object.getOwnPropertyDescriptor(e.canvas.__proto__,"height")),this.isPatched=!1,this.lastBoundFramebuffer=null,this.cullFace=!1,this.depthTest=!1,this.blend=!1,this.scissorTest=!1,this.stencilTest=!1,this.viewport=[0,0,0,0],this.colorMask=[!0,!0,!0,!0],this.clearColor=[0,0,0,0],this.attribs={position:0,texCoord:1},this.program=I(e,O,C,this.attribs),this.uniforms=y(e,this.program),this.viewportOffsetScale=new Float32Array(8),this.setTextureBounds(),this.vertexBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),this.indexCount=0,this.renderTarget=e.createTexture(),this.framebuffer=e.createFramebuffer(),this.depthStencilBuffer=null,this.depthBuffer=null,this.stencilBuffer=null,this.ctxAttribs.depth&&this.ctxAttribs.stencil?this.depthStencilBuffer=e.createRenderbuffer():this.ctxAttribs.depth?this.depthBuffer=e.createRenderbuffer():this.ctxAttribs.stencil&&(this.stencilBuffer=e.createRenderbuffer()),this.patch(),this.onResize()}f.prototype.destroy=function(){var e=this.gl;this.unpatch(),e.deleteProgram(this.program),e.deleteBuffer(this.vertexBuffer),e.deleteBuffer(this.indexBuffer),e.deleteTexture(this.renderTarget),e.deleteFramebuffer(this.framebuffer),this.depthStencilBuffer&&e.deleteRenderbuffer(this.depthStencilBuffer),this.depthBuffer&&e.deleteRenderbuffer(this.depthBuffer),this.stencilBuffer&&e.deleteRenderbuffer(this.stencilBuffer),this.cardboardUI&&this.cardboardUI.destroy()},f.prototype.onResize=function(){var e=this.gl,t=this,i=[e.RENDERBUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0];x(e,i,function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.framebuffer),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.texImage2D(e.TEXTURE_2D,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,t.bufferWidth,t.bufferHeight,0,t.ctxAttribs.alpha?e.RGBA:e.RGB,e.UNSIGNED_BYTE,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t.renderTarget,0),t.ctxAttribs.depth&&t.ctxAttribs.stencil?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t.depthStencilBuffer)):t.ctxAttribs.depth?(e.bindRenderbuffer(e.RENDERBUFFER,t.depthBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t.depthBuffer)):t.ctxAttribs.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,t.stencilBuffer),e.renderbufferStorage(e.RENDERBUFFER,e.STENCIL_INDEX8,t.bufferWidth,t.bufferHeight),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.STENCIL_ATTACHMENT,e.RENDERBUFFER,t.stencilBuffer)),!e.checkFramebufferStatus(e.FRAMEBUFFER)===e.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer incomplete!"),t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),t.realClearColor.apply(e,t.clearColor)}),this.cardboardUI&&this.cardboardUI.onResize()},f.prototype.patch=function(){if(!this.isPatched){var e=this,t=this.gl.canvas,i=this.gl;A()||(t.width=c()*this.bufferScale,t.height=L()*this.bufferScale,Object.defineProperty(t,"width",{configurable:!0,enumerable:!0,get:function(){return e.bufferWidth},set:function(i){e.bufferWidth=i,e.realCanvasWidth.set.call(t,i),e.onResize()}}),Object.defineProperty(t,"height",{configurable:!0,enumerable:!0,get:function(){return e.bufferHeight},set:function(i){e.bufferHeight=i,e.realCanvasHeight.set.call(t,i),e.onResize()}})),this.lastBoundFramebuffer=i.getParameter(i.FRAMEBUFFER_BINDING),null==this.lastBoundFramebuffer&&(this.lastBoundFramebuffer=this.framebuffer,this.gl.bindFramebuffer(i.FRAMEBUFFER,this.framebuffer)),this.gl.bindFramebuffer=function(t,M){e.lastBoundFramebuffer=M||e.framebuffer,e.realBindFramebuffer.call(i,t,e.lastBoundFramebuffer)},this.cullFace=i.getParameter(i.CULL_FACE),this.depthTest=i.getParameter(i.DEPTH_TEST),this.blend=i.getParameter(i.BLEND),this.scissorTest=i.getParameter(i.SCISSOR_TEST),this.stencilTest=i.getParameter(i.STENCIL_TEST),i.enable=function(t){switch(t){case i.CULL_FACE:e.cullFace=!0;break;case i.DEPTH_TEST:e.depthTest=!0;break;case i.BLEND:e.blend=!0;break;case i.SCISSOR_TEST:e.scissorTest=!0;break;case i.STENCIL_TEST:e.stencilTest=!0}e.realEnable.call(i,t)},i.disable=function(t){switch(t){case i.CULL_FACE:e.cullFace=!1;break;case i.DEPTH_TEST:e.depthTest=!1;break;case i.BLEND:e.blend=!1;break;case i.SCISSOR_TEST:e.scissorTest=!1;break;case i.STENCIL_TEST:e.stencilTest=!1}e.realDisable.call(i,t)},this.colorMask=i.getParameter(i.COLOR_WRITEMASK),i.colorMask=function(t,M,r,s){e.colorMask[0]=t,e.colorMask[1]=M,e.colorMask[2]=r,e.colorMask[3]=s,e.realColorMask.call(i,t,M,r,s)},this.clearColor=i.getParameter(i.COLOR_CLEAR_VALUE),i.clearColor=function(t,M,r,s){e.clearColor[0]=t,e.clearColor[1]=M,e.clearColor[2]=r,e.clearColor[3]=s,e.realClearColor.call(i,t,M,r,s)},this.viewport=i.getParameter(i.VIEWPORT),i.viewport=function(t,M,r,s){e.viewport[0]=t,e.viewport[1]=M,e.viewport[2]=r,e.viewport[3]=s,e.realViewport.call(i,t,M,r,s)},this.isPatched=!0,T(t)}},f.prototype.unpatch=function(){if(this.isPatched){var e=this.gl,t=this.gl.canvas;A()||(Object.defineProperty(t,"width",this.realCanvasWidth),Object.defineProperty(t,"height",this.realCanvasHeight)),t.width=this.bufferWidth,t.height=this.bufferHeight,e.bindFramebuffer=this.realBindFramebuffer,e.enable=this.realEnable,e.disable=this.realDisable,e.colorMask=this.realColorMask,e.clearColor=this.realClearColor,e.viewport=this.realViewport,this.lastBoundFramebuffer==this.framebuffer&&e.bindFramebuffer(e.FRAMEBUFFER,null),this.isPatched=!1,setTimeout(function(){T(t)},1)}},f.prototype.setTextureBounds=function(e,t){e||(e=[0,0,.5,1]),t||(t=[.5,0,.5,1]),this.viewportOffsetScale[0]=e[0],this.viewportOffsetScale[1]=e[1],this.viewportOffsetScale[2]=e[2],this.viewportOffsetScale[3]=e[3],this.viewportOffsetScale[4]=t[0],this.viewportOffsetScale[5]=t[1],this.viewportOffsetScale[6]=t[2],this.viewportOffsetScale[7]=t[3]},f.prototype.submitFrame=function(){var e=this.gl,t=this,i=[];if(this.dirtySubmitFrameBindings||i.push(e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING,e.ELEMENT_ARRAY_BUFFER_BINDING,e.TEXTURE_BINDING_2D,e.TEXTURE0),x(e,i,function(e){t.realBindFramebuffer.call(e,e.FRAMEBUFFER,null),t.cullFace&&t.realDisable.call(e,e.CULL_FACE),t.depthTest&&t.realDisable.call(e,e.DEPTH_TEST),t.blend&&t.realDisable.call(e,e.BLEND),t.scissorTest&&t.realDisable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realDisable.call(e,e.STENCIL_TEST),t.realColorMask.call(e,!0,!0,!0,!0),t.realViewport.call(e,0,0,e.drawingBufferWidth,e.drawingBufferHeight),(t.ctxAttribs.alpha||A())&&(t.realClearColor.call(e,0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)),e.useProgram(t.program),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.indexBuffer),e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.enableVertexAttribArray(t.attribs.position),e.enableVertexAttribArray(t.attribs.texCoord),e.vertexAttribPointer(t.attribs.position,2,e.FLOAT,!1,20,0),e.vertexAttribPointer(t.attribs.texCoord,3,e.FLOAT,!1,20,8),e.activeTexture(e.TEXTURE0),e.uniform1i(t.uniforms.diffuse,0),e.bindTexture(e.TEXTURE_2D,t.renderTarget),e.uniform4fv(t.uniforms.viewportOffsetScale,t.viewportOffsetScale),e.drawElements(e.TRIANGLES,t.indexCount,e.UNSIGNED_SHORT,0),t.cardboardUI&&t.cardboardUI.renderNoState(),t.realBindFramebuffer.call(t.gl,e.FRAMEBUFFER,t.framebuffer),t.ctxAttribs.preserveDrawingBuffer||(t.realClearColor.call(e,0,0,0,0),e.clear(e.COLOR_BUFFER_BIT)),t.dirtySubmitFrameBindings||t.realBindFramebuffer.call(e,e.FRAMEBUFFER,t.lastBoundFramebuffer),t.cullFace&&t.realEnable.call(e,e.CULL_FACE),t.depthTest&&t.realEnable.call(e,e.DEPTH_TEST),t.blend&&t.realEnable.call(e,e.BLEND),t.scissorTest&&t.realEnable.call(e,e.SCISSOR_TEST),t.stencilTest&&t.realEnable.call(e,e.STENCIL_TEST),t.realColorMask.apply(e,t.colorMask),t.realViewport.apply(e,t.viewport),!t.ctxAttribs.alpha&&t.ctxAttribs.preserveDrawingBuffer||t.realClearColor.apply(e,t.clearColor)}),A()){var M=e.canvas;M.width==t.bufferWidth&&M.height==t.bufferHeight||(t.bufferWidth=M.width,t.bufferHeight=M.height,t.onResize())}},f.prototype.updateDeviceInfo=function(e){var t=this.gl,i=this,M=[t.ARRAY_BUFFER_BINDING,t.ELEMENT_ARRAY_BUFFER_BINDING];x(t,M,function(t){var M=i.computeMeshVertices_(i.meshWidth,i.meshHeight,e);if(t.bindBuffer(t.ARRAY_BUFFER,i.vertexBuffer),t.bufferData(t.ARRAY_BUFFER,M,t.STATIC_DRAW),!i.indexCount){var r=i.computeMeshIndices_(i.meshWidth,i.meshHeight);t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,i.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,r,t.STATIC_DRAW),i.indexCount=r.length}})},f.prototype.computeMeshVertices_=function(e,t,i){for(var M=new Float32Array(2*e*t*5),r=i.getLeftEyeVisibleTanAngles(),s=i.getLeftEyeNoLensTanAngles(),A=i.getLeftEyeVisibleScreenRect(s),u=0,o=0;o<2;o++){for(var a=0;ar-42&&M.clientXi.clientHeight-42?e(M):M.clientX<42&&M.clientY<42&&t(M)},i.addEventListener("click",this.listener,!1)},k.prototype.onResize=function(){var e=this.gl,t=this,i=[e.ARRAY_BUFFER_BINDING];x(e,i,function(e){var i=[],M=e.drawingBufferWidth/2,r=Math.max(screen.width,screen.height)*window.devicePixelRatio,s=e.drawingBufferWidth/r,n=s*window.devicePixelRatio,A=4*n/2,u=42*n,o=28*n/2,a=14*n;function N(e,t){var r=(90-e)*m,s=Math.cos(r),n=Math.sin(r);i.push(Q*s*o+M,Q*n*o+o),i.push(t*s*o+M,t*n*o+o)}i.push(M-A,u),i.push(M-A,e.drawingBufferHeight),i.push(M+A,u),i.push(M+A,e.drawingBufferHeight),t.gearOffset=i.length/2;for(var D=0;D<=6;D++){var g=60*D;N(g,1),N(g+12,1),N(g+20,.75),N(g+40,.75),N(g+48,1)}function c(t,M){i.push(a+t,e.drawingBufferHeight-a-M)}t.gearVertexCount=i.length/2-t.gearOffset,t.arrowOffset=i.length/2;var L=A/Math.sin(45*m);c(0,o),c(o,0),c(o+L,L),c(L,o+L),c(L,o-L),c(0,o),c(o,2*o),c(o+L,2*o-L),c(L,o-L),c(0,o),c(L,o-A),c(28*n,o-A),c(L,o+A),c(28*n,o+A),t.arrowVertexCount=i.length/2-t.arrowOffset,e.bindBuffer(e.ARRAY_BUFFER,t.vertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW)})},k.prototype.render=function(){var e=this.gl,t=this,i=[e.CULL_FACE,e.DEPTH_TEST,e.BLEND,e.SCISSOR_TEST,e.STENCIL_TEST,e.COLOR_WRITEMASK,e.VIEWPORT,e.CURRENT_PROGRAM,e.ARRAY_BUFFER_BINDING];x(e,i,function(e){e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.BLEND),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.colorMask(!0,!0,!0,!0),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),t.renderNoState()})},k.prototype.renderNoState=function(){var e,t,i,M,r,s,n,A,u,o,a=this.gl;a.useProgram(this.program),a.bindBuffer(a.ARRAY_BUFFER,this.vertexBuffer),a.enableVertexAttribArray(this.attribs.position),a.vertexAttribPointer(this.attribs.position,2,a.FLOAT,!1,8,0),a.uniform4f(this.uniforms.color,1,1,1,1),e=this.projMat,t=0,i=a.drawingBufferWidth,M=0,r=a.drawingBufferHeight,A=1/(t-i),u=1/(M-r),o=1/((s=.1)-(n=1024)),e[0]=-2*A,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*o,e[11]=0,e[12]=(t+i)*A,e[13]=(r+M)*u,e[14]=(n+s)*o,e[15]=1,a.uniformMatrix4fv(this.uniforms.projectionMat,!1,this.projMat),a.drawArrays(a.TRIANGLE_STRIP,0,4),a.drawArrays(a.TRIANGLE_STRIP,this.gearOffset,this.gearVertexCount),a.drawArrays(a.TRIANGLE_STRIP,this.arrowOffset,this.arrowVertexCount)},v.prototype.distortInverse=function(e){for(var t=0,i=1,M=e-this.distort(t);Math.abs(i-t)>1e-4;){var r=e-this.distort(i),s=i-r*((i-t)/(r-M));t=i,i=s,M=r}return i},v.prototype.distort=function(e){for(var t=e*e,i=0,M=0;M=1)return this.w=s,this.x=i,this.y=M,this.z=r,this;var A=Math.acos(n),u=Math.sqrt(1-n*n);if(Math.abs(u)<.001)return this.w=.5*(s+this.w),this.x=.5*(i+this.x),this.y=.5*(M+this.y),this.z=.5*(r+this.z),this;var o=Math.sin((1-t)*A)/u,a=Math.sin(t*A)/u;return this.w=s*o+this.w*a,this.x=i*o+this.x*a,this.y=M*o+this.y*a,this.z=r*o+this.z*a,this},setFromUnitVectors:function(e,t){return void 0===Y&&(Y=new B),(_=e.dot(t)+1)<1e-6?(_=0,Math.abs(e.x)>Math.abs(e.z)?Y.set(-e.y,e.x,0):Y.set(0,-e.z,e.y)):Y.crossVectors(e,t),this.x=Y.x,this.y=Y.y,this.z=Y.z,this.w=_,this.normalize(),this}};var P=new G({widthMeters:.11,heightMeters:.062,bevelMeters:.004}),F=new G({widthMeters:.1038,heightMeters:.0584,bevelMeters:.004}),W={CardboardV1:new H({id:"CardboardV1",label:"Cardboard I/O 2014",fov:40,interLensDistance:.06,baselineLensDistance:.035,screenLensDistance:.042,distortionCoefficients:[.441,.156],inverseCoefficients:[-.4410035,.42756155,-.4804439,.5460139,-.58821183,.5733938,-.48303202,.33299083,-.17573841,.0651772,-.01488963,.001559834]}),CardboardV2:new H({id:"CardboardV2",label:"Cardboard I/O 2015",fov:60,interLensDistance:.064,baselineLensDistance:.035,screenLensDistance:.039,distortionCoefficients:[.34,.55],inverseCoefficients:[-.33836704,-.18162185,.862655,-1.2462051,1.0560602,-.58208317,.21609078,-.05444823,.009177956,-.0009904169,6183535e-11,-16981803e-13]})};function Z(e){this.viewer=W.CardboardV2,this.updateDeviceParams(e),this.distortion=new v(this.viewer.distortionCoefficients)}function H(e){this.id=e.id,this.label=e.label,this.fov=e.fov,this.interLensDistance=e.interLensDistance,this.baselineLensDistance=e.baselineLensDistance,this.screenLensDistance=e.screenLensDistance,this.distortionCoefficients=e.distortionCoefficients,this.inverseCoefficients=e.inverseCoefficients}Z.prototype.updateDeviceParams=function(e){this.device=this.determineDevice_(e)||this.device},Z.prototype.getDevice=function(){return this.device},Z.prototype.setViewer=function(e){this.viewer=e,this.distortion=new v(this.viewer.distortionCoefficients)},Z.prototype.determineDevice_=function(e){if(!e)return A()?(console.warn("Using fallback iOS device measurements."),F):(console.warn("Using fallback Android device measurements."),P);var t=.0254/e.xdpi,i=.0254/e.ydpi,M=c(),r=L();return new G({widthMeters:t*M,heightMeters:i*r,bevelMeters:.001*e.bevelMm})},Z.prototype.getDistortedFieldOfViewLeftEye=function(){var e=this.viewer,t=this.device,i=this.distortion,M=e.screenLensDistance,r=(t.widthMeters-e.interLensDistance)/2,s=e.interLensDistance/2,n=e.baselineLensDistance-t.bevelMeters,A=t.heightMeters-n,u=U*Math.atan(i.distort(r/M)),o=U*Math.atan(i.distort(s/M)),a=U*Math.atan(i.distort(n/M)),N=U*Math.atan(i.distort(A/M));return{leftDegrees:Math.min(u,e.fov),rightDegrees:Math.min(o,e.fov),downDegrees:Math.min(a,e.fov),upDegrees:Math.min(N,e.fov)}},Z.prototype.getLeftEyeVisibleTanAngles=function(){var e=this.viewer,t=this.device,i=this.distortion,M=Math.tan(-b*e.fov),r=Math.tan(b*e.fov),s=Math.tan(b*e.fov),n=Math.tan(-b*e.fov),A=t.widthMeters/4,u=t.heightMeters/2,o=e.baselineLensDistance-t.bevelMeters-u,a=e.interLensDistance/2-A,N=-o,D=e.screenLensDistance,g=i.distort((a-A)/D),c=i.distort((N+u)/D),L=i.distort((a+A)/D),j=i.distort((N-u)/D),I=new Float32Array(4);return I[0]=Math.max(M,g),I[1]=Math.min(r,c),I[2]=Math.min(s,L),I[3]=Math.max(n,j),I},Z.prototype.getLeftEyeNoLensTanAngles=function(){var e=this.viewer,t=this.device,i=this.distortion,M=new Float32Array(4),r=i.distortInverse(Math.tan(-b*e.fov)),s=i.distortInverse(Math.tan(b*e.fov)),n=i.distortInverse(Math.tan(b*e.fov)),A=i.distortInverse(Math.tan(-b*e.fov)),u=t.widthMeters/4,o=t.heightMeters/2,a=e.baselineLensDistance-t.bevelMeters-o,N=e.interLensDistance/2-u,D=-a,g=e.screenLensDistance,c=(N-u)/g,L=(D+o)/g,j=(N+u)/g,I=(D-o)/g;return M[0]=Math.max(r,c),M[1]=Math.min(s,L),M[2]=Math.min(n,j),M[3]=Math.max(A,I),M},Z.prototype.getLeftEyeVisibleScreenRect=function(e){var t=this.viewer,i=this.device,M=t.screenLensDistance,r=(i.widthMeters-t.interLensDistance)/2,s=t.baselineLensDistance-i.bevelMeters,n=(e[0]*M+r)/i.widthMeters,A=(e[1]*M+s)/i.heightMeters,u=(e[2]*M+r)/i.widthMeters,o=(e[3]*M+s)/i.heightMeters;return{x:n,y:o,width:u-n,height:A-o}},Z.prototype.getFieldOfViewLeftEye=function(e){return e?this.getUndistortedFieldOfViewLeftEye():this.getDistortedFieldOfViewLeftEye()},Z.prototype.getFieldOfViewRightEye=function(e){var t=this.getFieldOfViewLeftEye(e);return{leftDegrees:t.rightDegrees,rightDegrees:t.leftDegrees,upDegrees:t.upDegrees,downDegrees:t.downDegrees}},Z.prototype.getUndistortedFieldOfViewLeftEye=function(){var e=this.getUndistortedParams_();return{leftDegrees:U*Math.atan(e.outerDist),rightDegrees:U*Math.atan(e.innerDist),downDegrees:U*Math.atan(e.bottomDist),upDegrees:U*Math.atan(e.topDist)}},Z.prototype.getUndistortedViewportLeftEye=function(){var e=this.getUndistortedParams_(),t=this.viewer,i=this.device,M=t.screenLensDistance,r=i.widthMeters/M,s=i.heightMeters/M,n=i.width/r,A=i.height/s,u=Math.round((e.eyePosX-e.outerDist)*n),o=Math.round((e.eyePosY-e.bottomDist)*A);return{x:u,y:o,width:Math.round((e.eyePosX+e.innerDist)*n)-u,height:Math.round((e.eyePosY+e.topDist)*A)-o}},Z.prototype.getUndistortedParams_=function(){var e=this.viewer,t=this.device,i=this.distortion,M=e.screenLensDistance,r=e.interLensDistance/2/M,s=t.widthMeters/M,n=t.heightMeters/M,A=s/2-r,u=(e.baselineLensDistance-t.bevelMeters)/M,o=e.fov,a=i.distortInverse(Math.tan(b*o)),N=Math.min(A,a),D=Math.min(r,a),g=Math.min(u,a),c=Math.min(n-u,a);return{outerDist:N,innerDist:D,topDist:c,bottomDist:g,eyePosX:A,eyePosY:u}},Z.Viewers=W;var V={format:1,last_updated:"2017-09-12T18:54:02Z",devices:[{type:"android",rules:[{mdmh:"asus/*/Nexus 7/*"},{ua:"Nexus 7"}],dpi:[320.8,323],bw:3,ac:500},{type:"android",rules:[{mdmh:"asus/*/ASUS_Z00AD/*"},{ua:"ASUS_Z00AD"}],dpi:[403,404.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel XL/*"},{ua:"Pixel XL"}],dpi:[537.9,533],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Google/*/Pixel/*"},{ua:"Pixel"}],dpi:[432.6,436.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC6435LVW/*"},{ua:"HTC6435LVW"}],dpi:[449.7,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"HTC/*/HTC One XL/*"},{ua:"HTC One XL"}],dpi:[315.3,314.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"htc/*/Nexus 9/*"},{ua:"Nexus 9"}],dpi:289,bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One M9/*"},{ua:"HTC One M9"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One_M8/*"},{ua:"HTC One_M8"}],dpi:[449.7,447.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"HTC/*/HTC One/*"},{ua:"HTC One"}],dpi:472.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Huawei/*/Nexus 6P/*"},{ua:"Nexus 6P"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LENOVO/*/Lenovo PB2-690Y/*"},{ua:"Lenovo PB2-690Y"}],dpi:[457.2,454.713],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5X/*"},{ua:"Nexus 5X"}],dpi:[422,419.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS345/*"},{ua:"LGMS345"}],dpi:[221.7,219.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D800/*"},{ua:"LG-D800"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/LG-D850/*"},{ua:"LG-D850"}],dpi:[537.9,541.9],bw:3,ac:500},{type:"android",rules:[{mdmh:"LGE/*/VS985 4G/*"},{ua:"VS985 4G"}],dpi:[537.9,535.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 5/*"},{ua:"Nexus 5 B"}],dpi:[442.4,444.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/Nexus 4/*"},{ua:"Nexus 4"}],dpi:[319.8,318.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LG-P769/*"},{ua:"LG-P769"}],dpi:[240.6,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGMS323/*"},{ua:"LGMS323"}],dpi:[206.6,204.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"LGE/*/LGLS996/*"},{ua:"LGLS996"}],dpi:[403.4,401.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/4560MMX/*"},{ua:"4560MMX"}],dpi:[240,219.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/A250/*"},{ua:"Micromax A250"}],dpi:[480,446.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Micromax/*/Micromax AQ4501/*"},{ua:"Micromax AQ4501"}],dpi:240,bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/G5/*"},{ua:"Moto G (5) Plus"}],dpi:[403.4,403],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/DROID RAZR/*"},{ua:"DROID RAZR"}],dpi:[368.1,256.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT830C/*"},{ua:"XT830C"}],dpi:[254,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1021/*"},{ua:"XT1021"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1023/*"},{ua:"XT1023"}],dpi:[254,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1028/*"},{ua:"XT1028"}],dpi:[326.6,327.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1034/*"},{ua:"XT1034"}],dpi:[326.6,328.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1053/*"},{ua:"XT1053"}],dpi:[315.3,316.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1562/*"},{ua:"XT1562"}],dpi:[403.4,402.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/Nexus 6/*"},{ua:"Nexus 6 B"}],dpi:[494.3,489.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1063/*"},{ua:"XT1063"}],dpi:[295,296.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/XT1064/*"},{ua:"XT1064"}],dpi:[295,295.6],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1092/*"},{ua:"XT1092"}],dpi:[422,424.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"motorola/*/XT1095/*"},{ua:"XT1095"}],dpi:[422,423.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"motorola/*/G4/*"},{ua:"Moto G (4)"}],dpi:401,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/A0001/*"},{ua:"A0001"}],dpi:[403.4,401],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE E1005/*"},{ua:"ONE E1005"}],dpi:[442.4,441.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OnePlus/*/ONE A2005/*"},{ua:"ONE A2005"}],dpi:[391.9,405.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"OPPO/*/X909/*"},{ua:"X909"}],dpi:[442.4,444.1],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9082/*"},{ua:"GT-I9082"}],dpi:[184.7,185.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G360P/*"},{ua:"SM-G360P"}],dpi:[196.7,205.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Nexus S/*"},{ua:"Nexus S"}],dpi:[234.5,229.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[304.8,303.9],bw:5,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-T230NU/*"},{ua:"SM-T230NU"}],dpi:216,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SGH-T399/*"},{ua:"SGH-T399"}],dpi:[217.7,231.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SGH-M919/*"},{ua:"SGH-M919"}],dpi:[440.8,437.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N9005/*"},{ua:"SM-N9005"}],dpi:[386.4,387],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SM-N900A/*"},{ua:"SAMSUNG-SM-N900A"}],dpi:[386.4,387.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9500/*"},{ua:"GT-I9500"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/GT-I9505/*"},{ua:"GT-I9505"}],dpi:439.4,bw:4,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900F/*"},{ua:"SM-G900F"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G900M/*"},{ua:"SM-G900M"}],dpi:[415.6,431.6],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G800F/*"},{ua:"SM-G800F"}],dpi:326.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G906S/*"},{ua:"SM-G906S"}],dpi:[562.7,572.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300/*"},{ua:"GT-I9300"}],dpi:[306.7,304.8],bw:5,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-T535/*"},{ua:"SM-T535"}],dpi:[142.6,136.4],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-N920C/*"},{ua:"SM-N920C"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920P/*"},{ua:"SM-N920P"}],dpi:[386.3655,390.144],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N920W8/*"},{ua:"SM-N920W8"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9300I/*"},{ua:"GT-I9300I"}],dpi:[304.8,305.8],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-I9195/*"},{ua:"GT-I9195"}],dpi:[249.4,256.7],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SPH-L520/*"},{ua:"SPH-L520"}],dpi:[249.4,255.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SAMSUNG-SGH-I717/*"},{ua:"SAMSUNG-SGH-I717"}],dpi:285.8,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SPH-D710/*"},{ua:"SPH-D710"}],dpi:[217.7,204.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/GT-N7100/*"},{ua:"GT-N7100"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SCH-I605/*"},{ua:"SCH-I605"}],dpi:265.1,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/Galaxy Nexus/*"},{ua:"Galaxy Nexus"}],dpi:[315.3,314.2],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910H/*"},{ua:"SM-N910H"}],dpi:[515.1,518],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-N910C/*"},{ua:"SM-N910C"}],dpi:[515.2,520.2],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G130M/*"},{ua:"SM-G130M"}],dpi:[165.9,164.8],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G928I/*"},{ua:"SM-G928I"}],dpi:[515.1,518.4],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G920F/*"},{ua:"SM-G920F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G920P/*"},{ua:"SM-G920P"}],dpi:[522.5,577],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G925F/*"},{ua:"SM-G925F"}],dpi:580.6,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G925V/*"},{ua:"SM-G925V"}],dpi:[522.5,576.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G930F/*"},{ua:"SM-G930F"}],dpi:576.6,bw:3,ac:1e3},{type:"android",rules:[{mdmh:"samsung/*/SM-G935F/*"},{ua:"SM-G935F"}],dpi:533,bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G950F/*"},{ua:"SM-G950F"}],dpi:[562.707,565.293],bw:3,ac:500},{type:"android",rules:[{mdmh:"samsung/*/SM-G955U/*"},{ua:"SM-G955U"}],dpi:[522.514,525.762],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/C6903/*"},{ua:"C6903"}],dpi:[442.5,443.3],bw:3,ac:500},{type:"android",rules:[{mdmh:"Sony/*/D6653/*"},{ua:"D6653"}],dpi:[428.6,427.6],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6653/*"},{ua:"E6653"}],dpi:[428.6,425.7],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/E6853/*"},{ua:"E6853"}],dpi:[403.4,401.9],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"Sony/*/SGP321/*"},{ua:"SGP321"}],dpi:[224.7,224.1],bw:3,ac:500},{type:"android",rules:[{mdmh:"TCT/*/ALCATEL ONE TOUCH Fierce/*"},{ua:"ALCATEL ONE TOUCH Fierce"}],dpi:[240,247.5],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"THL/*/thl 5000/*"},{ua:"thl 5000"}],dpi:[480,443.3],bw:3,ac:1e3},{type:"android",rules:[{mdmh:"ZTE/*/ZTE Blade L2/*"},{ua:"ZTE Blade L2"}],dpi:240,bw:3,ac:500},{type:"ios",rules:[{res:[640,960]}],dpi:[325.1,328.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[640,1136]}],dpi:[317.1,320.2],bw:3,ac:1e3},{type:"ios",rules:[{res:[750,1334]}],dpi:326.4,bw:4,ac:1e3},{type:"ios",rules:[{res:[1242,2208]}],dpi:[453.6,458.4],bw:4,ac:1e3},{type:"ios",rules:[{res:[1125,2001]}],dpi:[410.9,415.4],bw:4,ac:1e3}]};function X(e,t){if(this.dpdb=V,this.recalculateDeviceParams_(),e){this.onDeviceParamsUpdated=t;var i=new XMLHttpRequest,M=this;i.open("GET",e,!0),i.addEventListener("load",function(){M.loading=!1,i.status>=200&&i.status<=299?(M.dpdb=JSON.parse(i.response),M.recalculateDeviceParams_()):console.error("Error loading online DPDB!")}),i.send()}}function J(e){this.xdpi=e.xdpi,this.ydpi=e.ydpi,this.bevelMm=e.bevelMm}function K(e,t){this.set(e,t)}function $(e,t){this.kFilter=e,this.isDebug=t,this.currentAccelMeasurement=new K,this.currentGyroMeasurement=new K,this.previousGyroMeasurement=new K,A()?this.filterQ=new R(-1,0,0,1):this.filterQ=new R(1,0,0,1),this.previousFilterQ=new R,this.previousFilterQ.copy(this.filterQ),this.accelQ=new R,this.isOrientationInitialized=!1,this.estimatedGravity=new B,this.measuredGravity=new B,this.gyroIntegralQ=new R}function ee(e,t){this.predictionTimeS=e,this.isDebug=t,this.previousQ=new R,this.previousTimestampS=null,this.deltaQ=new R,this.outQ=new R}function te(e,t,i,M){this.yawOnly=i,this.accelerometer=new B,this.gyroscope=new B,this.filter=new $(e,M),this.posePredictor=new ee(t,M),this.isFirefoxAndroid=o(),this.isIOS=A();var r=a();this.isDeviceMotionInRadians=!this.isIOS&&r&&r<66,this.isWithoutDeviceMotion=N(),this.filterToWorldQ=new R,A()?this.filterToWorldQ.setFromAxisAngle(new B(1,0,0),Math.PI/2):this.filterToWorldQ.setFromAxisAngle(new B(1,0,0),-Math.PI/2),this.inverseWorldToScreenQ=new R,this.worldToScreenQ=new R,this.originalPoseAdjustQ=new R,this.originalPoseAdjustQ.setFromAxisAngle(new B(0,0,1),-window.orientation*Math.PI/180),this.setScreenTransform_(),g()&&this.filterToWorldQ.multiply(this.inverseWorldToScreenQ),this.resetQ=new R,this.orientationOut_=new Float32Array(4),this.start()}X.prototype.getDeviceParams=function(){return this.deviceParams},X.prototype.recalculateDeviceParams_=function(){var e=this.calcDeviceParams_();e?(this.deviceParams=e,this.onDeviceParamsUpdated&&this.onDeviceParamsUpdated(this.deviceParams)):console.error("Failed to recalculate device parameters.")},X.prototype.calcDeviceParams_=function(){var e=this.dpdb;if(!e)return console.error("DPDB not available."),null;if(1!=e.format)return console.error("DPDB has unexpected format version."),null;if(!e.devices||!e.devices.length)return console.error("DPDB does not have a devices section."),null;var t=navigator.userAgent||navigator.vendor||window.opera,i=c(),M=L();if(!e.devices)return console.error("DPDB has no devices section."),null;for(var r=0;r1)&&this.run_(),this.previousGyroMeasurement.copy(this.currentGyroMeasurement)},$.prototype.run_=function(){if(!this.isOrientationInitialized)return this.accelQ=this.accelToQuaternion_(this.currentAccelMeasurement.sample),this.previousFilterQ.copy(this.accelQ),void(this.isOrientationInitialized=!0);var e=this.currentGyroMeasurement.timestampS-this.previousGyroMeasurement.timestampS,t=this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample,e);this.gyroIntegralQ.multiply(t),this.filterQ.copy(this.previousFilterQ),this.filterQ.multiply(t);var i=new R;i.copy(this.filterQ),i.inverse(),this.estimatedGravity.set(0,0,-1),this.estimatedGravity.applyQuaternion(i),this.estimatedGravity.normalize(),this.measuredGravity.copy(this.currentAccelMeasurement.sample),this.measuredGravity.normalize();var M,r=new R;r.setFromUnitVectors(this.estimatedGravity,this.measuredGravity),r.inverse(),this.isDebug&&console.log("Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)",U*((M=r).w>1?(console.warn("getQuaternionAngle: w > 1"),0):2*Math.acos(M.w)),this.estimatedGravity.x.toFixed(1),this.estimatedGravity.y.toFixed(1),this.estimatedGravity.z.toFixed(1),this.measuredGravity.x.toFixed(1),this.measuredGravity.y.toFixed(1),this.measuredGravity.z.toFixed(1));var s=new R;s.copy(this.filterQ),s.multiply(r),this.filterQ.slerp(s,1-this.kFilter),this.previousFilterQ.copy(this.filterQ)},$.prototype.getOrientation=function(){return this.filterQ},$.prototype.accelToQuaternion_=function(e){var t=new B;t.copy(e),t.normalize();var i=new R;return i.setFromUnitVectors(new B(0,0,-1),t),i.inverse(),i},$.prototype.gyroToQuaternionDelta_=function(e,t){var i=new R,M=new B;return M.copy(e),M.normalize(),i.setFromAxisAngle(M,e.length()*t),i},ee.prototype.getPrediction=function(e,t,i){if(!this.previousTimestampS)return this.previousQ.copy(e),this.previousTimestampS=i,e;var M=new B;M.copy(t),M.normalize();var r=t.length();if(r<20*b)return this.isDebug&&console.log("Moving slowly, at %s deg/s: no prediction",(U*r).toFixed(1)),this.outQ.copy(e),this.previousQ.copy(e),this.outQ;var s=r*this.predictionTimeS;return this.deltaQ.setFromAxisAngle(M,s),this.outQ.copy(this.previousQ),this.outQ.multiply(this.deltaQ),this.previousQ.copy(e),this.previousTimestampS=i,this.outQ},te.prototype.getPosition=function(){return null},te.prototype.getOrientation=function(){var e=void 0;if(this.isWithoutDeviceMotion&&this._deviceOrientationQ){this.deviceOrientationFixQ=this.deviceOrientationFixQ||(M=(new R).setFromAxisAngle(new B(0,0,-1),0),r=new R,-90===window.orientation?r.setFromAxisAngle(new B(0,1,0),Math.PI/-2):r.setFromAxisAngle(new B(0,1,0),Math.PI/2),M.multiply(r)),this.deviceOrientationFilterToWorldQ=this.deviceOrientationFilterToWorldQ||((i=new R).setFromAxisAngle(new B(1,0,0),-Math.PI/2),i),e=this._deviceOrientationQ;var t=new R;return t.copy(e),t.multiply(this.deviceOrientationFilterToWorldQ),t.multiply(this.resetQ),t.multiply(this.worldToScreenQ),t.multiplyQuaternions(this.deviceOrientationFixQ,t),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_}var i,M,r,s=this.filter.getOrientation();e=this.posePredictor.getPrediction(s,this.gyroscope,this.previousTimestampS);var t=new R;return t.copy(this.filterToWorldQ),t.multiply(this.resetQ),t.multiply(e),t.multiply(this.worldToScreenQ),this.yawOnly&&(t.x=0,t.z=0,t.normalize()),this.orientationOut_[0]=t.x,this.orientationOut_[1]=t.y,this.orientationOut_[2]=t.z,this.orientationOut_[3]=t.w,this.orientationOut_},te.prototype.resetPose=function(){this.resetQ.copy(this.filter.getOrientation()),this.resetQ.x=0,this.resetQ.y=0,this.resetQ.z*=-1,this.resetQ.normalize(),g()&&this.resetQ.multiply(this.inverseWorldToScreenQ),this.resetQ.multiply(this.originalPoseAdjustQ)},te.prototype.onDeviceOrientation_=function(e){this._deviceOrientationQ=this._deviceOrientationQ||new R;var t=e.alpha,i=e.beta,M=e.gamma;t=(t||0)*Math.PI/180,i=(i||0)*Math.PI/180,M=(M||0)*Math.PI/180,this._deviceOrientationQ.setFromEulerYXZ(i,t,-M)},te.prototype.onDeviceMotion_=function(e){this.updateDeviceMotion_(e)},te.prototype.updateDeviceMotion_=function(e){var t=e.accelerationIncludingGravity,i=e.rotationRate,M=e.timeStamp/1e3,r=M-this.previousTimestampS;return r<0?(d("fusion-pose-sensor:invalid:non-monotonic","Invalid timestamps detected: non-monotonic timestamp from devicemotion"),void(this.previousTimestampS=M)):r<=.001||r>1?(d("fusion-pose-sensor:invalid:outside-threshold","Invalid timestamps detected: Timestamp from devicemotion outside expected range."),void(this.previousTimestampS=M)):(this.accelerometer.set(-t.x,-t.y,-t.z),D()?this.gyroscope.set(-i.beta,i.alpha,i.gamma):this.gyroscope.set(i.alpha,i.beta,i.gamma),this.isDeviceMotionInRadians||this.gyroscope.multiplyScalar(Math.PI/180),this.filter.addAccelMeasurement(this.accelerometer,M),this.filter.addGyroMeasurement(this.gyroscope,M),void(this.previousTimestampS=M))},te.prototype.onOrientationChange_=function(e){this.setScreenTransform_()},te.prototype.onMessage_=function(e){var t=e.data;if(t&&t.type){var i=t.type.toLowerCase();"devicemotion"===i&&this.updateDeviceMotion_(t.deviceMotionEvent)}},te.prototype.setScreenTransform_=function(){switch(this.worldToScreenQ.set(0,0,0,1),window.orientation){case 0:break;case 90:this.worldToScreenQ.setFromAxisAngle(new B(0,0,1),-Math.PI/2);break;case-90:this.worldToScreenQ.setFromAxisAngle(new B(0,0,1),Math.PI/2)}this.inverseWorldToScreenQ.copy(this.worldToScreenQ),this.inverseWorldToScreenQ.inverse()},te.prototype.start=function(){var e,t,i;this.onDeviceMotionCallback_=this.onDeviceMotion_.bind(this),this.onOrientationChangeCallback_=this.onOrientationChange_.bind(this),this.onMessageCallback_=this.onMessage_.bind(this),this.onDeviceOrientationCallback_=this.onDeviceOrientation_.bind(this),A()&&(e=window.self!==window.top,t=h(document.referrer),i=h(window.location.href),e&&t!==i)&&window.addEventListener("message",this.onMessageCallback_),window.addEventListener("orientationchange",this.onOrientationChangeCallback_),this.isWithoutDeviceMotion?window.addEventListener("deviceorientation",this.onDeviceOrientationCallback_):window.addEventListener("devicemotion",this.onDeviceMotionCallback_)},te.prototype.stop=function(){window.removeEventListener("devicemotion",this.onDeviceMotionCallback_),window.removeEventListener("deviceorientation",this.onDeviceOrientationCallback_),window.removeEventListener("orientationchange",this.onOrientationChangeCallback_),window.removeEventListener("message",this.onMessageCallback_)};var ie=new B(1,0,0),Me=new B(0,0,1),re={};screen.orientation?re=screen.orientation:screen.msOrientation?re=screen.msOrientation:Object.defineProperty(re,"angle",{get:function(){return window.orientation||0}});var se=new R;se.setFromAxisAngle(ie,-Math.PI/2),se.multiply((new R).setFromAxisAngle(Me,Math.PI/2));var ne=function(){function e(t){M(this,e),this.config=t,this.sensor=null,this.fusionSensor=null,this._out=new Float32Array(4),this.api=null,this.errors=[],this._sensorQ=new R,this._worldToScreenQ=new R,this._outQ=new R,this._onSensorRead=this._onSensorRead.bind(this),this._onSensorError=this._onSensorError.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onOrientationChange(),this.init()}return r(e,[{key:"init",value:function(){var e=null;try{(e=new RelativeOrientationSensor({frequency:60})).addEventListener("error",this._onSensorError)}catch(e){this.errors.push(e),"SecurityError"===e.name?(console.error("Cannot construct sensors due to the Feature Policy"),console.warn('Attempting to fall back using "devicemotion"; however this will fail in the future without correct permissions.'),this.useDeviceMotion()):"ReferenceError"===e.name?this.useDeviceMotion():console.error(e)}e&&(this.api="sensor",this.sensor=e,this.sensor.addEventListener("reading",this._onSensorRead),this.sensor.start()),window.addEventListener("orientationchange",this._onOrientationChange)}},{key:"useDeviceMotion",value:function(){this.api="devicemotion",this.fusionSensor=new te(this.config.K_FILTER,this.config.PREDICTION_TIME_S,this.config.YAW_ONLY,this.config.DEBUG)}},{key:"getOrientation",value:function(){if(this.fusionSensor)return this.fusionSensor.getOrientation();if(!this.sensor||!this.sensor.quaternion)return this._out[0]=this._out[1]=this._out[2]=0,this._out[3]=1,this._out;var e=this.sensor.quaternion;this._sensorQ.set(e[0],e[1],e[2],e[3]);var t=this._outQ;return t.copy(se),t.multiply(this._sensorQ),t.multiply(this._worldToScreenQ),this.config.YAW_ONLY&&(t.x=t.z=0,t.normalize()),this._out[0]=t.x,this._out[1]=t.y,this._out[2]=t.z,this._out[3]=t.w,this._out}},{key:"_onSensorError",value:function(e){this.errors.push(e.error),"NotAllowedError"===e.error.name?console.error("Permission to access sensor was denied"):"NotReadableError"===e.error.name?console.error("Sensor could not be read"):console.error(e.error)}},{key:"_onSensorRead",value:function(){}},{key:"_onOrientationChange",value:function(){var e=-re.angle*Math.PI/180;this._worldToScreenQ.setFromAxisAngle(Me,e)}}]),e}();function Ae(){this.loadIcon_();var e=document.createElement("div"),t=e.style;t.position="fixed",t.top=0,t.right=0,t.bottom=0,t.left=0,t.backgroundColor="gray",t.fontFamily="sans-serif",t.zIndex=1e6;var i=document.createElement("img");i.src=this.icon;var t=i.style;t.marginLeft="25%",t.marginTop="25%",t.width="50%",e.appendChild(i);var M=document.createElement("div"),t=M.style;t.textAlign="center",t.fontSize="16px",t.lineHeight="24px",t.margin="24px 25%",t.width="50%",M.innerHTML="Place your phone into your Cardboard viewer.",e.appendChild(M);var r=document.createElement("div"),t=r.style;t.backgroundColor="#CFD8DC",t.position="fixed",t.bottom=0,t.width="100%",t.height="48px",t.padding="14px 24px",t.boxSizing="border-box",t.color="#656A6B",e.appendChild(r);var s=document.createElement("div");s.style.float="left",s.innerHTML="No Cardboard viewer?";var n=document.createElement("a");n.href="https://www.google.com/get/cardboard/get-cardboard/",n.innerHTML="get one",n.target="_blank";var t=n.style;t.float="right",t.fontWeight=600,t.textTransform="uppercase",t.borderLeft="1px solid gray",t.paddingLeft="24px",t.textDecoration="none",t.color="#656A6B",r.appendChild(s),r.appendChild(n),this.overlay=e,this.text=M,this.hide()}Ae.prototype.show=function(e){e||this.overlay.parentElement?e&&(this.overlay.parentElement&&this.overlay.parentElement!=e&&this.overlay.parentElement.removeChild(this.overlay),e.appendChild(this.overlay)):document.body.appendChild(this.overlay),this.overlay.style.display="block";var t=this.overlay.querySelector("img"),i=t.style;g()?(i.width="20%",i.marginLeft="40%",i.marginTop="3%"):(i.width="50%",i.marginLeft="25%",i.marginTop="25%")},Ae.prototype.hide=function(){this.overlay.style.display="none"},Ae.prototype.showTemporarily=function(e,t){this.show(t),this.timer=setTimeout(this.hide.bind(this),e)},Ae.prototype.disableShowTemporarily=function(){clearTimeout(this.timer)},Ae.prototype.update=function(){this.disableShowTemporarily(),!g()&&l()?this.show():this.hide()},Ae.prototype.loadIcon_=function(){this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjE5OHB4IiBoZWlna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gICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"};var ue="CardboardV1",oe="WEBVR_CARDBOARD_VIEWER";function ae(){try{this.selectedKey=localStorage.getItem(oe)}catch(e){console.error("Failed to load viewer profile: %s",e)}this.selectedKey||(this.selectedKey=ue),this.dialog=this.createDialog_(Z.Viewers),this.root=null,this.onChangeCallbacks_=[]}ae.prototype.show=function(e){this.root=e,e.appendChild(this.dialog);var t=this.dialog.querySelector("#"+this.selectedKey);t.checked=!0,this.dialog.style.display="block"},ae.prototype.hide=function(){this.root&&this.root.contains(this.dialog)&&this.root.removeChild(this.dialog),this.dialog.style.display="none"},ae.prototype.getCurrentViewer=function(){return Z.Viewers[this.selectedKey]},ae.prototype.getSelectedKey_=function(){var e=this.dialog.querySelector("input[name=field]:checked");return e?e.id:null},ae.prototype.onChange=function(e){this.onChangeCallbacks_.push(e)},ae.prototype.fireOnChange_=function(e){for(var t=0;t.5&&(this.noSleepVideo.currentTime=Math.random())}.bind(this)))}return M(e,[{key:"enable",value:function(){s?(this.disable(),this.noSleepTimer=window.setInterval(function(){window.location.href="/",window.setTimeout(window.stop,0)},15e3)):this.noSleepVideo.play()}},{key:"disable",value:function(){s?this.noSleepTimer&&(window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause()}}]),e}();e.exports=n},function(e,t,i){e.exports="data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExM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zdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="}])},e.exports=i()}(De={exports:{}},De.exports),(Ne=De.exports)&&Ne.__esModule?Ne.default:Ne),ce=1e3,Le=[0,0,.5,1],je=[.5,0,.5,1],Ie=window.requestAnimationFrame,ye=window.cancelAnimationFrame;function le(e){Object.defineProperties(this,{hasPosition:{writable:!1,enumerable:!0,value:e.hasPosition},hasExternalDisplay:{writable:!1,enumerable:!0,value:e.hasExternalDisplay},canPresent:{writable:!1,enumerable:!0,value:e.canPresent},maxLayers:{writable:!1,enumerable:!0,value:e.maxLayers},hasOrientation:{enumerable:!0,get:function(){return z("VRDisplayCapabilities.prototype.hasOrientation","VRDisplay.prototype.getFrameData"),e.hasOrientation}}})}function we(e){var t=!("wakelock"in(e=e||{}))||e.wakelock;this.isPolyfilled=!0,this.displayId=ce++,this.displayName="",this.depthNear=.01,this.depthFar=1e4,this.isPresenting=!1,Object.defineProperty(this,"isConnected",{get:function(){return z("VRDisplay.prototype.isConnected","VRDisplayCapabilities.prototype.hasExternalDisplay"),!1}}),this.capabilities=new le({hasPosition:!1,hasOrientation:!1,hasExternalDisplay:!1,canPresent:!1,maxLayers:1}),this.stageParameters=null,this.waitingForPresent_=!1,this.layer_=null,this.originalParent_=null,this.fullscreenElement_=null,this.fullscreenWrapper_=null,this.fullscreenElementCachedStyle_=null,this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null,t&&l()&&(this.wakelock_=new ge)}we.prototype.getFrameData=function(e){return E(e,this._getPose(),this)},we.prototype.getPose=function(){return z("VRDisplay.prototype.getPose","VRDisplay.prototype.getFrameData"),this._getPose()},we.prototype.resetPose=function(){return z("VRDisplay.prototype.resetPose"),this._resetPose()},we.prototype.getImmediatePose=function(){return z("VRDisplay.prototype.getImmediatePose","VRDisplay.prototype.getFrameData"),this._getPose()},we.prototype.requestAnimationFrame=function(e){return Ie(e)},we.prototype.cancelAnimationFrame=function(e){return ye(e)},we.prototype.wrapForFullscreen=function(e){if(A())return e;if(!this.fullscreenWrapper_){this.fullscreenWrapper_=document.createElement("div");var t=["height: "+Math.min(screen.height,screen.width)+"px !important","top: 0 !important","left: 0 !important","right: 0 !important","border: 0","margin: 0","padding: 0","z-index: 999999 !important","position: fixed"];this.fullscreenWrapper_.setAttribute("style",t.join("; ")+";"),this.fullscreenWrapper_.classList.add("webvr-polyfill-fullscreen-wrapper")}if(this.fullscreenElement_==e)return this.fullscreenWrapper_;if(this.fullscreenElement_&&(this.originalParent_?this.originalParent_.appendChild(this.fullscreenElement_):this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_)),this.fullscreenElement_=e,this.originalParent_=e.parentElement,this.originalParent_||document.body.appendChild(e),!this.fullscreenWrapper_.parentElement){var i=this.fullscreenElement_.parentElement;i.insertBefore(this.fullscreenWrapper_,this.fullscreenElement_),i.removeChild(this.fullscreenElement_)}this.fullscreenWrapper_.insertBefore(this.fullscreenElement_,this.fullscreenWrapper_.firstChild),this.fullscreenElementCachedStyle_=this.fullscreenElement_.getAttribute("style");var M=this;return function(){if(M.fullscreenElement_){var e=["position: absolute","top: 0","left: 0","width: "+Math.max(screen.width,screen.height)+"px","height: "+Math.min(screen.height,screen.width)+"px","border: 0","margin: 0","padding: 0"];M.fullscreenElement_.setAttribute("style",e.join("; ")+";")}}(),this.fullscreenWrapper_},we.prototype.removeFullscreenWrapper=function(){if(this.fullscreenElement_){var e=this.fullscreenElement_;this.fullscreenElementCachedStyle_?e.setAttribute("style",this.fullscreenElementCachedStyle_):e.removeAttribute("style"),this.fullscreenElement_=null,this.fullscreenElementCachedStyle_=null;var t=this.fullscreenWrapper_.parentElement;return this.fullscreenWrapper_.removeChild(e),this.originalParent_===t?t.insertBefore(e,this.fullscreenWrapper_):this.originalParent_&&this.originalParent_.appendChild(e),t.removeChild(this.fullscreenWrapper_),e}},we.prototype.requestPresent=function(e){var t=this.isPresenting,i=this;return e instanceof Array||(z("VRDisplay.prototype.requestPresent with non-array argument","an array of VRLayers as the first argument"),e=[e]),new Promise(function(M,r){if(i.capabilities.canPresent)if(0==e.length||e.length>i.capabilities.maxLayers)r(new Error("Invalid number of layers."));else{var s=e[0];if(s.source){var n=s.leftBounds||Le,o=s.rightBounds||je;if(t){var a=i.layer_;a.source!==s.source&&(a.source=s.source);for(var N=0;N<4;N++)a.leftBounds[N]=n[N],a.rightBounds[N]=o[N];return i.wrapForFullscreen(i.layer_.source),i.updatePresent_(),void M()}if(i.layer_={predistorted:s.predistorted,source:s.source,leftBounds:n.slice(0),rightBounds:o.slice(0)},i.waitingForPresent_=!1,i.layer_&&i.layer_.source){var D=i.wrapForFullscreen(i.layer_.source);i.addFullscreenListeners_(D,function(){var e=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;i.isPresenting=D===e,i.isPresenting?(screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape-primary").catch(function(e){console.error("screen.orientation.lock() failed due to",e.message)}),i.waitingForPresent_=!1,i.beginPresent_(),M()):(screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),i.removeFullscreenWrapper(),i.disableWakeLock(),i.endPresent_(),i.removeFullscreenListeners_()),i.fireVRDisplayPresentChange_()},function(){i.waitingForPresent_&&(i.removeFullscreenWrapper(),i.removeFullscreenListeners_(),i.disableWakeLock(),i.waitingForPresent_=!1,i.isPresenting=!1,r(new Error("Unable to present.")))}),function(e){if(u())return!1;if(e.requestFullscreen)e.requestFullscreen();else if(e.webkitRequestFullscreen)e.webkitRequestFullscreen();else if(e.mozRequestFullScreen)e.mozRequestFullScreen();else{if(!e.msRequestFullscreen)return!1;e.msRequestFullscreen()}return!0}(D)?(i.enableWakeLock(),i.waitingForPresent_=!0):(A()||u())&&(i.enableWakeLock(),i.isPresenting=!0,i.beginPresent_(),i.fireVRDisplayPresentChange_(),M())}i.waitingForPresent_||A()||(j(),r(new Error("Unable to present.")))}else M()}else r(new Error("VRDisplay is not capable of presenting."))})},we.prototype.exitPresent=function(){var e=this.isPresenting,t=this;return this.isPresenting=!1,this.layer_=null,this.disableWakeLock(),new Promise(function(i,M){e?(!j()&&A()&&(t.endPresent_(),t.fireVRDisplayPresentChange_()),u()&&(t.removeFullscreenWrapper(),t.removeFullscreenListeners_(),t.endPresent_(),t.fireVRDisplayPresentChange_()),i()):M(new Error("Was not presenting to VRDisplay."))})},we.prototype.getLayers=function(){return this.layer_?[this.layer_]:[]},we.prototype.fireVRDisplayPresentChange_=function(){var e=new CustomEvent("vrdisplaypresentchange",{detail:{display:this}});window.dispatchEvent(e)},we.prototype.fireVRDisplayConnect_=function(){var e=new CustomEvent("vrdisplayconnect",{detail:{display:this}});window.dispatchEvent(e)},we.prototype.addFullscreenListeners_=function(e,t,i){this.removeFullscreenListeners_(),this.fullscreenEventTarget_=e,this.fullscreenChangeHandler_=t,this.fullscreenErrorHandler_=i,t&&(document.fullscreenEnabled?e.addEventListener("fullscreenchange",t,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenchange",t,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenchange",t,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenchange",t,!1)),i&&(document.fullscreenEnabled?e.addEventListener("fullscreenerror",i,!1):document.webkitFullscreenEnabled?e.addEventListener("webkitfullscreenerror",i,!1):document.mozFullScreenEnabled?document.addEventListener("mozfullscreenerror",i,!1):document.msFullscreenEnabled&&e.addEventListener("msfullscreenerror",i,!1))},we.prototype.removeFullscreenListeners_=function(){if(this.fullscreenEventTarget_){var e=this.fullscreenEventTarget_;if(this.fullscreenChangeHandler_){var t=this.fullscreenChangeHandler_;e.removeEventListener("fullscreenchange",t,!1),e.removeEventListener("webkitfullscreenchange",t,!1),document.removeEventListener("mozfullscreenchange",t,!1),e.removeEventListener("msfullscreenchange",t,!1)}if(this.fullscreenErrorHandler_){var i=this.fullscreenErrorHandler_;e.removeEventListener("fullscreenerror",i,!1),e.removeEventListener("webkitfullscreenerror",i,!1),document.removeEventListener("mozfullscreenerror",i,!1),e.removeEventListener("msfullscreenerror",i,!1)}this.fullscreenEventTarget_=null,this.fullscreenChangeHandler_=null,this.fullscreenErrorHandler_=null}},we.prototype.enableWakeLock=function(){this.wakelock_&&this.wakelock_.enable()},we.prototype.disableWakeLock=function(){this.wakelock_&&this.wakelock_.disable()},we.prototype.beginPresent_=function(){},we.prototype.endPresent_=function(){},we.prototype.submitFrame=function(e){},we.prototype.getEyeParameters=function(e){return null};var Te={MOBILE_WAKE_LOCK:!0,DEBUG:!1,DPDB_URL:"https://dpdb.webvr.rocks/dpdb.json",K_FILTER:.98,PREDICTION_TIME_S:.04,CARDBOARD_UI_DISABLED:!1,ROTATE_INSTRUCTIONS_DISABLED:!1,YAW_ONLY:!1,BUFFER_SCALE:.5,DIRTY_SUBMIT_FRAME_BINDINGS:!1},Ee={LEFT:"left",RIGHT:"right"};function he(e){var t=w({},Te);e=w(t,e||{}),we.call(this,{wakelock:e.MOBILE_WAKE_LOCK}),this.config=e,this.displayName="Cardboard VRDisplay",this.capabilities=new le({hasPosition:!1,hasOrientation:!0,hasExternalDisplay:!1,canPresent:!0,maxLayers:1}),this.stageParameters=null,this.bufferScale_=this.config.BUFFER_SCALE,this.poseSensor_=new ne(this.config),this.distorter_=null,this.cardboardUI_=null,this.dpdb_=new X(this.config.DPDB_URL,this.onDeviceParamsUpdated_.bind(this)),this.deviceInfo_=new Z(this.dpdb_.getDeviceParams()),this.viewerSelector_=new ae,this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)),this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()),this.config.ROTATE_INSTRUCTIONS_DISABLED||(this.rotateInstructions_=new Ae),A()&&window.addEventListener("resize",this.onResize_.bind(this))}return he.prototype=Object.create(we.prototype),he.prototype._getPose=function(){return{position:null,orientation:this.poseSensor_.getOrientation(),linearVelocity:null,linearAcceleration:null,angularVelocity:null,angularAcceleration:null}},he.prototype._resetPose=function(){this.poseSensor_.resetPose&&this.poseSensor_.resetPose()},he.prototype._getFieldOfView=function(e){var t;if(e==Ee.LEFT)t=this.deviceInfo_.getFieldOfViewLeftEye();else{if(e!=Ee.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=this.deviceInfo_.getFieldOfViewRightEye()}return t},he.prototype._getEyeOffset=function(e){var t;if(e==Ee.LEFT)t=[.5*this.deviceInfo_.viewer.interLensDistance,0,0];else{if(e!=Ee.RIGHT)return console.error("Invalid eye provided: %s",e),null;t=[.5*-this.deviceInfo_.viewer.interLensDistance,0,0]}return t},he.prototype.getEyeParameters=function(e){var t=this._getEyeOffset(e),i=this._getFieldOfView(e),M={offset:t,renderWidth:.5*this.deviceInfo_.device.width*this.bufferScale_,renderHeight:this.deviceInfo_.device.height*this.bufferScale_};return Object.defineProperty(M,"fieldOfView",{enumerable:!0,get:function(){return z("VRFieldOfView","VRFrameData's projection matrices"),i}}),M},he.prototype.onDeviceParamsUpdated_=function(e){this.config.DEBUG&&console.log("DPDB reported that device params were updated."),this.deviceInfo_.updateDeviceParams(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_)},he.prototype.updateBounds_=function(){this.layer_&&this.distorter_&&(this.layer_.leftBounds||this.layer_.rightBounds)&&this.distorter_.setTextureBounds(this.layer_.leftBounds,this.layer_.rightBounds)},he.prototype.beginPresent_=function(){var e=this.layer_.source.getContext("webgl");e||(e=this.layer_.source.getContext("experimental-webgl")),e||(e=this.layer_.source.getContext("webgl2")),e&&(this.layer_.predistorted?this.config.CARDBOARD_UI_DISABLED||(e.canvas.width=c()*this.bufferScale_,e.canvas.height=L()*this.bufferScale_,this.cardboardUI_=new k(e)):(this.config.CARDBOARD_UI_DISABLED||(this.cardboardUI_=new k(e)),this.distorter_=new f(e,this.cardboardUI_,this.config.BUFFER_SCALE,this.config.DIRTY_SUBMIT_FRAME_BINDINGS),this.distorter_.updateDeviceInfo(this.deviceInfo_)),this.cardboardUI_&&this.cardboardUI_.listen(function(e){this.viewerSelector_.show(this.layer_.source.parentElement),e.stopPropagation(),e.preventDefault()}.bind(this),function(e){this.exitPresent(),e.stopPropagation(),e.preventDefault()}.bind(this)),this.rotateInstructions_&&(g()&&l()?this.rotateInstructions_.showTemporarily(3e3,this.layer_.source.parentElement):this.rotateInstructions_.update()),this.orientationHandler=this.onOrientationChange_.bind(this),window.addEventListener("orientationchange",this.orientationHandler),this.vrdisplaypresentchangeHandler=this.updateBounds_.bind(this),window.addEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler),this.fireVRDisplayDeviceParamsChange_())},he.prototype.endPresent_=function(){this.distorter_&&(this.distorter_.destroy(),this.distorter_=null),this.cardboardUI_&&(this.cardboardUI_.destroy(),this.cardboardUI_=null),this.rotateInstructions_&&this.rotateInstructions_.hide(),this.viewerSelector_.hide(),window.removeEventListener("orientationchange",this.orientationHandler),window.removeEventListener("vrdisplaypresentchange",this.vrdisplaypresentchangeHandler)},he.prototype.updatePresent_=function(){this.endPresent_(),this.beginPresent_()},he.prototype.submitFrame=function(e){if(this.distorter_)this.updateBounds_(),this.distorter_.submitFrame();else if(this.cardboardUI_&&this.layer_){var t=this.layer_.source.getContext("webgl").canvas;t.width==this.lastWidth&&t.height==this.lastHeight||this.cardboardUI_.onResize(),this.lastWidth=t.width,this.lastHeight=t.height,this.cardboardUI_.render()}},he.prototype.onOrientationChange_=function(e){this.viewerSelector_.hide(),this.rotateInstructions_&&this.rotateInstructions_.update(),this.onResize_()},he.prototype.onResize_=function(e){if(this.layer_){var t=this.layer_.source.getContext("webgl");t.canvas.setAttribute("style",["position: absolute","top: 0","left: 0","width: 100vw","height: 100vh","border: 0","margin: 0","padding: 0px","box-sizing: content-box"].join("; ")+";"),T(t.canvas)}},he.prototype.onViewerChanged_=function(e){this.deviceInfo_.setViewer(e),this.distorter_&&this.distorter_.updateDeviceInfo(this.deviceInfo_),this.fireVRDisplayDeviceParamsChange_()},he.prototype.fireVRDisplayDeviceParamsChange_=function(){var e=new CustomEvent("vrdisplaydeviceparamschange",{detail:{vrdisplay:this,deviceInfo:this.deviceInfo_}});window.dispatchEvent(e)},he.VRFrameData=function(){this.leftProjectionMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.rightViewMatrix=new Float32Array(16),this.pose=null},he.VRDisplay=we,he}()}(K={exports:{}},K.exports),K.exports),te=($=ee)&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$,ie=function(e){function s(e){t(this,s);var i=r(this,(s.__proto__||Object.getPrototypeOf(s)).call(this));return i.global=e,i.onWindowResize=i.onWindowResize.bind(i),i.global.window.addEventListener("resize",i.onWindowResize),i}return M(s,n),i(s,[{key:"onBaseLayerSet",value:function(e,t){throw new Error("Not implemented")}},{key:"supportsSession",value:function(){throw new Error("Not implemented")}},{key:"requestSession",value:function(){return new Promise(function(e,t){return t(new Error("Not implemented"))}.bind(this))}},{key:"requestAnimationFrame",value:function(e){throw new Error("Not implemented")}},{key:"onFrameStart",value:function(){throw new Error("Not implemented")}},{key:"onFrameEnd",value:function(e){throw new Error("Not implemented")}},{key:"requestStageBounds",value:function(){throw new Error("Not implemented")}},{key:"requestFrameOfReferenceTransform",value:function(e,t){return new Promise(function(e,t){return e(void 0)}.bind(this))}},{key:"cancelAnimationFrame",value:function(e){throw new Error("Not implemented")}},{key:"endSession",value:function(e){throw new Error("Not implemented")}},{key:"getViewport",value:function(e,t,i,M){throw new Error("Not implemented")}},{key:"getProjectionMatrix",value:function(e){throw new Error("Not implemented")}},{key:"getBasePoseMatrix",value:function(){throw new Error("Not implemented")}},{key:"getBaseViewMatrix",value:function(e){throw new Error("Not implemented")}},{key:"onWindowResize",value:function(){this.onWindowResize()}},{key:"depthNear",get:function(){throw new Error("Not implemented")},set:function(e){throw new Error("Not implemented")}},{key:"depthFar",get:function(){throw new Error("Not implemented")},set:function(e){throw new Error("Not implemented")}}]),s}(),Me=0,re=function e(i){t(this,e),this.outputContext=i.outputContext,this.exclusive=i.exclusive,this.ended=null,this.baseLayer=null,this.id=++Me,this.modifiedCanvasLayer=!1},se=function(e){function s(e,i){t(this,s);var M=i.capabilities.canPresent,n=r(this,(s.__proto__||Object.getPrototypeOf(s)).call(this,e));return n.display=i,n.frame=new e.VRFrameData,n.sessions=new Map,n.canPresent=M,n.baseModelMatrix=c(new Float32Array(16)),n.tempVec3=new Float32Array(3),n.onVRDisplayPresentChange=n.onVRDisplayPresentChange.bind(n),e.window.addEventListener("vrdisplaypresentchange",n.onVRDisplayPresentChange),n}return M(s,ie),i(s,[{key:"onBaseLayerSet",value:function(e,t){var i=this,M=this.sessions.get(e),r=t.context.canvas;if(M.exclusive){var s=this.display.getEyeParameters("left"),n=this.display.getEyeParameters("right");r.width=2*Math.max(s.renderWidth,n.renderWidth),r.height=Math.max(s.renderHeight,n.renderHeight),this.display.requestPresent([{source:r}]).then(function(){i.global.document.body.contains(r)||(M.modifiedCanvasLayer=!0,i.global.document.body.appendChild(r),function(e){e.style.display="block",e.style.position="absolute",e.style.width=e.style.height="1px",e.style.top=e.style.left="0px"}(r)),M.baseLayer=t})}else M.outputContext&&(M.baseLayer=t)}},{key:"supportsSession",value:function(){return!0!==(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).exclusive||!1!==this.canPresent}},{key:"requestSession",value:function(){var e=arguments;return new Promise(function(t,i){var M,r,s;if(M=e.length>0&&void 0!==e[0]?e[0]:{},!this.supportsSession(M))return t(Promise.reject());if(M.exclusive)return(r=this.global.document.createElement("canvas")).getContext("webgl"),Promise.resolve(this.display.requestPresent([{source:r}])).then(function(e){try{return n.call(this)}catch(e){return i(e)}}.bind(this),i);function n(){return s=new re(M),this.sessions.set(s.id,s),M.exclusive&&this.dispatchEvent("@@webxr-polyfill/vr-present-start",s.id),t(Promise.resolve(s.id))}return n.call(this)}.bind(this))}},{key:"requestAnimationFrame",value:function(e){return this.display.requestAnimationFrame(e)}},{key:"onFrameStart",value:function(){this.display.getFrameData(this.frame)}},{key:"onFrameEnd",value:function(e){var t=this.sessions.get(e);if(!t.ended&&t.baseLayer){if(t.outputContext&&(!t.exclusive||this.display.capabilities.hasExternalDisplay)){var i=t.baseLayer.context.canvas,M=i.width/2,r=i.height,s=t.outputContext.canvas,n=s.getContext("2d"),A=s.width,u=s.height;n.drawImage(i,0,0,M,r,0,0,A,u)}t.exclusive&&t.baseLayer&&this.display.submitFrame()}}},{key:"cancelAnimationFrame",value:function(e){this.display.cancelAnimationFrame(e)}},{key:"endSession",value:function(e){return new Promise(function(t,i){var M=this.sessions.get(e);return M.ended?t():M.exclusive?t(this.display.exitPresent()):(M.ended=!0,t())}.bind(this))}},{key:"requestStageBounds",value:function(){if(this.display.stageParameters){var e=this.display.stageParameters.sizeX,t=this.display.stageParameters.sizeZ,i=[];return i.push(-e/2),i.push(-t/2),i.push(e/2),i.push(-t/2),i.push(e/2),i.push(t/2),i.push(-e/2),i.push(t/2),i}return null}},{key:"requestFrameOfReferenceTransform",value:function(e,t){return new Promise(function(t,i){return"stage"===e&&this.display.stageParameters&&this.display.stageParameters.sittingToStandingTransform?t(this.display.stageParameters.sittingToStandingTransform):t()}.bind(this))}},{key:"getProjectionMatrix",value:function(e){if("left"===e)return this.frame.leftProjectionMatrix;if("right"===e)return this.frame.rightProjectionMatrix;throw new Error("eye must be of type 'left' or 'right'")}},{key:"getViewport",value:function(e,t,i,M){var r=this.sessions.get(e),s=i.context.canvas,n=s.width,A=s.height;if(!r.exclusive)return M.x=M.y=0,M.width=n,M.height=A,!0;if("left"===t)M.x=0;else{if("right"!==t)return!1;M.x=n/2}return M.y=0,M.width=n/2,M.height=A,!0}},{key:"getBasePoseMatrix",value:function(){var e,t,i,M,r,s,n,A,u,o,a,N,D,g,c,L,j,I,y,l=this.frame.pose,w=l.position,T=l.orientation;return w||T?(w||((w=this.tempVec3)[0]=w[1]=w[2]=0),e=this.baseModelMatrix,i=w,M=(t=T)[0],r=t[1],s=t[2],n=t[3],a=M*(A=M+M),N=M*(u=r+r),D=M*(o=s+s),g=r*u,c=r*o,L=s*o,j=n*A,I=n*u,y=n*o,e[0]=1-(g+L),e[1]=N+y,e[2]=D-I,e[3]=0,e[4]=N-y,e[5]=1-(a+L),e[6]=c+j,e[7]=0,e[8]=D+I,e[9]=c-j,e[10]=1-(a+g),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,this.baseModelMatrix):this.baseModelMatrix}},{key:"getBaseViewMatrix",value:function(e){if("left"===e)return this.frame.leftViewMatrix;if("right"===e)return this.frame.rightViewMatrix;throw new Error("eye must be of type 'left' or 'right'")}},{key:"onWindowResize",value:function(){}},{key:"onVRDisplayPresentChange",value:function(e){var t=this;this.display.isPresenting||this.sessions.forEach(function(e){if(e.exclusive&&!e.ended){if(e.modifiedCanvasLayer){var i=e.baseLayer.context.canvas;document.body.removeChild(i),i.setAttribute("style","")}t.dispatchEvent("@@webxr-polyfill/vr-present-end",e.id)}})}},{key:"depthNear",get:function(){return this.display.depthNear},set:function(e){this.display.depthNear=e}},{key:"depthFar",get:function(){return this.display.depthFar},set:function(e){this.display.depthFar=e}}]),s}(),ne=function(e){function i(e){t(this,i);var M=new te,s=r(this,(i.__proto__||Object.getPrototypeOf(i)).call(this,e,M));return s.display=M,s.frame={rightViewMatrix:new Float32Array(16),leftViewMatrix:new Float32Array(16),rightProjectionMatrix:new Float32Array(16),leftProjectionMatrix:new Float32Array(16),pose:null,timestamp:null},s}return M(i,se),i}(),Ae=function(e,t){return new Promise(function(i,M){var r;return Promise.resolve(function(e){return new Promise(function(t,i){var M;if(M=null,"xr"in e.navigator){var r=function(){try{return n.call(this)}catch(e){return i(e)}}.bind(this),s=function(e){try{return r()}catch(e){return i(e)}}.bind(this);try{return Promise.resolve(e.navigator.xr.requestDevice()).then(function(e){try{return M=e,r()}catch(e){return s(e)}}.bind(this),s)}catch(e){s(e)}}function n(){return t(M)}return n.call(this)}.bind(this))}(e)).then(function(s){try{if(r=s)return i(r);if(t.webvr)return Promise.resolve(function(e){return new Promise(function(t,i){var M,r;if(M=null,"getVRDisplays"in e.navigator){var s=function(){try{return A.call(this)}catch(e){return i(e)}}.bind(this),n=function(e){try{return s()}catch(e){return i(e)}}.bind(this);try{return Promise.resolve(e.navigator.getVRDisplays()).then(function(t){try{return(r=t)&&r.length&&(M=new se(e,r[0])),s()}catch(e){return n(e)}}.bind(this),n)}catch(e){n(e)}}function A(){return t(M)}return A.call(this)}.bind(this))}(e)).then(function(e){try{return(r=e)?i(new G(r)):n.call(this)}catch(e){return M(e)}}.bind(this),M);function n(){return t.cardboard&&J(e)?(e.VRFrameData||(e.VRFrameData=function(){this.rightViewMatrix=new Float32Array(16),this.leftViewMatrix=new Float32Array(16),this.rightProjectionMatrix=new Float32Array(16),this.leftProjectionMatrix=new Float32Array(16),this.pose=null}),i(new G(new ne(e)))):i(null)}return n.call(this)}catch(e){return M(e)}}.bind(this),M)}.bind(this))},ue={webvr:!0,cardboard:!0},oe=["navigator","HTMLCanvasElement","WebGLRenderingContext"];return function(){function M(i){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(this,M),this.global=i||e,this.config=Object.freeze(Object.assign({},ue,r)),this.nativeWebXR="xr"in this.global.navigator,this.injected=!1,this.nativeWebXR?this.config.cardboard&&J(this.global)&&this._patchRequestDevice():this._injectPolyfill(this.global)}return i(M,[{key:"_injectPolyfill",value:function(e){if(!oe.every(function(t){return!!e[t]}))throw new Error("Global must have the following attributes : "+oe);var t,i,M=!0,r=!1,s=void 0;try{for(var n,A=Object.keys(X)[Symbol.iterator]();!(M=(n=A.next()).done);M=!0){var u=n.value;void 0!==e[u]?console.warn(u+" already defined on global."):e[u]=X[u]}}catch(e){r=!0,s=e}finally{try{!M&&A.return&&A.return()}finally{if(r)throw s}}"function"!=typeof(i=e.WebGLRenderingContext).prototype.setCompatibleXRDevice&&(i.prototype.setCompatibleXRDevice=function(e){var t=this;return new Promise(function(t,i){e&&"function"==typeof e.requestSession?t():i()}).then(function(){return t[W]=e})},!0)&&(e.HTMLCanvasElement,t=HTMLCanvasElement.prototype.getContext,HTMLCanvasElement.prototype.getContext=function(e,i){if("xrpresent"===e){var M=t.call(this,"2d",i);return new g(this,M,i)}var r=t.call(this,e,i);return r[F]=!0,i&&"compatibleXRDevice"in i&&(r[W]=i.compatibleXRDevice),r}),this.injected=!0,this._patchRequestDevice()}},{key:"_patchRequestDevice",value:function(){var e=Ae(this.global,this.config);this.xr=new u(e),Object.defineProperty(this.global.navigator,"xr",{value:this.xr,configurable:!0})}}]),M}()}); diff --git a/build/webxr-polyfill.module.js b/build/webxr-polyfill.module.js new file mode 100644 index 0000000..6c2f3b2 --- /dev/null +++ b/build/webxr-polyfill.module.js @@ -0,0 +1,4346 @@ +/** + * @license + * webxr-polyfill + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * cardboard-vr-display + * Copyright (c) 2015-2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * webvr-polyfill-dpdb + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * wglu-preserve-state + * Copyright (c) 2016, Brandon Jones. + * + * 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. + */ + +/** + * @license + * nosleep.js + * Copyright (c) 2017, Rich Tibbett + * + * 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. + */ + +const _global = typeof global !== 'undefined' ? global : + typeof self !== 'undefined' ? self : + typeof window !== 'undefined' ? window : {}; + +const PRIVATE = Symbol('@@webxr-polyfill/EventTarget'); +class EventTarget { + constructor() { + this[PRIVATE] = { + listeners: new Map(), + }; + } + addEventListener(type, listener) { + if (typeof type !== 'string') { throw new Error('`type` must be a string'); } + if (typeof listener !== 'function') { throw new Error('`listener` must be a function'); } + const typedListeners = this[PRIVATE].listeners.get(type) || []; + typedListeners.push(listener); + this[PRIVATE].listeners.set(type, typedListeners); + } + removeEventListener(type, listener) { + if (typeof type !== 'string') { throw new Error('`type` must be a string'); } + if (typeof listener !== 'function') { throw new Error('`listener` must be a function'); } + const typedListeners = this[PRIVATE].listeners.get(type) || []; + for (let i = typedListeners.length; i >= 0; i--) { + if (typedListeners[i] === listener) { + typedListeners.pop(); + } + } + } + dispatchEvent(type, event) { + const typedListeners = this[PRIVATE].listeners.get(type) || []; + const queue = []; + for (let i = 0; i < typedListeners.length; i++) { + queue[i] = typedListeners[i]; + } + for (let listener of queue) { + listener(event); + } + if (typeof this[`on${type}`] === 'function') { + this[`on${type}`](event); + } + } +} + +const PRIVATE$1 = Symbol('@@webxr-polyfill/XR'); +class XR extends EventTarget { + constructor(device) { + super(); + this[PRIVATE$1] = { + device, + }; + } + async requestDevice() { + const device = await this[PRIVATE$1].device; + if (device) { + return device; + } + throw new Error('NotFoundError'); + } +} + +let now; +if ('performance' in _global === false) { + let startTime = Date.now(); + now = () => Date.now() - startTime; +} else { + now = () => performance.now(); +} +var now$1 = now; + +const PRIVATE$2 = Symbol('@@webxr-polyfill/XRPresentationContext'); +class XRPresentationContext { + constructor(canvas, ctx, glAttribs) { + this[PRIVATE$2] = { canvas, ctx, glAttribs }; + Object.assign(this, ctx); + } + get canvas() { return this[PRIVATE$2].canvas; } +} + +function mat4_identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +} +function mat4_copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +} +function mat4_invert(out, a) { + let a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + let a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + let a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + let a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + let b00 = a00 * a11 - a01 * a10; + let b01 = a00 * a12 - a02 * a10; + let b02 = a00 * a13 - a03 * a10; + let b03 = a01 * a12 - a02 * a11; + let b04 = a01 * a13 - a03 * a11; + let b05 = a02 * a13 - a03 * a12; + let b06 = a20 * a31 - a21 * a30; + let b07 = a20 * a32 - a22 * a30; + let b08 = a20 * a33 - a23 * a30; + let b09 = a21 * a32 - a22 * a31; + let b10 = a21 * a33 - a23 * a31; + let b11 = a22 * a33 - a23 * a32; + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1.0 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; +} +function mat4_fromRotationTranslation(out, q, v) { + let x = q[0], y = q[1], z = q[2], w = q[3]; + let x2 = x + x; + let y2 = y + y; + let z2 = z + z; + let xx = x * x2; + let xy = x * y2; + let xz = x * z2; + let yy = y * y2; + let yz = y * z2; + let zz = z * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; +} +function mat4_multiply(out, a, b) { + let a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + let a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + let a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + let a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + let b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; + out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; + out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; + out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + return out; +} + +const PRIVATE$3 = Symbol('@@webxr-polyfill/XRDevicePose'); +class XRDevicePose { + constructor(polyfill) { + this[PRIVATE$3] = { + polyfill, + leftViewMatrix: mat4_identity(new Float32Array(16)), + rightViewMatrix: mat4_identity(new Float32Array(16)), + poseModelMatrix: mat4_identity(new Float32Array(16)), + }; + } + get poseModelMatrix() { return this[PRIVATE$3].poseModelMatrix; } + getViewMatrix(view) { + switch (view.eye) { + case 'left': return this[PRIVATE$3].leftViewMatrix; + case 'right': return this[PRIVATE$3].rightViewMatrix; + } + throw new Error(`view is not a valid XREye`); + } + updateFromFrameOfReference(frameOfRef) { + const pose = this[PRIVATE$3].polyfill.getBasePoseMatrix(); + const leftViewMatrix = this[PRIVATE$3].polyfill.getBaseViewMatrix('left'); + const rightViewMatrix = this[PRIVATE$3].polyfill.getBaseViewMatrix('right'); + if (pose) { + frameOfRef.transformBasePoseMatrix(this[PRIVATE$3].poseModelMatrix, pose); + } + if (leftViewMatrix && rightViewMatrix) { + frameOfRef.transformBaseViewMatrix(this[PRIVATE$3].leftViewMatrix, + leftViewMatrix, + this[PRIVATE$3].poseModelMatrix); + frameOfRef.transformBaseViewMatrix(this[PRIVATE$3].rightViewMatrix, + rightViewMatrix, + this[PRIVATE$3].poseModelMatrix); + } + } +} + +const PRIVATE$4 = Symbol('@@webxr-polyfill/XRViewport'); +class XRViewport { + constructor(target) { + this[PRIVATE$4] = { target }; + } + get x() { return this[PRIVATE$4].target.x; } + get y() { return this[PRIVATE$4].target.y; } + get width() { return this[PRIVATE$4].target.width; } + get height() { return this[PRIVATE$4].target.height; } +} + +const PRIVATE$5 = Symbol('@@webxr-polyfill/XRView'); +const XREyes = ['left', 'right']; +class XRView { + constructor(polyfill, eye, sessionId) { + if (!XREyes.includes(eye)) { + throw new Error(`XREye must be one of: ${XREyes}`); + } + const temp = Object.create(null); + const viewport = new XRViewport(temp); + this[PRIVATE$5] = { + polyfill, + eye, + viewport, + temp, + sessionId, + }; + } + get eye() { return this[PRIVATE$5].eye; } + get projectionMatrix() { return this[PRIVATE$5].polyfill.getProjectionMatrix(this.eye); } + _getViewport(layer) { + const viewport = this[PRIVATE$5].viewport; + if (this[PRIVATE$5].polyfill.getViewport(this[PRIVATE$5].sessionId, + this.eye, + layer, + this[PRIVATE$5].temp)) { + return this[PRIVATE$5].viewport; + } + return undefined; + } +} + +const PRIVATE$6 = Symbol('@@webxr-polyfill/XRPresentationFrame'); +class XRPresentationFrame { + constructor(polyfill, session, sessionId) { + const devicePose = new XRDevicePose(polyfill); + const views = [ + new XRView(polyfill, 'left', sessionId), + ]; + if (session.exclusive) { + views.push(new XRView(polyfill, 'right', sessionId)); + } + this[PRIVATE$6] = { + polyfill, + devicePose, + views, + session, + }; + } + get session() { return this[PRIVATE$6].session; } + get views() { return this[PRIVATE$6].views; } + getDevicePose(coordinateSystem) { + this[PRIVATE$6].devicePose.updateFromFrameOfReference(coordinateSystem); + return this[PRIVATE$6].devicePose; + } +} + +const PRIVATE$7 = Symbol('@@webxr-polyfill/XRStageBoundsPoint'); +class XRStageBoundsPoint { + constructor(x, z) { + this[PRIVATE$7] = { x, z }; + } + get x() { return this[PRIVATE$7].x; } + get z() { return this[PRIVATE$7].z; } +} + +const PRIVATE$8 = Symbol('@@webxr-polyfill/XRStageBounds'); +class XRStageBounds { + constructor(boundsData) { + const geometry = []; + for (let i = 0; i < boundsData.length; i += 2) { + geometry.push(new XRStageBoundsPoint(boundsData[i], boundsData[i + 1])); + } + this[PRIVATE$8] = { geometry }; + } + get geometry() { return this[PRIVATE$8].geometry; } +} + +class XRCoordinateSystem { + constructor() {} + getTransformTo(other) { + throw new Error('Not yet supported'); + } +} + +const PRIVATE$9 = Symbol('@@webxr-polyfill/XRFrameOfReference'); +const DEFAULT_EMULATION_HEIGHT = 1.6; +const XRFrameOfReferenceTypes = ['headModel', 'eyeLevel', 'stage']; +const XRFrameOfReferenceOptions = Object.freeze({ + disableStageEmulation: false, + stageEmulationHeight: 0, +}); +class XRFrameOfReference extends XRCoordinateSystem { + constructor(polyfill, type, options, transform, bounds) { + options = Object.assign({}, XRFrameOfReferenceOptions, options); + if (!XRFrameOfReferenceTypes.includes(type)) { + throw new Error(`XRFrameOfReferenceType must be one of ${XRFrameOfReferenceTypes}`); + } + super(); + if (type === 'stage' && options.disableStageEmulation && !transform) { + throw new Error(`XRFrameOfReference cannot use 'stage' type, if disabling emulation and platform does not provide`); + } + const { disableStageEmulation, stageEmulationHeight } = options; + let emulatedHeight = 0; + if (type === 'stage' && !transform) { + emulatedHeight = stageEmulationHeight !== 0 ? stageEmulationHeight : DEFAULT_EMULATION_HEIGHT; + } + if (type === 'stage' && !transform) { + transform = mat4_identity(new Float32Array(16)); + transform[13] = emulatedHeight; + } + this[PRIVATE$9] = { + disableStageEmulation, + stageEmulationHeight, + emulatedHeight, + type, + transform, + polyfill, + bounds, + }; + this.onboundschange = undefined; + } + get bounds() { return this[PRIVATE$9].bounds; } + get emulatedHeight() { return this[PRIVATE$9].emulatedHeight; } + get type() { return this[PRIVATE$9].type; } + transformBasePoseMatrix(out, pose) { + if (this[PRIVATE$9].transform) { + mat4_multiply(out, this[PRIVATE$9].transform, pose); + return; + } + switch (this.type) { + case 'headModel': + if (out !== pose) { + mat4_copy(out, pose); + } + out[12] = out[13] = out[14] = 0; + return; + case 'eyeLevel': + if (out !== pose) { + mat4_copy(out, pose); + } + return; + } + } + transformBaseViewMatrix(out, view) { + let frameOfRef = this[PRIVATE$9].transform; + if (frameOfRef) { + mat4_invert(out, frameOfRef); + mat4_multiply(out, view, out); + } + else if (this.type === 'headModel') { + mat4_invert(out, view); + out[12] = 0; + out[13] = 0; + out[14] = 0; + mat4_invert(out, out); + return out; + } + else { + mat4_copy(out, view); + } + return out; + } +} + +const PRIVATE$10 = Symbol('@@webxr-polyfill/XRSession'); +const XRSessionCreationOptions = Object.freeze({ + exclusive: false, + outputContext: undefined, +}); +const validateSessionOptions = options => { + const { exclusive, outputContext } = options; + if (!exclusive && !outputContext) { + return false; + } + if (outputContext !== undefined && !(outputContext instanceof XRPresentationContext)) { + return false; + } + return true; +}; +class XRSession extends EventTarget { + constructor(polyfill, device, sessionOptions, id) { + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + super(); + const { exclusive, outputContext } = sessionOptions; + this[PRIVATE$10] = { + polyfill, + device, + exclusive, + outputContext, + ended: false, + suspended: false, + suspendedCallback: null, + id, + }; + const frame = new XRPresentationFrame(polyfill, this, this[PRIVATE$10].id); + this[PRIVATE$10].frame = frame; + this[PRIVATE$10].onPresentationEnd = sessionId => { + if (sessionId !== this[PRIVATE$10].id) { + this[PRIVATE$10].suspended = false; + this.dispatchEvent('focus', { session: this }); + const suspendedCallback = this[PRIVATE$10].suspendedCallback; + this[PRIVATE$10].suspendedCallback = null; + if (suspendedCallback) { + this.requestAnimationFrame(suspendedCallback); + } + return; + } + this[PRIVATE$10].ended = true; + polyfill.removeEventListener('@webvr-polyfill/vr-present-end', this[PRIVATE$10].onPresentationEnd); + polyfill.removeEventListener('@webvr-polyfill/vr-present-start', this[PRIVATE$10].onPresentationStart); + this.dispatchEvent('end', { session: this }); + }; + polyfill.addEventListener('@@webxr-polyfill/vr-present-end', this[PRIVATE$10].onPresentationEnd); + this[PRIVATE$10].onPresentationStart = sessionId => { + if (sessionId === this[PRIVATE$10].id) { + return; + } + this[PRIVATE$10].suspended = true; + this.dispatchEvent('blur', { session: this }); + }; + polyfill.addEventListener('@@webxr-polyfill/vr-present-start', this[PRIVATE$10].onPresentationStart); + this.onblur = undefined; + this.onfocus = undefined; + this.onresetpose = undefined; + this.onend = undefined; + } + get device() { return this[PRIVATE$10].device; } + get exclusive() { return this[PRIVATE$10].exclusive; } + get outputContext() { return this[PRIVATE$10].outputContext; } + get depthNear() { return this[PRIVATE$10].polyfill.depthNear; } + set depthNear(value) { this[PRIVATE$10].polyfill.depthNear = value; } + get depthFar() { return this[PRIVATE$10].polyfill.depthFar; } + set depthFar(value) { this[PRIVATE$10].polyfill.depthFar = value; } + get baseLayer() { return this[PRIVATE$10].baseLayer; } + set baseLayer(value) { + if (this[PRIVATE$10].ended) { + return; + } + this[PRIVATE$10].baseLayer = value; + this[PRIVATE$10].polyfill.onBaseLayerSet(this[PRIVATE$10].id, value); + } + async requestFrameOfReference(type, options={}) { + if (this[PRIVATE$10].ended) { + return; + } + options = Object.assign({}, XRFrameOfReferenceOptions, options); + if (!XRFrameOfReferenceTypes.includes(type)) { + throw new Error(`XRFrameOfReferenceType must be one of ${XRFrameOfReferenceTypes}`); + } + let transform = null; + let bounds = null; + try { + transform = await this[PRIVATE$10].polyfill.requestFrameOfReferenceTransform(type, options); + } catch (e) { + if (type !== 'stage' || options.disableStageEmulation) { + throw e; + } + } + if (type === 'stage' && transform) { + bounds = this[PRIVATE$10].polyfill.requestStageBounds(); + if (bounds) { + bounds = new XRStageBounds(bounds); + } + } + return new XRFrameOfReference(this[PRIVATE$10].polyfill, type, options, transform, bounds); + } + requestAnimationFrame(callback) { + if (this[PRIVATE$10].ended) { + return; + } + if (this[PRIVATE$10].suspended && this[PRIVATE$10].suspendedCallback) { + return; + } + if (this[PRIVATE$10].suspended && !this[PRIVATE$10].suspendedCallback) { + this[PRIVATE$10].suspendedCallback = callback; + } + return this[PRIVATE$10].polyfill.requestAnimationFrame(() => { + this[PRIVATE$10].polyfill.onFrameStart(); + callback(now$1(), this[PRIVATE$10].frame); + this[PRIVATE$10].polyfill.onFrameEnd(this[PRIVATE$10].id); + }); + } + cancelAnimationFrame(handle) { + if (this[PRIVATE$10].ended) { + return; + } + this[PRIVATE$10].polyfill.cancelAnimationFrame(handle); + } + async end() { + if (this[PRIVATE$10].ended) { + return; + } + if (!this.exclusive) { + this[PRIVATE$10].ended = true; + this[PRIVATE$10].polyfill.removeEventListener('@@webvr-polyfill/vr-present-start', + this[PRIVATE$10].onPresentationStart); + this[PRIVATE$10].polyfill.removeEventListener('@@webvr-polyfill/vr-present-end', + this[PRIVATE$10].onPresentationEnd); + this.dispatchEvent('end', { session: this }); + } + return this[PRIVATE$10].polyfill.endSession(this[PRIVATE$10].id); + } +} + +const PRIVATE$11 = Symbol('@@webxr-polyfill/XRDevice'); +class XRDevice extends EventTarget { + constructor(polyfill) { + if (!polyfill) { + throw new Error('XRDevice must receive a PolyfilledXRDevice.'); + } + super(); + this[PRIVATE$11] = { + polyfill, + exclusiveSession: null, + nonExclusiveSessions: new Set(), + }; + this.ondeactive = undefined; + } + async supportsSession(sessionOptions={}) { + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + if (!validateSessionOptions(sessionOptions)) { + return Promise.reject(null); + } + if (!this[PRIVATE$11].polyfill.supportsSession(sessionOptions)) { + return Promise.reject(null); + } + return null; + } + async requestSession(sessionOptions) { + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + if (!validateSessionOptions(sessionOptions)) { + throw new Error('NotSupportedError'); + } + if (this[PRIVATE$11].exclusiveSession && sessionOptions.exclusive) { + throw new Error('InvalidStateError'); + } + const sessionId = await this[PRIVATE$11].polyfill.requestSession(sessionOptions); + const session = new XRSession(this[PRIVATE$11].polyfill, this, sessionOptions, sessionId); + if (sessionOptions.exclusive) { + this[PRIVATE$11].exclusiveSession = session; + } else { + this[PRIVATE$11].nonExclusiveSessions.add(session); + } + const onSessionEnd = () => { + if (session.exclusive) { + this[PRIVATE$11].exclusiveSession = null; + } else { + this[PRIVATE$11].nonExclusiveSessions.delete(session); + } + session.removeEventListener('end', onSessionEnd); + }; + session.addEventListener('end', onSessionEnd); + return session; + } +} + +class XRLayer { + constructor() {} + getViewport(view) { + return view._getViewport(this); + } +} + +const POLYFILLED_COMPATIBLE_XR_DEVICE = Symbol('@@webxr-polyfill/polyfilled-compatible-xr-device'); +const COMPATIBLE_XR_DEVICE= Symbol('@@webxr-polyfill/compatible-xr-device'); + +const PRIVATE$12 = Symbol('@@webxr-polyfill/XRWebGLLayer'); +const XRWebGLLayerInit = Object.freeze({ + antialias: true, + depth: false, + stencil: false, + alpha: true, + multiview: false, + framebufferScaleFactor: 0, +}); +class XRWebGLLayer extends XRLayer { + constructor(session, context, layerInit={}) { + const config = Object.assign({}, XRWebGLLayerInit, layerInit); + if (!(session instanceof XRSession)) { + throw new Error('session must be a XRSession'); + } + if (session.ended) { + throw new Error(`InvalidStateError`); + } + if (context[POLYFILLED_COMPATIBLE_XR_DEVICE]) { + if (context[COMPATIBLE_XR_DEVICE] !== session.device) { + throw new Error(`InvalidStateError`); + } + } + const framebuffer = context.getParameter(context.FRAMEBUFFER_BINDING); + super(); + this[PRIVATE$12] = { + context, + config, + framebuffer, + }; + } + get context() { return this[PRIVATE$12].context; } + get antialias() { return this[PRIVATE$12].config.antialias; } + get depth() { return this[PRIVATE$12].config.depth; } + get stencil() { return this[PRIVATE$12].config.stencil; } + get alpha() { return this[PRIVATE$12].config.alpha; } + get multiview() { return false; } + get framebuffer() { return this[PRIVATE$12].framebuffer; } + get framebufferWidth() { return this[PRIVATE$12].context.drawingBufferWidth; } + get framebufferHeight() { return this[PRIVATE$12].context.drawingBufferHeight; } + requestViewportScaling(viewportScaleFactor) { + console.warn('requestViewportScaling is not yet implemented'); + } +} + +var API = { + XR, + XRDevice, + XRSession, + XRPresentationFrame, + XRView, + XRViewport, + XRDevicePose, + XRLayer, + XRWebGLLayer, + XRPresentationContext, + XRCoordinateSystem, + XRFrameOfReference, + XRStageBounds, + XRStageBoundsPoint, +}; + +const extendContextCompatibleXRDevice = Context => { + if (typeof Context.prototype.setCompatibleXRDevice === 'function') { + return false; + } + Context.prototype.setCompatibleXRDevice = function (xrDevice) { + return new Promise((resolve, reject) => { + if (xrDevice && typeof xrDevice.requestSession === 'function') { + resolve(); + } else { + reject(); + } + }).then(() => this[COMPATIBLE_XR_DEVICE] = xrDevice); + }; + return true; +}; +const extendGetContext = Canvas => { + const getContext = HTMLCanvasElement.prototype.getContext; + HTMLCanvasElement.prototype.getContext = function (contextType, glAttribs) { + if (contextType === 'xrpresent') { + let ctx = getContext.call(this, '2d', glAttribs); + return new XRPresentationContext(this, ctx, glAttribs); + } + const ctx = getContext.call(this, contextType, glAttribs); + ctx[POLYFILLED_COMPATIBLE_XR_DEVICE] = true; + if (glAttribs && ('compatibleXRDevice' in glAttribs)) { + ctx[COMPATIBLE_XR_DEVICE] = glAttribs.compatibleXRDevice; + } + return ctx; + }; +}; + +const isMobile = global => { + var check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(global.navigator.userAgent||global.navigator.vendor||global.opera); + return check; +}; +const applyCanvasStylesForMinimalRendering = canvas => { + canvas.style.display = 'block'; + canvas.style.position = 'absolute'; + canvas.style.width = canvas.style.height = '1px'; + canvas.style.top = canvas.style.left = '0px'; +}; + +var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + + +function unwrapExports (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +var cardboardVrDisplay = createCommonjsModule(function (module, exports) { +(function (global, factory) { + module.exports = factory(); +}(commonjsGlobal, (function () { var classCallCheck = function (instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } +}; +var createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; +}(); +var slicedToArray = function () { + function sliceIterator(arr, i) { + var _arr = []; + var _n = true; + var _d = false; + var _e = undefined; + try { + for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally { + try { + if (!_n && _i["return"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + return _arr; + } + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; +}(); +var MIN_TIMESTEP = 0.001; +var MAX_TIMESTEP = 1; +var base64 = function base64(mimeType, _base) { + return 'data:' + mimeType + ';base64,' + _base; +}; +var lerp = function lerp(a, b, t) { + return a + (b - a) * t; +}; +var isIOS = function () { + var isIOS = /iPad|iPhone|iPod/.test(navigator.platform); + return function () { + return isIOS; + }; +}(); +var isWebViewAndroid = function () { + var isWebViewAndroid = navigator.userAgent.indexOf('Version') !== -1 && navigator.userAgent.indexOf('Android') !== -1 && navigator.userAgent.indexOf('Chrome') !== -1; + return function () { + return isWebViewAndroid; + }; +}(); +var isSafari = function () { + var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); + return function () { + return isSafari; + }; +}(); +var isFirefoxAndroid = function () { + var isFirefoxAndroid = navigator.userAgent.indexOf('Firefox') !== -1 && navigator.userAgent.indexOf('Android') !== -1; + return function () { + return isFirefoxAndroid; + }; +}(); +var getChromeVersion = function () { + var match = navigator.userAgent.match(/.*Chrome\/([0-9]+)/); + var value = match ? parseInt(match[1], 10) : null; + return function () { + return value; + }; +}(); +var isChromeWithoutDeviceMotion = function () { + var value = false; + if (getChromeVersion() === 65) { + var match = navigator.userAgent.match(/.*Chrome\/([0-9\.]*)/); + if (match) { + var _match$1$split = match[1].split('.'), + _match$1$split2 = slicedToArray(_match$1$split, 4), + major = _match$1$split2[0], + minor = _match$1$split2[1], + branch = _match$1$split2[2], + build = _match$1$split2[3]; + value = parseInt(branch, 10) === 3325 && parseInt(build, 10) < 148; + } + } + return function () { + return value; + }; +}(); +var isR7 = function () { + var isR7 = navigator.userAgent.indexOf('R7 Build') !== -1; + return function () { + return isR7; + }; +}(); +var isLandscapeMode = function isLandscapeMode() { + var rtn = window.orientation == 90 || window.orientation == -90; + return isR7() ? !rtn : rtn; +}; +var isTimestampDeltaValid = function isTimestampDeltaValid(timestampDeltaS) { + if (isNaN(timestampDeltaS)) { + return false; + } + if (timestampDeltaS <= MIN_TIMESTEP) { + return false; + } + if (timestampDeltaS > MAX_TIMESTEP) { + return false; + } + return true; +}; +var getScreenWidth = function getScreenWidth() { + return Math.max(window.screen.width, window.screen.height) * window.devicePixelRatio; +}; +var getScreenHeight = function getScreenHeight() { + return Math.min(window.screen.width, window.screen.height) * window.devicePixelRatio; +}; +var requestFullscreen = function requestFullscreen(element) { + if (isWebViewAndroid()) { + return false; + } + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } else { + return false; + } + return true; +}; +var exitFullscreen = function exitFullscreen() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } else { + return false; + } + return true; +}; +var getFullscreenElement = function getFullscreenElement() { + return document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement || document.msFullscreenElement; +}; +var linkProgram = function linkProgram(gl, vertexSource, fragmentSource, attribLocationMap) { + var vertexShader = gl.createShader(gl.VERTEX_SHADER); + gl.shaderSource(vertexShader, vertexSource); + gl.compileShader(vertexShader); + var fragmentShader = gl.createShader(gl.FRAGMENT_SHADER); + gl.shaderSource(fragmentShader, fragmentSource); + gl.compileShader(fragmentShader); + var program = gl.createProgram(); + gl.attachShader(program, vertexShader); + gl.attachShader(program, fragmentShader); + for (var attribName in attribLocationMap) { + gl.bindAttribLocation(program, attribLocationMap[attribName], attribName); + }gl.linkProgram(program); + gl.deleteShader(vertexShader); + gl.deleteShader(fragmentShader); + return program; +}; +var getProgramUniforms = function getProgramUniforms(gl, program) { + var uniforms = {}; + var uniformCount = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS); + var uniformName = ''; + for (var i = 0; i < uniformCount; i++) { + var uniformInfo = gl.getActiveUniform(program, i); + uniformName = uniformInfo.name.replace('[0]', ''); + uniforms[uniformName] = gl.getUniformLocation(program, uniformName); + } + return uniforms; +}; +var orthoMatrix = function orthoMatrix(out, left, right, bottom, top, near, far) { + var lr = 1 / (left - right), + bt = 1 / (bottom - top), + nf = 1 / (near - far); + out[0] = -2 * lr; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = -2 * bt; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 2 * nf; + out[11] = 0; + out[12] = (left + right) * lr; + out[13] = (top + bottom) * bt; + out[14] = (far + near) * nf; + out[15] = 1; + return out; +}; +var isMobile = function isMobile() { + var check = false; + (function (a) { + if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; + })(navigator.userAgent || navigator.vendor || window.opera); + return check; +}; +var extend = function extend(dest, src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dest[key] = src[key]; + } + } + return dest; +}; +var safariCssSizeWorkaround = function safariCssSizeWorkaround(canvas) { + if (isIOS()) { + var width = canvas.style.width; + var height = canvas.style.height; + canvas.style.width = parseInt(width) + 1 + 'px'; + canvas.style.height = parseInt(height) + 'px'; + setTimeout(function () { + canvas.style.width = width; + canvas.style.height = height; + }, 100); + } + window.canvas = canvas; +}; +var frameDataFromPose = function () { + var piOver180 = Math.PI / 180.0; + var rad45 = Math.PI * 0.25; + function mat4_perspectiveFromFieldOfView(out, fov, near, far) { + var upTan = Math.tan(fov ? fov.upDegrees * piOver180 : rad45), + downTan = Math.tan(fov ? fov.downDegrees * piOver180 : rad45), + leftTan = Math.tan(fov ? fov.leftDegrees * piOver180 : rad45), + rightTan = Math.tan(fov ? fov.rightDegrees * piOver180 : rad45), + xScale = 2.0 / (leftTan + rightTan), + yScale = 2.0 / (upTan + downTan); + out[0] = xScale; + out[1] = 0.0; + out[2] = 0.0; + out[3] = 0.0; + out[4] = 0.0; + out[5] = yScale; + out[6] = 0.0; + out[7] = 0.0; + out[8] = -((leftTan - rightTan) * xScale * 0.5); + out[9] = (upTan - downTan) * yScale * 0.5; + out[10] = far / (near - far); + out[11] = -1.0; + out[12] = 0.0; + out[13] = 0.0; + out[14] = far * near / (near - far); + out[15] = 0.0; + return out; + } + function mat4_fromRotationTranslation(out, q, v) { + var x = q[0], + y = q[1], + z = q[2], + w = q[3], + x2 = x + x, + y2 = y + y, + z2 = z + z, + xx = x * x2, + xy = x * y2, + xz = x * z2, + yy = y * y2, + yz = y * z2, + zz = z * z2, + wx = w * x2, + wy = w * y2, + wz = w * z2; + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + return out; + } + function mat4_translate(out, a, v) { + var x = v[0], + y = v[1], + z = v[2], + a00, + a01, + a02, + a03, + a10, + a11, + a12, + a13, + a20, + a21, + a22, + a23; + if (a === out) { + out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; + out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; + out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; + out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; + } else { + a00 = a[0];a01 = a[1];a02 = a[2];a03 = a[3]; + a10 = a[4];a11 = a[5];a12 = a[6];a13 = a[7]; + a20 = a[8];a21 = a[9];a22 = a[10];a23 = a[11]; + out[0] = a00;out[1] = a01;out[2] = a02;out[3] = a03; + out[4] = a10;out[5] = a11;out[6] = a12;out[7] = a13; + out[8] = a20;out[9] = a21;out[10] = a22;out[11] = a23; + out[12] = a00 * x + a10 * y + a20 * z + a[12]; + out[13] = a01 * x + a11 * y + a21 * z + a[13]; + out[14] = a02 * x + a12 * y + a22 * z + a[14]; + out[15] = a03 * x + a13 * y + a23 * z + a[15]; + } + return out; + } + function mat4_invert(out, a) { + var a00 = a[0], + a01 = a[1], + a02 = a[2], + a03 = a[3], + a10 = a[4], + a11 = a[5], + a12 = a[6], + a13 = a[7], + a20 = a[8], + a21 = a[9], + a22 = a[10], + a23 = a[11], + a30 = a[12], + a31 = a[13], + a32 = a[14], + a33 = a[15], + b00 = a00 * a11 - a01 * a10, + b01 = a00 * a12 - a02 * a10, + b02 = a00 * a13 - a03 * a10, + b03 = a01 * a12 - a02 * a11, + b04 = a01 * a13 - a03 * a11, + b05 = a02 * a13 - a03 * a12, + b06 = a20 * a31 - a21 * a30, + b07 = a20 * a32 - a22 * a30, + b08 = a20 * a33 - a23 * a30, + b09 = a21 * a32 - a22 * a31, + b10 = a21 * a33 - a23 * a31, + b11 = a22 * a33 - a23 * a32, + det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + if (!det) { + return null; + } + det = 1.0 / det; + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + return out; + } + var defaultOrientation = new Float32Array([0, 0, 0, 1]); + var defaultPosition = new Float32Array([0, 0, 0]); + function updateEyeMatrices(projection, view, pose, fov, offset, vrDisplay) { + mat4_perspectiveFromFieldOfView(projection, fov || null, vrDisplay.depthNear, vrDisplay.depthFar); + var orientation = pose.orientation || defaultOrientation; + var position = pose.position || defaultPosition; + mat4_fromRotationTranslation(view, orientation, position); + if (offset) mat4_translate(view, view, offset); + mat4_invert(view, view); + } + return function (frameData, pose, vrDisplay) { + if (!frameData || !pose) return false; + frameData.pose = pose; + frameData.timestamp = pose.timestamp; + updateEyeMatrices(frameData.leftProjectionMatrix, frameData.leftViewMatrix, pose, vrDisplay._getFieldOfView("left"), vrDisplay._getEyeOffset("left"), vrDisplay); + updateEyeMatrices(frameData.rightProjectionMatrix, frameData.rightViewMatrix, pose, vrDisplay._getFieldOfView("right"), vrDisplay._getEyeOffset("right"), vrDisplay); + return true; + }; +}(); +var isInsideCrossOriginIFrame = function isInsideCrossOriginIFrame() { + var isFramed = window.self !== window.top; + var refOrigin = getOriginFromUrl(document.referrer); + var thisOrigin = getOriginFromUrl(window.location.href); + return isFramed && refOrigin !== thisOrigin; +}; +var getOriginFromUrl = function getOriginFromUrl(url) { + var domainIdx; + var protoSepIdx = url.indexOf("://"); + if (protoSepIdx !== -1) { + domainIdx = protoSepIdx + 3; + } else { + domainIdx = 0; + } + var domainEndIdx = url.indexOf('/', domainIdx); + if (domainEndIdx === -1) { + domainEndIdx = url.length; + } + return url.substring(0, domainEndIdx); +}; +var getQuaternionAngle = function getQuaternionAngle(quat) { + if (quat.w > 1) { + console.warn('getQuaternionAngle: w > 1'); + return 0; + } + var angle = 2 * Math.acos(quat.w); + return angle; +}; +var warnOnce = function () { + var observedWarnings = {}; + return function (key, message) { + if (observedWarnings[key] === undefined) { + console.warn('webvr-polyfill: ' + message); + observedWarnings[key] = true; + } + }; +}(); +var deprecateWarning = function deprecateWarning(deprecated, suggested) { + var alternative = suggested ? 'Please use ' + suggested + ' instead.' : ''; + warnOnce(deprecated, deprecated + ' has been deprecated. ' + 'This may not work on native WebVR displays. ' + alternative); +}; +function WGLUPreserveGLState(gl, bindings, callback) { + if (!bindings) { + callback(gl); + return; + } + var boundValues = []; + var activeTexture = null; + for (var i = 0; i < bindings.length; ++i) { + var binding = bindings[i]; + switch (binding) { + case gl.TEXTURE_BINDING_2D: + case gl.TEXTURE_BINDING_CUBE_MAP: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) { + console.error("TEXTURE_BINDING_2D or TEXTURE_BINDING_CUBE_MAP must be followed by a valid texture unit"); + boundValues.push(null, null); + break; + } + if (!activeTexture) { + activeTexture = gl.getParameter(gl.ACTIVE_TEXTURE); + } + gl.activeTexture(textureUnit); + boundValues.push(gl.getParameter(binding), null); + break; + case gl.ACTIVE_TEXTURE: + activeTexture = gl.getParameter(gl.ACTIVE_TEXTURE); + boundValues.push(null); + break; + default: + boundValues.push(gl.getParameter(binding)); + break; + } + } + callback(gl); + for (var i = 0; i < bindings.length; ++i) { + var binding = bindings[i]; + var boundValue = boundValues[i]; + switch (binding) { + case gl.ACTIVE_TEXTURE: + break; + case gl.ARRAY_BUFFER_BINDING: + gl.bindBuffer(gl.ARRAY_BUFFER, boundValue); + break; + case gl.COLOR_CLEAR_VALUE: + gl.clearColor(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.COLOR_WRITEMASK: + gl.colorMask(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.CURRENT_PROGRAM: + gl.useProgram(boundValue); + break; + case gl.ELEMENT_ARRAY_BUFFER_BINDING: + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, boundValue); + break; + case gl.FRAMEBUFFER_BINDING: + gl.bindFramebuffer(gl.FRAMEBUFFER, boundValue); + break; + case gl.RENDERBUFFER_BINDING: + gl.bindRenderbuffer(gl.RENDERBUFFER, boundValue); + break; + case gl.TEXTURE_BINDING_2D: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) + break; + gl.activeTexture(textureUnit); + gl.bindTexture(gl.TEXTURE_2D, boundValue); + break; + case gl.TEXTURE_BINDING_CUBE_MAP: + var textureUnit = bindings[++i]; + if (textureUnit < gl.TEXTURE0 || textureUnit > gl.TEXTURE31) + break; + gl.activeTexture(textureUnit); + gl.bindTexture(gl.TEXTURE_CUBE_MAP, boundValue); + break; + case gl.VIEWPORT: + gl.viewport(boundValue[0], boundValue[1], boundValue[2], boundValue[3]); + break; + case gl.BLEND: + case gl.CULL_FACE: + case gl.DEPTH_TEST: + case gl.SCISSOR_TEST: + case gl.STENCIL_TEST: + if (boundValue) { + gl.enable(binding); + } else { + gl.disable(binding); + } + break; + default: + console.log("No GL restore behavior for 0x" + binding.toString(16)); + break; + } + if (activeTexture) { + gl.activeTexture(activeTexture); + } + } +} +var glPreserveState = WGLUPreserveGLState; +var distortionVS = ['attribute vec2 position;', 'attribute vec3 texCoord;', 'varying vec2 vTexCoord;', 'uniform vec4 viewportOffsetScale[2];', 'void main() {', ' vec4 viewport = viewportOffsetScale[int(texCoord.z)];', ' vTexCoord = (texCoord.xy * viewport.zw) + viewport.xy;', ' gl_Position = vec4( position, 1.0, 1.0 );', '}'].join('\n'); +var distortionFS = ['precision mediump float;', 'uniform sampler2D diffuse;', 'varying vec2 vTexCoord;', 'void main() {', ' gl_FragColor = texture2D(diffuse, vTexCoord);', '}'].join('\n'); +function CardboardDistorter(gl, cardboardUI, bufferScale, dirtySubmitFrameBindings) { + this.gl = gl; + this.cardboardUI = cardboardUI; + this.bufferScale = bufferScale; + this.dirtySubmitFrameBindings = dirtySubmitFrameBindings; + this.ctxAttribs = gl.getContextAttributes(); + this.meshWidth = 20; + this.meshHeight = 20; + this.bufferWidth = gl.drawingBufferWidth; + this.bufferHeight = gl.drawingBufferHeight; + this.realBindFramebuffer = gl.bindFramebuffer; + this.realEnable = gl.enable; + this.realDisable = gl.disable; + this.realColorMask = gl.colorMask; + this.realClearColor = gl.clearColor; + this.realViewport = gl.viewport; + if (!isIOS()) { + this.realCanvasWidth = Object.getOwnPropertyDescriptor(gl.canvas.__proto__, 'width'); + this.realCanvasHeight = Object.getOwnPropertyDescriptor(gl.canvas.__proto__, 'height'); + } + this.isPatched = false; + this.lastBoundFramebuffer = null; + this.cullFace = false; + this.depthTest = false; + this.blend = false; + this.scissorTest = false; + this.stencilTest = false; + this.viewport = [0, 0, 0, 0]; + this.colorMask = [true, true, true, true]; + this.clearColor = [0, 0, 0, 0]; + this.attribs = { + position: 0, + texCoord: 1 + }; + this.program = linkProgram(gl, distortionVS, distortionFS, this.attribs); + this.uniforms = getProgramUniforms(gl, this.program); + this.viewportOffsetScale = new Float32Array(8); + this.setTextureBounds(); + this.vertexBuffer = gl.createBuffer(); + this.indexBuffer = gl.createBuffer(); + this.indexCount = 0; + this.renderTarget = gl.createTexture(); + this.framebuffer = gl.createFramebuffer(); + this.depthStencilBuffer = null; + this.depthBuffer = null; + this.stencilBuffer = null; + if (this.ctxAttribs.depth && this.ctxAttribs.stencil) { + this.depthStencilBuffer = gl.createRenderbuffer(); + } else if (this.ctxAttribs.depth) { + this.depthBuffer = gl.createRenderbuffer(); + } else if (this.ctxAttribs.stencil) { + this.stencilBuffer = gl.createRenderbuffer(); + } + this.patch(); + this.onResize(); +} +CardboardDistorter.prototype.destroy = function () { + var gl = this.gl; + this.unpatch(); + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); + gl.deleteBuffer(this.indexBuffer); + gl.deleteTexture(this.renderTarget); + gl.deleteFramebuffer(this.framebuffer); + if (this.depthStencilBuffer) { + gl.deleteRenderbuffer(this.depthStencilBuffer); + } + if (this.depthBuffer) { + gl.deleteRenderbuffer(this.depthBuffer); + } + if (this.stencilBuffer) { + gl.deleteRenderbuffer(this.stencilBuffer); + } + if (this.cardboardUI) { + this.cardboardUI.destroy(); + } +}; +CardboardDistorter.prototype.onResize = function () { + var gl = this.gl; + var self = this; + var glState = [gl.RENDERBUFFER_BINDING, gl.TEXTURE_BINDING_2D, gl.TEXTURE0]; + glPreserveState(gl, glState, function (gl) { + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, null); + if (self.scissorTest) { + self.realDisable.call(gl, gl.SCISSOR_TEST); + } + self.realColorMask.call(gl, true, true, true, true); + self.realViewport.call(gl, 0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + self.realClearColor.call(gl, 0, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.framebuffer); + gl.bindTexture(gl.TEXTURE_2D, self.renderTarget); + gl.texImage2D(gl.TEXTURE_2D, 0, self.ctxAttribs.alpha ? gl.RGBA : gl.RGB, self.bufferWidth, self.bufferHeight, 0, self.ctxAttribs.alpha ? gl.RGBA : gl.RGB, gl.UNSIGNED_BYTE, null); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); + gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, self.renderTarget, 0); + if (self.ctxAttribs.depth && self.ctxAttribs.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.depthStencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, self.depthStencilBuffer); + } else if (self.ctxAttribs.depth) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.depthBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, self.depthBuffer); + } else if (self.ctxAttribs.stencil) { + gl.bindRenderbuffer(gl.RENDERBUFFER, self.stencilBuffer); + gl.renderbufferStorage(gl.RENDERBUFFER, gl.STENCIL_INDEX8, self.bufferWidth, self.bufferHeight); + gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.RENDERBUFFER, self.stencilBuffer); + } + if (!gl.checkFramebufferStatus(gl.FRAMEBUFFER) === gl.FRAMEBUFFER_COMPLETE) { + console.error('Framebuffer incomplete!'); + } + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.lastBoundFramebuffer); + if (self.scissorTest) { + self.realEnable.call(gl, gl.SCISSOR_TEST); + } + self.realColorMask.apply(gl, self.colorMask); + self.realViewport.apply(gl, self.viewport); + self.realClearColor.apply(gl, self.clearColor); + }); + if (this.cardboardUI) { + this.cardboardUI.onResize(); + } +}; +CardboardDistorter.prototype.patch = function () { + if (this.isPatched) { + return; + } + var self = this; + var canvas = this.gl.canvas; + var gl = this.gl; + if (!isIOS()) { + canvas.width = getScreenWidth() * this.bufferScale; + canvas.height = getScreenHeight() * this.bufferScale; + Object.defineProperty(canvas, 'width', { + configurable: true, + enumerable: true, + get: function get() { + return self.bufferWidth; + }, + set: function set(value) { + self.bufferWidth = value; + self.realCanvasWidth.set.call(canvas, value); + self.onResize(); + } + }); + Object.defineProperty(canvas, 'height', { + configurable: true, + enumerable: true, + get: function get() { + return self.bufferHeight; + }, + set: function set(value) { + self.bufferHeight = value; + self.realCanvasHeight.set.call(canvas, value); + self.onResize(); + } + }); + } + this.lastBoundFramebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING); + if (this.lastBoundFramebuffer == null) { + this.lastBoundFramebuffer = this.framebuffer; + this.gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer); + } + this.gl.bindFramebuffer = function (target, framebuffer) { + self.lastBoundFramebuffer = framebuffer ? framebuffer : self.framebuffer; + self.realBindFramebuffer.call(gl, target, self.lastBoundFramebuffer); + }; + this.cullFace = gl.getParameter(gl.CULL_FACE); + this.depthTest = gl.getParameter(gl.DEPTH_TEST); + this.blend = gl.getParameter(gl.BLEND); + this.scissorTest = gl.getParameter(gl.SCISSOR_TEST); + this.stencilTest = gl.getParameter(gl.STENCIL_TEST); + gl.enable = function (pname) { + switch (pname) { + case gl.CULL_FACE: + self.cullFace = true;break; + case gl.DEPTH_TEST: + self.depthTest = true;break; + case gl.BLEND: + self.blend = true;break; + case gl.SCISSOR_TEST: + self.scissorTest = true;break; + case gl.STENCIL_TEST: + self.stencilTest = true;break; + } + self.realEnable.call(gl, pname); + }; + gl.disable = function (pname) { + switch (pname) { + case gl.CULL_FACE: + self.cullFace = false;break; + case gl.DEPTH_TEST: + self.depthTest = false;break; + case gl.BLEND: + self.blend = false;break; + case gl.SCISSOR_TEST: + self.scissorTest = false;break; + case gl.STENCIL_TEST: + self.stencilTest = false;break; + } + self.realDisable.call(gl, pname); + }; + this.colorMask = gl.getParameter(gl.COLOR_WRITEMASK); + gl.colorMask = function (r, g, b, a) { + self.colorMask[0] = r; + self.colorMask[1] = g; + self.colorMask[2] = b; + self.colorMask[3] = a; + self.realColorMask.call(gl, r, g, b, a); + }; + this.clearColor = gl.getParameter(gl.COLOR_CLEAR_VALUE); + gl.clearColor = function (r, g, b, a) { + self.clearColor[0] = r; + self.clearColor[1] = g; + self.clearColor[2] = b; + self.clearColor[3] = a; + self.realClearColor.call(gl, r, g, b, a); + }; + this.viewport = gl.getParameter(gl.VIEWPORT); + gl.viewport = function (x, y, w, h) { + self.viewport[0] = x; + self.viewport[1] = y; + self.viewport[2] = w; + self.viewport[3] = h; + self.realViewport.call(gl, x, y, w, h); + }; + this.isPatched = true; + safariCssSizeWorkaround(canvas); +}; +CardboardDistorter.prototype.unpatch = function () { + if (!this.isPatched) { + return; + } + var gl = this.gl; + var canvas = this.gl.canvas; + if (!isIOS()) { + Object.defineProperty(canvas, 'width', this.realCanvasWidth); + Object.defineProperty(canvas, 'height', this.realCanvasHeight); + } + canvas.width = this.bufferWidth; + canvas.height = this.bufferHeight; + gl.bindFramebuffer = this.realBindFramebuffer; + gl.enable = this.realEnable; + gl.disable = this.realDisable; + gl.colorMask = this.realColorMask; + gl.clearColor = this.realClearColor; + gl.viewport = this.realViewport; + if (this.lastBoundFramebuffer == this.framebuffer) { + gl.bindFramebuffer(gl.FRAMEBUFFER, null); + } + this.isPatched = false; + setTimeout(function () { + safariCssSizeWorkaround(canvas); + }, 1); +}; +CardboardDistorter.prototype.setTextureBounds = function (leftBounds, rightBounds) { + if (!leftBounds) { + leftBounds = [0, 0, 0.5, 1]; + } + if (!rightBounds) { + rightBounds = [0.5, 0, 0.5, 1]; + } + this.viewportOffsetScale[0] = leftBounds[0]; + this.viewportOffsetScale[1] = leftBounds[1]; + this.viewportOffsetScale[2] = leftBounds[2]; + this.viewportOffsetScale[3] = leftBounds[3]; + this.viewportOffsetScale[4] = rightBounds[0]; + this.viewportOffsetScale[5] = rightBounds[1]; + this.viewportOffsetScale[6] = rightBounds[2]; + this.viewportOffsetScale[7] = rightBounds[3]; +}; +CardboardDistorter.prototype.submitFrame = function () { + var gl = this.gl; + var self = this; + var glState = []; + if (!this.dirtySubmitFrameBindings) { + glState.push(gl.CURRENT_PROGRAM, gl.ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING, gl.TEXTURE_BINDING_2D, gl.TEXTURE0); + } + glPreserveState(gl, glState, function (gl) { + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, null); + if (self.cullFace) { + self.realDisable.call(gl, gl.CULL_FACE); + } + if (self.depthTest) { + self.realDisable.call(gl, gl.DEPTH_TEST); + } + if (self.blend) { + self.realDisable.call(gl, gl.BLEND); + } + if (self.scissorTest) { + self.realDisable.call(gl, gl.SCISSOR_TEST); + } + if (self.stencilTest) { + self.realDisable.call(gl, gl.STENCIL_TEST); + } + self.realColorMask.call(gl, true, true, true, true); + self.realViewport.call(gl, 0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + if (self.ctxAttribs.alpha || isIOS()) { + self.realClearColor.call(gl, 0, 0, 0, 1); + gl.clear(gl.COLOR_BUFFER_BIT); + } + gl.useProgram(self.program); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, self.indexBuffer); + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.enableVertexAttribArray(self.attribs.position); + gl.enableVertexAttribArray(self.attribs.texCoord); + gl.vertexAttribPointer(self.attribs.position, 2, gl.FLOAT, false, 20, 0); + gl.vertexAttribPointer(self.attribs.texCoord, 3, gl.FLOAT, false, 20, 8); + gl.activeTexture(gl.TEXTURE0); + gl.uniform1i(self.uniforms.diffuse, 0); + gl.bindTexture(gl.TEXTURE_2D, self.renderTarget); + gl.uniform4fv(self.uniforms.viewportOffsetScale, self.viewportOffsetScale); + gl.drawElements(gl.TRIANGLES, self.indexCount, gl.UNSIGNED_SHORT, 0); + if (self.cardboardUI) { + self.cardboardUI.renderNoState(); + } + self.realBindFramebuffer.call(self.gl, gl.FRAMEBUFFER, self.framebuffer); + if (!self.ctxAttribs.preserveDrawingBuffer) { + self.realClearColor.call(gl, 0, 0, 0, 0); + gl.clear(gl.COLOR_BUFFER_BIT); + } + if (!self.dirtySubmitFrameBindings) { + self.realBindFramebuffer.call(gl, gl.FRAMEBUFFER, self.lastBoundFramebuffer); + } + if (self.cullFace) { + self.realEnable.call(gl, gl.CULL_FACE); + } + if (self.depthTest) { + self.realEnable.call(gl, gl.DEPTH_TEST); + } + if (self.blend) { + self.realEnable.call(gl, gl.BLEND); + } + if (self.scissorTest) { + self.realEnable.call(gl, gl.SCISSOR_TEST); + } + if (self.stencilTest) { + self.realEnable.call(gl, gl.STENCIL_TEST); + } + self.realColorMask.apply(gl, self.colorMask); + self.realViewport.apply(gl, self.viewport); + if (self.ctxAttribs.alpha || !self.ctxAttribs.preserveDrawingBuffer) { + self.realClearColor.apply(gl, self.clearColor); + } + }); + if (isIOS()) { + var canvas = gl.canvas; + if (canvas.width != self.bufferWidth || canvas.height != self.bufferHeight) { + self.bufferWidth = canvas.width; + self.bufferHeight = canvas.height; + self.onResize(); + } + } +}; +CardboardDistorter.prototype.updateDeviceInfo = function (deviceInfo) { + var gl = this.gl; + var self = this; + var glState = [gl.ARRAY_BUFFER_BINDING, gl.ELEMENT_ARRAY_BUFFER_BINDING]; + glPreserveState(gl, glState, function (gl) { + var vertices = self.computeMeshVertices_(self.meshWidth, self.meshHeight, deviceInfo); + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW); + if (!self.indexCount) { + var indices = self.computeMeshIndices_(self.meshWidth, self.meshHeight); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, self.indexBuffer); + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW); + self.indexCount = indices.length; + } + }); +}; +CardboardDistorter.prototype.computeMeshVertices_ = function (width, height, deviceInfo) { + var vertices = new Float32Array(2 * width * height * 5); + var lensFrustum = deviceInfo.getLeftEyeVisibleTanAngles(); + var noLensFrustum = deviceInfo.getLeftEyeNoLensTanAngles(); + var viewport = deviceInfo.getLeftEyeVisibleScreenRect(noLensFrustum); + var vidx = 0; + for (var e = 0; e < 2; e++) { + for (var j = 0; j < height; j++) { + for (var i = 0; i < width; i++, vidx++) { + var u = i / (width - 1); + var v = j / (height - 1); + var s = u; + var t = v; + var x = lerp(lensFrustum[0], lensFrustum[2], u); + var y = lerp(lensFrustum[3], lensFrustum[1], v); + var d = Math.sqrt(x * x + y * y); + var r = deviceInfo.distortion.distortInverse(d); + var p = x * r / d; + var q = y * r / d; + u = (p - noLensFrustum[0]) / (noLensFrustum[2] - noLensFrustum[0]); + v = (q - noLensFrustum[3]) / (noLensFrustum[1] - noLensFrustum[3]); + u = (viewport.x + u * viewport.width - 0.5) * 2.0; + v = (viewport.y + v * viewport.height - 0.5) * 2.0; + vertices[vidx * 5 + 0] = u; + vertices[vidx * 5 + 1] = v; + vertices[vidx * 5 + 2] = s; + vertices[vidx * 5 + 3] = t; + vertices[vidx * 5 + 4] = e; + } + } + var w = lensFrustum[2] - lensFrustum[0]; + lensFrustum[0] = -(w + lensFrustum[0]); + lensFrustum[2] = w - lensFrustum[2]; + w = noLensFrustum[2] - noLensFrustum[0]; + noLensFrustum[0] = -(w + noLensFrustum[0]); + noLensFrustum[2] = w - noLensFrustum[2]; + viewport.x = 1 - (viewport.x + viewport.width); + } + return vertices; +}; +CardboardDistorter.prototype.computeMeshIndices_ = function (width, height) { + var indices = new Uint16Array(2 * (width - 1) * (height - 1) * 6); + var halfwidth = width / 2; + var halfheight = height / 2; + var vidx = 0; + var iidx = 0; + for (var e = 0; e < 2; e++) { + for (var j = 0; j < height; j++) { + for (var i = 0; i < width; i++, vidx++) { + if (i == 0 || j == 0) continue; + if (i <= halfwidth == j <= halfheight) { + indices[iidx++] = vidx; + indices[iidx++] = vidx - width - 1; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx - width - 1; + indices[iidx++] = vidx; + indices[iidx++] = vidx - 1; + } else { + indices[iidx++] = vidx - 1; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx; + indices[iidx++] = vidx - width; + indices[iidx++] = vidx - 1; + indices[iidx++] = vidx - width - 1; + } + } + } + } + return indices; +}; +CardboardDistorter.prototype.getOwnPropertyDescriptor_ = function (proto, attrName) { + var descriptor = Object.getOwnPropertyDescriptor(proto, attrName); + if (descriptor.get === undefined || descriptor.set === undefined) { + descriptor.configurable = true; + descriptor.enumerable = true; + descriptor.get = function () { + return this.getAttribute(attrName); + }; + descriptor.set = function (val) { + this.setAttribute(attrName, val); + }; + } + return descriptor; +}; +var uiVS = ['attribute vec2 position;', 'uniform mat4 projectionMat;', 'void main() {', ' gl_Position = projectionMat * vec4( position, -1.0, 1.0 );', '}'].join('\n'); +var uiFS = ['precision mediump float;', 'uniform vec4 color;', 'void main() {', ' gl_FragColor = color;', '}'].join('\n'); +var DEG2RAD = Math.PI / 180.0; +var kAnglePerGearSection = 60; +var kOuterRimEndAngle = 12; +var kInnerRimBeginAngle = 20; +var kOuterRadius = 1; +var kMiddleRadius = 0.75; +var kInnerRadius = 0.3125; +var kCenterLineThicknessDp = 4; +var kButtonWidthDp = 28; +var kTouchSlopFactor = 1.5; +function CardboardUI(gl) { + this.gl = gl; + this.attribs = { + position: 0 + }; + this.program = linkProgram(gl, uiVS, uiFS, this.attribs); + this.uniforms = getProgramUniforms(gl, this.program); + this.vertexBuffer = gl.createBuffer(); + this.gearOffset = 0; + this.gearVertexCount = 0; + this.arrowOffset = 0; + this.arrowVertexCount = 0; + this.projMat = new Float32Array(16); + this.listener = null; + this.onResize(); +} +CardboardUI.prototype.destroy = function () { + var gl = this.gl; + if (this.listener) { + gl.canvas.removeEventListener('click', this.listener, false); + } + gl.deleteProgram(this.program); + gl.deleteBuffer(this.vertexBuffer); +}; +CardboardUI.prototype.listen = function (optionsCallback, backCallback) { + var canvas = this.gl.canvas; + this.listener = function (event) { + var midline = canvas.clientWidth / 2; + var buttonSize = kButtonWidthDp * kTouchSlopFactor; + if (event.clientX > midline - buttonSize && event.clientX < midline + buttonSize && event.clientY > canvas.clientHeight - buttonSize) { + optionsCallback(event); + } + else if (event.clientX < buttonSize && event.clientY < buttonSize) { + backCallback(event); + } + }; + canvas.addEventListener('click', this.listener, false); +}; +CardboardUI.prototype.onResize = function () { + var gl = this.gl; + var self = this; + var glState = [gl.ARRAY_BUFFER_BINDING]; + glPreserveState(gl, glState, function (gl) { + var vertices = []; + var midline = gl.drawingBufferWidth / 2; + var physicalPixels = Math.max(screen.width, screen.height) * window.devicePixelRatio; + var scalingRatio = gl.drawingBufferWidth / physicalPixels; + var dps = scalingRatio * window.devicePixelRatio; + var lineWidth = kCenterLineThicknessDp * dps / 2; + var buttonSize = kButtonWidthDp * kTouchSlopFactor * dps; + var buttonScale = kButtonWidthDp * dps / 2; + var buttonBorder = (kButtonWidthDp * kTouchSlopFactor - kButtonWidthDp) * dps; + vertices.push(midline - lineWidth, buttonSize); + vertices.push(midline - lineWidth, gl.drawingBufferHeight); + vertices.push(midline + lineWidth, buttonSize); + vertices.push(midline + lineWidth, gl.drawingBufferHeight); + self.gearOffset = vertices.length / 2; + function addGearSegment(theta, r) { + var angle = (90 - theta) * DEG2RAD; + var x = Math.cos(angle); + var y = Math.sin(angle); + vertices.push(kInnerRadius * x * buttonScale + midline, kInnerRadius * y * buttonScale + buttonScale); + vertices.push(r * x * buttonScale + midline, r * y * buttonScale + buttonScale); + } + for (var i = 0; i <= 6; i++) { + var segmentTheta = i * kAnglePerGearSection; + addGearSegment(segmentTheta, kOuterRadius); + addGearSegment(segmentTheta + kOuterRimEndAngle, kOuterRadius); + addGearSegment(segmentTheta + kInnerRimBeginAngle, kMiddleRadius); + addGearSegment(segmentTheta + (kAnglePerGearSection - kInnerRimBeginAngle), kMiddleRadius); + addGearSegment(segmentTheta + (kAnglePerGearSection - kOuterRimEndAngle), kOuterRadius); + } + self.gearVertexCount = vertices.length / 2 - self.gearOffset; + self.arrowOffset = vertices.length / 2; + function addArrowVertex(x, y) { + vertices.push(buttonBorder + x, gl.drawingBufferHeight - buttonBorder - y); + } + var angledLineWidth = lineWidth / Math.sin(45 * DEG2RAD); + addArrowVertex(0, buttonScale); + addArrowVertex(buttonScale, 0); + addArrowVertex(buttonScale + angledLineWidth, angledLineWidth); + addArrowVertex(angledLineWidth, buttonScale + angledLineWidth); + addArrowVertex(angledLineWidth, buttonScale - angledLineWidth); + addArrowVertex(0, buttonScale); + addArrowVertex(buttonScale, buttonScale * 2); + addArrowVertex(buttonScale + angledLineWidth, buttonScale * 2 - angledLineWidth); + addArrowVertex(angledLineWidth, buttonScale - angledLineWidth); + addArrowVertex(0, buttonScale); + addArrowVertex(angledLineWidth, buttonScale - lineWidth); + addArrowVertex(kButtonWidthDp * dps, buttonScale - lineWidth); + addArrowVertex(angledLineWidth, buttonScale + lineWidth); + addArrowVertex(kButtonWidthDp * dps, buttonScale + lineWidth); + self.arrowVertexCount = vertices.length / 2 - self.arrowOffset; + gl.bindBuffer(gl.ARRAY_BUFFER, self.vertexBuffer); + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); + }); +}; +CardboardUI.prototype.render = function () { + var gl = this.gl; + var self = this; + var glState = [gl.CULL_FACE, gl.DEPTH_TEST, gl.BLEND, gl.SCISSOR_TEST, gl.STENCIL_TEST, gl.COLOR_WRITEMASK, gl.VIEWPORT, gl.CURRENT_PROGRAM, gl.ARRAY_BUFFER_BINDING]; + glPreserveState(gl, glState, function (gl) { + gl.disable(gl.CULL_FACE); + gl.disable(gl.DEPTH_TEST); + gl.disable(gl.BLEND); + gl.disable(gl.SCISSOR_TEST); + gl.disable(gl.STENCIL_TEST); + gl.colorMask(true, true, true, true); + gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); + self.renderNoState(); + }); +}; +CardboardUI.prototype.renderNoState = function () { + var gl = this.gl; + gl.useProgram(this.program); + gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer); + gl.enableVertexAttribArray(this.attribs.position); + gl.vertexAttribPointer(this.attribs.position, 2, gl.FLOAT, false, 8, 0); + gl.uniform4f(this.uniforms.color, 1.0, 1.0, 1.0, 1.0); + orthoMatrix(this.projMat, 0, gl.drawingBufferWidth, 0, gl.drawingBufferHeight, 0.1, 1024.0); + gl.uniformMatrix4fv(this.uniforms.projectionMat, false, this.projMat); + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4); + gl.drawArrays(gl.TRIANGLE_STRIP, this.gearOffset, this.gearVertexCount); + gl.drawArrays(gl.TRIANGLE_STRIP, this.arrowOffset, this.arrowVertexCount); +}; +function Distortion(coefficients) { + this.coefficients = coefficients; +} +Distortion.prototype.distortInverse = function (radius) { + var r0 = 0; + var r1 = 1; + var dr0 = radius - this.distort(r0); + while (Math.abs(r1 - r0) > 0.0001 ) { + var dr1 = radius - this.distort(r1); + var r2 = r1 - dr1 * ((r1 - r0) / (dr1 - dr0)); + r0 = r1; + r1 = r2; + dr0 = dr1; + } + return r1; +}; +Distortion.prototype.distort = function (radius) { + var r2 = radius * radius; + var ret = 0; + for (var i = 0; i < this.coefficients.length; i++) { + ret = r2 * (ret + this.coefficients[i]); + } + return (ret + 1) * radius; +}; +var degToRad = Math.PI / 180; +var radToDeg = 180 / Math.PI; +var Vector3 = function Vector3(x, y, z) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; +}; +Vector3.prototype = { + constructor: Vector3, + set: function set(x, y, z) { + this.x = x; + this.y = y; + this.z = z; + return this; + }, + copy: function copy(v) { + this.x = v.x; + this.y = v.y; + this.z = v.z; + return this; + }, + length: function length() { + return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + }, + normalize: function normalize() { + var scalar = this.length(); + if (scalar !== 0) { + var invScalar = 1 / scalar; + this.multiplyScalar(invScalar); + } else { + this.x = 0; + this.y = 0; + this.z = 0; + } + return this; + }, + multiplyScalar: function multiplyScalar(scalar) { + this.x *= scalar; + this.y *= scalar; + this.z *= scalar; + }, + applyQuaternion: function applyQuaternion(q) { + var x = this.x; + var y = this.y; + var z = this.z; + var qx = q.x; + var qy = q.y; + var qz = q.z; + var qw = q.w; + var ix = qw * x + qy * z - qz * y; + var iy = qw * y + qz * x - qx * z; + var iz = qw * z + qx * y - qy * x; + var iw = -qx * x - qy * y - qz * z; + this.x = ix * qw + iw * -qx + iy * -qz - iz * -qy; + this.y = iy * qw + iw * -qy + iz * -qx - ix * -qz; + this.z = iz * qw + iw * -qz + ix * -qy - iy * -qx; + return this; + }, + dot: function dot(v) { + return this.x * v.x + this.y * v.y + this.z * v.z; + }, + crossVectors: function crossVectors(a, b) { + var ax = a.x, + ay = a.y, + az = a.z; + var bx = b.x, + by = b.y, + bz = b.z; + this.x = ay * bz - az * by; + this.y = az * bx - ax * bz; + this.z = ax * by - ay * bx; + return this; + } +}; +var Quaternion = function Quaternion(x, y, z, w) { + this.x = x || 0; + this.y = y || 0; + this.z = z || 0; + this.w = w !== undefined ? w : 1; +}; +Quaternion.prototype = { + constructor: Quaternion, + set: function set(x, y, z, w) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + return this; + }, + copy: function copy(quaternion) { + this.x = quaternion.x; + this.y = quaternion.y; + this.z = quaternion.z; + this.w = quaternion.w; + return this; + }, + setFromEulerXYZ: function setFromEulerXYZ(x, y, z) { + var c1 = Math.cos(x / 2); + var c2 = Math.cos(y / 2); + var c3 = Math.cos(z / 2); + var s1 = Math.sin(x / 2); + var s2 = Math.sin(y / 2); + var s3 = Math.sin(z / 2); + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 + s1 * s2 * c3; + this.w = c1 * c2 * c3 - s1 * s2 * s3; + return this; + }, + setFromEulerYXZ: function setFromEulerYXZ(x, y, z) { + var c1 = Math.cos(x / 2); + var c2 = Math.cos(y / 2); + var c3 = Math.cos(z / 2); + var s1 = Math.sin(x / 2); + var s2 = Math.sin(y / 2); + var s3 = Math.sin(z / 2); + this.x = s1 * c2 * c3 + c1 * s2 * s3; + this.y = c1 * s2 * c3 - s1 * c2 * s3; + this.z = c1 * c2 * s3 - s1 * s2 * c3; + this.w = c1 * c2 * c3 + s1 * s2 * s3; + return this; + }, + setFromAxisAngle: function setFromAxisAngle(axis, angle) { + var halfAngle = angle / 2, + s = Math.sin(halfAngle); + this.x = axis.x * s; + this.y = axis.y * s; + this.z = axis.z * s; + this.w = Math.cos(halfAngle); + return this; + }, + multiply: function multiply(q) { + return this.multiplyQuaternions(this, q); + }, + multiplyQuaternions: function multiplyQuaternions(a, b) { + var qax = a.x, + qay = a.y, + qaz = a.z, + qaw = a.w; + var qbx = b.x, + qby = b.y, + qbz = b.z, + qbw = b.w; + this.x = qax * qbw + qaw * qbx + qay * qbz - qaz * qby; + this.y = qay * qbw + qaw * qby + qaz * qbx - qax * qbz; + this.z = qaz * qbw + qaw * qbz + qax * qby - qay * qbx; + this.w = qaw * qbw - qax * qbx - qay * qby - qaz * qbz; + return this; + }, + inverse: function inverse() { + this.x *= -1; + this.y *= -1; + this.z *= -1; + this.normalize(); + return this; + }, + normalize: function normalize() { + var l = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w); + if (l === 0) { + this.x = 0; + this.y = 0; + this.z = 0; + this.w = 1; + } else { + l = 1 / l; + this.x = this.x * l; + this.y = this.y * l; + this.z = this.z * l; + this.w = this.w * l; + } + return this; + }, + slerp: function slerp(qb, t) { + if (t === 0) return this; + if (t === 1) return this.copy(qb); + var x = this.x, + y = this.y, + z = this.z, + w = this.w; + var cosHalfTheta = w * qb.w + x * qb.x + y * qb.y + z * qb.z; + if (cosHalfTheta < 0) { + this.w = -qb.w; + this.x = -qb.x; + this.y = -qb.y; + this.z = -qb.z; + cosHalfTheta = -cosHalfTheta; + } else { + this.copy(qb); + } + if (cosHalfTheta >= 1.0) { + this.w = w; + this.x = x; + this.y = y; + this.z = z; + return this; + } + var halfTheta = Math.acos(cosHalfTheta); + var sinHalfTheta = Math.sqrt(1.0 - cosHalfTheta * cosHalfTheta); + if (Math.abs(sinHalfTheta) < 0.001) { + this.w = 0.5 * (w + this.w); + this.x = 0.5 * (x + this.x); + this.y = 0.5 * (y + this.y); + this.z = 0.5 * (z + this.z); + return this; + } + var ratioA = Math.sin((1 - t) * halfTheta) / sinHalfTheta, + ratioB = Math.sin(t * halfTheta) / sinHalfTheta; + this.w = w * ratioA + this.w * ratioB; + this.x = x * ratioA + this.x * ratioB; + this.y = y * ratioA + this.y * ratioB; + this.z = z * ratioA + this.z * ratioB; + return this; + }, + setFromUnitVectors: function () { + var v1, r; + var EPS = 0.000001; + return function (vFrom, vTo) { + if (v1 === undefined) v1 = new Vector3(); + r = vFrom.dot(vTo) + 1; + if (r < EPS) { + r = 0; + if (Math.abs(vFrom.x) > Math.abs(vFrom.z)) { + v1.set(-vFrom.y, vFrom.x, 0); + } else { + v1.set(0, -vFrom.z, vFrom.y); + } + } else { + v1.crossVectors(vFrom, vTo); + } + this.x = v1.x; + this.y = v1.y; + this.z = v1.z; + this.w = r; + this.normalize(); + return this; + }; + }() +}; +function Device(params) { + this.width = params.width || getScreenWidth(); + this.height = params.height || getScreenHeight(); + this.widthMeters = params.widthMeters; + this.heightMeters = params.heightMeters; + this.bevelMeters = params.bevelMeters; +} +var DEFAULT_ANDROID = new Device({ + widthMeters: 0.110, + heightMeters: 0.062, + bevelMeters: 0.004 +}); +var DEFAULT_IOS = new Device({ + widthMeters: 0.1038, + heightMeters: 0.0584, + bevelMeters: 0.004 +}); +var Viewers = { + CardboardV1: new CardboardViewer({ + id: 'CardboardV1', + label: 'Cardboard I/O 2014', + fov: 40, + interLensDistance: 0.060, + baselineLensDistance: 0.035, + screenLensDistance: 0.042, + distortionCoefficients: [0.441, 0.156], + inverseCoefficients: [-0.4410035, 0.42756155, -0.4804439, 0.5460139, -0.58821183, 0.5733938, -0.48303202, 0.33299083, -0.17573841, 0.0651772, -0.01488963, 0.001559834] + }), + CardboardV2: new CardboardViewer({ + id: 'CardboardV2', + label: 'Cardboard I/O 2015', + fov: 60, + interLensDistance: 0.064, + baselineLensDistance: 0.035, + screenLensDistance: 0.039, + distortionCoefficients: [0.34, 0.55], + inverseCoefficients: [-0.33836704, -0.18162185, 0.862655, -1.2462051, 1.0560602, -0.58208317, 0.21609078, -0.05444823, 0.009177956, -9.904169E-4, 6.183535E-5, -1.6981803E-6] + }) +}; +function DeviceInfo(deviceParams) { + this.viewer = Viewers.CardboardV2; + this.updateDeviceParams(deviceParams); + this.distortion = new Distortion(this.viewer.distortionCoefficients); +} +DeviceInfo.prototype.updateDeviceParams = function (deviceParams) { + this.device = this.determineDevice_(deviceParams) || this.device; +}; +DeviceInfo.prototype.getDevice = function () { + return this.device; +}; +DeviceInfo.prototype.setViewer = function (viewer) { + this.viewer = viewer; + this.distortion = new Distortion(this.viewer.distortionCoefficients); +}; +DeviceInfo.prototype.determineDevice_ = function (deviceParams) { + if (!deviceParams) { + if (isIOS()) { + console.warn('Using fallback iOS device measurements.'); + return DEFAULT_IOS; + } else { + console.warn('Using fallback Android device measurements.'); + return DEFAULT_ANDROID; + } + } + var METERS_PER_INCH = 0.0254; + var metersPerPixelX = METERS_PER_INCH / deviceParams.xdpi; + var metersPerPixelY = METERS_PER_INCH / deviceParams.ydpi; + var width = getScreenWidth(); + var height = getScreenHeight(); + return new Device({ + widthMeters: metersPerPixelX * width, + heightMeters: metersPerPixelY * height, + bevelMeters: deviceParams.bevelMm * 0.001 + }); +}; +DeviceInfo.prototype.getDistortedFieldOfViewLeftEye = function () { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + var eyeToScreenDistance = viewer.screenLensDistance; + var outerDist = (device.widthMeters - viewer.interLensDistance) / 2; + var innerDist = viewer.interLensDistance / 2; + var bottomDist = viewer.baselineLensDistance - device.bevelMeters; + var topDist = device.heightMeters - bottomDist; + var outerAngle = radToDeg * Math.atan(distortion.distort(outerDist / eyeToScreenDistance)); + var innerAngle = radToDeg * Math.atan(distortion.distort(innerDist / eyeToScreenDistance)); + var bottomAngle = radToDeg * Math.atan(distortion.distort(bottomDist / eyeToScreenDistance)); + var topAngle = radToDeg * Math.atan(distortion.distort(topDist / eyeToScreenDistance)); + return { + leftDegrees: Math.min(outerAngle, viewer.fov), + rightDegrees: Math.min(innerAngle, viewer.fov), + downDegrees: Math.min(bottomAngle, viewer.fov), + upDegrees: Math.min(topAngle, viewer.fov) + }; +}; +DeviceInfo.prototype.getLeftEyeVisibleTanAngles = function () { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + var fovLeft = Math.tan(-degToRad * viewer.fov); + var fovTop = Math.tan(degToRad * viewer.fov); + var fovRight = Math.tan(degToRad * viewer.fov); + var fovBottom = Math.tan(-degToRad * viewer.fov); + var halfWidth = device.widthMeters / 4; + var halfHeight = device.heightMeters / 2; + var verticalLensOffset = viewer.baselineLensDistance - device.bevelMeters - halfHeight; + var centerX = viewer.interLensDistance / 2 - halfWidth; + var centerY = -verticalLensOffset; + var centerZ = viewer.screenLensDistance; + var screenLeft = distortion.distort((centerX - halfWidth) / centerZ); + var screenTop = distortion.distort((centerY + halfHeight) / centerZ); + var screenRight = distortion.distort((centerX + halfWidth) / centerZ); + var screenBottom = distortion.distort((centerY - halfHeight) / centerZ); + var result = new Float32Array(4); + result[0] = Math.max(fovLeft, screenLeft); + result[1] = Math.min(fovTop, screenTop); + result[2] = Math.min(fovRight, screenRight); + result[3] = Math.max(fovBottom, screenBottom); + return result; +}; +DeviceInfo.prototype.getLeftEyeNoLensTanAngles = function () { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + var result = new Float32Array(4); + var fovLeft = distortion.distortInverse(Math.tan(-degToRad * viewer.fov)); + var fovTop = distortion.distortInverse(Math.tan(degToRad * viewer.fov)); + var fovRight = distortion.distortInverse(Math.tan(degToRad * viewer.fov)); + var fovBottom = distortion.distortInverse(Math.tan(-degToRad * viewer.fov)); + var halfWidth = device.widthMeters / 4; + var halfHeight = device.heightMeters / 2; + var verticalLensOffset = viewer.baselineLensDistance - device.bevelMeters - halfHeight; + var centerX = viewer.interLensDistance / 2 - halfWidth; + var centerY = -verticalLensOffset; + var centerZ = viewer.screenLensDistance; + var screenLeft = (centerX - halfWidth) / centerZ; + var screenTop = (centerY + halfHeight) / centerZ; + var screenRight = (centerX + halfWidth) / centerZ; + var screenBottom = (centerY - halfHeight) / centerZ; + result[0] = Math.max(fovLeft, screenLeft); + result[1] = Math.min(fovTop, screenTop); + result[2] = Math.min(fovRight, screenRight); + result[3] = Math.max(fovBottom, screenBottom); + return result; +}; +DeviceInfo.prototype.getLeftEyeVisibleScreenRect = function (undistortedFrustum) { + var viewer = this.viewer; + var device = this.device; + var dist = viewer.screenLensDistance; + var eyeX = (device.widthMeters - viewer.interLensDistance) / 2; + var eyeY = viewer.baselineLensDistance - device.bevelMeters; + var left = (undistortedFrustum[0] * dist + eyeX) / device.widthMeters; + var top = (undistortedFrustum[1] * dist + eyeY) / device.heightMeters; + var right = (undistortedFrustum[2] * dist + eyeX) / device.widthMeters; + var bottom = (undistortedFrustum[3] * dist + eyeY) / device.heightMeters; + return { + x: left, + y: bottom, + width: right - left, + height: top - bottom + }; +}; +DeviceInfo.prototype.getFieldOfViewLeftEye = function (opt_isUndistorted) { + return opt_isUndistorted ? this.getUndistortedFieldOfViewLeftEye() : this.getDistortedFieldOfViewLeftEye(); +}; +DeviceInfo.prototype.getFieldOfViewRightEye = function (opt_isUndistorted) { + var fov = this.getFieldOfViewLeftEye(opt_isUndistorted); + return { + leftDegrees: fov.rightDegrees, + rightDegrees: fov.leftDegrees, + upDegrees: fov.upDegrees, + downDegrees: fov.downDegrees + }; +}; +DeviceInfo.prototype.getUndistortedFieldOfViewLeftEye = function () { + var p = this.getUndistortedParams_(); + return { + leftDegrees: radToDeg * Math.atan(p.outerDist), + rightDegrees: radToDeg * Math.atan(p.innerDist), + downDegrees: radToDeg * Math.atan(p.bottomDist), + upDegrees: radToDeg * Math.atan(p.topDist) + }; +}; +DeviceInfo.prototype.getUndistortedViewportLeftEye = function () { + var p = this.getUndistortedParams_(); + var viewer = this.viewer; + var device = this.device; + var eyeToScreenDistance = viewer.screenLensDistance; + var screenWidth = device.widthMeters / eyeToScreenDistance; + var screenHeight = device.heightMeters / eyeToScreenDistance; + var xPxPerTanAngle = device.width / screenWidth; + var yPxPerTanAngle = device.height / screenHeight; + var x = Math.round((p.eyePosX - p.outerDist) * xPxPerTanAngle); + var y = Math.round((p.eyePosY - p.bottomDist) * yPxPerTanAngle); + return { + x: x, + y: y, + width: Math.round((p.eyePosX + p.innerDist) * xPxPerTanAngle) - x, + height: Math.round((p.eyePosY + p.topDist) * yPxPerTanAngle) - y + }; +}; +DeviceInfo.prototype.getUndistortedParams_ = function () { + var viewer = this.viewer; + var device = this.device; + var distortion = this.distortion; + var eyeToScreenDistance = viewer.screenLensDistance; + var halfLensDistance = viewer.interLensDistance / 2 / eyeToScreenDistance; + var screenWidth = device.widthMeters / eyeToScreenDistance; + var screenHeight = device.heightMeters / eyeToScreenDistance; + var eyePosX = screenWidth / 2 - halfLensDistance; + var eyePosY = (viewer.baselineLensDistance - device.bevelMeters) / eyeToScreenDistance; + var maxFov = viewer.fov; + var viewerMax = distortion.distortInverse(Math.tan(degToRad * maxFov)); + var outerDist = Math.min(eyePosX, viewerMax); + var innerDist = Math.min(halfLensDistance, viewerMax); + var bottomDist = Math.min(eyePosY, viewerMax); + var topDist = Math.min(screenHeight - eyePosY, viewerMax); + return { + outerDist: outerDist, + innerDist: innerDist, + topDist: topDist, + bottomDist: bottomDist, + eyePosX: eyePosX, + eyePosY: eyePosY + }; +}; +function CardboardViewer(params) { + this.id = params.id; + this.label = params.label; + this.fov = params.fov; + this.interLensDistance = params.interLensDistance; + this.baselineLensDistance = params.baselineLensDistance; + this.screenLensDistance = params.screenLensDistance; + this.distortionCoefficients = params.distortionCoefficients; + this.inverseCoefficients = params.inverseCoefficients; +} +DeviceInfo.Viewers = Viewers; +var format = 1; +var last_updated = "2017-09-12T18:54:02Z"; +var devices = [{"type":"android","rules":[{"mdmh":"asus/*/Nexus 7/*"},{"ua":"Nexus 7"}],"dpi":[320.8,323],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"asus/*/ASUS_Z00AD/*"},{"ua":"ASUS_Z00AD"}],"dpi":[403,404.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Google/*/Pixel XL/*"},{"ua":"Pixel XL"}],"dpi":[537.9,533],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Google/*/Pixel/*"},{"ua":"Pixel"}],"dpi":[432.6,436.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"HTC/*/HTC6435LVW/*"},{"ua":"HTC6435LVW"}],"dpi":[449.7,443.3],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"HTC/*/HTC One XL/*"},{"ua":"HTC One XL"}],"dpi":[315.3,314.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"htc/*/Nexus 9/*"},{"ua":"Nexus 9"}],"dpi":289,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"HTC/*/HTC One M9/*"},{"ua":"HTC One M9"}],"dpi":[442.5,443.3],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"HTC/*/HTC One_M8/*"},{"ua":"HTC One_M8"}],"dpi":[449.7,447.4],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"HTC/*/HTC One/*"},{"ua":"HTC One"}],"dpi":472.8,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Huawei/*/Nexus 6P/*"},{"ua":"Nexus 6P"}],"dpi":[515.1,518],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LENOVO/*/Lenovo PB2-690Y/*"},{"ua":"Lenovo PB2-690Y"}],"dpi":[457.2,454.713],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"LGE/*/Nexus 5X/*"},{"ua":"Nexus 5X"}],"dpi":[422,419.9],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/LGMS345/*"},{"ua":"LGMS345"}],"dpi":[221.7,219.1],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"LGE/*/LG-D800/*"},{"ua":"LG-D800"}],"dpi":[422,424.1],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"LGE/*/LG-D850/*"},{"ua":"LG-D850"}],"dpi":[537.9,541.9],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"LGE/*/VS985 4G/*"},{"ua":"VS985 4G"}],"dpi":[537.9,535.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/Nexus 5/*"},{"ua":"Nexus 5 B"}],"dpi":[442.4,444.8],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/Nexus 4/*"},{"ua":"Nexus 4"}],"dpi":[319.8,318.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/LG-P769/*"},{"ua":"LG-P769"}],"dpi":[240.6,247.5],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/LGMS323/*"},{"ua":"LGMS323"}],"dpi":[206.6,204.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"LGE/*/LGLS996/*"},{"ua":"LGLS996"}],"dpi":[403.4,401.5],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Micromax/*/4560MMX/*"},{"ua":"4560MMX"}],"dpi":[240,219.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Micromax/*/A250/*"},{"ua":"Micromax A250"}],"dpi":[480,446.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Micromax/*/Micromax AQ4501/*"},{"ua":"Micromax AQ4501"}],"dpi":240,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/G5/*"},{"ua":"Moto G (5) Plus"}],"dpi":[403.4,403],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/DROID RAZR/*"},{"ua":"DROID RAZR"}],"dpi":[368.1,256.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT830C/*"},{"ua":"XT830C"}],"dpi":[254,255.9],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1021/*"},{"ua":"XT1021"}],"dpi":[254,256.7],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1023/*"},{"ua":"XT1023"}],"dpi":[254,256.7],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1028/*"},{"ua":"XT1028"}],"dpi":[326.6,327.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1034/*"},{"ua":"XT1034"}],"dpi":[326.6,328.4],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1053/*"},{"ua":"XT1053"}],"dpi":[315.3,316.1],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1562/*"},{"ua":"XT1562"}],"dpi":[403.4,402.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/Nexus 6/*"},{"ua":"Nexus 6 B"}],"dpi":[494.3,489.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1063/*"},{"ua":"XT1063"}],"dpi":[295,296.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/XT1064/*"},{"ua":"XT1064"}],"dpi":[295,295.6],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1092/*"},{"ua":"XT1092"}],"dpi":[422,424.1],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"motorola/*/XT1095/*"},{"ua":"XT1095"}],"dpi":[422,423.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"motorola/*/G4/*"},{"ua":"Moto G (4)"}],"dpi":401,"bw":4,"ac":1000},{"type":"android","rules":[{"mdmh":"OnePlus/*/A0001/*"},{"ua":"A0001"}],"dpi":[403.4,401],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"OnePlus/*/ONE E1005/*"},{"ua":"ONE E1005"}],"dpi":[442.4,441.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"OnePlus/*/ONE A2005/*"},{"ua":"ONE A2005"}],"dpi":[391.9,405.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"OPPO/*/X909/*"},{"ua":"X909"}],"dpi":[442.4,444.1],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9082/*"},{"ua":"GT-I9082"}],"dpi":[184.7,185.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G360P/*"},{"ua":"SM-G360P"}],"dpi":[196.7,205.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/Nexus S/*"},{"ua":"Nexus S"}],"dpi":[234.5,229.8],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9300/*"},{"ua":"GT-I9300"}],"dpi":[304.8,303.9],"bw":5,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-T230NU/*"},{"ua":"SM-T230NU"}],"dpi":216,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SGH-T399/*"},{"ua":"SGH-T399"}],"dpi":[217.7,231.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SGH-M919/*"},{"ua":"SGH-M919"}],"dpi":[440.8,437.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N9005/*"},{"ua":"SM-N9005"}],"dpi":[386.4,387],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SAMSUNG-SM-N900A/*"},{"ua":"SAMSUNG-SM-N900A"}],"dpi":[386.4,387.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9500/*"},{"ua":"GT-I9500"}],"dpi":[442.5,443.3],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9505/*"},{"ua":"GT-I9505"}],"dpi":439.4,"bw":4,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G900F/*"},{"ua":"SM-G900F"}],"dpi":[415.6,431.6],"bw":5,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G900M/*"},{"ua":"SM-G900M"}],"dpi":[415.6,431.6],"bw":5,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G800F/*"},{"ua":"SM-G800F"}],"dpi":326.8,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G906S/*"},{"ua":"SM-G906S"}],"dpi":[562.7,572.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9300/*"},{"ua":"GT-I9300"}],"dpi":[306.7,304.8],"bw":5,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-T535/*"},{"ua":"SM-T535"}],"dpi":[142.6,136.4],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N920C/*"},{"ua":"SM-N920C"}],"dpi":[515.1,518.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N920P/*"},{"ua":"SM-N920P"}],"dpi":[386.3655,390.144],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N920W8/*"},{"ua":"SM-N920W8"}],"dpi":[515.1,518.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9300I/*"},{"ua":"GT-I9300I"}],"dpi":[304.8,305.8],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-I9195/*"},{"ua":"GT-I9195"}],"dpi":[249.4,256.7],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SPH-L520/*"},{"ua":"SPH-L520"}],"dpi":[249.4,255.9],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SAMSUNG-SGH-I717/*"},{"ua":"SAMSUNG-SGH-I717"}],"dpi":285.8,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SPH-D710/*"},{"ua":"SPH-D710"}],"dpi":[217.7,204.2],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/GT-N7100/*"},{"ua":"GT-N7100"}],"dpi":265.1,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SCH-I605/*"},{"ua":"SCH-I605"}],"dpi":265.1,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/Galaxy Nexus/*"},{"ua":"Galaxy Nexus"}],"dpi":[315.3,314.2],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N910H/*"},{"ua":"SM-N910H"}],"dpi":[515.1,518],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-N910C/*"},{"ua":"SM-N910C"}],"dpi":[515.2,520.2],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G130M/*"},{"ua":"SM-G130M"}],"dpi":[165.9,164.8],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G928I/*"},{"ua":"SM-G928I"}],"dpi":[515.1,518.4],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G920F/*"},{"ua":"SM-G920F"}],"dpi":580.6,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G920P/*"},{"ua":"SM-G920P"}],"dpi":[522.5,577],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G925F/*"},{"ua":"SM-G925F"}],"dpi":580.6,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G925V/*"},{"ua":"SM-G925V"}],"dpi":[522.5,576.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G930F/*"},{"ua":"SM-G930F"}],"dpi":576.6,"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G935F/*"},{"ua":"SM-G935F"}],"dpi":533,"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G950F/*"},{"ua":"SM-G950F"}],"dpi":[562.707,565.293],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"samsung/*/SM-G955U/*"},{"ua":"SM-G955U"}],"dpi":[522.514,525.762],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"Sony/*/C6903/*"},{"ua":"C6903"}],"dpi":[442.5,443.3],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"Sony/*/D6653/*"},{"ua":"D6653"}],"dpi":[428.6,427.6],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Sony/*/E6653/*"},{"ua":"E6653"}],"dpi":[428.6,425.7],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Sony/*/E6853/*"},{"ua":"E6853"}],"dpi":[403.4,401.9],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"Sony/*/SGP321/*"},{"ua":"SGP321"}],"dpi":[224.7,224.1],"bw":3,"ac":500},{"type":"android","rules":[{"mdmh":"TCT/*/ALCATEL ONE TOUCH Fierce/*"},{"ua":"ALCATEL ONE TOUCH Fierce"}],"dpi":[240,247.5],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"THL/*/thl 5000/*"},{"ua":"thl 5000"}],"dpi":[480,443.3],"bw":3,"ac":1000},{"type":"android","rules":[{"mdmh":"ZTE/*/ZTE Blade L2/*"},{"ua":"ZTE Blade L2"}],"dpi":240,"bw":3,"ac":500},{"type":"ios","rules":[{"res":[640,960]}],"dpi":[325.1,328.4],"bw":4,"ac":1000},{"type":"ios","rules":[{"res":[640,1136]}],"dpi":[317.1,320.2],"bw":3,"ac":1000},{"type":"ios","rules":[{"res":[750,1334]}],"dpi":326.4,"bw":4,"ac":1000},{"type":"ios","rules":[{"res":[1242,2208]}],"dpi":[453.6,458.4],"bw":4,"ac":1000},{"type":"ios","rules":[{"res":[1125,2001]}],"dpi":[410.9,415.4],"bw":4,"ac":1000}]; +var DPDB_CACHE = { + format: format, + last_updated: last_updated, + devices: devices +}; +function Dpdb(url, onDeviceParamsUpdated) { + this.dpdb = DPDB_CACHE; + this.recalculateDeviceParams_(); + if (url) { + this.onDeviceParamsUpdated = onDeviceParamsUpdated; + var xhr = new XMLHttpRequest(); + var obj = this; + xhr.open('GET', url, true); + xhr.addEventListener('load', function () { + obj.loading = false; + if (xhr.status >= 200 && xhr.status <= 299) { + obj.dpdb = JSON.parse(xhr.response); + obj.recalculateDeviceParams_(); + } else { + console.error('Error loading online DPDB!'); + } + }); + xhr.send(); + } +} +Dpdb.prototype.getDeviceParams = function () { + return this.deviceParams; +}; +Dpdb.prototype.recalculateDeviceParams_ = function () { + var newDeviceParams = this.calcDeviceParams_(); + if (newDeviceParams) { + this.deviceParams = newDeviceParams; + if (this.onDeviceParamsUpdated) { + this.onDeviceParamsUpdated(this.deviceParams); + } + } else { + console.error('Failed to recalculate device parameters.'); + } +}; +Dpdb.prototype.calcDeviceParams_ = function () { + var db = this.dpdb; + if (!db) { + console.error('DPDB not available.'); + return null; + } + if (db.format != 1) { + console.error('DPDB has unexpected format version.'); + return null; + } + if (!db.devices || !db.devices.length) { + console.error('DPDB does not have a devices section.'); + return null; + } + var userAgent = navigator.userAgent || navigator.vendor || window.opera; + var width = getScreenWidth(); + var height = getScreenHeight(); + if (!db.devices) { + console.error('DPDB has no devices section.'); + return null; + } + for (var i = 0; i < db.devices.length; i++) { + var device = db.devices[i]; + if (!device.rules) { + console.warn('Device[' + i + '] has no rules section.'); + continue; + } + if (device.type != 'ios' && device.type != 'android') { + console.warn('Device[' + i + '] has invalid type.'); + continue; + } + if (isIOS() != (device.type == 'ios')) continue; + var matched = false; + for (var j = 0; j < device.rules.length; j++) { + var rule = device.rules[j]; + if (this.matchRule_(rule, userAgent, width, height)) { + matched = true; + break; + } + } + if (!matched) continue; + var xdpi = device.dpi[0] || device.dpi; + var ydpi = device.dpi[1] || device.dpi; + return new DeviceParams({ xdpi: xdpi, ydpi: ydpi, bevelMm: device.bw }); + } + console.warn('No DPDB device match.'); + return null; +}; +Dpdb.prototype.matchRule_ = function (rule, ua, screenWidth, screenHeight) { + if (!rule.ua && !rule.res) return false; + if (rule.ua && ua.indexOf(rule.ua) < 0) return false; + if (rule.res) { + if (!rule.res[0] || !rule.res[1]) return false; + var resX = rule.res[0]; + var resY = rule.res[1]; + if (Math.min(screenWidth, screenHeight) != Math.min(resX, resY) || Math.max(screenWidth, screenHeight) != Math.max(resX, resY)) { + return false; + } + } + return true; +}; +function DeviceParams(params) { + this.xdpi = params.xdpi; + this.ydpi = params.ydpi; + this.bevelMm = params.bevelMm; +} +function SensorSample(sample, timestampS) { + this.set(sample, timestampS); +} +SensorSample.prototype.set = function (sample, timestampS) { + this.sample = sample; + this.timestampS = timestampS; +}; +SensorSample.prototype.copy = function (sensorSample) { + this.set(sensorSample.sample, sensorSample.timestampS); +}; +function ComplementaryFilter(kFilter, isDebug) { + this.kFilter = kFilter; + this.isDebug = isDebug; + this.currentAccelMeasurement = new SensorSample(); + this.currentGyroMeasurement = new SensorSample(); + this.previousGyroMeasurement = new SensorSample(); + if (isIOS()) { + this.filterQ = new Quaternion(-1, 0, 0, 1); + } else { + this.filterQ = new Quaternion(1, 0, 0, 1); + } + this.previousFilterQ = new Quaternion(); + this.previousFilterQ.copy(this.filterQ); + this.accelQ = new Quaternion(); + this.isOrientationInitialized = false; + this.estimatedGravity = new Vector3(); + this.measuredGravity = new Vector3(); + this.gyroIntegralQ = new Quaternion(); +} +ComplementaryFilter.prototype.addAccelMeasurement = function (vector, timestampS) { + this.currentAccelMeasurement.set(vector, timestampS); +}; +ComplementaryFilter.prototype.addGyroMeasurement = function (vector, timestampS) { + this.currentGyroMeasurement.set(vector, timestampS); + var deltaT = timestampS - this.previousGyroMeasurement.timestampS; + if (isTimestampDeltaValid(deltaT)) { + this.run_(); + } + this.previousGyroMeasurement.copy(this.currentGyroMeasurement); +}; +ComplementaryFilter.prototype.run_ = function () { + if (!this.isOrientationInitialized) { + this.accelQ = this.accelToQuaternion_(this.currentAccelMeasurement.sample); + this.previousFilterQ.copy(this.accelQ); + this.isOrientationInitialized = true; + return; + } + var deltaT = this.currentGyroMeasurement.timestampS - this.previousGyroMeasurement.timestampS; + var gyroDeltaQ = this.gyroToQuaternionDelta_(this.currentGyroMeasurement.sample, deltaT); + this.gyroIntegralQ.multiply(gyroDeltaQ); + this.filterQ.copy(this.previousFilterQ); + this.filterQ.multiply(gyroDeltaQ); + var invFilterQ = new Quaternion(); + invFilterQ.copy(this.filterQ); + invFilterQ.inverse(); + this.estimatedGravity.set(0, 0, -1); + this.estimatedGravity.applyQuaternion(invFilterQ); + this.estimatedGravity.normalize(); + this.measuredGravity.copy(this.currentAccelMeasurement.sample); + this.measuredGravity.normalize(); + var deltaQ = new Quaternion(); + deltaQ.setFromUnitVectors(this.estimatedGravity, this.measuredGravity); + deltaQ.inverse(); + if (this.isDebug) { + console.log('Delta: %d deg, G_est: (%s, %s, %s), G_meas: (%s, %s, %s)', radToDeg * getQuaternionAngle(deltaQ), this.estimatedGravity.x.toFixed(1), this.estimatedGravity.y.toFixed(1), this.estimatedGravity.z.toFixed(1), this.measuredGravity.x.toFixed(1), this.measuredGravity.y.toFixed(1), this.measuredGravity.z.toFixed(1)); + } + var targetQ = new Quaternion(); + targetQ.copy(this.filterQ); + targetQ.multiply(deltaQ); + this.filterQ.slerp(targetQ, 1 - this.kFilter); + this.previousFilterQ.copy(this.filterQ); +}; +ComplementaryFilter.prototype.getOrientation = function () { + return this.filterQ; +}; +ComplementaryFilter.prototype.accelToQuaternion_ = function (accel) { + var normAccel = new Vector3(); + normAccel.copy(accel); + normAccel.normalize(); + var quat = new Quaternion(); + quat.setFromUnitVectors(new Vector3(0, 0, -1), normAccel); + quat.inverse(); + return quat; +}; +ComplementaryFilter.prototype.gyroToQuaternionDelta_ = function (gyro, dt) { + var quat = new Quaternion(); + var axis = new Vector3(); + axis.copy(gyro); + axis.normalize(); + quat.setFromAxisAngle(axis, gyro.length() * dt); + return quat; +}; +function PosePredictor(predictionTimeS, isDebug) { + this.predictionTimeS = predictionTimeS; + this.isDebug = isDebug; + this.previousQ = new Quaternion(); + this.previousTimestampS = null; + this.deltaQ = new Quaternion(); + this.outQ = new Quaternion(); +} +PosePredictor.prototype.getPrediction = function (currentQ, gyro, timestampS) { + if (!this.previousTimestampS) { + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return currentQ; + } + var axis = new Vector3(); + axis.copy(gyro); + axis.normalize(); + var angularSpeed = gyro.length(); + if (angularSpeed < degToRad * 20) { + if (this.isDebug) { + console.log('Moving slowly, at %s deg/s: no prediction', (radToDeg * angularSpeed).toFixed(1)); + } + this.outQ.copy(currentQ); + this.previousQ.copy(currentQ); + return this.outQ; + } + var predictAngle = angularSpeed * this.predictionTimeS; + this.deltaQ.setFromAxisAngle(axis, predictAngle); + this.outQ.copy(this.previousQ); + this.outQ.multiply(this.deltaQ); + this.previousQ.copy(currentQ); + this.previousTimestampS = timestampS; + return this.outQ; +}; +function FusionPoseSensor(kFilter, predictionTime, yawOnly, isDebug) { + this.yawOnly = yawOnly; + this.accelerometer = new Vector3(); + this.gyroscope = new Vector3(); + this.filter = new ComplementaryFilter(kFilter, isDebug); + this.posePredictor = new PosePredictor(predictionTime, isDebug); + this.isFirefoxAndroid = isFirefoxAndroid(); + this.isIOS = isIOS(); + var chromeVersion = getChromeVersion(); + this.isDeviceMotionInRadians = !this.isIOS && chromeVersion && chromeVersion < 66; + this.isWithoutDeviceMotion = isChromeWithoutDeviceMotion(); + this.filterToWorldQ = new Quaternion(); + if (isIOS()) { + this.filterToWorldQ.setFromAxisAngle(new Vector3(1, 0, 0), Math.PI / 2); + } else { + this.filterToWorldQ.setFromAxisAngle(new Vector3(1, 0, 0), -Math.PI / 2); + } + this.inverseWorldToScreenQ = new Quaternion(); + this.worldToScreenQ = new Quaternion(); + this.originalPoseAdjustQ = new Quaternion(); + this.originalPoseAdjustQ.setFromAxisAngle(new Vector3(0, 0, 1), -window.orientation * Math.PI / 180); + this.setScreenTransform_(); + if (isLandscapeMode()) { + this.filterToWorldQ.multiply(this.inverseWorldToScreenQ); + } + this.resetQ = new Quaternion(); + this.orientationOut_ = new Float32Array(4); + this.start(); +} +FusionPoseSensor.prototype.getPosition = function () { + return null; +}; +FusionPoseSensor.prototype.getOrientation = function () { + var orientation = void 0; + if (this.isWithoutDeviceMotion && this._deviceOrientationQ) { + this.deviceOrientationFixQ = this.deviceOrientationFixQ || function () { + var z = new Quaternion().setFromAxisAngle(new Vector3(0, 0, -1), 0); + var y = new Quaternion(); + if (window.orientation === -90) { + y.setFromAxisAngle(new Vector3(0, 1, 0), Math.PI / -2); + } else { + y.setFromAxisAngle(new Vector3(0, 1, 0), Math.PI / 2); + } + return z.multiply(y); + }(); + this.deviceOrientationFilterToWorldQ = this.deviceOrientationFilterToWorldQ || function () { + var q = new Quaternion(); + q.setFromAxisAngle(new Vector3(1, 0, 0), -Math.PI / 2); + return q; + }(); + orientation = this._deviceOrientationQ; + var out = new Quaternion(); + out.copy(orientation); + out.multiply(this.deviceOrientationFilterToWorldQ); + out.multiply(this.resetQ); + out.multiply(this.worldToScreenQ); + out.multiplyQuaternions(this.deviceOrientationFixQ, out); + if (this.yawOnly) { + out.x = 0; + out.z = 0; + out.normalize(); + } + this.orientationOut_[0] = out.x; + this.orientationOut_[1] = out.y; + this.orientationOut_[2] = out.z; + this.orientationOut_[3] = out.w; + return this.orientationOut_; + } else { + var filterOrientation = this.filter.getOrientation(); + orientation = this.posePredictor.getPrediction(filterOrientation, this.gyroscope, this.previousTimestampS); + } + var out = new Quaternion(); + out.copy(this.filterToWorldQ); + out.multiply(this.resetQ); + out.multiply(orientation); + out.multiply(this.worldToScreenQ); + if (this.yawOnly) { + out.x = 0; + out.z = 0; + out.normalize(); + } + this.orientationOut_[0] = out.x; + this.orientationOut_[1] = out.y; + this.orientationOut_[2] = out.z; + this.orientationOut_[3] = out.w; + return this.orientationOut_; +}; +FusionPoseSensor.prototype.resetPose = function () { + this.resetQ.copy(this.filter.getOrientation()); + this.resetQ.x = 0; + this.resetQ.y = 0; + this.resetQ.z *= -1; + this.resetQ.normalize(); + if (isLandscapeMode()) { + this.resetQ.multiply(this.inverseWorldToScreenQ); + } + this.resetQ.multiply(this.originalPoseAdjustQ); +}; +FusionPoseSensor.prototype.onDeviceOrientation_ = function (e) { + this._deviceOrientationQ = this._deviceOrientationQ || new Quaternion(); + var alpha = e.alpha, + beta = e.beta, + gamma = e.gamma; + alpha = (alpha || 0) * Math.PI / 180; + beta = (beta || 0) * Math.PI / 180; + gamma = (gamma || 0) * Math.PI / 180; + this._deviceOrientationQ.setFromEulerYXZ(beta, alpha, -gamma); +}; +FusionPoseSensor.prototype.onDeviceMotion_ = function (deviceMotion) { + this.updateDeviceMotion_(deviceMotion); +}; +FusionPoseSensor.prototype.updateDeviceMotion_ = function (deviceMotion) { + var accGravity = deviceMotion.accelerationIncludingGravity; + var rotRate = deviceMotion.rotationRate; + var timestampS = deviceMotion.timeStamp / 1000; + var deltaS = timestampS - this.previousTimestampS; + if (deltaS < 0) { + warnOnce('fusion-pose-sensor:invalid:non-monotonic', 'Invalid timestamps detected: non-monotonic timestamp from devicemotion'); + this.previousTimestampS = timestampS; + return; + } else if (deltaS <= MIN_TIMESTEP || deltaS > MAX_TIMESTEP) { + warnOnce('fusion-pose-sensor:invalid:outside-threshold', 'Invalid timestamps detected: Timestamp from devicemotion outside expected range.'); + this.previousTimestampS = timestampS; + return; + } + this.accelerometer.set(-accGravity.x, -accGravity.y, -accGravity.z); + if (isR7()) { + this.gyroscope.set(-rotRate.beta, rotRate.alpha, rotRate.gamma); + } else { + this.gyroscope.set(rotRate.alpha, rotRate.beta, rotRate.gamma); + } + if (!this.isDeviceMotionInRadians) { + this.gyroscope.multiplyScalar(Math.PI / 180); + } + this.filter.addAccelMeasurement(this.accelerometer, timestampS); + this.filter.addGyroMeasurement(this.gyroscope, timestampS); + this.previousTimestampS = timestampS; +}; +FusionPoseSensor.prototype.onOrientationChange_ = function (screenOrientation) { + this.setScreenTransform_(); +}; +FusionPoseSensor.prototype.onMessage_ = function (event) { + var message = event.data; + if (!message || !message.type) { + return; + } + var type = message.type.toLowerCase(); + if (type !== 'devicemotion') { + return; + } + this.updateDeviceMotion_(message.deviceMotionEvent); +}; +FusionPoseSensor.prototype.setScreenTransform_ = function () { + this.worldToScreenQ.set(0, 0, 0, 1); + switch (window.orientation) { + case 0: + break; + case 90: + this.worldToScreenQ.setFromAxisAngle(new Vector3(0, 0, 1), -Math.PI / 2); + break; + case -90: + this.worldToScreenQ.setFromAxisAngle(new Vector3(0, 0, 1), Math.PI / 2); + break; + case 180: + break; + } + this.inverseWorldToScreenQ.copy(this.worldToScreenQ); + this.inverseWorldToScreenQ.inverse(); +}; +FusionPoseSensor.prototype.start = function () { + this.onDeviceMotionCallback_ = this.onDeviceMotion_.bind(this); + this.onOrientationChangeCallback_ = this.onOrientationChange_.bind(this); + this.onMessageCallback_ = this.onMessage_.bind(this); + this.onDeviceOrientationCallback_ = this.onDeviceOrientation_.bind(this); + if (isIOS() && isInsideCrossOriginIFrame()) { + window.addEventListener('message', this.onMessageCallback_); + } + window.addEventListener('orientationchange', this.onOrientationChangeCallback_); + if (this.isWithoutDeviceMotion) { + window.addEventListener('deviceorientation', this.onDeviceOrientationCallback_); + } else { + window.addEventListener('devicemotion', this.onDeviceMotionCallback_); + } +}; +FusionPoseSensor.prototype.stop = function () { + window.removeEventListener('devicemotion', this.onDeviceMotionCallback_); + window.removeEventListener('deviceorientation', this.onDeviceOrientationCallback_); + window.removeEventListener('orientationchange', this.onOrientationChangeCallback_); + window.removeEventListener('message', this.onMessageCallback_); +}; +var SENSOR_FREQUENCY = 60; +var X_AXIS = new Vector3(1, 0, 0); +var Z_AXIS = new Vector3(0, 0, 1); +var orientation = {}; +if (screen.orientation) { + orientation = screen.orientation; +} else if (screen.msOrientation) { + orientation = screen.msOrientation; +} else { + Object.defineProperty(orientation, 'angle', { + get: function get$$1() { + return window.orientation || 0; + } + }); +} +var SENSOR_TO_VR = new Quaternion(); +SENSOR_TO_VR.setFromAxisAngle(X_AXIS, -Math.PI / 2); +SENSOR_TO_VR.multiply(new Quaternion().setFromAxisAngle(Z_AXIS, Math.PI / 2)); +var PoseSensor = function () { + function PoseSensor(config) { + classCallCheck(this, PoseSensor); + this.config = config; + this.sensor = null; + this.fusionSensor = null; + this._out = new Float32Array(4); + this.api = null; + this.errors = []; + this._sensorQ = new Quaternion(); + this._worldToScreenQ = new Quaternion(); + this._outQ = new Quaternion(); + this._onSensorRead = this._onSensorRead.bind(this); + this._onSensorError = this._onSensorError.bind(this); + this._onOrientationChange = this._onOrientationChange.bind(this); + this._onOrientationChange(); + this.init(); + } + createClass(PoseSensor, [{ + key: 'init', + value: function init() { + var sensor = null; + try { + sensor = new RelativeOrientationSensor({ frequency: SENSOR_FREQUENCY }); + sensor.addEventListener('error', this._onSensorError); + } catch (error) { + this.errors.push(error); + if (error.name === 'SecurityError') { + console.error('Cannot construct sensors due to the Feature Policy'); + console.warn('Attempting to fall back using "devicemotion"; however this will ' + 'fail in the future without correct permissions.'); + this.useDeviceMotion(); + } else if (error.name === 'ReferenceError') { + this.useDeviceMotion(); + } else { + console.error(error); + } + } + if (sensor) { + this.api = 'sensor'; + this.sensor = sensor; + this.sensor.addEventListener('reading', this._onSensorRead); + this.sensor.start(); + } + window.addEventListener('orientationchange', this._onOrientationChange); + } + }, { + key: 'useDeviceMotion', + value: function useDeviceMotion() { + this.api = 'devicemotion'; + this.fusionSensor = new FusionPoseSensor(this.config.K_FILTER, this.config.PREDICTION_TIME_S, this.config.YAW_ONLY, this.config.DEBUG); + } + }, { + key: 'getOrientation', + value: function getOrientation() { + if (this.fusionSensor) { + return this.fusionSensor.getOrientation(); + } + if (!this.sensor || !this.sensor.quaternion) { + this._out[0] = this._out[1] = this._out[2] = 0; + this._out[3] = 1; + return this._out; + } + var q = this.sensor.quaternion; + this._sensorQ.set(q[0], q[1], q[2], q[3]); + var out = this._outQ; + out.copy(SENSOR_TO_VR); + out.multiply(this._sensorQ); + out.multiply(this._worldToScreenQ); + if (this.config.YAW_ONLY) { + out.x = out.z = 0; + out.normalize(); + } + this._out[0] = out.x; + this._out[1] = out.y; + this._out[2] = out.z; + this._out[3] = out.w; + return this._out; + } + }, { + key: '_onSensorError', + value: function _onSensorError(event) { + this.errors.push(event.error); + if (event.error.name === 'NotAllowedError') { + console.error('Permission to access sensor was denied'); + } else if (event.error.name === 'NotReadableError') { + console.error('Sensor could not be read'); + } else { + console.error(event.error); + } + } + }, { + key: '_onSensorRead', + value: function _onSensorRead() {} + }, { + key: '_onOrientationChange', + value: function _onOrientationChange() { + var angle = -orientation.angle * Math.PI / 180; + this._worldToScreenQ.setFromAxisAngle(Z_AXIS, angle); + } + }]); + return PoseSensor; +}(); +var rotateInstructionsAsset = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjE5OHB4IiBoZWlnaHQ9IjI0MHB4IiB2aWV3Qm94PSIwIDAgMTk4IDI0MCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWxuczpza2V0Y2g9Imh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaC9ucyI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDMuMy4zICgxMjA4MSkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+dHJhbnNpdGlvbjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHR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SBMMTAuMDgzLDkwLjM3NSBaIE0xMC4zMzMsNDYuNTY0IEwxMC4zMzMsODkuOTQ0IEw3Ny4xNTQsNTEuMzY1IEw3Ny4xNTQsNy45ODUgTDEwLjMzMyw0Ni41NjQgTDEwLjMzMyw0Ni41NjQgWiIgaWQ9IkZpbGwtMjAiIGZpbGw9IiM2MDdEOEIiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMjUuNzM3LDg4LjY0NyBMMTE4LjA5OCw5MS45ODEgTDExOC4wOTgsODQgTDEwNi42MzksODguNzEzIEwxMDYuNjM5LDk2Ljk4MiBMOTksMTAwLjMxNSBMMTEyLjM2OSwxMDMuOTYxIEwxMjUuNzM3LDg4LjY0NyIgaWQ9IkltcG9ydGVkLUxheWVycy1Db3B5LTIiIGZpbGw9IiM0NTVBNjQiIHNrZXRjaDp0eXBlPSJNU1NoYXBlR3JvdXAiPjwvcGF0aD4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+'; +function RotateInstructions() { + this.loadIcon_(); + var overlay = document.createElement('div'); + var s = overlay.style; + s.position = 'fixed'; + s.top = 0; + s.right = 0; + s.bottom = 0; + s.left = 0; + s.backgroundColor = 'gray'; + s.fontFamily = 'sans-serif'; + s.zIndex = 1000000; + var img = document.createElement('img'); + img.src = this.icon; + var s = img.style; + s.marginLeft = '25%'; + s.marginTop = '25%'; + s.width = '50%'; + overlay.appendChild(img); + var text = document.createElement('div'); + var s = text.style; + s.textAlign = 'center'; + s.fontSize = '16px'; + s.lineHeight = '24px'; + s.margin = '24px 25%'; + s.width = '50%'; + text.innerHTML = 'Place your phone into your Cardboard viewer.'; + overlay.appendChild(text); + var snackbar = document.createElement('div'); + var s = snackbar.style; + s.backgroundColor = '#CFD8DC'; + s.position = 'fixed'; + s.bottom = 0; + s.width = '100%'; + s.height = '48px'; + s.padding = '14px 24px'; + s.boxSizing = 'border-box'; + s.color = '#656A6B'; + overlay.appendChild(snackbar); + var snackbarText = document.createElement('div'); + snackbarText.style.float = 'left'; + snackbarText.innerHTML = 'No Cardboard viewer?'; + var snackbarButton = document.createElement('a'); + snackbarButton.href = 'https://www.google.com/get/cardboard/get-cardboard/'; + snackbarButton.innerHTML = 'get one'; + snackbarButton.target = '_blank'; + var s = snackbarButton.style; + s.float = 'right'; + s.fontWeight = 600; + s.textTransform = 'uppercase'; + s.borderLeft = '1px solid gray'; + s.paddingLeft = '24px'; + s.textDecoration = 'none'; + s.color = '#656A6B'; + snackbar.appendChild(snackbarText); + snackbar.appendChild(snackbarButton); + this.overlay = overlay; + this.text = text; + this.hide(); +} +RotateInstructions.prototype.show = function (parent) { + if (!parent && !this.overlay.parentElement) { + document.body.appendChild(this.overlay); + } else if (parent) { + if (this.overlay.parentElement && this.overlay.parentElement != parent) this.overlay.parentElement.removeChild(this.overlay); + parent.appendChild(this.overlay); + } + this.overlay.style.display = 'block'; + var img = this.overlay.querySelector('img'); + var s = img.style; + if (isLandscapeMode()) { + s.width = '20%'; + s.marginLeft = '40%'; + s.marginTop = '3%'; + } else { + s.width = '50%'; + s.marginLeft = '25%'; + s.marginTop = '25%'; + } +}; +RotateInstructions.prototype.hide = function () { + this.overlay.style.display = 'none'; +}; +RotateInstructions.prototype.showTemporarily = function (ms, parent) { + this.show(parent); + this.timer = setTimeout(this.hide.bind(this), ms); +}; +RotateInstructions.prototype.disableShowTemporarily = function () { + clearTimeout(this.timer); +}; +RotateInstructions.prototype.update = function () { + this.disableShowTemporarily(); + if (!isLandscapeMode() && isMobile()) { + this.show(); + } else { + this.hide(); + } +}; +RotateInstructions.prototype.loadIcon_ = function () { + this.icon = base64('image/svg+xml', rotateInstructionsAsset); +}; +var DEFAULT_VIEWER = 'CardboardV1'; +var VIEWER_KEY = 'WEBVR_CARDBOARD_VIEWER'; +var CLASS_NAME = 'webvr-polyfill-viewer-selector'; +function ViewerSelector() { + try { + this.selectedKey = localStorage.getItem(VIEWER_KEY); + } catch (error) { + console.error('Failed to load viewer profile: %s', error); + } + if (!this.selectedKey) { + this.selectedKey = DEFAULT_VIEWER; + } + this.dialog = this.createDialog_(DeviceInfo.Viewers); + this.root = null; + this.onChangeCallbacks_ = []; +} +ViewerSelector.prototype.show = function (root) { + this.root = root; + root.appendChild(this.dialog); + var selected = this.dialog.querySelector('#' + this.selectedKey); + selected.checked = true; + this.dialog.style.display = 'block'; +}; +ViewerSelector.prototype.hide = function () { + if (this.root && this.root.contains(this.dialog)) { + this.root.removeChild(this.dialog); + } + this.dialog.style.display = 'none'; +}; +ViewerSelector.prototype.getCurrentViewer = function () { + return DeviceInfo.Viewers[this.selectedKey]; +}; +ViewerSelector.prototype.getSelectedKey_ = function () { + var input = this.dialog.querySelector('input[name=field]:checked'); + if (input) { + return input.id; + } + return null; +}; +ViewerSelector.prototype.onChange = function (cb) { + this.onChangeCallbacks_.push(cb); +}; +ViewerSelector.prototype.fireOnChange_ = function (viewer) { + for (var i = 0; i < this.onChangeCallbacks_.length; i++) { + this.onChangeCallbacks_[i](viewer); + } +}; +ViewerSelector.prototype.onSave_ = function () { + this.selectedKey = this.getSelectedKey_(); + if (!this.selectedKey || !DeviceInfo.Viewers[this.selectedKey]) { + console.error('ViewerSelector.onSave_: this should never happen!'); + return; + } + this.fireOnChange_(DeviceInfo.Viewers[this.selectedKey]); + try { + localStorage.setItem(VIEWER_KEY, this.selectedKey); + } catch (error) { + console.error('Failed to save viewer profile: %s', error); + } + this.hide(); +}; +ViewerSelector.prototype.createDialog_ = function (options) { + var container = document.createElement('div'); + container.classList.add(CLASS_NAME); + container.style.display = 'none'; + var overlay = document.createElement('div'); + var s = overlay.style; + s.position = 'fixed'; + s.left = 0; + s.top = 0; + s.width = '100%'; + s.height = '100%'; + s.background = 'rgba(0, 0, 0, 0.3)'; + overlay.addEventListener('click', this.hide.bind(this)); + var width = 280; + var dialog = document.createElement('div'); + var s = dialog.style; + s.boxSizing = 'border-box'; + s.position = 'fixed'; + s.top = '24px'; + s.left = '50%'; + s.marginLeft = -width / 2 + 'px'; + s.width = width + 'px'; + s.padding = '24px'; + s.overflow = 'hidden'; + s.background = '#fafafa'; + s.fontFamily = "'Roboto', sans-serif"; + s.boxShadow = '0px 5px 20px #666'; + dialog.appendChild(this.createH1_('Select your viewer')); + for (var id in options) { + dialog.appendChild(this.createChoice_(id, options[id].label)); + } + dialog.appendChild(this.createButton_('Save', this.onSave_.bind(this))); + container.appendChild(overlay); + container.appendChild(dialog); + return container; +}; +ViewerSelector.prototype.createH1_ = function (name) { + var h1 = document.createElement('h1'); + var s = h1.style; + s.color = 'black'; + s.fontSize = '20px'; + s.fontWeight = 'bold'; + s.marginTop = 0; + s.marginBottom = '24px'; + h1.innerHTML = name; + return h1; +}; +ViewerSelector.prototype.createChoice_ = function (id, name) { + var div = document.createElement('div'); + div.style.marginTop = '8px'; + div.style.color = 'black'; + var input = document.createElement('input'); + input.style.fontSize = '30px'; + input.setAttribute('id', id); + input.setAttribute('type', 'radio'); + input.setAttribute('value', id); + input.setAttribute('name', 'field'); + var label = document.createElement('label'); + label.style.marginLeft = '4px'; + label.setAttribute('for', id); + label.innerHTML = name; + div.appendChild(input); + div.appendChild(label); + return div; +}; +ViewerSelector.prototype.createButton_ = function (label, onclick) { + var button = document.createElement('button'); + button.innerHTML = label; + var s = button.style; + s.float = 'right'; + s.textTransform = 'uppercase'; + s.color = '#1094f7'; + s.fontSize = '14px'; + s.letterSpacing = 0; + s.border = 0; + s.background = 'none'; + s.marginTop = '16px'; + button.addEventListener('click', onclick); + return button; +}; +var commonjsGlobal$$1 = typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof self !== 'undefined' ? self : {}; +function unwrapExports$$1 (x) { + return x && x.__esModule ? x['default'] : x; +} +function createCommonjsModule$$1(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} +var NoSleep = createCommonjsModule$$1(function (module, exports) { +(function webpackUniversalModuleDefinition(root, factory) { + module.exports = factory(); +})(commonjsGlobal$$1, function() { +return (function(modules) { + var installedModules = {}; + function __webpack_require__(moduleId) { + if(installedModules[moduleId]) { + return installedModules[moduleId].exports; + } + var module = installedModules[moduleId] = { + i: moduleId, + l: false, + exports: {} + }; + modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + module.l = true; + return module.exports; + } + __webpack_require__.m = modules; + __webpack_require__.c = installedModules; + __webpack_require__.d = function(exports, name, getter) { + if(!__webpack_require__.o(exports, name)) { + Object.defineProperty(exports, name, { + configurable: false, + enumerable: true, + get: getter + }); + } + }; + __webpack_require__.n = function(module) { + var getter = module && module.__esModule ? + function getDefault() { return module['default']; } : + function getModuleExports() { return module; }; + __webpack_require__.d(getter, 'a', getter); + return getter; + }; + __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; + __webpack_require__.p = ""; + return __webpack_require__(__webpack_require__.s = 0); + }) + ([ + (function(module, exports, __webpack_require__) { +var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +var mediaFile = __webpack_require__(1); +var oldIOS = typeof navigator !== 'undefined' && parseFloat(('' + (/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0, ''])[1]).replace('undefined', '3_2').replace('_', '.').replace('_', '')) < 10 && !window.MSStream; +var NoSleep = function () { + function NoSleep() { + _classCallCheck(this, NoSleep); + if (oldIOS) { + this.noSleepTimer = null; + } else { + this.noSleepVideo = document.createElement('video'); + this.noSleepVideo.setAttribute('playsinline', ''); + this.noSleepVideo.setAttribute('src', mediaFile); + this.noSleepVideo.addEventListener('timeupdate', function (e) { + if (this.noSleepVideo.currentTime > 0.5) { + this.noSleepVideo.currentTime = Math.random(); + } + }.bind(this)); + } + } + _createClass(NoSleep, [{ + key: 'enable', + value: function enable() { + if (oldIOS) { + this.disable(); + this.noSleepTimer = window.setInterval(function () { + window.location.href = '/'; + window.setTimeout(window.stop, 0); + }, 15000); + } else { + this.noSleepVideo.play(); + } + } + }, { + key: 'disable', + value: function disable() { + if (oldIOS) { + if (this.noSleepTimer) { + window.clearInterval(this.noSleepTimer); + this.noSleepTimer = null; + } + } else { + this.noSleepVideo.pause(); + } + } + }]); + return NoSleep; +}(); +module.exports = NoSleep; + }), + (function(module, exports, __webpack_require__) { +module.exports = 'data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHV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AAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA='; + }) + ]); +}); +}); +var NoSleep$1 = unwrapExports$$1(NoSleep); +var nextDisplayId = 1000; +var defaultLeftBounds = [0, 0, 0.5, 1]; +var defaultRightBounds = [0.5, 0, 0.5, 1]; +var raf = window.requestAnimationFrame; +var caf = window.cancelAnimationFrame; +function VRFrameData() { + this.leftProjectionMatrix = new Float32Array(16); + this.leftViewMatrix = new Float32Array(16); + this.rightProjectionMatrix = new Float32Array(16); + this.rightViewMatrix = new Float32Array(16); + this.pose = null; +} +function VRDisplayCapabilities(config) { + Object.defineProperties(this, { + hasPosition: { + writable: false, enumerable: true, value: config.hasPosition + }, + hasExternalDisplay: { + writable: false, enumerable: true, value: config.hasExternalDisplay + }, + canPresent: { + writable: false, enumerable: true, value: config.canPresent + }, + maxLayers: { + writable: false, enumerable: true, value: config.maxLayers + }, + hasOrientation: { + enumerable: true, get: function get() { + deprecateWarning('VRDisplayCapabilities.prototype.hasOrientation', 'VRDisplay.prototype.getFrameData'); + return config.hasOrientation; + } + } + }); +} +function VRDisplay(config) { + config = config || {}; + var USE_WAKELOCK = 'wakelock' in config ? config.wakelock : true; + this.isPolyfilled = true; + this.displayId = nextDisplayId++; + this.displayName = ''; + this.depthNear = 0.01; + this.depthFar = 10000.0; + this.isPresenting = false; + Object.defineProperty(this, 'isConnected', { + get: function get() { + deprecateWarning('VRDisplay.prototype.isConnected', 'VRDisplayCapabilities.prototype.hasExternalDisplay'); + return false; + } + }); + this.capabilities = new VRDisplayCapabilities({ + hasPosition: false, + hasOrientation: false, + hasExternalDisplay: false, + canPresent: false, + maxLayers: 1 + }); + this.stageParameters = null; + this.waitingForPresent_ = false; + this.layer_ = null; + this.originalParent_ = null; + this.fullscreenElement_ = null; + this.fullscreenWrapper_ = null; + this.fullscreenElementCachedStyle_ = null; + this.fullscreenEventTarget_ = null; + this.fullscreenChangeHandler_ = null; + this.fullscreenErrorHandler_ = null; + if (USE_WAKELOCK && isMobile()) { + this.wakelock_ = new NoSleep$1(); + } +} +VRDisplay.prototype.getFrameData = function (frameData) { + return frameDataFromPose(frameData, this._getPose(), this); +}; +VRDisplay.prototype.getPose = function () { + deprecateWarning('VRDisplay.prototype.getPose', 'VRDisplay.prototype.getFrameData'); + return this._getPose(); +}; +VRDisplay.prototype.resetPose = function () { + deprecateWarning('VRDisplay.prototype.resetPose'); + return this._resetPose(); +}; +VRDisplay.prototype.getImmediatePose = function () { + deprecateWarning('VRDisplay.prototype.getImmediatePose', 'VRDisplay.prototype.getFrameData'); + return this._getPose(); +}; +VRDisplay.prototype.requestAnimationFrame = function (callback) { + return raf(callback); +}; +VRDisplay.prototype.cancelAnimationFrame = function (id) { + return caf(id); +}; +VRDisplay.prototype.wrapForFullscreen = function (element) { + if (isIOS()) { + return element; + } + if (!this.fullscreenWrapper_) { + this.fullscreenWrapper_ = document.createElement('div'); + var cssProperties = ['height: ' + Math.min(screen.height, screen.width) + 'px !important', 'top: 0 !important', 'left: 0 !important', 'right: 0 !important', 'border: 0', 'margin: 0', 'padding: 0', 'z-index: 999999 !important', 'position: fixed']; + this.fullscreenWrapper_.setAttribute('style', cssProperties.join('; ') + ';'); + this.fullscreenWrapper_.classList.add('webvr-polyfill-fullscreen-wrapper'); + } + if (this.fullscreenElement_ == element) { + return this.fullscreenWrapper_; + } + if (this.fullscreenElement_) { + if (this.originalParent_) { + this.originalParent_.appendChild(this.fullscreenElement_); + } else { + this.fullscreenElement_.parentElement.removeChild(this.fullscreenElement_); + } + } + this.fullscreenElement_ = element; + this.originalParent_ = element.parentElement; + if (!this.originalParent_) { + document.body.appendChild(element); + } + if (!this.fullscreenWrapper_.parentElement) { + var parent = this.fullscreenElement_.parentElement; + parent.insertBefore(this.fullscreenWrapper_, this.fullscreenElement_); + parent.removeChild(this.fullscreenElement_); + } + this.fullscreenWrapper_.insertBefore(this.fullscreenElement_, this.fullscreenWrapper_.firstChild); + this.fullscreenElementCachedStyle_ = this.fullscreenElement_.getAttribute('style'); + var self = this; + function applyFullscreenElementStyle() { + if (!self.fullscreenElement_) { + return; + } + var cssProperties = ['position: absolute', 'top: 0', 'left: 0', 'width: ' + Math.max(screen.width, screen.height) + 'px', 'height: ' + Math.min(screen.height, screen.width) + 'px', 'border: 0', 'margin: 0', 'padding: 0']; + self.fullscreenElement_.setAttribute('style', cssProperties.join('; ') + ';'); + } + applyFullscreenElementStyle(); + return this.fullscreenWrapper_; +}; +VRDisplay.prototype.removeFullscreenWrapper = function () { + if (!this.fullscreenElement_) { + return; + } + var element = this.fullscreenElement_; + if (this.fullscreenElementCachedStyle_) { + element.setAttribute('style', this.fullscreenElementCachedStyle_); + } else { + element.removeAttribute('style'); + } + this.fullscreenElement_ = null; + this.fullscreenElementCachedStyle_ = null; + var parent = this.fullscreenWrapper_.parentElement; + this.fullscreenWrapper_.removeChild(element); + if (this.originalParent_ === parent) { + parent.insertBefore(element, this.fullscreenWrapper_); + } + else if (this.originalParent_) { + this.originalParent_.appendChild(element); + } + parent.removeChild(this.fullscreenWrapper_); + return element; +}; +VRDisplay.prototype.requestPresent = function (layers) { + var wasPresenting = this.isPresenting; + var self = this; + if (!(layers instanceof Array)) { + deprecateWarning('VRDisplay.prototype.requestPresent with non-array argument', 'an array of VRLayers as the first argument'); + layers = [layers]; + } + return new Promise(function (resolve, reject) { + if (!self.capabilities.canPresent) { + reject(new Error('VRDisplay is not capable of presenting.')); + return; + } + if (layers.length == 0 || layers.length > self.capabilities.maxLayers) { + reject(new Error('Invalid number of layers.')); + return; + } + var incomingLayer = layers[0]; + if (!incomingLayer.source) { + resolve(); + return; + } + var leftBounds = incomingLayer.leftBounds || defaultLeftBounds; + var rightBounds = incomingLayer.rightBounds || defaultRightBounds; + if (wasPresenting) { + var layer = self.layer_; + if (layer.source !== incomingLayer.source) { + layer.source = incomingLayer.source; + } + for (var i = 0; i < 4; i++) { + layer.leftBounds[i] = leftBounds[i]; + layer.rightBounds[i] = rightBounds[i]; + } + self.wrapForFullscreen(self.layer_.source); + self.updatePresent_(); + resolve(); + return; + } + self.layer_ = { + predistorted: incomingLayer.predistorted, + source: incomingLayer.source, + leftBounds: leftBounds.slice(0), + rightBounds: rightBounds.slice(0) + }; + self.waitingForPresent_ = false; + if (self.layer_ && self.layer_.source) { + var fullscreenElement = self.wrapForFullscreen(self.layer_.source); + var onFullscreenChange = function onFullscreenChange() { + var actualFullscreenElement = getFullscreenElement(); + self.isPresenting = fullscreenElement === actualFullscreenElement; + if (self.isPresenting) { + if (screen.orientation && screen.orientation.lock) { + screen.orientation.lock('landscape-primary').catch(function (error) { + console.error('screen.orientation.lock() failed due to', error.message); + }); + } + self.waitingForPresent_ = false; + self.beginPresent_(); + resolve(); + } else { + if (screen.orientation && screen.orientation.unlock) { + screen.orientation.unlock(); + } + self.removeFullscreenWrapper(); + self.disableWakeLock(); + self.endPresent_(); + self.removeFullscreenListeners_(); + } + self.fireVRDisplayPresentChange_(); + }; + var onFullscreenError = function onFullscreenError() { + if (!self.waitingForPresent_) { + return; + } + self.removeFullscreenWrapper(); + self.removeFullscreenListeners_(); + self.disableWakeLock(); + self.waitingForPresent_ = false; + self.isPresenting = false; + reject(new Error('Unable to present.')); + }; + self.addFullscreenListeners_(fullscreenElement, onFullscreenChange, onFullscreenError); + if (requestFullscreen(fullscreenElement)) { + self.enableWakeLock(); + self.waitingForPresent_ = true; + } else if (isIOS() || isWebViewAndroid()) { + self.enableWakeLock(); + self.isPresenting = true; + self.beginPresent_(); + self.fireVRDisplayPresentChange_(); + resolve(); + } + } + if (!self.waitingForPresent_ && !isIOS()) { + exitFullscreen(); + reject(new Error('Unable to present.')); + } + }); +}; +VRDisplay.prototype.exitPresent = function () { + var wasPresenting = this.isPresenting; + var self = this; + this.isPresenting = false; + this.layer_ = null; + this.disableWakeLock(); + return new Promise(function (resolve, reject) { + if (wasPresenting) { + if (!exitFullscreen() && isIOS()) { + self.endPresent_(); + self.fireVRDisplayPresentChange_(); + } + if (isWebViewAndroid()) { + self.removeFullscreenWrapper(); + self.removeFullscreenListeners_(); + self.endPresent_(); + self.fireVRDisplayPresentChange_(); + } + resolve(); + } else { + reject(new Error('Was not presenting to VRDisplay.')); + } + }); +}; +VRDisplay.prototype.getLayers = function () { + if (this.layer_) { + return [this.layer_]; + } + return []; +}; +VRDisplay.prototype.fireVRDisplayPresentChange_ = function () { + var event = new CustomEvent('vrdisplaypresentchange', { detail: { display: this } }); + window.dispatchEvent(event); +}; +VRDisplay.prototype.fireVRDisplayConnect_ = function () { + var event = new CustomEvent('vrdisplayconnect', { detail: { display: this } }); + window.dispatchEvent(event); +}; +VRDisplay.prototype.addFullscreenListeners_ = function (element, changeHandler, errorHandler) { + this.removeFullscreenListeners_(); + this.fullscreenEventTarget_ = element; + this.fullscreenChangeHandler_ = changeHandler; + this.fullscreenErrorHandler_ = errorHandler; + if (changeHandler) { + if (document.fullscreenEnabled) { + element.addEventListener('fullscreenchange', changeHandler, false); + } else if (document.webkitFullscreenEnabled) { + element.addEventListener('webkitfullscreenchange', changeHandler, false); + } else if (document.mozFullScreenEnabled) { + document.addEventListener('mozfullscreenchange', changeHandler, false); + } else if (document.msFullscreenEnabled) { + element.addEventListener('msfullscreenchange', changeHandler, false); + } + } + if (errorHandler) { + if (document.fullscreenEnabled) { + element.addEventListener('fullscreenerror', errorHandler, false); + } else if (document.webkitFullscreenEnabled) { + element.addEventListener('webkitfullscreenerror', errorHandler, false); + } else if (document.mozFullScreenEnabled) { + document.addEventListener('mozfullscreenerror', errorHandler, false); + } else if (document.msFullscreenEnabled) { + element.addEventListener('msfullscreenerror', errorHandler, false); + } + } +}; +VRDisplay.prototype.removeFullscreenListeners_ = function () { + if (!this.fullscreenEventTarget_) return; + var element = this.fullscreenEventTarget_; + if (this.fullscreenChangeHandler_) { + var changeHandler = this.fullscreenChangeHandler_; + element.removeEventListener('fullscreenchange', changeHandler, false); + element.removeEventListener('webkitfullscreenchange', changeHandler, false); + document.removeEventListener('mozfullscreenchange', changeHandler, false); + element.removeEventListener('msfullscreenchange', changeHandler, false); + } + if (this.fullscreenErrorHandler_) { + var errorHandler = this.fullscreenErrorHandler_; + element.removeEventListener('fullscreenerror', errorHandler, false); + element.removeEventListener('webkitfullscreenerror', errorHandler, false); + document.removeEventListener('mozfullscreenerror', errorHandler, false); + element.removeEventListener('msfullscreenerror', errorHandler, false); + } + this.fullscreenEventTarget_ = null; + this.fullscreenChangeHandler_ = null; + this.fullscreenErrorHandler_ = null; +}; +VRDisplay.prototype.enableWakeLock = function () { + if (this.wakelock_) { + this.wakelock_.enable(); + } +}; +VRDisplay.prototype.disableWakeLock = function () { + if (this.wakelock_) { + this.wakelock_.disable(); + } +}; +VRDisplay.prototype.beginPresent_ = function () { +}; +VRDisplay.prototype.endPresent_ = function () { +}; +VRDisplay.prototype.submitFrame = function (pose) { +}; +VRDisplay.prototype.getEyeParameters = function (whichEye) { + return null; +}; +var config = { + MOBILE_WAKE_LOCK: true, + DEBUG: false, + DPDB_URL: 'https://dpdb.webvr.rocks/dpdb.json', + K_FILTER: 0.98, + PREDICTION_TIME_S: 0.040, + CARDBOARD_UI_DISABLED: false, + ROTATE_INSTRUCTIONS_DISABLED: false, + YAW_ONLY: false, + BUFFER_SCALE: 0.5, + DIRTY_SUBMIT_FRAME_BINDINGS: false +}; +var Eye = { + LEFT: 'left', + RIGHT: 'right' +}; +function CardboardVRDisplay(config$$1) { + var defaults = extend({}, config); + config$$1 = extend(defaults, config$$1 || {}); + VRDisplay.call(this, { + wakelock: config$$1.MOBILE_WAKE_LOCK + }); + this.config = config$$1; + this.displayName = 'Cardboard VRDisplay'; + this.capabilities = new VRDisplayCapabilities({ + hasPosition: false, + hasOrientation: true, + hasExternalDisplay: false, + canPresent: true, + maxLayers: 1 + }); + this.stageParameters = null; + this.bufferScale_ = this.config.BUFFER_SCALE; + this.poseSensor_ = new PoseSensor(this.config); + this.distorter_ = null; + this.cardboardUI_ = null; + this.dpdb_ = new Dpdb(this.config.DPDB_URL, this.onDeviceParamsUpdated_.bind(this)); + this.deviceInfo_ = new DeviceInfo(this.dpdb_.getDeviceParams()); + this.viewerSelector_ = new ViewerSelector(); + this.viewerSelector_.onChange(this.onViewerChanged_.bind(this)); + this.deviceInfo_.setViewer(this.viewerSelector_.getCurrentViewer()); + if (!this.config.ROTATE_INSTRUCTIONS_DISABLED) { + this.rotateInstructions_ = new RotateInstructions(); + } + if (isIOS()) { + window.addEventListener('resize', this.onResize_.bind(this)); + } +} +CardboardVRDisplay.prototype = Object.create(VRDisplay.prototype); +CardboardVRDisplay.prototype._getPose = function () { + return { + position: null, + orientation: this.poseSensor_.getOrientation(), + linearVelocity: null, + linearAcceleration: null, + angularVelocity: null, + angularAcceleration: null + }; +}; +CardboardVRDisplay.prototype._resetPose = function () { + if (this.poseSensor_.resetPose) { + this.poseSensor_.resetPose(); + } +}; +CardboardVRDisplay.prototype._getFieldOfView = function (whichEye) { + var fieldOfView; + if (whichEye == Eye.LEFT) { + fieldOfView = this.deviceInfo_.getFieldOfViewLeftEye(); + } else if (whichEye == Eye.RIGHT) { + fieldOfView = this.deviceInfo_.getFieldOfViewRightEye(); + } else { + console.error('Invalid eye provided: %s', whichEye); + return null; + } + return fieldOfView; +}; +CardboardVRDisplay.prototype._getEyeOffset = function (whichEye) { + var offset; + if (whichEye == Eye.LEFT) { + offset = [this.deviceInfo_.viewer.interLensDistance * 0.5, 0.0, 0.0]; + } else if (whichEye == Eye.RIGHT) { + offset = [-this.deviceInfo_.viewer.interLensDistance * 0.5, 0.0, 0.0]; + } else { + console.error('Invalid eye provided: %s', whichEye); + return null; + } + return offset; +}; +CardboardVRDisplay.prototype.getEyeParameters = function (whichEye) { + var offset = this._getEyeOffset(whichEye); + var fieldOfView = this._getFieldOfView(whichEye); + var eyeParams = { + offset: offset, + renderWidth: this.deviceInfo_.device.width * 0.5 * this.bufferScale_, + renderHeight: this.deviceInfo_.device.height * this.bufferScale_ + }; + Object.defineProperty(eyeParams, 'fieldOfView', { + enumerable: true, + get: function get() { + deprecateWarning('VRFieldOfView', 'VRFrameData\'s projection matrices'); + return fieldOfView; + } + }); + return eyeParams; +}; +CardboardVRDisplay.prototype.onDeviceParamsUpdated_ = function (newParams) { + if (this.config.DEBUG) { + console.log('DPDB reported that device params were updated.'); + } + this.deviceInfo_.updateDeviceParams(newParams); + if (this.distorter_) { + this.distorter_.updateDeviceInfo(this.deviceInfo_); + } +}; +CardboardVRDisplay.prototype.updateBounds_ = function () { + if (this.layer_ && this.distorter_ && (this.layer_.leftBounds || this.layer_.rightBounds)) { + this.distorter_.setTextureBounds(this.layer_.leftBounds, this.layer_.rightBounds); + } +}; +CardboardVRDisplay.prototype.beginPresent_ = function () { + var gl = this.layer_.source.getContext('webgl'); + if (!gl) gl = this.layer_.source.getContext('experimental-webgl'); + if (!gl) gl = this.layer_.source.getContext('webgl2'); + if (!gl) return; + if (this.layer_.predistorted) { + if (!this.config.CARDBOARD_UI_DISABLED) { + gl.canvas.width = getScreenWidth() * this.bufferScale_; + gl.canvas.height = getScreenHeight() * this.bufferScale_; + this.cardboardUI_ = new CardboardUI(gl); + } + } else { + if (!this.config.CARDBOARD_UI_DISABLED) { + this.cardboardUI_ = new CardboardUI(gl); + } + this.distorter_ = new CardboardDistorter(gl, this.cardboardUI_, this.config.BUFFER_SCALE, this.config.DIRTY_SUBMIT_FRAME_BINDINGS); + this.distorter_.updateDeviceInfo(this.deviceInfo_); + } + if (this.cardboardUI_) { + this.cardboardUI_.listen(function (e) { + this.viewerSelector_.show(this.layer_.source.parentElement); + e.stopPropagation(); + e.preventDefault(); + }.bind(this), function (e) { + this.exitPresent(); + e.stopPropagation(); + e.preventDefault(); + }.bind(this)); + } + if (this.rotateInstructions_) { + if (isLandscapeMode() && isMobile()) { + this.rotateInstructions_.showTemporarily(3000, this.layer_.source.parentElement); + } else { + this.rotateInstructions_.update(); + } + } + this.orientationHandler = this.onOrientationChange_.bind(this); + window.addEventListener('orientationchange', this.orientationHandler); + this.vrdisplaypresentchangeHandler = this.updateBounds_.bind(this); + window.addEventListener('vrdisplaypresentchange', this.vrdisplaypresentchangeHandler); + this.fireVRDisplayDeviceParamsChange_(); +}; +CardboardVRDisplay.prototype.endPresent_ = function () { + if (this.distorter_) { + this.distorter_.destroy(); + this.distorter_ = null; + } + if (this.cardboardUI_) { + this.cardboardUI_.destroy(); + this.cardboardUI_ = null; + } + if (this.rotateInstructions_) { + this.rotateInstructions_.hide(); + } + this.viewerSelector_.hide(); + window.removeEventListener('orientationchange', this.orientationHandler); + window.removeEventListener('vrdisplaypresentchange', this.vrdisplaypresentchangeHandler); +}; +CardboardVRDisplay.prototype.updatePresent_ = function () { + this.endPresent_(); + this.beginPresent_(); +}; +CardboardVRDisplay.prototype.submitFrame = function (pose) { + if (this.distorter_) { + this.updateBounds_(); + this.distorter_.submitFrame(); + } else if (this.cardboardUI_ && this.layer_) { + var canvas = this.layer_.source.getContext('webgl').canvas; + if (canvas.width != this.lastWidth || canvas.height != this.lastHeight) { + this.cardboardUI_.onResize(); + } + this.lastWidth = canvas.width; + this.lastHeight = canvas.height; + this.cardboardUI_.render(); + } +}; +CardboardVRDisplay.prototype.onOrientationChange_ = function (e) { + this.viewerSelector_.hide(); + if (this.rotateInstructions_) { + this.rotateInstructions_.update(); + } + this.onResize_(); +}; +CardboardVRDisplay.prototype.onResize_ = function (e) { + if (this.layer_) { + var gl = this.layer_.source.getContext('webgl'); + var cssProperties = ['position: absolute', 'top: 0', 'left: 0', + 'width: 100vw', 'height: 100vh', 'border: 0', 'margin: 0', + 'padding: 0px', 'box-sizing: content-box']; + gl.canvas.setAttribute('style', cssProperties.join('; ') + ';'); + safariCssSizeWorkaround(gl.canvas); + } +}; +CardboardVRDisplay.prototype.onViewerChanged_ = function (viewer) { + this.deviceInfo_.setViewer(viewer); + if (this.distorter_) { + this.distorter_.updateDeviceInfo(this.deviceInfo_); + } + this.fireVRDisplayDeviceParamsChange_(); +}; +CardboardVRDisplay.prototype.fireVRDisplayDeviceParamsChange_ = function () { + var event = new CustomEvent('vrdisplaydeviceparamschange', { + detail: { + vrdisplay: this, + deviceInfo: this.deviceInfo_ + } + }); + window.dispatchEvent(event); +}; +CardboardVRDisplay.VRFrameData = VRFrameData; +CardboardVRDisplay.VRDisplay = VRDisplay; +return CardboardVRDisplay; +}))); +}); +var CardboardVRDisplay = unwrapExports(cardboardVrDisplay); + +class PolyfilledXRDevice extends EventTarget { + constructor(global) { + super(); + this.global = global; + this.onWindowResize = this.onWindowResize.bind(this); + this.global.window.addEventListener('resize', this.onWindowResize); + } + get depthNear() { throw new Error('Not implemented'); } + set depthNear(val) { throw new Error('Not implemented'); } + get depthFar() { throw new Error('Not implemented'); } + set depthFar(val) { throw new Error('Not implemented'); } + onBaseLayerSet(sessionId, layer) { throw new Error('Not implemented'); } + supportsSession(options={}) { throw new Error('Not implemented'); } + async requestSession(options={}) { throw new Error('Not implemented'); } + requestAnimationFrame(callback) { throw new Error('Not implemented'); } + onFrameStart() { throw new Error('Not implemented'); } + onFrameEnd(sessionId) { throw new Error('Not implemented'); } + requestStageBounds() { throw new Error('Not implemented'); } + async requestFrameOfReferenceTransform(type, options) { + return undefined; + } + cancelAnimationFrame(handle) { throw new Error('Not implemented'); } + endSession(sessionId) { throw new Error('Not implemented'); } + getViewport(sessionId, eye, layer, target) { throw new Error('Not implemented'); } + getProjectionMatrix(eye) { throw new Error('Not implemented'); } + getBasePoseMatrix() { throw new Error('Not implemented'); } + getBaseViewMatrix(eye) { throw new Error('Not implemented'); } + onWindowResize() { + this.onWindowResize(); + } +} + +let SESSION_ID = 0; +class Session { + constructor(sessionOptions) { + this.outputContext = sessionOptions.outputContext; + this.exclusive = sessionOptions.exclusive; + this.ended = null; + this.baseLayer = null; + this.id = ++SESSION_ID; + this.modifiedCanvasLayer = false; + } +} +class WebVRDevice extends PolyfilledXRDevice { + constructor(global, display) { + const { canPresent } = display.capabilities; + super(global); + this.display = display; + this.frame = new global.VRFrameData(); + this.sessions = new Map(); + this.canPresent = canPresent; + this.baseModelMatrix = mat4_identity(new Float32Array(16)); + this.tempVec3 = new Float32Array(3); + this.onVRDisplayPresentChange = this.onVRDisplayPresentChange.bind(this); + global.window.addEventListener('vrdisplaypresentchange', this.onVRDisplayPresentChange); + } + get depthNear() { return this.display.depthNear; } + set depthNear(val) { this.display.depthNear = val; } + get depthFar() { return this.display.depthFar; } + set depthFar(val) { this.display.depthFar = val; } + onBaseLayerSet(sessionId, layer) { + const session = this.sessions.get(sessionId); + const canvas = layer.context.canvas; + if (session.exclusive) { + const left = this.display.getEyeParameters('left'); + const right = this.display.getEyeParameters('right'); + canvas.width = Math.max(left.renderWidth, right.renderWidth) * 2; + canvas.height = Math.max(left.renderHeight, right.renderHeight); + this.display.requestPresent([{ source: canvas }]).then(() => { + if ("production" !== 'test' && + !this.global.document.body.contains(canvas)) { + session.modifiedCanvasLayer = true; + this.global.document.body.appendChild(canvas); + applyCanvasStylesForMinimalRendering(canvas); + } + session.baseLayer = layer; + }); + } + else if (session.outputContext) { + session.baseLayer = layer; + } + } + supportsSession(options={}) { + if (options.exclusive === true && this.canPresent === false) { + return false; + } + return true; + } + async requestSession(options={}) { + if (!this.supportsSession(options)) { + return Promise.reject(); + } + if (options.exclusive) { + const canvas = this.global.document.createElement('canvas'); + { + const ctx = canvas.getContext('webgl'); + } + await this.display.requestPresent([{ source: canvas }]); + } + const session = new Session(options); + this.sessions.set(session.id, session); + if (options.exclusive) { + this.dispatchEvent('@@webxr-polyfill/vr-present-start', session.id); + } + return Promise.resolve(session.id); + } + requestAnimationFrame(callback) { + return this.display.requestAnimationFrame(callback); + } + onFrameStart() { + this.display.getFrameData(this.frame); + } + onFrameEnd(sessionId) { + const session = this.sessions.get(sessionId); + if (session.ended || !session.baseLayer) { + return; + } + if (session.outputContext && + !(session.exclusive && !this.display.capabilities.hasExternalDisplay)) { + const canvas = session.baseLayer.context.canvas; + const iWidth = canvas.width / 2; + const iHeight = canvas.height; + { + const outputCanvas = session.outputContext.canvas; + const outputContext = outputCanvas.getContext('2d'); + const oWidth = outputCanvas.width; + const oHeight = outputCanvas.height; + outputContext.drawImage(canvas, 0, 0, iWidth, iHeight, + 0, 0, oWidth, oHeight); + } + } + if (session.exclusive && session.baseLayer) { + this.display.submitFrame(); + } + } + cancelAnimationFrame(handle) { + this.display.cancelAnimationFrame(handle); + } + async endSession(sessionId) { + const session = this.sessions.get(sessionId); + if (session.ended) { + return; + } + if (session.exclusive) { + return this.display.exitPresent(); + } else { + session.ended = true; + } + } + requestStageBounds() { + if (this.display.stageParameters) { + const width = this.display.stageParameters.sizeX; + const depth = this.display.stageParameters.sizeZ; + const data = []; + data.push(-width / 2); + data.push(-depth / 2); + data.push(width / 2); + data.push(-depth / 2); + data.push(width / 2); + data.push(depth / 2); + data.push(-width / 2); + data.push(depth / 2); + return data; + } + return null; + } + async requestFrameOfReferenceTransform(type, options) { + if (type === 'stage' && this.display.stageParameters && + this.display.stageParameters.sittingToStandingTransform) { + return this.display.stageParameters.sittingToStandingTransform; + } + } + getProjectionMatrix(eye) { + if (eye === 'left') { + return this.frame.leftProjectionMatrix; + } else if (eye === 'right') { + return this.frame.rightProjectionMatrix; + } else { + throw new Error(`eye must be of type 'left' or 'right'`); + } + } + getViewport(sessionId, eye, layer, target) { + const session = this.sessions.get(sessionId); + const { width, height } = layer.context.canvas; + if (!session.exclusive) { + target.x = target.y = 0; + target.width = width; + target.height = height; + return true; + } + if (eye === 'left') { + target.x = 0; + } else if (eye === 'right') { + target.x = width / 2; + } else { + return false; + } + target.y = 0; + target.width = width / 2; + target.height = height; + return true; + } + getBasePoseMatrix() { + let { position, orientation } = this.frame.pose; + if (!position && !orientation) { + return this.baseModelMatrix; + } + if (!position) { + position = this.tempVec3; + position[0] = position[1] = position[2] = 0; + } + mat4_fromRotationTranslation(this.baseModelMatrix, orientation, position); + return this.baseModelMatrix; + } + getBaseViewMatrix(eye) { + if (eye === 'left') { + return this.frame.leftViewMatrix; + } else if (eye === 'right') { + return this.frame.rightViewMatrix; + } else { + throw new Error(`eye must be of type 'left' or 'right'`); + } + } + onWindowResize() { + } + onVRDisplayPresentChange(e) { + if (!this.display.isPresenting) { + this.sessions.forEach(session => { + if (session.exclusive && !session.ended) { + if (session.modifiedCanvasLayer) { + const canvas = session.baseLayer.context.canvas; + document.body.removeChild(canvas); + canvas.setAttribute('style', ''); + } + this.dispatchEvent('@@webxr-polyfill/vr-present-end', session.id); + } + }); + } + } +} + +class CardboardXRDevice extends WebVRDevice { + constructor(global) { + const display = new CardboardVRDisplay(); + super(global, display); + this.display = display; + this.frame = { + rightViewMatrix: new Float32Array(16), + leftViewMatrix: new Float32Array(16), + rightProjectionMatrix: new Float32Array(16), + leftProjectionMatrix: new Float32Array(16), + pose: null, + timestamp: null, + }; + } +} + +const getXRDevice = async function (global) { + let device = null; + if ('xr' in global.navigator) { + try { + device = await global.navigator.xr.requestDevice(); + } catch (e) {} + } + return device; +}; +const getVRDisplay = async function (global) { + let device = null; + if ('getVRDisplays' in global.navigator) { + try { + const displays = await global.navigator.getVRDisplays(); + if (displays && displays.length) { + device = new WebVRDevice(global, displays[0]); + } + } catch (e) {} + } + return device; +}; +const requestDevice = async function (global, config) { + let device = await getXRDevice(global); + if (device) { + return device; + } + if (config.webvr) { + device = await getVRDisplay(global); + if (device) { + return new XRDevice(device); + } + } + if (config.cardboard && isMobile(global)) { + if (!global.VRFrameData) { + global.VRFrameData = function () { + this.rightViewMatrix = new Float32Array(16); + this.leftViewMatrix = new Float32Array(16); + this.rightProjectionMatrix = new Float32Array(16); + this.leftProjectionMatrix = new Float32Array(16); + this.pose = null; + }; + } + return new XRDevice(new CardboardXRDevice(global)); + } + return null; +}; + +const CONFIG_DEFAULTS = { + webvr: true, + cardboard: true, +}; +const partials = ['navigator', 'HTMLCanvasElement', 'WebGLRenderingContext']; +class WebXRPolyfill { + constructor(global, config={}) { + this.global = global || _global; + this.config = Object.freeze(Object.assign({}, CONFIG_DEFAULTS, config)); + this.nativeWebXR = 'xr' in this.global.navigator; + this.injected = false; + if (!this.nativeWebXR) { + this._injectPolyfill(this.global); + } + else if (this.config.cardboard && isMobile(this.global)) { + this._patchRequestDevice(); + } + } + _injectPolyfill(global) { + if (!partials.every(iface => !!global[iface])) { + throw new Error(`Global must have the following attributes : ${partials}`); + } + for (const className of Object.keys(API)) { + if (global[className] !== undefined) { + console.warn(`${className} already defined on global.`); + } else { + global[className] = API[className]; + } + } + { + const polyfilledCtx = extendContextCompatibleXRDevice(global.WebGLRenderingContext); + if (polyfilledCtx) { + extendGetContext(global.HTMLCanvasElement); + } + } + this.injected = true; + this._patchRequestDevice(); + } + _patchRequestDevice() { + const device = requestDevice(this.global, this.config); + this.xr = new XR(device); + Object.defineProperty(this.global.navigator, 'xr', { + value: this.xr, + configurable: true, + }); + } +} + +export default WebXRPolyfill; diff --git a/examples/css/common.css b/examples/css/common.css new file mode 100644 index 0000000..145673d --- /dev/null +++ b/examples/css/common.css @@ -0,0 +1,46 @@ +body { + background-color: #F0F0F0; + font: 1rem/1.4 -apple-system, BlinkMacSystemFont, + Segoe UI, Roboto, Oxygen, + Ubuntu, Cantarell, Fira Sans, + Droid Sans, Helvetica Neue, sans-serif; +} + +header { + position: relative; + z-index: 2; + left: 0px; + text-align: left; + max-width: 420px; + padding: 0.5em; + background-color: rgba(255, 255, 255, 0.90); + margin-bottom: 0.5em; + border-radius: 2px; +} + +details summary { + font-size: 1.0em; + font-weight: bold; +} + +details[open] summary { + font-size: 1.4em; + font-weight: bold; +} + +header h1 { + margin-top: 0px; +} + +canvas { + position: absolute; + z-index: 0; + width: 100%; + height: 100%; + left: 0; + top: 0; + right: 0; + bottom: 0; + margin: 0; + touch-action: none; +} diff --git a/examples/js/cottontail.js b/examples/js/cottontail.js new file mode 100644 index 0000000..22912fe --- /dev/null +++ b/examples/js/cottontail.js @@ -0,0 +1,22 @@ +/*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. +*/ +!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GLTF2Scene=t.CubeSeaScene=t.Scene=t.WebXRView=t.PbrMaterial=t.BoxBuilder=t.PrimitiveStream=t.createWebGLContext=t.Renderer=t.AABB=t.Ray=void 0;var n=r(1),i=r(2),o=r(7),a=r(9),s=r(10),_=r(11),u=r(18),l=r(19);"XRWebGLLayer"in window&&!("getViewport"in XRWebGLLayer.prototype)&&(XRWebGLLayer.prototype.getViewport=function(e){return e.getViewport(this)}),t.Ray=n.Ray,t.AABB=n.AABB,t.Renderer=i.Renderer,t.createWebGLContext=i.createWebGLContext,t.PrimitiveStream=o.PrimitiveStream,t.BoxBuilder=a.BoxBuilder,t.PbrMaterial=s.PbrMaterial,t.WebXRView=_.WebXRView,t.Scene=_.Scene,t.CubeSeaScene=u.CubeSeaScene,t.GLTF2Scene=l.GLTF2Scene},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:null;r(this,e),this.origin=vec3.create(),this._dir=vec3.create(),this._dir[2]=-1,transform&&(mat4.transformVec3(this.origin,this.origin,t),mat4.transformVec3(this._dir,this._dir,t),mat4.sub(this._dir,this._dir,this.origin)),this.inv_dir=vec3.fromValues(1/this._dir[0],1/this._dir[1],1/this._dir[2]),this.sign=[this.inv_dir[0]<0?1:-1,this.inv_dir[1]<0?1:-1,this.inv_dir[2]<0?1:-1]}return n(e,[{key:"dir",get:function(){return this._dir},set:function(e){this._dir=vec3.copy(this._dir,e),this.inv_dir=vec3.fromValues(1/this._dir[0],1/this._dir[1],1/this._dir[2]),this.sign=[this.inv_dir[0]<0?1:-1,this.inv_dir[1]<0?1:-1,this.inv_dir[2]<0?1:-1]}}]),e}(),t.AABB=function(){function e(){r(this,e),this.min=vec3.create(),this.max=vec3.create()}return n(e,[{key:"rayIntersect",value:function(e){var t=[this.min,this.max],r=(t[e.sign[0]][0]-e.origin[0])*e.inv_dir[0],n=(t[1-e.sign[0]][0]-e.origin[0])*e.inv_dir[0],i=(t[e.sign[1]][1]-e.origin[1])*e.inv_dir[1],o=(t[1-e.sign[1]][1]-e.origin[1])*e.inv_dir[1];if(r>o||i>n)return-1;i>r&&(r=i),os||a>n?-1:(a>r&&(r=a),s0?e.enable(t):e.disable(t))}Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=t.RenderView=t.ATTRIB_MASK=t.ATTRIB=void 0;var s=function(){function e(e,t){for(var r=0;r2&&void 0!==arguments[2]?arguments[2]:null,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"left";n(this,e),this.projection_matrix=t,this.view_matrix=r,this.viewport=i,this._eye=o,this._eye_index="left"==o?0:1}return s(e,[{key:"eye",get:function(){return this._eye},set:function(e){this._eye=e,this._eye_index="left"==e?0:1}},{key:"eye_index",get:function(){return this._eye_index}}]),e}(),function(){function e(t,r,i){var o=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;n(this,e),this._target=t,this._usage=r,this._length=a,i instanceof Promise?(this._buffer=null,this._promise=i.then(function(e){return o._buffer=e,o})):(this._buffer=i,this._promise=Promise.resolve(this))}return s(e,[{key:"waitForComplete",value:function(){return this._promise}}]),e}()),x=function e(t){n(this,e),this._attrib_index=c[t.name],this._component_count=t.component_count,this._component_type=t.component_type,this._stride=t.stride,this._byte_offset=t.byte_offset,this._normalized=t.normalized},w=function e(t){n(this,e),this._buffer=t,this._attributes=[]},T=function(){function e(t){n(this,e),this._mode=t.mode,this._element_count=t.element_count,this._instances=[],this._vao=null,this._complete=!1,this._material=null,this._attribute_buffers=[],this._attribute_mask=0;var r=!0,i=!1,o=void 0;try{for(var a,s=t.attributes[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var _=a.value;this._attribute_mask|=h[_.name];var u=new x(_),l=!1,f=!0,c=!1,d=void 0;try{for(var v,m=this._attribute_buffers[Symbol.iterator]();!(f=(v=m.next()).done);f=!0){var p=v.value;if(p._buffer==_.buffer){p._attributes.push(u),l=!0;break}}}catch(e){c=!0,d=e}finally{try{!f&&m.return&&m.return()}finally{if(c)throw d}}if(!l){var y=new w(_.buffer);y._attributes.push(u),this._attribute_buffers.push(y)}}}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}this._index_buffer=null,this._index_byte_offset=0,this._index_type=0,t.index_buffer&&(this._index_byte_offset=t.index_byte_offset,this._index_type=t.index_type,this._index_buffer=t.index_buffer)}return s(e,[{key:"setRenderMaterial",value:function(e){this._material=e,this._promise=null,this._complete=!1,null!=this._material&&this.waitForComplete()}},{key:"markActive",value:function(e){this._complete&&(this._active_frame_id=e,this.material&&this.material.markActive(e),this.program&&this.program.markActive(e))}},{key:"waitForComplete",value:function(){var e=this;if(!this._promise){if(!this._material)return Promise.reject("RenderPrimitive does not have a material");var t=[];t.push(this._material.waitForComplete());var r=!0,n=!1,i=void 0;try{for(var o,a=this._attribute_buffers[Symbol.iterator]();!(r=(o=a.next()).done);r=!0){var s=o.value;s._buffer._buffer||t.push(s._buffer._promise)}}catch(e){n=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}this._index_buffer&&!this._index_buffer._buffer&&t.push(this._index_buffer._promise),this._promise=Promise.all(t).then(function(){return e._complete=!0,e})}return this._promise}}]),e}(),E=mat4.create(),R=function e(t,r,i){n(this,e),this._uniform_name=r._uniform_name,this._texture=t._getRenderTexture(r._texture),this._index=i},O=function e(t){n(this,e),this._uniform_name=t._uniform_name,this._uniform=null,this._length=t._length,t._value instanceof Array?this._value=new Float32Array(t._value):this._value=new Float32Array([t._value])},S=function(){function e(t,r,i){n(this,e),this._program=i,this._state=r.state._state,this._samplers=[];for(var o=0;o>_.MAT_STATE.DEPTH_FUNC_SHIFT)+WebGLRenderingContext.NEVER}},{key:"blend_func_src",get:function(){return(0,_.stateToBlendFunc)(this._state,_.MAT_STATE.BLEND_SRC_RANGE,_.MAT_STATE.BLEND_SRC_SHIFT)}},{key:"blend_func_dst",get:function(){return(0,_.stateToBlendFunc)(this._state,_.MAT_STATE.BLEND_DST_RANGE,_.MAT_STATE.BLEND_DST_SHIFT)}}]),e}();t.Renderer=function(){function e(t){n(this,e),this._gl=t||o(),this._frame_id=-1,this._program_cache={},this._texture_cache={},this._render_primitives=Array(_.RENDER_ORDER.DEFAULT),this._camera_positions=[],this._vao_ext=t.getExtension("OES_vertex_array_object");var r=t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT);this._default_frag_precision=r.precision>0?"highp":"mediump"}return s(e,[{key:"createRenderBuffer",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:WebGLRenderingContext.STATIC_DRAW,n=this._gl,i=n.createBuffer();if(t instanceof Promise){var o=new g(e,r,t.then(function(t){return n.bindBuffer(e,i),n.bufferData(e,t,r),o._length=t.byteLength,i}));return o}return n.bindBuffer(e,i),n.bufferData(e,t,r),new g(e,r,i,t.byteLength)}},{key:"updateRenderBuffer",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(e._buffer){var i=this._gl;i.bindBuffer(e._target,e._buffer),0==n&&e._length==t.byteLength?i.bufferData(e._target,t,e._usage):i.bufferSubData(e._target,n,t)}else e.waitForComplete().then(function(e){r.updateRenderBuffer(e,t,n)})}},{key:"createRenderPrimitive",value:function(e,t){var r=this,n=new T(e),i=this._getMaterialProgram(t,n),o=new S(this,t,i);return n.setRenderMaterial(o),this._vao_ext&&n.waitForComplete().then(function(){n._vao=r._vao_ext.createVertexArrayOES(),r._vao_ext.bindVertexArrayOES(n._vao),r._bindPrimitive(n),r._vao_ext.bindVertexArrayOES(null)}),this._render_primitives[o._render_order]||(this._render_primitives[o._render_order]=[]),this._render_primitives[o._render_order].push(n),n}},{key:"createMesh",value:function(e,t){var r=new u.Node;return r.addRenderPrimitive(this.createRenderPrimitive(e,t)),r}},{key:"drawViews",value:function(e,t){if(t){this._gl;if(this._frame_id++,t.markActive(this._frame_id),1==e.length&&e[0].viewport){var r=e[0].viewport;this._gl.viewport(r.x,r.y,r.width,r.height)}for(var n=0;n1){if(h.viewport){var m=h.viewport;r.viewport(m.x,m.y,m.width,m.height)}r.uniformMatrix4fv(n.uniform.PROJECTION_MATRIX,!1,h.projection_matrix),r.uniformMatrix4fv(n.uniform.VIEW_MATRIX,!1,h.view_matrix),r.uniform3fv(n.uniform.CAMERA_POSITION,this._camera_positions[c]),r.uniform1i(n.uniform.EYE_INDEX,h.eye_index)}var p=!0,y=!1,b=void 0;try{for(var g,x=f._instances[Symbol.iterator]();!(p=(g=x.next()).done);p=!0){var w=g.value;w._active_frame_id==this._frame_id&&(r.uniformMatrix4fv(n.uniform.MODEL_MATRIX,!1,w.world_matrix),f._index_buffer?r.drawElements(f._mode,f._element_count,f._index_type,f._index_byte_offset):r.drawArrays(f._mode,0,f._element_count))}}catch(e){y=!0,b=e}finally{try{!p&&x.return&&x.return()}finally{if(y)throw b}}}}}}catch(e){s=!0,_=e}finally{try{!a&&l.return&&l.return()}finally{if(s)throw _}}}},{key:"_getRenderTexture",value:function(e){var t=this;if(!e)return null;var r=e.texture_key;if(!r)throw new Error("Texure does not have a valid key");if(r in this._texture_cache)return this._texture_cache[r];var n=this._gl,i=n.createTexture();return this._texture_cache[r]=i,e instanceof f.DataTexture?(n.bindTexture(n.TEXTURE_2D,i),n.texImage2D(n.TEXTURE_2D,0,e.format,e.width,e.height,0,e.format,e._type,e._data),this._setSamplerParameters(e)):e.waitForComplete().then(function(){n.bindTexture(n.TEXTURE_2D,i),n.texImage2D(n.TEXTURE_2D,0,e.format,e.format,n.UNSIGNED_BYTE,e._img),t._setSamplerParameters(e)}),i}},{key:"_setSamplerParameters",value:function(e){var t=this._gl,r=e.sampler,n=i(e.width)&&i(e.height),o=n&&e.mipmap;o&&t.generateMipmap(t.TEXTURE_2D);var a=r.min_filter||(o?t.LINEAR_MIPMAP_LINEAR:t.LINEAR),s=r.wrap_s||(n?t.REPEAT:t.CLAMP_TO_EDGE),_=r.wrap_t||(n?t.REPEAT:t.CLAMP_TO_EDGE);t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,r.mag_filter||t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,a),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,s),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,_)}},{key:"_getProgramKey",value:function(e,t){var r=e+":";for(var n in t)r+=n+"="+t[n]+",";return r}},{key:"_getMaterialProgram",value:function(e,t){var r=this,n=e.material_name,i=e.vertex_source,o=e.fragment_source;if(null==n)throw new Error("Material does not have a name");if(null==i)throw new Error('Material "'+n+'" does not have a vertex source');if(null==o)throw new Error('Material "'+n+'" does not have a fragment source');var a=e.getProgramDefines(t),s=this._getProgramKey(n,a);if(s in this._program_cache)return this._program_cache[s];var _=!1,u=i;u+=_?y:p;var f=o.match(m),h=f?"":"precision "+this._default_frag_precision+" float;\n",d=h+o;d+=b;var v=new l.Program(this._gl,u,d,c,a);return this._program_cache[s]=v,v.onNextUse(function(t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:null,r=this._gl,n=e._state,i=t?t._state:~n;if(n!=i){if(e._capsDiff(i)){a(r,r.CULL_FACE,_.CAP.CULL_FACE,i,n),a(r,r.BLEND,_.CAP.BLEND,i,n),a(r,r.DEPTH_TEST,_.CAP.DEPTH_TEST,i,n),a(r,r.STENCIL_TEST,_.CAP.STENCIL_TEST,i,n);var o=(n&_.CAP.COLOR_MASK)-(i&_.CAP.COLOR_MASK);if(o){var s=o>1;r.colorMask(s,s,s,s)}var u=(n&_.CAP.DEPTH_MASK)-(i&_.CAP.DEPTH_MASK);u&&r.depthMask(u>1);var l=(n&_.CAP.STENCIL_MASK)-(i&_.CAP.STENCIL_MASK);l&&r.stencilMask(l>1)}e._blendDiff(i)&&r.blendFunc(e.blend_func_src,e.blend_func_dst),e._depthFuncDiff(i)&&r.depthFunc(e.depth_func)}}},{key:"gl",get:function(){return this._gl}}]),e}()},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t,r){var n=(e&t)>>r;switch(n){case 0:case 1:return n;default:return n-2+o.SRC_COLOR}}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r>s.DEPTH_FUNC_SHIFT)+WebGLRenderingContext.NEVER},set:function(e){e-=WebGLRenderingContext.NEVER,this._state&=~s.DEPTH_FUNC_RANGE,this._state|=e<1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new f(e,t,r);return this._uniforms.push(n),n}},{key:"getProgramDefines",value:function(e){return{}}},{key:"material_name",get:function(){return null}},{key:"vertex_source",get:function(){return null}},{key:"fragment_source",get:function(){return null}}]),e}()},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r-1&&(this.children.splice(t,1),e.parent=null)}},{key:"setMatrixDirty",value:function(){if(!this._dirty_world_matrix){this._dirty_world_matrix=!0;var e=!0,t=!1,r=void 0;try{for(var n,i=this.children[Symbol.iterator]();!(e=(n=i.next()).done);e=!0){var o=n.value;o.setMatrixDirty()}}catch(e){t=!0,r=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}}}},{key:"_updateLocalMatrix",value:function(){return this._matrix||(this._matrix=mat4.create()),this._dirty_trs&&(this._dirty_trs=!1,mat4.fromRotationTranslationScale(this._matrix,this._rotation||o,this._translation||i,this._scale||a)),this._matrix}},{key:"waitForComplete",value:function(){var e=this,t=[],r=!0,n=!1,i=void 0;try{for(var o,a=this.children[Symbol.iterator]();!(r=(o=a.next()).done);r=!0){var s=o.value;t.push(s.waitForComplete())}}catch(e){n=!0,i=e}finally{try{!r&&a.return&&a.return()}finally{if(n)throw i}}if(this._render_primitives){var _=!0,u=!1,l=void 0;try{for(var f,c=this._render_primitives[Symbol.iterator]();!(_=(f=c.next()).done);_=!0){var h=f.value;t.push(h.waitForComplete())}}catch(e){u=!0,l=e}finally{try{!_&&c.return&&c.return()}finally{if(u)throw l}}}return Promise.all(t).then(function(){return e})}},{key:"addRenderPrimitive",value:function(e){this._render_primitives?this._render_primitives.push(e):this._render_primitives=[e],e._instances.push(this)}},{key:"removeRenderPrimitive",value:function(e){if(this._render_primitives){var t=this._render_primitives._instances.indexOf(e);t>-1&&(this._render_primitives._instances.splice(t,1),t=e._instances.indexOf(this),t>-1&&e._instances.splice(t,1),this._render_primitives.length||(this._render_primitives=null))}}},{key:"clearRenderPrimitives",value:function(){if(this._render_primitives){var e=!0,t=!1,r=void 0;try{for(var n,i=this._render_primitives[Symbol.iterator]();!(e=(n=i.next()).done);e=!0){var o=n.value,a=o._instances.indexOf(this);a>-1&&o._instances.splice(a,1)}}catch(e){t=!0,r=e}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}this._render_primitives=null}}},{key:"matrix",set:function(e){this._matrix=e,this.setMatrixDirty(),this._dirty_trs=!1,this._translation=null,this._rotation=null,this._scale=null},get:function(){return this.setMatrixDirty(),this._updateLocalMatrix()}},{key:"world_matrix",get:function(){return this._world_matrix||(this._dirty_world_matrix=!0,this._world_matrix=mat4.create()),(this._dirty_world_matrix||this._dirty_trs)&&(this.parent?mat4.mul(this._world_matrix,this.parent.world_matrix,this._updateLocalMatrix()):mat4.copy(this._world_matrix,this._updateLocalMatrix()),this._dirty_world_matrix=!1),this._world_matrix}},{key:"translation",set:function(e){null!=e&&(this._dirty_trs=!0,this.setMatrixDirty()),this._translation=e},get:function(){return this._dirty_trs=!0,this.setMatrixDirty(),this._translation||(this._translation=vec3.clone(i)),this._translation}},{key:"rotation",set:function(e){null!=e&&(this._dirty_trs=!0,this.setMatrixDirty()),this._rotation=e},get:function(){return this._dirty_trs=!0,this.setMatrixDirty(),this._rotation||(this._rotation=quat.clone(o)),this._rotation}},{key:"scale",set:function(e){null!=e&&(this._dirty_trs=!0,this.setMatrixDirty()),this._scale=e},get:function(){return this._dirty_trs=!0,this.setMatrixDirty(),this._scale||(this._scale=vec3.clone(a)),this._scale}},{key:"renderPrimitives",get:function(){return this._render_primitives}}]),e}()},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r3&&void 0!==arguments[3]?arguments[3]:a.RGBA,_=arguments.length>4&&void 0!==arguments[4]?arguments[4]:a.UNSIGNED_BYTE;i(this,t);var u=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return u._data=e,u._width=n,u._height=o,u._format=s,u._type=_,u._key="DATA_"+l,l++,u}return n(t,e),o(t,[{key:"format",get:function(){return this._format}},{key:"width",get:function(){return this._width}},{key:"height",get:function(){return this._height}},{key:"texture_key",get:function(){return this._key}}]),t}(_);t.ColorTexture=function(e){function t(e,n,o,a){i(this,t);var s=new Uint8Array([255*e,255*n,255*o,255*a]),_=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,s,1,1));return _.mipmap=!1,_._key="COLOR_"+s[0]+"_"+s[1]+"_"+s[2]+"_"+s[3],_}return n(t,e),t}(f)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.GeometryBuilderBase=t.PrimitiveStream=void 0;var i=function(){function e(e,t){for(var r=0;r=this._vertex_index)throw new Error("Geometry contains indices that are out of bounds. (Contains an index of "+this._high_index+" when the vertex count is "+this._vertex_index+")");this._geometry_started=!1,this._vertex_offset+=this._vertex_index}},{key:"pushVertex",value:function(e,t,r,n,i,o,a,_){if(!this._geometry_started)throw new Error("Cannot push vertices before calling startGeometry().");return this._transform&&(s[0]=e,s[1]=t,s[2]=r,vec3.transformMat4(s,s,this._transform),e=s[0],t=s[1],r=s[2],s[0]=o,s[1]=a,s[2]=_,vec3.transformMat3(s,s,this._normal_transform),o=s[0],a=s[1],_=s[2]),this._invert_normals&&(o*=-1,a*=-1,_*=-1),this._vertices.push(e,t,r,n,i,o,a,_),this._min?(this._min[0]=Math.min(this._min[0],e),this._min[1]=Math.min(this._min[1],t),this._min[2]=Math.min(this._min[2],r),this._max[0]=Math.max(this._max[0],e),this._max[1]=Math.max(this._max[1],t),this._max[2]=Math.max(this._max[2],r)):(this._min=vec3.fromValues(e,t,r),this._max=vec3.fromValues(e,t,r)),this._vertex_index++}},{key:"pushTriangle",value:function(e,t,r){if(!this._geometry_started)throw new Error("Cannot push triangles before calling startGeometry().");this._high_index=Math.max(this._high_index,e,t,r),e+=this._vertex_offset,t+=this._vertex_offset,r+=this._vertex_offset,this._flip_winding?this._indices.push(r,t,e):this._indices.push(e,t,r)}},{key:"clear",value:function(){if(this._geometry_started)throw new Error("Cannot clear before ending the current geometry.");this._vertices=[],this._indices=[],this._vertex_offset=0,this._min=null,this._max=null}},{key:"finishPrimitive",value:function(e){if(!this._vertex_offset)throw new Error("Attempted to call finishPrimitive() before creating any geometry.");var t=e.createRenderBuffer(a.ARRAY_BUFFER,new Float32Array(this._vertices)),r=e.createRenderBuffer(a.ELEMENT_ARRAY_BUFFER,new Uint16Array(this._indices)),n=[new o.PrimitiveAttribute("POSITION",t,3,a.FLOAT,32,0),new o.PrimitiveAttribute("TEXCOORD_0",t,2,a.FLOAT,32,12),new o.PrimitiveAttribute("NORMAL",t,3,a.FLOAT,32,20)],i=new o.Primitive(n,this._indices.length);return i.setIndexBuffer(r),i}},{key:"flip_winding",set:function(e){if(this._geometry_started)throw new Error("Cannot change flip_winding before ending the current geometry.");this._flip_winding=e},get:function(){this._flip_winding}},{key:"invert_normals",set:function(e){if(this._geometry_started)throw new Error("Cannot change invert_normals before ending the current geometry.");this._invert_normals=e},get:function(){this._invert_normals}},{key:"transform",set:function(e){if(this._geometry_started)throw new Error("Cannot change transform before ending the current geometry.");this._transform=e,this._transform&&(this._normal_transform||(this._normal_transform=mat3.create()),mat3.fromMat4(this._normal_transform,this._transform))},get:function(){this._transform}},{key:"next_vertex_index",get:function(){return this._vertex_index}}]),e}();t.GeometryBuilderBase=function(){function e(t){n(this,e),t?this._stream=t:this._stream=new _}return i(e,[{key:"finishPrimitive",value:function(e){this._stream.finishPrimitive(e)}},{key:"primitive_stream",set:function(e){this._stream=e},get:function(){return this._stream}}]),e}()},function(e,t){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:[0,0,0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=.5*t;this.pushBox([e[0]-r,e[1]-r,e[2]-r],[e[0]+r,e[1]+r,e[2]+r])}}]),t}(s.GeometryBuilderBase)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.PbrMaterial=void 0;var a=function(){function e(e,t){for(var r=0;r=0?this._frame_delta=this._timestamp-e:this._frame_delta=0,this._frame_delta}},{key:"endFrame",value:function(){this._input_renderer&&this._reset_input_end_frame&&this._input_renderer.reset(),this._stats&&this._stats.end()}},{key:"onLoadScene",value:function(e){return Promise.resolve()}},{key:"onDrawViews",value:function(e,t,r){e.drawViews(r,this)}},{key:"gltf2Loader",get:function(){return this._gltf2_loader}},{key:"inputRenderer",get:function(){return this._input_renderer}}]),t}(c.Node)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.BoundsRenderer=void 0;var a=function(){function e(e,t){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:"right";this._controller_node=e,this._controller_node_handedness=t}},{key:"addController",value:function(e){if(this._controller_node){var t=null;this._active_controllers1&&r.push(0,i-1,i)}for(var l=E,f=0;f0){var v=l+2*f;r.push(v-2,v-1,v),r.push(v-1,v+1,v)}}var m=l+2*E;r.push(m-2,m-1,l),r.push(m-1,l+1,l);var R=this._renderer.createRenderBuffer(e.ARRAY_BUFFER,new Float32Array(t)),O=this._renderer.createRenderBuffer(e.ELEMENT_ARRAY_BUFFER,new Uint16Array(r)),S=r.length,P=[new u.PrimitiveAttribute("POSITION",R,4,e.FLOAT,16,0)],C=new u.Primitive(P,S);C.setIndexBuffer(O);var L=new A,k=this._renderer.createRenderPrimitive(C,L),N=new _.Node;return N.addRenderPrimitive(k),N}}]),t}(_.Node)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Skybox=void 0;var a=function(){function e(e,t){for(var r=0;rthis._prev_graph_update_time+this._fps_step){var r=e-this._prev_graph_update_time;this._fps_average=Math.round(1e3/(r/this._frames)),this._updateGraph(this._fps_min,this._fps_average),this.enable_performance_monitoring&&console.log("Average FPS: "+this._fps_average+" Min FPS: "+this._fps_min),this._prev_graph_update_time=e,this._frames=0,this._fps_min=0}}},{key:"_updateGraph",value:function(e,t){var r=_(e),n=s(e-1),i=s(t+1),o=[a(this._last_segment),i,.02,r.r,r.g,r.b,a(this._last_segment+1),i,.02,r.r,r.g,r.b,a(this._last_segment),n,.02,r.r,r.g,r.b,a(this._last_segment+1),n,.02,r.r,r.g,r.b];r.r=.2,r.g=1,r.b=.2,this._last_segment==d-1?(this._renderer.updateRenderBuffer(this._fps_vertex_buffer,new Float32Array(o),24*this._last_segment*4),o=[a(0),s(v),.02,r.r,r.g,r.b,a(.25),s(v),.02,r.r,r.g,r.b,a(0),s(0),.02,r.r,r.g,r.b,a(.25),s(0),.02,r.r,r.g,r.b],this._renderer.updateRenderBuffer(this._fps_vertex_buffer,new Float32Array(o),0)):(o.push(a(this._last_segment+1),s(v),.02,r.r,r.g,r.b,a(this._last_segment+1.25),s(v),.02,r.r,r.g,r.b,a(this._last_segment+1),s(0),.02,r.r,r.g,r.b,a(this._last_segment+1.25),s(0),.02,r.r,r.g,r.b),this._renderer.updateRenderBuffer(this._fps_vertex_buffer,new Float32Array(o),24*this._last_segment*4)),this._last_segment=(this._last_segment+1)%d,this._seven_segment_node.text=this._fps_average+" FP5"}},{key:"performance_monitoring",get:function(){return this._performance_monitoring},set:function(e){this._performance_monitoring=e,this._fps_step=e?1e3:250}}]),t}(f.Node)},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SevenSegmentText=void 0;var a=function(){function e(e,t){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{};n(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r._grid_size=e.grid_size?e.grid_size:10,r._image_url=e.image_url?e.image_url:"media/textures/cube-sea.png",r}return o(t,e),a(t,[{key:"onLoadScene",value:function(e){for(var t=new l.BoxBuilder,r=.5*this._grid_size,n=0;n0&&(u=1/Math.sqrt(u),t[0]=n[0]*u,t[1]=n[1]*u,t[2]=n[2]*u),t}function w(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function R(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],s=r[2];return t[0]=e*s-u*i,t[1]=u*o-a*s,t[2]=a*i-e*o,t}function L(t,n,r,a){var e=n[0],u=n[1],o=n[2];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t[2]=o+a*(r[2]-o),t}function S(t,n,r,a,e,u){var o=u*u,i=o*(2*u-3)+1,s=o*(u-2)+u,c=o*(u-1),f=o*(3-2*u);return t[0]=n[0]*i+r[0]*s+a[0]*c+e[0]*f,t[1]=n[1]*i+r[1]*s+a[1]*c+e[1]*f,t[2]=n[2]*i+r[2]*s+a[2]*c+e[2]*f,t}function _(t,n,r,a,e,u){var o=1-u,i=o*o,s=u*u,c=i*o,f=3*u*i,M=3*s*o,h=s*u;return t[0]=n[0]*c+r[0]*f+a[0]*M+e[0]*h,t[1]=n[1]*c+r[1]*f+a[1]*M+e[1]*h,t[2]=n[2]*c+r[2]*f+a[2]*M+e[2]*h,t}function I(t,n){n=n||1;var r=2*Z.RANDOM()*Math.PI,a=2*Z.RANDOM()-1,e=Math.sqrt(1-a*a)*n;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t[2]=a*n,t}function N(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[3]*a+r[7]*e+r[11]*u+r[15];return o=o||1,t[0]=(r[0]*a+r[4]*e+r[8]*u+r[12])/o,t[1]=(r[1]*a+r[5]*e+r[9]*u+r[13])/o,t[2]=(r[2]*a+r[6]*e+r[10]*u+r[14])/o,t}function Y(t,n,r){var a=n[0],e=n[1],u=n[2];return t[0]=a*r[0]+e*r[3]+u*r[6],t[1]=a*r[1]+e*r[4]+u*r[7],t[2]=a*r[2]+e*r[5]+u*r[8],t}function g(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],s=r[2],c=r[3],f=c*a+i*u-s*e,M=c*e+s*a-o*u,h=c*u+o*e-i*a,l=-o*a-i*e-s*u;return t[0]=f*c+l*-o+M*-s-h*-i,t[1]=M*c+l*-i+h*-o-f*-s,t[2]=h*c+l*-s+f*-i-M*-o,t}function T(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[0],u[1]=e[1]*Math.cos(a)-e[2]*Math.sin(a),u[2]=e[1]*Math.sin(a)+e[2]*Math.cos(a),t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t}function j(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[2]*Math.sin(a)+e[0]*Math.cos(a),u[1]=e[1],u[2]=e[2]*Math.cos(a)-e[0]*Math.sin(a),t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t}function D(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[0]*Math.cos(a)-e[1]*Math.sin(a),u[1]=e[0]*Math.sin(a)+e[1]*Math.cos(a),u[2]=e[2],t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t}function V(t,n){var r=o(t[0],t[1],t[2]),a=o(n[0],n[1],n[2]);y(r,r),y(a,a);var e=w(r,a);return e>1?0:e<-1?Math.PI:Math.acos(e)}function z(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function F(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]}function Q(t,n){var r=t[0],a=t[1],e=t[2],u=n[0],o=n[1],i=n[2];return Math.abs(r-u)<=Z.EPSILON*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(a-o)<=Z.EPSILON*Math.max(1,Math.abs(a),Math.abs(o))&&Math.abs(e-i)<=Z.EPSILON*Math.max(1,Math.abs(e),Math.abs(i))}Object.defineProperty(n,"__esModule",{value:!0}),n.forEach=n.sqrLen=n.len=n.sqrDist=n.dist=n.div=n.mul=n.sub=void 0,n.create=a,n.clone=e,n.length=u,n.fromValues=o,n.copy=i,n.set=s,n.add=c,n.subtract=f,n.multiply=M,n.divide=h,n.ceil=l,n.floor=v,n.min=d,n.max=b,n.round=m,n.scale=p,n.scaleAndAdd=P,n.distance=E,n.squaredDistance=O,n.squaredLength=x,n.negate=A,n.inverse=q,n.normalize=y,n.dot=w,n.cross=R,n.lerp=L,n.hermite=S,n.bezier=_,n.random=I,n.transformMat4=N,n.transformMat3=Y,n.transformQuat=g,n.rotateX=T,n.rotateY=j,n.rotateZ=D,n.angle=V,n.str=z,n.exactEquals=F,n.equals=Q;var X=r(0),Z=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(X);n.sub=f,n.mul=M,n.div=h,n.dist=E,n.sqrDist=O,n.len=u,n.sqrLen=x,n.forEach=function(){var t=a();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=3),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;i0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=a*o,t[2]=e*o,t[3]=u*o),t}function w(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]}function R(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t[2]=o+a*(r[2]-o),t[3]=i+a*(r[3]-i),t}function L(t,n){return n=n||1,t[0]=T.RANDOM(),t[1]=T.RANDOM(),t[2]=T.RANDOM(),t[3]=T.RANDOM(),y(t,t),m(t,t,n),t}function S(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3];return t[0]=r[0]*a+r[4]*e+r[8]*u+r[12]*o,t[1]=r[1]*a+r[5]*e+r[9]*u+r[13]*o,t[2]=r[2]*a+r[6]*e+r[10]*u+r[14]*o,t[3]=r[3]*a+r[7]*e+r[11]*u+r[15]*o,t}function _(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],s=r[2],c=r[3],f=c*a+i*u-s*e,M=c*e+s*a-o*u,h=c*u+o*e-i*a,l=-o*a-i*e-s*u;return t[0]=f*c+l*-o+M*-s-h*-i,t[1]=M*c+l*-i+h*-o-f*-s,t[2]=h*c+l*-s+f*-i-M*-o,t[3]=n[3],t}function I(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function N(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]}function Y(t,n){var r=t[0],a=t[1],e=t[2],u=t[3],o=n[0],i=n[1],s=n[2],c=n[3];return Math.abs(r-o)<=T.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(a-i)<=T.EPSILON*Math.max(1,Math.abs(a),Math.abs(i))&&Math.abs(e-s)<=T.EPSILON*Math.max(1,Math.abs(e),Math.abs(s))&&Math.abs(u-c)<=T.EPSILON*Math.max(1,Math.abs(u),Math.abs(c))}Object.defineProperty(n,"__esModule",{value:!0}),n.forEach=n.sqrLen=n.len=n.sqrDist=n.dist=n.div=n.mul=n.sub=void 0,n.create=a,n.clone=e,n.fromValues=u,n.copy=o,n.set=i,n.add=s,n.subtract=c,n.multiply=f,n.divide=M,n.ceil=h,n.floor=l,n.min=v,n.max=d,n.round=b,n.scale=m,n.scaleAndAdd=p,n.distance=P,n.squaredDistance=E,n.length=O,n.squaredLength=x,n.negate=A,n.inverse=q,n.normalize=y,n.dot=w,n.lerp=R,n.random=L,n.transformMat4=S,n.transformQuat=_,n.str=I,n.exactEquals=N,n.equals=Y;var g=r(0),T=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(g);n.sub=c,n.mul=f,n.div=M,n.dist=P,n.sqrDist=E,n.len=O,n.sqrLen=x,n.forEach=function(){var t=a();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=4),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;i0?(a=2*Math.sqrt(r+1),t[3]=.25*a,t[0]=(n[6]-n[9])/a,t[1]=(n[8]-n[2])/a,t[2]=(n[1]-n[4])/a):n[0]>n[5]&n[0]>n[10]?(a=2*Math.sqrt(1+n[0]-n[5]-n[10]),t[3]=(n[6]-n[9])/a,t[0]=.25*a,t[1]=(n[1]+n[4])/a,t[2]=(n[8]+n[2])/a):n[5]>n[10]?(a=2*Math.sqrt(1+n[5]-n[0]-n[10]),t[3]=(n[8]-n[2])/a,t[0]=(n[1]+n[4])/a,t[1]=.25*a,t[2]=(n[6]+n[9])/a):(a=2*Math.sqrt(1+n[10]-n[0]-n[5]),t[3]=(n[1]-n[4])/a,t[0]=(n[8]+n[2])/a,t[1]=(n[6]+n[9])/a,t[2]=.25*a),t}function _(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3],s=e+e,c=u+u,f=o+o,M=e*s,h=e*c,l=e*f,v=u*c,d=u*f,b=o*f,m=i*s,p=i*c,P=i*f,E=a[0],O=a[1],x=a[2];return t[0]=(1-(v+b))*E,t[1]=(h+P)*E,t[2]=(l-p)*E,t[3]=0,t[4]=(h-P)*O,t[5]=(1-(M+b))*O,t[6]=(d+m)*O,t[7]=0,t[8]=(l+p)*x,t[9]=(d-m)*x,t[10]=(1-(M+v))*x,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function I(t,n,r,a,e){var u=n[0],o=n[1],i=n[2],s=n[3],c=u+u,f=o+o,M=i+i,h=u*c,l=u*f,v=u*M,d=o*f,b=o*M,m=i*M,p=s*c,P=s*f,E=s*M,O=a[0],x=a[1],A=a[2],q=e[0],y=e[1],w=e[2];return t[0]=(1-(d+m))*O,t[1]=(l+E)*O,t[2]=(v-P)*O,t[3]=0,t[4]=(l-E)*x,t[5]=(1-(h+m))*x,t[6]=(b+p)*x,t[7]=0,t[8]=(v+P)*A,t[9]=(b-p)*A,t[10]=(1-(h+d))*A,t[11]=0,t[12]=r[0]+q-(t[0]*q+t[4]*y+t[8]*w),t[13]=r[1]+y-(t[1]*q+t[5]*y+t[9]*w),t[14]=r[2]+w-(t[2]*q+t[6]*y+t[10]*w),t[15]=1,t}function N(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r+r,i=a+a,s=e+e,c=r*o,f=a*o,M=a*i,h=e*o,l=e*i,v=e*s,d=u*o,b=u*i,m=u*s;return t[0]=1-M-v,t[1]=f+m,t[2]=h-b,t[3]=0,t[4]=f-m,t[5]=1-c-v,t[6]=l+d,t[7]=0,t[8]=h+b,t[9]=l-d,t[10]=1-c-M,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Y(t,n,r,a,e,u,o){var i=1/(r-n),s=1/(e-a),c=1/(u-o);return t[0]=2*u*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*u*s,t[6]=0,t[7]=0,t[8]=(r+n)*i,t[9]=(e+a)*s,t[10]=(o+u)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*u*2*c,t[15]=0,t}function g(t,n,r,a,e){var u=1/Math.tan(n/2),o=1/(a-e);return t[0]=u/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(e+a)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*e*a*o,t[15]=0,t}function T(t,n,r,a){var e=Math.tan(n.upDegrees*Math.PI/180),u=Math.tan(n.downDegrees*Math.PI/180),o=Math.tan(n.leftDegrees*Math.PI/180),i=Math.tan(n.rightDegrees*Math.PI/180),s=2/(o+i),c=2/(e+u);return t[0]=s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(o-i)*s*.5,t[9]=(e-u)*c*.5,t[10]=a/(r-a),t[11]=-1,t[12]=0,t[13]=0,t[14]=a*r/(r-a),t[15]=0,t}function j(t,n,r,a,e,u,o){var i=1/(n-r),s=1/(a-e),c=1/(u-o);return t[0]=-2*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(n+r)*i,t[13]=(e+a)*s,t[14]=(o+u)*c,t[15]=1,t}function D(t,n,r,a){var e=void 0,u=void 0,o=void 0,i=void 0,s=void 0,c=void 0,f=void 0,M=void 0,h=void 0,l=void 0,v=n[0],d=n[1],b=n[2],m=a[0],p=a[1],P=a[2],E=r[0],O=r[1],x=r[2];return Math.abs(v-E)0&&(l=1/Math.sqrt(l),f*=l,M*=l,h*=l);var v=s*h-c*M,d=c*f-i*h,b=i*M-s*f;return t[0]=v,t[1]=d,t[2]=b,t[3]=0,t[4]=M*b-h*d,t[5]=h*v-f*b,t[6]=f*d-M*v,t[7]=0,t[8]=f,t[9]=M,t[10]=h,t[11]=0,t[12]=e,t[13]=u,t[14]=o,t[15]=1,t}function z(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function F(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))}function Q(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t[4]=n[4]+r[4],t[5]=n[5]+r[5],t[6]=n[6]+r[6],t[7]=n[7]+r[7],t[8]=n[8]+r[8],t[9]=n[9]+r[9],t[10]=n[10]+r[10],t[11]=n[11]+r[11],t[12]=n[12]+r[12],t[13]=n[13]+r[13],t[14]=n[14]+r[14],t[15]=n[15]+r[15],t}function X(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t[4]=n[4]-r[4],t[5]=n[5]-r[5],t[6]=n[6]-r[6],t[7]=n[7]-r[7],t[8]=n[8]-r[8],t[9]=n[9]-r[9],t[10]=n[10]-r[10],t[11]=n[11]-r[11],t[12]=n[12]-r[12],t[13]=n[13]-r[13],t[14]=n[14]-r[14],t[15]=n[15]-r[15],t}function Z(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=n[7]*r,t[8]=n[8]*r,t[9]=n[9]*r,t[10]=n[10]*r,t[11]=n[11]*r,t[12]=n[12]*r,t[13]=n[13]*r,t[14]=n[14]*r,t[15]=n[15]*r,t}function k(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t[4]=n[4]+r[4]*a,t[5]=n[5]+r[5]*a,t[6]=n[6]+r[6]*a,t[7]=n[7]+r[7]*a,t[8]=n[8]+r[8]*a,t[9]=n[9]+r[9]*a,t[10]=n[10]+r[10]*a,t[11]=n[11]+r[11]*a,t[12]=n[12]+r[12]*a,t[13]=n[13]+r[13]*a,t[14]=n[14]+r[14]*a,t[15]=n[15]+r[15]*a,t}function U(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]&&t[3]===n[3]&&t[4]===n[4]&&t[5]===n[5]&&t[6]===n[6]&&t[7]===n[7]&&t[8]===n[8]&&t[9]===n[9]&&t[10]===n[10]&&t[11]===n[11]&&t[12]===n[12]&&t[13]===n[13]&&t[14]===n[14]&&t[15]===n[15]}function W(t,n){var r=t[0],a=t[1],e=t[2],u=t[3],o=t[4],i=t[5],s=t[6],c=t[7],f=t[8],M=t[9],h=t[10],l=t[11],v=t[12],d=t[13],b=t[14],m=t[15],p=n[0],P=n[1],E=n[2],O=n[3],x=n[4],A=n[5],q=n[6],y=n[7],w=n[8],R=n[9],L=n[10],S=n[11],_=n[12],I=n[13],N=n[14],Y=n[15];return Math.abs(r-p)<=C.EPSILON*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(a-P)<=C.EPSILON*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(e-E)<=C.EPSILON*Math.max(1,Math.abs(e),Math.abs(E))&&Math.abs(u-O)<=C.EPSILON*Math.max(1,Math.abs(u),Math.abs(O))&&Math.abs(o-x)<=C.EPSILON*Math.max(1,Math.abs(o),Math.abs(x))&&Math.abs(i-A)<=C.EPSILON*Math.max(1,Math.abs(i),Math.abs(A))&&Math.abs(s-q)<=C.EPSILON*Math.max(1,Math.abs(s),Math.abs(q))&&Math.abs(c-y)<=C.EPSILON*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(f-w)<=C.EPSILON*Math.max(1,Math.abs(f),Math.abs(w))&&Math.abs(M-R)<=C.EPSILON*Math.max(1,Math.abs(M),Math.abs(R))&&Math.abs(h-L)<=C.EPSILON*Math.max(1,Math.abs(h),Math.abs(L))&&Math.abs(l-S)<=C.EPSILON*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(v-_)<=C.EPSILON*Math.max(1,Math.abs(v),Math.abs(_))&&Math.abs(d-I)<=C.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(b-N)<=C.EPSILON*Math.max(1,Math.abs(b),Math.abs(N))&&Math.abs(m-Y)<=C.EPSILON*Math.max(1,Math.abs(m),Math.abs(Y))}Object.defineProperty(n,"__esModule",{value:!0}),n.sub=n.mul=void 0,n.create=a,n.clone=e,n.copy=u,n.fromValues=o,n.set=i,n.identity=s,n.transpose=c,n.invert=f,n.adjoint=M,n.determinant=h,n.multiply=l,n.translate=v,n.scale=d,n.rotate=b,n.rotateX=m,n.rotateY=p,n.rotateZ=P,n.fromTranslation=E,n.fromScaling=O,n.fromRotation=x,n.fromXRotation=A,n.fromYRotation=q,n.fromZRotation=y,n.fromRotationTranslation=w,n.getTranslation=R,n.getScaling=L,n.getRotation=S,n.fromRotationTranslationScale=_,n.fromRotationTranslationScaleOrigin=I,n.fromQuat=N,n.frustum=Y,n.perspective=g,n.perspectiveFromFieldOfView=T,n.ortho=j,n.lookAt=D,n.targetTo=V,n.str=z,n.frob=F,n.add=Q,n.subtract=X,n.multiplyScalar=Z,n.multiplyScalarAndAdd=k,n.exactEquals=U,n.equals=W;var B=r(0),C=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(B);n.mul=l,n.sub=X},function(t,n,r){"use strict";function a(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}function e(){var t=new E.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function u(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function o(t,n,r){r*=.5;var a=Math.sin(r);return t[0]=a*n[0],t[1]=a*n[1],t[2]=a*n[2],t[3]=Math.cos(r),t}function i(t,n){var r=2*Math.acos(n[3]),a=Math.sin(r/2);return 0!=a?(t[0]=n[0]/a,t[1]=n[1]/a,t[2]=n[2]/a):(t[0]=1,t[1]=0,t[2]=0),r}function s(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],s=r[1],c=r[2],f=r[3];return t[0]=a*f+o*i+e*c-u*s,t[1]=e*f+o*s+u*i-a*c,t[2]=u*f+o*c+a*s-e*i,t[3]=o*f-a*i-e*s-u*c,t}function c(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s+o*i,t[1]=e*s+u*i,t[2]=u*s-e*i,t[3]=o*s-a*i,t}function f(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s-u*i,t[1]=e*s+o*i,t[2]=u*s+a*i,t[3]=o*s-e*i,t}function M(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),s=Math.cos(r);return t[0]=a*s+e*i,t[1]=e*s-a*i,t[2]=u*s+o*i,t[3]=o*s-u*i,t}function h(t,n){var r=n[0],a=n[1],e=n[2];return t[0]=r,t[1]=a,t[2]=e,t[3]=Math.sqrt(Math.abs(1-r*r-a*a-e*e)),t}function l(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3],s=r[0],c=r[1],f=r[2],M=r[3],h=void 0,l=void 0,v=void 0,d=void 0,b=void 0;return l=e*s+u*c+o*f+i*M,l<0&&(l=-l,s=-s,c=-c,f=-f,M=-M),1-l>1e-6?(h=Math.acos(l),v=Math.sin(h),d=Math.sin((1-a)*h)/v,b=Math.sin(a*h)/v):(d=1-a,b=a),t[0]=d*e+b*s,t[1]=d*u+b*c,t[2]=d*o+b*f,t[3]=d*i+b*M,t}function v(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*r+a*a+e*e+u*u,i=o?1/o:0;return t[0]=-r*i,t[1]=-a*i,t[2]=-e*i,t[3]=u*i,t}function d(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t}function b(t,n){var r=n[0]+n[4]+n[8],a=void 0;if(r>0)a=Math.sqrt(r+1),t[3]=.5*a,a=.5/a,t[0]=(n[5]-n[7])*a,t[1]=(n[6]-n[2])*a,t[2]=(n[1]-n[3])*a;else{var e=0;n[4]>n[0]&&(e=1),n[8]>n[3*e+e]&&(e=2);var u=(e+1)%3,o=(e+2)%3;a=Math.sqrt(n[3*e+e]-n[3*u+u]-n[3*o+o]+1),t[e]=.5*a,a=.5/a,t[3]=(n[3*u+o]-n[3*o+u])*a,t[u]=(n[3*u+e]+n[3*e+u])*a,t[o]=(n[3*o+e]+n[3*e+o])*a}return t}function m(t,n,r,a){var e=.5*Math.PI/180;n*=e,r*=e,a*=e;var u=Math.sin(n),o=Math.cos(n),i=Math.sin(r),s=Math.cos(r),c=Math.sin(a),f=Math.cos(a);return t[0]=u*s*f-o*i*c,t[1]=o*i*f+u*s*c,t[2]=o*s*c-u*i*f,t[3]=o*s*f+u*i*c,t}function p(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}Object.defineProperty(n,"__esModule",{value:!0}),n.setAxes=n.sqlerp=n.rotationTo=n.equals=n.exactEquals=n.normalize=n.sqrLen=n.squaredLength=n.len=n.length=n.lerp=n.dot=n.scale=n.mul=n.add=n.set=n.copy=n.fromValues=n.clone=void 0,n.create=e,n.identity=u,n.setAxisAngle=o,n.getAxisAngle=i,n.multiply=s,n.rotateX=c,n.rotateY=f,n.rotateZ=M,n.calculateW=h,n.slerp=l,n.invert=v,n.conjugate=d,n.fromMat3=b,n.fromEuler=m,n.str=p;var P=r(0),E=a(P),O=r(1),x=a(O),A=r(2),q=a(A),y=r(3),w=a(y),R=(n.clone=w.clone,n.fromValues=w.fromValues,n.copy=w.copy,n.set=w.set,n.add=w.add,n.mul=s,n.scale=w.scale,n.dot=w.dot,n.lerp=w.lerp,n.length=w.length),L=(n.len=R,n.squaredLength=w.squaredLength),S=(n.sqrLen=L,n.normalize=w.normalize);n.exactEquals=w.exactEquals,n.equals=w.equals,n.rotationTo=function(){var t=q.create(),n=q.fromValues(1,0,0),r=q.fromValues(0,1,0);return function(a,e,u){var i=q.dot(e,u);return i<-.999999?(q.cross(t,n,e),q.len(t)<1e-6&&q.cross(t,r,e),q.normalize(t,t),o(a,t,Math.PI),a):i>.999999?(a[0]=0,a[1]=0,a[2]=0,a[3]=1,a):(q.cross(t,e,u),a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=1+i,S(a,a))}}(),n.sqlerp=function(){var t=e(),n=e();return function(r,a,e,u,o,i){return l(t,a,o,i),l(n,e,u,i),l(r,t,n,2*i*(1-i)),r}}(),n.setAxes=function(){var t=x.create();return function(n,r,a,e){return t[0]=a[0],t[3]=a[1],t[6]=a[2],t[1]=e[0],t[4]=e[1],t[7]=e[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],S(n,b(n,t))}}()},function(t,n,r){"use strict";function a(){var t=new V.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t}function e(t){var n=new V.ARRAY_TYPE(2);return n[0]=t[0],n[1]=t[1],n}function u(t,n){var r=new V.ARRAY_TYPE(2);return r[0]=t,r[1]=n,r}function o(t,n){return t[0]=n[0],t[1]=n[1],t}function i(t,n,r){return t[0]=n,t[1]=r,t}function s(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t}function c(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t}function f(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t}function M(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t}function h(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t}function l(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t}function v(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t}function d(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t}function b(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t}function m(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t}function p(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t}function P(t,n){var r=n[0]-t[0],a=n[1]-t[1];return Math.sqrt(r*r+a*a)}function E(t,n){var r=n[0]-t[0],a=n[1]-t[1];return r*r+a*a}function O(t){var n=t[0],r=t[1];return Math.sqrt(n*n+r*r)}function x(t){var n=t[0],r=t[1];return n*n+r*r}function A(t,n){return t[0]=-n[0],t[1]=-n[1],t}function q(t,n){return t[0]=1/n[0],t[1]=1/n[1],t}function y(t,n){var r=n[0],a=n[1],e=r*r+a*a;return e>0&&(e=1/Math.sqrt(e),t[0]=n[0]*e,t[1]=n[1]*e),t}function w(t,n){return t[0]*n[0]+t[1]*n[1]}function R(t,n,r){var a=n[0]*r[1]-n[1]*r[0];return t[0]=t[1]=0,t[2]=a,t}function L(t,n,r,a){var e=n[0],u=n[1];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t}function S(t,n){n=n||1;var r=2*V.RANDOM()*Math.PI;return t[0]=Math.cos(r)*n,t[1]=Math.sin(r)*n,t}function _(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[2]*e,t[1]=r[1]*a+r[3]*e,t}function I(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[2]*e+r[4],t[1]=r[1]*a+r[3]*e+r[5],t}function N(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[3]*e+r[6],t[1]=r[1]*a+r[4]*e+r[7],t}function Y(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[4]*e+r[12],t[1]=r[1]*a+r[5]*e+r[13],t}function g(t){return"vec2("+t[0]+", "+t[1]+")"}function T(t,n){return t[0]===n[0]&&t[1]===n[1]}function j(t,n){var r=t[0],a=t[1],e=n[0],u=n[1];return Math.abs(r-e)<=V.EPSILON*Math.max(1,Math.abs(r),Math.abs(e))&&Math.abs(a-u)<=V.EPSILON*Math.max(1,Math.abs(a),Math.abs(u))}Object.defineProperty(n,"__esModule",{value:!0}),n.forEach=n.sqrLen=n.sqrDist=n.dist=n.div=n.mul=n.sub=n.len=void 0,n.create=a,n.clone=e,n.fromValues=u,n.copy=o,n.set=i,n.add=s,n.subtract=c,n.multiply=f,n.divide=M,n.ceil=h,n.floor=l,n.min=v,n.max=d,n.round=b,n.scale=m,n.scaleAndAdd=p,n.distance=P,n.squaredDistance=E,n.length=O,n.squaredLength=x,n.negate=A,n.inverse=q,n.normalize=y,n.dot=w,n.cross=R,n.lerp=L,n.random=S,n.transformMat2=_,n.transformMat2d=I,n.transformMat3=N,n.transformMat4=Y,n.str=g,n.exactEquals=T,n.equals=j;var D=r(0),V=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n.default=t,n}(D);n.len=O,n.sub=c,n.mul=f,n.div=M,n.dist=P,n.sqrDist=E,n.sqrLen=x,n.forEach=function(){var t=a();return function(n,r,a,e,u,o){var i=void 0,s=void 0;for(r||(r=2),a||(a=0),s=e?Math.min(e*r+a,n.length):n.length,i=a;i { + const logoHeight = height*_LOGO_SCALE; + const svgString = generateXRIconString(cssPrefix, logoHeight) + generateNoXRIconString(cssPrefix, logoHeight); + + return ``; +}; + +/** + * Inject the CSS string to the head of the document + * + * @param {string} cssText the css to inject + */ +const injectCSS = (cssText)=> { + // Create the css + const style = document.createElement('style'); + style.innerHTML = cssText; + + let head = document.getElementsByTagName('head')[0]; + head.insertBefore(style, head.firstChild); +}; + +/** + * Generate DOM element view for button + * + * @return {HTMLElement} + * @param {Object} options + */ +const createDefaultView = (options)=> { + const fontSize = options.height / 3; + if (options.injectCSS) { + // Check that css isnt already injected + if (!_WEBXR_UI_CSS_INJECTED[options.cssprefix]) { + injectCSS(generateCSS(options, fontSize)); + _WEBXR_UI_CSS_INJECTED[options.cssprefix] = true; + } + } + + const el = document.createElement('div'); + el.innerHTML = generateInnerHTML(options.cssprefix, fontSize); + return el.firstChild; +}; + + +const createXRIcon = (cssPrefix, height)=>{ + const el = document.createElement('div'); + el.innerHTML = generateXRIconString(cssPrefix, height); + return el.firstChild; +}; + +const createNoXRIcon = (cssPrefix, height)=>{ + const el = document.createElement('div'); + el.innerHTML = generateNoXRIconString(cssPrefix, height); + return el.firstChild; +}; + +const generateXRIconString = (cssPrefix, height)=> { + let aspect = 28 / 18; + return ` + + `; +}; + +const generateNoXRIconString = (cssPrefix, height)=>{ + let aspect = 28 / 18; + return ` + + + + `; +}; + +/** + * Generate the CSS string to inject + * + * @param {Object} options + * @param {Number} [fontSize=18] + * @return {string} + */ +const generateCSS = (options, fontSize=18)=> { + const height = options.height; + const borderWidth = 2; + const borderColor = options.background ? options.background : options.color; + const cssPrefix = options.cssprefix; + + let borderRadius; + if (options.corners == 'round') { + borderRadius = options.height / 2; + } else if (options.corners == 'square') { + borderRadius = 2; + } else { + borderRadius = options.corners; + } + + return (` + @font-face { + font-family: 'Karla'; + font-style: normal; + font-weight: 400; + src: local('Karla'), local('Karla-Regular'), + url(https://fonts.gstatic.com/s/karla/v5/31P4mP32i98D9CEnGyeX9Q.woff2) format('woff2'); + unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF; + } + @font-face { + font-family: 'Karla'; + font-style: normal; + font-weight: 400; + src: local('Karla'), local('Karla-Regular'), + url(https://fonts.gstatic.com/s/karla/v5/Zi_e6rBgGqv33BWF8WTq8g.woff2) format('woff2'); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, + U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; + } + + button.${cssPrefix}-button { + font-family: 'Karla', sans-serif; + + border: ${borderColor} ${borderWidth}px solid; + border-radius: ${borderRadius}px; + box-sizing: border-box; + background: ${options.background ? options.background : 'none'}; + + height: ${height}px; + min-width: ${fontSize * 9.6}px; + display: inline-block; + position: relative; + + cursor: pointer; + } + + button.${cssPrefix}-button:focus { + outline: none; + } + + /* + * Logo + */ + + .${cssPrefix}-logo { + width: ${height}px; + height: ${height}px; + position: absolute; + top:0px; + left:0px; + width: ${height - 4}px; + height: ${height - 4}px; + } + .${cssPrefix}-svg { + fill: ${options.color}; + margin-top: ${(height - fontSize * _LOGO_SCALE) / 2 - 2}px; + margin-left: ${height / 3 }px; + } + .${cssPrefix}-svg-error { + fill: ${options.color}; + display:none; + margin-top: ${(height - 28 / 18 * fontSize * _LOGO_SCALE) / 2 - 2}px; + margin-left: ${height / 3 }px; + } + + + /* + * Title + */ + + .${cssPrefix}-title { + color: ${options.color}; + position: relative; + font-size: ${fontSize}px; + padding-left: ${height * 1.05}px; + padding-right: ${(borderRadius - 10 < 5) ? height / 3 : borderRadius - 10}px; + } + + /* + * disabled + */ + + button.${cssPrefix}-button[disabled=true] { + opacity: ${options.disabledOpacity}; + } + + button.${cssPrefix}-button[disabled=true] > .${cssPrefix}-logo > .${cssPrefix}-svg { + display:none; + } + + button.${cssPrefix}-button[disabled=true] > .${cssPrefix}-logo > .${cssPrefix}-svg-error { + display:initial; + } + `); +}; + +// +// Button class +// + +class EnterXRButton { + /** + * Construct a new Enter XR Button + * @constructor + * @param {HTMLCanvasElement} sourceCanvas the canvas that you want to present with WebXR + * @param {Object} [options] optional parameters + * @param {HTMLElement} [options.domElement] provide your own domElement to bind to + * @param {Boolean} [options.injectCSS=true] set to false if you want to write your own styles + * @param {Function} [options.beforeEnter] should return a promise, opportunity to intercept request to enter + * @param {Function} [options.beforeExit] should return a promise, opportunity to intercept request to exit + * @param {Function} [options.onRequestStateChange] set to a function returning false to prevent default state changes + * @param {string} [options.textEnterXRTitle] set the text for Enter XR + * @param {string} [options.textXRNotFoundTitle] set the text for when a XR display is not found + * @param {string} [options.textExitXRTitle] set the text for exiting XR + * @param {string} [options.color] text and icon color + * @param {string} [options.background] set to false for no brackground or a color + * @param {string} [options.corners] set to 'round', 'square' or pixel value representing the corner radius + * @param {string} [options.disabledOpacity] set opacity of button dom when disabled + * @param {string} [options.cssprefix] set to change the css prefix from default 'webvr-ui' + */ + constructor(options) { + options = options || {}; + + options.color = options.color || 'rgb(80,168,252)'; + options.background = options.background || false; + options.disabledOpacity = options.disabledOpacity || 0.5; + options.height = options.height || 55; + options.corners = options.corners || 'square'; + options.cssprefix = options.cssprefix || 'webvr-ui'; + + // This reads VR as none of the samples are designed for other formats as of yet. + options.textEnterXRTitle = options.textEnterXRTitle || 'ENTER VR'; + options.textXRNotFoundTitle = options.textXRNotFoundTitle || 'VR NOT FOUND'; + options.textExitXRTitle = options.textExitXRTitle || 'EXIT VR'; + + options.onRequestSession = options.onRequestSession || (function() {}); + options.onEndSession = options.onEndSession || (function() {}); + + options.injectCSS = options.injectCSS !== false; + + this.options = options; + + this.device = null; + this.session = null; + + // Pass in your own domElement if you really dont want to use ours + this.domElement = options.domElement || createDefaultView(options); + this.__defaultDisplayStyle = this.domElement.style.display || 'initial'; + + // Bind button click events to __onClick + this.domElement.addEventListener('click', ()=> this.__onXRButtonClick()); + + this.__forceDisabled = false; + this.__setDisabledAttribute(true); + this.setTitle(this.options.textXRNotFoundTitle); + } + + /** + * Sets the XRDevice this button is associated with. + * @param {XRDevice} device + * @return {EnterXRButton} + */ + setDevice(device) { + this.device = device; + this.__updateButtonState(); + return this; + } + + /** + * Indicate that there's an active XRSession. Switches the button to "Exit XR" + * state if not null, or "Enter XR" state if null. + * @param {XRSession} session + * @return {EnterXRButton} + */ + setSession(session) { + this.session = session; + this.__updateButtonState(); + return this; + } + + /** + * Set the title of the button + * @param {string} text + * @return {EnterXRButton} + */ + setTitle(text) { + this.domElement.title = text; + ifChild(this.domElement, this.options.cssprefix, 'title', (title)=> { + if (!text) { + title.style.display = 'none'; + } else { + title.innerText = text; + title.style.display = 'initial'; + } + }); + + return this; + } + + /** + * Set the tooltip of the button + * @param {string} tooltip + * @return {EnterXRButton} + */ + setTooltip(tooltip) { + this.domElement.title = tooltip; + return this; + } + + /** + * Show the button + * @return {EnterXRButton} + */ + show() { + this.domElement.style.display = this.__defaultDisplayStyle; + return this; + } + + /** + * Hide the button + * @return {EnterXRButton} + */ + hide() { + this.domElement.style.display = 'none'; + return this; + } + + /** + * Enable the button + * @return {EnterXRButton} + */ + enable() { + this.__setDisabledAttribute(false); + this.__forceDisabled = false; + return this; + } + + /** + * Disable the button from being clicked + * @return {EnterXRButton} + */ + disable() { + this.__setDisabledAttribute(true); + this.__forceDisabled = true; + return this; + } + + /** + * clean up object for garbage collection + */ + remove() { + if (this.domElement.parentElement) { + this.domElement.parentElement.removeChild(this.domElement); + } + } + + /** + * Set the disabled attribute + * @param {boolean} disabled + * @private + */ + __setDisabledAttribute(disabled) { + if (disabled || this.__forceDisabled) { + this.domElement.setAttribute('disabled', 'true'); + } else { + this.domElement.removeAttribute('disabled'); + } + } + + /** + * Handling click event from button + * @private + */ + __onXRButtonClick() { + if (this.session) { + this.options.onEndSession(this.session); + } else if (this.device) { + this.options.onRequestSession(this.device); + } + } + + /** + * Updates the display of the button based on it's current state + * @private + */ + __updateButtonState() { + if (this.session) { + this.setTitle(this.options.textExitXRTitle); + this.setTooltip('Exit XR presentation'); + this.__setDisabledAttribute(false); + } else if (this.device) { + this.setTitle(this.options.textEnterXRTitle); + this.setTooltip('Enter XR'); + this.__setDisabledAttribute(false); + } else { + this.setTitle(this.options.textXRNotFoundTitle); + this.setTooltip('No XR headset found.'); + this.__setDisabledAttribute(true); + } + } +} + +/** + * Function checking if a specific css class exists as child of element. + * + * @param {HTMLElement} el element to find child in + * @param {string} cssPrefix css prefix of button + * @param {string} suffix class name + * @param {function} fn function to call if child is found + * @private + */ +const ifChild = (el, cssPrefix, suffix, fn)=> { + const c = el.querySelector('.' + cssPrefix + '-' + suffix); + c && fn(c); +}; + +return EnterXRButton; + +})(); diff --git a/examples/magic-window.html b/examples/magic-window.html new file mode 100644 index 0000000..c811874 --- /dev/null +++ b/examples/magic-window.html @@ -0,0 +1,177 @@ + + + + + + + + + + Magic Window + + + + + + + + + + +
+
+ Magic Window +

+ This sample demonstrates use of a non-exclusive XRSession to present + 'Magic Window' content prior to entering XR presentation with an + exclusive. +

+
+
+ + + diff --git a/examples/media/textures/cube-sea.png b/examples/media/textures/cube-sea.png new file mode 100644 index 0000000..356bc33 Binary files /dev/null and b/examples/media/textures/cube-sea.png differ diff --git a/examples/mirroring.html b/examples/mirroring.html new file mode 100644 index 0000000..ead3833 --- /dev/null +++ b/examples/mirroring.html @@ -0,0 +1,179 @@ + + + + + + + + + + Mirroring + + + + + + + + + + +
+
+ Mirroring +

+ This sample demonstrates how to present a simple WebGL scene to a + XRDevice while mirroring to a context. The scene is not rendered to + the page prior to XR presentation. Mirroring has no effect on mobile + or standalone devices. +

+
+
+
+

Click 'Enter XR' to see content

+
+ + + diff --git a/examples/xr-presentation.html b/examples/xr-presentation.html new file mode 100644 index 0000000..3f05f0c --- /dev/null +++ b/examples/xr-presentation.html @@ -0,0 +1,207 @@ + + + + + + + + + + XR Presentation + + + + + + + + + + + +
+
+ XR Presentation +

+ This sample demonstrates how to present a simple WebGL scene to a + XRDevice. The scene is not rendered to the page prior to XR + presentation, nor is it mirrored during presentation. +

+
+
+
+

Click 'Enter XR' to see content

+
+ + + diff --git a/licenses.txt b/licenses.txt new file mode 100644 index 0000000..5a5759b --- /dev/null +++ b/licenses.txt @@ -0,0 +1,98 @@ +/** + * @license + * webxr-polyfill + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * cardboard-vr-display + * Copyright (c) 2015-2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * webvr-polyfill-dpdb + * Copyright (c) 2017 Google + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @license + * wglu-preserve-state + * Copyright (c) 2016, Brandon Jones. + * + * 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. + */ + +/** + * @license + * nosleep.js + * Copyright (c) 2017, Rich Tibbett + * + * 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. + */ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..2ba7297 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3441 @@ +{ + "name": "webxr-polyfill", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "abab": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", + "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=", + "dev": true + }, + "acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", + "dev": true + }, + "acorn-es7-plugin": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz", + "integrity": "sha1-8u4fMiipDurRJF+asZIusucdM2s=", + "dev": true + }, + "acorn-globals": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz", + "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", + "dev": true, + "requires": { + "acorn": "5.4.1" + }, + "dependencies": { + "acorn": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.4.1.tgz", + "integrity": "sha512-XLmq3H/BVvW6/GbxKryGxWORz1ebilSsUDlyC27bXhWGWAZWkGwS6FLHjOlwFXNFoWFQEO/Df4u0YYd0K3BQgQ==", + "dev": true + } + } + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dev": true, + "requires": { + "acorn": "3.3.0" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "dev": true, + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.0.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "ajv-keywords": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", + "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", + "dev": true + }, + "ansi-escapes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.0.0.tgz", + "integrity": "sha512-O/klc27mWNUigtv0F8NJWbLF00OcegQalkqKURWdosW08YZKi4m6CnSUSvIZG1otNJbTWhN01Hhz389DW7mvDQ==", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", + "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", + "dev": true, + "requires": { + "sprintf-js": "1.0.3" + } + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "1.1.0" + } + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "1.0.3" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + }, + "assertion-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", + "dev": true + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=", + "dev": true + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "1.1.3", + "esutils": "2.0.2", + "js-tokens": "3.0.2" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "2.2.1", + "escape-string-regexp": "1.0.5", + "has-ansi": "2.0.0", + "strip-ansi": "3.0.1", + "supports-color": "2.0.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "babel-core": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-generator": "6.26.0", + "babel-helpers": "6.24.1", + "babel-messages": "6.23.0", + "babel-register": "6.26.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "convert-source-map": "1.5.1", + "debug": "2.6.8", + "json5": "0.5.1", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "path-is-absolute": "1.0.1", + "private": "0.1.8", + "slash": "1.0.0", + "source-map": "0.5.7" + } + }, + "babel-generator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", + "dev": true, + "requires": { + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "detect-indent": "4.0.0", + "jsesc": "1.3.0", + "lodash": "4.17.4", + "source-map": "0.5.7", + "trim-right": "1.0.1" + } + }, + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "dev": true, + "requires": { + "babel-helper-explode-assignable-expression": "6.24.1", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "6.24.1", + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", + "dev": true, + "requires": { + "babel-helper-function-name": "6.24.1", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.4" + } + }, + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "dev": true, + "requires": { + "babel-helper-get-function-arity": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.4" + } + }, + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "dev": true, + "requires": { + "babel-helper-function-name": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true, + "requires": { + "babel-helper-optimise-call-expression": "6.24.1", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-external-helpers": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-external-helpers/-/babel-plugin-external-helpers-6.22.0.tgz", + "integrity": "sha1-IoX0iwK9Xe3oUXXK+MYuhq3M76E=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", + "dev": true + }, + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", + "dev": true + }, + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", + "dev": true + }, + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "dev": true, + "requires": { + "babel-helper-remap-async-to-generator": "6.24.1", + "babel-plugin-syntax-async-functions": "6.13.0", + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "lodash": "4.17.4" + } + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "dev": true, + "requires": { + "babel-helper-define-map": "6.26.0", + "babel-helper-function-name": "6.24.1", + "babel-helper-optimise-call-expression": "6.24.1", + "babel-helper-replace-supers": "6.24.1", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "dev": true, + "requires": { + "babel-helper-function-name": "6.24.1", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz", + "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=", + "dev": true, + "requires": { + "babel-plugin-transform-strict-mode": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-amd": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0" + } + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "dev": true, + "requires": { + "babel-helper-replace-supers": "6.24.1", + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "dev": true, + "requires": { + "babel-helper-call-delegate": "6.24.1", + "babel-helper-get-function-arity": "6.24.1", + "babel-runtime": "6.26.0", + "babel-template": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "dev": true, + "requires": { + "babel-helper-regex": "6.26.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "dev": true, + "requires": { + "babel-helper-regex": "6.26.0", + "babel-runtime": "6.26.0", + "regexpu-core": "2.0.0" + } + }, + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", + "dev": true, + "requires": { + "babel-helper-builder-binary-assignment-operator-visitor": "6.24.1", + "babel-plugin-syntax-exponentiation-operator": "6.13.0", + "babel-runtime": "6.26.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", + "dev": true, + "requires": { + "regenerator-transform": "0.10.1" + } + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0" + } + }, + "babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "core-js": "2.5.3", + "regenerator-runtime": "0.10.5" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "dev": true + } + } + }, + "babel-preset-env": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", + "dev": true, + "requires": { + "babel-plugin-check-es2015-constants": "6.22.0", + "babel-plugin-syntax-trailing-function-commas": "6.22.0", + "babel-plugin-transform-async-to-generator": "6.24.1", + "babel-plugin-transform-es2015-arrow-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "6.22.0", + "babel-plugin-transform-es2015-block-scoping": "6.26.0", + "babel-plugin-transform-es2015-classes": "6.24.1", + "babel-plugin-transform-es2015-computed-properties": "6.24.1", + "babel-plugin-transform-es2015-destructuring": "6.23.0", + "babel-plugin-transform-es2015-duplicate-keys": "6.24.1", + "babel-plugin-transform-es2015-for-of": "6.23.0", + "babel-plugin-transform-es2015-function-name": "6.24.1", + "babel-plugin-transform-es2015-literals": "6.22.0", + "babel-plugin-transform-es2015-modules-amd": "6.24.1", + "babel-plugin-transform-es2015-modules-commonjs": "6.26.0", + "babel-plugin-transform-es2015-modules-systemjs": "6.24.1", + "babel-plugin-transform-es2015-modules-umd": "6.24.1", + "babel-plugin-transform-es2015-object-super": "6.24.1", + "babel-plugin-transform-es2015-parameters": "6.24.1", + "babel-plugin-transform-es2015-shorthand-properties": "6.24.1", + "babel-plugin-transform-es2015-spread": "6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "6.24.1", + "babel-plugin-transform-es2015-template-literals": "6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "6.23.0", + "babel-plugin-transform-es2015-unicode-regex": "6.24.1", + "babel-plugin-transform-exponentiation-operator": "6.24.1", + "babel-plugin-transform-regenerator": "6.26.0", + "browserslist": "2.11.3", + "invariant": "2.2.2", + "semver": "5.5.0" + } + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "requires": { + "babel-core": "6.26.0", + "babel-runtime": "6.26.0", + "core-js": "2.5.3", + "home-or-tmp": "2.0.0", + "lodash": "4.17.4", + "mkdirp": "0.5.1", + "source-map-support": "0.4.18" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "2.5.3", + "regenerator-runtime": "0.11.1" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-traverse": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "lodash": "4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "6.26.0", + "babel-messages": "6.23.0", + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "babylon": "6.18.0", + "debug": "2.6.8", + "globals": "9.18.0", + "invariant": "2.2.2", + "lodash": "4.17.4" + }, + "dependencies": { + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + } + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "esutils": "2.0.2", + "lodash": "4.17.4", + "to-fast-properties": "1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "dev": true, + "requires": { + "hoek": "4.2.0" + } + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "1.8.2", + "preserve": "0.2.0", + "repeat-element": "1.1.2" + } + }, + "browser-process-hrtime": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz", + "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=", + "dev": true + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "browserslist": { + "version": "2.11.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.11.3.tgz", + "integrity": "sha512-yWu5cXT7Av6mVwzWc8lMsJMHWn4xyjSuGYi4IozbVTLUOEYPSagUB8kiMDUHA1fS3zjr8nkxkn9jdvug4BBRmA==", + "dev": true, + "requires": { + "caniuse-lite": "1.0.30000792", + "electron-to-chromium": "1.3.32" + } + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "0.2.0" + } + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30000792", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000792.tgz", + "integrity": "sha1-0M6pgfgRjzlhRxr7tDyaHlu/AzI=", + "dev": true + }, + "cardboard-vr-display": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/cardboard-vr-display/-/cardboard-vr-display-1.0.10.tgz", + "integrity": "sha512-R8TX34zGgz7+8BHfXTBgQzJx18UT7M3PicldYByGic2hR11W1NvyDJllVmCnwBn+pHejsaXVnR1r8uCVsUn01w==", + "requires": { + "gl-preserve-state": "1.0.0", + "nosleep.js": "0.7.0", + "webvr-polyfill-dpdb": "1.0.7" + } + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "dev": true + }, + "chai": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-3.5.0.tgz", + "integrity": "sha1-TQJjewZ/6Vi9v906QOxW/vc3Mkc=", + "dev": true, + "requires": { + "assertion-error": "1.0.2", + "deep-eql": "0.1.3", + "type-detect": "1.0.0" + } + }, + "chalk": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz", + "integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==", + "dev": true, + "requires": { + "ansi-styles": "3.2.0", + "escape-string-regexp": "1.0.5", + "supports-color": "4.5.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "supports-color": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + } + } + }, + "chardet": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "dev": true + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "dev": true + }, + "color-convert": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", + "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "dev": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", + "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.3", + "typedarray": "0.0.6" + } + }, + "content-type-parser": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", + "integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==", + "dev": true + }, + "convert-source-map": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", + "dev": true + }, + "core-js": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", + "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "cross-env": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-5.1.3.tgz", + "integrity": "sha512-UOokgwvDzCT0mqRSLEkJzUhYXB1vK3E5UgDrD41QiXsm9UetcW2rCGHYz/O3p873lMJ1VZbFCF9Izkwh7nYR5A==", + "dev": true, + "requires": { + "cross-spawn": "5.1.0", + "is-windows": "1.0.1" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.1", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "dev": true, + "requires": { + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "dev": true, + "requires": { + "hoek": "4.2.0" + } + } + } + }, + "cssom": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", + "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=", + "dev": true + }, + "cssstyle": { + "version": "0.2.37", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", + "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", + "dev": true, + "requires": { + "cssom": "0.3.2" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-eql": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-0.1.3.tgz", + "integrity": "sha1-71WKyrjeJSBs1xOQbXTlaTDrafI=", + "dev": true, + "requires": { + "type-detect": "0.1.1" + }, + "dependencies": { + "type-detect": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.1.tgz", + "integrity": "sha1-C6XsKohWQORw6k6FBZcZANrFiCI=", + "dev": true + } + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "5.0.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.0", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "rimraf": "2.6.2" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "2.0.1" + } + }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "2.0.2" + } + }, + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "dev": true, + "requires": { + "webidl-conversions": "4.0.2" + } + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "electron-to-chromium": { + "version": "1.3.32", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.32.tgz", + "integrity": "sha1-EdBoTAhA4APEvoko+KxfNdvCtOY=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escodegen": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.0.tgz", + "integrity": "sha512-v0MYvNQ32bzwoG2OSFzWAkuahDQHK92JBN0pTAALJ4RIxEZe766QJPDR8Hqy7XNUy5K3fnVL76OqYAdc4TZEIw==", + "dev": true, + "requires": { + "esprima": "3.1.3", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.5.7" + }, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + } + } + }, + "eslint": { + "version": "4.16.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.16.0.tgz", + "integrity": "sha512-YVXV4bDhNoHHcv0qzU4Meof7/P26B4EuaktMi5L1Tnt52Aov85KmYA8c5D+xyZr/BkhvwUqr011jDSD/QTULxg==", + "dev": true, + "requires": { + "ajv": "5.5.2", + "babel-code-frame": "6.26.0", + "chalk": "2.3.0", + "concat-stream": "1.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.1.0", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "1.0.0", + "espree": "3.5.2", + "esquery": "1.0.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", + "glob": "7.1.2", + "globals": "11.3.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "3.3.0", + "is-resolvable": "1.1.0", + "js-yaml": "3.10.0", + "json-stable-stringify-without-jsonify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.0", + "require-uncached": "1.0.3", + "semver": "5.5.0", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "4.0.2", + "text-table": "0.2.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + } + } + }, + "eslint-config-google": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/eslint-config-google/-/eslint-config-google-0.9.1.tgz", + "integrity": "sha512-5A83D+lH0PA81QMESKbLJd/a3ic8tPZtwUmqNrxMRo54nfFaUvtt89q/+icQ+fd66c2xQHn0KyFkzJDoAUfpZA==", + "dev": true + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "4.2.0", + "estraverse": "4.2.0" + } + }, + "eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", + "dev": true + }, + "espree": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.2.tgz", + "integrity": "sha512-sadKeYwaR/aJ3stC2CdvgXu1T16TdYN+qwCpcWbMnGJ8s0zNWemzrvb2GbD4OhmJ/fwpJjudThAlLobGbWZbCQ==", + "dev": true, + "requires": { + "acorn": "5.4.1", + "acorn-jsx": "3.0.1" + }, + "dependencies": { + "acorn": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.4.1.tgz", + "integrity": "sha512-XLmq3H/BVvW6/GbxKryGxWORz1ebilSsUDlyC27bXhWGWAZWkGwS6FLHjOlwFXNFoWFQEO/Df4u0YYd0K3BQgQ==", + "dev": true + } + } + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "dev": true + }, + "esquery": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", + "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", + "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", + "dev": true, + "requires": { + "estraverse": "4.2.0", + "object-assign": "4.1.1" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "estree-walker": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.2.1.tgz", + "integrity": "sha1-va/oCVOD2EFNXcLs9MkXO225QS4=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "0.1.1" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "2.2.3" + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "dev": true + }, + "external-editor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.1.0.tgz", + "integrity": "sha512-E44iT5QVOUJBKij4IIV3uvxuNlbKS38Tw1HiupxEIHPv9qtC2PrDYohbXV5U+1jnfIXttny8gUhj+oZvflFlzA==", + "dev": true, + "requires": { + "chardet": "0.4.2", + "iconv-lite": "0.4.19", + "tmp": "0.0.33" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fast-async": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/fast-async/-/fast-async-6.3.0.tgz", + "integrity": "sha512-db5wfZ2+cv15bMfXbH9axCslxsTrhquGfkZiVhmUn2gFdNRnp8sweMSH1/9+M0+fHVHhHZBwll3SqCiNlcQhzg==", + "dev": true, + "requires": { + "nodent-compiler": "3.1.3", + "nodent-runtime": "3.0.4" + } + }, + "fast-deep-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" + } + }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "1.3.0", + "object-assign": "4.1.1" + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true, + "requires": { + "is-number": "2.1.0", + "isobject": "2.1.0", + "randomatic": "1.1.7", + "repeat-element": "1.1.2", + "repeat-string": "1.6.1" + } + }, + "flat-cache": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", + "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", + "dev": true, + "requires": { + "circular-json": "0.3.3", + "del": "2.2.2", + "graceful-fs": "4.1.11", + "write": "0.2.1" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "1.0.2" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "dev": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.17" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "1.0.0" + } + }, + "gl-preserve-state": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gl-preserve-state/-/gl-preserve-state-1.0.0.tgz", + "integrity": "sha512-zQZ25l3haD4hvgJZ6C9+s0ebdkW9y+7U2qxvGu1uWOJh8a4RU+jURIKEQhf8elIlFpMH6CrAY2tH0mYrRjet3Q==" + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "2.0.0", + "is-glob": "2.0.1" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "2.0.1" + } + }, + "globals": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.3.0.tgz", + "integrity": "sha512-kkpcKNlmQan9Z5ZmgqKH/SMbSmjxQ7QjyNqfXVc8VJcoBV2UEg+sxQD15GQofGRh2hfpwUb70VC31DR7Rq5Hdw==", + "dev": true + }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "1.0.2", + "arrify": "1.0.1", + "glob": "7.1.1", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "dev": true + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", + "dev": true + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "dev": true, + "requires": { + "ajv": "5.5.2", + "har-schema": "2.0.0" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "dev": true, + "requires": { + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.0", + "sntp": "2.1.0" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hoek": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==", + "dev": true + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "dev": true, + "requires": { + "whatwg-encoding": "1.0.3" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", + "dev": true + }, + "ignore": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", + "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "dev": true, + "requires": { + "ansi-escapes": "3.0.0", + "chalk": "2.3.0", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.1.0", + "figures": "2.0.0", + "lodash": "4.17.4", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + } + }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true, + "requires": { + "loose-envify": "1.3.1" + } + }, + "is-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "1.0.0" + } + }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + } + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", + "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "dev": true, + "requires": { + "is-path-inside": "1.0.1" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "1.0.2" + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-windows": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz", + "integrity": "sha1-MQ23D3QtJZoWo2kgK1GvhCMzENk=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz", + "integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==", + "dev": true, + "requires": { + "argparse": "1.0.9", + "esprima": "4.0.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "jsdom": { + "version": "11.6.2", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.6.2.tgz", + "integrity": "sha512-pAeZhpbSlUp5yQcS6cBQJwkbzmv4tWFaYxHbFVSxzXefqjvtRA851Z5N2P+TguVG9YeUDcgb8pdeVQRJh0XR3Q==", + "dev": true, + "requires": { + "abab": "1.0.4", + "acorn": "5.4.1", + "acorn-globals": "4.1.0", + "array-equal": "1.0.0", + "browser-process-hrtime": "0.1.2", + "content-type-parser": "1.0.2", + "cssom": "0.3.2", + "cssstyle": "0.2.37", + "domexception": "1.0.1", + "escodegen": "1.9.0", + "html-encoding-sniffer": "1.0.2", + "left-pad": "1.2.0", + "nwmatcher": "1.4.3", + "parse5": "4.0.0", + "pn": "1.1.0", + "request": "2.83.0", + "request-promise-native": "1.0.5", + "sax": "1.2.4", + "symbol-tree": "3.2.2", + "tough-cookie": "2.3.3", + "w3c-hr-time": "1.0.1", + "webidl-conversions": "4.0.2", + "whatwg-encoding": "1.0.3", + "whatwg-url": "6.4.0", + "ws": "4.0.0", + "xml-name-validator": "3.0.0" + }, + "dependencies": { + "acorn": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.4.1.tgz", + "integrity": "sha512-XLmq3H/BVvW6/GbxKryGxWORz1ebilSsUDlyC27bXhWGWAZWkGwS6FLHjOlwFXNFoWFQEO/Df4u0YYd0K3BQgQ==", + "dev": true + } + } + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + }, + "left-pad": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.2.0.tgz", + "integrity": "sha1-0wpzxrggHY99jnlWupYWCHpo4O4=", + "dev": true + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "requires": { + "js-tokens": "3.0.2" + } + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "magic-string": { + "version": "0.22.4", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.22.4.tgz", + "integrity": "sha512-kxBL06p6iO2qPBHsqGK2b3cRwiRGpnmSuVWNhwHcMX7qJOUr1HvricYP1LZOCdkQBUp0jiWg2d6WJwR3vYgByw==", + "dev": true, + "requires": { + "vlq": "0.2.3" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "2.0.0", + "array-unique": "0.2.1", + "braces": "1.8.5", + "expand-brackets": "0.1.5", + "extglob": "0.3.2", + "filename-regex": "2.0.1", + "is-extglob": "1.0.0", + "is-glob": "2.0.1", + "kind-of": "3.2.2", + "normalize-path": "2.1.1", + "object.omit": "2.0.1", + "parse-glob": "3.0.4", + "regex-cache": "0.4.4" + } + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=", + "dev": true + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "dev": true, + "requires": { + "mime-db": "1.30.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.8" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.0.0.tgz", + "integrity": "sha512-ukB2dF+u4aeJjc6IGtPNnJXfeby5d4ZqySlIBT0OEyva/DrMjVm5HkQxKnHDLKEfEQBsEnwTg9HHhtPHJdTd8w==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.11.0", + "debug": "3.1.0", + "diff": "3.3.1", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.3", + "he": "1.1.1", + "mkdirp": "0.5.1", + "supports-color": "4.4.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + } + } + }, + "mock-require": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mock-require/-/mock-require-3.0.1.tgz", + "integrity": "sha1-1e/YNMDaDOxzx7Z3Y9gWfTLYUd4=", + "dev": true, + "requires": { + "get-caller-file": "1.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "nodent-compiler": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/nodent-compiler/-/nodent-compiler-3.1.3.tgz", + "integrity": "sha512-pcUC9gIgXXI3mbGjESZfVZO4Vgarw63xYZFRdkqxCDnygvvpiAwzwvvJ7rWqskp72Nk3cxWZY/rYxUIkPT14lw==", + "dev": true, + "requires": { + "acorn": "4.0.13", + "acorn-es7-plugin": "1.1.7", + "source-map": "0.5.7" + } + }, + "nodent-runtime": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/nodent-runtime/-/nodent-runtime-3.0.4.tgz", + "integrity": "sha1-qAHst7sPbDmmmyTML6Nwz6i0kto=", + "dev": true + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "nosleep.js": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.7.0.tgz", + "integrity": "sha1-z9kZwlUjyg0PSmn7MwXAg62u4ok=" + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "nwmatcher": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", + "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==", + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "0.1.5", + "is-extendable": "0.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.2.0" + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + } + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "0.3.0", + "is-dotfile": "1.0.3", + "is-extglob": "1.0.0", + "is-glob": "2.0.1" + } + }, + "parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "2.0.4" + } + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==", + "dev": true + }, + "raf": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.0.tgz", + "integrity": "sha512-pDP/NMRAXoTfrhCfyfSEwJAKLaxBU9eApMeBPB1TkDouZmvPerIClV8lTAd+uF8ZiTaVl69e1FCxQrAd/VTjGw==", + "dev": true, + "requires": { + "performance-now": "2.1.0" + }, + "dependencies": { + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=", + "dev": true + } + } + }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.5" + } + } + } + }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "safe-buffer": "5.1.1", + "string_decoder": "1.0.3", + "util-deprecate": "1.0.2" + } + }, + "regenerate": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz", + "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + }, + "regenerator-transform": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "dev": true, + "requires": { + "babel-runtime": "6.26.0", + "babel-types": "6.26.0", + "private": "0.1.8" + } + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "0.1.3" + } + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true, + "requires": { + "regenerate": "1.3.3", + "regjsgen": "0.2.0", + "regjsparser": "0.1.5" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "1.0.2" + } + }, + "request": { + "version": "2.83.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "dev": true, + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.1", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.17", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.3", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + } + }, + "request-promise-core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", + "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "dev": true, + "requires": { + "lodash": "4.17.4" + } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "dev": true, + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "1.1.1", + "tough-cookie": "2.3.3" + } + }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "0.1.0", + "resolve-from": "1.0.1" + } + }, + "resolve": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", + "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.1" + } + }, + "rollup": { + "version": "0.55.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.55.3.tgz", + "integrity": "sha512-2TgimJ7pk+XfPT0DmAcOqq9qdXlJ04qKyzyLm1WvPS/E6XdXEXyG5u6L8AsjxOaKoEBlYGliPzo99jxwhn2NYQ==", + "dev": true + }, + "rollup-plugin-babel": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-3.0.3.tgz", + "integrity": "sha512-5kzM/Rr4jQSRPLc2eN5NuD+CI/6AAy7S1O18Ogu4U3nq1Q42VJn0C9EMtqnvxtfwf1XrezOtdA9ro1VZI5B0mA==", + "dev": true, + "requires": { + "rollup-pluginutils": "1.5.2" + } + }, + "rollup-plugin-cleanup": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-cleanup/-/rollup-plugin-cleanup-1.0.1.tgz", + "integrity": "sha1-ygVsdP5uoheD+ZhRljsXPL6Ok1k=", + "dev": true, + "requires": { + "acorn": "4.0.13", + "magic-string": "0.22.4", + "rollup-pluginutils": "1.5.2" + } + }, + "rollup-plugin-commonjs": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-8.3.0.tgz", + "integrity": "sha512-PYs3OiYgENFYEmI3vOEm5nrp3eY90YZqd5vGmQqeXmhJsAWFIrFdROCvOasqJ1HgeTvqyYo9IGXnFDyoboNcgQ==", + "dev": true, + "requires": { + "acorn": "5.4.1", + "estree-walker": "0.5.1", + "magic-string": "0.22.4", + "resolve": "1.5.0", + "rollup-pluginutils": "2.0.1" + }, + "dependencies": { + "acorn": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.4.1.tgz", + "integrity": "sha512-XLmq3H/BVvW6/GbxKryGxWORz1ebilSsUDlyC27bXhWGWAZWkGwS6FLHjOlwFXNFoWFQEO/Df4u0YYd0K3BQgQ==", + "dev": true + }, + "estree-walker": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.5.1.tgz", + "integrity": "sha512-7HgCgz1axW7w5aOvgOQkoR1RMBkllygJrssU3BvymKQ95lxXYv6Pon17fBRDm9qhkvXZGijOULoSF9ShOk/ZLg==", + "dev": true + }, + "rollup-pluginutils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz", + "integrity": "sha1-fslbNXP2VDpGpkYb2afFRFJdD8A=", + "dev": true, + "requires": { + "estree-walker": "0.3.1", + "micromatch": "2.3.11" + }, + "dependencies": { + "estree-walker": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.3.1.tgz", + "integrity": "sha1-5rGlHPcpJSTnI3wxLl/mZgwc4ao=", + "dev": true + } + } + } + } + }, + "rollup-plugin-node-resolve": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.2.tgz", + "integrity": "sha512-ZwmMip/yqw6cmDQJuCQJ1G7gw2z11iGUtQNFYrFZHmqadRHU+OZGC3nOXwXu+UTvcm5lzDspB1EYWrkTgPWybw==", + "dev": true, + "requires": { + "builtin-modules": "1.1.1", + "is-module": "1.0.0", + "resolve": "1.5.0" + } + }, + "rollup-plugin-replace": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-replace/-/rollup-plugin-replace-2.0.0.tgz", + "integrity": "sha512-pK9mTd/FNrhtBxcTBXoh0YOwRIShV0gGhv9qvUtNcXHxIMRZMXqfiZKVBmCRGp8/2DJRy62z2JUE7/5tP6WxOQ==", + "dev": true, + "requires": { + "magic-string": "0.22.4", + "minimatch": "3.0.4", + "rollup-pluginutils": "2.0.1" + }, + "dependencies": { + "estree-walker": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.3.1.tgz", + "integrity": "sha1-5rGlHPcpJSTnI3wxLl/mZgwc4ao=", + "dev": true + }, + "rollup-pluginutils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz", + "integrity": "sha1-fslbNXP2VDpGpkYb2afFRFJdD8A=", + "dev": true, + "requires": { + "estree-walker": "0.3.1", + "micromatch": "2.3.11" + } + } + } + }, + "rollup-plugin-uglify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-uglify/-/rollup-plugin-uglify-3.0.0.tgz", + "integrity": "sha512-dehLu9eRRoV4l09aC+ySntRw1OAfoyKdbk8Nelblj03tHoynkSybqyEpgavemi1LBOH6S1vzI58/mpxkZIe1iQ==", + "dev": true, + "requires": { + "uglify-es": "3.3.9" + } + }, + "rollup-pluginutils": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz", + "integrity": "sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=", + "dev": true, + "requires": { + "estree-walker": "0.2.1", + "minimatch": "3.0.4" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "2.1.0" + } + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", + "dev": true + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "dev": true, + "requires": { + "rx-lite": "4.0.8" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "dev": true + }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + } + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "dev": true, + "requires": { + "hoek": "4.2.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "0.5.7" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "dev": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + } + }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + } + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true, + "requires": { + "has-flag": "2.0.0" + } + }, + "symbol-tree": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=", + "dev": true + }, + "table": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", + "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "dev": true, + "requires": { + "ajv": "5.5.2", + "ajv-keywords": "2.1.1", + "chalk": "2.3.0", + "lodash": "4.17.4", + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "tough-cookie": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "dev": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "dev": true, + "requires": { + "punycode": "2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=", + "dev": true + } + } + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2" + } + }, + "type-detect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", + "integrity": "sha1-diIXzAbbJY7EiQihKY6LlRIejqI=", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "dev": true, + "requires": { + "commander": "2.13.0", + "source-map": "0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", + "dev": true + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + }, + "vlq": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/vlq/-/vlq-0.2.3.tgz", + "integrity": "sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow==", + "dev": true + }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "dev": true, + "requires": { + "browser-process-hrtime": "0.1.2" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "dev": true + }, + "webvr-polyfill-dpdb": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/webvr-polyfill-dpdb/-/webvr-polyfill-dpdb-1.0.7.tgz", + "integrity": "sha512-6G3i48V/0qkvDVfDDi2hYh53afMiE/f0zwY4Ujl23qEiBiJL7rBqMC+muk7ur7JyhNCP9Xs+fbf1PVvAGew4zA==" + }, + "whatwg-encoding": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", + "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==", + "dev": true, + "requires": { + "iconv-lite": "0.4.19" + } + }, + "whatwg-url": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.4.0.tgz", + "integrity": "sha512-Z0CVh/YE217Foyb488eo+iBv+r7eAQ0wSTyApi9n06jhcA3z6Nidg/EGvl0UFkg7kMdKxfBzzr+o9JF+cevgMg==", + "dev": true, + "requires": { + "lodash.sortby": "4.7.0", + "tr46": "1.0.1", + "webidl-conversions": "4.0.2" + } + }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "0.5.1" + } + }, + "ws": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-4.0.0.tgz", + "integrity": "sha512-QYslsH44bH8O7/W2815u5DpnCpXWpEK44FmaHffNwgJI4JMaSZONgPBTOfrxJ29mXKbXak+LsJ2uAkDTYq2ptQ==", + "dev": true, + "requires": { + "async-limiter": "1.0.0", + "safe-buffer": "5.1.1", + "ultron": "1.1.1" + } + }, + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..f229b85 --- /dev/null +++ b/package.json @@ -0,0 +1,55 @@ +{ + "name": "webxr-polyfill", + "version": "1.0.0", + "homepage": "https://github.com/immersive-web/webxr-polyfill", + "main": "build/webxr-polyfill.js", + "module": "build/webxr-polyfill.module.js", + "authors": [ + "Jordan Santell " + ], + "description": "Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard.", + "devDependencies": { + "babel-core": "^6.26.0", + "babel-plugin-external-helpers": "^6.22.0", + "babel-polyfill": "^6.26.0", + "babel-preset-env": "^1.6.0", + "chai": "^3.5.0", + "cross-env": "^5.1.3", + "eslint": "^4.16.0", + "eslint-config-google": "^0.9.1", + "fast-async": "^6.3.0", + "jsdom": "^11.6.2", + "mocha": "^5.0.0", + "mock-require": "^3.0.1", + "raf": "^3.4.0", + "rollup": "^0.55.3", + "rollup-plugin-babel": "^3.0.2", + "rollup-plugin-cleanup": "^1.0.1", + "rollup-plugin-commonjs": "^8.3.0", + "rollup-plugin-node-resolve": "^3.0.0", + "rollup-plugin-replace": "^2.0.0", + "rollup-plugin-uglify": "^3.0.0", + "semver": "^5.5.0", + "uglify-es": "^3.3.9" + }, + "keywords": [ + "vr", + "webvr", + "webxr" + ], + "license": "Apache-2.0", + "scripts": { + "build-script": "cross-env NODE_ENV=production rollup -c", + "build-module": "cross-env NODE_ENV=production rollup -c rollup.config.module.js", + "build-min": "cross-env NODE_ENV=production rollup -c rollup.config.min.js", + "build": "npm run build-script && npm run build-min && npm run build-module", + "test": "cross-env NODE_ENV=test mocha --require ./test/setup.js --require babel-core/register --exit --recursive" + }, + "repository": "immersive-web/webxr-polyfill", + "bugs": { + "url": "https://github.com/immersive-web/webxr-polyfill/issues" + }, + "dependencies": { + "cardboard-vr-display": "1.0.10" + } +} diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..399dcbf --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,46 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; +import path from 'path'; +import commonjs from 'rollup-plugin-commonjs'; +import replace from 'rollup-plugin-replace'; +import resolve from 'rollup-plugin-node-resolve'; +import cleanup from 'rollup-plugin-cleanup'; +import babel from 'rollup-plugin-babel'; +const banner = fs.readFileSync(path.join(__dirname, 'licenses.txt')); + +export default { + input: 'src/index.js', + output: { + file: './build/webxr-polyfill.js', + format: 'umd', + name: 'WebXRPolyfill', + banner: banner, + }, + plugins: [ + replace({ + 'process.env.NODE_ENV': JSON.stringify('production'), + }), + babel({ + exclude: 'node_modules/**', + }), + resolve(), + commonjs(), + cleanup({ + comments: 'none', + }), + ], +}; diff --git a/rollup.config.min.js b/rollup.config.min.js new file mode 100644 index 0000000..d7c1c09 --- /dev/null +++ b/rollup.config.min.js @@ -0,0 +1,40 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import defaultConfig from './rollup.config'; +import uglify from 'rollup-plugin-uglify'; +import { minify } from 'uglify-es'; + +export default Object.assign({}, defaultConfig, { + output: { + file: './build/webxr-polyfill.min.js', + format: defaultConfig.output.format, + name: defaultConfig.output.name, + banner: defaultConfig.output.banner, + }, + plugins: [...defaultConfig.plugins, uglify({ + output: { + // Preserve license commenting in minified build: + // https://github.com/TrySound/rollup-plugin-uglify/blob/master/README.md#comments + comments: function(node, comment) { + const { value, type } = comment; + if (type == "comment2") { + // multiline comment + return /@preserve|@license|@cc_on/i.test(value); + } + } + } + }, minify)], +}); diff --git a/rollup.config.module.js b/rollup.config.module.js new file mode 100644 index 0000000..e2e0d95 --- /dev/null +++ b/rollup.config.module.js @@ -0,0 +1,41 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; +import path from 'path'; +import commonjs from 'rollup-plugin-commonjs'; +import replace from 'rollup-plugin-replace'; +import resolve from 'rollup-plugin-node-resolve'; +import cleanup from 'rollup-plugin-cleanup'; +const banner = fs.readFileSync(path.join(__dirname, 'licenses.txt')); + +export default { + input: 'src/WebXRPolyfill.js', + output: { + file: './build/webxr-polyfill.module.js', + format: 'es', + banner: banner, + }, + plugins: [ + replace({ + 'process.env.NODE_ENV': JSON.stringify('production'), + }), + resolve(), + commonjs(), + cleanup({ + comments: 'none', + }), + ], +}; diff --git a/src/WebXRPolyfill.js b/src/WebXRPolyfill.js new file mode 100644 index 0000000..03959b9 --- /dev/null +++ b/src/WebXRPolyfill.js @@ -0,0 +1,105 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import GLOBAL from './lib/global'; +import API from './api/index'; +import XR from './api/XR'; +import { + extendContextCompatibleXRDevice, + extendGetContext +} from './extend-globals'; +import { isMobile } from './utils'; +import { requestDevice } from './devices'; + +const CONFIG_DEFAULTS = { + // Whether support for a browser implementing WebVR 1.1 is enabled. + // If enabled, XR support is powered by native WebVR 1.1 VRDisplays, + // exposed as XRDevices. + webvr: true, + // Whether a CardboardXRDevice should be discoverable if on + // a mobile device, and no other native (1.1 VRDisplay if `webvr` on, + // or XRDevice) found. + cardboard: true, +}; + +const partials = ['navigator', 'HTMLCanvasElement', 'WebGLRenderingContext']; + +export default class WebXRPolyfill { + /** + * @param {object} global + * @param {object?} config + */ + constructor(global, config={}) { + this.global = global || GLOBAL; + this.config = Object.freeze(Object.assign({}, CONFIG_DEFAULTS, config)); + this.nativeWebXR = 'xr' in this.global.navigator; + this.injected = false; + + // If no native WebXR implementation found, inject one + if (!this.nativeWebXR) { + this._injectPolyfill(this.global); + } + // If an implementation exists, on mobile, and cardboard enabled, + // patch `xr.requestDevice` so that we can return a cardboard display + // if there are no native devices + else if (this.config.cardboard && isMobile(this.global)) { + this._patchRequestDevice(); + } + } + + _injectPolyfill(global) { + if (!partials.every(iface => !!global[iface])) { + throw new Error(`Global must have the following attributes : ${partials}`); + } + + // Apply classes as globals + for (const className of Object.keys(API)) { + if (global[className] !== undefined) { + console.warn(`${className} already defined on global.`); + } else { + global[className] = API[className]; + } + } + + // Test environment does not have rendering contexts + if (process.env.NODE_ENV !== 'test') { + // Attempts to polyfill WebGLRenderingContext's `setCompatibleXRDevice` + // if it does not exist. + const polyfilledCtx = extendContextCompatibleXRDevice(global.WebGLRenderingContext); + + // If we polyfilled `setCompatibleXRDevice`, also polyfill the context creation + // parameter `{ compatibleXRDevice }`. Also assume that we need to polyfill + // `ctx.getContext('xrpresent')` + if (polyfilledCtx) { + extendGetContext(global.HTMLCanvasElement); + } + } + + this.injected = true; + + this._patchRequestDevice(); + } + + _patchRequestDevice() { + // Create `navigator.xr` instance and populate + // with polyfilled XRDevices + const device = requestDevice(this.global, this.config); + this.xr = new XR(device); + Object.defineProperty(this.global.navigator, 'xr', { + value: this.xr, + configurable: true, + }); + } +} diff --git a/src/api/XR.js b/src/api/XR.js new file mode 100644 index 0000000..e67154d --- /dev/null +++ b/src/api/XR.js @@ -0,0 +1,42 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import EventTarget from '../lib/EventTarget'; + +const PRIVATE = Symbol('@@webxr-polyfill/XR'); + +export default class XR extends EventTarget { + /** + * Receives a promise of an XRDevice, so that the polyfill + * can pass in some initial checks to asynchronously provide XRDevics + * if content immediately requests `requestDevice()`. + * + * @param {Promise} device + */ + constructor(device) { + super(); + this[PRIVATE] = { + device, + }; + } + + async requestDevice() { + const device = await this[PRIVATE].device; + if (device) { + return device; + } + throw new Error('NotFoundError'); + } +} diff --git a/src/api/XRCoordinateSystem.js b/src/api/XRCoordinateSystem.js new file mode 100644 index 0000000..2637e55 --- /dev/null +++ b/src/api/XRCoordinateSystem.js @@ -0,0 +1,28 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import EventTarget from '../lib/EventTarget'; + +export default class XRCoordinateSystem { + constructor() {} + + /** + * @param {XRCoordinateSystem} other + * @return {Float32Array?} + */ + getTransformTo(other) { + throw new Error('Not yet supported'); + } +} diff --git a/src/api/XRDevice.js b/src/api/XRDevice.js new file mode 100644 index 0000000..826167b --- /dev/null +++ b/src/api/XRDevice.js @@ -0,0 +1,106 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import EventTarget from '../lib/EventTarget'; +import XRSession, { XRSessionCreationOptions, validateSessionOptions } from './XRSession'; + +const PRIVATE = Symbol('@@webxr-polyfill/XRDevice'); + +export default class XRDevice extends EventTarget { + /** + * Pass in an instance of a PolyfilledXRDevice which exposes + * an interface that provides platform specific code, backed + * by Cardboard, Native 1.1 HMD, etc. + * + * @see ./src/devices/PolyfilledXRDevice.js + * + * @param {PolyfilledXRDevice} polyfill + */ + constructor(polyfill) { + if (!polyfill) { + throw new Error('XRDevice must receive a PolyfilledXRDevice.'); + } + + super(); + + if (process.env.NODE_ENV === 'test') { + this.polyfill = polyfill; + } + + this[PRIVATE] = { + polyfill, + exclusiveSession: null, + nonExclusiveSessions: new Set(), + } + + this.ondeactive = undefined; + } + + /** + * @param {XRSessionCreationOptions} sessionOptions + * @return {Promise} + */ + async supportsSession(sessionOptions={}) { + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + if (!validateSessionOptions(sessionOptions)) { + return Promise.reject(null); + } + + if (!this[PRIVATE].polyfill.supportsSession(sessionOptions)) { + return Promise.reject(null); + }; + + return null; + } + + /** + * @param {XRSessionCreationOptions} sessionOptions + * @return {Promise} + */ + async requestSession(sessionOptions) { + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + if (!validateSessionOptions(sessionOptions)) { + throw new Error('NotSupportedError'); + } + + if (this[PRIVATE].exclusiveSession && sessionOptions.exclusive) { + throw new Error('InvalidStateError'); + } + + // Call polyfill's requestSession, which validates the sessionOptions + // and does some initialization (1.1 fallback calls `vrDisplay.requestPresent()` + // for example). Could throw due to missing user gesture. + const sessionId = await this[PRIVATE].polyfill.requestSession(sessionOptions); + const session = new XRSession(this[PRIVATE].polyfill, this, sessionOptions, sessionId); + + if (sessionOptions.exclusive) { + this[PRIVATE].exclusiveSession = session; + } else { + this[PRIVATE].nonExclusiveSessions.add(session); + } + + const onSessionEnd = () => { + if (session.exclusive) { + this[PRIVATE].exclusiveSession = null; + } else { + this[PRIVATE].nonExclusiveSessions.delete(session); + } + session.removeEventListener('end', onSessionEnd); + }; + session.addEventListener('end', onSessionEnd); + + return session; + } +} diff --git a/src/api/XRDevicePose.js b/src/api/XRDevicePose.js new file mode 100644 index 0000000..81d3000 --- /dev/null +++ b/src/api/XRDevicePose.js @@ -0,0 +1,72 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const PRIVATE = Symbol('@@webxr-polyfill/XRDevicePose'); +import { mat4_identity } from '../math'; + +export default class XRDevicePose { + /** + * @param {PolyfilledXRDevice} polyfill + */ + constructor(polyfill) { + this[PRIVATE] = { + polyfill, + leftViewMatrix: mat4_identity(new Float32Array(16)), + rightViewMatrix: mat4_identity(new Float32Array(16)), + poseModelMatrix: mat4_identity(new Float32Array(16)), + }; + } + + /** + * @return {Float32Array} + */ + get poseModelMatrix() { return this[PRIVATE].poseModelMatrix; } + + /** + * @param {XRView} view + * @return Float32Array + */ + getViewMatrix(view) { + switch (view.eye) { + case 'left': return this[PRIVATE].leftViewMatrix; + case 'right': return this[PRIVATE].rightViewMatrix; + } + throw new Error(`view is not a valid XREye`); + } + + /** + * NON-STANDARD + * + * @param {XRFrameOfReference} frameOfRef + */ + updateFromFrameOfReference(frameOfRef) { + const pose = this[PRIVATE].polyfill.getBasePoseMatrix(); + const leftViewMatrix = this[PRIVATE].polyfill.getBaseViewMatrix('left'); + const rightViewMatrix = this[PRIVATE].polyfill.getBaseViewMatrix('right'); + + if (pose) { + frameOfRef.transformBasePoseMatrix(this[PRIVATE].poseModelMatrix, pose); + } + + if (leftViewMatrix && rightViewMatrix) { + frameOfRef.transformBaseViewMatrix(this[PRIVATE].leftViewMatrix, + leftViewMatrix, + this[PRIVATE].poseModelMatrix); + frameOfRef.transformBaseViewMatrix(this[PRIVATE].rightViewMatrix, + rightViewMatrix, + this[PRIVATE].poseModelMatrix); + } + } +} diff --git a/src/api/XRFrameOfReference.js b/src/api/XRFrameOfReference.js new file mode 100644 index 0000000..64bf830 --- /dev/null +++ b/src/api/XRFrameOfReference.js @@ -0,0 +1,179 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XRCoordinateSystem from './XRCoordinateSystem'; +import { mat4_copy, mat4_identity, mat4_multiply, mat4_invert } from '../math'; + +const PRIVATE = Symbol('@@webxr-polyfill/XRFrameOfReference'); +const DEFAULT_EMULATION_HEIGHT = 1.6; + +export const XRFrameOfReferenceTypes = ['headModel', 'eyeLevel', 'stage']; + +export const XRFrameOfReferenceOptions = Object.freeze({ + disableStageEmulation: false, + stageEmulationHeight: 0, +}); + +export default class XRFrameOfReference extends XRCoordinateSystem { + /** + * Optionally takes a `transform` from a polyfill's requestFrameOfReferenceMatrix + * so polyfill's can provide their own transforms for stage (or if they + * wanted to override eyeLevel/headModel). + * + * @param {PolyfilledXRDevice} polyfill + * @param {XRFrameOfReferenceType} type + * @param {XRFrameOfReferenceOptions} options + * @param {Float32Array?} transform + * @param {?} bounds + */ + constructor(polyfill, type, options, transform, bounds) { + options = Object.assign({}, XRFrameOfReferenceOptions, options); + + if (!XRFrameOfReferenceTypes.includes(type)) { + throw new Error(`XRFrameOfReferenceType must be one of ${XRFrameOfReferenceTypes}`); + } + + super(); + + // If stage emulation is disabled, and this is a stage frame of reference, + // and the PolyfilledXRDevice did not provide a transform, this is an invalid + // configuration and we shouldn't emulate here. XRSession.requestFrameOfReference + // should check this as well. + if (type === 'stage' && options.disableStageEmulation && !transform) { + throw new Error(`XRFrameOfReference cannot use 'stage' type, if disabling emulation and platform does not provide`); + } + + const { disableStageEmulation, stageEmulationHeight } = options; + + let emulatedHeight = 0; + // If we're using stage reference and no transform, we're emulating. + // Set emulated height from option or use the default + if (type === 'stage' && !transform) { + emulatedHeight = stageEmulationHeight !== 0 ? stageEmulationHeight : DEFAULT_EMULATION_HEIGHT; + } + + // If we're emulating the stage, and the polyfill did not provide + // a transform, create one here + if (type === 'stage' && !transform) { + // Apply emulatedHeight to the `y` translation + transform = mat4_identity(new Float32Array(16)); + transform[13] = emulatedHeight; + } + + this[PRIVATE] = { + disableStageEmulation, + stageEmulationHeight, + emulatedHeight, + type, + transform, + polyfill, + bounds, + }; + this.onboundschange = undefined; + } + + /** + * @return {XRStageBounds?} + */ + get bounds() { return this[PRIVATE].bounds; } + + /** + * @return {number} + */ + get emulatedHeight() { return this[PRIVATE].emulatedHeight; } + + /** + * NON-STANDARD + * + * @return {XRFrameOfReferenceType} + */ + get type() { return this[PRIVATE].type; } + + /** + * NON-STANDARD + * Takes a base pose model matrix and transforms it by the + * frame of reference. + * + * @param {Float32Array} out + * @param {Float32Array} pose + */ + transformBasePoseMatrix(out, pose) { + // If we have a transform, it was provided by the polyfill + // (probably "stage" type, but a polyfill could provide its own headModel) + // or we could be emulating a stage, in which case a transform + // was created in the constructor. Either way, if we have a transform, use it. + if (this[PRIVATE].transform) { + mat4_multiply(out, this[PRIVATE].transform, pose); + return; + } + + switch (this.type) { + // For 'headModel' just strip out the translation + case 'headModel': + if (out !== pose) { + mat4_copy(out, pose); + } + + out[12] = out[13] = out[14] = 0; + return; + + // For 'eyeLevel', assume the pose given as eye level, + // so no transformation + case 'eyeLevel': + if (out !== pose) { + mat4_copy(out, pose); + } + + return; + } + } + + /** + * NON-STANDARD + * Takes a base view matrix and transforms it by the + * pose matrix frame of reference. + * + * @param {Float32Array} out + * @param {Float32Array} view + */ + transformBaseViewMatrix(out, view) { + // If we have a transform (native or emulated stage), + // use it + let frameOfRef = this[PRIVATE].transform; + + if (frameOfRef) { + mat4_invert(out, frameOfRef); + mat4_multiply(out, view, out); + } + // If we have a head model, invert the view matrix + // to strip the translation and invert it back to a + // view matrix + else if (this.type === 'headModel') { + mat4_invert(out, view); + out[12] = 0; + out[13] = 0; + out[14] = 0; + mat4_invert(out, out); + return out; + } + // Otherwise don't transform the view matrix at all + // (like for `eyeLevel` frame of references. + else { + mat4_copy(out, view); + } + + return out; + } +} diff --git a/src/api/XRLayer.js b/src/api/XRLayer.js new file mode 100644 index 0000000..c3637c2 --- /dev/null +++ b/src/api/XRLayer.js @@ -0,0 +1,32 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default class XRLayer { + constructor() {} + + /** + * @TODO No mention in spec on not reusing the XRViewport + * on every frame + * + * @param {XRView} view + * @return {XRViewport?} + */ + getViewport(view) { + // TODO In the future maybe all this logic should be handled + // by the XRLayer? It's a bit difficult as this is one of the few + // classes directly instantiated by content rather. + return view._getViewport(this); + } +} diff --git a/src/api/XRPresentationContext.js b/src/api/XRPresentationContext.js new file mode 100644 index 0000000..874a64d --- /dev/null +++ b/src/api/XRPresentationContext.js @@ -0,0 +1,34 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const PRIVATE = Symbol('@@webxr-polyfill/XRPresentationContext'); + +export default class XRPresentationContext { + /** + * @param {HTMLCanvasElement} canvas + * @param {WebGLRenderingContext} ctx + * @param {Object?} glAttribs + */ + constructor(canvas, ctx, glAttribs) { + this[PRIVATE] = { canvas, ctx, glAttribs }; + + Object.assign(this, ctx); + } + + /** + * @return {HTMLCanvasElement} + */ + get canvas() { return this[PRIVATE].canvas; } +} diff --git a/src/api/XRPresentationFrame.js b/src/api/XRPresentationFrame.js new file mode 100644 index 0000000..51ab1aa --- /dev/null +++ b/src/api/XRPresentationFrame.js @@ -0,0 +1,67 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XRDevicePose from './XRDevicePose'; +import XRView from './XRView'; + +const PRIVATE = Symbol('@@webxr-polyfill/XRPresentationFrame'); + +export default class XRPresentationFrame { + /** + * @param {PolyfilledXRDevice} polyfill + * @param {XRSession} session + * @param {number} sessionId + */ + constructor(polyfill, session, sessionId) { + const devicePose = new XRDevicePose(polyfill); + + // Non-exclusive sessions only have a monoscopic view. + const views = [ + new XRView(polyfill, 'left', sessionId), + ]; + + if (session.exclusive) { + views.push(new XRView(polyfill, 'right', sessionId)); + } + + this[PRIVATE] = { + polyfill, + devicePose, + views, + session, + }; + } + + /** + * @TODO Not in spec, but used in sample code? + * + * @return {XRSession} session + */ + get session() { return this[PRIVATE].session; } + + /** + * @return {Array} views + */ + get views() { return this[PRIVATE].views; } + + /** + * @param {XRCoordinateSystem} coordinateSystem + * @return {XRDevicePose?} + */ + getDevicePose(coordinateSystem) { + this[PRIVATE].devicePose.updateFromFrameOfReference(coordinateSystem); + return this[PRIVATE].devicePose; + } +} diff --git a/src/api/XRSession.js b/src/api/XRSession.js new file mode 100644 index 0000000..eed27a3 --- /dev/null +++ b/src/api/XRSession.js @@ -0,0 +1,288 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import EventTarget from '../lib/EventTarget'; +import now from '../lib/now'; +import XRPresentationContext from './XRPresentationContext'; +import XRPresentationFrame from './XRPresentationFrame'; +import XRStageBounds from './XRStageBounds'; +import XRFrameOfReference, { + XRFrameOfReferenceTypes, + XRFrameOfReferenceOptions, +} from './XRFrameOfReference'; + +const PRIVATE = Symbol('@@webxr-polyfill/XRSession'); + +export const XRSessionCreationOptions = Object.freeze({ + exclusive: false, + outputContext: undefined, +}); + +/** + * @param {XRSessionCreationOptions} options + * @return boolean + */ +export const validateSessionOptions = options => { + const { exclusive, outputContext } = options; + + // If not an exclusive session, an outputContext must be defined + if (!exclusive && !outputContext) { + return false; + } + + // If outputContext exists, it must be a XRPresentationContext + if (outputContext !== undefined && !(outputContext instanceof XRPresentationContext)) { + return false; + } + + return true; +}; + +export default class XRSession extends EventTarget { + /** + * @param {PolyfilledXRDevice} polyfill + * @param {XRDevice} device + * @param {XRSessionCreationOptions} sessionOptions + * @param {number} id + */ + constructor(polyfill, device, sessionOptions, id) { + sessionOptions = Object.assign({}, XRSessionCreationOptions, sessionOptions); + + super(); + + const { exclusive, outputContext } = sessionOptions; + + this[PRIVATE] = { + polyfill, + device, + exclusive, + outputContext, + ended: false, + suspended: false, + suspendedCallback: null, + id, + }; + + const frame = new XRPresentationFrame(polyfill, this, this[PRIVATE].id); + this[PRIVATE].frame = frame; + + // Hook into the PolyfilledXRDisplay's `vr-present-end` event so we can + // wrap up things here if we're cut off from the underlying + // polyfilled device or explicitly ended via `session.end()` for this + // session. + this[PRIVATE].onPresentationEnd = sessionId => { + // If this session was suspended, resume it now that an exclusive + // session has ended. + if (sessionId !== this[PRIVATE].id) { + this[PRIVATE].suspended = false; + + this.dispatchEvent('focus', { session: this }); + const suspendedCallback = this[PRIVATE].suspendedCallback; + this[PRIVATE].suspendedCallback = null; + if (suspendedCallback) { + this.requestAnimationFrame(suspendedCallback); + } + return; + } + + // Otherwise, this is the exclusive session that has ended. + // Set `ended` to true so we can disable all functionality + // in this XRSession + this[PRIVATE].ended = true; + polyfill.removeEventListener('@webvr-polyfill/vr-present-end', this[PRIVATE].onPresentationEnd); + polyfill.removeEventListener('@webvr-polyfill/vr-present-start', this[PRIVATE].onPresentationStart); + this.dispatchEvent('end', { session: this }); + }; + polyfill.addEventListener('@@webxr-polyfill/vr-present-end', this[PRIVATE].onPresentationEnd); + + + // Hook into the PolyfilledXRDisplay's `vr-present-start` event so we can + // suspend if another session has begun exclusive presentation. + this[PRIVATE].onPresentationStart = sessionId => { + // Ignore if this is the session that has begun exclusive presenting + if (sessionId === this[PRIVATE].id) { + return; + } + + this[PRIVATE].suspended = true; + this.dispatchEvent('blur', { session: this }); + }; + polyfill.addEventListener('@@webxr-polyfill/vr-present-start', this[PRIVATE].onPresentationStart); + + this.onblur = undefined; + this.onfocus = undefined; + this.onresetpose = undefined; + this.onend = undefined; + } + + /** + * @return {XRDevice} + */ + get device() { return this[PRIVATE].device; } + + /** + * @return {boolean} + */ + get exclusive() { return this[PRIVATE].exclusive; } + + /** + * @return {WebGLRenderingContext} + */ + get outputContext() { return this[PRIVATE].outputContext; } + + /** + * @return {number} + */ + get depthNear() { return this[PRIVATE].polyfill.depthNear; } + + /** + * @param {number} + */ + set depthNear(value) { this[PRIVATE].polyfill.depthNear = value; } + + /** + * @return {number} + */ + get depthFar() { return this[PRIVATE].polyfill.depthFar; } + + /** + * @param {number} + */ + set depthFar(value) { this[PRIVATE].polyfill.depthFar = value; } + + /** + * @return {XRLayer} + */ + get baseLayer() { return this[PRIVATE].baseLayer; } + + /** + * @param {baseLayer} value + */ + set baseLayer(value) { + if (this[PRIVATE].ended) { + return; + } + + this[PRIVATE].baseLayer = value; + // Report to the polyfill since it'll need + // to handle the layer for rendering + this[PRIVATE].polyfill.onBaseLayerSet(this[PRIVATE].id, value); + } + + /** + * @return {XRFrameOfReference} + */ + async requestFrameOfReference(type, options={}) { + if (this[PRIVATE].ended) { + return; + } + + options = Object.assign({}, XRFrameOfReferenceOptions, options); + + if (!XRFrameOfReferenceTypes.includes(type)) { + throw new Error(`XRFrameOfReferenceType must be one of ${XRFrameOfReferenceTypes}`); + } + + let transform = null; + let bounds = null; + // Request a transform from the polyfill given the values. If returning a transform + // (probably "stage"), use it, and if undefined, XRFrameOfReference will use a default + // transform. This call can throw, rejecting the promise, indicating the polyfill does + // not support that frame of reference. + try { + transform = await this[PRIVATE].polyfill.requestFrameOfReferenceTransform(type, options); + } catch (e) { + // Check to see if stage frame of reference failed for this + // PolyfilledXRDevice and we aren't disabling stage emulation. + // Don't throw in this case, and let XRFrameOfReference use its + // stage emulation. + if (type !== 'stage' || options.disableStageEmulation) { + throw e; + } + } + + if (type === 'stage' && transform) { + bounds = this[PRIVATE].polyfill.requestStageBounds(); + if (bounds) { + bounds = new XRStageBounds(bounds); + } + } + + return new XRFrameOfReference(this[PRIVATE].polyfill, type, options, transform, bounds); + } + + /** + * @TODO see about reusing a wrapper function instead of recreating + * it on every frame if passed in the same `callback` + * + * @param {Function} callback + * @return {number} + */ + requestAnimationFrame(callback) { + if (this[PRIVATE].ended) { + return; + } + + // If the session is suspended and we have a previously saved + // suspendedCallback, abort this call + if (this[PRIVATE].suspended && this[PRIVATE].suspendedCallback) { + return; + } + + // Otherwise, if the session is suspended but has not yet creating + // the suspended callback, do so. It will resume once it is no + // longer suspended. + if (this[PRIVATE].suspended && !this[PRIVATE].suspendedCallback) { + this[PRIVATE].suspendedCallback = callback; + } + + return this[PRIVATE].polyfill.requestAnimationFrame(() => { + this[PRIVATE].polyfill.onFrameStart(); + callback(now(), this[PRIVATE].frame); + this[PRIVATE].polyfill.onFrameEnd(this[PRIVATE].id); + }); + } + + /** + * @param {number} handle + */ + cancelAnimationFrame(handle) { + if (this[PRIVATE].ended) { + return; + } + + this[PRIVATE].polyfill.cancelAnimationFrame(handle); + } + + async end() { + if (this[PRIVATE].ended) { + return; + } + + // If this is an exclusive session, trigger the platform to end, which + // will call the `onPresentationEnd` handler, wrapping this up. + if (!this.exclusive) { + this[PRIVATE].ended = true; + this[PRIVATE].polyfill.removeEventListener('@@webvr-polyfill/vr-present-start', + this[PRIVATE].onPresentationStart); + this[PRIVATE].polyfill.removeEventListener('@@webvr-polyfill/vr-present-end', + this[PRIVATE].onPresentationEnd); + + this.dispatchEvent('end', { session: this }); + } + + return this[PRIVATE].polyfill.endSession(this[PRIVATE].id); + } +} diff --git a/src/api/XRStageBounds.js b/src/api/XRStageBounds.js new file mode 100644 index 0000000..ca8153d --- /dev/null +++ b/src/api/XRStageBounds.js @@ -0,0 +1,33 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XRStageBoundsPoint from './XRStageBoundsPoint'; + +const PRIVATE = Symbol('@@webxr-polyfill/XRStageBounds'); + +export default class XRStageBounds { + constructor(boundsData) { + const geometry = []; + for (let i = 0; i < boundsData.length; i += 2) { + geometry.push(new XRStageBoundsPoint(boundsData[i], boundsData[i + 1])); + } + this[PRIVATE] = { geometry }; + } + + /** + * @return {} + */ + get geometry() { return this[PRIVATE].geometry; } +} diff --git a/src/api/XRStageBoundsPoint.js b/src/api/XRStageBoundsPoint.js new file mode 100644 index 0000000..4f021cd --- /dev/null +++ b/src/api/XRStageBoundsPoint.js @@ -0,0 +1,32 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const PRIVATE = Symbol('@@webxr-polyfill/XRStageBoundsPoint'); + +export default class XRStageBoundsPoint { + constructor(x, z) { + this[PRIVATE] = { x, z }; + } + + /** + * @return {number} + */ + get x() { return this[PRIVATE].x; } + + /** + * @return {number} + */ + get z() { return this[PRIVATE].z; } +} diff --git a/src/api/XRView.js b/src/api/XRView.js new file mode 100644 index 0000000..15f88f9 --- /dev/null +++ b/src/api/XRView.js @@ -0,0 +1,81 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XRViewport from './XRViewport'; + +const PRIVATE = Symbol('@@webxr-polyfill/XRView'); + +const XREyes = ['left', 'right']; + +export default class XRView { + /** + * @param {PolyfilledXRDevice} polyfill + * @param {XREye} eye + * @param {number} sessionId + */ + constructor(polyfill, eye, sessionId) { + if (!XREyes.includes(eye)) { + throw new Error(`XREye must be one of: ${XREyes}`); + } + + // Create a shared object that can be updated by other code + // that can update XRViewport values to adhere to API. + // Ugly but it works. + const temp = Object.create(null); + const viewport = new XRViewport(temp); + + this[PRIVATE] = { + polyfill, + eye, + viewport, + temp, + sessionId, + }; + } + + /** + * @return {XREye} + */ + get eye() { return this[PRIVATE].eye; } + + /** + * @return {Float32Array} + */ + get projectionMatrix() { return this[PRIVATE].polyfill.getProjectionMatrix(this.eye); } + + /** + * NON-STANDARD + * + * Previously `getViewport` was on XRView, and after a spec change, it's now + * available on a XRWebGLLayer. This may have to handle different types of + * layers in the future, and the XRLayer.getViewport() function mostly directly + * calls this function. + * + * https://github.com/immersive-web/webxr/pull/329/ + * + * @param {XRLayer} layer + * @return {XRViewport?} + */ + _getViewport(layer) { + const viewport = this[PRIVATE].viewport; + if (this[PRIVATE].polyfill.getViewport(this[PRIVATE].sessionId, + this.eye, + layer, + this[PRIVATE].temp)) { + return this[PRIVATE].viewport; + } + return undefined; + } +} diff --git a/src/api/XRViewport.js b/src/api/XRViewport.js new file mode 100644 index 0000000..27f58b8 --- /dev/null +++ b/src/api/XRViewport.js @@ -0,0 +1,48 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const PRIVATE = Symbol('@@webxr-polyfill/XRViewport'); + +export default class XRViewport { + /** + * Takes a proxy object that this viewport's XRView + * updates and we serve here to match API. + * + * @param {Object} target + */ + constructor(target) { + this[PRIVATE] = { target }; + } + + /** + * @return {number} + */ + get x() { return this[PRIVATE].target.x; } + + /** + * @return {number} + */ + get y() { return this[PRIVATE].target.y; } + + /** + * @return {number} + */ + get width() { return this[PRIVATE].target.width; } + + /** + * @return {number} + */ + get height() { return this[PRIVATE].target.height; } +} diff --git a/src/api/XRWebGLLayer.js b/src/api/XRWebGLLayer.js new file mode 100644 index 0000000..9c5aa30 --- /dev/null +++ b/src/api/XRWebGLLayer.js @@ -0,0 +1,121 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XRSession from './XRSession'; +import XRLayer from './XRLayer'; +import { + POLYFILLED_COMPATIBLE_XR_DEVICE, + COMPATIBLE_XR_DEVICE, +} from '../constants'; + +const PRIVATE = Symbol('@@webxr-polyfill/XRWebGLLayer'); + +export const XRWebGLLayerInit = Object.freeze({ + antialias: true, + depth: false, + stencil: false, + alpha: true, + multiview: false, + framebufferScaleFactor: 0, +}); + +export default class XRWebGLLayer extends XRLayer { + constructor(session, context, layerInit={}) { + const config = Object.assign({}, XRWebGLLayerInit, layerInit); + + if (!(session instanceof XRSession)) { + throw new Error('session must be a XRSession'); + } + + if (session.ended) { + throw new Error(`InvalidStateError`); + } + + // Since we're polyfilling, we're probably polyfilling + // the compatible XR device bit as well. It'd be + // unusual for this bit to not be polyfilled. + if (context[POLYFILLED_COMPATIBLE_XR_DEVICE]) { + if (context[COMPATIBLE_XR_DEVICE] !== session.device) { + throw new Error(`InvalidStateError`); + } + } + + // Use the default framebuffer + const framebuffer = context.getParameter(context.FRAMEBUFFER_BINDING); + + super(); + this[PRIVATE] = { + context, + config, + framebuffer, + }; + } + + /** + * @return {WebGLRenderingContext} + */ + get context() { return this[PRIVATE].context; } + + /** + * @return {boolean} + */ + get antialias() { return this[PRIVATE].config.antialias; } + + /** + * @return {boolean} + */ + get depth() { return this[PRIVATE].config.depth; } + + /** + * @return {boolean} + */ + get stencil() { return this[PRIVATE].config.stencil; } + + /** + * @return {boolean} + */ + get alpha() { return this[PRIVATE].config.alpha; } + + /** + * Not yet supported. + * + * @return {boolean} + */ + get multiview() { return false; } + + /** + * @return {WebGLFramebuffer} + */ + get framebuffer() { return this[PRIVATE].framebuffer; } + + /** + * @return {number} + */ + get framebufferWidth() { return this[PRIVATE].context.drawingBufferWidth; } + + /** + * @return {number} + */ + get framebufferHeight() { return this[PRIVATE].context.drawingBufferHeight; } + + /** + * Not yet supported. + * + * @param {number} viewportScaleFactor + */ + requestViewportScaling(viewportScaleFactor) { + console.warn('requestViewportScaling is not yet implemented'); + } +} diff --git a/src/api/index.js b/src/api/index.js new file mode 100644 index 0000000..d85b1fc --- /dev/null +++ b/src/api/index.js @@ -0,0 +1,46 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XR from './XR'; +import XRDevice from './XRDevice'; +import XRSession from './XRSession'; +import XRPresentationFrame from './XRPresentationFrame'; +import XRView from './XRView'; +import XRViewport from './XRViewport'; +import XRDevicePose from './XRDevicePose'; +import XRLayer from './XRLayer'; +import XRWebGLLayer from './XRWebGLLayer'; +import XRPresentationContext from './XRPresentationContext'; +import XRCoordinateSystem from './XRCoordinateSystem'; +import XRFrameOfReference from './XRFrameOfReference'; +import XRStageBounds from './XRStageBounds'; +import XRStageBoundsPoint from './XRStageBoundsPoint'; + +export default { + XR, + XRDevice, + XRSession, + XRPresentationFrame, + XRView, + XRViewport, + XRDevicePose, + XRLayer, + XRWebGLLayer, + XRPresentationContext, + XRCoordinateSystem, + XRFrameOfReference, + XRStageBounds, + XRStageBoundsPoint, +}; diff --git a/src/constants.js b/src/constants.js new file mode 100644 index 0000000..d5fe8af --- /dev/null +++ b/src/constants.js @@ -0,0 +1,27 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Token for storing whether or not a WebGLRenderingContext has + * a polyfill for `compatibleXRDevice`/`setCompatibleXRDevice()` + */ +export const POLYFILLED_COMPATIBLE_XR_DEVICE = Symbol('@@webxr-polyfill/polyfilled-compatible-xr-device'); + +/** + * Token for storing a compatible XRDevice set on a WebGLRenderingContext + * via `gl.setCompatibleXRDevice(xrDevice)` or via creation + * parameters like `canvas.getContext('webgl', { compatibleXRDevice })` + */ +export const COMPATIBLE_XR_DEVICE= Symbol('@@webxr-polyfill/compatible-xr-device'); diff --git a/src/devices.js b/src/devices.js new file mode 100644 index 0000000..3ace84f --- /dev/null +++ b/src/devices.js @@ -0,0 +1,100 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XRDevice from './api/XRDevice'; + +import CardboardXRDevice from './devices/CardboardXRDevice'; +import WebVRDevice from './devices/WebVRDevice'; + +import { isMobile } from './utils'; + +/** + * Queries browser to see if any XRDevice exists. + * Resolves to an XRDevice or null. + */ +const getXRDevice = async function (global) { + let device = null; + if ('xr' in global.navigator) { + try { + device = await global.navigator.xr.requestDevice(); + } catch (e) {} + } + + return device; +}; + +/** + * Queries browser to see if any VRDisplay exists. + * Resolves to a polyfilled XRDevice or null. + */ +const getVRDisplay = async function (global) { + let device = null; + if ('getVRDisplays' in global.navigator) { + try { + const displays = await global.navigator.getVRDisplays(); + if (displays && displays.length) { + device = new WebVRDevice(global, displays[0]); + } + } catch (e) {} + } + + return device; +}; + +/** + * Return polyfilled XRDevices based off of configuration + * and platform. + * + * @param {Object} global + * @param {Object} config + * @return {Promise} + */ +export const requestDevice = async function (global, config) { + // First, see if there are any native XRDevices on the platform + // in the case where we're not polyfilling the API, but providing + // a cardboard display if no native devices found. + let device = await getXRDevice(global); + + if (device) { + return device; + } + + // If no native XR devices found, check for a 1.1 VRDisplay. + if (config.webvr) { + device = await getVRDisplay(global); + if (device) { + return new XRDevice(device); + } + } + + // If cardboard is enabled, there are no native 1.1 VRDisplays, + // and we're on mobile, provide a CardboardXRDevice. + if (config.cardboard && isMobile(global)) { + // If we're on Cardboard, make sure that VRFrameData is a global + if (!global.VRFrameData) { + global.VRFrameData = function () { + this.rightViewMatrix = new Float32Array(16); + this.leftViewMatrix = new Float32Array(16); + this.rightProjectionMatrix = new Float32Array(16); + this.leftProjectionMatrix = new Float32Array(16); + this.pose = null; + }; + } + + return new XRDevice(new CardboardXRDevice(global)); + } + + return null; +} diff --git a/src/devices/CardboardXRDevice.js b/src/devices/CardboardXRDevice.js new file mode 100644 index 0000000..82bceb1 --- /dev/null +++ b/src/devices/CardboardXRDevice.js @@ -0,0 +1,41 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import CardboardVRDisplay from 'cardboard-vr-display'; +import WebVRDevice from './WebVRDevice'; + +export default class CardboardXRDevice extends WebVRDevice { + /** + * Takes a VRDisplay instance and a VRFrameData + * constructor from the WebVR 1.1 spec. + * + * @param {VRDisplay} display + * @param {VRFrameData} VRFrameData + */ + constructor(global) { + const display = new CardboardVRDisplay(); + super(global, display); + + this.display = display; + this.frame = { + rightViewMatrix: new Float32Array(16), + leftViewMatrix: new Float32Array(16), + rightProjectionMatrix: new Float32Array(16), + leftProjectionMatrix: new Float32Array(16), + pose: null, + timestamp: null, + }; + } +} diff --git a/src/devices/PolyfilledXRDevice.js b/src/devices/PolyfilledXRDevice.js new file mode 100644 index 0000000..cf153c0 --- /dev/null +++ b/src/devices/PolyfilledXRDevice.js @@ -0,0 +1,162 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import EventTarget from '../lib/EventTarget'; + +export default class PolyfilledXRDevice extends EventTarget { + /** + * Takes a VRDisplay object from the WebVR 1.1 spec. + * + * @param {Object} global + */ + constructor(global) { + super(); + + this.global = global; + this.onWindowResize = this.onWindowResize.bind(this); + + this.global.window.addEventListener('resize', this.onWindowResize); + } + + /** + * @return {number} + */ + get depthNear() { throw new Error('Not implemented'); } + + /** + * @param {number} + */ + set depthNear(val) { throw new Error('Not implemented'); } + + /** + * @return {number} + */ + get depthFar() { throw new Error('Not implemented'); } + + /** + * @param {number} + */ + set depthFar(val) { throw new Error('Not implemented'); } + + /** + * Called when a XRSession has a `baseLayer` property set. + * + * @param {number} sessionId + * @param {XRWebGLLayer} layer + */ + onBaseLayerSet(sessionId, layer) { throw new Error('Not implemented'); } + + /** + * @param {XRSessionCreationOptions} options + * @return {boolean} + */ + supportsSession(options={}) { throw new Error('Not implemented'); } + + /** + * Returns a promise if creating a session is successful. + * Usually used to set up presentation in the polyfilled device. + * + * @param {XRSessionCreationOptions} options + * @return {Promise} + */ + async requestSession(options={}) { throw new Error('Not implemented'); } + + /** + * @return {Function} + */ + requestAnimationFrame(callback) { throw new Error('Not implemented'); } + + onFrameStart() { throw new Error('Not implemented'); } + + /** + * @param {number} sessionId + */ + onFrameEnd(sessionId) { throw new Error('Not implemented'); } + + /** + * @return {Object?} + */ + requestStageBounds() { throw new Error('Not implemented'); } + + /** + * Returns a promise resolving to a transform if PolyfilledXRDevice + * can support frame of reference and provides its own values. + * Can resolve to `undefined` if the polyfilled API can provide + * a default. Rejects if this PolyfilledXRDevice cannot + * support the frame of reference. + * + * @param {XRFrameOfReferenceType} type + * @param {XRFrameOfReferenceOptions} options + * @return {Promise} + */ + async requestFrameOfReferenceTransform(type, options) { + return undefined; + } + + /** + * @param {number} handle + */ + cancelAnimationFrame(handle) { throw new Error('Not implemented'); } + + /** + * @param {number} sessionId + */ + endSession(sessionId) { throw new Error('Not implemented'); } + + /** + * Takes a XREye and a target to apply properties of + * `x`, `y`, `width` and `height` on. Returns a boolean + * indicating if it successfully was able to populate + * target's values. + * + * @param {number} sessionId + * @param {XREye} eye + * @param {XRWebGLLayer} layer + * @param {Object?} target + * @return {boolean} + */ + getViewport(sessionId, eye, layer, target) { throw new Error('Not implemented'); } + + /** + * @param {XREye} eye + * @return {Float32Array} + */ + getProjectionMatrix(eye) { throw new Error('Not implemented'); } + + /** + * Get model matrix unaffected by frame of reference. + * + * @return {Float32Array} + */ + getBasePoseMatrix() { throw new Error('Not implemented'); } + + /** + * Get view matrix unaffected by frame of reference. + * + * @param {XREye} eye + * @return {Float32Array} + */ + getBaseViewMatrix(eye) { throw new Error('Not implemented'); } + + /** + * Called on window resize. + */ + onWindowResize() { + // Bound by PolyfilledXRDevice and called on resize, but + // this will call child class onWindowResize (or, if not defined, + // call an infinite loop I guess) + this.onWindowResize(); + } +} diff --git a/src/devices/WebVRDevice.js b/src/devices/WebVRDevice.js new file mode 100644 index 0000000..5dc04c8 --- /dev/null +++ b/src/devices/WebVRDevice.js @@ -0,0 +1,451 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import PolyfilledXRDevice from './PolyfilledXRDevice'; +import XRDevice from '../api/XRDevice'; +import XRPresentationFrame from '../api/XRPresentationFrame'; +import XRView from '../api/XRView'; +import XRDevicePose from '../api/XRDevicePose'; +import { mat4_fromRotationTranslation, mat4_identity } from '../math'; +import { applyCanvasStylesForMinimalRendering } from '../utils'; + +const PRIVATE = Symbol('@@webxr-polyfill/WebVRDevice'); + +/** + * A Session helper class to mirror an XRSession and correlate + * between an XRSession, and tracking sessions in a PolyfilledXRDevice. + * Mostly referenced via `session.id` due to needing to verify + * session creation is possible on the PolyfilledXRDevice before + * the XRSession can be created. + */ +let SESSION_ID = 0; +class Session { + constructor(sessionOptions) { + this.outputContext = sessionOptions.outputContext; + this.exclusive = sessionOptions.exclusive; + this.ended = null; + this.baseLayer = null; + this.id = ++SESSION_ID; + // A flag indicating whether or not the canvas used for + // XRWebGLLayer was injected into the DOM to work around + // Firefox Desktop bug: https://bugzil.la/1435339 + this.modifiedCanvasLayer = false; + } +}; + +export default class WebVRDevice extends PolyfilledXRDevice { + /** + * Takes a VRDisplay instance and a VRFrameData + * constructor from the WebVR 1.1 spec. + * + * @param {VRDisplay} display + * @param {VRFrameData} VRFrameData + */ + constructor(global, display) { + const { canPresent } = display.capabilities; + super(global); + + this.display = display; + this.frame = new global.VRFrameData(); + this.sessions = new Map(); + this.canPresent = canPresent; + this.baseModelMatrix = mat4_identity(new Float32Array(16)); + this.tempVec3 = new Float32Array(3); + + this.onVRDisplayPresentChange = this.onVRDisplayPresentChange.bind(this); + + global.window.addEventListener('vrdisplaypresentchange', this.onVRDisplayPresentChange); + } + + /** + * @return {number} + */ + get depthNear() { return this.display.depthNear; } + + /** + * @param {number} + */ + set depthNear(val) { this.display.depthNear = val; } + + /** + * @return {number} + */ + get depthFar() { return this.display.depthFar; } + + /** + * @param {number} + */ + set depthFar(val) { this.display.depthFar = val; } + + /** + * Called when a XRSession has a `baseLayer` property set. + * + * @param {number} sessionId + * @param {XRWebGLLayer} layer + */ + onBaseLayerSet(sessionId, layer) { + const session = this.sessions.get(sessionId); + const canvas = layer.context.canvas; + + // If we're in an exclusive session, replace the dummy layer on + // the 1.1 device. + if (session.exclusive) { + // Wait for this to resolve before setting session.baseLayer, + // but we can still safely return this function synchronously + // We have to set the underlying canvas to the size + // requested by the 1.1 device. + const left = this.display.getEyeParameters('left'); + const right = this.display.getEyeParameters('right'); + + // Generate height/width due to optics as per 1.1 spec + canvas.width = Math.max(left.renderWidth, right.renderWidth) * 2; + canvas.height = Math.max(left.renderHeight, right.renderHeight); + this.display.requestPresent([{ source: canvas }]).then(() => { + // If canvas is not in the DOM, we must inject it anyway, + // due to a bug in Firefox Desktop, and ensure it is visible, + // so style it to be 1x1 in the upper left corner. + // https://bugzil.la/1435339 + // Our test environment doesn't have the canvas package, skip + // in tests for now. + if (process.env.NODE_ENV !== 'test' && + !this.global.document.body.contains(canvas)) { + session.modifiedCanvasLayer = true; + this.global.document.body.appendChild(canvas); + applyCanvasStylesForMinimalRendering(canvas); + } + session.baseLayer = layer; + }); + } + // If a non-exclusive session that has an outputContext + // we only have a magic window. + else if (session.outputContext) { + session.baseLayer = layer; + } + } + + /** + * If a 1.1 VRDisplay cannot present, it could be a 6DOF device + * that doesn't have its own way to present, but used in magic + * window mode. So in WebXR lingo, this cannot support an + * "exclusive" session. + * + * @param {XRSessionCreationOptions} options + * @return {boolean} + */ + supportsSession(options={}) { + if (options.exclusive === true && this.canPresent === false) { + return false; + } + return true; + } + + /** + * Returns a promise of a session ID if creating a session is successful. + * Usually used to set up presentation in the polyfilled device. + * We can't start presenting in a 1.1 device until we have a canvas + * layer, so use a dummy layer until `onBaseLayerSet` is called. + * May reject if session is not supported, or if an error is thrown + * when calling `requestPresent`. + * + * @param {XRSessionCreationOptions} options + * @return {Promise} + */ + async requestSession(options={}) { + if (!this.supportsSession(options)) { + return Promise.reject(); + } + + // If we're going to present to device, immediately call `requestPresent` + // since this needs to be inside of a user gesture for Cardboard + // (requires a user gesture for `requestFullscreen`), as well as + // WebVR 1.1 requiring to be in a user gesture. Use a dummy canvas, + // until we get the real canvas to present via `onBaseLayerSet`. + if (options.exclusive) { + const canvas = this.global.document.createElement('canvas'); + + // Our test environment doesn't have the canvas package, nor this + // restriction, so skip. + if (process.env.NODE_ENV !== 'test') { + // Create and discard a context to avoid + // "DOMException: Layer source must have a WebGLRenderingContext" + const ctx = canvas.getContext('webgl'); + } + await this.display.requestPresent([{ source: canvas }]); + } + + const session = new Session(options); + this.sessions.set(session.id, session); + + if (options.exclusive) { + this.dispatchEvent('@@webxr-polyfill/vr-present-start', session.id); + } + + return Promise.resolve(session.id); + } + + /** + * @return {Function} + */ + requestAnimationFrame(callback) { + return this.display.requestAnimationFrame(callback); + } + + onFrameStart() { + this.display.getFrameData(this.frame); + } + + onFrameEnd(sessionId) { + const session = this.sessions.get(sessionId); + + // Discard if this session is already ended, or if it does + // not yet have a baseLayer. + if (session.ended || !session.baseLayer) { + return; + } + + // If session is has an outputContext, whether magic window + // or mirroring (session.exclusive === true), copy the baseLayer + // pixels to the XRPresentationContext + // However, abort if this a mirrored context, and our VRDisplay + // does not have an external display; this kills performance rather + // quickly on mobile for a canvas that's not seen. + if (session.outputContext && + !(session.exclusive && !this.display.capabilities.hasExternalDisplay)) { + + const canvas = session.baseLayer.context.canvas; + const iWidth = canvas.width / 2; + const iHeight = canvas.height; + + // @TODO Our test environment doesn't have the canvas package for now, + // but this could be something we add to the tests. + if (process.env.NODE_ENV !== 'test') { + // @TODO Cache the context; since XRPresentationContext is created + // outside of the main API and does not expose the underlying context + const outputCanvas = session.outputContext.canvas; + const outputContext = outputCanvas.getContext('2d'); + const oWidth = outputCanvas.width; + const oHeight = outputCanvas.height; + + // We want to render only half of the layer context (left eye) + // proportional to the size of the outputContext canvas. + // ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight); + outputContext.drawImage(canvas, 0, 0, iWidth, iHeight, + 0, 0, oWidth, oHeight); + } + } + + // Only submit frame if we're presenting an exclusive session. + // on a session will start presenting in 1.1 but we still have + // to set up the width/height correctly and wait for `baseLayer` to + // be set. + if (session.exclusive && session.baseLayer) { + this.display.submitFrame(); + } + } + + /** + * @param {number} handle + */ + cancelAnimationFrame(handle) { + this.display.cancelAnimationFrame(handle); + } + + /** + * @TODO Spec + */ + async endSession(sessionId) { + const session = this.sessions.get(sessionId); + + if (session.ended) { + return; + } + + // If this is an exclusive session, end presenting; + // the vrdisplaypresentchange event will flip the `ended` bit. + if (session.exclusive) { + return this.display.exitPresent(); + } else { + session.ended = true; + } + } + + /** + * If the VRDisplay has stage parameters, convert them + * to an array of X, Z pairings. + * + * @return {Object?} + */ + requestStageBounds() { + if (this.display.stageParameters) { + const width = this.display.stageParameters.sizeX; + const depth = this.display.stageParameters.sizeZ; + const data = []; + + data.push(-width / 2); // X + data.push(-depth / 2); // Z + data.push(width / 2); // X + data.push(-depth / 2); // Z + data.push(width / 2); // X + data.push(depth / 2); // Z + data.push(-width / 2); // X + data.push(depth / 2); // Z + + return data; + } + return null; + } + + /** + * Returns a promise resolving to a transform if PolyfilledXRDevice + * can support frame of reference and provides its own values. + * Can resolve to `undefined` if the polyfilled API can provide + * a default. Rejects if this PolyfilledXRDevice cannot + * support the frame of reference. + * + * @param {XRFrameOfReferenceType} type + * @param {XRFrameOfReferenceOptions} options + * @return {Promise} + */ + async requestFrameOfReferenceTransform(type, options) { + if (type === 'stage' && this.display.stageParameters && + this.display.stageParameters.sittingToStandingTransform) { + return this.display.stageParameters.sittingToStandingTransform; + } + } + + /** + * @param {XREye} eye + * @return {Float32Array} + */ + getProjectionMatrix(eye) { + if (eye === 'left') { + return this.frame.leftProjectionMatrix; + } else if (eye === 'right') { + return this.frame.rightProjectionMatrix; + } else { + throw new Error(`eye must be of type 'left' or 'right'`); + } + } + + /** + * Takes a XREye and a target to apply properties of + * `x`, `y`, `width` and `height` on. Returns a boolean + * indicating if it successfully was able to populate + * target's values. + * + * @param {number} sessionId + * @param {XREye} eye + * @param {XRWebGLLayer} layer + * @param {Object?} target + * @return {boolean} + */ + getViewport(sessionId, eye, layer, target) { + // @TODO can we have another layer passed in that + // wasn't the same one as the `baseLayer`? + + const session = this.sessions.get(sessionId); + const { width, height } = layer.context.canvas; + + // If this is a non-exclusive session, return the + // whole canvas as the viewport + if (!session.exclusive) { + target.x = target.y = 0; + target.width = width; + target.height = height; + return true; + } + + // WebGL 1.1 viewports are just + if (eye === 'left') { + target.x = 0; + } else if (eye === 'right') { + target.x = width / 2; + } else { + return false; + } + + target.y = 0; + target.width = width / 2; + target.height = height; + + return true; + } + + /** + * Get model matrix unaffected by frame of reference. + * + * @return {Float32Array} + */ + getBasePoseMatrix() { + let { position, orientation } = this.frame.pose; + // On initialization, we might not have any values + if (!position && !orientation) { + return this.baseModelMatrix; + } + if (!position) { + position = this.tempVec3; + position[0] = position[1] = position[2] = 0; + } + mat4_fromRotationTranslation(this.baseModelMatrix, orientation, position); + return this.baseModelMatrix; + } + + /** + * Get view matrix unaffected by frame of reference. + * + * @param {XREye} eye + * @return {Float32Array} + */ + getBaseViewMatrix(eye) { + if (eye === 'left') { + return this.frame.leftViewMatrix; + } else if (eye === 'right') { + return this.frame.rightViewMatrix; + } else { + throw new Error(`eye must be of type 'left' or 'right'`); + } + } + + /** + * Triggered on window resize. + * + */ + onWindowResize() { + } + + /** + * Listens to the Native 1.1 `window.addEventListener('vrdisplaypresentchange')` + * event. + * + * @param {Event} event + */ + onVRDisplayPresentChange(e) { + if (!this.display.isPresenting) { + this.sessions.forEach(session => { + if (session.exclusive && !session.ended) { + // If we injected and modified the canvas layer + // due to https://bugzil.la/1435339, then remove it from the DOM + // and remove styles. + if (session.modifiedCanvasLayer) { + const canvas = session.baseLayer.context.canvas; + document.body.removeChild(canvas); + canvas.setAttribute('style', ''); + } + this.dispatchEvent('@@webxr-polyfill/vr-present-end', session.id); + } + }); + } + } +} diff --git a/src/extend-globals.js b/src/extend-globals.js new file mode 100644 index 0000000..3ce6aef --- /dev/null +++ b/src/extend-globals.js @@ -0,0 +1,108 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XRPresentationContext from './api/XRPresentationContext'; +import { + POLYFILLED_COMPATIBLE_XR_DEVICE, + COMPATIBLE_XR_DEVICE, +} from './constants'; + +const contextTypes = ['webgl', 'experimental-webgl']; + +/** + * Takes the WebGLRenderingContext constructor + * and creates a `setCompatibleXRDevice` function if it does not exist. + * Returns a boolean indicating whether or not the function + * was polyfilled. + * + * @param {WebGLRenderingContext} + * @return {boolean} + */ +export const extendContextCompatibleXRDevice = Context => { + if (typeof Context.prototype.setCompatibleXRDevice === 'function') { + return false; + } + + // Create `setCompatibleXRDevice` and if successful, store + // the XRDevice as a private attribute for error checking + Context.prototype.setCompatibleXRDevice = function (xrDevice) { + return new Promise((resolve, reject) => { + // This is all fake, so accept if you get anything + // that looks like a XRDevice + if (xrDevice && typeof xrDevice.requestSession === 'function') { + resolve(); + } else { + reject() + } + }).then(() => this[COMPATIBLE_XR_DEVICE] = xrDevice); + }; + + return true; +}; + + +/** + * Takes the HTMLCanvasElement constructor + * and wraps its `getContext` function to return a XRPresentationContext + * if requesting a `xrpresent` context type. Also + * patches context's with a POLYFILLED_COMPATIBLE_XR_DEVICE bit so the API + * knows it's also working with a polyfilled `compatibleXRDevice` bit. + * Can do extra checking for validity. + * + * @param {HTMLCanvasElement} Canvas + */ +export const extendGetContext = Canvas => { + const getContext = HTMLCanvasElement.prototype.getContext; + HTMLCanvasElement.prototype.getContext = function (contextType, glAttribs) { + + // If requesting a XRPresentationContext... + if (contextType === 'xrpresent') { + let ctx = getContext.call(this, '2d', glAttribs); + return new XRPresentationContext(this, ctx, glAttribs); + /* + let ctx; + for (const type of contextTypes) { + ctx = getContext.call(this, type, glAttribs); + if (ctx) { + break; + } + } + + // We can't create any webgl/experimental-webgl contexts, + // let consumer handle + if (!ctx) { + return null; + } + + return new XRPresentationContext(this, ctx, glAttribs); + */ + } + + const ctx = getContext.call(this, contextType, glAttribs); + + // Set this bit so the API knows the WebGLRenderingContext is + // also polyfilled a bit + ctx[POLYFILLED_COMPATIBLE_XR_DEVICE] = true; + + // If we've polyfilled WebGLRenderingContext's compatibleXRDevice + // bit, store the XRDevice in the private token if created via + // creation parameters + if (glAttribs && ('compatibleXRDevice' in glAttribs)) { + ctx[COMPATIBLE_XR_DEVICE] = glAttribs.compatibleXRDevice; + } + + return ctx; + } +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..6fb71fb --- /dev/null +++ b/src/index.js @@ -0,0 +1,26 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * index.js is used as an entry point for building a rollup bundle + * form of the polyfill in UMD style. + */ + +// Do not use any polyfills for the time being; let the consumers +// decide which features to support +// import 'babel-polyfill'; +import WebXRPolyfill from './WebXRPolyfill'; + +export default WebXRPolyfill; diff --git a/src/lib/EventTarget.js b/src/lib/EventTarget.js new file mode 100644 index 0000000..6a4cd7a --- /dev/null +++ b/src/lib/EventTarget.js @@ -0,0 +1,80 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const PRIVATE = Symbol('@@webxr-polyfill/EventTarget'); + +export default class EventTarget { + constructor() { + this[PRIVATE] = { + listeners: new Map(), + }; + } + + /** + * @param {string} type + * @param {Function} listener + */ + addEventListener(type, listener) { + if (typeof type !== 'string') { throw new Error('`type` must be a string'); } + if (typeof listener !== 'function') { throw new Error('`listener` must be a function'); } + + const typedListeners = this[PRIVATE].listeners.get(type) || []; + typedListeners.push(listener); + this[PRIVATE].listeners.set(type, typedListeners); + } + + /** + * @param {string} type + * @param {Function} listener + */ + removeEventListener(type, listener) { + if (typeof type !== 'string') { throw new Error('`type` must be a string'); } + if (typeof listener !== 'function') { throw new Error('`listener` must be a function'); } + + const typedListeners = this[PRIVATE].listeners.get(type) || []; + + for (let i = typedListeners.length; i >= 0; i--) { + if (typedListeners[i] === listener) { + typedListeners.pop(); + } + } + } + + /** + * @param {string} type + * @param {object} event + */ + dispatchEvent(type, event) { + const typedListeners = this[PRIVATE].listeners.get(type) || []; + + // Copy over all the listeners because a callback could remove + // an event listener, preventing all listeners from firing when + // the event was first dispatched. + const queue = []; + for (let i = 0; i < typedListeners.length; i++) { + queue[i] = typedListeners[i]; + } + + for (let listener of queue) { + listener(event); + } + + // Also fire if this EventTarget has an `on${EVENT_TYPE}` property + // that's a function + if (typeof this[`on${type}`] === 'function') { + this[`on${type}`](event); + } + } +} diff --git a/src/lib/global.js b/src/lib/global.js new file mode 100644 index 0000000..c1e31e0 --- /dev/null +++ b/src/lib/global.js @@ -0,0 +1,26 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A library for including application global. Similar to + * logic provided by `rollup-plugin-node-globals` without the + * rest of the functionality needed. + */ + +const _global = typeof global !== 'undefined' ? global : + typeof self !== 'undefined' ? self : + typeof window !== 'undefined' ? window : {}; + +export default _global; diff --git a/src/lib/now.js b/src/lib/now.js new file mode 100644 index 0000000..c611a0a --- /dev/null +++ b/src/lib/now.js @@ -0,0 +1,31 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A wrapper around `performance.now()` so that we can run unit tests + * in Node. + */ + +import GLOBAL from './global'; + +let now; +if ('performance' in GLOBAL === false) { + let startTime = Date.now(); + now = () => Date.now() - startTime; +} else { + now = () => performance.now(); +} + +export default now; diff --git a/src/math.js b/src/math.js new file mode 100644 index 0000000..b4dfdc6 --- /dev/null +++ b/src/math.js @@ -0,0 +1,250 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Utilities from gl-matrix + */ + +/** + * Set a mat4 to the identity matrix + * + * @param {mat4} out the receiving matrix + * @returns {mat4} out + */ +export function mat4_identity(out) { + out[0] = 1; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = 1; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = 1; + out[11] = 0; + out[12] = 0; + out[13] = 0; + out[14] = 0; + out[15] = 1; + return out; +} + +/** + * Copy the values from one mat4 to another + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +export function mat4_copy(out, a) { + out[0] = a[0]; + out[1] = a[1]; + out[2] = a[2]; + out[3] = a[3]; + out[4] = a[4]; + out[5] = a[5]; + out[6] = a[6]; + out[7] = a[7]; + out[8] = a[8]; + out[9] = a[9]; + out[10] = a[10]; + out[11] = a[11]; + out[12] = a[12]; + out[13] = a[13]; + out[14] = a[14]; + out[15] = a[15]; + return out; +} + +/** + * Inverts a mat4 + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the source matrix + * @returns {mat4} out + */ +export function mat4_invert(out, a) { + let a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + let a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + let a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + let a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + let b00 = a00 * a11 - a01 * a10; + let b01 = a00 * a12 - a02 * a10; + let b02 = a00 * a13 - a03 * a10; + let b03 = a01 * a12 - a02 * a11; + let b04 = a01 * a13 - a03 * a11; + let b05 = a02 * a13 - a03 * a12; + let b06 = a20 * a31 - a21 * a30; + let b07 = a20 * a32 - a22 * a30; + let b08 = a20 * a33 - a23 * a30; + let b09 = a21 * a32 - a22 * a31; + let b10 = a21 * a33 - a23 * a31; + let b11 = a22 * a33 - a23 * a32; + + // Calculate the determinant + let det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; + + if (!det) { + return null; + } + det = 1.0 / det; + + out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; + out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; + out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; + out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; + out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; + out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; + out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; + out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; + out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; + out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; + out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; + out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; + out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; + out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; + out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; + out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; + + return out; +} + +/** + * Creates a matrix from a quaternion rotation and vector translation + * This is equivalent to (but much faster than): + * + * mat4.identity(dest); + * mat4.translate(dest, vec); + * let quatMat = mat4.create(); + * quat4.toMat4(quat, quatMat); + * mat4.multiply(dest, quatMat); + * + * @param {mat4} out mat4 receiving operation result + * @param {quat4} q Rotation quaternion + * @param {vec3} v Translation vector + * @returns {mat4} out + */ +export function mat4_fromRotationTranslation(out, q, v) { + // Quaternion math + let x = q[0], y = q[1], z = q[2], w = q[3]; + let x2 = x + x; + let y2 = y + y; + let z2 = z + z; + + let xx = x * x2; + let xy = x * y2; + let xz = x * z2; + let yy = y * y2; + let yz = y * z2; + let zz = z * z2; + let wx = w * x2; + let wy = w * y2; + let wz = w * z2; + // + out[0] = 1 - (yy + zz); + out[1] = xy + wz; + out[2] = xz - wy; + out[3] = 0; + out[4] = xy - wz; + out[5] = 1 - (xx + zz); + out[6] = yz + wx; + out[7] = 0; + out[8] = xz + wy; + out[9] = yz - wx; + out[10] = 1 - (xx + yy); + out[11] = 0; + out[12] = v[0]; + out[13] = v[1]; + out[14] = v[2]; + out[15] = 1; + + return out; +} + +/** + * Multiplies two mat4s + * + * @param {mat4} out the receiving matrix + * @param {mat4} a the first operand + * @param {mat4} b the second operand + * @returns {mat4} out + */ +export function mat4_multiply(out, a, b) { + let a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3]; + let a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; + let a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; + let a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; + + // Cache only the current line of the second matrix + let b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; + out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; + out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; + out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + + b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; + out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; + out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; + out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; + out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; + return out; +} + +/** + * Generates a perspective projection matrix with the given bounds + * + * @param {mat4} out mat4 frustum matrix will be written into + * @param {number} fovy Vertical field of view in radians + * @param {number} aspect Aspect ratio. typically viewport width/height + * @param {number} near Near bound of the frustum + * @param {number} far Far bound of the frustum + * @returns {mat4} out + */ +export function perspective(out, fovy, aspect, near, far) { + let f = 1.0 / Math.tan(fovy / 2); + let nf = 1 / (near - far); + out[0] = f / aspect; + out[1] = 0; + out[2] = 0; + out[3] = 0; + out[4] = 0; + out[5] = f; + out[6] = 0; + out[7] = 0; + out[8] = 0; + out[9] = 0; + out[10] = (far + near) * nf; + out[11] = -1; + out[12] = 0; + out[13] = 0; + out[14] = (2 * far * near) * nf; + out[15] = 0; + return out; +} diff --git a/src/utils.js b/src/utils.js new file mode 100644 index 0000000..b71aea3 --- /dev/null +++ b/src/utils.js @@ -0,0 +1,34 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/** + * Determines whether or not this global's user agent is + * considered a mobile device. Taken from webvr-polyfill. + * + * @param {Object} global + */ +export const isMobile = global => { + var check = false; + (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(global.navigator.userAgent||global.navigator.vendor||global.opera); + return check; +}; + +export const applyCanvasStylesForMinimalRendering = canvas => { + canvas.style.display = 'block'; + canvas.style.position = 'absolute'; + canvas.style.width = canvas.style.height = '1px'; + canvas.style.top = canvas.style.left = '0px'; +}; diff --git a/test/api/test-event-target.js b/test/api/test-event-target.js new file mode 100644 index 0000000..439e22d --- /dev/null +++ b/test/api/test-event-target.js @@ -0,0 +1,69 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import EventTarget from '../../src/lib/EventTarget'; + +class ChildTarget extends EventTarget {} + +describe('API - EventTarget', () => { + it('binds events via addEventListener', () => { + const c = new ChildTarget(); + const events = []; + c.addEventListener('click', ({ value }) => events.push(`${value}-1`)); + c.addEventListener('click', ({ value }) => events.push(`${value}-2`)); + c.addEventListener('scroll', ({ value }) => events.push(value)); + + c.dispatchEvent('click', { value: 'hello' }); + assert.deepEqual(events, ['hello-1', 'hello-2']); + + c.dispatchEvent('scroll', { value: 'hello' }); + assert.deepEqual(events, ['hello-1', 'hello-2', 'hello']); + }); + + it('removes events via removeEventListener', () => { + const c = new ChildTarget(); + const events = []; + const c1 = ({ value }) => events.push(`${value}-1`); + const c2 = ({ value }) => events.push(`${value}-2`); + c.addEventListener('click', c1); + c.addEventListener('click', c2); + + c.dispatchEvent('click', { value: 'hello' }); + assert.deepEqual(events, ['hello-1', 'hello-2']); + + c.removeEventListener('click', c2); + c.dispatchEvent('click', { value: 'world' }); + assert.deepEqual(events, ['hello-1', 'hello-2', 'world-1']); + + c.removeEventListener('click', c1); + c.dispatchEvent('click', { value: 'hello' }); + assert.deepEqual(events, ['hello-1', 'hello-2', 'world-1']); + }); + + it('fires handlers stored as `on${type}` attributes', () => { + const c = new ChildTarget(); + const events = []; + const c1 = ({ value }) => events.push(`${value}-1`); + const c2 = ({ value }) => events.push(`${value}-2`); + c.addEventListener('click', c1); + c.onclick = c2; + + c.dispatchEvent('click', { value: 'hello' }); + assert.deepEqual(events, ['hello-1', 'hello-2']); + }); +}); diff --git a/test/api/test-xr-device-pose.js b/test/api/test-xr-device-pose.js new file mode 100644 index 0000000..b12e863 --- /dev/null +++ b/test/api/test-xr-device-pose.js @@ -0,0 +1,72 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import XRDevice from '../../src/api/XRDevice'; +import XRSession from '../../src/api/XRSession'; +import XRDevicePose from '../../src/api/XRDevicePose'; +import { createXRDevice } from '../lib/utils'; +import { mat4_invert, mat4_copy, mat4_identity } from '../../src/math'; + +// Half of an avg 62mm IPD value for the +// mock view matrices +const OFFSET = 0.031; + +describe('API - XRDevicePose', () => { + let device, session, ref; + // Technically this will expose the `frame` on a different than + // requested tick, but as long as we're not asking for a new frame, + // nothing should change in this mock env + let getFrame = () => new Promise(r => session.requestAnimationFrame((t, frame) => r(frame))); + beforeEach(async function () { + device = createXRDevice({ hasPosition: true }); + session = await device.requestSession({ exclusive: true }); + ref = await session.requestFrameOfReference('eyeLevel'); + }); + + it('gets an updated poseModelMatrix every frame', async function () { + let expected = new Float32Array(16); + mat4_identity(expected); + + // On each frame, check to see that the poseModelMatrix is + // going up the Z-axis on every tick + for (let z = 0; z < 3; z++) { + let frame = await getFrame(); + let pose = frame.getDevicePose(ref); + expected[14] = z + 1; + assert.deepEqual(pose.poseModelMatrix, expected); + } + }); + + it('gets updated view matrices frame', async function () { + let expected = new Float32Array(16); + + // On each frame, check to see that the view matrices are + // going up the Z-axis on every tick, and include IPD offsets + for (let z = 0; z < 3; z++) { + let frame = await getFrame(); + let pose = frame.getDevicePose(ref); + assert.equal(frame.views.length, 2); + for (const view of frame.views) { + mat4_copy(expected, pose.poseModelMatrix); + expected[12] += view.eye === 'left' ? -OFFSET : OFFSET; + mat4_invert(expected, expected); + assert.deepEqual(pose.getViewMatrix(view), expected); + } + } + }); +}); diff --git a/test/api/test-xr-device.js b/test/api/test-xr-device.js new file mode 100644 index 0000000..7048f5c --- /dev/null +++ b/test/api/test-xr-device.js @@ -0,0 +1,145 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import XRDevice from '../../src/api/XRDevice'; +import XRSession from '../../src/api/XRSession'; +import XRPresentationContext from '../../src/api/XRPresentationContext'; +import { createXRDevice } from '../lib/utils'; +import WebVRDevice from '../../src/devices/WebVRDevice'; +import MockVRDisplay from '../lib/MockVRDisplay'; +import { MockGlobalVR } from '../lib/globals'; + +describe('API - XRDevice', () => { + + it('needs a PolyfilledXRDevice', () => { + assert.throws(() => new XRDevice(), Error); + }); + + function validateOptions (fnName) { + it('accepts exclusive option', async function () { + const device = createXRDevice(); + return device[fnName]({ exclusive: true }); + }); + + it('accepts exclusive and outputContext option', async function () { + const device = createXRDevice(); + const ctx = new XRPresentationContext(); + return device[fnName]({ exclusive: true, outputContext: ctx }); + }); + + it('accepts non-exclusive and outputContext option', async function () { + const device = createXRDevice(); + const ctx = new XRPresentationContext(); + return device[fnName]({ exclusive: false, outputContext: ctx }); + }); + + it('fails non-exclusive without outputContext option', async function () { + const device = createXRDevice(); + const ctx = new XRPresentationContext(); + + let caught = false; + try { + await device[fnName](); + } catch (e) { + caught = true; + } + assert.equal(caught, true); + }); + + it('fails with non-XRPresentationContext outputContext option', async function () { + const device = createXRDevice(); + const ctx = new XRPresentationContext({ outputContext: {} }); + + let caught = false; + try { + await device[fnName](); + } catch (e) { + caught = true; + } + assert.equal(caught, true); + }); + + it('checks PolyfilledXRDevice for custom session support', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + if (fnName === 'supportsSession') { + polyfill[fnName] = () => false; + } else { + polyfill[fnName] = () => new Promise((res, rej) => rej()); + } + const device = new XRDevice(polyfill); + let caught = false; + try { + await device[fnName]({ exclusive: true }); + } catch (e) { + caught = true; + } + assert.equal(caught, true); + }); + + it('fails exclusive if underlying 1.1 VRDisplay `canPresent` is false', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global, { canPresent: false })); + const device = new XRDevice(polyfill); + let caught = false; + try { + await device[fnName]({ exclusive: true }); + } catch (e) { + caught = true; + } + assert.equal(caught, true); + }); + } + + describe('XRDevice#supportsSession()', () => { + validateOptions('supportsSession'); + }); + + describe('XRDevice#requestSession()', () => { + it('returns a XRSession', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + assert.instanceOf(session, XRSession); + }); + + it('rejects if requesting a second, concurrent exclusive session', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + let caught = false; + try { + await device.requestSession({ exclusive: true }); + } catch (e) { + caught = true; + } + assert.equal(caught, true); + }); + + it('resolves if requesting a second exclusive session after previous exclusive ends', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + await session.end(); + await device.requestSession({ exclusive: true }); + }); + + validateOptions('requestSession'); + }); + + describe('events', () => { + it('propagates a `deactivate` event from PolyfilledXRDevice'); + }); +}); diff --git a/test/api/test-xr-frame-of-reference.js b/test/api/test-xr-frame-of-reference.js new file mode 100644 index 0000000..dcbd1fd --- /dev/null +++ b/test/api/test-xr-frame-of-reference.js @@ -0,0 +1,218 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; +import raf from 'raf'; + +import XRDevice from '../../src/api/XRDevice'; +import XRSession from '../../src/api/XRSession'; +import XRPresentationContext from '../../src/api/XRPresentationContext'; +import XRFrameOfReference from '../../src/api/XRFrameOfReference'; +import XRStageBounds from '../../src/api/XRStageBounds'; +import { createXRDevice } from '../lib/utils'; +import WebVRDevice from '../../src/devices/WebVRDevice'; +import MockVRDisplay from '../lib/MockVRDisplay'; +import { MockGlobalVR } from '../lib/globals'; +import { mat4_identity } from '../../src/math'; + +describe('API - XRFrameOfReference', () => { + it('uses the polyfill\'s transform if provided', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + + polyfill.requestFrameOfReferenceTransform = async function (type, options) { + assert.equal(type, 'headModel'); + return new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 8, 0, 1 + ]); + }; + + const frameOfRef = await session.requestFrameOfReference('headModel'); + + const pose = mat4_identity(new Float32Array(16)); + // Set position to <1, 1, 1> + pose[12] = pose[13] = pose[14] = 1; + const out = new Float32Array(16); + frameOfRef.transformBasePoseMatrix(out, pose); + + assert.deepEqual(out, new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 9, 1, 1 + ]), 'pose is transformed by custom frame of reference from polyfill'); + }); + + it('rejects if stage not provided and emulation disabled', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + + return new Promise((resolve, reject) => + session.requestFrameOfReference('stage', { disableStageEmulation: true }) + .then(reject, resolve)); + }); + + it('rejects if the polyfill rejects the option', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + + polyfill.requestFrameOfReferenceTransform = function (type, options) { + return Promise.reject(); + }; + + return new Promise((resolve, reject) => { + session.requestFrameOfReference('headModel').then(reject, resolve); + }); + }); + + it('`emulatedHeight` is 0 when using non-stage reference', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + const ref = await session.requestFrameOfReference('headModel'); + assert.equal(ref.emulatedHeight, 0); + }); + + it('`emulatedHeight` is 0 when using non-emulated stage reference', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + polyfill.requestFrameOfReferenceTransform = function (type, options) { + const out = new Float32Array() + mat4_identity(out); + return out; + }; + + let ref = await session.requestFrameOfReference('stage', { disableStageEmulation: true }); + assert.equal(ref.emulatedHeight, 0); + + // Allowing emulation shouldn't change this as the platform provides + ref = await session.requestFrameOfReference('stage', { disableStageEmulation: false }); + assert.equal(ref.emulatedHeight, 0); + }); + + it('`emulatedHeight` is default value when using emulated stage when using 0 as `stageEmulationHeight`', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + const ref = await session.requestFrameOfReference('stage', { stageEmulationHeight: 0 }); + assert.equal(ref.emulatedHeight, 1.6); + }); + + it('`emulatedHeight` is default value when using emulated stage', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + const ref = await session.requestFrameOfReference('stage'); + assert.equal(ref.emulatedHeight, 1.6); + }); + + it('`emulatedHeight` uses `stageEmulationHeight` when emulated and non-zero', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + const ref = await session.requestFrameOfReference('stage', { stageEmulationHeight: 2.0 }); + assert.equal(ref.emulatedHeight, 2); + }); + + it('provides `bounds` when requesting a stage from a 6DOF device', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global, { hasPosition: true })); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + const ref = await session.requestFrameOfReference('stage');//, { stageEmulationHeight: 2.0 }); + assert.instanceOf(ref.bounds, XRStageBounds); + assert.equal(ref.bounds.geometry[0].x, -2.5); + assert.equal(ref.bounds.geometry[0].z, -5); + assert.equal(ref.bounds.geometry[1].x, 2.5); + assert.equal(ref.bounds.geometry[1].z, -5); + assert.equal(ref.bounds.geometry[2].x, 2.5); + assert.equal(ref.bounds.geometry[2].z, 5); + assert.equal(ref.bounds.geometry[3].x, -2.5); + assert.equal(ref.bounds.geometry[3].z, 5); + }); + + describe('XRFrameOfReference#transformBasePoseMatrix', () => { + // Get pose with translation of <5, 6, 7> + const getPose = () => new Float32Array([ + 1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, 0, + 5, 6, 7, 1 + ]); + + const data = [ + // headModel should strip out only translation + ['headModel', [ + 1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, 0, + 0, 0, 0, 1 + ]], + // eyeLevel shouldn't modify the pose at all + ['eyeLevel', [ + 1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, 0, + 5, 6, 7, 1 + ]], + // stage should increment the Y translation by the default + // emulation height + ['stage', [ + 1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, 0, + 5, 7.6, 7, 1 + ]] + ]; + + data.forEach(([type, expected]) => { + it(`uses the default transform for ${type} if none provided`, async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + const frameOfRef = await session.requestFrameOfReference(type); + const actual = mat4_identity(new Float32Array(16)); + frameOfRef.transformBasePoseMatrix(actual, getPose()); + assert.deepEqual(actual, new Float32Array(expected)); + }); + }); + + it('uses stageEmulationHeight when provided when emulating stage', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + const frameOfRef = await session.requestFrameOfReference('stage', { stageEmulationHeight: 1.55 }); + const actual = mat4_identity(new Float32Array(16)); + frameOfRef.transformBasePoseMatrix(actual, getPose()); + assert.deepEqual(actual, new Float32Array([ + 1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, -1, 0, + 5, 7.55, 7, 1 + ])); + }); + }); + + describe('XRFrameOfReference#transformBaseViewMatrix', () => { + it('correctly transforms view matrix when non-stage values provided'); + it('correctly transforms view matrix when stage values provided'); + }); +}); diff --git a/test/api/test-xr-layer.js b/test/api/test-xr-layer.js new file mode 100644 index 0000000..df5c294 --- /dev/null +++ b/test/api/test-xr-layer.js @@ -0,0 +1,35 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import XRDevice from '../../src/api/XRDevice'; +import XRSession from '../../src/api/XRSession'; +import XRDevicePose from '../../src/api/XRDevicePose'; +import XRPresentationContext from '../../src/api/XRPresentationContext'; +import { mat4_identity } from '../../src/math'; +import WebVRDevice from '../../src/devices/WebVRDevice'; +import MockVRDisplay from '../lib/MockVRDisplay'; +import { MockGlobalVR } from '../lib/globals'; + +const EPSILON = 0.0001; + +describe('API - XRLayer', () => { + describe('XRLayer#getViewport()', () => { + it('returns XRViewport with appropriate x, y, width, height values when exclusive'); + it('returns XRViewport with appropriate x, y, width, height values when non-exclusive'); + }); +}); diff --git a/test/api/test-xr-presentation-frame.js b/test/api/test-xr-presentation-frame.js new file mode 100644 index 0000000..9feddd8 --- /dev/null +++ b/test/api/test-xr-presentation-frame.js @@ -0,0 +1,49 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import XRSession from '../../src/api/XRSession'; +import XRDevicePose from '../../src/api/XRDevicePose'; +import { createXRDevice } from '../lib/utils'; + +describe('API - XRPresentationFrame', () => { + let device, session, ref; + beforeEach(async function () { + device = createXRDevice(); + session = await device.requestSession({ exclusive: true }); + ref = await session.requestFrameOfReference('eyeLevel'); + }); + + it('has two views', done => { + session.requestAnimationFrame((t, frame) => { + assert.equal(frame.views.length, 2); + const eyes = frame.views.map(v => v.eye); + assert.include(eyes, 'left'); + assert.include(eyes, 'right'); + done(); + }); + }); + + it('can get a device pose', done => { + session.requestAnimationFrame((t, frame) => { + const pose = frame.getDevicePose(ref); + assert.instanceOf(pose, XRDevicePose); + assert.instanceOf(pose.poseModelMatrix, Float32Array); + done(); + }); + }); +}); diff --git a/test/api/test-xr-session.js b/test/api/test-xr-session.js new file mode 100644 index 0000000..abdb72c --- /dev/null +++ b/test/api/test-xr-session.js @@ -0,0 +1,333 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; +import raf from 'raf'; + +import XRDevice from '../../src/api/XRDevice'; +import XRSession from '../../src/api/XRSession'; +import XRPresentationContext from '../../src/api/XRPresentationContext'; +import XRFrameOfReference from '../../src/api/XRFrameOfReference'; +import { MockGlobalVR } from '../lib/globals'; +import MockVRDisplay from '../lib/MockVRDisplay'; +import WebVRDevice from '../../src/devices/WebVRDevice'; +import { createXRDevice } from '../lib/utils'; + +describe('API - XRSession', () => { + it('has `device` property of owner XRDevice', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + assert.equal(session.device, device); + }); + + it('has `exclusive` property set to session options', async function () { + let options = { exclusive: true, outputContext: new XRPresentationContext() }; + let device = createXRDevice(); + let session = await device.requestSession(options); + assert.equal(session.exclusive, true); + + options.exclusive = false; + device = createXRDevice(); + session = await device.requestSession(options); + assert.equal(session.exclusive, false); + }); + + it('has `outputContext` property set to session options', async function () { + let options = { exclusive: true, outputContext: new XRPresentationContext() }; + let device = createXRDevice(); + let session = await device.requestSession(options); + assert.equal(session.outputContext, options.outputContext); + + options.outputContext = undefined; + device = createXRDevice(); + session = await device.requestSession(options); + assert.equal(session.outputContext, undefined); + }); + + it('has `depthNear` that properly get/sets to polyfill', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + + polyfill.depthNear = 0.2; + assert.equal(session.depthNear, 0.2); + + session.depthNear = 0.3; + assert.equal(polyfill.depthNear, 0.3); + }); + + it('has `depthFar` that properly get/sets to polyfill', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + + polyfill.depthFar = 200; + assert.equal(session.depthFar, 200); + + session.depthFar = 300; + assert.equal(polyfill.depthFar, 300); + }); + + it('calls polyfilled device `onBaseLayerSet` when setting a baselayer', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + const fakeLayer = { context: { canvas: {} }}; + + session.baseLayer = fakeLayer; + assert.equal(polyfill.sessions.size, 1); + let sessionId = null; + polyfill.sessions.forEach((value) => sessionId = value.id); + while (!polyfill.sessions.get(sessionId).baseLayer) { + await new Promise(resolve => setTimeout(resolve, 10)); + } + assert.equal(polyfill.sessions.get(sessionId).baseLayer, fakeLayer); + }); + + it('suspends all sessions when an exclusive session starts', async function () { + const device = createXRDevice(); + return new Promise(async function (resolve) { + let blur = 0; + const onBlur = () => { + blur++; + if (blur === 5) { + resolve(); + } + } + + const pSessions = new Array(5).fill(0).map(() => { + return device.requestSession({ + outputContext: new XRPresentationContext() + }); + }); + + const sessions = await Promise.all(pSessions); + sessions.forEach(s => s.addEventListener('blur', onBlur)); + device.requestSession({ exclusive: true }); + }); + }); + + it('resumes suspended requestAnimationFrame loop upon `focus`', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ + outputContext: new XRPresentationContext() + }); + + let blurredOnce = false; + let blurred = false; + const onBlur = () => { + blurred = true; + blurredOnce = true; + } + const onFocus = () => blurred = false; + const onFrame = (t, frame) => { + assert.equal(blurred, false); + session.requestAnimationFrame(onFrame); + }; + session.addEventListener('blur', onBlur); + session.addEventListener('focus', onFocus); + session.requestAnimationFrame(onFrame); + + const exSession = await device.requestSession({ exclusive: true }); + await exSession.end(); + assert.equal(blurredOnce, true); + assert.equal(blurred, false); + }); + + describe('XRSession#requestFrameOfReference()', () => { + it('only accepts valid XRFrameOfReferenceTypes', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + + for (const type of ['headModel', 'eyeLevel', 'stage']) { + const frameOfRef = await session.requestFrameOfReference(type); + assert.instanceOf(frameOfRef, XRFrameOfReference); + } + + for (const badType of [undefined, 'outerspace']) { + let caught = false; + try { + await session.requestFrameOfReference(badType); + } catch (e) { + caught = true; + } + assert.equal(caught, true); + } + }); + }); + + describe('XRSession#requestAnimationFrame()', () => { + it('uses the polyfill\'s function for requestAnimationFrame and calls onFrameStart/onFrameEnd', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + + const events = []; + return new Promise(async function (resolve) { + polyfill.onFrameStart = function () { + events.push('framestart'); + }; + + polyfill.requestAnimationFrame = function (callback) { + raf(callback); + events.push('requestframe'); + }; + + polyfill.onFrameEnd = function () { + events.push('frameend'); + + assert.deepEqual(events, ['requestframe', 'framestart', 'callback', 'frameend']); + resolve(); + }; + + session.requestAnimationFrame(function () { + assert.deepEqual(events, ['requestframe', 'framestart']); + events.push('callback'); + }); + }); + }); + }); + + describe('XRSession#cancelAnimationFrame()', () => { + it('cancels the frame for the passed in handler', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ exclusive: true }); + + let framesCalled = 0; + let onFrame = () => framesCalled++; + let handle = session.requestAnimationFrame(onFrame); + session.cancelAnimationFrame(handle); + + await new Promise(resolve => raf(resolve)); + assert.equal(framesCalled, 0); + + session.requestAnimationFrame(onFrame); + // cancel with last frame's handle, so no effect + session.cancelAnimationFrame(handle); + await new Promise(resolve => raf(resolve)); + assert.equal(framesCalled, 1); + + // Give it another tick to make sure + // there's not another frame + await new Promise(resolve => raf(resolve)); + assert.equal(framesCalled, 1); + }); + }); + + describe('XRSession#end()', () => { + it('calls the polyfill\'s `end()` function when non-exclusive', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ outputContext: new XRPresentationContext() }); + + let called = false; + const end = polyfill.endSession; + polyfill.endSession = id => { + called = true; + end.call(polyfill, id); + }; + + await session.end(); + assert.equal(called, true); + }); + + it('fires an `end` event', async function () { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + const device = new XRDevice(polyfill); + const session = await device.requestSession({ exclusive: true }); + + return new Promise(resolve => { + session.addEventListener('end', e => { + assert.equal(e.session, session, 'event has correct `session` attribute'); + resolve(); + }); + session.end(); + }); + }); + }); + + describe('events', () => { + describe('blur', () => { + it('fires `blur` event when non-exclusive session is suspended', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ + outputContext: new XRPresentationContext() + }); + return new Promise(resolve => { + session.addEventListener('blur', e => { + assert.equal(e.session, session); + resolve(); + }); + + device.requestSession({ exclusive: true }); + }); + }); + + it('propagates a `blur` event from PolyfilledXRDevice'); + }); + + describe('focus', () => { + it('fires `focus` event when non-exclusive session is suspended', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ + outputContext: new XRPresentationContext() + }); + return new Promise(async function (resolve) { + const exSession = await device.requestSession({ exclusive: true }); + session.addEventListener('focus', e => { + assert.equal(e.session, session); + resolve(); + }); + + await exSession.end(); + }); + }); + + it('propagates a `focus` event from PolyfilledXRDevice'); + }); + + describe('resetpose', () => { + it('propagates a `resetpose` event from PolyfilledXRDevice'); + }); + + describe('end', () => { + it('fires `end` event when session is terminated', async function () { + const device = createXRDevice(); + const session = await device.requestSession({ + outputContext: new XRPresentationContext() + }); + return new Promise(async function (resolve) { + session.addEventListener('end', e => { + assert.equal(e.session, session); + resolve(); + }); + + await session.end(); + }); + }); + + it('propagates a `end` event from PolyfilledXRDevice'); + }); + }); +}); diff --git a/test/api/test-xr-stage-bounds.js b/test/api/test-xr-stage-bounds.js new file mode 100644 index 0000000..2c60591 --- /dev/null +++ b/test/api/test-xr-stage-bounds.js @@ -0,0 +1,38 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import XRStageBounds from '../../src/api/XRStageBounds'; +import XRStageBoundsPoint from '../../src/api/XRStageBoundsPoint'; + +describe('API - XRStageBounds', () => { + it('can be constructed interally with an array of X and Z values', () => { + const bounds = new XRStageBounds([ + -2, -3, + 2, -3, + 2, 3, + -2, 3 + ]); + + for (let i = 0; i < bounds.geometry.length; i++) { + const point = bounds.geometry[i]; + assert.instanceOf(point, XRStageBoundsPoint); + assert.equal(point.x, (i === 0 || i === 3) ? -2 : 2); + assert.equal(point.z, i < 2 ? -3 : 3); + } + }); +}); diff --git a/test/api/test-xr-view.js b/test/api/test-xr-view.js new file mode 100644 index 0000000..7687484 --- /dev/null +++ b/test/api/test-xr-view.js @@ -0,0 +1,113 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import XRDevice from '../../src/api/XRDevice'; +import XRSession from '../../src/api/XRSession'; +import XRDevicePose from '../../src/api/XRDevicePose'; +import XRPresentationContext from '../../src/api/XRPresentationContext'; +import { mat4_identity } from '../../src/math'; +import WebVRDevice from '../../src/devices/WebVRDevice'; +import MockVRDisplay from '../lib/MockVRDisplay'; +import { MockGlobalVR } from '../lib/globals'; + +const EPSILON = 0.0001; + +describe('API - XRView', () => { + let global, polyfill, device, session, ref; + // Technically this will expose the `frame` on a different than + // requested tick, but as long as we're not asking for a new frame, + // nothing should change in this mock env + let getFrame = () => new Promise(r => session.requestAnimationFrame((t, frame) => r(frame))); + beforeEach(async function () { + global = new MockGlobalVR(); + polyfill = new WebVRDevice(global, new MockVRDisplay(global)); + device = new XRDevice(polyfill); + session = await device.requestSession({ exclusive: true }); + ref = await session.requestFrameOfReference('eyeLevel'); + }); + + it('has `eye` property of left and right', async function () { + let frame = await getFrame(); + assert.equal(frame.views.length, 2); + assert.ok(frame.views.some(v => v.eye === 'left')) + assert.ok(frame.views.some(v => v.eye === 'right')) + }); + + it('has `projectionMatrix` based off of depthNear/depthFar', async function () { + let expected = new Float32Array([ + 2.8278, 0, 0, 0, + 0, 5.0273, 0, 0, + 0, 0, -1.0002, -1, + 0, 0, -0.2, 0 + ]); + + session.depthNear = 0.1; + session.depthFar = 1000; + let frame = await getFrame(); + let view = frame.views[0]; + for (let i = 0; i < expected.length; i++) { + assert.closeTo(view.projectionMatrix[i], expected[i], EPSILON); + } + + // Change depthNear to see if it propagates to the projectionMatrix + session.depthNear = 0.01; + session.depthFar = 1000; + frame = await getFrame(); + view = frame.views[0]; + expected[10] = -1.00002; + expected[14] = -0.02000; + for (let i = 0; i < expected.length; i++) { + assert.closeTo(view.projectionMatrix[i], expected[i], EPSILON); + } + }); + + /** + * TODO this function been moved to XRLayer, so we're + * testing the underlying implementation here. We should test + * the XRLayer directly, although that's a bit harder with the WebGLContext + * usage in node. + */ + describe('XRView#_getViewport()', () => { + it('returns XRViewport with appropriate x, y, width, height values when exclusive', async function () { + const layer = { context: { canvas: { width: 1920, height: 1080 }}}; + + let frame = await getFrame(); + assert.equal(frame.views.length, 2); + for (let view of frame.views) { + let viewport = view._getViewport(layer); + assert.equal(viewport.x, view.eye === 'left' ? 0 : layer.context.canvas.width / 2); + assert.equal(viewport.y, 0); + assert.equal(viewport.width, layer.context.canvas.width / 2); + assert.equal(viewport.height, layer.context.canvas.height); + } + }); + + it('returns XRViewport with appropriate x, y, width, height values when non-exclusive', async function () { + const layer = { context: { canvas: { width: 1920, height: 1080 }}}; + session = await device.requestSession({ outputContext: new XRPresentationContext() }); + + let frame = await getFrame(); + assert.equal(frame.views.length, 1); + let viewport = frame.views[0]._getViewport(layer); + assert.equal(viewport.x, 0); + assert.equal(viewport.y, 0); + assert.equal(viewport.width, 1920); + assert.equal(viewport.height, 1080); + }); + }); +}); diff --git a/test/api/test-xr.js b/test/api/test-xr.js new file mode 100644 index 0000000..5cccd58 --- /dev/null +++ b/test/api/test-xr.js @@ -0,0 +1,38 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import XR from '../../src/api/XR'; +import XRDevice from '../../src/api/XRDevice'; +import { createXRDevice } from '../lib/utils'; + +describe('API - XR', () => { + describe('XR#requestDevice()', () => { + it('returns seeded thennable devices', async function () { + const device = createXRDevice(); + const pDevice = new Promise(resolve => resolve(device)); + const xr = new XR(pDevice); + const rDevice = await xr.requestDevice(); + assert.equal(rDevice, device); + }); + }); + + describe('events', () => { + it('propagates a `deviceconnect` event from PolyfilledXRDevice'); + it('propagates a `devicedisconnect` event from PolyfilledXRDevice'); + }); +}); diff --git a/test/lib/MockVRDisplay.js b/test/lib/MockVRDisplay.js new file mode 100644 index 0000000..eed0562 --- /dev/null +++ b/test/lib/MockVRDisplay.js @@ -0,0 +1,179 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import raf from 'raf'; +import EventTarget from '../../src/lib/EventTarget'; +import now from '../../src/lib/now'; +import { + perspective, + mat4_copy, + mat4_invert, + mat4_fromRotationTranslation, + mat4_identity +} from '../../src/math'; + +const IPD = 0.062; +let displayId = 0; +export default class MockVRDisplay extends EventTarget { + constructor(global, config = {}) { + super(); + this.global = global; + this.displayId = ++displayId; + this.displayName = 'MockVRDisplay'; + this.depthNear = 0.1; + this.depthFar = 1000.0; + this.isPresenting = false; + this.stageParameters = null; + + this.capabilities = Object.assign({ + hasPosition: false, + hasOrientation: true, + hasExternalDisplay: false, + canPresent: true, + maxLayers: 1, + }, config); + + if (this.capabilities.hasPosition) { + this.stageParameters = { + sizeX: 5, + sizeZ: 10, + sittingToStandingTransform: new Float32Array([ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ]), + }; + } + + // Width/height for calculating mock matrices/viewport + this._width = 1920; + this._height = 1080; + + this._leftViewMatrix = new Float32Array(16); + this._rightViewMatrix = new Float32Array(16); + this._leftProjectionMatrix = new Float32Array(16); + this._rightProjectionMatrix = new Float32Array(16); + this._poseMatrix = new Float32Array(16); + + mat4_identity(this._leftViewMatrix); + mat4_identity(this._rightViewMatrix); + mat4_identity(this._poseMatrix); + } + + getFrameData(data) { + data.timestamp = now(); + + // Update projection matrices + perspective(this._leftProjectionMatrix, Math.PI / 8, this._width / this._height, this.depthNear, this.depthFar); + perspective(this._rightProjectionMatrix, Math.PI / 8, this._width / this._height, this.depthNear, this.depthFar); + + mat4_copy(data.leftProjectionMatrix, this._leftProjectionMatrix); + mat4_copy(data.rightProjectionMatrix, this._rightProjectionMatrix); + mat4_copy(data.leftViewMatrix, this._leftViewMatrix); + mat4_copy(data.rightViewMatrix, this._rightViewMatrix); + + if (this.capabilities.hasPosition) { + data.pose.position[0] = this._poseMatrix[12]; + data.pose.position[1] = this._poseMatrix[13]; + data.pose.position[2] = this._poseMatrix[14]; + } + + // The tests don't animate orientation, so just use a default + // quaternion for now. + data.pose.orientation[0] = 0; + data.pose.orientation[1] = 0; + data.pose.orientation[2] = 0; + data.pose.orientation[3] = 1; + } + + /** + * @param {string} eye + * @return {VREyeParameters} + */ + getEyeParameters(eye) { + return { + offset: new Float32Array([eye === 'left' ? (-IPD/2) : (IPD/2), 0, 0]), + renderWidth: this._width / 2, + renderHeight: this._height, + }; + } + + /** + * @param {Function} callback + */ + requestAnimationFrame(callback) { + if (this.capabilities.hasPosition) { + // Tick up the Z position by 1 per frame + this._poseMatrix[14] = this._poseMatrix[14] + 1; + } + + // Copy the pose to view matrices, apply IPD difference, invert. + mat4_copy(this._leftViewMatrix, this._poseMatrix); + mat4_copy(this._rightViewMatrix, this._poseMatrix); + this._leftViewMatrix[12] = -IPD/2; + this._rightViewMatrix[12] = IPD/2; + + mat4_invert(this._leftViewMatrix, this._leftViewMatrix); + mat4_invert(this._rightViewMatrix, this._rightViewMatrix); + return raf(callback); + } + + /** + * @param {number} handle + */ + cancelAnimationFrame(handle) { + raf.cancel(handle); + } + + async requestPresent(layers) { + if (layers.length > this.capabilities.maxLayers) { + throw new Error(); + } + + if (!this.capabilities.canPresent) { + throw new Error(); + } + + const currentlyPresenting = this.isPresenting; + this.isPresenting = true; + if (!currentlyPresenting) { + const e = new this.global.window.Event('vrdisplaypresentchange'); + this.global.window.dispatchEvent(e); + } + + this._layers = layers; + } + + async exitPresent() { + const currentlyPresenting = this.isPresenting; + this.isPresenting = false; + if (currentlyPresenting) { + const e = new this.global.window.Event('vrdisplaypresentchange'); + this.global.window.dispatchEvent(e); + } + this._layers = null; + } + + submitFrame() { + if (!this.isPresenting) { + throw new Error(); + } + } + + getLayers() { + return this._layers; + } +} diff --git a/test/lib/globals.js b/test/lib/globals.js new file mode 100644 index 0000000..b14c140 --- /dev/null +++ b/test/lib/globals.js @@ -0,0 +1,55 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { JSDOM } from 'jsdom'; + +/** + * A mocked "global" object that contains all the necessary + * globals that the polyfill needs for injection and WebGL polyfilling. + * + * Polyfilled properties: + * + * `window` + * `navigator` + * `document` + */ + +export class MockGlobal { + constructor() { + const { window } = new JSDOM(`

Hello, WebXR

`); + this.window = window; + this.document = window.document; + this.navigator = window.navigator; + this.HTMLCanvasElement = {}; + this.WebGLRenderingContext = {}; + } +} + +export class MockGlobalVR extends MockGlobal { + constructor() { + super(); + this.VRFrameData = function VRFrameData() { + this.leftProjectionMatrix = new Float32Array(16); + this.rightProjectionMatrix = new Float32Array(16); + this.leftViewMatrix = new Float32Array(16); + this.rightViewMatrix = new Float32Array(16); + this.timestamp = null; + this.pose = { + position: new Float32Array(3), + orientation: new Float32Array(4), + }; + }; + } +} diff --git a/test/lib/utils.js b/test/lib/utils.js new file mode 100644 index 0000000..06a38b4 --- /dev/null +++ b/test/lib/utils.js @@ -0,0 +1,30 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import XRDevice from '../../src/api/XRDevice'; +import WebVRDevice from '../../src/devices/WebVRDevice'; +import MockVRDisplay from './MockVRDisplay'; +import { MockGlobalVR } from './globals'; + +/** + * Creates an XRDevice backed by a WebVRDevice using a MockVRDisplay. + * Pass in options that ultimately populate a VRDisplay's 1.1 capabilities, + * like 'hasExternalDisplay'. + */ +export const createXRDevice = (config) => { + const global = new MockGlobalVR(); + const polyfill = new WebVRDevice(global, new MockVRDisplay(global, config)); + return new XRDevice(polyfill); +}; diff --git a/test/setup.js b/test/setup.js new file mode 100644 index 0000000..8293861 --- /dev/null +++ b/test/setup.js @@ -0,0 +1,7 @@ +const mock = require('mock-require'); + +/** + * Mock the `cardboard-vr-display` dependency since it uses + * globals which makes it difficult to test against. + */ +mock('cardboard-vr-display', './lib/MockVRDisplay'); diff --git a/test/test-devices.js b/test/test-devices.js new file mode 100644 index 0000000..977224a --- /dev/null +++ b/test/test-devices.js @@ -0,0 +1,112 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import WebXRPolyfill from '../src/WebXRPolyfill'; +import { requestDevice } from '../src/devices'; +import XRDevice from '../src/api/XRDevice'; +import MockVRDisplay from './lib/MockVRDisplay'; +import { MockGlobal, MockGlobalVR } from './lib/globals'; + +const makeMobile = global => { + const realUA = global.navigator.userAgent; + Object.defineProperty(global.navigator, 'userAgent', { + get: () => `${realUA} iphone`, + }); +}; + +const addXR = (global, device) => { + const xr = { + requestDevice: () => new Promise(resolve => resolve(device)), + }; + + Object.defineProperty(global.navigator, 'xr', { + get: () => xr, + }); +}; + +const addVR = (global, display) => { + global.navigator.getVRDisplays = () => new Promise(resolve => resolve(display ? [display] : [])); + return; + Object.defineProperty(global.navigator, 'getVRDisplays', { + get: () => new Promise(resolve => resolve(display ? [display] : [])), + }); +}; + +describe('devices - requestDevice', () => { + it('returns XRDevice if exists', async function () { + const global = new MockGlobal(); + const xrDevice = {}; + const vrDevice = {}; + addXR(global, xrDevice); + addVR(global, vrDevice); + makeMobile(global); + + const device = await requestDevice(global, { cardboard: true, webvr: true }); + assert.equal(device, xrDevice); + }); + + it('returns wrapped VRDisplay if no native XRDevice exists', async function () { + const global = new MockGlobalVR(); + const vrDevice = new MockVRDisplay(); + addVR(global, vrDevice); + + const device = await requestDevice(global, { cardboard: true, webvr: true }); + assert.equal(device.polyfill.display, vrDevice); + assert.instanceOf(device, XRDevice); + }); + + it('returns wrapped CardboardVRDisplay if no native XRDevice or VRDisplay exists', async function () { + const global = new MockGlobalVR(); + addVR(global); + makeMobile(global); + const device = await requestDevice(global, { cardboard: true, webvr: true }); + assert.instanceOf(device, XRDevice); + assert.instanceOf(device.polyfill.display, MockVRDisplay); + }); + + it('returns wrapped CardboardVRDisplay if no native WebXR/WebVR implementations exists', async function () { + const global = new MockGlobal(); + makeMobile(global); + const device = await requestDevice(global, { cardboard: true, webvr: true }); + assert.instanceOf(device, XRDevice); + assert.instanceOf(device.polyfill.display, MockVRDisplay); + }); + + it('returns wrapped CardboardVRDisplay if no native XRDevice and webvr disabled', async function () { + const global = new MockGlobal(); + makeMobile(global); + const vrDevice = new MockVRDisplay(); + addVR(global, vrDevice); + const device = await requestDevice(global, { cardboard: true, webvr: false }); + assert.instanceOf(device, XRDevice); + assert.instanceOf(device.polyfill.display, MockVRDisplay); + }); + + it('returns no devices if no native support and not on mobile', async function () { + const global = new MockGlobal(); + const device = await requestDevice(global, { cardboard: true }); + assert.equal(device, null); + }); + + it('returns no devices if no native support and cardboard is false', async function () { + const global = new MockGlobal(); + makeMobile(global); + const device = await requestDevice(global, { cardboard: false }); + assert.equal(device, null); + }); +}); diff --git a/test/test-webxr-polyfill.js b/test/test-webxr-polyfill.js new file mode 100644 index 0000000..f6199be --- /dev/null +++ b/test/test-webxr-polyfill.js @@ -0,0 +1,90 @@ +/* + * Copyright 2017 Google Inc. All Rights Reserved. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import mocha from 'mocha'; +import { assert } from 'chai'; + +import WebXRPolyfill from '../src/WebXRPolyfill'; +import XRDevice from '../src/api/XRDevice'; +import { createXRDevice } from './lib/utils'; +import { MockGlobal } from './lib/globals'; + +const mockRequestDevice = () => new Promise(resolve => setTimeout(resolve, 5)); + +const makeMobile = global => { + const realUA = global.navigator.userAgent; + Object.defineProperty(global.navigator, 'userAgent', { + get: () => `${realUA} iphone`, + }); +} + +describe('WebXRPolyfill', () => { + describe('injecting', () => { + it('polyfills the WebXR API if navigator.xr does not exist', () => { + const global = new MockGlobal(); + assert.ok(!global.navigator.xr); + const polyfill = new WebXRPolyfill(global); + assert.ok(global.navigator.xr); + assert.equal(polyfill.injected, true); + }); + + it('does not polyfill if navigator.xr already exists', () => { + const global = new MockGlobal(); + // Inject the API to start as if it were native + new WebXRPolyfill(global); + + const polyfill = new WebXRPolyfill(global); + assert.ok(global.navigator.xr); + assert.equal(polyfill.injected, false); + }); + }); + + describe('patching', () => { + it('does not patch `xr.requestDevice` if exists when on desktop', () => { + const global = new MockGlobal(); + // Inject the API to start as if it were native + new WebXRPolyfill(global); + global.navigator.xr.requestDevice = mockRequestDevice; + + const polyfill = new WebXRPolyfill(global); + assert.equal(polyfill.injected, false); + assert.ok(global.navigator.xr.requestDevice === mockRequestDevice); + }); + + it('does not patch `xr.requestDevice` if exists on mobile when cardboard is false', () => { + const global = new MockGlobal(); + makeMobile(global); + // Inject the API to start as if it were native + new WebXRPolyfill(global); + global.navigator.xr.requestDevice = mockRequestDevice; + + const polyfill = new WebXRPolyfill(global, { cardboard: false }); + assert.equal(polyfill.injected, false); + assert.ok(global.navigator.xr.requestDevice === mockRequestDevice); + }); + + it('patches `xr.requestDevice` if exists on mobile and cardboard is true', () => { + const global = new MockGlobal(); + makeMobile(global); + // Inject the API to start as if it were native + new WebXRPolyfill(global); + global.navigator.xr.requestDevice = mockRequestDevice; + + const polyfill = new WebXRPolyfill(global, { cardboard: true }); + assert.equal(polyfill.injected, false); + assert.ok(global.navigator.xr.requestDevice !== mockRequestDevice); + }); + }); +});