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

Method _renderMosaic

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

Source from the content-addressed store, hash-verified

1080 }
1081
1082 _renderMosaic(params, inputTexture, width, height, flipY = 1.0, renderScale = 1.0) {
1083 const gl = this.gl;
1084 const program = this.programs.mosaic;
1085
1086 this._useProgram(program, flipY);
1087
1088 gl.activeTexture(gl.TEXTURE0);
1089 gl.bindTexture(gl.TEXTURE_2D, inputTexture);
1090
1091 const edgeColor = this._hexToRgb(params.edgeColor);
1092
1093 // Scale cellSize and edgeThickness proportionally to render resolution so export matches preview
1094 const scaledCellSize = params.cellSize * renderScale;
1095 const scaledEdgeThickness = params.edgeThickness * renderScale;
1096
1097 gl.uniform1i(program.uniforms.u_image, 0);
1098 gl.uniform1f(program.uniforms.u_cellSize, scaledCellSize);
1099 gl.uniform1f(program.uniforms.u_irregularity, params.irregularity);
1100 gl.uniform1f(program.uniforms.u_edgeThickness, scaledEdgeThickness);
1101 gl.uniform3f(program.uniforms.u_edgeColor, edgeColor[0], edgeColor[1], edgeColor[2]);
1102 gl.uniform1f(program.uniforms.u_colorVariation, params.colorVariation);
1103 gl.uniform2f(program.uniforms.u_resolution, width, height);
1104
1105 gl.drawArrays(gl.TRIANGLES, 0, 6);
1106 }
1107
1108 _renderTiltShift(params, inputTexture, width, height, flipY = 1.0, renderScale = 1.0) {
1109 const gl = this.gl;

Callers 1

_renderEffectMethod · 0.95

Calls 2

_useProgramMethod · 0.95
_hexToRgbMethod · 0.95

Tested by

no test coverage detected