Browse Source

Merge branch 'dev' into toonMap

Takahiro 8 years ago
parent
commit
e00cfbf3c7

+ 20 - 13
build/three.js

@@ -28934,15 +28934,13 @@
 			// Safari can not handle Data URIs through XMLHttpRequest so process manually
 			if ( dataUriRegexResult ) {
 
-				var mimeType = dataUriRegexResult[1];
-				var isBase64 = !!dataUriRegexResult[2];
-				var data = dataUriRegexResult[3];
+				var mimeType = dataUriRegexResult[ 1 ];
+				var isBase64 = !! dataUriRegexResult[ 2 ];
+				var data = dataUriRegexResult[ 3 ];
 
-				data = window.decodeURIComponent(data);
+				data = window.decodeURIComponent( data );
 
-				if( isBase64 ) {
-					data = window.atob(data);
-				}
+				if ( isBase64 ) data = window.atob( data );
 
 				try {
 
@@ -28955,16 +28953,18 @@
 						case 'blob':
 
 						 	response = new ArrayBuffer( data.length );
+
 							var view = new Uint8Array( response );
+
 							for ( var i = 0; i < data.length; i ++ ) {
 
-									view[ i ] = data.charCodeAt( i );
+								view[ i ] = data.charCodeAt( i );
 
 							}
 
 							if ( responseType === 'blob' ) {
 
-								response = new Blob( [ response ], { "type" : mimeType } );
+								response = new Blob( [ response ], { type: mimeType } );
 
 							}
 
@@ -28992,24 +28992,24 @@
 					}
 
 					// Wait for next browser tick
-					window.setTimeout( function() {
+					window.setTimeout( function () {
 
 						if ( onLoad ) onLoad( response );
 
 						scope.manager.itemEnd( url );
 
-					}, 0);
+					}, 0 );
 
 				} catch ( error ) {
 
 					// Wait for next browser tick
-					window.setTimeout( function() {
+					window.setTimeout( function () {
 
 						if ( onError ) onError( error );
 
 						scope.manager.itemError( url );
 
-					}, 0);
+					}, 0 );
 
 				}
 
@@ -29371,6 +29371,13 @@
 
 				image.src = url;
 
