Browse Source

fixed rounding error

Emmett Lalish 5 years ago
parent
commit
49fea882c9
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/extras/PMREMGenerator.js

+ 4 - 4
src/extras/PMREMGenerator.js

@@ -434,10 +434,10 @@ function _createRenderTarget( params ) {
 function _setViewport( x, y, width, height ) {
 
 	var invDpr = 1.0 / _renderer.getPixelRatio();
-	x *= invDpr;
-	y *= invDpr;
-	width *= invDpr;
-	height *= invDpr;
+	x = ( x + 0.5 ) * invDpr;
+	y = ( y + 0.5 ) * invDpr;
+	width = ( width + 0.5 ) * invDpr;
+	height = ( height + 0.5 ) * invDpr;
 	_renderer.setViewport( x, y, width, height );
 	_renderer.setScissor( x, y, width, height );