Skip to content
Snippets Groups Projects
Commit b5342688 authored by amandaghassaei's avatar amandaghassaei
Browse files

advection2d

parent 77295f7e
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
} }
vec2 pxCenter = vec2(0.5, 0.5); vec2 pxCenter = vec2(0.5, 0.5);
vec2 pos = fragCoord - pxCenter + u_dt*currentVelocity; 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){ if (pos.x < 0.0 || pos.x >= u_textureSize.x-1.0 || pos.y < 0.0 || pos.y >= u_textureSize.y-1.0){
//boundary //boundary
gl_FragColor = vec4(0); gl_FragColor = vec4(0);
......
...@@ -97,6 +97,7 @@ function resetWindow(){ ...@@ -97,6 +97,7 @@ function resetWindow(){
for (var j=0;j<width;j++){ for (var j=0;j<width;j++){
var index = 4*(i*width+j); var index = 4*(i*width+j);
velocity[index] = i/100; velocity[index] = i/100;
velocity[index+1] = j/100;
} }
} }
GPU.initTextureFromData("velocity", width, height, "FLOAT", velocity, true); GPU.initTextureFromData("velocity", width, height, "FLOAT", velocity, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment