From 08439b510a3ef300216955d905eb41dc7f52260f Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Fri, 22 May 2015 10:58:51 -0700 Subject: [PATCH] eod --- js/fea/DmaCellOther.js | 8 ++------ js/fea/DmaPart.js | 17 +++++++++++++++++ js/models/ThreeModel.js | 2 +- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/js/fea/DmaCellOther.js b/js/fea/DmaCellOther.js index d543b09a..4cddf23d 100644 --- a/js/fea/DmaCellOther.js +++ b/js/fea/DmaCellOther.js @@ -96,7 +96,8 @@ var cellMaterial = [new THREE.MeshNormalMaterial()]; return this.superCell.getMaterialType(); }; - DMAGIKCell.prototype.__initParts = function(){ + DMAGIKCell.prototype._initParts = function(){ + if (!this.superCell) return []; var parts = []; var isEnd = this.superCellIndex == 0 || this.superCellIndex == this.superCell.getLength(); if (dmaGlobals.lattice.get("partType") == "lego") { @@ -110,11 +111,6 @@ var cellMaterial = [new THREE.MeshNormalMaterial()]; return parts; }; - DMAGIKCell.prototype._initParts = function(){ - if (this.superCell) return this.__initParts(); - return []; - }; - self.DMAGIKCell = DMAGIKCell; })(); diff --git a/js/fea/DmaPart.js b/js/fea/DmaPart.js index 6c9baafb..914ebb6e 100644 --- a/js/fea/DmaPart.js +++ b/js/fea/DmaPart.js @@ -229,6 +229,7 @@ var partMaterial = new THREE.MeshLambertMaterial({ color:0xffffff, shading: THRE var unitScale = 1/(1.2699999809265137); unitPartGeo.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI/2)); unitPartGeo.applyMatrix(new THREE.Matrix4().makeScale(unitScale, unitScale, unitScale)); + console.log(unitPartGeo); }); function DMAGIKPart(type, parent){ @@ -236,9 +237,25 @@ var partMaterial = new THREE.MeshLambertMaterial({ color:0xffffff, shading: THRE } DMAGIKPart.prototype = Object.create(DMAPart.prototype); + DMAGIKPart.prototype._makeGikWireframe = function(positions, yPosition){ + var geometry = new THREE.Geometry(); + _.each(positions, function(position, index){ + if (position == yPosition){ + geometry.vertices.push(new THREE.Vector3(positions[index-1], yPosition, positions[index+1])); + } + }); + console.log(geometry.vertices); + return new THREE.Line(geometry); + }; + DMAGIKPart.prototype._makeMeshForType = function(){ var mesh = new THREE.Mesh(unitPartGeo, this.parentCell.getMaterialType()); + + + mesh.myPart = this;//need a ref back to this part + var wireframe = new THREE.EdgesHelper(mesh, 0x000000); + mesh.children.push(wireframe); return mesh; }; diff --git a/js/models/ThreeModel.js b/js/models/ThreeModel.js index 9d6dd844..f416c2ee 100644 --- a/js/models/ThreeModel.js +++ b/js/models/ThreeModel.js @@ -5,7 +5,7 @@ function ThreeModel(){ - var camera = new THREE.PerspectiveCamera(60, window.innerWidth/window.innerHeight, 0.001, 10000); + var camera = new THREE.PerspectiveCamera(60, window.innerWidth/window.innerHeight, 1, 10000); var scene = new THREE.Scene(); var renderer = new THREE.WebGLRenderer({antialias:true});//antialiasing is not supported in ff and on mac+chrome -- GitLab