|
@@ -7,12 +7,12 @@ THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.CustomBlending=5;THRE
|
|
THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;
|
|
THREE.MixOperation=1;THREE.AddOperation=2;THREE.UVMapping=function(){};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.RepeatWrapping=1E3;THREE.ClampToEdgeWrapping=1001;THREE.MirroredRepeatWrapping=1002;THREE.NearestFilter=1003;THREE.NearestMipMapNearestFilter=1004;THREE.NearestMipMapLinearFilter=1005;THREE.LinearFilter=1006;THREE.LinearMipMapNearestFilter=1007;
|
|
THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;
|
|
THREE.LinearMipMapLinearFilter=1008;THREE.UnsignedByteType=1009;THREE.ByteType=1010;THREE.ShortType=1011;THREE.UnsignedShortType=1012;THREE.IntType=1013;THREE.UnsignedIntType=1014;THREE.FloatType=1015;THREE.UnsignedShort4444Type=1016;THREE.UnsignedShort5551Type=1017;THREE.UnsignedShort565Type=1018;THREE.AlphaFormat=1019;THREE.RGBFormat=1020;THREE.RGBAFormat=1021;THREE.LuminanceFormat=1022;THREE.LuminanceAlphaFormat=1023;THREE.RGB_S3TC_DXT1_Format=2001;THREE.RGBA_S3TC_DXT1_Format=2002;
|
|
THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.Color=function(a){void 0!==a&&this.set(a);return this};
|
|
THREE.RGBA_S3TC_DXT3_Format=2003;THREE.RGBA_S3TC_DXT5_Format=2004;THREE.Color=function(a){void 0!==a&&this.set(a);return this};
|
|
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
|
|
|
|
-this.b=Math.sqrt(this.b);return this},set:function(a){switch(typeof a){case "number":this.setHex(a);break;case "string":this.setStyle(a)}},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;0===c?this.r=this.g=this.b=0:(d=Math.floor(6*a),e=6*a-d,a=c*(1-b),f=c*(1-b*e),b=c*(1-b*(1-e)),0===d?(this.r=c,this.g=b,this.b=a):1===d?(this.r=f,this.g=c,this.b=a):2===d?(this.r=a,this.g=c,this.b=b):3===d?(this.r=a,this.g=f,this.b=c):4===d?(this.r=b,this.g=a,this.b=
|
|
|
|
-c):5===d&&(this.r=c,this.g=a,this.b=f));return this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},setStyle:function(a){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(a))return a=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(a),
|
|
|
|
-this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(a))return a=/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(a),this.r=Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=
|
|
|
|
-/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},getHSV:function(a){var b=this.r,c=this.g,d=this.b,e=Math.max(Math.max(b,c),d),f=Math.min(Math.min(b,c),d);if(f===e)f=b=0;else{var g=e-f,f=g/e,b=(b===e?(c-d)/g:c===e?2+(d-b)/g:4+(b-c)/g)/6;0>b&&(b+=1);1<b&&(b-=1)}void 0===a&&(a={h:0,s:0,v:0});a.h=b;a.s=f;a.v=e;return a},lerpSelf:function(a,b){this.r+=(a.r-this.r)*b;this.g+=
|
|
|
|
-(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
|
|
|
|
|
|
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,set:function(a){switch(typeof a){case "number":this.setHex(a);break;case "string":this.setStyle(a)}},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,e,f;0===c?this.r=this.g=this.b=0:(d=Math.floor(6*a),e=6*a-d,a=c*(1-b),f=c*(1-b*e),b=c*(1-b*(1-e)),0===d?(this.r=c,this.g=b,this.b=a):1===
|
|
|
|
+d?(this.r=f,this.g=c,this.b=a):2===d?(this.r=a,this.g=c,this.b=b):3===d?(this.r=a,this.g=f,this.b=c):4===d?(this.r=b,this.g=a,this.b=c):5===d&&(this.r=c,this.g=a,this.b=f));return this},setStyle:function(a){if(/^rgb\((\d+),(\d+),(\d+)\)$/i.test(a))return a=/^rgb\((\d+),(\d+),(\d+)\)$/i.exec(a),this.r=Math.min(255,parseInt(a[1],10))/255,this.g=Math.min(255,parseInt(a[2],10))/255,this.b=Math.min(255,parseInt(a[3],10))/255,this;if(/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.test(a))return a=/^rgb\((\d+)\%,(\d+)\%,(\d+)\%\)$/i.exec(a),
|
|
|
|
+this.r=Math.min(100,parseInt(a[1],10))/100,this.g=Math.min(100,parseInt(a[2],10))/100,this.b=Math.min(100,parseInt(a[3],10))/100,this;if(/^\#([0-9a-f]{6})$/i.test(a))return a=/^\#([0-9a-f]{6})$/i.exec(a),this.setHex(parseInt(a[1],16)),this;if(/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.test(a))return a=/^\#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(a),this.setHex(parseInt(a[1]+a[1]+a[2]+a[2]+a[3]+a[3],16)),this;if(/^(\w+)$/i.test(a))return this.setHex(THREE.ColorKeywords[a]),this},copy:function(a){this.r=a.r;
|
|
|
|
+this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);this.b=Math.sqrt(this.b);return this},getHex:function(){return 255*this.r<<16^
|
|
|
|
+255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getStyle:function(){return"rgb("+(255*this.r|0)+","+(255*this.g|0)+","+(255*this.b|0)+")"},getHSV:function(a){var b=this.r,c=this.g,d=this.b,e=Math.max(Math.max(b,c),d),f=Math.min(Math.min(b,c),d);if(f===e)f=b=0;else{var g=e-f,f=g/e,b=(b===e?(c-d)/g:c===e?2+(d-b)/g:4+(b-c)/g)/6;0>b&&(b+=1);1<b&&(b-=1)}void 0===a&&(a={h:0,s:0,v:0});a.h=b;a.s=f;a.v=e;return a},add:function(a){this.r+=a.r;this.g+=
|
|
|
|
+a.g;this.b+=a.b;return this},addColors:function(a,b){this.r=a.r+b.r;this.g=a.g+b.g;this.b=a.b+b.b;return this},addScalar:function(a){this.r+=a;this.g+=a;this.b+=a;return this},multiply:function(a){this.r*=a.r;this.g*=a.g;this.b*=a.b;return this},multiplyScalar:function(a){this.r*=a;this.g*=a;this.b*=a;return this},lerpSelf:function(a,b){this.r+=(a.r-this.r)*b;this.g+=(a.g-this.g)*b;this.b+=(a.b-this.b)*b;return this},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
|
|
THREE.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,
|
|
THREE.ColorKeywords={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,
|
|
darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,
|
|
darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,
|
|
grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,
|
|
grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,
|
|
@@ -63,21 +63,21 @@ THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,f,g,h,
|
|
this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var k=g*i,m=g*f,n=d*i,l=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=m+n*e;c[5]=k-l*e;c[9]=-d*h;c[2]=l-k*e;c[6]=n+m*e;c[10]=g*h}else"YXZ"===b?(k=h*i,m=h*f,n=e*i,l=e*f,c[0]=k+l*d,c[4]=n*d-m,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=m*d-n,c[6]=l+k*d,c[10]=g*h):"ZXY"===b?(k=h*i,m=h*f,n=e*i,l=e*f,c[0]=k-l*d,c[4]=-g*f,c[8]=n+m*d,c[1]=m+n*d,c[5]=g*i,c[9]=l-k*d,c[2]=-g*e,c[6]=
|
|
this.elements,d=a.x,e=a.y,f=a.z,g=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e),i=Math.cos(f),f=Math.sin(f);if(void 0===b||"XYZ"===b){var k=g*i,m=g*f,n=d*i,l=d*f;c[0]=h*i;c[4]=-h*f;c[8]=e;c[1]=m+n*e;c[5]=k-l*e;c[9]=-d*h;c[2]=l-k*e;c[6]=n+m*e;c[10]=g*h}else"YXZ"===b?(k=h*i,m=h*f,n=e*i,l=e*f,c[0]=k+l*d,c[4]=n*d-m,c[8]=g*e,c[1]=g*f,c[5]=g*i,c[9]=-d,c[2]=m*d-n,c[6]=l+k*d,c[10]=g*h):"ZXY"===b?(k=h*i,m=h*f,n=e*i,l=e*f,c[0]=k-l*d,c[4]=-g*f,c[8]=n+m*d,c[1]=m+n*d,c[5]=g*i,c[9]=l-k*d,c[2]=-g*e,c[6]=
|
|
d,c[10]=g*h):"ZYX"===b?(k=g*i,m=g*f,n=d*i,l=d*f,c[0]=h*i,c[4]=n*e-m,c[8]=k*e+l,c[1]=h*f,c[5]=l*e+k,c[9]=m*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(k=g*h,m=g*e,n=d*h,l=d*e,c[0]=h*i,c[4]=l-k*f,c[8]=n*f+m,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=m*f+n,c[10]=k-l*f):"XZY"===b&&(k=g*h,m=g*e,n=d*h,l=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=k*f+l,c[5]=g*i,c[9]=m*f-n,c[2]=n*f-m,c[6]=d*i,c[10]=l*f+k);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+
|
|
d,c[10]=g*h):"ZYX"===b?(k=g*i,m=g*f,n=d*i,l=d*f,c[0]=h*i,c[4]=n*e-m,c[8]=k*e+l,c[1]=h*f,c[5]=l*e+k,c[9]=m*e-n,c[2]=-e,c[6]=d*h,c[10]=g*h):"YZX"===b?(k=g*h,m=g*e,n=d*h,l=d*e,c[0]=h*i,c[4]=l-k*f,c[8]=n*f+m,c[1]=f,c[5]=g*i,c[9]=-d*i,c[2]=-e*i,c[6]=m*f+n,c[10]=k-l*f):"XZY"===b&&(k=g*h,m=g*e,n=d*h,l=d*e,c[0]=h*i,c[4]=-f,c[8]=e*i,c[1]=k*f+l,c[5]=g*i,c[9]=m*f-n,c[2]=n*f-m,c[6]=d*i,c[10]=l*f+k);return this},setRotationFromQuaternion:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z,f=a.w,g=c+c,h=d+d,i=e+
|
|
e,a=c*g,k=c*h,c=c*i,m=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(m+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+m);return this},lookAt:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();0===g.length()&&(g.z=1);e.cross(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.cross(c,g).normalize());f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},
|
|
e,a=c*g,k=c*h,c=c*i,m=d*h,d=d*i,e=e*i,g=f*g,h=f*h,f=f*i;b[0]=1-(m+e);b[4]=k-f;b[8]=c+h;b[1]=k+f;b[5]=1-(a+e);b[9]=d-g;b[2]=c-h;b[6]=d+g;b[10]=1-(a+m);return this},lookAt:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();0===g.length()&&(g.z=1);e.cross(c,g).normalize();0===e.length()&&(g.x+=1E-4,e.cross(c,g).normalize());f.cross(g,e);d[0]=e.x;d[4]=f.x;d[8]=g.x;d[1]=e.y;d[5]=f.y;d[9]=g.y;d[2]=e.z;d[6]=f.z;d[10]=g.z;return this},
|
|
-multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],m=c[5],n=c[9],l=c[13],s=c[2],q=c[6],p=c[10],r=c[14],v=c[3],x=c[7],w=c[11],c=c[15],t=d[0],J=d[4],E=d[8],C=d[12],z=d[1],G=d[5],F=d[9],I=d[13],$=d[2],B=d[6],R=d[10],A=d[14],H=d[3],K=d[7],M=d[11],d=d[15];e[0]=f*t+g*z+h*$+i*H;e[4]=f*J+g*G+h*B+i*K;e[8]=f*E+g*F+h*R+i*M;e[12]=f*C+g*I+h*A+i*d;e[1]=k*t+m*z+n*$+l*H;e[5]=k*J+m*G+n*B+l*K;e[9]=k*E+m*F+n*R+l*M;e[13]=k*C+m*I+n*A+l*d;e[2]=s*t+q*z+p*$+r*H;e[6]=
|
|
|
|
-s*J+q*G+p*B+r*K;e[10]=s*E+q*F+p*R+r*M;e[14]=s*C+q*I+p*A+r*d;e[3]=v*t+x*z+w*$+c*H;e[7]=v*J+x*G+w*B+c*K;e[11]=v*E+x*F+w*R+c*M;e[15]=v*C+x*I+w*A+c*d;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=
|
|
|
|
|
|
+multiply:function(a,b){var c=a.elements,d=b.elements,e=this.elements,f=c[0],g=c[4],h=c[8],i=c[12],k=c[1],m=c[5],n=c[9],l=c[13],s=c[2],q=c[6],p=c[10],r=c[14],w=c[3],x=c[7],v=c[11],c=c[15],t=d[0],I=d[4],E=d[8],C=d[12],z=d[1],G=d[5],F=d[9],J=d[13],V=d[2],B=d[6],T=d[10],A=d[14],H=d[3],L=d[7],M=d[11],d=d[15];e[0]=f*t+g*z+h*V+i*H;e[4]=f*I+g*G+h*B+i*L;e[8]=f*E+g*F+h*T+i*M;e[12]=f*C+g*J+h*A+i*d;e[1]=k*t+m*z+n*V+l*H;e[5]=k*I+m*G+n*B+l*L;e[9]=k*E+m*F+n*T+l*M;e[13]=k*C+m*J+n*A+l*d;e[2]=s*t+q*z+p*V+r*H;e[6]=
|
|
|
|
+s*I+q*G+p*B+r*L;e[10]=s*E+q*F+p*T+r*M;e[14]=s*C+q*J+p*A+r*d;e[3]=w*t+x*z+v*V+c*H;e[7]=w*I+x*G+v*B+c*L;e[11]=w*E+x*F+v*T+c*M;e[15]=w*C+x*J+v*A+c*d;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){var d=this.elements;this.multiply(a,b);c[0]=d[0];c[1]=d[1];c[2]=d[2];c[3]=d[3];c[4]=d[4];c[5]=d[5];c[6]=d[6];c[7]=d[7];c[8]=d[8];c[9]=d[9];c[10]=d[10];c[11]=d[11];c[12]=d[12];c[13]=d[13];c[14]=d[14];c[15]=d[15];return this},multiplyScalar:function(a){var b=
|
|
this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,c=0,d=a.length;c<d;c+=3)b.x=a[c],b.y=a[c+1],b.z=a[c+2],this.multiplyVector3(b),a[c]=b.x,a[c+1]=b.y,a[c+2]=b.z;return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},
|
|
this.elements;b[0]*=a;b[4]*=a;b[8]*=a;b[12]*=a;b[1]*=a;b[5]*=a;b[9]*=a;b[13]*=a;b[2]*=a;b[6]*=a;b[10]*=a;b[14]*=a;b[3]*=a;b[7]*=a;b[11]*=a;b[15]*=a;return this},multiplyVector3Array:function(a){for(var b=THREE.Matrix4.__v1,c=0,d=a.length;c<d;c+=3)b.x=a[c],b.y=a[c+1],b.z=a[c+2],this.multiplyVector3(b),a[c]=b.x,a[c+1]=b.y,a[c+2]=b.z;return a},rotateAxis:function(a){var b=this.elements,c=a.x,d=a.y,e=a.z;a.x=c*b[0]+d*b[4]+e*b[8];a.y=c*b[1]+d*b[5]+e*b[9];a.z=c*b[2]+d*b[6]+e*b[10];a.normalize();return a},
|
|
crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],m=a[6],n=a[10],l=a[14];return a[3]*(+e*h*m-d*i*m-e*g*n+c*i*n+d*g*l-c*h*l)+a[7]*(+b*h*l-b*i*n+e*f*n-d*f*l+d*i*k-e*h*k)+a[11]*(+b*i*m-b*g*l-e*f*m+c*f*
|
|
crossVector:function(a){var b=this.elements,c=new THREE.Vector4;c.x=b[0]*a.x+b[4]*a.y+b[8]*a.z+b[12]*a.w;c.y=b[1]*a.x+b[5]*a.y+b[9]*a.z+b[13]*a.w;c.z=b[2]*a.x+b[6]*a.y+b[10]*a.z+b[14]*a.w;c.w=a.w?b[3]*a.x+b[7]*a.y+b[11]*a.z+b[15]*a.w:1;return c},determinant:function(){var a=this.elements,b=a[0],c=a[4],d=a[8],e=a[12],f=a[1],g=a[5],h=a[9],i=a[13],k=a[2],m=a[6],n=a[10],l=a[14];return a[3]*(+e*h*m-d*i*m-e*g*n+c*i*n+d*g*l-c*h*l)+a[7]*(+b*h*l-b*i*n+e*f*n-d*f*l+d*i*k-e*h*k)+a[11]*(+b*i*m-b*g*l-e*f*m+c*f*
|
|
l+e*g*k-c*i*k)+a[15]*(-d*g*k-b*h*m+b*g*n+d*f*m-c*f*n+c*h*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,
|
|
l+e*g*k-c*i*k)+a[15]*(-d*g*k-b*h*m+b*g*n+d*f*m-c*f*n+c*h*k)},transpose:function(){var a=this.elements,b;b=a[1];a[1]=a[4];a[4]=b;b=a[2];a[2]=a[8];a[8]=b;b=a[6];a[6]=a[9];a[9]=b;b=a[3];a[3]=a[12];a[12]=b;b=a[7];a[7]=a[13];a[13]=b;b=a[11];a[11]=a[14];a[14]=b;return this},flattenToArray:function(a){var b=this.elements;a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a},flattenToArrayOffset:function(a,
|
|
b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},
|
|
b){var c=this.elements;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3];a[b+4]=c[4];a[b+5]=c[5];a[b+6]=c[6];a[b+7]=c[7];a[b+8]=c[8];a[b+9]=c[9];a[b+10]=c[10];a[b+11]=c[11];a[b+12]=c[12];a[b+13]=c[13];a[b+14]=c[14];a[b+15]=c[15];return a},getPosition:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[12],a[13],a[14])},setPosition:function(a){var b=this.elements;b[12]=a.x;b[13]=a.y;b[14]=a.z;return this},getColumnX:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[0],a[1],a[2])},
|
|
-getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],i=d[1],k=d[5],m=d[9],n=d[13],l=d[2],s=d[6],q=d[10],p=d[14],r=d[3],v=d[7],x=d[11],w=d[15];c[0]=m*p*v-n*q*v+n*s*x-k*p*x-m*s*w+k*q*w;c[4]=h*q*v-g*p*v-h*s*x+f*p*x+g*s*w-f*q*w;c[8]=g*n*v-h*m*v+h*k*x-f*n*x-g*k*w+f*m*w;c[12]=h*m*s-g*n*s-h*k*q+
|
|
|
|
-f*n*q+g*k*p-f*m*p;c[1]=n*q*r-m*p*r-n*l*x+i*p*x+m*l*w-i*q*w;c[5]=g*p*r-h*q*r+h*l*x-e*p*x-g*l*w+e*q*w;c[9]=h*m*r-g*n*r-h*i*x+e*n*x+g*i*w-e*m*w;c[13]=g*n*l-h*m*l+h*i*q-e*n*q-g*i*p+e*m*p;c[2]=k*p*r-n*s*r+n*l*v-i*p*v-k*l*w+i*s*w;c[6]=h*s*r-f*p*r-h*l*v+e*p*v+f*l*w-e*s*w;c[10]=f*n*r-h*k*r+h*i*v-e*n*v-f*i*w+e*k*w;c[14]=h*k*l-f*n*l-h*i*s+e*n*s+f*i*p-e*k*p;c[3]=m*s*r-k*q*r-m*l*v+i*q*v+k*l*x-i*s*x;c[7]=f*q*r-g*s*r+g*l*v-e*q*v-f*l*x+e*s*x;c[11]=g*k*r-f*m*r-g*i*v+e*m*v+f*i*x-e*k*x;c[15]=f*m*l-g*k*l+g*i*s-e*m*
|
|
|
|
|
|
+getColumnY:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[4],a[5],a[6])},getColumnZ:function(){var a=this.elements;return THREE.Matrix4.__v1.set(a[8],a[9],a[10])},getInverse:function(a,b){var c=this.elements,d=a.elements,e=d[0],f=d[4],g=d[8],h=d[12],i=d[1],k=d[5],m=d[9],n=d[13],l=d[2],s=d[6],q=d[10],p=d[14],r=d[3],w=d[7],x=d[11],v=d[15];c[0]=m*p*w-n*q*w+n*s*x-k*p*x-m*s*v+k*q*v;c[4]=h*q*w-g*p*w-h*s*x+f*p*x+g*s*v-f*q*v;c[8]=g*n*w-h*m*w+h*k*x-f*n*x-g*k*v+f*m*v;c[12]=h*m*s-g*n*s-h*k*q+
|
|
|
|
+f*n*q+g*k*p-f*m*p;c[1]=n*q*r-m*p*r-n*l*x+i*p*x+m*l*v-i*q*v;c[5]=g*p*r-h*q*r+h*l*x-e*p*x-g*l*v+e*q*v;c[9]=h*m*r-g*n*r-h*i*x+e*n*x+g*i*v-e*m*v;c[13]=g*n*l-h*m*l+h*i*q-e*n*q-g*i*p+e*m*p;c[2]=k*p*r-n*s*r+n*l*w-i*p*w-k*l*v+i*s*v;c[6]=h*s*r-f*p*r-h*l*w+e*p*w+f*l*v-e*s*v;c[10]=f*n*r-h*k*r+h*i*w-e*n*w-f*i*v+e*k*v;c[14]=h*k*l-f*n*l-h*i*s+e*n*s+f*i*p-e*k*p;c[3]=m*s*r-k*q*r-m*l*w+i*q*w+k*l*x-i*s*x;c[7]=f*q*r-g*s*r+g*l*w-e*q*w-f*l*x+e*s*x;c[11]=g*k*r-f*m*r-g*i*w+e*m*w+f*i*x-e*k*x;c[15]=f*m*l-g*k*l+g*i*s-e*m*
|
|
s-f*i*q+e*k*q;c=d[0]*c[0]+d[1]*c[4]+d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,
|
|
s-f*i*q+e*k*q;c=d[0]*c[0]+d[1]*c[4]+d[2]*c[8]+d[3]*c[12];if(0==c){if(b)throw Error("Matrix4.getInverse(): can't invert matrix, determinant is 0");console.warn("Matrix4.getInverse(): can't invert matrix, determinant is 0");this.identity();return this}this.multiplyScalar(1/c);return this},compose:function(a,b,c){var d=this.elements,e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.makeScale(c);this.multiply(e,f);d[12]=a.x;d[13]=a.y;d[14]=a.z;return this},decompose:function(a,
|
|
b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]/=c.x;d.elements[1]/=c.x;d.elements[2]/=c.x;d.elements[4]/=c.y;d.elements[5]/=
|
|
b,c){var d=this.elements,e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(d[0],d[1],d[2]);f.set(d[4],d[5],d[6]);g.set(d[8],d[9],d[10]);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=g.length();a.x=d[12];a.y=d[13];a.z=d[14];d=THREE.Matrix4.__m1;d.copy(this);d.elements[0]/=c.x;d.elements[1]/=c.x;d.elements[2]/=c.x;d.elements[4]/=c.y;d.elements[5]/=
|
|
c.y;d.elements[6]/=c.y;d.elements[8]/=c.z;d.elements[9]/=c.z;d.elements[10]/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*
|
|
c.y;d.elements[6]/=c.y;d.elements[8]/=c.z;d.elements[9]/=c.z;d.elements[10]/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){var b=this.elements,a=a.elements;b[12]=a[12];b[13]=a[13];b[14]=a[14];return this},extractRotation:function(a){var b=this.elements,a=a.elements,c=THREE.Matrix4.__v1,d=1/c.set(a[0],a[1],a[2]).length(),e=1/c.set(a[4],a[5],a[6]).length(),c=1/c.set(a[8],a[9],a[10]).length();b[0]=a[0]*d;b[1]=a[1]*d;b[2]=a[2]*d;b[4]=a[4]*e;b[5]=a[5]*e;b[6]=a[6]*e;b[8]=a[8]*
|
|
c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],m=Math.cos(a),a=Math.sin(a);b[4]=m*c+a*g;b[5]=m*d+a*h;b[6]=m*e+a*i;b[7]=m*f+a*k;b[8]=m*g-a*c;b[9]=m*h-a*d;b[10]=m*i-a*e;b[11]=m*k-a*f;return this},rotateY:function(a){var b=
|
|
c;b[9]=a[9]*c;b[10]=a[10]*c;return this},translate:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[12]=b[0]*c+b[4]*d+b[8]*a+b[12];b[13]=b[1]*c+b[5]*d+b[9]*a+b[13];b[14]=b[2]*c+b[6]*d+b[10]*a+b[14];b[15]=b[3]*c+b[7]*d+b[11]*a+b[15];return this},rotateX:function(a){var b=this.elements,c=b[4],d=b[5],e=b[6],f=b[7],g=b[8],h=b[9],i=b[10],k=b[11],m=Math.cos(a),a=Math.sin(a);b[4]=m*c+a*g;b[5]=m*d+a*h;b[6]=m*e+a*i;b[7]=m*f+a*k;b[8]=m*g-a*c;b[9]=m*h-a*d;b[10]=m*i-a*e;b[11]=m*k-a*f;return this},rotateY:function(a){var b=
|
|
this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],k=b[11],m=Math.cos(a),a=Math.sin(a);b[0]=m*c-a*g;b[1]=m*d-a*h;b[2]=m*e-a*i;b[3]=m*f-a*k;b[8]=m*g+a*c;b[9]=m*h+a*d;b[10]=m*i+a*e;b[11]=m*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],m=Math.cos(a),a=Math.sin(a);b[0]=m*c+a*g;b[1]=m*d+a*h;b[2]=m*e+a*i;b[3]=m*f+a*k;b[4]=m*g-a*c;b[5]=m*h-a*d;b[6]=m*i-a*e;b[7]=m*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;
|
|
this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[8],h=b[9],i=b[10],k=b[11],m=Math.cos(a),a=Math.sin(a);b[0]=m*c-a*g;b[1]=m*d-a*h;b[2]=m*e-a*i;b[3]=m*f-a*k;b[8]=m*g+a*c;b[9]=m*h+a*d;b[10]=m*i+a*e;b[11]=m*k+a*f;return this},rotateZ:function(a){var b=this.elements,c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],k=b[7],m=Math.cos(a),a=Math.sin(a);b[0]=m*c+a*g;b[1]=m*d+a*h;b[2]=m*e+a*i;b[3]=m*f+a*k;b[4]=m*g-a*c;b[5]=m*h-a*d;b[6]=m*i-a*e;b[7]=m*k-a*f;return this},rotateByAxis:function(a,b){var c=this.elements;
|
|
-if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),m=Math.sin(b),n=1-k,l=d*e*n,s=d*f*n,n=e*f*n,d=d*m,q=e*m,m=f*m,f=g+(1-g)*k,g=l+m,e=s-q,l=l-m,h=h+(1-h)*k,m=n+d,s=s+q,n=n-d,i=i+(1-i)*k,k=c[0],d=c[1],q=c[2],p=c[3],r=c[4],v=c[5],x=c[6],w=c[7],t=c[8],J=c[9],E=c[10],C=c[11];c[0]=f*k+g*r+e*t;c[1]=f*d+g*
|
|
|
|
-v+e*J;c[2]=f*q+g*x+e*E;c[3]=f*p+g*w+e*C;c[4]=l*k+h*r+m*t;c[5]=l*d+h*v+m*J;c[6]=l*q+h*x+m*E;c[7]=l*p+h*w+m*C;c[8]=s*k+n*r+i*t;c[9]=s*d+n*v+i*J;c[10]=s*q+n*x+i*E;c[11]=s*p+n*w+i*C;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],
|
|
|
|
|
|
+if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===a.z)return this.rotateZ(b);var d=a.x,e=a.y,f=a.z,g=Math.sqrt(d*d+e*e+f*f),d=d/g,e=e/g,f=f/g,g=d*d,h=e*e,i=f*f,k=Math.cos(b),m=Math.sin(b),n=1-k,l=d*e*n,s=d*f*n,n=e*f*n,d=d*m,q=e*m,m=f*m,f=g+(1-g)*k,g=l+m,e=s-q,l=l-m,h=h+(1-h)*k,m=n+d,s=s+q,n=n-d,i=i+(1-i)*k,k=c[0],d=c[1],q=c[2],p=c[3],r=c[4],w=c[5],x=c[6],v=c[7],t=c[8],I=c[9],E=c[10],C=c[11];c[0]=f*k+g*r+e*t;c[1]=f*d+g*
|
|
|
|
+w+e*I;c[2]=f*q+g*x+e*E;c[3]=f*p+g*v+e*C;c[4]=l*k+h*r+m*t;c[5]=l*d+h*w+m*I;c[6]=l*q+h*x+m*E;c[7]=l*p+h*v+m*C;c[8]=s*k+n*r+i*t;c[9]=s*d+n*w+i*I;c[10]=s*q+n*x+i*E;c[11]=s*p+n*v+i*C;return this},scale:function(a){var b=this.elements,c=a.x,d=a.y,a=a.z;b[0]*=c;b[4]*=d;b[8]*=a;b[1]*=c;b[5]*=d;b[9]*=a;b[2]*=c;b[6]*=d;b[10]*=a;b[3]*=c;b[7]*=d;b[11]*=a;return this},getMaxScaleOnAxis:function(){var a=this.elements;return Math.sqrt(Math.max(a[0]*a[0]+a[1]*a[1]+a[2]*a[2],Math.max(a[4]*a[4]+a[5]*a[5]+a[6]*a[6],
|
|
a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a){this.set(1,0,0,a.x,0,1,0,a.y,0,0,1,a.z,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=
|
|
a[8]*a[8]+a[9]*a[9]+a[10]*a[10])))},makeTranslation:function(a){this.set(1,0,0,a.x,0,1,0,a.y,0,0,1,a.z,0,0,0,1);return this},makeRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},makeRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},makeRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},makeRotationAxis:function(a,b){var c=
|
|
Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a){this.set(a.x,0,0,0,0,a.y,0,0,0,0,a.z,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,
|
|
Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,h=a.z,i=e*f,k=e*g;this.set(i*f+c,i*g-d*h,i*h+d*g,0,i*g+d*h,k*g+c,k*h-d*f,0,i*h-d*g,k*h+d*f,e*h*h+c,0,0,0,0,1);return this},makeScale:function(a){this.set(a.x,0,0,0,0,a.y,0,0,0,0,a.z,0,0,0,0,1);return this},makeFrustum:function(a,b,c,d,e,f){var g=this.elements;g[0]=2*e/(b-a);g[4]=0;g[8]=(b+a)/(b-a);g[12]=0;g[1]=0;g[5]=2*e/(d-c);g[9]=(d+c)/(d-c);g[13]=0;g[2]=0;g[6]=0;g[10]=-(f+e)/(f-e);g[14]=-2*f*e/(f-e);g[3]=0;g[7]=0;g[11]=-1;g[15]=0;return this},makePerspective:function(a,
|
|
b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};
|
|
b,c,d){var a=c*Math.tan(THREE.Math.degToRad(0.5*a)),e=-a;return this.makeFrustum(e*b,a*b,e,a,c,d)},makeOrthographic:function(a,b,c,d,e,f){var g=this.elements,h=b-a,i=c-d,k=f-e;g[0]=2/h;g[4]=0;g[8]=0;g[12]=-((b+a)/h);g[1]=0;g[5]=2/i;g[9]=0;g[13]=-((c+d)/i);g[2]=0;g[6]=0;g[10]=-2/k;g[14]=-((f+e)/k);g[3]=0;g[7]=0;g[11]=0;g[15]=1;return this},clone:function(){var a=this.elements;return new THREE.Matrix4(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15])}};
|
|
@@ -113,9 +113,9 @@ THREE.Triangle.prototype={constructor:THREE.Triangle,set:function(a,b,c){this.a.
|
|
new THREE.Vector3).add(this.a,this.b).addSelf(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)},
|
|
new THREE.Vector3).add(this.a,this.b).addSelf(this.c).multiplyScalar(1/3)},normal:function(a){return THREE.Triangle.normal(this.a,this.b,this.c,a)},plane:function(a){return(a||new THREE.Plane).setFromCoplanarPoints(this.a,this.b,this.c)},barycoordFromPoint:function(a,b){return THREE.Triangle.barycoordFromPoint(a,this.a,this.b,this.c,b)},containsPoint:function(a){return THREE.Triangle.containsPoint(a,this.a,this.b,this.c)},equals:function(a){return a.a.equals(this.a)&&a.b.equals(this.b)&&a.c.equals(this.c)},
|
|
clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Triangle.__v0=new THREE.Vector3;THREE.Triangle.__v1=new THREE.Vector3;THREE.Triangle.__v2=new THREE.Vector3;THREE.Triangle.__v3=new THREE.Vector3;THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.getDelta();return this.elapsedTime};
|
|
clone:function(){return(new THREE.Triangle).copy(this)}};THREE.Triangle.__v0=new THREE.Vector3;THREE.Triangle.__v1=new THREE.Vector3;THREE.Triangle.__v2=new THREE.Vector3;THREE.Triangle.__v3=new THREE.Vector3;THREE.Vertex=function(a){console.warn("THREE.Vertex has been DEPRECATED. Use THREE.Vector3 instead.");return a};THREE.UV=function(a,b){console.warn("THREE.UV has been DEPRECATED. Use THREE.Vector2 instead.");return new THREE.Vector2(a,b)};THREE.Clock=function(a){this.autoStart=void 0!==a?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.getDelta();return this.elapsedTime};
|
|
THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.length()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Matrix4,g=function(a,b){return a.distance-b.distance},h=function(g,h,i){if(g instanceof a.Particle){h=h.ray.distanceToPoint(g.matrixWorld.getPosition());if(h>g.scale.x)return i;i.push({distance:h,point:g.position,face:null,object:g})}else if(g instanceof a.Mesh){b.set(g.matrixWorld.getPosition(),
|
|
THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.001*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.EventDispatcher=function(){var a={};this.addEventListener=function(b,c){void 0===a[b]&&(a[b]=[]);-1===a[b].indexOf(c)&&a[b].push(c)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);-1!==d&&a[b].splice(d,1)};this.dispatchEvent=function(b){var c=a[b.type];if(void 0!==c){b.target=this;for(var d=0,e=c.length;d<e;d++)c[d].call(this,b)}}};(function(a){a.Raycaster=function(b,c,d,e){this.ray=new a.Ray(b,c);0<this.ray.direction.length()&&this.ray.direction.normalize();this.near=d||0;this.far=e||Infinity};var b=new a.Sphere,c=new a.Ray,d=new a.Plane,e=new a.Vector3,f=new a.Matrix4,g=function(a,b){return a.distance-b.distance},h=function(g,h,i){if(g instanceof a.Particle){h=h.ray.distanceToPoint(g.matrixWorld.getPosition());if(h>g.scale.x)return i;i.push({distance:h,point:g.position,face:null,object:g})}else if(g instanceof a.Mesh){b.set(g.matrixWorld.getPosition(),
|
|
-g.geometry.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!h.ray.isIntersectionSphere(b))return i;var l=g.geometry,s=l.vertices,q=g.material instanceof a.MeshFaceMaterial,p=!0===q?g.material.materials:null,r=g.material.side,v,x,w,t=h.precision;g.matrixRotationWorld.extractRotation(g.matrixWorld);f.getInverse(g.matrixWorld);c.copy(h.ray).transform(f);for(var J=0,E=l.faces.length;J<E;J++){var C=l.faces[J],r=!0===q?p[C.materialIndex]:g.material;if(void 0!==r){d.setFromNormalAndCoplanarPoint(C.normal,
|
|
|
|
-s[C.a]);var z=c.distanceToPlane(d);if(!(Math.abs(z)<t)&&!(0>z)){r=r.side;if(r!==a.DoubleSide&&(v=c.direction.dot(d.normal),!(r===a.FrontSide?0>v:0<v)))continue;if(!(z<h.near||z>h.far)){e=c.at(z,e);if(C instanceof a.Face3){if(r=s[C.a],v=s[C.b],x=s[C.c],!a.Triangle.containsPoint(e,r,v,x))continue}else if(C instanceof a.Face4){if(r=s[C.a],v=s[C.b],x=s[C.c],w=s[C.d],!a.Triangle.containsPoint(e,r,v,w)&&!a.Triangle.containsPoint(e,v,x,w))continue}else throw Error("face type not supported");i.push({distance:z,
|
|
|
|
-point:h.ray.at(z),face:C,faceIndex:J,object:g})}}}}}},i=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)h(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&i(a,this,c);h(a,this,c);c.sort(g);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)h(a[d],
|
|
|
|
|
|
+g.geometry.boundingSphere.radius*g.matrixWorld.getMaxScaleOnAxis());if(!h.ray.isIntersectionSphere(b))return i;var l=g.geometry,s=l.vertices,q=g.material instanceof a.MeshFaceMaterial,p=!0===q?g.material.materials:null,r=g.material.side,w,x,v,t=h.precision;g.matrixRotationWorld.extractRotation(g.matrixWorld);f.getInverse(g.matrixWorld);c.copy(h.ray).transform(f);for(var I=0,E=l.faces.length;I<E;I++){var C=l.faces[I],r=!0===q?p[C.materialIndex]:g.material;if(void 0!==r){d.setFromNormalAndCoplanarPoint(C.normal,
|
|
|
|
+s[C.a]);var z=c.distanceToPlane(d);if(!(Math.abs(z)<t)&&!(0>z)){r=r.side;if(r!==a.DoubleSide&&(w=c.direction.dot(d.normal),!(r===a.FrontSide?0>w:0<w)))continue;if(!(z<h.near||z>h.far)){e=c.at(z,e);if(C instanceof a.Face3){if(r=s[C.a],w=s[C.b],x=s[C.c],!a.Triangle.containsPoint(e,r,w,x))continue}else if(C instanceof a.Face4){if(r=s[C.a],w=s[C.b],x=s[C.c],v=s[C.d],!a.Triangle.containsPoint(e,r,w,v)&&!a.Triangle.containsPoint(e,w,x,v))continue}else throw Error("face type not supported");i.push({distance:z,
|
|
|
|
+point:h.ray.at(z),face:C,faceIndex:I,object:g})}}}}}},i=function(a,b,c){for(var a=a.getDescendants(),d=0,e=a.length;d<e;d++)h(a[d],b,c)};a.Raycaster.prototype.precision=1E-4;a.Raycaster.prototype.set=function(a,b){this.ray.set(a,b);0<this.ray.direction.length()&&this.ray.direction.normalize()};a.Raycaster.prototype.intersectObject=function(a,b){var c=[];!0===b&&i(a,this,c);h(a,this,c);c.sort(g);return c};a.Raycaster.prototype.intersectObjects=function(a,b){for(var c=[],d=0,e=a.length;d<e;d++)h(a[d],
|
|
this,c),!0===b&&i(a[d],this,c);c.sort(g);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
this,c),!0===b&&i(a[d],this,c);c.sort(g);return c}})(THREE);THREE.Object3D=function(){this.id=THREE.Object3DIdCount++;this.name="";this.properties={};this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder=THREE.Object3D.defaultEulerOrder;this.scale=new THREE.Vector3(1,1,1);this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);a=(new THREE.Matrix4).extractRotation(this.matrix);this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);a=(new THREE.Matrix4).extractRotation(this.matrix);this.rotation.setEulerFromRotationMatrix(a,this.eulerOrder);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,
|
|
@@ -125,18 +125,18 @@ traverse:function(a){a(this);for(var b=0,c=this.children.length;b<c;b++)this.chi
|
|
!1===this.useQuaternion?this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder):this.matrix.setRotationFromQuaternion(this.quaternion);(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),
|
|
!1===this.useQuaternion?this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder):this.matrix.setRotationFromQuaternion(this.quaternion);(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)void 0===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),
|
|
this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){void 0===a&&(a=new THREE.Object3D);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(this.rotation);a.eulerOrder=this.eulerOrder;a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);
|
|
this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},clone:function(a){void 0===a&&(a=new THREE.Object3D);a.name=this.name;a.up.copy(this.up);a.position.copy(this.position);a.rotation instanceof THREE.Vector3&&a.rotation.copy(this.rotation);a.eulerOrder=this.eulerOrder;a.scale.copy(this.scale);a.renderDepth=this.renderDepth;a.rotationAutoUpdate=this.rotationAutoUpdate;a.matrix.copy(this.matrix);a.matrixWorld.copy(this.matrixWorld);a.matrixRotationWorld.copy(this.matrixRotationWorld);
|
|
a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());return a}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(k===n){var a=new THREE.RenderableVertex;m.push(a);n++;k++;return a}return m[k++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
a.matrixAutoUpdate=this.matrixAutoUpdate;a.matrixWorldNeedsUpdate=this.matrixWorldNeedsUpdate;a.quaternion.copy(this.quaternion);a.useQuaternion=this.useQuaternion;a.visible=this.visible;a.castShadow=this.castShadow;a.receiveShadow=this.receiveShadow;a.frustumCulled=this.frustumCulled;for(var b=0;b<this.children.length;b++)a.add(this.children[b].clone());return a}};THREE.Object3D.__m1=new THREE.Matrix4;THREE.Object3D.defaultEulerOrder="XYZ";THREE.Object3DIdCount=0;THREE.Projector=function(){function a(){if(f===h){var a=new THREE.RenderableObject;g.push(a);h++;f++;return a}return g[f++]}function b(){if(k===n){var a=new THREE.RenderableVertex;m.push(a);n++;k++;return a}return m[k++]}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,f=b.z+b.w,g=-a.z+a.w,h=-b.z+b.w;if(0<=e&&0<=f&&0<=g&&0<=h)return!0;if(0>e&&0>f||0>g&&0>h)return!1;0>e?c=Math.max(c,e/(e-f)):0>f&&(d=Math.min(d,e/(e-f)));0>g?c=Math.max(c,g/(g-h)):0>h&&(d=Math.min(d,g/(g-h)));if(d<
|
|
-c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var e,f,g=[],h=0,i,k,m=[],n=0,l,s,q=[],p=0,r,v=[],x=0,w,t,J=[],E=0,C,z,G=[],F=0,I={objects:[],sprites:[],lights:[],elements:[]},$=new THREE.Vector3,B=new THREE.Vector4,R=new THREE.Matrix4,A=new THREE.Matrix4,H,K=new THREE.Matrix4,M=new THREE.Matrix3,P=new THREE.Matrix3,ga=new THREE.Vector3,ra=new THREE.Frustum,L=new THREE.Vector4,oa=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,
|
|
|
|
-b.matrixWorldInverse);return a.applyMatrix4(A)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);A.multiply(b.matrixWorld,b.projectionMatrixInverse);return a.applyMatrix4(A)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Raycaster(a,c)};this.projectScene=function(g,h,n,W){var ja=h.near,fa=h.far,aa=!1,ma,Q,ka,va,Ea,na,wa,qa,$a,rb,La,db,pb;
|
|
|
|
-z=t=r=s=0;I.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();R.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));A.multiply(h.projectionMatrix,R);P.getInverse(R);P.transpose();ra.setFromMatrix(A);f=0;I.objects.length=0;I.sprites.length=0;I.lights.length=0;var Nb=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof THREE.Light)I.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===
|
|
|
|
-f.frustumCulled||!0===ra.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:($.copy(f.matrixWorld.getPosition()),$.applyMatrix4(A),e.z=$.z),I.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:($.copy(f.matrixWorld.getPosition()),$.applyMatrix4(A),e.z=$.z),I.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:($.copy(f.matrixWorld.getPosition()),$.applyMatrix4(A),e.z=$.z),
|
|
|
|
-I.objects.push(e));Nb(f)}}};Nb(g);!0===n&&I.objects.sort(c);g=0;for(n=I.objects.length;g<n;g++)if(qa=I.objects[g].object,H=qa.matrixWorld,k=0,qa instanceof THREE.Mesh){$a=qa.geometry;ka=$a.vertices;rb=$a.faces;$a=$a.faceVertexUvs;M.getInverse(H);M.transpose();db=qa.material instanceof THREE.MeshFaceMaterial;pb=!0===db?qa.material:null;ma=0;for(Q=ka.length;ma<Q;ma++)i=b(),i.positionWorld.copy(ka[ma]),i.positionWorld.applyMatrix4(H),i.positionScreen.copy(i.positionWorld),i.positionScreen.applyMatrix4(A),
|
|
|
|
-i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>ja&&i.positionScreen.z<fa;ka=0;for(ma=rb.length;ka<ma;ka++){Q=rb[ka];var yb=!0===db?pb.materials[Q.materialIndex]:qa.material;if(void 0!==yb){na=yb.side;if(Q instanceof THREE.Face3)if(va=m[Q.a],Ea=m[Q.b],wa=m[Q.c],!0===va.visible&&!0===Ea.visible&&!0===wa.visible)if(aa=0>(wa.positionScreen.x-va.positionScreen.x)*(Ea.positionScreen.y-va.positionScreen.y)-(wa.positionScreen.y-va.positionScreen.y)*
|
|
|
|
-(Ea.positionScreen.x-va.positionScreen.x),na===THREE.DoubleSide||aa===(na===THREE.FrontSide))s===p?(La=new THREE.RenderableFace3,q.push(La),p++,s++,l=La):l=q[s++],l.v1.copy(va),l.v2.copy(Ea),l.v3.copy(wa);else continue;else continue;else if(Q instanceof THREE.Face4)if(va=m[Q.a],Ea=m[Q.b],wa=m[Q.c],La=m[Q.d],!0===va.visible&&!0===Ea.visible&&!0===wa.visible&&!0===La.visible)if(aa=0>(La.positionScreen.x-va.positionScreen.x)*(Ea.positionScreen.y-va.positionScreen.y)-(La.positionScreen.y-va.positionScreen.y)*
|
|
|
|
-(Ea.positionScreen.x-va.positionScreen.x)||0>(Ea.positionScreen.x-wa.positionScreen.x)*(La.positionScreen.y-wa.positionScreen.y)-(Ea.positionScreen.y-wa.positionScreen.y)*(La.positionScreen.x-wa.positionScreen.x),na===THREE.DoubleSide||aa===(na===THREE.FrontSide)){if(r===x){var Ra=new THREE.RenderableFace4;v.push(Ra);x++;r++;l=Ra}else l=v[r++];l.v1.copy(va);l.v2.copy(Ea);l.v3.copy(wa);l.v4.copy(La)}else continue;else continue;l.normalModel.copy(Q.normal);!1===aa&&(na===THREE.BackSide||na===THREE.DoubleSide)&&
|
|
|
|
-l.normalModel.negate();l.normalModel.applyMatrix3(M);l.normalModel.normalize();l.normalModelView.copy(l.normalModel);l.normalModelView.applyMatrix3(P);l.centroidModel.copy(Q.centroid);l.centroidModel.applyMatrix4(H);wa=Q.vertexNormals;va=0;for(Ea=wa.length;va<Ea;va++)La=l.vertexNormalsModel[va],La.copy(wa[va]),!1===aa&&(na===THREE.BackSide||na===THREE.DoubleSide)&&La.negate(),La.applyMatrix3(M),La.normalize(),Ra=l.vertexNormalsModelView[va],Ra.copy(La),Ra.applyMatrix3(P);l.vertexNormalsLength=wa.length;
|
|
|
|
-na=0;for(va=$a.length;na<va;na++)if(La=$a[na][ka],void 0!==La){Ea=0;for(wa=La.length;Ea<wa;Ea++)l.uvs[na][Ea]=La[Ea]}l.color=Q.color;l.material=yb;ga.copy(l.centroidModel);ga.applyMatrix4(A);l.z=ga.z;I.elements.push(l)}}}else if(qa instanceof THREE.Line){K.multiply(A,H);ka=qa.geometry.vertices;va=b();va.positionScreen.copy(ka[0]);va.positionScreen.applyMatrix4(K);rb=qa.type===THREE.LinePieces?2:1;ma=1;for(Q=ka.length;ma<Q;ma++)va=b(),va.positionScreen.copy(ka[ma]),va.positionScreen.applyMatrix4(K),
|
|
|
|
-0<(ma+1)%rb||(Ea=m[k-2],L.copy(va.positionScreen),oa.copy(Ea.positionScreen),!0===d(L,oa)&&(L.multiplyScalar(1/L.w),oa.multiplyScalar(1/oa.w),t===E?($a=new THREE.RenderableLine,J.push($a),E++,t++,w=$a):w=J[t++],w.v1.positionScreen.copy(L),w.v2.positionScreen.copy(oa),w.z=Math.max(L.z,oa.z),w.material=qa.material,I.elements.push(w)))}g=0;for(n=I.sprites.length;g<n;g++)qa=I.sprites[g].object,H=qa.matrixWorld,qa instanceof THREE.Particle&&(B.set(H.elements[12],H.elements[13],H.elements[14],1),B.applyMatrix4(A),
|
|
|
|
-B.z/=B.w,0<B.z&&1>B.z&&(z===F?(ja=new THREE.RenderableParticle,G.push(ja),F++,z++,C=ja):C=G[z++],C.object=qa,C.x=B.x/B.w,C.y=B.y/B.w,C.z=B.z,C.rotation=qa.rotation.z,C.scale.x=qa.scale.x*Math.abs(C.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),C.scale.y=qa.scale.y*Math.abs(C.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),C.material=qa.material,I.elements.push(C)));!0===W&&I.elements.sort(c);return I}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
|
|
|
|
+c)return!1;a.lerpSelf(b,c);b.lerpSelf(a,1-d);return!0}var e,f,g=[],h=0,i,k,m=[],n=0,l,s,q=[],p=0,r,w=[],x=0,v,t,I=[],E=0,C,z,G=[],F=0,J={objects:[],sprites:[],lights:[],elements:[]},V=new THREE.Vector3,B=new THREE.Vector4,T=new THREE.Matrix4,A=new THREE.Matrix4,H,L=new THREE.Matrix4,M=new THREE.Matrix3,P=new THREE.Matrix3,ca=new THREE.Vector3,oa=new THREE.Frustum,K=new THREE.Vector4,ha=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);A.multiply(b.projectionMatrix,
|
|
|
|
+b.matrixWorldInverse);return a.applyMatrix4(A)};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);A.multiply(b.matrixWorld,b.projectionMatrixInverse);return a.applyMatrix4(A)};this.pickingRay=function(a,b){a.z=-1;var c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Raycaster(a,c)};this.projectScene=function(g,h,n,ia){var wa=h.near,ya=h.far,sa=!1,ga,fa,xa,pa,za,Oa,ja,ta,qa,kb,Ja,Ya,
|
|
|
|
+qb;z=t=r=s=0;J.elements.length=0;g.updateMatrixWorld();void 0===h.parent&&h.updateMatrixWorld();T.copy(h.matrixWorldInverse.getInverse(h.matrixWorld));A.multiply(h.projectionMatrix,T);P.getInverse(T);P.transpose();oa.setFromMatrix(A);f=0;J.objects.length=0;J.sprites.length=0;J.lights.length=0;var Db=function(b){for(var c=0,d=b.children.length;c<d;c++){var f=b.children[c];if(!1!==f.visible){if(f instanceof THREE.Light)J.lights.push(f);else if(f instanceof THREE.Mesh||f instanceof THREE.Line){if(!1===
|
|
|
|
+f.frustumCulled||!0===oa.intersectsObject(f))e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.copy(f.matrixWorld.getPosition()),V.applyMatrix4(A),e.z=V.z),J.objects.push(e)}else f instanceof THREE.Sprite||f instanceof THREE.Particle?(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.copy(f.matrixWorld.getPosition()),V.applyMatrix4(A),e.z=V.z),J.sprites.push(e)):(e=a(),e.object=f,null!==f.renderDepth?e.z=f.renderDepth:(V.copy(f.matrixWorld.getPosition()),V.applyMatrix4(A),e.z=V.z),
|
|
|
|
+J.objects.push(e));Db(f)}}};Db(g);!0===n&&J.objects.sort(c);g=0;for(n=J.objects.length;g<n;g++)if(ta=J.objects[g].object,H=ta.matrixWorld,k=0,ta instanceof THREE.Mesh){qa=ta.geometry;xa=qa.vertices;kb=qa.faces;qa=qa.faceVertexUvs;M.getInverse(H);M.transpose();Ya=ta.material instanceof THREE.MeshFaceMaterial;qb=!0===Ya?ta.material:null;ga=0;for(fa=xa.length;ga<fa;ga++)i=b(),i.positionWorld.copy(xa[ga]),i.positionWorld.applyMatrix4(H),i.positionScreen.copy(i.positionWorld),i.positionScreen.applyMatrix4(A),
|
|
|
|
+i.positionScreen.x/=i.positionScreen.w,i.positionScreen.y/=i.positionScreen.w,i.visible=i.positionScreen.z>wa&&i.positionScreen.z<ya;xa=0;for(ga=kb.length;xa<ga;xa++){fa=kb[xa];var zb=!0===Ya?qb.materials[fa.materialIndex]:ta.material;if(void 0!==zb){Oa=zb.side;if(fa instanceof THREE.Face3)if(pa=m[fa.a],za=m[fa.b],ja=m[fa.c],!0===pa.visible&&!0===za.visible&&!0===ja.visible)if(sa=0>(ja.positionScreen.x-pa.positionScreen.x)*(za.positionScreen.y-pa.positionScreen.y)-(ja.positionScreen.y-pa.positionScreen.y)*
|
|
|
|
+(za.positionScreen.x-pa.positionScreen.x),Oa===THREE.DoubleSide||sa===(Oa===THREE.FrontSide))s===p?(Ja=new THREE.RenderableFace3,q.push(Ja),p++,s++,l=Ja):l=q[s++],l.v1.copy(pa),l.v2.copy(za),l.v3.copy(ja);else continue;else continue;else if(fa instanceof THREE.Face4)if(pa=m[fa.a],za=m[fa.b],ja=m[fa.c],Ja=m[fa.d],!0===pa.visible&&!0===za.visible&&!0===ja.visible&&!0===Ja.visible)if(sa=0>(Ja.positionScreen.x-pa.positionScreen.x)*(za.positionScreen.y-pa.positionScreen.y)-(Ja.positionScreen.y-pa.positionScreen.y)*
|
|
|
|
+(za.positionScreen.x-pa.positionScreen.x)||0>(za.positionScreen.x-ja.positionScreen.x)*(Ja.positionScreen.y-ja.positionScreen.y)-(za.positionScreen.y-ja.positionScreen.y)*(Ja.positionScreen.x-ja.positionScreen.x),Oa===THREE.DoubleSide||sa===(Oa===THREE.FrontSide)){if(r===x){var rb=new THREE.RenderableFace4;w.push(rb);x++;r++;l=rb}else l=w[r++];l.v1.copy(pa);l.v2.copy(za);l.v3.copy(ja);l.v4.copy(Ja)}else continue;else continue;l.normalModel.copy(fa.normal);!1===sa&&(Oa===THREE.BackSide||Oa===THREE.DoubleSide)&&
|
|
|
|
+l.normalModel.negate();l.normalModel.applyMatrix3(M);l.normalModel.normalize();l.normalModelView.copy(l.normalModel);l.normalModelView.applyMatrix3(P);l.centroidModel.copy(fa.centroid);l.centroidModel.applyMatrix4(H);ja=fa.vertexNormals;pa=0;for(za=ja.length;pa<za;pa++)Ja=l.vertexNormalsModel[pa],Ja.copy(ja[pa]),!1===sa&&(Oa===THREE.BackSide||Oa===THREE.DoubleSide)&&Ja.negate(),Ja.applyMatrix3(M),Ja.normalize(),rb=l.vertexNormalsModelView[pa],rb.copy(Ja),rb.applyMatrix3(P);l.vertexNormalsLength=ja.length;
|
|
|
|
+Oa=0;for(pa=qa.length;Oa<pa;Oa++)if(Ja=qa[Oa][xa],void 0!==Ja){za=0;for(ja=Ja.length;za<ja;za++)l.uvs[Oa][za]=Ja[za]}l.color=fa.color;l.material=zb;ca.copy(l.centroidModel);ca.applyMatrix4(A);l.z=ca.z;J.elements.push(l)}}}else if(ta instanceof THREE.Line){L.multiply(A,H);xa=ta.geometry.vertices;pa=b();pa.positionScreen.copy(xa[0]);pa.positionScreen.applyMatrix4(L);kb=ta.type===THREE.LinePieces?2:1;ga=1;for(fa=xa.length;ga<fa;ga++)pa=b(),pa.positionScreen.copy(xa[ga]),pa.positionScreen.applyMatrix4(L),
|
|
|
|
+0<(ga+1)%kb||(za=m[k-2],K.copy(pa.positionScreen),ha.copy(za.positionScreen),!0===d(K,ha)&&(K.multiplyScalar(1/K.w),ha.multiplyScalar(1/ha.w),t===E?(qa=new THREE.RenderableLine,I.push(qa),E++,t++,v=qa):v=I[t++],v.v1.positionScreen.copy(K),v.v2.positionScreen.copy(ha),v.z=Math.max(K.z,ha.z),v.material=ta.material,J.elements.push(v)))}g=0;for(n=J.sprites.length;g<n;g++)ta=J.sprites[g].object,H=ta.matrixWorld,ta instanceof THREE.Particle&&(B.set(H.elements[12],H.elements[13],H.elements[14],1),B.applyMatrix4(A),
|
|
|
|
+B.z/=B.w,0<B.z&&1>B.z&&(z===F?(wa=new THREE.RenderableParticle,G.push(wa),F++,z++,C=wa):C=G[z++],C.object=ta,C.x=B.x/B.w,C.y=B.y/B.w,C.z=B.z,C.rotation=ta.rotation.z,C.scale.x=ta.scale.x*Math.abs(C.x-(B.x+h.projectionMatrix.elements[0])/(B.w+h.projectionMatrix.elements[12])),C.scale.y=ta.scale.y*Math.abs(C.y-(B.y+h.projectionMatrix.elements[5])/(B.w+h.projectionMatrix.elements[13])),C.material=ta.material,J.elements.push(C)));!0===ia&&J.elements.sort(c);return J}};THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=void 0!==f?f:0;this.centroid=new THREE.Vector3};
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==g?g:0;this.centroid=new THREE.Vector3};
|
|
return a}};THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=void 0!==g?g:0;this.centroid=new THREE.Vector3};
|
|
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;b=0;for(c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();b=0;for(c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();b=0;for(c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
|
|
@@ -151,9 +151,9 @@ THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d
|
|
computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<
|
|
computeMorphNormals:function(){var a,b,c,d,e;c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];e.__originalFaceNormal?e.__originalFaceNormal.copy(e.normal):e.__originalFaceNormal=e.normal.clone();e.__originalVertexNormals||(e.__originalVertexNormals=[]);a=0;for(b=e.vertexNormals.length;a<b;a++)e.__originalVertexNormals[a]?e.__originalVertexNormals[a].copy(e.vertexNormals[a]):e.__originalVertexNormals[a]=e.vertexNormals[a].clone()}var f=new THREE.Geometry;f.faces=this.faces;a=0;for(b=this.morphTargets.length;a<
|
|
b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(k)}g=this.morphNormals[a];f.vertices=
|
|
b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var g=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,k;c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=new THREE.Vector3,k=e instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},g.push(i),h.push(k)}g=this.morphNormals[a];f.vertices=
|
|
this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],k=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,
|
|
this.morphTargets[a].vertices;f.computeFaceNormals();f.computeVertexNormals();c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],i=g.faceNormals[c],k=g.vertexNormals[c],i.copy(e.normal),e instanceof THREE.Face3?(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2])):(k.a.copy(e.vertexNormals[0]),k.b.copy(e.vertexNormals[1]),k.c.copy(e.vertexNormals[2]),k.d.copy(e.vertexNormals[3]))}c=0;for(d=this.faces.length;c<d;c++)e=this.faces[c],e.normal=e.__originalFaceNormal,
|
|
-e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];m=g[e];n=g[f];l=g[z];s=i.x-h.x;q=k.x-h.x;p=i.y-h.y;r=k.y-h.y;v=i.z-h.z;x=k.z-h.z;w=n.x-m.x;t=l.x-m.x;J=n.y-m.y;E=l.y-m.y;C=1/(w*E-t*J);I.set((E*s-J*q)*C,(E*p-J*r)*C,(E*v-J*x)*C);$.set((w*q-t*s)*C,(w*r-t*p)*C,(w*x-t*v)*C);G[b].addSelf(I);G[c].addSelf(I);G[d].addSelf(I);F[b].addSelf($);F[c].addSelf($);F[d].addSelf($)}var b,c,d,e,f,g,h,i,k,m,n,l,s,q,p,r,v,x,
|
|
|
|
-w,t,J,E,C,z,G=[],F=[],I=new THREE.Vector3,$=new THREE.Vector3,B=new THREE.Vector3,R=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,F[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var H=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
|
|
|
|
-f.vertexNormals.length;d++)A.copy(f.vertexNormals[d]),e=f[H[d]],z=G[e],B.copy(z),B.subSelf(A.multiplyScalar(A.dot(z))).normalize(),R.cross(f.vertexNormals[d],z),e=R.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},
|
|
|
|
|
|
+e.vertexNormals=e.__originalVertexNormals},computeTangents:function(){function a(a,b,c,d,e,f,z){h=a.vertices[b];i=a.vertices[c];k=a.vertices[d];m=g[e];n=g[f];l=g[z];s=i.x-h.x;q=k.x-h.x;p=i.y-h.y;r=k.y-h.y;w=i.z-h.z;x=k.z-h.z;v=n.x-m.x;t=l.x-m.x;I=n.y-m.y;E=l.y-m.y;C=1/(v*E-t*I);J.set((E*s-I*q)*C,(E*p-I*r)*C,(E*w-I*x)*C);V.set((v*q-t*s)*C,(v*r-t*p)*C,(v*x-t*w)*C);G[b].addSelf(J);G[c].addSelf(J);G[d].addSelf(J);F[b].addSelf(V);F[c].addSelf(V);F[d].addSelf(V)}var b,c,d,e,f,g,h,i,k,m,n,l,s,q,p,r,w,x,
|
|
|
|
+v,t,I,E,C,z,G=[],F=[],J=new THREE.Vector3,V=new THREE.Vector3,B=new THREE.Vector3,T=new THREE.Vector3,A=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,F[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],g=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.d,0,1,3),a(this,f.b,f.c,f.d,1,2,3));var H=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<
|
|
|
|
+f.vertexNormals.length;d++)A.copy(f.vertexNormals[d]),e=f[H[d]],z=G[e],B.copy(z),B.subSelf(A.multiplyScalar(A.dot(z))).normalize(),T.cross(f.vertexNormals[d],z),e=T.dot(F[e]),e=0>e?-1:1,f.vertexTangents[d]=new THREE.Vector4(B.x,B.y,B.z,e)}this.hasTangents=!0},computeLineDistances:function(){for(var a=0,b=this.vertices,c=0,d=b.length;c<d;c++)0<c&&(a+=b[c].distanceTo(b[c-1])),this.lineDistances[c]=a},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);this.boundingBox.setFromPoints(this.vertices)},
|
|
computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i,k;this.__tmpVertices=void 0;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(g=
|
|
computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);this.boundingSphere.setFromCenterAndPoints(this.boundingSphere.center,this.vertices)},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),f,g,h,i,k;this.__tmpVertices=void 0;f=0;for(g=this.vertices.length;f<g;f++)d=this.vertices[f],d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];e=[];f=0;for(g=
|
|
this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];h=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(h[i]==h[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];h=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)h[i]==h[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=d){h.splice(d,1);var m=new THREE.Face3(h[0],h[1],h[2],a.normal,a.color,a.materialIndex);h=0;for(i=this.faceVertexUvs.length;h<i;h++)(k=this.faceVertexUvs[h][f])&&
|
|
this.faces.length;f<g;f++)if(a=this.faces[f],a instanceof THREE.Face3){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];h=[a.a,a.b,a.c];d=-1;for(i=0;3>i;i++)if(h[i]==h[(i+1)%3]){e.push(f);break}}else if(a instanceof THREE.Face4){a.a=c[a.a];a.b=c[a.b];a.c=c[a.c];a.d=c[a.d];h=[a.a,a.b,a.c,a.d];d=-1;for(i=0;4>i;i++)h[i]==h[(i+1)%4]&&(0<=d&&e.push(f),d=i);if(0<=d){h.splice(d,1);var m=new THREE.Face3(h[0],h[1],h[2],a.normal,a.color,a.materialIndex);h=0;for(i=this.faceVertexUvs.length;h<i;h++)(k=this.faceVertexUvs[h][f])&&
|
|
k.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(m.vertexNormals=a.vertexNormals,m.vertexNormals.splice(d,1));a.vertexColors&&0<a.vertexColors.length&&(m.vertexColors=a.vertexColors,m.vertexColors.splice(d,1));this.faces[f]=m}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);h=0;for(i=this.faceVertexUvs.length;h<i;h++)this.faceVertexUvs[h].splice(f,1)}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<
|
|
k.splice(d,1);a.vertexNormals&&0<a.vertexNormals.length&&(m.vertexNormals=a.vertexNormals,m.vertexNormals.splice(d,1));a.vertexColors&&0<a.vertexColors.length&&(m.vertexColors=a.vertexColors,m.vertexColors.splice(d,1));this.faces[f]=m}}for(f=e.length-1;0<=f;f--){this.faces.splice(f,1);h=0;for(i=this.faceVertexUvs.length;h<i;h++)this.faceVertexUvs[h].splice(f,1)}c=this.vertices.length-b.length;this.vertices=b;return c},clone:function(){for(var a=new THREE.Geometry,b=this.vertices,c=0,d=b.length;c<
|
|
@@ -161,20 +161,20 @@ d;c++)a.vertices.push(b[c].clone());b=this.faces;c=0;for(d=b.length;c<d;c++)a.fa
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);
|
|
THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,applyMatrix:function(a){var b,c;this.attributes.position&&(b=this.attributes.position.array);this.attributes.normal&&(c=this.attributes.normal.array);void 0!==b&&(a.multiplyVector3Array(b),this.verticesNeedUpdate=!0);void 0!==c&&(b=new THREE.Matrix3,b.getInverse(a).transpose(),b.multiplyVector3Array(c),this.normalizeNormals(),this.normalsNeedUpdate=!0)},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);
|
|
var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,g=a.length;f<g;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=
|
|
var a=this.attributes.position.array;if(a){var b=this.boundingBox,c,d,e;3<=a.length&&(b.min.x=b.max.x=a[0],b.min.y=b.max.y=a[1],b.min.z=b.max.z=a[2]);for(var f=3,g=a.length;f<g;f+=3)c=a[f],d=a[f+1],e=a[f+2],c<b.min.x?b.min.x=c:c>b.max.x&&(b.max.x=c),d<b.min.y?b.min.y=d:d>b.max.y&&(b.max.y=d),e<b.min.z?b.min.z=e:e>b.max.z&&(b.max.z=e)}if(void 0===a||0===a.length)this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){null===this.boundingSphere&&(this.boundingSphere=
|
|
new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
|
|
new THREE.Sphere);var a=this.attributes.position.array;if(a){for(var b,c=0,d,e,f=0,g=a.length;f<g;f+=3)b=a[f],d=a[f+1],e=a[f+2],b=b*b+d*d+e*e,b>c&&(c=b);this.boundingSphere.radius=Math.sqrt(c)}},computeVertexNormals:function(){if(this.attributes.position){var a,b,c,d;a=this.attributes.position.array.length;if(void 0===this.attributes.normal)this.attributes.normal={itemSize:3,array:new Float32Array(a),numItems:a};else{a=0;for(b=this.attributes.normal.array.length;a<b;a++)this.attributes.normal.array[a]=
|
|
-0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,k,m,n,l=new THREE.Vector3,s=new THREE.Vector3,q=new THREE.Vector3,p=new THREE.Vector3,r=new THREE.Vector3;if(this.attributes.index){var v=this.attributes.index.array,x=this.offsets;c=0;for(d=x.length;c<d;++c){b=x[c].start;g=x[c].count;var w=x[c].index;a=b;for(b+=g;a<b;a+=3)g=w+v[a],h=w+v[a+1],i=w+v[a+2],k=e[3*g],m=e[3*g+1],n=e[3*g+2],l.set(k,m,n),k=e[3*h],m=e[3*h+1],n=e[3*h+2],s.set(k,m,n),k=e[3*i],m=e[3*i+1],n=e[3*i+2],q.set(k,
|
|
|
|
|
|
+0}var e=this.attributes.position.array,f=this.attributes.normal.array,g,h,i,k,m,n,l=new THREE.Vector3,s=new THREE.Vector3,q=new THREE.Vector3,p=new THREE.Vector3,r=new THREE.Vector3;if(this.attributes.index){var w=this.attributes.index.array,x=this.offsets;c=0;for(d=x.length;c<d;++c){b=x[c].start;g=x[c].count;var v=x[c].index;a=b;for(b+=g;a<b;a+=3)g=v+w[a],h=v+w[a+1],i=v+w[a+2],k=e[3*g],m=e[3*g+1],n=e[3*g+2],l.set(k,m,n),k=e[3*h],m=e[3*h+1],n=e[3*h+2],s.set(k,m,n),k=e[3*i],m=e[3*i+1],n=e[3*i+2],q.set(k,
|
|
m,n),p.sub(q,s),r.sub(l,s),p.crossSelf(r),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],m=e[a+1],n=e[a+2],l.set(k,m,n),k=e[a+3],m=e[a+4],n=e[a+5],s.set(k,m,n),k=e[a+6],m=e[a+7],n=e[a+8],q.set(k,m,n),p.sub(q,s),r.sub(l,s),p.crossSelf(r),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=
|
|
m,n),p.sub(q,s),r.sub(l,s),p.crossSelf(r),f[3*g]+=p.x,f[3*g+1]+=p.y,f[3*g+2]+=p.z,f[3*h]+=p.x,f[3*h+1]+=p.y,f[3*h+2]+=p.z,f[3*i]+=p.x,f[3*i+1]+=p.y,f[3*i+2]+=p.z}}else{a=0;for(b=e.length;a<b;a+=9)k=e[a],m=e[a+1],n=e[a+2],l.set(k,m,n),k=e[a+3],m=e[a+4],n=e[a+5],s.set(k,m,n),k=e[a+6],m=e[a+7],n=e[a+8],q.set(k,m,n),p.sub(q,s),r.sub(l,s),p.crossSelf(r),f[a]=p.x,f[a+1]=p.y,f[a+2]=p.z,f[a+3]=p.x,f[a+4]=p.y,f[a+5]=p.z,f[a+6]=p.x,f[a+7]=p.y,f[a+8]=p.z}this.normalizeNormals();this.normalsNeedUpdate=!0}},normalizeNormals:function(){for(var a=
|
|
-this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){ga.x=d[3*a];ga.y=d[3*a+1];ga.z=d[3*a+2];ra.copy(ga);oa=i[a];M.copy(oa);M.subSelf(ga.multiplyScalar(ga.dot(oa))).normalize();P.cross(ra,oa);Aa=P.dot(k[a]);L=0>Aa?-1:1;h[4*a]=M.x;h[4*a+1]=M.y;h[4*a+2]=M.z;h[4*a+3]=L}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===
|
|
|
|
|
|
+this.attributes.normal.array,b,c,d,e=0,f=a.length;e<f;e+=3)b=a[e],c=a[e+1],d=a[e+2],b=1/Math.sqrt(b*b+c*c+d*d),a[e]*=b,a[e+1]*=b,a[e+2]*=b},computeTangents:function(){function a(a){ca.x=d[3*a];ca.y=d[3*a+1];ca.z=d[3*a+2];oa.copy(ca);ha=i[a];M.copy(ha);M.subSelf(ca.multiplyScalar(ca.dot(ha))).normalize();P.cross(oa,ha);ea=P.dot(k[a]);K=0>ea?-1:1;h[4*a]=M.x;h[4*a+1]=M.y;h[4*a+2]=M.z;h[4*a+3]=K}if(void 0===this.attributes.index||void 0===this.attributes.position||void 0===this.attributes.normal||void 0===
|
|
this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],k=[],g=0;g<f;g++)i[g]=new THREE.Vector3,k[g]=new THREE.Vector3;
|
|
this.attributes.uv)console.warn("Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()");else{var b=this.attributes.index.array,c=this.attributes.position.array,d=this.attributes.normal.array,e=this.attributes.uv.array,f=c.length/3;if(void 0===this.attributes.tangent){var g=4*f;this.attributes.tangent={itemSize:4,array:new Float32Array(g),numItems:g}}for(var h=this.attributes.tangent.array,i=[],k=[],g=0;g<f;g++)i[g]=new THREE.Vector3,k[g]=new THREE.Vector3;
|
|
-var m,n,l,s,q,p,r,v,x,w,t,J,E,C,z,f=new THREE.Vector3,g=new THREE.Vector3,G,F,I,$,B,R,A,H=this.offsets;I=0;for($=H.length;I<$;++I){F=H[I].start;B=H[I].count;var K=H[I].index;G=F;for(F+=B;G<F;G+=3)B=K+b[G],R=K+b[G+1],A=K+b[G+2],m=c[3*B],n=c[3*B+1],l=c[3*B+2],s=c[3*R],q=c[3*R+1],p=c[3*R+2],r=c[3*A],v=c[3*A+1],x=c[3*A+2],w=e[2*B],t=e[2*B+1],J=e[2*R],E=e[2*R+1],C=e[2*A],z=e[2*A+1],s-=m,m=r-m,q-=n,n=v-n,p-=l,l=x-l,J-=w,w=C-w,E-=t,t=z-t,z=1/(J*t-w*E),f.set((t*s-E*m)*z,(t*q-E*n)*z,(t*p-E*l)*z),g.set((J*
|
|
|
|
-m-w*s)*z,(J*n-w*q)*z,(J*l-w*p)*z),i[B].addSelf(f),i[R].addSelf(f),i[A].addSelf(f),k[B].addSelf(g),k[R].addSelf(g),k[A].addSelf(g)}var M=new THREE.Vector3,P=new THREE.Vector3,ga=new THREE.Vector3,ra=new THREE.Vector3,L,oa,Aa;I=0;for($=H.length;I<$;++I){F=H[I].start;B=H[I].count;K=H[I].index;G=F;for(F+=B;G<F;G+=3)B=K+b[G],R=K+b[G+1],A=K+b[G+2],a(B),a(R),a(A)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
|
|
|
|
+var m,n,l,s,q,p,r,w,x,v,t,I,E,C,z,f=new THREE.Vector3,g=new THREE.Vector3,G,F,J,V,B,T,A,H=this.offsets;J=0;for(V=H.length;J<V;++J){F=H[J].start;B=H[J].count;var L=H[J].index;G=F;for(F+=B;G<F;G+=3)B=L+b[G],T=L+b[G+1],A=L+b[G+2],m=c[3*B],n=c[3*B+1],l=c[3*B+2],s=c[3*T],q=c[3*T+1],p=c[3*T+2],r=c[3*A],w=c[3*A+1],x=c[3*A+2],v=e[2*B],t=e[2*B+1],I=e[2*T],E=e[2*T+1],C=e[2*A],z=e[2*A+1],s-=m,m=r-m,q-=n,n=w-n,p-=l,l=x-l,I-=v,v=C-v,E-=t,t=z-t,z=1/(I*t-v*E),f.set((t*s-E*m)*z,(t*q-E*n)*z,(t*p-E*l)*z),g.set((I*
|
|
|
|
+m-v*s)*z,(I*n-v*q)*z,(I*l-v*p)*z),i[B].addSelf(f),i[T].addSelf(f),i[A].addSelf(f),k[B].addSelf(g),k[T].addSelf(g),k[A].addSelf(g)}var M=new THREE.Vector3,P=new THREE.Vector3,ca=new THREE.Vector3,oa=new THREE.Vector3,K,ha,ea;J=0;for(V=H.length;J<V;++J){F=H[J].start;B=H[J].count;L=H[J].index;G=F;for(F+=B;G<F;G+=3)B=L+b[G],T=L+b[G+1],A=L+b[G+2],a(B),a(T),a(A)}this.tangentsNeedUpdate=this.hasTangents=!0}},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=Object.create(THREE.Object3D.prototype);THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);!0===this.rotationAutoUpdate&&(!1===this.useQuaternion?this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder):this.quaternion.copy(this.matrix.decompose()[1]))};THREE.OrthographicCamera=function(a,b,c,d,e,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==e?e:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=Object.create(THREE.Camera.prototype);THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix.makeOrthographic(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=Object.create(THREE.Camera.prototype);THREE.PerspectiveCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);this.fov=2*THREE.Math.radToDeg(Math.atan(b/(2*a)));this.updateProjectionMatrix()};
|
|
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,e,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=e;this.height=f;this.updateProjectionMatrix()};
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=
|
|
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(THREE.Math.degToRad(0.5*this.fov))*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=Object.create(THREE.Object3D.prototype);THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=Object.create(THREE.Light.prototype);THREE.AreaLight=function(a,b){THREE.Light.call(this,a);this.normal=new THREE.Vector3(0,-1,0);this.right=new THREE.Vector3(1,0,0);this.intensity=void 0!==b?b:1;this.height=this.width=1;this.constantAttenuation=1.5;this.linearAttenuation=0.5;this.quadraticAttenuation=0.1};THREE.AreaLight.prototype=Object.create(THREE.Light.prototype);THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=!1;this.shadowCascadeOffset=
|
|
new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.groundColor=new THREE.Color(b);this.position=new THREE.Vector3(0,100,0);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/2;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=
|
|
new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=Object.create(THREE.Light.prototype);THREE.HemisphereLight=function(a,b,c){THREE.Light.call(this,a);this.groundColor=new THREE.Color(b);this.position=new THREE.Vector3(0,100,0);this.intensity=void 0!==c?c:1};THREE.HemisphereLight.prototype=Object.create(THREE.Light.prototype);THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=Object.create(THREE.Light.prototype);THREE.SpotLight=function(a,b,c,d,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.angle=void 0!==d?d:Math.PI/2;this.exponent=void 0!==e?e:10;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=
|
|
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(){}};
|
|
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/
|
|
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.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,h,i,k,r){var v=f.toLowerCase().endsWith(".dds"),x=b+"/"+f;if(v){var w=THREE.ImageUtils.loadCompressedTexture(x);a[e]=w}else w=document.createElement("canvas"),a[e]=new THREE.Texture(w);a[e].sourceFile=f;h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
|
|
|
|
-void 0!==f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));r&&(a[e].anisotropy=r);if(!v){var t=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);t.image.width=a;t.image.height=b;t.image.getContext("2d").drawImage(this,0,0,a,b)}else t.image=this;t.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=x}}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,
|
|
|
|
|
|
+a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function e(a,e,f,h,i,k,r){var w=f.toLowerCase().endsWith(".dds"),x=b+"/"+f;if(w){var v=THREE.ImageUtils.loadCompressedTexture(x);a[e]=v}else v=document.createElement("canvas"),a[e]=new THREE.Texture(v);a[e].sourceFile=f;h&&(a[e].repeat.set(h[0],h[1]),1!==h[0]&&(a[e].wrapS=THREE.RepeatWrapping),1!==h[1]&&(a[e].wrapT=THREE.RepeatWrapping));i&&a[e].offset.set(i[0],i[1]);k&&(f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},
|
|
|
|
+void 0!==f[k[0]]&&(a[e].wrapS=f[k[0]]),void 0!==f[k[1]]&&(a[e].wrapT=f[k[1]]));r&&(a[e].anisotropy=r);if(!w){var t=a[e],a=new Image;a.onload=function(){if(!c(this.width)||!c(this.height)){var a=d(this.width),b=d(this.height);t.image.width=a;t.image.height=b;t.image.getContext("2d").drawImage(this,0,0,a,b)}else t.image=this;t.needsUpdate=!0};a.crossOrigin=g.crossOrigin;a.src=x}}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 k=a.shading.toLowerCase();"phong"===k?h="MeshPhongMaterial":"basic"===k&&(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);
|
|
map:null,lightMap:null,normalMap:null,bumpMap:null,wireframe:!1};if(a.shading){var k=a.shading.toLowerCase();"phong"===k?h="MeshPhongMaterial":"basic"===k&&(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&&
|
|
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,
|
|
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,
|
|
@@ -183,44 +183,44 @@ k.uSpecularColor.value.setHex(i.specular),k.uAmbientColor.value.setHex(i.ambient
|
|
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){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);g.send(null)};
|
|
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){var h=JSON.parse(g.responseText);a.loadAjaxBuffers(h,c,e,d,f)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+g.status+"]")};g.open("GET",b,!0);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(){if(4==f.readyState)if(200==f.status||0==f.status){var c=f.response;void 0===c&&(c=(new Uint8Array(f.responseBody)).buffer);THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else 3==f.readyState?e&&(0==h&&(h=f.getResponseHeader("Content-Length")),e({total:h,loaded:f.responseText.length})):
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,e){var f=new XMLHttpRequest,g=c+"/"+a.buffers,h=0;f.onreadystatechange=function(){if(4==f.readyState)if(200==f.status||0==f.status){var c=f.response;void 0===c&&(c=(new Uint8Array(f.responseBody)).buffer);THREE.BinaryLoader.prototype.createBinModel(c,b,d,a.materials)}else console.error("THREE.BinaryLoader: Couldn't load ["+g+"] ["+f.status+"]");else 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)};
|
|
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(){var b,c,d,e,k,m,n,l,s,q,p,r,v,x,w,t;function J(a){return a%4?4-a%4:0}function E(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,e,f,g,h,i,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=K[2*e],e=K[2*e+1],i=K[2*f],k=K[2*f+1],f=K[2*g],g=K[2*g+1],R.faceVertexUvs[0].push([new THREE.Vector2(h,e),new THREE.Vector2(i,k),new THREE.Vector2(f,
|
|
|
|
-g)])}function G(b,c){var d,e,f,g,h,i,k,m,l,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++)e=n[4*d],f=n[4*d+1],g=n[4*d+2],h=n[4*d+3],i=K[2*e],e=K[2*e+1],k=K[2*f],m=K[2*f+1],f=K[2*g],l=K[2*g+1],g=K[2*h],h=K[2*h+1],R.faceVertexUvs[0].push([new THREE.Vector2(i,e),new THREE.Vector2(k,m),new THREE.Vector2(f,l),new THREE.Vector2(g,h)])}function F(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],R.faces.push(new THREE.Face3(e,f,g,null,
|
|
|
|
-null,h))}function I(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=k[d],R.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function $(b,c,d,e){for(var f,g,h,i,k,m,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];k=d[3*e];m=d[3*e+1];l=d[3*e+2];i=n[e];var q=H[3*m],p=H[3*m+1];m=H[3*m+2];var s=H[3*l],r=H[3*l+1];l=H[3*l+2];R.faces.push(new THREE.Face3(f,
|
|
|
|
-g,h,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(q,p,m),new THREE.Vector3(s,r,l)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,k,m,l,n,q,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];m=d[4*e];l=d[4*e+1];n=d[4*e+2];q=d[4*e+3];k=p[e];var s=H[3*l],r=H[3*l+1];l=H[3*l+2];var t=H[3*n],v=H[3*n+1];n=H[3*n+2];var w=H[3*q],x=H[3*q+1];q=H[3*q+2];R.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(H[3*
|
|
|
|
-m],H[3*m+1],H[3*m+2]),new THREE.Vector3(s,r,l),new THREE.Vector3(t,v,n),new THREE.Vector3(w,x,q)],null,k))}}var R=this,A=0,H=[],K=[],M,P,ga;THREE.Geometry.call(this);t=a;P=A;x=new Uint8Array(t,P,12);q="";for(v=0;12>v;v++)q+=String.fromCharCode(x[P+v]);b=E(t,P+12);E(t,P+13);E(t,P+14);E(t,P+15);c=E(t,P+16);d=E(t,P+17);e=E(t,P+18);k=E(t,P+19);m=C(t,P+20);n=C(t,P+20+4);l=C(t,P+20+8);s=C(t,P+20+12);q=C(t,P+20+16);p=C(t,P+20+20);r=C(t,P+20+24);v=C(t,P+20+28);x=C(t,P+20+32);w=C(t,P+20+36);t=C(t,P+20+40);
|
|
|
|
-A+=b;P=3*c+k;ga=4*c+k;M=s*P;b=q*(P+3*d);c=p*(P+3*e);k=r*(P+3*d+3*e);P=v*ga;d=x*(ga+4*d);e=w*(ga+4*e);ga=A;var A=new Float32Array(a,A,3*m),ra,L,oa,Aa;for(ra=0;ra<m;ra++)L=A[3*ra],oa=A[3*ra+1],Aa=A[3*ra+2],R.vertices.push(new THREE.Vector3(L,oa,Aa));m=A=ga+3*m*Float32Array.BYTES_PER_ELEMENT;if(n){A=new Int8Array(a,A,3*n);for(ga=0;ga<n;ga++)ra=A[3*ga],L=A[3*ga+1],oa=A[3*ga+2],H.push(ra/127,L/127,oa/127)}A=m+3*n*Int8Array.BYTES_PER_ELEMENT;n=A+=J(3*n);if(l){m=new Float32Array(a,A,2*l);for(A=0;A<l;A++)ga=
|
|
|
|
-m[2*A],ra=m[2*A+1],K.push(ga,ra)}l=A=n+2*l*Float32Array.BYTES_PER_ELEMENT;M=l+M+J(2*s);n=M+b+J(2*q);b=n+c+J(2*p);c=b+k+J(2*r);P=c+P+J(2*v);k=P+d+J(2*x);d=k+e+J(2*w);p&&(e=n+3*p*Uint32Array.BYTES_PER_ELEMENT,F(p,n,e+3*p*Uint32Array.BYTES_PER_ELEMENT),z(p,e));r&&(p=b+3*r*Uint32Array.BYTES_PER_ELEMENT,e=p+3*r*Uint32Array.BYTES_PER_ELEMENT,$(r,b,p,e+3*r*Uint32Array.BYTES_PER_ELEMENT),z(r,e));w&&(r=k+4*w*Uint32Array.BYTES_PER_ELEMENT,I(w,k,r+4*w*Uint32Array.BYTES_PER_ELEMENT),G(w,r));t&&(w=d+4*t*Uint32Array.BYTES_PER_ELEMENT,
|
|
|
|
-r=w+4*t*Uint32Array.BYTES_PER_ELEMENT,B(t,d,w,r+4*t*Uint32Array.BYTES_PER_ELEMENT),G(t,r));s&&F(s,l,l+3*s*Uint32Array.BYTES_PER_ELEMENT);q&&(s=M+3*q*Uint32Array.BYTES_PER_ELEMENT,$(q,M,s,s+3*q*Uint32Array.BYTES_PER_ELEMENT));v&&I(v,c,c+4*v*Uint32Array.BYTES_PER_ELEMENT);x&&(q=P+4*x*Uint32Array.BYTES_PER_ELEMENT,B(x,P,q,q+4*x*Uint32Array.BYTES_PER_ELEMENT));this.computeCentroids();this.computeFaceNormals()};e.prototype=Object.create(THREE.Geometry.prototype);e=new e(c);c=this.initMaterials(d,c);this.needsTangents(c)&&
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(){var b,c,d,e,k,m,n,l,s,q,p,r,w,x,v,t;function I(a){return a%4?4-a%4:0}function E(a,b){return(new Uint8Array(a,b,1))[0]}function C(a,b){return(new Uint32Array(a,b,1))[0]}function z(b,c){var d,e,f,g,h,i,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=L[2*e],e=L[2*e+1],i=L[2*f],k=L[2*f+1],f=L[2*g],g=L[2*g+1],T.faceVertexUvs[0].push([new THREE.Vector2(h,e),new THREE.Vector2(i,k),new THREE.Vector2(f,
|
|
|
|
+g)])}function G(b,c){var d,e,f,g,h,i,k,m,l,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++)e=n[4*d],f=n[4*d+1],g=n[4*d+2],h=n[4*d+3],i=L[2*e],e=L[2*e+1],k=L[2*f],m=L[2*f+1],f=L[2*g],l=L[2*g+1],g=L[2*h],h=L[2*h+1],T.faceVertexUvs[0].push([new THREE.Vector2(i,e),new THREE.Vector2(k,m),new THREE.Vector2(f,l),new THREE.Vector2(g,h)])}function F(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[3*d],f=c[3*d+1],g=c[3*d+2],h=i[d],T.faces.push(new THREE.Face3(e,f,g,null,
|
|
|
|
+null,h))}function J(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[4*d],f=c[4*d+1],g=c[4*d+2],h=c[4*d+3],i=k[d],T.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function V(b,c,d,e){for(var f,g,h,i,k,m,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),n=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[3*e];g=c[3*e+1];h=c[3*e+2];k=d[3*e];m=d[3*e+1];l=d[3*e+2];i=n[e];var q=H[3*m],p=H[3*m+1];m=H[3*m+2];var s=H[3*l],r=H[3*l+1];l=H[3*l+2];T.faces.push(new THREE.Face3(f,
|
|
|
|
+g,h,[new THREE.Vector3(H[3*k],H[3*k+1],H[3*k+2]),new THREE.Vector3(q,p,m),new THREE.Vector3(s,r,l)],null,i))}}function B(b,c,d,e){for(var f,g,h,i,k,m,l,n,q,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),p=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[4*e];g=c[4*e+1];h=c[4*e+2];i=c[4*e+3];m=d[4*e];l=d[4*e+1];n=d[4*e+2];q=d[4*e+3];k=p[e];var s=H[3*l],r=H[3*l+1];l=H[3*l+2];var t=H[3*n],w=H[3*n+1];n=H[3*n+2];var v=H[3*q],x=H[3*q+1];q=H[3*q+2];T.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(H[3*
|
|
|
|
+m],H[3*m+1],H[3*m+2]),new THREE.Vector3(s,r,l),new THREE.Vector3(t,w,n),new THREE.Vector3(v,x,q)],null,k))}}var T=this,A=0,H=[],L=[],M,P,ca;THREE.Geometry.call(this);t=a;P=A;x=new Uint8Array(t,P,12);q="";for(w=0;12>w;w++)q+=String.fromCharCode(x[P+w]);b=E(t,P+12);E(t,P+13);E(t,P+14);E(t,P+15);c=E(t,P+16);d=E(t,P+17);e=E(t,P+18);k=E(t,P+19);m=C(t,P+20);n=C(t,P+20+4);l=C(t,P+20+8);s=C(t,P+20+12);q=C(t,P+20+16);p=C(t,P+20+20);r=C(t,P+20+24);w=C(t,P+20+28);x=C(t,P+20+32);v=C(t,P+20+36);t=C(t,P+20+40);
|
|
|
|
+A+=b;P=3*c+k;ca=4*c+k;M=s*P;b=q*(P+3*d);c=p*(P+3*e);k=r*(P+3*d+3*e);P=w*ca;d=x*(ca+4*d);e=v*(ca+4*e);ca=A;var A=new Float32Array(a,A,3*m),oa,K,ha,ea;for(oa=0;oa<m;oa++)K=A[3*oa],ha=A[3*oa+1],ea=A[3*oa+2],T.vertices.push(new THREE.Vector3(K,ha,ea));m=A=ca+3*m*Float32Array.BYTES_PER_ELEMENT;if(n){A=new Int8Array(a,A,3*n);for(ca=0;ca<n;ca++)oa=A[3*ca],K=A[3*ca+1],ha=A[3*ca+2],H.push(oa/127,K/127,ha/127)}A=m+3*n*Int8Array.BYTES_PER_ELEMENT;n=A+=I(3*n);if(l){m=new Float32Array(a,A,2*l);for(A=0;A<l;A++)ca=
|
|
|
|
+m[2*A],oa=m[2*A+1],L.push(ca,oa)}l=A=n+2*l*Float32Array.BYTES_PER_ELEMENT;M=l+M+I(2*s);n=M+b+I(2*q);b=n+c+I(2*p);c=b+k+I(2*r);P=c+P+I(2*w);k=P+d+I(2*x);d=k+e+I(2*v);p&&(e=n+3*p*Uint32Array.BYTES_PER_ELEMENT,F(p,n,e+3*p*Uint32Array.BYTES_PER_ELEMENT),z(p,e));r&&(p=b+3*r*Uint32Array.BYTES_PER_ELEMENT,e=p+3*r*Uint32Array.BYTES_PER_ELEMENT,V(r,b,p,e+3*r*Uint32Array.BYTES_PER_ELEMENT),z(r,e));v&&(r=k+4*v*Uint32Array.BYTES_PER_ELEMENT,J(v,k,r+4*v*Uint32Array.BYTES_PER_ELEMENT),G(v,r));t&&(v=d+4*t*Uint32Array.BYTES_PER_ELEMENT,
|
|
|
|
+r=v+4*t*Uint32Array.BYTES_PER_ELEMENT,B(t,d,v,r+4*t*Uint32Array.BYTES_PER_ELEMENT),G(t,r));s&&F(s,l,l+3*s*Uint32Array.BYTES_PER_ELEMENT);q&&(s=M+3*q*Uint32Array.BYTES_PER_ELEMENT,V(q,M,s,s+3*q*Uint32Array.BYTES_PER_ELEMENT));w&&J(w,c,c+4*w*Uint32Array.BYTES_PER_ELEMENT);x&&(q=P+4*x*Uint32Array.BYTES_PER_ELEMENT,B(x,P,q,q+4*x*Uint32Array.BYTES_PER_ELEMENT));this.computeCentroids();this.computeFaceNormals()};e.prototype=Object.create(THREE.Geometry.prototype);e=new e(c);c=this.initMaterials(d,c);this.needsTangents(c)&&
|
|
e.computeTangents();b(e,c)};THREE.ImageLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
e.computeTangents();b(e,c)};THREE.ImageLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.ImageLoader.prototype={constructor:THREE.ImageLoader,load:function(a,b){var c=this;void 0===b&&(b=new Image);b.addEventListener("load",function(){c.dispatchEvent({type:"load",content:b})},!1);b.addEventListener("error",function(){c.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);c.crossOrigin&&(b.crossOrigin=c.crossOrigin);b.src=a}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a);this.withCredentials=!1};THREE.JSONLoader.prototype=Object.create(THREE.Loader.prototype);THREE.JSONLoader.prototype.load=function(a,b,c){c=c&&"string"===typeof 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.withCredentials=this.withCredentials;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var f=new XMLHttpRequest,g=0;f.withCredentials=this.withCredentials;f.onreadystatechange=function(){if(f.readyState===f.DONE)if(200===f.status||0===f.status){if(f.responseText){var h=JSON.parse(f.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+f.status+"]");else f.readyState===
|
|
f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);f.send(null)};
|
|
f.LOADING?e&&(0===g&&(g=f.getResponseHeader("Content-Length")),e({total:g,loaded:f.responseText.length})):f.readyState===f.HEADERS_RECEIVED&&(g=f.getResponseHeader("Content-Length"))};f.open("GET",b,!0);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,f,g,h,i,k,m,n,l,s,q,p,r,v,x,w,t=a.faces;q=a.vertices;var J=a.normals,E=a.colors,C=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&C++;for(f=0;f<C;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(k=q.length;i<k;)m=new THREE.Vector3,m.x=q[i++]*e,m.y=q[i++]*e,m.z=q[i++]*e,d.vertices.push(m);i=0;for(k=t.length;i<k;){q=t[i++];m=q&1;h=q&2;f=q&4;g=q&8;l=q&16;n=q&32;p=q&64;q&=128;m?(r=new THREE.Face4,
|
|
|
|
-r.a=t[i++],r.b=t[i++],r.c=t[i++],r.d=t[i++],m=4):(r=new THREE.Face3,r.a=t[i++],r.b=t[i++],r.c=t[i++],m=3);h&&(h=t[i++],r.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<C;f++)v=a.uvs[f],s=t[i++],w=v[2*s],s=v[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(w,s);if(g)for(f=0;f<C;f++){v=a.uvs[f];x=[];for(g=0;g<m;g++)s=t[i++],w=v[2*s],s=v[2*s+1],x[g]=new THREE.Vector2(w,s);d.faceVertexUvs[f][h]=x}l&&(l=3*t[i++],g=new THREE.Vector3,g.x=J[l++],g.y=J[l++],g.z=J[l],r.normal=g);if(n)for(f=0;f<m;f++)l=3*t[i++],g=
|
|
|
|
-new THREE.Vector3,g.x=J[l++],g.y=J[l++],g.z=J[l],r.vertexNormals.push(g);p&&(n=t[i++],n=new THREE.Color(E[n]),r.color=n);if(q)for(f=0;f<m;f++)n=t[i++],n=new THREE.Color(E[n]),r.vertexColors.push(n);d.faces.push(r)}if(a.skinWeights){i=0;for(k=a.skinWeights.length;i<k;i+=2)t=a.skinWeights[i],J=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(t,J,0,0))}if(a.skinIndices){i=0;for(k=a.skinIndices.length;i<k;i+=2)t=a.skinIndices[i],J=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(t,J,0,0))}d.bones=
|
|
|
|
-a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(k=a.morphTargets.length;i<k;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];E=d.morphTargets[i].vertices;C=a.morphTargets[i].vertices;t=0;for(J=C.length;t<J;t+=3)q=new THREE.Vector3,q.x=C[t]*e,q.y=C[t+1]*e,q.z=C[t+2]*e,E.push(q)}}if(void 0!==a.morphColors){i=0;for(k=a.morphColors.length;i<k;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
|
|
|
|
-[];J=d.morphColors[i].colors;E=a.morphColors[i].colors;e=0;for(t=E.length;e<t;e+=3)C=new THREE.Color(16755200),C.setRGB(E[e],E[e+1],E[e+2]),J.push(C)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader);this.addGeometryHandler("binary",THREE.BinaryLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=void 0!==a.scale?1/a.scale:1,f,g,h,i,k,m,n,l,s,q,p,r,w,x,v,t=a.faces;q=a.vertices;var I=a.normals,E=a.colors,C=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&C++;for(f=0;f<C;f++)d.faceUvs[f]=[],d.faceVertexUvs[f]=[];i=0;for(k=q.length;i<k;)m=new THREE.Vector3,m.x=q[i++]*e,m.y=q[i++]*e,m.z=q[i++]*e,d.vertices.push(m);i=0;for(k=t.length;i<k;){q=t[i++];m=q&1;h=q&2;f=q&4;g=q&8;l=q&16;n=q&32;p=q&64;q&=128;m?(r=new THREE.Face4,
|
|
|
|
+r.a=t[i++],r.b=t[i++],r.c=t[i++],r.d=t[i++],m=4):(r=new THREE.Face3,r.a=t[i++],r.b=t[i++],r.c=t[i++],m=3);h&&(h=t[i++],r.materialIndex=h);h=d.faces.length;if(f)for(f=0;f<C;f++)w=a.uvs[f],s=t[i++],v=w[2*s],s=w[2*s+1],d.faceUvs[f][h]=new THREE.Vector2(v,s);if(g)for(f=0;f<C;f++){w=a.uvs[f];x=[];for(g=0;g<m;g++)s=t[i++],v=w[2*s],s=w[2*s+1],x[g]=new THREE.Vector2(v,s);d.faceVertexUvs[f][h]=x}l&&(l=3*t[i++],g=new THREE.Vector3,g.x=I[l++],g.y=I[l++],g.z=I[l],r.normal=g);if(n)for(f=0;f<m;f++)l=3*t[i++],g=
|
|
|
|
+new THREE.Vector3,g.x=I[l++],g.y=I[l++],g.z=I[l],r.vertexNormals.push(g);p&&(n=t[i++],n=new THREE.Color(E[n]),r.color=n);if(q)for(f=0;f<m;f++)n=t[i++],n=new THREE.Color(E[n]),r.vertexColors.push(n);d.faces.push(r)}if(a.skinWeights){i=0;for(k=a.skinWeights.length;i<k;i+=2)t=a.skinWeights[i],I=a.skinWeights[i+1],d.skinWeights.push(new THREE.Vector4(t,I,0,0))}if(a.skinIndices){i=0;for(k=a.skinIndices.length;i<k;i+=2)t=a.skinIndices[i],I=a.skinIndices[i+1],d.skinIndices.push(new THREE.Vector4(t,I,0,0))}d.bones=
|
|
|
|
+a.bones;d.animation=a.animation;if(void 0!==a.morphTargets){i=0;for(k=a.morphTargets.length;i<k;i++){d.morphTargets[i]={};d.morphTargets[i].name=a.morphTargets[i].name;d.morphTargets[i].vertices=[];E=d.morphTargets[i].vertices;C=a.morphTargets[i].vertices;t=0;for(I=C.length;t<I;t+=3)q=new THREE.Vector3,q.x=C[t]*e,q.y=C[t+1]*e,q.z=C[t+2]*e,E.push(q)}}if(void 0!==a.morphColors){i=0;for(k=a.morphColors.length;i<k;i++){d.morphColors[i]={};d.morphColors[i].name=a.morphColors[i].name;d.morphColors[i].colors=
|
|
|
|
+[];I=d.morphColors[i].colors;E=a.morphColors[i].colors;e=0;for(t=E.length;e<t;e+=3)C=new THREE.Color(16755200),C.setRGB(E[e],E[e+1],E[e+2]),I.push(C)}}d.computeCentroids();d.computeFaceNormals();a=this.initMaterials(a.materials,c);this.needsTangents(a)&&d.computeTangents();b(d,a)};THREE.LoadingMonitor=function(){THREE.EventDispatcher.call(this);var a=this,b=0,c=0,d=function(){b++;a.dispatchEvent({type:"progress",loaded:b,total:c});b===c&&a.dispatchEvent({type:"load"})};this.add=function(a){c++;a.addEventListener("load",d,!1)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader);this.addGeometryHandler("binary",THREE.BinaryLoader)};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){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
|
|
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){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
|
|
THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
|
|
THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(z.scene,F.objects)}function f(a,b){var c,e,g,i,k,n;for(n in b)if(void 0===z.objects[n]){var p=b[n],r=null;if(p.type&&p.type in m.hierarchyHandlerMap){if(void 0===p.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,properties:1,skin:1,morph:1,mirroredLoop:1,duration:1};e={};for(var t in p)t in c||(e[t]=p[t]);s=z.materials[p.material];p.loading=!0;
|
|
THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:n+"/"+a}function e(){f(z.scene,F.objects)}function f(a,b){var c,e,g,i,k,n;for(n in b)if(void 0===z.objects[n]){var p=b[n],r=null;if(p.type&&p.type in m.hierarchyHandlerMap){if(void 0===p.loading){c={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,properties:1,skin:1,morph:1,mirroredLoop:1,duration:1};e={};for(var t in p)t in c||(e[t]=p[t]);s=z.materials[p.material];p.loading=!0;
|
|
c=m.hierarchyHandlerMap[p.type].loaderObject;c.options?c.load(d(p.url,F.urlBaseType),h(n,a,s,p)):c.load(d(p.url,F.urlBaseType),h(n,a,s,p),e)}}else if(void 0!==p.geometry){if(l=z.geometries[p.geometry]){r=!1;s=z.materials[p.material];r=s instanceof THREE.ShaderMaterial;e=p.position;g=p.rotation;i=p.scale;c=p.matrix;k=p.quaternion;p.material||(s=new THREE.MeshFaceMaterial(z.face_materials[p.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(z.face_materials[p.geometry]));
|
|
c=m.hierarchyHandlerMap[p.type].loaderObject;c.options?c.load(d(p.url,F.urlBaseType),h(n,a,s,p)):c.load(d(p.url,F.urlBaseType),h(n,a,s,p),e)}}else if(void 0!==p.geometry){if(l=z.geometries[p.geometry]){r=!1;s=z.materials[p.material];r=s instanceof THREE.ShaderMaterial;e=p.position;g=p.rotation;i=p.scale;c=p.matrix;k=p.quaternion;p.material||(s=new THREE.MeshFaceMaterial(z.face_materials[p.geometry]));s instanceof THREE.MeshFaceMaterial&&0===s.materials.length&&(s=new THREE.MeshFaceMaterial(z.face_materials[p.geometry]));
|
|
if(s instanceof THREE.MeshFaceMaterial)for(var A=0;A<s.materials.length;A++)r=r||s.materials[A]instanceof THREE.ShaderMaterial;r&&l.computeTangents();p.skin?r=new THREE.SkinnedMesh(l,s):p.morph?(r=new THREE.MorphAnimMesh(l,s),void 0!==p.duration&&(r.duration=p.duration),void 0!==p.time&&(r.time=p.time),void 0!==p.mirroredLoop&&(r.mirroredLoop=p.mirroredLoop),s.morphNormals&&l.computeMorphNormals()):r=new THREE.Mesh(l,s);r.name=n;c?(r.matrixAutoUpdate=!1,r.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],
|
|
if(s instanceof THREE.MeshFaceMaterial)for(var A=0;A<s.materials.length;A++)r=r||s.materials[A]instanceof THREE.ShaderMaterial;r&&l.computeTangents();p.skin?r=new THREE.SkinnedMesh(l,s):p.morph?(r=new THREE.MorphAnimMesh(l,s),void 0!==p.duration&&(r.duration=p.duration),void 0!==p.time&&(r.time=p.time),void 0!==p.mirroredLoop&&(r.mirroredLoop=p.mirroredLoop),s.morphNormals&&l.computeMorphNormals()):r=new THREE.Mesh(l,s);r.name=n;c?(r.matrixAutoUpdate=!1,r.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],
|
|
-c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(r.position.set(e[0],e[1],e[2]),k?(r.quaternion.set(k[0],k[1],k[2],k[3]),r.useQuaternion=!0):r.rotation.set(g[0],g[1],g[2]),r.scale.set(i[0],i[1],i[2]));r.visible=p.visible;r.castShadow=p.castShadow;r.receiveShadow=p.receiveShadow;a.add(r);z.objects[n]=r}}else"DirectionalLight"===p.type||"PointLight"===p.type||"AmbientLight"===p.type?(x=void 0!==p.color?p.color:16777215,w=void 0!==p.intensity?p.intensity:1,"DirectionalLight"===p.type?(e=p.direction,
|
|
|
|
-v=new THREE.DirectionalLight(x,w),v.position.set(e[0],e[1],e[2]),p.target&&(G.push({object:v,targetName:p.target}),v.target=null)):"PointLight"===p.type?(e=p.position,c=p.distance,v=new THREE.PointLight(x,w,c),v.position.set(e[0],e[1],e[2])):"AmbientLight"===p.type&&(v=new THREE.AmbientLight(x)),a.add(v),v.name=n,z.lights[n]=v,z.objects[n]=v):"PerspectiveCamera"===p.type||"OrthographicCamera"===p.type?("PerspectiveCamera"===p.type?q=new THREE.PerspectiveCamera(p.fov,p.aspect,p.near,p.far):"OrthographicCamera"===
|
|
|
|
|
|
+c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(r.position.set(e[0],e[1],e[2]),k?(r.quaternion.set(k[0],k[1],k[2],k[3]),r.useQuaternion=!0):r.rotation.set(g[0],g[1],g[2]),r.scale.set(i[0],i[1],i[2]));r.visible=p.visible;r.castShadow=p.castShadow;r.receiveShadow=p.receiveShadow;a.add(r);z.objects[n]=r}}else"DirectionalLight"===p.type||"PointLight"===p.type||"AmbientLight"===p.type?(x=void 0!==p.color?p.color:16777215,v=void 0!==p.intensity?p.intensity:1,"DirectionalLight"===p.type?(e=p.direction,
|
|
|
|
+w=new THREE.DirectionalLight(x,v),w.position.set(e[0],e[1],e[2]),p.target&&(G.push({object:w,targetName:p.target}),w.target=null)):"PointLight"===p.type?(e=p.position,c=p.distance,w=new THREE.PointLight(x,v,c),w.position.set(e[0],e[1],e[2])):"AmbientLight"===p.type&&(w=new THREE.AmbientLight(x)),a.add(w),w.name=n,z.lights[n]=w,z.objects[n]=w):"PerspectiveCamera"===p.type||"OrthographicCamera"===p.type?("PerspectiveCamera"===p.type?q=new THREE.PerspectiveCamera(p.fov,p.aspect,p.near,p.far):"OrthographicCamera"===
|
|
p.type&&(q=new THREE.OrthographicCamera(p.left,p.right,p.top,p.bottom,p.near,p.far)),e=p.position,q.position.set(e[0],e[1],e[2]),a.add(q),q.name=n,z.cameras[n]=q,z.objects[n]=q):(e=p.position,g=p.rotation,i=p.scale,k=p.quaternion,r=new THREE.Object3D,r.name=n,r.position.set(e[0],e[1],e[2]),k?(r.quaternion.set(k[0],k[1],k[2],k[3]),r.useQuaternion=!0):r.rotation.set(g[0],g[1],g[2]),r.scale.set(i[0],i[1],i[2]),r.visible=void 0!==p.visible?p.visible:!1,a.add(r),z.objects[n]=r,z.empties[n]=r);if(r){if(void 0!==
|
|
p.type&&(q=new THREE.OrthographicCamera(p.left,p.right,p.top,p.bottom,p.near,p.far)),e=p.position,q.position.set(e[0],e[1],e[2]),a.add(q),q.name=n,z.cameras[n]=q,z.objects[n]=q):(e=p.position,g=p.rotation,i=p.scale,k=p.quaternion,r=new THREE.Object3D,r.name=n,r.position.set(e[0],e[1],e[2]),k?(r.quaternion.set(k[0],k[1],k[2],k[3]),r.useQuaternion=!0):r.rotation.set(g[0],g[1],g[2]),r.scale.set(i[0],i[1],i[2]),r.visible=void 0!==p.visible?p.visible:!1,a.add(r),z.objects[n]=r,z.empties[n]=r);if(r){if(void 0!==
|
|
p.properties)for(var B in p.properties)r.properties[B]=p.properties[B];void 0!==p.children&&f(r,p.children)}}}function g(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c;e();t-=1;m.onLoadComplete();k()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,p=d.scale;f.position.set(g[0],g[1],g[2]);i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(p[0],p[1],p[2]);
|
|
p.properties)for(var B in p.properties)r.properties[B]=p.properties[B];void 0!==p.children&&f(r,p.children)}}}function g(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c;e();t-=1;m.onLoadComplete();k()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.position,h=d.rotation,i=d.quaternion,p=d.scale;f.position.set(g[0],g[1],g[2]);i?(f.quaternion.set(i[0],i[1],i[2],i[3]),f.useQuaternion=!0):f.rotation.set(h[0],h[1],h[2]);f.scale.set(p[0],p[1],p[2]);
|
|
-c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;z.objects[a]=f;e();t-=1;m.onLoadComplete();k()}}function i(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c}}function k(){m.callbackProgress({totalModels:E,totalTextures:C,loadedModels:E-t,loadedTextures:C-J},z);m.onLoadProgress();if(0===t&&0===J){for(var a=0;a<G.length;a++){var c=G[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,
|
|
|
|
-z.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(z)}}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),l,s,q,p,r,v,x,w,t,J,E,C,z,G=[],F=a,I;for(I in this.geometryHandlerMap)a=this.geometryHandlerMap[I].loaderClass,this.geometryHandlerMap[I].loaderObject=new a;for(I in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[I].loaderClass,this.hierarchyHandlerMap[I].loaderObject=new a;J=t=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
|
|
|
|
-objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(F.transform&&(I=F.transform.position,a=F.transform.rotation,c=F.transform.scale,I&&z.scene.position.set(I[0],I[1],I[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),I||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();I=function(a){return function(){J-=a;k();m.onLoadComplete()}};for(var $ in F.fogs)a=F.fogs[$],"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]),z.fogs[$]=p;for(var B in F.geometries)p=F.geometries[B],p.type in this.geometryHandlerMap&&(t+=1,m.onLoadStart());for(var R in F.objects)p=F.objects[R],p.type&&p.type in this.hierarchyHandlerMap&&(t+=1,m.onLoadStart());E=t;for(B in F.geometries)if(p=F.geometries[B],"cube"===p.type)l=new THREE.CubeGeometry(p.width,p.height,p.depth,p.widthSegments,p.heightSegments,p.depthSegments),z.geometries[B]=l;else if("plane"===p.type)l=new THREE.PlaneGeometry(p.width,p.height,
|
|
|
|
|
|
+c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;z.objects[a]=f;e();t-=1;m.onLoadComplete();k()}}function i(a){return function(b,c){z.geometries[a]=b;z.face_materials[a]=c}}function k(){m.callbackProgress({totalModels:E,totalTextures:C,loadedModels:E-t,loadedTextures:C-I},z);m.onLoadProgress();if(0===t&&0===I){for(var a=0;a<G.length;a++){var c=G[a],d=z.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,
|
|
|
|
+z.scene.add(c.object.target));c.object.target.properties.targetInverse=c.object}b(z)}}var m=this,n=THREE.Loader.prototype.extractUrlBase(c),l,s,q,p,r,w,x,v,t,I,E,C,z,G=[],F=a,J;for(J in this.geometryHandlerMap)a=this.geometryHandlerMap[J].loaderClass,this.geometryHandlerMap[J].loaderObject=new a;for(J in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[J].loaderClass,this.hierarchyHandlerMap[J].loaderObject=new a;I=t=0;z={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},
|
|
|
|
+objects:{},cameras:{},lights:{},fogs:{},empties:{}};if(F.transform&&(J=F.transform.position,a=F.transform.rotation,c=F.transform.scale,J&&z.scene.position.set(J[0],J[1],J[2]),a&&z.scene.rotation.set(a[0],a[1],a[2]),c&&z.scene.scale.set(c[0],c[1],c[2]),J||a||c))z.scene.updateMatrix(),z.scene.updateMatrixWorld();J=function(a){return function(){I-=a;k();m.onLoadComplete()}};for(var V in F.fogs)a=F.fogs[V],"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]),z.fogs[V]=p;for(var B in F.geometries)p=F.geometries[B],p.type in this.geometryHandlerMap&&(t+=1,m.onLoadStart());for(var T in F.objects)p=F.objects[T],p.type&&p.type in this.hierarchyHandlerMap&&(t+=1,m.onLoadStart());E=t;for(B in F.geometries)if(p=F.geometries[B],"cube"===p.type)l=new THREE.CubeGeometry(p.width,p.height,p.depth,p.widthSegments,p.heightSegments,p.depthSegments),z.geometries[B]=l;else if("plane"===p.type)l=new THREE.PlaneGeometry(p.width,p.height,
|
|
p.widthSegments,p.heightSegments),z.geometries[B]=l;else if("sphere"===p.type)l=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),z.geometries[B]=l;else if("cylinder"===p.type)l=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),z.geometries[B]=l;else if("torus"===p.type)l=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),z.geometries[B]=l;else if("icosahedron"===p.type)l=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),z.geometries[B]=
|
|
p.widthSegments,p.heightSegments),z.geometries[B]=l;else if("sphere"===p.type)l=new THREE.SphereGeometry(p.radius,p.widthSegments,p.heightSegments),z.geometries[B]=l;else if("cylinder"===p.type)l=new THREE.CylinderGeometry(p.topRad,p.botRad,p.height,p.radSegs,p.heightSegs),z.geometries[B]=l;else if("torus"===p.type)l=new THREE.TorusGeometry(p.radius,p.tube,p.segmentsR,p.segmentsT),z.geometries[B]=l;else if("icosahedron"===p.type)l=new THREE.IcosahedronGeometry(p.radius,p.subdivisions),z.geometries[B]=
|
|
-l;else if(p.type in this.geometryHandlerMap){R={};for(r in p)"type"!==r&&"url"!==r&&(R[r]=p[r]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,F.urlBaseType),g(B),R)}else"embedded"===p.type&&(R=F.embeds[p.id],R.metadata=F.metadata,R&&this.geometryHandlerMap.ascii.loaderObject.createModel(R,i(B),""));for(var A in F.textures)if(B=F.textures[A],B.url instanceof Array){J+=B.url.length;for(r=0;r<B.url.length;r++)m.onLoadStart()}else J+=1,m.onLoadStart();C=J;for(A in F.textures){B=F.textures[A];
|
|
|
|
-void 0!==B.mapping&&void 0!==THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){R=B.url.length;p=[];for(r=0;r<R;r++)p[r]=d(B.url[r],F.urlBaseType);r=(r=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,I(R)):THREE.ImageUtils.loadTextureCube(p,B.mapping,I(R))}else r=B.url.toLowerCase().endsWith(".dds"),R=d(B.url,F.urlBaseType),p=I(1),r=r?THREE.ImageUtils.loadCompressedTexture(R,B.mapping,p):THREE.ImageUtils.loadTexture(R,B.mapping,p),void 0!==
|
|
|
|
-THREE[B.minFilter]&&(r.minFilter=THREE[B.minFilter]),void 0!==THREE[B.magFilter]&&(r.magFilter=THREE[B.magFilter]),B.anisotropy&&(r.anisotropy=B.anisotropy),B.repeat&&(r.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),B.offset&&r.offset.set(B.offset[0],B.offset[1]),B.wrap&&(R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==R[B.wrap[0]]&&(r.wrapS=R[B.wrap[0]]),void 0!==R[B.wrap[1]]&&(r.wrapT=
|
|
|
|
-R[B.wrap[1]]));z.textures[A]=r}var H,K;for(H in F.materials){A=F.materials[H];for(K in A.parameters)"envMap"===K||"map"===K||"lightMap"===K||"bumpMap"===K?A.parameters[K]=z.textures[A.parameters[K]]:"shading"===K?A.parameters[K]="flat"===A.parameters[K]?THREE.FlatShading:THREE.SmoothShading:"side"===K?A.parameters[K]="double"==A.parameters[K]?THREE.DoubleSide:"back"==A.parameters[K]?THREE.BackSide:THREE.FrontSide:"blending"===K?A.parameters[K]=A.parameters[K]in THREE?THREE[A.parameters[K]]:THREE.NormalBlending:
|
|
|
|
-"combine"===K?A.parameters[K]=A.parameters[K]in THREE?THREE[A.parameters[K]]:THREE.MultiplyOperation:"vertexColors"===K?"face"==A.parameters[K]?A.parameters[K]=THREE.FaceColors:A.parameters[K]&&(A.parameters[K]=THREE.VertexColors):"wrapRGB"===K&&(I=A.parameters[K],A.parameters[K]=new THREE.Vector3(I[0],I[1],I[2]));void 0!==A.parameters.opacity&&1>A.parameters.opacity&&(A.parameters.transparent=!0);A.parameters.normalMap?(I=THREE.ShaderUtils.lib.normal,B=THREE.UniformsUtils.clone(I.uniforms),r=A.parameters.color,
|
|
|
|
-R=A.parameters.specular,p=A.parameters.ambient,$=A.parameters.shininess,B.tNormal.value=z.textures[A.parameters.normalMap],A.parameters.normalScale&&B.uNormalScale.value.set(A.parameters.normalScale[0],A.parameters.normalScale[1]),A.parameters.map&&(B.tDiffuse.value=A.parameters.map,B.enableDiffuse.value=!0),A.parameters.envMap&&(B.tCube.value=A.parameters.envMap,B.enableReflection.value=!0,B.uReflectivity.value=A.parameters.reflectivity),A.parameters.lightMap&&(B.tAO.value=A.parameters.lightMap,
|
|
|
|
-B.enableAO.value=!0),A.parameters.specularMap&&(B.tSpecular.value=z.textures[A.parameters.specularMap],B.enableSpecular.value=!0),A.parameters.displacementMap&&(B.tDisplacement.value=z.textures[A.parameters.displacementMap],B.enableDisplacement.value=!0,B.uDisplacementBias.value=A.parameters.displacementBias,B.uDisplacementScale.value=A.parameters.displacementScale),B.uDiffuseColor.value.setHex(r),B.uSpecularColor.value.setHex(R),B.uAmbientColor.value.setHex(p),B.uShininess.value=$,A.parameters.opacity&&
|
|
|
|
-(B.uOpacity.value=A.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:I.fragmentShader,vertexShader:I.vertexShader,uniforms:B,lights:!0,fog:!0})):s=new THREE[A.type](A.parameters);z.materials[H]=s}for(H in F.materials)if(A=F.materials[H],A.parameters.materials){K=[];for(r=0;r<A.parameters.materials.length;r++)K.push(z.materials[A.parameters.materials[r]]);z.materials[H].materials=K}e();z.cameras&&F.defaults.camera&&(z.currentCamera=z.cameras[F.defaults.camera]);z.fogs&&F.defaults.fog&&
|
|
|
|
|
|
+l;else if(p.type in this.geometryHandlerMap){T={};for(r in p)"type"!==r&&"url"!==r&&(T[r]=p[r]);this.geometryHandlerMap[p.type].loaderObject.load(d(p.url,F.urlBaseType),g(B),T)}else"embedded"===p.type&&(T=F.embeds[p.id],T.metadata=F.metadata,T&&this.geometryHandlerMap.ascii.loaderObject.createModel(T,i(B),""));for(var A in F.textures)if(B=F.textures[A],B.url instanceof Array){I+=B.url.length;for(r=0;r<B.url.length;r++)m.onLoadStart()}else I+=1,m.onLoadStart();C=I;for(A in F.textures){B=F.textures[A];
|
|
|
|
+void 0!==B.mapping&&void 0!==THREE[B.mapping]&&(B.mapping=new THREE[B.mapping]);if(B.url instanceof Array){T=B.url.length;p=[];for(r=0;r<T;r++)p[r]=d(B.url[r],F.urlBaseType);r=(r=p[0].endsWith(".dds"))?THREE.ImageUtils.loadCompressedTextureCube(p,B.mapping,J(T)):THREE.ImageUtils.loadTextureCube(p,B.mapping,J(T))}else r=B.url.toLowerCase().endsWith(".dds"),T=d(B.url,F.urlBaseType),p=J(1),r=r?THREE.ImageUtils.loadCompressedTexture(T,B.mapping,p):THREE.ImageUtils.loadTexture(T,B.mapping,p),void 0!==
|
|
|
|
+THREE[B.minFilter]&&(r.minFilter=THREE[B.minFilter]),void 0!==THREE[B.magFilter]&&(r.magFilter=THREE[B.magFilter]),B.anisotropy&&(r.anisotropy=B.anisotropy),B.repeat&&(r.repeat.set(B.repeat[0],B.repeat[1]),1!==B.repeat[0]&&(r.wrapS=THREE.RepeatWrapping),1!==B.repeat[1]&&(r.wrapT=THREE.RepeatWrapping)),B.offset&&r.offset.set(B.offset[0],B.offset[1]),B.wrap&&(T={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==T[B.wrap[0]]&&(r.wrapS=T[B.wrap[0]]),void 0!==T[B.wrap[1]]&&(r.wrapT=
|
|
|
|
+T[B.wrap[1]]));z.textures[A]=r}var H,L;for(H in F.materials){A=F.materials[H];for(L in A.parameters)"envMap"===L||"map"===L||"lightMap"===L||"bumpMap"===L?A.parameters[L]=z.textures[A.parameters[L]]:"shading"===L?A.parameters[L]="flat"===A.parameters[L]?THREE.FlatShading:THREE.SmoothShading:"side"===L?A.parameters[L]="double"==A.parameters[L]?THREE.DoubleSide:"back"==A.parameters[L]?THREE.BackSide:THREE.FrontSide:"blending"===L?A.parameters[L]=A.parameters[L]in THREE?THREE[A.parameters[L]]:THREE.NormalBlending:
|
|
|
|
+"combine"===L?A.parameters[L]=A.parameters[L]in THREE?THREE[A.parameters[L]]:THREE.MultiplyOperation:"vertexColors"===L?"face"==A.parameters[L]?A.parameters[L]=THREE.FaceColors:A.parameters[L]&&(A.parameters[L]=THREE.VertexColors):"wrapRGB"===L&&(J=A.parameters[L],A.parameters[L]=new THREE.Vector3(J[0],J[1],J[2]));void 0!==A.parameters.opacity&&1>A.parameters.opacity&&(A.parameters.transparent=!0);A.parameters.normalMap?(J=THREE.ShaderUtils.lib.normal,B=THREE.UniformsUtils.clone(J.uniforms),r=A.parameters.color,
|
|
|
|
+T=A.parameters.specular,p=A.parameters.ambient,V=A.parameters.shininess,B.tNormal.value=z.textures[A.parameters.normalMap],A.parameters.normalScale&&B.uNormalScale.value.set(A.parameters.normalScale[0],A.parameters.normalScale[1]),A.parameters.map&&(B.tDiffuse.value=A.parameters.map,B.enableDiffuse.value=!0),A.parameters.envMap&&(B.tCube.value=A.parameters.envMap,B.enableReflection.value=!0,B.uReflectivity.value=A.parameters.reflectivity),A.parameters.lightMap&&(B.tAO.value=A.parameters.lightMap,
|
|
|
|
+B.enableAO.value=!0),A.parameters.specularMap&&(B.tSpecular.value=z.textures[A.parameters.specularMap],B.enableSpecular.value=!0),A.parameters.displacementMap&&(B.tDisplacement.value=z.textures[A.parameters.displacementMap],B.enableDisplacement.value=!0,B.uDisplacementBias.value=A.parameters.displacementBias,B.uDisplacementScale.value=A.parameters.displacementScale),B.uDiffuseColor.value.setHex(r),B.uSpecularColor.value.setHex(T),B.uAmbientColor.value.setHex(p),B.uShininess.value=V,A.parameters.opacity&&
|
|
|
|
+(B.uOpacity.value=A.parameters.opacity),s=new THREE.ShaderMaterial({fragmentShader:J.fragmentShader,vertexShader:J.vertexShader,uniforms:B,lights:!0,fog:!0})):s=new THREE[A.type](A.parameters);z.materials[H]=s}for(H in F.materials)if(A=F.materials[H],A.parameters.materials){L=[];for(r=0;r<A.parameters.materials.length;r++)L.push(z.materials[A.parameters.materials[r]]);z.materials[H].materials=L}e();z.cameras&&F.defaults.camera&&(z.currentCamera=z.cameras[F.defaults.camera]);z.fogs&&F.defaults.fog&&
|
|
(z.scene.fog=z.fogs[F.defaults.fog]);a=F.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(a[0],a[1],a[2]);z.bgColorAlpha=F.defaults.bgalpha;m.callbackSync(z);k()};THREE.TextureLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){THREE.EventDispatcher.call(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
|
|
(z.scene.fog=z.fogs[F.defaults.fog]);a=F.defaults.bgcolor;z.bgColor=new THREE.Color;z.bgColor.setRGB(a[0],a[1],a[2]);z.bgColorAlpha=F.defaults.bgalpha;m.callbackSync(z);k()};THREE.TextureLoader=function(){THREE.EventDispatcher.call(this);this.crossOrigin=null};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a){var b=this,c=new Image;c.addEventListener("load",function(){var a=new THREE.Texture(c);a.needsUpdate=!0;b.dispatchEvent({type:"load",content:a})},!1);c.addEventListener("error",function(){b.dispatchEvent({type:"error",message:"Couldn't load URL ["+a+"]"})},!1);b.crossOrigin&&(c.crossOrigin=b.crossOrigin);c.src=a}};THREE.Material=function(){THREE.EventDispatcher.call(this);this.id=THREE.MaterialIdCount++;this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.overdraw=!1;this.needsUpdate=this.visible=!0};
|
|
THREE.Material.prototype.setValues=function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
|
|
THREE.Material.prototype.setValues=function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof THREE.Color&&c instanceof THREE.Color?d.copy(c):d instanceof THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]=c}}};
|
|
THREE.Material.prototype.clone=function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;
|
|
THREE.Material.prototype.clone=function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;
|
|
@@ -263,36 +263,35 @@ THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInver
|
|
!1}};THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial;this.rotation3d=this.rotation;this.rotation=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);(1!==this.scale.x||1!==this.scale.y)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0};
|
|
!1}};THREE.LOD.prototype.clone=function(){};THREE.Sprite=function(a){THREE.Object3D.call(this);this.material=void 0!==a?a:new THREE.SpriteMaterial;this.rotation3d=this.rotation;this.rotation=0};THREE.Sprite.prototype=Object.create(THREE.Object3D.prototype);THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);(1!==this.scale.x||1!==this.scale.y)&&this.matrix.scale(this.scale);this.matrixWorldNeedsUpdate=!0};
|
|
THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
THREE.Sprite.prototype.clone=function(a){void 0===a&&(a=new THREE.Sprite(this.material));THREE.Object3D.prototype.clone.call(this,a);return a};THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=Object.create(THREE.Object3D.prototype);
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)-1===this.__lights.indexOf(a)&&this.__lights.push(a),a.target&&void 0===a.target.parent&&this.add(a.target);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.__objects.indexOf(a)){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
|
|
-THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){x!==a&&(x=p.globalAlpha=a)}function c(a){w!==a&&(a===THREE.NormalBlending?p.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?p.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(p.globalCompositeOperation="darker"),w=a)}function d(a){t!==a&&(t=p.strokeStyle=a)}function e(a){J!==a&&(J=p.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,k=new THREE.Projector,m=void 0!==a.canvas?a.canvas:
|
|
|
|
-document.createElement("canvas"),n,l,s,q,p=m.getContext("2d"),r=new THREE.Color(0),v=0,x=1,w=0,t=null,J=null,E=null,C=null,z=null,G,F,I,$,B=new THREE.RenderableVertex,R=new THREE.RenderableVertex,A,H,K,M,P,ga,ra,L,oa,Aa,Ha,O,W=new THREE.Color,ja=new THREE.Color,fa=new THREE.Color,aa=new THREE.Color,ma=new THREE.Color,Q=new THREE.Color,ka=new THREE.Color,va={},Ea={},na,wa,qa,$a,rb,La,db,pb,Nb,yb,Ra=new THREE.Box2,Ia=new THREE.Box2,Ua=new THREE.Box2,Eb=!1,Qa=new THREE.Color,eb=new THREE.Color,jb=new THREE.Color,
|
|
|
|
-la=new THREE.Vector3,fb,zb,jc,sb,Kb,sa,Va=16;fb=document.createElement("canvas");fb.width=fb.height=2;zb=fb.getContext("2d");zb.fillStyle="rgba(0,0,0,1)";zb.fillRect(0,0,2,2);jc=zb.getImageData(0,0,2,2);sb=jc.data;Kb=document.createElement("canvas");Kb.width=Kb.height=Va;sa=Kb.getContext("2d");sa.translate(-Va/2,-Va/2);sa.scale(Va,Va);Va--;this.domElement=m;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.sortElements=
|
|
|
|
-this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a*this.devicePixelRatio;l=b*this.devicePixelRatio;s=Math.floor(n/2);q=Math.floor(l/2);m.width=n;m.height=l;m.style.width=a+"px";m.style.height=b+"px";Ra.min.set(-s,-q);Ra.max.set(s,q);Ia.min.set(-s,-q);Ia.max.set(s,q);x=1;w=0;z=C=E=J=t=null};this.setClearColor=function(a,b){r.copy(a);v=void 0!==b?b:1;Ia.min.set(-s,-q);Ia.max.set(s,q)};this.setClearColorHex=function(a,b){r.setHex(a);v=void 0!==b?
|
|
|
|
-b:1;Ia.min.set(-s,-q);Ia.max.set(s,q)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){p.setTransform(1,0,0,-1,s,q);!1===Ia.empty()&&(Ia.intersect(Ra),Ia.expandByScalar(2),1>v&&p.clearRect(Ia.min.x|0,Ia.min.y|0,Ia.max.x-Ia.min.x|0,Ia.max.y-Ia.min.y|0),0<v&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*r.b)+","+v+")"),p.fillRect(Ia.min.x|0,Ia.min.y|0,Ia.max.x-Ia.min.x|0,Ia.max.y-Ia.min.y|0)),Ia.makeEmpty())};this.render=function(a,
|
|
|
|
-j){function m(a,b,c){for(var d=0,e=i.length;d<e;d++){var f=i[d],g=f.color;if(f instanceof THREE.DirectionalLight){var h=f.matrixWorld.getPosition().normalize(),j=b.dot(h);0>=j||(j*=f.intensity,c.r+=g.r*j,c.g+=g.g*j,c.b+=g.b*j)}else f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),j=b.dot(la.sub(h,a).normalize()),0>=j||(j*=0==f.distance?1:1-Math.min(a.distanceTo(h)/f.distance,1),0!=j&&(j*=f.intensity,c.r+=g.r*j,c.g+=g.g*j,c.b+=g.b*j)))}}function l(a,d,e,g,h,i,k,ea){f.info.render.vertices+=
|
|
|
|
-3;f.info.render.faces++;b(ea.opacity);c(ea.blending);A=a.positionScreen.x;H=a.positionScreen.y;K=d.positionScreen.x;M=d.positionScreen.y;P=e.positionScreen.x;ga=e.positionScreen.y;n(A,H,K,M,P,ga);(ea instanceof THREE.MeshLambertMaterial||ea instanceof THREE.MeshPhongMaterial)&&null===ea.map&&null===ea.map?(Q.copy(ea.color),ka.copy(ea.emissive),ea.vertexColors===THREE.FaceColors&&(Q.r*=k.color.r,Q.g*=k.color.g,Q.b*=k.color.b),!0===Eb?!1===ea.wireframe&&ea.shading==THREE.SmoothShading&&3==k.vertexNormalsLength?
|
|
|
|
-(ja.r=fa.r=aa.r=Qa.r,ja.g=fa.g=aa.g=Qa.g,ja.b=fa.b=aa.b=Qa.b,m(k.v1.positionWorld,k.vertexNormalsModel[0],ja),m(k.v2.positionWorld,k.vertexNormalsModel[1],fa),m(k.v3.positionWorld,k.vertexNormalsModel[2],aa),ja.r=ja.r*Q.r+ka.r,ja.g=ja.g*Q.g+ka.g,ja.b=ja.b*Q.b+ka.b,fa.r=fa.r*Q.r+ka.r,fa.g=fa.g*Q.g+ka.g,fa.b=fa.b*Q.b+ka.b,aa.r=aa.r*Q.r+ka.r,aa.g=aa.g*Q.g+ka.g,aa.b=aa.b*Q.b+ka.b,ma.r=0.5*(fa.r+aa.r),ma.g=0.5*(fa.g+aa.g),ma.b=0.5*(fa.b+aa.b),qa=J(ja,fa,aa,ma),x(A,H,K,M,P,ga,0,0,1,0,0,1,qa)):(W.r=Qa.r,
|
|
|
|
-W.g=Qa.g,W.b=Qa.b,m(k.centroidModel,k.normalModel,W),W.r=W.r*Q.r+ka.r,W.g=W.g*Q.g+ka.g,W.b=W.b*Q.b+ka.b,!0===ea.wireframe?t(W,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):v(W)):!0===ea.wireframe?t(ea.color,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):v(ea.color)):ea instanceof THREE.MeshBasicMaterial||ea instanceof THREE.MeshLambertMaterial||ea instanceof THREE.MeshPhongMaterial?null!==ea.map?ea.map.mapping instanceof THREE.UVMapping&&($a=k.uvs[0],w(A,H,K,M,P,
|
|
|
|
-ga,$a[g].x,$a[g].y,$a[h].x,$a[h].y,$a[i].x,$a[i].y,ea.map)):null!==ea.envMap?ea.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(la.copy(k.vertexNormalsModelView[g]),rb=0.5*la.x+0.5,La=0.5*la.y+0.5,la.copy(k.vertexNormalsModelView[h]),db=0.5*la.x+0.5,pb=0.5*la.y+0.5,la.copy(k.vertexNormalsModelView[i]),Nb=0.5*la.x+0.5,yb=0.5*la.y+0.5,w(A,H,K,M,P,ga,rb,La,db,pb,Nb,yb,ea.envMap)):(W.copy(ea.color),ea.vertexColors===THREE.FaceColors&&(W.r*=k.color.r,W.g*=k.color.g,W.b*=k.color.b),!0===ea.wireframe?
|
|
|
|
-t(W,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):v(W)):ea instanceof THREE.MeshDepthMaterial?(na=j.near,wa=j.far,ja.r=ja.g=ja.b=1-Va(a.positionScreen.z,na,wa),fa.r=fa.g=fa.b=1-Va(d.positionScreen.z,na,wa),aa.r=aa.g=aa.b=1-Va(e.positionScreen.z,na,wa),ma.r=0.5*(fa.r+aa.r),ma.g=0.5*(fa.g+aa.g),ma.b=0.5*(fa.b+aa.b),qa=J(ja,fa,aa,ma),x(A,H,K,M,P,ga,0,0,1,0,0,1,qa)):ea instanceof THREE.MeshNormalMaterial&&(ea.shading==THREE.FlatShading?(W.r=0.5*k.normalModelView.x+0.5,W.g=0.5*k.normalModelView.y+
|
|
|
|
-0.5,W.b=0.5*k.normalModelView.z+0.5,!0===ea.wireframe?t(W,ea.wireframeLinewidth,ea.wireframeLinecap,ea.wireframeLinejoin):v(W)):ea.shading==THREE.SmoothShading&&(la.copy(k.vertexNormalsModelView[g]),ja.r=0.5*la.x+0.5,ja.g=0.5*la.y+0.5,ja.b=0.5*la.z+0.5,la.copy(k.vertexNormalsModelView[h]),fa.r=0.5*la.x+0.5,fa.g=0.5*la.y+0.5,fa.b=0.5*la.z+0.5,la.copy(k.vertexNormalsModelView[i]),aa.r=0.5*la.x+0.5,aa.g=0.5*la.y+0.5,aa.b=0.5*la.z+0.5,ma.r=0.5*(fa.r+aa.r),ma.g=0.5*(fa.g+aa.g),ma.b=0.5*(fa.b+aa.b),qa=
|
|
|
|
-J(ja,fa,aa,ma),x(A,H,K,M,P,ga,0,0,1,0,0,1,qa)))}function n(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.closePath()}function r(a,b,c,d,e,f,g,h){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(g,h);p.closePath()}function t(a,b,c,e){E!==b&&(E=p.lineWidth=b);C!==c&&(C=p.lineCap=c);z!==e&&(z=p.lineJoin=e);d(a.getStyle());p.stroke();Ua.expandByScalar(2*b)}function v(a){e(a.getStyle());p.fill()}function w(a,b,c,d,f,g,h,j,i,k,ea,m,l){if(!(l instanceof THREE.DataTexture||
|
|
|
|
-void 0===l.image||0==l.image.width)){if(!0===l.needsUpdate){var n=l.wrapS==THREE.RepeatWrapping,q=l.wrapT==THREE.RepeatWrapping;va[l.id]=p.createPattern(l.image,!0===n&&!0===q?"repeat":!0===n&&!1===q?"repeat-x":!1===n&&!0===q?"repeat-y":"no-repeat");l.needsUpdate=!1}void 0===va[l.id]?e("rgba(0,0,0,1)"):e(va[l.id]);var n=l.offset.x/l.repeat.x,q=l.offset.y/l.repeat.y,s=l.image.width*l.repeat.x,r=l.image.height*l.repeat.y,h=(h+n)*s,j=(1-j+q)*r,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+n)*s-h,k=(1-k+q)*r-j,ea=(ea+
|
|
|
|
-n)*s-h,m=(1-m+q)*r-j,n=i*m-ea*k;0===n?(void 0===Ea[l.id]&&(b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,b=b.getContext("2d"),b.drawImage(l.image,0,0),Ea[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data),b=Ea[l.id],h=4*(Math.floor(h)+Math.floor(j)*l.image.width),W.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255),v(W)):(n=1/n,l=(m*c-k*f)*n,k=(m*d-k*g)*n,c=(i*f-ea*c)*n,d=(i*g-ea*d)*n,a=a-l*h-c*j,h=b-k*h-d*j,p.save(),p.transform(l,k,c,d,a,h),p.fill(),p.restore())}}
|
|
|
|
-function x(a,b,c,d,e,f,g,h,j,i,k,ea,m){var l,n;l=m.width-1;n=m.height-1;g*=l;h*=n;c-=a;d-=b;e-=a;f-=b;j=j*l-g;i=i*n-h;k=k*l-g;ea=ea*n-h;n=1/(j*ea-k*i);l=(ea*c-i*e)*n;i=(ea*d-i*f)*n;c=(j*e-k*c)*n;d=(j*f-k*d)*n;a=a-l*g-c*h;b=b-i*g-d*h;p.save();p.transform(l,i,c,d,a,b);p.clip();p.drawImage(m,0,0);p.restore()}function J(a,b,c,d){sb[0]=255*a.r|0;sb[1]=255*a.g|0;sb[2]=255*a.b|0;sb[4]=255*b.r|0;sb[5]=255*b.g|0;sb[6]=255*b.b|0;sb[8]=255*c.r|0;sb[9]=255*c.g|0;sb[10]=255*c.b|0;sb[12]=255*d.r|0;sb[13]=255*d.g|
|
|
|
|
-0;sb[14]=255*d.b|0;zb.putImageData(jc,0,0);sa.drawImage(fb,0,0);return Kb}function Va(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ob(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===j instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");else{!0===this.autoClear&&this.clear();p.setTransform(1,0,0,-1,s,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,j,this.sortObjects,
|
|
|
|
-this.sortElements);h=g.elements;i=g.lights;Eb=0<i.length;if(!0===Eb){Qa.setRGB(0,0,0);eb.setRGB(0,0,0);jb.setRGB(0,0,0);for(var Ab=0,kc=i.length;Ab<kc;Ab++){var X=i[Ab],Z=X.color;X instanceof THREE.AmbientLight?(Qa.r+=Z.r,Qa.g+=Z.g,Qa.b+=Z.b):X instanceof THREE.DirectionalLight?(eb.r+=Z.r,eb.g+=Z.g,eb.b+=Z.b):X instanceof THREE.PointLight&&(jb.r+=Z.r,jb.g+=Z.g,jb.b+=Z.b)}}Ab=0;for(kc=h.length;Ab<kc;Ab++){var ba=h[Ab],X=ba.material;if(!(void 0===X||!1===X.visible)){Ua.makeEmpty();if(ba instanceof THREE.RenderableParticle){G=
|
|
|
|
-ba;G.x*=s;G.y*=q;var Z=G,Xa=ba;b(X.opacity);c(X.blending);var Bb=void 0,Sa=void 0,ab=void 0,Ya=void 0,Cb=ba=void 0,ea=void 0;X instanceof THREE.ParticleBasicMaterial?null===X.map?(ab=Xa.object.scale.x,Ya=Xa.object.scale.y,ab*=Xa.scale.x*s,Ya*=Xa.scale.y*q,Ua.min.set(Z.x-ab,Z.y-Ya),Ua.max.set(Z.x+ab,Z.y+Ya),!1!==Ra.isIntersectionBox(Ua)&&(e(X.color.getStyle()),p.save(),p.translate(Z.x,Z.y),p.rotate(-Xa.rotation),p.scale(ab,Ya),p.fillRect(-1,-1,2,2),p.restore())):(ba=X.map.image,Cb=ba.width>>1,ea=ba.height>>
|
|
|
|
-1,ab=Xa.scale.x*s,Ya=Xa.scale.y*q,Bb=ab*Cb,Sa=Ya*ea,Ua.min.set(Z.x-Bb,Z.y-Sa),Ua.max.set(Z.x+Bb,Z.y+Sa),!1!==Ra.isIntersectionBox(Ua)&&(p.save(),p.translate(Z.x,Z.y),p.rotate(-Xa.rotation),p.scale(ab,-Ya),p.translate(-Cb,-ea),p.drawImage(ba,0,0),p.restore())):X instanceof THREE.ParticleCanvasMaterial&&(Bb=Xa.scale.x*s,Sa=Xa.scale.y*q,Ua.min.set(Z.x-Bb,Z.y-Sa),Ua.max.set(Z.x+Bb,Z.y+Sa),!1!==Ra.isIntersectionBox(Ua)&&(d(X.color.getStyle()),e(X.color.getStyle()),p.save(),p.translate(Z.x,Z.y),p.rotate(-Xa.rotation),
|
|
|
|
-p.scale(Bb,Sa),X.program(p),p.restore()))}else ba instanceof THREE.RenderableLine?(G=ba.v1,F=ba.v2,G.positionScreen.x*=s,G.positionScreen.y*=q,F.positionScreen.x*=s,F.positionScreen.y*=q,Ua.setFromPoints([G.positionScreen,F.positionScreen]),!0===Ra.isIntersectionBox(Ua)&&(Z=G,Xa=F,b(X.opacity),c(X.blending),p.beginPath(),p.moveTo(Z.positionScreen.x,Z.positionScreen.y),p.lineTo(Xa.positionScreen.x,Xa.positionScreen.y),X instanceof THREE.LineBasicMaterial&&(Z=X.linewidth,E!==Z&&(E=p.lineWidth=Z),Z=
|
|
|
|
-X.linecap,C!==Z&&(C=p.lineCap=Z),Z=X.linejoin,z!==Z&&(z=p.lineJoin=Z),d(X.color.getStyle()),p.stroke(),Ua.expandByScalar(2*X.linewidth)))):ba instanceof THREE.RenderableFace3?(G=ba.v1,F=ba.v2,I=ba.v3,G.positionScreen.x*=s,G.positionScreen.y*=q,F.positionScreen.x*=s,F.positionScreen.y*=q,I.positionScreen.x*=s,I.positionScreen.y*=q,!0===X.overdraw&&(ob(G.positionScreen,F.positionScreen),ob(F.positionScreen,I.positionScreen),ob(I.positionScreen,G.positionScreen)),Ua.setFromPoints([G.positionScreen,F.positionScreen,
|
|
|
|
-I.positionScreen]),!0===Ra.isIntersectionBox(Ua)&&l(G,F,I,0,1,2,ba,X,a)):ba instanceof THREE.RenderableFace4&&(G=ba.v1,F=ba.v2,I=ba.v3,$=ba.v4,G.positionScreen.x*=s,G.positionScreen.y*=q,F.positionScreen.x*=s,F.positionScreen.y*=q,I.positionScreen.x*=s,I.positionScreen.y*=q,$.positionScreen.x*=s,$.positionScreen.y*=q,B.positionScreen.copy(F.positionScreen),R.positionScreen.copy($.positionScreen),!0===X.overdraw&&(ob(G.positionScreen,F.positionScreen),ob(F.positionScreen,$.positionScreen),ob($.positionScreen,
|
|
|
|
-G.positionScreen),ob(I.positionScreen,B.positionScreen),ob(I.positionScreen,R.positionScreen)),Ua.setFromPoints([G.positionScreen,F.positionScreen,I.positionScreen,$.positionScreen]),!0===Ra.isIntersectionBox(Ua)&&(Z=G,Xa=F,Bb=I,Sa=$,ab=B,Ya=R,Cb=a,f.info.render.vertices+=4,f.info.render.faces++,b(X.opacity),c(X.blending),void 0!==X.map&&null!==X.map||void 0!==X.envMap&&null!==X.envMap?(l(Z,Xa,Sa,0,1,3,ba,X,Cb),l(ab,Bb,Ya,1,2,3,ba,X,Cb)):(A=Z.positionScreen.x,H=Z.positionScreen.y,K=Xa.positionScreen.x,
|
|
|
|
-M=Xa.positionScreen.y,P=Bb.positionScreen.x,ga=Bb.positionScreen.y,ra=Sa.positionScreen.x,L=Sa.positionScreen.y,oa=ab.positionScreen.x,Aa=ab.positionScreen.y,Ha=Ya.positionScreen.x,O=Ya.positionScreen.y,X instanceof THREE.MeshLambertMaterial||X instanceof THREE.MeshPhongMaterial?(Q.copy(X.color),ka.copy(X.emissive),X.vertexColors===THREE.FaceColors&&(Q.r*=ba.color.r,Q.g*=ba.color.g,Q.b*=ba.color.b),!0===Eb?!1===X.wireframe&&X.shading==THREE.SmoothShading&&4==ba.vertexNormalsLength?(ja.r=fa.r=aa.r=
|
|
|
|
-ma.r=Qa.r,ja.g=fa.g=aa.g=ma.g=Qa.g,ja.b=fa.b=aa.b=ma.b=Qa.b,m(ba.v1.positionWorld,ba.vertexNormalsModel[0],ja),m(ba.v2.positionWorld,ba.vertexNormalsModel[1],fa),m(ba.v4.positionWorld,ba.vertexNormalsModel[3],aa),m(ba.v3.positionWorld,ba.vertexNormalsModel[2],ma),ja.r=ja.r*Q.r+ka.r,ja.g=ja.g*Q.g+ka.g,ja.b=ja.b*Q.b+ka.b,fa.r=fa.r*Q.r+ka.r,fa.g=fa.g*Q.g+ka.g,fa.b=fa.b*Q.b+ka.b,aa.r=aa.r*Q.r+ka.r,aa.g=aa.g*Q.g+ka.g,aa.b=aa.b*Q.b+ka.b,ma.r=ma.r*Q.r+ka.r,ma.g=ma.g*Q.g+ka.g,ma.b=ma.b*Q.b+ka.b,qa=J(ja,fa,
|
|
|
|
-aa,ma),n(A,H,K,M,ra,L),x(A,H,K,M,ra,L,0,0,1,0,0,1,qa),n(oa,Aa,P,ga,Ha,O),x(oa,Aa,P,ga,Ha,O,1,0,1,1,0,1,qa)):(W.r=Qa.r,W.g=Qa.g,W.b=Qa.b,m(ba.centroidModel,ba.normalModel,W),W.r=W.r*Q.r+ka.r,W.g=W.g*Q.g+ka.g,W.b=W.b*Q.b+ka.b,r(A,H,K,M,P,ga,ra,L),!0===X.wireframe?t(W,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):v(W)):(W.r=Q.r+ka.r,W.g=Q.g+ka.g,W.b=Q.b+ka.b,r(A,H,K,M,P,ga,ra,L),!0===X.wireframe?t(W,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):v(W))):X instanceof THREE.MeshBasicMaterial?
|
|
|
|
-(W.copy(X.color),X.vertexColors===THREE.FaceColors&&(W.r*=ba.color.r,W.g*=ba.color.g,W.b*=ba.color.b),r(A,H,K,M,P,ga,ra,L),!0===X.wireframe?t(W,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):v(W)):X instanceof THREE.MeshNormalMaterial?X.shading==THREE.FlatShading?(W.r=0.5*ba.normalModelView.x+0.5,W.g=0.5*ba.normalModelView.y+0.5,W.b=0.5*ba.normalModelView.z+0.5,r(A,H,K,M,P,ga,ra,L),!0===X.wireframe?t(W,X.wireframeLinewidth,X.wireframeLinecap,X.wireframeLinejoin):v(W)):X.shading==THREE.SmoothShading&&
|
|
|
|
-(la.copy(ba.vertexNormalsModelView[0]),ja.r=0.5*la.x+0.5,ja.g=0.5*la.y+0.5,ja.b=0.5*la.z+0.5,la.copy(ba.vertexNormalsModelView[1]),fa.r=0.5*la.x+0.5,fa.g=0.5*la.y+0.5,fa.b=0.5*la.z+0.5,la.copy(ba.vertexNormalsModelView[3]),aa.r=0.5*la.x+0.5,aa.g=0.5*la.y+0.5,aa.b=0.5*la.z+0.5,la.copy(ba.vertexNormalsModelView[2]),ma.r=0.5*la.x+0.5,ma.g=0.5*la.y+0.5,ma.b=0.5*la.z+0.5,qa=J(ja,fa,aa,ma),n(A,H,K,M,ra,L),x(A,H,K,M,ra,L,0,0,1,0,0,1,qa),n(oa,Aa,P,ga,Ha,O),x(oa,Aa,P,ga,Ha,O,1,0,1,1,0,1,qa)):X instanceof THREE.MeshDepthMaterial&&
|
|
|
|
-(na=j.near,wa=j.far,ja.r=ja.g=ja.b=1-Va(Z.positionScreen.z,na,wa),fa.r=fa.g=fa.b=1-Va(Xa.positionScreen.z,na,wa),aa.r=aa.g=aa.b=1-Va(Sa.positionScreen.z,na,wa),ma.r=ma.g=ma.b=1-Va(Bb.positionScreen.z,na,wa),qa=J(ja,fa,aa,ma),n(A,H,K,M,ra,L),x(A,H,K,M,ra,L,0,0,1,0,0,1,qa),n(oa,Aa,P,ga,Ha,O),x(oa,Aa,P,ga,Ha,O,1,0,1,1,0,1,qa)))));Ia.union(Ua)}}p.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
|
|
|
|
+THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);-1!==b&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),-1!==b&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};THREE.Fog=function(a,b,c){this.name="";this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),this.near,this.far)};THREE.FogExp2=function(a,b){this.name="";this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};THREE.FogExp2.prototype.clone=function(){return new THREE.FogExp2(this.color.getHex(),this.density)};THREE.CanvasRenderer=function(a){function b(a){x!==a&&(x=p.globalAlpha=a)}function c(a){v!==a&&(a===THREE.NormalBlending?p.globalCompositeOperation="source-over":a===THREE.AdditiveBlending?p.globalCompositeOperation="lighter":a===THREE.SubtractiveBlending&&(p.globalCompositeOperation="darker"),v=a)}function d(a){t!==a&&(t=p.strokeStyle=a)}function e(a){I!==a&&(I=p.fillStyle=a)}console.log("THREE.CanvasRenderer",THREE.REVISION);var a=a||{},f=this,g,h,i,k=new THREE.Projector,m=void 0!==a.canvas?a.canvas:
|
|
|
|
+document.createElement("canvas"),n,l,s,q,p=m.getContext("2d"),r=new THREE.Color(0),w=0,x=1,v=0,t=null,I=null,E=null,C=null,z=null,G,F,J,V,B=new THREE.RenderableVertex,T=new THREE.RenderableVertex,A,H,L,M,P,ca,oa,K,ha,ea,Sa,O,ia=new THREE.Color,wa=new THREE.Color,ya=new THREE.Color,sa=new THREE.Color,ga=new THREE.Color,fa=new THREE.Color,xa=new THREE.Color,pa=new THREE.Color,za={},Oa={},ja,ta,qa,kb,Ja,Ya,qb,Db,zb,rb,ob=new THREE.Box2,ma=new THREE.Box2,Fa=new THREE.Box2,Cb=!1,Za=new THREE.Color,kc=
|
|
|
|
+new THREE.Color,Lb=new THREE.Color,pb=new THREE.Vector3,Ab,Ob,qc,lb,Ga,$a,fb=16;Ab=document.createElement("canvas");Ab.width=Ab.height=2;Ob=Ab.getContext("2d");Ob.fillStyle="rgba(0,0,0,1)";Ob.fillRect(0,0,2,2);qc=Ob.getImageData(0,0,2,2);lb=qc.data;Ga=document.createElement("canvas");Ga.width=Ga.height=fb;$a=Ga.getContext("2d");$a.translate(-fb/2,-fb/2);$a.scale(fb,fb);fb--;this.domElement=m;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:
|
|
|
|
+1;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){n=a*this.devicePixelRatio;l=b*this.devicePixelRatio;s=Math.floor(n/2);q=Math.floor(l/2);m.width=n;m.height=l;m.style.width=a+"px";m.style.height=b+"px";ob.min.set(-s,-q);ob.max.set(s,q);ma.min.set(-s,-q);ma.max.set(s,q);x=1;v=0;z=C=E=I=t=null};this.setClearColor=function(a,b){r.copy(a);w=void 0!==b?b:1;ma.min.set(-s,-q);ma.max.set(s,q)};this.setClearColorHex=function(a,b){r.setHex(a);
|
|
|
|
+w=void 0!==b?b:1;ma.min.set(-s,-q);ma.max.set(s,q)};this.getMaxAnisotropy=function(){return 0};this.clear=function(){p.setTransform(1,0,0,-1,s,q);!1===ma.empty()&&(ma.intersect(ob),ma.expandByScalar(2),1>w&&p.clearRect(ma.min.x|0,ma.min.y|0,ma.max.x-ma.min.x|0,ma.max.y-ma.min.y|0),0<w&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(255*r.r)+","+Math.floor(255*r.g)+","+Math.floor(255*r.b)+","+w+")"),p.fillRect(ma.min.x|0,ma.min.y|0,ma.max.x-ma.min.x|0,ma.max.y-ma.min.y|0)),ma.makeEmpty())};this.render=
|
|
|
|
+function(a,m){function l(a,b,c){for(var d=0,e=i.length;d<e;d++){var f=i[d];pa.copy(f.color);if(f instanceof THREE.DirectionalLight){var g=f.matrixWorld.getPosition().normalize(),h=b.dot(g);0>=h||(h*=f.intensity,c.add(pa.multiplyScalar(h)))}else f instanceof THREE.PointLight&&(g=f.matrixWorld.getPosition(),h=b.dot(pb.sub(g,a).normalize()),0>=h||(h*=0==f.distance?1:1-Math.min(a.distanceTo(g)/f.distance,1),0!=h&&(h*=f.intensity,c.add(pa.multiplyScalar(h)))))}}function n(a,d,e,g,h,j,i,k){f.info.render.vertices+=
|
|
|
|
+3;f.info.render.faces++;b(k.opacity);c(k.blending);A=a.positionScreen.x;H=a.positionScreen.y;L=d.positionScreen.x;M=d.positionScreen.y;P=e.positionScreen.x;ca=e.positionScreen.y;r(A,H,L,M,P,ca);(k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial)&&null===k.map&&null===k.map?(fa.copy(k.color),xa.copy(k.emissive),k.vertexColors===THREE.FaceColors&&fa.multiply(i.color),!0===Cb?!1===k.wireframe&&k.shading==THREE.SmoothShading&&3==i.vertexNormalsLength?(wa.copy(Za),ya.copy(Za),
|
|
|
|
+sa.copy(Za),l(i.v1.positionWorld,i.vertexNormalsModel[0],wa),l(i.v2.positionWorld,i.vertexNormalsModel[1],ya),l(i.v3.positionWorld,i.vertexNormalsModel[2],sa),wa.multiply(fa).add(xa),ya.multiply(fa).add(xa),sa.multiply(fa).add(xa),ga.addColors(ya,sa).multiplyScalar(0.5),qa=gb(wa,ya,sa,ga),I(A,H,L,M,P,ca,0,0,1,0,0,1,qa)):(ia.copy(Za),l(i.centroidModel,i.normalModel,ia),ia.multiply(fa).add(xa),!0===k.wireframe?w(ia,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):v(ia)):!0===k.wireframe?
|
|
|
|
+w(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):v(k.color)):k instanceof THREE.MeshBasicMaterial||k instanceof THREE.MeshLambertMaterial||k instanceof THREE.MeshPhongMaterial?null!==k.map?k.map.mapping instanceof THREE.UVMapping&&(kb=i.uvs[0],x(A,H,L,M,P,ca,kb[g].x,kb[g].y,kb[h].x,kb[h].y,kb[j].x,kb[j].y,k.map)):null!==k.envMap?k.envMap.mapping instanceof THREE.SphericalReflectionMapping&&(pb.copy(i.vertexNormalsModelView[g]),Ja=0.5*pb.x+0.5,Ya=0.5*pb.y+0.5,pb.copy(i.vertexNormalsModelView[h]),
|
|
|
|
+qb=0.5*pb.x+0.5,Db=0.5*pb.y+0.5,pb.copy(i.vertexNormalsModelView[j]),zb=0.5*pb.x+0.5,rb=0.5*pb.y+0.5,x(A,H,L,M,P,ca,Ja,Ya,qb,Db,zb,rb,k.envMap)):(ia.copy(k.color),k.vertexColors===THREE.FaceColors&&ia.multiply(i.color),!0===k.wireframe?w(ia,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):v(ia)):k instanceof THREE.MeshDepthMaterial?(ja=m.near,ta=m.far,h=1-ab(a.positionScreen.z,ja,ta),wa.setRGB(h,h,h),h=1-ab(d.positionScreen.z,ja,ta),ya.setRGB(h,h,h),h=1-ab(e.positionScreen.z,ja,ta),sa.setRGB(h,
|
|
|
|
+h,h),ga.addColors(ya,sa).multiplyScalar(0.5),qa=gb(wa,ya,sa,ga),I(A,H,L,M,P,ca,0,0,1,0,0,1,qa)):k instanceof THREE.MeshNormalMaterial&&(k.shading==THREE.FlatShading?(d=i.normalModelView,ia.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),!0===k.wireframe?w(ia,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):v(ia)):k.shading==THREE.SmoothShading&&(d=i.vertexNormalsModelView[g],wa.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),d=i.vertexNormalsModelView[h],ya.setRGB(d.x,d.y,
|
|
|
|
+d.z).multiplyScalar(0.5).addScalar(0.5),d=i.vertexNormalsModelView[j],sa.setRGB(d.x,d.y,d.z).multiplyScalar(0.5).addScalar(0.5),ga.addColors(ya,sa).multiplyScalar(0.5),qa=gb(wa,ya,sa,ga),I(A,H,L,M,P,ca,0,0,1,0,0,1,qa)))}function r(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.closePath()}function t(a,b,c,d,e,f,g,h){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(g,h);p.closePath()}function w(a,b,c,e){E!==b&&(E=p.lineWidth=b);C!==c&&(C=p.lineCap=c);z!==e&&
|
|
|
|
+(z=p.lineJoin=e);d(a.getStyle());p.stroke();Fa.expandByScalar(2*b)}function v(a){e(a.getStyle());p.fill()}function x(a,b,c,d,f,g,h,j,i,k,sb,m,l){if(!(l instanceof THREE.DataTexture||void 0===l.image||0==l.image.width)){if(!0===l.needsUpdate){var n=l.wrapS==THREE.RepeatWrapping,q=l.wrapT==THREE.RepeatWrapping;za[l.id]=p.createPattern(l.image,!0===n&&!0===q?"repeat":!0===n&&!1===q?"repeat-x":!1===n&&!0===q?"repeat-y":"no-repeat");l.needsUpdate=!1}void 0===za[l.id]?e("rgba(0,0,0,1)"):e(za[l.id]);var n=
|
|
|
|
+l.offset.x/l.repeat.x,q=l.offset.y/l.repeat.y,s=l.image.width*l.repeat.x,r=l.image.height*l.repeat.y,h=(h+n)*s,j=(1-j+q)*r,c=c-a,d=d-b,f=f-a,g=g-b,i=(i+n)*s-h,k=(1-k+q)*r-j,sb=(sb+n)*s-h,m=(1-m+q)*r-j,n=i*m-sb*k;0===n?(void 0===Oa[l.id]&&(b=document.createElement("canvas"),b.width=l.image.width,b.height=l.image.height,b=b.getContext("2d"),b.drawImage(l.image,0,0),Oa[l.id]=b.getImageData(0,0,l.image.width,l.image.height).data),b=Oa[l.id],h=4*(Math.floor(h)+Math.floor(j)*l.image.width),ia.setRGB(b[h]/
|
|
|
|
+255,b[h+1]/255,b[h+2]/255),v(ia)):(n=1/n,l=(m*c-k*f)*n,k=(m*d-k*g)*n,c=(i*f-sb*c)*n,d=(i*g-sb*d)*n,a=a-l*h-c*j,h=b-k*h-d*j,p.save(),p.transform(l,k,c,d,a,h),p.fill(),p.restore())}}function I(a,b,c,d,e,f,g,h,j,i,k,sb,m){var l,n;l=m.width-1;n=m.height-1;g*=l;h*=n;c-=a;d-=b;e-=a;f-=b;j=j*l-g;i=i*n-h;k=k*l-g;sb=sb*n-h;n=1/(j*sb-k*i);l=(sb*c-i*e)*n;i=(sb*d-i*f)*n;c=(j*e-k*c)*n;d=(j*f-k*d)*n;a=a-l*g-c*h;b=b-i*g-d*h;p.save();p.transform(l,i,c,d,a,b);p.clip();p.drawImage(m,0,0);p.restore()}function gb(a,
|
|
|
|
+b,c,d){lb[0]=255*a.r|0;lb[1]=255*a.g|0;lb[2]=255*a.b|0;lb[4]=255*b.r|0;lb[5]=255*b.g|0;lb[6]=255*b.b|0;lb[8]=255*c.r|0;lb[9]=255*c.g|0;lb[10]=255*c.b|0;lb[12]=255*d.r|0;lb[13]=255*d.g|0;lb[14]=255*d.b|0;Ob.putImageData(qc,0,0);$a.drawImage(Ab,0,0);return Ga}function ab(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function ub(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;0!==e&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}if(!1===m instanceof THREE.Camera)console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");
|
|
|
|
+else{!0===this.autoClear&&this.clear();p.setTransform(1,0,0,-1,s,q);f.info.render.vertices=0;f.info.render.faces=0;g=k.projectScene(a,m,this.sortObjects,this.sortElements);h=g.elements;i=g.lights;Cb=0<i.length;if(!0===Cb){Za.setRGB(0,0,0);kc.setRGB(0,0,0);Lb.setRGB(0,0,0);for(var fb=0,Nb=i.length;fb<Nb;fb++){var W=i[fb],Y=W.color;W instanceof THREE.AmbientLight?Za.add(Y):W instanceof THREE.DirectionalLight?kc.add(Y):W instanceof THREE.PointLight&&Lb.add(Y)}}fb=0;for(Nb=h.length;fb<Nb;fb++){var Z=
|
|
|
|
+h[fb],W=Z.material;if(!(void 0===W||!1===W.visible)){Fa.makeEmpty();if(Z instanceof THREE.RenderableParticle){G=Z;G.x*=s;G.y*=q;var Y=G,bb=Z;b(W.opacity);c(W.blending);var Va=void 0,Pa=void 0,hb=void 0,Ta=void 0,sb=Z=void 0,dd=void 0;W instanceof THREE.ParticleBasicMaterial?null===W.map?(hb=bb.object.scale.x,Ta=bb.object.scale.y,hb*=bb.scale.x*s,Ta*=bb.scale.y*q,Fa.min.set(Y.x-hb,Y.y-Ta),Fa.max.set(Y.x+hb,Y.y+Ta),!1!==ob.isIntersectionBox(Fa)&&(e(W.color.getStyle()),p.save(),p.translate(Y.x,Y.y),
|
|
|
|
+p.rotate(-bb.rotation),p.scale(hb,Ta),p.fillRect(-1,-1,2,2),p.restore())):(Z=W.map.image,sb=Z.width>>1,dd=Z.height>>1,hb=bb.scale.x*s,Ta=bb.scale.y*q,Va=hb*sb,Pa=Ta*dd,Fa.min.set(Y.x-Va,Y.y-Pa),Fa.max.set(Y.x+Va,Y.y+Pa),!1!==ob.isIntersectionBox(Fa)&&(p.save(),p.translate(Y.x,Y.y),p.rotate(-bb.rotation),p.scale(hb,-Ta),p.translate(-sb,-dd),p.drawImage(Z,0,0),p.restore())):W instanceof THREE.ParticleCanvasMaterial&&(Va=bb.scale.x*s,Pa=bb.scale.y*q,Fa.min.set(Y.x-Va,Y.y-Pa),Fa.max.set(Y.x+Va,Y.y+Pa),
|
|
|
|
+!1!==ob.isIntersectionBox(Fa)&&(d(W.color.getStyle()),e(W.color.getStyle()),p.save(),p.translate(Y.x,Y.y),p.rotate(-bb.rotation),p.scale(Va,Pa),W.program(p),p.restore()))}else Z instanceof THREE.RenderableLine?(G=Z.v1,F=Z.v2,G.positionScreen.x*=s,G.positionScreen.y*=q,F.positionScreen.x*=s,F.positionScreen.y*=q,Fa.setFromPoints([G.positionScreen,F.positionScreen]),!0===ob.isIntersectionBox(Fa)&&(Y=G,bb=F,b(W.opacity),c(W.blending),p.beginPath(),p.moveTo(Y.positionScreen.x,Y.positionScreen.y),p.lineTo(bb.positionScreen.x,
|
|
|
|
+bb.positionScreen.y),W instanceof THREE.LineBasicMaterial&&(Y=W.linewidth,E!==Y&&(E=p.lineWidth=Y),Y=W.linecap,C!==Y&&(C=p.lineCap=Y),Y=W.linejoin,z!==Y&&(z=p.lineJoin=Y),d(W.color.getStyle()),p.stroke(),Fa.expandByScalar(2*W.linewidth)))):Z instanceof THREE.RenderableFace3?(G=Z.v1,F=Z.v2,J=Z.v3,G.positionScreen.x*=s,G.positionScreen.y*=q,F.positionScreen.x*=s,F.positionScreen.y*=q,J.positionScreen.x*=s,J.positionScreen.y*=q,!0===W.overdraw&&(ub(G.positionScreen,F.positionScreen),ub(F.positionScreen,
|
|
|
|
+J.positionScreen),ub(J.positionScreen,G.positionScreen)),Fa.setFromPoints([G.positionScreen,F.positionScreen,J.positionScreen]),!0===ob.isIntersectionBox(Fa)&&n(G,F,J,0,1,2,Z,W,a)):Z instanceof THREE.RenderableFace4&&(G=Z.v1,F=Z.v2,J=Z.v3,V=Z.v4,G.positionScreen.x*=s,G.positionScreen.y*=q,F.positionScreen.x*=s,F.positionScreen.y*=q,J.positionScreen.x*=s,J.positionScreen.y*=q,V.positionScreen.x*=s,V.positionScreen.y*=q,B.positionScreen.copy(F.positionScreen),T.positionScreen.copy(V.positionScreen),
|
|
|
|
+!0===W.overdraw&&(ub(G.positionScreen,F.positionScreen),ub(F.positionScreen,V.positionScreen),ub(V.positionScreen,G.positionScreen),ub(J.positionScreen,B.positionScreen),ub(J.positionScreen,T.positionScreen)),Fa.setFromPoints([G.positionScreen,F.positionScreen,J.positionScreen,V.positionScreen]),!0===ob.isIntersectionBox(Fa)&&(Y=G,bb=F,Va=J,Pa=V,hb=B,Ta=T,sb=a,f.info.render.vertices+=4,f.info.render.faces++,b(W.opacity),c(W.blending),void 0!==W.map&&null!==W.map||void 0!==W.envMap&&null!==W.envMap?
|
|
|
|
+(n(Y,bb,Pa,0,1,3,Z,W,sb),n(hb,Va,Ta,1,2,3,Z,W,sb)):(A=Y.positionScreen.x,H=Y.positionScreen.y,L=bb.positionScreen.x,M=bb.positionScreen.y,P=Va.positionScreen.x,ca=Va.positionScreen.y,oa=Pa.positionScreen.x,K=Pa.positionScreen.y,ha=hb.positionScreen.x,ea=hb.positionScreen.y,Sa=Ta.positionScreen.x,O=Ta.positionScreen.y,W instanceof THREE.MeshLambertMaterial||W instanceof THREE.MeshPhongMaterial?(fa.copy(W.color),xa.copy(W.emissive),W.vertexColors===THREE.FaceColors&&fa.multiply(Z.color),!0===Cb?!1===
|
|
|
|
+W.wireframe&&W.shading==THREE.SmoothShading&&4==Z.vertexNormalsLength?(wa.copy(Za),ya.copy(Za),sa.copy(Za),ga.copy(Za),l(Z.v1.positionWorld,Z.vertexNormalsModel[0],wa),l(Z.v2.positionWorld,Z.vertexNormalsModel[1],ya),l(Z.v4.positionWorld,Z.vertexNormalsModel[3],sa),l(Z.v3.positionWorld,Z.vertexNormalsModel[2],ga),wa.multiply(fa).add(xa),ya.multiply(fa).add(xa),sa.multiply(fa).add(xa),ga.multiply(fa).add(xa),qa=gb(wa,ya,sa,ga),r(A,H,L,M,oa,K),I(A,H,L,M,oa,K,0,0,1,0,0,1,qa),r(ha,ea,P,ca,Sa,O),I(ha,
|
|
|
|
+ea,P,ca,Sa,O,1,0,1,1,0,1,qa)):(ia.copy(Za),l(Z.centroidModel,Z.normalModel,ia),ia.multiply(fa).add(xa),t(A,H,L,M,P,ca,oa,K),!0===W.wireframe?w(ia,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):v(ia)):(ia.addColors(fa,xa),t(A,H,L,M,P,ca,oa,K),!0===W.wireframe?w(ia,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):v(ia))):W instanceof THREE.MeshBasicMaterial?(ia.copy(W.color),W.vertexColors===THREE.FaceColors&&ia.multiply(Z.color),t(A,H,L,M,P,ca,oa,K),!0===W.wireframe?w(ia,
|
|
|
|
+W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):v(ia)):W instanceof THREE.MeshNormalMaterial?(Y=void 0,W.shading==THREE.FlatShading?(Y=Z.normalModelView,ia.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),t(A,H,L,M,P,ca,oa,K),!0===W.wireframe?w(ia,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):v(ia)):W.shading==THREE.SmoothShading&&(Y=Z.vertexNormalsModelView[0],wa.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),Y=Z.vertexNormalsModelView[1],ya.setRGB(Y.x,Y.y,
|
|
|
|
+Y.z).multiplyScalar(0.5).addScalar(0.5),Y=Z.vertexNormalsModelView[3],sa.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),Y=Z.vertexNormalsModelView[2],ga.setRGB(Y.x,Y.y,Y.z).multiplyScalar(0.5).addScalar(0.5),qa=gb(wa,ya,sa,ga),r(A,H,L,M,oa,K),I(A,H,L,M,oa,K,0,0,1,0,0,1,qa),r(ha,ea,P,ca,Sa,O),I(ha,ea,P,ca,Sa,O,1,0,1,1,0,1,qa))):W instanceof THREE.MeshDepthMaterial&&(ja=m.near,ta=m.far,wa.r=wa.g=wa.b=1-ab(Y.positionScreen.z,ja,ta),ya.r=ya.g=ya.b=1-ab(bb.positionScreen.z,ja,ta),sa.r=sa.g=sa.b=
|
|
|
|
+1-ab(Pa.positionScreen.z,ja,ta),ga.r=ga.g=ga.b=1-ab(Va.positionScreen.z,ja,ta),qa=gb(wa,ya,sa,ga),r(A,H,L,M,oa,K),I(A,H,L,M,oa,K,0,0,1,0,0,1,qa),r(ha,ea,P,ca,Sa,O),I(ha,ea,P,ca,Sa,O,1,0,1,1,0,1,qa)))));ma.union(Fa)}}p.setTransform(1,0,0,1,0,0)}}};THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
envmap_pars_fragment:"#ifdef USE_ENVMAP\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nuniform bool useRefract;\nuniform float refractionRatio;\n#else\nvarying vec3 vReflect;\n#endif\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec3 reflectVec;\n#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP )\nvec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );\nif ( useRefract ) {\nreflectVec = refract( cameraToVertex, normal, refractionRatio );\n} else { \nreflectVec = reflect( cameraToVertex, normal );\n}\n#else\nreflectVec = vReflect;\n#endif\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularStrength * reflectivity );\n} else if ( combine == 2 ) {\ngl_FragColor.xyz += cubeColor.xyz * specularStrength * reflectivity;\n} else {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * cubeColor.xyz, specularStrength * reflectivity );\n}\n#endif",
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
envmap_pars_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( PHONG ) || defined( LAMBERT ) || defined ( USE_SHADOWMAP )\n#ifdef USE_SKINNING\nvec4 worldPosition = modelMatrix * skinned;\n#endif\n#if defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( morphed, 1.0 );\n#endif\n#if ! defined( USE_MORPHTARGETS ) && ! defined( USE_SKINNING )\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n#endif\n#endif",
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
envmap_vertex:"#if defined( USE_ENVMAP ) && ! defined( USE_BUMPMAP ) && ! defined( USE_NORMALMAP )\nvec3 worldNormal = mat3( modelMatrix[ 0 ].xyz, modelMatrix[ 1 ].xyz, modelMatrix[ 2 ].xyz ) * objectNormal;\nworldNormal = normalize( worldNormal );\nvec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\nif ( useRefract ) {\nvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n} else {\nvReflect = reflect( cameraToVertex, worldNormal );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
|
|
@@ -343,157 +342,157 @@ m;c++)a.__morphTargetsArrays.push(new Float32Array(3*i))}if(a.numMorphNormals){a
|
|
"v3"===c.type?h=3:"v4"===c.type?h=4:"c"===c.type&&(h=3),c.size=h,c.array=new Float32Array(i*h),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===
|
|
"v3"===c.type?h=3:"v4"===c.type?h=4:"c"===c.type&&(h=3),c.size=h,c.array=new Float32Array(i*h),c.buffer=j.createBuffer(),c.buffer.belongsToAttribute=p,k.needsUpdate=!0,c.__original=k;a.__webglCustomAttributesList.push(c)}}a.__inittedArrays=!0}function e(a,b){return a.material instanceof THREE.MeshFaceMaterial?a.material.materials[b.materialIndex]:a.material}function f(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===
|
|
THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){var b,c,d;for(b in a.attributes)d="index"===b?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,c=a.attributes[b],c.buffer=j.createBuffer(),j.bindBuffer(d,c.buffer),j.bufferData(d,c.array,j.STATIC_DRAW)}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;a.elementsNeedUpdate&&
|
|
THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){return a.map||a.lightMap||a.bumpMap||a.normalMap||a.specularMap||a instanceof THREE.ShaderMaterial?!0:!1}function h(a){var b,c,d;for(b in a.attributes)d="index"===b?j.ELEMENT_ARRAY_BUFFER:j.ARRAY_BUFFER,c=a.attributes[b],c.buffer=j.createBuffer(),j.bindBuffer(d,c.buffer),j.bufferData(d,c.array,j.STATIC_DRAW)}function i(a,b,c){var d=a.attributes,e=d.index,f=d.position,g=d.normal,h=d.uv,i=d.color,d=d.tangent;a.elementsNeedUpdate&&
|
|
void 0!==e&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(j.bindBuffer(j.ARRAY_BUFFER,g.buffer),j.bufferData(j.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==h&&(j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.colorsNeedUpdate&&void 0!==i&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
void 0!==e&&(j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.buffer),j.bufferData(j.ELEMENT_ARRAY_BUFFER,e.array,b));a.verticesNeedUpdate&&void 0!==f&&(j.bindBuffer(j.ARRAY_BUFFER,f.buffer),j.bufferData(j.ARRAY_BUFFER,f.array,b));a.normalsNeedUpdate&&void 0!==g&&(j.bindBuffer(j.ARRAY_BUFFER,g.buffer),j.bufferData(j.ARRAY_BUFFER,g.array,b));a.uvsNeedUpdate&&void 0!==h&&(j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b));a.colorsNeedUpdate&&void 0!==i&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
-i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){fb[a]||(j.enableVertexAttribArray(a),fb[a]=!0)}function m(){for(var a in fb)fb[a]&&(j.disableVertexAttribArray(a),fb[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function l(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)ka=
|
|
|
|
-fa=null,ma=Q=wa=na=pb=db=qa=-1,Va=!0,a[d].render(b,c,jb,la),ka=fa=null,ma=Q=wa=na=pb=db=qa=-1,Va=!0}function q(a,b,c,d,e,f,g,h){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&O.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);O.setDepthTest(j.depthTest);O.setDepthWrite(j.depthWrite);F(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}O.setMaterialFaces(j);k instanceof
|
|
|
|
|
|
+i.buffer),j.bufferData(j.ARRAY_BUFFER,i.array,b));a.tangentsNeedUpdate&&void 0!==d&&(j.bindBuffer(j.ARRAY_BUFFER,d.buffer),j.bufferData(j.ARRAY_BUFFER,d.array,b));if(c)for(var k in a.attributes)delete a.attributes[k].array}function k(a){pb[a]||(j.enableVertexAttribArray(a),pb[a]=!0)}function m(){for(var a in pb)pb[a]&&(j.disableVertexAttribArray(a),pb[a]=!1)}function n(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}function l(a,b){return b[0]-a[0]}function s(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)xa=
|
|
|
|
+ya=null,ga=fa=ja=Oa=qb=Ya=ta=-1,$a=!0,a[d].render(b,c,kc,Lb),xa=ya=null,ga=fa=ja=Oa=qb=Ya=ta=-1,$a=!0}function q(a,b,c,d,e,f,g,h){var j,i,k,m;b?(i=a.length-1,m=b=-1):(i=0,b=a.length,m=1);for(var l=i;l!==b;l+=m)if(j=a[l],j.render){i=j.object;k=j.buffer;if(h)j=h;else{j=j[c];if(!j)continue;g&&O.setBlending(j.blending,j.blendEquation,j.blendSrc,j.blendDst);O.setDepthTest(j.depthTest);O.setDepthWrite(j.depthWrite);F(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits)}O.setMaterialFaces(j);k instanceof
|
|
THREE.BufferGeometry?O.renderBufferDirect(d,e,f,j,k,i):O.renderBuffer(d,e,f,j,k,i)}}function p(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&O.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);O.setDepthTest(h.depthTest);O.setDepthWrite(h.depthWrite);F(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}O.renderImmediateObject(c,d,e,h,j)}}function r(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
THREE.BufferGeometry?O.renderBufferDirect(d,e,f,j,k,i):O.renderBuffer(d,e,f,j,k,i)}}function p(a,b,c,d,e,f,g){for(var h,j,i=0,k=a.length;i<k;i++)if(h=a[i],j=h.object,j.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&O.setBlending(h.blending,h.blendEquation,h.blendSrc,h.blendDst);O.setDepthTest(h.depthTest);O.setDepthWrite(h.depthWrite);F(h.polygonOffset,h.polygonOffsetFactor,h.polygonOffsetUnits)}O.renderImmediateObject(c,d,e,h,j)}}function r(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
|
|
-function v(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function x(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function w(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function t(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function J(a,b,c,d,e){Ea=0;d.needsUpdate&&(d.program&&Cb(d),O.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets));
|
|
|
|
-var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==fa&&(j.useProgram(g),fa=g,f=!0);d.id!==ma&&(ma=d.id,f=!0);if(f||a!==ka)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==ka&&(ka=a);if(d.skinning)if(ob&&e.useVertexTexture){if(null!==h.boneTexture){var k=E();j.uniform1i(h.boneTexture,k);O.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?
|
|
|
|
-(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if(Va){for(var m,l=k=0,n=0,p,q,s,r=Jc,t=r.directional.colors,v=r.directional.positions,w=r.point.colors,x=r.point.positions,A=r.point.distances,C=r.spot.colors,F=r.spot.positions,I=r.spot.distances,J=r.spot.directions,W=r.spot.anglesCos,L=r.spot.exponents,Q=r.hemi.skyColors,M=r.hemi.groundColors,aa=r.hemi.positions,
|
|
|
|
-R=0,P=0,ja=0,X=0,$=0,ga=0,ba=0,va=0,V=m=0,c=s=V=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,s=m.distance,m instanceof THREE.AmbientLight?m.visible&&(O.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?($+=1,m.visible&&(sa.copy(m.matrixWorld.getPosition()),sa.subSelf(m.target.matrixWorld.getPosition()),sa.normalize(),0===sa.x&&0===sa.y&&0===sa.z||(m=3*R,v[m]=sa.x,v[m+1]=sa.y,v[m+2]=sa.z,O.gammaInput?z(t,m,p,q*q):G(t,m,p,
|
|
|
|
-q),R+=1))):m instanceof THREE.PointLight?(ga+=1,m.visible&&(V=3*P,O.gammaInput?z(w,V,p,q*q):G(w,V,p,q),q=m.matrixWorld.getPosition(),x[V]=q.x,x[V+1]=q.y,x[V+2]=q.z,A[P]=s,P+=1)):m instanceof THREE.SpotLight?(ba+=1,m.visible&&(V=3*ja,O.gammaInput?z(C,V,p,q*q):G(C,V,p,q),q=m.matrixWorld.getPosition(),F[V]=q.x,F[V+1]=q.y,F[V+2]=q.z,I[ja]=s,sa.copy(q),sa.subSelf(m.target.matrixWorld.getPosition()),sa.normalize(),J[V]=sa.x,J[V+1]=sa.y,J[V+2]=sa.z,W[ja]=Math.cos(m.angle),L[ja]=m.exponent,ja+=1)):m instanceof
|
|
|
|
-THREE.HemisphereLight&&(va+=1,m.visible&&(sa.copy(m.matrixWorld.getPosition()),sa.normalize(),0===sa.x&&0===sa.y&&0===sa.z||(s=3*X,aa[s]=sa.x,aa[s+1]=sa.y,aa[s+2]=sa.z,p=m.color,m=m.groundColor,O.gammaInput?(q*=q,z(Q,s,p,q),z(M,s,m,q)):(G(Q,s,p,q),G(M,s,m,q)),X+=1))));c=3*R;for(f=Math.max(t.length,3*$);c<f;c++)t[c]=0;c=3*P;for(f=Math.max(w.length,3*ga);c<f;c++)w[c]=0;c=3*ja;for(f=Math.max(C.length,3*ba);c<f;c++)C[c]=0;c=3*X;for(f=Math.max(Q.length,3*va);c<f;c++)Q[c]=0;c=3*X;for(f=Math.max(M.length,
|
|
|
|
-3*va);c<f;c++)M[c]=0;r.directional.length=R;r.point.length=P;r.spot.length=ja;r.hemi.length=X;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;Va=!1}c=Jc;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;
|
|
|
|
|
|
+function w(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function x(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function v(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function t(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function I(a,b,c,d,e){za=0;d.needsUpdate&&(d.program&&Ta(d),O.initMaterial(d,b,c,e),d.needsUpdate=!1);d.morphTargets&&!e.__webglMorphTargetInfluences&&(e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets));
|
|
|
|
+var f=!1,g=d.program,h=g.uniforms,i=d.uniforms;g!==ya&&(j.useProgram(g),ya=g,f=!0);d.id!==ga&&(ga=d.id,f=!0);if(f||a!==xa)j.uniformMatrix4fv(h.projectionMatrix,!1,a.projectionMatrix.elements),a!==xa&&(xa=a);if(d.skinning)if(ab&&e.useVertexTexture){if(null!==h.boneTexture){var k=E();j.uniform1i(h.boneTexture,k);O.setTexture(e.boneTexture,k)}}else null!==h.boneGlobalMatrices&&j.uniformMatrix4fv(h.boneGlobalMatrices,!1,e.boneMatrices);if(f){c&&d.fog&&(i.fogColor.value=c.color,c instanceof THREE.Fog?
|
|
|
|
+(i.fogNear.value=c.near,i.fogFar.value=c.far):c instanceof THREE.FogExp2&&(i.fogDensity.value=c.density));if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){if($a){for(var m,l=k=0,n=0,p,q,s,r=fb,t=r.directional.colors,w=r.directional.positions,v=r.point.colors,x=r.point.positions,A=r.point.distances,C=r.spot.colors,F=r.spot.positions,J=r.spot.distances,I=r.spot.directions,K=r.spot.anglesCos,ia=r.spot.exponents,M=r.hemi.skyColors,T=r.hemi.groundColors,P=r.hemi.positions,
|
|
|
|
+W=0,V=0,Y=0,fa=0,ca=0,wa=0,pa=0,sa=0,U=m=0,c=s=U=0,f=b.length;c<f;c++)m=b[c],m.onlyShadow||(p=m.color,q=m.intensity,s=m.distance,m instanceof THREE.AmbientLight?m.visible&&(O.gammaInput?(k+=p.r*p.r,l+=p.g*p.g,n+=p.b*p.b):(k+=p.r,l+=p.g,n+=p.b)):m instanceof THREE.DirectionalLight?(ca+=1,m.visible&&(Ga.copy(m.matrixWorld.getPosition()),Ga.subSelf(m.target.matrixWorld.getPosition()),Ga.normalize(),0===Ga.x&&0===Ga.y&&0===Ga.z||(m=3*W,w[m]=Ga.x,w[m+1]=Ga.y,w[m+2]=Ga.z,O.gammaInput?z(t,m,p,q*q):G(t,m,
|
|
|
|
+p,q),W+=1))):m instanceof THREE.PointLight?(wa+=1,m.visible&&(U=3*V,O.gammaInput?z(v,U,p,q*q):G(v,U,p,q),q=m.matrixWorld.getPosition(),x[U]=q.x,x[U+1]=q.y,x[U+2]=q.z,A[V]=s,V+=1)):m instanceof THREE.SpotLight?(pa+=1,m.visible&&(U=3*Y,O.gammaInput?z(C,U,p,q*q):G(C,U,p,q),q=m.matrixWorld.getPosition(),F[U]=q.x,F[U+1]=q.y,F[U+2]=q.z,J[Y]=s,Ga.copy(q),Ga.subSelf(m.target.matrixWorld.getPosition()),Ga.normalize(),I[U]=Ga.x,I[U+1]=Ga.y,I[U+2]=Ga.z,K[Y]=Math.cos(m.angle),ia[Y]=m.exponent,Y+=1)):m instanceof
|
|
|
|
+THREE.HemisphereLight&&(sa+=1,m.visible&&(Ga.copy(m.matrixWorld.getPosition()),Ga.normalize(),0===Ga.x&&0===Ga.y&&0===Ga.z||(s=3*fa,P[s]=Ga.x,P[s+1]=Ga.y,P[s+2]=Ga.z,p=m.color,m=m.groundColor,O.gammaInput?(q*=q,z(M,s,p,q),z(T,s,m,q)):(G(M,s,p,q),G(T,s,m,q)),fa+=1))));c=3*W;for(f=Math.max(t.length,3*ca);c<f;c++)t[c]=0;c=3*V;for(f=Math.max(v.length,3*wa);c<f;c++)v[c]=0;c=3*Y;for(f=Math.max(C.length,3*pa);c<f;c++)C[c]=0;c=3*fa;for(f=Math.max(M.length,3*sa);c<f;c++)M[c]=0;c=3*fa;for(f=Math.max(T.length,
|
|
|
|
+3*sa);c<f;c++)T[c]=0;r.directional.length=W;r.point.length=V;r.spot.length=Y;r.hemi.length=fa;r.ambient[0]=k;r.ambient[1]=l;r.ambient[2]=n;$a=!1}c=fb;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances;i.spotLightColor.value=c.spot.colors;i.spotLightPosition.value=c.spot.positions;
|
|
i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;O.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):
|
|
i.spotLightDistance.value=c.spot.distances;i.spotLightDirection.value=c.spot.directions;i.spotLightAngleCos.value=c.spot.anglesCos;i.spotLightExponent.value=c.spot.exponents;i.hemisphereLightSkyColor.value=c.hemi.skyColors;i.hemisphereLightGroundColor.value=c.hemi.groundColors;i.hemisphereLightDirection.value=c.hemi.positions}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial){i.opacity.value=d.opacity;O.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):
|
|
i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Z;d.map?Z=d.map:d.specularMap?Z=d.specularMap:d.normalMap?Z=d.normalMap:d.bumpMap&&(Z=d.bumpMap);void 0!==Z&&(c=Z.offset,Z=Z.repeat,i.offsetRepeat.value.set(c.x,c.y,Z.x,Z.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
i.diffuse.value=d.color;i.map.value=d.map;i.lightMap.value=d.lightMap;i.specularMap.value=d.specularMap;d.bumpMap&&(i.bumpMap.value=d.bumpMap,i.bumpScale.value=d.bumpScale);d.normalMap&&(i.normalMap.value=d.normalMap,i.normalScale.value.copy(d.normalScale));var Z;d.map?Z=d.map:d.specularMap?Z=d.specularMap:d.normalMap?Z=d.normalMap:d.bumpMap&&(Z=d.bumpMap);void 0!==Z&&(c=Z.offset,Z=Z.repeat,i.offsetRepeat.value.set(c.x,c.y,Z.x,Z.y));i.envMap.value=d.envMap;i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
|
|
1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?
|
|
1:-1;i.reflectivity.value=d.reflectivity;i.refractionRatio.value=d.refractionRatio;i.combine.value=d.combine;i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping}d instanceof THREE.LineBasicMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity):d instanceof THREE.LineDashedMaterial?(i.diffuse.value=d.color,i.opacity.value=d.opacity,i.dashSize.value=d.dashSize,i.totalSize.value=d.dashSize+d.gapSize,i.scale.value=d.scale):d instanceof THREE.ParticleBasicMaterial?
|
|
-(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=K.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,O.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
|
|
|
|
|
|
+(i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=L.height/2,i.map.value=d.map):d instanceof THREE.MeshPhongMaterial?(i.shininess.value=d.shininess,O.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshLambertMaterial?
|
|
(O.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Z=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof
|
|
(O.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.emissive.value.copyGammaToLinear(d.emissive)):(i.ambient.value=d.ambient,i.emissive.value=d.emissive),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB)):d instanceof THREE.MeshDepthMaterial?(i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity):d instanceof THREE.MeshNormalMaterial&&(i.opacity.value=d.opacity);if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){c=Z=0;for(f=b.length;c<f;c++)if(k=b[c],k.castShadow&&(k instanceof
|
|
THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Z]=k.shadowMap,i.shadowMapSize.value[Z]=k.shadowMapSize,i.shadowMatrix.value[Z]=k.shadowMatrix,i.shadowDarkness.value[Z]=k.shadowDarkness,i.shadowBias.value[Z]=k.shadowBias,Z++}b=d.uniformsList;i=0;for(Z=b.length;i<Z;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,
|
|
THREE.SpotLight||k instanceof THREE.DirectionalLight&&!k.shadowCascade))i.shadowMap.value[Z]=k.shadowMap,i.shadowMapSize.value[Z]=k.shadowMapSize,i.shadowMatrix.value[Z]=k.shadowMatrix,i.shadowDarkness.value[Z]=k.shadowDarkness,i.shadowBias.value[Z]=k.shadowBias,Z++}b=d.uniformsList;i=0;for(Z=b.length;i<Z;i++)if(f=g.uniforms[b[i][1]])if(c=b[i][0],l=c.type,k=c.value,"i"===l)j.uniform1i(f,k);else if("f"===l)j.uniform1f(f,k);else if("v2"===l)j.uniform2f(f,k.x,k.y);else if("v3"===l)j.uniform3f(f,k.x,
|
|
k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=
|
|
k.y,k.z);else if("v4"===l)j.uniform4f(f,k.x,k.y,k.z,k.w);else if("c"===l)j.uniform3f(f,k.r,k.g,k.b);else if("iv1"===l)j.uniform1iv(f,k);else if("iv"===l)j.uniform3iv(f,k);else if("fv1"===l)j.uniform1fv(f,k);else if("fv"===l)j.uniform3fv(f,k);else if("v2v"===l){void 0===c._array&&(c._array=new Float32Array(2*k.length));l=0;for(n=k.length;l<n;l++)r=2*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y;j.uniform2fv(f,c._array)}else if("v3v"===l){void 0===c._array&&(c._array=new Float32Array(3*k.length));l=0;for(n=
|
|
k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=
|
|
k.length;l<n;l++)r=3*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z;j.uniform3fv(f,c._array)}else if("v4v"===l){void 0===c._array&&(c._array=new Float32Array(4*k.length));l=0;for(n=k.length;l<n;l++)r=4*l,c._array[r]=k[l].x,c._array[r+1]=k[l].y,c._array[r+2]=k[l].z,c._array[r+3]=k[l].w;j.uniform4fv(f,c._array)}else if("m4"===l)void 0===c._array&&(c._array=new Float32Array(16)),k.flattenToArray(c._array),j.uniformMatrix4fv(f,!1,c._array);else if("m4v"===l){void 0===c._array&&(c._array=
|
|
new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=E(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),O.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,
|
|
new Float32Array(16*k.length));l=0;for(n=k.length;l<n;l++)k[l].flattenToArrayOffset(c._array,16*l);j.uniformMatrix4fv(f,!1,c._array)}else if("t"===l){if(r=k,k=E(),j.uniform1i(f,k),r)if(r.image instanceof Array&&6===r.image.length){if(c=r,f=k,6===c.image.length)if(c.needsUpdate){c.image.__webglTextureCube||(c.image.__webglTextureCube=j.createTexture(),O.info.memory.textures++);j.activeTexture(j.TEXTURE0+f);j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,
|
|
-c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)O.autoScaleCubemaps&&!f?(n=k,r=l,t=c.image[l],w=bd,t.width<=w&&t.height<=w||(x=Math.max(t.width,t.height),v=Math.floor(t.width*w/x),w=Math.floor(t.height*w/x),x=document.createElement("canvas"),x.width=v,x.height=w,x.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,v,w),t=x),n[r]=t):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=H(c.format);t=H(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){w=
|
|
|
|
-k[l].mipmaps;x=0;for(A=w.length;x<A;x++)v=w[x],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,x,r,v.width,v.height,0,v.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
|
|
|
+c.flipY);f=c instanceof THREE.CompressedTexture;k=[];for(l=0;6>l;l++)O.autoScaleCubemaps&&!f?(n=k,r=l,t=c.image[l],v=ad,t.width<=v&&t.height<=v||(x=Math.max(t.width,t.height),w=Math.floor(t.width*v/x),v=Math.floor(t.height*v/x),x=document.createElement("canvas"),x.width=w,x.height=v,x.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,w,v),t=x),n[r]=t):k[l]=c.image[l];l=k[0];n=0===(l.width&l.width-1)&&0===(l.height&l.height-1);r=H(c.format);t=H(c.type);B(j.TEXTURE_CUBE_MAP,c,n);for(l=0;6>l;l++)if(f){v=
|
|
|
|
+k[l].mipmaps;x=0;for(A=v.length;x<A;x++)w=v[x],j.compressedTexImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,x,r,w.width,w.height,0,w.data)}else j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,r,r,t,k[l]);c.generateMipmaps&&n&&j.generateMipmap(j.TEXTURE_CUBE_MAP);c.needsUpdate=!1;if(c.onUpdate)c.onUpdate()}else j.activeTexture(j.TEXTURE0+f),j.bindTexture(j.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else r instanceof THREE.WebGLRenderTargetCube?(c=r,j.activeTexture(j.TEXTURE0+k),j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
c.__webglTexture)):O.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=E();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&O.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(h.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
c.__webglTexture)):O.setTexture(r,k)}else if("tv"===l){void 0===c._array&&(c._array=[]);l=0;for(n=c.value.length;l<n;l++)c._array[l]=E();j.uniform1iv(f,c._array);l=0;for(n=c.value.length;l<n;l++)r=c.value[l],k=c._array[l],r&&O.setTexture(r,k)}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition)b=a.matrixWorld.getPosition(),j.uniform3f(h.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
-d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function E(){var a=Ea;a>=Lc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Lc);
|
|
|
|
-Ea+=1;return a}function C(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function F(a,b,c){Nb!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Nb=a);if(a&&(yb!==b||Ra!==c))j.polygonOffset(b,c),yb=b,Ra=c}function I(a){for(var a=a.split("\n"),b=0,c=a.length;b<
|
|
|
|
-c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function $(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(I(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,H(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,H(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,H(b.magFilter)),j.texParameteri(a,
|
|
|
|
-j.TEXTURE_MIN_FILTER,H(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter)));if(Fb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,Fb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Kc)),b.__oldAnisotropy=b.anisotropy}function R(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?
|
|
|
|
|
|
+d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&j.uniformMatrix4fv(h.viewMatrix,!1,a.matrixWorldInverse.elements)}j.uniformMatrix4fv(h.modelViewMatrix,!1,e._modelViewMatrix.elements);h.normalMatrix&&j.uniformMatrix3fv(h.normalMatrix,!1,e._normalMatrix.elements);null!==h.modelMatrix&&j.uniformMatrix4fv(h.modelMatrix,!1,e.matrixWorld.elements);return g}function E(){var a=za;a>=Jc&&console.warn("WebGLRenderer: trying to use "+a+" texture units while this GPU supports only "+Jc);
|
|
|
|
+za+=1;return a}function C(a,b){a._modelViewMatrix.multiply(b.matrixWorldInverse,a.matrixWorld);a._normalMatrix.getInverse(a._modelViewMatrix);a._normalMatrix.transpose()}function z(a,b,c,d){a[b]=c.r*c.r*d;a[b+1]=c.g*c.g*d;a[b+2]=c.b*c.b*d}function G(a,b,c,d){a[b]=c.r*d;a[b+1]=c.g*d;a[b+2]=c.b*d}function F(a,b,c){Db!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),Db=a);if(a&&(zb!==b||rb!==c))j.polygonOffset(b,c),zb=b,rb=c}function J(a){for(var a=a.split("\n"),b=0,c=a.length;b<
|
|
|
|
+c;b++)a[b]=b+1+": "+a[b];return a.join("\n")}function V(a,b){var c;"fragment"===a?c=j.createShader(j.FRAGMENT_SHADER):"vertex"===a&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);return!j.getShaderParameter(c,j.COMPILE_STATUS)?(console.error(j.getShaderInfoLog(c)),console.error(J(b)),null):c}function B(a,b,c){c?(j.texParameteri(a,j.TEXTURE_WRAP_S,H(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,H(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,H(b.magFilter)),j.texParameteri(a,
|
|
|
|
+j.TEXTURE_MIN_FILTER,H(b.minFilter))):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,A(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,A(b.minFilter)));if(Eb&&b.type!==THREE.FloatType&&(1<b.anisotropy||b.__oldAnisotropy))j.texParameterf(a,Eb.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,Ac)),b.__oldAnisotropy=b.anisotropy}function T(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?
|
|
(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function A(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?
|
|
(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function A(a){return a===THREE.NearestFilter||a===THREE.NearestMipMapNearestFilter||a===THREE.NearestMipMapLinearFilter?
|
|
j.NEAREST:j.LINEAR}function H(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;
|
|
j.NEAREST:j.LINEAR}function H(a){if(a===THREE.RepeatWrapping)return j.REPEAT;if(a===THREE.ClampToEdgeWrapping)return j.CLAMP_TO_EDGE;if(a===THREE.MirroredRepeatWrapping)return j.MIRRORED_REPEAT;if(a===THREE.NearestFilter)return j.NEAREST;if(a===THREE.NearestMipMapNearestFilter)return j.NEAREST_MIPMAP_NEAREST;if(a===THREE.NearestMipMapLinearFilter)return j.NEAREST_MIPMAP_LINEAR;if(a===THREE.LinearFilter)return j.LINEAR;if(a===THREE.LinearMipMapNearestFilter)return j.LINEAR_MIPMAP_NEAREST;if(a===THREE.LinearMipMapLinearFilter)return j.LINEAR_MIPMAP_LINEAR;
|
|
if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;
|
|
if(a===THREE.UnsignedByteType)return j.UNSIGNED_BYTE;if(a===THREE.UnsignedShort4444Type)return j.UNSIGNED_SHORT_4_4_4_4;if(a===THREE.UnsignedShort5551Type)return j.UNSIGNED_SHORT_5_5_5_1;if(a===THREE.UnsignedShort565Type)return j.UNSIGNED_SHORT_5_6_5;if(a===THREE.ByteType)return j.BYTE;if(a===THREE.ShortType)return j.SHORT;if(a===THREE.UnsignedShortType)return j.UNSIGNED_SHORT;if(a===THREE.IntType)return j.INT;if(a===THREE.UnsignedIntType)return j.UNSIGNED_INT;if(a===THREE.FloatType)return j.FLOAT;
|
|
if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;
|
|
if(a===THREE.AlphaFormat)return j.ALPHA;if(a===THREE.RGBFormat)return j.RGB;if(a===THREE.RGBAFormat)return j.RGBA;if(a===THREE.LuminanceFormat)return j.LUMINANCE;if(a===THREE.LuminanceAlphaFormat)return j.LUMINANCE_ALPHA;if(a===THREE.AddEquation)return j.FUNC_ADD;if(a===THREE.SubtractEquation)return j.FUNC_SUBTRACT;if(a===THREE.ReverseSubtractEquation)return j.FUNC_REVERSE_SUBTRACT;if(a===THREE.ZeroFactor)return j.ZERO;if(a===THREE.OneFactor)return j.ONE;if(a===THREE.SrcColorFactor)return j.SRC_COLOR;
|
|
-if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==tb){if(a===THREE.RGB_S3TC_DXT1_Format)return tb.COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
|
|
-if(a===THREE.RGBA_S3TC_DXT1_Format)return tb.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return tb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return tb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},K=void 0!==a.canvas?a.canvas:document.createElement("canvas"),M=void 0!==a.precision?a.precision:"highp",P=void 0!==a.alpha?a.alpha:!0,ga=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,ra=void 0!==a.antialias?
|
|
|
|
-a.antialias:!1,L=void 0!==a.stencil?a.stencil:!0,oa=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,Aa=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Ha=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=K;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=
|
|
|
|
-this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var O=this,W=[],ja=
|
|
|
|
-0,fa=null,aa=null,ma=-1,Q=null,ka=null,va=0,Ea=0,na=-1,wa=-1,qa=-1,$a=-1,rb=-1,La=-1,db=-1,pb=-1,Nb=null,yb=null,Ra=null,Ia=null,Ua=0,Eb=0,Qa=0,eb=0,jb=0,la=0,fb={},zb=new THREE.Frustum,jc=new THREE.Matrix4,sb=new THREE.Matrix4,Kb=new THREE.Vector3,sa=new THREE.Vector3,Va=!0,Jc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,
|
|
|
|
-skyColors:[],groundColors:[],positions:[]}},j,pc,zc,Fb,tb;try{if(!(j=K.getContext("experimental-webgl",{alpha:P,premultipliedAlpha:ga,antialias:ra,stencil:L,preserveDrawingBuffer:oa})))throw"Error creating WebGL context.";}catch(cd){console.error(cd)}pc=j.getExtension("OES_texture_float");zc=j.getExtension("OES_standard_derivatives");Fb=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");tb=
|
|
|
|
-j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");pc||console.log("THREE.WebGLRenderer: Float textures not supported.");zc||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Fb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");tb||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");j.clearColor(0,0,0,1);j.clearDepth(1);
|
|
|
|
-j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(Aa.r,Aa.g,Aa.b,Ha);this.context=j;var Lc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),dd=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var bd=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Kc=Fb?j.getParameter(Fb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):
|
|
|
|
-0,qc=0<dd,ob=qc&&pc;tb&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var Ab=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),kc=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var X=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),Z=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,
|
|
|
|
-j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var ba=0<Ab.precision&&0<X.precision,Xa=0<kc.precision&&0<Z.precision;"highp"===M&&!ba&&(Xa?(M="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(M="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===
|
|
|
|
-M&&!Xa&&(M="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return qc};this.getMaxAnisotropy=function(){return Kc};this.getPrecision=function(){return M};this.setSize=function(a,b){K.width=a*this.devicePixelRatio;K.height=b*this.devicePixelRatio;K.style.width=a+"px";K.style.height=b+"px";this.setViewport(0,0,K.width,K.height)};this.setViewport=function(a,b,c,d){Ua=void 0!==a?a:0;Eb=void 0!==b?b:0;Qa=
|
|
|
|
-void 0!==c?c:K.width;eb=void 0!==d?d:K.height;j.viewport(Ua,Eb,Qa,eb)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){Aa.setHex(a);Ha=b;j.clearColor(Aa.r,Aa.g,Aa.b,Ha)};this.setClearColor=function(a,b){Aa.copy(a);Ha=b;j.clearColor(Aa.r,Aa.g,Aa.b,Ha)};this.getClearColor=function(){return Aa};this.getClearAlpha=function(){return Ha};this.clear=function(a,b,c){var d=0;if(void 0===
|
|
|
|
-a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){fa=null;ma=Q=pb=db=qa=-1;Va=!0;wa=na=-1;this.shadowMapPlugin.update(a,b)};var Bb=function(a){a=a.target;a.removeEventListener("dispose",
|
|
|
|
-Bb);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);
|
|
|
|
|
|
+if(a===THREE.OneMinusSrcColorFactor)return j.ONE_MINUS_SRC_COLOR;if(a===THREE.SrcAlphaFactor)return j.SRC_ALPHA;if(a===THREE.OneMinusSrcAlphaFactor)return j.ONE_MINUS_SRC_ALPHA;if(a===THREE.DstAlphaFactor)return j.DST_ALPHA;if(a===THREE.OneMinusDstAlphaFactor)return j.ONE_MINUS_DST_ALPHA;if(a===THREE.DstColorFactor)return j.DST_COLOR;if(a===THREE.OneMinusDstColorFactor)return j.ONE_MINUS_DST_COLOR;if(a===THREE.SrcAlphaSaturateFactor)return j.SRC_ALPHA_SATURATE;if(void 0!==Mb){if(a===THREE.RGB_S3TC_DXT1_Format)return Mb.COMPRESSED_RGB_S3TC_DXT1_EXT;
|
|
|
|
+if(a===THREE.RGBA_S3TC_DXT1_Format)return Mb.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(a===THREE.RGBA_S3TC_DXT3_Format)return Mb.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(a===THREE.RGBA_S3TC_DXT5_Format)return Mb.COMPRESSED_RGBA_S3TC_DXT5_EXT}return 0}console.log("THREE.WebGLRenderer",THREE.REVISION);var a=a||{},L=void 0!==a.canvas?a.canvas:document.createElement("canvas"),M=void 0!==a.precision?a.precision:"highp",P=void 0!==a.alpha?a.alpha:!0,ca=void 0!==a.premultipliedAlpha?a.premultipliedAlpha:!0,oa=void 0!==a.antialias?
|
|
|
|
+a.antialias:!1,K=void 0!==a.stencil?a.stencil:!0,ha=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,ea=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),Sa=void 0!==a.clearAlpha?a.clearAlpha:0;this.domElement=L;this.context=null;this.devicePixelRatio=void 0!==a.devicePixelRatio?a.devicePixelRatio:void 0!==window.devicePixelRatio?window.devicePixelRatio:1;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=
|
|
|
|
+this.autoClear=!0;this.shadowMapEnabled=this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapAutoUpdate=!0;this.shadowMapType=THREE.PCFShadowMap;this.shadowMapCullFace=THREE.CullFaceFront;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var O=this,ia=[],wa=
|
|
|
|
+0,ya=null,sa=null,ga=-1,fa=null,xa=null,pa=0,za=0,Oa=-1,ja=-1,ta=-1,qa=-1,kb=-1,Ja=-1,Ya=-1,qb=-1,Db=null,zb=null,rb=null,ob=null,ma=0,Fa=0,Cb=0,Za=0,kc=0,Lb=0,pb={},Ab=new THREE.Frustum,Ob=new THREE.Matrix4,qc=new THREE.Matrix4,lb=new THREE.Vector3,Ga=new THREE.Vector3,$a=!0,fb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]},spot:{length:0,colors:[],positions:[],distances:[],directions:[],anglesCos:[],exponents:[]},hemi:{length:0,
|
|
|
|
+skyColors:[],groundColors:[],positions:[]}},j,rc,Ic,Eb,Mb;try{if(!(j=L.getContext("experimental-webgl",{alpha:P,premultipliedAlpha:ca,antialias:oa,stencil:K,preserveDrawingBuffer:ha})))throw"Error creating WebGL context.";}catch(bd){console.error(bd)}rc=j.getExtension("OES_texture_float");Ic=j.getExtension("OES_standard_derivatives");Eb=j.getExtension("EXT_texture_filter_anisotropic")||j.getExtension("MOZ_EXT_texture_filter_anisotropic")||j.getExtension("WEBKIT_EXT_texture_filter_anisotropic");Mb=
|
|
|
|
+j.getExtension("WEBGL_compressed_texture_s3tc")||j.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||j.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");rc||console.log("THREE.WebGLRenderer: Float textures not supported.");Ic||console.log("THREE.WebGLRenderer: Standard derivatives not supported.");Eb||console.log("THREE.WebGLRenderer: Anisotropic texture filtering not supported.");Mb||console.log("THREE.WebGLRenderer: S3TC compressed textures not supported.");j.clearColor(0,0,0,1);j.clearDepth(1);
|
|
|
|
+j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(ea.r,ea.g,ea.b,Sa);this.context=j;var Jc=j.getParameter(j.MAX_TEXTURE_IMAGE_UNITS),$c=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS);j.getParameter(j.MAX_TEXTURE_SIZE);var ad=j.getParameter(j.MAX_CUBE_MAP_TEXTURE_SIZE),Ac=Eb?j.getParameter(Eb.MAX_TEXTURE_MAX_ANISOTROPY_EXT):
|
|
|
|
+0,gb=0<$c,ab=gb&&rc;Mb&&j.getParameter(j.COMPRESSED_TEXTURE_FORMATS);var ub=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_FLOAT),cd=j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_FLOAT);var Nb=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_FLOAT),W=j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_FLOAT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_FLOAT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,
|
|
|
|
+j.MEDIUM_INT);j.getShaderPrecisionFormat(j.VERTEX_SHADER,j.LOW_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.HIGH_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.MEDIUM_INT);j.getShaderPrecisionFormat(j.FRAGMENT_SHADER,j.LOW_INT);var Y=0<ub.precision&&0<Nb.precision,Z=0<cd.precision&&0<W.precision;"highp"===M&&!Y&&(Z?(M="mediump",console.warn("WebGLRenderer: highp not supported, using mediump")):(M="lowp",console.warn("WebGLRenderer: highp and mediump not supported, using lowp")));"mediump"===
|
|
|
|
+M&&!Z&&(M="lowp",console.warn("WebGLRenderer: mediump not supported, using lowp"));this.getContext=function(){return j};this.supportsVertexTextures=function(){return gb};this.getMaxAnisotropy=function(){return Ac};this.getPrecision=function(){return M};this.setSize=function(a,b){L.width=a*this.devicePixelRatio;L.height=b*this.devicePixelRatio;L.style.width=a+"px";L.style.height=b+"px";this.setViewport(0,0,L.width,L.height)};this.setViewport=function(a,b,c,d){ma=void 0!==a?a:0;Fa=void 0!==b?b:0;Cb=
|
|
|
|
+void 0!==c?c:L.width;Za=void 0!==d?d:L.height;j.viewport(ma,Fa,Cb,Za)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){ea.setHex(a);Sa=b;j.clearColor(ea.r,ea.g,ea.b,Sa)};this.setClearColor=function(a,b){ea.copy(a);Sa=b;j.clearColor(ea.r,ea.g,ea.b,Sa)};this.getClearColor=function(){return ea};this.getClearAlpha=function(){return Sa};this.clear=function(a,b,c){var d=0;if(void 0===
|
|
|
|
+a||a)d|=j.COLOR_BUFFER_BIT;if(void 0===b||b)d|=j.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.updateShadowMap=function(a,b){ya=null;ga=fa=qb=Ya=ta=-1;$a=!0;ja=Oa=-1;this.shadowMapPlugin.update(a,b)};var bb=function(a){a=a.target;a.removeEventListener("dispose",
|
|
|
|
+bb);a.__webglInit=void 0;void 0!==a.__webglVertexBuffer&&j.deleteBuffer(a.__webglVertexBuffer);void 0!==a.__webglNormalBuffer&&j.deleteBuffer(a.__webglNormalBuffer);void 0!==a.__webglTangentBuffer&&j.deleteBuffer(a.__webglTangentBuffer);void 0!==a.__webglColorBuffer&&j.deleteBuffer(a.__webglColorBuffer);void 0!==a.__webglUVBuffer&&j.deleteBuffer(a.__webglUVBuffer);void 0!==a.__webglUV2Buffer&&j.deleteBuffer(a.__webglUV2Buffer);void 0!==a.__webglSkinIndicesBuffer&&j.deleteBuffer(a.__webglSkinIndicesBuffer);
|
|
void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)j.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==
|
|
void 0!==a.__webglSkinWeightsBuffer&&j.deleteBuffer(a.__webglSkinWeightsBuffer);void 0!==a.__webglFaceBuffer&&j.deleteBuffer(a.__webglFaceBuffer);void 0!==a.__webglLineBuffer&&j.deleteBuffer(a.__webglLineBuffer);void 0!==a.__webglLineDistanceBuffer&&j.deleteBuffer(a.__webglLineDistanceBuffer);if(void 0!==a.geometryGroups)for(var c in a.geometryGroups){var d=a.geometryGroups[c];if(void 0!==d.numMorphTargets)for(var e=0,f=d.numMorphTargets;e<f;e++)j.deleteBuffer(d.__webglMorphTargetsBuffers[e]);if(void 0!==
|
|
-d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)j.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);O.info.memory.geometries--},Sa=function(a){a=a.target;a.removeEventListener("dispose",Sa);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));O.info.memory.textures--},ab=function(a){a=a.target;a.removeEventListener("dispose",ab);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof
|
|
|
|
-THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);O.info.memory.textures--},Ya=function(a){a=a.target;a.removeEventListener("dispose",Ya);Cb(a)},Cb=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=W.length;a<c;a++)if(d=W[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===
|
|
|
|
-e){e=[];a=0;for(c=W.length;a<c;a++)d=W[a],d.program!==b&&e.push(d);W=e;j.deleteProgram(b);O.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
|
|
+d.numMorphNormals){e=0;for(f=d.numMorphNormals;e<f;e++)j.deleteBuffer(d.__webglMorphNormalsBuffers[e])}b(d)}b(a);O.info.memory.geometries--},Va=function(a){a=a.target;a.removeEventListener("dispose",Va);a.image&&a.image.__webglTextureCube?j.deleteTexture(a.image.__webglTextureCube):a.__webglInit&&(a.__webglInit=!1,j.deleteTexture(a.__webglTexture));O.info.memory.textures--},Pa=function(a){a=a.target;a.removeEventListener("dispose",Pa);if(a&&a.__webglTexture)if(j.deleteTexture(a.__webglTexture),a instanceof
|
|
|
|
+THREE.WebGLRenderTargetCube)for(var b=0;6>b;b++)j.deleteFramebuffer(a.__webglFramebuffer[b]),j.deleteRenderbuffer(a.__webglRenderbuffer[b]);else j.deleteFramebuffer(a.__webglFramebuffer),j.deleteRenderbuffer(a.__webglRenderbuffer);O.info.memory.textures--},hb=function(a){a=a.target;a.removeEventListener("dispose",hb);Ta(a)},Ta=function(a){var b=a.program;if(void 0!==b){a.program=void 0;var c,d,e=!1,a=0;for(c=ia.length;a<c;a++)if(d=ia[a],d.program===b){d.usedTimes--;0===d.usedTimes&&(e=!0);break}if(!0===
|
|
|
|
+e){e=[];a=0;for(c=ia.length;a<c;a++)d=ia[a],d.program!==b&&e.push(d);ia=e;j.deleteProgram(b);O.info.memory.programs--}}};this.renderBufferImmediate=function(a,b,c){a.hasPositions&&!a.__webglVertexBuffer&&(a.__webglVertexBuffer=j.createBuffer());a.hasNormals&&!a.__webglNormalBuffer&&(a.__webglNormalBuffer=j.createBuffer());a.hasUvs&&!a.__webglUvBuffer&&(a.__webglUvBuffer=j.createBuffer());a.hasColors&&!a.__webglColorBuffer&&(a.__webglColorBuffer=j.createBuffer());a.hasPositions&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],l=n[p+5],h=n[p+6],k=n[p+7],m=n[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+
|
|
a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormals){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c.shading===THREE.FlatShading){var d,e,f,g,h,i,k,l,m,n,p,q=3*a.count;for(p=0;p<q;p+=9)n=a.normalArray,d=n[p],e=n[p+1],f=n[p+2],g=n[p+3],i=n[p+4],l=n[p+5],h=n[p+6],k=n[p+7],m=n[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+m)/3,n[p]=d,n[p+1]=e,n[p+
|
|
2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
2]=f,n[p+3]=d,n[p+4]=e,n[p+5]=f,n[p+6]=d,n[p+7]=e,n[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}a.hasUvs&&c.map&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglUvBuffer),j.bufferData(j.ARRAY_BUFFER,a.uvArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.uv),j.vertexAttribPointer(b.attributes.uv,2,j.FLOAT,!1,0,0));a.hasColors&&c.vertexColors!==THREE.NoColors&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
-a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=J(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==Q&&(Q=d,b=!0),b&&m(),f instanceof THREE.Mesh)if(f=e.attributes.index){d=e.offsets;1<d.length&&(b=!0);for(var c=0,g=d.length;c<
|
|
|
|
|
|
+a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,a.colorArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.color),j.vertexAttribPointer(b.attributes.color,3,j.FLOAT,!1,0,0));j.drawArrays(j.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,e,f){if(!1!==d.visible)if(c=I(a,b,c,d,f),a=c.attributes,b=!1,d=16777215*e.id+2*c.id+(d.wireframe?1:0),d!==fa&&(fa=d,b=!0),b&&m(),f instanceof THREE.Mesh)if(f=e.attributes.index){d=e.offsets;1<d.length&&(b=!0);for(var c=0,g=d.length;c<
|
|
g;c++){var h=d[c].index;if(b){var i=e.attributes.position,l=i.itemSize;j.bindBuffer(j.ARRAY_BUFFER,i.buffer);k(a.position);j.vertexAttribPointer(a.position,l,j.FLOAT,!1,0,4*h*l);l=e.attributes.normal;if(0<=a.normal&&l){var n=l.itemSize;j.bindBuffer(j.ARRAY_BUFFER,l.buffer);k(a.normal);j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,4*h*n)}l=e.attributes.uv;0<=a.uv&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,4*h*n));l=e.attributes.color;0<=
|
|
g;c++){var h=d[c].index;if(b){var i=e.attributes.position,l=i.itemSize;j.bindBuffer(j.ARRAY_BUFFER,i.buffer);k(a.position);j.vertexAttribPointer(a.position,l,j.FLOAT,!1,0,4*h*l);l=e.attributes.normal;if(0<=a.normal&&l){var n=l.itemSize;j.bindBuffer(j.ARRAY_BUFFER,l.buffer);k(a.normal);j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,4*h*n)}l=e.attributes.uv;0<=a.uv&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,4*h*n));l=e.attributes.color;0<=
|
|
a.color&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,4*h*n));l=e.attributes.tangent;0<=a.tangent&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,4*h*n));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,d[c].count,j.UNSIGNED_SHORT,2*d[c].start);O.info.render.calls++;O.info.render.vertices+=d[c].count;O.info.render.faces+=d[c].count/3}}else b&&
|
|
a.color&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,4*h*n));l=e.attributes.tangent;0<=a.tangent&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,4*h*n));j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,f.buffer)}j.drawElements(j.TRIANGLES,d[c].count,j.UNSIGNED_SHORT,2*d[c].start);O.info.render.calls++;O.info.render.vertices+=d[c].count;O.info.render.faces+=d[c].count/3}}else b&&
|
|
(i=e.attributes.position,l=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,l,j.FLOAT,!1,0,0),l=e.attributes.normal,0<=a.normal&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.normal),j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,0)),l=e.attributes.uv,0<=a.uv&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,0)),l=e.attributes.color,0<=a.color&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
(i=e.attributes.position,l=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,l,j.FLOAT,!1,0,0),l=e.attributes.normal,0<=a.normal&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.normal),j.vertexAttribPointer(a.normal,n,j.FLOAT,!1,0,0)),l=e.attributes.uv,0<=a.uv&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.uv),j.vertexAttribPointer(a.uv,n,j.FLOAT,!1,0,0)),l=e.attributes.color,0<=a.color&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,
|
|
l.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),l=e.attributes.tangent,0<=a.tangent&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,0))),j.drawArrays(j.TRIANGLES,0,i.numItems/3),O.info.render.calls++,O.info.render.vertices+=i.numItems/3,O.info.render.faces+=i.numItems/3/3;else f instanceof THREE.ParticleSystem&&b&&(i=e.attributes.position,l=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,
|
|
l.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),l=e.attributes.tangent,0<=a.tangent&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.tangent),j.vertexAttribPointer(a.tangent,n,j.FLOAT,!1,0,0))),j.drawArrays(j.TRIANGLES,0,i.numItems/3),O.info.render.calls++,O.info.render.vertices+=i.numItems/3,O.info.render.faces+=i.numItems/3/3;else f instanceof THREE.ParticleSystem&&b&&(i=e.attributes.position,l=i.itemSize,j.bindBuffer(j.ARRAY_BUFFER,i.buffer),k(a.position),j.vertexAttribPointer(a.position,
|
|
-l,j.FLOAT,!1,0,0),l=e.attributes.color,0<=a.color&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,i.numItems/3),O.info.render.calls++,O.info.render.points+=i.numItems/3)};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,c=J(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==Q&&(Q=c,a=!0);a&&m();if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),
|
|
|
|
|
|
+l,j.FLOAT,!1,0,0),l=e.attributes.color,0<=a.color&&l&&(n=l.itemSize,j.bindBuffer(j.ARRAY_BUFFER,l.buffer),k(a.color),j.vertexAttribPointer(a.color,n,j.FLOAT,!1,0,0)),j.drawArrays(j.POINTS,0,i.numItems/3),O.info.render.calls++,O.info.render.points+=i.numItems/3)};this.renderBuffer=function(a,b,c,d,e,f){if(!1!==d.visible){var g,h,c=I(a,b,c,d,f),b=c.attributes,a=!1,c=16777215*e.id+2*c.id+(d.wireframe?1:0);c!==fa&&(fa=c,a=!0);a&&m();if(!d.morphTargets&&0<=b.position)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),
|
|
k(b.position),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var i=0;h=f.morphTargetForcedOrder;
|
|
k(b.position),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;-1!==f.morphTargetBase&&0<=c.position?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):0<=c.position&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),k(c.position),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){var i=0;h=f.morphTargetForcedOrder;
|
|
for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[h[i]]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[h[i]]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[h[i]],i++}else{h=[];g=f.morphTargetInfluences;
|
|
for(g=f.morphTargetInfluences;i<d.numSupportedMorphTargets&&i<h.length;)0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[h[i]]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphNormalsBuffers[h[i]]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[h[i]],i++}else{h=[];g=f.morphTargetInfluences;
|
|
var n,p=g.length;for(n=0;n<p;n++)i=g[n],0<i&&h.push([i,n]);h.length>d.numSupportedMorphTargets?(h.sort(l),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(l):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?(n=h[i][1],0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
var n,p=g.length;for(n=0;n<p;n++)i=g[n],0<i&&h.push([i,n]);h.length>d.numSupportedMorphTargets?(h.sort(l),h.length=d.numSupportedMorphTargets):h.length>d.numSupportedMorphNormals?h.sort(l):0===h.length&&h.push([0,0]);for(i=0;i<d.numSupportedMorphTargets;)h[i]?(n=h[i][1],0<=c["morphTarget"+i]&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[n]),k(c["morphTarget"+i]),j.vertexAttribPointer(c["morphTarget"+i],3,j.FLOAT,!1,0,0)),0<=c["morphNormal"+i]&&d.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
e.__webglMorphNormalsBuffers[n]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[n]):f.__webglMorphTargetInfluences[i]=0,i++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
e.__webglMorphNormalsBuffers[n]),k(c["morphNormal"+i]),j.vertexAttribPointer(c["morphNormal"+i],3,j.FLOAT,!1,0,0)),f.__webglMorphTargetInfluences[i]=g[n]):f.__webglMorphTargetInfluences[i]=0,i++}null!==d.program.uniforms.morphTargetInfluences&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],0<=b[c.buffer.belongsToAttribute]&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
c.buffer),k(b[c.buffer.belongsToAttribute]),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),k(b.color),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),k(b.normal),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),k(b.tangent),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));
|
|
c.buffer),k(b[c.buffer.belongsToAttribute]),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}0<=b.color&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),k(b.color),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));0<=b.normal&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),k(b.normal),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));0<=b.tangent&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),k(b.tangent),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));
|
|
0<=b.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),k(b.uv),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0));0<=b.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),k(b.uv2),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=b.skinIndex&&0<=b.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),k(b.skinIndex),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(b.skinWeight),j.vertexAttribPointer(b.skinWeight,
|
|
0<=b.uv&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),k(b.uv),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0));0<=b.uv2&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),k(b.uv2),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0));d.skinning&&(0<=b.skinIndex&&0<=b.skinWeight)&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),k(b.skinIndex),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),k(b.skinWeight),j.vertexAttribPointer(b.skinWeight,
|
|
-4,j.FLOAT,!1,0,0));0<=b.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(b.lineDistance),j.vertexAttribPointer(b.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==Ia&&(j.lineWidth(d),Ia=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,
|
|
|
|
-0)),O.info.render.calls++,O.info.render.vertices+=e.__webglFaceCount,O.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==Ia&&(j.lineWidth(d),Ia=d),j.drawArrays(f,0,e.__webglLineCount),O.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),O.info.render.calls++,O.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),
|
|
|
|
-O.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,i=a.__lights,k=a.fog;ma=-1;Va=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);jc.multiply(b.projectionMatrix,b.matrixWorldInverse);zb.setFromMatrix(jc);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,
|
|
|
|
-a,b);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;O.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||zb.intersectsObject(g))){C(g,b);var l=f,m=l.buffer,r=void 0,t=r=void 0,t=l.object.material;if(t instanceof THREE.MeshFaceMaterial)r=
|
|
|
|
-m.materialIndex,r=t.materials[r],r.transparent?(l.transparent=r,l.opaque=null):(l.opaque=r,l.transparent=null);else if(r=t)r.transparent?(l.transparent=r,l.opaque=null):(l.opaque=r,l.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(Kb.copy(g.matrixWorld.getPosition()),Kb.applyMatrix4(jc),f.z=Kb.z),f.id=g.id)}this.sortObjects&&h.sort(n);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(C(g,b),g=f.object.material,g.transparent?
|
|
|
|
|
|
+4,j.FLOAT,!1,0,0));0<=b.lineDistance&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglLineDistanceBuffer),k(b.lineDistance),j.vertexAttribPointer(b.lineDistance,1,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ob&&(j.lineWidth(d),ob=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,
|
|
|
|
+0)),O.info.render.calls++,O.info.render.vertices+=e.__webglFaceCount,O.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ob&&(j.lineWidth(d),ob=d),j.drawArrays(f,0,e.__webglLineCount),O.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),O.info.render.calls++,O.info.render.points+=e.__webglParticleCount):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),
|
|
|
|
+O.info.render.calls++)}};this.render=function(a,b,c,d){if(!1===b instanceof THREE.Camera)console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");else{var e,f,g,h,i=a.__lights,k=a.fog;ga=-1;$a=!0;this.autoUpdateScene&&a.updateMatrixWorld();void 0===b.parent&&b.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);Ob.multiply(b.projectionMatrix,b.matrixWorldInverse);Ab.setFromMatrix(Ob);this.autoUpdateObjects&&this.initWebGLObjects(a);s(this.renderPluginsPre,
|
|
|
|
+a,b);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;O.info.render.points=0;this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh||g instanceof THREE.ParticleSystem)||!g.frustumCulled||Ab.intersectsObject(g))){C(g,b);var l=f,m=l.buffer,r=void 0,t=r=void 0,t=l.object.material;if(t instanceof THREE.MeshFaceMaterial)r=
|
|
|
|
+m.materialIndex,r=t.materials[r],r.transparent?(l.transparent=r,l.opaque=null):(l.opaque=r,l.transparent=null);else if(r=t)r.transparent?(l.transparent=r,l.opaque=null):(l.opaque=r,l.transparent=null);f.render=!0;!0===this.sortObjects&&(null!==g.renderDepth?f.z=g.renderDepth:(lb.copy(g.matrixWorld.getPosition()),lb.applyMatrix4(Ob),f.z=lb.z),f.id=g.id)}this.sortObjects&&h.sort(n);h=a.__webglObjectsImmediate;d=0;for(e=h.length;d<e;d++)f=h[d],g=f.object,g.visible&&(C(g,b),g=f.object.material,g.transparent?
|
|
(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),F(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),q(a.__webglObjects,!1,"",b,i,k,!0,d),p(a.__webglObjectsImmediate,"",b,i,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),q(a.__webglObjects,!0,"opaque",b,i,k,!1,d),p(a.__webglObjectsImmediate,"opaque",
|
|
(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null));a.overrideMaterial?(d=a.overrideMaterial,this.setBlending(d.blending,d.blendEquation,d.blendSrc,d.blendDst),this.setDepthTest(d.depthTest),this.setDepthWrite(d.depthWrite),F(d.polygonOffset,d.polygonOffsetFactor,d.polygonOffsetUnits),q(a.__webglObjects,!1,"",b,i,k,!0,d),p(a.__webglObjectsImmediate,"",b,i,k,!1,d)):(d=null,this.setBlending(THREE.NoBlending),q(a.__webglObjects,!0,"opaque",b,i,k,!1,d),p(a.__webglObjectsImmediate,"opaque",
|
|
b,i,k,!1,d),q(a.__webglObjects,!1,"transparent",b,i,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,i,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,
|
|
b,i,k,!1,d),q(a.__webglObjects,!1,"transparent",b,i,k,!0,d),p(a.__webglObjectsImmediate,"transparent",b,i,k,!0,d));s(this.renderPluginsPost,a,b);c&&(c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter)&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,
|
|
-null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=J(a,b,c,d,e);Q=-1;O.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,zb):e.render(function(a){O.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,m=void 0,n=void 0,p=void 0,q=void 0;
|
|
|
|
-if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",Bb)),b instanceof THREE.Mesh)if(n=b.geometry,p=b.material,n instanceof THREE.Geometry){if(void 0===n.geometryGroups){var s=n,z=void 0,A=void 0,C=void 0,B=void 0,E=void 0,F=void 0,G={},H=s.morphTargets.length,I=s.morphNormals.length,J=p instanceof THREE.MeshFaceMaterial;s.geometryGroups=
|
|
|
|
|
|
+null)));this.setDepthTest(!0);this.setDepthWrite(!0)}};this.renderImmediateObject=function(a,b,c,d,e){var f=I(a,b,c,d,e);fa=-1;O.setMaterialFaces(d);e.immediateRenderCallback?e.immediateRenderCallback(f,j,Ab):e.render(function(a){O.renderBufferImmediate(a,f,d)})};this.initWebGLObjects=function(a){a.__webglObjects||(a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[]);for(;a.__objectsAdded.length;){var b=a.__objectsAdded[0],k=a,m=void 0,n=void 0,p=void 0,q=void 0;
|
|
|
|
+if(!b.__webglInit)if(b.__webglInit=!0,b._modelViewMatrix=new THREE.Matrix4,b._normalMatrix=new THREE.Matrix3,void 0!==b.geometry&&void 0===b.geometry.__webglInit&&(b.geometry.__webglInit=!0,b.geometry.addEventListener("dispose",bb)),b instanceof THREE.Mesh)if(n=b.geometry,p=b.material,n instanceof THREE.Geometry){if(void 0===n.geometryGroups){var s=n,z=void 0,A=void 0,C=void 0,B=void 0,E=void 0,F=void 0,G={},H=s.morphTargets.length,I=s.morphNormals.length,J=p instanceof THREE.MeshFaceMaterial;s.geometryGroups=
|
|
{};z=0;for(A=s.faces.length;z<A;z++)C=s.faces[z],B=J?C.materialIndex:0,void 0===G[B]&&(G[B]={hash:B,counter:0}),F=G[B].hash+"_"+G[B].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:H,numMorphNormals:I}),E=C instanceof THREE.Face3?3:4,65535<s.geometryGroups[F].vertices+E&&(G[B].counter+=1,F=G[B].hash+"_"+G[B].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:H,
|
|
{};z=0;for(A=s.faces.length;z<A;z++)C=s.faces[z],B=J?C.materialIndex:0,void 0===G[B]&&(G[B]={hash:B,counter:0}),F=G[B].hash+"_"+G[B].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:H,numMorphNormals:I}),E=C instanceof THREE.Face3?3:4,65535<s.geometryGroups[F].vertices+E&&(G[B].counter+=1,F=G[B].hash+"_"+G[B].counter,void 0===s.geometryGroups[F]&&(s.geometryGroups[F]={faces3:[],faces4:[],materialIndex:B,vertices:0,numMorphTargets:H,
|
|
-numMorphNormals:I})),C instanceof THREE.Face3?s.geometryGroups[F].faces3.push(z):s.geometryGroups[F].faces4.push(z),s.geometryGroups[F].vertices+=E;s.geometryGroupsList=[];var W=void 0;for(W in s.geometryGroups)s.geometryGroups[W].id=va++,s.geometryGroupsList.push(s.geometryGroups[W])}for(m in n.geometryGroups)if(q=n.geometryGroups[m],!q.__webglVertexBuffer){var K=q;K.__webglVertexBuffer=j.createBuffer();K.__webglNormalBuffer=j.createBuffer();K.__webglTangentBuffer=j.createBuffer();K.__webglColorBuffer=
|
|
|
|
-j.createBuffer();K.__webglUVBuffer=j.createBuffer();K.__webglUV2Buffer=j.createBuffer();K.__webglSkinIndicesBuffer=j.createBuffer();K.__webglSkinWeightsBuffer=j.createBuffer();K.__webglFaceBuffer=j.createBuffer();K.__webglLineBuffer=j.createBuffer();var L=void 0,Q=void 0;if(K.numMorphTargets){K.__webglMorphTargetsBuffers=[];L=0;for(Q=K.numMorphTargets;L<Q;L++)K.__webglMorphTargetsBuffers.push(j.createBuffer())}if(K.numMorphNormals){K.__webglMorphNormalsBuffers=[];L=0;for(Q=K.numMorphNormals;L<Q;L++)K.__webglMorphNormalsBuffers.push(j.createBuffer())}O.info.memory.geometries++;
|
|
|
|
-d(q,b);n.verticesNeedUpdate=!0;n.morphTargetsNeedUpdate=!0;n.elementsNeedUpdate=!0;n.uvsNeedUpdate=!0;n.normalsNeedUpdate=!0;n.tangentsNeedUpdate=!0;n.colorsNeedUpdate=!0}}else n instanceof THREE.BufferGeometry&&h(n);else if(b instanceof THREE.Ribbon){if(n=b.geometry,!n.__webglVertexBuffer){var fa=n;fa.__webglVertexBuffer=j.createBuffer();fa.__webglColorBuffer=j.createBuffer();fa.__webglNormalBuffer=j.createBuffer();O.info.memory.geometries++;var M=n,ja=b,P=M.vertices.length;M.__vertexArray=new Float32Array(3*
|
|
|
|
-P);M.__colorArray=new Float32Array(3*P);M.__normalArray=new Float32Array(3*P);M.__webglVertexCount=P;c(M,ja);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0;n.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(n=b.geometry,!n.__webglVertexBuffer){var R=n;R.__webglVertexBuffer=j.createBuffer();R.__webglColorBuffer=j.createBuffer();R.__webglLineDistanceBuffer=j.createBuffer();O.info.memory.geometries++;var aa=n,X=b,ka=aa.vertices.length;aa.__vertexArray=new Float32Array(3*ka);aa.__colorArray=new Float32Array(3*
|
|
|
|
-ka);aa.__lineDistanceArray=new Float32Array(1*ka);aa.__webglLineCount=ka;c(aa,X);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0;n.lineDistancesNeedUpdate=!0}}else if(b instanceof THREE.ParticleSystem&&(n=b.geometry,!n.__webglVertexBuffer))if(n instanceof THREE.Geometry){var $=n;$.__webglVertexBuffer=j.createBuffer();$.__webglColorBuffer=j.createBuffer();O.info.memory.geometries++;var Z=n,ma=b,ga=Z.vertices.length;Z.__vertexArray=new Float32Array(3*ga);Z.__colorArray=new Float32Array(3*ga);Z.__sortArray=
|
|
|
|
-[];Z.__webglParticleCount=ga;c(Z,ma);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0}else n instanceof THREE.BufferGeometry&&h(n);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(n=b.geometry,n instanceof THREE.BufferGeometry)r(k.__webglObjects,n,b);else{if(n instanceof THREE.Geometry)for(m in n.geometryGroups)q=n.geometryGroups[m],r(k.__webglObjects,q,b)}else b instanceof THREE.Ribbon||b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(n=b.geometry,r(k.__webglObjects,n,b)):b instanceof THREE.ImmediateRenderObject||
|
|
|
|
-b.immediateRenderCallback?k.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?k.__webglSprites.push(b):b instanceof THREE.LensFlare&&k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var ba=a.__objectsRemoved[0],oa=a;ba instanceof THREE.Mesh||ba instanceof THREE.ParticleSystem||ba instanceof THREE.Ribbon||ba instanceof THREE.Line?w(oa.__webglObjects,ba):ba instanceof THREE.Sprite?t(oa.__webglSprites,
|
|
|
|
-ba):ba instanceof THREE.LensFlare?t(oa.__webglFlares,ba):(ba instanceof THREE.ImmediateRenderObject||ba.immediateRenderCallback)&&w(oa.__webglObjectsImmediate,ba);ba.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var qa=0,Ea=a.__webglObjects.length;qa<Ea;qa++){var la=a.__webglObjects[qa].object,V=la.geometry,wa=void 0,ra=void 0,na=void 0;if(la instanceof THREE.Mesh)if(V instanceof THREE.BufferGeometry)(V.verticesNeedUpdate||V.elementsNeedUpdate||V.uvsNeedUpdate||V.normalsNeedUpdate||V.colorsNeedUpdate||
|
|
|
|
-V.tangentsNeedUpdate)&&i(V,j.DYNAMIC_DRAW,!V.dynamic),V.verticesNeedUpdate=!1,V.elementsNeedUpdate=!1,V.uvsNeedUpdate=!1,V.normalsNeedUpdate=!1,V.colorsNeedUpdate=!1,V.tangentsNeedUpdate=!1;else{for(var Aa=0,La=V.geometryGroupsList.length;Aa<La;Aa++)if(wa=V.geometryGroupsList[Aa],na=e(la,wa),V.buffersNeedUpdate&&d(wa,la),ra=na.attributes&&v(na),V.verticesNeedUpdate||V.morphTargetsNeedUpdate||V.elementsNeedUpdate||V.uvsNeedUpdate||V.normalsNeedUpdate||V.colorsNeedUpdate||V.tangentsNeedUpdate||ra){var xa=
|
|
|
|
-wa,Ia=la,sa=j.DYNAMIC_DRAW,$a=!V.dynamic,Ha=na;if(xa.__inittedArrays){var Ua=f(Ha),Qa=Ha.vertexColors?Ha.vertexColors:!1,Xa=g(Ha),Va=Ua===THREE.SmoothShading,D=void 0,Y=void 0,Ra=void 0,N=void 0,ab=void 0,Ya=void 0,Sa=void 0,rb=void 0,db=void 0,ob=void 0,pb=void 0,S=void 0,T=void 0,U=void 0,ua=void 0,eb=void 0,fb=void 0,jb=void 0,yb=void 0,Ob=void 0,Pb=void 0,Qb=void 0,zb=void 0,Rb=void 0,Sb=void 0,Tb=void 0,Ab=void 0,Ub=void 0,Vb=void 0,Wb=void 0,Cb=void 0,Xb=void 0,Yb=void 0,Zb=void 0,Eb=void 0,
|
|
|
|
-Ba=void 0,Nb=void 0,tb=void 0,Fb=void 0,vc=void 0,gb=void 0,kc=void 0,bb=void 0,cb=void 0,lc=void 0,ec=void 0,Ta=0,Za=0,fc=0,gc=0,Gb=0,mb=0,Fa=0,qb=0,Wa=0,da=0,pa=0,y=0,Ca=void 0,hb=xa.__vertexArray,Ac=xa.__uvArray,Bc=xa.__uv2Array,Hb=xa.__normalArray,Ma=xa.__tangentArray,ib=xa.__colorArray,Na=xa.__skinIndexArray,Oa=xa.__skinWeightArray,pc=xa.__morphTargetsArrays,qc=xa.__morphNormalsArrays,ed=xa.__webglCustomAttributesList,u=void 0,$b=xa.__faceArray,Db=xa.__lineArray,ub=Ia.geometry,Jc=ub.elementsNeedUpdate,
|
|
|
|
-zc=ub.uvsNeedUpdate,Kc=ub.normalsNeedUpdate,Lc=ub.tangentsNeedUpdate,bd=ub.colorsNeedUpdate,cd=ub.morphTargetsNeedUpdate,rc=ub.vertices,ya=xa.faces3,za=xa.faces4,nb=ub.faces,fd=ub.faceVertexUvs[0],gd=ub.faceVertexUvs[1],sc=ub.skinIndices,mc=ub.skinWeights,nc=ub.morphTargets,Mc=ub.morphNormals;if(ub.verticesNeedUpdate){D=0;for(Y=ya.length;D<Y;D++)N=nb[ya[D]],S=rc[N.a],T=rc[N.b],U=rc[N.c],hb[Za]=S.x,hb[Za+1]=S.y,hb[Za+2]=S.z,hb[Za+3]=T.x,hb[Za+4]=T.y,hb[Za+5]=T.z,hb[Za+6]=U.x,hb[Za+7]=U.y,hb[Za+8]=
|
|
|
|
-U.z,Za+=9;D=0;for(Y=za.length;D<Y;D++)N=nb[za[D]],S=rc[N.a],T=rc[N.b],U=rc[N.c],ua=rc[N.d],hb[Za]=S.x,hb[Za+1]=S.y,hb[Za+2]=S.z,hb[Za+3]=T.x,hb[Za+4]=T.y,hb[Za+5]=T.z,hb[Za+6]=U.x,hb[Za+7]=U.y,hb[Za+8]=U.z,hb[Za+9]=ua.x,hb[Za+10]=ua.y,hb[Za+11]=ua.z,Za+=12;j.bindBuffer(j.ARRAY_BUFFER,xa.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,hb,sa)}if(cd){gb=0;for(kc=nc.length;gb<kc;gb++){D=pa=0;for(Y=ya.length;D<Y;D++)lc=ya[D],N=nb[lc],S=nc[gb].vertices[N.a],T=nc[gb].vertices[N.b],U=nc[gb].vertices[N.c],
|
|
|
|
-bb=pc[gb],bb[pa]=S.x,bb[pa+1]=S.y,bb[pa+2]=S.z,bb[pa+3]=T.x,bb[pa+4]=T.y,bb[pa+5]=T.z,bb[pa+6]=U.x,bb[pa+7]=U.y,bb[pa+8]=U.z,Ha.morphNormals&&(Va?(ec=Mc[gb].vertexNormals[lc],Ob=ec.a,Pb=ec.b,Qb=ec.c):Qb=Pb=Ob=Mc[gb].faceNormals[lc],cb=qc[gb],cb[pa]=Ob.x,cb[pa+1]=Ob.y,cb[pa+2]=Ob.z,cb[pa+3]=Pb.x,cb[pa+4]=Pb.y,cb[pa+5]=Pb.z,cb[pa+6]=Qb.x,cb[pa+7]=Qb.y,cb[pa+8]=Qb.z),pa+=9;D=0;for(Y=za.length;D<Y;D++)lc=za[D],N=nb[lc],S=nc[gb].vertices[N.a],T=nc[gb].vertices[N.b],U=nc[gb].vertices[N.c],ua=nc[gb].vertices[N.d],
|
|
|
|
-bb=pc[gb],bb[pa]=S.x,bb[pa+1]=S.y,bb[pa+2]=S.z,bb[pa+3]=T.x,bb[pa+4]=T.y,bb[pa+5]=T.z,bb[pa+6]=U.x,bb[pa+7]=U.y,bb[pa+8]=U.z,bb[pa+9]=ua.x,bb[pa+10]=ua.y,bb[pa+11]=ua.z,Ha.morphNormals&&(Va?(ec=Mc[gb].vertexNormals[lc],Ob=ec.a,Pb=ec.b,Qb=ec.c,zb=ec.d):zb=Qb=Pb=Ob=Mc[gb].faceNormals[lc],cb=qc[gb],cb[pa]=Ob.x,cb[pa+1]=Ob.y,cb[pa+2]=Ob.z,cb[pa+3]=Pb.x,cb[pa+4]=Pb.y,cb[pa+5]=Pb.z,cb[pa+6]=Qb.x,cb[pa+7]=Qb.y,cb[pa+8]=Qb.z,cb[pa+9]=zb.x,cb[pa+10]=zb.y,cb[pa+11]=zb.z),pa+=12;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
-xa.__webglMorphTargetsBuffers[gb]);j.bufferData(j.ARRAY_BUFFER,pc[gb],sa);Ha.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,xa.__webglMorphNormalsBuffers[gb]),j.bufferData(j.ARRAY_BUFFER,qc[gb],sa))}}if(mc.length){D=0;for(Y=ya.length;D<Y;D++)N=nb[ya[D]],Ub=mc[N.a],Vb=mc[N.b],Wb=mc[N.c],Oa[da]=Ub.x,Oa[da+1]=Ub.y,Oa[da+2]=Ub.z,Oa[da+3]=Ub.w,Oa[da+4]=Vb.x,Oa[da+5]=Vb.y,Oa[da+6]=Vb.z,Oa[da+7]=Vb.w,Oa[da+8]=Wb.x,Oa[da+9]=Wb.y,Oa[da+10]=Wb.z,Oa[da+11]=Wb.w,Xb=sc[N.a],Yb=sc[N.b],Zb=sc[N.c],Na[da]=Xb.x,Na[da+
|
|
|
|
-1]=Xb.y,Na[da+2]=Xb.z,Na[da+3]=Xb.w,Na[da+4]=Yb.x,Na[da+5]=Yb.y,Na[da+6]=Yb.z,Na[da+7]=Yb.w,Na[da+8]=Zb.x,Na[da+9]=Zb.y,Na[da+10]=Zb.z,Na[da+11]=Zb.w,da+=12;D=0;for(Y=za.length;D<Y;D++)N=nb[za[D]],Ub=mc[N.a],Vb=mc[N.b],Wb=mc[N.c],Cb=mc[N.d],Oa[da]=Ub.x,Oa[da+1]=Ub.y,Oa[da+2]=Ub.z,Oa[da+3]=Ub.w,Oa[da+4]=Vb.x,Oa[da+5]=Vb.y,Oa[da+6]=Vb.z,Oa[da+7]=Vb.w,Oa[da+8]=Wb.x,Oa[da+9]=Wb.y,Oa[da+10]=Wb.z,Oa[da+11]=Wb.w,Oa[da+12]=Cb.x,Oa[da+13]=Cb.y,Oa[da+14]=Cb.z,Oa[da+15]=Cb.w,Xb=sc[N.a],Yb=sc[N.b],Zb=sc[N.c],
|
|
|
|
-Eb=sc[N.d],Na[da]=Xb.x,Na[da+1]=Xb.y,Na[da+2]=Xb.z,Na[da+3]=Xb.w,Na[da+4]=Yb.x,Na[da+5]=Yb.y,Na[da+6]=Yb.z,Na[da+7]=Yb.w,Na[da+8]=Zb.x,Na[da+9]=Zb.y,Na[da+10]=Zb.z,Na[da+11]=Zb.w,Na[da+12]=Eb.x,Na[da+13]=Eb.y,Na[da+14]=Eb.z,Na[da+15]=Eb.w,da+=16;0<da&&(j.bindBuffer(j.ARRAY_BUFFER,xa.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,Na,sa),j.bindBuffer(j.ARRAY_BUFFER,xa.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Oa,sa))}if(bd&&Qa){D=0;for(Y=ya.length;D<Y;D++)N=nb[ya[D]],Sa=N.vertexColors,
|
|
|
|
-rb=N.color,3===Sa.length&&Qa===THREE.VertexColors?(Rb=Sa[0],Sb=Sa[1],Tb=Sa[2]):Tb=Sb=Rb=rb,ib[Wa]=Rb.r,ib[Wa+1]=Rb.g,ib[Wa+2]=Rb.b,ib[Wa+3]=Sb.r,ib[Wa+4]=Sb.g,ib[Wa+5]=Sb.b,ib[Wa+6]=Tb.r,ib[Wa+7]=Tb.g,ib[Wa+8]=Tb.b,Wa+=9;D=0;for(Y=za.length;D<Y;D++)N=nb[za[D]],Sa=N.vertexColors,rb=N.color,4===Sa.length&&Qa===THREE.VertexColors?(Rb=Sa[0],Sb=Sa[1],Tb=Sa[2],Ab=Sa[3]):Ab=Tb=Sb=Rb=rb,ib[Wa]=Rb.r,ib[Wa+1]=Rb.g,ib[Wa+2]=Rb.b,ib[Wa+3]=Sb.r,ib[Wa+4]=Sb.g,ib[Wa+5]=Sb.b,ib[Wa+6]=Tb.r,ib[Wa+7]=Tb.g,ib[Wa+8]=
|
|
|
|
-Tb.b,ib[Wa+9]=Ab.r,ib[Wa+10]=Ab.g,ib[Wa+11]=Ab.b,Wa+=12;0<Wa&&(j.bindBuffer(j.ARRAY_BUFFER,xa.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,ib,sa))}if(Lc&&ub.hasTangents){D=0;for(Y=ya.length;D<Y;D++)N=nb[ya[D]],db=N.vertexTangents,eb=db[0],fb=db[1],jb=db[2],Ma[Fa]=eb.x,Ma[Fa+1]=eb.y,Ma[Fa+2]=eb.z,Ma[Fa+3]=eb.w,Ma[Fa+4]=fb.x,Ma[Fa+5]=fb.y,Ma[Fa+6]=fb.z,Ma[Fa+7]=fb.w,Ma[Fa+8]=jb.x,Ma[Fa+9]=jb.y,Ma[Fa+10]=jb.z,Ma[Fa+11]=jb.w,Fa+=12;D=0;for(Y=za.length;D<Y;D++)N=nb[za[D]],db=N.vertexTangents,eb=db[0],
|
|
|
|
-fb=db[1],jb=db[2],yb=db[3],Ma[Fa]=eb.x,Ma[Fa+1]=eb.y,Ma[Fa+2]=eb.z,Ma[Fa+3]=eb.w,Ma[Fa+4]=fb.x,Ma[Fa+5]=fb.y,Ma[Fa+6]=fb.z,Ma[Fa+7]=fb.w,Ma[Fa+8]=jb.x,Ma[Fa+9]=jb.y,Ma[Fa+10]=jb.z,Ma[Fa+11]=jb.w,Ma[Fa+12]=yb.x,Ma[Fa+13]=yb.y,Ma[Fa+14]=yb.z,Ma[Fa+15]=yb.w,Fa+=16;j.bindBuffer(j.ARRAY_BUFFER,xa.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ma,sa)}if(Kc&&Ua){D=0;for(Y=ya.length;D<Y;D++)if(N=nb[ya[D]],ab=N.vertexNormals,Ya=N.normal,3===ab.length&&Va)for(Ba=0;3>Ba;Ba++)tb=ab[Ba],Hb[mb]=tb.x,Hb[mb+1]=
|
|
|
|
-tb.y,Hb[mb+2]=tb.z,mb+=3;else for(Ba=0;3>Ba;Ba++)Hb[mb]=Ya.x,Hb[mb+1]=Ya.y,Hb[mb+2]=Ya.z,mb+=3;D=0;for(Y=za.length;D<Y;D++)if(N=nb[za[D]],ab=N.vertexNormals,Ya=N.normal,4===ab.length&&Va)for(Ba=0;4>Ba;Ba++)tb=ab[Ba],Hb[mb]=tb.x,Hb[mb+1]=tb.y,Hb[mb+2]=tb.z,mb+=3;else for(Ba=0;4>Ba;Ba++)Hb[mb]=Ya.x,Hb[mb+1]=Ya.y,Hb[mb+2]=Ya.z,mb+=3;j.bindBuffer(j.ARRAY_BUFFER,xa.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Hb,sa)}if(zc&&fd&&Xa){D=0;for(Y=ya.length;D<Y;D++)if(Ra=ya[D],ob=fd[Ra],void 0!==ob)for(Ba=
|
|
|
|
-0;3>Ba;Ba++)Fb=ob[Ba],Ac[fc]=Fb.x,Ac[fc+1]=Fb.y,fc+=2;D=0;for(Y=za.length;D<Y;D++)if(Ra=za[D],ob=fd[Ra],void 0!==ob)for(Ba=0;4>Ba;Ba++)Fb=ob[Ba],Ac[fc]=Fb.x,Ac[fc+1]=Fb.y,fc+=2;0<fc&&(j.bindBuffer(j.ARRAY_BUFFER,xa.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Ac,sa))}if(zc&&gd&&Xa){D=0;for(Y=ya.length;D<Y;D++)if(Ra=ya[D],pb=gd[Ra],void 0!==pb)for(Ba=0;3>Ba;Ba++)vc=pb[Ba],Bc[gc]=vc.x,Bc[gc+1]=vc.y,gc+=2;D=0;for(Y=za.length;D<Y;D++)if(Ra=za[D],pb=gd[Ra],void 0!==pb)for(Ba=0;4>Ba;Ba++)vc=pb[Ba],Bc[gc]=
|
|
|
|
-vc.x,Bc[gc+1]=vc.y,gc+=2;0<gc&&(j.bindBuffer(j.ARRAY_BUFFER,xa.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Bc,sa))}if(Jc){D=0;for(Y=ya.length;D<Y;D++)$b[Gb]=Ta,$b[Gb+1]=Ta+1,$b[Gb+2]=Ta+2,Gb+=3,Db[qb]=Ta,Db[qb+1]=Ta+1,Db[qb+2]=Ta,Db[qb+3]=Ta+2,Db[qb+4]=Ta+1,Db[qb+5]=Ta+2,qb+=6,Ta+=3;D=0;for(Y=za.length;D<Y;D++)$b[Gb]=Ta,$b[Gb+1]=Ta+1,$b[Gb+2]=Ta+3,$b[Gb+3]=Ta+1,$b[Gb+4]=Ta+2,$b[Gb+5]=Ta+3,Gb+=6,Db[qb]=Ta,Db[qb+1]=Ta+1,Db[qb+2]=Ta,Db[qb+3]=Ta+3,Db[qb+4]=Ta+1,Db[qb+5]=Ta+2,Db[qb+6]=Ta+2,Db[qb+7]=
|
|
|
|
-Ta+3,qb+=8,Ta+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,xa.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,$b,sa);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,xa.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Db,sa)}if(ed){Ba=0;for(Nb=ed.length;Ba<Nb;Ba++)if(u=ed[Ba],u.__original.needsUpdate){y=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)N=nb[ya[D]],u.array[y]=u.value[N.a],u.array[y+1]=u.value[N.b],u.array[y+2]=u.value[N.c],y+=3;D=0;for(Y=za.length;D<
|
|
|
|
-Y;D++)N=nb[za[D]],u.array[y]=u.value[N.a],u.array[y+1]=u.value[N.b],u.array[y+2]=u.value[N.c],u.array[y+3]=u.value[N.d],y+=4}else{if("faces"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)Ca=u.value[ya[D]],u.array[y]=Ca,u.array[y+1]=Ca,u.array[y+2]=Ca,y+=3;D=0;for(Y=za.length;D<Y;D++)Ca=u.value[za[D]],u.array[y]=Ca,u.array[y+1]=Ca,u.array[y+2]=Ca,u.array[y+3]=Ca,y+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)N=nb[ya[D]],S=u.value[N.a],T=u.value[N.b],
|
|
|
|
-U=u.value[N.c],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=T.x,u.array[y+3]=T.y,u.array[y+4]=U.x,u.array[y+5]=U.y,y+=6;D=0;for(Y=za.length;D<Y;D++)N=nb[za[D]],S=u.value[N.a],T=u.value[N.b],U=u.value[N.c],ua=u.value[N.d],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=T.x,u.array[y+3]=T.y,u.array[y+4]=U.x,u.array[y+5]=U.y,u.array[y+6]=ua.x,u.array[y+7]=ua.y,y+=8}else{if("faces"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)U=T=S=Ca=u.value[ya[D]],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=T.x,u.array[y+
|
|
|
|
-3]=T.y,u.array[y+4]=U.x,u.array[y+5]=U.y,y+=6;D=0;for(Y=za.length;D<Y;D++)ua=U=T=S=Ca=u.value[za[D]],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=T.x,u.array[y+3]=T.y,u.array[y+4]=U.x,u.array[y+5]=U.y,u.array[y+6]=ua.x,u.array[y+7]=ua.y,y+=8}}else if(3===u.size){var ca;ca="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)N=nb[ya[D]],S=u.value[N.a],T=u.value[N.b],U=u.value[N.c],u.array[y]=S[ca[0]],u.array[y+1]=S[ca[1]],u.array[y+2]=
|
|
|
|
-S[ca[2]],u.array[y+3]=T[ca[0]],u.array[y+4]=T[ca[1]],u.array[y+5]=T[ca[2]],u.array[y+6]=U[ca[0]],u.array[y+7]=U[ca[1]],u.array[y+8]=U[ca[2]],y+=9;D=0;for(Y=za.length;D<Y;D++)N=nb[za[D]],S=u.value[N.a],T=u.value[N.b],U=u.value[N.c],ua=u.value[N.d],u.array[y]=S[ca[0]],u.array[y+1]=S[ca[1]],u.array[y+2]=S[ca[2]],u.array[y+3]=T[ca[0]],u.array[y+4]=T[ca[1]],u.array[y+5]=T[ca[2]],u.array[y+6]=U[ca[0]],u.array[y+7]=U[ca[1]],u.array[y+8]=U[ca[2]],u.array[y+9]=ua[ca[0]],u.array[y+10]=ua[ca[1]],u.array[y+11]=
|
|
|
|
-ua[ca[2]],y+=12}else if("faces"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)U=T=S=Ca=u.value[ya[D]],u.array[y]=S[ca[0]],u.array[y+1]=S[ca[1]],u.array[y+2]=S[ca[2]],u.array[y+3]=T[ca[0]],u.array[y+4]=T[ca[1]],u.array[y+5]=T[ca[2]],u.array[y+6]=U[ca[0]],u.array[y+7]=U[ca[1]],u.array[y+8]=U[ca[2]],y+=9;D=0;for(Y=za.length;D<Y;D++)ua=U=T=S=Ca=u.value[za[D]],u.array[y]=S[ca[0]],u.array[y+1]=S[ca[1]],u.array[y+2]=S[ca[2]],u.array[y+3]=T[ca[0]],u.array[y+4]=T[ca[1]],u.array[y+5]=T[ca[2]],u.array[y+6]=U[ca[0]],
|
|
|
|
-u.array[y+7]=U[ca[1]],u.array[y+8]=U[ca[2]],u.array[y+9]=ua[ca[0]],u.array[y+10]=ua[ca[1]],u.array[y+11]=ua[ca[2]],y+=12}else if("faceVertices"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)Ca=u.value[ya[D]],S=Ca[0],T=Ca[1],U=Ca[2],u.array[y]=S[ca[0]],u.array[y+1]=S[ca[1]],u.array[y+2]=S[ca[2]],u.array[y+3]=T[ca[0]],u.array[y+4]=T[ca[1]],u.array[y+5]=T[ca[2]],u.array[y+6]=U[ca[0]],u.array[y+7]=U[ca[1]],u.array[y+8]=U[ca[2]],y+=9;D=0;for(Y=za.length;D<Y;D++)Ca=u.value[za[D]],S=Ca[0],T=Ca[1],U=Ca[2],ua=
|
|
|
|
-Ca[3],u.array[y]=S[ca[0]],u.array[y+1]=S[ca[1]],u.array[y+2]=S[ca[2]],u.array[y+3]=T[ca[0]],u.array[y+4]=T[ca[1]],u.array[y+5]=T[ca[2]],u.array[y+6]=U[ca[0]],u.array[y+7]=U[ca[1]],u.array[y+8]=U[ca[2]],u.array[y+9]=ua[ca[0]],u.array[y+10]=ua[ca[1]],u.array[y+11]=ua[ca[2]],y+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)N=nb[ya[D]],S=u.value[N.a],T=u.value[N.b],U=u.value[N.c],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=S.z,u.array[y+3]=S.w,u.array[y+
|
|
|
|
-4]=T.x,u.array[y+5]=T.y,u.array[y+6]=T.z,u.array[y+7]=T.w,u.array[y+8]=U.x,u.array[y+9]=U.y,u.array[y+10]=U.z,u.array[y+11]=U.w,y+=12;D=0;for(Y=za.length;D<Y;D++)N=nb[za[D]],S=u.value[N.a],T=u.value[N.b],U=u.value[N.c],ua=u.value[N.d],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=S.z,u.array[y+3]=S.w,u.array[y+4]=T.x,u.array[y+5]=T.y,u.array[y+6]=T.z,u.array[y+7]=T.w,u.array[y+8]=U.x,u.array[y+9]=U.y,u.array[y+10]=U.z,u.array[y+11]=U.w,u.array[y+12]=ua.x,u.array[y+13]=ua.y,u.array[y+14]=ua.z,u.array[y+
|
|
|
|
-15]=ua.w,y+=16}else if("faces"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)U=T=S=Ca=u.value[ya[D]],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=S.z,u.array[y+3]=S.w,u.array[y+4]=T.x,u.array[y+5]=T.y,u.array[y+6]=T.z,u.array[y+7]=T.w,u.array[y+8]=U.x,u.array[y+9]=U.y,u.array[y+10]=U.z,u.array[y+11]=U.w,y+=12;D=0;for(Y=za.length;D<Y;D++)ua=U=T=S=Ca=u.value[za[D]],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=S.z,u.array[y+3]=S.w,u.array[y+4]=T.x,u.array[y+5]=T.y,u.array[y+6]=T.z,u.array[y+7]=T.w,u.array[y+
|
|
|
|
-8]=U.x,u.array[y+9]=U.y,u.array[y+10]=U.z,u.array[y+11]=U.w,u.array[y+12]=ua.x,u.array[y+13]=ua.y,u.array[y+14]=ua.z,u.array[y+15]=ua.w,y+=16}else if("faceVertices"===u.boundTo){D=0;for(Y=ya.length;D<Y;D++)Ca=u.value[ya[D]],S=Ca[0],T=Ca[1],U=Ca[2],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=S.z,u.array[y+3]=S.w,u.array[y+4]=T.x,u.array[y+5]=T.y,u.array[y+6]=T.z,u.array[y+7]=T.w,u.array[y+8]=U.x,u.array[y+9]=U.y,u.array[y+10]=U.z,u.array[y+11]=U.w,y+=12;D=0;for(Y=za.length;D<Y;D++)Ca=u.value[za[D]],
|
|
|
|
-S=Ca[0],T=Ca[1],U=Ca[2],ua=Ca[3],u.array[y]=S.x,u.array[y+1]=S.y,u.array[y+2]=S.z,u.array[y+3]=S.w,u.array[y+4]=T.x,u.array[y+5]=T.y,u.array[y+6]=T.z,u.array[y+7]=T.w,u.array[y+8]=U.x,u.array[y+9]=U.y,u.array[y+10]=U.z,u.array[y+11]=U.w,u.array[y+12]=ua.x,u.array[y+13]=ua.y,u.array[y+14]=ua.z,u.array[y+15]=ua.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,sa)}}$a&&(delete xa.__inittedArrays,delete xa.__colorArray,delete xa.__normalArray,delete xa.__tangentArray,
|
|
|
|
-delete xa.__uvArray,delete xa.__uv2Array,delete xa.__faceArray,delete xa.__vertexArray,delete xa.__lineArray,delete xa.__skinIndexArray,delete xa.__skinWeightArray)}}V.verticesNeedUpdate=!1;V.morphTargetsNeedUpdate=!1;V.elementsNeedUpdate=!1;V.uvsNeedUpdate=!1;V.normalsNeedUpdate=!1;V.colorsNeedUpdate=!1;V.tangentsNeedUpdate=!1;V.buffersNeedUpdate=!1;na.attributes&&x(na)}else if(la instanceof THREE.Ribbon){na=e(la,V);ra=na.attributes&&v(na);if(V.verticesNeedUpdate||V.colorsNeedUpdate||V.normalsNeedUpdate||
|
|
|
|
-ra){var Ib=V,Nc=j.DYNAMIC_DRAW,Cc=void 0,Dc=void 0,Ec=void 0,Oc=void 0,Da=void 0,Pc=void 0,Qc=void 0,Rc=void 0,md=void 0,kb=void 0,wc=void 0,Ja=void 0,vb=void 0,nd=Ib.vertices,od=Ib.colors,pd=Ib.normals,dd=nd.length,yd=od.length,zd=pd.length,Sc=Ib.__vertexArray,Tc=Ib.__colorArray,Uc=Ib.__normalArray,Ad=Ib.colorsNeedUpdate,Bd=Ib.normalsNeedUpdate,hd=Ib.__webglCustomAttributesList;if(Ib.verticesNeedUpdate){for(Cc=0;Cc<dd;Cc++)Oc=nd[Cc],Da=3*Cc,Sc[Da]=Oc.x,Sc[Da+1]=Oc.y,Sc[Da+2]=Oc.z;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
-Ib.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Sc,Nc)}if(Ad){for(Dc=0;Dc<yd;Dc++)Pc=od[Dc],Da=3*Dc,Tc[Da]=Pc.r,Tc[Da+1]=Pc.g,Tc[Da+2]=Pc.b;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Tc,Nc)}if(Bd){for(Ec=0;Ec<zd;Ec++)Qc=pd[Ec],Da=3*Ec,Uc[Da]=Qc.x,Uc[Da+1]=Qc.y,Uc[Da+2]=Qc.z;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Uc,Nc)}if(hd){Rc=0;for(md=hd.length;Rc<md;Rc++)if(Ja=hd[Rc],Ja.needsUpdate&&(void 0===Ja.boundTo||"vertices"===
|
|
|
|
-Ja.boundTo)){Da=0;wc=Ja.value.length;if(1===Ja.size)for(kb=0;kb<wc;kb++)Ja.array[kb]=Ja.value[kb];else if(2===Ja.size)for(kb=0;kb<wc;kb++)vb=Ja.value[kb],Ja.array[Da]=vb.x,Ja.array[Da+1]=vb.y,Da+=2;else if(3===Ja.size)if("c"===Ja.type)for(kb=0;kb<wc;kb++)vb=Ja.value[kb],Ja.array[Da]=vb.r,Ja.array[Da+1]=vb.g,Ja.array[Da+2]=vb.b,Da+=3;else for(kb=0;kb<wc;kb++)vb=Ja.value[kb],Ja.array[Da]=vb.x,Ja.array[Da+1]=vb.y,Ja.array[Da+2]=vb.z,Da+=3;else if(4===Ja.size)for(kb=0;kb<wc;kb++)vb=Ja.value[kb],Ja.array[Da]=
|
|
|
|
-vb.x,Ja.array[Da+1]=vb.y,Ja.array[Da+2]=vb.z,Ja.array[Da+3]=vb.w,Da+=4;j.bindBuffer(j.ARRAY_BUFFER,Ja.buffer);j.bufferData(j.ARRAY_BUFFER,Ja.array,Nc)}}}V.verticesNeedUpdate=!1;V.colorsNeedUpdate=!1;V.normalsNeedUpdate=!1;na.attributes&&x(na)}else if(la instanceof THREE.Line){na=e(la,V);ra=na.attributes&&v(na);if(V.verticesNeedUpdate||V.colorsNeedUpdate||V.lineDistancesNeedUpdate||ra){var Jb=V,Vc=j.DYNAMIC_DRAW,Fc=void 0,Gc=void 0,Hc=void 0,Wc=void 0,Pa=void 0,Xc=void 0,qd=Jb.vertices,rd=Jb.colors,
|
|
|
|
-sd=Jb.lineDistances,Cd=qd.length,Dd=rd.length,Ed=sd.length,Yc=Jb.__vertexArray,Zc=Jb.__colorArray,td=Jb.__lineDistanceArray,Fd=Jb.colorsNeedUpdate,Gd=Jb.lineDistancesNeedUpdate,id=Jb.__webglCustomAttributesList,$c=void 0,ud=void 0,lb=void 0,xc=void 0,wb=void 0,Ka=void 0;if(Jb.verticesNeedUpdate){for(Fc=0;Fc<Cd;Fc++)Wc=qd[Fc],Pa=3*Fc,Yc[Pa]=Wc.x,Yc[Pa+1]=Wc.y,Yc[Pa+2]=Wc.z;j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Yc,Vc)}if(Fd){for(Gc=0;Gc<Dd;Gc++)Xc=rd[Gc],Pa=
|
|
|
|
-3*Gc,Zc[Pa]=Xc.r,Zc[Pa+1]=Xc.g,Zc[Pa+2]=Xc.b;j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Zc,Vc)}if(Gd){for(Hc=0;Hc<Ed;Hc++)td[Hc]=sd[Hc];j.bindBuffer(j.ARRAY_BUFFER,Jb.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,td,Vc)}if(id){$c=0;for(ud=id.length;$c<ud;$c++)if(Ka=id[$c],Ka.needsUpdate&&(void 0===Ka.boundTo||"vertices"===Ka.boundTo)){Pa=0;xc=Ka.value.length;if(1===Ka.size)for(lb=0;lb<xc;lb++)Ka.array[lb]=Ka.value[lb];else if(2===Ka.size)for(lb=0;lb<xc;lb++)wb=
|
|
|
|
-Ka.value[lb],Ka.array[Pa]=wb.x,Ka.array[Pa+1]=wb.y,Pa+=2;else if(3===Ka.size)if("c"===Ka.type)for(lb=0;lb<xc;lb++)wb=Ka.value[lb],Ka.array[Pa]=wb.r,Ka.array[Pa+1]=wb.g,Ka.array[Pa+2]=wb.b,Pa+=3;else for(lb=0;lb<xc;lb++)wb=Ka.value[lb],Ka.array[Pa]=wb.x,Ka.array[Pa+1]=wb.y,Ka.array[Pa+2]=wb.z,Pa+=3;else if(4===Ka.size)for(lb=0;lb<xc;lb++)wb=Ka.value[lb],Ka.array[Pa]=wb.x,Ka.array[Pa+1]=wb.y,Ka.array[Pa+2]=wb.z,Ka.array[Pa+3]=wb.w,Pa+=4;j.bindBuffer(j.ARRAY_BUFFER,Ka.buffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
-Ka.array,Vc)}}}V.verticesNeedUpdate=!1;V.colorsNeedUpdate=!1;V.lineDistancesNeedUpdate=!1;na.attributes&&x(na)}else if(la instanceof THREE.ParticleSystem)if(V instanceof THREE.BufferGeometry)(V.verticesNeedUpdate||V.colorsNeedUpdate)&&i(V,j.DYNAMIC_DRAW,!V.dynamic),V.verticesNeedUpdate=!1,V.colorsNeedUpdate=!1;else{na=e(la,V);ra=na.attributes&&v(na);if(V.verticesNeedUpdate||V.colorsNeedUpdate||la.sortParticles||ra){var ac=V,jd=j.DYNAMIC_DRAW,Ic=la,xb=void 0,bc=void 0,cc=void 0,ia=void 0,dc=void 0,
|
|
|
|
-oc=void 0,ad=ac.vertices,kd=ad.length,ld=ac.colors,vd=ld.length,tc=ac.__vertexArray,uc=ac.__colorArray,hc=ac.__sortArray,wd=ac.verticesNeedUpdate,xd=ac.colorsNeedUpdate,ic=ac.__webglCustomAttributesList,Lb=void 0,yc=void 0,ta=void 0,Mb=void 0,Ga=void 0,ha=void 0;if(Ic.sortParticles){sb.copy(jc);sb.multiplySelf(Ic.matrixWorld);for(xb=0;xb<kd;xb++)cc=ad[xb],Kb.copy(cc),Kb.applyMatrix4(sb),hc[xb]=[Kb.z,xb];hc.sort(l);for(xb=0;xb<kd;xb++)cc=ad[hc[xb][1]],ia=3*xb,tc[ia]=cc.x,tc[ia+1]=cc.y,tc[ia+2]=cc.z;
|
|
|
|
-for(bc=0;bc<vd;bc++)ia=3*bc,oc=ld[hc[bc][1]],uc[ia]=oc.r,uc[ia+1]=oc.g,uc[ia+2]=oc.b;if(ic){Lb=0;for(yc=ic.length;Lb<yc;Lb++)if(ha=ic[Lb],void 0===ha.boundTo||"vertices"===ha.boundTo)if(ia=0,Mb=ha.value.length,1===ha.size)for(ta=0;ta<Mb;ta++)dc=hc[ta][1],ha.array[ta]=ha.value[dc];else if(2===ha.size)for(ta=0;ta<Mb;ta++)dc=hc[ta][1],Ga=ha.value[dc],ha.array[ia]=Ga.x,ha.array[ia+1]=Ga.y,ia+=2;else if(3===ha.size)if("c"===ha.type)for(ta=0;ta<Mb;ta++)dc=hc[ta][1],Ga=ha.value[dc],ha.array[ia]=Ga.r,ha.array[ia+
|
|
|
|
-1]=Ga.g,ha.array[ia+2]=Ga.b,ia+=3;else for(ta=0;ta<Mb;ta++)dc=hc[ta][1],Ga=ha.value[dc],ha.array[ia]=Ga.x,ha.array[ia+1]=Ga.y,ha.array[ia+2]=Ga.z,ia+=3;else if(4===ha.size)for(ta=0;ta<Mb;ta++)dc=hc[ta][1],Ga=ha.value[dc],ha.array[ia]=Ga.x,ha.array[ia+1]=Ga.y,ha.array[ia+2]=Ga.z,ha.array[ia+3]=Ga.w,ia+=4}}else{if(wd)for(xb=0;xb<kd;xb++)cc=ad[xb],ia=3*xb,tc[ia]=cc.x,tc[ia+1]=cc.y,tc[ia+2]=cc.z;if(xd)for(bc=0;bc<vd;bc++)oc=ld[bc],ia=3*bc,uc[ia]=oc.r,uc[ia+1]=oc.g,uc[ia+2]=oc.b;if(ic){Lb=0;for(yc=ic.length;Lb<
|
|
|
|
-yc;Lb++)if(ha=ic[Lb],ha.needsUpdate&&(void 0===ha.boundTo||"vertices"===ha.boundTo))if(Mb=ha.value.length,ia=0,1===ha.size)for(ta=0;ta<Mb;ta++)ha.array[ta]=ha.value[ta];else if(2===ha.size)for(ta=0;ta<Mb;ta++)Ga=ha.value[ta],ha.array[ia]=Ga.x,ha.array[ia+1]=Ga.y,ia+=2;else if(3===ha.size)if("c"===ha.type)for(ta=0;ta<Mb;ta++)Ga=ha.value[ta],ha.array[ia]=Ga.r,ha.array[ia+1]=Ga.g,ha.array[ia+2]=Ga.b,ia+=3;else for(ta=0;ta<Mb;ta++)Ga=ha.value[ta],ha.array[ia]=Ga.x,ha.array[ia+1]=Ga.y,ha.array[ia+2]=Ga.z,
|
|
|
|
-ia+=3;else if(4===ha.size)for(ta=0;ta<Mb;ta++)Ga=ha.value[ta],ha.array[ia]=Ga.x,ha.array[ia+1]=Ga.y,ha.array[ia+2]=Ga.z,ha.array[ia+3]=Ga.w,ia+=4}}if(wd||Ic.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ac.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,tc,jd);if(xd||Ic.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ac.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,uc,jd);if(ic){Lb=0;for(yc=ic.length;Lb<yc;Lb++)if(ha=ic[Lb],ha.needsUpdate||Ic.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ha.buffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
-ha.array,jd)}}V.verticesNeedUpdate=!1;V.colorsNeedUpdate=!1;na.attributes&&x(na)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",Ya);var i,k,l,n,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?
|
|
|
|
|
|
+numMorphNormals:I})),C instanceof THREE.Face3?s.geometryGroups[F].faces3.push(z):s.geometryGroups[F].faces4.push(z),s.geometryGroups[F].vertices+=E;s.geometryGroupsList=[];var L=void 0;for(L in s.geometryGroups)s.geometryGroups[L].id=pa++,s.geometryGroupsList.push(s.geometryGroups[L])}for(m in n.geometryGroups)if(q=n.geometryGroups[m],!q.__webglVertexBuffer){var K=q;K.__webglVertexBuffer=j.createBuffer();K.__webglNormalBuffer=j.createBuffer();K.__webglTangentBuffer=j.createBuffer();K.__webglColorBuffer=
|
|
|
|
+j.createBuffer();K.__webglUVBuffer=j.createBuffer();K.__webglUV2Buffer=j.createBuffer();K.__webglSkinIndicesBuffer=j.createBuffer();K.__webglSkinWeightsBuffer=j.createBuffer();K.__webglFaceBuffer=j.createBuffer();K.__webglLineBuffer=j.createBuffer();var M=void 0,ia=void 0;if(K.numMorphTargets){K.__webglMorphTargetsBuffers=[];M=0;for(ia=K.numMorphTargets;M<ia;M++)K.__webglMorphTargetsBuffers.push(j.createBuffer())}if(K.numMorphNormals){K.__webglMorphNormalsBuffers=[];M=0;for(ia=K.numMorphNormals;M<
|
|
|
|
+ia;M++)K.__webglMorphNormalsBuffers.push(j.createBuffer())}O.info.memory.geometries++;d(q,b);n.verticesNeedUpdate=!0;n.morphTargetsNeedUpdate=!0;n.elementsNeedUpdate=!0;n.uvsNeedUpdate=!0;n.normalsNeedUpdate=!0;n.tangentsNeedUpdate=!0;n.colorsNeedUpdate=!0}}else n instanceof THREE.BufferGeometry&&h(n);else if(b instanceof THREE.Ribbon){if(n=b.geometry,!n.__webglVertexBuffer){var T=n;T.__webglVertexBuffer=j.createBuffer();T.__webglColorBuffer=j.createBuffer();T.__webglNormalBuffer=j.createBuffer();
|
|
|
|
+O.info.memory.geometries++;var P=n,W=b,V=P.vertices.length;P.__vertexArray=new Float32Array(3*V);P.__colorArray=new Float32Array(3*V);P.__normalArray=new Float32Array(3*V);P.__webglVertexCount=V;c(P,W);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0;n.normalsNeedUpdate=!0}}else if(b instanceof THREE.Line){if(n=b.geometry,!n.__webglVertexBuffer){var Y=n;Y.__webglVertexBuffer=j.createBuffer();Y.__webglColorBuffer=j.createBuffer();Y.__webglLineDistanceBuffer=j.createBuffer();O.info.memory.geometries++;
|
|
|
|
+var Z=n,fa=b,ya=Z.vertices.length;Z.__vertexArray=new Float32Array(3*ya);Z.__colorArray=new Float32Array(3*ya);Z.__lineDistanceArray=new Float32Array(1*ya);Z.__webglLineCount=ya;c(Z,fa);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0;n.lineDistancesNeedUpdate=!0}}else if(b instanceof THREE.ParticleSystem&&(n=b.geometry,!n.__webglVertexBuffer))if(n instanceof THREE.Geometry){var ca=n;ca.__webglVertexBuffer=j.createBuffer();ca.__webglColorBuffer=j.createBuffer();O.info.memory.geometries++;var wa=n,sa=
|
|
|
|
+b,xa=wa.vertices.length;wa.__vertexArray=new Float32Array(3*xa);wa.__colorArray=new Float32Array(3*xa);wa.__sortArray=[];wa.__webglParticleCount=xa;c(wa,sa);n.verticesNeedUpdate=!0;n.colorsNeedUpdate=!0}else n instanceof THREE.BufferGeometry&&h(n);if(!b.__webglActive){if(b instanceof THREE.Mesh)if(n=b.geometry,n instanceof THREE.BufferGeometry)r(k.__webglObjects,n,b);else{if(n instanceof THREE.Geometry)for(m in n.geometryGroups)q=n.geometryGroups[m],r(k.__webglObjects,q,b)}else b instanceof THREE.Ribbon||
|
|
|
|
+b instanceof THREE.Line||b instanceof THREE.ParticleSystem?(n=b.geometry,r(k.__webglObjects,n,b)):b instanceof THREE.ImmediateRenderObject||b.immediateRenderCallback?k.__webglObjectsImmediate.push({object:b,opaque:null,transparent:null}):b instanceof THREE.Sprite?k.__webglSprites.push(b):b instanceof THREE.LensFlare&&k.__webglFlares.push(b);b.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var ga=a.__objectsRemoved[0],ha=a;ga instanceof THREE.Mesh||ga instanceof THREE.ParticleSystem||
|
|
|
|
+ga instanceof THREE.Ribbon||ga instanceof THREE.Line?v(ha.__webglObjects,ga):ga instanceof THREE.Sprite?t(ha.__webglSprites,ga):ga instanceof THREE.LensFlare?t(ha.__webglFlares,ga):(ga instanceof THREE.ImmediateRenderObject||ga.immediateRenderCallback)&&v(ha.__webglObjectsImmediate,ga);ga.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var za=0,ta=a.__webglObjects.length;za<ta;za++){var ja=a.__webglObjects[za].object,U=ja.geometry,oa=void 0,qa=void 0,ea=void 0;if(ja instanceof THREE.Mesh)if(U instanceof
|
|
|
|
+THREE.BufferGeometry)(U.verticesNeedUpdate||U.elementsNeedUpdate||U.uvsNeedUpdate||U.normalsNeedUpdate||U.colorsNeedUpdate||U.tangentsNeedUpdate)&&i(U,j.DYNAMIC_DRAW,!U.dynamic),U.verticesNeedUpdate=!1,U.elementsNeedUpdate=!1,U.uvsNeedUpdate=!1,U.normalsNeedUpdate=!1,U.colorsNeedUpdate=!1,U.tangentsNeedUpdate=!1;else{for(var Oa=0,Ja=U.geometryGroupsList.length;Oa<Ja;Oa++)if(oa=U.geometryGroupsList[Oa],ea=e(ja,oa),U.buffersNeedUpdate&&d(oa,ja),qa=ea.attributes&&w(ea),U.verticesNeedUpdate||U.morphTargetsNeedUpdate||
|
|
|
|
+U.elementsNeedUpdate||U.uvsNeedUpdate||U.normalsNeedUpdate||U.colorsNeedUpdate||U.tangentsNeedUpdate||qa){var ra=oa,Ga=ja,ma=j.DYNAMIC_DRAW,Sa=!U.dynamic,Fa=ea;if(ra.__inittedArrays){var kb=f(Fa),fb=Fa.vertexColors?Fa.vertexColors:!1,pb=g(Fa),hb=kb===THREE.SmoothShading,D=void 0,X=void 0,Ta=void 0,N=void 0,Za=void 0,Va=void 0,Pa=void 0,ob=void 0,Ya=void 0,qb=void 0,rb=void 0,Q=void 0,R=void 0,S=void 0,na=void 0,$a=void 0,ab=void 0,gb=void 0,ub=void 0,Pb=void 0,Qb=void 0,Rb=void 0,zb=void 0,Sb=void 0,
|
|
|
|
+Tb=void 0,Ub=void 0,Ab=void 0,Vb=void 0,Wb=void 0,Xb=void 0,Cb=void 0,Yb=void 0,Zb=void 0,$b=void 0,Db=void 0,Aa=void 0,Mb=void 0,lc=void 0,Eb=void 0,wc=void 0,cb=void 0,kc=void 0,Wa=void 0,Xa=void 0,mc=void 0,fc=void 0,Qa=0,Ua=0,gc=0,hc=0,Fb=0,mb=0,Da=0,tb=0,Ra=0,aa=0,ka=0,y=0,Ba=void 0,db=ra.__vertexArray,Lb=ra.__uvArray,Nb=ra.__uv2Array,Gb=ra.__normalArray,Ka=ra.__tangentArray,eb=ra.__colorArray,La=ra.__skinIndexArray,Ma=ra.__skinWeightArray,rc=ra.__morphTargetsArrays,ed=ra.__morphNormalsArrays,
|
|
|
|
+fd=ra.__webglCustomAttributesList,u=void 0,ac=ra.__faceArray,Bb=ra.__lineArray,vb=Ga.geometry,Ic=vb.elementsNeedUpdate,Ac=vb.uvsNeedUpdate,Jc=vb.normalsNeedUpdate,$c=vb.tangentsNeedUpdate,ad=vb.colorsNeedUpdate,bd=vb.morphTargetsNeedUpdate,sc=vb.vertices,ua=ra.faces3,va=ra.faces4,nb=vb.faces,gd=vb.faceVertexUvs[0],hd=vb.faceVertexUvs[1],tc=vb.skinIndices,nc=vb.skinWeights,oc=vb.morphTargets,Kc=vb.morphNormals;if(vb.verticesNeedUpdate){D=0;for(X=ua.length;D<X;D++)N=nb[ua[D]],Q=sc[N.a],R=sc[N.b],S=
|
|
|
|
+sc[N.c],db[Ua]=Q.x,db[Ua+1]=Q.y,db[Ua+2]=Q.z,db[Ua+3]=R.x,db[Ua+4]=R.y,db[Ua+5]=R.z,db[Ua+6]=S.x,db[Ua+7]=S.y,db[Ua+8]=S.z,Ua+=9;D=0;for(X=va.length;D<X;D++)N=nb[va[D]],Q=sc[N.a],R=sc[N.b],S=sc[N.c],na=sc[N.d],db[Ua]=Q.x,db[Ua+1]=Q.y,db[Ua+2]=Q.z,db[Ua+3]=R.x,db[Ua+4]=R.y,db[Ua+5]=R.z,db[Ua+6]=S.x,db[Ua+7]=S.y,db[Ua+8]=S.z,db[Ua+9]=na.x,db[Ua+10]=na.y,db[Ua+11]=na.z,Ua+=12;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,db,ma)}if(bd){cb=0;for(kc=oc.length;cb<kc;cb++){D=
|
|
|
|
+ka=0;for(X=ua.length;D<X;D++)mc=ua[D],N=nb[mc],Q=oc[cb].vertices[N.a],R=oc[cb].vertices[N.b],S=oc[cb].vertices[N.c],Wa=rc[cb],Wa[ka]=Q.x,Wa[ka+1]=Q.y,Wa[ka+2]=Q.z,Wa[ka+3]=R.x,Wa[ka+4]=R.y,Wa[ka+5]=R.z,Wa[ka+6]=S.x,Wa[ka+7]=S.y,Wa[ka+8]=S.z,Fa.morphNormals&&(hb?(fc=Kc[cb].vertexNormals[mc],Pb=fc.a,Qb=fc.b,Rb=fc.c):Rb=Qb=Pb=Kc[cb].faceNormals[mc],Xa=ed[cb],Xa[ka]=Pb.x,Xa[ka+1]=Pb.y,Xa[ka+2]=Pb.z,Xa[ka+3]=Qb.x,Xa[ka+4]=Qb.y,Xa[ka+5]=Qb.z,Xa[ka+6]=Rb.x,Xa[ka+7]=Rb.y,Xa[ka+8]=Rb.z),ka+=9;D=0;for(X=va.length;D<
|
|
|
|
+X;D++)mc=va[D],N=nb[mc],Q=oc[cb].vertices[N.a],R=oc[cb].vertices[N.b],S=oc[cb].vertices[N.c],na=oc[cb].vertices[N.d],Wa=rc[cb],Wa[ka]=Q.x,Wa[ka+1]=Q.y,Wa[ka+2]=Q.z,Wa[ka+3]=R.x,Wa[ka+4]=R.y,Wa[ka+5]=R.z,Wa[ka+6]=S.x,Wa[ka+7]=S.y,Wa[ka+8]=S.z,Wa[ka+9]=na.x,Wa[ka+10]=na.y,Wa[ka+11]=na.z,Fa.morphNormals&&(hb?(fc=Kc[cb].vertexNormals[mc],Pb=fc.a,Qb=fc.b,Rb=fc.c,zb=fc.d):zb=Rb=Qb=Pb=Kc[cb].faceNormals[mc],Xa=ed[cb],Xa[ka]=Pb.x,Xa[ka+1]=Pb.y,Xa[ka+2]=Pb.z,Xa[ka+3]=Qb.x,Xa[ka+4]=Qb.y,Xa[ka+5]=Qb.z,Xa[ka+
|
|
|
|
+6]=Rb.x,Xa[ka+7]=Rb.y,Xa[ka+8]=Rb.z,Xa[ka+9]=zb.x,Xa[ka+10]=zb.y,Xa[ka+11]=zb.z),ka+=12;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglMorphTargetsBuffers[cb]);j.bufferData(j.ARRAY_BUFFER,rc[cb],ma);Fa.morphNormals&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglMorphNormalsBuffers[cb]),j.bufferData(j.ARRAY_BUFFER,ed[cb],ma))}}if(nc.length){D=0;for(X=ua.length;D<X;D++)N=nb[ua[D]],Vb=nc[N.a],Wb=nc[N.b],Xb=nc[N.c],Ma[aa]=Vb.x,Ma[aa+1]=Vb.y,Ma[aa+2]=Vb.z,Ma[aa+3]=Vb.w,Ma[aa+4]=Wb.x,Ma[aa+5]=Wb.y,Ma[aa+6]=Wb.z,Ma[aa+
|
|
|
|
+7]=Wb.w,Ma[aa+8]=Xb.x,Ma[aa+9]=Xb.y,Ma[aa+10]=Xb.z,Ma[aa+11]=Xb.w,Yb=tc[N.a],Zb=tc[N.b],$b=tc[N.c],La[aa]=Yb.x,La[aa+1]=Yb.y,La[aa+2]=Yb.z,La[aa+3]=Yb.w,La[aa+4]=Zb.x,La[aa+5]=Zb.y,La[aa+6]=Zb.z,La[aa+7]=Zb.w,La[aa+8]=$b.x,La[aa+9]=$b.y,La[aa+10]=$b.z,La[aa+11]=$b.w,aa+=12;D=0;for(X=va.length;D<X;D++)N=nb[va[D]],Vb=nc[N.a],Wb=nc[N.b],Xb=nc[N.c],Cb=nc[N.d],Ma[aa]=Vb.x,Ma[aa+1]=Vb.y,Ma[aa+2]=Vb.z,Ma[aa+3]=Vb.w,Ma[aa+4]=Wb.x,Ma[aa+5]=Wb.y,Ma[aa+6]=Wb.z,Ma[aa+7]=Wb.w,Ma[aa+8]=Xb.x,Ma[aa+9]=Xb.y,Ma[aa+
|
|
|
|
+10]=Xb.z,Ma[aa+11]=Xb.w,Ma[aa+12]=Cb.x,Ma[aa+13]=Cb.y,Ma[aa+14]=Cb.z,Ma[aa+15]=Cb.w,Yb=tc[N.a],Zb=tc[N.b],$b=tc[N.c],Db=tc[N.d],La[aa]=Yb.x,La[aa+1]=Yb.y,La[aa+2]=Yb.z,La[aa+3]=Yb.w,La[aa+4]=Zb.x,La[aa+5]=Zb.y,La[aa+6]=Zb.z,La[aa+7]=Zb.w,La[aa+8]=$b.x,La[aa+9]=$b.y,La[aa+10]=$b.z,La[aa+11]=$b.w,La[aa+12]=Db.x,La[aa+13]=Db.y,La[aa+14]=Db.z,La[aa+15]=Db.w,aa+=16;0<aa&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,La,ma),j.bindBuffer(j.ARRAY_BUFFER,ra.__webglSkinWeightsBuffer),
|
|
|
|
+j.bufferData(j.ARRAY_BUFFER,Ma,ma))}if(ad&&fb){D=0;for(X=ua.length;D<X;D++)N=nb[ua[D]],Pa=N.vertexColors,ob=N.color,3===Pa.length&&fb===THREE.VertexColors?(Sb=Pa[0],Tb=Pa[1],Ub=Pa[2]):Ub=Tb=Sb=ob,eb[Ra]=Sb.r,eb[Ra+1]=Sb.g,eb[Ra+2]=Sb.b,eb[Ra+3]=Tb.r,eb[Ra+4]=Tb.g,eb[Ra+5]=Tb.b,eb[Ra+6]=Ub.r,eb[Ra+7]=Ub.g,eb[Ra+8]=Ub.b,Ra+=9;D=0;for(X=va.length;D<X;D++)N=nb[va[D]],Pa=N.vertexColors,ob=N.color,4===Pa.length&&fb===THREE.VertexColors?(Sb=Pa[0],Tb=Pa[1],Ub=Pa[2],Ab=Pa[3]):Ab=Ub=Tb=Sb=ob,eb[Ra]=Sb.r,eb[Ra+
|
|
|
|
+1]=Sb.g,eb[Ra+2]=Sb.b,eb[Ra+3]=Tb.r,eb[Ra+4]=Tb.g,eb[Ra+5]=Tb.b,eb[Ra+6]=Ub.r,eb[Ra+7]=Ub.g,eb[Ra+8]=Ub.b,eb[Ra+9]=Ab.r,eb[Ra+10]=Ab.g,eb[Ra+11]=Ab.b,Ra+=12;0<Ra&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,eb,ma))}if($c&&vb.hasTangents){D=0;for(X=ua.length;D<X;D++)N=nb[ua[D]],Ya=N.vertexTangents,$a=Ya[0],ab=Ya[1],gb=Ya[2],Ka[Da]=$a.x,Ka[Da+1]=$a.y,Ka[Da+2]=$a.z,Ka[Da+3]=$a.w,Ka[Da+4]=ab.x,Ka[Da+5]=ab.y,Ka[Da+6]=ab.z,Ka[Da+7]=ab.w,Ka[Da+8]=gb.x,Ka[Da+9]=gb.y,Ka[Da+
|
|
|
|
+10]=gb.z,Ka[Da+11]=gb.w,Da+=12;D=0;for(X=va.length;D<X;D++)N=nb[va[D]],Ya=N.vertexTangents,$a=Ya[0],ab=Ya[1],gb=Ya[2],ub=Ya[3],Ka[Da]=$a.x,Ka[Da+1]=$a.y,Ka[Da+2]=$a.z,Ka[Da+3]=$a.w,Ka[Da+4]=ab.x,Ka[Da+5]=ab.y,Ka[Da+6]=ab.z,Ka[Da+7]=ab.w,Ka[Da+8]=gb.x,Ka[Da+9]=gb.y,Ka[Da+10]=gb.z,Ka[Da+11]=gb.w,Ka[Da+12]=ub.x,Ka[Da+13]=ub.y,Ka[Da+14]=ub.z,Ka[Da+15]=ub.w,Da+=16;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,Ka,ma)}if(Jc&&kb){D=0;for(X=ua.length;D<X;D++)if(N=nb[ua[D]],
|
|
|
|
+Za=N.vertexNormals,Va=N.normal,3===Za.length&&hb)for(Aa=0;3>Aa;Aa++)lc=Za[Aa],Gb[mb]=lc.x,Gb[mb+1]=lc.y,Gb[mb+2]=lc.z,mb+=3;else for(Aa=0;3>Aa;Aa++)Gb[mb]=Va.x,Gb[mb+1]=Va.y,Gb[mb+2]=Va.z,mb+=3;D=0;for(X=va.length;D<X;D++)if(N=nb[va[D]],Za=N.vertexNormals,Va=N.normal,4===Za.length&&hb)for(Aa=0;4>Aa;Aa++)lc=Za[Aa],Gb[mb]=lc.x,Gb[mb+1]=lc.y,Gb[mb+2]=lc.z,mb+=3;else for(Aa=0;4>Aa;Aa++)Gb[mb]=Va.x,Gb[mb+1]=Va.y,Gb[mb+2]=Va.z,mb+=3;j.bindBuffer(j.ARRAY_BUFFER,ra.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
+Gb,ma)}if(Ac&&gd&&pb){D=0;for(X=ua.length;D<X;D++)if(Ta=ua[D],qb=gd[Ta],void 0!==qb)for(Aa=0;3>Aa;Aa++)Eb=qb[Aa],Lb[gc]=Eb.x,Lb[gc+1]=Eb.y,gc+=2;D=0;for(X=va.length;D<X;D++)if(Ta=va[D],qb=gd[Ta],void 0!==qb)for(Aa=0;4>Aa;Aa++)Eb=qb[Aa],Lb[gc]=Eb.x,Lb[gc+1]=Eb.y,gc+=2;0<gc&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,Lb,ma))}if(Ac&&hd&&pb){D=0;for(X=ua.length;D<X;D++)if(Ta=ua[D],rb=hd[Ta],void 0!==rb)for(Aa=0;3>Aa;Aa++)wc=rb[Aa],Nb[hc]=wc.x,Nb[hc+1]=wc.y,hc+=2;D=0;
|
|
|
|
+for(X=va.length;D<X;D++)if(Ta=va[D],rb=hd[Ta],void 0!==rb)for(Aa=0;4>Aa;Aa++)wc=rb[Aa],Nb[hc]=wc.x,Nb[hc+1]=wc.y,hc+=2;0<hc&&(j.bindBuffer(j.ARRAY_BUFFER,ra.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,Nb,ma))}if(Ic){D=0;for(X=ua.length;D<X;D++)ac[Fb]=Qa,ac[Fb+1]=Qa+1,ac[Fb+2]=Qa+2,Fb+=3,Bb[tb]=Qa,Bb[tb+1]=Qa+1,Bb[tb+2]=Qa,Bb[tb+3]=Qa+2,Bb[tb+4]=Qa+1,Bb[tb+5]=Qa+2,tb+=6,Qa+=3;D=0;for(X=va.length;D<X;D++)ac[Fb]=Qa,ac[Fb+1]=Qa+1,ac[Fb+2]=Qa+3,ac[Fb+3]=Qa+1,ac[Fb+4]=Qa+2,ac[Fb+5]=Qa+3,Fb+=6,Bb[tb]=
|
|
|
|
+Qa,Bb[tb+1]=Qa+1,Bb[tb+2]=Qa,Bb[tb+3]=Qa+3,Bb[tb+4]=Qa+1,Bb[tb+5]=Qa+2,Bb[tb+6]=Qa+2,Bb[tb+7]=Qa+3,tb+=8,Qa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ra.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ac,ma);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,ra.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,Bb,ma)}if(fd){Aa=0;for(Mb=fd.length;Aa<Mb;Aa++)if(u=fd[Aa],u.__original.needsUpdate){y=0;if(1===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(X=ua.length;D<X;D++)N=nb[ua[D]],u.array[y]=
|
|
|
|
+u.value[N.a],u.array[y+1]=u.value[N.b],u.array[y+2]=u.value[N.c],y+=3;D=0;for(X=va.length;D<X;D++)N=nb[va[D]],u.array[y]=u.value[N.a],u.array[y+1]=u.value[N.b],u.array[y+2]=u.value[N.c],u.array[y+3]=u.value[N.d],y+=4}else{if("faces"===u.boundTo){D=0;for(X=ua.length;D<X;D++)Ba=u.value[ua[D]],u.array[y]=Ba,u.array[y+1]=Ba,u.array[y+2]=Ba,y+=3;D=0;for(X=va.length;D<X;D++)Ba=u.value[va[D]],u.array[y]=Ba,u.array[y+1]=Ba,u.array[y+2]=Ba,u.array[y+3]=Ba,y+=4}}else if(2===u.size)if(void 0===u.boundTo||"vertices"===
|
|
|
|
+u.boundTo){D=0;for(X=ua.length;D<X;D++)N=nb[ua[D]],Q=u.value[N.a],R=u.value[N.b],S=u.value[N.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;D=0;for(X=va.length;D<X;D++)N=nb[va[D]],Q=u.value[N.a],R=u.value[N.b],S=u.value[N.c],na=u.value[N.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=na.x,u.array[y+7]=na.y,y+=8}else{if("faces"===u.boundTo){D=0;for(X=ua.length;D<X;D++)S=
|
|
|
|
+R=Q=Ba=u.value[ua[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,y+=6;D=0;for(X=va.length;D<X;D++)na=S=R=Q=Ba=u.value[va[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=R.x,u.array[y+3]=R.y,u.array[y+4]=S.x,u.array[y+5]=S.y,u.array[y+6]=na.x,u.array[y+7]=na.y,y+=8}}else if(3===u.size){var $;$="c"===u.type?["r","g","b"]:["x","y","z"];if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(X=ua.length;D<X;D++)N=nb[ua[D]],Q=u.value[N.a],R=u.value[N.b],
|
|
|
|
+S=u.value[N.c],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],y+=9;D=0;for(X=va.length;D<X;D++)N=nb[va[D]],Q=u.value[N.a],R=u.value[N.b],S=u.value[N.c],na=u.value[N.d],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+
|
|
|
|
+9]=na[$[0]],u.array[y+10]=na[$[1]],u.array[y+11]=na[$[2]],y+=12}else if("faces"===u.boundTo){D=0;for(X=ua.length;D<X;D++)S=R=Q=Ba=u.value[ua[D]],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],y+=9;D=0;for(X=va.length;D<X;D++)na=S=R=Q=Ba=u.value[va[D]],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+
|
|
|
|
+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+9]=na[$[0]],u.array[y+10]=na[$[1]],u.array[y+11]=na[$[2]],y+=12}else if("faceVertices"===u.boundTo){D=0;for(X=ua.length;D<X;D++)Ba=u.value[ua[D]],Q=Ba[0],R=Ba[1],S=Ba[2],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],y+=9;D=0;for(X=va.length;D<X;D++)Ba=u.value[va[D]],Q=Ba[0],R=
|
|
|
|
+Ba[1],S=Ba[2],na=Ba[3],u.array[y]=Q[$[0]],u.array[y+1]=Q[$[1]],u.array[y+2]=Q[$[2]],u.array[y+3]=R[$[0]],u.array[y+4]=R[$[1]],u.array[y+5]=R[$[2]],u.array[y+6]=S[$[0]],u.array[y+7]=S[$[1]],u.array[y+8]=S[$[2]],u.array[y+9]=na[$[0]],u.array[y+10]=na[$[1]],u.array[y+11]=na[$[2]],y+=12}}else if(4===u.size)if(void 0===u.boundTo||"vertices"===u.boundTo){D=0;for(X=ua.length;D<X;D++)N=nb[ua[D]],Q=u.value[N.a],R=u.value[N.b],S=u.value[N.c],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,
|
|
|
|
+u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(X=va.length;D<X;D++)N=nb[va[D]],Q=u.value[N.a],R=u.value[N.b],S=u.value[N.c],na=u.value[N.d],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=na.x,u.array[y+13]=na.y,u.array[y+14]=
|
|
|
|
+na.z,u.array[y+15]=na.w,y+=16}else if("faces"===u.boundTo){D=0;for(X=ua.length;D<X;D++)S=R=Q=Ba=u.value[ua[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(X=va.length;D<X;D++)na=S=R=Q=Ba=u.value[va[D]],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+
|
|
|
|
+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=na.x,u.array[y+13]=na.y,u.array[y+14]=na.z,u.array[y+15]=na.w,y+=16}else if("faceVertices"===u.boundTo){D=0;for(X=ua.length;D<X;D++)Ba=u.value[ua[D]],Q=Ba[0],R=Ba[1],S=Ba[2],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,y+=12;D=0;for(X=va.length;D<X;D++)Ba=
|
|
|
|
+u.value[va[D]],Q=Ba[0],R=Ba[1],S=Ba[2],na=Ba[3],u.array[y]=Q.x,u.array[y+1]=Q.y,u.array[y+2]=Q.z,u.array[y+3]=Q.w,u.array[y+4]=R.x,u.array[y+5]=R.y,u.array[y+6]=R.z,u.array[y+7]=R.w,u.array[y+8]=S.x,u.array[y+9]=S.y,u.array[y+10]=S.z,u.array[y+11]=S.w,u.array[y+12]=na.x,u.array[y+13]=na.y,u.array[y+14]=na.z,u.array[y+15]=na.w,y+=16}j.bindBuffer(j.ARRAY_BUFFER,u.buffer);j.bufferData(j.ARRAY_BUFFER,u.array,ma)}}Sa&&(delete ra.__inittedArrays,delete ra.__colorArray,delete ra.__normalArray,delete ra.__tangentArray,
|
|
|
|
+delete ra.__uvArray,delete ra.__uv2Array,delete ra.__faceArray,delete ra.__vertexArray,delete ra.__lineArray,delete ra.__skinIndexArray,delete ra.__skinWeightArray)}}U.verticesNeedUpdate=!1;U.morphTargetsNeedUpdate=!1;U.elementsNeedUpdate=!1;U.uvsNeedUpdate=!1;U.normalsNeedUpdate=!1;U.colorsNeedUpdate=!1;U.tangentsNeedUpdate=!1;U.buffersNeedUpdate=!1;ea.attributes&&x(ea)}else if(ja instanceof THREE.Ribbon){ea=e(ja,U);qa=ea.attributes&&w(ea);if(U.verticesNeedUpdate||U.colorsNeedUpdate||U.normalsNeedUpdate||
|
|
|
|
+qa){var Hb=U,Lc=j.DYNAMIC_DRAW,Bc=void 0,Cc=void 0,Dc=void 0,Mc=void 0,Ca=void 0,Nc=void 0,Oc=void 0,Pc=void 0,nd=void 0,ib=void 0,xc=void 0,Ha=void 0,wb=void 0,od=Hb.vertices,pd=Hb.colors,qd=Hb.normals,cd=od.length,zd=pd.length,Ad=qd.length,Qc=Hb.__vertexArray,Rc=Hb.__colorArray,Sc=Hb.__normalArray,Bd=Hb.colorsNeedUpdate,Cd=Hb.normalsNeedUpdate,id=Hb.__webglCustomAttributesList;if(Hb.verticesNeedUpdate){for(Bc=0;Bc<cd;Bc++)Mc=od[Bc],Ca=3*Bc,Qc[Ca]=Mc.x,Qc[Ca+1]=Mc.y,Qc[Ca+2]=Mc.z;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
|
+Hb.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Qc,Lc)}if(Bd){for(Cc=0;Cc<zd;Cc++)Nc=pd[Cc],Ca=3*Cc,Rc[Ca]=Nc.r,Rc[Ca+1]=Nc.g,Rc[Ca+2]=Nc.b;j.bindBuffer(j.ARRAY_BUFFER,Hb.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Rc,Lc)}if(Cd){for(Dc=0;Dc<Ad;Dc++)Oc=qd[Dc],Ca=3*Dc,Sc[Ca]=Oc.x,Sc[Ca+1]=Oc.y,Sc[Ca+2]=Oc.z;j.bindBuffer(j.ARRAY_BUFFER,Hb.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Sc,Lc)}if(id){Pc=0;for(nd=id.length;Pc<nd;Pc++)if(Ha=id[Pc],Ha.needsUpdate&&(void 0===Ha.boundTo||"vertices"===
|
|
|
|
+Ha.boundTo)){Ca=0;xc=Ha.value.length;if(1===Ha.size)for(ib=0;ib<xc;ib++)Ha.array[ib]=Ha.value[ib];else if(2===Ha.size)for(ib=0;ib<xc;ib++)wb=Ha.value[ib],Ha.array[Ca]=wb.x,Ha.array[Ca+1]=wb.y,Ca+=2;else if(3===Ha.size)if("c"===Ha.type)for(ib=0;ib<xc;ib++)wb=Ha.value[ib],Ha.array[Ca]=wb.r,Ha.array[Ca+1]=wb.g,Ha.array[Ca+2]=wb.b,Ca+=3;else for(ib=0;ib<xc;ib++)wb=Ha.value[ib],Ha.array[Ca]=wb.x,Ha.array[Ca+1]=wb.y,Ha.array[Ca+2]=wb.z,Ca+=3;else if(4===Ha.size)for(ib=0;ib<xc;ib++)wb=Ha.value[ib],Ha.array[Ca]=
|
|
|
|
+wb.x,Ha.array[Ca+1]=wb.y,Ha.array[Ca+2]=wb.z,Ha.array[Ca+3]=wb.w,Ca+=4;j.bindBuffer(j.ARRAY_BUFFER,Ha.buffer);j.bufferData(j.ARRAY_BUFFER,Ha.array,Lc)}}}U.verticesNeedUpdate=!1;U.colorsNeedUpdate=!1;U.normalsNeedUpdate=!1;ea.attributes&&x(ea)}else if(ja instanceof THREE.Line){ea=e(ja,U);qa=ea.attributes&&w(ea);if(U.verticesNeedUpdate||U.colorsNeedUpdate||U.lineDistancesNeedUpdate||qa){var Ib=U,Tc=j.DYNAMIC_DRAW,Ec=void 0,Fc=void 0,Gc=void 0,Uc=void 0,Na=void 0,Vc=void 0,rd=Ib.vertices,sd=Ib.colors,
|
|
|
|
+td=Ib.lineDistances,Dd=rd.length,Ed=sd.length,Fd=td.length,Wc=Ib.__vertexArray,Xc=Ib.__colorArray,ud=Ib.__lineDistanceArray,Gd=Ib.colorsNeedUpdate,Hd=Ib.lineDistancesNeedUpdate,jd=Ib.__webglCustomAttributesList,Yc=void 0,vd=void 0,jb=void 0,yc=void 0,xb=void 0,Ia=void 0;if(Ib.verticesNeedUpdate){for(Ec=0;Ec<Dd;Ec++)Uc=rd[Ec],Na=3*Ec,Wc[Na]=Uc.x,Wc[Na+1]=Uc.y,Wc[Na+2]=Uc.z;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Wc,Tc)}if(Gd){for(Fc=0;Fc<Ed;Fc++)Vc=sd[Fc],Na=
|
|
|
|
+3*Fc,Xc[Na]=Vc.r,Xc[Na+1]=Vc.g,Xc[Na+2]=Vc.b;j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,Xc,Tc)}if(Hd){for(Gc=0;Gc<Fd;Gc++)ud[Gc]=td[Gc];j.bindBuffer(j.ARRAY_BUFFER,Ib.__webglLineDistanceBuffer);j.bufferData(j.ARRAY_BUFFER,ud,Tc)}if(jd){Yc=0;for(vd=jd.length;Yc<vd;Yc++)if(Ia=jd[Yc],Ia.needsUpdate&&(void 0===Ia.boundTo||"vertices"===Ia.boundTo)){Na=0;yc=Ia.value.length;if(1===Ia.size)for(jb=0;jb<yc;jb++)Ia.array[jb]=Ia.value[jb];else if(2===Ia.size)for(jb=0;jb<yc;jb++)xb=
|
|
|
|
+Ia.value[jb],Ia.array[Na]=xb.x,Ia.array[Na+1]=xb.y,Na+=2;else if(3===Ia.size)if("c"===Ia.type)for(jb=0;jb<yc;jb++)xb=Ia.value[jb],Ia.array[Na]=xb.r,Ia.array[Na+1]=xb.g,Ia.array[Na+2]=xb.b,Na+=3;else for(jb=0;jb<yc;jb++)xb=Ia.value[jb],Ia.array[Na]=xb.x,Ia.array[Na+1]=xb.y,Ia.array[Na+2]=xb.z,Na+=3;else if(4===Ia.size)for(jb=0;jb<yc;jb++)xb=Ia.value[jb],Ia.array[Na]=xb.x,Ia.array[Na+1]=xb.y,Ia.array[Na+2]=xb.z,Ia.array[Na+3]=xb.w,Na+=4;j.bindBuffer(j.ARRAY_BUFFER,Ia.buffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
+Ia.array,Tc)}}}U.verticesNeedUpdate=!1;U.colorsNeedUpdate=!1;U.lineDistancesNeedUpdate=!1;ea.attributes&&x(ea)}else if(ja instanceof THREE.ParticleSystem)if(U instanceof THREE.BufferGeometry)(U.verticesNeedUpdate||U.colorsNeedUpdate)&&i(U,j.DYNAMIC_DRAW,!U.dynamic),U.verticesNeedUpdate=!1,U.colorsNeedUpdate=!1;else{ea=e(ja,U);qa=ea.attributes&&w(ea);if(U.verticesNeedUpdate||U.colorsNeedUpdate||ja.sortParticles||qa){var bc=U,kd=j.DYNAMIC_DRAW,Hc=ja,yb=void 0,cc=void 0,dc=void 0,da=void 0,ec=void 0,
|
|
|
|
+pc=void 0,Zc=bc.vertices,ld=Zc.length,md=bc.colors,wd=md.length,uc=bc.__vertexArray,vc=bc.__colorArray,ic=bc.__sortArray,xd=bc.verticesNeedUpdate,yd=bc.colorsNeedUpdate,jc=bc.__webglCustomAttributesList,Jb=void 0,zc=void 0,la=void 0,Kb=void 0,Ea=void 0,ba=void 0;if(Hc.sortParticles){qc.copy(Ob);qc.multiplySelf(Hc.matrixWorld);for(yb=0;yb<ld;yb++)dc=Zc[yb],lb.copy(dc),lb.applyMatrix4(qc),ic[yb]=[lb.z,yb];ic.sort(l);for(yb=0;yb<ld;yb++)dc=Zc[ic[yb][1]],da=3*yb,uc[da]=dc.x,uc[da+1]=dc.y,uc[da+2]=dc.z;
|
|
|
|
+for(cc=0;cc<wd;cc++)da=3*cc,pc=md[ic[cc][1]],vc[da]=pc.r,vc[da+1]=pc.g,vc[da+2]=pc.b;if(jc){Jb=0;for(zc=jc.length;Jb<zc;Jb++)if(ba=jc[Jb],void 0===ba.boundTo||"vertices"===ba.boundTo)if(da=0,Kb=ba.value.length,1===ba.size)for(la=0;la<Kb;la++)ec=ic[la][1],ba.array[la]=ba.value[ec];else if(2===ba.size)for(la=0;la<Kb;la++)ec=ic[la][1],Ea=ba.value[ec],ba.array[da]=Ea.x,ba.array[da+1]=Ea.y,da+=2;else if(3===ba.size)if("c"===ba.type)for(la=0;la<Kb;la++)ec=ic[la][1],Ea=ba.value[ec],ba.array[da]=Ea.r,ba.array[da+
|
|
|
|
+1]=Ea.g,ba.array[da+2]=Ea.b,da+=3;else for(la=0;la<Kb;la++)ec=ic[la][1],Ea=ba.value[ec],ba.array[da]=Ea.x,ba.array[da+1]=Ea.y,ba.array[da+2]=Ea.z,da+=3;else if(4===ba.size)for(la=0;la<Kb;la++)ec=ic[la][1],Ea=ba.value[ec],ba.array[da]=Ea.x,ba.array[da+1]=Ea.y,ba.array[da+2]=Ea.z,ba.array[da+3]=Ea.w,da+=4}}else{if(xd)for(yb=0;yb<ld;yb++)dc=Zc[yb],da=3*yb,uc[da]=dc.x,uc[da+1]=dc.y,uc[da+2]=dc.z;if(yd)for(cc=0;cc<wd;cc++)pc=md[cc],da=3*cc,vc[da]=pc.r,vc[da+1]=pc.g,vc[da+2]=pc.b;if(jc){Jb=0;for(zc=jc.length;Jb<
|
|
|
|
+zc;Jb++)if(ba=jc[Jb],ba.needsUpdate&&(void 0===ba.boundTo||"vertices"===ba.boundTo))if(Kb=ba.value.length,da=0,1===ba.size)for(la=0;la<Kb;la++)ba.array[la]=ba.value[la];else if(2===ba.size)for(la=0;la<Kb;la++)Ea=ba.value[la],ba.array[da]=Ea.x,ba.array[da+1]=Ea.y,da+=2;else if(3===ba.size)if("c"===ba.type)for(la=0;la<Kb;la++)Ea=ba.value[la],ba.array[da]=Ea.r,ba.array[da+1]=Ea.g,ba.array[da+2]=Ea.b,da+=3;else for(la=0;la<Kb;la++)Ea=ba.value[la],ba.array[da]=Ea.x,ba.array[da+1]=Ea.y,ba.array[da+2]=Ea.z,
|
|
|
|
+da+=3;else if(4===ba.size)for(la=0;la<Kb;la++)Ea=ba.value[la],ba.array[da]=Ea.x,ba.array[da+1]=Ea.y,ba.array[da+2]=Ea.z,ba.array[da+3]=Ea.w,da+=4}}if(xd||Hc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,uc,kd);if(yd||Hc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,bc.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,vc,kd);if(jc){Jb=0;for(zc=jc.length;Jb<zc;Jb++)if(ba=jc[Jb],ba.needsUpdate||Hc.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,ba.buffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
|
+ba.array,kd)}}U.verticesNeedUpdate=!1;U.colorsNeedUpdate=!1;ea.attributes&&x(ea)}}};this.initMaterial=function(a,b,c,d){var e,f,g,h;a.addEventListener("dispose",hb);var i,k,l,n,m;a instanceof THREE.MeshDepthMaterial?m="depth":a instanceof THREE.MeshNormalMaterial?m="normal":a instanceof THREE.MeshBasicMaterial?m="basic":a instanceof THREE.MeshLambertMaterial?m="lambert":a instanceof THREE.MeshPhongMaterial?m="phong":a instanceof THREE.LineBasicMaterial?m="basic":a instanceof THREE.LineDashedMaterial?
|
|
m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var p=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,s,r;e=g=s=r=p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&s++,q instanceof THREE.SpotLight&&r++,q instanceof THREE.HemisphereLight&&p++);e=g;f=s;g=r;h=p;p=q=0;for(r=b.length;p<r;p++)s=b[p],s.castShadow&&
|
|
m="dashed":a instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var p=THREE.ShaderLib[m];a.uniforms=THREE.UniformsUtils.clone(p.uniforms);a.vertexShader=p.vertexShader;a.fragmentShader=p.fragmentShader}var q,s,r;e=g=s=r=p=0;for(f=b.length;e<f;e++)q=b[e],q.onlyShadow||(q instanceof THREE.DirectionalLight&&g++,q instanceof THREE.PointLight&&s++,q instanceof THREE.SpotLight&&r++,q instanceof THREE.HemisphereLight&&p++);e=g;f=s;g=r;h=p;p=q=0;for(r=b.length;p<r;p++)s=b[p],s.castShadow&&
|
|
-(s instanceof THREE.SpotLight&&q++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&q++);n=q;ob&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{s=a.fragmentShader;r=a.vertexShader;p=a.uniforms;b=a.attributes;q=a.defines;
|
|
|
|
-var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:ob&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,
|
|
|
|
-maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,v,w,d=[];m?d.push(m):(d.push(s),d.push(r));for(v in q)d.push(v),d.push(q[v]);for(t in c)d.push(t),d.push(c[t]);
|
|
|
|
-m=d.join();t=0;for(v=W.length;t<v;t++)if(d=W[t],d.code===m){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");v=[];for(w in q)d=q[w],!1!==d&&(d="#define "+w+" "+d,v.push(d));d=v.join("\n");w=j.createProgram();v=["precision "+M+" float;",d,qc?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?
|
|
|
|
|
|
+(s instanceof THREE.SpotLight&&q++,s instanceof THREE.DirectionalLight&&!s.shadowCascade&&q++);n=q;ab&&d&&d.useVertexTexture?l=1024:(b=j.getParameter(j.MAX_VERTEX_UNIFORM_VECTORS),b=Math.floor((b-20)/4),void 0!==d&&d instanceof THREE.SkinnedMesh&&(b=Math.min(d.bones.length,b),b<d.bones.length&&console.warn("WebGLRenderer: too many bones - "+d.bones.length+", this GPU supports just "+b+" (try OpenGL instead of ANGLE)")),l=b);a:{s=a.fragmentShader;r=a.vertexShader;p=a.uniforms;b=a.attributes;q=a.defines;
|
|
|
|
+var c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,bumpMap:!!a.bumpMap,normalMap:!!a.normalMap,specularMap:!!a.specularMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,fogExp:c instanceof THREE.FogExp2,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,maxBones:l,useVertexTexture:ab&&d&&d.useVertexTexture,boneTextureWidth:d&&d.boneTextureWidth,boneTextureHeight:d&&d.boneTextureHeight,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,
|
|
|
|
+maxDirLights:e,maxPointLights:f,maxSpotLights:g,maxHemiLights:h,maxShadows:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapType:this.shadowMapType,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:a.side===THREE.DoubleSide,flipSided:a.side===THREE.BackSide},t,w,v,d=[];m?d.push(m):(d.push(s),d.push(r));for(w in q)d.push(w),d.push(q[w]);for(t in c)d.push(t),d.push(c[t]);
|
|
|
|
+m=d.join();t=0;for(w=ia.length;t<w;t++)if(d=ia[t],d.code===m){d.usedTimes++;k=d.program;break a}t="SHADOWMAP_TYPE_BASIC";c.shadowMapType===THREE.PCFShadowMap?t="SHADOWMAP_TYPE_PCF":c.shadowMapType===THREE.PCFSoftShadowMap&&(t="SHADOWMAP_TYPE_PCF_SOFT");w=[];for(v in q)d=q[v],!1!==d&&(d="#define "+v+" "+d,w.push(d));d=w.join("\n");v=j.createProgram();w=["precision "+M+" float;",d,gb?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?
|
|
"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?
|
|
"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?
|
|
"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.useVertexTexture?"#define BONE_TEXTURE":"",c.boneTextureWidth?"#define N_BONE_PIXEL_X "+c.boneTextureWidth.toFixed(1):"",c.boneTextureHeight?"#define N_BONE_PIXEL_Y "+c.boneTextureHeight.toFixed(1):"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
t=["precision "+M+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
t=["precision "+M+" float;",c.bumpMap||c.normalMap?"#extension GL_OES_standard_derivatives : enable":"",d,"#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SPOT_LIGHTS "+c.maxSpotLights,"#define MAX_HEMI_LIGHTS "+c.maxHemiLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",
|
|
c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fogExp?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.bumpMap?"#define USE_BUMPMAP":"",c.normalMap?"#define USE_NORMALMAP":"",c.specularMap?"#define USE_SPECULARMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.flipSided?"#define FLIP_SIDED":
|
|
-"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=$("fragment",t+s);v=$("vertex",v+r);j.attachShader(w,v);j.attachShader(w,t);j.linkProgram(w);j.getProgramParameter(w,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(w,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
|
-j.getError()+"]");j.deleteShader(t);j.deleteShader(v);w.uniforms={};w.attributes={};var x;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(x in p)t.push(x);x=t;t=0;for(v=x.length;t<v;t++)p=x[t],w.uniforms[p]=j.getUniformLocation(w,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(x=0;x<c.maxMorphTargets;x++)t.push("morphTarget"+
|
|
|
|
-x);for(x=0;x<c.maxMorphNormals;x++)t.push("morphNormal"+x);for(k in b)t.push(k);k=t;x=0;for(b=k.length;x<b;x++)t=k[x],w.attributes[t]=j.getAttribLocation(w,t);w.id=ja++;W.push({program:w,code:m,usedTimes:1});O.info.memory.programs=W.length;k=w}a.program=k;x=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)w=b+k,0<=x[w]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)w=
|
|
|
|
-b+k,0<=x[w]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;na!==
|
|
|
|
-b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),na=b);wa!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),wa=a)};this.setDepthTest=function(a){db!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),db=a)};this.setDepthWrite=function(a){pb!==a&&(j.depthMask(a),pb=a)};this.setBlending=function(a,b,c,d){a!==qa&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),
|
|
|
|
-j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),qa=a);if(a===THREE.CustomBlending){if(b!==$a&&(j.blendEquation(H(b)),$a=b),c!==rb||d!==La)j.blendFunc(H(c),H(d)),rb=c,La=d}else La=
|
|
|
|
-rb=$a=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Sa),a.__webglTexture=j.createTexture(),O.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=H(a.format),
|
|
|
|
|
|
+"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapEnabled?"#define "+t:"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");t=V("fragment",t+s);w=V("vertex",w+r);j.attachShader(v,w);j.attachShader(v,t);j.linkProgram(v);j.getProgramParameter(v,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(v,j.VALIDATE_STATUS)+", gl error ["+
|
|
|
|
+j.getError()+"]");j.deleteShader(t);j.deleteShader(w);v.uniforms={};v.attributes={};var x;t="viewMatrix modelViewMatrix projectionMatrix normalMatrix modelMatrix cameraPosition morphTargetInfluences".split(" ");c.useVertexTexture?t.push("boneTexture"):t.push("boneGlobalMatrices");for(x in p)t.push(x);x=t;t=0;for(w=x.length;t<w;t++)p=x[t],v.uniforms[p]=j.getUniformLocation(v,p);t="position normal uv uv2 tangent color skinIndex skinWeight lineDistance".split(" ");for(x=0;x<c.maxMorphTargets;x++)t.push("morphTarget"+
|
|
|
|
+x);for(x=0;x<c.maxMorphNormals;x++)t.push("morphNormal"+x);for(k in b)t.push(k);k=t;x=0;for(b=k.length;x<b;x++)t=k[x],v.attributes[t]=j.getAttribLocation(v,t);v.id=wa++;ia.push({program:v,code:m,usedTimes:1});O.info.memory.programs=ia.length;k=v}a.program=k;x=a.program.attributes;if(a.morphTargets){a.numSupportedMorphTargets=0;b="morphTarget";for(k=0;k<this.maxMorphTargets;k++)v=b+k,0<=x[v]&&a.numSupportedMorphTargets++}if(a.morphNormals){a.numSupportedMorphNormals=0;b="morphNormal";for(k=0;k<this.maxMorphNormals;k++)v=
|
|
|
|
+b+k,0<=x[v]&&a.numSupportedMorphNormals++}a.uniformsList=[];for(i in a.uniforms)a.uniformsList.push([a.uniforms[i],i])};this.setFaceCulling=function(a,b){a===THREE.CullFaceNone?j.disable(j.CULL_FACE):(b===THREE.FrontFaceDirectionCW?j.frontFace(j.CW):j.frontFace(j.CCW),a===THREE.CullFaceBack?j.cullFace(j.BACK):a===THREE.CullFaceFront?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE))};this.setMaterialFaces=function(a){var b=a.side===THREE.DoubleSide,a=a.side===THREE.BackSide;Oa!==
|
|
|
|
+b&&(b?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Oa=b);ja!==a&&(a?j.frontFace(j.CW):j.frontFace(j.CCW),ja=a)};this.setDepthTest=function(a){Ya!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Ya=a)};this.setDepthWrite=function(a){qb!==a&&(j.depthMask(a),qb=a)};this.setBlending=function(a,b,c,d){a!==ta&&(a===THREE.NoBlending?j.disable(j.BLEND):a===THREE.AdditiveBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.SRC_ALPHA,j.ONE)):a===THREE.SubtractiveBlending?(j.enable(j.BLEND),
|
|
|
|
+j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR)):a===THREE.MultiplyBlending?(j.enable(j.BLEND),j.blendEquation(j.FUNC_ADD),j.blendFunc(j.ZERO,j.SRC_COLOR)):a===THREE.CustomBlending?j.enable(j.BLEND):(j.enable(j.BLEND),j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)),ta=a);if(a===THREE.CustomBlending){if(b!==qa&&(j.blendEquation(H(b)),qa=b),c!==kb||d!==Ja)j.blendFunc(H(c),H(d)),kb=c,Ja=d}else Ja=
|
|
|
|
+kb=qa=null};this.setTexture=function(a,b){if(a.needsUpdate){a.__webglInit||(a.__webglInit=!0,a.addEventListener("dispose",Va),a.__webglTexture=j.createTexture(),O.info.memory.textures++);j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);j.pixelStorei(j.UNPACK_FLIP_Y_WEBGL,a.flipY);j.pixelStorei(j.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha);j.pixelStorei(j.UNPACK_ALIGNMENT,a.unpackAlignment);var c=a.image,d=0===(c.width&c.width-1)&&0===(c.height&c.height-1),e=H(a.format),
|
|
f=H(a.type);B(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,
|
|
f=H(a.type);B(j.TEXTURE_2D,a,d);var g=a.mipmaps;if(a instanceof THREE.DataTexture)if(0<g.length&&d){for(var h=0,i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,e,f,c.data);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,c.width,c.height,0,e,f,c.data);else if(a instanceof THREE.CompressedTexture){h=0;for(i=g.length;h<i;h++)c=g[h],j.compressedTexImage2D(j.TEXTURE_2D,h,e,c.width,c.height,0,c.data)}else if(0<g.length&&d){h=0;for(i=g.length;h<i;h++)c=g[h],j.texImage2D(j.TEXTURE_2D,
|
|
-h,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",ab);a.__webglTexture=
|
|
|
|
|
|
+h,e,e,f,c);a.generateMipmaps=!1}else j.texImage2D(j.TEXTURE_2D,0,e,e,f,a.image);a.generateMipmaps&&d&&j.generateMipmap(j.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){void 0===a.depthBuffer&&(a.depthBuffer=!0);void 0===a.stencilBuffer&&(a.stencilBuffer=!0);a.addEventListener("dispose",Pa);a.__webglTexture=
|
|
j.createTexture();O.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=H(a.format),e=H(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);B(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
j.createTexture();O.info.memory.textures++;var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=H(a.format),e=H(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);B(j.TEXTURE_CUBE_MAP,a,c);for(var f=0;6>f;f++){a.__webglFramebuffer[f]=j.createFramebuffer();a.__webglRenderbuffer[f]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+f,0,d,a.width,a.height,0,d,e,null);var g=a,h=j.TEXTURE_CUBE_MAP_POSITIVE_X+f;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
-a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);R(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),B(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),
|
|
|
|
-j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):R(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,
|
|
|
|
-null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Qa,a=eb,d=Ua,e=Eb);b!==aa&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),aa=b);jb=c;la=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){THREE.EventDispatcher.call(this);this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);
|
|
|
|
|
|
+a.__webglFramebuffer[f]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,h,g.__webglTexture,0);T(a.__webglRenderbuffer[f],a)}c&&j.generateMipmap(j.TEXTURE_CUBE_MAP)}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=a.shareDepthFrom?a.shareDepthFrom.__webglRenderbuffer:j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),B(j.TEXTURE_2D,a,c),j.texImage2D(j.TEXTURE_2D,0,d,a.width,a.height,0,d,e,null),d=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),
|
|
|
|
+j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,d,a.__webglTexture,0),a.shareDepthFrom?a.depthBuffer&&!a.stencilBuffer?j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):a.depthBuffer&&a.stencilBuffer&&j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a.__webglRenderbuffer):T(a.__webglRenderbuffer,a),c&&j.generateMipmap(j.TEXTURE_2D);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,
|
|
|
|
+null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=Cb,a=Za,d=ma,e=Fa);b!==sa&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),sa=b);kc=c;Lb=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};THREE.WebGLRenderTarget=function(a,b,c){THREE.EventDispatcher.call(this);this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.anisotropy=void 0!==c.anisotropy?c.anisotropy:1;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);
|
|
this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0;this.shareDepthFrom=null};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.anisotropy=this.anisotropy;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;a.generateMipmaps=this.generateMipmaps;a.shareDepthFrom=this.shareDepthFrom;return a};
|
|
THREE.WebGLRenderTarget.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
|
|
THREE.WebGLRenderTarget.prototype.dispose=function(){this.dispatchEvent({type:"dispose"})};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=Object.create(THREE.WebGLRenderTarget.prototype);THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidModel=new THREE.Vector3;this.normalModel=new THREE.Vector3;this.normalModelView=new THREE.Vector3;this.vertexNormalsLength=0;this.vertexNormalsModel=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.vertexNormalsModelView=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];
|
|
-this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;a.getHSV(e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,m=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,l=h.length;n<l;n++){var s=h[n].clone();c&&s.applyMatrix4(c);g.push(s)}n=0;for(l=k.length;n<l;n++){var s=k[n],q,p,r=s.vertexNormals,v=s.vertexColors;s instanceof THREE.Face3?
|
|
|
|
-q=new THREE.Face3(s.a+e,s.b+e,s.c+e):s instanceof THREE.Face4&&(q=new THREE.Face4(s.a+e,s.b+e,s.c+e,s.d+e));q.normal.copy(s.normal);d&&q.normal.applyMatrix3(d).normalize();g=0;for(h=r.length;g<h;g++)p=r[g].clone(),d&&p.applyMatrix3(d).normalize(),q.vertexNormals.push(p);q.color.copy(s.color);g=0;for(h=v.length;g<h;g++)p=v[g],q.vertexColors.push(p.clone());q.materialIndex=s.materialIndex;q.centroid.copy(s.centroid);c&&q.centroid.applyMatrix4(c);i.push(q)}n=0;for(l=f.length;n<l;n++){c=f[n];d=[];g=0;
|
|
|
|
|
|
+this.material=this.color=null;this.uvs=[[]];this.z=null};THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=this.object=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};THREE.ColorUtils={adjustHSV:function(a,b,c,d){var e=THREE.ColorUtils.__hsv;a.getHSV(e);e.h=THREE.Math.clamp(e.h+b,0,1);e.s=THREE.Math.clamp(e.s+c,0,1);e.v=THREE.Math.clamp(e.v+d,0,1);a.setHSV(e.h,e.s,e.v)}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};THREE.GeometryUtils={merge:function(a,b){var c,d,e=a.vertices.length,f=b instanceof THREE.Mesh?b.geometry:b,g=a.vertices,h=f.vertices,i=a.faces,k=f.faces,m=a.faceVertexUvs[0],f=f.faceVertexUvs[0];b instanceof THREE.Mesh&&(b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix3,d.getInverse(c),d.transpose());for(var n=0,l=h.length;n<l;n++){var s=h[n].clone();c&&s.applyMatrix4(c);g.push(s)}n=0;for(l=k.length;n<l;n++){var s=k[n],q,p,r=s.vertexNormals,w=s.vertexColors;s instanceof THREE.Face3?
|
|
|
|
+q=new THREE.Face3(s.a+e,s.b+e,s.c+e):s instanceof THREE.Face4&&(q=new THREE.Face4(s.a+e,s.b+e,s.c+e,s.d+e));q.normal.copy(s.normal);d&&q.normal.applyMatrix3(d).normalize();g=0;for(h=r.length;g<h;g++)p=r[g].clone(),d&&p.applyMatrix3(d).normalize(),q.vertexNormals.push(p);q.color.copy(s.color);g=0;for(h=w.length;g<h;g++)p=w[g],q.vertexColors.push(p.clone());q.materialIndex=s.materialIndex;q.centroid.copy(s.centroid);c&&q.centroid.applyMatrix4(c);i.push(q)}n=0;for(l=f.length;n<l;n++){c=f[n];d=[];g=0;
|
|
for(h=c.length;g<h;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));m.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,g=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||g.push(f);a.faces=g},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);
|
|
for(h=c.length;g<h;g++)d.push(new THREE.Vector2(c[g].x,c[g].y));m.push(d)}},removeMaterials:function(a,b){for(var c={},d=0,e=b.length;d<e;d++)c[b[d]]=!0;for(var f,g=[],d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f.materialIndex in c||g.push(f);a.faces=g},randomPointInTriangle:function(a,b,c){var d,e,f,g=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();e=THREE.GeometryUtils.random();1<d+e&&(d=1-d,e=1-e);f=1-d-e;g.copy(a);g.multiplyScalar(d);h.copy(b);h.multiplyScalar(e);g.addSelf(h);
|
|
h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a],e=b.vertices[a.b],f=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,
|
|
h.copy(c);h.multiplyScalar(f);g.addSelf(h);return g},randomPointInFace:function(a,b,c){var d,e,f;if(a instanceof THREE.Face3)return d=b.vertices[a.a],e=b.vertices[a.b],f=b.vertices[a.c],THREE.GeometryUtils.randomPointInTriangle(d,e,f);if(a instanceof THREE.Face4){d=b.vertices[a.a];e=b.vertices[a.b];f=b.vertices[a.c];var b=b.vertices[a.d],g;c?a._area1&&a._area2?(c=a._area1,g=a._area2):(c=THREE.GeometryUtils.triangleArea(d,e,b),g=THREE.GeometryUtils.triangleArea(e,f,b),a._area1=c,a._area2=g):(c=THREE.GeometryUtils.triangleArea(d,
|
|
e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],m,n,l,s;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?(m=g[d.a],n=g[d.b],l=g[d.c],
|
|
e,b),g=THREE.GeometryUtils.triangleArea(e,f,b));return THREE.GeometryUtils.random()*(c+g)<c?THREE.GeometryUtils.randomPointInTriangle(d,e,b):THREE.GeometryUtils.randomPointInTriangle(e,f,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,e,f=a.faces,g=a.vertices,h=f.length,i=0,k=[],m,n,l,s;for(e=0;e<h;e++)d=f[e],d instanceof THREE.Face3?(m=g[d.a],n=g[d.b],l=g[d.c],
|
|
@@ -502,24 +501,24 @@ return 0.5*d.length()},center:function(a){a.computeBoundingBox();var b=a.boundin
|
|
c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,k=d.c,m=d.d,n=new THREE.Face3,l=new THREE.Face3;n.color.copy(d.color);l.color.copy(d.color);n.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;n.a=e;n.b=i;n.c=m;l.a=i;l.b=k;l.c=m;4===d.vertexColors.length&&(n.vertexColors[0]=d.vertexColors[0].clone(),n.vertexColors[1]=d.vertexColors[1].clone(),n.vertexColors[2]=d.vertexColors[3].clone(),
|
|
c;b++)g[b]=[];b=0;for(c=a.faceVertexUvs.length;b<c;b++)h[b]=[];b=0;for(c=a.faces.length;b<c;b++)if(d=a.faces[b],d instanceof THREE.Face4){e=d.a;var i=d.b,k=d.c,m=d.d,n=new THREE.Face3,l=new THREE.Face3;n.color.copy(d.color);l.color.copy(d.color);n.materialIndex=d.materialIndex;l.materialIndex=d.materialIndex;n.a=e;n.b=i;n.c=m;l.a=i;l.b=k;l.c=m;4===d.vertexColors.length&&(n.vertexColors[0]=d.vertexColors[0].clone(),n.vertexColors[1]=d.vertexColors[1].clone(),n.vertexColors[2]=d.vertexColors[3].clone(),
|
|
l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());f.push(n,l);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(n=a.faceVertexUvs[d][b],i=n[1],k=n[2],m=n[3],n=[n[0].clone(),i.clone(),m.clone()],i=[i.clone(),k.clone(),m.clone()],h[d].push(n,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);
|
|
l.vertexColors[0]=d.vertexColors[1].clone(),l.vertexColors[1]=d.vertexColors[2].clone(),l.vertexColors[2]=d.vertexColors[3].clone());f.push(n,l);d=0;for(e=a.faceVertexUvs.length;d<e;d++)a.faceVertexUvs[d].length&&(n=a.faceVertexUvs[d][b],i=n[1],k=n[2],m=n[3],n=[n[0].clone(),i.clone(),m.clone()],i=[i.clone(),k.clone(),m.clone()],h[d].push(n,i));d=0;for(e=a.faceUvs.length;d<e;d++)a.faceUvs[d].length&&(i=a.faceUvs[d][b],g[d].push(i,i))}else{f.push(d);d=0;for(e=a.faceUvs.length;d<e;d++)g[d].push(a.faceUvs[d][b]);
|
|
d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(k.clone());f.a=
|
|
d=0;for(e=a.faceVertexUvs.length;d<e;d++)h[d].push(a.faceVertexUvs[d][b])}a.faces=f;a.faceUvs=g;a.faceVertexUvs=h;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var e=b.length,f=a.faces[c];if(f instanceof THREE.Face4){var g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],k=a.vertices[f.d];b.push(g.clone());b.push(h.clone());b.push(i.clone());b.push(k.clone());f.a=
|
|
-e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,k,m,n,l,s,q,p,r,v,x,w,t,J=[],E=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)E[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,k=a.vertices[f],m=a.vertices[g],n=a.vertices[h],s=k.distanceTo(m),q=m.distanceTo(n),
|
|
|
|
-l=k.distanceTo(n),s>b||q>b||l>b){i=a.vertices.length;w=e.clone();t=e.clone();s>=q&&s>=l?(k=k.clone(),k.lerpSelf(m,0.5),w.a=f,w.b=i,w.c=h,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),w.vertexNormals[1].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),w.vertexColors[1].copy(f),t.vertexColors[0].copy(f)),e=0):q>=s&&q>=l?(k=m.clone(),k.lerpSelf(n,0.5),w.a=f,w.b=
|
|
|
|
-g,w.c=i,t.a=i,t.b=h,t.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),w.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f),t.vertexNormals[1].copy(e.vertexNormals[2]),t.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),w.vertexColors[2].copy(f),t.vertexColors[0].copy(f),t.vertexColors[1].copy(e.vertexColors[2]),t.vertexColors[2].copy(e.vertexColors[0])),e=1):(k=k.clone(),
|
|
|
|
-k.lerpSelf(n,0.5),w.a=f,w.b=g,w.c=i,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),w.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),w.vertexColors[2].copy(f),t.vertexColors[0].copy(f)),e=2);J.push(w,t);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(k=a.faceVertexUvs[f][c],t=k[0],h=k[1],w=k[2],0===e?
|
|
|
|
-(m=t.clone(),m.lerpSelf(h,0.5),k=[t.clone(),m.clone(),w.clone()],h=[m.clone(),h.clone(),w.clone()]):1===e?(m=h.clone(),m.lerpSelf(w,0.5),k=[t.clone(),h.clone(),m.clone()],h=[m.clone(),w.clone(),t.clone()]):(m=t.clone(),m.lerpSelf(w,0.5),k=[t.clone(),h.clone(),m.clone()],h=[m.clone(),h.clone(),w.clone()]),E[f].push(k,h))}else{J.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)E[f].push(a.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,k=a.vertices[f],m=a.vertices[g],n=a.vertices[h],l=a.vertices[i],
|
|
|
|
-s=k.distanceTo(m),q=m.distanceTo(n),p=n.distanceTo(l),r=k.distanceTo(l),s>b||q>b||p>b||r>b){v=a.vertices.length;x=a.vertices.length+1;w=e.clone();t=e.clone();s>=q&&s>=p&&s>=r||p>=q&&p>=s&&p>=r?(s=k.clone(),s.lerpSelf(m,0.5),m=n.clone(),m.lerpSelf(l,0.5),w.a=f,w.b=v,w.c=x,w.d=i,t.a=v,t.b=g,t.c=h,t.d=x,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),w.vertexNormals[1].copy(f),w.vertexNormals[2].copy(g),
|
|
|
|
-t.vertexNormals[0].copy(f),t.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),w.vertexColors[1].copy(f),w.vertexColors[2].copy(g),t.vertexColors[0].copy(f),t.vertexColors[3].copy(g)),e=0):(s=m.clone(),s.lerpSelf(n,0.5),m=l.clone(),m.lerpSelf(k,0.5),w.a=f,w.b=g,w.c=v,w.d=x,t.a=x,t.b=v,t.c=h,t.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],
|
|
|
|
-0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),w.vertexNormals[2].copy(f),w.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),w.vertexColors[2].copy(f),w.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(f)),e=1);J.push(w,t);a.vertices.push(s,m);f=0;for(g=a.faceVertexUvs.length;f<
|
|
|
|
-g;f++)a.faceVertexUvs[f].length&&(k=a.faceVertexUvs[f][c],t=k[0],h=k[1],w=k[2],k=k[3],0===e?(m=t.clone(),m.lerpSelf(h,0.5),n=w.clone(),n.lerpSelf(k,0.5),t=[t.clone(),m.clone(),n.clone(),k.clone()],h=[m.clone(),h.clone(),w.clone(),n.clone()]):(m=h.clone(),m.lerpSelf(w,0.5),n=k.clone(),n.lerpSelf(t,0.5),t=[t.clone(),h.clone(),m.clone(),n.clone()],h=[n.clone(),m.clone(),w.clone(),k.clone()]),E[f].push(t,h))}else{J.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)E[f].push(a.faceVertexUvs[f][c])}a.faces=
|
|
|
|
-J;a.faceVertexUvs=E},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;THREE.GeometryUtils.__v2=new THREE.Vector3;THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
|
|
|
|
|
|
+e;f.b=e+1;f.c=e+2;f.d=e+3}else g=f.a,h=f.b,i=f.c,g=a.vertices[g],h=a.vertices[h],i=a.vertices[i],b.push(g.clone()),b.push(h.clone()),b.push(i.clone()),f.a=e,f.b=e+1,f.c=e+2}a.vertices=b;delete a.__tmpVertices},tessellate:function(a,b){var c,d,e,f,g,h,i,k,m,n,l,s,q,p,r,w,x,v,t,I=[],E=[];c=0;for(d=a.faceVertexUvs.length;c<d;c++)E[c]=[];c=0;for(d=a.faces.length;c<d;c++)if(e=a.faces[c],e instanceof THREE.Face3)if(f=e.a,g=e.b,h=e.c,k=a.vertices[f],m=a.vertices[g],n=a.vertices[h],s=k.distanceTo(m),q=m.distanceTo(n),
|
|
|
|
+l=k.distanceTo(n),s>b||q>b||l>b){i=a.vertices.length;v=e.clone();t=e.clone();s>=q&&s>=l?(k=k.clone(),k.lerpSelf(m,0.5),v.a=f,v.b=i,v.c=h,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),v.vertexNormals[1].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),v.vertexColors[1].copy(f),t.vertexColors[0].copy(f)),e=0):q>=s&&q>=l?(k=m.clone(),k.lerpSelf(n,0.5),v.a=f,v.b=
|
|
|
|
+g,v.c=i,t.a=i,t.b=h,t.c=f,3===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f),t.vertexNormals[1].copy(e.vertexNormals[2]),t.vertexNormals[2].copy(e.vertexNormals[0])),3===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),t.vertexColors[0].copy(f),t.vertexColors[1].copy(e.vertexColors[2]),t.vertexColors[2].copy(e.vertexColors[0])),e=1):(k=k.clone(),
|
|
|
|
+k.lerpSelf(n,0.5),v.a=f,v.b=g,v.c=i,t.a=i,t.b=g,t.c=h,3===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[2],0.5),v.vertexNormals[2].copy(f),t.vertexNormals[0].copy(f)),3===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[2],0.5),v.vertexColors[2].copy(f),t.vertexColors[0].copy(f)),e=2);I.push(v,t);a.vertices.push(k);f=0;for(g=a.faceVertexUvs.length;f<g;f++)a.faceVertexUvs[f].length&&(k=a.faceVertexUvs[f][c],t=k[0],h=k[1],v=k[2],0===e?
|
|
|
|
+(m=t.clone(),m.lerpSelf(h,0.5),k=[t.clone(),m.clone(),v.clone()],h=[m.clone(),h.clone(),v.clone()]):1===e?(m=h.clone(),m.lerpSelf(v,0.5),k=[t.clone(),h.clone(),m.clone()],h=[m.clone(),v.clone(),t.clone()]):(m=t.clone(),m.lerpSelf(v,0.5),k=[t.clone(),h.clone(),m.clone()],h=[m.clone(),h.clone(),v.clone()]),E[f].push(k,h))}else{I.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)E[f].push(a.faceVertexUvs[f][c])}else if(f=e.a,g=e.b,h=e.c,i=e.d,k=a.vertices[f],m=a.vertices[g],n=a.vertices[h],l=a.vertices[i],
|
|
|
|
+s=k.distanceTo(m),q=m.distanceTo(n),p=n.distanceTo(l),r=k.distanceTo(l),s>b||q>b||p>b||r>b){w=a.vertices.length;x=a.vertices.length+1;v=e.clone();t=e.clone();s>=q&&s>=p&&s>=r||p>=q&&p>=s&&p>=r?(s=k.clone(),s.lerpSelf(m,0.5),m=n.clone(),m.lerpSelf(l,0.5),v.a=f,v.b=w,v.c=x,v.d=i,t.a=w,t.b=g,t.c=h,t.d=x,4===e.vertexNormals.length&&(f=e.vertexNormals[0].clone(),f.lerpSelf(e.vertexNormals[1],0.5),g=e.vertexNormals[2].clone(),g.lerpSelf(e.vertexNormals[3],0.5),v.vertexNormals[1].copy(f),v.vertexNormals[2].copy(g),
|
|
|
|
+t.vertexNormals[0].copy(f),t.vertexNormals[3].copy(g)),4===e.vertexColors.length&&(f=e.vertexColors[0].clone(),f.lerpSelf(e.vertexColors[1],0.5),g=e.vertexColors[2].clone(),g.lerpSelf(e.vertexColors[3],0.5),v.vertexColors[1].copy(f),v.vertexColors[2].copy(g),t.vertexColors[0].copy(f),t.vertexColors[3].copy(g)),e=0):(s=m.clone(),s.lerpSelf(n,0.5),m=l.clone(),m.lerpSelf(k,0.5),v.a=f,v.b=g,v.c=w,v.d=x,t.a=x,t.b=w,t.c=h,t.d=i,4===e.vertexNormals.length&&(f=e.vertexNormals[1].clone(),f.lerpSelf(e.vertexNormals[2],
|
|
|
|
+0.5),g=e.vertexNormals[3].clone(),g.lerpSelf(e.vertexNormals[0],0.5),v.vertexNormals[2].copy(f),v.vertexNormals[3].copy(g),t.vertexNormals[0].copy(g),t.vertexNormals[1].copy(f)),4===e.vertexColors.length&&(f=e.vertexColors[1].clone(),f.lerpSelf(e.vertexColors[2],0.5),g=e.vertexColors[3].clone(),g.lerpSelf(e.vertexColors[0],0.5),v.vertexColors[2].copy(f),v.vertexColors[3].copy(g),t.vertexColors[0].copy(g),t.vertexColors[1].copy(f)),e=1);I.push(v,t);a.vertices.push(s,m);f=0;for(g=a.faceVertexUvs.length;f<
|
|
|
|
+g;f++)a.faceVertexUvs[f].length&&(k=a.faceVertexUvs[f][c],t=k[0],h=k[1],v=k[2],k=k[3],0===e?(m=t.clone(),m.lerpSelf(h,0.5),n=v.clone(),n.lerpSelf(k,0.5),t=[t.clone(),m.clone(),n.clone(),k.clone()],h=[m.clone(),h.clone(),v.clone(),n.clone()]):(m=h.clone(),m.lerpSelf(v,0.5),n=k.clone(),n.lerpSelf(t,0.5),t=[t.clone(),h.clone(),m.clone(),n.clone()],h=[n.clone(),m.clone(),v.clone(),k.clone()]),E[f].push(t,h))}else{I.push(e);f=0;for(g=a.faceVertexUvs.length;f<g;f++)E[f].push(a.faceVertexUvs[f][c])}a.faces=
|
|
|
|
+I;a.faceVertexUvs=E},setMaterialIndex:function(a,b,c,d){a=a.faces;d=d||a.length-1;for(c=c||0;c<=d;c++)a[c].materialIndex=b}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;THREE.GeometryUtils.__v2=new THREE.Vector3;THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c,d){var e=new Image,f=new THREE.Texture(e,b),b=new THREE.ImageLoader;b.addEventListener("load",function(a){f.image=a.content;f.needsUpdate=!0;c&&c(f)});b.addEventListener("error",function(a){d&&d(a.message)});b.crossOrigin=this.crossOrigin;b.load(a,e);f.sourceFile=a;return f},loadCompressedTexture:function(a,b,c,d){var e=new THREE.CompressedTexture;e.mapping=b;var f=new XMLHttpRequest;f.onload=function(){var a=THREE.ImageUtils.parseDDS(f.response,
|
|
!0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=!0,c&&c(f))};h.onerror=d;h.crossOrigin=
|
|
!0);e.format=a.format;e.mipmaps=a.mipmaps;e.image.width=a.width;e.image.height=a.height;e.generateMipmaps=!1;e.needsUpdate=!0;c&&c(e)};f.onerror=d;f.open("GET",a,!0);f.responseType="arraybuffer";f.send(null);return e},loadTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.Texture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;for(var b=0,g=a.length;b<g;++b){var h=new Image;e[b]=h;h.onload=function(){e.loadCount+=1;6===e.loadCount&&(f.needsUpdate=!0,c&&c(f))};h.onerror=d;h.crossOrigin=
|
|
this.crossOrigin;h.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var g=0,h=a.length;g<h;++g){var i={};
|
|
this.crossOrigin;h.src=a[b]}return f},loadCompressedTextureCube:function(a,b,c,d){var e=[];e.loadCount=0;var f=new THREE.CompressedTexture;f.image=e;void 0!==b&&(f.mapping=b);f.flipY=!1;f.generateMipmaps=!1;b=function(a,b){return function(){var d=THREE.ImageUtils.parseDDS(a.response,!0);b.format=d.format;b.mipmaps=d.mipmaps;b.width=d.width;b.height=d.height;e.loadCount+=1;6===e.loadCount&&(f.format=d.format,f.needsUpdate=!0,c&&c(f))}};if(a instanceof Array)for(var g=0,h=a.length;g<h;++g){var i={};
|
|
e[g]=i;var k=new XMLHttpRequest;k.onload=b(k,i);k.onerror=d;i=a[g];k.open("GET",i,!0);k.responseType="arraybuffer";k.send(null)}else k=new XMLHttpRequest,k.onload=function(){var a=THREE.ImageUtils.parseDDS(k.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},k.onerror=
|
|
e[g]=i;var k=new XMLHttpRequest;k.onload=b(k,i);k.onerror=d;i=a[g];k.open("GET",i,!0);k.responseType="arraybuffer";k.send(null)}else k=new XMLHttpRequest,k.onload=function(){var a=THREE.ImageUtils.parseDDS(k.response,!0);if(a.isCubemap){for(var b=a.mipmaps.length/a.mipmapCount,d=0;d<b;d++){e[d]={mipmaps:[]};for(var g=0;g<a.mipmapCount;g++)e[d].mipmaps.push(a.mipmaps[d*a.mipmapCount+g]),e[d].format=a.format,e[d].width=a.width,e[d].height=a.height}f.format=a.format;f.needsUpdate=!0;c&&c(f)}},k.onerror=
|
|
d,k.open("GET",a,!0),k.responseType="arraybuffer",k.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(542327876!==h[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!h[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
|
|
d,k.open("GET",a,!0),k.responseType="arraybuffer",k.send(null);return f},parseDDS:function(a,b){function c(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}var d={mipmaps:[],width:0,height:0,format:null,mipmapCount:1},e=c("DXT1"),f=c("DXT3"),g=c("DXT5"),h=new Int32Array(a,0,31);if(542327876!==h[0])return console.error("ImageUtils.parseDDS(): Invalid magic number in DDS header"),d;if(!h[20]&4)return console.error("ImageUtils.parseDDS(): Unsupported format, must contain a FourCC code"),
|
|
d;var i=h[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.isCubemap=h[28]&512?!0:!1;d.width=h[4];d.height=h[3];for(var h=h[1]+4,f=d.width,g=d.height,i=d.isCubemap?
|
|
d;var i=h[21];switch(i){case e:e=8;d.format=THREE.RGB_S3TC_DXT1_Format;break;case f:e=16;d.format=THREE.RGBA_S3TC_DXT3_Format;break;case g:e=16;d.format=THREE.RGBA_S3TC_DXT5_Format;break;default:return console.error("ImageUtils.parseDDS(): Unsupported FourCC code: ",String.fromCharCode(i&255,i>>8&255,i>>16&255,i>>24&255)),d}d.mipmapCount=1;h[2]&131072&&!1!==b&&(d.mipmapCount=Math.max(1,h[7]));d.isCubemap=h[28]&512?!0:!1;d.width=h[4];d.height=h[3];for(var h=h[1]+4,f=d.width,g=d.height,i=d.isCubemap?
|
|
6:1,k=0;k<i;k++){for(var m=0;m<d.mipmapCount;m++){var n=Math.max(4,f)/4*Math.max(4,g)/4*e,l={data:new Uint8Array(a,h,n),width:f,height:g};d.mipmaps.push(l);h+=n;f=Math.max(0.5*f,1);g=Math.max(0.5*g,1)}f=d.width;g=d.height}return d},getNormalMap:function(a,b){var c=function(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=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,
|
|
6:1,k=0;k<i;k++){for(var m=0;m<d.mipmapCount;m++){var n=Math.max(4,f)/4*Math.max(4,g)/4*e,l={data:new Uint8Array(a,h,n),width:f,height:g};d.mipmaps.push(l);h+=n;f=Math.max(0.5*f,1);g=Math.max(0.5*g,1)}f=d.width;g=d.height}return d},getNormalMap:function(a,b){var c=function(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=b|1,d=a.width,e=a.height,f=document.createElement("canvas");f.width=d;f.height=e;var g=f.getContext("2d");g.drawImage(a,0,0);for(var h=g.getImageData(0,
|
|
-0,d,e).data,i=g.createImageData(d,e),k=i.data,m=0;m<d;m++)for(var n=0;n<e;n++){var l=0>n-1?0:n-1,s=n+1>e-1?e-1:n+1,q=0>m-1?0:m-1,p=m+1>d-1?d-1:m+1,r=[],v=[0,0,h[4*(n*d+m)]/255*b];r.push([-1,0,h[4*(n*d+q)]/255*b]);r.push([-1,-1,h[4*(l*d+q)]/255*b]);r.push([0,-1,h[4*(l*d+m)]/255*b]);r.push([1,-1,h[4*(l*d+p)]/255*b]);r.push([1,0,h[4*(n*d+p)]/255*b]);r.push([1,1,h[4*(s*d+p)]/255*b]);r.push([0,1,h[4*(s*d+m)]/255*b]);r.push([-1,1,h[4*(s*d+q)]/255*b]);l=[];q=r.length;for(s=0;s<q;s++){var p=r[s],x=r[(s+1)%
|
|
|
|
-q],p=[p[0]-v[0],p[1]-v[1],p[2]-v[2]],x=[x[0]-v[0],x[1]-v[1],x[2]-v[2]];l.push(c([p[1]*x[2]-p[2]*x[1],p[2]*x[0]-p[0]*x[2],p[0]*x[1]-p[1]*x[0]]))}r=[0,0,0];for(s=0;s<l.length;s++)r[0]+=l[s][0],r[1]+=l[s][1],r[2]+=l[s][2];r[0]/=l.length;r[1]/=l.length;r[2]/=l.length;v=4*(n*d+m);k[v]=255*((r[0]+1)/2)|0;k[v+1]=255*((r[1]+1)/2)|0;k[v+2]=255*r[2]|0;k[v+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),
|
|
|
|
|
|
+0,d,e).data,i=g.createImageData(d,e),k=i.data,m=0;m<d;m++)for(var n=0;n<e;n++){var l=0>n-1?0:n-1,s=n+1>e-1?e-1:n+1,q=0>m-1?0:m-1,p=m+1>d-1?d-1:m+1,r=[],w=[0,0,h[4*(n*d+m)]/255*b];r.push([-1,0,h[4*(n*d+q)]/255*b]);r.push([-1,-1,h[4*(l*d+q)]/255*b]);r.push([0,-1,h[4*(l*d+m)]/255*b]);r.push([1,-1,h[4*(l*d+p)]/255*b]);r.push([1,0,h[4*(n*d+p)]/255*b]);r.push([1,1,h[4*(s*d+p)]/255*b]);r.push([0,1,h[4*(s*d+m)]/255*b]);r.push([-1,1,h[4*(s*d+q)]/255*b]);l=[];q=r.length;for(s=0;s<q;s++){var p=r[s],x=r[(s+1)%
|
|
|
|
+q],p=[p[0]-w[0],p[1]-w[1],p[2]-w[2]],x=[x[0]-w[0],x[1]-w[1],x[2]-w[2]];l.push(c([p[1]*x[2]-p[2]*x[1],p[2]*x[0]-p[0]*x[2],p[0]*x[1]-p[1]*x[0]]))}r=[0,0,0];for(s=0;s<l.length;s++)r[0]+=l[s][0],r[1]+=l[s][1],r[2]+=l[s][2];r[0]/=l.length;r[1]/=l.length;r[2]/=l.length;w=4*(n*d+m);k[w]=255*((r[0]+1)/2)|0;k[w+1]=255*((r[1]+1)/2)|0;k[w+2]=255*r[2]|0;k[w+3]=255}g.putImageData(i,0,0);return f},generateDataTexture:function(a,b,c){for(var d=a*b,e=new Uint8Array(3*d),f=Math.floor(255*c.r),g=Math.floor(255*c.g),
|
|
c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,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.Object3D,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.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
c=Math.floor(255*c.b),h=0;h<d;h++)e[3*h]=f,e[3*h+1]=g,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.Object3D,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.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\nvec3 I = worldPosition.xyz - cameraPosition;\nvReflect = reflect( I, worldNormal );\nvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );\nvec3 I = worldPosition.xyz - cameraPosition;\nvReflect = reflect( I, worldNormal );\nvRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new THREE.Vector2(1,
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},enableDisplacement:{type:"i",value:0},tDisplacement:{type:"t",value:null},tDiffuse:{type:"t",value:null},tCube:{type:"t",value:null},tNormal:{type:"t",value:null},tSpecular:{type:"t",value:null},tAO:{type:"t",value:null},uNormalScale:{type:"v2",value:new THREE.Vector2(1,
|
|
@@ -529,11 +528,11 @@ THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"v
|
|
THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
|
|
THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\nuniform bool enableDisplacement;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vWorldPosition;\nvarying vec3 vViewPosition;",
|
|
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
|
|
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.skinbase_vertex,THREE.ShaderChunk.skinnormal_vertex,"#ifdef USE_SKINNING\nvNormal = normalize( normalMatrix * skinnedNormal.xyz );\nvec4 skinnedTangent = skinMatrix * vec4( tangent.xyz, 0.0 );\nvTangent = normalize( normalMatrix * skinnedTangent.xyz );\n#else\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\n#endif\nvBinormal = normalize( cross( vNormal, vTangent ) * tangent.w );\nvUv = uv * uRepeat + uOffset;\nvec3 displacedPosition;\n#ifdef VERTEX_TEXTURES\nif ( enableDisplacement ) {\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\ndisplacedPosition = position + normalize( normal ) * df;\n} else {\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n}\n#else\n#ifdef USE_SKINNING\nvec4 skinVertex = vec4( position, 1.0 );\nvec4 skinned = boneMatX * skinVertex * skinWeight.x;\nskinned \t += boneMatY * skinVertex * skinWeight.y;\ndisplacedPosition = skinned.xyz;\n#else\ndisplacedPosition = position;\n#endif\n#endif\nvec4 mvPosition = modelViewMatrix * vec4( displacedPosition, 1.0 );\nvec4 worldPosition = modelMatrix * vec4( displacedPosition, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\nvWorldPosition = worldPosition.xyz;\nvViewPosition = -mvPosition.xyz;\n#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;\n}\n#endif\n}"].join("\n")},
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"}}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},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){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
cube:{uniforms:{tCube:{type:"t",value:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vWorldPosition;\nvoid main() {\nvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\nvWorldPosition = worldPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vWorldPosition;\nvoid main() {\ngl_FragColor = textureCube( tCube, vec3( tFlip * vWorldPosition.x, vWorldPosition.yz ) );\n}"}}};THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},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){for(var b=this.getFace(),c=this.size/b.resolution,d=
|
|
-0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,m,n,l,s,q,p,r,v=b.glyphs[a]||b.glyphs["?"];if(v){if(v.o){b=v._cachedOutline||(v._cachedOutline=v.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
|
|
|
|
-c+d;m=b[a++]*c;s=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(s,q,i,m);if(g=f[f.length-1]){n=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var x=g/h;THREE.Shape.Utils.b2(x,n,s,i);THREE.Shape.Utils.b2(x,l,q,m)}}break;case "b":if(i=b[a++]*c+d,m=b[a++]*c,s=b[a++]*c+d,q=b[a++]*-c,p=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,m,s,q,p,r),g=f[f.length-1]){n=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++)x=g/h,THREE.Shape.Utils.b3(x,n,s,p,i),THREE.Shape.Utils.b3(x,l,q,r,m)}}}return{offset:v.ha*c,path:e}}}};
|
|
|
|
|
|
+0,e=String(a).split(""),f=e.length,g=[],a=0;a<f;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h),d=d+h.offset;g.push(h.path)}return{paths:g,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var f=[],g,h,i,k,m,n,l,s,q,p,r,w=b.glyphs[a]||b.glyphs["?"];if(w){if(w.o){b=w._cachedOutline||(w._cachedOutline=w.o.split(" "));k=b.length;for(a=0;a<k;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;m=b[a++]*c;e.moveTo(i,m);break;case "l":i=b[a++]*c+d;m=b[a++]*c;e.lineTo(i,m);break;case "q":i=b[a++]*
|
|
|
|
+c+d;m=b[a++]*c;s=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(s,q,i,m);if(g=f[f.length-1]){n=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++){var x=g/h;THREE.Shape.Utils.b2(x,n,s,i);THREE.Shape.Utils.b2(x,l,q,m)}}break;case "b":if(i=b[a++]*c+d,m=b[a++]*c,s=b[a++]*c+d,q=b[a++]*-c,p=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,m,s,q,p,r),g=f[f.length-1]){n=g.x;l=g.y;g=1;for(h=this.divisions;g<=h;g++)x=g/h,THREE.Shape.Utils.b3(x,n,s,p,i),THREE.Shape.Utils.b3(x,l,q,r,m)}}}return{offset:w.ha*c,path:e}}}};
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
THREE.FontUtils.generateShapes=function(a,b){var b=b||{},c=void 0!==b.curveSegments?b.curveSegments:4,d=void 0!==b.font?b.font:"helvetiker",e=void 0!==b.weight?b.weight:"normal",f=void 0!==b.style?b.style:"normal";THREE.FontUtils.size=void 0!==b.size?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=e;THREE.FontUtils.style=f;c=THREE.FontUtils.drawText(a).paths;d=[];e=0;for(f=c.length;e<f;e++)Array.prototype.push.apply(d,c[e].toShapes());return d};
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,m;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var n=2*e;for(k=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);m=k+1;e<=m&&(m=0);var l;a:{var s=l=void 0,q=void 0,p=void 0,r=void 0,v=void 0,x=void 0,w=void 0,t=
|
|
|
|
-void 0,s=a[g[i]].x,q=a[g[i]].y,p=a[g[k]].x,r=a[g[k]].y,v=a[g[m]].x,x=a[g[m]].y;if(1E-10>(p-s)*(x-q)-(r-q)*(v-s))l=!1;else{var J=void 0,E=void 0,C=void 0,z=void 0,G=void 0,F=void 0,I=void 0,$=void 0,B=void 0,R=void 0,B=$=I=t=w=void 0,J=v-p,E=x-r,C=s-v,z=q-x,G=p-s,F=r-q;for(l=0;l<e;l++)if(!(l===i||l===k||l===m))if(w=a[g[l]].x,t=a[g[l]].y,I=w-s,$=t-q,B=w-p,R=t-r,w-=v,t-=x,B=J*R-E*B,I=G*$-F*I,$=C*t-z*w,0<=B&&0<=$&&0<=I){l=!1;break a}l=!0}}if(l){f.push([a[g[i]],a[g[k]],a[g[m]]]);h.push([g[i],g[k],g[m]]);
|
|
|
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,f=b-1,g=0;g<b;f=g++)e+=a[f].x*a[g].y-a[g].x*a[f].y;return 0.5*e};a.Triangulate=function(a,d){var e=a.length;if(3>e)return null;var f=[],g=[],h=[],i,k,m;if(0<b(a))for(k=0;k<e;k++)g[k]=k;else for(k=0;k<e;k++)g[k]=e-1-k;var n=2*e;for(k=e-1;2<e;){if(0>=n--){console.log("Warning, unable to triangulate polygon!");break}i=k;e<=i&&(i=0);k=i+1;e<=k&&(k=0);m=k+1;e<=m&&(m=0);var l;a:{var s=l=void 0,q=void 0,p=void 0,r=void 0,w=void 0,x=void 0,v=void 0,t=
|
|
|
|
+void 0,s=a[g[i]].x,q=a[g[i]].y,p=a[g[k]].x,r=a[g[k]].y,w=a[g[m]].x,x=a[g[m]].y;if(1E-10>(p-s)*(x-q)-(r-q)*(w-s))l=!1;else{var I=void 0,E=void 0,C=void 0,z=void 0,G=void 0,F=void 0,J=void 0,V=void 0,B=void 0,T=void 0,B=V=J=t=v=void 0,I=w-p,E=x-r,C=s-w,z=q-x,G=p-s,F=r-q;for(l=0;l<e;l++)if(!(l===i||l===k||l===m))if(v=a[g[l]].x,t=a[g[l]].y,J=v-s,V=t-q,B=v-p,T=t-r,v-=w,t-=x,B=I*T-E*B,J=G*V-F*J,V=C*t-z*v,0<=B&&0<=V&&0<=J){l=!1;break a}l=!0}}if(l){f.push([a[g[i]],a[g[k]],a[g[m]]]);h.push([g[i],g[k],g[m]]);
|
|
i=k;for(m=k+1;m<e;i++,m++)g[i]=g[m];e--;n=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
i=k;for(m=k+1;m<e;i++,m++)g[i]=g[m];e--;n=2*e}}return d?h:f};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){a=this.getUtoTmapping(a);return this.getPoint(a)};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=this.__arcLengthDivisions?this.__arcLengthDivisions:200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var b=[],c,d=this.getPoint(0),e,f=0;b.push(0);for(e=1;e<=a;e++)c=this.getPoint(e/a),f+=c.distanceTo(d),b.push(f),d=c;return this.cacheArcLengths=b};
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};
|
|
THREE.Curve.prototype.updateArcLengths=function(){this.needsUpdate=!0;this.getLengths()};THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,e=c.length,f;f=b?b:a*c[e-1];for(var g=0,h=e-1,i;g<=h;)if(d=Math.floor(g+(h-g)/2),i=c[d]-f,0>i)g=d+1;else if(0<i)h=d-1;else{h=d;break}d=h;if(c[d]==f)return d/(e-1);g=c[d];return c=(d+(f-g)/(c[d+1]-g))/(e-1)};THREE.Curve.prototype.getTangent=function(a){var b=a-1E-4,a=a+1E-4;0>b&&(b=0);1<a&&(a=1);b=this.getPoint(b);return this.getPoint(a).clone().subSelf(b).normalize()};
|
|
@@ -609,20 +608,20 @@ THREE.CombinedCamera.prototype.setLens=function(a,b){void 0===b&&(b=24);var c=2*
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a,d=0.707*b,c=[[a,0,0],[b,0,0],[-a,0,0],[-b,0,0],[0,a,0],[0,b,0],[0,-a,0],[0,-b,0],[0,0,a],[0,0,b],[0,0,-a],[0,0,-b],[c,c,0],[d,d,0],[-c,-c,0],[-d,-d,0],[c,-c,0],[d,-d,0],[-c,c,0],[-d,d,0],[c,0,c],[d,0,d],[-c,0,-c],[-d,0,-d],[c,0,-c],[d,0,-d],[-c,0,c],[-d,0,d],[0,c,c],[0,d,d],[0,-c,-c],[0,-d,-d],[0,c,-c],[0,d,-d],[0,-c,c],[0,-d,d]],d=0,e=c.length;d<e;d++)this.vertices.push(new THREE.Vector3(c[d][0],c[d][1],c[d][2]))};
|
|
THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.AsteriskGeometry=function(a,b){THREE.Geometry.call(this);for(var c=0.707*a,d=0.707*b,c=[[a,0,0],[b,0,0],[-a,0,0],[-b,0,0],[0,a,0],[0,b,0],[0,-a,0],[0,-b,0],[0,0,a],[0,0,b],[0,0,-a],[0,0,-b],[c,c,0],[d,d,0],[-c,-c,0],[-d,-d,0],[c,-c,0],[d,-d,0],[-c,c,0],[-d,d,0],[c,0,c],[d,0,d],[-c,0,-c],[-d,0,-d],[c,0,-c],[d,0,-d],[-c,0,c],[-d,0,d],[0,c,c],[0,d,d],[0,-c,-c],[0,-d,-d],[0,c,-c],[0,d,-d],[0,-c,c],[0,-d,d]],d=0,e=c.length;d<e;d++)this.vertices.push(new THREE.Vector3(c[d][0],c[d][1],c[d][2]))};
|
|
THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),
|
|
THREE.AsteriskGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CircleGeometry=function(a,b,c,d){THREE.Geometry.call(this);var a=a||50,c=void 0!==c?c:0,d=void 0!==d?d:2*Math.PI,b=void 0!==b?Math.max(3,b):8,e,f=[];e=new THREE.Vector3;var g=new THREE.Vector2(0.5,0.5);this.vertices.push(e);f.push(g);for(e=0;e<=b;e++){var h=new THREE.Vector3;h.x=a*Math.cos(c+e/b*d);h.y=a*Math.sin(c+e/b*d);this.vertices.push(h);f.push(new THREE.Vector2((h.x/a+1)/2,-(h.y/a+1)/2+1))}c=new THREE.Vector3(0,0,-1);for(e=1;e<=b;e++)this.faces.push(new THREE.Face3(e,e+1,0,[c,c,c])),
|
|
-this.faceVertexUvs[0].push([f[e],f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var r,v=h.widthSegments,x=h.heightSegments,w=e/2,t=f/2,J=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)r="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)r="y",x=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)r="x",v=h.depthSegments;var E=v+1,C=x+1,z=e/v,G=f/x,F=new THREE.Vector3;F[r]=0<g?1:-1;for(e=0;e<C;e++)for(f=0;f<E;f++){var I=new THREE.Vector3;I[a]=(f*z-w)*c;I[b]=(e*G-t)*d;I[r]=g;h.vertices.push(I)}for(e=
|
|
|
|
-0;e<x;e++)for(f=0;f<v;f++)a=new THREE.Face4(f+E*e+J,f+E*(e+1)+J,f+1+E*(e+1)+J,f+1+E*e+J),a.normal.copy(F),a.vertexNormals.push(F.clone(),F.clone(),F.clone(),F.clone()),a.materialIndex=p,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/v,1-e/x),new THREE.Vector2(f/v,1-(e+1)/x),new THREE.Vector2((f+1)/v,1-(e+1)/x),new THREE.Vector2((f+1)/v,1-e/x)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
|
|
|
|
+this.faceVertexUvs[0].push([f[e],f[e+1],g]);this.computeCentroids();this.computeFaceNormals();this.boundingSphere=new THREE.Sphere(new THREE.Vector3,a)};THREE.CircleGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CubeGeometry=function(a,b,c,d,e,f){function g(a,b,c,d,e,f,g,p){var r,w=h.widthSegments,x=h.heightSegments,v=e/2,t=f/2,I=h.vertices.length;if("x"===a&&"y"===b||"y"===a&&"x"===b)r="z";else if("x"===a&&"z"===b||"z"===a&&"x"===b)r="y",x=h.depthSegments;else if("z"===a&&"y"===b||"y"===a&&"z"===b)r="x",w=h.depthSegments;var E=w+1,C=x+1,z=e/w,G=f/x,F=new THREE.Vector3;F[r]=0<g?1:-1;for(e=0;e<C;e++)for(f=0;f<E;f++){var J=new THREE.Vector3;J[a]=(f*z-v)*c;J[b]=(e*G-t)*d;J[r]=g;h.vertices.push(J)}for(e=
|
|
|
|
+0;e<x;e++)for(f=0;f<w;f++)a=new THREE.Face4(f+E*e+I,f+E*(e+1)+I,f+1+E*(e+1)+I,f+1+E*e+I),a.normal.copy(F),a.vertexNormals.push(F.clone(),F.clone(),F.clone(),F.clone()),a.materialIndex=p,h.faces.push(a),h.faceVertexUvs[0].push([new THREE.Vector2(f/w,1-e/x),new THREE.Vector2(f/w,1-(e+1)/x),new THREE.Vector2((f+1)/w,1-(e+1)/x),new THREE.Vector2((f+1)/w,1-e/x)])}THREE.Geometry.call(this);var h=this;this.width=a;this.height=b;this.depth=c;this.widthSegments=d||1;this.heightSegments=e||1;this.depthSegments=
|
|
f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],m=[];for(i=0;i<=e;i++){var n=[],l=[],s=i/e,q=s*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,r=new THREE.Vector3;r.x=q*Math.sin(2*p*Math.PI);r.y=-s*c+g;r.z=q*Math.cos(2*p*Math.PI);this.vertices.push(r);n.push(this.vertices.length-1);l.push(new THREE.Vector2(p,1-s))}k.push(n);m.push(l)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(n=this.vertices[k[0][h]].clone(),
|
|
f||1;a=this.width/2;b=this.height/2;c=this.depth/2;g("z","y",-1,-1,this.depth,this.height,a,0);g("z","y",1,-1,this.depth,this.height,-a,1);g("x","z",1,1,this.width,this.depth,b,2);g("x","z",1,-1,this.width,this.depth,-b,3);g("x","y",1,-1,this.width,this.height,c,4);g("x","y",-1,-1,this.width,this.height,-c,5);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.CylinderGeometry=function(a,b,c,d,e,f){THREE.Geometry.call(this);var a=void 0!==a?a:20,b=void 0!==b?b:20,c=void 0!==c?c:100,g=c/2,d=d||8,e=e||1,h,i,k=[],m=[];for(i=0;i<=e;i++){var n=[],l=[],s=i/e,q=s*(b-a)+a;for(h=0;h<=d;h++){var p=h/d,r=new THREE.Vector3;r.x=q*Math.sin(2*p*Math.PI);r.y=-s*c+g;r.z=q*Math.cos(2*p*Math.PI);this.vertices.push(r);n.push(this.vertices.length-1);l.push(new THREE.Vector2(p,1-s))}k.push(n);m.push(l)}c=(b-a)/c;for(h=0;h<d;h++){0!==a?(n=this.vertices[k[0][h]].clone(),
|
|
-l=this.vertices[k[0][h+1]].clone()):(n=this.vertices[k[1][h]].clone(),l=this.vertices[k[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],q=k[i+1][h],p=k[i+1][h+1],r=k[i][h+1],v=n.clone(),x=n.clone(),w=l.clone(),t=l.clone(),J=m[i][h].clone(),E=m[i+1][h].clone(),C=m[i+1][h+1].clone(),z=m[i][h+1].clone();this.faces.push(new THREE.Face4(s,q,p,r,[v,x,w,t]));this.faceVertexUvs[0].push([J,E,C,z])}}if(!f&&0<
|
|
|
|
-a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],q=k[0][h+1],p=this.vertices.length-1,v=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),J=m[0][h].clone(),E=m[0][h+1].clone(),C=new THREE.Vector2(E.u,0),this.faces.push(new THREE.Face3(s,q,p,[v,x,w])),this.faceVertexUvs[0].push([J,E,C])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],q=k[i][h],p=this.vertices.length-1,v=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,
|
|
|
|
--1,0),w=new THREE.Vector3(0,-1,0),J=m[i][h+1].clone(),E=m[i][h].clone(),C=new THREE.Vector2(E.u,1),this.faces.push(new THREE.Face3(s,q,p,[v,x,w])),this.faceVertexUvs[0].push([J,E,C])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
|
|
|
|
+l=this.vertices[k[0][h+1]].clone()):(n=this.vertices[k[1][h]].clone(),l=this.vertices[k[1][h+1]].clone());n.setY(Math.sqrt(n.x*n.x+n.z*n.z)*c).normalize();l.setY(Math.sqrt(l.x*l.x+l.z*l.z)*c).normalize();for(i=0;i<e;i++){var s=k[i][h],q=k[i+1][h],p=k[i+1][h+1],r=k[i][h+1],w=n.clone(),x=n.clone(),v=l.clone(),t=l.clone(),I=m[i][h].clone(),E=m[i+1][h].clone(),C=m[i+1][h+1].clone(),z=m[i][h+1].clone();this.faces.push(new THREE.Face4(s,q,p,r,[w,x,v,t]));this.faceVertexUvs[0].push([I,E,C,z])}}if(!f&&0<
|
|
|
|
+a){this.vertices.push(new THREE.Vector3(0,g,0));for(h=0;h<d;h++)s=k[0][h],q=k[0][h+1],p=this.vertices.length-1,w=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),I=m[0][h].clone(),E=m[0][h+1].clone(),C=new THREE.Vector2(E.u,0),this.faces.push(new THREE.Face3(s,q,p,[w,x,v])),this.faceVertexUvs[0].push([I,E,C])}if(!f&&0<b){this.vertices.push(new THREE.Vector3(0,-g,0));for(h=0;h<d;h++)s=k[i][h+1],q=k[i][h],p=this.vertices.length-1,w=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,
|
|
|
|
+-1,0),v=new THREE.Vector3(0,-1,0),I=m[i][h+1].clone(),E=m[i][h].clone(),C=new THREE.Vector2(E.u,1),this.faces.push(new THREE.Face3(s,q,p,[w,x,v])),this.faceVertexUvs[0].push([I,E,C])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry=function(a,b){"undefined"!==typeof a&&(THREE.Geometry.call(this),a=a instanceof Array?a:[a],this.shapebb=a[a.length-1].getBoundingBox(),this.addShapeList(a,b),this.computeCentroids(),this.computeFaceNormals())};THREE.ExtrudeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ExtrudeGeometry.prototype.addShapeList=function(a,b){for(var c=a.length,d=0;d<c;d++)this.addShape(a[d],b)};
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(L=c.length;0<=--L;){e=L;f=L-1;0>f&&(f=c.length-1);
|
|
|
|
-for(var g=0,h=s+2*m,g=0;g<h;g++){var i=P*g,k=P*(g+1),l=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,t=e,v=f,l=l+$,i=i+$,n=n+$,k=k+$;I.faces.push(new THREE.Face4(l,i,n,k,null,null,x));l=w.generateSideWallUV(I,a,p,b,l,i,n,k,q,r,t,v);I.faceVertexUvs[0].push(l)}}}function f(a,b,c){I.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=$;d+=$;e+=$;I.faces.push(new THREE.Face3(c,d,e,null,null,v));c=f?w.generateBottomUV(I,a,b,c,d,e):w.generateTopUV(I,a,b,c,d,e);I.faceVertexUvs[0].push(c)}var h=void 0!==
|
|
|
|
-b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,q=b.extrudePath,p,r=!1,v=b.material,x=b.extrudeMaterial,w=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,J,E,C;q&&(p=q.getSpacedPoints(s),r=!0,n=!1,t=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(q,
|
|
|
|
-s,!1),J=new THREE.Vector3,E=new THREE.Vector3,C=new THREE.Vector3);n||(k=i=m=0);var z,G,F,I=this,$=this.vertices.length,l=a.extractPoints(l),B=l.shape,l=l.holes;if(q=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();G=0;for(F=l.length;G<F;G++)z=l[G],THREE.Shape.Utils.isClockWise(z)&&(l[G]=z.reverse());q=!1}var R=THREE.Shape.Utils.triangulateShape(B,l),q=B;G=0;for(F=l.length;G<F;G++)z=l[G],B=B.concat(z);var A,H,K,M,P=B.length,ga=R.length,ra=[],L=0,oa=q.length;A=oa-1;for(H=L+1;L<oa;L++,A++,H++)A===oa&&
|
|
|
|
-(A=0),H===oa&&(H=0),ra[L]=d(q[L],q[A],q[H]);var Aa=[],Ha,O=ra.concat();G=0;for(F=l.length;G<F;G++){z=l[G];Ha=[];L=0;oa=z.length;A=oa-1;for(H=L+1;L<oa;L++,A++,H++)A===oa&&(A=0),H===oa&&(H=0),Ha[L]=d(z[L],z[A],z[H]);Aa.push(Ha);O=O.concat(Ha)}for(A=0;A<m;A++){z=A/m;K=i*(1-z);H=k*Math.sin(z*Math.PI/2);L=0;for(oa=q.length;L<oa;L++)M=c(q[L],ra[L],H),f(M.x,M.y,-K);G=0;for(F=l.length;G<F;G++){z=l[G];Ha=Aa[G];L=0;for(oa=z.length;L<oa;L++)M=c(z[L],Ha[L],H),f(M.x,M.y,-K)}}H=k;for(L=0;L<P;L++)M=n?c(B[L],O[L],
|
|
|
|
-H):B[L],r?(E.copy(t.normals[0]).multiplyScalar(M.x),J.copy(t.binormals[0]).multiplyScalar(M.y),C.copy(p[0]).addSelf(E).addSelf(J),f(C.x,C.y,C.z)):f(M.x,M.y,0);for(z=1;z<=s;z++)for(L=0;L<P;L++)M=n?c(B[L],O[L],H):B[L],r?(E.copy(t.normals[z]).multiplyScalar(M.x),J.copy(t.binormals[z]).multiplyScalar(M.y),C.copy(p[z]).addSelf(E).addSelf(J),f(C.x,C.y,C.z)):f(M.x,M.y,h/s*z);for(A=m-1;0<=A;A--){z=A/m;K=i*(1-z);H=k*Math.sin(z*Math.PI/2);L=0;for(oa=q.length;L<oa;L++)M=c(q[L],ra[L],H),f(M.x,M.y,h+K);G=0;for(F=
|
|
|
|
-l.length;G<F;G++){z=l[G];Ha=Aa[G];L=0;for(oa=z.length;L<oa;L++)M=c(z[L],Ha[L],H),r?f(M.x,M.y+p[s-1].y,p[s-1].x+K):f(M.x,M.y,h+K)}}if(n){i=0*P;for(L=0;L<ga;L++)h=R[L],g(h[2]+i,h[1]+i,h[0]+i,!0);i=P*(s+2*m);for(L=0;L<ga;L++)h=R[L],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(L=0;L<ga;L++)h=R[L],g(h[2],h[1],h[0],!0);for(L=0;L<ga;L++)h=R[L],g(h[0]+P*s,h[1]+P*s,h[2]+P*s,!1)}h=0;e(q,h);h+=q.length;G=0;for(F=l.length;G<F;G++)z=l[G],e(z,h),h+=z.length};
|
|
|
|
|
|
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);0===f&&(console.log("Either infinite or no solutions!"),0===g?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return 0>g?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=2*Math.PI),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function e(c,d){var e,f;for(K=c.length;0<=--K;){e=K;f=K-1;0>f&&(f=c.length-1);
|
|
|
|
+for(var g=0,h=s+2*m,g=0;g<h;g++){var i=P*g,k=P*(g+1),l=d+e+i,i=d+f+i,n=d+f+k,k=d+e+k,p=c,q=g,r=h,t=e,w=f,l=l+V,i=i+V,n=n+V,k=k+V;J.faces.push(new THREE.Face4(l,i,n,k,null,null,x));l=v.generateSideWallUV(J,a,p,b,l,i,n,k,q,r,t,w);J.faceVertexUvs[0].push(l)}}}function f(a,b,c){J.vertices.push(new THREE.Vector3(a,b,c))}function g(c,d,e,f){c+=V;d+=V;e+=V;J.faces.push(new THREE.Face3(c,d,e,null,null,w));c=f?v.generateBottomUV(J,a,b,c,d,e):v.generateTopUV(J,a,b,c,d,e);J.faceVertexUvs[0].push(c)}var h=void 0!==
|
|
|
|
+b.amount?b.amount:100,i=void 0!==b.bevelThickness?b.bevelThickness:6,k=void 0!==b.bevelSize?b.bevelSize:i-2,m=void 0!==b.bevelSegments?b.bevelSegments:3,n=void 0!==b.bevelEnabled?b.bevelEnabled:!0,l=void 0!==b.curveSegments?b.curveSegments:12,s=void 0!==b.steps?b.steps:1,q=b.extrudePath,p,r=!1,w=b.material,x=b.extrudeMaterial,v=void 0!==b.UVGenerator?b.UVGenerator:THREE.ExtrudeGeometry.WorldUVGenerator,t,I,E,C;q&&(p=q.getSpacedPoints(s),r=!0,n=!1,t=void 0!==b.frames?b.frames:new THREE.TubeGeometry.FrenetFrames(q,
|
|
|
|
+s,!1),I=new THREE.Vector3,E=new THREE.Vector3,C=new THREE.Vector3);n||(k=i=m=0);var z,G,F,J=this,V=this.vertices.length,l=a.extractPoints(l),B=l.shape,l=l.holes;if(q=!THREE.Shape.Utils.isClockWise(B)){B=B.reverse();G=0;for(F=l.length;G<F;G++)z=l[G],THREE.Shape.Utils.isClockWise(z)&&(l[G]=z.reverse());q=!1}var T=THREE.Shape.Utils.triangulateShape(B,l),q=B;G=0;for(F=l.length;G<F;G++)z=l[G],B=B.concat(z);var A,H,L,M,P=B.length,ca=T.length,oa=[],K=0,ha=q.length;A=ha-1;for(H=K+1;K<ha;K++,A++,H++)A===ha&&
|
|
|
|
+(A=0),H===ha&&(H=0),oa[K]=d(q[K],q[A],q[H]);var ea=[],Sa,O=oa.concat();G=0;for(F=l.length;G<F;G++){z=l[G];Sa=[];K=0;ha=z.length;A=ha-1;for(H=K+1;K<ha;K++,A++,H++)A===ha&&(A=0),H===ha&&(H=0),Sa[K]=d(z[K],z[A],z[H]);ea.push(Sa);O=O.concat(Sa)}for(A=0;A<m;A++){z=A/m;L=i*(1-z);H=k*Math.sin(z*Math.PI/2);K=0;for(ha=q.length;K<ha;K++)M=c(q[K],oa[K],H),f(M.x,M.y,-L);G=0;for(F=l.length;G<F;G++){z=l[G];Sa=ea[G];K=0;for(ha=z.length;K<ha;K++)M=c(z[K],Sa[K],H),f(M.x,M.y,-L)}}H=k;for(K=0;K<P;K++)M=n?c(B[K],O[K],
|
|
|
|
+H):B[K],r?(E.copy(t.normals[0]).multiplyScalar(M.x),I.copy(t.binormals[0]).multiplyScalar(M.y),C.copy(p[0]).addSelf(E).addSelf(I),f(C.x,C.y,C.z)):f(M.x,M.y,0);for(z=1;z<=s;z++)for(K=0;K<P;K++)M=n?c(B[K],O[K],H):B[K],r?(E.copy(t.normals[z]).multiplyScalar(M.x),I.copy(t.binormals[z]).multiplyScalar(M.y),C.copy(p[z]).addSelf(E).addSelf(I),f(C.x,C.y,C.z)):f(M.x,M.y,h/s*z);for(A=m-1;0<=A;A--){z=A/m;L=i*(1-z);H=k*Math.sin(z*Math.PI/2);K=0;for(ha=q.length;K<ha;K++)M=c(q[K],oa[K],H),f(M.x,M.y,h+L);G=0;for(F=
|
|
|
|
+l.length;G<F;G++){z=l[G];Sa=ea[G];K=0;for(ha=z.length;K<ha;K++)M=c(z[K],Sa[K],H),r?f(M.x,M.y+p[s-1].y,p[s-1].x+L):f(M.x,M.y,h+L)}}if(n){i=0*P;for(K=0;K<ca;K++)h=T[K],g(h[2]+i,h[1]+i,h[0]+i,!0);i=P*(s+2*m);for(K=0;K<ca;K++)h=T[K],g(h[0]+i,h[1]+i,h[2]+i,!1)}else{for(K=0;K<ca;K++)h=T[K],g(h[2],h[1],h[0],!0);for(K=0;K<ca;K++)h=T[K],g(h[0]+P*s,h[1]+P*s,h[2]+P*s,!1)}h=0;e(q,h);h+=q.length;G=0;for(F=l.length;G<F;G++)z=l[G],e(z,h),h+=z.length};
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,
|
|
THREE.ExtrudeGeometry.WorldUVGenerator={generateTopUV:function(a,b,c,d,e,f){b=a.vertices[e].x;e=a.vertices[e].y;c=a.vertices[f].x;f=a.vertices[f].y;return[new THREE.Vector2(a.vertices[d].x,a.vertices[d].y),new THREE.Vector2(b,e),new THREE.Vector2(c,f)]},generateBottomUV:function(a,b,c,d,e,f){return this.generateTopUV(a,b,c,d,e,f)},generateSideWallUV:function(a,b,c,d,e,f,g,h){var b=a.vertices[e].x,c=a.vertices[e].y,e=a.vertices[e].z,d=a.vertices[f].x,i=a.vertices[f].y,f=a.vertices[f].z,k=a.vertices[g].x,
|
|
m=a.vertices[g].y,g=a.vertices[g].z,n=a.vertices[h].x,l=a.vertices[h].y,a=a.vertices[h].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-g),new THREE.Vector2(l,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
m=a.vertices[g].y,g=a.vertices[g].z,n=a.vertices[h].x,l=a.vertices[h].y,a=a.vertices[h].z;return 0.01>Math.abs(c-i)?[new THREE.Vector2(b,1-e),new THREE.Vector2(d,1-f),new THREE.Vector2(k,1-g),new THREE.Vector2(n,1-a)]:[new THREE.Vector2(c,1-e),new THREE.Vector2(i,1-f),new THREE.Vector2(m,1-g),new THREE.Vector2(l,1-a)]}};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;THREE.ShapeGeometry=function(a,b){THREE.Geometry.call(this);!1===a instanceof Array&&(a=[a]);this.shapebb=a[a.length-1].getBoundingBox();this.addShapeList(a,b);this.computeCentroids();this.computeFaceNormals()};THREE.ShapeGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ShapeGeometry.prototype.addShapeList=function(a,b){for(var c=0,d=a.length;c<d;c++)this.addShape(a[c],b);return this};
|
|
@@ -648,31 +647,27 @@ THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,k=0,m=a.length;k<m;k++)e(
|
|
k,m)),g.push([l,s,q]),g.push([s,p,q])):(f.push(new THREE.Face4(a,e,k,m)),g.push([l,s,p,q]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),g=f.length();f.x+=g*2E-6*(Math.random()-0.5);f.y+=g*2E-6*(Math.random()-0.5);f.z+=g*2E-6*(Math.random()-0.5);for(var g=[],h=0;h<c.length;){var i=c[h],k=f,m=a[i[0]],n;n=m;var l=a[i[1]],s=a[i[2]],q=new THREE.Vector3,p=new THREE.Vector3;q.sub(s,l);p.sub(n,l);q.crossSelf(p);q.normalize();n=q;m=n.dot(m);if(n.dot(k)>=
|
|
k,m)),g.push([l,s,q]),g.push([s,p,q])):(f.push(new THREE.Face4(a,e,k,m)),g.push([l,s,p,q]));this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ParametricGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.ConvexGeometry=function(a){function b(a){var b=a.length();return new THREE.Vector2(a.x/b,a.y/b)}THREE.Geometry.call(this);for(var c=[[0,1,2],[0,2,1]],d=3;d<a.length;d++){var e=d,f=a[e].clone(),g=f.length();f.x+=g*2E-6*(Math.random()-0.5);f.y+=g*2E-6*(Math.random()-0.5);f.z+=g*2E-6*(Math.random()-0.5);for(var g=[],h=0;h<c.length;){var i=c[h],k=f,m=a[i[0]],n;n=m;var l=a[i[1]],s=a[i[2]],q=new THREE.Vector3,p=new THREE.Vector3;q.sub(s,l);p.sub(n,l);q.crossSelf(p);q.normalize();n=q;m=n.dot(m);if(n.dot(k)>=
|
|
m){for(k=0;3>k;k++){m=[i[k],i[(k+1)%3]];n=!0;for(l=0;l<g.length;l++)if(g[l][0]===m[1]&&g[l][1]===m[0]){g[l]=g[g.length-1];g.pop();n=!1;break}n&&g.push(m)}c[h]=c[c.length-1];c.pop()}else h++}for(l=0;l<g.length;l++)c.push([g[l][0],g[l][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;3>h;h++)void 0===f[g[h]]&&(f[g[h]]=e++,this.vertices.push(a[g[h]])),g[h]=f[g[h]]}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=0;d<this.faces.length;d++)g=this.faces[d],
|
|
m){for(k=0;3>k;k++){m=[i[k],i[(k+1)%3]];n=!0;for(l=0;l<g.length;l++)if(g[l][0]===m[1]&&g[l][1]===m[0]){g[l]=g[g.length-1];g.pop();n=!1;break}n&&g.push(m)}c[h]=c[c.length-1];c.pop()}else h++}for(l=0;l<g.length;l++)c.push([g[l][0],g[l][1],e])}e=0;f=Array(a.length);for(d=0;d<c.length;d++){g=c[d];for(h=0;3>h;h++)void 0===f[g[h]]&&(f[g[h]]=e++,this.vertices.push(a[g[h]])),g[h]=f[g[h]]}for(d=0;d<c.length;d++)this.faces.push(new THREE.Face3(c[d][0],c[d][1],c[d][2]));for(d=0;d<this.faces.length;d++)g=this.faces[d],
|
|
this.faceVertexUvs[0].push([b(this.vertices[g.a]),b(this.vertices[g.b]),b(this.vertices[g.c])]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a||1,0,0),new THREE.Vector3,new THREE.Vector3(0,a||1,0),new THREE.Vector3,new THREE.Vector3(0,0,a||1));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
this.faceVertexUvs[0].push([b(this.vertices[g.a]),b(this.vertices[g.b]),b(this.vertices[g.c])]);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.ConvexGeometry.prototype=Object.create(THREE.Geometry.prototype);THREE.AxisHelper=function(a){var b=new THREE.Geometry;b.vertices.push(new THREE.Vector3,new THREE.Vector3(a||1,0,0),new THREE.Vector3,new THREE.Vector3(0,a||1,0),new THREE.Vector3,new THREE.Vector3(0,0,a||1));b.colors.push(new THREE.Color(16711680),new THREE.Color(16755200),new THREE.Color(65280),new THREE.Color(11206400),new THREE.Color(255),new THREE.Color(43775));a=new THREE.LineBasicMaterial({vertexColors:THREE.VertexColors});THREE.Line.call(this,b,a,THREE.LinePieces)};
|
|
-THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===d&&(d=16776960);void 0===c&&(c=20);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);b instanceof THREE.Vector3&&(this.position=
|
|
|
|
-b);this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(a){var b=(new THREE.Vector3(0,1,0)).crossSelf(a),a=Math.acos((new THREE.Vector3(0,1,0)).dot(a.clone().normalize()));this.matrix=(new THREE.Matrix4).makeRotationAxis(b.normalize(),a);this.rotation.setEulerFromRotationMatrix(this.matrix,this.eulerOrder)};THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};
|
|
|
|
-THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.geometry.vertices.push(new THREE.Vector3);d.geometry.colors.push(new THREE.Color(b));void 0===d.pointMap[a]&&(d.pointMap[a]=[]);d.pointMap[a].push(d.geometry.vertices.length-1)}THREE.Line.call(this);var d=this;this.geometry=new THREE.Geometry;this.material=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.type=THREE.LinePieces;this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=
|
|
|
|
|
|
+THREE.AxisHelper.prototype=Object.create(THREE.Line.prototype);THREE.ArrowHelper=function(a,b,c,d){THREE.Object3D.call(this);void 0===c&&(c=20);void 0===d&&(d=16776960);var e=new THREE.Geometry;e.vertices.push(new THREE.Vector3(0,0,0));e.vertices.push(new THREE.Vector3(0,1,0));this.line=new THREE.Line(e,new THREE.LineBasicMaterial({color:d}));this.add(this.line);e=new THREE.CylinderGeometry(0,0.05,0.25,5,1);this.cone=new THREE.Mesh(e,new THREE.MeshBasicMaterial({color:d}));this.cone.position.set(0,1,0);this.add(this.cone);b instanceof THREE.Vector3&&(this.position=
|
|
|
|
+b);this.setDirection(a);this.setLength(c)};THREE.ArrowHelper.prototype=Object.create(THREE.Object3D.prototype);THREE.ArrowHelper.prototype.setDirection=function(a){var b=THREE.ArrowHelper.__v1.copy(a).normalize();0.999<b.y?this.rotation.set(0,0,0):-0.999>b.y?this.rotation.set(Math.PI,0,0):(a=THREE.ArrowHelper.__v2.set(b.z,0,-b.x).normalize(),b=Math.acos(b.y),a=THREE.ArrowHelper.__q1.setFromAxisAngle(a,b),this.rotation.setEulerFromQuaternion(a,this.eulerOrder))};
|
|
|
|
+THREE.ArrowHelper.prototype.setLength=function(a){this.scale.set(a,a,a)};THREE.ArrowHelper.prototype.setColor=function(a){this.line.material.color.setHex(a);this.cone.material.color.setHex(a)};THREE.ArrowHelper.__v1=new THREE.Vector3;THREE.ArrowHelper.__v2=new THREE.Vector3;THREE.ArrowHelper.__q1=new THREE.Quaternion;THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.geometry.vertices.push(new THREE.Vector3);d.geometry.colors.push(new THREE.Color(b));void 0===d.pointMap[a]&&(d.pointMap[a]=[]);d.pointMap[a].push(d.geometry.vertices.length-1)}THREE.Line.call(this);var d=this;this.geometry=new THREE.Geometry;this.material=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.type=THREE.LinePieces;this.matrixWorld=a.matrixWorld;this.matrixAutoUpdate=!1;this.pointMap=
|
|
{};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1",
|
|
{};b("n1","n2",16755200);b("n2","n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1",
|
|
"cf2",3355443);b("cf3","cf4",3355443);this.camera=a;this.update(a)};THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);
|
|
"cf2",3355443);b("cf3","cf4",3355443);this.camera=a;this.update(a)};THREE.CameraHelper.prototype=Object.create(THREE.Line.prototype);
|
|
THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(void 0!==a){d=0;for(e=a.length;d<e;d++)b.geometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,1);
|
|
THREE.CameraHelper.prototype.update=function(){function a(a,d,e,f){THREE.CameraHelper.__v.set(d,e,f);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=b.pointMap[a];if(void 0!==a){d=0;for(e=a.length;d<e;d++)b.geometry.vertices[a[d]].copy(THREE.CameraHelper.__v)}}var b=this;THREE.CameraHelper.__c.projectionMatrix.copy(this.camera.projectionMatrix);a("c",0,0,-1);a("t",0,0,1);a("n1",-1,-1,-1);a("n2",1,-1,-1);a("n3",-1,1,-1);a("n4",1,1,-1);a("f1",-1,-1,1);
|
|
-a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.geometry.verticesNeedUpdate=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;THREE.DirectionalLightHelper=function(a,b,c){THREE.Object3D.call(this);this.light=a;this.position=a.position;this.direction=new THREE.Vector3;this.direction.sub(a.target.position,a.position);this.color=a.color.clone();var d=THREE.Math.clamp(a.intensity,0,1);this.color.r*=d;this.color.g*=d;this.color.b*=d;var d=this.color.getHex(),e=new THREE.SphereGeometry(b,16,8),f=new THREE.AsteriskGeometry(1.25*b,2.25*b),g=new THREE.MeshBasicMaterial({color:d,fog:!1}),h=new THREE.LineBasicMaterial({color:d,fog:!1});
|
|
|
|
-this.lightArrow=new THREE.ArrowHelper(this.direction,null,c,d);this.lightSphere=new THREE.Mesh(e,g);this.lightArrow.cone.material.fog=!1;this.lightArrow.line.material.fog=!1;this.lightRays=new THREE.Line(f,h,THREE.LinePieces);this.add(this.lightArrow);this.add(this.lightSphere);this.add(this.lightRays);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.targetSphere=null;a.target.properties.targetInverse&&(b=new THREE.SphereGeometry(b,
|
|
|
|
-8,4),c=new THREE.MeshBasicMaterial({color:d,wireframe:!0,fog:!1}),this.targetSphere=new THREE.Mesh(b,c),this.targetSphere.position=a.target.position,this.targetSphere.properties.isGizmo=!0,this.targetSphere.properties.gizmoSubject=a.target,this.targetSphere.properties.gizmoRoot=this.targetSphere,a=new THREE.LineDashedMaterial({color:d,dashSize:4,gapSize:4,opacity:0.75,transparent:!0,fog:!1}),d=new THREE.Geometry,d.vertices.push(this.position.clone()),d.vertices.push(this.targetSphere.position.clone()),
|
|
|
|
-d.computeLineDistances(),this.targetLine=new THREE.Line(d,a),this.targetLine.properties.isGizmo=!0);this.properties.isGizmo=!0};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
-THREE.DirectionalLightHelper.prototype.update=function(){this.direction.sub(this.light.target.position,this.light.position);this.lightArrow.setDirection(this.direction);this.color.copy(this.light.color);var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.r*=a;this.color.g*=a;this.color.b*=a;this.lightArrow.setColor(this.color.getHex());this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.targetSphere.material.color.copy(this.color);this.targetLine.material.color.copy(this.color);
|
|
|
|
-this.targetLine.geometry.vertices[0].copy(this.light.position);this.targetLine.geometry.vertices[1].copy(this.light.target.position);this.targetLine.geometry.computeLineDistances();this.targetLine.geometry.verticesNeedUpdate=!0};THREE.HemisphereLightHelper=function(a,b,c){THREE.Object3D.call(this);this.light=a;this.position=a.position;var d=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.r*=d;this.color.g*=d;this.color.b*=d;var e=this.color.getHex();this.groundColor=a.groundColor.clone();this.groundColor.r*=d;this.groundColor.g*=d;this.groundColor.b*=d;for(var d=this.groundColor.getHex(),f=new THREE.SphereGeometry(b,16,8,0,2*Math.PI,0,0.5*Math.PI),g=new THREE.SphereGeometry(b,16,8,0,2*Math.PI,0.5*
|
|
|
|
-Math.PI,Math.PI),h=new THREE.MeshBasicMaterial({color:e,fog:!1}),i=new THREE.MeshBasicMaterial({color:d,fog:!1}),k=0,m=f.faces.length;k<m;k++)f.faces[k].materialIndex=0;k=0;for(m=g.faces.length;k<m;k++)g.faces[k].materialIndex=1;THREE.GeometryUtils.merge(f,g);this.lightSphere=new THREE.Mesh(f,new THREE.MeshFaceMaterial([h,i]));this.lightArrow=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,1.1*(b+c),0),c,e);this.lightArrow.rotation.x=Math.PI;this.lightArrowGround=new THREE.ArrowHelper(new THREE.Vector3(0,
|
|
|
|
-1,0),new THREE.Vector3(0,-1.1*(b+c),0),c,d);b=new THREE.Object3D;b.rotation.x=0.5*-Math.PI;b.add(this.lightSphere);b.add(this.lightArrow);b.add(this.lightArrowGround);this.add(b);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.properties.isGizmo=!0;this.target=new THREE.Vector3;this.lookAt(this.target)};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
-THREE.HemisphereLightHelper.prototype.update=function(){var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.groundColor.copy(this.light.groundColor);this.color.r*=a;this.color.g*=a;this.color.b*=a;this.groundColor.r*=a;this.groundColor.g*=a;this.groundColor.b*=a;this.lightSphere.material.materials[0].color.copy(this.color);this.lightSphere.material.materials[1].color.copy(this.groundColor);this.lightArrow.setColor(this.color.getHex());this.lightArrowGround.setColor(this.groundColor.getHex());
|
|
|
|
-this.lookAt(this.target)};THREE.PointLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.position=a.position;this.color=a.color.clone();var c=THREE.Math.clamp(a.intensity,0,1);this.color.r*=c;this.color.g*=c;this.color.b*=c;var d=this.color.getHex(),c=new THREE.SphereGeometry(b,16,8),e=new THREE.AsteriskGeometry(1.25*b,2.25*b),f=new THREE.IcosahedronGeometry(1,2),g=new THREE.MeshBasicMaterial({color:d,fog:!1}),h=new THREE.LineBasicMaterial({color:d,fog:!1}),d=new THREE.MeshBasicMaterial({color:d,fog:!1,wireframe:!0,
|
|
|
|
-opacity:0.1,transparent:!0});this.lightSphere=new THREE.Mesh(c,g);this.lightRays=new THREE.Line(e,h,THREE.LinePieces);this.lightDistance=new THREE.Mesh(f,d);c=a.distance;0===c?this.lightDistance.visible=!1:this.lightDistance.scale.set(c,c,c);this.add(this.lightSphere);this.add(this.lightRays);this.add(this.lightDistance);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.properties.isGizmo=!0};
|
|
|
|
-THREE.PointLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
-THREE.PointLightHelper.prototype.update=function(){this.color.copy(this.light.color);var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.r*=a;this.color.g*=a;this.color.b*=a;this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.lightDistance.material.color.copy(this.color);a=this.light.distance;0===a?this.lightDistance.visible=!1:(this.lightDistance.visible=!0,this.lightDistance.scale.set(a,a,a))};THREE.SpotLightHelper=function(a,b,c){THREE.Object3D.call(this);this.light=a;this.position=a.position;this.direction=new THREE.Vector3;this.direction.sub(a.target.position,a.position);this.color=a.color.clone();var d=THREE.Math.clamp(a.intensity,0,1);this.color.r*=d;this.color.g*=d;this.color.b*=d;var d=this.color.getHex(),e=new THREE.SphereGeometry(b,16,8),f=new THREE.AsteriskGeometry(1.25*b,2.25*b),g=new THREE.CylinderGeometry(1E-4,1,1,8,1,!0),h=new THREE.Matrix4;h.rotateX(-Math.PI/2);h.translate(new THREE.Vector3(0,
|
|
|
|
--0.5,0));g.applyMatrix(h);var i=new THREE.MeshBasicMaterial({color:d,fog:!1}),h=new THREE.LineBasicMaterial({color:d,fog:!1}),k=new THREE.MeshBasicMaterial({color:d,fog:!1,wireframe:!0,opacity:0.3,transparent:!0});this.lightArrow=new THREE.ArrowHelper(this.direction,null,c,d);this.lightSphere=new THREE.Mesh(e,i);this.lightCone=new THREE.Mesh(g,k);c=a.distance?a.distance:1E4;e=2*c*Math.tan(0.5*a.angle);this.lightCone.scale.set(e,e,c);this.lightArrow.cone.material.fog=!1;this.lightArrow.line.material.fog=
|
|
|
|
-!1;this.lightRays=new THREE.Line(f,h,THREE.LinePieces);this.gyroscope=new THREE.Gyroscope;this.gyroscope.add(this.lightArrow);this.gyroscope.add(this.lightSphere);this.gyroscope.add(this.lightRays);this.add(this.gyroscope);this.add(this.lightCone);this.lookAt(a.target.position);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.targetSphere=null;a.target.properties.targetInverse&&(b=new THREE.SphereGeometry(b,8,4),f=new THREE.MeshBasicMaterial({color:d,
|
|
|
|
-wireframe:!0,fog:!1}),this.targetSphere=new THREE.Mesh(b,f),this.targetSphere.position=a.target.position,this.targetSphere.properties.isGizmo=!0,this.targetSphere.properties.gizmoSubject=a.target,this.targetSphere.properties.gizmoRoot=this.targetSphere,a=new THREE.LineDashedMaterial({color:d,dashSize:4,gapSize:4,opacity:0.75,transparent:!0,fog:!1}),d=new THREE.Geometry,d.vertices.push(this.position.clone()),d.vertices.push(this.targetSphere.position.clone()),d.computeLineDistances(),this.targetLine=
|
|
|
|
-new THREE.Line(d,a),this.targetLine.properties.isGizmo=!0);this.properties.isGizmo=!0};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
-THREE.SpotLightHelper.prototype.update=function(){this.direction.sub(this.light.target.position,this.light.position);this.lightArrow.setDirection(this.direction);this.lookAt(this.light.target.position);var a=this.light.distance?this.light.distance:1E4,b=2*a*Math.tan(0.5*this.light.angle);this.lightCone.scale.set(b,b,a);this.color.copy(this.light.color);a=THREE.Math.clamp(this.light.intensity,0,1);this.color.r*=a;this.color.g*=a;this.color.b*=a;this.lightArrow.setColor(this.color.getHex());this.lightSphere.material.color.copy(this.color);
|
|
|
|
-this.lightRays.material.color.copy(this.color);this.lightCone.material.color.copy(this.color);this.targetSphere.material.color.copy(this.color);this.targetLine.material.color.copy(this.color);this.targetLine.geometry.vertices[0].copy(this.light.position);this.targetLine.geometry.vertices[1].copy(this.light.target.position);this.targetLine.geometry.computeLineDistances();this.targetLine.geometry.verticesNeedUpdate=!0};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
|
|
+a("f2",1,-1,1);a("f3",-1,1,1);a("f4",1,1,1);a("u1",0.7,1.1,-1);a("u2",-0.7,1.1,-1);a("u3",0,2,-1);a("cf1",-1,0,1);a("cf2",1,0,1);a("cf3",0,-1,1);a("cf4",0,1,1);a("cn1",-1,0,-1);a("cn2",1,0,-1);a("cn3",0,-1,-1);a("cn4",0,1,-1);this.geometry.verticesNeedUpdate=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;THREE.DirectionalLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.position=a.position;this.direction=new THREE.Vector3;this.direction.sub(a.target.position,a.position);var c=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(c);var c=this.color.getHex(),d=new THREE.SphereGeometry(b,16,8),e=new THREE.AsteriskGeometry(1.25*b,2.25*b),f=new THREE.MeshBasicMaterial({color:c,fog:!1}),g=new THREE.LineBasicMaterial({color:c,fog:!1});this.lightSphere=
|
|
|
|
+new THREE.Mesh(d,f);this.lightRays=new THREE.Line(e,g,THREE.LinePieces);this.add(this.lightSphere);this.add(this.lightRays);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.targetSphere=null;a.target.properties.targetInverse&&(d=new THREE.SphereGeometry(b,8,4),e=new THREE.MeshBasicMaterial({color:c,wireframe:!0,fog:!1}),this.targetSphere=new THREE.Mesh(d,e),this.targetSphere.position=a.target.position,this.targetSphere.properties.isGizmo=
|
|
|
|
+!0,this.targetSphere.properties.gizmoSubject=a.target,this.targetSphere.properties.gizmoRoot=this.targetSphere,c=new THREE.LineDashedMaterial({color:c,dashSize:4,gapSize:4,opacity:0.75,transparent:!0,fog:!1}),d=new THREE.Geometry,d.vertices.push(this.position.clone()),d.vertices.push(this.targetSphere.position.clone()),d.computeLineDistances(),this.targetLine=new THREE.Line(d,c),this.targetLine.properties.isGizmo=!0);this.properties.isGizmo=!0};THREE.DirectionalLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
+THREE.DirectionalLightHelper.prototype.update=function(){this.direction.sub(this.light.target.position,this.light.position);var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.targetSphere.material.color.copy(this.color);this.targetLine.material.color.copy(this.color);this.targetLine.geometry.vertices[0].copy(this.light.position);this.targetLine.geometry.vertices[1].copy(this.light.target.position);
|
|
|
|
+this.targetLine.geometry.computeLineDistances();this.targetLine.geometry.verticesNeedUpdate=!0};THREE.HemisphereLightHelper=function(a,b,c){THREE.Object3D.call(this);this.light=a;this.position=a.position;var d=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(d);var e=this.color.getHex();this.groundColor=a.groundColor.clone();this.groundColor.multiplyScalar(d);for(var d=this.groundColor.getHex(),f=new THREE.SphereGeometry(b,16,8,0,2*Math.PI,0,0.5*Math.PI),g=new THREE.SphereGeometry(b,16,8,0,2*Math.PI,0.5*Math.PI,Math.PI),h=new THREE.MeshBasicMaterial({color:e,
|
|
|
|
+fog:!1}),i=new THREE.MeshBasicMaterial({color:d,fog:!1}),k=0,m=f.faces.length;k<m;k++)f.faces[k].materialIndex=0;k=0;for(m=g.faces.length;k<m;k++)g.faces[k].materialIndex=1;THREE.GeometryUtils.merge(f,g);this.lightSphere=new THREE.Mesh(f,new THREE.MeshFaceMaterial([h,i]));this.lightArrow=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,1.1*(b+c),0),c,e);this.lightArrow.rotation.x=Math.PI;this.lightArrowGround=new THREE.ArrowHelper(new THREE.Vector3(0,1,0),new THREE.Vector3(0,-1.1*
|
|
|
|
+(b+c),0),c,d);b=new THREE.Object3D;b.rotation.x=0.5*-Math.PI;b.add(this.lightSphere);b.add(this.lightArrow);b.add(this.lightArrowGround);this.add(b);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.properties.isGizmo=!0;this.target=new THREE.Vector3;this.lookAt(this.target)};THREE.HemisphereLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
+THREE.HemisphereLightHelper.prototype.update=function(){var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.groundColor.copy(this.light.groundColor);this.groundColor.multiplyScalar(a);this.lightSphere.material.materials[0].color.copy(this.color);this.lightSphere.material.materials[1].color.copy(this.groundColor);this.lightArrow.setColor(this.color.getHex());this.lightArrowGround.setColor(this.groundColor.getHex());this.lookAt(this.target)};THREE.PointLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.position=a.position;var c=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(c);var d=this.color.getHex(),c=new THREE.SphereGeometry(b,16,8),e=new THREE.AsteriskGeometry(1.25*b,2.25*b),f=new THREE.IcosahedronGeometry(1,2),g=new THREE.MeshBasicMaterial({color:d,fog:!1}),h=new THREE.LineBasicMaterial({color:d,fog:!1}),d=new THREE.MeshBasicMaterial({color:d,fog:!1,wireframe:!0,opacity:0.1,
|
|
|
|
+transparent:!0});this.lightSphere=new THREE.Mesh(c,g);this.lightRays=new THREE.Line(e,h,THREE.LinePieces);this.lightDistance=new THREE.Mesh(f,d);c=a.distance;0===c?this.lightDistance.visible=!1:this.lightDistance.scale.set(c,c,c);this.add(this.lightSphere);this.add(this.lightRays);this.add(this.lightDistance);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.properties.isGizmo=!0};THREE.PointLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
+THREE.PointLightHelper.prototype.update=function(){var a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.lightDistance.material.color.copy(this.color);a=this.light.distance;0===a?this.lightDistance.visible=!1:(this.lightDistance.visible=!0,this.lightDistance.scale.set(a,a,a))};THREE.SpotLightHelper=function(a,b){THREE.Object3D.call(this);this.light=a;this.position=a.position;this.direction=new THREE.Vector3;this.direction.sub(a.target.position,a.position);var c=THREE.Math.clamp(a.intensity,0,1);this.color=a.color.clone();this.color.multiplyScalar(c);var c=this.color.getHex(),d=new THREE.SphereGeometry(b,16,8),e=new THREE.AsteriskGeometry(1.25*b,2.25*b),f=new THREE.CylinderGeometry(1E-4,1,1,8,1,!0),g=new THREE.Matrix4;g.rotateX(-Math.PI/2);g.translate(new THREE.Vector3(0,
|
|
|
|
+-0.5,0));f.applyMatrix(g);var h=new THREE.MeshBasicMaterial({color:c,fog:!1}),g=new THREE.LineBasicMaterial({color:c,fog:!1}),i=new THREE.MeshBasicMaterial({color:c,fog:!1,wireframe:!0,opacity:0.3,transparent:!0});this.lightSphere=new THREE.Mesh(d,h);this.lightCone=new THREE.Mesh(f,i);d=a.distance?a.distance:1E4;f=2*d*Math.tan(0.5*a.angle);this.lightCone.scale.set(f,f,d);this.lightRays=new THREE.Line(e,g,THREE.LinePieces);this.gyroscope=new THREE.Gyroscope;this.gyroscope.add(this.lightSphere);this.gyroscope.add(this.lightRays);
|
|
|
|
+this.add(this.gyroscope);this.add(this.lightCone);this.lookAt(a.target.position);this.lightSphere.properties.isGizmo=!0;this.lightSphere.properties.gizmoSubject=a;this.lightSphere.properties.gizmoRoot=this;this.targetSphere=null;a.target.properties.targetInverse&&(e=new THREE.SphereGeometry(b,8,4),g=new THREE.MeshBasicMaterial({color:c,wireframe:!0,fog:!1}),this.targetSphere=new THREE.Mesh(e,g),this.targetSphere.position=a.target.position,this.targetSphere.properties.isGizmo=!0,this.targetSphere.properties.gizmoSubject=
|
|
|
|
+a.target,this.targetSphere.properties.gizmoRoot=this.targetSphere,c=new THREE.LineDashedMaterial({color:c,dashSize:4,gapSize:4,opacity:0.75,transparent:!0,fog:!1}),e=new THREE.Geometry,e.vertices.push(this.position.clone()),e.vertices.push(this.targetSphere.position.clone()),e.computeLineDistances(),this.targetLine=new THREE.Line(e,c),this.targetLine.properties.isGizmo=!0);this.properties.isGizmo=!0};THREE.SpotLightHelper.prototype=Object.create(THREE.Object3D.prototype);
|
|
|
|
+THREE.SpotLightHelper.prototype.update=function(){this.direction.sub(this.light.target.position,this.light.position);this.lookAt(this.light.target.position);var a=this.light.distance?this.light.distance:1E4,b=2*a*Math.tan(0.5*this.light.angle);this.lightCone.scale.set(b,b,a);a=THREE.Math.clamp(this.light.intensity,0,1);this.color.copy(this.light.color);this.color.multiplyScalar(a);this.lightSphere.material.color.copy(this.color);this.lightRays.material.color.copy(this.color);this.lightCone.material.color.copy(this.color);
|
|
|
|
+this.targetSphere.material.color.copy(this.color);this.targetLine.material.color.copy(this.color);this.targetLine.geometry.vertices[0].copy(this.light.position);this.targetLine.geometry.vertices[1].copy(this.light.target.position);this.targetLine.geometry.computeLineDistances();this.targetLine.geometry.verticesNeedUpdate=!0};THREE.ImmediateRenderObject=function(){THREE.Object3D.call(this);this.render=function(){}};THREE.ImmediateRenderObject.prototype=Object.create(THREE.Object3D.prototype);THREE.LensFlare=function(a,b,c,d,e){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,e)};THREE.LensFlare.prototype=Object.create(THREE.Object3D.prototype);
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
THREE.LensFlare.prototype.add=function(a,b,c,d,e,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===e&&(e=new THREE.Color(16777215));void 0===d&&(d=THREE.NormalBlending);c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:e,blending:d})};
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);
|
|
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,e=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+e*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};THREE.MorphBlendMesh=function(a,b){THREE.Mesh.call(this,a,b);this.animationsMap={};this.animationsList=[];var c=this.geometry.morphTargets.length;this.createAnimation("__default",0,c-1,c/1);this.setAnimationWeight("__default",1)};THREE.MorphBlendMesh.prototype=Object.create(THREE.Mesh.prototype);
|
|
THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
|
|
THREE.MorphBlendMesh.prototype.createAnimation=function(a,b,c,d){b={startFrame:b,endFrame:c,length:c-b+1,fps:d,duration:(c-b)/d,lastFrame:0,currentFrame:0,active:!1,time:0,direction:1,weight:1,directionBackwards:!1,mirroredLoop:!1};this.animationsMap[a]=b;this.animationsList.push(b)};
|
|
@@ -685,29 +680,29 @@ f!==d.currentFrame&&(this.morphTargetInfluences[d.lastFrame]=0,this.morphTargetI
|
|
e[q++]=0;e[q++]=0;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;q=0;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
e[q++]=0;e[q++]=0;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=1;e[q++]=-1;e[q++]=1;e[q++]=0;e[q++]=1;q=0;f[q++]=0;f[q++]=1;f[q++]=2;f[q++]=0;f[q++]=2;f[q++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,n=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));l={};s={};l.vertex=b.getAttribLocation(n,"position");l.uv=b.getAttribLocation(n,"uv");s.renderType=b.getUniformLocation(n,"renderType");s.map=b.getUniformLocation(n,"map");s.occlusionMap=b.getUniformLocation(n,"occlusionMap");s.opacity=
|
|
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(m=!1,n=a(THREE.ShaderFlares.lensFlare,d)):(m=!0,n=a(THREE.ShaderFlares.lensFlareVertexTexture,d));l={};s={};l.vertex=b.getAttribLocation(n,"position");l.uv=b.getAttribLocation(n,"uv");s.renderType=b.getUniformLocation(n,"renderType");s.map=b.getUniformLocation(n,"map");s.occlusionMap=b.getUniformLocation(n,"occlusionMap");s.opacity=
|
|
-b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scale=b.getUniformLocation(n,"scale");s.rotation=b.getUniformLocation(n,"rotation");s.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,x=a.length;if(x){var w=new THREE.Vector3,t=f/e,J=0.5*e,E=0.5*f,C=16/f,z=new THREE.Vector2(C*t,C),G=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),I=s,C=l;b.useProgram(n);b.enableVertexAttribArray(l.vertex);b.enableVertexAttribArray(l.uv);
|
|
|
|
-b.uniform1i(I.occlusionMap,0);b.uniform1i(I.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(C.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var $,B,R,A,H;for($=0;$<x;$++)if(C=16/f,z.set(C*t,C),A=a[$],w.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]),w.applyMatrix4(d.matrixWorldInverse),w.applyMatrix4(d.projectionMatrix),G.copy(w),F.x=G.x*J+J,F.y=
|
|
|
|
-G.y*E+E,m||0<F.x&&F.x<e&&0<F.y&&F.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(I.renderType,0);b.uniform2f(I.scale,z.x,z.y);b.uniform3f(I.screenPosition,G.x,G.y,G.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(I.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
|
-b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(G);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(I.renderType,2);b.enable(b.BLEND);B=0;for(R=A.lensFlares.length;B<R;B++)H=A.lensFlares[B],0.001<H.opacity&&0.001<H.scale&&(G.x=H.x,G.y=H.y,G.z=H.z,C=H.size*H.scale/f,z.x=C*t,z.y=C,b.uniform3f(I.screenPosition,G.x,G.y,G.z),b.uniform2f(I.scale,z.x,z.y),b.uniform1f(I.rotation,H.rotation),b.uniform1f(I.opacity,
|
|
|
|
-H.opacity),b.uniform3f(I.color,H.color.r,H.color.g,H.color.b),c.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),c.setTexture(H.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
|
-vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,n){var l,s,q,p,r,v,x,w,t,J=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
|
|
|
|
+b.getUniformLocation(n,"opacity");s.color=b.getUniformLocation(n,"color");s.scale=b.getUniformLocation(n,"scale");s.rotation=b.getUniformLocation(n,"rotation");s.screenPosition=b.getUniformLocation(n,"screenPosition")};this.render=function(a,d,e,f){var a=a.__webglFlares,x=a.length;if(x){var v=new THREE.Vector3,t=f/e,I=0.5*e,E=0.5*f,C=16/f,z=new THREE.Vector2(C*t,C),G=new THREE.Vector3(1,1,0),F=new THREE.Vector2(1,1),J=s,C=l;b.useProgram(n);b.enableVertexAttribArray(l.vertex);b.enableVertexAttribArray(l.uv);
|
|
|
|
+b.uniform1i(J.occlusionMap,0);b.uniform1i(J.map,1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(C.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(C.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var V,B,T,A,H;for(V=0;V<x;V++)if(C=16/f,z.set(C*t,C),A=a[V],v.set(A.matrixWorld.elements[12],A.matrixWorld.elements[13],A.matrixWorld.elements[14]),v.applyMatrix4(d.matrixWorldInverse),v.applyMatrix4(d.projectionMatrix),G.copy(v),F.x=G.x*I+I,F.y=
|
|
|
|
+G.y*E+E,m||0<F.x&&F.x<e&&0<F.y&&F.y<f){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,F.x-8,F.y-8,16,16,0);b.uniform1i(J.renderType,0);b.uniform2f(J.scale,z.x,z.y);b.uniform3f(J.screenPosition,G.x,G.y,G.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,F.x-8,F.y-8,16,16,0);b.uniform1i(J.renderType,1);b.disable(b.DEPTH_TEST);
|
|
|
|
+b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);A.positionScreen.copy(G);A.customUpdateCallback?A.customUpdateCallback(A):A.updateLensFlares();b.uniform1i(J.renderType,2);b.enable(b.BLEND);B=0;for(T=A.lensFlares.length;B<T;B++)H=A.lensFlares[B],0.001<H.opacity&&0.001<H.scale&&(G.x=H.x,G.y=H.y,G.z=H.z,C=H.size*H.scale/f,z.x=C*t,z.y=C,b.uniform3f(J.screenPosition,G.x,G.y,G.z),b.uniform2f(J.scale,z.x,z.y),b.uniform1f(J.rotation,H.rotation),b.uniform1f(J.opacity,
|
|
|
|
+H.opacity),b.uniform3f(J.color,H.color.r,H.color.g,H.color.b),c.setBlending(H.blending,H.blendEquation,H.blendSrc,H.blendDst),c.setTexture(H.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0))}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};THREE.ShadowMapPlugin=function(){var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4,i=new THREE.Vector3,k=new THREE.Vector3;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
|
|
+vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(m,n){var l,s,q,p,r,w,x,v,t,I=[];p=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);a.enable(a.CULL_FACE);a.frontFace(a.CCW);b.shadowMapCullFace===THREE.CullFaceFront?
|
|
a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);l=0;for(s=m.__lights.length;l<s;l++)if(q=m.__lights[l],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(r=0;r<q.shadowCascadeCount;r++){var E;if(q.shadowCascadeArray[r])E=q.shadowCascadeArray[r];else{t=q;x=r;E=new THREE.DirectionalLight;E.isVirtual=!0;E.onlyShadow=!0;E.castShadow=!0;E.shadowCameraNear=t.shadowCameraNear;E.shadowCameraFar=t.shadowCameraFar;E.shadowCameraLeft=t.shadowCameraLeft;E.shadowCameraRight=t.shadowCameraRight;
|
|
a.cullFace(a.FRONT):a.cullFace(a.BACK);b.setDepthTest(!0);l=0;for(s=m.__lights.length;l<s;l++)if(q=m.__lights[l],q.castShadow)if(q instanceof THREE.DirectionalLight&&q.shadowCascade)for(r=0;r<q.shadowCascadeCount;r++){var E;if(q.shadowCascadeArray[r])E=q.shadowCascadeArray[r];else{t=q;x=r;E=new THREE.DirectionalLight;E.isVirtual=!0;E.onlyShadow=!0;E.castShadow=!0;E.shadowCameraNear=t.shadowCameraNear;E.shadowCameraFar=t.shadowCameraFar;E.shadowCameraLeft=t.shadowCameraLeft;E.shadowCameraRight=t.shadowCameraRight;
|
|
-E.shadowCameraBottom=t.shadowCameraBottom;E.shadowCameraTop=t.shadowCameraTop;E.shadowCameraVisible=t.shadowCameraVisible;E.shadowDarkness=t.shadowDarkness;E.shadowBias=t.shadowCascadeBias[x];E.shadowMapWidth=t.shadowCascadeWidth[x];E.shadowMapHeight=t.shadowCascadeHeight[x];E.pointsWorld=[];E.pointsFrustum=[];w=E.pointsWorld;v=E.pointsFrustum;for(var C=0;8>C;C++)w[C]=new THREE.Vector3,v[C]=new THREE.Vector3;w=t.shadowCascadeNearZ[x];t=t.shadowCascadeFarZ[x];v[0].set(-1,-1,w);v[1].set(1,-1,w);v[2].set(-1,
|
|
|
|
-1,w);v[3].set(1,1,w);v[4].set(-1,-1,t);v[5].set(1,-1,t);v[6].set(-1,1,t);v[7].set(1,1,t);E.originalCamera=n;v=new THREE.Gyroscope;v.position=q.shadowCascadeOffset;v.add(E);v.add(E.target);n.add(v);q.shadowCascadeArray[r]=E;console.log("Created virtualLight",E)}x=q;w=r;t=x.shadowCascadeArray[w];t.position.copy(x.position);t.target.position.copy(x.target.position);t.lookAt(t.target);t.shadowCameraVisible=x.shadowCameraVisible;t.shadowDarkness=x.shadowDarkness;t.shadowBias=x.shadowCascadeBias[w];v=x.shadowCascadeNearZ[w];
|
|
|
|
-x=x.shadowCascadeFarZ[w];t=t.pointsFrustum;t[0].z=v;t[1].z=v;t[2].z=v;t[3].z=v;t[4].z=x;t[5].z=x;t[6].z=x;t[7].z=x;J[p]=E;p++}else J[p]=q,p++;l=0;for(s=J.length;l<s;l++){q=J[l];q.shadowMap||(r=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(r=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:r,magFilter:r,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
|
|
|
|
+E.shadowCameraBottom=t.shadowCameraBottom;E.shadowCameraTop=t.shadowCameraTop;E.shadowCameraVisible=t.shadowCameraVisible;E.shadowDarkness=t.shadowDarkness;E.shadowBias=t.shadowCascadeBias[x];E.shadowMapWidth=t.shadowCascadeWidth[x];E.shadowMapHeight=t.shadowCascadeHeight[x];E.pointsWorld=[];E.pointsFrustum=[];v=E.pointsWorld;w=E.pointsFrustum;for(var C=0;8>C;C++)v[C]=new THREE.Vector3,w[C]=new THREE.Vector3;v=t.shadowCascadeNearZ[x];t=t.shadowCascadeFarZ[x];w[0].set(-1,-1,v);w[1].set(1,-1,v);w[2].set(-1,
|
|
|
|
+1,v);w[3].set(1,1,v);w[4].set(-1,-1,t);w[5].set(1,-1,t);w[6].set(-1,1,t);w[7].set(1,1,t);E.originalCamera=n;w=new THREE.Gyroscope;w.position=q.shadowCascadeOffset;w.add(E);w.add(E.target);n.add(w);q.shadowCascadeArray[r]=E;console.log("Created virtualLight",E)}x=q;v=r;t=x.shadowCascadeArray[v];t.position.copy(x.position);t.target.position.copy(x.target.position);t.lookAt(t.target);t.shadowCameraVisible=x.shadowCameraVisible;t.shadowDarkness=x.shadowDarkness;t.shadowBias=x.shadowCascadeBias[v];w=x.shadowCascadeNearZ[v];
|
|
|
|
+x=x.shadowCascadeFarZ[v];t=t.pointsFrustum;t[0].z=w;t[1].z=w;t[2].z=w;t[3].z=w;t[4].z=x;t[5].z=x;t[6].z=x;t[7].z=x;I[p]=E;p++}else I[p]=q,p++;l=0;for(s=I.length;l<s;l++){q=I[l];q.shadowMap||(r=THREE.LinearFilter,b.shadowMapType===THREE.PCFSoftShadowMap&&(r=THREE.NearestFilter),q.shadowMap=new THREE.WebGLRenderTarget(q.shadowMapWidth,q.shadowMapHeight,{minFilter:r,magFilter:r,format:THREE.RGBAFormat}),q.shadowMapSize=new THREE.Vector2(q.shadowMapWidth,q.shadowMapHeight),q.shadowMatrix=new THREE.Matrix4);
|
|
if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(q.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}q.shadowCameraVisible&&
|
|
if(!q.shadowCamera){if(q instanceof THREE.SpotLight)q.shadowCamera=new THREE.PerspectiveCamera(q.shadowCameraFov,q.shadowMapWidth/q.shadowMapHeight,q.shadowCameraNear,q.shadowCameraFar);else if(q instanceof THREE.DirectionalLight)q.shadowCamera=new THREE.OrthographicCamera(q.shadowCameraLeft,q.shadowCameraRight,q.shadowCameraTop,q.shadowCameraBottom,q.shadowCameraNear,q.shadowCameraFar);else{console.error("Unsupported light type for shadow");continue}m.add(q.shadowCamera);b.autoUpdateScene&&m.updateMatrixWorld()}q.shadowCameraVisible&&
|
|
-!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&E.originalCamera==n){r=n;p=q.shadowCamera;v=q.pointsFrustum;t=q.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)w=t[x],w.copy(v[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(w,r),w.applyMatrix4(p.matrixWorldInverse),w.x<i.x&&(i.x=w.x),w.x>k.x&&(k.x=w.x),w.y<i.y&&(i.y=w.y),w.y>k.y&&(k.y=w.y),w.z<i.z&&(i.z=w.z),w.z>k.z&&
|
|
|
|
-(k.z=w.z);p.left=i.x;p.right=k.x;p.top=k.y;p.bottom=i.y;p.updateProjectionMatrix()}p=q.shadowMap;v=q.shadowMatrix;r=q.shadowCamera;r.position.copy(q.matrixWorld.getPosition());r.lookAt(q.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(r.projectionMatrix);v.multiplySelf(r.matrixWorldInverse);
|
|
|
|
-h.multiply(r.projectionMatrix,r.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(p);b.clear();t=m.__webglObjects;q=0;for(p=t.length;q<p;q++)if(x=t[q],v=x.object,x.render=!1,v.visible&&v.castShadow&&(!(v instanceof THREE.Mesh||v instanceof THREE.ParticleSystem)||!v.frustumCulled||g.intersectsObject(v)))v._modelViewMatrix.multiply(r.matrixWorldInverse,v.matrixWorld),x.render=!0;q=0;for(p=t.length;q<p;q++)x=t[q],x.render&&(v=x.object,x=x.buffer,C=v.material instanceof THREE.MeshFaceMaterial?
|
|
|
|
-v.material.materials[0]:v.material,w=0<v.geometry.morphTargets.length&&C.morphTargets,C=v instanceof THREE.SkinnedMesh&&C.skinning,w=v.customDepthMaterial?v.customDepthMaterial:C?w?f:e:w?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(r,m.__lights,null,w,x,v):b.renderBuffer(r,m.__lights,null,w,x,v));t=m.__webglObjectsImmediate;q=0;for(p=t.length;q<p;q++)x=t[q],v=x.object,v.visible&&v.castShadow&&(v._modelViewMatrix.multiply(r.matrixWorldInverse,v.matrixWorld),b.renderImmediateObject(r,
|
|
|
|
-m.__lights,null,c,v))}l=b.getClearColor();s=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,s);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,k,m;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,
|
|
|
|
|
|
+!q.cameraHelper&&(q.cameraHelper=new THREE.CameraHelper(q.shadowCamera),q.shadowCamera.add(q.cameraHelper));if(q.isVirtual&&E.originalCamera==n){r=n;p=q.shadowCamera;w=q.pointsFrustum;t=q.pointsWorld;i.set(Infinity,Infinity,Infinity);k.set(-Infinity,-Infinity,-Infinity);for(x=0;8>x;x++)v=t[x],v.copy(w[x]),THREE.ShadowMapPlugin.__projector.unprojectVector(v,r),v.applyMatrix4(p.matrixWorldInverse),v.x<i.x&&(i.x=v.x),v.x>k.x&&(k.x=v.x),v.y<i.y&&(i.y=v.y),v.y>k.y&&(k.y=v.y),v.z<i.z&&(i.z=v.z),v.z>k.z&&
|
|
|
|
+(k.z=v.z);p.left=i.x;p.right=k.x;p.top=k.y;p.bottom=i.y;p.updateProjectionMatrix()}p=q.shadowMap;w=q.shadowMatrix;r=q.shadowCamera;r.position.copy(q.matrixWorld.getPosition());r.lookAt(q.target.matrixWorld.getPosition());r.updateMatrixWorld();r.matrixWorldInverse.getInverse(r.matrixWorld);q.cameraHelper&&(q.cameraHelper.visible=q.shadowCameraVisible);q.shadowCameraVisible&&q.cameraHelper.update();w.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf(r.projectionMatrix);w.multiplySelf(r.matrixWorldInverse);
|
|
|
|
+h.multiply(r.projectionMatrix,r.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(p);b.clear();t=m.__webglObjects;q=0;for(p=t.length;q<p;q++)if(x=t[q],w=x.object,x.render=!1,w.visible&&w.castShadow&&(!(w instanceof THREE.Mesh||w instanceof THREE.ParticleSystem)||!w.frustumCulled||g.intersectsObject(w)))w._modelViewMatrix.multiply(r.matrixWorldInverse,w.matrixWorld),x.render=!0;q=0;for(p=t.length;q<p;q++)x=t[q],x.render&&(w=x.object,x=x.buffer,C=w.material instanceof THREE.MeshFaceMaterial?
|
|
|
|
+w.material.materials[0]:w.material,v=0<w.geometry.morphTargets.length&&C.morphTargets,C=w instanceof THREE.SkinnedMesh&&C.skinning,v=w.customDepthMaterial?w.customDepthMaterial:C?v?f:e:v?d:c,x instanceof THREE.BufferGeometry?b.renderBufferDirect(r,m.__lights,null,v,x,w):b.renderBuffer(r,m.__lights,null,v,x,w));t=m.__webglObjectsImmediate;q=0;for(p=t.length;q<p;q++)x=t[q],w=x.object,w.visible&&w.castShadow&&(w._modelViewMatrix.multiply(r.matrixWorldInverse,w.matrixWorld),b.renderImmediateObject(r,
|
|
|
|
+m.__lights,null,c,w))}l=b.getClearColor();s=b.getClearAlpha();a.clearColor(l.r,l.g,l.b,s);a.enable(a.BLEND);b.shadowMapCullFace===THREE.CullFaceFront&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;THREE.SpritePlugin=function(){function a(a,b){return a.z!==b.z?b.z-a.z:b.id-a.id}var b,c,d,e,f,g,h,i,k,m;this.init=function(a){b=a.context;c=a;d=a.getPrecision();e=new Float32Array(16);f=new Uint16Array(6);a=0;e[a++]=-1;e[a++]=-1;e[a++]=0;e[a++]=0;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=1;e[a++]=-1;e[a++]=1;e[a++]=0;e[a++]=1;a=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,
|
|
e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(s,p+a.fragmentShader);b.shaderSource(q,p+a.vertexShader);b.compileShader(s);b.compileShader(q);b.attachShader(l,s);b.attachShader(l,q);b.linkProgram(l);i=l;k={};m={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
|
|
e,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,l=b.createProgram(),s=b.createShader(b.FRAGMENT_SHADER),q=b.createShader(b.VERTEX_SHADER),p="precision "+d+" float;\n";b.shaderSource(s,p+a.fragmentShader);b.shaderSource(q,p+a.vertexShader);b.compileShader(s);b.compileShader(q);b.attachShader(l,s);b.attachShader(l,q);b.linkProgram(l);i=l;k={};m={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,
|
|
"uv");m.uvOffset=b.getUniformLocation(i,"uvOffset");m.uvScale=b.getUniformLocation(i,"uvScale");m.rotation=b.getUniformLocation(i,"rotation");m.scale=b.getUniformLocation(i,"scale");m.alignment=b.getUniformLocation(i,"alignment");m.color=b.getUniformLocation(i,"color");m.map=b.getUniformLocation(i,"map");m.opacity=b.getUniformLocation(i,"opacity");m.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");m.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");m.screenPosition=b.getUniformLocation(i,
|
|
"uv");m.uvOffset=b.getUniformLocation(i,"uvOffset");m.uvScale=b.getUniformLocation(i,"uvScale");m.rotation=b.getUniformLocation(i,"rotation");m.scale=b.getUniformLocation(i,"scale");m.alignment=b.getUniformLocation(i,"alignment");m.color=b.getUniformLocation(i,"color");m.map=b.getUniformLocation(i,"map");m.opacity=b.getUniformLocation(i,"opacity");m.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");m.sizeAttenuation=b.getUniformLocation(i,"sizeAttenuation");m.screenPosition=b.getUniformLocation(i,
|
|
-"screenPosition");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");m.fogType=b.getUniformLocation(i,"fogType");m.fogDensity=b.getUniformLocation(i,"fogDensity");m.fogNear=b.getUniformLocation(i,"fogNear");m.fogFar=b.getUniformLocation(i,"fogFar");m.fogColor=b.getUniformLocation(i,"fogColor");m.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,q){var p=d.__webglSprites,r=p.length;if(r){var v=k,x=m,w=q/
|
|
|
|
-f,f=0.5*f,t=0.5*q;b.useProgram(i);b.enableVertexAttribArray(v.position);b.enableVertexAttribArray(v.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(v.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(v.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(x.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(x.map,0);var J=v=0,E=d.fog;E?(b.uniform3f(x.fogColor,E.color.r,E.color.g,E.color.b),
|
|
|
|
-E instanceof THREE.Fog?(b.uniform1f(x.fogNear,E.near),b.uniform1f(x.fogFar,E.far),b.uniform1i(x.fogType,1),J=v=1):E instanceof THREE.FogExp2&&(b.uniform1f(x.fogDensity,E.density),b.uniform1i(x.fogType,2),J=v=2)):(b.uniform1i(x.fogType,0),J=v=0);for(var C,z,G=[],E=0;E<r;E++)C=p[E],z=C.material,C.visible&&0!==z.opacity&&(z.useScreenCoordinates?C.z=-C.position.z:(C._modelViewMatrix.multiply(e.matrixWorldInverse,C.matrixWorld),C.z=-C._modelViewMatrix.elements[14]));p.sort(a);for(E=0;E<r;E++)C=p[E],z=
|
|
|
|
|
|
+"screenPosition");m.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");m.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");m.fogType=b.getUniformLocation(i,"fogType");m.fogDensity=b.getUniformLocation(i,"fogDensity");m.fogNear=b.getUniformLocation(i,"fogNear");m.fogFar=b.getUniformLocation(i,"fogFar");m.fogColor=b.getUniformLocation(i,"fogColor");m.alphaTest=b.getUniformLocation(i,"alphaTest")};this.render=function(d,e,f,q){var p=d.__webglSprites,r=p.length;if(r){var w=k,x=m,v=q/
|
|
|
|
+f,f=0.5*f,t=0.5*q;b.useProgram(i);b.enableVertexAttribArray(w.position);b.enableVertexAttribArray(w.uv);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(w.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(w.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(x.projectionMatrix,!1,e.projectionMatrix.elements);b.activeTexture(b.TEXTURE0);b.uniform1i(x.map,0);var I=w=0,E=d.fog;E?(b.uniform3f(x.fogColor,E.color.r,E.color.g,E.color.b),
|
|
|
|
+E instanceof THREE.Fog?(b.uniform1f(x.fogNear,E.near),b.uniform1f(x.fogFar,E.far),b.uniform1i(x.fogType,1),I=w=1):E instanceof THREE.FogExp2&&(b.uniform1f(x.fogDensity,E.density),b.uniform1i(x.fogType,2),I=w=2)):(b.uniform1i(x.fogType,0),I=w=0);for(var C,z,G=[],E=0;E<r;E++)C=p[E],z=C.material,C.visible&&0!==z.opacity&&(z.useScreenCoordinates?C.z=-C.position.z:(C._modelViewMatrix.multiply(e.matrixWorldInverse,C.matrixWorld),C.z=-C._modelViewMatrix.elements[14]));p.sort(a);for(E=0;E<r;E++)C=p[E],z=
|
|
C.material,C.visible&&0!==z.opacity&&(z.map&&z.map.image&&z.map.image.width)&&(b.uniform1f(x.alphaTest,z.alphaTest),!0===z.useScreenCoordinates?(b.uniform1i(x.useScreenCoordinates,1),b.uniform3f(x.screenPosition,(C.position.x*c.devicePixelRatio-f)/f,(t-C.position.y*c.devicePixelRatio)/t,Math.max(0,Math.min(1,C.position.z))),G[0]=c.devicePixelRatio,G[1]=c.devicePixelRatio):(b.uniform1i(x.useScreenCoordinates,0),b.uniform1i(x.sizeAttenuation,z.sizeAttenuation?1:0),b.uniformMatrix4fv(x.modelViewMatrix,
|
|
C.material,C.visible&&0!==z.opacity&&(z.map&&z.map.image&&z.map.image.width)&&(b.uniform1f(x.alphaTest,z.alphaTest),!0===z.useScreenCoordinates?(b.uniform1i(x.useScreenCoordinates,1),b.uniform3f(x.screenPosition,(C.position.x*c.devicePixelRatio-f)/f,(t-C.position.y*c.devicePixelRatio)/t,Math.max(0,Math.min(1,C.position.z))),G[0]=c.devicePixelRatio,G[1]=c.devicePixelRatio):(b.uniform1i(x.useScreenCoordinates,0),b.uniform1i(x.sizeAttenuation,z.sizeAttenuation?1:0),b.uniformMatrix4fv(x.modelViewMatrix,
|
|
-!1,C._modelViewMatrix.elements),G[0]=1,G[1]=1),e=d.fog&&z.fog?J:0,v!==e&&(b.uniform1i(x.fogType,e),v=e),e=1/(z.scaleByViewport?q:1),G[0]*=e*w*C.scale.x,G[1]*=e*C.scale.y,b.uniform2f(x.uvScale,z.uvScale.x,z.uvScale.y),b.uniform2f(x.uvOffset,z.uvOffset.x,z.uvOffset.y),b.uniform2f(x.alignment,z.alignment.x,z.alignment.y),b.uniform1f(x.opacity,z.opacity),b.uniform3f(x.color,z.color.r,z.color.g,z.color.b),b.uniform1f(x.rotation,C.rotation),b.uniform2fv(x.scale,G),c.setBlending(z.blending,z.blendEquation,
|
|
|
|
|
|
+!1,C._modelViewMatrix.elements),G[0]=1,G[1]=1),e=d.fog&&z.fog?I:0,w!==e&&(b.uniform1i(x.fogType,e),w=e),e=1/(z.scaleByViewport?q:1),G[0]*=e*v*C.scale.x,G[1]*=e*C.scale.y,b.uniform2f(x.uvScale,z.uvScale.x,z.uvScale.y),b.uniform2f(x.uvOffset,z.uvOffset.x,z.uvOffset.y),b.uniform2f(x.alignment,z.alignment.x,z.alignment.y),b.uniform1f(x.opacity,z.opacity),b.uniform3f(x.color,z.color.r,z.color.g,z.color.b),b.uniform1f(x.rotation,C.rotation),b.uniform2fv(x.scale,G),c.setBlending(z.blending,z.blendEquation,
|
|
z.blendSrc,z.blendDst),c.setDepthTest(z.depthTest),c.setDepthWrite(z.depthWrite),c.setTexture(z.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
z.blendSrc,z.blendDst),c.setDepthTest(z.depthTest),c.setDepthWrite(z.depthWrite),c.setTexture(z.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE)}}};THREE.DepthPassPlugin=function(){this.enabled=!1;this.renderTarget=null;var a,b,c,d,e,f,g=new THREE.Frustum,h=new THREE.Matrix4;this.init=function(g){a=g.context;b=g;var g=THREE.ShaderLib.depthRGBA,h=THREE.UniformsUtils.clone(g.uniforms);c=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h});d=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0});e=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var m,n,l,s,q,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);h.multiply(k.projectionMatrix,
|
|
vertexShader:g.vertexShader,uniforms:h,skinning:!0});f=new THREE.ShaderMaterial({fragmentShader:g.fragmentShader,vertexShader:g.vertexShader,uniforms:h,morphTargets:!0,skinning:!0});c._shadowPass=!0;d._shadowPass=!0;e._shadowPass=!0;f._shadowPass=!0};this.render=function(a,b){this.enabled&&this.update(a,b)};this.update=function(i,k){var m,n,l,s,q,p;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.setDepthTest(!0);b.autoUpdateScene&&i.updateMatrixWorld();k.matrixWorldInverse.getInverse(k.matrixWorld);h.multiply(k.projectionMatrix,
|
|
k.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;m=0;for(n=p.length;m<n;m++)if(l=p[m],q=l.object,l.render=!1,q.visible&&(!(q instanceof THREE.Mesh||q instanceof THREE.ParticleSystem)||!q.frustumCulled||g.intersectsObject(q)))q._modelViewMatrix.multiply(k.matrixWorldInverse,q.matrixWorld),l.render=!0;var r;m=0;for(n=p.length;m<n;m++)if(l=p[m],l.render&&(q=l.object,l=l.buffer,!(q instanceof THREE.ParticleSystem)||q.customDepthMaterial))(r=q.material instanceof
|
|
k.matrixWorldInverse);g.setFromMatrix(h);b.setRenderTarget(this.renderTarget);b.clear();p=i.__webglObjects;m=0;for(n=p.length;m<n;m++)if(l=p[m],q=l.object,l.render=!1,q.visible&&(!(q instanceof THREE.Mesh||q instanceof THREE.ParticleSystem)||!q.frustumCulled||g.intersectsObject(q)))q._modelViewMatrix.multiply(k.matrixWorldInverse,q.matrixWorld),l.render=!0;var r;m=0;for(n=p.length;m<n;m++)if(l=p[m],l.render&&(q=l.object,l=l.buffer,!(q instanceof THREE.ParticleSystem)||q.customDepthMaterial))(r=q.material instanceof
|