From 2f020dc3192a25338ad8ccfe672d915e4db85449 Mon Sep 17 00:00:00 2001 From: amandaghassaei Date: Thu, 26 May 2016 14:24:08 -0400 Subject: [PATCH] set material working --- js/cells/DMACell.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/cells/DMACell.js b/js/cells/DMACell.js index 9437ab7..2a984da 100644 --- a/js/cells/DMACell.js +++ b/js/cells/DMACell.js @@ -43,6 +43,12 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' return this.object3D.children[0]; }; + DMACell.prototype.getVisibleMesh = function(){ + var children = this.object3D.children; + if (children[1].name == "part") return children[1]; + return children[0]; + }; + DMACell.prototype._rotateCell = function(object3D){ return object3D;//by default, no mesh transformations }; @@ -66,6 +72,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' var partGeo = this._getPartGeo(); if (partGeo){ var partMesh = new THREE.Mesh(partGeo, this.getMaterial(true)); + partMesh.name = "part"; meshes.push(partMesh); wireframeMesh = partMesh; mesh.visible = false; @@ -196,7 +203,7 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'globals', ' }; DMACell.prototype._setTHREEMaterial = function(threeMaterial){ - this.getHighlightableMesh().material = threeMaterial; + this.getVisibleMesh().material = threeMaterial; }; DMACell.prototype.getMaterial = function(returnTHREEObject){ -- GitLab