Browse Source

Updated builds.

Mr.doob 9 years ago
parent
commit
2725e5d5a7
2 changed files with 10 additions and 19 deletions
  1. 5 13
      build/three.js
  2. 5 6
      build/three.min.js

+ 5 - 13
build/three.js

@@ -28325,24 +28325,16 @@ THREE.ImageUtils = {
 
 
 	loadTexture: function ( url, mapping, onLoad, onError ) {
 	loadTexture: function ( url, mapping, onLoad, onError ) {
 
 
-		var loader = new THREE.ImageLoader();
-		loader.crossOrigin = this.crossOrigin;
-
-		var texture = new THREE.Texture( undefined, mapping );
-
-		loader.load( url, function ( image ) {
+		var loader = new THREE.TextureLoader();
+		loader.setCrossOrigin( this.crossOrigin );
 
 
-			texture.image = image;
-			texture.needsUpdate = true;
+		var texture = loader.load( url, function ( texture ) {
 
 
 			if ( onLoad ) onLoad( texture );
 			if ( onLoad ) onLoad( texture );
 
 
-		}, undefined, function ( event ) {
-
-			if ( onError ) onError( event );
-
-		} );
+		}, undefined, onError );
 
 
+		texture.mapping = mapping;
 		texture.sourceFile = url;
 		texture.sourceFile = url;
 
 
 		return texture;
 		return texture;

+ 5 - 6
build/three.min.js

@@ -688,12 +688,11 @@ B.enable(v.BLEND);v.bindBuffer(v.ARRAY_BUFFER,A);v.vertexAttribPointer(w,2,v.FLO
 (v.uniform1i(p,0),I=N=0);for(var D=0,L=b.length;D<L;D++){var U=b[D];U.modelViewMatrix.multiplyMatrices(Q.matrixWorldInverse,U.matrixWorld);U.z=-U.modelViewMatrix.elements[14]}b.sort(E);for(var P=[],D=0,L=b.length;D<L;D++){var U=b[D],R=U.material;v.uniform1f(u,R.alphaTest);v.uniformMatrix4fv(k,!1,U.modelViewMatrix.elements);U.matrixWorld.decompose(F,C,M);P[0]=M.x;P[1]=M.y;U=0;K.fog&&R.fog&&(U=I);N!==U&&(v.uniform1i(p,U),N=U);null!==R.map?(v.uniform2f(c,R.map.offset.x,R.map.offset.y),v.uniform2f(d,
 (v.uniform1i(p,0),I=N=0);for(var D=0,L=b.length;D<L;D++){var U=b[D];U.modelViewMatrix.multiplyMatrices(Q.matrixWorldInverse,U.matrixWorld);U.z=-U.modelViewMatrix.elements[14]}b.sort(E);for(var P=[],D=0,L=b.length;D<L;D++){var U=b[D],R=U.material;v.uniform1f(u,R.alphaTest);v.uniformMatrix4fv(k,!1,U.modelViewMatrix.elements);U.matrixWorld.decompose(F,C,M);P[0]=M.x;P[1]=M.y;U=0;K.fog&&R.fog&&(U=I);N!==U&&(v.uniform1i(p,U),N=U);null!==R.map?(v.uniform2f(c,R.map.offset.x,R.map.offset.y),v.uniform2f(d,
 R.map.repeat.x,R.map.repeat.y)):(v.uniform2f(c,0,0),v.uniform2f(d,1,1));v.uniform1f(l,R.opacity);v.uniform3f(f,R.color.r,R.color.g,R.color.b);v.uniform1f(e,R.rotation);v.uniform2fv(g,P);B.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst);B.setDepthTest(R.depthTest);B.setDepthWrite(R.depthWrite);R.map&&R.map.image&&R.map.image.width?a.setTexture(R.map,0):a.setTexture(H,0);v.drawElements(v.TRIANGLES,6,v.UNSIGNED_SHORT,0)}B.enable(v.CULL_FACE);a.resetGLState()}}};
 R.map.repeat.x,R.map.repeat.y)):(v.uniform2f(c,0,0),v.uniform2f(d,1,1));v.uniform1f(l,R.opacity);v.uniform3f(f,R.color.r,R.color.g,R.color.b);v.uniform1f(e,R.rotation);v.uniform2fv(g,P);B.setBlending(R.blending,R.blendEquation,R.blendSrc,R.blendDst);B.setDepthTest(R.depthTest);B.setDepthWrite(R.depthWrite);R.map&&R.map.image&&R.map.image.width?a.setTexture(R.map,0):a.setTexture(H,0);v.drawElements(v.TRIANGLES,6,v.UNSIGNED_SHORT,0)}B.enable(v.CULL_FACE);a.resetGLState()}}};
 THREE.GeometryUtils={merge:function(a,b,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry);a.merge(b,d,c)},center:function(a){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return a.center()}};
 THREE.GeometryUtils={merge:function(a,b,c){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var d;b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),d=b.matrix,b=b.geometry);a.merge(b,d,c)},center:function(a){console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead.");return a.center()}};
-THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){var e=new THREE.ImageLoader;e.crossOrigin=this.crossOrigin;var g=new THREE.Texture(void 0,b);e.load(a,function(a){g.image=a;g.needsUpdate=!0;c&&c(g)},void 0,function(a){d&&d(a)});g.sourceFile=a;return g},loadTextureCube:function(a,b,c,d){function e(b){g.load(a[b],function(a){f.images[b]=a;h+=1;6===h&&(f.needsUpdate=!0,c&&c(f))},void 0,d)}var g=new THREE.ImageLoader;g.crossOrigin=this.crossOrigin;var f=new THREE.CubeTexture([],b),h=
-0;b=0;for(var l=a.length;b<l;++b)e(b);return f},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(a,b){function c(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]}b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");
-g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,l=f.createImageData(d,e),k=l.data,n=0;n<d;n++)for(var p=0;p<e;p++){var m=0>p-1?0:p-1,q=p+1>e-1?e-1:p+1,t=0>n-1?0:n-1,s=n+1>d-1?d-1:n+1,u=[],w=[0,0,h[4*(p*d+n)]/255*b];u.push([-1,0,h[4*(p*d+t)]/255*b]);u.push([-1,-1,h[4*(m*d+t)]/255*b]);u.push([0,-1,h[4*(m*d+n)]/255*b]);u.push([1,-1,h[4*(m*d+s)]/255*b]);u.push([1,0,h[4*(p*d+s)]/255*b]);u.push([1,1,h[4*(q*d+s)]/255*b]);u.push([0,1,h[4*(q*d+n)]/255*
-b]);u.push([-1,1,h[4*(q*d+t)]/255*b]);m=[];t=u.length;for(q=0;q<t;q++){var s=u[q],x=u[(q+1)%t],s=[s[0]-w[0],s[1]-w[1],s[2]-w[2]],x=[x[0]-w[0],x[1]-w[1],x[2]-w[2]];m.push(c([s[1]*x[2]-s[2]*x[1],s[2]*x[0]-s[0]*x[2],s[0]*x[1]-s[1]*x[0]]))}u=[0,0,0];for(q=0;q<m.length;q++)u[0]+=m[q][0],u[1]+=m[q][1],u[2]+=m[q][2];u[0]/=m.length;u[1]/=m.length;u[2]/=m.length;w=4*(p*d+n);k[w]=(u[0]+1)/2*255|0;k[w+1]=(u[1]+1)/2*255|0;k[w+2]=255*u[2]|0;k[w+3]=255}f.putImageData(l,0,0);return g},generateDataTexture:function(a,
-b,c){var d=a*b,e=new Uint8Array(3*d),g=Math.floor(255*c.r),f=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*h]=g,e[3*h+1]=f,e[3*h+2]=c;a=new THREE.DataTexture(e,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
-THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Group,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
+THREE.ImageUtils={crossOrigin:void 0,loadTexture:function(a,b,c,d){var e=new THREE.TextureLoader;e.setCrossOrigin(this.crossOrigin);d=e.load(a,function(a){c&&c(a)},void 0,d);d.mapping=b;d.sourceFile=a;return d},loadTextureCube:function(a,b,c,d){function e(b){g.load(a[b],function(a){f.images[b]=a;h+=1;6===h&&(f.needsUpdate=!0,c&&c(f))},void 0,d)}var g=new THREE.ImageLoader;g.crossOrigin=this.crossOrigin;var f=new THREE.CubeTexture([],b),h=0;b=0;for(var l=a.length;b<l;++b)e(b);return f},loadCompressedTexture:function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},
+loadCompressedTextureCube:function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")},getNormalMap:function(a,b){function c(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]}b|=1;var d=a.width,e=a.height,g=document.createElement("canvas");g.width=d;g.height=e;var f=g.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,e).data,l=f.createImageData(d,e),k=l.data,n=0;n<d;n++)for(var p=0;p<e;p++){var m=
+0>p-1?0:p-1,q=p+1>e-1?e-1:p+1,t=0>n-1?0:n-1,s=n+1>d-1?d-1:n+1,u=[],w=[0,0,h[4*(p*d+n)]/255*b];u.push([-1,0,h[4*(p*d+t)]/255*b]);u.push([-1,-1,h[4*(m*d+t)]/255*b]);u.push([0,-1,h[4*(m*d+n)]/255*b]);u.push([1,-1,h[4*(m*d+s)]/255*b]);u.push([1,0,h[4*(p*d+s)]/255*b]);u.push([1,1,h[4*(q*d+s)]/255*b]);u.push([0,1,h[4*(q*d+n)]/255*b]);u.push([-1,1,h[4*(q*d+t)]/255*b]);m=[];t=u.length;for(q=0;q<t;q++){var s=u[q],x=u[(q+1)%t],s=[s[0]-w[0],s[1]-w[1],s[2]-w[2]],x=[x[0]-w[0],x[1]-w[1],x[2]-w[2]];m.push(c([s[1]*
+x[2]-s[2]*x[1],s[2]*x[0]-s[0]*x[2],s[0]*x[1]-s[1]*x[0]]))}u=[0,0,0];for(q=0;q<m.length;q++)u[0]+=m[q][0],u[1]+=m[q][1],u[2]+=m[q][2];u[0]/=m.length;u[1]/=m.length;u[2]/=m.length;w=4*(p*d+n);k[w]=(u[0]+1)/2*255|0;k[w+1]=(u[1]+1)/2*255|0;k[w+2]=255*u[2]|0;k[w+3]=255}f.putImageData(l,0,0);return g},generateDataTexture:function(a,b,c){var d=a*b,e=new Uint8Array(3*d),g=Math.floor(255*c.r),f=Math.floor(255*c.g);c=Math.floor(255*c.b);for(var h=0;h<d;h++)e[3*h]=g,e[3*h+1]=f,e[3*h+2]=c;a=new THREE.DataTexture(e,
+a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};THREE.SceneUtils={createMultiMaterialObject:function(a,b){for(var c=new THREE.Group,d=0,e=b.length;d<e;d++)c.add(new THREE.Mesh(a,b[d]));return c},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face.toLowerCase()][this.weight][this.style]}catch(a){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing.";}},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){try{return this.faces[this.face.toLowerCase()][this.weight][this.style]}catch(a){throw"The font "+this.face+" with "+this.weight+" weight and "+this.style+" style is missing.";}},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=
 a},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=String(a).split(""),g=e.length,f=[];for(a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,l,k,n,p,m,q,t,s,u,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o)for(b=w._cachedOutline||(w._cachedOutline=w.o.split(" ")),k=b.length,a=0;a<k;)switch(l=b[a++],l){case "m":l=b[a++]*c+d;n=b[a++]*c;e.moveTo(l,n);
 a},drawText:function(a){var b=this.getFace(),c=this.size/b.resolution,d=0,e=String(a).split(""),g=e.length,f=[];for(a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,l,k,n,p,m,q,t,s,u,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o)for(b=w._cachedOutline||(w._cachedOutline=w.o.split(" ")),k=b.length,a=0;a<k;)switch(l=b[a++],l){case "m":l=b[a++]*c+d;n=b[a++]*c;e.moveTo(l,n);
 break;case "l":l=b[a++]*c+d;n=b[a++]*c;e.lineTo(l,n);break;case "q":l=b[a++]*c+d;n=b[a++]*c;q=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(q,t,l,n);if(f=g[g.length-1])for(p=f.x,m=f.y,f=1,h=this.divisions;f<=h;f++){var x=f/h;THREE.Shape.Utils.b2(x,p,q,l);THREE.Shape.Utils.b2(x,m,t,n)}break;case "b":if(l=b[a++]*c+d,n=b[a++]*c,q=b[a++]*c+d,t=b[a++]*c,s=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(q,t,s,u,l,n),f=g[g.length-1])for(p=f.x,m=f.y,f=1,h=this.divisions;f<=h;f++)x=f/h,THREE.Shape.Utils.b3(x,p,q,s,l),THREE.Shape.Utils.b3(x,
 break;case "l":l=b[a++]*c+d;n=b[a++]*c;e.lineTo(l,n);break;case "q":l=b[a++]*c+d;n=b[a++]*c;q=b[a++]*c+d;t=b[a++]*c;e.quadraticCurveTo(q,t,l,n);if(f=g[g.length-1])for(p=f.x,m=f.y,f=1,h=this.divisions;f<=h;f++){var x=f/h;THREE.Shape.Utils.b2(x,p,q,l);THREE.Shape.Utils.b2(x,m,t,n)}break;case "b":if(l=b[a++]*c+d,n=b[a++]*c,q=b[a++]*c+d,t=b[a++]*c,s=b[a++]*c+d,u=b[a++]*c,e.bezierCurveTo(q,t,s,u,l,n),f=g[g.length-1])for(p=f.x,m=f.y,f=1,h=this.divisions;f<=h;f++)x=f/h,THREE.Shape.Utils.b3(x,p,q,s,l),THREE.Shape.Utils.b3(x,