Commit b8bfbda2 authored by amandaghassaei's avatar amandaghassaei

new version threejs 81

parent 1460782b
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -8,7 +8,8 @@ define(['three', 'cell'], ...@@ -8,7 +8,8 @@ define(['three', 'cell'],
//var unitCellGeo = new THREE.BoxGeometry(1,1,1); //var unitCellGeo = new THREE.BoxGeometry(1,1,1);
var unitCellGeo = new THREE.BoxGeometry(1,1,1);//new THREE.Geometry(); var unitCellGeo = new THREE.BoxGeometry(1,1,1);//new THREE.Geometry()
var wireframeMaterial = new THREE.LineBasicMaterial({color:0x000000, linewidth:1});
// //
// //box vertices // //box vertices
//unitCellGeo.vertices = [ //unitCellGeo.vertices = [
...@@ -83,10 +84,9 @@ define(['three', 'cell'], ...@@ -83,10 +84,9 @@ define(['three', 'cell'],
}; };
CubeCell.prototype._buildWireframe = function(mesh){//abstract mesh representation of cell CubeCell.prototype._buildWireframe = function(mesh){//abstract mesh representation of cell
var wireframe = new THREE.EdgesHelper(mesh); var wireframe = new THREE.LineSegments(new THREE.EdgesGeometry(mesh.geometry), wireframeMaterial);
wireframe.material.color.set(0x000000); //wireframe.matrixWorld = mesh.matrixWorld;
wireframe.matrixWorld = mesh.matrixWorld; //wireframe.matrixAutoUpdate = true;
wireframe.matrixAutoUpdate = true;
return wireframe; return wireframe;
}; };
......
...@@ -8,6 +8,7 @@ define(['underscore', 'appState', 'three'], function(_, appState, THREE){ ...@@ -8,6 +8,7 @@ define(['underscore', 'appState', 'three'], function(_, appState, THREE){
var materialNum = 1;//outward facing name var materialNum = 1;//outward facing name
var customMeshTypes = []; var customMeshTypes = [];
var textureLoader = new THREE.TextureLoader();
var torsion1dof = new THREE.Geometry(); var torsion1dof = new THREE.Geometry();
//torsion //torsion
...@@ -519,7 +520,11 @@ define(['underscore', 'appState', 'three'], function(_, appState, THREE){ ...@@ -519,7 +520,11 @@ define(['underscore', 'appState', 'three'], function(_, appState, THREE){
DMAMaterial.prototype._makeMaterialObject = function(color, transparent){ DMAMaterial.prototype._makeMaterialObject = function(color, transparent){
if (transparent) return new THREE.MeshLambertMaterial({color:color, transparent:true, opacity:0.4}); if (transparent) return new THREE.MeshLambertMaterial({color:color, transparent:true, opacity:0.4});
var json = {color: color}; var json = {color: color};
if (this.texture) json.map = THREE.ImageUtils.loadTexture("assets/textures/"+this.texture+".png"); if (this.texture) {
textureLoader.load("assets/textures/"+this.texture+".png", function(texture){
json.map = texture;//todo not sure if this loades on time
});
}
return new THREE.MeshLambertMaterial(json); return new THREE.MeshLambertMaterial(json);
}; };
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
define(['underscore', 'three', 'combinedCamera'], function(_, THREE){ define(['underscore', 'three'], function(_, THREE){
//var camera = new THREE.CombinedCamera( window.innerWidth / 2, window.innerHeight / 2, 60, 0.01, 1000, - 500, 1000 ); //var camera = new THREE.CombinedCamera( window.innerWidth / 2, window.innerHeight / 2, 60, 0.01, 1000, - 500, 1000 );
var camera = new THREE.PerspectiveCamera(60, window.innerWidth/window.innerHeight, 0.01, 1000); var camera = new THREE.PerspectiveCamera(60, window.innerWidth/window.innerHeight, 0.01, 1000);
......
...@@ -53,10 +53,10 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or ...@@ -53,10 +53,10 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
}, },
_setControlsEnabled: function(){ _setControlsEnabled: function(){
var state = appState.get("shift") || appState.get("extrudeMode"); var state = !(appState.get("shift") || appState.get("extrudeMode"));
this.controls.noRotate = state; this.controls.enableRotate = state;
this.controls.noPan = state; this.controls.enablePan = state;
this.controls.noZoom = state; this.controls.enableZoom = state;
}, },
reset3DNavigation: function(){ reset3DNavigation: function(){
...@@ -74,9 +74,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or ...@@ -74,9 +74,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
_mouseOut: function(){ _mouseOut: function(){
if (globals.get("highlighter")) globals.get("highlighter").setNothingHighlighted(); if (globals.get("highlighter")) globals.get("highlighter").setNothingHighlighted();
this._setNoPartIntersections(); this._setNoPartIntersections();
this.controls.noRotate = false; this.controls.enableRotate = true;
this.controls.noPan = false; this.controls.enablePan = true;
this.controls.noZoom = false; this.controls.enableZoom = true;
}, },
_isDragging: function(){ _isDragging: function(){
...@@ -107,9 +107,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or ...@@ -107,9 +107,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
} else if (this.leftClick && !this.rightClick) { } else if (this.leftClick && !this.rightClick) {
highlighter.addRemoveVoxel(!appState.get("deleteMode")); highlighter.addRemoveVoxel(!appState.get("deleteMode"));
if (highlighter.highlightingArrow()) { if (highlighter.highlightingArrow()) {
this.controls.noRotate = false; this.controls.enableRotate = true;
this.controls.noPan = false; this.controls.enablePan = true;
this.controls.noZoom = false; this.controls.enableZoom = true;
} }
} }
switch (e.which) { switch (e.which) {
...@@ -144,9 +144,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or ...@@ -144,9 +144,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
globals.get("highlighter").mouseDown(); globals.get("highlighter").mouseDown();
if (globals.get("highlighter").highlightingArrow()){ if (globals.get("highlighter").highlightingArrow()){
this.controls.noRotate = true; this.controls.enableRotate = false;
this.controls.noPan = true; this.controls.enablePan = false;
this.controls.noZoom = true; this.controls.enableZoom = false;
} }
}, },
...@@ -156,7 +156,7 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or ...@@ -156,7 +156,7 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
//if (!(appState.get("manualSelectOrigin"))) return;//todo ? //if (!(appState.get("manualSelectOrigin"))) return;//todo ?
if (this._isDragging() && !this.controls.noRotate) {//in the middle of a camera move if (this._isDragging() && this.controls.enableRotate) {//in the middle of a camera move
globals.get("highlighter").setNothingHighlighted(); globals.get("highlighter").setNothingHighlighted();
this._setNoPartIntersections(); this._setNoPartIntersections();
return; return;
......
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