未验证 提交 48272588 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #15784 from maccesch/dev

Fixed anaglyph and multi sample render target examples
......@@ -145,6 +145,8 @@ THREE.AnaglyphEffect = function ( renderer, width, height ) {
renderer.setRenderTarget( _renderTargetR );
renderer.clear();
renderer.render( scene, _stereo.cameraR );
renderer.setRenderTarget( null );
renderer.render( _scene, _camera );
renderer.setRenderTarget( currentRenderTarget );
......
......@@ -310,8 +310,14 @@ export class WebGLRenderer implements Renderer {
/**
* Render a scene using a camera.
* The render is done to the renderTarget (if specified) or to the canvas as usual.
* If forceClear is true, the canvas will be cleared before rendering, even if the renderer's autoClear property is false.
* The render is done to a previously specified {@link WebGLRenderTarget#renderTarget .renderTarget} set by calling
* {@link WebGLRenderer#setRenderTarget .setRenderTarget} or to the canvas as usual.
*
* By default render buffers are cleared before rendering but you can prevent this by setting the property
* {@link WebGLRenderer#autoClear autoClear} to false. If you want to prevent only certain buffers being cleared
* you can set either the {@link WebGLRenderer#autoClearColor autoClearColor},
* {@link WebGLRenderer#autoClearStencil autoClearStencil} or {@link WebGLRenderer#autoClearDepth autoClearDepth}
* properties to false. To forcibly clear one ore more buffers call {@link WebGLRenderer#clear .clear}.
*/
render(
scene: Scene,
......
......@@ -1103,7 +1103,7 @@ function WebGLRenderer( parameters ) {
currentRenderState = renderStates.get( scene, camera );
currentRenderState.init();
scene.onBeforeRender( _this, scene, camera, renderTarget );
scene.onBeforeRender( _this, scene, camera, renderTarget || _currentRenderTarget );
_projScreenMatrix.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
_frustum.setFromMatrix( _projScreenMatrix );
......@@ -1174,15 +1174,15 @@ function WebGLRenderer( parameters ) {
//
if ( renderTarget !== undefined ) {
if ( _currentRenderTarget !== null ) {
// Generate mipmap if we're using any kind of mipmap filtering
textures.updateRenderTargetMipmap( renderTarget );
textures.updateRenderTargetMipmap( _currentRenderTarget );
// resolve multisample renderbuffers to a single-sample texture if necessary
textures.updateMultisampleRenderTarget( renderTarget );
textures.updateMultisampleRenderTarget( _currentRenderTarget );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册