A polyfill and example code for building augmented reality (AR) and virtual reality (VR) applications using WebXR.
Перейти к файлу
blairmacintyre 28c36e0d73 update index.html 2017-10-23 22:41:19 -04:00
examples added screenshots 2017-10-23 22:38:08 -04:00
polyfill Merge pull request #29 from mozilla/tfs-stage-and-floor 2017-10-06 15:40:06 -07:00
tests Use a tracker coordinate system instead of stage. Update examples so they function but next they need to use the (not yet implemented) floor anchors. 2017-10-04 16:08:47 -07:00
.gitignore Pull the example code from the webxr-api repository. 2017-09-04 18:59:34 -07:00
CODING.md Use a tracker coordinate system instead of stage. Update examples so they function but next they need to use the (not yet implemented) floor anchors. 2017-10-04 16:08:47 -07:00
CONTRIBUTING.md Fix typo in the contributing doc. 2017-09-13 13:21:48 -07:00
LICENSE Use the Mozilla license. 2017-09-04 19:04:11 -07:00
README.md Update README.md 2017-10-17 17:56:27 -07:00
index.html update index.html 2017-10-23 22:41:19 -04:00
package-lock.json Pull the example code from the webxr-api repository. 2017-09-04 18:59:34 -07:00
package.json npm start also builds the polyfill 2017-09-08 13:36:23 -07:00
viewer.html added meta tag 2017-10-23 22:39:35 -04:00
webpack.config.js Pull the example code from the webxr-api repository. 2017-09-04 18:59:34 -07:00

README.md

WebXR polyfill with examples

This repository holds a polyfill and example applications for a proposed API for building AR and VR applications in web browsers.

You can find the proposed API description in the webxr-api repository.

WARNING

THIS SOFTWARE IS PRERELEASE, IS NOT READY FOR PRODUCTION USE, AND WILL SOON HAVE BREAKING CHANGES.

NOTHING IN THIS REPO COMES WITH ANY WARRENTY WHATSOEVER. DO NOT USE IT FOR ANYTHING EXCEPT EXPERIMENTS.

There are a lot of pieces of the WebXR polyfill that are stubbed out and throw 'Not implemented' when called. The paths that are used by the examples are filled in, but things like cartographic coordinates and geospatial coordinate systems are not yet implemented.

Running the examples

Clone this repo and then change directories into webxr-polyfill/

Install npm and then run the following:

npm install   # downloads webpack and an http server
npm start     # builds the polyfill in dist/webxr-polyfill.js and start the http server in the current directory

Using one of the supported browsers listed below, go to http://YOUR_HOST_NAME:8080/

Portable builds

To build the WebXR polyfill into a single file that you can use in a different codebase:

npm run build

The resulting file will be in dist/webxr-polyfill.js

Writing your own XR apps

The WebXR polyfill is not dependent on any external libraries, but examples/common.js has a handy base class, XRExampleBase, that wraps all of the boilerplate of starting a WebXR session and rendering into a WebGL layer using Three.js.

Look in examples/ar_simplest/index.html for an example of how to extend XRExampleBase and how to start up an app.

If you run these apps on Mozilla's ARKit based iOS app then they will use the class in polyfill/platform/ARKitWrapper.js to get pose and anchor data out of ARKit.

If you run these apps on Google's ARCore backed browser then they will use the class in polyfill/platform/ARCoreCameraRenderer.js to use data out of ARCore.

If you run these apps on desktop Firefox or Chrome with a WebVR 1.1 supported VR headset, the headset will be exposed as a WebXR XRDisplay.

If you run these apps on a device with no VR or AR tracking, the apps will use the 3dof orientation provided by Javascript orientation events.

Supported Displays

  • Flat Display (AR only, needs VR)
  • WebVR 1.1 HMD (VR only, needs AR)
  • Cardboard (NOT YET)
  • Hololens (NOT YET)

Supported Realities

  • Camera Reality (ARKit on Mozilla iOS Test App, WebARonARCore on Android, WebARonARKit on iOS (NOT YET), WebRTC video stream (PARTIAL))
  • Virtual Reality (Desktop Firefox with Vive and Rift, Daydream (NOT TESTED), GearVR (Not Tested), Edge with MS MR headsets (NOT TESTED))
  • Passthrough Reality (NOT YET)

Supported Browsers