提交 5f6d4cc8 编写于 作者: M Mr.doob

More VR* clean up.

上级 604540ff
......@@ -3,14 +3,13 @@
* @author mrdoob / http://mrdoob.com
*/
THREE.VRControls = function ( object, callback ) {
THREE.VRControls = function ( object, onError ) {
var scope = this;
// Allow for multiple VR input devices.
var vrInputs = [];
var onVRDevices = function ( devices ) {
function gotVRDevices( devices ) {
for ( var i = 0; i < devices.length; i ++ ) {
......@@ -24,27 +23,20 @@ THREE.VRControls = function ( object, callback ) {
}
if ( callback !== undefined ) {
callback( 'HMD not available' );
}
if ( onError ) onError( 'HMD not available' );
};
if ( navigator.getVRDevices !== undefined ) {
if ( navigator.getVRDevices ) {
navigator.getVRDevices().then( onVRDevices );
} else if ( callback !== undefined ) {
callback( 'Your browser is not VR Ready' );
navigator.getVRDevices().then( gotVRDevices );
}
// the Rift SDK returns the position in meters
// this scale factor allows the user to define how meters
// are converted to scene units.
this.scale = 1;
this.update = function () {
......
......@@ -2,25 +2,13 @@
* @author dmarcos / https://github.com/dmarcos
* @author mrdoob / http://mrdoob.com
*
* It handles stereo rendering
* If mozGetVRDevices and getVRDevices APIs are not available it gracefuly falls back to a
* regular renderer
* WebVR Spec: http://mozvr.github.io/webvr-spec/webvr.html
*
* The HMD supported is the Oculus DK1 and The Web API doesn't currently allow
* to query for the display resolution (only the chrome API allows it).
* The dimensions of the screen are temporarly hardcoded (1280 x 800).
*
* For VR mode to work it has to be used with the Oculus enabled builds of Firefox or Chrome:
*
* Firefox:
*
* http://mozvr.com/downloads.html
*
* Chrome builds:
*
* https://drive.google.com/a/google.com/folderview?id=0BzudLt22BqGRbW9WTHMtOWMzNjQ&usp=sharing#list
* Firefox: http://mozvr.com/downloads/
* Chromium: https://drive.google.com/folderview?id=0BzudLt22BqGRbW9WTHMtOWMzNjQ&usp=sharing#list
*
*/
THREE.VREffect = function ( renderer, onError ) {
var vrHMD;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册