| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459 |
- // 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,h,j,m;if(b==0)e=f=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);m=b*(1-c*j);c=b*(1-c*(1-j));switch(h){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,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(J,C,K,z){z=z.clone().subSelf(C);K=K.clone().subSelf(C);var W=J.clone().subSelf(C);J=z.dot(z);C=z.dot(K);z=z.dot(W);var S=K.dot(K);K=K.dot(W);W=1/(J*S-C*C);S=(S*z-C*K)*W;J=(J*K-C*z)*W;return S>0&&J>0&&S+J<1}var b,e,f,g,h,j,m,n,p,t,
- x,o=a.geometry,y=o.vertices,H=[];b=0;for(e=o.faces.length;b<e;b++){f=o.faces[b];t=this.origin.clone();x=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(y[f.a].position.clone());h=m.multiplyVector3(y[f.b].position.clone());j=m.multiplyVector3(y[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(y[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());p=x.dot(n);if(p<0){n=n.dot((new THREE.Vector3).sub(g,t))/p;t=t.addSelf(x.multiplyScalar(n));
- if(f instanceof THREE.Face3){if(c(t,g,h,j)){f={distance:this.origin.distanceTo(t),point:t,face:f,object:a};H.push(f)}}else if(f instanceof THREE.Face4&&(c(t,g,h,m)||c(t,h,j,m))){f={distance:this.origin.distanceTo(t),point:t,face:f,object:a};H.push(f)}}}return H}};
- THREE.Rectangle=function(){function a(){g=e-c;h=f-b}var c,b,e,f,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,n,p,t){j=!1;c=m;b=n;e=p;f=t;a()};this.addPoint=function(m,n){if(j){j=!1;c=m;b=n;e=m;f=n}else{c=c<m?c:m;b=b<n?b:n;e=e>m?e:m;f=f>n?f:n}a()};
- this.add3Points=function(m,n,p,t,x,o){if(j){j=!1;c=m<p?m<x?m:x:p<x?p:x;b=n<t?n<o?n:o:t<o?t:o;e=m>p?m>x?m:x:p>x?p:x;f=n>t?n>o?n:o:t>o?t:o}else{c=m<p?m<x?m<c?m:c:x<c?x:c:p<x?p<c?p:c:x<c?x:c;b=n<t?n<o?n<b?n:b:o<b?o:b:t<o?t<b?t:b:o<b?o:b;e=m>p?m>x?m>e?m:e:x>e?x:e:p>x?p>e?p:e:x>e?x:e;f=n>t?n>o?n>f?n:f:o>f?o:f:t>o?t>f?t:f:o>f?o:f}a()};this.addRectangle=function(m){if(j){j=!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(){j=!0;f=e=b=c=0;a()};this.isEmpty=function(){return j}};
- 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,h,j,m,n,p,t,x,o,y,H){this.set(a||1,c||0,b||0,e||0,f||0,g||1,h||0,j||0,m||0,n||0,p||1,t||0,x||0,o||0,y||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,h,j,m,n,p,t,x,o,y,H){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=m;this.n32=n;this.n33=p;this.n34=t;this.n41=x;this.n42=o;this.n43=y;this.n44=H;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,h=a.n21,j=a.n22,m=a.n23,n=a.n24,p=a.n31,t=a.n32,x=a.n33,o=a.n34,y=a.n41,H=a.n42,J=a.n43,C=a.n44,K=c.n11,z=c.n12,W=c.n13,S=c.n14,R=c.n21,ia=c.n22,
- ea=c.n23,qa=c.n24,na=c.n31,Y=c.n32,d=c.n33,Ea=c.n34;this.n11=b*K+e*R+f*na;this.n12=b*z+e*ia+f*Y;this.n13=b*W+e*ea+f*d;this.n14=b*S+e*qa+f*Ea+g;this.n21=h*K+j*R+m*na;this.n22=h*z+j*ia+m*Y;this.n23=h*W+j*ea+m*d;this.n24=h*S+j*qa+m*Ea+n;this.n31=p*K+t*R+x*na;this.n32=p*z+t*ia+x*Y;this.n33=p*W+t*ea+x*d;this.n34=p*S+t*qa+x*Ea+o;this.n41=y*K+H*R+J*na;this.n42=y*z+H*ia+J*Y;this.n43=y*W+H*ea+J*d;this.n44=y*S+H*qa+J*Ea+C;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,h=this.n23,j=this.n24,m=this.n31,n=this.n32,p=this.n33,t=this.n34,x=this.n41,o=this.n42,y=this.n43,H=this.n44;return e*h*n*x-b*j*n*x-e*g*p*x+c*j*p*x+b*g*t*x-c*h*t*x-e*h*m*o+b*j*m*o+e*f*p*o-a*j*p*o-b*f*t*o+a*h*t*o+e*g*m*y-c*j*m*y-e*f*n*y+a*j*n*y+c*f*t*y-a*g*t*y-b*g*m*H+c*h*m*H+b*f*n*H-a*h*n*H-c*f*p*H+a*g*p*H},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,h=a.y,j=
- a.z,m=f*g,n=f*h;this.set(m*g+b,m*h-e*j,m*j+e*h,0,m*h+e*j,n*h+b,n*j-e*g,0,m*j-e*h,n*j+e*g,f*j*j+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 h=a*b,j=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=j*g+a*e;this.n22=-j*e+a*g;this.n23=-c*f;this.n31=-h*g+c*e;this.n32=h*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,h=b+b,j=e+e;a=c*g;var m=c*h;c*=j;var n=b*h;b*=j;e*=j;g*=f;h*=f;f*=j;this.n11=1-(n+e);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
- a.n14;this.n24=a.n24;this.n34=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,h=a.n21,j=a.n22,m=a.n23,n=a.n24,p=a.n31,t=a.n32,x=a.n33,o=a.n34,y=a.n41,H=a.n42,J=a.n43,C=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*o*H-n*x*H+n*t*J-j*o*J-m*t*C+j*x*C;c.n12=g*x*H-f*o*H-g*t*J+e*o*J+f*t*C-e*x*C;c.n13=f*n*H-g*m*H+g*j*J-e*n*J-f*j*C+e*m*C;c.n14=g*m*t-f*n*t-g*j*x+e*n*x+f*j*o-e*m*o;c.n21=n*x*y-m*o*y-n*p*J+h*o*J+m*p*C-h*x*C;c.n22=f*o*y-g*x*y+g*p*J-b*o*J-f*p*C+b*x*C;c.n23=g*m*y-f*n*y-g*h*J+b*n*J+f*h*C-b*m*C;
- c.n24=f*n*p-g*m*p+g*h*x-b*n*x-f*h*o+b*m*o;c.n31=j*o*y-n*t*y+n*p*H-h*o*H-j*p*C+h*t*C;c.n32=g*t*y-e*o*y-g*p*H+b*o*H+e*p*C-b*t*C;c.n33=f*n*y-g*j*y+g*h*H-b*n*H-e*h*C+b*j*C;c.n34=g*j*p-e*n*p-g*h*t+b*n*t+e*h*o-b*j*o;c.n41=m*t*y-j*x*y-m*p*H+h*x*H+j*p*J-h*t*J;c.n42=e*x*y-f*t*y+f*p*H-b*x*H-e*p*J+b*t*J;c.n43=f*j*y-e*m*y-f*h*H+b*m*H+e*h*J-b*j*J;c.n44=e*m*p-f*j*p+f*h*t-b*m*t-e*h*x+b*j*x;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,h=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*n;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*h;b[4]=a*j;b[5]=a*m;b[6]=a*n;b[7]=a*p;b[8]=a*t;return c};
- THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,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 h,j,m,n;h=new THREE.Matrix4;j=c-a;m=b-e;n=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+e)/m);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
- 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 h=a*c,j=e*f;this.w=h*g-j*b;this.x=h*b+j*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,h=a.y,j=a.z;a=a.w;this.x=c*a+f*g+b*j-e*h;this.y=b*a+f*h+e*g-c*j;this.z=e*a+f*j+c*h-b*g;this.w=f*a-c*g-b*h-e*j;return this},
- multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,f=a.z,g=this.x,h=this.y,j=this.z,m=this.w,n=m*b+h*f-j*e,p=m*e+j*b-g*f,t=m*f+g*e-h*b;b=-g*b-h*e-j*f;c.x=n*m+b*-g+p*-j-t*-h;c.y=p*m+b*-h+t*-g-n*-j;c.z=t*m+b*-j+n*-h-p*-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),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){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)/h;e=Math.sin(e*g)/h;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,h){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=h instanceof Array?h:[h];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,h,j=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){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,b.position);m.sub(c.position,b.position);j.crossSelf(m)}j.isZero()||
- j.normalize();g.normal.copy(j)}},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(za,va,ga,X,N,ka,Aa){j=za.vertices[va].position;m=za.vertices[ga].position;n=za.vertices[X].position;p=h[N];t=h[ka];x=h[Aa];o=m.x-j.x;y=n.x-j.x;H=m.y-j.y;J=n.y-j.y;C=m.z-j.z;K=n.z-j.z;z=t.u-p.u;W=x.u-p.u;S=t.v-p.v;R=x.v-p.v;ia=1/(z*R-W*
- S);Y.set((R*o-S*y)*ia,(R*H-S*J)*ia,(R*C-S*K)*ia);d.set((z*y-W*o)*ia,(z*J-W*H)*ia,(z*K-W*C)*ia);qa[va].addSelf(Y);qa[ga].addSelf(Y);qa[X].addSelf(Y);na[va].addSelf(d);na[ga].addSelf(d);na[X].addSelf(d)}var c,b,e,f,g,h,j,m,n,p,t,x,o,y,H,J,C,K,z,W,S,R,ia,ea,qa=[],na=[],Y=new THREE.Vector3,d=new THREE.Vector3,Ea=new THREE.Vector3,la=new THREE.Vector3,Ha=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){qa[c]=new THREE.Vector3;na[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];
- h=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 ta=["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++){Ha.copy(g.vertexNormals[e]);f=g[ta[e]];ea=qa[f];Ea.copy(ea);Ea.subSelf(Ha.multiplyScalar(Ha.dot(ea))).normalize();la.cross(g.vertexNormals[e],ea);f=la.dot(na[f]);f=f<0?-1:1;g.vertexTangents[e]=new THREE.Vector4(Ea.x,Ea.y,
- Ea.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(o,y,H,J,C,K,z){o=(H-o)*0.5;J=(J-y)*0.5;return(2*(y-H)+o+J)*z+(-3*(y-H)-2*o-J)*K+o*C+y}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,h,j,m,n,p,t,x;this.initFromArray=function(o){this.points=[];for(var y=0;y<o.length;y++)this.points[y]={x:o[y][0],y:o[y][1],z:o[y][2]}};this.getPoint=function(o){f=(this.points.length-1)*o;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];p=this.points[b[1]];
- t=this.points[b[2]];x=this.points[b[3]];j=h*h;m=h*j;e.x=c(n.x,p.x,t.x,x.x,h,j,m);e.y=c(n.y,p.y,t.y,x.y,h,j,m);e.z=c(n.z,p.z,t.z,x.z,h,j,m);return e};this.getControlPointsArray=function(){var o,y,H=this.points.length,J=[];for(o=0;o<H;o++){y=this.points[o];J[o]=[y.x,y.y,y.z]}return J};this.getLength=function(o){var y,H,J=y=y=0,C=new THREE.Vector3,K=new THREE.Vector3,z=[],W=0;z[0]=0;o||(o=100);H=this.points.length*o;C.copy(this.points[0]);for(o=1;o<H;o++){y=o/H;position=this.getPoint(y);K.copy(position);
- W+=K.distanceTo(C);C.copy(position);y*=this.points.length-1;y=Math.floor(y);if(y!=J){z[y]=W;J=y}}z[z.length]=W;return{chunks:z,total:W}};this.reparametrizeByArcLength=function(o){var y,H,J,C,K,z,W=[],S=new THREE.Vector3,R=this.getLength();W.push(S.copy(this.points[0]).clone());for(y=1;y<this.points.length;y++){H=R.chunks[y]-R.chunks[y-1];z=Math.ceil(o*H/R.total);C=(y-1)/(this.points.length-1);K=y/(this.points.length-1);for(H=1;H<z-1;H++){J=C+H*(1/z)*(K-C);position=this.getPoint(J);W.push(S.copy(position).clone())}W.push(S.copy(this.points[y]).clone())}this.points=
- W}};
- THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
- 0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var n=f.hierarchy[g].keys[h].morphTargets[m];j[n]=-1}f.hierarchy[g].usedMorphTargets=j;for(h=0;h<f.hierarchy[g].keys.length;h++){var p=
- {};for(n in j){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===n){p[n]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(p[n]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=p}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
- f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(h));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var h=0;h<f.bones.length;h++)g.push(f.bones[h]);else e(f,g);return g};var e=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)e(f.children[h],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,h,j,m,n,p=this.data.JIT.hierarchy,t,x;this.currentTime+=a*this.timeScale;x=this.currentTime;t=this.currentTime%=this.data.length;n=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,y=this.hierarchy.length;o<y;o++){a=this.hierarchy[o];m=a.animationCache;if(this.JITCompile&&p[o][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=p[o][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
- !1}else{a.matrix=p[o][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var H=0;H<3;H++){b=c[H];h=m.prevKey[b];j=m.nextKey[b];if(j.time<=x){if(t<x)if(this.loop){h=this.data.hierarchy[o].keys[0];for(j=this.getNextKeyWith(b,o,1);j.time<t;){h=j;j=this.getNextKeyWith(b,o,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,o,j.index+1)}while(j.time<
- t)}m.prevKey[b]=h;m.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-h.time)/(j.time-h.time);f=h[b];g=j[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o);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",o,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",o,j.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&&p[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)p[o][n]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
- THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,g,h,j,m,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];m=a[b[2]];n=a[b[3]];b=f*f;h=f*b;e[0]=this.interpolate(g[0],j[0],m[0],n[0],f,b,h);e[1]=this.interpolate(g[1],j[1],m[1],n[1],f,b,h);e[2]=this.interpolate(g[2],j[2],m[2],n[2],f,b,h);return e};
- THREE.Animation.prototype.interpolate=function(a,c,b,e,f,g,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-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){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
- THREE.LensFlare=function(a,c,b,e){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;a!==undefined&&this.add(a,c,b,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
- THREE.LensFlare.prototype.add=function(a,c,b,e){c===undefined&&(c=-1);b===undefined&&(b=0);if(e===undefined)e=THREE.BillboardBlending;b=Math.min(b,Math.max(0,b));this.lensFlares.push({texture:a,size:c,distance:b,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:e})};
- THREE.LensFlare.prototype.updateLensFlares=function(a){var c,b=this.lensFlares.length,e,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(c=0;c<b;c++){e=this.lensFlares[c];e.x=this.positionScreen.x+f*e.distance;e.y=this.positionScreen.y+g*e.distance;e.wantedScale=a*0.2+0.8;e.wantedRotation=e.x*Math.PI*0.25;e.wantedOpacity=a;e.scale+=(e.wantedScale-e.scale)*0.25;e.rotation+=(e.wantedRotation-e.rotation)*0.25;e.opacity+=(e.wantedOpacity-e.opacity)*0.5}};THREE.NoShading=0;THREE.FlatShading=1;
- THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.AdditiveAlphaBlending=5;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,h,j;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;h=f.rotq;j=f.scl;e=this.addBone();e.name=f.name;e.position.set(g[0],g[1],g[2]);e.quaternion.set(h[0],h[1],h[2],h[3]);e.useQuaternion=!0;j!==undefined?e.scale.set(j[0],j[1],j[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,h,j,m,n,p,t=["a","b","c","d"];for(m=0;m<g;m++){j=c.length;h=f[m];if(h instanceof THREE.Face4){n=4;j=new THREE.Face4(j,j+1,j+2,j+3)}else{n=3;j=new THREE.Face3(j,j+1,j+2)}j.normal.copy(h.normal);b.push(j);for(j=
- 0;j<n;j++){p=a[h[t[j]]];c.push(new THREE.Vertex(p.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){j=b[h];j=this.facesShareEdge(c,a,j);if(j!==undefined){j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]);j.normal.set(1,0,0);e.push(j)}}}};
- THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var e,f,g,h,j,m,n,p,t,x,o,y,H,J=0,C=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(y=0;y<e;y++){g=c[C[y]];j=a[g];for(H=0;H<f;H++){h=b[C[H]];m=a[h];if(Math.abs(j.position.x-m.position.x)<1.0E-4&&Math.abs(j.position.y-m.position.y)<1.0E-4&&Math.abs(j.position.z-m.position.z)<1.0E-4){J++;if(J===1){n=j;p=m;t=g;x=h;o=C[y]}if(J===2){o+=C[y];return o==="ad"||o==="ac"?{faces:[c,b],vertices:[n,p,m,j],indices:[t,
- x,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[n,j,m,p],indices:[t,g,h,x],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 Y=m[j]=m[j]||new THREE.RenderableVertex;j++;return Y}function c(Y,d){return d.z-Y.z}function b(Y,d){var Ea=0,la=1,Ha=Y.z+Y.w,ta=d.z+d.w,za=-Y.z+Y.w,va=-d.z+d.w;if(Ha>=0&&ta>=0&&za>=0&&va>=0)return!0;else if(Ha<0&&ta<0||za<0&&va<0)return!1;else{if(Ha<0)Ea=Math.max(Ea,Ha/(Ha-ta));else ta<0&&(la=Math.min(la,Ha/(Ha-ta)));if(za<0)Ea=Math.max(Ea,za/(za-va));else va<0&&(la=Math.min(la,za/(za-va)));if(la<Ea)return!1;else{Y.lerpSelf(d,Ea);d.lerpSelf(Y,1-la);return!0}}}
- var e,f,g=[],h,j,m=[],n,p,t=[],x,o=[],y,H,J=[],C,K,z=[],W=new THREE.Vector4,S=new THREE.Vector4,R=new THREE.Matrix4,ia=new THREE.Matrix4,ea=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Vector4,na=new THREE.Vector4;this.projectVector=function(Y,d){R.multiply(d.projectionMatrix,d.matrixWorldInverse);R.multiplyVector3(Y);return Y};this.unprojectVector=function(Y,d){R.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));
- R.multiplyVector3(Y);return Y};this.projectObjects=function(Y,d,Ea){d=[];var la,Ha,ta;f=0;Ha=Y.objects;Y=0;for(la=Ha.length;Y<la;Y++){ta=Ha[Y];var za;if(!(za=!ta.visible))if(za=ta instanceof THREE.Mesh){a:{za=void 0;for(var va=ta.matrixWorld,ga=-ta.geometry.boundingSphere.radius*Math.max(ta.scale.x,Math.max(ta.scale.y,ta.scale.z)),X=0;X<6;X++){za=ea[X].x*va.n14+ea[X].y*va.n24+ea[X].z*va.n34+ea[X].w;if(za<=ga){za=!1;break a}}za=!0}za=!za}if(!za){za=g[f]=g[f]||new THREE.RenderableObject;f++;e=za;W.copy(ta.position);
- R.multiplyVector3(W);e.object=ta;e.z=W.z;d.push(e)}}Ea&&d.sort(c);return d};this.projectScene=function(Y,d,Ea){var la=[],Ha=d.near,ta=d.far,za,va,ga,X,N,ka,Aa,pa,Ba,Fa,Ja,Wa,bb,Xa,L,T,ma;K=H=x=p=0;d.matrixAutoUpdate&&d.updateMatrix();Y.update(undefined,!1,d);R.multiply(d.projectionMatrix,d.matrixWorldInverse);ea[0].set(R.n41-R.n11,R.n42-R.n12,R.n43-R.n13,R.n44-R.n14);ea[1].set(R.n41+R.n11,R.n42+R.n12,R.n43+R.n13,R.n44+R.n14);ea[2].set(R.n41+R.n21,R.n42+R.n22,R.n43+R.n23,R.n44+R.n24);ea[3].set(R.n41-
- R.n21,R.n42-R.n22,R.n43-R.n23,R.n44-R.n24);ea[4].set(R.n41-R.n31,R.n42-R.n32,R.n43-R.n33,R.n44-R.n34);ea[5].set(R.n41+R.n31,R.n42+R.n32,R.n43+R.n33,R.n44+R.n34);for(za=0;za<6;za++){Ba=ea[za];Ba.divideScalar(Math.sqrt(Ba.x*Ba.x+Ba.y*Ba.y+Ba.z*Ba.z))}Ba=this.projectObjects(Y,d,!0);Y=0;for(za=Ba.length;Y<za;Y++){Fa=Ba[Y].object;if(Fa.visible){Ja=Fa.matrixWorld;Wa=Fa.matrixRotationWorld;bb=Fa.materials;Xa=Fa.overdraw;j=0;if(Fa instanceof THREE.Mesh){L=Fa.geometry;X=L.vertices;T=L.faces;L=L.faceVertexUvs;
- va=0;for(ga=X.length;va<ga;va++){h=a();h.positionWorld.copy(X[va].position);Ja.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);R.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>Ha&&h.positionScreen.z<ta}X=0;for(va=T.length;X<va;X++){ga=T[X];if(ga instanceof THREE.Face3){N=m[ga.a];ka=m[ga.b];Aa=m[ga.c];if(N.visible&&ka.visible&&Aa.visible&&(Fa.doubleSided||Fa.flipSided!=(Aa.positionScreen.x-
- N.positionScreen.x)*(ka.positionScreen.y-N.positionScreen.y)-(Aa.positionScreen.y-N.positionScreen.y)*(ka.positionScreen.x-N.positionScreen.x)<0)){pa=t[p]=t[p]||new THREE.RenderableFace3;p++;n=pa;n.v1.copy(N);n.v2.copy(ka);n.v3.copy(Aa)}else continue}else if(ga instanceof THREE.Face4){N=m[ga.a];ka=m[ga.b];Aa=m[ga.c];pa=m[ga.d];if(N.visible&&ka.visible&&Aa.visible&&pa.visible&&(Fa.doubleSided||Fa.flipSided!=((pa.positionScreen.x-N.positionScreen.x)*(ka.positionScreen.y-N.positionScreen.y)-(pa.positionScreen.y-
- N.positionScreen.y)*(ka.positionScreen.x-N.positionScreen.x)<0||(ka.positionScreen.x-Aa.positionScreen.x)*(pa.positionScreen.y-Aa.positionScreen.y)-(ka.positionScreen.y-Aa.positionScreen.y)*(pa.positionScreen.x-Aa.positionScreen.x)<0))){ma=o[x]=o[x]||new THREE.RenderableFace4;x++;n=ma;n.v1.copy(N);n.v2.copy(ka);n.v3.copy(Aa);n.v4.copy(pa)}else continue}n.normalWorld.copy(ga.normal);Wa.multiplyVector3(n.normalWorld);n.centroidWorld.copy(ga.centroid);Ja.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);
- R.multiplyVector3(n.centroidScreen);Aa=ga.vertexNormals;N=0;for(ka=Aa.length;N<ka;N++){pa=n.vertexNormalsWorld[N];pa.copy(Aa[N]);Wa.multiplyVector3(pa)}N=0;for(ka=L.length;N<ka;N++)if(ma=L[N][X]){Aa=0;for(pa=ma.length;Aa<pa;Aa++)n.uvs[N][Aa]=ma[Aa]}n.meshMaterials=bb;n.faceMaterials=ga.materials;n.overdraw=Xa;n.z=n.centroidScreen.z;la.push(n)}}else if(Fa instanceof THREE.Line){ia.multiply(R,Ja);X=Fa.geometry.vertices;N=a();N.positionScreen.copy(X[0].position);ia.multiplyVector4(N.positionScreen);
- va=1;for(ga=X.length;va<ga;va++){N=a();N.positionScreen.copy(X[va].position);ia.multiplyVector4(N.positionScreen);ka=m[j-2];qa.copy(N.positionScreen);na.copy(ka.positionScreen);if(b(qa,na)){qa.multiplyScalar(1/qa.w);na.multiplyScalar(1/na.w);Ja=J[H]=J[H]||new THREE.RenderableLine;H++;y=Ja;y.v1.positionScreen.copy(qa);y.v2.positionScreen.copy(na);y.z=Math.max(qa.z,na.z);y.materials=Fa.materials;la.push(y)}}}else if(Fa instanceof THREE.Particle){S.set(Fa.position.x,Fa.position.y,Fa.position.z,1);R.multiplyVector4(S);
- S.z/=S.w;if(S.z>0&&S.z<1){Ja=z[K]=z[K]||new THREE.RenderableParticle;K++;C=Ja;C.x=S.x/S.w;C.y=S.y/S.w;C.z=S.z;C.rotation=Fa.rotation.z;C.scale.x=Fa.scale.x*Math.abs(C.x-(S.x+d.projectionMatrix.n11)/(S.w+d.projectionMatrix.n14));C.scale.y=Fa.scale.y*Math.abs(C.y-(S.y+d.projectionMatrix.n22)/(S.w+d.projectionMatrix.n24));C.materials=Fa.materials;la.push(C)}}}}Ea&&la.sort(c);return la}};
- 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(h,j){b=h;e=j;f=b/2;g=e/2};this.render=function(h,j){var m,n,p,t,x,o,y,H;a=c.projectScene(h,j);m=0;for(n=a.length;m<n;m++){x=a[m];if(x instanceof THREE.RenderableParticle){y=x.x*f+f;H=x.y*g+g;p=0;for(t=x.material.length;p<t;p++){o=x.material[p];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=y+"px";o.style.top=H+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(aa){if(x!=aa)n.globalAlpha=x=aa}function c(aa){if(o!=aa){switch(aa){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}o=aa}}var b=null,e=new THREE.Projector,f=document.createElement("canvas"),g,h,j,m,n=f.getContext("2d"),p=new THREE.Color(0),t=0,x=1,o=0,y=null,H=null,J=1,C,K,z,W,S=new THREE.RenderableVertex,
- R=new THREE.RenderableVertex,ia,ea,qa,na,Y,d,Ea,la,Ha,ta,za,va,ga=new THREE.Color,X=new THREE.Color,N=new THREE.Color,ka=new THREE.Color,Aa=new THREE.Color,pa,Ba,Fa,Ja,Wa,bb,Xa,L,T,ma,Q=new THREE.Rectangle,O=new THREE.Rectangle,k=new THREE.Rectangle,B=!1,w=new THREE.Color,q=new THREE.Color,A=new THREE.Color,I=new THREE.Color,F=new THREE.Vector3,G,D,U,E,ha,$,ua=16;G=document.createElement("canvas");G.width=G.height=2;D=G.getContext("2d");D.fillStyle="rgba(0,0,0,1)";D.fillRect(0,0,2,2);U=D.getImageData(0,
- 0,2,2);E=U.data;ha=document.createElement("canvas");ha.width=ha.height=ua;$=ha.getContext("2d");$.translate(-ua/2,-ua/2);$.scale(ua,ua);ua--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(aa,xa){g=aa;h=xa;j=g/2;m=h/2;f.width=g;f.height=h;Q.set(-j,-m,j,m);x=1;o=0;H=y=null;J=1};this.setClearColor=function(aa,xa){p=aa;t=xa};this.setClearColorHex=function(aa,xa){p.setHex(aa);t=xa};this.clear=function(){n.setTransform(1,0,0,-1,j,m);if(!O.isEmpty()){O.inflate(1);
- O.minSelf(Q);if(p.hex==0&&t==0)n.clearRect(O.getX(),O.getY(),O.getWidth(),O.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+t+")";n.fillRect(O.getX(),O.getY(),O.getWidth(),O.getHeight())}O.empty()}};this.render=function(aa,xa){function Da(P){var ca,fa,V,sa=P.lights;q.setRGB(0,0,0);A.setRGB(0,0,0);I.setRGB(0,0,0);P=0;for(ca=sa.length;P<ca;P++){fa=sa[P];V=fa.color;if(fa instanceof THREE.AmbientLight){q.r+=V.r;
- q.g+=V.g;q.b+=V.b}else if(fa instanceof THREE.DirectionalLight){A.r+=V.r;A.g+=V.g;A.b+=V.b}else if(fa instanceof THREE.PointLight){I.r+=V.r;I.g+=V.g;I.b+=V.b}}}function Ca(P,ca,fa,V){var sa,ra,Z,da,Ga=P.lights;P=0;for(sa=Ga.length;P<sa;P++){ra=Ga[P];Z=ra.color;da=ra.intensity;if(ra instanceof THREE.DirectionalLight){ra=fa.dot(ra.position)*da;if(ra>0){V.r+=Z.r*ra;V.g+=Z.g*ra;V.b+=Z.b*ra}}else if(ra instanceof THREE.PointLight){F.sub(ra.position,ca);F.normalize();ra=fa.dot(F)*da;if(ra>0){V.r+=Z.r*ra;
- V.g+=Z.g*ra;V.b+=Z.b*ra}}}}function ja(P,ca,fa){a(fa.opacity);c(fa.blending);var V,sa,ra,Z,da,Ga;if(fa instanceof THREE.ParticleBasicMaterial){if(fa.map){Z=fa.map.image;da=Z.width>>1;Ga=Z.height>>1;fa=ca.scale.x*j;ra=ca.scale.y*m;V=fa*da;sa=ra*Ga;k.set(P.x-V,P.y-sa,P.x+V,P.y+sa);if(Q.instersects(k)){n.save();n.translate(P.x,P.y);n.rotate(-ca.rotation);n.scale(fa,-ra);n.translate(-da,-Ga);n.drawImage(Z,0,0);n.restore()}}}else if(fa instanceof THREE.ParticleCanvasMaterial){if(B){w.r=q.r+A.r+I.r;w.g=
- q.g+A.g+I.g;w.b=q.b+A.b+I.b;ga.r=fa.color.r*w.r;ga.g=fa.color.g*w.g;ga.b=fa.color.b*w.b;ga.updateStyleString()}else ga.__styleString=fa.color.__styleString;V=ca.scale.x*j;sa=ca.scale.y*m;k.set(P.x-V,P.y-sa,P.x+V,P.y+sa);if(Q.instersects(k)){n.save();n.translate(P.x,P.y);n.rotate(-ca.rotation);n.scale(V,sa);fa.program(n,ga);n.restore()}}}function oa(P,ca,fa,V){a(V.opacity);c(V.blending);n.beginPath();n.moveTo(P.positionScreen.x,P.positionScreen.y);n.lineTo(ca.positionScreen.x,ca.positionScreen.y);
- n.closePath();if(V instanceof THREE.LineBasicMaterial){ga.__styleString=V.color.__styleString;P=V.linewidth;if(J!=P)n.lineWidth=J=P;P=ga.__styleString;if(y!=P)n.strokeStyle=y=P;n.stroke();k.inflate(V.linewidth*2)}}function wa(P,ca,fa,V,sa,ra,Z,da,Ga){a(da.opacity);c(da.blending);ia=P.positionScreen.x;ea=P.positionScreen.y;qa=ca.positionScreen.x;na=ca.positionScreen.y;Y=fa.positionScreen.x;d=fa.positionScreen.y;Pa(ia,ea,qa,na,Y,d);if(da instanceof THREE.MeshBasicMaterial)if(da.map){if(da.map.mapping instanceof
- THREE.UVMapping){Ja=Z.uvs[0];La(ia,ea,qa,na,Y,d,da.map.image,Ja[V].u,Ja[V].v,Ja[sa].u,Ja[sa].v,Ja[ra].u,Ja[ra].v)}}else if(da.envMap){if(da.envMap.mapping instanceof THREE.SphericalReflectionMapping){P=xa.matrixWorldInverse;F.copy(Z.vertexNormalsWorld[0]);Wa=(F.x*P.n11+F.y*P.n12+F.z*P.n13)*0.5+0.5;bb=-(F.x*P.n21+F.y*P.n22+F.z*P.n23)*0.5+0.5;F.copy(Z.vertexNormalsWorld[1]);Xa=(F.x*P.n11+F.y*P.n12+F.z*P.n13)*0.5+0.5;L=-(F.x*P.n21+F.y*P.n22+F.z*P.n23)*0.5+0.5;F.copy(Z.vertexNormalsWorld[2]);T=(F.x*P.n11+
- F.y*P.n12+F.z*P.n13)*0.5+0.5;ma=-(F.x*P.n21+F.y*P.n22+F.z*P.n23)*0.5+0.5;La(ia,ea,qa,na,Y,d,da.envMap.image,Wa,bb,Xa,L,T,ma)}}else da.wireframe?Na(da.color.__styleString,da.wireframeLinewidth):Ia(da.color.__styleString);else if(da instanceof THREE.MeshLambertMaterial){if(da.map&&!da.wireframe){if(da.map.mapping instanceof THREE.UVMapping){Ja=Z.uvs[0];La(ia,ea,qa,na,Y,d,da.map.image,Ja[V].u,Ja[V].v,Ja[sa].u,Ja[sa].v,Ja[ra].u,Ja[ra].v)}c(THREE.SubtractiveBlending)}if(B)if(!da.wireframe&&da.shading==
- THREE.SmoothShading&&Z.vertexNormalsWorld.length==3){X.r=N.r=ka.r=q.r;X.g=N.g=ka.g=q.g;X.b=N.b=ka.b=q.b;Ca(Ga,Z.v1.positionWorld,Z.vertexNormalsWorld[0],X);Ca(Ga,Z.v2.positionWorld,Z.vertexNormalsWorld[1],N);Ca(Ga,Z.v3.positionWorld,Z.vertexNormalsWorld[2],ka);Aa.r=(N.r+ka.r)*0.5;Aa.g=(N.g+ka.g)*0.5;Aa.b=(N.b+ka.b)*0.5;Fa=eb(X,N,ka,Aa);La(ia,ea,qa,na,Y,d,Fa,0,0,1,0,0,1)}else{w.r=q.r;w.g=q.g;w.b=q.b;Ca(Ga,Z.centroidWorld,Z.normalWorld,w);ga.r=da.color.r*w.r;ga.g=da.color.g*w.g;ga.b=da.color.b*w.b;
- ga.updateStyleString();da.wireframe?Na(ga.__styleString,da.wireframeLinewidth):Ia(ga.__styleString)}else da.wireframe?Na(da.color.__styleString,da.wireframeLinewidth):Ia(da.color.__styleString)}else if(da instanceof THREE.MeshDepthMaterial){pa=xa.near;Ba=xa.far;X.r=X.g=X.b=1-$a(P.positionScreen.z,pa,Ba);N.r=N.g=N.b=1-$a(ca.positionScreen.z,pa,Ba);ka.r=ka.g=ka.b=1-$a(fa.positionScreen.z,pa,Ba);Aa.r=(N.r+ka.r)*0.5;Aa.g=(N.g+ka.g)*0.5;Aa.b=(N.b+ka.b)*0.5;Fa=eb(X,N,ka,Aa);La(ia,ea,qa,na,Y,d,Fa,0,0,1,
- 0,0,1)}else if(da instanceof THREE.MeshNormalMaterial){ga.r=Ta(Z.normalWorld.x);ga.g=Ta(Z.normalWorld.y);ga.b=Ta(Z.normalWorld.z);ga.updateStyleString();da.wireframe?Na(ga.__styleString,da.wireframeLinewidth):Ia(ga.__styleString)}}function Ma(P,ca,fa,V,sa,ra,Z,da,Ga){a(da.opacity);c(da.blending);if(da.map||da.envMap){wa(P,ca,V,0,1,3,Z,da,Ga);wa(sa,fa,ra,1,2,3,Z,da,Ga)}else{ia=P.positionScreen.x;ea=P.positionScreen.y;qa=ca.positionScreen.x;na=ca.positionScreen.y;Y=fa.positionScreen.x;d=fa.positionScreen.y;
- Ea=V.positionScreen.x;la=V.positionScreen.y;Ha=sa.positionScreen.x;ta=sa.positionScreen.y;za=ra.positionScreen.x;va=ra.positionScreen.y;if(da instanceof THREE.MeshBasicMaterial){cb(ia,ea,qa,na,Y,d,Ea,la);da.wireframe?Na(da.color.__styleString,da.wireframeLinewidth):Ia(da.color.__styleString)}else if(da instanceof THREE.MeshLambertMaterial)if(B)if(!da.wireframe&&da.shading==THREE.SmoothShading&&Z.vertexNormalsWorld.length==4){X.r=N.r=ka.r=Aa.r=q.r;X.g=N.g=ka.g=Aa.g=q.g;X.b=N.b=ka.b=Aa.b=q.b;Ca(Ga,
- Z.v1.positionWorld,Z.vertexNormalsWorld[0],X);Ca(Ga,Z.v2.positionWorld,Z.vertexNormalsWorld[1],N);Ca(Ga,Z.v4.positionWorld,Z.vertexNormalsWorld[3],ka);Ca(Ga,Z.v3.positionWorld,Z.vertexNormalsWorld[2],Aa);Fa=eb(X,N,ka,Aa);Pa(ia,ea,qa,na,Ea,la);La(ia,ea,qa,na,Ea,la,Fa,0,0,1,0,0,1);Pa(Ha,ta,Y,d,za,va);La(Ha,ta,Y,d,za,va,Fa,1,0,1,1,0,1)}else{w.r=q.r;w.g=q.g;w.b=q.b;Ca(Ga,Z.centroidWorld,Z.normalWorld,w);ga.r=da.color.r*w.r;ga.g=da.color.g*w.g;ga.b=da.color.b*w.b;ga.updateStyleString();cb(ia,ea,qa,na,
- Y,d,Ea,la);da.wireframe?Na(ga.__styleString,da.wireframeLinewidth):Ia(ga.__styleString)}else{cb(ia,ea,qa,na,Y,d,Ea,la);da.wireframe?Na(da.color.__styleString,da.wireframeLinewidth):Ia(da.color.__styleString)}else if(da instanceof THREE.MeshNormalMaterial){ga.r=Ta(Z.normalWorld.x);ga.g=Ta(Z.normalWorld.y);ga.b=Ta(Z.normalWorld.z);ga.updateStyleString();cb(ia,ea,qa,na,Y,d,Ea,la);da.wireframe?Na(ga.__styleString,da.wireframeLinewidth):Ia(ga.__styleString)}else if(da instanceof THREE.MeshDepthMaterial){pa=
- xa.near;Ba=xa.far;X.r=X.g=X.b=1-$a(P.positionScreen.z,pa,Ba);N.r=N.g=N.b=1-$a(ca.positionScreen.z,pa,Ba);ka.r=ka.g=ka.b=1-$a(V.positionScreen.z,pa,Ba);Aa.r=Aa.g=Aa.b=1-$a(fa.positionScreen.z,pa,Ba);Fa=eb(X,N,ka,Aa);Pa(ia,ea,qa,na,Ea,la);La(ia,ea,qa,na,Ea,la,Fa,0,0,1,0,0,1);Pa(Ha,ta,Y,d,za,va);La(Ha,ta,Y,d,za,va,Fa,1,0,1,1,0,1)}}}function Pa(P,ca,fa,V,sa,ra){n.beginPath();n.moveTo(P,ca);n.lineTo(fa,V);n.lineTo(sa,ra);n.lineTo(P,ca);n.closePath()}function cb(P,ca,fa,V,sa,ra,Z,da){n.beginPath();n.moveTo(P,
- ca);n.lineTo(fa,V);n.lineTo(sa,ra);n.lineTo(Z,da);n.lineTo(P,ca);n.closePath()}function Na(P,ca){if(y!=P)n.strokeStyle=y=P;if(J!=ca)n.lineWidth=J=ca;n.stroke();k.inflate(ca*2)}function Ia(P){if(H!=P)n.fillStyle=H=P;n.fill()}function La(P,ca,fa,V,sa,ra,Z,da,Ga,Ua,ab,Qa,hb){var db,Za;db=Z.width-1;Za=Z.height-1;da*=db;Ga*=Za;Ua*=db;ab*=Za;Qa*=db;hb*=Za;fa-=P;V-=ca;sa-=P;ra-=ca;Ua-=da;ab-=Ga;Qa-=da;hb-=Ga;db=Ua*hb-Qa*ab;if(db!=0){Za=1/db;db=(hb*fa-ab*sa)*Za;ab=(hb*V-ab*ra)*Za;fa=(Ua*sa-Qa*fa)*Za;V=(Ua*
- ra-Qa*V)*Za;P=P-db*da-fa*Ga;ca=ca-ab*da-V*Ga;n.save();n.transform(db,ab,fa,V,P,ca);n.clip();n.drawImage(Z,0,0);n.restore()}}function eb(P,ca,fa,V){var sa=~~(P.r*255),ra=~~(P.g*255);P=~~(P.b*255);var Z=~~(ca.r*255),da=~~(ca.g*255);ca=~~(ca.b*255);var Ga=~~(fa.r*255),Ua=~~(fa.g*255);fa=~~(fa.b*255);var ab=~~(V.r*255),Qa=~~(V.g*255);V=~~(V.b*255);E[0]=sa<0?0:sa>255?255:sa;E[1]=ra<0?0:ra>255?255:ra;E[2]=P<0?0:P>255?255:P;E[4]=Z<0?0:Z>255?255:Z;E[5]=da<0?0:da>255?255:da;E[6]=ca<0?0:ca>255?255:ca;E[8]=
- Ga<0?0:Ga>255?255:Ga;E[9]=Ua<0?0:Ua>255?255:Ua;E[10]=fa<0?0:fa>255?255:fa;E[12]=ab<0?0:ab>255?255:ab;E[13]=Qa<0?0:Qa>255?255:Qa;E[14]=V<0?0:V>255?255:V;D.putImageData(U,0,0);$.drawImage(G,0,0);return ha}function $a(P,ca,fa){P=(P-ca)/(fa-ca);return P*P*(3-2*P)}function Ta(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function Va(P,ca){var fa=ca.x-P.x,V=ca.y-P.y,sa=1/Math.sqrt(fa*fa+V*V);fa*=sa;V*=sa;ca.x+=fa;ca.y+=V;P.x-=fa;P.y-=V}var Ka,Ya,ya,M,Oa,Ra,fb,Sa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,
- j,m);b=e.projectScene(aa,xa,this.sortElements);(B=aa.lights.length>0)&&Da(aa);Ka=0;for(Ya=b.length;Ka<Ya;Ka++){ya=b[Ka];k.empty();if(ya instanceof THREE.RenderableParticle){C=ya;C.x*=j;C.y*=m;M=0;for(Oa=ya.materials.length;M<Oa;){Sa=ya.materials[M++];Sa.opacity!=0&&ja(C,ya,Sa,aa)}}else if(ya instanceof THREE.RenderableLine){C=ya.v1;K=ya.v2;C.positionScreen.x*=j;C.positionScreen.y*=m;K.positionScreen.x*=j;K.positionScreen.y*=m;k.addPoint(C.positionScreen.x,C.positionScreen.y);k.addPoint(K.positionScreen.x,
- K.positionScreen.y);if(Q.instersects(k)){M=0;for(Oa=ya.materials.length;M<Oa;){Sa=ya.materials[M++];Sa.opacity!=0&&oa(C,K,ya,Sa,aa)}}}else if(ya instanceof THREE.RenderableFace3){C=ya.v1;K=ya.v2;z=ya.v3;C.positionScreen.x*=j;C.positionScreen.y*=m;K.positionScreen.x*=j;K.positionScreen.y*=m;z.positionScreen.x*=j;z.positionScreen.y*=m;if(ya.overdraw){Va(C.positionScreen,K.positionScreen);Va(K.positionScreen,z.positionScreen);Va(z.positionScreen,C.positionScreen)}k.add3Points(C.positionScreen.x,C.positionScreen.y,
- K.positionScreen.x,K.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(Q.instersects(k)){M=0;for(Oa=ya.meshMaterials.length;M<Oa;){Sa=ya.meshMaterials[M++];if(Sa instanceof THREE.MeshFaceMaterial){Ra=0;for(fb=ya.faceMaterials.length;Ra<fb;)(Sa=ya.faceMaterials[Ra++])&&Sa.opacity!=0&&wa(C,K,z,0,1,2,ya,Sa,aa)}else Sa.opacity!=0&&wa(C,K,z,0,1,2,ya,Sa,aa)}}}else if(ya instanceof THREE.RenderableFace4){C=ya.v1;K=ya.v2;z=ya.v3;W=ya.v4;C.positionScreen.x*=j;C.positionScreen.y*=m;K.positionScreen.x*=
- j;K.positionScreen.y*=m;z.positionScreen.x*=j;z.positionScreen.y*=m;W.positionScreen.x*=j;W.positionScreen.y*=m;S.positionScreen.copy(K.positionScreen);R.positionScreen.copy(W.positionScreen);if(ya.overdraw){Va(C.positionScreen,K.positionScreen);Va(K.positionScreen,W.positionScreen);Va(W.positionScreen,C.positionScreen);Va(z.positionScreen,S.positionScreen);Va(z.positionScreen,R.positionScreen)}k.addPoint(C.positionScreen.x,C.positionScreen.y);k.addPoint(K.positionScreen.x,K.positionScreen.y);k.addPoint(z.positionScreen.x,
- z.positionScreen.y);k.addPoint(W.positionScreen.x,W.positionScreen.y);if(Q.instersects(k)){M=0;for(Oa=ya.meshMaterials.length;M<Oa;){Sa=ya.meshMaterials[M++];if(Sa instanceof THREE.MeshFaceMaterial){Ra=0;for(fb=ya.faceMaterials.length;Ra<fb;)(Sa=ya.faceMaterials[Ra++])&&Sa.opacity!=0&&Ma(C,K,z,W,S,R,ya,Sa,aa)}else Sa.opacity!=0&&Ma(C,K,z,W,S,R,ya,Sa,aa)}}}O.addRectangle(k)}n.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(ta,za,va){var ga,X,N,ka;ga=0;for(X=ta.lights.length;ga<X;ga++){N=ta.lights[ga];if(N instanceof THREE.DirectionalLight){ka=za.normalWorld.dot(N.position)*N.intensity;if(ka>0){va.r+=N.color.r*ka;va.g+=N.color.g*ka;va.b+=N.color.b*ka}}else if(N instanceof THREE.PointLight){qa.sub(N.position,za.centroidWorld);qa.normalize();ka=za.normalWorld.dot(qa)*N.intensity;if(ka>0){va.r+=N.color.r*ka;va.g+=N.color.g*ka;va.b+=N.color.b*ka}}}}function c(ta,za,va,ga,X,N){d=e(Ea++);
- d.setAttribute("d","M "+ta.positionScreen.x+" "+ta.positionScreen.y+" L "+za.positionScreen.x+" "+za.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+"z");if(X instanceof THREE.MeshBasicMaterial)z.__styleString=X.color.__styleString;else if(X instanceof THREE.MeshLambertMaterial)if(K){W.r=S.r;W.g=S.g;W.b=S.b;a(N,ga,W);z.r=X.color.r*W.r;z.g=X.color.g*W.g;z.b=X.color.b*W.b;z.updateStyleString()}else z.__styleString=X.color.__styleString;else if(X instanceof THREE.MeshDepthMaterial){ea=
- 1-X.__2near/(X.__farPlusNear-ga.z*X.__farMinusNear);z.setRGB(ea,ea,ea)}else X instanceof THREE.MeshNormalMaterial&&z.setRGB(f(ga.normalWorld.x),f(ga.normalWorld.y),f(ga.normalWorld.z));X.wireframe?d.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+X.wireframeLinewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.wireframeLinecap+"; stroke-linejoin: "+X.wireframeLinejoin):d.setAttribute("style","fill: "+z.__styleString+"; fill-opacity: "+X.opacity);j.appendChild(d)}
- function b(ta,za,va,ga,X,N,ka){d=e(Ea++);d.setAttribute("d","M "+ta.positionScreen.x+" "+ta.positionScreen.y+" L "+za.positionScreen.x+" "+za.positionScreen.y+" L "+va.positionScreen.x+","+va.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");if(N instanceof THREE.MeshBasicMaterial)z.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshLambertMaterial)if(K){W.r=S.r;W.g=S.g;W.b=S.b;a(ka,X,W);z.r=N.color.r*W.r;z.g=N.color.g*W.g;z.b=N.color.b*W.b;z.updateStyleString()}else z.__styleString=
- N.color.__styleString;else if(N instanceof THREE.MeshDepthMaterial){ea=1-N.__2near/(N.__farPlusNear-X.z*N.__farMinusNear);z.setRGB(ea,ea,ea)}else N instanceof THREE.MeshNormalMaterial&&z.setRGB(f(X.normalWorld.x),f(X.normalWorld.y),f(X.normalWorld.z));N.wireframe?d.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+N.wireframeLinewidth+"; stroke-opacity: "+N.opacity+"; stroke-linecap: "+N.wireframeLinecap+"; stroke-linejoin: "+N.wireframeLinejoin):d.setAttribute("style",
- "fill: "+z.__styleString+"; fill-opacity: "+N.opacity);j.appendChild(d)}function e(ta){if(na[ta]==null){na[ta]=document.createElementNS("http://www.w3.org/2000/svg","path");Ha==0&&na[ta].setAttribute("shape-rendering","crispEdges")}return na[ta]}function f(ta){return ta<0?Math.min((1+ta)*0.5,0.5):0.5+Math.min(ta*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,p,t,x,o,y,H,J=new THREE.Rectangle,C=new THREE.Rectangle,K=!1,z=new THREE.Color(16777215),
- W=new THREE.Color(16777215),S=new THREE.Color(0),R=new THREE.Color(0),ia=new THREE.Color(0),ea,qa=new THREE.Vector3,na=[],Y=[],d,Ea,la,Ha=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ta){switch(ta){case "high":Ha=1;break;case "low":Ha=0}};this.setSize=function(ta,za){m=ta;n=za;p=m/2;t=n/2;j.setAttribute("viewBox",-p+" "+-t+" "+m+" "+n);j.setAttribute("width",m);j.setAttribute("height",n);J.set(-p,-t,p,t)};this.clear=function(){for(;j.childNodes.length>
- 0;)j.removeChild(j.childNodes[0])};this.render=function(ta,za){var va,ga,X,N,ka,Aa,pa,Ba;this.autoClear&&this.clear();g=h.projectScene(ta,za,this.sortElements);la=Ea=0;if(K=ta.lights.length>0){pa=ta.lights;S.setRGB(0,0,0);R.setRGB(0,0,0);ia.setRGB(0,0,0);va=0;for(ga=pa.length;va<ga;va++){X=pa[va];N=X.color;if(X instanceof THREE.AmbientLight){S.r+=N.r;S.g+=N.g;S.b+=N.b}else if(X instanceof THREE.DirectionalLight){R.r+=N.r;R.g+=N.g;R.b+=N.b}else if(X instanceof THREE.PointLight){ia.r+=N.r;ia.g+=N.g;
- ia.b+=N.b}}}va=0;for(ga=g.length;va<ga;va++){pa=g[va];C.empty();if(pa instanceof THREE.RenderableParticle){x=pa;x.x*=p;x.y*=-t;X=0;for(N=pa.materials.length;X<N;)X++}else if(pa instanceof THREE.RenderableLine){x=pa.v1;o=pa.v2;x.positionScreen.x*=p;x.positionScreen.y*=-t;o.positionScreen.x*=p;o.positionScreen.y*=-t;C.addPoint(x.positionScreen.x,x.positionScreen.y);C.addPoint(o.positionScreen.x,o.positionScreen.y);if(J.instersects(C)){X=0;for(N=pa.materials.length;X<N;)if((Ba=pa.materials[X++])&&Ba.opacity!=
- 0){ka=x;Aa=o;var Fa=la++;if(Y[Fa]==null){Y[Fa]=document.createElementNS("http://www.w3.org/2000/svg","line");Ha==0&&Y[Fa].setAttribute("shape-rendering","crispEdges")}d=Y[Fa];d.setAttribute("x1",ka.positionScreen.x);d.setAttribute("y1",ka.positionScreen.y);d.setAttribute("x2",Aa.positionScreen.x);d.setAttribute("y2",Aa.positionScreen.y);if(Ba instanceof THREE.LineBasicMaterial){z.__styleString=Ba.color.__styleString;d.setAttribute("style","fill: none; stroke: "+z.__styleString+"; stroke-width: "+
- Ba.linewidth+"; stroke-opacity: "+Ba.opacity+"; stroke-linecap: "+Ba.linecap+"; stroke-linejoin: "+Ba.linejoin);j.appendChild(d)}}}}else if(pa instanceof THREE.RenderableFace3){x=pa.v1;o=pa.v2;y=pa.v3;x.positionScreen.x*=p;x.positionScreen.y*=-t;o.positionScreen.x*=p;o.positionScreen.y*=-t;y.positionScreen.x*=p;y.positionScreen.y*=-t;C.addPoint(x.positionScreen.x,x.positionScreen.y);C.addPoint(o.positionScreen.x,o.positionScreen.y);C.addPoint(y.positionScreen.x,y.positionScreen.y);if(J.instersects(C)){X=
- 0;for(N=pa.meshMaterials.length;X<N;){Ba=pa.meshMaterials[X++];if(Ba instanceof THREE.MeshFaceMaterial){ka=0;for(Aa=pa.faceMaterials.length;ka<Aa;)(Ba=pa.faceMaterials[ka++])&&Ba.opacity!=0&&c(x,o,y,pa,Ba,ta)}else Ba&&Ba.opacity!=0&&c(x,o,y,pa,Ba,ta)}}}else if(pa instanceof THREE.RenderableFace4){x=pa.v1;o=pa.v2;y=pa.v3;H=pa.v4;x.positionScreen.x*=p;x.positionScreen.y*=-t;o.positionScreen.x*=p;o.positionScreen.y*=-t;y.positionScreen.x*=p;y.positionScreen.y*=-t;H.positionScreen.x*=p;H.positionScreen.y*=
- -t;C.addPoint(x.positionScreen.x,x.positionScreen.y);C.addPoint(o.positionScreen.x,o.positionScreen.y);C.addPoint(y.positionScreen.x,y.positionScreen.y);C.addPoint(H.positionScreen.x,H.positionScreen.y);if(J.instersects(C)){X=0;for(N=pa.meshMaterials.length;X<N;){Ba=pa.meshMaterials[X++];if(Ba instanceof THREE.MeshFaceMaterial){ka=0;for(Aa=pa.faceMaterials.length;ka<Aa;)(Ba=pa.faceMaterials[ka++])&&Ba.opacity!=0&&b(x,o,y,H,pa,Ba,ta)}else Ba&&Ba.opacity!=0&&b(x,o,y,H,pa,Ba,ta)}}}}}};
- 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 ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ 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 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
- lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
- 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:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",
- value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
- THREE.ShaderLib={lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nattribute \tvec2 \tposition;\nattribute vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform int renderPink;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderPink == 1 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}\n}"},
- shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\n}"},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(k,B,w){var q,A,I,F=k.vertices,G=F.length,D=k.colors,U=D.length,E=k.__vertexArray,ha=k.__colorArray,$=k.__sortArray,ua=k.__dirtyVertices,aa=k.__dirtyColors;if(w.sortParticles){Ba.multiplySelf(w.matrixWorld);for(q=0;q<G;q++){A=F[q].position;Wa.copy(A);Ba.multiplyVector3(Wa);$[q]=[Wa.z,q]}$.sort(function(xa,Da){return Da[0]-xa[0]});for(q=0;q<G;q++){A=F[$[q][1]].position;I=q*3;E[I]=A.x;E[I+1]=A.y;E[I+2]=A.z}for(q=0;q<U;q++){I=q*3;color=D[$[q][1]];ha[I]=color.r;
- ha[I+1]=color.g;ha[I+2]=color.b}}else{if(ua)for(q=0;q<G;q++){A=F[q].position;I=q*3;E[I]=A.x;E[I+1]=A.y;E[I+2]=A.z}if(aa)for(q=0;q<U;q++){color=D[q];I=q*3;ha[I]=color.r;ha[I+1]=color.g;ha[I+2]=color.b}}if(ua||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,E,B)}if(aa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,ha,B)}}function b(k,B){k.fragmentShader=B.fragmentShader;k.vertexShader=B.vertexShader;k.uniforms=
- Uniforms.clone(B.uniforms)}function e(k,B,w,q,A){q.program||Ha.initMaterial(q,B,w,A);var I=q.program,F=I.uniforms,G=q.uniforms;if(I!=Ea){d.useProgram(I);Ea=I}d.uniformMatrix4fv(F.projectionMatrix,!1,Fa);if(w&&(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial||q instanceof THREE.LineBasicMaterial||q instanceof THREE.ParticleBasicMaterial)){G.fogColor.value.setHex(w.color.hex);if(w instanceof THREE.Fog){G.fogNear.value=w.near;G.fogFar.value=
- w.far}else if(w instanceof THREE.FogExp2)G.fogDensity.value=w.density}if(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q.lights){var D,U,E=0,ha=0,$=0,ua,aa,xa,Da=bb,Ca=Da.directional.colors,ja=Da.directional.positions,oa=Da.point.colors,wa=Da.point.positions,Ma=0,Pa=0;w=U=U=0;for(D=B.length;w<D;w++){U=B[w];ua=U.color;aa=U.position;xa=U.intensity;if(U instanceof THREE.AmbientLight){E+=ua.r;ha+=ua.g;$+=ua.b}else if(U instanceof THREE.DirectionalLight){U=Ma*3;Ca[U]=ua.r*
- xa;Ca[U+1]=ua.g*xa;Ca[U+2]=ua.b*xa;ja[U]=aa.x;ja[U+1]=aa.y;ja[U+2]=aa.z;Ma+=1}else if(U instanceof THREE.PointLight){U=Pa*3;oa[U]=ua.r*xa;oa[U+1]=ua.g*xa;oa[U+2]=ua.b*xa;wa[U]=aa.x;wa[U+1]=aa.y;wa[U+2]=aa.z;Pa+=1}}for(w=Ma*3;w<Ca.length;w++)Ca[w]=0;for(w=Pa*3;w<oa.length;w++)oa[w]=0;Da.point.length=Pa;Da.directional.length=Ma;Da.ambient[0]=E;Da.ambient[1]=ha;Da.ambient[2]=$;w=bb;G.enableLighting.value=w.directional.length+w.point.length;G.ambientLightColor.value=w.ambient;G.directionalLightColor.value=
- w.directional.colors;G.directionalLightDirection.value=w.directional.positions;G.pointLightColor.value=w.point.colors;G.pointLightPosition.value=w.point.positions}if(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial){G.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);G.opacity.value=q.opacity;G.map.texture=q.map;G.lightMap.texture=q.lightMap;G.envMap.texture=q.envMap;G.reflectivity.value=q.reflectivity;
- G.refractionRatio.value=q.refractionRatio;G.combine.value=q.combine;G.useRefract.value=q.envMap&&q.envMap.mapping instanceof THREE.CubeRefractionMapping}if(q instanceof THREE.LineBasicMaterial){G.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);G.opacity.value=q.opacity}else if(q instanceof THREE.ParticleBasicMaterial){G.psColor.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);G.opacity.value=q.opacity;G.size.value=q.size;G.scale.value=Y.height/
- 2;G.map.texture=q.map}else if(q instanceof THREE.MeshPhongMaterial){G.ambient.value.setRGB(q.ambient.r,q.ambient.g,q.ambient.b);G.specular.value.setRGB(q.specular.r,q.specular.g,q.specular.b);G.shininess.value=q.shininess}else if(q instanceof THREE.MeshDepthMaterial){G.mNear.value=k.near;G.mFar.value=k.far;G.opacity.value=q.opacity}else if(q instanceof THREE.MeshNormalMaterial)G.opacity.value=q.opacity;for(var cb in G)if(ha=I.uniforms[cb]){D=G[cb];E=D.type;w=D.value;if(E=="i")d.uniform1i(ha,w);else if(E==
- "f")d.uniform1f(ha,w);else if(E=="fv1")d.uniform1fv(ha,w);else if(E=="fv")d.uniform3fv(ha,w);else if(E=="v2")d.uniform2f(ha,w.x,w.y);else if(E=="v3")d.uniform3f(ha,w.x,w.y,w.z);else if(E=="c")d.uniform3f(ha,w.r,w.g,w.b);else if(E=="t"){d.uniform1i(ha,w);if(D=D.texture)if(D.image instanceof Array&&D.image.length==6){if(D.image.length==6){if(D.needsUpdate){if(D.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,D.image.__webGLTextureCube);for(E=0;E<6;++E)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,
- 0,0,0,d.RGBA,d.UNSIGNED_BYTE,D.image[E])}else{D.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,D.image.__webGLTextureCube);for(E=0;E<6;++E)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+E,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,D.image[E]);D.__wasSetOnce=!0}S(d.TEXTURE_CUBE_MAP,D,D.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);D.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_CUBE_MAP,D.image.__webGLTextureCube)}}else R(D,w)}}d.uniformMatrix4fv(F.modelViewMatrix,
- !1,A._modelViewMatrixArray);d.uniformMatrix3fv(F.normalMatrix,!1,A._normalMatrixArray);(q instanceof THREE.MeshShaderMaterial||q instanceof THREE.MeshPhongMaterial||q.envMap)&&d.uniform3f(F.cameraPosition,k.position.x,k.position.y,k.position.z);(q instanceof THREE.MeshShaderMaterial||q.envMap||q.skinning)&&d.uniformMatrix4fv(F.objectMatrix,!1,A._objectMatrixArray);(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshShaderMaterial||q.skinning)&&d.uniformMatrix4fv(F.viewMatrix,
- !1,Ja);if(q instanceof THREE.ShadowVolumeDynamicMaterial){k=G.directionalLightDirection.value;k[0]=-B.position.x;k[1]=-B.position.y;k[2]=-B.position.z;d.uniform3fv(F.directionalLightDirection,k);d.uniformMatrix4fv(F.objectMatrix,!1,A._objectMatrixArray);d.uniformMatrix4fv(F.viewMatrix,!1,Ja)}if(q.skinning){d.uniformMatrix4fv(F.cameraInverseMatrix,!1,Ja);d.uniformMatrix4fv(F.boneGlobalMatrices,!1,A.boneMatrices)}return I}function f(k,B,w,q,A,I){if(q.opacity!=0){k=e(k,B,w,q,I).attributes;if(q.morphTargets){B=
- q.program.attributes;I.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,A.__webGLMorphTargetsBuffers[I.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,A.__webGLVertexBuffer);d.vertexAttribPointer(B.position,3,d.FLOAT,!1,0,0);if(I.morphTargetForcedOrder.length){w=0;for(var F=I.morphTargetForcedOrder,G=I.morphTargetInfluences;w<q.numSupportedMorphTargets&&w<F.length;){d.bindBuffer(d.ARRAY_BUFFER,A.__webGLMorphTargetsBuffers[F[w]]);d.vertexAttribPointer(B["morphTarget"+w],3,d.FLOAT,!1,0,0);I.__webGLMorphTargetInfluences[w]=
- G[F[w]];w++}}else{F=[];var D=-1,U=0;G=I.morphTargetInfluences;var E,ha=G.length;w=0;for(I.morphTargetBase!==-1&&(F[I.morphTargetBase]=!0);w<q.numSupportedMorphTargets;){for(E=0;E<ha;E++)if(!F[E]&&G[E]>D){U=E;D=G[U]}d.bindBuffer(d.ARRAY_BUFFER,A.__webGLMorphTargetsBuffers[U]);d.vertexAttribPointer(B["morphTarget"+w],3,d.FLOAT,!1,0,0);I.__webGLMorphTargetInfluences[w]=D;F[U]=1;D=-1;w++}}d.uniform1fv(q.program.uniforms.morphTargetInfluences,I.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,
- A.__webGLVertexBuffer);d.vertexAttribPointer(k.position,3,d.FLOAT,!1,0,0)}if(k.color>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webGLColorBuffer);d.vertexAttribPointer(k.color,3,d.FLOAT,!1,0,0)}if(k.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webGLNormalBuffer);d.vertexAttribPointer(k.normal,3,d.FLOAT,!1,0,0)}if(k.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webGLTangentBuffer);d.vertexAttribPointer(k.tangent,4,d.FLOAT,!1,0,0)}if(k.uv>=0)if(A.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,A.__webGLUVBuffer);
- d.vertexAttribPointer(k.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv)}else d.disableVertexAttribArray(k.uv);if(k.uv2>=0)if(A.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,A.__webGLUV2Buffer);d.vertexAttribPointer(k.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv2)}else d.disableVertexAttribArray(k.uv2);if(q.skinning&&k.skinVertexA>=0&&k.skinVertexB>=0&&k.skinIndex>=0&&k.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);d.vertexAttribPointer(k.skinVertexA,4,d.FLOAT,
- !1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webGLSkinVertexBBuffer);d.vertexAttribPointer(k.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);d.vertexAttribPointer(k.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);d.vertexAttribPointer(k.skinWeight,4,d.FLOAT,!1,0,0)}if(I instanceof THREE.Mesh)if(q.wireframe){d.lineWidth(q.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);d.drawElements(d.LINES,A.__webGLLineCount,
- d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,A.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(I instanceof THREE.Line){I=I.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(q.linewidth);d.drawArrays(I,0,A.__webGLLineCount)}else if(I instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,A.__webGLParticleCount);else I instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,A.__webGLVertexCount)}}function g(k,B){if(!k.__webGLVertexBuffer)k.__webGLVertexBuffer=
- d.createBuffer();if(!k.__webGLNormalBuffer)k.__webGLNormalBuffer=d.createBuffer();if(k.hasPos){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,k.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(B.attributes.position);d.vertexAttribPointer(B.attributes.position,3,d.FLOAT,!1,0,0)}if(k.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,k.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(B.attributes.normal);d.vertexAttribPointer(B.attributes.normal,
- 3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,k.count);k.count=0}function h(k){if(ta!=k.doubleSided){k.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ta=k.doubleSided}if(za!=k.flipSided){k.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);za=k.flipSided}}function j(k){if(ga!=k){k?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ga=k}}function m(k){pa[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);pa[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);pa[2].set(k.n41+k.n21,k.n42+k.n22,
- k.n43+k.n23,k.n44+k.n24);pa[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);pa[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);pa[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);var B;for(k=0;k<6;k++){B=pa[k];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}}function n(k){for(var B=k.matrixWorld,w=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),q=0;q<6;q++){k=pa[q].x*B.n14+pa[q].y*B.n24+pa[q].z*B.n34+pa[q].w;if(k<=w)return!1}return!0}function p(k,
- B){k.list[k.count]=B;k.count+=1}function t(k){var B,w,q=k.object,A=k.opaque,I=k.transparent;I.count=0;k=A.count=0;for(B=q.materials.length;k<B;k++){w=q.materials[k];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?p(I,w):p(A,w)}}function x(k){var B,w,q,A,I=k.object,F=k.buffer,G=k.opaque,D=k.transparent;D.count=0;k=G.count=0;for(q=I.materials.length;k<q;k++){B=I.materials[k];if(B instanceof THREE.MeshFaceMaterial){B=0;for(w=F.materials.length;B<w;B++)(A=F.materials[B])&&(A.opacity&&A.opacity<
- 1||A.blending!=THREE.NormalBlending?p(D,A):p(G,A))}else{A=B;A.opacity&&A.opacity<1||A.blending!=THREE.NormalBlending?p(D,A):p(G,A)}}}function o(k,B){return B.z-k.z}function y(k){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);var B,w=k.lights.length,q,A=k.lights,I=[],F,G,D,U,E,ha=k.__webglShadowVolumes.length;
- for(B=0;B<w;B++){q=k.lights[B];if(q instanceof THREE.DirectionalLight){I[0]=-q.position.x;I[1]=-q.position.y;I[2]=-q.position.z;for(E=0;E<ha;E++){q=k.__webglShadowVolumes[E].object;F=k.__webglShadowVolumes[E].buffer;G=q.materials[0];G.program||Ha.initMaterial(G,A,undefined,q);G=G.program;D=G.uniforms;U=G.attributes;if(Ea!==G){d.useProgram(G);Ea=G;d.uniformMatrix4fv(D.projectionMatrix,!1,Fa);d.uniformMatrix4fv(D.viewMatrix,!1,Ja);d.uniform3fv(D.directionalLightDirection,I)}q.matrixWorld.flattenToArray(q._objectMatrixArray);
- d.uniformMatrix4fv(D.objectMatrix,!1,q._objectMatrixArray);d.bindBuffer(d.ARRAY_BUFFER,F.__webGLVertexBuffer);d.vertexAttribPointer(U.position,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,F.__webGLNormalBuffer);d.vertexAttribPointer(U.normal,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,F.__webGLFaceBuffer);d.cullFace(d.FRONT);d.drawElements(d.TRIANGLES,F.__webGLFaceCount,d.UNSIGNED_SHORT,0);d.cullFace(d.BACK);d.drawElements(d.TRIANGLES,F.__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);va="";Ea=Q.program;d.useProgram(Q.program);d.uniformMatrix4fv(Q.projectionLocation,!1,Fa);d.uniform1f(Q.darknessLocation,Q.darkness);d.bindBuffer(d.ARRAY_BUFFER,Q.vertexBuffer);d.vertexAttribPointer(Q.vertexLocation,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(Q.vertexLocation);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.blendEquation(d.FUNC_ADD);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
- Q.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)}function H(k,B){var w,q,A,I=k.__webglLensFlares.length,F,G,D;F=new THREE.Vector3;var U=Aa/ka;G=ka*0.5;D=Aa*0.5;var E=16/Aa,ha=[E*U,E],$=[1,1,0];E=[1,1];var ua,aa=O.readBackPixels,xa,Da,Ca=O.uniforms;w=O.attributes;d.useProgram(O.program);Ea=O.program;va="";d.uniform1i(Ca.map,0);d.activeTexture(d.TEXTURE0);d.uniform1f(Ca.opacity,1);d.uniform1f(Ca.rotation,
- 0);d.uniform2fv(Ca.scale,ha);d.bindBuffer(d.ARRAY_BUFFER,O.vertexBuffer);d.vertexAttribPointer(w.vertex,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(w.uv,2,d.FLOAT,!1,16,8);d.bindTexture(d.TEXTURE_2D,O.tempTexture);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,O.elementBuffer);d.disable(d.CULL_FACE);d.depthMask(!1);for(A=0;A<I;A++){w=k.__webglLensFlares[A].object;F.set(w.matrixWorld.n14,w.matrixWorld.n24,w.matrixWorld.n34);B.matrixWorldInverse.multiplyVector3(F);q=F.z;B.projectionMatrix.multiplyVector3(F);$[0]=
- F.x;$[1]=F.y;$[2]=F.z;E[0]=$[0]*G+G;E[1]=$[1]*D+D;d.copyTexSubImage2D(d.TEXTURE_2D,0,0,0,E[0]-8,E[1]-8,16,16);d.uniform3fv(Ca.screenPosition,$);d.uniform1i(Ca.renderPink,1);d.enable(d.DEPTH_TEST);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);try{d.readPixels(E[0]-8,E[1]-8,16,16,d.RGBA,d.UNSIGNED_BYTE,O.readBackPixels)}catch(ja){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}d.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(6*
- (1-Math.max(0,Math.min(-q,B.far))/B.far),10)+1;q=sampleDistance*4;ua=sampleDistance*64;Da=0;xa=28-q+(448-ua);O.readBackPixels[xa+0]===255&&O.readBackPixels[xa+1]===0&&O.readBackPixels[xa+2]===255&&(Da+=0.2);xa=28+q+(448-ua);aa[xa+0]===255&&aa[xa+1]===0&&aa[xa+2]===255&&(Da+=0.2);xa=28+q+(448+ua);aa[xa+0]===255&&aa[xa+1]===0&&aa[xa+2]===255&&(Da+=0.2);xa=28-q+(448+ua);aa[xa+0]===255&&aa[xa+1]===0&&aa[xa+2]===255&&(Da+=0.2);xa=476;aa[xa+0]===255&&aa[xa+1]===0&&aa[xa+2]===255&&(Da+=0.2);w.positionScreen.x=
- $[0];w.positionScreen.y=$[1];w.positionScreen.z=$[2];w.customUpdateCallback?w.customUpdateCallback(Da,w):w.updateLensFlares(Da);d.uniform1i(Ca.renderPink,0);d.disable(d.DEPTH_TEST);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}d.enable(d.BLEND);for(A=0;A<I;A++){w=k.__webglLensFlares[A].object;F=0;for(G=w.lensFlares.length;F<G;F++){D=w.lensFlares[F];if(D.opacity>0.0010&&D.scale>0.0010){$[0]=D.x;$[1]=D.y;$[2]=D.z;E=D.size*D.scale/Aa;ha[0]=E*U;ha[1]=E;d.uniform3fv(Ca.screenPosition,$);d.uniform1f(Ca.rotation,
- D.rotation);d.uniform2fv(Ca.scale,ha);d.uniform1f(Ca.opacity,D.opacity);W(D.blending);R(D.texture,0);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}}}d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(!0);d.disable(d.BLEND)}function J(k,B){k._modelViewMatrix.multiplyToArray(B.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(k._modelViewMatrix).transposeIntoArray(k._normalMatrixArray)}function C(k){var B,w,q;if(k instanceof THREE.Mesh){w=k.geometry;for(B in w.geometryGroups){q=
- w.geometryGroups[B];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){var A=d.DYNAMIC_DRAW,I=void 0,F=void 0,G=void 0,D=void 0;G=void 0;var U=void 0,E=void 0,ha=void 0,$=void 0,ua=void 0,aa=void 0,xa=void 0,Da=void 0,Ca=void 0,ja=void 0,oa=void 0,wa=void 0,Ma=void 0;E=void 0;ha=void 0;D=void 0;$=void 0;D=void 0;ja=void 0;oa=void 0;E=void 0;ja=void 0;oa=void 0;wa=void 0;Ma=void 0;ja=void 0;oa=void 0;wa=void 0;Ma=void 0;
- ja=void 0;oa=void 0;wa=void 0;Ma=void 0;ja=void 0;oa=void 0;wa=void 0;D=void 0;$=void 0;U=void 0;G=void 0;G=void 0;var Pa=void 0,cb=void 0,Na=void 0,Ia=0,La=0,eb=0,$a=0,Ta=0,Va=0,Ka=0,Ya=0,ya=0,M=0,Oa=0,Ra=q.__vertexArray,fb=q.__uvArray,Sa=q.__uv2Array,P=q.__normalArray,ca=q.__tangentArray,fa=q.__colorArray,V=q.__skinVertexAArray,sa=q.__skinVertexBArray,ra=q.__skinIndexArray,Z=q.__skinWeightArray,da=q.__morphTargetsArrays,Ga=q.__faceArray,Ua=q.__lineArray,ab=q.__needsSmoothNormals;aa=q.__vertexColorType;
- ua=q.__uvType;xa=q.__normalType;var Qa=k.geometry,hb=Qa.__dirtyVertices,db=Qa.__dirtyElements,Za=Qa.__dirtyUvs,ob=Qa.__dirtyNormals,pb=Qa.__dirtyTangents,qb=Qa.__dirtyColors,rb=Qa.__dirtyMorphTargets,kb=Qa.vertices,sb=q.faces,vb=Qa.faces,tb=Qa.faceVertexUvs[0],ub=Qa.faceVertexUvs[1],lb=Qa.skinVerticesA,mb=Qa.skinVerticesB,nb=Qa.skinIndices,ib=Qa.skinWeights,jb=Qa.edgeFaces,gb=Qa.morphTargets;I=0;for(F=sb.length;I<F;I++){G=sb[I];D=vb[G];tb&&(Da=tb[G]);ub&&(Ca=ub[G]);G=D.vertexNormals;U=D.normal;E=
- D.vertexColors;ha=D.color;$=D.vertexTangents;if(D instanceof THREE.Face3){if(hb){ja=kb[D.a].position;oa=kb[D.b].position;wa=kb[D.c].position;Ra[La]=ja.x;Ra[La+1]=ja.y;Ra[La+2]=ja.z;Ra[La+3]=oa.x;Ra[La+4]=oa.y;Ra[La+5]=oa.z;Ra[La+6]=wa.x;Ra[La+7]=wa.y;Ra[La+8]=wa.z;La+=9}if(rb){Pa=0;for(cb=gb.length;Pa<cb;Pa++){ja=gb[Pa].vertices[D.a].position;oa=gb[Pa].vertices[D.b].position;wa=gb[Pa].vertices[D.c].position;Na=da[Pa];Na[Oa+0]=ja.x;Na[Oa+1]=ja.y;Na[Oa+2]=ja.z;Na[Oa+3]=oa.x;Na[Oa+4]=oa.y;Na[Oa+5]=oa.z;
- Na[Oa+6]=wa.x;Na[Oa+7]=wa.y;Na[Oa+8]=wa.z}Oa+=9}if(ib.length){ja=ib[D.a];oa=ib[D.b];wa=ib[D.c];Z[M]=ja.x;Z[M+1]=ja.y;Z[M+2]=ja.z;Z[M+3]=ja.w;Z[M+4]=oa.x;Z[M+5]=oa.y;Z[M+6]=oa.z;Z[M+7]=oa.w;Z[M+8]=wa.x;Z[M+9]=wa.y;Z[M+10]=wa.z;Z[M+11]=wa.w;ja=nb[D.a];oa=nb[D.b];wa=nb[D.c];ra[M]=ja.x;ra[M+1]=ja.y;ra[M+2]=ja.z;ra[M+3]=ja.w;ra[M+4]=oa.x;ra[M+5]=oa.y;ra[M+6]=oa.z;ra[M+7]=oa.w;ra[M+8]=wa.x;ra[M+9]=wa.y;ra[M+10]=wa.z;ra[M+11]=wa.w;ja=lb[D.a];oa=lb[D.b];wa=lb[D.c];V[M]=ja.x;V[M+1]=ja.y;V[M+2]=ja.z;V[M+3]=
- 1;V[M+4]=oa.x;V[M+5]=oa.y;V[M+6]=oa.z;V[M+7]=1;V[M+8]=wa.x;V[M+9]=wa.y;V[M+10]=wa.z;V[M+11]=1;ja=mb[D.a];oa=mb[D.b];wa=mb[D.c];sa[M]=ja.x;sa[M+1]=ja.y;sa[M+2]=ja.z;sa[M+3]=1;sa[M+4]=oa.x;sa[M+5]=oa.y;sa[M+6]=oa.z;sa[M+7]=1;sa[M+8]=wa.x;sa[M+9]=wa.y;sa[M+10]=wa.z;sa[M+11]=1;M+=12}if(qb&&aa){if(E.length==3&&aa==THREE.VertexColors){D=E[0];ja=E[1];oa=E[2]}else oa=ja=D=ha;fa[ya]=D.r;fa[ya+1]=D.g;fa[ya+2]=D.b;fa[ya+3]=ja.r;fa[ya+4]=ja.g;fa[ya+5]=ja.b;fa[ya+6]=oa.r;fa[ya+7]=oa.g;fa[ya+8]=oa.b;ya+=9}if(pb&&
- Qa.hasTangents){E=$[0];ha=$[1];D=$[2];ca[Ka]=E.x;ca[Ka+1]=E.y;ca[Ka+2]=E.z;ca[Ka+3]=E.w;ca[Ka+4]=ha.x;ca[Ka+5]=ha.y;ca[Ka+6]=ha.z;ca[Ka+7]=ha.w;ca[Ka+8]=D.x;ca[Ka+9]=D.y;ca[Ka+10]=D.z;ca[Ka+11]=D.w;Ka+=12}if(ob&&xa)if(G.length==3&&ab)for($=0;$<3;$++){U=G[$];P[Va]=U.x;P[Va+1]=U.y;P[Va+2]=U.z;Va+=3}else for($=0;$<3;$++){P[Va]=U.x;P[Va+1]=U.y;P[Va+2]=U.z;Va+=3}if(Za&&Da!==undefined&&ua)for($=0;$<3;$++){G=Da[$];fb[eb]=G.u;fb[eb+1]=G.v;eb+=2}if(Za&&Ca!==undefined&&ua)for($=0;$<3;$++){G=Ca[$];Sa[$a]=G.u;
- Sa[$a+1]=G.v;$a+=2}if(db){Ga[Ta]=Ia;Ga[Ta+1]=Ia+1;Ga[Ta+2]=Ia+2;Ta+=3;Ua[Ya]=Ia;Ua[Ya+1]=Ia+1;Ua[Ya+2]=Ia;Ua[Ya+3]=Ia+2;Ua[Ya+4]=Ia+1;Ua[Ya+5]=Ia+2;Ya+=6;Ia+=3}}else if(D instanceof THREE.Face4){if(hb){ja=kb[D.a].position;oa=kb[D.b].position;wa=kb[D.c].position;Ma=kb[D.d].position;Ra[La]=ja.x;Ra[La+1]=ja.y;Ra[La+2]=ja.z;Ra[La+3]=oa.x;Ra[La+4]=oa.y;Ra[La+5]=oa.z;Ra[La+6]=wa.x;Ra[La+7]=wa.y;Ra[La+8]=wa.z;Ra[La+9]=Ma.x;Ra[La+10]=Ma.y;Ra[La+11]=Ma.z;La+=12}if(rb){Pa=0;for(cb=gb.length;Pa<cb;Pa++){ja=
- gb[Pa].vertices[D.a].position;oa=gb[Pa].vertices[D.b].position;wa=gb[Pa].vertices[D.c].position;Ma=gb[Pa].vertices[D.d].position;Na=da[Pa];Na[Oa+0]=ja.x;Na[Oa+1]=ja.y;Na[Oa+2]=ja.z;Na[Oa+3]=oa.x;Na[Oa+4]=oa.y;Na[Oa+5]=oa.z;Na[Oa+6]=wa.x;Na[Oa+7]=wa.y;Na[Oa+8]=wa.z;Na[Oa+9]=Ma.x;Na[Oa+10]=Ma.y;Na[Oa+11]=Ma.z}Oa+=12}if(ib.length){ja=ib[D.a];oa=ib[D.b];wa=ib[D.c];Ma=ib[D.d];Z[M]=ja.x;Z[M+1]=ja.y;Z[M+2]=ja.z;Z[M+3]=ja.w;Z[M+4]=oa.x;Z[M+5]=oa.y;Z[M+6]=oa.z;Z[M+7]=oa.w;Z[M+8]=wa.x;Z[M+9]=wa.y;Z[M+10]=wa.z;
- Z[M+11]=wa.w;Z[M+12]=Ma.x;Z[M+13]=Ma.y;Z[M+14]=Ma.z;Z[M+15]=Ma.w;ja=nb[D.a];oa=nb[D.b];wa=nb[D.c];Ma=nb[D.d];ra[M]=ja.x;ra[M+1]=ja.y;ra[M+2]=ja.z;ra[M+3]=ja.w;ra[M+4]=oa.x;ra[M+5]=oa.y;ra[M+6]=oa.z;ra[M+7]=oa.w;ra[M+8]=wa.x;ra[M+9]=wa.y;ra[M+10]=wa.z;ra[M+11]=wa.w;ra[M+12]=Ma.x;ra[M+13]=Ma.y;ra[M+14]=Ma.z;ra[M+15]=Ma.w;ja=lb[D.a];oa=lb[D.b];wa=lb[D.c];Ma=lb[D.d];V[M]=ja.x;V[M+1]=ja.y;V[M+2]=ja.z;V[M+3]=1;V[M+4]=oa.x;V[M+5]=oa.y;V[M+6]=oa.z;V[M+7]=1;V[M+8]=wa.x;V[M+9]=wa.y;V[M+10]=wa.z;V[M+11]=1;V[M+
- 12]=Ma.x;V[M+13]=Ma.y;V[M+14]=Ma.z;V[M+15]=1;ja=mb[D.a];oa=mb[D.b];wa=mb[D.c];D=mb[D.d];sa[M]=ja.x;sa[M+1]=ja.y;sa[M+2]=ja.z;sa[M+3]=1;sa[M+4]=oa.x;sa[M+5]=oa.y;sa[M+6]=oa.z;sa[M+7]=1;sa[M+8]=wa.x;sa[M+9]=wa.y;sa[M+10]=wa.z;sa[M+11]=1;sa[M+12]=D.x;sa[M+13]=D.y;sa[M+14]=D.z;sa[M+15]=1;M+=16}if(qb&&aa){if(E.length==4&&aa==THREE.VertexColors){D=E[0];ja=E[1];oa=E[2];E=E[3]}else E=oa=ja=D=ha;fa[ya]=D.r;fa[ya+1]=D.g;fa[ya+2]=D.b;fa[ya+3]=ja.r;fa[ya+4]=ja.g;fa[ya+5]=ja.b;fa[ya+6]=oa.r;fa[ya+7]=oa.g;fa[ya+
- 8]=oa.b;fa[ya+9]=E.r;fa[ya+10]=E.g;fa[ya+11]=E.b;ya+=12}if(pb&&Qa.hasTangents){E=$[0];ha=$[1];D=$[2];$=$[3];ca[Ka]=E.x;ca[Ka+1]=E.y;ca[Ka+2]=E.z;ca[Ka+3]=E.w;ca[Ka+4]=ha.x;ca[Ka+5]=ha.y;ca[Ka+6]=ha.z;ca[Ka+7]=ha.w;ca[Ka+8]=D.x;ca[Ka+9]=D.y;ca[Ka+10]=D.z;ca[Ka+11]=D.w;ca[Ka+12]=$.x;ca[Ka+13]=$.y;ca[Ka+14]=$.z;ca[Ka+15]=$.w;Ka+=16}if(ob&&xa)if(G.length==4&&ab)for($=0;$<4;$++){U=G[$];P[Va]=U.x;P[Va+1]=U.y;P[Va+2]=U.z;Va+=3}else for($=0;$<4;$++){P[Va]=U.x;P[Va+1]=U.y;P[Va+2]=U.z;Va+=3}if(Za&&Da!==undefined&&
- ua)for($=0;$<4;$++){G=Da[$];fb[eb]=G.u;fb[eb+1]=G.v;eb+=2}if(Za&&Ca!==undefined&&ua)for($=0;$<4;$++){G=Ca[$];Sa[$a]=G.u;Sa[$a+1]=G.v;$a+=2}if(db){Ga[Ta]=Ia;Ga[Ta+1]=Ia+1;Ga[Ta+2]=Ia+3;Ga[Ta+3]=Ia+1;Ga[Ta+4]=Ia+2;Ga[Ta+5]=Ia+3;Ta+=6;Ua[Ya]=Ia;Ua[Ya+1]=Ia+1;Ua[Ya+2]=Ia;Ua[Ya+3]=Ia+3;Ua[Ya+4]=Ia+1;Ua[Ya+5]=Ia+2;Ua[Ya+6]=Ia+2;Ua[Ya+7]=Ia+3;Ya+=8;Ia+=4}}}if(jb){I=0;for(F=jb.length;I<F;I++){Ga[Ta]=jb[I].a;Ga[Ta+1]=jb[I].b;Ga[Ta+2]=jb[I].c;Ga[Ta+3]=jb[I].a;Ga[Ta+4]=jb[I].c;Ga[Ta+5]=jb[I].d;Ta+=6}}if(hb){d.bindBuffer(d.ARRAY_BUFFER,
- q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ra,A)}if(rb){Pa=0;for(cb=gb.length;Pa<cb;Pa++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[Pa]);d.bufferData(d.ARRAY_BUFFER,da[Pa],A)}}if(qb&&ya>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,fa,A)}if(ob){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,P,A)}if(pb&&Qa.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,A)}if(Za&&
- eb>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,fb,A)}if(Za&&$a>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Sa,A)}if(db){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ga,A);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ua,A)}if(M>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,V,A);d.bindBuffer(d.ARRAY_BUFFER,
- q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,sa,A);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,ra,A);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,Z,A)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(k instanceof THREE.Ribbon){w=k.geometry;if(w.__dirtyVertices||w.__dirtyColors){k=w;B=d.DYNAMIC_DRAW;xa=k.vertices;
- A=k.colors;Da=xa.length;I=A.length;Ca=k.__vertexArray;F=k.__colorArray;Ia=k.__dirtyColors;if(k.__dirtyVertices){for(ua=0;ua<Da;ua++){aa=xa[ua].position;q=ua*3;Ca[q]=aa.x;Ca[q+1]=aa.y;Ca[q+2]=aa.z}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ca,B)}if(Ia){for(ua=0;ua<I;ua++){color=A[ua];q=ua*3;F[q]=color.r;F[q+1]=color.g;F[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,F,B)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(k instanceof
- THREE.Line){w=k.geometry;if(w.__dirtyVertices||w.__dirtyColors){k=w;B=d.DYNAMIC_DRAW;xa=k.vertices;A=k.colors;Da=xa.length;I=A.length;Ca=k.__vertexArray;F=k.__colorArray;Ia=k.__dirtyColors;if(k.__dirtyVertices){for(ua=0;ua<Da;ua++){aa=xa[ua].position;q=ua*3;Ca[q]=aa.x;Ca[q+1]=aa.y;Ca[q+2]=aa.z}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ca,B)}if(Ia){for(ua=0;ua<I;ua++){color=A[ua];q=ua*3;F[q]=color.r;F[q+1]=color.g;F[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);
- d.bufferData(d.ARRAY_BUFFER,F,B)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem){w=k.geometry;(w.__dirtyVertices||w.__dirtyColors||k.sortParticles)&&c(w,d.DYNAMIC_DRAW,k);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function K(k){function B($){var ua=[];w=0;for(q=$.length;w<q;w++)$[w]==undefined?ua.push("undefined"):ua.push($[w].id);return ua.join("_")}var w,q,A,I,F,G,D,U,E={},ha=k.morphTargets!==undefined?k.morphTargets.length:0;k.geometryGroups={};A=0;for(I=k.faces.length;A<
- I;A++){F=k.faces[A];G=F.materials;D=B(G);E[D]==undefined&&(E[D]={hash:D,counter:0});U=E[D].hash+"_"+E[D].counter;k.geometryGroups[U]==undefined&&(k.geometryGroups[U]={faces:[],materials:G,vertices:0,numMorphTargets:ha});F=F instanceof THREE.Face3?3:4;if(k.geometryGroups[U].vertices+F>65535){E[D].counter+=1;U=E[D].hash+"_"+E[D].counter;k.geometryGroups[U]==undefined&&(k.geometryGroups[U]={faces:[],materials:G,vertices:0,numMorphTargets:ha})}k.geometryGroups[U].faces.push(A);k.geometryGroups[U].vertices+=
- F}}function z(k,B,w){k.push({buffer:B,object:w,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function W(k){if(k!=va){switch(k){case THREE.AdditiveAlphaBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);break;
- case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}va=k}}function S(k,B,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){d.texParameteri(k,d.TEXTURE_WRAP_S,na(B.wrapS));d.texParameteri(k,d.TEXTURE_WRAP_T,na(B.wrapT));d.texParameteri(k,d.TEXTURE_MAG_FILTER,na(B.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,na(B.minFilter));d.generateMipmap(k)}else{d.texParameteri(k,
- d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(k,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(k,d.TEXTURE_MAG_FILTER,qa(B.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,qa(B.minFilter))}}function R(k,B){if(k.needsUpdate){if(k.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,k.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,k.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,
- k.image);k.__wasSetOnce=!0}S(d.TEXTURE_2D,k,k.image);d.bindTexture(d.TEXTURE_2D,null);k.needsUpdate=!1}d.activeTexture(d.TEXTURE0+B);d.bindTexture(d.TEXTURE_2D,k.__webGLTexture)}function ia(k){if(k&&!k.__webGLFramebuffer){k.__webGLFramebuffer=d.createFramebuffer();k.__webGLRenderbuffer=d.createRenderbuffer();k.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,k.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,k.width,k.height);d.bindTexture(d.TEXTURE_2D,
- k.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,na(k.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,na(k.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,na(k.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,na(k.minFilter));d.texImage2D(d.TEXTURE_2D,0,na(k.format),k.width,k.height,0,na(k.format),na(k.type),null);d.bindFramebuffer(d.FRAMEBUFFER,k.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,k.__webGLTexture,
- 0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,k.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var B,w;if(k){B=k.__webGLFramebuffer;w=k.width;k=k.height}else{B=null;w=ka;k=Aa}if(B!=la){d.bindFramebuffer(d.FRAMEBUFFER,B);d.viewport(X,N,w,k);la=B}}function ea(k,B){var w;if(k=="fragment")w=d.createShader(d.FRAGMENT_SHADER);else k=="vertex"&&(w=d.createShader(d.VERTEX_SHADER));d.shaderSource(w,
- B);d.compileShader(w);if(!d.getShaderParameter(w,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(w));console.error(B);return null}return w}function qa(k){switch(k){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function na(k){switch(k){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 Y=document.createElement("canvas"),d,Ea=null,la=null,Ha=this,ta=null,za=null,va=null,ga=null,X=0,N=0,ka=0,Aa=0,pa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
- new THREE.Vector4],Ba=new THREE.Matrix4,Fa=new Float32Array(16),Ja=new Float32Array(16),Wa=new THREE.Vector4,bb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Xa=!0,L=!0,T=new THREE.Color(0),ma=0;if(a){if(a.stencil!=undefined)Xa=a.stencil;if(a.antialias!==undefined)L=a.antialias;a.clearColor!==undefined&&T.setHex(a.clearColor);if(a.clearAlpha!==undefined)ma=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Y;this.autoClear=!0;this.sortObjects=
- !0;(function(k,B,w,q){try{if(!(d=Y.getContext("experimental-webgl",{antialias:k,stencil:q})))throw"Error creating WebGL context.";}catch(A){console.error(A)}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.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(B.r,B.g,B.b,w)})(L,T,ma,Xa);this.context=d;if(Xa){var Q={};Q.vertices=new Float32Array(12);Q.faces=new Uint16Array(6);Q.darkness=
- 0.5;Q.vertices[0]=-2;Q.vertices[1]=-1;Q.vertices[2]=-1;Q.vertices[3]=2;Q.vertices[4]=-1;Q.vertices[5]=-1;Q.vertices[6]=2;Q.vertices[7]=1;Q.vertices[8]=-1;Q.vertices[9]=-2;Q.vertices[10]=1;Q.vertices[11]=-1;Q.faces[0]=0;Q.faces[1]=1;Q.faces[2]=2;Q.faces[3]=0;Q.faces[4]=2;Q.faces[5]=3;Q.vertexBuffer=d.createBuffer();Q.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,Q.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,Q.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Q.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,
- Q.faces,d.STATIC_DRAW);Q.program=d.createProgram();d.attachShader(Q.program,ea("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(Q.program,ea("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(Q.program);Q.vertexLocation=d.getAttribLocation(Q.program,"position");Q.projectionLocation=d.getUniformLocation(Q.program,"projectionMatrix");Q.darknessLocation=d.getUniformLocation(Q.program,"darkness")}var O={};O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);O.transparency=
- 0.5;a=0;O.vertices[a++]=-1;O.vertices[a++]=-1;O.vertices[a++]=0;O.vertices[a++]=0;O.vertices[a++]=1;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=0;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=0;O.vertices[a++]=1;a=0;O.faces[a++]=0;O.faces[a++]=1;O.faces[a++]=2;O.faces[a++]=0;O.faces[a++]=2;O.faces[a++]=3;O.vertexBuffer=d.createBuffer();O.elementBuffer=d.createBuffer();O.tempTexture=d.createTexture();O.readBackPixels=
- new Uint8Array(1024);d.bindBuffer(d.ARRAY_BUFFER,O.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,O.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,O.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,O.faces,d.STATIC_DRAW);d.bindTexture(d.TEXTURE_2D,O.tempTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,
- d.NEAREST);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST);O.program=d.createProgram();d.attachShader(O.program,ea("fragment",THREE.ShaderLib.lensFlare.fragmentShader));d.attachShader(O.program,ea("vertex",THREE.ShaderLib.lensFlare.vertexShader));d.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.vertex=d.getAttribLocation(O.program,"position");O.attributes.uv=d.getAttribLocation(O.program,"UV");O.uniforms.map=d.getUniformLocation(O.program,"map");O.uniforms.opacity=
- d.getUniformLocation(O.program,"opacity");O.uniforms.scale=d.getUniformLocation(O.program,"scale");O.uniforms.rotation=d.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition=d.getUniformLocation(O.program,"screenPosition");O.uniforms.renderPink=d.getUniformLocation(O.program,"renderPink");this.setSize=function(k,B){Y.width=k;Y.height=B;this.setViewport(0,0,Y.width,Y.height)};this.setViewport=function(k,B,w,q){X=k;N=B;ka=w;Aa=q;d.viewport(X,N,ka,Aa)};this.setScissor=function(k,B,w,q){d.scissor(k,
- B,w,q)};this.enableScissorTest=function(k){k?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(k){d.depthMask(k)};this.setClearColorHex=function(k,B){var w=new THREE.Color(k);d.clearColor(w.r,w.g,w.b,B)};this.setClearColor=function(k,B){d.clearColor(k.r,k.g,k.b,B)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(k){Q.darkness=k};this.initMaterial=function(k,B,w,q){var A,I,F;if(k instanceof
- THREE.MeshDepthMaterial)b(k,THREE.ShaderLib.depth);else if(k instanceof THREE.ShadowVolumeDynamicMaterial)b(k,THREE.ShaderLib.shadowVolumeDynamic);else if(k instanceof THREE.MeshNormalMaterial)b(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)b(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)b(k,THREE.ShaderLib.lambert);else if(k instanceof THREE.MeshPhongMaterial)b(k,THREE.ShaderLib.phong);else if(k instanceof THREE.LineBasicMaterial)b(k,THREE.ShaderLib.basic);
- else k instanceof THREE.ParticleBasicMaterial&&b(k,THREE.ShaderLib.particle_basic);var G,D,U,E;F=U=E=0;for(G=B.length;F<G;F++){D=B[F];D instanceof THREE.DirectionalLight&&U++;D instanceof THREE.PointLight&&E++}if(E+U<=4)B=U;else{B=Math.ceil(4*U/(E+U));E=4-B}F={directional:B,point:E};G=50;if(q!==undefined&&q instanceof THREE.SkinnedMesh)G=q.bones.length;E=k.fragmentShader;B=k.vertexShader;G={fog:w,map:k.map,envMap:k.envMap,lightMap:k.lightMap,vertexColors:k.vertexColors,sizeAttenuation:k.sizeAttenuation,
- skinning:k.skinning,morphTargets:k.morphTargets,maxDirLights:F.directional,maxPointLights:F.point,maxBones:G};w=d.createProgram();F=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+G.maxDirLights,"#define MAX_POINT_LIGHTS "+G.maxPointLights,G.fog?"#define USE_FOG":"",G.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",G.map?"#define USE_MAP":"",G.envMap?"#define USE_ENVMAP":"",G.lightMap?"#define USE_LIGHTMAP":"",G.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
- G=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+G.maxDirLights,"#define MAX_POINT_LIGHTS "+G.maxPointLights,"#define MAX_BONES "+G.maxBones,G.map?"#define USE_MAP":"",G.envMap?"#define USE_ENVMAP":"",G.lightMap?"#define USE_LIGHTMAP":"",G.vertexColors?"#define USE_COLOR":"",G.skinning?"#define USE_SKINNING":"",G.morphTargets?"#define USE_MORPHTARGETS":"",G.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
- d.attachShader(w,ea("fragment",F+E));d.attachShader(w,ea("vertex",G+B));d.linkProgram(w);d.getProgramParameter(w,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(w,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");w.uniforms={};w.attributes={};k.program=w;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(A in k.uniforms)w.push(A);
- A=k.program;E=0;for(B=w.length;E<B;E++){F=w[E];A.uniforms[F]=d.getUniformLocation(A,F)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(A=0;A<this.maxMorphTargets;A++)w.push("morphTarget"+A);for(I in k.attributes)w.push(I);I=k.program;A=w;w=0;for(E=A.length;w<E;w++){B=A[w];I.attributes[B]=d.getAttribLocation(I,B)}I=k.program.attributes;d.enableVertexAttribArray(I.position);I.color>=0&&d.enableVertexAttribArray(I.color);I.normal>=0&&d.enableVertexAttribArray(I.normal);
- I.tangent>=0&&d.enableVertexAttribArray(I.tangent);if(k.skinning&&I.skinVertexA>=0&&I.skinVertexB>=0&&I.skinIndex>=0&&I.skinWeight>=0){d.enableVertexAttribArray(I.skinVertexA);d.enableVertexAttribArray(I.skinVertexB);d.enableVertexAttribArray(I.skinIndex);d.enableVertexAttribArray(I.skinWeight)}if(k.morphTargets){k.numSupportedMorphTargets=0;if(I.morphTarget0>=0){d.enableVertexAttribArray(I.morphTarget0);k.numSupportedMorphTargets++}if(I.morphTarget1>=0){d.enableVertexAttribArray(I.morphTarget1);
- k.numSupportedMorphTargets++}if(I.morphTarget2>=0){d.enableVertexAttribArray(I.morphTarget2);k.numSupportedMorphTargets++}if(I.morphTarget3>=0){d.enableVertexAttribArray(I.morphTarget3);k.numSupportedMorphTargets++}if(I.morphTarget4>=0){d.enableVertexAttribArray(I.morphTarget4);k.numSupportedMorphTargets++}if(I.morphTarget5>=0){d.enableVertexAttribArray(I.morphTarget5);k.numSupportedMorphTargets++}if(I.morphTarget6>=0){d.enableVertexAttribArray(I.morphTarget6);k.numSupportedMorphTargets++}if(I.morphTarget7>=
- 0){d.enableVertexAttribArray(I.morphTarget7);k.numSupportedMorphTargets++}q.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(A=0;A<this.maxMorphTargets;A++)q.__webGLMorphTargetInfluences[A]=0}};this.render=function(k,B,w,q){var A,I,F,G,D,U,E,ha,$=k.lights,ua=k.fog;B.matrixAutoUpdate&&B.updateMatrix();k.update(undefined,!1,B);B.matrixWorldInverse.flattenToArray(Ja);B.projectionMatrix.flattenToArray(Fa);Ba.multiply(B.projectionMatrix,B.matrixWorldInverse);m(Ba);this.initWebGLObjects(k);
- ia(w);(this.autoClear||q)&&this.clear();D=k.__webglObjects.length;for(q=0;q<D;q++){A=k.__webglObjects[q];E=A.object;if(E.visible)if(!(E instanceof THREE.Mesh)||n(E)){E.matrixWorld.flattenToArray(E._objectMatrixArray);J(E,B);x(A);A.render=!0;if(this.sortObjects){Wa.copy(E.position);Ba.multiplyVector3(Wa);A.z=Wa.z}}else A.render=!1;else A.render=!1}this.sortObjects&&k.__webglObjects.sort(o);U=k.__webglObjectsImmediate.length;for(q=0;q<U;q++){A=k.__webglObjectsImmediate[q];E=A.object;if(E.visible){E.matrixAutoUpdate&&
- E.matrixWorld.flattenToArray(E._objectMatrixArray);J(E,B);t(A)}}W(THREE.NormalBlending);for(q=0;q<D;q++){A=k.__webglObjects[q];if(A.render){E=A.object;ha=A.buffer;F=A.opaque;h(E);for(A=0;A<F.count;A++){G=F.list[A];j(G.depthTest);f(B,$,ua,G,ha,E)}}}for(q=0;q<U;q++){A=k.__webglObjectsImmediate[q];E=A.object;if(E.visible){F=A.opaque;h(E);for(A=0;A<F.count;A++){G=F.list[A];j(G.depthTest);I=e(B,$,ua,G,E);E.render(function(aa){g(aa,I)})}}}for(q=0;q<D;q++){A=k.__webglObjects[q];if(A.render){E=A.object;ha=
- A.buffer;F=A.transparent;h(E);for(A=0;A<F.count;A++){G=F.list[A];W(G.blending);j(G.depthTest);f(B,$,ua,G,ha,E)}}}for(q=0;q<U;q++){A=k.__webglObjectsImmediate[q];E=A.object;if(E.visible){F=A.transparent;h(E);for(A=0;A<F.count;A++){G=F.list[A];W(G.blending);j(G.depthTest);I=e(B,$,ua,G,E);E.render(function(aa){g(aa,I)})}}}Xa&&k.__webglShadowVolumes.length&&k.lights.length&&y(k);k.__webglLensFlares.length&&H(k,B);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(k){if(!k.__webglObjects){k.__webglObjects=[];k.__webglObjectsImmediate=[];k.__webglShadowVolumes=[];k.__webglLensFlares=[]}for(;k.__objectsAdded.length;){var B=k.__objectsAdded[0],w=k,q=void 0,A=void 0,I=void 0;if(B._modelViewMatrix==undefined){B._modelViewMatrix=new THREE.Matrix4;B._normalMatrixArray=new Float32Array(9);B._modelViewMatrixArray=new Float32Array(16);B._objectMatrixArray=
- new Float32Array(16);B.matrixWorld.flattenToArray(B._objectMatrixArray)}if(B instanceof THREE.Mesh){A=B.geometry;A.geometryGroups==undefined&&K(A);for(q in A.geometryGroups){I=A.geometryGroups[q];if(!I.__webGLVertexBuffer){var F=I;F.__webGLVertexBuffer=d.createBuffer();F.__webGLNormalBuffer=d.createBuffer();F.__webGLTangentBuffer=d.createBuffer();F.__webGLColorBuffer=d.createBuffer();F.__webGLUVBuffer=d.createBuffer();F.__webGLUV2Buffer=d.createBuffer();F.__webGLSkinVertexABuffer=d.createBuffer();
- F.__webGLSkinVertexBBuffer=d.createBuffer();F.__webGLSkinIndicesBuffer=d.createBuffer();F.__webGLSkinWeightsBuffer=d.createBuffer();F.__webGLFaceBuffer=d.createBuffer();F.__webGLLineBuffer=d.createBuffer();if(F.numMorphTargets){var G=void 0,D=void 0;F.__webGLMorphTargetsBuffers=[];G=0;for(D=F.numMorphTargets;G<D;G++)F.__webGLMorphTargetsBuffers.push(d.createBuffer())}F=I;G=B;var U=void 0,E=void 0,ha=void 0;ha=void 0;var $=D=0,ua=0;U=void 0;E=void 0;var aa=void 0;E=void 0;var xa=G.geometry;aa=xa.faces;
- var Da=F.faces;U=0;for(E=Da.length;U<E;U++){ha=Da[U];ha=aa[ha];if(ha instanceof THREE.Face3){D+=3;$+=1;ua+=3}else if(ha instanceof THREE.Face4){D+=4;$+=2;ua+=4}}U=F;E=G;aa=void 0;Da=void 0;var Ca=void 0,ja=void 0;Ca=void 0;ha=[];aa=0;for(Da=E.materials.length;aa<Da;aa++){Ca=E.materials[aa];if(Ca instanceof THREE.MeshFaceMaterial){Ca=0;for(l=U.materials.length;Ca<l;Ca++)(ja=U.materials[Ca])&&ha.push(ja)}else(ja=Ca)&&ha.push(ja)}E=ha;a:{U=void 0;aa=void 0;Da=E.length;for(U=0;U<Da;U++){aa=E[U];if(aa.map||
- aa.lightMap||aa instanceof THREE.MeshShaderMaterial){U=!0;break a}}U=!1}a:{aa=E;Da=void 0;ha=void 0;Ca=aa.length;for(Da=0;Da<Ca;Da++){ha=aa[Da];if(!(ha instanceof THREE.MeshBasicMaterial&&!ha.envMap||ha instanceof THREE.MeshDepthMaterial)){aa=ha&&ha.shading!=undefined&&ha.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}aa=!1}a:{Da=void 0;ha=void 0;Ca=E.length;for(Da=0;Da<Ca;Da++){ha=E[Da];if(ha.vertexColors){E=ha.vertexColors;break a}}E=!1}F.__vertexArray=new Float32Array(D*
- 3);if(aa)F.__normalArray=new Float32Array(D*3);if(xa.hasTangents)F.__tangentArray=new Float32Array(D*4);if(E)F.__colorArray=new Float32Array(D*3);if(U){if(xa.faceUvs.length>0||xa.faceVertexUvs.length>0)F.__uvArray=new Float32Array(D*2);if(xa.faceUvs.length>1||xa.faceVertexUvs.length>1)F.__uv2Array=new Float32Array(D*2)}if(G.geometry.skinWeights.length&&G.geometry.skinIndices.length){F.__skinVertexAArray=new Float32Array(D*4);F.__skinVertexBArray=new Float32Array(D*4);F.__skinIndexArray=new Float32Array(D*
- 4);F.__skinWeightArray=new Float32Array(D*4)}F.__faceArray=new Uint16Array($*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*6:0));F.__lineArray=new Uint16Array(ua*2);if(F.numMorphTargets){xa=void 0;Da=void 0;F.__morphTargetsArrays=[];xa=0;for(Da=F.numMorphTargets;xa<Da;xa++)F.__morphTargetsArrays.push(new Float32Array(D*3))}F.__needsSmoothNormals=aa==THREE.SmoothShading;F.__uvType=U;F.__vertexColorType=E;F.__normalType=aa;F.__webGLFaceCount=$*3+(G.geometry.edgeFaces?G.geometry.edgeFaces.length*
- 6:0);F.__webGLLineCount=ua*2;A.__dirtyVertices=!0;A.__dirtyMorphTargets=!0;A.__dirtyElements=!0;A.__dirtyUvs=!0;A.__dirtyNormals=!0;A.__dirtyTangents=!0;A.__dirtyColors=!0}B instanceof THREE.ShadowVolume?z(w.__webglShadowVolumes,I,B):z(w.__webglObjects,I,B)}}else if(B instanceof THREE.LensFlare)z(w.__webglLensFlares,undefined,B);else if(B instanceof THREE.Ribbon){A=B.geometry;if(!A.__webGLVertexBuffer){q=A;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=A;I=q.vertices.length;
- q.__vertexArray=new Float32Array(I*3);q.__colorArray=new Float32Array(I*3);q.__webGLVertexCount=I;A.__dirtyVertices=!0;A.__dirtyColors=!0}z(w.__webglObjects,A,B)}else if(B instanceof THREE.Line){A=B.geometry;if(!A.__webGLVertexBuffer){q=A;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=A;I=q.vertices.length;q.__vertexArray=new Float32Array(I*3);q.__colorArray=new Float32Array(I*3);q.__webGLLineCount=I;A.__dirtyVertices=!0;A.__dirtyColors=!0}z(w.__webglObjects,A,B)}else if(B instanceof
- THREE.ParticleSystem){A=B.geometry;if(!A.__webGLVertexBuffer){q=A;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=A;I=q.vertices.length;q.__vertexArray=new Float32Array(I*3);q.__colorArray=new Float32Array(I*3);q.__sortArray=[];q.__webGLParticleCount=I;A.__dirtyVertices=!0;A.__dirtyColors=!0}z(w.__webglObjects,A,B)}else THREE.MarchingCubes!==undefined&&B instanceof THREE.MarchingCubes&&w.__webglObjectsImmediate.push({object:B,opaque:{list:[],count:0},transparent:{list:[],
- count:0}});k.__objectsAdded.splice(0,1)}for(;k.__objectsRemoved.length;){B=k.__objectsRemoved[0];w=k;A=void 0;q=void 0;for(A=w.__webglObjects.length-1;A>=0;A--){q=w.__webglObjects[A].object;B==q&&w.__webglObjects.splice(A,1)}k.__objectsRemoved.splice(0,1)}B=0;for(w=k.__webglObjects.length;B<w;B++)C(k.__webglObjects[B].object,k);B=0;for(w=k.__webglShadowVolumes.length;B<w;B++)C(k.__webglShadowVolumes[B].object,k);B=0;for(w=k.__webglLensFlares.length;B<w;B++)C(k.__webglLensFlares[B].object,k)};this.setFaceCulling=
- function(k,B){if(k){!B||B=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(k=="back")d.cullFace(d.BACK);else k=="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,h=f.vertices,j=a.faces,m=f.faces,n=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,t=h.length;p<t;p++){var x=new THREE.Vertex(h[p].position.clone());b&&c.matrix.multiplyVector3(x.position);g.push(x)}p=0;for(t=m.length;p<t;p++){h=m[p];var o,y,H=h.vertexNormals;x=h.vertexColors;if(h instanceof THREE.Face3)o=new THREE.Face3(h.a+e,h.b+e,h.c+
- e);else h instanceof THREE.Face4&&(o=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));o.normal.copy(h.normal);b=0;for(g=H.length;b<g;b++){y=H[b];o.vertexNormals.push(y.clone())}o.color.copy(h.color);b=0;for(g=x.length;b<g;b++){y=x[b];o.vertexColors.push(y.clone())}o.materials=h.materials.slice();o.centroid.copy(h.centroid);j.push(o)}p=0;for(t=f.length;p<t;p++){e=f[p];j=[];b=0;for(g=e.length;b<g;b++)j.push(new THREE.UV(e[b].u,e[b].v));n.push(j)}}},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){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(p in ia.objects)if(!la.objects[p]){H=ia.objects[p];if(z=la.geometries[H.geometry]){R=
- [];for(i=0;i<H.materials.length;i++)R[i]=la.materials[H.materials[i]];J=H.position;r=H.rotation;s=H.scale;object=new THREE.Mesh(z,R);object.position.set(J[0],J[1],J[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;la.scene.addObject(object);la.objects[p]=object}}}function h(Ha){return function(ta){la.geometries[Ha]=ta;g();na-=1;j()}}function j(){e({total_models:d,total_textures:Ea,loaded_models:d-na,loaded_textures:Ea-Y},la);na==0&&Y==0&&b(la)}var m,
- n,p,t,x,o,y,H,J,C,K,z,W,S,R,ia,ea,qa,na,Y,d,Ea,la;ia=f.data;ea=new THREE.BinaryLoader;qa=new THREE.JSONLoader;Y=na=0;la={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};f=function(){Y-=1;j()};for(x in ia.cameras){C=ia.cameras[x];if(C.type=="perspective")W=new THREE.Camera(C.fov,C.aspect,C.near,C.far);else if(C.type=="ortho"){W=new THREE.Camera;W.projectionMatrix=THREE.Matrix4.makeOrtho(C.left,C.right,C.top,C.bottom,C.near,C.far)}J=C.position;C=
- C.target;W.position.set(J[0],J[1],J[2]);W.target.position.set(C[0],C[1],C[2]);la.cameras[x]=W}for(t in ia.lights){x=ia.lights[t];if(x.type=="directional"){J=x.direction;light=new THREE.DirectionalLight;light.position.set(J[0],J[1],J[2]);light.position.normalize()}else if(x.type=="point"){J=x.position;light=new THREE.PointLight;light.position.set(J[0],J[1],J[2])}C=x.color;i=x.intensity||1;light.color.setRGB(C[0]*i,C[1]*i,C[2]*i);la.scene.addLight(light);la.lights[t]=light}for(o in ia.fogs){t=ia.fogs[o];
- if(t.type=="linear")S=new THREE.Fog(0,t.near,t.far);else t.type=="exp2"&&(S=new THREE.FogExp2(0,t.density));C=t.color;S.color.setRGB(C[0],C[1],C[2]);la.fogs[o]=S}if(la.cameras&&ia.defaults.camera)la.currentCamera=la.cameras[ia.defaults.camera];if(la.fogs&&ia.defaults.fog)la.scene.fog=la.fogs[ia.defaults.fog];C=ia.defaults.bgcolor;la.bgColor=new THREE.Color;la.bgColor.setRGB(C[0],C[1],C[2]);la.bgColorAlpha=ia.defaults.bgalpha;for(m in ia.geometries){o=ia.geometries[m];if(o.type=="bin_mesh"||o.type==
- "ascii_mesh")na+=1}d=na;for(m in ia.geometries){o=ia.geometries[m];if(o.type=="cube"){z=new Cube(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);la.geometries[m]=z}else if(o.type=="plane"){z=new Plane(o.width,o.height,o.segmentsWidth,o.segmentsHeight);la.geometries[m]=z}else if(o.type=="sphere"){z=new Sphere(o.radius,o.segmentsWidth,o.segmentsHeight);la.geometries[m]=z}else if(o.type=="cylinder"){z=new Cylinder(o.numSegs,o.topRad,o.botRad,o.height,
- o.topOffset,o.botOffset);la.geometries[m]=z}else if(o.type=="torus"){z=new Torus(o.radius,o.tube,o.segmentsR,o.segmentsT);la.geometries[m]=z}else if(o.type=="icosahedron"){z=new Icosahedron(o.subdivisions);la.geometries[m]=z}else if(o.type=="bin_mesh")ea.load({model:o.url,callback:h(m)});else o.type=="ascii_mesh"&&qa.load({model:o.url,callback:h(m)})}for(y in ia.textures){m=ia.textures[y];Y+=m.url instanceof Array?m.url.length:1}Ea=Y;for(y in ia.textures){m=ia.textures[y];if(m.mapping!=undefined&&
- THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array)o=ImageUtils.loadTextureCube(m.url,m.mapping,f);else{o=ImageUtils.loadTexture(m.url,m.mapping,f);if(THREE[m.minFilter]!=undefined)o.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)o.magFilter=THREE[m.magFilter]}la.textures[y]=o}for(n in ia.materials){y=ia.materials[n];for(K in y.parameters)if(K=="envMap"||K=="map"||K=="lightMap")y.parameters[K]=la.textures[y.parameters[K]];else if(K=="shading")y.parameters[K]=
- y.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")y.parameters[K]=THREE[y.parameters[K]]?THREE[y.parameters[K]]:THREE.NormalBlending;else K=="combine"&&(y.parameters[K]=y.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);y=new THREE[y.type](y.parameters);la.materials[n]=y}g();c(la)}},addMesh:function(a,c,b,e,f,g,h,j,m,n){c=new THREE.Mesh(c,n);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=h;c.rotation.y=
- j;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.0050;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(n,p,t,x){var o={name:t,fps:0.6,length:x,hierarchy:[]},y,H=p.getControlPointsArray(),J=p.getLength(),C=H.length,K=0;y=C-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:H[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[y]={time:x,pos:H[y],rot:[0,0,0,1],scl:[1,1,1]};for(y=1;y<C-1;y++){K=x*J.chunks[y]/J.total;p.keys[y]={time:K,pos:H[y]}}o.hierarchy[0]=p;THREE.AnimationHandler.add(o);return new THREE.Animation(n,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,p){var t,
- x,o=new THREE.Geometry;for(t=0;t<n.points.length*p;t++){x=t/(n.points.length*p);x=n.getPoint(x);o.vertices[t]=new THREE.Vertex(new THREE.Vector3(x.x,x.y,x.z))}return o}function e(n,p){var t=b(p,10),x=b(p,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,o);particleObj=new THREE.ParticleSystem(x,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);x=new Sphere(1,
- 16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){t=new THREE.Mesh(x,o);t.position.copy(p.points[i]);t.updateMatrix();n.addChild(t)}}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.0050;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(n,p,t){var x,o;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;x=this.phi%f;this.phi=x>=0?x:x+f;x=this.verticalAngleMap.srcRange;o=this.verticalAngleMap.dstRange;
- this.phi=(this.phi-x[0])*(o[1]-o[0])/(x[1]-x[0])+o[0];x=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-x[0])*(o[1]-o[0])/(x[1]-x[0])+o[0];x=this.target.position;x.x=100*Math.sin(this.phi)*Math.cos(this.theta);x.y=100*Math.cos(this.phi);x.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,p,t)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
- this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(m,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
- 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(n,p){return function(){p.apply(n,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
- var Cube=function(a,c,b,e,f,g,h,j,m){function n(J,C,K,z,W,S,R,ia){var ea,qa,na=e||1,Y=f||1,d=W/2,Ea=S/2,la=p.vertices.length;if(J=="x"&&C=="y"||J=="y"&&C=="x")ea="z";else if(J=="x"&&C=="z"||J=="z"&&C=="x"){ea="y";Y=g||1}else if(J=="z"&&C=="y"||J=="y"&&C=="z"){ea="x";na=g||1}var Ha=na+1,ta=Y+1;W/=na;var za=S/Y;for(qa=0;qa<ta;qa++)for(S=0;S<Ha;S++){var va=new THREE.Vector3;va[J]=(S*W-d)*K;va[C]=(qa*za-Ea)*z;va[ea]=R;p.vertices.push(new THREE.Vertex(va))}for(qa=0;qa<Y;qa++)for(S=0;S<na;S++){p.faces.push(new THREE.Face4(S+
- Ha*qa+la,S+Ha*(qa+1)+la,S+1+Ha*(qa+1)+la,S+1+Ha*qa+la,null,null,ia));p.faceVertexUvs[0].push([new THREE.UV(S/na,qa/Y),new THREE.UV(S/na,(qa+1)/Y),new THREE.UV((S+1)/na,(qa+1)/Y),new THREE.UV((S+1)/na,qa/Y)])}}THREE.Geometry.call(this);var p=this,t=a/2,x=c/2,o=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var H in m)this.sides[H]!=
- undefined&&(this.sides[H]=m[H]);this.sides.px&&n("z","y",1*j,-1,b,c,-t,this.materials[0]);this.sides.nx&&n("z","y",-1*j,-1,b,c,t,this.materials[1]);this.sides.py&&n("x","z",1*j,1,a,b,x,this.materials[2]);this.sides.ny&&n("x","z",1*j,-1,a,b,-x,this.materials[3]);this.sides.pz&&n("x","y",1*j,-1,a,c,o,this.materials[4]);this.sides.nz&&n("x","y",-1*j,-1,a,c,-o,this.materials[5]);(function(){for(var J=[],C=[],K=0,z=p.vertices.length;K<z;K++){for(var W=p.vertices[K],S=!1,R=0,ia=J.length;R<ia;R++){var ea=
- J[R];if(W.position.x==ea.position.x&&W.position.y==ea.position.y&&W.position.z==ea.position.z){C[K]=R;S=!0;break}}if(!S){C[K]=J.length;J.push(new THREE.Vertex(W.position.clone()))}}K=0;for(z=p.faces.length;K<z;K++){W=p.faces[K];W.a=C[W.a];W.b=C[W.b];W.c=C[W.c];W.d=C[W.d]}p.vertices=J})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,c,b,e,f,g){function h(p,t,x){j.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,x)))}THREE.Geometry.call(this);var j=this,m=Math.PI,n=e/2;for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-n);for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,n);for(e=0;e<a;e++)j.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){h(0,0,-n-(g||0));for(e=a;e<a+a/2;e++)j.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){h(0,0,n+(f||0));
- for(e=a+a/2;e<2*a;e++)j.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(t,x,o){var y=Math.sqrt(t*t+x*x+o*o);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(t/y,x/y,o/y)))-1}function b(t,x,o,y){y.faces.push(new THREE.Face3(t,x,o))}function e(t,x){var o=f.vertices[t].position,y=f.vertices[x].position;return c((o.x+y.x)/2,(o.y+y.y)/2,(o.z+y.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
- 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var m=e(g.faces[j].a,g.faces[j].b),n=e(g.faces[j].b,g.faces[j].c),p=e(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,m,p,h);b(g.faces[j].b,n,m,h);b(g.faces[j].c,
- p,n,h);b(m,n,p,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
- 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=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=a[j].clone();f[j]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.0010;n+=c){for(j=0;j<e.length;j++)if(n<this.angle){e[j]=m.multiplyVector3(e[j].clone());this.vertices.push(new THREE.Vertex(e[j]));g[j]=this.vertices.length-1}else g=h;n==0&&(h=f);for(j=
- 0;j<f.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[j]));this.faceVertexUvs[0].push([new THREE.UV(n/b,j/a.length),new THREE.UV(n/b,(j+1)/a.length),new THREE.UV((n-c)/b,(j+1)/a.length),new THREE.UV((n-c)/b,j/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,h=c/2;b=b||1;e=e||1;var j=b+1,m=e+1;a/=b;var n=c/e;for(f=0;f<m;f++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));for(f=0;f<e;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*f,c+j*(f+1),c+1+j*(f+1),c+1+j*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),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){e=b/h;var j=a*Math.cos(e*f),m=a*Math.sin(e*f),n=[],p=0;for(e=0;e<g;e++){var t=2*e/g,x=m*Math.sin(t*f);t=m*Math.cos(t*f);(b==0||b==h)&&e>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,j,x)))-1);n.push(p)}c.push(n)}var o,y,H;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){n=e==g-1;h=c[b][n?0:e+1];j=c[b][n?g-1:e];m=c[b-1][n?g-1:e];n=c[b-1][n?
- 0:e+1];x=b/(f-1);o=(b-1)/(f-1);y=(e+1)/g;t=e/g;p=new THREE.UV(1-y,x);x=new THREE.UV(1-t,x);t=new THREE.UV(1-t,o);var J=new THREE.UV(1-y,o);if(b<c.length-1){o=this.vertices[h].position.clone();y=this.vertices[j].position.clone();H=this.vertices[m].position.clone();o.normalize();y.normalize();H.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([p,x,t])}if(b>1){o=this.vertices[h].position.clone();
- y=this.vertices[m].position.clone();H=this.vertices[n].position.clone();o.normalize();y.normalize();H.normalize();this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([p,t,J])}}}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,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,h));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[h][0],a[h][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,h){function j(t,x,o,y,H,J){x=o/y*t;o=Math.cos(x);return new THREE.Vector3(H*(2+o)*0.5*Math.cos(t),H*(2+o)*Math.sin(t)*0.5,J*H*Math.sin(x)*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=h||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;h=c/this.segmentsT*2*Math.PI;f=j(m,h,this.q,this.p,this.radius,this.heightScale);m=j(m+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;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(h);h=this.tube*Math.sin(h);f.x+=m*e.x+h*g.x;f.y+=m*e.y+h*g.y;f.z+=m*e.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
- 0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];e=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,e));this.faceVertexUvs[0].push([h,m,n]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([p,
- n,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
- THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";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(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function e(j,m){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),t=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
- j.image.width=p;j.image.height=t;j.image.getContext("2d").drawImage(this,0,0,p,t)}else j.image=this;j.needsUpdate=!0};n.src=m}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;e(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=
- (a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;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=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(f){THREE.JSONLoader.prototype.createModel(f.data,b,e)};c.postMessage(a)},createModel:function(a,c,b){var e=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
- else{var h,j,m,n,p,t,x,o,y,H,J=a.faces;o=a.vertices;var C=a.normals,K=a.colors,z=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&z++;for(h=0;h<z;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}m=0;for(n=o.length;m<n;){y=new THREE.Vertex;y.position.x=o[m++];y.position.y=o[m++];y.position.z=o[m++];g.vertices.push(y)}m=0;for(n=J.length;m<n;){p=J[m++];t=p&1;h=p&2;x=p&4;j=p&8;o=p&16;y=p&32;H=p&64;p&=128;if(t){t=new THREE.Face4;t.a=J[m++];t.b=J[m++];t.c=J[m++];t.d=J[m++];nVertices=4}else{t=new THREE.Face3;t.a=
- J[m++];t.b=J[m++];t.c=J[m++];nVertices=3}if(h){materialIndex=J[m++];t.materials=g.materials[materialIndex]}if(x)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvIndex=J[m++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(j)for(h=0;h<z;h++){uvLayer=a.uvs[h];uvs=[];for(j=0;j<nVertices;j++){uvIndex=J[m++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[j]=new THREE.UV(u,v)}j=g.faces.length;g.faceVertexUvs[h][j]=uvs}if(o){normalIndex=J[m++]*3;normal=new THREE.Vector3;normal.x=
- C[normalIndex++];normal.y=C[normalIndex++];normal.z=C[normalIndex];t.normal=normal}if(y)for(h=0;h<nVertices;h++){normalIndex=J[m++]*3;normal=new THREE.Vector3;normal.x=C[normalIndex++];normal.y=C[normalIndex++];normal.z=C[normalIndex];t.vertexNormals.push(normal)}if(H){color=new THREE.Color(J[m++]);t.color=color}if(p)for(h=0;h<nVertices;h++){colorIndex=J[m++];color=new THREE.Color(K[colorIndex]);t.vertexColors.push(color)}g.faces.push(t)}}})();(function(){var h,j,m,n;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<
- j;h+=2){m=a.skinWeights[h];n=a.skinWeights[h+1];g.skinWeights.push(new THREE.Vector4(m,n,0,0))}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){m=a.skinIndices[h];n=a.skinIndices[h+1];g.skinIndices.push(new THREE.Vector4(m,n,0,0))}}g.bones=a.bones;g.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var h,j,m,n;h=0;for(j=a.morphTargets.length;h<j;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=[];dstVertices=g.morphTargets[h].vertices;
- srcVertices=a.morphTargets[h].vertices;m=0;for(n=srcVertices.length;m<n;m+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[m],srcVertices[m+1],srcVertices[m+2])))}}})();this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))}};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(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,f,e,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
- c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,g){var h=new XMLHttpRequest,j=e+"/"+a,m=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){m==0&&(m=h.getResponseHeader("Content-Length"));g({total:m,loaded:h.responseText.length})}}else h.readyState==2&&(m=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
- h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,e){var f=function(g){function h(L,T){var ma=p(L,T),Q=p(L,T+1),O=p(L,T+2),k=p(L,T+3),B=(k<<1&255|O>>7)-127;ma|=(O&127)<<16|Q<<8;if(ma==0&&B==-127)return 0;return(1-2*(k>>7))*(1+ma*Math.pow(2,-23))*Math.pow(2,B)}function j(L,T){var ma=p(L,T),Q=p(L,T+1),O=p(L,T+2);return(p(L,T+3)<<24)+(O<<16)+(Q<<8)+ma}function m(L,T){var ma=p(L,T);return(p(L,T+1)<<8)+ma}function n(L,T){var ma=p(L,T);return ma>127?ma-256:ma}function p(L,
- T){return L.charCodeAt(T)&255}function t(L){var T,ma,Q;T=j(a,L);ma=j(a,L+R);Q=j(a,L+ia);L=m(a,L+ea);THREE.BinaryLoader.prototype.f3(C,T,ma,Q,L)}function x(L){var T,ma,Q,O,k,B;T=j(a,L);ma=j(a,L+R);Q=j(a,L+ia);O=m(a,L+ea);k=j(a,L+qa);B=j(a,L+na);L=j(a,L+Y);THREE.BinaryLoader.prototype.f3n(C,W,T,ma,Q,O,k,B,L)}function o(L){var T,ma,Q,O;T=j(a,L);ma=j(a,L+d);Q=j(a,L+Ea);O=j(a,L+la);L=m(a,L+Ha);THREE.BinaryLoader.prototype.f4(C,T,ma,Q,O,L)}function y(L){var T,ma,Q,O,k,B,w,q;T=j(a,L);ma=j(a,L+d);Q=j(a,L+
- Ea);O=j(a,L+la);k=m(a,L+Ha);B=j(a,L+ta);w=j(a,L+za);q=j(a,L+va);L=j(a,L+ga);THREE.BinaryLoader.prototype.f4n(C,W,T,ma,Q,O,k,B,w,q,L)}function H(L){var T,ma;T=j(a,L);ma=j(a,L+X);L=j(a,L+N);THREE.BinaryLoader.prototype.uv3(C.faceVertexUvs[0],S[T*2],S[T*2+1],S[ma*2],S[ma*2+1],S[L*2],S[L*2+1])}function J(L){var T,ma,Q;T=j(a,L);ma=j(a,L+ka);Q=j(a,L+Aa);L=j(a,L+pa);THREE.BinaryLoader.prototype.uv4(C.faceVertexUvs[0],S[T*2],S[T*2+1],S[ma*2],S[ma*2+1],S[Q*2],S[Q*2+1],S[L*2],S[L*2+1])}var C=this,K=0,z,W=[],
- S=[],R,ia,ea,qa,na,Y,d,Ea,la,Ha,ta,za,va,ga,X,N,ka,Aa,pa,Ba,Fa,Ja,Wa,bb,Xa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,e,g);z={signature:a.substr(K,8),header_bytes:p(a,K+8),vertex_coordinate_bytes:p(a,K+9),normal_coordinate_bytes:p(a,K+10),uv_coordinate_bytes:p(a,K+11),vertex_index_bytes:p(a,K+12),normal_index_bytes:p(a,K+13),uv_index_bytes:p(a,K+14),material_index_bytes:p(a,K+15),nvertices:j(a,K+16),nnormals:j(a,K+16+4),nuvs:j(a,K+16+8),ntri_flat:j(a,K+16+12),ntri_smooth:j(a,
- K+16+16),ntri_flat_uv:j(a,K+16+20),ntri_smooth_uv:j(a,K+16+24),nquad_flat:j(a,K+16+28),nquad_smooth:j(a,K+16+32),nquad_flat_uv:j(a,K+16+36),nquad_smooth_uv:j(a,K+16+40)};K+=z.header_bytes;R=z.vertex_index_bytes;ia=z.vertex_index_bytes*2;ea=z.vertex_index_bytes*3;qa=z.vertex_index_bytes*3+z.material_index_bytes;na=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;Y=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;d=z.vertex_index_bytes;Ea=z.vertex_index_bytes*2;
- la=z.vertex_index_bytes*3;Ha=z.vertex_index_bytes*4;ta=z.vertex_index_bytes*4+z.material_index_bytes;za=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;va=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;ga=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;X=z.uv_index_bytes;N=z.uv_index_bytes*2;ka=z.uv_index_bytes;Aa=z.uv_index_bytes*2;pa=z.uv_index_bytes*3;g=z.vertex_index_bytes*3+z.material_index_bytes;Xa=z.vertex_index_bytes*4+z.material_index_bytes;
- Ba=z.ntri_flat*g;Fa=z.ntri_smooth*(g+z.normal_index_bytes*3);Ja=z.ntri_flat_uv*(g+z.uv_index_bytes*3);Wa=z.ntri_smooth_uv*(g+z.normal_index_bytes*3+z.uv_index_bytes*3);bb=z.nquad_flat*Xa;g=z.nquad_smooth*(Xa+z.normal_index_bytes*4);Xa=z.nquad_flat_uv*(Xa+z.uv_index_bytes*4);K+=function(L){for(var T,ma,Q,O=z.vertex_coordinate_bytes*3,k=L+z.nvertices*O;L<k;L+=O){T=h(a,L);ma=h(a,L+z.vertex_coordinate_bytes);Q=h(a,L+z.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(C,T,ma,Q)}return z.nvertices*
- O}(K);K+=function(L){for(var T,ma,Q,O=z.normal_coordinate_bytes*3,k=L+z.nnormals*O;L<k;L+=O){T=n(a,L);ma=n(a,L+z.normal_coordinate_bytes);Q=n(a,L+z.normal_coordinate_bytes*2);W.push(T/127,ma/127,Q/127)}return z.nnormals*O}(K);K+=function(L){for(var T,ma,Q=z.uv_coordinate_bytes*2,O=L+z.nuvs*Q;L<O;L+=Q){T=h(a,L);ma=h(a,L+z.uv_coordinate_bytes);S.push(T,ma)}return z.nuvs*Q}(K);Ba=K+Ba;Fa=Ba+Fa;Ja=Fa+Ja;Wa=Ja+Wa;bb=Wa+bb;g=bb+g;Xa=g+Xa;(function(L){var T,ma=z.vertex_index_bytes*3+z.material_index_bytes,
- Q=ma+z.uv_index_bytes*3,O=L+z.ntri_flat_uv*Q;for(T=L;T<O;T+=Q){t(T);H(T+ma)}return O-L})(Fa);(function(L){var T,ma=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Q=ma+z.uv_index_bytes*3,O=L+z.ntri_smooth_uv*Q;for(T=L;T<O;T+=Q){x(T);H(T+ma)}return O-L})(Ja);(function(L){var T,ma=z.vertex_index_bytes*4+z.material_index_bytes,Q=ma+z.uv_index_bytes*4,O=L+z.nquad_flat_uv*Q;for(T=L;T<O;T+=Q){o(T);J(T+ma)}return O-L})(g);(function(L){var T,ma=z.vertex_index_bytes*4+z.material_index_bytes+
- z.normal_index_bytes*4,Q=ma+z.uv_index_bytes*4,O=L+z.nquad_smooth_uv*Q;for(T=L;T<O;T+=Q){y(T);J(T+ma)}return O-L})(Xa);(function(L){var T,ma=z.vertex_index_bytes*3+z.material_index_bytes,Q=L+z.ntri_flat*ma;for(T=L;T<Q;T+=ma)t(T);return Q-L})(K);(function(L){var T,ma=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,Q=L+z.ntri_smooth*ma;for(T=L;T<Q;T+=ma)x(T);return Q-L})(Ba);(function(L){var T,ma=z.vertex_index_bytes*4+z.material_index_bytes,Q=L+z.nquad_flat*ma;for(T=L;T<Q;T+=ma)o(T);
- return Q-L})(Wa);(function(L){var T,ma=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,Q=L+z.nquad_smooth*ma;for(T=L;T<Q;T+=ma)y(T);return Q-L})(bb);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,h,j,m){g=a.materials[g];var n=c[j*3],p=c[j*3+1];j=c[j*3+2];var t=c[m*3],x=c[m*3+1];m=c[m*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,p,j),new THREE.Vector3(t,x,m)],null,g))},f4n:function(a,c,b,e,f,g,h,j,m,n,p){h=a.materials[h];var t=c[m*3],x=c[m*3+1];m=c[m*3+2];var o=c[n*3],y=c[n*3+1];n=c[n*3+2];var H=c[p*3],J=c[p*3+1];p=c[p*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[j*
- 3],c[j*3+1],c[j*3+2]),new THREE.Vector3(t,x,m),new THREE.Vector3(o,y,n),new THREE.Vector3(H,J,p)],null,h))},uv3:function(a,c,b,e,f,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(e,f));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,e,f,g,h,j,m){var n=[];n.push(new THREE.UV(c,b));n.push(new THREE.UV(e,f));n.push(new THREE.UV(g,h));n.push(new THREE.UV(j,m));a.push(n)}};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,h,j,m,n,p,t){h=(h-p)/(t-p);p=this.normal_cache;e[g]=j+h*this.delta;e[g+1]=m;e[g+2]=n;f[g]=this.lerp(p[b],p[b+3],h);f[g+1]=this.lerp(p[b+1],p[b+4],h);f[g+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,e,f,g,h,j,m,n,p,t){h=(h-p)/(t-p);p=this.normal_cache;e[g]=j;e[g+1]=m+h*this.delta;e[g+
- 2]=n;e=b+this.yd*3;f[g]=this.lerp(p[b],p[e],h);f[g+1]=this.lerp(p[b+1],p[e+1],h);f[g+2]=this.lerp(p[b+2],p[e+2],h)};this.VIntZ=function(b,e,f,g,h,j,m,n,p,t){h=(h-p)/(t-p);p=this.normal_cache;e[g]=j;e[g+1]=m;e[g+2]=n+h*this.delta;e=b+this.zd*3;f[g]=this.lerp(p[b],p[e],h);f[g+1]=this.lerp(p[b+1],p[e+1],h);f[g+2]=this.lerp(p[b+2],p[e+2],h)};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,h,j){var m=g+1,n=g+this.yd,p=g+this.zd,t=m+this.yd,x=m+this.zd,o=g+this.yd+this.zd,y=m+this.yd+this.zd,H=0,J=this.field[g],C=this.field[m],K=this.field[n],z=this.field[t],W=this.field[p],S=this.field[x],R=this.field[o],ia=this.field[y];J<h&&(H|=1);C<h&&(H|=2);K<h&&(H|=8);z<h&&(H|=4);W<h&&(H|=16);S<h&&(H|=32);R<h&&(H|=128);ia<h&&(H|=64);var ea=THREE.edgeTable[H];if(ea==0)return 0;
- var qa=this.delta,na=b+qa,Y=e+qa;qa=f+qa;if(ea&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,e,f,J,C)}if(ea&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,h,na,e,f,C,z)}if(ea&4){this.compNorm(n);this.compNorm(t);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,Y,f,K,z)}if(ea&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,e,f,J,K)}if(ea&16){this.compNorm(p);this.compNorm(x);this.VIntX(p*3,this.vlist,this.nlist,
- 12,h,b,e,qa,W,S)}if(ea&32){this.compNorm(x);this.compNorm(y);this.VIntY(x*3,this.vlist,this.nlist,15,h,na,e,qa,S,ia)}if(ea&64){this.compNorm(o);this.compNorm(y);this.VIntX(o*3,this.vlist,this.nlist,18,h,b,Y,qa,R,ia)}if(ea&128){this.compNorm(p);this.compNorm(o);this.VIntY(p*3,this.vlist,this.nlist,21,h,b,e,qa,W,R)}if(ea&256){this.compNorm(g);this.compNorm(p);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,e,f,J,W)}if(ea&512){this.compNorm(m);this.compNorm(x);this.VIntZ(m*3,this.vlist,this.nlist,27,h,na,
- e,f,C,S)}if(ea&1024){this.compNorm(t);this.compNorm(y);this.VIntZ(t*3,this.vlist,this.nlist,30,h,na,Y,f,z,ia)}if(ea&2048){this.compNorm(n);this.compNorm(o);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,Y,f,K,R)}H<<=4;for(h=g=0;THREE.triTable[H+h]!=-1;){b=H+h;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],j);h+=3;g++}return g};this.posnormtriv=function(b,e,f,g,h,j){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[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+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[h];this.normalArray[m+7]=e[h+1];this.normalArray[m+8]=e[h+2];this.hasPos=!0;this.hasNormal=!0;
- this.count+=3;this.count>=this.maxCount-3&&j(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,h){var j=this.size*Math.sqrt(g/h),m=f*this.size,n=e*this.size,p=b*this.size,t=Math.floor(m-j);t<1&&(t=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var x=Math.floor(n-j);x<1&&(x=1);n=Math.floor(n+j);n>this.size-1&&(n=
- this.size-1);var o=Math.floor(p-j);o<1&&(o=1);j=Math.floor(p+j);j>this.size-1&&(j=this.size-1);for(var y,H,J,C,K,z;t<m;t++){p=this.size2*t;H=t/this.size-f;K=H*H;for(H=x;H<n;H++){J=p+this.size*H;y=H/this.size-e;z=y*y;for(y=o;y<j;y++){C=y/this.size-b;C=g/(1.0E-6+C*C+z+K)-h;C>0&&(this.field[J+y]+=C)}}}};this.addPlaneX=function(b,e){var f,g,h,j,m,n=this.size,p=this.yd,t=this.zd,x=this.field,o=n*Math.sqrt(b/e);o>n&&(o=n);for(f=0;f<o;f++){g=f/n;g*=g;j=b/(1.0E-4+g)-e;if(j>0)for(g=0;g<n;g++){m=f+g*p;for(h=
- 0;h<n;h++)x[t*h+m]+=j}}};this.addPlaneY=function(b,e){var f,g,h,j,m,n,p=this.size,t=this.yd,x=this.zd,o=this.field,y=p*Math.sqrt(b/e);y>p&&(y=p);for(g=0;g<y;g++){f=g/p;f*=f;j=b/(1.0E-4+f)-e;if(j>0){m=g*t;for(f=0;f<p;f++){n=m+f;for(h=0;h<p;h++)o[x*h+n]+=j}}}};this.addPlaneZ=function(b,e){var f,g,h,j,m,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;j=b/(1.0E-4+f)-e;if(j>0){m=zd*h;for(g=0;g<size;g++){n=m+g*yd;
- for(f=0;f<size;f++)field[n+f]+=j}}}};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,h,j,m,n,p,t,x=this.size-2;for(h=1;h<x;h++){t=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<x;g++){p=t+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<x;f++){j=(f-this.halfsize)/this.halfsize;e=p+f;this.polygonize(j,m,n,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;
- this.render(function(f){var g,h,j,m,n,p,t,x;for(g=0;g<f.count;g++){n=g*3;t=n+1;x=n+2;h=f.positionArray[n];j=f.positionArray[t];m=f.positionArray[x];p=new THREE.Vector3(h,j,m);h=f.normalArray[n];j=f.normalArray[t];m=f.normalArray[x];n=new THREE.Vector3(h,j,m);n.normalize();n=new THREE.Vertex(p,n);e.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;t=n+1;x=n+2;p=e.vertices[n].normal;h=e.vertices[t].normal;j=e.vertices[x].normal;n=new THREE.Face3(n,t,x,[p,h,j]);e.faces.push(n)}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,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
- THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
- -1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
- 8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
- -1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
- 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
- -1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
- 10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
- 6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
- 8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
- 2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
- -1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
- -1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
- -1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- 1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
- -1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
- 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
- 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
- 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
|