123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712 |
- // Three.js r46dev - http://github.com/mrdoob/three.js
- var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
- THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
- THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,h;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),h=c*(1-
- b*f),b=c*(1-b*(1-f)),e){case 1:this.r=h;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=h;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=h;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
- Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
- THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
- divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.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(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
- equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
- THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
- addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
- divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.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(a){return this.normalize().multiplyScalar(a)},
- cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){return this.set(this.y*a.z-this.z*a.y,this.z*a.x-this.x*a.z,this.x*a.y-this.y*a.x)},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);this.y=Math.asin(a.n13);
- Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==void 0?e:1};
- THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
- b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
- normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
- THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.objects)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,c){return a.distance-c.distance});return e},intersectObject:function(a){function b(a,c,b){var e;e=b.clone().subSelf(a).dot(c);if(e<=0)return null;a=a.clone().addSelf(c.clone().multiplyScalar(e));return b.distanceTo(a)}function c(a,c,b,e){var e=e.clone().subSelf(c),
- b=b.clone().subSelf(c),f=a.clone().subSelf(c),a=e.dot(e),c=e.dot(b),e=e.dot(f),k=b.dot(b),b=b.dot(f),f=1/(a*k-c*c),k=(k*e-c*b)*f,a=(a*b-c*e)*f;return k>0&&a>0&&k+a<1}for(var e,f=[],h=0,k=a.children.length;h<k;h++)Array.prototype.push.apply(f,this.intersectObject(a.children[h]));if(a instanceof THREE.Particle){h=b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.scale.x)return[];e={distance:h,point:a.position,face:null,object:a};f.push(e)}else if(a instanceof THREE.Mesh){h=
- b(this.origin,this.direction,a.matrixWorld.getPosition());if(h===null||h>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return f;for(var l,n,p,u,t,v,o,y,x=a.geometry,w=x.vertices,h=0,k=x.faces.length;h<k;h++)if(e=x.faces[h],o=this.origin.clone(),y=this.direction.clone(),u=a.matrixWorld,l=u.multiplyVector3(e.centroid.clone()).subSelf(o),v=l.dot(y),!(v<=0)&&(l=u.multiplyVector3(w[e.a].position.clone()),n=u.multiplyVector3(w[e.b].position.clone()),p=u.multiplyVector3(w[e.c].position.clone()),
- u=e instanceof THREE.Face4?u.multiplyVector3(w[e.d].position.clone()):null,t=a.matrixRotationWorld.multiplyVector3(e.normal.clone()),v=y.dot(t),a.doubleSided||(a.flipSided?v>0:v<0)))if(v=t.dot((new THREE.Vector3).sub(l,o))/v,o=o.addSelf(y.multiplyScalar(v)),e instanceof THREE.Face3)c(o,l,n,p)&&(e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e));else if(e instanceof THREE.Face4&&(c(o,l,n,u)||c(o,n,p,u)))e={distance:this.origin.distanceTo(o),point:o,face:e,object:a},f.push(e)}return f}};
- THREE.Rectangle=function(){function a(){h=e-b;k=f-c}var b,c,e,f,h,k,l=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(k,h,u,t){l=!1;b=k;c=h;e=u;f=t;a()};this.addPoint=function(k,h){l?(l=!1,b=k,c=h,e=k,f=h):(b=b<k?b:k,c=c<h?c:h,e=e>k?e:k,f=f>h?f:h);a()};this.add3Points=
- function(k,h,u,t,v,o){l?(l=!1,b=k<u?k<v?k:v:u<v?u:v,c=h<t?h<o?h:o:t<o?t:o,e=k>u?k>v?k:v:u>v?u:v,f=h>t?h>o?h:o:t>o?t:o):(b=k<u?k<v?k<b?k:b:v<b?v:b:u<v?u<b?u:b:v<b?v:b,c=h<t?h<o?h<c?h:c:o<c?o:c:t<o?t<c?t:c:o<c?o:c,e=k>u?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e,f=h>t?h>o?h>f?h:f:o>f?o:f:t>o?t>f?t:f:o>f?o:f);a()};this.addRectangle=function(k){l?(l=!1,b=k.getLeft(),c=k.getTop(),e=k.getRight(),f=k.getBottom()):(b=b<k.getLeft()?b:k.getLeft(),c=c<k.getTop()?c:k.getTop(),e=e>k.getRight()?e:k.getRight(),f=f>
- k.getBottom()?f:k.getBottom());a()};this.inflate=function(k){b-=k;c-=k;e+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c:k.getTop();e=e<k.getRight()?e:k.getRight();f=f<k.getBottom()?f:k.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){l=!0;f=e=c=b=0;a()};this.isEmpty=function(){return l}};
- THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,e,f){return e+(a-b)*(f-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
- THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
- THREE.Matrix4=function(a,b,c,e,f,h,k,l,n,p,u,t,v,o,y,x){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,k||0,l||0,n||0,p||0,u!==void 0?u:1,t||0,v||0,o||0,y||0,x!==void 0?x:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,k,l,n,p,u,t,v,o,y,x){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=k;this.n24=l;this.n31=n;this.n32=p;this.n33=u;this.n34=t;this.n41=v;this.n42=o;this.n43=y;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
- b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;
- a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+
- c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,n=a.n23,p=a.n24,u=a.n31,t=a.n32,v=a.n33,o=a.n34,y=a.n41,x=a.n42,w=a.n43,A=a.n44,z=b.n11,C=b.n12,
- B=b.n13,K=b.n14,F=b.n21,M=b.n22,E=b.n23,O=b.n24,V=b.n31,H=b.n32,P=b.n33,L=b.n34,T=b.n41,S=b.n42,m=b.n43,aa=b.n44;this.n11=c*z+e*F+f*V+h*T;this.n12=c*C+e*M+f*H+h*S;this.n13=c*B+e*E+f*P+h*m;this.n14=c*K+e*O+f*L+h*aa;this.n21=k*z+l*F+n*V+p*T;this.n22=k*C+l*M+n*H+p*S;this.n23=k*B+l*E+n*P+p*m;this.n24=k*K+l*O+n*L+p*aa;this.n31=u*z+t*F+v*V+o*T;this.n32=u*C+t*M+v*H+o*S;this.n33=u*B+t*E+v*P+o*m;this.n34=u*K+t*O+v*L+o*aa;this.n41=y*z+x*F+w*V+A*T;this.n42=y*C+x*M+w*H+A*S;this.n43=y*B+x*E+w*P+A*m;this.n44=y*
- K+x*O+w*L+A*aa;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=
- a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,k=this.n23,l=this.n24,n=this.n31,p=this.n32,u=this.n33,t=this.n34,v=this.n41,o=this.n42,y=this.n43,x=this.n44;return e*k*p*v-c*l*p*v-e*h*u*v+b*l*u*v+c*h*t*v-b*k*t*v-e*k*n*o+c*l*n*o+e*f*u*o-a*l*u*o-c*f*t*o+a*k*t*o+e*h*n*y-b*l*n*y-e*f*p*y+a*l*p*y+b*f*t*y-a*h*t*y-c*h*n*x+b*k*n*x+c*f*p*x-a*k*p*x-b*f*
- u*x+a*h*u*x},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=
- this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
- this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=
- this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,
- 0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,k=a.y,l=a.z,n=f*h,p=f*k;this.set(n*h+c,n*k-e*l,n*l+e*k,0,n*k+e*l,p*k+c,p*l-e*h,0,n*l-e*k,p*l+e*h,f*l*l+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.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(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),k=Math.cos(e),e=Math.sin(e),l=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var n=
- k*l,p=k*f,u=e*l,t=e*f;this.n11=n+t*c;this.n12=u*c-p;this.n13=h*e;this.n21=h*f;this.n22=h*l;this.n23=-c;this.n31=p*c-u;this.n32=t+n*c;this.n33=h*k;break;case "ZXY":n=k*l;p=k*f;u=e*l;t=e*f;this.n11=n-t*c;this.n12=-h*f;this.n13=u+p*c;this.n21=p+u*c;this.n22=h*l;this.n23=t-n*c;this.n31=-h*e;this.n32=c;this.n33=h*k;break;case "ZYX":n=h*l;p=h*f;u=c*l;t=c*f;this.n11=k*l;this.n12=u*e-p;this.n13=n*e+t;this.n21=k*f;this.n22=t*e+n;this.n23=p*e-u;this.n31=-e;this.n32=c*k;this.n33=h*k;break;case "YZX":n=h*k;p=
- h*e;u=c*k;t=c*e;this.n11=k*l;this.n12=t-n*f;this.n13=u*f+p;this.n21=f;this.n22=h*l;this.n23=-c*l;this.n31=-e*l;this.n32=p*f+u;this.n33=n-t*f;break;case "XZY":n=h*k;p=h*e;u=c*k;t=c*e;this.n11=k*l;this.n12=-f;this.n13=e*l;this.n21=n*f+t;this.n22=h*l;this.n23=p*f-u;this.n31=u*f-p;this.n32=c*l;this.n33=t*f+n;break;default:n=h*l,p=h*f,u=c*l,t=c*f,this.n11=k*l,this.n12=-k*f,this.n13=e,this.n21=p+u*e,this.n22=n-t*e,this.n23=-c*k,this.n31=t-n*e,this.n32=u+p*e,this.n33=h*k}return this},setRotationFromQuaternion:function(a){var b=
- a.x,c=a.y,e=a.z,f=a.w,h=b+b,k=c+c,l=e+e,a=b*h,n=b*k;b*=l;var p=c*k;c*=l;e*=l;h*=f;k*=f;f*=l;this.n11=1-(p+e);this.n12=n-f;this.n13=b+k;this.n21=n+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-k;this.n32=c+h;this.n33=1-(a+p);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;
- e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();
- c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,e=1/b.y,f=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=
- a.n23*f;this.n33=a.n33*f}};
- THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,k=a.n21,l=a.n22,n=a.n23,p=a.n24,u=a.n31,t=a.n32,v=a.n33,o=a.n34,y=a.n41,x=a.n42,w=a.n43,A=a.n44;b===void 0&&(b=new THREE.Matrix4);b.n11=n*o*x-p*v*x+p*t*w-l*o*w-n*t*A+l*v*A;b.n12=h*v*x-f*o*x-h*t*w+e*o*w+f*t*A-e*v*A;b.n13=f*p*x-h*n*x+h*l*w-e*p*w-f*l*A+e*n*A;b.n14=h*n*t-f*p*t-h*l*v+e*p*v+f*l*o-e*n*o;b.n21=p*v*y-n*o*y-p*u*w+k*o*w+n*u*A-k*v*A;b.n22=f*o*y-h*v*y+h*u*w-c*o*w-f*u*A+c*v*A;b.n23=h*n*y-f*p*y-h*k*w+c*p*w+f*k*A-c*n*A;b.n24=
- f*p*u-h*n*u+h*k*v-c*p*v-f*k*o+c*n*o;b.n31=l*o*y-p*t*y+p*u*x-k*o*x-l*u*A+k*t*A;b.n32=h*t*y-e*o*y-h*u*x+c*o*x+e*u*A-c*t*A;b.n33=f*p*y-h*l*y+h*k*x-c*p*x-e*k*A+c*l*A;b.n34=h*l*u-e*p*u-h*k*t+c*p*t+e*k*o-c*l*o;b.n41=n*t*y-l*v*y-n*u*x+k*v*x+l*u*w-k*t*w;b.n42=e*v*y-f*t*y+f*u*x-c*v*x-e*u*w+c*t*w;b.n43=f*l*y-e*n*y-f*k*x+c*n*x+e*k*w-c*l*w;b.n44=e*n*u-f*l*u+f*k*t-c*n*t-e*k*v+c*l*v;b.multiplyScalar(1/a.determinant());return b};
- THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,l=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*k+a.n31*p;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*k;c[4]=a*l;c[5]=a*n;c[6]=a*p;c[7]=a*u;c[8]=a*t;return b};
- THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var k;k=new THREE.Matrix4;k.n11=2*f/(b-a);k.n12=0;k.n13=(b+a)/(b-a);k.n14=0;k.n21=0;k.n22=2*f/(e-c);k.n23=(e+c)/(e-c);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+f)/(h-f);k.n34=-2*h*f/(h-f);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
- THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var k,l,n,p;k=new THREE.Matrix4;l=b-a;n=c-e;p=h-f;k.n11=2/l;k.n12=0;k.n13=0;k.n14=-((b+a)/l);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((c+e)/n);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+f)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
- THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;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.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
- THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
- -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addChildRecurse(a)}},remove:function(a){var b=this,c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;for(this.children.splice(c,1);b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeChildRecurse(a)}},getChildByName:function(a,b){var c,e,f;c=0;for(e=this.children.length;c<e;c++){f=this.children[c];if(f.name===
- a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},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(a,b,c){this.matrixAutoUpdate&&
- this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,b=!0;for(var a=0,e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,c)},addChild:function(a){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(a)},removeChild:function(a){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
- this.remove(a)}};THREE.Object3DCount=0;
- THREE.Projector=function(){function a(){var a=n[l]=n[l]||new THREE.RenderableVertex;l++;return a}function b(a,c){return c.z-a.z}function c(a,c){var b=0,e=1,f=a.z+a.w,k=c.z+c.w,h=-a.z+a.w,l=-c.z+c.w;return f>=0&&k>=0&&h>=0&&l>=0?!0:f<0&&k<0||h<0&&l<0?!1:(f<0?b=Math.max(b,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),h<0?b=Math.max(b,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),e<b?!1:(a.lerpSelf(c,b),c.lerpSelf(a,1-e),!0))}var e,f,h=[],k,l,n=[],p,u,t=[],v,o=[],y,x,w=[],A,z,C=[],B=[],K=[],F=new THREE.Vector4,M=new THREE.Vector4,
- E=new THREE.Matrix4,O=new THREE.Matrix4,V=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,P=new THREE.Vector4;this.projectVector=function(a,c){E.multiply(c.projectionMatrix,c.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,c){E.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));E.multiplyVector3(a);return a};this.pickingRay=function(a,c){var b;a.z=-1;b=new THREE.Vector3(a.x,
- a.y,1);this.unprojectVector(a,c);this.unprojectVector(b,c);b.subSelf(a).normalize();return new THREE.Ray(a,b)};this.projectObjects=function(a,c,k){var m,l;f=B.length=0;m=a.objects;a=0;for(c=m.length;a<c;a++){l=m[a];var n;if(!(n=!l.visible))if(n=l instanceof THREE.Mesh)if(n=l.frustumCulled){a:{n=void 0;for(var p=l.matrixWorld,o=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),t=0;t<6;t++)if(n=V[t].x*p.n14+V[t].y*p.n24+V[t].z*p.n34+V[t].w,n<=o){n=!1;break a}n=!0}n=
- !n}if(!n)n=h[f]=h[f]||new THREE.RenderableObject,f++,e=n,F.copy(l.position),E.multiplyVector3(F),e.object=l,e.z=F.z,B.push(e)}k&&B.sort(b);return B};this.projectScene=function(e,f,h){var m=f.near,B=f.far,F,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa,na,fa,qa,la;z=x=v=u=K.length=0;f.matrixAutoUpdate&&f.update(void 0,!0);e.update(void 0,!1,f);E.multiply(f.projectionMatrix,f.matrixWorldInverse);V[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);V[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);V[2].set(E.n41+
- E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);V[3].set(E.n41-E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);V[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);V[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(F=0;F<6;F++)R=V[F],R.divideScalar(Math.sqrt(R.x*R.x+R.y*R.y+R.z*R.z));R=this.projectObjects(e,f,!0);e=0;for(F=R.length;e<F;e++)if(Y=R[e].object,Y.visible)if(X=Y.matrixWorld,ga=Y.matrixRotationWorld,oa=Y.materials,na=Y.overdraw,l=0,Y instanceof THREE.Mesh){fa=Y.geometry;ia=fa.vertices;
- qa=fa.faces;fa=fa.faceVertexUvs;ea=0;for(da=ia.length;ea<da;ea++)k=a(),k.positionWorld.copy(ia[ea].position),X.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),E.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>m&&k.positionScreen.z<B;ia=0;for(ea=qa.length;ia<ea;ia++){da=qa[ia];if(da instanceof THREE.Face3)if(ha=n[da.a],ja=n[da.b],ca=n[da.c],ha.visible&&ja.visible&&ca.visible&&(Y.doubleSided||
- Y.flipSided!=(ca.positionScreen.x-ha.positionScreen.x)*(ja.positionScreen.y-ha.positionScreen.y)-(ca.positionScreen.y-ha.positionScreen.y)*(ja.positionScreen.x-ha.positionScreen.x)<0))Z=t[u]=t[u]||new THREE.RenderableFace3,u++,p=Z,p.v1.copy(ha),p.v2.copy(ja),p.v3.copy(ca);else continue;else if(da instanceof THREE.Face4)if(ha=n[da.a],ja=n[da.b],ca=n[da.c],Z=n[da.d],ha.visible&&ja.visible&&ca.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-ha.positionScreen.x)*(ja.positionScreen.y-
- ha.positionScreen.y)-(Z.positionScreen.y-ha.positionScreen.y)*(ja.positionScreen.x-ha.positionScreen.x)<0||(ja.positionScreen.x-ca.positionScreen.x)*(Z.positionScreen.y-ca.positionScreen.y)-(ja.positionScreen.y-ca.positionScreen.y)*(Z.positionScreen.x-ca.positionScreen.x)<0)))la=o[v]=o[v]||new THREE.RenderableFace4,v++,p=la,p.v1.copy(ha),p.v2.copy(ja),p.v3.copy(ca),p.v4.copy(Z);else continue;p.normalWorld.copy(da.normal);ga.multiplyVector3(p.normalWorld);p.centroidWorld.copy(da.centroid);X.multiplyVector3(p.centroidWorld);
- p.centroidScreen.copy(p.centroidWorld);E.multiplyVector3(p.centroidScreen);ca=da.vertexNormals;ha=0;for(ja=ca.length;ha<ja;ha++)Z=p.vertexNormalsWorld[ha],Z.copy(ca[ha]),ga.multiplyVector3(Z);ha=0;for(ja=fa.length;ha<ja;ha++)if(la=fa[ha][ia]){ca=0;for(Z=la.length;ca<Z;ca++)p.uvs[ha][ca]=la[ca]}p.meshMaterials=oa;p.faceMaterials=da.materials;p.overdraw=na;p.z=p.centroidScreen.z;K.push(p)}}else if(Y instanceof THREE.Line){O.multiply(E,X);ia=Y.geometry.vertices;ha=a();ha.positionScreen.copy(ia[0].position);
- O.multiplyVector4(ha.positionScreen);ea=1;for(da=ia.length;ea<da;ea++)if(ha=a(),ha.positionScreen.copy(ia[ea].position),O.multiplyVector4(ha.positionScreen),ja=n[l-2],H.copy(ha.positionScreen),P.copy(ja.positionScreen),c(H,P))H.multiplyScalar(1/H.w),P.multiplyScalar(1/P.w),X=w[x]=w[x]||new THREE.RenderableLine,x++,y=X,y.v1.positionScreen.copy(H),y.v2.positionScreen.copy(P),y.z=Math.max(H.z,P.z),y.materials=Y.materials,K.push(y)}else if(Y instanceof THREE.Particle&&(M.set(Y.matrixWorld.n14,Y.matrixWorld.n24,
- Y.matrixWorld.n34,1),E.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))X=C[z]=C[z]||new THREE.RenderableParticle,z++,A=X,A.x=M.x/M.w,A.y=M.y/M.w,A.z=M.z,A.rotation=Y.rotation.z,A.scale.x=Y.scale.x*Math.abs(A.x-(M.x+f.projectionMatrix.n11)/(M.w+f.projectionMatrix.n14)),A.scale.y=Y.scale.y*Math.abs(A.y-(M.y+f.projectionMatrix.n22)/(M.w+f.projectionMatrix.n24)),A.materials=Y.materials,K.push(A);h&&K.sort(b);return K}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
- THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),k=a*b,l=e*f;this.w=k*h-l*c;this.x=k*c+l*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
- this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
- this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
- this.x,c=this.y,e=this.z,f=this.w,h=a.x,k=a.y,l=a.z,a=a.w;this.x=b*a+f*h+c*l-e*k;this.y=c*a+f*k+e*h-b*l;this.z=e*a+f*l+b*k-c*h;this.w=f*a-b*h-c*k-e*l;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,k=this.y,l=this.z,n=this.w,p=n*c+k*f-l*e,u=n*e+l*c-h*f,t=n*f+h*e-k*c,c=-h*
- c-k*e-l*f;b.x=p*n+c*-h+u*-l-t*-k;b.y=u*n+c*-k+t*-h-p*-l;b.z=t*n+c*-l+p*-k-u*-h;return b}};THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),k=Math.sqrt(1-f*f);if(Math.abs(k)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;f=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;c.w=a.w*f+b.w*e;c.x=a.x*f+b.x*e;c.y=a.y*f+b.y*e;c.z=a.z*f+b.z*e;return c};
- THREE.Vertex=function(a){this.position=a||new THREE.Vector3};THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
- THREE.Face4=function(a,b,c,e,f,h,k){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=k;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
- THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
- THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
- THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,k=f.vertexNormals.length;h<k;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
- b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
- c,e,f,h,k,l=new THREE.Vector3,n=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){l.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)l.addSelf(h.vertexNormals[b]);l.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],k=this.vertices[h.c],l.sub(k.position,c.position),n.sub(b.position,c.position),l.crossSelf(n);l.isZero()||l.normalize();h.normal.copy(l)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
- Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
- THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
- c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,c,b,e,f,h,m){l=a.vertices[c].position;n=a.vertices[b].position;p=a.vertices[e].position;u=k[f];t=k[h];v=k[m];o=n.x-l.x;y=p.x-l.x;x=n.y-l.y;w=p.y-l.y;A=n.z-l.z;z=p.z-l.z;C=t.u-u.u;B=v.u-u.u;K=t.v-u.v;F=v.v-u.v;M=1/(C*F-B*K);H.set((F*o-K*y)*M,(F*x-K*w)*M,(F*A-K*z)*M);P.set((C*y-B*o)*M,(C*w-B*x)*M,(C*z-B*A)*M);O[c].addSelf(H);O[b].addSelf(H);O[e].addSelf(H);V[c].addSelf(P);
- V[b].addSelf(P);V[e].addSelf(P)}var b,c,e,f,h,k,l,n,p,u,t,v,o,y,x,w,A,z,C,B,K,F,M,E,O=[],V=[],H=new THREE.Vector3,P=new THREE.Vector3,L=new THREE.Vector3,T=new THREE.Vector3,S=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)O[b]=new THREE.Vector3,V[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],k=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var m=["a","b",
- "c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)S.copy(h.vertexNormals[e]),f=h[m[e]],E=O[f],L.copy(E),L.subSelf(S.multiplyScalar(S.dot(E))).normalize(),T.cross(h.vertexNormals[e],E),f=T.dot(V[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(L.x,L.y,L.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
- this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
- a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),
- c[h]=b.length-1):c[h]=c[a[e]];h=0;for(k=this.faces.length;h<k;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
- THREE.Spline=function(a){function b(a,c,b,e,f,k,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*k+a*f+c}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,k,l,n,p,u,t,v;this.initFromArray=function(a){this.points=[];for(var c=0;c<a.length;c++)this.points[c]={x:a[c][0],y:a[c][1],z:a[c][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);k=f-h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;p=this.points[c[0]];u=this.points[c[1]];
- t=this.points[c[2]];v=this.points[c[3]];l=k*k;n=k*l;e.x=b(p.x,u.x,t.x,v.x,k,l,n);e.y=b(p.y,u.y,t.y,v.y,k,l,n);e.z=b(p.z,u.z,t.z,v.z,k,l,n);return e};this.getControlPointsArray=function(){var a,c,b=this.points.length,e=[];for(a=0;a<b;a++)c=this.points[a],e[a]=[c.x,c.y,c.z];return e};this.getLength=function(a){var c,b,e=c=c=0,f=new THREE.Vector3,k=new THREE.Vector3,h=[],l=0;h[0]=0;a||(a=100);b=this.points.length*a;f.copy(this.points[0]);for(a=1;a<b;a++)c=a/b,position=this.getPoint(c),k.copy(position),
- l+=k.distanceTo(f),f.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(h[c]=l,e=c);h[h.length]=l;return{chunks:h,total:l}};this.reparametrizeByArcLength=function(a){var c,b,e,f,k,h,l=[],n=new THREE.Vector3,p=this.getLength();l.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){b=p.chunks[c]-p.chunks[c-1];h=Math.ceil(a*b/p.total);f=(c-1)/(this.points.length-1);k=c/(this.points.length-1);for(b=1;b<h-1;b++)e=f+b*(1/h)*(k-f),position=this.getPoint(e),l.push(n.copy(position).clone());
- l.push(n.copy(this.points[c]).clone())}this.points=l}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
- THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
- THREE.Camera.prototype.update=function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
- THREE.OrthographicCamera=function(a,b,c,e,f,h){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=f!==void 0?f:0.1;this.far=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
- THREE.PerspectiveCamera=function(a,b,c,e){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};
- THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,e,f,h){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=e;this.width=f;this.height=h;this.updateProjectionMatrix()};
- THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,e=a*c,a=Math.abs(a*b-e),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*a/this.fullWidth,e+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
- this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
- THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
- THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(a,b,c,e){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.castShadow=e!==void 0?e:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
- THREE.Material=function(a){this.name="";this.id=THREE.MaterialCount++;a=a||{};this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
- a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0};THREE.MaterialCount=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.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
- THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
- !0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:
- !1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
- THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=
- a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=
- a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
- THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:!1;this.perPixel=a.perPixel!==void 0?a.perPixel:!1;this.map=a.map!==void 0?a.map:null;this.lightMap=
- a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=
- a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
- THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
- THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
- THREE.MeshShaderMaterial=function(a){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(a)};
- THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
- THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
- THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
- void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
- THREE.Texture=function(a,b,c,e,f,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f: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={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
- THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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.DataTexture=function(a,b,c,e,f,h,k,l,n){THREE.Texture.call(this,null,f,h,k,l,n);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
- THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
- THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
- THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=
- c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
- THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++)a=this.children[e],a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
- b,c)};THREE.Bone.prototype.add=function(a){if(this.children.indexOf(a)===-1&&(a.parent!==void 0&&a.parent.removeChild(a),a.parent=this,this.children.push(a),!(a instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
- THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,h,k,l;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],h=f.pos,k=f.rotq,l=f.scl,e=this.addBone(),e.name=f.name,e.position.set(h[0],h[1],h[2]),e.quaternion.set(k[0],k[1],k[2],k[3]),e.useQuaternion=!0,l!==void 0?e.scale.set(l[0],l[1],l[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
- e=this.bones[c],f.parent===-1?this.add(e):this.bones[f.parent].add(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
- THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var e,f=this.children.length;for(e=0;e<f;e++)a=this.children[e],a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c);c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
- b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
- THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var a,b=[],c=0;c<this.bones.length;c++)a=this.bones[c],b.push(THREE.Matrix4.makeInvert(a.skinMatrix)),a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;e=new THREE.Vector3(c.x,
- c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(e));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};
- THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype=new THREE.Mesh;THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;
- THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/(this.geometry.morphTargets.length-1);this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction*=-1;if(this.time>this.duration)this.time=this.duration,this.directionBackwards=!0;if(this.time<0)this.time=0,this.directionBackwards=!1}}else this.time%=this.duration;a=THREE.Math.clamp(Math.floor(this.time/b),0,this.geometry.morphTargets.length-1);if(a!=this.currentKeyframe)this.morphTargetInfluences[this.lastKeyframe]=
- 0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a;b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};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.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
- THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
- this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};
- THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map instanceof THREE.Texture?a.map:THREE.ImageUtils.loadTexture(a.map);this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:
- !this.useScreenCoordinates;this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.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.fog=null;this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=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.add=function(a){this.supr.add.call(this,a);this.addChildRecurse(a)};
- THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.remove=function(a){this.supr.remove.call(this,a);this.removeChildRecurse(a)};
- THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
- THREE.Scene.prototype.addChild=function(a){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addObject=function(a){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(a)};THREE.Scene.prototype.addLight=function(a){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(a)};THREE.Scene.prototype.removeChild=function(a){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(a)};
- THREE.Scene.prototype.removeObject=function(a){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(a)};THREE.Scene.prototype.removeLight=function(a){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(a)};THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,f,h;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;e=b;f=c/2;h=e/2};this.render=function(c,e){var n,p,u,t,v,o,y,x;a=b.projectScene(c,e);n=0;for(p=a.length;n<p;n++)if(v=a[n],v instanceof THREE.RenderableParticle){y=v.x*f+f;x=v.y*h+h;u=0;for(t=v.material.length;u<t;u++)if(o=v.material[u],o instanceof THREE.ParticleDOMMaterial)o=o.domElement,o.style.left=y+"px",o.style.top=x+"px"}}};
- THREE.CanvasRenderer=function(a){function b(a){if(w!=a)o.globalAlpha=w=a}function c(a){if(A!=a){switch(a){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}A=a}}function e(a){if(z!=a)o.strokeStyle=z=a}function f(a){if(C!=a)o.fillStyle=C=a}var h=this,k=null,l=new THREE.Projector,a=a||{},n=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
- p,u,t,v,o=n.getContext("2d"),y=new THREE.Color(0),x=0,w=1,A=0,z=null,C=null,B=null,K=null,F=null,M,E,O,V,H=new THREE.RenderableVertex,P=new THREE.RenderableVertex,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z=new THREE.Color(0),R=new THREE.Color(0),Y=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),oa=[],na,fa,qa,la,ua,sa,Da,Ea,za,Fa,xa=new THREE.Rectangle,G=new THREE.Rectangle,$=new THREE.Rectangle,ma=!1,I=new THREE.Color,N=new THREE.Color,ta=new THREE.Color,pa=new THREE.Color,ka=new THREE.Vector3,
- ya,va,Ca,Ba,Ga,W,a=16;ya=document.createElement("canvas");ya.width=ya.height=2;va=ya.getContext("2d");va.fillStyle="rgba(0,0,0,1)";va.fillRect(0,0,2,2);Ca=va.getImageData(0,0,2,2);Ba=Ca.data;Ga=document.createElement("canvas");Ga.width=Ga.height=a;W=Ga.getContext("2d");W.translate(-a/2,-a/2);W.scale(a,a);a--;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,c){p=a;u=c;t=Math.floor(p/2);v=Math.floor(u/2);n.width=p;
- n.height=u;xa.set(-t,-v,t,v);G.set(-t,-v,t,v);w=1;A=0;F=K=B=C=z=null};this.setClearColor=function(a,c){y.copy(a);x=c;G.set(-t,-v,t,v)};this.setClearColorHex=function(a,c){y.setHex(a);x=c;G.set(-t,-v,t,v)};this.clear=function(){o.setTransform(1,0,0,-1,t,v);G.isEmpty()||(G.minSelf(xa),G.inflate(2),x<1&&o.clearRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight())),x>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+
- Math.floor(y.b*255)+","+x+")"),o.fillRect(Math.floor(G.getX()),Math.floor(G.getY()),Math.floor(G.getWidth()),Math.floor(G.getHeight()))),G.empty())};this.render=function(a,n){function p(a){var c,b,e,f=a.lights;N.setRGB(0,0,0);ta.setRGB(0,0,0);pa.setRGB(0,0,0);a=0;for(c=f.length;a<c;a++)b=f[a],e=b.color,b instanceof THREE.AmbientLight?(N.r+=e.r,N.g+=e.g,N.b+=e.b):b instanceof THREE.DirectionalLight?(ta.r+=e.r,ta.g+=e.g,ta.b+=e.b):b instanceof THREE.PointLight&&(pa.r+=e.r,pa.g+=e.g,pa.b+=e.b)}function u(a,
- c,b,e){var f,k,h,m,l=a.lights,a=0;for(f=l.length;a<f;a++)k=l[a],h=k.color,k instanceof THREE.DirectionalLight?(m=b.dot(k.position),m<=0||(m*=k.intensity,e.r+=h.r*m,e.g+=h.g*m,e.b+=h.b*m)):k instanceof THREE.PointLight&&(m=b.dot(ka.sub(k.position,c).normalize()),m<=0||(m*=k.distance==0?1:1-Math.min(c.distanceTo(k.position)/k.distance,1),m!=0&&(m*=k.intensity,e.r+=h.r*m,e.g+=h.g*m,e.b+=h.b*m)))}function x(a,k,h){b(h.opacity);c(h.blending);var m,l,n,p,u,wa;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)p=
- h.map.image,u=p.width>>1,wa=p.height>>1,h=k.scale.x*t,n=k.scale.y*v,m=h*u,l=n*wa,$.set(a.x-m,a.y-l,a.x+m,a.y+l),xa.intersects($)&&(o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(h,-n),o.translate(-u,-wa),o.drawImage(p,0,0),o.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(m=k.scale.x*t,l=k.scale.y*v,$.set(a.x-m,a.y-l,a.x+m,a.y+l),xa.intersects($)&&(e(h.color.getContextStyle()),f(h.color.getContextStyle()),o.save(),o.translate(a.x,a.y),o.rotate(-k.rotation),o.scale(m,l),h.program(o),
- o.restore()))}function w(a,f,k,h){b(h.opacity);c(h.blending);o.beginPath();o.moveTo(a.positionScreen.x,a.positionScreen.y);o.lineTo(f.positionScreen.x,f.positionScreen.y);o.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(B!=a)o.lineWidth=B=a;a=h.linecap;if(K!=a)o.lineCap=K=a;a=h.linejoin;if(F!=a)o.lineJoin=F=a;e(h.color.getContextStyle());o.stroke();$.inflate(h.linewidth*2)}}function y(a,e,f,k,l,p,t,o,v){h.info.render.vertices+=3;h.info.render.faces++;b(o.opacity);c(o.blending);
- L=a.positionScreen.x;T=a.positionScreen.y;S=e.positionScreen.x;m=e.positionScreen.y;aa=f.positionScreen.x;U=f.positionScreen.y;A(L,T,S,m,aa,U);if(o instanceof THREE.MeshBasicMaterial)if(o.map)o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map));else if(o.envMap){if(o.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=n.matrixWorldInverse,ka.copy(t.vertexNormalsWorld[0]),ua=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,
- sa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[1]),Da=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Ea=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,ka.copy(t.vertexNormalsWorld[2]),za=(ka.x*a.n11+ka.y*a.n12+ka.z*a.n13)*0.5+0.5,Fa=-(ka.x*a.n21+ka.y*a.n22+ka.z*a.n23)*0.5+0.5,$a(L,T,S,m,aa,U,ua,sa,Da,Ea,za,Fa,o.envMap)}else o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshLambertMaterial)o.map&&!o.wireframe&&
- (o.map.mapping instanceof THREE.UVMapping&&(la=t.uvs[0],$a(L,T,S,m,aa,U,la[k].u,la[k].v,la[l].u,la[l].v,la[p].u,la[p].v,o.map)),c(THREE.SubtractiveBlending)),ma?!o.wireframe&&o.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?(R.r=Y.r=X.r=N.r,R.g=Y.g=X.g=N.g,R.b=Y.b=X.b=N.b,u(v,t.v1.positionWorld,t.vertexNormalsWorld[0],R),u(v,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),u(v,t.v3.positionWorld,t.vertexNormalsWorld[2],X),R.r=Math.max(0,Math.min(o.color.r*R.r,1)),R.g=Math.max(0,Math.min(o.color.g*
- R.g,1)),R.b=Math.max(0,Math.min(o.color.b*R.b,1)),Y.r=Math.max(0,Math.min(o.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(o.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(o.color.b*Y.b,1)),X.r=Math.max(0,Math.min(o.color.r*X.r,1)),X.g=Math.max(0,Math.min(o.color.g*X.g,1)),X.b=Math.max(0,Math.min(o.color.b*X.b,1)),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,t.centroidWorld,t.normalWorld,I),Z.r=Math.max(0,Math.min(o.color.r*
- I.r,1)),Z.g=Math.max(0,Math.min(o.color.g*I.g,1)),Z.b=Math.max(0,Math.min(o.color.b*I.b,1)),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)):o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color);else if(o instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(f.positionScreen.z,na,fa),ga.r=(Y.r+X.r)*0.5,ga.g=(Y.g+X.g)*0.5,
- ga.b=(Y.b+X.b)*0.5,qa=Xa(R,Y,X,ga),Ua(L,T,S,m,aa,U,0,0,1,0,0,1,qa);else if(o instanceof THREE.MeshNormalMaterial)Z.r=Va(t.normalWorld.x),Z.g=Va(t.normalWorld.y),Z.b=Va(t.normalWorld.z),o.wireframe?Ka(Z,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(Z)}function z(a,e,f,k,l,p,o,t,v){h.info.render.vertices+=4;h.info.render.faces++;b(t.opacity);c(t.blending);if(t.map||t.envMap)y(a,e,k,0,1,3,o,t,v),y(l,f,p,1,2,3,o,t,v);else if(L=a.positionScreen.x,T=a.positionScreen.y,S=e.positionScreen.x,
- m=e.positionScreen.y,aa=f.positionScreen.x,U=f.positionScreen.y,ea=k.positionScreen.x,da=k.positionScreen.y,ia=l.positionScreen.x,ha=l.positionScreen.y,ja=p.positionScreen.x,ca=p.positionScreen.y,t instanceof THREE.MeshBasicMaterial)C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color);else if(t instanceof THREE.MeshLambertMaterial)ma?!t.wireframe&&t.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==4?(R.r=Y.r=X.r=ga.r=N.r,R.g=
- Y.g=X.g=ga.g=N.g,R.b=Y.b=X.b=ga.b=N.b,u(v,o.v1.positionWorld,o.vertexNormalsWorld[0],R),u(v,o.v2.positionWorld,o.vertexNormalsWorld[1],Y),u(v,o.v4.positionWorld,o.vertexNormalsWorld[3],X),u(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),R.r=Math.max(0,Math.min(t.color.r*R.r,1)),R.g=Math.max(0,Math.min(t.color.g*R.g,1)),R.b=Math.max(0,Math.min(t.color.b*R.b,1)),Y.r=Math.max(0,Math.min(t.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(t.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(t.color.b*Y.b,1)),X.r=Math.max(0,
- Math.min(t.color.r*X.r,1)),X.g=Math.max(0,Math.min(t.color.g*X.g,1)),X.b=Math.max(0,Math.min(t.color.b*X.b,1)),ga.r=Math.max(0,Math.min(t.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(t.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(t.color.b*ga.b,1)),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)):(I.r=N.r,I.g=N.g,I.b=N.b,u(v,o.centroidWorld,o.normalWorld,I),Z.r=Math.max(0,Math.min(t.color.r*I.r,1)),Z.g=Math.max(0,Math.min(t.color.g*
- I.g,1)),Z.b=Math.max(0,Math.min(t.color.b*I.b,1)),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z)):(C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(t.color));else if(t instanceof THREE.MeshNormalMaterial)Z.r=Va(o.normalWorld.x),Z.g=Va(o.normalWorld.y),Z.b=Va(o.normalWorld.z),C(L,T,S,m,aa,U,ea,da),t.wireframe?Ka(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):La(Z);
- else if(t instanceof THREE.MeshDepthMaterial)na=n.near,fa=n.far,R.r=R.g=R.b=1-Oa(a.positionScreen.z,na,fa),Y.r=Y.g=Y.b=1-Oa(e.positionScreen.z,na,fa),X.r=X.g=X.b=1-Oa(k.positionScreen.z,na,fa),ga.r=ga.g=ga.b=1-Oa(f.positionScreen.z,na,fa),qa=Xa(R,Y,X,ga),A(L,T,S,m,ea,da),Ua(L,T,S,m,ea,da,0,0,1,0,0,1,qa),A(ia,ha,aa,U,ja,ca),Ua(ia,ha,aa,U,ja,ca,1,0,1,1,0,1,qa)}function A(a,c,b,e,f,k){o.beginPath();o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(a,c);o.closePath()}function C(a,c,b,e,f,k,h,m){o.beginPath();
- o.moveTo(a,c);o.lineTo(b,e);o.lineTo(f,k);o.lineTo(h,m);o.lineTo(a,c);o.closePath()}function Ka(a,c,b,f){if(B!=c)o.lineWidth=B=c;if(K!=b)o.lineCap=K=b;if(F!=f)o.lineJoin=F=f;e(a.getContextStyle());o.stroke();$.inflate(c*2)}function La(a){f(a.getContextStyle());o.fill()}function $a(a,c,b,e,k,h,m,l,n,p,t,u,v){if(v.image.width!=0){if(v.needsUpdate==!0||oa[v.id]==void 0){var wa=v.wrapS==THREE.RepeatWrapping,G=v.wrapT==THREE.RepeatWrapping;oa[v.id]=o.createPattern(v.image,wa&&G?"repeat":wa&&!G?"repeat-x":
- !wa&&G?"repeat-y":"no-repeat");v.needsUpdate=!1}f(oa[v.id]);var wa=v.offset.x/v.repeat.x,G=v.offset.y/v.repeat.y,x=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,m=(m+wa)*x,l=(l+G)*v,n=(n+wa)*x,p=(p+G)*v,t=(t+wa)*x,u=(u+G)*v;b-=a;e-=c;k-=a;h-=c;n-=m;p-=l;t-=m;u-=l;wa=1/(n*u-t*p);v=(u*b-p*k)*wa;p=(u*e-p*h)*wa;b=(n*k-t*b)*wa;e=(n*h-t*e)*wa;a=a-v*m-b*l;c=c-p*m-e*l;o.save();o.transform(v,p,b,e,a,c);o.fill();o.restore()}}function Ua(a,c,b,e,f,k,h,m,l,n,p,t,v){var u,wa;u=v.width-1;wa=v.height-
- 1;h*=u;m*=wa;l*=u;n*=wa;p*=u;t*=wa;b-=a;e-=c;f-=a;k-=c;l-=h;n-=m;p-=h;t-=m;wa=1/(l*t-p*n);u=(t*b-n*f)*wa;n=(t*e-n*k)*wa;b=(l*f-p*b)*wa;e=(l*k-p*e)*wa;a=a-u*h-b*m;c=c-n*h-e*m;o.save();o.transform(u,n,b,e,a,c);o.clip();o.drawImage(v,0,0);o.restore()}function Xa(a,c,b,e){var f=~~(a.r*255),k=~~(a.g*255),a=~~(a.b*255),h=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),l=~~(b.r*255),n=~~(b.g*255),b=~~(b.b*255),p=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255);Ba[0]=f<0?0:f>255?255:f;Ba[1]=k<0?0:k>255?255:k;Ba[2]=a<0?0:
- a>255?255:a;Ba[4]=h<0?0:h>255?255:h;Ba[5]=m<0?0:m>255?255:m;Ba[6]=c<0?0:c>255?255:c;Ba[8]=l<0?0:l>255?255:l;Ba[9]=n<0?0:n>255?255:n;Ba[10]=b<0?0:b>255?255:b;Ba[12]=p<0?0:p>255?255:p;Ba[13]=t<0?0:t>255?255:t;Ba[14]=e<0?0:e>255?255:e;va.putImageData(Ca,0,0);W.drawImage(ya,0,0);return Ga}function Oa(a,c,b){a=(a-c)/(b-c);return a*a*(3-2*a)}function Va(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ma(a,c){var b=c.x-a.x,e=c.y-a.y,f=b*b+e*e;f!=0&&(f=1/Math.sqrt(f),b*=f,e*=f,c.x+=b,c.y+=e,a.x-=b,a.y-=e)}var Ya,
- ab,ra,Ha,Na,Wa,Za,Aa;this.autoClear?this.clear():o.setTransform(1,0,0,-1,t,v);h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,n,this.sortElements);(ma=a.lights.length>0)&&p(a);Ya=0;for(ab=k.length;Ya<ab;Ya++){ra=k[Ya];$.empty();if(ra instanceof THREE.RenderableParticle){M=ra;M.x*=t;M.y*=v;Ha=0;for(Na=ra.materials.length;Ha<Na;)Aa=ra.materials[Ha++],Aa.opacity!=0&&x(M,ra,Aa,a)}else if(ra instanceof THREE.RenderableLine){if(M=ra.v1,E=ra.v2,M.positionScreen.x*=t,M.positionScreen.y*=
- v,E.positionScreen.x*=t,E.positionScreen.y*=v,$.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),xa.intersects($)){Ha=0;for(Na=ra.materials.length;Ha<Na;)Aa=ra.materials[Ha++],Aa.opacity!=0&&w(M,E,ra,Aa,a)}}else if(ra instanceof THREE.RenderableFace3){if(M=ra.v1,E=ra.v2,O=ra.v3,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),
- Ma(E.positionScreen,O.positionScreen),Ma(O.positionScreen,M.positionScreen)),$.add3Points(M.positionScreen.x,M.positionScreen.y,E.positionScreen.x,E.positionScreen.y,O.positionScreen.x,O.positionScreen.y),xa.intersects($)){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&y(M,E,O,0,1,2,ra,Aa,a)}else Aa.opacity!=0&&y(M,E,O,0,1,2,ra,Aa,a)}}else if(ra instanceof
- THREE.RenderableFace4&&(M=ra.v1,E=ra.v2,O=ra.v3,V=ra.v4,M.positionScreen.x*=t,M.positionScreen.y*=v,E.positionScreen.x*=t,E.positionScreen.y*=v,O.positionScreen.x*=t,O.positionScreen.y*=v,V.positionScreen.x*=t,V.positionScreen.y*=v,H.positionScreen.copy(E.positionScreen),P.positionScreen.copy(V.positionScreen),ra.overdraw&&(Ma(M.positionScreen,E.positionScreen),Ma(E.positionScreen,V.positionScreen),Ma(V.positionScreen,M.positionScreen),Ma(O.positionScreen,H.positionScreen),Ma(O.positionScreen,P.positionScreen)),
- $.addPoint(M.positionScreen.x,M.positionScreen.y),$.addPoint(E.positionScreen.x,E.positionScreen.y),$.addPoint(O.positionScreen.x,O.positionScreen.y),$.addPoint(V.positionScreen.x,V.positionScreen.y),xa.intersects($))){Ha=0;for(Na=ra.meshMaterials.length;Ha<Na;)if(Aa=ra.meshMaterials[Ha++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=ra.faceMaterials.length;Wa<Za;)(Aa=ra.faceMaterials[Wa++])&&Aa.opacity!=0&&z(M,E,O,V,H,P,ra,Aa,a)}else Aa.opacity!=0&&z(M,E,O,V,H,P,ra,Aa,a)}G.addRectangle($)}o.setTransform(1,
- 0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(a,c,b){var e,f,k,h;e=0;for(f=a.lights.length;e<f;e++)k=a.lights[e],k instanceof THREE.DirectionalLight?(h=c.normalWorld.dot(k.position)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h)):k instanceof THREE.PointLight&&(V.sub(k.position,c.centroidWorld),V.normalize(),h=c.normalWorld.dot(V)*k.intensity,h>0&&(b.r+=k.color.r*h,b.g+=k.color.g*h,b.b+=k.color.b*h))}function b(c,b,k,m,l,p){h.info.render.vertices+=3;h.info.render.faces++;L=e(T++);
- L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");l instanceof THREE.MeshBasicMaterial?B.copy(l.color):l instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(p,m,K),B.r=Math.max(0,Math.min(l.color.r*K.r,1)),B.g=Math.max(0,Math.min(l.color.g*K.g,1)),B.b=Math.max(0,Math.min(l.color.b*K.b,1))):B.copy(l.color):l instanceof THREE.MeshDepthMaterial?(O=1-l.__2near/(l.__farPlusNear-
- m.z*l.__farMinusNear),B.setRGB(O,O,O)):l instanceof THREE.MeshNormalMaterial&&B.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));l.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+"; fill-opacity: "+l.opacity);n.appendChild(L)}function c(c,b,k,m,l,p,t){h.info.render.vertices+=
- 4;h.info.render.faces++;L=e(T++);L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+b.positionScreen.x+" "+b.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?B.copy(p.color):p instanceof THREE.MeshLambertMaterial?C?(K.r=F.r,K.g=F.g,K.b=F.b,a(t,l,K),B.r=Math.max(0,Math.min(p.color.r*K.r,1)),B.g=Math.max(0,Math.min(p.color.g*K.g,1)),B.b=Math.max(0,Math.min(p.color.b*K.b,1))):
- B.copy(p.color):p instanceof THREE.MeshDepthMaterial?(O=1-p.__2near/(p.__farPlusNear-l.z*p.__farMinusNear),B.setRGB(O,O,O)):p instanceof THREE.MeshNormalMaterial&&B.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));p.wireframe?L.setAttribute("style","fill: none; stroke: "+B.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):L.setAttribute("style","fill: "+B.getContextStyle()+
- "; fill-opacity: "+p.opacity);n.appendChild(L)}function e(a){H[a]==null&&(H[a]=document.createElementNS("http://www.w3.org/2000/svg","path"),m==0&&H[a].setAttribute("shape-rendering","crispEdges"));return H[a]}function f(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var h=this,k=null,l=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,u,t,v,o,y,x,w,A=new THREE.Rectangle,z=new THREE.Rectangle,C=!1,B=new THREE.Color(16777215),K=new THREE.Color(16777215),F=new THREE.Color(0),
- M=new THREE.Color(0),E=new THREE.Color(0),O,V=new THREE.Vector3,H=[],P=[],L,T,S,m=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(a){switch(a){case "high":m=1;break;case "low":m=0}};this.setSize=function(a,c){p=a;u=c;t=p/2;v=u/2;n.setAttribute("viewBox",-t+" "+-v+" "+p+" "+u);n.setAttribute("width",p);n.setAttribute("height",u);A.set(-t,-v,t,v)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};
- this.render=function(a,e){var f,p,u,B,O,H,K,R;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=l.projectScene(a,e,this.sortElements);S=T=0;if(C=a.lights.length>0){K=a.lights;F.setRGB(0,0,0);M.setRGB(0,0,0);E.setRGB(0,0,0);f=0;for(p=K.length;f<p;f++)u=K[f],B=u.color,u instanceof THREE.AmbientLight?(F.r+=B.r,F.g+=B.g,F.b+=B.b):u instanceof THREE.DirectionalLight?(M.r+=B.r,M.g+=B.g,M.b+=B.b):u instanceof THREE.PointLight&&(E.r+=B.r,E.g+=B.g,E.b+=B.b)}f=0;for(p=k.length;f<
- p;f++)if(K=k[f],z.empty(),K instanceof THREE.RenderableParticle){o=K;o.x*=t;o.y*=-v;u=0;for(B=K.materials.length;u<B;)u++}else if(K instanceof THREE.RenderableLine){if(o=K.v1,y=K.v2,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),A.intersects(z)){u=0;for(B=K.materials.length;u<B;)if((R=K.materials[u++])&&R.opacity!=0){O=o;H=y;var Y=S++;P[Y]==null&&(P[Y]=document.createElementNS("http://www.w3.org/2000/svg",
- "line"),m==0&&P[Y].setAttribute("shape-rendering","crispEdges"));L=P[Y];L.setAttribute("x1",O.positionScreen.x);L.setAttribute("y1",O.positionScreen.y);L.setAttribute("x2",H.positionScreen.x);L.setAttribute("y2",H.positionScreen.y);R instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+R.color.getContextStyle()+"; stroke-width: "+R.linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.linecap+"; stroke-linejoin: "+R.linejoin),n.appendChild(L))}}}else if(K instanceof
- THREE.RenderableFace3){if(o=K.v1,y=K.v2,x=K.v3,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),A.intersects(z)){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(H=K.faceMaterials.length;O<H;)(R=K.faceMaterials[O++])&&
- R.opacity!=0&&b(o,y,x,K,R,a)}else R&&R.opacity!=0&&b(o,y,x,K,R,a)}}else if(K instanceof THREE.RenderableFace4&&(o=K.v1,y=K.v2,x=K.v3,w=K.v4,o.positionScreen.x*=t,o.positionScreen.y*=-v,y.positionScreen.x*=t,y.positionScreen.y*=-v,x.positionScreen.x*=t,x.positionScreen.y*=-v,w.positionScreen.x*=t,w.positionScreen.y*=-v,z.addPoint(o.positionScreen.x,o.positionScreen.y),z.addPoint(y.positionScreen.x,y.positionScreen.y),z.addPoint(x.positionScreen.x,x.positionScreen.y),z.addPoint(w.positionScreen.x,w.positionScreen.y),
- A.intersects(z))){u=0;for(B=K.meshMaterials.length;u<B;)if(R=K.meshMaterials[u++],R instanceof THREE.MeshFaceMaterial){O=0;for(H=K.faceMaterials.length;O<H;)(R=K.faceMaterials[O++])&&R.opacity!=0&&c(o,y,x,w,K,R,a)}else R&&R.opacity!=0&&c(o,y,x,w,K,R,a)}}};
- 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 float flipEnvMap;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\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\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\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_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform 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#endif",
- lights_lambert_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = vec3( 0.0 );\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}\n#endif\nvLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;\n}",
- lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",lights_phong_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\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#endif",
- lights_phong_pars_fragment:"uniform 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 ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
- lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDistance = lDistance;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, lVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 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 = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
- 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\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\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",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
- shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
- shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
- THREE.UniformsUtils={merge:function(a){var b,c,e,f={};for(b=0;b<a.length;b++)for(c in e=this.clone(a[b]),e)f[c]=e[c];return f},clone:function(a){var b,c,e,f={};for(b in a)for(c in f[b]={},a[b])e=a[b][c],f[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return f}};
- 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},flipEnvMap:{type:"f",value:-1},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)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
- THREE.ShaderLib={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 vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"},
- depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",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}"},normal:{uniforms:{opacity:{type:"f",value:1}},
- vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),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,THREE.ShaderChunk.shadowmap_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,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),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,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
- THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)}}]),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,
- THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_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_lambert_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform 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,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",
- THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,"gl_FragColor.xyz = gl_FragColor.xyz * vLightWeighting;",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",
- value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),vertexShader:["varying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_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 = -mvPosition.xyz;\nvec3 transformedNormal = normalMatrix * normal;\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,
- "}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;",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_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,
- THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,
- THREE.ShaderChunk.shadowmap_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;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
- THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
- THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
- THREE.WebGLRenderer=function(a){function b(a,c){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(c.materialIndex>=0)return a.geometry.materials[c.materialIndex]}function c(a,c,b){var e,f,k,h=a.vertices,l=h.length,n=a.colors,p=n.length,t=a.__vertexArray,o=a.__colorArray,u=a.__sortArray,v=a.__dirtyVertices,G=a.__dirtyColors,x=a.__webglCustomAttributesList,w;if(x){k=0;for(e=x.length;k<e;k++)x[k].offset=0}if(b.sortParticles){sa.multiplySelf(b.matrixWorld);for(e=
- 0;e<l;e++)f=h[e].position,za.copy(f),sa.multiplyVector3(za),u[e]=[za.z,e];u.sort(function(a,c){return c[0]-a[0]});for(e=0;e<l;e++)f=h[u[e][1]].position,k=e*3,t[k]=f.x,t[k+1]=f.y,t[k+2]=f.z;for(e=0;e<p;e++)k=e*3,color=n[u[e][1]],o[k]=color.r,o[k+1]=color.g,o[k+2]=color.b;if(x){k=0;for(e=x.length;k<e;k++){l=x[k];p=l.value.length;for(n=0;n<p;n++){index=u[n][1];h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[index]}else{if(l.boundTo===void 0||l.boundTo==="vertices")w=
- l.value[index];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type==="c"?(l.array[h]=w.r,l.array[h+1]=w.g,l.array[h+2]=w.b):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z,l.array[h+3]=w.w)}l.offset+=l.size}}}}else{if(v)for(e=0;e<l;e++)f=h[e].position,k=e*3,t[k]=f.x,t[k+1]=f.y,t[k+2]=f.z;if(G)for(e=0;e<p;e++)color=n[e],k=e*3,o[k]=color.r,o[k+1]=color.g,o[k+2]=color.b;if(x){k=0;for(e=x.length;k<e;k++)if(l=x[k],l.__original.needsUpdate){p=
- l.value.length;for(n=0;n<p;n++){h=l.offset;if(l.size===1){if(l.boundTo===void 0||l.boundTo==="vertices")l.array[h]=l.value[n]}else{if(l.boundTo===void 0||l.boundTo==="vertices")w=l.value[n];l.size===2?(l.array[h]=w.x,l.array[h+1]=w.y):l.size===3?l.type==="c"?(l.array[h]=w.r,l.array[h+1]=w.g,l.array[h+2]=w.b):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z):(l.array[h]=w.x,l.array[h+1]=w.y,l.array[h+2]=w.z,l.array[h+3]=w.w)}l.offset+=l.size}}}}if(v||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),
- m.bufferData(m.ARRAY_BUFFER,t,c);if(G||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,a.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,o,c);if(x){k=0;for(e=x.length;k<e;k++)if(l=x[k],l.__original.needsUpdate||b.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,l.buffer),m.bufferData(m.ARRAY_BUFFER,l.array,c)}}function e(a,c,b,e,k){e.program||S.initMaterial(e,c,b,k);if(e.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);for(var f=0,h=S.maxMorphTargets;f<
- h;f++)k.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,h=f.uniforms,n=e.uniforms;f!==U&&(m.useProgram(f),U=f,l=!0);if(e.id!==da)da=e.id,l=!0;if(l){m.uniformMatrix4fv(h.projectionMatrix,!1,Da);if(b&&e.fog)if(n.fogColor.value=b.color,b instanceof THREE.Fog)n.fogNear.value=b.near,n.fogFar.value=b.far;else if(b instanceof THREE.FogExp2)n.fogDensity.value=b.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var p,t,o=0,u=0,v=0,G,w,x,y=Fa,ma=y.directional.colors,
- $=y.directional.positions,z=y.point.colors,A=y.point.positions,C=y.point.distances,B=0,I=0,b=p=x=0,l=c.length;b<l;b++)if(p=c[b],t=p.color,G=p.position,w=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)S.gammaInput?(o+=t.r*t.r,u+=t.g*t.g,v+=t.b*t.b):(o+=t.r,u+=t.g,v+=t.b);else if(p instanceof THREE.DirectionalLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),$[x]=G.x,$[x+1]=G.y,$[x+2]=G.z,B+=1;else if(p instanceof
- THREE.SpotLight)x=B*3,S.gammaInput?(ma[x]=t.r*t.r*w*w,ma[x+1]=t.g*t.g*w*w,ma[x+2]=t.b*t.b*w*w):(ma[x]=t.r*w,ma[x+1]=t.g*w,ma[x+2]=t.b*w),t=1/G.length(),$[x]=G.x*t,$[x+1]=G.y*t,$[x+2]=G.z*t,B+=1;else if(p instanceof THREE.PointLight)p=I*3,S.gammaInput?(z[p]=t.r*t.r*w*w,z[p+1]=t.g*t.g*w*w,z[p+2]=t.b*t.b*w*w):(z[p]=t.r*w,z[p+1]=t.g*w,z[p+2]=t.b*w),A[p]=G.x,A[p+1]=G.y,A[p+2]=G.z,C[I]=x,I+=1;b=B*3;for(l=ma.length;b<l;b++)ma[b]=0;b=I*3;for(l=z.length;b<l;b++)z[b]=0;y.point.length=I;y.directional.length=
- B;y.ambient[0]=o;y.ambient[1]=u;y.ambient[2]=v;c=Fa;n.enableLighting.value=c.directional.length+c.point.length;n.ambientLightColor.value=c.ambient;n.directionalLightColor.value=c.directional.colors;n.directionalLightDirection.value=c.directional.positions;n.pointLightColor.value=c.point.colors;n.pointLightPosition.value=c.point.positions;n.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
- e.opacity,S.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
- if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=xa.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,S.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof
- THREE.MeshLambertMaterial)S.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(k.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(c=0;c<ka.length;c++)n.shadowMatrix.value[c]=ka[c],n.shadowMap.texture[c]=S.shadowMap[c];n.shadowDarkness.value=S.shadowMapDarkness;n.shadowBias.value=S.shadowMapBias}c=
- e.uniformsList;n=0;for(b=c.length;n<b;n++)if(u=f.uniforms[c[n][1]])if(o=c[n][0],v=o.type,l=o.value,v==="i")m.uniform1i(u,l);else if(v==="f")m.uniform1f(u,l);else if(v==="v2")m.uniform2f(u,l.x,l.y);else if(v==="v3")m.uniform3f(u,l.x,l.y,l.z);else if(v==="v4")m.uniform4f(u,l.x,l.y,l.z,l.w);else if(v==="c")m.uniform3f(u,l.r,l.g,l.b);else if(v==="fv1")m.uniform1fv(u,l);else if(v==="fv")m.uniform3fv(u,l);else if(v==="v3v"){if(!o._array)o._array=new Float32Array(3*l.length);v=0;for(G=l.length;v<G;v++)y=
- v*3,o._array[y]=l[v].x,o._array[y+1]=l[v].y,o._array[y+2]=l[v].z;m.uniform3fv(u,o._array)}else if(v==="m4"){if(!o._array)o._array=new Float32Array(16);l.flattenToArray(o._array);m.uniformMatrix4fv(u,!1,o._array)}else if(v==="m4v"){if(!o._array)o._array=new Float32Array(16*l.length);v=0;for(G=l.length;v<G;v++)l[v].flattenToArrayOffset(o._array,v*16);m.uniformMatrix4fv(u,!1,o._array)}else if(v==="t"){if(m.uniform1i(u,l),u=o.texture)if(u.image instanceof Array&&u.image.length===6){if(o=u,o.image.length===
- 6)if(o.needsUpdate){if(!o.image.__webglTextureCube)o.image.__webglTextureCube=m.createTexture();m.activeTexture(m.TEXTURE0+l);m.bindTexture(m.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(l=0;l<6;l++)m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,o.image[l]);M(m.TEXTURE_CUBE_MAP,o,o.image[0]);o.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+l),m.bindTexture(m.TEXTURE_CUBE_MAP,o.image.__webglTextureCube)}else u instanceof THREE.WebGLRenderTargetCube?(o=u,m.activeTexture(m.TEXTURE0+
- l),m.bindTexture(m.TEXTURE_CUBE_MAP,o.__webglTexture)):E(u,l)}else if(v==="tv"){if(!o._array){o._array=[];v=0;for(G=o.texture.length;v<G;v++)o._array[v]=l+v}m.uniform1iv(u,o._array);v=0;for(G=o.texture.length;v<G;v++)(u=o.texture[v])&&E(u,o._array[v])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&h.cameraPosition!==null&&m.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
- e instanceof THREE.ShaderMaterial||e.skinning)&&h.viewMatrix!==null&&m.uniformMatrix4fv(h.viewMatrix,!1,Ea);e.skinning&&(m.uniformMatrix4fv(h.cameraInverseMatrix,!1,Ea),m.uniformMatrix4fv(h.boneGlobalMatrices,!1,k.boneMatrices))}m.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray);h.normalMatrix&&m.uniformMatrix3fv(h.normalMatrix,!1,k._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||k.receiveShadow)&&h.objectMatrix!==null&&m.uniformMatrix4fv(h.objectMatrix,
- !1,k._objectMatrixArray);return f}function f(a,c,b,k,f,h){if(k.opacity!==0){var l,n,b=e(a,c,b,k,h),a=b.attributes,c=!1,b=f.id*16777215+b.id*2+(k.wireframe?1:0);b!==ia&&(ia=b,c=!0);if(!k.morphTargets&&a.position>=0)c&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),m.vertexAttribPointer(a.position,3,m.FLOAT,!1,0,0));else if(h.morphTargetBase){b=k.program.attributes;h.morphTargetBase!==-1?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),m.vertexAttribPointer(b.position,
- 3,m.FLOAT,!1,0,0)):b.position>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglVertexBuffer),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){l=0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;l<k.numSupportedMorphTargets&&l<p.length;)m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[l]]),m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[l]=n[p[l]],l++}else{var p=[],t=-1,o=0;n=h.morphTargetInfluences;var v,
- u=n.length;l=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);l<k.numSupportedMorphTargets;){for(v=0;v<u;v++)!p[v]&&n[v]>t&&(o=v,t=n[o]);m.bindBuffer(m.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[o]);m.vertexAttribPointer(b["morphTarget"+l],3,m.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[l]=t;p[o]=1;t=-1;l++}}k.program.uniforms.morphTargetInfluences!==null&&m.uniform1fv(k.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(c){if(f.__webglCustomAttributesList){l=0;for(n=
- f.__webglCustomAttributesList.length;l<n;l++)b=f.__webglCustomAttributesList[l],a[b.buffer.belongsToAttribute]>=0&&(m.bindBuffer(m.ARRAY_BUFFER,b.buffer),m.vertexAttribPointer(a[b.buffer.belongsToAttribute],b.size,m.FLOAT,!1,0,0))}a.color>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglColorBuffer),m.vertexAttribPointer(a.color,3,m.FLOAT,!1,0,0));a.normal>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglNormalBuffer),m.vertexAttribPointer(a.normal,3,m.FLOAT,!1,0,0));a.tangent>=0&&(m.bindBuffer(m.ARRAY_BUFFER,
- f.__webglTangentBuffer),m.vertexAttribPointer(a.tangent,4,m.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglUVBuffer),m.vertexAttribPointer(a.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv)):m.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,f.__webglUV2Buffer),m.vertexAttribPointer(a.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(a.uv2)):m.disableVertexAttribArray(a.uv2));k.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
- 0&&a.skinIndex>=0&&a.skinWeight>=0&&(m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexABuffer),m.vertexAttribPointer(a.skinVertexA,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),m.vertexAttribPointer(a.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),m.vertexAttribPointer(a.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),m.vertexAttribPointer(a.skinWeight,4,m.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(k.wireframe?
- (m.lineWidth(k.wireframeLinewidth),c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),m.drawElements(m.LINES,f.__webglLineCount,m.UNSIGNED_SHORT,0)):(c&&m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),m.drawElements(m.TRIANGLES,f.__webglFaceCount,m.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=f.__webglFaceCount,S.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?m.LINE_STRIP:m.LINES,m.lineWidth(k.linewidth),m.drawArrays(h,
- 0,f.__webglLineCount),S.info.render.calls++):h instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,f.__webglParticleCount),S.info.render.calls++):h instanceof THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,f.__webglVertexCount),S.info.render.calls++)}}function h(a,c,b){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=m.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=m.createBuffer();a.hasPos&&(m.bindBuffer(m.ARRAY_BUFFER,a.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,a.positionArray,
- m.DYNAMIC_DRAW),m.enableVertexAttribArray(c.attributes.position),m.vertexAttribPointer(c.attributes.position,3,m.FLOAT,!1,0,0));if(a.hasNormal){m.bindBuffer(m.ARRAY_BUFFER,a.__webglNormalBuffer);if(b===THREE.FlatShading){var e,f,k,h,l,n,p,t,o,v,u=a.count*3;for(v=0;v<u;v+=9)b=a.normalArray,e=b[v],f=b[v+1],k=b[v+2],h=b[v+3],n=b[v+4],t=b[v+5],l=b[v+6],p=b[v+7],o=b[v+8],e=(e+h+l)/3,f=(f+n+p)/3,k=(k+t+o)/3,b[v]=e,b[v+1]=f,b[v+2]=k,b[v+3]=e,b[v+4]=f,b[v+5]=k,b[v+6]=e,b[v+7]=f,b[v+8]=k}m.bufferData(m.ARRAY_BUFFER,
- a.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(c.attributes.normal);m.vertexAttribPointer(c.attributes.normal,3,m.FLOAT,!1,0,0)}m.drawArrays(m.TRIANGLES,0,a.count);a.count=0}function k(a){if(ja!==a.doubleSided)a.doubleSided?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),ja=a.doubleSided;if(ca!==a.flipSided)a.flipSided?m.frontFace(m.CW):m.frontFace(m.CCW),ca=a.flipSided}function l(a){R!==a&&(a?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),R=a)}function n(a){Y!==a&&(m.depthMask(a),Y=a)}function p(a,
- c,b){X!==a&&(a?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),X=a);if(a&&(ga!==c||oa!==b))m.polygonOffset(c,b),ga=c,oa=b}function u(a){ua[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ua[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ua[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ua[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ua[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ua[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);
- for(var c,a=0;a<6;a++)c=ua[a],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function t(a){for(var c=a.matrixWorld,b=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ua[e].x*c.n14+ua[e].y*c.n24+ua[e].z*c.n34+ua[e].w,a<=b)return!1;return!0}function v(a){var c=a.object.material;c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function o(a){var c=a.object,b=a.buffer,e;e=c.material;if(e instanceof THREE.MeshFaceMaterial){if(b=
- b.materialIndex,b>=0)c=c.geometry.materials[b],c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}else if(c=e)c.transparent?(a.transparent=c,a.opaque=null):(a.opaque=c,a.transparent=null)}function y(a,c){return c.z-a.z}function x(a){var c,b,n,p=0,o,v,G,w,x=a.lights;pa||(pa=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));c=0;for(b=x.length;c<b;c++)if(n=x[c],n instanceof THREE.SpotLight&&n.castShadow){da=
- -1;S.shadowMap[p]||(S.shadowMap[p]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ka[p]||(ka[p]=new THREE.Matrix4);o=S.shadowMap[p];v=ka[p];pa.position.copy(n.position);pa.lookAt(n.target.position);pa.update(void 0,!0);a.update(void 0,!1,pa);v.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(pa.projectionMatrix);v.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Ea);
- pa.projectionMatrix.flattenToArray(Da);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);u(sa);S.initWebGLObjects(a);V(o);m.clearColor(1,1,1,1);S.clear();m.clearColor(I.r,I.g,I.b,N);v=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(o=0;o<v;o++)G=a.__webglObjects[o],w=G.object,w.visible&&w.castShadow?!(w instanceof THREE.Mesh)||!w.frustumCulled||t(w)?(w.matrixWorld.flattenToArray(w._objectMatrixArray),A(w,pa,!1),G.render=!0):G.render=!1:G.render=!1;l(!0);F(THREE.NormalBlending);
- for(o=0;o<v;o++)if(G=a.__webglObjects[o],G.render)w=G.object,buffer=G.buffer,k(w),G=w.customDepthMaterial?w.customDepthMaterial:w.geometry.morphTargets.length?Ca:va,f(pa,x,null,G,buffer,w);for(o=0;o<n;o++)G=a.__webglObjectsImmediate[o],w=G.object,w.visible&&w.castShadow&&(w.matrixAutoUpdate&&w.matrixWorld.flattenToArray(w._objectMatrixArray),ia=-1,A(w,pa,!1),k(w),program=e(pa,x,null,va,w),w.immediateRenderCallback?w.immediateRenderCallback(program,m,ua):w.render(function(a){h(a,program,va.shading)}));
- p++}}function w(a,c){var b,e,f;b=W.attributes;var k=W.uniforms,h=la/qa,l,n=[],p=qa*0.5,t=la*0.5,o=!0;m.useProgram(W.program);U=W.program;ia=R=Z=-1;Ta||(m.enableVertexAttribArray(W.attributes.position),m.enableVertexAttribArray(W.attributes.uv),Ta=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.vertexAttribPointer(b.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);
- m.uniformMatrix4fv(k.projectionMatrix,!1,Da);m.activeTexture(m.TEXTURE0);m.uniform1i(k.map,0);b=0;for(e=a.__webglSprites.length;b<e;b++)if(f=a.__webglSprites[b],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);b=0;for(e=a.__webglSprites.length;b<e;b++)f=a.__webglSprites[b],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&
- (f.useScreenCoordinates?(m.uniform1i(k.useScreenCoordinates,1),m.uniform3f(k.screenPosition,(f.position.x-p)/p,(t-f.position.y)/t,Math.max(0,Math.min(1,f.position.z)))):(m.uniform1i(k.useScreenCoordinates,0),m.uniform1i(k.affectedByDistance,f.affectedByDistance?1:0),m.uniformMatrix4fv(k.modelViewMatrix,!1,f._modelViewMatrixArray)),l=f.map.image.width/(f.scaleByViewport?la:1),n[0]=l*h*f.scale.x,n[1]=l*f.scale.y,m.uniform2f(k.uvScale,f.uvScale.x,f.uvScale.y),m.uniform2f(k.uvOffset,f.uvOffset.x,f.uvOffset.y),
- m.uniform2f(k.alignment,f.alignment.x,f.alignment.y),m.uniform1f(k.opacity,f.opacity),m.uniform3f(k.color,f.color.r,f.color.g,f.color.b),m.uniform1f(k.rotation,f.rotation),m.uniform2fv(k.scale,n),f.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),F(f.blending),E(f.map,0),m.drawElements(m.TRIANGLES,6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(Y)}function A(a,c,b){a._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
- a.matrixWorld,a._modelViewMatrixArray);b&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function z(a){for(var c in a.attributes)if(a.attributes[c].needsUpdate)return!0;return!1}function C(a){for(var c in a.attributes)a.attributes[c].needsUpdate=!1}function B(a,c){for(var b=a.length-1;b>=0;b--)a[b].object===c&&a.splice(b,1)}function K(a,c,b){a.push({buffer:c,object:b,opaque:null,transparent:null})}function F(a){if(a!==Z){switch(a){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);
- m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}Z=a}}function M(a,c,b){(b.width&b.width-1)===0&&(b.height&b.height-1)===0?(m.texParameteri(a,m.TEXTURE_WRAP_S,T(c.wrapS)),m.texParameteri(a,
- m.TEXTURE_WRAP_T,T(c.wrapT)),m.texParameteri(a,m.TEXTURE_MAG_FILTER,T(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,T(c.minFilter)),m.generateMipmap(a)):(m.texParameteri(a,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(a,m.TEXTURE_MAG_FILTER,L(c.magFilter)),m.texParameteri(a,m.TEXTURE_MIN_FILTER,L(c.minFilter)))}function E(a,c){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=m.createTexture(),S.info.memory.textures++;
- m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),m.UNSIGNED_BYTE,a.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,a.image);M(m.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else m.activeTexture(m.TEXTURE0+c),m.bindTexture(m.TEXTURE_2D,a.__webglTexture)}function O(a,c){m.bindRenderbuffer(m.RENDERBUFFER,a);c.depthBuffer&&!c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,
- m.DEPTH_COMPONENT16,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,a)):c.depthBuffer&&c.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_STENCIL,c.width,c.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,a)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,c.width,c.height)}function V(a){var c=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;
- if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=m.createTexture();if(c){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture);M(m.TEXTURE_CUBE_MAP,a,a);for(var b=0;b<6;b++){a.__webglFramebuffer[b]=m.createFramebuffer();a.__webglRenderbuffer[b]=m.createRenderbuffer();m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+b,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=m.TEXTURE_CUBE_MAP_POSITIVE_X+b;m.bindFramebuffer(m.FRAMEBUFFER,
- a.__webglFramebuffer[b]);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,f,e.__webglTexture,0);O(a.__webglRenderbuffer[b],a)}}else a.__webglFramebuffer=m.createFramebuffer(),a.__webglRenderbuffer=m.createRenderbuffer(),m.bindTexture(m.TEXTURE_2D,a.__webglTexture),M(m.TEXTURE_2D,a,a),m.texImage2D(m.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),b=m.TEXTURE_2D,m.bindFramebuffer(m.FRAMEBUFFER,a.__webglFramebuffer),m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,
- b,a.__webglTexture,0),m.bindRenderbuffer(m.RENDERBUFFER,a.__webglRenderbuffer),O(a.__webglRenderbuffer,a);c?m.bindTexture(m.TEXTURE_CUBE_MAP,null):m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}a?(c=c?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,b=a.width,a=a.height,f=e=0):(c=null,b=qa,a=la,e=na,f=fa);c!==ea&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(e,f,b,a),ea=c)}function H(a){a instanceof THREE.WebGLRenderTargetCube?
- (m.bindTexture(m.TEXTURE_CUBE_MAP,a.__webglTexture),m.generateMipmap(m.TEXTURE_CUBE_MAP),m.bindTexture(m.TEXTURE_CUBE_MAP,null)):(m.bindTexture(m.TEXTURE_2D,a.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))}function P(a,c){var b;a==="fragment"?b=m.createShader(m.FRAGMENT_SHADER):a==="vertex"&&(b=m.createShader(m.VERTEX_SHADER));m.shaderSource(b,c);m.compileShader(b);if(!m.getShaderParameter(b,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(b)),console.error(c),
- null;return b}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}}function T(a){switch(a){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;
- case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;
- case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}var S=this,m,aa=[],U=null,ea=null,da=-1,ia=null,ha=0,ja=null,ca=null,Z=null,R=null,Y=null,X=null,ga=null,oa=null,na=0,fa=0,qa=0,la=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Da=new Float32Array(16),Ea=new Float32Array(16),za=new THREE.Vector4,
- Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},xa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),G=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ma=a.antialias!==void 0?a.antialias:!1,I=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),N=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,
- geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=xa;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=
- !0;var pa,ka=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya}),Ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});va._shadowPass=!0;Ca._shadowPass=!0;try{if(!(m=xa.getContext("experimental-webgl",{antialias:ma,stencil:G,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+
- " | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}m.clearColor(0,0,0,1);m.clearDepth(1);m.clearStencil(0);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(I.r,I.g,I.b,N);this.context=m;var Ga=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
- 0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);G=0;W.vertices[G++]=-1;W.vertices[G++]=-1;W.vertices[G++]=0;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=1;W.vertices[G++]=0;W.vertices[G++]=-1;W.vertices[G++]=1;W.vertices[G++]=0;G=W.vertices[G++]=0;W.faces[G++]=0;W.faces[G++]=1;W.faces[G++]=2;W.faces[G++]=0;W.faces[G++]=2;W.faces[G++]=3;W.vertexBuffer=m.createBuffer();W.elementBuffer=
- m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,W.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,W.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,W.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,W.faces,m.STATIC_DRAW);W.program=m.createProgram();m.attachShader(W.program,P("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(W.program,P("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=m.getAttribLocation(W.program,
- "position");W.attributes.uv=m.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=m.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=m.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=m.getUniformLocation(W.program,"rotation");W.uniforms.scale=m.getUniformLocation(W.program,"scale");W.uniforms.alignment=m.getUniformLocation(W.program,"alignment");W.uniforms.color=m.getUniformLocation(W.program,"color");W.uniforms.map=m.getUniformLocation(W.program,"map");W.uniforms.opacity=
- m.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=m.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=m.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=m.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=m.getUniformLocation(W.program,"modelViewMatrix");W.uniforms.projectionMatrix=m.getUniformLocation(W.program,"projectionMatrix");var Ta=!1;this.setSize=function(a,c){xa.width=a;xa.height=
- c;this.setViewport(0,0,xa.width,xa.height)};this.setViewport=function(a,c,b,e){na=a;fa=c;qa=b;la=e;m.viewport(na,fa,qa,la)};this.setScissor=function(a,c,b,e){m.scissor(a,c,b,e)};this.enableScissorTest=function(a){a?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.setClearColorHex=function(a,c){I.setHex(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.setClearColor=function(a,c){I.copy(a);N=c;m.clearColor(I.r,I.g,I.b,N)};this.getClearColor=function(){return I};this.getClearAlpha=function(){return N};
- this.clear=function(a,c,b){var e=0;if(a===void 0||a)e|=m.COLOR_BUFFER_BIT;if(c===void 0||c)e|=m.DEPTH_BUFFER_BIT;if(b===void 0||b)e|=m.STENCIL_BUFFER_BIT;m.clear(e)};this.getContext=function(){return m};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[g];m.deleteBuffer(c.__webglVertexBuffer);
- m.deleteBuffer(c.__webglNormalBuffer);m.deleteBuffer(c.__webglTangentBuffer);m.deleteBuffer(c.__webglColorBuffer);m.deleteBuffer(c.__webglUVBuffer);m.deleteBuffer(c.__webglUV2Buffer);m.deleteBuffer(c.__webglSkinVertexABuffer);m.deleteBuffer(c.__webglSkinVertexBBuffer);m.deleteBuffer(c.__webglSkinIndicesBuffer);m.deleteBuffer(c.__webglSkinWeightsBuffer);m.deleteBuffer(c.__webglFaceBuffer);m.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var b=0,e=c.numMorphTargets;b<e;b++)m.deleteBuffer(c.__webglMorphTargetsBuffers[b]);
- S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,m.deleteBuffer(a.__webglVertexBuffer),m.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=
- function(a){if(a.__webglInit)a.__webglInit=!1,m.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.initMaterial=function(a,c,b,e){var f,k,h,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");
- if(l){var n=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,t,o;p=o=n=0;for(t=c.length;p<t;p++)h=c[p],h instanceof THREE.SpotLight&&o++,h instanceof THREE.DirectionalLight&&o++,h instanceof THREE.PointLight&&n++;n+o<=ta?p=o:(p=Math.ceil(ta*o/(n+o)),n=ta-p);h={directional:p,point:n};n=o=0;for(p=c.length;n<p;n++)t=c[n],t instanceof THREE.SpotLight&&t.castShadow&&o++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=
- e.bones.length;var u;a:{p=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,c=a.attributes,b={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:b,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,
- maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},w,e=[];l?e.push(l):(e.push(p),e.push(t));for(w in b)e.push(w),e.push(b[w]);l=e.join();w=0;for(e=aa.length;w<e;w++)if(aa[w].code===l){u=aa[w].program;break a}w=m.createProgram();e=[Ga?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,
- "#define MAX_SHADOWS "+b.maxShadows,"#define MAX_BONES "+b.maxBones,b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":"",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.skinning?"#define USE_SKINNING":"",b.morphTargets?"#define USE_MORPHTARGETS":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.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");
- h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+b.maxDirLights,"#define MAX_POINT_LIGHTS "+b.maxPointLights,"#define MAX_SHADOWS "+b.maxShadows,b.alphaTest?"#define ALPHATEST "+b.alphaTest:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",b.useFog&&b.fog?"#define USE_FOG":"",b.useFog&&b.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",b.map?"#define USE_MAP":"",b.envMap?"#define USE_ENVMAP":
- "",b.lightMap?"#define USE_LIGHTMAP":"",b.vertexColors?"#define USE_COLOR":"",b.metal?"#define METAL":"",b.perPixel?"#define PHONG_PER_PIXEL":"",b.shadowMapEnabled?"#define USE_SHADOWMAP":"",b.shadowMapSoft?"#define SHADOWMAP_SOFT":"",b.shadowMapSoft?"#define SHADOWMAP_WIDTH "+b.shadowMapWidth.toFixed(1):"",b.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+b.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m.attachShader(w,P("fragment",h+p));m.attachShader(w,
- P("vertex",e+t));m.linkProgram(w);m.getProgramParameter(w,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(w,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");w.uniforms={};w.attributes={};var G,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(G in n)e.push(G);G=e;e=0;for(n=G.length;e<n;e++)p=G[e],w.uniforms[p]=m.getUniformLocation(w,
- p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(G=0;G<b.maxMorphTargets;G++)e.push("morphTarget"+G);for(u in c)e.push(u);u=e;G=0;for(c=u.length;G<c;G++)b=u[G],w.attributes[b]=m.getAttribLocation(w,b);w.id=aa.length;aa.push({program:w,code:l});S.info.memory.programs=aa.length;u=w}a.program=u;u=a.program.attributes;u.position>=0&&m.enableVertexAttribArray(u.position);u.color>=0&&m.enableVertexAttribArray(u.color);u.normal>=0&&m.enableVertexAttribArray(u.normal);
- u.tangent>=0&&m.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(m.enableVertexAttribArray(u.skinVertexA),m.enableVertexAttribArray(u.skinVertexB),m.enableVertexAttribArray(u.skinIndex),m.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(k in a.attributes)u[k]!==void 0&&u[k]>=0&&m.enableVertexAttribArray(u[k]);if(a.morphTargets)for(k=a.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)G="morphTarget"+k,u[G]>=0&&(m.enableVertexAttribArray(u[G]),
- a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,c,b,e){V(a);this.clear(c,b,e)};this.updateShadowMap=function(a,c){x(a,c)};this.render=function(a,c,b,G){var ma,$,z,C,B,I,K,E=a.lights,na=a.fog;da=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&x(a,c);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;if(c.matrixAutoUpdate){for(z=c;z.parent;)z=z.parent;z.update(void 0,!0)}a.update(void 0,!1,
- c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Da);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);u(sa);this.initWebGLObjects(a);V(b);(this.autoClear||G)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);z=a.__webglObjects.length;for(G=0;G<z;G++)if(B=a.__webglObjects[G],I=B.object,I.visible)if(!(I instanceof THREE.Mesh)||!I.frustumCulled||t(I)){if(I.matrixWorld.flattenToArray(I._objectMatrixArray),A(I,c,!0),o(B),B.render=!0,this.sortObjects)B.object.renderDepth?
- B.z=B.object.renderDepth:(za.copy(I.position),sa.multiplyVector3(za),B.z=za.z)}else B.render=!1;else B.render=!1;this.sortObjects&&a.__webglObjects.sort(y);C=a.__webglObjectsImmediate.length;for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray),A(I,c,!0),v(B));if(a.overrideMaterial){l(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render)I=B.object,K=B.buffer,
- k(I),f(c,E,na,a.overrideMaterial,K,I);for(G=0;G<C;G++)B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,k(I),ma=e(c,E,na,a.overrideMaterial,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(c){h(c,ma,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(G=z-1;G>=0;G--)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),f(c,E,na,$,K,
- I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.opaque))k(I),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)});for(G=0;G<z;G++)if(B=a.__webglObjects[G],B.render&&(I=B.object,K=B.buffer,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),
- f(c,E,na,$,K,I);for(G=0;G<C;G++)if(B=a.__webglObjectsImmediate[G],I=B.object,I.visible&&(ia=-1,$=B.transparent))k(I),F($.blending),l($.depthTest),n($.depthWrite),p($.polygonOffset,$.polygonOffsetFactor,$.polygonOffsetUnits),ma=e(c,E,na,$,I),I.immediateRenderCallback?I.immediateRenderCallback(ma,m,ua):I.render(function(a){h(a,ma,$.shading)})}a.__webglSprites.length&&w(a,c);b&&b.minFilter!==THREE.NearestFilter&&b.minFilter!==THREE.LinearFilter&&H(b)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=
- [],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,k=void 0,h=void 0,l=void 0;if(!e.__webglInit)if(e.__webglInit=!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),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var l=h,n=void 0,p=void 0,t=void 0,o=void 0,
- v=t=void 0,u=void 0,G={},w=l.morphTargets.length;l.geometryGroups={};n=0;for(p=l.faces.length;n<p;n++)t=l.faces[n],o=t.materialIndex,v=o!==void 0?o:-1,G[v]===void 0&&(G[v]={hash:v,counter:0}),u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]===void 0&&(l.geometryGroups[u]={faces:[],materialIndex:o,vertices:0,numMorphTargets:w}),t=t instanceof THREE.Face3?3:4,l.geometryGroups[u].vertices+t>65535&&(G[v].counter+=1,u=G[v].hash+"_"+G[v].counter,l.geometryGroups[u]===void 0&&(l.geometryGroups[u]={faces:[],
- materialIndex:o,vertices:0,numMorphTargets:w})),l.geometryGroups[u].faces.push(n),l.geometryGroups[u].vertices+=t;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=ha++,l.geometryGroupsList.push(l.geometryGroups[n])}for(k in h.geometryGroups)if(l=h.geometryGroups[k],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=m.createBuffer();n.__webglNormalBuffer=m.createBuffer();n.__webglTangentBuffer=m.createBuffer();n.__webglColorBuffer=m.createBuffer();n.__webglUVBuffer=
- m.createBuffer();n.__webglUV2Buffer=m.createBuffer();n.__webglSkinVertexABuffer=m.createBuffer();n.__webglSkinVertexBBuffer=m.createBuffer();n.__webglSkinIndicesBuffer=m.createBuffer();n.__webglSkinWeightsBuffer=m.createBuffer();n.__webglFaceBuffer=m.createBuffer();n.__webglLineBuffer=m.createBuffer();if(n.numMorphTargets){o=p=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(o=n.numMorphTargets;p<o;p++)n.__webglMorphTargetsBuffers.push(m.createBuffer())}S.info.memory.geometries++;for(var o=e,x=t=G=
- void 0,v=x=w=x=void 0,u=v=n=0,y=t=void 0,ma=void 0,t=p=w=G=void 0,w=o.geometry,y=w.faces,ma=l.faces,G=0,t=ma.length;G<t;G++)x=ma[G],x=y[x],x instanceof THREE.Face3?(n+=3,v+=1,u+=3):x instanceof THREE.Face4&&(n+=4,v+=2,u+=4);G=b(o,l);t=G.map||G.lightMap||G instanceof THREE.ShaderMaterial?!0:!1;ma=G instanceof THREE.MeshBasicMaterial&&!G.envMap||G instanceof THREE.MeshDepthMaterial?!1:G&&G.shading!==void 0&&G.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;y=G.vertexColors?G.vertexColors:
- !1;l.__vertexArray=new Float32Array(n*3);if(ma)l.__normalArray=new Float32Array(n*3);if(w.hasTangents)l.__tangentArray=new Float32Array(n*4);if(y)l.__colorArray=new Float32Array(n*3);if(t){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)l.__uvArray=new Float32Array(n*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(n*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)l.__skinVertexAArray=new Float32Array(n*4),l.__skinVertexBArray=new Float32Array(n*
- 4),l.__skinIndexArray=new Float32Array(n*4),l.__skinWeightArray=new Float32Array(n*4);l.__faceArray=new Uint16Array(v*3);l.__lineArray=new Uint16Array(u*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];w=0;for(x=l.numMorphTargets;w<x;w++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=ma===THREE.SmoothShading;l.__uvType=t;l.__vertexColorType=y;l.__normalType=ma;l.__webglFaceCount=v*3;l.__webglLineCount=u*2;if(G.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=
- [];o=void 0;for(o in G.attributes){t=G.attributes[o];w={};for(p in t)w[p]=t[p];if(!w.__webglInitialized||w.createUniqueBuffers)w.__webglInitialized=!0,v=1,w.type==="v2"?v=2:w.type==="v3"?v=3:w.type==="v4"?v=4:w.type==="c"&&(v=3),w.size=v,w.array=new Float32Array(n*v),w.buffer=m.createBuffer(),w.buffer.belongsToAttribute=o,t.needsUpdate=!0,w.__original=t;l.__webglCustomAttributesList.push(w)}}l.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=
- !0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=m.createBuffer(),l.__webglColorBuffer=m.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)l=h,l.__webglVertexBuffer=m.createBuffer(),
- l.__webglColorBuffer=m.createBuffer(),S.info.memory.geometries++,l=h,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){l=h;l.__webglVertexBuffer=m.createBuffer();l.__webglColorBuffer=m.createBuffer();S.info.geometries++;l=h;p=e;n=l.vertices.length;l.__vertexArray=new Float32Array(n*3);l.__colorArray=new Float32Array(n*
- 3);l.__sortArray=[];l.__webglParticleCount=n;p=p.material;if(p.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];o=void 0;for(o in p.attributes){originalAttribute=p.attributes[o];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(n*size),attribute.buffer=m.createBuffer(),attribute.buffer.belongsToAttribute=o,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;l.__webglCustomAttributesList.push(attribute)}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)l=h.geometryGroups[k],K(f.__webglObjects,l,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
- e instanceof THREE.ParticleSystem?(h=e.geometry,K(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)B(f.__webglObjects,
- e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;for(h=f.length-1;h>=0;h--)f[h]===k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&B(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(h=a.__webglObjects[e].object,k=h.geometry,l=v=o=void 0,h instanceof THREE.Mesh){n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(o=k.geometryGroupsList[n],l=b(h,o),v=l.attributes&&z(l),k.__dirtyVertices||
- k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||v)if(v=m.DYNAMIC_DRAW,u=!k.dynamic,o.__inittedArrays){var $=w=G=void 0,I=void 0,A=$=void 0,E=void 0,na=void 0,O=void 0,M=x=ma=y=t=void 0,H=void 0,F=void 0,fa=void 0,ta=void 0,N=I=O=I=na=E=void 0,L=void 0,J=L=N=E=void 0,D=void 0,J=L=N=$=$=A=L=N=I=J=L=N=D=J=L=N=D=J=L=N=void 0,R=0,P=0,qa=0,Y=0,la=0,pa=0,T=0,W=0,V=0,Q=0,U=0,X=J=0,X=void 0,ka=o.__vertexArray,ia=o.__uvArray,ua=o.__uv2Array,ya=o.__normalArray,
- aa=o.__tangentArray,da=o.__colorArray,ga=o.__skinVertexAArray,ea=o.__skinVertexBArray,Z=o.__skinIndexArray,ca=o.__skinWeightArray,ja=o.__morphTargetsArrays,oa=o.__webglCustomAttributesList,D=void 0,Ca=o.__faceArray,va=o.__lineArray,Ba=o.__needsSmoothNormals,y=o.__vertexColorType,t=o.__uvType,ma=o.__normalType,sa=h.geometry,Da=sa.__dirtyVertices,Ea=sa.__dirtyElements,za=sa.__dirtyUvs,Fa=sa.__dirtyNormals,xa=sa.__dirtyTangents,Ga=sa.__dirtyColors,Ta=sa.__dirtyMorphTargets,Pa=sa.vertices,bb=o.faces,
- eb=sa.faces,cb=sa.faceVertexUvs[0],db=sa.faceVertexUvs[1],Qa=sa.skinVerticesA,Ra=sa.skinVerticesB,Sa=sa.skinIndices,Ja=sa.skinWeights,Ia=sa.morphTargets;if(oa){N=0;for(L=oa.length;N<L;N++)oa[N].offset=0,oa[N].offsetSrc=0}G=0;for(w=bb.length;G<w;G++)if($=bb[G],I=eb[$],cb&&(x=cb[$]),db&&(M=db[$]),$=I.vertexNormals,A=I.normal,E=I.vertexColors,na=I.color,O=I.vertexTangents,I instanceof THREE.Face3){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+
- 3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,P+=9;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.offsetSrc+=
- 3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(H=D.value[I.a],F=D.value[I.b],fa=D.value[I.c]):D.boundTo==="faces"?(fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],D.offsetSrc+=3),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=
- F.b,D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z),D.offset+=9):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.offset+=12))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,
- F=Ia[N].vertices[I.b].position,fa=Ia[N].vertices[I.c].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z;U+=9}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],ca[Q]=N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,
- Z[Q+10]=J.z,Z[Q+11]=J.w,N=Qa[I.a],L=Qa[I.b],J=Qa[I.c],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,Q+=12;if(Ga&&y)E.length===3&&y===THREE.VertexColors?(I=E[0],N=E[1],L=E[2]):L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,da[V+4]=N.g,
- da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,V+=9;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,T+=12;if(Fa&&ma)if($.length===3&&Ba)for(N=0;N<3;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<3;N++)ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<3;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&
- t)for(N=0;N<3;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+2,la+=3,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+2,va[W+4]=R+1,va[W+5]=R+2,W+=6,R+=3)}else if(I instanceof THREE.Face4){if(Da)H=Pa[I.a].position,F=Pa[I.b].position,fa=Pa[I.c].position,ta=Pa[I.d].position,ka[P]=H.x,ka[P+1]=H.y,ka[P+2]=H.z,ka[P+3]=F.x,ka[P+4]=F.y,ka[P+5]=F.z,ka[P+6]=fa.x,ka[P+7]=fa.y,ka[P+8]=fa.z,ka[P+9]=ta.x,ka[P+10]=ta.y,ka[P+11]=ta.z,P+=12;if(oa){N=0;for(L=oa.length;N<L;N++)if(D=oa[N],D.__original.needsUpdate)J=
- D.offset,X=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[J]=D.value[I.a],D.array[J+1]=D.value[I.b],D.array[J+2]=D.value[I.c],D.array[J+3]=D.value[I.d]):D.boundTo==="faces"?(X=D.value[X],D.array[J]=X,D.array[J+1]=X,D.array[J+2]=X,D.array[J+3]=X,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[J]=D.value[X],D.array[J+1]=D.value[X+1],D.array[J+2]=D.value[X+2],D.array[J+3]=D.value[X+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(H=D.value[I.a],
- F=D.value[I.b],fa=D.value[I.c],ta=D.value[I.d]):D.boundTo==="faces"?(ta=fa=F=H=X=D.value[X],D.offsetSrc++):D.boundTo==="faceVertices"&&(H=D.value[X],F=D.value[X+1],fa=D.value[X+2],ta=D.value[X+3],D.offsetSrc+=4),D.size===2?(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=F.x,D.array[J+3]=F.y,D.array[J+4]=fa.x,D.array[J+5]=fa.y,D.array[J+6]=ta.x,D.array[J+7]=ta.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[J]=H.r,D.array[J+1]=H.g,D.array[J+2]=H.b,D.array[J+3]=F.r,D.array[J+4]=F.g,D.array[J+5]=F.b,
- D.array[J+6]=fa.r,D.array[J+7]=fa.g,D.array[J+8]=fa.b,D.array[J+9]=ta.r,D.array[J+10]=ta.g,D.array[J+11]=ta.b):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=F.x,D.array[J+4]=F.y,D.array[J+5]=F.z,D.array[J+6]=fa.x,D.array[J+7]=fa.y,D.array[J+8]=fa.z,D.array[J+9]=ta.x,D.array[J+10]=ta.y,D.array[J+11]=ta.z),D.offset+=12):(D.array[J]=H.x,D.array[J+1]=H.y,D.array[J+2]=H.z,D.array[J+3]=H.w,D.array[J+4]=F.x,D.array[J+5]=F.y,D.array[J+6]=F.z,D.array[J+7]=F.w,D.array[J+8]=fa.x,D.array[J+9]=
- fa.y,D.array[J+10]=fa.z,D.array[J+11]=fa.w,D.array[J+12]=ta.x,D.array[J+13]=ta.y,D.array[J+14]=ta.z,D.array[J+15]=ta.w,D.offset+=16))}if(Ta){N=0;for(L=Ia.length;N<L;N++)H=Ia[N].vertices[I.a].position,F=Ia[N].vertices[I.b].position,fa=Ia[N].vertices[I.c].position,ta=Ia[N].vertices[I.d].position,J=ja[N],J[U]=H.x,J[U+1]=H.y,J[U+2]=H.z,J[U+3]=F.x,J[U+4]=F.y,J[U+5]=F.z,J[U+6]=fa.x,J[U+7]=fa.y,J[U+8]=fa.z,J[U+9]=ta.x,J[U+10]=ta.y,J[U+11]=ta.z;U+=12}if(Ja.length)N=Ja[I.a],L=Ja[I.b],J=Ja[I.c],D=Ja[I.d],ca[Q]=
- N.x,ca[Q+1]=N.y,ca[Q+2]=N.z,ca[Q+3]=N.w,ca[Q+4]=L.x,ca[Q+5]=L.y,ca[Q+6]=L.z,ca[Q+7]=L.w,ca[Q+8]=J.x,ca[Q+9]=J.y,ca[Q+10]=J.z,ca[Q+11]=J.w,ca[Q+12]=D.x,ca[Q+13]=D.y,ca[Q+14]=D.z,ca[Q+15]=D.w,N=Sa[I.a],L=Sa[I.b],J=Sa[I.c],D=Sa[I.d],Z[Q]=N.x,Z[Q+1]=N.y,Z[Q+2]=N.z,Z[Q+3]=N.w,Z[Q+4]=L.x,Z[Q+5]=L.y,Z[Q+6]=L.z,Z[Q+7]=L.w,Z[Q+8]=J.x,Z[Q+9]=J.y,Z[Q+10]=J.z,Z[Q+11]=J.w,Z[Q+12]=D.x,Z[Q+13]=D.y,Z[Q+14]=D.z,Z[Q+15]=D.w,N=Qa[I.a],L=Qa[I.b],J=Qa[I.c],D=Qa[I.d],ga[Q]=N.x,ga[Q+1]=N.y,ga[Q+2]=N.z,ga[Q+3]=1,ga[Q+4]=
- L.x,ga[Q+5]=L.y,ga[Q+6]=L.z,ga[Q+7]=1,ga[Q+8]=J.x,ga[Q+9]=J.y,ga[Q+10]=J.z,ga[Q+11]=1,ga[Q+12]=D.x,ga[Q+13]=D.y,ga[Q+14]=D.z,ga[Q+15]=1,N=Ra[I.a],L=Ra[I.b],J=Ra[I.c],I=Ra[I.d],ea[Q]=N.x,ea[Q+1]=N.y,ea[Q+2]=N.z,ea[Q+3]=1,ea[Q+4]=L.x,ea[Q+5]=L.y,ea[Q+6]=L.z,ea[Q+7]=1,ea[Q+8]=J.x,ea[Q+9]=J.y,ea[Q+10]=J.z,ea[Q+11]=1,ea[Q+12]=I.x,ea[Q+13]=I.y,ea[Q+14]=I.z,ea[Q+15]=1,Q+=16;if(Ga&&y)E.length===4&&y===THREE.VertexColors?(I=E[0],N=E[1],L=E[2],E=E[3]):E=L=N=I=na,da[V]=I.r,da[V+1]=I.g,da[V+2]=I.b,da[V+3]=N.r,
- da[V+4]=N.g,da[V+5]=N.b,da[V+6]=L.r,da[V+7]=L.g,da[V+8]=L.b,da[V+9]=E.r,da[V+10]=E.g,da[V+11]=E.b,V+=12;if(xa&&sa.hasTangents)E=O[0],na=O[1],I=O[2],O=O[3],aa[T]=E.x,aa[T+1]=E.y,aa[T+2]=E.z,aa[T+3]=E.w,aa[T+4]=na.x,aa[T+5]=na.y,aa[T+6]=na.z,aa[T+7]=na.w,aa[T+8]=I.x,aa[T+9]=I.y,aa[T+10]=I.z,aa[T+11]=I.w,aa[T+12]=O.x,aa[T+13]=O.y,aa[T+14]=O.z,aa[T+15]=O.w,T+=16;if(Fa&&ma)if($.length===4&&Ba)for(N=0;N<4;N++)A=$[N],ya[pa]=A.x,ya[pa+1]=A.y,ya[pa+2]=A.z,pa+=3;else for(N=0;N<4;N++)ya[pa]=A.x,ya[pa+1]=A.y,
- ya[pa+2]=A.z,pa+=3;if(za&&x!==void 0&&t)for(N=0;N<4;N++)$=x[N],ia[qa]=$.u,ia[qa+1]=$.v,qa+=2;if(za&&M!==void 0&&t)for(N=0;N<4;N++)$=M[N],ua[Y]=$.u,ua[Y+1]=$.v,Y+=2;Ea&&(Ca[la]=R,Ca[la+1]=R+1,Ca[la+2]=R+3,Ca[la+3]=R+1,Ca[la+4]=R+2,Ca[la+5]=R+3,la+=6,va[W]=R,va[W+1]=R+1,va[W+2]=R,va[W+3]=R+3,va[W+4]=R+1,va[W+5]=R+2,va[W+6]=R+2,va[W+7]=R+3,W+=8,R+=4)}Da&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,ka,v));if(oa){N=0;for(L=oa.length;N<L;N++)D=oa[N],D.__original.needsUpdate&&
- (m.bindBuffer(m.ARRAY_BUFFER,D.buffer),m.bufferData(m.ARRAY_BUFFER,D.array,v))}if(Ta){N=0;for(L=Ia.length;N<L;N++)m.bindBuffer(m.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[N]),m.bufferData(m.ARRAY_BUFFER,ja[N],v)}Ga&&V>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,da,v));Fa&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,ya,v));xa&&sa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,aa,
- v));za&&qa>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ia,v));za&&Y>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ua,v));Ea&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,Ca,v),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,va,v));Q>0&&(m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,ga,v),m.bindBuffer(m.ARRAY_BUFFER,
- o.__webglSkinVertexBBuffer),m.bufferData(m.ARRAY_BUFFER,ea,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,Z,v),m.bindBuffer(m.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,ca,v));u&&(delete o.__inittedArrays,delete o.__colorArray,delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,delete o.__skinVertexBArray,delete o.__skinIndexArray,
- delete o.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;l.attributes&&C(l)}else if(h instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){h=k;l=m.DYNAMIC_DRAW;n=G=u=u=void 0;w=h.vertices;p=h.colors;t=w.length;o=p.length;y=h.__vertexArray;v=h.__colorArray;ma=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u<t;u++)G=w[u].position,n=u*3,y[n]=G.x,y[n+1]=G.y,y[n+2]=G.z;m.bindBuffer(m.ARRAY_BUFFER,
- h.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,y,l)}if(ma){for(u=0;u<o;u++)color=p[u],n=u*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,v,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){if(k.__dirtyVertices||k.__dirtyColors){h=k;l=m.DYNAMIC_DRAW;n=G=u=u=void 0;w=h.vertices;p=h.colors;t=w.length;o=p.length;y=h.__vertexArray;v=h.__colorArray;ma=h.__dirtyColors;if(h.__dirtyVertices){for(u=0;u<
- t;u++)G=w[u].position,n=u*3,y[n]=G.x,y[n+1]=G.y,y[n+2]=G.z;m.bindBuffer(m.ARRAY_BUFFER,h.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,y,l)}if(ma){for(u=0;u<o;u++)color=p[u],n=u*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,h.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,v,l)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)l=b(h,o),v=l.attributes&&z(l),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||v)&&c(k,m.DYNAMIC_DRAW,h),
- k.__dirtyVertices=!1,k.__dirtyColors=!1,l.attributes&&C(l)};this.setFaceCulling=function(a,c){a?(!c||c==="ccw"?m.frontFace(m.CCW):m.frontFace(m.CW),a==="back"?m.cullFace(m.BACK):a==="front"?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),m.enable(m.CULL_FACE)):m.disable(m.CULL_FACE)};this.supportsVertexTextures=function(){return Ga}};
- THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
- THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
- THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
- THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
- THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
- THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
- THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
- THREE.ColorUtils={adjustHSV:function(a,b,c,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+e,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,e=a.g,f=a.b,h=Math.max(Math.max(c,e),f),k=Math.min(Math.min(c,e),f);if(k===h)k=c=0;else{var l=h-k,k=l/h,c=c===h?(e-f)/l:e===h?2+(f-c)/l:4+(c-e)/l;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=k;b.v=h;return b}};
- THREE.ColorUtils.__hsv={h:0,s:0,v:0};
- THREE.GeometryUtils={merge:function(a,b){for(var c,e,f=a.vertices.length,h=b instanceof THREE.Mesh?b.geometry:b,k=a.vertices,l=h.vertices,n=a.faces,p=h.faces,u=a.faceVertexUvs[0],t=h.faceVertexUvs[0],v={},o=0;o<a.materials.length;o++)v[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,e=new THREE.Matrix4,e.extractRotation(c,b.scale);for(var o=0,y=l.length;o<y;o++){var x=new THREE.Vertex(l[o].position.clone());c&&c.multiplyVector3(x.position);k.push(x)}o=
- 0;for(y=p.length;o<y;o++){var k=p[o],w,A,z=k.vertexNormals,C=k.vertexColors;k instanceof THREE.Face3?w=new THREE.Face3(k.a+f,k.b+f,k.c+f):k instanceof THREE.Face4&&(w=new THREE.Face4(k.a+f,k.b+f,k.c+f,k.d+f));w.normal.copy(k.normal);e&&e.multiplyVector3(w.normal);l=0;for(x=z.length;l<x;l++)A=z[l].clone(),e&&e.multiplyVector3(A),w.vertexNormals.push(A);w.color.copy(k.color);l=0;for(x=C.length;l<x;l++)A=C[l],w.vertexColors.push(A.clone());if(k.materialIndex!==void 0){l=h.materials[k.materialIndex];
- x=v[l.id];if(x===void 0)x=a.materials.length,a.materials.push(l);w.materialIndex=x}w.centroid.copy(k.centroid);c&&c.multiplyVector3(w.centroid);n.push(w)}o=0;for(y=t.length;o<y;o++){c=t[o];e=[];l=0;for(x=c.length;l<x;l++)e.push(new THREE.UV(c[l].u,c[l].v));u.push(e)}},clone:function(a){var b=new THREE.Geometry,c,e=a.vertices,f=a.faces,h=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();a=0;for(c=e.length;a<c;a++){var k=new THREE.Vertex(e[a].position.clone());b.vertices.push(k)}a=0;
- for(c=f.length;a<c;a++){var l=f[a],n,p,u=l.vertexNormals,t=l.vertexColors;l instanceof THREE.Face3?n=new THREE.Face3(l.a,l.b,l.c):l instanceof THREE.Face4&&(n=new THREE.Face4(l.a,l.b,l.c,l.d));n.normal.copy(l.normal);e=0;for(k=u.length;e<k;e++)p=u[e],n.vertexNormals.push(p.clone());n.color.copy(l.color);e=0;for(k=t.length;e<k;e++)p=t[e],n.vertexColors.push(p.clone());n.materialIndex=l.materialIndex;n.centroid.copy(l.centroid);b.faces.push(n)}a=0;for(c=h.length;a<c;a++){f=h[a];n=[];e=0;for(k=f.length;e<
- k;e++)n.push(new THREE.UV(f[e].u,f[e].v));b.faceVertexUvs[0].push(n)}return b},randomPointInTriangle:function(a,b,c){var e,f,h,k=new THREE.Vector3,l=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();e+f>1&&(e=1-e,f=1-f);h=1-e-f;k.copy(a);k.multiplyScalar(e);l.copy(b);l.multiplyScalar(f);k.addSelf(l);l.copy(c);l.multiplyScalar(h);k.addSelf(l);return k},randomPointInFace:function(a,b,c){var e,f,h;if(a instanceof THREE.Face3)return e=b.vertices[a.a].position,f=b.vertices[a.b].position,
- h=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,f,h);else if(a instanceof THREE.Face4){e=b.vertices[a.a].position;f=b.vertices[a.b].position;h=b.vertices[a.c].position;var b=b.vertices[a.d].position,k;c?a._area1&&a._area2?(c=a._area1,k=a._area2):(c=THREE.GeometryUtils.triangleArea(e,f,b),k=THREE.GeometryUtils.triangleArea(f,h,b),a._area1=c,a._area2=k):(c=THREE.GeometryUtils.triangleArea(e,f,b),k=THREE.GeometryUtils.triangleArea(f,h,b));return THREE.GeometryUtils.random()*(c+
- k)<c?THREE.GeometryUtils.randomPointInTriangle(e,f,b):THREE.GeometryUtils.randomPointInTriangle(f,h,b)}},randomPointsInGeometry:function(a,b){function c(a){function c(b,e){if(e<b)return b;var f=b+Math.floor((e-b)/2);return p[f]>a?c(b,f-1):p[f]<a?c(f+1,e):f}return c(0,p.length-1)}var e,f,h=a.faces,k=a.vertices,l=h.length,n=0,p=[],u,t,v,o;for(f=0;f<l;f++){e=h[f];if(e instanceof THREE.Face3)u=k[e.a].position,t=k[e.b].position,v=k[e.c].position,e._area=THREE.GeometryUtils.triangleArea(u,t,v);else if(e instanceof
- THREE.Face4)u=k[e.a].position,t=k[e.b].position,v=k[e.c].position,o=k[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(u,t,o),e._area2=THREE.GeometryUtils.triangleArea(t,v,o),e._area=e._area1+e._area2;n+=e._area;p[f]=n}e=[];k={};for(f=0;f<b;f++)l=THREE.GeometryUtils.random()*n,l=c(l),e[f]=THREE.GeometryUtils.randomPointInFace(h[l],a,!0),k[l]?k[l]+=1:k[l]=1;return e},triangleArea:function(a,b,c){var e,f=THREE.GeometryUtils.__v1;f.sub(a,b);e=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
- b=0.5*(e+a+c);return Math.sqrt(b*(b-e)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=new THREE.Matrix4;b.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(b);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
- THREE.ImageUtils={loadTexture:function(a,b,c){var e=new Image,f=new THREE.Texture(e,b);e.onload=function(){f.needsUpdate=!0;c&&c(this)};e.crossOrigin="";e.src=a;return f},loadTextureCube:function(a,b,c){var e,f=[],h=new THREE.Texture(f,b),b=f.loadCount=0;for(e=a.length;b<e;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount===6)h.needsUpdate=!0;c&&c(this)},f[b].crossOrigin="",f[b].src=a[b];return h},getNormalMap:function(a,b){var c=function(a){var c=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
- a[2]*a[2]);return[a[0]/c,a[1]/c,a[2]/c]};b|=1;var e=a.width,f=a.height,h=document.createElement("canvas");h.width=e;h.height=f;var k=h.getContext("2d");k.drawImage(a,0,0);for(var l=k.getImageData(0,0,e,f).data,n=k.createImageData(e,f),p=n.data,u=0;u<e;u++)for(var t=1;t<f;t++){var v=t-1<0?f-1:t-1,o=(t+1)%f,y=u-1<0?e-1:u-1,x=(u+1)%e,w=[],A=[0,0,l[(t*e+u)*4]/255*b];w.push([-1,0,l[(t*e+y)*4]/255*b]);w.push([-1,-1,l[(v*e+y)*4]/255*b]);w.push([0,-1,l[(v*e+u)*4]/255*b]);w.push([1,-1,l[(v*e+x)*4]/255*b]);
- w.push([1,0,l[(t*e+x)*4]/255*b]);w.push([1,1,l[(o*e+x)*4]/255*b]);w.push([0,1,l[(o*e+u)*4]/255*b]);w.push([-1,1,l[(o*e+y)*4]/255*b]);v=[];y=w.length;for(o=0;o<y;o++){var x=w[o],z=w[(o+1)%y],x=[x[0]-A[0],x[1]-A[1],x[2]-A[2]],z=[z[0]-A[0],z[1]-A[1],z[2]-A[2]];v.push(c([x[1]*z[2]-x[2]*z[1],x[2]*z[0]-x[0]*z[2],x[0]*z[1]-x[1]*z[0]]))}w=[0,0,0];for(o=0;o<v.length;o++)w[0]+=v[o][0],w[1]+=v[o][1],w[2]+=v[o][2];w[0]/=v.length;w[1]/=v.length;w[2]/=v.length;A=(t*e+u)*4;p[A]=(w[0]+1)/2*255|0;p[A+1]=(w[1]+0.5)*
- 255|0;p[A+2]=w[2]*255|0;p[A+3]=255}k.putImageData(n,0,0);return h}};THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,e,f=a.children.length;for(e=0;e<f;e++)c=a.children[e],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,e=b.length,f=new THREE.Object3D;for(c=0;c<e;c++){var h=new THREE.Mesh(a,b[c]);f.add(h)}return f}};
- 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,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
- value:1},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},uReflectivity:{type:"f",value:0.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,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 bool enableReflection;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform samplerCube tCube;\nuniform float uNormalScale;\nuniform float uReflectivity;\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.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3( 1.0 ), 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.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 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 = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = specularTex.r * pow( pointDotNormalHalf, uShininess );\npointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;\npointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 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 = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = specularTex.r * pow( dirDotNormalHalf, uShininess );\ndirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;\ndirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor) + totalSpecular;\nif ( enableReflection ) {\nvec3 wPos = cameraPosition - vViewPosition;\nvec3 vReflect = reflect( normalize( wPos ), normal );\nvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, uReflectivity );\n}",
- THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\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;",
- THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv * uRepeat + uOffset;\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",
- THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},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;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
- THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
- THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,e=this.getPoint(0),f,h=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),h+=c.distanceTo(e),b.push(h),e=c;return this.cacheArcLengths=b};
- THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),e=0,f=c.length,h;h=b?b:a*c[f-1];time=Date.now();for(var k=0,l=f-1,n;k<=l;)if(e=Math.floor(k+(l-k)/2),n=c[e]-h,n<0)k=e+1;else if(n>0)l=e-1;else{l=e;break}e=l;if(c[e]==h)return e/(f-1);k=c[e];return c=(e+(h-k)/(c[e+1]-k))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
- THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);var b=this.getPoint(b),a=this.getPoint(a),c=new THREE.Vector2;c.sub(a,b);return c.unit()};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(a,b,c,e){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,e))};THREE.LineCurve.prototype=new THREE.Curve;
- THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};
- THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var e=Array.prototype.slice.call(arguments),a=new THREE.Vector2(e[0],e[1]),b=new THREE.Vector2(e[2],e[3]),c=new THREE.Vector2(e[4],e[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
- THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};
- THREE.CubicBezierCurve=function(a,b,c,e){if(!(b instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),b=new THREE.Vector2(f[2],f[3]),c=new THREE.Vector2(f[4],f[5]),e=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=e};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
- THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};
- THREE.SplineCurve=function(a){this.points=a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
- THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>e.length-2?a:a+1;c[3]=a>e.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(e[c[0]].x,e[c[1]].x,e[c[2]].x,e[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(e[c[0]].y,e[c[1]].y,e[c[2]].y,e[c[3]].y,f);return b};THREE.ArcCurve=function(a,b,c,e,f,h){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=e;this.aEndAngle=f;this.aClockwise=h};
- THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);a=this.aStartAngle+a*b;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(a),this.aY+this.aRadius*Math.sin(a))};
- THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,e){return 2*(1-a)*(c-b)+2*a*(e-c)},tangentCubicBezier:function(a,b,c,e,f){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*e*(1-a)-3*a*a*e+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,e,f){var a=(c-a)*0.5,e=(e-b)*0.5,h=f*f;return(2*b-2*c+a+e)*f*h+(-3*b+3*c-2*a-e)*h+a*f+b}};
- THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(v2,v1);b.multiplyScalar(a);b.addSelf(this.v1);return b});
- THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});
- THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,e){this.v0=a;this.v1=b;this.v2=c;this.v3=e},function(a){var b,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)});
- THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a},function(a){var b=new THREE.Vector3,c=[],e=this.points,f;f=(e.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>e.length-2?a:a+1;c[3]=a>e.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(e[c[0]].x,e[c[1]].x,e[c[2]].x,e[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(e[c[0]].y,e[c[1]].y,e[c[2]].y,e[c[3]].y,f);b.z=THREE.Curve.Utils.interpolate(e[c[0]].z,e[c[1]].z,e[c[2]].z,e[c[3]].z,f);return b});
- THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
- THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
- THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,e=this.curves.length;for(c=0;c<e;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
- THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,e,f;b=c=Number.NEGATIVE_INFINITY;e=f=Number.POSITIVE_INFINITY;var h,k,l,n;n=new THREE.Vector2;k=0;for(l=a.length;k<l;k++){h=a[k];if(h.x>b)b=h.x;else if(h.x<e)e=h.x;if(h.y>c)c=h.y;else if(h.y<c)f=h.y;n.addSelf(h.x,h.y)}return{minX:e,minY:f,maxX:b,maxY:c,centroid:n.divideScalar(l)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
- THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
- THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),e,f;if(!b)b=this.bends;e=0;for(f=b.length;e<f;e++)c=this.getWrapPoints(c,b[e]);return c};
- THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),e,f,h,k,l,n;e=0;for(f=a.length;e<f;e++)h=a[e],k=h.x,l=h.y,n=k/c.maxX,n=b.getUtoTmapping(n,k),k=b.getPoint(n),l=b.getNormalVector(n).multiplyScalar(l),h.x=k.x+l.x,h.y=k.y+l.y;return a};THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
- 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(a){this.moveTo(a[0].x,a[0].y);var b,c=a.length;for(b=1;b<c;b++)this.lineTo(a[b].x,a[b].y)};THREE.Path.prototype.moveTo=function(){var a=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:a})};
- THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(e[e.length-2],e[e.length-1]),new THREE.Vector2(a,b)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
- THREE.Path.prototype.quadraticCurveTo=function(a,b,c,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
- THREE.Path.prototype.bezierCurveTo=function(a,b,c,e,f,h){var k=Array.prototype.slice.call(arguments),l=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(l[l.length-2],l[l.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,e),new THREE.Vector2(f,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:k})};
- THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
- THREE.Path.prototype.arc=function(a,b,c,e,f,h){var k=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,e,f,h));this.actions.push({action:THREE.PathActions.ARC,args:k})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
- THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],e,f,h,k,l,n,p,u,t,v,o,y,x;e=0;for(f=this.actions.length;e<f;e++)switch(h=this.actions[e],k=h.action,h=h.args,k){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:l=h[2];n=h[3];t=h[0];v=h[1];c.length>0?(k=c[c.length-1],o=k.x,y=k.y):(k=this.actions[e-1].args,o=k[k.length-2],y=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b2(x,o,t,l),x=THREE.Shape.Utils.b2(x,y,v,
- n),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.BEZIER_CURVE_TO:l=h[4];n=h[5];t=h[0];v=h[1];p=h[2];u=h[3];c.length>0?(k=c[c.length-1],o=k.x,y=k.y):(k=this.actions[e-1].args,o=k[k.length-2],y=k[k.length-1]);for(k=1;k<=a;k++)x=k/a,h=THREE.Shape.Utils.b3(x,o,t,p,l),x=THREE.Shape.Utils.b3(x,y,v,u,n),c.push(new THREE.Vector2(h,x));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[e-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];x=a*h[0].length;k=k.concat(h[0]);h=new THREE.SplineCurve(k);
- for(k=1;k<=x;k++)c.push(h.getPointAt(k/x));break;case THREE.PathActions.ARC:k=this.actions[e-1].args;l=h[0];n=h[1];p=h[2];t=h[3];x=h[4];v=!!h[5];u=k[k.length-2];o=k[k.length-1];k.length==0&&(u=o=0);y=x-t;var w=a*2;for(k=1;k<=w;k++)x=k/w,v||(x=1-x),x=t+x*y,h=u+l+p*Math.cos(x),x=o+n+p*Math.sin(x),c.push(new THREE.Vector2(h,x))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
- THREE.Path.prototype.nltransform=function(a,b,c,e,f,h){var k=this.getPoints(),l,n,p,u,t;l=0;for(n=k.length;l<n;l++)p=k[l],u=p.x,t=p.y,p.x=a*u+b*t+c,p.y=e*t+f*u+h;return k};
- THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,e,f,a=0;for(c=this.actions.length;a<c;a++)e=this.actions[a],f=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&b[e].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";e=
- this.getPoints();a=0;for(c=e.length;a<c;a++)f=e[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
- THREE.Path.prototype.toShapes=function(){var a,b,c,e,f=[],h=new THREE.Path;a=0;for(b=this.actions.length;a<b;a++)c=this.actions[a],e=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(f.push(h),h=new THREE.Path),h[c].apply(h,e);h.actions.length!=0&&f.push(h);if(f.length==0)return[];var k,h=[];if(THREE.Shape.Utils.isClockWise(f[0].getPoints())){a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(k&&h.push(k),k=new THREE.Shape,k.actions=e.actions,k.curves=
- e.curves):k.holes.push(e);h.push(k)}else{k=new THREE.Shape;a=0;for(b=f.length;a<b;a++)e=f[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(k.actions=e.actions,k.curves=e.curves,h.push(k),k=new THREE.Shape):k.holes.push(e)}return h};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(a){return new THREE.ExtrudeGeometry(this,a)};
- THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,e=[];for(b=0;b<c;b++)e[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
- THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
- THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),e=c.concat(),f,h,k,l,n,p,u,t,v,o,y=[];for(n=0;n<b.length;n++){p=b[n];Array.prototype.push.apply(e,p);h=Number.POSITIVE_INFINITY;for(f=0;f<p.length;f++){v=p[f];o=[];for(t=0;t<c.length;t++)u=c[t],u=v.distanceToSquared(u),o.push(u),u<h&&(h=u,k=f,l=t)}f=l-1>=0?l-1:c.length-1;h=k-1>=0?k-1:p.length-1;var x=[p[k],c[l],c[f]];t=THREE.FontUtils.Triangulate.area(x);var w=[p[k],p[h],c[l]];v=THREE.FontUtils.Triangulate.area(w);o=l;u=k;l+=1;k+=-1;l<
- 0&&(l+=c.length);l%=c.length;k<0&&(k+=p.length);k%=p.length;f=l-1>=0?l-1:c.length-1;h=k-1>=0?k-1:p.length-1;x=[p[k],c[l],c[f]];x=THREE.FontUtils.Triangulate.area(x);w=[p[k],p[h],c[l]];w=THREE.FontUtils.Triangulate.area(w);t+v>x+w&&(l=o,k=u,l<0&&(l+=c.length),l%=c.length,k<0&&(k+=p.length),k%=p.length,f=l-1>=0?l-1:c.length-1,h=k-1>=0?k-1:p.length-1);t=c.slice(0,l);v=c.slice(l);o=p.slice(k);u=p.slice(0,k);h=[p[k],p[h],c[l]];y.push([p[k],c[l],c[f]]);y.push(h);c=t.concat(o).concat(u).concat(v)}return{shape:c,
- isolatedPts:y,allpoints:e}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),e=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),h,k,l,n,p={};h=0;for(k=e.length;h<k;h++)n=e[h].x+":"+e[h].y,p[n]!==void 0&&console.log("Duplicate point",n),p[n]=h;h=0;for(k=c.length;h<k;h++){l=c[h];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=p[n],n!==void 0&&(l[e]=n)}h=0;for(k=f.length;h<k;h++){l=f[h];for(e=0;e<3;e++)n=l[e].x+":"+l[e].y,n=p[n],n!==void 0&&(l[e]=n)}return c.concat(f)},
- isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,e){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,e)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,e,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,e)+
- this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){this.text=a;var b=b||this.parameters,c=b.curveSegments!==void 0?b.curveSegments:4,e=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",h=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=e;THREE.FontUtils.weight=f;THREE.FontUtils.style=h};
- THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,e=a.length;c<e;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
- THREE.AnimationHandler=function(){var a=[],b={},c={update:function(c){for(var b=0;b<a.length;b++)a[b].update(c)},addToUpdate:function(c){a.indexOf(c)===-1&&a.push(c)},removeFromUpdate:function(c){c=a.indexOf(c);c!==-1&&a.splice(c,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var e=0;e<a.hierarchy[c].keys.length;e++){if(a.hierarchy[c].keys[e].time<
- 0)a.hierarchy[c].keys[e].time=0;if(a.hierarchy[c].keys[e].rot!==void 0&&!(a.hierarchy[c].keys[e].rot instanceof THREE.Quaternion)){var l=a.hierarchy[c].keys[e].rot;a.hierarchy[c].keys[e].rot=new THREE.Quaternion(l[0],l[1],l[2],l[3])}}if(a.hierarchy[c].keys[0].morphTargets!==void 0){l={};for(e=0;e<a.hierarchy[c].keys.length;e++)for(var n=0;n<a.hierarchy[c].keys[e].morphTargets.length;n++){var p=a.hierarchy[c].keys[e].morphTargets[n];l[p]=-1}a.hierarchy[c].usedMorphTargets=l;for(e=0;e<a.hierarchy[c].keys.length;e++){var u=
- {};for(p in l){for(n=0;n<a.hierarchy[c].keys[e].morphTargets.length;n++)if(a.hierarchy[c].keys[e].morphTargets[n]===p){u[p]=a.hierarchy[c].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[c].keys[e].morphTargets.length&&(u[p]=0)}a.hierarchy[c].keys[e].morphTargetsInfluences=u}}for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].time===a.hierarchy[c].keys[e-1].time&&(a.hierarchy[c].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[c].keys.length;e++)a.hierarchy[c].keys[e].index=e}e=parseInt(a.length*
- a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var c=[];if(a instanceof THREE.SkinnedMesh)for(var b=0;b<a.bones.length;b++)c.push(a.bones[b]);else e(a,c);return c}},e=function(a,c){c.push(a);for(var b=0;b<a.children.length;b++)e(a.children[b],c)};c.LINEAR=0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=
- 2;return c}();THREE.Animation=function(a,b,c,e){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
- THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,e=this.hierarchy.length,f;for(c=0;c<e;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
- THREE.Bone?f.skinMatrix:f.matrix;var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,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 a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
- THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,e,f,h,k,l,n,p,u=this.data.JIT.hierarchy,t,v;this.currentTime+=a*this.timeScale;v=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,y=this.hierarchy.length;o<y;o++)if(a=this.hierarchy[o],n=a.animationCache,this.JITCompile&&u[o][p]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=u[o][p],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
- !1):(a.matrix=u[o][p],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var x=0;x<3;x++){c=b[x];k=n.prevKey[c];l=n.nextKey[c];if(l.time<=v){if(t<v)if(this.loop){k=this.data.hierarchy[o].keys[0];for(l=this.getNextKeyWith(c,o,1);l.time<t;)k=l,l=this.getNextKeyWith(c,o,l.index+1)}else{this.stop();return}else{do k=l,l=this.getNextKeyWith(c,o,l.index+1);while(l.time<
- t)}n.prevKey[c]=k;n.nextKey[c]=l}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-k.time)/(l.time-k.time);f=k[c];h=l[c];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o),e=e<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
- this.getPrevKeyWith("pos",o,k.index-1).pos,this.points[1]=f,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",o,l.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(c===
- "rot")THREE.Quaternion.slerp(f,h,a.quaternion,e);else if(c==="scl")c=a.scale,c.x=f[0]+(h[0]-f[0])*e,c.y=f[1]+(h[1]-f[1])*e,c.z=f[2]+(h[2]-f[2])*e}}if(this.JITCompile&&u[0][p]===void 0){this.hierarchy[0].update(void 0,!0);for(o=0;o<this.hierarchy.length;o++)u[o][p]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
- THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],e=[],f,h,k,l,n,p;f=(a.length-1)*b;h=Math.floor(f);f-=h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];l=a[c[1]];n=a[c[2]];p=a[c[3]];c=f*f;k=f*c;e[0]=this.interpolate(h[0],l[0],n[0],p[0],f,c,k);e[1]=this.interpolate(h[1],l[1],n[1],p[1],f,c,k);e[2]=this.interpolate(h[2],l[2],n[2],p[2],f,c,k);return e};
- THREE.Animation.prototype.interpolate=function(a,b,c,e,f,h,k){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*k+(-3*(b-c)-2*a-e)*h+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var e=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<e.length-1?c:e.length-1:c%=e.length;c<e.length;c++)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[0]};
- THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+e.length;c>=0;c--)if(e[c][a]!==void 0)return e[c];return this.data.hierarchy[b].keys[e.length-1]};
- THREE.CubeCamera=function(a,b,c,e){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
- this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
- new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(e,e,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
- 1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,c){var b=this.renderTarget;b.activeCubeFace=0;a.render(c,this.cameraPX,b);b.activeCubeFace=1;a.render(c,this.cameraNX,b);b.activeCubeFace=2;a.render(c,this.cameraPY,b);b.activeCubeFace=3;a.render(c,
- this.cameraNY,b);b.activeCubeFace=4;a.render(c,this.cameraPZ,b);b.activeCubeFace=5;a.render(c,this.cameraNZ,b)}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};
- THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};THREE.CombinedCamera=function(a,b,c,e,f,h,k){THREE.Camera.call(this);this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,h,k);this.cameraP=new THREE.PerspectiveCamera(c,a/b,e,f);this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
- THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.projectionMatrix=this.cameraP.projectionMatrix};THREE.CombinedCamera.prototype.toOrthographic=function(){this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix};THREE.CombinedCamera.prototype.setFov=function(a){this.cameraP.fov=a;this.cameraP.updateProjectionMatrix();this.toPerspective()};
- THREE.CombinedCamera.prototype.setLens=function(a,b){b||(b=43.25);var c=2*Math.atan(b/(a*2));c*=180/Math.PI;this.setFov(c);return c};
- THREE.FirstPersonControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;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=Math.PI;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.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
- !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
- function(a){switch(a.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 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.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;break;case 82:this.moveUp=
- !1;break;case 70:this.moveDown=!1}};this.update=function(a){if(!this.freeze){if(this.heightSpeed){var c=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin;this.autoSpeedFactor=a*c*this.heightCoef}else this.autoSpeedFactor=0;c=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(c);this.moveLeft&&this.object.translateX(-c);this.moveRight&&this.object.translateX(c);
- this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);c=a*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 a=this.target,b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
- (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*a);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=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;b=this.object.position;a.x=b.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=b.y+100*Math.cos(this.phi);a.z=b.z+100*Math.sin(this.phi)*Math.sin(this.theta);
- this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.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.PathControls=function(a,b){function c(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,c){return function(){c.apply(a,arguments)}}function f(a,c,b,e){var k={name:b,fps:0.6,length:e,hierarchy:[]},h,f=c.getControlPointsArray(),l=c.getLength(),w=f.length,A=0;h=w-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:f[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:e,pos:f[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<w-1;h++)A=e*l.chunks[h]/l.total,c.keys[h]={time:A,pos:f[h]};k.hierarchy[0]=
- c;THREE.AnimationHandler.add(k);return new THREE.Animation(a,b,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,c){var b,e,h=new THREE.Geometry;for(b=0;b<a.points.length*c;b++)e=b/(a.points.length*c),e=a.getPoint(e),h.vertices[b]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return h}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
- this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var k=Math.PI*2,l=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);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)*l;this.theta=this.lon*l;a=this.phi%k;this.phi=a>=0?a:a+k;b=this.verticalAngleMap.srcRange;
- a=this.verticalAngleMap.dstRange;b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var e=a[1]-a[0];this.phi=c((b-a[0])/e)*e+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);e=a[1]-a[0];this.theta=c((b-a[0])/e)*e+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
- function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),c=new THREE.MeshLambertMaterial({color:65280}),
- b=new THREE.CubeGeometry(10,10,20),k=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(b,a);a=new THREE.Mesh(k,c);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
- this.debugPath,c=this.spline,b=h(c,10),k=h(c,10),l=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(b,l);particleObj=new THREE.ParticleSystem(k,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);k=new THREE.SphereGeometry(1,16,8);l=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)b=new THREE.Mesh(k,l),b.position.copy(c.points[i]),a.add(b)}this.domElement.addEventListener("mousemove",
- e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
- THREE.FlyControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;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.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.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(a){switch(a.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(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
- !0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),b=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(a.pageX-c.offset[0]-b)/b;this.moveState.pitchDown=(a.pageY-c.offset[1]-k)/k;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
- !1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var c=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*c);this.object.translateY(this.moveVector.y*c);this.object.translateZ(this.moveVector.z*c);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
- this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=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=-a+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);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
- THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,k=!1,l=1,n=0,p=0,u=0,t=0,v=0,o=window.innerWidth/2,y=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
- this.rotateHorizontally(b*t);this.rotateVertically(b*v)}b=a*this.movementSpeed;this.object.translateZ(-b*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(b*p);this.object.translateY(b*u);k&&(this.roll+=this.rollSpeed*a*l);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();f.copy(this.forward);e.set(0,1,0);c.cross(e,
- f).normalize();e.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=e.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=e.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=e.z;this.object.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(h);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
- this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
- a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
- function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){t=(a.clientX-o)/window.innerWidth;v=(a.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
- function(a){switch(a.keyCode){case 38:case 87:n=1;break;case 37:case 65:p=-1;break;case 40:case 83:n=-1;break;case 39:case 68:p=1;break;case 81:k=!0;l=1;break;case 69:k=!0;l=-1;break;case 82:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65:p=0;break;case 40:case 83:n=0;break;case 39:case 68:p=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:u=0;break;case 70:u=0}},!1)};
- THREE.TrackballControls=function(a,b){function c(a,c){return function(){c.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
- 0,0);var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector2,p=new THREE.Vector2,u=new THREE.Vector2,t=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var b=new THREE.Vector3((a-this.screen.width*0.5-this.screen.offsetLeft)/
- this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),e=b.length();e>1?b.normalize():b.z=Math.sqrt(1-e*e);h.copy(this.object.position).subSelf(this.target);e=this.object.up.clone().setLength(b.y);e.addSelf(this.object.up.clone().crossSelf(h).setLength(b.x));e.addSelf(h.setLength(b.z));return e};this.rotateCamera=function(){var a=Math.acos(k.dot(l)/k.length()/l.length());if(a){var c=(new THREE.Vector3).cross(k,l).normalize(),b=new THREE.Quaternion;a*=this.rotateSpeed;b.setFromAxisAngle(c,
- -a);b.multiplyVector3(h);b.multiplyVector3(this.object.up);b.multiplyVector3(l);this.staticMoving?k=l:(b.setFromAxisAngle(c,a*(this.dynamicDampingFactor-1)),b.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(p.y-n.y)*this.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),this.staticMoving?n=p:n.y+=(p.y-n.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=t.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(h.length()*this.panSpeed);var c=h.clone().crossSelf(this.object.up).setLength(a.x);
- c.addSelf(this.object.up.clone().setLength(a.y));this.object.position.addSelf(c);this.target.addSelf(c);this.staticMoving?u=t:u.addSelf(a.sub(t,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),h.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,h.setLength(this.minDistance))};this.update=function(){h.copy(this.object.position).subSelf(this.target);
- this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,h);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,function(a){e&&(k=l=this.getMouseProjectionOnBall(a.clientX,a.clientY),n=p=this.getMouseOnScreen(a.clientX,a.clientY),u=t=this.getMouseOnScreen(a.clientX,a.clientY),e=!1);f!==this.STATE.NONE&&
- (f===this.STATE.ROTATE?l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?p=this.getMouseOnScreen(a.clientX,a.clientY):f===this.STATE.PAN&&!this.noPan&&(t=this.getMouseOnScreen(a.clientX,a.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(a){a.preventDefault();a.stopPropagation();if(f===this.STATE.NONE)f=a.button,f===this.STATE.ROTATE?k=l=this.getMouseProjectionOnBall(a.clientX,a.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=p=this.getMouseOnScreen(a.clientX,
- a.clientY):this.noPan||(u=t=this.getMouseOnScreen(a.clientX,a.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(a){a.preventDefault();a.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(a){if(f===this.STATE.NONE){if(a.keyCode===this.keys[this.STATE.ROTATE])f=this.STATE.ROTATE;else if(a.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(a.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.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
- THREE.CubeGeometry=function(a,b,c,e,f,h,k,l){function n(a,c,b,k,l,n,o,t){var u,v,w=e||1,x=f||1,m=l/2,y=n/2,A=p.vertices.length;if(a==="x"&&c==="y"||a==="y"&&c==="x")u="z";else if(a==="x"&&c==="z"||a==="z"&&c==="x")u="y",x=h||1;else if(a==="z"&&c==="y"||a==="y"&&c==="z")u="x",w=h||1;var z=w+1,C=x+1;l/=w;var ia=n/x;for(v=0;v<C;v++)for(n=0;n<z;n++){var ha=new THREE.Vector3;ha[a]=(n*l-m)*b;ha[c]=(v*ia-y)*k;ha[u]=o;p.vertices.push(new THREE.Vertex(ha))}for(v=0;v<x;v++)for(n=0;n<w;n++)p.faces.push(new THREE.Face4(n+
- z*v+A,n+z*(v+1)+A,n+1+z*(v+1)+A,n+1+z*v+A,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(n/w,v/x),new THREE.UV(n/w,(v+1)/x),new THREE.UV((n+1)/w,(v+1)/x),new THREE.UV((n+1)/w,v/x)])}THREE.Geometry.call(this);var p=this,u=a/2,t=b/2,v=c/2,o,y,x,w,A,z;if(k!==void 0){if(k instanceof Array)this.materials=k;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(k)}o=0;w=1;y=2;A=3;x=4;z=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=void 0)for(var C in l)this.sides[C]!=
- void 0&&(this.sides[C]=l[C]);this.sides.px&&n("z","y",-1,-1,c,b,u,o);this.sides.nx&&n("z","y",1,-1,c,b,-u,w);this.sides.py&&n("x","z",1,1,a,c,t,y);this.sides.ny&&n("x","z",1,-1,a,c,-t,A);this.sides.pz&&n("x","y",1,-1,a,b,v,x);this.sides.nz&&n("x","y",-1,-1,a,b,-v,z);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
- THREE.CylinderGeometry=function(a,b,c,e,f,h){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,k=c/2,e=e||8,f=f||1,l,n,p=[],u=[];for(n=0;n<=f;n++){var t=[],v=[],o=n/f,y=o*(b-a)+a;for(l=0;l<=e;l++){var x=l/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(x*Math.PI*2),-o*c+k,y*Math.cos(x*Math.PI*2))));t.push(this.vertices.length-1);v.push(new THREE.UV(x,o))}p.push(t);u.push(v)}for(n=0;n<f;n++)for(l=0;l<e;l++){var c=p[n][l],t=p[n+1][l],v=p[n+1][l+1],o=p[n][l+1],y=
- this.vertices[c].position.clone().setY(0).normalize(),x=this.vertices[t].position.clone().setY(0).normalize(),w=this.vertices[v].position.clone().setY(0).normalize(),A=this.vertices[o].position.clone().setY(0).normalize(),z=u[n][l].clone(),C=u[n+1][l].clone(),B=u[n+1][l+1].clone(),K=u[n][l+1].clone();this.faces.push(new THREE.Face4(c,t,v,o,[y,x,w,A]));this.faceVertexUvs[0].push([z,C,B,K])}if(!h&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(l=0;l<e;l++)c=p[0][l],t=p[0][l+
- 1],v=this.vertices.length-1,y=new THREE.Vector3(0,1,0),x=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),z=u[0][l].clone(),C=u[0][l+1].clone(),B=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(l=0;l<e;l++)c=p[n][l+1],t=p[n][l],v=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),x=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),z=u[n][l+1].clone(),C=u[n][l].clone(),
- B=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(c,t,v,[y,x,w])),this.faceVertexUvs[0].push([z,C,B])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
- THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,e=a.length,f;this.shapebb=a[e-1].getBoundingBox();for(c=0;c<e;c++)f=a[c],this.addShape(f,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
- THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,c,b){c||console.log("die");return c.clone().multiplyScalar(b).addSelf(a)}function e(a,c,b){var e=THREE.ExtrudeGeometry.__v1,k=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,f=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;e.set(a.x-c.x,a.y-c.y);k.set(a.x-b.x,a.y-b.y);e=e.normalize();k=k.normalize();h.set(-e.y,e.x);f.set(k.y,-k.x);l.copy(a).addSelf(h);m.copy(a).addSelf(f);if(l.equals(m))return f.clone();
- l.copy(c).addSelf(h);m.copy(b).addSelf(f);h=e.dot(f);f=m.subSelf(l).dot(f);h===0&&(console.log("Either infinite or no solutions!"),f===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));f/=h;if(f<0)return c=Math.atan2(c.y-a.y,c.x-a.x),a=Math.atan2(b.y-a.y,b.x-a.x),c>a&&(a+=Math.PI*2),anglec=(c+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(f).addSelf(l).subSelf(a).clone()}function f(a){for(H=a.length;--H>=0;){ja=H;ca=H-1;ca<0&&(ca=a.length-
- 1);for(var c=0,b=o+u*2,c=0;c<b;c++){var e=aa*c,k=aa*(c+1),h=Z+ja+e,f=Z+ja+k,m=h,e=Z+ca+e,k=Z+ca+k,p=f;m+=V;e+=V;k+=V;p+=V;O.faces.push(new THREE.Face4(m,e,k,p,null,null,B));B&&(m=c/b,e=(c+1)/b,k=l+n*2,h=(O.vertices[h].position.z+n)/k,f=(O.vertices[f].position.z+n)/k,O.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(f,m),new THREE.UV(f,e),new THREE.UV(h,e)]))}}}function h(a,c,b){O.vertices.push(new THREE.Vertex(new THREE.Vector3(a,c,b)))}function k(a,c,b){a+=V;c+=V;b+=V;O.faces.push(new THREE.Face3(a,
- c,b,null,null,C));if(C){var e=K.maxY,k=K.maxX,h=O.vertices[c].position.x,c=O.vertices[c].position.y,f=O.vertices[b].position.x,b=O.vertices[b].position.y;O.faceVertexUvs[0].push([new THREE.UV(O.vertices[a].position.x/k,O.vertices[a].position.y/e),new THREE.UV(h/k,c/e),new THREE.UV(f/k,b/e)])}}var l=b.amount!==void 0?b.amount:100,n=b.bevelThickness!==void 0?b.bevelThickness:6,p=b.bevelSize!==void 0?b.bevelSize:n-2,u=b.bevelSegments!==void 0?b.bevelSegments:3,t=b.bevelEnabled!==void 0?b.bevelEnabled:
- !0,v=b.curveSegments!==void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,y=b.bendPath,x=b.extrudePath,w,A=!1,z=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,C=b.material,B=b.extrudeMaterial,K=this.shapebb;if(x)w=x.getPoints(v),o=w.length,A=!0,t=!1;t||(p=n=u=0);var F,M,E,O=this,V=this.vertices.length;y&&a.addWrapPath(y);v=z?a.extractAllSpacedPoints(v):a.extractAllPoints(v);y=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();M=0;for(E=v.length;M<E;M++)F=v[M],THREE.Shape.Utils.isClockWise(F)&&
- (v[M]=F.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,v);z=y;M=0;for(E=v.length;M<E;M++)F=v[M],y=y.concat(F);var H,P,L,T,S,m,aa=y.length,U=x.length,ea=[];H=0;P=z.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ea[H]=e(z[H],z[ja],z[ca]);var da=[],ia,ha=ea.concat();M=0;for(E=v.length;M<E;M++){F=v[M];ia=[];H=0;P=F.length;ja=P-1;for(ca=H+1;H<P;H++,ja++,ca++)ja===P&&(ja=0),ca===P&&(ca=0),ia[H]=e(F[H],F[ja],F[ca]);da.push(ia);ha=ha.concat(ia)}for(L=0;L<u;L++){T=L/u;S=n*
- (1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,m.y,-S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),h(m.x,m.y,-S)}}T=p;for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[0].y,w[0].x):h(m.x,m.y,0);for(L=1;L<=o;L++)for(H=0;H<aa;H++)m=t?c(y[H],ha[H],T):y[H],A?h(m.x,m.y+w[L-1].y,w[L-1].x):h(m.x,m.y,l/o*L);for(L=u-1;L>=0;L--){T=L/u;S=n*(1-T);T=p*Math.sin(T*Math.PI/2);H=0;for(P=z.length;H<P;H++)m=c(z[H],ea[H],T),h(m.x,
- m.y,l+S);M=0;for(E=v.length;M<E;M++){F=v[M];ia=da[M];H=0;for(P=F.length;H<P;H++)m=c(F[H],ia[H],T),A?h(m.x,m.y+w[o-1].y,w[o-1].x+S):h(m.x,m.y,l+S)}}if(t){t=aa*0;for(H=0;H<U;H++)p=x[H],k(p[2]+t,p[1]+t,p[0]+t);t=aa*(o+u*2);for(H=0;H<U;H++)p=x[H],k(p[0]+t,p[1]+t,p[2]+t)}else{for(H=0;H<U;H++)p=x[H],k(p[2],p[1],p[0]);for(H=0;H<U;H++)p=x[H],k(p[0]+aa*o,p[1]+aa*o,p[2]+aa*o)}var ja,ca,Z=0;f(z);Z+=z.length;M=0;for(E=v.length;M<E;M++)F=v[M],f(F),Z+=F.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
- THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
- THREE.IcosahedronGeometry=function(a){function b(a,c,b){var e=Math.sqrt(a*a+c*c+b*b);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,c/e,b/e)))-1}function c(a,c,b,e){e.faces.push(new THREE.Face3(a,c,b))}function e(a,c){var e=f.vertices[a].position,k=f.vertices[c].position;return b((e.x+k.x)/2,(e.y+k.y)/2,(e.z+k.z)/2)}var f=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,
- -a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,h);c(0,5,1,h);c(0,1,7,h);c(0,7,10,h);c(0,10,11,h);c(1,5,9,h);c(5,11,4,h);c(11,10,2,h);c(10,7,6,h);c(7,1,8,h);c(3,9,4,h);c(3,4,2,h);c(3,2,6,h);c(3,6,8,h);c(3,8,9,h);c(4,9,5,h);c(2,4,11,h);c(6,2,10,h);c(8,6,7,h);c(9,8,1,h);for(var k=0;k<this.subdivisions;k++){var a=new THREE.Geometry,l;for(l in h.faces){var n=e(h.faces[l].a,h.faces[l].b),p=e(h.faces[l].b,h.faces[l].c),u=e(h.faces[l].c,h.faces[l].a);c(h.faces[l].a,n,u,a);c(h.faces[l].b,p,
- n,a);c(h.faces[l].c,u,p,a);c(n,p,u,a)}h.faces=a.faces}f.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
- THREE.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],e=[],f=[],h=[],k=(new THREE.Matrix4).setRotationZ(b),l=0;l<a.length;l++)this.vertices.push(new THREE.Vertex(a[l])),c[l]=a[l].clone(),e[l]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=b){for(l=0;l<c.length;l++)n<this.angle?(c[l]=k.multiplyVector3(c[l].clone()),this.vertices.push(new THREE.Vertex(c[l])),f[l]=this.vertices.length-1):f=h;n==0&&(h=e);
- for(l=0;l<e.length-1;l++)this.faces.push(new THREE.Face4(f[l],f[l+1],e[l+1],e[l])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,l/a.length),new THREE.UV(1-n/this.angle,(l+1)/a.length),new THREE.UV(1-(n-b)/this.angle,(l+1)/a.length),new THREE.UV(1-(n-b)/this.angle,l/a.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
- THREE.OctahedronGeometry=function(a,b){function c(c){var b=c.clone().normalize(),b=new THREE.Vertex(b.clone().multiplyScalar(a));b.index=k.vertices.push(b)-1;b.uv=new THREE.UV(Math.atan2(c.z,-c.x)/2/Math.PI+0.5,Math.atan2(-c.y,Math.sqrt(c.x*c.x+c.z*c.z))/Math.PI+0.5);return b}function e(a,c,b,l){l<1?(l=new THREE.Face3(a.index,c.index,b.index,[a.position,c.position,b.position]),l.centroid.addSelf(a.position).addSelf(c.position).addSelf(b.position).divideScalar(3),l.normal=l.centroid.clone().normalize(),
- k.faces.push(l),l=Math.atan2(l.centroid.z,-l.centroid.x),k.faceVertexUvs[0].push([h(a.uv,a.position,l),h(c.uv,c.position,l),h(b.uv,b.position,l)])):(l-=1,e(a,f(a,c),f(a,b),l),e(f(a,c),c,f(c,b),l),e(f(a,b),f(c,b),b,l),e(f(a,c),f(c,b),f(a,b),l))}function f(a,b){l[a.index]||(l[a.index]=[]);l[b.index]||(l[b.index]=[]);var e=l[a.index][b.index];e===void 0&&(l[a.index][b.index]=l[b.index][a.index]=e=c((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return e}function h(a,c,b){b<0&&a.u===
- 1&&(a=new THREE.UV(a.u-1,a.v));c.x===0&&c.z===0&&(a=new THREE.UV(b/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var b=isFinite(b)?b:3,k=this;c(new THREE.Vector3(1,0,0));c(new THREE.Vector3(-1,0,0));c(new THREE.Vector3(0,1,0));c(new THREE.Vector3(0,-1,0));c(new THREE.Vector3(0,0,1));c(new THREE.Vector3(0,0,-1));var l=[],n=this.vertices;e(n[0],n[2],n[4],b);e(n[0],n[4],n[3],b);e(n[0],n[3],n[5],b);e(n[0],n[5],n[2],b);e(n[1],n[2],n[5],b);e(n[1],n[5],n[3],b);e(n[1],n[3],n[4],b);e(n[1],n[4],n[2],
- b);this.boundingSphere={radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
- THREE.PlaneGeometry=function(a,b,c,e){THREE.Geometry.call(this);var f,h=a/2,k=b/2,c=c||1,e=e||1,l=c+1,n=e+1;a/=c;var p=b/e;for(f=0;f<n;f++)for(b=0;b<l;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-h,-(f*p-k),0)));for(f=0;f<e;f++)for(b=0;b<c;b++)this.faces.push(new THREE.Face4(b+l*f,b+l*(f+1),b+1+l*(f+1),b+1+l*f)),this.faceVertexUvs[0].push([new THREE.UV(b/c,f/e),new THREE.UV(b/c,(f+1)/e),new THREE.UV((b+1)/c,(f+1)/e),new THREE.UV((b+1)/c,f/e)]);this.computeCentroids();this.computeFaceNormals()};
- THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
- THREE.SphereGeometry=function(a,b,c){THREE.Geometry.call(this);for(var a=a||50,e,f=Math.PI,h=Math.max(3,b||8),k=Math.max(2,c||6),b=[],c=0;c<k+1;c++){e=c/k;var l=a*Math.cos(e*f),n=a*Math.sin(e*f),p=[],u=0;for(e=0;e<h;e++){var t=2*e/h,v=n*Math.sin(t*f),t=n*Math.cos(t*f);(c==0||c==k)&&e>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,l,v)))-1);p.push(u)}b.push(p)}for(var o,y,x,f=b.length,c=0;c<f;c++)if(h=b[c].length,c>0)for(e=0;e<h;e++){p=e==h-1;k=b[c][p?0:e+1];l=b[c][p?h-1:e];n=b[c-1][p?
- h-1:e];p=b[c-1][p?0:e+1];v=c/(f-1);o=(c-1)/(f-1);y=(e+1)/h;var t=e/h,u=new THREE.UV(1-y,v),v=new THREE.UV(1-t,v),t=new THREE.UV(1-t,o),w=new THREE.UV(1-y,o);c<b.length-1&&(o=this.vertices[k].position.clone(),y=this.vertices[l].position.clone(),x=this.vertices[n].position.clone(),o.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(k,l,n,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([u,v,t]));c>1&&(o=
- this.vertices[k].position.clone(),y=this.vertices[n].position.clone(),x=this.vertices[p].position.clone(),o.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(k,n,p,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([u,t,w]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
- THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
- THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var e=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
- THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
- THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,b){return(new TextPath(a,b)).toShapes()},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=
- this.getFace(),c=this.size/b.resolution,e=0,f=String(a).split(""),h=f.length,k=[],a=0;a<h;a++){var l=new THREE.Path,l=this.extractGlyphPoints(f[a],b,c,e,l);e+=l.offset;k.push(l.path)}return{paths:k,offset:e/2}},extractGlyphPoints:function(a,b,c,e,f){var h=[],k,l,n,p,u,t,v,o,y,x,w=b.glyphs[a]||b.glyphs[ctxt.options.fallbackCharacter];if(w){if(w.o){b=w._cachedOutline||(w._cachedOutline=w.o.split(" "));n=b.length;for(a=0;a<n;)switch(l=b[a++],l){case "m":l=b[a++]*c+e;p=b[a++]*c;h.push(new THREE.Vector2(l,
- p));f.moveTo(l,p);break;case "l":l=b[a++]*c+e;p=b[a++]*c;h.push(new THREE.Vector2(l,p));f.lineTo(l,p);break;case "q":l=b[a++]*c+e;p=b[a++]*c;v=b[a++]*c+e;o=b[a++]*c;f.quadraticCurveTo(v,o,l,p);if(k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var A=k/divisions,z=THREE.Shape.Utils.b2(A,u,v,l),A=THREE.Shape.Utils.b2(A,t,o,p);h.push(new THREE.Vector2(z,A))}}break;case "b":if(l=b[a++]*c+e,p=b[a++]*c,v=b[a++]*c+e,o=b[a++]*-c,y=b[a++]*c+e,x=b[a++]*-c,f.bezierCurveTo(l,p,
- v,o,y,x),k=h[h.length-1]){u=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)A=k/divisions,z=THREE.Shape.Utils.b3(A,u,v,y,l),A=THREE.Shape.Utils.b3(A,t,o,x,p),h.push(new THREE.Vector2(z,A))}}}return{offset:w.ha*c,points:h,path:f}}}};
- (function(a){var b=function(a){for(var b=a.length,f=0,h=b-1,k=0;k<b;h=k++)f+=a[h].x*a[k].y-a[k].x*a[h].y;return f*0.5};a.Triangulate=function(a,e){var f=a.length;if(f<3)return null;var h=[],k=[],l=[],n,p,u;if(b(a)>0)for(p=0;p<f;p++)k[p]=p;else for(p=0;p<f;p++)k[p]=f-1-p;var t=2*f;for(p=f-1;f>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return l;return h}n=p;f<=n&&(n=0);p=n+1;f<=p&&(p=0);u=p+1;f<=u&&(u=0);var v;a:{v=a;var o=n,y=p,x=u,w=f,A=k,z=void 0,C=void 0,B=void 0,
- K=void 0,F=void 0,M=void 0,E=void 0,O=void 0,V=void 0,C=v[A[o]].x,B=v[A[o]].y,K=v[A[y]].x,F=v[A[y]].y,M=v[A[x]].x,E=v[A[x]].y;if(1.0E-10>(K-C)*(E-B)-(F-B)*(M-C))v=!1;else{for(z=0;z<w;z++)if(!(z==o||z==y||z==x)){var O=v[A[z]].x,V=v[A[z]].y,H=void 0,P=void 0,L=void 0,T=void 0,S=void 0,m=void 0,aa=void 0,U=void 0,ea=void 0,da=void 0,ia=void 0,ha=void 0,H=L=S=void 0,H=M-K,P=E-F,L=C-M,T=B-E,S=K-C,m=F-B,aa=O-C,U=V-B,ea=O-K,da=V-F,ia=O-M,ha=V-E,H=H*da-P*ea,S=S*U-m*aa,L=L*ha-T*ia;if(H>=0&&L>=0&&S>=0){v=!1;
- break a}}v=!0}}if(v){h.push([a[k[n]],a[k[p]],a[k[u]]]);l.push([k[n],k[p],k[u]]);n=p;for(u=p+1;u<f;n++,u++)k[n]=k[u];f--;t=2*f}}if(e)return l;return h};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
- THREE.TorusGeometry=function(a,b,c,e,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(e=0;e<=this.segmentsT;e++){var h=e/this.segmentsT*this.arc,k=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(h);f.y=this.radius*Math.sin(h);var l=new THREE.Vector3;l.x=(this.radius+this.tube*Math.cos(k))*Math.cos(h);l.y=(this.radius+this.tube*Math.cos(k))*Math.sin(h);l.z=
- this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(l));a.push(new THREE.UV(e/this.segmentsT,1-c/this.segmentsR));b.push(l.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(e=1;e<=this.segmentsT;e++){var f=(this.segmentsT+1)*c+e-1,h=(this.segmentsT+1)*(c-1)+e-1,k=(this.segmentsT+1)*(c-1)+e,l=(this.segmentsT+1)*c+e,n=new THREE.Face4(f,h,k,l,[b[f],b[h],b[k],b[l]]);n.normal.addSelf(b[f]);n.normal.addSelf(b[h]);n.normal.addSelf(b[k]);n.normal.addSelf(b[l]);n.normal.normalize();this.faces.push(n);
- this.faceVertexUvs[0].push([a[f].clone(),a[h].clone(),a[k].clone(),a[l].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
- THREE.TorusKnotGeometry=function(a,b,c,e,f,h,k){function l(a,c,b,e,k,h){c=b/e*a;b=Math.cos(c);return new THREE.Vector3(k*(2+b)*0.5*Math.cos(a),k*(2+b)*Math.sin(a)*0.5,h*k*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=e||8;this.p=f||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;e=new THREE.Vector3;h=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(b=0;b<
- this.segmentsT;++b){var n=a/this.segmentsR*2*this.p*Math.PI,k=b/this.segmentsT*2*Math.PI,f=l(n,k,this.q,this.p,this.radius,this.heightScale),n=l(n+0.01,k,this.q,this.p,this.radius,this.heightScale);c.x=n.x-f.x;c.y=n.y-f.y;c.z=n.z-f.z;e.x=n.x+f.x;e.y=n.y+f.y;e.z=n.z+f.z;h.cross(c,e);e.cross(h,c);h.normalize();e.normalize();n=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);f.x+=n*e.x+k*h.x;f.y+=n*e.y+k*h.y;f.z+=n*e.z+k*h.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
- f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var e=(a+1)%this.segmentsR,h=(b+1)%this.segmentsT,f=this.grid[a][b],c=this.grid[e][b],e=this.grid[e][h],h=this.grid[a][h],k=new THREE.UV(a/this.segmentsR,b/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),u=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,c,e,h));this.faceVertexUvs[0].push([k,n,p,u])}this.computeCentroids();
- this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
- THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,c,b,e,l,n){var o=new THREE.Face4(a,c,b,e,null,l.color,l.material);if(k.useOldVertexColors){o.vertexColors=[];for(var m,p,u,v=0;v<4;v++){u=n[v];m=new THREE.Color;m.setRGB(0,0,0);for(var w=0;w<u.length;w++)p=l.vertexColors[u[w]-1],m.r+=p.r,m.g+=p.g,m.b+=p.b;m.r/=u.length;m.g/=u.length;m.b/=u.length;o.vertexColors[v]=m}}f.push(o);(!k.supportUVs||t.length!=0)&&h.push([t[a],t[c],t[b],t[e]])}function c(a,c){return Math.min(a,c)+"_"+Math.max(a,
- c)}var e=[],f=[],h=[],k=this,l=a.vertices,e=a.faces,n=l.concat(),p=[],u={},t=[],v,o,y,x,w,A=a.faceVertexUvs[0];v=0;for(o=A.length;v<o;v++){y=0;for(x=A[v].length;y<x;y++)w=e[v]["abcd".charAt(y)],t[w]||(t[w]=A[v][y])}var z;v=0;for(o=e.length;v<o;v++)if(w=e[v],p.push(w.centroid),n.push(new THREE.Vertex(w.centroid)),k.supportUVs&&t.length!=0){z=new THREE.UV;if(w instanceof THREE.Face3)z.u=t[w.a].u+t[w.b].u+t[w.c].u,z.v=t[w.a].v+t[w.b].v+t[w.c].v,z.u/=3,z.v/=3;else if(w instanceof THREE.Face4)z.u=t[w.a].u+
- t[w.b].u+t[w.c].u+t[w.d].u,z.v=t[w.a].v+t[w.b].v+t[w.c].v+t[w.d].v,z.u/=4,z.v/=4;t.push(z)}x=function(a){function b(a,c,e){a[c]===void 0&&(a[c]=[]);a[c].push(e)}var e,k,h,f,l={};e=0;for(k=a.faces.length;e<k;e++)h=a.faces[e],h instanceof THREE.Face3?(f=c(h.a,h.b),b(l,f,e),f=c(h.b,h.c),b(l,f,e),f=c(h.c,h.a),b(l,f,e)):h instanceof THREE.Face4&&(f=c(h.a,h.b),b(l,f,e),f=c(h.b,h.c),b(l,f,e),f=c(h.c,h.d),b(l,f,e),f=c(h.d,h.a),b(l,f,e));return l}(a);var C,B,K=0,A=l.length,F;for(v in x)if(w=x[v],z=w[0],C=
- w[1],F=v.split("_"),o=F[0],F=F[1],B=new THREE.Vector3,w.length!=2?(B.addSelf(l[o].position),B.addSelf(l[F].position),B.multiplyScalar(0.5)):(B.addSelf(p[z]),B.addSelf(p[C]),B.addSelf(l[o].position),B.addSelf(l[F].position),B.multiplyScalar(0.25)),u[v]=A+e.length+K,n.push(new THREE.Vertex(B)),K++,k.supportUVs&&t.length!=0)z=new THREE.UV,z.u=t[o].u+t[F].u,z.v=t[o].v+t[F].v,z.u/=2,z.v/=2,t.push(z);v=0;for(o=p.length;v<o;v++)w=e[v],z=A+v,w instanceof THREE.Face3?(C=c(w.a,w.b),F=c(w.b,w.c),K=c(w.c,w.a),
- b(z,u[C],w.b,u[F],w,["123","12","2","23"]),b(z,u[F],w.c,u[K],w,["123","23","3","31"]),b(z,u[K],w.a,u[C],w,["123","31","1","12"])):w instanceof THREE.Face4?(C=c(w.a,w.b),F=c(w.b,w.c),K=c(w.c,w.d),B=c(w.d,w.a),b(z,u[C],w.b,u[F],w,["1234","12","2","23"]),b(z,u[F],w.c,u[K],w,["1234","23","3","34"]),b(z,u[K],w.d,u[B],w,["1234","34","4","41"]),b(z,u[B],w.a,u[C],w,["1234","41","1","12"])):console.log("face should be a face!",w);var e=n,M={},E={},n=function(a,c){M[a]===void 0&&(M[a]=[]);M[a].push(c)},u=function(a,
- c){E[a]===void 0&&(E[a]={});E[a][c]=null};for(v in x)w=x[v],F=v.split("_"),o=F[0],F=F[1],n(o,[o,F]),n(F,[o,F]),z=w[0],C=w[1],u(o,z),C?u(o,C):u(o,z),u(F,z),C?u(F,C):u(F,z);n=new THREE.Vector3;u=new THREE.Vector3;v=0;for(o=l.length;v<o;v++)if(M[v]!==void 0){n.set(0,0,0);u.set(0,0,0);x=new THREE.Vector3(0,0,0);A=0;for(y in E[v])n.addSelf(p[y]),A++;n.divideScalar(A);A=M[v].length;for(y=0;y<A;y++)w=M[v][y],w=l[w[0]].position.clone().addSelf(l[w[1]].position).divideScalar(2),u.addSelf(w);u.divideScalar(A);
- x.addSelf(l[v].position);x.multiplyScalar(A-3);x.addSelf(n);x.addSelf(u.multiplyScalar(2));x.divideScalar(A);e[v].position=x}a.vertices=e;a.faces=f;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
- THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
- 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(b[e],c)},hasNormals:function(a){var b,c,e=a.materials.length;for(c=0;c<e;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
- a}function e(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.src=b}function f(a,c,k,h,f,l){var n=document.createElement("canvas");a[c]=new THREE.Texture(n);a[c].sourceFile=k;if(h){a[c].repeat.set(h[0],h[1]);if(h[0]!=1)a[c].wrapS=THREE.RepeatWrapping;
- if(h[1]!=1)a[c].wrapT=THREE.RepeatWrapping}f&&a[c].offset.set(f[0],f[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[c].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[c].wrapT=h[l[1]]}e(a[c],b+"/"+k)}function h(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var k,l,n;l="MeshLambertMaterial";k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?l="MeshPhongMaterial":a.shading=="Basic"&&(l="MeshBasicMaterial"));
- if(a.blending)if(a.blending=="Additive")k.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")k.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")k.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)k.transparent=a.transparent;if(a.depthTest!==void 0)k.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(a.vertexColors)k.vertexColors=THREE.VertexColors;if(a.colorDiffuse)k.color=h(a.colorDiffuse);
- else if(a.DbgColor)k.color=a.DbgColor;if(a.colorSpecular)k.specular=h(a.colorSpecular);if(a.colorAmbient)k.ambient=h(a.colorAmbient);if(a.transparency)k.opacity=a.transparency;if(a.specularCoef)k.shininess=a.specularCoef;a.mapDiffuse&&b&&f(k,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&f(k,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&f(k,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
- a.mapSpecular&&b&&f(k,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var p=THREE.ShaderUtils.lib.normal,u=THREE.UniformsUtils.clone(p.uniforms),t=k.color;l=k.specular;n=k.ambient;var v=k.shininess;u.tNormal.texture=k.normalMap;if(a.mapNormalFactor)u.uNormalScale.value=a.mapNormalFactor;if(k.map)u.tDiffuse.texture=k.map,u.enableDiffuse.value=!0;if(k.specularMap)u.tSpecular.texture=k.specularMap,u.enableSpecular.value=!0;if(k.lightMap)u.tAO.texture=
- k.lightMap,u.enableAO.value=!0;u.uDiffuseColor.value.setHex(t);u.uSpecularColor.value.setHex(l);u.uAmbientColor.value.setHex(n);u.uShininess.value=v;if(k.opacity)u.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:u,lights:!0,fog:!0})}else k=new THREE[l](k);return k}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
- THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
- THREE.BinaryLoader.prototype.load=function(a,b,c,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var f=a,a=f.model,b=f.callback,c=f.texture_path,e=f.bin_path}var c=c?c:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),f=Date.now(),a=new Worker(a),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
- b,e,c,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(f)};
- THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,e,f,h){var k=new XMLHttpRequest,l=e+"/"+a,n=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,c,f,b):alert("Couldn't load ["+l+"] ["+k.status+"]"):k.readyState==3?h&&(n==0&&(n=k.getResponseHeader("Content-Length")),h({total:n,loaded:k.responseText.length})):k.readyState==2&&(n=k.getResponseHeader("Content-Length"))};k.open("GET",l,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
- k.setRequestHeader("Content-Type","text/plain");k.send(null)};
- THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,e){var f=function(c){function b(a,c){var e=u(a,c),f=u(a,c+1),h=u(a,c+2),k=u(a,c+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function f(a,c){var b=u(a,c),e=u(a,c+1),h=u(a,c+2);return(u(a,c+3)<<24)+(h<<16)+(e<<8)+b}function n(a,c){var b=u(a,c);return(u(a,c+1)<<8)+b}function p(a,c){var b=u(a,c);return b>127?b-256:b}function u(a,c){return a.charCodeAt(c)&255}function t(c){var b,
- e,h;b=f(a,c);e=f(a,c+F);h=f(a,c+M);c=n(a,c+E);A.faces.push(new THREE.Face3(b,e,h,null,null,c))}function v(c){var b,e,h,k,m,o,p;b=f(a,c);e=f(a,c+F);h=f(a,c+M);k=n(a,c+E);m=f(a,c+O);o=f(a,c+V);p=f(a,c+H);var c=B[o*3],t=B[o*3+1];o=B[o*3+2];var u=B[p*3],v=B[p*3+1];p=B[p*3+2];A.faces.push(new THREE.Face3(b,e,h,[new THREE.Vector3(B[m*3],B[m*3+1],B[m*3+2]),new THREE.Vector3(c,t,o),new THREE.Vector3(u,v,p)],null,k))}function o(c){var b,e,h,k;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);c=n(a,c+S);A.faces.push(new THREE.Face4(b,
- e,h,k,null,null,c))}function y(c){var b,e,h,k,o,p,t,u,v;b=f(a,c);e=f(a,c+P);h=f(a,c+L);k=f(a,c+T);o=n(a,c+S);p=f(a,c+m);t=f(a,c+aa);u=f(a,c+U);v=f(a,c+ea);var c=B[t*3],w=B[t*3+1];t=B[t*3+2];var G=B[u*3],x=B[u*3+1];u=B[u*3+2];var ma=B[v*3],I=B[v*3+1];v=B[v*3+2];A.faces.push(new THREE.Face4(b,e,h,k,[new THREE.Vector3(B[p*3],B[p*3+1],B[p*3+2]),new THREE.Vector3(c,w,t),new THREE.Vector3(G,x,u),new THREE.Vector3(ma,I,v)],null,o))}function x(c){var b,e,h,k;b=f(a,c);e=f(a,c+da);h=f(a,c+ia);c=K[b*2];k=K[b*
- 2+1];b=K[e*2];var m=A.faceVertexUvs[0];e=K[e*2+1];var n=K[h*2];h=K[h*2+1];var o=[];o.push(new THREE.UV(c,k));o.push(new THREE.UV(b,e));o.push(new THREE.UV(n,h));m.push(o)}function w(c){var b,e,h,k,m,n;b=f(a,c);e=f(a,c+ha);h=f(a,c+ja);k=f(a,c+ca);c=K[b*2];m=K[b*2+1];b=K[e*2];n=K[e*2+1];e=K[h*2];var o=A.faceVertexUvs[0];h=K[h*2+1];var p=K[k*2];k=K[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(b,n));t.push(new THREE.UV(e,h));t.push(new THREE.UV(p,k));o.push(t)}var A=this,z=0,C,B=[],K=
- [],F,M,E,O,V,H,P,L,T,S,m,aa,U,ea,da,ia,ha,ja,ca,Z,R,Y,X,ga,oa;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(A,e,c);C={signature:a.substr(z,8),header_bytes:u(a,z+8),vertex_coordinate_bytes:u(a,z+9),normal_coordinate_bytes:u(a,z+10),uv_coordinate_bytes:u(a,z+11),vertex_index_bytes:u(a,z+12),normal_index_bytes:u(a,z+13),uv_index_bytes:u(a,z+14),material_index_bytes:u(a,z+15),nvertices:f(a,z+16),nnormals:f(a,z+16+4),nuvs:f(a,z+16+8),ntri_flat:f(a,z+16+12),ntri_smooth:f(a,z+16+16),ntri_flat_uv:f(a,
- z+16+20),ntri_smooth_uv:f(a,z+16+24),nquad_flat:f(a,z+16+28),nquad_smooth:f(a,z+16+32),nquad_flat_uv:f(a,z+16+36),nquad_smooth_uv:f(a,z+16+40)};z+=C.header_bytes;F=C.vertex_index_bytes;M=C.vertex_index_bytes*2;E=C.vertex_index_bytes*3;O=C.vertex_index_bytes*3+C.material_index_bytes;V=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;H=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;P=C.vertex_index_bytes;L=C.vertex_index_bytes*2;T=C.vertex_index_bytes*3;S=C.vertex_index_bytes*
- 4;m=C.vertex_index_bytes*4+C.material_index_bytes;aa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;U=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ea=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;da=C.uv_index_bytes;ia=C.uv_index_bytes*2;ha=C.uv_index_bytes;ja=C.uv_index_bytes*2;ca=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;oa=C.vertex_index_bytes*4+C.material_index_bytes;Z=C.ntri_flat*c;R=C.ntri_smooth*(c+
- C.normal_index_bytes*3);Y=C.ntri_flat_uv*(c+C.uv_index_bytes*3);X=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ga=C.nquad_flat*oa;c=C.nquad_smooth*(oa+C.normal_index_bytes*4);oa=C.nquad_flat_uv*(oa+C.uv_index_bytes*4);z+=function(c){for(var e,h,f,l=C.vertex_coordinate_bytes*3,m=c+C.nvertices*l;c<m;c+=l)e=b(a,c),h=b(a,c+C.vertex_coordinate_bytes),f=b(a,c+C.vertex_coordinate_bytes*2),A.vertices.push(new THREE.Vertex(new THREE.Vector3(e,h,f)));return C.nvertices*l}(z);z+=function(c){for(var b,
- e,h,f=C.normal_coordinate_bytes*3,k=c+C.nnormals*f;c<k;c+=f)b=p(a,c),e=p(a,c+C.normal_coordinate_bytes),h=p(a,c+C.normal_coordinate_bytes*2),B.push(b/127,e/127,h/127);return C.nnormals*f}(z);z+=function(c){for(var e,h,f=C.uv_coordinate_bytes*2,l=c+C.nuvs*f;c<l;c+=f)e=b(a,c),h=b(a,c+C.uv_coordinate_bytes),K.push(e,h);return C.nuvs*f}(z);Z=z+Z;R=Z+R;Y=R+Y;X=Y+X;ga=X+ga;c=ga+c;oa=c+oa;(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes,e=b+C.uv_index_bytes*3,h=a+C.ntri_flat_uv*e;for(c=
- a;c<h;c+=e)t(c),x(c+b);return h-a})(R);(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=b+C.uv_index_bytes*3,h=a+C.ntri_smooth_uv*e;for(c=a;c<h;c+=e)v(c),x(c+b);return h-a})(Y);(function(a){var c,b=C.vertex_index_bytes*4+C.material_index_bytes,e=b+C.uv_index_bytes*4,h=a+C.nquad_flat_uv*e;for(c=a;c<h;c+=e)o(c),w(c+b);return h-a})(c);(function(a){var c,b=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,e=b+C.uv_index_bytes*4,h=a+C.nquad_smooth_uv*
- e;for(c=a;c<h;c+=e)y(c),w(c+b);return h-a})(oa);(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes,e=a+C.ntri_flat*b;for(c=a;c<e;c+=b)t(c);return e-a})(z);(function(a){var c,b=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=a+C.ntri_smooth*b;for(c=a;c<e;c+=b)v(c);return e-a})(Z);(function(a){var c,b=C.vertex_index_bytes*4+C.material_index_bytes,e=a+C.nquad_flat*b;for(c=a;c<e;c+=b)o(c);return e-a})(X);(function(a){var c,b=C.vertex_index_bytes*4+C.material_index_bytes+
- C.normal_index_bytes*4,e=a+C.nquad_smooth*b;for(c=a;c<e;c+=b)y(c);return e-a})(ga);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
- THREE.ColladaLoader=function(){function a(a,e,f){R=a;e=e||ga;f!==void 0&&(a=f.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");na=b("//dae:library_images/dae:image",k,"image");ua=b("//dae:library_materials/dae:material",E,"material");sa=b("//dae:library_effects/dae:effect",L,"effect");la=b("//dae:library_geometries/dae:geometry",w,"geometry");qa=b("//dae:library_controllers/dae:controller",l,"controller");fa=b("//dae:library_animations/dae:animation",S,"animation");Da=b(".//dae:library_visual_scenes/dae:visual_scene",
- u,"visual_scene");za=[];Fa=[];(a=R.evaluate(".//dae:scene/dae:instance_visual_scene",R,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),X=Da[a]):X=null;Y=new THREE.Object3D;for(a=0;a<X.nodes.length;a++)Y.add(h(X.nodes[a]));c();for(var m in fa);m={scene:Y,morphs:za,skins:Fa,dae:{images:na,materials:ua,effects:sa,geometries:la,controllers:qa,animations:fa,visualScenes:Da,scene:X}};e&&e(m);return m}function b(a,c,b){for(var a=R.evaluate(a,R,ea,
- XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},h=a.iterateNext(),f=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=b+f++;e[h.id]=h;h=a.iterateNext()}return e}function c(){var a=1E6,c=-a,b=0,e;for(e in fa)for(var h=fa[e],f=0;f<h.sampler.length;f++){var k=h.sampler[f];k.create();a=Math.min(a,k.startTime);c=Math.max(c,k.endTime);b=Math.max(b,k.input.length)}return{start:a,end:c,frames:b}}function e(a,c,b,h){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=
- a.channels[0].sampler.output[b];f instanceof THREE.Matrix4&&a.world.copy(f)}h&&a.world.multiply(h,a.world);c.push(a);for(h=0;h<a.nodes.length;h++)e(a.nodes[h],c,b,a.world)}function f(a,b,h){var f=qa[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=c(),b=X.getChildById(b.skeleton[0],!0)||X.getChildBySid(b.skeleton[0],!0),l,m,n,o,p=new THREE.Vector3,
- t;for(l=0;l<a.vertices.length;l++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(h=0;h<k.frames;h++){var u=[],v=[];for(l=0;l<a.vertices.length;l++)v.push(new THREE.Vertex(new THREE.Vector3));e(b,u,h);l=u;m=f.skin;for(o=0;o<l.length;o++)if(n=l[o],t=-1,n.type=="JOINT"){for(var w=0;w<m.joints.length;w++)if(n.sid==m.joints[w]){t=w;break}if(t>=0){w=m.invBindMatrices[t];n.invBindMatrix=w;n.skinningMatrix=new THREE.Matrix4;n.skinningMatrix.multiply(n.world,w);n.weights=[];for(w=0;w<m.weights.length;w++)for(var x=
- 0;x<m.weights[w].length;x++){var y=m.weights[w][x];y.joint==t&&n.weights.push(y)}}else throw"ColladaLoader: Could not find joint '"+n.sid+"'.";}for(l=0;l<u.length;l++)if(u[l].type=="JOINT")for(m=0;m<u[l].weights.length;m++)n=u[l].weights[m],o=n.index,n=n.weight,t=a.vertices[o],o=v[o],p.x=t.position.x,p.y=t.position.y,p.z=t.position.z,u[l].skinningMatrix.multiplyVector3(p),o.position.x+=p.x*n,o.position.y+=p.y*n,o.position.z+=p.z*n;a.morphTargets.push({name:"target_"+h,vertices:v})}}}function h(a){var c=
- new THREE.Object3D,b,e,k;c.name=a.id||"";c.matrixAutoUpdate=!1;c.matrix=a.matrix;for(k=0;k<a.controllers.length;k++){var l=qa[a.controllers[k].url];switch(l.type){case "skin":if(la[l.skin.source]){var m=new x;m.url=l.skin.source;m.instance_material=a.controllers[k].instance_material;a.geometries.push(m);b=a.controllers[k]}else if(qa[l.skin.source]&&(e=l=qa[l.skin.source],l.morph&&la[l.morph.source]))m=new x,m.url=l.morph.source,m.instance_material=a.controllers[k].instance_material,a.geometries.push(m);
- break;case "morph":if(la[l.morph.source])m=new x,m.url=l.morph.source,m.instance_material=a.controllers[k].instance_material,a.geometries.push(m),e=a.controllers[k];console.log("ColladaLoader: Morph-controller partially supported.")}}for(k=0;k<a.geometries.length;k++){var l=a.geometries[k],m=l.instance_material,l=la[l.url],n={},p=0,t;if(l&&l.mesh&&l.mesh.primitives){if(c.name.length==0)c.name=l.id;if(m)for(j=0;j<m.length;j++){t=m[j];var u=sa[ua[t.target].instance_effect.url].shader;u.material.opacity=
- !u.material.opacity?1:u.material.opacity;t=n[t.symbol]=u.material;p++}m=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});l=l.mesh.geometry3js;if(p>1){m=new THREE.MeshFaceMaterial;for(j=0;j<l.faces.length;j++)p=l.faces[j],p.materials=[n[p.daeMaterial]]}if(b!==void 0)f(l,b),m.morphTargets=!0,m=new THREE.SkinnedMesh(l,m),m.skeleton=b.skeleton,m.skinController=qa[b.url],m.skinInstanceController=b,m.name="skin_"+Fa.length,Fa.push(m);else if(e!==void 0){n=l;p=e instanceof o?
- qa[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");else{p=p.morph;for(u=0;u<p.targets.length;u++){var v=la[p.targets[u]];if(v.mesh&&v.mesh.primitives&&v.mesh.primitives.length)v=v.mesh.primitives[0].geometry,v.vertices.length===n.vertices.length&&n.morphTargets.push({name:"target_1",vertices:v.vertices})}n.morphTargets.push({name:"target_Z",vertices:n.vertices})}m.morphTargets=!0;m=new THREE.Mesh(l,m);m.name="morph_"+za.length;za.push(m)}else m=new THREE.Mesh(l,m);c.add(m)}}for(k=
- 0;k<a.nodes.length;k++)c.add(h(a.nodes[k],a));return c}function k(){this.init_from=this.id=""}function l(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function t(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=
- [];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function v(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function x(){this.url="";this.instance_material=[]}function w(){this.id="";this.mesh=null}function A(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function z(){}function C(){this.material="";this.count=0;this.inputs=
- [];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function B(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function F(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(a){this.id=a;this.type=null}function E(){this.name=this.id="";this.instance_effect=null}function O(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function V(a,c){this.type=
- a;this.effect=c;this.material=null}function H(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function L(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function T(){this.url=""}function S(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function m(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
- this.sid=null}function aa(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function U(a){var c=a.getAttribute("id");if(oa[c]!=void 0)return oa[c];oa[c]=(new M(c)).parse(a);return oa[c]}function ea(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function da(a){for(var a=ha(a),c=[],b=0;b<a.length;b++)c.push(parseFloat(a[b]));return c}function ia(a){for(var a=ha(a),c=[],b=0;b<a.length;b++)c.push(parseInt(a[b],
- 10));return c}function ha(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ja(a,c,b){return a.hasAttribute(c)?parseInt(a.getAttribute(c),10):b}function ca(a,c){if(a===void 0){for(var b="0.";b.length<c+2;)b+="0";return b}c=c||2;b=a.toString().split(".");for(b[1]=b.length>1?b[1].substr(0,c):"0";b[1].length<c;)b[1]+="0";return b.join(".")}function Z(a,c){var b="";b+=ca(a.x,c)+",";b+=ca(a.y,c)+",";b+=ca(a.z,c);return b}var R=null,Y=null,X,ga=null,oa={},na={},fa={},qa={},la={},ua=
- {},sa={},Da,Ea,za,Fa,xa=THREE.SmoothShading;k.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="init_from")this.init_from=b.textContent}return this};l.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "skin":this.skin=(new p).parse(b);this.type=b.nodeName;break;case "morph":this.morph=
- (new n).parse(b),this.type=b.nodeName}}return this};n.prototype.parse=function(a){var c={},b=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var h=a.childNodes[e];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new M).parse(h);c[h.id]=h;break;case "targets":b=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(e=0;e<b.length;e++)switch(a=b[e],h=c[a.source],a.semantic){case "MORPH_TARGET":this.targets=
- h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=function(a){for(var c=[],b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":c.push((new F).parse(e))}}return c};p.prototype.parse=function(a){var c={},b,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<a.childNodes.length;h++){var f=a.childNodes[h];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
- da(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new M).parse(f);c[f.id]=f;break;case "joints":b=f;break;case "vertex_weights":e=f;break;default:console.log(f.nodeName)}}this.parseJoints(b,c);this.parseWeights(e,c);return this};p.prototype.parseJoints=function(a,c){for(var b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
- (new F).parse(e),h=c[e.source];if(e.semantic=="JOINT")this.joints=h.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(a,c){for(var b,e,h=[],f=0;f<a.childNodes.length;f++){var k=a.childNodes[f];if(k.nodeType==1)switch(k.nodeName){case "input":h.push((new F).parse(k));break;case "v":b=ia(k.textContent);break;case "vcount":e=ia(k.textContent)}}for(f=k=0;f<e.length;f++){for(var l=e[f],m=[],n=0;n<l;n++){for(var o={},p=0;p<h.length;p++){var t=
- h[p],u=b[k+t.offset];switch(t.semantic){case "JOINT":o.joint=u;break;case "WEIGHT":o.weight=c[t.source].data[u]}}m.push(o);k+=h.length}for(n=0;n<m.length;n++)m[n].index=f;this.weights.push(m)}};u.prototype.getChildById=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};u.prototype.getChildBySid=function(a,c){for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};u.prototype.parse=function(a){this.id=
- a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new t).parse(b))}}return this};t.prototype.getChannelForTransform=function(a){for(var c=0;c<this.channels.length;c++){var b=this.channels[c],e=b.target.split("/");e.shift();var h=e.shift(),f=h.indexOf(".")>=0,k=h.indexOf("(")>=0,l;if(f)e=h.split("."),h=e.shift(),e.shift();else if(k){l=h.split("(");h=l.shift();
- for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(h==a)return b.info={sid:h,dotSyntax:f,arrSyntax:k,arrIndices:l},b}return null};t.prototype.getChildById=function(a,c){if(this.id==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildById(a,c);if(e)return e}return null};t.prototype.getChildBySid=function(a,c){if(this.sid==a)return this;if(c)for(var b=0;b<this.nodes.length;b++){var e=this.nodes[b].getChildBySid(a,c);if(e)return e}return null};t.prototype.getTransformBySid=
- function(a){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==a)return this.transforms[c];return null};t.prototype.parse=function(a){var c;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var b=0;b<a.childNodes.length;b++)if(c=a.childNodes[b],c.nodeType==
- 1)switch(c.nodeName){case "node":this.nodes.push((new t).parse(c));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new o).parse(c));break;case "instance_geometry":this.geometries.push((new x).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=R.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",R,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new t).parse(c));break;
- case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new v).parse(c));break;case "extra":break;default:console.log(c.nodeName)}a=[];b=1E6;c=-1E6;for(var e in fa)for(var h=fa[e],f=0;f<h.channel.length;f++){var k=h.channel[f],l=h.sampler[f];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,b=Math.min(b,l.startTime),c=Math.max(c,l.endTime),a.push(k)}if(a.length)this.startTime=b,this.endTime=c;if((this.channels=a)&&this.channels.length){e=
- 1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(b=0;b<a.input.length-1;b++)e=Math.min(e,a.input[b+1]-a.input[b])}b=[];for(a=this.startTime;a<this.endTime;a+=e){c=a;for(var h={},m=f=void 0,f=0;f<this.channels.length;f++)m=this.channels[f],h[m.sid]=m;k=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(l=this.transforms[f],m=h[l.sid],m!==void 0){for(var n=m.sampler,p,m=0;m<n.input.length-1;m++)if(n.input[m+1]>c){p=n.output[m];break}k=p!==void 0?p instanceof THREE.Matrix4?
- k.multiply(k,p):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);c=k;b.push({time:a,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=b}this.updateMatrix();return this};t.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};v.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=da(a.textContent);this.updateMatrix();return this};
- v.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
- this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "skeleton":this.skeleton.push(b.textContent.replace(/^#/,""));break;case "bind_material":if(b=R.evaluate(".//dae:instance_material",b,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
- null))for(var e=b.iterateNext();e;)this.instance_material.push((new y).parse(e)),e=b.iterateNext()}}return this};y.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};x.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1&&b.nodeName=="bind_material"){if(a=R.evaluate(".//dae:instance_material",
- b,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=a.iterateNext();c;)this.instance_material.push((new y).parse(c)),c=a.iterateNext();break}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "mesh":this.mesh=(new A(this)).parse(b)}}return this};A.prototype.parse=function(a){function c(a,b){var e=Z(a.position);h[e]===void 0&&(h[e]={v:a,index:b});return h[e]}this.primitives=[];var b;for(b=
- 0;b<a.childNodes.length;b++){var e=a.childNodes[b];switch(e.nodeName){case "source":U(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new C).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new z).parse(e))}}var h={};this.geometry3js=new THREE.Geometry;e=oa[this.vertices.input.POSITION.source].data;for(a=b=0;b<e.length;b+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(e[b],e[b+
- 1],e[b+2]));c(f,a);this.geometry3js.vertices.push(f)}for(b=0;b<this.primitives.length;b++)primitive=this.primitives[b],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(a,c,b){var e=0,h,f,k=a.p,l=a.inputs,m,n,o,p=0,t=3,u=[];for(h=0;h<l.length;h++)switch(m=l[h],
- m.semantic){case "TEXCOORD":u.push(m.set)}for(;e<k.length;){var v=[],w=[],x={},y=[];a.vcount&&(t=a.vcount[p++]);for(h=0;h<t;h++)for(f=0;f<l.length;f++)switch(m=l[f],source=oa[m.source],n=k[e+h*l.length+m.offset],numParams=source.accessor.params.length,o=n*numParams,m.semantic){case "VERTEX":m=Z(c.vertices[n].position);v.push(b[m].index);break;case "NORMAL":w.push(new THREE.Vector3(source.data[o],source.data[o+1],source.data[o+2]));break;case "TEXCOORD":x[m.set]===void 0&&(x[m.set]=[]);x[m.set].push(new THREE.UV(source.data[o],
- source.data[o+1]));break;case "COLOR":y.push((new THREE.Color).setRGB(source.data[o],source.data[o+1],source.data[o+2]))}var z;t==3?z=new THREE.Face3(v[0],v[1],v[2],[w[0],w[1],w[2]],y.length?y:new THREE.Color):t==4&&(z=new THREE.Face4(v[0],v[1],v[2],v[3],[w[0],w[1],w[2],w[3]],y.length?y:new THREE.Color));z.daeMaterial=a.material;c.faces.push(z);for(f=0;f<u.length;f++)h=x[u[f]],c.faceVertexUvs[f].push([h[0],h[1],h[2]]);e+=l.length*t}};z.prototype=new C;z.prototype.constructor=z;C.prototype.setVertices=
- function(a){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==a.id)this.inputs[c].source=a.input.POSITION.source};C.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ja(a,"count",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "input":this.inputs.push((new F).parse(a.childNodes[c]));break;case "vcount":this.vcount=ia(b.textContent);break;case "p":this.p=ia(b.textContent)}}return this};B.prototype.parse=
- function(a){this.params=[];this.source=a.getAttribute("source");this.count=ja(a,"count",0);this.stride=ja(a,"stride",0);for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeName=="param"){var e={};e.name=b.getAttribute("name");e.type=b.getAttribute("type");this.params.push(e)}}return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++)a.childNodes[c].nodeName=="input"&&(input=(new F).parse(a.childNodes[c]),this.input[input.semantic]=
- input);return this};F.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ja(a,"set",-1);this.offset=ja(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(a){this.id=a.getAttribute("id");for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];switch(b.nodeName){case "bool_array":for(var e=ha(b.textContent),h=[],f=0;f<e.length;f++)h.push(e[f]=="true"||e[f]=="1"?
- !0:!1);this.data=h;this.type=b.nodeName;break;case "float_array":this.data=da(b.textContent);this.type=b.nodeName;break;case "int_array":this.data=ia(b.textContent);this.type=b.nodeName;break;case "IDREF_array":case "Name_array":this.data=ha(b.textContent);this.type=b.nodeName;break;case "technique_common":for(e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="accessor"){this.accessor=(new B).parse(b.childNodes[e]);break}}}return this};M.prototype.read=function(){var a=[],c=this.accessor.params[0];
- switch(c.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(c=0;c<this.data.length;c+=16){var b=this.data.slice(c,c+16),e=new THREE.Matrix4;e.set(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8],b[9],b[10],b[11],b[12],b[13],b[14],b[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+c.type+".")}return a};E.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var c=0;c<a.childNodes.length;c++)if(a.childNodes[c].nodeName==
- "instance_effect"){this.instance_effect=(new T).parse(a.childNodes[c]);break}return this};O.prototype.isColor=function(){return this.texture==null};O.prototype.isTexture=function(){return this.texture!=null};O.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "color":b=da(b.textContent);this.color=new THREE.Color(0);this.color.setRGB(b[0],b[1],b[2]);this.color.a=b[3];break;case "texture":this.texture=b.getAttribute("texture"),
- this.texcoord=b.getAttribute("texcoord")}}return this};V.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[b.nodeName]=(new O).parse(b);break;case "shininess":case "reflectivity":case "transparency":var e;e=R.evaluate(".//dae:float",b,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=e.iterateNext(),f=[];h;)f.push(h),h=e.iterateNext();
- e=f;e.length>0&&(this[b.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};V.prototype.create=function(){var a={},c=this.transparency!==void 0&&this.transparency<1,b;for(b in this)switch(b){case "ambient":case "emission":case "diffuse":case "specular":var e=this[b];if(e instanceof O)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=na[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ea+e.init_from),
- a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else b=="diffuse"?a.color=e.color.getHex():c||(a[b]=e.color.getHex());break;case "shininess":case "reflectivity":a[b]=this[b];break;case "transparency":if(c)a.transparent=!0,a.opacity=this[b],c=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};H.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "init_from":this.init_from=
- b.textContent;break;case "format":this.format=b.textContent;break;default:console.log("unhandled Surface prop: "+b.nodeName)}}return this};P.prototype.parse=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":this.source=b.textContent;break;case "minfilter":this.minfilter=b.textContent;break;case "magfilter":this.magfilter=b.textContent;break;case "mipfilter":this.mipfilter=b.textContent;break;case "wrap_s":this.wrap_s=b.textContent;
- break;case "wrap_t":this.wrap_t=b.textContent;break;default:console.log("unhandled Sampler2D prop: "+b.nodeName)}}return this};L.prototype.create=function(){if(this.shader==null)return null};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(b))}}return this};L.prototype.parseNewparam=
- function(a){for(var c=a.getAttribute("sid"),b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new H(this)).parse(e);this.surface.sid=c;break;case "sampler2D":this.sampler=(new P(this)).parse(e);this.sampler.sid=c;break;case "extra":break;default:console.log(e.nodeName)}}};L.prototype.parseProfileCOMMON=function(a){for(var c,b=0;b<a.childNodes.length;b++){var e=a.childNodes[b];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
- break;case "technique":c=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return c};L.prototype.parseTechnique=function(a){for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new V(b.nodeName,this)).parse(b)}}};T.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};S.prototype.parse=function(a){this.id=a.getAttribute("id");
- this.name=a.getAttribute("name");this.source={};for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "source":b=(new M).parse(b);this.source[b.id]=b;break;case "sampler":this.sampler.push((new aa(this)).parse(b));break;case "channel":this.channel.push((new m(this)).parse(b))}}return this};m.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var c=this.target.split("/");c.shift();var a=
- c.shift(),b=a.indexOf(".")>=0,e=a.indexOf("(")>=0,h,f;if(b)c=a.split("."),a=c.shift(),f=c.shift();else if(e){h=a.split("(");a=h.shift();for(c=0;c<h.length;c++)h[c]=parseInt(h[c].replace(/\)/,""))}this.sid=a;this.dotSyntax=b;this.arrSyntax=e;this.arrIndices=h;this.member=f;return this};aa.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];if(b.nodeType==1)switch(b.nodeName){case "input":this.inputs.push((new F).parse(b))}}return this};
- aa.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var c=this.inputs[a],b=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=b.read();break;case "OUTPUT":this.output=b.read();break;case "INTERPOLATION":this.interpolation=b.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
- Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(c,b){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);c+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
- 200))ga=b,a(e.responseXML,void 0,c)};e.open("GET",c,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){xa=a},applySkin:f,geometries:la}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
- THREE.JSONLoader.prototype.load=function(a,b,c){var e,f=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,b=e.callback,c=e.texture_path;e=new Worker(a);c=c?c:this.extractUrlbase(a);e.onmessage=function(a){f.createModel(a.data,b,c);f.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
- THREE.JSONLoader.prototype.createModel=function(a,b,c){var e=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,c);(function(c){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var b,f,n,p,u,t,v,o,y,x,w,A,z,C,B=a.faces;t=a.vertices;var K=a.normals,F=a.colors,M=0;for(b=0;b<a.uvs.length;b++)a.uvs[b].length&&M++;for(b=0;b<M;b++)e.faceUvs[b]=[],e.faceVertexUvs[b]=[];p=0;for(u=t.length;p<u;)v=new THREE.Vertex,v.position.x=t[p++]*c,v.position.y=
- t[p++]*c,v.position.z=t[p++]*c,e.vertices.push(v);p=0;for(u=B.length;p<u;){c=B[p++];t=c&1;n=c&2;b=c&4;f=c&8;o=c&16;v=c&32;x=c&64;c&=128;t?(w=new THREE.Face4,w.a=B[p++],w.b=B[p++],w.c=B[p++],w.d=B[p++],t=4):(w=new THREE.Face3,w.a=B[p++],w.b=B[p++],w.c=B[p++],t=3);if(n)n=B[p++],w.materialIndex=n;n=e.faces.length;if(b)for(b=0;b<M;b++)A=a.uvs[b],y=B[p++],C=A[y*2],y=A[y*2+1],e.faceUvs[b][n]=new THREE.UV(C,y);if(f)for(b=0;b<M;b++){A=a.uvs[b];z=[];for(f=0;f<t;f++)y=B[p++],C=A[y*2],y=A[y*2+1],z[f]=new THREE.UV(C,
- y);e.faceVertexUvs[b][n]=z}if(o)o=B[p++]*3,f=new THREE.Vector3,f.x=K[o++],f.y=K[o++],f.z=K[o],w.normal=f;if(v)for(b=0;b<t;b++)o=B[p++]*3,f=new THREE.Vector3,f.x=K[o++],f.y=K[o++],f.z=K[o],w.vertexNormals.push(f);if(x)v=B[p++],v=new THREE.Color(F[v]),w.color=v;if(c)for(b=0;b<t;b++)v=B[p++],v=new THREE.Color(F[v]),w.vertexColors.push(v);e.faces.push(w)}}})(f);(function(){var c,b,f,n;if(a.skinWeights){c=0;for(b=a.skinWeights.length;c<b;c+=2)f=a.skinWeights[c],n=a.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
- n,0,0))}if(a.skinIndices){c=0;for(b=a.skinIndices.length;c<b;c+=2)f=a.skinIndices[c],n=a.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,n,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(c){if(a.morphTargets!==void 0){var b,f,n,p,u,t,v,o,y;b=0;for(f=a.morphTargets.length;b<f;b++){e.morphTargets[b]={};e.morphTargets[b].name=a.morphTargets[b].name;e.morphTargets[b].vertices=[];o=e.morphTargets[b].vertices;y=a.morphTargets[b].vertices;n=0;for(p=y.length;n<p;n+=3)u=y[n]*c,t=y[n+1]*
- c,v=y[n+2]*c,o.push(new THREE.Vertex(new THREE.Vector3(u,t,v)))}}if(a.morphColors!==void 0){b=0;for(f=a.morphColors.length;b<f;b++){e.morphColors[b]={};e.morphColors[b].name=a.morphColors[b].name;e.morphColors[b].colors=[];p=e.morphColors[b].colors;u=a.morphColors[b].colors;c=0;for(n=u.length;c<n;c+=3)t=new THREE.Color(16755200),t.setRGB(u[c],u[c+1],u[c+2]),p.push(t)}}})(f);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();b(e)};
- THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
- THREE.SceneLoader.prototype={load:function(a,b){var c=this,e=new Worker(a);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,c){return c=="relativeToHTML"?a:f+"/"+a}function l(){for(o in P.objects)if(!U.objects[o])if(z=P.objects[o],z.geometry!==void 0){if(F=U.geometries[z.geometry]){var a=!1;for(da=0;da<z.materials.length;da++)V=U.materials[z.materials[da]],a=V instanceof THREE.ShaderMaterial;a&&F.computeTangents();C=z.position;r=z.rotation;q=z.quaternion;
- s=z.scale;q=0;V.length==0&&(V=new THREE.MeshFaceMaterial);V.length>1&&(V=new THREE.MeshFaceMaterial);object=new THREE.Mesh(F,V);object.name=o;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=z.visible;U.scene.add(object);U.objects[o]=object;z.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),U.scene.collisions.colliders.push(a));if(z.castsShadow)a=
- new THREE.ShadowVolume(F),U.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}}else C=z.position,r=z.rotation,q=z.quaternion,s=z.scale,q=0,object=new THREE.Object3D,object.name=o,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=
- z.visible!==void 0?z.visible:!1,U.scene.add(object),U.objects[o]=object,U.empties[o]=object,z.trigger&&z.trigger.toLowerCase()!="none"&&(a={type:z.trigger,object:z},U.triggers[object.name]=a)}function n(a){return function(b){U.geometries[a]=b;l();T-=1;c.onLoadComplete();u()}}function p(a){return function(c){U.geometries[a]=c}}function u(){c.callbackProgress({totalModels:m,totalTextures:aa,loadedModels:m-T,loadedTextures:aa-S},U);c.onLoadProgress();T==0&&S==0&&b(U)}var t,v,o,y,x,w,A,z,C,B,K,F,M,E,
- O,V,H,P,L,T,S,m,aa,U;P=a.data;O=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=T=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(o in P.objects)if(z=P.objects[o],z.meshCollider){a=!0;break}if(a)U.scene.collisions=new THREE.CollisionSystem;if(P.transform){a=P.transform.position;B=P.transform.rotation;var ea=P.transform.scale;a&&U.scene.position.set(a[0],a[1],a[2]);B&&U.scene.rotation.set(B[0],B[1],B[2]);ea&&
- U.scene.scale.set(ea[0],ea[1],ea[2]);(a||B||ea)&&U.scene.updateMatrix()}a=function(){S-=1;u();c.onLoadComplete()};for(x in P.cameras)B=P.cameras[x],B.type=="perspective"?M=new THREE.PerspectiveCamera(B.fov,B.aspect,B.near,B.far):B.type=="ortho"&&(M=new THREE.OrthographicCamera(B.left,B.right,B.top,B.bottom,B.near,B.far)),C=B.position,B=B.target,M.position.set(C[0],C[1],C[2]),M.target=new THREE.Vector3(B[0],B[1],B[2]),U.cameras[x]=M;for(y in P.lights)x=P.lights[y],M=x.color!==void 0?x.color:16777215,
- B=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,H=new THREE.DirectionalLight(M,B),H.position.set(C[0],C[1],C[2]),H.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,H=new THREE.PointLight(M,B,d),H.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(H=new THREE.AmbientLight(M)),U.scene.add(H),U.lights[y]=H;for(w in P.fogs)y=P.fogs[w],y.type=="linear"?E=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(E=new THREE.FogExp2(0,y.density)),B=y.color,E.color.setRGB(B[0],
- B[1],B[2]),U.fogs[w]=E;if(U.cameras&&P.defaults.camera)U.currentCamera=U.cameras[P.defaults.camera];if(U.fogs&&P.defaults.fog)U.scene.fog=U.fogs[P.defaults.fog];B=P.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(B[0],B[1],B[2]);U.bgColorAlpha=P.defaults.bgalpha;for(t in P.geometries)if(w=P.geometries[t],w.type=="bin_mesh"||w.type=="ascii_mesh")T+=1,c.onLoadStart();m=T;for(t in P.geometries)w=P.geometries[t],w.type=="cube"?(F=new THREE.CubeGeometry(w.width,w.height,w.depth,w.segmentsWidth,
- w.segmentsHeight,w.segmentsDepth,null,w.flipped,w.sides),U.geometries[t]=F):w.type=="plane"?(F=new THREE.PlaneGeometry(w.width,w.height,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="sphere"?(F=new THREE.SphereGeometry(w.radius,w.segmentsWidth,w.segmentsHeight),U.geometries[t]=F):w.type=="cylinder"?(F=new THREE.CylinderGeometry(w.topRad,w.botRad,w.height,w.radSegs,w.heightSegs),U.geometries[t]=F):w.type=="torus"?(F=new THREE.TorusGeometry(w.radius,w.tube,w.segmentsR,w.segmentsT),U.geometries[t]=
- F):w.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(w.subdivisions),U.geometries[t]=F):w.type=="bin_mesh"?O.load(e(w.url,P.urlBaseType),n(t)):w.type=="ascii_mesh"?L.load(e(w.url,P.urlBaseType),n(t)):w.type=="embedded_mesh"&&(w=P.embeds[w.id])&&L.createModel(w,p(t),"");for(A in P.textures)if(t=P.textures[A],t.url instanceof Array){S+=t.url.length;for(O=0;O<t.url.length;O++)c.onLoadStart()}else S+=1,c.onLoadStart();aa=S;for(A in P.textures){t=P.textures[A];if(t.mapping!=void 0&&THREE[t.mapping]!=
- void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){O=[];for(var da=0;da<t.url.length;da++)O[da]=e(t.url[da],P.urlBaseType);O=THREE.ImageUtils.loadTextureCube(O,t.mapping,a)}else{O=THREE.ImageUtils.loadTexture(e(t.url,P.urlBaseType),t.mapping,a);if(THREE[t.minFilter]!=void 0)O.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)O.magFilter=THREE[t.magFilter];if(t.repeat){O.repeat.set(t.repeat[0],t.repeat[1]);if(t.repeat[0]!=1)O.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)O.wrapT=
- THREE.RepeatWrapping}t.offset&&O.offset.set(t.offset[0],t.offset[1]);if(t.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[t.wrap[0]]!==void 0)O.wrapS=L[t.wrap[0]];if(L[t.wrap[1]]!==void 0)O.wrapT=L[t.wrap[1]]}}U.textures[A]=O}for(v in P.materials){A=P.materials[v];for(K in A.parameters)if(K=="envMap"||K=="map"||K=="lightMap")A.parameters[K]=U.textures[A.parameters[K]];else if(K=="shading")A.parameters[K]=A.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;
- else if(K=="blending")A.parameters[K]=THREE[A.parameters[K]]?THREE[A.parameters[K]]:THREE.NormalBlending;else if(K=="combine")A.parameters[K]=A.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(A.parameters[K]=="face")A.parameters[K]=THREE.FaceColors;else if(A.parameters[K])A.parameters[K]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=!0;if(A.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;
- a=THREE.UniformsUtils.clone(t.uniforms);O=A.parameters.color;L=A.parameters.specular;w=A.parameters.ambient;E=A.parameters.shininess;a.tNormal.texture=U.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)a.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)a.tDiffuse.texture=A.parameters.map,a.enableDiffuse.value=!0;if(A.parameters.lightMap)a.tAO.texture=A.parameters.lightMap,a.enableAO.value=!0;if(A.parameters.specularMap)a.tSpecular.texture=U.textures[A.parameters.specularMap],
- a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(O);a.uSpecularColor.value.setHex(L);a.uAmbientColor.value.setHex(w);a.uShininess.value=E;if(A.parameters.opacity)a.uOpacity.value=A.parameters.opacity;A=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:a,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);U.materials[v]=A}l();c.callbackSync(U)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
- THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
- THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var e=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,h=c.offsetX!==void 0?c.offsetX:0,k=c.offsetY!==void 0?c.offsetY:0,l=c.offsetZ!==void 0?c.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
- b,f,h,k,l):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),e=1,f=0;f<8;f++){for(var h=0,k=0;k<b;++k){var l=a.charCodeAt(k+e);h+=l>>1^-(l&1);c[8*k+f]=h}e+=b}b=a.length-e;h=new Uint16Array(b);for(f=k=0;f<b;f++)l=a.charCodeAt(f+e),h[f]=k-l,l==0&&k++;return[c,h]};
- THREE.UTF8Loader.prototype.createModel=function(a,b,c,e,f,h){var k=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(a),p=[],u=[];(function(a,k,n){for(var p,u,w,A=a.length;n<A;n+=k)p=a[n],u=a[n+1],w=a[n+2],p=p/16383*c,u=u/16383*c,w=w/16383*c,p+=e,u+=f,w+=h,b.vertices.push(new THREE.Vertex(new THREE.Vector3(p,u,w)))})(k[0],8,0);(function(a,c,b){for(var e,f,h=a.length;b<h;b+=c)e=a[b],f=a[b+1],e/=1023,f/=1023,u.push(e,1-f)})(k[0],8,3);(function(a,
- c,b){for(var e,f,h,k=a.length;b<k;b+=c)e=a[b],f=a[b+1],h=a[b+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(k[0],8,5);(function(a){var c,e,f,h,k,n,z,C,B,K=a.length;for(c=0;c<K;c+=3){e=a[c];f=a[c+1];h=a[c+2];k=b;C=e;B=f;n=h;z=e;var F=f,M=h,E=k.materials[0],O=p[F*3],V=p[F*3+1],F=p[F*3+2],H=p[M*3],P=p[M*3+1],M=p[M*3+2];z=new THREE.Vector3(p[z*3],p[z*3+1],p[z*3+2]);F=new THREE.Vector3(O,V,F);M=new THREE.Vector3(H,P,M);k.faces.push(new THREE.Face3(C,B,n,[z,F,M],null,E));k=u[e*2];e=u[e*2+
- 1];n=u[f*2];z=u[f*2+1];C=u[h*2];B=u[h*2+1];h=b.faceVertexUvs[0];f=n;n=z;z=[];z.push(new THREE.UV(k,e));z.push(new THREE.UV(f,n));z.push(new THREE.UV(C,B));h.push(z)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;b(new k)};
- THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
- c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
- THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(a){this.isolation=80;this.size=a;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(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l+k*this.delta;b[h+1]=n;b[h+2]=p;f[h]=this.lerp(u[a],u[a+3],k);f[h+1]=this.lerp(u[a+1],u[a+4],k);f[h+2]=this.lerp(u[a+2],u[a+5],k)};this.VIntY=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n+k*this.delta;b[h+
- 2]=p;b=a+this.yd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.VIntZ=function(a,b,f,h,k,l,n,p,u,t){k=(k-u)/(t-u);u=this.normal_cache;b[h]=l;b[h+1]=n;b[h+2]=p+k*this.delta;b=a+this.zd*3;f[h]=this.lerp(u[a],u[b],k);f[h+1]=this.lerp(u[a+1],u[b+1],k);f[h+2]=this.lerp(u[a+2],u[b+2],k)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-
- this.field[a+this.yd],this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,h,k,l){var n=h+1,p=h+this.yd,u=h+this.zd,t=n+this.yd,v=n+this.zd,o=h+this.yd+this.zd,y=n+this.yd+this.zd,x=0,w=this.field[h],A=this.field[n],z=this.field[p],C=this.field[t],B=this.field[u],K=this.field[v],F=this.field[o],M=this.field[y];w<k&&(x|=1);A<k&&(x|=2);z<k&&(x|=8);C<k&&(x|=4);B<k&&(x|=16);K<k&&(x|=32);F<k&&(x|=128);M<k&&(x|=64);var E=THREE.edgeTable[x];if(E===0)return 0;
- var O=this.delta,V=a+O,H=b+O,O=f+O;E&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,k,a,b,f,w,A));E&2&&(this.compNorm(n),this.compNorm(t),this.VIntY(n*3,this.vlist,this.nlist,3,k,V,b,f,A,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,k,a,H,f,z,C));E&8&&(this.compNorm(h),this.compNorm(p),this.VIntY(h*3,this.vlist,this.nlist,9,k,a,b,f,w,z));E&16&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,12,k,a,b,O,B,K));
- E&32&&(this.compNorm(v),this.compNorm(y),this.VIntY(v*3,this.vlist,this.nlist,15,k,V,b,O,K,M));E&64&&(this.compNorm(o),this.compNorm(y),this.VIntX(o*3,this.vlist,this.nlist,18,k,a,H,O,F,M));E&128&&(this.compNorm(u),this.compNorm(o),this.VIntY(u*3,this.vlist,this.nlist,21,k,a,b,O,B,F));E&256&&(this.compNorm(h),this.compNorm(u),this.VIntZ(h*3,this.vlist,this.nlist,24,k,a,b,f,w,B));E&512&&(this.compNorm(n),this.compNorm(v),this.VIntZ(n*3,this.vlist,this.nlist,27,k,V,b,f,A,K));E&1024&&(this.compNorm(t),
- this.compNorm(y),this.VIntZ(t*3,this.vlist,this.nlist,30,k,V,H,f,C,M));E&2048&&(this.compNorm(p),this.compNorm(o),this.VIntZ(p*3,this.vlist,this.nlist,33,k,a,H,f,z,F));x<<=4;for(k=h=0;THREE.triTable[x+k]!=-1;)a=x+k,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],l),k+=3,h++;return h};this.posnormtriv=function(a,b,f,h,k,l){var n=this.count*3;this.positionArray[n]=a[f];this.positionArray[n+1]=a[f+1];this.positionArray[n+2]=a[f+2];this.positionArray[n+
- 3]=a[h];this.positionArray[n+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[k];this.positionArray[n+7]=a[k+1];this.positionArray[n+8]=a[k+2];this.normalArray[n]=b[f];this.normalArray[n+1]=b[f+1];this.normalArray[n+2]=b[f+2];this.normalArray[n+3]=b[h];this.normalArray[n+4]=b[h+1];this.normalArray[n+5]=b[h+2];this.normalArray[n+6]=b[k];this.normalArray[n+7]=b[k+1];this.normalArray[n+8]=b[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&l(this)};this.begin=
- function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,h,k){var l=this.size*Math.sqrt(h/k),n=f*this.size,p=b*this.size,u=a*this.size,t=Math.floor(n-l);t<1&&(t=1);n=Math.floor(n+l);n>this.size-1&&(n=this.size-1);var v=Math.floor(p-l);v<1&&(v=1);p=Math.floor(p+l);p>this.size-1&&(p=this.size-1);var o=Math.floor(u-l);o<1&&(o=1);l=Math.floor(u+l);
- l>this.size-1&&(l=this.size-1);for(var y,x,w,A,z,C;t<n;t++){u=this.size2*t;x=t/this.size-f;z=x*x;for(x=v;x<p;x++){w=u+this.size*x;y=x/this.size-b;C=y*y;for(y=o;y<l;y++)A=y/this.size-a,A=h/(1.0E-6+A*A+C+z)-k,A>0&&(this.field[w+y]+=A)}}};this.addPlaneX=function(a,b){var f,h,k,l,n,p=this.size,u=this.yd,t=this.zd,v=this.field,o=p*Math.sqrt(a/b);o>p&&(o=p);for(f=0;f<o;f++)if(h=f/p,h*=h,l=a/(1.0E-4+h)-b,l>0)for(h=0;h<p;h++){n=f+h*u;for(k=0;k<p;k++)v[t*k+n]+=l}};this.addPlaneY=function(a,b){var f,h,k,l,
- n,p,u=this.size,t=this.yd,v=this.zd,o=this.field,y=u*Math.sqrt(a/b);y>u&&(y=u);for(h=0;h<y;h++)if(f=h/u,f*=f,l=a/(1.0E-4+f)-b,l>0){n=h*t;for(f=0;f<u;f++){p=n+f;for(k=0;k<u;k++)o[v*k+p]+=l}}};this.addPlaneZ=function(a,b){var f,h,k,l,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/b);dist>size&&(dist=size);for(k=0;k<dist;k++)if(f=k/size,f*=f,l=a/(1.0E-4+f)-b,l>0){n=zd*k;for(h=0;h<size;h++){p=n+h*yd;for(f=0;f<size;f++)field[p+f]+=l}}};this.reset=function(){var a;for(a=
- 0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var b,f,h,k,l,n,p,u,t,v=this.size-2;for(k=1;k<v;k++){t=this.size2*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<v;h++){u=t+this.size*h;n=(h-this.halfsize)/this.halfsize;for(f=1;f<v;f++)l=(f-this.halfsize)/this.halfsize,b=u+f,this.polygonize(l,n,p,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(h){var k,l,n,p,u,t,v,o;for(k=0;k<h.count;k++)v=
- k*3,u=v+1,o=v+2,l=h.positionArray[v],n=h.positionArray[u],p=h.positionArray[o],t=new THREE.Vector3(l,n,p),l=h.normalArray[v],n=h.normalArray[u],p=h.normalArray[o],v=new THREE.Vector3(l,n,p),v.normalize(),u=new THREE.Vertex(t),b.vertices.push(u),f.push(v);nfaces=h.count/3;for(k=0;k<nfaces;k++)v=(a+k)*3,u=v+1,o=v+2,t=f[v],l=f[u],n=f[o],v=new THREE.Face3(v,u,o,[t,l,n]),b.faces.push(v);a+=nfaces;h.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
- THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
- THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
- 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
- 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
- THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
- -1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
- 8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
- -1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
- 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
- -1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
- 10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
- 6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
- 8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
- 2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
- -1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
- -1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
- -1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- 1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
- -1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
- 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
- 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
- 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.PlaneCollider=function(a,b){this.point=a;this.normal=b};THREE.SphereCollider=function(a,b){this.center=a;this.radius=b;this.radiusSq=b*b};THREE.BoxCollider=function(a,b){this.min=a;this.max=b;this.dynamic=!0;this.normal=new THREE.Vector3};
- THREE.MeshCollider=function(a,b){this.mesh=a;this.box=b;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(a){Array.prototype.push.apply(this.colliders,a.colliders);Array.prototype.push.apply(this.hits,a.hits)};
- THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var b,c,e,f,h=0;b=0;for(c=this.colliders.length;b<c;b++)if(f=this.colliders[b],e=this.rayCast(a,f),e<Number.MAX_VALUE)f.distance=e,e>h?this.hits.push(f):this.hits.unshift(f),h=e;return this.hits};
- THREE.CollisionSystem.prototype.rayCastNearest=function(a){var b=this.rayCastAll(a);if(b.length==0)return null;for(var c=0;b[c]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,b[c]);if(e.dist<Number.MAX_VALUE){b[c].distance=e.dist;b[c].faceIndex=e.faceIndex;break}c++}if(c>b.length)return null;return b[c]};
- THREE.CollisionSystem.prototype.rayCast=function(a,b){if(b instanceof THREE.PlaneCollider)return this.rayPlane(a,b);else if(b instanceof THREE.SphereCollider)return this.raySphere(a,b);else if(b instanceof THREE.BoxCollider)return this.rayBox(a,b);else if(b instanceof THREE.MeshCollider&&b.box)return this.rayBox(a,b.box)};
- THREE.CollisionSystem.prototype.rayMesh=function(a,b){for(var c=this.makeRayLocal(a,b.mesh),e=Number.MAX_VALUE,f,h=0;h<b.numFaces;h++){var k=b.mesh.geometry.faces[h],l=b.mesh.geometry.vertices[k.a].position,n=b.mesh.geometry.vertices[k.b].position,p=b.mesh.geometry.vertices[k.c].position,u=k instanceof THREE.Face4?b.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(c,l,n,p,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize())):
- k instanceof THREE.Face4&&(k=this.rayTriangle(c,l,n,u,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize()),k=this.rayTriangle(c,n,p,u,e,this.collisionNormal,b.mesh),k<e&&(e=k,f=h,b.normal.copy(this.collisionNormal),b.normal.normalize()))}return{dist:e,faceIndex:f}};
- THREE.CollisionSystem.prototype.rayTriangle=function(a,b,c,e,f,h,k){var l=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;h.set(0,0,0);l.sub(c,b);n.sub(e,c);h.cross(l,n);l=h.dot(a.direction);if(!(l<0))if(k.doubleSided||k.flipSided)h.multiplyScalar(-1),l*=-1;else return Number.MAX_VALUE;k=h.dot(b)-h.dot(a.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=l*f))return Number.MAX_VALUE;k/=l;l=THREE.CollisionSystem.__v3;l.copy(a.direction);l.multiplyScalar(k);l.addSelf(a.origin);Math.abs(h.x)>
- Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(a=l.y-b.y,h=c.y-b.y,f=e.y-b.y,l=l.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.y-b.y,c=c.y-b.y,e=e.y-b.y):Math.abs(h.y)>Math.abs(h.z)?(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.z-b.z,c=c.z-b.z,e=e.z-b.z):(a=l.x-b.x,h=c.x-b.x,f=e.x-b.x,l=l.y-b.y,c=c.y-b.y,e=e.y-b.y);b=h*e-c*f;if(b==0)return Number.MAX_VALUE;b=1/b;e=(a*e-l*f)*b;if(!(e>=0))return Number.MAX_VALUE;b*=h*l-c*a;if(!(b>=0))return Number.MAX_VALUE;if(!(1-e-b>=0))return Number.MAX_VALUE;return k};
- THREE.CollisionSystem.prototype.makeRayLocal=function(a,b){var c=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(b.matrixWorld,c);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);c.multiplyVector3(e.origin);c.rotateAxis(e.direction);e.direction.normalize();return e};
- THREE.CollisionSystem.prototype.rayBox=function(a,b){var c;b.dynamic&&b.mesh&&b.mesh.matrixWorld?c=this.makeRayLocal(a,b.mesh):(c=THREE.CollisionSystem.__r,c.origin.copy(a.origin),c.direction.copy(a.direction));var e=0,f=0,h=0,k=0,l=0,n=0,p=!0;c.origin.x<b.min.x?(e=b.min.x-c.origin.x,e/=c.direction.x,p=!1,k=-1):c.origin.x>b.max.x&&(e=b.max.x-c.origin.x,e/=c.direction.x,p=!1,k=1);c.origin.y<b.min.y?(f=b.min.y-c.origin.y,f/=c.direction.y,p=!1,l=-1):c.origin.y>b.max.y&&(f=b.max.y-c.origin.y,f/=c.direction.y,
- p=!1,l=1);c.origin.z<b.min.z?(h=b.min.z-c.origin.z,h/=c.direction.z,p=!1,n=-1):c.origin.z>b.max.z&&(h=b.max.z-c.origin.z,h/=c.direction.z,p=!1,n=1);if(p)return-1;p=0;f>e&&(p=1,e=f);h>e&&(p=2,e=h);switch(p){case 0:l=c.origin.y+c.direction.y*e;if(l<b.min.y||l>b.max.y)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(k,0,0);break;case 1:k=c.origin.x+c.direction.x*e;if(k<b.min.x||k>b.max.x)return Number.MAX_VALUE;c=c.origin.z+c.direction.z*
- e;if(c<b.min.z||c>b.max.z)return Number.MAX_VALUE;b.normal.set(0,l,0);break;case 2:k=c.origin.x+c.direction.x*e;if(k<b.min.x||k>b.max.x)return Number.MAX_VALUE;l=c.origin.y+c.direction.y*e;if(l<b.min.y||l>b.max.y)return Number.MAX_VALUE;b.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,b){var c=a.direction.dot(b.normal),e=b.point.dot(b.normal);if(c<0)c=(e-a.origin.dot(b.normal))/c;else return Number.MAX_VALUE;return c>0?c:Number.MAX_VALUE};
- THREE.CollisionSystem.prototype.raySphere=function(a,b){var c=b.center.clone().subSelf(a.origin);if(c.lengthSq<b.radiusSq)return-1;var e=c.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;c=b.radiusSq-(c.lengthSq()-e*e);if(c>=0)return Math.abs(e)-Math.sqrt(c);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
- THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var b=a.geometry.boundingBox,c=new THREE.Vector3(b.x[0],b.y[0],b.z[0]),b=new THREE.Vector3(b.x[1],b.y[1],b.z[1]),c=new THREE.BoxCollider(c,b);c.mesh=a;return c};THREE.CollisionUtils.MeshAABB=function(a){var b=THREE.CollisionUtils.MeshOBB(a);b.min.addSelf(a.position);b.max.addSelf(a.position);b.dynamic=!1;return b};
- THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
- if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);var b=this,c=this.setSize,e=this.render,f=new THREE.PerspectiveCamera,h=new THREE.PerspectiveCamera,k=new THREE.Matrix4,l=new THREE.Matrix4,n,p,u;f.matrixAutoUpdate=h.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.PerspectiveCamera(53,1,1,1E4);o.position.z=
- 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},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 y=new THREE.Scene;y.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(a,e){c.call(b,a,e);t.width=a;t.height=e;v.width=a;v.height=e};this.render=function(a,c){c.update(null,!0);if(n!==c.aspect||p!==c.near||u!==c.fov){n=c.aspect;p=c.near;u=c.fov;var A=c.projectionMatrix.clone(),z=125/30*0.5,C=z*p/125,B=p*Math.tan(u*Math.PI/360),K;k.n14=z;l.n14=-z;z=-B*n+C;K=B*n+C;A.n11=2*p/(K-z);A.n13=(K+z)/(K-z);f.projectionMatrix=A.clone();z=-B*n-C;K=B*n-C;A.n11=2*p/(K-z);A.n13=
- (K+z)/(K-z);h.projectionMatrix=A.clone()}f.matrix=c.matrixWorld.clone().multiplySelf(l);f.update(null,!0);f.position.copy(c.position);f.near=p;f.far=c.far;e.call(b,a,f,t,!0);h.matrix=c.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(c.position);h.near=p;h.far=c.far;e.call(b,a,h,v,!0);e.call(b,y,o)}};
- if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,e=this.render,f,h,k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);var l=new THREE.PerspectiveCamera;l.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,e){c.call(b,a,e);f=a/2;h=e};this.render=function(a,c){this.clear();k.fov=c.fov;k.aspect=0.5*c.aspect;k.near=c.near;k.far=
- c.far;k.updateProjectionMatrix();k.position.copy(c.position);k.target.copy(c.target);k.translateX(b.separation);k.lookAt(k.target);l.projectionMatrix=k.projectionMatrix;l.position.copy(c.position);l.target.copy(c.target);l.translateX(-b.separation);l.lookAt(l.target);this.setViewport(0,0,f,h);e.call(b,a,k);this.setViewport(f,0,f,h);e.call(b,a,l,!1)}};
|