From 51071f1210b8357806c24cc2a6a869aa8380adda Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Mon, 15 Mar 2021 19:13:33 +0100 Subject: [PATCH] fix liquid effect for android --- src/components/liquid/LiquidEffect.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/components/liquid/LiquidEffect.js b/src/components/liquid/LiquidEffect.js index 244ad5e..99411c5 100644 --- a/src/components/liquid/LiquidEffect.js +++ b/src/components/liquid/LiquidEffect.js @@ -1,6 +1,7 @@ import { FloatType, Mesh, + NearestFilter, OrthographicCamera, PlaneBufferGeometry, RGBAFormat, @@ -18,8 +19,17 @@ function LiquidEffect(renderer) { // this.delta = new Vector2(this.width / Math.pow(width, 2), this.height / Math.pow(height, 2)); this.delta = new Vector2(1 / this.width, 1 / this.height); - this.hMap = new WebGLRenderTarget(this.width, this.height, { type: FloatType, format: RGBAFormat, depthBuffer: false, stencilBuffer: false }); - this.hMap1 = new WebGLRenderTarget(this.width, this.height, { type: FloatType, format: RGBAFormat, depthBuffer: false, stencilBuffer: false }); + const targetOptions = { + minFilter: NearestFilter, + magFilter: NearestFilter, + type: FloatType, + format: RGBAFormat, + depthBuffer: false, + // stencilBuffer: false, + }; + + this.hMap = new WebGLRenderTarget(this.width, this.height, targetOptions); + this.hMap1 = new WebGLRenderTarget(this.width, this.height, targetOptions); this.fsQuad = new FullScreenQuad(); this.initShaders(); @@ -150,10 +160,10 @@ LiquidEffect.prototype.addDrop = function (x, y, radius, strength) { this.swapBuffers(); }; -LiquidEffect.prototype.renderBuffer = function (buffer, target) { - this.copyMat.uniforms.tDiffuse.value = buffer.texture; - this.renderShaderMat(this.copyMat, target); -}; +// LiquidEffect.prototype.renderBuffer = function (buffer, target) { +// this.copyMat.uniforms.tDiffuse.value = buffer.texture; +// this.renderShaderMat(this.copyMat, target); +// }; LiquidEffect.prototype.renderShaderMat = function (mat, target) { this.fsQuad.material = mat;