MCPcopy Index your code
hub / github.com/PavelDoGreat/WebGL-Fluid-Simulation / splat

Function splat

script.js:1441–1455  ·  view source on GitHub ↗
(x, y, dx, dy, color)

Source from the content-addressed store, hash-verified

1439}
1440
1441function splat (x, y, dx, dy, color) {
1442 splatProgram.bind();
1443 gl.uniform1i(splatProgram.uniforms.uTarget, velocity.read.attach(0));
1444 gl.uniform1f(splatProgram.uniforms.aspectRatio, canvas.width / canvas.height);
1445 gl.uniform2f(splatProgram.uniforms.point, x, y);
1446 gl.uniform3f(splatProgram.uniforms.color, dx, dy, 0.0);
1447 gl.uniform1f(splatProgram.uniforms.radius, correctRadius(config.SPLAT_RADIUS / 100.0));
1448 blit(velocity.write);
1449 velocity.swap();
1450
1451 gl.uniform1i(splatProgram.uniforms.uTarget, dye.read.attach(0));
1452 gl.uniform3f(splatProgram.uniforms.color, color.r, color.g, color.b);
1453 blit(dye.write);
1454 dye.swap();
1455}
1456
1457function correctRadius (radius) {
1458 let aspectRatio = canvas.width / canvas.height;

Callers 2

splatPointerFunction · 0.85
multipleSplatsFunction · 0.85

Calls 2

correctRadiusFunction · 0.85
bindMethod · 0.45

Tested by

no test coverage detected