123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445 |
- // Three.js r37 - http://github.com/mrdoob/three.js
- var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
- THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var e,f,g,j,k,m;if(b==0)e=f=g=0;else{j=Math.floor(a*6);k=a*6-j;a=b*(1-c);m=b*(1-c*k);c=b*(1-c*(1-k));switch(j){case 1:e=m;f=b;g=a;break;case 2:e=a;f=b;g=c;break;case 3:e=a;f=m;g=b;break;case 4:e=c;f=a;g=b;break;case 5:e=b;f=a;
- g=m;break;case 6:case 0:e=b;f=c;g=a}}this.r=e;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
- 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
- THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
- this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,b){this.set(a||0,c||0,b||0)};
- THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
- c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,b=this.y,e=this.z;this.set(b*a.z-e*a.y,e*a.x-c*a.z,c*a.y-b*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
- a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,b=this.y-a.y;a=this.z-a.z;return c*c+b*b+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
- this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
- 1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,e){this.set(a||0,c||0,b||0,e||1)};
- THREE.Vector4.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
- a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
- THREE.Ray.prototype={intersectScene:function(a){var c,b,e=a.objects,f=[];a=0;for(c=e.length;a<c;a++){b=e[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,j){return g.distance-j.distance});return f},intersectObject:function(a){function c(I,J,L,B){B=B.clone().subSelf(J);L=L.clone().subSelf(J);var N=I.clone().subSelf(J);I=B.dot(B);J=B.dot(L);B=B.dot(N);var P=L.dot(L);L=L.dot(N);N=1/(I*P-J*J);P=(P*B-J*L)*N;I=(I*L-J*B)*N;return P>0&&I>0&&P+I<1}var b,e,f,g,j,k,m,o,n,x,
- z,y=a.geometry,A=y.vertices,G=[];b=0;for(e=y.faces.length;b<e;b++){f=y.faces[b];x=this.origin.clone();z=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(A[f.a].position.clone());j=m.multiplyVector3(A[f.b].position.clone());k=m.multiplyVector3(A[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(A[f.d].position.clone()):null;o=a.matrixRotationWorld.multiplyVector3(f.normal.clone());n=z.dot(o);if(n<0){o=o.dot((new THREE.Vector3).sub(g,x))/n;x=x.addSelf(z.multiplyScalar(o));
- if(f instanceof THREE.Face3){if(c(x,g,j,k)){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};G.push(f)}}else if(f instanceof THREE.Face4&&(c(x,g,j,m)||c(x,j,k,m))){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};G.push(f)}}}return G}};
- THREE.Rectangle=function(){function a(){g=e-c;j=f-b}var c,b,e,f,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,o,n,x){k=!1;c=m;b=o;e=n;f=x;a()};this.addPoint=function(m,o){if(k){k=!1;c=m;b=o;e=m;f=o}else{c=c<m?c:m;b=b<o?b:o;e=e>m?e:m;f=f>o?f:o}a()};
- this.add3Points=function(m,o,n,x,z,y){if(k){k=!1;c=m<n?m<z?m:z:n<z?n:z;b=o<x?o<y?o:y:x<y?x:y;e=m>n?m>z?m:z:n>z?n:z;f=o>x?o>y?o:y:x>y?x:y}else{c=m<n?m<z?m<c?m:c:z<c?z:c:n<z?n<c?n:c:z<c?z:c;b=o<x?o<y?o<b?o:b:y<b?y:b:x<y?x<b?x:b:y<b?y:b;e=m>n?m>z?m>e?m:e:z>e?z:e:n>z?n>e?n:e:z>e?z:e;f=o>x?o>y?o>f?o:f:y>f?y:f:x>y?x>f?x:f:y>f?y:f}a()};this.addRectangle=function(m){if(k){k=!1;c=m.getLeft();b=m.getTop();e=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();e=e>m.getRight()?
- e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;e+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();e=e<m.getRight()?e:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(b,m.getTop())>=0};this.empty=function(){k=!0;f=e=b=c=0;a()};this.isEmpty=function(){return k}};
- THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
- THREE.Matrix4=function(a,c,b,e,f,g,j,k,m,o,n,x,z,y,A,G){this.set(a||1,c||0,b||0,e||0,f||0,g||1,j||0,k||0,m||0,o||0,n||1,x||0,z||0,y||0,A||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,j,k,m,o,n,x,z,y,A,G){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=n;this.n34=x;this.n41=z;this.n42=y;this.n43=A;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var e=THREE.Matrix4.__v1,
- f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;e.cross(b,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(b,g).normalize()}f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,f=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
- e+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*e+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();
- return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,j=a.n21,k=a.n22,m=a.n23,o=a.n24,n=a.n31,x=a.n32,z=a.n33,y=a.n34,A=a.n41,G=a.n42,I=a.n43,J=a.n44,L=c.n11,B=c.n12,N=c.n13,P=c.n14,R=c.n21,ma=c.n22,
- d=c.n23,da=c.n24,W=c.n31,$=c.n32,Y=c.n33,ta=c.n34;this.n11=b*L+e*R+f*W;this.n12=b*B+e*ma+f*$;this.n13=b*N+e*d+f*Y;this.n14=b*P+e*da+f*ta+g;this.n21=j*L+k*R+m*W;this.n22=j*B+k*ma+m*$;this.n23=j*N+k*d+m*Y;this.n24=j*P+k*da+m*ta+o;this.n31=n*L+x*R+z*W;this.n32=n*B+x*ma+z*$;this.n33=n*N+x*d+z*Y;this.n34=n*P+x*da+z*ta+y;this.n41=A*L+G*R+I*W;this.n42=A*B+G*ma+I*$;this.n43=A*N+G*d+I*Y;this.n44=A*P+G*da+I*ta+J;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);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;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
- determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,n=this.n33,x=this.n34,z=this.n41,y=this.n42,A=this.n43,G=this.n44;return e*j*o*z-b*k*o*z-e*g*n*z+c*k*n*z+b*g*x*z-c*j*x*z-e*j*m*y+b*k*m*y+e*f*n*y-a*k*n*y-b*f*x*y+a*j*x*y+e*g*m*A-c*k*m*A-e*f*o*A+a*k*o*A+c*f*x*A-a*g*x*A-b*g*m*G+c*j*m*G+b*f*o*G-a*j*o*G-c*f*n*G+a*g*n*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
- a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;
- this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;
- a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
- setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),f=1-b,g=a.x,j=a.y,k=
- a.z,m=f*g,o=f*j;this.set(m*g+b,m*j-e*k,m*k+e*j,0,m*j+e*k,o*j+b,o*k-e*g,0,m*k-e*j,o*k+e*g,f*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(e);e=Math.sin(e);var j=a*b,k=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=k*g+a*e;this.n22=-k*e+a*g;this.n23=-c*f;this.n31=-j*g+c*e;this.n32=j*e+c*g;this.n33=a*f;return this},
- setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,f=a.w,g=c+c,j=b+b,k=e+e;a=c*g;var m=c*j;c*=k;var o=b*j;b*=k;e*=k;g*=f;j*=f;f*=k;this.n11=1-(o+e);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-j;this.n32=b+g;this.n33=1-(a+o);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
- a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,e=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
- THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,j=a.n21,k=a.n22,m=a.n23,o=a.n24,n=a.n31,x=a.n32,z=a.n33,y=a.n34,A=a.n41,G=a.n42,I=a.n43,J=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*y*G-o*z*G+o*x*I-k*y*I-m*x*J+k*z*J;c.n12=g*z*G-f*y*G-g*x*I+e*y*I+f*x*J-e*z*J;c.n13=f*o*G-g*m*G+g*k*I-e*o*I-f*k*J+e*m*J;c.n14=g*m*x-f*o*x-g*k*z+e*o*z+f*k*y-e*m*y;c.n21=o*z*A-m*y*A-o*n*I+j*y*I+m*n*J-j*z*J;c.n22=f*y*A-g*z*A+g*n*I-b*y*I-f*n*J+b*z*J;c.n23=g*m*A-f*o*A-g*j*I+b*o*I+f*j*J-b*m*J;
- c.n24=f*o*n-g*m*n+g*j*z-b*o*z-f*j*y+b*m*y;c.n31=k*y*A-o*x*A+o*n*G-j*y*G-k*n*J+j*x*J;c.n32=g*x*A-e*y*A-g*n*G+b*y*G+e*n*J-b*x*J;c.n33=f*o*A-g*k*A+g*j*G-b*o*G-e*j*J+b*k*J;c.n34=g*k*n-e*o*n-g*j*x+b*o*x+e*j*y-b*k*y;c.n41=m*x*A-k*z*A-m*n*G+j*z*G+k*n*I-j*x*I;c.n42=e*z*A-f*x*A+f*n*G-b*z*G-e*n*I+b*x*I;c.n43=f*k*A-e*m*A-f*j*G+b*m*G+e*j*I-b*k*I;c.n44=e*m*n-f*k*n+f*j*x-b*m*x-e*j*z+b*k*z;c.multiplyScalar(1/a.determinant());return c};
- THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*e;b[1]=a*f;b[2]=a*g;b[3]=a*j;b[4]=a*k;b[5]=a*m;b[6]=a*o;b[7]=a*n;b[8]=a*x;return c};
- THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var j;j=new THREE.Matrix4;j.n11=2*f/(c-a);j.n12=0;j.n13=(c+a)/(c-a);j.n14=0;j.n21=0;j.n22=2*f/(e-b);j.n23=(e+b)/(e-b);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+f)/(g-f);j.n34=-2*g*f/(g-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,c,b,e){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,e)};
- THREE.Matrix4.makeOrtho=function(a,c,b,e,f,g){var j,k,m,o;j=new THREE.Matrix4;k=c-a;m=b-e;o=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+a)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((b+e)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((g+f)/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;
- THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
- !0;this._vector=new THREE.Vector3};
- THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
- undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
- 1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
- c,b)}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==undefined?e:1)};
- THREE.Quaternion.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,e=a.y*c,f=a.z*c;a=Math.cos(e);e=Math.sin(e);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var j=a*c,k=e*f;this.w=j*g-k*b;this.x=j*b+k*g;this.y=e*c*g+a*f*b;this.z=a*f*g-e*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
- -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,e=this.z,f=this.w,g=a.x,j=a.y,k=a.z;a=a.w;this.x=c*a+f*g+b*k-e*j;this.y=b*a+f*j+e*g-c*k;this.z=e*a+f*k+c*j-b*g;this.w=f*a-c*g-b*j-e*k;return this},
- multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,f=a.z,g=this.x,j=this.y,k=this.z,m=this.w,o=m*b+j*f-k*e,n=m*e+k*b-g*f,x=m*f+g*e-j*b;b=-g*b-j*e-k*f;c.x=o*m+b*-g+n*-k-x*-j;c.y=n*m+b*-j+x*-g-o*-k;c.z=x*m+b*-k+o*-j-n*-g;return c}};
- THREE.Quaternion.slerp=function(a,c,b,e){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.001){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}f=Math.sin((1-e)*g)/j;e=Math.sin(e*g)/j;b.w=a.w*f+c.w*e;b.x=a.x*f+c.x*e;b.y=a.y*f+c.y*e;b.z=a.z*f+c.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
- THREE.Face3=function(a,c,b,e,f,g){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
- THREE.Face4=function(a,c,b,e,f,g,j){this.a=a;this.b=c;this.c=b;this.d=e;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=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
- THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
- THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
- b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,e,f,g,j,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){k.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];j=this.vertices[g.c];k.sub(j.position,b.position);m.sub(c.position,b.position);k.crossSelf(m)}k.isZero()||
- k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=
- this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal);e[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(e[b.a]);
- b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(e[b.a]);b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c]);b.vertexNormals[3].copy(e[b.d])}}},computeTangents:function(){function a(V,ja,na,S,Q,fa,la){k=V.vertices[ja].position;m=V.vertices[na].position;o=V.vertices[S].position;n=j[Q];x=j[fa];z=j[la];y=m.x-k.x;A=o.x-k.x;G=m.y-k.y;I=o.y-k.y;J=m.z-k.z;L=o.z-k.z;B=x.u-n.u;N=z.u-n.u;P=x.v-n.v;R=z.v-n.v;ma=1/(B*R-N*P);
- $.set((R*y-P*A)*ma,(R*G-P*I)*ma,(R*J-P*L)*ma);Y.set((B*A-N*y)*ma,(B*I-N*G)*ma,(B*L-N*J)*ma);da[ja].addSelf($);da[na].addSelf($);da[S].addSelf($);W[ja].addSelf(Y);W[na].addSelf(Y);W[S].addSelf(Y)}var c,b,e,f,g,j,k,m,o,n,x,z,y,A,G,I,J,L,B,N,P,R,ma,d,da=[],W=[],$=new THREE.Vector3,Y=new THREE.Vector3,ta=new THREE.Vector3,wa=new THREE.Vector3,xa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){da[c]=new THREE.Vector3;W[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];
- j=this.faceVertexUvs[0][c];if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var ka=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++){xa.copy(g.vertexNormals[e]);f=g[ka[e]];d=da[f];ta.copy(d);ta.subSelf(xa.multiplyScalar(xa.dot(d))).normalize();wa.cross(g.vertexNormals[e],d);f=wa.dot(W[f]);f=f<0?-1:1;g.vertexTangents[e]=new THREE.Vector4(ta.x,ta.y,ta.z,
- f)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
- if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
- {radius:a}}};THREE.GeometryIdCounter=0;
- THREE.Spline=function(a){function c(y,A,G,I,J,L,B){y=(G-y)*0.5;I=(I-A)*0.5;return(2*(A-G)+y+I)*B+(-3*(A-G)-2*y-I)*L+y*J+A}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,j,k,m,o,n,x,z;this.initFromArray=function(y){this.points=[];for(var A=0;A<y.length;A++)this.points[A]={x:y[A][0],y:y[A][1],z:y[A][2]}};this.getPoint=function(y){f=(this.points.length-1)*y;g=Math.floor(f);j=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;o=this.points[b[0]];n=this.points[b[1]];
- x=this.points[b[2]];z=this.points[b[3]];k=j*j;m=j*k;e.x=c(o.x,n.x,x.x,z.x,j,k,m);e.y=c(o.y,n.y,x.y,z.y,j,k,m);e.z=c(o.z,n.z,x.z,z.z,j,k,m);return e};this.getControlPointsArray=function(){var y,A,G=this.points.length,I=[];for(y=0;y<G;y++){A=this.points[y];I[y]=[A.x,A.y,A.z]}return I};this.getLength=function(y){var A,G,I=A=A=0,J=new THREE.Vector3,L=new THREE.Vector3,B=[],N=0;B[0]=0;y||(y=100);G=this.points.length*y;J.copy(this.points[0]);for(y=1;y<G;y++){A=y/G;position=this.getPoint(A);L.copy(position);
- N+=L.distanceTo(J);J.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=I){B[A]=N;I=A}}B[B.length]=N;return{chunks:B,total:N}};this.reparametrizeByArcLength=function(y){var A,G,I,J,L,B,N=[],P=new THREE.Vector3,R=this.getLength();N.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){G=R.chunks[A]-R.chunks[A-1];B=Math.ceil(y*G/R.total);J=(A-1)/(this.points.length-1);L=A/(this.points.length-1);for(G=1;G<B-1;G++){I=J+G*(1/B)*(L-J);position=this.getPoint(I);N.push(P.copy(position).clone())}N.push(P.copy(this.points[A]).clone())}this.points=
- N}};
- THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var j=0;j<f.hierarchy[g].keys.length;j++){if(f.hierarchy[g].keys[j].time<0)f.hierarchy[g].keys[j].time=
- 0;if(f.hierarchy[g].keys[j].rot!==undefined&&!(f.hierarchy[g].keys[j].rot instanceof THREE.Quaternion)){var k=f.hierarchy[g].keys[j].rot;f.hierarchy[g].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(j=0;j<f.hierarchy[g].keys.length;j++)for(var m=0;m<f.hierarchy[g].keys[j].morphTargets.length;m++){var o=f.hierarchy[g].keys[j].morphTargets[m];k[o]=-1}f.hierarchy[g].usedMorphTargets=k;for(j=0;j<f.hierarchy[g].keys.length;j++){var n=
- {};for(o in k){for(m=0;m<f.hierarchy[g].keys[j].morphTargets.length;m++)if(f.hierarchy[g].keys[j].morphTargets[m]===o){n[o]=f.hierarchy[g].keys[j].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[j].morphTargets.length&&(n[o]=0)}f.hierarchy[g].keys[j].morphTargetsInfluences=n}}for(j=1;j<f.hierarchy[g].keys.length;j++)if(f.hierarchy[g].keys[j].time===f.hierarchy[g].keys[j-1].time){f.hierarchy[g].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[g].keys.length;j++)f.hierarchy[g].keys[j].index=j}j=parseInt(f.length*
- f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(j));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)g.push(f.bones[j]);else e(f,g);return g};var e=function(f,g){g.push(f);for(var j=0;j<f.children.length;j++)e(f.children[j],g)};b.LINEAR=
- 0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
- THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,e=this.hierarchy.length,f;for(b=0;b<e;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
- f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
- THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
- THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
- THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,g,j,k,m,o,n=this.data.JIT.hierarchy,x,z;this.currentTime+=a*this.timeScale;z=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 y=0,A=this.hierarchy.length;y<A;y++){a=this.hierarchy[y];m=a.animationCache;if(this.JITCompile&&n[y][o]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[y][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
- !1}else{a.matrix=n[y][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var G=0;G<3;G++){b=c[G];j=m.prevKey[b];k=m.nextKey[b];if(k.time<=z){if(x<z)if(this.loop){j=this.data.hierarchy[y].keys[0];for(k=this.getNextKeyWith(b,y,1);k.time<x;){j=k;k=this.getNextKeyWith(b,y,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(b,y,k.index+1)}while(k.time<
- x)}m.prevKey[b]=j;m.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(x-j.time)/(k.time-j.time);f=j[b];g=k[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+y);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
- this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",y,k.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
- "rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}}}}if(this.JITCompile&&n[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)n[y][o]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
- THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,g,j,k,m,o;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];k=a[b[1]];m=a[b[2]];o=a[b[3]];b=f*f;j=f*b;e[0]=this.interpolate(g[0],k[0],m[0],o[0],f,b,j);e[1]=this.interpolate(g[1],k[1],m[1],o[1],f,b,j);e[2]=this.interpolate(g[2],k[2],m[2],o[2],f,b,j);return e};
- THREE.Animation.prototype.interpolate=function(a,c,b,e,f,g,j){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*j+(-3*(c-b)-2*a-e)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[0]};
- THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
- THREE.Camera=function(a,c,b,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
- THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
- THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
- !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
- THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=b||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=b||0};THREE.PointLight.prototype=new THREE.Light;
- THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;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(){};
- THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
- a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
- if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
- if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;
- if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
- !1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.envMap!==undefined)this.envMap=a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
- if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;
- if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
- THREE.MeshPhongMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=
- this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.lightMap!==undefined)this.lightMap=a.lightMap;if(a.map!==undefined)this.map=a.map;if(a.envMap!==undefined)this.envMap=
- a.envMap;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refractionRatio!==undefined)this.refractionRatio=a.refractionRatio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;
- if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
- THREE.MeshDepthMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
- undefined)this.wireframeLinewidth=a.wireframeLinewidth}};
- THREE.MeshNormalMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==
- undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=function(){};
- THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=!1;this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==
- undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;
- if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
- THREE.ShadowVolumeDynamicMaterial=function(){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
- !1};
- THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=a.sizeAttenuation;
- if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
- THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};
- THREE.Texture=function(a,c,b,e,f,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
- 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;
- THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
- THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
- var Uniforms={clone:function(a){var c,b,e,f={};for(c in a){f[c]={};for(b in a[c]){e=a[c][b];f[c][b]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return f},merge:function(a){var c,b,e,f={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(b in e)f[b]=e[b]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
- THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=b!=undefined?b:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
- THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
- THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var b=0;b<this.geometry.morphTargets.length;b++){this.morphTargetInfluences.push(0);
- this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
- THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
- c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
- THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,e,f,g,j,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;j=f.rotq;k=f.scl;e=this.addBone();e.name=f.name;e.position.set(g[0],g[1],g[2]);e.quaternion.set(j[0],j[1],j[2],j[3]);e.useQuaternion=!0;k!==undefined?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
- e=this.bones[b];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
- THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
- c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
- THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
- e=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(e));e=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
- THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
- THREE.Sound=function(a,c,b,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var f;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
- "audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
- THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
- THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
- THREE.Sound.prototype.update=function(a,c,b){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
- THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,c){c===undefined&&(c=0);c=Math.abs(c);for(var b=0;b<this.LODs.length;b++)if(c<this.LODs[b].visibleAtDistance)break;this.LODs.splice(b,0,{visibleAtDistance:c,object3D:a});this.addChild(a)};
- THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=b.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible=
- !1;this.LODs[e].object3D.visible=!0}else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
- THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
- THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,b=this.geometry.faces,e=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,j,k,m,o,n,x=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;j=f[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);b.push(k);for(k=
- 0;k<o;k++){n=a[j[x[k]]];c.push(new THREE.Vertex(n.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(j=g+1;j<f.length;j++){k=b[j];k=this.facesShareEdge(c,a,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);e.push(k)}}}};
- THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var e,f,g,j,k,m,o,n,x,z,y,A,G,I=0,J=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(A=0;A<e;A++){g=c[J[A]];k=a[g];for(G=0;G<f;G++){j=b[J[G]];m=a[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){I++;if(I===1){o=k;n=m;x=g;z=j;y=J[A]}if(I===2){y+=J[A];return y==="ad"||y==="ac"?{faces:[c,b],vertices:[o,n,m,k],indices:[x,
- z,j,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[o,k,m,n],indices:[x,g,j,z],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
- THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
- THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
- THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
- THREE.Projector=function(){function a(){var $=m[k]=m[k]||new THREE.RenderableVertex;k++;return $}function c($,Y){return Y.z-$.z}function b($,Y){var ta=0,wa=1,xa=$.z+$.w,ka=Y.z+Y.w,V=-$.z+$.w,ja=-Y.z+Y.w;if(xa>=0&&ka>=0&&V>=0&&ja>=0)return!0;else if(xa<0&&ka<0||V<0&&ja<0)return!1;else{if(xa<0)ta=Math.max(ta,xa/(xa-ka));else ka<0&&(wa=Math.min(wa,xa/(xa-ka)));if(V<0)ta=Math.max(ta,V/(V-ja));else ja<0&&(wa=Math.min(wa,V/(V-ja)));if(wa<ta)return!1;else{$.lerpSelf(Y,ta);Y.lerpSelf($,1-wa);return!0}}}var e,
- f,g=[],j,k,m=[],o,n,x=[],z,y=[],A,G,I=[],J,L,B=[],N=new THREE.Vector4,P=new THREE.Vector4,R=new THREE.Matrix4,ma=new THREE.Matrix4,d=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],da=new THREE.Vector4,W=new THREE.Vector4;this.projectVector=function($,Y){R.multiply(Y.projectionMatrix,Y.matrixWorldInverse);R.multiplyVector3($);return $};this.unprojectVector=function($,Y){R.multiply(Y.matrixWorld,THREE.Matrix4.makeInvert(Y.projectionMatrix));
- R.multiplyVector3($);return $};this.projectObjects=function($,Y,ta){Y=[];var wa,xa,ka;f=0;xa=$.objects;$=0;for(wa=xa.length;$<wa;$++){ka=xa[$];var V;if(!(V=!ka.visible))if(V=ka instanceof THREE.Mesh){a:{V=void 0;for(var ja=ka.matrixWorld,na=-ka.geometry.boundingSphere.radius*Math.max(ka.scale.x,Math.max(ka.scale.y,ka.scale.z)),S=0;S<6;S++){V=d[S].x*ja.n14+d[S].y*ja.n24+d[S].z*ja.n34+d[S].w;if(V<=na){V=!1;break a}}V=!0}V=!V}if(!V){V=g[f]=g[f]||new THREE.RenderableObject;f++;e=V;N.copy(ka.position);
- R.multiplyVector3(N);e.object=ka;e.z=N.z;Y.push(e)}}ta&&Y.sort(c);return Y};this.projectScene=function($,Y,ta){var wa=[],xa=Y.near,ka=Y.far,V,ja,na,S,Q,fa,la,ha,sa,Aa,Ga,Ta,ab,Ja,h,t,w;L=G=z=n=0;Y.matrixAutoUpdate&&Y.updateMatrix();$.update(undefined,!1,Y);R.multiply(Y.projectionMatrix,Y.matrixWorldInverse);d[0].set(R.n41-R.n11,R.n42-R.n12,R.n43-R.n13,R.n44-R.n14);d[1].set(R.n41+R.n11,R.n42+R.n12,R.n43+R.n13,R.n44+R.n14);d[2].set(R.n41+R.n21,R.n42+R.n22,R.n43+R.n23,R.n44+R.n24);d[3].set(R.n41-R.n21,
- R.n42-R.n22,R.n43-R.n23,R.n44-R.n24);d[4].set(R.n41-R.n31,R.n42-R.n32,R.n43-R.n33,R.n44-R.n34);d[5].set(R.n41+R.n31,R.n42+R.n32,R.n43+R.n33,R.n44+R.n34);for(V=0;V<6;V++){sa=d[V];sa.divideScalar(Math.sqrt(sa.x*sa.x+sa.y*sa.y+sa.z*sa.z))}sa=this.projectObjects($,Y,!0);$=0;for(V=sa.length;$<V;$++){Aa=sa[$].object;if(Aa.visible){Ga=Aa.matrixWorld;Ta=Aa.matrixRotationWorld;ab=Aa.materials;Ja=Aa.overdraw;k=0;if(Aa instanceof THREE.Mesh){h=Aa.geometry;S=h.vertices;t=h.faces;h=h.faceVertexUvs;ja=0;for(na=
- S.length;ja<na;ja++){j=a();j.positionWorld.copy(S[ja].position);Ga.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);R.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>xa&&j.positionScreen.z<ka}S=0;for(ja=t.length;S<ja;S++){na=t[S];if(na instanceof THREE.Face3){Q=m[na.a];fa=m[na.b];la=m[na.c];if(Q.visible&&fa.visible&&la.visible&&(Aa.doubleSided||Aa.flipSided!=(la.positionScreen.x-Q.positionScreen.x)*
- (fa.positionScreen.y-Q.positionScreen.y)-(la.positionScreen.y-Q.positionScreen.y)*(fa.positionScreen.x-Q.positionScreen.x)<0)){ha=x[n]=x[n]||new THREE.RenderableFace3;n++;o=ha;o.v1.copy(Q);o.v2.copy(fa);o.v3.copy(la)}else continue}else if(na instanceof THREE.Face4){Q=m[na.a];fa=m[na.b];la=m[na.c];ha=m[na.d];if(Q.visible&&fa.visible&&la.visible&&ha.visible&&(Aa.doubleSided||Aa.flipSided!=((ha.positionScreen.x-Q.positionScreen.x)*(fa.positionScreen.y-Q.positionScreen.y)-(ha.positionScreen.y-Q.positionScreen.y)*
- (fa.positionScreen.x-Q.positionScreen.x)<0||(fa.positionScreen.x-la.positionScreen.x)*(ha.positionScreen.y-la.positionScreen.y)-(fa.positionScreen.y-la.positionScreen.y)*(ha.positionScreen.x-la.positionScreen.x)<0))){w=y[z]=y[z]||new THREE.RenderableFace4;z++;o=w;o.v1.copy(Q);o.v2.copy(fa);o.v3.copy(la);o.v4.copy(ha)}else continue}o.normalWorld.copy(na.normal);Ta.multiplyVector3(o.normalWorld);o.centroidWorld.copy(na.centroid);Ga.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);
- R.multiplyVector3(o.centroidScreen);la=na.vertexNormals;Q=0;for(fa=la.length;Q<fa;Q++){ha=o.vertexNormalsWorld[Q];ha.copy(la[Q]);Ta.multiplyVector3(ha)}Q=0;for(fa=h.length;Q<fa;Q++)if(w=h[Q][S]){la=0;for(ha=w.length;la<ha;la++)o.uvs[Q][la]=w[la]}o.meshMaterials=ab;o.faceMaterials=na.materials;o.overdraw=Ja;o.z=o.centroidScreen.z;wa.push(o)}}else if(Aa instanceof THREE.Line){ma.multiply(R,Ga);S=Aa.geometry.vertices;Q=a();Q.positionScreen.copy(S[0].position);ma.multiplyVector4(Q.positionScreen);ja=
- 1;for(na=S.length;ja<na;ja++){Q=a();Q.positionScreen.copy(S[ja].position);ma.multiplyVector4(Q.positionScreen);fa=m[k-2];da.copy(Q.positionScreen);W.copy(fa.positionScreen);if(b(da,W)){da.multiplyScalar(1/da.w);W.multiplyScalar(1/W.w);Ga=I[G]=I[G]||new THREE.RenderableLine;G++;A=Ga;A.v1.positionScreen.copy(da);A.v2.positionScreen.copy(W);A.z=Math.max(da.z,W.z);A.materials=Aa.materials;wa.push(A)}}}else if(Aa instanceof THREE.Particle){P.set(Aa.position.x,Aa.position.y,Aa.position.z,1);R.multiplyVector4(P);
- P.z/=P.w;if(P.z>0&&P.z<1){Ga=B[L]=B[L]||new THREE.RenderableParticle;L++;J=Ga;J.x=P.x/P.w;J.y=P.y/P.w;J.z=P.z;J.rotation=Aa.rotation.z;J.scale.x=Aa.scale.x*Math.abs(J.x-(P.x+Y.projectionMatrix.n11)/(P.w+Y.projectionMatrix.n14));J.scale.y=Aa.scale.y*Math.abs(J.y-(P.y+Y.projectionMatrix.n22)/(P.w+Y.projectionMatrix.n24));J.materials=Aa.materials;wa.push(J)}}}}ta&&wa.sort(c);return wa}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,f,g;this.domElement=document.createElement("div");this.setSize=function(j,k){b=j;e=k;f=b/2;g=e/2};this.render=function(j,k){var m,o,n,x,z,y,A,G;a=c.projectScene(j,k);m=0;for(o=a.length;m<o;m++){z=a[m];if(z instanceof THREE.RenderableParticle){A=z.x*f+f;G=z.y*g+g;n=0;for(x=z.material.length;n<x;n++){y=z.material[n];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=A+"px";y.style.top=G+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(Z){if(y!=Z)n.globalAlpha=y=Z}function c(Z){if(A!=Z){switch(Z){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}A=Z}}function b(Z){if(G!=Z)n.strokeStyle=G=Z}var e=null,f=new THREE.Projector,g=document.createElement("canvas"),j,k,m,o,n=g.getContext("2d"),x=new THREE.Color(0),z=0,y=1,A=0,G=null,I=null,
- J=1,L,B,N,P,R=new THREE.RenderableVertex,ma=new THREE.RenderableVertex,d,da,W,$,Y,ta,wa,xa,ka,V,ja,na,S=new THREE.Color,Q=new THREE.Color,fa=new THREE.Color,la=new THREE.Color,ha=new THREE.Color,sa,Aa,Ga,Ta,ab,Ja,h,t,w,p,D=new THREE.Rectangle,F=new THREE.Rectangle,H=new THREE.Rectangle,E=!1,C=new THREE.Color,T=new THREE.Color,K=new THREE.Color,ga=new THREE.Color,X=new THREE.Vector3,pa,va,Ka,ua,Ba,aa,ea=16;pa=document.createElement("canvas");pa.width=pa.height=2;va=pa.getContext("2d");va.fillStyle=
- "rgba(0,0,0,1)";va.fillRect(0,0,2,2);Ka=va.getImageData(0,0,2,2);ua=Ka.data;Ba=document.createElement("canvas");Ba.width=Ba.height=ea;aa=Ba.getContext("2d");aa.translate(-ea/2,-ea/2);aa.scale(ea,ea);ea--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(Z,Ca){j=Z;k=Ca;m=j/2;o=k/2;g.width=j;g.height=k;D.set(-m,-o,m,o);y=1;A=0;I=G=null;J=1};this.setClearColor=function(Z,Ca){x=Z;z=Ca};this.setClearColorHex=function(Z,Ca){x.setHex(Z);z=Ca};this.clear=function(){n.setTransform(1,
- 0,0,-1,m,o);if(!F.isEmpty()){F.inflate(1);F.minSelf(D);if(x.hex==0&&z==0)n.clearRect(F.getX(),F.getY(),F.getWidth(),F.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+Math.floor(x.b*255)+","+z+")";n.fillRect(F.getX(),F.getY(),F.getWidth(),F.getHeight())}F.empty()}};this.render=function(Z,Ca){function Wa(M){var qa,ia,ca,Ea=M.lights;T.setRGB(0,0,0);K.setRGB(0,0,0);ga.setRGB(0,0,0);M=0;for(qa=Ea.length;M<qa;M++){ia=Ea[M];ca=ia.color;if(ia instanceof
- THREE.AmbientLight){T.r+=ca.r;T.g+=ca.g;T.b+=ca.b}else if(ia instanceof THREE.DirectionalLight){K.r+=ca.r;K.g+=ca.g;K.b+=ca.b}else if(ia instanceof THREE.PointLight){ga.r+=ca.r;ga.g+=ca.g;ga.b+=ca.b}}}function Ya(M,qa,ia,ca){var Ea,ra,oa,U,Ha=M.lights;M=0;for(Ea=Ha.length;M<Ea;M++){ra=Ha[M];oa=ra.color;if(ra instanceof THREE.DirectionalLight){U=ia.dot(ra.position);if(!(U<=0)){U*=ra.intensity;ca.r+=oa.r*U;ca.g+=oa.g*U;ca.b+=oa.b*U}}else if(ra instanceof THREE.PointLight){U=ia.dot(X.sub(ra.position,
- qa).normalize());if(!(U<=0)){U*=ra.distance==0?1:1-Math.min(qa.distanceTo(ra.position)/ra.distance,1);if(U!=0){U*=ra.intensity;ca.r+=oa.r*U;ca.g+=oa.g*U;ca.b+=oa.b*U}}}}}function Na(M,qa,ia){a(ia.opacity);c(ia.blending);var ca,Ea,ra,oa,U,Ha;if(ia instanceof THREE.ParticleBasicMaterial){if(ia.map){oa=ia.map.image;U=oa.width>>1;Ha=oa.height>>1;ia=qa.scale.x*m;ra=qa.scale.y*o;ca=ia*U;Ea=ra*Ha;H.set(M.x-ca,M.y-Ea,M.x+ca,M.y+Ea);if(D.instersects(H)){n.save();n.translate(M.x,M.y);n.rotate(-qa.rotation);
- n.scale(ia,-ra);n.translate(-U,-Ha);n.drawImage(oa,0,0);n.restore()}}}else if(ia instanceof THREE.ParticleCanvasMaterial){ca=qa.scale.x*m;Ea=qa.scale.y*o;H.set(M.x-ca,M.y-Ea,M.x+ca,M.y+Ea);if(D.instersects(H)){b(ia.color.__styleString);ra=ia.color.__styleString;if(I!=ra)n.fillStyle=I=ra;n.save();n.translate(M.x,M.y);n.rotate(-qa.rotation);n.scale(ca,Ea);ia.program(n);n.restore()}}}function La(M,qa,ia,ca){a(ca.opacity);c(ca.blending);n.beginPath();n.moveTo(M.positionScreen.x,M.positionScreen.y);n.lineTo(qa.positionScreen.x,
- qa.positionScreen.y);n.closePath();if(ca instanceof THREE.LineBasicMaterial){S.__styleString=ca.color.__styleString;M=ca.linewidth;if(J!=M)n.lineWidth=J=M;b(S.__styleString);n.stroke();H.inflate(ca.linewidth*2)}}function Sa(M,qa,ia,ca,Ea,ra,oa,U,Ha){a(U.opacity);c(U.blending);d=M.positionScreen.x;da=M.positionScreen.y;W=qa.positionScreen.x;$=qa.positionScreen.y;Y=ia.positionScreen.x;ta=ia.positionScreen.y;bb(d,da,W,$,Y,ta);if(U instanceof THREE.MeshBasicMaterial)if(U.map){if(U.map.mapping instanceof
- THREE.UVMapping){Ta=oa.uvs[0];Ua(d,da,W,$,Y,ta,U.map.image,Ta[ca].u,Ta[ca].v,Ta[Ea].u,Ta[Ea].v,Ta[ra].u,Ta[ra].v)}}else if(U.envMap){if(U.envMap.mapping instanceof THREE.SphericalReflectionMapping){M=Ca.matrixWorldInverse;X.copy(oa.vertexNormalsWorld[0]);ab=(X.x*M.n11+X.y*M.n12+X.z*M.n13)*0.5+0.5;Ja=-(X.x*M.n21+X.y*M.n22+X.z*M.n23)*0.5+0.5;X.copy(oa.vertexNormalsWorld[1]);h=(X.x*M.n11+X.y*M.n12+X.z*M.n13)*0.5+0.5;t=-(X.x*M.n21+X.y*M.n22+X.z*M.n23)*0.5+0.5;X.copy(oa.vertexNormalsWorld[2]);w=(X.x*M.n11+
- X.y*M.n12+X.z*M.n13)*0.5+0.5;p=-(X.x*M.n21+X.y*M.n22+X.z*M.n23)*0.5+0.5;Ua(d,da,W,$,Y,ta,U.envMap.image,ab,Ja,h,t,w,p)}}else U.wireframe?Va(U.color.__styleString,U.wireframeLinewidth):Fa(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){if(U.map.mapping instanceof THREE.UVMapping){Ta=oa.uvs[0];Ua(d,da,W,$,Y,ta,U.map.image,Ta[ca].u,Ta[ca].v,Ta[Ea].u,Ta[Ea].v,Ta[ra].u,Ta[ra].v)}c(THREE.SubtractiveBlending)}if(E)if(!U.wireframe&&U.shading==THREE.SmoothShading&&
- oa.vertexNormalsWorld.length==3){Q.r=fa.r=la.r=T.r;Q.g=fa.g=la.g=T.g;Q.b=fa.b=la.b=T.b;Ya(Ha,oa.v1.positionWorld,oa.vertexNormalsWorld[0],Q);Ya(Ha,oa.v2.positionWorld,oa.vertexNormalsWorld[1],fa);Ya(Ha,oa.v3.positionWorld,oa.vertexNormalsWorld[2],la);ha.r=(fa.r+la.r)*0.5;ha.g=(fa.g+la.g)*0.5;ha.b=(fa.b+la.b)*0.5;Ga=Ra(Q,fa,la,ha);Ua(d,da,W,$,Y,ta,Ga,0,0,1,0,0,1)}else{C.r=T.r;C.g=T.g;C.b=T.b;Ya(Ha,oa.centroidWorld,oa.normalWorld,C);S.r=U.color.r*C.r;S.g=U.color.g*C.g;S.b=U.color.b*C.b;S.updateStyleString();
- U.wireframe?Va(S.__styleString,U.wireframeLinewidth):Fa(S.__styleString)}else U.wireframe?Va(U.color.__styleString,U.wireframeLinewidth):Fa(U.color.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){sa=Ca.near;Aa=Ca.far;Q.r=Q.g=Q.b=1-O(M.positionScreen.z,sa,Aa);fa.r=fa.g=fa.b=1-O(qa.positionScreen.z,sa,Aa);la.r=la.g=la.b=1-O(ia.positionScreen.z,sa,Aa);ha.r=(fa.r+la.r)*0.5;ha.g=(fa.g+la.g)*0.5;ha.b=(fa.b+la.b)*0.5;Ga=Ra(Q,fa,la,ha);Ua(d,da,W,$,Y,ta,Ga,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){S.r=
- Qa(oa.normalWorld.x);S.g=Qa(oa.normalWorld.y);S.b=Qa(oa.normalWorld.z);S.updateStyleString();U.wireframe?Va(S.__styleString,U.wireframeLinewidth):Fa(S.__styleString)}}function fb(M,qa,ia,ca,Ea,ra,oa,U,Ha){a(U.opacity);c(U.blending);if(U.map||U.envMap){Sa(M,qa,ca,0,1,3,oa,U,Ha);Sa(Ea,ia,ra,1,2,3,oa,U,Ha)}else{d=M.positionScreen.x;da=M.positionScreen.y;W=qa.positionScreen.x;$=qa.positionScreen.y;Y=ia.positionScreen.x;ta=ia.positionScreen.y;wa=ca.positionScreen.x;xa=ca.positionScreen.y;ka=Ea.positionScreen.x;
- V=Ea.positionScreen.y;ja=ra.positionScreen.x;na=ra.positionScreen.y;if(U instanceof THREE.MeshBasicMaterial){Xa(d,da,W,$,Y,ta,wa,xa);U.wireframe?Va(U.color.__styleString,U.wireframeLinewidth):Fa(U.color.__styleString)}else if(U instanceof THREE.MeshLambertMaterial)if(E)if(!U.wireframe&&U.shading==THREE.SmoothShading&&oa.vertexNormalsWorld.length==4){Q.r=fa.r=la.r=ha.r=T.r;Q.g=fa.g=la.g=ha.g=T.g;Q.b=fa.b=la.b=ha.b=T.b;Ya(Ha,oa.v1.positionWorld,oa.vertexNormalsWorld[0],Q);Ya(Ha,oa.v2.positionWorld,
- oa.vertexNormalsWorld[1],fa);Ya(Ha,oa.v4.positionWorld,oa.vertexNormalsWorld[3],la);Ya(Ha,oa.v3.positionWorld,oa.vertexNormalsWorld[2],ha);Ga=Ra(Q,fa,la,ha);bb(d,da,W,$,wa,xa);Ua(d,da,W,$,wa,xa,Ga,0,0,1,0,0,1);bb(ka,V,Y,ta,ja,na);Ua(ka,V,Y,ta,ja,na,Ga,1,0,1,1,0,1)}else{C.r=T.r;C.g=T.g;C.b=T.b;Ya(Ha,oa.centroidWorld,oa.normalWorld,C);S.r=U.color.r*C.r;S.g=U.color.g*C.g;S.b=U.color.b*C.b;S.updateStyleString();Xa(d,da,W,$,Y,ta,wa,xa);U.wireframe?Va(S.__styleString,U.wireframeLinewidth):Fa(S.__styleString)}else{Xa(d,
- da,W,$,Y,ta,wa,xa);U.wireframe?Va(U.color.__styleString,U.wireframeLinewidth):Fa(U.color.__styleString)}else if(U instanceof THREE.MeshNormalMaterial){S.r=Qa(oa.normalWorld.x);S.g=Qa(oa.normalWorld.y);S.b=Qa(oa.normalWorld.z);S.updateStyleString();Xa(d,da,W,$,Y,ta,wa,xa);U.wireframe?Va(S.__styleString,U.wireframeLinewidth):Fa(S.__styleString)}else if(U instanceof THREE.MeshDepthMaterial){sa=Ca.near;Aa=Ca.far;Q.r=Q.g=Q.b=1-O(M.positionScreen.z,sa,Aa);fa.r=fa.g=fa.b=1-O(qa.positionScreen.z,sa,Aa);la.r=
- la.g=la.b=1-O(ca.positionScreen.z,sa,Aa);ha.r=ha.g=ha.b=1-O(ia.positionScreen.z,sa,Aa);Ga=Ra(Q,fa,la,ha);bb(d,da,W,$,wa,xa);Ua(d,da,W,$,wa,xa,Ga,0,0,1,0,0,1);bb(ka,V,Y,ta,ja,na);Ua(ka,V,Y,ta,ja,na,Ga,1,0,1,1,0,1)}}}function bb(M,qa,ia,ca,Ea,ra){n.beginPath();n.moveTo(M,qa);n.lineTo(ia,ca);n.lineTo(Ea,ra);n.lineTo(M,qa);n.closePath()}function Xa(M,qa,ia,ca,Ea,ra,oa,U){n.beginPath();n.moveTo(M,qa);n.lineTo(ia,ca);n.lineTo(Ea,ra);n.lineTo(oa,U);n.lineTo(M,qa);n.closePath()}function Va(M,qa){b(M);if(J!=
- qa)n.lineWidth=J=qa;n.stroke();H.inflate(qa*2)}function Fa(M){if(I!=M)n.fillStyle=I=M;n.fill()}function Ua(M,qa,ia,ca,Ea,ra,oa,U,Ha,cb,$a,db,ib){var Za,eb;Za=oa.width-1;eb=oa.height-1;U*=Za;Ha*=eb;cb*=Za;$a*=eb;db*=Za;ib*=eb;ia-=M;ca-=qa;Ea-=M;ra-=qa;cb-=U;$a-=Ha;db-=U;ib-=Ha;Za=cb*ib-db*$a;if(Za!=0){eb=1/Za;Za=(ib*ia-$a*Ea)*eb;$a=(ib*ca-$a*ra)*eb;ia=(cb*Ea-db*ia)*eb;ca=(cb*ra-db*ca)*eb;M=M-Za*U-ia*Ha;qa=qa-$a*U-ca*Ha;n.save();n.transform(Za,$a,ia,ca,M,qa);n.clip();n.drawImage(oa,0,0);n.restore()}}
- function Ra(M,qa,ia,ca){var Ea=~~(M.r*255),ra=~~(M.g*255);M=~~(M.b*255);var oa=~~(qa.r*255),U=~~(qa.g*255);qa=~~(qa.b*255);var Ha=~~(ia.r*255),cb=~~(ia.g*255);ia=~~(ia.b*255);var $a=~~(ca.r*255),db=~~(ca.g*255);ca=~~(ca.b*255);ua[0]=Ea<0?0:Ea>255?255:Ea;ua[1]=ra<0?0:ra>255?255:ra;ua[2]=M<0?0:M>255?255:M;ua[4]=oa<0?0:oa>255?255:oa;ua[5]=U<0?0:U>255?255:U;ua[6]=qa<0?0:qa>255?255:qa;ua[8]=Ha<0?0:Ha>255?255:Ha;ua[9]=cb<0?0:cb>255?255:cb;ua[10]=ia<0?0:ia>255?255:ia;ua[12]=$a<0?0:$a>255?255:$a;ua[13]=db<
- 0?0:db>255?255:db;ua[14]=ca<0?0:ca>255?255:ca;va.putImageData(Ka,0,0);aa.drawImage(pa,0,0);return Ba}function O(M,qa,ia){M=(M-qa)/(ia-qa);return M*M*(3-2*M)}function Qa(M){M=(M+1)*0.5;return M<0?0:M>1?1:M}function Oa(M,qa){var ia=qa.x-M.x,ca=qa.y-M.y,Ea=1/Math.sqrt(ia*ia+ca*ca);ia*=Ea;ca*=Ea;qa.x+=ia;qa.y+=ca;M.x-=ia;M.y-=ca}var gb,kb,za,Da,Pa,Ia,Ma,ya;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,o);e=f.projectScene(Z,Ca,this.sortElements);(E=Z.lights.length>0)&&Wa(Z);gb=0;for(kb=e.length;gb<
- kb;gb++){za=e[gb];H.empty();if(za instanceof THREE.RenderableParticle){L=za;L.x*=m;L.y*=o;Da=0;for(Pa=za.materials.length;Da<Pa;){ya=za.materials[Da++];ya.opacity!=0&&Na(L,za,ya,Z)}}else if(za instanceof THREE.RenderableLine){L=za.v1;B=za.v2;L.positionScreen.x*=m;L.positionScreen.y*=o;B.positionScreen.x*=m;B.positionScreen.y*=o;H.addPoint(L.positionScreen.x,L.positionScreen.y);H.addPoint(B.positionScreen.x,B.positionScreen.y);if(D.instersects(H)){Da=0;for(Pa=za.materials.length;Da<Pa;){ya=za.materials[Da++];
- ya.opacity!=0&&La(L,B,za,ya,Z)}}}else if(za instanceof THREE.RenderableFace3){L=za.v1;B=za.v2;N=za.v3;L.positionScreen.x*=m;L.positionScreen.y*=o;B.positionScreen.x*=m;B.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;if(za.overdraw){Oa(L.positionScreen,B.positionScreen);Oa(B.positionScreen,N.positionScreen);Oa(N.positionScreen,L.positionScreen)}H.add3Points(L.positionScreen.x,L.positionScreen.y,B.positionScreen.x,B.positionScreen.y,N.positionScreen.x,N.positionScreen.y);if(D.instersects(H)){Da=
- 0;for(Pa=za.meshMaterials.length;Da<Pa;){ya=za.meshMaterials[Da++];if(ya instanceof THREE.MeshFaceMaterial){Ia=0;for(Ma=za.faceMaterials.length;Ia<Ma;)(ya=za.faceMaterials[Ia++])&&ya.opacity!=0&&Sa(L,B,N,0,1,2,za,ya,Z)}else ya.opacity!=0&&Sa(L,B,N,0,1,2,za,ya,Z)}}}else if(za instanceof THREE.RenderableFace4){L=za.v1;B=za.v2;N=za.v3;P=za.v4;L.positionScreen.x*=m;L.positionScreen.y*=o;B.positionScreen.x*=m;B.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;P.positionScreen.x*=m;P.positionScreen.y*=
- o;R.positionScreen.copy(B.positionScreen);ma.positionScreen.copy(P.positionScreen);if(za.overdraw){Oa(L.positionScreen,B.positionScreen);Oa(B.positionScreen,P.positionScreen);Oa(P.positionScreen,L.positionScreen);Oa(N.positionScreen,R.positionScreen);Oa(N.positionScreen,ma.positionScreen)}H.addPoint(L.positionScreen.x,L.positionScreen.y);H.addPoint(B.positionScreen.x,B.positionScreen.y);H.addPoint(N.positionScreen.x,N.positionScreen.y);H.addPoint(P.positionScreen.x,P.positionScreen.y);if(D.instersects(H)){Da=
- 0;for(Pa=za.meshMaterials.length;Da<Pa;){ya=za.meshMaterials[Da++];if(ya instanceof THREE.MeshFaceMaterial){Ia=0;for(Ma=za.faceMaterials.length;Ia<Ma;)(ya=za.faceMaterials[Ia++])&&ya.opacity!=0&&fb(L,B,N,P,R,ma,za,ya,Z)}else ya.opacity!=0&&fb(L,B,N,P,R,ma,za,ya,Z)}}}F.addRectangle(H)}n.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(ka,V,ja){var na,S,Q,fa;na=0;for(S=ka.lights.length;na<S;na++){Q=ka.lights[na];if(Q instanceof THREE.DirectionalLight){fa=V.normalWorld.dot(Q.position)*Q.intensity;if(fa>0){ja.r+=Q.color.r*fa;ja.g+=Q.color.g*fa;ja.b+=Q.color.b*fa}}else if(Q instanceof THREE.PointLight){da.sub(Q.position,V.centroidWorld);da.normalize();fa=V.normalWorld.dot(da)*Q.intensity;if(fa>0){ja.r+=Q.color.r*fa;ja.g+=Q.color.g*fa;ja.b+=Q.color.b*fa}}}}function c(ka,V,ja,na,S,Q){Y=e(ta++);
- Y.setAttribute("d","M "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+ja.positionScreen.x+","+ja.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)B.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(L){N.r=P.r;N.g=P.g;N.b=P.b;a(Q,na,N);B.r=S.color.r*N.r;B.g=S.color.g*N.g;B.b=S.color.b*N.b;B.updateStyleString()}else B.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){d=
- 1-S.__2near/(S.__farPlusNear-na.z*S.__farMinusNear);B.setRGB(d,d,d)}else S instanceof THREE.MeshNormalMaterial&&B.setRGB(f(na.normalWorld.x),f(na.normalWorld.y),f(na.normalWorld.z));S.wireframe?Y.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):Y.setAttribute("style","fill: "+B.__styleString+"; fill-opacity: "+S.opacity);k.appendChild(Y)}
- function b(ka,V,ja,na,S,Q,fa){Y=e(ta++);Y.setAttribute("d","M "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+ja.positionScreen.x+","+ja.positionScreen.y+" L "+na.positionScreen.x+","+na.positionScreen.y+"z");if(Q instanceof THREE.MeshBasicMaterial)B.__styleString=Q.color.__styleString;else if(Q instanceof THREE.MeshLambertMaterial)if(L){N.r=P.r;N.g=P.g;N.b=P.b;a(fa,S,N);B.r=Q.color.r*N.r;B.g=Q.color.g*N.g;B.b=Q.color.b*N.b;B.updateStyleString()}else B.__styleString=
- Q.color.__styleString;else if(Q instanceof THREE.MeshDepthMaterial){d=1-Q.__2near/(Q.__farPlusNear-S.z*Q.__farMinusNear);B.setRGB(d,d,d)}else Q instanceof THREE.MeshNormalMaterial&&B.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));Q.wireframe?Y.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+Q.wireframeLinewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.wireframeLinecap+"; stroke-linejoin: "+Q.wireframeLinejoin):Y.setAttribute("style","fill: "+
- B.__styleString+"; fill-opacity: "+Q.opacity);k.appendChild(Y)}function e(ka){if(W[ka]==null){W[ka]=document.createElementNS("http://www.w3.org/2000/svg","path");xa==0&&W[ka].setAttribute("shape-rendering","crispEdges")}return W[ka]}function f(ka){return ka<0?Math.min((1+ka)*0.5,0.5):0.5+Math.min(ka*0.5,0.5)}var g=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,o,n,x,z,y,A,G,I=new THREE.Rectangle,J=new THREE.Rectangle,L=!1,B=new THREE.Color(16777215),N=
- new THREE.Color(16777215),P=new THREE.Color(0),R=new THREE.Color(0),ma=new THREE.Color(0),d,da=new THREE.Vector3,W=[],$=[],Y,ta,wa,xa=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ka){switch(ka){case "high":xa=1;break;case "low":xa=0}};this.setSize=function(ka,V){m=ka;o=V;n=m/2;x=o/2;k.setAttribute("viewBox",-n+" "+-x+" "+m+" "+o);k.setAttribute("width",m);k.setAttribute("height",o);I.set(-n,-x,n,x)};this.clear=function(){for(;k.childNodes.length>
- 0;)k.removeChild(k.childNodes[0])};this.render=function(ka,V){var ja,na,S,Q,fa,la,ha,sa;this.autoClear&&this.clear();g=j.projectScene(ka,V,this.sortElements);wa=ta=0;if(L=ka.lights.length>0){ha=ka.lights;P.setRGB(0,0,0);R.setRGB(0,0,0);ma.setRGB(0,0,0);ja=0;for(na=ha.length;ja<na;ja++){S=ha[ja];Q=S.color;if(S instanceof THREE.AmbientLight){P.r+=Q.r;P.g+=Q.g;P.b+=Q.b}else if(S instanceof THREE.DirectionalLight){R.r+=Q.r;R.g+=Q.g;R.b+=Q.b}else if(S instanceof THREE.PointLight){ma.r+=Q.r;ma.g+=Q.g;ma.b+=
- Q.b}}}ja=0;for(na=g.length;ja<na;ja++){ha=g[ja];J.empty();if(ha instanceof THREE.RenderableParticle){z=ha;z.x*=n;z.y*=-x;S=0;for(Q=ha.materials.length;S<Q;)S++}else if(ha instanceof THREE.RenderableLine){z=ha.v1;y=ha.v2;z.positionScreen.x*=n;z.positionScreen.y*=-x;y.positionScreen.x*=n;y.positionScreen.y*=-x;J.addPoint(z.positionScreen.x,z.positionScreen.y);J.addPoint(y.positionScreen.x,y.positionScreen.y);if(I.instersects(J)){S=0;for(Q=ha.materials.length;S<Q;)if((sa=ha.materials[S++])&&sa.opacity!=
- 0){fa=z;la=y;var Aa=wa++;if($[Aa]==null){$[Aa]=document.createElementNS("http://www.w3.org/2000/svg","line");xa==0&&$[Aa].setAttribute("shape-rendering","crispEdges")}Y=$[Aa];Y.setAttribute("x1",fa.positionScreen.x);Y.setAttribute("y1",fa.positionScreen.y);Y.setAttribute("x2",la.positionScreen.x);Y.setAttribute("y2",la.positionScreen.y);if(sa instanceof THREE.LineBasicMaterial){B.__styleString=sa.color.__styleString;Y.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+
- sa.linewidth+"; stroke-opacity: "+sa.opacity+"; stroke-linecap: "+sa.linecap+"; stroke-linejoin: "+sa.linejoin);k.appendChild(Y)}}}}else if(ha instanceof THREE.RenderableFace3){z=ha.v1;y=ha.v2;A=ha.v3;z.positionScreen.x*=n;z.positionScreen.y*=-x;y.positionScreen.x*=n;y.positionScreen.y*=-x;A.positionScreen.x*=n;A.positionScreen.y*=-x;J.addPoint(z.positionScreen.x,z.positionScreen.y);J.addPoint(y.positionScreen.x,y.positionScreen.y);J.addPoint(A.positionScreen.x,A.positionScreen.y);if(I.instersects(J)){S=
- 0;for(Q=ha.meshMaterials.length;S<Q;){sa=ha.meshMaterials[S++];if(sa instanceof THREE.MeshFaceMaterial){fa=0;for(la=ha.faceMaterials.length;fa<la;)(sa=ha.faceMaterials[fa++])&&sa.opacity!=0&&c(z,y,A,ha,sa,ka)}else sa&&sa.opacity!=0&&c(z,y,A,ha,sa,ka)}}}else if(ha instanceof THREE.RenderableFace4){z=ha.v1;y=ha.v2;A=ha.v3;G=ha.v4;z.positionScreen.x*=n;z.positionScreen.y*=-x;y.positionScreen.x*=n;y.positionScreen.y*=-x;A.positionScreen.x*=n;A.positionScreen.y*=-x;G.positionScreen.x*=n;G.positionScreen.y*=
- -x;J.addPoint(z.positionScreen.x,z.positionScreen.y);J.addPoint(y.positionScreen.x,y.positionScreen.y);J.addPoint(A.positionScreen.x,A.positionScreen.y);J.addPoint(G.positionScreen.x,G.positionScreen.y);if(I.instersects(J)){S=0;for(Q=ha.meshMaterials.length;S<Q;){sa=ha.meshMaterials[S++];if(sa instanceof THREE.MeshFaceMaterial){fa=0;for(la=ha.faceMaterials.length;fa<la;)(sa=ha.faceMaterials[fa++])&&sa.opacity!=0&&b(z,y,A,G,ha,sa,ka)}else sa&&sa.opacity!=0&&b(z,y,A,G,ha,sa,ka)}}}}}};
- 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",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",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",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",
- 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}",
- 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;",
- 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",
- 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",
- default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"};
- 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",
- 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},
- fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
- THREE.ShaderLib={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}",
- fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},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}},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,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,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
- THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,
- THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
- THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
- THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),
- vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
- THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
- THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
- THREE.WebGLRenderer=function(a){function c(h,t,w){var p,D,F,H=h.vertices,E=H.length,C=h.colors,T=C.length,K=h.__vertexArray,ga=h.__colorArray,X=h.__sortArray,pa=h.__dirtyVertices,va=h.__dirtyColors;if(w.sortParticles){fa.multiplySelf(w.matrixWorld);for(p=0;p<E;p++){D=H[p].position;sa.copy(D);fa.multiplyVector3(sa);X[p]=[sa.z,p]}X.sort(function(Ka,ua){return ua[0]-Ka[0]});for(p=0;p<E;p++){D=H[X[p][1]].position;F=p*3;K[F]=D.x;K[F+1]=D.y;K[F+2]=D.z}for(p=0;p<T;p++){F=p*3;color=C[X[p][1]];ga[F]=color.r;
- ga[F+1]=color.g;ga[F+2]=color.b}}else{if(pa)for(p=0;p<E;p++){D=H[p].position;F=p*3;K[F]=D.x;K[F+1]=D.y;K[F+2]=D.z}if(va)for(p=0;p<T;p++){color=C[p];F=p*3;ga[F]=color.r;ga[F+1]=color.g;ga[F+2]=color.b}}if(pa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,K,t)}if(va||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,ga,t)}}function b(h,t){h.uniforms=Uniforms.clone(t.uniforms);h.vertexShader=t.vertexShader;
- h.fragmentShader=t.fragmentShader}function e(h,t,w,p,D){p.__webglProgram||Y.initMaterial(p,t,w,D);var F=p.program,H=F.uniforms,E=p.uniforms;if(F!=W){d.useProgram(F);W=F}d.uniformMatrix4fv(H.projectionMatrix,!1,la);if(w&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p instanceof THREE.ParticleBasicMaterial)){E.fogColor.value.setHex(w.color.hex);if(w instanceof THREE.Fog){E.fogNear.value=w.near;
- E.fogFar.value=w.far}else if(w instanceof THREE.FogExp2)E.fogDensity.value=w.density}if(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p.lights){var C,T,K=0,ga=0,X=0,pa,va,Ka,ua,Ba=Aa,aa=Ba.directional.colors,ea=Ba.directional.positions,Z=Ba.point.colors,Ca=Ba.point.positions,Wa=Ba.point.distances,Ya=0,Na=0;w=T=ua=0;for(C=t.length;w<C;w++){T=t[w];pa=T.color;va=T.position;Ka=T.intensity;ua=T.distance;if(T instanceof THREE.AmbientLight){K+=pa.r;ga+=pa.g;X+=pa.b}else if(T instanceof
- THREE.DirectionalLight){ua=Ya*3;aa[ua]=pa.r*Ka;aa[ua+1]=pa.g*Ka;aa[ua+2]=pa.b*Ka;ea[ua]=va.x;ea[ua+1]=va.y;ea[ua+2]=va.z;Ya+=1}else if(T instanceof THREE.PointLight){T=Na*3;Z[T]=pa.r*Ka;Z[T+1]=pa.g*Ka;Z[T+2]=pa.b*Ka;Ca[T]=va.x;Ca[T+1]=va.y;Ca[T+2]=va.z;Wa[Na]=ua;Na+=1}}for(w=Ya*3;w<aa.length;w++)aa[w]=0;for(w=Na*3;w<Z.length;w++)Z[w]=0;Ba.point.length=Na;Ba.directional.length=Ya;Ba.ambient[0]=K;Ba.ambient[1]=ga;Ba.ambient[2]=X;w=Aa;E.enableLighting.value=w.directional.length+w.point.length;E.ambientLightColor.value=
- w.ambient;E.directionalLightColor.value=w.directional.colors;E.directionalLightDirection.value=w.directional.positions;E.pointLightColor.value=w.point.colors;E.pointLightPosition.value=w.point.positions;E.pointLightDistance.value=w.point.distances}if(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity;E.map.texture=p.map;E.lightMap.texture=p.lightMap;E.envMap.texture=
- p.envMap;E.reflectivity.value=p.reflectivity;E.refractionRatio.value=p.refractionRatio;E.combine.value=p.combine;E.useRefract.value=p.envMap&&p.envMap.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity;E.size.value=p.size;E.scale.value=da.height/2;E.map.texture=
- p.map}else if(p instanceof THREE.MeshPhongMaterial){E.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);E.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);E.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){E.mNear.value=h.near;E.mFar.value=h.far;E.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)E.opacity.value=p.opacity;for(var La in E)if(ga=F.uniforms[La]){C=E[La];K=C.type;w=C.value;if(K=="i")d.uniform1i(ga,w);else if(K=="f")d.uniform1f(ga,
- w);else if(K=="fv1")d.uniform1fv(ga,w);else if(K=="fv")d.uniform3fv(ga,w);else if(K=="v2")d.uniform2f(ga,w.x,w.y);else if(K=="v3")d.uniform3f(ga,w.x,w.y,w.z);else if(K=="c")d.uniform3f(ga,w.r,w.g,w.b);else if(K=="t"){d.uniform1i(ga,w);if(C=C.texture)if(C.image instanceof Array&&C.image.length==6){if(C.image.length==6){if(C.needsUpdate){if(C.__webglInit){d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube);for(K=0;K<6;++K)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,d.RGBA,d.UNSIGNED_BYTE,
- C.image[K])}else{C.image.__webglTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube);for(K=0;K<6;++K)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,C.image[K]);C.__webglInit=!0}B(d.TEXTURE_CUBE_MAP,C,C.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);C.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube)}}else{if(C.needsUpdate){if(C.__webglInit){d.bindTexture(d.TEXTURE_2D,C.__webglTexture);
- d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,C.image)}else{C.__webglTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,C.__webglTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,C.image);C.__webglInit=!0}B(d.TEXTURE_2D,C,C.image);d.bindTexture(d.TEXTURE_2D,null);C.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_2D,C.__webglTexture)}}}d.uniformMatrix4fv(H.modelViewMatrix,!1,D._modelViewMatrixArray);d.uniformMatrix3fv(H.normalMatrix,!1,D._normalMatrixArray);
- (p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshPhongMaterial||p.envMap)&&d.uniform3f(H.cameraPosition,h.position.x,h.position.y,h.position.z);(p instanceof THREE.MeshShaderMaterial||p.envMap||p.skinning)&&d.uniformMatrix4fv(H.objectMatrix,!1,D._objectMatrixArray);(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||p.skinning)&&d.uniformMatrix4fv(H.viewMatrix,!1,ha);if(p instanceof THREE.ShadowVolumeDynamicMaterial){h=
- E.directionalLightDirection.value;h[0]=-t.position.x;h[1]=-t.position.y;h[2]=-t.position.z;d.uniform3fv(H.directionalLightDirection,h);d.uniformMatrix4fv(H.objectMatrix,!1,D._objectMatrixArray);d.uniformMatrix4fv(H.viewMatrix,!1,ha)}if(p.skinning){d.uniformMatrix4fv(H.cameraInverseMatrix,!1,ha);d.uniformMatrix4fv(H.boneGlobalMatrices,!1,D.boneMatrices)}return F}function f(h,t,w,p,D,F){if(p.opacity!=0){h=e(h,t,w,p,F).attributes;if(p.morphTargets){t=p.program.attributes;F.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,
- D.__webglMorphTargetsBuffers[F.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,D.__webglVertexBuffer);d.vertexAttribPointer(t.position,3,d.FLOAT,!1,0,0);if(F.morphTargetForcedOrder.length){w=0;for(var H=F.morphTargetForcedOrder,E=F.morphTargetInfluences;w<p.numSupportedMorphTargets&&w<H.length;){d.bindBuffer(d.ARRAY_BUFFER,D.__webglMorphTargetsBuffers[H[w]]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);F.__webglMorphTargetInfluences[w]=E[H[w]];w++}}else{H=[];var C=-1,T=0;E=F.morphTargetInfluences;
- var K,ga=E.length;w=0;for(F.morphTargetBase!==-1&&(H[F.morphTargetBase]=!0);w<p.numSupportedMorphTargets;){for(K=0;K<ga;K++)if(!H[K]&&E[K]>C){T=K;C=E[T]}d.bindBuffer(d.ARRAY_BUFFER,D.__webglMorphTargetsBuffers[T]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);F.__webglMorphTargetInfluences[w]=C;H[T]=1;C=-1;w++}}d.uniform1fv(p.program.uniforms.morphTargetInfluences,F.__webglMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,D.__webglVertexBuffer);d.vertexAttribPointer(h.position,
- 3,d.FLOAT,!1,0,0)}if(h.color>=0){d.bindBuffer(d.ARRAY_BUFFER,D.__webglColorBuffer);d.vertexAttribPointer(h.color,3,d.FLOAT,!1,0,0)}if(h.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,D.__webglNormalBuffer);d.vertexAttribPointer(h.normal,3,d.FLOAT,!1,0,0)}if(h.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,D.__webglTangentBuffer);d.vertexAttribPointer(h.tangent,4,d.FLOAT,!1,0,0)}if(h.uv>=0)if(D.__webglUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,D.__webglUVBuffer);d.vertexAttribPointer(h.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(h.uv)}else d.disableVertexAttribArray(h.uv);
- if(h.uv2>=0)if(D.__webglUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,D.__webglUV2Buffer);d.vertexAttribPointer(h.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(h.uv2)}else d.disableVertexAttribArray(h.uv2);if(p.skinning&&h.skinVertexA>=0&&h.skinVertexB>=0&&h.skinIndex>=0&&h.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,D.__webglSkinVertexABuffer);d.vertexAttribPointer(h.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,D.__webglSkinVertexBBuffer);d.vertexAttribPointer(h.skinVertexB,4,d.FLOAT,!1,0,
- 0);d.bindBuffer(d.ARRAY_BUFFER,D.__webglSkinIndicesBuffer);d.vertexAttribPointer(h.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,D.__webglSkinWeightsBuffer);d.vertexAttribPointer(h.skinWeight,4,d.FLOAT,!1,0,0)}if(F instanceof THREE.Mesh)if(p.wireframe){d.lineWidth(p.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,D.__webglLineBuffer);d.drawElements(d.LINES,D.__webglLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,D.__webglFaceBuffer);d.drawElements(d.TRIANGLES,
- D.__webglFaceCount,d.UNSIGNED_SHORT,0)}else if(F instanceof THREE.Line){F=F.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(p.linewidth);d.drawArrays(F,0,D.__webglLineCount)}else if(F instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,D.__webglParticleCount);else F instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,D.__webglVertexCount)}}function g(h,t){if(!h.__webglVertexBuffer)h.__webglVertexBuffer=d.createBuffer();if(!h.__webglNormalBuffer)h.__webglNormalBuffer=d.createBuffer();
- if(h.hasPos){d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,h.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.position);d.vertexAttribPointer(t.attributes.position,3,d.FLOAT,!1,0,0)}if(h.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,h.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,h.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.normal);d.vertexAttribPointer(t.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,h.count);
- h.count=0}function j(h){if(ta!=h.doubleSided){h.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ta=h.doubleSided}if(wa!=h.flipSided){h.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);wa=h.flipSided}}function k(h){if(ka!=h){h?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ka=h}}function m(h){Q[0].set(h.n41-h.n11,h.n42-h.n12,h.n43-h.n13,h.n44-h.n14);Q[1].set(h.n41+h.n11,h.n42+h.n12,h.n43+h.n13,h.n44+h.n14);Q[2].set(h.n41+h.n21,h.n42+h.n22,h.n43+h.n23,h.n44+h.n24);Q[3].set(h.n41-h.n21,h.n42-
- h.n22,h.n43-h.n23,h.n44-h.n24);Q[4].set(h.n41-h.n31,h.n42-h.n32,h.n43-h.n33,h.n44-h.n34);Q[5].set(h.n41+h.n31,h.n42+h.n32,h.n43+h.n33,h.n44+h.n34);var t;for(h=0;h<6;h++){t=Q[h];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function o(h){for(var t=h.matrixWorld,w=-h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)),p=0;p<6;p++){h=Q[p].x*t.n14+Q[p].y*t.n24+Q[p].z*t.n34+Q[p].w;if(h<=w)return!1}return!0}function n(h,t){h.list[h.count]=t;h.count+=1}function x(h){var t,
- w,p=h.object,D=h.opaque,F=h.transparent;F.count=0;h=D.count=0;for(t=p.materials.length;h<t;h++){w=p.materials[h];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?n(F,w):n(D,w)}}function z(h){var t,w,p,D,F=h.object,H=h.buffer,E=h.opaque,C=h.transparent;C.count=0;h=E.count=0;for(p=F.materials.length;h<p;h++){t=F.materials[h];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=H.materials.length;t<w;t++)(D=H.materials[t])&&(D.opacity&&D.opacity<1||D.blending!=THREE.NormalBlending?n(C,D):n(E,D))}else{D=
- t;D.opacity&&D.opacity<1||D.blending!=THREE.NormalBlending?n(C,D):n(E,D)}}}function y(h,t){return t.z-h.z}function A(h,t){h._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(h._modelViewMatrix).transposeIntoArray(h._normalMatrixArray)}function G(h){var t,w,p;if(h instanceof THREE.Mesh){w=h.geometry;for(t in w.geometryGroups){p=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||
- w.__dirtyColors||w.__dirtyTangents){var D=d.DYNAMIC_DRAW,F=void 0,H=void 0,E=void 0,C=void 0;E=void 0;var T=void 0,K=void 0,ga=void 0,X=void 0,pa=void 0,va=void 0,Ka=void 0,ua=void 0,Ba=void 0,aa=void 0,ea=void 0,Z=void 0,Ca=void 0;K=void 0;ga=void 0;C=void 0;X=void 0;C=void 0;aa=void 0;ea=void 0;K=void 0;aa=void 0;ea=void 0;Z=void 0;Ca=void 0;aa=void 0;ea=void 0;Z=void 0;Ca=void 0;aa=void 0;ea=void 0;Z=void 0;Ca=void 0;aa=void 0;ea=void 0;Z=void 0;C=void 0;X=void 0;T=void 0;E=void 0;E=void 0;var Wa=
- void 0,Ya=void 0,Na=void 0,La=0,Sa=0,fb=0,bb=0,Xa=0,Va=0,Fa=0,Ua=0,Ra=0,O=0,Qa=0,Oa=p.__vertexArray,gb=p.__uvArray,kb=p.__uv2Array,za=p.__normalArray,Da=p.__tangentArray,Pa=p.__colorArray,Ia=p.__skinVertexAArray,Ma=p.__skinVertexBArray,ya=p.__skinIndexArray,M=p.__skinWeightArray,qa=p.__morphTargetsArrays,ia=p.__faceArray,ca=p.__lineArray,Ea=p.__needsSmoothNormals;va=p.__vertexColorType;pa=p.__uvType;Ka=p.__normalType;var ra=h.geometry,oa=ra.__dirtyVertices,U=ra.__dirtyElements,Ha=ra.__dirtyUvs,cb=
- ra.__dirtyNormals,$a=ra.__dirtyTangents,db=ra.__dirtyColors,ib=ra.__dirtyMorphTargets,Za=ra.vertices,eb=p.faces,rb=ra.faces,pb=ra.faceVertexUvs[0],qb=ra.faceVertexUvs[1],mb=ra.skinVerticesA,nb=ra.skinVerticesB,ob=ra.skinIndices,jb=ra.skinWeights,lb=ra.edgeFaces,hb=ra.morphTargets;F=0;for(H=eb.length;F<H;F++){E=eb[F];C=rb[E];pb&&(ua=pb[E]);qb&&(Ba=qb[E]);E=C.vertexNormals;T=C.normal;K=C.vertexColors;ga=C.color;X=C.vertexTangents;if(C instanceof THREE.Face3){if(oa){aa=Za[C.a].position;ea=Za[C.b].position;
- Z=Za[C.c].position;Oa[Sa]=aa.x;Oa[Sa+1]=aa.y;Oa[Sa+2]=aa.z;Oa[Sa+3]=ea.x;Oa[Sa+4]=ea.y;Oa[Sa+5]=ea.z;Oa[Sa+6]=Z.x;Oa[Sa+7]=Z.y;Oa[Sa+8]=Z.z;Sa+=9}if(ib){Wa=0;for(Ya=hb.length;Wa<Ya;Wa++){aa=hb[Wa].vertices[C.a].position;ea=hb[Wa].vertices[C.b].position;Z=hb[Wa].vertices[C.c].position;Na=qa[Wa];Na[Qa+0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E.u;kb[bb+1]=
- E.v;bb+=2}if(U){ia[Xa]=La;ia[Xa+1]=La+1;ia[Xa+2]=La+3;ia[Xa+3]=La+1;ia[Xa+4]=La+2;ia[Xa+5]=La+3;Xa+=6;ca[Ua]=La;ca[Ua+1]=La+1;ca[Ua+2]=La;ca[Ua+3]=La+3;ca[Ua+4]=La+1;ca[Ua+5]=La+2;ca[Ua+6]=La+2;ca[Ua+7]=La+3;Ua+=8;La+=4}}}if(lb){F=0;for(H=lb.length;F<H;F++){ia[Xa]=lb[F].a;ia[Xa+1]=lb[F].b;ia[Xa+2]=lb[F].c;ia[Xa+3]=lb[F].a;ia[Xa+4]=lb[F].c;ia[Xa+5]=lb[F].d;Xa+=6}}if(oa){d.bindBuffer(d.ARRAY_BUFFER,p.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Oa,D)}if(ib){Wa=0;for(Ya=hb.length;Wa<Ya;Wa++){d.bindBuffer(d.ARRAY_BUFFER,
- p.__webglMorphTargetsBuffers[Wa]);d.bufferData(d.ARRAY_BUFFER,qa[Wa],D)}}if(db&&Ra>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,Pa,D)}if(cb){d.bindBuffer(d.ARRAY_BUFFER,p.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,za,D)}if($a&&ra.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,p.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Da,D)}if(Ha&&fb>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglUVBuffer);d.bufferData(d.ARRAY_BUFFER,gb,D)}if(Ha&&bb>0){d.bindBuffer(d.ARRAY_BUFFER,
- p.__webglUV2Buffer);d.bufferData(d.ARRAY_BUFFER,kb,D)}if(U){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ia,D);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ca,D)}if(O>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,Ia,D);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,D);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinIndicesBuffer);
- d.bufferData(d.ARRAY_BUFFER,ya,D);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,M,D)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){w=h.geometry;if(w.__dirtyVertices||w.__dirtyColors){h=w;t=d.DYNAMIC_DRAW;Ka=h.vertices;D=h.colors;ua=Ka.length;F=D.length;Ba=h.__vertexArray;H=h.__colorArray;La=h.__dirtyColors;if(h.__dirtyVertices){for(pa=
- 0;pa<ua;pa++){va=Ka[pa].position;p=pa*3;Ba[p]=va.x;Ba[p+1]=va.y;Ba[p+2]=va.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ba,t)}if(La){for(pa=0;pa<F;pa++){color=D[pa];p=pa*3;H[p]=color.r;H[p+1]=color.g;H[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(h instanceof THREE.Line){w=h.geometry;if(w.__dirtyVertices||w.__dirtyColors){h=w;t=d.DYNAMIC_DRAW;Ka=h.vertices;D=h.colors;
- ua=Ka.length;F=D.length;Ba=h.__vertexArray;H=h.__colorArray;La=h.__dirtyColors;if(h.__dirtyVertices){for(pa=0;pa<ua;pa++){va=Ka[pa].position;p=pa*3;Ba[p]=va.x;Ba[p+1]=va.y;Ba[p+2]=va.z}d.bindBuffer(d.ARRAY_BUFFER,h.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ba,t)}if(La){for(pa=0;pa<F;pa++){color=D[pa];p=pa*3;H[p]=color.r;H[p+1]=color.g;H[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,h.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(h instanceof
- THREE.ParticleSystem){w=h.geometry;(w.__dirtyVertices||w.__dirtyColors||h.sortParticles)&&c(w,d.DYNAMIC_DRAW,h);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function I(h){function t(X){var pa=[];w=0;for(p=X.length;w<p;w++)X[w]==undefined?pa.push("undefined"):pa.push(X[w].id);return pa.join("_")}var w,p,D,F,H,E,C,T,K={},ga=h.morphTargets!==undefined?h.morphTargets.length:0;h.geometryGroups={};D=0;for(F=h.faces.length;D<F;D++){H=h.faces[D];E=H.materials;C=t(E);K[C]==undefined&&(K[C]={hash:C,counter:0});
- T=K[C].hash+"_"+K[C].counter;h.geometryGroups[T]==undefined&&(h.geometryGroups[T]={faces:[],materials:E,vertices:0,numMorphTargets:ga});H=H instanceof THREE.Face3?3:4;if(h.geometryGroups[T].vertices+H>65535){K[C].counter+=1;T=K[C].hash+"_"+K[C].counter;h.geometryGroups[T]==undefined&&(h.geometryGroups[T]={faces:[],materials:E,vertices:0,numMorphTargets:ga})}h.geometryGroups[T].faces.push(D);h.geometryGroups[T].vertices+=H}}function J(h,t,w){h.push({buffer:t,object:w,opaque:{list:[],count:0},transparent:{list:[],
- count:0}})}function L(h){if(h!=xa){switch(h){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}xa=h}}function B(h,t,w){if((w.width&
- w.width-1)==0&&(w.height&w.height-1)==0){d.texParameteri(h,d.TEXTURE_WRAP_S,ma(t.wrapS));d.texParameteri(h,d.TEXTURE_WRAP_T,ma(t.wrapT));d.texParameteri(h,d.TEXTURE_MAG_FILTER,ma(t.magFilter));d.texParameteri(h,d.TEXTURE_MIN_FILTER,ma(t.minFilter));d.generateMipmap(h)}else{d.texParameteri(h,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(h,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(h,d.TEXTURE_MAG_FILTER,R(t.magFilter));d.texParameteri(h,d.TEXTURE_MIN_FILTER,R(t.minFilter))}}function N(h){if(h&&
- !h.__webglFramebuffer){h.__webglFramebuffer=d.createFramebuffer();h.__webglRenderbuffer=d.createRenderbuffer();h.__webglTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,h.__webglRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,h.width,h.height);d.bindTexture(d.TEXTURE_2D,h.__webglTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,ma(h.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,ma(h.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,ma(h.magFilter));
- d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,ma(h.minFilter));d.texImage2D(d.TEXTURE_2D,0,ma(h.format),h.width,h.height,0,ma(h.format),ma(h.type),null);d.bindFramebuffer(d.FRAMEBUFFER,h.__webglFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,h.__webglTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,h.__webglRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,
- null)}var t,w;if(h){t=h.__webglFramebuffer;w=h.width;h=h.height}else{t=null;w=na;h=S}if(t!=$){d.bindFramebuffer(d.FRAMEBUFFER,t);d.viewport(V,ja,w,h);$=t}}function P(h,t){var w;if(h=="fragment")w=d.createShader(d.FRAGMENT_SHADER);else h=="vertex"&&(w=d.createShader(d.VERTEX_SHADER));d.shaderSource(w,t);d.compileShader(w);if(!d.getShaderParameter(w,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(w));console.error(t);return null}return w}function R(h){switch(h){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
- default:return d.LINEAR}}function ma(h){switch(h){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
- case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
- var d,da=document.createElement("canvas"),W=null,$=null,Y=this,ta=null,wa=null,xa=null,ka=null,V=0,ja=0,na=0,S=0,Q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],fa=new THREE.Matrix4,la=new Float32Array(16),ha=new Float32Array(16),sa=new THREE.Vector4,Aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Ga=!0,Ta=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)Ga=
- a.antialias;a.clearColor!==undefined&&Ta.setHex(a.clearColor);if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=da;this.autoClear=!0;this.sortObjects=!0;(function(h,t,w){try{if(!(d=da.getContext("experimental-webgl",{antialias:h,stencil:!0})))throw"Error creating WebGL context.";}catch(p){console.error(p)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);
- d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(t.r,t.g,t.b,w)})(Ga,Ta,ab);this.context=d;var Ja={};a=[];Ga=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Ga[0]=0;Ga[1]=1;Ga[2]=2;Ga[3]=0;Ga[4]=2;Ga[5]=3;Ja.vertexBuffer=d.createBuffer();Ja.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,Ja.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,new Float32Array(a),d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
- Ja.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,new Uint16Array(Ga),d.STATIC_DRAW);Ja.program=d.createProgram();d.attachShader(Ja.program,P("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(Ja.program,P("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(Ja.program);Ja.vertexLocation=d.getAttribLocation(Ja.program,"position");Ja.projectionLocation=d.getUniformLocation(Ja.program,"projectionMatrix");this.setSize=function(h,t){da.width=h;da.height=t;this.setViewport(0,
- 0,da.width,da.height)};this.setViewport=function(h,t,w,p){V=h;ja=t;na=w;S=p;d.viewport(V,ja,na,S)};this.setScissor=function(h,t,w,p){d.scissor(h,t,w,p)};this.enableScissorTest=function(h){h?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(h){d.depthMask(h)};this.setClearColorHex=function(h,t){var w=new THREE.Color(h);d.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(h,t){d.clearColor(h.r,h.g,h.b,t)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|
- d.STENCIL_BUFFER_BIT)};this.initMaterial=function(h,t,w,p){var D,F,H,E;if(h instanceof THREE.MeshDepthMaterial)b(h,THREE.ShaderLib.depth);else if(h instanceof THREE.ShadowVolumeDynamicMaterial)b(h,THREE.ShaderLib.shadowVolumeDynamic);else if(h instanceof THREE.MeshNormalMaterial)b(h,THREE.ShaderLib.normal);else if(h instanceof THREE.MeshBasicMaterial)b(h,THREE.ShaderLib.basic);else if(h instanceof THREE.MeshLambertMaterial)b(h,THREE.ShaderLib.lambert);else if(h instanceof THREE.MeshPhongMaterial)b(h,
- THREE.ShaderLib.phong);else if(h instanceof THREE.LineBasicMaterial)b(h,THREE.ShaderLib.basic);else h instanceof THREE.ParticleBasicMaterial&&b(h,THREE.ShaderLib.particle_basic);if(!h.program){var C,T,K;C=K=E=0;for(H=t.length;C<H;C++){T=t[C];T instanceof THREE.DirectionalLight&&K++;T instanceof THREE.PointLight&&E++}if(E+K<=4)t=K;else{t=Math.ceil(4*K/(E+K));E=4-t}E={directional:t,point:E};t=50;if(p!==undefined&&p instanceof THREE.SkinnedMesh)t=p.bones.length;H={map:h.map,envMap:h.envMap,lightMap:h.lightMap,
- vertexColors:h.vertexColors,fog:w,sizeAttenuation:h.sizeAttenuation,skinning:h.skinning,morphTargets:h.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=h.fragmentShader;E=h.vertexShader;t=d.createProgram();C=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,H.fog?"#define USE_FOG":"",H.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":
- "",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");H=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":
- "",H.morphTargets?"#define USE_MORPHTARGETS":"",H.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 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");
- d.attachShader(t,P("fragment",C+w));d.attachShader(t,P("vertex",H+E));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};h.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(D in h.uniforms)w.push(D);
- D=h.program;E=0;for(t=w.length;E<t;E++){C=w[E];D.uniforms[C]=d.getUniformLocation(D,C)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(D=0;D<this.maxMorphTargets;D++)w.push("morphTarget"+D);for(F in h.attributes)w.push(F);F=h.program;D=w;w=0;for(E=D.length;w<E;w++){t=D[w];F.attributes[t]=d.getAttribLocation(F,t)}F=h.program.attributes;d.enableVertexAttribArray(F.position);F.color>=0&&d.enableVertexAttribArray(F.color);F.normal>=0&&d.enableVertexAttribArray(F.normal);
- F.tangent>=0&&d.enableVertexAttribArray(F.tangent);if(h.skinning&&F.skinVertexA>=0&&F.skinVertexB>=0&&F.skinIndex>=0&&F.skinWeight>=0){d.enableVertexAttribArray(F.skinVertexA);d.enableVertexAttribArray(F.skinVertexB);d.enableVertexAttribArray(F.skinIndex);d.enableVertexAttribArray(F.skinWeight)}if(h.morphTargets){h.numSupportedMorphTargets=0;if(F.morphTarget0>=0){d.enableVertexAttribArray(F.morphTarget0);h.numSupportedMorphTargets++}if(F.morphTarget1>=0){d.enableVertexAttribArray(F.morphTarget1);
- h.numSupportedMorphTargets++}if(F.morphTarget2>=0){d.enableVertexAttribArray(F.morphTarget2);h.numSupportedMorphTargets++}if(F.morphTarget3>=0){d.enableVertexAttribArray(F.morphTarget3);h.numSupportedMorphTargets++}if(F.morphTarget4>=0){d.enableVertexAttribArray(F.morphTarget4);h.numSupportedMorphTargets++}if(F.morphTarget5>=0){d.enableVertexAttribArray(F.morphTarget5);h.numSupportedMorphTargets++}if(F.morphTarget6>=0){d.enableVertexAttribArray(F.morphTarget6);h.numSupportedMorphTargets++}if(F.morphTarget7>=
- 0){d.enableVertexAttribArray(F.morphTarget7);h.numSupportedMorphTargets++}p.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);D=0;for(F=this.maxMorphTargets;D<F;D++)p.__webglMorphTargetInfluences[D]=0}}h.__webglProgram=!0};this.render=function(h,t,w,p){var D,F,H,E,C,T,K,ga,X=h.lights,pa=h.fog;t.matrixAutoUpdate&&t.updateMatrix();h.update(undefined,!1,t);t.matrixWorldInverse.flattenToArray(ha);t.projectionMatrix.flattenToArray(la);fa.multiply(t.projectionMatrix,t.matrixWorldInverse);
- m(fa);this.initWebGLObjects(h);N(w);(this.autoClear||p)&&this.clear();p=h.__webglObjects.length;for(C=0;C<p;C++){E=h.__webglObjects[C];K=E.object;if(K.visible)if(!(K instanceof THREE.Mesh)||o(K)){K.matrixWorld.flattenToArray(K._objectMatrixArray);A(K,t);z(E);E.render=!0;if(this.sortObjects){sa.copy(K.position);fa.multiplyVector3(sa);E.z=sa.z}}else E.render=!1;else E.render=!1}this.sortObjects&&h.__webglObjects.sort(y);T=h.__webglObjectsImmediate.length;for(C=0;C<T;C++){E=h.__webglObjectsImmediate[C];
- K=E.object;if(K.visible){K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray);A(K,t);x(E)}}L(THREE.NormalBlending);for(C=0;C<p;C++){E=h.__webglObjects[C];if(E.render){K=E.object;ga=E.buffer;H=E.opaque;j(K);for(D=0;D<H.count;D++){E=H.list[D];k(E.depthTest);f(t,X,pa,E,ga,K)}}}for(C=0;C<T;C++){E=h.__webglObjectsImmediate[C];K=E.object;if(K.visible){H=E.opaque;j(K);for(D=0;D<H.count;D++){E=H.list[D];k(E.depthTest);F=e(t,X,pa,E,K);K.render(function(va){g(va,F)})}}}for(C=0;C<p;C++){E=
- h.__webglObjects[C];if(E.render){K=E.object;ga=E.buffer;H=E.transparent;j(K);for(D=0;D<H.count;D++){E=H.list[D];L(E.blending);k(E.depthTest);f(t,X,pa,E,ga,K)}}}for(C=0;C<T;C++){E=h.__webglObjectsImmediate[C];K=E.object;if(K.visible){H=E.transparent;j(K);for(D=0;D<H.count;D++){E=H.list[D];L(E.blending);k(E.depthTest);F=e(t,X,pa,E,K);K.render(function(va){g(va,F)})}}}if(h.__webglShadowVolumes.length&&h.lights.length){d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(0.1,1);d.enable(d.STENCIL_TEST);d.depthMask(!1);
- d.colorMask(!1,!1,!1,!1);d.stencilFunc(d.ALWAYS,1,255);d.stencilOpSeparate(d.BACK,d.KEEP,d.INCR,d.KEEP);d.stencilOpSeparate(d.FRONT,d.KEEP,d.DECR,d.KEEP);T=h.lights.length;ga=[];p=h.__webglShadowVolumes.length;for(t=0;t<T;t++){C=h.lights[t];if(C instanceof THREE.DirectionalLight){ga[0]=-C.position.x;ga[1]=-C.position.y;ga[2]=-C.position.z;for(C=0;C<p;C++){K=h.__webglShadowVolumes[C].object;D=h.__webglShadowVolumes[C].buffer;E=K.materials[0];E.program||Y.initMaterial(E,X,pa,K);F=E.program;E=F.uniforms;
- H=F.attributes;if(W!==F){d.useProgram(F);W=F;d.uniformMatrix4fv(E.projectionMatrix,!1,la);d.uniformMatrix4fv(E.viewMatrix,!1,ha);d.uniform3fv(E.directionalLightDirection,ga)}K.matrixWorld.flattenToArray(K._objectMatrixArray);d.uniformMatrix4fv(E.objectMatrix,!1,K._objectMatrixArray);d.bindBuffer(d.ARRAY_BUFFER,D.__webglVertexBuffer);d.vertexAttribPointer(H.position,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,D.__webglNormalBuffer);d.vertexAttribPointer(H.normal,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
- D.__webglFaceBuffer);d.cullFace(d.FRONT);d.drawElements(d.TRIANGLES,D.__webglFaceCount,d.UNSIGNED_SHORT,0);d.cullFace(d.BACK);d.drawElements(d.TRIANGLES,D.__webglFaceCount,d.UNSIGNED_SHORT,0)}}}d.disable(d.POLYGON_OFFSET_FILL);d.colorMask(!0,!0,!0,!0);d.stencilFunc(d.NOTEQUAL,0,255);d.stencilOp(d.KEEP,d.KEEP,d.KEEP);d.disable(d.DEPTH_TEST);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.blendEquation(d.FUNC_ADD);xa="";W=Ja.program;d.useProgram(Ja.program);d.uniformMatrix4fv(Ja.projectionLocation,
- !1,la);d.bindBuffer(d.ARRAY_BUFFER,Ja.vertexBuffer);d.vertexAttribPointer(Ja.vertexLocation,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(Ja.vertexLocation);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ja.elementBuffer);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);d.disable(d.STENCIL_TEST);d.enable(d.DEPTH_TEST);d.disable(d.BLEND);d.depthMask(!0)}if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,w.__webglTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,
- null)}};this.initWebGLObjects=function(h){if(!h.__webglObjects){h.__webglObjects=[];h.__webglObjectsImmediate=[];h.__webglShadowVolumes=[]}for(;h.__objectsAdded.length;){var t=h.__objectsAdded[0],w=h,p=void 0,D=void 0,F=void 0;if(t._modelViewMatrix==undefined){t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);t._modelViewMatrixArray=new Float32Array(16);t._objectMatrixArray=new Float32Array(16);t.matrixWorld.flattenToArray(t._objectMatrixArray)}if(t instanceof THREE.Mesh){D=
- t.geometry;D.geometryGroups==undefined&&I(D);for(p in D.geometryGroups){F=D.geometryGroups[p];if(!F.__webglVertexBuffer){var H=F;H.__webglVertexBuffer=d.createBuffer();H.__webglNormalBuffer=d.createBuffer();H.__webglTangentBuffer=d.createBuffer();H.__webglColorBuffer=d.createBuffer();H.__webglUVBuffer=d.createBuffer();H.__webglUV2Buffer=d.createBuffer();H.__webglSkinVertexABuffer=d.createBuffer();H.__webglSkinVertexBBuffer=d.createBuffer();H.__webglSkinIndicesBuffer=d.createBuffer();H.__webglSkinWeightsBuffer=
- d.createBuffer();H.__webglFaceBuffer=d.createBuffer();H.__webglLineBuffer=d.createBuffer();if(H.numMorphTargets){var E=void 0,C=void 0;H.__webglMorphTargetsBuffers=[];E=0;for(C=H.numMorphTargets;E<C;E++)H.__webglMorphTargetsBuffers.push(d.createBuffer())}H=F;E=t;var T=void 0,K=void 0,ga=void 0;ga=void 0;var X=C=0,pa=0;T=void 0;K=void 0;var va=void 0;K=void 0;var Ka=E.geometry;va=Ka.faces;var ua=H.faces;T=0;for(K=ua.length;T<K;T++){ga=ua[T];ga=va[ga];if(ga instanceof THREE.Face3){C+=3;X+=1;pa+=3}else if(ga instanceof
- THREE.Face4){C+=4;X+=2;pa+=4}}T=H;K=E;va=void 0;ua=void 0;var Ba=void 0,aa=void 0;Ba=void 0;ga=[];va=0;for(ua=K.materials.length;va<ua;va++){Ba=K.materials[va];if(Ba instanceof THREE.MeshFaceMaterial){Ba=0;for(l=T.materials.length;Ba<l;Ba++)(aa=T.materials[Ba])&&ga.push(aa)}else(aa=Ba)&&ga.push(aa)}K=ga;a:{T=void 0;va=void 0;ua=K.length;for(T=0;T<ua;T++){va=K[T];if(va.map||va.lightMap||va instanceof THREE.MeshShaderMaterial){T=!0;break a}}T=!1}a:{va=K;ua=void 0;ga=void 0;Ba=va.length;for(ua=0;ua<
- Ba;ua++){ga=va[ua];if(!(ga instanceof THREE.MeshBasicMaterial&&!ga.envMap||ga instanceof THREE.MeshDepthMaterial)){va=ga&&ga.shading!=undefined&&ga.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}va=!1}a:{ua=void 0;ga=void 0;Ba=K.length;for(ua=0;ua<Ba;ua++){ga=K[ua];if(ga.vertexColors){K=ga.vertexColors;break a}}K=!1}H.__vertexArray=new Float32Array(C*3);if(va)H.__normalArray=new Float32Array(C*3);if(Ka.hasTangents)H.__tangentArray=new Float32Array(C*4);if(K)H.__colorArray=
- new Float32Array(C*3);if(T){if(Ka.faceUvs.length>0||Ka.faceVertexUvs.length>0)H.__uvArray=new Float32Array(C*2);if(Ka.faceUvs.length>1||Ka.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(C*2)}if(E.geometry.skinWeights.length&&E.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(C*4);H.__skinVertexBArray=new Float32Array(C*4);H.__skinIndexArray=new Float32Array(C*4);H.__skinWeightArray=new Float32Array(C*4)}H.__faceArray=new Uint16Array(X*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*
- 6:0));H.__lineArray=new Uint16Array(pa*2);if(H.numMorphTargets){Ka=void 0;ua=void 0;H.__morphTargetsArrays=[];Ka=0;for(ua=H.numMorphTargets;Ka<ua;Ka++)H.__morphTargetsArrays.push(new Float32Array(C*3))}H.__needsSmoothNormals=va==THREE.SmoothShading;H.__uvType=T;H.__vertexColorType=K;H.__normalType=va;H.__webglFaceCount=X*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0);H.__webglLineCount=pa*2;D.__dirtyVertices=!0;D.__dirtyMorphTargets=!0;D.__dirtyElements=!0;D.__dirtyUvs=!0;D.__dirtyNormals=
- !0;D.__dirtyTangents=!0;D.__dirtyColors=!0}t instanceof THREE.ShadowVolume?J(w.__webglShadowVolumes,F,t):J(w.__webglObjects,F,t)}}else if(t instanceof THREE.Ribbon){D=t.geometry;if(!D.__webglVertexBuffer){p=D;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=D;F=p.vertices.length;p.__vertexArray=new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__webglVertexCount=F;D.__dirtyVertices=!0;D.__dirtyColors=!0}J(w.__webglObjects,D,t)}else if(t instanceof THREE.Line){D=
- t.geometry;if(!D.__webglVertexBuffer){p=D;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=D;F=p.vertices.length;p.__vertexArray=new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__webglLineCount=F;D.__dirtyVertices=!0;D.__dirtyColors=!0}J(w.__webglObjects,D,t)}else if(t instanceof THREE.ParticleSystem){D=t.geometry;if(!D.__webglVertexBuffer){p=D;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=D;F=p.vertices.length;p.__vertexArray=
- new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__sortArray=[];p.__webglParticleCount=F;D.__dirtyVertices=!0;D.__dirtyColors=!0}J(w.__webglObjects,D,t)}else THREE.MarchingCubes!==undefined&&t instanceof THREE.MarchingCubes&&w.__webglObjectsImmediate.push({object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});h.__objectsAdded.splice(0,1)}for(;h.__objectsRemoved.length;){t=h.__objectsRemoved[0];w=h;D=void 0;p=void 0;for(D=w.__webglObjects.length-1;D>=0;D--){p=w.__webglObjects[D].object;
- t==p&&w.__webglObjects.splice(D,1)}h.__objectsRemoved.splice(0,1)}t=0;for(w=h.__webglObjects.length;t<w;t++)G(h.__webglObjects[t].object,h);t=0;for(w=h.__webglShadowVolumes.length;t<w;t++)G(h.__webglShadowVolumes[t].object,h)};this.setFaceCulling=function(h,t){if(h){!t||t=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(h=="back")d.cullFace(d.BACK);else h=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
- 0}};THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var e,f=b.length;for(e=0;e<f;e++){a=b[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
- THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
- THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.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};
- 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};
- 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};
- var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,f=b?c.geometry:c,g=a.vertices,j=f.vertices,k=a.faces,m=f.faces,o=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,x=j.length;n<x;n++){var z=new THREE.Vertex(j[n].position.clone());b&&c.matrix.multiplyVector3(z.position);g.push(z)}n=0;for(x=m.length;n<x;n++){j=m[n];var y,A,G=j.vertexNormals;z=j.vertexColors;if(j instanceof THREE.Face3)y=new THREE.Face3(j.a+e,j.b+e,j.c+
- e);else j instanceof THREE.Face4&&(y=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));y.normal.copy(j.normal);b=0;for(g=G.length;b<g;b++){A=G[b];y.vertexNormals.push(A.clone())}y.color.copy(j.color);b=0;for(g=z.length;b<g;b++){A=z[b];y.vertexColors.push(A.clone())}y.materials=j.materials.slice();y.centroid.copy(j.centroid);k.push(y)}n=0;for(x=f.length;n<x;n++){e=f[n];k=[];b=0;for(g=e.length;b<g;b++)k.push(new THREE.UV(e[b].u,e[b].v));o.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=
- new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(e=a.length;c<e;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,e){var f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(j){function k(na,S){return S=="relativeToHTML"?
- na:g+"/"+na}function m(){for(y in W.objects)if(!V.objects[y]){L=W.objects[y];if(R=V.geometries[L.geometry]){da=[];for(ja=0;ja<L.materials.length;ja++)da[ja]=V.materials[L.materials[ja]];B=L.position;r=L.rotation;q=L.quaternion;s=L.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(R,da);object.position.set(B[0],B[1],B[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=L.visible;V.scene.addObject(object);V.objects[y]=object}}}function o(na){return function(S){V.geometries[na]=S;m();ta-=1;n()}}function n(){e({total_models:xa,total_textures:ka,loaded_models:xa-ta,loaded_textures:ka-wa},V);ta==0&&wa==0&&b(V)}var x,z,y,A,G,I,J,L,B,N,P,R,ma,d,da,W,$,Y,ta,wa,xa,ka,V;W=j.data;$=new THREE.BinaryLoader;Y=new THREE.JSONLoader;wa=ta=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){wa-=1;
- n()};for(G in W.cameras){N=W.cameras[G];if(N.type=="perspective")ma=new THREE.Camera(N.fov,N.aspect,N.near,N.far);else if(N.type=="ortho"){ma=new THREE.Camera;ma.projectionMatrix=THREE.Matrix4.makeOrtho(N.left,N.right,N.top,N.bottom,N.near,N.far)}B=N.position;N=N.target;ma.position.set(B[0],B[1],B[2]);ma.target.position.set(N[0],N[1],N[2]);V.cameras[G]=ma}for(A in W.lights){G=W.lights[A];ma=G.color!==undefined?G.color:16777215;N=G.intensity!==undefined?G.intensity:1;if(G.type=="directional"){B=G.direction;
- light=new THREE.DirectionalLight(ma,N);light.position.set(B[0],B[1],B[2]);light.position.normalize()}else if(G.type=="point"){B=G.position;light=new THREE.PointLight(ma,N);light.position.set(B[0],B[1],B[2])}V.scene.addLight(light);V.lights[A]=light}for(I in W.fogs){A=W.fogs[I];if(A.type=="linear")d=new THREE.Fog(0,A.near,A.far);else A.type=="exp2"&&(d=new THREE.FogExp2(0,A.density));N=A.color;d.color.setRGB(N[0],N[1],N[2]);V.fogs[I]=d}if(V.cameras&&W.defaults.camera)V.currentCamera=V.cameras[W.defaults.camera];
- if(V.fogs&&W.defaults.fog)V.scene.fog=V.fogs[W.defaults.fog];N=W.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(N[0],N[1],N[2]);V.bgColorAlpha=W.defaults.bgalpha;for(x in W.geometries){I=W.geometries[x];if(I.type=="bin_mesh"||I.type=="ascii_mesh")ta+=1}xa=ta;for(x in W.geometries){I=W.geometries[x];if(I.type=="cube"){R=new Cube(I.width,I.height,I.depth,I.segmentsWidth,I.segmentsHeight,I.segmentsDepth,null,I.flipped,I.sides);V.geometries[x]=R}else if(I.type=="plane"){R=new Plane(I.width,
- I.height,I.segmentsWidth,I.segmentsHeight);V.geometries[x]=R}else if(I.type=="sphere"){R=new Sphere(I.radius,I.segmentsWidth,I.segmentsHeight);V.geometries[x]=R}else if(I.type=="cylinder"){R=new Cylinder(I.numSegs,I.topRad,I.botRad,I.height,I.topOffset,I.botOffset);V.geometries[x]=R}else if(I.type=="torus"){R=new Torus(I.radius,I.tube,I.segmentsR,I.segmentsT);V.geometries[x]=R}else if(I.type=="icosahedron"){R=new Icosahedron(I.subdivisions);V.geometries[x]=R}else if(I.type=="bin_mesh")$.load({model:k(I.url,
- W.urlBaseType),callback:o(x)});else I.type=="ascii_mesh"&&Y.load({model:k(I.url,W.urlBaseType),callback:o(x)})}for(J in W.textures){x=W.textures[J];wa+=x.url instanceof Array?x.url.length:1}ka=wa;for(J in W.textures){x=W.textures[J];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){I=[];for(var ja=0;ja<x.url.length;ja++)I[ja]=k(x.url[ja],W.urlBaseType);I=ImageUtils.loadTextureCube(I,x.mapping,j)}else{I=ImageUtils.loadTexture(k(x.url,W.urlBaseType),
- x.mapping,j);if(THREE[x.minFilter]!=undefined)I.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)I.magFilter=THREE[x.magFilter]}V.textures[J]=I}for(z in W.materials){J=W.materials[z];for(P in J.parameters)if(P=="envMap"||P=="map"||P=="lightMap")J.parameters[P]=V.textures[J.parameters[P]];else if(P=="shading")J.parameters[P]=J.parameters[P]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(P=="blending")J.parameters[P]=THREE[J.parameters[P]]?THREE[J.parameters[P]]:THREE.NormalBlending;
- else P=="combine"&&(J.parameters[P]=J.parameters[P]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);J=new THREE[J.type](J.parameters);V.materials[z]=J}m();c(V)}},addMesh:function(a,c,b,e,f,g,j,k,m,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=j;c.rotation.y=k;c.rotation.z=m;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,
- vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));
- e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,e,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));
- SceneUtils.addMesh(a,c,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++){b=a.children[e];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",
- value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
- 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}"},
- normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
- uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragmentShader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
- 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}"},
- 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",
- 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}"},
- 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}"},
- 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}",
- fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=e=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=b[c]}for(c=0;c<g;++c)b[c]/=e;return b}};
- THREE.QuakeCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
- a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
- this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
- !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
- !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
- var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var e=this.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
- !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
- THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
- THREE.PathCamera=function(a){function c(o,n,x,z){var y={name:x,fps:0.6,length:z,hierarchy:[]},A,G=n.getControlPointsArray(),I=n.getLength(),J=G.length,L=0;A=J-1;n={parent:-1,keys:[]};n.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};n.keys[A]={time:z,pos:G[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<J-1;A++){L=z*I.chunks[A]/I.total;n.keys[A]={time:L,pos:G[A]}}y.hierarchy[0]=n;THREE.AnimationHandler.add(y);return new THREE.Animation(o,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(o,n){var x,
- z,y=new THREE.Geometry;for(x=0;x<o.points.length*n;x++){z=x/(o.points.length*n);z=o.getPoint(z);y.vertices[x]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return y}function e(o,n){var x=b(n,10),z=b(n,10),y=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,y);particleObj=new THREE.ParticleSystem(z,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);z=new Sphere(1,
- 16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<n.points.length;i++){x=new THREE.Mesh(z,y);x.position.copy(n.points[i]);x.updateMatrix();o.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookVertical=
- !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
- if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
- this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(o,n,x){var z,y;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;z=this.phi%f;this.phi=z>=0?z:z+f;z=this.verticalAngleMap.srcRange;y=this.verticalAngleMap.dstRange;
- this.phi=(this.phi-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.horizontalAngleMap.srcRange;y=this.horizontalAngleMap.dstRange;this.theta=(this.theta-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.target.position;z.x=100*Math.sin(this.phi)*Math.cos(this.theta);z.y=100*Math.cos(this.phi);z.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,n,x)};this.onMouseMove=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){a=new THREE.MeshLambertMaterial({color:30719});var j=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(m,j);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
- c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(o,n){return function(){n.apply(o,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
- var Cube=function(a,c,b,e,f,g,j,k,m){function o(I,J,L,B,N,P,R,ma){var d,da,W=e||1,$=f||1,Y=N/2,ta=P/2,wa=n.vertices.length;if(I=="x"&&J=="y"||I=="y"&&J=="x")d="z";else if(I=="x"&&J=="z"||I=="z"&&J=="x"){d="y";$=g||1}else if(I=="z"&&J=="y"||I=="y"&&J=="z"){d="x";W=g||1}var xa=W+1,ka=$+1;N/=W;var V=P/$;for(da=0;da<ka;da++)for(P=0;P<xa;P++){var ja=new THREE.Vector3;ja[I]=(P*N-Y)*L;ja[J]=(da*V-ta)*B;ja[d]=R;n.vertices.push(new THREE.Vertex(ja))}for(da=0;da<$;da++)for(P=0;P<W;P++){n.faces.push(new THREE.Face4(P+
- xa*da+wa,P+xa*(da+1)+wa,P+1+xa*(da+1)+wa,P+1+xa*da+wa,null,null,ma));n.faceVertexUvs[0].push([new THREE.UV(P/W,da/$),new THREE.UV(P/W,(da+1)/$),new THREE.UV((P+1)/W,(da+1)/$),new THREE.UV((P+1)/W,da/$)])}}THREE.Geometry.call(this);var n=this,x=a/2,z=c/2,y=b/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var A=0;A<6;A++)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 G in m)this.sides[G]!=
- undefined&&(this.sides[G]=m[G]);this.sides.px&&o("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&o("x","z",1*k,1,a,b,z,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,a,b,-z,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,a,c,y,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,a,c,-y,this.materials[5]);(function(){for(var I=[],J=[],L=0,B=n.vertices.length;L<B;L++){for(var N=n.vertices[L],P=!1,R=0,ma=I.length;R<ma;R++){var d=
- I[R];if(N.position.x==d.position.x&&N.position.y==d.position.y&&N.position.z==d.position.z){J[L]=R;P=!0;break}}if(!P){J[L]=I.length;I.push(new THREE.Vertex(N.position.clone()))}}L=0;for(B=n.faces.length;L<B;L++){N=n.faces[L];N.a=J[N.a];N.b=J[N.b];N.c=J[N.c];N.d=J[N.d]}n.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,c,b,e,f,g){function j(n,x,z){k.vertices.push(new THREE.Vertex(new THREE.Vector3(n,x,z)))}THREE.Geometry.call(this);var k=this,m=Math.PI,o=e/2;for(e=0;e<a;e++)j(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-o);for(e=0;e<a;e++)j(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,o);for(e=0;e<a;e++)k.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){j(0,0,-o-(g||0));for(e=a;e<a+a/2;e++)k.faces.push(new THREE.Face4(2*a,(2*e-2*a)%a,(2*e-2*a+1)%a,(2*e-2*a+2)%a))}if(c>0){j(0,0,o+(f||0));
- for(e=a+a/2;e<2*a;e++)k.faces.push(new THREE.Face4(2*a+1,(2*e-2*a+2)%a+a,(2*e-2*a+1)%a+a,(2*e-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
- var Icosahedron=function(a){function c(x,z,y){var A=Math.sqrt(x*x+z*z+y*y);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,z/A,y/A)))-1}function b(x,z,y,A){A.faces.push(new THREE.Face3(x,z,y))}function e(x,z){var y=f.vertices[x].position,A=f.vertices[z].position;return c((y.x+A.x)/2,(y.y+A.y)/2,(y.z+A.z)/2)}var f=this,g=new THREE.Geometry,j;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
- 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){j=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),o=e(g.faces[k].b,g.faces[k].c),n=e(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,m,n,j);b(g.faces[k].b,o,m,j);b(g.faces[k].c,
- n,o,j);b(m,o,n,j)}g.faces=j.faces}f.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
- function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var e=[],f=[],g=[],j=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));e[k]=a[k].clone();f[k]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),o=0;o<=this.angle+0.001;o+=c){for(k=0;k<e.length;k++)if(o<this.angle){e[k]=m.multiplyVector3(e[k].clone());this.vertices.push(new THREE.Vertex(e[k]));g[k]=this.vertices.length-1}else g=j;o==0&&(j=f);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(o/b,k/a.length),new THREE.UV(o/b,(k+1)/a.length),new THREE.UV((o-c)/b,(k+1)/a.length),new THREE.UV((o-c)/b,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
- var Plane=function(a,c,b,e){THREE.Geometry.call(this);var f,g=a/2,j=c/2;b=b||1;e=e||1;var k=b+1,m=e+1;a/=b;var o=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*o-j),0)));for(f=0;f<e;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)])}this.computeCentroids();this.computeFaceNormals()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,c,b){THREE.Geometry.call(this);var e,f=Math.PI,g=Math.max(3,c||8),j=Math.max(2,b||6);c=[];for(b=0;b<j+1;b++){e=b/j;var k=a*Math.cos(e*f),m=a*Math.sin(e*f),o=[],n=0;for(e=0;e<g;e++){var x=2*e/g,z=m*Math.sin(x*f);x=m*Math.cos(x*f);(b==0||b==j)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,z)))-1);o.push(n)}c.push(o)}var y,A,G;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){o=e==g-1;j=c[b][o?0:e+1];k=c[b][o?g-1:e];m=c[b-1][o?g-1:e];o=c[b-1][o?
- 0:e+1];z=b/(f-1);y=(b-1)/(f-1);A=(e+1)/g;x=e/g;n=new THREE.UV(1-A,z);z=new THREE.UV(1-x,z);x=new THREE.UV(1-x,y);var I=new THREE.UV(1-A,y);if(b<c.length-1){y=this.vertices[j].position.clone();A=this.vertices[k].position.clone();G=this.vertices[m].position.clone();y.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([n,z,x])}if(b>1){y=this.vertices[j].position.clone();
- A=this.vertices[m].position.clone();G=this.vertices[o].position.clone();y.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([n,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- var Torus=function(a,c,b,e){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
- 1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,j=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,j));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[j][0],a[j][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
- var TorusKnot=function(a,c,b,e,f,g,j){function k(x,z,y,A,G,I){z=y/A*x;y=Math.cos(z);return new THREE.Vector3(G*(2+y)*0.5*Math.cos(x),G*(2+y)*Math.sin(x)*0.5,I*G*Math.sin(z)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
- a/this.segmentsR*2*this.p*Math.PI;j=c/this.segmentsT*2*Math.PI;f=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);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(b,e);e.cross(g,b);g.normalize();e.normalize();m=this.tube*Math.cos(j);j=this.tube*Math.sin(j);f.x+=m*e.x+j*g.x;f.y+=m*e.y+j*g.y;f.z+=m*e.z+j*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
- 0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;j=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];e=this.grid[a][j];g=this.grid[g][j];j=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var o=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,e));this.faceVertexUvs[0].push([j,m,o]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([n,
- o,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
- THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
- this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function e(k,m){var o=new Image;o.onload=function(){if(!b(this.width)||!b(this.height)){var n=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
- Math.LN2));k.image.width=n;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,n,x)}else k.image=this;k.needsUpdate=!0};o.src=m}var f,g,j;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.mapDiffuse&&c){j=document.createElement("canvas");g.map=new THREE.Texture(j);g.map.sourceFile=a.mapDiffuse;
- e(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){j=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=j;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){j=document.createElement("canvas");g.lightMap=new THREE.Texture(j);g.lightMap.sourceFile=a.mapLightmap;e(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
- THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(g){c.createModel(g.data,e,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
- THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var f,g,j,k,m,o,n,x,z,y,A=a.faces;x=a.vertices;var G=a.normals,I=a.colors,J=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&J++;for(f=0;f<J;f++){e.faceUvs[f]=[];e.faceVertexUvs[f]=[]}k=0;for(m=x.length;k<m;){z=new THREE.Vertex;z.position.x=x[k++];z.position.y=x[k++];z.position.z=x[k++];e.vertices.push(z)}k=
- 0;for(m=A.length;k<m;){o=A[k++];n=o&1;j=o&2;f=o&4;g=o&8;x=o&16;z=o&32;y=o&64;o&=128;if(n){n=new THREE.Face4;n.a=A[k++];n.b=A[k++];n.c=A[k++];n.d=A[k++];nVertices=4}else{n=new THREE.Face3;n.a=A[k++];n.b=A[k++];n.c=A[k++];nVertices=3}if(j){materialIndex=A[k++];n.materials=e.materials[materialIndex]}j=e.faces.length;if(f)for(f=0;f<J;f++){uvLayer=a.uvs[f];uvIndex=A[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];e.faceUvs[f][j]=new THREE.UV(u,v)}if(g)for(f=0;f<J;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<
- nVertices;g++){uvIndex=A[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}e.faceVertexUvs[f][j]=uvs}if(x){normalIndex=A[k++]*3;normal=new THREE.Vector3;normal.x=G[normalIndex++];normal.y=G[normalIndex++];normal.z=G[normalIndex];n.normal=normal}if(z)for(f=0;f<nVertices;f++){normalIndex=A[k++]*3;normal=new THREE.Vector3;normal.x=G[normalIndex++];normal.y=G[normalIndex++];normal.z=G[normalIndex];n.vertexNormals.push(normal)}if(y){color=new THREE.Color(A[k++]);n.color=color}if(o)for(f=
- 0;f<nVertices;f++){colorIndex=A[k++];color=new THREE.Color(I[colorIndex]);n.vertexColors.push(color)}e.faces.push(n)}}})();(function(){var f,g,j,k;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){j=a.skinWeights[f];k=a.skinWeights[f+1];e.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){j=a.skinIndices[f];k=a.skinIndices[f+1];e.skinIndices.push(new THREE.Vector4(j,k,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==
- undefined){var f,g,j,k;f=0;for(g=a.morphTargets.length;f<g;f++){e.morphTargets[f]={};e.morphTargets[f].name=a.morphTargets[f].name;e.morphTargets[f].vertices=[];dstVertices=e.morphTargets[f].vertices;srcVertices=a.morphTargets[f].vertices;j=0;for(k=srcVertices.length;j<k;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
- THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
- THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,b,f,e,g)};c.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
- c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,g){var j=new XMLHttpRequest,k=e+"/"+a,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(g){m==0&&(m=j.getResponseHeader("Content-Length"));g({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");
- j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(a,c,b,e){var f=function(g){function j(h,t){var w=n(h,t),p=n(h,t+1),D=n(h,t+2),F=n(h,t+3),H=(F<<1&255|D>>7)-127;w|=(D&127)<<16|p<<8;if(w==0&&H==-127)return 0;return(1-2*(F>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,H)}function k(h,t){var w=n(h,t),p=n(h,t+1),D=n(h,t+2);return(n(h,t+3)<<24)+(D<<16)+(p<<8)+w}function m(h,t){var w=n(h,t);return(n(h,t+1)<<8)+w}function o(h,t){var w=n(h,t);return w>127?w-256:w}function n(h,
- t){return h.charCodeAt(t)&255}function x(h){var t,w,p;t=k(a,h);w=k(a,h+R);p=k(a,h+ma);h=m(a,h+d);THREE.BinaryLoader.prototype.f3(J,t,w,p,h)}function z(h){var t,w,p,D,F,H;t=k(a,h);w=k(a,h+R);p=k(a,h+ma);D=m(a,h+d);F=k(a,h+da);H=k(a,h+W);h=k(a,h+$);THREE.BinaryLoader.prototype.f3n(J,N,t,w,p,D,F,H,h)}function y(h){var t,w,p,D;t=k(a,h);w=k(a,h+Y);p=k(a,h+ta);D=k(a,h+wa);h=m(a,h+xa);THREE.BinaryLoader.prototype.f4(J,t,w,p,D,h)}function A(h){var t,w,p,D,F,H,E,C;t=k(a,h);w=k(a,h+Y);p=k(a,h+ta);D=k(a,h+wa);
- F=m(a,h+xa);H=k(a,h+ka);E=k(a,h+V);C=k(a,h+ja);h=k(a,h+na);THREE.BinaryLoader.prototype.f4n(J,N,t,w,p,D,F,H,E,C,h)}function G(h){var t,w;t=k(a,h);w=k(a,h+S);h=k(a,h+Q);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],P[t*2],P[t*2+1],P[w*2],P[w*2+1],P[h*2],P[h*2+1])}function I(h){var t,w,p;t=k(a,h);w=k(a,h+fa);p=k(a,h+la);h=k(a,h+ha);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],P[t*2],P[t*2+1],P[w*2],P[w*2+1],P[p*2],P[p*2+1],P[h*2],P[h*2+1])}var J=this,L=0,B,N=[],P=[],R,ma,d,da,W,$,Y,ta,
- wa,xa,ka,V,ja,na,S,Q,fa,la,ha,sa,Aa,Ga,Ta,ab,Ja;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(J,e,g);B={signature:a.substr(L,8),header_bytes:n(a,L+8),vertex_coordinate_bytes:n(a,L+9),normal_coordinate_bytes:n(a,L+10),uv_coordinate_bytes:n(a,L+11),vertex_index_bytes:n(a,L+12),normal_index_bytes:n(a,L+13),uv_index_bytes:n(a,L+14),material_index_bytes:n(a,L+15),nvertices:k(a,L+16),nnormals:k(a,L+16+4),nuvs:k(a,L+16+8),ntri_flat:k(a,L+16+12),ntri_smooth:k(a,L+16+16),ntri_flat_uv:k(a,
- L+16+20),ntri_smooth_uv:k(a,L+16+24),nquad_flat:k(a,L+16+28),nquad_smooth:k(a,L+16+32),nquad_flat_uv:k(a,L+16+36),nquad_smooth_uv:k(a,L+16+40)};L+=B.header_bytes;R=B.vertex_index_bytes;ma=B.vertex_index_bytes*2;d=B.vertex_index_bytes*3;da=B.vertex_index_bytes*3+B.material_index_bytes;W=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;$=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;Y=B.vertex_index_bytes;ta=B.vertex_index_bytes*2;wa=B.vertex_index_bytes*3;xa=
- B.vertex_index_bytes*4;ka=B.vertex_index_bytes*4+B.material_index_bytes;V=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;ja=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;na=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;S=B.uv_index_bytes;Q=B.uv_index_bytes*2;fa=B.uv_index_bytes;la=B.uv_index_bytes*2;ha=B.uv_index_bytes*3;g=B.vertex_index_bytes*3+B.material_index_bytes;Ja=B.vertex_index_bytes*4+B.material_index_bytes;sa=B.ntri_flat*
- g;Aa=B.ntri_smooth*(g+B.normal_index_bytes*3);Ga=B.ntri_flat_uv*(g+B.uv_index_bytes*3);Ta=B.ntri_smooth_uv*(g+B.normal_index_bytes*3+B.uv_index_bytes*3);ab=B.nquad_flat*Ja;g=B.nquad_smooth*(Ja+B.normal_index_bytes*4);Ja=B.nquad_flat_uv*(Ja+B.uv_index_bytes*4);L+=function(h){for(var t,w,p,D=B.vertex_coordinate_bytes*3,F=h+B.nvertices*D;h<F;h+=D){t=j(a,h);w=j(a,h+B.vertex_coordinate_bytes);p=j(a,h+B.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(J,t,w,p)}return B.nvertices*D}(L);L+=function(h){for(var t,
- w,p,D=B.normal_coordinate_bytes*3,F=h+B.nnormals*D;h<F;h+=D){t=o(a,h);w=o(a,h+B.normal_coordinate_bytes);p=o(a,h+B.normal_coordinate_bytes*2);N.push(t/127,w/127,p/127)}return B.nnormals*D}(L);L+=function(h){for(var t,w,p=B.uv_coordinate_bytes*2,D=h+B.nuvs*p;h<D;h+=p){t=j(a,h);w=j(a,h+B.uv_coordinate_bytes);P.push(t,w)}return B.nuvs*p}(L);sa=L+sa;Aa=sa+Aa;Ga=Aa+Ga;Ta=Ga+Ta;ab=Ta+ab;g=ab+g;Ja=g+Ja;(function(h){var t,w=B.vertex_index_bytes*3+B.material_index_bytes,p=w+B.uv_index_bytes*3,D=h+B.ntri_flat_uv*
- p;for(t=h;t<D;t+=p){x(t);G(t+w)}return D-h})(Aa);(function(h){var t,w=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,p=w+B.uv_index_bytes*3,D=h+B.ntri_smooth_uv*p;for(t=h;t<D;t+=p){z(t);G(t+w)}return D-h})(Ga);(function(h){var t,w=B.vertex_index_bytes*4+B.material_index_bytes,p=w+B.uv_index_bytes*4,D=h+B.nquad_flat_uv*p;for(t=h;t<D;t+=p){y(t);I(t+w)}return D-h})(g);(function(h){var t,w=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,p=w+B.uv_index_bytes*
- 4,D=h+B.nquad_smooth_uv*p;for(t=h;t<D;t+=p){A(t);I(t+w)}return D-h})(Ja);(function(h){var t,w=B.vertex_index_bytes*3+B.material_index_bytes,p=h+B.ntri_flat*w;for(t=h;t<p;t+=w)x(t);return p-h})(L);(function(h){var t,w=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,p=h+B.ntri_smooth*w;for(t=h;t<p;t+=w)z(t);return p-h})(sa);(function(h){var t,w=B.vertex_index_bytes*4+B.material_index_bytes,p=h+B.nquad_flat*w;for(t=h;t<p;t+=w)y(t);return p-h})(Ta);(function(h){var t,w=B.vertex_index_bytes*
- 4+B.material_index_bytes+B.normal_index_bytes*4,p=h+B.nquad_smooth*w;for(t=h;t<p;t+=w)A(t);return p-h})(ab);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,g){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[g]))},f3n:function(a,
- c,b,e,f,g,j,k,m){g=a.materials[g];var o=c[k*3],n=c[k*3+1];k=c[k*3+2];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(x,z,m)],null,g))},f4n:function(a,c,b,e,f,g,j,k,m,o,n){j=a.materials[j];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];var y=c[o*3],A=c[o*3+1];o=c[o*3+2];var G=c[n*3],I=c[n*3+1];n=c[n*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
- z,m),new THREE.Vector3(y,A,o),new THREE.Vector3(G,I,n)],null,j))},uv3:function(a,c,b,e,f,g,j){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,j));a.push(k)},uv4:function(a,c,b,e,f,g,j,k,m){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(e,f));o.push(new THREE.UV(g,j));o.push(new THREE.UV(k,m));a.push(o)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
- THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
- 0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,g,j,k,m,o,n,x){j=(j-n)/(x-n);n=this.normal_cache;e[g]=k+j*this.delta;e[g+1]=m;e[g+2]=o;f[g]=this.lerp(n[b],n[b+3],j);f[g+1]=this.lerp(n[b+1],n[b+4],j);f[g+2]=this.lerp(n[b+2],n[b+5],j)};this.VIntY=function(b,e,f,g,j,k,m,o,n,x){j=(j-n)/(x-n);n=this.normal_cache;e[g]=k;e[g+1]=m+j*this.delta;e[g+
- 2]=o;e=b+this.yd*3;f[g]=this.lerp(n[b],n[e],j);f[g+1]=this.lerp(n[b+1],n[e+1],j);f[g+2]=this.lerp(n[b+2],n[e+2],j)};this.VIntZ=function(b,e,f,g,j,k,m,o,n,x){j=(j-n)/(x-n);n=this.normal_cache;e[g]=k;e[g+1]=m;e[g+2]=o+j*this.delta;e=b+this.zd*3;f[g]=this.lerp(n[b],n[e],j);f[g+1]=this.lerp(n[b+1],n[e+1],j);f[g+2]=this.lerp(n[b+2],n[e+2],j)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
- this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,f,g,j,k){var m=g+1,o=g+this.yd,n=g+this.zd,x=m+this.yd,z=m+this.zd,y=g+this.yd+this.zd,A=m+this.yd+this.zd,G=0,I=this.field[g],J=this.field[m],L=this.field[o],B=this.field[x],N=this.field[n],P=this.field[z],R=this.field[y],ma=this.field[A];I<j&&(G|=1);J<j&&(G|=2);L<j&&(G|=8);B<j&&(G|=4);N<j&&(G|=16);P<j&&(G|=32);R<j&&(G|=128);ma<j&&(G|=64);var d=THREE.edgeTable[G];if(d==0)return 0;
- var da=this.delta,W=b+da,$=e+da;da=f+da;if(d&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,j,b,e,f,I,J)}if(d&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,j,W,e,f,J,B)}if(d&4){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,6,j,b,$,f,L,B)}if(d&8){this.compNorm(g);this.compNorm(o);this.VIntY(g*3,this.vlist,this.nlist,9,j,b,e,f,I,L)}if(d&16){this.compNorm(n);this.compNorm(z);this.VIntX(n*3,this.vlist,this.nlist,12,j,
- b,e,da,N,P)}if(d&32){this.compNorm(z);this.compNorm(A);this.VIntY(z*3,this.vlist,this.nlist,15,j,W,e,da,P,ma)}if(d&64){this.compNorm(y);this.compNorm(A);this.VIntX(y*3,this.vlist,this.nlist,18,j,b,$,da,R,ma)}if(d&128){this.compNorm(n);this.compNorm(y);this.VIntY(n*3,this.vlist,this.nlist,21,j,b,e,da,N,R)}if(d&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,e,f,I,N)}if(d&512){this.compNorm(m);this.compNorm(z);this.VIntZ(m*3,this.vlist,this.nlist,27,j,W,e,f,J,P)}if(d&
- 1024){this.compNorm(x);this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,j,W,$,f,B,ma)}if(d&2048){this.compNorm(o);this.compNorm(y);this.VIntZ(o*3,this.vlist,this.nlist,33,j,b,$,f,L,R)}G<<=4;for(j=g=0;THREE.triTable[G+j]!=-1;){b=G+j;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],k);j+=3;g++}return g};this.posnormtriv=function(b,e,f,g,j,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+
- 2]=b[f+2];this.positionArray[m+3]=b[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[j];this.positionArray[m+7]=b[j+1];this.positionArray[m+8]=b[j+2];this.normalArray[m]=e[f];this.normalArray[m+1]=e[f+1];this.normalArray[m+2]=e[f+2];this.normalArray[m+3]=e[g];this.normalArray[m+4]=e[g+1];this.normalArray[m+5]=e[g+2];this.normalArray[m+6]=e[j];this.normalArray[m+7]=e[j+1];this.normalArray[m+8]=e[j+2];this.hasPos=!0;this.hasNormal=!0;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(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,f,g,j){var k=this.size*Math.sqrt(g/j),m=f*this.size,o=e*this.size,n=b*this.size,x=Math.floor(m-k);x<1&&(x=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var z=Math.floor(o-k);z<1&&(z=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var y=Math.floor(n-
- k);y<1&&(y=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-1);for(var A,G,I,J,L,B;x<m;x++){n=this.size2*x;G=x/this.size-f;L=G*G;for(G=z;G<o;G++){I=n+this.size*G;A=G/this.size-e;B=A*A;for(A=y;A<k;A++){J=A/this.size-b;J=g/(1.0E-6+J*J+B+L)-j;J>0&&(this.field[I+A]+=J)}}}};this.addPlaneX=function(b,e){var f,g,j,k,m,o=this.size,n=this.yd,x=this.zd,z=this.field,y=o*Math.sqrt(b/e);y>o&&(y=o);for(f=0;f<y;f++){g=f/o;g*=g;k=b/(1.0E-4+g)-e;if(k>0)for(g=0;g<o;g++){m=f+g*n;for(j=0;j<o;j++)z[x*j+m]+=k}}};this.addPlaneY=
- function(b,e){var f,g,j,k,m,o,n=this.size,x=this.yd,z=this.zd,y=this.field,A=n*Math.sqrt(b/e);A>n&&(A=n);for(g=0;g<A;g++){f=g/n;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=g*x;for(f=0;f<n;f++){o=m+f;for(j=0;j<n;j++)y[z*j+o]+=k}}}};this.addPlaneZ=function(b,e){var f,g,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(j=0;j<dist;j++){f=j/size;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=zd*j;for(g=0;g<size;g++){o=m+g*yd;for(f=0;f<size;f++)field[o+f]+=k}}}};this.reset=
- function(){var b;for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,f,g,j,k,m,o,n,x,z=this.size-2;for(j=1;j<z;j++){x=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(g=1;g<z;g++){n=x+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<z;f++){k=(f-this.halfsize)/this.halfsize;e=n+f;this.polygonize(k,m,o,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;this.render(function(f){var g,j,k,
- m,o,n,x,z;for(g=0;g<f.count;g++){o=g*3;x=o+1;z=o+2;j=f.positionArray[o];k=f.positionArray[x];m=f.positionArray[z];n=new THREE.Vector3(j,k,m);j=f.normalArray[o];k=f.normalArray[x];m=f.normalArray[z];o=new THREE.Vector3(j,k,m);o.normalize();o=new THREE.Vertex(n,o);e.vertices.push(o)}nfaces=f.count/3;for(g=0;g<nfaces;g++){o=(b+g)*3;x=o+1;z=o+2;n=e.vertices[o].normal;j=e.vertices[x].normal;k=e.vertices[z].normal;o=new THREE.Face3(o,x,z,[n,j,k]);e.faces.push(o)}b+=nfaces;f.count=0});return e};this.init(a)};
- THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
- 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,
- 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,
- 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2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