mrdoob/three.js — pull request #5015 by dmarcos (2014-07-01 18:14:01+00:00)
Title: Renderer Plugin to handle stereo rendering and head tracking for VR HMDs...

.... It uses the native Firefox API

Mr Doob, What do you think?

- It handles stereo rendering
- It queries the state of the hmd on each render call to keep the camera in sync with the head orientation.
- It degrades gracefully. If used when the mozGetVRDevices is not available it behaves as a regular renderer.
- Included example based on webgl_interactive_cubes.html

Online version here:

http://swimminglessonsformodernlife.com/three.js/examples/webgl_plugin_vr.html

The difference boils down to the following lines:

var vrPlugin = new THREE.VRPlugin();
vrPlugin.init(renderer);
var fullScreenButton = document.querySelector('.button');
fullScreenButton.onclick = function() {
vrPlugin.enableVRMode(true);
};
vrPlugin.render( scene, camera );

The goal is making it very easy to use.

Links to VR enabled Firefox builds:

http://people.mozilla.com/~vladimir/vr/firefox-33.0a1.en-US.mac.dmg
http://people.mozilla.com/~vladimir/vr/firefox-33.0a1.en-US.win64-x86_64.zip