Commit 66d1ea46 authored by amandaghassaei's avatar amandaghassaei
Browse files

dynamic model working again

parent f274b46b
......@@ -180,7 +180,7 @@
if (creaseMeta2[3] < 0.0){//crease reaction
float nodeNum = creaseMeta2[2];
//node #1
//node #1
float normalIndex1D = thetas[2];
vec2 normalsIndex = vec2(mod(normalIndex1D, u_textureDimFaces.x)+0.5, floor(normalIndex1D/u_textureDimFaces.x)+0.5);
vec2 scaledNormalsIndex = normalsIndex/u_textureDimFaces;
......
......@@ -370,9 +370,9 @@ function initDynamicModel(globals){
for (var i=0;i<creases.length;i++){
var rgbaIndex = i*4;
var vector = creases[i].getVector();
creaseVectors[rgbaIndex] = vector.x;
creaseVectors[rgbaIndex+1] = vector.y;
creaseVectors[rgbaIndex+2] = vector.z;
creaseVectors[rgbaIndex] = -vector.x;
creaseVectors[rgbaIndex+1] = -vector.y;
creaseVectors[rgbaIndex+2] = -vector.z;
}
globals.gpuMath.initTextureFromData("u_creaseVectors", textureDimCreases, textureDimCreases, "FLOAT", creaseVectors, true);
}
......
......@@ -25,7 +25,7 @@ function initGlobals(){
//sim settings
creasePercent: 0,
axialStiffness: 100,
creaseStiffness: 10,
creaseStiffness: 30,
panelStiffness: 1,
//dynamic sim settings
......
......@@ -120,7 +120,7 @@ $(function() {
globals = initGlobals();
globals.model = initModel(globals);
globals.staticSolver = initStaticSolver(globals);
globals.dynamicSolver = initDynamicModel(globals);
globals.dynamicModel = initDynamicModel(globals);
// globals.staticSolver.syncNodesAndEdges();
globals.pattern = initPattern(globals);
globals.threeView.render();
......
......@@ -12,10 +12,10 @@ function initModel(globals){
nodes.push(new Node(new THREE.Vector3(0,0,10), nodes.length));
nodes.push(new Node(new THREE.Vector3(10,0,0), nodes.length));
nodes.push(new Node(new THREE.Vector3(0,0,-10), nodes.length));
// nodes.push(new Node(new THREE.Vector3(10,0,-10), nodes.length));
nodes[0].setFixed(true);
nodes[1].setFixed(true);
nodes[2].setFixed(true);
nodes.push(new Node(new THREE.Vector3(10,0,-10), nodes.length));
// nodes[0].setFixed(true);
// nodes[1].setFixed(true);
// nodes[2].setFixed(true);
var edges = [];
edges.push(new Beam([nodes[0], nodes[1]]));
......@@ -23,17 +23,17 @@ function initModel(globals){
edges.push(new Beam([nodes[2], nodes[0]]));
edges.push(new Beam([nodes[3], nodes[0]]));
edges.push(new Beam([nodes[3], nodes[2]]));
// edges.push(new Beam([nodes[3], nodes[4]]));
// edges.push(new Beam([nodes[2], nodes[4]]));
edges.push(new Beam([nodes[3], nodes[4]]));
edges.push(new Beam([nodes[2], nodes[4]]));
var faces = [];
faces.push(new THREE.Face3(0,1,2));
faces.push(new THREE.Face3(0,2,3));
// faces.push(new THREE.Face3(4,3,2));
faces.push(new THREE.Face3(4,3,2));
var creases = [];
creases.push(new Crease(edges[2], 0, 1, Math.PI-0.001, 1, nodes[1], nodes[3], 0));
// creases.push(new Crease(edges[4], 2, 1, -(Math.PI-0.001), 1, nodes[4], nodes[0], 1));
creases.push(new Crease(edges[4], 2, 1, -(Math.PI-0.001), 1, nodes[4], nodes[0], 1));
var _allNodeObject3Ds = [];
_.each(nodes, function(node){
......
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