From 3f0679e5718653c461b394a3daba09d193fd8442 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Tue, 23 Jun 2015 15:45:09 -0700 Subject: [PATCH] saving sparsity --- js/cells/DMACell.js | 13 ++++++------- js/cells/supercells/DMASuperCell.js | 6 ------ js/lattice/LatticeBase.js | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index d4d02cce..769988d7 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -75,7 +75,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' return "cell"; }; - DMACell.prototype._buildWireframe = function(mesh, geometry){//for "cell" view + DMACell.prototype._buildWireframe = function(mesh, geometry, isBeam){//for "cell" view + if (isBeam) new THREE.Mesh(geometry, wireframeMaterial.clone());//todo fix this return new THREE.Mesh(geometry, wireframeMaterial); }; @@ -252,6 +253,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' break; case "part": if (!this.parts) { + console.log(this); this._initParts(function(parts){ self.parts = parts; setVisiblity(); @@ -324,10 +326,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' }; DMACell.prototype._initBeams = function(callback){ - if (this.cells) { - _.each(this.cells) - } - var wireframe = this._buildWireframe(this.object3D.children[0], this._getGeometry()); + var wireframe = this._buildWireframe(this.object3D.children[0], this._getGeometry(), true); wireframe.name = "beam"; if (wireframe.material.wireframeLinewidth) wireframe.material.wireframeLinewidth = 5; else wireframe.material.linewidth = 5; @@ -408,8 +407,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' var data = { materialName: this.materialName }; - if (materials[this.materialName].cells) return data;//material definition in material composites - if (this.cells) data.cells = this.cells; +// if (materials[this.materialName].sparseCells) return data;//material definition in material composites +// if (this.cells) data.cells = this.cells; return data; }; diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index 024c21e9..a2fe3a82 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -143,11 +143,5 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], }); }; - DMASuperCell.prototype.toJSON = function(){ - var data = DMACell.prototype.toJSON.call(this); - if (this.cells) data.cells = this.cells; - return data; - }; - return DMASuperCell; }); \ No newline at end of file diff --git a/js/lattice/LatticeBase.js b/js/lattice/LatticeBase.js index 74c430f3..5c264f4e 100644 --- a/js/lattice/LatticeBase.js +++ b/js/lattice/LatticeBase.js @@ -489,7 +489,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre parseCellsJSON: function(sparseCells){ var cellsMin = this.get("cellsMin"); this._loopCells(sparseCells, function(cell, x, y, z, self){ - if (cell) self.addCellAtIndex((new THREE.Vector3(x, y, z)).add(cellsMin), true, true, cell.material); + if (cell) self.addCellAtIndex((new THREE.Vector3(x, y, z)).add(cellsMin), true, true, cell.materialName); }); }, -- GitLab