diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index 96ce95e91e7904a92cac03e404893f5520a30365..c2d6351310b5f15f2220321689eff2b483fc6e5c 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -217,7 +217,6 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'], console.warn("no material "+ this.material + " found for class "+ materialClass); return null; } - console.log(material.shading); return material; }; diff --git a/js/cells/OctaEdgeCell.js b/js/cells/OctaEdgeCell.js index a81b11b76c5eb0efc7e2f508683aeb6877c4851c..689efe73106cceefaecaaa343cb51e7ba01d3678 100644 --- a/js/cells/OctaEdgeCell.js +++ b/js/cells/OctaEdgeCell.js @@ -11,6 +11,10 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'octaFaceCel } OctaEdgeCell.prototype = Object.create(OctaFaceCell.prototype); + OctaFaceCell.prototype._rotateCell = function(object3D){ + return object3D; + }; + OctaEdgeCell.prototype.calcHighlighterParams = function(face, point){ var direction = face.normal.clone().applyQuaternion(this.getAbsoluteOrientation()); var position = this.getAbsolutePosition(); diff --git a/js/lattice/CubeLattice.js b/js/lattice/CubeLattice.js index 1fae3a4a6ec437f316cc1eb6e50eddf7dd31f305..2853e6c4e0f1c89f4fa3561b1451f37690044ba8 100644 --- a/js/lattice/CubeLattice.js +++ b/js/lattice/CubeLattice.js @@ -42,7 +42,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['cubeCell'], function(CubeCell){ var cell = new CubeCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/GIKLattice.js b/js/lattice/GIKLattice.js index be5d8ff0a72e5a8553bc126c1c8f3866b743df4d..066c037574222148633fd6af41061448c48c7a39 100644 --- a/js/lattice/GIKLattice.js +++ b/js/lattice/GIKLattice.js @@ -43,7 +43,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['gikSuperCell'], function(GIKSuperCell){ var cell = new GIKSuperCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/KelvinLattice.js b/js/lattice/KelvinLattice.js index c67998c258c9150b35717b809bffba3ddfa95837..f84156ff5fd5dcb6fc1c428ec58f3ee6794412d1 100644 --- a/js/lattice/KelvinLattice.js +++ b/js/lattice/KelvinLattice.js @@ -43,7 +43,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['kelvinCell'], function(KelvinCell){ var cell = new KelvinCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index b5cfd0f83aa67f88936030ede6752a877326d110..5728d63ffc69394133f922aa62200fe002822c0f 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -22,8 +22,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre //spacing for connectors/joints cellSeparation: {xy:0, z:0}, - cellType: "tetra", - connectionType: "stacked", + cellType: "cube", + connectionType: "face", partType: null, materialType: null, materialClass: "mechanical", @@ -68,7 +68,8 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre for (var z=relativeMin.z;z<=relativeMax.z;z++){ if (!this.sparseCells[x][y][z]) { var self = this; - this.sparseCells[x][y][z] = this.makeCellForLatticeType((new THREE.Vector3(x, y, z)).add(cellsMin), function(){ + this.makeCellForLatticeType((new THREE.Vector3(x, y, z)).add(cellsMin), function(cell){ + self.sparseCells[x][y][z] = cell; self.set("numCells", self.get("numCells")+1); }); } else console.warn("already a cell there"); @@ -79,17 +80,21 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }, addCellAtIndex: function(indices, noRender, noCheck){//no render no check from fill + console.log(indices); + console.log(this.get("cellsMin")); + console.log(this.get("cellsMax")); if (!noCheck || noCheck === undefined) this.checkForMatrixExpansion(this.sparseCells, indices, indices); + console.log(this.sparseCells); var index = (new THREE.Vector3()).subVectors(indices, this.get("cellsMin") || indices); if (!this.sparseCells[index.x][index.y][index.z]) { var self = this; - var callback = function(){ + this.makeCellForLatticeType(indices, function(cell){ + self.sparseCells[index.x][index.y][index.z] = cell; self.set("numCells", self.get("numCells")+1); if (!noRender || noRender === undefined) three.render(); - }; - this.sparseCells[index.x][index.y][index.z] = this.makeCellForLatticeType(indices, callback); + }); } else console.warn("already a cell there"); }, @@ -131,7 +136,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre }, clearCells: function(){ - this._iterCells(this.sparseCells, function(cell){//send destroy to top level + this._loopCells(this.sparseCells, function(cell){//send destroy to top level if (cell) cell.destroy(); }); three.removeAllCells();//todo add flag in cell destroy to avoid redundancy here @@ -224,8 +229,15 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre return; } - var lastMax = this.get("cellsMax") || indicesMax; - var lastMin = this.get("cellsMin") || indicesMin; + if (!this.get("cellsMax") || !this.get("cellsMin")){ + this.set("cellsMax", indicesMax); + this.set("cellsMin", indicesMin); + this._expandCellsArray(cells, (new THREE.Vector3()).subVectors(indicesMax, indicesMin), false); + return; + } + + var lastMax = this.get("cellsMax"); + var lastMin = this.get("cellsMin"); var newMax = this._updateCellsMax(indicesMax, lastMax); var newMin = this._updateCellsMin(indicesMin, lastMin); if (newMax) { @@ -417,7 +429,9 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre if (!cell) return; var index = _.clone(cell.index); if (cell.destroy) cell.destroy(); - cells[x][y][z] = self.makeCellForLatticeType(index);// parentPos, parentOrientation, direction, parentType, type) + self.makeCellForLatticeType(index, function(newCell){ + cells[x][y][z] = newCell; + }); }); three.render(); }); diff --git a/js/lattice/OctaEdgeLattice.js b/js/lattice/OctaEdgeLattice.js index 1a6f3d33851718761510049435b4eb29393fca84..517ff6aa4dfbc0c32bd53195d20e640b50d6b51a 100644 --- a/js/lattice/OctaEdgeLattice.js +++ b/js/lattice/OctaEdgeLattice.js @@ -65,7 +65,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['octaEdgeCell'], function(OctaEdgeCell){ var cell = new OctaEdgeCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/OctaFaceLattice.js b/js/lattice/OctaFaceLattice.js index 0927d3e6b6246a364edadcdd048fabf27c30cd5d..2aa1d1feebb351d1de39ec0491d55e83bee2e199 100644 --- a/js/lattice/OctaFaceLattice.js +++ b/js/lattice/OctaFaceLattice.js @@ -51,7 +51,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['octaFaceCell'], function(OctaFaceCell){ var cell = new OctaFaceCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/OctaRotEdgeLattice.js b/js/lattice/OctaRotEdgeLattice.js index 88ab171e520e72384830925087d448028496169c..8fc717cb46e1b7d0a16535648b2b68681e82c70c 100644 --- a/js/lattice/OctaRotEdgeLattice.js +++ b/js/lattice/OctaRotEdgeLattice.js @@ -53,7 +53,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['octaRotEdgeCell'], function(OctaRotEdgeCell){ var cell = new OctaRotEdgeCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/OctaVertexLattice.js b/js/lattice/OctaVertexLattice.js index 76764cb9a78ebcf531c8746a9047042c65e344e1..508c40e2e7ff345738554fce7d494ddd23551686 100644 --- a/js/lattice/OctaVertexLattice.js +++ b/js/lattice/OctaVertexLattice.js @@ -49,7 +49,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['octaVertexCell'], function(OctaVertexCell){ var cell = new OctaVertexCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/TetraStackedLattice.js b/js/lattice/TetraStackedLattice.js index 1bc435a0cbe9093bcd3ab8a6f415061b1ab23c6a..4bea1a019f0472c87148ebaf3faf78d544ff6cb0 100644 --- a/js/lattice/TetraStackedLattice.js +++ b/js/lattice/TetraStackedLattice.js @@ -51,7 +51,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['tetraStackedCell'], function(TetraStackedCell){ var cell = new TetraStackedCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/TetraVertexLattice.js b/js/lattice/TetraVertexLattice.js index e04a7a830a58659270dd200b0e9c2021395632ef..09537f95e54fb6db43871e22b8d08a22230ab95c 100644 --- a/js/lattice/TetraVertexLattice.js +++ b/js/lattice/TetraVertexLattice.js @@ -51,7 +51,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['tetraVertexCell'], function(TetraVertexCell){ var cell = new TetraVertexCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/lattice/TruncatedCubeLattice.js b/js/lattice/TruncatedCubeLattice.js index 7ba455af2a8cc0fd96e33b1ebc07745f065be7f3..2c8eaf4dae8867dd06774ea1071e39f8496d62eb 100644 --- a/js/lattice/TruncatedCubeLattice.js +++ b/js/lattice/TruncatedCubeLattice.js @@ -43,7 +43,6 @@ define(['underscore', 'backbone', 'appState', 'lattice', 'globals', 'plist', 'th require(['truncatedCubeCell'], function(TruncatedCubeCell){ var cell = new TruncatedCubeCell(indices); if (callback) callback(cell); - return cell; }); }, diff --git a/js/models/PList.js b/js/models/PList.js index 7a25f4d6ff91bfeb7537b221e3f4ae185aeac80d..3323f103f5d40997ec2a6dacafbd2ab771e5f6b1 100644 --- a/js/models/PList.js +++ b/js/models/PList.js @@ -36,7 +36,7 @@ define(['three'], function(THREE){ }, allConnectionTypes: { octa: {face:"Face", edge:"Edge", edgeRot:"Edge (Rotated)", vertex:"Vertex"},// freeformFace:"Freeform Face" - tetra: {stacked: "Stacked", vertex: "Vertex"}, + tetra: {stacked: "Stacked"},//vertex: "Vertex" cube: {face:"Face", gik: "GIK"}, truncatedCube: {face:"Face"}, kelvin: {face: "Face"}