Pārlūkot izejas kodu

Merge branch 'dev' of github.com:mrdoob/three.js into awdloader

Pierre Lepers 11 gadi atpakaļ
vecāks
revīzija
bafbbfba98

+ 150 - 84
build/three.js

@@ -1224,6 +1224,15 @@ THREE.Vector2.prototype = {
 		return this;
 
 	},
+	
+	multiply: function ( v ) {
+
+		this.x *= v.x;
+		this.y *= v.y;
+
+		return this;
+
+	},
 
 	multiplyScalar: function ( s ) {
 
@@ -1234,6 +1243,15 @@ THREE.Vector2.prototype = {
 
 	},
 
+	divide: function ( v ) {
+
+		this.x /= v.x;
+		this.y /= v.y;
+
+		return this;
+
+	},
+
 	divideScalar: function ( scalar ) {
 
 		if ( scalar !== 0 ) {
@@ -11114,6 +11132,43 @@ THREE.SpotLight.prototype.clone = function () {
 
 };
 
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+THREE.Cache = {
+
+	files: {},
+
+	add: function ( key, file ) {
+
+		// console.log( 'THREE.Cache', 'Adding key:', key );
+
+		this.files[ key ] = file;
+
+	},
+
+	get: function ( key ) {
+
+		// console.log( 'THREE.Cache', 'Checking key:', key );
+
+		return this.files[ key ];
+
+	},
+
+	remove: function ( key ) {
+
+		delete this.files[ key ];
+
+	},
+
+	clear: function () {
+
+		this.files = {}
+
+	}
+
+};
 /**
  * @author alteredq / http://alteredqualia.com/
  */
@@ -11193,7 +11248,7 @@ THREE.Loader.prototype = {
 
 		for ( var i = 0; i < materials.length; ++ i ) {
 
-			array[ i ] = THREE.Loader.prototype.createMaterial( materials[ i ], texturePath );
+			array[ i ] = this.createMaterial( materials[ i ], texturePath );
 
 		}
 
@@ -11219,13 +11274,6 @@ THREE.Loader.prototype = {
 
 		var _this = this;
 
-		function is_pow2( n ) {
-
-			var l = Math.log( n ) / Math.LN2;
-			return Math.floor( l ) == l;
-
-		}
-
 		function nearest_pow2( n ) {
 
 			var l = Math.log( n ) / Math.LN2;
@@ -11233,36 +11281,6 @@ THREE.Loader.prototype = {
 
 		}
 
-		function load_image( where, url ) {
-
-			var image = new Image();
-
-			image.onload = function () {
-
-				if ( !is_pow2( this.width ) || !is_pow2( this.height ) ) {
-
-					var width = nearest_pow2( this.width );
-					var height = nearest_pow2( this.height );
-
-					where.image.width = width;
-					where.image.height = height;
-					where.image.getContext( '2d' ).drawImage( this, 0, 0, width, height );
-
-				} else {
-
-					where.image = this;
-
-				}
-
-				where.needsUpdate = true;
-
-			};
-
-			if ( _this.crossOrigin !== undefined ) image.crossOrigin = _this.crossOrigin;
-			image.src = url;
-
-		}
-
 		function create_texture( where, name, sourceFile, repeat, offset, wrap, anisotropy ) {
 
 			var isCompressed = /\.dds$/i.test( sourceFile );
@@ -11320,7 +11338,31 @@ THREE.Loader.prototype = {
 
 			if ( ! isCompressed ) {
 
-				load_image( where[ name ], fullPath );
+				var texture = where[ name ];
+
+				var loader = new THREE.ImageLoader();
+				loader.crossOrigin = _this.crossOrigin;
+				loader.load( fullPath, function ( image ) {
+
+					if ( THREE.Math.isPowerOfTwo( image.width ) === false ||
+						 THREE.Math.isPowerOfTwo( image.height ) === false ) {
+
+						var width = nearest_pow2( image.width );
+						var height = nearest_pow2( image.height );
+
+						texture.image.width = width;
+						texture.image.height = height;
+						texture.image.getContext( '2d' ).drawImage( image, 0, 0, width, height );
+
+					} else {
+
+						texture.image = image;
+
+					}
+
+					texture.needsUpdate = true;
+
+				} );
 
 			}
 
@@ -11577,6 +11619,15 @@ THREE.XHRLoader.prototype = {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
+		var cached = THREE.Cache.get( url );
+
+		if ( cached !== undefined ) {
+
+			onLoad( cached );
+			return;
+
+		}
+
 		var scope = this;
 		var request = new XMLHttpRequest();
 
@@ -11584,6 +11635,8 @@ THREE.XHRLoader.prototype = {
 
 			request.addEventListener( 'load', function ( event ) {
 
+				THREE.Cache.add( url, event.target.responseText );
+
 				onLoad( event.target.responseText );
 				scope.manager.itemEnd( url );
 
@@ -11644,6 +11697,15 @@ THREE.ImageLoader.prototype = {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
+		var cached = THREE.Cache.get( url );
+
+		if ( cached !== undefined ) {
+
+			onLoad( cached );
+			return;
+
+		}
+
 		var scope = this;
 		var image = document.createElement( 'img' );
 
@@ -11651,8 +11713,10 @@ THREE.ImageLoader.prototype = {
 
 			image.addEventListener( 'load', function ( event ) {
 
-				scope.manager.itemEnd( url );
+				THREE.Cache.add( url, this );
+
 				onLoad( this );
+				scope.manager.itemEnd( url );
 
 			}, false );
 
@@ -31033,61 +31097,70 @@ THREE.ClosedSplineCurve3 = THREE.Curve.create(
  * @author mikael emtinger / http://gomo.se/
  */
 
-THREE.AnimationHandler = (function() {
+THREE.AnimationHandler = ( function () {
 
 	var playing = [];
 	var library = {};
 	var that    = {};
 
+	that.update = function ( deltaTimeMS ) {
 
-	//--- update ---
-
-	that.update = function( deltaTimeMS ) {
+		for ( var i = 0; i < playing.length; i ++ ) {
 
-		for( var i = 0; i < playing.length; i ++ )
 			playing[ i ].update( deltaTimeMS );
 
-	};
+		}
 
+	};
 
-	//--- add ---
+	that.addToUpdate = function ( animation ) {
 
-	that.addToUpdate = function( animation ) {
+		if ( playing.indexOf( animation ) === -1 ) {
 
-		if ( playing.indexOf( animation ) === -1 )
 			playing.push( animation );
 
-	};
-
+		}
 
-	//--- remove ---
+	};
 
-	that.removeFromUpdate = function( animation ) {
+	that.removeFromUpdate = function ( animation ) {
 
 		var index = playing.indexOf( animation );
 
-		if( index !== -1 )
+		if ( index !== -1 ) {
+
 			playing.splice( index, 1 );
 
-	};
+		}
 
+	};
 
-	//--- add ---
+	that.add = function ( data ) {
 
-	that.add = function( data ) {
+		if ( library[ data.name ] !== undefined ) {
 
-		if ( library[ data.name ] !== undefined )
 			console.log( "THREE.AnimationHandler.add: Warning! " + data.name + " already exists in library. Overwriting." );
 
+		}
+
 		library[ data.name ] = data;
 		initData( data );
 
 	};
 
+	that.remove = function ( name ) {
 
-	//--- get ---
+		if ( library[ name ] === undefined ) {
 
-	that.get = function( name ) {
+			console.log( "THREE.AnimationHandler.add: Warning! " + name + " doesn't exists in library. Doing nothing." );
+
+		}
+			
+		library[ name ] = undefined;
+
+	};
+
+	that.get = function ( name ) {
 
 		if ( typeof name === "string" ) {
 
@@ -31097,7 +31170,6 @@ THREE.AnimationHandler = (function() {
 
 			} else {
 
-				console.log( "THREE.AnimationHandler.get: Couldn't find animation " + name );
 				return null;
 
 			}
@@ -31110,9 +31182,7 @@ THREE.AnimationHandler = (function() {
 
 	};
 
-	//--- parse ---
-
-	that.parse = function( root ) {
+	that.parse = function ( root ) {
 
 		// setup hierarchy
 
@@ -31120,7 +31190,7 @@ THREE.AnimationHandler = (function() {
 
 		if ( root instanceof THREE.SkinnedMesh ) {
 
-			for( var b = 0; b < root.bones.length; b++ ) {
+			for ( var b = 0; b < root.bones.length; b++ ) {
 
 				hierarchy.push( root.bones[ b ] );
 
@@ -31136,52 +31206,50 @@ THREE.AnimationHandler = (function() {
 
 	};
 
-	var parseRecurseHierarchy = function( root, hierarchy ) {
+	var parseRecurseHierarchy = function ( root, hierarchy ) {
 
 		hierarchy.push( root );
 
-		for( var c = 0; c < root.children.length; c++ )
+		for ( var c = 0; c < root.children.length; c++ )
 			parseRecurseHierarchy( root.children[ c ], hierarchy );
 
 	}
 
+	var initData = function ( data ) {
 
-	//--- init data ---
-
-	var initData = function( data ) {
-
-		if( data.initialized === true )
+		if ( data.initialized === true )
 			return;
 
 
 		// loop through all keys
 
-		for( var h = 0; h < data.hierarchy.length; h ++ ) {
+		for ( var h = 0; h < data.hierarchy.length; h ++ ) {
 
-			for( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {
+			for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {
 
 				// remove minus times
 
-				if( data.hierarchy[ h ].keys[ k ].time < 0 )
-					data.hierarchy[ h ].keys[ k ].time = 0;
+				if ( data.hierarchy[ h ].keys[ k ].time < 0 ) {
+
+					 data.hierarchy[ h ].keys[ k ].time = 0;
 
+				}
 
 				// create quaternions
 
-				if( data.hierarchy[ h ].keys[ k ].rot !== undefined &&
-				 !( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) {
+				if ( data.hierarchy[ h ].keys[ k ].rot !== undefined &&
+				  !( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) {
 
 					var quat = data.hierarchy[ h ].keys[ k ].rot;
-					data.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion( quat[0], quat[1], quat[2], quat[3] );
+					data.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion().fromArray( quat );
 
 				}
 
 			}
 
-
 			// prepare morph target keys
 
-			if( data.hierarchy[ h ].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) {
+			if ( data.hierarchy[ h ].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) {
 
 				// get all used
 
@@ -31259,8 +31327,6 @@ THREE.AnimationHandler = (function() {
 
 		}
 
-		// done
-
 		data.initialized = true;
 
 	};
@@ -31274,7 +31340,7 @@ THREE.AnimationHandler = (function() {
 
 	return that;
 
-}());
+}() );
 
 /**
  * @author mikael emtinger / http://gomo.se/

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 87 - 85
build/three.min.js


+ 18 - 14
examples/js/loaders/UTF8Loader.js

@@ -34,9 +34,13 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 
 	var geometry = new THREE.BufferGeometry();
 
-	var positionArray = new Float32Array( 3 * 3 * ntris );
-	var normalArray = new Float32Array( 3 * 3 * ntris );
-	var uvArray = new Float32Array( 2 * 3 * ntris );
+    var positions = new THREE.Float32Attribute( ntris * 3, 3 );
+    var normals = new THREE.Float32Attribute( ntris * 3, 3 );
+    var uvs = new THREE.Float32Attribute( ntris * 3, 2 );
+
+	var positionsArray = positions.array;
+	var normalsArray = normals.array;
+	var uvsArray = uvs.array;
 
 	var i, j, offset;
 	var x, y, z;
@@ -56,9 +60,9 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 		y = attribArray[ i + 1 ];
 		z = attribArray[ i + 2 ];
 
-		positionArray[ j++ ] = x;
-		positionArray[ j++ ] = y;
-		positionArray[ j++ ] = z;
+		positionsArray[ j++ ] = x;
+		positionsArray[ j++ ] = y;
+		positionsArray[ j++ ] = z;
 
 	}
 
@@ -72,8 +76,8 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 		u = attribArray[ i ];
 		v = attribArray[ i + 1 ];
 
-		uvArray[ j++ ] = u;
-		uvArray[ j++ ] = v;
+		uvsArray[ j++ ] = u;
+		uvsArray[ j++ ] = v;
 
 	}
 
@@ -88,16 +92,16 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
 		y = attribArray[ i + 1 ];
 		z = attribArray[ i + 2 ];
 
-		normalArray[ j++ ] = x;
-		normalArray[ j++ ] = y;
-		normalArray[ j++ ] = z;
+		normalsArray[ j++ ] = x;
+		normalsArray[ j++ ] = y;
+		normalsArray[ j++ ] = z;
 
 	}
 
     geometry.addAttribute( 'index', indexArray, 1 );
-    geometry.addAttribute( 'position', positionArray, 3 );
-    geometry.addAttribute( 'normal', normalArray, 3 );
-    geometry.addAttribute( 'uv', uvArray, 2 );
+    geometry.addAttribute( 'position', positions );
+    geometry.addAttribute( 'normal', normals );
+    geometry.addAttribute( 'uv', uvs );
 
     geometry.offsets.push( { start: 0, count: indexArray.length, index: 0 } );
 

+ 46 - 44
src/extras/animation/AnimationHandler.js

@@ -2,61 +2,70 @@
  * @author mikael emtinger / http://gomo.se/
  */
 
-THREE.AnimationHandler = (function() {
+THREE.AnimationHandler = ( function () {
 
 	var playing = [];
 	var library = {};
 	var that    = {};
 
+	that.update = function ( deltaTimeMS ) {
 
-	//--- update ---
+		for ( var i = 0; i < playing.length; i ++ ) {
 
-	that.update = function( deltaTimeMS ) {
-
-		for( var i = 0; i < playing.length; i ++ )
 			playing[ i ].update( deltaTimeMS );
 
-	};
+		}
 
+	};
 
-	//--- add ---
+	that.addToUpdate = function ( animation ) {
 
-	that.addToUpdate = function( animation ) {
+		if ( playing.indexOf( animation ) === -1 ) {
 
-		if ( playing.indexOf( animation ) === -1 )
 			playing.push( animation );
 
-	};
-
+		}
 
-	//--- remove ---
+	};
 
-	that.removeFromUpdate = function( animation ) {
+	that.removeFromUpdate = function ( animation ) {
 
 		var index = playing.indexOf( animation );
 
-		if( index !== -1 )
+		if ( index !== -1 ) {
+
 			playing.splice( index, 1 );
 
-	};
+		}
 
+	};
 
-	//--- add ---
+	that.add = function ( data ) {
 
-	that.add = function( data ) {
+		if ( library[ data.name ] !== undefined ) {
 
-		if ( library[ data.name ] !== undefined )
 			console.log( "THREE.AnimationHandler.add: Warning! " + data.name + " already exists in library. Overwriting." );
 
+		}
+
 		library[ data.name ] = data;
 		initData( data );
 
 	};
 
+	that.remove = function ( name ) {
 
-	//--- get ---
+		if ( library[ name ] === undefined ) {
 
-	that.get = function( name ) {
+			console.log( "THREE.AnimationHandler.add: Warning! " + name + " doesn't exists in library. Doing nothing." );
+
+		}
+			
+		library[ name ] = undefined;
+
+	};
+
+	that.get = function ( name ) {
 
 		if ( typeof name === "string" ) {
 
@@ -66,7 +75,6 @@ THREE.AnimationHandler = (function() {
 
 			} else {
 
-				console.log( "THREE.AnimationHandler.get: Couldn't find animation " + name );
 				return null;
 
 			}
@@ -79,9 +87,7 @@ THREE.AnimationHandler = (function() {
 
 	};
 
-	//--- parse ---
-
-	that.parse = function( root ) {
+	that.parse = function ( root ) {
 
 		// setup hierarchy
 
@@ -89,7 +95,7 @@ THREE.AnimationHandler = (function() {
 
 		if ( root instanceof THREE.SkinnedMesh ) {
 
-			for( var b = 0; b < root.bones.length; b++ ) {
+			for ( var b = 0; b < root.bones.length; b++ ) {
 
 				hierarchy.push( root.bones[ b ] );
 
@@ -105,52 +111,50 @@ THREE.AnimationHandler = (function() {
 
 	};
 
-	var parseRecurseHierarchy = function( root, hierarchy ) {
+	var parseRecurseHierarchy = function ( root, hierarchy ) {
 
 		hierarchy.push( root );
 
-		for( var c = 0; c < root.children.length; c++ )
+		for ( var c = 0; c < root.children.length; c++ )
 			parseRecurseHierarchy( root.children[ c ], hierarchy );
 
 	}
 
+	var initData = function ( data ) {
 
-	//--- init data ---
-
-	var initData = function( data ) {
-
-		if( data.initialized === true )
+		if ( data.initialized === true )
 			return;
 
 
 		// loop through all keys
 
-		for( var h = 0; h < data.hierarchy.length; h ++ ) {
+		for ( var h = 0; h < data.hierarchy.length; h ++ ) {
 
-			for( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {
+			for ( var k = 0; k < data.hierarchy[ h ].keys.length; k ++ ) {
 
 				// remove minus times
 
-				if( data.hierarchy[ h ].keys[ k ].time < 0 )
-					data.hierarchy[ h ].keys[ k ].time = 0;
+				if ( data.hierarchy[ h ].keys[ k ].time < 0 ) {
+
+					 data.hierarchy[ h ].keys[ k ].time = 0;
 
+				}
 
 				// create quaternions
 
-				if( data.hierarchy[ h ].keys[ k ].rot !== undefined &&
-				 !( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) {
+				if ( data.hierarchy[ h ].keys[ k ].rot !== undefined &&
+				  !( data.hierarchy[ h ].keys[ k ].rot instanceof THREE.Quaternion ) ) {
 
 					var quat = data.hierarchy[ h ].keys[ k ].rot;
-					data.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion( quat[0], quat[1], quat[2], quat[3] );
+					data.hierarchy[ h ].keys[ k ].rot = new THREE.Quaternion().fromArray( quat );
 
 				}
 
 			}
 
-
 			// prepare morph target keys
 
-			if( data.hierarchy[ h ].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) {
+			if ( data.hierarchy[ h ].keys.length && data.hierarchy[ h ].keys[ 0 ].morphTargets !== undefined ) {
 
 				// get all used
 
@@ -228,8 +232,6 @@ THREE.AnimationHandler = (function() {
 
 		}
 
-		// done
-
 		data.initialized = true;
 
 	};
@@ -243,4 +245,4 @@ THREE.AnimationHandler = (function() {
 
 	return that;
 
-}());
+}() );

+ 37 - 0
src/loaders/Cache.js

@@ -0,0 +1,37 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+THREE.Cache = {
+
+	files: {},
+
+	add: function ( key, file ) {
+
+		// console.log( 'THREE.Cache', 'Adding key:', key );
+
+		this.files[ key ] = file;
+
+	},
+
+	get: function ( key ) {
+
+		// console.log( 'THREE.Cache', 'Checking key:', key );
+
+		return this.files[ key ];
+
+	},
+
+	remove: function ( key ) {
+
+		delete this.files[ key ];
+
+	},
+
+	clear: function () {
+
+		this.files = {}
+
+	}
+
+};

+ 12 - 1
src/loaders/ImageLoader.js

@@ -14,6 +14,15 @@ THREE.ImageLoader.prototype = {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
+		var cached = THREE.Cache.get( url );
+
+		if ( cached !== undefined ) {
+
+			onLoad( cached );
+			return;
+
+		}
+
 		var scope = this;
 		var image = document.createElement( 'img' );
 
@@ -21,8 +30,10 @@ THREE.ImageLoader.prototype = {
 
 			image.addEventListener( 'load', function ( event ) {
 
-				scope.manager.itemEnd( url );
+				THREE.Cache.add( url, this );
+
 				onLoad( this );
+				scope.manager.itemEnd( url );
 
 			}, false );
 

+ 26 - 39
src/loaders/Loader.js

@@ -77,7 +77,7 @@ THREE.Loader.prototype = {
 
 		for ( var i = 0; i < materials.length; ++ i ) {
 
-			array[ i ] = THREE.Loader.prototype.createMaterial( materials[ i ], texturePath );
+			array[ i ] = this.createMaterial( materials[ i ], texturePath );
 
 		}
 
@@ -103,13 +103,6 @@ THREE.Loader.prototype = {
 
 		var _this = this;
 
-		function is_pow2( n ) {
-
-			var l = Math.log( n ) / Math.LN2;
-			return Math.floor( l ) == l;
-
-		}
-
 		function nearest_pow2( n ) {
 
 			var l = Math.log( n ) / Math.LN2;
@@ -117,36 +110,6 @@ THREE.Loader.prototype = {
 
 		}
 
-		function load_image( where, url ) {
-
-			var image = new Image();
-
-			image.onload = function () {
-
-				if ( !is_pow2( this.width ) || !is_pow2( this.height ) ) {
-
-					var width = nearest_pow2( this.width );
-					var height = nearest_pow2( this.height );
-
-					where.image.width = width;
-					where.image.height = height;
-					where.image.getContext( '2d' ).drawImage( this, 0, 0, width, height );
-
-				} else {
-
-					where.image = this;
-
-				}
-
-				where.needsUpdate = true;
-
-			};
-
-			if ( _this.crossOrigin !== undefined ) image.crossOrigin = _this.crossOrigin;
-			image.src = url;
-
-		}
-
 		function create_texture( where, name, sourceFile, repeat, offset, wrap, anisotropy ) {
 
 			var isCompressed = /\.dds$/i.test( sourceFile );
@@ -204,7 +167,31 @@ THREE.Loader.prototype = {
 
 			if ( ! isCompressed ) {
 
-				load_image( where[ name ], fullPath );
+				var texture = where[ name ];
+
+				var loader = new THREE.ImageLoader();
+				loader.crossOrigin = _this.crossOrigin;
+				loader.load( fullPath, function ( image ) {
+
+					if ( THREE.Math.isPowerOfTwo( image.width ) === false ||
+						 THREE.Math.isPowerOfTwo( image.height ) === false ) {
+
+						var width = nearest_pow2( image.width );
+						var height = nearest_pow2( image.height );
+
+						texture.image.width = width;
+						texture.image.height = height;
+						texture.image.getContext( '2d' ).drawImage( image, 0, 0, width, height );
+
+					} else {
+
+						texture.image = image;
+
+					}
+
+					texture.needsUpdate = true;
+
+				} );
 
 			}
 

+ 11 - 0
src/loaders/XHRLoader.js

@@ -14,6 +14,15 @@ THREE.XHRLoader.prototype = {
 
 	load: function ( url, onLoad, onProgress, onError ) {
 
+		var cached = THREE.Cache.get( url );
+
+		if ( cached !== undefined ) {
+
+			onLoad( cached );
+			return;
+
+		}
+
 		var scope = this;
 		var request = new XMLHttpRequest();
 
@@ -21,6 +30,8 @@ THREE.XHRLoader.prototype = {
 
 			request.addEventListener( 'load', function ( event ) {
 
+				THREE.Cache.add( url, event.target.responseText );
+
 				onLoad( event.target.responseText );
 				scope.manager.itemEnd( url );
 

+ 18 - 0
src/math/Vector2.js

@@ -133,6 +133,15 @@ THREE.Vector2.prototype = {
 		return this;
 
 	},
+	
+	multiply: function ( v ) {
+
+		this.x *= v.x;
+		this.y *= v.y;
+
+		return this;
+
+	},
 
 	multiplyScalar: function ( s ) {
 
@@ -143,6 +152,15 @@ THREE.Vector2.prototype = {
 
 	},
 
+	divide: function ( v ) {
+
+		this.x /= v.x;
+		this.y /= v.y;
+
+		return this;
+
+	},
+
 	divideScalar: function ( scalar ) {
 
 		if ( scalar !== 0 ) {

+ 1 - 1
utils/build/build.js

@@ -68,7 +68,7 @@ function main() {
 
 		var result = uglify.minify( sources, { outSourceMap: sourcemap } );
 		
-		fs.writeFileSync( output, result.code + sourcemapping, 'utf8' );
+		fs.writeFileSync( output, 'three.js / threejs.org/license\n' + result.code + sourcemapping, 'utf8' );
 
 		if ( args.sourcemaps ) {
 

+ 1 - 1
utils/build/build.py

@@ -79,7 +79,7 @@ def main(argv=None):
 		# header
 
 		with open(output,'r') as f: text = f.read()
-		with open(output,'w') as f: f.write('// three.js - http://github.com/mrdoob/three.js\n' + text + sourcemapping)
+		with open(output,'w') as f: f.write('// three.js / threejs.org/license\n' + text + sourcemapping)
 
 	os.close(fd)
 	os.remove(path)

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

@@ -41,6 +41,7 @@
 	"src/lights/HemisphereLight.js",
 	"src/lights/PointLight.js",
 	"src/lights/SpotLight.js",
+	"src/loaders/Cache.js",
 	"src/loaders/Loader.js",
 	"src/loaders/XHRLoader.js",
 	"src/loaders/ImageLoader.js",

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels