From 990f8fea19342095ba9f39466e40113a52491edb Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Wed, 17 Jun 2015 12:03:08 -0700 Subject: [PATCH] messing around with material setup --- js/cells/supercells/DMASuperCell.js | 1 + js/cells/supercells/GIKSuperCell.js | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index d5ec79d5..f9a7a2c8 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 2c2d517f..f80081c4 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){ -- GitLab