Sfoglia il codice sorgente

VRControls/VREffect: Added getVRDisplays(). See #9133.

Mr.doob 9 anni fa
parent
commit
44ca4217c9
2 ha cambiato i file con 16 aggiunte e 2 eliminazioni
  1. 7 1
      examples/js/controls/VRControls.js
  2. 9 1
      examples/js/effects/VREffect.js

+ 7 - 1
examples/js/controls/VRControls.js

@@ -7,7 +7,7 @@ THREE.VRControls = function ( object, onError ) {
 
 	var scope = this;
 
-	var vrDisplay;
+	var vrDisplay, vrDisplays;
 
 	var standingMatrix = new THREE.Matrix4();
 
@@ -66,6 +66,12 @@ THREE.VRControls = function ( object, onError ) {
 
 	};
 
+	this.getVRDisplays = function () {
+
+		return vrDisplays;
+
+	};
+
 	this.getStandingMatrix = function () {
 
 		return standingMatrix;

+ 9 - 1
examples/js/effects/VREffect.js

@@ -13,7 +13,7 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	var isWebVR1 = true;
 
-	var vrDisplay;
+	var vrDisplay, vrDisplays;
 	var eyeTranslationL = new THREE.Vector3();
 	var eyeTranslationR = new THREE.Vector3();
 	var renderRectL, renderRectR;
@@ -21,6 +21,8 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	function gotVRDisplays( displays ) {
 
+		vrDisplays = displays;
+
 		for ( var i = 0; i < displays.length; i ++ ) {
 
 			if ( 'VRDisplay' in window && displays[ i ] instanceof VRDisplay ) {
@@ -74,6 +76,12 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	};
 
+	this.getVRDisplays = function () {
+
+		return vrDisplays;
+
+	};
+
 	this.setSize = function ( width, height ) {
 
 		rendererSize = { width: width, height: height };