瀏覽代碼

Added overrideMimeType check also to CTMLoader.

alteredq 13 年之前
父節點
當前提交
773c30b253
共有 3 個文件被更改,包括 9 次插入9 次删除
  1. 4 4
      build/Three.js
  2. 4 4
      build/custom/ThreeExtras.js
  3. 1 1
      examples/js/ctm/CTMLoader.js

+ 4 - 4
build/Three.js

@@ -527,7 +527,7 @@ THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THRE
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-0.5*((Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI),0.5-f.y/2),new THREE.UV(1-
 0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,f);c(0,5,1,
 f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),j=d(f.faces[h].b,f.faces[h].c),l=d(f.faces[h].c,f.faces[h].a);c(f.faces[h].a,i,l,a);c(f.faces[h].b,j,i,a);c(f.faces[h].c,l,j,a);c(i,j,l,a)}f.faces=a.faces;f.faceVertexUvs[0]=
-a.faceVertexUvs[0]}e.faces=f.faces;e.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+a.faceVertexUvs[0]}e.faces=f.faces;e.faceVertexUvs[0]=f.faceVertexUvs[0];this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=g.vertices.push(c)-1;var d=Math.atan2(b.z,-b.x)/2/Math.PI+0.5,b=Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5;c.uv=new THREE.UV(d,b);return c}function d(a,b,c,h){1>h?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
@@ -574,7 +574,7 @@ j.lightMap,l.enableAO.value=!0;l.uDiffuseColor.value.setHex(j.color);l.uSpecular
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status)try{var h=JSON.parse(g.responseText);void 0===h.metadata||void 0===h.metadata.formatVersion||3!==h.metadata.formatVersion?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
-g.status+"]")};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
+g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);
 f.responseType="arraybuffer";f.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,j,l,o,p,n,q,m,r,s,t,u,x,v;function A(a){return a%4?4-a%4:0}function D(a,b){return(new Uint8Array(a,b,1))[0]}function E(a,b){return(new Uint32Array(a,b,1))[0]}function C(b,c){var d,e,f,g,h,i,k,j,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[3*d];f=l[3*d+1];g=l[3*d+2];h=H[2*e];e=H[2*e+1];i=H[2*f];k=H[2*f+1];f=H[2*g];j=H[2*g+1];g=P.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,k));
