diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index 1f94204c7462173039efac285f321cbb53cf2848..bcb3706f8665b1be828e115a53f369d411a38da1 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -241,7 +241,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'], DMACell.prototype.setMode = function(mode, callback){ - if (mode === undefined) mode = appState.get("cellMode"); + if (!mode || mode === undefined) mode = appState.get("cellMode"); var self = this; switch(mode) { @@ -284,7 +284,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals'], callback(); return; } - three.conditionalRender(); + if (!self.superCell) three.conditionalRender(); } }; diff --git a/js/cells/supercells/DMASuperCell.js b/js/cells/supercells/DMASuperCell.js index 803abd7139d598379856a3f8825ebc54bbf4e593..84984e079e6f89016c4cfcc9f013c43ddeb89778 100644 --- a/js/cells/supercells/DMASuperCell.js +++ b/js/cells/supercells/DMASuperCell.js @@ -16,8 +16,10 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], var material = this.getMaterial(); var range = material.dimensions || appState.get("superCellRange"); this.cells = this._makeChildCells(range, this.getMaterial()); - - if (!superCell || superCell === undefined) this.setMode();//don't pass a call down to children again + + if (!superCell || superCell === undefined) this.setMode(null, function(){ + three.conditionalRender(); + });//don't pass a call down to children again } DMASuperCell.prototype = Object.create(DMACell.prototype); @@ -39,7 +41,6 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], cellMaterial = material.sparseCells[x][y][z].material; this._makeSubCellForIndex({index: new THREE.Vector3(x,y,z), material:cellMaterial}, function(cell){ var index = cell.getIndex(); - console.log(index); cells[index.x][index.y][index.z] = cell; }); } else console.warn("no material for composite cell definition subcell"); @@ -58,6 +59,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cell'], DMASuperCell.prototype._makeSubCellForIndex = function(json, callback){ var subclassFile = lattice.getCellSubclassFile(); if (json.material && json.material.substr(0,5) == "super") subclassFile = "compositeCell"; + console.log(subclassFile); var self = this; require([subclassFile], function(CellSubclass){ var cell = new CellSubclass(json, self); diff --git a/js/highlighter/Highlighter.js b/js/highlighter/Highlighter.js index 2a517004cadf0dc518ffc81affd7ad1ee7ac35eb..e812c51d3907b41a74686bf5851d6a732a7e1cfc 100644 --- a/js/highlighter/Highlighter.js +++ b/js/highlighter/Highlighter.js @@ -21,6 +21,7 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' opacity:0.4, color:0xffffff })); + if (this._makeWireframe) this._makeWireframe(); three.sceneAdd(this.mesh); this._setScale(); diff --git a/js/highlighter/SuperCellHighlighter.js b/js/highlighter/SuperCellHighlighter.js index c66d2fab1f006f65aa8514608459a55e8be5c863..85eaa35938c233a3be96a743164acba7c3d27382 100644 --- a/js/highlighter/SuperCellHighlighter.js +++ b/js/highlighter/SuperCellHighlighter.js @@ -18,6 +18,14 @@ define(['underscore', 'backbone', 'threeModel', 'appState', 'lattice', 'cell', ' return new THREE.BoxGeometry(lattice.xScale(),lattice.yScale(),lattice.zScale()); }, + _makeWireframe: function(mesh){ +// var wireframe = new THREE.BoxHelper(mesh); +// wireframe.material.color.set(0x000000); +// wireframe.matrixWorld = mesh.matrixWorld; +// wireframe.matrixAutoUpdate = true; +// mesh.add(wireframe); + }, + _setScale: function(){ this.mesh.scale.set(appState.get("superCellRange").x, appState.get("superCellRange").y, appState.get("superCellRange").z);