Explorar o código

More VR* clean up.

Mr.doob %!s(int64=10) %!d(string=hai) anos
pai
achega
5f6d4cc80c
Modificáronse 2 ficheiros con 10 adicións e 30 borrados
  1. 6 14
      examples/js/controls/VRControls.js
  2. 4 16
      examples/js/effects/VREffect.js

+ 6 - 14
examples/js/controls/VRControls.js

@@ -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 () {

+ 4 - 16
examples/js/effects/VREffect.js

@@ -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;