Three.js 210 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. // Three.js r37 - http://github.com/mrdoob/three.js
  2. var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
  3. THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,f,g,h,k,m;if(b==0)d=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=b*(1-c);m=b*(1-c*k);c=b*(1-c*(1-k));switch(h){case 1:d=m;f=b;g=a;break;case 2:d=a;f=b;g=c;break;case 3:d=a;f=m;g=b;break;case 4:d=c;f=a;g=b;break;case 5:d=b;f=a;
  4. g=m;break;case 6:case 0:d=b;f=c;g=a}}this.r=d;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
  5. 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
  6. THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
  7. this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,b){this.set(a||0,c||0,b||0)};
  8. THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
  9. c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,b=this.y,d=this.z;this.set(b*a.z-d*a.y,d*a.x-c*a.z,c*a.y-b*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
  10. a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,b=this.y-a.y;a=this.z-a.z;return c*c+b*b+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
  11. this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
  12. 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
  13. THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
  14. a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
  15. THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,f=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(M,D,J,C){C=C.clone().subSelf(D);J=J.clone().subSelf(D);var U=M.clone().subSelf(D);M=C.dot(C);D=C.dot(J);C=C.dot(U);var P=J.dot(J);J=J.dot(U);U=1/(M*P-D*D);P=(P*C-D*J)*U;M=(M*J-D*C)*U;return P>0&&M>0&&P+M<1}var b,d,f,g,h,k,m,n,q,x,
  16. y,p=a.geometry,z=p.vertices,G=[];b=0;for(d=p.faces.length;b<d;b++){f=p.faces[b];x=this.origin.clone();y=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(z[f.a].position.clone());h=m.multiplyVector3(z[f.b].position.clone());k=m.multiplyVector3(z[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(z[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());q=y.dot(n);if(q<0){n=n.dot((new THREE.Vector3).sub(g,x))/q;x=x.addSelf(y.multiplyScalar(n));
  17. if(f instanceof THREE.Face3){if(c(x,g,h,k)){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};G.push(f)}}else if(f instanceof THREE.Face4&&(c(x,g,h,m)||c(x,h,k,m))){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};G.push(f)}}}return G}};
  18. THREE.Rectangle=function(){function a(){g=d-c;h=f-b}var c,b,d,f,g,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(m,n,q,x){k=!1;c=m;b=n;d=q;f=x;a()};this.addPoint=function(m,n){if(k){k=!1;c=m;b=n;d=m;f=n}else{c=c<m?c:m;b=b<n?b:n;d=d>m?d:m;f=f>n?f:n}a()};
  19. this.add3Points=function(m,n,q,x,y,p){if(k){k=!1;c=m<q?m<y?m:y:q<y?q:y;b=n<x?n<p?n:p:x<p?x:p;d=m>q?m>y?m:y:q>y?q:y;f=n>x?n>p?n:p:x>p?x:p}else{c=m<q?m<y?m<c?m:c:y<c?y:c:q<y?q<c?q:c:y<c?y:c;b=n<x?n<p?n<b?n:b:p<b?p:b:x<p?x<b?x:b:p<b?p:b;d=m>q?m>y?m>d?m:d:y>d?y:d:q>y?q>d?q:d:y>d?y:d;f=n>x?n>p?n>f?n:f:p>f?p:f:x>p?x>f?x:f:p>f?p:f}a()};this.addRectangle=function(m){if(k){k=!1;c=m.getLeft();b=m.getTop();d=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();d=d>m.getRight()?
  20. d:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;d+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();d=d<m.getRight()?d:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(d,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(b,m.getTop())>=0};this.empty=function(){k=!0;f=d=b=c=0;a()};this.isEmpty=function(){return k}};
  21. THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
  22. THREE.Matrix4=function(a,c,b,d,f,g,h,k,m,n,q,x,y,p,z,G){this.set(a||1,c||0,b||0,d||0,f||0,g||1,h||0,k||0,m||0,n||0,q||1,x||0,y||0,p||0,z||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
  23. THREE.Matrix4.prototype={set:function(a,c,b,d,f,g,h,k,m,n,q,x,y,p,z,G){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=m;this.n32=n;this.n33=q;this.n34=x;this.n41=y;this.n42=p;this.n43=z;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
  24. f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,f=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
  25. d+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
  26. return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,m=a.n23,n=a.n24,q=a.n31,x=a.n32,y=a.n33,p=a.n34,z=a.n41,G=a.n42,M=a.n43,D=a.n44,J=c.n11,C=c.n12,U=c.n13,P=c.n14,O=c.n21,W=c.n22,
  27. Y=c.n23,e=c.n24,ja=c.n31,X=c.n32,V=c.n33,va=c.n34;this.n11=b*J+d*O+f*ja;this.n12=b*C+d*W+f*X;this.n13=b*U+d*Y+f*V;this.n14=b*P+d*e+f*va+g;this.n21=h*J+k*O+m*ja;this.n22=h*C+k*W+m*X;this.n23=h*U+k*Y+m*V;this.n24=h*P+k*e+m*va+n;this.n31=q*J+x*O+y*ja;this.n32=q*C+x*W+y*X;this.n33=q*U+x*Y+y*V;this.n34=q*P+x*e+y*va+p;this.n41=z*J+G*O+M*ja;this.n42=z*C+G*W+M*X;this.n43=z*U+G*Y+M*V;this.n44=z*P+G*e+M*va+D;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
  28. b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=
  29. this.n11,c=this.n12,b=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,m=this.n31,n=this.n32,q=this.n33,x=this.n34,y=this.n41,p=this.n42,z=this.n43,G=this.n44;return d*h*n*y-b*k*n*y-d*g*q*y+c*k*q*y+b*g*x*y-c*h*x*y-d*h*m*p+b*k*m*p+d*f*q*p-a*k*q*p-b*f*x*p+a*h*x*p+d*g*m*z-c*k*m*z-d*f*n*z+a*k*n*z+c*f*x*z-a*g*x*z-b*g*m*G+c*h*m*G+b*f*n*G-a*h*n*G-c*f*q*G+a*g*q*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
  30. this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
  31. this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=
  32. this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,
  33. c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),f=1-b,g=a.x,h=a.y,k=a.z,m=f*g,n=f*h;this.set(m*
  34. g+b,m*h-d*k,m*k+d*h,0,m*h+d*k,n*h+b,n*k-d*g,0,m*k-d*h,n*k+d*g,f*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,k=c*b;this.n11=f*g;this.n12=-f*d;this.n13=b;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-c*f;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*f;return this},setRotationFromQuaternion:function(a){var c=
  35. a.x,b=a.y,d=a.z,f=a.w,g=c+c,h=b+b,k=d+d;a=c*g;var m=c*h;c*=k;var n=b*h;b*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(n+d);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
  36. a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
  37. THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,m=a.n23,n=a.n24,q=a.n31,x=a.n32,y=a.n33,p=a.n34,z=a.n41,G=a.n42,M=a.n43,D=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*p*G-n*y*G+n*x*M-k*p*M-m*x*D+k*y*D;c.n12=g*y*G-f*p*G-g*x*M+d*p*M+f*x*D-d*y*D;c.n13=f*n*G-g*m*G+g*k*M-d*n*M-f*k*D+d*m*D;c.n14=g*m*x-f*n*x-g*k*y+d*n*y+f*k*p-d*m*p;c.n21=n*y*z-m*p*z-n*q*M+h*p*M+m*q*D-h*y*D;c.n22=f*p*z-g*y*z+g*q*M-b*p*M-f*q*D+b*y*D;c.n23=g*m*z-f*n*z-g*h*M+b*n*M+f*h*D-b*m*D;
  38. c.n24=f*n*q-g*m*q+g*h*y-b*n*y-f*h*p+b*m*p;c.n31=k*p*z-n*x*z+n*q*G-h*p*G-k*q*D+h*x*D;c.n32=g*x*z-d*p*z-g*q*G+b*p*G+d*q*D-b*x*D;c.n33=f*n*z-g*k*z+g*h*G-b*n*G-d*h*D+b*k*D;c.n34=g*k*q-d*n*q-g*h*x+b*n*x+d*h*p-b*k*p;c.n41=m*x*z-k*y*z-m*q*G+h*y*G+k*q*M-h*x*M;c.n42=d*y*z-f*x*z+f*q*G-b*y*G-d*q*M+b*x*M;c.n43=f*k*z-d*m*z-f*h*G+b*m*G+d*h*M-b*k*M;c.n44=d*m*q-f*k*q+f*h*x-b*m*x-d*h*y+b*k*y;c.multiplyScalar(1/a.determinant());return c};
  39. THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,q=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*k;b[5]=a*m;b[6]=a*n;b[7]=a*q;b[8]=a*x;return c};
  40. THREE.Matrix4.makeFrustum=function(a,c,b,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,d)};
  41. THREE.Matrix4.makeOrtho=function(a,c,b,d,f,g){var h,k,m,n;h=new THREE.Matrix4;k=c-a;m=b-d;n=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+d)/m);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
  42. THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
  43. !0;this._vector=new THREE.Vector3};
  44. THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
  45. undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
  46. 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
  47. c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
  48. THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,f=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var h=a*c,k=d*f;this.w=h*g-k*b;this.x=h*b+k*g;this.y=d*c*g+a*f*b;this.z=a*f*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
  49. -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=c*a+f*g+b*k-d*h;this.y=b*a+f*h+d*g-c*k;this.z=d*a+f*k+c*h-b*g;this.w=f*a-c*g-b*h-d*k;return this},
  50. multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,m=this.w,n=m*b+h*f-k*d,q=m*d+k*b-g*f,x=m*f+g*d-h*b;b=-g*b-h*d-k*f;c.x=n*m+b*-g+q*-k-x*-h;c.y=q*m+b*-h+x*-g-n*-k;c.z=x*m+b*-k+n*-h-q*-g;return c}};
  51. THREE.Quaternion.slerp=function(a,c,b,d){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*f+c.w*d;b.x=a.x*f+c.x*d;b.y=a.y*f+c.y*d;b.z=a.z*f+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
  52. THREE.Face3=function(a,c,b,d,f,g){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
  53. THREE.Face4=function(a,c,b,d,f,g,h){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
  54. THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
  55. THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
  56. b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,f,g,h,k=new THREE.Vector3,m=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,b.position);m.sub(c.position,b.position);k.crossSelf(m)}k.isZero()||
  57. k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
  58. this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);
  59. b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(oa,ma,ca,S,L,fa,ra){k=oa.vertices[ma].position;m=oa.vertices[ca].position;n=oa.vertices[S].position;q=h[L];x=h[fa];y=h[ra];p=m.x-k.x;z=n.x-k.x;G=m.y-k.y;M=n.y-k.y;D=m.z-k.z;J=n.z-k.z;C=x.u-q.u;U=y.u-q.u;P=x.v-q.v;O=y.v-q.v;W=1/(C*O-U*
  60. P);X.set((O*p-P*z)*W,(O*G-P*M)*W,(O*D-P*J)*W);V.set((C*z-U*p)*W,(C*M-U*G)*W,(C*J-U*D)*W);e[ma].addSelf(X);e[ca].addSelf(X);e[S].addSelf(X);ja[ma].addSelf(V);ja[ca].addSelf(V);ja[S].addSelf(V)}var c,b,d,f,g,h,k,m,n,q,x,y,p,z,G,M,D,J,C,U,P,O,W,Y,e=[],ja=[],X=new THREE.Vector3,V=new THREE.Vector3,va=new THREE.Vector3,ga=new THREE.Vector3,za=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){e[c]=new THREE.Vector3;ja[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];h=this.faceVertexUvs[0][c];
  61. if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var la=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(d=0;d<g.vertexNormals.length;d++){za.copy(g.vertexNormals[d]);f=g[la[d]];Y=e[f];va.copy(Y);va.subSelf(za.multiplyScalar(za.dot(Y))).normalize();ga.cross(g.vertexNormals[d],Y);f=ga.dot(ja[f]);f=f<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(va.x,va.y,va.z,f)}}this.hasTangents=!0},
  62. computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=
  63. a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
  64. THREE.Spline=function(a){function c(p,z,G,M,D,J,C){p=(G-p)*0.5;M=(M-z)*0.5;return(2*(z-G)+p+M)*C+(-3*(z-G)-2*p-M)*J+p*D+z}this.points=a;var b=[],d={x:0,y:0,z:0},f,g,h,k,m,n,q,x,y;this.initFromArray=function(p){this.points=[];for(var z=0;z<p.length;z++)this.points[z]={x:p[z][0],y:p[z][1],z:p[z][2]}};this.getPoint=function(p){f=(this.points.length-1)*p;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];q=this.points[b[1]];
  65. x=this.points[b[2]];y=this.points[b[3]];k=h*h;m=h*k;d.x=c(n.x,q.x,x.x,y.x,h,k,m);d.y=c(n.y,q.y,x.y,y.y,h,k,m);d.z=c(n.z,q.z,x.z,y.z,h,k,m);return d};this.getControlPointsArray=function(){var p,z,G=this.points.length,M=[];for(p=0;p<G;p++){z=this.points[p];M[p]=[z.x,z.y,z.z]}return M};this.getLength=function(p){var z,G,M=z=z=0,D=new THREE.Vector3,J=new THREE.Vector3,C=[],U=0;C[0]=0;p||(p=100);G=this.points.length*p;D.copy(this.points[0]);for(p=1;p<G;p++){z=p/G;position=this.getPoint(z);J.copy(position);
  66. U+=J.distanceTo(D);D.copy(position);z*=this.points.length-1;z=Math.floor(z);if(z!=M){C[z]=U;M=z}}C[C.length]=U;return{chunks:C,total:U}};this.reparametrizeByArcLength=function(p){var z,G,M,D,J,C,U=[],P=new THREE.Vector3,O=this.getLength();U.push(P.copy(this.points[0]).clone());for(z=1;z<this.points.length;z++){G=O.chunks[z]-O.chunks[z-1];C=Math.ceil(p*G/O.total);D=(z-1)/(this.points.length-1);J=z/(this.points.length-1);for(G=1;G<C-1;G++){M=D+G*(1/C)*(J-D);position=this.getPoint(M);U.push(P.copy(position).clone())}U.push(P.copy(this.points[z]).clone())}this.points=
  67. U}};
  68. THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
  69. 0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var k=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var n=f.hierarchy[g].keys[h].morphTargets[m];k[n]=-1}f.hierarchy[g].usedMorphTargets=k;for(h=0;h<f.hierarchy[g].keys.length;h++){var q=
  70. {};for(n in k){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===n){q[n]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(q[n]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=q}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
  71. f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(h));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var h=0;h<f.bones.length;h++)g.push(f.bones[h]);else d(f,g);return g};var d=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)d(f.children[h],g)};b.LINEAR=
  72. 0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
  73. THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,f;for(b=0;b<d;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
  74. f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
  75. THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
  76. THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
  77. THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,f,g,h,k,m,n,q=this.data.JIT.hierarchy,x,y;this.currentTime+=a*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;n=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,z=this.hierarchy.length;p<z;p++){a=this.hierarchy[p];m=a.animationCache;if(this.JITCompile&&q[p][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=q[p][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
  78. !1}else{a.matrix=q[p][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var G=0;G<3;G++){b=c[G];h=m.prevKey[b];k=m.nextKey[b];if(k.time<=y){if(x<y)if(this.loop){h=this.data.hierarchy[p].keys[0];for(k=this.getNextKeyWith(b,p,1);k.time<x;){h=k;k=this.getNextKeyWith(b,p,k.index+1)}}else{this.stop();return}else{do{h=k;k=this.getNextKeyWith(b,p,k.index+1)}while(k.time<
  79. x)}m.prevKey[b]=h;m.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(k.time-h.time);f=h[b];g=k[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
  80. this.getPrevKeyWith("pos",p,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",p,k.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
  81. "rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}}}}if(this.JITCompile&&q[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(p=0;p<this.hierarchy.length;p++)q[p][n]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
  82. THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],f,g,h,k,m,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];k=a[b[1]];m=a[b[2]];n=a[b[3]];b=f*f;h=f*b;d[0]=this.interpolate(g[0],k[0],m[0],n[0],f,b,h);d[1]=this.interpolate(g[1],k[1],m[1],n[1],f,b,h);d[2]=this.interpolate(g[2],k[2],m[2],n[2],f,b,h);return d};
  83. THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
  84. THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
  85. THREE.Camera=function(a,c,b,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
  86. THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
  87. THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
  88. !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
  89. THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
  90. THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
  91. THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
  92. THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
  93. a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
  94. THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
  95. if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
  96. if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;
  97. if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
  98. THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
  99. !1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
  100. if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;
  101. if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
  102. THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
  103. this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=
  104. a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;
  105. if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
  106. THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
  107. undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
  108. THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
  109. undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
  110. THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=!1;this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==
  111. undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;
  112. if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
  113. THREE.ShadowVolumeDynamicMaterial=function(){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
  114. !1};
  115. THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=a.sizeAttenuation;
  116. if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
  117. THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};
  118. THREE.Texture=function(a,c,b,d,f,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
  119. THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
  120. THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
  121. THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
  122. var Uniforms={clone:function(a){var c,b,d,f={};for(c in a){f[c]={};for(b in a[c]){d=a[c][b];f[c][b]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var c,b,d,f={};for(c=0;c<a.length;c++){d=this.clone(a[c]);for(b in d)f[b]=d[b]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
  123. THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=b!=undefined?b:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
  124. THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
  125. THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var b=0;b<this.geometry.morphTargets.length;b++){this.morphTargetInfluences.push(0);
  126. this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
  127. THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
  128. THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<f;d++)this.children[d].update(this.skinMatrix,
  129. c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
  130. THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,f,g,h,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;h=f.rotq;k=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
  131. d=this.bones[b];f.parent===-1?this.addChild(d):this.bones[f.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
  132. THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,f=this.children.length;for(d=0;d<f;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
  133. c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
  134. THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
  135. d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
  136. THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
  137. THREE.Sound=function(a,c,b,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var f;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
  138. "audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
  139. THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
  140. THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
  141. THREE.Sound.prototype.update=function(a,c,b){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
  142. THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,c){c===undefined&&(c=0);c=Math.abs(c);for(var b=0;b<this.LODs.length;b++)if(c<this.LODs[b].visibleAtDistance)break;this.LODs.splice(b,0,{visibleAtDistance:c,object3D:a});this.addChild(a)};
  143. THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=b.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var d=1;d<this.LODs.length;d++)if(a>=this.LODs[d].visibleAtDistance){this.LODs[d-1].object3D.visible=
  144. !1;this.LODs[d].object3D.visible=!0}else break;for(;d<this.LODs.length;d++)this.LODs[d].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
  145. THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
  146. THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,b=this.geometry.faces,d=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,h,k,m,n,q,x=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;h=f[m];if(h instanceof THREE.Face4){n=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{n=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(h.normal);b.push(k);for(k=
  147. 0;k<n;k++){q=a[h[x[k]]];c.push(new THREE.Vertex(q.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){k=b[h];k=this.facesShareEdge(c,a,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);d.push(k)}}}};
  148. THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var d,f,g,h,k,m,n,q,x,y,p,z,G,M=0,D=["a","b","c","d"];d=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(z=0;z<d;z++){g=c[D[z]];k=a[g];for(G=0;G<f;G++){h=b[D[G]];m=a[h];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){M++;if(M===1){n=k;q=m;x=g;y=h;p=D[z]}if(M===2){p+=D[z];return p==="ad"||p==="ac"?{faces:[c,b],vertices:[n,q,m,k],indices:[x,
  149. y,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[n,k,m,q],indices:[x,g,h,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
  150. THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
  151. THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
  152. THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
  153. THREE.Projector=function(){function a(){var X=m[k]=m[k]||new THREE.RenderableVertex;k++;return X}function c(X,V){return V.z-X.z}function b(X,V){var va=0,ga=1,za=X.z+X.w,la=V.z+V.w,oa=-X.z+X.w,ma=-V.z+V.w;if(za>=0&&la>=0&&oa>=0&&ma>=0)return!0;else if(za<0&&la<0||oa<0&&ma<0)return!1;else{if(za<0)va=Math.max(va,za/(za-la));else la<0&&(ga=Math.min(ga,za/(za-la)));if(oa<0)va=Math.max(va,oa/(oa-ma));else ma<0&&(ga=Math.min(ga,oa/(oa-ma)));if(ga<va)return!1;else{X.lerpSelf(V,va);V.lerpSelf(X,1-ga);return!0}}}
  154. var d,f,g=[],h,k,m=[],n,q,x=[],y,p=[],z,G,M=[],D,J,C=[],U=new THREE.Vector4,P=new THREE.Vector4,O=new THREE.Matrix4,W=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],e=new THREE.Vector4,ja=new THREE.Vector4;this.projectVector=function(X,V){O.multiply(V.projectionMatrix,V.matrixWorldInverse);O.multiplyVector3(X);return X};this.unprojectVector=function(X,V){O.multiply(V.matrixWorld,THREE.Matrix4.makeInvert(V.projectionMatrix));
  155. O.multiplyVector3(X);return X};this.projectObjects=function(X,V,va){V=[];var ga,za,la;f=0;za=X.objects;X=0;for(ga=za.length;X<ga;X++){la=za[X];var oa;if(!(oa=!la.visible))if(oa=la instanceof THREE.Mesh){a:{oa=void 0;for(var ma=la.matrixWorld,ca=-la.geometry.boundingSphere.radius*Math.max(la.scale.x,Math.max(la.scale.y,la.scale.z)),S=0;S<6;S++){oa=Y[S].x*ma.n14+Y[S].y*ma.n24+Y[S].z*ma.n34+Y[S].w;if(oa<=ca){oa=!1;break a}}oa=!0}oa=!oa}if(!oa){oa=g[f]=g[f]||new THREE.RenderableObject;f++;d=oa;U.copy(la.position);
  156. O.multiplyVector3(U);d.object=la;d.z=U.z;V.push(d)}}va&&V.sort(c);return V};this.projectScene=function(X,V,va){var ga=[],za=V.near,la=V.far,oa,ma,ca,S,L,fa,ra,ka,qa,wa,Ca,Za,$a,Ha,j,t,w;J=G=y=q=0;V.matrixAutoUpdate&&V.updateMatrix();X.update(undefined,!1,V);O.multiply(V.projectionMatrix,V.matrixWorldInverse);Y[0].set(O.n41-O.n11,O.n42-O.n12,O.n43-O.n13,O.n44-O.n14);Y[1].set(O.n41+O.n11,O.n42+O.n12,O.n43+O.n13,O.n44+O.n14);Y[2].set(O.n41+O.n21,O.n42+O.n22,O.n43+O.n23,O.n44+O.n24);Y[3].set(O.n41-O.n21,
  157. O.n42-O.n22,O.n43-O.n23,O.n44-O.n24);Y[4].set(O.n41-O.n31,O.n42-O.n32,O.n43-O.n33,O.n44-O.n34);Y[5].set(O.n41+O.n31,O.n42+O.n32,O.n43+O.n33,O.n44+O.n34);for(oa=0;oa<6;oa++){qa=Y[oa];qa.divideScalar(Math.sqrt(qa.x*qa.x+qa.y*qa.y+qa.z*qa.z))}qa=this.projectObjects(X,V,!0);X=0;for(oa=qa.length;X<oa;X++){wa=qa[X].object;if(wa.visible){Ca=wa.matrixWorld;Za=wa.matrixRotationWorld;$a=wa.materials;Ha=wa.overdraw;k=0;if(wa instanceof THREE.Mesh){j=wa.geometry;S=j.vertices;t=j.faces;j=j.faceVertexUvs;ma=0;
  158. for(ca=S.length;ma<ca;ma++){h=a();h.positionWorld.copy(S[ma].position);Ca.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);O.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>za&&h.positionScreen.z<la}S=0;for(ma=t.length;S<ma;S++){ca=t[S];if(ca instanceof THREE.Face3){L=m[ca.a];fa=m[ca.b];ra=m[ca.c];if(L.visible&&fa.visible&&ra.visible&&(wa.doubleSided||wa.flipSided!=(ra.positionScreen.x-
  159. L.positionScreen.x)*(fa.positionScreen.y-L.positionScreen.y)-(ra.positionScreen.y-L.positionScreen.y)*(fa.positionScreen.x-L.positionScreen.x)<0)){ka=x[q]=x[q]||new THREE.RenderableFace3;q++;n=ka;n.v1.copy(L);n.v2.copy(fa);n.v3.copy(ra)}else continue}else if(ca instanceof THREE.Face4){L=m[ca.a];fa=m[ca.b];ra=m[ca.c];ka=m[ca.d];if(L.visible&&fa.visible&&ra.visible&&ka.visible&&(wa.doubleSided||wa.flipSided!=((ka.positionScreen.x-L.positionScreen.x)*(fa.positionScreen.y-L.positionScreen.y)-(ka.positionScreen.y-
  160. L.positionScreen.y)*(fa.positionScreen.x-L.positionScreen.x)<0||(fa.positionScreen.x-ra.positionScreen.x)*(ka.positionScreen.y-ra.positionScreen.y)-(fa.positionScreen.y-ra.positionScreen.y)*(ka.positionScreen.x-ra.positionScreen.x)<0))){w=p[y]=p[y]||new THREE.RenderableFace4;y++;n=w;n.v1.copy(L);n.v2.copy(fa);n.v3.copy(ra);n.v4.copy(ka)}else continue}n.normalWorld.copy(ca.normal);Za.multiplyVector3(n.normalWorld);n.centroidWorld.copy(ca.centroid);Ca.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);
  161. O.multiplyVector3(n.centroidScreen);ra=ca.vertexNormals;L=0;for(fa=ra.length;L<fa;L++){ka=n.vertexNormalsWorld[L];ka.copy(ra[L]);Za.multiplyVector3(ka)}L=0;for(fa=j.length;L<fa;L++)if(w=j[L][S]){ra=0;for(ka=w.length;ra<ka;ra++)n.uvs[L][ra]=w[ra]}n.meshMaterials=$a;n.faceMaterials=ca.materials;n.overdraw=Ha;n.z=n.centroidScreen.z;ga.push(n)}}else if(wa instanceof THREE.Line){W.multiply(O,Ca);S=wa.geometry.vertices;L=a();L.positionScreen.copy(S[0].position);W.multiplyVector4(L.positionScreen);ma=1;
  162. for(ca=S.length;ma<ca;ma++){L=a();L.positionScreen.copy(S[ma].position);W.multiplyVector4(L.positionScreen);fa=m[k-2];e.copy(L.positionScreen);ja.copy(fa.positionScreen);if(b(e,ja)){e.multiplyScalar(1/e.w);ja.multiplyScalar(1/ja.w);Ca=M[G]=M[G]||new THREE.RenderableLine;G++;z=Ca;z.v1.positionScreen.copy(e);z.v2.positionScreen.copy(ja);z.z=Math.max(e.z,ja.z);z.materials=wa.materials;ga.push(z)}}}else if(wa instanceof THREE.Particle){P.set(wa.position.x,wa.position.y,wa.position.z,1);O.multiplyVector4(P);
  163. P.z/=P.w;if(P.z>0&&P.z<1){Ca=C[J]=C[J]||new THREE.RenderableParticle;J++;D=Ca;D.x=P.x/P.w;D.y=P.y/P.w;D.z=P.z;D.rotation=wa.rotation.z;D.scale.x=wa.scale.x*Math.abs(D.x-(P.x+V.projectionMatrix.n11)/(P.w+V.projectionMatrix.n14));D.scale.y=wa.scale.y*Math.abs(D.y-(P.y+V.projectionMatrix.n22)/(P.w+V.projectionMatrix.n24));D.materials=wa.materials;ga.push(D)}}}}va&&ga.sort(c);return ga}};
  164. THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){b=h;d=k;f=b/2;g=d/2};this.render=function(h,k){var m,n,q,x,y,p,z,G;a=c.projectScene(h,k);m=0;for(n=a.length;m<n;m++){y=a[m];if(y instanceof THREE.RenderableParticle){z=y.x*f+f;G=y.y*g+g;q=0;for(x=y.material.length;q<x;q++){p=y.material[q];if(p instanceof THREE.ParticleDOMMaterial){p=p.domElement;p.style.left=z+"px";p.style.top=G+"px"}}}}}};
  165. THREE.CanvasRenderer=function(){function a(R){if(y!=R)n.globalAlpha=y=R}function c(R){if(p!=R){switch(R){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}p=R}}var b=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,m,n=f.getContext("2d"),q=new THREE.Color(0),x=0,y=1,p=0,z=null,G=null,M=1,D,J,C,U,P=new THREE.RenderableVertex,
  166. O=new THREE.RenderableVertex,W,Y,e,ja,X,V,va,ga,za,la,oa,ma,ca=new THREE.Color,S=new THREE.Color,L=new THREE.Color,fa=new THREE.Color,ra=new THREE.Color,ka,qa,wa,Ca,Za,$a,Ha,j,t,w,o=new THREE.Rectangle,B=new THREE.Rectangle,F=new THREE.Rectangle,H=!1,E=new THREE.Color,A=new THREE.Color,T=new THREE.Color,I=new THREE.Color,Q=new THREE.Vector3,ha,pa,sa,Aa,xa,Ea,da=16;ha=document.createElement("canvas");ha.width=ha.height=2;pa=ha.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);sa=pa.getImageData(0,
  167. 0,2,2);Aa=sa.data;xa=document.createElement("canvas");xa.width=xa.height=da;Ea=xa.getContext("2d");Ea.translate(-da/2,-da/2);Ea.scale(da,da);da--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(R,ia){g=R;h=ia;k=g/2;m=h/2;f.width=g;f.height=h;o.set(-k,-m,k,m);y=1;p=0;G=z=null;M=1};this.setClearColor=function(R,ia){q=R;x=ia};this.setClearColorHex=function(R,ia){q.setHex(R);x=ia};this.clear=function(){n.setTransform(1,0,0,-1,k,m);if(!B.isEmpty()){B.inflate(1);
  168. B.minSelf(o);if(q.hex==0&&x==0)n.clearRect(B.getX(),B.getY(),B.getWidth(),B.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+x+")";n.fillRect(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(R,ia){function La(K){var Z,na,aa,ta=K.lights;A.setRGB(0,0,0);T.setRGB(0,0,0);I.setRGB(0,0,0);K=0;for(Z=ta.length;K<Z;K++){na=ta[K];aa=na.color;if(na instanceof THREE.AmbientLight){A.r+=aa.r;
  169. A.g+=aa.g;A.b+=aa.b}else if(na instanceof THREE.DirectionalLight){T.r+=aa.r;T.g+=aa.g;T.b+=aa.b}else if(na instanceof THREE.PointLight){I.r+=aa.r;I.g+=aa.g;I.b+=aa.b}}}function Ga(K,Z,na,aa){var ta,ya,ea,$,Ka=K.lights;K=0;for(ta=Ka.length;K<ta;K++){ya=Ka[K];ea=ya.color;$=ya.intensity;if(ya instanceof THREE.DirectionalLight){ya=na.dot(ya.position)*$;if(ya>0){aa.r+=ea.r*ya;aa.g+=ea.g*ya;aa.b+=ea.b*ya}}else if(ya instanceof THREE.PointLight){Q.sub(ya.position,Z);Q.normalize();ya=na.dot(Q)*$;if(ya>0){aa.r+=
  170. ea.r*ya;aa.g+=ea.g*ya;aa.b+=ea.b*ya}}}}function eb(K,Z,na){a(na.opacity);c(na.blending);var aa,ta,ya,ea,$,Ka;if(na instanceof THREE.ParticleBasicMaterial){if(na.map){ea=na.map.image;$=ea.width>>1;Ka=ea.height>>1;na=Z.scale.x*k;ya=Z.scale.y*m;aa=na*$;ta=ya*Ka;F.set(K.x-aa,K.y-ta,K.x+aa,K.y+ta);if(o.instersects(F)){n.save();n.translate(K.x,K.y);n.rotate(-Z.rotation);n.scale(na,-ya);n.translate(-$,-Ka);n.drawImage(ea,0,0);n.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){if(H){E.r=A.r+
  171. T.r+I.r;E.g=A.g+T.g+I.g;E.b=A.b+T.b+I.b;ca.r=na.color.r*E.r;ca.g=na.color.g*E.g;ca.b=na.color.b*E.b;ca.updateStyleString()}else ca.__styleString=na.color.__styleString;aa=Z.scale.x*k;ta=Z.scale.y*m;F.set(K.x-aa,K.y-ta,K.x+aa,K.y+ta);if(o.instersects(F)){n.save();n.translate(K.x,K.y);n.rotate(-Z.rotation);n.scale(aa,ta);na.program(n,ca);n.restore()}}}function Ta(K,Z,na,aa){a(aa.opacity);c(aa.blending);n.beginPath();n.moveTo(K.positionScreen.x,K.positionScreen.y);n.lineTo(Z.positionScreen.x,Z.positionScreen.y);
  172. n.closePath();if(aa instanceof THREE.LineBasicMaterial){ca.__styleString=aa.color.__styleString;K=aa.linewidth;if(M!=K)n.lineWidth=M=K;K=ca.__styleString;if(z!=K)n.strokeStyle=z=K;n.stroke();F.inflate(aa.linewidth*2)}}function Ia(K,Z,na,aa,ta,ya,ea,$,Ka){a($.opacity);c($.blending);W=K.positionScreen.x;Y=K.positionScreen.y;e=Z.positionScreen.x;ja=Z.positionScreen.y;X=na.positionScreen.x;V=na.positionScreen.y;bb(W,Y,e,ja,X,V);if($ instanceof THREE.MeshBasicMaterial)if($.map){if($.map.mapping instanceof
  173. THREE.UVMapping){Ca=ea.uvs[0];Da(W,Y,e,ja,X,V,$.map.image,Ca[aa].u,Ca[aa].v,Ca[ta].u,Ca[ta].v,Ca[ya].u,Ca[ya].v)}}else if($.envMap){if($.envMap.mapping instanceof THREE.SphericalReflectionMapping){K=ia.matrixWorldInverse;Q.copy(ea.vertexNormalsWorld[0]);Za=(Q.x*K.n11+Q.y*K.n12+Q.z*K.n13)*0.5+0.5;$a=-(Q.x*K.n21+Q.y*K.n22+Q.z*K.n23)*0.5+0.5;Q.copy(ea.vertexNormalsWorld[1]);Ha=(Q.x*K.n11+Q.y*K.n12+Q.z*K.n13)*0.5+0.5;j=-(Q.x*K.n21+Q.y*K.n22+Q.z*K.n23)*0.5+0.5;Q.copy(ea.vertexNormalsWorld[2]);t=(Q.x*K.n11+
  174. Q.y*K.n12+Q.z*K.n13)*0.5+0.5;w=-(Q.x*K.n21+Q.y*K.n22+Q.z*K.n23)*0.5+0.5;Da(W,Y,e,ja,X,V,$.envMap.image,Za,$a,Ha,j,t,w)}}else $.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){if($.map.mapping instanceof THREE.UVMapping){Ca=ea.uvs[0];Da(W,Y,e,ja,X,V,$.map.image,Ca[aa].u,Ca[aa].v,Ca[ta].u,Ca[ta].v,Ca[ya].u,Ca[ya].v)}c(THREE.SubtractiveBlending)}if(H)if(!$.wireframe&&$.shading==THREE.SmoothShading&&
  175. ea.vertexNormalsWorld.length==3){S.r=L.r=fa.r=A.r;S.g=L.g=fa.g=A.g;S.b=L.b=fa.b=A.b;Ga(Ka,ea.v1.positionWorld,ea.vertexNormalsWorld[0],S);Ga(Ka,ea.v2.positionWorld,ea.vertexNormalsWorld[1],L);Ga(Ka,ea.v3.positionWorld,ea.vertexNormalsWorld[2],fa);ra.r=(L.r+fa.r)*0.5;ra.g=(L.g+fa.g)*0.5;ra.b=(L.b+fa.b)*0.5;wa=Va(S,L,fa,ra);Da(W,Y,e,ja,X,V,wa,0,0,1,0,0,1)}else{E.r=A.r;E.g=A.g;E.b=A.b;Ga(Ka,ea.centroidWorld,ea.normalWorld,E);ca.r=$.color.r*E.r;ca.g=$.color.g*E.g;ca.b=$.color.b*E.b;ca.updateStyleString();
  176. $.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else $.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){ka=ia.near;qa=ia.far;S.r=S.g=S.b=1-Ma(K.positionScreen.z,ka,qa);L.r=L.g=L.b=1-Ma(Z.positionScreen.z,ka,qa);fa.r=fa.g=fa.b=1-Ma(na.positionScreen.z,ka,qa);ra.r=(L.r+fa.r)*0.5;ra.g=(L.g+fa.g)*0.5;ra.b=(L.b+fa.b)*0.5;wa=Va(S,L,fa,ra);Da(W,Y,e,ja,X,V,wa,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){ca.r=
  177. N(ea.normalWorld.x);ca.g=N(ea.normalWorld.y);ca.b=N(ea.normalWorld.z);ca.updateStyleString();$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}}function Ra(K,Z,na,aa,ta,ya,ea,$,Ka){a($.opacity);c($.blending);if($.map||$.envMap){Ia(K,Z,aa,0,1,3,ea,$,Ka);Ia(ta,na,ya,1,2,3,ea,$,Ka)}else{W=K.positionScreen.x;Y=K.positionScreen.y;e=Z.positionScreen.x;ja=Z.positionScreen.y;X=na.positionScreen.x;V=na.positionScreen.y;va=aa.positionScreen.x;ga=aa.positionScreen.y;za=ta.positionScreen.x;
  178. la=ta.positionScreen.y;oa=ya.positionScreen.x;ma=ya.positionScreen.y;if($ instanceof THREE.MeshBasicMaterial){db(W,Y,e,ja,X,V,va,ga);$.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshLambertMaterial)if(H)if(!$.wireframe&&$.shading==THREE.SmoothShading&&ea.vertexNormalsWorld.length==4){S.r=L.r=fa.r=ra.r=A.r;S.g=L.g=fa.g=ra.g=A.g;S.b=L.b=fa.b=ra.b=A.b;Ga(Ka,ea.v1.positionWorld,ea.vertexNormalsWorld[0],S);Ga(Ka,ea.v2.positionWorld,ea.vertexNormalsWorld[1],
  179. L);Ga(Ka,ea.v4.positionWorld,ea.vertexNormalsWorld[3],fa);Ga(Ka,ea.v3.positionWorld,ea.vertexNormalsWorld[2],ra);wa=Va(S,L,fa,ra);bb(W,Y,e,ja,va,ga);Da(W,Y,e,ja,va,ga,wa,0,0,1,0,0,1);bb(za,la,X,V,oa,ma);Da(za,la,X,V,oa,ma,wa,1,0,1,1,0,1)}else{E.r=A.r;E.g=A.g;E.b=A.b;Ga(Ka,ea.centroidWorld,ea.normalWorld,E);ca.r=$.color.r*E.r;ca.g=$.color.g*E.g;ca.b=$.color.b*E.b;ca.updateStyleString();db(W,Y,e,ja,X,V,va,ga);$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else{db(W,Y,e,ja,
  180. X,V,va,ga);$.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshNormalMaterial){ca.r=N(ea.normalWorld.x);ca.g=N(ea.normalWorld.y);ca.b=N(ea.normalWorld.z);ca.updateStyleString();db(W,Y,e,ja,X,V,va,ga);$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){ka=ia.near;qa=ia.far;S.r=S.g=S.b=1-Ma(K.positionScreen.z,ka,qa);L.r=L.g=L.b=1-Ma(Z.positionScreen.z,ka,qa);fa.r=fa.g=
  181. fa.b=1-Ma(aa.positionScreen.z,ka,qa);ra.r=ra.g=ra.b=1-Ma(na.positionScreen.z,ka,qa);wa=Va(S,L,fa,ra);bb(W,Y,e,ja,va,ga);Da(W,Y,e,ja,va,ga,wa,0,0,1,0,0,1);bb(za,la,X,V,oa,ma);Da(za,la,X,V,oa,ma,wa,1,0,1,1,0,1)}}}function bb(K,Z,na,aa,ta,ya){n.beginPath();n.moveTo(K,Z);n.lineTo(na,aa);n.lineTo(ta,ya);n.lineTo(K,Z);n.closePath()}function db(K,Z,na,aa,ta,ya,ea,$){n.beginPath();n.moveTo(K,Z);n.lineTo(na,aa);n.lineTo(ta,ya);n.lineTo(ea,$);n.lineTo(K,Z);n.closePath()}function Pa(K,Z){if(z!=K)n.strokeStyle=
  182. z=K;if(M!=Z)n.lineWidth=M=Z;n.stroke();F.inflate(Z*2)}function Ua(K){if(G!=K)n.fillStyle=G=K;n.fill()}function Da(K,Z,na,aa,ta,ya,ea,$,Ka,Xa,Ya,cb,gb){var ab,Wa;ab=ea.width-1;Wa=ea.height-1;$*=ab;Ka*=Wa;Xa*=ab;Ya*=Wa;cb*=ab;gb*=Wa;na-=K;aa-=Z;ta-=K;ya-=Z;Xa-=$;Ya-=Ka;cb-=$;gb-=Ka;ab=Xa*gb-cb*Ya;if(ab!=0){Wa=1/ab;ab=(gb*na-Ya*ta)*Wa;Ya=(gb*aa-Ya*ya)*Wa;na=(Xa*ta-cb*na)*Wa;aa=(Xa*ya-cb*aa)*Wa;K=K-ab*$-na*Ka;Z=Z-Ya*$-aa*Ka;n.save();n.transform(ab,Ya,na,aa,K,Z);n.clip();n.drawImage(ea,0,0);n.restore()}}
  183. function Va(K,Z,na,aa){var ta=~~(K.r*255),ya=~~(K.g*255);K=~~(K.b*255);var ea=~~(Z.r*255),$=~~(Z.g*255);Z=~~(Z.b*255);var Ka=~~(na.r*255),Xa=~~(na.g*255);na=~~(na.b*255);var Ya=~~(aa.r*255),cb=~~(aa.g*255);aa=~~(aa.b*255);Aa[0]=ta<0?0:ta>255?255:ta;Aa[1]=ya<0?0:ya>255?255:ya;Aa[2]=K<0?0:K>255?255:K;Aa[4]=ea<0?0:ea>255?255:ea;Aa[5]=$<0?0:$>255?255:$;Aa[6]=Z<0?0:Z>255?255:Z;Aa[8]=Ka<0?0:Ka>255?255:Ka;Aa[9]=Xa<0?0:Xa>255?255:Xa;Aa[10]=na<0?0:na>255?255:na;Aa[12]=Ya<0?0:Ya>255?255:Ya;Aa[13]=cb<0?0:cb>
  184. 255?255:cb;Aa[14]=aa<0?0:aa>255?255:aa;pa.putImageData(sa,0,0);Ea.drawImage(ha,0,0);return xa}function Ma(K,Z,na){K=(K-Z)/(na-Z);return K*K*(3-2*K)}function N(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function Na(K,Z){var na=Z.x-K.x,aa=Z.y-K.y,ta=1/Math.sqrt(na*na+aa*aa);na*=ta;aa*=ta;Z.x+=na;Z.y+=aa;K.x-=na;K.y-=aa}var Qa,ib,Ba,Sa,Fa,Oa,Ja,ua;this.autoClear?this.clear():n.setTransform(1,0,0,-1,k,m);b=d.projectScene(R,ia,this.sortElements);(H=R.lights.length>0)&&La(R);Qa=0;for(ib=b.length;Qa<ib;Qa++){Ba=
  185. b[Qa];F.empty();if(Ba instanceof THREE.RenderableParticle){D=Ba;D.x*=k;D.y*=m;Sa=0;for(Fa=Ba.materials.length;Sa<Fa;){ua=Ba.materials[Sa++];ua.opacity!=0&&eb(D,Ba,ua,R)}}else if(Ba instanceof THREE.RenderableLine){D=Ba.v1;J=Ba.v2;D.positionScreen.x*=k;D.positionScreen.y*=m;J.positionScreen.x*=k;J.positionScreen.y*=m;F.addPoint(D.positionScreen.x,D.positionScreen.y);F.addPoint(J.positionScreen.x,J.positionScreen.y);if(o.instersects(F)){Sa=0;for(Fa=Ba.materials.length;Sa<Fa;){ua=Ba.materials[Sa++];
  186. ua.opacity!=0&&Ta(D,J,Ba,ua,R)}}}else if(Ba instanceof THREE.RenderableFace3){D=Ba.v1;J=Ba.v2;C=Ba.v3;D.positionScreen.x*=k;D.positionScreen.y*=m;J.positionScreen.x*=k;J.positionScreen.y*=m;C.positionScreen.x*=k;C.positionScreen.y*=m;if(Ba.overdraw){Na(D.positionScreen,J.positionScreen);Na(J.positionScreen,C.positionScreen);Na(C.positionScreen,D.positionScreen)}F.add3Points(D.positionScreen.x,D.positionScreen.y,J.positionScreen.x,J.positionScreen.y,C.positionScreen.x,C.positionScreen.y);if(o.instersects(F)){Sa=
  187. 0;for(Fa=Ba.meshMaterials.length;Sa<Fa;){ua=Ba.meshMaterials[Sa++];if(ua instanceof THREE.MeshFaceMaterial){Oa=0;for(Ja=Ba.faceMaterials.length;Oa<Ja;)(ua=Ba.faceMaterials[Oa++])&&ua.opacity!=0&&Ia(D,J,C,0,1,2,Ba,ua,R)}else ua.opacity!=0&&Ia(D,J,C,0,1,2,Ba,ua,R)}}}else if(Ba instanceof THREE.RenderableFace4){D=Ba.v1;J=Ba.v2;C=Ba.v3;U=Ba.v4;D.positionScreen.x*=k;D.positionScreen.y*=m;J.positionScreen.x*=k;J.positionScreen.y*=m;C.positionScreen.x*=k;C.positionScreen.y*=m;U.positionScreen.x*=k;U.positionScreen.y*=
  188. m;P.positionScreen.copy(J.positionScreen);O.positionScreen.copy(U.positionScreen);if(Ba.overdraw){Na(D.positionScreen,J.positionScreen);Na(J.positionScreen,U.positionScreen);Na(U.positionScreen,D.positionScreen);Na(C.positionScreen,P.positionScreen);Na(C.positionScreen,O.positionScreen)}F.addPoint(D.positionScreen.x,D.positionScreen.y);F.addPoint(J.positionScreen.x,J.positionScreen.y);F.addPoint(C.positionScreen.x,C.positionScreen.y);F.addPoint(U.positionScreen.x,U.positionScreen.y);if(o.instersects(F)){Sa=
  189. 0;for(Fa=Ba.meshMaterials.length;Sa<Fa;){ua=Ba.meshMaterials[Sa++];if(ua instanceof THREE.MeshFaceMaterial){Oa=0;for(Ja=Ba.faceMaterials.length;Oa<Ja;)(ua=Ba.faceMaterials[Oa++])&&ua.opacity!=0&&Ra(D,J,C,U,P,O,Ba,ua,R)}else ua.opacity!=0&&Ra(D,J,C,U,P,O,Ba,ua,R)}}}B.addRectangle(F)}n.setTransform(1,0,0,1,0,0)}};
  190. THREE.SVGRenderer=function(){function a(la,oa,ma){var ca,S,L,fa;ca=0;for(S=la.lights.length;ca<S;ca++){L=la.lights[ca];if(L instanceof THREE.DirectionalLight){fa=oa.normalWorld.dot(L.position)*L.intensity;if(fa>0){ma.r+=L.color.r*fa;ma.g+=L.color.g*fa;ma.b+=L.color.b*fa}}else if(L instanceof THREE.PointLight){e.sub(L.position,oa.centroidWorld);e.normalize();fa=oa.normalWorld.dot(e)*L.intensity;if(fa>0){ma.r+=L.color.r*fa;ma.g+=L.color.g*fa;ma.b+=L.color.b*fa}}}}function c(la,oa,ma,ca,S,L){V=d(va++);
  191. V.setAttribute("d","M "+la.positionScreen.x+" "+la.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)C.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(J){U.r=P.r;U.g=P.g;U.b=P.b;a(L,ca,U);C.r=S.color.r*U.r;C.g=S.color.g*U.g;C.b=S.color.b*U.b;C.updateStyleString()}else C.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){Y=
  192. 1-S.__2near/(S.__farPlusNear-ca.z*S.__farMinusNear);C.setRGB(Y,Y,Y)}else S instanceof THREE.MeshNormalMaterial&&C.setRGB(f(ca.normalWorld.x),f(ca.normalWorld.y),f(ca.normalWorld.z));S.wireframe?V.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):V.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+S.opacity);k.appendChild(V)}
  193. function b(la,oa,ma,ca,S,L,fa){V=d(va++);V.setAttribute("d","M "+la.positionScreen.x+" "+la.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(L instanceof THREE.MeshBasicMaterial)C.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshLambertMaterial)if(J){U.r=P.r;U.g=P.g;U.b=P.b;a(fa,S,U);C.r=L.color.r*U.r;C.g=L.color.g*U.g;C.b=L.color.b*U.b;C.updateStyleString()}else C.__styleString=
  194. L.color.__styleString;else if(L instanceof THREE.MeshDepthMaterial){Y=1-L.__2near/(L.__farPlusNear-S.z*L.__farMinusNear);C.setRGB(Y,Y,Y)}else L instanceof THREE.MeshNormalMaterial&&C.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));L.wireframe?V.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+L.wireframeLinewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframeLinecap+"; stroke-linejoin: "+L.wireframeLinejoin):V.setAttribute("style","fill: "+
  195. C.__styleString+"; fill-opacity: "+L.opacity);k.appendChild(V)}function d(la){if(ja[la]==null){ja[la]=document.createElementNS("http://www.w3.org/2000/svg","path");za==0&&ja[la].setAttribute("shape-rendering","crispEdges")}return ja[la]}function f(la){return la<0?Math.min((1+la)*0.5,0.5):0.5+Math.min(la*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,q,x,y,p,z,G,M=new THREE.Rectangle,D=new THREE.Rectangle,J=!1,C=new THREE.Color(16777215),
  196. U=new THREE.Color(16777215),P=new THREE.Color(0),O=new THREE.Color(0),W=new THREE.Color(0),Y,e=new THREE.Vector3,ja=[],X=[],V,va,ga,za=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(la){switch(la){case "high":za=1;break;case "low":za=0}};this.setSize=function(la,oa){m=la;n=oa;q=m/2;x=n/2;k.setAttribute("viewBox",-q+" "+-x+" "+m+" "+n);k.setAttribute("width",m);k.setAttribute("height",n);M.set(-q,-x,q,x)};this.clear=function(){for(;k.childNodes.length>
  197. 0;)k.removeChild(k.childNodes[0])};this.render=function(la,oa){var ma,ca,S,L,fa,ra,ka,qa;this.autoClear&&this.clear();g=h.projectScene(la,oa,this.sortElements);ga=va=0;if(J=la.lights.length>0){ka=la.lights;P.setRGB(0,0,0);O.setRGB(0,0,0);W.setRGB(0,0,0);ma=0;for(ca=ka.length;ma<ca;ma++){S=ka[ma];L=S.color;if(S instanceof THREE.AmbientLight){P.r+=L.r;P.g+=L.g;P.b+=L.b}else if(S instanceof THREE.DirectionalLight){O.r+=L.r;O.g+=L.g;O.b+=L.b}else if(S instanceof THREE.PointLight){W.r+=L.r;W.g+=L.g;W.b+=
  198. L.b}}}ma=0;for(ca=g.length;ma<ca;ma++){ka=g[ma];D.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=q;y.y*=-x;S=0;for(L=ka.materials.length;S<L;)S++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;p=ka.v2;y.positionScreen.x*=q;y.positionScreen.y*=-x;p.positionScreen.x*=q;p.positionScreen.y*=-x;D.addPoint(y.positionScreen.x,y.positionScreen.y);D.addPoint(p.positionScreen.x,p.positionScreen.y);if(M.instersects(D)){S=0;for(L=ka.materials.length;S<L;)if((qa=ka.materials[S++])&&qa.opacity!=
  199. 0){fa=y;ra=p;var wa=ga++;if(X[wa]==null){X[wa]=document.createElementNS("http://www.w3.org/2000/svg","line");za==0&&X[wa].setAttribute("shape-rendering","crispEdges")}V=X[wa];V.setAttribute("x1",fa.positionScreen.x);V.setAttribute("y1",fa.positionScreen.y);V.setAttribute("x2",ra.positionScreen.x);V.setAttribute("y2",ra.positionScreen.y);if(qa instanceof THREE.LineBasicMaterial){C.__styleString=qa.color.__styleString;V.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+
  200. qa.linewidth+"; stroke-opacity: "+qa.opacity+"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);k.appendChild(V)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;p=ka.v2;z=ka.v3;y.positionScreen.x*=q;y.positionScreen.y*=-x;p.positionScreen.x*=q;p.positionScreen.y*=-x;z.positionScreen.x*=q;z.positionScreen.y*=-x;D.addPoint(y.positionScreen.x,y.positionScreen.y);D.addPoint(p.positionScreen.x,p.positionScreen.y);D.addPoint(z.positionScreen.x,z.positionScreen.y);if(M.instersects(D)){S=
  201. 0;for(L=ka.meshMaterials.length;S<L;){qa=ka.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){fa=0;for(ra=ka.faceMaterials.length;fa<ra;)(qa=ka.faceMaterials[fa++])&&qa.opacity!=0&&c(y,p,z,ka,qa,la)}else qa&&qa.opacity!=0&&c(y,p,z,ka,qa,la)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;p=ka.v2;z=ka.v3;G=ka.v4;y.positionScreen.x*=q;y.positionScreen.y*=-x;p.positionScreen.x*=q;p.positionScreen.y*=-x;z.positionScreen.x*=q;z.positionScreen.y*=-x;G.positionScreen.x*=q;G.positionScreen.y*=
  202. -x;D.addPoint(y.positionScreen.x,y.positionScreen.y);D.addPoint(p.positionScreen.x,p.positionScreen.y);D.addPoint(z.positionScreen.x,z.positionScreen.y);D.addPoint(G.positionScreen.x,G.positionScreen.y);if(M.instersects(D)){S=0;for(L=ka.meshMaterials.length;S<L;){qa=ka.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){fa=0;for(ra=ka.faceMaterials.length;fa<ra;)(qa=ka.faceMaterials[fa++])&&qa.opacity!=0&&b(y,p,z,G,ka,qa,la)}else qa&&qa.opacity!=0&&b(y,p,z,G,ka,qa,la)}}}}}};
  203. 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",
  204. envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
  205. envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
  206. map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
  207. lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
  208. lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
  209. lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
  210. color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
  211. morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
  212. default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"};
  213. THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
  214. value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",
  215. value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
  216. THREE.ShaderLib={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
  217. depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
  218. fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
  219. THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
  220. THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
  221. THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",
  222. THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",
  223. THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
  224. THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),
  225. vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
  226. THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
  227. THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
  228. THREE.WebGLRenderer=function(a){function c(j,t,w){var o,B,F,H=j.vertices,E=H.length,A=j.colors,T=A.length,I=j.__vertexArray,Q=j.__colorArray,ha=j.__sortArray,pa=j.__dirtyVertices,sa=j.__dirtyColors;if(w.sortParticles){fa.multiplySelf(w.matrixWorld);for(o=0;o<E;o++){B=H[o].position;qa.copy(B);fa.multiplyVector3(qa);ha[o]=[qa.z,o]}ha.sort(function(Aa,xa){return xa[0]-Aa[0]});for(o=0;o<E;o++){B=H[ha[o][1]].position;F=o*3;I[F]=B.x;I[F+1]=B.y;I[F+2]=B.z}for(o=0;o<T;o++){F=o*3;color=A[ha[o][1]];Q[F]=color.r;
  229. Q[F+1]=color.g;Q[F+2]=color.b}}else{if(pa)for(o=0;o<E;o++){B=H[o].position;F=o*3;I[F]=B.x;I[F+1]=B.y;I[F+2]=B.z}if(sa)for(o=0;o<T;o++){color=A[o];F=o*3;Q[F]=color.r;Q[F+1]=color.g;Q[F+2]=color.b}}if(pa||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,j.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,I,t)}if(sa||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,j.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Q,t)}}function b(j,t){j.uniforms=Uniforms.clone(t.uniforms);j.vertexShader=t.vertexShader;j.fragmentShader=
  230. t.fragmentShader}function d(j,t,w,o,B){o.__webglProgram||V.initMaterial(o,t,w,B);var F=o.program,H=F.uniforms,E=o.uniforms;if(F!=ja){e.useProgram(F);ja=F}e.uniformMatrix4fv(H.projectionMatrix,!1,ra);if(w&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){E.fogColor.value.setHex(w.color.hex);if(w instanceof THREE.Fog){E.fogNear.value=w.near;E.fogFar.value=
  231. w.far}else if(w instanceof THREE.FogExp2)E.fogDensity.value=w.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var A,T,I=0,Q=0,ha=0,pa,sa,Aa,xa=wa,Ea=xa.directional.colors,da=xa.directional.positions,R=xa.point.colors,ia=xa.point.positions,La=0,Ga=0;w=T=T=0;for(A=t.length;w<A;w++){T=t[w];pa=T.color;sa=T.position;Aa=T.intensity;if(T instanceof THREE.AmbientLight){I+=pa.r;Q+=pa.g;ha+=pa.b}else if(T instanceof THREE.DirectionalLight){T=La*3;Ea[T]=pa.r*
  232. Aa;Ea[T+1]=pa.g*Aa;Ea[T+2]=pa.b*Aa;da[T]=sa.x;da[T+1]=sa.y;da[T+2]=sa.z;La+=1}else if(T instanceof THREE.PointLight){T=Ga*3;R[T]=pa.r*Aa;R[T+1]=pa.g*Aa;R[T+2]=pa.b*Aa;ia[T]=sa.x;ia[T+1]=sa.y;ia[T+2]=sa.z;Ga+=1}}for(w=La*3;w<Ea.length;w++)Ea[w]=0;for(w=Ga*3;w<R.length;w++)R[w]=0;xa.point.length=Ga;xa.directional.length=La;xa.ambient[0]=I;xa.ambient[1]=Q;xa.ambient[2]=ha;w=wa;E.enableLighting.value=w.directional.length+w.point.length;E.ambientLightColor.value=w.ambient;E.directionalLightColor.value=
  233. w.directional.colors;E.directionalLightDirection.value=w.directional.positions;E.pointLightColor.value=w.point.colors;E.pointLightPosition.value=w.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity;E.map.texture=o.map;E.lightMap.texture=o.lightMap;E.envMap.texture=o.envMap;E.reflectivity.value=o.reflectivity;
  234. E.refractionRatio.value=o.refractionRatio;E.combine.value=o.combine;E.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity;E.size.value=o.size;E.scale.value=Y.height/
  235. 2;E.map.texture=o.map}else if(o instanceof THREE.MeshPhongMaterial){E.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);E.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);E.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){E.mNear.value=j.near;E.mFar.value=j.far;E.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)E.opacity.value=o.opacity;for(var eb in E)if(Q=F.uniforms[eb]){A=E[eb];I=A.type;w=A.value;if(I=="i")e.uniform1i(Q,w);else if(I==
  236. "f")e.uniform1f(Q,w);else if(I=="fv1")e.uniform1fv(Q,w);else if(I=="fv")e.uniform3fv(Q,w);else if(I=="v2")e.uniform2f(Q,w.x,w.y);else if(I=="v3")e.uniform3f(Q,w.x,w.y,w.z);else if(I=="c")e.uniform3f(Q,w.r,w.g,w.b);else if(I=="t"){e.uniform1i(Q,w);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__wasSetOnce){e.bindTexture(e.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(I=0;I<6;++I)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,e.RGBA,
  237. e.UNSIGNED_BYTE,A.image[I])}else{A.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(I=0;I<6;++I)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,A.image[I]);A.__wasSetOnce=!0}C(e.TEXTURE_CUBE_MAP,A,A.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}e.activeTexture(e.TEXTURE0+w);e.bindTexture(e.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube)}}else{if(A.needsUpdate){if(A.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
  238. A.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,A.image)}else{A.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,A.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,A.image);A.__wasSetOnce=!0}C(e.TEXTURE_2D,A,A.image);e.bindTexture(e.TEXTURE_2D,null);A.needsUpdate=!1}e.activeTexture(e.TEXTURE0+w);e.bindTexture(e.TEXTURE_2D,A.__webGLTexture)}}}e.uniformMatrix4fv(H.modelViewMatrix,!1,B._modelViewMatrixArray);e.uniformMatrix3fv(H.normalMatrix,
  239. !1,B._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||o instanceof THREE.MeshPhongMaterial||o.envMap)&&e.uniform3f(H.cameraPosition,j.position.x,j.position.y,j.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&e.uniformMatrix4fv(H.objectMatrix,!1,B._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&e.uniformMatrix4fv(H.viewMatrix,!1,ka);if(o instanceof THREE.ShadowVolumeDynamicMaterial){j=
  240. E.directionalLightDirection.value;j[0]=-t.position.x;j[1]=-t.position.y;j[2]=-t.position.z;e.uniform3fv(H.directionalLightDirection,j);e.uniformMatrix4fv(H.objectMatrix,!1,B._objectMatrixArray);e.uniformMatrix4fv(H.viewMatrix,!1,ka)}if(o.skinning){e.uniformMatrix4fv(H.cameraInverseMatrix,!1,ka);e.uniformMatrix4fv(H.boneGlobalMatrices,!1,B.boneMatrices)}return F}function f(j,t,w,o,B,F){if(o.opacity!=0){j=d(j,t,w,o,F).attributes;if(o.morphTargets){t=o.program.attributes;F.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,
  241. B.__webGLMorphTargetsBuffers[F.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,B.__webGLVertexBuffer);e.vertexAttribPointer(t.position,3,e.FLOAT,!1,0,0);if(F.morphTargetForcedOrder.length){w=0;for(var H=F.morphTargetForcedOrder,E=F.morphTargetInfluences;w<o.numSupportedMorphTargets&&w<H.length;){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLMorphTargetsBuffers[H[w]]);e.vertexAttribPointer(t["morphTarget"+w],3,e.FLOAT,!1,0,0);F.__webGLMorphTargetInfluences[w]=E[H[w]];w++}}else{H=[];var A=-1,T=0;E=F.morphTargetInfluences;
  242. var I,Q=E.length;w=0;for(F.morphTargetBase!==-1&&(H[F.morphTargetBase]=!0);w<o.numSupportedMorphTargets;){for(I=0;I<Q;I++)if(!H[I]&&E[I]>A){T=I;A=E[T]}e.bindBuffer(e.ARRAY_BUFFER,B.__webGLMorphTargetsBuffers[T]);e.vertexAttribPointer(t["morphTarget"+w],3,e.FLOAT,!1,0,0);F.__webGLMorphTargetInfluences[w]=A;H[T]=1;A=-1;w++}}e.uniform1fv(o.program.uniforms.morphTargetInfluences,F.__webGLMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,B.__webGLVertexBuffer);e.vertexAttribPointer(j.position,3,
  243. e.FLOAT,!1,0,0)}if(j.color>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLColorBuffer);e.vertexAttribPointer(j.color,3,e.FLOAT,!1,0,0)}if(j.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLNormalBuffer);e.vertexAttribPointer(j.normal,3,e.FLOAT,!1,0,0)}if(j.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLTangentBuffer);e.vertexAttribPointer(j.tangent,4,e.FLOAT,!1,0,0)}if(j.uv>=0)if(B.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLUVBuffer);e.vertexAttribPointer(j.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(j.uv)}else e.disableVertexAttribArray(j.uv);
  244. if(j.uv2>=0)if(B.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLUV2Buffer);e.vertexAttribPointer(j.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(j.uv2)}else e.disableVertexAttribArray(j.uv2);if(o.skinning&&j.skinVertexA>=0&&j.skinVertexB>=0&&j.skinIndex>=0&&j.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);e.vertexAttribPointer(j.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);e.vertexAttribPointer(j.skinVertexB,4,e.FLOAT,!1,0,
  245. 0);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);e.vertexAttribPointer(j.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);e.vertexAttribPointer(j.skinWeight,4,e.FLOAT,!1,0,0)}if(F instanceof THREE.Mesh)if(o.wireframe){e.lineWidth(o.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);e.drawElements(e.LINES,B.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,
  246. B.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(F instanceof THREE.Line){F=F.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(o.linewidth);e.drawArrays(F,0,B.__webGLLineCount)}else if(F instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,B.__webGLParticleCount);else F instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,B.__webGLVertexCount)}}function g(j,t){if(!j.__webGLVertexBuffer)j.__webGLVertexBuffer=e.createBuffer();if(!j.__webGLNormalBuffer)j.__webGLNormalBuffer=e.createBuffer();
  247. if(j.hasPos){e.bindBuffer(e.ARRAY_BUFFER,j.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,j.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(t.attributes.position);e.vertexAttribPointer(t.attributes.position,3,e.FLOAT,!1,0,0)}if(j.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,j.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,j.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(t.attributes.normal);e.vertexAttribPointer(t.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,j.count);
  248. j.count=0}function h(j){if(va!=j.doubleSided){j.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);va=j.doubleSided}if(ga!=j.flipSided){j.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ga=j.flipSided}}function k(j){if(la!=j){j?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);la=j}}function m(j){L[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);L[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);L[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);L[3].set(j.n41-j.n21,j.n42-
  249. j.n22,j.n43-j.n23,j.n44-j.n24);L[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);L[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);var t;for(j=0;j<6;j++){t=L[j];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function n(j){for(var t=j.matrixWorld,w=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),o=0;o<6;o++){j=L[o].x*t.n14+L[o].y*t.n24+L[o].z*t.n34+L[o].w;if(j<=w)return!1}return!0}function q(j,t){j.list[j.count]=t;j.count+=1}function x(j){var t,
  250. w,o=j.object,B=j.opaque,F=j.transparent;F.count=0;j=B.count=0;for(t=o.materials.length;j<t;j++){w=o.materials[j];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?q(F,w):q(B,w)}}function y(j){var t,w,o,B,F=j.object,H=j.buffer,E=j.opaque,A=j.transparent;A.count=0;j=E.count=0;for(o=F.materials.length;j<o;j++){t=F.materials[j];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=H.materials.length;t<w;t++)(B=H.materials[t])&&(B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?q(A,B):q(E,B))}else{B=
  251. t;B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?q(A,B):q(E,B)}}}function p(j,t){return t.z-j.z}function z(j,t){j._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(j._modelViewMatrix).transposeIntoArray(j._normalMatrixArray)}function G(j){var t,w,o;if(j instanceof THREE.Mesh){w=j.geometry;for(t in w.geometryGroups){o=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||
  252. w.__dirtyColors||w.__dirtyTangents){var B=e.DYNAMIC_DRAW,F=void 0,H=void 0,E=void 0,A=void 0;E=void 0;var T=void 0,I=void 0,Q=void 0,ha=void 0,pa=void 0,sa=void 0,Aa=void 0,xa=void 0,Ea=void 0,da=void 0,R=void 0,ia=void 0,La=void 0;I=void 0;Q=void 0;A=void 0;ha=void 0;A=void 0;da=void 0;R=void 0;I=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;A=void 0;ha=void 0;T=void 0;E=void 0;E=void 0;var Ga=
  253. void 0,eb=void 0,Ta=void 0,Ia=0,Ra=0,bb=0,db=0,Pa=0,Ua=0,Da=0,Va=0,Ma=0,N=0,Na=0,Qa=o.__vertexArray,ib=o.__uvArray,Ba=o.__uv2Array,Sa=o.__normalArray,Fa=o.__tangentArray,Oa=o.__colorArray,Ja=o.__skinVertexAArray,ua=o.__skinVertexBArray,K=o.__skinIndexArray,Z=o.__skinWeightArray,na=o.__morphTargetsArrays,aa=o.__faceArray,ta=o.__lineArray,ya=o.__needsSmoothNormals;sa=o.__vertexColorType;pa=o.__uvType;Aa=o.__normalType;var ea=j.geometry,$=ea.__dirtyVertices,Ka=ea.__dirtyElements,Xa=ea.__dirtyUvs,Ya=
  254. ea.__dirtyNormals,cb=ea.__dirtyTangents,gb=ea.__dirtyColors,ab=ea.__dirtyMorphTargets,Wa=ea.vertices,nb=o.faces,qb=ea.faces,ob=ea.faceVertexUvs[0],pb=ea.faceVertexUvs[1],kb=ea.skinVerticesA,lb=ea.skinVerticesB,mb=ea.skinIndices,hb=ea.skinWeights,jb=ea.edgeFaces,fb=ea.morphTargets;F=0;for(H=nb.length;F<H;F++){E=nb[F];A=qb[E];ob&&(xa=ob[E]);pb&&(Ea=pb[E]);E=A.vertexNormals;T=A.normal;I=A.vertexColors;Q=A.color;ha=A.vertexTangents;if(A instanceof THREE.Face3){if($){da=Wa[A.a].position;R=Wa[A.b].position;
  255. ia=Wa[A.c].position;Qa[Ra]=da.x;Qa[Ra+1]=da.y;Qa[Ra+2]=da.z;Qa[Ra+3]=R.x;Qa[Ra+4]=R.y;Qa[Ra+5]=R.z;Qa[Ra+6]=ia.x;Qa[Ra+7]=ia.y;Qa[Ra+8]=ia.z;Ra+=9}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){da=fb[Ga].vertices[A.a].position;R=fb[Ga].vertices[A.b].position;ia=fb[Ga].vertices[A.c].position;Ta=na[Ga];Ta[Na+0]=da.x;Ta[Na+1]=da.y;Ta[Na+2]=da.z;Ta[Na+3]=R.x;Ta[Na+4]=R.y;Ta[Na+5]=R.z;Ta[Na+6]=ia.x;Ta[Na+7]=ia.y;Ta[Na+8]=ia.z}Na+=9}if(hb.length){da=hb[A.a];R=hb[A.b];ia=hb[A.c];Z[N]=da.x;Z[N+1]=da.y;Z[N+2]=da.z;
  256. Z[N+3]=da.w;Z[N+4]=R.x;Z[N+5]=R.y;Z[N+6]=R.z;Z[N+7]=R.w;Z[N+8]=ia.x;Z[N+9]=ia.y;Z[N+10]=ia.z;Z[N+11]=ia.w;da=mb[A.a];R=mb[A.b];ia=mb[A.c];K[N]=da.x;K[N+1]=da.y;K[N+2]=da.z;K[N+3]=da.w;K[N+4]=R.x;K[N+5]=R.y;K[N+6]=R.z;K[N+7]=R.w;K[N+8]=ia.x;K[N+9]=ia.y;K[N+10]=ia.z;K[N+11]=ia.w;da=kb[A.a];R=kb[A.b];ia=kb[A.c];Ja[N]=da.x;Ja[N+1]=da.y;Ja[N+2]=da.z;Ja[N+3]=1;Ja[N+4]=R.x;Ja[N+5]=R.y;Ja[N+6]=R.z;Ja[N+7]=1;Ja[N+8]=ia.x;Ja[N+9]=ia.y;Ja[N+10]=ia.z;Ja[N+11]=1;da=lb[A.a];R=lb[A.b];ia=lb[A.c];ua[N]=da.x;ua[N+
  257. 1]=da.y;ua[N+2]=da.z;ua[N+3]=1;ua[N+4]=R.x;ua[N+5]=R.y;ua[N+6]=R.z;ua[N+7]=1;ua[N+8]=ia.x;ua[N+9]=ia.y;ua[N+10]=ia.z;ua[N+11]=1;N+=12}if(gb&&sa){if(I.length==3&&sa==THREE.VertexColors){A=I[0];da=I[1];R=I[2]}else R=da=A=Q;Oa[Ma]=A.r;Oa[Ma+1]=A.g;Oa[Ma+2]=A.b;Oa[Ma+3]=da.r;Oa[Ma+4]=da.g;Oa[Ma+5]=da.b;Oa[Ma+6]=R.r;Oa[Ma+7]=R.g;Oa[Ma+8]=R.b;Ma+=9}if(cb&&ea.hasTangents){I=ha[0];Q=ha[1];A=ha[2];Fa[Da]=I.x;Fa[Da+1]=I.y;Fa[Da+2]=I.z;Fa[Da+3]=I.w;Fa[Da+4]=Q.x;Fa[Da+5]=Q.y;Fa[Da+6]=Q.z;Fa[Da+7]=Q.w;Fa[Da+8]=
  258. A.x;Fa[Da+9]=A.y;Fa[Da+10]=A.z;Fa[Da+11]=A.w;Da+=12}if(Ya&&Aa)if(E.length==3&&ya)for(ha=0;ha<3;ha++){T=E[ha];Sa[Ua]=T.x;Sa[Ua+1]=T.y;Sa[Ua+2]=T.z;Ua+=3}else for(ha=0;ha<3;ha++){Sa[Ua]=T.x;Sa[Ua+1]=T.y;Sa[Ua+2]=T.z;Ua+=3}if(Xa&&xa!==undefined&&pa)for(ha=0;ha<3;ha++){E=xa[ha];ib[bb]=E.u;ib[bb+1]=E.v;bb+=2}if(Xa&&Ea!==undefined&&pa)for(ha=0;ha<3;ha++){E=Ea[ha];Ba[db]=E.u;Ba[db+1]=E.v;db+=2}if(Ka){aa[Pa]=Ia;aa[Pa+1]=Ia+1;aa[Pa+2]=Ia+2;Pa+=3;ta[Va]=Ia;ta[Va+1]=Ia+1;ta[Va+2]=Ia;ta[Va+3]=Ia+2;ta[Va+4]=Ia+
  259. 1;ta[Va+5]=Ia+2;Va+=6;Ia+=3}}else if(A instanceof THREE.Face4){if($){da=Wa[A.a].position;R=Wa[A.b].position;ia=Wa[A.c].position;La=Wa[A.d].position;Qa[Ra]=da.x;Qa[Ra+1]=da.y;Qa[Ra+2]=da.z;Qa[Ra+3]=R.x;Qa[Ra+4]=R.y;Qa[Ra+5]=R.z;Qa[Ra+6]=ia.x;Qa[Ra+7]=ia.y;Qa[Ra+8]=ia.z;Qa[Ra+9]=La.x;Qa[Ra+10]=La.y;Qa[Ra+11]=La.z;Ra+=12}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){da=fb[Ga].vertices[A.a].position;R=fb[Ga].vertices[A.b].position;ia=fb[Ga].vertices[A.c].position;La=fb[Ga].vertices[A.d].position;Ta=na[Ga];
  260. Ta[Na+0]=da.x;Ta[Na+1]=da.y;Ta[Na+2]=da.z;Ta[Na+3]=R.x;Ta[Na+4]=R.y;Ta[Na+5]=R.z;Ta[Na+6]=ia.x;Ta[Na+7]=ia.y;Ta[Na+8]=ia.z;Ta[Na+9]=La.x;Ta[Na+10]=La.y;Ta[Na+11]=La.z}Na+=12}if(hb.length){da=hb[A.a];R=hb[A.b];ia=hb[A.c];La=hb[A.d];Z[N]=da.x;Z[N+1]=da.y;Z[N+2]=da.z;Z[N+3]=da.w;Z[N+4]=R.x;Z[N+5]=R.y;Z[N+6]=R.z;Z[N+7]=R.w;Z[N+8]=ia.x;Z[N+9]=ia.y;Z[N+10]=ia.z;Z[N+11]=ia.w;Z[N+12]=La.x;Z[N+13]=La.y;Z[N+14]=La.z;Z[N+15]=La.w;da=mb[A.a];R=mb[A.b];ia=mb[A.c];La=mb[A.d];K[N]=da.x;K[N+1]=da.y;K[N+2]=da.z;K[N+
  261. 3]=da.w;K[N+4]=R.x;K[N+5]=R.y;K[N+6]=R.z;K[N+7]=R.w;K[N+8]=ia.x;K[N+9]=ia.y;K[N+10]=ia.z;K[N+11]=ia.w;K[N+12]=La.x;K[N+13]=La.y;K[N+14]=La.z;K[N+15]=La.w;da=kb[A.a];R=kb[A.b];ia=kb[A.c];La=kb[A.d];Ja[N]=da.x;Ja[N+1]=da.y;Ja[N+2]=da.z;Ja[N+3]=1;Ja[N+4]=R.x;Ja[N+5]=R.y;Ja[N+6]=R.z;Ja[N+7]=1;Ja[N+8]=ia.x;Ja[N+9]=ia.y;Ja[N+10]=ia.z;Ja[N+11]=1;Ja[N+12]=La.x;Ja[N+13]=La.y;Ja[N+14]=La.z;Ja[N+15]=1;da=lb[A.a];R=lb[A.b];ia=lb[A.c];A=lb[A.d];ua[N]=da.x;ua[N+1]=da.y;ua[N+2]=da.z;ua[N+3]=1;ua[N+4]=R.x;ua[N+5]=
  262. R.y;ua[N+6]=R.z;ua[N+7]=1;ua[N+8]=ia.x;ua[N+9]=ia.y;ua[N+10]=ia.z;ua[N+11]=1;ua[N+12]=A.x;ua[N+13]=A.y;ua[N+14]=A.z;ua[N+15]=1;N+=16}if(gb&&sa){if(I.length==4&&sa==THREE.VertexColors){A=I[0];da=I[1];R=I[2];I=I[3]}else I=R=da=A=Q;Oa[Ma]=A.r;Oa[Ma+1]=A.g;Oa[Ma+2]=A.b;Oa[Ma+3]=da.r;Oa[Ma+4]=da.g;Oa[Ma+5]=da.b;Oa[Ma+6]=R.r;Oa[Ma+7]=R.g;Oa[Ma+8]=R.b;Oa[Ma+9]=I.r;Oa[Ma+10]=I.g;Oa[Ma+11]=I.b;Ma+=12}if(cb&&ea.hasTangents){I=ha[0];Q=ha[1];A=ha[2];ha=ha[3];Fa[Da]=I.x;Fa[Da+1]=I.y;Fa[Da+2]=I.z;Fa[Da+3]=I.w;
  263. Fa[Da+4]=Q.x;Fa[Da+5]=Q.y;Fa[Da+6]=Q.z;Fa[Da+7]=Q.w;Fa[Da+8]=A.x;Fa[Da+9]=A.y;Fa[Da+10]=A.z;Fa[Da+11]=A.w;Fa[Da+12]=ha.x;Fa[Da+13]=ha.y;Fa[Da+14]=ha.z;Fa[Da+15]=ha.w;Da+=16}if(Ya&&Aa)if(E.length==4&&ya)for(ha=0;ha<4;ha++){T=E[ha];Sa[Ua]=T.x;Sa[Ua+1]=T.y;Sa[Ua+2]=T.z;Ua+=3}else for(ha=0;ha<4;ha++){Sa[Ua]=T.x;Sa[Ua+1]=T.y;Sa[Ua+2]=T.z;Ua+=3}if(Xa&&xa!==undefined&&pa)for(ha=0;ha<4;ha++){E=xa[ha];ib[bb]=E.u;ib[bb+1]=E.v;bb+=2}if(Xa&&Ea!==undefined&&pa)for(ha=0;ha<4;ha++){E=Ea[ha];Ba[db]=E.u;Ba[db+1]=
  264. E.v;db+=2}if(Ka){aa[Pa]=Ia;aa[Pa+1]=Ia+1;aa[Pa+2]=Ia+3;aa[Pa+3]=Ia+1;aa[Pa+4]=Ia+2;aa[Pa+5]=Ia+3;Pa+=6;ta[Va]=Ia;ta[Va+1]=Ia+1;ta[Va+2]=Ia;ta[Va+3]=Ia+3;ta[Va+4]=Ia+1;ta[Va+5]=Ia+2;ta[Va+6]=Ia+2;ta[Va+7]=Ia+3;Va+=8;Ia+=4}}}if(jb){F=0;for(H=jb.length;F<H;F++){aa[Pa]=jb[F].a;aa[Pa+1]=jb[F].b;aa[Pa+2]=jb[F].c;aa[Pa+3]=jb[F].a;aa[Pa+4]=jb[F].c;aa[Pa+5]=jb[F].d;Pa+=6}}if($){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Qa,B)}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){e.bindBuffer(e.ARRAY_BUFFER,
  265. o.__webGLMorphTargetsBuffers[Ga]);e.bufferData(e.ARRAY_BUFFER,na[Ga],B)}}if(gb&&Ma>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Oa,B)}if(Ya){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Sa,B)}if(cb&&ea.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,Fa,B)}if(Xa&&bb>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,B)}if(Xa&&db>0){e.bindBuffer(e.ARRAY_BUFFER,
  266. o.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Ba,B)}if(Ka){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,aa,B);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ta,B)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Ja,B);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ua,B);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);
  267. e.bufferData(e.ARRAY_BUFFER,K,B);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Z,B)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=e.DYNAMIC_DRAW;Aa=j.vertices;B=j.colors;xa=Aa.length;F=B.length;Ea=j.__vertexArray;H=j.__colorArray;Ia=j.__dirtyColors;if(j.__dirtyVertices){for(pa=
  268. 0;pa<xa;pa++){sa=Aa[pa].position;o=pa*3;Ea[o]=sa.x;Ea[o+1]=sa.y;Ea[o+2]=sa.z}e.bindBuffer(e.ARRAY_BUFFER,j.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ea,t)}if(Ia){for(pa=0;pa<F;pa++){color=B[pa];o=pa*3;H[o]=color.r;H[o+1]=color.g;H[o+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,j.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,H,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Line){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=e.DYNAMIC_DRAW;Aa=j.vertices;B=j.colors;
  269. xa=Aa.length;F=B.length;Ea=j.__vertexArray;H=j.__colorArray;Ia=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<xa;pa++){sa=Aa[pa].position;o=pa*3;Ea[o]=sa.x;Ea[o+1]=sa.y;Ea[o+2]=sa.z}e.bindBuffer(e.ARRAY_BUFFER,j.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ea,t)}if(Ia){for(pa=0;pa<F;pa++){color=B[pa];o=pa*3;H[o]=color.r;H[o+1]=color.g;H[o+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,j.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,H,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof
  270. THREE.ParticleSystem){w=j.geometry;(w.__dirtyVertices||w.__dirtyColors||j.sortParticles)&&c(w,e.DYNAMIC_DRAW,j);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function M(j){function t(ha){var pa=[];w=0;for(o=ha.length;w<o;w++)ha[w]==undefined?pa.push("undefined"):pa.push(ha[w].id);return pa.join("_")}var w,o,B,F,H,E,A,T,I={},Q=j.morphTargets!==undefined?j.morphTargets.length:0;j.geometryGroups={};B=0;for(F=j.faces.length;B<F;B++){H=j.faces[B];E=H.materials;A=t(E);I[A]==undefined&&(I[A]={hash:A,counter:0});
  271. T=I[A].hash+"_"+I[A].counter;j.geometryGroups[T]==undefined&&(j.geometryGroups[T]={faces:[],materials:E,vertices:0,numMorphTargets:Q});H=H instanceof THREE.Face3?3:4;if(j.geometryGroups[T].vertices+H>65535){I[A].counter+=1;T=I[A].hash+"_"+I[A].counter;j.geometryGroups[T]==undefined&&(j.geometryGroups[T]={faces:[],materials:E,vertices:0,numMorphTargets:Q})}j.geometryGroups[T].faces.push(B);j.geometryGroups[T].vertices+=H}}function D(j,t,w){j.push({buffer:t,object:w,opaque:{list:[],count:0},transparent:{list:[],
  272. count:0}})}function J(j){if(j!=za){switch(j){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)}za=j}}function C(j,t,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){e.texParameteri(j,e.TEXTURE_WRAP_S,
  273. W(t.wrapS));e.texParameteri(j,e.TEXTURE_WRAP_T,W(t.wrapT));e.texParameteri(j,e.TEXTURE_MAG_FILTER,W(t.magFilter));e.texParameteri(j,e.TEXTURE_MIN_FILTER,W(t.minFilter));e.generateMipmap(j)}else{e.texParameteri(j,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(j,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(j,e.TEXTURE_MAG_FILTER,O(t.magFilter));e.texParameteri(j,e.TEXTURE_MIN_FILTER,O(t.minFilter))}}function U(j){if(j&&!j.__webGLFramebuffer){j.__webGLFramebuffer=e.createFramebuffer();j.__webGLRenderbuffer=
  274. e.createRenderbuffer();j.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,j.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,j.width,j.height);e.bindTexture(e.TEXTURE_2D,j.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,W(j.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,W(j.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,W(j.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,W(j.minFilter));e.texImage2D(e.TEXTURE_2D,
  275. 0,W(j.format),j.width,j.height,0,W(j.format),W(j.type),null);e.bindFramebuffer(e.FRAMEBUFFER,j.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,j.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,j.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var t,w;if(j){t=j.__webGLFramebuffer;w=j.width;j=j.height}else{t=null;w=ca;j=S}if(t!=X){e.bindFramebuffer(e.FRAMEBUFFER,
  276. t);e.viewport(oa,ma,w,j);X=t}}function P(j,t){var w;if(j=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else j=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,t);e.compileShader(w);if(!e.getShaderParameter(w,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(w));console.error(t);return null}return w}function O(j){switch(j){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function W(j){switch(j){case THREE.RepeatWrapping:return e.REPEAT;
  277. case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;
  278. case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var Y=document.createElement("canvas"),
  279. e,ja=null,X=null,V=this,va=null,ga=null,za=null,la=null,oa=0,ma=0,ca=0,S=0,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],fa=new THREE.Matrix4,ra=new Float32Array(16),ka=new Float32Array(16),qa=new THREE.Vector4,wa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ca=!0,Za=new THREE.Color(0),$a=0;if(a){if(a.antialias!==undefined)Ca=a.antialias;a.clearColor!==undefined&&Za.setHex(a.clearColor);
  280. if(a.clearAlpha!==undefined)$a=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Y;this.autoClear=!0;this.sortObjects=!0;(function(j,t,w){try{if(!(e=Y.getContext("experimental-webgl",{antialias:j,stencil:!0})))throw"Error creating WebGL context.";}catch(o){console.error(o)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(t.r,t.g,t.b,
  281. w)})(Ca,Za,$a);this.context=e;var Ha={};a=[];Ca=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Ca[0]=0;Ca[1]=1;Ca[2]=2;Ca[3]=0;Ca[4]=2;Ca[5]=3;Ha.vertexBuffer=e.createBuffer();Ha.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,Ha.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,new Float32Array(a),e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,Ha.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array(Ca),e.STATIC_DRAW);Ha.program=
  282. e.createProgram();e.attachShader(Ha.program,P("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(Ha.program,P("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(Ha.program);Ha.vertexLocation=e.getAttribLocation(Ha.program,"position");Ha.projectionLocation=e.getUniformLocation(Ha.program,"projectionMatrix");this.setSize=function(j,t){Y.width=j;Y.height=t;this.setViewport(0,0,Y.width,Y.height)};this.setViewport=function(j,t,w,o){oa=j;ma=t;ca=w;S=o;e.viewport(oa,ma,ca,
  283. S)};this.setScissor=function(j,t,w,o){e.scissor(j,t,w,o)};this.enableScissorTest=function(j){j?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(j){e.depthMask(j)};this.setClearColorHex=function(j,t){var w=new THREE.Color(j);e.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(j,t){e.clearColor(j.r,j.g,j.b,t)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.initMaterial=function(j,t,w,o){var B,F,H,E;if(j instanceof
  284. THREE.MeshDepthMaterial)b(j,THREE.ShaderLib.depth);else if(j instanceof THREE.ShadowVolumeDynamicMaterial)b(j,THREE.ShaderLib.shadowVolumeDynamic);else if(j instanceof THREE.MeshNormalMaterial)b(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial)b(j,THREE.ShaderLib.basic);else if(j instanceof THREE.MeshLambertMaterial)b(j,THREE.ShaderLib.lambert);else if(j instanceof THREE.MeshPhongMaterial)b(j,THREE.ShaderLib.phong);else if(j instanceof THREE.LineBasicMaterial)b(j,THREE.ShaderLib.basic);
  285. else j instanceof THREE.ParticleBasicMaterial&&b(j,THREE.ShaderLib.particle_basic);if(!j.program){var A,T,I;A=I=E=0;for(H=t.length;A<H;A++){T=t[A];T instanceof THREE.DirectionalLight&&I++;T instanceof THREE.PointLight&&E++}if(E+I<=4)t=I;else{t=Math.ceil(4*I/(E+I));E=4-t}E={directional:t,point:E};t=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)t=o.bones.length;H={fog:w,map:j.map,envMap:j.envMap,lightMap:j.lightMap,vertexColors:j.vertexColors,sizeAttenuation:j.sizeAttenuation,skinning:j.skinning,
  286. morphTargets:j.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=j.fragmentShader;E=j.vertexShader;t=e.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,H.fog?"#define USE_FOG":"",H.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
  287. H=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":"",H.morphTargets?"#define USE_MORPHTARGETS":"",H.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
  288. e.attachShader(t,P("fragment",A+w));e.attachShader(t,P("vertex",H+E));e.linkProgram(t);e.getProgramParameter(t,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");t.uniforms={};t.attributes={};j.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in j.uniforms)w.push(B);
  289. B=j.program;E=0;for(t=w.length;E<t;E++){A=w[E];B.uniforms[A]=e.getUniformLocation(B,A)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<this.maxMorphTargets;B++)w.push("morphTarget"+B);for(F in j.attributes)w.push(F);F=j.program;B=w;w=0;for(E=B.length;w<E;w++){t=B[w];F.attributes[t]=e.getAttribLocation(F,t)}F=j.program.attributes;e.enableVertexAttribArray(F.position);F.color>=0&&e.enableVertexAttribArray(F.color);F.normal>=0&&e.enableVertexAttribArray(F.normal);
  290. F.tangent>=0&&e.enableVertexAttribArray(F.tangent);if(j.skinning&&F.skinVertexA>=0&&F.skinVertexB>=0&&F.skinIndex>=0&&F.skinWeight>=0){e.enableVertexAttribArray(F.skinVertexA);e.enableVertexAttribArray(F.skinVertexB);e.enableVertexAttribArray(F.skinIndex);e.enableVertexAttribArray(F.skinWeight)}if(j.morphTargets){j.numSupportedMorphTargets=0;if(F.morphTarget0>=0){e.enableVertexAttribArray(F.morphTarget0);j.numSupportedMorphTargets++}if(F.morphTarget1>=0){e.enableVertexAttribArray(F.morphTarget1);
  291. j.numSupportedMorphTargets++}if(F.morphTarget2>=0){e.enableVertexAttribArray(F.morphTarget2);j.numSupportedMorphTargets++}if(F.morphTarget3>=0){e.enableVertexAttribArray(F.morphTarget3);j.numSupportedMorphTargets++}if(F.morphTarget4>=0){e.enableVertexAttribArray(F.morphTarget4);j.numSupportedMorphTargets++}if(F.morphTarget5>=0){e.enableVertexAttribArray(F.morphTarget5);j.numSupportedMorphTargets++}if(F.morphTarget6>=0){e.enableVertexAttribArray(F.morphTarget6);j.numSupportedMorphTargets++}if(F.morphTarget7>=
  292. 0){e.enableVertexAttribArray(F.morphTarget7);j.numSupportedMorphTargets++}o.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(B=0;B<this.maxMorphTargets;B++)o.__webGLMorphTargetInfluences[B]=0}}j.__webglProgram=!0};this.render=function(j,t,w,o){var B,F,H,E,A,T,I,Q,ha=j.lights,pa=j.fog;t.matrixAutoUpdate&&t.updateMatrix();j.update(undefined,!1,t);t.matrixWorldInverse.flattenToArray(ka);t.projectionMatrix.flattenToArray(ra);fa.multiply(t.projectionMatrix,t.matrixWorldInverse);
  293. m(fa);this.initWebGLObjects(j);U(w);(this.autoClear||o)&&this.clear();o=j.__webglObjects.length;for(A=0;A<o;A++){E=j.__webglObjects[A];I=E.object;if(I.visible)if(!(I instanceof THREE.Mesh)||n(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);z(I,t);y(E);E.render=!0;if(this.sortObjects){qa.copy(I.position);fa.multiplyVector3(qa);E.z=qa.z}}else E.render=!1;else E.render=!1}this.sortObjects&&j.__webglObjects.sort(p);T=j.__webglObjectsImmediate.length;for(A=0;A<T;A++){E=j.__webglObjectsImmediate[A];
  294. I=E.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);z(I,t);x(E)}}J(THREE.NormalBlending);for(A=0;A<o;A++){E=j.__webglObjects[A];if(E.render){I=E.object;Q=E.buffer;H=E.opaque;h(I);for(B=0;B<H.count;B++){E=H.list[B];k(E.depthTest);f(t,ha,pa,E,Q,I)}}}for(A=0;A<T;A++){E=j.__webglObjectsImmediate[A];I=E.object;if(I.visible){H=E.opaque;h(I);for(B=0;B<H.count;B++){E=H.list[B];k(E.depthTest);F=d(t,ha,pa,E,I);I.render(function(sa){g(sa,F)})}}}for(A=0;A<o;A++){E=
  295. j.__webglObjects[A];if(E.render){I=E.object;Q=E.buffer;H=E.transparent;h(I);for(B=0;B<H.count;B++){E=H.list[B];J(E.blending);k(E.depthTest);f(t,ha,pa,E,Q,I)}}}for(A=0;A<T;A++){E=j.__webglObjectsImmediate[A];I=E.object;if(I.visible){H=E.transparent;h(I);for(B=0;B<H.count;B++){E=H.list[B];J(E.blending);k(E.depthTest);F=d(t,ha,pa,E,I);I.render(function(sa){g(sa,F)})}}}if(j.__webglShadowVolumes.length&&j.lights.length){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.depthMask(!1);
  296. e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);T=j.lights.length;Q=[];o=j.__webglShadowVolumes.length;for(t=0;t<T;t++){A=j.lights[t];if(A instanceof THREE.DirectionalLight){Q[0]=-A.position.x;Q[1]=-A.position.y;Q[2]=-A.position.z;for(A=0;A<o;A++){I=j.__webglShadowVolumes[A].object;B=j.__webglShadowVolumes[A].buffer;E=I.materials[0];E.program||V.initMaterial(E,ha,pa,I);F=E.program;E=F.uniforms;
  297. H=F.attributes;if(ja!==F){e.useProgram(F);ja=F;e.uniformMatrix4fv(E.projectionMatrix,!1,ra);e.uniformMatrix4fv(E.viewMatrix,!1,ka);e.uniform3fv(E.directionalLightDirection,Q)}I.matrixWorld.flattenToArray(I._objectMatrixArray);e.uniformMatrix4fv(E.objectMatrix,!1,I._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLVertexBuffer);e.vertexAttribPointer(H.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLNormalBuffer);e.vertexAttribPointer(H.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
  298. B.__webGLFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,B.__webGLFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,B.__webGLFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);za="";ja=Ha.program;e.useProgram(Ha.program);e.uniformMatrix4fv(Ha.projectionLocation,
  299. !1,ra);e.bindBuffer(e.ARRAY_BUFFER,Ha.vertexBuffer);e.vertexAttribPointer(Ha.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(Ha.vertexLocation);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,Ha.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.disable(e.BLEND);e.depthMask(!0)}if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,w.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,
  300. null)}};this.initWebGLObjects=function(j){if(!j.__webglObjects){j.__webglObjects=[];j.__webglObjectsImmediate=[];j.__webglShadowVolumes=[]}for(;j.__objectsAdded.length;){var t=j.__objectsAdded[0],w=j,o=void 0,B=void 0,F=void 0;if(t._modelViewMatrix==undefined){t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);t._modelViewMatrixArray=new Float32Array(16);t._objectMatrixArray=new Float32Array(16);t.matrixWorld.flattenToArray(t._objectMatrixArray)}if(t instanceof THREE.Mesh){B=
  301. t.geometry;B.geometryGroups==undefined&&M(B);for(o in B.geometryGroups){F=B.geometryGroups[o];if(!F.__webGLVertexBuffer){var H=F;H.__webGLVertexBuffer=e.createBuffer();H.__webGLNormalBuffer=e.createBuffer();H.__webGLTangentBuffer=e.createBuffer();H.__webGLColorBuffer=e.createBuffer();H.__webGLUVBuffer=e.createBuffer();H.__webGLUV2Buffer=e.createBuffer();H.__webGLSkinVertexABuffer=e.createBuffer();H.__webGLSkinVertexBBuffer=e.createBuffer();H.__webGLSkinIndicesBuffer=e.createBuffer();H.__webGLSkinWeightsBuffer=
  302. e.createBuffer();H.__webGLFaceBuffer=e.createBuffer();H.__webGLLineBuffer=e.createBuffer();if(H.numMorphTargets){var E=void 0,A=void 0;H.__webGLMorphTargetsBuffers=[];E=0;for(A=H.numMorphTargets;E<A;E++)H.__webGLMorphTargetsBuffers.push(e.createBuffer())}H=F;E=t;var T=void 0,I=void 0,Q=void 0;Q=void 0;var ha=A=0,pa=0;T=void 0;I=void 0;var sa=void 0;I=void 0;var Aa=E.geometry;sa=Aa.faces;var xa=H.faces;T=0;for(I=xa.length;T<I;T++){Q=xa[T];Q=sa[Q];if(Q instanceof THREE.Face3){A+=3;ha+=1;pa+=3}else if(Q instanceof
  303. THREE.Face4){A+=4;ha+=2;pa+=4}}T=H;I=E;sa=void 0;xa=void 0;var Ea=void 0,da=void 0;Ea=void 0;Q=[];sa=0;for(xa=I.materials.length;sa<xa;sa++){Ea=I.materials[sa];if(Ea instanceof THREE.MeshFaceMaterial){Ea=0;for(l=T.materials.length;Ea<l;Ea++)(da=T.materials[Ea])&&Q.push(da)}else(da=Ea)&&Q.push(da)}I=Q;a:{T=void 0;sa=void 0;xa=I.length;for(T=0;T<xa;T++){sa=I[T];if(sa.map||sa.lightMap||sa instanceof THREE.MeshShaderMaterial){T=!0;break a}}T=!1}a:{sa=I;xa=void 0;Q=void 0;Ea=sa.length;for(xa=0;xa<Ea;xa++){Q=
  304. sa[xa];if(!(Q instanceof THREE.MeshBasicMaterial&&!Q.envMap||Q instanceof THREE.MeshDepthMaterial)){sa=Q&&Q.shading!=undefined&&Q.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}sa=!1}a:{xa=void 0;Q=void 0;Ea=I.length;for(xa=0;xa<Ea;xa++){Q=I[xa];if(Q.vertexColors){I=Q.vertexColors;break a}}I=!1}H.__vertexArray=new Float32Array(A*3);if(sa)H.__normalArray=new Float32Array(A*3);if(Aa.hasTangents)H.__tangentArray=new Float32Array(A*4);if(I)H.__colorArray=new Float32Array(A*
  305. 3);if(T){if(Aa.faceUvs.length>0||Aa.faceVertexUvs.length>0)H.__uvArray=new Float32Array(A*2);if(Aa.faceUvs.length>1||Aa.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(A*2)}if(E.geometry.skinWeights.length&&E.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(A*4);H.__skinVertexBArray=new Float32Array(A*4);H.__skinIndexArray=new Float32Array(A*4);H.__skinWeightArray=new Float32Array(A*4)}H.__faceArray=new Uint16Array(ha*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0));
  306. H.__lineArray=new Uint16Array(pa*2);if(H.numMorphTargets){Aa=void 0;xa=void 0;H.__morphTargetsArrays=[];Aa=0;for(xa=H.numMorphTargets;Aa<xa;Aa++)H.__morphTargetsArrays.push(new Float32Array(A*3))}H.__needsSmoothNormals=sa==THREE.SmoothShading;H.__uvType=T;H.__vertexColorType=I;H.__normalType=sa;H.__webGLFaceCount=ha*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0);H.__webGLLineCount=pa*2;B.__dirtyVertices=!0;B.__dirtyMorphTargets=!0;B.__dirtyElements=!0;B.__dirtyUvs=!0;B.__dirtyNormals=!0;
  307. B.__dirtyTangents=!0;B.__dirtyColors=!0}t instanceof THREE.ShadowVolume?D(w.__webglShadowVolumes,F,t):D(w.__webglObjects,F,t)}}else if(t instanceof THREE.Ribbon){B=t.geometry;if(!B.__webGLVertexBuffer){o=B;o.__webGLVertexBuffer=e.createBuffer();o.__webGLColorBuffer=e.createBuffer();o=B;F=o.vertices.length;o.__vertexArray=new Float32Array(F*3);o.__colorArray=new Float32Array(F*3);o.__webGLVertexCount=F;B.__dirtyVertices=!0;B.__dirtyColors=!0}D(w.__webglObjects,B,t)}else if(t instanceof THREE.Line){B=
  308. t.geometry;if(!B.__webGLVertexBuffer){o=B;o.__webGLVertexBuffer=e.createBuffer();o.__webGLColorBuffer=e.createBuffer();o=B;F=o.vertices.length;o.__vertexArray=new Float32Array(F*3);o.__colorArray=new Float32Array(F*3);o.__webGLLineCount=F;B.__dirtyVertices=!0;B.__dirtyColors=!0}D(w.__webglObjects,B,t)}else if(t instanceof THREE.ParticleSystem){B=t.geometry;if(!B.__webGLVertexBuffer){o=B;o.__webGLVertexBuffer=e.createBuffer();o.__webGLColorBuffer=e.createBuffer();o=B;F=o.vertices.length;o.__vertexArray=
  309. new Float32Array(F*3);o.__colorArray=new Float32Array(F*3);o.__sortArray=[];o.__webGLParticleCount=F;B.__dirtyVertices=!0;B.__dirtyColors=!0}D(w.__webglObjects,B,t)}else THREE.MarchingCubes!==undefined&&t instanceof THREE.MarchingCubes&&w.__webglObjectsImmediate.push({object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});j.__objectsAdded.splice(0,1)}for(;j.__objectsRemoved.length;){t=j.__objectsRemoved[0];w=j;B=void 0;o=void 0;for(B=w.__webglObjects.length-1;B>=0;B--){o=w.__webglObjects[B].object;
  310. t==o&&w.__webglObjects.splice(B,1)}j.__objectsRemoved.splice(0,1)}t=0;for(w=j.__webglObjects.length;t<w;t++)G(j.__webglObjects[t].object,j);t=0;for(w=j.__webglShadowVolumes.length;t<w;t++)G(j.__webglShadowVolumes[t].object,j)};this.setFaceCulling=function(j,t){if(j){!t||t=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(j=="back")e.cullFace(e.BACK);else j=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
  311. 0}};THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,f=b.length;for(d=0;d<f;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
  312. 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)};
  313. THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
  314. THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
  315. THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
  316. var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,k=a.faces,m=f.faces,n=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var q=0,x=h.length;q<x;q++){var y=new THREE.Vertex(h[q].position.clone());b&&c.matrix.multiplyVector3(y.position);g.push(y)}q=0;for(x=m.length;q<x;q++){h=m[q];var p,z,G=h.vertexNormals;y=h.vertexColors;if(h instanceof THREE.Face3)p=new THREE.Face3(h.a+d,h.b+d,h.c+
  317. d);else h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+d,h.b+d,h.c+d,h.d+d));p.normal.copy(h.normal);b=0;for(g=G.length;b<g;b++){z=G[b];p.vertexNormals.push(z.clone())}p.color.copy(h.color);b=0;for(g=y.length;b<g;b++){z=y[b];p.vertexColors.push(z.clone())}p.materials=h.materials.slice();p.centroid.copy(h.centroid);k.push(p)}q=0;for(x=f.length;q<x;q++){d=f[q];k=[];b=0;for(g=d.length;b<g;b++)k.push(new THREE.UV(d[b].u,d[b].v));n.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,f=
  318. new THREE.Texture(d,c);d.onload=function(){f.needsUpdate=!0;b&&b(this)};d.src=a;return f},loadTextureCube:function(a,c,b){var d,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(d=a.length;c<d;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(q in W.objects)if(!ga.objects[q]){G=W.objects[q];if(C=ga.geometries[G.geometry]){O=
  319. [];for(i=0;i<G.materials.length;i++)O[i]=ga.materials[G.materials[i]];M=G.position;r=G.rotation;s=G.scale;object=new THREE.Mesh(C,O);object.position.set(M[0],M[1],M[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;ga.scene.addObject(object);ga.objects[q]=object}}}function h(za){return function(la){ga.geometries[za]=la;g();ja-=1;k()}}function k(){d({total_models:V,total_textures:va,loaded_models:V-ja,loaded_textures:va-X},ga);ja==0&&X==0&&b(ga)}var m,
  320. n,q,x,y,p,z,G,M,D,J,C,U,P,O,W,Y,e,ja,X,V,va,ga;W=f.data;Y=new THREE.BinaryLoader;e=new THREE.JSONLoader;X=ja=0;ga={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};f=function(){X-=1;k()};for(y in W.cameras){D=W.cameras[y];if(D.type=="perspective")U=new THREE.Camera(D.fov,D.aspect,D.near,D.far);else if(D.type=="ortho"){U=new THREE.Camera;U.projectionMatrix=THREE.Matrix4.makeOrtho(D.left,D.right,D.top,D.bottom,D.near,D.far)}M=D.position;D=D.target;
  321. U.position.set(M[0],M[1],M[2]);U.target.position.set(D[0],D[1],D[2]);ga.cameras[y]=U}for(x in W.lights){y=W.lights[x];if(y.type=="directional"){M=y.direction;light=new THREE.DirectionalLight;light.position.set(M[0],M[1],M[2]);light.position.normalize()}else if(y.type=="point"){M=y.position;light=new THREE.PointLight;light.position.set(M[0],M[1],M[2])}D=y.color;i=y.intensity||1;light.color.setRGB(D[0]*i,D[1]*i,D[2]*i);ga.scene.addLight(light);ga.lights[x]=light}for(p in W.fogs){x=W.fogs[p];if(x.type==
  322. "linear")P=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(P=new THREE.FogExp2(0,x.density));D=x.color;P.color.setRGB(D[0],D[1],D[2]);ga.fogs[p]=P}if(ga.cameras&&W.defaults.camera)ga.currentCamera=ga.cameras[W.defaults.camera];if(ga.fogs&&W.defaults.fog)ga.scene.fog=ga.fogs[W.defaults.fog];D=W.defaults.bgcolor;ga.bgColor=new THREE.Color;ga.bgColor.setRGB(D[0],D[1],D[2]);ga.bgColorAlpha=W.defaults.bgalpha;for(m in W.geometries){p=W.geometries[m];if(p.type=="bin_mesh"||p.type=="ascii_mesh")ja+=
  323. 1}V=ja;for(m in W.geometries){p=W.geometries[m];if(p.type=="cube"){C=new Cube(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides);ga.geometries[m]=C}else if(p.type=="plane"){C=new Plane(p.width,p.height,p.segmentsWidth,p.segmentsHeight);ga.geometries[m]=C}else if(p.type=="sphere"){C=new Sphere(p.radius,p.segmentsWidth,p.segmentsHeight);ga.geometries[m]=C}else if(p.type=="cylinder"){C=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);
  324. ga.geometries[m]=C}else if(p.type=="torus"){C=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);ga.geometries[m]=C}else if(p.type=="icosahedron"){C=new Icosahedron(p.subdivisions);ga.geometries[m]=C}else if(p.type=="bin_mesh")Y.load({model:p.url,callback:h(m)});else p.type=="ascii_mesh"&&e.load({model:p.url,callback:h(m)})}for(z in W.textures){m=W.textures[z];X+=m.url instanceof Array?m.url.length:1}va=X;for(z in W.textures){m=W.textures[z];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=
  325. new THREE[m.mapping];if(m.url instanceof Array)p=ImageUtils.loadTextureCube(m.url,m.mapping,f);else{p=ImageUtils.loadTexture(m.url,m.mapping,f);if(THREE[m.minFilter]!=undefined)p.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)p.magFilter=THREE[m.magFilter]}ga.textures[z]=p}for(n in W.materials){z=W.materials[n];for(J in z.parameters)if(J=="envMap"||J=="map"||J=="lightMap")z.parameters[J]=ga.textures[z.parameters[J]];else if(J=="shading")z.parameters[J]=z.parameters[J]=="flat"?THREE.FlatShading:
  326. THREE.SmoothShading;else if(J=="blending")z.parameters[J]=THREE[z.parameters[J]]?THREE[z.parameters[J]]:THREE.NormalBlending;else J=="combine"&&(z.parameters[J]=z.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);z=new THREE[z.type](z.parameters);ga.materials[n]=z}g();c(ga)}},addMesh:function(a,c,b,d,f,g,h,k,m,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=k;c.rotation.z=m;a.addObject(c);return c},
  327. addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
  328. d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,
  329. c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,f=a.children.length;
  330. for(d=0;d<f;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},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:1,texture: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, 1.0, 1.0, 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;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
  331. 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 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
  332. normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
  333. uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragmentShader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
  334. vertexShader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\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 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
  335. cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
  336. value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
  337. film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
  338. screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
  339. fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
  340. THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
  341. a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
  342. this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
  343. !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
  344. !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
  345. var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
  346. !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
  347. THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
  348. THREE.PathCamera=function(a){function c(n,q,x,y){var p={name:x,fps:0.6,length:y,hierarchy:[]},z,G=q.getControlPointsArray(),M=q.getLength(),D=G.length,J=0;z=D-1;q={parent:-1,keys:[]};q.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};q.keys[z]={time:y,pos:G[z],rot:[0,0,0,1],scl:[1,1,1]};for(z=1;z<D-1;z++){J=y*M.chunks[z]/M.total;q.keys[z]={time:J,pos:G[z]}}p.hierarchy[0]=q;THREE.AnimationHandler.add(p);return new THREE.Animation(n,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,q){var x,
  349. y,p=new THREE.Geometry;for(x=0;x<n.points.length*q;x++){y=x/(n.points.length*q);y=n.getPoint(y);p.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return p}function d(n,q){var x=b(q,10),y=b(q,10),p=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,p);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);y=new Sphere(1,
  350. 16,8);p=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<q.points.length;i++){x=new THREE.Mesh(y,p);x.position.copy(q.points[i]);x.updateMatrix();n.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
  351. !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
  352. if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
  353. this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(n,q,x){var y,p;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;y=this.phi%f;this.phi=y>=0?y:y+f;y=this.verticalAngleMap.srcRange;p=this.verticalAngleMap.dstRange;
  354. this.phi=(this.phi-y[0])*(p[1]-p[0])/(y[1]-y[0])+p[0];y=this.horizontalAngleMap.srcRange;p=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(p[1]-p[0])/(y[1]-y[0])+p[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,q,x)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
  355. this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(m,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
  356. c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,q){return function(){q.apply(n,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
  357. var Cube=function(a,c,b,d,f,g,h,k,m){function n(M,D,J,C,U,P,O,W){var Y,e,ja=d||1,X=f||1,V=U/2,va=P/2,ga=q.vertices.length;if(M=="x"&&D=="y"||M=="y"&&D=="x")Y="z";else if(M=="x"&&D=="z"||M=="z"&&D=="x"){Y="y";X=g||1}else if(M=="z"&&D=="y"||M=="y"&&D=="z"){Y="x";ja=g||1}var za=ja+1,la=X+1;U/=ja;var oa=P/X;for(e=0;e<la;e++)for(P=0;P<za;P++){var ma=new THREE.Vector3;ma[M]=(P*U-V)*J;ma[D]=(e*oa-va)*C;ma[Y]=O;q.vertices.push(new THREE.Vertex(ma))}for(e=0;e<X;e++)for(P=0;P<ja;P++){q.faces.push(new THREE.Face4(P+
  358. za*e+ga,P+za*(e+1)+ga,P+1+za*(e+1)+ga,P+1+za*e+ga,null,null,W));q.faceVertexUvs[0].push([new THREE.UV(P/ja,e/X),new THREE.UV(P/ja,(e+1)/X),new THREE.UV((P+1)/ja,(e+1)/X),new THREE.UV((P+1)/ja,e/X)])}}THREE.Geometry.call(this);var q=this,x=a/2,y=c/2,p=b/2;k=k?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var z=0;z<6;z++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var G in m)this.sides[G]!=
  359. undefined&&(this.sides[G]=m[G]);this.sides.px&&n("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*k,1,a,b,y,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,a,b,-y,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,a,c,p,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,a,c,-p,this.materials[5]);(function(){for(var M=[],D=[],J=0,C=q.vertices.length;J<C;J++){for(var U=q.vertices[J],P=!1,O=0,W=M.length;O<W;O++){var Y=M[O];
  360. if(U.position.x==Y.position.x&&U.position.y==Y.position.y&&U.position.z==Y.position.z){D[J]=O;P=!0;break}}if(!P){D[J]=M.length;M.push(new THREE.Vertex(U.position.clone()))}}J=0;for(C=q.faces.length;J<C;J++){U=q.faces[J];U.a=D[U.a];U.b=D[U.b];U.c=D[U.c];U.d=D[U.d]}q.vertices=M})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
  361. var Cylinder=function(a,c,b,d,f,g){function h(q,x,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(q,x,y)))}THREE.Geometry.call(this);var k=this,m=Math.PI,n=d/2;for(d=0;d<a;d++)h(Math.sin(2*m*d/a)*c,Math.cos(2*m*d/a)*c,-n);for(d=0;d<a;d++)h(Math.sin(2*m*d/a)*b,Math.cos(2*m*d/a)*b,n);for(d=0;d<a;d++)k.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-n-(g||0));for(d=a;d<a+a/2;d++)k.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,n+(f||0));
  362. for(d=a+a/2;d<2*a;d++)k.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
  363. var Icosahedron=function(a){function c(x,y,p){var z=Math.sqrt(x*x+y*y+p*p);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/z,y/z,p/z)))-1}function b(x,y,p,z){z.faces.push(new THREE.Face3(x,y,p))}function d(x,y){var p=f.vertices[x].position,z=f.vertices[y].position;return c((p.x+z.x)/2,(p.y+z.y)/2,(p.z+z.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
  364. 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var m=d(g.faces[k].a,g.faces[k].b),n=d(g.faces[k].b,g.faces[k].c),q=d(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,m,q,h);b(g.faces[k].b,n,m,h);b(g.faces[k].c,
  365. q,n,h);b(m,n,q,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
  366. function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));d[k]=a[k].clone();f[k]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.001;n+=c){for(k=0;k<d.length;k++)if(n<this.angle){d[k]=m.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;n==0&&(h=f);for(k=
  367. 0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(n/b,k/a.length),new THREE.UV(n/b,(k+1)/a.length),new THREE.UV((n-c)/b,(k+1)/a.length),new THREE.UV((n-c)/b,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
  368. var Plane=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;d=d||1;var k=b+1,m=d+1;a/=b;var n=c/d;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));for(f=0;f<d;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/d)])}this.computeCentroids();this.computeFaceNormals()};
  369. Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
  370. var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var k=a*Math.cos(d*f),m=a*Math.sin(d*f),n=[],q=0;for(d=0;d<g;d++){var x=2*d/g,y=m*Math.sin(x*f);x=m*Math.cos(x*f);(b==0||b==h)&&d>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);n.push(q)}c.push(n)}var p,z,G;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){n=d==g-1;h=c[b][n?0:d+1];k=c[b][n?g-1:d];m=c[b-1][n?g-1:d];n=c[b-1][n?
  371. 0:d+1];y=b/(f-1);p=(b-1)/(f-1);z=(d+1)/g;x=d/g;q=new THREE.UV(1-z,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,p);var M=new THREE.UV(1-z,p);if(b<c.length-1){p=this.vertices[h].position.clone();z=this.vertices[k].position.clone();G=this.vertices[m].position.clone();p.normalize();z.normalize();G.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([q,y,x])}if(b>1){p=this.vertices[h].position.clone();
  372. z=this.vertices[m].position.clone();G=this.vertices[n].position.clone();p.normalize();z.normalize();G.normalize();this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([q,x,M])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
  373. var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
  374. 1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,f,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
  375. var TorusKnot=function(a,c,b,d,f,g,h){function k(x,y,p,z,G,M){y=p/z*x;p=Math.cos(y);return new THREE.Vector3(G*(2+p)*0.5*Math.cos(x),G*(2+p)*Math.sin(x)*0.5,M*G*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
  376. a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;f=k(m,h,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;d.x=m.x+f.x;d.y=m.y+f.y;d.z=m.z+f.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();m=this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=m*d.x+h*g.x;f.y+=m*d.y+h*g.y;f.z+=m*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
  377. 0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),q=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,d));this.faceVertexUvs[0].push([h,m,n]);this.faces.push(new THREE.Face3(g,d,b));this.faceVertexUvs[0].push([q,
  378. n,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
  379. THREE.Loader.prototype={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 c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
  380. this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,m){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var q=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
  381. Math.LN2));k.image.width=q;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,q,x)}else k.image=this;k.needsUpdate=!0};n.src=m}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;d(g.map,c+
  382. "/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
  383. THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,d=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(g){c.createModel(g.data,d,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
  384. THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry;this.init_materials(d,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var f,g,h,k,m,n,q,x,y,p,z=a.faces;x=a.vertices;var G=a.normals,M=a.colors,D=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&D++;for(f=0;f<D;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}h=0;for(k=x.length;h<k;){y=new THREE.Vertex;y.position.x=x[h++];y.position.y=x[h++];y.position.z=x[h++];d.vertices.push(y)}h=
  385. 0;for(k=z.length;h<k;){m=z[h++];n=m&1;f=m&2;q=m&4;g=m&8;x=m&16;y=m&32;p=m&64;m&=128;if(n){n=new THREE.Face4;n.a=z[h++];n.b=z[h++];n.c=z[h++];n.d=z[h++];nVertices=4}else{n=new THREE.Face3;n.a=z[h++];n.b=z[h++];n.c=z[h++];nVertices=3}if(f){materialIndex=z[h++];n.materials=d.materials[materialIndex]}if(q)for(f=0;f<D;f++){uvLayer=a.uvs[f];uvIndex=z[h++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];d.faceUvs[f].push(new THREE.UV(u,v))}if(g)for(f=0;f<D;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<nVertices;g++){uvIndex=
  386. z[h++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}g=d.faces.length;d.faceVertexUvs[f][g]=uvs}if(x){normalIndex=z[h++]*3;normal=new THREE.Vector3;normal.x=G[normalIndex++];normal.y=G[normalIndex++];normal.z=G[normalIndex];n.normal=normal}if(y)for(f=0;f<nVertices;f++){normalIndex=z[h++]*3;normal=new THREE.Vector3;normal.x=G[normalIndex++];normal.y=G[normalIndex++];normal.z=G[normalIndex];n.vertexNormals.push(normal)}if(p){color=new THREE.Color(z[h++]);n.color=color}if(m)for(f=
  387. 0;f<nVertices;f++){colorIndex=z[h++];color=new THREE.Color(M[colorIndex]);n.vertexColors.push(color)}d.faces.push(n)}}})();(function(){var f,g,h,k;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){h=a.skinWeights[f];k=a.skinWeights[f+1];d.skinWeights.push(new THREE.Vector4(h,k,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){h=a.skinIndices[f];k=a.skinIndices[f+1];d.skinIndices.push(new THREE.Vector4(h,k,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(){if(a.morphTargets!==
  388. undefined){var f,g,h,k;f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;d.morphTargets[f].vertices=[];dstVertices=d.morphTargets[f].vertices;srcVertices=a.morphTargets[f].vertices;h=0;for(k=srcVertices.length;h<k;h+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[h],srcVertices[h+1],srcVertices[h+2])))}}})();d.computeCentroids();d.computeFaceNormals();c(d)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
  389. THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
  390. THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,f,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
  391. c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,m=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){m==0&&(m=h.getResponseHeader("Content-Length"));g({total:m,loaded:h.responseText.length})}}else h.readyState==2&&(m=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
  392. h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,d){var f=function(g){function h(j,t){var w=q(j,t),o=q(j,t+1),B=q(j,t+2),F=q(j,t+3),H=(F<<1&255|B>>7)-127;w|=(B&127)<<16|o<<8;if(w==0&&H==-127)return 0;return(1-2*(F>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,H)}function k(j,t){var w=q(j,t),o=q(j,t+1),B=q(j,t+2);return(q(j,t+3)<<24)+(B<<16)+(o<<8)+w}function m(j,t){var w=q(j,t);return(q(j,t+1)<<8)+w}function n(j,t){var w=q(j,t);return w>127?w-256:w}function q(j,
  393. t){return j.charCodeAt(t)&255}function x(j){var t,w,o;t=k(a,j);w=k(a,j+O);o=k(a,j+W);j=m(a,j+Y);THREE.BinaryLoader.prototype.f3(D,t,w,o,j)}function y(j){var t,w,o,B,F,H;t=k(a,j);w=k(a,j+O);o=k(a,j+W);B=m(a,j+Y);F=k(a,j+e);H=k(a,j+ja);j=k(a,j+X);THREE.BinaryLoader.prototype.f3n(D,U,t,w,o,B,F,H,j)}function p(j){var t,w,o,B;t=k(a,j);w=k(a,j+V);o=k(a,j+va);B=k(a,j+ga);j=m(a,j+za);THREE.BinaryLoader.prototype.f4(D,t,w,o,B,j)}function z(j){var t,w,o,B,F,H,E,A;t=k(a,j);w=k(a,j+V);o=k(a,j+va);B=k(a,j+ga);
  394. F=m(a,j+za);H=k(a,j+la);E=k(a,j+oa);A=k(a,j+ma);j=k(a,j+ca);THREE.BinaryLoader.prototype.f4n(D,U,t,w,o,B,F,H,E,A,j)}function G(j){var t,w;t=k(a,j);w=k(a,j+S);j=k(a,j+L);THREE.BinaryLoader.prototype.uv3(D.faceVertexUvs[0],P[t*2],P[t*2+1],P[w*2],P[w*2+1],P[j*2],P[j*2+1])}function M(j){var t,w,o;t=k(a,j);w=k(a,j+fa);o=k(a,j+ra);j=k(a,j+ka);THREE.BinaryLoader.prototype.uv4(D.faceVertexUvs[0],P[t*2],P[t*2+1],P[w*2],P[w*2+1],P[o*2],P[o*2+1],P[j*2],P[j*2+1])}var D=this,J=0,C,U=[],P=[],O,W,Y,e,ja,X,V,va,
  395. ga,za,la,oa,ma,ca,S,L,fa,ra,ka,qa,wa,Ca,Za,$a,Ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(D,d,g);C={signature:a.substr(J,8),header_bytes:q(a,J+8),vertex_coordinate_bytes:q(a,J+9),normal_coordinate_bytes:q(a,J+10),uv_coordinate_bytes:q(a,J+11),vertex_index_bytes:q(a,J+12),normal_index_bytes:q(a,J+13),uv_index_bytes:q(a,J+14),material_index_bytes:q(a,J+15),nvertices:k(a,J+16),nnormals:k(a,J+16+4),nuvs:k(a,J+16+8),ntri_flat:k(a,J+16+12),ntri_smooth:k(a,J+16+16),ntri_flat_uv:k(a,
  396. J+16+20),ntri_smooth_uv:k(a,J+16+24),nquad_flat:k(a,J+16+28),nquad_smooth:k(a,J+16+32),nquad_flat_uv:k(a,J+16+36),nquad_smooth_uv:k(a,J+16+40)};J+=C.header_bytes;O=C.vertex_index_bytes;W=C.vertex_index_bytes*2;Y=C.vertex_index_bytes*3;e=C.vertex_index_bytes*3+C.material_index_bytes;ja=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;X=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;V=C.vertex_index_bytes;va=C.vertex_index_bytes*2;ga=C.vertex_index_bytes*3;za=
  397. C.vertex_index_bytes*4;la=C.vertex_index_bytes*4+C.material_index_bytes;oa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;ma=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ca=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;S=C.uv_index_bytes;L=C.uv_index_bytes*2;fa=C.uv_index_bytes;ra=C.uv_index_bytes*2;ka=C.uv_index_bytes*3;g=C.vertex_index_bytes*3+C.material_index_bytes;Ha=C.vertex_index_bytes*4+C.material_index_bytes;qa=C.ntri_flat*
  398. g;wa=C.ntri_smooth*(g+C.normal_index_bytes*3);Ca=C.ntri_flat_uv*(g+C.uv_index_bytes*3);Za=C.ntri_smooth_uv*(g+C.normal_index_bytes*3+C.uv_index_bytes*3);$a=C.nquad_flat*Ha;g=C.nquad_smooth*(Ha+C.normal_index_bytes*4);Ha=C.nquad_flat_uv*(Ha+C.uv_index_bytes*4);J+=function(j){for(var t,w,o,B=C.vertex_coordinate_bytes*3,F=j+C.nvertices*B;j<F;j+=B){t=h(a,j);w=h(a,j+C.vertex_coordinate_bytes);o=h(a,j+C.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(D,t,w,o)}return C.nvertices*B}(J);J+=function(j){for(var t,
  399. w,o,B=C.normal_coordinate_bytes*3,F=j+C.nnormals*B;j<F;j+=B){t=n(a,j);w=n(a,j+C.normal_coordinate_bytes);o=n(a,j+C.normal_coordinate_bytes*2);U.push(t/127,w/127,o/127)}return C.nnormals*B}(J);J+=function(j){for(var t,w,o=C.uv_coordinate_bytes*2,B=j+C.nuvs*o;j<B;j+=o){t=h(a,j);w=h(a,j+C.uv_coordinate_bytes);P.push(t,w)}return C.nuvs*o}(J);qa=J+qa;wa=qa+wa;Ca=wa+Ca;Za=Ca+Za;$a=Za+$a;g=$a+g;Ha=g+Ha;(function(j){var t,w=C.vertex_index_bytes*3+C.material_index_bytes,o=w+C.uv_index_bytes*3,B=j+C.ntri_flat_uv*
  400. o;for(t=j;t<B;t+=o){x(t);G(t+w)}return B-j})(wa);(function(j){var t,w=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,o=w+C.uv_index_bytes*3,B=j+C.ntri_smooth_uv*o;for(t=j;t<B;t+=o){y(t);G(t+w)}return B-j})(Ca);(function(j){var t,w=C.vertex_index_bytes*4+C.material_index_bytes,o=w+C.uv_index_bytes*4,B=j+C.nquad_flat_uv*o;for(t=j;t<B;t+=o){p(t);M(t+w)}return B-j})(g);(function(j){var t,w=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,o=w+C.uv_index_bytes*
  401. 4,B=j+C.nquad_smooth_uv*o;for(t=j;t<B;t+=o){z(t);M(t+w)}return B-j})(Ha);(function(j){var t,w=C.vertex_index_bytes*3+C.material_index_bytes,o=j+C.ntri_flat*w;for(t=j;t<o;t+=w)x(t);return o-j})(J);(function(j){var t,w=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,o=j+C.ntri_smooth*w;for(t=j;t<o;t+=w)y(t);return o-j})(qa);(function(j){var t,w=C.vertex_index_bytes*4+C.material_index_bytes,o=j+C.nquad_flat*w;for(t=j;t<o;t+=w)p(t);return o-j})(Za);(function(j){var t,w=C.vertex_index_bytes*
  402. 4+C.material_index_bytes+C.normal_index_bytes*4,o=j+C.nquad_smooth*w;for(t=j;t<o;t+=w)z(t);return o-j})($a);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,f){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[f]))},f4:function(a,c,b,d,f,g){a.faces.push(new THREE.Face4(c,b,d,f,null,null,a.materials[g]))},f3n:function(a,
  403. c,b,d,f,g,h,k,m){g=a.materials[g];var n=c[k*3],q=c[k*3+1];k=c[k*3+2];var x=c[m*3],y=c[m*3+1];m=c[m*3+2];a.faces.push(new THREE.Face3(b,d,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,q,k),new THREE.Vector3(x,y,m)],null,g))},f4n:function(a,c,b,d,f,g,h,k,m,n,q){h=a.materials[h];var x=c[m*3],y=c[m*3+1];m=c[m*3+2];var p=c[n*3],z=c[n*3+1];n=c[n*3+2];var G=c[q*3],M=c[q*3+1];q=c[q*3+2];a.faces.push(new THREE.Face4(b,d,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
  404. y,m),new THREE.Vector3(p,z,n),new THREE.Vector3(G,M,q)],null,h))},uv3:function(a,c,b,d,f,g,h){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,c,b,d,f,g,h,k,m){var n=[];n.push(new THREE.UV(c,b));n.push(new THREE.UV(d,f));n.push(new THREE.UV(g,h));n.push(new THREE.UV(k,m));a.push(n)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
  405. THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
  406. 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,f){return b+(d-b)*f};this.VIntX=function(b,d,f,g,h,k,m,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=m;d[g+2]=n;f[g]=this.lerp(q[b],q[b+3],h);f[g+1]=this.lerp(q[b+1],q[b+4],h);f[g+2]=this.lerp(q[b+2],q[b+5],h)};this.VIntY=function(b,d,f,g,h,k,m,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=k;d[g+1]=m+h*this.delta;d[g+
  407. 2]=n;d=b+this.yd*3;f[g]=this.lerp(q[b],q[d],h);f[g+1]=this.lerp(q[b+1],q[d+1],h);f[g+2]=this.lerp(q[b+2],q[d+2],h)};this.VIntZ=function(b,d,f,g,h,k,m,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=k;d[g+1]=m;d[g+2]=n+h*this.delta;d=b+this.zd*3;f[g]=this.lerp(q[b],q[d],h);f[g+1]=this.lerp(q[b+1],q[d+1],h);f[g+2]=this.lerp(q[b+2],q[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
  408. this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,f,g,h,k){var m=g+1,n=g+this.yd,q=g+this.zd,x=m+this.yd,y=m+this.zd,p=g+this.yd+this.zd,z=m+this.yd+this.zd,G=0,M=this.field[g],D=this.field[m],J=this.field[n],C=this.field[x],U=this.field[q],P=this.field[y],O=this.field[p],W=this.field[z];M<h&&(G|=1);D<h&&(G|=2);J<h&&(G|=8);C<h&&(G|=4);U<h&&(G|=16);P<h&&(G|=32);O<h&&(G|=128);W<h&&(G|=64);var Y=THREE.edgeTable[G];if(Y==0)return 0;
  409. var e=this.delta,ja=b+e,X=d+e;e=f+e;if(Y&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,f,M,D)}if(Y&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,h,ja,d,f,D,C)}if(Y&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,X,f,J,C)}if(Y&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,f,M,J)}if(Y&16){this.compNorm(q);this.compNorm(y);this.VIntX(q*3,this.vlist,this.nlist,12,h,b,d,
  410. e,U,P)}if(Y&32){this.compNorm(y);this.compNorm(z);this.VIntY(y*3,this.vlist,this.nlist,15,h,ja,d,e,P,W)}if(Y&64){this.compNorm(p);this.compNorm(z);this.VIntX(p*3,this.vlist,this.nlist,18,h,b,X,e,O,W)}if(Y&128){this.compNorm(q);this.compNorm(p);this.VIntY(q*3,this.vlist,this.nlist,21,h,b,d,e,U,O)}if(Y&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,f,M,U)}if(Y&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,h,ja,d,f,D,P)}if(Y&1024){this.compNorm(x);
  411. this.compNorm(z);this.VIntZ(x*3,this.vlist,this.nlist,30,h,ja,X,f,C,W)}if(Y&2048){this.compNorm(n);this.compNorm(p);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,X,f,J,O)}G<<=4;for(h=g=0;THREE.triTable[G+h]!=-1;){b=G+h;d=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(b,d,f,g,h,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+
  412. 3]=b[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+2];this.normalArray[m]=d[f];this.normalArray[m+1]=d[f+1];this.normalArray[m+2]=d[f+2];this.normalArray[m+3]=d[g];this.normalArray[m+4]=d[g+1];this.normalArray[m+5]=d[g+2];this.normalArray[m+6]=d[h];this.normalArray[m+7]=d[h+1];this.normalArray[m+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
  413. function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,f,g,h){var k=this.size*Math.sqrt(g/h),m=f*this.size,n=d*this.size,q=b*this.size,x=Math.floor(m-k);x<1&&(x=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(n-k);y<1&&(y=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var p=Math.floor(q-k);p<1&&(p=1);k=Math.floor(q+k);
  414. k>this.size-1&&(k=this.size-1);for(var z,G,M,D,J,C;x<m;x++){q=this.size2*x;G=x/this.size-f;J=G*G;for(G=y;G<n;G++){M=q+this.size*G;z=G/this.size-d;C=z*z;for(z=p;z<k;z++){D=z/this.size-b;D=g/(1.0E-6+D*D+C+J)-h;D>0&&(this.field[M+z]+=D)}}}};this.addPlaneX=function(b,d){var f,g,h,k,m,n=this.size,q=this.yd,x=this.zd,y=this.field,p=n*Math.sqrt(b/d);p>n&&(p=n);for(f=0;f<p;f++){g=f/n;g*=g;k=b/(1.0E-4+g)-d;if(k>0)for(g=0;g<n;g++){m=f+g*q;for(h=0;h<n;h++)y[x*h+m]+=k}}};this.addPlaneY=function(b,d){var f,g,
  415. h,k,m,n,q=this.size,x=this.yd,y=this.zd,p=this.field,z=q*Math.sqrt(b/d);z>q&&(z=q);for(g=0;g<z;g++){f=g/q;f*=f;k=b/(1.0E-4+f)-d;if(k>0){m=g*x;for(f=0;f<q;f++){n=m+f;for(h=0;h<q;h++)p[y*h+n]+=k}}}};this.addPlaneZ=function(b,d){var f,g,h,k,m,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=b/(1.0E-4+f)-d;if(k>0){m=zd*h;for(g=0;g<size;g++){n=m+g*yd;for(f=0;f<size;f++)field[n+f]+=k}}}};this.reset=function(){var b;
  416. for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,f,g,h,k,m,n,q,x,y=this.size-2;for(h=1;h<y;h++){x=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){q=x+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<y;f++){k=(f-this.halfsize)/this.halfsize;d=q+f;this.polygonize(k,m,n,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,m,n,q,x,y;for(g=
  417. 0;g<f.count;g++){n=g*3;x=n+1;y=n+2;h=f.positionArray[n];k=f.positionArray[x];m=f.positionArray[y];q=new THREE.Vector3(h,k,m);h=f.normalArray[n];k=f.normalArray[x];m=f.normalArray[y];n=new THREE.Vector3(h,k,m);n.normalize();n=new THREE.Vertex(q,n);d.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;x=n+1;y=n+2;q=d.vertices[n].normal;h=d.vertices[x].normal;k=d.vertices[y].normal;n=new THREE.Face3(n,x,y,[q,h,k]);d.faces.push(n)}b+=nfaces;f.count=0});return d};this.init(a)};
  418. THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
  419. THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
  420. 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
  421. 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
  422. THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
  423. -1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
  424. -1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
  425. -1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
  426. 8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
  427. -1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
  428. 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
  429. -1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
  430. 10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
  431. 6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
  432. 8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
  433. 2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
  434. -1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
  435. -1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
  436. -1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
  437. 1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
  438. -1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
  439. 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
  440. 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
  441. -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
  442. 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
粤ICP备19079148号