(x, y, dx, dy, color)
| 819 | } |
| 820 | |
| 821 | function splat(x, y, dx, dy, color) { |
| 822 | splatProgram.bind(); |
| 823 | gl.uniform1i(splatProgram.uniforms.uTarget, velocity.read.attach(0)); |
| 824 | gl.uniform1f(splatProgram.uniforms.aspectRatio, canvas.width / canvas.height); |
| 825 | gl.uniform2f(splatProgram.uniforms.point, x, y); |
| 826 | gl.uniform3f(splatProgram.uniforms.color, dx, dy, 0.0); |
| 827 | gl.uniform1f(splatProgram.uniforms.radius, correctRadius(config.SPLAT_RADIUS / 100.0)); |
| 828 | blit(velocity.write); |
| 829 | velocity.swap(); |
| 830 | |
| 831 | gl.uniform1i(splatProgram.uniforms.uTarget, dye.read.attach(0)); |
| 832 | gl.uniform3f(splatProgram.uniforms.color, color.r, color.g, color.b); |
| 833 | blit(dye.write); |
| 834 | dye.swap(); |
| 835 | } |
| 836 | |
| 837 | function correctRadius(radius) { |
| 838 | let aspectRatio = canvas.width / canvas.height; |
no test coverage detected