Commit 96528274 authored by amandaghassaei's avatar amandaghassaei
Browse files

small changes

parent 1cc36b55
......@@ -124,7 +124,7 @@ function initControls(globals){
setRadio("simType", globals.simType, function(val){
globals.simType = val;
globals.needsSync = true;
globals.simNeedsSync = true;
});
setSliderInput("#axialStiffness", globals.axialStiffness, 10, 40, 1, function(val){
......
......@@ -34,6 +34,7 @@ function initGlobals(){
shouldZeroDynamicVelocity: false,
shouldCenterGeo: false,
needsSync: false,
simNeedsSync: false,
//3d vis
simType: "dynamic",
......
......@@ -184,6 +184,7 @@ function initModel(globals){
nextFaces = _faces;
globals.needsSync = true;
globals.simNeedsSync = true;
if (!inited) {
startSolver();//start animation loop
......@@ -292,11 +293,17 @@ function initModel(globals){
updateEdgeVisibility();
updateMeshVisibility();
getSolver().syncNodesAndEdges();
syncSolver();
globals.needsSync = false;
if (!globals.simulationRunning) reset();
}
function syncSolver(){
getSolver().syncNodesAndEdges();
globals.simNeedsSync = false;
}
function getNodes(){
return nodes;
}
......@@ -336,6 +343,7 @@ function initModel(globals){
buildModel: buildModel,//load new model
sync: sync,//update geometry to new model
syncSolver: syncSolver,//update solver params
//rendering
setMeshMaterial: setMeshMaterial,
......
......@@ -163,8 +163,8 @@ function initRigidSolver(){
}
for (var j=0;j<numFreeCreases;j++){
var crease = creases[freeCreasesMapping[j]];
for (var j=0;j<creases.length;j++){
var crease = creases[j];
var normal1 = normals[crease.face1Index];
var normal2 = normals[crease.face2Index];
var dotNormals = normal1.dot(normal2);
......
......@@ -106,7 +106,9 @@ function initThreeView(globals) {
function _loop(callback){
if (globals.needsSync){
globals.model.sync();
globals.needsSync = false;
}
if (globals.simNeedsSync){
globals.model.syncSolver();
}
if (globals.simulationRunning) callback();
if (globals.vrEnabled){
......
Supports Markdown
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