diff --git a/js/fea/dmaNode.js b/js/fea/dmaNode.js index a77b2a803fd78807336a40e188cf6e1bbeb6a723..e7a53e0130a46a1cacdaa63a517a665d6e140587 100644 --- a/js/fea/dmaNode.js +++ b/js/fea/dmaNode.js @@ -14,7 +14,7 @@ BeamNode.prototype.addBeam = function(beam){ BeamNode.prototype.render = function(){ - var geometry = new THREE.SphereGeometry(2); + var geometry = new THREE.BoxGeometry(2,2,2); geometry.applyMatrix( new THREE.Matrix4().makeTranslation(this.x, this.y, this.z) ); var mesh = new THREE.Mesh(geometry); diff --git a/js/fea/dmaPart.js b/js/fea/dmaPart.js index 23c7c625cf49d7f381c872203b31ffee8271e9d3..ae58792de7e50b9b8fe8a39ff218ab5b7ea55766 100644 --- a/js/fea/dmaPart.js +++ b/js/fea/dmaPart.js @@ -5,12 +5,16 @@ //a part, element with a single material, handled by assembler -function Part(nodes, config) {//list of nodes, config tells how nodes are connected - this.nodes = nodes; - this.beams = this._createBeams(nodes, config); -}; -Part.prototype._createBeams = function(nodes, config){ + +function DmaPart(geometry) {//list of nodes, config tells how nodes are connected +// this.nodes = nodes; +// this.beams = this._createBeams(nodes, config); + this.geometry = geometry; + this.render(); +} + +DmaPart.prototype._createBeams = function(nodes, config){ var beams = []; _.each(config, function(pair){ beams.push(new Beam(nodes[pair[0]], nodes[pair[2]])); @@ -18,21 +22,27 @@ Part.prototype._createBeams = function(nodes, config){ return beams; }; -Part.prototype.render = function(scene){ +DmaPart.prototype.render = function(){ + var mesh = new THREE.Mesh(this.geometry); + window.three.sceneAdd(mesh); + window.three.render(); }; -Part.prototype.translate = function(dx, dy, dz){ +DmaPart.prototype.translate = function(dx, dy, dz){ }; -Part.prototype.rotate = function(rx, ry, rz){ +DmaPart.prototype.rotate = function(rx, ry, rz){ }; +////////////////////////////////////////////////////////////// +/////////////////SUBCLASSES/////////////////////////////////// +////////////////////////////////////////////////////////////// -//matt's part -function PartTriangle(nodes){ -} - -PartTriangle.prototype = new Part(nodes, [[0,1],[1,2],[2,0]]); \ No newline at end of file +////matt's part +//function PartTriangle(){ +//} +// +//PartTriangle.prototype = new DmaPart(); \ No newline at end of file diff --git a/js/main.js b/js/main.js index 9b9db456acc717b71573bb2a786844a3e7759934..6ccd65a04d70de40dacef1368d5d77e56423deda 100644 --- a/js/main.js +++ b/js/main.js @@ -26,5 +26,18 @@ $(function(){ var threeView = new ThreeView({model:threeModel, highlightTargets:highlightTargets}); + //first, pre load the stl + part_loadSTL(); + + function part_loadSTL(){ + var loader = new THREE.STLLoader(); + loader.addEventListener('load', part_onMeshLoad); + loader.load('data/Airbus_A300-600.stl'); + } + + function part_onMeshLoad(e){ + new DmaPart(e.content); + } + setupNavBar(threeModel); }); diff --git a/main.html b/main.html index 30e987c300560cf2040773fbe0e54fbd0f0eb24c..5290fddf69490a09987228b08d719437e9531d26 100644 --- a/main.html +++ b/main.html @@ -41,7 +41,7 @@ <!--fea stuff--> <script src="js/fea/dmaCell.js"></script> - <!--<script src="js/fea/dmaPart.js"></script>--> + <script src="js/fea/dmaPart.js"></script> <!--<script src="js/fea/dmaBeam.js"></script>--> <script src="js/fea/dmaNode.js"></script>