From efd03f38cac6c265384d2f3ccabed1e1ca706ab3 Mon Sep 17 00:00:00 2001
From: Amanda Ghassaei <amandaghassaei@gmail.com>
Date: Wed, 17 Jun 2015 09:35:25 -0700
Subject: [PATCH] gik supercell

---
 js/cells/DMACell.js                 |  3 ++-
 js/cells/supercells/DMASuperCell.js |  2 +-
 js/cells/supercells/GIKSuperCell.js | 17 +++++++++++++++++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js
index 59d365a3..923e05a0 100644
--- a/js/cells/DMACell.js
+++ b/js/cells/DMACell.js
@@ -273,7 +273,8 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'],
         }
 
         function setVisiblity(){
-            var visible = !(self.superCell && self.cells);//middle layers are always hidden
+            var visible = true;
+            if (mode == "supercell") visible = !(self.superCell && self.cells);//middle layers are always hidden in supercell mode
 
             _.each(self.object3D.children, function(child){
                 if (child.name == "object3D") return;
diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js
index c75708fa..d5ec79d5 100644
--- a/js/cells/supercells/DMASuperCell.js
+++ b/js/cells/supercells/DMASuperCell.js
@@ -47,7 +47,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'],
                             } else console.warn("no material for composite cell definition subcell");
                         }//else no cell in this spot
                     } else {//if not from composite definition, add subcell at all possible indices in supercell range
-                        this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), material:cellMaterial}, function(cell){
+                        this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), material:this.material}, function(cell){
                             cells[x][y][z] = cell;
                         });
                     }
diff --git a/js/cells/supercells/GIKSuperCell.js b/js/cells/supercells/GIKSuperCell.js
index 1f4cad71..2c2d517f 100644
--- a/js/cells/supercells/GIKSuperCell.js
+++ b/js/cells/supercells/GIKSuperCell.js
@@ -8,6 +8,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell',
     function(_, THREE, three, lattice, appState, DMASuperCell, GIKCell){
 
     var unitGeos = {};
+    var materials = {};
 
     function makePartWithLength(length){
         var geo = new THREE.BoxGeometry(lattice.xScale(0),lattice.yScale(0),lattice.zScale(0));
@@ -38,6 +39,22 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'superCell',
         return unitGeos[key];
     };
 
+    GIKSuperCell.prototype.getMaterial = function(returnTHREEObject){
+        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)
+        };
+    };
+
     GIKSuperCell.prototype._buildWireframe = function(mesh){
         var wireframe = new THREE.BoxHelper(mesh);
         wireframe.material.color.set(0x000000);
-- 
GitLab