Explorar o código

Updated builds.

Mr.doob %!s(int64=12) %!d(string=hai) anos
pai
achega
fde5632b36
Modificáronse 2 ficheiros con 10 adicións e 31 borrados
  1. 3 24
      build/three.js
  2. 7 7
      build/three.min.js

+ 3 - 24
build/three.js

@@ -18,27 +18,6 @@ self.console = self.console || {
 self.Int32Array = self.Int32Array || Array;
 self.Float32Array = self.Float32Array || Array;
 
-// Shims for "startsWith", "endsWith", and "trim" for browsers where this is not yet implemented
-// not sure we should have this, or at least not have it here
-
-// http://stackoverflow.com/questions/646628/javascript-startswith
-// http://stackoverflow.com/questions/498970/how-do-i-trim-a-string-in-javascript
-// http://wiki.ecmascript.org/doku.php?id=harmony%3astring_extras
-
-String.prototype.startsWith = String.prototype.startsWith || function ( str ) {
-
-	return this.slice( 0, str.length ) === str;
-
-};
-
-String.prototype.endsWith = String.prototype.endsWith || function ( str ) {
-
-	var t = String( str );
-	var index = this.lastIndexOf( t );
-	return ( -1 < index && index ) === (this.length - t.length);
-
-};
-
 String.prototype.trim = String.prototype.trim || function () {
 
 	return this.replace( /^\s+|\s+$/g, '' );
@@ -9061,7 +9040,7 @@ THREE.Loader.prototype = {
 
 		function create_texture( where, name, sourceFile, repeat, offset, wrap, anisotropy ) {
 
-			var isCompressed = sourceFile.toLowerCase().endsWith( ".dds" );
+			var isCompressed = /\.dds$/i.test( sourceFile );
 			var fullPath = texturePath + "/" + sourceFile;
 
 			if ( isCompressed ) {
@@ -10764,7 +10743,7 @@ THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
 
 			}
 
-			var isCompressed = url_array[ 0 ].endsWith( ".dds" );
+			var isCompressed = /\.dds$/i.test( url_array[ 0 ] );
 
 			if ( isCompressed ) {
 
@@ -10778,7 +10757,7 @@ THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
 
 		} else {
 
-			var isCompressed = textureJSON.url.toLowerCase().endsWith( ".dds" );
+			var isCompressed = /\.dds$/i.test( textureJSON.url );
 			var fullUrl = get_url( textureJSON.url, data.urlBaseType );
 			var textureCallback = generateTextureCallback( 1 );
 

+ 7 - 7
build/three.min.js

@@ -1,6 +1,6 @@
 // three.js - http://github.com/mrdoob/three.js
-'use strict';var THREE=THREE||{REVISION:"56dev"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};self.Int32Array=self.Int32Array||Array;self.Float32Array=self.Float32Array||Array;String.prototype.startsWith=String.prototype.startsWith||function(a){return this.slice(0,a.length)===a};String.prototype.endsWith=String.prototype.endsWith||function(a){var a=String(a),b=this.lastIndexOf(a);return(-1<b&&b)===this.length-a.length};
-String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};THREE.extend=function(a,b){if(Object.keys)for(var c=Object.keys(b),d=0,e=c.length;d<e;d++){var f=c[d];Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(b,f))}else for(f in c={}.hasOwnProperty,b)c.call(b,f)&&(a[f]=b[f]);return a};
+'use strict';var THREE=THREE||{REVISION:"56dev"};self.console=self.console||{info:function(){},log:function(){},debug:function(){},warn:function(){},error:function(){}};self.Int32Array=self.Int32Array||Array;self.Float32Array=self.Float32Array||Array;String.prototype.trim=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")};
+THREE.extend=function(a,b){if(Object.keys)for(var c=Object.keys(b),d=0,e=c.length;d<e;d++){var f=c[d];Object.defineProperty(a,f,Object.getOwnPropertyDescriptor(b,f))}else for(f in c={}.hasOwnProperty,b)c.call(b,f)&&(a[f]=b[f]);return a};
 (function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];void 0===window.requestAnimationFrame&&(window.requestAnimationFrame=function(b){var c=Date.now(),f=Math.max(0,16-(c-a)),g=window.setTimeout(function(){b(c+f)},f);a=c+f;return g});window.cancelAnimationFrame=window.cancelAnimationFrame||
 function(a){window.clearTimeout(a)}})();THREE.CullFaceNone=0;THREE.CullFaceBack=1;THREE.CullFaceFront=2;THREE.CullFaceFrontBack=3;THREE.FrontFaceDirectionCW=0;THREE.FrontFaceDirectionCCW=1;THREE.BasicShadowMap=0;THREE.PCFShadowMap=1;THREE.PCFSoftShadowMap=2;THREE.FrontSide=0;THREE.BackSide=1;THREE.DoubleSide=2;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;
 THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THREE.AddEquation=100;THREE.SubtractEquation=101;THREE.ReverseSubtractEquation=102;THREE.ZeroFactor=200;THREE.OneFactor=201;THREE.SrcColorFactor=202;THREE.OneMinusSrcColorFactor=203;THREE.SrcAlphaFactor=204;THREE.OneMinusSrcAlphaFactor=205;THREE.DstAlphaFactor=206;THREE.OneMinusDstAlphaFactor=207;THREE.DstColorFactor=208;THREE.OneMinusDstColorFactor=209;THREE.SrcAlphaSaturateFactor=210;THREE.MultiplyOperation=0;
@@ -182,9 +182,9 @@ new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,
 this.shadowMapSize=this.shadowMap=null};THREE.SpotLight.prototype=Object.create(THREE.Light.prototype);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ",b=a.total?b+((100*a.loaded/
 a.total).toFixed(0)+"%"):b+((a.loaded/1E3).toFixed(2)+" KB");this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(1>a.length?".":a.join("/"))+"/"},initMaterials:function(a,b){for(var c=[],d=0;d<a.length;++d)c[d]=THREE.Loader.prototype.createMaterial(a[d],b);return c},needsTangents:function(a){for(var b=0,c=a.length;b<c;b++)if(a[b]instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,i,h,j,q){var w=f.toLowerCase().endsWith(".dds"),v=b+"/"+f;if(w){var y=THREE.ImageUtils.loadCompressedTexture(v);a[e]=y}else y=document.createElement("canvas"),a[e]=new THREE.Texture(y);a[e].sourceFile=f;i&&(a[e].repeat.set(i[0],i[1]),1!==i[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==i[1]&&(a[e].wrapT=THREE.RepeatWrapping));h&&a[e].offset.set(h[0],h[1]);j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
-void 0!==f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]&&(a[e].wrapT=f[j[1]]));q&&(a[e].anisotropy=q);if(!w){var z=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);z.image.width=a;z.image.height=b;z.image.getContext("2d").drawImage(this,0,0,a,b)}else z.image=this;z.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=v}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,
-map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?h="MeshPhongMaterial":"basic"===j&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,i,h,j,q){var w=/\.dds$/i.test(f),v=b+"/"+f;if(w){var y=THREE.ImageUtils.loadCompressedTexture(v);a[e]=y}else y=document.createElement("canvas"),a[e]=new THREE.Texture(y);a[e].sourceFile=f;i&&(a[e].repeat.set(i[0],i[1]),1!==i[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==i[1]&&(a[e].wrapT=THREE.RepeatWrapping));h&&a[e].offset.set(h[0],h[1]);j&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==
+f[j[0]]&&(a[e].wrapS=f[j[0]]),void 0!==f[j[1]]&&(a[e].wrapT=f[j[1]]));q&&(a[e].anisotropy=q);if(!w){var z=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);z.image.width=a;z.image.height=b;z.image.getContext("2d").drawImage(this,0,0,a,b)}else z.image=this;z.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=v}}function f(a){return(255*a[0]<<16)+(255*a[1]<<8)+255*a[2]}var g=this,h="MeshLambertMaterial",i={color:15658734,opacity:1,map:null,
+lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var j=a.shading.toLowerCase();"phong"===j?h="MeshPhongMaterial":"basic"===j&&(h="MeshBasicMaterial")}void 0!==a.blending&&void 0!==THREE[a.blending]&&(i.blending=THREE[a.blending]);if(void 0!==a.transparent||1>a.opacity)i.transparent=a.transparent;void 0!==a.depthTest&&(i.depthTest=a.depthTest);void 0!==a.depthWrite&&(i.depthWrite=a.depthWrite);void 0!==a.visible&&(i.visible=a.visible);void 0!==a.flipSided&&(i.side=THREE.BackSide);
 void 0!==a.doubleSided&&(i.side=THREE.DoubleSide);void 0!==a.wireframe&&(i.wireframe=a.wireframe);void 0!==a.vertexColors&&("face"===a.vertexColors?i.vertexColors=THREE.FaceColors:a.vertexColors&&(i.vertexColors=THREE.VertexColors));a.colorDiffuse?i.color=f(a.colorDiffuse):a.DbgColor&&(i.color=a.DbgColor);a.colorSpecular&&(i.specular=f(a.colorSpecular));a.colorAmbient&&(i.ambient=f(a.colorAmbient));a.transparency&&(i.opacity=a.transparency);a.specularCoef&&(i.shininess=a.specularCoef);a.mapDiffuse&&
 b&&e(i,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);a.mapLight&&b&&e(i,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);a.mapBump&&b&&e(i,"bumpMap",a.mapBump,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);a.mapNormal&&b&&e(i,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);a.mapSpecular&&b&&e(i,"specularMap",a.mapSpecular,a.mapSpecularRepeat,
 a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);a.mapBumpScale&&(i.bumpScale=a.mapBumpScale);a.mapNormal?(h=THREE.ShaderLib.normalmap,j=THREE.UniformsUtils.clone(h.uniforms),j.tNormal.value=i.normalMap,a.mapNormalFactor&&j.uNormalScale.value.set(a.mapNormalFactor,a.mapNormalFactor),i.map&&(j.tDiffuse.value=i.map,j.enableDiffuse.value=!0),i.specularMap&&(j.tSpecular.value=i.specularMap,j.enableSpecular.value=!0),i.lightMap&&(j.tAO.value=i.lightMap,j.enableAO.value=!0),j.uDiffuseColor.value.setHex(i.color),
@@ -211,8 +211,8 @@ this.hierarchyHandlerMap[B].loaderObject=new a;r=z=0;l={scene:new THREE.Scene,ge
 for(var N in F.fogs)a=F.fogs[N],"linear"===a.type?p=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(p=new THREE.FogExp2(0,a.density)),a=a.color,p.color.setRGB(a[0],a[1],a[2]),l.fogs[N]=p;for(var A in F.geometries)p=F.geometries[A],p.type in this.geometryHandlerMap&&(z+=1,k.onLoadStart());for(var Q in F.objects)p=F.objects[Q],p.type&&p.type in this.hierarchyHandlerMap&&(z+=1,k.onLoadStart());E=z;for(A in F.geometries)if(p=F.geometries[A],"cube"===p.type)m=new THREE.CubeGeometry(p.width,p.height,p.depth,
 p.widthSegments,p.heightSegments,p.depthSegments),l.geometries[A]=m;else if("plane"===p.type)m=new THREE.PlaneGeometry(p.width,p.height,p.widthSegments,p.heightSegments),l.geometries[A]=m;else if("sphere"===p.type)m=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),l.geometries[A]=m;else if("cylinder"===p.type)m=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),l.geometries[A]=m;else if("torus"===p.type)m=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,
 p.segmentsT),l.geometries[A]=m;else if("icosahedron"===p.type)m=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),l.geometries[A]=m;else if(p.type in this.geometryHandlerMap){Q={};for(q in p)"type"!==q&&"url"!==q&&(Q[q]=p[q]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,F.urlBaseType),g(A),Q)}else"embedded"===p.type&&(Q=F.embeds[p.id],Q.metadata=F.metadata,Q&&this.geometryHandlerMap.ascii.loaderObject.createModel(Q,i(A),""));for(var C in F.textures)if(A=F.textures[C],A.url instanceof
-Array){r+=A.url.length;for(q=0;q<A.url.length;q++)k.onLoadStart()}else r+=1,k.onLoadStart();D=r;for(C in F.textures){A=F.textures[C];void 0!==A.mapping&&void 0!==THREE[A.mapping]&&(A.mapping=new THREE[A.mapping]);if(A.url instanceof Array){Q=A.url.length;p=[];for(q=0;q<Q;q++)p[q]=d(A.url[q],F.urlBaseType);q=(q=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,A.mapping,B(Q)):THREE.ImageUtils.loadTextureCube(p,A.mapping,B(Q))}else q=A.url.toLowerCase().endsWith(".dds"),Q=d(A.url,
-F.urlBaseType),p=B(1),q=q?THREE.ImageUtils.loadCompressedTexture(Q,A.mapping,p):THREE.ImageUtils.loadTexture(Q,A.mapping,p),void 0!==THREE[A.minFilter]&&(q.minFilter=THREE[A.minFilter]),void 0!==THREE[A.magFilter]&&(q.magFilter=THREE[A.magFilter]),A.anisotropy&&(q.anisotropy=A.anisotropy),A.repeat&&(q.repeat.set(A.repeat[0],A.repeat[1]),1!==A.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==A.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),A.offset&&q.offset.set(A.offset[0],A.offset[1]),A.wrap&&(Q={repeat:THREE.RepeatWrapping,
+Array){r+=A.url.length;for(q=0;q<A.url.length;q++)k.onLoadStart()}else r+=1,k.onLoadStart();D=r;for(C in F.textures){A=F.textures[C];void 0!==A.mapping&&void 0!==THREE[A.mapping]&&(A.mapping=new THREE[A.mapping]);if(A.url instanceof Array){Q=A.url.length;p=[];for(q=0;q<Q;q++)p[q]=d(A.url[q],F.urlBaseType);q=(q=/\.dds$/i.test(p[0]))?THREE.ImageUtils.loadCompressedTextureCube(p,A.mapping,B(Q)):THREE.ImageUtils.loadTextureCube(p,A.mapping,B(Q))}else q=/\.dds$/i.test(A.url),Q=d(A.url,F.urlBaseType),p=
+B(1),q=q?THREE.ImageUtils.loadCompressedTexture(Q,A.mapping,p):THREE.ImageUtils.loadTexture(Q,A.mapping,p),void 0!==THREE[A.minFilter]&&(q.minFilter=THREE[A.minFilter]),void 0!==THREE[A.magFilter]&&(q.magFilter=THREE[A.magFilter]),A.anisotropy&&(q.anisotropy=A.anisotropy),A.repeat&&(q.repeat.set(A.repeat[0],A.repeat[1]),1!==A.repeat[0]&&(q.wrapS=THREE.RepeatWrapping),1!==A.repeat[1]&&(q.wrapT=THREE.RepeatWrapping)),A.offset&&q.offset.set(A.offset[0],A.offset[1]),A.wrap&&(Q={repeat:THREE.RepeatWrapping,
 mirror:THREE.MirroredRepeatWrapping},void 0!==Q[A.wrap[0]]&&(q.wrapS=Q[A.wrap[0]]),void 0!==Q[A.wrap[1]]&&(q.wrapT=Q[A.wrap[1]]));l.textures[C]=q}var G,t;for(G in F.materials){C=F.materials[G];for(t in C.parameters)"envMap"===t||"map"===t||"lightMap"===t||"bumpMap"===t?C.parameters[t]=l.textures[C.parameters[t]]:"shading"===t?C.parameters[t]="flat"===C.parameters[t]?THREE.FlatShading:THREE.SmoothShading:"side"===t?C.parameters[t]="double"==C.parameters[t]?THREE.DoubleSide:"back"==C.parameters[t]?
 THREE.BackSide:THREE.FrontSide:"blending"===t?C.parameters[t]=C.parameters[t]in THREE?THREE[C.parameters[t]]:THREE.NormalBlending:"combine"===t?C.parameters[t]=C.parameters[t]in THREE?THREE[C.parameters[t]]:THREE.MultiplyOperation:"vertexColors"===t?"face"==C.parameters[t]?C.parameters[t]=THREE.FaceColors:C.parameters[t]&&(C.parameters[t]=THREE.VertexColors):"wrapRGB"===t&&(B=C.parameters[t],C.parameters[t]=new THREE.Vector3(B[0],B[1],B[2]));void 0!==C.parameters.opacity&&1>C.parameters.opacity&&
 (C.parameters.transparent=!0);C.parameters.normalMap?(B=THREE.ShaderLib.normalmap,A=THREE.UniformsUtils.clone(B.uniforms),q=C.parameters.color,Q=C.parameters.specular,p=C.parameters.ambient,N=C.parameters.shininess,A.tNormal.value=l.textures[C.parameters.normalMap],C.parameters.normalScale&&A.uNormalScale.value.set(C.parameters.normalScale[0],C.parameters.normalScale[1]),C.parameters.map&&(A.tDiffuse.value=C.parameters.map,A.enableDiffuse.value=!0),C.parameters.envMap&&(A.tCube.value=C.parameters.envMap,