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

Method _renderScanlines

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

Source from the content-addressed store, hash-verified

688 }
689
690 _renderScanlines(params, inputTexture, width, height, flipY = 1.0, renderScale = 1.0) {
691 const gl = this.gl;
692 const program = this.programs.scanlines;
693
694 this._useProgram(program, flipY);
695
696 gl.activeTexture(gl.TEXTURE0);
697 gl.bindTexture(gl.TEXTURE_2D, inputTexture);
698
699 // Scale spacing proportionally to render resolution so export matches preview
700 const scaledSpacing = params.spacing * renderScale;
701
702 gl.uniform1i(program.uniforms.u_image, 0);
703 gl.uniform1f(program.uniforms.u_spacing, scaledSpacing);
704 gl.uniform1f(program.uniforms.u_thickness, params.thickness);
705 gl.uniform1f(program.uniforms.u_opacity, params.opacity);
706 gl.uniform1i(program.uniforms.u_horizontal, params.horizontal ? 1 : 0);
707 gl.uniform1f(program.uniforms.u_offset, params.offset);
708 gl.uniform2f(program.uniforms.u_resolution, width, height);
709
710 gl.drawArrays(gl.TRIANGLES, 0, 6);
711 }
712
713 _renderPixelate(params, inputTexture, width, height, flipY = 1.0, renderScale = 1.0) {
714 const gl = this.gl;

Callers 1

_renderEffectMethod · 0.95

Calls 1

_useProgramMethod · 0.95

Tested by

no test coverage detected