Pārlūkot izejas kodu

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

Garrett Johnson 2 gadi atpakaļ
vecāks
revīzija
6c348d74da
1 mainītis faili ar 20 papildinājumiem un 2 dzēšanām
  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() );
 
 
 	};
 	};