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

Method _renderPixelate

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

Source from the content-addressed store, hash-verified

711 }
712
713 _renderPixelate(params, inputTexture, width, height, flipY = 1.0, renderScale = 1.0) {
714 const gl = this.gl;
715 const program = this.programs.pixelate;
716
717 this._useProgram(program, flipY);
718
719 gl.activeTexture(gl.TEXTURE0);
720 gl.bindTexture(gl.TEXTURE_2D, inputTexture);
721
722 // Scale size proportionally to render resolution so export matches preview
723 const scaledSize = params.size * renderScale;
724
725 gl.uniform1i(program.uniforms.u_image, 0);
726 gl.uniform1f(program.uniforms.u_size, scaledSize);
727 gl.uniform1i(program.uniforms.u_maintainAspect, params.maintainAspect ? 1 : 0);
728 gl.uniform2f(program.uniforms.u_resolution, width, height);
729
730 gl.drawArrays(gl.TRIANGLES, 0, 6);
731 }
732
733 _renderBlur(params, inputTexture, width, height, flipY = 1.0, renderScale = 1.0) {
734 const gl = this.gl;

Callers 1

_renderEffectMethod · 0.95

Calls 1

_useProgramMethod · 0.95

Tested by

no test coverage detected