From dd36aa4c5f895e94857a1c7a4312f23b06ff72d7 Mon Sep 17 00:00:00 2001 From: Davide Cristini Date: Wed, 17 Jul 2024 14:58:51 +0200 Subject: [PATCH] fix: avoid warnings with Three 165+ with screen-space-reflections.js `copyFramebufferToTexture()` changed its signature in r165 https://github.com/mrdoob/three.js/pull/28329 --- src/effects/SSR/screen-space-reflections.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/effects/SSR/screen-space-reflections.js b/src/effects/SSR/screen-space-reflections.js index 197798e..f1e06d5 100644 --- a/src/effects/SSR/screen-space-reflections.js +++ b/src/effects/SSR/screen-space-reflections.js @@ -1466,9 +1466,15 @@ class TemporalResolvePass extends Pass { renderer.setRenderTarget(this.renderTarget) renderer.render(this.scene, this.camera) // save the render target's texture for use in next frame - renderer.copyFramebufferToTexture(zeroVec2, this.accumulatedTexture) - renderer.setRenderTarget(this.velocityPass.renderTarget) - renderer.copyFramebufferToTexture(zeroVec2, this.lastVelocityTexture) + if (Number(REVISION) >= 165) { + renderer.copyFramebufferToTexture(this.accumulatedTexture, zeroVec2) + renderer.setRenderTarget(this.velocityPass.renderTarget) + renderer.copyFramebufferToTexture(this.lastVelocityTexture, zeroVec2) + } else { + renderer.copyFramebufferToTexture(zeroVec2, this.accumulatedTexture) + renderer.setRenderTarget(this.velocityPass.renderTarget) + renderer.copyFramebufferToTexture(zeroVec2, this.accumulatedTexture) + } } }