diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index d5ec79d50cc6806f9c3cca3abdd72e7c24d8d7bf..f9a7a2c8af65991c09a9f52a2bcee73b25dae9e4 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -40,6 +40,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], if (material.sparseCells[x][y][z]){ if (material.sparseCells[x][y][z].material) { cellMaterial = material.sparseCells[x][y][z].material; + console.log(cellMaterial); this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), material:cellMaterial}, function(cell){ var index = cell.getIndex(); cells[index.x][index.y][index.z] = cell; diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js index 2c2d517f0abaeee3ed31762657f0d9c6813fccc4..f80081c45c16e30397753571804049b848597dde 100644 --- a/js/cells/supercells/GIKSuperCell.js +++ b/js/cells/supercells/GIKSuperCell.js @@ -43,16 +43,19 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell', if (returnTHREEObject){ return DMASuperCell.prototype.getMaterial.call(this, returnTHREEObject); } - return { -// name: name, - material: this.material, -// color: this.get("color"), -// altColor: this.get("color"), -// numCells: this.get("numCells"), - cellsMin: new THREE.Vector3(0,0,0), - cellsMax: new THREE.Vector3(this.getLength(), 0, 0), - dimensions: new THREE.Vector3(this.getLength()+1, 1, 1) - }; + if (!materials[this.material]) materials[this.material] = {}; + var length = this.getLength(); + if (!materials[this.material]["length" + (length+1)]) { + materials[this.material]["length" + (length+1)] = + { + material: this.material, + cellsMin: new THREE.Vector3(0,0,0), + cellsMax: new THREE.Vector3(length, 0, 0), + dimensions: new THREE.Vector3(length+1, 1, 1) + }; + } + console.log(materials[this.material]); + return materials[this.material]["length" + (length+1)]; }; GIKSuperCell.prototype._buildWireframe = function(mesh){