123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698 |
- // Three.js r45dev - http://github.com/mrdoob/three.js
- var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
- THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,e){this.r=b;this.g=c;this.b=e;return this},setHSV:function(b,c,e){var f,m,h;if(e==0)this.r=this.g=this.b=0;else switch(f=Math.floor(b*6),m=b*6-f,b=e*(1-c),h=e*(1-c*m),c=e*(1-c*(1-m)),f){case 1:this.r=h;this.g=e;this.b=b;break;case 2:this.r=b;this.g=e;this.b=c;break;case 3:this.r=b;this.g=h;this.b=e;break;case 4:this.r=c;this.g=b;this.b=e;break;case 5:this.r=
- e;this.g=b;this.b=h;break;case 6:case 0:this.r=e,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&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(b,c){this.x=b||0;this.y=c||0};
- THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
- divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
- equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,e){this.x=b||0;this.y=c||0;this.z=e||0};
- THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,e){this.x=b;this.y=c;this.z=e;return this},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},
- addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this},
- divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},
- cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);
- Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(b,c,e,f){this.x=b||0;this.y=c||0;this.z=e||0;this.w=f!==void 0?f:1};
- THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w!==void 0?b.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-
- c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
- normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
- THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)Array.prototype.push.apply(f,this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f;f=c.clone().subSelf(b).dot(e);if(f<=0)return null;b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),
- c=c.clone().subSelf(e),m=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(m),h=c.dot(c),c=c.dot(m),m=1/(b*h-e*e),h=(h*f-e*c)*m,b=(b*c-e*f)*m;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
- Math.max(b.scale.y,b.scale.z)))return[];var m,h,k,n,p,u,w,t,x,v,z=b.geometry,y=z.vertices,B=[],f=0;for(m=z.faces.length;f<m;f++)if(h=z.faces[f],x=this.origin.clone(),v=this.direction.clone(),u=b.matrixWorld,k=u.multiplyVector3(h.centroid.clone()).subSelf(x),t=k.dot(v),!(t<=0)&&(k=u.multiplyVector3(y[h.a].position.clone()),n=u.multiplyVector3(y[h.b].position.clone()),p=u.multiplyVector3(y[h.c].position.clone()),u=h instanceof THREE.Face4?u.multiplyVector3(y[h.d].position.clone()):null,w=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
- t=v.dot(w),b.doubleSided||(b.flipSided?t>0:t<0)))if(t=w.dot((new THREE.Vector3).sub(k,x))/t,x=x.addSelf(v.multiplyScalar(t)),h instanceof THREE.Face3)e(x,k,n,p)&&(h={distance:this.origin.distanceTo(x),point:x,face:h,object:b},B.push(h));else if(h instanceof THREE.Face4&&(e(x,k,n,u)||e(x,n,p,u)))h={distance:this.origin.distanceTo(x),point:x,face:h,object:b},B.push(h);B.sort(function(b,e){return b.distance-e.distance});return B}else return[]}};
- THREE.Rectangle=function(){function b(){h=f-c;k=m-e}var c,e,f,m,h,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return m};this.set=function(h,k,w,t){n=!1;c=h;e=k;f=w;m=t;b()};this.addPoint=function(h,k){n?(n=!1,c=h,e=k,f=h,m=k):(c=c<h?c:h,e=e<k?e:k,f=f>h?f:h,m=m>k?m:k);b()};this.add3Points=
- function(h,k,w,t,x,v){n?(n=!1,c=h<w?h<x?h:x:w<x?w:x,e=k<t?k<v?k:v:t<v?t:v,f=h>w?h>x?h:x:w>x?w:x,m=k>t?k>v?k:v:t>v?t:v):(c=h<w?h<x?h<c?h:c:x<c?x:c:w<x?w<c?w:c:x<c?x:c,e=k<t?k<v?k<e?k:e:v<e?v:e:t<v?t<e?t:e:v<e?v:e,f=h>w?h>x?h>f?h:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,m=k>t?k>v?k>m?k:m:v>m?v:m:t>v?t>m?t:m:v>m?v:m);b()};this.addRectangle=function(h){n?(n=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),m=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),m=m>
- h.getBottom()?m:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;m+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();m=m<h.getBottom()?m:h.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(m,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;m=f=e=c=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]};
- THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
- THREE.Matrix4=function(b,c,e,f,m,h,k,n,p,u,w,t,x,v,z,y){this.set(b!==void 0?b:1,c||0,e||0,f||0,m||0,h!==void 0?h:1,k||0,n||0,p||0,u||0,w!==void 0?w:1,t||0,x||0,v||0,z||0,y!==void 0?y:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,m,h,k,n,p,u,w,t,x,v,z,y){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=m;this.n22=h;this.n23=k;this.n24=n;this.n31=p;this.n32=u;this.n33=w;this.n34=t;this.n41=x;this.n42=v;this.n43=z;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
- c,e){var f=THREE.Matrix4.__v1,m=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;f.cross(e,h).normalize();f.length()===0&&(h.x+=1.0E-4,f.cross(e,h).normalize());m.cross(h,f).normalize();this.n11=f.x;this.n12=m.x;this.n13=h.x;this.n21=f.y;this.n22=m.y;this.n23=h.y;this.n31=f.z;this.n32=m.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,m=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*m;
- b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*m;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*m;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,m=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*m;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*m;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*m;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*m;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
- e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,m=b.n13,h=b.n14,k=b.n21,n=b.n22,p=b.n23,u=b.n24,w=b.n31,t=b.n32,x=b.n33,v=b.n34,z=b.n41,y=b.n42,B=b.n43,C=b.n44,E=c.n11,F=c.n12,
- G=c.n13,M=c.n14,P=c.n21,L=c.n22,A=c.n23,J=c.n24,Z=c.n31,I=c.n32,O=c.n33,X=c.n34,V=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*E+f*P+m*Z+h*V;this.n12=e*F+f*L+m*I+h*W;this.n13=e*G+f*A+m*O+h*o;this.n14=e*M+f*J+m*X+h*ea;this.n21=k*E+n*P+p*Z+u*V;this.n22=k*F+n*L+p*I+u*W;this.n23=k*G+n*A+p*O+u*o;this.n24=k*M+n*J+p*X+u*ea;this.n31=w*E+t*P+x*Z+v*V;this.n32=w*F+t*L+x*I+v*W;this.n33=w*G+t*A+x*O+v*o;this.n34=w*M+t*J+x*X+v*ea;this.n41=z*E+y*P+B*Z+C*V;this.n42=z*F+y*L+B*I+C*W;this.n43=z*G+y*A+B*O+C*o;this.n44=z*
- M+y*J+B*X+C*ea;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
- b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,m=this.n21,h=this.n22,k=this.n23,n=this.n24,p=this.n31,u=this.n32,w=this.n33,t=this.n34,x=this.n41,v=this.n42,z=this.n43,y=this.n44;return f*k*u*x-e*n*u*x-f*h*w*x+c*n*w*x+e*h*t*x-c*k*t*x-f*k*p*v+e*n*p*v+f*m*w*v-b*n*w*v-e*m*t*v+b*k*t*v+f*h*p*z-c*n*p*z-f*m*u*z+b*n*u*z+c*m*t*z-b*h*t*z-e*h*p*y+c*k*p*y+e*m*u*y-b*k*u*y-c*m*
- w*y+b*h*w*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
- this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
- this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
- this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
- 0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),m=1-e,h=b.x,k=b.y,n=b.z,p=m*h,u=m*k;this.set(p*h+e,p*k-f*n,p*n+f*k,0,p*k+f*n,u*k+e,u*n-f*h,0,p*n-f*k,u*n+f*h,m*n*n+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
- new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,m=b.z,h=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f),n=Math.cos(m),m=Math.sin(m);switch(c){case "YXZ":var p=
- k*n,u=k*m,w=f*n,t=f*m;this.n11=p+t*e;this.n12=w*e-u;this.n13=h*f;this.n21=h*m;this.n22=h*n;this.n23=-e;this.n31=u*e-w;this.n32=t+p*e;this.n33=h*k;break;case "ZXY":p=k*n;u=k*m;w=f*n;t=f*m;this.n11=p-t*e;this.n12=-h*m;this.n13=w+u*e;this.n21=u+w*e;this.n22=h*n;this.n23=t-p*e;this.n31=-h*f;this.n32=e;this.n33=h*k;break;case "ZYX":p=h*n;u=h*m;w=e*n;t=e*m;this.n11=k*n;this.n12=w*f-u;this.n13=p*f+t;this.n21=k*m;this.n22=t*f+p;this.n23=u*f-w;this.n31=-f;this.n32=e*k;this.n33=h*k;break;case "YZX":p=h*k;u=
- h*f;w=e*k;t=e*f;this.n11=k*n;this.n12=t-p*m;this.n13=w*m+u;this.n21=m;this.n22=h*n;this.n23=-e*n;this.n31=-f*n;this.n32=u*m+w;this.n33=p-t*m;break;case "XZY":p=h*k;u=h*f;w=e*k;t=e*f;this.n11=k*n;this.n12=-m;this.n13=f*n;this.n21=p*m+t;this.n22=h*n;this.n23=u*m-w;this.n31=w*m-u;this.n32=e*n;this.n33=t*m+p;break;default:p=h*n,u=h*m,w=e*n,t=e*m,this.n11=k*n,this.n12=-k*m,this.n13=f,this.n21=u+w*f,this.n22=p-t*f,this.n23=-e*k,this.n31=t-p*f,this.n32=w+u*f,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=
- b.x,e=b.y,f=b.z,m=b.w,h=c+c,k=e+e,n=f+f,b=c*h,p=c*k;c*=n;var u=e*k;e*=n;f*=n;h*=m;k*=m;m*=n;this.n11=1-(u+f);this.n12=p-m;this.n13=c+k;this.n21=p+m;this.n22=1-(b+f);this.n23=e-h;this.n31=c-k;this.n32=e+h;this.n33=1-(b+u);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,m=THREE.Matrix4.__m2;
- f.identity();f.setRotationFromQuaternion(c);m.setScale(e.x,e.y,e.z);this.multiply(f,m);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,m=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);m.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length();
- e.y=m.length();e.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,m=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*m;this.n23=
- b.n23*m;this.n33=b.n33*m}};
- THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,m=b.n13,h=b.n14,k=b.n21,n=b.n22,p=b.n23,u=b.n24,w=b.n31,t=b.n32,x=b.n33,v=b.n34,z=b.n41,y=b.n42,B=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*y-u*x*y+u*t*B-n*v*B-p*t*C+n*x*C;c.n12=h*x*y-m*v*y-h*t*B+f*v*B+m*t*C-f*x*C;c.n13=m*u*y-h*p*y+h*n*B-f*u*B-m*n*C+f*p*C;c.n14=h*p*t-m*u*t-h*n*x+f*u*x+m*n*v-f*p*v;c.n21=u*x*z-p*v*z-u*w*B+k*v*B+p*w*C-k*x*C;c.n22=m*v*z-h*x*z+h*w*B-e*v*B-m*w*C+e*x*C;c.n23=h*p*z-m*u*z-h*k*B+e*u*B+m*k*C-e*p*C;c.n24=
- m*u*w-h*p*w+h*k*x-e*u*x-m*k*v+e*p*v;c.n31=n*v*z-u*t*z+u*w*y-k*v*y-n*w*C+k*t*C;c.n32=h*t*z-f*v*z-h*w*y+e*v*y+f*w*C-e*t*C;c.n33=m*u*z-h*n*z+h*k*y-e*u*y-f*k*C+e*n*C;c.n34=h*n*w-f*u*w-h*k*t+e*u*t+f*k*v-e*n*v;c.n41=p*t*z-n*x*z-p*w*y+k*x*y+n*w*B-k*t*B;c.n42=f*x*z-m*t*z+m*w*y-e*x*y-f*w*B+e*t*B;c.n43=m*n*z-f*p*z-m*k*y+e*p*y+f*k*B-e*n*B;c.n44=f*p*w-m*n*w+m*k*t-e*p*t-f*k*x+e*n*x;c.multiplyScalar(1/b.determinant());return c};
- THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,m=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,u=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*u;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*m;e[2]=b*h;e[3]=b*k;e[4]=b*n;e[5]=b*p;e[6]=b*u;e[7]=b*w;e[8]=b*t;return c};
- THREE.Matrix4.makeFrustum=function(b,c,e,f,m,h){var k;k=new THREE.Matrix4;k.n11=2*m/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*m/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+m)/(h-m);k.n34=-2*h*m/(h-m);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var m,b=e*Math.tan(b*Math.PI/360);m=-b;return THREE.Matrix4.makeFrustum(m*c,b*c,m,b,e,f)};
- THREE.Matrix4.makeOrtho=function(b,c,e,f,m,h){var k,n,p,u;k=new THREE.Matrix4;n=c-b;p=e-f;u=h-m;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((c+b)/n);k.n21=0;k.n22=2/p;k.n23=0;k.n24=-((e+f)/p);k.n31=0;k.n32=0;k.n33=-2/u;k.n34=-((h+m)/u);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.id=THREE.Object3DCount++;this.name="";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(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
- -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this,e=this.children.indexOf(b);if(e!==-1){b.parent=void 0;for(this.children.splice(e,1);c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeChildRecurse(b)}},getChildByName:function(b,c){var e,f,m;e=0;for(f=this.children.length;e<f;e++){m=this.children[e];if(m.name===
- b)return m;if(c&&(m=m.getChildByName(b,c),m!==void 0))return m}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&
- this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add().");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove().");
- this.remove(b)}};THREE.Object3DCount=0;
- THREE.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,h=b.z+b.w,m=e.z+e.w,k=-b.z+b.w,n=-e.z+e.w;return h>=0&&m>=0&&k>=0&&n>=0?!0:h<0&&m<0||k<0&&n<0?!1:(h<0?c=Math.max(c,h/(h-m)):m<0&&(f=Math.min(f,h/(h-m))),k<0?c=Math.max(c,k/(k-n)):n<0&&(f=Math.min(f,k/(k-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,m,h=[],k,n,p=[],u,w,t=[],x,v=[],z,y,B=[],C,E,F=[],G=[],M=[],P=new THREE.Vector4,L=new THREE.Vector4,
- A=new THREE.Matrix4,J=new THREE.Matrix4,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,O=new THREE.Vector4;this.projectVector=function(b,e){A.multiply(e.projectionMatrix,e.matrixWorldInverse);A.multiplyVector3(b);return b};this.unprojectVector=function(b,e){A.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));A.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;m=G.length=0;
- o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var t;if(!(t=!n.visible))if(t=n instanceof THREE.Mesh)if(t=n.frustumCulled){a:{t=void 0;for(var v=n.matrixWorld,u=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),p=0;p<6;p++)if(t=Z[p].x*v.n14+Z[p].y*v.n24+Z[p].z*v.n34+Z[p].w,t<=u){t=!1;break a}t=!0}t=!t}if(!t)t=h[m]=h[m]||new THREE.RenderableObject,m++,f=t,P.copy(n.position),A.multiplyVector3(P),f.object=n,f.z=P.z,G.push(f)}k&&G.sort(c);return G};this.projectScene=
- function(f,h,m){var o=h.near,G=h.far,T,P,aa,ha,ca,qa,fa,da,U,$,ga,ka,ua,la,N,ma,ra;E=y=x=w=M.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);A.multiply(h.projectionMatrix,h.matrixWorldInverse);Z[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);Z[1].set(A.n41+A.n11,A.n42+A.n12,A.n43+A.n13,A.n44+A.n14);Z[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);Z[3].set(A.n41-A.n21,A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);Z[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);
- Z[5].set(A.n41+A.n31,A.n42+A.n32,A.n43+A.n33,A.n44+A.n34);for(T=0;T<6;T++)U=Z[T],U.divideScalar(Math.sqrt(U.x*U.x+U.y*U.y+U.z*U.z));U=this.projectObjects(f,h,!0);f=0;for(T=U.length;f<T;f++)if($=U[f].object,$.visible)if(ga=$.matrixWorld,ka=$.matrixRotationWorld,ua=$.materials,la=$.overdraw,n=0,$ instanceof THREE.Mesh){N=$.geometry;ha=N.vertices;ma=N.faces;N=N.faceVertexUvs;P=0;for(aa=ha.length;P<aa;P++)k=b(),k.positionWorld.copy(ha[P].position),ga.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
- A.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<G;ha=0;for(P=ma.length;ha<P;ha++){aa=ma[ha];if(aa instanceof THREE.Face3)if(ca=p[aa.a],qa=p[aa.b],fa=p[aa.c],ca.visible&&qa.visible&&fa.visible&&($.doubleSided||$.flipSided!=(fa.positionScreen.x-ca.positionScreen.x)*(qa.positionScreen.y-ca.positionScreen.y)-(fa.positionScreen.y-ca.positionScreen.y)*(qa.positionScreen.x-ca.positionScreen.x)<
- 0))da=t[w]=t[w]||new THREE.RenderableFace3,w++,u=da,u.v1.copy(ca),u.v2.copy(qa),u.v3.copy(fa);else continue;else if(aa instanceof THREE.Face4)if(ca=p[aa.a],qa=p[aa.b],fa=p[aa.c],da=p[aa.d],ca.visible&&qa.visible&&fa.visible&&da.visible&&($.doubleSided||$.flipSided!=((da.positionScreen.x-ca.positionScreen.x)*(qa.positionScreen.y-ca.positionScreen.y)-(da.positionScreen.y-ca.positionScreen.y)*(qa.positionScreen.x-ca.positionScreen.x)<0||(qa.positionScreen.x-fa.positionScreen.x)*(da.positionScreen.y-
- fa.positionScreen.y)-(qa.positionScreen.y-fa.positionScreen.y)*(da.positionScreen.x-fa.positionScreen.x)<0)))ra=v[x]=v[x]||new THREE.RenderableFace4,x++,u=ra,u.v1.copy(ca),u.v2.copy(qa),u.v3.copy(fa),u.v4.copy(da);else continue;u.normalWorld.copy(aa.normal);ka.multiplyVector3(u.normalWorld);u.centroidWorld.copy(aa.centroid);ga.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);A.multiplyVector3(u.centroidScreen);fa=aa.vertexNormals;ca=0;for(qa=fa.length;ca<qa;ca++)da=u.vertexNormalsWorld[ca],
- da.copy(fa[ca]),ka.multiplyVector3(da);ca=0;for(qa=N.length;ca<qa;ca++)if(ra=N[ca][ha]){fa=0;for(da=ra.length;fa<da;fa++)u.uvs[ca][fa]=ra[fa]}u.meshMaterials=ua;u.faceMaterials=aa.materials;u.overdraw=la;u.z=u.centroidScreen.z;M.push(u)}}else if($ instanceof THREE.Line){J.multiply(A,ga);ha=$.geometry.vertices;ca=b();ca.positionScreen.copy(ha[0].position);J.multiplyVector4(ca.positionScreen);P=1;for(aa=ha.length;P<aa;P++)if(ca=b(),ca.positionScreen.copy(ha[P].position),J.multiplyVector4(ca.positionScreen),
- qa=p[n-2],I.copy(ca.positionScreen),O.copy(qa.positionScreen),e(I,O))I.multiplyScalar(1/I.w),O.multiplyScalar(1/O.w),ga=B[y]=B[y]||new THREE.RenderableLine,y++,z=ga,z.v1.positionScreen.copy(I),z.v2.positionScreen.copy(O),z.z=Math.max(I.z,O.z),z.materials=$.materials,M.push(z)}else if($ instanceof THREE.Particle&&(L.set($.matrixWorld.n14,$.matrixWorld.n24,$.matrixWorld.n34,1),A.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))ga=F[E]=F[E]||new THREE.RenderableParticle,E++,C=ga,C.x=L.x/L.w,C.y=L.y/L.w,C.z=
- L.z,C.rotation=$.rotation.z,C.scale.x=$.scale.x*Math.abs(C.x-(L.x+h.projectionMatrix.n11)/(L.w+h.projectionMatrix.n14)),C.scale.y=$.scale.y*Math.abs(C.y-(L.y+h.projectionMatrix.n22)/(L.w+h.projectionMatrix.n24)),C.materials=$.materials,M.push(C);m&&M.sort(c);return M}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
- THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,m=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-m),m=Math.sin(-m),h=Math.cos(e),e=Math.sin(e),k=b*c,n=f*m;this.w=k*h-n*e;this.x=k*e+n*h;this.y=f*c*h+b*m*e;this.z=b*m*h-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
- this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
- this.x,e=this.y,f=this.z,m=this.w,h=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+m*h+e*n-f*k;this.y=e*b+m*k+f*h-c*n;this.z=f*b+m*n+c*k-e*h;this.w=m*b-c*h-e*k-f*n;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,m=b.z,h=this.x,k=this.y,n=this.z,p=this.w,u=p*e+k*m-n*f,w=p*f+n*e-h*m,t=p*m+h*f-k*e,e=-h*
- e-k*f-n*m;c.x=u*p+e*-h+w*-n-t*-k;c.y=w*p+e*-k+t*-h-u*-n;c.z=t*p+e*-n+u*-k-w*-h;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var m=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(m)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var h=Math.acos(m),k=Math.sqrt(1-m*m);if(Math.abs(k)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;m=Math.sin((1-f)*h)/k;f=Math.sin(f*h)/k;e.w=b.w*m+c.w*f;e.x=b.x*m+c.x*f;e.y=b.y*m+c.y*f;e.z=b.z*m+c.z*f;return e};
- THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,m,h){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
- THREE.Face4=function(b,c,e,f,m,h,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=m instanceof THREE.Vector3?m:new THREE.Vector3;this.vertexNormals=m instanceof Array?m:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
- THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.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.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(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var e=0,f=this.vertices.length;e<f;e++)b.multiplyVector3(this.vertices[e].position);e=0;for(f=this.faces.length;e<f;e++){var m=this.faces[e];c.multiplyVector3(m.normal);for(var h=0,k=m.vertexNormals.length;h<k;h++)c.multiplyVector3(m.vertexNormals[h]);b.multiplyVector3(m.centroid)}},computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<
- c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
- e,f,m,h,k,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(m=this.faces.length;f<m;f++){h=this.faces[f];if(b&&h.vertexNormals.length){n.set(0,0,0);c=0;for(e=h.vertexNormals.length;c<e;c++)n.addSelf(h.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[h.a],e=this.vertices[h.b],k=this.vertices[h.c],n.sub(k.position,e.position),p.sub(c.position,e.position),n.crossSelf(p);n.isZero()||n.normalize();h.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
- Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof
- THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
- e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,m,o){n=b.vertices[e].position;p=b.vertices[c].position;u=b.vertices[f].position;w=k[h];t=k[m];x=k[o];v=p.x-n.x;z=u.x-n.x;y=p.y-n.y;B=u.y-n.y;C=p.z-n.z;E=u.z-n.z;F=t.u-w.u;G=x.u-w.u;M=t.v-w.v;P=x.v-w.v;L=1/(F*P-G*M);I.set((P*v-M*z)*L,(P*y-M*B)*L,(P*C-M*E)*L);O.set((F*z-G*v)*L,(F*B-G*y)*L,(F*E-G*C)*L);J[e].addSelf(I);J[c].addSelf(I);J[f].addSelf(I);Z[e].addSelf(O);
- Z[c].addSelf(O);Z[f].addSelf(O)}var c,e,f,m,h,k,n,p,u,w,t,x,v,z,y,B,C,E,F,G,M,P,L,A,J=[],Z=[],I=new THREE.Vector3,O=new THREE.Vector3,X=new THREE.Vector3,V=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)J[c]=new THREE.Vector3,Z[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var o=["a","b",
- "c","d"];c=0;for(e=this.faces.length;c<e;c++){h=this.faces[c];for(f=0;f<h.vertexNormals.length;f++)W.copy(h.vertexNormals[f]),m=h[o[f]],A=J[m],X.copy(A),X.subSelf(W.multiplyScalar(W.dot(A))).normalize(),V.cross(h.vertexNormals[f],A),m=V.dot(Z[m]),m=m<0?-1:1,h.vertexTangents[f]=new THREE.Vector4(X.x,X.y,X.z,m)}this.hasTangents=!0},computeBoundingBox:function(){var b;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
- this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
- b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},mergeVertices:function(){var b={},c=[],e=[],f,m=Math.pow(10,4),h,k;h=0;for(k=this.vertices.length;h<k;h++)f=this.vertices[h].position,f=[Math.round(f.x*m),Math.round(f.y*m),Math.round(f.z*m)].join("_"),b[f]===void 0?(b[f]=h,c.push(this.vertices[h]),
- e[h]=c.length-1):e[h]=e[b[f]];h=0;for(k=this.faces.length;h<k;h++){b=this.faces[h];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};THREE.GeometryCount=0;
- THREE.Spline=function(b){function c(b,e,c,f,h,m,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*m+b*h+e}this.points=b;var e=[],f={x:0,y:0,z:0},m,h,k,n,p,u,w,t,x;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){m=(this.points.length-1)*b;h=Math.floor(m);k=m-h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>this.points.length-2?h:h+1;e[3]=h>this.points.length-3?h:h+2;u=this.points[e[0]];w=this.points[e[1]];
- t=this.points[e[2]];x=this.points[e[3]];n=k*k;p=k*n;f.x=c(u.x,w.x,t.x,x.x,k,n,p);f.y=c(u.y,w.y,t.y,x.y,k,n,p);f.z=c(u.z,w.z,t.z,x.z,k,n,p);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,h=new THREE.Vector3,m=new THREE.Vector3,k=[],n=0;k[0]=0;b||(b=100);c=this.points.length*b;h.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),m.copy(position),
- n+=m.distanceTo(h),h.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=n,f=e);k[k.length]=n;return{chunks:k,total:n}};this.reparametrizeByArcLength=function(b){var e,c,f,h,m,k,n=[],t=new THREE.Vector3,u=this.getLength();n.push(t.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=u.chunks[e]-u.chunks[e-1];k=Math.ceil(b*c/u.total);h=(e-1)/(this.points.length-1);m=e/(this.points.length-1);for(c=1;c<k-1;c++)f=h+c*(1/k)*(m-h),position=this.getPoint(f),n.push(t.copy(position).clone());
- n.push(t.copy(this.points[e]).clone())}this.points=n}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,m){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e!==void 0?e:0.1;this.far=f!==void 0?f:2E3;this.target=m||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
- THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
- THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
- THREE.Camera.prototype.setViewOffset=function(b,c,e,f,m,h){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=m;this.height=h;this.updateProjectionMatrix()};
- THREE.Camera.prototype.update=function(b,c,e){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
- !1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};THREE.OrthoCamera=function(b,c,e,f,m,h,k){THREE.Camera.call(this,45,1,m,h,k);this.left=b;this.right=c;this.top=e;this.bottom=f;this.updateProjectionMatrix()};THREE.OrthoCamera.prototype=new THREE.Camera;THREE.OrthoCamera.prototype.constructor=THREE.OrthoCamera;
- THREE.OrthoCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
- THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,0,0);this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0};
- THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,e,f){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c!==void 0?c:1;this.distance=e!==void 0?e:0;this.castShadow=f!==void 0?f:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
- THREE.Material=function(b){this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.depthWrite=b.depthWrite!==void 0?b.depthWrite:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=
- b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:0;this.alphaTest=b.alphaTest!==void 0?b.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(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
- THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:
- !0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:
- !1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
- THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?
- b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?
- b.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
- THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;
- this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.fog=b.fog!==void 0?b.fog:!0;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=
- b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
- THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
- THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
- THREE.MeshShaderMaterial=function(b){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(b)};
- THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.fog=b.fog!==void 0?b.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
- THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
- THREE.ShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=b.fog!==
- void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
- THREE.Texture=function(b,c,e,f,m,h){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=m!==void 0?m: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 b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};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(b,c,e,f,m,h,k,n,p){THREE.Texture.call(this,null,m,h,k,n,p);this.image={data:b,width:c,height:e};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
- THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
- THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
- THREE.Line.prototype.constructor=THREE.Line;
- THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var e=0;e<this.geometry.morphTargets.length;e++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[e].name]=
- e}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
- THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,m=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<m;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.skinMatrix,c,e):b.update(this.matrixWorld,!0,e)}else for(f=0;f<m;f++)this.children[f].update(this.skinMatrix,
- c,e)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
- THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var e,f,m,h,k,n;if(this.geometry.bones!==void 0){for(e=0;e<this.geometry.bones.length;e++)m=this.geometry.bones[e],h=m.pos,k=m.rotq,n=m.scl,f=this.addBone(),f.name=m.name,f.position.set(h[0],h[1],h[2]),f.quaternion.set(k[0],k[1],k[2],k[3]),f.useQuaternion=!0,n!==void 0?f.scale.set(n[0],n[1],n[2]):f.scale.set(1,1,1);for(e=0;e<this.bones.length;e++)m=this.geometry.bones[e],
- f=this.bones[e],m.parent===-1?this.addChild(f):this.bones[m.parent].addChild(f);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
- THREE.SkinnedMesh.prototype.update=function(b,c,e){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var f,m=this.children.length;for(f=0;f<m;f++)b=this.children[f],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,e):b.update(this.matrixWorld,c,e);e=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<e;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
- c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
- THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],e=0;e<this.bones.length;e++)b=this.bones[e],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,e*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(b=0;b<this.geometry.skinIndices.length;b++){var e=this.geometry.vertices[b].position,m=this.geometry.skinIndices[b].x,h=this.geometry.skinIndices[b].y;f=new THREE.Vector3(e.x,
- e.y,e.z);this.geometry.skinVerticesA.push(c[m].multiplyVector3(f));f=new THREE.Vector3(e.x,e.y,e.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(f));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(e=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=e,this.geometry.skinWeights[b].y+=e)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
- THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),e=0;e<this.LODs.length;e++)if(c<this.LODs[e].visibleAtDistance)break;this.LODs.splice(e,0,{visibleAtDistance:c,object3D:b});this.add(b)};
- THREE.LOD.prototype.update=function(b,c,e){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=e.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(b>=this.LODs[f].visibleAtDistance)this.LODs[f-1].object3D.visible=!1,
- this.LODs[f].object3D.visible=!0;else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};
- THREE.Sprite=function(b){THREE.Object3D.call(this);this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map);this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:
- !this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;THREE.Sprite.prototype.supr=THREE.Object3D.prototype;
- THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
- THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
- THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=this.fog=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.add=function(b){this.supr.add.call(this,b);this.addChildRecurse(b)};
- THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1){this.objects.push(b);this.__objectsAdded.push(b);var c=this.__objectsRemoved.indexOf(b);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.remove=function(b){this.supr.remove.call(this,b);this.removeChildRecurse(b)};
- THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b),c=this.__objectsAdded.indexOf(b),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
- THREE.Scene.prototype.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add().");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add().");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove().");this.remove(b)};
- THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove().");this.remove(b)};THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove().");this.remove(b)};THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=e!==void 0?e:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,m,h;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;m=e/2;h=f/2};this.render=function(e,f){var p,u,w,t,x,v,z,y;b=c.projectScene(e,f);p=0;for(u=b.length;p<u;p++)if(x=b[p],x instanceof THREE.RenderableParticle){z=x.x*m+m;y=x.y*h+h;w=0;for(t=x.material.length;w<t;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=y+"px"}}};
- THREE.CanvasRenderer=function(b){function c(b){if(B!=b)v.globalAlpha=B=b}function e(b){if(C!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}C=b}}function f(b){if(E!=b)v.strokeStyle=E=b}function m(b){if(F!=b)v.fillStyle=F=b}var h=this,k=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
- u,w,t,x,v=p.getContext("2d"),z=new THREE.Color(0),y=0,B=1,C=0,E=null,F=null,G=null,M=null,P=null,L,A,J,Z,I=new THREE.RenderableVertex,O=new THREE.RenderableVertex,X,V,W,o,ea,T,na,aa,ha,ca,qa,fa,da=new THREE.Color(0),U=new THREE.Color(0),$=new THREE.Color(0),ga=new THREE.Color(0),ka=new THREE.Color(0),ua=[],la,N,ma,ra,wa,Da,Ea,Aa,Ca,Ga,K=new THREE.Rectangle,R=new THREE.Rectangle,S=new THREE.Rectangle,ja=!1,oa=new THREE.Color,ia=new THREE.Color,sa=new THREE.Color,va=new THREE.Color,pa=new THREE.Vector3,
- xa,ya,Ka,Ba,Ha,Y,b=16;xa=document.createElement("canvas");xa.width=xa.height=2;ya=xa.getContext("2d");ya.fillStyle="rgba(0,0,0,1)";ya.fillRect(0,0,2,2);Ka=ya.getImageData(0,0,2,2);Ba=Ka.data;Ha=document.createElement("canvas");Ha.width=Ha.height=b;Y=Ha.getContext("2d");Y.translate(-b/2,-b/2);Y.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){u=b;w=e;t=Math.floor(u/2);x=Math.floor(w/2);p.width=u;
- p.height=w;K.set(-t,-x,t,x);R.set(-t,-x,t,x);B=1;C=0;P=M=G=F=E=null};this.setClearColor=function(b,e){z.copy(b);y=e;R.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){z.setHex(b);y=e;R.set(-t,-x,t,x)};this.clear=function(){v.setTransform(1,0,0,-1,t,x);R.isEmpty()||(R.minSelf(K),R.inflate(2),y<1&&v.clearRect(Math.floor(R.getX()),Math.floor(R.getY()),Math.floor(R.getWidth()),Math.floor(R.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),m("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*
- 255)+","+y+")"),v.fillRect(Math.floor(R.getX()),Math.floor(R.getY()),Math.floor(R.getWidth()),Math.floor(R.getHeight()))),R.empty())};this.render=function(b,u){function p(b){var e,c,f,h=b.lights;ia.setRGB(0,0,0);sa.setRGB(0,0,0);va.setRGB(0,0,0);b=0;for(e=h.length;b<e;b++)c=h[b],f=c.color,c instanceof THREE.AmbientLight?(ia.r+=f.r,ia.g+=f.g,ia.b+=f.b):c instanceof THREE.DirectionalLight?(sa.r+=f.r,sa.g+=f.g,sa.b+=f.b):c instanceof THREE.PointLight&&(va.r+=f.r,va.g+=f.g,va.b+=f.b)}function w(b,e,c,
- f){var h,m,k,o,n=b.lights,b=0;for(h=n.length;b<h;b++)m=n[b],k=m.color,m instanceof THREE.DirectionalLight?(o=c.dot(m.position),o<=0||(o*=m.intensity,f.r+=k.r*o,f.g+=k.g*o,f.b+=k.b*o)):m instanceof THREE.PointLight&&(o=c.dot(pa.sub(m.position,e).normalize()),o<=0||(o*=m.distance==0?1:1-Math.min(e.distanceTo(m.position)/m.distance,1),o!=0&&(o*=m.intensity,f.r+=k.r*o,f.g+=k.g*o,f.b+=k.b*o)))}function y(b,h,k){c(k.opacity);e(k.blending);var o,n,u,p,Fa,w;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)p=
- k.map.image,Fa=p.width>>1,w=p.height>>1,k=h.scale.x*t,u=h.scale.y*x,o=k*Fa,n=u*w,S.set(b.x-o,b.y-n,b.x+o,b.y+n),K.intersects(S)&&(v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(k,-u),v.translate(-Fa,-w),v.drawImage(p,0,0),v.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(o=h.scale.x*t,n=h.scale.y*x,S.set(b.x-o,b.y-n,b.x+o,b.y+n),K.intersects(S)&&(f(k.color.getContextStyle()),m(k.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(o,n),k.program(v),
- v.restore()))}function z(b,h,k,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(h.positionScreen.x,h.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)v.lineWidth=G=b;b=m.linecap;if(M!=b)v.lineCap=M=b;b=m.linejoin;if(P!=b)v.lineJoin=P=b;f(m.color.getContextStyle());v.stroke();S.inflate(m.linewidth*2)}}function B(b,f,m,k,n,t,p,v,x){h.info.render.vertices+=3;h.info.render.faces++;c(v.opacity);e(v.blending);
- X=b.positionScreen.x;V=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=m.positionScreen.x;T=m.positionScreen.y;E(X,V,W,o,ea,T);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(ra=p.uvs[0],ab(X,V,W,o,ea,T,ra[k].u,ra[k].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,pa.copy(p.vertexNormalsWorld[0]),wa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
- Da=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Ga=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(X,V,W,o,ea,T,wa,Da,Ea,Aa,Ca,Ga,v.envMap)}else v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&
- (v.map.mapping instanceof THREE.UVMapping&&(ra=p.uvs[0],ab(X,V,W,o,ea,T,ra[k].u,ra[k].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,v.map)),e(THREE.SubtractiveBlending)),ja?!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(U.r=$.r=ga.r=ia.r,U.g=$.g=ga.g=ia.g,U.b=$.b=ga.b=ia.b,w(x,p.v1.positionWorld,p.vertexNormalsWorld[0],U),w(x,p.v2.positionWorld,p.vertexNormalsWorld[1],$),w(x,p.v3.positionWorld,p.vertexNormalsWorld[2],ga),U.r=Math.max(0,Math.min(v.color.r*U.r,1)),U.g=Math.max(0,
- Math.min(v.color.g*U.g,1)),U.b=Math.max(0,Math.min(v.color.b*U.b,1)),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*$.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),ka.r=($.r+ga.r)*0.5,ka.g=($.g+ga.g)*0.5,ka.b=($.b+ga.b)*0.5,ma=Ya(U,$,ga,ka),Va(X,V,W,o,ea,T,0,0,1,0,0,1,ma)):(oa.r=ia.r,oa.g=ia.g,oa.b=ia.b,w(x,p.centroidWorld,p.normalWorld,
- oa),da.r=Math.max(0,Math.min(v.color.r*oa.r,1)),da.g=Math.max(0,Math.min(v.color.g*oa.g,1)),da.b=Math.max(0,Math.min(v.color.b*oa.b,1)),v.wireframe?Na(da,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(da)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(v.color);else if(v instanceof THREE.MeshDepthMaterial)la=u.near,N=u.far,U.r=U.g=U.b=1-Ra(b.positionScreen.z,la,N),$.r=$.g=$.b=1-Ra(f.positionScreen.z,la,N),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,
- la,N),ka.r=($.r+ga.r)*0.5,ka.g=($.g+ga.g)*0.5,ka.b=($.b+ga.b)*0.5,ma=Ya(U,$,ga,ka),Va(X,V,W,o,ea,T,0,0,1,0,0,1,ma);else if(v instanceof THREE.MeshNormalMaterial)da.r=Wa(p.normalWorld.x),da.g=Wa(p.normalWorld.y),da.b=Wa(p.normalWorld.z),v.wireframe?Na(da,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Oa(da)}function C(b,f,m,k,n,t,v,p,x){h.info.render.vertices+=4;h.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)B(b,f,k,0,1,3,v,p,x),B(n,m,t,1,2,3,v,p,x);else if(X=b.positionScreen.x,
- V=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=m.positionScreen.x,T=m.positionScreen.y,na=k.positionScreen.x,aa=k.positionScreen.y,ha=n.positionScreen.x,ca=n.positionScreen.y,qa=t.positionScreen.x,fa=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)F(X,V,W,o,ea,T,na,aa),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)ja?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
- 4?(U.r=$.r=ga.r=ka.r=ia.r,U.g=$.g=ga.g=ka.g=ia.g,U.b=$.b=ga.b=ka.b=ia.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],U),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],$),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],ga),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],ka),U.r=Math.max(0,Math.min(p.color.r*U.r,1)),U.g=Math.max(0,Math.min(p.color.g*U.g,1)),U.b=Math.max(0,Math.min(p.color.b*U.b,1)),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*
- $.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),ka.r=Math.max(0,Math.min(p.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(p.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(p.color.b*ka.b,1)),ma=Ya(U,$,ga,ka),E(X,V,W,o,na,aa),Va(X,V,W,o,na,aa,0,0,1,0,0,1,ma),E(ha,ca,ea,T,qa,fa),Va(ha,ca,ea,T,qa,fa,1,0,1,1,0,1,ma)):(oa.r=ia.r,oa.g=ia.g,oa.b=ia.b,w(x,v.centroidWorld,v.normalWorld,oa),da.r=Math.max(0,Math.min(p.color.r*oa.r,
- 1)),da.g=Math.max(0,Math.min(p.color.g*oa.g,1)),da.b=Math.max(0,Math.min(p.color.b*oa.b,1)),F(X,V,W,o,ea,T,na,aa),p.wireframe?Na(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(da)):(F(X,V,W,o,ea,T,na,aa),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)da.r=Wa(v.normalWorld.x),da.g=Wa(v.normalWorld.y),da.b=Wa(v.normalWorld.z),F(X,V,W,o,ea,T,na,aa),p.wireframe?Na(da,p.wireframeLinewidth,
- p.wireframeLinecap,p.wireframeLinejoin):Oa(da);else if(p instanceof THREE.MeshDepthMaterial)la=u.near,N=u.far,U.r=U.g=U.b=1-Ra(b.positionScreen.z,la,N),$.r=$.g=$.b=1-Ra(f.positionScreen.z,la,N),ga.r=ga.g=ga.b=1-Ra(k.positionScreen.z,la,N),ka.r=ka.g=ka.b=1-Ra(m.positionScreen.z,la,N),ma=Ya(U,$,ga,ka),E(X,V,W,o,na,aa),Va(X,V,W,o,na,aa,0,0,1,0,0,1,ma),E(ha,ca,ea,T,qa,fa),Va(ha,ca,ea,T,qa,fa,1,0,1,1,0,1,ma)}function E(b,e,c,f,h,m){v.beginPath();v.moveTo(b,e);v.lineTo(c,f);v.lineTo(h,m);v.lineTo(b,e);
- v.closePath()}function F(b,e,c,f,h,m,k,o){v.beginPath();v.moveTo(b,e);v.lineTo(c,f);v.lineTo(h,m);v.lineTo(k,o);v.lineTo(b,e);v.closePath()}function Na(b,e,c,h){if(G!=e)v.lineWidth=G=e;if(M!=c)v.lineCap=M=c;if(P!=h)v.lineJoin=P=h;f(b.getContextStyle());v.stroke();S.inflate(e*2)}function Oa(b){m(b.getContextStyle());v.fill()}function ab(b,e,c,f,h,k,o,n,p,t,u,Fa,x){if(x.image.width!=0){if(x.needsUpdate==!0||ua[x.id]==void 0){var w=x.wrapS==THREE.RepeatWrapping,y=x.wrapT==THREE.RepeatWrapping;ua[x.id]=
- v.createPattern(x.image,w&&y?"repeat":w&&!y?"repeat-x":!w&&y?"repeat-y":"no-repeat");x.needsUpdate=!1}m(ua[x.id]);var w=x.offset.x/x.repeat.x,y=x.offset.y/x.repeat.y,K=(x.image.width-1)*x.repeat.x,x=(x.image.height-1)*x.repeat.y,o=(o+w)*K,n=(n+y)*x,p=(p+w)*K,t=(t+y)*x,u=(u+w)*K,Fa=(Fa+y)*x;c-=b;f-=e;h-=b;k-=e;p-=o;t-=n;u-=o;Fa-=n;w=1/(p*Fa-u*t);x=(Fa*c-t*h)*w;t=(Fa*f-t*k)*w;c=(p*h-u*c)*w;f=(p*k-u*f)*w;b=b-x*o-c*n;e=e-t*o-f*n;v.save();v.transform(x,t,c,f,b,e);v.fill();v.restore()}}function Va(b,e,
- c,f,h,m,k,o,n,p,t,u,Fa){var x,w;x=Fa.width-1;w=Fa.height-1;k*=x;o*=w;n*=x;p*=w;t*=x;u*=w;c-=b;f-=e;h-=b;m-=e;n-=k;p-=o;t-=k;u-=o;w=1/(n*u-t*p);x=(u*c-p*h)*w;p=(u*f-p*m)*w;c=(n*h-t*c)*w;f=(n*m-t*f)*w;b=b-x*k-c*o;e=e-p*k-f*o;v.save();v.transform(x,p,c,f,b,e);v.clip();v.drawImage(Fa,0,0);v.restore()}function Ya(b,e,c,f){var h=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);Ba[0]=h<0?
- 0:h>255?255:h;Ba[1]=k<0?0:k>255?255:k;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=e<0?0:e>255?255:e;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=c<0?0:c>255?255:c;Ba[12]=t<0?0:t>255?255:t;Ba[13]=v<0?0:v>255?255:v;Ba[14]=f<0?0:f>255?255:f;ya.putImageData(Ka,0,0);Y.drawImage(xa,0,0);return Ha}function Ra(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(b,e){var c=e.x-b.x,f=e.y-b.y,h=c*c+f*f;h!=0&&(h=1/Math.sqrt(h),
- c*=h,f*=h,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Za,bb,ta,Ia,Qa,Xa,$a,za;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,x);h.info.render.vertices=0;h.info.render.faces=0;k=n.projectScene(b,u,this.sortElements);(ja=b.lights.length>0)&&p(b);Za=0;for(bb=k.length;Za<bb;Za++){ta=k[Za];S.empty();if(ta instanceof THREE.RenderableParticle){L=ta;L.x*=t;L.y*=x;Ia=0;for(Qa=ta.materials.length;Ia<Qa;)za=ta.materials[Ia++],za.opacity!=0&&y(L,ta,za,b)}else if(ta instanceof THREE.RenderableLine){if(L=ta.v1,A=ta.v2,
- L.positionScreen.x*=t,L.positionScreen.y*=x,A.positionScreen.x*=t,A.positionScreen.y*=x,S.addPoint(L.positionScreen.x,L.positionScreen.y),S.addPoint(A.positionScreen.x,A.positionScreen.y),K.intersects(S)){Ia=0;for(Qa=ta.materials.length;Ia<Qa;)za=ta.materials[Ia++],za.opacity!=0&&z(L,A,ta,za,b)}}else if(ta instanceof THREE.RenderableFace3){if(L=ta.v1,A=ta.v2,J=ta.v3,L.positionScreen.x*=t,L.positionScreen.y*=x,A.positionScreen.x*=t,A.positionScreen.y*=x,J.positionScreen.x*=t,J.positionScreen.y*=x,
- ta.overdraw&&(Pa(L.positionScreen,A.positionScreen),Pa(A.positionScreen,J.positionScreen),Pa(J.positionScreen,L.positionScreen)),S.add3Points(L.positionScreen.x,L.positionScreen.y,A.positionScreen.x,A.positionScreen.y,J.positionScreen.x,J.positionScreen.y),K.intersects(S)){Ia=0;for(Qa=ta.meshMaterials.length;Ia<Qa;)if(za=ta.meshMaterials[Ia++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=ta.faceMaterials.length;Xa<$a;)(za=ta.faceMaterials[Xa++])&&za.opacity!=0&&B(L,A,J,0,1,2,ta,za,b)}else za.opacity!=
- 0&&B(L,A,J,0,1,2,ta,za,b)}}else if(ta instanceof THREE.RenderableFace4&&(L=ta.v1,A=ta.v2,J=ta.v3,Z=ta.v4,L.positionScreen.x*=t,L.positionScreen.y*=x,A.positionScreen.x*=t,A.positionScreen.y*=x,J.positionScreen.x*=t,J.positionScreen.y*=x,Z.positionScreen.x*=t,Z.positionScreen.y*=x,I.positionScreen.copy(A.positionScreen),O.positionScreen.copy(Z.positionScreen),ta.overdraw&&(Pa(L.positionScreen,A.positionScreen),Pa(A.positionScreen,Z.positionScreen),Pa(Z.positionScreen,L.positionScreen),Pa(J.positionScreen,
- I.positionScreen),Pa(J.positionScreen,O.positionScreen)),S.addPoint(L.positionScreen.x,L.positionScreen.y),S.addPoint(A.positionScreen.x,A.positionScreen.y),S.addPoint(J.positionScreen.x,J.positionScreen.y),S.addPoint(Z.positionScreen.x,Z.positionScreen.y),K.intersects(S))){Ia=0;for(Qa=ta.meshMaterials.length;Ia<Qa;)if(za=ta.meshMaterials[Ia++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=ta.faceMaterials.length;Xa<$a;)(za=ta.faceMaterials[Xa++])&&za.opacity!=0&&C(L,A,J,Z,I,O,ta,za,b)}else za.opacity!=
- 0&&C(L,A,J,Z,I,O,ta,za,b)}R.addRectangle(S)}v.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function b(b,e,c){var f,h,k,m;f=0;for(h=b.lights.length;f<h;f++)k=b.lights[f],k instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(k.position)*k.intensity,m>0&&(c.r+=k.color.r*m,c.g+=k.color.g*m,c.b+=k.color.b*m)):k instanceof THREE.PointLight&&(Z.sub(k.position,e.centroidWorld),Z.normalize(),m=e.normalWorld.dot(Z)*k.intensity,m>0&&(c.r+=k.color.r*m,c.g+=k.color.g*m,c.b+=k.color.b*m))}function c(e,c,k,o,n,t){h.info.render.vertices+=3;h.info.render.faces++;X=f(V++);
- X.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?F?(M.r=P.r,M.g=P.g,M.b=P.b,b(t,o,M),G.r=Math.max(0,Math.min(n.color.r*M.r,1)),G.g=Math.max(0,Math.min(n.color.g*M.g,1)),G.b=Math.max(0,Math.min(n.color.b*M.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(J=1-n.__2near/(n.__farPlusNear-
- o.z*n.__farMinusNear),G.setRGB(J,J,J)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(m(o.normalWorld.x),m(o.normalWorld.y),m(o.normalWorld.z));n.wireframe?X.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):X.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(X)}function e(e,c,k,o,n,t,v){h.info.render.vertices+=
- 4;h.info.render.faces++;X=f(V++);X.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?F?(M.r=P.r,M.g=P.g,M.b=P.b,b(v,n,M),G.r=Math.max(0,Math.min(t.color.r*M.r,1)),G.g=Math.max(0,Math.min(t.color.g*M.g,1)),G.b=Math.max(0,Math.min(t.color.b*M.b,1))):
- G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(J=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),G.setRGB(J,J,J)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(m(n.normalWorld.x),m(n.normalWorld.y),m(n.normalWorld.z));t.wireframe?X.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):X.setAttribute("style","fill: "+G.getContextStyle()+
- "; fill-opacity: "+t.opacity);p.appendChild(X)}function f(b){I[b]==null&&(I[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&I[b].setAttribute("shape-rendering","crispEdges"));return I[b]}function m(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var h=this,k=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,t,x,v,z,y,B,C=new THREE.Rectangle,E=new THREE.Rectangle,F=!1,G=new THREE.Color(16777215),M=new THREE.Color(16777215),P=new THREE.Color(0),
- L=new THREE.Color(0),A=new THREE.Color(0),J,Z=new THREE.Vector3,I=[],O=[],X,V,W,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){u=b;w=e;t=u/2;x=w/2;p.setAttribute("viewBox",-t+" "+-x+" "+u+" "+w);p.setAttribute("width",u);p.setAttribute("height",w);C.set(-t,-x,t,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
- this.render=function(b,f){var m,u,w,G,I,M,J,U;this.autoClear&&this.clear();h.info.render.vertices=0;h.info.render.faces=0;k=n.projectScene(b,f,this.sortElements);W=V=0;if(F=b.lights.length>0){J=b.lights;P.setRGB(0,0,0);L.setRGB(0,0,0);A.setRGB(0,0,0);m=0;for(u=J.length;m<u;m++)w=J[m],G=w.color,w instanceof THREE.AmbientLight?(P.r+=G.r,P.g+=G.g,P.b+=G.b):w instanceof THREE.DirectionalLight?(L.r+=G.r,L.g+=G.g,L.b+=G.b):w instanceof THREE.PointLight&&(A.r+=G.r,A.g+=G.g,A.b+=G.b)}m=0;for(u=k.length;m<
- u;m++)if(J=k[m],E.empty(),J instanceof THREE.RenderableParticle){v=J;v.x*=t;v.y*=-x;w=0;for(G=J.materials.length;w<G;)w++}else if(J instanceof THREE.RenderableLine){if(v=J.v1,z=J.v2,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(E)){w=0;for(G=J.materials.length;w<G;)if((U=J.materials[w++])&&U.opacity!=0){I=v;M=z;var $=W++;O[$]==null&&(O[$]=document.createElementNS("http://www.w3.org/2000/svg",
- "line"),o==0&&O[$].setAttribute("shape-rendering","crispEdges"));X=O[$];X.setAttribute("x1",I.positionScreen.x);X.setAttribute("y1",I.positionScreen.y);X.setAttribute("x2",M.positionScreen.x);X.setAttribute("y2",M.positionScreen.y);U instanceof THREE.LineBasicMaterial&&(X.setAttribute("style","fill: none; stroke: "+U.color.getContextStyle()+"; stroke-width: "+U.linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.linecap+"; stroke-linejoin: "+U.linejoin),p.appendChild(X))}}}else if(J instanceof
- THREE.RenderableFace3){if(v=J.v1,z=J.v2,y=J.v3,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(E)){w=0;for(G=J.meshMaterials.length;w<G;)if(U=J.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){I=0;for(M=J.faceMaterials.length;I<M;)(U=J.faceMaterials[I++])&&
- U.opacity!=0&&c(v,z,y,J,U,b)}else U&&U.opacity!=0&&c(v,z,y,J,U,b)}}else if(J instanceof THREE.RenderableFace4&&(v=J.v1,z=J.v2,y=J.v3,B=J.v4,v.positionScreen.x*=t,v.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,B.positionScreen.x*=t,B.positionScreen.y*=-x,E.addPoint(v.positionScreen.x,v.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),
- C.intersects(E))){w=0;for(G=J.meshMaterials.length;w<G;)if(U=J.meshMaterials[w++],U instanceof THREE.MeshFaceMaterial){I=0;for(M=J.faceMaterials.length;I<M;)(U=J.faceMaterials[I++])&&U.opacity!=0&&e(v,z,y,B,J,U,b)}else U&&U.opacity!=0&&e(v,z,y,B,J,U,b)}}};
- THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
- map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
- lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif",
- lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n}\n#endif\n}",
- lights_phong_pars_vertex:"#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",lights_phong_vertex:"#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",
- lights_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 ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_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 ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * 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 = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight;\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 + totalSpecular + ambientLightColor * ambient;",
- color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
- morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
- default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",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\nvec4 shadowColor = vec4( 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 * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * 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"};
- THREE.UniformsUtils={merge:function(b){var c,e,f,m={};for(c=0;c<b.length;c++)for(e in f=this.clone(b[c]),f)m[e]=f[e];return m},clone:function(b){var c,e,f,m={};for(c in b)for(e in m[c]={},b[c])f=b[c][e],m[c][e]=f instanceof THREE.Color||f instanceof THREE.Vector2||f instanceof THREE.Vector3||f instanceof THREE.Vector4||f instanceof THREE.Matrix4||f instanceof THREE.Texture?f.clone():f instanceof Array?f.slice():f;return m}};
- THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",
- value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
- value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:3,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.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap]),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,
- THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,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_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;\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( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
- "gl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_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 = normalize( 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_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_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,
- THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_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(b){function c(b,e,c){var f,h,k,m=b.vertices,n=m.length,p=b.colors,t=p.length,v=b.__vertexArray,u=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,y=b.__dirtyColors,K=b.__webglCustomAttributes,z,S;if(K)for(z in K)K[z].offset=0;if(c.sortParticles){Da.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)h=m[f].position,Ca.copy(h),Da.multiplyVector3(Ca),w[f]=[Ca.z,f];w.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)h=m[w[f][1]].position,k=f*3,v[k]=h.x,v[k+1]=h.y,v[k+2]=h.z;
- for(f=0;f<t;f++)k=f*3,color=p[w[f][1]],u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;if(K)for(z in K){f=K[z];p=f.value.length;for(k=0;k<p;k++){index=w[k][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")S=f.value[index];f.size===2?(f.array[t]=S.x,f.array[t+1]=S.y):f.size===3?f.type==="c"?(f.array[t]=S.r,f.array[t+1]=S.g,f.array[t+2]=S.b):(f.array[t]=S.x,f.array[t+1]=S.y,f.array[t+2]=S.z):(f.array[t]=
- S.x,f.array[t+1]=S.y,f.array[t+2]=S.z,f.array[t+3]=S.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)h=m[f].position,k=f*3,v[k]=h.x,v[k+1]=h.y,v[k+2]=h.z;if(y)for(f=0;f<t;f++)color=p[f],k=f*3,u[k]=color.r,u[k+1]=color.g,u[k+2]=color.b;if(K)for(z in K)if(f=K[z],f.__original.needsUpdate){p=f.value.length;for(k=0;k<p;k++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[k]}else{if(f.boundTo===void 0||f.boundTo==="vertices")S=f.value[k];f.size===2?(f.array[t]=
- S.x,f.array[t+1]=S.y):f.size===3?f.type==="c"?(f.array[t]=S.r,f.array[t+1]=S.g,f.array[t+2]=S.b):(f.array[t]=S.x,f.array[t+1]=S.y,f.array[t+2]=S.z):(f.array[t]=S.x,f.array[t+1]=S.y,f.array[t+2]=S.z,f.array[t+3]=S.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,v,e);if(y||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(K)for(z in K)if(f=K[z],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
- f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,h){f.program||W.initMaterial(f,e,c,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var k=0,m=W.maxMorphTargets;k<m;k++)h.__webglMorphTargetInfluences[k]=0}var n=!1,k=f.program,m=k.uniforms,t=f.uniforms;k!=T&&(o.useProgram(k),T=k,n=!0);if(f.id!=aa)aa=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(c&&f.fog)if(t.fogColor.value=c.color,c instanceof
- THREE.Fog)t.fogNear.value=c.near,t.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)t.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,v,u=0,w=0,x=0,y,S,z,B=Ga,C=B.directional.colors,R=B.directional.positions,E=B.point.colors,F=B.point.positions,G=B.point.distances,la=0,L=0,c=p=z=0,n=e.length;c<n;c++)if(p=e[c],v=p.color,y=p.position,S=p.intensity,z=p.distance,p instanceof THREE.AmbientLight)u+=v.r,w+=v.g,x+=v.b;else if(p instanceof
- THREE.DirectionalLight)z=la*3,C[z]=v.r*S,C[z+1]=v.g*S,C[z+2]=v.b*S,R[z]=y.x,R[z+1]=y.y,R[z+2]=y.z,la+=1;else if(p instanceof THREE.SpotLight)z=la*3,C[z]=v.r*S,C[z+1]=v.g*S,C[z+2]=v.b*S,v=1/y.length(),R[z]=y.x*v,R[z+1]=y.y*v,R[z+2]=y.z*v,la+=1;else if(p instanceof THREE.PointLight)p=L*3,E[p]=v.r*S,E[p+1]=v.g*S,E[p+2]=v.b*S,F[p]=y.x,F[p+1]=y.y,F[p+2]=y.z,G[L]=z,L+=1;c=la*3;for(n=C.length;c<n;c++)C[c]=0;c=L*3;for(n=E.length;c<n;c++)E[c]=0;B.point.length=L;B.directional.length=la;B.ambient[0]=u;B.ambient[1]=
- w;B.ambient[2]=x;e=Ga;t.enableLighting.value=e.directional.length+e.point.length;t.ambientLightColor.value=e.ambient;t.directionalLightColor.value=e.directional.colors;t.directionalLightDirection.value=e.directional.positions;t.pointLightColor.value=e.point.colors;t.pointLightPosition.value=e.point.positions;t.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=f.color,t.opacity.value=
- f.opacity,(t.map.texture=f.map)&&t.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),t.lightMap.texture=f.lightMap,t.envMap.texture=f.envMap,t.reflectivity.value=f.reflectivity,t.refractionRatio.value=f.refractionRatio,t.combine.value=f.combine,t.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)t.psColor.value=
- f.color,t.opacity.value=f.opacity,t.size.value=f.size,t.scale.value=K.height/2,t.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)t.ambient.value=f.ambient,t.specular.value=f.specular,t.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)t.mNear.value=b.near,t.mFar.value=b.far,t.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)t.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&t.shadowMatrix){for(e=0;e<pa.length;e++)t.shadowMatrix.value[e]=
- pa[e],t.shadowMap.texture[e]=W.shadowMap[e];t.shadowDarkness.value=W.shadowMapDarkness;t.shadowBias.value=W.shadowMapBias}e=f.uniformsList;t=0;for(c=e.length;t<c;t++)if(w=k.uniforms[e[t][1]])if(u=e[t][0],x=u.type,n=u.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
- n);else if(x=="v3v"){if(!u._array)u._array=new Float32Array(3*n.length);x=0;for(y=n.length;x<y;x++)B=x*3,u._array[B]=n[x].x,u._array[B+1]=n[x].y,u._array[B+2]=n[x].z;o.uniform3fv(w,u._array)}else if(x=="m4"){if(!u._array)u._array=new Float32Array(16);n.flattenToArray(u._array);o.uniformMatrix4fv(w,!1,u._array)}else if(x=="m4v"){if(!u._array)u._array=new Float32Array(16*n.length);x=0;for(y=n.length;x<y;x++)n[x].flattenToArrayOffset(u._array,x*16);o.uniformMatrix4fv(w,!1,u._array)}else if(x=="t"){if(o.uniform1i(w,
- n),w=u.texture)if(w.image instanceof Array&&w.image.length==6){if(u=w,u.image.length==6)if(u.needsUpdate){if(!u.image.__webglTextureCube)u.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,u.image[n]);A(o.TEXTURE_CUBE_MAP,u,u.image[0]);u.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}else w instanceof
- THREE.WebGLRenderTargetCube?(u=w,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,u.__webglTexture)):J(w,n)}else if(x=="tv"){if(!u._array){u._array=[];x=0;for(y=u.texture.length;x<y;x++)u._array[x]=n+x}o.uniform1iv(w,u._array);x=0;for(y=u.texture.length;x<y;x++)(w=u.texture[x])&&J(w,u._array[x])}(f instanceof THREE.ShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof
- THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Aa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Aa),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,h.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,h._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&
- m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,h._objectMatrixArray);return k}function f(b,c,f,h,k,m){if(h.opacity!=0){var n,f=e(b,c,f,h,m),b=f.attributes,c=!1,f=k.id*16777215+f.id;f!=ha&&(ha=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),
- o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var t=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;t<h.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=u[p[t]],t++;else{var p=[],v=-1,
- x=0,u=m.morphTargetInfluences,w,y=u.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<h.numSupportedMorphTargets;){for(w=0;w<y;w++)!p[w]&&u[w]>v&&(x=w,v=u[x]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[x]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=v;p[x]=1;v=-1;t++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=
- 0&&(f=k.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,
- k.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,
- o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe?(o.lineWidth(h.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount,
- o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=k.__webglFaceCount,W.info.render.faces+=k.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(m,0,k.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),W.info.render.calls++):
- m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),W.info.render.calls++)}}function m(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
- b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,t,p,u,v,x,w=b.count*3;for(x=0;x<w;x+=9)c=b.normalArray,f=c[x],h=c[x+1],k=c[x+2],m=c[x+3],t=c[x+4],u=c[x+5],n=c[x+6],p=c[x+7],v=c[x+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+u+v)/3,c[x]=f,c[x+1]=h,c[x+2]=k,c[x+3]=f,c[x+4]=h,c[x+5]=k,c[x+6]=f,c[x+7]=h,c[x+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
- 0,b.count);b.count=0}function h(b){if(qa!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),qa=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function k(b){U!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),U=b)}function n(b){$!=b&&(o.depthMask(b),$=b)}function p(b,e,c){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(ka!=e||ua!=c))o.polygonOffset(e,c),ka=e,ua=c}function u(b){wa[0].set(b.n41-
- b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);wa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);wa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);wa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);wa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);wa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=wa[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function w(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
- Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=wa[f].x*e.n14+wa[f].y*e.n24+wa[f].z*e.n34+wa[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?t(k,c):t(h,c)}function v(b){var e,c,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=
- 0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?t(o,h):t(n,h))}else(h=e)&&(h.transparent?t(o,h):t(n,h))}function z(b,e){return e.z-b.z}function y(b){var c,n,t,p=0,v,x,y,K,z=b.lights;va||(va=new THREE.Camera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=z.length;c<n;c++)if(t=z[c],t instanceof THREE.SpotLight&&t.castShadow){aa=-1;W.shadowMap[p]||(W.shadowMap[p]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
- {minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[p]||(pa[p]=new THREE.Matrix4);v=W.shadowMap[p];x=pa[p];va.position.copy(t.position);va.target.position.copy(t.target.position);va.update(void 0,!0);b.update(void 0,!1,va);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(va.projectionMatrix);x.multiplySelf(va.matrixWorldInverse);va.matrixWorldInverse.flattenToArray(Aa);va.projectionMatrix.flattenToArray(Ea);Da.multiply(va.projectionMatrix,va.matrixWorldInverse);
- u(Da);W.initWebGLObjects(b);Z(v);o.clearColor(1,1,1,1);W.clear();o.clearColor(oa.r,oa.g,oa.b,ia);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],K=y.object,K.visible&&K.castShadow?!(K instanceof THREE.Mesh)||!K.frustumCulled||w(K)?(K.matrixWorld.flattenToArray(K._objectMatrixArray),C(K,va,!1),y.render=!0):y.render=!1:y.render=!1;k(!0);L(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)K=y.object,buffer=y.buffer,h(K),y=K.customDepthMaterial?
- K.customDepthMaterial:K.geometry.morphTargets.length?Ka:ya,f(va,z,null,y,buffer,K);for(v=0;v<t;v++)y=b.__webglObjectsImmediate[v],K=y.object,K.visible&&K.castShadow&&(K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray),C(K,va,!1),h(K),program=e(va,z,null,ya,K),K.render(function(b){m(b,program,ya.shading)}));p++}}function B(b,e){var c,f,h;c=Y.attributes;var k=Y.uniforms,m=ra/ma,n,t=[],p=ma*0.5,v=ra*0.5,u=!0;o.useProgram(Y.program);T=Y.program;ha=U=da=-1;Ja||(o.enableVertexAttribArray(Y.attributes.position),
- o.enableVertexAttribArray(Y.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)if(h=b.__webglSprites[c],h.visible&&h.opacity!=0)h.useScreenCoordinates?
- h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(z);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(v-h.position.y)/v,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,
- 0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?ra:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),o.uniform3f(k.color,h.color.r,h.color.g,h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),
- h.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!h.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),L(h.blending),J(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask($)}function C(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function E(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<
- c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function F(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function G(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function M(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,f,h,k,m,n,o,t,p={},v=b.morphTargets!==void 0?
- b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=e(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:v}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:v})),
- b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function P(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=da){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,
- o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}da=b}}function A(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b,
- o.TEXTURE_MIN_FILTER,V(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,X(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,X(e.minFilter)))}function J(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?
- o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);A(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function Z(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=
- o.createRenderbuffer();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);A(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),A(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,V(b.format),b.width,b.height,
- 0,V(b.format),V(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,
- b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);
- o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=ma,b=ra,f=la,h=N);e!=na&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),na=e)}function I(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,
- null))}function O(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(e),null;return c}function X(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
- case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;
- case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var W=this,o,ea=[],T=null,
- na=null,aa=-1,ha=null,ca=0,qa=null,fa=null,da=null,U=null,$=null,ga=null,ka=null,ua=null,la=0,N=0,ma=0,ra=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},K=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
- R=b.stencil!==void 0?b.stencil:!0,S=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ja=b.antialias!==void 0?b.antialias:!1,oa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ia=b.clearAlpha!==void 0?b.clearAlpha:0,sa=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=K;this.sortObjects=this.autoClear=!0;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=!0;var va,pa=[],b=THREE.ShaderLib.depthRGBA,xa=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa,morphTargets:!0});ya._shadowPass=
- !0;Ka._shadowPass=!0;try{if(!(o=K.getContext("experimental-webgl",{antialias:ja,stencil:R,preserveDrawingBuffer:S})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);
- o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(oa.r,oa.g,oa.b,ia);this.context=o;var Ha=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,Y={};Y.vertices=new Float32Array(16);Y.faces=new Uint16Array(6);R=0;Y.vertices[R++]=-1;Y.vertices[R++]=-1;Y.vertices[R++]=0;Y.vertices[R++]=1;Y.vertices[R++]=1;Y.vertices[R++]=-1;Y.vertices[R++]=1;Y.vertices[R++]=1;Y.vertices[R++]=1;Y.vertices[R++]=1;Y.vertices[R++]=1;Y.vertices[R++]=0;Y.vertices[R++]=
- -1;Y.vertices[R++]=1;Y.vertices[R++]=0;R=Y.vertices[R++]=0;Y.faces[R++]=0;Y.faces[R++]=1;Y.faces[R++]=2;Y.faces[R++]=0;Y.faces[R++]=2;Y.faces[R++]=3;Y.vertexBuffer=o.createBuffer();Y.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,Y.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,Y.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,Y.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,Y.faces,o.STATIC_DRAW);Y.program=o.createProgram();o.attachShader(Y.program,O("fragment",THREE.ShaderLib.sprite.fragmentShader));
- o.attachShader(Y.program,O("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(Y.program);Y.attributes={};Y.uniforms={};Y.attributes.position=o.getAttribLocation(Y.program,"position");Y.attributes.uv=o.getAttribLocation(Y.program,"uv");Y.uniforms.uvOffset=o.getUniformLocation(Y.program,"uvOffset");Y.uniforms.uvScale=o.getUniformLocation(Y.program,"uvScale");Y.uniforms.rotation=o.getUniformLocation(Y.program,"rotation");Y.uniforms.scale=o.getUniformLocation(Y.program,"scale");Y.uniforms.alignment=
- o.getUniformLocation(Y.program,"alignment");Y.uniforms.color=o.getUniformLocation(Y.program,"color");Y.uniforms.map=o.getUniformLocation(Y.program,"map");Y.uniforms.opacity=o.getUniformLocation(Y.program,"opacity");Y.uniforms.useScreenCoordinates=o.getUniformLocation(Y.program,"useScreenCoordinates");Y.uniforms.affectedByDistance=o.getUniformLocation(Y.program,"affectedByDistance");Y.uniforms.screenPosition=o.getUniformLocation(Y.program,"screenPosition");Y.uniforms.modelViewMatrix=o.getUniformLocation(Y.program,
- "modelViewMatrix");Y.uniforms.projectionMatrix=o.getUniformLocation(Y.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,e){K.width=b;K.height=e;this.setViewport(0,0,K.width,K.height)};this.setViewport=function(b,e,c,f){la=b;N=e;ma=c;ra=f;o.viewport(la,N,ma,ra)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){oa.setHex(b);ia=e;o.clearColor(oa.r,oa.g,oa.b,ia)};
- this.setClearColor=function(b,e){oa.copy(b);ia=e;o.clearColor(oa.r,oa.g,oa.b,ia)};this.getClearColor=function(){return oa};this.getClearAlpha=function(){return ia};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=
- b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=
- 0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
- W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof
- THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,v,u;p=u=t=0;for(v=e.length;p<v;p++)m=e[p],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&t++;t+u<=sa?p=u:(p=Math.ceil(sa*u/(t+u)),t=sa-p);m={directional:p,point:t};t=u=0;for(p=e.length;t<p;t++)v=e[t],v instanceof THREE.SpotLight&&v.castShadow&&
- u++;var x=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)x=f.bones.length;var w;a:{p=b.fragmentShader;v=b.vertexShader;var t=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:m.directional,maxPointLights:m.point,maxBones:x,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,
- shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},y,f=[];n?f.push(n):(f.push(p),f.push(v));for(y in c)f.push(y),f.push(c[y]);n=f.join();y=0;for(f=ea.length;y<f;y++)if(ea[y].code==n){w=ea[y].program;break a}y=o.createProgram();f=[Ha?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?
- "#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
- m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",
- c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(y,O("fragment",m+p));o.attachShader(y,O("vertex",f+v));o.linkProgram(y);o.getProgramParameter(y,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(y,o.VALIDATE_STATUS)+", gl error ["+
- o.getError()+"]");y.uniforms={};y.attributes={};var K,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(K in t)f.push(K);K=f;f=0;for(t=K.length;f<t;f++)p=K[f],y.uniforms[p]=o.getUniformLocation(y,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(K=0;K<c.maxMorphTargets;K++)f.push("morphTarget"+K);for(w in e)f.push(w);
- w=f;K=0;for(e=w.length;K<e;K++)c=w[K],y.attributes[c]=o.getAttribLocation(y,c);y.id=ea.length;ea.push({program:y,code:n});W.info.memory.programs=ea.length;w=y}b.program=w;w=b.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),
- o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(k in b.attributes)w[k]!==void 0&&w[k]>=0&&o.enableVertexAttribArray(w[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)K="morphTarget"+k,w[K]>=0&&(o.enableVertexAttribArray(w[K]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,e,c,f){Z(b);
- b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);o.clear(b)};this.render=function(b,c,o,t){var K,S,R,E,F,G,A,la,J=b.lights,ja=b.fog;aa=-1;this.shadowMapEnabled&&y(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);Da.multiply(c.projectionMatrix,c.matrixWorldInverse);u(Da);this.initWebGLObjects(b);Z(o);
- (this.autoClear||t)&&this.clear();F=b.__webglObjects.length;for(t=0;t<F;t++)if(K=b.__webglObjects[t],A=K.object,A.visible)if(!(A instanceof THREE.Mesh)||!A.frustumCulled||w(A)){if(A.matrixWorld.flattenToArray(A._objectMatrixArray),C(A,c,!0),v(K),K.render=!0,this.sortObjects)K.object.renderDepth?K.z=K.object.renderDepth:(Ca.copy(A.position),Da.multiplyVector3(Ca),K.z=Ca.z)}else K.render=!1;else K.render=!1;this.sortObjects&&b.__webglObjects.sort(z);G=b.__webglObjectsImmediate.length;for(t=0;t<G;t++)K=
- b.__webglObjectsImmediate[t],A=K.object,A.visible&&(A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray),C(A,c,!0),x(K));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);L(b.overrideMaterial.blending);for(t=0;t<F;t++)if(K=b.__webglObjects[t],K.render)A=K.object,la=K.buffer,h(A),f(c,J,ja,b.overrideMaterial,la,A);for(t=0;t<G;t++)K=b.__webglObjectsImmediate[t],A=K.object,A.visible&&(h(A),S=e(c,J,ja,b.overrideMaterial,A),A.render(function(e){m(e,S,b.overrideMaterial.shading)}))}else{L(THREE.NormalBlending);
- for(t=F-1;t>=0;t--)if(K=b.__webglObjects[t],K.render){A=K.object;la=K.buffer;R=K.opaque;h(A);for(K=0;K<R.count;K++)E=R.list[K],k(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,J,ja,E,la,A)}for(t=0;t<G;t++)if(K=b.__webglObjectsImmediate[t],A=K.object,A.visible){R=K.opaque;h(A);for(K=0;K<R.count;K++)E=R.list[K],k(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),S=e(c,J,ja,E,A),A.render(function(b){m(b,S,E.shading)})}for(t=
- 0;t<F;t++)if(K=b.__webglObjects[t],K.render){A=K.object;la=K.buffer;R=K.transparent;h(A);for(K=0;K<R.count;K++)E=R.list[K],L(E.blending),k(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,J,ja,E,la,A)}for(t=0;t<G;t++)if(K=b.__webglObjectsImmediate[t],A=K.object,A.visible){R=K.transparent;h(A);for(K=0;K<R.count;K++)E=R.list[K],L(E.blending),k(E.depthTest),n(E.depthWrite),p(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),S=e(c,J,ja,E,A),A.render(function(b){m(b,
- S,E.shading)})}}b.__webglSprites.length&&B(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&I(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=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)for(h in k=e.geometry,k.geometryGroups==void 0&&M(k),k.geometryGroups){if(m=k.geometryGroups[h],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=
- o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,v=void 0,u=void 0,x=void 0,w=x=void 0,K=void 0,y=void 0,z=y=t=0,S=x=u=void 0,x=p=S=u=v=void 0,w=n.geometry,K=w.faces,S=
- m.faces,v=0,u=S.length;v<u;v++)x=S[v],x=K[x],x instanceof THREE.Face3?(t+=3,y+=1,z+=3):x instanceof THREE.Face4&&(t+=4,y+=2,z+=4);for(var v=m,u=n,B=S=K=void 0,R=void 0,B=void 0,x=[],K=0,S=u.materials.length;K<S;K++)if(B=u.materials[K],B instanceof THREE.MeshFaceMaterial){B=0;for(l=v.materials.length;B<l;B++)(R=v.materials[B])&&x.push(R)}else(R=B)&&x.push(R);v=x;m.__materials=v;a:{K=u=void 0;S=v.length;for(u=0;u<S;u++)if(K=v[u],K.map||K.lightMap||K instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{S=
- K=void 0;x=v.length;for(K=0;K<x;K++)if(S=v[K],!(S instanceof THREE.MeshBasicMaterial&&!S.envMap||S instanceof THREE.MeshDepthMaterial)){S=S&&S.shading!=void 0&&S.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}S=!1}a:{x=K=void 0;B=v.length;for(K=0;K<B;K++)if(x=v[K],x.vertexColors){x=x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(t*3);if(S)m.__normalArray=new Float32Array(t*3);if(w.hasTangents)m.__tangentArray=new Float32Array(t*4);if(x)m.__colorArray=new Float32Array(t*
- 3);if(u){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=
- new Uint16Array(z*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(K=m.numMorphTargets;w<K;w++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=S==THREE.SmoothShading;m.__uvType=u;m.__vertexColorType=x;m.__normalType=S;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=z*2;w=0;for(K=v.length;w<K;w++)if(u=v[w],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){x=u.attributes[a];
- S={};for(p in x)S[p]=x[p];if(!S.__webglInitialized||S.createUniqueBuffers)S.__webglInitialized=!0,y=1,S.type==="v2"?y=2:S.type==="v3"?y=3:S.type==="v4"?y=4:S.type==="c"&&(y=3),S.size=y,S.array=new Float32Array(t*y),S.buffer=o.createBuffer(),S.buffer.belongsToAttribute=a,x.needsUpdate=!0,S.__original=x;m.__webglCustomAttributes[a]=S}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof
- THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,
- m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=
- n.materials;z=y=p=void 0;p=0;for(y=n.materials.length;p<y;p++)if(z=n.materials[p],z.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=
- 4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(t*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],P(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
- e instanceof THREE.ParticleSystem?(k=e.geometry,P(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)G(f.__webglObjects,
- e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else e instanceof THREE.MarchingCubes&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=E(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||
- h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,z=!h.dynamic,p.__inittedArrays){var C=v=w=void 0,A=void 0,la=C=void 0,J=void 0,L=void 0,ja=void 0,I=R=B=x=S=K=u=void 0,ia=void 0,oa=void 0,H=A=ja=A=L=J=void 0,D=void 0,N=D=H=J=void 0,O=void 0,$=N=D=H=C=C=la=ja=A=N=D=H=O=N=D=H=O=N=D=H=void 0,ma=0,U=0,X=0,ra=0,T=0,Z=0,sa=0,Y=0,pa=0,Q=0,V=0,N=H=0,N=void 0,ga=p.__vertexArray,va=p.__uvArray,wa=p.__uv2Array,ka=p.__normalArray,ha=p.__tangentArray,da=p.__colorArray,
- ca=p.__skinVertexAArray,aa=p.__skinVertexBArray,ea=p.__skinIndexArray,fa=p.__skinWeightArray,qa=p.__morphTargetsArrays,ya=p.__webglCustomAttributes,D=void 0,ua=p.__faceArray,xa=p.__lineArray,Da=p.__needsSmoothNormals,K=p.__vertexColorType,u=p.__uvType,S=p.__normalType,na=k.geometry,Ea=na.__dirtyVertices,Ba=na.__dirtyElements,Aa=na.__dirtyUvs,Ha=na.__dirtyNormals,Ka=na.__dirtyTangents,Ca=na.__dirtyColors,Ga=na.__dirtyMorphTargets,Ja=na.vertices,cb=p.faces,fb=na.faces,db=na.faceVertexUvs[0],eb=na.faceVertexUvs[1],
- Sa=na.skinVerticesA,Ta=na.skinVerticesB,Ua=na.skinIndices,Ma=na.skinWeights,La=na.morphTargets;if(ya)for($ in ya)ya[$].offset=0,ya[$].offsetSrc=0;w=0;for(v=cb.length;w<v;w++)if(C=cb[w],A=fb[C],db&&(x=db[C]),eb&&(B=eb[C]),C=A.vertexNormals,la=A.normal,J=A.vertexColors,L=A.color,ja=A.vertexTangents,A instanceof THREE.Face3){if(Ea)R=Ja[A.a].position,I=Ja[A.b].position,ia=Ja[A.c].position,ga[U]=R.x,ga[U+1]=R.y,ga[U+2]=R.z,ga[U+3]=I.x,ga[U+4]=I.y,ga[U+5]=I.z,ga[U+6]=ia.x,ga[U+7]=ia.y,ga[U+8]=ia.z,U+=9;
- if(ya)for($ in ya)if(D=ya[$],D.__original.needsUpdate)H=D.offset,N=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[H]=D.value[A.a],D.array[H+1]=D.value[A.b],D.array[H+2]=D.value[A.c]):D.boundTo==="faces"?(N=D.value[N],D.array[H]=N,D.array[H+1]=N,D.array[H+2]=N,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[H]=D.value[N],D.array[H+1]=D.value[N+1],D.array[H+2]=D.value[N+2],D.offsetSrc+=3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(R=D.value[A.a],I=D.value[A.b],
- ia=D.value[A.c]):D.boundTo==="faces"?(ia=I=R=N=D.value[N],D.offsetSrc++):D.boundTo==="faceVertices"&&(R=D.value[N],I=D.value[N+1],ia=D.value[N+2],D.offsetSrc+=3),D.size===2?(D.array[H]=R.x,D.array[H+1]=R.y,D.array[H+2]=I.x,D.array[H+3]=I.y,D.array[H+4]=ia.x,D.array[H+5]=ia.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[H]=R.r,D.array[H+1]=R.g,D.array[H+2]=R.b,D.array[H+3]=I.r,D.array[H+4]=I.g,D.array[H+5]=I.b,D.array[H+6]=ia.r,D.array[H+7]=ia.g,D.array[H+8]=ia.b):(D.array[H]=R.x,D.array[H+1]=R.y,
- D.array[H+2]=R.z,D.array[H+3]=I.x,D.array[H+4]=I.y,D.array[H+5]=I.z,D.array[H+6]=ia.x,D.array[H+7]=ia.y,D.array[H+8]=ia.z),D.offset+=9):(D.array[H]=R.x,D.array[H+1]=R.y,D.array[H+2]=R.z,D.array[H+3]=R.w,D.array[H+4]=I.x,D.array[H+5]=I.y,D.array[H+6]=I.z,D.array[H+7]=I.w,D.array[H+8]=ia.x,D.array[H+9]=ia.y,D.array[H+10]=ia.z,D.array[H+11]=ia.w,D.offset+=12));if(Ga){H=0;for(D=La.length;H<D;H++)R=La[H].vertices[A.a].position,I=La[H].vertices[A.b].position,ia=La[H].vertices[A.c].position,N=qa[H],N[V]=
- R.x,N[V+1]=R.y,N[V+2]=R.z,N[V+3]=I.x,N[V+4]=I.y,N[V+5]=I.z,N[V+6]=ia.x,N[V+7]=ia.y,N[V+8]=ia.z;V+=9}if(Ma.length)H=Ma[A.a],D=Ma[A.b],N=Ma[A.c],fa[Q]=H.x,fa[Q+1]=H.y,fa[Q+2]=H.z,fa[Q+3]=H.w,fa[Q+4]=D.x,fa[Q+5]=D.y,fa[Q+6]=D.z,fa[Q+7]=D.w,fa[Q+8]=N.x,fa[Q+9]=N.y,fa[Q+10]=N.z,fa[Q+11]=N.w,H=Ua[A.a],D=Ua[A.b],N=Ua[A.c],ea[Q]=H.x,ea[Q+1]=H.y,ea[Q+2]=H.z,ea[Q+3]=H.w,ea[Q+4]=D.x,ea[Q+5]=D.y,ea[Q+6]=D.z,ea[Q+7]=D.w,ea[Q+8]=N.x,ea[Q+9]=N.y,ea[Q+10]=N.z,ea[Q+11]=N.w,H=Sa[A.a],D=Sa[A.b],N=Sa[A.c],ca[Q]=H.x,
- ca[Q+1]=H.y,ca[Q+2]=H.z,ca[Q+3]=1,ca[Q+4]=D.x,ca[Q+5]=D.y,ca[Q+6]=D.z,ca[Q+7]=1,ca[Q+8]=N.x,ca[Q+9]=N.y,ca[Q+10]=N.z,ca[Q+11]=1,H=Ta[A.a],D=Ta[A.b],N=Ta[A.c],aa[Q]=H.x,aa[Q+1]=H.y,aa[Q+2]=H.z,aa[Q+3]=1,aa[Q+4]=D.x,aa[Q+5]=D.y,aa[Q+6]=D.z,aa[Q+7]=1,aa[Q+8]=N.x,aa[Q+9]=N.y,aa[Q+10]=N.z,aa[Q+11]=1,Q+=12;if(Ca&&K)J.length==3&&K==THREE.VertexColors?(A=J[0],H=J[1],D=J[2]):D=H=A=L,da[pa]=A.r,da[pa+1]=A.g,da[pa+2]=A.b,da[pa+3]=H.r,da[pa+4]=H.g,da[pa+5]=H.b,da[pa+6]=D.r,da[pa+7]=D.g,da[pa+8]=D.b,pa+=9;if(Ka&&
- na.hasTangents)J=ja[0],L=ja[1],A=ja[2],ha[sa]=J.x,ha[sa+1]=J.y,ha[sa+2]=J.z,ha[sa+3]=J.w,ha[sa+4]=L.x,ha[sa+5]=L.y,ha[sa+6]=L.z,ha[sa+7]=L.w,ha[sa+8]=A.x,ha[sa+9]=A.y,ha[sa+10]=A.z,ha[sa+11]=A.w,sa+=12;if(Ha&&S)if(C.length==3&&Da)for(ja=0;ja<3;ja++)la=C[ja],ka[Z]=la.x,ka[Z+1]=la.y,ka[Z+2]=la.z,Z+=3;else for(ja=0;ja<3;ja++)ka[Z]=la.x,ka[Z+1]=la.y,ka[Z+2]=la.z,Z+=3;if(Aa&&x!==void 0&&u)for(ja=0;ja<3;ja++)C=x[ja],va[X]=C.u,va[X+1]=C.v,X+=2;if(Aa&&B!==void 0&&u)for(ja=0;ja<3;ja++)C=B[ja],wa[ra]=C.u,wa[ra+
- 1]=C.v,ra+=2;Ba&&(ua[T]=ma,ua[T+1]=ma+1,ua[T+2]=ma+2,T+=3,xa[Y]=ma,xa[Y+1]=ma+1,xa[Y+2]=ma,xa[Y+3]=ma+2,xa[Y+4]=ma+1,xa[Y+5]=ma+2,Y+=6,ma+=3)}else if(A instanceof THREE.Face4){if(Ea)R=Ja[A.a].position,I=Ja[A.b].position,ia=Ja[A.c].position,oa=Ja[A.d].position,ga[U]=R.x,ga[U+1]=R.y,ga[U+2]=R.z,ga[U+3]=I.x,ga[U+4]=I.y,ga[U+5]=I.z,ga[U+6]=ia.x,ga[U+7]=ia.y,ga[U+8]=ia.z,ga[U+9]=oa.x,ga[U+10]=oa.y,ga[U+11]=oa.z,U+=12;if(ya)for($ in ya)if(D=ya[$],D.__original.needsUpdate)H=D.offset,N=D.offsetSrc,D.size===
- 1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[H]=D.value[A.a],D.array[H+1]=D.value[A.b],D.array[H+2]=D.value[A.c],D.array[H+3]=D.value[A.d]):D.boundTo==="faces"?(N=D.value[N],D.array[H]=N,D.array[H+1]=N,D.array[H+2]=N,D.array[H+3]=N,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[H]=D.value[N],D.array[H+1]=D.value[N+1],D.array[H+2]=D.value[N+2],D.array[H+3]=D.value[N+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(R=D.value[A.a],I=D.value[A.b],ia=D.value[A.c],
- oa=D.value[A.d]):D.boundTo==="faces"?(oa=ia=I=R=N=D.value[N],D.offsetSrc++):D.boundTo==="faceVertices"&&(R=D.value[N],I=D.value[N+1],ia=D.value[N+2],oa=D.value[N+3],D.offsetSrc+=4),D.size===2?(D.array[H]=R.x,D.array[H+1]=R.y,D.array[H+2]=I.x,D.array[H+3]=I.y,D.array[H+4]=ia.x,D.array[H+5]=ia.y,D.array[H+6]=oa.x,D.array[H+7]=oa.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[H]=R.r,D.array[H+1]=R.g,D.array[H+2]=R.b,D.array[H+3]=I.r,D.array[H+4]=I.g,D.array[H+5]=I.b,D.array[H+6]=ia.r,D.array[H+7]=
- ia.g,D.array[H+8]=ia.b,D.array[H+9]=oa.r,D.array[H+10]=oa.g,D.array[H+11]=oa.b):(D.array[H]=R.x,D.array[H+1]=R.y,D.array[H+2]=R.z,D.array[H+3]=I.x,D.array[H+4]=I.y,D.array[H+5]=I.z,D.array[H+6]=ia.x,D.array[H+7]=ia.y,D.array[H+8]=ia.z,D.array[H+9]=oa.x,D.array[H+10]=oa.y,D.array[H+11]=oa.z),D.offset+=12):(D.array[H]=R.x,D.array[H+1]=R.y,D.array[H+2]=R.z,D.array[H+3]=R.w,D.array[H+4]=I.x,D.array[H+5]=I.y,D.array[H+6]=I.z,D.array[H+7]=I.w,D.array[H+8]=ia.x,D.array[H+9]=ia.y,D.array[H+10]=ia.z,D.array[H+
- 11]=ia.w,D.array[H+12]=oa.x,D.array[H+13]=oa.y,D.array[H+14]=oa.z,D.array[H+15]=oa.w,D.offset+=16));if(Ga){H=0;for(D=La.length;H<D;H++)R=La[H].vertices[A.a].position,I=La[H].vertices[A.b].position,ia=La[H].vertices[A.c].position,oa=La[H].vertices[A.d].position,N=qa[H],N[V]=R.x,N[V+1]=R.y,N[V+2]=R.z,N[V+3]=I.x,N[V+4]=I.y,N[V+5]=I.z,N[V+6]=ia.x,N[V+7]=ia.y,N[V+8]=ia.z,N[V+9]=oa.x,N[V+10]=oa.y,N[V+11]=oa.z;V+=12}if(Ma.length)H=Ma[A.a],D=Ma[A.b],N=Ma[A.c],O=Ma[A.d],fa[Q]=H.x,fa[Q+1]=H.y,fa[Q+2]=H.z,fa[Q+
- 3]=H.w,fa[Q+4]=D.x,fa[Q+5]=D.y,fa[Q+6]=D.z,fa[Q+7]=D.w,fa[Q+8]=N.x,fa[Q+9]=N.y,fa[Q+10]=N.z,fa[Q+11]=N.w,fa[Q+12]=O.x,fa[Q+13]=O.y,fa[Q+14]=O.z,fa[Q+15]=O.w,H=Ua[A.a],D=Ua[A.b],N=Ua[A.c],O=Ua[A.d],ea[Q]=H.x,ea[Q+1]=H.y,ea[Q+2]=H.z,ea[Q+3]=H.w,ea[Q+4]=D.x,ea[Q+5]=D.y,ea[Q+6]=D.z,ea[Q+7]=D.w,ea[Q+8]=N.x,ea[Q+9]=N.y,ea[Q+10]=N.z,ea[Q+11]=N.w,ea[Q+12]=O.x,ea[Q+13]=O.y,ea[Q+14]=O.z,ea[Q+15]=O.w,H=Sa[A.a],D=Sa[A.b],N=Sa[A.c],O=Sa[A.d],ca[Q]=H.x,ca[Q+1]=H.y,ca[Q+2]=H.z,ca[Q+3]=1,ca[Q+4]=D.x,ca[Q+5]=D.y,
- ca[Q+6]=D.z,ca[Q+7]=1,ca[Q+8]=N.x,ca[Q+9]=N.y,ca[Q+10]=N.z,ca[Q+11]=1,ca[Q+12]=O.x,ca[Q+13]=O.y,ca[Q+14]=O.z,ca[Q+15]=1,H=Ta[A.a],D=Ta[A.b],N=Ta[A.c],A=Ta[A.d],aa[Q]=H.x,aa[Q+1]=H.y,aa[Q+2]=H.z,aa[Q+3]=1,aa[Q+4]=D.x,aa[Q+5]=D.y,aa[Q+6]=D.z,aa[Q+7]=1,aa[Q+8]=N.x,aa[Q+9]=N.y,aa[Q+10]=N.z,aa[Q+11]=1,aa[Q+12]=A.x,aa[Q+13]=A.y,aa[Q+14]=A.z,aa[Q+15]=1,Q+=16;if(Ca&&K)J.length==4&&K==THREE.VertexColors?(A=J[0],H=J[1],D=J[2],J=J[3]):J=D=H=A=L,da[pa]=A.r,da[pa+1]=A.g,da[pa+2]=A.b,da[pa+3]=H.r,da[pa+4]=H.g,
- da[pa+5]=H.b,da[pa+6]=D.r,da[pa+7]=D.g,da[pa+8]=D.b,da[pa+9]=J.r,da[pa+10]=J.g,da[pa+11]=J.b,pa+=12;if(Ka&&na.hasTangents)J=ja[0],L=ja[1],A=ja[2],ja=ja[3],ha[sa]=J.x,ha[sa+1]=J.y,ha[sa+2]=J.z,ha[sa+3]=J.w,ha[sa+4]=L.x,ha[sa+5]=L.y,ha[sa+6]=L.z,ha[sa+7]=L.w,ha[sa+8]=A.x,ha[sa+9]=A.y,ha[sa+10]=A.z,ha[sa+11]=A.w,ha[sa+12]=ja.x,ha[sa+13]=ja.y,ha[sa+14]=ja.z,ha[sa+15]=ja.w,sa+=16;if(Ha&&S)if(C.length==4&&Da)for(ja=0;ja<4;ja++)la=C[ja],ka[Z]=la.x,ka[Z+1]=la.y,ka[Z+2]=la.z,Z+=3;else for(ja=0;ja<4;ja++)ka[Z]=
- la.x,ka[Z+1]=la.y,ka[Z+2]=la.z,Z+=3;if(Aa&&x!==void 0&&u)for(ja=0;ja<4;ja++)C=x[ja],va[X]=C.u,va[X+1]=C.v,X+=2;if(Aa&&B!==void 0&&u)for(ja=0;ja<4;ja++)C=B[ja],wa[ra]=C.u,wa[ra+1]=C.v,ra+=2;Ba&&(ua[T]=ma,ua[T+1]=ma+1,ua[T+2]=ma+3,ua[T+3]=ma+1,ua[T+4]=ma+2,ua[T+5]=ma+3,T+=6,xa[Y]=ma,xa[Y+1]=ma+1,xa[Y+2]=ma,xa[Y+3]=ma+3,xa[Y+4]=ma+1,xa[Y+5]=ma+2,xa[Y+6]=ma+2,xa[Y+7]=ma+3,Y+=8,ma+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ya)for($ in ya)D=ya[$],D.__original.needsUpdate&&
- (o.bindBuffer(o.ARRAY_BUFFER,D.buffer),o.bufferData(o.ARRAY_BUFFER,D.array,y));if(Ga){H=0;for(D=La.length;H<D;H++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[H]),o.bufferData(o.ARRAY_BUFFER,qa[H],y)}Ca&&pa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,da,y));Ha&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ka,y));Ka&&na.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ha,
- y));Aa&&X>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,va,y));Aa&&ra>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ua,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,xa,y));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,
- p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));z&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,
- delete p.__skinIndexArray,delete p.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;F(m)}else if(k instanceof THREE.Ribbon){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=z=z=void 0;v=k.vertices;t=k.colors;u=v.length;p=t.length;K=k.__vertexArray;y=k.__colorArray;S=k.__dirtyColors;if(k.__dirtyVertices){for(z=0;z<u;z++)w=v[z].position,n=z*3,K[n]=w.x,K[n+1]=w.y,
- K[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,K,m)}if(S){for(z=0;z<p;z++)color=t[z],n=z*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=z=z=void 0;v=k.vertices;t=k.colors;u=v.length;p=t.length;K=k.__vertexArray;y=k.__colorArray;
- S=k.__dirtyColors;if(k.__dirtyVertices){for(z=0;z<u;z++)w=v[z].position,n=z*3,K[n]=w.x,K[n+1]=w.y,K[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,K,m)}if(S){for(z=0;z<p;z++)color=t[z],n=z*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=E(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||
- p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,F(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ha}};
- THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
- THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
- THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);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(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
- THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
- THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
- THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
- THREE.ColorUtils={adjustHSV:function(b,c,e,f){var m=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,m);m.h=THREE.ColorUtils.clamp(m.h+c,0,1);m.s=THREE.ColorUtils.clamp(m.s+e,0,1);m.v=THREE.ColorUtils.clamp(m.v+f,0,1);b.setHSV(m.h,m.s,m.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,m=b.b,h=Math.max(Math.max(e,f),m),k=Math.min(Math.min(e,f),m);if(k==h)k=e=0;else{var n=h-k,k=n/h,e=e==h?(f-m)/n:f==h?2+(m-e)/n:4+(e-f)/n;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=k;c.v=h;return c},
- clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
- THREE.GeometryUtils={merge:function(b,c){var e,f,m=b.vertices.length,h=c instanceof THREE.Mesh?c.geometry:c,k=b.vertices,n=h.vertices,p=b.faces,u=h.faces,w=b.faceVertexUvs[0],h=h.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var t=0,x=n.length;t<x;t++){var v=new THREE.Vertex(n[t].position.clone());e&&e.multiplyVector3(v.position);k.push(v)}t=0;for(x=u.length;t<x;t++){var v=u[t],z,y,B=v.vertexNormals,
- C=v.vertexColors;v instanceof THREE.Face3?z=new THREE.Face3(v.a+m,v.b+m,v.c+m):v instanceof THREE.Face4&&(z=new THREE.Face4(v.a+m,v.b+m,v.c+m,v.d+m));z.normal.copy(v.normal);f&&f.multiplyVector3(z.normal);k=0;for(n=B.length;k<n;k++)y=B[k].clone(),f&&f.multiplyVector3(y),z.vertexNormals.push(y);z.color.copy(v.color);k=0;for(n=C.length;k<n;k++)y=C[k],z.vertexColors.push(y.clone());z.materials=v.materials.slice();z.centroid.copy(v.centroid);e&&e.multiplyVector3(z.centroid);p.push(z)}t=0;for(x=h.length;t<
- x;t++){e=h[t];f=[];k=0;for(n=e.length;k<n;k++)f.push(new THREE.UV(e[k].u,e[k].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,m=b.faces,h=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var k=new THREE.Vertex(f[b].position.clone());c.vertices.push(k)}b=0;for(e=m.length;b<e;b++){var n=m[b],p,u,w=n.vertexNormals,t=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
- for(k=w.length;f<k;f++)u=w[f],p.vertexNormals.push(u.clone());p.color.copy(n.color);f=0;for(k=t.length;f<k;f++)u=t[f],p.vertexColors.push(u.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);c.faces.push(p)}b=0;for(e=h.length;b<e;b++){m=h[b];p=[];f=0;for(k=m.length;f<k;f++)p.push(new THREE.UV(m[f].u,m[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,m,h,k=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();m=THREE.GeometryUtils.random();
- f+m>1&&(f=1-f,m=1-m);h=1-f-m;k.copy(b);k.multiplyScalar(f);n.copy(c);n.multiplyScalar(m);k.addSelf(n);n.copy(e);n.multiplyScalar(h);k.addSelf(n);return k},randomPointInFace:function(b,c,e){var f,m,h;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,m=c.vertices[b.b].position,h=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,m,h);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;m=c.vertices[b.b].position;h=c.vertices[b.c].position;var c=c.vertices[b.d].position,
- k;e?b._area1&&b._area2?(e=b._area1,k=b._area2):(e=THREE.GeometryUtils.triangleArea(f,m,c),k=THREE.GeometryUtils.triangleArea(m,h,c),b._area1=e,b._area2=k):(e=THREE.GeometryUtils.triangleArea(f,m,c),k=THREE.GeometryUtils.triangleArea(m,h,c));return THREE.GeometryUtils.random()*(e+k)<e?THREE.GeometryUtils.randomPointInTriangle(f,m,c):THREE.GeometryUtils.randomPointInTriangle(m,h,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var h=c+Math.floor((f-c)/2);return u[h]>
- b?e(c,h-1):u[h]<b?e(h+1,f):h}return e(0,u.length-1)}var f,m,h=b.faces,k=b.vertices,n=h.length,p=0,u=[],w,t,x,v;for(m=0;m<n;m++){f=h[m];if(f instanceof THREE.Face3)w=k[f.a].position,t=k[f.b].position,x=k[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,t,x);else if(f instanceof THREE.Face4)w=k[f.a].position,t=k[f.b].position,x=k[f.c].position,v=k[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,t,v),f._area2=THREE.GeometryUtils.triangleArea(t,x,v),f._area=f._area1+f._area2;p+=f._area;
- u[m]=p}f=[];k={};for(m=0;m<c;m++)n=THREE.GeometryUtils.random()*p,n=e(n),f[m]=THREE.GeometryUtils.randomPointInFace(h[n],b,!0),k[n]?k[n]+=1:k[n]=1;return f},triangleArea:function(b,c,e){var f,m=THREE.GeometryUtils.__v1;m.sub(b,c);f=m.length();m.sub(b,e);b=m.length();m.sub(c,e);e=m.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
- (b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(c);b.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
- THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,m=new THREE.Texture(f,c);f.onload=function(){m.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return m},loadTextureCube:function(b,c,e){var f,m=[],h=new THREE.Texture(m,c),c=m.loadCount=0;for(f=b.length;c<f;++c)m[c]=new Image,m[c].onload=function(){m.loadCount+=1;if(m.loadCount==6)h.needsUpdate=!0;e&&e(this)},m[c].crossOrigin="",m[c].src=b[c];return h},getNormalMap:function(b,c){var e=function(b){var e=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
- b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,m=b.height,h=document.createElement("canvas");h.width=f;h.height=m;var k=h.getContext("2d");k.drawImage(b,0,0);for(var n=k.getImageData(0,0,f,m).data,p=k.createImageData(f,m),u=p.data,w=0;w<f;w++)for(var t=1;t<m;t++){var x=t-1<0?m-1:t-1,v=(t+1)%m,z=w-1<0?f-1:w-1,y=(w+1)%f,B=[],C=[0,0,n[(t*f+w)*4]/255*c];B.push([-1,0,n[(t*f+z)*4]/255*c]);B.push([-1,-1,n[(x*f+z)*4]/255*c]);B.push([0,-1,n[(x*f+w)*4]/255*c]);B.push([1,-1,n[(x*f+y)*4]/255*c]);
- B.push([1,0,n[(t*f+y)*4]/255*c]);B.push([1,1,n[(v*f+y)*4]/255*c]);B.push([0,1,n[(v*f+w)*4]/255*c]);B.push([-1,1,n[(v*f+z)*4]/255*c]);x=[];z=B.length;for(v=0;v<z;v++){var y=B[v],E=B[(v+1)%z],y=[y[0]-C[0],y[1]-C[1],y[2]-C[2]],E=[E[0]-C[0],E[1]-C[1],E[2]-C[2]];x.push(e([y[1]*E[2]-y[2]*E[1],y[2]*E[0]-y[0]*E[2],y[0]*E[1]-y[1]*E[0]]))}B=[0,0,0];for(v=0;v<x.length;v++)B[0]+=x[v][0],B[1]+=x[v][1],B[2]+=x[v][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;C=(t*f+w)*4;u[C]=(B[0]+1)/2*255|0;u[C+1]=(B[1]+0.5)*
- 255|0;u[C+2]=B[2]*255|0;u[C+3]=255}k.putImageData(p,0,0);return h}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,m=b.children.length;for(f=0;f<m;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
- if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
- vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
- normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
- value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1}}]),fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
- THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( 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 = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = specularTex.r * pow( pointDotNormalHalf, uShininess );\npointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;\npointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight;\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 = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = specularTex.r * pow( dirDotNormalHalf, uShininess );\ndirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;\ndirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight;\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 + totalSpecular + ambientLightColor * uAmbientColor;",
- THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:"attribute vec4 tangent;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\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;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
- cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"}}};
- THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};
- THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1)return this.cacheArcLengths;var c=[],e,f=this.getPoint(0),m,h=0;c.push(0);for(m=1;m<=b;m++)e=this.getPoint(m/b),h+=e.distanceTo(f),c.push(h),f=e;return this.cacheArcLengths=c};
- THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,m=e.length,h;h=c?c:b*e[m-1];time=Date.now();for(var k=0,n=m-1,p;k<=n;)if(f=Math.floor(k+(n-k)/2),p=e[f]-h,p<0)k=f+1;else if(p>0)n=f-1;else{n=f;break}f=n;if(e[f]==h)return f/(m-1);k=e[f];return e=(f+(h-k)/(e[f+1]-k))/(m-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)};
- THREE.Curve.prototype.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve;
- THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b};
- THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
- THREE.QuadraticBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(c,b)};THREE.QuadraticBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.x,this.v1.x,this.v2.x);b=THREE.Curve.Utils.tangentQuadraticBezier(b,this.v0.y,this.v1.y,this.v2.y);c=new THREE.Vector2(c,b);c.normalize();return c};
- THREE.CubicBezierCurve=function(b,c,e,f){if(!(c instanceof THREE.Vector2))var m=Array.prototype.slice.call(arguments),b=new THREE.Vector2(m[0],m[1]),c=new THREE.Vector2(m[2],m[3]),e=new THREE.Vector2(m[4],m[5]),f=new THREE.Vector2(m[6],m[7]);this.v0=b;this.v1=c;this.v2=e;this.v3=f};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
- THREE.CubicBezierCurve.prototype.getPoint=function(b){var c;c=THREE.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(c,b)};THREE.CubicBezierCurve.prototype.getTangent=function(b){var c;c=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);b=THREE.Curve.Utils.tangentCubicBezier(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);c=new THREE.Vector2(c,b);c.normalize();return c};
- THREE.SplineCurve=function(b){this.points=b};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
- THREE.SplineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2,e=[],f=this.points,m;m=(f.length-1)*b;b=Math.floor(m);m-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,m);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,m);return c};THREE.ArcCurve=function(b,c,e,f,m,h){this.aX=b;this.aY=c;this.aRadius=e;this.aStartAngle=f;this.aEndAngle=m;this.aClockwise=h};
- THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(b){var c=this.aEndAngle-this.aStartAngle;this.aClockwise||(b=1-b);b=this.aStartAngle+b*c;return new THREE.Vector2(this.aX+this.aRadius*Math.cos(b),this.aY+this.aRadius*Math.sin(b))};
- THREE.Curve.Utils={tangentQuadraticBezier:function(b,c,e,f){return 2*(1-b)*(e-c)+2*b*(f-e)},tangentCubicBezier:function(b,c,e,f,m){return-3*c*(1-b)*(1-b)+3*e*(1-b)*(1-b)-6*b*e*(1-b)+6*b*f*(1-b)-3*b*b*f+3*b*b*m},tangentSpline:function(b){return 6*b*b-6*b+(3*b*b-4*b+1)+(-6*b*b+6*b)+(3*b*b-2*b)},interpolate:function(b,c,e,f,m){var b=(e-b)*0.5,f=(f-c)*0.5,h=m*m;return(2*c-2*e+b+f)*m*h+(-3*c+3*e-2*b-f)*h+b*m+c}};
- THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constructor=b;b.prototype.getPoint=c;return b};THREE.LineCurve3=THREE.Curve.create(function(b,c){this.v1=b;this.v2=c},function(b){var c=new THREE.Vector3;c.sub(v2,v1);c.multiplyScalar(b);c.addSelf(this.v1);return c});
- THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e){this.v0=b;this.v1=c;this.v2=e},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);e=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);b=THREE.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,e,b)});
- THREE.CubicBezierCurve3=THREE.Curve.create(function(b,c,e,f){this.v0=b;this.v1=c;this.v2=e;this.v3=f},function(b){var c,e;c=THREE.Shape.Utils.b3(b,this.v0.x,this.v1.x,this.v2.x,this.v3.x);e=THREE.Shape.Utils.b3(b,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=THREE.Shape.Utils.b3(b,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(c,e,b)});
- THREE.SplineCurve3=THREE.Curve.create(function(b){this.points=b},function(b){var c=new THREE.Vector3,e=[],f=this.points,m;m=(f.length-1)*b;b=Math.floor(m);m-=b;e[0]=b==0?b:b-1;e[1]=b;e[2]=b>f.length-2?b:b+1;e[3]=b>f.length-3?b:b+2;c.x=THREE.Curve.Utils.interpolate(f[e[0]].x,f[e[1]].x,f[e[2]].x,f[e[3]].x,m);c.y=THREE.Curve.Utils.interpolate(f[e[0]].y,f[e[1]].y,f[e[2]].y,f[e[3]].y,m);c.z=THREE.Curve.Utils.interpolate(f[e[0]].z,f[e[1]].z,f[e[2]].z,f[e[3]].z,m);return c});
- THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(b){this.curves.push(b)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
- THREE.CurvePath.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.getCurveLengths(),b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]};
- THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);return this.cacheLengths=b};
- THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,m;c=e=Number.NEGATIVE_INFINITY;f=m=Number.POSITIVE_INFINITY;var h,k,n,p;p=new THREE.Vector2;k=0;for(n=b.length;k<n;k++){h=b[k];if(h.x>c)c=h.x;else if(h.x<f)f=h.x;if(h.y>e)e=h.y;else if(h.y<e)m=h.y;p.addSelf(h.x,h.y)}return{minX:f,minY:m,maxX:c,maxY:e,centroid:p.divideScalar(n)}};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
- THREE.CurvePath.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.CurvePath.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(b){this.bends.push(b)};
- THREE.CurvePath.prototype.getTransformedPoints=function(b,c){var e=this.getPoints(b),f,m;if(!c)c=this.bends;f=0;for(m=c.length;f<m;f++)e=this.getWrapPoints(e,c[f]);return e};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(b,c){var e=this.getSpacedPoints(b),f,m;if(!c)c=this.bends;f=0;for(m=c.length;f<m;f++)e=this.getWrapPoints(e,c[f]);return e};
- THREE.CurvePath.prototype.getWrapPoints=function(b,c){var e=this.getBoundingBox(),f,m,h,k,n,p;f=0;for(m=b.length;f<m;f++)h=b[f],k=h.x,n=h.y,p=k/e.maxX,p=c.getUtoTmapping(p,k),k=c.getPoint(p),n=c.getNormalVector(p).multiplyScalar(n),h.x=k.x+n.x,h.y=k.y+n.y;return b};THREE.Path=function(b){THREE.CurvePath.call(this);this.actions=[];b&&this.fromPoints(b)};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(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
- THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(b,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:e})};
- THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var m=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(b,c),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:m})};
- THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,m,h){var k=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(n[n.length-2],n[n.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f),new THREE.Vector2(m,h)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:k})};
- THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];Array.prototype.push.apply(e,b);this.curves.push(new THREE.SplineCurve(e));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
- THREE.Path.prototype.arc=function(b,c,e,f,m,h){var k=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,m,h));this.actions.push({action:THREE.PathActions.ARC,args:k})};THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
- THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,m,h,k,n,p,u,w,t,x,v,z,y;f=0;for(m=this.actions.length;f<m;f++)switch(h=this.actions[f],k=h.action,h=h.args,k){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(h[0],h[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=h[2];p=h[3];t=h[0];x=h[1];e.length>0?(k=e[e.length-1],v=k.x,z=k.y):(k=this.actions[f-1].args,v=k[k.length-2],z=k[k.length-1]);for(k=1;k<=b;k++)y=k/b,h=THREE.Shape.Utils.b2(y,v,t,n),y=THREE.Shape.Utils.b2(y,z,x,
- p),e.push(new THREE.Vector2(h,y));break;case THREE.PathActions.BEZIER_CURVE_TO:n=h[4];p=h[5];t=h[0];x=h[1];u=h[2];w=h[3];e.length>0?(k=e[e.length-1],v=k.x,z=k.y):(k=this.actions[f-1].args,v=k[k.length-2],z=k[k.length-1]);for(k=1;k<=b;k++)y=k/b,h=THREE.Shape.Utils.b3(y,v,t,u,n),y=THREE.Shape.Utils.b3(y,z,x,w,p),e.push(new THREE.Vector2(h,y));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];y=b*h[0].length;k=k.concat(h[0]);h=new THREE.SplineCurve(k);
- for(k=1;k<=y;k++)e.push(h.getPointAt(k/y));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=h[0];p=h[1];u=h[2];t=h[3];y=h[4];x=!!h[5];w=k[k.length-2];v=k[k.length-1];k.length==0&&(w=v=0);z=y-t;var B=b*2;for(k=1;k<=B;k++)y=k/B,x||(y=1-y),y=t+y*z,h=w+n+u*Math.cos(y),y=v+p+u*Math.sin(y),e.push(new THREE.Vector2(h,y))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)};
- THREE.Path.prototype.nltransform=function(b,c,e,f,m,h){var k=this.getPoints(),n,p,u,w,t;n=0;for(p=k.length;n<p;n++)u=k[n],w=u.x,t=u.y,u.x=b*w+c*t+e,u.y=f*t+m*w+h;return k};
- THREE.Path.prototype.debug=function(b){var c=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,m,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],m=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,m);c.stroke();c.closePath();c.strokeStyle="red";f=
- this.getPoints();b=0;for(e=f.length;b<e;b++)m=f[b],c.beginPath(),c.arc(m.x,m.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
- THREE.Path.prototype.toShapes=function(){var b,c,e,f,m=[],h=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&h.actions.length!=0&&(m.push(h),h=new THREE.Path),h[e].apply(h,f);h.actions.length!=0&&m.push(h);if(m.length==0)return[];var k,h=[];if(THREE.Shape.Utils.isClockWise(m[0].getPoints())){b=0;for(c=m.length;b<c;b++)f=m[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(k&&h.push(k),k=new THREE.Shape,k.actions=f.actions,k.curves=
- f.curves):k.holes.push(f);h.push(k)}else{k=new THREE.Shape;b=0;for(c=m.length;b<c;b++)f=m[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(k.actions=f.actions,k.curves=f.curves,h.push(k),k=new THREE.Shape):k.holes.push(f)}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(b){return new THREE.ExtrudeGeometry(this,b)};
- THREE.Shape.prototype.getPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedPoints(b,this.bends);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedSpacedPoints(b,this.bends);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};
- THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
- THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),m,h,k,n,p,u,w,t,x,v,z=[];for(p=0;p<c.length;p++){u=c[p];Array.prototype.push.apply(f,u);h=Number.POSITIVE_INFINITY;for(m=0;m<u.length;m++){x=u[m];v=[];for(t=0;t<e.length;t++)w=e[t],w=x.distanceToSquared(w),v.push(w),w<h&&(h=w,k=m,n=t)}m=n-1>=0?n-1:e.length-1;h=k-1>=0?k-1:u.length-1;var y=[u[k],e[n],e[m]];t=THREE.FontUtils.Triangulate.area(y);var B=[u[k],u[h],e[n]];x=THREE.FontUtils.Triangulate.area(B);v=n;w=k;n+=1;k+=-1;n<
- 0&&(n+=e.length);n%=e.length;k<0&&(k+=u.length);k%=u.length;m=n-1>=0?n-1:e.length-1;h=k-1>=0?k-1:u.length-1;y=[u[k],e[n],e[m]];y=THREE.FontUtils.Triangulate.area(y);B=[u[k],u[h],e[n]];B=THREE.FontUtils.Triangulate.area(B);t+x>y+B&&(n=v,k=w,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=u.length),k%=u.length,m=n-1>=0?n-1:e.length-1,h=k-1>=0?k-1:u.length-1);t=e.slice(0,n);x=e.slice(n);v=u.slice(k);w=u.slice(0,k);h=[u[k],u[h],e[n]];z.push([u[k],e[n],e[m]]);z.push(h);e=t.concat(v).concat(w).concat(x)}return{shape:e,
- isolatedPts:z,allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,m=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),h,k,n,p,u={};h=0;for(k=f.length;h<k;h++)p=f[h].x+":"+f[h].y,u[p]!==void 0&&console.log("Duplicate point",p),u[p]=h;h=0;for(k=e.length;h<k;h++){n=e[h];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=u[p],p!==void 0&&(n[f]=p)}h=0;for(k=m.length;h<k;h++){n=m[h];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=u[p],p!==void 0&&(n[f]=p)}return e.concat(m)},
- isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,m){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+
- this.b3p3(b,m)}};THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",m=c.weight!==void 0?c.weight:"normal",h=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=m;THREE.FontUtils.style=h};
- THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)Array.prototype.push.apply(c,b[e].toShapes());return c};
- THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
- 0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var n=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(n[0],n[1],n[2],n[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){n={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++){var u=b.hierarchy[e].keys[f].morphTargets[p];n[u]=-1}b.hierarchy[e].usedMorphTargets=n;for(f=0;f<b.hierarchy[e].keys.length;f++){var w=
- {};for(u in n){for(p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++)if(b.hierarchy[e].keys[f].morphTargets[p]===u){w[u]=b.hierarchy[e].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[e].keys[f].morphTargets.length&&(w[u]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=w}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
- b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
- 2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
- THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,m;for(e=0;e<f;e++){m=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)m.useQuaternion=!0;m.matrixAutoUpdate=!0;if(m.animationCache===void 0)m.animationCache={},m.animationCache.prevKey={pos:0,rot:0,scl:0},m.animationCache.nextKey={pos:0,rot:0,scl:0},m.animationCache.originalMatrix=m instanceof
- THREE.Bone?m.skinMatrix:m.matrix;var h=m.animationCache.prevKey;m=m.animationCache.nextKey;h.pos=this.data.hierarchy[e].keys[0];h.rot=this.data.hierarchy[e].keys[0];h.scl=this.data.hierarchy[e].keys[0];m.pos=this.getNextKeyWith("pos",e,1);m.rot=this.getNextKeyWith("rot",e,1);m.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
- THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
- THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
- THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,m,h,k,n,p,u,w=this.data.JIT.hierarchy,t,x;this.currentTime+=b*this.timeScale;x=this.currentTime;t=this.currentTime%=this.data.length;u=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,z=this.hierarchy.length;v<z;v++)if(b=this.hierarchy[v],p=b.animationCache,this.JITCompile&&w[v][u]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=w[v][u],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
- !1):(b.matrix=w[v][u],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var y=0;y<3;y++){e=c[y];k=p.prevKey[e];n=p.nextKey[e];if(n.time<=x){if(t<x)if(this.loop){k=this.data.hierarchy[v].keys[0];for(n=this.getNextKeyWith(e,v,1);n.time<t;)k=n,n=this.getNextKeyWith(e,v,n.index+1)}else{this.stop();return}else{do k=n,n=this.getNextKeyWith(e,v,n.index+1);while(n.time<
- t)}p.prevKey[e]=k;p.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-k.time)/(n.time-k.time);m=k[e];h=n[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=m[0]+(h[0]-m[0])*f,e.y=m[1]+(h[1]-m[1])*f,e.z=m[2]+(h[2]-m[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
- this.getPrevKeyWith("pos",v,k.index-1).pos,this.points[1]=m,this.points[2]=h,this.points[3]=this.getNextKeyWith("pos",v,n.index+1).pos,f=f*0.33+0.33,m=this.interpolateCatmullRom(this.points,f),e.x=m[0],e.y=m[1],e.z=m[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
- "rot")THREE.Quaternion.slerp(m,h,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=m[0]+(h[0]-m[0])*f,e.y=m[1]+(h[1]-m[1])*f,e.z=m[2]+(h[2]-m[2])*f}}if(this.JITCompile&&w[0][u]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)w[v][u]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
- THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],m,h,k,n,p,u;m=(b.length-1)*c;h=Math.floor(m);m-=h;e[0]=h==0?h:h-1;e[1]=h;e[2]=h>b.length-2?h:h+1;e[3]=h>b.length-3?h:h+2;h=b[e[0]];n=b[e[1]];p=b[e[2]];u=b[e[3]];e=m*m;k=m*e;f[0]=this.interpolate(h[0],n[0],p[0],u[0],m,e,k);f[1]=this.interpolate(h[1],n[1],p[1],u[1],m,e,k);f[2]=this.interpolate(h[2],n[2],p[2],u[2],m,e,k);return f};
- THREE.Animation.prototype.interpolate=function(b,c,e,f,m,h,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*h+b*m+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
- THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
- THREE.CubeCamera=function(b,c,e,f){this.cameraPX=new THREE.Camera(90,1,b,c);this.cameraNX=new THREE.Camera(90,1,b,c);this.cameraPY=new THREE.Camera(90,1,b,c);this.cameraNY=new THREE.Camera(90,1,b,c);this.cameraPZ=new THREE.Camera(90,1,b,c);this.cameraNZ=new THREE.Camera(90,1,b,c);this.height=e;this.position=new THREE.Vector3(0,e,0);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.cameraPY.up.set(0,0,1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.renderTarget=new THREE.WebGLRenderTargetCube(f,f,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(b){this.position.x=b.x;this.position.z=b.z;this.cameraPX.target.position.add(this.position,new THREE.Vector3(-1,0,0));this.cameraNX.target.position.add(this.position,new THREE.Vector3(1,0,0));this.cameraPY.target.position.add(this.position,
- new THREE.Vector3(0,1,0));this.cameraNY.target.position.add(this.position,new THREE.Vector3(0,-1,0));this.cameraPZ.target.position.add(this.position,new THREE.Vector3(0,0,1));this.cameraNZ.target.position.add(this.position,new THREE.Vector3(0,0,-1))};this.updateCubeMap=function(b,e){var c=this.renderTarget;b.setFaceCulling("back","cw");e.scale.y=-1;e.position.y=2*this.height;e.updateMatrix();c.activeCubeFace=0;b.render(e,this.cameraPX,c);c.activeCubeFace=1;b.render(e,this.cameraNX,c);e.scale.y=1;
- e.position.y=0;e.updateMatrix();e.scale.x=-1;e.updateMatrix();c.activeCubeFace=2;b.render(e,this.cameraPY,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw");c.activeCubeFace=3;b.render(e,this.cameraNY,c);e.scale.x=-1;e.updateMatrix();b.setFaceCulling("back","cw");c.activeCubeFace=4;b.render(e,this.cameraPZ,c);c.activeCubeFace=5;b.render(e,this.cameraNZ,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw")}};
- THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
- b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
- void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.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(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=
- !1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=
- !0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update=function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*
- ((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c);this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown&&this.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||
- (c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target.position,m=this.position;b.x=m.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=m.y+100*Math.cos(this.phi);b.z=m.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*
- c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target.position;m=this.position;b.x=m.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=m.y+100*Math.cos(this.phi);b.z=m.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
- !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;
- THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
- THREE.PathCamera=function(b){function c(b,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),p=m.length,E=0;k=p-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<p-1;k++)E=f*n.chunks[k]/n.total,e.keys[k]={time:E,pos:m[k]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
- f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,k);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);h=new THREE.SphereGeometry(1,
- 16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=
- this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;
- if(b.createDebugDummy!==void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=
- this.mouseX=0;this.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 m=Math.PI*2,h=Math.PI/180;this.update=function(b,e,c){var f,k;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,
- Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;f=this.phi%m;this.phi=f>=0?f:f+m;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var n=k[1]-k[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/n)*n+k[0];f=this.horizontalAngleMap.srcRange;k=this.horizontalAngleMap.dstRange;n=k[1]-k[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k[0])/n)*n+k[0];f=this.target.position;
- f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&
- this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),p=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(p,k);b.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=
- c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,e){return function(){e.apply(b,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
- THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
- b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.domElement!==document&&this.domElement.setAttribute("tabindex",-1);this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};
- this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=
- 1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=
- 0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),
- m=c.size[0]/2,h=c.size[1]/2;this.moveState.yawLeft=-(b.pageX-c.offset[0]-m)/m;this.moveState.pitchDown=(b.pageY-c.offset[1]-h)/h;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=
- b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=
- !0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
- -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
- this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
- THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var m=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Matrix4,p=!1,u=1,w=0,t=0,x=0,v=0,z=0,y=window.innerWidth/2,B=window.innerHeight/2;this.update=
- function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*z));b=this.delta*this.movementSpeed;this.translateZ(b*(w>0||this.autoForward&&!(w<0)?1:w));this.translateX(b*t);this.translateY(b*x);p&&(this.roll+=this.rollSpeed*this.delta*u);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();k.copy(this.forward);h.set(0,1,0);m.cross(h,k).normalize();h.cross(k,m).normalize();this.matrix.n11=m.x;this.matrix.n12=h.x;this.matrix.n13=k.x;this.matrix.n21=m.y;this.matrix.n22=h.y;this.matrix.n23=k.y;this.matrix.n31=m.z;this.matrix.n32=h.z;this.matrix.n33=k.z;n.identity();n.n11=Math.cos(this.roll);n.n12=-Math.sin(this.roll);n.n21=Math.sin(this.roll);n.n22=Math.cos(this.roll);this.matrix.multiplySelf(n);
- this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
- this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){m.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);m.multiplyScalar(b);this.forward.subSelf(m);this.forward.normalize()};this.rotateVertically=function(b){h.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);h.multiplyScalar(b);this.forward.addSelf(h);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
- function(b){v=(b.clientX-y)/window.innerWidth;z=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:w=1;break;case 2:w=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:w=0;break;case 2:w=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:w=1;break;case 37:case 65:t=-1;break;
- case 40:case 83:w=-1;break;case 39:case 68:t=1;break;case 81:p=!0;u=1;break;case 69:p=!0;u=-1;break;case 82:x=1;break;case 70:x=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:w=0;break;case 37:case 65:t=0;break;case 40:case 83:w=0;break;case 39:case 68:t=0;break;case 81:p=!1;break;case 69:p=!1;break;case 82:x=0;break;case 70:x=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
- THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
- THREE.TrackballCamera=function(b){function c(b,e){return function(){e.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
- !1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,m=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector2,p=new THREE.Vector2,u=new THREE.Vector2,w=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,e){return new THREE.Vector2((b-
- this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);m=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(m).setLength(c.x));f.addSelf(m.setLength(c.z));return f};
- this.rotateCamera=function(){var b=Math.acos(h.dot(k)/h.length()/k.length());if(b){var e=(new THREE.Vector3).cross(h,k).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(m);c.multiplyVector3(this.up);c.multiplyVector3(k);this.staticMoving?h=k:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(h))}};this.zoomCamera=function(){var b=1+(p.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(m.multiplyScalar(b),this.staticMoving?n=p:n.y+=(p.y-n.y)*this.dynamicDampingFactor)};
- this.panCamera=function(){var b=w.clone().subSelf(u);if(b.lengthSq()){b.multiplyScalar(m.length()*this.panSpeed);var c=m.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?u=w:u.addSelf(b.sub(w,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
- m.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,m.setLength(this.minDistance))};this.update=function(b,c,e){m=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,m);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
- c(this,function(b){e&&(h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=p=this.getMouseOnScreen(b.clientX,b.clientY),u=w=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?p=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(w=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
- b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?h=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=p=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(u=w=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
- this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
- THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;
- THREE.CubeGeometry=function(b,c,e,f,m,h,k,n,p){function u(b,c,e,k,n,p,t,u){var v,x,y=f||1,z=m||1,O=n/2,X=p/2,V=w.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")v="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")v="y",z=h||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")v="x",y=h||1;var W=y+1,o=z+1;n/=y;var ea=p/z;for(x=0;x<o;x++)for(p=0;p<W;p++){var T=new THREE.Vector3;T[b]=(p*n-O)*e;T[c]=(x*ea-X)*k;T[v]=t;w.vertices.push(new THREE.Vertex(T))}for(x=0;x<z;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+W*
- x+V,p+W*(x+1)+V,p+1+W*(x+1)+V,p+1+W*x+V,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/z),new THREE.UV(p/y,(x+1)/z),new THREE.UV((p+1)/y,(x+1)/z),new THREE.UV((p+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,t=b/2,x=c/2,v=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var z=0;z<6;z++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var y in p)this.sides[y]!=void 0&&(this.sides[y]=
- p[y]);this.sides.px&&u("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&u("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&u("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&u("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&u("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&u("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
- THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
- THREE.CylinderGeometry=function(b,c,e,f,m,h){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,k=e/2,f=f||8,m=m||1,n,p,u=[],w=[];for(p=0;p<=m;p++){var t=[],x=[],v=p/m,z=v*(c-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(y*Math.PI*2),-v*e+k,z*Math.cos(y*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(y,v))}u.push(t);w.push(x)}for(p=0;p<m;p++)for(n=0;n<f;n++){var e=u[p][n],t=u[p+1][n],x=u[p+1][n+1],v=u[p][n+1],z=
- this.vertices[e].position.clone().setY(0).normalize(),y=this.vertices[t].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),C=this.vertices[v].position.clone().setY(0).normalize(),E=w[p][n].clone(),F=w[p+1][n].clone(),G=w[p+1][n+1].clone(),M=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,v,[z,y,B,C]));this.faceVertexUvs[0].push([E,F,G,M])}if(!h&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)e=u[0][n],t=u[0][n+
- 1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),E=w[0][n].clone(),F=w[0][n+1].clone(),G=new THREE.UV(F.u,0),this.faces.push(new THREE.Face3(e,t,x,[z,y,B])),this.faceVertexUvs[0].push([E,F,G])}if(!h&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)e=u[p][n+1],t=u[p][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),E=w[p][n+1].clone(),F=w[p][n].clone(),
- G=new THREE.UV(F.u,1),this.faces.push(new THREE.Face3(e,t,x,[z,y,B])),this.faceVertexUvs[0].push([E,F,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
- THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,m;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)m=b[e],this.addShape(m,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
- THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
- n.copy(c).addSelf(k);o.copy(e).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function m(b){for(I=b.length;--I>=0;){qa=I;fa=I-1;fa<0&&(fa=b.length-
- 1);for(var c=0,e=v+w*2,c=0;c<e;c++){var f=ea*c,h=ea*(c+1),k=da+qa+f,m=da+qa+h,o=k,f=da+fa+f,h=da+fa+h,t=m;o+=Z;f+=Z;h+=Z;t+=Z;J.faces.push(new THREE.Face4(o,f,h,t,null,null,G));G&&(o=c/e,f=(c+1)/e,h=n+p*2,k=(J.vertices[k].position.z+p)/h,m=(J.vertices[m].position.z+p)/h,J.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function h(b,c,e){J.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=Z;c+=Z;e+=Z;J.faces.push(new THREE.Face3(b,
- c,e,null,null,F));if(F){var f=M.maxY,h=M.maxX,k=J.vertices[c].position.x,c=J.vertices[c].position.y,m=J.vertices[e].position.x,e=J.vertices[e].position.y;J.faceVertexUvs[0].push([new THREE.UV(J.vertices[b].position.x/h,J.vertices[b].position.y/f),new THREE.UV(k/h,c/f),new THREE.UV(m/h,e/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:p-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
- !0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,B,C=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,F=c.material,G=c.extrudeMaterial,M=this.shapebb;if(y)B=y.getPoints(x),v=B.length,C=!0,t=!1;t||(u=p=w=0);var P,L,A,J=this,Z=this.vertices.length;z&&b.addWrapPath(z);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();L=0;for(A=x.length;L<A;L++)P=x[L],THREE.Shape.Utils.isClockWise(P)&&
- (x[L]=P.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);E=z;L=0;for(A=x.length;L<A;L++)P=x[L],z=z.concat(P);var I,O,X,V,W,o,ea=z.length,T=y.length,na=[];I=0;O=E.length;qa=O-1;for(fa=I+1;I<O;I++,qa++,fa++)qa==O&&(qa=0),fa==O&&(fa=0),na[I]=f(E[I],E[qa],E[fa]);var aa=[],ha,ca=na.concat();L=0;for(A=x.length;L<A;L++){P=x[L];ha=[];I=0;O=P.length;qa=O-1;for(fa=I+1;I<O;I++,qa++,fa++)qa==O&&(qa=0),fa==O&&(fa=0),ha[I]=f(P[I],P[qa],P[fa]);aa.push(ha);ca=ca.concat(ha)}for(X=0;X<w;X++){V=X/w;W=p*(1-
- V);V=u*Math.sin(V*Math.PI/2);I=0;for(O=E.length;I<O;I++)o=e(E[I],na[I],V),h(o.x,o.y,-W);L=0;for(A=x.length;L<A;L++){P=x[L];ha=aa[L];I=0;for(O=P.length;I<O;I++)o=e(P[I],ha[I],V),h(o.x,o.y,-W)}}V=u;for(I=0;I<ea;I++)o=t?e(z[I],ca[I],V):z[I],C?h(o.x,o.y+B[0].y,B[0].x):h(o.x,o.y,0);for(X=1;X<=v;X++)for(I=0;I<ea;I++)o=t?e(z[I],ca[I],V):z[I],C?h(o.x,o.y+B[X-1].y,B[X-1].x):h(o.x,o.y,n/v*X);for(X=w-1;X>=0;X--){V=X/w;W=p*(1-V);V=u*Math.sin(V*Math.PI/2);I=0;for(O=E.length;I<O;I++)o=e(E[I],na[I],V),h(o.x,o.y,
- n+W);L=0;for(A=x.length;L<A;L++){P=x[L];ha=aa[L];I=0;for(O=P.length;I<O;I++)o=e(P[I],ha[I],V),C?h(o.x,o.y+B[v-1].y,B[v-1].x+W):h(o.x,o.y,n+W)}}if(t){t=ea*0;for(I=0;I<T;I++)u=y[I],k(u[2]+t,u[1]+t,u[0]+t);t=ea*(v+w*2);for(I=0;I<T;I++)u=y[I],k(u[0]+t,u[1]+t,u[2]+t)}else{for(I=0;I<T;I++)u=y[I],k(u[2],u[1],u[0]);for(I=0;I<T;I++)u=y[I],k(u[0]+ea*v,u[1]+ea*v,u[2]+ea*v)}var qa,fa,da=0;m(E);da+=E.length;L=0;for(A=x.length;L<A;L++)P=x[L],m(P),da+=P.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.SubdivisionGeometry=function(b){function c(b,c,e,h){f.faces.push(new THREE.Face4(b,c,e,h,null,null,null));(!w||u.length!=0)&&f.faceVertexUvs[0].push([u[b],u[c],u[e],u[h]])}function e(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}THREE.Geometry.call(this);var f=this,m=b.vertices,h=b.faces,k=m.concat(),n=[],p={},u=[],w=!1,t,x,v,z,y;y=b.faceVertexUvs[0];var B;t=0;for(x=y.length;t<x;t++){v=0;for(z=y[t].length;v<z;v++)B=h[t]["abcd".charAt(v)],u[B]||(u[B]=y[t][v])}this.materials=b.materials;var C;t=
- 0;for(x=h.length;t<x;t++)if(y=h[t],n.push(y.centroid),k.push(new THREE.Vertex(y.centroid)),w&&u.length!=0){C=new THREE.UV;if(y instanceof THREE.Face3)C.u=u[y.a].u+u[y.b].u+u[y.c].u,C.v=u[y.a].v+u[y.b].v+u[y.c].v,C.u/=3,C.v/=3;else if(y instanceof THREE.Face4)C.u=u[y.a].u+u[y.b].u+u[y.c].u+u[y.d].u,C.v=u[y.a].v+u[y.b].v+u[y.c].v+u[y.d].v,C.u/=4,C.v/=4;u.push(C)}var b=function(b){function c(b,e,f){b[e]===void 0&&(b[e]={set:{},array:[]});b[e].set[f]=1;b[e].array.push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<
- h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));b.vfMap=n;b.edges=[];k=0;for(f in n)k++,h=n[f],b.edges.push(h.array);return n}(b),E,F=0;z=m.length;for(t in b)if(y=b[t],y=y.array,C=y[0],y=y[1],E=new THREE.Vector3,E.addSelf(n[C]),E.addSelf(n[y]),B=t.split("_"),x=B[0],B=B[1],E.addSelf(m[x].position),E.addSelf(m[B].position),
- E.multiplyScalar(0.25),p[t]=z+h.length+F,k.push(new THREE.Vertex(E)),F++,w&&u.length!=0)C=new THREE.UV,C.u=u[x].u+u[B].u,C.v=u[x].v+u[B].v,C.u/=2,C.v/=2,u.push(C);var G;t=0;for(x=n.length;t<x;t++)y=h[t],B=z+t,y instanceof THREE.Face3?(F=e(y.a,y.b),C=e(y.b,y.c),E=e(y.c,y.a),c(B,p[F],y.b,p[C]),c(B,p[C],y.c,p[E]),c(B,p[E],y.a,p[F])):y instanceof THREE.Face4?(F=e(y.a,y.b),C=e(y.b,y.c),E=e(y.c,y.d),G=e(y.d,y.a),c(B,p[F],y.b,p[C]),c(B,p[C],y.c,p[E]),c(B,p[E],y.d,p[G]),c(B,p[G],y.a,p[F])):console.log("face should be a face!",
- y);f.vertices=k;var M={},P={},h=function(b,c){M[b]===void 0&&(M[b]=[]);M[b].push(c)},k=function(b,c){P[b]===void 0&&(P[b]={});P[b][c]=null};for(t in b)y=b[t],B=t.split("_"),x=B[0],B=B[1],h(x,[x,B]),h(B,[x,B]),y=y.array,C=y[0],y=y[1],k(x,C),k(x,y),k(B,C),k(B,y);h=new THREE.Vector3;k=new THREE.Vector3;t=0;for(x=m.length;t<x;t++)if(M[t]!==void 0){h.set(0,0,0);k.set(0,0,0);p=new THREE.Vector3(0,0,0);b=0;for(v in P[t])h.addSelf(n[v]),b++;h.divideScalar(b);b=M[t].length;for(v=0;v<b;v++)y=M[t][v],z=m[y[0]].position.clone().addSelf(m[y[1]].position).divideScalar(2),
- k.addSelf(z);k.divideScalar(b);p.addSelf(m[t].position);p.multiplyScalar(b-3);p.addSelf(h);p.addSelf(k.multiplyScalar(2));p.divideScalar(b);this.vertices[t].position=p}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.SubdivisionGeometry.prototype=new THREE.Geometry;THREE.SubdivisionGeometry.prototype.constructor=THREE.SubdivisionGeometry;
- THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return m.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=m.vertices[b].position,h=m.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var m=this,h=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
- -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,h);e(0,5,1,h);e(0,1,7,h);e(0,7,10,h);e(0,10,11,h);e(1,5,9,h);e(5,11,4,h);e(11,10,2,h);e(10,7,6,h);e(7,1,8,h);e(3,9,4,h);e(3,4,2,h);e(3,2,6,h);e(3,6,8,h);e(3,8,9,h);e(4,9,5,h);e(2,4,11,h);e(6,2,10,h);e(8,6,7,h);e(9,8,1,h);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in h.faces){var p=f(h.faces[n].a,h.faces[n].b),u=f(h.faces[n].b,h.faces[n].c),w=f(h.faces[n].c,h.faces[n].a);e(h.faces[n].a,p,w,b);e(h.faces[n].b,u,
- p,b);e(h.faces[n].c,w,u,b);e(p,u,w,b)}h.faces=b.faces}m.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
- THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],m=[],h=[],k=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var p=0;p<=this.angle+0.0010;p+=c){for(n=0;n<e.length;n++)p<this.angle?(e[n]=k.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),m[n]=this.vertices.length-1):m=h;p==0&&(h=f);
- for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(m[n],m[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,n/b.length),new THREE.UV(1-p/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,n/b.length)]);f=m;m=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
- THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var m,h=b/2,k=c/2,e=e||1,f=f||1,n=e+1,p=f+1;b/=e;var u=c/f;for(m=0;m<p;m++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-h,-(m*u-k),0)));for(m=0;m<f;m++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+n*m,c+n*(m+1),c+1+n*(m+1),c+1+n*m)),this.faceVertexUvs[0].push([new THREE.UV(c/e,m/f),new THREE.UV(c/e,(m+1)/f),new THREE.UV((c+1)/e,(m+1)/f),new THREE.UV((c+1)/e,m/f)]);this.computeCentroids();this.computeFaceNormals()};
- THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
- THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,m=Math.PI,h=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e<k+1;e++){f=e/k;var n=b*Math.cos(f*m),p=b*Math.sin(f*m),u=[],w=0;for(f=0;f<h;f++){var t=2*f/h,x=p*Math.sin(t*m),t=p*Math.cos(t*m);(e==0||e==k)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,n,x)))-1);u.push(w)}c.push(u)}for(var v,z,y,m=c.length,e=0;e<m;e++)if(h=c[e].length,e>0)for(f=0;f<h;f++){u=f==h-1;k=c[e][u?0:f+1];n=c[e][u?h-1:f];p=c[e-1][u?
- h-1:f];u=c[e-1][u?0:f+1];x=e/(m-1);v=(e-1)/(m-1);z=(f+1)/h;var t=f/h,w=new THREE.UV(1-z,x),x=new THREE.UV(1-t,x),t=new THREE.UV(1-t,v),B=new THREE.UV(1-z,v);e<c.length-1&&(v=this.vertices[k].position.clone(),z=this.vertices[n].position.clone(),y=this.vertices[p].position.clone(),v.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(k,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([w,x,t]));e>1&&(v=
- this.vertices[k].position.clone(),z=this.vertices[p].position.clone(),y=this.vertices[u].position.clone(),v.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(k,p,u,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([w,t,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
- THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
- THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};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(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
- this.getFace(),e=this.size/c.resolution,f=0,m=String(b).split(""),h=m.length,k=[],b=0;b<h;b++){var n=new THREE.Path,n=this.extractGlyphPoints(m[b],c,e,f,n);f+=n.offset;k.push(n.path)}return{paths:k,offset:f/2}},extractGlyphPoints:function(b,c,e,f,m){var h=[],k,n,p,u,w,t,x,v,z,y,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));p=c.length;for(b=0;b<p;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;u=c[b++]*e;h.push(new THREE.Vector2(n,
- u));m.moveTo(n,u);break;case "l":n=c[b++]*e+f;u=c[b++]*e;h.push(new THREE.Vector2(n,u));m.lineTo(n,u);break;case "q":n=c[b++]*e+f;u=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;m.quadraticCurveTo(x,v,n,u);if(k=h[h.length-1]){w=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var C=k/divisions,E=THREE.Shape.Utils.b2(C,w,x,n),C=THREE.Shape.Utils.b2(C,t,v,u);h.push(new THREE.Vector2(E,C))}}break;case "b":if(n=c[b++]*e+f,u=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,z=c[b++]*e+f,y=c[b++]*-e,m.bezierCurveTo(n,u,
- x,v,z,y),k=h[h.length-1]){w=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)C=k/divisions,E=THREE.Shape.Utils.b3(C,w,x,z,n),C=THREE.Shape.Utils.b3(C,t,v,y,u),h.push(new THREE.Vector2(E,C))}}}return{offset:B.ha*e,points:h,path:m}}}};
- (function(b){var c=function(b){for(var c=b.length,m=0,h=c-1,k=0;k<c;h=k++)m+=b[h].x*b[k].y-b[k].x*b[h].y;return m*0.5};b.Triangulate=function(b,f){var m=b.length;if(m<3)return null;var h=[],k=[],n=[],p,u,w;if(c(b)>0)for(u=0;u<m;u++)k[u]=u;else for(u=0;u<m;u++)k[u]=m-1-u;var t=2*m;for(u=m-1;m>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return h}p=u;m<=p&&(p=0);u=p+1;m<=u&&(u=0);w=u+1;m<=w&&(w=0);var x;a:{x=b;var v=p,z=u,y=w,B=m,C=k,E=void 0,F=void 0,G=void 0,
- M=void 0,P=void 0,L=void 0,A=void 0,J=void 0,Z=void 0,F=x[C[v]].x,G=x[C[v]].y,M=x[C[z]].x,P=x[C[z]].y,L=x[C[y]].x,A=x[C[y]].y;if(1.0E-10>(M-F)*(A-G)-(P-G)*(L-F))x=!1;else{for(E=0;E<B;E++)if(!(E==v||E==z||E==y)){var J=x[C[E]].x,Z=x[C[E]].y,I=void 0,O=void 0,X=void 0,V=void 0,W=void 0,o=void 0,ea=void 0,T=void 0,na=void 0,aa=void 0,ha=void 0,ca=void 0,I=X=W=void 0,I=L-M,O=A-P,X=F-L,V=G-A,W=M-F,o=P-G,ea=J-F,T=Z-G,na=J-M,aa=Z-P,ha=J-L,ca=Z-A,I=I*aa-O*na,W=W*T-o*ea,X=X*ca-V*ha;if(I>=0&&X>=0&&W>=0){x=!1;
- break a}}x=!0}}if(x){h.push([b[k[p]],b[k[u]],b[k[w]]]);n.push([k[p],k[u],k[w]]);p=u;for(w=u+1;w<m;p++,w++)k[p]=k[w];m--;t=2*m}}if(f)return n;return h};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
- THREE.TorusGeometry=function(b,c,e,f,m){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=m||Math.PI*2;m=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var h=f/this.segmentsT*this.arc,k=e/this.segmentsR*Math.PI*2;m.x=this.radius*Math.cos(h);m.y=this.radius*Math.sin(h);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(h);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(h);n.z=
- this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(m).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var m=(this.segmentsT+1)*e+f-1,h=(this.segmentsT+1)*(e-1)+f-1,k=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,p=new THREE.Face4(m,h,k,n,[c[m],c[h],c[k],c[n]]);p.normal.addSelf(c[m]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[n]);p.normal.normalize();this.faces.push(p);
- this.faceVertexUvs[0].push([b[m].clone(),b[h].clone(),b[k].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
- THREE.TorusKnotGeometry=function(b,c,e,f,m,h,k){function n(b,c,e,f,h,k){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(h*(2+e)*0.5*Math.cos(b),h*(2+e)*Math.sin(b)*0.5,k*h*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=m||2;this.q=h||3;this.heightScale=k||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;h=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
- this.segmentsT;++c){var p=b/this.segmentsR*2*this.p*Math.PI,k=c/this.segmentsT*2*Math.PI,m=n(p,k,this.q,this.p,this.radius,this.heightScale),p=n(p+0.01,k,this.q,this.p,this.radius,this.heightScale);e.x=p.x-m.x;e.y=p.y-m.y;e.z=p.z-m.z;f.x=p.x+m.x;f.y=p.y+m.y;f.z=p.z+m.z;h.cross(e,f);f.cross(h,e);h.normalize();f.normalize();p=-this.tube*Math.cos(k);k=this.tube*Math.sin(k);m.x+=p*f.x+k*h.x;m.y+=p*f.y+k*h.y;m.z+=p*f.z+k*h.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m.x,m.y,
- m.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,h=(c+1)%this.segmentsT,m=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][h],h=this.grid[b][h],k=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),u=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),w=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(m,e,f,h));this.faceVertexUvs[0].push([k,p,u,w])}this.computeCentroids();
- this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
- THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
- this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.length<1?".":b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,
- c){var f=new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function m(b,e,h,k,m,n){var p=document.createElement("canvas");b[e]=new THREE.Texture(p);b[e].sourceFile=h;if(k){b[e].repeat.set(k[0],k[1]);if(k[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
- if(k[1]!=1)b[e].wrapT=THREE.RepeatWrapping}m&&b[e].offset.set(m[0],m[1]);if(n){k={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(k[n[0]]!==void 0)b[e].wrapS=k[n[0]];if(k[n[1]]!==void 0)b[e].wrapT=k[n[1]]}f(b[e],c+"/"+h)}function h(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var k,n,p;n="MeshLambertMaterial";k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?n="MeshPhongMaterial":b.shading=="Basic"&&(n="MeshBasicMaterial"));
- if(b.blending)if(b.blending=="Additive")k.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")k.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")k.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)k.transparent=b.transparent;if(b.depthTest!==void 0)k.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(b.vertexColors)k.vertexColors=THREE.VertexColors;if(b.colorDiffuse)k.color=h(b.colorDiffuse);
- else if(b.DbgColor)k.color=b.DbgColor;if(b.colorSpecular)k.specular=h(b.colorSpecular);if(b.colorAmbient)k.ambient=h(b.colorAmbient);if(b.transparency)k.opacity=b.transparency;if(b.specularCoef)k.shininess=b.specularCoef;b.mapDiffuse&&c&&m(k,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&m(k,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&m(k,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
- b.mapSpecular&&c&&m(k,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var u=THREE.ShaderUtils.lib.normal,w=THREE.UniformsUtils.clone(u.uniforms),t=k.color;n=k.specular;p=k.ambient;var x=k.shininess;w.tNormal.texture=k.normalMap;if(b.mapNormalFactor)w.uNormalScale.value=b.mapNormalFactor;if(k.map)w.tDiffuse.texture=k.map,w.enableDiffuse.value=!0;if(k.specularMap)w.tSpecular.texture=k.specularMap,w.enableSpecular.value=!0;if(k.lightMap)w.tAO.texture=
- k.lightMap,w.enableAO.value=!0;w.uDiffuseColor.value.setHex(t);w.uSpecularColor.value.setHex(n);w.uAmbientColor.value.setHex(p);w.uShininess.value=x;if(k.opacity)w.uOpacity.value=k.opacity;k=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:w,lights:!0,fog:!0})}else k=new THREE[n](k);return k},constructor:THREE.Loader};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;
- THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
- THREE.BinaryLoader.prototype.load=function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),m=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),h=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,m,f,h)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
- c.postMessage(b)};
- THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,m,h){var k=new XMLHttpRequest,n=f+"/"+b,p=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,m,c):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?h&&(p==0&&(p=k.getResponseHeader("Content-Length")),h({total:p,loaded:k.responseText.length})):k.readyState==2&&(p=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
- k.setRequestHeader("Content-Type","text/plain");k.send(null)};
- THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var m=function(c){function e(b,c){var f=w(b,c),h=w(b,c+1),k=w(b,c+2),m=w(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function m(b,c){var e=w(b,c),f=w(b,c+1),h=w(b,c+2);return(w(b,c+3)<<24)+(h<<16)+(f<<8)+e}function p(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function u(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function t(c){var e,
- f,h;e=m(b,c);f=m(b,c+P);h=m(b,c+L);c=p(b,c+A);C.faces.push(new THREE.Face3(e,f,h,null,null,C.materials[c]))}function x(c){var e,f,h,k,o,t;e=m(b,c);f=m(b,c+P);h=m(b,c+L);k=p(b,c+A);o=m(b,c+J);t=m(b,c+Z);c=m(b,c+I);k=C.materials[k];var u=G[t*3],v=G[t*3+1];t=G[t*3+2];var w=G[c*3],x=G[c*3+1],c=G[c*3+2];C.faces.push(new THREE.Face3(e,f,h,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,c)],null,k))}function v(c){var e,f,h,k;e=m(b,c);f=m(b,c+O);h=m(b,c+X);k=m(b,
- c+V);c=p(b,c+W);C.faces.push(new THREE.Face4(e,f,h,k,null,null,C.materials[c]))}function z(c){var e,f,h,k,t,u,v,w;e=m(b,c);f=m(b,c+O);h=m(b,c+X);k=m(b,c+V);t=p(b,c+W);u=m(b,c+o);v=m(b,c+ea);w=m(b,c+T);c=m(b,c+na);t=C.materials[t];var x=G[v*3],K=G[v*3+1];v=G[v*3+2];var y=G[w*3],S=G[w*3+1];w=G[w*3+2];var z=G[c*3],B=G[c*3+1],c=G[c*3+2];C.faces.push(new THREE.Face4(e,f,h,k,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,K,v),new THREE.Vector3(y,S,w),new THREE.Vector3(z,B,c)],null,t))}
- function y(c){var e,f,h,k;e=m(b,c);f=m(b,c+aa);h=m(b,c+ha);c=M[e*2];k=M[e*2+1];e=M[f*2];var o=C.faceVertexUvs[0];f=M[f*2+1];var p=M[h*2];h=M[h*2+1];var t=[];t.push(new THREE.UV(c,k));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}function B(c){var e,f,h,k,o,p;e=m(b,c);f=m(b,c+ca);h=m(b,c+qa);k=m(b,c+fa);c=M[e*2];o=M[e*2+1];e=M[f*2];p=M[f*2+1];f=M[h*2];var t=C.faceVertexUvs[0];h=M[h*2+1];var u=M[k*2];k=M[k*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
- h));v.push(new THREE.UV(u,k));t.push(v)}var C=this,E=0,F,G=[],M=[],P,L,A,J,Z,I,O,X,V,W,o,ea,T,na,aa,ha,ca,qa,fa,da,U,$,ga,ka,ua;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);F={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:m(b,E+16),nnormals:m(b,E+16+4),nuvs:m(b,
- E+16+8),ntri_flat:m(b,E+16+12),ntri_smooth:m(b,E+16+16),ntri_flat_uv:m(b,E+16+20),ntri_smooth_uv:m(b,E+16+24),nquad_flat:m(b,E+16+28),nquad_smooth:m(b,E+16+32),nquad_flat_uv:m(b,E+16+36),nquad_smooth_uv:m(b,E+16+40)};E+=F.header_bytes;P=F.vertex_index_bytes;L=F.vertex_index_bytes*2;A=F.vertex_index_bytes*3;J=F.vertex_index_bytes*3+F.material_index_bytes;Z=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes;I=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*2;O=F.vertex_index_bytes;
- X=F.vertex_index_bytes*2;V=F.vertex_index_bytes*3;W=F.vertex_index_bytes*4;o=F.vertex_index_bytes*4+F.material_index_bytes;ea=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes;T=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*2;na=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*3;aa=F.uv_index_bytes;ha=F.uv_index_bytes*2;ca=F.uv_index_bytes;qa=F.uv_index_bytes*2;fa=F.uv_index_bytes*3;c=F.vertex_index_bytes*3+F.material_index_bytes;ua=F.vertex_index_bytes*
- 4+F.material_index_bytes;da=F.ntri_flat*c;U=F.ntri_smooth*(c+F.normal_index_bytes*3);$=F.ntri_flat_uv*(c+F.uv_index_bytes*3);ga=F.ntri_smooth_uv*(c+F.normal_index_bytes*3+F.uv_index_bytes*3);ka=F.nquad_flat*ua;c=F.nquad_smooth*(ua+F.normal_index_bytes*4);ua=F.nquad_flat_uv*(ua+F.uv_index_bytes*4);E+=function(c){for(var f,h,m,n=F.vertex_coordinate_bytes*3,o=c+F.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+F.vertex_coordinate_bytes),m=e(b,c+F.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
- h,m)));return F.nvertices*n}(E);E+=function(c){for(var e,f,h,k=F.normal_coordinate_bytes*3,m=c+F.nnormals*k;c<m;c+=k)e=u(b,c),f=u(b,c+F.normal_coordinate_bytes),h=u(b,c+F.normal_coordinate_bytes*2),G.push(e/127,f/127,h/127);return F.nnormals*k}(E);E+=function(c){for(var f,h,m=F.uv_coordinate_bytes*2,n=c+F.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+F.uv_coordinate_bytes),M.push(f,h);return F.nuvs*m}(E);da=E+da;U=da+U;$=U+$;ga=$+ga;ka=ga+ka;c=ka+c;ua=c+ua;(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes,
- f=e+F.uv_index_bytes*3,h=b+F.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),y(c+e);return h-b})(U);(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*3,f=e+F.uv_index_bytes*3,h=b+F.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),y(c+e);return h-b})($);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes,f=e+F.uv_index_bytes*4,h=b+F.nquad_flat_uv*f;for(c=b;c<h;c+=f)v(c),B(c+e);return h-b})(c);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*
- 4,f=e+F.uv_index_bytes*4,h=b+F.nquad_smooth_uv*f;for(c=b;c<h;c+=f)z(c),B(c+e);return h-b})(ua);(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes,f=b+F.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(E);(function(b){var c,e=F.vertex_index_bytes*3+F.material_index_bytes+F.normal_index_bytes*3,f=b+F.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(da);(function(b){var c,e=F.vertex_index_bytes*4+F.material_index_bytes,f=b+F.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(ga);(function(b){var c,
- e=F.vertex_index_bytes*4+F.material_index_bytes+F.normal_index_bytes*4,f=b+F.nquad_smooth*e;for(c=b;c<f;c+=e)z(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m(e))};
- THREE.ColladaLoader=function(){function b(b,c,e){for(var b=da.evaluate(b,da,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in la)for(var h=la[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function e(b,c,f,h){b.world=b.world||
- new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=N[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=$.getChildById(f.skeleton[0],!0)||$.getChildBySid(f.skeleton[0],
- !0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
- for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var B=o.weights[y][z];B.joint==v&&p.weights.push(B)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function m(b){var c=new THREE.Object3D,
- e,h,k;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(k=0;k<b.controllers.length;k++){var n=N[b.controllers[k].url];switch(n.type){case "skin":if(ma[n.skin.source]){var o=new z;o.url=n.skin.source;o.instance_material=b.controllers[k].instance_material;b.geometries.push(o);e=b.controllers[k]}else if(N[n.skin.source]&&(h=n=N[n.skin.source],n.morph&&ma[n.morph.source]))o=new z,o.url=n.morph.source,o.instance_material=b.controllers[k].instance_material,b.geometries.push(o);break;case "morph":if(ma[n.morph.source])o=
- new z,o.url=n.morph.source,o.instance_material=b.controllers[k].instance_material,b.geometries.push(o),h=b.controllers[k];console.log("DAE: morph-controller partially supported.")}}for(k=0;k<b.geometries.length;k++){var n=b.geometries[k],o=n.instance_material,n=ma[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=wa[ra[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
- v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)f(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=N[e.url],o.skinInstanceController=e,o.name="skin_"+Ca.length,Ca.push(o);else if(h!==void 0){p=n;t=h instanceof x?N[h.url]:h;if(!t||!t.morph)console.log("could not find morph controller!");
- else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=ma[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Aa.length;Aa.push(o)}else o=new THREE.Mesh(n,o);c.add(o)}}for(k=0;k<b.nodes.length;k++)c.add(m(b.nodes[k],b));return c}function h(){this.init_from=
- this.id=""}function k(){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 w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=
- this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function v(){this.target=this.symbol=""}function z(){this.url="";this.instance_material=[]}function y(){this.id="";this.mesh=null}function B(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function F(){this.source="";
- this.stride=this.count=0;this.params=[]}function G(){this.input={}}function M(){this.semantic="";this.offset=0;this.source="";this.set=0}function P(b){this.id=b;this.type=null}function L(){this.name=this.id="";this.instance_effect=null}function A(){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 J(b,c){this.type=b;this.effect=c;this.material=null}function Z(b){this.effect=b;this.format=this.init_from=
- null}function I(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function O(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function X(){this.url=""}function V(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
- this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(b){var c=b.getAttribute("id");if(ka[c]!=void 0)return ka[c];ka[c]=(new P(c)).parse(b);return ka[c]}function T(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function na(b){for(var b=ha(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function aa(b){for(var b=ha(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function ha(b){return b.replace(/^\s+/,"").replace(/\s+$/,
- "").split(/\s+/)}function ca(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function qa(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function fa(b,c){var e="";e+=qa(b.x,c)+",";e+=qa(b.y,c)+",";e+=qa(b.z,c);return e}var da=null,U=null,$,ga=null,ka={},ua={},la={},N={},ma={},ra={},wa={},Da,Ea,Aa,Ca,Ga=THREE.SmoothShading;h.prototype.parse=function(b){this.id=
- b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};k.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new p).parse(e);this.type=e.nodeName;break;case "morph":this.morph=(new n).parse(e),this.type=e.nodeName}}return this};n.prototype.parse=function(b){var c=
- {},e=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new P).parse(h);c[h.id]=h;break;case "targets":e=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<e.length;f++)switch(b=e[f],h=c[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
- function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new M).parse(f))}}return c};p.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=na(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
- k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new P).parse(k);c[k.id]=k;break;case "joints":e=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(e,c);this.parseWeights(f,c);return this};p.prototype.parseJoints=function(b,c){for(var e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new M).parse(f),h=c[f.source];if(f.semantic=="JOINT")this.joints=
- h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,c){for(var e,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new M).parse(m));break;case "v":e=aa(m.textContent);break;case "vcount":f=aa(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=e[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
- case "WEIGHT":t.weight=c[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};u.prototype.getChildById=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};u.prototype.getChildBySid=function(b,c){for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};u.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
- this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e))}}return this};w.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
- ""))}if(h==b)return e.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},e}return null};w.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};w.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
- b)return this.transforms[c];return null};w.prototype.parse=function(b){var c;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.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 e=0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c));break;case "instance_camera":break;
- case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new z).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=da.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",da,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(c));
- break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in la)for(var h=la[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+
- 1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,u,o=0;o<p.input.length-1;o++)if(p.input[o+1]>c){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,
- c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};t.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=na(b.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var b=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":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
- x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=da.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=e.iterateNext()}}return this};
- v.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=da.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new v).parse(c)),
- c=b.iterateNext();break}}return this};y.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new B(this)).parse(e)}}return this};B.prototype.parse=function(b){function c(b,e){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
- (new G).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new C).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ka[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(k,b);this.geometry3js.vertices.push(k)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),
- this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};B.prototype.handlePrimitive=function(b,c,e){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},B=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
- n[k],source=ka[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=fa(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]);z[o.set].push(new THREE.UV(source.data[t],source.data[t+1]));break;case "COLOR":B.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var A;v==
- 3?A=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],B.length?B:new THREE.Color):v==4&&(A=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],B.length?B:new THREE.Color));A.daeMaterial=b.material;c.faces.push(A);for(k=0;k<w.length;k++)h=z[w[k]],c.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};C.prototype=new E;C.prototype.constructor=C;E.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};
- E.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ca(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new M).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};F.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ca(b,"count",0);this.stride=ca(b,"stride",0);for(var c=
- 0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};G.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new M).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};M.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
- "");this.set=ca(b,"set",-1);this.offset=ca(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};P.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "bool_array":for(var f=ha(e.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=e.nodeName;break;case "float_array":this.data=na(e.textContent);this.type=e.nodeName;break;case "int_array":this.data=
- aa(e.textContent);this.type=e.nodeName;break;case "IDREF_array":case "Name_array":this.data=ha(e.textContent);this.type=e.nodeName;break;case "technique_common":for(f=0;f<e.childNodes.length;f++)if(e.childNodes[f].nodeName=="accessor"){this.accessor=(new F).parse(e.childNodes[f]);break}}}return this};P.prototype.read=function(){var b=[],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 e=
- this.data.slice(c,c+16),f=new THREE.Matrix4;f.set(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+c.type)}return b};L.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var c=0;c<b.childNodes.length;c++)if(b.childNodes[c].nodeName=="instance_effect"){this.instance_effect=(new X).parse(b.childNodes[c]);break}return this};A.prototype.isColor=
- function(){return this.texture==null};A.prototype.isTexture=function(){return this.texture!=null};A.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "color":e=na(e.textContent);this.color=new THREE.Color(0);this.color.setRGB(e[0],e[1],e[2]);this.color.a=e[3];break;case "texture":this.texture=e.getAttribute("texture"),this.texcoord=e.getAttribute("texcoord")}}return this};J.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=
- b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[e.nodeName]=(new A).parse(e);break;case "shininess":case "reflectivity":case "transparency":var f;f=da.evaluate(".//dae:float",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[e.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};J.prototype.create=function(){var b=
- {},c=this.transparency!==void 0&&this.transparency<1,e;for(e in this)switch(e){case "ambient":case "emission":case "diffuse":case "specular":var f=this[e];if(f instanceof A)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ua[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else e=="diffuse"?b.color=
- f.color.getHex():c||(b[e]=f.color.getHex());break;case "shininess":case "reflectivity":b[e]=this[e];break;case "transparency":if(c)b.transparent=!0,b.opacity=this[e],c=!0}b.shading=Ga;return this.material=new THREE.MeshLambertMaterial(b)};Z.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "init_from":this.init_from=e.textContent;break;case "format":this.format=e.textContent;break;default:console.log("unhandled Surface prop: "+
- e.nodeName)}}return this};I.prototype.parse=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":this.source=e.textContent;break;case "minfilter":this.minfilter=e.textContent;break;case "magfilter":this.magfilter=e.textContent;break;case "mipfilter":this.mipfilter=e.textContent;break;case "wrap_s":this.wrap_s=e.textContent;break;case "wrap_t":this.wrap_t=e.textContent;break;default:console.log("unhandled Sampler2D prop: "+e.nodeName)}}return this};
- O.prototype.create=function(){if(this.shader==null)return null};O.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(e))}}return this};O.prototype.parseNewparam=function(b){for(var c=b.getAttribute("sid"),e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
- (new Z(this)).parse(f);this.surface.sid=c;break;case "sampler2D":this.sampler=(new I(this)).parse(f);this.sampler.sid=c;break;case "extra":break;default:console.log(f.nodeName)}}};O.prototype.parseProfileCOMMON=function(b){for(var c,e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":c=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return c};
- O.prototype.parseTechnique=function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new J(e.nodeName,this)).parse(e)}}};X.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};V.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "source":e=
- (new P).parse(e);this.source[e.id]=e;break;case "sampler":this.sampler.push((new o(this)).parse(e));break;case "channel":this.channel.push((new W(this)).parse(e))}}return this};W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var c=this.target.split("/");c.shift();var b=c.shift(),e=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(e)c=b.split("."),b=c.shift(),k=c.shift();else if(f){h=b.split("(");b=h.shift();for(c=0;c<h.length;c++)h[c]=
- parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new M).parse(e))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=
- e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.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(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&
- document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){ga=f;var o,p=e;da=n.responseXML;o=ga;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ua=b("//dae:library_images/dae:image",h,"image");ra=b("//dae:library_materials/dae:material",
- L,"material");wa=b("//dae:library_effects/dae:effect",O,"effect");ma=b("//dae:library_geometries/dae:geometry",y,"geometry");N=b("//dae:library_controllers/dae:controller",k,"controller");la=b("//dae:library_animations/dae:animation",V,"animation");Da=b(".//dae:library_visual_scenes/dae:visual_scene",u,"visual_scene");Aa=[];Ca=[];(p=da.evaluate(".//dae:scene/dae:instance_visual_scene",da,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),$=Da[p]):
- $=null;U=new THREE.Object3D;for(p=0;p<$.nodes.length;p++)U.add(m($.nodes[p]));c();for(var t in la);t={scene:U,morphs:Aa,skins:Ca,dae:{images:ua,materials:ra,effects:wa,geometries:ma,controllers:N,animations:la,visualScenes:Da,scene:$}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Ga=b},applySkin:f,geometries:ma}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
- THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,m=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,m);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
- THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,m=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,m,p,u,w,t,x,v,z,y,B,C,E,F,G=b.faces;t=b.vertices;var M=b.normals,P=b.colors,L=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&L++;for(e=0;e<L;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];u=0;for(w=t.length;u<w;)x=new THREE.Vertex,x.position.x=t[u++]*c,x.position.y=
- t[u++]*c,x.position.z=t[u++]*c,f.vertices.push(x);u=0;for(w=G.length;u<w;){c=G[u++];t=c&1;p=c&2;e=c&4;m=c&8;v=c&16;x=c&32;y=c&64;c&=128;t?(B=new THREE.Face4,B.a=G[u++],B.b=G[u++],B.c=G[u++],B.d=G[u++],t=4):(B=new THREE.Face3,B.a=G[u++],B.b=G[u++],B.c=G[u++],t=3);if(p)p=G[u++],B.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<L;e++)C=b.uvs[e],z=G[u++],F=C[z*2],z=C[z*2+1],f.faceUvs[e][p]=new THREE.UV(F,z);if(m)for(e=0;e<L;e++){C=b.uvs[e];E=[];for(m=0;m<t;m++)z=G[u++],F=C[z*2],z=C[z*2+1],E[m]=
- new THREE.UV(F,z);f.faceVertexUvs[e][p]=E}if(v)v=G[u++]*3,m=new THREE.Vector3,m.x=M[v++],m.y=M[v++],m.z=M[v],B.normal=m;if(x)for(e=0;e<t;e++)v=G[u++]*3,m=new THREE.Vector3,m.x=M[v++],m.y=M[v++],m.z=M[v],B.vertexNormals.push(m);if(y)x=G[u++],x=new THREE.Color(P[x]),B.color=x;if(c)for(e=0;e<t;e++)x=G[u++],x=new THREE.Color(P[x]),B.vertexColors.push(x);f.faces.push(B)}}})(m);(function(){var c,e,m,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)m=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(m,
- p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)m=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(m,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,m,p,u,w,t,x,v,z;e=0;for(m=b.morphTargets.length;e<m;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;z=b.morphTargets[e].vertices;p=0;for(u=z.length;p<u;p+=3)w=z[p]*c,t=z[p+1]*
- c,x=z[p+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(w,t,x)))}}if(b.morphColors!==void 0){e=0;for(m=b.morphColors.length;e<m;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];u=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(p=w.length;c<p;c+=3)t=new THREE.Color(16755200),t.setRGB(w[c],w[c+1],w[c+2]),u.push(t)}}})(m);(function(){if(b.edges!==void 0){var c,e,m;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],m=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
- f.vertices[m],e,m))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
- THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var m=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:m+"/"+b}function n(){for(v in O.objects)if(!T.objects[v])if(E=O.objects[v],E.geometry!==void 0){if(P=T.geometries[E.geometry]){var b=!1;Z=[];for(aa=0;aa<E.materials.length;aa++)Z[aa]=T.materials[E.materials[aa]],b=Z[aa]instanceof THREE.ShaderMaterial;b&&P.computeTangents();F=E.position;r=E.rotation;
- q=E.quaternion;s=E.scale;q=0;Z.length==0&&(Z[0]=new THREE.MeshFaceMaterial);Z.length>1&&(Z=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(P,Z);object.name=v;object.position.set(F[0],F[1],F[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=E.visible;T.scene.add(object);T.objects[v]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
- if(E.castsShadow)b=new THREE.ShadowVolume(P),T.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else F=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(F[0],F[1],F[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=E.visible!==void 0?E.visible:!1,T.scene.add(object),T.objects[v]=object,T.empties[v]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function p(b){return function(c){T.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function u(b){return function(c){T.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-V,loadedTextures:ea-W},T);e.onLoadProgress();V==0&&W==0&&c(T)}var t,
- x,v,z,y,B,C,E,F,G,M,P,L,A,J,Z,I,O,X,V,W,o,ea,T;O=b.data;J=new THREE.BinaryLoader;X=new THREE.JSONLoader;W=V=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in O.objects)if(E=O.objects[v],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(O.transform){b=O.transform.position;G=O.transform.rotation;var na=O.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);G&&T.scene.rotation.set(G[0],
- G[1],G[2]);na&&T.scene.scale.set(na[0],na[1],na[2]);(b||G||na)&&T.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(y in O.cameras){G=O.cameras[y];if(G.type=="perspective")L=new THREE.Camera(G.fov,G.aspect,G.near,G.far);else if(G.type=="ortho")L=new THREE.Camera,L.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);F=G.position;G=G.target;L.position.set(F[0],F[1],F[2]);L.target.position.set(G[0],G[1],G[2]);T.cameras[y]=L}for(z in O.lights)y=O.lights[z],
- L=y.color!==void 0?y.color:16777215,G=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(F=y.direction,I=new THREE.DirectionalLight(L,G),I.position.set(F[0],F[1],F[2]),I.position.normalize()):y.type=="point"?(F=y.position,d=y.distance,I=new THREE.PointLight(L,G,d),I.position.set(F[0],F[1],F[2])):y.type=="ambient"&&(I=new THREE.AmbientLight(L)),T.scene.add(I),T.lights[z]=I;for(B in O.fogs)z=O.fogs[B],z.type=="linear"?A=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(A=new THREE.FogExp2(0,z.density)),
- G=z.color,A.color.setRGB(G[0],G[1],G[2]),T.fogs[B]=A;if(T.cameras&&O.defaults.camera)T.currentCamera=T.cameras[O.defaults.camera];if(T.fogs&&O.defaults.fog)T.scene.fog=T.fogs[O.defaults.fog];G=O.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(G[0],G[1],G[2]);T.bgColorAlpha=O.defaults.bgalpha;for(t in O.geometries)if(B=O.geometries[t],B.type=="bin_mesh"||B.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(t in O.geometries)B=O.geometries[t],B.type=="cube"?(P=new THREE.CubeGeometry(B.width,
- B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),T.geometries[t]=P):B.type=="plane"?(P=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),T.geometries[t]=P):B.type=="sphere"?(P=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),T.geometries[t]=P):B.type=="cylinder"?(P=new THREE.CylinderGeometry(B.topRad,B.botRad,B.height,B.radSegs,B.heightSegs),T.geometries[t]=P):B.type=="torus"?(P=new THREE.TorusGeometry(B.radius,B.tube,
- B.segmentsR,B.segmentsT),T.geometries[t]=P):B.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(B.subdivisions),T.geometries[t]=P):B.type=="bin_mesh"?J.load({model:f(B.url,O.urlBaseType),callback:p(t)}):B.type=="ascii_mesh"?X.load({model:f(B.url,O.urlBaseType),callback:p(t)}):B.type=="embedded_mesh"&&(B=O.embeds[B.id])&&X.createModel(B,u(t),"");for(C in O.textures)if(t=O.textures[C],t.url instanceof Array){W+=t.url.length;for(J=0;J<t.url.length;J++)e.onLoadStart()}else W+=1,e.onLoadStart();ea=
- W;for(C in O.textures){t=O.textures[C];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){J=[];for(var aa=0;aa<t.url.length;aa++)J[aa]=f(t.url[aa],O.urlBaseType);J=THREE.ImageUtils.loadTextureCube(J,t.mapping,b)}else{J=THREE.ImageUtils.loadTexture(f(t.url,O.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)J.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)J.magFilter=THREE[t.magFilter];if(t.repeat){J.repeat.set(t.repeat[0],t.repeat[1]);
- if(t.repeat[0]!=1)J.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)J.wrapT=THREE.RepeatWrapping}t.offset&&J.offset.set(t.offset[0],t.offset[1]);if(t.wrap){X={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(X[t.wrap[0]]!==void 0)J.wrapS=X[t.wrap[0]];if(X[t.wrap[1]]!==void 0)J.wrapT=X[t.wrap[1]]}}T.textures[C]=J}for(x in O.materials){C=O.materials[x];for(M in C.parameters)if(M=="envMap"||M=="map"||M=="lightMap")C.parameters[M]=T.textures[C.parameters[M]];else if(M=="shading")C.parameters[M]=
- C.parameters[M]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(M=="blending")C.parameters[M]=THREE[C.parameters[M]]?THREE[C.parameters[M]]:THREE.NormalBlending;else if(M=="combine")C.parameters[M]=C.parameters[M]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(M=="vertexColors")if(C.parameters[M]=="face")C.parameters[M]=THREE.FaceColors;else if(C.parameters[M])C.parameters[M]=THREE.VertexColors;if(C.parameters.opacity!==void 0&&C.parameters.opacity<1)C.parameters.transparent=
- !0;if(C.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);J=C.parameters.color;X=C.parameters.specular;B=C.parameters.ambient;A=C.parameters.shininess;b.tNormal.texture=T.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)b.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)b.tDiffuse.texture=C.parameters.map,b.enableDiffuse.value=!0;if(C.parameters.lightMap)b.tAO.texture=C.parameters.lightMap,b.enableAO.value=!0;if(C.parameters.specularMap)b.tSpecular.texture=
- T.textures[C.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(J);b.uSpecularColor.value.setHex(X);b.uAmbientColor.value.setHex(B);b.uShininess.value=A;if(C.parameters.opacity)b.uOpacity.value=C.parameters.opacity;C=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);T.materials[x]=C}n();e.callbackSync(T)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
- THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
- THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,m=b.scale!==void 0?b.scale:1,h=b.offsetX!==void 0?b.offsetX:0,k=b.offsetY!==void 0?b.offsetY:0,n=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,m,h,k,n):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
- THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,m=0;m<8;m++){for(var h=0,k=0;k<c;++k){var n=b.charCodeAt(k+f);h+=n>>1^-(n&1);e[8*k+m]=h}f+=c}c=b.length-f;h=new Uint16Array(c);for(m=k=0;m<c;m++)n=b.charCodeAt(m+f),h[m]=k-n,n==0&&k++;return[e,h]};
- THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,m,h){var k=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),u=[],w=[];(function(b,k,p){for(var u,w,B,C=b.length;p<C;p+=k)u=b[p],w=b[p+1],B=b[p+2],u=u/16383*e,w=w/16383*e,B=B/16383*e,u+=f,w+=m,B+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,w,B)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,w.push(f,1-h)})(k[0],8,3);(function(b,
- c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,u.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,p,E,F,G,M=b.length;for(e=0;e<M;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;F=f;G=h;p=k;E=f;var P=h,L=k,A=m.materials[0],J=u[P*3],Z=u[P*3+1],P=u[P*3+2],I=u[L*3],O=u[L*3+1],L=u[L*3+2];E=new THREE.Vector3(u[E*3],u[E*3+1],u[E*3+2]);P=new THREE.Vector3(J,Z,P);L=new THREE.Vector3(I,O,L);m.faces.push(new THREE.Face3(F,G,p,[E,P,L],null,A));m=w[f*2];f=w[f*2+
- 1];p=w[h*2];E=w[h*2+1];F=w[k*2];G=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,p));E.push(new THREE.UV(F,G));k.push(E)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
- THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
- 0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,m){return b+(c-b)*m};this.VIntX=function(b,c,m,h,k,n,p,u,w,t){k=(k-w)/(t-w);w=this.normal_cache;c[h]=n+k*this.delta;c[h+1]=p;c[h+2]=u;m[h]=this.lerp(w[b],w[b+3],k);m[h+1]=this.lerp(w[b+1],w[b+4],k);m[h+2]=this.lerp(w[b+2],w[b+5],k)};this.VIntY=function(b,c,m,h,k,n,p,u,w,t){k=(k-w)/(t-w);w=this.normal_cache;c[h]=n;c[h+1]=p+k*this.delta;c[h+
- 2]=u;c=b+this.yd*3;m[h]=this.lerp(w[b],w[c],k);m[h+1]=this.lerp(w[b+1],w[c+1],k);m[h+2]=this.lerp(w[b+2],w[c+2],k)};this.VIntZ=function(b,c,m,h,k,n,p,u,w,t){k=(k-w)/(t-w);w=this.normal_cache;c[h]=n;c[h+1]=p;c[h+2]=u+k*this.delta;c=b+this.zd*3;m[h]=this.lerp(w[b],w[c],k);m[h+1]=this.lerp(w[b+1],w[c+1],k);m[h+2]=this.lerp(w[b+2],w[c+2],k)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
- this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,m,h,k,n){var p=h+1,u=h+this.yd,w=h+this.zd,t=p+this.yd,x=p+this.zd,v=h+this.yd+this.zd,z=p+this.yd+this.zd,y=0,B=this.field[h],C=this.field[p],E=this.field[u],F=this.field[t],G=this.field[w],M=this.field[x],P=this.field[v],L=this.field[z];B<k&&(y|=1);C<k&&(y|=2);E<k&&(y|=8);F<k&&(y|=4);G<k&&(y|=16);M<k&&(y|=32);P<k&&(y|=128);L<k&&(y|=64);var A=THREE.edgeTable[y];if(A==0)return 0;var J=this.delta,
- Z=b+J,I=c+J,J=m+J;A&1&&(this.compNorm(h),this.compNorm(p),this.VIntX(h*3,this.vlist,this.nlist,0,k,b,c,m,B,C));A&2&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,3,k,Z,c,m,C,F));A&4&&(this.compNorm(u),this.compNorm(t),this.VIntX(u*3,this.vlist,this.nlist,6,k,b,I,m,E,F));A&8&&(this.compNorm(h),this.compNorm(u),this.VIntY(h*3,this.vlist,this.nlist,9,k,b,c,m,B,E));A&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,k,b,c,J,G,M));A&32&&(this.compNorm(x),
- this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,k,Z,c,J,M,L));A&64&&(this.compNorm(v),this.compNorm(z),this.VIntX(v*3,this.vlist,this.nlist,18,k,b,I,J,P,L));A&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,k,b,c,J,G,P));A&256&&(this.compNorm(h),this.compNorm(w),this.VIntZ(h*3,this.vlist,this.nlist,24,k,b,c,m,B,G));A&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,k,Z,c,m,C,M));A&1024&&(this.compNorm(t),this.compNorm(z),this.VIntZ(t*
- 3,this.vlist,this.nlist,30,k,Z,I,m,F,L));A&2048&&(this.compNorm(u),this.compNorm(v),this.VIntZ(u*3,this.vlist,this.nlist,33,k,b,I,m,E,P));y<<=4;for(k=h=0;THREE.triTable[y+k]!=-1;)b=y+k,c=b+1,m=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[m],n),k+=3,h++;return h};this.posnormtriv=function(b,c,m,h,k,n){var p=this.count*3;this.positionArray[p]=b[m];this.positionArray[p+1]=b[m+1];this.positionArray[p+2]=b[m+2];this.positionArray[p+3]=b[h];this.positionArray[p+
- 4]=b[h+1];this.positionArray[p+5]=b[h+2];this.positionArray[p+6]=b[k];this.positionArray[p+7]=b[k+1];this.positionArray[p+8]=b[k+2];this.normalArray[p]=c[m];this.normalArray[p+1]=c[m+1];this.normalArray[p+2]=c[m+2];this.normalArray[p+3]=c[h];this.normalArray[p+4]=c[h+1];this.normalArray[p+5]=c[h+2];this.normalArray[p+6]=c[k];this.normalArray[p+7]=c[k+1];this.normalArray[p+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(this)};this.begin=function(){this.count=0;
- this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,m,h,k){var n=this.size*Math.sqrt(h/k),p=m*this.size,u=c*this.size,w=b*this.size,t=Math.floor(p-n);t<1&&(t=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
- 1);for(var z,y,B,C,E,F;t<p;t++){w=this.size2*t;y=t/this.size-m;E=y*y;for(y=x;y<u;y++){B=w+this.size*y;z=y/this.size-c;F=z*z;for(z=v;z<n;z++)C=z/this.size-b,C=h/(1.0E-6+C*C+F+E)-k,C>0&&(this.field[B+z]+=C)}}};this.addPlaneX=function(b,c){var m,h,k,n,p,u=this.size,w=this.yd,t=this.zd,x=this.field,v=u*Math.sqrt(b/c);v>u&&(v=u);for(m=0;m<v;m++)if(h=m/u,h*=h,n=b/(1.0E-4+h)-c,n>0)for(h=0;h<u;h++){p=m+h*w;for(k=0;k<u;k++)x[t*k+p]+=n}};this.addPlaneY=function(b,c){var m,h,k,n,p,u,w=this.size,t=this.yd,x=
- this.zd,v=this.field,z=w*Math.sqrt(b/c);z>w&&(z=w);for(h=0;h<z;h++)if(m=h/w,m*=m,n=b/(1.0E-4+m)-c,n>0){p=h*t;for(m=0;m<w;m++){u=p+m;for(k=0;k<w;k++)v[x*k+u]+=n}}};this.addPlaneZ=function(b,c){var m,h,k,n,p,u;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(m=k/size,m*=m,n=b/(1.0E-4+m)-c,n>0){p=zd*k;for(h=0;h<size;h++){u=p+h*yd;for(m=0;m<size;m++)field[u+m]+=n}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
- 3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,m,h,k,n,p,u,w,t,x=this.size-2;for(k=1;k<x;k++){t=this.size2*k;u=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++){w=t+this.size*h;p=(h-this.halfsize)/this.halfsize;for(m=1;m<x;m++)n=(m-this.halfsize)/this.halfsize,c=w+m,this.polygonize(n,p,u,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,m=[];this.render(function(h){var k,n,p,u,w,t,x,v;for(k=0;k<h.count;k++)x=k*3,w=x+1,v=x+2,n=h.positionArray[x],
- p=h.positionArray[w],u=h.positionArray[v],t=new THREE.Vector3(n,p,u),n=h.normalArray[x],p=h.normalArray[w],u=h.normalArray[v],x=new THREE.Vector3(n,p,u),x.normalize(),w=new THREE.Vertex(t),c.vertices.push(w),m.push(x);nfaces=h.count/3;for(k=0;k<nfaces;k++)x=(b+k)*3,w=x+1,v=x+2,t=m[x],n=m[w],p=m[v],x=new THREE.Face3(x,w,v,[t,n,p]),c.faces.push(x);b+=nfaces;h.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
- THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
- 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
- 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
- THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
- -1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
- 8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
- -1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
- 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
- -1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
- 10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
- 6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
- 8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
- 2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
- -1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
- -1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
- -1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- 1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
- -1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
- 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
- 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
- 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
- THREE.Trident=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));
- this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};
- THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=!0;this.normal=new THREE.Vector3};THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;
- THREE.CollisionSystem.prototype.merge=function(b){Array.prototype.push.apply(this.colliders,b.colliders);Array.prototype.push.apply(this.hits,b.hits)};THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,m,h=0;c=0;for(e=this.colliders.length;c<e;c++)if(m=this.colliders[c],f=this.rayCast(b,m),f<Number.MAX_VALUE)m.distance=f,f>h?this.hits.push(m):this.hits.unshift(m),h=f;return this.hits};
- THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
- THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
- THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,m,h=0;h<c.numFaces;h++){var k=c.mesh.geometry.faces[h],n=c.mesh.geometry.vertices[k.a].position,p=c.mesh.geometry.vertices[k.b].position,u=c.mesh.geometry.vertices[k.c].position,w=k instanceof THREE.Face4?c.mesh.geometry.vertices[k.d].position:null;k instanceof THREE.Face3?(k=this.rayTriangle(e,n,p,u,f,this.collisionNormal,c.mesh),k<f&&(f=k,m=h,c.normal.copy(this.collisionNormal),c.normal.normalize())):
- k instanceof THREE.Face4&&(k=this.rayTriangle(e,n,p,w,f,this.collisionNormal,c.mesh),k<f&&(f=k,m=h,c.normal.copy(this.collisionNormal),c.normal.normalize()),k=this.rayTriangle(e,p,u,w,f,this.collisionNormal,c.mesh),k<f&&(f=k,m=h,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:m}};
- THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,m,h,k){var n=THREE.CollisionSystem.__v1,p=THREE.CollisionSystem.__v2;h.set(0,0,0);n.sub(e,c);p.sub(f,e);h.cross(n,p);n=h.dot(b.direction);if(!(n<0))if(k.doubleSided||k.flipSided)h.multiplyScalar(-1),n*=-1;else return Number.MAX_VALUE;k=h.dot(c)-h.dot(b.origin);if(!(k<=0))return Number.MAX_VALUE;if(!(k>=n*m))return Number.MAX_VALUE;k/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(k);n.addSelf(b.origin);Math.abs(h.x)>
- Math.abs(h.y)?Math.abs(h.x)>Math.abs(h.z)?(b=n.y-c.y,h=e.y-c.y,m=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,h=e.x-c.x,m=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(h.y)>Math.abs(h.z)?(b=n.x-c.x,h=e.x-c.x,m=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,h=e.x-c.x,m=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=h*f-e*m;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*m)*c;if(!(f>=0))return Number.MAX_VALUE;c*=h*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return k};
- THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
- THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,m=0,h=0,k=0,n=0,p=0,u=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,u=!1,k=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,u=!1,k=1);e.origin.y<c.min.y?(m=c.min.y-e.origin.y,m/=e.direction.y,u=!1,n=-1):e.origin.y>c.max.y&&(m=c.max.y-e.origin.y,m/=e.direction.y,
- u=!1,n=1);e.origin.z<c.min.z?(h=c.min.z-e.origin.z,h/=e.direction.z,u=!1,p=-1):e.origin.z>c.max.z&&(h=c.max.z-e.origin.z,h/=e.direction.z,u=!1,p=1);if(u)return-1;u=0;m>f&&(u=1,f=m);h>f&&(u=2,f=h);switch(u){case 0:n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(k,0,0);break;case 1:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
- f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:k=e.origin.x+e.direction.x*f;if(k<c.min.x||k>c.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,p)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
- THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
- THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
- THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
- if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,m=new THREE.Camera,h=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,p,u,w;m.useTarget=h.useTarget=!1;m.matrixAutoUpdate=h.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
- 2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},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 z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||u!==e.near||w!==e.fov){p=e.aspect;u=e.near;w=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,F=E*u/125,G=u*Math.tan(w*Math.PI/360),M;k.n14=E;n.n14=-E;E=-G*p+F;M=G*p+F;C.n11=2*u/(M-E);C.n13=(M+E)/(M-E);m.projectionMatrix=C.clone();E=-G*p-F;M=G*p-F;C.n11=2*u/(M-E);C.n13=
- (M+E)/(M-E);h.projectionMatrix=C.clone()}m.matrix=e.matrixWorld.clone().multiplySelf(n);m.update(null,!0);m.position.copy(e.position);m.near=u;m.far=e.far;f.call(c,b,m,t,!0);h.matrix=e.matrixWorld.clone().multiplySelf(k);h.update(null,!0);h.position.copy(e.position);h.near=u;h.far=e.far;f.call(c,b,h,x,!0);f.call(c,z,v)}};
- if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,m,h,k=new THREE.Camera,n=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);m=b/2;h=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;
- k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,m,h);f.call(c,b,k);this.setViewport(m,0,m,h);f.call(c,b,n,!1)}};
|