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'],
//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
//unitCellGeo.vertices = [
......@@ -83,10 +84,9 @@ define(['three', 'cell'],
};
CubeCell.prototype._buildWireframe = function(mesh){//abstract mesh representation of cell
var wireframe = new THREE.EdgesHelper(mesh);
wireframe.material.color.set(0x000000);
wireframe.matrixWorld = mesh.matrixWorld;
wireframe.matrixAutoUpdate = true;
var wireframe = new THREE.LineSegments(new THREE.EdgesGeometry(mesh.geometry), wireframeMaterial);
//wireframe.matrixWorld = mesh.matrixWorld;
//wireframe.matrixAutoUpdate = true;
return wireframe;
};
......
......@@ -8,6 +8,7 @@ define(['underscore', 'appState', 'three'], function(_, appState, THREE){
var materialNum = 1;//outward facing name
var customMeshTypes = [];
var textureLoader = new THREE.TextureLoader();
var torsion1dof = new THREE.Geometry();
//torsion
......@@ -519,7 +520,11 @@ define(['underscore', 'appState', 'three'], function(_, appState, THREE){
DMAMaterial.prototype._makeMaterialObject = function(color, transparent){
if (transparent) return new THREE.MeshLambertMaterial({color:color, transparent:true, opacity:0.4});
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);
};
......
......@@ -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.PerspectiveCamera(60, window.innerWidth/window.innerHeight, 0.01, 1000);
......
......@@ -53,10 +53,10 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
},
_setControlsEnabled: function(){
var state = appState.get("shift") || appState.get("extrudeMode");
this.controls.noRotate = state;
this.controls.noPan = state;
this.controls.noZoom = state;
var state = !(appState.get("shift") || appState.get("extrudeMode"));
this.controls.enableRotate = state;
this.controls.enablePan = state;
this.controls.enableZoom = state;
},
reset3DNavigation: function(){
......@@ -74,9 +74,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
_mouseOut: function(){
if (globals.get("highlighter")) globals.get("highlighter").setNothingHighlighted();
this._setNoPartIntersections();
this.controls.noRotate = false;
this.controls.noPan = false;
this.controls.noZoom = false;
this.controls.enableRotate = true;
this.controls.enablePan = true;
this.controls.enableZoom = true;
},
_isDragging: function(){
......@@ -107,9 +107,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
} else if (this.leftClick && !this.rightClick) {
highlighter.addRemoveVoxel(!appState.get("deleteMode"));
if (highlighter.highlightingArrow()) {
this.controls.noRotate = false;
this.controls.noPan = false;
this.controls.noZoom = false;
this.controls.enableRotate = true;
this.controls.enablePan = true;
this.controls.enableZoom = true;
}
}
switch (e.which) {
......@@ -144,9 +144,9 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
globals.get("highlighter").mouseDown();
if (globals.get("highlighter").highlightingArrow()){
this.controls.noRotate = true;
this.controls.noPan = true;
this.controls.noZoom = true;
this.controls.enableRotate = false;
this.controls.enablePan = false;
this.controls.enableZoom = false;
}
},
......@@ -156,7 +156,7 @@ define(['underscore', 'backbone', 'three', 'appState', 'globals', 'lattice', 'or
//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();
this._setNoPartIntersections();
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