Browse Source

VREffect improvements.

Mr.doob 11 years ago
parent
commit
295581dc98
2 changed files with 8 additions and 4 deletions
  1. 7 3
      examples/js/effects/VREffect.js
  2. 1 1
      examples/webgl_effects_vr.html

+ 7 - 3
examples/js/effects/VREffect.js

@@ -95,8 +95,8 @@ THREE.VREffect = function ( renderer, done ) {
 			camera.updateMatrixWorld();
 		}
 
-		cameraLeft.projectionMatrix = this.FovToProjection( this.leftEyeFOV );
-		cameraRight.projectionMatrix = this.FovToProjection( this.rightEyeFOV );
+		cameraLeft.projectionMatrix = this.FovToProjection( this.leftEyeFOV, true, camera.near, camera.far );
+		cameraRight.projectionMatrix = this.FovToProjection( this.rightEyeFOV, true, camera.near, camera.far );
 
 		camera.matrixWorld.decompose( cameraLeft.position, cameraLeft.quaternion, cameraLeft.scale );
 		camera.matrixWorld.decompose( cameraRight.position, cameraRight.quaternion, cameraRight.scale );
@@ -116,6 +116,10 @@ THREE.VREffect = function ( renderer, done ) {
 
 	};
 
+	this.setSize = function( width, height ) {
+		renderer.setSize( width, height );
+	};
+
 	this.setFullScreen = function( enable ) {
 		var renderer = this._renderer;
 		var vrHMD = this._vrHMD;
@@ -231,4 +235,4 @@ THREE.VREffect = function ( renderer, done ) {
 		return this.FovPortToProjection(fovPort, rightHanded, zNear, zFar);
 	};
 
-};
+};

+ 1 - 1
examples/webgl_effects_vr.html

@@ -144,7 +144,7 @@
 				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
 
-				renderer.setSize( window.innerWidth, window.innerHeight );
+				vrEffect.setSize( window.innerWidth, window.innerHeight );
 
 			}