Commit 1e59cd24 authored by amandaghassaei's avatar amandaghassaei

fixed wierd boundary issue

parent 442b4dfd
......@@ -130,7 +130,7 @@
float n = texture2D(u_velocity, repeatBoundary(fragCoord+vec2(0.0, 1.0))/u_textureSize).y;
float s = texture2D(u_velocity, repeatBoundary(fragCoord+vec2(0.0, -1.0))/u_textureSize).y;
float e = texture2D(u_velocity, (fragCoord+vec2(1.0, 0.0))/u_textureSize).x;
float e = texture2D(u_velocity, repeatBoundary(fragCoord+vec2(1.0, 0.0))/u_textureSize).x;
float w = texture2D(u_velocity, (fragCoord+vec2(-1.0, 0.0))/u_textureSize).x;
float div = u_const*(e-w + n-s);
......@@ -292,8 +292,9 @@
}
if (pos.x >= u_textureSize.x-1.0) {
gl_FragColor = vec4(0, 0, 0, 0);
return;
//return;
}
if (pos.x >= u_textureSize.x-1.0) pos.x -= u_textureSize.x-1.0;
//periodic boundary in y
if (pos.y < 0.0) {
......
......@@ -192,7 +192,7 @@ function resetWindow(){
GPU.setUniformForProgram("render" ,"u_textureSize", [actualWidth, actualHeight], "2f");
GPU.setProgram("boundary");
GPU.setUniformForProgram("boundary" ,"u_textureSize", [width, height], "2f");
GPU.setUniformForProgram("boundary" ,"u_obstaclePosition", [obstaclePosition[0]*width/actualWidth, obstaclePosition[1]*height/actualHeight, "2f");
GPU.setUniformForProgram("boundary" ,"u_obstaclePosition", [obstaclePosition[0]*width/actualWidth, obstaclePosition[1]*height/actualHeight], "2f");
GPU.setUniformForProgram("boundary" ,"u_obstacleRad", obstacleRad*width/actualWidth, "1f");
var velocity = new Float32Array(width*height*4);
......
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