فهرست منبع

Removed tangents code. See #7094.

Mr.doob 10 سال پیش
والد
کامیت
0c42f98876

+ 7 - 24
docs/api/core/BufferGeometry.html

@@ -86,11 +86,6 @@
 		Set by [page:.fromGeometry]().
 		</div>
 
-		<h4>[page:BufferAttribute tangent] (itemSize: 3)</h4>
-		<div>
-		Stores the x, y, and z components of the tangent vector of each vertex in this geometry. Set by [page:.computeTangents]().
-		</div>
-
 		<h4>[page:BufferAttribute index] (itemSize: 3)</h4>
 		Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles," and works much the same as it does in [page:Geometry]: each triangle is associated with the index of three vertices. This attribute therefore stores the index of each vertex for each triangular face.
 
@@ -158,11 +153,6 @@
 		Morph vertices match number and order of primary vertices.
 		</div>
 
-		<h3>[property:boolean hasTangents]</h3>
-		<div>
-		True if BufferGeometry has tangents. Set in [page:.computeTangents].
-		</div>
-
 		<h2>Methods</h2>
 
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
@@ -178,7 +168,7 @@
 		<div>
 		Adds a draw call to this geometry; see the [page:BufferGeometry.drawcalls drawcalls] property for details.
 		</div>
-    
+
 		<h3>[method:null clearDrawCalls]( )</h3>
 		<div>
 		Clears all draw calls.
@@ -188,12 +178,12 @@
 		<div>
 		Bakes matrix transform directly into vertex coordinates.
 		</div>
-    
+
 		<h3>[method:null center] ()</h3>
 		<div>
 		Center the geometry based on the bounding box.
 		</div>
-    
+
 		<h3>[method:BufferGeometry rotateX] ( [page:Float radians] )</h3>
 		<div>
 		Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop
@@ -243,13 +233,6 @@
 		Computes vertex normals by averaging face normals.<br />
 		</div>
 
-		<h3>[method:null computeTangents]()</h3>
-		<div>
-		Computes vertex tangents.<br />
-		Based on [link:http://www.terathon.com/code/tangent.html]<br />
-		Geometry must have vertex [page:UV UVs] (layer 0 will be used).
-		</div>
-
 		<h3>[method:null computeBoundingBox]()</h3>
 		<div>
 		Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.<br />
@@ -306,18 +289,18 @@
 		<div>
 		Returns a raw object representation of the BufferGeometry.
 		</div>
-		
+
 		<h3>[method:BufferGeometry clone]()</h3>
 		<div>
 		Creates a clone of this BufferGeometry.
 		</div>
-		
+
 		<h3>[method:BufferGeometry copy]( [page:BufferGeometry bufferGeometry] )</h3>
 		<div>
 		Copies another BufferGeometry to this BufferGeometry.
 		</div>
-		
-		
+
+
 
 		<h2>Source</h2>
 

+ 2 - 7
docs/api/core/Face3.html

@@ -71,11 +71,6 @@
 		Array of 3 vertex colors.
 		</div>
 
-		<h3>[property:Array vertexTangents]</h3>
-		<div>
-		Array of 3 vertex tangents.
-		</div>
-
 
 		<h3>[property:Integer materialIndex]</h3>
 		<div>
@@ -88,8 +83,8 @@
 		<div>
 		Creates a new clone of the Face3 object.
 		</div>
-		
-		
+
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 15 - 32
docs/api/core/Geometry.html

@@ -117,10 +117,10 @@
 		// e.g.
 		geometry.skinIndices[15] = new THREE.Vector4(   0,   5,   9, 0 );
 		geometry.skinWeights[15] = new THREE.Vector4( 0.2, 0.5, 0.3, 0 );
-		
+
 		// corresponds with the following vertex
 		geometry.vertices[15];
-		
+
 		// these bones will be used like so:
 		skeleton.bones[0]; // weight of 0.2
 		skeleton.bones[5]; // weight of 0.5
@@ -141,48 +141,38 @@
 		<code>{ radius: float }</code>
 		</div>
 
-		<h3>[property:Boolean hasTangents]</h3>
-		<div>
-		True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents].
-		</div>
-
 		<h3>[property:Boolean dynamic]</h3>
 		<div>
 		Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).<br/>
 		Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.<br/>
 		Defaults to true.
 		</div>
-		
+
 		<h3>[property:Boolean verticesNeedUpdate]</h3>
 		<div>
 		Set to *true* if the vertices array has been updated.
 		</div>
-		
+
 		<h3>[property:Boolean elementsNeedUpdate]</h3>
 		<div>
 		Set to *true* if the faces array has been updated.
 		</div>
-		
+
 		<h3>[property:Boolean uvsNeedUpdate]</h3>
 		<div>
 		Set to *true* if the uvs array has been updated.
 		</div>
-		
+
 		<h3>[property:Boolean normalsNeedUpdate]</h3>
 		<div>
 		Set to *true* if the normals array has been updated.
 		</div>
-		
-		<h3>[property:Boolean tangentsNeedUpdate]</h3>
-		<div>
-		Set to *true* if the tangents in the faces has been updated.
-		</div>
-		
+
 		<h3>[property:Boolean colorsNeedUpdate]</h3>
 		<div>
 		Set to *true* if the colors array has been updated.
 		</div>
-		
+
 		<h3>[property:Boolean lineDistancesNeedUpdate]</h3>
 		<div>
 		Set to *true* if the linedistances array has been updated.
@@ -193,10 +183,10 @@
 		An array containing distances between vertices for Line geometries.
 		This is required for LinePieces/LineDashedMaterial to render correctly.
 		Line distances can also be generated with computeLineDistances.
-		</div> 
+		</div>
 
 		<h2>Methods</h2>
-		
+
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 
 		<h3>[method:null applyMatrix]( [page:Matrix4 matrix] )</h3>
@@ -208,7 +198,7 @@
 		<div>
 		Center the geometry based on the bounding box.
 		</div>
-    
+
 		<h3>[method:Geometry rotateX] ( [page:Float radians] )</h3>
 		<div>
 		Rotate the geometry about the X axis. This is typically done as a one time operation, and not during a loop
@@ -264,13 +254,6 @@
 		Computes morph normals.
 		</div>
 
-		<h3>[method:null computeTangents]()</h3>
-		<div>
-		Computes vertex tangents.<br />
-		Based on [link:http://www.terathon.com/code/tangent.html]<br />
-		Geometry must have vertex [page:UV UVs] (layer 0 will be used).
-		</div>
-
 		<h3>[method:null computeBoundingBox]()</h3>
 		<div>
 		Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
@@ -280,7 +263,7 @@
 		<div>
 		Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
 		</div>
-		
+
 		<div>Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are *null*.</div>
 
 		<h3>[method:null merge]( [page:Geometry geometry], [page:Matrix4 matrix], [page:Integer materialIndexOffset] )</h3>
@@ -297,16 +280,16 @@
 		Normalize the geometry. <br />
 		Make the geometry centered and has a bounding sphere whose raidus equals to 1.0.
 		</div>
-		
+
 		<h3>[method:Geometry clone]()</h3>
 		<div>
 		Creates a new clone of the Geometry.
 		</div>
-		
+
 		<h3>[method:null dispose]()</h3>
 		<div>
 		Removes The object from memory. <br />
-		Don't forget to call this method when you remove a geometry because it can cause memory leaks. 
+		Don't forget to call this method when you remove a geometry because it can cause memory leaks.
 		</div>
 
 		<h3>[method:null computeLineDistances]()</h3>

+ 0 - 59
docs/api/extras/helpers/VertexTangentsHelper.html

@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../../" />
-		<script src="list.js"></script>
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-		[page:Line] &rarr;
-
-		<h1>[name]</h1>
-
-		<div class="desc">Renders [page:ArrowHelper arrows] to visualize an object's vertex tangent vectors. Requires that tangents have been specified in a [page:BufferAttribute custom attribute] or have been computed using [page:Geometry.computeTangents computeTangents]. </div>
-
-		<h2>Example</h2>
-
-		<code>
-		geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 );
-		material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
-		object = new THREE.Mesh( geometry, material );
-
-		edges = new THREE.VertexTangentsHelper( object, 2, 0x00ff00, 1 );
-
-		scene.add( object );
-		scene.add( edges );
-		</code>
-
-		<h2>Constructor</h2>
-
-
-		<h3>[name]( [page:Object3D object], [page:Number size], [page:Color color], [page:Number linewidth] )</h3>
-		<div>object -- object for which to render vertex tangents
-		size -- size (length) of the arrows
-		color -- color of the arrows
-		linewidth -- width of the arrow lines
-		</div>
-
-
-		<h2>Properties</h2>
-
-		<h3>[property:Object3D object]</h3>
-		<div>
-		The attached object
-		</div>
-
-
-		<h2>Methods</h2>
-
-
-		<h3>[method:null update]()</h3>
-		<div>Updates the vertex tangent preview arrows based on the new position and tangents of the object.</div>
-
-		<h2>Source</h2>
-
-		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
-	</body>
-</html>

+ 0 - 8
docs/api/loaders/Loader.html

@@ -43,14 +43,6 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:Boolean needsTangents]( [page:Array materials] )</h3>
-		<div>
-		[page:Array materials] — an array of [page:Material]
-		</div>
-		<div>
-		Checks if the loaded object needs tangents based on its materials.
-		</div>
-
 		<h3>[method:Material createMaterial]( [page:object m], [page:string texturePath] )</h3>
 		<div>
 		[page:Object m] — The parameters to create the material. <br />

+ 0 - 1
docs/list.js