+			} else if ( this.crossOrigin !== undefined ) {
+
+				// crossOrigin doesn't work with URL.createObjectURL()?
+
+				image.crossOrigin = this.crossOrigin;
+				image.src = url;
+
 			} else {
 
 				var loader = new FileLoader();

+ 17 - 17
build/three.min.js

@@ -612,23 +612,23 @@ e.manager.itemError(a)},0)}}else{var n=new XMLHttpRequest;n.open("GET",a,!0);n.a
 b,c,d){function e(e){k.load(a[e],function(a){a=f._parser(a,!0);g[e]={width:a.width,height:a.height,format:a.format,mipmaps:a.mipmaps};m+=1;6===m&&(1===a.mipmapCount&&(h.minFilter=1006),h.format=a.format,h.needsUpdate=!0,b&&b(h))},c,d)}var f=this,g=[],h=new Lb;h.image=g;var k=new Na(this.manager);k.setPath(this.path);k.setResponseType("arraybuffer");if(Array.isArray(a))for(var m=0,l=0,p=a.length;l<p;++l)e(l);else k.load(a,function(a){a=f._parser(a,!0);if(a.isCubemap)for(var c=a.mipmaps.length/a.mipmapCount,
 d=0;d<c;d++){g[d]={mipmaps:[]};for(var e=0;e<a.mipmapCount;e++)g[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+e]),g[d].format=a.format,g[d].width=a.width,g[d].height=a.height}else h.image.width=a.width,h.image.height=a.height,h.mipmaps=a.mipmaps;1===a.mipmapCount&&(h.minFilter=1006);h.format=a.format;h.needsUpdate=!0;b&&b(h)},c,d);return h},setPath:function(a){this.path=a;return this}});Object.assign(Nd.prototype,{load:function(a,b,c,d){var e=this,f=new fb,g=new Na(this.manager);g.setResponseType("arraybuffer");
 g.load(a,function(a){if(a=e._parser(a))void 0!==a.image?f.image=a.image:void 0!==a.data&&(f.image.width=a.width,f.image.height=a.height,f.image.data=a.data),f.wrapS=void 0!==a.wrapS?a.wrapS:1001,f.wrapT=void 0!==a.wrapT?a.wrapT:1001,f.magFilter=void 0!==a.magFilter?a.magFilter:1006,f.minFilter=void 0!==a.minFilter?a.minFilter:1008,f.anisotropy=void 0!==a.anisotropy?a.anisotropy:1,void 0!==a.format&&(f.format=a.format),void 0!==a.type&&(f.type=a.type),void 0!==a.mipmaps&&(f.mipmaps=a.mipmaps),1===
-a.mipmapCount&&(f.minFilter=1006),f.needsUpdate=!0,b&&b(f,a)},c,d);return f}});Object.assign(Tc.prototype,{load:function(a,b,c,d){var e=this,f=document.createElementNS("http://www.w3.org/1999/xhtml","img");f.onload=function(){f.onload=null;URL.revokeObjectURL(f.src);b&&b(f);e.manager.itemEnd(a)};f.onerror=d;if(0===a.indexOf("data:"))f.src=a;else{var g=new Na;g.setPath(this.path);g.setResponseType("blob");g.setWithCredentials(this.withCredentials);g.load(a,function(a){f.src=URL.createObjectURL(a)},
-c,d)}e.manager.itemStart(a);return f},setCrossOrigin:function(a){this.crossOrigin=a;return this},setWithCredentials:function(a){this.withCredentials=a;return this},setPath:function(a){this.path=a;return this}});Object.assign(Od.prototype,{load:function(a,b,c,d){function e(c){g.load(a[c],function(a){f.images[c]=a;h++;6===h&&(f.needsUpdate=!0,b&&b(f))},void 0,d)}var f=new Za,g=new Tc(this.manager);g.setCrossOrigin(this.crossOrigin);g.setPath(this.path);var h=0;for(c=0;c<a.length;++c)e(c);return f},
-setCrossOrigin:function(a){this.crossOrigin=a;return this},setPath:function(a){this.path=a;return this}});Object.assign(nd.prototype,{load:function(a,b,c,d){var e=new ea,f=new Tc(this.manager);f.setCrossOrigin(this.crossOrigin);f.setWithCredentials(this.withCredentials);f.setPath(this.path);f.load(a,function(c){var d=0<a.search(/\.(jpg|jpeg)$/)||0===a.search(/^data\:image\/jpeg/);e.format=d?1022:1023;e.image=c;e.needsUpdate=!0;void 0!==b&&b(e)},c,d);return e},setCrossOrigin:function(a){this.crossOrigin=
-a;return this},setWithCredentials:function(a){this.withCredentials=a;return this},setPath:function(a){this.path=a;return this}});oa.prototype=Object.assign(Object.create(E.prototype),{constructor:oa,isLight:!0,copy:function(a){E.prototype.copy.call(this,a);this.color.copy(a.color);this.intensity=a.intensity;return this},toJSON:function(a){a=E.prototype.toJSON.call(this,a);a.object.color=this.color.getHex();a.object.intensity=this.intensity;void 0!==this.groundColor&&(a.object.groundColor=this.groundColor.getHex());
-void 0!==this.distance&&(a.object.distance=this.distance);void 0!==this.angle&&(a.object.angle=this.angle);void 0!==this.decay&&(a.object.decay=this.decay);void 0!==this.penumbra&&(a.object.penumbra=this.penumbra);void 0!==this.shadow&&(a.object.shadow=this.shadow.toJSON());return a}});od.prototype=Object.assign(Object.create(oa.prototype),{constructor:od,isHemisphereLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.groundColor.copy(a.groundColor);return this}});Object.assign(ub.prototype,
-{copy:function(a){this.camera=a.camera.clone();this.bias=a.bias;this.radius=a.radius;this.mapSize.copy(a.mapSize);return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a={};0!==this.bias&&(a.bias=this.bias);1!==this.radius&&(a.radius=this.radius);if(512!==this.mapSize.x||512!==this.mapSize.y)a.mapSize=this.mapSize.toArray();a.camera=this.camera.toJSON(!1).object;delete a.camera.matrix;return a}});pd.prototype=Object.assign(Object.create(ub.prototype),{constructor:pd,
-isSpotLightShadow:!0,update:function(a){var b=2*S.RAD2DEG*a.angle,c=this.mapSize.width/this.mapSize.height;a=a.distance||500;var d=this.camera;if(b!==d.fov||c!==d.aspect||a!==d.far)d.fov=b,d.aspect=c,d.far=a,d.updateProjectionMatrix()}});qd.prototype=Object.assign(Object.create(oa.prototype),{constructor:qd,isSpotLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.distance=a.distance;this.angle=a.angle;this.penumbra=a.penumbra;this.decay=a.decay;this.target=a.target.clone();this.shadow=
-a.shadow.clone();return this}});rd.prototype=Object.assign(Object.create(oa.prototype),{constructor:rd,isPointLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.distance=a.distance;this.decay=a.decay;this.shadow=a.shadow.clone();return this}});sd.prototype=Object.assign(Object.create(ub.prototype),{constructor:sd});td.prototype=Object.assign(Object.create(oa.prototype),{constructor:td,isDirectionalLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.target=a.target.clone();this.shadow=
-a.shadow.clone();return this}});ud.prototype=Object.assign(Object.create(oa.prototype),{constructor:ud,isAmbientLight:!0});var xa={arraySlice:function(a,b,c){return xa.isTypedArray(a)?new a.constructor(a.subarray(b,c)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=a.length,
-c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,k=0;k!==b;++k)e[g++]=a[h+k];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g)){do g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++];while(void 0!==f)}else if(void 0!==g.toArray){do g=f[d],void 0!==
-g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};ka.prototype={constructor:ka,evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a<d)){for(var f=c+2;;){if(void 0===d){if(a<e)break d;this._cachedIndex=c=b.length;return this.afterEnd_(c-1,a,e)}if(c===f)break;e=d;d=b[++c];if(a<d)break b}d=b.length;break c}if(a>=e)break a;else{f=b[1];a<f&&(c=2,e=
-f);for(f=c-2;;){if(void 0===e)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(c===f)break;d=e;e=b[--c-1];if(a>=e)break b}d=c;c=0}}for(;c<d;)e=c+d>>>1,a<b[e]?d=e:c=e+1;d=b[c];e=b[c-1];if(void 0===e)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(void 0===d)return this._cachedIndex=c=b.length,this.afterEnd_(c-1,e,a)}this._cachedIndex=c;this.intervalChanged_(c,e,d)}return this.interpolate_(c,e,a,d)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},
-copySampleValue_:function(a){var b=this.resultBuffer,c=this.sampleValues,d=this.valueSize;a*=d;for(var e=0;e!==d;++e)b[e]=c[a+e];return b},interpolate_:function(a,b,c,d){throw Error("call to abstract method");},intervalChanged_:function(a,b,c){}};Object.assign(ka.prototype,{beforeStart_:ka.prototype.copySampleValue_,afterEnd_:ka.prototype.copySampleValue_});vd.prototype=Object.assign(Object.create(ka.prototype),{constructor:vd,DefaultSettings_:{endingStart:2400,endingEnd:2400},intervalChanged_:function(a,
-b,c){var d=this.parameterPositions,e=a-2,f=a+1,g=d[e],h=d[f];if(void 0===g)switch(this.getSettings_().endingStart){case 2401:e=a;g=2*b-c;break;case 2402:e=d.length-2;g=b+d[e]-d[e+1];break;default:e=a,g=c}if(void 0===h)switch(this.getSettings_().endingEnd){case 2401:f=a;h=2*c-b;break;case 2402:f=1;h=c+d[1]-d[0];break;default:f=a-1,h=b}a=.5*(c-b);d=this.valueSize;this._weightPrev=a/(b-g);this._weightNext=a/(h-c);this._offsetPrev=e*d;this._offsetNext=f*d},interpolate_:function(a,b,c,d){var e=this.resultBuffer,
-f=this.sampleValues,g=this.valueSize;a*=g;var h=a-g,k=this._offsetPrev,m=this._offsetNext,l=this._weightPrev,p=this._weightNext,n=(c-b)/(d-b);c=n*n;d=c*n;b=-l*d+2*l*c-l*n;l=(1+l)*d+(-1.5-2*l)*c+(-.5+l)*n+1;n=(-1-p)*d+(1.5+p)*c+.5*n;p=p*d-p*c;for(c=0;c!==g;++c)e[c]=b*f[k+c]+l*f[h+c]+n*f[a+c]+p*f[m+c];return e}});Uc.prototype=Object.assign(Object.create(ka.prototype),{constructor:Uc,interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;a*=g;var h=a-g;b=(c-b)/(d-
-b);c=1-b;for(d=0;d!==g;++d)e[d]=f[h+d]*c+f[a+d]*b;return e}});wd.prototype=Object.assign(Object.create(ka.prototype),{constructor:wd,interpolate_:function(a,b,c,d){return this.copySampleValue_(a-1)}});var Ya;Ya={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(a){return new wd(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodLinear:function(a){return new Uc(this.times,this.values,this.getValueSize(),
-a)},InterpolantFactoryMethodSmooth:function(a){return new vd(this.times,this.values,this.getValueSize(),a)},setInterpolation:function(a){var b;switch(a){case 2300:b=this.InterpolantFactoryMethodDiscrete;break;case 2301:b=this.InterpolantFactoryMethodLinear;break;case 2302:b=this.InterpolantFactoryMethodSmooth}if(void 0===b){b="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(a!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);
+a.mipmapCount&&(f.minFilter=1006),f.needsUpdate=!0,b&&b(f,a)},c,d);return f}});Object.assign(Tc.prototype,{load:function(a,b,c,d){var e=this,f=document.createElementNS("http://www.w3.org/1999/xhtml","img");f.onload=function(){f.onload=null;URL.revokeObjectURL(f.src);b&&b(f);e.manager.itemEnd(a)};f.onerror=d;if(0===a.indexOf("data:"))f.src=a;else if(void 0!==this.crossOrigin)f.crossOrigin=this.crossOrigin,f.src=a;else{var g=new Na;g.setPath(this.path);g.setResponseType("blob");g.setWithCredentials(this.withCredentials);
+g.load(a,function(a){f.src=URL.createObjectURL(a)},c,d)}e.manager.itemStart(a);return f},setCrossOrigin:function(a){this.crossOrigin=a;return this},setWithCredentials:function(a){this.withCredentials=a;return this},setPath:function(a){this.path=a;return this}});Object.assign(Od.prototype,{load:function(a,b,c,d){function e(c){g.load(a[c],function(a){f.images[c]=a;h++;6===h&&(f.needsUpdate=!0,b&&b(f))},void 0,d)}var f=new Za,g=new Tc(this.manager);g.setCrossOrigin(this.crossOrigin);g.setPath(this.path);
+var h=0;for(c=0;c<a.length;++c)e(c);return f},setCrossOrigin:function(a){this.crossOrigin=a;return this},setPath:function(a){this.path=a;return this}});Object.assign(nd.prototype,{load:function(a,b,c,d){var e=new ea,f=new Tc(this.manager);f.setCrossOrigin(this.crossOrigin);f.setWithCredentials(this.withCredentials);f.setPath(this.path);f.load(a,function(c){var d=0<a.search(/\.(jpg|jpeg)$/)||0===a.search(/^data\:image\/jpeg/);e.format=d?1022:1023;e.image=c;e.needsUpdate=!0;void 0!==b&&b(e)},c,d);return e},
+setCrossOrigin:function(a){this.crossOrigin=a;return this},setWithCredentials:function(a){this.withCredentials=a;return this},setPath:function(a){this.path=a;return this}});oa.prototype=Object.assign(Object.create(E.prototype),{constructor:oa,isLight:!0,copy:function(a){E.prototype.copy.call(this,a);this.color.copy(a.color);this.intensity=a.intensity;return this},toJSON:function(a){a=E.prototype.toJSON.call(this,a);a.object.color=this.color.getHex();a.object.intensity=this.intensity;void 0!==this.groundColor&&
+(a.object.groundColor=this.groundColor.getHex());void 0!==this.distance&&(a.object.distance=this.distance);void 0!==this.angle&&(a.object.angle=this.angle);void 0!==this.decay&&(a.object.decay=this.decay);void 0!==this.penumbra&&(a.object.penumbra=this.penumbra);void 0!==this.shadow&&(a.object.shadow=this.shadow.toJSON());return a}});od.prototype=Object.assign(Object.create(oa.prototype),{constructor:od,isHemisphereLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.groundColor.copy(a.groundColor);
+return this}});Object.assign(ub.prototype,{copy:function(a){this.camera=a.camera.clone();this.bias=a.bias;this.radius=a.radius;this.mapSize.copy(a.mapSize);return this},clone:function(){return(new this.constructor).copy(this)},toJSON:function(){var a={};0!==this.bias&&(a.bias=this.bias);1!==this.radius&&(a.radius=this.radius);if(512!==this.mapSize.x||512!==this.mapSize.y)a.mapSize=this.mapSize.toArray();a.camera=this.camera.toJSON(!1).object;delete a.camera.matrix;return a}});pd.prototype=Object.assign(Object.create(ub.prototype),
+{constructor:pd,isSpotLightShadow:!0,update:function(a){var b=2*S.RAD2DEG*a.angle,c=this.mapSize.width/this.mapSize.height;a=a.distance||500;var d=this.camera;if(b!==d.fov||c!==d.aspect||a!==d.far)d.fov=b,d.aspect=c,d.far=a,d.updateProjectionMatrix()}});qd.prototype=Object.assign(Object.create(oa.prototype),{constructor:qd,isSpotLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.distance=a.distance;this.angle=a.angle;this.penumbra=a.penumbra;this.decay=a.decay;this.target=a.target.clone();
+this.shadow=a.shadow.clone();return this}});rd.prototype=Object.assign(Object.create(oa.prototype),{constructor:rd,isPointLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.distance=a.distance;this.decay=a.decay;this.shadow=a.shadow.clone();return this}});sd.prototype=Object.assign(Object.create(ub.prototype),{constructor:sd});td.prototype=Object.assign(Object.create(oa.prototype),{constructor:td,isDirectionalLight:!0,copy:function(a){oa.prototype.copy.call(this,a);this.target=a.target.clone();
+this.shadow=a.shadow.clone();return this}});ud.prototype=Object.assign(Object.create(oa.prototype),{constructor:ud,isAmbientLight:!0});var xa={arraySlice:function(a,b,c){return xa.isTypedArray(a)?new a.constructor(a.subarray(b,c)):a.slice(b,c)},convertArray:function(a,b,c){return!a||!c&&a.constructor===b?a:"number"===typeof b.BYTES_PER_ELEMENT?new b(a):Array.prototype.slice.call(a)},isTypedArray:function(a){return ArrayBuffer.isView(a)&&!(a instanceof DataView)},getKeyframeOrder:function(a){for(var b=
+a.length,c=Array(b),d=0;d!==b;++d)c[d]=d;c.sort(function(b,c){return a[b]-a[c]});return c},sortedArray:function(a,b,c){for(var d=a.length,e=new a.constructor(d),f=0,g=0;g!==d;++f)for(var h=c[f]*b,k=0;k!==b;++k)e[g++]=a[h+k];return e},flattenJSON:function(a,b,c,d){for(var e=1,f=a[0];void 0!==f&&void 0===f[d];)f=a[e++];if(void 0!==f){var g=f[d];if(void 0!==g)if(Array.isArray(g)){do g=f[d],void 0!==g&&(b.push(f.time),c.push.apply(c,g)),f=a[e++];while(void 0!==f)}else if(void 0!==g.toArray){do g=f[d],
+void 0!==g&&(b.push(f.time),g.toArray(c,c.length)),f=a[e++];while(void 0!==f)}else{do g=f[d],void 0!==g&&(b.push(f.time),c.push(g)),f=a[e++];while(void 0!==f)}}}};ka.prototype={constructor:ka,evaluate:function(a){var b=this.parameterPositions,c=this._cachedIndex,d=b[c],e=b[c-1];a:{b:{c:{d:if(!(a<d)){for(var f=c+2;;){if(void 0===d){if(a<e)break d;this._cachedIndex=c=b.length;return this.afterEnd_(c-1,a,e)}if(c===f)break;e=d;d=b[++c];if(a<d)break b}d=b.length;break c}if(a>=e)break a;else{f=b[1];a<f&&
+(c=2,e=f);for(f=c-2;;){if(void 0===e)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(c===f)break;d=e;e=b[--c-1];if(a>=e)break b}d=c;c=0}}for(;c<d;)e=c+d>>>1,a<b[e]?d=e:c=e+1;d=b[c];e=b[c-1];if(void 0===e)return this._cachedIndex=0,this.beforeStart_(0,a,d);if(void 0===d)return this._cachedIndex=c=b.length,this.afterEnd_(c-1,e,a)}this._cachedIndex=c;this.intervalChanged_(c,e,d)}return this.interpolate_(c,e,a,d)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||
+this.DefaultSettings_},copySampleValue_:function(a){var b=this.resultBuffer,c=this.sampleValues,d=this.valueSize;a*=d;for(var e=0;e!==d;++e)b[e]=c[a+e];return b},interpolate_:function(a,b,c,d){throw Error("call to abstract method");},intervalChanged_:function(a,b,c){}};Object.assign(ka.prototype,{beforeStart_:ka.prototype.copySampleValue_,afterEnd_:ka.prototype.copySampleValue_});vd.prototype=Object.assign(Object.create(ka.prototype),{constructor:vd,DefaultSettings_:{endingStart:2400,endingEnd:2400},
+intervalChanged_:function(a,b,c){var d=this.parameterPositions,e=a-2,f=a+1,g=d[e],h=d[f];if(void 0===g)switch(this.getSettings_().endingStart){case 2401:e=a;g=2*b-c;break;case 2402:e=d.length-2;g=b+d[e]-d[e+1];break;default:e=a,g=c}if(void 0===h)switch(this.getSettings_().endingEnd){case 2401:f=a;h=2*c-b;break;case 2402:f=1;h=c+d[1]-d[0];break;default:f=a-1,h=b}a=.5*(c-b);d=this.valueSize;this._weightPrev=a/(b-g);this._weightNext=a/(h-c);this._offsetPrev=e*d;this._offsetNext=f*d},interpolate_:function(a,
+b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;a*=g;var h=a-g,k=this._offsetPrev,m=this._offsetNext,l=this._weightPrev,p=this._weightNext,n=(c-b)/(d-b);c=n*n;d=c*n;b=-l*d+2*l*c-l*n;l=(1+l)*d+(-1.5-2*l)*c+(-.5+l)*n+1;n=(-1-p)*d+(1.5+p)*c+.5*n;p=p*d-p*c;for(c=0;c!==g;++c)e[c]=b*f[k+c]+l*f[h+c]+n*f[a+c]+p*f[m+c];return e}});Uc.prototype=Object.assign(Object.create(ka.prototype),{constructor:Uc,interpolate_:function(a,b,c,d){var e=this.resultBuffer,f=this.sampleValues,g=this.valueSize;
+a*=g;var h=a-g;b=(c-b)/(d-b);c=1-b;for(d=0;d!==g;++d)e[d]=f[h+d]*c+f[a+d]*b;return e}});wd.prototype=Object.assign(Object.create(ka.prototype),{constructor:wd,interpolate_:function(a,b,c,d){return this.copySampleValue_(a-1)}});var Ya;Ya={TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:2301,InterpolantFactoryMethodDiscrete:function(a){return new wd(this.times,this.values,this.getValueSize(),a)},InterpolantFactoryMethodLinear:function(a){return new Uc(this.times,this.values,
+this.getValueSize(),a)},InterpolantFactoryMethodSmooth:function(a){return new vd(this.times,this.values,this.getValueSize(),a)},setInterpolation:function(a){var b;switch(a){case 2300:b=this.InterpolantFactoryMethodDiscrete;break;case 2301:b=this.InterpolantFactoryMethodLinear;break;case 2302:b=this.InterpolantFactoryMethodSmooth}if(void 0===b){b="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(a!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);
 else throw Error(b);console.warn(b)}else this.createInterpolant=b},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}},getValueSize:function(){return this.values.length/this.times.length},shift:function(a){if(0!==a)for(var b=this.times,c=0,d=b.length;c!==d;++c)b[c]+=a;return this},scale:function(a){if(1!==a)for(var b=this.times,c=
 0,d=b.length;c!==d;++c)b[c]*=a;return this},trim:function(a,b){for(var c=this.times,d=c.length,e=0,f=d-1;e!==d&&c[e]<a;)++e;for(;-1!==f&&c[f]>b;)--f;++f;if(0!==e||f!==d)e>=f&&(f=Math.max(f,1),e=f-1),d=this.getValueSize(),this.times=xa.arraySlice(c,e,f),this.values=xa.arraySlice(this.values,e*d,f*d);return this},validate:function(){var a=!0,b=this.getValueSize();0!==b-Math.floor(b)&&(console.error("invalid value size in track",this),a=!1);var c=this.times,b=this.values,d=c.length;0===d&&(console.error("track is empty",
 this),a=!1);for(var e=null,f=0;f!==d;f++){var g=c[f];if("number"===typeof g&&isNaN(g)){console.error("time is not a valid number",this,f,g);a=!1;break}if(null!==e&&e>g){console.error("out of order keys",this,f,g,e);a=!1;break}e=g}if(void 0!==b&&xa.isTypedArray(b))for(f=0,c=b.length;f!==c;++f)if(d=b[f],isNaN(d)){console.error("value is not a valid number",this,f,d);a=!1;break}return a},optimize:function(){for(var a=this.times,b=this.values,c=this.getValueSize(),d=2302===this.getInterpolation(),e=1,

+ 20 - 13
build/three.modules.js

@@ -28928,15 +28928,13 @@ Object.assign( FileLoader.prototype, {
 		// Safari can not handle Data URIs through XMLHttpRequest so process manually
 		if ( dataUriRegexResult ) {
 
-			var mimeType = dataUriRegexResult[1];
-			var isBase64 = !!dataUriRegexResult[2];
-			var data = dataUriRegexResult[3];
+			var mimeType = dataUriRegexResult[ 1 ];
+			var isBase64 = !! dataUriRegexResult[ 2 ];
+			var data = dataUriRegexResult[ 3 ];
 
-			data = window.decodeURIComponent(data);
+			data = window.decodeURIComponent( data );
 
-			if( isBase64 ) {
-				data = window.atob(data);
-			}
+			if ( isBase64 ) data = window.atob( data );
 
 			try {
 
@@ -28949,16 +28947,18 @@ Object.assign( FileLoader.prototype, {
 					case 'blob':
 
 					 	response = new ArrayBuffer( data.length );
+
 						var view = new Uint8Array( response );
+
 						for ( var i = 0; i < data.length; i ++ ) {
 
-								view[ i ] = data.charCodeAt( i );
+							view[ i ] = data.charCodeAt( i );
 
 						}
 
 						if ( responseType === 'blob' ) {
 
-							response = new Blob( [ response ], { "type" : mimeType } );
+							response = new Blob( [ response ], { type: mimeType } );
 
 						}
 
@@ -28986,24 +28986,24 @@ Object.assign( FileLoader.prototype, {
 				}
 
 				// Wait for next browser tick
-				window.setTimeout( function() {
+				window.setTimeout( function () {
 
 					if ( onLoad ) onLoad( response );
 
 					scope.manager.itemEnd( url );
 
-				}, 0);
+				}, 0 );
 
 			} catch ( error ) {
 
 				// Wait for next browser tick
-				window.setTimeout( function() {
+				window.setTimeout( function () {
 
 					if ( onError ) onError( error );
 
 					scope.manager.itemError( url );
 
-				}, 0);
+				}, 0 );
 
 			}
 
@@ -29365,6 +29365,13 @@ Object.assign( ImageLoader.prototype, {
 
 			image.src = url;
 
+		} else if ( this.crossOrigin !== undefined ) {
+
+			// crossOrigin doesn't work with URL.createObjectURL()?
+
+			image.crossOrigin = this.crossOrigin;
+			image.src = url;
+
 		} else {
 
 			var loader = new FileLoader();

+ 2 - 2
examples/js/animation/MMDPhysics.js

@@ -35,7 +35,7 @@ THREE.MMDPhysics = function ( mesh, params ) {
 	this.unitStep = ( params.unitStep !== undefined ) ? params.unitStep : 1 / 65;
 	this.maxStepNum = ( params.maxStepNum !== undefined ) ? params.maxStepNum : 3;
 
-	this.world = null;
+	this.world = params.world !== undefined ? params.world : null;
 	this.bodies = [];
 	this.constraints = [];
 
@@ -67,7 +67,7 @@ THREE.MMDPhysics.prototype = {
 
 		mesh.updateMatrixWorld( true );
 
-		this.initWorld();
+		if ( this.world === null ) this.initWorld();
 		this.initRigidBodies();
 		this.initConstraints();
 

+ 24 - 1
examples/js/loaders/MMDLoader.js

@@ -42,6 +42,7 @@ THREE.MMDLoader = function ( manager ) {
 	THREE.Loader.call( this );
 	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
 	this.parser = new MMDParser.Parser();
+	this.textureCrossOrigin = null;
 
 };
 
@@ -68,6 +69,17 @@ THREE.MMDLoader.prototype.defaultToonTextures = [
 	'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAL0lEQVRYR+3QQREAAAzCsOFfNJPBJ1XQS9r2hsUAAQIECBAgQIAAAQIECBAgsBZ4MUx/ofm2I/kAAAAASUVORK5CYII='
 ];
 
+/*
+ * Set 'anonymous' for the the texture image file in other domain
+ * even if server responds with "Access-Control-Allow-Origin: *"
+ * because some image operation fails in MMDLoader.
+ */
+THREE.MMDLoader.prototype.setTextureCrossOrigin = function ( value ) {
+
+	this.textureCrossOrigin = value;
+
+};
+
 THREE.MMDLoader.prototype.load = function ( modelUrl, vmdUrls, callback, onProgress, onError ) {
 
 	var scope = this;
@@ -123,6 +135,7 @@ THREE.MMDLoader.prototype.loadVmds = function ( urls, callback, onProgress, onEr
 	var scope = this;
 
 	var vmds = [];
+	urls = urls.slice();
 
 	function run () {
 
@@ -865,7 +878,9 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 		var offset = 0;
 		var materialParams = [];
 
-		function loadTexture( filePath, params ) {
+		if ( scope.textureCrossOrigin !== null ) textureLoader.setCrossOrigin( scope.textureCrossOrigin );
+
+		function loadTexture ( filePath, params ) {
 
 			if ( params === undefined ) {
 
@@ -2208,10 +2223,18 @@ THREE.MMDHelper.prototype = {
 
 	setPhysicses: function ( params ) {
 
+		params = ( params === undefined ) ? {} : Object.assign( {}, params );
+
 		for ( var i = 0; i < this.meshes.length; i++ ) {
 
 			this.setPhysics( this.meshes[ i ], params );
 
+			if ( i === 0 && params.sharePhysicsWorld === true ) {
+
+				params.world = this.meshes[ 0 ].physics.world;
+
+			}
+
 		}
 
 	},

+ 71 - 71
examples/js/renderers/WebGLDeferredRenderer.js

@@ -1623,13 +1623,13 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			map: { type: "t", value: null },
-			offsetRepeat: { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
+			map: { value: null },
+			offsetRepeat: { value: new THREE.Vector4( 0, 0, 1, 1 ) },
 
-			diffuse: { type: "c", value: new THREE.Color( 0x000000 ) },
-			emissive: { type: "c", value: new THREE.Color( 0x000000 ) },
-			specular: { type: "c", value: new THREE.Color( 0x000000 ) },
-			shininess: { type: "f", value: 30.0 }
+			diffuse: { value: new THREE.Color( 0x000000 ) },
+			emissive: { value: new THREE.Color( 0x000000 ) },
+			specular: { value: new THREE.Color( 0x000000 ) },
+			shininess: { value: 30.0 }
 
 		},
 
@@ -1687,9 +1687,9 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerColor: { type: "t", value: null },
-			viewWidth: { type: "f", value: 800 },
-			viewHeight: { type: "f", value: 600 }
+			samplerColor: { value: null },
+			viewWidth: { value: 800 },
+			viewHeight: { value: 600 }
 
 		},
 
@@ -1729,18 +1729,18 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerNormalDepth: { type: "t", value: null },
-			samplerColor: { type: "t", value: null },
+			samplerNormalDepth: { value: null },
+			samplerColor: { value: null },
 
-			matProjInverse: { type: "m4", value: new THREE.Matrix4() },
+			matProjInverse: { value: new THREE.Matrix4() },
 
-			viewWidth: { type: "f", value: 800 },
-			viewHeight: { type: "f", value: 600 },
+			viewWidth: { value: 800 },
+			viewHeight: { value: 600 },
 
-			lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
-			lightPositionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
-			lightIntensity: { type: "f", value: 1.0 },
-			lightRadius: { type: "f", value: 1.0 }
+			lightColor: { value: new THREE.Color( 0x000000 ) },
+			lightPositionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
+			lightIntensity: { value: 1.0 },
+			lightRadius: { value: 1.0 }
 
 		},
 
@@ -1811,19 +1811,19 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerNormalDepth: { type: "t", value: null },
-			samplerColor: { type: "t", value: null },
+			samplerNormalDepth: { value: null },
+			samplerColor: { value: null },
 
-			matProjInverse: { type: "m4", value: new THREE.Matrix4() },
+			matProjInverse: { value: new THREE.Matrix4() },
 
-			viewWidth: { type: "f", value: 800 },
-			viewHeight: { type: "f", value: 600 },
+			viewWidth: { value: 800 },
+			viewHeight: { value: 600 },
 
-			lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
-			lightDirectionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
-			lightPositionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
-			lightAngle: { type: "f", value: 1.0 },
-			lightIntensity: { type: "f", value: 1.0 }
+			lightColor: { value: new THREE.Color( 0x000000 ) },
+			lightDirectionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
+			lightPositionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
+			lightAngle: { value: 1.0 },
+			lightIntensity: { value: 1.0 }
 
 		},
 
@@ -1907,17 +1907,17 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerNormalDepth: { type: "t", value: null },
-			samplerColor: { type: "t", value: null },
+			samplerNormalDepth: { value: null },
+			samplerColor: { value: null },
 
-			matProjInverse: { type: "m4", value: new THREE.Matrix4() },
+			matProjInverse: { value: new THREE.Matrix4() },
 
-			viewWidth: { type: "f", value: 800 },
-			viewHeight: { type: "f", value: 600 },
+			viewWidth: { value: 800 },
+			viewHeight: { value: 600 },
 
-			lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
-			lightDirectionVS : { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
-			lightIntensity: { type: "f", value: 1.0 }
+			lightColor: { value: new THREE.Color( 0x000000 ) },
+			lightDirectionVS : { value: new THREE.Vector3( 0, 1, 0 ) },
+			lightIntensity: { value: 1.0 }
 
 		},
 
@@ -1972,7 +1972,7 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			shininess: { type: "f", value: 30.0 }
+			shininess: { value: 30.0 }
 
 		},
 
@@ -2030,17 +2030,17 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerNormalDepthShininess: { type: "t", value: null },
+			samplerNormalDepthShininess: { value: null },
 
-			matProjInverse: { type: "m4", value: new THREE.Matrix4() },
+			matProjInverse: { value: new THREE.Matrix4() },
 
-			viewWidth: { type: "f", value: 800 },
-			viewHeight: { type: "f", value: 600 },
+			viewWidth: { value: 800 },
+			viewHeight: { value: 600 },
 
-			lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
-			lightPositionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
-			lightIntensity: { type: "f", value: 1.0 },
-			lightRadius: { type: "f", value: 1.0 }
+			lightColor: { value: new THREE.Color( 0x000000 ) },
+			lightPositionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
+			lightIntensity: { value: 1.0 },
+			lightRadius: { value: 1.0 }
 
 		},
 
@@ -2101,18 +2101,18 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerNormalDepthShininess: { type: "t", value: null },
+			samplerNormalDepthShininess: { value: null },
 
-			matProjInverse: { type: "m4", value: new THREE.Matrix4() },
+			matProjInverse: { value: new THREE.Matrix4() },
 
-			viewWidth: { type: "f", value: 800 },
-			viewHeight: { type: "f", value: 600 },
+			viewWidth: { value: 800 },
+			viewHeight: { value: 600 },
 
-			lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
-			lightDirectionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
-			lightPositionVS: { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
-			lightAngle: { type: "f", value: 1.0 },
-			lightIntensity: { type: "f", value: 1.0 }
+			lightColor: { value: new THREE.Color( 0x000000 ) },
+			lightDirectionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
+			lightPositionVS: { value: new THREE.Vector3( 0, 1, 0 ) },
+			lightAngle: { value: 1.0 },
+			lightIntensity: { value: 1.0 }
 
 		},
 
@@ -2194,16 +2194,16 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerNormalDepthShininess: { type: "t", value: null },
+			samplerNormalDepthShininess: { value: null },
 
-			matProjInverse: { type: "m4", value: new THREE.Matrix4() },
+			matProjInverse: { value: new THREE.Matrix4() },
 
-			viewWidth: { type: "f", value: 800 },
-			viewHeight: { type: "f", value: 600 },
+			viewWidth: { value: 800 },
+			viewHeight: { value: 600 },
 
-			lightColor: { type: "c", value: new THREE.Color( 0x000000 ) },
-			lightDirectionVS : { type: "v3", value: new THREE.Vector3( 0, 1, 0 ) },
-			lightIntensity: { type: "f", value: 1.0 }
+			lightColor: { value: new THREE.Color( 0x000000 ) },
+			lightDirectionVS : { value: new THREE.Vector3( 0, 1, 0 ) },
+			lightIntensity: { value: 1.0 }
 
 		},
 
@@ -2258,18 +2258,18 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerLight: { type: "t", value: null },
+			samplerLight: { value: null },
 
-			map: { type: "t", value: null },
-			offsetRepeat: { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
+			map: { value: null },
+			offsetRepeat: { value: new THREE.Vector4( 0, 0, 1, 1 ) },
 
-			viewWidth: { type: "f", value: 800 },
-			viewHeight: { type: "f", value: 600 },
+			viewWidth: { value: 800 },
+			viewHeight: { value: 600 },
 
-			diffuse: { type: "c", value: new THREE.Color( 0x000000 ) },
-			emissive: { type: "c", value: new THREE.Color( 0x000000 ) },
-			specular: { type: "c", value: new THREE.Color( 0x000000 ) },
-			shininess: { type: "f", value: 30.0 }
+			diffuse: { value: new THREE.Color( 0x000000 ) },
+			emissive: { value: new THREE.Color( 0x000000 ) },
+			specular: { value: new THREE.Color( 0x000000 ) },
+			shininess: { value: 30.0 }
 
 		},
 
@@ -2341,7 +2341,7 @@ THREE.ShaderDeferred = {
 
 		uniforms: {
 
-			samplerResult: { type: "t", value: null }
+			samplerResult: { value: null }
 
 		},
 

+ 13 - 13
src/loaders/FileLoader.js

@@ -46,15 +46,13 @@ Object.assign( FileLoader.prototype, {
 		// Safari can not handle Data URIs through XMLHttpRequest so process manually
 		if ( dataUriRegexResult ) {
 
-			var mimeType = dataUriRegexResult[1];
-			var isBase64 = !!dataUriRegexResult[2];
-			var data = dataUriRegexResult[3];
+			var mimeType = dataUriRegexResult[ 1 ];
+			var isBase64 = !! dataUriRegexResult[ 2 ];
+			var data = dataUriRegexResult[ 3 ];
 
-			data = window.decodeURIComponent(data);
+			data = window.decodeURIComponent( data );
 
-			if( isBase64 ) {
-				data = window.atob(data);
-			}
+			if ( isBase64 ) data = window.atob( data );
 
 			try {
 
@@ -67,16 +65,18 @@ Object.assign( FileLoader.prototype, {
 					case 'blob':
 
 					 	response = new ArrayBuffer( data.length );
+
 						var view = new Uint8Array( response );
+
 						for ( var i = 0; i < data.length; i ++ ) {
 
-								view[ i ] = data.charCodeAt( i );
+							view[ i ] = data.charCodeAt( i );
 
 						}
 
 						if ( responseType === 'blob' ) {
 
-							response = new Blob( [ response ], { "type" : mimeType } );
+							response = new Blob( [ response ], { type: mimeType } );
 
 						}
 
@@ -104,24 +104,24 @@ Object.assign( FileLoader.prototype, {
 				}
 
 				// Wait for next browser tick
-				window.setTimeout( function() {
+				window.setTimeout( function () {
 
 					if ( onLoad ) onLoad( response );
 
 					scope.manager.itemEnd( url );
 
-				}, 0);
+				}, 0 );
 
 			} catch ( error ) {
 
 				// Wait for next browser tick
-				window.setTimeout( function() {
+				window.setTimeout( function () {
 
 					if ( onError ) onError( error );
 
 					scope.manager.itemError( url );
 
-				}, 0);
+				}, 0 );
 
 			}
 

+ 7 - 0
src/loaders/ImageLoader.js

@@ -35,6 +35,13 @@ Object.assign( ImageLoader.prototype, {
 
 			image.src = url;
 
+		} else if ( this.crossOrigin !== undefined ) {
+
+			// crossOrigin doesn't work with URL.createObjectURL()?
+
+			image.crossOrigin = this.crossOrigin;
+			image.src = url;
+
 		} else {
 
 			var loader = new FileLoader();