From 77295f7e90a9f242112ebd3725de660c988e20b7 Mon Sep 17 00:00:00 2001 From: amandaghassaei <amandaghassaei@gmail.com> Date: Sun, 2 Apr 2017 18:37:54 -0400 Subject: [PATCH] boundaries --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index f4d29e2..78692ee 100644 --- a/index.html +++ b/index.html @@ -46,15 +46,15 @@ vec2 currentVelocity = texture2D(u_velocity, fragCoord/u_textureSize).xy; //implicitly solve advection - + if (length(currentVelocity) == 0.0) {//no velocity gl_FragColor = vec4(texture2D(u_material, fragCoord/u_textureSize).x, 0, 0, 0); return; } vec2 pxCenter = vec2(0.5, 0.5); - vec2 pos = fragCoord - pxCenter - u_dt*currentVelocity; - if (pos.x < 0.0 || pos.x >= u_textureSize.x || pos.y < 0.0 || pos.y >= u_textureSize.y){ + vec2 pos = fragCoord - pxCenter + u_dt*currentVelocity; + if (pos.x < 0.0 || pos.x >= u_textureSize.x-1.0 || pos.y < 0.0 || pos.y >= u_textureSize.y-1.0){ //boundary gl_FragColor = vec4(0); return; -- GitLab