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

Method _renderBlur

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

Source from the content-addressed store, hash-verified

731 }
732
733 _renderBlur(params, inputTexture, width, height, flipY = 1.0, renderScale = 1.0) {
734 const gl = this.gl;
735 const program = this.programs.blur;
736
737 this._useProgram(program, flipY);
738
739 gl.activeTexture(gl.TEXTURE0);
740 gl.bindTexture(gl.TEXTURE_2D, inputTexture);
741
742 const typeMap = { gaussian: 0, radial: 1, motion: 2 };
743
744 // Scale radius proportionally to render resolution so export matches preview
745 const scaledRadius = params.radius * renderScale;
746
747 gl.uniform1i(program.uniforms.u_image, 0);
748 gl.uniform1f(program.uniforms.u_radius, scaledRadius);
749 gl.uniform1i(program.uniforms.u_type, typeMap[params.type] ?? 0);
750 gl.uniform1f(program.uniforms.u_angle, params.angle);
751 gl.uniform2f(program.uniforms.u_resolution, width, height);
752
753 gl.drawArrays(gl.TRIANGLES, 0, 6);
754 }
755
756 _renderDistortion(params, inputTexture, width, height, flipY = 1.0) {
757 const gl = this.gl;

Callers 1

_renderEffectMethod · 0.95

Calls 1

_useProgramMethod · 0.95

Tested by

no test coverage detected