Browse Source

Merge pull request #14825 from Mugen87/dev9

Examples: Clean up
Mr.doob 7 years ago
parent
commit
c570b9bd95

+ 1 - 4
examples/canvas_materials_reflection.html

@@ -45,10 +45,7 @@
 
 		<script>
 
-			var camera, scene, renderer,
-			particle1, particle2, particle2,
-			light1, light2, light3,
-			loader, mesh;
+			var camera, scene, renderer, loader, mesh;
 
 			init();
 			animate();

+ 42 - 41
examples/js/Volume.js

@@ -11,7 +11,7 @@
  * @param   {string}        type            The type of data (uint8, uint16, ...)
  * @param   {ArrayBuffer}   arrayBuffer     The buffer with volume data
  */
-THREE.Volume = function( xLength, yLength, zLength, type, arrayBuffer ) {
+THREE.Volume = function ( xLength, yLength, zLength, type, arrayBuffer ) {
 
 	if ( arguments.length > 0 ) {
 
@@ -137,17 +137,17 @@ THREE.Volume = function( xLength, yLength, zLength, type, arrayBuffer ) {
 	 */
 	var lowerThreshold = - Infinity;
 	Object.defineProperty( this, 'lowerThreshold', {
-		get : function() {
+		get: function () {
 
 			return lowerThreshold;
 
 		},
-		set : function( value ) {
+		set: function ( value ) {
 
 			lowerThreshold = value;
-			this.sliceList.forEach( function( slice ) {
+			this.sliceList.forEach( function ( slice ) {
 
-				slice.geometryNeedsUpdate = true
+				slice.geometryNeedsUpdate = true;
 
 			} );
 
@@ -159,15 +159,15 @@ THREE.Volume = function( xLength, yLength, zLength, type, arrayBuffer ) {
 	 */
 	var upperThreshold = Infinity;
 	Object.defineProperty( this, 'upperThreshold', {
-		get : function() {
+		get: function () {
 
 			return upperThreshold;
 
 		},
-		set : function( value ) {
+		set: function ( value ) {
 
 			upperThreshold = value;
-			this.sliceList.forEach( function( slice ) {
+			this.sliceList.forEach( function ( slice ) {
 
 				slice.geometryNeedsUpdate = true;
 
@@ -191,7 +191,7 @@ THREE.Volume = function( xLength, yLength, zLength, type, arrayBuffer ) {
 
 THREE.Volume.prototype = {
 
-	constructor : THREE.Volume,
+	constructor: THREE.Volume,
 
 	/**
 	 * @member {Function} getData Shortcut for data[access(i,j,k)]
@@ -201,7 +201,7 @@ THREE.Volume.prototype = {
 	 * @param {number} k    Third coordinate
 	 * @returns {number}  value in the data array
 	 */
-	getData : function( i, j, k ) {
+	getData: function ( i, j, k ) {
 
 		return this.data[ k * this.xLength * this.yLength + j * this.xLength + i ];
 
@@ -215,7 +215,7 @@ THREE.Volume.prototype = {
 	 * @param {number} k    Third coordinate
 	 * @returns {number}  index
 	 */
-	access : function( i, j, k ) {
+	access: function ( i, j, k ) {
 
 		return k * this.xLength * this.yLength + j * this.xLength + i;
 
@@ -227,7 +227,7 @@ THREE.Volume.prototype = {
 	 * @param {number} index index of the voxel
 	 * @returns {Array}  [x,y,z]
 	 */
-	reverseAccess : function( index ) {
+	reverseAccess: function ( index ) {
 
 		var z = Math.floor( index / ( this.yLength * this.xLength ) );
 		var y = Math.floor( ( index - z * this.yLength * this.xLength ) / this.xLength );
@@ -246,7 +246,7 @@ THREE.Volume.prototype = {
 	 * @param {Object}   context    You can specify a context in which call the function, default if this Volume
 	 * @returns {THREE.Volume}   this
 	 */
-	map : function( functionToMap, context ) {
+	map: function ( functionToMap, context ) {
 
 		var length = this.data.length;
 		context = context || this;
@@ -268,23 +268,23 @@ THREE.Volume.prototype = {
 	 * @param {number}            index the index of the slice
 	 * @returns {Object} an object containing all the usefull information on the geometry of the slice
 	 */
-	extractPerpendicularPlane : function( axis, RASIndex ) {
+	extractPerpendicularPlane: function ( axis, RASIndex ) {
 
 		var iLength,
-		jLength,
-		sliceAccess,
-		planeMatrix = ( new THREE.Matrix4() ).identity(),
-		volume = this,
-		planeWidth,
-		planeHeight,
-		firstSpacing,
-		secondSpacing,
-		positionOffset,
-		IJKIndex;
+			jLength,
+			sliceAccess,
+			planeMatrix = ( new THREE.Matrix4() ).identity(),
+			volume = this,
+			planeWidth,
+			planeHeight,
+			firstSpacing,
+			secondSpacing,
+			positionOffset,
+			IJKIndex;
 
 		var axisInIJK = new THREE.Vector3(),
-		firstDirection = new THREE.Vector3(),
-		secondDirection = new THREE.Vector3();
+			firstDirection = new THREE.Vector3(),
+			secondDirection = new THREE.Vector3();
 
 		var dimensions = new THREE.Vector3( this.xLength, this.yLength, this.zLength );
 
@@ -327,6 +327,7 @@ THREE.Volume.prototype = {
 				positionOffset = ( volume.RASDimensions[ 2 ] - 1 ) / 2;
 				planeMatrix.setPosition( new THREE.Vector3( 0, 0, RASIndex - positionOffset ) );
 				break;
+
 		}
 
 		firstDirection.applyMatrix4( volume.inverseMatrix ).normalize();
@@ -341,25 +342,25 @@ THREE.Volume.prototype = {
 
 		IJKIndex = Math.abs( Math.round( IJKIndex.applyMatrix4( volume.inverseMatrix ).dot( axisInIJK ) ) );
 		var base = [ new THREE.Vector3( 1, 0, 0 ), new THREE.Vector3( 0, 1, 0 ), new THREE.Vector3( 0, 0, 1 ) ];
-		var iDirection = [ firstDirection, secondDirection, axisInIJK ].find( function( x ) {
+		var iDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
 
 			return Math.abs( x.dot( base[ 0 ] ) ) > 0.9;
 
 		} );
-		var jDirection = [ firstDirection, secondDirection, axisInIJK ].find( function( x ) {
+		var jDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
 
 			return Math.abs( x.dot( base[ 1 ] ) ) > 0.9;
 
 		} );
-		var kDirection = [ firstDirection, secondDirection, axisInIJK ].find( function( x ) {
+		var kDirection = [ firstDirection, secondDirection, axisInIJK ].find( function ( x ) {
 
 			return Math.abs( x.dot( base[ 2 ] ) ) > 0.9;
 
 		} );
 		var argumentsWithInversion = [ 'volume.xLength-1-', 'volume.yLength-1-', 'volume.zLength-1-' ];
-		var argArray = [ iDirection, jDirection, kDirection ].map( function( direction, n ) {
+		var argArray = [ iDirection, jDirection, kDirection ].map( function ( direction, n ) {
 
-			return ( direction.dot( base[ n ] ) > 0 ? '' : argumentsWithInversion[ n ] ) + ( direction === axisInIJK ? 'IJKIndex' : direction.argVar )
+			return ( direction.dot( base[ n ] ) > 0 ? '' : argumentsWithInversion[ n ] ) + ( direction === axisInIJK ? 'IJKIndex' : direction.argVar );
 
 		} );
 		var argString = argArray.join( ',' );
@@ -367,12 +368,12 @@ THREE.Volume.prototype = {
 
 
 		return {
-			iLength : iLength,
-			jLength : jLength,
-			sliceAccess : sliceAccess,
-			matrix : planeMatrix,
-			planeWidth : planeWidth,
-			planeHeight : planeHeight
+			iLength: iLength,
+			jLength: jLength,
+			sliceAccess: sliceAccess,
+			matrix: planeMatrix,
+			planeWidth: planeWidth,
+			planeHeight: planeHeight
 		};
 
 	},
@@ -385,7 +386,7 @@ THREE.Volume.prototype = {
 	 * @param {number}            index the index of the slice
 	 * @returns {THREE.VolumeSlice} the extracted slice
 	 */
-	extractSlice : function( axis, index ) {
+	extractSlice: function ( axis, index ) {
 
 		var slice = new THREE.VolumeSlice( this, index, axis );
 		this.sliceList.push( slice );
@@ -399,9 +400,9 @@ THREE.Volume.prototype = {
 	 * @memberof THREE.Volume
 	 * @returns {THREE.Volume} this
 	 */
-	repaintAllSlices : function() {
+	repaintAllSlices: function () {
 
-		this.sliceList.forEach( function( slice ) {
+		this.sliceList.forEach( function ( slice ) {
 
 			slice.repaint();
 
@@ -416,7 +417,7 @@ THREE.Volume.prototype = {
 	 * @memberof THREE.Volume
 	 * @returns {Array} [min,max]
 	 */
-	computeMinMax : function() {
+	computeMinMax: function () {
 
 		var min = Infinity;
 		var max = - Infinity;

+ 2 - 2
examples/js/controls/TransformControls.js

@@ -511,7 +511,7 @@ THREE.TransformControls = function ( camera, domElement ) {
 			x: ( pointer.clientX - rect.left ) / rect.width * 2 - 1,
 			y: - ( pointer.clientY - rect.top ) / rect.height * 2 + 1,
 			button: event.button
-		}
+		};
 
 	}
 
@@ -604,7 +604,7 @@ THREE.TransformControls = function ( camera, domElement ) {
 
 		console.warn( 'THREE.TransformControls: update function has been depricated.' );
 
-	}
+	};
 
 };
 

+ 1 - 1
examples/js/loaders/MTLLoader.js

@@ -148,7 +148,7 @@ THREE.MTLLoader.prototype = {
 				info = { name: value };
 				materialsInfo[ value ] = info;
 
-			} else if ( info ) {
+			} else {
 
 				if ( key === 'ka' || key === 'kd' || key === 'ks' ) {
 

+ 42 - 45
examples/js/loaders/ctm/ctm.js

@@ -53,7 +53,7 @@ CTM.File.prototype.load = function(stream) {
 	this.header = new CTM.FileHeader(stream);
 
 	this.body = new CTM.FileBody(this.header);
-  
+
 	this.getReader().read(stream, this.body);
 };
 
@@ -109,7 +109,7 @@ CTM.FileBody = function(header) {
 	if ( header.hasNormals() ) {
 		this.normals = new Float32Array(data, (i + v) * 4, n);
 	}
-  
+
 	if (header.uvMapCount) {
 		this.uvMaps = [];
 		for (j = 0; j < header.uvMapCount; ++ j) {
@@ -117,7 +117,7 @@ CTM.FileBody = function(header) {
         (i + v + n + (j * u) ) * 4, u) };
 		}
 	}
-  
+
 	if (header.attrMapCount) {
 		this.attrMaps = [];
 		for (j = 0; j < header.attrMapCount; ++ j) {
@@ -140,7 +140,7 @@ CTM.FileMG2Header = function(stream) {
 	this.divx = stream.readInt32();
 	this.divy = stream.readInt32();
 	this.divz = stream.readInt32();
-  
+
 	this.sizex = (this.higherBoundx - this.lowerBoundx) / this.divx;
 	this.sizey = (this.higherBoundy - this.lowerBoundy) / this.divy;
 	this.sizez = (this.higherBoundz - this.lowerBoundz) / this.divz;
@@ -152,7 +152,7 @@ CTM.ReaderRAW = function() {
 CTM.ReaderRAW.prototype.read = function(stream, body) {
 	this.readIndices(stream, body.indices);
 	this.readVertices(stream, body.vertices);
-  
+
 	if (body.normals) {
 		this.readNormals(stream, body.normals);
 	}
@@ -206,7 +206,7 @@ CTM.ReaderMG1 = function() {
 CTM.ReaderMG1.prototype.read = function(stream, body) {
 	this.readIndices(stream, body.indices);
 	this.readVertices(stream, body.vertices);
-  
+
 	if (body.normals) {
 		this.readNormals(stream, body.normals);
 	}
@@ -221,7 +221,7 @@ CTM.ReaderMG1.prototype.read = function(stream, body) {
 CTM.ReaderMG1.prototype.readIndices = function(stream, indices) {
 	stream.readInt32(); //magic "INDX"
 	stream.readInt32(); //packed size
-  
+
 	var interleaved = new CTM.InterleavedStream(indices, 3);
 	LZMA.decompress(stream, stream, interleaved, interleaved.data.length);
 
@@ -231,7 +231,7 @@ CTM.ReaderMG1.prototype.readIndices = function(stream, indices) {
 CTM.ReaderMG1.prototype.readVertices = function(stream, vertices) {
 	stream.readInt32(); //magic "VERT"
 	stream.readInt32(); //packed size
-  
+
 	var interleaved = new CTM.InterleavedStream(vertices, 1);
 	LZMA.decompress(stream, stream, interleaved, interleaved.data.length);
 };
@@ -251,7 +251,7 @@ CTM.ReaderMG1.prototype.readUVMaps = function(stream, uvMaps) {
 
 		uvMaps[i].name = stream.readString();
 		uvMaps[i].filename = stream.readString();
-    
+
 		stream.readInt32(); //packed size
 
 		var interleaved = new CTM.InterleavedStream(uvMaps[i].uv, 2);
@@ -265,7 +265,7 @@ CTM.ReaderMG1.prototype.readAttrMaps = function(stream, attrMaps) {
 		stream.readInt32(); //magic "ATTR"
 
 		attrMaps[i].name = stream.readString();
-    
+
 		stream.readInt32(); //packed size
 
 		var interleaved = new CTM.InterleavedStream(attrMaps[i].attr, 4);
@@ -278,10 +278,10 @@ CTM.ReaderMG2 = function() {
 
 CTM.ReaderMG2.prototype.read = function(stream, body) {
 	this.MG2Header = new CTM.FileMG2Header(stream);
-  
+
 	this.readVertices(stream, body.vertices);
 	this.readIndices(stream, body.indices);
-  
+
 	if (body.normals) {
 		this.readNormals(stream, body);
 	}
@@ -299,23 +299,23 @@ CTM.ReaderMG2.prototype.readVertices = function(stream, vertices) {
 
 	var interleaved = new CTM.InterleavedStream(vertices, 3);
 	LZMA.decompress(stream, stream, interleaved, interleaved.data.length);
-  
+
 	var gridIndices = this.readGridIndices(stream, vertices);
-  
+
 	CTM.restoreVertices(vertices, this.MG2Header, gridIndices, this.MG2Header.vertexPrecision);
 };
 
 CTM.ReaderMG2.prototype.readGridIndices = function(stream, vertices) {
 	stream.readInt32(); //magic "GIDX"
 	stream.readInt32(); //packed size
-  
+
 	var gridIndices = new Uint32Array(vertices.length / 3);
-  
+
 	var interleaved = new CTM.InterleavedStream(gridIndices, 1);
 	LZMA.decompress(stream, stream, interleaved, interleaved.data.length);
-  
+
 	CTM.restoreGridIndices(gridIndices, gridIndices.length);
-  
+
 	return gridIndices;
 };
 
@@ -348,14 +348,14 @@ CTM.ReaderMG2.prototype.readUVMaps = function(stream, uvMaps) {
 
 		uvMaps[i].name = stream.readString();
 		uvMaps[i].filename = stream.readString();
-    
+
 		var precision = stream.readFloat32();
-    
+
 		stream.readInt32(); //packed size
 
 		var interleaved = new CTM.InterleavedStream(uvMaps[i].uv, 2);
 		LZMA.decompress(stream, stream, interleaved, interleaved.data.length);
-    
+
 		CTM.restoreMap(uvMaps[i].uv, 2, precision);
 	}
 };
@@ -366,14 +366,14 @@ CTM.ReaderMG2.prototype.readAttrMaps = function(stream, attrMaps) {
 		stream.readInt32(); //magic "ATTR"
 
 		attrMaps[i].name = stream.readString();
-    
+
 		var precision = stream.readFloat32();
-    
+
 		stream.readInt32(); //packed size
 
 		var interleaved = new CTM.InterleavedStream(attrMaps[i].attr, 4);
 		LZMA.decompress(stream, stream, interleaved, interleaved.data.length);
-    
+
 		CTM.restoreMap(attrMaps[i].attr, 4, precision);
 	}
 };
@@ -386,7 +386,7 @@ CTM.restoreIndices = function(indices, len) {
 	}
 	for (; i < len; i += 3) {
 		indices[i] += indices[i - 3];
-    
+
 		if (indices[i] === indices[i - 3]) {
 			indices[i + 1] += indices[i - 2];
 		}else {
@@ -413,7 +413,7 @@ CTM.restoreVertices = function(vertices, grid, gridIndices, precision) {
 
 	for (; i < len; j += 3) {
 		x = gridIdx = gridIndices[i ++];
-    
+
 		z = ~~(x / zdiv);
 		x -= ~~(z * zdiv);
 		y = ~~(x / ydiv);
@@ -452,13 +452,13 @@ CTM.restoreNormals = function(normals, smooth, precision) {
 			normals[i + 1] = smooth[i + 1] * ro;
 			normals[i + 2] = smooth[i + 2] * ro;
 		}else {
-      
+
 			if (phi <= 4) {
 				theta = (intNormals[i + 2] - 2) * PI_DIV_2;
 			}else {
 				theta = ( (intNormals[i + 2] * 4 / phi) - 2) * PI_DIV_2;
 			}
-      
+
 			phi *= precision * PI_DIV_2;
 			sinPhi = ro * Math.sin(phi);
 
@@ -475,12 +475,9 @@ CTM.restoreNormals = function(normals, smooth, precision) {
 				bz /= len;
 			}
 
-			normals[i]     = smooth[i]     * nz +
-        (smooth[i + 1] * bz - smooth[i + 2] * by) * ny - bz * nx;
-			normals[i + 1] = smooth[i + 1] * nz -
-        (smooth[i + 2]      + smooth[i]   ) * bz  * ny + by * nx;
-			normals[i + 2] = smooth[i + 2] * nz +
-        (smooth[i]     * by + smooth[i + 1] * bz) * ny + bz * nx;
+			normals[i] = smooth[i] * nz + (smooth[i + 1] * bz - smooth[i + 2] * by) * ny - bz * nx;
+			normals[i + 1] = smooth[i + 1] * nz - (smooth[i + 2] + smooth[i]) * bz  * ny + by * nx;
+			normals[i + 2] = smooth[i + 2] * nz + (smooth[i] * by + smooth[i + 1] * bz) * ny + bz * nx;
 		}
 	}
 };
@@ -495,9 +492,9 @@ CTM.restoreMap = function(map, count, precision) {
 
 		for (j = i; j < len; j += count) {
 			value = intMap[j];
-      
+
 			delta += value & 1 ? -( (value + 1) >> 1) : value >> 1;
-      
+
 			map[j] = delta * precision;
 		}
 	}
@@ -520,18 +517,18 @@ CTM.calcSmoothNormals = function(indices, vertices) {
 		v2y = vertices[indz + 1] - vertices[indx + 1];
 		v1z = vertices[indy + 2] - vertices[indx + 2];
 		v2z = vertices[indz + 2] - vertices[indx + 2];
-    
+
 		nx = v1y * v2z - v1z * v2y;
 		ny = v1z * v2x - v1x * v2z;
 		nz = v1x * v2y - v1y * v2x;
-    
+
 		len = Math.sqrt(nx * nx + ny * ny + nz * nz);
 		if (len > 1e-10) {
 			nx /= len;
 			ny /= len;
 			nz /= len;
 		}
-    
+
 		smooth[indx]     += nx;
 		smooth[indx + 1] += ny;
 		smooth[indx + 2] += nz;
@@ -544,7 +541,7 @@ CTM.calcSmoothNormals = function(indices, vertices) {
 	}
 
 	for (i = 0, k = smooth.length; i < k; i += 3) {
-		len = Math.sqrt(smooth[i] * smooth[i] + 
+		len = Math.sqrt(smooth[i] * smooth[i] +
       smooth[i + 1] * smooth[i + 1] +
       smooth[i + 2] * smooth[i + 2]);
 
@@ -577,13 +574,13 @@ CTM.InterleavedStream = function(data, count) {
 
 CTM.InterleavedStream.prototype.writeByte = function(value) {
 	this.data[this.offset] = value;
-  
+
 	this.offset += this.count;
 	if (this.offset >= this.len) {
-  
+
 		this.offset -= this.len - 4;
 		if (this.offset >= this.count) {
-    
+
 			this.offset -= this.count + (CTM.isLittleEndian ? 1 : -1);
 		}
 	}
@@ -616,7 +613,7 @@ CTM.Stream.prototype.readFloat32 = function() {
 	var b1 = this.readByte();
 	var b2 = this.readByte();
 
-	m += (b1 & 0x7f) << 16; 
+	m += (b1 & 0x7f) << 16;
 	var e = ( (b2 & 0x7f) << 1) | ( (b1 & 0x80) >>> 7);
 	var s = b2 & 0x80 ? -1 : 1;
 
@@ -642,7 +639,7 @@ CTM.Stream.prototype.readString = function() {
 
 CTM.Stream.prototype.readArrayInt32 = function(array) {
 	var i = 0, len = array.length;
-  
+
 	while (i < len) {
 		array[i ++] = this.readInt32();
 	}

+ 47 - 48
examples/js/utils/SkeletonUtils.js

@@ -11,7 +11,6 @@ THREE.SkeletonUtils = {
 		var pos = new THREE.Vector3(),
 			quat = new THREE.Quaternion(),
 			scale = new THREE.Vector3(),
-			hipPosition = new THREE.Vector3(),
 			bindBoneMatrix = new THREE.Matrix4(),
 			relativeMatrix = new THREE.Matrix4(),
 			globalMatrix = new THREE.Matrix4();
@@ -93,7 +92,7 @@ THREE.SkeletonUtils = {
 						bone.updateMatrixWorld();
 
 					}
-					
+
 					bindBones.push( bone.matrixWorld.clone() );
 
 				}
@@ -112,7 +111,7 @@ THREE.SkeletonUtils = {
 				if ( boneTo ) {
 
 					boneTo.updateMatrixWorld();
-					
+
 					if ( options.useTargetMatrix ) {
 
 						relativeMatrix.copy( boneTo.matrixWorld );
@@ -158,11 +157,11 @@ THREE.SkeletonUtils = {
 				}
 
 				if ( options.preserveHipPosition && name === options.hip ) {
-					
+
 					bone.matrix.setPosition( pos.set( 0, bone.position.y, 0 ) );
-					
+
 				}
-				
+
 				bone.matrix.decompose( bone.position, bone.quaternion, bone.scale );
 
 				bone.updateMatrixWorld();
@@ -218,7 +217,7 @@ THREE.SkeletonUtils = {
 			bones = this.getBones( target.skeleton ),
 			boneDatas = [],
 			positionOffset,
-			bone, boneTo, boneData, 
+			bone, boneTo, boneData,
 			name, i, j;
 
 		mixer.clipAction( clip ).play();
@@ -235,7 +234,7 @@ THREE.SkeletonUtils = {
 			for ( j = 0; j < bones.length; ++ j ) {
 
 				name = options.names[ bones[ j ].name ] || bones[ j ].name;
-				
+
 				boneTo = this.getBoneByName( name, source.skeleton );
 
 				if ( boneTo ) {
@@ -326,16 +325,16 @@ THREE.SkeletonUtils = {
 		return new THREE.AnimationClip( clip.name, - 1, convertedTracks );
 
 	},
-	
-	getHelperFromSkeleton: function( skeleton ) {
-		
+
+	getHelperFromSkeleton: function ( skeleton ) {
+
 		var source = new THREE.SkeletonHelper( skeleton.bones[ 0 ] );
 		source.skeleton = skeleton;
-		
+
 		return source;
-		
+
 	},
-	
+
 	getSkeletonOffsets: function () {
 
 		var targetParentPos = new THREE.Vector3(),
@@ -356,50 +355,50 @@ THREE.SkeletonUtils = {
 				source = this.getHelperFromSkeleton( source );
 
 			}
-			
+
 			var nameKeys = Object.keys( options.names ),
 				nameValues = Object.values( options.names ),
 				sourceBones = source.isObject3D ? source.skeleton.bones : this.getBones( source ),
 				bones = target.isObject3D ? target.skeleton.bones : this.getBones( target ),
 				offsets = [],
-				bone, boneTo, 
+				bone, boneTo,
 				name, i;
-			
+
 			target.skeleton.pose();
-			
+
 			for ( i = 0; i < bones.length; ++ i ) {
 
 				bone = bones[ i ];
 				name = options.names[ bone.name ] || bone.name;
 
 				boneTo = this.getBoneByName( name, sourceBones );
-				
+
 				if ( boneTo && name !== options.hip ) {
-				
+
 					var boneParent = this.getNearestBone( bone.parent, nameKeys ),
 						boneToParent = this.getNearestBone( boneTo.parent, nameValues );
-				
+
 					boneParent.updateMatrixWorld();
 					boneToParent.updateMatrixWorld();
-				
-					targetParentPos.setFromMatrixPosition( boneParent.matrixWorld  );
+
+					targetParentPos.setFromMatrixPosition( boneParent.matrixWorld );
 					targetPos.setFromMatrixPosition( bone.matrixWorld );
-					
+
 					sourceParentPos.setFromMatrixPosition( boneToParent.matrixWorld );
 					sourcePos.setFromMatrixPosition( boneTo.matrixWorld );
-					
-					targetDir.subVectors( 
+
+					targetDir.subVectors(
 						new THREE.Vector2( targetPos.x, targetPos.y ),
-						new THREE.Vector2( targetParentPos.x, targetParentPos.y ), 
+						new THREE.Vector2( targetParentPos.x, targetParentPos.y )
 					).normalize();
-					
-					sourceDir.subVectors( 
+
+					sourceDir.subVectors(
 						new THREE.Vector2( sourcePos.x, sourcePos.y ),
-						new THREE.Vector2( sourceParentPos.x, sourceParentPos.y ),
+						new THREE.Vector2( sourceParentPos.x, sourceParentPos.y )
 					).normalize();
-					
+
 					var laterialAngle = targetDir.angle() - sourceDir.angle();
-					
+
 					var offset = new THREE.Matrix4().makeRotationFromEuler(
 						new THREE.Euler(
 							0,
@@ -407,22 +406,22 @@ THREE.SkeletonUtils = {
 							laterialAngle
 						)
 					);
-					
+
 					bone.matrix.multiply( offset );
 
 					bone.matrix.decompose( bone.position, bone.quaternion, bone.scale );
 
 					bone.updateMatrixWorld();
-					
+
 					offsets[ name ] = offset;
-					
+
 				}
-				
+
 			}
-			
+
 			return offsets;
-			
-		}
+
+		};
 
 	}(),
 
@@ -457,25 +456,25 @@ THREE.SkeletonUtils = {
 		for ( var i = 0, bones = this.getBones( skeleton ); i < bones.length; i ++ ) {
 
 			if ( name === bones[ i ].name )
-				
+
 				return bones[ i ];
 
 		}
 
 	},
-	
+
 	getNearestBone: function ( bone, names ) {
 
-		while( bone.isBone ) {
-			
-			if ( names.indexOf( bone.name ) !== -1 ) {
-				
+		while ( bone.isBone ) {
+
+			if ( names.indexOf( bone.name ) !== - 1 ) {
+
 				return bone;
-				
+
 			}
-			
+
 			bone = bone.parent;
-			
+
 		}
 
 	},

+ 1 - 1
examples/webgl_geometry_extrude_shapes2.html

@@ -48,7 +48,7 @@
 
 			function d3threeD( exports ) {
 
-				var DEGS_TO_RADS = Math.PI / 180, UNIT_SIZE = 100;
+				var DEGS_TO_RADS = Math.PI / 180;
 				var DIGIT_0 = 48, DIGIT_9 = 57, COMMA = 44, SPACE = 32, PERIOD = 46, MINUS = 45;
 
 				exports.transformSVGPath = function transformSVGPath( pathStr ) {

+ 2 - 1
examples/webgl_geometry_teapot.html

@@ -250,7 +250,8 @@
 				h.add( effectController, "nonblinn" ).name( "original scale" ).onChange( render );
 
 				// shading
-				h = gui.add( effectController, "newShading", [ "wireframe", "flat", "smooth", "glossy", "textured", "reflective" ] ).name( "Shading" ).onChange( render );
+
+				gui.add( effectController, "newShading", [ "wireframe", "flat", "smooth", "glossy", "textured", "reflective" ] ).name( "Shading" ).onChange( render );
 
 			}
 

+ 1 - 1
examples/webgl_loader_nodes.html

@@ -109,7 +109,7 @@
 
 				gui = new dat.GUI();
 
-				var example = gui.add( param, 'load', {
+				gui.add( param, 'load', {
 					'caustic': 'caustic',
 					'displace': 'displace',
 					'wave': 'wave',

+ 3 - 1
examples/webgl_loader_texture_exr.html

@@ -111,7 +111,8 @@
 
 				var loader = new THREE.EXRLoader();
 
-				var texture = loader.load( "textures/piz_compressed.exr", function( texture, textureData ){
+				loader.load( "textures/piz_compressed.exr", function( texture, textureData ) {
+
 					console.log( textureData.header ); // exr header
 
 					texture.minFilter = THREE.NearestFilter;
@@ -133,6 +134,7 @@
 					quad.position.z = -100;
 					scene.add( quad );
 					animate();
+
 				} );
 
 				renderer = new THREE.WebGLRenderer();

+ 2 - 2
examples/webgl_materials_nodes.html

@@ -39,7 +39,7 @@
 		<script src='js/geometries/TeapotBufferGeometry.js'></script>
 		<script src="js/controls/OrbitControls.js"></script>
 		<script src="js/libs/dat.gui.min.js"></script>
-		
+
 		<script type="module">
 
 			import './js/nodes/THREE.Nodes.js';
@@ -161,7 +161,7 @@
 
 				gui = new dat.GUI();
 
-				var example = gui.add( param, 'example', {
+				gui.add( param, 'example', {
 					'basic / mesh-standard': 'mesh-standard',
 					'basic / standard': 'standard',
 					'basic / physical': 'physical',

+ 0 - 4
examples/webgl_postprocessing_dof.html

@@ -112,8 +112,6 @@
 
 				var geo = new THREE.SphereBufferGeometry( 1, 20, 10 );
 
-				var start = Date.now();
-
 				var xgrid = 14,
 					ygrid = 9,
 					zgrid = 14;
@@ -157,8 +155,6 @@
 
 				}
 
-				//console.log("init time: ", Date.now() - start );
-
 				scene.matrixAutoUpdate = false;
 
 				initPostprocessing();

+ 0 - 2
examples/webgl_postprocessing_glitch.html

@@ -130,8 +130,6 @@
 
 				requestAnimationFrame( animate );
 
-				var time = Date.now();
-
 				object.rotation.x += 0.005;
 				object.rotation.y += 0.01;
 

+ 2 - 3
examples/webgl_postprocessing_nodes_pass.html

@@ -73,7 +73,7 @@
 
 				gui = new dat.GUI();
 
-				var example = gui.add( param, 'example', {
+				gui.add( param, 'example', {
 					'basic / color-adjustment': 'color-adjustment',
 					'basic / blends': 'blends',
 					'basic / fade': 'fade',
@@ -317,7 +317,6 @@
 						var normal = new THREE.TextureNode( decalNormal );
 						var normalXY = new THREE.SwitchNode( normal, 'xy' );
 						var scale = new THREE.FloatNode( .5 );
-						var flip = new THREE.Vector2Node( - 1, 1 );
 
 						var normalXYFlip = new THREE.Math1Node(
 							normalXY,
@@ -557,4 +556,4 @@
 		</script>
 
 	</body>
-</html>
+</html>

+ 1 - 1
examples/webgl_raycast_texture.html

@@ -181,7 +181,7 @@
 
 				}
 
-			}
+			};
 
 			var width = window.innerWidth;
 			var height = window.innerHeight;

+ 1 - 1
examples/webgl_tonemapping.html

@@ -160,7 +160,7 @@
 					hdrpath + 'pz' + hdrformat, hdrpath + 'nz' + hdrformat
 				];
 
-				var hdrCubeMap = new THREE.HDRCubeTextureLoader().load( THREE.UnsignedByteType, hdrurls, function ( hdrCubeMap ) {
+				new THREE.HDRCubeTextureLoader().load( THREE.UnsignedByteType, hdrurls, function ( hdrCubeMap ) {
 
 					var pmremGenerator = new THREE.PMREMGenerator( hdrCubeMap );
 					pmremGenerator.update( renderer );

+ 2 - 2
examples/webvr_sandbox.html

@@ -73,7 +73,7 @@
 				light.target.position.set( 0, 0, - 2 );
 				scene.add( light.target );
 
-				var helper = new THREE.CameraHelper( light.shadow.camera );
+				// var helper = new THREE.CameraHelper( light.shadow.camera );
 				// scene.add( helper );
 
 				var light = new THREE.DirectionalLight( 0xff0000 );
@@ -84,7 +84,7 @@
 				light.target.position.set( 0, 0, - 2 );
 				scene.add( light.target );
 
-				var helper = new THREE.CameraHelper( light.shadow.camera );
+				// var helper = new THREE.CameraHelper( light.shadow.camera );
 				// scene.add( helper );
 
 				// lensflare