Browse Source

makes all shadings honor viewport camera (#28426)

ycw 1 year ago
parent
commit
6651acfd87
1 changed files with 4 additions and 4 deletions
  1. 4 4
      editor/js/Viewport.js

+ 4 - 4
editor/js/Viewport.js

@@ -633,8 +633,7 @@ function Viewport( editor ) {
 
 		if ( viewportCamera.isPerspectiveCamera ) {
 
-			viewportCamera.aspect = editor.camera.aspect;
-			viewportCamera.projectionMatrix.copy( editor.camera.projectionMatrix );
+			updateAspectRatio();
 
 		} else if ( viewportCamera.isOrthographicCamera ) {
 
@@ -646,6 +645,7 @@ function Viewport( editor ) {
 
 		controls.enabled = ( viewportCamera === editor.camera );
 
+		initPT();
 		render();
 
 	} );
@@ -657,7 +657,7 @@ function Viewport( editor ) {
 		switch ( viewportShading ) {
 
 			case 'realistic':
-				pathtracer.init( scene, camera );
+				pathtracer.init( scene, editor.viewportCamera );
 				break;
 
 			case 'solid':
@@ -768,7 +768,7 @@ function Viewport( editor ) {
 
 		if ( editor.viewportShading === 'realistic' ) {
 
-			pathtracer.init( scene, camera );
+			pathtracer.init( scene, editor.viewportCamera );
 
 		}