Three.js 259 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. // Three.js r41/ROME - http://github.com/mrdoob/three.js
  2. var THREE=THREE||{};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}THREE.Color=function(b){this.setHex(b)};
  3. THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,d,c){this.r=b;this.g=d;this.b=c;this.updateHex()},setHSV:function(b,d,c){var f,g,h,j,k,m;if(c==0)f=g=h=0;else{j=Math.floor(b*6);k=b*6-j;b=c*(1-d);m=c*(1-d*k);d=c*(1-d*(1-k));switch(j){case 1:f=m;g=c;h=b;break;case 2:f=b;g=c;h=d;break;case 3:f=b;g=m;h=c;break;case 4:f=d;g=b;h=c;break;case 5:f=c;g=b;h=m;break;case 6:case 0:f=c;g=d;h=b}}this.setRGB(f,
  4. g,h)},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},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,d){this.set(b||0,d||0)};
  5. THREE.Vector2.prototype={set:function(b,d){this.x=b;this.y=d;return this},copy:function(b){this.set(b.x,b.y);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
  6. 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(b,d,c){this.set(b||0,d||0,c||0)};
  7. THREE.Vector3.prototype={set:function(b,d,c){this.x=b;this.y=d;this.z=c;return this},copy:function(b){this.set(b.x,b.y,b.z);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z);return this},addScalar:function(b){this.set(this.x+b,this.y+b,this.z+b);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z);return this},cross:function(b,
  8. d){this.set(b.y*d.z-b.z*d.y,b.z*d.x-b.x*d.z,b.x*d.y-b.y*d.x);return this},crossSelf:function(b){var d=this.x,c=this.y,f=this.z;this.set(c*b.z-f*b.y,f*b.x-d*b.z,d*b.y-c*b.x);return this},multiply:function(b,d){this.set(b.x*d.x,b.y*d.y,b.z*d.z);return this},multiplySelf:function(b){this.set(this.x*b.x,this.y*b.y,this.z*b.z);return this},multiplyScalar:function(b){this.set(this.x*b,this.y*b,this.z*b);return this},divideSelf:function(b){this.set(this.x/b.x,this.y/b.y,this.z/b.z);return this},divideScalar:function(b){this.set(this.x/
  9. b,this.y/b,this.z/b);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var d=this.x-b.x,c=this.y-b.y;b=this.z-b.z;return d*d+c*c+b*b},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 b=
  10. this.length();b>0?this.multiplyScalar(1/b):this.set(0,0,0);return this},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var d=Math.cos(this.y);this.y=Math.asin(b.n13);if(Math.abs(d)>1.0E-5){this.x=Math.atan2(-b.n23/d,b.n33/d);this.z=Math.atan2(-b.n12/d,b.n11/d)}else{this.x=0;this.z=Math.atan2(b.n21,b.n22)}},setLength:function(b){return this.normalize().multiplyScalar(b)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
  11. 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(b,d,c,f){this.set(b||0,d||0,c||0,f||1)};
  12. THREE.Vector4.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.set(b.x,b.y,b.z,b.w||1);return this},add:function(b,d){this.set(b.x+d.x,b.y+d.y,b.z+d.z,b.w+d.w);return this},addSelf:function(b){this.set(this.x+b.x,this.y+b.y,this.z+b.z,this.w+b.w);return this},sub:function(b,d){this.set(b.x-d.x,b.y-d.y,b.z-d.z,b.w-d.w);return this},subSelf:function(b){this.set(this.x-b.x,this.y-b.y,this.z-b.z,this.w-b.w);return this},multiplyScalar:function(b){this.set(this.x*
  13. b,this.y*b,this.z*b,this.w*b);return this},divideScalar:function(b){this.set(this.x/b,this.y/b,this.z/b,this.w/b);return this},lerpSelf:function(b,d){this.set(this.x+(b.x-this.x)*d,this.y+(b.y-this.y)*d,this.z+(b.z-this.z)*d,this.w+(b.w-this.w)*d)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(b,d){this.origin=b||new THREE.Vector3;this.direction=d||new THREE.Vector3};
  14. THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var d,c,f,g=[];d=0;for(c=b.length;d<c;d++){f=b[d];f instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(f)))}g.sort(function(h,j){return h.distance-j.distance});return g},intersectObject:function(b){function d(H,C,S,E){E=E.clone().subSelf(C);S=S.clone().subSelf(C);var T=H.clone().subSelf(C);H=E.dot(E);C=E.dot(S);E=E.dot(T);var O=S.dot(S);S=S.dot(T);T=1/(H*O-C*C);O=(O*E-C*S)*T;
  15. H=(H*S-C*E)*T;return O>0&&H>0&&O+H<1}var c,f,g,h,j,k,m,o,p,x,y,t=b.geometry,u=t.vertices,I=[];c=0;for(f=t.faces.length;c<f;c++){g=t.faces[c];x=this.origin.clone();y=this.direction.clone();m=b.matrixWorld;h=m.multiplyVector3(u[g.a].position.clone());j=m.multiplyVector3(u[g.b].position.clone());k=m.multiplyVector3(u[g.c].position.clone());m=g instanceof THREE.Face4?m.multiplyVector3(u[g.d].position.clone()):null;o=b.matrixRotationWorld.multiplyVector3(g.normal.clone());p=y.dot(o);if(b.doubleSided||
  16. (b.flipSided?p>0:p<0)){o=o.dot((new THREE.Vector3).sub(h,x))/p;x=x.addSelf(y.multiplyScalar(o));if(g instanceof THREE.Face3){if(d(x,h,j,k)){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};I.push(g)}}else if(g instanceof THREE.Face4&&(d(x,h,j,m)||d(x,j,k,m))){g={distance:this.origin.distanceTo(x),point:x,face:g,object:b};I.push(g)}}}return I}};
  17. THREE.Rectangle=function(){function b(){h=f-d;j=g-c}var d,c,f,g,h,j,k=!0;this.getX=function(){return d};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return d};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(m,o,p,x){k=!1;d=m;c=o;f=p;g=x;b()};this.addPoint=function(m,o){if(k){k=!1;d=m;c=o;f=m;g=o}else{d=d<m?d:m;c=c<o?c:o;f=f>m?f:m;g=g>o?g:o}b()};
  18. this.add3Points=function(m,o,p,x,y,t){if(k){k=!1;d=m<p?m<y?m:y:p<y?p:y;c=o<x?o<t?o:t:x<t?x:t;f=m>p?m>y?m:y:p>y?p:y;g=o>x?o>t?o:t:x>t?x:t}else{d=m<p?m<y?m<d?m:d:y<d?y:d:p<y?p<d?p:d:y<d?y:d;c=o<x?o<t?o<c?o:c:t<c?t:c:x<t?x<c?x:c:t<c?t:c;f=m>p?m>y?m>f?m:f:y>f?y:f:p>y?p>f?p:f:y>f?y:f;g=o>x?o>t?o>g?o:g:t>g?t:g:x>t?x>g?x:g:t>g?t:g}b()};this.addRectangle=function(m){if(k){k=!1;d=m.getLeft();c=m.getTop();f=m.getRight();g=m.getBottom()}else{d=d<m.getLeft()?d:m.getLeft();c=c<m.getTop()?c:m.getTop();f=f>m.getRight()?
  19. f:m.getRight();g=g>m.getBottom()?g:m.getBottom()}b()};this.inflate=function(m){d-=m;c-=m;f+=m;g+=m;b()};this.minSelf=function(m){d=d>m.getLeft()?d:m.getLeft();c=c>m.getTop()?c:m.getTop();f=f<m.getRight()?f:m.getRight();g=g<m.getBottom()?g:m.getBottom();b()};this.instersects=function(m){return Math.min(f,m.getRight())-Math.max(d,m.getLeft())>=0&&Math.min(g,m.getBottom())-Math.max(c,m.getTop())>=0};this.empty=function(){k=!0;g=f=c=d=0;b()};this.isEmpty=function(){return k}};
  20. THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,d=this.m;b=d[1];d[1]=d[3];d[3]=b;b=d[2];d[2]=d[6];d[6]=b;b=d[5];d[5]=d[7];d[7]=b;return this},transposeIntoArray:function(b){var d=this.m;b[0]=d[0];b[1]=d[3];b[2]=d[6];b[3]=d[1];b[4]=d[4];b[5]=d[7];b[6]=d[2];b[7]=d[5];b[8]=d[8];return this}};
  21. THREE.Matrix4=function(b,d,c,f,g,h,j,k,m,o,p,x,y,t,u,I){this.set(b||1,d||0,c||0,f||0,g||0,h||1,j||0,k||0,m||0,o||0,p||1,x||0,y||0,t||0,u||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
  22. THREE.Matrix4.prototype={set:function(b,d,c,f,g,h,j,k,m,o,p,x,y,t,u,I){this.n11=b;this.n12=d;this.n13=c;this.n14=f;this.n21=g;this.n22=h;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=p;this.n34=x;this.n41=y;this.n42=t;this.n43=u;this.n44=I;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,d,c){var f=THREE.Matrix4.__v1,
  23. g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,d).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var d=b.x,c=b.y,f=b.z,g=1/(this.n41*d+this.n42*c+this.n43*f+this.n44);b.x=(this.n11*d+this.n12*c+this.n13*f+this.n14)*g;b.y=(this.n21*d+this.n22*c+this.n23*
  24. f+this.n24)*g;b.z=(this.n31*d+this.n32*c+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var d=b.x,c=b.y,f=b.z,g=b.w;b.x=this.n11*d+this.n12*c+this.n13*f+this.n14*g;b.y=this.n21*d+this.n22*c+this.n23*f+this.n24*g;b.z=this.n31*d+this.n32*c+this.n33*f+this.n34*g;b.w=this.n41*d+this.n42*c+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var d=b.x,c=b.y,f=b.z;b.x=d*this.n11+c*this.n12+f*this.n13;b.y=d*this.n21+c*this.n22+f*this.n23;b.z=d*this.n31+c*this.n32+f*this.n33;b.normalize();
  25. return b},crossVector:function(b){var d=new THREE.Vector4;d.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;d.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;d.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;d.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return d},multiply:function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,x=b.n32,y=b.n33,t=b.n34,u=b.n41,I=b.n42,H=b.n43,C=b.n44,S=d.n11,E=d.n12,T=d.n13,O=d.n14,Q=d.n21,ya=d.n22,
  26. aa=d.n23,ga=d.n24,X=d.n31,ha=d.n32,e=d.n33,Ja=d.n34;this.n11=c*S+f*Q+g*X;this.n12=c*E+f*ya+g*ha;this.n13=c*T+f*aa+g*e;this.n14=c*O+f*ga+g*Ja+h;this.n21=j*S+k*Q+m*X;this.n22=j*E+k*ya+m*ha;this.n23=j*T+k*aa+m*e;this.n24=j*O+k*ga+m*Ja+o;this.n31=p*S+x*Q+y*X;this.n32=p*E+x*ya+y*ha;this.n33=p*T+x*aa+y*e;this.n34=p*O+x*ga+y*Ja+t;this.n41=u*S+I*Q+H*X;this.n42=u*E+I*ya+H*ha;this.n43=u*T+I*aa+H*e;this.n44=u*O+I*ga+H*Ja+C;return this},multiplyToArray:function(b,d,c){this.multiply(b,d);c[0]=this.n11;c[1]=this.n21;
  27. c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},
  28. determinant:function(){var b=this.n11,d=this.n12,c=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,p=this.n33,x=this.n34,y=this.n41,t=this.n42,u=this.n43,I=this.n44;return f*j*o*y-c*k*o*y-f*h*p*y+d*k*p*y+c*h*x*y-d*j*x*y-f*j*m*t+c*k*m*t+f*g*p*t-b*k*p*t-c*g*x*t+b*j*x*t+f*h*m*u-d*k*m*u-f*g*o*u+b*k*o*u+d*g*x*u-b*h*x*u-c*h*m*I+d*j*m*I+c*g*o*I-b*j*o*I-d*g*p*I+b*h*p*I},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=
  29. b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;
  30. this.flat[1]=this.n21;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(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;
  31. 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 b},flattenToArrayOffset:function(b,d){b[d]=this.n11;b[d+1]=this.n21;b[d+2]=this.n31;b[d+3]=this.n41;b[d+4]=this.n12;b[d+5]=this.n22;b[d+6]=this.n32;b[d+7]=this.n42;b[d+8]=this.n13;b[d+9]=this.n23;b[d+10]=this.n33;b[d+11]=this.n43;b[d+12]=this.n14;b[d+13]=this.n24;b[d+14]=this.n34;b[d+15]=this.n44;return b},setTranslation:function(b,d,c){this.set(1,0,0,b,0,1,0,d,0,0,1,c,0,0,0,1);return this},
  32. setScale:function(b,d,c){this.set(b,0,0,0,0,d,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(1,0,0,0,0,d,-b,0,0,b,d,0,0,0,0,1);return this},setRotationY:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,0,b,0,0,1,0,0,-b,0,d,0,0,0,0,1);return this},setRotationZ:function(b){var d=Math.cos(b);b=Math.sin(b);this.set(d,-b,0,0,b,d,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,d){var c=Math.cos(d),f=Math.sin(d),g=1-c,h=b.x,j=b.y,k=
  33. b.z,m=g*h,o=g*j;this.set(m*h+c,m*j-f*k,m*k+f*j,0,m*j+f*k,o*j+c,o*k-f*h,0,m*k-f*j,o*k+f*h,g*k*k+c,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=
  34. new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var d=b.x,c=b.y,f=b.z;b=Math.cos(d);d=Math.sin(d);var g=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=b*c,k=d*c;this.n11=g*h;this.n12=-g*f;this.n13=c;this.n21=k*h+b*f;this.n22=-k*f+b*h;this.n23=-d*g;this.n31=-j*h+d*f;this.n32=j*f+
  35. d*h;this.n33=b*g;return this},setRotationFromQuaternion:function(b){var d=b.x,c=b.y,f=b.z,g=b.w,h=d+d,j=c+c,k=f+f;b=d*h;var m=d*j;d*=k;var o=c*j;c*=k;f*=k;h*=g;j*=g;g*=k;this.n11=1-(o+f);this.n12=m-g;this.n13=d+j;this.n21=m+g;this.n22=1-(b+f);this.n23=c-h;this.n31=d-j;this.n32=c+h;this.n33=1-(b+o);return this},scale:function(b){var d=b.x,c=b.y;b=b.z;this.n11*=d;this.n12*=c;this.n13*=b;this.n21*=d;this.n22*=c;this.n23*=b;this.n31*=d;this.n32*=c;this.n33*=b;this.n41*=d;this.n42*=c;this.n43*=b;return this},
  36. extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,d){var c=1/d.x,f=1/d.y,g=1/d.z;this.n11=b.n11*c;this.n21=b.n21*c;this.n31=b.n31*c;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
  37. THREE.Matrix4.makeInvert=function(b,d){var c=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,k=b.n22,m=b.n23,o=b.n24,p=b.n31,x=b.n32,y=b.n33,t=b.n34,u=b.n41,I=b.n42,H=b.n43,C=b.n44;d===undefined&&(d=new THREE.Matrix4);d.n11=m*t*I-o*y*I+o*x*H-k*t*H-m*x*C+k*y*C;d.n12=h*y*I-g*t*I-h*x*H+f*t*H+g*x*C-f*y*C;d.n13=g*o*I-h*m*I+h*k*H-f*o*H-g*k*C+f*m*C;d.n14=h*m*x-g*o*x-h*k*y+f*o*y+g*k*t-f*m*t;d.n21=o*y*u-m*t*u-o*p*H+j*t*H+m*p*C-j*y*C;d.n22=g*t*u-h*y*u+h*p*H-c*t*H-g*p*C+c*y*C;d.n23=h*m*u-g*o*u-h*j*H+c*o*H+g*j*C-c*m*C;
  38. d.n24=g*o*p-h*m*p+h*j*y-c*o*y-g*j*t+c*m*t;d.n31=k*t*u-o*x*u+o*p*I-j*t*I-k*p*C+j*x*C;d.n32=h*x*u-f*t*u-h*p*I+c*t*I+f*p*C-c*x*C;d.n33=g*o*u-h*k*u+h*j*I-c*o*I-f*j*C+c*k*C;d.n34=h*k*p-f*o*p-h*j*x+c*o*x+f*j*t-c*k*t;d.n41=m*x*u-k*y*u-m*p*I+j*y*I+k*p*H-j*x*H;d.n42=f*y*u-g*x*u+g*p*I-c*y*I-f*p*H+c*x*H;d.n43=g*k*u-f*m*u-g*j*I+c*m*I+f*j*H-c*k*H;d.n44=f*m*p-g*k*p+g*j*x-c*m*x-f*j*y+c*k*y;d.multiplyScalar(1/b.determinant());return d};
  39. THREE.Matrix4.makeInvert3x3=function(b){var d=b.m33,c=d.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,m=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,x=b.n22*b.n11-b.n21*b.n12;b=b.n11*f+b.n21*j+b.n31*o;if(b==0)throw"matrix not invertible";b=1/b;c[0]=b*f;c[1]=b*g;c[2]=b*h;c[3]=b*j;c[4]=b*k;c[5]=b*m;c[6]=b*o;c[7]=b*p;c[8]=b*x;return d};
  40. THREE.Matrix4.makeFrustum=function(b,d,c,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(d-b);j.n12=0;j.n13=(d+b)/(d-b);j.n14=0;j.n21=0;j.n22=2*g/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,d,c,f){var g;b=c*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*d,b*d,g,b,c,f)};
  41. THREE.Matrix4.makeOrtho=function(b,d,c,f,g,h){var j,k,m,o;j=new THREE.Matrix4;k=d-b;m=c-f;o=h-g;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((d+b)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((c+f)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((h+g)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};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.dynamic=!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=
  43. 1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
  44. THREE.Object3D.prototype={translate:function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
  45. -1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var d=this;d.parent!==undefined;)d=d.parent;d!==undefined&&d instanceof THREE.Scene&&d.addChildRecurse(b)}},removeChild:function(b){var d=this.children.indexOf(b);if(d!==-1){b.parent=undefined;this.children.splice(d,1)}},getChildByName:function(b,d){var c,f,g;c=0;for(f=this.children.length;c<f;c++){g=this.children[c];if(g.name===b)return g;if(d){g=g.getChildByName(b,d);if(g!==undefined)return g}}},updateMatrix:function(){this.matrix.setPosition(this.position);
  46. this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==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(b,d,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||d){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);
  47. this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;d=!0}b=0;for(var f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,d,c)}};THREE.Quaternion=function(b,d,c,f){this.set(b||0,d||0,c||0,f!==undefined?f:1)};
  48. THREE.Quaternion.prototype={set:function(b,d,c,f){this.x=b;this.y=d;this.z=c;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var d=0.5*Math.PI/360,c=b.x*d,f=b.y*d,g=b.z*d;b=Math.cos(f);f=Math.sin(f);d=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var j=b*d,k=f*g;this.w=j*h-k*c;this.x=j*c+k*h;this.y=f*d*h+b*g*c;this.z=b*g*h-f*d*c;return this},setFromAxisAngle:function(b,d){var c=d/2,f=Math.sin(c);this.x=b.x*f;this.y=
  49. b.y*f;this.z=b.z*f;this.w=Math.cos(c);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*=-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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(b==0)this.w=this.z=this.y=this.x=0;else{b=1/b;this.x*=b;this.y*=b;this.z*=b;this.w*=b}return this},
  50. multiplySelf:function(b){var d=this.x,c=this.y,f=this.z,g=this.w,h=b.x,j=b.y,k=b.z;b=b.w;this.x=d*b+g*h+c*k-f*j;this.y=c*b+g*j+f*h-d*k;this.z=f*b+g*k+d*j-c*h;this.w=g*b-d*h-c*j-f*k;return this},multiply:function(b,d){this.x=b.x*d.w+b.y*d.z-b.z*d.y+b.w*d.x;this.y=-b.x*d.z+b.y*d.w+b.z*d.x+b.w*d.y;this.z=b.x*d.y-b.y*d.x+b.z*d.w+b.w*d.z;this.w=-b.x*d.x-b.y*d.y-b.z*d.z+b.w*d.w;return this},multiplyVector3:function(b,d){d||(d=b);var c=b.x,f=b.y,g=b.z,h=this.x,j=this.y,k=this.z,m=this.w,o=m*c+j*g-k*f,p=
  51. m*f+k*c-h*g,x=m*g+h*f-j*c;c=-h*c-j*f-k*g;d.x=o*m+c*-h+p*-k-x*-j;d.y=p*m+c*-j+x*-h-o*-k;d.z=x*m+c*-k+o*-j-p*-h;return d}};
  52. THREE.Quaternion.slerp=function(b,d,c,f){var g=b.w*d.w+b.x*d.x+b.y*d.y+b.z*d.z;if(Math.abs(g)>=1){c.w=b.w;c.x=b.x;c.y=b.y;c.z=b.z;return c}var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.001){c.w=0.5*(b.w+d.w);c.x=0.5*(b.x+d.x);c.y=0.5*(b.y+d.y);c.z=0.5*(b.z+d.z);return c}g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=b.w*g+d.w*f;c.x=b.x*g+d.x*f;c.y=b.y*g+d.y*f;c.z=b.z*g+d.z*f;return c};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
  53. THREE.Face3=function(b,d,c,f,g,h){this.a=b;this.b=d;this.c=c;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};
  54. THREE.Face4=function(b,d,c,f,g,h,j){this.a=b;this.b=d;this.c=c;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,d){this.set(b||0,d||0)};
  55. THREE.UV.prototype={set:function(b,d){this.u=b;this.v=d;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
  56. THREE.Geometry.prototype={computeCentroids:function(){var b,d,c;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
  57. c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(b){var d,c,f,g,h,j,k=new THREE.Vector3,m=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){k.set(0,0,0);d=0;for(c=h.vertexNormals.length;d<c;d++)k.addSelf(h.vertexNormals[d]);k.divideScalar(3)}else{d=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];k.sub(j.position,c.position);m.sub(d.position,c.position);k.crossSelf(m)}k.isZero()||
  58. k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var b,d,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(d=this.vertices.length;b<d;b++)f[b]=new THREE.Vector3;b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
  59. this.__tmpVertices;b=0;for(d=this.vertices.length;b<d;b++)f[b].set(0,0,0)}b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}b=0;for(d=this.vertices.length;b<d;b++)f[b].normalize();b=0;for(d=this.faces.length;b<d;b++){c=this.faces[b];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
  60. c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function b(ua,da,sa,na,ra,oa,ea){k=ua.vertices[da].position;m=ua.vertices[sa].position;o=ua.vertices[na].position;p=j[ra];x=j[oa];y=j[ea];t=m.x-k.x;u=o.x-k.x;I=m.y-k.y;H=o.y-k.y;C=m.z-k.z;S=o.z-k.z;E=x.u-p.u;T=y.u-p.u;O=x.v-p.v;Q=y.v-p.v;ya=1/(E*
  61. Q-T*O);ha.set((Q*t-O*u)*ya,(Q*I-O*H)*ya,(Q*C-O*S)*ya);e.set((E*u-T*t)*ya,(E*H-T*I)*ya,(E*S-T*C)*ya);ga[da].addSelf(ha);ga[sa].addSelf(ha);ga[na].addSelf(ha);X[da].addSelf(e);X[sa].addSelf(e);X[na].addSelf(e)}var d,c,f,g,h,j,k,m,o,p,x,y,t,u,I,H,C,S,E,T,O,Q,ya,aa,ga=[],X=[],ha=new THREE.Vector3,e=new THREE.Vector3,Ja=new THREE.Vector3,ta=new THREE.Vector3,Da=new THREE.Vector3;d=0;for(c=this.vertices.length;d<c;d++){ga[d]=new THREE.Vector3;X[d]=new THREE.Vector3}d=0;for(c=this.faces.length;d<c;d++){h=
  62. this.faces[d];j=this.faceVertexUvs[0][d];if(h instanceof THREE.Face3)b(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){b(this,h.a,h.b,h.c,0,1,2);b(this,h.a,h.b,h.d,0,1,3)}}var ca=["a","b","c","d"];d=0;for(c=this.faces.length;d<c;d++){h=this.faces[d];for(f=0;f<h.vertexNormals.length;f++){Da.copy(h.vertexNormals[f]);g=h[ca[f]];aa=ga[g];Ja.copy(aa);Ja.subSelf(Da.multiplyScalar(Da.dot(aa))).normalize();ta.cross(h.vertexNormals[f],aa);g=ta.dot(X[g]);g=g<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(Ja.x,
  63. Ja.y,Ja.z,g)}}this.hasTangents=!0},computeBoundingBox:function(){var b;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 d=1,c=this.vertices.length;d<c;d++){b=this.vertices[d];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;
  64. if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=this.boundingSphere===null?0:this.boundingSphere.radius,d=0,c=this.vertices.length;d<c;d++)b=Math.max(b,this.vertices[d].position.length());this.boundingSphere=
  65. {radius:b}},computeEdgeFaces:function(){function b(m,o){return Math.min(m,o)+"_"+Math.max(m,o)}function d(m,o,p){if(m[o]===undefined){m[o]={set:{},array:[]};m[o].set[p]=1;m[o].array.push(p)}else if(m[o].set[p]===undefined){m[o].set[p]=1;m[o].array.push(p)}}var c,f,g,h,j,k={};c=0;for(f=this.faces.length;c<f;c++){j=this.faces[c];if(j instanceof THREE.Face3){g=b(j.a,j.b);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.a,j.c);d(k,g,c)}else if(j instanceof THREE.Face4){g=b(j.b,j.d);d(k,g,c);g=b(j.a,j.b);d(k,g,c);
  66. g=b(j.a,j.d);d(k,g,c);g=b(j.b,j.c);d(k,g,c);g=b(j.c,j.d);d(k,g,c)}}c=0;for(f=this.edges.length;c<f;c++){j=this.edges[c];g=j.vertexIndices[0];h=j.vertexIndices[1];j.faceIndices=k[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++){h=j.faceIndices[g];j.faces.push(this.faces[h])}}}};THREE.GeometryIdCounter=0;
  67. THREE.Spline=function(b){function d(t,u,I,H,C,S,E){t=(I-t)*0.5;H=(H-u)*0.5;return(2*(u-I)+t+H)*E+(-3*(u-I)-2*t-H)*S+t*C+u}this.points=b;var c=[],f={x:0,y:0,z:0},g,h,j,k,m,o,p,x,y;this.initFromArray=function(t){this.points=[];for(var u=0;u<t.length;u++)this.points[u]={x:t[u][0],y:t[u][1],z:t[u][2]}};this.getPoint=function(t){g=(this.points.length-1)*t;h=Math.floor(g);j=g-h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;o=this.points[c[0]];p=this.points[c[1]];
  68. x=this.points[c[2]];y=this.points[c[3]];k=j*j;m=j*k;f.x=d(o.x,p.x,x.x,y.x,j,k,m);f.y=d(o.y,p.y,x.y,y.y,j,k,m);f.z=d(o.z,p.z,x.z,y.z,j,k,m);return f};this.getControlPointsArray=function(){var t,u,I=this.points.length,H=[];for(t=0;t<I;t++){u=this.points[t];H[t]=[u.x,u.y,u.z]}return H};this.getLength=function(t){var u,I,H=u=u=0,C=new THREE.Vector3,S=new THREE.Vector3,E=[],T=0;E[0]=0;t||(t=100);I=this.points.length*t;C.copy(this.points[0]);for(t=1;t<I;t++){u=t/I;position=this.getPoint(u);S.copy(position);
  69. T+=S.distanceTo(C);C.copy(position);u*=this.points.length-1;u=Math.floor(u);if(u!=H){E[u]=T;H=u}}E[E.length]=T;return{chunks:E,total:T}};this.reparametrizeByArcLength=function(t){var u,I,H,C,S,E,T=[],O=new THREE.Vector3,Q=this.getLength();T.push(O.copy(this.points[0]).clone());for(u=1;u<this.points.length;u++){I=Q.chunks[u]-Q.chunks[u-1];E=Math.ceil(t*I/Q.total);C=(u-1)/(this.points.length-1);S=u/(this.points.length-1);for(I=1;I<E-1;I++){H=C+I*(1/E)*(S-C);position=this.getPoint(H);T.push(O.copy(position).clone())}T.push(O.copy(this.points[u]).clone())}this.points=
  70. T}};THREE.Edge=function(b,d,c,f){this.vertices=[b,d];this.vertexIndices=[c,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,d,c,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=d||1;this.near=c||0.1;this.far=f||2E3;this.target=g||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;
  71. THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
  72. THREE.Camera.prototype.update=function(b,d,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);d=!0}else{this.matrixAutoUpdate&&this.updateMatrix();if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
  73. !1;d=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
  74. THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,d,c,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1;this.distance=c||0;this.castShadow=f!==undefined?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,d,c){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=d||1;this.distance=c||0};
  75. THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,d,c,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;b!==undefined&&this.add(b,d,c,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
  76. THREE.LensFlare.prototype.add=function(b,d,c,f){d===undefined&&(d=-1);c===undefined&&(c=0);if(f===undefined)f=THREE.BillboardBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:b,size:d,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:f})};
  77. THREE.LensFlare.prototype.updateLensFlares=function(){var b,d=this.lensFlares.length,c,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(b=0;b<d;b++){c=this.lensFlares[b];c.x=this.positionScreen.x+f*c.distance;c.y=this.positionScreen.y+g*c.distance;c.wantedRotation=c.x*Math.PI*0.25;c.rotation+=(c.wantedRotation-c.rotation)*0.25}};
  78. THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==undefined?b.opacity:1;this.transparent=b.transparent!==undefined?b.transparent:!1;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==undefined?b.depthTest:!0};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;
  79. THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
  80. THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==undefined?b.linewidth:1;this.linecap=b.linecap!==undefined?b.linecap:"round";this.linejoin=b.linejoin!==undefined?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
  81. THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:0.98;this.shading=
  82. b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==undefined?
  83. b.morphTargets:!1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
  84. THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:0.98;this.shading=
  85. b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==undefined?
  86. b.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
  87. THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==undefined?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==undefined?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==undefined?b.shininess:30;this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?
  88. b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:0.98;this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=
  89. b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==undefined?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
  90. THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
  91. THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
  92. THREE.MeshShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==undefined?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==undefined?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==undefined?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:
  93. 1;this.fog=b.fog!==undefined?b.fog:!1;this.lights=b.lights!==undefined?b.lights:!1;this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==undefined?b.morphTargets:!1};THREE.MeshShaderMaterial.prototype=new THREE.Material;THREE.MeshShaderMaterial.prototype.constructor=THREE.MeshShaderMaterial;
  94. THREE.ShadowVolumeDynamicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.lightMap=b.lightMap!==undefined?b.lightMap:null;this.envMap=b.envMap!==undefined?b.envMap:null;this.combine=b.combine!==undefined?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==undefined?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==undefined?b.refractionRatio:
  95. 0.98;this.shading=b.shading!==undefined?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==undefined?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==undefined?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==undefined?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==undefined?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1;this.skinning=b.skinning!==undefined?b.skinning:!1;this.morphTargets=b.morphTargets!==
  96. undefined?b.morphTargets:!1};THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
  97. THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==undefined?b.map:null;this.size=b.size!==undefined?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==undefined?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==undefined?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
  98. THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==undefined?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==undefined?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
  99. THREE.Texture=function(b,d,c,f,g,h){this.image=b;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==undefined?g:THREE.LinearFilter;this.minFilter=h!==undefined?h: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)}};
  100. 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;
  101. THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
  102. THREE.Line=function(b,d,c){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
  103. THREE.Mesh=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d&&d.length?d:[d];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=b.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
  104. this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==undefined)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
  105. THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;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;
  106. THREE.Bone.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++){b=this.children[f];b instanceof THREE.Bone?b.update(this.skinMatrix,d,c):b.update(this.matrixWorld,!0,c)}}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
  107. d,c)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1){b.parent!==undefined&&b.parent.removeChild(b);b.parent=this;this.children.push(b);if(!(b instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
  108. THREE.SkinnedMesh=function(b,d){THREE.Mesh.call(this,b,d);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,f,g,h,j,k;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){g=this.geometry.bones[c];h=g.pos;j=g.rotq;k=g.scl;f=this.addBone();f.name=g.name;f.position.set(h[0],h[1],h[2]);f.quaternion.set(j[0],j[1],j[2],j[3]);f.useQuaternion=!0;k!==undefined?f.scale.set(k[0],k[1],k[2]):f.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){g=this.geometry.bones[c];
  109. f=this.bones[c];g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
  110. THREE.SkinnedMesh.prototype.update=function(b,d,c){if(this.visible){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var f,g=this.children.length;for(f=0;f<g;f++){b=this.children[f];b instanceof THREE.Bone?b.update(this.identityMatrix,!1,c):b.update(this.matrixWorld,d,c)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(d=0;d<c;d++)ba[d].skinMatrix.flattenToArrayOffset(bm,
  111. d*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===undefined&&(b=new THREE.Bone(this));this.bones.push(b);return b};
  112. THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var b,d=[],c=0;c<this.bones.length;c++){b=this.bones[c];d.push(THREE.Matrix4.makeInvert(b.skinMatrix));b.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){c=this.geometry.vertices[b].position;var g=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;
  113. f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(d[g].multiplyVector3(f));f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(d[h].multiplyVector3(f));if(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1){c=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5;this.geometry.skinWeights[b].x+=c;this.geometry.skinWeights[b].y+=c}}}};
  114. THREE.Ribbon=function(b,d){THREE.Object3D.call(this);this.geometry=b;this.materials=d instanceof Array?d:[d];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
  115. THREE.Sound=function(b,d,c,f){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=d!==undefined?Math.abs(d):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==undefined?f:!0;this.sources=b instanceof Array?b:[b];var g;c=this.sources.length;for(b=0;b<c;b++){d=this.sources[b];d.toLowerCase();if(d.indexOf(".mp3")!==-1)g=
  116. "audio/mpeg";else if(d.indexOf(".ogg")!==-1)g="audio/ogg";else d.indexOf(".wav")!==-1&&(g="audio/wav");if(this.domElement.canPlayType(g)){g=document.createElement("source");g.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(g);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;
  117. THREE.Sound.prototype.onLoad=function(){var b=this.THREESound;if(!b.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);b.isLoaded=!0;b.duration=this.duration;b.isPlaying&&b.play()}};THREE.Sound.prototype.addToDOM=function(b){this.isAddedToDOM=!0;b.appendChild(this.domElement)};THREE.Sound.prototype.play=function(b){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(b)this.domElement.currentTime=b%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
  118. THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(b){b=b.length();this.domElement.volume=b<=this.radius?this.volume*(1-b/this.radius):0};
  119. THREE.Sound.prototype.update=function(b,d,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);d=!0}if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}var f=this.children.length;for(b=0;b<f;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
  120. THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,d){d===undefined&&(d=0);d=Math.abs(d);for(var c=0;c<this.LODs.length;c++)if(d<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:d,object3D:b});this.addChild(b)};
  121. THREE.LOD.prototype.update=function(b,d,c){this.matrixAutoUpdate&&(d|=this.updateMatrix());if(d||this.matrixWorldNeedsUpdate){b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;d=!0}if(this.LODs.length>1){b=c.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
  122. !1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,d,c)};THREE.ShadowVolume=function(b,d){if(b instanceof THREE.Mesh){THREE.Mesh.call(this,b.geometry,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);b.addChild(this)}else THREE.Mesh.call(this,b,d?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
  123. THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
  124. THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,d,c,f,g,h,j,k,m,o,p,x,y,t,u=new THREE.Geometry;u.vertices=this.geometry.vertices;f=u.faces=this.geometry.faces;var I=u.egdes=this.geometry.edges,H=u.edgeFaces=[];g=0;var C=[];b=0;for(d=f.length;b<d;b++){c=f[b];C.push(g);g+=c instanceof THREE.Face3?3:4;c.vertexNormals[0]=c.normal;c.vertexNormals[1]=c.normal;c.vertexNormals[2]=c.normal;if(c instanceof THREE.Face4)c.vertexNormals[3]=
  125. c.normal}b=0;for(d=I.length;b<d;b++){k=I[b];c=k.faces[0];f=k.faces[1];g=k.faceIndices[0];h=k.faceIndices[1];j=k.vertexIndices[0];k=k.vertexIndices[1];if(c.a===j){m="a";p=C[g]+0}else if(c.b===j){m="b";p=C[g]+1}else if(c.c===j){m="c";p=C[g]+2}else if(c.d===j){m="d";p=C[g]+3}if(c.a===k){m+="a";x=C[g]+0}else if(c.b===k){m+="b";x=C[g]+1}else if(c.c===k){m+="c";x=C[g]+2}else if(c.d===k){m+="d";x=C[g]+3}if(f.a===j){o="a";y=C[h]+0}else if(f.b===j){o="b";y=C[h]+1}else if(f.c===j){o="c";y=C[h]+2}else if(f.d===
  126. j){o="d";y=C[h]+3}if(f.a===k){o+="a";t=C[h]+0}else if(f.b===k){o+="b";t=C[h]+1}else if(f.c===k){o+="c";t=C[h]+2}else if(f.d===k){o+="d";t=C[h]+3}if(m==="ac"||m==="ad"||m==="ca"||m==="da"){if(p>x){c=p;p=x;x=c}}else if(p<x){c=p;p=x;x=c}if(o==="ac"||o==="ad"||o==="ca"||o==="da"){if(y>t){c=y;y=t;t=c}}else if(y<t){c=y;y=t;t=c}c=new THREE.Face4(p,x,y,t);c.normal.set(1,0,0);H.push(c)}this.geometry=u}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
  127. THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var d=this.geometry.vertices,c=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces;b=b.vertices;var h=g.length,j,k,m,o,p,x=["a","b","c","d"];for(m=0;m<h;m++){k=d.length;j=g[m];if(j instanceof THREE.Face4){o=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{o=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);c.push(k);
  128. for(k=0;k<o;k++){p=b[j[x[k]]];d.push(new THREE.Vertex(p.position.clone()))}}for(h=0;h<g.length-1;h++){b=c[h];for(j=h+1;j<g.length;j++){k=c[j];k=this.facesShareEdge(d,b,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);f.push(k)}}}};
  129. THREE.ShadowVolume.prototype.facesShareEdge=function(b,d,c){var f,g,h,j,k,m,o,p,x,y,t,u,I,H=0,C=["a","b","c","d"];f=d instanceof THREE.Face4?4:3;g=c instanceof THREE.Face4?4:3;for(u=0;u<f;u++){h=d[C[u]];k=b[h];for(I=0;I<g;I++){j=c[C[I]];m=b[j];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){H++;if(H===1){o=k;p=m;x=h;y=j;t=C[u]}if(H===2){t+=C[u];return t==="ad"||t==="ac"?{faces:[d,c],vertices:[o,p,m,k],indices:[x,
  130. y,j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[d,c],vertices:[o,k,m,p],indices:[x,h,j,y],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};
  131. THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==undefined){this.material=b.material;this.map=undefined;this.blending=material.blending}else if(b.map!==undefined){this.map=b.map instanceof THREE.Texture?b.map:ImageUtils.loadTexture(b.map);this.material=undefined;this.blending=b.blending!==undefined?b.blending:THREE.NormalBlending}this.useScreenCoordinates=b.useScreenCoordinates!==undefined?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==undefined?b.mergeWith3D:!this.useScreenCoordinates;
  132. this.affectedByDistance=b.affectedByDistance!==undefined?b.affectedByDistance:!this.useScreenCoordinates;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
  133. THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,this.scale.y)}this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
  134. THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
  135. THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=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;THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};
  136. THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b)}for(var d=0;d<b.children.length;d++)this.addChildRecurse(b.children[d])};
  137. THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var d=this.lights.indexOf(b);d!==-1&&this.lights.splice(d,1)}else if(b instanceof THREE.Sound){d=this.sounds.indexOf(b);d!==-1&&this.sounds.splice(d,1)}else if(!(b instanceof THREE.Camera)){d=this.objects.indexOf(b);if(d!==-1){this.objects.splice(d,1);this.__objectsRemoved.push(b)}}for(d=0;d<b.children.length;d++)this.removeChildRecurse(b.children[d])};
  138. 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(b,d,c){this.color=new THREE.Color(b);this.near=d||1;this.far=c||1E3};THREE.FogExp2=function(b,d){this.color=new THREE.Color(b);this.density=d!==undefined?d:2.5E-4};
  139. THREE.Projector=function(){function b(){var ha=m[k]=m[k]||new THREE.RenderableVertex;k++;return ha}function d(ha,e){return e.z-ha.z}function c(ha,e){var Ja=0,ta=1,Da=ha.z+ha.w,ca=e.z+e.w,ua=-ha.z+ha.w,da=-e.z+e.w;if(Da>=0&&ca>=0&&ua>=0&&da>=0)return!0;else if(Da<0&&ca<0||ua<0&&da<0)return!1;else{if(Da<0)Ja=Math.max(Ja,Da/(Da-ca));else ca<0&&(ta=Math.min(ta,Da/(Da-ca)));if(ua<0)Ja=Math.max(Ja,ua/(ua-da));else da<0&&(ta=Math.min(ta,ua/(ua-da)));if(ta<Ja)return!1;else{ha.lerpSelf(e,Ja);e.lerpSelf(ha,
  140. 1-ta);return!0}}}var f,g,h=[],j,k,m=[],o,p,x=[],y,t=[],u,I,H=[],C,S,E=[],T=new THREE.Vector4,O=new THREE.Vector4,Q=new THREE.Matrix4,ya=new THREE.Matrix4,aa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ga=new THREE.Vector4,X=new THREE.Vector4;this.projectVector=function(ha,e){Q.multiply(e.projectionMatrix,e.matrixWorldInverse);Q.multiplyVector3(ha);return ha};this.unprojectVector=function(ha,e){Q.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));
  141. Q.multiplyVector3(ha);return ha};this.projectObjects=function(ha,e,Ja){e=[];var ta,Da,ca;g=0;Da=ha.objects;ha=0;for(ta=Da.length;ha<ta;ha++){ca=Da[ha];var ua;if(!(ua=!ca.visible))if(ua=ca instanceof THREE.Mesh){a:{ua=void 0;for(var da=ca.matrixWorld,sa=-ca.geometry.boundingSphere.radius*Math.max(ca.scale.x,Math.max(ca.scale.y,ca.scale.z)),na=0;na<6;na++){ua=aa[na].x*da.n14+aa[na].y*da.n24+aa[na].z*da.n34+aa[na].w;if(ua<=sa){ua=!1;break a}}ua=!0}ua=!ua}if(!ua){ua=h[g]=h[g]||new THREE.RenderableObject;
  142. g++;f=ua;T.copy(ca.position);Q.multiplyVector3(T);f.object=ca;f.z=T.z;e.push(f)}}Ja&&e.sort(d);return e};this.projectScene=function(ha,e,Ja){var ta=[],Da=e.near,ca=e.far,ua,da,sa,na,ra,oa,ea,Aa,Oa,fa,xa,Ma,Qa,Ua,L,Z,ja;S=I=y=p=0;e.matrixAutoUpdate&&e.update(undefined,!0);ha.update(undefined,!1,e);Q.multiply(e.projectionMatrix,e.matrixWorldInverse);aa[0].set(Q.n41-Q.n11,Q.n42-Q.n12,Q.n43-Q.n13,Q.n44-Q.n14);aa[1].set(Q.n41+Q.n11,Q.n42+Q.n12,Q.n43+Q.n13,Q.n44+Q.n14);aa[2].set(Q.n41+Q.n21,Q.n42+Q.n22,
  143. Q.n43+Q.n23,Q.n44+Q.n24);aa[3].set(Q.n41-Q.n21,Q.n42-Q.n22,Q.n43-Q.n23,Q.n44-Q.n24);aa[4].set(Q.n41-Q.n31,Q.n42-Q.n32,Q.n43-Q.n33,Q.n44-Q.n34);aa[5].set(Q.n41+Q.n31,Q.n42+Q.n32,Q.n43+Q.n33,Q.n44+Q.n34);for(ua=0;ua<6;ua++){Oa=aa[ua];Oa.divideScalar(Math.sqrt(Oa.x*Oa.x+Oa.y*Oa.y+Oa.z*Oa.z))}Oa=this.projectObjects(ha,e,!0);ha=0;for(ua=Oa.length;ha<ua;ha++){fa=Oa[ha].object;if(fa.visible){xa=fa.matrixWorld;Ma=fa.matrixRotationWorld;Qa=fa.materials;Ua=fa.overdraw;k=0;if(fa instanceof THREE.Mesh){L=fa.geometry;
  144. na=L.vertices;Z=L.faces;L=L.faceVertexUvs;da=0;for(sa=na.length;da<sa;da++){j=b();j.positionWorld.copy(na[da].position);xa.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);Q.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Da&&j.positionScreen.z<ca}na=0;for(da=Z.length;na<da;na++){sa=Z[na];if(sa instanceof THREE.Face3){ra=m[sa.a];oa=m[sa.b];ea=m[sa.c];if(ra.visible&&oa.visible&&ea.visible&&
  145. (fa.doubleSided||fa.flipSided!=(ea.positionScreen.x-ra.positionScreen.x)*(oa.positionScreen.y-ra.positionScreen.y)-(ea.positionScreen.y-ra.positionScreen.y)*(oa.positionScreen.x-ra.positionScreen.x)<0)){Aa=x[p]=x[p]||new THREE.RenderableFace3;p++;o=Aa;o.v1.copy(ra);o.v2.copy(oa);o.v3.copy(ea)}else continue}else if(sa instanceof THREE.Face4){ra=m[sa.a];oa=m[sa.b];ea=m[sa.c];Aa=m[sa.d];if(ra.visible&&oa.visible&&ea.visible&&Aa.visible&&(fa.doubleSided||fa.flipSided!=((Aa.positionScreen.x-ra.positionScreen.x)*
  146. (oa.positionScreen.y-ra.positionScreen.y)-(Aa.positionScreen.y-ra.positionScreen.y)*(oa.positionScreen.x-ra.positionScreen.x)<0||(oa.positionScreen.x-ea.positionScreen.x)*(Aa.positionScreen.y-ea.positionScreen.y)-(oa.positionScreen.y-ea.positionScreen.y)*(Aa.positionScreen.x-ea.positionScreen.x)<0))){ja=t[y]=t[y]||new THREE.RenderableFace4;y++;o=ja;o.v1.copy(ra);o.v2.copy(oa);o.v3.copy(ea);o.v4.copy(Aa)}else continue}o.normalWorld.copy(sa.normal);Ma.multiplyVector3(o.normalWorld);o.centroidWorld.copy(sa.centroid);
  147. xa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);Q.multiplyVector3(o.centroidScreen);ea=sa.vertexNormals;ra=0;for(oa=ea.length;ra<oa;ra++){Aa=o.vertexNormalsWorld[ra];Aa.copy(ea[ra]);Ma.multiplyVector3(Aa)}ra=0;for(oa=L.length;ra<oa;ra++)if(ja=L[ra][na]){ea=0;for(Aa=ja.length;ea<Aa;ea++)o.uvs[ra][ea]=ja[ea]}o.meshMaterials=Qa;o.faceMaterials=sa.materials;o.overdraw=Ua;o.z=o.centroidScreen.z;ta.push(o)}}else if(fa instanceof THREE.Line){ya.multiply(Q,xa);na=fa.geometry.vertices;
  148. ra=b();ra.positionScreen.copy(na[0].position);ya.multiplyVector4(ra.positionScreen);da=1;for(sa=na.length;da<sa;da++){ra=b();ra.positionScreen.copy(na[da].position);ya.multiplyVector4(ra.positionScreen);oa=m[k-2];ga.copy(ra.positionScreen);X.copy(oa.positionScreen);if(c(ga,X)){ga.multiplyScalar(1/ga.w);X.multiplyScalar(1/X.w);xa=H[I]=H[I]||new THREE.RenderableLine;I++;u=xa;u.v1.positionScreen.copy(ga);u.v2.positionScreen.copy(X);u.z=Math.max(ga.z,X.z);u.materials=fa.materials;ta.push(u)}}}else if(fa instanceof
  149. THREE.Particle){O.set(fa.matrixWorld.n14,fa.matrixWorld.n24,fa.matrixWorld.n34,1);Q.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){xa=E[S]=E[S]||new THREE.RenderableParticle;S++;C=xa;C.x=O.x/O.w;C.y=O.y/O.w;C.z=O.z;C.rotation=fa.rotation.z;C.scale.x=fa.scale.x*Math.abs(C.x-(O.x+e.projectionMatrix.n11)/(O.w+e.projectionMatrix.n14));C.scale.y=fa.scale.y*Math.abs(C.y-(O.y+e.projectionMatrix.n22)/(O.w+e.projectionMatrix.n24));C.materials=fa.materials;ta.push(C)}}}}Ja&&ta.sort(d);return ta}};
  150. THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,d=new THREE.Projector,c,f,g,h;this.domElement=document.createElement("div");this.setSize=function(j,k){c=j;f=k;g=c/2;h=f/2};this.render=function(j,k){var m,o,p,x,y,t,u,I;b=d.projectScene(j,k);m=0;for(o=b.length;m<o;m++){y=b[m];if(y instanceof THREE.RenderableParticle){u=y.x*g+g;I=y.y*h+h;p=0;for(x=y.material.length;p<x;p++){t=y.material[p];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=u+"px";t.style.top=I+"px"}}}}}};
  151. THREE.CanvasRenderer=function(b){function d(V){if(C!=V)u.globalAlpha=C=V}function c(V){if(S!=V){switch(V){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}S=V}}function f(V){if(E!=V.hex){E=V.hex;u.strokeStyle="#"+h(E.toString(16))}}function g(V){if(T!=V.hex){T=V.hex;u.fillStyle="#"+h(T.toString(16))}}function h(V){for(;V.length<6;)V="0"+
  152. V;return V}var j=this,k=null,m=new THREE.Projector;b=b||{};var o=b.canvas!==undefined?b.canvas:document.createElement("canvas"),p,x,y,t,u=o.getContext("2d"),I=new THREE.Color(0),H=0,C=1,S=0,E=null,T=null,O=null,Q=null,ya=null,aa,ga,X,ha,e=new THREE.RenderableVertex,Ja=new THREE.RenderableVertex,ta,Da,ca,ua,da,sa,na,ra,oa,ea,Aa,Oa,fa=new THREE.Color(0),xa=new THREE.Color(0),Ma=new THREE.Color(0),Qa=new THREE.Color(0),Ua=new THREE.Color(0),L,Z,ja,la,Na,fb,hb,Ga,ka,ub,lb=new THREE.Rectangle,n=new THREE.Rectangle,
  153. D=new THREE.Rectangle,z=!1,v=new THREE.Color,A=new THREE.Color,M=new THREE.Color,J=new THREE.Color,G=new THREE.Vector3,U,Y,B,K,W,ia;b=16;U=document.createElement("canvas");U.width=U.height=2;Y=U.getContext("2d");Y.fillStyle="rgba(0,0,0,1)";Y.fillRect(0,0,2,2);B=Y.getImageData(0,0,2,2);K=B.data;W=document.createElement("canvas");W.width=W.height=b;ia=W.getContext("2d");ia.translate(-b/2,-b/2);ia.scale(b,b);b--;this.domElement=o;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,
  154. faces:0};this.setSize=function(V,Ka){p=V;x=Ka;y=p/2;t=x/2;o.width=p;o.height=x;lb.set(-y,-t,y,t);C=1;S=0;ya=Q=O=T=E=null};this.setClearColor=function(V,Ka){I=V;H=Ka};this.setClearColorHex=function(V,Ka){I.setHex(V);H=Ka};this.clear=function(){u.setTransform(1,0,0,-1,y,t);if(!n.isEmpty()){n.inflate(1);n.minSelf(lb);if(I.hex==0&&H==0)u.clearRect(n.getX(),n.getY(),n.getWidth(),n.getHeight());else{c(THREE.NormalBlending);d(1);u.fillStyle="rgba("+Math.floor(I.r*255)+","+Math.floor(I.g*255)+","+Math.floor(I.b*
  155. 255)+","+H+")";u.fillRect(n.getX(),n.getY(),n.getWidth(),n.getHeight())}n.empty()}};this.render=function(V,Ka){function Ba(R){var pa,va,qa,Ia=R.lights;A.setRGB(0,0,0);M.setRGB(0,0,0);J.setRGB(0,0,0);R=0;for(pa=Ia.length;R<pa;R++){va=Ia[R];qa=va.color;if(va instanceof THREE.AmbientLight){A.r+=qa.r;A.g+=qa.g;A.b+=qa.b}else if(va instanceof THREE.DirectionalLight){M.r+=qa.r;M.g+=qa.g;M.b+=qa.b}else if(va instanceof THREE.PointLight){J.r+=qa.r;J.g+=qa.g;J.b+=qa.b}}}function La(R,pa,va,qa){var Ia,wa,ma,
  156. N,za=R.lights;R=0;for(Ia=za.length;R<Ia;R++){wa=za[R];ma=wa.color;if(wa instanceof THREE.DirectionalLight){N=va.dot(wa.position);if(!(N<=0)){N*=wa.intensity;qa.r+=ma.r*N;qa.g+=ma.g*N;qa.b+=ma.b*N}}else if(wa instanceof THREE.PointLight){N=va.dot(G.sub(wa.position,pa).normalize());if(!(N<=0)){N*=wa.distance==0?1:1-Math.min(pa.distanceTo(wa.position)/wa.distance,1);if(N!=0){N*=wa.intensity;qa.r+=ma.r*N;qa.g+=ma.g*N;qa.b+=ma.b*N}}}}}function bb(R,pa,va){d(va.opacity);c(va.blending);var qa,Ia,wa,ma,N,
  157. za;if(va instanceof THREE.ParticleBasicMaterial){if(va.map){ma=va.map.image;N=ma.width>>1;za=ma.height>>1;va=pa.scale.x*y;wa=pa.scale.y*t;qa=va*N;Ia=wa*za;D.set(R.x-qa,R.y-Ia,R.x+qa,R.y+Ia);if(lb.instersects(D)){u.save();u.translate(R.x,R.y);u.rotate(-pa.rotation);u.scale(va,-wa);u.translate(-N,-za);u.drawImage(ma,0,0);u.restore()}}}else if(va instanceof THREE.ParticleCanvasMaterial){qa=pa.scale.x*y;Ia=pa.scale.y*t;D.set(R.x-qa,R.y-Ia,R.x+qa,R.y+Ia);if(lb.instersects(D)){f(va.color);g(va.color);u.save();
  158. u.translate(R.x,R.y);u.rotate(-pa.rotation);u.scale(qa,Ia);va.program(u);u.restore()}}}function kb(R,pa,va,qa){d(qa.opacity);c(qa.blending);u.beginPath();u.moveTo(R.positionScreen.x,R.positionScreen.y);u.lineTo(pa.positionScreen.x,pa.positionScreen.y);u.closePath();if(qa instanceof THREE.LineBasicMaterial){R=qa.linewidth;if(O!=R)u.lineWidth=O=R;R=qa.linecap;if(Q!=R)u.lineCap=Q=R;R=qa.linejoin;if(ya!=R)u.lineJoin=ya=R;f(qa.color);u.stroke();D.inflate(qa.linewidth*2)}}function Ca(R,pa,va,qa,Ia,wa,ma,
  159. N,za){j.data.vertices+=3;j.data.faces++;d(N.opacity);c(N.blending);ta=R.positionScreen.x;Da=R.positionScreen.y;ca=pa.positionScreen.x;ua=pa.positionScreen.y;da=va.positionScreen.x;sa=va.positionScreen.y;Ea(ta,Da,ca,ua,da,sa);if(N instanceof THREE.MeshBasicMaterial)if(N.map){if(N.map.mapping instanceof THREE.UVMapping){la=ma.uvs[0];w(ta,Da,ca,ua,da,sa,N.map.image,la[qa].u,la[qa].v,la[Ia].u,la[Ia].v,la[wa].u,la[wa].v)}}else if(N.envMap){if(N.envMap.mapping instanceof THREE.SphericalReflectionMapping){R=
  160. Ka.matrixWorldInverse;G.copy(ma.vertexNormalsWorld[0]);Na=(G.x*R.n11+G.y*R.n12+G.z*R.n13)*0.5+0.5;fb=-(G.x*R.n21+G.y*R.n22+G.z*R.n23)*0.5+0.5;G.copy(ma.vertexNormalsWorld[1]);hb=(G.x*R.n11+G.y*R.n12+G.z*R.n13)*0.5+0.5;Ga=-(G.x*R.n21+G.y*R.n22+G.z*R.n23)*0.5+0.5;G.copy(ma.vertexNormalsWorld[2]);ka=(G.x*R.n11+G.y*R.n12+G.z*R.n13)*0.5+0.5;ub=-(G.x*R.n21+G.y*R.n22+G.z*R.n23)*0.5+0.5;w(ta,Da,ca,ua,da,sa,N.envMap.image,Na,fb,hb,Ga,ka,ub)}}else N.wireframe?F(N.color,N.wireframeLinewidth,N.wireframeLinecap,
  161. N.wireframeLinejoin):$(N.color);else if(N instanceof THREE.MeshLambertMaterial){if(N.map&&!N.wireframe){if(N.map.mapping instanceof THREE.UVMapping){la=ma.uvs[0];w(ta,Da,ca,ua,da,sa,N.map.image,la[qa].u,la[qa].v,la[Ia].u,la[Ia].v,la[wa].u,la[wa].v)}c(THREE.SubtractiveBlending)}if(z)if(!N.wireframe&&N.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==3){xa.r=Ma.r=Qa.r=A.r;xa.g=Ma.g=Qa.g=A.g;xa.b=Ma.b=Qa.b=A.b;La(za,ma.v1.positionWorld,ma.vertexNormalsWorld[0],xa);La(za,ma.v2.positionWorld,
  162. ma.vertexNormalsWorld[1],Ma);La(za,ma.v3.positionWorld,ma.vertexNormalsWorld[2],Qa);Ua.r=(Ma.r+Qa.r)*0.5;Ua.g=(Ma.g+Qa.g)*0.5;Ua.b=(Ma.b+Qa.b)*0.5;ja=cb(xa,Ma,Qa,Ua);w(ta,Da,ca,ua,da,sa,ja,0,0,1,0,0,1)}else{v.r=A.r;v.g=A.g;v.b=A.b;La(za,ma.centroidWorld,ma.normalWorld,v);fa.r=Math.max(0,Math.min(N.color.r*v.r,1));fa.g=Math.max(0,Math.min(N.color.g*v.g,1));fa.b=Math.max(0,Math.min(N.color.b*v.b,1));fa.updateHex();N.wireframe?F(fa,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):$(fa)}else N.wireframe?
  163. F(N.color,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):$(N.color)}else if(N instanceof THREE.MeshDepthMaterial){L=Ka.near;Z=Ka.far;xa.r=xa.g=xa.b=1-gb(R.positionScreen.z,L,Z);Ma.r=Ma.g=Ma.b=1-gb(pa.positionScreen.z,L,Z);Qa.r=Qa.g=Qa.b=1-gb(va.positionScreen.z,L,Z);Ua.r=(Ma.r+Qa.r)*0.5;Ua.g=(Ma.g+Qa.g)*0.5;Ua.b=(Ma.b+Qa.b)*0.5;ja=cb(xa,Ma,Qa,Ua);w(ta,Da,ca,ua,da,sa,ja,0,0,1,0,0,1)}else if(N instanceof THREE.MeshNormalMaterial){fa.r=Va(ma.normalWorld.x);fa.g=Va(ma.normalWorld.y);fa.b=
  164. Va(ma.normalWorld.z);fa.updateHex();N.wireframe?F(fa,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):$(fa)}}function Ha(R,pa,va,qa,Ia,wa,ma,N,za){j.data.vertices+=4;j.data.faces++;d(N.opacity);c(N.blending);if(N.map||N.envMap){Ca(R,pa,qa,0,1,3,ma,N,za);Ca(Ia,va,wa,1,2,3,ma,N,za)}else{ta=R.positionScreen.x;Da=R.positionScreen.y;ca=pa.positionScreen.x;ua=pa.positionScreen.y;da=va.positionScreen.x;sa=va.positionScreen.y;na=qa.positionScreen.x;ra=qa.positionScreen.y;oa=Ia.positionScreen.x;
  165. ea=Ia.positionScreen.y;Aa=wa.positionScreen.x;Oa=wa.positionScreen.y;if(N instanceof THREE.MeshBasicMaterial){Ta(ta,Da,ca,ua,da,sa,na,ra);N.wireframe?F(N.color,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):$(N.color)}else if(N instanceof THREE.MeshLambertMaterial)if(z)if(!N.wireframe&&N.shading==THREE.SmoothShading&&ma.vertexNormalsWorld.length==4){xa.r=Ma.r=Qa.r=Ua.r=A.r;xa.g=Ma.g=Qa.g=Ua.g=A.g;xa.b=Ma.b=Qa.b=Ua.b=A.b;La(za,ma.v1.positionWorld,ma.vertexNormalsWorld[0],xa);La(za,ma.v2.positionWorld,
  166. ma.vertexNormalsWorld[1],Ma);La(za,ma.v4.positionWorld,ma.vertexNormalsWorld[3],Qa);La(za,ma.v3.positionWorld,ma.vertexNormalsWorld[2],Ua);ja=cb(xa,Ma,Qa,Ua);Ea(ta,Da,ca,ua,na,ra);w(ta,Da,ca,ua,na,ra,ja,0,0,1,0,0,1);Ea(oa,ea,da,sa,Aa,Oa);w(oa,ea,da,sa,Aa,Oa,ja,1,0,1,1,0,1)}else{v.r=A.r;v.g=A.g;v.b=A.b;La(za,ma.centroidWorld,ma.normalWorld,v);fa.r=Math.max(0,Math.min(N.color.r*v.r,1));fa.g=Math.max(0,Math.min(N.color.g*v.g,1));fa.b=Math.max(0,Math.min(N.color.b*v.b,1));fa.updateHex();Ta(ta,Da,ca,ua,
  167. da,sa,na,ra);N.wireframe?F(fa,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):$(fa)}else{Ta(ta,Da,ca,ua,da,sa,na,ra);N.wireframe?F(N.color,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):$(N.color)}else if(N instanceof THREE.MeshNormalMaterial){fa.r=Va(ma.normalWorld.x);fa.g=Va(ma.normalWorld.y);fa.b=Va(ma.normalWorld.z);fa.updateHex();Ta(ta,Da,ca,ua,da,sa,na,ra);N.wireframe?F(fa,N.wireframeLinewidth,N.wireframeLinecap,N.wireframeLinejoin):$(fa)}else if(N instanceof THREE.MeshDepthMaterial){L=
  168. Ka.near;Z=Ka.far;xa.r=xa.g=xa.b=1-gb(R.positionScreen.z,L,Z);Ma.r=Ma.g=Ma.b=1-gb(pa.positionScreen.z,L,Z);Qa.r=Qa.g=Qa.b=1-gb(qa.positionScreen.z,L,Z);Ua.r=Ua.g=Ua.b=1-gb(va.positionScreen.z,L,Z);ja=cb(xa,Ma,Qa,Ua);Ea(ta,Da,ca,ua,na,ra);w(ta,Da,ca,ua,na,ra,ja,0,0,1,0,0,1);Ea(oa,ea,da,sa,Aa,Oa);w(oa,ea,da,sa,Aa,Oa,ja,1,0,1,1,0,1)}}}function Ea(R,pa,va,qa,Ia,wa){u.beginPath();u.moveTo(R,pa);u.lineTo(va,qa);u.lineTo(Ia,wa);u.lineTo(R,pa);u.closePath()}function Ta(R,pa,va,qa,Ia,wa,ma,N){u.beginPath();
  169. u.moveTo(R,pa);u.lineTo(va,qa);u.lineTo(Ia,wa);u.lineTo(ma,N);u.lineTo(R,pa);u.closePath()}function F(R,pa,va,qa){if(O!=pa)u.lineWidth=O=pa;if(Q!=va)u.lineCap=Q=va;if(ya!=qa)u.lineJoin=ya=qa;f(R);u.stroke();D.inflate(pa*2)}function $(R){g(R);u.fill()}function w(R,pa,va,qa,Ia,wa,ma,N,za,Ra,Pa,ib,eb){var Za,$a;Za=ma.width-1;$a=ma.height-1;N*=Za;za*=$a;Ra*=Za;Pa*=$a;ib*=Za;eb*=$a;va-=R;qa-=pa;Ia-=R;wa-=pa;Ra-=N;Pa-=za;ib-=N;eb-=za;Za=Ra*eb-ib*Pa;if(Za!=0){$a=1/Za;Za=(eb*va-Pa*Ia)*$a;Pa=(eb*qa-Pa*wa)*
  170. $a;va=(Ra*Ia-ib*va)*$a;qa=(Ra*wa-ib*qa)*$a;R=R-Za*N-va*za;pa=pa-Pa*N-qa*za;u.save();u.transform(Za,Pa,va,qa,R,pa);u.clip();u.drawImage(ma,0,0);u.restore()}}function cb(R,pa,va,qa){var Ia=~~(R.r*255),wa=~~(R.g*255);R=~~(R.b*255);var ma=~~(pa.r*255),N=~~(pa.g*255);pa=~~(pa.b*255);var za=~~(va.r*255),Ra=~~(va.g*255);va=~~(va.b*255);var Pa=~~(qa.r*255),ib=~~(qa.g*255);qa=~~(qa.b*255);K[0]=Ia<0?0:Ia>255?255:Ia;K[1]=wa<0?0:wa>255?255:wa;K[2]=R<0?0:R>255?255:R;K[4]=ma<0?0:ma>255?255:ma;K[5]=N<0?0:N>255?
  171. 255:N;K[6]=pa<0?0:pa>255?255:pa;K[8]=za<0?0:za>255?255:za;K[9]=Ra<0?0:Ra>255?255:Ra;K[10]=va<0?0:va>255?255:va;K[12]=Pa<0?0:Pa>255?255:Pa;K[13]=ib<0?0:ib>255?255:ib;K[14]=qa<0?0:qa>255?255:qa;Y.putImageData(B,0,0);ia.drawImage(U,0,0);return W}function gb(R,pa,va){R=(R-pa)/(va-pa);return R*R*(3-2*R)}function Va(R){R=(R+1)*0.5;return R<0?0:R>1?1:R}function Wa(R,pa){var va=pa.x-R.x,qa=pa.y-R.y,Ia=1/Math.sqrt(va*va+qa*qa);va*=Ia;qa*=Ia;pa.x+=va;pa.y+=qa;R.x-=va;R.y-=qa}var jb,mb,Fa,Xa,Sa,ab,Ya,P;this.autoClear?
  172. this.clear():u.setTransform(1,0,0,-1,y,t);j.data.vertices=0;j.data.faces=0;k=m.projectScene(V,Ka,this.sortElements);(z=V.lights.length>0)&&Ba(V);jb=0;for(mb=k.length;jb<mb;jb++){Fa=k[jb];D.empty();if(Fa instanceof THREE.RenderableParticle){aa=Fa;aa.x*=y;aa.y*=t;Xa=0;for(Sa=Fa.materials.length;Xa<Sa;){P=Fa.materials[Xa++];P.opacity!=0&&bb(aa,Fa,P,V)}}else if(Fa instanceof THREE.RenderableLine){aa=Fa.v1;ga=Fa.v2;aa.positionScreen.x*=y;aa.positionScreen.y*=t;ga.positionScreen.x*=y;ga.positionScreen.y*=
  173. t;D.addPoint(aa.positionScreen.x,aa.positionScreen.y);D.addPoint(ga.positionScreen.x,ga.positionScreen.y);if(lb.instersects(D)){Xa=0;for(Sa=Fa.materials.length;Xa<Sa;){P=Fa.materials[Xa++];P.opacity!=0&&kb(aa,ga,Fa,P,V)}}}else if(Fa instanceof THREE.RenderableFace3){aa=Fa.v1;ga=Fa.v2;X=Fa.v3;aa.positionScreen.x*=y;aa.positionScreen.y*=t;ga.positionScreen.x*=y;ga.positionScreen.y*=t;X.positionScreen.x*=y;X.positionScreen.y*=t;if(Fa.overdraw){Wa(aa.positionScreen,ga.positionScreen);Wa(ga.positionScreen,
  174. X.positionScreen);Wa(X.positionScreen,aa.positionScreen)}D.add3Points(aa.positionScreen.x,aa.positionScreen.y,ga.positionScreen.x,ga.positionScreen.y,X.positionScreen.x,X.positionScreen.y);if(lb.instersects(D)){Xa=0;for(Sa=Fa.meshMaterials.length;Xa<Sa;){P=Fa.meshMaterials[Xa++];if(P instanceof THREE.MeshFaceMaterial){ab=0;for(Ya=Fa.faceMaterials.length;ab<Ya;)(P=Fa.faceMaterials[ab++])&&P.opacity!=0&&Ca(aa,ga,X,0,1,2,Fa,P,V)}else P.opacity!=0&&Ca(aa,ga,X,0,1,2,Fa,P,V)}}}else if(Fa instanceof THREE.RenderableFace4){aa=
  175. Fa.v1;ga=Fa.v2;X=Fa.v3;ha=Fa.v4;aa.positionScreen.x*=y;aa.positionScreen.y*=t;ga.positionScreen.x*=y;ga.positionScreen.y*=t;X.positionScreen.x*=y;X.positionScreen.y*=t;ha.positionScreen.x*=y;ha.positionScreen.y*=t;e.positionScreen.copy(ga.positionScreen);Ja.positionScreen.copy(ha.positionScreen);if(Fa.overdraw){Wa(aa.positionScreen,ga.positionScreen);Wa(ga.positionScreen,ha.positionScreen);Wa(ha.positionScreen,aa.positionScreen);Wa(X.positionScreen,e.positionScreen);Wa(X.positionScreen,Ja.positionScreen)}D.addPoint(aa.positionScreen.x,
  176. aa.positionScreen.y);D.addPoint(ga.positionScreen.x,ga.positionScreen.y);D.addPoint(X.positionScreen.x,X.positionScreen.y);D.addPoint(ha.positionScreen.x,ha.positionScreen.y);if(lb.instersects(D)){Xa=0;for(Sa=Fa.meshMaterials.length;Xa<Sa;){P=Fa.meshMaterials[Xa++];if(P instanceof THREE.MeshFaceMaterial){ab=0;for(Ya=Fa.faceMaterials.length;ab<Ya;)(P=Fa.faceMaterials[ab++])&&P.opacity!=0&&Ha(aa,ga,X,ha,e,Ja,Fa,P,V)}else P.opacity!=0&&Ha(aa,ga,X,ha,e,Ja,Fa,P,V)}}}n.addRectangle(D)}u.setTransform(1,
  177. 0,0,1,0,0)}};
  178. THREE.SVGRenderer=function(){function b(da,sa,na){var ra,oa,ea,Aa;ra=0;for(oa=da.lights.length;ra<oa;ra++){ea=da.lights[ra];if(ea instanceof THREE.DirectionalLight){Aa=sa.normalWorld.dot(ea.position)*ea.intensity;if(Aa>0){na.r+=ea.color.r*Aa;na.g+=ea.color.g*Aa;na.b+=ea.color.b*Aa}}else if(ea instanceof THREE.PointLight){ha.sub(ea.position,sa.centroidWorld);ha.normalize();Aa=sa.normalWorld.dot(ha)*ea.intensity;if(Aa>0){na.r+=ea.color.r*Aa;na.g+=ea.color.g*Aa;na.b+=ea.color.b*Aa}}}}function d(da,sa,
  179. na,ra,oa,ea){j.data.vertices+=3;j.data.faces++;ta=f(Da++);ta.setAttribute("d","M "+da.positionScreen.x+" "+da.positionScreen.y+" L "+sa.positionScreen.x+" "+sa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+"z");if(oa instanceof THREE.MeshBasicMaterial)O.hex=oa.color.hex;else if(oa instanceof THREE.MeshLambertMaterial)if(T){Q.r=ya.r;Q.g=ya.g;Q.b=ya.b;b(ea,ra,Q);O.r=Math.max(0,Math.min(oa.color.r*Q.r,1));O.g=Math.max(0,Math.min(oa.color.g*Q.g,1));O.b=Math.max(0,Math.min(oa.color.b*
  180. Q.b,1));O.updateHex()}else O.hex=oa.color.hex;else if(oa instanceof THREE.MeshDepthMaterial){X=1-oa.__2near/(oa.__farPlusNear-ra.z*oa.__farMinusNear);O.setRGB(X,X,X)}else oa instanceof THREE.MeshNormalMaterial&&O.setRGB(g(ra.normalWorld.x),g(ra.normalWorld.y),g(ra.normalWorld.z));oa.wireframe?ta.setAttribute("style","fill: none; stroke: #"+h(O.hex.toString(16))+"; stroke-width: "+oa.wireframeLinewidth+"; stroke-opacity: "+oa.opacity+"; stroke-linecap: "+oa.wireframeLinecap+"; stroke-linejoin: "+oa.wireframeLinejoin):
  181. ta.setAttribute("style","fill: #"+h(O.hex.toString(16))+"; fill-opacity: "+oa.opacity);o.appendChild(ta)}function c(da,sa,na,ra,oa,ea,Aa){j.data.vertices+=4;j.data.faces++;ta=f(Da++);ta.setAttribute("d","M "+da.positionScreen.x+" "+da.positionScreen.y+" L "+sa.positionScreen.x+" "+sa.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(ea instanceof THREE.MeshBasicMaterial)O.hex=ea.color.hex;else if(ea instanceof THREE.MeshLambertMaterial)if(T){Q.r=
  182. ya.r;Q.g=ya.g;Q.b=ya.b;b(Aa,oa,Q);O.r=Math.max(0,Math.min(ea.color.r*Q.r,1));O.g=Math.max(0,Math.min(ea.color.g*Q.g,1));O.b=Math.max(0,Math.min(ea.color.b*Q.b,1));O.updateHex()}else O.hex=ea.color.hex;else if(ea instanceof THREE.MeshDepthMaterial){X=1-ea.__2near/(ea.__farPlusNear-oa.z*ea.__farMinusNear);O.setRGB(X,X,X)}else ea instanceof THREE.MeshNormalMaterial&&O.setRGB(g(oa.normalWorld.x),g(oa.normalWorld.y),g(oa.normalWorld.z));ea.wireframe?ta.setAttribute("style","fill: none; stroke: #"+h(O.hex.toString(16))+
  183. "; stroke-width: "+ea.wireframeLinewidth+"; stroke-opacity: "+ea.opacity+"; stroke-linecap: "+ea.wireframeLinecap+"; stroke-linejoin: "+ea.wireframeLinejoin):ta.setAttribute("style","fill: #"+h(O.hex.toString(16))+"; fill-opacity: "+ea.opacity);o.appendChild(ta)}function f(da){if(e[da]==null){e[da]=document.createElementNS("http://www.w3.org/2000/svg","path");ua==0&&e[da].setAttribute("shape-rendering","crispEdges")}return e[da]}function g(da){da=(da+1)*0.5;return da<0?0:da>1?1:da}function h(da){for(;da.length<
  184. 6;)da="0"+da;return da}var j=this,k=null,m=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,x,y,t,u,I,H,C,S=new THREE.Rectangle,E=new THREE.Rectangle,T=!1,O=new THREE.Color(16777215),Q=new THREE.Color(16777215),ya=new THREE.Color(0),aa=new THREE.Color(0),ga=new THREE.Color(0),X,ha=new THREE.Vector3,e=[],Ja=[],ta,Da,ca,ua=1;this.domElement=o;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.data={vertices:0,faces:0};this.setQuality=function(da){switch(da){case "high":ua=
  185. 1;break;case "low":ua=0}};this.setSize=function(da,sa){p=da;x=sa;y=p/2;t=x/2;o.setAttribute("viewBox",-y+" "+-t+" "+p+" "+x);o.setAttribute("width",p);o.setAttribute("height",x);S.set(-y,-t,y,t)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=function(da,sa){var na,ra,oa,ea,Aa,Oa,fa,xa;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=m.projectScene(da,sa,this.sortElements);ca=Da=0;if(T=da.lights.length>0){fa=da.lights;ya.setRGB(0,0,0);
  186. aa.setRGB(0,0,0);ga.setRGB(0,0,0);na=0;for(ra=fa.length;na<ra;na++){oa=fa[na];ea=oa.color;if(oa instanceof THREE.AmbientLight){ya.r+=ea.r;ya.g+=ea.g;ya.b+=ea.b}else if(oa instanceof THREE.DirectionalLight){aa.r+=ea.r;aa.g+=ea.g;aa.b+=ea.b}else if(oa instanceof THREE.PointLight){ga.r+=ea.r;ga.g+=ea.g;ga.b+=ea.b}}}na=0;for(ra=k.length;na<ra;na++){fa=k[na];E.empty();if(fa instanceof THREE.RenderableParticle){u=fa;u.x*=y;u.y*=-t;oa=0;for(ea=fa.materials.length;oa<ea;)oa++}else if(fa instanceof THREE.RenderableLine){u=
  187. fa.v1;I=fa.v2;u.positionScreen.x*=y;u.positionScreen.y*=-t;I.positionScreen.x*=y;I.positionScreen.y*=-t;E.addPoint(u.positionScreen.x,u.positionScreen.y);E.addPoint(I.positionScreen.x,I.positionScreen.y);if(S.instersects(E)){oa=0;for(ea=fa.materials.length;oa<ea;)if((xa=fa.materials[oa++])&&xa.opacity!=0){Aa=u;Oa=I;var Ma=ca++;if(Ja[Ma]==null){Ja[Ma]=document.createElementNS("http://www.w3.org/2000/svg","line");ua==0&&Ja[Ma].setAttribute("shape-rendering","crispEdges")}ta=Ja[Ma];ta.setAttribute("x1",
  188. Aa.positionScreen.x);ta.setAttribute("y1",Aa.positionScreen.y);ta.setAttribute("x2",Oa.positionScreen.x);ta.setAttribute("y2",Oa.positionScreen.y);if(xa instanceof THREE.LineBasicMaterial){ta.setAttribute("style","fill: none; stroke: ##"+h(xa.color.hex.toString(16))+"; stroke-width: "+xa.linewidth+"; stroke-opacity: "+xa.opacity+"; stroke-linecap: "+xa.linecap+"; stroke-linejoin: "+xa.linejoin);o.appendChild(ta)}}}}else if(fa instanceof THREE.RenderableFace3){u=fa.v1;I=fa.v2;H=fa.v3;u.positionScreen.x*=
  189. y;u.positionScreen.y*=-t;I.positionScreen.x*=y;I.positionScreen.y*=-t;H.positionScreen.x*=y;H.positionScreen.y*=-t;E.addPoint(u.positionScreen.x,u.positionScreen.y);E.addPoint(I.positionScreen.x,I.positionScreen.y);E.addPoint(H.positionScreen.x,H.positionScreen.y);if(S.instersects(E)){oa=0;for(ea=fa.meshMaterials.length;oa<ea;){xa=fa.meshMaterials[oa++];if(xa instanceof THREE.MeshFaceMaterial){Aa=0;for(Oa=fa.faceMaterials.length;Aa<Oa;)(xa=fa.faceMaterials[Aa++])&&xa.opacity!=0&&d(u,I,H,fa,xa,da)}else xa&&
  190. xa.opacity!=0&&d(u,I,H,fa,xa,da)}}}else if(fa instanceof THREE.RenderableFace4){u=fa.v1;I=fa.v2;H=fa.v3;C=fa.v4;u.positionScreen.x*=y;u.positionScreen.y*=-t;I.positionScreen.x*=y;I.positionScreen.y*=-t;H.positionScreen.x*=y;H.positionScreen.y*=-t;C.positionScreen.x*=y;C.positionScreen.y*=-t;E.addPoint(u.positionScreen.x,u.positionScreen.y);E.addPoint(I.positionScreen.x,I.positionScreen.y);E.addPoint(H.positionScreen.x,H.positionScreen.y);E.addPoint(C.positionScreen.x,C.positionScreen.y);if(S.instersects(E)){oa=
  191. 0;for(ea=fa.meshMaterials.length;oa<ea;){xa=fa.meshMaterials[oa++];if(xa instanceof THREE.MeshFaceMaterial){Aa=0;for(Oa=fa.faceMaterials.length;Aa<Oa;)(xa=fa.faceMaterials[Aa++])&&xa.opacity!=0&&c(u,I,H,C,fa,xa,da)}else xa&&xa.opacity!=0&&c(u,I,H,C,fa,xa,da)}}}}}};
  192. THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
  193. 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",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",
  194. map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",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",
  195. lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",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 ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
  196. 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 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}",
  197. lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ 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( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + vViewPosition );\nfloat pointDistance = vPointLight[ i ].w;\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 * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\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;",
  198. 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",
  199. 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",
  200. default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"};THREE.UniformsUtils={merge:function(b){var d,c,f,g={};for(d=0;d<b.length;d++){f=this.clone(b[d]);for(c in f)g[c]=f[c]}return g},clone:function(b){var d,c,f,g={};for(d in b){g[d]={};for(c in b[d]){f=b[d][c];g[d][c]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return g}};
  201. 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",
  202. value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",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},
  203. fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
  204. THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform int renderType;\nuniform\tsampler2D\tocclusionMap;\nattribute \tvec2 \tposition;\nattribute vec2\tUV;\nvarying\tvec2\tvUV;\nvarying\tfloat\tvVisibility;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ));\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform int renderType;\nvarying\tvec2\t\tvUV;\nvarying\tfloat\t\tvVisibility;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
  205. lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform int renderType;\nattribute \tvec2 \tposition;\nattribute vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
  206. fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform int renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
  207. sprite:{vertexShader:"uniform\tint\t\tuseScreenCoordinates;\nuniform int affectedByDistance;\nuniform\tvec3\tscreenPosition;\nuniform \tmat4 \tmodelViewMatrix;\nuniform \tmat4 \tprojectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform\tvec2 uvScale;\nattribute \tvec2 \tposition;\nattribute vec2\tuv;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
  208. fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}"},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\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\n}"},
  209. 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.0 );\n}"},
  210. 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}},
  211. 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,
  212. 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,
  213. 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:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),
  214. fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",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,
  215. THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",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,
  216. THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.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}}]),
  217. fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",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,
  218. THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),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,
  219. "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,"#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,
  220. THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",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;",
  221. 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")}};
  222. THREE.WebGLRenderer=function(b){function d(n,D,z){var v,A,M,J=n.vertices,G=J.length,U=n.colors,Y=U.length,B=n.__vertexArray,K=n.__colorArray,W=n.__sortArray,ia=n.__dirtyVertices,V=n.__dirtyColors;if(z.sortParticles){fa.multiplySelf(z.matrixWorld);for(v=0;v<G;v++){A=J[v].position;Qa.copy(A);fa.multiplyVector3(Qa);W[v]=[Qa.z,v]}W.sort(function(Ka,Ba){return Ba[0]-Ka[0]});for(v=0;v<G;v++){A=J[W[v][1]].position;M=v*3;B[M]=A.x;B[M+1]=A.y;B[M+2]=A.z}for(v=0;v<Y;v++){M=v*3;color=U[W[v][1]];K[M]=color.r;
  223. K[M+1]=color.g;K[M+2]=color.b}}else{if(ia)for(v=0;v<G;v++){A=J[v].position;M=v*3;B[M]=A.x;B[M+1]=A.y;B[M+2]=A.z}if(V)for(v=0;v<Y;v++){color=U[v];M=v*3;K[M]=color.r;K[M+1]=color.g;K[M+2]=color.b}}if(ia||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,B,D)}if(V||z.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,D)}}function c(n,D,z,v,A){v.program||ha.initMaterial(v,D,z,A);var M=v.program,J=M.uniforms,G=v.uniforms;
  224. if(M!=ta){e.useProgram(M);ta=M}e.uniformMatrix4fv(J.projectionMatrix,!1,xa);if(z&&(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial||v instanceof THREE.LineBasicMaterial||v instanceof THREE.ParticleBasicMaterial||v.fog)){G.fogColor.value=z.color;if(z instanceof THREE.Fog){G.fogNear.value=z.near;G.fogFar.value=z.far}else if(z instanceof THREE.FogExp2)G.fogDensity.value=z.density}if(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||
  225. v.lights){var U,Y,B=0,K=0,W=0,ia,V,Ka,Ba,La=Ua,bb=La.directional.colors,kb=La.directional.positions,Ca=La.point.colors,Ha=La.point.positions,Ea=La.point.distances,Ta=0,F=0;z=Y=Ba=0;for(U=D.length;z<U;z++){Y=D[z];ia=Y.color;V=Y.position;Ka=Y.intensity;Ba=Y.distance;if(Y instanceof THREE.AmbientLight){B+=ia.r;K+=ia.g;W+=ia.b}else if(Y instanceof THREE.DirectionalLight){Ba=Ta*3;bb[Ba]=ia.r*Ka;bb[Ba+1]=ia.g*Ka;bb[Ba+2]=ia.b*Ka;kb[Ba]=V.x;kb[Ba+1]=V.y;kb[Ba+2]=V.z;Ta+=1}else if(Y instanceof THREE.PointLight){Y=
  226. F*3;Ca[Y]=ia.r*Ka;Ca[Y+1]=ia.g*Ka;Ca[Y+2]=ia.b*Ka;Ha[Y]=V.x;Ha[Y+1]=V.y;Ha[Y+2]=V.z;Ea[F]=Ba;F+=1}}for(z=Ta*3;z<bb.length;z++)bb[z]=0;for(z=F*3;z<Ca.length;z++)Ca[z]=0;La.point.length=F;La.directional.length=Ta;La.ambient[0]=B;La.ambient[1]=K;La.ambient[2]=W;z=Ua;G.enableLighting.value=z.directional.length+z.point.length;G.ambientLightColor.value=z.ambient;G.directionalLightColor.value=z.directional.colors;G.directionalLightDirection.value=z.directional.positions;G.pointLightColor.value=z.point.colors;
  227. G.pointLightPosition.value=z.point.positions;G.pointLightDistance.value=z.point.distances}if(v instanceof THREE.MeshBasicMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshPhongMaterial){G.diffuse.value=v.color;G.opacity.value=v.opacity;G.map.texture=v.map;G.lightMap.texture=v.lightMap;G.envMap.texture=v.envMap;G.reflectivity.value=v.reflectivity;G.refractionRatio.value=v.refractionRatio;G.combine.value=v.combine;G.useRefract.value=v.envMap&&v.envMap.mapping instanceof THREE.CubeRefractionMapping}if(v instanceof
  228. THREE.LineBasicMaterial){G.diffuse.value=v.color;G.opacity.value=v.opacity}else if(v instanceof THREE.ParticleBasicMaterial){G.psColor.value=v.color;G.opacity.value=v.opacity;G.size.value=v.size;G.scale.value=L.height/2;G.map.texture=v.map}else if(v instanceof THREE.MeshPhongMaterial){G.ambient.value=v.ambient;G.specular.value=v.specular;G.shininess.value=v.shininess}else if(v instanceof THREE.MeshDepthMaterial){G.mNear.value=n.near;G.mFar.value=n.far;G.opacity.value=v.opacity}else if(v instanceof
  229. THREE.MeshNormalMaterial)G.opacity.value=v.opacity;for(var $ in G)if(K=M.uniforms[$]){U=G[$];B=U.type;z=U.value;if(B=="i")e.uniform1i(K,z);else if(B=="f")e.uniform1f(K,z);else if(B=="fv1")e.uniform1fv(K,z);else if(B=="fv")e.uniform3fv(K,z);else if(B=="v2")e.uniform2f(K,z.x,z.y);else if(B=="v3")e.uniform3f(K,z.x,z.y,z.z);else if(B=="v4")e.uniform4f(K,z.x,z.y,z.z,z.w);else if(B=="c")e.uniform3f(K,z.r,z.g,z.b);else if(B=="t"){e.uniform1i(K,z);if(U=U.texture)if(U.image instanceof Array&&U.image.length==
  230. 6){if(U.image.length==6){if(U.needsUpdate){if(U.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,U.image.__webglTextureCube);for(B=0;B<6;++B)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,0,0,e.RGBA,e.UNSIGNED_BYTE,U.image[B])}else{U.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,U.image.__webglTextureCube);for(B=0;B<6;++B)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+B,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,U.image[B]);U.__webglInit=!0}O(e.TEXTURE_CUBE_MAP,U,U.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,
  231. null);U.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,U.image.__webglTextureCube)}}else Q(U,z)}}e.uniformMatrix4fv(J.modelViewMatrix,!1,A._modelViewMatrixArray);e.uniformMatrix3fv(J.normalMatrix,!1,A._normalMatrixArray);(v instanceof THREE.MeshShaderMaterial||v instanceof THREE.MeshPhongMaterial||v.envMap)&&J.cameraPosition!==null&&e.uniform3f(J.cameraPosition,n.position.x,n.position.y,n.position.z);(v instanceof THREE.MeshShaderMaterial||v.envMap||v.skinning)&&J.objectMatrix!==
  232. null&&e.uniformMatrix4fv(J.objectMatrix,!1,A._objectMatrixArray);(v instanceof THREE.MeshPhongMaterial||v instanceof THREE.MeshLambertMaterial||v instanceof THREE.MeshShaderMaterial||v.skinning)&&J.viewMatrix!==null&&e.uniformMatrix4fv(J.viewMatrix,!1,Ma);if(v instanceof THREE.ShadowVolumeDynamicMaterial){n=G.directionalLightDirection.value;n[0]=-D[1].position.x;n[1]=-D[1].position.y;n[2]=-D[1].position.z;e.uniform3fv(J.directionalLightDirection,n);e.uniformMatrix4fv(J.objectMatrix,!1,A._objectMatrixArray);
  233. e.uniformMatrix4fv(J.viewMatrix,!1,Ma)}if(v.skinning){e.uniformMatrix4fv(J.cameraInverseMatrix,!1,Ma);e.uniformMatrix4fv(J.boneGlobalMatrices,!1,A.boneMatrices)}return M}function f(n,D,z,v,A,M){if(v.opacity!=0){var J;n=c(n,D,z,v,M).attributes;if(!v.morphTargets&&n.position>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(n.position,3,e.FLOAT,!1,0,0)}else{D=v.program.attributes;if(M.morphTargetBase!==-1){e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[M.morphTargetBase]);
  234. e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0)}else if(D.position>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglVertexBuffer);e.vertexAttribPointer(D.position,3,e.FLOAT,!1,0,0)}if(M.morphTargetForcedOrder.length){z=0;for(var G=M.morphTargetForcedOrder,U=M.morphTargetInfluences;z<v.numSupportedMorphTargets&&z<G.length;){e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[G[z]]);e.vertexAttribPointer(D["morphTarget"+z],3,e.FLOAT,!1,0,0);M.__webglMorphTargetInfluences[z]=U[G[z]];z++}}else{G=[];var Y=
  235. -1,B=0;U=M.morphTargetInfluences;var K,W=U.length;z=0;for(M.morphTargetBase!==-1&&(G[M.morphTargetBase]=!0);z<v.numSupportedMorphTargets;){for(K=0;K<W;K++)if(!G[K]&&U[K]>Y){B=K;Y=U[B]}e.bindBuffer(e.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[B]);e.vertexAttribPointer(D["morphTarget"+z],3,e.FLOAT,!1,0,0);M.__webglMorphTargetInfluences[z]=Y;G[B]=1;Y=-1;z++}}v.program.uniforms.morphTargetInfluences!==null&&e.uniform1fv(v.program.uniforms.morphTargetInfluences,M.__webglMorphTargetInfluences)}if(v.attributes)for(J in v.attributes)if(n[J]!==
  236. undefined&&n[J]>=0){D=v.attributes[J];if(D.buffer){e.bindBuffer(e.ARRAY_BUFFER,D.buffer);e.vertexAttribPointer(n[J],D.size,e.FLOAT,!1,0,0)}}if(n.color>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglColorBuffer);e.vertexAttribPointer(n.color,3,e.FLOAT,!1,0,0)}if(n.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglNormalBuffer);e.vertexAttribPointer(n.normal,3,e.FLOAT,!1,0,0)}if(n.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglTangentBuffer);e.vertexAttribPointer(n.tangent,4,e.FLOAT,!1,0,0)}if(n.uv>=0)if(A.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,
  237. A.__webglUVBuffer);e.vertexAttribPointer(n.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv)}else e.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(A.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,A.__webglUV2Buffer);e.vertexAttribPointer(n.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(n.uv2)}else e.disableVertexAttribArray(n.uv2);if(v.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexABuffer);e.vertexAttribPointer(n.skinVertexA,
  238. 4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinVertexBBuffer);e.vertexAttribPointer(n.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinIndicesBuffer);e.vertexAttribPointer(n.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,A.__webglSkinWeightsBuffer);e.vertexAttribPointer(n.skinWeight,4,e.FLOAT,!1,0,0)}if(M instanceof THREE.Mesh){if(v.wireframe){e.lineWidth(v.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);e.drawElements(e.LINES,
  239. A.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);e.drawElements(e.TRIANGLES,A.__webglFaceCount,e.UNSIGNED_SHORT,0)}ha.data.vertices+=A.__webglFaceCount;ha.data.faces+=A.__webglFaceCount/3;ha.data.drawCalls++}else if(M instanceof THREE.Line){M=M.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(v.linewidth);e.drawArrays(M,0,A.__webglLineCount);ha.data.drawCalls++}else if(M instanceof THREE.ParticleSystem){e.drawArrays(e.POINTS,0,A.__webglParticleCount);
  240. ha.data.drawCalls++}else if(M instanceof THREE.Ribbon){e.drawArrays(e.TRIANGLE_STRIP,0,A.__webglVertexCount);ha.data.drawCalls++}}}function g(n,D,z){if(!n.__webglVertexBuffer)n.__webglVertexBuffer=e.createBuffer();if(!n.__webglNormalBuffer)n.__webglNormalBuffer=e.createBuffer();if(n.hasPos){e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,n.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.position);e.vertexAttribPointer(D.attributes.position,3,e.FLOAT,
  241. !1,0,0)}if(n.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,n.__webglNormalBuffer);if(z==THREE.FlatShading){var v,A,M,J,G,U,Y,B,K,W,ia=n.count*3;for(W=0;W<ia;W+=9){z=n.normalArray;v=z[W];A=z[W+1];M=z[W+2];J=z[W+3];U=z[W+4];B=z[W+5];G=z[W+6];Y=z[W+7];K=z[W+8];v=(v+J+G)/3;A=(A+U+Y)/3;M=(M+B+K)/3;z[W]=v;z[W+1]=A;z[W+2]=M;z[W+3]=v;z[W+4]=A;z[W+5]=M;z[W+6]=v;z[W+7]=A;z[W+8]=M}}e.bufferData(e.ARRAY_BUFFER,n.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(D.attributes.normal);e.vertexAttribPointer(D.attributes.normal,
  242. 3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,n.count);n.count=0}function h(n){if(ua!=n.doubleSided){n.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);ua=n.doubleSided}if(da!=n.flipSided){n.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);da=n.flipSided}}function j(n){if(na!=n){n?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);na=n}}function k(n){Oa[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);Oa[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);Oa[2].set(n.n41+n.n21,n.n42+n.n22,
  243. n.n43+n.n23,n.n44+n.n24);Oa[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);Oa[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);Oa[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var D;for(n=0;n<6;n++){D=Oa[n];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function m(n){for(var D=n.matrixWorld,z=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++){n=Oa[v].x*D.n14+Oa[v].y*D.n24+Oa[v].z*D.n34+Oa[v].w;if(n<=z)return!1}return!0}function o(n,
  244. D){n.list[n.count]=D;n.count+=1}function p(n){var D,z,v=n.object,A=n.opaque,M=n.transparent;M.count=0;n=A.count=0;for(D=v.materials.length;n<D;n++){z=v.materials[n];z.transparent?o(M,z):o(A,z)}}function x(n){var D,z,v,A,M=n.object,J=n.buffer,G=n.opaque,U=n.transparent;U.count=0;n=G.count=0;for(v=M.materials.length;n<v;n++){D=M.materials[n];if(D instanceof THREE.MeshFaceMaterial){D=0;for(z=J.materials.length;D<z;D++)(A=J.materials[D])&&(A.transparent?o(U,A):o(G,A))}else(A=D)&&(A.transparent?o(U,A):
  245. o(G,A))}}function y(n,D){return D.z-n.z}function t(n){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(!1);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);var D,z=n.lights.length,v,A=n.lights,M=[],J,G,U,Y,B,K=n.__webglShadowVolumes.length;for(D=0;D<z;D++){v=n.lights[D];if(v instanceof THREE.DirectionalLight&&v.castShadow){M[0]=
  246. -v.position.x;M[1]=-v.position.y;M[2]=-v.position.z;for(B=0;B<K;B++){v=n.__webglShadowVolumes[B].object;J=n.__webglShadowVolumes[B].buffer;G=v.materials[0];G.program||ha.initMaterial(G,A,undefined,v);G=G.program;U=G.uniforms;Y=G.attributes;if(ta!==G){e.useProgram(G);ta=G;e.uniformMatrix4fv(U.projectionMatrix,!1,xa);e.uniformMatrix4fv(U.viewMatrix,!1,Ma);e.uniform3fv(U.directionalLightDirection,M)}v.matrixWorld.flattenToArray(v._objectMatrixArray);e.uniformMatrix4fv(U.objectMatrix,!1,v._objectMatrixArray);
  247. e.bindBuffer(e.ARRAY_BUFFER,J.__webglVertexBuffer);e.vertexAttribPointer(Y.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,J.__webglNormalBuffer);e.vertexAttribPointer(Y.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,J.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,J.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,J.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,
  248. 0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);sa=-1;ta=Ga.program;e.useProgram(Ga.program);e.uniformMatrix4fv(Ga.projectionLocation,!1,xa);e.uniform1f(Ga.darknessLocation,Ga.darkness);e.bindBuffer(e.ARRAY_BUFFER,Ga.vertexBuffer);e.vertexAttribPointer(Ga.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(Ga.vertexLocation);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,Ga.elementBuffer);e.drawElements(e.TRIANGLES,
  249. 6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.depthMask(ca)}function u(n,D){var z,v,A;z=_sprite.attributes;var M=_sprite.uniforms,J=Aa/ea,G,U=[],Y=ea*0.5,B=Aa*0.5,K=!0;e.useProgram(_sprite.program);ta=_sprite.program;sa=-1;if(!lb){e.enableVertexAttribArray(_sprite.attributes.position);e.enableVertexAttribArray(_sprite.attributes.uv);lb=!0}e.disable(e.CULL_FACE);e.enable(e.BLEND);e.depthMask(!0);e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.vertexAttribPointer(z.position,
  250. 2,e.FLOAT,!1,16,0);e.vertexAttribPointer(z.uv,2,e.FLOAT,!1,16,8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.uniformMatrix4fv(M.projectionMatrix,!1,xa);e.activeTexture(e.TEXTURE0);e.uniform1i(M.map,0);z=0;for(v=n.__webglSprites.length;z<v;z++){A=n.__webglSprites[z];if(A.useScreenCoordinates)A.z=-A.position.z;else{A._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,A.matrixWorld,A._modelViewMatrixArray);A.z=-A._modelViewMatrix.n34}}n.__webglSprites.sort(y);z=0;for(v=n.__webglSprites.length;z<
  251. v;z++){A=n.__webglSprites[z];if(A.material===undefined&&A.map&&A.map.image&&A.map.image.width){if(A.useScreenCoordinates){e.uniform1i(M.useScreenCoordinates,1);e.uniform3f(M.screenPosition,(A.position.x-Y)/Y,(B-A.position.y)/B,Math.max(0,Math.min(1,A.position.z)))}else{e.uniform1i(M.useScreenCoordinates,0);e.uniform1i(M.affectedByDistance,A.affectedByDistance?1:0);e.uniformMatrix4fv(M.modelViewMatrix,!1,A._modelViewMatrixArray)}G=A.map.image.width/(A.affectedByDistance?1:Aa);U[0]=G*J*A.scale.x;U[1]=
  252. G*A.scale.y;e.uniform2f(M.uvScale,A.uvScale.x,A.uvScale.y);e.uniform2f(M.uvOffset,A.uvOffset.x,A.uvOffset.y);e.uniform2f(M.alignment,A.alignment.x,A.alignment.y);e.uniform1f(M.opacity,A.opacity);e.uniform1f(M.rotation,A.rotation);e.uniform2fv(M.scale,U);if(A.mergeWith3D&&!K){e.enable(e.DEPTH_TEST);K=!0}else if(!A.mergeWith3D&&K){e.disable(e.DEPTH_TEST);K=!1}T(A.blending);Q(A.map,0);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ca)}function I(n,
  253. D){var z,v,A=n.__webglLensFlares.length,M,J,G,U=new THREE.Vector3,Y=Aa/ea,B=ea*0.5,K=Aa*0.5,W=16/Aa,ia=[W*Y,W],V=[1,1,0],Ka=[1,1],Ba=ka.uniforms;z=ka.attributes;e.useProgram(ka.program);ta=ka.program;sa=-1;if(!ub){e.enableVertexAttribArray(ka.attributes.vertex);e.enableVertexAttribArray(ka.attributes.uv);ub=!0}e.uniform1i(Ba.occlusionMap,0);e.uniform1i(Ba.map,1);e.bindBuffer(e.ARRAY_BUFFER,ka.vertexBuffer);e.vertexAttribPointer(z.vertex,2,e.FLOAT,!1,16,0);e.vertexAttribPointer(z.uv,2,e.FLOAT,!1,16,
  254. 8);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ka.elementBuffer);e.disable(e.CULL_FACE);e.depthMask(!1);e.activeTexture(e.TEXTURE0);e.bindTexture(e.TEXTURE_2D,ka.occlusionTexture);e.activeTexture(e.TEXTURE1);for(v=0;v<A;v++){z=n.__webglLensFlares[v].object;U.set(z.matrixWorld.n14,z.matrixWorld.n24,z.matrixWorld.n34);D.matrixWorldInverse.multiplyVector3(U);D.projectionMatrix.multiplyVector3(U);V[0]=U.x;V[1]=U.y;V[2]=U.z;Ka[0]=V[0]*B+B;Ka[1]=V[1]*K+K;if(ka.hasVertexTexture||Ka[0]>0&&Ka[0]<ea&&Ka[1]>0&&Ka[1]<
  255. Aa){e.bindTexture(e.TEXTURE_2D,ka.tempTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGB,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ba.renderType,0);e.uniform2fv(Ba.scale,ia);e.uniform3fv(Ba.screenPosition,V);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.bindTexture(e.TEXTURE_2D,ka.occlusionTexture);e.copyTexImage2D(e.TEXTURE_2D,0,e.RGBA,Ka[0]-8,Ka[1]-8,16,16,0);e.uniform1i(Ba.renderType,1);e.disable(e.DEPTH_TEST);e.bindTexture(e.TEXTURE_2D,ka.tempTexture);e.drawElements(e.TRIANGLES,
  256. 6,e.UNSIGNED_SHORT,0);z.positionScreen.x=V[0];z.positionScreen.y=V[1];z.positionScreen.z=V[2];z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();e.uniform1i(Ba.renderType,2);e.enable(e.BLEND);M=0;for(J=z.lensFlares.length;M<J;M++){G=z.lensFlares[M];if(G.opacity>0.001&&G.scale>0.001){V[0]=G.x;V[1]=G.y;V[2]=G.z;W=G.size*G.scale/Aa;ia[0]=W*Y;ia[1]=W;e.uniform3fv(Ba.screenPosition,V);e.uniform2fv(Ba.scale,ia);e.uniform1f(Ba.rotation,G.rotation);e.uniform1f(Ba.opacity,G.opacity);T(G.blending);
  257. Q(G.texture,1);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0)}}}}e.enable(e.CULL_FACE);e.enable(e.DEPTH_TEST);e.depthMask(ca)}function H(n,D){n._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}function C(n){var D,z,v,A,M;if(n instanceof THREE.Mesh){z=n.geometry;for(D in z.geometryGroups){v=z.geometryGroups[D];M=!1;for(A in v.__webglCustomAttributes)if(v.__webglCustomAttributes[A].needsUpdate){M=
  258. !0;break}if(z.__dirtyVertices||z.__dirtyMorphTargets||z.__dirtyElements||z.__dirtyUvs||z.__dirtyNormals||z.__dirtyColors||z.__dirtyTangents||M){M=n;var J=e.DYNAMIC_DRAW;if(v.__inittedArrays){var G=void 0,U=void 0,Y=void 0,B=void 0;Y=void 0;var K=void 0,W=void 0,ia=void 0,V=void 0,Ka=void 0,Ba=void 0,La=void 0,bb=void 0,kb=void 0,Ca=void 0,Ha=void 0,Ea=void 0,Ta=void 0;W=void 0;ia=void 0;B=void 0;V=void 0;B=void 0;var F=void 0,$=void 0;W=void 0;F=void 0;$=void 0;var w=void 0,cb=void 0;F=void 0;$=void 0;
  259. w=void 0;cb=void 0;F=void 0;$=void 0;w=void 0;cb=void 0;F=void 0;$=void 0;w=void 0;B=void 0;V=void 0;K=void 0;Y=void 0;Y=void 0;F=void 0;$=void 0;w=void 0;var gb=void 0,Va=0,Wa=0,jb=0,mb=0,Fa=0,Xa=0,Sa=0,ab=0,Ya=0,P=0,R=0;$=F=0;var pa=v.__vertexArray,va=v.__uvArray,qa=v.__uv2Array,Ia=v.__normalArray,wa=v.__tangentArray,ma=v.__colorArray,N=v.__skinVertexAArray,za=v.__skinVertexBArray,Ra=v.__skinIndexArray,Pa=v.__skinWeightArray,ib=v.__morphTargetsArrays,eb=v.__webglCustomAttributes;w=void 0;var Za=
  260. v.__faceArray,$a=v.__lineArray,Bb=v.__needsSmoothNormals;Ba=v.__vertexColorType;Ka=v.__uvType;La=v.__normalType;var db=M.geometry,vb=db.__dirtyVertices,wb=db.__dirtyElements,tb=db.__dirtyUvs,xb=db.__dirtyNormals,yb=db.__dirtyTangents,zb=db.__dirtyColors,Ab=db.__dirtyMorphTargets,pb=db.vertices,Cb=v.faces,Fb=db.faces,Db=db.faceVertexUvs[0],Eb=db.faceVertexUvs[1],qb=db.skinVerticesA,rb=db.skinVerticesB,sb=db.skinIndices,nb=db.skinWeights,ob=M instanceof THREE.ShadowVolume?db.edgeFaces:undefined;morphTargets=
  261. db.morphTargets;if(eb)for(gb in eb){eb[gb].offset=0;eb[gb].offsetSrc=0}G=0;for(U=Cb.length;G<U;G++){Y=Cb[G];B=Fb[Y];Db&&(bb=Db[Y]);Eb&&(kb=Eb[Y]);Y=B.vertexNormals;K=B.normal;W=B.vertexColors;ia=B.color;V=B.vertexTangents;if(B instanceof THREE.Face3){if(vb){Ca=pb[B.a].position;Ha=pb[B.b].position;Ea=pb[B.c].position;pa[Wa]=Ca.x;pa[Wa+1]=Ca.y;pa[Wa+2]=Ca.z;pa[Wa+3]=Ha.x;pa[Wa+4]=Ha.y;pa[Wa+5]=Ha.z;pa[Wa+6]=Ea.x;pa[Wa+7]=Ea.y;pa[Wa+8]=Ea.z;Wa+=9}if(eb)for(gb in eb){w=eb[gb];if(w.needsUpdate){F=w.offset;
  262. $=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||w.boundTo==="vertices"){w.array[F+0]=w.value[B.a];w.array[F+1]=w.value[B.b];w.array[F+2]=w.value[B.c]}else if(w.boundTo==="faces"){w.array[F+0]=w.value[$];w.array[F+1]=w.value[$];w.array[F+2]=w.value[$];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[F+0]=w.value[$+0];w.array[F+1]=w.value[$+1];w.array[F+2]=w.value[$+2];w.offsetSrc+=3}w.offset+=3}else{if(w.boundTo===undefined||w.boundTo==="vertices"){Ca=w.value[B.a];Ha=w.value[B.b];Ea=
  263. w.value[B.c]}else if(w.boundTo==="faces"){Ca=w.value[$];Ha=w.value[$];Ea=w.value[$];w.offsetSrc++}else if(w.boundTo==="faceVertices"){Ca=w.value[$+0];Ha=w.value[$+1];Ea=w.value[$+2];w.offsetSrc+=3}if(w.size===2){w.array[F+0]=Ca.x;w.array[F+1]=Ca.y;w.array[F+2]=Ha.x;w.array[F+3]=Ha.y;w.array[F+4]=Ea.x;w.array[F+5]=Ea.y;w.offset+=6}else if(w.size===3){if(w.type==="c"){w.array[F+0]=Ca.r;w.array[F+1]=Ca.g;w.array[F+2]=Ca.b;w.array[F+3]=Ha.r;w.array[F+4]=Ha.g;w.array[F+5]=Ha.b;w.array[F+6]=Ea.r;w.array[F+
  264. 7]=Ea.g;w.array[F+8]=Ea.b}else{w.array[F+0]=Ca.x;w.array[F+1]=Ca.y;w.array[F+2]=Ca.z;w.array[F+3]=Ha.x;w.array[F+4]=Ha.y;w.array[F+5]=Ha.z;w.array[F+6]=Ea.x;w.array[F+7]=Ea.y;w.array[F+8]=Ea.z}w.offset+=9}else{w.array[F+0]=Ca.x;w.array[F+1]=Ca.y;w.array[F+2]=Ca.z;w.array[F+3]=Ca.w;w.array[F+4]=Ha.x;w.array[F+5]=Ha.y;w.array[F+6]=Ha.z;w.array[F+7]=Ha.w;w.array[F+8]=Ea.x;w.array[F+9]=Ea.y;w.array[F+10]=Ea.z;w.array[F+11]=Ea.w;w.offset+=12}}}}if(Ab){F=0;for($=morphTargets.length;F<$;F++){Ca=morphTargets[F].vertices[B.a].position;
  265. Ha=morphTargets[F].vertices[B.b].position;Ea=morphTargets[F].vertices[B.c].position;w=ib[F];w[R+0]=Ca.x;w[R+1]=Ca.y;w[R+2]=Ca.z;w[R+3]=Ha.x;w[R+4]=Ha.y;w[R+5]=Ha.z;w[R+6]=Ea.x;w[R+7]=Ea.y;w[R+8]=Ea.z}R+=9}if(nb.length){F=nb[B.a];$=nb[B.b];w=nb[B.c];Pa[P]=F.x;Pa[P+1]=F.y;Pa[P+2]=F.z;Pa[P+3]=F.w;Pa[P+4]=$.x;Pa[P+5]=$.y;Pa[P+6]=$.z;Pa[P+7]=$.w;Pa[P+8]=w.x;Pa[P+9]=w.y;Pa[P+10]=w.z;Pa[P+11]=w.w;F=sb[B.a];$=sb[B.b];w=sb[B.c];Ra[P]=F.x;Ra[P+1]=F.y;Ra[P+2]=F.z;Ra[P+3]=F.w;Ra[P+4]=$.x;Ra[P+5]=$.y;Ra[P+6]=
  266. $.z;Ra[P+7]=$.w;Ra[P+8]=w.x;Ra[P+9]=w.y;Ra[P+10]=w.z;Ra[P+11]=w.w;F=qb[B.a];$=qb[B.b];w=qb[B.c];N[P]=F.x;N[P+1]=F.y;N[P+2]=F.z;N[P+3]=1;N[P+4]=$.x;N[P+5]=$.y;N[P+6]=$.z;N[P+7]=1;N[P+8]=w.x;N[P+9]=w.y;N[P+10]=w.z;N[P+11]=1;F=rb[B.a];$=rb[B.b];w=rb[B.c];za[P]=F.x;za[P+1]=F.y;za[P+2]=F.z;za[P+3]=1;za[P+4]=$.x;za[P+5]=$.y;za[P+6]=$.z;za[P+7]=1;za[P+8]=w.x;za[P+9]=w.y;za[P+10]=w.z;za[P+11]=1;P+=12}if(zb&&Ba){if(W.length==3&&Ba==THREE.VertexColors){B=W[0];F=W[1];$=W[2]}else $=F=B=ia;ma[Ya]=B.r;ma[Ya+1]=
  267. B.g;ma[Ya+2]=B.b;ma[Ya+3]=F.r;ma[Ya+4]=F.g;ma[Ya+5]=F.b;ma[Ya+6]=$.r;ma[Ya+7]=$.g;ma[Ya+8]=$.b;Ya+=9}if(yb&&db.hasTangents){W=V[0];ia=V[1];B=V[2];wa[Sa]=W.x;wa[Sa+1]=W.y;wa[Sa+2]=W.z;wa[Sa+3]=W.w;wa[Sa+4]=ia.x;wa[Sa+5]=ia.y;wa[Sa+6]=ia.z;wa[Sa+7]=ia.w;wa[Sa+8]=B.x;wa[Sa+9]=B.y;wa[Sa+10]=B.z;wa[Sa+11]=B.w;Sa+=12}if(xb&&La)if(Y.length==3&&Bb)for(V=0;V<3;V++){K=Y[V];Ia[Xa]=K.x;Ia[Xa+1]=K.y;Ia[Xa+2]=K.z;Xa+=3}else for(V=0;V<3;V++){Ia[Xa]=K.x;Ia[Xa+1]=K.y;Ia[Xa+2]=K.z;Xa+=3}if(tb&&bb!==undefined&&Ka)for(V=
  268. 0;V<3;V++){Y=bb[V];va[jb]=Y.u;va[jb+1]=Y.v;jb+=2}if(tb&&kb!==undefined&&Ka)for(V=0;V<3;V++){Y=kb[V];qa[mb]=Y.u;qa[mb+1]=Y.v;mb+=2}if(wb){Za[Fa]=Va;Za[Fa+1]=Va+1;Za[Fa+2]=Va+2;Fa+=3;$a[ab]=Va;$a[ab+1]=Va+1;$a[ab+2]=Va;$a[ab+3]=Va+2;$a[ab+4]=Va+1;$a[ab+5]=Va+2;ab+=6;Va+=3}}else if(B instanceof THREE.Face4){if(vb){Ca=pb[B.a].position;Ha=pb[B.b].position;Ea=pb[B.c].position;Ta=pb[B.d].position;pa[Wa]=Ca.x;pa[Wa+1]=Ca.y;pa[Wa+2]=Ca.z;pa[Wa+3]=Ha.x;pa[Wa+4]=Ha.y;pa[Wa+5]=Ha.z;pa[Wa+6]=Ea.x;pa[Wa+7]=Ea.y;
  269. pa[Wa+8]=Ea.z;pa[Wa+9]=Ta.x;pa[Wa+10]=Ta.y;pa[Wa+11]=Ta.z;Wa+=12}if(eb)for(gb in eb){w=eb[gb];if(w.needsUpdate){F=w.offset;$=w.offsetSrc;if(w.size===1){if(w.boundTo===undefined||w.boundTo==="vertices"){w.array[F+0]=w.value[B.a];w.array[F+1]=w.value[B.b];w.array[F+2]=w.value[B.c];w.array[F+3]=w.value[B.d]}else if(w.boundTo==="faces"){w.array[F+0]=w.value[$];w.array[F+1]=w.value[$];w.array[F+2]=w.value[$];w.array[F+3]=w.value[$];w.offsetSrc++}else if(w.boundTo==="faceVertices"){w.array[F+0]=w.value[$+
  270. 0];w.array[F+1]=w.value[$+1];w.array[F+2]=w.value[$+2];w.array[F+3]=w.value[$+3];w.offsetSrc+=4}w.offset+=4}else{if(w.boundTo===undefined||w.boundTo==="vertices"){Ca=w.value[B.a];Ha=w.value[B.b];Ea=w.value[B.c];Ta=w.value[B.d]}else if(w.boundTo==="faces"){Ca=w.value[$];Ha=w.value[$];Ea=w.value[$];Ta=w.value[$];w.offsetSrc++}else if(w.boundTo==="faceVertices"){Ca=w.value[$+0];Ha=w.value[$+1];Ea=w.value[$+2];Ta=w.value[$+3];w.offsetSrc+=4}if(w.size===2){w.array[F+0]=Ca.x;w.array[F+1]=Ca.y;w.array[F+
  271. 2]=Ha.x;w.array[F+3]=Ha.y;w.array[F+4]=Ea.x;w.array[F+5]=Ea.y;w.array[F+6]=Ta.x;w.array[F+7]=Ta.y;w.offset+=8}else if(w.size===3){if(w.type==="c"){w.array[F+0]=Ca.r;w.array[F+1]=Ca.g;w.array[F+2]=Ca.b;w.array[F+3]=Ha.r;w.array[F+4]=Ha.g;w.array[F+5]=Ha.b;w.array[F+6]=Ea.r;w.array[F+7]=Ea.g;w.array[F+8]=Ea.b;w.array[F+9]=Ta.r;w.array[F+10]=Ta.g;w.array[F+11]=Ta.b}else{w.array[F+0]=Ca.x;w.array[F+1]=Ca.y;w.array[F+2]=Ca.z;w.array[F+3]=Ha.x;w.array[F+4]=Ha.y;w.array[F+5]=Ha.z;w.array[F+6]=Ea.x;w.array[F+
  272. 7]=Ea.y;w.array[F+8]=Ea.z;w.array[F+9]=Ta.x;w.array[F+10]=Ta.y;w.array[F+11]=Ta.z}w.offset+=12}else{w.array[F+0]=Ca.x;w.array[F+1]=Ca.y;w.array[F+2]=Ca.z;w.array[F+3]=Ca.w;w.array[F+4]=Ha.x;w.array[F+5]=Ha.y;w.array[F+6]=Ha.z;w.array[F+7]=Ha.w;w.array[F+8]=Ea.x;w.array[F+9]=Ea.y;w.array[F+10]=Ea.z;w.array[F+11]=Ea.w;w.array[F+12]=Ta.x;w.array[F+13]=Ta.y;w.array[F+14]=Ta.z;w.array[F+15]=Ta.w;w.offset+=16}}}}if(Ab){F=0;for($=morphTargets.length;F<$;F++){Ca=morphTargets[F].vertices[B.a].position;Ha=
  273. morphTargets[F].vertices[B.b].position;Ea=morphTargets[F].vertices[B.c].position;Ta=morphTargets[F].vertices[B.d].position;w=ib[F];w[R+0]=Ca.x;w[R+1]=Ca.y;w[R+2]=Ca.z;w[R+3]=Ha.x;w[R+4]=Ha.y;w[R+5]=Ha.z;w[R+6]=Ea.x;w[R+7]=Ea.y;w[R+8]=Ea.z;w[R+9]=Ta.x;w[R+10]=Ta.y;w[R+11]=Ta.z}R+=12}if(nb.length){F=nb[B.a];$=nb[B.b];w=nb[B.c];cb=nb[B.d];Pa[P]=F.x;Pa[P+1]=F.y;Pa[P+2]=F.z;Pa[P+3]=F.w;Pa[P+4]=$.x;Pa[P+5]=$.y;Pa[P+6]=$.z;Pa[P+7]=$.w;Pa[P+8]=w.x;Pa[P+9]=w.y;Pa[P+10]=w.z;Pa[P+11]=w.w;Pa[P+12]=cb.x;Pa[P+
  274. 13]=cb.y;Pa[P+14]=cb.z;Pa[P+15]=cb.w;F=sb[B.a];$=sb[B.b];w=sb[B.c];cb=sb[B.d];Ra[P]=F.x;Ra[P+1]=F.y;Ra[P+2]=F.z;Ra[P+3]=F.w;Ra[P+4]=$.x;Ra[P+5]=$.y;Ra[P+6]=$.z;Ra[P+7]=$.w;Ra[P+8]=w.x;Ra[P+9]=w.y;Ra[P+10]=w.z;Ra[P+11]=w.w;Ra[P+12]=cb.x;Ra[P+13]=cb.y;Ra[P+14]=cb.z;Ra[P+15]=cb.w;F=qb[B.a];$=qb[B.b];w=qb[B.c];cb=qb[B.d];N[P]=F.x;N[P+1]=F.y;N[P+2]=F.z;N[P+3]=1;N[P+4]=$.x;N[P+5]=$.y;N[P+6]=$.z;N[P+7]=1;N[P+8]=w.x;N[P+9]=w.y;N[P+10]=w.z;N[P+11]=1;N[P+12]=cb.x;N[P+13]=cb.y;N[P+14]=cb.z;N[P+15]=1;F=rb[B.a];
  275. $=rb[B.b];w=rb[B.c];B=rb[B.d];za[P]=F.x;za[P+1]=F.y;za[P+2]=F.z;za[P+3]=1;za[P+4]=$.x;za[P+5]=$.y;za[P+6]=$.z;za[P+7]=1;za[P+8]=w.x;za[P+9]=w.y;za[P+10]=w.z;za[P+11]=1;za[P+12]=B.x;za[P+13]=B.y;za[P+14]=B.z;za[P+15]=1;P+=16}if(zb&&Ba){if(W.length==4&&Ba==THREE.VertexColors){B=W[0];F=W[1];$=W[2];W=W[3]}else W=$=F=B=ia;ma[Ya]=B.r;ma[Ya+1]=B.g;ma[Ya+2]=B.b;ma[Ya+3]=F.r;ma[Ya+4]=F.g;ma[Ya+5]=F.b;ma[Ya+6]=$.r;ma[Ya+7]=$.g;ma[Ya+8]=$.b;ma[Ya+9]=W.r;ma[Ya+10]=W.g;ma[Ya+11]=W.b;Ya+=12}if(yb&&db.hasTangents){W=
  276. V[0];ia=V[1];B=V[2];V=V[3];wa[Sa]=W.x;wa[Sa+1]=W.y;wa[Sa+2]=W.z;wa[Sa+3]=W.w;wa[Sa+4]=ia.x;wa[Sa+5]=ia.y;wa[Sa+6]=ia.z;wa[Sa+7]=ia.w;wa[Sa+8]=B.x;wa[Sa+9]=B.y;wa[Sa+10]=B.z;wa[Sa+11]=B.w;wa[Sa+12]=V.x;wa[Sa+13]=V.y;wa[Sa+14]=V.z;wa[Sa+15]=V.w;Sa+=16}if(xb&&La)if(Y.length==4&&Bb)for(V=0;V<4;V++){K=Y[V];Ia[Xa]=K.x;Ia[Xa+1]=K.y;Ia[Xa+2]=K.z;Xa+=3}else for(V=0;V<4;V++){Ia[Xa]=K.x;Ia[Xa+1]=K.y;Ia[Xa+2]=K.z;Xa+=3}if(tb&&bb!==undefined&&Ka)for(V=0;V<4;V++){Y=bb[V];va[jb]=Y.u;va[jb+1]=Y.v;jb+=2}if(tb&&kb!==
  277. undefined&&Ka)for(V=0;V<4;V++){Y=kb[V];qa[mb]=Y.u;qa[mb+1]=Y.v;mb+=2}if(wb){Za[Fa]=Va;Za[Fa+1]=Va+1;Za[Fa+2]=Va+3;Za[Fa+3]=Va+1;Za[Fa+4]=Va+2;Za[Fa+5]=Va+3;Fa+=6;$a[ab]=Va;$a[ab+1]=Va+1;$a[ab+2]=Va;$a[ab+3]=Va+3;$a[ab+4]=Va+1;$a[ab+5]=Va+2;$a[ab+6]=Va+2;$a[ab+7]=Va+3;ab+=8;Va+=4}}}if(ob){G=0;for(U=ob.length;G<U;G++){Za[Fa]=ob[G].a;Za[Fa+1]=ob[G].b;Za[Fa+2]=ob[G].c;Za[Fa+3]=ob[G].a;Za[Fa+4]=ob[G].c;Za[Fa+5]=ob[G].d;Fa+=6}}if(vb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
  278. pa,J)}if(eb)for(gb in eb){w=eb[gb];if(w.needsUpdate){e.bindBuffer(e.ARRAY_BUFFER,w.buffer);e.bufferData(e.ARRAY_BUFFER,w.array,J);w.needsUpdate=!1}}if(Ab){F=0;for($=morphTargets.length;F<$;F++){e.bindBuffer(e.ARRAY_BUFFER,v.__webglMorphTargetsBuffers[F]);e.bufferData(e.ARRAY_BUFFER,ib[F],J)}}if(zb&&Ya>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ma,J)}if(xb){e.bindBuffer(e.ARRAY_BUFFER,v.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,J)}if(yb&&db.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
  279. v.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,wa,J)}if(tb&&jb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,va,J)}if(tb&&mb>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,qa,J)}if(wb){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Za,J);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,v.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,$a,J)}if(P>0){e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexABuffer);
  280. e.bufferData(e.ARRAY_BUFFER,N,J);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,za,J);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,J);e.bindBuffer(e.ARRAY_BUFFER,v.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,J)}if(!M.dynamic){delete v.__inittedArrays;delete v.__colorArray;delete v.__normalArray;delete v.__tangentArray;delete v.__uvArray;delete v.__uv2Array;delete v.__faceArray;delete v.__vertexArray;delete v.__lineArray;
  281. delete v.__skinVertexAArray;delete v.__skinVertexBArray;delete v.__skinIndexArray;delete v.__skinWeightArray}}}}z.__dirtyVertices=!1;z.__dirtyMorphTargets=!1;z.__dirtyElements=!1;z.__dirtyUvs=!1;z.__dirtyNormals=!1;z.__dirtyTangents=!1;z.__dirtyColors=!1}else if(n instanceof THREE.Ribbon){z=n.geometry;if(z.__dirtyVertices||z.__dirtyColors){n=z;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ba=Ka.length;M=v.length;La=n.__vertexArray;J=n.__colorArray;bb=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ba;G++){U=
  282. Ka[G].position;A=G*3;La[A]=U.x;La[A+1]=U.y;La[A+2]=U.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,La,D)}if(bb){for(G=0;G<M;G++){color=v[G];A=G*3;J[A]=color.r;J[A+1]=color.g;J[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,J,D)}}z.__dirtyVertices=!1;z.__dirtyColors=!1}else if(n instanceof THREE.Line){z=n.geometry;if(z.__dirtyVertices||z.__dirtyColors){n=z;D=e.DYNAMIC_DRAW;Ka=n.vertices;v=n.colors;Ba=Ka.length;M=v.length;
  283. La=n.__vertexArray;J=n.__colorArray;bb=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<Ba;G++){U=Ka[G].position;A=G*3;La[A]=U.x;La[A+1]=U.y;La[A+2]=U.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,La,D)}if(bb){for(G=0;G<M;G++){color=v[G];A=G*3;J[A]=color.r;J[A+1]=color.g;J[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,J,D)}}z.__dirtyVertices=!1;z.__dirtyColors=!1}else if(n instanceof THREE.ParticleSystem){z=n.geometry;
  284. (z.__dirtyVertices||z.__dirtyColors||n.sortParticles)&&d(z,e.DYNAMIC_DRAW,n);z.__dirtyVertices=!1;z.__dirtyColors=!1}}function S(n){function D(W){var ia=[];z=0;for(v=W.length;z<v;z++)W[z]==undefined?ia.push("undefined"):ia.push(W[z].id);return ia.join("_")}var z,v,A,M,J,G,U,Y,B={},K=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};A=0;for(M=n.faces.length;A<M;A++){J=n.faces[A];G=J.materials;U=D(G);B[U]==undefined&&(B[U]={hash:U,counter:0});Y=B[U].hash+"_"+B[U].counter;n.geometryGroups[Y]==
  285. undefined&&(n.geometryGroups[Y]={faces:[],materials:G,vertices:0,numMorphTargets:K});J=J instanceof THREE.Face3?3:4;if(n.geometryGroups[Y].vertices+J>65535){B[U].counter+=1;Y=B[U].hash+"_"+B[U].counter;n.geometryGroups[Y]==undefined&&(n.geometryGroups[Y]={faces:[],materials:G,vertices:0,numMorphTargets:K})}n.geometryGroups[Y].faces.push(A);n.geometryGroups[Y].vertices+=J}}function E(n,D,z){n.push({buffer:D,object:z,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function T(n){if(n!=sa){switch(n){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);
  286. e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}sa=n}}function O(n,D,z){if((z.width&z.width-1)==0&&(z.height&z.height-1)==0){e.texParameteri(n,e.TEXTURE_WRAP_S,X(D.wrapS));e.texParameteri(n,
  287. e.TEXTURE_WRAP_T,X(D.wrapT));e.texParameteri(n,e.TEXTURE_MAG_FILTER,X(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,X(D.minFilter));e.generateMipmap(n)}else{e.texParameteri(n,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(n,e.TEXTURE_MAG_FILTER,ga(D.magFilter));e.texParameteri(n,e.TEXTURE_MIN_FILTER,ga(D.minFilter))}}function Q(n,D){if(n.needsUpdate){if(n.__webglTexture)n.__webglTexture=e.deleteTexture(n.__webglTexture);n.__webglTexture=
  288. e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n.image);O(e.TEXTURE_2D,n,n.image);e.bindTexture(e.TEXTURE_2D,null);n.needsUpdate=!1}e.activeTexture(e.TEXTURE0+D);e.bindTexture(e.TEXTURE_2D,n.__webglTexture)}function ya(n){if(n&&!n.__webglFramebuffer){if(n.depthBuffer===undefined)n.depthBuffer=!0;if(n.stencilBuffer===undefined)n.stencilBuffer=!0;n.__webglFramebuffer=e.createFramebuffer();n.__webglRenderbuffer=e.createRenderbuffer();
  289. n.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,n.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,X(n.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,X(n.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,X(n.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,X(n.minFilter));e.texImage2D(e.TEXTURE_2D,0,X(n.format),n.width,n.height,0,X(n.format),X(n.type),null);e.bindRenderbuffer(e.RENDERBUFFER,n.__webglRenderbuffer);e.bindFramebuffer(e.FRAMEBUFFER,
  290. n.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.__webglTexture,0);if(n.depthBuffer&&!n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,n.__webglRenderbuffer)}else if(n.depthBuffer&&n.stencilBuffer){e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,n.width,n.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,
  291. n.__webglRenderbuffer)}else e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,n.width,n.height);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var D,z;if(n){D=n.__webglFramebuffer;z=n.width;n=n.height}else{D=null;z=ea;n=Aa}if(D!=Da){e.bindFramebuffer(e.FRAMEBUFFER,D);e.viewport(ra,oa,z,n);Da=D}}function aa(n,D){var z;if(n=="fragment")z=e.createShader(e.FRAGMENT_SHADER);else n=="vertex"&&(z=e.createShader(e.VERTEX_SHADER));e.shaderSource(z,
  292. D);e.compileShader(z);if(!e.getShaderParameter(z,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(z));console.error(D);return null}return z}function ga(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;default:return e.LINEAR}}function X(n){switch(n){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;
  293. 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;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;
  294. 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 ha=this,e,Ja=[],ta=null,Da=null,ca=!0,ua=null,da=null,sa=null,na=null,ra=0,oa=0,ea=0,Aa=0,Oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
  295. fa=new THREE.Matrix4,xa=new Float32Array(16),Ma=new Float32Array(16),Qa=new THREE.Vector4,Ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};var L=b.canvas!==undefined?b.canvas:document.createElement("canvas"),Z=b.stencil!==undefined?b.stencil:!0,ja=b.antialias!==undefined?b.antialias:!1,la=b.clearColor!==undefined?new THREE.Color(b.clearColor):new THREE.Color(0),Na=b.clearAlpha!==undefined?b.clearAlpha:0;this.data={vertices:0,
  296. faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=L;this.autoClear=!0;this.sortObjects=!0;try{if(!(e=L.getContext("experimental-webgl",{antialias:ja,stencil:Z})))throw"Error creating WebGL context.";}catch(fb){console.error(fb)}console.log(navigator.userAgent+" | "+e.getParameter(e.VERSION)+" | "+e.getParameter(e.VENDOR)+" | "+e.getParameter(e.RENDERER)+" | "+e.getParameter(e.SHADING_LANGUAGE_VERSION));e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);
  297. e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(la.r,la.g,la.b,Na);this.context=e;var hb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Z){var Ga={};Ga.vertices=new Float32Array(12);Ga.faces=new Uint16Array(6);Ga.darkness=0.5;Ga.vertices[0]=-20;Ga.vertices[1]=-20;Ga.vertices[2]=-1;Ga.vertices[3]=20;Ga.vertices[4]=-20;Ga.vertices[5]=-1;Ga.vertices[6]=20;Ga.vertices[7]=20;Ga.vertices[8]=-1;Ga.vertices[9]=
  298. -20;Ga.vertices[10]=20;Ga.vertices[11]=-1;Ga.faces[0]=0;Ga.faces[1]=1;Ga.faces[2]=2;Ga.faces[3]=0;Ga.faces[4]=2;Ga.faces[5]=3;Ga.vertexBuffer=e.createBuffer();Ga.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,Ga.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ga.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,Ga.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ga.faces,e.STATIC_DRAW);Ga.program=e.createProgram();e.attachShader(Ga.program,aa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));
  299. e.attachShader(Ga.program,aa("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(Ga.program);Ga.vertexLocation=e.getAttribLocation(Ga.program,"position");Ga.projectionLocation=e.getUniformLocation(Ga.program,"projectionMatrix");Ga.darknessLocation=e.getUniformLocation(Ga.program,"darkness")}var ka={};ka.vertices=new Float32Array(16);ka.faces=new Uint16Array(6);b=0;ka.vertices[b++]=-1;ka.vertices[b++]=-1;ka.vertices[b++]=0;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=
  300. 1;ka.vertices[b++]=0;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=1;ka.vertices[b++]=-1;ka.vertices[b++]=1;ka.vertices[b++]=0;ka.vertices[b++]=1;b=0;ka.faces[b++]=0;ka.faces[b++]=1;ka.faces[b++]=2;ka.faces[b++]=0;ka.faces[b++]=2;ka.faces[b++]=3;ka.vertexBuffer=e.createBuffer();ka.elementBuffer=e.createBuffer();ka.tempTexture=e.createTexture();ka.occlusionTexture=e.createTexture();e.bindBuffer(e.ARRAY_BUFFER,ka.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,ka.vertices,e.STATIC_DRAW);
  301. e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,ka.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ka.faces,e.STATIC_DRAW);e.bindTexture(e.TEXTURE_2D,ka.tempTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGB,16,16,0,e.RGB,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);e.bindTexture(e.TEXTURE_2D,
  302. ka.occlusionTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,16,16,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST);if(e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0){ka.hasVertexTexture=!1;ka.program=e.createProgram();e.attachShader(ka.program,aa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));
  303. e.attachShader(ka.program,aa("vertex",THREE.ShaderLib.lensFlare.vertexShader))}else{ka.hasVertexTexture=!0;ka.program=e.createProgram();e.attachShader(ka.program,aa("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader));e.attachShader(ka.program,aa("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader))}e.linkProgram(ka.program);ka.attributes={};ka.uniforms={};ka.attributes.vertex=e.getAttribLocation(ka.program,"position");ka.attributes.uv=e.getAttribLocation(ka.program,"UV");ka.uniforms.renderType=
  304. e.getUniformLocation(ka.program,"renderType");ka.uniforms.map=e.getUniformLocation(ka.program,"map");ka.uniforms.occlusionMap=e.getUniformLocation(ka.program,"occlusionMap");ka.uniforms.opacity=e.getUniformLocation(ka.program,"opacity");ka.uniforms.scale=e.getUniformLocation(ka.program,"scale");ka.uniforms.rotation=e.getUniformLocation(ka.program,"rotation");ka.uniforms.screenPosition=e.getUniformLocation(ka.program,"screenPosition");var ub=!1;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=
  305. new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=
  306. 2;_sprite.faces[b++]=3;_sprite.vertexBuffer=e.createBuffer();_sprite.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,_sprite.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,_sprite.vertices,e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,_sprite.faces,e.STATIC_DRAW);_sprite.program=e.createProgram();e.attachShader(_sprite.program,aa("fragment",THREE.ShaderLib.sprite.fragmentShader));e.attachShader(_sprite.program,aa("vertex",THREE.ShaderLib.sprite.vertexShader));
  307. e.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=e.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=e.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=e.getUniformLocation(_sprite.program,"uvOffset");_sprite.uniforms.uvScale=e.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=e.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=e.getUniformLocation(_sprite.program,"scale");
  308. _sprite.uniforms.alignment=e.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=e.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=e.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=e.getUniformLocation(_sprite.program,"useScreenCoordinates");_sprite.uniforms.affectedByDistance=e.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=e.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=
  309. e.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=e.getUniformLocation(_sprite.program,"projectionMatrix");var lb=!1;this.setSize=function(n,D){L.width=n;L.height=D;this.setViewport(0,0,L.width,L.height)};this.setViewport=function(n,D,z,v){ra=n;oa=D;ea=z;Aa=v;e.viewport(ra,oa,ea,Aa)};this.setScissor=function(n,D,z,v){e.scissor(n,D,z,v)};this.enableScissorTest=function(n){n?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){ca=
  310. n;e.depthMask(n)};this.setClearColorHex=function(n,D){la.setHex(n);Na=D;e.clearColor(la.r,la.g,la.b,Na)};this.setClearColor=function(n,D){la.copy(n);Na=D;e.clearColor(la.r,la.g,la.b,Na)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(n){Ga.darkness=n};this.getContext=function(){return e};this.initMaterial=function(n,D,z,v){var A,M,J;if(n instanceof THREE.MeshDepthMaterial)J="depth";else if(n instanceof THREE.ShadowVolumeDynamicMaterial)J=
  311. "shadowVolumeDynamic";else if(n instanceof THREE.MeshNormalMaterial)J="normal";else if(n instanceof THREE.MeshBasicMaterial)J="basic";else if(n instanceof THREE.MeshLambertMaterial)J="lambert";else if(n instanceof THREE.MeshPhongMaterial)J="phong";else if(n instanceof THREE.LineBasicMaterial)J="basic";else n instanceof THREE.ParticleBasicMaterial&&(J="particle_basic");if(J){var G=THREE.ShaderLib[J];n.uniforms=THREE.UniformsUtils.clone(G.uniforms);n.vertexShader=G.vertexShader;n.fragmentShader=G.fragmentShader}var U,
  312. Y,B;U=B=G=0;for(Y=D.length;U<Y;U++){M=D[U];M instanceof THREE.DirectionalLight&&B++;M instanceof THREE.PointLight&&G++}if(G+B<=4)D=B;else{D=Math.ceil(4*B/(G+B));G=4-D}M={directional:D,point:G};B=50;if(v!==undefined&&v instanceof THREE.SkinnedMesh)B=v.bones.length;var K;a:{U=n.fragmentShader;Y=n.vertexShader;G=n.uniforms;D=n.attributes;z={map:!!n.map,envMap:!!n.envMap,lightMap:!!n.lightMap,vertexColors:n.vertexColors,fog:z,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,
  313. maxMorphTargets:this.maxMorphTargets,maxDirLights:M.directional,maxPointLights:M.point,maxBones:B};var W;M=[];if(J)M.push(J);else{M.push(U);M.push(Y)}for(W in z){M.push(W);M.push(z[W])}J=M.join();W=0;for(M=Ja.length;W<M;W++)if(Ja[W].code==J){K=Ja[W].program;break a}W=e.createProgram();prefix_fragment=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+z.maxDirLights,"#define MAX_POINT_LIGHTS "+z.maxPointLights,z.fog?"#define USE_FOG":"",z.fog instanceof THREE.FogExp2?"#define FOG_EXP2":
  314. "",z.map?"#define USE_MAP":"",z.envMap?"#define USE_ENVMAP":"",z.lightMap?"#define USE_LIGHTMAP":"",z.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");prefix_vertex=[hb?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+z.maxDirLights,"#define MAX_POINT_LIGHTS "+z.maxPointLights,"#define MAX_BONES "+z.maxBones,z.map?"#define USE_MAP":"",z.envMap?"#define USE_ENVMAP":"",z.lightMap?"#define USE_LIGHTMAP":"",z.vertexColors?"#define USE_COLOR":
  315. "",z.skinning?"#define USE_SKINNING":"",z.morphTargets?"#define USE_MORPHTARGETS":"",z.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 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
  316. e.attachShader(W,aa("fragment",prefix_fragment+U));e.attachShader(W,aa("vertex",prefix_vertex+Y));e.linkProgram(W);e.getProgramParameter(W,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(W,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");W.uniforms={};W.attributes={};var ia;U=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(ia in G)U.push(ia);
  317. ia=U;G=0;for(U=ia.length;G<U;G++){Y=ia[G];W.uniforms[Y]=e.getUniformLocation(W,Y)}U=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(ia=0;ia<z.maxMorphTargets;ia++)U.push("morphTarget"+ia);for(K in D)U.push(K);K=U;ia=0;for(D=K.length;ia<D;ia++){z=K[ia];W.attributes[z]=e.getAttribLocation(W,z)}Ja.push({program:W,code:J});K=W}n.program=K;K=n.program.attributes;K.position>=0&&e.enableVertexAttribArray(K.position);K.color>=0&&e.enableVertexAttribArray(K.color);
  318. K.normal>=0&&e.enableVertexAttribArray(K.normal);K.tangent>=0&&e.enableVertexAttribArray(K.tangent);if(n.skinning&&K.skinVertexA>=0&&K.skinVertexB>=0&&K.skinIndex>=0&&K.skinWeight>=0){e.enableVertexAttribArray(K.skinVertexA);e.enableVertexAttribArray(K.skinVertexB);e.enableVertexAttribArray(K.skinIndex);e.enableVertexAttribArray(K.skinWeight)}if(n.attributes)for(A in n.attributes)K[A]!==undefined&&K[A]>=0&&e.enableVertexAttribArray(K[A]);if(n.morphTargets){n.numSupportedMorphTargets=0;if(K.morphTarget0>=
  319. 0){e.enableVertexAttribArray(K.morphTarget0);n.numSupportedMorphTargets++}if(K.morphTarget1>=0){e.enableVertexAttribArray(K.morphTarget1);n.numSupportedMorphTargets++}if(K.morphTarget2>=0){e.enableVertexAttribArray(K.morphTarget2);n.numSupportedMorphTargets++}if(K.morphTarget3>=0){e.enableVertexAttribArray(K.morphTarget3);n.numSupportedMorphTargets++}if(K.morphTarget4>=0){e.enableVertexAttribArray(K.morphTarget4);n.numSupportedMorphTargets++}if(K.morphTarget5>=0){e.enableVertexAttribArray(K.morphTarget5);
  320. n.numSupportedMorphTargets++}if(K.morphTarget6>=0){e.enableVertexAttribArray(K.morphTarget6);n.numSupportedMorphTargets++}if(K.morphTarget7>=0){e.enableVertexAttribArray(K.morphTarget7);n.numSupportedMorphTargets++}v.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);n=0;for(A=this.maxMorphTargets;n<A;n++)v.__webglMorphTargetInfluences[n]=0}};this.render=function(n,D,z,v){var A,M,J,G,U,Y,B,K,W=n.lights,ia=n.fog;ha.data.vertices=0;ha.data.faces=0;ha.data.drawCalls=0;D.matrixAutoUpdate&&
  321. D.update(undefined,!0);n.update(undefined,!1,D);D.matrixWorldInverse.flattenToArray(Ma);D.projectionMatrix.flattenToArray(xa);fa.multiply(D.projectionMatrix,D.matrixWorldInverse);k(fa);this.initWebGLObjects(n);ya(z);(this.autoClear||v)&&this.clear();U=n.__webglObjects.length;for(v=0;v<U;v++){A=n.__webglObjects[v];B=A.object;if(B.visible)if(!(B instanceof THREE.Mesh)||m(B)){B.matrixWorld.flattenToArray(B._objectMatrixArray);H(B,D);x(A);A.render=!0;if(this.sortObjects){Qa.copy(B.position);fa.multiplyVector3(Qa);
  322. A.z=Qa.z}}else A.render=!1;else A.render=!1}this.sortObjects&&n.__webglObjects.sort(y);Y=n.__webglObjectsImmediate.length;for(v=0;v<Y;v++){A=n.__webglObjectsImmediate[v];B=A.object;if(B.visible){B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray);H(B,D);p(A)}}T(THREE.NormalBlending);for(v=0;v<U;v++){A=n.__webglObjects[v];if(A.render){B=A.object;K=A.buffer;J=A.opaque;h(B);for(A=0;A<J.count;A++){G=J.list[A];j(G.depthTest);f(D,W,ia,G,K,B)}}}for(v=0;v<Y;v++){A=n.__webglObjectsImmediate[v];
  323. B=A.object;if(B.visible){J=A.opaque;h(B);for(A=0;A<J.count;A++){G=J.list[A];j(G.depthTest);M=c(D,W,ia,G,B);B.render(function(V){g(V,M,G.shading)})}}}for(v=0;v<U;v++){A=n.__webglObjects[v];if(A.render){B=A.object;K=A.buffer;J=A.transparent;h(B);for(A=0;A<J.count;A++){G=J.list[A];T(G.blending);j(G.depthTest);f(D,W,ia,G,K,B)}}}for(v=0;v<Y;v++){A=n.__webglObjectsImmediate[v];B=A.object;if(B.visible){J=A.transparent;h(B);for(A=0;A<J.count;A++){G=J.list[A];T(G.blending);j(G.depthTest);M=c(D,W,ia,G,B);B.render(function(V){g(V,
  324. M,G.shading)})}}}n.__webglSprites.length&&u(n,D);Z&&n.__webglShadowVolumes.length&&n.lights.length&&t(n);n.__webglLensFlares.length&&I(n,D);if(z&&z.minFilter!==THREE.NearestFilter&&z.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,z.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}e.finish()};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[];n.__webglShadowVolumes=[];n.__webglLensFlares=[];n.__webglSprites=
  325. []}for(;n.__objectsAdded.length;){var D=n.__objectsAdded[0],z=n,v=void 0,A=void 0,M=void 0;if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){A=D.geometry;A.geometryGroups==undefined&&S(A);for(v in A.geometryGroups){M=A.geometryGroups[v];if(!M.__webglVertexBuffer){var J=M;J.__webglVertexBuffer=
  326. e.createBuffer();J.__webglNormalBuffer=e.createBuffer();J.__webglTangentBuffer=e.createBuffer();J.__webglColorBuffer=e.createBuffer();J.__webglUVBuffer=e.createBuffer();J.__webglUV2Buffer=e.createBuffer();J.__webglSkinVertexABuffer=e.createBuffer();J.__webglSkinVertexBBuffer=e.createBuffer();J.__webglSkinIndicesBuffer=e.createBuffer();J.__webglSkinWeightsBuffer=e.createBuffer();J.__webglFaceBuffer=e.createBuffer();J.__webglLineBuffer=e.createBuffer();if(J.numMorphTargets){var G=void 0,U=void 0;J.__webglMorphTargetsBuffers=
  327. [];G=0;for(U=J.numMorphTargets;G<U;G++)J.__webglMorphTargetsBuffers.push(e.createBuffer())}J=M;G=D;var Y=void 0,B=void 0,K=void 0;K=void 0;var W=void 0,ia=void 0,V=void 0,Ka=V=U=0;B=void 0;K=void 0;var Ba=void 0;Y=void 0;B=void 0;W=G.geometry;Ba=W.faces;ia=J.faces;Y=0;for(B=ia.length;Y<B;Y++){K=ia[Y];K=Ba[K];if(K instanceof THREE.Face3){U+=3;V+=1;Ka+=3}else if(K instanceof THREE.Face4){U+=4;V+=2;Ka+=4}}Y=J;B=G;Ba=void 0;ia=void 0;var La=void 0,bb=void 0;La=void 0;K=[];Ba=0;for(ia=B.materials.length;Ba<
  328. ia;Ba++){La=B.materials[Ba];if(La instanceof THREE.MeshFaceMaterial){La=0;for(l=Y.materials.length;La<l;La++)(bb=Y.materials[La])&&K.push(bb)}else(bb=La)&&K.push(bb)}Y=K;a:{B=void 0;Ba=void 0;ia=Y.length;for(B=0;B<ia;B++){Ba=Y[B];if(Ba.map||Ba.lightMap||Ba instanceof THREE.MeshShaderMaterial){B=!0;break a}}B=!1}a:{Ba=Y;ia=void 0;K=void 0;La=Ba.length;for(ia=0;ia<La;ia++){K=Ba[ia];if(!(K instanceof THREE.MeshBasicMaterial&&!K.envMap||K instanceof THREE.MeshDepthMaterial)){Ba=K&&K.shading!=undefined&&
  329. K.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}Ba=!1}a:{ia=void 0;K=void 0;La=Y.length;for(ia=0;ia<La;ia++){K=Y[ia];if(K.vertexColors){K=K.vertexColors;break a}}K=!1}J.__vertexArray=new Float32Array(U*3);if(Ba)J.__normalArray=new Float32Array(U*3);if(W.hasTangents)J.__tangentArray=new Float32Array(U*4);if(K)J.__colorArray=new Float32Array(U*3);if(B){if(W.faceUvs.length>0||W.faceVertexUvs.length>0)J.__uvArray=new Float32Array(U*2);if(W.faceUvs.length>1||W.faceVertexUvs.length>
  330. 1)J.__uv2Array=new Float32Array(U*2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){J.__skinVertexAArray=new Float32Array(U*4);J.__skinVertexBArray=new Float32Array(U*4);J.__skinIndexArray=new Float32Array(U*4);J.__skinWeightArray=new Float32Array(U*4)}J.__faceArray=new Uint16Array(V*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0));J.__lineArray=new Uint16Array(Ka*2);if(J.numMorphTargets){J.__morphTargetsArrays=[];W=0;for(ia=J.numMorphTargets;W<ia;W++)J.__morphTargetsArrays.push(new Float32Array(U*
  331. 3))}J.__needsSmoothNormals=Ba==THREE.SmoothShading;J.__uvType=B;J.__vertexColorType=K;J.__normalType=Ba;J.__webglFaceCount=V*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0);J.__webglLineCount=Ka*2;W=0;for(ia=Y.length;W<ia;W++)if(Y[W].attributes){J.__webglCustomAttributes={};for(a in Y[W].attributes){B=Y[W].attributes[a];if(!B.__webglInitialized||B.createUniqueBuffers){B.__webglInitialized=!0;V=1;if(B.type==="v2")V=2;else if(B.type==="v3")V=3;else if(B.type==="v4")V=4;else B.type==="c"&&(V=
  332. 3);B.size=V;B.needsUpdate=!0;B.array=new Float32Array(U*V);B.buffer=e.createBuffer();B.buffer.belongsToAttribute=a}J.__webglCustomAttributes[a]=B}}J.__inittedArrays=!0;A.__dirtyVertices=!0;A.__dirtyMorphTargets=!0;A.__dirtyElements=!0;A.__dirtyUvs=!0;A.__dirtyNormals=!0;A.__dirtyTangents=!0;A.__dirtyColors=!0}D instanceof THREE.ShadowVolume?E(z.__webglShadowVolumes,M,D):E(z.__webglObjects,M,D)}}else if(D instanceof THREE.LensFlare)E(z.__webglLensFlares,undefined,D);else if(D instanceof THREE.Ribbon){A=
  333. D.geometry;if(!A.__webglVertexBuffer){v=A;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=A;M=v.vertices.length;v.__vertexArray=new Float32Array(M*3);v.__colorArray=new Float32Array(M*3);v.__webglVertexCount=M;A.__dirtyVertices=!0;A.__dirtyColors=!0}E(z.__webglObjects,A,D)}else if(D instanceof THREE.Line){A=D.geometry;if(!A.__webglVertexBuffer){v=A;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=A;M=v.vertices.length;v.__vertexArray=new Float32Array(M*
  334. 3);v.__colorArray=new Float32Array(M*3);v.__webglLineCount=M;A.__dirtyVertices=!0;A.__dirtyColors=!0}E(z.__webglObjects,A,D)}else if(D instanceof THREE.ParticleSystem){A=D.geometry;if(!A.__webglVertexBuffer){v=A;v.__webglVertexBuffer=e.createBuffer();v.__webglColorBuffer=e.createBuffer();v=A;M=v.vertices.length;v.__vertexArray=new Float32Array(M*3);v.__colorArray=new Float32Array(M*3);v.__sortArray=[];v.__webglParticleCount=M;A.__dirtyVertices=!0;A.__dirtyColors=!0}E(z.__webglObjects,A,D)}else if(THREE.MarchingCubes!==
  335. undefined&&D instanceof THREE.MarchingCubes)z.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],count:0}});else D instanceof THREE.Sprite&&z.__webglSprites.push(D);n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){D=n.__objectsRemoved[0];z=n;A=void 0;v=void 0;if(D instanceof THREE.Mesh)for(A=z.__webglObjects.length-1;A>=0;A--){v=z.__webglObjects[A].object;if(D==v){z.__webglObjects.splice(A,1);break}}else if(D instanceof THREE.Sprite)for(A=z.__webglSprites.length-
  336. 1;A>=0;A--){v=z.__webglSprites[A];if(D==v){z.__webglSprites.splice(A,1);break}}n.__objectsRemoved.splice(0,1)}D=0;for(z=n.__webglObjects.length;D<z;D++)C(n.__webglObjects[D].object,n);D=0;for(z=n.__webglShadowVolumes.length;D<z;D++)C(n.__webglShadowVolumes[D].object,n);D=0;for(z=n.__webglLensFlares.length;D<z;D++)C(n.__webglLensFlares[D].object,n)};this.setFaceCulling=function(n,D){if(n){!D||D=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(n=="back")e.cullFace(e.BACK);else n=="front"?e.cullFace(e.FRONT):
  337. e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return hb}};
  338. THREE.WebGLRenderTarget=function(b,d,c){this.width=b;this.height=d;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBAFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==
  339. undefined?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==undefined?c.stencilBuffer:!0};
  340. 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(b,d,c){c&&b.update(undefined,!1,d);c=b.sounds;var f,g=c.length;for(f=0;f<g;f++){b=c[f];this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34);this.soundPosition.subSelf(d.position);if(b.isPlaying&&b.isLoaded){b.isAddedToDOM||b.addToDOM(this.domElement);b.calculateVolumeAndPan(this.soundPosition)}}}};
  341. THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
  342. 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};
  343. 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};
  344. 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};
  345. THREE.ColorUtils={adjustHSV:function(b,d,c,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+d,0,1);g.s=THREE.ColorUtils.clamp(g.s+c,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,d){var c=b.r,f=b.g,g=b.b,h=Math.max(Math.max(c,f),g),j=Math.min(Math.min(c,f),g);if(j==h)j=c=0;else{var k=h-j;j=k/h;c=c==h?(f-g)/k:f==h?2+(g-c)/k:4+(c-f)/k;c/=6;c<0&&(c+=1);c>1&&(c-=1)}d===undefined&&(d={h:0,s:0,v:0});d.h=c;d.s=j;d.v=h;return d},
  346. clamp:function(b,d,c){return b<d?d:b>c?c:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
  347. var GeometryUtils={merge:function(b,d){var c=d instanceof THREE.Mesh,f=b.vertices.length,g=c?d.geometry:d,h=b.vertices,j=g.vertices,k=b.faces,m=g.faces,o=b.faceVertexUvs[0];g=g.faceVertexUvs[0];c&&d.matrixAutoUpdate&&d.updateMatrix();for(var p=0,x=j.length;p<x;p++){var y=new THREE.Vertex(j[p].position.clone());c&&d.matrix.multiplyVector3(y.position);h.push(y)}p=0;for(x=m.length;p<x;p++){j=m[p];var t,u,I=j.vertexNormals;y=j.vertexColors;if(j instanceof THREE.Face3)t=new THREE.Face3(j.a+f,j.b+f,j.c+
  348. f);else j instanceof THREE.Face4&&(t=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));t.normal.copy(j.normal);c=0;for(h=I.length;c<h;c++){u=I[c];t.vertexNormals.push(u.clone())}t.color.copy(j.color);c=0;for(h=y.length;c<h;c++){u=y[c];t.vertexColors.push(u.clone())}t.materials=j.materials.slice();t.centroid.copy(j.centroid);k.push(t)}p=0;for(x=g.length;p<x;p++){f=g[p];k=[];c=0;for(h=f.length;c<h;c++)k.push(new THREE.UV(f[c].u,f[c].v));o.push(k)}}};
  349. THREE.ImageUtils={loadTexture:function(b,d,c){var f=new Image,g=new THREE.Texture(f,d);f.onload=function(){g.needsUpdate=!0;c&&c(this)};f.src=b;return g},loadTextureCube:function(b,d,c){var f,g=[],h=new THREE.Texture(g,d);d=g.loadCount=0;for(f=b.length;d<f;++d){g[d]=new Image;g[d].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;c&&c(this)};g[d].src=b[d]}return h}};
  350. THREE.SceneUtils={addMesh:function(b,d,c,f,g,h,j,k,m,o){d=new THREE.Mesh(d,o);d.scale.x=d.scale.y=d.scale.z=c;d.position.x=f;d.position.y=g;d.position.z=h;d.rotation.x=j;d.rotation.y=k;d.rotation.z=m;b.addObject(d);return d},addPanoramaCubeWebGL:function(b,d,c){var f=THREE.ShaderUtils.lib.cube;f.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:f.uniforms});d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,1,null,!0),c);b.addObject(d);
  351. return d},addPanoramaCube:function(b,d,c){var f=[];f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));f.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));d=new THREE.Mesh(new THREE.Cube(d,d,d,1,1,f,!0),
  352. new THREE.MeshFaceMaterial);b.addObject(d);return d},addPanoramaCubePlanes:function(b,d,c){var f=d/2;d=new THREE.Plane(d,d);var g=Math.PI,h=Math.PI/2;THREE.SceneUtils.addMesh(b,d,1,0,0,-f,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));THREE.SceneUtils.addMesh(b,d,1,-f,0,0,0,h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));THREE.SceneUtils.addMesh(b,d,1,f,0,0,0,-h,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));THREE.SceneUtils.addMesh(b,d,1,0,f,0,h,
  353. 0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));THREE.SceneUtils.addMesh(b,d,1,0,-f,0,-h,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))},showHierarchy:function(b,d){THREE.SceneUtils.traverseHierarchy(b,function(c){c.visible=d})},traverseHierarchy:function(b,d){var c,f,g=b.children.length;for(f=0;f<g;f++){c=b.children[f];d(c);THREE.SceneUtils.traverseHierarchy(c,d)}}};
  354. THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value: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}",
  355. 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}"},
  356. normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",
  357. value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},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 enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\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 specularTex = 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;\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, 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 = specularTex.r * pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight * pointDiffuseWeight;\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 = specularTex.r * pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight * dirDiffuseWeight;\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}",
  358. 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}"},
  359. 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",
  360. 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}"},
  361. 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}"},
  362. 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}",
  363. fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var d,c,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;c=Array(h);for(d=f=0;d<h;++d){c[d]=Math.exp(-((d-g)*(d-g))/(2*b*b));f+=c[d]}for(d=0;d<h;++d)c[d]/=f;return c}};
  364. THREE.AnimationHandler=function(){var b=[],d={},c={};c.update=function(g){for(var h=0;h<b.length;h++)b[h].update(g)};c.addToUpdate=function(g){b.indexOf(g)===-1&&b.push(g)};c.removeFromUpdate=function(g){g=b.indexOf(g);g!==-1&&b.splice(g,1)};c.add=function(g){d[g.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+g.name+" already exists in library. Overwriting.");d[g.name]=g;if(g.initialized!==!0){for(var h=0;h<g.hierarchy.length;h++){for(var j=0;j<g.hierarchy[h].keys.length;j++){if(g.hierarchy[h].keys[j].time<
  365. 0)g.hierarchy[h].keys[j].time=0;if(g.hierarchy[h].keys[j].rot!==undefined&&!(g.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var k=g.hierarchy[h].keys[j].rot;g.hierarchy[h].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(g.hierarchy[h].keys[0].morphTargets!==undefined){k={};for(j=0;j<g.hierarchy[h].keys.length;j++)for(var m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++){var o=g.hierarchy[h].keys[j].morphTargets[m];k[o]=-1}g.hierarchy[h].usedMorphTargets=k;for(j=0;j<g.hierarchy[h].keys.length;j++){var p=
  366. {};for(o in k){for(m=0;m<g.hierarchy[h].keys[j].morphTargets.length;m++)if(g.hierarchy[h].keys[j].morphTargets[m]===o){p[o]=g.hierarchy[h].keys[j].morphTargetsInfluences[m];break}m===g.hierarchy[h].keys[j].morphTargets.length&&(p[o]=0)}g.hierarchy[h].keys[j].morphTargetsInfluences=p}}for(j=1;j<g.hierarchy[h].keys.length;j++)if(g.hierarchy[h].keys[j].time===g.hierarchy[h].keys[j-1].time){g.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<g.hierarchy[h].keys.length;j++)g.hierarchy[h].keys[j].index=j}j=parseInt(g.length*
  367. g.fps,10);g.JIT={};g.JIT.hierarchy=[];for(h=0;h<g.hierarchy.length;h++)g.JIT.hierarchy.push(Array(j));g.initialized=!0}};c.get=function(g){if(typeof g==="string")if(d[g])return d[g];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+g);return null}};c.parse=function(g){var h=[];if(g instanceof THREE.SkinnedMesh)for(var j=0;j<g.bones.length;j++)h.push(g.bones[j]);else f(g,h);return h};var f=function(g,h){h.push(g);for(var j=0;j<g.children.length;j++)f(g.children[j],h)};c.LINEAR=
  368. 0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(b,d,c,f){this.root=b;this.data=THREE.AnimationHandler.get(d);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
  369. THREE.Animation.prototype.play=function(b,d){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==undefined?b:!0;this.currentTime=d!==undefined?d:0;var c,f=this.hierarchy.length,g;for(c=0;c<f;c++){g=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===undefined){g.animationCache={};g.animationCache.prevKey={pos:0,rot:0,scl:0};g.animationCache.nextKey={pos:0,rot:0,scl:0};g.animationCache.originalMatrix=
  370. g instanceof THREE.Bone?g.skinMatrix:g.matrix}var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];g.pos=this.getNextKeyWith("pos",c,1);g.rot=this.getNextKeyWith("rot",c,1);g.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
  371. THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
  372. THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==undefined){if(this.hierarchy[b]instanceof THREE.Bone)this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix;else this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix;delete this.hierarchy[b].animationCache}};
  373. THREE.Animation.prototype.update=function(b){if(this.isPlaying){var d=["pos","rot","scl"],c,f,g,h,j,k,m,o,p=this.data.JIT.hierarchy,x,y;this.currentTime+=b*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;o=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,u=this.hierarchy.length;t<u;t++){b=this.hierarchy[t];m=b.animationCache;if(this.JITCompile&&p[t][o]!==undefined)if(b instanceof THREE.Bone){b.skinMatrix=p[t][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=
  374. !1}else{b.matrix=p[t][o];b.matrixAutoUpdate=!1;b.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(b instanceof THREE.Bone)b.skinMatrix=b.animationCache.originalMatrix;else b.matrix=b.animationCache.originalMatrix;for(var I=0;I<3;I++){c=d[I];j=m.prevKey[c];k=m.nextKey[c];if(k.time<=y){if(x<y)if(this.loop){j=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(c,t,1);k.time<x;){j=k;k=this.getNextKeyWith(c,t,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(c,t,k.index+1)}while(k.time<
  375. x)}m.prevKey[c]=j;m.nextKey[c]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(x-j.time)/(k.time-j.time);g=j[c];h=k[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+t);f=f<0?0:1}if(c==="pos"){c=b.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
  376. this.getPrevKeyWith("pos",t,j.index-1).pos;this.points[1]=g;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos;f=f*0.33+0.33;g=this.interpolateCatmullRom(this.points,f);c.x=g[0];c.y=g[1];c.z=g[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);b.rotation.set(0,f,0)}}}else if(c===
  377. "rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(c==="scl"){c=b.scale;c.x=g[0]+(h[0]-g[0])*f;c.y=g[1]+(h[1]-g[1])*f;c.z=g[2]+(h[2]-g[2])*f}}}}if(this.JITCompile&&p[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(t=0;t<this.hierarchy.length;t++)p[t][o]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
  378. THREE.Animation.prototype.interpolateCatmullRom=function(b,d){var c=[],f=[],g,h,j,k,m,o;g=(b.length-1)*d;h=Math.floor(g);g-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>b.length-2?h:h+1;c[3]=h>b.length-3?h:h+2;h=b[c[0]];k=b[c[1]];m=b[c[2]];o=b[c[3]];c=g*g;j=g*c;f[0]=this.interpolate(h[0],k[0],m[0],o[0],g,c,j);f[1]=this.interpolate(h[1],k[1],m[1],o[1],g,c,j);f[2]=this.interpolate(h[2],k[2],m[2],o[2],g,c,j);return f};
  379. THREE.Animation.prototype.interpolate=function(b,d,c,f,g,h,j){b=(c-b)*0.5;f=(f-d)*0.5;return(2*(d-c)+b+f)*j+(-3*(d-c)-2*b-f)*h+b*g+d};THREE.Animation.prototype.getNextKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<f.length-1?c:f.length-1;else c%=f.length;for(;c<f.length;c++)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[0]};
  380. THREE.Animation.prototype.getPrevKeyWith=function(b,d,c){var f=this.data.hierarchy[d].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][b]!==undefined)return f[c];return this.data.hierarchy[d].keys[f.length-1]};
  381. THREE.QuakeCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=
  382. b.movementSpeed;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.noFly!==undefined)this.noFly=b.noFly;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.autoForward!==undefined)this.autoForward=b.autoForward;if(b.activeLook!==undefined)this.activeLook=b.activeLook;if(b.heightSpeed!==undefined)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==undefined)this.heightCoef=b.heightCoef;if(b.heightMin!==undefined)this.heightMin=b.heightMin;if(b.heightMax!==undefined)this.heightMax=
  383. b.heightMax;if(b.constrainVertical!==undefined)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==undefined)this.verticalMin=b.verticalMin;if(b.verticalMax!==undefined)this.verticalMax=b.verticalMax;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.freeze=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=
  384. window.innerHeight/2;this.onMouseDown=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(c){c.preventDefault();c.stopPropagation();if(this.activeLook)switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(c){this.mouseX=c.clientX-this.windowHalfX;this.mouseY=c.clientY-this.windowHalfY};this.onKeyDown=
  385. function(c){switch(c.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;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(c){switch(c.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){var c=(new Date).getTime();this.tdiff=(c-this.lastUpdate)/
  386. 1E3;this.lastUpdate=c;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var f=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(f+this.autoSpeedFactor));this.moveBackward&&this.translateZ(f);this.moveLeft&&this.translateX(-f);this.moveRight&&this.translateX(f);f=this.tdiff*this.lookSpeed;
  387. this.activeLook||(f=0);this.lon+=this.mouseX*f;this.lookVertical&&(this.lat-=this.mouseY*f);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;c=this.target.position;var g=this.position;c.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=g.y+100*Math.cos(this.phi);c.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*f;this.lookVertical&&(this.lat-=this.mouseY*f);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=
  388. (90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;c=this.target.position;g=this.position;c.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);c.y=g.y+100*Math.cos(this.phi);c.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(c){c.preventDefault()},!1);this.domElement.addEventListener("mousemove",d(this,
  389. this.onMouseMove),!1);this.domElement.addEventListener("mousedown",d(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",d(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",d(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",d(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
  390. THREE.QuakeCamera.prototype.translate=function(b,d){this.matrix.rotateAxis(d);if(this.noFly)d.y=0;this.position.addSelf(d.multiplyScalar(b));this.target.position.addSelf(d.multiplyScalar(b))};
  391. THREE.PathCamera=function(b){function d(o,p,x,y){var t={name:x,fps:0.6,length:y,hierarchy:[]},u,I=p.getControlPointsArray(),H=p.getLength(),C=I.length,S=0;u=C-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:I[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[u]={time:y,pos:I[u],rot:[0,0,0,1],scl:[1,1,1]};for(u=1;u<C-1;u++){S=y*H.chunks[u]/H.total;p.keys[u]={time:S,pos:I[u]}}t.hierarchy[0]=p;THREE.AnimationHandler.add(t);return new THREE.Animation(o,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function c(o,p){var x,
  392. y,t=new THREE.Geometry;for(x=0;x<o.points.length*p;x++){y=x/(o.points.length*p);y=o.getPoint(y);t.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return t}function f(o,p){var x=c(p,10),y=c(p,10),t=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,t);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new THREE.Sphere(1,
  393. 16,8);t=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){x=new THREE.Mesh(y,t);x.position.copy(p.points[i]);x.updateMatrix();o.addChild(x)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.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=
  394. !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(b){if(b.duration!==undefined)this.duration=b.duration*1E3;if(b.waypoints!==undefined)this.waypoints=b.waypoints;if(b.useConstantSpeed!==undefined)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==undefined)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==undefined)this.createDebugPath=b.createDebugPath;
  395. if(b.createDebugDummy!==undefined)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==undefined)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==undefined)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==undefined)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==undefined)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==undefined)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==undefined)this.domElement=b.domElement}this.theta=this.phi=this.lon=
  396. this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,h=Math.PI/180;this.update=function(o,p,x){var y,t;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)*h;this.theta=this.lon*h;y=this.phi%g;this.phi=y>=0?y:y+g;y=this.verticalAngleMap.srcRange;t=this.verticalAngleMap.dstRange;
  397. var u=t[1]-t[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-y[0])*(t[1]-t[0])/(y[1]-y[0])+t[0]-t[0])/u)*u+t[0];y=this.horizontalAngleMap.srcRange;t=this.horizontalAngleMap.dstRange;u=t[1]-t[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-y[0])*(t[1]-t[0])/(y[1]-y[0])+t[0]-t[0])/u)*u+t[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,o,p,x)};this.onMouseMove=
  398. function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){b=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.Cube(10,10,20),m=new THREE.Cube(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(m,j);b.position.set(0,10,
  399. 0);this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else{this.animation=d(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,p){return function(){p.apply(o,arguments)}}(this,
  400. 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;
  401. THREE.FlyCamera=function(b){function d(c,f){return function(){f.apply(c,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.005;this.dragToLook=!1;this.autoForward=!1;this.domElement=document;if(b){if(b.movementSpeed!==undefined)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==undefined)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==undefined)this.dragToLook=b.dragToLook;if(b.autoForward!==undefined)this.autoForward=
  402. b.autoForward;if(b.domElement!==undefined)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(c){if(typeof this[c.type]=="function")this[c.type](c)};this.keydown=function(c){if(!c.altKey){switch(c.keyCode){case 16:this.movementSpeedMultiplier=
  403. 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
  404. this.keyup=function(c){switch(c.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
  405. case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(c){c.preventDefault();c.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(c.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(c){if(!this.dragToLook||this.mouseStatus>0){var f=this.getContainerDimensions(),g=f.size[0]/2,h=f.size[1]/2;this.moveState.yawLeft=-(c.clientX-f.offset[0]-g)/g;this.moveState.pitchDown=(c.clientY-
  406. f.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(c){c.preventDefault();c.stopPropagation();if(this.dragToLook){this.mouseStatus--;this.moveState.yawLeft=this.moveState.pitchDown=0}else switch(c.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var c=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=c;this.tdiff=(c-this.lastUpdate)/1E3;this.lastUpdate=c;c=this.tdiff*this.movementSpeed;var f=this.tdiff*
  407. this.rollSpeed;this.translateX(this.moveVector.x*c);this.translateY(this.moveVector.y*c);this.translateZ(this.moveVector.z*c);this.tmpQuaternion.set(this.rotationVector.x*f,this.rotationVector.y*f,this.rotationVector.z*f,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var c=this.moveState.forward||
  408. this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-c+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
  409. document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",d(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",d(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",d(this,this.mouseup),!1);window.addEventListener("keydown",d(this,this.keydown),!1);window.addEventListener("keyup",d(this,
  410. this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
  411. THREE.RollCamera=function(b,d,c,f){THREE.Camera.call(this,b,d,c,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.useTarget=!1;this.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,m=!1,o=1,p=0,x=0,y=0,t=0,u=0,I=window.innerWidth/2,H=window.innerHeight/2;this.update=
  412. function(){var C=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=C;this.delta=(C-this.lastUpdate)/1E3;this.lastUpdate=C;if(this.mouseLook){C=this.delta*this.lookSpeed;this.rotateHorizontally(C*t);this.rotateVertically(C*u)}C=this.delta*this.movementSpeed;this.translateZ(C*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(C*x);this.translateY(C*y);m&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1]){this.forward.y=this.constrainVertical[1];this.forward.normalize()}else if(this.forward.y<
  413. this.constrainVertical[0]){this.forward.y=this.constrainVertical[0];this.forward.normalize()}j.copy(this.forward);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
  414. this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(C){this.position.x+=this.matrix.n11*C;this.position.y+=this.matrix.n21*C;this.position.z+=this.matrix.n31*C};this.translateY=function(C){this.position.x+=this.matrix.n12*C;this.position.y+=this.matrix.n22*C;this.position.z+=this.matrix.n32*C};this.translateZ=function(C){this.position.x-=this.matrix.n13*C;this.position.y-=
  415. this.matrix.n23*C;this.position.z-=this.matrix.n33*C};this.rotateHorizontally=function(C){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(C);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(C){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(C);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(C){C.preventDefault()},!1);this.domElement.addEventListener("mousemove",
  416. function(C){t=(C.clientX-I)/window.innerWidth;u=(C.clientY-H)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(C){C.preventDefault();C.stopPropagation();switch(C.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(C){C.preventDefault();C.stopPropagation();switch(C.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(C){switch(C.keyCode){case 38:case 87:p=1;break;case 37:case 65:x=-1;break;
  417. case 40:case 83:p=-1;break;case 39:case 68:x=1;break;case 81:m=!0;o=1;break;case 69:m=!0;o=-1;break;case 82:y=1;break;case 70:y=-1}},!1);this.domElement.addEventListener("keyup",function(C){switch(C.keyCode){case 38:case 87:p=0;break;case 37:case 65:x=0;break;case 40:case 83:p=0;break;case 39:case 68:x=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:y=0;break;case 70:y=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
  418. THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
  419. THREE.Cube=function(b,d,c,f,g,h,j,k,m){function o(H,C,S,E,T,O,Q,ya){var aa,ga,X=f||1,ha=g||1,e=T/2,Ja=O/2,ta=p.vertices.length;if(H=="x"&&C=="y"||H=="y"&&C=="x")aa="z";else if(H=="x"&&C=="z"||H=="z"&&C=="x"){aa="y";ha=h||1}else if(H=="z"&&C=="y"||H=="y"&&C=="z"){aa="x";X=h||1}var Da=X+1,ca=ha+1;T/=X;var ua=O/ha;for(ga=0;ga<ca;ga++)for(O=0;O<Da;O++){var da=new THREE.Vector3;da[H]=(O*T-e)*S;da[C]=(ga*ua-Ja)*E;da[aa]=Q;p.vertices.push(new THREE.Vertex(da))}for(ga=0;ga<ha;ga++)for(O=0;O<X;O++){p.faces.push(new THREE.Face4(O+
  420. Da*ga+ta,O+Da*(ga+1)+ta,O+1+Da*(ga+1)+ta,O+1+Da*ga+ta,null,null,ya));p.faceVertexUvs[0].push([new THREE.UV(O/X,ga/ha),new THREE.UV(O/X,(ga+1)/ha),new THREE.UV((O+1)/X,(ga+1)/ha),new THREE.UV((O+1)/X,ga/ha)])}}THREE.Geometry.call(this);var p=this,x=b/2,y=d/2,t=c/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var u=0;u<6;u++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var I in m)this.sides[I]!=
  421. undefined&&(this.sides[I]=m[I]);this.sides.px&&o("z","y",1*k,-1,c,d,-x,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,c,d,x,this.materials[1]);this.sides.py&&o("x","z",1*k,1,b,c,y,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,b,c,-y,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,b,d,t,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,b,d,-t,this.materials[5]);(function(){for(var H=[],C=[],S=0,E=p.vertices.length;S<E;S++){for(var T=p.vertices[S],O=!1,Q=0,ya=H.length;Q<ya;Q++){var aa=
  422. H[Q];if(T.position.x==aa.position.x&&T.position.y==aa.position.y&&T.position.z==aa.position.z){C[S]=Q;O=!0;break}}if(!O){C[S]=H.length;H.push(new THREE.Vertex(T.position.clone()))}}S=0;for(E=p.faces.length;S<E;S++){T=p.faces[S];T.a=C[T.a];T.b=C[T.b];T.c=C[T.c];T.d=C[T.d]}p.vertices=H})();this.computeCentroids();this.computeFaceNormals()};THREE.Cube.prototype=new THREE.Geometry;THREE.Cube.prototype.constructor=THREE.Cube;
  423. THREE.Cylinder=function(b,d,c,f,g,h){function j(y,t,u){k.vertices.push(new THREE.Vertex(new THREE.Vector3(y,t,u)))}THREE.Geometry.call(this);var k=this,m,o=Math.PI*2,p=f/2;for(m=0;m<b;m++)j(Math.sin(o*m/b)*d,Math.cos(o*m/b)*d,-p);for(m=0;m<b;m++)j(Math.sin(o*m/b)*c,Math.cos(o*m/b)*c,p);for(m=0;m<b;m++)k.faces.push(new THREE.Face4(m,m+b,b+(m+1)%b,(m+1)%b));if(c>0){j(0,0,-p-(h||0));for(m=b;m<b+b/2;m++)k.faces.push(new THREE.Face4(2*b,(2*m-2*b)%b,(2*m-2*b+1)%b,(2*m-2*b+2)%b))}if(d>0){j(0,0,p+(g||0));
  424. for(m=b+b/2;m<2*b;m++)k.faces.push(new THREE.Face4(2*b+1,(2*m-2*b+2)%b+b,(2*m-2*b+1)%b+b,(2*m-2*b)%b+b))}m=0;for(b=this.faces.length;m<b;m++){d=[];c=this.faces[m];g=this.vertices[c.a];h=this.vertices[c.b];p=this.vertices[c.c];var x=this.vertices[c.d];d.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/o,0.5+g.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/o,0.5+h.position.z/f));d.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/o,0.5+p.position.z/
  425. f));c instanceof THREE.Face4&&d.push(new THREE.UV(0.5+Math.atan2(x.position.x,x.position.y)/o,0.5+x.position.z/f));this.faceVertexUvs[0].push(d)}this.computeCentroids();this.computeFaceNormals()};THREE.Cylinder.prototype=new THREE.Geometry;THREE.Cylinder.prototype.constructor=THREE.Cylinder;
  426. THREE.Icosahedron=function(b){function d(x,y,t){var u=Math.sqrt(x*x+y*y+t*t);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(x/u,y/u,t/u)))-1}function c(x,y,t,u){u.faces.push(new THREE.Face3(x,y,t))}function f(x,y){var t=g.vertices[x].position,u=g.vertices[y].position;return d((t.x+u.x)/2,(t.y+u.y)/2,(t.z+u.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;d(-1,b,0);d(1,b,0);d(-1,-b,0);d(1,-b,0);d(0,-1,b);d(0,1,b);d(0,-1,-b);d(0,
  427. 1,-b);d(b,0,-1);d(b,0,1);d(-b,0,-1);d(-b,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in h.faces){var m=f(h.faces[k].a,h.faces[k].b),o=f(h.faces[k].b,h.faces[k].c),p=f(h.faces[k].c,h.faces[k].a);c(h.faces[k].a,m,p,j);c(h.faces[k].b,o,m,j);c(h.faces[k].c,
  428. p,o,j);c(m,o,p,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Icosahedron.prototype=new THREE.Geometry;THREE.Icosahedron.prototype.constructor=THREE.Icosahedron;
  429. THREE.Lathe=function(b,d,c){THREE.Geometry.call(this);this.steps=d||12;this.angle=c||2*Math.PI;d=this.angle/this.steps;c=[];for(var f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(d),k=0;k<b.length;k++){this.vertices.push(new THREE.Vertex(b[k]));c[k]=b[k].clone();f[k]=this.vertices.length-1}for(var m=0;m<=this.angle+0.001;m+=d){for(k=0;k<c.length;k++)if(m<this.angle){c[k]=j.multiplyVector3(c[k].clone());this.vertices.push(new THREE.Vertex(c[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);
  430. for(k=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(1-m/this.angle,k/b.length),new THREE.UV(1-m/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,(k+1)/b.length),new THREE.UV(1-(m-d)/this.angle,k/b.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Lathe.prototype=new THREE.Geometry;THREE.Lathe.prototype.constructor=THREE.Lathe;
  431. THREE.Plane=function(b,d,c,f){THREE.Geometry.call(this);var g,h=b/2,j=d/2;c=c||1;f=f||1;var k=c+1,m=f+1;b/=c;var o=d/f;for(g=0;g<m;g++)for(d=0;d<k;d++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(d*b-h,-(g*o-j),0)));for(g=0;g<f;g++)for(d=0;d<c;d++){this.faces.push(new THREE.Face4(d+k*g,d+k*(g+1),d+1+k*(g+1),d+1+k*g));this.faceVertexUvs[0].push([new THREE.UV(d/c,g/f),new THREE.UV(d/c,(g+1)/f),new THREE.UV((d+1)/c,(g+1)/f),new THREE.UV((d+1)/c,g/f)])}this.computeCentroids();this.computeFaceNormals()};
  432. THREE.Plane.prototype=new THREE.Geometry;THREE.Plane.prototype.constructor=THREE.Plane;
  433. THREE.Sphere=function(b,d,c){THREE.Geometry.call(this);var f,g=Math.PI,h=Math.max(3,d||8),j=Math.max(2,c||6);d=[];for(c=0;c<j+1;c++){f=c/j;var k=b*Math.cos(f*g),m=b*Math.sin(f*g),o=[],p=0;for(f=0;f<h;f++){var x=2*f/h,y=m*Math.sin(x*g);x=m*Math.cos(x*g);(c==0||c==j)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);o.push(p)}d.push(o)}var t,u,I;g=d.length;for(c=0;c<g;c++){h=d[c].length;if(c>0)for(f=0;f<h;f++){o=f==h-1;j=d[c][o?0:f+1];k=d[c][o?h-1:f];m=d[c-1][o?h-1:f];o=d[c-
  434. 1][o?0:f+1];y=c/(g-1);t=(c-1)/(g-1);u=(f+1)/h;x=f/h;p=new THREE.UV(1-u,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,t);var H=new THREE.UV(1-u,t);if(c<d.length-1){t=this.vertices[j].position.clone();u=this.vertices[k].position.clone();I=this.vertices[m].position.clone();t.normalize();u.normalize();I.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(I.x,I.y,I.z)]));this.faceVertexUvs[0].push([p,y,x])}if(c>1){t=this.vertices[j].position.clone();
  435. u=this.vertices[m].position.clone();I=this.vertices[o].position.clone();t.normalize();u.normalize();I.normalize();this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(I.x,I.y,I.z)]));this.faceVertexUvs[0].push([p,x,H])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.Sphere.prototype=new THREE.Geometry;THREE.Sphere.prototype.constructor=THREE.Sphere;
  436. THREE.Torus=function(b,d,c,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=d||40;this.segmentsR=c||8;this.segmentsT=f||6;b=[];for(d=0;d<=this.segmentsR;++d)for(c=0;c<=this.segmentsT;++c){f=c/this.segmentsT*2*Math.PI;var g=d/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([c/this.segmentsT,1-d/this.segmentsR])}for(d=1;d<=this.segmentsR;++d)for(c=
  437. 1;c<=this.segmentsT;++c){f=(this.segmentsT+1)*d+c;g=(this.segmentsT+1)*d+c-1;var h=(this.segmentsT+1)*(d-1)+c-1,j=(this.segmentsT+1)*(d-1)+c;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.Torus.prototype=new THREE.Geometry;THREE.Torus.prototype.constructor=THREE.Torus;
  438. THREE.TorusKnot=function(b,d,c,f,g,h,j){function k(x,y,t,u,I,H){y=t/u*x;t=Math.cos(y);return new THREE.Vector3(I*(2+t)*0.5*Math.cos(x),I*(2+t)*Math.sin(x)*0.5,H*I*Math.sin(y)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=d||40;this.segmentsR=c||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(d=0;d<this.segmentsT;++d){var m=
  439. b/this.segmentsR*2*this.p*Math.PI;j=d/this.segmentsT*2*Math.PI;g=k(m,j,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,j,this.q,this.p,this.radius,this.heightScale);c.x=m.x-g.x;c.y=m.y-g.y;c.z=m.z-g.z;f.x=m.x+g.x;f.y=m.y+g.y;f.z=m.z+g.z;h.cross(c,f);f.cross(h,c);h.normalize();f.normalize();m=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=m*f.x+j*h.x;g.y+=m*f.y+j*h.y;g.z+=m*f.z+j*h.z;this.grid[b][d]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(d=
  440. 0;d<this.segmentsT;++d){f=(b+1)%this.segmentsR;h=(d+1)%this.segmentsT;g=this.grid[b][d];c=this.grid[f][d];f=this.grid[f][h];h=this.grid[b][h];j=new THREE.UV(b/this.segmentsR,d/this.segmentsT);m=new THREE.UV((b+1)/this.segmentsR,d/this.segmentsT);var o=new THREE.UV((b+1)/this.segmentsR,(d+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(d+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,c,f,h));this.faceVertexUvs[0].push([j,m,o,p])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};
  441. THREE.TorusKnot.prototype=new THREE.Geometry;THREE.TorusKnot.prototype.constructor=THREE.TorusKnot;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
  442. THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var d="Loaded ";d+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
  443. this.statusDomElement.innerHTML=d},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,d,c){b.materials=[];for(var f=0;f<d.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(d[f],c)]},createMaterial:function(b,d){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function f(k,m){var o=new Image;o.onload=function(){if(!c(this.width)||!c(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
  444. Math.LN2));k.image.width=p;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,p,x)}else k.image=this;k.needsUpdate=!0};o.src=m}var g,h,j;g="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};if(b.shading)if(b.shading=="Phong")g="MeshPhongMaterial";else b.shading=="Basic"&&(g="MeshBasicMaterial");if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending==
  445. "Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==undefined||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==undefined)h.depthTest=b.depthTest;if(b.vertexColors!==undefined)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&d){j=document.createElement("canvas");h.map=new THREE.Texture(j);h.map.sourceFile=b.mapDiffuse;f(h.map,d+"/"+b.mapDiffuse)}else if(b.colorDiffuse){j=(b.colorDiffuse[0]*255<<
  446. 16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255;h.color=j;h.opacity=b.transparency}else if(b.DbgColor)h.color=b.DbgColor;if(b.mapLightmap&&d){j=document.createElement("canvas");h.lightMap=new THREE.Texture(j);h.lightMap.sourceFile=b.mapLightmap;f(h.lightMap,d+"/"+b.mapLightmap)}return new THREE[g](h)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
  447. THREE.JSONLoader.prototype.load=function(b){var d=this,c=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(c);b=new Worker(c);b.onmessage=function(h){d.createModel(h.data,f,g);d.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
  448. THREE.JSONLoader.prototype.createModel=function(b,d,c){var f=new THREE.Geometry,g=b.scale!==undefined?1/b.scale:1;this.init_materials(f,b.materials,c);(function(h){if(b.version===undefined||b.version!=2)console.error("Deprecated file format.");else{var j,k,m,o,p,x,y,t,u,I,H,C,S,E,T=b.faces;x=b.vertices;var O=b.normals,Q=b.colors,ya=0;for(j=0;j<b.uvs.length;j++)b.uvs[j].length&&ya++;for(j=0;j<ya;j++){f.faceUvs[j]=[];f.faceVertexUvs[j]=[]}o=0;for(p=x.length;o<p;){y=new THREE.Vertex;y.position.x=x[o++]*
  449. h;y.position.y=x[o++]*h;y.position.z=x[o++]*h;f.vertices.push(y)}o=0;for(p=T.length;o<p;){h=T[o++];x=h&1;m=h&2;j=h&4;k=h&8;t=h&16;y=h&32;I=h&64;h&=128;if(x){H=new THREE.Face4;H.a=T[o++];H.b=T[o++];H.c=T[o++];H.d=T[o++];x=4}else{H=new THREE.Face3;H.a=T[o++];H.b=T[o++];H.c=T[o++];x=3}if(m){m=T[o++];H.materials=f.materials[m]}m=f.faces.length;if(j)for(j=0;j<ya;j++){C=b.uvs[j];u=T[o++];E=C[u*2];u=C[u*2+1];f.faceUvs[j][m]=new THREE.UV(E,u)}if(k)for(j=0;j<ya;j++){C=b.uvs[j];S=[];for(k=0;k<x;k++){u=T[o++];
  450. E=C[u*2];u=C[u*2+1];S[k]=new THREE.UV(E,u)}f.faceVertexUvs[j][m]=S}if(t){t=T[o++]*3;k=new THREE.Vector3;k.x=O[t++];k.y=O[t++];k.z=O[t];H.normal=k}if(y)for(j=0;j<x;j++){t=T[o++]*3;k=new THREE.Vector3;k.x=O[t++];k.y=O[t++];k.z=O[t];H.vertexNormals.push(k)}if(I){y=T[o++];y=new THREE.Color(Q[y]);H.color=y}if(h)for(j=0;j<x;j++){y=T[o++];y=new THREE.Color(Q[y]);H.vertexColors.push(y)}f.faces.push(H)}}})(g);(function(){var h,j,k,m;if(b.skinWeights){h=0;for(j=b.skinWeights.length;h<j;h+=2){k=b.skinWeights[h];
  451. m=b.skinWeights[h+1];f.skinWeights.push(new THREE.Vector4(k,m,0,0))}}if(b.skinIndices){h=0;for(j=b.skinIndices.length;h<j;h+=2){k=b.skinIndices[h];m=b.skinIndices[h+1];f.skinIndices.push(new THREE.Vector4(k,m,0,0))}}f.bones=b.bones;f.animation=b.animation})();(function(h){if(b.morphTargets!==undefined){var j,k,m,o,p,x,y,t,u;j=0;for(k=b.morphTargets.length;j<k;j++){f.morphTargets[j]={};f.morphTargets[j].name=b.morphTargets[j].name;f.morphTargets[j].vertices=[];t=f.morphTargets[j].vertices;u=b.morphTargets[j].vertices;
  452. m=0;for(o=u.length;m<o;m+=3){p=u[m]*h;x=u[m+1]*h;y=u[m+2]*h;t.push(new THREE.Vertex(new THREE.Vector3(p,x,y)))}}}if(b.morphColors!==undefined){j=0;for(k=b.morphColors.length;j<k;j++){f.morphColors[j]={};f.morphColors[j].name=b.morphColors[j].name;f.morphColors[j].colors=[];o=f.morphColors[j].colors;p=b.morphColors[j].colors;h=0;for(m=p.length;h<m;h+=3){x=new THREE.Color(16755200);x.setRGB(p[h],p[h+1],p[h+2]);o.push(x)}}}})(g);(function(){if(b.edges!==undefined){var h,j,k;for(h=0;h<b.edges.length;h+=
  453. 2){j=b.edges[h];k=b.edges[h+1];f.edges.push(new THREE.Edge(f.vertices[j],f.vertices[k],j,k))}}})();f.computeFaceNormals();d(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
  454. THREE.BinaryLoader.prototype={load:function(b){var d=b.model,c=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(d),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(d);b=(new Date).getTime();d=new Worker(d);var h=this.showProgress?THREE.Loader.prototype.updateProgress:null;d.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,c,g,f,h)};d.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
  455. d.postMessage(b)},loadAjaxBuffers:function(b,d,c,f,g,h){var j=new XMLHttpRequest,k=f+"/"+b,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,c,g,d):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(h){m==0&&(m=j.getResponseHeader("Content-Length"));h({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
  456. j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,d,c,f){var g=function(h){function j(L,Z){var ja=p(L,Z),la=p(L,Z+1),Na=p(L,Z+2),fb=p(L,Z+3),hb=(fb<<1&255|Na>>7)-127;ja|=(Na&127)<<16|la<<8;if(ja==0&&hb==-127)return 0;return(1-2*(fb>>7))*(1+ja*Math.pow(2,-23))*Math.pow(2,hb)}function k(L,Z){var ja=p(L,Z),la=p(L,Z+1),Na=p(L,Z+2);return(p(L,Z+3)<<24)+(Na<<16)+(la<<8)+ja}function m(L,Z){var ja=p(L,Z);return(p(L,Z+1)<<8)+ja}function o(L,Z){var ja=p(L,Z);return ja>
  457. 127?ja-256:ja}function p(L,Z){return L.charCodeAt(Z)&255}function x(L){var Z,ja,la;Z=k(b,L);ja=k(b,L+Q);la=k(b,L+ya);L=m(b,L+aa);THREE.BinaryLoader.prototype.f3(C,Z,ja,la,L)}function y(L){var Z,ja,la,Na,fb,hb;Z=k(b,L);ja=k(b,L+Q);la=k(b,L+ya);Na=m(b,L+aa);fb=k(b,L+ga);hb=k(b,L+X);L=k(b,L+ha);THREE.BinaryLoader.prototype.f3n(C,T,Z,ja,la,Na,fb,hb,L)}function t(L){var Z,ja,la,Na;Z=k(b,L);ja=k(b,L+e);la=k(b,L+Ja);Na=k(b,L+ta);L=m(b,L+Da);THREE.BinaryLoader.prototype.f4(C,Z,ja,la,Na,L)}function u(L){var Z,
  458. ja,la,Na,fb,hb,Ga,ka;Z=k(b,L);ja=k(b,L+e);la=k(b,L+Ja);Na=k(b,L+ta);fb=m(b,L+Da);hb=k(b,L+ca);Ga=k(b,L+ua);ka=k(b,L+da);L=k(b,L+sa);THREE.BinaryLoader.prototype.f4n(C,T,Z,ja,la,Na,fb,hb,Ga,ka,L)}function I(L){var Z,ja;Z=k(b,L);ja=k(b,L+na);L=k(b,L+ra);THREE.BinaryLoader.prototype.uv3(C.faceVertexUvs[0],O[Z*2],O[Z*2+1],O[ja*2],O[ja*2+1],O[L*2],O[L*2+1])}function H(L){var Z,ja,la;Z=k(b,L);ja=k(b,L+oa);la=k(b,L+ea);L=k(b,L+Aa);THREE.BinaryLoader.prototype.uv4(C.faceVertexUvs[0],O[Z*2],O[Z*2+1],O[ja*
  459. 2],O[ja*2+1],O[la*2],O[la*2+1],O[L*2],O[L*2+1])}var C=this,S=0,E,T=[],O=[],Q,ya,aa,ga,X,ha,e,Ja,ta,Da,ca,ua,da,sa,na,ra,oa,ea,Aa,Oa,fa,xa,Ma,Qa,Ua;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,h);E={signature:b.substr(S,8),header_bytes:p(b,S+8),vertex_coordinate_bytes:p(b,S+9),normal_coordinate_bytes:p(b,S+10),uv_coordinate_bytes:p(b,S+11),vertex_index_bytes:p(b,S+12),normal_index_bytes:p(b,S+13),uv_index_bytes:p(b,S+14),material_index_bytes:p(b,S+15),nvertices:k(b,S+16),nnormals:k(b,
  460. S+16+4),nuvs:k(b,S+16+8),ntri_flat:k(b,S+16+12),ntri_smooth:k(b,S+16+16),ntri_flat_uv:k(b,S+16+20),ntri_smooth_uv:k(b,S+16+24),nquad_flat:k(b,S+16+28),nquad_smooth:k(b,S+16+32),nquad_flat_uv:k(b,S+16+36),nquad_smooth_uv:k(b,S+16+40)};S+=E.header_bytes;Q=E.vertex_index_bytes;ya=E.vertex_index_bytes*2;aa=E.vertex_index_bytes*3;ga=E.vertex_index_bytes*3+E.material_index_bytes;X=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes;ha=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*
  461. 2;e=E.vertex_index_bytes;Ja=E.vertex_index_bytes*2;ta=E.vertex_index_bytes*3;Da=E.vertex_index_bytes*4;ca=E.vertex_index_bytes*4+E.material_index_bytes;ua=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes;da=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*2;sa=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*3;na=E.uv_index_bytes;ra=E.uv_index_bytes*2;oa=E.uv_index_bytes;ea=E.uv_index_bytes*2;Aa=E.uv_index_bytes*3;h=E.vertex_index_bytes*3+E.material_index_bytes;
  462. Ua=E.vertex_index_bytes*4+E.material_index_bytes;Oa=E.ntri_flat*h;fa=E.ntri_smooth*(h+E.normal_index_bytes*3);xa=E.ntri_flat_uv*(h+E.uv_index_bytes*3);Ma=E.ntri_smooth_uv*(h+E.normal_index_bytes*3+E.uv_index_bytes*3);Qa=E.nquad_flat*Ua;h=E.nquad_smooth*(Ua+E.normal_index_bytes*4);Ua=E.nquad_flat_uv*(Ua+E.uv_index_bytes*4);S+=function(L){for(var Z,ja,la,Na=E.vertex_coordinate_bytes*3,fb=L+E.nvertices*Na;L<fb;L+=Na){Z=j(b,L);ja=j(b,L+E.vertex_coordinate_bytes);la=j(b,L+E.vertex_coordinate_bytes*2);
  463. THREE.BinaryLoader.prototype.v(C,Z,ja,la)}return E.nvertices*Na}(S);S+=function(L){for(var Z,ja,la,Na=E.normal_coordinate_bytes*3,fb=L+E.nnormals*Na;L<fb;L+=Na){Z=o(b,L);ja=o(b,L+E.normal_coordinate_bytes);la=o(b,L+E.normal_coordinate_bytes*2);T.push(Z/127,ja/127,la/127)}return E.nnormals*Na}(S);S+=function(L){for(var Z,ja,la=E.uv_coordinate_bytes*2,Na=L+E.nuvs*la;L<Na;L+=la){Z=j(b,L);ja=j(b,L+E.uv_coordinate_bytes);O.push(Z,ja)}return E.nuvs*la}(S);Oa=S+Oa;fa=Oa+fa;xa=fa+xa;Ma=xa+Ma;Qa=Ma+Qa;h=Qa+
  464. h;Ua=h+Ua;(function(L){var Z,ja=E.vertex_index_bytes*3+E.material_index_bytes,la=ja+E.uv_index_bytes*3,Na=L+E.ntri_flat_uv*la;for(Z=L;Z<Na;Z+=la){x(Z);I(Z+ja)}return Na-L})(fa);(function(L){var Z,ja=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,la=ja+E.uv_index_bytes*3,Na=L+E.ntri_smooth_uv*la;for(Z=L;Z<Na;Z+=la){y(Z);I(Z+ja)}return Na-L})(xa);(function(L){var Z,ja=E.vertex_index_bytes*4+E.material_index_bytes,la=ja+E.uv_index_bytes*4,Na=L+E.nquad_flat_uv*la;for(Z=L;Z<Na;Z+=
  465. la){t(Z);H(Z+ja)}return Na-L})(h);(function(L){var Z,ja=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,la=ja+E.uv_index_bytes*4,Na=L+E.nquad_smooth_uv*la;for(Z=L;Z<Na;Z+=la){u(Z);H(Z+ja)}return Na-L})(Ua);(function(L){var Z,ja=E.vertex_index_bytes*3+E.material_index_bytes,la=L+E.ntri_flat*ja;for(Z=L;Z<la;Z+=ja)x(Z);return la-L})(S);(function(L){var Z,ja=E.vertex_index_bytes*3+E.material_index_bytes+E.normal_index_bytes*3,la=L+E.ntri_smooth*ja;for(Z=L;Z<la;Z+=ja)y(Z);return la-
  466. L})(Oa);(function(L){var Z,ja=E.vertex_index_bytes*4+E.material_index_bytes,la=L+E.nquad_flat*ja;for(Z=L;Z<la;Z+=ja)t(Z);return la-L})(Ma);(function(L){var Z,ja=E.vertex_index_bytes*4+E.material_index_bytes+E.normal_index_bytes*4,la=L+E.nquad_smooth*ja;for(Z=L;Z<la;Z+=ja)u(Z);return la-L})(Qa);this.computeCentroids();this.computeFaceNormals()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;d(new g(c))},v:function(b,d,c,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(d,c,f)))},f3:function(b,
  467. d,c,f,g){b.faces.push(new THREE.Face3(d,c,f,null,null,b.materials[g]))},f4:function(b,d,c,f,g,h){b.faces.push(new THREE.Face4(d,c,f,g,null,null,b.materials[h]))},f3n:function(b,d,c,f,g,h,j,k,m){h=b.materials[h];var o=d[k*3],p=d[k*3+1];k=d[k*3+2];var x=d[m*3],y=d[m*3+1];m=d[m*3+2];b.faces.push(new THREE.Face3(c,f,g,[new THREE.Vector3(d[j*3],d[j*3+1],d[j*3+2]),new THREE.Vector3(o,p,k),new THREE.Vector3(x,y,m)],null,h))},f4n:function(b,d,c,f,g,h,j,k,m,o,p){j=b.materials[j];var x=d[m*3],y=d[m*3+1];m=
  468. d[m*3+2];var t=d[o*3],u=d[o*3+1];o=d[o*3+2];var I=d[p*3],H=d[p*3+1];p=d[p*3+2];b.faces.push(new THREE.Face4(c,f,g,h,[new THREE.Vector3(d[k*3],d[k*3+1],d[k*3+2]),new THREE.Vector3(x,y,m),new THREE.Vector3(t,u,o),new THREE.Vector3(I,H,p)],null,j))},uv3:function(b,d,c,f,g,h,j){var k=[];k.push(new THREE.UV(d,c));k.push(new THREE.UV(f,g));k.push(new THREE.UV(h,j));b.push(k)},uv4:function(b,d,c,f,g,h,j,k,m){var o=[];o.push(new THREE.UV(d,c));o.push(new THREE.UV(f,g));o.push(new THREE.UV(h,j));o.push(new THREE.UV(k,
  469. m));b.push(o)}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
  470. THREE.SceneLoader.prototype={load:function(b,d){var c=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(h){function j(na,ra){return ra=="relativeToHTML"?na:g+"/"+na}function k(){for(t in X.objects)if(!ca.objects[t]){S=X.objects[t];if(S.geometry!==undefined){if(Q=ca.geometries[S.geometry]){ga=[];for(sa=0;sa<S.materials.length;sa++)ga[sa]=ca.materials[S.materials[sa]];E=S.position;r=S.rotation;q=S.quaternion;s=S.scale;q=0;ga.length==0&&(ga[0]=
  471. new THREE.MeshFaceMaterial);ga.length>1&&(ga=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(Q,ga);object.name=t;object.position.set(E[0],E[1],E[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=S.visible;ca.scene.addObject(object);ca.objects[t]=object;if(S.meshCollider){var na=THREE.CollisionUtils.MeshColliderWBox(object);ca.scene.collisions.colliders.push(na)}if(S.castsShadow){na=
  472. new THREE.ShadowVolume(Q);ca.scene.addChild(na);na.position=object.position;na.rotation=object.rotation;na.scale=object.scale}if(S.trigger&&S.trigger.toLowerCase()!="none"){na={type:S.trigger,object:S};ca.triggers[object.name]=na}}}else{E=S.position;r=S.rotation;q=S.quaternion;s=S.scale;q=0;object=new THREE.Object3D;object.name=t;object.position.set(E[0],E[1],E[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],
  473. s[1],s[2]);object.visible=S.visible!==undefined?S.visible:!1;ca.scene.addObject(object);ca.objects[t]=object;ca.empties[t]=object;if(S.trigger&&S.trigger.toLowerCase()!="none"){na={type:S.trigger,object:S};ca.triggers[object.name]=na}}}}function m(na){return function(ra){ca.geometries[na]=ra;k();e-=1;c.onLoadComplete();p()}}function o(na){return function(ra){ca.geometries[na]=ra}}function p(){c.callbackProgress({totalModels:ta,totalTextures:Da,loadedModels:ta-e,loadedTextures:Da-Ja},ca);c.onLoadProgress();
  474. e==0&&Ja==0&&d(ca)}var x,y,t,u,I,H,C,S,E,T,O,Q,ya,aa,ga,X,ha,e,Ja,ta,Da,ca;X=h.data;h=new THREE.BinaryLoader;ha=new THREE.JSONLoader;Ja=e=0;ca={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var ua=!1;for(t in X.objects){S=X.objects[t];if(S.meshCollider){ua=!0;break}}if(ua)ca.scene.collisions=new THREE.CollisionSystem;if(X.transform){ua=X.transform.position;T=X.transform.rotation;var da=X.transform.scale;ua&&ca.scene.position.set(ua[0],
  475. ua[1],ua[2]);T&&ca.scene.rotation.set(T[0],T[1],T[2]);da&&ca.scene.scale.set(da[0],da[1],da[2]);(ua||T||da)&&ca.scene.updateMatrix()}ua=function(){Ja-=1;p();c.onLoadComplete()};for(I in X.cameras){T=X.cameras[I];if(T.type=="perspective")ya=new THREE.Camera(T.fov,T.aspect,T.near,T.far);else if(T.type=="ortho"){ya=new THREE.Camera;ya.projectionMatrix=THREE.Matrix4.makeOrtho(T.left,T.right,T.top,T.bottom,T.near,T.far)}E=T.position;T=T.target;ya.position.set(E[0],E[1],E[2]);ya.target.position.set(T[0],
  476. T[1],T[2]);ca.cameras[I]=ya}for(u in X.lights){I=X.lights[u];ya=I.color!==undefined?I.color:16777215;T=I.intensity!==undefined?I.intensity:1;if(I.type=="directional"){E=I.direction;light=new THREE.DirectionalLight(ya,T);light.position.set(E[0],E[1],E[2]);light.position.normalize()}else if(I.type=="point"){E=I.position;light=new THREE.PointLight(ya,T);light.position.set(E[0],E[1],E[2])}ca.scene.addLight(light);ca.lights[u]=light}for(H in X.fogs){u=X.fogs[H];if(u.type=="linear")aa=new THREE.Fog(0,u.near,
  477. u.far);else u.type=="exp2"&&(aa=new THREE.FogExp2(0,u.density));T=u.color;aa.color.setRGB(T[0],T[1],T[2]);ca.fogs[H]=aa}if(ca.cameras&&X.defaults.camera)ca.currentCamera=ca.cameras[X.defaults.camera];if(ca.fogs&&X.defaults.fog)ca.scene.fog=ca.fogs[X.defaults.fog];T=X.defaults.bgcolor;ca.bgColor=new THREE.Color;ca.bgColor.setRGB(T[0],T[1],T[2]);ca.bgColorAlpha=X.defaults.bgalpha;for(x in X.geometries){H=X.geometries[x];if(H.type=="bin_mesh"||H.type=="ascii_mesh"){e+=1;c.onLoadStart()}}ta=e;for(x in X.geometries){H=
  478. X.geometries[x];if(H.type=="cube"){Q=new THREE.Cube(H.width,H.height,H.depth,H.segmentsWidth,H.segmentsHeight,H.segmentsDepth,null,H.flipped,H.sides);ca.geometries[x]=Q}else if(H.type=="plane"){Q=new THREE.Plane(H.width,H.height,H.segmentsWidth,H.segmentsHeight);ca.geometries[x]=Q}else if(H.type=="sphere"){Q=new THREE.Sphere(H.radius,H.segmentsWidth,H.segmentsHeight);ca.geometries[x]=Q}else if(H.type=="cylinder"){Q=new THREE.Cylinder(H.numSegs,H.topRad,H.botRad,H.height,H.topOffset,H.botOffset);ca.geometries[x]=
  479. Q}else if(H.type=="torus"){Q=new THREE.Torus(H.radius,H.tube,H.segmentsR,H.segmentsT);ca.geometries[x]=Q}else if(H.type=="icosahedron"){Q=new THREE.Icosahedron(H.subdivisions);ca.geometries[x]=Q}else if(H.type=="bin_mesh")h.load({model:j(H.url,X.urlBaseType),callback:m(x)});else if(H.type=="ascii_mesh")ha.load({model:j(H.url,X.urlBaseType),callback:m(x)});else if(H.type=="embedded_mesh")(H=X.embeds[H.id])&&ha.createModel(H,o(x),"")}for(C in X.textures){x=X.textures[C];if(x.url instanceof Array){Ja+=
  480. x.url.length;for(h=0;h<x.url.length;h++)c.onLoadStart()}else{Ja+=1;c.onLoadStart()}}Da=Ja;for(C in X.textures){x=X.textures[C];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){h=[];for(var sa=0;sa<x.url.length;sa++)h[sa]=j(x.url[sa],X.urlBaseType);h=THREE.ImageUtils.loadTextureCube(h,x.mapping,ua)}else{h=THREE.ImageUtils.loadTexture(j(x.url,X.urlBaseType),x.mapping,ua);if(THREE[x.minFilter]!=undefined)h.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=
  481. undefined)h.magFilter=THREE[x.magFilter]}ca.textures[C]=h}for(y in X.materials){C=X.materials[y];for(O in C.parameters)if(O=="envMap"||O=="map"||O=="lightMap")C.parameters[O]=ca.textures[C.parameters[O]];else if(O=="shading")C.parameters[O]=C.parameters[O]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(O=="blending")C.parameters[O]=THREE[C.parameters[O]]?THREE[C.parameters[O]]:THREE.NormalBlending;else if(O=="combine")C.parameters[O]=C.parameters[O]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
  482. else if(O=="vertexColors")if(C.parameters[O]=="face")C.parameters[O]=THREE.FaceColors;else if(C.parameters[O])C.parameters[O]=THREE.VertexColors;if(C.parameters.opacity!==undefined&&C.parameters.opacity<1)C.parameters.transparent=!0;C=new THREE[C.type](C.parameters);ca.materials[y]=C}k();c.callbackSync(ca)}}};
  483. THREE.MarchingCubes=function(b,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(c){this.isolation=80;this.size=c;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=
  484. 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,f,g){return c+(f-c)*g};this.VIntX=function(c,f,g,h,j,k,m,o,p,x){j=(j-p)/(x-p);p=this.normal_cache;f[h]=k+j*this.delta;f[h+1]=m;f[h+2]=o;g[h]=this.lerp(p[c],p[c+3],j);g[h+1]=this.lerp(p[c+1],p[c+4],j);g[h+2]=this.lerp(p[c+2],p[c+5],j)};this.VIntY=function(c,f,g,h,j,k,m,o,p,x){j=(j-p)/(x-p);p=this.normal_cache;f[h]=k;f[h+1]=m+j*this.delta;f[h+
  485. 2]=o;f=c+this.yd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.VIntZ=function(c,f,g,h,j,k,m,o,p,x){j=(j-p)/(x-p);p=this.normal_cache;f[h]=k;f[h+1]=m;f[h+2]=o+j*this.delta;f=c+this.zd*3;g[h]=this.lerp(p[c],p[f],j);g[h+1]=this.lerp(p[c+1],p[f+1],j);g[h+2]=this.lerp(p[c+2],p[f+2],j)};this.compNorm=function(c){var f=c*3;if(this.normal_cache[f]==0){this.normal_cache[f]=this.field[c-1]-this.field[c+1];this.normal_cache[f+1]=this.field[c-this.yd]-
  486. this.field[c+this.yd];this.normal_cache[f+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,f,g,h,j,k){var m=h+1,o=h+this.yd,p=h+this.zd,x=m+this.yd,y=m+this.zd,t=h+this.yd+this.zd,u=m+this.yd+this.zd,I=0,H=this.field[h],C=this.field[m],S=this.field[o],E=this.field[x],T=this.field[p],O=this.field[y],Q=this.field[t],ya=this.field[u];H<j&&(I|=1);C<j&&(I|=2);S<j&&(I|=8);E<j&&(I|=4);T<j&&(I|=16);O<j&&(I|=32);Q<j&&(I|=128);ya<j&&(I|=64);var aa=THREE.edgeTable[I];if(aa==0)return 0;
  487. var ga=this.delta,X=c+ga,ha=f+ga;ga=g+ga;if(aa&1){this.compNorm(h);this.compNorm(m);this.VIntX(h*3,this.vlist,this.nlist,0,j,c,f,g,H,C)}if(aa&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,j,X,f,g,C,E)}if(aa&4){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,6,j,c,ha,g,S,E)}if(aa&8){this.compNorm(h);this.compNorm(o);this.VIntY(h*3,this.vlist,this.nlist,9,j,c,f,g,H,S)}if(aa&16){this.compNorm(p);this.compNorm(y);this.VIntX(p*3,this.vlist,this.nlist,
  488. 12,j,c,f,ga,T,O)}if(aa&32){this.compNorm(y);this.compNorm(u);this.VIntY(y*3,this.vlist,this.nlist,15,j,X,f,ga,O,ya)}if(aa&64){this.compNorm(t);this.compNorm(u);this.VIntX(t*3,this.vlist,this.nlist,18,j,c,ha,ga,Q,ya)}if(aa&128){this.compNorm(p);this.compNorm(t);this.VIntY(p*3,this.vlist,this.nlist,21,j,c,f,ga,T,Q)}if(aa&256){this.compNorm(h);this.compNorm(p);this.VIntZ(h*3,this.vlist,this.nlist,24,j,c,f,g,H,T)}if(aa&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,j,X,
  489. f,g,C,O)}if(aa&1024){this.compNorm(x);this.compNorm(u);this.VIntZ(x*3,this.vlist,this.nlist,30,j,X,ha,g,E,ya)}if(aa&2048){this.compNorm(o);this.compNorm(t);this.VIntZ(o*3,this.vlist,this.nlist,33,j,c,ha,g,S,Q)}I<<=4;for(j=h=0;THREE.triTable[I+j]!=-1;){c=I+j;f=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[f],3*THREE.triTable[g],k);j+=3;h++}return h};this.posnormtriv=function(c,f,g,h,j,k){var m=this.count*3;this.positionArray[m]=c[g];this.positionArray[m+1]=c[g+
  490. 1];this.positionArray[m+2]=c[g+2];this.positionArray[m+3]=c[h];this.positionArray[m+4]=c[h+1];this.positionArray[m+5]=c[h+2];this.positionArray[m+6]=c[j];this.positionArray[m+7]=c[j+1];this.positionArray[m+8]=c[j+2];this.normalArray[m]=f[g];this.normalArray[m+1]=f[g+1];this.normalArray[m+2]=f[g+2];this.normalArray[m+3]=f[h];this.normalArray[m+4]=f[h+1];this.normalArray[m+5]=f[h+2];this.normalArray[m+6]=f[j];this.normalArray[m+7]=f[j+1];this.normalArray[m+8]=f[j+2];this.hasPos=!0;this.hasNormal=!0;
  491. this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var f=this.count*3;f<this.positionArray.length;f++)this.positionArray[f]=0;c(this)}};this.addBall=function(c,f,g,h,j){var k=this.size*Math.sqrt(h/j),m=g*this.size,o=f*this.size,p=c*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(o-k);y<1&&(y=1);o=Math.floor(o+k);o>this.size-1&&(o=
  492. this.size-1);var t=Math.floor(p-k);t<1&&(t=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-1);for(var u,I,H,C,S,E;x<m;x++){p=this.size2*x;I=x/this.size-g;S=I*I;for(I=y;I<o;I++){H=p+this.size*I;u=I/this.size-f;E=u*u;for(u=t;u<k;u++){C=u/this.size-c;C=h/(1.0E-6+C*C+E+S)-j;C>0&&(this.field[H+u]+=C)}}}};this.addPlaneX=function(c,f){var g,h,j,k,m,o=this.size,p=this.yd,x=this.zd,y=this.field,t=o*Math.sqrt(c/f);t>o&&(t=o);for(g=0;g<t;g++){h=g/o;h*=h;k=c/(1.0E-4+h)-f;if(k>0)for(h=0;h<o;h++){m=g+h*p;for(j=
  493. 0;j<o;j++)y[x*j+m]+=k}}};this.addPlaneY=function(c,f){var g,h,j,k,m,o,p=this.size,x=this.yd,y=this.zd,t=this.field,u=p*Math.sqrt(c/f);u>p&&(u=p);for(h=0;h<u;h++){g=h/p;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=h*x;for(g=0;g<p;g++){o=m+g;for(j=0;j<p;j++)t[y*j+o]+=k}}}};this.addPlaneZ=function(c,f){var g,h,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/f);dist>size&&(dist=size);for(j=0;j<dist;j++){g=j/size;g*=g;k=c/(1.0E-4+g)-f;if(k>0){m=zd*j;for(h=0;h<size;h++){o=m+h*yd;
  494. for(g=0;g<size;g++)field[o+g]+=k}}}};this.reset=function(){var c;for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var f,g,h,j,k,m,o,p,x,y=this.size-2;for(j=1;j<y;j++){x=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(h=1;h<y;h++){p=x+this.size*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){k=(g-this.halfsize)/this.halfsize;f=p+g;this.polygonize(k,m,o,f,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,f=new THREE.Geometry,
  495. g=[];this.render(function(h){var j,k,m,o,p,x,y,t;for(j=0;j<h.count;j++){y=j*3;p=y+1;t=y+2;k=h.positionArray[y];m=h.positionArray[p];o=h.positionArray[t];x=new THREE.Vector3(k,m,o);k=h.normalArray[y];m=h.normalArray[p];o=h.normalArray[t];y=new THREE.Vector3(k,m,o);y.normalize();p=new THREE.Vertex(x);f.vertices.push(p);g.push(y)}nfaces=h.count/3;for(j=0;j<nfaces;j++){y=(c+j)*3;p=y+1;t=y+2;x=g[y];k=g[p];m=g[t];y=new THREE.Face3(y,p,t,[x,k,m]);f.faces.push(y)}c+=nfaces;h.count=0});return f};this.init(b)};
  496. THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
  497. 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,
  498. 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,
  499. 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]);
  500. 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,
  501. -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,
  502. -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,
  503. -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,
  504. 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,
  505. -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,
  506. 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,
  507. -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,
  508. 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,
  509. 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,
  510. 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,
  511. 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,
  512. -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,
  513. -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,
  514. -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,
  515. 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,
  516. -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,
  517. 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,
  518. 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,
  519. -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,
  520. 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]);
  521. THREE.Trident=function(b){function d(h){return new THREE.Mesh(new THREE.Cylinder(30,0.1,b.length/20,b.length/5),new THREE.MeshBasicMaterial({color:h}))}function c(h,j){var k=new THREE.Geometry;k.vertices=[new THREE.Vertex,new THREE.Vertex(h)];return new THREE.Line(k,new THREE.LineBasicMaterial({color:j}))}THREE.Object3D.call(this);var f=Math.PI/2,g;b=b||THREE.Trident.defaultParams;if(b!==THREE.Trident.defaultParams)for(g in THREE.Trident.defaultParams)b.hasOwnProperty(g)||(b[g]=THREE.Trident.defaultParams[g]);
  522. this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(c(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(c(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(c(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows){g=d(b.xAxisColor);g.rotation.y=-f;g.position.x=b.length;this.addChild(g);g=d(b.yAxisColor);g.rotation.x=f;g.position.y=b.length;this.addChild(g);g=d(b.zAxisColor);g.rotation.y=Math.PI;g.position.z=b.length;this.addChild(g)}};
  523. THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,d){this.point=b;this.normal=d};THREE.SphereCollider=function(b,d){this.center=b;this.radius=d;this.radiusSq=d*d};THREE.BoxCollider=function(b,d){this.min=b;this.max=d;this.dynamic=!0;this.normal=new THREE.Vector3};
  524. THREE.MeshCollider=function(b,d){this.mesh=b;this.box=d;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
  525. THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var d,c,f,g,h=0;d=0;for(c=this.colliders.length;d<c;d++){g=this.colliders[d];f=this.rayCast(b,g);if(f<Number.MAX_VALUE){g.distance=f;f>h?this.hits.push(g):this.hits.unshift(g);h=f}}return this.hits};
  526. THREE.CollisionSystem.prototype.rayCastNearest=function(b){var d=this.rayCastAll(b);if(d.length==0)return null;for(var c=0;d[c]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,d[c]);if(f.dist<Number.MAX_VALUE){d[c].distance=f.dist;d[c].faceIndex=f.faceIndex;break}c++}if(c>d.length)return null;return d[c]};
  527. THREE.CollisionSystem.prototype.rayCast=function(b,d){if(d instanceof THREE.PlaneCollider)return this.rayPlane(b,d);else if(d instanceof THREE.SphereCollider)return this.raySphere(b,d);else if(d instanceof THREE.BoxCollider)return this.rayBox(b,d);else if(d instanceof THREE.MeshCollider&&d.box)return this.rayBox(b,d.box)};
  528. THREE.CollisionSystem.prototype.rayMesh=function(b,d){for(var c=this.makeRayLocal(b,d.mesh),f=Number.MAX_VALUE,g,h=0;h<d.numFaces;h++){var j=d.mesh.geometry.faces[h],k=d.mesh.geometry.vertices[j.a].position,m=d.mesh.geometry.vertices[j.b].position,o=d.mesh.geometry.vertices[j.c].position,p=j instanceof THREE.Face4?d.mesh.geometry.vertices[j.d].position:null;if(j instanceof THREE.Face3){j=this.rayTriangle(c,k,m,o,f,this.collisionNormal);if(j<f){f=j;g=h;d.normal.copy(this.collisionNormal);d.normal.normalize()}}else if(j instanceof
  529. THREE.Face4){j=this.rayTriangle(c,k,m,p,f,this.collisionNormal);if(j<f){f=j;g=h;d.normal.copy(this.collisionNormal);d.normal.normalize()}j=this.rayTriangle(c,m,o,p,f,this.collisionNormal);if(j<f){f=j;g=h;d.normal.copy(this.collisionNormal);d.normal.normalize()}}}return{dist:f,faceIndex:g}};
  530. THREE.CollisionSystem.prototype.rayTriangle=function(b,d,c,f,g,h){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;h.set(0,0,0);j.sub(c,d);k.sub(f,c);h.cross(j,k);k=h.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=h.dot(d)-h.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*g))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);if(Math.abs(h.x)>Math.abs(h.y))if(Math.abs(h.x)>Math.abs(h.z)){b=k.y-d.y;h=c.y-
  531. d.y;g=f.y-d.y;k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;h=c.x-d.x;g=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}else if(Math.abs(h.y)>Math.abs(h.z)){b=k.x-d.x;h=c.x-d.x;g=f.x-d.x;k=k.z-d.z;c=c.z-d.z;f=f.z-d.z}else{b=k.x-d.x;h=c.x-d.x;g=f.x-d.x;k=k.y-d.y;c=c.y-d.y;f=f.y-d.y}d=h*f-c*g;if(d==0)return Number.MAX_VALUE;d=1/d;f=(b*f-k*g)*d;if(!(f>=0))return Number.MAX_VALUE;d*=h*k-c*b;if(!(d>=0))return Number.MAX_VALUE;if(!(1-f-d>=0))return Number.MAX_VALUE;return j};
  532. THREE.CollisionSystem.prototype.makeRayLocal=function(b,d){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(d.matrixWorld,c);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);c.multiplyVector3(f.origin);c.rotateAxis(f.direction);f.direction.normalize();return f};
  533. THREE.CollisionSystem.prototype.rayBox=function(b,d){var c;if(d.dynamic&&d.mesh&&d.mesh.matrixWorld)c=this.makeRayLocal(b,d.mesh);else{c=THREE.CollisionSystem.__r;c.origin.copy(b.origin);c.direction.copy(b.direction)}var f=0,g=0,h=0,j=0,k=0,m=0,o=!0;if(c.origin.x<d.min.x){f=d.min.x-c.origin.x;f/=c.direction.x;o=!1;j=-1}else if(c.origin.x>d.max.x){f=d.max.x-c.origin.x;f/=c.direction.x;o=!1;j=1}if(c.origin.y<d.min.y){g=d.min.y-c.origin.y;g/=c.direction.y;o=!1;k=-1}else if(c.origin.y>d.max.y){g=d.max.y-
  534. c.origin.y;g/=c.direction.y;o=!1;k=1}if(c.origin.z<d.min.z){h=d.min.z-c.origin.z;h/=c.direction.z;o=!1;m=-1}else if(c.origin.z>d.max.z){h=d.max.z-c.origin.z;h/=c.direction.z;o=!1;m=1}if(o)return-1;o=0;if(g>f){o=1;f=g}if(h>f){o=2;f=h}switch(o){case 0:k=c.origin.y+c.direction.y*f;if(k<d.min.y||k>d.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*f;if(c<d.min.z||c>d.max.z)return Number.MAX_VALUE;d.normal.set(j,0,0);break;case 1:j=c.origin.x+c.direction.x*f;if(j<d.min.x||j>d.max.x)return Number.MAX_VALUE;
  535. c=c.origin.z+c.direction.z*f;if(c<d.min.z||c>d.max.z)return Number.MAX_VALUE;d.normal.set(0,k,0);break;case 2:j=c.origin.x+c.direction.x*f;if(j<d.min.x||j>d.max.x)return Number.MAX_VALUE;k=c.origin.y+c.direction.y*f;if(k<d.min.y||k>d.max.y)return Number.MAX_VALUE;d.normal.set(0,0,m)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,d){var c=b.direction.dot(d.normal),f=d.point.dot(d.normal);if(c<0)c=(f-b.origin.dot(d.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
  536. THREE.CollisionSystem.prototype.raySphere=function(b,d){var c=d.center.clone().subSelf(b.origin);if(c.lengthSq<d.radiusSq)return-1;var f=c.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;c=d.radiusSq-(c.lengthSq()-f*f);if(c>=0)return Math.abs(f)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
  537. THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var d=b.geometry.boundingBox,c=new THREE.Vector3(d.x[0],d.y[0],d.z[0]);d=new THREE.Vector3(d.x[1],d.y[1],d.z[1]);c=new THREE.BoxCollider(c,d);c.mesh=b;return c};THREE.CollisionUtils.MeshAABB=function(b){var d=THREE.CollisionUtils.MeshOBB(b);d.min.addSelf(b.position);d.max.addSelf(b.position);d.dynamic=!1;return d};
  538. THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};