Commit d6f190db authored by amandaghassaei's avatar amandaghassaei

small changes

parent f400b4a1
......@@ -93,8 +93,8 @@
float n = texture2D(u_pressure, repeatBoundary(fragCoord+vec2(0.0, 1.0))/u_textureSize).x;
float s = texture2D(u_pressure, repeatBoundary(fragCoord+vec2(0.0, -1.0))/u_textureSize).x;
float e = texture2D(u_pressure, repeatBoundary(fragCoord+vec2(1.0, 0.0))/u_textureSize).x;
float w = texture2D(u_pressure, repeatBoundary(fragCoord+vec2(-1.0, 0.0))/u_textureSize).x;
float e = texture2D(u_pressure, (fragCoord+vec2(1.0, 0.0))/u_textureSize).x;
float w = texture2D(u_pressure, (fragCoord+vec2(-1.0, 0.0))/u_textureSize).x;
gl_FragColor = vec4(currentVelocity-u_const*vec2(e-w, n-s), 0, 0);
}
......@@ -130,8 +130,8 @@
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, repeatBoundary(fragCoord+vec2(1.0, 0.0))/u_textureSize).x;
float w = texture2D(u_velocity, repeatBoundary(fragCoord+vec2(-1.0, 0.0))/u_textureSize).x;
float e = texture2D(u_velocity, (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);
gl_FragColor = vec4(div, 0, 0, 0);
......
......@@ -216,13 +216,12 @@ function resetWindow(){
var numCols = Math.floor(actualHeight/10);
if (numCols%2 == 1) numCols--;
var colHeight = actualHeight/numCols;
var material = new Float32Array(actualWidth*actualHeight*4);
for (var i=0;i<actualHeight;i++){
for (var j=0;j<actualWidth;j++){
var index = 4*(i*actualWidth+j);
if (j==0 && (Math.floor(i/colHeight))%2) material[index] = 1.0;
if (j==0 && Math.floor(i/actualHeight*numCols)%2==0) material[index] = 1.0;
}
}
GPU.initTextureFromData("material", actualWidth, actualHeight, "FLOAT", material, true);
......
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