Commit d1d4b185 authored by amandaghassaei's avatar amandaghassaei
Browse files

sim finished for now

parent 438e1bc8
......@@ -142,6 +142,7 @@
uniform vec2 u_textureDimNodeFaces;
uniform float u_creasePercent;
uniform float u_dt;
uniform float u_axialStiffness;
uniform sampler2D u_lastPosition;
uniform sampler2D u_lastVelocity;
uniform sampler2D u_originalPosition;
......@@ -304,8 +305,7 @@
vec3 normal = getFromArray(faceMeta[0], u_textureDimFaces, u_normals).xyz;
//calc forces
float triangleStiffness = 0.1;
anglesDiff *= triangleStiffness;
anglesDiff *= u_axialStiffness/100.0;
if (faceIndex == 0){//a
vec3 normalCrossAC = cross(normal, ac)/lengthAC;
vec3 normalCrossAB = cross(normal, ab)/lengthAB;
......
......@@ -179,10 +179,10 @@ function initControls(globals){
globals.materialHasChanged = true;
});
setSliderInput("#triStiffness", globals.triStiffness, 0, 10, 0.01, function(val){
globals.triStiffness = val;//todo update
// globals.materialHasChanged = true;
});
// setSliderInput("#triStiffness", globals.triStiffness, 0, 10, 0.01, function(val){
// globals.triStiffness = val;//todo update
// // globals.materialHasChanged = true;
// });
setSliderInput("#creaseStiffness", globals.creaseStiffness, 0, 3, 0.01, function(val){
globals.creaseStiffness = val;
......
......@@ -308,6 +308,7 @@ function initDynamicSolver(globals){
gpuMath.setUniformForProgram("velocityCalc", "u_textureDimNodeCreases", [textureDimNodeCreases, textureDimNodeCreases], "2f");
gpuMath.setUniformForProgram("velocityCalc", "u_textureDimNodeFaces", [textureDimNodeFaces, textureDimNodeFaces], "2f");
gpuMath.setUniformForProgram("velocityCalc", "u_creasePercent", globals.creasePercent, "1f");
gpuMath.setUniformForProgram("velocityCalc", "u_axialStiffness", globals.axialStiffness, "1f");
gpuMath.createProgram("thetaCalc", vertexShader, document.getElementById("thetaCalcShader").text);
gpuMath.setUniformForProgram("thetaCalc", "u_normals", 0, "1i");
......@@ -383,8 +384,13 @@ function initDynamicSolver(globals){
}
}
globals.gpuMath.initTextureFromData("u_beamMeta", textureDimEdges, textureDimEdges, "FLOAT", beamMeta, true);
//recalc dt
if (programsInited) setSolveParams();
if (programsInited) {
globals.gpuMath.setProgram("velocityCalc");
globals.gpuMath.setUniformForProgram("velocityCalc", "u_axialStiffness", globals.axialStiffness, "1f");
setSolveParams();//recalc dt
}
}
function updateExternalForces(){
......
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