瀏覽代碼

Merge remote branch 'remotes/upstream/experimental' into experimental

alteredq 14 年之前
父節點
當前提交
91ef6a7188
共有 5 個文件被更改,包括 46 次插入76 次删除
  1. 2 3
      build/custom/ThreeSVG.js
  2. 43 43
      src/core/Spline.js
  3. 1 14
      src/core/Vertex.js
  4. 0 15
      src/renderers/CanvasRenderer.js
  5. 0 1
      utils/build.py

+ 2 - 3
build/custom/ThreeSVG.js

@@ -103,9 +103,8 @@ undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
 THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
 undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
-a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
-THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
-THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
+THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;

+ 43 - 43
src/core/Spline.js

@@ -5,27 +5,27 @@
  * @author mrdoob / http://mrdoob.com/
  * @author alteredq / http://alteredqualia.com/
  */
- 
+
 THREE.Spline = function ( points ) {
 
 	this.points = points;
-	
+
 	var c = [], v3 = { x: 0, y: 0, z: 0 },
 	point, intPoint, weight, w2, w3,
 	pa, pb, pc, pd;
 
 	this.initFromArray = function( a ) {
-		
+
 		this.points = [];
-		
+
 		for ( var i = 0; i < a.length; i++ ) {
-			
+
 			this.points[ i ] = { x: a[ i ][ 0 ], y: a[ i ][ 1 ], z: a[ i ][ 2 ] };
-			
+
 		}
-		
+
 	};
-	
+
 	this.getPoint = function ( k ) {
 
 		point = ( this.points.length - 1 ) * k;
@@ -44,11 +44,11 @@ THREE.Spline = function ( points ) {
 
 		w2 = weight * weight;
 		w3 = weight * w2;
-		
+
 		v3.x = interpolate( pa.x, pb.x, pc.x, pd.x, weight, w2, w3 );
 		v3.y = interpolate( pa.y, pb.y, pc.y, pd.y, weight, w2, w3 );
 		v3.z = interpolate( pa.z, pb.z, pc.z, pd.z, weight, w2, w3 );
-		
+
 		return v3;
 
 	};
@@ -57,20 +57,20 @@ THREE.Spline = function ( points ) {
 
 		var i, p, l = this.points.length,
 			coords = [];
-		
+
 		for ( i = 0; i < l; i ++ ) {
-			
+
 			p = this.points[ i ];
 			coords[ i ] = [ p.x, p.y, p.z ];
 
 		}
-		
+
 		return coords;
 
 	};
-		
+
 	// approximate length by summing linear segments
-	
+
 	this.getLength = function ( nSubDivisions ) {
 
 		var i, index, nSamples,
@@ -79,31 +79,31 @@ THREE.Spline = function ( points ) {
 			tmpVec = new THREE.Vector3(),
 			chunkLengths = [],
 			totalLength = 0;
-	
+
 		// first point has 0 length
-		
+
 		chunkLengths[ 0 ] = 0;
-		
+
 		if ( !nSubDivisions ) nSubDivisions = 100;
-		
+
 		nSamples = this.points.length * nSubDivisions;
-		
+
 		oldPosition.copy( this.points[ 0 ] );
 
 		for ( i = 1; i < nSamples; i ++ ) {
 
 			index = i / nSamples;
-			
+
 			position = this.getPoint( index );
 			tmpVec.copy( position );
-			
+
 			totalLength += tmpVec.distanceTo( oldPosition );
-			
+
 			oldPosition.copy( position );
 
 			point = ( this.points.length - 1 ) * index;
 			intPoint = Math.floor( point );
-			
+
 			if ( intPoint != oldIntPoint ) {
 
 				chunkLengths[ intPoint ] = totalLength;
@@ -112,56 +112,56 @@ THREE.Spline = function ( points ) {
 			}
 
 		}
-		
+
 		// last point ends with total length
-		
+
 		chunkLengths[ chunkLengths.length ] = totalLength;
 
 		return { chunks: chunkLengths, total: totalLength };
 
 	};
-	
+
 	this.reparametrizeByArcLength = function ( samplingCoef ) {
-		
-		var i, j, 
+
+		var i, j,
 			index, indexCurrent, indexNext,
 			linearDistance, realDistance,
 			sampling,
 			newpoints = [],
 			tmpVec = new THREE.Vector3(),
 			sl = this.getLength();
-		
+
 		newpoints.push( tmpVec.copy( this.points[ 0 ] ).clone() );
-		
+
 		for ( i = 1; i < this.points.length; i++ ) {
-			
+
 			//tmpVec.copy( this.points[ i - 1 ] );
 			//linearDistance = tmpVec.distanceTo( this.points[ i ] );
 
 			realDistance = sl.chunks[ i ] - sl.chunks[ i - 1 ];
-			
-			sampling = Math.ceil( samplingCoef * realDistance / sl.total );			
-			
+
+			sampling = Math.ceil( samplingCoef * realDistance / sl.total );
+
 			indexCurrent = ( i - 1 ) / ( this.points.length - 1 );
 			indexNext = i / ( this.points.length - 1 );
-			
+
 			for ( j = 1; j < sampling - 1; j++ ) {
 
 				index = indexCurrent + j * ( 1 / sampling ) * ( indexNext - indexCurrent );
 
 				position = this.getPoint( index );
 				newpoints.push( tmpVec.copy( position ).clone() );
-				
+
 			}
-			
+
 			newpoints.push( tmpVec.copy( this.points[ i ] ).clone() );
 
 		}
-		
+
 		this.points = newpoints;
-		
-	};		
-	
+
+	};
+
 	// Catmull-Rom
 
 	function interpolate( p0, p1, p2, p3, t, t2, t3 ) {
@@ -173,4 +173,4 @@ THREE.Spline = function ( points ) {
 
 	};
 
-};
+};

+ 1 - 14
src/core/Vertex.js

@@ -2,21 +2,8 @@
  * @author mr.doob / http://mrdoob.com/
  */
 
-THREE.Vertex = function ( position /*, normal*/ ) {
+THREE.Vertex = function ( position ) {
 
 	this.position = position || new THREE.Vector3();
 
-	/*
-	this.positionWorld = new THREE.Vector3();
-	this.positionScreen = new THREE.Vector4();
-
-	this.normal = normal || new THREE.Vector3();
-	this.normalWorld = new THREE.Vector3();
-	this.normalScreen = new THREE.Vector3();
-
-	this.tangent = new THREE.Vector4();
-
-	this.__visible = true;
-	*/
-
 };

+ 0 - 15
src/renderers/CanvasRenderer.js

@@ -718,21 +718,6 @@ THREE.CanvasRenderer = function () {
 
 				if ( _enableLighting ) {
 
-					/*
-					_light.r = _ambientLight.r;
-					_light.g = _ambientLight.g;
-					_light.b = _ambientLight.b;
-
-					calculateLight( scene, element.centroidWorld, element.normalWorld, _light );
-
-					_color.r = material.color.r * _light.r;
-					_color.g = material.color.g * _light.g;
-					_color.b = material.color.b * _light.b;
-
-					_color.updateStyleString();
-					material.wireframe ? strokePath( _color.__styleString, material.wireframeLinewidth ) : fillPath( _color.__styleString );
-					*/
-
 					if ( !material.wireframe && material.shading == THREE.SmoothShading && element.vertexNormalsWorld.length == 4 ) {
 
 						_color1.r = _color2.r = _color3.r = _color4.r = _ambientLight.r;

+ 0 - 1
utils/build.py

@@ -216,7 +216,6 @@ SVG_FILES = [
 'materials/MeshNormalMaterial.js',
 'materials/MeshFaceMaterial.js',
 'materials/ParticleBasicMaterial.js',
-'materials/ParticleCanvasMaterial.js',
 'objects/Particle.js',
 'objects/Line.js',
 'objects/Mesh.js',