@@ -230,7 +230,6 @@ var list = {
 			[ "PointLightHelper", "api/extras/helpers/PointLightHelper" ],
 			[ "SpotLightHelper", "api/extras/helpers/SpotLightHelper" ],
 			[ "VertexNormalsHelper", "api/extras/helpers/VertexNormalsHelper" ],
-			[ "VertexTangentsHelper", "api/extras/helpers/VertexTangentsHelper" ],
 			[ "WireframeHelper", "api/extras/helpers/WireframeHelper" ]
 		],
 

+ 0 - 48
editor/js/libs/tern-threejs/threejs.js

@@ -225,10 +225,6 @@
           "!type": "[]",
           "!doc": "Array of morph targets. Each morph target is a Javascript object:\n\t\t<code>{ name: \"targetName\", vertices: [ new THREE.Vertex(), ... ] }</code>\n\t\tMorph vertices match number and order of primary vertices."
         },
-        "hasTangents": {
-          "!type": "boolean",
-          "!doc": "True if BufferGeometry has tangents. Set in [page:.computeTangents]."
-        },
         "addAttribute": {
           "!type": "null",
           "!doc": "Adds an attribute to this geometry. Use this rather than the attributes property, \n\t\tbecause an internal array of attributes is maintained to speed up iterating over\n\t\tattributes."
@@ -245,10 +241,6 @@
           "!type": "fn()",
           "!doc": "Computes vertex normals by averaging face normals.<br>"
         },
-        "computeTangents": {
-          "!type": "fn()",
-          "!doc": "Computes vertex tangents.<br>\n\t\tBased on [link:http://www.terathon.com/code/tangent.html]<br>\n\t\tGeometry must have vertex [page:UV UVs] (layer 0 will be used)."
-        },
         "computeBoundingBox": {
           "!type": "fn()",
           "!doc": "Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.<br>\n\t\tBounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are *null*."
@@ -374,10 +366,6 @@
           "!type": "[]",
           "!doc": "Array of 3 vertex colors."
         },
-        "vertexTangents": {
-          "!type": "[]",
-          "!doc": "Array of 3 vertex tangents."
-        },
         "materialIndex": {
           "!type": "number",
           "!doc": "Material index (points to [page:MeshFaceMaterial MeshFaceMaterial.materials])."
@@ -445,10 +433,6 @@
           "!type": "object",
           "!doc": "Bounding sphere.\n\t\t<code>{ radius: float }</code>"
         },
-        "hasTangents": {
-          "!type": "bool",
-          "!doc": "True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents]."
-        },
         "dynamic": {
           "!type": "bool",
           "!doc": "Set to *true* if attribute buffers will need to change in runtime (using \"dirty\" flags).<br>\n\t\tUnless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.<br>\n\t\tDefaults to true."
@@ -469,10 +453,6 @@
           "!type": "bool",
           "!doc": "Set to *true* if the normals array has been updated."
         },
-        "tangentsNeedUpdate": {
-          "!type": "bool",
-          "!doc": "Set to *true* if the tangents in the faces has been updated."
-        },
         "colorsNeedUpdate": {
           "!type": "bool",
           "!doc": "Set to *true* if the colors array has been updated."
@@ -501,10 +481,6 @@
           "!type": "fn()",
           "!doc": "Computes morph normals."
         },
-        "computeTangents": {
-          "!type": "fn()",
-          "!doc": "Computes vertex tangents.<br>\n\t\tBased on [link:http://www.terathon.com/code/tangent.html]<br>\n\t\tGeometry must have vertex [page:UV UVs] (layer 0 will be used)."
-        },
         "computeBoundingBox": {
           "!type": "fn()",
           "!doc": "Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute."
@@ -2005,22 +1981,6 @@
       "!doc": "Renders [page:ArrowHelper arrows] to visualize an object's vertex normal vectors. Requires that normals have been specified in a [page:BufferAttribute custom attribute] or have been calculated using [page:Geometry.computeVertexNormals computeVertexNormals].",
       "!type": "fn(object: +THREE.Object3D, size: number, color: +THREE.Color, linewidth: number)"
     },
