123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606 |
- // Three.js r42 - http://github.com/mrdoob/three.js
- var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
- THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;this.updateHex()},setHSV:function(b,c,e){var f,g,h,j,m,n;if(e==0)f=g=h=0;else switch(j=Math.floor(b*6),m=b*6-j,b=e*(1-c),n=e*(1-c*m),c=e*(1-c*(1-m)),j){case 1:f=n;g=e;h=b;break;case 2:f=b;g=e;h=c;break;case 3:f=b;g=n;h=e;break;case 4:f=c;g=b;h=e;break;case 5:f=e;g=b;h=n;break;case 6:case 0:f=e,g=c,h=b}this.setRGB(f,
- g,h)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
- THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
- (this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
- unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.set(b||0,c||0,e||0)};
- THREE.Vector3.prototype={set:function(b,c,e){this.x=b;this.y=c;this.z=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;return this},subSelf:function(b){this.x-=
- b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){return this.divide(this,b)},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*
- b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*
- b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};
- THREE.Vector4=function(b,c,e,f){this.set(b||0,c||0,e||0,f||1)};
- THREE.Vector4.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){return this.set(b.x,b.y,b.z,b.w||1)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=
- b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
- setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
- THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f,c=c.matrixWorld.getPosition();f=c.clone().subSelf(b).dot(e);b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),c=c.clone().subSelf(e),
- g=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(g),h=c.dot(c),c=c.dot(g),g=1/(b*h-e*e),h=(h*f-e*c)*g,b=(b*c-e*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,h,j,m,n,p,o,u,v,w,x=b.geometry,
- y=x.vertices,D=[],f=0;for(g=x.faces.length;f<g;f++)if(h=x.faces[f],v=this.origin.clone(),w=this.direction.clone(),p=b.matrixWorld,j=p.multiplyVector3(y[h.a].position.clone()),m=p.multiplyVector3(y[h.b].position.clone()),n=p.multiplyVector3(y[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(y[h.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),u=w.dot(o),b.doubleSided||(b.flipSided?u>0:u<0))if(o=o.dot((new THREE.Vector3).sub(j,v))/u,v=v.addSelf(w.multiplyScalar(o)),
- h instanceof THREE.Face3)e(v,j,m,n)&&(h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},D.push(h));else if(h instanceof THREE.Face4&&(e(v,j,m,p)||e(v,m,n,p)))h={distance:this.origin.distanceTo(v),point:v,face:h,object:b},D.push(h);return D}else return[]}};
- THREE.Rectangle=function(){function b(){h=f-c;j=g-e}var c,e,f,g,h,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,u){m=!1;c=h;e=j;f=o;g=u;b()};this.addPoint=function(h,j){m?(m=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
- function(h,j,o,u,v,w){m?(m=!1,c=h<o?h<v?h:v:o<v?o:v,e=j<u?j<w?j:w:u<w?u:w,f=h>o?h>v?h:v:o>v?o:v,g=j>u?j>w?j:w:u>w?u:w):(c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<u?j<w?j<e?j:e:w<e?w:e:u<w?u<e?u:e:w<e?w:e,f=h>o?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=j>u?j>w?j>g?j:g:w>g?w:g:u>w?u>g?u:g:w>g?w:g);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
- h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;g=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
- THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,h,j,m,n,p,o,u,v,w,x,y){this.set(b||1,c||0,e||0,f||0,g||0,h||1,j||0,m||0,n||0,p||0,o||1,u||0,v||0,w||0,x||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={set:function(b,c,e,f,g,h,j,m,n,p,o,u,v,w,x,y){this.n11=b;this.n12=c;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=o;this.n34=u;this.n41=v;this.n42=w;this.n43=x;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,e){var f=THREE.Matrix4.__v1,
- g=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(e,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(e,h).normalize());g.cross(h,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=h.x;this.n21=f.y;this.n22=g.y;this.n23=h.y;this.n31=f.z;this.n32=g.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;b.y=(this.n21*c+this.n22*e+this.n23*
- f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+e*this.n32+f*this.n33;b.normalize();
- return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,v=b.n33,w=b.n34,x=b.n41,y=b.n42,D=b.n43,A=b.n44,H=c.n11,C=c.n12,E=c.n13,I=c.n14,J=c.n21,S=c.n22,
- R=c.n23,N=c.n24,F=c.n31,W=c.n32,K=c.n33,X=c.n34,Q=c.n41,U=c.n42,k=c.n43,ia=c.n44;this.n11=e*H+f*J+g*F+h*Q;this.n12=e*C+f*S+g*W+h*U;this.n13=e*E+f*R+g*K+h*k;this.n14=e*I+f*N+g*X+h*ia;this.n21=j*H+m*J+n*F+p*Q;this.n22=j*C+m*S+n*W+p*U;this.n23=j*E+m*R+n*K+p*k;this.n24=j*I+m*N+n*X+p*ia;this.n31=o*H+u*J+v*F+w*Q;this.n32=o*C+u*S+v*W+w*U;this.n33=o*E+u*R+v*K+w*k;this.n34=o*I+u*N+v*X+w*ia;this.n41=x*H+y*J+D*F+A*Q;this.n42=x*C+y*S+D*W+A*U;this.n43=x*E+y*R+D*K+A*k;this.n44=x*I+y*N+D*X+A*ia;return this},multiplyToArray:function(b,
- c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=
- b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,h=this.n22,j=this.n23,m=this.n24,n=this.n31,p=this.n32,o=this.n33,u=this.n34,v=this.n41,w=this.n42,x=this.n43,y=this.n44;return f*j*p*v-e*m*p*v-f*h*o*v+c*m*o*v+e*h*u*v-c*j*u*v-f*j*n*w+e*m*n*w+f*g*o*w-b*m*o*w-e*g*u*w+b*j*u*w+f*h*n*x-c*m*n*x-f*g*p*x+b*m*p*x+c*g*u*x-b*h*u*x-e*h*n*y+c*j*n*y+e*g*p*y-b*j*p*y-c*g*o*y+b*h*o*y},transpose:function(){var b;b=this.n21;this.n21=
- this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=
- this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=
- this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,
- c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,
- c){var e=Math.cos(c),f=Math.sin(c),g=1-e,h=b.x,j=b.y,m=b.z,n=g*h,p=g*j;this.set(n*h+e,n*j-f*m,n*m+f*j,0,n*j+f*m,p*j+e,p*m-f*h,0,n*m-f*j,p*m+f*h,g*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);
- return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,h=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),m=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var n=j*m,p=j*g,o=f*m,u=f*g;this.n11=n+u*e;this.n12=
- o*e-p;this.n13=h*f;this.n21=h*g;this.n22=h*m;this.n23=-e;this.n31=p*e-o;this.n32=u+n*e;this.n33=h*j;break;case "ZXY":n=j*m;p=j*g;o=f*m;u=f*g;this.n11=n-u*e;this.n12=-h*g;this.n13=o+p*e;this.n21=p+o*e;this.n22=h*m;this.n23=u-n*e;this.n31=-h*f;this.n32=e;this.n33=h*j;break;case "ZYX":n=h*m;p=h*g;o=e*m;u=e*g;this.n11=j*m;this.n12=o*f-p;this.n13=n*f+u;this.n21=j*g;this.n22=u*f+n;this.n23=p*f-o;this.n31=-f;this.n32=e*j;this.n33=h*j;break;case "YZX":n=h*j;p=h*f;o=e*j;u=e*f;this.n11=j*m;this.n12=u-n*g;this.n13=
- o*g+p;this.n21=g;this.n22=h*m;this.n23=-e*m;this.n31=-f*m;this.n32=p*g+o;this.n33=n-u*g;break;case "XZY":n=h*j;p=h*f;o=e*j;u=e*f;this.n11=j*m;this.n12=-g;this.n13=f*m;this.n21=n*g+u;this.n22=h*m;this.n23=p*g-o;this.n31=o*g-p;this.n32=e*m;this.n33=u*g+n;break;default:n=h*m,p=h*g,o=e*m,u=e*g,this.n11=j*m,this.n12=-j*g,this.n13=f,this.n21=p+o*f,this.n22=n-u*f,this.n23=-e*j,this.n31=u-n*f,this.n32=o+p*f,this.n33=h*j}return this},setRotationFromQuaternion:function(b){var c=b.x,e=b.y,f=b.z,g=b.w,h=c+c,
- j=e+e,m=f+f,b=c*h,n=c*j;c*=m;var p=e*j;e*=m;f*=m;h*=g;j*=g;g*=m;this.n11=1-(p+f);this.n12=n-g;this.n13=c+j;this.n21=n+g;this.n22=1-(b+f);this.n23=e-h;this.n31=c-j;this.n32=e+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,
- c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
- THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,h=b.n14,j=b.n21,m=b.n22,n=b.n23,p=b.n24,o=b.n31,u=b.n32,v=b.n33,w=b.n34,x=b.n41,y=b.n42,D=b.n43,A=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=n*w*y-p*v*y+p*u*D-m*w*D-n*u*A+m*v*A;c.n12=h*v*y-g*w*y-h*u*D+f*w*D+g*u*A-f*v*A;c.n13=g*p*y-h*n*y+h*m*D-f*p*D-g*m*A+f*n*A;c.n14=h*n*u-g*p*u-h*m*v+f*p*v+g*m*w-f*n*w;c.n21=p*v*x-n*w*x-p*o*D+j*w*D+n*o*A-j*v*A;c.n22=g*w*x-h*v*x+h*o*D-e*w*D-g*o*A+e*v*A;c.n23=h*n*x-g*p*x-h*j*D+e*p*D+g*j*A-e*n*A;c.n24=
- g*p*o-h*n*o+h*j*v-e*p*v-g*j*w+e*n*w;c.n31=m*w*x-p*u*x+p*o*y-j*w*y-m*o*A+j*u*A;c.n32=h*u*x-f*w*x-h*o*y+e*w*y+f*o*A-e*u*A;c.n33=g*p*x-h*m*x+h*j*y-e*p*y-f*j*A+e*m*A;c.n34=h*m*o-f*p*o-h*j*u+e*p*u+f*j*w-e*m*w;c.n41=n*u*x-m*v*x-n*o*y+j*v*y+m*o*D-j*u*D;c.n42=f*v*x-g*u*x+g*o*y-e*v*y-f*o*D+e*u*D;c.n43=g*m*x-f*n*x-g*j*y+e*n*y+f*j*D-e*m*D;c.n44=f*n*o-g*m*o+g*j*u-e*n*u-f*j*v+e*m*v;c.multiplyScalar(1/b.determinant());return c};
- THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,n=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*h;e[3]=b*j;e[4]=b*m;e[5]=b*n;e[6]=b*p;e[7]=b*o;e[8]=b*u;return c};
- THREE.Matrix4.makeFrustum=function(b,c,e,f,g,h){var j;j=new THREE.Matrix4;j.n11=2*g/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*g/(f-e);j.n23=(f+e)/(f-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+g)/(h-g);j.n34=-2*h*g/(h-g);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
- THREE.Matrix4.makeOrtho=function(b,c,e,f,g,h){var j,m,n,p;j=new THREE.Matrix4;m=c-b;n=e-f;p=h-g;j.n11=2/m;j.n12=0;j.n13=0;j.n14=-((c+b)/m);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((e+f)/n);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((h+g)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
- THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
- this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this._vector=new THREE.Vector3;this.name=""};
- THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
- -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,g;e=0;for(f=this.children.length;e<f;e++){g=this.children[e];if(g.name===b)return g;if(c&&(g=g.getChildByName(b,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);
- this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
- this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
- THREE.Quaternion.prototype={set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),h=Math.cos(e),e=Math.sin(e),j=b*c,m=f*g;this.w=j*h-m*e;this.x=j*e+m*h;this.y=f*c*h+b*g*e;this.z=b*g*h-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);this.x=b.x*f;this.y=b.y*
- f;this.z=b.z*f;this.w=Math.cos(e);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
- multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,h=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+g*h+e*m-f*j;this.y=e*b+g*j+f*h-c*m;this.z=f*b+g*m+c*j-e*h;this.w=g*b-c*h-e*j-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,h=this.x,j=this.y,m=this.z,n=this.w,p=n*e+j*g-m*f,o=
- n*f+m*e-h*g,u=n*g+h*f-j*e,e=-h*e-j*f-m*g;c.x=p*n+e*-h+o*-m-u*-j;c.y=o*n+e*-j+u*-h-p*-m;c.z=u*n+e*-m+p*-j-o*-h;return c}};
- THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var h=Math.acos(g),j=Math.sqrt(1-g*g);if(Math.abs(j)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
- THREE.Face3=function(b,c,e,f,g,h){this.a=b;this.b=c;this.c=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.Face4=function(b,c,e,f,g,h,j){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
- THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
- THREE.Geometry.prototype={computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
- e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,h,j,m=new THREE.Vector3,n=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){h=this.faces[f];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(e=h.vertexNormals.length;c<e;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],e=this.vertices[h.b],j=this.vertices[h.c],m.sub(j.position,e.position),n.sub(c.position,e.position),m.crossSelf(n);m.isZero()||
- m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
- this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
- e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,g,h,k){m=b.vertices[e].position;n=b.vertices[c].position;p=b.vertices[f].position;o=j[g];u=j[h];v=j[k];w=n.x-m.x;x=p.x-m.x;y=n.y-m.y;D=p.y-m.y;A=n.z-m.z;H=p.z-m.z;C=u.u-o.u;E=v.u-o.u;I=u.v-o.v;J=v.v-o.v;S=1/(C*J-E*I);W.set((J*w-I*x)*
- S,(J*y-I*D)*S,(J*A-I*H)*S);K.set((C*x-E*w)*S,(C*D-E*y)*S,(C*H-E*A)*S);N[e].addSelf(W);N[c].addSelf(W);N[f].addSelf(W);F[e].addSelf(K);F[c].addSelf(K);F[f].addSelf(K)}var c,e,f,g,h,j,m,n,p,o,u,v,w,x,y,D,A,H,C,E,I,J,S,R,N=[],F=[],W=new THREE.Vector3,K=new THREE.Vector3,X=new THREE.Vector3,Q=new THREE.Vector3,U=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)N[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],j=this.faceVertexUvs[0][c],h instanceof
- THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var k=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)U.copy(h.vertexNormals[f]),g=h[k[f]],R=N[g],X.copy(R),X.subSelf(U.multiplyScalar(U.dot(R))).normalize(),Q.cross(h.vertexNormals[f],R),g=Q.dot(F[g]),g=g<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
- if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
- else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
- void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,g,h,j,m={};e=0;for(f=this.faces.length;e<f;e++)j=this.faces[e],j instanceof THREE.Face3?(g=b(j.a,j.b),c(m,g,e),g=b(j.b,j.c),c(m,g,e),g=b(j.a,j.c),c(m,g,e)):j instanceof THREE.Face4&&(g=b(j.b,j.d),c(m,g,e),g=b(j.a,j.b),c(m,g,e),g=b(j.a,j.d),c(m,g,e),g=b(j.b,j.c),c(m,g,e),g=b(j.c,j.d),c(m,g,e));e=0;for(f=this.edges.length;e<f;e++){j=this.edges[e];g=j.vertexIndices[0];h=j.vertexIndices[1];
- j.faceIndices=m[b(g,h)].array;for(g=0;g<j.faceIndices.length;g++)h=j.faceIndices[g],j.faces.push(this.faces[h])}}};THREE.GeometryIdCounter=0;
- THREE.Spline=function(b){function c(b,e,c,f,g,h,j){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*j+(-3*(e-c)-2*b-f)*h+b*g+e}this.points=b;var e=[],f={x:0,y:0,z:0},g,h,j,m,n,p,o,u,v;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;h=Math.floor(g);j=g-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;p=this.points[e[0]];o=this.points[e[1]];
- u=this.points[e[2]];v=this.points[e[3]];m=j*j;n=j*m;f.x=c(p.x,o.x,u.x,v.x,j,m,n);f.y=c(p.y,o.y,u.y,v.y,j,m,n);f.z=c(p.z,o.z,u.z,v.z,j,m,n);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,g=new THREE.Vector3,h=new THREE.Vector3,j=[],m=0;j[0]=0;b||(b=100);c=this.points.length*b;g.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
- m+=h.distanceTo(g),g.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(j[e]=m,f=e);j[j.length]=m;return{chunks:j,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,g,h,j,m=[],n=new THREE.Vector3,p=this.getLength();m.push(n.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=p.chunks[e]-p.chunks[e-1];j=Math.ceil(b*c/p.total);g=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<j-1;c++)f=g+c*(1/j)*(h-g),position=this.getPoint(f),m.push(n.copy(position).clone());
- m.push(n.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
- THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
- THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
- THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,h){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=h;this.updateProjectionMatrix()};
- THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
- !1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
- THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=e||0;this.castShadow=f!==void 0?f:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=e||0};
- THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,c,e,f){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=void 0;b!==void 0&&this.add(b,c,e,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
- THREE.LensFlare.prototype.add=function(b,c,e,f){c===void 0&&(c=-1);e===void 0&&(e=0);if(f===void 0)f=THREE.BillboardBlending;e=Math.min(e,Math.max(0,e));this.lensFlares.push({texture:b,size:c,distance:e,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:f})};
- THREE.LensFlare.prototype.updateLensFlares=function(){var b,c=this.lensFlares.length,e,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(b=0;b<c;b++)e=this.lensFlares[b],e.x=this.positionScreen.x+f*e.distance,e.y=this.positionScreen.y+g*e.distance,e.wantedRotation=e.x*Math.PI*0.25,e.rotation+=(e.wantedRotation-e.rotation)*0.25};
- THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:
- 0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
- THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;
- THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
- THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
- void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};
- THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
- THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
- void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};
- THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
- THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;
- this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==
- void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
- THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
- THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
- THREE.MeshShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=
- b.fog!==void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshShaderMaterial.prototype=new THREE.Material;THREE.MeshShaderMaterial.prototype.constructor=THREE.MeshShaderMaterial;
- THREE.ShadowVolumeDynamicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
- void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};
- THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
- THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
- THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
- THREE.Texture=function(b,c,e,f,g,h){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);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.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
- THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;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(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
- THREE.Line.prototype.constructor=THREE.Line;
- THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
- e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
- THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<g;f++)this.children[f].update(this.skinMatrix,
- c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
- THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,g,h,j,m;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)g=this.geometry.bones[e],h=g.pos,j=g.rotq,m=g.scl,f=this.addBone(),f.name=g.name,f.position.set(h[0],h[1],h[2]),f.quaternion.set(j[0],j[1],j[2],j[3]),f.useQuaternion=!0,m!==void 0?f.scale.set(m[0],m[1],m[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)g=this.geometry.bones[e],
- f=this.bones[e],g.parent===-1?this.addChild(f):this.bones[g.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
- THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,g=this.children.length;for(f=0;f<g;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
- c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
- THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,g=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
- e.y,e.z);this.geometry.skinVerticesA.push(c[g].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
- THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;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(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
- THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
- this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
- THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
- THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,e,f,g,h,j,m,n,p,o,u,v,w,x=new THREE.Geometry;x.vertices=this.geometry.vertices;f=x.faces=this.geometry.faces;var y=x.egdes=this.geometry.edges,D=x.edgeFaces=[];g=0;var A=[];b=0;for(c=f.length;b<c;b++)if(e=f[b],A.push(g),g+=e instanceof THREE.Face3?3:4,e.vertexNormals[0]=e.normal,e.vertexNormals[1]=e.normal,e.vertexNormals[2]=e.normal,e instanceof THREE.Face4)e.vertexNormals[3]=
- e.normal;b=0;for(c=y.length;b<c;b++)m=y[b],e=m.faces[0],f=m.faces[1],g=m.faceIndices[0],h=m.faceIndices[1],j=m.vertexIndices[0],m=m.vertexIndices[1],e.a===j?(n="a",o=A[g]+0):e.b===j?(n="b",o=A[g]+1):e.c===j?(n="c",o=A[g]+2):e.d===j&&(n="d",o=A[g]+3),e.a===m?(n+="a",u=A[g]+0):e.b===m?(n+="b",u=A[g]+1):e.c===m?(n+="c",u=A[g]+2):e.d===m&&(n+="d",u=A[g]+3),f.a===j?(p="a",v=A[h]+0):f.b===j?(p="b",v=A[h]+1):f.c===j?(p="c",v=A[h]+2):f.d===j&&(p="d",v=A[h]+3),f.a===m?(p+="a",w=A[h]+0):f.b===m?(p+="b",w=A[h]+
- 1):f.c===m?(p+="c",w=A[h]+2):f.d===m&&(p+="d",w=A[h]+3),n==="ac"||n==="ad"||n==="ca"||n==="da"?o>u&&(e=o,o=u,u=e):o<u&&(e=o,o=u,u=e),p==="ac"||p==="ad"||p==="ca"||p==="da"?v>w&&(e=v,v=w,w=e):v<w&&(e=v,v=w,w=e),e=new THREE.Face4(o,u,v,w),e.normal.set(1,0,0),D.push(e);this.geometry=x}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
- THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,e=this.geometry.faces,f=this.geometry.edgeFaces,g=b.faces,b=b.vertices,h=g.length,j,m,n,p,o,u=["a","b","c","d"];for(n=0;n<h;n++){m=c.length;j=g[n];j instanceof THREE.Face4?(p=4,m=new THREE.Face4(m,m+1,m+2,m+3)):(p=3,m=new THREE.Face3(m,m+1,m+2));m.normal.copy(j.normal);e.push(m);
- for(m=0;m<p;m++)o=b[j[u[m]]],c.push(new THREE.Vertex(o.position.clone()))}for(h=0;h<g.length-1;h++){b=e[h];for(j=h+1;j<g.length;j++)m=e[j],m=this.facesShareEdge(c,b,m),m!==void 0&&(m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]),m.normal.set(1,0,0),f.push(m))}};
- THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,e){var f,g,h,j,m,n,p,o,u,v,w,x,y,D=0,A=["a","b","c","d"];f=c instanceof THREE.Face4?4:3;g=e instanceof THREE.Face4?4:3;for(x=0;x<f;x++){h=c[A[x]];m=b[h];for(y=0;y<g;y++)if(j=e[A[y]],n=b[j],Math.abs(m.position.x-n.position.x)<1.0E-4&&Math.abs(m.position.y-n.position.y)<1.0E-4&&Math.abs(m.position.z-n.position.z)<1.0E-4&&(D++,D===1&&(p=m,o=n,u=h,v=j,w=A[x]),D===2))return w+=A[x],w==="ad"||w==="ac"?{faces:[c,e],vertices:[p,o,n,m],indices:[u,v,
- j,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,e],vertices:[p,m,n,o],indices:[u,h,j,v],vertexTypes:[1,1,2,2],extrudable:!0}}};
- THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
- this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
- THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
- THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
- THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=this.fog=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};
- THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
- THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.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(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
- THREE.Projector=function(){function b(){var b=n[m]=n[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,g=b.z+b.w,h=e.z+e.w,j=-b.z+b.w,m=-e.z+e.w;return g>=0&&h>=0&&j>=0&&m>=0?!0:g<0&&h<0||j<0&&m<0?!1:(g<0?c=Math.max(c,g/(g-h)):h<0&&(f=Math.min(f,g/(g-h))),j<0?c=Math.max(c,j/(j-m)):m<0&&(f=Math.min(f,j/(j-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,g,h=[],j,m,n=[],p,o,u=[],v,w=[],x,y,D=[],A,H,C=[],E=new THREE.Vector4,I=new THREE.Vector4,
- J=new THREE.Matrix4,S=new THREE.Matrix4,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,F=new THREE.Vector4;this.projectVector=function(b,e){J.multiply(e.projectionMatrix,e.matrixWorldInverse);J.multiplyVector3(b);return b};this.unprojectVector=function(b,e){J.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));J.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var e=[],m,n,k;g=0;n=
- b.objects;b=0;for(m=n.length;b<m;b++){k=n[b];var p;if(!(p=!k.visible))if(p=k instanceof THREE.Mesh){a:{p=void 0;for(var o=k.matrixWorld,u=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),v=0;v<6;v++)if(p=R[v].x*o.n14+R[v].y*o.n24+R[v].z*o.n34+R[v].w,p<=u){p=!1;break a}p=!0}p=!p}if(!p)p=h[g]=h[g]||new THREE.RenderableObject,g++,f=p,E.copy(k.position),J.multiplyVector3(E),f.object=k,f.z=E.z,e.push(f)}j&&e.sort(c);return e};this.projectScene=function(f,g,h){var E=[],
- U=g.near,k=g.far,ia,L,ga,fa,$,ha,ja,ma,ra,T,ka,ca,oa,da,Y,Z,pa;H=y=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);J.multiply(g.projectionMatrix,g.matrixWorldInverse);R[0].set(J.n41-J.n11,J.n42-J.n12,J.n43-J.n13,J.n44-J.n14);R[1].set(J.n41+J.n11,J.n42+J.n12,J.n43+J.n13,J.n44+J.n14);R[2].set(J.n41+J.n21,J.n42+J.n22,J.n43+J.n23,J.n44+J.n24);R[3].set(J.n41-J.n21,J.n42-J.n22,J.n43-J.n23,J.n44-J.n24);R[4].set(J.n41-J.n31,J.n42-J.n32,J.n43-J.n33,J.n44-J.n34);R[5].set(J.n41+J.n31,J.n42+
- J.n32,J.n43+J.n33,J.n44+J.n34);for(ia=0;ia<6;ia++)ra=R[ia],ra.divideScalar(Math.sqrt(ra.x*ra.x+ra.y*ra.y+ra.z*ra.z));ra=this.projectObjects(f,g,!0);f=0;for(ia=ra.length;f<ia;f++)if(T=ra[f].object,T.visible)if(ka=T.matrixWorld,ca=T.matrixRotationWorld,oa=T.materials,da=T.overdraw,m=0,T instanceof THREE.Mesh){Y=T.geometry;fa=Y.vertices;Z=Y.faces;Y=Y.faceVertexUvs;L=0;for(ga=fa.length;L<ga;L++)j=b(),j.positionWorld.copy(fa[L].position),ka.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
- J.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>U&&j.positionScreen.z<k;fa=0;for(L=Z.length;fa<L;fa++){ga=Z[fa];if(ga instanceof THREE.Face3)if($=n[ga.a],ha=n[ga.b],ja=n[ga.c],$.visible&&ha.visible&&ja.visible&&(T.doubleSided||T.flipSided!=(ja.positionScreen.x-$.positionScreen.x)*(ha.positionScreen.y-$.positionScreen.y)-(ja.positionScreen.y-$.positionScreen.y)*(ha.positionScreen.x-$.positionScreen.x)<0))ma=
- u[o]=u[o]||new THREE.RenderableFace3,o++,p=ma,p.v1.copy($),p.v2.copy(ha),p.v3.copy(ja);else continue;else if(ga instanceof THREE.Face4)if($=n[ga.a],ha=n[ga.b],ja=n[ga.c],ma=n[ga.d],$.visible&&ha.visible&&ja.visible&&ma.visible&&(T.doubleSided||T.flipSided!=((ma.positionScreen.x-$.positionScreen.x)*(ha.positionScreen.y-$.positionScreen.y)-(ma.positionScreen.y-$.positionScreen.y)*(ha.positionScreen.x-$.positionScreen.x)<0||(ha.positionScreen.x-ja.positionScreen.x)*(ma.positionScreen.y-ja.positionScreen.y)-
- (ha.positionScreen.y-ja.positionScreen.y)*(ma.positionScreen.x-ja.positionScreen.x)<0)))pa=w[v]=w[v]||new THREE.RenderableFace4,v++,p=pa,p.v1.copy($),p.v2.copy(ha),p.v3.copy(ja),p.v4.copy(ma);else continue;p.normalWorld.copy(ga.normal);ca.multiplyVector3(p.normalWorld);p.centroidWorld.copy(ga.centroid);ka.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);J.multiplyVector3(p.centroidScreen);ja=ga.vertexNormals;$=0;for(ha=ja.length;$<ha;$++)ma=p.vertexNormalsWorld[$],ma.copy(ja[$]),
- ca.multiplyVector3(ma);$=0;for(ha=Y.length;$<ha;$++)if(pa=Y[$][fa]){ja=0;for(ma=pa.length;ja<ma;ja++)p.uvs[$][ja]=pa[ja]}p.meshMaterials=oa;p.faceMaterials=ga.materials;p.overdraw=da;p.z=p.centroidScreen.z;E.push(p)}}else if(T instanceof THREE.Line){S.multiply(J,ka);fa=T.geometry.vertices;$=b();$.positionScreen.copy(fa[0].position);S.multiplyVector4($.positionScreen);L=1;for(ga=fa.length;L<ga;L++)if($=b(),$.positionScreen.copy(fa[L].position),S.multiplyVector4($.positionScreen),ha=n[m-2],N.copy($.positionScreen),
- F.copy(ha.positionScreen),e(N,F))N.multiplyScalar(1/N.w),F.multiplyScalar(1/F.w),ka=D[y]=D[y]||new THREE.RenderableLine,y++,x=ka,x.v1.positionScreen.copy(N),x.v2.positionScreen.copy(F),x.z=Math.max(N.z,F.z),x.materials=T.materials,E.push(x)}else if(T instanceof THREE.Particle&&(I.set(T.matrixWorld.n14,T.matrixWorld.n24,T.matrixWorld.n34,1),J.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))ka=C[H]=C[H]||new THREE.RenderableParticle,H++,A=ka,A.x=I.x/I.w,A.y=I.y/I.w,A.z=I.z,A.rotation=T.rotation.z,A.scale.x=
- T.scale.x*Math.abs(A.x-(I.x+g.projectionMatrix.n11)/(I.w+g.projectionMatrix.n14)),A.scale.y=T.scale.y*Math.abs(A.y-(I.y+g.projectionMatrix.n22)/(I.w+g.projectionMatrix.n24)),A.materials=T.materials,E.push(A);h&&E.sort(c);return E}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;h=f/2};this.render=function(e,f){var n,p,o,u,v,w,x,y;b=c.projectScene(e,f);n=0;for(p=b.length;n<p;n++)if(v=b[n],v instanceof THREE.RenderableParticle){x=v.x*g+g;y=v.y*h+h;o=0;for(u=v.material.length;o<u;o++)if(w=v.material[o],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=x+"px",w.style.top=y+"px"}}};
- THREE.CanvasRenderer=function(b){function c(b){if(A!=b)x.globalAlpha=A=b}function e(b){if(H!=b){switch(b){case THREE.NormalBlending:x.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:x.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:x.globalCompositeOperation="darker"}H=b}}function f(b){if(C!=b.hex)C=b.hex,x.strokeStyle="#"+h(C.toString(16))}function g(b){if(E!=b.hex)E=b.hex,x.fillStyle="#"+h(E.toString(16))}function h(b){for(;b.length<6;)b="0"+b;return b}
- var j=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),o,u,v,w,x=p.getContext("2d"),y=new THREE.Color(0),D=0,A=1,H=0,C=null,E=null,I=null,J=null,S=null,R,N,F,W,K=new THREE.RenderableVertex,X=new THREE.RenderableVertex,Q,U,k,ia,L,ga,fa,$,ha,ja,ma,ra,T=new THREE.Color(0),ka=new THREE.Color(0),ca=new THREE.Color(0),oa=new THREE.Color(0),da=new THREE.Color(0),Y,Z,pa,na,qa,ya,Ca,xa,Aa,Oa,ua=new THREE.Rectangle,ta=new THREE.Rectangle,sa=new THREE.Rectangle,
- Da=!1,ea=new THREE.Color,O=new THREE.Color,wa=new THREE.Color,V=new THREE.Color,la=new THREE.Vector3,aa,Ra,Xa,za,Sa,Ta,b=16;aa=document.createElement("canvas");aa.width=aa.height=2;Ra=aa.getContext("2d");Ra.fillStyle="rgba(0,0,0,1)";Ra.fillRect(0,0,2,2);Xa=Ra.getImageData(0,0,2,2);za=Xa.data;Sa=document.createElement("canvas");Sa.width=Sa.height=b;Ta=Sa.getContext("2d");Ta.translate(-b/2,-b/2);Ta.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,
- faces:0};this.setSize=function(b,e){o=b;u=e;v=o/2;w=u/2;p.width=o;p.height=u;ua.set(-v,-w,v,w);ta.set(-v,-w,v,w);A=1;H=0;S=J=I=E=C=null};this.setClearColor=function(b,e){y=b;D=e;ta.set(-v,-w,v,w)};this.setClearColorHex=function(b,e){y.setHex(b);D=e;ta.set(-v,-w,v,w)};this.clear=function(){x.setTransform(1,0,0,-1,v,w);if(!ta.isEmpty())ta.inflate(1),ta.minSelf(ua),y.hex==0&&D==0?x.clearRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight()):(e(THREE.NormalBlending),c(1),x.fillStyle="rgba("+Math.floor(y.r*
- 255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+D+")",x.fillRect(ta.getX(),ta.getY(),ta.getWidth(),ta.getHeight())),ta.empty()};this.render=function(b,h){function p(b){var e,c,f,g=b.lights;O.setRGB(0,0,0);wa.setRGB(0,0,0);V.setRGB(0,0,0);b=0;for(e=g.length;b<e;b++)c=g[b],f=c.color,c instanceof THREE.AmbientLight?(O.r+=f.r,O.g+=f.g,O.b+=f.b):c instanceof THREE.DirectionalLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.PointLight&&(V.r+=f.r,V.g+=f.g,V.b+=f.b)}function o(b,e,c,f){var g,
- h,k,j,m=b.lights,b=0;for(g=m.length;b<g;b++)h=m[b],k=h.color,h instanceof THREE.DirectionalLight?(j=c.dot(h.position),j<=0||(j*=h.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)):h instanceof THREE.PointLight&&(j=c.dot(la.sub(h.position,e).normalize()),j<=0||(j*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),j!=0&&(j*=h.intensity,f.r+=k.r*j,f.g+=k.g*j,f.b+=k.b*j)))}function u(b,h,k){c(k.opacity);e(k.blending);var j,m,p,n,o,aa;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)n=
- k.map.image,o=n.width>>1,aa=n.height>>1,k=h.scale.x*v,p=h.scale.y*w,j=k*o,m=p*aa,sa.set(b.x-j,b.y-m,b.x+j,b.y+m),ua.instersects(sa)&&(x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(k,-p),x.translate(-o,-aa),x.drawImage(n,0,0),x.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*v,m=h.scale.y*w,sa.set(b.x-j,b.y-m,b.x+j,b.y+m),ua.instersects(sa)&&(f(k.color),g(k.color),x.save(),x.translate(b.x,b.y),x.rotate(-h.rotation),x.scale(j,m),k.program(x),x.restore()))}function A(b,
- g,h,k){c(k.opacity);e(k.blending);x.beginPath();x.moveTo(b.positionScreen.x,b.positionScreen.y);x.lineTo(g.positionScreen.x,g.positionScreen.y);x.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(I!=b)x.lineWidth=I=b;b=k.linecap;if(J!=b)x.lineCap=J=b;b=k.linejoin;if(S!=b)x.lineJoin=S=b;f(k.color);x.stroke();sa.inflate(k.linewidth*2)}}function D(b,f,g,m,p,n,aa,u,v){j.data.vertices+=3;j.data.faces++;c(u.opacity);e(u.blending);Q=b.positionScreen.x;U=b.positionScreen.y;k=f.positionScreen.x;
- ia=f.positionScreen.y;L=g.positionScreen.x;ga=g.positionScreen.y;C(Q,U,k,ia,L,ga);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(na=aa.uvs[0],Ea(Q,U,k,ia,L,ga,u.map.image,na[m].u,na[m].v,na[p].u,na[p].v,na[n].u,na[n].v));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=h.matrixWorldInverse,la.copy(aa.vertexNormalsWorld[0]),qa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,ya=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(aa.vertexNormalsWorld[1]),
- Ca=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,xa=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(aa.vertexNormalsWorld[2]),Aa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,Oa=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,Ea(Q,U,k,ia,L,ga,u.envMap.image,qa,ya,Ca,xa,Aa,Oa)}else u.wireframe?E(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&(na=aa.uvs[0],Ea(Q,
- U,k,ia,L,ga,u.map.image,na[m].u,na[m].v,na[p].u,na[p].v,na[n].u,na[n].v)),e(THREE.SubtractiveBlending)),Da?!u.wireframe&&u.shading==THREE.SmoothShading&&aa.vertexNormalsWorld.length==3?(ka.r=ca.r=oa.r=O.r,ka.g=ca.g=oa.g=O.g,ka.b=ca.b=oa.b=O.b,o(v,aa.v1.positionWorld,aa.vertexNormalsWorld[0],ka),o(v,aa.v2.positionWorld,aa.vertexNormalsWorld[1],ca),o(v,aa.v3.positionWorld,aa.vertexNormalsWorld[2],oa),da.r=(ca.r+oa.r)*0.5,da.g=(ca.g+oa.g)*0.5,da.b=(ca.b+oa.b)*0.5,pa=Ua(ka,ca,oa,da),Ea(Q,U,k,ia,L,ga,
- pa,0,0,1,0,0,1)):(ea.r=O.r,ea.g=O.g,ea.b=O.b,o(v,aa.centroidWorld,aa.normalWorld,ea),T.r=Math.max(0,Math.min(u.color.r*ea.r,1)),T.g=Math.max(0,Math.min(u.color.g*ea.g,1)),T.b=Math.max(0,Math.min(u.color.b*ea.b,1)),T.updateHex(),u.wireframe?E(T,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(T)):u.wireframe?E(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(u.color);else if(u instanceof THREE.MeshDepthMaterial)Y=h.near,Z=h.far,ka.r=ka.g=ka.b=1-Ka(b.positionScreen.z,
- Y,Z),ca.r=ca.g=ca.b=1-Ka(f.positionScreen.z,Y,Z),oa.r=oa.g=oa.b=1-Ka(g.positionScreen.z,Y,Z),da.r=(ca.r+oa.r)*0.5,da.g=(ca.g+oa.g)*0.5,da.b=(ca.b+oa.b)*0.5,pa=Ua(ka,ca,oa,da),Ea(Q,U,k,ia,L,ga,pa,0,0,1,0,0,1);else if(u instanceof THREE.MeshNormalMaterial)T.r=Pa(aa.normalWorld.x),T.g=Pa(aa.normalWorld.y),T.b=Pa(aa.normalWorld.z),T.updateHex(),u.wireframe?E(T,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):Ga(T)}function y(b,f,g,m,p,n,u,aa,v){j.data.vertices+=4;j.data.faces++;c(aa.opacity);
- e(aa.blending);if(aa.map||aa.envMap)D(b,f,m,0,1,3,u,aa,v),D(p,g,n,1,2,3,u,aa,v);else if(Q=b.positionScreen.x,U=b.positionScreen.y,k=f.positionScreen.x,ia=f.positionScreen.y,L=g.positionScreen.x,ga=g.positionScreen.y,fa=m.positionScreen.x,$=m.positionScreen.y,ha=p.positionScreen.x,ja=p.positionScreen.y,ma=n.positionScreen.x,ra=n.positionScreen.y,aa instanceof THREE.MeshBasicMaterial)H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color);
- else if(aa instanceof THREE.MeshLambertMaterial)Da?!aa.wireframe&&aa.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4?(ka.r=ca.r=oa.r=da.r=O.r,ka.g=ca.g=oa.g=da.g=O.g,ka.b=ca.b=oa.b=da.b=O.b,o(v,u.v1.positionWorld,u.vertexNormalsWorld[0],ka),o(v,u.v2.positionWorld,u.vertexNormalsWorld[1],ca),o(v,u.v4.positionWorld,u.vertexNormalsWorld[3],oa),o(v,u.v3.positionWorld,u.vertexNormalsWorld[2],da),pa=Ua(ka,ca,oa,da),C(Q,U,k,ia,fa,$),Ea(Q,U,k,ia,fa,$,pa,0,0,1,0,0,1),C(ha,ja,L,ga,ma,ra),Ea(ha,
- ja,L,ga,ma,ra,pa,1,0,1,1,0,1)):(ea.r=O.r,ea.g=O.g,ea.b=O.b,o(v,u.centroidWorld,u.normalWorld,ea),T.r=Math.max(0,Math.min(aa.color.r*ea.r,1)),T.g=Math.max(0,Math.min(aa.color.g*ea.g,1)),T.b=Math.max(0,Math.min(aa.color.b*ea.b,1)),T.updateHex(),H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(T,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(T)):(H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(aa.color,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(aa.color));else if(aa instanceof THREE.MeshNormalMaterial)T.r=
- Pa(u.normalWorld.x),T.g=Pa(u.normalWorld.y),T.b=Pa(u.normalWorld.z),T.updateHex(),H(Q,U,k,ia,L,ga,fa,$),aa.wireframe?E(T,aa.wireframeLinewidth,aa.wireframeLinecap,aa.wireframeLinejoin):Ga(T);else if(aa instanceof THREE.MeshDepthMaterial)Y=h.near,Z=h.far,ka.r=ka.g=ka.b=1-Ka(b.positionScreen.z,Y,Z),ca.r=ca.g=ca.b=1-Ka(f.positionScreen.z,Y,Z),oa.r=oa.g=oa.b=1-Ka(m.positionScreen.z,Y,Z),da.r=da.g=da.b=1-Ka(g.positionScreen.z,Y,Z),pa=Ua(ka,ca,oa,da),C(Q,U,k,ia,fa,$),Ea(Q,U,k,ia,fa,$,pa,0,0,1,0,0,1),C(ha,
- ja,L,ga,ma,ra),Ea(ha,ja,L,ga,ma,ra,pa,1,0,1,1,0,1)}function C(b,e,c,f,g,h){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,h);x.lineTo(b,e);x.closePath()}function H(b,e,c,f,g,h,k,j){x.beginPath();x.moveTo(b,e);x.lineTo(c,f);x.lineTo(g,h);x.lineTo(k,j);x.lineTo(b,e);x.closePath()}function E(b,e,c,g){if(I!=e)x.lineWidth=I=e;if(J!=c)x.lineCap=J=c;if(S!=g)x.lineJoin=S=g;f(b);x.stroke();sa.inflate(e*2)}function Ga(b){g(b);x.fill()}function Ea(b,e,c,f,g,h,k,j,m,p,n,aa,u){var o,v;o=k.width-1;v=k.height-
- 1;j*=o;m*=v;p*=o;n*=v;aa*=o;u*=v;c-=b;f-=e;g-=b;h-=e;p-=j;n-=m;aa-=j;u-=m;o=p*u-aa*n;if(!((o<0?-o:o)<1))v=1/o,o=(u*c-n*g)*v,n=(u*f-n*h)*v,c=(p*g-aa*c)*v,f=(p*h-aa*f)*v,b=b-o*j-c*m,e=e-n*j-f*m,x.save(),x.transform(o,n,c,f,b,e),x.clip(),x.drawImage(k,0,0),x.restore()}function Ua(b,e,c,f){var g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),j=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);za[0]=g<0?0:g>255?255:g;za[1]=h<0?0:h>255?
- 255:h;za[2]=b<0?0:b>255?255:b;za[4]=k<0?0:k>255?255:k;za[5]=j<0?0:j>255?255:j;za[6]=e<0?0:e>255?255:e;za[8]=m<0?0:m>255?255:m;za[9]=p<0?0:p>255?255:p;za[10]=c<0?0:c>255?255:c;za[12]=n<0?0:n>255?255:n;za[13]=u<0?0:u>255?255:u;za[14]=f<0?0:f>255?255:f;Ra.putImageData(Xa,0,0);Ta.drawImage(aa,0,0);return Sa}function Ka(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Pa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ha(b,e){var c=e.x-b.x,f=e.y-b.y,g=c*c+f*f;g!=0&&(g=1/Math.sqrt(g),c*=g,f*=g,e.x+=c,e.y+=
- f,b.x-=c,b.y-=f)}var Va,G,M,B,Ia,Qa,Wa,va;this.autoClear?this.clear():x.setTransform(1,0,0,-1,v,w);j.data.vertices=0;j.data.faces=0;m=n.projectScene(b,h,this.sortElements);(Da=b.lights.length>0)&&p(b);Va=0;for(G=m.length;Va<G;Va++){M=m[Va];sa.empty();if(M instanceof THREE.RenderableParticle){R=M;R.x*=v;R.y*=w;B=0;for(Ia=M.materials.length;B<Ia;)va=M.materials[B++],va.opacity!=0&&u(R,M,va,b)}else if(M instanceof THREE.RenderableLine){if(R=M.v1,N=M.v2,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=
- v,N.positionScreen.y*=w,sa.addPoint(R.positionScreen.x,R.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),ua.instersects(sa)){B=0;for(Ia=M.materials.length;B<Ia;)va=M.materials[B++],va.opacity!=0&&A(R,N,M,va,b)}}else if(M instanceof THREE.RenderableFace3){if(R=M.v1,N=M.v2,F=M.v3,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=v,N.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,M.overdraw&&(Ha(R.positionScreen,N.positionScreen),Ha(N.positionScreen,
- F.positionScreen),Ha(F.positionScreen,R.positionScreen)),sa.add3Points(R.positionScreen.x,R.positionScreen.y,N.positionScreen.x,N.positionScreen.y,F.positionScreen.x,F.positionScreen.y),ua.instersects(sa)){B=0;for(Ia=M.meshMaterials.length;B<Ia;)if(va=M.meshMaterials[B++],va instanceof THREE.MeshFaceMaterial){Qa=0;for(Wa=M.faceMaterials.length;Qa<Wa;)(va=M.faceMaterials[Qa++])&&va.opacity!=0&&D(R,N,F,0,1,2,M,va,b)}else va.opacity!=0&&D(R,N,F,0,1,2,M,va,b)}}else if(M instanceof THREE.RenderableFace4&&
- (R=M.v1,N=M.v2,F=M.v3,W=M.v4,R.positionScreen.x*=v,R.positionScreen.y*=w,N.positionScreen.x*=v,N.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,W.positionScreen.x*=v,W.positionScreen.y*=w,K.positionScreen.copy(N.positionScreen),X.positionScreen.copy(W.positionScreen),M.overdraw&&(Ha(R.positionScreen,N.positionScreen),Ha(N.positionScreen,W.positionScreen),Ha(W.positionScreen,R.positionScreen),Ha(F.positionScreen,K.positionScreen),Ha(F.positionScreen,X.positionScreen)),sa.addPoint(R.positionScreen.x,
- R.positionScreen.y),sa.addPoint(N.positionScreen.x,N.positionScreen.y),sa.addPoint(F.positionScreen.x,F.positionScreen.y),sa.addPoint(W.positionScreen.x,W.positionScreen.y),ua.instersects(sa))){B=0;for(Ia=M.meshMaterials.length;B<Ia;)if(va=M.meshMaterials[B++],va instanceof THREE.MeshFaceMaterial){Qa=0;for(Wa=M.faceMaterials.length;Qa<Wa;)(va=M.faceMaterials[Qa++])&&va.opacity!=0&&y(R,N,F,W,K,X,M,va,b)}else va.opacity!=0&&y(R,N,F,W,K,X,M,va,b)}ta.addRectangle(sa)}x.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function b(b,e,c){var f,g,h,k;f=0;for(g=b.lights.length;f<g;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(h.position)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k)):h instanceof THREE.PointLight&&(W.sub(h.position,e.centroidWorld),W.normalize(),k=e.normalWorld.dot(W)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k))}function c(e,c,k,m,n,u){j.data.vertices+=3;j.data.faces++;Q=f(U++);Q.setAttribute("d",
- "M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?I.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?E?(J.r=S.r,J.g=S.g,J.b=S.b,b(u,m,J),I.r=Math.max(0,Math.min(n.color.r*J.r,1)),I.g=Math.max(0,Math.min(n.color.g*J.g,1)),I.b=Math.max(0,Math.min(n.color.b*J.b,1)),I.updateHex()):I.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(F=1-n.__2near/(n.__farPlusNear-
- m.z*n.__farMinusNear),I.setRGB(F,F,F)):n instanceof THREE.MeshNormalMaterial&&I.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: #"+h(I.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: #"+h(I.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(Q)}function e(e,c,k,m,
- n,u,o){j.data.vertices+=4;j.data.faces++;Q=f(U++);Q.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?I.hex=u.color.hex:u instanceof THREE.MeshLambertMaterial?E?(J.r=S.r,J.g=S.g,J.b=S.b,b(o,n,J),I.r=Math.max(0,Math.min(u.color.r*J.r,1)),I.g=Math.max(0,Math.min(u.color.g*J.g,1)),I.b=Math.max(0,Math.min(u.color.b*
- J.b,1)),I.updateHex()):I.hex=u.color.hex:u instanceof THREE.MeshDepthMaterial?(F=1-u.__2near/(u.__farPlusNear-n.z*u.__farMinusNear),I.setRGB(F,F,F)):u instanceof THREE.MeshNormalMaterial&&I.setRGB(g(n.normalWorld.x),g(n.normalWorld.y),g(n.normalWorld.z));u.wireframe?Q.setAttribute("style","fill: none; stroke: #"+h(I.hex.toString(16))+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):Q.setAttribute("style",
- "fill: #"+h(I.hex.toString(16))+"; fill-opacity: "+u.opacity);p.appendChild(Q)}function f(b){K[b]==null&&(K[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),ia==0&&K[b].setAttribute("shape-rendering","crispEdges"));return K[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function h(b){for(;b.length<6;)b="0"+b;return b}var j=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,u,v,w,x,y,D,A,H=new THREE.Rectangle,C=new THREE.Rectangle,
- E=!1,I=new THREE.Color(16777215),J=new THREE.Color(16777215),S=new THREE.Color(0),R=new THREE.Color(0),N=new THREE.Color(0),F,W=new THREE.Vector3,K=[],X=[],Q,U,k,ia=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":ia=1;break;case "low":ia=0}};this.setSize=function(b,e){o=b;u=e;v=o/2;w=u/2;p.setAttribute("viewBox",-v+" "+-w+" "+o+" "+u);p.setAttribute("width",o);p.setAttribute("height",u);H.set(-v,
- -w,v,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,f){var g,u,o,I,J,F,T,K;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;m=n.projectScene(b,f,this.sortElements);k=U=0;if(E=b.lights.length>0){T=b.lights;S.setRGB(0,0,0);R.setRGB(0,0,0);N.setRGB(0,0,0);g=0;for(u=T.length;g<u;g++)o=T[g],I=o.color,o instanceof THREE.AmbientLight?(S.r+=I.r,S.g+=I.g,S.b+=I.b):o instanceof THREE.DirectionalLight?(R.r+=I.r,R.g+=I.g,R.b+=I.b):o instanceof
- THREE.PointLight&&(N.r+=I.r,N.g+=I.g,N.b+=I.b)}g=0;for(u=m.length;g<u;g++)if(T=m[g],C.empty(),T instanceof THREE.RenderableParticle){x=T;x.x*=v;x.y*=-w;o=0;for(I=T.materials.length;o<I;)o++}else if(T instanceof THREE.RenderableLine){if(x=T.v1,y=T.v2,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),H.instersects(C)){o=0;for(I=T.materials.length;o<I;)if((K=T.materials[o++])&&
- K.opacity!=0){J=x;F=y;var W=k++;X[W]==null&&(X[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),ia==0&&X[W].setAttribute("shape-rendering","crispEdges"));Q=X[W];Q.setAttribute("x1",J.positionScreen.x);Q.setAttribute("y1",J.positionScreen.y);Q.setAttribute("x2",F.positionScreen.x);Q.setAttribute("y2",F.positionScreen.y);K instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: ##"+h(K.color.hex.toString(16))+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+
- K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin),p.appendChild(Q))}}}else if(T instanceof THREE.RenderableFace3){if(x=T.v1,y=T.v2,D=T.v3,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,D.positionScreen.x*=v,D.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(D.positionScreen.x,D.positionScreen.y),H.instersects(C)){o=0;for(I=T.meshMaterials.length;o<
- I;)if(K=T.meshMaterials[o++],K instanceof THREE.MeshFaceMaterial){J=0;for(F=T.faceMaterials.length;J<F;)(K=T.faceMaterials[J++])&&K.opacity!=0&&c(x,y,D,T,K,b)}else K&&K.opacity!=0&&c(x,y,D,T,K,b)}}else if(T instanceof THREE.RenderableFace4&&(x=T.v1,y=T.v2,D=T.v3,A=T.v4,x.positionScreen.x*=v,x.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,D.positionScreen.x*=v,D.positionScreen.y*=-w,A.positionScreen.x*=v,A.positionScreen.y*=-w,C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(y.positionScreen.x,
- y.positionScreen.y),C.addPoint(D.positionScreen.x,D.positionScreen.y),C.addPoint(A.positionScreen.x,A.positionScreen.y),H.instersects(C))){o=0;for(I=T.meshMaterials.length;o<I;)if(K=T.meshMaterials[o++],K instanceof THREE.MeshFaceMaterial){J=0;for(F=T.faceMaterials.length;J<F;)(K=T.faceMaterials[J++])&&K.opacity!=0&&e(x,y,D,A,T,K,b)}else K&&K.opacity!=0&&e(x,y,D,A,T,K,b)}}};
- 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_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
- lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
- lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}",
- lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\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.UniformsUtils={merge:function(b){var c,e,f,g={};for(c=0;c<b.length;c++)for(e in f=this.clone(b[c]),f)g[e]=f[e];return g},clone:function(b){var c,e,f,g={};for(c in b)for(e in g[c]={},b[c])f=b[c][e],g[c][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f;return g}};
- THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},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},morphTargetInfluences:{type:"f",value:0}},fog:{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)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
- value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
- THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 UV;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
- lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 UV;\nvarying vec2 vUV;\nvoid main() {\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
- sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
- fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}"},shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main() {\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform \tfloat \tdarkness;\nvoid main() {\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.0 );\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.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog]),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:THREE.UniformsUtils.merge([THREE.UniformsLib.common,
- THREE.UniformsLib.fog,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:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,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(b){function c(b,e,c){var f,g,h,j=b.vertices,m=j.length,n=b.colors,u=n.length,p=b.__vertexArray,o=b.__colorArray,v=b.__sortArray,w=b.__dirtyVertices,x=b.__dirtyColors,A=b.__webglCustomAttributes,D,y;if(A)for(D in A)A[D].offset=0;if(c.sortParticles){pa.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)g=j[f].position,ya.copy(g),pa.multiplyVector3(ya),v[f]=[ya.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)g=j[v[f][1]].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;
- for(f=0;f<u;f++)h=f*3,color=n[v[f][1]],o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(A)for(D in A){f=A[D];n=f.value.length;for(h=0;h<n;h++){index=v[h][1];u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[index];f.size===2?(f.array[u]=y.x,f.array[u+1]=y.y):f.size===3?f.type==="c"?(f.array[u]=y.r,f.array[u+1]=y.g,f.array[u+2]=y.b):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z):(f.array[u]=
- y.x,f.array[u+1]=y.y,f.array[u+2]=y.z,f.array[u+3]=y.w)}f.offset+=f.size}}}else{if(w)for(f=0;f<m;f++)g=j[f].position,h=f*3,p[h]=g.x,p[h+1]=g.y,p[h+2]=g.z;if(x)for(f=0;f<u;f++)color=n[f],h=f*3,o[h]=color.r,o[h+1]=color.g,o[h+2]=color.b;if(A)for(D in A)if(f=A[D],f.__original.needsUpdate){n=f.value.length;for(h=0;h<n;h++){u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")y=f.value[h];f.size===2?(f.array[u]=
- y.x,f.array[u+1]=y.y):f.size===3?f.type==="c"?(f.array[u]=y.r,f.array[u+1]=y.g,f.array[u+2]=y.b):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z):(f.array[u]=y.x,f.array[u+1]=y.y,f.array[u+2]=y.z,f.array[u+3]=y.w)}f.offset+=f.size}}}if(w||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,p,e);if(x||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,o,e);if(A)for(D in A)if(f=A[D],f.__original.needsUpdate||c.sortParticles)k.bindBuffer(k.ARRAY_BUFFER,
- f.buffer),k.bufferData(k.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,g){f.program||U.initMaterial(f,e,c,g);var h=f.program,j=h.uniforms,m=f.uniforms;h!=L&&(k.useProgram(h),L=h);k.uniformMatrix4fv(j.projectionMatrix,!1,na);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,
- m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var u,n,p=0,o=0,v=0,w,x,A,y,D=Ca,C=D.directional.colors,I=D.directional.positions,H=D.point.colors,J=D.point.positions,E=D.point.distances,Y=0,G=0,c=n=y=0;for(u=e.length;c<u;c++)if(n=e[c],w=n.color,x=n.position,A=n.intensity,y=n.distance,n instanceof THREE.AmbientLight)p+=w.r,o+=w.g,v+=w.b;else if(n instanceof THREE.DirectionalLight)y=
- Y*3,C[y]=w.r*A,C[y+1]=w.g*A,C[y+2]=w.b*A,I[y]=x.x,I[y+1]=x.y,I[y+2]=x.z,Y+=1;else if(n instanceof THREE.PointLight)n=G*3,H[n]=w.r*A,H[n+1]=w.g*A,H[n+2]=w.b*A,J[n]=x.x,J[n+1]=x.y,J[n+2]=x.z,E[G]=y,G+=1;for(c=Y*3;c<C.length;c++)C[c]=0;for(c=G*3;c<H.length;c++)H[c]=0;D.point.length=G;D.directional.length=Y;D.ambient[0]=p;D.ambient[1]=o;D.ambient[2]=v;c=Ca;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;
- m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=
- f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=xa.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=
- f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;for(var M in m)if(o=h.uniforms[M])if(u=m[M],p=u.type,c=u.value,p=="i")k.uniform1i(o,c);else if(p=="f")k.uniform1f(o,c);else if(p=="fv1")k.uniform1fv(o,c);else if(p=="fv")k.uniform3fv(o,c);else if(p=="v2")k.uniform2f(o,c.x,c.y);else if(p=="v3")k.uniform3f(o,
- c.x,c.y,c.z);else if(p=="v4")k.uniform4f(o,c.x,c.y,c.z,c.w);else if(p=="c")k.uniform3f(o,c.r,c.g,c.b);else if(p=="t"&&(k.uniform1i(o,c),u=u.texture))if(u.image instanceof Array&&u.image.length==6){if(u.image.length==6){if(u.needsUpdate){if(u.__webglInit){k.bindTexture(k.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(p=0;p<6;++p)k.texSubImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,0,0,k.RGBA,k.UNSIGNED_BYTE,u.image[p])}else{u.image.__webglTextureCube=k.createTexture();k.bindTexture(k.TEXTURE_CUBE_MAP,
- u.image.__webglTextureCube);for(p=0;p<6;++p)k.texImage2D(k.TEXTURE_CUBE_MAP_POSITIVE_X+p,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,u.image[p]);u.__webglInit=!0}N(k.TEXTURE_CUBE_MAP,u,u.image[0]);k.bindTexture(k.TEXTURE_CUBE_MAP,null);u.needsUpdate=!1}k.activeTexture(k.TEXTURE0+c);k.bindTexture(k.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}}else F(u,c);k.uniformMatrix4fv(j.modelViewMatrix,!1,g._modelViewMatrixArray);k.uniformMatrix3fv(j.normalMatrix,!1,g._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
- f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&k.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning)&&j.objectMatrix!==null&&k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&k.uniformMatrix4fv(j.viewMatrix,!1,qa);if(f instanceof THREE.ShadowVolumeDynamicMaterial)b=
- m.directionalLightDirection.value,b[0]=-e[1].position.x,b[1]=-e[1].position.y,b[2]=-e[1].position.z,k.uniform3fv(j.directionalLightDirection,b),k.uniformMatrix4fv(j.objectMatrix,!1,g._objectMatrixArray),k.uniformMatrix4fv(j.viewMatrix,!1,qa);f.skinning&&(k.uniformMatrix4fv(j.cameraInverseMatrix,!1,qa),k.uniformMatrix4fv(j.boneGlobalMatrices,!1,g.boneMatrices));return h}function f(b,c,f,g,h,j){if(g.opacity!=0){var m,b=e(b,c,f,g,j).attributes;if(!g.morphTargets&&b.position>=0)k.bindBuffer(k.ARRAY_BUFFER,
- h.__webglVertexBuffer),k.vertexAttribPointer(b.position,3,k.FLOAT,!1,0,0);else{c=g.program.attributes;j.morphTargetBase!==-1?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0)):c.position>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglVertexBuffer),k.vertexAttribPointer(c.position,3,k.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,u=j.morphTargetForcedOrder,n=j.morphTargetInfluences;f<g.numSupportedMorphTargets&&
- f<u.length;)k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[u[f]]),k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=n[u[f]],f++;else{var u=[],p=-1,o=0,n=j.morphTargetInfluences,v,w=n.length,f=0;for(j.morphTargetBase!==-1&&(u[j.morphTargetBase]=!0);f<g.numSupportedMorphTargets;){for(v=0;v<w;v++)!u[v]&&n[v]>p&&(o=v,p=n[o]);k.bindBuffer(k.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o]);k.vertexAttribPointer(c["morphTarget"+f],3,k.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=
- p;u[o]=1;p=-1;f++}}g.program.uniforms.morphTargetInfluences!==null&&k.uniform1fv(g.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],k.bindBuffer(k.ARRAY_BUFFER,c.buffer),k.vertexAttribPointer(b[m],c.size,k.FLOAT,!1,0,0));b.color>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglColorBuffer),k.vertexAttribPointer(b.color,3,k.FLOAT,!1,0,0));b.normal>=0&&(k.bindBuffer(k.ARRAY_BUFFER,
- h.__webglNormalBuffer),k.vertexAttribPointer(b.normal,3,k.FLOAT,!1,0,0));b.tangent>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglTangentBuffer),k.vertexAttribPointer(b.tangent,4,k.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUVBuffer),k.vertexAttribPointer(b.uv,2,k.FLOAT,!1,0,0),k.enableVertexAttribArray(b.uv)):k.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(k.bindBuffer(k.ARRAY_BUFFER,h.__webglUV2Buffer),k.vertexAttribPointer(b.uv2,2,k.FLOAT,!1,0,
- 0),k.enableVertexAttribArray(b.uv2)):k.disableVertexAttribArray(b.uv2));g.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexABuffer),k.vertexAttribPointer(b.skinVertexA,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),k.vertexAttribPointer(b.skinVertexB,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),k.vertexAttribPointer(b.skinIndex,4,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,
- h.__webglSkinWeightsBuffer),k.vertexAttribPointer(b.skinWeight,4,k.FLOAT,!1,0,0));j instanceof THREE.Mesh?(g.wireframe?(k.lineWidth(g.wireframeLinewidth),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),k.drawElements(k.LINES,h.__webglLineCount,k.UNSIGNED_SHORT,0)):(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),k.drawElements(k.TRIANGLES,h.__webglFaceCount,k.UNSIGNED_SHORT,0)),U.data.vertices+=h.__webglFaceCount,U.data.faces+=h.__webglFaceCount/3,U.data.drawCalls++):j instanceof
- THREE.Line?(j=j.type==THREE.LineStrip?k.LINE_STRIP:k.LINES,k.lineWidth(g.linewidth),k.drawArrays(j,0,h.__webglLineCount),U.data.drawCalls++):j instanceof THREE.ParticleSystem?(k.drawArrays(k.POINTS,0,h.__webglParticleCount),U.data.drawCalls++):j instanceof THREE.Ribbon&&(k.drawArrays(k.TRIANGLE_STRIP,0,h.__webglVertexCount),U.data.drawCalls++)}}function g(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=k.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=k.createBuffer();b.hasPos&&
- (k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,b.positionArray,k.DYNAMIC_DRAW),k.enableVertexAttribArray(e.attributes.position),k.vertexAttribPointer(e.attributes.position,3,k.FLOAT,!1,0,0));if(b.hasNormal){k.bindBuffer(k.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,g,j,m,u,n,p,o,v,w=b.count*3;for(v=0;v<w;v+=9)c=b.normalArray,f=c[v],h=c[v+1],g=c[v+2],j=c[v+3],u=c[v+4],p=c[v+5],m=c[v+6],n=c[v+7],o=c[v+8],f=(f+j+m)/3,h=(h+u+n)/3,g=(g+p+o)/3,c[v]=
- f,c[v+1]=h,c[v+2]=g,c[v+3]=f,c[v+4]=h,c[v+5]=g,c[v+6]=f,c[v+7]=h,c[v+8]=g}k.bufferData(k.ARRAY_BUFFER,b.normalArray,k.DYNAMIC_DRAW);k.enableVertexAttribArray(e.attributes.normal);k.vertexAttribPointer(e.attributes.normal,3,k.FLOAT,!1,0,0)}k.drawArrays(k.TRIANGLES,0,b.count);b.count=0}function h(b){if($!=b.doubleSided)b.doubleSided?k.disable(k.CULL_FACE):k.enable(k.CULL_FACE),$=b.doubleSided;if(ha!=b.flipSided)b.flipSided?k.frontFace(k.CW):k.frontFace(k.CCW),ha=b.flipSided}function j(b){ma!=b&&(b?
- k.enable(k.DEPTH_TEST):k.disable(k.DEPTH_TEST),ma=b)}function m(b,e,c){ra!=b&&(b?k.enable(k.POLYGON_OFFSET_FILL):k.disable(k.POLYGON_OFFSET_FILL),ra=b);if(b&&(T!=e||ka!=c))k.polygonOffset(e,c),T=e,ka=c}function n(b){Z[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Z[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);Z[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Z[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Z[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);
- Z[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=Z[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function p(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=Z[f].x*e.n14+Z[f].y*e.n24+Z[f].z*e.n34+Z[f].w,b<=c)return!1;return!0}function o(b,e){b.list[b.count]=e;b.count+=1}function u(b){var e,c,f=b.object,h=b.opaque,g=b.transparent;g.count=0;b=h.count=0;for(e=f.materials.length;b<
- e;b++)c=f.materials[b],c.transparent?o(g,c):o(h,c)}function v(b){var e,c,f,h,g=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=g.materials.length;b<f;b++)if(e=g.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=j.materials.length;e<c;e++)(h=j.materials[e])&&(h.transparent?o(m,h):o(k,h))}else(h=e)&&(h.transparent?o(m,h):o(k,h))}function w(b,e){return e.z-b.z}function x(b){k.enable(k.POLYGON_OFFSET_FILL);k.polygonOffset(0.1,1);k.enable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);
- k.depthMask(!1);k.colorMask(!1,!1,!1,!1);k.stencilFunc(k.ALWAYS,1,255);k.stencilOpSeparate(k.BACK,k.KEEP,k.INCR,k.KEEP);k.stencilOpSeparate(k.FRONT,k.KEEP,k.DECR,k.KEEP);var e,c=b.lights.length,f,h=b.lights,g=[],j,m,u,n,p,o=b.__webglShadowVolumes.length;for(e=0;e<c;e++)if(f=b.lights[e],f instanceof THREE.DirectionalLight&&f.castShadow){g[0]=-f.position.x;g[1]=-f.position.y;g[2]=-f.position.z;for(p=0;p<o;p++)f=b.__webglShadowVolumes[p].object,j=b.__webglShadowVolumes[p].buffer,m=f.materials[0],m.program||
- U.initMaterial(m,h,void 0,f),m=m.program,u=m.uniforms,n=m.attributes,L!==m&&(k.useProgram(m),L=m,k.uniformMatrix4fv(u.projectionMatrix,!1,na),k.uniformMatrix4fv(u.viewMatrix,!1,qa),k.uniform3fv(u.directionalLightDirection,g)),f.matrixWorld.flattenToArray(f._objectMatrixArray),k.uniformMatrix4fv(u.objectMatrix,!1,f._objectMatrixArray),k.bindBuffer(k.ARRAY_BUFFER,j.__webglVertexBuffer),k.vertexAttribPointer(n.position,3,k.FLOAT,!1,0,0),k.bindBuffer(k.ARRAY_BUFFER,j.__webglNormalBuffer),k.vertexAttribPointer(n.normal,
- 3,k.FLOAT,!1,0,0),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),k.cullFace(k.FRONT),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0),k.cullFace(k.BACK),k.drawElements(k.TRIANGLES,j.__webglFaceCount,k.UNSIGNED_SHORT,0)}k.disable(k.POLYGON_OFFSET_FILL);k.colorMask(!0,!0,!0,!0);k.stencilFunc(k.NOTEQUAL,0,255);k.stencilOp(k.KEEP,k.KEEP,k.KEEP);k.disable(k.DEPTH_TEST);ma=ja=-1;L=ea.program;k.useProgram(ea.program);k.uniformMatrix4fv(ea.projectionLocation,!1,na);k.uniform1f(ea.darknessLocation,
- ea.darkness);k.bindBuffer(k.ARRAY_BUFFER,ea.vertexBuffer);k.vertexAttribPointer(ea.vertexLocation,3,k.FLOAT,!1,0,0);k.enableVertexAttribArray(ea.vertexLocation);k.blendFunc(k.ONE,k.ONE_MINUS_SRC_ALPHA);k.blendEquation(k.FUNC_ADD);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.disable(k.STENCIL_TEST);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function y(b,e){var c,f,h;c=V.attributes;var g=V.uniforms,j=Y/da,m,u=[],n=da*0.5,p=Y*0.5,o=!0;k.useProgram(V.program);
- L=V.program;ma=ja=-1;la||(k.enableVertexAttribArray(V.attributes.position),k.enableVertexAttribArray(V.attributes.uv),la=!0);k.disable(k.CULL_FACE);k.enable(k.BLEND);k.depthMask(!0);k.bindBuffer(k.ARRAY_BUFFER,V.vertexBuffer);k.vertexAttribPointer(c.position,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,V.elementBuffer);k.uniformMatrix4fv(g.projectionMatrix,!1,na);k.activeTexture(k.TEXTURE0);k.uniform1i(g.map,0);c=0;for(f=b.__webglSprites.length;c<
- f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(w);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(k.uniform1i(g.useScreenCoordinates,1),k.uniform3f(g.screenPosition,(h.position.x-n)/n,(p-h.position.y)/p,Math.max(0,Math.min(1,h.position.z)))):
- (k.uniform1i(g.useScreenCoordinates,0),k.uniform1i(g.affectedByDistance,h.affectedByDistance?1:0),k.uniformMatrix4fv(g.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Y:1),u[0]=m*j*h.scale.x,u[1]=m*h.scale.y,k.uniform2f(g.uvScale,h.uvScale.x,h.uvScale.y),k.uniform2f(g.uvOffset,h.uvOffset.x,h.uvOffset.y),k.uniform2f(g.alignment,h.alignment.x,h.alignment.y),k.uniform1f(g.opacity,h.opacity),k.uniform1f(g.rotation,h.rotation),k.uniform2fv(g.scale,u),h.mergeWith3D&&
- !o?(k.enable(k.DEPTH_TEST),o=!0):!h.mergeWith3D&&o&&(k.disable(k.DEPTH_TEST),o=!1),R(h.blending),F(h.map,0),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0));k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function D(b,e){var c,f,h=b.__webglLensFlares.length,g,j,m,u=new THREE.Vector3,n=Y/da,p=da*0.5,o=Y*0.5,v=16/Y,w=[v*n,v],x=[1,1,0],A=[1,1],y=O.uniforms;c=O.attributes;k.useProgram(O.program);L=O.program;ma=ja=-1;wa||(k.enableVertexAttribArray(O.attributes.vertex),k.enableVertexAttribArray(O.attributes.uv),
- wa=!0);k.uniform1i(y.occlusionMap,0);k.uniform1i(y.map,1);k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.vertexAttribPointer(c.vertex,2,k.FLOAT,!1,16,0);k.vertexAttribPointer(c.uv,2,k.FLOAT,!1,16,8);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.disable(k.CULL_FACE);k.depthMask(!1);k.activeTexture(k.TEXTURE0);k.bindTexture(k.TEXTURE_2D,O.occlusionTexture);k.activeTexture(k.TEXTURE1);for(f=0;f<h;f++)if(c=b.__webglLensFlares[f].object,u.set(c.matrixWorld.n14,c.matrixWorld.n24,c.matrixWorld.n34),
- e.matrixWorldInverse.multiplyVector3(u),e.projectionMatrix.multiplyVector3(u),x[0]=u.x,x[1]=u.y,x[2]=u.z,A[0]=x[0]*p+p,A[1]=x[1]*o+o,O.hasVertexTexture||A[0]>0&&A[0]<da&&A[1]>0&&A[1]<Y){k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.copyTexImage2D(k.TEXTURE_2D,0,k.RGB,A[0]-8,A[1]-8,16,16,0);k.uniform1i(y.renderType,0);k.uniform2fv(y.scale,w);k.uniform3fv(y.screenPosition,x);k.disable(k.BLEND);k.enable(k.DEPTH_TEST);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);k.bindTexture(k.TEXTURE_2D,O.occlusionTexture);
- k.copyTexImage2D(k.TEXTURE_2D,0,k.RGBA,A[0]-8,A[1]-8,16,16,0);k.uniform1i(y.renderType,1);k.disable(k.DEPTH_TEST);k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0);c.positionScreen.x=x[0];c.positionScreen.y=x[1];c.positionScreen.z=x[2];c.customUpdateCallback?c.customUpdateCallback(c):c.updateLensFlares();k.uniform1i(y.renderType,2);k.enable(k.BLEND);g=0;for(j=c.lensFlares.length;g<j;g++)if(m=c.lensFlares[g],m.opacity>0.0010&&m.scale>0.0010)x[0]=m.x,x[1]=m.y,
- x[2]=m.z,v=m.size*m.scale/Y,w[0]=v*n,w[1]=v,k.uniform3fv(y.screenPosition,x),k.uniform2fv(y.scale,w),k.uniform1f(y.rotation,m.rotation),k.uniform1f(y.opacity,m.opacity),R(m.blending),F(m.texture,1),k.drawElements(k.TRIANGLES,6,k.UNSIGNED_SHORT,0)}k.enable(k.CULL_FACE);k.enable(k.DEPTH_TEST);k.depthMask(fa)}function A(b,e){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
- function H(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function C(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function E(b){var e,f,h,g;if(b instanceof THREE.Mesh){f=b.geometry;for(e in f.geometryGroups)if(h=f.geometryGroups[e],g=H(h),f.__dirtyVertices||f.__dirtyMorphTargets||f.__dirtyElements||f.__dirtyUvs||
- f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||g){g=h;var j=b,m=k.DYNAMIC_DRAW;if(g.__inittedArrays){var u=void 0,n=void 0,p=void 0,o=void 0,v=p=void 0,w=void 0,x=void 0,A=void 0,y=void 0,D=void 0,I=void 0,J=void 0,Y=void 0,E=void 0,F=void 0,Z=void 0,N=void 0,G=o=A=o=x=w=void 0,M=void 0,B=M=G=w=void 0,K=void 0,R=B=M=G=p=p=v=A=o=B=M=G=K=B=M=G=K=B=M=G=void 0,L=0,O=0,T=0,W=0,pa=0,S=0,Q=0,V=0,na=0,P=0,U=0,M=G=0,$=g.__vertexArray,ea=g.__uvArray,ia=g.__uv2Array,ga=g.__normalArray,X=g.__tangentArray,
- fa=g.__colorArray,qa=g.__skinVertexAArray,ha=g.__skinVertexBArray,ca=g.__skinIndexArray,da=g.__skinWeightArray,oa=g.__morphTargetsArrays,ka=g.__webglCustomAttributes,B=void 0,ja=g.__faceArray,ma=g.__lineArray,ra=g.__needsSmoothNormals,D=g.__vertexColorType,y=g.__uvType,I=g.__normalType,la=j.geometry,ya=la.__dirtyVertices,ta=la.__dirtyElements,sa=la.__dirtyUvs,ua=la.__dirtyNormals,Ca=la.__dirtyTangents,xa=la.__dirtyColors,Aa=la.__dirtyMorphTargets,wa=la.vertices,Da=g.faces,Oa=la.faces,Ya=la.faceVertexUvs[0],
- Za=la.faceVertexUvs[1],La=la.skinVerticesA,Ma=la.skinVerticesB,Na=la.skinIndices,Fa=la.skinWeights,Ja=j instanceof THREE.ShadowVolume?la.edgeFaces:void 0,Ba=la.morphTargets;if(ka)for(R in ka)ka[R].offset=0,ka[R].offsetSrc=0;u=0;for(n=Da.length;u<n;u++)if(p=Da[u],o=Oa[p],Ya&&(J=Ya[p]),Za&&(Y=Za[p]),p=o.vertexNormals,v=o.normal,w=o.vertexColors,x=o.color,A=o.vertexTangents,o instanceof THREE.Face3){if(ya)E=wa[o.a].position,F=wa[o.b].position,Z=wa[o.c].position,$[O]=E.x,$[O+1]=E.y,$[O+2]=E.z,$[O+3]=
- F.x,$[O+4]=F.y,$[O+5]=F.z,$[O+6]=Z.x,$[O+7]=Z.y,$[O+8]=Z.z,O+=9;if(ka)for(R in ka)if(B=ka[R],B.__original.needsUpdate)G=B.offset,M=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[G+0]=B.value[o.a],B.array[G+1]=B.value[o.b],B.array[G+2]=B.value[o.c]):B.boundTo==="faces"?(B.array[G+0]=B.value[M],B.array[G+1]=B.value[M],B.array[G+2]=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[G+0]=B.value[M+0],B.array[G+1]=B.value[M+1],B.array[G+2]=B.value[M+2],B.offsetSrc+=
- 3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?(E=B.value[o.a],F=B.value[o.b],Z=B.value[o.c]):B.boundTo==="faces"?(E=B.value[M],F=B.value[M],Z=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(E=B.value[M+0],F=B.value[M+1],Z=B.value[M+2],B.offsetSrc+=3),B.size===2?(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=F.x,B.array[G+3]=F.y,B.array[G+4]=Z.x,B.array[G+5]=Z.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[G+0]=E.r,B.array[G+1]=E.g,B.array[G+2]=E.b,B.array[G+3]=F.r,B.array[G+
- 4]=F.g,B.array[G+5]=F.b,B.array[G+6]=Z.r,B.array[G+7]=Z.g,B.array[G+8]=Z.b):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=F.x,B.array[G+4]=F.y,B.array[G+5]=F.z,B.array[G+6]=Z.x,B.array[G+7]=Z.y,B.array[G+8]=Z.z),B.offset+=9):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=E.w,B.array[G+4]=F.x,B.array[G+5]=F.y,B.array[G+6]=F.z,B.array[G+7]=F.w,B.array[G+8]=Z.x,B.array[G+9]=Z.y,B.array[G+10]=Z.z,B.array[G+11]=Z.w,B.offset+=12));if(Aa){G=0;for(M=Ba.length;G<M;G++)E=
- Ba[G].vertices[o.a].position,F=Ba[G].vertices[o.b].position,Z=Ba[G].vertices[o.c].position,B=oa[G],B[U+0]=E.x,B[U+1]=E.y,B[U+2]=E.z,B[U+3]=F.x,B[U+4]=F.y,B[U+5]=F.z,B[U+6]=Z.x,B[U+7]=Z.y,B[U+8]=Z.z;U+=9}if(Fa.length)G=Fa[o.a],M=Fa[o.b],B=Fa[o.c],da[P]=G.x,da[P+1]=G.y,da[P+2]=G.z,da[P+3]=G.w,da[P+4]=M.x,da[P+5]=M.y,da[P+6]=M.z,da[P+7]=M.w,da[P+8]=B.x,da[P+9]=B.y,da[P+10]=B.z,da[P+11]=B.w,G=Na[o.a],M=Na[o.b],B=Na[o.c],ca[P]=G.x,ca[P+1]=G.y,ca[P+2]=G.z,ca[P+3]=G.w,ca[P+4]=M.x,ca[P+5]=M.y,ca[P+6]=M.z,
- ca[P+7]=M.w,ca[P+8]=B.x,ca[P+9]=B.y,ca[P+10]=B.z,ca[P+11]=B.w,G=La[o.a],M=La[o.b],B=La[o.c],qa[P]=G.x,qa[P+1]=G.y,qa[P+2]=G.z,qa[P+3]=1,qa[P+4]=M.x,qa[P+5]=M.y,qa[P+6]=M.z,qa[P+7]=1,qa[P+8]=B.x,qa[P+9]=B.y,qa[P+10]=B.z,qa[P+11]=1,G=Ma[o.a],M=Ma[o.b],B=Ma[o.c],ha[P]=G.x,ha[P+1]=G.y,ha[P+2]=G.z,ha[P+3]=1,ha[P+4]=M.x,ha[P+5]=M.y,ha[P+6]=M.z,ha[P+7]=1,ha[P+8]=B.x,ha[P+9]=B.y,ha[P+10]=B.z,ha[P+11]=1,P+=12;if(xa&&D)w.length==3&&D==THREE.VertexColors?(o=w[0],G=w[1],M=w[2]):M=G=o=x,fa[na]=o.r,fa[na+1]=o.g,
- fa[na+2]=o.b,fa[na+3]=G.r,fa[na+4]=G.g,fa[na+5]=G.b,fa[na+6]=M.r,fa[na+7]=M.g,fa[na+8]=M.b,na+=9;if(Ca&&la.hasTangents)w=A[0],x=A[1],o=A[2],X[Q]=w.x,X[Q+1]=w.y,X[Q+2]=w.z,X[Q+3]=w.w,X[Q+4]=x.x,X[Q+5]=x.y,X[Q+6]=x.z,X[Q+7]=x.w,X[Q+8]=o.x,X[Q+9]=o.y,X[Q+10]=o.z,X[Q+11]=o.w,Q+=12;if(ua&&I)if(p.length==3&&ra)for(A=0;A<3;A++)v=p[A],ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;else for(A=0;A<3;A++)ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;if(sa&&J!==void 0&&y)for(A=0;A<3;A++)p=J[A],ea[T]=p.u,ea[T+1]=p.v,T+=2;if(sa&&
- Y!==void 0&&y)for(A=0;A<3;A++)p=Y[A],ia[W]=p.u,ia[W+1]=p.v,W+=2;ta&&(ja[pa]=L,ja[pa+1]=L+1,ja[pa+2]=L+2,pa+=3,ma[V]=L,ma[V+1]=L+1,ma[V+2]=L,ma[V+3]=L+2,ma[V+4]=L+1,ma[V+5]=L+2,V+=6,L+=3)}else if(o instanceof THREE.Face4){if(ya)E=wa[o.a].position,F=wa[o.b].position,Z=wa[o.c].position,N=wa[o.d].position,$[O]=E.x,$[O+1]=E.y,$[O+2]=E.z,$[O+3]=F.x,$[O+4]=F.y,$[O+5]=F.z,$[O+6]=Z.x,$[O+7]=Z.y,$[O+8]=Z.z,$[O+9]=N.x,$[O+10]=N.y,$[O+11]=N.z,O+=12;if(ka)for(R in ka)if(B=ka[R],B.__original.needsUpdate)G=B.offset,
- M=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[G+0]=B.value[o.a],B.array[G+1]=B.value[o.b],B.array[G+2]=B.value[o.c],B.array[G+3]=B.value[o.d]):B.boundTo==="faces"?(B.array[G+0]=B.value[M],B.array[G+1]=B.value[M],B.array[G+2]=B.value[M],B.array[G+3]=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[G+0]=B.value[M+0],B.array[G+1]=B.value[M+1],B.array[G+2]=B.value[M+2],B.array[G+3]=B.value[M+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo===
- "vertices"?(E=B.value[o.a],F=B.value[o.b],Z=B.value[o.c],N=B.value[o.d]):B.boundTo==="faces"?(E=B.value[M],F=B.value[M],Z=B.value[M],N=B.value[M],B.offsetSrc++):B.boundTo==="faceVertices"&&(E=B.value[M+0],F=B.value[M+1],Z=B.value[M+2],N=B.value[M+3],B.offsetSrc+=4),B.size===2?(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=F.x,B.array[G+3]=F.y,B.array[G+4]=Z.x,B.array[G+5]=Z.y,B.array[G+6]=N.x,B.array[G+7]=N.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[G+0]=E.r,B.array[G+1]=E.g,B.array[G+2]=E.b,
- B.array[G+3]=F.r,B.array[G+4]=F.g,B.array[G+5]=F.b,B.array[G+6]=Z.r,B.array[G+7]=Z.g,B.array[G+8]=Z.b,B.array[G+9]=N.r,B.array[G+10]=N.g,B.array[G+11]=N.b):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=F.x,B.array[G+4]=F.y,B.array[G+5]=F.z,B.array[G+6]=Z.x,B.array[G+7]=Z.y,B.array[G+8]=Z.z,B.array[G+9]=N.x,B.array[G+10]=N.y,B.array[G+11]=N.z),B.offset+=12):(B.array[G+0]=E.x,B.array[G+1]=E.y,B.array[G+2]=E.z,B.array[G+3]=E.w,B.array[G+4]=F.x,B.array[G+5]=F.y,B.array[G+6]=F.z,B.array[G+
- 7]=F.w,B.array[G+8]=Z.x,B.array[G+9]=Z.y,B.array[G+10]=Z.z,B.array[G+11]=Z.w,B.array[G+12]=N.x,B.array[G+13]=N.y,B.array[G+14]=N.z,B.array[G+15]=N.w,B.offset+=16));if(Aa){G=0;for(M=Ba.length;G<M;G++)E=Ba[G].vertices[o.a].position,F=Ba[G].vertices[o.b].position,Z=Ba[G].vertices[o.c].position,N=Ba[G].vertices[o.d].position,B=oa[G],B[U+0]=E.x,B[U+1]=E.y,B[U+2]=E.z,B[U+3]=F.x,B[U+4]=F.y,B[U+5]=F.z,B[U+6]=Z.x,B[U+7]=Z.y,B[U+8]=Z.z,B[U+9]=N.x,B[U+10]=N.y,B[U+11]=N.z;U+=12}if(Fa.length)G=Fa[o.a],M=Fa[o.b],
- B=Fa[o.c],K=Fa[o.d],da[P]=G.x,da[P+1]=G.y,da[P+2]=G.z,da[P+3]=G.w,da[P+4]=M.x,da[P+5]=M.y,da[P+6]=M.z,da[P+7]=M.w,da[P+8]=B.x,da[P+9]=B.y,da[P+10]=B.z,da[P+11]=B.w,da[P+12]=K.x,da[P+13]=K.y,da[P+14]=K.z,da[P+15]=K.w,G=Na[o.a],M=Na[o.b],B=Na[o.c],K=Na[o.d],ca[P]=G.x,ca[P+1]=G.y,ca[P+2]=G.z,ca[P+3]=G.w,ca[P+4]=M.x,ca[P+5]=M.y,ca[P+6]=M.z,ca[P+7]=M.w,ca[P+8]=B.x,ca[P+9]=B.y,ca[P+10]=B.z,ca[P+11]=B.w,ca[P+12]=K.x,ca[P+13]=K.y,ca[P+14]=K.z,ca[P+15]=K.w,G=La[o.a],M=La[o.b],B=La[o.c],K=La[o.d],qa[P]=G.x,
- qa[P+1]=G.y,qa[P+2]=G.z,qa[P+3]=1,qa[P+4]=M.x,qa[P+5]=M.y,qa[P+6]=M.z,qa[P+7]=1,qa[P+8]=B.x,qa[P+9]=B.y,qa[P+10]=B.z,qa[P+11]=1,qa[P+12]=K.x,qa[P+13]=K.y,qa[P+14]=K.z,qa[P+15]=1,G=Ma[o.a],M=Ma[o.b],B=Ma[o.c],o=Ma[o.d],ha[P]=G.x,ha[P+1]=G.y,ha[P+2]=G.z,ha[P+3]=1,ha[P+4]=M.x,ha[P+5]=M.y,ha[P+6]=M.z,ha[P+7]=1,ha[P+8]=B.x,ha[P+9]=B.y,ha[P+10]=B.z,ha[P+11]=1,ha[P+12]=o.x,ha[P+13]=o.y,ha[P+14]=o.z,ha[P+15]=1,P+=16;if(xa&&D)w.length==4&&D==THREE.VertexColors?(o=w[0],G=w[1],M=w[2],w=w[3]):w=M=G=o=x,fa[na]=
- o.r,fa[na+1]=o.g,fa[na+2]=o.b,fa[na+3]=G.r,fa[na+4]=G.g,fa[na+5]=G.b,fa[na+6]=M.r,fa[na+7]=M.g,fa[na+8]=M.b,fa[na+9]=w.r,fa[na+10]=w.g,fa[na+11]=w.b,na+=12;if(Ca&&la.hasTangents)w=A[0],x=A[1],o=A[2],A=A[3],X[Q]=w.x,X[Q+1]=w.y,X[Q+2]=w.z,X[Q+3]=w.w,X[Q+4]=x.x,X[Q+5]=x.y,X[Q+6]=x.z,X[Q+7]=x.w,X[Q+8]=o.x,X[Q+9]=o.y,X[Q+10]=o.z,X[Q+11]=o.w,X[Q+12]=A.x,X[Q+13]=A.y,X[Q+14]=A.z,X[Q+15]=A.w,Q+=16;if(ua&&I)if(p.length==4&&ra)for(A=0;A<4;A++)v=p[A],ga[S]=v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;else for(A=0;A<4;A++)ga[S]=
- v.x,ga[S+1]=v.y,ga[S+2]=v.z,S+=3;if(sa&&J!==void 0&&y)for(A=0;A<4;A++)p=J[A],ea[T]=p.u,ea[T+1]=p.v,T+=2;if(sa&&Y!==void 0&&y)for(A=0;A<4;A++)p=Y[A],ia[W]=p.u,ia[W+1]=p.v,W+=2;ta&&(ja[pa]=L,ja[pa+1]=L+1,ja[pa+2]=L+3,ja[pa+3]=L+1,ja[pa+4]=L+2,ja[pa+5]=L+3,pa+=6,ma[V]=L,ma[V+1]=L+1,ma[V+2]=L,ma[V+3]=L+3,ma[V+4]=L+1,ma[V+5]=L+2,ma[V+6]=L+2,ma[V+7]=L+3,V+=8,L+=4)}if(Ja){u=0;for(n=Ja.length;u<n;u++)ja[pa]=Ja[u].a,ja[pa+1]=Ja[u].b,ja[pa+2]=Ja[u].c,ja[pa+3]=Ja[u].a,ja[pa+4]=Ja[u].c,ja[pa+5]=Ja[u].d,pa+=6}ya&&
- (k.bindBuffer(k.ARRAY_BUFFER,g.__webglVertexBuffer),k.bufferData(k.ARRAY_BUFFER,$,m));if(ka)for(R in ka)B=ka[R],B.__original.needsUpdate&&(k.bindBuffer(k.ARRAY_BUFFER,B.buffer),k.bufferData(k.ARRAY_BUFFER,B.array,m));if(Aa){G=0;for(M=Ba.length;G<M;G++)k.bindBuffer(k.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[G]),k.bufferData(k.ARRAY_BUFFER,oa[G],m)}xa&&na>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglColorBuffer),k.bufferData(k.ARRAY_BUFFER,fa,m));ua&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglNormalBuffer),
- k.bufferData(k.ARRAY_BUFFER,ga,m));Ca&&la.hasTangents&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglTangentBuffer),k.bufferData(k.ARRAY_BUFFER,X,m));sa&&T>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUVBuffer),k.bufferData(k.ARRAY_BUFFER,ea,m));sa&&W>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglUV2Buffer),k.bufferData(k.ARRAY_BUFFER,ia,m));ta&&(k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,ja,m),k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),k.bufferData(k.ELEMENT_ARRAY_BUFFER,
- ma,m));P>0&&(k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexABuffer),k.bufferData(k.ARRAY_BUFFER,qa,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),k.bufferData(k.ARRAY_BUFFER,ha,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),k.bufferData(k.ARRAY_BUFFER,ca,m),k.bindBuffer(k.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),k.bufferData(k.ARRAY_BUFFER,da,m));j.dynamic||(delete g.__inittedArrays,delete g.__colorArray,delete g.__normalArray,delete g.__tangentArray,delete g.__uvArray,delete g.__uv2Array,
- delete g.__faceArray,delete g.__vertexArray,delete g.__lineArray,delete g.__skinVertexAArray,delete g.__skinVertexBArray,delete g.__skinIndexArray,delete g.__skinWeightArray)}}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyTangents=!1;f.__dirtyColors=!1;C(h)}else if(b instanceof THREE.Ribbon){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;y=b.vertices;g=b.colors;D=y.length;j=g.length;I=b.__vertexArray;m=b.__colorArray;
- J=b.__dirtyColors;if(b.__dirtyVertices){for(u=0;u<D;u++)n=y[u].position,h=u*3,I[h]=n.x,I[h+1]=n.y,I[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,I,e)}if(J){for(u=0;u<j;u++)color=g[u],h=u*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.Line){f=b.geometry;if(f.__dirtyVertices||f.__dirtyColors){b=f;e=k.DYNAMIC_DRAW;
- y=b.vertices;g=b.colors;D=y.length;j=g.length;I=b.__vertexArray;m=b.__colorArray;J=b.__dirtyColors;if(b.__dirtyVertices){for(u=0;u<D;u++)n=y[u].position,h=u*3,I[h]=n.x,I[h+1]=n.y,I[h+2]=n.z;k.bindBuffer(k.ARRAY_BUFFER,b.__webglVertexBuffer);k.bufferData(k.ARRAY_BUFFER,I,e)}if(J){for(u=0;u<j;u++)color=g[u],h=u*3,m[h]=color.r,m[h+1]=color.g,m[h+2]=color.b;k.bindBuffer(k.ARRAY_BUFFER,b.__webglColorBuffer);k.bufferData(k.ARRAY_BUFFER,m,e)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)f=
- b.geometry,g=H(f),(f.__dirtyVertices||f.__dirtyColors||b.sortParticles||g)&&c(f,k.DYNAMIC_DRAW,b),f.__dirtyVertices=!1,f.__dirtyColors=!1,C(f)}function I(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function J(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,g,j,k,m,u,o={},n=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(g=b.faces.length;h<g;h++)j=b.faces[h],k=j.materials,
- m=e(k),o[m]==void 0&&(o[m]={hash:m,counter:0}),u=o[m].hash+"_"+o[m].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],materials:k,vertices:0,numMorphTargets:n}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[u].vertices+j>65535&&(o[m].counter+=1,u=o[m].hash+"_"+o[m].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],materials:k,vertices:0,numMorphTargets:n})),b.geometryGroups[u].faces.push(h),b.geometryGroups[u].vertices+=j}function S(b,e,c){b.push({buffer:e,object:c,
- opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE);break;case THREE.SubtractiveBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:k.blendEquation(k.FUNC_ADD);k.blendFunc(k.ZERO,k.SRC_COLOR);break;default:k.blendEquationSeparate(k.FUNC_ADD,k.FUNC_ADD),k.blendFuncSeparate(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA,k.ONE,k.ONE_MINUS_SRC_ALPHA)}ja=
- b}}function N(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(k.texParameteri(b,k.TEXTURE_WRAP_S,Q(e.wrapS)),k.texParameteri(b,k.TEXTURE_WRAP_T,Q(e.wrapT)),k.texParameteri(b,k.TEXTURE_MAG_FILTER,Q(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,Q(e.minFilter)),k.generateMipmap(b)):(k.texParameteri(b,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE),k.texParameteri(b,k.TEXTURE_MAG_FILTER,X(e.magFilter)),k.texParameteri(b,k.TEXTURE_MIN_FILTER,X(e.minFilter)))}
- function F(b,e){if(b.needsUpdate)b.__webglInit?(k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image)):(b.__webglTexture=k.createTexture(),k.bindTexture(k.TEXTURE_2D,b.__webglTexture),k.texImage2D(k.TEXTURE_2D,0,k.RGBA,k.RGBA,k.UNSIGNED_BYTE,b.image),b.__webglInit=!0),N(k.TEXTURE_2D,b,b.image),k.bindTexture(k.TEXTURE_2D,null),b.needsUpdate=!1;k.activeTexture(k.TEXTURE0+e);k.bindTexture(k.TEXTURE_2D,b.__webglTexture)}function W(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===
- void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=k.createFramebuffer();b.__webglRenderbuffer=k.createRenderbuffer();b.__webglTexture=k.createTexture();k.bindTexture(k.TEXTURE_2D,b.__webglTexture);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,Q(b.wrapS));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,Q(b.wrapT));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,Q(b.magFilter));k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,Q(b.minFilter));k.texImage2D(k.TEXTURE_2D,
- 0,Q(b.format),b.width,b.height,0,Q(b.format),Q(b.type),null);k.bindRenderbuffer(k.RENDERBUFFER,b.__webglRenderbuffer);k.bindFramebuffer(k.FRAMEBUFFER,b.__webglFramebuffer);k.framebufferTexture2D(k.FRAMEBUFFER,k.COLOR_ATTACHMENT0,k.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,k.DEPTH_COMPONENT16,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(k.renderbufferStorage(k.RENDERBUFFER,
- k.DEPTH_STENCIL,b.width,b.height),k.framebufferRenderbuffer(k.FRAMEBUFFER,k.DEPTH_STENCIL_ATTACHMENT,k.RENDERBUFFER,b.__webglRenderbuffer)):k.renderbufferStorage(k.RENDERBUFFER,k.RGBA4,b.width,b.height);k.bindTexture(k.TEXTURE_2D,null);k.bindRenderbuffer(k.RENDERBUFFER,null);k.bindFramebuffer(k.FRAMEBUFFER,null)}var e,c;b?(e=b.__webglFramebuffer,c=b.width,b=b.height):(e=null,c=da,b=Y);e!=ga&&(k.bindFramebuffer(k.FRAMEBUFFER,e),k.viewport(ca,oa,c,b),ga=e)}function K(b,e){var c;b=="fragment"?c=k.createShader(k.FRAGMENT_SHADER):
- b=="vertex"&&(c=k.createShader(k.VERTEX_SHADER));k.shaderSource(c,e);k.compileShader(c);if(!k.getShaderParameter(c,k.COMPILE_STATUS))return console.error(k.getShaderInfoLog(c)),console.error(e),null;return c}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return k.NEAREST;default:return k.LINEAR}}function Q(b){switch(b){case THREE.RepeatWrapping:return k.REPEAT;case THREE.ClampToEdgeWrapping:return k.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return k.MIRRORED_REPEAT;
- case THREE.NearestFilter:return k.NEAREST;case THREE.NearestMipMapNearestFilter:return k.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return k.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return k.LINEAR;case THREE.LinearMipMapNearestFilter:return k.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return k.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return k.BYTE;case THREE.UnsignedByteType:return k.UNSIGNED_BYTE;case THREE.ShortType:return k.SHORT;case THREE.UnsignedShortType:return k.UNSIGNED_SHORT;
- case THREE.IntType:return k.INT;case THREE.UnsignedShortType:return k.UNSIGNED_INT;case THREE.FloatType:return k.FLOAT;case THREE.AlphaFormat:return k.ALPHA;case THREE.RGBFormat:return k.RGB;case THREE.RGBAFormat:return k.RGBA;case THREE.LuminanceFormat:return k.LUMINANCE;case THREE.LuminanceAlphaFormat:return k.LUMINANCE_ALPHA}return 0}var U=this,k,ia=[],L=null,ga=null,fa=!0,$=null,ha=null,ja=null,ma=null,ra=null,T=null,ka=null,ca=0,oa=0,da=0,Y=0,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
- new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],pa=new THREE.Matrix4,na=new Float32Array(16),qa=new Float32Array(16),ya=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},xa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?b.stencil:!0,Oa=b.antialias!==void 0?b.antialias:!1,ua=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ta=b.clearAlpha!==
- void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClear=!0;try{if(!(k=xa.getContext("experimental-webgl",{antialias:Oa,stencil:Aa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+k.getParameter(k.VERSION)+" | "+k.getParameter(k.VENDOR)+" | "+k.getParameter(k.RENDERER)+" | "+k.getParameter(k.SHADING_LANGUAGE_VERSION))}catch(sa){console.error(sa)}k.clearColor(0,0,0,1);k.clearDepth(1);k.enable(k.DEPTH_TEST);
- k.depthFunc(k.LEQUAL);k.frontFace(k.CCW);k.cullFace(k.BACK);k.enable(k.CULL_FACE);k.enable(k.BLEND);k.blendEquation(k.FUNC_ADD);k.blendFunc(k.SRC_ALPHA,k.ONE_MINUS_SRC_ALPHA);k.clearColor(ua.r,ua.g,ua.b,ta);this.context=k;var Da=k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;if(Aa){var ea={};ea.vertices=new Float32Array(12);ea.faces=new Uint16Array(6);ea.darkness=0.5;ea.vertices[0]=-20;ea.vertices[1]=-20;ea.vertices[2]=-1;ea.vertices[3]=20;ea.vertices[4]=-20;ea.vertices[5]=-1;ea.vertices[6]=20;
- ea.vertices[7]=20;ea.vertices[8]=-1;ea.vertices[9]=-20;ea.vertices[10]=20;ea.vertices[11]=-1;ea.faces[0]=0;ea.faces[1]=1;ea.faces[2]=2;ea.faces[3]=0;ea.faces[4]=2;ea.faces[5]=3;ea.vertexBuffer=k.createBuffer();ea.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,ea.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,ea.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,ea.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,ea.faces,k.STATIC_DRAW);ea.program=k.createProgram();k.attachShader(ea.program,
- K("fragment",THREE.ShaderLib.shadowPost.fragmentShader));k.attachShader(ea.program,K("vertex",THREE.ShaderLib.shadowPost.vertexShader));k.linkProgram(ea.program);ea.vertexLocation=k.getAttribLocation(ea.program,"position");ea.projectionLocation=k.getUniformLocation(ea.program,"projectionMatrix");ea.darknessLocation=k.getUniformLocation(ea.program,"darkness")}var O={};O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);b=0;O.vertices[b++]=-1;O.vertices[b++]=-1;O.vertices[b++]=0;O.vertices[b++]=
- 0;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=1;O.vertices[b++]=-1;O.vertices[b++]=1;O.vertices[b++]=0;O.vertices[b++]=1;b=0;O.faces[b++]=0;O.faces[b++]=1;O.faces[b++]=2;O.faces[b++]=0;O.faces[b++]=2;O.faces[b++]=3;O.vertexBuffer=k.createBuffer();O.elementBuffer=k.createBuffer();O.tempTexture=k.createTexture();O.occlusionTexture=k.createTexture();k.bindBuffer(k.ARRAY_BUFFER,O.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
- O.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,O.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,O.faces,k.STATIC_DRAW);k.bindTexture(k.TEXTURE_2D,O.tempTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGB,16,16,0,k.RGB,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.bindTexture(k.TEXTURE_2D,
- O.occlusionTexture);k.texImage2D(k.TEXTURE_2D,0,k.RGBA,16,16,0,k.RGBA,k.UNSIGNED_BYTE,null);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,k.CLAMP_TO_EDGE);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,k.NEAREST);k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,k.NEAREST);k.getParameter(k.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(O.hasVertexTexture=!1,O.program=k.createProgram(),k.attachShader(O.program,K("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),
- k.attachShader(O.program,K("vertex",THREE.ShaderLib.lensFlare.vertexShader))):(O.hasVertexTexture=!0,O.program=k.createProgram(),k.attachShader(O.program,K("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),k.attachShader(O.program,K("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));k.linkProgram(O.program);O.attributes={};O.uniforms={};O.attributes.vertex=k.getAttribLocation(O.program,"position");O.attributes.uv=k.getAttribLocation(O.program,"UV");O.uniforms.renderType=
- k.getUniformLocation(O.program,"renderType");O.uniforms.map=k.getUniformLocation(O.program,"map");O.uniforms.occlusionMap=k.getUniformLocation(O.program,"occlusionMap");O.uniforms.opacity=k.getUniformLocation(O.program,"opacity");O.uniforms.scale=k.getUniformLocation(O.program,"scale");O.uniforms.rotation=k.getUniformLocation(O.program,"rotation");O.uniforms.screenPosition=k.getUniformLocation(O.program,"screenPosition");var wa=!1,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);b=
- 0;V.vertices[b++]=-1;V.vertices[b++]=-1;V.vertices[b++]=0;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=-1;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=1;V.vertices[b++]=0;V.vertices[b++]=-1;V.vertices[b++]=1;V.vertices[b++]=0;b=V.vertices[b++]=0;V.faces[b++]=0;V.faces[b++]=1;V.faces[b++]=2;V.faces[b++]=0;V.faces[b++]=2;V.faces[b++]=3;V.vertexBuffer=k.createBuffer();V.elementBuffer=k.createBuffer();k.bindBuffer(k.ARRAY_BUFFER,V.vertexBuffer);k.bufferData(k.ARRAY_BUFFER,
- V.vertices,k.STATIC_DRAW);k.bindBuffer(k.ELEMENT_ARRAY_BUFFER,V.elementBuffer);k.bufferData(k.ELEMENT_ARRAY_BUFFER,V.faces,k.STATIC_DRAW);V.program=k.createProgram();k.attachShader(V.program,K("fragment",THREE.ShaderLib.sprite.fragmentShader));k.attachShader(V.program,K("vertex",THREE.ShaderLib.sprite.vertexShader));k.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=k.getAttribLocation(V.program,"position");V.attributes.uv=k.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=
- k.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=k.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=k.getUniformLocation(V.program,"rotation");V.uniforms.scale=k.getUniformLocation(V.program,"scale");V.uniforms.alignment=k.getUniformLocation(V.program,"alignment");V.uniforms.map=k.getUniformLocation(V.program,"map");V.uniforms.opacity=k.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=k.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=
- k.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=k.getUniformLocation(V.program,"screenPosition");V.uniforms.modelViewMatrix=k.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=k.getUniformLocation(V.program,"projectionMatrix");var la=!1;this.setSize=function(b,e){xa.width=b;xa.height=e;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(b,e,c,f){ca=b;oa=e;da=c;Y=f;k.viewport(ca,oa,da,Y)};this.setScissor=function(b,e,c,f){k.scissor(b,
- e,c,f)};this.enableScissorTest=function(b){b?k.enable(k.SCISSOR_TEST):k.disable(k.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){fa=b;k.depthMask(b)};this.setClearColorHex=function(b,e){ua.setHex(b);ta=e;k.clearColor(ua.r,ua.g,ua.b,ta)};this.setClearColor=function(b,e){ua.copy(b);ta=e;k.clearColor(ua.r,ua.g,ua.b,ta)};this.clear=function(){k.clear(k.COLOR_BUFFER_BIT|k.DEPTH_BUFFER_BIT|k.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){ea.darkness=b};this.getContext=function(){return k};
- this.initMaterial=function(b,e,c,f){var h,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var m=THREE.ShaderLib[j];b.uniforms=
- THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var u,o,n;u=n=m=0;for(o=e.length;u<o;u++)g=e[u],g instanceof THREE.DirectionalLight&&n++,g instanceof THREE.PointLight&&m++;m+n<=4?e=n:(e=Math.ceil(4*n/(m+n)),m=4-e);g={directional:e,point:m};n=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)n=f.bones.length;var p;a:{u=b.fragmentShader;o=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,
- fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:n},v;g=[];j?g.push(j):(g.push(u),g.push(o));for(v in c)g.push(v),g.push(c[v]);j=g.join();v=0;for(g=ia.length;v<g;v++)if(ia[v].code==j){p=ia[v].program;break a}v=k.createProgram();g=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+
- c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
- n=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");k.attachShader(v,K("fragment",n+u));k.attachShader(v,K("vertex",g+o));k.linkProgram(v);
- k.getProgramParameter(v,k.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+k.getProgramParameter(v,k.VALIDATE_STATUS)+", gl error ["+k.getError()+"]");v.uniforms={};v.attributes={};var w;u=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in m)u.push(w);w=u;m=0;for(u=w.length;m<u;m++)o=w[m],v.uniforms[o]=k.getUniformLocation(v,o);u=["position","normal",
- "uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<c.maxMorphTargets;w++)u.push("morphTarget"+w);for(p in e)u.push(p);p=u;w=0;for(e=p.length;w<e;w++)c=p[w],v.attributes[c]=k.getAttribLocation(v,c);ia.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&k.enableVertexAttribArray(p.position);p.color>=0&&k.enableVertexAttribArray(p.color);p.normal>=0&&k.enableVertexAttribArray(p.normal);p.tangent>=0&&k.enableVertexAttribArray(p.tangent);
- b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(k.enableVertexAttribArray(p.skinVertexA),k.enableVertexAttribArray(p.skinVertexB),k.enableVertexAttribArray(p.skinIndex),k.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&k.enableVertexAttribArray(p[h]);if(b.morphTargets){b.numSupportedMorphTargets=0;p.morphTarget0>=0&&(k.enableVertexAttribArray(p.morphTarget0),b.numSupportedMorphTargets++);p.morphTarget1>=0&&(k.enableVertexAttribArray(p.morphTarget1),
- b.numSupportedMorphTargets++);p.morphTarget2>=0&&(k.enableVertexAttribArray(p.morphTarget2),b.numSupportedMorphTargets++);p.morphTarget3>=0&&(k.enableVertexAttribArray(p.morphTarget3),b.numSupportedMorphTargets++);p.morphTarget4>=0&&(k.enableVertexAttribArray(p.morphTarget4),b.numSupportedMorphTargets++);p.morphTarget5>=0&&(k.enableVertexAttribArray(p.morphTarget5),b.numSupportedMorphTargets++);p.morphTarget6>=0&&(k.enableVertexAttribArray(p.morphTarget6),b.numSupportedMorphTargets++);p.morphTarget7>=
- 0&&(k.enableVertexAttribArray(p.morphTarget7),b.numSupportedMorphTargets++);f.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(h=this.maxMorphTargets;b<h;b++)f.__webglMorphTargetInfluences[b]=0}};this.render=function(b,c,o,C){var E,I,F,H,J,Z,Y,N,L=b.lights,K=b.fog;U.data.vertices=0;U.data.faces=0;U.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(qa);c.projectionMatrix.flattenToArray(na);pa.multiply(c.projectionMatrix,
- c.matrixWorldInverse);n(pa);this.initWebGLObjects(b);W(o);(this.autoClear||C)&&this.clear();J=b.__webglObjects.length;for(C=0;C<J;C++)if(E=b.__webglObjects[C],Y=E.object,Y.visible)if(!(Y instanceof THREE.Mesh)||p(Y)){if(Y.matrixWorld.flattenToArray(Y._objectMatrixArray),A(Y,c),v(E),E.render=!0,this.sortObjects)E.object.renderDepth?E.z=E.object.renderDepth:(ya.copy(Y.position),pa.multiplyVector3(ya),E.z=ya.z)}else E.render=!1;else E.render=!1;this.sortObjects&&b.__webglObjects.sort(w);Z=b.__webglObjectsImmediate.length;
- for(C=0;C<Z;C++)E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible&&(Y.matrixAutoUpdate&&Y.matrixWorld.flattenToArray(Y._objectMatrixArray),A(Y,c),u(E));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);R(b.overrideMaterial.blending);for(C=0;C<J;C++)if(E=b.__webglObjects[C],E.render)Y=E.object,N=E.buffer,h(Y),f(c,L,K,b.overrideMaterial,N,Y);for(C=0;C<Z;C++)E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible&&(h(Y),I=e(c,L,K,b.overrideMaterial,Y),Y.render(function(e){g(e,I,b.overrideMaterial.shading)}))}else{R(THREE.NormalBlending);
- for(C=0;C<J;C++)if(E=b.__webglObjects[C],E.render){Y=E.object;N=E.buffer;F=E.opaque;h(Y);for(E=0;E<F.count;E++)H=F.list[E],j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,L,K,H,N,Y)}for(C=0;C<Z;C++)if(E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible){F=E.opaque;h(Y);for(E=0;E<F.count;E++)H=F.list[E],j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,L,K,H,Y),Y.render(function(b){g(b,I,H.shading)})}for(C=0;C<J;C++)if(E=b.__webglObjects[C],
- E.render){Y=E.object;N=E.buffer;F=E.transparent;h(Y);for(E=0;E<F.count;E++)H=F.list[E],R(H.blending),j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,L,K,H,N,Y)}for(C=0;C<Z;C++)if(E=b.__webglObjectsImmediate[C],Y=E.object,Y.visible){F=E.transparent;h(Y);for(E=0;E<F.count;E++)H=F.list[E],R(H.blending),j(H.depthTest),m(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,L,K,H,Y),Y.render(function(b){g(b,I,H.shading)})}}b.__webglSprites.length&&y(b,c);Aa&&
- b.__webglShadowVolumes.length&&b.lights.length&&x(b);b.__webglLensFlares.length&&D(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(k.bindTexture(k.TEXTURE_2D,o.__webglTexture),k.generateMipmap(k.TEXTURE_2D),k.bindTexture(k.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
- c=b,f=void 0,g=void 0,h=void 0;if(e._modelViewMatrix==void 0)e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray);if(e instanceof THREE.Mesh)for(f in g=e.geometry,g.geometryGroups==void 0&&J(g),g.geometryGroups){h=g.geometryGroups[f];if(!h.__webglVertexBuffer){var j=h;j.__webglVertexBuffer=k.createBuffer();j.__webglNormalBuffer=k.createBuffer();
- j.__webglTangentBuffer=k.createBuffer();j.__webglColorBuffer=k.createBuffer();j.__webglUVBuffer=k.createBuffer();j.__webglUV2Buffer=k.createBuffer();j.__webglSkinVertexABuffer=k.createBuffer();j.__webglSkinVertexBBuffer=k.createBuffer();j.__webglSkinIndicesBuffer=k.createBuffer();j.__webglSkinWeightsBuffer=k.createBuffer();j.__webglFaceBuffer=k.createBuffer();j.__webglLineBuffer=k.createBuffer();if(j.numMorphTargets){var m=void 0,u=void 0;j.__webglMorphTargetsBuffers=[];m=0;for(u=j.numMorphTargets;m<
- u;m++)j.__webglMorphTargetsBuffers.push(k.createBuffer())}for(var j=h,m=e,o=void 0,p=void 0,n=void 0,v=n=void 0,w=void 0,x=void 0,A=x=u=0,y=n=p=void 0,D=y=p=o=void 0,n=void 0,v=m.geometry,w=v.faces,y=j.faces,o=0,p=y.length;o<p;o++)n=y[o],n=w[n],n instanceof THREE.Face3?(u+=3,x+=1,A+=3):n instanceof THREE.Face4&&(u+=4,x+=2,A+=4);for(var o=j,p=m,C=y=w=void 0,H=void 0,C=void 0,n=[],w=0,y=p.materials.length;w<y;w++)if(C=p.materials[w],C instanceof THREE.MeshFaceMaterial){C=0;for(l=o.materials.length;C<
- l;C++)(H=o.materials[C])&&n.push(H)}else(H=C)&&n.push(H);o=n;j.__materials=o;a:{w=p=void 0;y=o.length;for(p=0;p<y;p++)if(w=o[p],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{y=w=void 0;n=o.length;for(w=0;w<n;w++)if(y=o[w],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=!1}a:{n=w=void 0;C=o.length;for(w=0;w<C;w++)if(n=o[w],
- n.vertexColors){n=n.vertexColors;break a}n=!1}j.__vertexArray=new Float32Array(u*3);if(y)j.__normalArray=new Float32Array(u*3);if(v.hasTangents)j.__tangentArray=new Float32Array(u*4);if(n)j.__colorArray=new Float32Array(u*3);if(p){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)j.__uvArray=new Float32Array(u*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(u*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(u*4),
- j.__skinVertexBArray=new Float32Array(u*4),j.__skinIndexArray=new Float32Array(u*4),j.__skinWeightArray=new Float32Array(u*4);j.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(A*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];v=0;for(w=j.numMorphTargets;v<w;v++)j.__morphTargetsArrays.push(new Float32Array(u*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=p;j.__vertexColorType=n;j.__normalType=y;j.__webglFaceCount=
- x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);j.__webglLineCount=A*2;v=0;for(w=o.length;v<w;v++)if(p=o[v],p.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in p.attributes){n=p.attributes[a];y={};for(D in n)y[D]=n[D];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,x=1,y.type==="v2"?x=2:y.type==="v3"?x=3:y.type==="v4"?x=4:y.type==="c"&&(x=3),y.size=x,y.array=new Float32Array(u*x),y.buffer=k.createBuffer(),y.buffer.belongsToAttribute=
- a,n.needsUpdate=!0,y.__original=n;j.__webglCustomAttributes[a]=y}}j.__inittedArrays=!0;g.__dirtyVertices=!0;g.__dirtyMorphTargets=!0;g.__dirtyElements=!0;g.__dirtyUvs=!0;g.__dirtyNormals=!0;g.__dirtyTangents=!0;g.__dirtyColors=!0}e instanceof THREE.ShadowVolume?S(c.__webglShadowVolumes,h,e):S(c.__webglObjects,h,e)}else if(e instanceof THREE.LensFlare)S(c.__webglLensFlares,void 0,e);else if(e instanceof THREE.Ribbon){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),
- f.__webglColorBuffer=k.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglVertexCount=h,g.__dirtyVertices=!0,g.__dirtyColors=!0;S(c.__webglObjects,g,e)}else if(e instanceof THREE.Line){g=e.geometry;if(!g.__webglVertexBuffer)f=g,f.__webglVertexBuffer=k.createBuffer(),f.__webglColorBuffer=k.createBuffer(),f=g,h=f.vertices.length,f.__vertexArray=new Float32Array(h*3),f.__colorArray=new Float32Array(h*3),f.__webglLineCount=h,g.__dirtyVertices=
- !0,g.__dirtyColors=!0;S(c.__webglObjects,g,e)}else if(e instanceof THREE.ParticleSystem){g=e.geometry;if(!g.__webglVertexBuffer){f=g;f.__webglVertexBuffer=k.createBuffer();f.__webglColorBuffer=k.createBuffer();f=g;h=e;j=f.vertices.length;f.__vertexArray=new Float32Array(j*3);f.__colorArray=new Float32Array(j*3);f.__sortArray=[];f.__webglParticleCount=j;f.__materials=h.materials;D=u=m=void 0;m=0;for(u=h.materials.length;m<u;m++)if(D=h.materials[m],D.attributes){if(f.__webglCustomAttributes===void 0)f.__webglCustomAttributes=
- {};for(a in D.attributes){originalAttribute=D.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(j*size),attribute.buffer=k.createBuffer(),attribute.buffer.belongsToAttribute=
- a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;f.__webglCustomAttributes[a]=attribute}}g.__dirtyVertices=!0;g.__dirtyColors=!0}S(c.__webglObjects,g,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&c.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){c=b.__objectsRemoved[0];e=b;if(c instanceof
- THREE.ShadowVolume)I(e.__webglShadowVolumes,c);else if(c instanceof THREE.Mesh||c instanceof THREE.ParticleSystem||c instanceof THREE.Ribbon||c instanceof THREE.Line)I(e.__webglObjects,c);else if(c instanceof THREE.Sprite){e=e.__webglSprites;g=void 0;for(g=e.length-1;g>=0;g--)e[g]==c&&e.splice(g,1)}else c instanceof THREE.LensFlare?I(e.__webglLensFlares,c):c instanceof THREE.MarchingCubes&&I(e.__webglObjectsImmediate,c);b.__objectsRemoved.splice(0,1)}e=0;for(c=b.__webglObjects.length;e<c;e++)E(b.__webglObjects[e].object,
- b);e=0;for(c=b.__webglShadowVolumes.length;e<c;e++)E(b.__webglShadowVolumes[e].object,b);e=0;for(c=b.__webglLensFlares.length;e<c;e++)E(b.__webglLensFlares[e].object,b)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?k.frontFace(k.CCW):k.frontFace(k.CW),b=="back"?k.cullFace(k.BACK):b=="front"?k.cullFace(k.FRONT):k.cullFace(k.FRONT_AND_BACK),k.enable(k.CULL_FACE)):k.disable(k.CULL_FACE)};this.supportsVertexTextures=function(){return Da}};
- THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
- THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
- 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};
- THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,h=Math.max(Math.max(e,f),g),j=Math.min(Math.min(e,f),g);if(j==h)j=e=0;else{var m=h-j,j=m/h,e=e==h?(f-g)/m:f==h?2+(g-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=j;c.v=h;return c},
- clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
- THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,h=b.vertices,j=g.vertices,m=b.faces,n=g.faces,p=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,u=j.length;o<u;o++){var v=new THREE.Vertex(j[o].position.clone());e&&c.matrix.multiplyVector3(v.position);h.push(v)}o=0;for(u=n.length;o<u;o++){var j=n[o],w,x,y=j.vertexNormals,v=j.vertexColors;j instanceof THREE.Face3?w=new THREE.Face3(j.a+f,j.b+f,j.c+
- f):j instanceof THREE.Face4&&(w=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));w.normal.copy(j.normal);e=0;for(h=y.length;e<h;e++)x=y[e],w.vertexNormals.push(x.clone());w.color.copy(j.color);e=0;for(h=v.length;e<h;e++)x=v[e],w.vertexColors.push(x.clone());w.materials=j.materials.slice();w.centroid.copy(j.centroid);m.push(w)}o=0;for(u=g.length;o<u;o++){f=g[o];m=[];e=0;for(h=f.length;e<h;e++)m.push(new THREE.UV(f[e].u,f[e].v));p.push(m)}}};
- THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],h=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)h.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return h}};
- THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
- if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",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:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},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},uOpacity:{type:"f",value:1}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\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 ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
- THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( 1.0 );\nvec4 mColor = vec4( uDiffuseColor, uOpacity );\nvec4 mSpecular = vec4( uSpecularColor, uOpacity );\nvec3 specularTex = vec3( 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ngl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\nif( enableAO )\ngl_FragColor = gl_FragColor * texture2D( tAO, vUv );\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointTotal = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = specularTex.r * pow( pointDotNormalHalf, uShininess );\npointTotal += pointDistance * vec4( pointLightColor[ i ], 1.0 ) * ( mColor * pointDiffuseWeight + mSpecular * pointSpecularWeight * pointDiffuseWeight );\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirTotal = 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 + viewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = specularTex.r * pow( dirDotNormalHalf, uShininess );\ndirTotal += vec4( directionalLightColor[ i ], 1.0 ) * ( mColor * dirDiffuseWeight + mSpecular * dirSpecularWeight * dirDiffuseWeight );\n}\n#endif\nvec4 totalLight = vec4( ambientLightColor * uAmbientColor, uOpacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirTotal;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointTotal;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
- THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:"attribute vec4 tangent;\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;\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\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;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\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(b){var c,e,f,g,h=2*Math.ceil(b*3)+1;h>25&&(h=25);g=(h-1)*0.5;e=Array(h);for(c=f=0;c<h;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<h;++c)e[c]/=f;return e}};
- THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
- 0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var m=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){m={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++){var p=b.hierarchy[e].keys[f].morphTargets[n];m[p]=-1}b.hierarchy[e].usedMorphTargets=m;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
- {};for(p in m){for(n=0;n<b.hierarchy[e].keys[f].morphTargets.length;n++)if(b.hierarchy[e].keys[f].morphTargets[n]===p){o[p]=b.hierarchy[e].keys[f].morphTargetsInfluences[n];break}n===b.hierarchy[e].keys[f].morphTargets.length&&(o[p]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
- b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
- 2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
- THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
- THREE.Bone?g.skinMatrix:g.matrix;var h=g.animationCache.prevKey;g=g.animationCache.nextKey;h.pos=this.data.hierarchy[e].keys[0];h.rot=this.data.hierarchy[e].keys[0];h.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,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.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
- THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,h,j,m,n,p,o=this.data.JIT.hierarchy,u,v;this.currentTime+=b*this.timeScale;v=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,x=this.hierarchy.length;w<x;w++)if(b=this.hierarchy[w],n=b.animationCache,this.JITCompile&&o[w][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[w][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
- !1):(b.matrix=o[w][p],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var y=0;y<3;y++){e=c[y];j=n.prevKey[e];m=n.nextKey[e];if(m.time<=v){if(u<v)if(this.loop){j=this.data.hierarchy[w].keys[0];for(m=this.getNextKeyWith(e,w,1);m.time<u;)j=m,m=this.getNextKeyWith(e,w,m.index+1)}else{this.stop();return}else{do j=m,m=this.getNextKeyWith(e,w,m.index+1);while(m.time<
- u)}n.prevKey[e]=j;n.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-j.time)/(m.time-j.time);g=j[e];h=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+w),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
- this.getPrevKeyWith("pos",w,j.index-1).pos,this.points[1]=g,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",w,m.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
- "rot")THREE.Quaternion.slerp(g,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(h[0]-g[0])*f,e.y=g[1]+(h[1]-g[1])*f,e.z=g[2]+(h[2]-g[2])*f}}if(this.JITCompile&&o[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;w<this.hierarchy.length;w++)o[w][p]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
- THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,h,j,m,n,p;g=(b.length-1)*c;h=Math.floor(g);g-=h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>b.length-2?h:h+1;e[3]=h>b.length-3?h:h+2;h=b[e[0]];m=b[e[1]];n=b[e[2]];p=b[e[3]];e=g*g;j=g*e;f[0]=this.interpolate(h[0],m[0],n[0],p[0],g,e,j);f[1]=this.interpolate(h[1],m[1],n[1],p[1],g,e,j);f[2]=this.interpolate(h[2],m[2],n[2],p[2],g,e,j);return f};
- THREE.Animation.prototype.interpolate=function(b,c,e,f,g,h,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*h+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
- THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
- THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
- b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
- void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
- b.stopPropagation();if(this.activeLook)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.activeLook)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;break;case 81:this.freeze=!this.freeze}};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(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=
- this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c);this.moveRight&&this.translateX(c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&
- (this.lat-=this.mouseY*c);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;var b=this.target.position,g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);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;if(this.constrainVertical)this.phi=
- (this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.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.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;
- THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
- THREE.PathCamera=function(b){function c(b,e,c,f){var g={name:c,fps:0.6,length:f,hierarchy:[]},h,j=e.getControlPointsArray(),m=e.getLength(),n=j.length,H=0;h=n-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<n-1;h++)H=f*m.chunks[h]/m.total,e.keys[h]={time:H,pos:j[h]};g.hierarchy[0]=e;THREE.AnimationHandler.add(g);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
- f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,g);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
- 16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,g),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
- this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
- void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.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 g=Math.PI*2,h=Math.PI/180;this.update=function(b,e,c){var f,j;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;var m=j[1]-j[0];this.phi=
- TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j[0])/m)*m+j[0];f=this.horizontalAngleMap.srcRange;j=this.horizontalAngleMap.dstRange;m=j[1]-j[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j[0])/m)*m+j[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.mouseX=
- b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),j=new THREE.MeshLambertMaterial({color:65280}),m=new THREE.CubeGeometry(10,10,20),n=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(m,b);b=new THREE.Mesh(n,j);b.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(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,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;
- THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
- b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
- 0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
- this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
- case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),g=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-g)/g;this.moveState.pitchDown=(b.clientY-
- c.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
- this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
- this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
- document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
- this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
- THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,n=!1,p=1,o=0,u=0,v=0,w=0,x=0,y=window.innerWidth/2,D=window.innerHeight/2;this.update=
- function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*w),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*u);this.translateY(b*v);n&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
- else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();j.copy(this.forward);h.set(0,1,0);g.cross(h,j).normalize();h.cross(j,g).normalize();this.matrix.n11=g.x;this.matrix.n12=h.x;this.matrix.n13=j.x;this.matrix.n21=g.y;this.matrix.n22=h.y;this.matrix.n23=j.y;this.matrix.n31=g.z;this.matrix.n32=h.z;this.matrix.n33=j.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
- this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
- this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
- function(b){w=(b.clientX-y)/window.innerWidth;x=(b.clientY-D)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:u=-1;break;
- case 40:case 83:o=-1;break;case 39:case 68:u=1;break;case 81:n=!0;p=1;break;case 69:n=!0;p=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:u=0;break;case 40:case 83:o=0;break;case 39:case 68:u=0;break;case 81:n=!1;break;case 69:n=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
- THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
- THREE.TrackballCamera=function(b){function c(b,e){return function(){e.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
- !1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,h=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector2,n=new THREE.Vector2,p=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-
- this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(g).setLength(c.x));f.addSelf(g.setLength(c.z));return f};
- this.rotateCamera=function(){var b=Math.acos(h.dot(j)/h.length()/j.length());if(b){var e=(new THREE.Vector3).cross(h,j).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(g);c.multiplyVector3(this.up);c.multiplyVector3(j);this.staticMoving?h=j:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(h))}};this.zoomCamera=function(){var b=1+(n.y-m.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?m=n:m.y+=(n.y-m.y)*this.dynamicDampingFactor)};
- this.panCamera=function(){var b=o.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var e=g.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?p=o:p.addSelf(b.sub(o,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
- g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,e,c){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,e,c)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
- c(this,function(b){e&&(h=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),m=n=this.getMouseOnScreen(b.clientX,b.clientY),p=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?j=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
- b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?h=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?m=n=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
- this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
- THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};
- THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheLengths&&this.cacheLengths.length==b)return this.cacheLengths;var c=[],e,f=this.getPoint(0),g,h=0;for(g=1;g<=b;g++)e=this.getPoint(g/b),h+=e.distanceTo(f),c.push(h),f=e;return this.cacheLengths=c};
- THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,h;for(h=c?c:b*e[g-1];f<g;){if(e[f]>h)break;f++}return f/g};THREE.LineCurve=function(b,c,e,f){this.x1=b;this.y1=c;this.x2=e;this.y2=f};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){return new THREE.Vector2(this.x1+(this.x2-this.x1)*b,this.y1+(this.y2-this.y1)*b)};
- THREE.QuadraticBezierCurve=function(b,c,e,f,g,h){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=h};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b2(b,this.x0,this.x1,this.x2);b=THREE.FontUtils.b2(b,this.y0,this.y1,this.y2);return new THREE.Vector2(c,b)};
- THREE.QuadraticBezierCurve.prototype.getNormalVector=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.x0,this.x1,this.x2);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.y0,this.y1,this.y2);return(new THREE.Vector2(-b,c)).unit()};THREE.CubicBezierCurve=function(b,c,e,f,g,h,j,m){this.x0=b;this.y0=c;this.x1=e;this.y1=f;this.x2=g;this.y2=h;this.x3=j;this.y3=m};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
- THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.FontUtils.b3(b,this.x0,this.x1,this.x2,this.x3);b=THREE.FontUtils.b3(b,this.y0,this.y1,this.y2,this.y3);return new THREE.Vector2(c,b)};THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
- THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,g;g=(f.length-1)*b;b=Math.floor(g);g-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,g);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,g);return c};THREE.ArcCurve=function(b,c,e,f,g,h){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=g;this.aClockwise=h};
- THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))};
- THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentSpline:function(){},interpolate:function(b,c,e,f,g){var b=(e-b)*0.5,f=(f-c)*0.5,h=g*g;return(2*c-2*e+b+f)*g*h+(-3*c+3*e-2*b-f)*h+b*g+c}};THREE.Path=function(b){this.actions=[];this.curves=[];b&&this.fromPoints(b)};THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};
- THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
- THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args,f=new THREE.LineCurve(f[f.length-2],f[f.length-1],b,c);this.curves.push(f);this.actions.push({action:THREE.PathActions.LINE_TO,args:e,curve:f})};
- THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var g=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args,h=new THREE.QuadraticBezierCurve(h[h.length-2],h[h.length-1],b,c,e,f);this.curves.push(h);this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g,curve:h})};
- THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,g,h){var j=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args,m=new THREE.CubicBezierCurve(m[m.length-2],m[m.length-1],b,c,e,f,g,h);this.curves.push(m);this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:j,curve:m})};
- THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b),e=new THREE.SplineCurve(e);this.curves.push(e);this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c,curve:e})};
- THREE.Path.prototype.arc=function(b,c,e,f,g,h){var j=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,h));this.actions.push({action:THREE.PathActions.ARC,args:j})};THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
- THREE.Path.prototype.getPoints=function(b){var b=b||12,c=[],e,f,g,h,j,m,n,p,o,u,v,w,x;e=0;for(f=this.actions.length;e<f;e++)switch(g=this.actions[e],h=g.action,g=g.args,h){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:j=g[2];m=g[3];o=g[0];u=g[1];c.length>0?(h=c[c.length-1],v=h.x,w=h.y):(h=this.actions[e-1].args,v=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,g=THREE.FontUtils.b2(x,v,o,j),x=THREE.FontUtils.b2(x,w,u,m),c.push(new THREE.Vector2(g,
- x));break;case THREE.PathActions.BEZIER_CURVE_TO:j=g[4];m=g[5];o=g[0];u=g[1];n=g[2];p=g[3];c.length>0?(h=c[c.length-1],v=h.x,w=h.y):(h=this.actions[e-1].args,v=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,g=THREE.FontUtils.b3(x,v,o,n,j),x=THREE.FontUtils.b3(x,w,u,p,m),c.push(new THREE.Vector2(g,x));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];x=b*g[0].length;h=h.concat(g[0]);g=new THREE.SplineCurve(h);for(h=1;h<=x;h++)c.push(g.getPointAt(h/
- x));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;j=g[0];m=g[1];n=g[2];o=g[3];x=g[4];u=!!g[5];p=h[h.length-2];v=h[h.length-1];h.length==0&&(p=v=0);w=x-o;var y=b*2;for(h=1;h<=y;h++)x=h/y,u||(x=1-x),x=o+x*w,g=p+j+n*Math.cos(x),x=v+m+n*Math.sin(x),c.push(new THREE.Vector2(g,x))}return c};
- THREE.Path.prototype.getMinAndMax=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var h,j,m;j=0;for(m=b.length;j<m;j++){h=b[j];if(h.x>c)c=h.x;else if(h.x<f)f=h.x;if(h.y>e)e=h.y;else if(h.y<e)g=h.y}return{minX:f,minY:g,maxX:c,maxY:e}};THREE.Path.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.sums,b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};
- THREE.Path.prototype.getLength=function(){var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);this.sums=b;return c};
- THREE.Path.prototype.createPathGeometry=function(b,c){var e=this.getPoints(b),f,g=new THREE.Object3D;c||(c=new THREE.LineBasicMaterial({color:0,opacity:0.7}));for(var h=1;h<e.length;h++)f=new THREE.Geometry,f.vertices.push(new THREE.Vertex(new THREE.Vector3(e[h-1].x,e[h-1].y,0))),f.vertices.push(new THREE.Vertex(new THREE.Vector3(e[h].x,e[h].y,0))),f=new THREE.Line(f,c),g.addChild(f);return g};
- THREE.Path.prototype.transform=function(b){b=new THREE.Path;b.moveTo(0,0);b.quadraticCurveTo(100,20,140,80);console.log(b.cacheArcLengths());var c=this.getMinAndMax(),e=this.getPoints(),f,g,h,j,m,n;f=0;for(g=e.length;f<g;f++)h=e[f],j=h.x,m=h.y,n=j/c.maxX,j=b.getPoint(n),m=b.getNormalVector(n).multiplyScalar(m),h.x=j.x+m.x,h.y=j.y+m.y;return e};
- THREE.Path.prototype.nltransform=function(b,c,e,f,g,h){var j=this.getPoints(),m,n,p,o,u;m=0;for(n=j.length;m<n;m++)p=j[m],o=p.x,u=p.y,p.x=b*o+c*u+e,p.y=f*u+g*o+h;return j};
- THREE.Path.prototype.debug=function(b){var c=this.getMinAndMax();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=this.transform(0.866,
- -0.866,0,0.5,0.5,-50);b=0;for(e=f.length;b<e;b++)g=f[b],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
- THREE.Shape.prototype.getHoles=function(b){var b=b?"getSpacedPoints":"getPoints",c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c][b]();return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this[b?"getSpacedPoints":"getPoints"](),holes:this.getHoles(b)}};
- THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,h,j,m,n,p,o,u,v,w,x=[];for(n=0;n<c.length;n++){p=c[n];f=f.concat(p);h=Number.POSITIVE_INFINITY;for(g=0;g<p.length;g++){v=p[g];w=[];for(u=0;u<e.length;u++)o=e[u],o=v.distanceTo(o),w.push(o),o<h&&(h=o,j=g,m=u)}g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;var y=[p[j],e[m],e[g]];u=THREE.FontUtils.Triangulate.area(y);var D=[p[j],p[h],e[m]];v=THREE.FontUtils.Triangulate.area(D);w=m;o=j;m+=1;j+=-1;m<0&&(m+=e.length);m%=e.length;
- j<0&&(j+=p.length);j%=p.length;g=m-1>=0?m-1:e.length-1;h=j-1>=0?j-1:p.length-1;y=[p[j],e[m],e[g]];y=THREE.FontUtils.Triangulate.area(y);D=[p[j],p[h],e[m]];D=THREE.FontUtils.Triangulate.area(D);u+v>y+D&&(m=w,j=o,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=p.length),j%=p.length,g=m-1>=0?m-1:e.length-1,h=j-1>=0?j-1:p.length-1);u=e.slice(0,m);v=e.slice(m);w=p.slice(j);o=p.slice(0,j);h=[p[j],p[h],e[m]];x.push([p[j],e[m],e[g]]);x.push(h);e=u.concat(w).concat(o).concat(v)}return{shape:e,isolatedPts:x,allpoints:f}},
- triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),h,j,m,n;for(h=0;h<e.length;h++){n=e[h];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(n[j])&&(n[j]=m)}for(h=0;h<g.length;h++){n=g[h];for(j=0;j<3;j++)for(m=0;m<f.length;m++)f[m].equals(n[j])&&(n[j]=m)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0}};
- THREE.CubeGeometry=function(b,c,e,f,g,h,j,m,n){function p(b,e,c,j,m,n,p,u){var v,w,x=f||1,y=g||1,K=m/2,X=n/2,Q=o.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",y=h||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",x=h||1;var U=x+1,k=y+1;m/=x;var ia=n/y;for(w=0;w<k;w++)for(n=0;n<U;n++){var L=new THREE.Vector3;L[b]=(n*m-K)*c;L[e]=(w*ia-X)*j;L[v]=p;o.vertices.push(new THREE.Vertex(L))}for(w=0;w<y;w++)for(n=0;n<x;n++)o.faces.push(new THREE.Face4(n+U*
- w+Q,n+U*(w+1)+Q,n+1+U*(w+1)+Q,n+1+U*w+Q,null,null,u)),o.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var o=this,u=b/2,v=c/2,w=e/2,m=m?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var x=0;x<6;x++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var y in n)this.sides[y]!=void 0&&(this.sides[y]=
- n[y]);this.sides.px&&p("z","y",1*m,-1,e,c,-u,this.materials[0]);this.sides.nx&&p("z","y",-1*m,-1,e,c,u,this.materials[1]);this.sides.py&&p("x","z",1*m,1,b,e,v,this.materials[2]);this.sides.ny&&p("x","z",1*m,-1,b,e,-v,this.materials[3]);this.sides.pz&&p("x","y",1*m,-1,b,c,w,this.materials[4]);this.sides.nz&&p("x","y",-1*m,-1,b,c,-w,this.materials[5]);(function(){for(var b=[],e=[],c=0,f=o.vertices.length;c<f;c++){for(var h=o.vertices[c],g=!1,j=0,m=b.length;j<m;j++){var n=b[j];if(h.position.x==n.position.x&&
- h.position.y==n.position.y&&h.position.z==n.position.z){e[c]=j;g=!0;break}}if(!g)e[c]=b.length,b.push(new THREE.Vertex(h.position.clone()))}c=0;for(f=o.faces.length;c<f;c++)h=o.faces[c],h.a=e[h.a],h.b=e[h.b],h.c=e[h.c],h.d=e[h.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
- THREE.CylinderGeometry=function(b,c,e,f,g,h){function j(b,e,c){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}THREE.Geometry.call(this);var m=this,n,p=Math.PI*2,o=f/2;for(n=0;n<b;n++)j(Math.sin(p*n/b)*c,Math.cos(p*n/b)*c,-o);for(n=0;n<b;n++)j(Math.sin(p*n/b)*e,Math.cos(p*n/b)*e,o);for(n=0;n<b;n++)m.faces.push(new THREE.Face4(n,n+b,b+(n+1)%b,(n+1)%b));if(e>0){j(0,0,-o-(h||0));for(n=b;n<b+b/2;n++)m.faces.push(new THREE.Face4(2*b,(2*n-2*b)%b,(2*n-2*b+1)%b,(2*n-2*b+2)%b))}if(c>0){j(0,0,o+
- (g||0));for(n=b+b/2;n<2*b;n++)m.faces.push(new THREE.Face4(2*b+1,(2*n-2*b+2)%b+b,(2*n-2*b+1)%b+b,(2*n-2*b)%b+b))}n=0;for(b=this.faces.length;n<b;n++){var c=[],e=this.faces[n],g=this.vertices[e.a],h=this.vertices[e.b],o=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(h.position.x,h.position.y)/p,0.5+h.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/p,0.5+o.position.z/
- f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/p,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
- THREE.ExtrudeGeometry=function(b,c){function e(b,e,c,f){vectorFromCentroid=b.clone().subSelf(e);adj=c/vectorFromCentroid.length();f?adj+=1:adj=1-adj;return vectorFromCentroid.multiplyScalar(adj).addSelf(e)}function f(b){for(F=b.length;--F>=0;){Q=F;U=F-1;U<0&&(U=b.length-1);for(var e=0;e<u+o*2;e++){var c=K*e,f=K*(e+1);H.faces.push(new THREE.Face4(k+Q+c,k+U+c,k+U+f,k+Q+f))}}}function g(b,e,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function h(b,e,c){H.faces.push(new THREE.Face3(b,
- e,c))}var j=c.amount!==void 0?c.amount:100,m=c.bevelThickness!==void 0?c.bevelThickness:8,n=c.bevelSize!==void 0?c.bevelSize:m,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.bevelSegments!==void 0?c.bevelSegments:3;p||(o=0);var u=c.steps!==void 0?c.steps:1,v=c.path!==void 0?c.path:null,w,x=!1;if(v)w=v.getPoints(),u=w.length,x=!0;THREE.Geometry.call(this);var y,D,A,H=this,v=b.extractAllPoints(!1),C=v.shape,v=v.holes,E=!THREE.Shape.Utils.isClockWise(C);if(E){C=C.reverse();D=0;for(A=v.length;D<A;D++)y=
- v[D],THREE.Shape.Utils.isClockWise(y)&&(v[D]=y.reverse());E=!1}var E=THREE.Shape.Utils.triangulateShape(C,v),I=C;D=0;for(A=v.length;D<A;D++)y=v[D],C=C.concat(y);var J,S=new THREE.Vector2,R,N,F=0;for(il=I.length;F<il;F++)S.addSelf(I[F]);R=S.divideScalar(I.length);N=[];D=0;for(A=v.length;D<A;D++){S=new THREE.Vector2;y=v[D];F=0;for(il=y.length;F<il;F++)S.addSelf(y[F]);N[D]=S.divideScalar(y.length)}var F,W,K=C.length,S=E.length,X;for(J=o;J>0;J--){t=J/o;z=m*t;X=n*(1-Math.sin((1-t)*Math.PI/2));F=0;for(il=
- I.length;F<il;F++)W=e(I[F],R,X,!1),g(W.x,W.y,-z);D=0;for(A=v.length;D<A;D++){y=v[D];F=0;for(il=y.length;F<il;F++)W=e(y[F],N[D],X,!0),g(W.x,W.y,-z)}}for(F=0;F<K;F++)W=C[F],x?g(W.x,W.y+w[0].y,w[0].x):g(W.x,W.y,0);for(y=1;y<=u;y++)for(F=0;F<K;F++)W=C[F],x?g(W.x,W.y+w[y-1].y,w[y-1].x):g(W.x,W.y,j/u*y);for(J=1;J<=o;J++){t=J/o;z=m*t;X=n*(1-Math.sin((1-t)*Math.PI/2));F=0;for(il=I.length;F<il;F++)W=e(I[F],R,X,!1),g(W.x,W.y,j+z);D=0;for(A=v.length;D<A;D++){y=v[D];F=0;for(il=y.length;F<il;F++)W=e(y[F],N[D],
- X,!0),x?g(W.x,W.y+w[u-1].y,w[u-1].x+z):g(W.x,W.y,j+z)}}if(p){m=K*0;for(F=0;F<S;F++)j=E[F],h(j[2]+m,j[1]+m,j[0]+m);m=K*(u+o*2);for(F=0;F<S;F++)j=E[F],h(j[0]+m,j[1]+m,j[2]+m)}else{for(F=0;F<S;F++)j=E[F],h(j[2],j[1],j[0]);for(F=0;F<S;F++)j=E[F],h(j[0]+K*u,j[1]+K*u,j[2]+K*u)}var Q,U,k=0;f(I);k+=I.length;D=0;for(A=v.length;D<A;D++)y=v[D],f(y),k+=y.length;this.computeCentroids();this.computeFaceNormals()};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
- THREE.IcosahedronGeometry=function(b){function c(b,e,c){var f=Math.sqrt(b*b+e*e+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,h=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
- -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var m in h.faces){var n=f(h.faces[m].a,h.faces[m].b),p=f(h.faces[m].b,h.faces[m].c),o=f(h.faces[m].c,h.faces[m].a);e(h.faces[m].a,n,o,j);e(h.faces[m].b,p,n,j);
- e(h.faces[m].c,o,p,j);e(n,p,o,j)}h.faces=j.faces}g.faces=h.faces;delete h;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
- THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],h=[],j=(new THREE.Matrix4).setRotationZ(c),m=0;m<b.length;m++)this.vertices.push(new THREE.Vertex(b[m])),e[m]=b[m].clone(),f[m]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(m=0;m<e.length;m++)n<this.angle?(e[m]=j.multiplyVector3(e[m].clone()),this.vertices.push(new THREE.Vertex(e[m])),g[m]=this.vertices.length-1):g=h;n==0&&(h=f);
- for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(g[m],g[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,m/b.length),new THREE.UV(1-n/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(n-c)/this.angle,m/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
- THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,h=b/2,j=c/2,e=e||1,f=f||1,m=e+1,n=f+1;b/=e;var p=c/f;for(g=0;g<n;g++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(g*p-j),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*g,c+m*(g+1),c+1+m*(g+1),c+1+m*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
- THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
- THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,h=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e<j+1;e++){f=e/j;var m=b*Math.cos(f*g),n=b*Math.sin(f*g),p=[],o=0;for(f=0;f<h;f++){var u=2*f/h,v=n*Math.sin(u*g),u=n*Math.cos(u*g);(e==0||e==j)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,m,v)))-1);p.push(o)}c.push(p)}for(var w,x,y,g=c.length,e=0;e<g;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){p=f==h-1;j=c[e][p?0:f+1];m=c[e][p?h-1:f];n=c[e-1][p?
- h-1:f];p=c[e-1][p?0:f+1];v=e/(g-1);w=(e-1)/(g-1);x=(f+1)/h;var u=f/h,o=new THREE.UV(1-x,v),v=new THREE.UV(1-u,v),u=new THREE.UV(1-u,w),D=new THREE.UV(1-x,w);e<c.length-1&&(w=this.vertices[j].position.clone(),x=this.vertices[m].position.clone(),y=this.vertices[n].position.clone(),w.normalize(),x.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,m,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([o,v,u]));e>1&&(w=
- this.vertices[j].position.clone(),x=this.vertices[n].position.clone(),y=this.vertices[p].position.clone(),w.normalize(),x.normalize(),y.normalize(),this.faces.push(new THREE.Face3(j,n,p,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([o,u,D]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
- THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
- THREE.TextGeometry.prototype.set=function(b,c){function e(b,e,c){x.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function f(b,e,c,f){x.faces.push(new THREE.Face4(b,e,c,f))}this.text=b;var c=c||this.parameters,g=c.height!==void 0?c.height:50,h=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",n=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,o=c.bezelSize!==void 0?c.bezelSize:8,u=c.bezelEnabled!==
- void 0?c.bezelEnabled:!1;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=h;THREE.FontUtils.face=j;THREE.FontUtils.weight=m;THREE.FontUtils.style=n;THREE.FontUtils.bezelSize=o;var m=THREE.FontUtils.drawText(b),h=m.points,v=m.faces,j=m.contour,w=m.bezel,x=this;x.vertices=[];x.faces=[];for(var y,n=h.length,D=v.length,o=w.length,m=0;m<n;m++)y=h[m],e(y.x,y.y,0);for(m=0;m<n;m++)y=h[m],e(y.x,y.y,g);if(u){for(m=0;m<o;m++)y=w[m],e(y.x,y.y,p);for(m=0;m<o;m++)y=w[m],e(y.x,y.y,g-p)}for(m=
- 0;m<D;m++)g=v[m],x.faces.push(new THREE.Face3(g[2],g[1],g[0]));for(m=0;m<D;m++)g=v[m],x.faces.push(new THREE.Face3(g[0]+n,g[1]+n,g[2]+n));var A;if(u)for(m=w.length;--m>0;){if(A){if(A.equals(j[m])){A=null;continue}}else A=j[m];p=n*2+m;v=p-1;f(p,v,v+o,p+o);for(u=0;u<n;u++)if(h[u].equals(j[m]))break;for(g=0;g<n;g++)if(h[g].equals(j[m-1]))break;f(u,g,v,p);f(p+o,v+o,g+n,u+n)}else for(m=j.length;--m>0;){if(A){if(A.equals(j[m])){A=null;continue}}else A=j[m];for(u=0;u<n;u++)if(h[u].equals(j[m]))break;for(g=
- 0;g<n;g++)if(h[g].equals(j[m-1]))break;f(u,g,g+n,u+n)}this.computeCentroids();this.computeFaceNormals()};
- THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
- {points:b,faces:[]};for(var e,f,g,h,j,m=[],n=0;n<c.length;n++){j=c[n];h=[];for(e=0;e<j.length;e++)f=j[e],h.push(f.x+","+f.y);var p;e=h.slice(1).indexOf(h[0]);var o=this.Triangulate.area(j.slice(0,e+1))<0;f=[];for(e=-1;e<h.length;){p=e+1;e=h[p];e=h.slice(p+1).indexOf(e)+p;if(e<=p)break;var u=j.slice(p,e+1);o?this.Triangulate.area(u)<0?(p>0&&m.push({shape:g,holes:f}),g=u,f=[]):f.push(u):this.Triangulate.area(u)<0?(m.push({shape:u,holes:f}),f=[]):f.push(u);e++}o&&m.push({shape:g,holes:f})}var v,w,x,
- y,D,A;h=[];for(j=0;j<m.length;j++){n=m[j];g=n.shape;f=n.holes;for(p=0;p<f.length;p++){o=f[p];x=Number.POSITIVE_INFINITY;for(u=0;u<o.length;u++){D=o[u];for(e=0;e<g.length;e++)y=g[e],y=D.distanceTo(y),y<x&&(x=y,v=u,w=e)}e=w-1>=0?w-1:g.length-1;var u=v-1>=0?v-1:o.length-1,H=[];H.push(o[v]);H.push(g[w]);H.push(g[e]);x=this.Triangulate.area(H);var C=[];C.push(o[v]);C.push(o[u]);C.push(g[w]);D=this.Triangulate.area(C);y=w;A=v;w+=1;v+=-1;w<0&&(w+=g.length);w%=g.length;v<0&&(v+=o.length);v%=g.length;e=w-
- 1>=0?w-1:g.length-1;u=v-1>=0?v-1:o.length-1;H=[];H.push(o[v]);H.push(g[w]);H.push(g[e]);H=this.Triangulate.area(H);C=[];C.push(o[v]);C.push(o[u]);C.push(g[w]);C=this.Triangulate.area(C);x+D>H+C&&(w=y,v=A,w<0&&(w+=g.length),w%=g.length,v<0&&(v+=o.length),v%=g.length,e=w-1>=0?w-1:g.length-1,u=v-1>=0?v-1:o.length-1);x=g.slice(0,w);D=g.slice(w);y=o.slice(v);A=o.slice(0,v);h.push(o[v]);h.push(g[w]);h.push(g[e]);h.push(o[v]);h.push(o[u]);h.push(g[w]);g=x.concat(y).concat(A).concat(D)}n.shape=g}v=[];w=[];
- for(j=p=0;j<m.length;j++){n=m[j];g=n.shape;v=v.concat(g);o=THREE.FontUtils.Triangulate(g,!0);for(f=0;f<o.length;f++)n=o[f],n[0]+=p,n[1]+=p,n[2]+=p;w=w.concat(o);p+=g.length}var E;for(f=0;f<h.length/3;f++){n=[];for(m=0;m<3;m++){j=!1;for(g=0;g<v.length&&!j;g++)E=f*3+m,v[g].equals(h[E])&&(n.push(g),j=!0);j||(v.push(h[E]),n.push(v.length-1),console.log("not found"))}w.push(n)}return{points:v,faces:w}},drawText:function(b){var c=[],e=[],f,g=this.getFace(),h=this.size/g.resolution,j=0;f=String(b).split("");
- for(var m=f.length,n=new THREE.Path,b=0;b<m;b++){var p=this.extractGlyphPoints(f[b],g,h,j,n);j+=p.offset;c.push(p.points);e=e.concat(p.points)}console.log(n);b=j/2;for(f=0;f<e.length;f++)e[f].x-=b;c=this.extractPoints(e,c);c.contour=e;g=[];h=[];f=[];for(var j=[],m=new THREE.Vector2,o,b=e.length;--b>=0;){if(o){if(o.equals(e[b])){o=null;n=this.Triangulate.area(f)>0;j.push(n);h.push(m.divideScalar(f.length));f=[];m=new THREE.Vector2;continue}}else o=e[b];m.addSelf(e[b]);f.push(e[b])}b=e.length;for(f=
- 0;--b>=0;)n=e[b],m=h[f],n=n.clone().subSelf(m),p=this.bezelSize/n.length(),j[f]?p+=1:p=1-p,p=n.multiplyScalar(p).addSelf(m),g.unshift(p),o?o.equals(e[b])&&(o=null,f++):o=e[b];c.bezel=g;return c},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*
- (1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)},extractGlyphPoints:function(b,c,e,f,g){var h=[],j,m,n,p,o,u,v,w,x,y,D=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(D){if(D.o){c=D._cachedOutline||(D._cachedOutline=D.o.split(" "));n=c.length;for(b=0;b<n;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,p));g.moveTo(m,p);break;case "l":m=c[b++]*e+f;p=c[b++]*e;h.push(new THREE.Vector2(m,
- p));g.lineTo(m,p);break;case "q":m=c[b++]*e+f;p=c[b++]*e;v=c[b++]*e+f;w=c[b++]*e;g.quadraticCurveTo(v,w,m,p);if(j=h[h.length-1]){o=j.x;u=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++){var A=j/divisions,H=THREE.FontUtils.b2(A,o,v,m),A=THREE.FontUtils.b2(A,u,w,p);h.push(new THREE.Vector2(H,A))}}break;case "b":if(m=c[b++]*e+f,p=c[b++]*e,v=c[b++]*e+f,w=c[b++]*-e,x=c[b++]*e+f,y=c[b++]*-e,g.bezierCurveTo(m,p,v,w,x,y),j=h[h.length-1]){o=j.x;u=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++)A=
- j/divisions,H=THREE.FontUtils.b3(A,o,v,x,m),A=THREE.FontUtils.b3(A,u,w,y,p),h.push(new THREE.Vector2(H,A))}}}return{offset:D.ha*e,points:h,path:g}}}};
- (function(b){var c=function(b){for(var c=b.length,g=0,h=c-1,j=0;j<c;h=j++)g+=b[h].x*b[j].y-b[j].x*b[h].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var h=[],j=[],m=[],n,p,o;if(c(b)>0)for(p=0;p<g;p++)j[p]=p;else for(p=0;p<g;p++)j[p]=g-1-p;var u=2*g;for(p=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return h}n=p;g<=n&&(n=0);p=n+1;g<=p&&(p=0);o=p+1;g<=o&&(o=0);var v;a:{v=b;var w=n,x=p,y=o,D=g,A=j,H=void 0,C=void 0,E=void 0,
- I=void 0,J=void 0,S=void 0,R=void 0,N=void 0,F=void 0,C=v[A[w]].x,E=v[A[w]].y,I=v[A[x]].x,J=v[A[x]].y,S=v[A[y]].x,R=v[A[y]].y;if(1.0E-10>(I-C)*(R-E)-(J-E)*(S-C))v=!1;else{for(H=0;H<D;H++)if(!(H==w||H==x||H==y)){var N=v[A[H]].x,F=v[A[H]].y,W=void 0,K=void 0,X=void 0,Q=void 0,U=void 0,k=void 0,ia=void 0,L=void 0,ga=void 0,fa=void 0,$=void 0,ha=void 0,W=X=U=void 0,W=S-I,K=R-J,X=C-S,Q=E-R,U=I-C,k=J-E,ia=N-C,L=F-E,ga=N-I,fa=F-J,$=N-S,ha=F-R,W=W*fa-K*ga,U=U*L-k*ia,X=X*ha-Q*$;if(W>=0&&X>=0&&U>=0){v=!1;break a}}v=
- !0}}if(v){h.push([b[j[n]],b[j[p]],b[j[o]]]);m.push([j[n],j[p],j[o]]);n=p;for(o=p+1;o<g;n++,o++)j[n]=j[o];g--;u=2*g}}if(f)return m;return h};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
- THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
- 1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,j=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,h,j));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[h][0],b[h][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
- THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
- THREE.TorusKnotGeometry=function(b,c,e,f,g,h,j){function m(b,e,c,f,h,g){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(b),h*(2+c)*Math.sin(b)*0.5,g*h*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=h||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
- this.segmentsT;++c){var n=b/this.segmentsR*2*this.p*Math.PI,j=c/this.segmentsT*2*Math.PI,g=m(n,j,this.q,this.p,this.radius,this.heightScale),n=m(n+0.01,j,this.q,this.p,this.radius,this.heightScale);e.x=n.x-g.x;e.y=n.y-g.y;e.z=n.z-g.z;f.x=n.x+g.x;f.y=n.y+g.y;f.z=n.z+g.z;h.cross(e,f);f.cross(h,e);h.normalize();f.normalize();n=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);g.x+=n*f.x+j*h.x;g.y+=n*f.y+j*h.y;g.z+=n*f.z+j*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
- g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,h=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][h],h=this.grid[b][h],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),n=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,h));this.faceVertexUvs[0].push([j,n,p,o])}this.computeCentroids();
- this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
- THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
- this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
- new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,h,g,j,m){var n=document.createElement("canvas");b[e]=new THREE.Texture(n);b[e].sourceFile=h;if(g){b[e].repeat.set(g[0],g[1]);if(g[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(g[1]!=
- 1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(m){g={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(g[m[0]]!==void 0)b[e].wrapS=g[m[0]];if(g[m[1]]!==void 0)b[e].wrapT=g[m[1]]}f(b[e],c+"/"+h)}function h(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var j,m,n;m="MeshLambertMaterial";j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
- if(b.blending)if(b.blending=="Additive")j.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")j.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")j.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)j.transparent=b.transparent;if(b.depthTest!==void 0)j.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(b.vertexColors)j.vertexColors=THREE.VertexColors;if(b.colorDiffuse)j.color=h(b.colorDiffuse);
- else if(b.DbgColor)j.color=b.DbgColor;if(b.colorSpecular)j.specular=h(b.colorSpecular);if(b.colorAmbient)j.ambient=h(b.colorAmbient);if(b.transparency)j.opacity=b.transparency;if(b.specularCoef)j.shininess=b.specularCoef;b.mapDiffuse&&c&&g(j,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(j,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(j,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
- b.mapSpecular&&c&&g(j,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var p=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(p.uniforms),u=j.color;m=j.specular;n=j.ambient;var v=j.shininess;o.tNormal.texture=j.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(j.map)o.tDiffuse.texture=j.map,o.enableDiffuse.value=!0;if(j.specularMap)o.tSpecular.texture=j.specularMap,o.enableSpecular.value=!0;if(j.lightMap)o.tAO.texture=
- j.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(u);o.uSpecularColor.value.setHex(m);o.uAmbientColor.value.setHex(n);o.uShininess.value=v;if(j.opacity)o.uOpacity.value=j.opacity;j=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:o,lights:!0,fog:!0})}else j=new THREE[m](j);return j}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
- THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
- THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,g,n,p,o,u,v,w,x,y,D,A,H,C,E=b.faces;u=b.vertices;var I=b.normals,J=b.colors,S=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&S++;for(c=0;c<S;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];p=0;for(o=u.length;p<o;)v=new THREE.Vertex,v.position.x=u[p++]*e,v.position.y=
- u[p++]*e,v.position.z=u[p++]*e,f.vertices.push(v);p=0;for(o=E.length;p<o;){e=E[p++];u=e&1;n=e&2;c=e&4;g=e&8;w=e&16;v=e&32;y=e&64;e&=128;u?(D=new THREE.Face4,D.a=E[p++],D.b=E[p++],D.c=E[p++],D.d=E[p++],u=4):(D=new THREE.Face3,D.a=E[p++],D.b=E[p++],D.c=E[p++],u=3);if(n)n=E[p++],D.materials=f.materials[n];n=f.faces.length;if(c)for(c=0;c<S;c++)A=b.uvs[c],x=E[p++],C=A[x*2],x=A[x*2+1],f.faceUvs[c][n]=new THREE.UV(C,x);if(g)for(c=0;c<S;c++){A=b.uvs[c];H=[];for(g=0;g<u;g++)x=E[p++],C=A[x*2],x=A[x*2+1],H[g]=
- new THREE.UV(C,x);f.faceVertexUvs[c][n]=H}if(w)w=E[p++]*3,g=new THREE.Vector3,g.x=I[w++],g.y=I[w++],g.z=I[w],D.normal=g;if(v)for(c=0;c<u;c++)w=E[p++]*3,g=new THREE.Vector3,g.x=I[w++],g.y=I[w++],g.z=I[w],D.vertexNormals.push(g);if(y)v=E[p++],v=new THREE.Color(J[v]),D.color=v;if(e)for(c=0;c<u;c++)v=E[p++],v=new THREE.Color(J[v]),D.vertexColors.push(v);f.faces.push(D)}}})(g);(function(){var c,e,g,n;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],n=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
- n,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],n=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,n,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,n,p,o,u,v,w,x;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];w=f.morphTargets[e].vertices;x=b.morphTargets[e].vertices;n=0;for(p=x.length;n<p;n+=3)o=x[n]*c,u=x[n+1]*
- c,v=x[n+2]*c,w.push(new THREE.Vertex(new THREE.Vector3(o,u,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];p=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(n=o.length;c<n;c+=3)u=new THREE.Color(16755200),u.setRGB(o[c],o[c+1],o[c+2]),p.push(u)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
- f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
- THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
- c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,h){var j=new XMLHttpRequest,m=f+"/"+b,n=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,e,g,c):alert("Couldn't load ["+m+"] ["+j.status+"]"):j.readyState==3?h&&(n==0&&(n=j.getResponseHeader("Content-Length")),h({total:n,loaded:j.responseText.length})):j.readyState==2&&(n=j.getResponseHeader("Content-Length"))};j.open("GET",m,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
- j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function n(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function p(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
- c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+J);h=g(b,c+S);c=n(b,c+R);THREE.BinaryLoader.prototype.f3(A,e,f,h,c)}function v(c){var e,f,h,j,k,o;e=g(b,c);f=g(b,c+J);h=g(b,c+S);j=n(b,c+R);k=g(b,c+N);o=g(b,c+F);c=g(b,c+W);THREE.BinaryLoader.prototype.f3n(A,E,e,f,h,j,k,o,c)}function w(c){var e,f,h,j;e=g(b,c);f=g(b,c+K);h=g(b,c+X);j=g(b,c+Q);c=n(b,c+U);THREE.BinaryLoader.prototype.f4(A,e,f,h,j,c)}function x(c){var e,f,h,j,o,p,u,v;e=g(b,c);f=g(b,c+K);h=g(b,c+X);j=g(b,c+Q);o=n(b,
- c+U);p=g(b,c+k);u=g(b,c+ia);v=g(b,c+L);c=g(b,c+ga);THREE.BinaryLoader.prototype.f4n(A,E,e,f,h,j,o,p,u,v,c)}function y(c){var e,f;e=g(b,c);f=g(b,c+fa);c=g(b,c+$);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[c*2],I[c*2+1])}function D(c){var e,f,h;e=g(b,c);f=g(b,c+ha);h=g(b,c+ja);c=g(b,c+ma);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[h*2],I[h*2+1],I[c*2],I[c*2+1])}var A=this,H=0,C,E=[],I=[],J,S,R,N,F,W,K,X,Q,U,k,ia,L,
- ga,fa,$,ha,ja,ma,ra,T,ka,ca,oa,da;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);C={signature:b.substr(H,8),header_bytes:o(b,H+8),vertex_coordinate_bytes:o(b,H+9),normal_coordinate_bytes:o(b,H+10),uv_coordinate_bytes:o(b,H+11),vertex_index_bytes:o(b,H+12),normal_index_bytes:o(b,H+13),uv_index_bytes:o(b,H+14),material_index_bytes:o(b,H+15),nvertices:g(b,H+16),nnormals:g(b,H+16+4),nuvs:g(b,H+16+8),ntri_flat:g(b,H+16+12),ntri_smooth:g(b,H+16+16),ntri_flat_uv:g(b,H+16+20),ntri_smooth_uv:g(b,
- H+16+24),nquad_flat:g(b,H+16+28),nquad_smooth:g(b,H+16+32),nquad_flat_uv:g(b,H+16+36),nquad_smooth_uv:g(b,H+16+40)};H+=C.header_bytes;J=C.vertex_index_bytes;S=C.vertex_index_bytes*2;R=C.vertex_index_bytes*3;N=C.vertex_index_bytes*3+C.material_index_bytes;F=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;W=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;K=C.vertex_index_bytes;X=C.vertex_index_bytes*2;Q=C.vertex_index_bytes*3;U=C.vertex_index_bytes*4;k=C.vertex_index_bytes*
- 4+C.material_index_bytes;ia=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;L=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ga=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;fa=C.uv_index_bytes;$=C.uv_index_bytes*2;ha=C.uv_index_bytes;ja=C.uv_index_bytes*2;ma=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;da=C.vertex_index_bytes*4+C.material_index_bytes;ra=C.ntri_flat*c;T=C.ntri_smooth*(c+C.normal_index_bytes*3);ka=
- C.ntri_flat_uv*(c+C.uv_index_bytes*3);ca=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);oa=C.nquad_flat*da;c=C.nquad_smooth*(da+C.normal_index_bytes*4);da=C.nquad_flat_uv*(da+C.uv_index_bytes*4);H+=function(c){for(var f,g,h,k=C.vertex_coordinate_bytes*3,m=c+C.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+C.vertex_coordinate_bytes),h=e(b,c+C.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(A,f,g,h);return C.nvertices*k}(H);H+=function(c){for(var e,f,g,h=C.normal_coordinate_bytes*3,
- j=c+C.nnormals*h;c<j;c+=h)e=p(b,c),f=p(b,c+C.normal_coordinate_bytes),g=p(b,c+C.normal_coordinate_bytes*2),E.push(e/127,f/127,g/127);return C.nnormals*h}(H);H+=function(c){for(var f,g,h=C.uv_coordinate_bytes*2,k=c+C.nuvs*h;c<k;c+=h)f=e(b,c),g=e(b,c+C.uv_coordinate_bytes),I.push(f,g);return C.nuvs*h}(H);ra=H+ra;T=ra+T;ka=T+ka;ca=ka+ca;oa=ca+oa;c=oa+c;da=c+da;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=e+C.uv_index_bytes*3,g=b+C.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),y(c+e);return g-
- b})(T);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,g=b+C.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),y(c+e);return g-b})(ka);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,g=b+C.nquad_flat_uv*f;for(c=b;c<g;c+=f)w(c),D(c+e);return g-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=e+C.uv_index_bytes*4,g=b+C.nquad_smooth_uv*f;for(c=b;c<g;c+=f)x(c),
- D(c+e);return g-b})(da);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(H);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(ra);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)w(c);return f-b})(ca);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
- 4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(oa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,h){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[h]))},
- f3n:function(b,c,e,f,g,h,j,m,n){var h=b.materials[h],p=c[m*3],o=c[m*3+1],m=c[m*3+2],u=c[n*3],v=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,o,m),new THREE.Vector3(u,v,n)],null,h))},f4n:function(b,c,e,f,g,h,j,m,n,p,o){var j=b.materials[j],u=c[n*3],v=c[n*3+1],n=c[n*3+2],w=c[p*3],x=c[p*3+1],p=c[p*3+2],y=c[o*3],D=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,h,[new THREE.Vector3(c[m*3],c[m*3+1],c[m*3+2]),new THREE.Vector3(u,
- v,n),new THREE.Vector3(w,x,p),new THREE.Vector3(y,D,o)],null,j))},uv3:function(b,c,e,f,g,h,j){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(h,j));b.push(m)},uv4:function(b,c,e,f,g,h,j,m,n){var p=[];p.push(new THREE.UV(c,e));p.push(new THREE.UV(f,g));p.push(new THREE.UV(h,j));p.push(new THREE.UV(m,n));b.push(p)}};
- THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
- THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function m(){for(w in K.objects)if(!L.objects[w])if(H=K.objects[w],H.geometry!==void 0){if(J=L.geometries[H.geometry]){var b=!1;F=[];for(fa=0;fa<H.materials.length;fa++)F[fa]=L.materials[H.materials[fa]],b=F[fa]instanceof THREE.MeshShaderMaterial;b&&J.computeTangents();C=H.position;r=
- H.rotation;q=H.quaternion;s=H.scale;q=0;F.length==0&&(F[0]=new THREE.MeshFaceMaterial);F.length>1&&(F=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(J,F);object.name=w;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=H.visible;L.scene.addObject(object);L.objects[w]=object;H.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),L.scene.collisions.colliders.push(b));
- if(H.castsShadow)b=new THREE.ShadowVolume(J),L.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}}else C=H.position,r=H.rotation,q=H.quaternion,s=H.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
- s[1],s[2]),object.visible=H.visible!==void 0?H.visible:!1,L.scene.addObject(object),L.objects[w]=object,L.empties[w]=object,H.trigger&&H.trigger.toLowerCase()!="none"&&(b={type:H.trigger,object:H},L.triggers[object.name]=b)}function n(b){return function(c){L.geometries[b]=c;m();Q-=1;e.onLoadComplete();o()}}function p(b){return function(c){L.geometries[b]=c}}function o(){e.callbackProgress({totalModels:k,totalTextures:ia,loadedModels:k-Q,loadedTextures:ia-U},L);e.onLoadProgress();Q==0&&U==0&&c(L)}
- var u,v,w,x,y,D,A,H,C,E,I,J,S,R,N,F,W,K,X,Q,U,k,ia,L;K=b.data;N=new THREE.BinaryLoader;X=new THREE.JSONLoader;U=Q=0;L={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in K.objects)if(H=K.objects[w],H.meshCollider){b=!0;break}if(b)L.scene.collisions=new THREE.CollisionSystem;if(K.transform){b=K.transform.position;E=K.transform.rotation;var ga=K.transform.scale;b&&L.scene.position.set(b[0],b[1],b[2]);E&&L.scene.rotation.set(E[0],
- E[1],E[2]);ga&&L.scene.scale.set(ga[0],ga[1],ga[2]);(b||E||ga)&&L.scene.updateMatrix()}b=function(){U-=1;o();e.onLoadComplete()};for(y in K.cameras){E=K.cameras[y];if(E.type=="perspective")S=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")S=new THREE.Camera,S.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;S.position.set(C[0],C[1],C[2]);S.target.position.set(E[0],E[1],E[2]);L.cameras[y]=S}for(x in K.lights)y=K.lights[x],
- S=y.color!==void 0?y.color:16777215,E=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(C=y.direction,W=new THREE.DirectionalLight(S,E),W.position.set(C[0],C[1],C[2]),W.position.normalize()):y.type=="point"?(C=y.position,d=y.distance,W=new THREE.PointLight(S,E,d),W.position.set(C[0],C[1],C[2])):y.type=="ambient"&&(W=new THREE.AmbientLight(S)),L.scene.addLight(W),L.lights[x]=W;for(D in K.fogs)x=K.fogs[D],x.type=="linear"?R=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(R=new THREE.FogExp2(0,
- x.density)),E=x.color,R.color.setRGB(E[0],E[1],E[2]),L.fogs[D]=R;if(L.cameras&&K.defaults.camera)L.currentCamera=L.cameras[K.defaults.camera];if(L.fogs&&K.defaults.fog)L.scene.fog=L.fogs[K.defaults.fog];E=K.defaults.bgcolor;L.bgColor=new THREE.Color;L.bgColor.setRGB(E[0],E[1],E[2]);L.bgColorAlpha=K.defaults.bgalpha;for(u in K.geometries)if(D=K.geometries[u],D.type=="bin_mesh"||D.type=="ascii_mesh")Q+=1,e.onLoadStart();k=Q;for(u in K.geometries)D=K.geometries[u],D.type=="cube"?(J=new THREE.CubeGeometry(D.width,
- D.height,D.depth,D.segmentsWidth,D.segmentsHeight,D.segmentsDepth,null,D.flipped,D.sides),L.geometries[u]=J):D.type=="plane"?(J=new THREE.PlaneGeometry(D.width,D.height,D.segmentsWidth,D.segmentsHeight),L.geometries[u]=J):D.type=="sphere"?(J=new THREE.SphereGeometry(D.radius,D.segmentsWidth,D.segmentsHeight),L.geometries[u]=J):D.type=="cylinder"?(J=new THREE.CylinderGeometry(D.numSegs,D.topRad,D.botRad,D.height,D.topOffset,D.botOffset),L.geometries[u]=J):D.type=="torus"?(J=new THREE.TorusGeometry(D.radius,
- D.tube,D.segmentsR,D.segmentsT),L.geometries[u]=J):D.type=="icosahedron"?(J=new THREE.IcosahedronGeometry(D.subdivisions),L.geometries[u]=J):D.type=="bin_mesh"?N.load({model:f(D.url,K.urlBaseType),callback:n(u)}):D.type=="ascii_mesh"?X.load({model:f(D.url,K.urlBaseType),callback:n(u)}):D.type=="embedded_mesh"&&(D=K.embeds[D.id])&&X.createModel(D,p(u),"");for(A in K.textures)if(u=K.textures[A],u.url instanceof Array){U+=u.url.length;for(N=0;N<u.url.length;N++)e.onLoadStart()}else U+=1,e.onLoadStart();
- ia=U;for(A in K.textures){u=K.textures[A];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){N=[];for(var fa=0;fa<u.url.length;fa++)N[fa]=f(u.url[fa],K.urlBaseType);N=THREE.ImageUtils.loadTextureCube(N,u.mapping,b)}else{N=THREE.ImageUtils.loadTexture(f(u.url,K.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)N.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)N.magFilter=THREE[u.magFilter];if(u.repeat){N.repeat.set(u.repeat[0],
- u.repeat[1]);if(u.repeat[0]!=1)N.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)N.wrapT=THREE.RepeatWrapping}u.offset&&N.offset.set(u.offset[0],u.offset[1]);if(u.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[u.wrap[0]]!==void 0)N.wrapS=X[u.wrap[0]];if(X[u.wrap[1]]!==void 0)N.wrapT=X[u.wrap[1]]}}L.textures[A]=N}for(v in K.materials){A=K.materials[v];for(I in A.parameters)if(I=="envMap"||I=="map"||I=="lightMap")A.parameters[I]=L.textures[A.parameters[I]];else if(I=="shading")A.parameters[I]=
- A.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")A.parameters[I]=THREE[A.parameters[I]]?THREE[A.parameters[I]]:THREE.NormalBlending;else if(I=="combine")A.parameters[I]=A.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I=="vertexColors")if(A.parameters[I]=="face")A.parameters[I]=THREE.FaceColors;else if(A.parameters[I])A.parameters[I]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
- !0;if(A.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);N=A.parameters.color;X=A.parameters.specular;D=A.parameters.ambient;R=A.parameters.shininess;b.tNormal.texture=L.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)b.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)b.tDiffuse.texture=A.parameters.map,b.enableDiffuse.value=!0;if(A.parameters.lightMap)b.tAO.texture=A.parameters.lightMap,b.enableAO.value=!0;if(A.parameters.specularMap)b.tSpecular.texture=
- L.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(N);b.uSpecularColor.value.setHex(X);b.uAmbientColor.value.setHex(D);b.uShininess.value=R;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);L.materials[v]=A}m();e.callbackSync(L)}}};
- THREE.MarchingCubes=function(b,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.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m+j*this.delta;c[h+1]=n;c[h+2]=p;g[h]=this.lerp(o[b],o[b+3],j);g[h+1]=this.lerp(o[b+1],o[b+4],j);g[h+2]=this.lerp(o[b+2],o[b+5],j)};this.VIntY=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m;c[h+1]=n+j*this.delta;c[h+
- 2]=p;c=b+this.yd*3;g[h]=this.lerp(o[b],o[c],j);g[h+1]=this.lerp(o[b+1],o[c+1],j);g[h+2]=this.lerp(o[b+2],o[c+2],j)};this.VIntZ=function(b,c,g,h,j,m,n,p,o,u){j=(j-o)/(u-o);o=this.normal_cache;c[h]=m;c[h+1]=n;c[h+2]=p+j*this.delta;c=b+this.zd*3;g[h]=this.lerp(o[b],o[c],j);g[h+1]=this.lerp(o[b+1],o[c+1],j);g[h+2]=this.lerp(o[b+2],o[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
- this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,h,j,m){var n=h+1,p=h+this.yd,o=h+this.zd,u=n+this.yd,v=n+this.zd,w=h+this.yd+this.zd,x=n+this.yd+this.zd,y=0,D=this.field[h],A=this.field[n],H=this.field[p],C=this.field[u],E=this.field[o],I=this.field[v],J=this.field[w],S=this.field[x];D<j&&(y|=1);A<j&&(y|=2);H<j&&(y|=8);C<j&&(y|=4);E<j&&(y|=16);I<j&&(y|=32);J<j&&(y|=128);S<j&&(y|=64);var R=THREE.edgeTable[y];if(R==0)return 0;var N=this.delta,
- F=b+N,W=c+N,N=g+N;R&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,j,b,c,g,D,A));R&2&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,3,j,F,c,g,A,C));R&4&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,6,j,b,W,g,H,C));R&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,j,b,c,g,D,H));R&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,j,b,c,N,E,I));R&32&&(this.compNorm(v),
- this.compNorm(x),this.VIntY(v*3,this.vlist,this.nlist,15,j,F,c,N,I,S));R&64&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,18,j,b,W,N,J,S));R&128&&(this.compNorm(o),this.compNorm(w),this.VIntY(o*3,this.vlist,this.nlist,21,j,b,c,N,E,J));R&256&&(this.compNorm(h),this.compNorm(o),this.VIntZ(h*3,this.vlist,this.nlist,24,j,b,c,g,D,E));R&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,j,F,c,g,A,I));R&1024&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*
- 3,this.vlist,this.nlist,30,j,F,W,g,C,S));R&2048&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,33,j,b,W,g,H,J));y<<=4;for(j=h=0;THREE.triTable[y+j]!=-1;)b=y+j,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],m),j+=3,h++;return h};this.posnormtriv=function(b,c,g,h,j,m){var n=this.count*3;this.positionArray[n]=b[g];this.positionArray[n+1]=b[g+1];this.positionArray[n+2]=b[g+2];this.positionArray[n+3]=b[h];this.positionArray[n+
- 4]=b[h+1];this.positionArray[n+5]=b[h+2];this.positionArray[n+6]=b[j];this.positionArray[n+7]=b[j+1];this.positionArray[n+8]=b[j+2];this.normalArray[n]=c[g];this.normalArray[n+1]=c[g+1];this.normalArray[n+2]=c[g+2];this.normalArray[n+3]=c[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[j];this.normalArray[n+7]=c[j+1];this.normalArray[n+8]=c[j+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
- this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,h,j){var m=this.size*Math.sqrt(h/j),n=g*this.size,p=c*this.size,o=b*this.size,u=Math.floor(n-m);u<1&&(u=1);n=Math.floor(n+m);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var w=Math.floor(o-m);w<1&&(w=1);m=Math.floor(o+m);m>this.size-1&&(m=this.size-
- 1);for(var x,y,D,A,H,C;u<n;u++){o=this.size2*u;y=u/this.size-g;H=y*y;for(y=v;y<p;y++){D=o+this.size*y;x=y/this.size-c;C=x*x;for(x=w;x<m;x++)A=x/this.size-b,A=h/(1.0E-6+A*A+C+H)-j,A>0&&(this.field[D+x]+=A)}}};this.addPlaneX=function(b,c){var g,h,j,m,n,p=this.size,o=this.yd,u=this.zd,v=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(g=0;g<w;g++)if(h=g/p,h*=h,m=b/(1.0E-4+h)-c,m>0)for(h=0;h<p;h++){n=g+h*o;for(j=0;j<p;j++)v[u*j+n]+=m}};this.addPlaneY=function(b,c){var g,h,j,m,n,p,o=this.size,u=this.yd,v=
- this.zd,w=this.field,x=o*Math.sqrt(b/c);x>o&&(x=o);for(h=0;h<x;h++)if(g=h/o,g*=g,m=b/(1.0E-4+g)-c,m>0){n=h*u;for(g=0;g<o;g++){p=n+g;for(j=0;j<o;j++)w[v*j+p]+=m}}};this.addPlaneZ=function(b,c){var g,h,j,m,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(g=j/size,g*=g,m=b/(1.0E-4+g)-c,m>0){n=zd*j;for(h=0;h<size;h++){p=n+h*yd;for(g=0;g<size;g++)field[p+g]+=m}}};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 c,g,h,j,m,n,p,o,u,v=this.size-2;for(j=1;j<v;j++){u=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(h=1;h<v;h++){o=u+this.size*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<v;g++)m=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(m,n,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(h){var j,m,n,p,o,u,v,w;for(j=0;j<h.count;j++)v=j*3,o=v+1,w=v+2,m=h.positionArray[v],
- n=h.positionArray[o],p=h.positionArray[w],u=new THREE.Vector3(m,n,p),m=h.normalArray[v],n=h.normalArray[o],p=h.normalArray[w],v=new THREE.Vector3(m,n,p),v.normalize(),o=new THREE.Vertex(u),c.vertices.push(o),g.push(v);nfaces=h.count/3;for(j=0;j<nfaces;j++)v=(b+j)*3,o=v+1,w=v+2,u=g[v],m=g[o],n=g[w],v=new THREE.Face3(v,o,w,[u,m,n]),c.faces.push(v);b+=nfaces;h.count=0});return c};this.init(b)};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]);
- THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,b.length/20,b.length/5),new THREE.MeshBasicMaterial({color:c}))}function e(b,c){var e=new THREE.Geometry;e.vertices=[new THREE.Vertex,new THREE.Vertex(b)];return new THREE.Line(e,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var f=Math.PI/2,g,b=b||THREE.Trident.defaultParams;if(b!==THREE.Trident.defaultParams)for(g in THREE.Trident.defaultParams)b.hasOwnProperty(g)||(b[g]=THREE.Trident.defaultParams[g]);
- this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(e(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(e(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(e(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)g=c(b.xAxisColor),g.rotation.y=-f,g.position.x=b.length,this.addChild(g),g=c(b.yAxisColor),g.rotation.x=f,g.position.y=b.length,this.addChild(g),g=c(b.zAxisColor),g.rotation.y=Math.PI,g.position.z=b.length,this.addChild(g)};
- THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:!0,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};
- THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
- THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,h=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>h?this.hits.push(g):this.hits.unshift(g),h=f;return this.hits};
- THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
- THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
- THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,h=0;h<c.numFaces;h++){var j=c.mesh.geometry.faces[h],m=c.mesh.geometry.vertices[j.a].position,n=c.mesh.geometry.vertices[j.b].position,p=c.mesh.geometry.vertices[j.c].position,o=j instanceof THREE.Face4?c.mesh.geometry.vertices[j.d].position:null;j instanceof THREE.Face3?(j=this.rayTriangle(e,m,n,p,f,this.collisionNormal,c.mesh),j<f&&(f=j,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
- j instanceof THREE.Face4&&(j=this.rayTriangle(e,m,n,o,f,this.collisionNormal,c.mesh),j<f&&(f=j,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),j=this.rayTriangle(e,n,p,o,f,this.collisionNormal,c.mesh),j<f&&(f=j,g=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
- THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,h,j){var m=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;h.set(0,0,0);m.sub(e,c);n.sub(f,e);h.cross(m,n);m=h.dot(b.direction);if(!(m<0))if(j.doubleSided||j.flipSided)h.multiplyScalar(-1),m*=-1;else return Number.MAX_VALUE;j=h.dot(c)-h.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=m*g))return Number.MAX_VALUE;j/=m;m=THREE.CollisionSystem.__v3;m.copy(b.direction);m.multiplyScalar(j);m.addSelf(b.origin);Math.abs(h.x)>
- Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=m.y-c.y,h=e.y-c.y,g=f.y-c.y,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=m.x-c.x,h=e.x-c.x,g=f.x-c.x,m=m.y-c.y,e=e.y-c.y,f=f.y-c.y);c=h*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-m*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*m-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return j};
- THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
- THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,h=0,j=0,m=0,n=0,p=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,p=!1,j=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,p=!1,j=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,p=!1,m=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
- p=!1,m=1);e.origin.z<c.min.z?(h=c.min.z-e.origin.z,h/=e.direction.z,p=!1,n=-1):e.origin.z>c.max.z&&(h=c.max.z-e.origin.z,h/=e.direction.z,p=!1,n=1);if(p)return-1;p=0;g>f&&(p=1,f=g);h>f&&(p=2,f=h);switch(p){case 0:m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=e.origin.x+e.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
- f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case 2:j=e.origin.x+e.direction.x*f;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;m=e.origin.y+e.direction.y*f;if(m<c.min.y||m>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
- THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
- THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
- THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
- if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,h=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,n,p,o;g.useTarget=h.useTarget=!1;g.matrixAutoUpdate=h.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.Camera(53,1,1,1E4);w.position.z=
- 2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
- var x=new THREE.Scene;x.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(n!==e.aspect||p!==e.near||o!==e.fov){n=e.aspect;p=e.near;o=e.fov;var A=e.projectionMatrix.clone(),H=125/30*0.5,C=H*p/125,E=p*Math.tan(o*Math.PI/360),I;j.n14=H;m.n14=-H;H=-E*n+C;I=E*n+C;A.n11=2*p/(I-H);A.n13=(I+H)/(I-H);g.projectionMatrix=A.clone();H=-E*n-C;I=E*n-C;A.n11=2*p/(I-H);
- A.n13=(I+H)/(I-H);h.projectionMatrix=A.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(m);g.update(null,!0);g.position.copy(e.position);g.near=p;g.far=e.far;f.call(c,b,g,u,!0);h.matrix=e.matrixWorld.clone().multiplySelf(j);h.update(null,!0);h.position.copy(e.position);h.near=p;h.far=e.far;f.call(c,b,h,v,!0);f.call(c,x,w)}};
- if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,h,j=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;h=f};this.render=function(b,e){this.clear();j.fov=e.fov;j.aspect=0.5*e.aspect;j.near=e.near;j.far=e.far;
- j.updateProjectionMatrix();j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(c.separation);m.projectionMatrix=j.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,g,h);f.call(c,b,j);this.setViewport(g,0,g,h);f.call(c,b,m,!1)}};
|