Commit d11ee567 authored by Amanda Ghassaei's avatar Amanda Ghassaei

lego part

parent d2965f7e
......@@ -20,14 +20,29 @@ define(['underscore', 'three', 'threeModel', 'lattice', 'appState', 'cubeCell'],
var self = this;
var parts = [];
if (lattice.get("partType") == "lego") {
require(['gikPart'], function(GIKPart){
parts.push(new GIKPart(self.index.x, self));
if (lattice.get("partType") == "willLego") {
require(['gikPart'], function(PartSubclass){
parts.push(new PartSubclass(self.index.x, self));
callback(parts);
});
} else {
require(['gikPartLowPoly'], function(GIKPartLowPoly){
parts.push(new GIKPartLowPoly(self.index.x, self));
} else if (lattice.get("partType") == "willLegoLowPoly") {
require(['gikPartLowPoly'], function(PartSubclass){
parts.push(new PartSubclass(self.index.x, self));
callback(parts);
});
} else if (lattice.get("partType") == "dnaLego") {
require(['legoPart'], function(PartSubclass){
parts.push(new PartSubclass(self.index.x, self));
callback(parts);
});
} 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") == "dnaStraight") {
require(['gikPartLowPoly'], function(PartSubclass){
parts.push(new PartSubclass(self.index.x, self));
callback(parts);
});
}
......
......@@ -107,6 +107,7 @@ require.config({
kennyTeqPart: 'parts/KennyTeqPart',
kennyTeqHighResPart: 'parts/KennyTeqHighResPart',
samTeqPart: 'parts/SamTeqPart',
legoPart: 'parts/LegoPart',
//materials
materials: 'materials/DMAMaterials',
......
/**
* Created by aghassaei on 9/14/15.
*/
define(['underscore', 'stlLoader', 'gikPart', 'bin!../assets/stls/parts/legoBrick1x1.stl'], function(_, THREE, GIKPart, stl){
var loader = new THREE.STLLoader();
var unitGeo = preProcessGeo(loader.parse(stl));
function preProcessGeo(geo){
geo.computeBoundingBox();
var unitScale = 1/(8.2);
geo.applyMatrix(new THREE.Matrix4().makeScale(unitScale, unitScale, unitScale));
return geo;
}
function LegoPart(index, parent){
GIKPart.call(this, index, parent);
}
LegoPart.prototype = Object.create(GIKPart.prototype);
LegoPart.prototype._getGeometry = function(){
return unitGeo;
};
return LegoPart;
});
\ No newline at end of file
......@@ -224,10 +224,10 @@ define(['three'], function(THREE){
willGik: {
name: "Electronic GIK Lattice",
parts: {
lego: {
willLego: {
name: "Micro LEGO (high res)"
},
legoLowPoly: {
willLegoLowPoly: {
name: "Micro LEGO (low res)"
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment