Răsfoiți Sursa

Merge pull request #14743 from mrdoob/webvr

WebVRManager: Added device.capabilities.hasExternalDisplay support.
Mr.doob 7 ani în urmă
părinte
comite
66bab7bdc2
2 a modificat fișierele cu 17 adăugiri și 8 ștergeri
  1. 3 6
      src/renderers/WebGLRenderer.js
  2. 14 2
      src/renderers/webvr/WebVRManager.js

+ 3 - 6
src/renderers/WebGLRenderer.js

@@ -159,6 +159,7 @@ function WebGLRenderer( parameters ) {
 
 		// frustum
 
+		_camera = null,
 		_frustum = new Frustum(),
 
 		// clipping
@@ -1043,6 +1044,7 @@ function WebGLRenderer( parameters ) {
 		_currentGeometryProgram.wireframe = false;
 		_currentMaterialId = - 1;
 		_currentCamera = null;
+		_camera = camera;
 
 		// update scene graph
 
@@ -1124,12 +1126,7 @@ function WebGLRenderer( parameters ) {
 
 		} else {
 
-			// opaque pass (front-to-back order)
-
 			if ( opaqueObjects.length ) renderObjects( opaqueObjects, scene, camera );
-
-			// transparent pass (back-to-front order)
-
 			if ( transparentObjects.length ) renderObjects( transparentObjects, scene, camera );
 
 		}
@@ -1154,7 +1151,7 @@ function WebGLRenderer( parameters ) {
 
 		if ( vr.enabled ) {
 
-			vr.submitFrame();
+			vr.submitFrame( scene, _camera );
 
 		}
 

+ 14 - 2
src/renderers/webvr/WebVRManager.js

@@ -356,9 +356,21 @@ function WebVRManager( renderer ) {
 
 	};
 
-	this.submitFrame = function () {
+	this.submitFrame = function ( scene, camera ) {
 
-		if ( isPresenting() ) device.submitFrame();
+		if ( isPresenting() ) {
+
+			device.submitFrame();
+
+			if ( device.capabilities.hasExternalDisplay ) {
+
+				scope.enabled = false;
+				renderer.render( scene, camera );
+				scope.enabled = true;
+
+			}
+
+		}
 
 	};