Commit 77295f7e authored by amandaghassaei's avatar amandaghassaei

boundaries

parent fc4a6dff
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment