소스 검색

Fix StereoEffect so it actually clips correctly

Line and point rasterization is not clipped by gl.viewport,
gl.viewport only clips vertex calculations. If a vertex is
on the edge of the viewport (so it's not clipped) but it's
being turned into a `POINT`, and say `gl_PointSize = 16` then
 that point will get rendered partially outside the viewport.

Also gl.clear is not affected by viewport settings, only scissor
settings so there's no reason to change the viewport to clear.
Gregg Tavares 10 년 전
부모
커밋
03539807c2
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      examples/js/effects/StereoEffect.js

+ 5 - 1
examples/js/effects/StereoEffect.js

@@ -122,15 +122,19 @@ THREE.StereoEffect = function ( renderer ) {
 
 		//
 
-		renderer.setViewport( 0, 0, _width * 2, _height );
 		renderer.clear();
+		renderer.enableScissorTest( true );
 
+		renderer.setScissor( 0, 0, _width, _height );
 		renderer.setViewport( 0, 0, _width, _height );
 		renderer.render( scene, _cameraL );
 
+		renderer.setScissor( _width, 0, _width, _height );
 		renderer.setViewport( _width, 0, _width, _height );
 		renderer.render( scene, _cameraR );
 
+		renderer.enableScissorTest( false );
+
 	};
 
 };