(x, y, dx, dy, color)
| 1439 | } |
| 1440 | |
| 1441 | function 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 | |
| 1457 | function correctRadius (radius) { |
| 1458 | let aspectRatio = canvas.width / canvas.height; |
no test coverage detected