diff --git a/assets/stls/parts/GIKEndPart.STL b/assets/stls/parts/GIKEndPart.STL new file mode 100755 index 0000000000000000000000000000000000000000..69b0489036035262fcb258938a4ad7e57b4a0407 Binary files /dev/null and b/assets/stls/parts/GIKEndPart.STL differ diff --git a/assets/stls/parts/GIKEndPartLowPoly.STL b/assets/stls/parts/GIKEndPartLowPoly.STL new file mode 100755 index 0000000000000000000000000000000000000000..9034310b61f0d79fd989d06125f5b8eb0e2f3cf9 Binary files /dev/null and b/assets/stls/parts/GIKEndPartLowPoly.STL differ diff --git a/assets/stls/parts/GIKPart.STL b/assets/stls/parts/GIKPart.STL new file mode 100755 index 0000000000000000000000000000000000000000..1e6cce3510f4ab617d0719349379e559ea6c367f Binary files /dev/null and b/assets/stls/parts/GIKPart.STL differ diff --git a/assets/stls/parts/GIKPartLowPoly.STL b/assets/stls/parts/GIKPartLowPoly.STL new file mode 100755 index 0000000000000000000000000000000000000000..caceba0652aade11784be73e9643bc827d839700 Binary files /dev/null and b/assets/stls/parts/GIKPartLowPoly.STL differ diff --git a/js/fea/DMASuperCell.js b/js/fea/DMASuperCell.js index ddbc76a492f263aa0e70c58e04c5e4ada2a431a5..2fb7ce1a2eacb4ddfa739cea47c3b0f168011b24 100644 --- a/js/fea/DMASuperCell.js +++ b/js/fea/DMASuperCell.js @@ -8,6 +8,7 @@ var cellMaterials = [new THREE.MeshNormalMaterial()]; DMASuperCell = function(length, range, cells){ var shouldRotate = range.max.x == range.min.x; this.mesh = this._buildSuperCellMesh(length, shouldRotate); + this.setVisibility(dmaGlobals.appState.get("cellMode")=="cell"); this.index = _.clone(range.max); this.cells = cells; this.setScale(); diff --git a/js/fea/DmaCellOther.js b/js/fea/DmaCellOther.js index 1b9b274d30ebbc97ddfca8694b07c6f0d5f03de5..1e56869f8a07c678abf6cdc8016627cf122e83a7 100644 --- a/js/fea/DmaCellOther.js +++ b/js/fea/DmaCellOther.js @@ -85,7 +85,8 @@ var cellMaterial = [new THREE.MeshNormalMaterial()]; DMAGIKCell.prototype._initParts = function(){ var parts = []; - parts.push(new DMAGIKPart(0, this)); + if (dmaGlobals.lattice.get("partType") == "lego") parts.push(new DMAGIKPart(0, this)); + else parts.push(new DMAGIKPartLowPoly(0, this)); return parts; }; diff --git a/js/fea/DmaPart.js b/js/fea/DmaPart.js index b08fbbd7fad0790d09a9bb77888869026d4192c3..0675b710873753c387774d34e49edaa7f822c0de 100644 --- a/js/fea/DmaPart.js +++ b/js/fea/DmaPart.js @@ -223,8 +223,12 @@ var partMaterial = new THREE.MeshLambertMaterial({ color:0xffffff, shading: THRE loader.load("assets/stls/parts/GIKPart.stl", function(geometry){ unitPartGeo = geometry; -// unitPartGeo.applyMatrix(new THREE.Matrix4().makeRotationY(Math.PI)); -// unitPartGeo.applyMatrix(new THREE.Matrix4().makeTranslation(0,0,0.09)); + unitPartGeo.computeBoundingBox(); + unitPartGeo.applyMatrix(new THREE.Matrix4().makeTranslation(-(unitPartGeo.boundingBox.min.x+unitPartGeo.boundingBox.max.x)/2, + -(unitPartGeo.boundingBox.min.y+unitPartGeo.boundingBox.max.y)/2, -(unitPartGeo.boundingBox.min.z+unitPartGeo.boundingBox.max.z)/2)); + var unitScale = 1/(unitPartGeo.boundingBox.max.x-unitPartGeo.boundingBox.min.x); + unitPartGeo.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI/2)); + unitPartGeo.applyMatrix(new THREE.Matrix4().makeScale(unitScale, unitScale, unitScale)); }); function DMAGIKPart(type, parent){ @@ -238,6 +242,38 @@ var partMaterial = new THREE.MeshLambertMaterial({ color:0xffffff, shading: THRE return mesh; }; - self.DMAMicroLegoPart = DMAGIKPart; + self.DMAGIKPart = DMAGIKPart; + +})(); + +(function () { + + var unitPartGeo; + + //import part geometry + var loader = new THREE.STLLoader(); + loader.load("assets/stls/parts/GIKPartLowPoly.stl", function(geometry){ + + unitPartGeo = geometry; + unitPartGeo.computeBoundingBox(); + unitPartGeo.applyMatrix(new THREE.Matrix4().makeTranslation(-(unitPartGeo.boundingBox.min.x+unitPartGeo.boundingBox.max.x)/2, + -(unitPartGeo.boundingBox.min.y+unitPartGeo.boundingBox.max.y)/2, -(unitPartGeo.boundingBox.min.z+unitPartGeo.boundingBox.max.z)/2)); + var unitScale = 1/(unitPartGeo.boundingBox.max.x-unitPartGeo.boundingBox.min.x); + unitPartGeo.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI/2)); + unitPartGeo.applyMatrix(new THREE.Matrix4().makeScale(unitScale, unitScale, unitScale)); + }); + + function DMAGIKPartLowPoly(type, parent){ + DMAPart.call(this, type, parent); + } + DMAGIKPartLowPoly.prototype = Object.create(DMAPart.prototype); + + DMAGIKPartLowPoly.prototype._makeMeshForType = function(){ + var mesh = new THREE.Mesh(unitPartGeo, partMaterial); + mesh.myPart = this;//need a ref back to this part + return mesh; + }; + + self.DMAGIKPartLowPoly = DMAGIKPartLowPoly; })(); \ No newline at end of file