Browse Source

WebVR: Clean up.

Mr.doob 8 years ago
parent
commit
6bf939fbb3
1 changed files with 5 additions and 14 deletions
  1. 5 14
      examples/js/vr/WebVR.js

+ 5 - 14
examples/js/vr/WebVR.js

@@ -83,16 +83,7 @@ var WEBVR = {
 
 	},
 
-	getButton: function ( display, canvas ) {
-
-		/*
-		if ( display instanceof VRDisplay === false ) {
-
-			console.error( 'WebVR.getButton() now expects a VRDisplay.' );
-			return;
-
-		}
-		*/
+	getButton: function ( effect, canvas ) {
 
 		var button = document.createElement( 'button' );
 		button.style.position = 'absolute';
@@ -110,24 +101,24 @@ var WEBVR = {
 		button.style.textAlign = 'center';
 		button.style.zIndex = '999';
 
-		if ( display ) {
+		if ( effect.getVRDisplay() ) {
 
 			button.textContent = 'ENTER VR';
 			button.onclick = function () {
 
-				display.isPresenting ? display.exitPresent() : display.requestPresent( [ { source: canvas } ] );
+				effect.isPresenting ? effect.exitPresent() : effect.requestPresent( [ { source: canvas } ] );
 
 			};
 
 			window.addEventListener( 'vrdisplaypresentchange', function () {
 
-				button.textContent = display.isPresenting ? 'EXIT VR' : 'ENTER VR';
+				button.textContent = effect.isPresenting ? 'EXIT VR' : 'ENTER VR';
 
 			}, false );
 
 		} else {
 
-			button.textContent = 'NO VR DISPLAY';			
+			button.textContent = 'NO VR DISPLAY';
 
 		}