-    "VertexTangentsHelper": {
-      "!url": "http://threejs.org/docs/#Reference/extras/helpers/VertexTangentsHelper",
-      "prototype": {
-        "!proto": "THREE.Line.prototype",
-        "object": {
-          "!type": "+THREE.Object3D",
-          "!doc": "The attached object"
-        },
-        "update": {
-          "!type": "fn()",
-          "!doc": "Updates the vertex tangent preview arrows based on the new position and tangents of the object."
-        }
-      },
-      "!doc": "Renders [page:ArrowHelper arrows] to visualize an object's vertex tangent vectors. Requires that tangents have been specified in a [page:BufferAttribute custom attribute] or have been computed using [page:Geometry.computeTangents computeTangents].",
-      "!type": "fn(object: +THREE.Object3D, size: number, color: +THREE.Color, linewidth: number)"
-    },
     "WireframeHelper": {
       "!url": "http://threejs.org/docs/#Reference/extras/helpers/WireframeHelper",
       "prototype": {
@@ -2504,10 +2464,6 @@
           "!type": "fn(json: object, texturePath: string) -> +THREE.Object3D",
           "!doc": "Parse a <em>JSON</em> structure and return an [page:Object] containing the parsed .[page:Geometry] and .[page:Array materials]."
         },
-        "needsTangents": {
-          "!type": "fn(materials: []) -> bool",
-          "!doc": "Checks if the loaded object needs tangents based on its materials."
-        },
         "updateProgress": {
           "!type": "fn(progress: object)",
           "!doc": "Updates the DOM object with the progress made."
@@ -2559,10 +2515,6 @@
           "!type": "string",
           "!doc": "The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS."
         },
-        "needsTangents": {
-          "!type": "fn(materials: []) -> bool",
-          "!doc": "Checks if the loaded object needs tangents based on its materials."
-        },
         "updateProgress": {
           "!type": "fn(progress: object)",
           "!doc": "Updates the DOM object with the progress made."

+ 0 - 1
examples/index.html

@@ -297,7 +297,6 @@
 				"webgl_materials_envmaps",
 				"webgl_materials_grass",
 				"webgl_materials_lightmap",
-				"webgl_materials_normaldisplacementmap",
 				"webgl_materials_normalmap",
 				"webgl_materials_parallaxmap",
 				"webgl_materials_shaders_fresnel",

+ 187 - 0
examples/js/BufferGeometryUtils.js

@@ -0,0 +1,187 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+THREE.BufferGeometryUtils = {
+
+	computeTangents: function ( geometry ) {
+
+		var index = geometry.index;
+		var attributes = geometry.attributes;
+
+		// based on http://www.terathon.com/code/tangent.html
+		// (per vertex tangents)
+
+		if ( index === null ||
+			 attributes.position === undefined ||
+			 attributes.normal === undefined ||
+			 attributes.uv === undefined ) {
+
+			console.warn( 'THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' );
+			return;
+
+		}
+
+		var indices = index.array;
+		var positions = attributes.position.array;
+		var normals = attributes.normal.array;
+		var uvs = attributes.uv.array;
+
+		var nVertices = positions.length / 3;
+
+		if ( attributes.tangent === undefined ) {
+
+			geometry.addAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
+
+		}
+
+		var tangents = attributes.tangent.array;
+
+		var tan1 = [], tan2 = [];
+
+		for ( var k = 0; k < nVertices; k ++ ) {
+
+			tan1[ k ] = new THREE.Vector3();
+			tan2[ k ] = new THREE.Vector3();
+
+		}
+
+		var vA = new THREE.Vector3(),
+			vB = new THREE.Vector3(),
+			vC = new THREE.Vector3(),
+
+			uvA = new THREE.Vector2(),
+			uvB = new THREE.Vector2(),
+			uvC = new THREE.Vector2(),
+
+			sdir = new THREE.Vector3(),
+			tdir = new THREE.Vector3();
+
+		function handleTriangle( a, b, c ) {
+
+			vA.fromArray( positions, a * 3 );
+			vB.fromArray( positions, b * 3 );
+			vC.fromArray( positions, c * 3 );
+
+			uvA.fromArray( uvs, a * 2 );
+			uvB.fromArray( uvs, b * 2 );
+			uvC.fromArray( uvs, c * 2 );
+
+			var x1 = vB.x - vA.x;
+			var x2 = vC.x - vA.x;
+
+			var y1 = vB.y - vA.y;
+			var y2 = vC.y - vA.y;
+
+			var z1 = vB.z - vA.z;
+			var z2 = vC.z - vA.z;
+
+			var s1 = uvB.x - uvA.x;
+			var s2 = uvC.x - uvA.x;
+
+			var t1 = uvB.y - uvA.y;
+			var t2 = uvC.y - uvA.y;
+
+			var r = 1.0 / ( s1 * t2 - s2 * t1 );
+
+			sdir.set(
+				( t2 * x1 - t1 * x2 ) * r,
+				( t2 * y1 - t1 * y2 ) * r,
+				( t2 * z1 - t1 * z2 ) * r
+			);
+
+			tdir.set(
+				( s1 * x2 - s2 * x1 ) * r,
+				( s1 * y2 - s2 * y1 ) * r,
+				( s1 * z2 - s2 * z1 ) * r
+			);
+
+			tan1[ a ].add( sdir );
+			tan1[ b ].add( sdir );
+			tan1[ c ].add( sdir );
+
+			tan2[ a ].add( tdir );
+			tan2[ b ].add( tdir );
+			tan2[ c ].add( tdir );
+
+		}
+
+		var groups = geometry.groups;
+
+		if ( groups.length === 0 ) {
+
+			groups = [ {
+				start: 0,
+				count: indices.length
+			} ];
+
+		}
+
+		for ( var j = 0, jl = groups.length; j < jl; ++ j ) {
+
+			var group = groups[ j ];
+
+			var start = group.start;
+			var count = group.count;
+
+			for ( var i = start, il = start + count; i < il; i += 3 ) {
+
+				handleTriangle(
+					indices[ i + 0 ],
+					indices[ i + 1 ],
+					indices[ i + 2 ]
+				);
+
+			}
+
+		}
+
+		var tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3();
+		var n = new THREE.Vector3(), n2 = new THREE.Vector3();
+		var w, t, test;
+
+		function handleVertex( v ) {
+
+			n.fromArray( normals, v * 3 );
+			n2.copy( n );
+
+			t = tan1[ v ];
+
+			// Gram-Schmidt orthogonalize
+
+			tmp.copy( t );
+			tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();
+
+			// Calculate handedness
+
+			tmp2.crossVectors( n2, t );
+			test = tmp2.dot( tan2[ v ] );
+			w = ( test < 0.0 ) ? - 1.0 : 1.0;
+
+			tangents[ v * 4 ] = tmp.x;
+			tangents[ v * 4 + 1 ] = tmp.y;
+			tangents[ v * 4 + 2 ] = tmp.z;
+			tangents[ v * 4 + 3 ] = w;
+
+		}
+
+		for ( var j = 0, jl = groups.length; j < jl; ++ j ) {
+
+			var group = groups[ j ];
+
+			var start = group.start;
+			var count = group.count;
+
+			for ( var i = start, il = start + count; i < il; i += 3 ) {
+
+				handleVertex( indices[ i + 0 ] );
+				handleVertex( indices[ i + 1 ] );
+				handleVertex( indices[ i + 2 ] );
+
+			}
+
+		}
+
+	}
+
+};

+ 22 - 23
examples/js/geometries/DecalGeometry.js

@@ -27,7 +27,7 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 	this.cube.updateMatrix();
 
 	this.iCubeMatrix = ( new THREE.Matrix4() ).getInverse( this.cube.matrix );
-	
+
 	this.faceIndices = [ 'a', 'b', 'c', 'd' ];
 
 	this.clipFace = function( inVertices, plane ) {
@@ -40,16 +40,16 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 				d1 = v1.vertex.dot( p ) - size;
 
 			var s = d0 / ( d0 - d1 );
-			var v = new THREE.DecalVertex( 
-				new THREE.Vector3( 
+			var v = new THREE.DecalVertex(
+				new THREE.Vector3(
 					v0.vertex.x + s * ( v1.vertex.x - v0.vertex.x ),
 					v0.vertex.y + s * ( v1.vertex.y - v0.vertex.y ),
-					v0.vertex.z + s * ( v1.vertex.z - v0.vertex.z ) 
+					v0.vertex.z + s * ( v1.vertex.z - v0.vertex.z )
 				),
 				new THREE.Vector3(
 					v0.normal.x + s * ( v1.normal.x - v0.normal.x ),
 					v0.normal.y + s * ( v1.normal.y - v0.normal.y ),
-					v0.normal.z + s * ( v1.normal.z - v0.normal.z ) 
+					v0.normal.z + s * ( v1.normal.z - v0.normal.z )
 				)
 			);
 
@@ -91,19 +91,19 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 					var nV1, nV2, nV3;
 					if ( v1Out ) {
 
-						nV1 = inVertices[ j + 1 ]; 
+						nV1 = inVertices[ j + 1 ];
 						nV2 = inVertices[ j + 2 ];
 						nV3 = clip( inVertices[ j ], nV1, plane );
 						nV4 = clip( inVertices[ j ], nV2, plane );
 
 					}
-					if ( v2Out ) { 
+					if ( v2Out ) {
 
-						nV1 = inVertices[ j ]; 
+						nV1 = inVertices[ j ];
 						nV2 = inVertices[ j + 2 ];
 						nV3 = clip( inVertices[ j + 1 ], nV1, plane );
 						nV4 = clip( inVertices[ j + 1 ], nV2, plane );
-						
+
 						outVertices.push( nV3 );
 						outVertices.push( nV2.clone() );
 						outVertices.push( nV1.clone() );
@@ -114,9 +114,9 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 						break;
 
 					}
-					if ( v3Out ) { 
+					if ( v3Out ) {
 
-						nV1 = inVertices[ j ]; 
+						nV1 = inVertices[ j ];
 						nV2 = inVertices[ j + 1 ];
 						nV3 = clip( inVertices[ j + 2 ], nV1, plane );
 						nV4 = clip( inVertices[ j + 2 ], nV2, plane );
@@ -137,17 +137,17 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 				case 2: {
 
 					var nV1, nV2, nV3;
-					if ( ! v1Out ) { 
+					if ( ! v1Out ) {
 
 						nV1 = inVertices[ j ].clone();
 						nV2 = clip( nV1, inVertices[ j + 1 ], plane );
-						nV3 = clip( nV1, inVertices[ j + 2 ], plane ); 
+						nV3 = clip( nV1, inVertices[ j + 2 ], plane );
 						outVertices.push( nV1 );
 						outVertices.push( nV2 );
 						outVertices.push( nV3 );
 
 					}
-					if ( ! v2Out ) { 
+					if ( ! v2Out ) {
 
 						nV1 = inVertices[ j + 1 ].clone();
 						nV2 = clip( nV1, inVertices[ j + 2 ], plane );
@@ -245,30 +245,30 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 		}
 
 		for ( var k = 0; k < finalVertices.length; k += 3 ) {
-			
+
 			this.vertices.push(
 				finalVertices[ k ].vertex,
 				finalVertices[ k + 1 ].vertex,
 				finalVertices[ k + 2 ].vertex
 			);
 
-			var f = new THREE.Face3( 
-				k, 
-				k + 1, 
+			var f = new THREE.Face3(
+				k,
+				k + 1,
 				k + 2
 			);
 			f.vertexNormals.push( finalVertices[ k + 0 ].normal );
 			f.vertexNormals.push( finalVertices[ k + 1 ].normal );
 			f.vertexNormals.push( finalVertices[ k + 2 ].normal );
-			
+
 			this.faces.push( f );
-			
+
 			this.faceVertexUvs[ 0 ].push( [
 				this.uvs[ k ],
-				this.uvs[ k + 1 ], 
+				this.uvs[ k + 1 ],
 				this.uvs[ k + 2 ]
 			] );
-		
+
 		}
 
 		this.verticesNeedUpdate = true;
@@ -277,7 +277,6 @@ THREE.DecalGeometry = function( mesh, position, rotation, dimensions, check ) {
 		this.uvsNeedUpdate = true;
 		this.normalsNeedUpdate = true;
 		this.colorsNeedUpdate = true;
-		this.tangentsNeedUpdate = true;
 		this.computeFaceNormals();
 
 	};

+ 0 - 2
examples/js/loaders/AssimpJSONLoader.js

@@ -212,10 +212,8 @@ THREE.AssimpJSONLoader.prototype = {
 
 		//geometry.computeFaceNormals();
 		//geometry.computeVertexNormals();
-		//geometry.computeTangents();
 		geometry.computeBoundingSphere();
 
-		// TODO: tangents
 		return geometry;
 
 	},

+ 0 - 2
examples/js/loaders/BinaryLoader.js

@@ -686,8 +686,6 @@ THREE.BinaryLoader.prototype = {
 		var geometry = new Model( texturePath );
 		var materials = THREE.Loader.prototype.initMaterials( jsonMaterials, texturePath, this.crossOrigin );
 
-		if ( THREE.Loader.prototype.needsTangents( materials ) ) geometry.computeTangents();
-
 		callback( geometry, materials );
 
 	}

+ 0 - 19
examples/js/loaders/deprecated/SceneLoader.js

@@ -218,10 +218,7 @@ THREE.SceneLoader.prototype = {
 
 						if ( geometry ) {
 
-							var needsTangents = false;
-
 							material = result.materials[ objJSON.material ];
-							needsTangents = material instanceof THREE.ShaderMaterial;
 
 							pos = objJSON.position;
 							rot = objJSON.rotation;
@@ -248,22 +245,6 @@ THREE.SceneLoader.prototype = {
 
 							}
 
-							if ( material instanceof THREE.MeshFaceMaterial ) {
-
-								for ( var i = 0; i < material.materials.length; i ++ ) {
-
-									needsTangents = needsTangents || ( material.materials[ i ] instanceof THREE.ShaderMaterial );
-
-								}
-
-							}
-
-							if ( needsTangents ) {
-
-								geometry.computeTangents();
-
-							}
-
 							if ( objJSON.skin ) {
 
 								object = new THREE.SkinnedMesh( geometry, material );

+ 0 - 515
examples/js/shaders/NormalDisplacementShader.js

@@ -1,515 +0,0 @@
-/*
- * @author alteredq / http://alteredqualia.com/
- *
- * Normal map shader
- *  - Blinn-Phong
- *  - normal + diffuse + specular + AO + displacement + reflection + shadow maps
- *  - point and directional lights (use with "lights: true" material option)
- */
-
-THREE.NormalDisplacementShader = {
-
-	uniforms: THREE.UniformsUtils.merge( [
-
-		THREE.UniformsLib[ "fog" ],
-		THREE.UniformsLib[ "lights" ],
-		THREE.UniformsLib[ "shadowmap" ],
-
-		{
-
-			"enableAO"          : { type: "i", value: 0 },
-			"enableDiffuse"     : { type: "i", value: 0 },
-			"enableSpecular"    : { type: "i", value: 0 },
-			"enableReflection"  : { type: "i", value: 0 },
-			"enableDisplacement": { type: "i", value: 0 },
-
-			"tDisplacement": { type: "t", value: null }, // must go first as this is vertex texture
-			"tDiffuse"     : { type: "t", value: null },
-			"tCube"        : { type: "t", value: null },
-			"tNormal"      : { type: "t", value: null },
-			"tSpecular"    : { type: "t", value: null },
-			"tAO"          : { type: "t", value: null },
-
-			"uNormalScale": { type: "v2", value: new THREE.Vector2( 1, 1 ) },
-
-			"uDisplacementBias": { type: "f", value: 0.0 },
-			"uDisplacementScale": { type: "f", value: 1.0 },
-
-			"diffuse": { type: "c", value: new THREE.Color( 0xffffff ) },
-			"specular": { type: "c", value: new THREE.Color( 0x111111 ) },
-			"shininess": { type: "f", value: 30 },
-			"opacity": { type: "f", value: 1 },
-
-			"refractionRatio": { type: "f", value: 0.98 },
-			"reflectivity": { type: "f", value: 0.5 },
-
-			"uOffset" : { type: "v2", value: new THREE.Vector2( 0, 0 ) },
-			"uRepeat" : { type: "v2", value: new THREE.Vector2( 1, 1 ) },
-
-		}
-
-	] ),
-
-	fragmentShader: [
-
-		"uniform vec3 diffuse;",
-		"uniform vec3 specular;",
-		"uniform float shininess;",
-		"uniform float opacity;",
-
-		"uniform bool enableDiffuse;",
-		"uniform bool enableSpecular;",
-		"uniform bool enableAO;",
-		"uniform bool enableReflection;",
-
-		"uniform sampler2D tDiffuse;",
-		"uniform sampler2D tNormal;",
-		"uniform sampler2D tSpecular;",
-		"uniform sampler2D tAO;",
-
-		"uniform samplerCube tCube;",
-
-		"uniform vec2 uNormalScale;",
-
-		"uniform float refractionRatio;",
-		"uniform float reflectivity;",
-
-		"varying vec3 vTangent;",
-		"varying vec3 vBinormal;",
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"uniform vec3 ambientLightColor;",
-
-		"#if MAX_DIR_LIGHTS > 0",
-
-		"	uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];",
-		"	uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];",
-
-		"#endif",
-
-		"#if MAX_HEMI_LIGHTS > 0",
-
-		"	uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];",
-		"	uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];",
-		"	uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];",
-
-		"#endif",
-
-		"#if MAX_POINT_LIGHTS > 0",
-
-		"	uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];",
-		"	uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];",
-		"	uniform float pointLightDistance[ MAX_POINT_LIGHTS ];",
-
-		"#endif",
-
-		"#if MAX_SPOT_LIGHTS > 0",
-
-		"	uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];",
-		"	uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];",
-		"	uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];",
-		"	uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];",
-		"	uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];",
-		"	uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];",
-
-		"#endif",
-
-		"varying vec3 vWorldPosition;",
-		"varying vec3 vViewPosition;",
-
-		THREE.ShaderChunk[ "common" ],
-		THREE.ShaderChunk[ "shadowmap_pars_fragment" ],
-		THREE.ShaderChunk[ "fog_pars_fragment" ],
-		THREE.ShaderChunk[ "logdepthbuf_pars_fragment" ],
-
-		"void main() {",
-
-			THREE.ShaderChunk[ "logdepthbuf_fragment" ],
-
-		"	vec3 outgoingLight = vec3( 0.0 );",
-
-		"	vec4 diffuseColor = vec4( diffuse, opacity );",
-
-		"	vec3 specularTex = vec3( 1.0 );",
-
-		"	vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;",
-		"	normalTex.xy *= uNormalScale;",
-		"	normalTex = normalize( normalTex );",
-
-		"	if( enableDiffuse ) {",
-
-		"		#ifdef GAMMA_INPUT",
-
-		"			vec4 texelColor = texture2D( tDiffuse, vUv );",
-		"			texelColor.xyz *= texelColor.xyz;",
-
-		"			diffuseColor *= texelColor;",
-
-		"		#else",
-
-		"			diffuseColor *= texture2D( tDiffuse, vUv );",
-
-		"		#endif",
-
-		"	}",
-
-		"	if( enableAO ) {",
-
-		"		diffuseColor.rgb *= texture2D( tAO, vUv ).xyz;", // actually, the AOmap should be modulating ambient light sources only,
-																 // and should use the second set of UVs, as is done elsewhere in the library
-		"	}",
-
-			THREE.ShaderChunk[ "alphatest_fragment" ],
-
-		"	if( enableSpecular )",
-		"		specularTex = texture2D( tSpecular, vUv ).xyz;",
-
-		"	mat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );",
-		"	vec3 finalNormal = tsb * normalTex;",
-
-		"	#ifdef FLIP_SIDED",
-
-		"		finalNormal = - finalNormal;",
-
-		"	#endif",
-
-		"	vec3 normal = normalize( finalNormal );",
-		"	vec3 viewPosition = normalize( vViewPosition );",
-
-		"	vec3 totalDiffuseLight = vec3( 0.0 );",
-		"	vec3 totalSpecularLight = vec3( 0.0 );",
-
-			// point lights
-
-		"	#if MAX_POINT_LIGHTS > 0",
-
-		"		for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
-
-		"			vec3 pointVector = pointLightPosition[ i ] + vViewPosition.xyz;",
-
-		"			float pointDistance = 1.0;",
-		"			if ( pointLightDistance[ i ] > 0.0 )",
-		"				pointDistance = 1.0 - min( ( length( pointVector ) / pointLightDistance[ i ] ), 1.0 );",
-
-		"			pointVector = normalize( pointVector );",
-
-					// diffuse
-
-		"			float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );",
-
-		"			totalDiffuseLight += pointDistance * pointLightColor[ i ] * pointDiffuseWeight;",
-
-					// specular
-
-		"			vec3 pointHalfVector = normalize( pointVector + viewPosition );",
-		"			float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
-		"			float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
-
-		"			float specularNormalization = ( shininess + 2.0 ) / 8.0;",
-
-		"			vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( pointVector, pointHalfVector ), 0.0 ), 5.0 );",
-		"			totalSpecularLight += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;",
-
-		"		}",
-
-		"	#endif",
-
-			// spot lights
-
-		"	#if MAX_SPOT_LIGHTS > 0",
-
-		"		for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {",
-
-		"			vec3 spotVector = spotLightPosition[ i ] + vViewPosition.xyz;",
-
-		"			float spotDistance = 1.0;",
-		"			if ( spotLightDistance[ i ] > 0.0 )",
-		"				spotDistance = 1.0 - min( ( length( spotVector ) / spotLightDistance[ i ] ), 1.0 );",
-
-		"			spotVector = normalize( spotVector );",
-
-		"			float spotEffect = dot( spotLightDirection[ i ], spotVector );",
-
-		"			if ( spotEffect > spotLightAngleCos[ i ] ) {",
-
-		"				spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );",
-
-						// diffuse
-
-
-		"				float spotDiffuseWeight = max( dot( normal, spotVector ), 0.0 );",
-
-		"				totalDiffuseLight += spotDistance * spotLightColor[ i ] * spotDiffuseWeight * spotEffect;",
-
-						// specular
-
-		"				vec3 spotHalfVector = normalize( spotVector + viewPosition );",
-		"				float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );",
-		"				float spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, shininess ), 0.0 );",
-
-		"				float specularNormalization = ( shininess + 2.0 ) / 8.0;",
-
-		"				vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( spotVector, spotHalfVector ), 0.0 ), 5.0 );",
-		"				totalSpecularLight += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;",
-
-		"			}",
-
-		"		}",
-
-		"	#endif",
-
-			// directional lights
-
-		"	#if MAX_DIR_LIGHTS > 0",
-
-		"		for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {",
-
-		"			vec3 dirVector = directionalLightDirection[ i ];",
-
-					// diffuse
-
-		"			float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );",
-
-		"			totalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;",
-
-					// specular
-
-		"			vec3 dirHalfVector = normalize( dirVector + viewPosition );",
-		"			float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
-		"			float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
-
-		"			float specularNormalization = ( shininess + 2.0 ) / 8.0;",
-
-		"			vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );",
-		"			totalSpecularLight += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;",
-
-		"		}",
-
-		"	#endif",
-
-			// hemisphere lights
-
-		"	#if MAX_HEMI_LIGHTS > 0",
-
-		"		for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
-
-		"			vec3 lVector = hemisphereLightDirection[ i ];",
-
-					// diffuse
-
-		"			float dotProduct = dot( normal, lVector );",
-		"			float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
-
-		"			vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );",
-
-		"			totalDiffuseLight += hemiColor;",
-
-					// specular (sky light)
-
-		"			vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );",
-		"			float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
-		"			float hemiSpecularWeightSky = specularTex.r * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );",
-
-					//
-
-		"			float specularNormalization = ( shininess + 2.0 ) / 8.0;",
-
-		"			vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );",
-		"			totalSpecularLight += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) );",
-
-		"		}",
-
-		"	#endif",
-
-		"	#ifdef METAL",
-
-		"		outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
-
-		"	#else",
-
-		"		outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor ) + totalSpecularLight;",
-
-		"	#endif",
-
-		"	if ( enableReflection ) {",
-
-		"		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );",
-
-		"		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );",
-
-		"		#ifdef ENVMAP_MODE_REFLECTION",
-
-		"			vec3 vReflect = reflect( cameraToVertex, worldNormal );",
-
-		"		#else",
-
-		"			vec3 vReflect = refract( cameraToVertex, worldNormal, refractionRatio );",
-
-		"		#endif",
-
-		"		vec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );",
-
-		"		#ifdef GAMMA_INPUT",
-
-		"			cubeColor.xyz *= cubeColor.xyz;",
-
-		"		#endif",
-
-		"		outgoingLight = mix( outgoingLight, cubeColor.xyz, specularTex.r * reflectivity );",
-
-		"	}",
-
-			THREE.ShaderChunk[ "shadowmap_fragment" ],
-			THREE.ShaderChunk[ "linear_to_gamma_fragment" ],
-			THREE.ShaderChunk[ "fog_fragment" ],
-
-		"	gl_FragColor = vec4( outgoingLight, diffuseColor.a );",
-
-		"}"
-
-	].join( "\n" ),
-
-	vertexShader: [
-
-		"attribute vec4 tangent;",
-
-		"uniform vec2 uOffset;",
-		"uniform vec2 uRepeat;",
-
-		"uniform bool enableDisplacement;",
-
-		"#ifdef VERTEX_TEXTURES",
-
-		"	uniform sampler2D tDisplacement;",
-		"	uniform float uDisplacementScale;",
-		"	uniform float uDisplacementBias;",
-
-		"#endif",
-
-		"varying vec3 vTangent;",
-		"varying vec3 vBinormal;",
-		"varying vec3 vNormal;",
-		"varying vec2 vUv;",
-
-		"varying vec3 vWorldPosition;",
-		"varying vec3 vViewPosition;",
-
-		THREE.ShaderChunk[ "skinning_pars_vertex" ],
-		THREE.ShaderChunk[ "shadowmap_pars_vertex" ],
-		THREE.ShaderChunk[ "logdepthbuf_pars_vertex" ],
-
-		"void main() {",
-
-			THREE.ShaderChunk[ "skinbase_vertex" ],
-			THREE.ShaderChunk[ "skinnormal_vertex" ],
-
-			// normal, tangent and binormal vectors
-
-		"	#ifdef USE_SKINNING",
-
-		"		vNormal = normalize( normalMatrix * skinnedNormal.xyz );",
-
-		"		vec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );",
-		"		vTangent = normalize( normalMatrix * skinnedTangent.xyz );",
-
-		"	#else",
-
-		"		vNormal = normalize( normalMatrix * normal );",
-		"		vTangent = normalize( normalMatrix * tangent.xyz );",
-
-		"	#endif",
-
-		"	vBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );",
-
-		"	vUv = uv * uRepeat + uOffset;",
-
-			// displacement mapping
-
-		"	vec3 displacedPosition;",
-
-		"	#ifdef VERTEX_TEXTURES",
-
-		"		if ( enableDisplacement ) {",
-
-		"			vec3 dv = texture2D( tDisplacement, uv ).xyz;",
-		"			float df = uDisplacementScale * dv.x + uDisplacementBias;",
-		"			displacedPosition = position + normalize( normal ) * df;",
-
-		"		} else {",
-
-		"			#ifdef USE_SKINNING",
-
-		"				vec4 skinVertex = bindMatrix * vec4( position, 1.0 );",
-
-		"				vec4 skinned = vec4( 0.0 );",
-		"				skinned += boneMatX * skinVertex * skinWeight.x;",
-		"				skinned += boneMatY * skinVertex * skinWeight.y;",
-		"				skinned += boneMatZ * skinVertex * skinWeight.z;",
-		"				skinned += boneMatW * skinVertex * skinWeight.w;",
-		"				skinned  = bindMatrixInverse * skinned;",
-
-		"				displacedPosition = skinned.xyz;",
-
-		"			#else",
-
-		"				displacedPosition = position;",
-
-		"			#endif",
-
-		"		}",
-
-		"	#else",
-
-		"		#ifdef USE_SKINNING",
-
-		"			vec4 skinVertex = bindMatrix * vec4( position, 1.0 );",
-
-		"			vec4 skinned = vec4( 0.0 );",
-		"			skinned += boneMatX * skinVertex * skinWeight.x;",
-		"			skinned += boneMatY * skinVertex * skinWeight.y;",
-		"			skinned += boneMatZ * skinVertex * skinWeight.z;",
-		"			skinned += boneMatW * skinVertex * skinWeight.w;",
-		"			skinned  = bindMatrixInverse * skinned;",
-
-		"			displacedPosition = skinned.xyz;",
-
-		"		#else",
-
-		"			displacedPosition = position;",
-
-		"		#endif",
-
-		"	#endif",
-
-			//
-
-		"	vec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );",
-		"	vec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );",
-
-		"	gl_Position = projectionMatrix * mvPosition;",
-
-			THREE.ShaderChunk[ "logdepthbuf_vertex" ],
-
-			//
-
-		"	vWorldPosition = worldPosition.xyz;",
-		"	vViewPosition = - mvPosition.xyz;",
-
-			// shadows
-
-		"	#ifdef USE_SHADOWMAP",
-
-		"		for( int i = 0; i < MAX_SHADOWS; i ++ ) {",
-
-		"			vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;",
-
-		"		}",
-
-		"	#endif",
-
-		"}"
-
-	].join( "\n" )
-
-};

+ 0 - 7
examples/obj/ninja/.htaccess

@@ -1,7 +0,0 @@
-<Files *.js>
-SetOutputFilter DEFLATE
-</Files>
-
-<Files *.bin>
-SetOutputFilter DEFLATE
-</Files>

+ 0 - 325
examples/webgl_materials_normaldisplacementmap.html

@@ -1,325 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - materials - normal map</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<style>
-			body {
-				background:#000;
-				color:#fff;
-				padding:0;
-				margin:0;
-				font-weight: bold;
-				overflow:hidden;
-			}
-
-			a {	color: #ffffff;	}
-
-			#info {
-				position: absolute;
-				top: 0px; width: 100%;
-				color: #ffffff;
-				padding: 5px;
-				font-family:Monospace;
-				font-size:13px;
-				text-align:center;
-				z-index:1000;
-			}
-
-			#oldie {
-				background:rgb(200,100,0) !important;
-				color:#fff;
-			}
-
-			#vt { display:none }
-			#vt, #vt a { color:orange; }
-		</style>
-	</head>
-
-	<body>
-
-		<div id="info">
-			<a href="http://threejs.org" target="_blank">three.js</a> - webgl (<span id="description">normal + ao + displacement + environment + shadow</span>) map demo.
-			ninja head from <a href="http://developer.amd.com/archive/gpu/MeshMapper/pages/default.aspx" target="_blank">AMD GPU MeshMapper</a>
-
-			<div id="vt">displacement mapping needs vertex textures (GPU with Shader Model 3.0)</div>
-		</div>
-
-		<script src="../build/three.min.js"></script>
-
-		<script src="js/loaders/BinaryLoader.js"></script>
-		<script src="js/shaders/NormalDisplacementShader.js"></script>
-
-		<script src="js/Detector.js"></script>
-		<script src="js/libs/stats.min.js"></script>
-
-		<script>
-
-			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
-
-			var stats, loader;
-
-			var camera, scene, renderer;
-
-			var mesh1, mesh2;
-
-			var pointLight;
-
-			var mouseX = 0;
-			var mouseY = 0;
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-
-			var r = 0.0;
-
-			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
-
-			init();
-			animate();
-
-			function init() {
-
-				var container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				scene = new THREE.Scene();
-
-				var width = 500;
-				var aspect = window.innerWidth / window.innerHeight;
-				camera = new THREE.OrthographicCamera( - width * aspect, width * aspect, width, - width, 1, 10000 );
-				camera.position.z = 1500;
-
-				// LIGHTS
-
-				var ambientLight = new THREE.AmbientLight( 0x111111 );
-				scene.add( ambientLight );
-
-				pointLight = new THREE.PointLight( 0xff0000 );
-				pointLight.position.z = 10000;
-				pointLight.distance = 4000;
-				scene.add( pointLight );
-
-				var pointLight2 = new THREE.PointLight( 0xff5500 );
-				pointLight2.position.z = 1000;
-				scene.add( pointLight2 );
-
-				var pointLight3 = new THREE.PointLight( 0x0000ff );
-				pointLight3.position.x = -1000;
-				pointLight3.position.z = 1000;
-				scene.add( pointLight3 );
-
-				var spotLight = new THREE.SpotLight( 0xaaaaaa );
-				spotLight.position.set( 1000, 500, 1000 );
-				spotLight.castShadow = true;
-				spotLight.shadowCameraNear = 500;
-				spotLight.shadowCameraFov = 70;
-				spotLight.shadowBias = - 0.001;
-				spotLight.shadowMapWidth = 1024;
-				spotLight.shadowMapHeight = 1024;
-				spotLight.shadowDarkness = 0.5;
-				scene.add( spotLight );
-
-				// env map
-
-				var path = "textures/cube/SwedishRoyalCastle/";
-				var format = '.jpg';
-				var urls = [
-						path + 'px' + format, path + 'nx' + format,
-						path + 'py' + format, path + 'ny' + format,
-						path + 'pz' + format, path + 'nz' + format
-					];
-
-				var reflectionCube = THREE.ImageUtils.loadTextureCube( urls, THREE.CubeReflectionMapping );
-
-				// common material parameters
-
-				var diffuse = 0x0a0100, specular = 0xffffff, shininess = 10, scale = 23;
-
-				// normal map shader
-
-				var shader = THREE.NormalDisplacementShader;
-				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
-
-				uniforms[ "enableAO" ].value = true;
-				uniforms[ "enableDiffuse" ].value = false;
-				uniforms[ "enableSpecular" ].value = false;
-				uniforms[ "enableReflection" ].value = true;
-				uniforms[ "enableDisplacement" ].value = true;
-
-				uniforms[ "tNormal" ].value = THREE.ImageUtils.loadTexture( "textures/normal/ninja/normal.jpg" );
-				uniforms[ "tAO" ].value = THREE.ImageUtils.loadTexture( "textures/normal/ninja/ao.jpg" );
-
-				uniforms[ "tDisplacement" ].value = THREE.ImageUtils.loadTexture( "textures/normal/ninja/displacement.jpg" );
-				uniforms[ "uDisplacementBias" ].value = - 0.428408;
-				uniforms[ "uDisplacementScale" ].value = 2.436143;
-
-				uniforms[ "uNormalScale" ].value.y = - 1;
-
-				uniforms[ "diffuse" ].value.setHex( diffuse );
-				uniforms[ "specular" ].value.setHex( specular );
-
-				uniforms[ "shininess" ].value = shininess;
-
-				uniforms[ "tCube" ].value = reflectionCube;
-				uniforms[ "reflectivity" ].value = 0.2;
-
-				var defines = {};
-				defines[ "ENVMAP_MODE_REFLECTION" ] = "";
-
-				var parameters = {
-					defines: defines,
-					uniforms: uniforms,
-					vertexShader: shader.vertexShader,
-					fragmentShader: shader.fragmentShader,
-					lights: true,
-					fog: false
-				};
-
-				var material1 = new THREE.ShaderMaterial( parameters );
-
-				var material2 = new THREE.MeshPhongMaterial( {
-					color: diffuse,
-					specular: specular,
-					shininess: shininess,
-					normalMap: uniforms[ "tNormal" ].value,
-					normalScale: uniforms[ "uNormalScale" ].value,
-					aoMap: uniforms[ "tAO" ].value,
-					aoMapIntensity: 1,
-					envMap: reflectionCube,
-					combine: THREE.MixOperation,
-					reflectivity: 0.2
-				} );
-
-				//
-
-				loader = new THREE.BinaryLoader();
-				loader.load( "obj/ninja/NinjaLo_bin.js", function( geometry ) { createScene( geometry, scale, material1, material2 ) } );
-
-				//
-
-				renderer = new THREE.WebGLRenderer();
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
-
-				//
-
-				renderer.gammaInput = true;
-				renderer.gammaOutput = true;
-
-				//
-
-				renderer.shadowMap.enabled = true;
-				renderer.shadowMap.type = THREE.PCFShadowMap;
-
-				//
-
-				var description = "normal + ao" + ( renderer.supportsVertexTextures() ? " + displacement + environment + shadow" : " + <strike>displacement</strike>" );
-				document.getElementById( "description" ).innerHTML = description;
-				document.getElementById( "vt" ).style.display = renderer.supportsVertexTextures() ? "none" : "block";
-
-				//
-
-				stats = new Stats();
-				stats.domElement.style.position = 'absolute';
-				stats.domElement.style.top = '0px';
-				stats.domElement.style.zIndex = 100;
-				container.appendChild( stats.domElement );
-
-				//
-
-				window.addEventListener( 'resize', onWindowResize, false );
-
-			}
-
-			function onWindowResize() {
-
-				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
-
-				camera.left = window.innerWidth / - 2;
-				camera.right = window.innerWidth / 2;
-				camera.top = window.innerHeight / 2;
-				camera.bottom = window.innerHeight / - 2;
-
-				camera.updateProjectionMatrix();
-
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-			}
-
-			function createScene( geometry, scale, material1, material2 ) {
-
-				geometry.computeTangents(); // attribute tangents are required for NormalDisplacementShader
-
-				geometry.faceVertexUvs[ 1 ] = geometry.faceVertexUvs[ 0 ]; // 2nd set of UVs required for aoMap with MeshPhongMaterial
-
-				mesh1 = new THREE.Mesh( geometry, material1 );
-				mesh1.position.x = - scale * 12;
-				mesh1.scale.set( scale, scale, scale );
-				mesh1.castShadow = true;
-				mesh1.receiveShadow = true;
-				scene.add( mesh1 );
-
-				mesh2 = new THREE.Mesh( geometry, material2 );
-				mesh2.position.x = scale * 12;
-				mesh2.scale.set( scale, scale, scale );
-				mesh2.castShadow = true;
-				mesh2.receiveShadow = true;
-				scene.add( mesh2 );
-
-			}
-
-			function onDocumentMouseMove(event) {
-
-				mouseX = ( event.clientX - windowHalfX ) * 10;
-				mouseY = ( event.clientY - windowHalfY ) * 10;
-
-			}
-
-			//
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				render();
-
-				stats.update();
-
-			}
-
-			function render() {
-
-				var ry = mouseX * 0.0003, rx = mouseY * 0.0003;
-
-				if( mesh1 ) {
-
-					mesh1.rotation.y = ry;
-					mesh1.rotation.x = rx;
-
-				}
-
-				if( mesh2 ) {
-
-					mesh2.rotation.y = ry;
-					mesh2.rotation.x = rx;
-
-				}
-
-				pointLight.position.x = 2500 * Math.cos( r );
-				pointLight.position.z = 2500 * Math.sin( r );
-
-				r += 0.01;
-
-				renderer.render( scene, camera );
-
-			}
-
-
-		</script>
-
-	</body>
-</html>

+ 3 - 1
examples/webgl_terrain_dynamic.html

@@ -73,6 +73,7 @@
 		<script src="js/postprocessing/MaskPass.js"></script>
 		<script src="js/postprocessing/SavePass.js"></script>
 
+		<script src="js/BufferGeometryUtils.js"></script>
 		<script src="js/ShaderTerrain.js"></script>
 
 		<script src="js/Detector.js"></script>
@@ -415,7 +416,8 @@
 				// TERRAIN MESH
 
 				var geometryTerrain = new THREE.PlaneBufferGeometry( 6000, 6000, 256, 256 );
-				geometryTerrain.computeTangents();
+
+				THREE.BufferGeometryUtils.computeTangents( geometryTerrain );
 
 				terrain = new THREE.Mesh( geometryTerrain, mlib[ "terrain" ] );
 				terrain.position.set( 0, -125, 0 );

+ 1 - 199
src/core/BufferGeometry.js

@@ -353,14 +353,12 @@ THREE.BufferGeometry.prototype = {
 			direct.normalsNeedUpdate = geometry.normalsNeedUpdate;
 			direct.colorsNeedUpdate = geometry.colorsNeedUpdate;
 			direct.uvsNeedUpdate = geometry.uvsNeedUpdate;
-			direct.tangentsNeedUpdate = geometry.tangentsNeedUpdate;
 			direct.groupsNeedUpdate = geometry.groupsNeedUpdate;
 
 			geometry.verticesNeedUpdate = false;
 			geometry.normalsNeedUpdate = false;
 			geometry.colorsNeedUpdate = false;
 			geometry.uvsNeedUpdate = false;
-			geometry.tangentsNeedUpdate = false;
 			geometry.groupsNeedUpdate = false;
 
 			geometry = direct;
@@ -412,21 +410,6 @@ THREE.BufferGeometry.prototype = {
 
 		}
 
-		if ( geometry.tangentsNeedUpdate === true ) {
-
-			var attribute = this.attributes.tangent;
-
-			if ( attribute !== undefined ) {
-
-				attribute.copyVector4sArray( geometry.tangents );
-				attribute.needsUpdate = true;
-
-			}
-
-			geometry.tangentsNeedUpdate = false;
-
-		}
-
 		if ( geometry.lineDistancesNeedUpdate ) {
 
 			var attribute = this.attributes.lineDistance;
@@ -496,13 +479,6 @@ THREE.BufferGeometry.prototype = {
 
 		}
 
-		if ( geometry.tangents.length > 0 ) {
-
-			var tangents = new Float32Array( geometry.tangents.length * 4 );
-			this.addAttribute( 'tangent', new THREE.BufferAttribute( tangents, 4 ).copyVector4sArray( geometry.tangents ) );
-
-		}
-
 		if ( geometry.indices.length > 0 ) {
 
 			var TypeArray = geometry.vertices.length > 65535 ? Uint32Array : Uint16Array;
@@ -805,181 +781,7 @@ THREE.BufferGeometry.prototype = {
 
 	computeTangents: function () {
 
-		var index = this.index;
-		var attributes = this.attributes;
-
-		// based on http://www.terathon.com/code/tangent.html
-		// (per vertex tangents)
-
-		if ( index === undefined ||
-			 attributes.position === undefined ||
-			 attributes.normal === undefined ||
-			 attributes.uv === undefined ) {
-
-			console.warn( 'THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()' );
-			return;
-
-		}
-
-		var indices = index.array;
-		var positions = attributes.position.array;
-		var normals = attributes.normal.array;
-		var uvs = attributes.uv.array;
-
-		var nVertices = positions.length / 3;
-
-		if ( attributes.tangent === undefined ) {
-
-			this.addAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
-
-		}
-
-		var tangents = attributes.tangent.array;
-
-		var tan1 = [], tan2 = [];
-
-		for ( var k = 0; k < nVertices; k ++ ) {
-
-			tan1[ k ] = new THREE.Vector3();
-			tan2[ k ] = new THREE.Vector3();
-
-		}
-
-		var vA = new THREE.Vector3(),
-			vB = new THREE.Vector3(),
-			vC = new THREE.Vector3(),
-
-			uvA = new THREE.Vector2(),
-			uvB = new THREE.Vector2(),
-			uvC = new THREE.Vector2(),
-
-			sdir = new THREE.Vector3(),
-			tdir = new THREE.Vector3();
-
-		function handleTriangle( a, b, c ) {
-
-			vA.fromArray( positions, a * 3 );
-			vB.fromArray( positions, b * 3 );
-			vC.fromArray( positions, c * 3 );
-
-			uvA.fromArray( uvs, a * 2 );
-			uvB.fromArray( uvs, b * 2 );
-			uvC.fromArray( uvs, c * 2 );
-
-			var x1 = vB.x - vA.x;
-			var x2 = vC.x - vA.x;
-
-			var y1 = vB.y - vA.y;
-			var y2 = vC.y - vA.y;
-
-			var z1 = vB.z - vA.z;
-			var z2 = vC.z - vA.z;
-
-			var s1 = uvB.x - uvA.x;
-			var s2 = uvC.x - uvA.x;
-
-			var t1 = uvB.y - uvA.y;
-			var t2 = uvC.y - uvA.y;
-
-			var r = 1.0 / ( s1 * t2 - s2 * t1 );
-
-			sdir.set(
-				( t2 * x1 - t1 * x2 ) * r,
-				( t2 * y1 - t1 * y2 ) * r,
-				( t2 * z1 - t1 * z2 ) * r
-			);
-
-			tdir.set(
-				( s1 * x2 - s2 * x1 ) * r,
-				( s1 * y2 - s2 * y1 ) * r,
-				( s1 * z2 - s2 * z1 ) * r
-			);
-
-			tan1[ a ].add( sdir );
-			tan1[ b ].add( sdir );
-			tan1[ c ].add( sdir );
-
-			tan2[ a ].add( tdir );
-			tan2[ b ].add( tdir );
-			tan2[ c ].add( tdir );
-
-		}
-
-		var groups = this.groups;
-
-		if ( groups.length === 0 ) {
-
-			groups = [ {
-				start: 0,
-				count: indices.length
-			} ];
-
-		}
-
-		for ( var j = 0, jl = groups.length; j < jl; ++ j ) {
-
-			var group = groups[ j ];
-
-			var start = group.start;
-			var count = group.count;
-
-			for ( var i = start, il = start + count; i < il; i += 3 ) {
-
-				handleTriangle(
-					indices[ i + 0 ],
-					indices[ i + 1 ],
-					indices[ i + 2 ]
-				);
-
-			}
-
-		}
-
-		var tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3();
-		var n = new THREE.Vector3(), n2 = new THREE.Vector3();
-		var w, t, test;
-
-		function handleVertex( v ) {
-
-			n.fromArray( normals, v * 3 );
-			n2.copy( n );
-
-			t = tan1[ v ];
-
-			// Gram-Schmidt orthogonalize
-
-			tmp.copy( t );
-			tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();
-
-			// Calculate handedness
-
-			tmp2.crossVectors( n2, t );
-			test = tmp2.dot( tan2[ v ] );
-			w = ( test < 0.0 ) ? - 1.0 : 1.0;
-
-			tangents[ v * 4 ] = tmp.x;
-			tangents[ v * 4 + 1 ] = tmp.y;
-			tangents[ v * 4 + 2 ] = tmp.z;
-			tangents[ v * 4 + 3 ] = w;
-
-		}
-
-		for ( var j = 0, jl = groups.length; j < jl; ++ j ) {
-
-			var group = groups[ j ];
-
-			var start = group.start;
-			var count = group.count;
-
-			for ( var i = start, il = start + count; i < il; i += 3 ) {
-
-				handleVertex( indices[ i + 0 ] );
-				handleVertex( indices[ i + 1 ] );
-				handleVertex( indices[ i + 2 ] );
-
-			}
-
-		}
+		console.warn( 'THREE.BufferGeometry: .computeTangents() has been removed.' );
 
 	},
 

+ 0 - 34
src/core/DirectGeometry.js

@@ -17,7 +17,6 @@ THREE.DirectGeometry = function () {
 	this.colors = [];
 	this.uvs = [];
 	this.uvs2 = [];
-	this.tangents = [];
 
 	this.groups = [];
 
@@ -37,7 +36,6 @@ THREE.DirectGeometry = function () {
 	this.normalsNeedUpdate = false;
 	this.colorsNeedUpdate = false;
 	this.uvsNeedUpdate = false;
-	this.tangentsNeedUpdate = false;
 	this.groupsNeedUpdate = false;
 
 };
@@ -52,21 +50,12 @@ THREE.DirectGeometry.prototype = {
 	computeFaceNormals: function () {
 
 		console.warn( 'THREE.DirectGeometry: computeFaceNormals() is not a method of this type of geometry.' );
-		return this;
 
 	},
 
 	computeVertexNormals: function () {
 
 		console.warn( 'THREE.DirectGeometry: computeVertexNormals() is not a method of this type of geometry.' );
-		return this;
-
-	},
-
-	computeTangents: function () {
-
-		console.warn( 'THREE.DirectGeometry: computeTangents() is not a method of this type of geometry.' );
-		return this;
 
 	},
 
@@ -124,8 +113,6 @@ THREE.DirectGeometry.prototype = {
 		var hasFaceVertexUv = faceVertexUvs[ 0 ] && faceVertexUvs[ 0 ].length > 0;
 		var hasFaceVertexUv2 = faceVertexUvs[ 1 ] && faceVertexUvs[ 1 ].length > 0;
 
-		var hasTangents = geometry.hasTangents;
-
 		// morphs
 
 		var morphTargets = geometry.morphTargets;
@@ -242,26 +229,6 @@ THREE.DirectGeometry.prototype = {
 
 			}
 
-			// tangents
-
-			if ( hasTangents === true ) {
-
-				var vertexTangents = face.vertexTangents;
-
-				if ( vertexTangents.length === 3 ) {
-
-					this.tangents.push( vertexTangents[ 0 ], vertexTangents[ 1 ], vertexTangents[ 2 ] );
-
-				} else {
-
-					console.warn( 'THREE.DirectGeometry.fromGeometry(): Undefined tangents ', i );
-
-					this.tangents.push( new THREE.Vector4(), new THREE.Vector4(), new THREE.Vector4() );
-
-				}
-
-			}
-
 			// morphs
 
 			for ( var j = 0; j < morphTargetsLength; j ++ ) {
@@ -302,7 +269,6 @@ THREE.DirectGeometry.prototype = {
 		this.normalsNeedUpdate = geometry.normalsNeedUpdate;
 		this.colorsNeedUpdate = geometry.colorsNeedUpdate;
 		this.uvsNeedUpdate = geometry.uvsNeedUpdate;
-		this.tangentsNeedUpdate = geometry.tangentsNeedUpdate;
 		this.groupsNeedUpdate = geometry.groupsNeedUpdate;
 
 		return this;

+ 0 - 8
src/core/Face3.js

@@ -15,8 +15,6 @@ THREE.Face3 = function ( a, b, c, normal, color, materialIndex ) {
 	this.color = color instanceof THREE.Color ? color : new THREE.Color();
 	this.vertexColors = Array.isArray( color ) ? color : [];
 
-	this.vertexTangents = [];
-
 	this.materialIndex = materialIndex !== undefined ? materialIndex : 0;
 
 };
@@ -54,12 +52,6 @@ THREE.Face3.prototype = {
 
 		}
 
-		for ( var i = 0, il = source.vertexTangents.length; i < il; i ++ ) {
-
-			this.vertexTangents[ i ] = source.vertexTangents[ i ].clone();
-
-		}
-
 		return this;
 
 	}

+ 1 - 118
src/core/Geometry.js

@@ -33,15 +33,12 @@ THREE.Geometry = function () {
 	this.boundingBox = null;
 	this.boundingSphere = null;
 
-	this.hasTangents = false;
-
 	// update flags
 
 	this.verticesNeedUpdate = false;
 	this.elementsNeedUpdate = false;
 	this.uvsNeedUpdate = false;
 	this.normalsNeedUpdate = false;
-	this.tangentsNeedUpdate = false;
 	this.colorsNeedUpdate = false;
 	this.lineDistancesNeedUpdate = false;
 	this.groupsNeedUpdate = false;
@@ -223,15 +220,12 @@ THREE.Geometry.prototype = {
 		var colors = attributes.color !== undefined ? attributes.color.array : undefined;
 		var uvs = attributes.uv !== undefined ? attributes.uv.array : undefined;
 		var uvs2 = attributes.uv2 !== undefined ? attributes.uv2.array : undefined;
-		var tangents = attributes.tangent !== undefined ? attributes.tangent.array : undefined;
 
 		if ( uvs2 !== undefined ) this.faceVertexUvs[ 1 ] = [];
-		if ( tangents !== undefined ) this.hasTangents = true;
 
 		var tempNormals = [];
 		var tempUVs = [];
 		var tempUVs2 = [];
-		var tempTangents = [];
 
 		for ( var i = 0, j = 0, k = 0; i < vertices.length; i += 3, j += 2, k += 4 ) {
 
@@ -261,12 +255,6 @@ THREE.Geometry.prototype = {
 
 			}
 
-			if ( tangents !== undefined ) {
-
-				tempTangents.push( new THREE.Vector4( tangents[ k ], tangents[ k + 1 ], tangents[ k + 2 ], tangents[ k + 3 ] ) );
-
-			}
-
 		}
 
 		var addFace = function ( a, b, c ) {
@@ -290,12 +278,6 @@ THREE.Geometry.prototype = {
 
 			}
 
-			if ( tangents !== undefined ) {
-
-				face.vertexTangents.push( tempTangents[ a ].clone(), tempTangents[ b ].clone(), tempTangents[ c ].clone() );
-
-			}
-
 		};
 
 		if ( indices !== undefined ) {
@@ -617,106 +599,7 @@ THREE.Geometry.prototype = {
 
 	computeTangents: function () {
 
-		// based on http://www.terathon.com/code/tangent.html
-		// tangents go to vertices
-
-		var f, fl, v, vl, i, vertexIndex,
-			face, uv, vA, vB, vC, uvA, uvB, uvC,
-			x1, x2, y1, y2, z1, z2,
-			s1, s2, t1, t2, r, t, test,
-			tan1 = [], tan2 = [],
-			sdir = new THREE.Vector3(), tdir = new THREE.Vector3(),
-			tmp = new THREE.Vector3(), tmp2 = new THREE.Vector3(),
-			n = new THREE.Vector3(), w;
-
-		for ( v = 0, vl = this.vertices.length; v < vl; v ++ ) {
-
-			tan1[ v ] = new THREE.Vector3();
-			tan2[ v ] = new THREE.Vector3();
-
-		}
-
-		function handleTriangle( context, a, b, c, ua, ub, uc ) {
-
-			vA = context.vertices[ a ];
-			vB = context.vertices[ b ];
-			vC = context.vertices[ c ];
-
-			uvA = uv[ ua ];
-			uvB = uv[ ub ];
-			uvC = uv[ uc ];
-
-			x1 = vB.x - vA.x;
-			x2 = vC.x - vA.x;
-			y1 = vB.y - vA.y;
-			y2 = vC.y - vA.y;
-			z1 = vB.z - vA.z;
-			z2 = vC.z - vA.z;
-
-			s1 = uvB.x - uvA.x;
-			s2 = uvC.x - uvA.x;
-			t1 = uvB.y - uvA.y;
-			t2 = uvC.y - uvA.y;
-
-			r = 1.0 / ( s1 * t2 - s2 * t1 );
-			sdir.set( ( t2 * x1 - t1 * x2 ) * r,
-					  ( t2 * y1 - t1 * y2 ) * r,
-					  ( t2 * z1 - t1 * z2 ) * r );
-			tdir.set( ( s1 * x2 - s2 * x1 ) * r,
-					  ( s1 * y2 - s2 * y1 ) * r,
-					  ( s1 * z2 - s2 * z1 ) * r );
-
-			tan1[ a ].add( sdir );
-			tan1[ b ].add( sdir );
-			tan1[ c ].add( sdir );
-
-			tan2[ a ].add( tdir );
-			tan2[ b ].add( tdir );
-			tan2[ c ].add( tdir );
-
-		}
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-			uv = this.faceVertexUvs[ 0 ][ f ]; // use UV layer 0 for tangents
-
-			handleTriangle( this, face.a, face.b, face.c, 0, 1, 2 );
-
-		}
-
-		var faceIndex = [ 'a', 'b', 'c', 'd' ];
-
-		for ( f = 0, fl = this.faces.length; f < fl; f ++ ) {
-
-			face = this.faces[ f ];
-
-			for ( i = 0; i < Math.min( face.vertexNormals.length, 3 ); i ++ ) {
-
-				n.copy( face.vertexNormals[ i ] );
-
-				vertexIndex = face[ faceIndex[ i ] ];
-
-				t = tan1[ vertexIndex ];
-
-				// Gram-Schmidt orthogonalize
-
-				tmp.copy( t );
-				tmp.sub( n.multiplyScalar( n.dot( t ) ) ).normalize();
-
-				// Calculate handedness
-
-				tmp2.crossVectors( face.vertexNormals[ i ], t );
-				test = tmp2.dot( tan2[ vertexIndex ] );
-				w = ( test < 0.0 ) ? - 1.0 : 1.0;
-
-				face.vertexTangents[ i ] = new THREE.Vector4( tmp.x, tmp.y, tmp.z, w );
-
-			}
-
-		}
-
-		this.hasTangents = true;
+		console.warn( 'THREE.Geometry: .computeTangents() has been removed.' );
 
 	},
 

+ 0 - 144
src/extras/helpers/VertexTangentsHelper.js

@@ -1,144 +0,0 @@
-/**
- * @author mrdoob / http://mrdoob.com/
- * @author WestLangley / http://github.com/WestLangley
-*/
-
-THREE.VertexTangentsHelper = function ( object, size, hex, linewidth ) {
-
-	this.object = object;
-
-	this.size = ( size !== undefined ) ? size : 1;
-
-	var color = ( hex !== undefined ) ? hex : 0x0000ff;
-
-	var width = ( linewidth !== undefined ) ? linewidth : 1;
-
-	//
-
-	var nTangents = 0;
-
-	var objGeometry = this.object.geometry;
-
-	if ( objGeometry instanceof THREE.Geometry ) {
-
-		nTangents = objGeometry.faces.length * 3;
-
-	} else if ( objGeometry instanceof THREE.BufferGeometry ) {
-
-		nTangents = objGeometry.attributes.tangent.count
-
-	}
-
-	//
-
-	var geometry = new THREE.BufferGeometry();
-
-	var positions = new THREE.Float32Attribute( nTangents * 2 * 3, 3 );
-
-	geometry.addAttribute( 'position', positions );
-
-	THREE.LineSegments.call( this, geometry, new THREE.LineBasicMaterial( { color: color, linewidth: width } ) );
-
-	//
-
-	this.matrixAutoUpdate = false;
-
-	this.update();
-
-};
-
-THREE.VertexTangentsHelper.prototype = Object.create( THREE.LineSegments.prototype );
-THREE.VertexTangentsHelper.prototype.constructor = THREE.VertexTangentsHelper;
-
-THREE.VertexTangentsHelper.prototype.update = ( function ( object ) {
-
-	var v1 = new THREE.Vector3();
-	var v2 = new THREE.Vector3();
-
-	return function() {
-
-		var keys = [ 'a', 'b', 'c' ];
-
-		this.object.updateMatrixWorld( true );
-
-		var matrixWorld = this.object.matrixWorld;
-
-		var position = this.geometry.attributes.position;
-
-		//
-
-		var objGeometry = this.object.geometry;
-
-		if ( objGeometry instanceof THREE.Geometry ) {
-
-			var vertices = objGeometry.vertices;
-
-			var faces = objGeometry.faces;
-
-			var idx = 0;
-
-			for ( var i = 0, l = faces.length; i < l; i ++ ) {
-
-				var face = faces[ i ];
-
-				for ( var j = 0, jl = face.vertexTangents.length; j < jl; j ++ ) {
-
-					var vertex = vertices[ face[ keys[ j ] ] ];
-
-					var tangent = face.vertexTangents[ j ];
-
-					v1.copy( vertex ).applyMatrix4( matrixWorld );
-
-					v2.set( tangent.x, tangent.y, tangent.z ); // tangent.w used for bitangents only
-
-					v2.transformDirection( matrixWorld ).multiplyScalar( this.size ).add( v1 );
-
-					position.setXYZ( idx, v1.x, v1.y, v1.z );
-
-					idx = idx + 1;
-
-					position.setXYZ( idx, v2.x, v2.y, v2.z );
-
-					idx = idx + 1;
-
-				}
-
-			}
-
-		} else if ( objGeometry instanceof THREE.BufferGeometry ) {
-
-			var objPos = objGeometry.attributes.position;
-
-			var objTan = objGeometry.attributes.tangent;
-
-			var idx = 0;
-
-			// for simplicity, ignore index and drawcalls, and render every tangent
-
-			for ( var j = 0, jl = objPos.count; j < jl; j ++ ) {
-
-				v1.set( objPos.getX( j ), objPos.getY( j ), objPos.getZ( j ) ).applyMatrix4( matrixWorld );
-
-				v2.set( objTan.getX( j ), objTan.getY( j ), objTan.getZ( j ) ); // tangent.w used for bitangents only
-
-				v2.transformDirection( matrixWorld ).multiplyScalar( this.size ).add( v1 );
-
-				position.setXYZ( idx, v1.x, v1.y, v1.z );
-
-				idx = idx + 1;
-
-				position.setXYZ( idx, v2.x, v2.y, v2.z );
-
-				idx = idx + 1;
-
-			}
-
-		}
-
-		position.needsUpdate = true;
-
-		return this;
-
-	}
-
-}() );

+ 0 - 6
src/loaders/JSONLoader.js

@@ -495,12 +495,6 @@ THREE.JSONLoader.prototype = {
 
 			var materials = THREE.Loader.prototype.initMaterials( json.materials, texturePath, this.crossOrigin );
 
-			if ( THREE.Loader.prototype.needsTangents( materials ) ) {
-
-				geometry.computeTangents();
-
-			}
-
 			return { geometry: geometry, materials: materials };
 
 		}

+ 0 - 14
src/loaders/Loader.js

@@ -42,20 +42,6 @@ THREE.Loader.prototype = {
 
 	},
 
-	needsTangents: function ( materials ) {
-
-		for ( var i = 0, il = materials.length; i < il; i ++ ) {
-
-			var m = materials[ i ];
-
-			if ( m instanceof THREE.ShaderMaterial ) return true;
-
-		}
-
-		return false;
-
-	},
-
 	createMaterial: ( function () {
 
 		var imageLoader;

+ 0 - 1
utils/build/includes/extras.json

@@ -63,7 +63,6 @@
 	"src/extras/helpers/SkeletonHelper.js",
 	"src/extras/helpers/SpotLightHelper.js",
 	"src/extras/helpers/VertexNormalsHelper.js",
-	"src/extras/helpers/VertexTangentsHelper.js",
 	"src/extras/helpers/WireframeHelper.js",
 	"src/extras/objects/ImmediateRenderObject.js",
 	"src/extras/objects/MorphBlendMesh.js"