diff --git a/assets/stls/parts/DNALegoBrick1x1.stl b/assets/stls/parts/DNALegoBrick1x1.stl new file mode 100644 index 0000000000000000000000000000000000000000..9bae87f673c7718e7681259ca25ede8b7e0b57df Binary files /dev/null and b/assets/stls/parts/DNALegoBrick1x1.stl differ diff --git a/js/cells/GIKCell.js b/js/cells/GIKCell.js index c5b0651946a1ba261d475aadd4f178e22b864478..f01c6aad3c9f2b4e1800cb6277af2e13410b4520 100644 --- a/js/cells/GIKCell.js +++ b/js/cells/GIKCell.js @@ -30,13 +30,13 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'], parts.push(new PartSubclass(self.index.x, self)); callback(parts); }); - } else if (lattice.get("partType") == "dnaLego") { + } else if (lattice.get("partType") == "lego") { require(['legoPart'], function(PartSubclass){ parts.push(new PartSubclass(self.index.x, self)); callback(parts); }); - } else if (lattice.get("partType") == "lego") { - require(['legoPart'], function(PartSubclass){ + } else if (lattice.get("partType") == "dnaLego") { + require(['dnaLegoPart'], function(PartSubclass){ parts.push(new PartSubclass(self.index.x, self)); callback(parts); }); diff --git a/js/lattice/Lattice.js b/js/lattice/Lattice.js index 6f22d90422336deabc7246f5bbae8c065e273fd7..371a9ade615eace0ce92ef4ec28c5100ecaec4d6 100644 --- a/js/lattice/Lattice.js +++ b/js/lattice/Lattice.js @@ -15,7 +15,7 @@ define(['underscore', 'backbone', 'appState', 'globals', 'plist', 'three', 'thre cellType: "cube", connectionType: "gik", - latticeType: "willGik", + latticeType: "dnaBricks", partType: null, aspectRatio: null, diff --git a/js/main.js b/js/main.js index 895b59f9dfce9112cb9a561f23026cbe3181e904..a8fc4fb6366e454188ade1dd2df1f5250cc26e44 100644 --- a/js/main.js +++ b/js/main.js @@ -109,6 +109,7 @@ require.config({ samTeqPart: 'parts/SamTeqPart', legoPart: 'parts/LegoPart', dnaStraightPart: 'parts/DNAStraightPart', + dnaLegoPart: 'parts/DNALegoPart', //materials materials: 'materials/DMAMaterials', @@ -214,7 +215,8 @@ require.config({ kennyTeqPartSTL: 'assets/stls/parts/KennyTeqPart.stl', kennyTeqPartHighResSTL: 'assets/stls/parts/KennyTeqPartHighRes.stl', samTeqPartSTL: 'assets/stls/parts/SamTeqPart.stl', - legoBrickSTL: 'assets/stls/parts/legoBrick1x1.stl' + legoBrickSTL: 'assets/stls/parts/legoBrick1x1.stl', + dnaLegoBrickSTL: 'assets/stls/parts/DNALegoBrick1x1.stl' }, diff --git a/js/models/AppState.js b/js/models/AppState.js index 158fe6bbbfccc1a2005186677f5f06091481a993..9b150c3ca9c254b9a7b524ce1d7e504c1238fd9a 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -36,7 +36,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu cellsVisible: true, superCellIndex: new THREE.Vector3(0,0,0),//offset of superCell adds - gikLength: 4,//this updates super cell range when using non-composite materials + gikLength: 2,//this updates super cell range when using non-composite materials superCellRange: new THREE.Vector3(1,1,1), realisticColorScheme: false, diff --git a/js/parts/DNALegoPart.js b/js/parts/DNALegoPart.js new file mode 100644 index 0000000000000000000000000000000000000000..a9d780bc778a527bf0f28d51ef77c25733f2941f --- /dev/null +++ b/js/parts/DNALegoPart.js @@ -0,0 +1,26 @@ +/** + * Created by aghassaei on 9/14/15. + */ + + +define(['underscore', 'stlLoader', 'gikPart', 'bin!dnaLegoBrickSTL'], function(_, THREE, GIKPart, stl){ + + var loader = new THREE.STLLoader(); + var unitGeo = preProcessGeo(loader.parse(stl)); + + function preProcessGeo(geo){ + geo.applyMatrix(new THREE.Matrix4().makeRotationX(Math.PI/2)); + return geo; + } + + function DNALegoPart(index, parent){ + GIKPart.call(this, index, parent); + } + DNALegoPart.prototype = Object.create(GIKPart.prototype); + + DNALegoPart.prototype._getGeometry = function(){ + return unitGeo; + }; + + return DNALegoPart; +}); \ No newline at end of file diff --git a/js/plists/PList.js b/js/plists/PList.js index 58ff02f724b48c40820f5c27a6dd6cd2d6a595e0..d97aaf21c171ae0994667add362072c247a4bdf5 100644 --- a/js/plists/PList.js +++ b/js/plists/PList.js @@ -12,7 +12,7 @@ define(['three'], function(THREE){ lattice:"Lattice", //sketch:"Sketch", material:"Materials", - import:"Import", +// import:"Import", part:"Part" //script:"Script" }