@@ -653,7 +653,7 @@ function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(ca=c
 THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){try{var h=JSON.parse(f.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+f.status+"]");else 3==f.readyState?e&&(0==g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):
-2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,j,l,o,p,n,q,m,r,s,t,u,x=a.faces;o=a.vertices;var v=a.normals,A=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(l=o.length;j<
 l;)p=new THREE.Vertex,p.position.x=o[j++]*b,p.position.y=o[j++]*b,p.position.z=o[j++]*b,d.vertices.push(p);j=0;for(l=x.length;j<l;){b=x[j++];o=b&1;i=b&2;c=b&4;e=b&8;n=b&16;p=b&32;m=b&64;b&=128;o?(r=new THREE.Face4,r.a=x[j++],r.b=x[j++],r.c=x[j++],r.d=x[j++],o=4):(r=new THREE.Face3,r.a=x[j++],r.b=x[j++],r.c=x[j++],o=3);if(i)i=x[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<D;c++)s=a.uvs[c],q=x[j++],u=s[2*q],q=s[2*q+1],d.faceUvs[c][i]=new THREE.UV(u,q);if(e)for(c=0;c<D;c++){s=a.uvs[c];t=[];
 for(e=0;e<o;e++)q=x[j++],u=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(u,q);d.faceVertexUvs[c][i]=t}if(n)n=3*x[j++],e=new THREE.Vector3,e.x=v[n++],e.y=v[n++],e.z=v[n],r.normal=e;if(p)for(c=0;c<o;c++)n=3*x[j++],e=new THREE.Vector3,e.x=v[n++],e.y=v[n++],e.z=v[n],r.vertexNormals.push(e);if(m)p=x[j++],p=new THREE.Color(A[p]),r.color=p;if(b)for(c=0;c<o;c++)p=x[j++],p=new THREE.Color(A[p]),r.vertexColors.push(p);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
@@ -661,7 +661,7 @@ for(e=0;e<o;e++)q=x[j++],u=s[2*q],q=s[2*q+1],t[e]=new THREE.UV(u,q);d.faceVertex
 q=a.morphTargets[c].vertices;for(i=0,j=q.length;i<j;i+=3)l=q[i]*b,o=q[i+1]*b,p=q[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(l,o,p)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;l=a.morphColors[c].colors;for(b=0,i=l.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(l[b],l[b+1],l[b+2]),j.push(o)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status)try{var e=JSON.parse(d.responseText);void 0===e.metadata||void 0===e.metadata.formatVersion||3!==e.metadata.formatVersion?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
-d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
+d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
 THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:j+"/"+a}function e(){var a;for(p in N.objects)if(!y.objects[p])if(s=N.objects[p],void 0!==s.geometry){if(F=y.geometries[s.geometry]){a=!1;for(I=0;I<s.materials.length;I++)R=y.materials[s.materials[I]],a=R instanceof THREE.ShaderMaterial;a&&F.computeTangents();x=s.position;v=s.rotation;A=s.quaternion;D=s.scale;A=0;0==R.length&&(R=new THREE.MeshFaceMaterial);1<R.length&&(R=new THREE.MeshFaceMaterial);
 a=new THREE.Mesh(F,R);a.name=p;a.position.set(x[0],x[1],x[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(D[0],D[1],D[2]);a.visible=s.visible;y.scene.add(a);y.objects[p]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);y.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(F),y.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&"none"!=s.trigger.toLowerCase()&&(b=
 {type:s.trigger,object:s},y.triggers[a.name]=b)}}else x=s.position,v=s.rotation,A=s.quaternion,D=s.scale,A=0,a=new THREE.Object3D,a.name=p,a.position.set(x[0],x[1],x[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(D[0],D[1],D[2]),a.visible=void 0!==s.visible?s.visible:!1,y.scene.add(a),y.objects[p]=a,y.empties[p]=a,s.trigger&&"none"!=s.trigger.toLowerCase()&&(b={type:s.trigger,object:s},y.triggers[a.name]=b)}function f(a){return function(b){y.geometries[a]=

+ 4 - 4
build/custom/ThreeExtras.js

@@ -175,7 +175,7 @@ THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THRE
 THREE.IcosahedronGeometry=function(a){function b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-0.5*((Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI),0.5-f.y/2),new THREE.UV(1-
 0.5*((Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI),0.5-g.y/2),new THREE.UV(1-0.5*((Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI),0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,f);c(0,5,1,
 f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(var g=0;g<this.subdivisions;g++){var a=new THREE.Geometry,h;for(h in f.faces){var i=d(f.faces[h].a,f.faces[h].b),k=d(f.faces[h].b,f.faces[h].c),j=d(f.faces[h].c,f.faces[h].a);c(f.faces[h].a,i,j,a);c(f.faces[h].b,k,i,a);c(f.faces[h].c,j,k,a);c(i,k,j,a)}f.faces=a.faces;f.faceVertexUvs[0]=
-a.faceVertexUvs[0]}e.faces=f.faces;e.faceVertexUvs[0]=f.faceVertexUvs[0];this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+a.faceVertexUvs[0]}e.faces=f.faces;e.faceVertexUvs[0]=f.faceVertexUvs[0];this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
 THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],e=[],f=[],g=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=g.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),e[h]=this.vertices.length-1):e=f;0==i&&(f=d);
 for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(e[h],e[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=e;e=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,b){function c(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=g.vertices.push(c)-1;var d=Math.atan2(b.z,-b.x)/2/Math.PI+0.5,b=Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5;c.uv=new THREE.UV(d,b);return c}function d(a,b,c,h){1>h?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
@@ -222,7 +222,7 @@ k.lightMap,j.enableAO.value=!0;j.uDiffuseColor.value.setHex(k.color);j.uSpecular
 THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,b,c,d){if(a instanceof Object)console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath )."),d=a,a=d.model,b=d.callback,c=d.texture_path,d=d.bin_path;var c=c?c:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,e)};
 THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,e,f){var g=new XMLHttpRequest;g.onreadystatechange=function(){if(4==g.readyState)if(200==g.status||0==g.status)try{var h=JSON.parse(g.responseText);void 0===h.metadata||void 0===h.metadata.formatVersion||3!==h.metadata.formatVersion?console.error("Deprecated file format."):a.loadAjaxBuffers(h,c,e,d,f)}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+
-g.status+"]")};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
+g.status+"]")};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){4==f.readyState?200==f.status||0==f.status?THREE.BinaryLoader.prototype.createBinModel(f.response,b,d,a.materials):console.error("Couldn't load ["+g+"] ["+f.status+"]"):3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):2==f.readyState&&(h=f.getResponseHeader("Content-Length"))};f.open("GET",g,!0);
 f.responseType="arraybuffer";f.send(null)};
 THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){var c,e,i,k,j,o,l,n,p,m,q,r,t,s,v,u;function w(a){return a%4?4-a%4:0}function z(a,b){return(new Uint8Array(a,b,1))[0]}function x(a,b){return(new Uint32Array(a,b,1))[0]}function A(b,c){var d,e,f,g,h,i,j,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[3*d];f=m[3*d+1];g=m[3*d+2];h=y[2*e];e=y[2*e+1];i=y[2*f];j=y[2*f+1];f=y[2*g];k=y[2*g+1];g=G.faceVertexUvs[0];var n=[];n.push(new THREE.UV(h,e));n.push(new THREE.UV(i,j));
@@ -301,7 +301,7 @@ function(){if(4==f.readyState){if(0==f.status||200==f.status)f.responseXML?(ia=c
 THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
 THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){try{var h=JSON.parse(f.responseText)}catch(i){console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}a.createModel(h,c,d);a.onLoadComplete()}else console.error("Couldn't load ["+b+"] ["+f.status+"]");else 3==f.readyState?e&&(0==g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):
-2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
+2==f.readyState&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.overrideMimeType&&f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(void 0===a.metadata||void 0===a.metadata.formatVersion||3!==a.metadata.formatVersion)console.error("Deprecated file format.");else{var c,e,i,k,j,o,l,n,p,m,q,r,t,s,v=a.faces;o=a.vertices;var u=a.normals,w=a.colors,z=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&z++;for(c=0;c<z;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(j=o.length;k<
 j;)l=new THREE.Vertex,l.position.x=o[k++]*b,l.position.y=o[k++]*b,l.position.z=o[k++]*b,d.vertices.push(l);k=0;for(j=v.length;k<j;){b=v[k++];o=b&1;i=b&2;c=b&4;e=b&8;n=b&16;l=b&32;m=b&64;b&=128;o?(q=new THREE.Face4,q.a=v[k++],q.b=v[k++],q.c=v[k++],q.d=v[k++],o=4):(q=new THREE.Face3,q.a=v[k++],q.b=v[k++],q.c=v[k++],o=3);if(i)i=v[k++],q.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<z;c++)r=a.uvs[c],p=v[k++],s=r[2*p],p=r[2*p+1],d.faceUvs[c][i]=new THREE.UV(s,p);if(e)for(c=0;c<z;c++){r=a.uvs[c];t=[];
 for(e=0;e<o;e++)p=v[k++],s=r[2*p],p=r[2*p+1],t[e]=new THREE.UV(s,p);d.faceVertexUvs[c][i]=t}if(n)n=3*v[k++],e=new THREE.Vector3,e.x=u[n++],e.y=u[n++],e.z=u[n],q.normal=e;if(l)for(c=0;c<o;c++)n=3*v[k++],e=new THREE.Vector3,e.x=u[n++],e.y=u[n++],e.z=u[n],q.vertexNormals.push(e);if(m)l=v[k++],l=new THREE.Color(w[l]),q.color=l;if(b)for(c=0;c<o;c++)l=v[k++],l=new THREE.Color(w[l]),q.vertexColors.push(l);d.faces.push(q)}}})(e);(function(){var b,c,e,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=
@@ -309,7 +309,7 @@ for(e=0;e<o;e++)p=v[k++],s=r[2*p],p=r[2*p+1],t[e]=new THREE.UV(s,p);d.faceVertex
 p=a.morphTargets[c].vertices;for(i=0,k=p.length;i<k;i+=3)j=p[i]*b,o=p[i+1]*b,l=p[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(j,o,l)))}}if(void 0!==a.morphColors)for(c=0,e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;j=a.morphColors[c].colors;for(b=0,i=j.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(j[b],j[b+1],j[b+2]),k.push(o)}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
 d.computeTangents();b(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
 THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4==d.readyState)if(200==d.status||0==d.status)try{var e=JSON.parse(d.responseText);void 0===e.metadata||void 0===e.metadata.formatVersion||3!==e.metadata.formatVersion?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(f){console.error(f),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
-d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
+d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
 THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:k+"/"+a}function e(){var a;for(l in B.objects)if(!C.objects[l])if(r=B.objects[l],void 0!==r.geometry){if(F=C.geometries[r.geometry]){a=!1;for(L=0;L<r.materials.length;L++)J=C.materials[r.materials[L]],a=J instanceof THREE.ShaderMaterial;a&&F.computeTangents();v=r.position;u=r.rotation;w=r.quaternion;z=r.scale;w=0;0==J.length&&(J=new THREE.MeshFaceMaterial);1<J.length&&(J=new THREE.MeshFaceMaterial);
 a=new THREE.Mesh(F,J);a.name=l;a.position.set(v[0],v[1],v[2]);w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(u[0],u[1],u[2]);a.scale.set(z[0],z[1],z[2]);a.visible=r.visible;C.scene.add(a);C.objects[l]=a;if(r.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);C.scene.collisions.colliders.push(b)}if(r.castsShadow)b=new THREE.ShadowVolume(F),C.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;r.trigger&&"none"!=r.trigger.toLowerCase()&&(b=
 {type:r.trigger,object:r},C.triggers[a.name]=b)}}else v=r.position,u=r.rotation,w=r.quaternion,z=r.scale,w=0,a=new THREE.Object3D,a.name=l,a.position.set(v[0],v[1],v[2]),w?(a.quaternion.set(w[0],w[1],w[2],w[3]),a.useQuaternion=!0):a.rotation.set(u[0],u[1],u[2]),a.scale.set(z[0],z[1],z[2]),a.visible=void 0!==r.visible?r.visible:!1,C.scene.add(a),C.objects[l]=a,C.empties[l]=a,r.trigger&&"none"!=r.trigger.toLowerCase()&&(b={type:r.trigger,object:r},C.triggers[a.name]=b)}function f(a){return function(b){C.geometries[a]=

+ 1 - 1
examples/js/ctm/CTMLoader.js

@@ -75,7 +75,7 @@ THREE.CTMLoader.prototype.loadParts = function( url, callback, useWorker, useBuf
 	}
 
 	xhr.open( "GET", url, true );
-	xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
+	if ( xhr.overrideMimeType ) xhr.overrideMimeType( "text/plain; charset=x-user-defined" );
 	xhr.setRequestHeader( "Content-Type", "text/plain" );
 	xhr.send( null );