Explorar o código

Examples: Clean up

Mugen87 %!s(int64=6) %!d(string=hai) anos
pai
achega
c5bd6e30eb

+ 1 - 0
examples/js/utils/BufferGeometryUtils.js

@@ -499,6 +499,7 @@ THREE.BufferGeometryUtils = {
 
 		// initialize the arrays
 		for ( var i = 0, l = attributeNames.length; i < l; i ++ ) {
+
 			var name = attributeNames[ i ];
 
 			attrArrays[ name ] = [];

+ 31 - 31
examples/js/utils/MathUtils.js

@@ -5,59 +5,59 @@
 
 THREE.MathUtils = {
 
-    setQuaternionFromProperEuler: function ( q, a, b, c, order ) {
+	setQuaternionFromProperEuler: function ( q, a, b, c, order ) {
 
-        // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
+		// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
 
-        // rotations are applied to the axes in the order specified by 'order'
-        // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
-        // angles are in radians
+		// rotations are applied to the axes in the order specified by 'order'
+		// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
+		// angles are in radians
 
-        var cos = Math.cos;
-        var sin = Math.sin;
+		var cos = Math.cos;
+		var sin = Math.sin;
 
-        var c2 = cos( b / 2 );
-        var s2 = sin( b / 2 );
+		var c2 = cos( b / 2 );
+		var s2 = sin( b / 2 );
 
-        var c13 = cos( ( a + c ) / 2 );
-        var s13 = sin( ( a + c ) / 2 );
+		var c13 = cos( ( a + c ) / 2 );
+		var s13 = sin( ( a + c ) / 2 );
 
-        var c1_3 = cos( ( a - c ) / 2 );
-        var s1_3 = sin( ( a - c ) / 2 );
+		var c1_3 = cos( ( a - c ) / 2 );
+		var s1_3 = sin( ( a - c ) / 2 );
 
-        var c3_1 = cos( ( c - a ) / 2 );
-        var s3_1 = sin( ( c - a ) / 2 );
+		var c3_1 = cos( ( c - a ) / 2 );
+		var s3_1 = sin( ( c - a ) / 2 );
 
-        if ( order === 'XYX' ) {
+		if ( order === 'XYX' ) {
 
-            q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
+			q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
 
-        } else if ( order === 'YZY' ) {
+		} else if ( order === 'YZY' ) {
 
-            q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
+			q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
 
-        } else if ( order === 'ZXZ' ) {
+		} else if ( order === 'ZXZ' ) {
 
-            q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
+			q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
 
-        } else if ( order === 'XZX' ) {
+		} else if ( order === 'XZX' ) {
 
-            q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
+			q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
 
-        } else if ( order === 'YXY' ) {
+		} else if ( order === 'YXY' ) {
 
-            q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
+			q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
 
-        } else if ( order === 'ZYZ' ) {
+		} else if ( order === 'ZYZ' ) {
 
-            q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
+			q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
 
-        } else {
+		} else {
 
-            console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.' );
+			console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.' );
 
-        }
+		}
 
-    }
+	}
 
 };

+ 1 - 1
examples/js/utils/SkeletonUtils.js

@@ -572,7 +572,7 @@ THREE.SkeletonUtils = {
 };
 
 
-function parallelTraverse ( a, b, callback ) {
+function parallelTraverse( a, b, callback ) {
 
 	callback( a, b );
 

+ 37 - 37
examples/js/utils/TypedArrayUtils.js

@@ -12,7 +12,7 @@ THREE.TypedArrayUtils = {};
  *
  * Complexity: http://bigocheatsheet.com/ see Quicksort
  *
- * Example: 
+ * Example:
  * points: [x, y, z, x, y, z, x, y, z, ...]
  * eleSize: 3 //because of (x, y, z)
  * orderElement: 0 //order according to x
@@ -39,7 +39,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 		}
 
 	};
-	
+
 	var i, j, swap = new Float32Array( eleSize ), temp = new Float32Array( eleSize );
 
 	while ( true ) {
@@ -49,13 +49,13 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 			for ( j = left + 1; j <= right; j ++ ) {
 
 				for ( x = 0; x < eleSize; x ++ ) {
-			
+
 					swap[ x ] = arr[ j * eleSize + x ];
 
 				}
-				
+
 				i = j - 1;
-				
+
 				while ( i >= left && arr[ i * eleSize + orderElement ] > swap[ orderElement ] ) {
 
 					for ( x = 0; x < eleSize; x ++ ) {
@@ -75,7 +75,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 				}
 
 			}
-			
+
 			if ( sp == - 1 ) break;
 
 			right = stack[ sp -- ]; //?
@@ -87,25 +87,25 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 
 			i = left + 1;
 			j = right;
-	
+
 			swapF( median, i );
 
 			if ( arr[ left * eleSize + orderElement ] > arr[ right * eleSize + orderElement ] ) {
-		
+
 				swapF( left, right );
-				
+
 			}
 
 			if ( arr[ i * eleSize + orderElement ] > arr[ right * eleSize + orderElement ] ) {
-		
+
 				swapF( i, right );
-		
+
 			}
 
 			if ( arr[ left * eleSize + orderElement ] > arr[ i * eleSize + orderElement ] ) {
-		
+
 				swapF( left, i );
-			
+
 			}
 
 			for ( x = 0; x < eleSize; x ++ ) {
@@ -113,16 +113,16 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 				temp[ x ] = arr[ i * eleSize + x ];
 
 			}
-			
+
 			while ( true ) {
-				
+
 				do i ++; while ( arr[ i * eleSize + orderElement ] < temp[ orderElement ] );
 				do j --; while ( arr[ j * eleSize + orderElement ] > temp[ orderElement ] );
-				
+
 				if ( j < i ) break;
-		
+
 				swapF( i, j );
-			
+
 			}
 
 			for ( x = 0; x < eleSize; x ++ ) {
@@ -170,7 +170,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
  *
  * Requires typed array quicksort
  *
- * Example: 
+ * Example:
  * points: [x, y, z, x, y, z, x, y, z, ...]
  * metric: function(a, b){	return Math.pow(a[0] - b[0], 2) +  Math.pow(a[1] - b[1], 2) +  Math.pow(a[2] - b[2], 2); }  //Manhatten distance
  * eleSize: 3 //because of (x, y, z)
@@ -182,18 +182,18 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
  * If you want to further minimize memory usage, remove Node.depth and replace in search algorithm with a traversal to root node (see comments at THREE.TypedArrayUtils.Kdtree.prototype.Node)
  */
 
- THREE.TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
+THREE.TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 
 	var self = this;
-	
+
 	var maxDepth = 0;
-	
+
 	var getPointSet = function ( points, pos ) {
 
 		return points.subarray( pos * eleSize, pos * eleSize + eleSize );
 
 	};
-		
+
 	function buildTree( points, depth, parent, pos ) {
 
 		var dim = depth % eleSize,
@@ -202,7 +202,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 			plength = points.length / eleSize;
 
 		if ( depth > maxDepth ) maxDepth = depth;
-		
+
 		if ( plength === 0 ) return null;
 		if ( plength === 1 ) {
 
@@ -211,29 +211,29 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 		}
 
 		THREE.TypedArrayUtils.quicksortIP( points, eleSize, dim );
-		
+
 		median = Math.floor( plength / 2 );
-		
+
 		node = new self.Node( getPointSet( points, median ), depth, parent, median + pos );
 		node.left = buildTree( points.subarray( 0, median * eleSize ), depth + 1, node, pos );
 		node.right = buildTree( points.subarray( ( median + 1 ) * eleSize, points.length ), depth + 1, node, pos + median + 1 );
 
 		return node;
-	
+
 	}
 
 	this.root = buildTree( points, 0, null, 0 );
-		
+
 	this.getMaxDepth = function () {
 
 		return maxDepth;
 
 	};
-	
+
 	this.nearest = function ( point, maxNodes, maxDistance ) {
-	
-		 /* point: array of size eleSize 
-			maxNodes: max amount of nodes to return 
+
+		 /* point: array of size eleSize
+			maxNodes: max amount of nodes to return
 			maxDistance: maximum distance to point result nodes should have
 			condition (not implemented): function to test node before it's added to the result list, e.g. test for view frustum
 		*/
@@ -250,7 +250,7 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 
 			}
 
-					);
+		);
 
 		function nearestSearch( node ) {
 
@@ -383,11 +383,11 @@ THREE.TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 			}
 
 		}
-		
+
 		return result;
-	
+
 	};
-	
+
 };
 
 /**
@@ -414,7 +414,7 @@ THREE.TypedArrayUtils.Kdtree.prototype.Node = function ( obj, depth, parent, pos
 	this.depth = depth;
 	this.pos = pos;
 
-}; 
+};
 
 /**
  * Binary heap implementation

+ 1 - 0
examples/jsm/utils/BufferGeometryUtils.js

@@ -508,6 +508,7 @@ var BufferGeometryUtils = {
 
 		// initialize the arrays
 		for ( var i = 0, l = attributeNames.length; i < l; i ++ ) {
+
 			var name = attributeNames[ i ];
 
 			attrArrays[ name ] = [];

+ 31 - 31
examples/jsm/utils/MathUtils.js

@@ -7,60 +7,60 @@
 
 var MathUtils = {
 
-    setQuaternionFromProperEuler: function ( q, a, b, c, order ) {
+	setQuaternionFromProperEuler: function ( q, a, b, c, order ) {
 
-        // Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
+		// Intrinsic Proper Euler Angles - see https://en.wikipedia.org/wiki/Euler_angles
 
-        // rotations are applied to the axes in the order specified by 'order'
-        // rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
-        // angles are in radians
+		// rotations are applied to the axes in the order specified by 'order'
+		// rotation by angle 'a' is applied first, then by angle 'b', then by angle 'c'
+		// angles are in radians
 
-        var cos = Math.cos;
-        var sin = Math.sin;
+		var cos = Math.cos;
+		var sin = Math.sin;
 
-        var c2 = cos( b / 2 );
-        var s2 = sin( b / 2 );
+		var c2 = cos( b / 2 );
+		var s2 = sin( b / 2 );
 
-        var c13 = cos( ( a + c ) / 2 );
-        var s13 = sin( ( a + c ) / 2 );
+		var c13 = cos( ( a + c ) / 2 );
+		var s13 = sin( ( a + c ) / 2 );
 
-        var c1_3 = cos( ( a - c ) / 2 );
-        var s1_3 = sin( ( a - c ) / 2 );
+		var c1_3 = cos( ( a - c ) / 2 );
+		var s1_3 = sin( ( a - c ) / 2 );
 
-        var c3_1 = cos( ( c - a ) / 2 );
-        var s3_1 = sin( ( c - a ) / 2 );
+		var c3_1 = cos( ( c - a ) / 2 );
+		var s3_1 = sin( ( c - a ) / 2 );
 
-        if ( order === 'XYX' ) {
+		if ( order === 'XYX' ) {
 
-            q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
+			q.set( c2 * s13, s2 * c1_3, s2 * s1_3, c2 * c13 );
 
-        } else if ( order === 'YZY' ) {
+		} else if ( order === 'YZY' ) {
 
-            q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
+			q.set( s2 * s1_3, c2 * s13, s2 * c1_3, c2 * c13 );
 
-        } else if ( order === 'ZXZ' ) {
+		} else if ( order === 'ZXZ' ) {
 
-            q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
+			q.set( s2 * c1_3, s2 * s1_3, c2 * s13, c2 * c13 );
 
-        } else if ( order === 'XZX' ) {
+		} else if ( order === 'XZX' ) {
 
-            q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
+			q.set( c2 * s13, s2 * s3_1, s2 * c3_1, c2 * c13 );
 
-        } else if ( order === 'YXY' ) {
+		} else if ( order === 'YXY' ) {
 
-            q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
+			q.set( s2 * c3_1, c2 * s13, s2 * s3_1, c2 * c13 );
 
-        } else if ( order === 'ZYZ' ) {
+		} else if ( order === 'ZYZ' ) {
 
-            q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
+			q.set( s2 * s3_1, s2 * c3_1, c2 * s13, c2 * c13 );
 
-        } else {
+		} else {
 
-            console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.' );
+			console.warn( 'THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.' );
 
-        }
+		}
 
-    }
+	}
 
 };
 

+ 1 - 1
examples/jsm/utils/SkeletonUtils.js

@@ -585,7 +585,7 @@ var SkeletonUtils = {
 };
 
 
-function parallelTraverse ( a, b, callback ) {
+function parallelTraverse( a, b, callback ) {
 
 	callback( a, b );
 

+ 37 - 37
examples/jsm/utils/TypedArrayUtils.js

@@ -12,7 +12,7 @@ var TypedArrayUtils = {};
  *
  * Complexity: http://bigocheatsheet.com/ see Quicksort
  *
- * Example: 
+ * Example:
  * points: [x, y, z, x, y, z, x, y, z, ...]
  * eleSize: 3 //because of (x, y, z)
  * orderElement: 0 //order according to x
@@ -39,7 +39,7 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 		}
 
 	};
-	
+
 	var i, j, swap = new Float32Array( eleSize ), temp = new Float32Array( eleSize );
 
 	while ( true ) {
@@ -49,13 +49,13 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 			for ( j = left + 1; j <= right; j ++ ) {
 
 				for ( x = 0; x < eleSize; x ++ ) {
-			
+
 					swap[ x ] = arr[ j * eleSize + x ];
 
 				}
-				
+
 				i = j - 1;
-				
+
 				while ( i >= left && arr[ i * eleSize + orderElement ] > swap[ orderElement ] ) {
 
 					for ( x = 0; x < eleSize; x ++ ) {
@@ -75,7 +75,7 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 				}
 
 			}
-			
+
 			if ( sp == - 1 ) break;
 
 			right = stack[ sp -- ]; //?
@@ -87,25 +87,25 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 
 			i = left + 1;
 			j = right;
-	
+
 			swapF( median, i );
 
 			if ( arr[ left * eleSize + orderElement ] > arr[ right * eleSize + orderElement ] ) {
-		
+
 				swapF( left, right );
-				
+
 			}
 
 			if ( arr[ i * eleSize + orderElement ] > arr[ right * eleSize + orderElement ] ) {
-		
+
 				swapF( i, right );
-		
+
 			}
 
 			if ( arr[ left * eleSize + orderElement ] > arr[ i * eleSize + orderElement ] ) {
-		
+
 				swapF( left, i );
-			
+
 			}
 
 			for ( x = 0; x < eleSize; x ++ ) {
@@ -113,16 +113,16 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 				temp[ x ] = arr[ i * eleSize + x ];
 
 			}
-			
+
 			while ( true ) {
-				
+
 				do i ++; while ( arr[ i * eleSize + orderElement ] < temp[ orderElement ] );
 				do j --; while ( arr[ j * eleSize + orderElement ] > temp[ orderElement ] );
-				
+
 				if ( j < i ) break;
-		
+
 				swapF( i, j );
-			
+
 			}
 
 			for ( x = 0; x < eleSize; x ++ ) {
@@ -170,7 +170,7 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
  *
  * Requires typed array quicksort
  *
- * Example: 
+ * Example:
  * points: [x, y, z, x, y, z, x, y, z, ...]
  * metric: function(a, b){	return Math.pow(a[0] - b[0], 2) +  Math.pow(a[1] - b[1], 2) +  Math.pow(a[2] - b[2], 2); }  //Manhatten distance
  * eleSize: 3 //because of (x, y, z)
@@ -182,18 +182,18 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
  * If you want to further minimize memory usage, remove Node.depth and replace in search algorithm with a traversal to root node (see comments at TypedArrayUtils.Kdtree.prototype.Node)
  */
 
- TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
+TypedArrayUtils.Kdtree = function ( points, metric, eleSize ) {
 
 	var self = this;
-	
+
 	var maxDepth = 0;
-	
+
 	var getPointSet = function ( points, pos ) {
 
 		return points.subarray( pos * eleSize, pos * eleSize + eleSize );
 
 	};
-		
+
 	function buildTree( points, depth, parent, pos ) {
 
 		var dim = depth % eleSize,
@@ -202,7 +202,7 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 			plength = points.length / eleSize;
 
 		if ( depth > maxDepth ) maxDepth = depth;
-		
+
 		if ( plength === 0 ) return null;
 		if ( plength === 1 ) {
 
@@ -211,29 +211,29 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 		}
 
 		TypedArrayUtils.quicksortIP( points, eleSize, dim );
-		
+
 		median = Math.floor( plength / 2 );
-		
+
 		node = new self.Node( getPointSet( points, median ), depth, parent, median + pos );
 		node.left = buildTree( points.subarray( 0, median * eleSize ), depth + 1, node, pos );
 		node.right = buildTree( points.subarray( ( median + 1 ) * eleSize, points.length ), depth + 1, node, pos + median + 1 );
 
 		return node;
-	
+
 	}
 
 	this.root = buildTree( points, 0, null, 0 );
-		
+
 	this.getMaxDepth = function () {
 
 		return maxDepth;
 
 	};
-	
+
 	this.nearest = function ( point, maxNodes, maxDistance ) {
-	
-		 /* point: array of size eleSize 
-			maxNodes: max amount of nodes to return 
+
+		 /* point: array of size eleSize
+			maxNodes: max amount of nodes to return
 			maxDistance: maximum distance to point result nodes should have
 			condition (not implemented): function to test node before it's added to the result list, e.g. test for view frustum
 		*/
@@ -250,7 +250,7 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 
 			}
 
-					);
+		);
 
 		function nearestSearch( node ) {
 
@@ -383,11 +383,11 @@ TypedArrayUtils.quicksortIP = function ( arr, eleSize, orderElement ) {
 			}
 
 		}
-		
+
 		return result;
-	
+
 	};
-	
+
 };
 
 /**
@@ -414,7 +414,7 @@ TypedArrayUtils.Kdtree.prototype.Node = function ( obj, depth, parent, pos ) {
 	this.depth = depth;
 	this.pos = pos;
 
-}; 
+};
 
 /**
  * Binary heap implementation