Browse Source

Yet more clean up.

Mr.doob 12 years ago
parent
commit
6e6b17997f

+ 7 - 6
src/core/Projector.js

@@ -428,13 +428,14 @@ THREE.Projector = function () {
 						_line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z );
 						_line.z = Math.max( _clippedVertex1PositionScreen.z, _clippedVertex2PositionScreen.z );
 
 
 						_line.material = object.material;
 						_line.material = object.material;
-						
-						if (object.material.vertexColors === THREE.VertexColors){
-						    
-							_line.vertexColors[0].set(object.geometry.colors[v]);
-							_line.vertexColors[1].set(object.geometry.colors[v-1]);
-						    
+
+						if ( object.material.vertexColors === THREE.VertexColors ) {
+
+							_line.vertexColors[ 0 ].copy( object.geometry.colors[ v ] );
+							_line.vertexColors[ 1 ].copy( object.geometry.colors[ v - 1 ] );
+
 						}
 						}
+
 						_renderData.elements.push( _line );
 						_renderData.elements.push( _line );
 
 
 					}
 					}

+ 40 - 37
src/renderers/CanvasRenderer.js

@@ -196,7 +196,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 	};
 	};
 
 
-	this.getMaxAnisotropy  = function () {
+	this.getMaxAnisotropy = function () {
 
 
 		return 0;
 		return 0;
 
 
@@ -429,7 +429,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 					_pointLights.add( lightColor );
 					_pointLights.add( lightColor );
 
 
-				}setStrokeStyle
+				}
 
 
 			}
 			}
 
 
@@ -602,40 +602,43 @@ THREE.CanvasRenderer = function ( parameters ) {
 			_context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
 			_context.lineTo( v2.positionScreen.x, v2.positionScreen.y );
 
 
 			if ( material instanceof THREE.LineBasicMaterial ) {
 			if ( material instanceof THREE.LineBasicMaterial ) {
-                
-                setLineWidth( material.linewidth );
-    			setLineCap( material.linecap );
-    			setLineJoin( material.linejoin );
-                
-                if (material.vertexColors !== THREE.VertexColors){
-
-    				setStrokeStyle( material.color.getStyle() );
-    
-
-                } else {
-                
-                    var colorStyle1 = element.vertexColors[0].getStyle();
-                    var colorStyle2 = element.vertexColors[1].getStyle();
-                    
-                    if (colorStyle1 === colorStyle2){
-                        
-                        setStrokeStyle( colorStyle1 );
-                        
-                    }else {
-                
-                        var grad= _context.createLinearGradient(v1.positionScreen.x, 
-                                                            v1.positionScreen.y, 
-                                                            v2.positionScreen.x, 
-                                                            v2.positionScreen.y);
-                        grad.addColorStop(0, colorStyle1);
-                        grad.addColorStop(1, colorStyle2);
-                        setStrokeStyle(grad);
-                        
-                    }
-                    
-			    }
-                _context.stroke();
-    			_elemBox.expandByScalar( material.linewidth * 2 );
+
+				setLineWidth( material.linewidth );
+				setLineCap( material.linecap );
+				setLineJoin( material.linejoin );
+
+				if ( material.vertexColors !== THREE.VertexColors ) {
+
+					setStrokeStyle( material.color.getStyle() );
+
+				} else {
+
+					var colorStyle1 = element.vertexColors[0].getStyle();
+					var colorStyle2 = element.vertexColors[1].getStyle();
+
+					if ( colorStyle1 === colorStyle2 ) {
+
+						setStrokeStyle( colorStyle1 );
+
+					} else {
+
+						var grad = _context.createLinearGradient(
+							v1.positionScreen.x,
+							v1.positionScreen.y,
+							v2.positionScreen.x,
+							v2.positionScreen.y
+						);
+
+						grad.addColorStop( 0, colorStyle1 );
+						grad.addColorStop( 1, colorStyle2 );
+						setStrokeStyle( grad );
+
+					}
+
+				}
+
+				_context.stroke();
+				_elemBox.expandByScalar( material.linewidth * 2 );
 
 
 			} else if ( material instanceof THREE.LineDashedMaterial ) {
 			} else if ( material instanceof THREE.LineDashedMaterial ) {
 
 
@@ -1182,7 +1185,7 @@ THREE.CanvasRenderer = function ( parameters ) {
 
 
 		function expand( v1, v2 ) {
 		function expand( v1, v2 ) {
 
 
-			var x = v2.x - v1.x, y =  v2.y - v1.y,
+			var x = v2.x - v1.x, y = v2.y - v1.y,
 			det = x * x + y * y, idet;
 			det = x * x + y * y, idet;
 
 
 			if ( det === 0 ) return;
 			if ( det === 0 ) return;

+ 1 - 1
src/renderers/renderables/RenderableLine.js

@@ -9,7 +9,7 @@ THREE.RenderableLine = function () {
 	this.v1 = new THREE.RenderableVertex();
 	this.v1 = new THREE.RenderableVertex();
 	this.v2 = new THREE.RenderableVertex();
 	this.v2 = new THREE.RenderableVertex();
 
 
-	this.vertexColors = [ new THREE.Color(), new THREE.Color()];
+	this.vertexColors = [ new THREE.Color(), new THREE.Color() ];
 	this.material = null;
 	this.material = null;
 
 
 };
 };