Commit 821eb848 authored by amandaghassaei's avatar amandaghassaei

small fix

parent ca972d08
...@@ -412,13 +412,14 @@ ...@@ -412,13 +412,14 @@
vec2 fragCoord = gl_FragCoord.xy; vec2 fragCoord = gl_FragCoord.xy;
vec2 scaledFragCoord = fragCoord/u_textureDim; vec2 scaledFragCoord = fragCoord/u_textureDim;
vec3 lastPosition = texture2D(u_lastPosition, scaledFragCoord).xyz;
vec2 mass = texture2D(u_mass, scaledFragCoord).xy; vec2 mass = texture2D(u_mass, scaledFragCoord).xy;
if (mass[1] == 1.0){//fixed if (mass[1] == 1.0){//fixed
gl_FragColor = vec4(0.0); gl_FragColor = vec4(lastPosition, 0.0);
return; return;
} }
vec3 force = texture2D(u_externalForces, scaledFragCoord).xyz; vec3 force = texture2D(u_externalForces, scaledFragCoord).xyz;
vec3 lastPosition = texture2D(u_lastPosition, scaledFragCoord).xyz;
vec3 lastLastPosition = texture2D(u_lastLastPosition, scaledFragCoord).xyz; vec3 lastLastPosition = texture2D(u_lastLastPosition, scaledFragCoord).xyz;
vec3 lastVelocity = texture2D(u_lastVelocity, scaledFragCoord).xyz; vec3 lastVelocity = texture2D(u_lastVelocity, scaledFragCoord).xyz;
vec3 originalPosition = texture2D(u_originalPosition, scaledFragCoord).xyz; vec3 originalPosition = texture2D(u_originalPosition, scaledFragCoord).xyz;
......
...@@ -514,7 +514,7 @@ function initDynamicSolver(globals){ ...@@ -514,7 +514,7 @@ function initDynamicSolver(globals){
} }
globals.gpuMath.initTextureFromData("u_lastPosition", textureDim, textureDim, "FLOAT", lastPosition, true); globals.gpuMath.initTextureFromData("u_lastPosition", textureDim, textureDim, "FLOAT", lastPosition, true);
globals.gpuMath.initFrameBufferForTexture("u_lastPosition", true); globals.gpuMath.initFrameBufferForTexture("u_lastPosition", true);
if (globals.integrationType == "verlet") globals.gpuMath.step("copyTexture", ["u_lastPosition"], "u_lastLastPosition");
} }
function setCreasePercent(percent){ function setCreasePercent(percent){
......
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