MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / _renderDistortion

Method _renderDistortion

src/tools/texture-lab/renderer.js:756–775  ·  view source on GitHub ↗
(params, inputTexture, width, height, flipY = 1.0)

Source from the content-addressed store, hash-verified

754 }
755
756 _renderDistortion(params, inputTexture, width, height, flipY = 1.0) {
757 const gl = this.gl;
758 const program = this.programs.distortion;
759
760 this._useProgram(program, flipY);
761
762 gl.activeTexture(gl.TEXTURE0);
763 gl.bindTexture(gl.TEXTURE_2D, inputTexture);
764
765 const typeMap = { wave: 0, swirl: 1, bulge: 2 };
766
767 gl.uniform1i(program.uniforms.u_image, 0);
768 gl.uniform1i(program.uniforms.u_type, typeMap[params.type] ?? 0);
769 gl.uniform1f(program.uniforms.u_amplitude, params.amplitude);
770 gl.uniform1f(program.uniforms.u_frequency, params.frequency);
771 gl.uniform2f(program.uniforms.u_center, params.centerX, params.centerY);
772 gl.uniform2f(program.uniforms.u_resolution, width, height);
773
774 gl.drawArrays(gl.TRIANGLES, 0, 6);
775 }
776
777 _renderPosterize(params, inputTexture, width, height, flipY = 1.0) {
778 const gl = this.gl;

Callers 1

_renderEffectMethod · 0.95

Calls 1

_useProgramMethod · 0.95

Tested by

no test coverage detected