Skip to content
Snippets Groups Projects
Commit 1976219e authored by Amanda Ghassaei's avatar Amanda Ghassaei
Browse files

z index flag in parts

parent bcb7c5f9
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@
this.cellMesh = this._buildCellMesh(this.position);
window.three.sceneAdd(this.cellMesh);
this.parts = this._initParts(this.position);
this.parts = this._initParts(this.position, indices.z);
this.drawForMode(mode);
}
......@@ -59,10 +59,10 @@
return position;
};
DMACell.prototype._initParts = function(position){
DMACell.prototype._initParts = function(position, zIndex){
var parts = [];
for (var i=0;i<3;i++){
parts.push(new DMAPart(i, position));
parts.push(new DMAPart(i, position, zIndex%2==1));
}
return parts;
};
......
......@@ -24,13 +24,10 @@
partGeometry.applyMatrix(new THREE.Matrix4().makeScale(30,30,30));
}
function DMAPart(type, position) {
function DMAPart(type, position, oddZFlag) {
this.position = position;
this.oddZFlag = oddZFlag;//this tells me if cell is at an odd z height in lattice, everything needs to rotate 180
this.type = type;
// this.nodes = nodes;
// this.beams = this._createBeams(nodes, config);
// this.geometry = geometry;
}
DMAPart.prototype._draw = function(){
......@@ -45,8 +42,7 @@
mesh.position.y = -30/3*Math.sqrt(3)+this.position.y;
mesh.position.z = this.position.z;
//todo this sucks, go back and fix the real problem
if (Math.round(mesh.position.z/(2*30/Math.sqrt(6)))%2 == 1){
if (this.oddZFlag){//adjust some offsets for odd z layers
mesh.position.y += 30 + 30/6;
mesh.rotateZ(Math.PI);
}
......@@ -62,14 +58,6 @@
return mesh;
};
DMAPart.prototype._createBeams = function(nodes, config){
// var beams = [];
// _.each(config, function(pair){
// beams.push(new Beam(nodes[pair[0]], nodes[pair[2]]));
// });
// return beams;
};
DMAPart.prototype.show = function(){
if (!this.mesh) this._draw();
this.mesh.visible = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment