Quellcode durchsuchen

WebGLRenderer: only account for pixel ratio when applying scissor, viewport to canvas

Garrett Johnson vor 2 Jahren
Ursprung
Commit
6c348d74da
1 geänderte Dateien mit 20 neuen und 2 gelöschten Zeilen
  1. 20 2
      src/renderers/WebGLRenderer.js

+ 20 - 2
src/renderers/WebGLRenderer.js

@@ -462,7 +462,16 @@ function WebGLRenderer( parameters = {} ) {
 
 		}
 
-		state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );
+		_currentViewport.copy( _viewport );
+
+		// pixel ratio only applies to the canvas
+		if ( _currentRenderTarget === null ) {
+
+			_currentViewport.multiplyScalar( _pixelRatio );
+
+		}
+
+		state.viewport( _currentViewport.floor() );
 
 	};
 
@@ -484,7 +493,16 @@ function WebGLRenderer( parameters = {} ) {
 
 		}
 
-		state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );
+		_currentScissor.copy( _scissor );
+
+		// pixel ratio only applies to the canvas
+		if ( _currentRenderTarget === null ) {
+
+			_currentScissor.multiplyScalar( _pixelRatio );
+
+		}
+
+		state.scissor( _currentScissor.floor() );
 
 	};