var THREE=THREE||{REVISION:"48"};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;
(function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"CancelRequestAnimationFrame"];if(!window.requestAnimationFrame)window.requestAnimationFrame=function(b){var c=(new Date).getTime(),g=Math.max(0,16-(c-a)),e=window.setTimeout(function(){b(c+g)},g);a=c+g;return e};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=
function(a){clearTimeout(a)}})();THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var b=Date.now(),a=0.0010*(b-this.oldTime);this.oldTime=b;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
this.b=Math.sqrt(this.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,f,g;if(c===0)this.r=this.g=this.b=0;else switch(d=Math.floor(a*6),f=a*6-d,a=c*(1-b),g=c*(1-b*f),b=c*(1-b*(1-f)),d){case 1:this.r=g;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=g;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=g;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=
Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return Math.floor(this.r*255)<<16^Math.floor(this.g*255)<<8^Math.floor(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;return this},cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},getPositionFromMatrix:function(a){this.x=
a.n14;this.y=a.n24;this.z=a.n34;return this},getRotationFromMatrix:function(a,b){var c=b?b.x:1,d=b?b.y:1,f=b?b.z:1,g=a.n11/c,e=a.n12/d,c=a.n21/c,d=a.n22/d,h=a.n23/f,i=a.n33/f;this.y=Math.asin(a.n13/f);f=Math.cos(this.y);Math.abs(f)>1.0E-5?(this.x=Math.atan2(-h/f,i/f),this.z=Math.atan2(-e/f,g/f)):(this.x=0,this.z=Math.atan2(c,d));return this},getScaleFromMatrix:function(a){var b=this.set(a.n11,a.n21,a.n31).length(),c=this.set(a.n12,a.n22,a.n32).length(),a=this.set(a.n13,a.n23,a.n33).length();this.x=
b;this.y=c;this.z=a},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},isZero:function(){return this.lengthSq()<1.0E-4}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1;return this},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;
this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),f=0;f<6;f++)if(a=b[f].x*c.n14+b[f].y*c.n24+b[f].z*c.n34+b[f].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
THREE.Ray=function(a,b){function c(a,b,c){s.sub(c,a);r=s.dot(b);t=m.add(a,p.copy(b).multiplyScalar(r));return v=c.distanceTo(t)}function d(a,b,c,d){s.sub(d,b);m.sub(c,b);p.sub(a,b);u=s.dot(s);w=s.dot(m);y=s.dot(p);F=m.dot(m);D=m.dot(p);G=1/(u*F-w*w);I=(F*y-w*D)*G;K=(u*D-w*y)*G;return I>=0&&K>=0&&I+K<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectObjects=function(a){var b,c,d=[];for(b=0,c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));
d.sort(function(a,b){return a.distance-b.distance});return d};var f=1.0E-4;this.setPrecision=function(a){f=a};var g=new THREE.Vector3,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3,q=new THREE.Vector3,n=new THREE.Vector3,o=new THREE.Vector3;this.intersectObject=function(a){var b,m=[];if(a instanceof THREE.Particle){var s=c(this.origin,this.direction,a.matrixWorld.getPosition());if(s>a.scale.x)return[];b={distance:s,point:a.position,face:null,object:a};
m.push(b)}else if(a instanceof THREE.Mesh){var s=c(this.origin,this.direction,a.matrixWorld.getPosition()),p=THREE.Frustum.__v1.set(a.matrixWorld.getColumnX().length(),a.matrixWorld.getColumnY().length(),a.matrixWorld.getColumnZ().length());if(s>a.geometry.boundingSphere.radius*Math.max(p.x,Math.max(p.y,p.z)))return m;var r,l,t=a.geometry,u=t.vertices,z;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(s=0,p=t.faces.length;s<p;s++)if(b=t.faces[s],j.copy(this.origin),k.copy(this.direction),
z=a.matrixWorld,q=z.multiplyVector3(q.copy(b.centroid)).subSelf(j),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),r=k.dot(n),!(Math.abs(r)<f)&&(l=n.dot(q)/r,!(l<0)&&(a.doubleSided||(a.flipSided?r>0:r<0))))if(o.add(j,k.multiplyScalar(l)),b instanceof THREE.Face3)g=z.multiplyVector3(g.copy(u[b.a].position)),e=z.multiplyVector3(e.copy(u[b.b].position)),h=z.multiplyVector3(h.copy(u[b.c].position)),d(o,g,e,h)&&(b={distance:j.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b));else if(b instanceof
THREE.Face4&&(g=z.multiplyVector3(g.copy(u[b.a].position)),e=z.multiplyVector3(e.copy(u[b.b].position)),h=z.multiplyVector3(h.copy(u[b.c].position)),i=z.multiplyVector3(i.copy(u[b.d].position)),d(o,g,e,i)||d(o,e,h,i)))b={distance:j.distanceTo(o),point:o.clone(),face:b,object:a},m.push(b)}return m};var s=new THREE.Vector3,m=new THREE.Vector3,p=new THREE.Vector3,r,t,v,u,w,y,F,D,G,I,K};
THREE.Rectangle=function(){function a(){g=d-b;e=f-c}var b,c,d,f,g,e,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return e};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(g,e,k,q){h=!1;b=g;c=e;d=k;f=q;a()};this.addPoint=function(g,e){h?(h=!1,b=g,c=e,d=g,f=e):(b=b<g?b:g,c=c<e?c:e,d=d>g?d:g,f=f>e?f:e);a()};this.add3Points=
function(g,e,k,q,n,o){h?(h=!1,b=g<k?g<n?g:n:k<n?k:n,c=e<q?e<o?e:o:q<o?q:o,d=g>k?g>n?g:n:k>n?k:n,f=e>q?e>o?e:o:q>o?q:o):(b=g<k?g<n?g<b?g:b:n<b?n:b:k<n?k<b?k:b:n<b?n:b,c=e<q?e<o?e<c?e:c:o<c?o:c:q<o?q<c?q:c:o<c?o:c,d=g>k?g>n?g>d?g:d:n>d?n:d:k>n?k>d?k:d:n>d?n:d,f=e>q?e>o?e>f?e:f:o>f?o:f:q>o?q>f?q:f:o>f?o:f);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),f=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),f=f>
g.getBottom()?f:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;f+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();f=f<g.getBottom()?f:g.getBottom();a()};this.intersects=function(a){return d<a.getLeft()?!1:b>a.getRight()?!1:f<a.getTop()?!1:c>a.getBottom()?!1:!0};this.empty=function(){h=!0;f=d=c=b=0;a()};this.isEmpty=function(){return h}};
THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,f){return d+(a-b)*(f-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())},sign:function(a){return a<0?-1:a>0?1:0}};THREE.Matrix3=function(){this.m=[]};
THREE.Matrix3.prototype={constructor:THREE.Matrix3,transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};THREE.Matrix4=function(a,b,c,d,f,g,e,h,i,j,k,q,n,o,s,m){this.set(a!==void 0?a:1,b||0,c||0,d||0,f||0,g!==void 0?g:1,e||0,h||0,i||0,j||0,k!==void 0?k:1,q||0,n||0,o||0,s||0,m!==void 0?m:1);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,f,g,e,h,i,j,k,q,n,o,s,m){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=e;this.n24=h;this.n31=i;this.n32=j;this.n33=k;this.n34=q;this.n41=n;this.n42=o;this.n43=s;this.n44=m;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());f.cross(g,d);this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,e=a.n21,h=a.n22,i=a.n23,j=a.n24,k=a.n31,q=a.n32,n=a.n33,o=a.n34,s=a.n41,m=a.n42,p=a.n43,r=a.n44,t=b.n11,
v=b.n12,u=b.n13,w=b.n14,y=b.n21,F=b.n22,D=b.n23,G=b.n24,I=b.n31,K=b.n32,Q=b.n33,N=b.n34,B=b.n41,O=b.n42,S=b.n43,A=b.n44;this.n11=c*t+d*y+f*I+g*B;this.n12=c*v+d*F+f*K+g*O;this.n13=c*u+d*D+f*Q+g*S;this.n14=c*w+d*G+f*N+g*A;this.n21=e*t+h*y+i*I+j*B;this.n22=e*v+h*F+i*K+j*O;this.n23=e*u+h*D+i*Q+j*S;this.n24=e*w+h*G+i*N+j*A;this.n31=k*t+q*y+n*I+o*B;this.n32=k*v+q*F+n*K+o*O;this.n33=k*u+q*D+n*Q+o*S;this.n34=k*w+q*G+n*N+o*A;this.n41=s*t+m*y+p*I+r*B;this.n42=s*v+m*F+p*K+r*O;this.n43=s*u+m*D+p*Q+r*S;this.n44=
s*w+m*G+p*N+r*A;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;
this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*
d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+
this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,e=this.n23,h=this.n24,i=this.n31,j=this.n32,k=this.n33,q=this.n34,n=this.n41,o=this.n42,s=this.n43,m=this.n44;return d*e*j*n-c*h*j*n-d*g*k*n+b*h*k*n+c*g*q*n-b*e*q*n-d*e*i*o+c*h*i*o+d*f*k*o-a*h*k*o-c*f*q*o+a*e*q*o+d*g*i*s-b*h*i*s-d*f*j*s+a*h*j*s+b*f*q*s-a*g*q*s-c*g*i*m+b*e*i*m+c*f*j*m-a*e*j*m-b*f*k*m+a*g*k*m},transpose:function(){var a;
a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
a.n43=this.n43;a.n44=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+
10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=
Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,e=a.y,h=a.z,i=f*g,j=f*e;this.set(i*g+c,i*e-d*h,i*h+d*e,0,i*e+d*h,j*e+c,j*h-d*g,0,i*h-d*e,j*h+d*g,f*h*h+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,
this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,f=a.n14,g=a.n21,e=a.n22,h=a.n23,i=a.n24,j=a.n31,k=a.n32,q=a.n33,n=a.n34,o=a.n41,s=a.n42,m=a.n43,p=a.n44;this.n11=h*n*s-i*q*s+i*k*m-e*n*m-h*k*p+e*q*p;this.n12=f*q*s-d*n*s-f*k*m+c*n*m+d*k*p-c*q*p;this.n13=d*i*s-f*h*s+f*e*m-c*i*m-d*e*p+c*h*p;this.n14=f*h*k-d*i*k-f*e*q+c*
i*q+d*e*n-c*h*n;this.n21=i*q*o-h*n*o-i*j*m+g*n*m+h*j*p-g*q*p;this.n22=d*n*o-f*q*o+f*j*m-b*n*m-d*j*p+b*q*p;this.n23=f*h*o-d*i*o-f*g*m+b*i*m+d*g*p-b*h*p;this.n24=d*i*j-f*h*j+f*g*q-b*i*q-d*g*n+b*h*n;this.n31=e*n*o-i*k*o+i*j*s-g*n*s-e*j*p+g*k*p;this.n32=f*k*o-c*n*o-f*j*s+b*n*s+c*j*p-b*k*p;this.n33=c*i*o-f*e*o+f*g*s-b*i*s-c*g*p+b*e*p;this.n34=f*e*j-c*i*j-f*g*k+b*i*k+c*g*n-b*e*n;this.n41=h*k*o-e*q*o-h*j*s+g*q*s+e*j*m-g*k*m;this.n42=c*q*o-d*k*o+d*j*s-b*q*s-c*j*m+b*k*m;this.n43=d*e*o-c*h*o-d*g*s+b*h*s+c*
g*m-b*e*m;this.n44=c*h*j-d*e*j+d*g*k-b*h*k-c*g*q+b*e*q;this.multiplyScalar(1/a.determinant());return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,f=a.z,g=Math.cos(c),c=Math.sin(c),e=Math.cos(d),d=Math.sin(d),h=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var i=e*h,j=e*f,k=d*h,q=d*f;this.n11=i+q*c;this.n12=k*c-j;this.n13=g*d;this.n21=g*f;this.n22=g*h;this.n23=-c;this.n31=j*c-k;this.n32=q+i*c;this.n33=g*e;break;case "ZXY":i=e*h;j=e*f;k=d*h;q=d*f;this.n11=i-q*c;this.n12=-g*f;this.n13=k+
j*c;this.n21=j+k*c;this.n22=g*h;this.n23=q-i*c;this.n31=-g*d;this.n32=c;this.n33=g*e;break;case "ZYX":i=g*h;j=g*f;k=c*h;q=c*f;this.n11=e*h;this.n12=k*d-j;this.n13=i*d+q;this.n21=e*f;this.n22=q*d+i;this.n23=j*d-k;this.n31=-d;this.n32=c*e;this.n33=g*e;break;case "YZX":i=g*e;j=g*d;k=c*e;q=c*d;this.n11=e*h;this.n12=q-i*f;this.n13=k*f+j;this.n21=f;this.n22=g*h;this.n23=-c*h;this.n31=-d*h;this.n32=j*f+k;this.n33=i-q*f;break;case "XZY":i=g*e;j=g*d;k=c*e;q=c*d;this.n11=e*h;this.n12=-f;this.n13=d*h;this.n21=
i*f+q;this.n22=g*h;this.n23=j*f-k;this.n31=k*f-j;this.n32=c*h;this.n33=q*f+i;break;default:i=g*h,j=g*f,k=c*h,q=c*f,this.n11=e*h,this.n12=-e*f,this.n13=d,this.n21=j+k*d,this.n22=i-q*d,this.n23=-c*e,this.n31=q-i*d,this.n32=k+j*d,this.n33=g*e}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,e=c+c,h=d+d,a=b*g,i=b*e;b*=h;var j=c*e;c*=h;d*=h;g*=f;e*=f;f*=h;this.n11=1-(j+d);this.n12=i-f;this.n13=b+e;this.n21=i+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-e;this.n32=c+g;
this.n33=1-(a+j);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var d=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(d,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,
g=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=f.length();c.z=g.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);
return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(a.x===1&&a.y===0&&a.z===0)return this.rotateX(b);
else if(a.x===0&&a.y===1&&a.z===0)return this.rotateY(b);else if(a.x===0&&a.y===0&&a.z===1)return this.rotateZ(b);var c=a.x,d=a.y,f=a.z,g=Math.sqrt(c*c+d*d+f*f);c/=g;d/=g;f/=g;var g=c*c,e=d*d,h=f*f,i=Math.cos(b),j=Math.sin(b),k=1-i,q=c*d*k,n=c*f*k;k*=d*f;c*=j;var o=d*j;j*=f;f=g+(1-g)*i;g=q+j;d=n-o;q-=j;e+=(1-e)*i;j=k+c;n+=o;k-=c;h+=(1-h)*i;var i=this.n11,c=this.n21,o=this.n31,s=this.n41,m=this.n12,p=this.n22,r=this.n32,t=this.n42,v=this.n13,u=this.n23,w=this.n33,y=this.n43;this.n11=f*i+g*m+d*v;this.n21=
f*c+g*p+d*u;this.n31=f*o+g*r+d*w;this.n41=f*s+g*t+d*y;this.n12=q*i+e*m+j*v;this.n22=q*c+e*p+j*u;this.n32=q*o+e*r+j*w;this.n42=q*s+e*t+j*y;this.n13=n*i+k*m+h*v;this.n23=n*c+k*p+h*u;this.n33=n*o+k*r+h*w;this.n43=n*s+k*t+h*y;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,f=this.n42,g=this.n13,e=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n12=j*b+a*g;this.n22=j*c+a*e;this.n32=j*d+a*h;this.n42=j*f+a*i;this.n13=j*g-a*b;this.n23=j*e-a*c;this.n33=j*h-a*d;this.n43=
j*i-a*f;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,g=this.n13,e=this.n23,h=this.n33,i=this.n43,j=Math.cos(a),a=Math.sin(a);this.n11=j*b-a*g;this.n21=j*c-a*e;this.n31=j*d-a*h;this.n41=j*f-a*i;this.n13=j*g+a*b;this.n23=j*e+a*c;this.n33=j*h+a*d;this.n43=j*i+a*f;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,f=this.n41,g=this.n12,e=this.n22,h=this.n32,i=this.n42,j=Math.cos(a),a=Math.sin(a);this.n11=j*b+a*g;this.n21=j*c+a*e;this.n31=j*d+a*h;
this.n41=j*f+a*i;this.n12=j*g-a*b;this.n22=j*e-a*c;this.n32=j*h-a*d;this.n42=j*i-a*f;return this},translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,e=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,q=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*e+a.n31*j;if(a===0)return null;a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*e;c[4]=a*h;c[5]=a*i;c[6]=a*j;c[7]=a*k;c[8]=a*q;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var e;e=new THREE.Matrix4;e.n11=2*f/(b-a);e.n12=0;e.n13=(b+a)/(b-a);e.n14=0;e.n21=0;e.n22=2*f/(d-c);e.n23=(d+c)/(d-c);e.n24=0;e.n31=0;e.n32=0;e.n33=-(g+f)/(g-f);e.n34=-2*g*f/(g-f);e.n41=0;e.n42=0;e.n43=-1;e.n44=0;return e};THREE.Matrix4.makePerspective=function(a,b,c,d){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var e,h,i,j;e=new THREE.Matrix4;h=b-a;i=c-d;j=g-f;e.n11=2/h;e.n12=0;e.n13=0;e.n14=-((b+a)/h);e.n21=0;e.n22=2/i;e.n23=0;e.n24=-((c+d)/i);e.n31=0;e.n32=0;e.n33=-2/j;e.n34=-((g+f)/j);e.n41=0;e.n42=0;e.n43=0;e.n44=1;return e};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=!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,applyMatrix:function(a){this.matrix.multiply(a,this.matrix);this.scale.getScaleFromMatrix(this.matrix);this.rotation.getRotationFromMatrix(this.matrix,this.scale);this.position.getPositionFromMatrix(this.matrix)},translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,
this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)},add:function(a){if(a===this)console.warn("THREE.Object3D.add: An object can't be added as a child of itself.");else if(this.children.indexOf(a)===-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__addObject(a)}},remove:function(a){var b=
this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.__removeObject(a)}},getChildByName:function(a,b){var c,d,f;for(c=0,d=this.children.length;c<d;c++){f=this.children[c];if(f.name===a)return f;if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,
this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<
c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
THREE.Projector=function(){function a(){var a=e[g]=e[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[i]=j[i]||new THREE.RenderableVertex;i++;return a}function c(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,f=a.z+a.w,g=b.z+b.w,e=-a.z+a.w,h=-b.z+b.w;return f>=0&&g>=0&&e>=0&&h>=0?!0:f<0&&g<0||e<0&&h<0?!1:(f<0?c=Math.max(c,f/(f-g)):g<0&&(d=Math.min(d,f/(f-g))),e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,g,e=[],h,i,j=[],
k,q,n=[],o,s=[],m,p,r=[],t,v,u=[],w={objects:[],sprites:[],lights:[],elements:[]},y=new THREE.Vector3,F=new THREE.Vector4,D=new THREE.Matrix4,G=new THREE.Matrix4,I=new THREE.Frustum,K=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);D.multiply(b.projectionMatrix,b.matrixWorldInverse);D.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);D.multiply(b.matrixWorld,
b.projectionMatrixInverse);D.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,d){g=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var e=function(b){if(b.visible!==!1){(b instanceof THREE.Mesh||b instanceof THREE.Line)&&(b.frustumCulled===!1||I.contains(b))?(D.multiplyVector3(y.copy(b.position)),f=a(),f.object=
b,f.z=y.z,w.objects.push(f)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(D.multiplyVector3(y.copy(b.position)),f=a(),f.object=b,f.z=y.z,w.sprites.push(f)):b instanceof THREE.Light&&w.lights.push(b);for(var c=0,d=b.children.length;c<d;c++)e(b.children[c])}};e(b);d&&w.objects.sort(c);return w};this.projectScene=function(a,f,g){var e=f.near,A=f.far,l=!1,y,E,z,T,W,M,ma,aa,Z,X,U,Y,$,oa,ga;v=p=o=q=0;w.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);D.multiply(f.projectionMatrix,f.matrixWorldInverse);I.setFromMatrix(D);w=this.projectGraph(a,!1);for(a=0,y=w.objects.length;a<y;a++)if(Z=w.objects[a].object,X=Z.matrixWorld,i=0,Z instanceof THREE.Mesh){U=Z.geometry;Y=Z.geometry.materials;T=U.vertices;$=U.faces;oa=U.faceVertexUvs;U=Z.matrixRotationWorld.extractRotation(X);for(E=0,z=T.length;E<z;E++)h=b(),h.positionWorld.copy(T[E].position),X.multiplyVector3(h.positionWorld),
h.positionScreen.copy(h.positionWorld),D.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>e&&h.positionScreen.z<A;for(T=0,E=$.length;T<E;T++){z=$[T];if(z instanceof THREE.Face3)if(W=j[z.a],M=j[z.b],ma=j[z.c],W.visible&&M.visible&&ma.visible)if(l=(ma.positionScreen.x-W.positionScreen.x)*(M.positionScreen.y-W.positionScreen.y)-(ma.positionScreen.y-W.positionScreen.y)*(M.positionScreen.x-W.positionScreen.x)<0,
Z.doubleSided||l!=Z.flipSided)aa=n[q]=n[q]||new THREE.RenderableFace3,q++,k=aa,k.v1.copy(W),k.v2.copy(M),k.v3.copy(ma);else continue;else continue;else if(z instanceof THREE.Face4)if(W=j[z.a],M=j[z.b],ma=j[z.c],aa=j[z.d],W.visible&&M.visible&&ma.visible&&aa.visible)if(l=(aa.positionScreen.x-W.positionScreen.x)*(M.positionScreen.y-W.positionScreen.y)-(aa.positionScreen.y-W.positionScreen.y)*(M.positionScreen.x-W.positionScreen.x)<0||(M.positionScreen.x-ma.positionScreen.x)*(aa.positionScreen.y-ma.positionScreen.y)-
(M.positionScreen.y-ma.positionScreen.y)*(aa.positionScreen.x-ma.positionScreen.x)<0,Z.doubleSided||l!=Z.flipSided)ga=s[o]=s[o]||new THREE.RenderableFace4,o++,k=ga,k.v1.copy(W),k.v2.copy(M),k.v3.copy(ma),k.v4.copy(aa);else continue;else continue;k.normalWorld.copy(z.normal);!l&&(Z.flipSided||Z.doubleSided)&&k.normalWorld.negate();U.multiplyVector3(k.normalWorld);k.centroidWorld.copy(z.centroid);X.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);D.multiplyVector3(k.centroidScreen);
ma=z.vertexNormals;for(W=0,M=ma.length;W<M;W++)aa=k.vertexNormalsWorld[W],aa.copy(ma[W]),!l&&(Z.flipSided||Z.doubleSided)&&aa.negate(),U.multiplyVector3(aa);for(W=0,M=oa.length;W<M;W++)if(ga=oa[W][T])for(ma=0,aa=ga.length;ma<aa;ma++)k.uvs[W][ma]=ga[ma];k.material=Z.material;k.faceMaterial=z.materialIndex!==null?Y[z.materialIndex]:null;k.z=k.centroidScreen.z;w.elements.push(k)}}else if(Z instanceof THREE.Line){G.multiply(D,X);T=Z.geometry.vertices;W=b();W.positionScreen.copy(T[0].position);G.multiplyVector4(W.positionScreen);
for(E=1,z=T.length;E<z;E++)if(W=b(),W.positionScreen.copy(T[E].position),G.multiplyVector4(W.positionScreen),M=j[i-2],K.copy(W.positionScreen),Q.copy(M.positionScreen),d(K,Q))K.multiplyScalar(1/K.w),Q.multiplyScalar(1/Q.w),X=r[p]=r[p]||new THREE.RenderableLine,p++,m=X,m.v1.positionScreen.copy(K),m.v2.positionScreen.copy(Q),m.z=Math.max(K.z,Q.z),m.material=Z.material,w.elements.push(m)}for(a=0,y=w.sprites.length;a<y;a++)if(Z=w.sprites[a].object,X=Z.matrixWorld,Z instanceof THREE.Particle&&(F.set(X.n14,
X.n24,X.n34,1),D.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))e=u[v]=u[v]||new THREE.RenderableParticle,v++,t=e,t.x=F.x/F.w,t.y=F.y/F.w,t.z=F.z,t.rotation=Z.rotation.z,t.scale.x=Z.scale.x*Math.abs(t.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),t.scale.y=Z.scale.y*Math.abs(t.y-(F.y+f.projectionMatrix.n22)/(F.w+f.projectionMatrix.n24)),t.material=Z.material,w.elements.push(t);g&&w.elements.sort(c);return w}};
THREE.Quaternion=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=d!==void 0?d:1};
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},clone:function(){return new THREE.Quaternion(this.x,this.y,this.z,this.w)},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-f),f=Math.sin(-f),g=Math.cos(c),c=Math.sin(c),e=a*b,h=d*f;this.w=e*g-h*c;this.x=e*c+h*g;this.y=d*b*g+a*f*c;this.z=a*f*
g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?
-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=
this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,e=a.y,h=a.z,a=a.w;this.x=b*a+f*g+c*h-d*e;this.y=c*a+f*e+d*g-b*h;this.z=d*a+f*h+b*e-c*g;this.w=f*a-b*g-c*e-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=
a);var c=a.x,d=a.y,f=a.z,g=this.x,e=this.y,h=this.z,i=this.w,j=i*c+e*f-h*d,k=i*d+h*c-g*f,q=i*f+g*d-e*c,c=-g*c-e*d-h*f;b.x=j*i+c*-g+k*-h-q*-e;b.y=k*i+c*-e+q*-g-j*-h;b.z=q*i+c*-h+j*-e-k*-g;return b}};
THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var g=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*g)/f;d=Math.sin(d*g)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Vertex.prototype={constructor:THREE.Vertex,clone:function(){return new THREE.Vertex(this.position.clone())}};THREE.Face3=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};
THREE.Face3.prototype={constructor:THREE.Face3,clone:function(){var a=new THREE.Face3(this.a,this.b,this.c);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
return a}};THREE.Face4=function(a,b,c,d,f,g,e){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
THREE.Face4.prototype={constructor:THREE.Face4,clone:function(){var a=new THREE.Face4(this.a,this.b,this.c,this.d);a.normal.copy(this.normal);a.color.copy(this.color);a.centroid.copy(this.centroid);a.materialIndex=this.materialIndex;var b,c;for(b=0,c=this.vertexNormals.length;b<c;b++)a.vertexNormals[b]=this.vertexNormals[b].clone();for(b=0,c=this.vertexColors.length;b<c;b++)a.vertexColors[b]=this.vertexColors[b].clone();for(b=0,c=this.vertexTangents.length;b<c;b++)a.vertexTangents[b]=this.vertexTangents[b].clone();
return a}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},lerpSelf:function(a,b){this.u+=(a.u-this.u)*b;this.v+=(a.v-this.v)*b;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.morphNormals=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a);for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var g=0,e=f.vertexNormals.length;g<e;g++)b.multiplyVector3(f.vertexNormals[g]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c.centroid.set(0,
0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(){var a,b,c,d,f,g,e=new THREE.Vector3,
h=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],f=this.vertices[c.b],g=this.vertices[c.c],e.sub(g.position,f.position),h.sub(d.position,f.position),e.crossSelf(h),e.isZero()||e.normalize(),c.normal.copy(e)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof
THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),
d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeMorphNormals:function(){var a,b,c,d,f;for(c=0,d=this.faces.length;c<
d;c++){f=this.faces[c];f.__originalFaceNormal?f.__originalFaceNormal.copy(f.normal):f.__originalFaceNormal=f.normal.clone();if(!f.__originalVertexNormals)f.__originalVertexNormals=[];for(a=0,b=f.vertexNormals.length;a<b;a++)f.__originalVertexNormals[a]?f.__originalVertexNormals[a].copy(f.vertexNormals[a]):f.__originalVertexNormals[a]=f.vertexNormals[a].clone()}var g=new THREE.Geometry;g.faces=this.faces;for(a=0,b=this.morphTargets.length;a<b;a++){if(!this.morphNormals[a]){this.morphNormals[a]={};
this.morphNormals[a].faceNormals=[];this.morphNormals[a].vertexNormals=[];var e=this.morphNormals[a].faceNormals,h=this.morphNormals[a].vertexNormals,i,j;for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],i=new THREE.Vector3,j=f instanceof THREE.Face3?{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3}:{a:new THREE.Vector3,b:new THREE.Vector3,c:new THREE.Vector3,d:new THREE.Vector3},e.push(i),h.push(j)}e=this.morphNormals[a];g.vertices=this.morphTargets[a].vertices;g.computeFaceNormals();
g.computeVertexNormals();for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],i=e.faceNormals[c],j=e.vertexNormals[c],i.copy(f.normal),f instanceof THREE.Face3?(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2])):(j.a.copy(f.vertexNormals[0]),j.b.copy(f.vertexNormals[1]),j.c.copy(f.vertexNormals[2]),j.d.copy(f.vertexNormals[3]))}for(c=0,d=this.faces.length;c<d;c++)f=this.faces[c],f.normal=f.__originalFaceNormal,f.vertexNormals=f.__originalVertexNormals},computeTangents:function(){function a(a,
b,c,d,f,g,D){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=e[f];q=e[g];n=e[D];o=i.x-h.x;s=j.x-h.x;m=i.y-h.y;p=j.y-h.y;r=i.z-h.z;t=j.z-h.z;v=q.u-k.u;u=n.u-k.u;w=q.v-k.v;y=n.v-k.v;F=1/(v*y-u*w);K.set((y*o-w*s)*F,(y*m-w*p)*F,(y*r-w*t)*F);Q.set((v*s-u*o)*F,(v*p-u*m)*F,(v*t-u*r)*F);G[b].addSelf(K);G[c].addSelf(K);G[d].addSelf(K);I[b].addSelf(Q);I[c].addSelf(Q);I[d].addSelf(Q)}var b,c,d,f,g,e,h,i,j,k,q,n,o,s,m,p,r,t,v,u,w,y,F,D,G=[],I=[],K=new THREE.Vector3,Q=new THREE.Vector3,
N=new THREE.Vector3,B=new THREE.Vector3,O=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)G[b]=new THREE.Vector3,I[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)g=this.faces[b],e=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var S=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)O.copy(g.vertexNormals[d]),f=g[S[d]],
D=G[f],N.copy(D),N.subSelf(O.multiplyScalar(O.dot(D))).normalize(),B.cross(g.vertexNormals[d],D),f=B.dot(I[f]),f=f<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(N.x,N.y,N.z,f)}this.hasTangents=!0},computeBoundingBox:function(){if(!this.boundingBox)this.boundingBox={min:new THREE.Vector3,max:new THREE.Vector3};if(this.vertices.length>0){var a;a=this.vertices[0].position;this.boundingBox.min.copy(a);this.boundingBox.max.copy(a);for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,f=this.vertices.length;d<
f;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}else this.boundingBox.min.set(0,0,0),this.boundingBox.max.set(0,0,0)},computeBoundingSphere:function(){if(!this.boundingSphere)this.boundingSphere={radius:0};for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere.radius=b},mergeVertices:function(){var a={},b=[],c=[],d,f=Math.pow(10,
4),g,e;for(g=0,e=this.vertices.length;g<e;g++)d=this.vertices[g].position,d=[Math.round(d.x*f),Math.round(d.y*f),Math.round(d.z*f)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];for(g=0,e=this.faces.length;g<e;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
THREE.Spline=function(a){function b(a,b,c,d,f,g,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*g+a*f+b}this.points=a;var c=[],d={x:0,y:0,z:0},f,g,e,h,i,j,k,q,n;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;g=Math.floor(f);e=f-g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>this.points.length-2?g:g+1;c[3]=g>this.points.length-3?g:g+2;j=this.points[c[0]];k=this.points[c[1]];
q=this.points[c[2]];n=this.points[c[3]];h=e*e;i=e*h;d.x=b(j.x,k.x,q.x,n.x,e,h,i);d.y=b(j.y,k.y,q.y,n.y,e,h,i);d.z=b(j.z,k.z,q.z,n.z,e,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,f=b=b=0,g=new THREE.Vector3,e=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),e.copy(d),i+=e.distanceTo(g),
g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=f&&(h[b]=i,f=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,f,g,e,h=[],i=new THREE.Vector3,j=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=j.chunks[b]-j.chunks[b-1];e=Math.ceil(a*c/j.total);f=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<e-1;c++)d=f+c*(1/e)*(g-f),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
h}};THREE.Camera=function(){THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.getRotationFromMatrix(this.matrix)};
THREE.OrthographicCamera=function(a,b,c,d,f,g){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=f!==void 0?f:0.1;this.far=g!==void 0?g:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.updateProjectionMatrix()};
THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,f,g){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=f;this.height=g;this.updateProjectionMatrix()};
THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.onlyShadow=this.castShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraLeft=-500;this.shadowCameraTop=this.shadowCameraRight=500;this.shadowCameraBottom=-500;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCascade=
!1;this.shadowCascadeOffset=new THREE.Vector3(0,0,-1E3);this.shadowCascadeCount=2;this.shadowCascadeBias=[0,0,0];this.shadowCascadeWidth=[512,512,512];this.shadowCascadeHeight=[512,512,512];this.shadowCascadeNearZ=[-1,0.99,0.998];this.shadowCascadeFarZ=[0.99,0.998,1];this.shadowCascadeArray=[];this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
THREE.SpotLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0;this.castShadow=d!==void 0?d:!1;this.onlyShadow=!1;this.shadowCameraNear=50;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowCameraVisible=!1;this.shadowBias=0;this.shadowDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowMatrix=this.shadowCamera=this.shadowMapSize=this.shadowMap=null};
THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
THREE.Material=function(a){a=a||{};this.id=THREE.MaterialCount++;this.name="";this.opacity=a.opacity!==void 0?a.opacity:1;this.transparent=a.transparent!==void 0?a.transparent:!1;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.depthTest=a.depthTest!==void 0?a.depthTest:!0;this.depthWrite=a.depthWrite!==void 0?a.depthWrite:!0;this.polygonOffset=a.polygonOffset!==void 0?a.polygonOffset:!1;this.polygonOffsetFactor=a.polygonOffsetFactor!==void 0?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
a.polygonOffsetUnits!==void 0?a.polygonOffsetUnits:0;this.alphaTest=a.alphaTest!==void 0?a.alphaTest:0;this.overdraw=a.overdraw!==void 0?a.overdraw:!1};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NoBlending=0;THREE.NormalBlending=1;THREE.AdditiveBlending=2;THREE.SubtractiveBlending=3;THREE.MultiplyBlending=4;THREE.AdditiveAlphaBlending=5;
THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=a.linewidth!==void 0?a.linewidth:1;this.linecap=a.linecap!==void 0?a.linecap:"round";this.linejoin=a.linejoin!==void 0?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:
!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:
!1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.wrapAround=a.wrapAround!==void 0?a.wrapAround:!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:
THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?
a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=a.ambient!==void 0?new THREE.Color(a.ambient):new THREE.Color(16777215);this.specular=a.specular!==void 0?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=a.shininess!==void 0?a.shininess:30;this.metal=a.metal!==void 0?a.metal:!1;this.perPixel=a.perPixel!==void 0?a.perPixel:!1;this.wrapAround=a.wrapAround!==void 0?a.wrapAround:
!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=a.map!==void 0?a.map:null;this.lightMap=a.lightMap!==void 0?a.lightMap:null;this.envMap=a.envMap!==void 0?a.envMap:null;this.combine=a.combine!==void 0?a.combine:THREE.MultiplyOperation;this.reflectivity=a.reflectivity!==void 0?a.reflectivity:1;this.refractionRatio=a.refractionRatio!==void 0?a.refractionRatio:0.98;this.fog=a.fog!==void 0?a.fog:!0;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:
!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.wireframeLinecap=a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.wireframeLinejoin!==void 0?a.wireframeLinejoin:"round";this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1;this.morphNormals=a.morphNormals!==void 0?a.morphNormals:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;
THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.program=a.program!==void 0?a.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(a){THREE.Material.call(this);this.domElement=a};
THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
THREE.Texture=function(a,b,c,d,f,g,e,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.format=e!==void 0?e:THREE.RGBAFormat;this.type=h!==void 0?h:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
!0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;
THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,d,f,g,e,h,i,j){THREE.Texture.call(this,null,g,e,h,i,j,d,f);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.ParticleBasicMaterial({color:Math.random()*16777215});this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.LineBasicMaterial({color:Math.random()*16777215});this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b!==void 0?b:new THREE.MeshBasicMaterial({color:Math.random()*16777215,wireframe:!0});if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),
this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,f,g,e,h;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],g=f.pos,e=f.rotq,h=f.scl,d=this.addBone(),d.name=f.name,d.position.set(g[0],g[1],g[2]),d.quaternion.set(e[0],e[1],e[2],e[3]),d.useQuaternion=!0,h!==void 0?d.scale.set(h[0],h[1],h[2]):d.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
d=this.bones[c],f.parent===-1?this.add(d):this.bones[f.parent].add(d);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.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
a*16)};
THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y,d=
new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};
THREE.MorphAnimMesh=function(a,b){THREE.Mesh.call(this,a,b);this.duration=1E3;this.mirroredLoop=!1;this.currentKeyframe=this.lastKeyframe=this.time=0;this.direction=1;this.directionBackwards=!1;this.setFrameRange(0,this.geometry.morphTargets.length-1)};THREE.MorphAnimMesh.prototype=new THREE.Mesh;THREE.MorphAnimMesh.prototype.constructor=THREE.MorphAnimMesh;
THREE.MorphAnimMesh.prototype.setFrameRange=function(a,b){this.startKeyframe=a;this.endKeyframe=b;this.length=this.endKeyframe-this.startKeyframe+1};THREE.MorphAnimMesh.prototype.setDirectionForward=function(){this.direction=1;this.directionBackwards=!1};THREE.MorphAnimMesh.prototype.setDirectionBackward=function(){this.direction=-1;this.directionBackwards=!0};
THREE.MorphAnimMesh.prototype.parseAnimations=function(){var a=this.geometry;if(!a.animations)a.animations={};for(var b,c=a.animations,d=/([a-z]+)(\d+)/,f=0,g=a.morphTargets.length;f<g;f++){var e=a.morphTargets[f].name.match(d);if(e&&e.length>1){e=e[1];c[e]||(c[e]={start:Infinity,end:-Infinity});var h=c[e];if(f<h.start)h.start=f;if(f>h.end)h.end=f;b||(b=e)}}a.firstAnimation=b};
THREE.MorphAnimMesh.prototype.setAnimationLabel=function(a,b,c){if(!this.geometry.animations)this.geometry.animations={};this.geometry.animations[a]={start:b,end:c}};THREE.MorphAnimMesh.prototype.playAnimation=function(a,b){var c=this.geometry.animations[a];c?(this.setFrameRange(c.start,c.end),this.duration=1E3*((c.end-c.start)/b),this.time=0):console.warn("animation["+a+"] undefined")};
THREE.MorphAnimMesh.prototype.updateAnimation=function(a){var b=this.duration/this.length;this.time+=this.direction*a;if(this.mirroredLoop){if(this.time>this.duration||this.time<0){this.direction*=-1;if(this.time>this.duration)this.time=this.duration,this.directionBackwards=!0;if(this.time<0)this.time=0,this.directionBackwards=!1}}else this.time%=this.duration,this.time<0&&(this.time+=this.duration);a=this.startKeyframe+THREE.Math.clamp(Math.floor(this.time/b),0,this.length-1);if(a!==this.currentKeyframe)this.morphTargetInfluences[this.lastKeyframe]=
0,this.morphTargetInfluences[this.currentKeyframe]=1,this.morphTargetInfluences[a]=0,this.lastKeyframe=this.currentKeyframe,this.currentKeyframe=a;b=this.time%b/b;this.directionBackwards&&(b=1-b);this.morphTargetInfluences[this.currentKeyframe]=b;this.morphTargetInfluences[this.lastKeyframe]=1-b};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.matrixWorld.n14+a.n32*this.matrixWorld.n24+a.n33*this.matrixWorld.n34+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:new THREE.Texture;this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:!this.useScreenCoordinates;
this.scaleByViewport=a.scaleByViewport!==void 0?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
THREE.Sprite.prototype.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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.__objects=[];this.__lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
THREE.Scene.prototype.__addObject=function(a){if(a instanceof THREE.Light)this.__lights.indexOf(a)===-1&&this.__lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.__objects.indexOf(a)===-1){this.__objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);b!==-1&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.__addObject(a.children[b])};
THREE.Scene.prototype.__removeObject=function(a){if(a instanceof THREE.Light){var b=this.__lights.indexOf(a);b!==-1&&this.__lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.__objects.indexOf(a),b!==-1&&(this.__objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.__removeObject(a.children[b])};
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
THREE.DOMRenderer=function(){var a,b,c=new THREE.Projector,d,f,g,e;this.domElement=document.createElement("div");this.setSize=function(a,b){d=a;f=b;g=d/2;e=f/2};this.render=function(d,f){var j,k,q,n,o;a=c.projectScene(d,f);b=a.elements;for(j=0,k=b.length;j<k;j++)if(q=b[j],q instanceof THREE.RenderableParticle&&(n=q.x*g+g,o=q.y*e+e,q=q.material,q instanceof THREE.ParticleDOMMaterial))q=q.domElement,q.style.left=n+"px",q.style.top=o+"px"}};
THREE.CanvasRenderer=function(a){function b(a){if(t!=a)m.globalAlpha=t=a}function c(a){if(v!=a){switch(a){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}v=a}}function d(a){if(u!=a)m.strokeStyle=u=a}function f(a){if(w!=a)m.fillStyle=w=a}var a=a||{},g=this,e,h,i,j=new THREE.Projector,k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
q,n,o,s,m=k.getContext("2d"),p=new THREE.Color(0),r=0,t=1,v=0,u=null,w=null,y=null,F=null,D=null,G,I,K,Q,N=new THREE.RenderableVertex,B=new THREE.RenderableVertex,O,S,A,l,V,E,z,T,W,M,ma,aa,Z=new THREE.Color,X=new THREE.Color,U=new THREE.Color,Y=new THREE.Color,$=new THREE.Color,oa=[],ga=[],ra,qa,ha,ka,Ea,Aa,ya,xa,za,wa,sa=new THREE.Rectangle,na=new THREE.Rectangle,ja=new THREE.Rectangle,ta=!1,ua=new THREE.Color,Ba=new THREE.Color,Ga=new THREE.Color,da=new THREE.Vector3,R,Ca,Ra,Da,Oa,Pa,a=16;R=document.createElement("canvas");
R.width=R.height=2;Ca=R.getContext("2d");Ca.fillStyle="rgba(0,0,0,1)";Ca.fillRect(0,0,2,2);Ra=Ca.getImageData(0,0,2,2);Da=Ra.data;Oa=document.createElement("canvas");Oa.width=Oa.height=a;Pa=Oa.getContext("2d");Pa.translate(-a/2,-a/2);Pa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){q=a;n=b;o=Math.floor(q/2);s=Math.floor(n/2);k.width=q;k.height=n;sa.set(-o,-s,o,s);na.set(-o,-s,o,s);t=1;v=0;D=
F=y=w=u=null};this.setClearColor=function(a,b){p.copy(a);r=b;na.set(-o,-s,o,s)};this.setClearColorHex=function(a,b){p.setHex(a);r=b;na.set(-o,-s,o,s)};this.clear=function(){m.setTransform(1,0,0,-1,o,s);na.isEmpty()||(na.minSelf(sa),na.inflate(2),r<1&&m.clearRect(Math.floor(na.getX()),Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight())),r>0&&(c(THREE.NormalBlending),b(1),f("rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+r+")"),m.fillRect(Math.floor(na.getX()),
Math.floor(na.getY()),Math.floor(na.getWidth()),Math.floor(na.getHeight()))),na.empty())};this.render=function(a,k){function n(a){var b,c,d,f;ua.setRGB(0,0,0);Ba.setRGB(0,0,0);Ga.setRGB(0,0,0);for(b=0,c=a.length;b<c;b++)d=a[b],f=d.color,d instanceof THREE.AmbientLight?(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b):d instanceof THREE.DirectionalLight?(Ba.r+=f.r,Ba.g+=f.g,Ba.b+=f.b):d instanceof THREE.PointLight&&(Ga.r+=f.r,Ga.g+=f.g,Ga.b+=f.b)}function q(a,b,c,d){var f,g,e,h,i,l;for(f=0,g=a.length;f<g;f++)e=a[f],
h=e.color,e instanceof THREE.DirectionalLight?(i=e.matrixWorld.getPosition(),l=c.dot(i),l<=0||(l*=e.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):e instanceof THREE.PointLight&&(i=e.matrixWorld.getPosition(),l=c.dot(da.sub(i,b).normalize()),l<=0||(l*=e.distance==0?1:1-Math.min(b.distanceTo(i)/e.distance,1),l!=0&&(l*=e.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function p(a,g,e){b(e.opacity);c(e.blending);var h,da,i,l,j,k;if(e instanceof THREE.ParticleBasicMaterial){if(e.map)l=e.map.image,j=l.width>>
1,k=l.height>>1,e=g.scale.x*o,i=g.scale.y*s,h=e*j,da=i*k,ja.set(a.x-h,a.y-da,a.x+h,a.y+da),sa.intersects(ja)&&(m.save(),m.translate(a.x,a.y),m.rotate(-g.rotation),m.scale(e,-i),m.translate(-j,-k),m.drawImage(l,0,0),m.restore())}else e instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*o,da=g.scale.y*s,ja.set(a.x-h,a.y-da,a.x+h,a.y+da),sa.intersects(ja)&&(d(e.color.getContextStyle()),f(e.color.getContextStyle()),m.save(),m.translate(a.x,a.y),m.rotate(-g.rotation),m.scale(h,da),e.program(m),m.restore()))}
function r(a,f,g,e){b(e.opacity);c(e.blending);m.beginPath();m.moveTo(a.positionScreen.x,a.positionScreen.y);m.lineTo(f.positionScreen.x,f.positionScreen.y);m.closePath();if(e instanceof THREE.LineBasicMaterial){a=e.linewidth;if(y!=a)m.lineWidth=y=a;a=e.linecap;if(F!=a)m.lineCap=F=a;a=e.linejoin;if(D!=a)m.lineJoin=D=a;d(e.color.getContextStyle());m.stroke();ja.inflate(e.linewidth*2)}}function t(a,d,f,e,h,j,m,R){g.info.render.vertices+=3;g.info.render.faces++;b(R.opacity);c(R.blending);O=a.positionScreen.x;
S=a.positionScreen.y;A=d.positionScreen.x;l=d.positionScreen.y;V=f.positionScreen.x;E=f.positionScreen.y;w(O,S,A,l,V,E);if(R instanceof THREE.MeshBasicMaterial)if(R.map)R.map.mapping instanceof THREE.UVMapping&&(ka=m.uvs[0],Sa(O,S,A,l,V,E,ka[e].u,ka[e].v,ka[h].u,ka[h].v,ka[j].u,ka[j].v,R.map));else if(R.envMap){if(R.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,da.copy(m.vertexNormalsWorld[e]),Ea=(da.x*a.n11+da.y*a.n12+da.z*a.n13)*0.5+0.5,Aa=-(da.x*a.n21+da.y*a.n22+
da.z*a.n23)*0.5+0.5,da.copy(m.vertexNormalsWorld[h]),ya=(da.x*a.n11+da.y*a.n12+da.z*a.n13)*0.5+0.5,xa=-(da.x*a.n21+da.y*a.n22+da.z*a.n23)*0.5+0.5,da.copy(m.vertexNormalsWorld[j]),za=(da.x*a.n11+da.y*a.n12+da.z*a.n13)*0.5+0.5,wa=-(da.x*a.n21+da.y*a.n22+da.z*a.n23)*0.5+0.5,Sa(O,S,A,l,V,E,Ea,Aa,ya,xa,za,wa,R.envMap)}else R.wireframe?Ha(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(R.color);else if(R instanceof THREE.MeshLambertMaterial)R.map&&!R.wireframe&&(R.map.mapping instanceof
THREE.UVMapping&&(ka=m.uvs[0],Sa(O,S,A,l,V,E,ka[e].u,ka[e].v,ka[h].u,ka[h].v,ka[j].u,ka[j].v,R.map)),c(THREE.SubtractiveBlending)),ta?!R.wireframe&&R.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(X.r=U.r=Y.r=ua.r,X.g=U.g=Y.g=ua.g,X.b=U.b=Y.b=ua.b,q(i,m.v1.positionWorld,m.vertexNormalsWorld[0],X),q(i,m.v2.positionWorld,m.vertexNormalsWorld[1],U),q(i,m.v3.positionWorld,m.vertexNormalsWorld[2],Y),X.r=Math.max(0,Math.min(R.color.r*X.r,1)),X.g=Math.max(0,Math.min(R.color.g*X.g,1)),X.b=
Math.max(0,Math.min(R.color.b*X.b,1)),U.r=Math.max(0,Math.min(R.color.r*U.r,1)),U.g=Math.max(0,Math.min(R.color.g*U.g,1)),U.b=Math.max(0,Math.min(R.color.b*U.b,1)),Y.r=Math.max(0,Math.min(R.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(R.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(R.color.b*Y.b,1)),$.r=(U.r+Y.r)*0.5,$.g=(U.g+Y.g)*0.5,$.b=(U.b+Y.b)*0.5,ha=L(X,U,Y,$),Ma(O,S,A,l,V,E,0,0,1,0,0,1,ha)):(Z.r=ua.r,Z.g=ua.g,Z.b=ua.b,q(i,m.centroidWorld,m.normalWorld,Z),Z.r=Math.max(0,Math.min(R.color.r*Z.r,1)),Z.g=
Math.max(0,Math.min(R.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(R.color.b*Z.b,1)),R.wireframe?Ha(Z,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(Z)):R.wireframe?Ha(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(R.color);else if(R instanceof THREE.MeshDepthMaterial)ra=k.near,qa=k.far,X.r=X.g=X.b=1-La(a.positionScreen.z,ra,qa),U.r=U.g=U.b=1-La(d.positionScreen.z,ra,qa),Y.r=Y.g=Y.b=1-La(f.positionScreen.z,ra,qa),$.r=(U.r+Y.r)*0.5,$.g=(U.g+Y.g)*0.5,$.b=(U.b+Y.b)*
0.5,ha=L(X,U,Y,$),Ma(O,S,A,l,V,E,0,0,1,0,0,1,ha);else if(R instanceof THREE.MeshNormalMaterial)Z.r=Na(m.normalWorld.x),Z.g=Na(m.normalWorld.y),Z.b=Na(m.normalWorld.z),R.wireframe?Ha(Z,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(Z)}function u(a,d,f,e,h,da,j,R,m){g.info.render.vertices+=4;g.info.render.faces++;b(R.opacity);c(R.blending);if(R.map||R.envMap)t(a,d,e,0,1,3,j,R,m),t(h,f,da,1,2,3,j,R,m);else if(O=a.positionScreen.x,S=a.positionScreen.y,A=d.positionScreen.x,l=d.positionScreen.y,
V=f.positionScreen.x,E=f.positionScreen.y,z=e.positionScreen.x,T=e.positionScreen.y,W=h.positionScreen.x,M=h.positionScreen.y,ma=da.positionScreen.x,aa=da.positionScreen.y,R instanceof THREE.MeshBasicMaterial)v(O,S,A,l,V,E,z,T),R.wireframe?Ha(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(R.color);else if(R instanceof THREE.MeshLambertMaterial)ta?!R.wireframe&&R.shading==THREE.SmoothShading&&j.vertexNormalsWorld.length==4?(X.r=U.r=Y.r=$.r=ua.r,X.g=U.g=Y.g=$.g=ua.g,X.b=U.b=
Y.b=$.b=ua.b,q(i,j.v1.positionWorld,j.vertexNormalsWorld[0],X),q(i,j.v2.positionWorld,j.vertexNormalsWorld[1],U),q(i,j.v4.positionWorld,j.vertexNormalsWorld[3],Y),q(i,j.v3.positionWorld,j.vertexNormalsWorld[2],$),X.r=Math.max(0,Math.min(R.color.r*X.r,1)),X.g=Math.max(0,Math.min(R.color.g*X.g,1)),X.b=Math.max(0,Math.min(R.color.b*X.b,1)),U.r=Math.max(0,Math.min(R.color.r*U.r,1)),U.g=Math.max(0,Math.min(R.color.g*U.g,1)),U.b=Math.max(0,Math.min(R.color.b*U.b,1)),Y.r=Math.max(0,Math.min(R.color.r*Y.r,
1)),Y.g=Math.max(0,Math.min(R.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(R.color.b*Y.b,1)),$.r=Math.max(0,Math.min(R.color.r*$.r,1)),$.g=Math.max(0,Math.min(R.color.g*$.g,1)),$.b=Math.max(0,Math.min(R.color.b*$.b,1)),ha=L(X,U,Y,$),w(O,S,A,l,z,T),Ma(O,S,A,l,z,T,0,0,1,0,0,1,ha),w(W,M,V,E,ma,aa),Ma(W,M,V,E,ma,aa,1,0,1,1,0,1,ha)):(Z.r=ua.r,Z.g=ua.g,Z.b=ua.b,q(i,j.centroidWorld,j.normalWorld,Z),Z.r=Math.max(0,Math.min(R.color.r*Z.r,1)),Z.g=Math.max(0,Math.min(R.color.g*Z.g,1)),Z.b=Math.max(0,Math.min(R.color.b*
Z.b,1)),v(O,S,A,l,V,E,z,T),R.wireframe?Ha(Z,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(Z)):(v(O,S,A,l,V,E,z,T),R.wireframe?Ha(R.color,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(R.color));else if(R instanceof THREE.MeshNormalMaterial)Z.r=Na(j.normalWorld.x),Z.g=Na(j.normalWorld.y),Z.b=Na(j.normalWorld.z),v(O,S,A,l,V,E,z,T),R.wireframe?Ha(Z,R.wireframeLinewidth,R.wireframeLinecap,R.wireframeLinejoin):J(Z);else if(R instanceof THREE.MeshDepthMaterial)ra=k.near,
qa=k.far,X.r=X.g=X.b=1-La(a.positionScreen.z,ra,qa),U.r=U.g=U.b=1-La(d.positionScreen.z,ra,qa),Y.r=Y.g=Y.b=1-La(e.positionScreen.z,ra,qa),$.r=$.g=$.b=1-La(f.positionScreen.z,ra,qa),ha=L(X,U,Y,$),w(O,S,A,l,z,T),Ma(O,S,A,l,z,T,0,0,1,0,0,1,ha),w(W,M,V,E,ma,aa),Ma(W,M,V,E,ma,aa,1,0,1,1,0,1,ha)}function w(a,b,c,d,f,g){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(f,g);m.lineTo(a,b);m.closePath()}function v(a,b,c,d,f,g,e,h){m.beginPath();m.moveTo(a,b);m.lineTo(c,d);m.lineTo(f,g);m.lineTo(e,h);m.lineTo(a,
b);m.closePath()}function Ha(a,b,c,f){if(y!=b)m.lineWidth=y=b;if(F!=c)m.lineCap=F=c;if(D!=f)m.lineJoin=D=f;d(a.getContextStyle());m.stroke();ja.inflate(b*2)}function J(a){f(a.getContextStyle());m.fill()}function Sa(a,b,c,d,g,e,h,da,i,l,j,R,k){if(k.image.width!=0){if(k.needsUpdate==!0||oa[k.id]==void 0){var n=k.wrapS==THREE.RepeatWrapping,Ca=k.wrapT==THREE.RepeatWrapping;oa[k.id]=m.createPattern(k.image,n&&Ca?"repeat":n&&!Ca?"repeat-x":!n&&Ca?"repeat-y":"no-repeat");k.needsUpdate=!1}f(oa[k.id]);var n=
k.offset.x/k.repeat.x,Ca=k.offset.y/k.repeat.y,q=k.image.width*k.repeat.x,o=k.image.height*k.repeat.y,h=(h+n)*q,da=(da+Ca)*o,i=(i+n)*q,l=(l+Ca)*o,j=(j+n)*q,R=(R+Ca)*o;c-=a;d-=b;g-=a;e-=b;i-=h;l-=da;j-=h;R-=da;n=i*R-j*l;if(n==0){if(ga[k.id]===void 0)b=document.createElement("canvas"),b.width=k.image.width,b.height=k.image.height,b=b.getContext("2d"),b.drawImage(k.image,0,0),ga[k.id]=b.getImageData(0,0,k.image.width,k.image.height).data;b=ga[k.id];h=(Math.floor(h)+Math.floor(da)*k.image.width)*4;Z.setRGB(b[h]/
255,b[h+1]/255,b[h+2]/255);J(Z)}else n=1/n,k=(R*c-l*g)*n,l=(R*d-l*e)*n,c=(i*g-j*c)*n,d=(i*e-j*d)*n,a=a-k*h-c*da,h=b-l*h-d*da,m.save(),m.transform(k,l,c,d,a,h),m.fill(),m.restore()}}function Ma(a,b,c,d,f,g,e,h,da,i,l,j,R){var k,n;k=R.width-1;n=R.height-1;e*=k;h*=n;da*=k;i*=n;l*=k;j*=n;c-=a;d-=b;f-=a;g-=b;da-=e;i-=h;l-=e;j-=h;n=1/(da*j-l*i);k=(j*c-i*f)*n;i=(j*d-i*g)*n;c=(da*f-l*c)*n;d=(da*g-l*d)*n;a=a-k*e-c*h;b=b-i*e-d*h;m.save();m.transform(k,i,c,d,a,b);m.clip();m.drawImage(R,0,0);m.restore()}function L(a,
b,c,d){var f=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),e=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),da=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),l=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255);Da[0]=f<0?0:f>255?255:f;Da[1]=g<0?0:g>255?255:g;Da[2]=a<0?0:a>255?255:a;Da[4]=e<0?0:e>255?255:e;Da[5]=h<0?0:h>255?255:h;Da[6]=b<0?0:b>255?255:b;Da[8]=da<0?0:da>255?255:da;Da[9]=i<0?0:i>255?255:i;Da[10]=c<0?0:c>255?255:c;Da[12]=l<0?0:l>255?255:l;Da[13]=j<0?0:j>255?255:j;Da[14]=d<0?0:d>255?255:d;Ca.putImageData(Ra,0,0);Pa.drawImage(R,
0,0);return Oa}function La(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Na(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ia(a,b){var c=b.x-a.x,d=b.y-a.y,f=c*c+d*d;f!=0&&(f=1/Math.sqrt(f),c*=f,d*=f,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var P,Ta,va,Fa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,o,s);g.info.render.vertices=0;g.info.render.faces=0;e=j.projectScene(a,k,this.sortElements);h=e.elements;i=e.lights;(ta=i.length>0)&&n(i);for(P=0,Ta=h.length;P<Ta;P++)if(va=h[P],Fa=va.material,Fa=Fa instanceof
THREE.MeshFaceMaterial?va.faceMaterial:Fa,!(Fa==null||Fa.opacity==0)){ja.empty();if(va instanceof THREE.RenderableParticle)G=va,G.x*=o,G.y*=s,p(G,va,Fa,a);else if(va instanceof THREE.RenderableLine)G=va.v1,I=va.v2,G.positionScreen.x*=o,G.positionScreen.y*=s,I.positionScreen.x*=o,I.positionScreen.y*=s,ja.addPoint(G.positionScreen.x,G.positionScreen.y),ja.addPoint(I.positionScreen.x,I.positionScreen.y),sa.intersects(ja)&&r(G,I,va,Fa,a);else if(va instanceof THREE.RenderableFace3)G=va.v1,I=va.v2,K=va.v3,
G.positionScreen.x*=o,G.positionScreen.y*=s,I.positionScreen.x*=o,I.positionScreen.y*=s,K.positionScreen.x*=o,K.positionScreen.y*=s,Fa.overdraw&&(Ia(G.positionScreen,I.positionScreen),Ia(I.positionScreen,K.positionScreen),Ia(K.positionScreen,G.positionScreen)),ja.add3Points(G.positionScreen.x,G.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),sa.intersects(ja)&&t(G,I,K,0,1,2,va,Fa,a);else if(va instanceof THREE.RenderableFace4)G=va.v1,I=va.v2,K=va.v3,Q=
va.v4,G.positionScreen.x*=o,G.positionScreen.y*=s,I.positionScreen.x*=o,I.positionScreen.y*=s,K.positionScreen.x*=o,K.positionScreen.y*=s,Q.positionScreen.x*=o,Q.positionScreen.y*=s,N.positionScreen.copy(I.positionScreen),B.positionScreen.copy(Q.positionScreen),Fa.overdraw&&(Ia(G.positionScreen,I.positionScreen),Ia(I.positionScreen,Q.positionScreen),Ia(Q.positionScreen,G.positionScreen),Ia(K.positionScreen,N.positionScreen),Ia(K.positionScreen,B.positionScreen)),ja.addPoint(G.positionScreen.x,G.positionScreen.y),
ja.addPoint(I.positionScreen.x,I.positionScreen.y),ja.addPoint(K.positionScreen.x,K.positionScreen.y),ja.addPoint(Q.positionScreen.x,Q.positionScreen.y),sa.intersects(ja)&&u(G,I,K,Q,N,B,va,Fa,a);na.addRectangle(ja)}m.setTransform(1,0,0,1,0,0)}};
THREE.SVGRenderer=function(){function a(a,b,c,d){var f,g,e,h,i,j;for(f=0,g=a.length;f<g;f++)e=a[f],h=e.color,e instanceof THREE.DirectionalLight?(i=e.matrixWorld.getPosition(),j=c.dot(i),j<=0||(j*=e.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)):e instanceof THREE.PointLight&&(i=e.matrixWorld.getPosition(),j=c.dot(G.sub(i,b).normalize()),j<=0||(j*=e.distance==0?1:1-Math.min(b.distanceTo(i)/e.distance,1),j!=0&&(j*=e.intensity,d.r+=h.r*j,d.g+=h.g*j,d.b+=h.b*j)))}function b(a){I[a]==null&&(I[a]=document.createElementNS("http://www.w3.org/2000/svg",
"path"),O==0&&I[a].setAttribute("shape-rendering","crispEdges"));return I[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,f,g,e,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,q,n,o,s,m,p,r=new THREE.Rectangle,t=new THREE.Rectangle,v=!1,u=new THREE.Color,w=new THREE.Color,y=new THREE.Color,F=new THREE.Color,D,G=new THREE.Vector3,I=[],K=[],Q,N,B,O=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
faces:0}};this.setQuality=function(a){switch(a){case "high":O=1;break;case "low":O=0}};this.setSize=function(a,b){j=a;k=b;q=j/2;n=k/2;i.setAttribute("viewBox",-q+" "+-n+" "+j+" "+k);i.setAttribute("width",j);i.setAttribute("height",k);r.set(-q,-n,q,n)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(j,k){var l,G,E,z;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;f=h.projectScene(j,k,this.sortElements);g=f.elements;
e=f.lights;B=N=0;if(v=e.length>0){w.setRGB(0,0,0);y.setRGB(0,0,0);F.setRGB(0,0,0);for(l=0,G=e.length;l<G;l++)z=e[l],E=z.color,z instanceof THREE.AmbientLight?(w.r+=E.r,w.g+=E.g,w.b+=E.b):z instanceof THREE.DirectionalLight?(y.r+=E.r,y.g+=E.g,y.b+=E.b):z instanceof THREE.PointLight&&(F.r+=E.r,F.g+=E.g,F.b+=E.b)}for(l=0,G=g.length;l<G;l++)if(E=g[l],z=E.material,z=z instanceof THREE.MeshFaceMaterial?E.faceMaterial:z,!(z==null||z.opacity==0))if(t.empty(),E instanceof THREE.RenderableParticle)o=E,o.x*=
q,o.y*=-n;else if(E instanceof THREE.RenderableLine){if(o=E.v1,s=E.v2,o.positionScreen.x*=q,o.positionScreen.y*=-n,s.positionScreen.x*=q,s.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),r.intersects(t)){E=o;var T=s,W=B++;K[W]==null&&(K[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),O==0&&K[W].setAttribute("shape-rendering","crispEdges"));Q=K[W];Q.setAttribute("x1",E.positionScreen.x);Q.setAttribute("y1",E.positionScreen.y);
Q.setAttribute("x2",T.positionScreen.x);Q.setAttribute("y2",T.positionScreen.y);z instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+z.color.getContextStyle()+"; stroke-width: "+z.linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.linecap+"; stroke-linejoin: "+z.linejoin),i.appendChild(Q))}}else if(E instanceof THREE.RenderableFace3){if(o=E.v1,s=E.v2,m=E.v3,o.positionScreen.x*=q,o.positionScreen.y*=-n,s.positionScreen.x*=q,s.positionScreen.y*=-n,m.positionScreen.x*=
q,m.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,o.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),r.intersects(t)){var T=o,W=s,I=m;d.info.render.vertices+=3;d.info.render.faces++;Q=b(N++);Q.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?u.copy(z.color):z instanceof THREE.MeshLambertMaterial?
v?(u.r=w.r,u.g=w.g,u.b=w.b,a(e,E.centroidWorld,E.normalWorld,u),u.r=Math.max(0,Math.min(z.color.r*u.r,1)),u.g=Math.max(0,Math.min(z.color.g*u.g,1)),u.b=Math.max(0,Math.min(z.color.b*u.b,1))):u.copy(z.color):z instanceof THREE.MeshDepthMaterial?(D=1-z.__2near/(z.__farPlusNear-E.z*z.__farMinusNear),u.setRGB(D,D,D)):z instanceof THREE.MeshNormalMaterial&&u.setRGB(c(E.normalWorld.x),c(E.normalWorld.y),c(E.normalWorld.z));z.wireframe?Q.setAttribute("style","fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+
z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):Q.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(Q)}}else if(E instanceof THREE.RenderableFace4&&(o=E.v1,s=E.v2,m=E.v3,p=E.v4,o.positionScreen.x*=q,o.positionScreen.y*=-n,s.positionScreen.x*=q,s.positionScreen.y*=-n,m.positionScreen.x*=q,m.positionScreen.y*=-n,p.positionScreen.x*=q,p.positionScreen.y*=-n,t.addPoint(o.positionScreen.x,
o.positionScreen.y),t.addPoint(s.positionScreen.x,s.positionScreen.y),t.addPoint(m.positionScreen.x,m.positionScreen.y),t.addPoint(p.positionScreen.x,p.positionScreen.y),r.intersects(t))){var T=o,W=s,I=m,ma=p;d.info.render.vertices+=4;d.info.render.faces++;Q=b(N++);Q.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+I.positionScreen.x+","+I.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");z instanceof THREE.MeshBasicMaterial?
u.copy(z.color):z instanceof THREE.MeshLambertMaterial?v?(u.r=w.r,u.g=w.g,u.b=w.b,a(e,E.centroidWorld,E.normalWorld,u),u.r=Math.max(0,Math.min(z.color.r*u.r,1)),u.g=Math.max(0,Math.min(z.color.g*u.g,1)),u.b=Math.max(0,Math.min(z.color.b*u.b,1))):u.copy(z.color):z instanceof THREE.MeshDepthMaterial?(D=1-z.__2near/(z.__farPlusNear-E.z*z.__farMinusNear),u.setRGB(D,D,D)):z instanceof THREE.MeshNormalMaterial&&u.setRGB(c(E.normalWorld.x),c(E.normalWorld.y),c(E.normalWorld.z));z.wireframe?Q.setAttribute("style",
"fill: none; stroke: "+u.getContextStyle()+"; stroke-width: "+z.wireframeLinewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframeLinecap+"; stroke-linejoin: "+z.wireframeLinejoin):Q.setAttribute("style","fill: "+u.getContextStyle()+"; fill-opacity: "+z.opacity);i.appendChild(Q)}}};
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
envmap_fragment:"#ifdef USE_ENVMAP\n#ifdef DOUBLE_SIDED\nfloat flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );\nvec4 cubeColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#else\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#endif\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform 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\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",
lights_lambert_vertex:"vLightFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\nvLightBack = vec3( 0.0 );\n#endif\ntransformedNormal = normalize( transformedNormal );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nfloat dotProduct = dot( transformedNormal, dirVector );\nvec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\ndirectionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\ndirectionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += directionalLightColor[ i ] * directionalLightWeighting;\n#ifdef DOUBLE_SIDED\nvLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;\n#endif\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 dotProduct = dot( transformedNormal, lVector );\nvec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );\n#ifdef DOUBLE_SIDED\nvec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );\n#endif\n#endif\n#ifdef WRAP_AROUND\nvec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );\npointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );\n#ifdef DOUBLE_SIDED\npointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );\n#endif\n#endif\nvLightFront += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef DOUBLE_SIDED\nvLightBack += pointLightColor[ i ] * pointLightWeightingBack * lDistance;\n#endif\n}\n#endif\nvLightFront = vLightFront * diffuse + ambient * ambientLightColor;\n#ifdef DOUBLE_SIDED\nvLightBack = vLightBack * diffuse + ambient * ambientLightColor;\n#endif",
lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",lights_phong_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif",
lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#ifdef DOUBLE_SIDED\nnormal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n#endif\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse  = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\nfloat dotProduct = dot( normal, lVector );\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dotProduct, 0.0 );\n#endif\npointDiffuse  += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\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 );\nfloat dotProduct = dot( normal, dirVector );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dotProduct, 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dotProduct, 0.0 );\n#endif\ndirDiffuse  += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * modelViewMatrix * gl_Position;\n#endif",
morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n#ifndef USE_MORPHNORMALS\nuniform float morphTargetInfluences[ 8 ];\n#else\nuniform float morphTargetInfluences[ 4 ];\n#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n#ifndef USE_MORPHNORMALS\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n#endif\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",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\nvec3 morphedNormal = vec3( 0.0 );\nmorphedNormal +=  ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\nmorphedNormal +=  ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\nmorphedNormal +=  ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\nmorphedNormal +=  ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\nmorphedNormal += normal;\nvec3 transformedNormal = normalMatrix * morphedNormal;\n#else\nvec3 transformedNormal = normalMatrix * normal;\n#endif",
shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform vec2 shadowMapSize[ MAX_SHADOWS ];\nuniform float shadowDarkness[ MAX_SHADOWS ];\nuniform float shadowBias[ MAX_SHADOWS ];\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_DEBUG\nvec3 frustumColors[3];\nfrustumColors[0] = vec3( 1.0, 0.5, 0.0 );\nfrustumColors[1] = vec3( 0.0, 1.0, 0.8 );\nfrustumColors[2] = vec3( 0.0, 0.5, 1.0 );\n#endif\n#ifdef SHADOWMAP_CASCADE\nint inFrustumCount = 0;\n#endif\nfloat fDepth;\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nbool inFrustum = all( inFrustumVec );\n#ifdef SHADOWMAP_CASCADE\ninFrustumCount += int( inFrustum );\nbvec3 frustumTestVec = bvec3( inFrustum, inFrustumCount == 1, shadowCoord.z <= 1.0 );\n#else\nbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n#endif\nbool frustumTest = all( frustumTestVec );\nif ( frustumTest ) {\nshadowCoord.z += shadowBias[ i ];\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nfloat xPixelOffset = 1.0 / shadowMapSize[ i ].x;\nfloat yPixelOffset = 1.0 / shadowMapSize[ i ].y;\nfloat dx0 = -1.25 * xPixelOffset;\nfloat dy0 = -1.25 * yPixelOffset;\nfloat dx1 = 1.25 * xPixelOffset;\nfloat dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness[ i ] * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );\n#endif\n}\n#ifdef SHADOWMAP_DEBUG\n#ifdef SHADOWMAP_CASCADE\nif ( inFrustum && inFrustumCount == 1 ) gl_FragColor.xyz *= frustumColors[ i ];\n#else\nif ( inFrustum ) gl_FragColor.xyz *= frustumColors[ i ];\n#endif\n#endif\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n#ifdef USE_MORPHTARGETS\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( morphed, 1.0 );\n#else\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n#endif\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",
linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
THREE.UniformsUtils={merge:function(a){var b,c,d,f={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)f[c]=d[c];return f},clone:function(a){var b,c,d,f={};for(b in a)for(c in f[b]={},a[b])d=a[b][c],f[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return f}};
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMapSize:{type:"v2v",value:[]},shadowBias:{type:"fv1",value:[]},shadowDarkness:{type:"fv1",value:[]},shadowMatrix:{type:"m4v",value:[]}}};
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",
value:1}},vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["varying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",
THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,
THREE.ShaderChunk.morphnormal_vertex,THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform float opacity;\nvarying vec3 vLightFront;\n#ifdef DOUBLE_SIDED\nvarying vec3 vLightBack;\n#endif",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,
THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,"#ifdef DOUBLE_SIDED\nif ( gl_FrontFacing )\ngl_FragColor.xyz *= vLightFront;\nelse\ngl_FragColor.xyz *= vLightBack;\n#else\ngl_FragColor.xyz *= vLightFront;\n#endif",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,
THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),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;",
THREE.ShaderChunk.morphnormal_vertex,"vNormal = transformedNormal;",THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,
THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,
THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in d.attributes){var e=d.attributes[f];if(!e.__webglInitialized||e.createUniqueBuffers){e.__webglInitialized=!0;var g=1;e.type==="v2"?g=2:e.type==="v3"?g=3:e.type==="v4"?g=4:e.type==="c"&&(g=3);e.size=g;e.array=new Float32Array(c*g);e.buffer=l.createBuffer();e.buffer.belongsToAttribute=f;e.needsUpdate=!0}a.__webglCustomAttributesList.push(e)}}}
function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function f(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function g(a,b,c){var d,f,e,g,h=a.vertices;g=h.length;
var i=a.colors,j=i.length,k=a.__vertexArray,m=a.__colorArray,n=a.__sortArray,q=a.__dirtyVertices,o=a.__dirtyColors,s=a.__webglCustomAttributesList;if(c.sortParticles){za.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)f=h[d].position,wa.copy(f),za.multiplyVector3(wa),n[d]=[wa.z,d];n.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)f=h[n[d][1]].position,e=d*3,k[e]=f.x,k[e+1]=f.y,k[e+2]=f.z;for(d=0;d<j;d++)e=d*3,f=i[n[d][1]],m[e]=f.r,m[e+1]=f.g,m[e+2]=f.b;if(s)for(i=0,j=s.length;i<j;i++)if(h=s[i],
h.boundTo===void 0||h.boundTo==="vertices")if(e=0,f=h.value.length,h.size===1)for(d=0;d<f;d++)g=n[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=n[d][1],g=h.value[g],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,e+=3;else if(h.size===4)for(d=0;d<f;d++)g=n[d][1],g=h.value[g],
h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+3]=g.w,e+=4}else{if(q)for(d=0;d<g;d++)f=h[d].position,e=d*3,k[e]=f.x,k[e+1]=f.y,k[e+2]=f.z;if(o)for(d=0;d<j;d++)f=i[d],e=d*3,m[e]=f.r,m[e+1]=f.g,m[e+2]=f.b;if(s)for(i=0,j=s.length;i<j;i++)if(h=s[i],h.needsUpdate&&(h.boundTo===void 0||h.boundTo==="vertices"))if(f=h.value.length,e=0,h.size===1)for(d=0;d<f;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,e+=2;else if(h.size===3)if(h.type===
"c")for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.r,h.array[e+1]=g.g,h.array[e+2]=g.b,e+=3;else for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,e+=3;else if(h.size===4)for(d=0;d<f;d++)g=h.value[d],h.array[e]=g.x,h.array[e+1]=g.y,h.array[e+2]=g.z,h.array[e+3]=g.w,e+=4}if(q||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,k,b);if(o||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,m,
b);if(s)for(i=0,j=s.length;i<j;i++)if(h=s[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}function e(a,b){return b.z-a.z}function h(a,b,c){if(a.length)for(var d=0,f=a.length;d<f;d++)M=E=null,T=W=Y=U=X=-1,a[d].render(b,c,Aa,ya),M=E=null,T=W=Y=U=X=-1}function i(a,b,c,d,f,e,g,h){var i,j,l,k;b?(j=a.length-1,k=b=-1):(j=0,b=a.length,k=1);for(var m=j;m!==b;m+=k)if(i=a[m],i.render){j=i.object;l=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;g&&
A.setBlending(i.blending);A.setDepthTest(i.depthTest);A.setDepthWrite(i.depthWrite);r(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}A.setObjectFaces(j);l instanceof THREE.BufferGeometry?A.renderBufferDirect(d,f,e,i,l,j):A.renderBuffer(d,f,e,i,l,j)}}function j(a,b,c,d,f,e,g){for(var h,i,j=0,l=a.length;j<l;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;e&&A.setBlending(h.blending);A.setDepthTest(h.depthTest);A.setDepthWrite(h.depthWrite);r(h.polygonOffset,h.polygonOffsetFactor,
h.polygonOffsetUnits)}A.renderImmediateObject(c,d,f,h,i)}}function k(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function q(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function n(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function s(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function m(a,b,c,d,f){d.program||A.initMaterial(d,b,c,f);if(d.morphTargets&&
!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(A.maxMorphTargets);for(var e=0,g=A.maxMorphTargets;e<g;e++)f.__webglMorphTargetInfluences[e]=0}var h=!1,e=d.program,g=e.uniforms,i=d.uniforms;e!==E&&(l.useProgram(e),E=e,h=!0);if(d.id!==T)T=d.id,h=!0;if(h||a!==M)l.uniformMatrix4fv(g.projectionMatrix,!1,a._projectionMatrixArray),a!==M&&(M=a);if(h){if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof
THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var j,k=0,m=0,n=0,q,o,s,p=na,r=p.directional.colors,t=p.directional.positions,z=p.point.colors,u=p.point.positions,w=p.point.distances,D=0,G=0,W=s=0;for(c=0,h=b.length;c<h;c++)if(j=b[c],!j.onlyShadow)if(q=j.color,o=j.intensity,s=j.distance,j instanceof THREE.AmbientLight)A.gammaInput?(k+=q.r*q.r,m+=q.g*q.g,n+=q.b*q.b):(k+=q.r,m+=q.g,n+=q.b);else if(j instanceof THREE.DirectionalLight)s=
D*3,A.gammaInput?(r[s]=q.r*q.r*o*o,r[s+1]=q.g*q.g*o*o,r[s+2]=q.b*q.b*o*o):(r[s]=q.r*o,r[s+1]=q.g*o,r[s+2]=q.b*o),sa.copy(j.matrixWorld.getPosition()),sa.subSelf(j.target.matrixWorld.getPosition()),sa.normalize(),t[s]=sa.x,t[s+1]=sa.y,t[s+2]=sa.z,D+=1;else if(j instanceof THREE.PointLight||j instanceof THREE.SpotLight)W=G*3,A.gammaInput?(z[W]=q.r*q.r*o*o,z[W+1]=q.g*q.g*o*o,z[W+2]=q.b*q.b*o*o):(z[W]=q.r*o,z[W+1]=q.g*o,z[W+2]=q.b*o),j=j.matrixWorld.getPosition(),u[W]=j.x,u[W+1]=j.y,u[W+2]=j.z,w[G]=s,
G+=1;for(c=D*3,h=r.length;c<h;c++)r[c]=0;for(c=G*3,h=z.length;c<h;c++)z[c]=0;p.point.length=G;p.directional.length=D;p.ambient[0]=k;p.ambient[1]=m;p.ambient[2]=n;c=na;i.ambientLightColor.value=c.ambient;i.directionalLightColor.value=c.directional.colors;i.directionalLightDirection.value=c.directional.positions;i.pointLightColor.value=c.point.colors;i.pointLightPosition.value=c.point.positions;i.pointLightDistance.value=c.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,A.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=
d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=F.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,A.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
(i.ambient.value=d.ambient,i.specular.value=d.specular),d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)A.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient,d.wrapAround&&i.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&i.shadowMatrix){h=
c=0;for(k=b.length;h<k;h++)if(m=b[h],m.castShadow&&(m instanceof THREE.SpotLight||m instanceof THREE.DirectionalLight&&!m.shadowCascade))i.shadowMap.texture[c]=m.shadowMap,i.shadowMapSize.value[c]=m.shadowMapSize,i.shadowMatrix.value[c]=m.shadowMatrix,i.shadowDarkness.value[c]=m.shadowDarkness,i.shadowBias.value[c]=m.shadowBias,c++}b=d.uniformsList;for(i=0,c=b.length;i<c;i++)if(m=e.uniforms[b[i][1]])if(h=b[i][0],n=h.type,k=h.value,n==="i")l.uniform1i(m,k);else if(n==="f")l.uniform1f(m,k);else if(n===
"v2")l.uniform2f(m,k.x,k.y);else if(n==="v3")l.uniform3f(m,k.x,k.y,k.z);else if(n==="v4")l.uniform4f(m,k.x,k.y,k.z,k.w);else if(n==="c")l.uniform3f(m,k.r,k.g,k.b);else if(n==="fv1")l.uniform1fv(m,k);else if(n==="fv")l.uniform3fv(m,k);else if(n==="v2v"){if(!h._array)h._array=new Float32Array(2*k.length);for(n=0,p=k.length;n<p;n++)r=n*2,h._array[r]=k[n].x,h._array[r+1]=k[n].y;l.uniform2fv(m,h._array)}else if(n==="v3v"){if(!h._array)h._array=new Float32Array(3*k.length);for(n=0,p=k.length;n<p;n++)r=
n*3,h._array[r]=k[n].x,h._array[r+1]=k[n].y,h._array[r+2]=k[n].z;l.uniform3fv(m,h._array)}else if(n=="v4v"){if(!h._array)h._array=new Float32Array(4*k.length);for(n=0,p=k.length;n<p;n++)r=n*4,h._array[r]=k[n].x,h._array[r+1]=k[n].y,h._array[r+2]=k[n].z,h._array[r+3]=k[n].w;l.uniform4fv(m,h._array)}else if(n==="m4"){if(!h._array)h._array=new Float32Array(16);k.flattenToArray(h._array);l.uniformMatrix4fv(m,!1,h._array)}else if(n==="m4v"){if(!h._array)h._array=new Float32Array(16*k.length);for(n=0,p=
k.length;n<p;n++)k[n].flattenToArrayOffset(h._array,n*16);l.uniformMatrix4fv(m,!1,h._array)}else if(n==="t"){if(l.uniform1i(m,k),m=h.texture)if(m.image instanceof Array&&m.image.length===6){if(h=m,h.image.length===6)if(h.needsUpdate){if(!h.image.__webglTextureCube)h.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+k);l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube);k=[];for(m=0;m<6;m++){n=k;p=m;if(A.autoScaleCubemaps){if(r=h.image[m],z=ta,!(r.width<=z&&r.height<=z))u=
Math.max(r.width,r.height),t=Math.floor(r.width*z/u),z=Math.floor(r.height*z/u),u=document.createElement("canvas"),u.width=t,u.height=z,u.getContext("2d").drawImage(r,0,0,r.width,r.height,0,0,t,z),r=u}else r=h.image[m];n[p]=r}m=k[0];n=(m.width&m.width-1)===0&&(m.height&m.height-1)===0;p=y(h.format);r=y(h.type);v(l.TEXTURE_CUBE_MAP,h,n);for(m=0;m<6;m++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,p,p,r,k[m]);h.generateMipmaps&&n&&l.generateMipmap(l.TEXTURE_CUBE_MAP);h.needsUpdate=!1;if(h.onUpdate)h.onUpdate()}else l.activeTexture(l.TEXTURE0+
k),l.bindTexture(l.TEXTURE_CUBE_MAP,h.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(h=m,l.activeTexture(l.TEXTURE0+k),l.bindTexture(l.TEXTURE_CUBE_MAP,h.__webglTexture)):A.setTexture(m,k)}else if(n==="tv"){if(!h._array){h._array=[];for(n=0,p=h.texture.length;n<p;n++)h._array[n]=k+n}l.uniform1iv(m,h._array);for(n=0,p=h.texture.length;n<p;n++)(m=h.texture[n])&&A.setTexture(m,h._array[n])}if((d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&
g.cameraPosition!==null)b=a.matrixWorld.getPosition(),l.uniform3f(g.cameraPosition,b.x,b.y,b.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&l.uniformMatrix4fv(g.viewMatrix,!1,a._viewMatrixArray);d.skinning&&l.uniformMatrix4fv(g.boneGlobalMatrices,!1,f.boneMatrices)}l.uniformMatrix4fv(g.modelViewMatrix,!1,f._modelViewMatrixArray);g.normalMatrix&&l.uniformMatrix3fv(g.normalMatrix,!1,f._normalMatrixArray);
(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&g.objectMatrix!==null&&l.uniformMatrix4fv(g.objectMatrix,!1,f._objectMatrixArray);return e}function p(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);c&&c.transposeIntoArray(a._normalMatrixArray)}function r(a,b,c){$!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),$=a);if(a&&(oa!==b||ga!==c))l.polygonOffset(b,
c),oa=b,ga=c}function t(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);return!l.getShaderParameter(c,l.COMPILE_STATUS)?(console.error(l.getShaderInfoLog(c)),console.error(b),null):c}function v(a,b,c){c?(l.texParameteri(a,l.TEXTURE_WRAP_S,y(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,y(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,y(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,y(b.minFilter))):
(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,w(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,w(b.minFilter)))}function u(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,
l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function w(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;default:return l.LINEAR}}function y(a){switch(a){case THREE.RepeatWrapping:return l.REPEAT;case THREE.ClampToEdgeWrapping:return l.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return l.MIRRORED_REPEAT;
case THREE.NearestFilter:return l.NEAREST;case THREE.NearestMipMapNearestFilter:return l.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return l.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return l.LINEAR;case THREE.LinearMipMapNearestFilter:return l.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return l.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return l.BYTE;case THREE.UnsignedByteType:return l.UNSIGNED_BYTE;case THREE.ShortType:return l.SHORT;case THREE.UnsignedShortType:return l.UNSIGNED_SHORT;
case THREE.IntType:return l.INT;case THREE.UnsignedIntType:return l.UNSIGNED_INT;case THREE.FloatType:return l.FLOAT;case THREE.AlphaFormat:return l.ALPHA;case THREE.RGBFormat:return l.RGB;case THREE.RGBAFormat:return l.RGBA;case THREE.LuminanceFormat:return l.LUMINANCE;case THREE.LuminanceAlphaFormat:return l.LUMINANCE_ALPHA}return 0}var a=a||{},F=a.canvas!==void 0?a.canvas:document.createElement("canvas"),D=a.precision!==void 0?a.precision:"mediump",G=a.alpha!==void 0?a.alpha:!0,I=a.premultipliedAlpha!==
void 0?a.premultipliedAlpha:!0,K=a.antialias!==void 0?a.antialias:!1,Q=a.stencil!==void 0?a.stencil:!0,N=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,B=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),O=a.clearAlpha!==void 0?a.clearAlpha:0,S=a.maxLights!==void 0?a.maxLights:4;this.domElement=F;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.shadowMapEnabled=
this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.shadowMapCascade=this.shadowMapDebug=!1;this.maxMorphTargets=8;this.maxMorphNormals=4;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var A=this,l,V=[],E=null,z=null,T=-1,W=null,M=null,ma=0,aa=null,Z=null,X=null,U=null,Y=null,
$=null,oa=null,ga=null,ra=null,qa=0,ha=0,ka=0,Ea=0,Aa=0,ya=0,xa=new THREE.Frustum,za=new THREE.Matrix4,wa=new THREE.Vector4,sa=new THREE.Vector3,na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};l=function(){var a;try{if(!(a=F.getContext("experimental-webgl",{alpha:G,premultipliedAlpha:I,antialias:K,stencil:Q,preserveDrawingBuffer:N})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+
" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(B.r,B.g,B.b,O);this.context=l;var ja=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS);
l.getParameter(l.MAX_TEXTURE_SIZE);var ta=l.getParameter(l.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return l};this.supportsVertexTextures=function(){return ja>0};this.setSize=function(a,b){F.width=a;F.height=b;this.setViewport(0,0,F.width,F.height)};this.setViewport=function(a,b,c,d){qa=a;ha=b;ka=c;Ea=d;l.viewport(qa,ha,ka,Ea)};this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=
function(a,b){B.setHex(a);O=b;l.clearColor(B.r,B.g,B.b,O)};this.setClearColor=function(a,b){B.copy(a);O=b;l.clearColor(B.r,B.g,B.b,O)};this.getClearColor=function(){return B};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=l.COLOR_BUFFER_BIT;if(b===void 0||b)d|=l.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);
this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];l.deleteBuffer(c.__webglVertexBuffer);l.deleteBuffer(c.__webglNormalBuffer);l.deleteBuffer(c.__webglTangentBuffer);
l.deleteBuffer(c.__webglColorBuffer);l.deleteBuffer(c.__webglUVBuffer);l.deleteBuffer(c.__webglUV2Buffer);l.deleteBuffer(c.__webglSkinVertexABuffer);l.deleteBuffer(c.__webglSkinVertexBBuffer);l.deleteBuffer(c.__webglSkinIndicesBuffer);l.deleteBuffer(c.__webglSkinWeightsBuffer);l.deleteBuffer(c.__webglFaceBuffer);l.deleteBuffer(c.__webglLineBuffer);var d=void 0,f=void 0;if(c.numMorphTargets)for(d=0,f=c.numMorphTargets;d<f;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.numMorphNormals)for(d=
0,f=c.numMorphNormals;d<f;d++)l.deleteBuffer(c.__webglMorphNormalsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer);A.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),
A.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),A.info.memory.textures--};this.updateShadowMap=function(a,b){E=null;T=W=Y=U=X=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=l.createBuffer();
if(!a.__webglNormalBuffer)a.__webglNormalBuffer=l.createBuffer();a.hasPos&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),l.enableVertexAttribArray(b.attributes.position),l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormal){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,e,g,h,i,j,k,m,n,q=a.count*3;for(n=0;n<q;n+=9)c=a.normalArray,d=c[n],f=c[n+1],e=c[n+2],g=c[n+3],i=c[n+
4],k=c[n+5],h=c[n+6],j=c[n+7],m=c[n+8],d=(d+g+h)/3,f=(f+i+j)/3,e=(e+k+m)/3,c[n]=d,c[n+1]=f,c[n+2]=e,c[n+3]=d,c[n+4]=f,c[n+5]=e,c[n+6]=d,c[n+7]=f,c[n+8]=e}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.normal);l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}l.drawArrays(l.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,e){if(d.opacity!==0&&(c=m(a,b,c,d,e),a=c.attributes,b=!1,d=f.id*16777215+c.id*2+(d.wireframe?
1:0),d!==W&&(W=d,b=!0),e instanceof THREE.Mesh)){e=f.offsets;d=0;for(c=e.length;d<c;++d)b&&(l.bindBuffer(l.ARRAY_BUFFER,f.vertexPositionBuffer),l.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,l.FLOAT,!1,0,e[d].index*12),a.normal>=0&&f.vertexNormalBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,f.vertexNormalBuffer),l.vertexAttribPointer(a.normal,f.vertexNormalBuffer.itemSize,l.FLOAT,!1,0,e[d].index*12)),a.uv>=0&&f.vertexUvBuffer&&(f.vertexUvBuffer?(l.bindBuffer(l.ARRAY_BUFFER,f.vertexUvBuffer),
l.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,l.FLOAT,!1,0,e[d].index*8),l.enableVertexAttribArray(a.uv)):l.disableVertexAttribArray(a.uv)),a.color>=0&&f.vertexColorBuffer&&(l.bindBuffer(l.ARRAY_BUFFER,f.vertexColorBuffer),l.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,l.FLOAT,!1,0,e[d].index*16)),l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f.vertexIndexBuffer)),l.drawElements(l.TRIANGLES,e[d].count,l.UNSIGNED_SHORT,e[d].start*2),A.info.render.calls++,A.info.render.vertices+=e[d].count,
A.info.render.faces+=e[d].count/3}};this.renderBuffer=function(a,b,c,d,f,e){if(d.opacity!==0){var g,h,c=m(a,b,c,d,e),b=c.attributes,a=!1,c=f.id*16777215+c.id*2+(d.wireframe?1:0);c!==W&&(W=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(e.morphTargetBase){c=d.program.attributes;e.morphTargetBase!==-1?(l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[e.morphTargetBase]),l.vertexAttribPointer(c.position,
3,l.FLOAT,!1,0,0)):c.position>=0&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglVertexBuffer),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(e.morphTargetForcedOrder.length){g=0;var i=e.morphTargetForcedOrder;for(h=e.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i[g]]),l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0),d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[i[g]]),l.vertexAttribPointer(c["morphNormal"+
g],3,l.FLOAT,!1,0,0)),e.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],j=-1,k=0;h=e.morphTargetInfluences;var n,q=h.length;g=0;for(e.morphTargetBase!==-1&&(i[e.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<q;n++)!i[n]&&h[n]>j&&(k=n,j=h[k]);l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);d.morphNormals&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglMorphNormalsBuffers[k]),l.vertexAttribPointer(c["morphNormal"+
g],3,l.FLOAT,!1,0,0));e.__webglMorphTargetInfluences[g]=j;i[k]=1;j=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,e.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList)for(g=0,h=f.__webglCustomAttributesList.length;g<h;g++)c=f.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0));b.color>=0&&
(l.bindBuffer(l.ARRAY_BUFFER,f.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));b.normal>=0&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));b.tangent>=0&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));b.uv>=0&&(f.__webglUVBuffer?(l.bindBuffer(l.ARRAY_BUFFER,f.__webglUVBuffer),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv)):l.disableVertexAttribArray(b.uv));
b.uv2>=0&&(f.__webglUV2Buffer?(l.bindBuffer(l.ARRAY_BUFFER,f.__webglUV2Buffer),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv2)):l.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(l.bindBuffer(l.ARRAY_BUFFER,f.__webglSkinVertexABuffer),l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,
f.__webglSkinIndicesBuffer),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0))}e instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ra&&(l.lineWidth(d),ra=d),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),l.drawElements(l.LINES,f.__webglLineCount,l.UNSIGNED_SHORT,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),l.drawElements(l.TRIANGLES,f.__webglFaceCount,
l.UNSIGNED_SHORT,0)),A.info.render.calls++,A.info.render.vertices+=f.__webglFaceCount,A.info.render.faces+=f.__webglFaceCount/3):e instanceof THREE.Line?(e=e.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==ra&&(l.lineWidth(d),ra=d),l.drawArrays(e,0,f.__webglLineCount),A.info.render.calls++):e instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,f.__webglParticleCount),A.info.render.calls++,A.info.render.points+=f.__webglParticleCount):e instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,
0,f.__webglVertexCount),A.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,k,n,m=a.__lights,q=a.fog;T=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();h(this.renderPluginsPre,a,b);A.info.render.calls=0;A.info.render.vertices=0;A.info.render.faces=0;A.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=
new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);za.multiply(b.projectionMatrix,b.matrixWorldInverse);xa.setFromMatrix(za);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;for(d=0,f=n.length;d<f;d++)if(g=n[d],k=g.object,g.render=!1,k.visible&&(!(k instanceof
THREE.Mesh||k instanceof THREE.ParticleSystem)||!k.frustumCulled||xa.contains(k))){k.matrixWorld.flattenToArray(k._objectMatrixArray);p(k,b);var o=g,s=o.object,t=o.buffer,z=void 0,z=z=void 0,z=s.material;if(z instanceof THREE.MeshFaceMaterial){if(z=t.materialIndex,z>=0)z=s.geometry.materials[z],z.transparent?(o.transparent=z,o.opaque=null):(o.opaque=z,o.transparent=null)}else if(z)z.transparent?(o.transparent=z,o.opaque=null):(o.opaque=z,o.transparent=null);g.render=!0;if(this.sortObjects)k.renderDepth?
g.z=k.renderDepth:(wa.copy(k.position),za.multiplyVector3(wa),g.z=wa.z)}this.sortObjects&&n.sort(e);n=a.__webglObjectsImmediate;for(d=0,f=n.length;d<f;d++)if(g=n[d],k=g.object,k.visible)k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),p(k,b),k=g.object.material,k.transparent?(g.transparent=k,g.opaque=null):(g.opaque=k,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),
r(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),i(a.__webglObjects,!1,"",b,m,q,!0,a.overrideMaterial),j(a.__webglObjectsImmediate,"",b,m,q,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),i(a.__webglObjects,!0,"opaque",b,m,q,!1),j(a.__webglObjectsImmediate,"opaque",b,m,q,!1),i(a.__webglObjects,!1,"transparent",b,m,q,!0),j(a.__webglObjectsImmediate,"transparent",b,m,q,!0));h(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&
c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,c.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,f){var e=m(a,b,c,d,f);W=-1;A.setObjectFaces(f);f.immediateRenderCallback?
f.immediateRenderCallback(e,l,xa):f.render(function(a){A.renderBufferImmediate(a,e,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],h=a,i=void 0,j=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){if(j=e.geometry,j instanceof THREE.Geometry){if(j.geometryGroups===void 0){var m=j,p=void 0,r=void 0,t=void 0,z=void 0,C=void 0,u=void 0,w=void 0,v={},D=m.morphTargets.length,E=m.morphNormals.length;m.geometryGroups={};for(p=0,r=m.faces.length;p<r;p++)t=m.faces[p],z=t.materialIndex,u=z!==void 0?z:-1,v[u]===void 0&&(v[u]={hash:u,counter:0}),w=v[u].hash+"_"+v[u].counter,m.geometryGroups[w]===void 0&&(m.geometryGroups[w]=
{faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:D,numMorphNormals:E}),C=t instanceof THREE.Face3?3:4,m.geometryGroups[w].vertices+C>65535&&(v[u].counter+=1,w=v[u].hash+"_"+v[u].counter,m.geometryGroups[w]===void 0&&(m.geometryGroups[w]={faces3:[],faces4:[],materialIndex:z,vertices:0,numMorphTargets:D,numMorphNormals:E})),t instanceof THREE.Face3?m.geometryGroups[w].faces3.push(p):m.geometryGroups[w].faces4.push(p),m.geometryGroups[w].vertices+=C;m.geometryGroupsList=[];p=void 0;for(p in m.geometryGroups)m.geometryGroups[p].id=
ma++,m.geometryGroupsList.push(m.geometryGroups[p])}for(i in j.geometryGroups)if(m=j.geometryGroups[i],!m.__webglVertexBuffer){p=m;p.__webglVertexBuffer=l.createBuffer();p.__webglNormalBuffer=l.createBuffer();p.__webglTangentBuffer=l.createBuffer();p.__webglColorBuffer=l.createBuffer();p.__webglUVBuffer=l.createBuffer();p.__webglUV2Buffer=l.createBuffer();p.__webglSkinVertexABuffer=l.createBuffer();p.__webglSkinVertexBBuffer=l.createBuffer();p.__webglSkinIndicesBuffer=l.createBuffer();p.__webglSkinWeightsBuffer=
l.createBuffer();p.__webglFaceBuffer=l.createBuffer();p.__webglLineBuffer=l.createBuffer();t=r=void 0;if(p.numMorphTargets){p.__webglMorphTargetsBuffers=[];for(r=0,t=p.numMorphTargets;r<t;r++)p.__webglMorphTargetsBuffers.push(l.createBuffer())}if(p.numMorphNormals){p.__webglMorphNormalsBuffers=[];for(r=0,t=p.numMorphNormals;r<t;r++)p.__webglMorphNormalsBuffers.push(l.createBuffer())}A.info.memory.geometries++;z=e;C=z.geometry;r=m.faces3;u=m.faces4;p=r.length*3+u.length*4;t=r.length*1+u.length*2;u=
r.length*3+u.length*4;r=c(z,m);w=f(r);v=d(r);D=r.vertexColors?r.vertexColors:!1;m.__vertexArray=new Float32Array(p*3);if(v)m.__normalArray=new Float32Array(p*3);if(C.hasTangents)m.__tangentArray=new Float32Array(p*4);if(D)m.__colorArray=new Float32Array(p*3);if(w){if(C.faceUvs.length>0||C.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(C.faceUvs.length>1||C.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(z.geometry.skinWeights.length&&z.geometry.skinIndices.length)m.__skinVertexAArray=
new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(t*3);m.__lineArray=new Uint16Array(u*2);C=z=void 0;if(m.numMorphTargets){m.__morphTargetsArrays=[];for(z=0,C=m.numMorphTargets;z<C;z++)m.__morphTargetsArrays.push(new Float32Array(p*3))}if(m.numMorphNormals){m.__morphNormalsArrays=[];for(z=0,C=m.numMorphNormals;z<C;z++)m.__morphNormalsArrays.push(new Float32Array(p*3))}m.__webglFaceCount=
t*3;m.__webglLineCount=u*2;if(r.attributes){if(m.__webglCustomAttributesList===void 0)m.__webglCustomAttributesList=[];t=void 0;for(t in r.attributes){var z=r.attributes[t],C={},y;for(y in z)C[y]=z[y];if(!C.__webglInitialized||C.createUniqueBuffers)C.__webglInitialized=!0,u=1,C.type==="v2"?u=2:C.type==="v3"?u=3:C.type==="v4"?u=4:C.type==="c"&&(u=3),C.size=u,C.array=new Float32Array(p*u),C.buffer=l.createBuffer(),C.buffer.belongsToAttribute=t,z.needsUpdate=!0,C.__original=z;m.__webglCustomAttributesList.push(C)}}m.__inittedArrays=
!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}}}else if(e instanceof THREE.Ribbon){if(j=e.geometry,!j.__webglVertexBuffer)m=j,m.__webglVertexBuffer=l.createBuffer(),m.__webglColorBuffer=l.createBuffer(),A.info.memory.geometries++,m=j,p=m.vertices.length,m.__vertexArray=new Float32Array(p*3),m.__colorArray=new Float32Array(p*3),m.__webglVertexCount=p,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(e instanceof
THREE.Line){if(j=e.geometry,!j.__webglVertexBuffer)m=j,m.__webglVertexBuffer=l.createBuffer(),m.__webglColorBuffer=l.createBuffer(),A.info.memory.geometries++,m=j,p=e,r=m.vertices.length,m.__vertexArray=new Float32Array(r*3),m.__colorArray=new Float32Array(r*3),m.__webglLineCount=r,b(m,p),j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(j=e.geometry,!j.__webglVertexBuffer))m=j,m.__webglVertexBuffer=l.createBuffer(),m.__webglColorBuffer=l.createBuffer(),A.info.geometries++,
m=j,p=e,r=m.vertices.length,m.__vertexArray=new Float32Array(r*3),m.__colorArray=new Float32Array(r*3),m.__sortArray=[],m.__webglParticleCount=r,b(m,p),j.__dirtyVertices=!0,j.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)if(j=e.geometry,j instanceof THREE.BufferGeometry)k(h.__webglObjects,j,e);else for(i in j.geometryGroups)m=j.geometryGroups[i],k(h.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(j=e.geometry,k(h.__webglObjects,
j,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?h.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite?h.__webglSprites.push(e):e instanceof THREE.LensFlare&&h.__webglFlares.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)e=a.__objectsRemoved[0],h=a,e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line?o(h.__webglObjects,
e):e instanceof THREE.Sprite?s(h.__webglSprites,e):e instanceof THREE.LensFlare?s(h.__webglFlares,e):(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&o(h.__webglObjectsImmediate,e),e.__webglActive=!1,a.__objectsRemoved.splice(0,1);e=0;for(h=a.__webglObjects.length;e<h;e++)if(y=a.__webglObjects[e].object,i=y.geometry,j=t=r=void 0,y instanceof THREE.Mesh)if(i instanceof THREE.BufferGeometry)i.__dirtyVertices=!1,i.__dirtyElements=!1,i.__dirtyUvs=!1,i.__dirtyNormals=!1,i.__dirtyColors=!1;
else{m=0;for(p=i.geometryGroupsList.length;m<p;m++)if(r=i.geometryGroupsList[m],j=c(y,r),t=j.attributes&&q(j),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||t){var T=y,t=l.DYNAMIC_DRAW,z=!i.dynamic,v=j;if(r.__inittedArrays){var D=d(v),E=v.vertexColors?v.vertexColors:!1,W=f(v),G=D===THREE.SmoothShading,F=u=C=void 0,J=void 0,I=void 0,Z=void 0,L=void 0,K=void 0,S=void 0,O=F=void 0,P=void 0,M=void 0,B=void 0,N=J=void 0,
aa=void 0,Q=void 0,U=B=M=P=J=S=void 0,X=void 0,Y=void 0,$=L=void 0,V=void 0,ca=J=P=V=$=M=P=V=$=M=P=V=$=M=P=void 0,ga=void 0,oa=Z=void 0,ka=void 0,ia=void 0,ra=void 0,ha=void 0,la=void 0,B=la=void 0,qa=O=ia=ga=0,na=0,ja=ca=F=0,ba=L=N=0,H=0,pa=void 0,ba=r.__vertexArray,ka=r.__uvArray,H=r.__uv2Array,oa=r.__normalArray,I=r.__tangentArray,aa=r.__colorArray,U=r.__skinVertexAArray,X=r.__skinVertexBArray,Y=r.__skinIndexArray,K=r.__skinWeightArray,$=r.__morphTargetsArrays,V=r.__morphNormalsArrays,w=r.__webglCustomAttributesList,
x=void 0,x=r.__faceArray,pa=r.__lineArray,Q=T.geometry,sa=Q.__dirtyElements,ta=Q.__dirtyUvs,Z=Q.__dirtyNormals,S=Q.__dirtyTangents,Ea=Q.__dirtyColors,ra=Q.__dirtyMorphTargets,la=Q.vertices,T=r.faces3,fa=r.faces4,ea=Q.faces,Aa=Q.faceVertexUvs[0],za=Q.faceVertexUvs[1],wa=Q.skinVerticesA,ya=Q.skinVerticesB,xa=Q.skinIndices,Ja=Q.skinWeights,Ka=Q.morphTargets,Qa=Q.morphNormals;if(Q.__dirtyVertices){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],P=la[J.a].position,M=la[J.b].position,B=la[J.c].position,ba[ia]=P.x,
ba[ia+1]=P.y,ba[ia+2]=P.z,ba[ia+3]=M.x,ba[ia+4]=M.y,ba[ia+5]=M.z,ba[ia+6]=B.x,ba[ia+7]=B.y,ba[ia+8]=B.z,ia+=9;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],P=la[J.a].position,M=la[J.b].position,B=la[J.c].position,J=la[J.d].position,ba[ia]=P.x,ba[ia+1]=P.y,ba[ia+2]=P.z,ba[ia+3]=M.x,ba[ia+4]=M.y,ba[ia+5]=M.z,ba[ia+6]=B.x,ba[ia+7]=B.y,ba[ia+8]=B.z,ba[ia+9]=J.x,ba[ia+10]=J.y,ba[ia+11]=J.z,ia+=12;l.bindBuffer(l.ARRAY_BUFFER,r.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,ba,t)}if(ra)for(ia=0,ra=Ka.length;ia<
ra;ia++){ba=0;for(C=0,u=T.length;C<u;C++){la=T[C];J=ea[la];P=Ka[ia].vertices[J.a].position;M=Ka[ia].vertices[J.b].position;B=Ka[ia].vertices[J.c].position;ha=$[ia];ha[ba]=P.x;ha[ba+1]=P.y;ha[ba+2]=P.z;ha[ba+3]=M.x;ha[ba+4]=M.y;ha[ba+5]=M.z;ha[ba+6]=B.x;ha[ba+7]=B.y;ha[ba+8]=B.z;if(v.morphNormals)G?(B=Qa[ia].vertexNormals[la],J=B.a,P=B.b,M=B.c):M=P=J=Qa[ia].faceNormals[la],la=V[ia],la[ba]=J.x,la[ba+1]=J.y,la[ba+2]=J.z,la[ba+3]=P.x,la[ba+4]=P.y,la[ba+5]=P.z,la[ba+6]=M.x,la[ba+7]=M.y,la[ba+8]=M.z;ba+=
9}for(C=0,u=fa.length;C<u;C++){la=fa[C];J=ea[la];P=Ka[ia].vertices[J.a].position;M=Ka[ia].vertices[J.b].position;B=Ka[ia].vertices[J.c].position;J=Ka[ia].vertices[J.d].position;ha=$[ia];ha[ba]=P.x;ha[ba+1]=P.y;ha[ba+2]=P.z;ha[ba+3]=M.x;ha[ba+4]=M.y;ha[ba+5]=M.z;ha[ba+6]=B.x;ha[ba+7]=B.y;ha[ba+8]=B.z;ha[ba+9]=J.x;ha[ba+10]=J.y;ha[ba+11]=J.z;if(v.morphNormals)G?(B=Qa[ia].vertexNormals[la],J=B.a,P=B.b,M=B.c,B=B.d):B=M=P=J=Qa[ia].faceNormals[la],la=V[ia],la[ba]=J.x,la[ba+1]=J.y,la[ba+2]=J.z,la[ba+3]=
P.x,la[ba+4]=P.y,la[ba+5]=P.z,la[ba+6]=M.x,la[ba+7]=M.y,la[ba+8]=M.z,la[ba+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K[L+8]=P.x,K[L+9]=P.y,K[L+10]=P.z,K[L+11]=P.w,K[L+12]=M.x,K[L+13]=M.y,K[L+14]=M.z,K[L+15]=M.w,$=xa[J.a],V=xa[J.b],P=xa[J.c],M=xa[J.d],Y[L]=$.x,Y[L+1]=$.y,Y[L+2]=$.z,Y[L+3]=$.w,Y[L+4]=V.x,Y[L+5]=V.y,Y[L+6]=V.z,Y[L+7]=V.w,Y[L+8]=P.x,Y[L+9]=P.y,Y[L+10]=P.z,Y[L+11]=P.w,Y[L+12]=M.x,Y[L+13]=M.y,Y[L+14]=M.z,Y[L+15]=M.w,
$=wa[J.a],V=wa[J.b],P=wa[J.c],M=wa[J.d],U[L]=$.x,U[L+1]=$.y,U[L+2]=$.z,U[L+3]=1,U[L+4]=V.x,U[L+5]=V.y,U[L+6]=V.z,U[L+7]=1,U[L+8]=P.x,U[L+9]=P.y,U[L+10]=P.z,U[L+11]=1,U[L+12]=M.x,U[L+13]=M.y,U[L+14]=M.z,U[L+15]=1,$=ya[J.a],V=ya[J.b],P=ya[J.c],J=ya[J.d],X[L]=$.x,X[L+1]=$.y,X[L+2]=$.z,X[L+3]=1,X[L+4]=V.x,X[L+5]=V.y,X[L+6]=V.z,X[L+7]=1,X[L+8]=P.x,X[L+9]=P.y,X[L+10]=P.z,X[L+11]=1,X[L+12]=J.x,X[L+13]=J.y,X[L+14]=J.z,X[L+15]=1,L+=16;L>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,
U,t),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,X,t),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,Y,t),l.bindBuffer(l.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,K,t))}if(Ea&&E){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],L=J.vertexColors,K=J.color,L.length===3&&E===THREE.VertexColors?(U=L[0],X=L[1],Y=L[2]):Y=X=U=K,aa[N]=U.r,aa[N+1]=U.g,aa[N+2]=U.b,aa[N+3]=X.r,aa[N+4]=X.g,aa[N+5]=X.b,aa[N+6]=Y.r,aa[N+
7]=Y.g,aa[N+8]=Y.b,N+=9;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],L=J.vertexColors,K=J.color,L.length===4&&E===THREE.VertexColors?(U=L[0],X=L[1],Y=L[2],L=L[3]):L=Y=X=U=K,aa[N]=U.r,aa[N+1]=U.g,aa[N+2]=U.b,aa[N+3]=X.r,aa[N+4]=X.g,aa[N+5]=X.b,aa[N+6]=Y.r,aa[N+7]=Y.g,aa[N+8]=Y.b,aa[N+9]=L.r,aa[N+10]=L.g,aa[N+11]=L.b,N+=12;N>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,aa,t))}if(S&&Q.hasTangents){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],S=J.vertexTangents,N=S[0],aa=S[1],
Q=S[2],I[ca]=N.x,I[ca+1]=N.y,I[ca+2]=N.z,I[ca+3]=N.w,I[ca+4]=aa.x,I[ca+5]=aa.y,I[ca+6]=aa.z,I[ca+7]=aa.w,I[ca+8]=Q.x,I[ca+9]=Q.y,I[ca+10]=Q.z,I[ca+11]=Q.w,ca+=12;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],S=J.vertexTangents,N=S[0],aa=S[1],Q=S[2],S=S[3],I[ca]=N.x,I[ca+1]=N.y,I[ca+2]=N.z,I[ca+3]=N.w,I[ca+4]=aa.x,I[ca+5]=aa.y,I[ca+6]=aa.z,I[ca+7]=aa.w,I[ca+8]=Q.x,I[ca+9]=Q.y,I[ca+10]=Q.z,I[ca+11]=Q.w,I[ca+12]=S.x,I[ca+13]=S.y,I[ca+14]=S.z,I[ca+15]=S.w,ca+=16;l.bindBuffer(l.ARRAY_BUFFER,r.__webglTangentBuffer);
l.bufferData(l.ARRAY_BUFFER,I,t)}if(Z&&D){for(C=0,u=T.length;C<u;C++)if(J=ea[T[C]],I=J.vertexNormals,Z=J.normal,I.length===3&&G)for(ca=0;ca<3;ca++)Z=I[ca],oa[F]=Z.x,oa[F+1]=Z.y,oa[F+2]=Z.z,F+=3;else for(ca=0;ca<3;ca++)oa[F]=Z.x,oa[F+1]=Z.y,oa[F+2]=Z.z,F+=3;for(C=0,u=fa.length;C<u;C++)if(J=ea[fa[C]],I=J.vertexNormals,Z=J.normal,I.length===4&&G)for(ca=0;ca<4;ca++)Z=I[ca],oa[F]=Z.x,oa[F+1]=Z.y,oa[F+2]=Z.z,F+=3;else for(ca=0;ca<4;ca++)oa[F]=Z.x,oa[F+1]=Z.y,oa[F+2]=Z.z,F+=3;l.bindBuffer(l.ARRAY_BUFFER,
r.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,oa,t)}if(ta&&Aa&&W){for(C=0,u=T.length;C<u;C++)if(F=T[C],F=Aa[F],F!==void 0)for(ca=0;ca<3;ca++)oa=F[ca],ka[O]=oa.u,ka[O+1]=oa.v,O+=2;for(C=0,u=fa.length;C<u;C++)if(F=fa[C],F=Aa[F],F!==void 0)for(ca=0;ca<4;ca++)oa=F[ca],ka[O]=oa.u,ka[O+1]=oa.v,O+=2;O>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,ka,t))}if(ta&&za&&W){for(C=0,u=T.length;C<u;C++)if(F=T[C],O=za[F],O!==void 0)for(ca=0;ca<3;ca++)ka=O[ca],H[qa]=ka.u,H[qa+
1]=ka.v,qa+=2;for(C=0,u=fa.length;C<u;C++)if(F=fa[C],O=za[F],O!==void 0)for(ca=0;ca<4;ca++)ka=O[ca],H[qa]=ka.u,H[qa+1]=ka.v,qa+=2;qa>0&&(l.bindBuffer(l.ARRAY_BUFFER,r.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,H,t))}if(sa){for(C=0,u=T.length;C<u;C++)x[na]=ga,x[na+1]=ga+1,x[na+2]=ga+2,na+=3,pa[ja]=ga,pa[ja+1]=ga+1,pa[ja+2]=ga,pa[ja+3]=ga+2,pa[ja+4]=ga+1,pa[ja+5]=ga+2,ja+=6,ga+=3;for(C=0,u=fa.length;C<u;C++)x[na]=ga,x[na+1]=ga+1,x[na+2]=ga+3,x[na+3]=ga+1,x[na+4]=ga+2,x[na+5]=ga+3,na+=6,pa[ja]=ga,
pa[ja+1]=ga+1,pa[ja+2]=ga,pa[ja+3]=ga+3,pa[ja+4]=ga+1,pa[ja+5]=ga+2,pa[ja+6]=ga+2,pa[ja+7]=ga+3,ja+=8,ga+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,x,t);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,pa,t)}if(w)for(ca=0,ga=w.length;ca<ga;ca++)if(x=w[ca],x.__original.needsUpdate){H=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],x.array[H]=x.value[J.a],
x.array[H+1]=x.value[J.b],x.array[H+2]=x.value[J.c],H+=3;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],x.array[H]=x.value[J.a],x.array[H+1]=x.value[J.b],x.array[H+2]=x.value[J.c],x.array[H+3]=x.value[J.d],H+=4}else{if(x.boundTo==="faces"){for(C=0,u=T.length;C<u;C++)pa=x.value[T[C]],x.array[H]=pa,x.array[H+1]=pa,x.array[H+2]=pa,H+=3;for(C=0,u=fa.length;C<u;C++)pa=x.value[fa[C]],x.array[H]=pa,x.array[H+1]=pa,x.array[H+2]=pa,x.array[H+3]=pa,H+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){for(C=
0,u=T.length;C<u;C++)J=ea[T[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=M.x,x.array[H+3]=M.y,x.array[H+4]=B.x,x.array[H+5]=B.y,H+=6;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],J=x.value[J.d],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=M.x,x.array[H+3]=M.y,x.array[H+4]=B.x,x.array[H+5]=B.y,x.array[H+6]=J.x,x.array[H+7]=J.y,H+=8}else{if(x.boundTo==="faces"){for(C=0,u=T.length;C<u;C++)B=M=P=pa=x.value[T[C]],x.array[H]=
P.x,x.array[H+1]=P.y,x.array[H+2]=M.x,x.array[H+3]=M.y,x.array[H+4]=B.x,x.array[H+5]=B.y,H+=6;for(C=0,u=fa.length;C<u;C++)J=B=M=P=pa=x.value[fa[C]],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=M.x,x.array[H+3]=M.y,x.array[H+4]=B.x,x.array[H+5]=B.y,x.array[H+6]=J.x,x.array[H+7]=J.y,H+=8}}else if(x.size===3)if(v=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],x.array[H]=P[v[0]],x.array[H+
1]=P[v[1]],x.array[H+2]=P[v[2]],x.array[H+3]=M[v[0]],x.array[H+4]=M[v[1]],x.array[H+5]=M[v[2]],x.array[H+6]=B[v[0]],x.array[H+7]=B[v[1]],x.array[H+8]=B[v[2]],H+=9;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],J=x.value[J.d],x.array[H]=P[v[0]],x.array[H+1]=P[v[1]],x.array[H+2]=P[v[2]],x.array[H+3]=M[v[0]],x.array[H+4]=M[v[1]],x.array[H+5]=M[v[2]],x.array[H+6]=B[v[0]],x.array[H+7]=B[v[1]],x.array[H+8]=B[v[2]],x.array[H+9]=J[v[0]],x.array[H+10]=J[v[1]],x.array[H+
11]=J[v[2]],H+=12}else{if(x.boundTo==="faces"){for(C=0,u=T.length;C<u;C++)B=M=P=pa=x.value[T[C]],x.array[H]=P[v[0]],x.array[H+1]=P[v[1]],x.array[H+2]=P[v[2]],x.array[H+3]=M[v[0]],x.array[H+4]=M[v[1]],x.array[H+5]=M[v[2]],x.array[H+6]=B[v[0]],x.array[H+7]=B[v[1]],x.array[H+8]=B[v[2]],H+=9;for(C=0,u=fa.length;C<u;C++)J=B=M=P=pa=x.value[fa[C]],x.array[H]=P[v[0]],x.array[H+1]=P[v[1]],x.array[H+2]=P[v[2]],x.array[H+3]=M[v[0]],x.array[H+4]=M[v[1]],x.array[H+5]=M[v[2]],x.array[H+6]=B[v[0]],x.array[H+7]=
B[v[1]],x.array[H+8]=B[v[2]],x.array[H+9]=J[v[0]],x.array[H+10]=J[v[1]],x.array[H+11]=J[v[2]],H+=12}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){for(C=0,u=T.length;C<u;C++)J=ea[T[C]],P=x.value[J.a],M=x.value[J.b],B=x.value[J.c],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=P.z,x.array[H+3]=P.w,x.array[H+4]=M.x,x.array[H+5]=M.y,x.array[H+6]=M.z,x.array[H+7]=M.w,x.array[H+8]=B.x,x.array[H+9]=B.y,x.array[H+10]=B.z,x.array[H+11]=B.w,H+=12;for(C=0,u=fa.length;C<u;C++)J=ea[fa[C]],P=
x.value[J.a],M=x.value[J.b],B=x.value[J.c],J=x.value[J.d],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=P.z,x.array[H+3]=P.w,x.array[H+4]=M.x,x.array[H+5]=M.y,x.array[H+6]=M.z,x.array[H+7]=M.w,x.array[H+8]=B.x,x.array[H+9]=B.y,x.array[H+10]=B.z,x.array[H+11]=B.w,x.array[H+12]=J.x,x.array[H+13]=J.y,x.array[H+14]=J.z,x.array[H+15]=J.w,H+=16}else if(x.boundTo==="faces"){for(C=0,u=T.length;C<u;C++)B=M=P=pa=x.value[T[C]],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=P.z,x.array[H+3]=P.w,x.array[H+4]=M.x,
x.array[H+5]=M.y,x.array[H+6]=M.z,x.array[H+7]=M.w,x.array[H+8]=B.x,x.array[H+9]=B.y,x.array[H+10]=B.z,x.array[H+11]=B.w,H+=12;for(C=0,u=fa.length;C<u;C++)J=B=M=P=pa=x.value[fa[C]],x.array[H]=P.x,x.array[H+1]=P.y,x.array[H+2]=P.z,x.array[H+3]=P.w,x.array[H+4]=M.x,x.array[H+5]=M.y,x.array[H+6]=M.z,x.array[H+7]=M.w,x.array[H+8]=B.x,x.array[H+9]=B.y,x.array[H+10]=B.z,x.array[H+11]=B.w,x.array[H+12]=J.x,x.array[H+13]=J.y,x.array[H+14]=J.z,x.array[H+15]=J.w,H+=16}l.bindBuffer(l.ARRAY_BUFFER,x.buffer);
l.bufferData(l.ARRAY_BUFFER,x.array,t)}z&&(delete r.__inittedArrays,delete r.__colorArray,delete r.__normalArray,delete r.__tangentArray,delete r.__uvArray,delete r.__uv2Array,delete r.__faceArray,delete r.__vertexArray,delete r.__lineArray,delete r.__skinVertexAArray,delete r.__skinVertexBArray,delete r.__skinIndexArray,delete r.__skinWeightArray)}}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;j.attributes&&
n(j)}else if(y instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){j=i;y=l.DYNAMIC_DRAW;C=m=C=z=z=void 0;u=j.vertices;p=j.colors;w=u.length;r=p.length;v=j.__vertexArray;t=j.__colorArray;D=j.__dirtyColors;if(j.__dirtyVertices){for(z=0;z<w;z++)C=u[z].position,m=z*3,v[m]=C.x,v[m+1]=C.y,v[m+2]=C.z;l.bindBuffer(l.ARRAY_BUFFER,j.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,y)}if(D){for(z=0;z<r;z++)C=p[z],m=z*3,t[m]=C.r,t[m+1]=C.g,t[m+2]=C.b;l.bindBuffer(l.ARRAY_BUFFER,j.__webglColorBuffer);
l.bufferData(l.ARRAY_BUFFER,t,y)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(y instanceof THREE.Line){j=c(y,r);t=j.attributes&&q(j);if(i.__dirtyVertices||i.__dirtyColors||t){y=i;m=l.DYNAMIC_DRAW;w=p=W=u=E=void 0;u=y.vertices;r=y.colors;w=u.length;t=r.length;v=y.__vertexArray;z=y.__colorArray;D=y.__dirtyColors;C=y.__webglCustomAttributesList;ea=fa=T=G=W=E=void 0;if(y.__dirtyVertices){for(E=0;E<w;E++)W=u[E].position,p=E*3,v[p]=W.x,v[p+1]=W.y,v[p+2]=W.z;l.bindBuffer(l.ARRAY_BUFFER,y.__webglVertexBuffer);
l.bufferData(l.ARRAY_BUFFER,v,m)}if(D){for(u=0;u<t;u++)w=r[u],p=u*3,z[p]=w.r,z[p+1]=w.g,z[p+2]=w.b;l.bindBuffer(l.ARRAY_BUFFER,y.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,z,m)}if(C)for(E=0,W=C.length;E<W;E++)if(ea=C[E],ea.needsUpdate&&(ea.boundTo===void 0||ea.boundTo==="vertices")){p=0;T=ea.value.length;if(ea.size===1)for(G=0;G<T;G++)ea.array[G]=ea.value[G];else if(ea.size===2)for(G=0;G<T;G++)fa=ea.value[G],ea.array[p]=fa.x,ea.array[p+1]=fa.y,p+=2;else if(ea.size===3)if(ea.type==="c")for(G=
0;G<T;G++)fa=ea.value[G],ea.array[p]=fa.r,ea.array[p+1]=fa.g,ea.array[p+2]=fa.b,p+=3;else for(G=0;G<T;G++)fa=ea.value[G],ea.array[p]=fa.x,ea.array[p+1]=fa.y,ea.array[p+2]=fa.z,p+=3;else if(ea.size===4)for(G=0;G<T;G++)fa=ea.value[G],ea.array[p]=fa.x,ea.array[p+1]=fa.y,ea.array[p+2]=fa.z,ea.array[p+3]=fa.w,p+=4;l.bindBuffer(l.ARRAY_BUFFER,ea.buffer);l.bufferData(l.ARRAY_BUFFER,ea.array,m)}}i.__dirtyVertices=!1;i.__dirtyColors=!1;j.attributes&&n(j)}else if(y instanceof THREE.ParticleSystem)j=c(y,r),
t=j.attributes&&q(j),(i.__dirtyVertices||i.__dirtyColors||y.sortParticles||t)&&g(i,l.DYNAMIC_DRAW,y),i.__dirtyVertices=!1,i.__dirtyColors=!1,j.attributes&&n(j)};this.initMaterial=function(a,b,c,d){var f,e,g,h,i;a instanceof THREE.MeshDepthMaterial?i="depth":a instanceof THREE.MeshNormalMaterial?i="normal":a instanceof THREE.MeshBasicMaterial?i="basic":a instanceof THREE.MeshLambertMaterial?i="lambert":a instanceof THREE.MeshPhongMaterial?i="phong":a instanceof THREE.LineBasicMaterial?i="basic":a instanceof
THREE.ParticleBasicMaterial&&(i="particle_basic");if(i){var j=THREE.ShaderLib[i];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var k,m;e=j=0;for(k=0,m=b.length;k<m;k++)f=b[k],f.onlyShadow||(f instanceof THREE.DirectionalLight&&e++,f instanceof THREE.PointLight&&j++,f instanceof THREE.SpotLight&&j++);j+e<=S?k=e:(k=Math.ceil(S*e/(j+e)),j=S-k);f=k;e=j;var n=0;for(j=0,k=b.length;j<k;j++)m=b[j],m.castShadow&&(m instanceof THREE.SpotLight&&
n++,m instanceof THREE.DirectionalLight&&!m.shadowCascade&&n++);var q=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)q=d.bones.length;var o;a:{k=a.fragmentShader;m=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,morphNormals:a.morphNormals,maxMorphTargets:this.maxMorphTargets,maxMorphNormals:this.maxMorphNormals,maxDirLights:f,
maxPointLights:e,maxBones:q,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapDebug:this.shadowMapDebug,shadowMapCascade:this.shadowMapCascade,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround,doubleSided:d&&d.doubleSided},s,d=[];i?d.push(i):(d.push(k),d.push(m));for(s in c)d.push(s),d.push(c[s]);i=d.join();for(s=0,d=V.length;s<d;s++)if(V[s].code===i){o=V[s].program;break a}s=l.createProgram();d=[ja>0?"#define VERTEX_TEXTURES":
"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#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.morphNormals?"#define USE_MORPHNORMALS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\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;\n#ifdef USE_MORPHNORMALS\nattribute vec3 morphNormal0;\nattribute vec3 morphNormal1;\nattribute vec3 morphNormal2;\nattribute vec3 morphNormal3;\n#else\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
f=["precision "+D+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",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.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.doubleSided?"#define DOUBLE_SIDED":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapDebug?"#define SHADOWMAP_DEBUG":"",c.shadowMapCascade?"#define SHADOWMAP_CASCADE":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");l.attachShader(s,t("fragment",f+k));
l.attachShader(s,t("vertex",d+m));l.linkProgram(s);l.getProgramParameter(s,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(s,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");s.uniforms={};s.attributes={};var p,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,boneGlobalMatrices,morphTargetInfluences".split(",");for(p in j)d.push(p);p=d;for(d=0,j=p.length;d<j;d++)k=p[d],s.uniforms[k]=l.getUniformLocation(s,
k);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(p=0;p<c.maxMorphTargets;p++)d.push("morphTarget"+p);for(p=0;p<c.maxMorphNormals;p++)d.push("morphNormal"+p);for(o in b)d.push(o);o=d;for(p=0,b=o.length;p<b;p++)c=o[p],s.attributes[c]=l.getAttribLocation(s,c);s.id=V.length;V.push({program:s,code:i});A.info.memory.programs=V.length;o=s}a.program=o;o=a.program.attributes;o.position>=0&&l.enableVertexAttribArray(o.position);o.color>=0&&l.enableVertexAttribArray(o.color);
o.normal>=0&&l.enableVertexAttribArray(o.normal);o.tangent>=0&&l.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(l.enableVertexAttribArray(o.skinVertexA),l.enableVertexAttribArray(o.skinVertexB),l.enableVertexAttribArray(o.skinIndex),l.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(h in a.attributes)o[h]!==void 0&&o[h]>=0&&l.enableVertexAttribArray(o[h]);if(a.morphTargets){a.numSupportedMorphTargets=0;s="morphTarget";
for(h=0;h<this.maxMorphTargets;h++)p=s+h,o[p]>=0&&(l.enableVertexAttribArray(o[p]),a.numSupportedMorphTargets++)}if(a.morphNormals){a.numSupportedMorphNormals=0;s="morphNormal";for(h=0;h<this.maxMorphNormals;h++)p=s+h,o[p]>=0&&(l.enableVertexAttribArray(o[p]),a.numSupportedMorphNormals++)}a.uniformsList=[];for(g in a.uniforms)a.uniformsList.push([a.uniforms[g],g])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?l.frontFace(l.CCW):l.frontFace(l.CW),a==="back"?l.cullFace(l.BACK):a==="front"?l.cullFace(l.FRONT):
l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE)):l.disable(l.CULL_FACE)};this.setObjectFaces=function(a){if(aa!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),aa=a.doubleSided;if(Z!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),Z=a.flipSided};this.setDepthTest=function(a){U!==a&&(a?l.enable(l.DEPTH_TEST):l.disable(l.DEPTH_TEST),U=a)};this.setDepthWrite=function(a){Y!==a&&(l.depthMask(a),Y=a)};this.setBlending=function(a){if(a!==X){switch(a){case THREE.NoBlending:l.disable(l.BLEND);
break;case THREE.AdditiveBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE);break;case THREE.SubtractiveBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.enable(l.BLEND),l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}X=
a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),A.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);var c=a.image,d=(c.width&c.width-1)===0&&(c.height&c.height-1)===0,f=y(a.format),e=y(a.type);v(l.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,f,c.width,c.height,0,f,e,c.data):l.texImage2D(l.TEXTURE_2D,0,f,f,e,a.image);a.generateMipmaps&&d&&l.generateMipmap(l.TEXTURE_2D);
a.needsUpdate=!1;if(a.onUpdate)a.onUpdate()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=l.createTexture();var c=(a.width&a.width-1)===0&&(a.height&a.height-1)===0,d=y(a.format),f=y(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,
a.__webglTexture);v(l.TEXTURE_CUBE_MAP,a,c);for(c=0;c<6;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,0,d,f,null);var e=a,g=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,g,e.__webglTexture,0);u(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=
l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),v(l.TEXTURE_2D,a,c),l.texImage2D(l.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null),d=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,d,a.__webglTexture,0),u(a.__webglRenderbuffer,a);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:
a.__webglFramebuffer,d=a.width,a=a.height,c=f=0):(b=null,d=ka,a=Ea,f=qa,c=ha);b!==z&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(f,c,d,a),z=b);Aa=d;ya=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0;this.generateMipmaps=!0};
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterial=this.material=null;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.faceMaterial=this.material=null;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.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
THREE.ColorUtils={adjustHSV:function(a,b,c,d){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,f);f.h=THREE.Math.clamp(f.h+b,0,1);f.s=THREE.Math.clamp(f.s+c,0,1);f.v=THREE.Math.clamp(f.v+d,0,1);a.setHSV(f.h,f.s,f.v)},rgbToHsv:function(a,b){var c=a.r,d=a.g,f=a.b,g=Math.max(Math.max(c,d),f),e=Math.min(Math.min(c,d),f);if(e===g)e=c=0;else{var h=g-e,e=h/g,c=c===g?(d-f)/h:d===g?2+(f-c)/h:4+(c-d)/h;c/=6;c<0&&(c+=1);c>1&&(c-=1)}b===void 0&&(b={h:0,s:0,v:0});b.h=c;b.s=e;b.v=g;return b}};
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
THREE.GeometryUtils={merge:function(a,b){for(var c,d,f=a.vertices.length,g=b instanceof THREE.Mesh?b.geometry:b,e=a.vertices,h=g.vertices,i=a.faces,j=g.faces,k=a.faceVertexUvs[0],q=g.faceVertexUvs[0],n={},o=0;o<a.materials.length;o++)n[a.materials[o].id]=o;if(b instanceof THREE.Mesh)b.matrixAutoUpdate&&b.updateMatrix(),c=b.matrix,d=new THREE.Matrix4,d.extractRotation(c,b.scale);for(var o=0,s=h.length;o<s;o++){var m=h[o].clone();c&&c.multiplyVector3(m.position);e.push(m)}for(o=0,s=j.length;o<s;o++){var e=
j[o],p,r,t=e.vertexNormals,v=e.vertexColors;e instanceof THREE.Face3?p=new THREE.Face3(e.a+f,e.b+f,e.c+f):e instanceof THREE.Face4&&(p=new THREE.Face4(e.a+f,e.b+f,e.c+f,e.d+f));p.normal.copy(e.normal);d&&d.multiplyVector3(p.normal);h=0;for(m=t.length;h<m;h++)r=t[h].clone(),d&&d.multiplyVector3(r),p.vertexNormals.push(r);p.color.copy(e.color);h=0;for(m=v.length;h<m;h++)r=v[h],p.vertexColors.push(r.clone());if(e.materialIndex!==void 0){h=g.materials[e.materialIndex];m=h.id;v=n[m];if(v===void 0)v=a.materials.length,
n[m]=v,a.materials.push(h);p.materialIndex=v}p.centroid.copy(e.centroid);c&&c.multiplyVector3(p.centroid);i.push(p)}for(o=0,s=q.length;o<s;o++){c=q[o];d=[];h=0;for(m=c.length;h<m;h++)d.push(new THREE.UV(c[h].u,c[h].v));k.push(d)}},clone:function(a){var b=new THREE.Geometry,c,d=a.vertices,f=a.faces,g=a.faceVertexUvs[0];if(a.materials)b.materials=a.materials.slice();for(a=0,c=d.length;a<c;a++)b.vertices.push(d[a].clone());for(a=0,c=f.length;a<c;a++)b.faces.push(f[a].clone());for(a=0,c=g.length;a<c;a++){for(var d=
g[a],f=[],e=0,h=d.length;e<h;e++)f.push(new THREE.UV(d[e].u,d[e].v));b.faceVertexUvs[0].push(f)}return b},randomPointInTriangle:function(a,b,c){var d,f,g,e=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();f=THREE.GeometryUtils.random();d+f>1&&(d=1-d,f=1-f);g=1-d-f;e.copy(a);e.multiplyScalar(d);h.copy(b);h.multiplyScalar(f);e.addSelf(h);h.copy(c);h.multiplyScalar(g);e.addSelf(h);return e},randomPointInFace:function(a,b,c){var d,f,g;if(a instanceof THREE.Face3)return d=b.vertices[a.a].position,
f=b.vertices[a.b].position,g=b.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,f,g);else if(a instanceof THREE.Face4){d=b.vertices[a.a].position;f=b.vertices[a.b].position;g=b.vertices[a.c].position;var b=b.vertices[a.d].position,e;c?a._area1&&a._area2?(c=a._area1,e=a._area2):(c=THREE.GeometryUtils.triangleArea(d,f,b),e=THREE.GeometryUtils.triangleArea(f,g,b),a._area1=c,a._area2=e):(c=THREE.GeometryUtils.triangleArea(d,f,b),e=THREE.GeometryUtils.triangleArea(f,g,b));return THREE.GeometryUtils.random()*
(c+e)<c?THREE.GeometryUtils.randomPointInTriangle(d,f,b):THREE.GeometryUtils.randomPointInTriangle(f,g,b)}},randomPointsInGeometry:function(a,b){function c(a){function b(c,d){if(d<c)return c;var f=c+Math.floor((d-c)/2);return j[f]>a?b(c,f-1):j[f]<a?b(f+1,d):f}return b(0,j.length-1)}var d,f,g=a.faces,e=a.vertices,h=g.length,i=0,j=[],k,q,n,o;for(f=0;f<h;f++){d=g[f];if(d instanceof THREE.Face3)k=e[d.a].position,q=e[d.b].position,n=e[d.c].position,d._area=THREE.GeometryUtils.triangleArea(k,q,n);else if(d instanceof
THREE.Face4)k=e[d.a].position,q=e[d.b].position,n=e[d.c].position,o=e[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(k,q,o),d._area2=THREE.GeometryUtils.triangleArea(q,n,o),d._area=d._area1+d._area2;i+=d._area;j[f]=i}d=[];e={};for(f=0;f<b;f++)h=THREE.GeometryUtils.random()*i,h=c(h),d[f]=THREE.GeometryUtils.randomPointInFace(g[h],a,!0),e[h]?e[h]+=1:e[h]=1;return d},triangleArea:function(a,b,c){var d,f=THREE.GeometryUtils.__v1;f.sub(a,b);d=f.length();f.sub(a,c);a=f.length();f.sub(b,c);c=f.length();
b=0.5*(d+a+c);return Math.sqrt(b*(b-d)*(b-a)*(b-c))},center:function(a){a.computeBoundingBox();var b=a.boundingBox,c=new THREE.Vector3;c.add(b.min,b.max);c.multiplyScalar(-0.5);a.applyMatrix((new THREE.Matrix4).setTranslation(c.x,c.y,c.z));a.computeBoundingBox();return c},normalizeUVs:function(a){for(var a=a.faceVertexUvs[0],b=0,c=a.length;b<c;b++)for(var d=a[b],f=0,g=d.length;f<g;f++)d[f].u!==1&&(d[f].u-=Math.floor(d[f].u)),d[f].v!==1&&(d[f].v-=Math.floor(d[f].v))},triangulateQuads:function(a){for(var b=
a.faces.length-1;b>=0;b--){var c=a.faces[b];if(c instanceof THREE.Face4){var d=c.a,f=c.b,g=c.c,e=c.d,h=c.clone(),c=c.clone();h.a=d;h.b=f;h.c=e;c.a=f;c.b=g;c.c=e;a.faces.splice(b,1,h,c);for(d=0;d<a.faceVertexUvs.length;d++)a.faceVertexUvs[d].length&&(h=a.faceVertexUvs[d][b],f=h[1],g=h[2],e=h[3],h=[h[0].clone(),f.clone(),e.clone()],f=[f.clone(),g.clone(),e.clone()],a.faceVertexUvs[d].splice(b,1,h,f));for(d=0;d<a.faceUvs.length;d++)a.faceUvs[d].length&&(f=a.faceUvs[d][b],a.faceUvs[d].splice(b,1,f,f))}}a.computeCentroids();
a.computeFaceNormals();a.computeVertexNormals();a.hasTangents&&a.computeTangents()},explode:function(a){for(var b=[],c=0,d=a.faces.length;c<d;c++){var f=b.length,g=a.faces[c];if(g instanceof THREE.Face4){var e=g.a,h=g.b,i=g.c,e=a.vertices[e],h=a.vertices[h],i=a.vertices[i],j=a.vertices[g.d];b.push(e.clone());b.push(h.clone());b.push(i.clone());b.push(j.clone());g.a=f;g.b=f+1;g.c=f+2;g.d=f+3}else e=g.a,h=g.b,i=g.c,e=a.vertices[e],h=a.vertices[h],i=a.vertices[i],b.push(e.clone()),b.push(h.clone()),
b.push(i.clone()),g.a=f,g.b=f+1,g.c=f+2}a.vertices=b},tessellate:function(a,b){var c,d,f,g,e,h,i,j,k,q,n,o,s,m,p,r,t;for(c=a.faces.length-1;c>=0;c--)if(d=a.faces[c],d instanceof THREE.Face3){if(f=d.a,g=d.b,e=d.c,i=a.vertices[f],j=a.vertices[g],k=a.vertices[e],n=i.position.distanceTo(j.position),o=j.position.distanceTo(k.position),q=i.position.distanceTo(k.position),n>b||o>b||q>b){h=a.vertices.length;t=d.clone();d=d.clone();n>=o&&n>=q?(i=i.clone(),i.position.lerpSelf(j.position,0.5),t.a=f,t.b=h,t.c=
e,d.a=h,d.b=g,d.c=e,f=0):o>=n&&o>=q?(i=j.clone(),i.position.lerpSelf(k.position,0.5),t.a=f,t.b=g,t.c=h,d.a=h,d.b=e,d.c=f,f=1):(i=i.clone(),i.position.lerpSelf(k.position,0.5),t.a=f,t.b=g,t.c=h,d.a=h,d.b=g,d.c=e,f=2);a.faces.splice(c,1,t,d);a.vertices.push(i);for(g=0;g<a.faceVertexUvs.length;g++)a.faceVertexUvs[g].length&&(k=a.faceVertexUvs[g][c],j=k[0],e=k[1],i=k[2],f===0?(n=j.clone(),n.lerpSelf(e,0.5),k=[j.clone(),n.clone(),i.clone()],e=[n.clone(),e.clone(),i.clone()]):f===1?(n=e.clone(),n.lerpSelf(i,
0.5),k=[j.clone(),e.clone(),n.clone()],e=[n.clone(),i.clone(),j.clone()]):(n=j.clone(),n.lerpSelf(i,0.5),k=[j.clone(),e.clone(),n.clone()],e=[n.clone(),e.clone(),i.clone()]),a.faceVertexUvs[g].splice(c,1,k,e))}}else if(f=d.a,g=d.b,e=d.c,h=d.d,i=a.vertices[f],j=a.vertices[g],k=a.vertices[e],q=a.vertices[h],n=i.position.distanceTo(j.position),o=j.position.distanceTo(k.position),s=k.position.distanceTo(q.position),m=i.position.distanceTo(q.position),n>b||o>b||s>b||m>b){p=a.vertices.length;r=a.vertices.length+
1;t=d.clone();d=d.clone();n>=o&&n>=s&&n>=m||s>=o&&s>=n&&s>=m?(n=i.clone(),n.position.lerpSelf(j.position,0.5),j=k.clone(),j.position.lerpSelf(q.position,0.5),t.a=f,t.b=p,t.c=r,t.d=h,d.a=p,d.b=g,d.c=e,d.d=r,f=0):(n=j.clone(),n.position.lerpSelf(k.position,0.5),j=q.clone(),j.position.lerpSelf(i.position,0.5),t.a=f,t.b=g,t.c=p,t.d=r,d.a=r,d.b=p,d.c=e,d.d=h,f=1);a.faces.splice(c,1,t,d);a.vertices.push(n);a.vertices.push(j);for(g=0;g<a.faceVertexUvs.length;g++)a.faceVertexUvs[g].length&&(k=a.faceVertexUvs[g][c],
j=k[0],e=k[1],i=k[2],k=k[3],f===0?(n=j.clone(),n.lerpSelf(e,0.5),o=i.clone(),o.lerpSelf(k,0.5),j=[j.clone(),n.clone(),o.clone(),k.clone()],e=[n.clone(),e.clone(),i.clone(),o.clone()]):(n=e.clone(),n.lerpSelf(i,0.5),o=k.clone(),o.lerpSelf(j,0.5),j=[j.clone(),e.clone(),n.clone(),o.clone()],e=[o.clone(),n.clone(),i.clone(),k.clone()]),a.faceVertexUvs[g].splice(c,1,j,e))}}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
THREE.ImageUtils={crossOrigin:"anonymous",loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,b);f.loadCount=0;for(b=0,d=a.length;b<d;++b)f[b]=new Image,f[b].onload=function(){f.loadCount+=1;if(f.loadCount===6)g.needsUpdate=!0;c&&c(this)},f[b].crossOrigin=this.crossOrigin,f[b].src=a[b];return g},getNormalMap:function(a,
b){var c=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};b|=1;var d=a.width,f=a.height,g=document.createElement("canvas");g.width=d;g.height=f;var e=g.getContext("2d");e.drawImage(a,0,0);for(var h=e.getImageData(0,0,d,f).data,i=e.createImageData(d,f),j=i.data,k=0;k<d;k++)for(var q=1;q<f;q++){var n=q-1<0?f-1:q-1,o=(q+1)%f,s=k-1<0?d-1:k-1,m=(k+1)%d,p=[],r=[0,0,h[(q*d+k)*4]/255*b];p.push([-1,0,h[(q*d+s)*4]/255*b]);p.push([-1,-1,h[(n*d+s)*4]/255*b]);p.push([0,
-1,h[(n*d+k)*4]/255*b]);p.push([1,-1,h[(n*d+m)*4]/255*b]);p.push([1,0,h[(q*d+m)*4]/255*b]);p.push([1,1,h[(o*d+m)*4]/255*b]);p.push([0,1,h[(o*d+k)*4]/255*b]);p.push([-1,1,h[(o*d+s)*4]/255*b]);n=[];s=p.length;for(o=0;o<s;o++){var m=p[o],t=p[(o+1)%s],m=[m[0]-r[0],m[1]-r[1],m[2]-r[2]],t=[t[0]-r[0],t[1]-r[1],t[2]-r[2]];n.push(c([m[1]*t[2]-m[2]*t[1],m[2]*t[0]-m[0]*t[2],m[0]*t[1]-m[1]*t[0]]))}p=[0,0,0];for(o=0;o<n.length;o++)p[0]+=n[o][0],p[1]+=n[o][1],p[2]+=n[o][2];p[0]/=n.length;p[1]/=n.length;p[2]/=n.length;
r=(q*d+k)*4;j[r]=(p[0]+1)/2*255|0;j[r+1]=(p[1]+0.5)*255|0;j[r+2]=p[2]*255|0;j[r+3]=255}e.putImageData(i,0,0);return g},generateDataTexture:function(a,b,c){for(var d=a*b,f=new Uint8Array(3*d),g=Math.floor(c.r*255),e=Math.floor(c.g*255),c=Math.floor(c.b*255),h=0;h<d;h++)f[h*3]=g,f[h*3+1]=e,f[h*3+2]=c;a=new THREE.DataTexture(f,a,b,THREE.RGBFormat);a.needsUpdate=!0;return a}};
THREE.SceneUtils={showHierarchy:function(a,b){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=b})},traverseHierarchy:function(a,b){var c,d,f=a.children.length;for(d=0;d<f;d++)c=a.children[d],b(c),THREE.SceneUtils.traverseHierarchy(c,b)},createMultiMaterialObject:function(a,b){var c,d=b.length,f=new THREE.Object3D;for(c=0;c<d;c++){var g=new THREE.Mesh(a,b[c]);f.add(g)}return f},cloneObject:function(a){var b;a instanceof THREE.MorphAnimMesh?(b=new THREE.MorphAnimMesh(a.geometry,a.material),
b.duration=a.duration,b.mirroredLoop=a.mirroredLoop,b.time=a.time,b.lastKeyframe=a.lastKeyframe,b.currentKeyframe=a.currentKeyframe,b.direction=a.direction,b.directionBackwards=a.directionBackwards):a instanceof THREE.SkinnedMesh?b=new THREE.SkinnedMesh(a.geometry,a.material):a instanceof THREE.Mesh?b=new THREE.Mesh(a.geometry,a.material):a instanceof THREE.Line?b=new THREE.Line(a.geometry,a.material,a.type):a instanceof THREE.Ribbon?b=new THREE.Ribbon(a.geometry,a.material):a instanceof THREE.ParticleSystem?
(b=new THREE.ParticleSystem(a.geometry,a.material),b.sortParticles=a.sortParticles):a instanceof THREE.Particle?b=new THREE.Particle(a.material):a instanceof THREE.Sprite?(b=new THREE.Sprite({}),b.color.copy(a.color),b.map=a.map,b.blending=a.blending,b.useScreenCoordinates=a.useScreenCoordinates,b.mergeWith3D=a.mergeWith3D,b.affectedByDistance=a.affectedByDistance,b.scaleByViewport=a.scaleByViewport,b.alignment=a.alignment,b.rotation3d.copy(a.rotation3d),b.rotation=a.rotation,b.opacity=a.opacity,
b.uvOffset.copy(a.uvOffset),b.uvScale.copy(a.uvScale)):a instanceof THREE.LOD?b=new THREE.LOD:a instanceof THREE.MarchingCubes?(b=new THREE.MarchingCubes(a.resolution,a.material),b.field.set(a.field),b.isolation=a.isolation):a instanceof THREE.Object3D&&(b=new THREE.Object3D);b.name=a.name;b.parent=a.parent;b.up.copy(a.up);b.position.copy(a.position);b.rotation instanceof THREE.Vector3&&b.rotation.copy(a.rotation);b.eulerOrder=a.eulerOrder;b.scale.copy(a.scale);b.dynamic=a.dynamic;b.doubleSided=a.doubleSided;
b.flipSided=a.flipSided;b.renderDepth=a.renderDepth;b.rotationAutoUpdate=a.rotationAutoUpdate;b.matrix.copy(a.matrix);b.matrixWorld.copy(a.matrixWorld);b.matrixRotationWorld.copy(a.matrixRotationWorld);b.matrixAutoUpdate=a.matrixAutoUpdate;b.matrixWorldNeedsUpdate=a.matrixWorldNeedsUpdate;b.quaternion.copy(a.quaternion);b.useQuaternion=a.useQuaternion;b.boundRadius=a.boundRadius;b.boundRadiusScale=a.boundRadiusScale;b.visible=a.visible;b.castShadow=a.castShadow;b.receiveShadow=a.receiveShadow;b.frustumCulled=
a.frustumCulled;for(var c=0;c<a.children.length;c++){var d=THREE.SceneUtils.cloneObject(a.children[c]);b.children[c]=d;d.parent=b}if(a instanceof THREE.LOD)for(c=0;c<a.LODs.length;c++)b.LODs[c]={visibleAtDistance:a.LODs[c].visibleAtDistance,object3D:b.children[c]};return b},detach:function(a,b,c){a.applyMatrix(b.matrixWorld);b.remove(a);c.add(a)},attach:function(a,b,c){var d=new THREE.Matrix4;d.getInverse(c.matrixWorld);a.applyMatrix(d);b.remove(a);c.add(a)}};
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
value:1},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",value:new THREE.Color(16777215)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(16777215)},uShininess:{type:"f",value:30},uOpacity:{type:"f",value:1},uReflectivity:{type:"f",value:0.5},uOffset:{type:"v2",value:new THREE.Vector2(0,0)},uRepeat:{type:"v2",value:new THREE.Vector2(1,1)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),
fragmentShader:["uniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform float uOpacity;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform bool enableReflection;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform samplerCube tCube;\nuniform float uNormalScale;\nuniform float uReflectivity;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;",
THREE.ShaderChunk.shadowmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3( 1.0 ), uOpacity );\nvec3 specularTex = vec3( 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse ) {\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( tDiffuse, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );\n#endif\n}\nif( enableAO ) {\n#ifdef GAMMA_INPUT\nvec4 aoColor = texture2D( tAO, vUv );\naoColor.xyz *= aoColor.xyz;\ngl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;\n#endif\n}\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( 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 );\nfloat pointDistance = vPointLight[ i ].w;\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\n#endif\npointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;\nvec3 pointHalfVector = normalize( pointVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );\npointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\n#ifdef WRAP_AROUND\nfloat directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );\nfloat directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\n#endif\ndirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );\ndirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor) + totalSpecular;\nif ( enableReflection ) {\nvec3 wPos = cameraPosition - vViewPosition;\nvec3 vReflect = reflect( normalize( wPos ), normal );\nvec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );\n}",
THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["attribute vec4 tangent;\nuniform vec2 uOffset;\nuniform vec2 uRepeat;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;",
THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvViewPosition = -mvPosition.xyz;\nvNormal = normalMatrix * normal;\nvTangent = normalMatrix * tangent.xyz;\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvUv = uv * uRepeat + uOffset;\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif",
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},cube:{uniforms:{tCube:{type:"t",value:1,texture:null},tFlip:{type:"f",value:-1}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nuniform float tFlip;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( tFlip * wPos.x, wPos.yz ) );\n}"}}};
THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(a){return this.getPoint(this.getUtoTmapping(a))};THREE.Curve.prototype.getPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPoint(b/a));return c};THREE.Curve.prototype.getSpacedPoints=function(a){a||(a=5);var b,c=[];for(b=0;b<=a;b++)c.push(this.getPointAt(b/a));return c};
THREE.Curve.prototype.getLength=function(){var a=this.getLengths();return a[a.length-1]};THREE.Curve.prototype.getLengths=function(a){a||(a=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==a+1)return this.cacheArcLengths;var b=[],c,d=this.getPoint(0),f,g=0;b.push(0);for(f=1;f<=a;f++)c=this.getPoint(f/a),g+=c.distanceTo(d),b.push(g),d=c;return this.cacheArcLengths=b};
THREE.Curve.prototype.getUtoTmapping=function(a,b){var c=this.getLengths(),d=0,f=c.length,g;g=b?b:a*c[f-1];for(var e=0,h=f-1,i;e<=h;)if(d=Math.floor(e+(h-e)/2),i=c[d]-g,i<0)e=d+1;else if(i>0)h=d-1;else{h=d;break}d=h;if(c[d]==g)return d/(f-1);e=c[d];return c=(d+(g-e)/(c[d+1]-e))/(f-1)};THREE.Curve.prototype.getNormalVector=function(a){a=this.getTangent(a);return new THREE.Vector2(-a.y,a.x)};
THREE.Curve.prototype.getTangent=function(a){var b=a-1.0E-4;a+=1.0E-4;b<0&&(b=0);a>1&&(a=1);b=this.getPoint(b);a=this.getPoint(a);return b.clone().subSelf(a).normalize()};THREE.Curve.prototype.getTangentAt=function(a){return this.getTangent(this.getUtoTmapping(a))};THREE.LineCurve=function(a,b){a instanceof THREE.Vector2?(this.v1=a,this.v2=b):THREE.LineCurve.oldConstructor.apply(this,arguments)};
THREE.LineCurve.oldConstructor=function(a,b,c,d){this.constructor(new THREE.Vector2(a,b),new THREE.Vector2(c,d))};THREE.LineCurve.prototype=new THREE.Curve;THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.multiplyScalar(a).addSelf(this.v1);return b};THREE.LineCurve.prototype.getPointAt=function(a){return this.getPoint(a)};
THREE.LineCurve.prototype.getTangent=function(){var a=new THREE.Vector2;a.sub(this.v2,this.v1);a.normalize();return a};THREE.QuadraticBezierCurve=function(a,b,c){if(!(b instanceof THREE.Vector2))var d=Array.prototype.slice.call(arguments),a=new THREE.Vector2(d[0],d[1]),b=new THREE.Vector2(d[2],d[3]),c=new THREE.Vector2(d[4],d[5]);this.v0=a;this.v1=b;this.v2=c};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
THREE.QuadraticBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);return new THREE.Vector2(b,a)};THREE.QuadraticBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.x,this.v1.x,this.v2.x);a=THREE.Curve.Utils.tangentQuadraticBezier(a,this.v0.y,this.v1.y,this.v2.y);b=new THREE.Vector2(b,a);b.normalize();return b};
THREE.CubicBezierCurve=function(a,b,c,d){if(!(b instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),a=new THREE.Vector2(f[0],f[1]),b=new THREE.Vector2(f[2],f[3]),c=new THREE.Vector2(f[4],f[5]),d=new THREE.Vector2(f[6],f[7]);this.v0=a;this.v1=b;this.v2=c;this.v3=d};THREE.CubicBezierCurve.prototype=new THREE.Curve;THREE.CubicBezierCurve.prototype.constructor=THREE.CubicBezierCurve;
THREE.CubicBezierCurve.prototype.getPoint=function(a){var b;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);return new THREE.Vector2(b,a)};THREE.CubicBezierCurve.prototype.getTangent=function(a){var b;b=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);a=THREE.Curve.Utils.tangentCubicBezier(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);b=new THREE.Vector2(b,a);b.normalize();return b};
THREE.SplineCurve=function(a){this.points=a==void 0?[]:a};THREE.SplineCurve.prototype=new THREE.Curve;THREE.SplineCurve.prototype.constructor=THREE.SplineCurve;
THREE.SplineCurve.prototype.getPoint=function(a){var b=new THREE.Vector2,c=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>d.length-2?a:a+1;c[3]=a>d.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,f);return b};THREE.ArcCurve=function(a,b,c,d,f,g){this.aX=a;this.aY=b;this.aRadius=c;this.aStartAngle=d;this.aEndAngle=f;this.aClockwise=g};
THREE.ArcCurve.prototype=new THREE.Curve;THREE.ArcCurve.prototype.constructor=THREE.ArcCurve;THREE.ArcCurve.prototype.getPoint=function(a){var b=this.aEndAngle-this.aStartAngle;this.aClockwise||(a=1-a);b=this.aStartAngle+a*b;a=this.aX+this.aRadius*Math.cos(b);b=this.aY+this.aRadius*Math.sin(b);return new THREE.Vector2(a,b)};
THREE.Curve.Utils={tangentQuadraticBezier:function(a,b,c,d){return 2*(1-a)*(c-b)+2*a*(d-c)},tangentCubicBezier:function(a,b,c,d,f){return-3*b*(1-a)*(1-a)+3*c*(1-a)*(1-a)-6*a*c*(1-a)+6*a*d*(1-a)-3*a*a*d+3*a*a*f},tangentSpline:function(a){return 6*a*a-6*a+(3*a*a-4*a+1)+(-6*a*a+6*a)+(3*a*a-2*a)},interpolate:function(a,b,c,d,f){var a=(c-a)*0.5,d=(d-b)*0.5,g=f*f;return(2*b-2*c+a+d)*f*g+(-3*b+3*c-2*a-d)*g+a*f+b}};
THREE.Curve.create=function(a,b){a.prototype=new THREE.Curve;a.prototype.constructor=a;a.prototype.getPoint=b;return a};THREE.LineCurve3=THREE.Curve.create(function(a,b){this.v1=a;this.v2=b},function(a){var b=new THREE.Vector3;b.sub(this.v2,this.v1);b.multiplyScalar(a);b.addSelf(this.v1);return b});
THREE.QuadraticBezierCurve3=THREE.Curve.create(function(a,b,c){this.v0=a;this.v1=b;this.v2=c},function(a){var b,c;b=THREE.Shape.Utils.b2(a,this.v0.x,this.v1.x,this.v2.x);c=THREE.Shape.Utils.b2(a,this.v0.y,this.v1.y,this.v2.y);a=THREE.Shape.Utils.b2(a,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(b,c,a)});
THREE.CubicBezierCurve3=THREE.Curve.create(function(a,b,c,d){this.v0=a;this.v1=b;this.v2=c;this.v3=d},function(a){var b,c;b=THREE.Shape.Utils.b3(a,this.v0.x,this.v1.x,this.v2.x,this.v3.x);c=THREE.Shape.Utils.b3(a,this.v0.y,this.v1.y,this.v2.y,this.v3.y);a=THREE.Shape.Utils.b3(a,this.v0.z,this.v1.z,this.v2.z,this.v3.z);return new THREE.Vector3(b,c,a)});
THREE.SplineCurve3=THREE.Curve.create(function(a){this.points=a==void 0?[]:a},function(a){var b=new THREE.Vector3,c=[],d=this.points,f;f=(d.length-1)*a;a=Math.floor(f);f-=a;c[0]=a==0?a:a-1;c[1]=a;c[2]=a>d.length-2?a:a+1;c[3]=a>d.length-3?a:a+2;b.x=THREE.Curve.Utils.interpolate(d[c[0]].x,d[c[1]].x,d[c[2]].x,d[c[3]].x,f);b.y=THREE.Curve.Utils.interpolate(d[c[0]].y,d[c[1]].y,d[c[2]].y,d[c[3]].y,f);b.z=THREE.Curve.Utils.interpolate(d[c[0]].z,d[c[1]].z,d[c[2]].z,d[c[3]].z,f);return b});
THREE.CurvePath=function(){this.curves=[];this.bends=[];this.autoClose=!1};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(a){this.curves.push(a)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){var a=this.curves[0].getPoint(0),b=this.curves[this.curves.length-1].getPoint(1);a.equals(b)||this.curves.push(new THREE.LineCurve(b,a))};
THREE.CurvePath.prototype.getPoint=function(a){for(var b=a*this.getLength(),c=this.getCurveLengths(),a=0;a<c.length;){if(c[a]>=b)return b=c[a]-b,a=this.curves[a],b=1-b/a.getLength(),a.getPointAt(b);a++}return null};THREE.CurvePath.prototype.getLength=function(){var a=this.getCurveLengths();return a[a.length-1]};
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var a=[],b=0,c,d=this.curves.length;for(c=0;c<d;c++)b+=this.curves[c].getLength(),a.push(b);return this.cacheLengths=a};
THREE.CurvePath.prototype.getBoundingBox=function(){var a=this.getPoints(),b,c,d,f;b=c=Number.NEGATIVE_INFINITY;d=f=Number.POSITIVE_INFINITY;var g,e,h,i;i=new THREE.Vector2;for(e=0,h=a.length;e<h;e++){g=a[e];if(g.x>b)b=g.x;else if(g.x<d)d=g.x;if(g.y>c)c=g.y;else if(g.y<c)f=g.y;i.addSelf(g.x,g.y)}return{minX:d,minY:f,maxX:b,maxY:c,centroid:i.divideScalar(h)}};THREE.CurvePath.prototype.createPointsGeometry=function(a){return this.createGeometry(this.getPoints(a,!0))};
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(a){return this.createGeometry(this.getSpacedPoints(a,!0))};THREE.CurvePath.prototype.createGeometry=function(a){for(var b=new THREE.Geometry,c=0;c<a.length;c++)b.vertices.push(new THREE.Vertex(new THREE.Vector3(a[c].x,a[c].y,0)));return b};THREE.CurvePath.prototype.addWrapPath=function(a){this.bends.push(a)};
THREE.CurvePath.prototype.getTransformedPoints=function(a,b){var c=this.getPoints(a),d,f;if(!b)b=this.bends;for(d=0,f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(a,b){var c=this.getSpacedPoints(a),d,f;if(!b)b=this.bends;for(d=0,f=b.length;d<f;d++)c=this.getWrapPoints(c,b[d]);return c};
THREE.CurvePath.prototype.getWrapPoints=function(a,b){var c=this.getBoundingBox(),d,f,g,e,h,i;for(d=0,f=a.length;d<f;d++)g=a[d],e=g.x,h=g.y,i=e/c.maxX,i=b.getUtoTmapping(i,e),e=b.getPoint(i),h=b.getNormalVector(i).multiplyScalar(h),g.x=e.x+h.x,g.y=e.y+h.y;return a};
THREE.EventTarget=function(){var a={};this.addEventListener=function(b,c){a[b]==void 0&&(a[b]=[]);a[b].indexOf(c)===-1&&a[b].push(c)};this.dispatchEvent=function(b){for(var c in a[b.type])a[b.type][c](b)};this.removeEventListener=function(b,c){var d=a[b].indexOf(c);d!==-1&&a[b].splice(d,1)}};THREE.Gyroscope=function(){THREE.Object3D.call(this)};THREE.Gyroscope.prototype=new THREE.Object3D;THREE.Gyroscope.prototype.constructor=THREE.Gyroscope;
THREE.Gyroscope.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?(this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix),this.matrixWorld.decompose(this.translationWorld,this.rotationWorld,this.scaleWorld),this.matrix.decompose(this.translationObject,this.rotationObject,this.scaleObject),this.matrixWorld.compose(this.translationWorld,this.rotationObject,this.scaleWorld)):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)};THREE.Gyroscope.prototype.translationWorld=new THREE.Vector3;THREE.Gyroscope.prototype.translationObject=new THREE.Vector3;THREE.Gyroscope.prototype.rotationWorld=new THREE.Quaternion;THREE.Gyroscope.prototype.rotationObject=new THREE.Quaternion;THREE.Gyroscope.prototype.scaleWorld=new THREE.Vector3;THREE.Gyroscope.prototype.scaleObject=new THREE.Vector3;
THREE.Path=function(a){THREE.CurvePath.call(this);this.actions=[];a&&this.fromPoints(a)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(a){this.moveTo(a[0].x,a[0].y);for(var b=1,c=a.length;b<c;b++)this.lineTo(a[b].x,a[b].y)};
THREE.Path.prototype.moveTo=function(a,b){var c=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:c})};THREE.Path.prototype.lineTo=function(a,b){var c=Array.prototype.slice.call(arguments),d=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(d[d.length-2],d[d.length-1]),new THREE.Vector2(a,b)));this.actions.push({action:THREE.PathActions.LINE_TO,args:c})};
THREE.Path.prototype.quadraticCurveTo=function(a,b,c,d){var f=Array.prototype.slice.call(arguments),g=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(g[g.length-2],g[g.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:f})};
THREE.Path.prototype.bezierCurveTo=function(a,b,c,d,f,g){var e=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,b),new THREE.Vector2(c,d),new THREE.Vector2(f,g)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:e})};
THREE.Path.prototype.splineThru=function(a){var b=Array.prototype.slice.call(arguments),c=this.actions[this.actions.length-1].args,c=[new THREE.Vector2(c[c.length-2],c[c.length-1])];Array.prototype.push.apply(c,a);this.curves.push(new THREE.SplineCurve(c));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:b})};
THREE.Path.prototype.arc=function(a,b,c,d,f,g){var e=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,b,c,d,f,g));this.actions.push({action:THREE.PathActions.ARC,args:e})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var b=[],c=0;c<a;c++)b.push(this.getPoint(c/a));return b};
THREE.Path.prototype.getPoints=function(a,b){var a=a||12,c=[],d,f,g,e,h,i,j,k,q,n,o,s,m;for(d=0,f=this.actions.length;d<f;d++)switch(g=this.actions[d],e=g.action,g=g.args,e){case THREE.PathActions.LINE_TO:c.push(new THREE.Vector2(g[0],g[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=g[2];i=g[3];q=g[0];n=g[1];c.length>0?(e=c[c.length-1],o=e.x,s=e.y):(e=this.actions[d-1].args,o=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b2(m,o,q,h),m=THREE.Shape.Utils.b2(m,s,n,
i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.BEZIER_CURVE_TO:h=g[4];i=g[5];q=g[0];n=g[1];j=g[2];k=g[3];c.length>0?(e=c[c.length-1],o=e.x,s=e.y):(e=this.actions[d-1].args,o=e[e.length-2],s=e[e.length-1]);for(e=1;e<=a;e++)m=e/a,g=THREE.Shape.Utils.b3(m,o,q,j,h),m=THREE.Shape.Utils.b3(m,s,n,k,i),c.push(new THREE.Vector2(g,m));break;case THREE.PathActions.CSPLINE_THRU:e=this.actions[d-1].args;e=[new THREE.Vector2(e[e.length-2],e[e.length-1])];m=a*g[0].length;e=e.concat(g[0]);g=new THREE.SplineCurve(e);
for(e=1;e<=m;e++)c.push(g.getPointAt(e/m));break;case THREE.PathActions.ARC:e=this.actions[d-1].args;h=g[0];i=g[1];j=g[2];q=g[3];m=g[4];n=!!g[5];k=e[e.length-2];o=e[e.length-1];e.length==0&&(k=o=0);s=m-q;var p=a*2;for(e=1;e<=p;e++)m=e/p,n||(m=1-m),m=q+m*s,g=k+h+j*Math.cos(m),m=o+i+j*Math.sin(m),c.push(new THREE.Vector2(g,m))}b&&c.push(c[0]);return c};THREE.Path.prototype.transform=function(a,b){this.getBoundingBox();return this.getWrapPoints(this.getPoints(b),a)};
THREE.Path.prototype.nltransform=function(a,b,c,d,f,g){var e=this.getPoints(),h,i,j,k,q;for(h=0,i=e.length;h<i;h++)j=e[h],k=j.x,q=j.y,j.x=a*k+b*q+c,j.y=d*q+f*k+g;return e};
THREE.Path.prototype.debug=function(a){var b=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",b.maxX+100),a.setAttribute("height",b.maxY+100),document.body.appendChild(a));b=a.getContext("2d");b.fillStyle="white";b.fillRect(0,0,a.width,a.height);b.strokeStyle="black";b.beginPath();var c,d,f;for(a=0,c=this.actions.length;a<c;a++)d=this.actions[a],f=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&b[d].apply(b,f);b.stroke();b.closePath();b.strokeStyle="red";d=
this.getPoints();for(a=0,c=d.length;a<c;a++)f=d[a],b.beginPath(),b.arc(f.x,f.y,1.5,0,Math.PI*2,!1),b.stroke(),b.closePath()};
THREE.Path.prototype.toShapes=function(){var a,b,c,d,f=[],g=new THREE.Path;for(a=0,b=this.actions.length;a<b;a++)c=this.actions[a],d=c.args,c=c.action,c==THREE.PathActions.MOVE_TO&&g.actions.length!=0&&(f.push(g),g=new THREE.Path),g[c].apply(g,d);g.actions.length!=0&&f.push(g);if(f.length==0)return[];var e;d=[];a=!THREE.Shape.Utils.isClockWise(f[0].getPoints());if(f.length==1)return g=f[0],e=new THREE.Shape,e.actions=g.actions,e.curves=g.curves,d.push(e),d;if(a){e=new THREE.Shape;for(a=0,b=f.length;a<
b;a++)g=f[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(e.actions=g.actions,e.curves=g.curves,d.push(e),e=new THREE.Shape):e.holes.push(g)}else{for(a=0,b=f.length;a<b;a++)g=f[a],THREE.Shape.Utils.isClockWise(g.getPoints())?(e&&d.push(e),e=new THREE.Shape,e.actions=g.actions,e.curves=g.curves):e.holes.push(g);d.push(e)}return d};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;
THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};THREE.Shape.prototype.getPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var b,c=this.holes.length,d=[];for(b=0;b<c;b++)d[b]=this.holes[b].getTransformedSpacedPoints(a,this.bends);return d};
THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
THREE.Shape.Utils={removeHoles:function(a,b){var c=a.concat(),d=c.concat(),f,g,e,h,i,j,k,q,n,o,s=[];for(i=0;i<b.length;i++){j=b[i];Array.prototype.push.apply(d,j);g=Number.POSITIVE_INFINITY;for(f=0;f<j.length;f++){n=j[f];o=[];for(q=0;q<c.length;q++)k=c[q],k=n.distanceToSquared(k),o.push(k),k<g&&(g=k,e=f,h=q)}f=h-1>=0?h-1:c.length-1;g=e-1>=0?e-1:j.length-1;var m=[j[e],c[h],c[f]];q=THREE.FontUtils.Triangulate.area(m);var p=[j[e],j[g],c[h]];n=THREE.FontUtils.Triangulate.area(p);o=h;k=e;h+=1;e+=-1;h<
0&&(h+=c.length);h%=c.length;e<0&&(e+=j.length);e%=j.length;f=h-1>=0?h-1:c.length-1;g=e-1>=0?e-1:j.length-1;m=[j[e],c[h],c[f]];m=THREE.FontUtils.Triangulate.area(m);p=[j[e],j[g],c[h]];p=THREE.FontUtils.Triangulate.area(p);q+n>m+p&&(h=o,e=k,h<0&&(h+=c.length),h%=c.length,e<0&&(e+=j.length),e%=j.length,f=h-1>=0?h-1:c.length-1,g=e-1>=0?e-1:j.length-1);q=c.slice(0,h);n=c.slice(h);o=j.slice(e);k=j.slice(0,e);g=[j[e],j[g],c[h]];s.push([j[e],c[h],c[f]]);s.push(g);c=q.concat(o).concat(k).concat(n)}return{shape:c,
isolatedPts:s,allpoints:d}},triangulateShape:function(a,b){var c=THREE.Shape.Utils.removeHoles(a,b),d=c.allpoints,f=c.isolatedPts,c=THREE.FontUtils.Triangulate(c.shape,!1),g,e,h,i,j={};for(g=0,e=d.length;g<e;g++)i=d[g].x+":"+d[g].y,j[i]!==void 0&&console.log("Duplicate point",i),j[i]=g;for(g=0,e=c.length;g<e;g++){h=c[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}for(g=0,e=f.length;g<e;g++){h=f[g];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=j[i],i!==void 0&&(h[d]=i)}return c.concat(f)},
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,b){var c=1-a;return c*c*b},b2p1:function(a,b){return 2*(1-a)*a*b},b2p2:function(a,b){return a*a*b},b2:function(a,b,c,d){return this.b2p0(a,b)+this.b2p1(a,c)+this.b2p2(a,d)},b3p0:function(a,b){var c=1-a;return c*c*c*b},b3p1:function(a,b){var c=1-a;return 3*c*c*a*b},b3p2:function(a,b){return 3*(1-a)*a*a*b},b3p3:function(a,b){return a*a*a*b},b3:function(a,b,c,d,f){return this.b3p0(a,b)+this.b3p1(a,c)+this.b3p2(a,d)+
this.b3p3(a,f)}};THREE.TextPath=function(a,b){THREE.Path.call(this);this.parameters=b||{};this.set(a)};THREE.TextPath.prototype.set=function(a,b){b=b||this.parameters;this.text=a;var c=b.curveSegments!==void 0?b.curveSegments:4,d=b.font!==void 0?b.font:"helvetiker",f=b.weight!==void 0?b.weight:"normal",g=b.style!==void 0?b.style:"normal";THREE.FontUtils.size=b.size!==void 0?b.size:100;THREE.FontUtils.divisions=c;THREE.FontUtils.face=d;THREE.FontUtils.weight=f;THREE.FontUtils.style=g};
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,b=[],c=0,d=a.length;c<d;c++)Array.prototype.push.apply(b,a[c].toShapes());return b};
THREE.AnimationHandler=function(){var a=[],b={},c={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){b[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");b[a.name]=a;if(a.initialized!==!0){for(var c=0;c<a.hierarchy.length;c++){for(var d=0;d<a.hierarchy[c].keys.length;d++){if(a.hierarchy[c].keys[d].time<
0)a.hierarchy[c].keys[d].time=0;if(a.hierarchy[c].keys[d].rot!==void 0&&!(a.hierarchy[c].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[c].keys[d].rot;a.hierarchy[c].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[c].keys.length&&a.hierarchy[c].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[c].keys.length;d++)for(var i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++){var j=a.hierarchy[c].keys[d].morphTargets[i];h[j]=-1}a.hierarchy[c].usedMorphTargets=
h;for(d=0;d<a.hierarchy[c].keys.length;d++){var k={};for(j in h){for(i=0;i<a.hierarchy[c].keys[d].morphTargets.length;i++)if(a.hierarchy[c].keys[d].morphTargets[i]===j){k[j]=a.hierarchy[c].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[c].keys[d].morphTargets.length&&(k[j]=0)}a.hierarchy[c].keys[d].morphTargetsInfluences=k}}for(d=1;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].time===a.hierarchy[c].keys[d-1].time&&(a.hierarchy[c].keys.splice(d,1),d--);for(d=0;d<a.hierarchy[c].keys.length;d++)a.hierarchy[c].keys[d].index=
d}d=parseInt(a.length*a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(c=0;c<a.hierarchy.length;c++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return b[a]?b[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};c.LINEAR=
0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,d){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=c!==void 0?c:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;var c,d=this.hierarchy.length,f;for(c=0;c<d;c++){f=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===void 0)f.animationCache={},f.animationCache.prevKey={pos:0,rot:0,scl:0},f.animationCache.nextKey={pos:0,rot:0,scl:0},f.animationCache.originalMatrix=f instanceof
THREE.Bone?f.skinMatrix:f.matrix;var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[c].keys[0];g.rot=this.data.hierarchy[c].keys[0];g.scl=this.data.hierarchy[c].keys[0];f.pos=this.getNextKeyWith("pos",c,1);f.rot=this.getNextKeyWith("rot",c,1);f.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,d,f,g,e,h,i,j,k=this.data.JIT.hierarchy,q,n;this.currentTime+=a*this.timeScale;n=this.currentTime;q=this.currentTime%=this.data.length;j=parseInt(Math.min(q*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,s=this.hierarchy.length;o<s;o++)if(a=this.hierarchy[o],i=a.animationCache,this.JITCompile&&k[o][j]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
!1):(a.matrix=k[o][j],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var m=0;m<3;m++){c=b[m];e=i.prevKey[c];h=i.nextKey[c];if(h.time<=n){if(q<n)if(this.loop){e=this.data.hierarchy[o].keys[0];for(h=this.getNextKeyWith(c,o,1);h.time<q;)e=h,h=this.getNextKeyWith(c,o,h.index+1)}else{this.stop();return}else{do e=h,h=this.getNextKeyWith(c,o,h.index+1);while(h.time<
q)}i.prevKey[c]=e;i.nextKey[c]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(q-e.time)/(h.time-e.time);f=e[c];g=h[c];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+o),d=d<0?0:1;if(c==="pos")if(c=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)c.x=f[0]+(g[0]-f[0])*d,c.y=f[1]+(g[1]-f[1])*d,c.z=f[2]+(g[2]-f[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
this.getPrevKeyWith("pos",o,e.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",o,h.index+1).pos,d=d*0.33+0.33,f=this.interpolateCatmullRom(this.points,d),c.x=f[0],c.y=f[1],c.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(c),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(c===
"rot")THREE.Quaternion.slerp(f,g,a.quaternion,d);else if(c==="scl")c=a.scale,c.x=f[0]+(g[0]-f[0])*d,c.y=f[1]+(g[1]-f[1])*d,c.z=f[2]+(g[2]-f[2])*d}}if(this.JITCompile&&k[0][j]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(o=0;o<this.hierarchy.length;o++)k[o][j]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],d=[],f,g,e,h,i,j;f=(a.length-1)*b;g=Math.floor(f);f-=g;c[0]=g===0?g:g-1;c[1]=g;c[2]=g>a.length-2?g:g+1;c[3]=g>a.length-3?g:g+2;g=a[c[0]];h=a[c[1]];i=a[c[2]];j=a[c[3]];c=f*f;e=f*c;d[0]=this.interpolate(g[0],h[0],i[0],j[0],f,c,e);d[1]=this.interpolate(g[1],h[1],i[1],j[1],f,c,e);d[2]=this.interpolate(g[2],h[2],i[2],j[2],f,c,e);return d};
THREE.Animation.prototype.interpolate=function(a,b,c,d,f,g,e){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*e+(-3*(b-c)-2*a-d)*g+a*f+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var d=this.data.hierarchy[b].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c=c<d.length-1?c:d.length-1:c%=d.length;c<d.length;c++)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[0]};
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys,c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+d.length;c>=0;c--)if(d[c][a]!==void 0)return d[c];return this.data.hierarchy[b].keys[d.length-1]};
THREE.KeyFrameAnimation=function(a,b,c){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=0.0010;this.isPlaying=!1;this.loop=this.isPaused=!0;this.JITCompile=c!==void 0?c:!0;a=0;for(b=this.hierarchy.length;a<b;a++){var c=this.data.hierarchy[a].sids,d=this.hierarchy[a];if(this.data.hierarchy[a].keys.length&&c){for(var f=0;f<c.length;f++){var g=c[f],e=this.getNextKeyWith(g,a,0);e&&e.apply(g)}d.matrixAutoUpdate=!1;this.data.hierarchy[a].node.updateMatrix();
d.matrixWorldNeedsUpdate=!0}}};
THREE.KeyFrameAnimation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=b!==void 0?b:0;this.startTimeMs=b;this.startTime=1E7;this.endTime=-this.startTime;var c,d=this.hierarchy.length,f,g;for(c=0;c<d;c++){f=this.hierarchy[c];g=this.data.hierarchy[c];f.useQuaternion=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey=null,g.animationCache.nextKey=null,g.animationCache.originalMatrix=f instanceof THREE.Bone?f.skinMatrix:
f.matrix;f=this.data.hierarchy[c].keys;if(f.length)g.animationCache.prevKey=f[0],g.animationCache.nextKey=f[1],this.startTime=Math.min(f[0].time,this.startTime),this.endTime=Math.max(f[f.length-1].time,this.endTime)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};THREE.KeyFrameAnimation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
THREE.KeyFrameAnimation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.data.hierarchy.length;a++){var b=this.hierarchy[a],c=this.data.hierarchy[a];if(c.animationCache!==void 0){var d=c.animationCache.originalMatrix;b instanceof THREE.Bone?(d.copy(b.skinMatrix),b.skinMatrix=d):(d.copy(b.matrix),b.matrix=d);delete c.animationCache}}};
THREE.KeyFrameAnimation.prototype.update=function(a){if(this.isPlaying){var b,c,d,f,g=this.data.JIT.hierarchy,e,h,i;this.currentTime+=a*this.timeScale;h=this.currentTime;e=this.currentTime%=this.data.length;if(e<this.startTimeMs)e=this.currentTime=this.startTimeMs+e;f=parseInt(Math.min(e*this.data.fps,this.data.length*this.data.fps),10);if((i=e<h)&&!this.loop){for(var a=0,j=this.hierarchy.length;a<j;a++){var k=this.data.hierarchy[a].keys,g=this.data.hierarchy[a].sids;d=k.length-1;f=this.hierarchy[a];
if(k.length){for(k=0;k<g.length;k++)e=g[k],(h=this.getPrevKeyWith(e,a,d))&&h.apply(e);this.data.hierarchy[a].node.updateMatrix();f.matrixWorldNeedsUpdate=!0}}this.stop()}else if(!(e<this.startTime)){a=0;for(j=this.hierarchy.length;a<j;a++){d=this.hierarchy[a];b=this.data.hierarchy[a];var k=b.keys,q=b.animationCache;if(this.JITCompile&&g[a][f]!==void 0)d instanceof THREE.Bone?(d.skinMatrix=g[a][f],d.matrixWorldNeedsUpdate=!1):(d.matrix=g[a][f],d.matrixWorldNeedsUpdate=!0);else if(k.length){if(this.JITCompile&&
q)d instanceof THREE.Bone?d.skinMatrix=q.originalMatrix:d.matrix=q.originalMatrix;b=q.prevKey;c=q.nextKey;if(b&&c){if(c.time<=h){if(i&&this.loop){b=k[0];for(c=k[1];c.time<e;)b=c,c=k[b.index+1]}else if(!i)for(var n=k.length-1;c.time<e&&c.index!==n;)b=c,c=k[b.index+1];q.prevKey=b;q.nextKey=c}c.time>=e?b.interpolate(c,e):b.interpolate(c,c.time)}this.data.hierarchy[a].node.updateMatrix();d.matrixWorldNeedsUpdate=!0}}if(this.JITCompile&&g[0][f]===void 0){this.hierarchy[0].updateMatrixWorld(!0);for(a=0;a<
this.hierarchy.length;a++)g[a][f]=this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix.clone():this.hierarchy[a].matrix.clone()}}}};THREE.KeyFrameAnimation.prototype.getNextKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c%=b.length;c<b.length;c++)if(b[c].hasTarget(a))return b[c];return b[0]};THREE.KeyFrameAnimation.prototype.getPrevKeyWith=function(a,b,c){b=this.data.hierarchy[b].keys;for(c=c>=0?c:c+b.length;c>=0;c--)if(b[c].hasTarget(a))return b[c];return b[b.length-1]};
THREE.CubeCamera=function(a,b,c,d){this.heightOffset=c;this.position=new THREE.Vector3(0,c,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,b);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
this.position;this.cameraNY.position=this.position;this.cameraPZ.position=this.position;this.cameraNZ.position=this.position;this.cameraPX.up.set(0,-1,0);this.cameraNX.up.set(0,-1,0);this.cameraPY.up.set(0,0,1);this.cameraNY.up.set(0,0,-1);this.cameraPZ.up.set(0,-1,0);this.cameraNZ.up.set(0,-1,0);this.targetPX=new THREE.Vector3(0,0,0);this.targetNX=new THREE.Vector3(0,0,0);this.targetPY=new THREE.Vector3(0,0,0);this.targetNY=new THREE.Vector3(0,0,0);this.targetPZ=new THREE.Vector3(0,0,0);this.targetNZ=
new THREE.Vector3(0,0,0);this.renderTarget=new THREE.WebGLRenderTargetCube(d,d,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFilter});this.updatePosition=function(a){this.position.copy(a);this.position.y+=this.heightOffset;this.targetPX.copy(this.position);this.targetNX.copy(this.position);this.targetPY.copy(this.position);this.targetNY.copy(this.position);this.targetPZ.copy(this.position);this.targetNZ.copy(this.position);this.targetPX.x+=1;this.targetNX.x-=1;this.targetPY.y+=
1;this.targetNY.y-=1;this.targetPZ.z+=1;this.targetNZ.z-=1;this.cameraPX.lookAt(this.targetPX);this.cameraNX.lookAt(this.targetNX);this.cameraPY.lookAt(this.targetPY);this.cameraNY.lookAt(this.targetNY);this.cameraPZ.lookAt(this.targetPZ);this.cameraNZ.lookAt(this.targetNZ)};this.updateCubeMap=function(a,b){var c=this.renderTarget;c.activeCubeFace=0;a.render(b,this.cameraPX,c);c.activeCubeFace=1;a.render(b,this.cameraNX,c);c.activeCubeFace=2;a.render(b,this.cameraPY,c);c.activeCubeFace=3;a.render(b,
this.cameraNY,c);c.activeCubeFace=4;a.render(b,this.cameraPZ,c);c.activeCubeFace=5;a.render(b,this.cameraNZ,c)}};THREE.CombinedCamera=function(a,b,c,d,f,g,e){THREE.Camera.call(this);this.fov=c;this.left=-a/2;this.right=a/2;this.top=b/2;this.bottom=-b/2;this.cameraO=new THREE.OrthographicCamera(a/-2,a/2,b/2,b/-2,g,e);this.cameraP=new THREE.PerspectiveCamera(c,a/b,d,f);this.zoom=1;this.toPerspective()};THREE.CombinedCamera.prototype=new THREE.Camera;THREE.CombinedCamera.prototype.constructor=THREE.CoolCamera;
THREE.CombinedCamera.prototype.toPerspective=function(){this.near=this.cameraP.near;this.far=this.cameraP.far;this.cameraP.fov=this.fov/this.zoom;this.cameraP.updateProjectionMatrix();this.projectionMatrix=this.cameraP.projectionMatrix;this.inPersepectiveMode=!0;this.inOrthographicMode=!1};
THREE.CombinedCamera.prototype.toOrthographic=function(){var a=this.cameraP.aspect,b=(this.cameraP.near+this.cameraP.far)/2;b*=Math.tan(this.fov/2);a=2*b*a/2;b/=this.zoom;a/=this.zoom;this.cameraO.left=-a;this.cameraO.right=a;this.cameraO.top=b;this.cameraO.bottom=-b;this.cameraO.updateProjectionMatrix();this.near=this.cameraO.near;this.far=this.cameraO.far;this.projectionMatrix=this.cameraO.projectionMatrix;this.inPersepectiveMode=!1;this.inOrthographicMode=!0};
THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,b){var c=2*Math.atan((b!==void 0?b:24)/(a*2))*(180/Math.PI);this.setFov(c);return c};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
THREE.FirstPersonControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=b!==void 0?b:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
!1;break;case 70:this.moveDown=!1}};this.update=function(a){var b=0;if(!this.freeze){this.heightSpeed?(b=THREE.Math.clamp(this.object.position.y,this.heightMin,this.heightMax)-this.heightMin,this.autoSpeedFactor=a*b*this.heightCoef):this.autoSpeedFactor=0;b=a*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(b+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(b);this.moveLeft&&this.object.translateX(-b);this.moveRight&&this.object.translateX(b);
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);a*=this.lookSpeed;this.activeLook||(a=0);this.lon+=this.mouseX*a;this.lookVertical&&(this.lat-=this.mouseY*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.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*a;this.lookVertical&&(this.lat-=this.mouseY*a*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=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
this.object.lookAt(b)}};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
THREE.PathControls=function(a,b){function c(a){return(a*=2)<1?0.5*a*a:-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function f(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),p=g.length,r=0;f=p-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<p-1;f++)r=d*h.chunks[f]/h.total,b.keys[f]={time:r,pos:g[f]};e.hierarchy[0]=b;THREE.AnimationHandler.add(e);
return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function g(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=b!==void 0?b:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=
new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/
2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var e=Math.PI*2,h=Math.PI/180;this.update=function(a){var b;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%e;this.phi=a>=0?a:a+e;b=this.verticalAngleMap.srcRange;a=this.verticalAngleMap.dstRange;
b=THREE.Math.mapLinear(this.phi,b[0],b[1],a[0],a[1]);var d=a[1]-a[0];this.phi=c((b-a[0])/d)*d+a[0];b=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;b=THREE.Math.mapLinear(this.theta,b[0],b[1],a[0],a[1]);d=a[1]-a[0];this.theta=c((b-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=function(a){this.domElement===
document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
c=new THREE.CubeGeometry(10,10,20),e=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(e,b);a.position.set(0,10,0);this.animation=f(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=f(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
this.debugPath,b=this.spline,e=g(b,10),c=g(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),e=new THREE.Line(e,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));e.scale.set(1,1,1);a.add(e);c.scale.set(1,1,1);a.add(c);for(var e=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),o=0;o<b.points.length;o++)c=new THREE.Mesh(e,h),c.position.copy(b.points[o]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
!1)}};THREE.PathControlsIdCounter=0;
THREE.FlyControls=function(a,b){function c(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=b!==void 0?b:document;b&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(a){if(!this.dragToLook||this.mouseStatus>0){var b=this.getContainerDimensions(),c=b.size[0]/2,e=b.size[1]/2;this.moveState.yawLeft=-(a.pageX-b.offset[0]-c)/c;this.moveState.pitchDown=(a.pageY-b.offset[1]-e)/e;this.updateRotationVector()}};this.mouseup=function(a){a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(a.button){case 0:this.moveForward=
!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(a){var b=a*this.movementSpeed;a*=this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*a,this.rotationVector.y*a,this.rotationVector.z*a,1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,
this.mouseup),!1);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
THREE.RollControls=function(a,b){this.object=a;this.domElement=b!==void 0?b:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var c=new THREE.Vector3,d=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Matrix4,e=!1,h=1,i=0,j=0,k=0,q=0,n=0,o=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var b=a*this.lookSpeed;
this.rotateHorizontally(b*q);this.rotateVertically(b*n)}b=a*this.movementSpeed;this.object.translateZ(-b*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(b*j);this.object.translateY(b*k);e&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();f.copy(this.forward);d.set(0,1,0);c.cross(d,
f).normalize();d.cross(f,c).normalize();this.object.matrix.n11=c.x;this.object.matrix.n12=d.x;this.object.matrix.n13=f.x;this.object.matrix.n21=c.y;this.object.matrix.n22=d.y;this.object.matrix.n23=f.y;this.object.matrix.n31=c.z;this.object.matrix.n32=d.z;this.object.matrix.n33=f.z;g.identity();g.n11=Math.cos(this.roll);g.n12=-Math.sin(this.roll);g.n21=Math.sin(this.roll);g.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(g);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){c.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);c.multiplyScalar(a);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){q=(a.clientX-o)/window.innerWidth;n=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:j=-1;break;case 40:case 83:i=-1;break;case 39:case 68:j=1;break;case 81:e=!0;h=1;break;case 69:e=!0;h=-1;break;case 82:k=1;break;case 70:k=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:j=0;break;case 40:case 83:i=0;break;case 39:case 68:j=0;break;case 81:e=!1;break;case 69:e=!1;break;case 82:k=0;break;case 70:k=0}},!1)};
THREE.TrackballControls=function(a,b){THREE.EventTarget.call(this);var c=this;this.object=a;this.domElement=b!==void 0?b:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=this.noRotate=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
new THREE.Vector3;var d=new THREE.Vector3,f=!1,g=-1,e=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector2,k=new THREE.Vector2,q=new THREE.Vector2,n=new THREE.Vector2,o={type:"change"};this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,b){return new THREE.Vector2((a-c.screen.offsetLeft)/c.radius*0.5,(b-c.screen.offsetTop)/c.radius*0.5)};this.getMouseProjectionOnBall=function(a,b){var d=new THREE.Vector3((a-c.screen.width*
0.5-c.screen.offsetLeft)/c.radius,(c.screen.height*0.5+c.screen.offsetTop-b)/c.radius,0),f=d.length();f>1?d.normalize():d.z=Math.sqrt(1-f*f);e.copy(c.object.position).subSelf(c.target);f=c.object.up.clone().setLength(d.y);f.addSelf(c.object.up.clone().crossSelf(e).setLength(d.x));f.addSelf(e.setLength(d.z));return f};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var b=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=c.rotateSpeed;d.setFromAxisAngle(b,
-a);d.multiplyVector3(e);d.multiplyVector3(c.object.up);d.multiplyVector3(i);c.staticMoving?h=i:(d.setFromAxisAngle(b,a*(c.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(k.y-j.y)*c.zoomSpeed;a!==1&&a>0&&(e.multiplyScalar(a),c.staticMoving?j=k:j.y+=(k.y-j.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=n.clone().subSelf(q);if(a.lengthSq()){a.multiplyScalar(e.length()*c.panSpeed);var b=e.clone().crossSelf(c.object.up).setLength(a.x);b.addSelf(c.object.up.clone().setLength(a.y));
c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?q=n:q.addSelf(a.sub(n,q).multiplyScalar(c.dynamicDampingFactor))}};this.checkDistances=function(){if(!c.noZoom||!c.noPan)c.object.position.lengthSq()>c.maxDistance*c.maxDistance&&c.object.position.setLength(c.maxDistance),e.lengthSq()<c.minDistance*c.minDistance&&c.object.position.add(c.target,e.setLength(c.minDistance))};this.update=function(){e.copy(c.object.position).subSelf(c.target);c.noRotate||c.rotateCamera();c.noZoom||c.zoomCamera();
c.noPan||c.panCamera();c.object.position.add(c.target,e);c.checkDistances();c.object.lookAt(c.target);d.distanceTo(c.object.position)>0&&(c.dispatchEvent(o),d.copy(c.object.position))};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(f&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),q=n=c.getMouseOnScreen(a.clientX,a.clientY),f=!1),g!==-1&&(g===0&&
!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===1&&!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):g===2&&!c.noPan&&(n=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===-1))g=a.button,g===0&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===1&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(q=n=c.getMouseOnScreen(a.clientX,a.clientY))},
!1);this.domElement.addEventListener("mouseup",function(a){c.enabled&&(a.preventDefault(),a.stopPropagation(),g=-1)},!1);window.addEventListener("keydown",function(a){c.enabled&&g===-1&&(a.keyCode===c.keys[0]&&!c.noRotate?g=0:a.keyCode===c.keys[1]&&!c.noZoom?g=1:a.keyCode===c.keys[2]&&!c.noPan&&(g=2),g!==-1&&(f=!0))},!1);window.addEventListener("keyup",function(){c.enabled&&g!==-1&&(g=-1)},!1)};
THREE.CubeGeometry=function(a,b,c,d,f,g,e,h){function i(a,b,c,e,h,i,k,m){var n,o=d||1,q=f||1,p=h/2,s=i/2,r=j.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",q=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var l=o+1,t=q+1,v=h/o,z=i/q,T=new THREE.Vector3;T[n]=k>0?1:-1;for(h=0;h<t;h++)for(i=0;i<l;i++){var W=new THREE.Vector3;W[a]=(i*v-p)*c;W[b]=(h*z-s)*e;W[n]=k;j.vertices.push(new THREE.Vertex(W))}for(h=0;h<q;h++)for(i=0;i<o;i++)a=
new THREE.Face4(i+l*h+r,i+l*(h+1)+r,i+1+l*(h+1)+r,i+1+l*h+r),a.normal.copy(T),a.vertexNormals.push(T.clone(),T.clone(),T.clone(),T.clone()),a.materialIndex=m,j.faces.push(a),j.faceVertexUvs[0].push([new THREE.UV(i/o,h/q),new THREE.UV(i/o,(h+1)/q),new THREE.UV((i+1)/o,(h+1)/q),new THREE.UV((i+1)/o,h/q)])}THREE.Geometry.call(this);var j=this,k=a/2,q=b/2,n=c/2,o,s,m,p,r,t;if(e!==void 0){if(e instanceof Array)this.materials=e;else{this.materials=[];for(o=0;o<6;o++)this.materials.push(e)}o=0;p=1;s=2;r=
3;m=4;t=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var v in h)this.sides[v]!==void 0&&(this.sides[v]=h[v]);this.sides.px&&i("z","y",-1,-1,c,b,k,o);this.sides.nx&&i("z","y",1,-1,c,b,-k,p);this.sides.py&&i("x","z",1,1,a,c,q,s);this.sides.ny&&i("x","z",1,-1,a,c,-q,r);this.sides.pz&&i("x","y",1,-1,a,b,n,m);this.sides.nz&&i("x","y",-1,-1,a,b,-n,t);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
THREE.CylinderGeometry=function(a,b,c,d,f,g){THREE.Geometry.call(this);var a=a!==void 0?a:20,b=b!==void 0?b:20,c=c!==void 0?c:100,e=c/2,d=d||8,f=f||1,h,i,j=[],k=[];for(i=0;i<=f;i++){var q=[],n=[],o=i/f,s=o*(b-a)+a;for(h=0;h<=d;h++){var m=h/d,p=s*Math.sin(m*Math.PI*2),r=-o*c+e,t=s*Math.cos(m*Math.PI*2);this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,r,t)));q.push(this.vertices.length-1);n.push(new THREE.UV(m,o))}j.push(q);k.push(n)}for(i=0;i<f;i++)for(h=0;h<d;h++){var c=j[i][h],q=j[i+1][h],
n=j[i+1][h+1],o=j[i][h+1],s=this.vertices[c].position.clone().setY(0).normalize(),m=this.vertices[q].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),r=this.vertices[o].position.clone().setY(0).normalize(),t=k[i][h].clone(),v=k[i+1][h].clone(),u=k[i+1][h+1].clone(),w=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,q,n,o,[s,m,p,r]));this.faceVertexUvs[0].push([t,v,u,w])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,e,0)));for(h=
0;h<d;h++)c=j[0][h],q=j[0][h+1],n=this.vertices.length-1,s=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),t=k[0][h].clone(),v=k[0][h+1].clone(),u=new THREE.UV(v.u,0),this.faces.push(new THREE.Face3(c,q,n,[s,m,p])),this.faceVertexUvs[0].push([t,v,u])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-e,0)));for(h=0;h<d;h++)c=j[i][h+1],q=j[i][h],n=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,
0),t=k[i][h+1].clone(),v=k[i][h].clone(),u=new THREE.UV(v.u,1),this.faces.push(new THREE.Face3(c,q,n,[s,m,p])),this.faceVertexUvs[0].push([t,v,u])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d,f=a.length;this.shapebb=a[f-1].getBoundingBox();for(d=0;d<f;d++)c=a[d],this.addShape(c,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;return g<0?(b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),c=(b+a)/2,a=-Math.cos(c),c=-Math.sin(c),new THREE.Vector2(a,c)):d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function f(a){for(A=a.length;--A>=0;){V=A;E=A-1;E<0&&(E=a.length-1);for(var b=
0,c=o+k*2,b=0;b<c;b++){var d=B*b,e=B*(b+1),f=M+V+d,g=M+E+d,h=M+E+e,i=M+V+e;f+=G;g+=G;h+=G;i+=G;D.faces.push(new THREE.Face4(f,g,h,i,null,null,u));var e=D.vertices[f].position.x,d=D.vertices[f].position.y,f=D.vertices[f].position.z,j=D.vertices[g].position.x,m=D.vertices[g].position.y,g=D.vertices[g].position.z,l=D.vertices[h].position.x,n=D.vertices[h].position.y,h=D.vertices[h].position.z,q=D.vertices[i].position.x,p=D.vertices[i].position.y,i=D.vertices[i].position.z;Math.abs(d-m)<0.01?D.faceVertexUvs[0].push([new THREE.UV(e,
f),new THREE.UV(j,g),new THREE.UV(l,h),new THREE.UV(q,i)]):D.faceVertexUvs[0].push([new THREE.UV(d,f),new THREE.UV(m,g),new THREE.UV(n,h),new THREE.UV(p,i)])}}}function g(a,b,c){D.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function e(a,b,c){a+=G;b+=G;c+=G;D.faces.push(new THREE.Face3(a,b,c,null,null,v));var d=D.vertices[b].position.x,b=D.vertices[b].position.y,e=D.vertices[c].position.x,c=D.vertices[c].position.y;D.faceVertexUvs[0].push([new THREE.UV(D.vertices[a].position.x,1-D.vertices[a].position.y),
new THREE.UV(d,1-b),new THREE.UV(e,1-c)])}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,q=b.bevelEnabled!==void 0?b.bevelEnabled:!0,n=b.curveSegments!==void 0?b.curveSegments:12,o=b.steps!==void 0?b.steps:1,s=b.bendPath,m=b.extrudePath,p,r=!1,t=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,v=b.material,u=b.extrudeMaterial;if(m)p=m.getPoints(n),o=p.length,r=!0,q=!1;q||(j=i=k=
0);var w,y,F,D=this,G=this.vertices.length;s&&a.addWrapPath(s);n=t?a.extractAllSpacedPoints(n):a.extractAllPoints(n);s=n.shape;n=n.holes;if(m=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();for(y=0,F=n.length;y<F;y++)w=n[y],THREE.Shape.Utils.isClockWise(w)&&(n[y]=w.reverse());m=!1}m=THREE.Shape.Utils.triangulateShape(s,n);t=s;for(y=0,F=n.length;y<F;y++)w=n[y],s=s.concat(w);for(var I,K,Q,N,B=s.length,O=m.length,S=[],A=0,l=t.length,V=l-1,E=A+1;A<l;A++,V++,E++)V===l&&(V=0),E===l&&(E=0),S[A]=d(t[A],
t[V],t[E]);var z=[],T,W=S.concat();for(y=0,F=n.length;y<F;y++){w=n[y];T=[];for(A=0,l=w.length,V=l-1,E=A+1;A<l;A++,V++,E++)V===l&&(V=0),E===l&&(E=0),T[A]=d(w[A],w[V],w[E]);z.push(T);W=W.concat(T)}for(I=0;I<k;I++){K=I/k;Q=i*(1-K);K=j*Math.sin(K*Math.PI/2);for(A=0,l=t.length;A<l;A++)N=c(t[A],S[A],K),g(N.x,N.y,-Q);for(y=0,F=n.length;y<F;y++){w=n[y];T=z[y];for(A=0,l=w.length;A<l;A++)N=c(w[A],T[A],K),g(N.x,N.y,-Q)}}K=j;for(A=0;A<B;A++)N=q?c(s[A],W[A],K):s[A],r?g(N.x,N.y+p[0].y,p[0].x):g(N.x,N.y,0);for(I=
1;I<=o;I++)for(A=0;A<B;A++)N=q?c(s[A],W[A],K):s[A],r?g(N.x,N.y+p[I-1].y,p[I-1].x):g(N.x,N.y,h/o*I);for(I=k-1;I>=0;I--){K=I/k;Q=i*(1-K);K=j*Math.sin(K*Math.PI/2);for(A=0,l=t.length;A<l;A++)N=c(t[A],S[A],K),g(N.x,N.y,h+Q);for(y=0,F=n.length;y<F;y++){w=n[y];T=z[y];for(A=0,l=w.length;A<l;A++)N=c(w[A],T[A],K),r?g(N.x,N.y+p[o-1].y,p[o-1].x+Q):g(N.x,N.y,h+Q)}}if(q){i=B*0;for(A=0;A<O;A++)h=m[A],e(h[2]+i,h[1]+i,h[0]+i);i=B*(o+k*2);for(A=0;A<O;A++)h=m[A],e(h[0]+i,h[1]+i,h[2]+i)}else{for(A=0;A<O;A++)h=m[A],
e(h[2],h[1],h[0]);for(A=0;A<O;A++)h=m[A],e(h[0]+B*o,h[1]+B*o,h[2]+B*o)}var M=0;f(t);M+=t.length;for(y=0,F=n.length;y<F;y++)w=n[y],f(w),M+=w.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.LatheGeometry=function(a,b,c){THREE.Geometry.call(this);this.steps=b||12;this.angle=c||2*Math.PI;for(var b=this.angle/this.steps,c=[],d=[],f=[],g=[],e=(new THREE.Matrix4).setRotationZ(b),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),c[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=b){for(h=0;h<c.length;h++)i<this.angle?(c[h]=e.multiplyVector3(c[h].clone()),this.vertices.push(new THREE.Vertex(c[h])),f[h]=this.vertices.length-1):f=g;i==0&&(g=d);
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-b)/this.angle,h/a.length)]);d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
THREE.PlaneGeometry=function(a,b,c,d){THREE.Geometry.call(this);for(var f=a/2,g=b/2,c=c||1,d=d||1,e=c+1,h=d+1,i=a/c,j=b/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(b=0;b<e;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*i-f,-(a*j-g),0)));for(a=0;a<d;a++)for(b=0;b<c;b++)f=new THREE.Face4(b+e*a,b+e*(a+1),b+1+e*(a+1),b+1+e*a),f.normal.copy(k),f.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(f),this.faceVertexUvs[0].push([new THREE.UV(b/c,a/d),new THREE.UV(b/
c,(a+1)/d),new THREE.UV((b+1)/c,(a+1)/d),new THREE.UV((b+1)/c,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
THREE.SphereGeometry=function(a,b,c,d,f,g,e){THREE.Geometry.call(this);var a=a||50,d=d!==void 0?d:0,f=f!==void 0?f:Math.PI*2,g=g!==void 0?g:0,e=e!==void 0?e:Math.PI,b=Math.max(3,Math.floor(b)||8),c=Math.max(2,Math.floor(c)||6),h,i,j=[],k=[];for(i=0;i<=c;i++){var q=[],n=[];for(h=0;h<=b;h++){var o=h/b,s=i/c,m=-a*Math.cos(d+o*f)*Math.sin(g+s*e),p=a*Math.cos(g+s*e),r=a*Math.sin(d+o*f)*Math.sin(g+s*e);this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,p,r)));q.push(this.vertices.length-1);n.push(new THREE.UV(o,
s))}j.push(q);k.push(n)}for(i=0;i<c;i++)for(h=0;h<b;h++){var d=j[i][h+1],f=j[i][h],g=j[i+1][h],e=j[i+1][h+1],q=this.vertices[d].position.clone().normalize(),n=this.vertices[f].position.clone().normalize(),o=this.vertices[g].position.clone().normalize(),s=this.vertices[e].position.clone().normalize(),m=k[i][h+1].clone(),p=k[i][h].clone(),r=k[i+1][h].clone(),t=k[i+1][h+1].clone();Math.abs(this.vertices[d].position.y)==a?(this.faces.push(new THREE.Face3(d,g,e,[q,o,s])),this.faceVertexUvs[0].push([m,
r,t])):Math.abs(this.vertices[g].position.y)==a?(this.faces.push(new THREE.Face3(d,f,g,[q,n,o])),this.faceVertexUvs[0].push([m,p,r])):(this.faces.push(new THREE.Face4(d,f,g,e,[q,n,o,s])),this.faceVertexUvs[0].push([m,p,r,t]))}this.computeCentroids();this.computeFaceNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
THREE.TextGeometry=function(a,b){var c=(new THREE.TextPath(a,b)).toShapes();b.amount=b.height!==void 0?b.height:50;if(b.bevelThickness===void 0)b.bevelThickness=10;if(b.bevelSize===void 0)b.bevelSize=8;if(b.bevelEnabled===void 0)b.bevelEnabled=!1;if(b.bend){var d=c[c.length-1].getBoundingBox().maxX;b.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,c,b)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var b=a.familyName.toLowerCase();this.faces[b]=this.faces[b]||{};this.faces[b][a.cssFontWeight]=this.faces[b][a.cssFontWeight]||{};this.faces[b][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[b][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var b=this.getFace(),c=this.size/b.resolution,d=
0,f=String(a).split(""),g=f.length,e=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(f[a],b,c,d,h);d+=h.offset;e.push(h.path)}return{paths:e,offset:d/2}},extractGlyphPoints:function(a,b,c,d,f){var g=[],e,h,i,j,k,q,n,o,s,m,p,r=b.glyphs[a]||b.glyphs["?"];if(r){if(r.o){b=r._cachedOutline||(r._cachedOutline=r.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));f.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
k));f.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;o=b[a++]*c+d;s=b[a++]*c;f.quadraticCurveTo(o,s,i,k);if(e=g[g.length-1]){q=e.x;n=e.y;for(e=1,h=this.divisions;e<=h;e++){var t=e/h,v=THREE.Shape.Utils.b2(t,q,o,i),t=THREE.Shape.Utils.b2(t,n,s,k);g.push(new THREE.Vector2(v,t))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,o=b[a++]*c+d,s=b[a++]*-c,m=b[a++]*c+d,p=b[a++]*-c,f.bezierCurveTo(i,k,o,s,m,p),e=g[g.length-1]){q=e.x;n=e.y;for(e=1,h=this.divisions;e<=h;e++)t=e/h,v=THREE.Shape.Utils.b3(t,q,o,
m,i),t=THREE.Shape.Utils.b3(t,n,s,p,k),g.push(new THREE.Vector2(v,t))}}}return{offset:r.ha*c,points:g,path:f}}}};
(function(a){var b=function(a){for(var b=a.length,f=0,g=b-1,e=0;e<b;g=e++)f+=a[g].x*a[e].y-a[e].x*a[g].y;return f*0.5};a.Triangulate=function(a,d){var f=a.length;if(f<3)return null;var g=[],e=[],h=[],i,j,k;if(b(a)>0)for(j=0;j<f;j++)e[j]=j;else for(j=0;j<f;j++)e[j]=f-1-j;var q=2*f;for(j=f-1;f>2;){if(q--<=0){console.log("Warning, unable to triangulate polygon!");break}i=j;f<=i&&(i=0);j=i+1;f<=j&&(j=0);k=j+1;f<=k&&(k=0);var n;a:{n=a;var o=i,s=j,m=k,p=f,r=e,t=void 0,v=void 0,u=void 0,w=void 0,y=void 0,
F=void 0,D=void 0,G=void 0,I=void 0,v=n[r[o]].x,u=n[r[o]].y,w=n[r[s]].x,y=n[r[s]].y,F=n[r[m]].x,D=n[r[m]].y;if(1.0E-10>(w-v)*(D-u)-(y-u)*(F-v))n=!1;else{for(t=0;t<p;t++)if(!(t==o||t==s||t==m)){var G=n[r[t]].x,I=n[r[t]].y,K=void 0,Q=void 0,N=void 0,B=void 0,O=void 0,S=void 0,A=void 0,l=void 0,V=void 0,E=void 0,z=void 0,T=void 0,K=N=O=void 0,K=F-w,Q=D-y,N=v-F,B=u-D,O=w-v,S=y-u,A=G-v,l=I-u,V=G-w,E=I-y,z=G-F,T=I-D,K=K*E-Q*V,O=O*l-S*A,N=N*T-B*z;if(K>=0&&N>=0&&O>=0){n=!1;break a}}n=!0}}if(n){g.push([a[e[i]],
a[e[j]],a[e[k]]]);h.push([e[i],e[j],e[k]]);for(i=j,k=j+1;k<f;i++,k++)e[i]=e[k];f--;q=2*f}}return d?h:g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
THREE.TorusGeometry=function(a,b,c,d,f){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=f||Math.PI*2;f=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,e=c/this.segmentsR*Math.PI*2;f.x=this.radius*Math.cos(g);f.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(e))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(e))*Math.sin(g);h.z=
this.tube*Math.sin(e);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(f).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var f=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,e=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(f,g,e,h,[b[f],b[g],b[e],b[h]]);i.normal.addSelf(b[f]);i.normal.addSelf(b[g]);i.normal.addSelf(b[e]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
this.faceVertexUvs[0].push([a[f].clone(),a[g].clone(),a[e].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
THREE.TorusKnotGeometry=function(a,b,c,d,f,g,e){function h(a,b,c,d,e,f){var g=Math.cos(a);Math.cos(b);b=Math.sin(a);a*=c/d;c=Math.cos(a);g*=e*(2+c)*0.5;b=e*(2+c)*b*0.5;e=f*e*Math.sin(a)*0.5;return new THREE.Vector3(g,b,e)}THREE.Geometry.call(this);this.radius=a||200;this.tube=b||40;this.segmentsR=c||64;this.segmentsT=d||8;this.p=f||2;this.q=g||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);c=new THREE.Vector3;d=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=
Array(this.segmentsT);for(b=0;b<this.segmentsT;++b){var i=a/this.segmentsR*2*this.p*Math.PI,e=b/this.segmentsT*2*Math.PI,g=h(i,e,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,e,this.q,this.p,this.radius,this.heightScale);c.sub(i,g);d.add(i,g);f.cross(c,d);d.cross(f,c);f.normalize();d.normalize();i=-this.tube*Math.cos(e);e=this.tube*Math.sin(e);g.x+=i*d.x+e*f.x;g.y+=i*d.y+e*f.y;g.z+=i*d.z+e*f.z;this.grid[a][b]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,g.z)))-1}}for(a=0;a<
this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var f=(a+1)%this.segmentsR,g=(b+1)%this.segmentsT,c=this.grid[a][b],d=this.grid[f][b],f=this.grid[f][g],g=this.grid[a][g],e=new THREE.UV(a/this.segmentsR,b/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,b/this.segmentsT),j=new THREE.UV((a+1)/this.segmentsR,(b+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(b+1)/this.segmentsT);this.faces.push(new THREE.Face4(c,d,f,g));this.faceVertexUvs[0].push([e,i,j,k])}this.computeCentroids();this.computeFaceNormals();
this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;
THREE.PolyhedronGeometry=function(a,b,c,d){function f(a){var b=new THREE.Vertex(a.normalize());b.index=i.vertices.push(b)-1;var c=Math.atan2(a.z,-a.x)/2/Math.PI+0.5,a=Math.atan2(-a.y,Math.sqrt(a.x*a.x+a.z*a.z))/Math.PI+0.5;b.uv=new THREE.UV(c,a);return b}function g(a,b,c,d){d<1?(d=new THREE.Face3(a.index,b.index,c.index,[a.position.clone(),b.position.clone(),c.position.clone()]),d.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),d.normal=d.centroid.clone().normalize(),
i.faces.push(d),d=Math.atan2(d.centroid.z,-d.centroid.x),i.faceVertexUvs[0].push([h(a.uv,a.position,d),h(b.uv,b.position,d),h(c.uv,c.position,d)])):(d-=1,g(a,e(a,b),e(a,c),d),g(e(a,b),b,e(b,c),d),g(e(a,c),e(b,c),c,d),g(e(a,b),e(b,c),e(a,c),d))}function e(a,b){q[a.index]||(q[a.index]=[]);q[b.index]||(q[b.index]=[]);var c=q[a.index][b.index];c===void 0&&(q[a.index][b.index]=q[b.index][a.index]=c=f((new THREE.Vector3).add(a.position,b.position).divideScalar(2)));return c}function h(a,b,c){c<0&&a.u===
1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);for(var c=c||1,d=d||0,i=this,j=0,k=a.length;j<k;j++)f(new THREE.Vector3(a[j][0],a[j][1],a[j][2]));for(var q=[],a=this.vertices,j=0,k=b.length;j<k;j++)g(a[b[j][0]],a[b[j][1]],a[b[j][2]],d);this.mergeVertices();j=0;for(k=this.vertices.length;j<k;j++)this.vertices[j].position.multiplyScalar(c);this.boundingSphere={radius:c}};THREE.PolyhedronGeometry.prototype=new THREE.Geometry;
THREE.PolyhedronGeometry.prototype.constructor=THREE.PolyhedronGeometry;THREE.IcosahedronGeometry=function(a,b){var c=(1+Math.sqrt(5))/2;THREE.PolyhedronGeometry.call(this,[[-1,c,0],[1,c,0],[-1,-c,0],[1,-c,0],[0,-1,c],[0,1,c],[0,-1,-c],[0,1,-c],[c,0,-1],[c,0,1],[-c,0,-1],[-c,0,1]],[[0,11,5],[0,5,1],[0,1,7],[0,7,10],[0,10,11],[1,5,9],[5,11,4],[11,10,2],[10,7,6],[7,1,8],[3,9,4],[3,4,2],[3,2,6],[3,6,8],[3,8,9],[4,9,5],[2,4,11],[6,2,10],[8,6,7],[9,8,1]],a,b)};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;
THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;THREE.OctahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],[[0,2,4],[0,4,3],[0,3,5],[0,5,2],[1,2,5],[1,5,3],[1,3,4],[1,4,2]],a,b)};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
THREE.TetrahedronGeometry=function(a,b){THREE.PolyhedronGeometry.call(this,[[1,1,1],[-1,-1,1],[-1,1,-1],[1,-1,-1]],[[2,1,0],[0,3,2],[1,3,0],[2,3,1]],a,b)};THREE.TetrahedronGeometry.prototype=new THREE.Geometry;THREE.TetrahedronGeometry.prototype.constructor=THREE.TetrahedronGeometry;
THREE.AxisHelper=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var b=new THREE.CylinderGeometry(0,5,25,5,1),c;c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));
this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.AxisHelper.prototype=new THREE.Object3D;THREE.AxisHelper.prototype.constructor=THREE.AxisHelper;
THREE.CameraHelper=function(a){function b(a,b,d){c(a,d);c(b,d)}function c(a,b){d.lineGeometry.vertices.push(new THREE.Vertex(new THREE.Vector3));d.lineGeometry.colors.push(new THREE.Color(b));d.pointMap[a]===void 0&&(d.pointMap[a]=[]);d.pointMap[a].push(d.lineGeometry.vertices.length-1)}THREE.Object3D.call(this);var d=this;this.lineGeometry=new THREE.Geometry;this.lineMaterial=new THREE.LineBasicMaterial({color:16777215,vertexColors:THREE.FaceColors});this.pointMap={};b("n1","n2",16755200);b("n2",
"n4",16755200);b("n4","n3",16755200);b("n3","n1",16755200);b("f1","f2",16755200);b("f2","f4",16755200);b("f4","f3",16755200);b("f3","f1",16755200);b("n1","f1",16755200);b("n2","f2",16755200);b("n3","f3",16755200);b("n4","f4",16755200);b("p","n1",16711680);b("p","n2",16711680);b("p","n3",16711680);b("p","n4",16711680);b("u1","u2",43775);b("u2","u3",43775);b("u3","u1",43775);b("c","t",16777215);b("p","c",3355443);b("cn1","cn2",3355443);b("cn3","cn4",3355443);b("cf1","cf2",3355443);b("cf3","cf4",3355443);
this.update(a);this.lines=new THREE.Line(this.lineGeometry,this.lineMaterial,THREE.LinePieces);this.add(this.lines)};THREE.CameraHelper.prototype=new THREE.Object3D;THREE.CameraHelper.prototype.constructor=THREE.CameraHelper;
THREE.CameraHelper.prototype.update=function(a){function b(a,b,g,e){THREE.CameraHelper.__v.set(b,g,e);THREE.CameraHelper.__projector.unprojectVector(THREE.CameraHelper.__v,THREE.CameraHelper.__c);a=c.pointMap[a];if(a!==void 0){b=0;for(g=a.length;b<g;b++)c.lineGeometry.vertices[a[b]].position.copy(THREE.CameraHelper.__v)}}var c=this;THREE.CameraHelper.__c.projectionMatrix.copy(a.projectionMatrix);b("c",0,0,-1);b("t",0,0,1);b("n1",-1,-1,-1);b("n2",1,-1,-1);b("n3",-1,1,-1);b("n4",1,1,-1);b("f1",-1,-1,
1);b("f2",1,-1,1);b("f3",-1,1,1);b("f4",1,1,1);b("u1",0.7,1.1,-1);b("u2",-0.7,1.1,-1);b("u3",0,2,-1);b("cf1",-1,0,1);b("cf2",1,0,1);b("cf3",0,-1,1);b("cf4",0,1,1);b("cn1",-1,0,-1);b("cn2",1,0,-1);b("cn3",0,-1,-1);b("cn4",0,1,-1);this.lineGeometry.__dirtyVertices=!0};THREE.CameraHelper.__projector=new THREE.Projector;THREE.CameraHelper.__v=new THREE.Vector3;THREE.CameraHelper.__c=new THREE.Camera;
THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var b=this.subdivisions;b-- >0;)this.smooth(a)};
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(e.useOldVertexColors){j.vertexColors=[];for(var k,m,q,o=0;o<4;o++){q=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var p=0;p<q.length;p++)m=h.vertexColors[q[p]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=q.length;k.g/=q.length;k.b/=q.length;j.vertexColors[o]=k}}f.push(j);(!e.supportUVs||n.length!=0)&&g.push([n[a],n[b],n[c],n[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
b)}var d=[],f=[],g=[],e=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},q={},n=[],o,s,m,p,r,t=a.faceVertexUvs[0];for(o=0,s=t.length;o<s;o++)for(m=0,p=t[o].length;m<p;m++)r=d[o]["abcd".charAt(m)],n[r]||(n[r]=t[o][m]);var v;for(o=0,s=d.length;o<s;o++)if(r=d[o],j.push(r.centroid),i.push(new THREE.Vertex(r.centroid)),e.supportUVs&&n.length!=0){v=new THREE.UV;if(r instanceof THREE.Face3)v.u=n[r.a].u+n[r.b].u+n[r.c].u,v.v=n[r.a].v+n[r.b].v+n[r.c].v,v.u/=3,v.v/=3;else if(r instanceof THREE.Face4)v.u=
n[r.a].u+n[r.b].u+n[r.c].u+n[r.d].u,v.v=n[r.a].v+n[r.b].v+n[r.c].v+n[r.d].v,v.u/=4,v.v/=4;n.push(v)}s=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].push(d)}var d,e,f,g,h={};for(d=0,e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var u=0,t=h.length,w,y,F={},D={},G=function(a,
b){F[a]===void 0&&(F[a]=[]);F[a].push(b)},I=function(a,b){D[a]===void 0&&(D[a]={});D[a][b]=null};for(o in s){v=s[o];w=o.split("_");y=w[0];w=w[1];G(y,[y,w]);G(w,[y,w]);for(m=0,p=v.length;m<p;m++)r=v[m],I(y,r,o),I(w,r,o);v.length<2&&(q[o]=!0)}for(o in s)if(v=s[o],r=v[0],v=v[1],w=o.split("_"),y=w[0],w=w[1],p=new THREE.Vector3,q[o]?(p.addSelf(h[y].position),p.addSelf(h[w].position),p.multiplyScalar(0.5)):(p.addSelf(j[r]),p.addSelf(j[v]),p.addSelf(h[y].position),p.addSelf(h[w].position),p.multiplyScalar(0.25)),
k[o]=t+d.length+u,i.push(new THREE.Vertex(p)),u++,e.supportUVs&&n.length!=0)v=new THREE.UV,v.u=n[y].u+n[w].u,v.v=n[y].v+n[w].v,v.u/=2,v.v/=2,n.push(v);var K,Q;w=["123","12","2","23"];p=["123","23","3","31"];var G=["123","31","1","12"],I=["1234","12","2","23"],N=["1234","23","3","34"],B=["1234","34","4","41"],O=["1234","41","1","12"];for(o=0,s=j.length;o<s;o++)r=d[o],v=t+o,r instanceof THREE.Face3?(u=c(r.a,r.b),y=c(r.b,r.c),K=c(r.c,r.a),b(v,k[u],r.b,k[y],r,w),b(v,k[y],r.c,k[K],r,p),b(v,k[K],r.a,k[u],
r,G)):r instanceof THREE.Face4?(u=c(r.a,r.b),y=c(r.b,r.c),K=c(r.c,r.d),Q=c(r.d,r.a),b(v,k[u],r.b,k[y],r,I),b(v,k[y],r.c,k[K],r,N),b(v,k[K],r.d,k[Q],r,B),b(v,k[Q],r.a,k[u],r,O)):console.log("face should be a face!",r);d=i;i=new THREE.Vector3;k=new THREE.Vector3;for(o=0,s=h.length;o<s;o++)if(F[o]!==void 0){i.set(0,0,0);k.set(0,0,0);r=new THREE.Vector3(0,0,0);v=0;for(m in D[o])i.addSelf(j[m]),v++;u=0;t=F[o].length;for(m=0;m<t;m++)q[c(F[o][m][0],F[o][m][1])]&&u++;if(u!=2){i.divideScalar(v);for(m=0;m<
t;m++)v=F[o][m],v=h[v[0]].position.clone().addSelf(h[v[1]].position).divideScalar(2),k.addSelf(v);k.divideScalar(t);r.addSelf(h[o].position);r.multiplyScalar(t-3);r.addSelf(i);r.addSelf(k.multiplyScalar(2));r.divideScalar(t);d[o].position=r}}a.vertices=d;a.faces=f;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
THREE.Loader.prototype={constructor:THREE.Loader,crossOrigin:"anonymous",addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+
"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlBase:function(a){a=a.split("/");a.pop();return(a.length<1?".":a.join("/"))+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;
return Math.floor(a)==a}function d(a){a=Math.log(a)/Math.LN2;return Math.pow(2,Math.round(a))}function f(a,b){var e=new Image;e.onload=function(){if(!c(this.width)||!c(this.height)){var b=d(this.width),e=d(this.height);a.image.width=b;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,b,e)}else a.image=this;a.needsUpdate=!0};e.crossOrigin=h.crossOrigin;e.src=b}function g(a,c,d,e,g,h){var i=document.createElement("canvas");a[c]=new THREE.Texture(i);a[c].sourceFile=d;if(e){a[c].repeat.set(e[0],
e[1]);if(e[0]!=1)a[c].wrapS=THREE.RepeatWrapping;if(e[1]!=1)a[c].wrapT=THREE.RepeatWrapping}g&&a[c].offset.set(g[0],g[1]);if(h){e={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(e[h[0]]!==void 0)a[c].wrapS=e[h[0]];if(e[h[1]]!==void 0)a[c].wrapT=e[h[1]]}f(a[c],b+"/"+d)}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h=this,i="MeshLambertMaterial",j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?
i="MeshPhongMaterial":a.shading=="Basic"&&(i="MeshBasicMaterial"));if(a.blending)if(a.blending=="Additive")j.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")j.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")j.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)j.transparent=a.transparent;if(a.depthTest!==void 0)j.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(a.vertexColors)j.vertexColors=
THREE.VertexColors;if(a.colorDiffuse)j.color=e(a.colorDiffuse);else if(a.DbgColor)j.color=a.DbgColor;if(a.colorSpecular)j.specular=e(a.colorSpecular);if(a.colorAmbient)j.ambient=e(a.colorAmbient);if(a.transparency)j.opacity=a.transparency;if(a.specularCoef)j.shininess=a.specularCoef;a.mapDiffuse&&b&&g(j,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&b&&g(j,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&b&&g(j,"normalMap",
a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);a.mapSpecular&&b&&g(j,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var i=THREE.ShaderUtils.lib.normal,k=THREE.UniformsUtils.clone(i.uniforms);k.tNormal.texture=j.normalMap;if(a.mapNormalFactor)k.uNormalScale.value=a.mapNormalFactor;if(j.map)k.tDiffuse.texture=j.map,k.enableDiffuse.value=!0;if(j.specularMap)k.tSpecular.texture=j.specularMap,k.enableSpecular.value=!0;if(j.lightMap)k.tAO.texture=
j.lightMap,k.enableAO.value=!0;k.uDiffuseColor.value.setHex(j.color);k.uSpecularColor.value.setHex(j.specular);k.uAmbientColor.value.setHex(j.ambient);k.uShininess.value=j.shininess;if(j.opacity!==void 0)k.uOpacity.value=j.opacity;j=new THREE.ShaderMaterial({fragmentShader:i.fragmentShader,vertexShader:i.vertexShader,uniforms:k,lights:!0,fog:!0})}else j=new THREE[i](j);if(a.DbgName!==void 0)j.name=a.DbgName;return j}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;THREE.BinaryLoader.prototype.load=function(a,b,c,d){var c=c?c:this.extractUrlBase(a),d=d?d:this.extractUrlBase(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;this.onLoadStart();this.loadAjaxJSON(this,a,b,c,d,f)};
THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,b,c,d,f,g){var e=new XMLHttpRequest;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0){var h=JSON.parse(e.responseText);a.loadAjaxBuffers(h,c,f,d,g)}else console.error("THREE.BinaryLoader: Couldn't load ["+b+"] ["+e.status+"]")};e.open("GET",b,!0);e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,b,c,d,f){var g=new XMLHttpRequest,e=c+"/"+a.buffers,h=0;g.onreadystatechange=function(){g.readyState==4?g.status==200||g.status==0?THREE.BinaryLoader.prototype.createBinModel(g.response,b,d,a.materials):console.error("THREE.BinaryLoader: Couldn't load ["+e+"] ["+g.status+"]"):g.readyState==3?f&&(h==0&&(h=g.getResponseHeader("Content-Length")),f({total:h,loaded:g.responseText.length})):g.readyState==2&&(h=g.getResponseHeader("Content-Length"))};
g.open("GET",e,!0);g.responseType="arraybuffer";g.send(null)};
THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var f=function(b){var c,f,i,j,k,q,n,o,s,m,p,r,t,v,u;function w(a){return a%4?4-a%4:0}function y(a,b){return(new Uint8Array(a,b,1))[0]}function F(a,b){return(new Uint32Array(a,b,1))[0]}function D(b,c){var d,e,f,g,h,i,j,k,l=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=l[d*3];f=l[d*3+1];g=l[d*3+2];h=A[e*2];e=A[e*2+1];i=A[f*2];j=A[f*2+1];f=A[g*2];k=A[g*2+1];g=B.faceVertexUvs[0];var m=[];m.push(new THREE.UV(h,e));m.push(new THREE.UV(i,j));m.push(new THREE.UV(f,
k));g.push(m)}}function G(b,c){var d,e,f,g,h,i,j,k,l,m,n=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=n[d*4];f=n[d*4+1];g=n[d*4+2];h=n[d*4+3];i=A[e*2];e=A[e*2+1];j=A[f*2];l=A[f*2+1];k=A[g*2];m=A[g*2+1];g=A[h*2];f=A[h*2+1];h=B.faceVertexUvs[0];var o=[];o.push(new THREE.UV(i,e));o.push(new THREE.UV(j,l));o.push(new THREE.UV(k,m));o.push(new THREE.UV(g,f));h.push(o)}}function I(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],
B.faces.push(new THREE.Face3(e,f,g,null,null,h))}function K(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=j[d],B.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function Q(b,c,d,e){for(var f,g,h,i,j,k,l,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),m=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];j=d[e*3];k=d[e*3+1];l=d[e*3+2];i=m[e];var n=S[k*3],o=S[k*3+1];k=S[k*3+2];var q=S[l*3],p=
S[l*3+1];l=S[l*3+2];B.faces.push(new THREE.Face3(f,g,h,[new THREE.Vector3(S[j*3],S[j*3+1],S[j*3+2]),new THREE.Vector3(n,o,k),new THREE.Vector3(q,p,l)],null,i))}}function N(b,c,d,e){for(var f,g,h,i,j,k,l,m,n,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];l=d[e*4+1];m=d[e*4+2];n=d[e*4+3];j=o[e];var q=S[l*3],p=S[l*3+1];l=S[l*3+2];var r=S[m*3],s=S[m*3+1];m=S[m*3+2];var t=S[n*3],u=S[n*3+1];n=S[n*3+2];B.faces.push(new THREE.Face4(f,
g,h,i,[new THREE.Vector3(S[k*3],S[k*3+1],S[k*3+2]),new THREE.Vector3(q,p,l),new THREE.Vector3(r,s,m),new THREE.Vector3(t,u,n)],null,j))}}var B=this,O=0,S=[],A=[],l,V,E;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(B,d,b);(function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d})(a,O,12);c=y(a,O+12);y(a,O+13);y(a,O+14);y(a,O+15);f=y(a,O+16);i=y(a,O+17);j=y(a,O+18);k=y(a,O+19);q=F(a,O+20);n=F(a,O+20+4);o=F(a,O+20+8);b=F(a,O+20+12);s=
F(a,O+20+16);m=F(a,O+20+20);p=F(a,O+20+24);r=F(a,O+20+28);t=F(a,O+20+32);v=F(a,O+20+36);u=F(a,O+20+40);O+=c;c=f*3+k;E=f*4+k;l=b*c;V=s*(c+i*3);f=m*(c+j*3);k=p*(c+i*3+j*3);c=r*E;i=t*(E+i*4);j=v*(E+j*4);O+=function(b){var b=new Float32Array(a,b,q*3),c,d,e,f;for(c=0;c<q;c++)d=b[c*3],e=b[c*3+1],f=b[c*3+2],B.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,f)));return q*3*Float32Array.BYTES_PER_ELEMENT}(O);O+=function(b){if(n){var b=new Int8Array(a,b,n*3),c,d,e,f;for(c=0;c<n;c++)d=b[c*3],e=b[c*3+1],
f=b[c*3+2],S.push(d/127,e/127,f/127)}return n*3*Int8Array.BYTES_PER_ELEMENT}(O);O+=w(n*3);O+=function(b){if(o){var b=new Float32Array(a,b,o*2),c,d,e;for(c=0;c<o;c++)d=b[c*2],e=b[c*2+1],A.push(d,e)}return o*2*Float32Array.BYTES_PER_ELEMENT}(O);l=O+l+w(b*2);V=l+V+w(s*2);f=V+f+w(m*2);k=f+k+w(p*2);c=k+c+w(r*2);i=c+i+w(t*2);j=i+j+w(v*2);(function(a){if(m){var b=a+m*Uint32Array.BYTES_PER_ELEMENT*3;I(m,a,b+m*Uint32Array.BYTES_PER_ELEMENT*3);D(m,b)}})(V);(function(a){if(p){var b=a+p*Uint32Array.BYTES_PER_ELEMENT*
3,c=b+p*Uint32Array.BYTES_PER_ELEMENT*3;Q(p,a,b,c+p*Uint32Array.BYTES_PER_ELEMENT*3);D(p,c)}})(f);(function(a){if(v){var b=a+v*Uint32Array.BYTES_PER_ELEMENT*4;K(v,a,b+v*Uint32Array.BYTES_PER_ELEMENT*4);G(v,b)}})(i);(function(a){if(u){var b=a+u*Uint32Array.BYTES_PER_ELEMENT*4,c=b+u*Uint32Array.BYTES_PER_ELEMENT*4;N(u,a,b,c+u*Uint32Array.BYTES_PER_ELEMENT*4);G(u,c)}})(j);b&&I(b,O,O+b*Uint32Array.BYTES_PER_ELEMENT*3);(function(a){if(s){var b=a+s*Uint32Array.BYTES_PER_ELEMENT*3;Q(s,a,b,b+s*Uint32Array.BYTES_PER_ELEMENT*
3)}})(l);r&&K(r,k,k+r*Uint32Array.BYTES_PER_ELEMENT*4);(function(a){if(t){var b=a+t*Uint32Array.BYTES_PER_ELEMENT*4;N(t,a,b,b+t*Uint32Array.BYTES_PER_ELEMENT*4)}})(c);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))};
THREE.ColladaLoader=function(){function a(a,d,f){U=a;d=d||oa;f!==void 0&&(a=f.split("/"),a.pop(),wa=(a.length<1?".":a.join("/"))+"/");if((a=U.evaluate("//dae:asset",U,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&a.childNodes)for(f=0;f<a.childNodes.length;f++){var i=a.childNodes[f];switch(i.nodeName){case "unit":(i=i.getAttribute("meter"))&&parseFloat(i);break;case "up_axis":ua=i.textContent.charAt(0)}}if(!ta.convertUpAxis||ua===ta.upAxis)Ba=null;else switch(ua){case "X":Ba=ta.upAxis===
"Y"?"XtoY":"XtoZ";break;case "Y":Ba=ta.upAxis==="X"?"YtoX":"YtoZ";break;case "Z":Ba=ta.upAxis==="X"?"ZtoX":"ZtoY"}ra=b("//dae:library_images/dae:image",e,"image");Ea=b("//dae:library_materials/dae:material",D,"material");Aa=b("//dae:library_effects/dae:effect",N,"effect");ka=b("//dae:library_geometries/dae:geometry",p,"geometry");ya=b(".//dae:library_cameras/dae:camera",V,"camera");ha=b("//dae:library_controllers/dae:controller",h,"controller");qa=b("//dae:library_animations/dae:animation",O,"animation");
za=b(".//dae:library_visual_scenes/dae:visual_scene",k,"visual_scene");sa=[];na=[];(a=U.evaluate(".//dae:scene/dae:instance_visual_scene",U,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),$=za[a.length>0?a:"visual_scene0"]):$=null;Y=new THREE.Object3D;for(a=0;a<$.nodes.length;a++)Y.add(g($.nodes[a]));xa=[];c(Y);a={scene:Y,morphs:sa,skins:na,animations:xa,dae:{images:ra,materials:Ea,cameras:ya,effects:Aa,geometries:ka,controllers:ha,animations:qa,
visualScenes:za,scene:$}};d&&d(a);return a}function b(a,b,c){for(var a=U.evaluate(a,U,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(!e.id||e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function c(a){var b=$.getChildById(a.name,!0),d=null;if(b&&b.keys){d={fps:60,hierarchy:[{node:b,keys:b.keys,sids:b.sids}],node:a,name:"animation_"+a.name,length:0};xa.push(d);for(var e=0,f=b.keys.length;e<f;e++)d.length=Math.max(d.length,b.keys[e].time)}else d=
{hierarchy:[{keys:[],sids:[]}]};e=0;for(f=a.children.length;e<f;e++)for(var b=0,g=c(a.children[e]).hierarchy.length;b<g;b++)d.hierarchy.push({keys:[],sids:[]});return d}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function f(a,b,c){var e,f=ha[b.url];if(!f||
!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var c=1E6,g=-c,h=0;for(e in qa)for(var i=qa[e],j=0;j<i.sampler.length;j++){var k=i.sampler[j];k.create();c=Math.min(c,k.startTime);g=Math.max(g,k.endTime);h=Math.max(h,k.input.length)}e=h;for(var b=$.getChildById(b.skeleton[0],!0)||$.getChildBySid(b.skeleton[0],!0),l,m,g=new THREE.Vector3,n,j=0;j<a.vertices.length;j++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[j].position);
for(c=0;c<e;c++){h=[];i=[];for(j=0;j<a.vertices.length;j++)i.push(new THREE.Vertex(new THREE.Vector3));d(b,h,c);j=h;k=f.skin;for(m=0;m<j.length;m++)if(l=j[m],n=-1,l.type=="JOINT"){for(var o=0;o<k.joints.length;o++)if(l.sid==k.joints[o]){n=o;break}if(n>=0){o=k.invBindMatrices[n];l.invBindMatrix=o;l.skinningMatrix=new THREE.Matrix4;l.skinningMatrix.multiply(l.world,o);l.weights=[];for(o=0;o<k.weights.length;o++)for(var q=0;q<k.weights[o].length;q++){var p=k.weights[o][q];p.joint==n&&l.weights.push(p)}}else throw"ColladaLoader: Could not find joint '"+
l.sid+"'.";}for(j=0;j<h.length;j++)if(h[j].type=="JOINT")for(k=0;k<h[j].weights.length;k++)l=h[j].weights[k],m=l.index,l=l.weight,n=a.vertices[m],m=i[m],g.x=n.position.x,g.y=n.position.y,g.z=n.position.z,h[j].skinningMatrix.multiplyVector3(g),m.position.x+=g.x*l,m.position.y+=g.y*l,m.position.z+=g.z*l;a.morphTargets.push({name:"target_"+c,vertices:i})}}}function g(a){var b=new THREE.Object3D,c,d,e,h;for(e=0;e<a.controllers.length;e++){var i=ha[a.controllers[e].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
new m;j.url=i.skin.source;j.instance_material=a.controllers[e].instance_material;a.geometries.push(j);c=a.controllers[e]}else if(ha[i.skin.source]&&(d=i=ha[i.skin.source],i.morph&&ka[i.morph.source]))j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new m,j.url=i.morph.source,j.instance_material=a.controllers[e].instance_material,a.geometries.push(j),d=a.controllers[e];console.log("ColladaLoader: Morph-controller partially supported.")}}for(e=
0;e<a.geometries.length;e++){var i=a.geometries[e],j=i.instance_material,i=ka[i.url],k={},l=[],n=0,q;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){q=j[h];var p=Ea[q.target],r=Aa[p.instance_effect.url].shader;r.material.opacity=!r.material.opacity?1:r.material.opacity;k[q.symbol]=n;l.push(r.material);q=r.material;q.name=p.name==null||p.name===""?p.id:p.name;n++}j=q||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;
if(n>1){j=new THREE.MeshFaceMaterial;i.materials=l;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materialIndex=k[l.daeMaterial]}if(c!==void 0)f(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=ha[c.url],j.skinInstanceController=c,j.name="skin_"+na.length,na.push(j);else if(d!==void 0){h=i;k=d instanceof o?ha[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(n=ka[k.targets[l]],n.mesh&&n.mesh.primitives&&
n.mesh.primitives.length)n=n.mesh.primitives[0].geometry,n.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:n.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+sa.length;sa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}for(e=0;e<a.cameras.length;e++)b=ya[a.cameras[e].url],b=new THREE.PerspectiveCamera(b.fov,b.aspect_ratio,b.znear,b.zfar);b.name=a.id||"";b.matrix=a.matrix;
e=a.matrix.decompose();b.position=e[0];b.quaternion=e[1];b.useQuaternion=!0;b.scale=e[2];ta.centerGeometry&&b.geometry&&(e=THREE.GeometryUtils.center(b.geometry),b.quaternion.multiplyVector3(e.multiplySelf(b.scale)),b.position.subSelf(e));for(e=0;e<a.nodes.length;e++)b.add(g(a.nodes[e],a));return b}function e(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function j(){this.source=
"";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function q(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function n(){this.type=this.sid="";this.data=[];this.obj=null}function o(){this.url="";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function m(){this.url=
"";this.instance_material=[]}function p(){this.id="";this.mesh=null}function r(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function t(){}function v(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function u(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function y(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function D(){this.name=
this.id="";this.instance_effect=null}function G(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texOpts=this.texcoord=this.texture=null}function I(a,b){this.type=a;this.effect=b;this.material=null}function K(a){this.effect=a;this.format=this.init_from=null}function Q(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function N(){this.name=this.id="";this.sampler=this.surface=this.shader=
null}function B(){this.url=""}function O(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function S(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=this.fullSid=null}function A(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.strideOut=this.output=this.input=null;this.duration=0}function l(a){this.targets=[];this.time=a}function V(){this.name=this.id=""}function E(){this.url=
""}function z(a){return a=="dae"?"http://www.collada.org/2005/11/COLLADASchema":null}function T(a){for(var a=M(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseFloat(a[c]));return b}function W(a){for(var a=M(a),b=[],c=0,d=a.length;c<d;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.length>0?a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/):[]}function ma(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(ta.convertUpAxis&&ua!==ta.upAxis)switch(Ba){case "XtoY":var c=
a[0];a[0]=b*a[1];a[1]=c;break;case "XtoZ":c=a[2];a[2]=a[1];a[1]=a[0];a[0]=c;break;case "YtoX":c=a[0];a[0]=a[1];a[1]=b*c;break;case "YtoZ":c=a[1];a[1]=b*a[2];a[2]=c;break;case "ZtoX":c=a[0];a[0]=a[1];a[1]=a[2];a[2]=c;break;case "ZtoY":c=a[1],a[1]=a[2],a[2]=b*c}}function Z(a,b){var c=[a[b],a[b+1],a[b+2]];aa(c,-1);return new THREE.Vector3(c[0],c[1],c[2])}function X(a){if(ta.convertUpAxis){var b=[a[0],a[4],a[8]];aa(b,-1);a[0]=b[0];a[4]=b[1];a[8]=b[2];b=[a[1],a[5],a[9]];aa(b,-1);a[1]=b[0];a[5]=b[1];a[9]=
b[2];b=[a[2],a[6],a[10]];aa(b,-1);a[2]=b[0];a[6]=b[1];a[10]=b[2];b=[a[0],a[1],a[2]];aa(b,-1);a[0]=b[0];a[1]=b[1];a[2]=b[2];b=[a[4],a[5],a[6]];aa(b,-1);a[4]=b[0];a[5]=b[1];a[6]=b[2];b=[a[8],a[9],a[10]];aa(b,-1);a[8]=b[0];a[9]=b[1];a[10]=b[2];b=[a[3],a[7],a[11]];aa(b,-1);a[3]=b[0];a[7]=b[1];a[11]=b[2]}return new THREE.Matrix4(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])}var U=null,Y=null,$,oa=null,ga={},ra={},qa={},ha={},ka={},Ea={},Aa={},ya={},xa,za,wa,sa,
na,ja=THREE.SmoothShading,ta={centerGeometry:!1,convertUpAxis:!1,subdivideFaces:!0,upAxis:"Y"},ua="Y",Ba=null,Ga=Math.PI/180;e.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=
(new j).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new F).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=
c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new y).parse(d))}}return b};j.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=
a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=T(f.textContent);this.bindShapeMatrix=X(f);break;case "source":f=(new F).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};j.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new y).parse(d),e=b[d.source];
if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};j.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new y).parse(g));break;case "v":c=W(g.textContent);break;case "vcount":d=W(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=
n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");
this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new q).parse(c))}}return this};q.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,
""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};q.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};q.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};q.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==
a)return this.transforms[b];return null};q.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.cameras=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new q).parse(b));
break;case "instance_camera":this.cameras.push((new E).parse(b));break;case "instance_controller":this.controllers.push((new o).parse(b));break;case "instance_geometry":this.geometries.push((new m).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=U.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",U,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new q).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new n).parse(b));
break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in qa)for(var e=qa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=[];a=[];c=0;for(e=this.channels.length;c<e;c++){b=this.channels[c];f=b.fullSid;g=b.member;if(ta.convertUpAxis)switch(g){case "X":switch(Ba){case "XtoY":case "XtoZ":case "YtoX":g=
"Y";break;case "ZtoX":g="Z"}break;case "Y":switch(Ba){case "XtoY":case "YtoX":case "ZtoX":g="X";break;case "XtoZ":case "YtoZ":case "ZtoY":g="Z"}break;case "Z":switch(Ba){case "XtoZ":g="X";break;case "YtoZ":case "ZtoX":case "ZtoY":g="Y"}}var h=b.sampler,i=h.input,j=this.getTransformBySid(b.sid);if(j){a.indexOf(f)===-1&&a.push(f);b=0;for(var k=i.length;b<k;b++){var p=i[b],r=h.getData(j.type,b),s;s=null;for(var t=0,u=d.length;t<u&&s==null;t++){var v=d[t];if(v.time===p)s=v;else if(v.time>p)break}if(!s){s=
new l(p);t=-1;u=0;for(v=d.length;u<v&&t==-1;u++)d[u].time>=p&&(t=u);p=t;d.splice(p==-1?d.length:p,0,s)}s.addTarget(f,j,g,r)}}else console.log('Could not find transform "'+b.sid+'" in node '+this.id)}for(c=0;c<a.length;c++){e=a[c];for(b=0;b<d.length;b++)if(s=d[b],!s.hasTarget(e)){h=d;f=s;j=b;g=e;i=void 0;a:{i=j?j-1:0;for(i=i>=0?i:i+h.length;i>=0;i--)if(k=h[i],k.hasTarget(g)){i=k;break a}i=null}k=void 0;a:{for(j+=1;j<h.length;j++)if(k=h[j],k.hasTarget(g))break a;k=null}if(i&&k){h=(f.time-i.time)/(k.time-
i.time);i=i.getTarget(g);j=k.getTarget(g).data;k=i.data;r=void 0;if(k.length){r=[];for(p=0;p<k.length;++p)r[p]=k[p]+(j[p]-k[p])*h}else r=k+(j-k)*h;f.addTarget(g,i.transform,i.member,r)}}}this.keys=d;this.sids=a}this.updateMatrix();return this};q.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(this.matrix)};n.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=T(a.textContent);this.convert();
return this};n.prototype.convert=function(){switch(this.type){case "matrix":this.obj=X(this.data);break;case "rotate":this.angle=this.data[3]*Ga;case "translate":aa(this.data,-1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;case "scale":aa(this.data,1);this.obj=new THREE.Vector3(this.data[0],this.data[1],this.data[2]);break;default:console.log("Can not convert Transform of type "+this.type)}};n.prototype.apply=function(a){switch(this.type){case "matrix":a.multiplySelf(this.obj);
break;case "translate":a.translate(this.obj);break;case "rotate":a.rotateByAxis(this.obj,this.angle);break;case "scale":a.scale(this.obj)}};n.prototype.update=function(a,b){switch(this.type){case "matrix":console.log("Currently not handling matrix transform updates");break;case "translate":case "scale":switch(b){case "X":this.obj.x=a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2]}break;case "rotate":switch(b){case "X":this.obj.x=
a;break;case "Y":this.obj.y=a;break;case "Z":this.obj.z=a;break;case "ANGLE":this.angle=a*Ga;break;default:this.obj.x=a[0],this.obj.y=a[1],this.obj.z=a[2],this.angle=a[3]*Ga}}};o.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=U.evaluate(".//dae:instance_material",
c,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=
U.evaluate(".//dae:instance_material",c,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};p.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new r(this)).parse(c)}}return this};r.prototype.parse=function(a){this.primitives=[];var b;for(b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
switch(c.nodeName){case "source":var d=c.getAttribute("id");ga[d]==void 0&&(ga[d]=(new F(d)).parse(c));break;case "vertices":this.vertices=(new w).parse(c);break;case "triangles":this.primitives.push((new v).parse(c));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new t).parse(c))}}this.geometry3js=new THREE.Geometry;a=ga[this.vertices.input.POSITION.source].data;for(b=0;b<a.length;b+=3)this.geometry3js.vertices.push(new THREE.Vertex(Z(a,
b)));for(b=0;b<this.primitives.length;b++)a=this.primitives[b],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.calcNormals&&(this.geometry3js.computeVertexNormals(),delete this.geometry3js.calcNormals);this.geometry3js.computeBoundingBox();return this};r.prototype.handlePrimitive=function(a,b){var c=0,d,e,f=a.p,g=a.inputs,h,i,j,k,l=0,m=3,n=0,o=[];for(d=0;d<g.length;d++){h=g[d];var q=h.offset+
1,n=n<q?q:n;switch(h.semantic){case "TEXCOORD":o.push(h.set)}}for(;c<f.length;){var p=[],r=[],q={},s=[];a.vcount&&(m=a.vcount[l++]);for(d=0;d<m;d++)for(e=0;e<g.length;e++)switch(h=g[e],k=ga[h.source],i=f[c+d*n+h.offset],j=k.accessor.params.length,j*=i,h.semantic){case "VERTEX":p.push(i);break;case "NORMAL":r.push(Z(k.data,j));break;case "TEXCOORD":q[h.set]===void 0&&(q[h.set]=[]);q[h.set].push(new THREE.UV(k.data[j],1-k.data[j+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(k.data[j],k.data[j+
1],k.data[j+2]))}e=null;d=[];if(r.length==0)if(h=this.vertices.input.NORMAL){k=ga[h.source];j=k.accessor.params.length;h=0;for(i=p.length;h<i;h++)r.push(Z(k.data,p[h]*j))}else b.calcNormals=!0;if(m===3)d.push(new THREE.Face3(p[0],p[1],p[2],r,s.length?s:new THREE.Color));else if(m===4)d.push(new THREE.Face4(p[0],p[1],p[2],p[3],r,s.length?s:new THREE.Color));else if(m>4&&ta.subdivideFaces){s=s.length?s:new THREE.Color;for(e=1;e<m-1;)d.push(new THREE.Face3(p[0],p[e],p[e+1],[r[0],r[e++],r[e]],s))}if(d.length){h=
0;for(i=d.length;h<i;h++){e=d[h];e.daeMaterial=a.material;b.faces.push(e);for(e=0;e<o.length;e++)p=q[o[e]],p=m>4?[p[0],p[h+1],p[h+2]]:m===4?[p[0],p[1],p[2],p[3]]:[p[0],p[1],p[2]],b.faceVertexUvs[e]||(b.faceVertexUvs[e]=[]),b.faceVertexUvs[e].push(p)}}else console.log("dropped face with vcount "+m+" for geometry with id: "+b.id);c+=n*m}};t.prototype=new v;t.prototype.constructor=t;v.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
a.input.POSITION.source};v.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ma(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new y).parse(a.childNodes[b]));break;case "vcount":this.vcount=W(c.textContent);break;case "p":this.p=W(c.textContent)}}return this};u.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ma(a,"count",0);this.stride=
ma(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new y).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};y.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
"");this.set=ma(a,"set",-1);this.offset=ma(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent),e=[],f=0,g=d.length;f<g;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=T(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
W(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new u).parse(c.childNodes[d]);break}}}return this};F.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
this.data.slice(b,b+16),c=X(c);a.push(c)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};D.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new B).parse(a.childNodes[b]);break}return this};G.prototype.isColor=function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=
null};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=T(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord"),this.texOpts={offsetU:0,offsetV:0,repeatU:1,repeatV:1,wrapU:1,wrapV:1},this.parseTexture(c)}}return this};G.prototype.parseTexture=function(a){if(!a.childNodes)return this;
a.childNodes[1]&&a.childNodes[1].nodeName==="extra"&&(a=a.childNodes[1],a.childNodes[1]&&a.childNodes[1].nodeName==="technique"&&(a=a.childNodes[1]));for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "offsetU":case "offsetV":case "repeatU":case "repeatV":this.texOpts[c.nodeName]=parseFloat(c.textContent);break;case "wrapU":case "wrapV":this.texOpts[c.nodeName]=parseInt(c.textContent);break;default:this.texOpts[c.nodeName]=c.textContent}}return this};I.prototype.parse=
function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=U.evaluate(".//dae:float",c,z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();
return this};I.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof G)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid){var e=ra[this.effect.surface.init_from];if(e)e=THREE.ImageUtils.loadTexture(wa+e.init_from),e.wrapS=d.texOpts.wrapU?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,
e.wrapT=d.texOpts.wrapV?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping,e.offset.x=d.texOpts.offsetU,e.offset.y=d.texOpts.offsetV,e.repeat.x=d.texOpts.repeatU,e.repeat.y=d.texOpts.repeatV,a.map=e}}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=ja;return this.material=new THREE.MeshLambertMaterial(a)};K.prototype.parse=function(a){for(var b=
0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};Q.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=
c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};N.prototype.create=function(){if(this.shader==null)return null};N.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
N.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new K(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new Q(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};N.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};N.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "constant":case "lambert":case "blinn":case "phong":this.shader=(new I(c.nodeName,this)).parse(c)}}};B.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};O.prototype.parse=function(a){this.id=
a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new A(this)).parse(c));break;case "channel":this.channel.push((new S(this)).parse(c))}}return this};S.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");
b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0;if(c)b=a.split("."),this.sid=b.shift(),this.member=b.shift();else if(d){b=a.split("(");this.sid=b.shift();for(var e=0;e<b.length;e++)b[e]=parseInt(b[e].replace(/\)/,""));this.arrIndices=b}else this.sid=a;this.fullSid=a;this.dotSyntax=c;this.arrSyntax=d;return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new y).parse(c))}}return this};
A.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();this.strideOut=c.accessor.stride;break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=
0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};A.prototype.getData=function(a,b){var c;if(this.strideOut>1){c=[];b*=this.strideOut;for(var d=0;d<this.strideOut;++d)c[d]=this.output[b+d];if(this.strideOut===3)switch(a){case "rotate":case "translate":aa(c,-1);break;case "scale":aa(c,1)}}else c=this.output[b];return c};l.prototype.addTarget=function(a,b,c,d){this.targets.push({sid:a,
member:c,transform:b,data:d})};l.prototype.apply=function(a){for(var b=0;b<this.targets.length;++b){var c=this.targets[b];(!a||c.sid===a)&&c.transform.update(c.data,c.member)}};l.prototype.getTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return this.targets[b];return null};l.prototype.hasTarget=function(a){for(var b=0;b<this.targets.length;++b)if(this.targets[b].sid===a)return!0;return!1};l.prototype.interpolate=function(a,b){for(var c=0;c<this.targets.length;++c){var d=
this.targets[c],e=a.getTarget(d.sid);if(e){var f=(b-this.time)/(a.time-this.time),g=e.data,h=d.data;if(f<0||f>1)console.log("Key.interpolate: Warning! Scale out of bounds:"+f),f=f<0?0:1;if(h.length)for(var e=[],i=0;i<h.length;++i)e[i]=h[i]+(g[i]-h[i])*f;else e=h+(g-h)*f}else e=d.data;d.transform.update(e,d.member)}};V.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "optics":this.parseOptics(c)}}return this};
V.prototype.parseOptics=function(a){for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="technique_common")for(var c=a.childNodes[b],d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="perspective")for(var e=c.childNodes[d],f=0;f<e.childNodes.length;f++){var g=e.childNodes[f];switch(g.nodeName){case "xfov":this.fov=g.textContent;break;case "znear":this.znear=0.4;break;case "zfar":this.zfar=1E15;break;case "aspect_ratio":this.aspect_ratio=g.textContent}}return this};E.prototype.parse=
function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};return{load:function(b,c,d){var e=0;if(document.implementation&&document.implementation.createDocument){var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4){if(f.status==0||f.status==200)f.responseXML?(oa=c,a(f.responseXML,void 0,b)):console.error("ColladaLoader: Empty or non-existing file ("+b+")")}else f.readyState==3&&d&&(e==0&&(e=f.getResponseHeader("Content-Length")),
d({total:e,loaded:f.responseText.length}))};f.open("GET",b,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){ja=a},applySkin:f,geometries:ka,options:ta}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
THREE.JSONLoader.prototype.load=function(a,b,c){c=c?c:this.extractUrlBase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,f){var g=new XMLHttpRequest,e=0;g.onreadystatechange=function(){if(g.readyState===g.DONE)if(g.status===200||g.status===0){if(g.responseText){var h=JSON.parse(g.responseText);a.createModel(h,c,d)}else console.warn("THREE.JSONLoader: ["+b+"] seems to be unreachable or file there is empty");a.onLoadComplete()}else console.error("THREE.JSONLoader: Couldn't load ["+b+"] ["+g.status+"]");else g.readyState===g.LOADING?f&&(e===0&&(e=g.getResponseHeader("Content-Length")),
f({total:e,loaded:g.responseText.length})):g.readyState===g.HEADERS_RECEIVED&&(e=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType&&g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,f=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){var c,f,i,j,k,q,n,o,s,m,p,r,t,v,u=a.faces;q=a.vertices;var w=a.normals,y=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=q.length;j<k;)n=new THREE.Vertex,n.position.x=q[j++]*b,n.position.y=q[j++]*b,n.position.z=q[j++]*b,d.vertices.push(n);j=0;for(k=u.length;j<k;){b=
u[j++];q=b&1;i=b&2;c=b&4;f=b&8;o=b&16;n=b&32;m=b&64;b&=128;q?(p=new THREE.Face4,p.a=u[j++],p.b=u[j++],p.c=u[j++],p.d=u[j++],q=4):(p=new THREE.Face3,p.a=u[j++],p.b=u[j++],p.c=u[j++],q=3);if(i)i=u[j++],p.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<F;c++)r=a.uvs[c],s=u[j++],v=r[s*2],s=r[s*2+1],d.faceUvs[c][i]=new THREE.UV(v,s);if(f)for(c=0;c<F;c++){r=a.uvs[c];t=[];for(f=0;f<q;f++)s=u[j++],v=r[s*2],s=r[s*2+1],t[f]=new THREE.UV(v,s);d.faceVertexUvs[c][i]=t}if(o)o=u[j++]*3,f=new THREE.Vector3,f.x=w[o++],
f.y=w[o++],f.z=w[o],p.normal=f;if(n)for(c=0;c<q;c++)o=u[j++]*3,f=new THREE.Vector3,f.x=w[o++],f.y=w[o++],f.z=w[o],p.vertexNormals.push(f);if(m)n=u[j++],n=new THREE.Color(y[n]),p.color=n;if(b)for(c=0;c<q;c++)n=u[j++],n=new THREE.Color(y[n]),p.vertexColors.push(n);d.faces.push(p)}})(f);(function(){var b,c,f,i;if(a.skinWeights)for(b=0,c=a.skinWeights.length;b<c;b+=2)f=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(f,i,0,0));if(a.skinIndices)for(b=0,c=a.skinIndices.length;b<
c;b+=2)f=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(f,i,0,0));d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,f,i,j,k,q,n,o,s;for(c=0,f=a.morphTargets.length;c<f;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];o=d.morphTargets[c].vertices;s=a.morphTargets[c].vertices;for(i=0,j=s.length;i<j;i+=3)k=s[i]*b,q=s[i+1]*b,n=s[i+2]*b,o.push(new THREE.Vertex(new THREE.Vector3(k,q,
n)))}}if(a.morphColors!==void 0)for(c=0,f=a.morphColors.length;c<f;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;for(b=0,i=k.length;b<i;b+=3)q=new THREE.Color(16755200),q.setRGB(k[b],k[b+1],k[b+2]),j.push(q)}})(f);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();b(d)};
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0){var f=JSON.parse(d.responseText);c.createScene(f,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.overrideMimeType&&d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function f(){var a;for(n in B.objects)if(!E.objects[n])if(r=B.objects[n],r.geometry!==void 0){if(I=E.geometries[r.geometry]){a=!1;K=E.materials[r.materials[0]];(a=K instanceof THREE.ShaderMaterial)&&I.computeTangents();u=r.position;w=r.rotation;y=r.quaternion;F=r.scale;y=0;r.materials.length==0&&(K=new THREE.MeshFaceMaterial);r.materials.length>1&&(K=new THREE.MeshFaceMaterial);a=new THREE.Mesh(I,
K);a.name=n;a.position.set(u[0],u[1],u[2]);y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]);a.scale.set(F[0],F[1],F[2]);a.visible=r.visible;E.scene.add(a);E.objects[n]=a;if(r.castsShadow){var b=new THREE.ShadowVolume(I);E.scene.add(b);b.position=a.position;b.rotation=a.rotation;b.scale=a.scale}r.trigger&&r.trigger.toLowerCase()!="none"&&(b={type:r.trigger,object:r},E.triggers[a.name]=b)}}else u=r.position,w=r.rotation,y=r.quaternion,F=r.scale,y=0,a=new THREE.Object3D,
a.name=n,a.position.set(u[0],u[1],u[2]),y?(a.quaternion.set(y[0],y[1],y[2],y[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(F[0],F[1],F[2]),a.visible=r.visible!==void 0?r.visible:!1,E.scene.add(a),E.objects[n]=a,E.empties[n]=a,r.trigger&&r.trigger.toLowerCase()!="none"&&(b={type:r.trigger,object:r},E.triggers[a.name]=b)}function g(a){return function(b){E.geometries[a]=b;f();S-=1;i.onLoadComplete();h()}}function e(a){return function(b){E.geometries[a]=b}}function h(){i.callbackProgress({totalModels:l,
totalTextures:V,loadedModels:l-S,loadedTextures:V-A},E);i.onLoadProgress();S==0&&A==0&&b(E)}var i=this,j=THREE.Loader.prototype.extractUrlBase(c),k,q,n,o,s,m,p,r,t,v,u,w,y,F,D,G,I,K,Q,N,B,O,S,A,l,V,E;B=a;c=new THREE.BinaryLoader;O=new THREE.JSONLoader;A=S=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};if(B.transform)a=B.transform.position,t=B.transform.rotation,D=B.transform.scale,a&&E.scene.position.set(a[0],a[1],
a[2]),t&&E.scene.rotation.set(t[0],t[1],t[2]),D&&E.scene.scale.set(D[0],D[1],D[2]),(a||t||D)&&E.scene.updateMatrix();a=function(){A-=1;h();i.onLoadComplete()};for(s in B.cameras)D=B.cameras[s],D.type=="perspective"?Q=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(Q=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),u=D.position,t=D.target,D=D.up,Q.position.set(u[0],u[1],u[2]),Q.target=new THREE.Vector3(t[0],t[1],t[2]),D&&Q.up.set(D[0],D[1],D[2]),
E.cameras[s]=Q;for(o in B.lights)t=B.lights[o],s=t.color!==void 0?t.color:16777215,Q=t.intensity!==void 0?t.intensity:1,t.type=="directional"?(u=t.direction,v=new THREE.DirectionalLight(s,Q),v.position.set(u[0],u[1],u[2]),v.position.normalize()):t.type=="point"?(u=t.position,v=t.distance,v=new THREE.PointLight(s,Q,v),v.position.set(u[0],u[1],u[2])):t.type=="ambient"&&(v=new THREE.AmbientLight(s)),E.scene.add(v),E.lights[o]=v;for(m in B.fogs)o=B.fogs[m],o.type=="linear"?N=new THREE.Fog(0,o.near,o.far):
o.type=="exp2"&&(N=new THREE.FogExp2(0,o.density)),D=o.color,N.color.setRGB(D[0],D[1],D[2]),E.fogs[m]=N;if(E.cameras&&B.defaults.camera)E.currentCamera=E.cameras[B.defaults.camera];if(E.fogs&&B.defaults.fog)E.scene.fog=E.fogs[B.defaults.fog];D=B.defaults.bgcolor;E.bgColor=new THREE.Color;E.bgColor.setRGB(D[0],D[1],D[2]);E.bgColorAlpha=B.defaults.bgalpha;for(k in B.geometries)if(m=B.geometries[k],m.type=="bin_mesh"||m.type=="ascii_mesh")S+=1,i.onLoadStart();l=S;for(k in B.geometries)if(m=B.geometries[k],
m.type=="cube")I=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),E.geometries[k]=I;else if(m.type=="plane")I=new THREE.PlaneGeometry(m.width,m.height,m.segmentsWidth,m.segmentsHeight),E.geometries[k]=I;else if(m.type=="sphere")I=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),E.geometries[k]=I;else if(m.type=="cylinder")I=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),E.geometries[k]=
I;else if(m.type=="torus")I=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),E.geometries[k]=I;else if(m.type=="icosahedron")I=new THREE.IcosahedronGeometry(m.radius,m.subdivisions),E.geometries[k]=I;else if(m.type=="bin_mesh")c.load(d(m.url,B.urlBaseType),g(k));else if(m.type=="ascii_mesh")O.load(d(m.url,B.urlBaseType),g(k));else if(m.type=="embedded_mesh")m=B.embeds[m.id],m.metadata=B.metadata,m&&O.createModel(m,e(k),"");for(p in B.textures)if(k=B.textures[p],k.url instanceof Array){A+=
k.url.length;for(m=0;m<k.url.length;m++)i.onLoadStart()}else A+=1,i.onLoadStart();V=A;for(p in B.textures){k=B.textures[p];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){m=[];for(N=0;N<k.url.length;N++)m[N]=d(k.url[N],B.urlBaseType);m=THREE.ImageUtils.loadTextureCube(m,k.mapping,a)}else{m=THREE.ImageUtils.loadTexture(d(k.url,B.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)m.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)m.magFilter=
THREE[k.magFilter];if(k.repeat){m.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)m.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)m.wrapT=THREE.RepeatWrapping}k.offset&&m.offset.set(k.offset[0],k.offset[1]);if(k.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(N[k.wrap[0]]!==void 0)m.wrapS=N[k.wrap[0]];if(N[k.wrap[1]]!==void 0)m.wrapT=N[k.wrap[1]]}}E.textures[p]=m}for(q in B.materials){p=B.materials[q];for(G in p.parameters)if(G=="envMap"||G=="map"||G=="lightMap")p.parameters[G]=
E.textures[p.parameters[G]];else if(G=="shading")p.parameters[G]=p.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")p.parameters[G]=THREE[p.parameters[G]]?THREE[p.parameters[G]]:THREE.NormalBlending;else if(G=="combine")p.parameters[G]=p.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(p.parameters[G]=="face")p.parameters[G]=THREE.FaceColors;else if(p.parameters[G])p.parameters[G]=THREE.VertexColors;if(p.parameters.opacity!==
void 0&&p.parameters.opacity<1)p.parameters.transparent=!0;if(p.parameters.normalMap){a=THREE.ShaderUtils.lib.normal;k=THREE.UniformsUtils.clone(a.uniforms);m=p.parameters.color;N=p.parameters.specular;c=p.parameters.ambient;O=p.parameters.shininess;k.tNormal.texture=E.textures[p.parameters.normalMap];if(p.parameters.normalMapFactor)k.uNormalScale.value=p.parameters.normalMapFactor;if(p.parameters.map)k.tDiffuse.texture=p.parameters.map,k.enableDiffuse.value=!0;if(p.parameters.lightMap)k.tAO.texture=
p.parameters.lightMap,k.enableAO.value=!0;if(p.parameters.specularMap)k.tSpecular.texture=E.textures[p.parameters.specularMap],k.enableSpecular.value=!0;k.uDiffuseColor.value.setHex(m);k.uSpecularColor.value.setHex(N);k.uAmbientColor.value.setHex(c);k.uShininess.value=O;if(p.parameters.opacity)k.uOpacity.value=p.parameters.opacity;K=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:k,lights:!0,fog:!0})}else K=new THREE[p.type](p.parameters);E.materials[q]=
K}f();i.callbackSync(E);h()};THREE.UTF8Loader=function(){};
THREE.UTF8Loader.prototype.load=function(a,b,c){var d=new XMLHttpRequest,f=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,e=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,b,f,g,e,h):console.error("THREE.UTF8Loader: Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,
!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,f=0;f<8;f++){for(var g=0,e=0;e<b;++e){var h=a.charCodeAt(e+d);g+=h>>1^-(h&1);c[8*e+f]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(f=e=0;f<b;f++)h=a.charCodeAt(f+d),g[f]=e-h,h==0&&e++;return[c,g]};
THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,f,g){var e=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var e=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,e,i){for(var j,k,p,r=a.length;i<r;i+=e)j=a[i],k=a[i+1],p=a[i+2],j=j/16383*c,k=k/16383*c,p=p/16383*c,j+=d,k+=f,p+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,p)))})(e[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(e[0],8,3);(function(a,
b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,j.push(d,e,f)})(e[0],8,5);(function(a){var c,d,e,f,g,i,t,v,u,w=a.length;for(c=0;c<w;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;v=d;u=e;i=f;var y=j[e*3],F=j[e*3+1],D=j[e*3+2],G=j[f*3],I=j[f*3+1],K=j[f*3+2];t=new THREE.Vector3(j[d*3],j[d*3+1],j[d*3+2]);y=new THREE.Vector3(y,F,D);G=new THREE.Vector3(G,I,K);g.faces.push(new THREE.Face3(v,u,i,[t,y,G],null,0));g=k[d*2];d=k[d*2+1];i=k[e*2];t=k[e*2+1];v=k[f*
2];u=k[f*2+1];f=b.faceVertexUvs[0];e=i;i=t;t=[];t.push(new THREE.UV(g,d));t.push(new THREE.UV(e,i));t.push(new THREE.UV(v,u));f.push(t)}})(e[1]);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e)};
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,b,f){return a+(b-a)*f};this.VIntX=function(a,b,f,g,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;b[g]=h+e*this.delta;b[g+1]=i;b[g+2]=j;f[g]=this.lerp(k[a],k[a+3],e);f[g+1]=this.lerp(k[a+1],k[a+4],e);f[g+2]=this.lerp(k[a+2],k[a+5],e)};this.VIntY=function(a,b,f,g,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;b[g]=h;b[g+1]=i+e*this.delta;b[g+2]=j;b=a+this.yd*
3;f[g]=this.lerp(k[a],k[b],e);f[g+1]=this.lerp(k[a+1],k[b+1],e);f[g+2]=this.lerp(k[a+2],k[b+2],e)};this.VIntZ=function(a,b,f,g,e,h,i,j,k,q){e=(e-k)/(q-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=j+e*this.delta;b=a+this.zd*3;f[g]=this.lerp(k[a],k[b],e);f[g+1]=this.lerp(k[a+1],k[b+1],e);f[g+2]=this.lerp(k[a+2],k[b+2],e)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,f,g,e,h){var i=g+1,j=g+this.yd,k=g+this.zd,q=i+this.yd,n=i+this.zd,o=g+this.yd+this.zd,s=i+this.yd+this.zd,m=0,p=this.field[g],r=this.field[i],t=this.field[j],v=this.field[q],u=this.field[k],w=this.field[n],y=this.field[o],F=this.field[s];p<e&&(m|=1);r<e&&(m|=2);t<e&&(m|=8);v<e&&(m|=4);u<e&&(m|=16);w<e&&(m|=32);y<e&&(m|=128);F<e&&(m|=64);var D=THREE.edgeTable[m];if(D===0)return 0;var G=this.delta,I=a+
G,K=b+G,G=f+G;D&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,e,a,b,f,p,r));D&2&&(this.compNorm(i),this.compNorm(q),this.VIntY(i*3,this.vlist,this.nlist,3,e,I,b,f,r,v));D&4&&(this.compNorm(j),this.compNorm(q),this.VIntX(j*3,this.vlist,this.nlist,6,e,a,K,f,t,v));D&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,e,a,b,f,p,t));D&16&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,12,e,a,b,G,u,w));D&32&&(this.compNorm(n),
this.compNorm(s),this.VIntY(n*3,this.vlist,this.nlist,15,e,I,b,G,w,F));D&64&&(this.compNorm(o),this.compNorm(s),this.VIntX(o*3,this.vlist,this.nlist,18,e,a,K,G,y,F));D&128&&(this.compNorm(k),this.compNorm(o),this.VIntY(k*3,this.vlist,this.nlist,21,e,a,b,G,u,y));D&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,e,a,b,f,p,u));D&512&&(this.compNorm(i),this.compNorm(n),this.VIntZ(i*3,this.vlist,this.nlist,27,e,I,b,f,r,w));D&1024&&(this.compNorm(q),this.compNorm(s),this.VIntZ(q*
3,this.vlist,this.nlist,30,e,I,K,f,v,F));D&2048&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,33,e,a,K,f,t,y));m<<=4;for(e=g=0;THREE.triTable[m+e]!=-1;)a=m+e,b=a+1,f=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[f],h),e+=3,g++;return g};this.posnormtriv=function(a,b,f,g,e,h){var i=this.count*3;this.positionArray[i]=a[f];this.positionArray[i+1]=a[f+1];this.positionArray[i+2]=a[f+2];this.positionArray[i+3]=a[g];this.positionArray[i+
4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[e];this.positionArray[i+7]=a[e+1];this.positionArray[i+8]=a[e+2];this.normalArray[i]=b[f];this.normalArray[i+1]=b[f+1];this.normalArray[i+2]=b[f+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[e];this.normalArray[i+7]=b[e+1];this.normalArray[i+8]=b[e+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=function(){this.count=0;
this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,f,g,e){var h=this.size*Math.sqrt(g/e),i=f*this.size,j=b*this.size,k=a*this.size,q=Math.floor(i-h);q<1&&(q=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var n=Math.floor(j-h);n<1&&(n=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);h=Math.floor(k+h);h>this.size-1&&(h=this.size-
1);for(var s,m,p,r,t,v,u,k=q;k<i;k++){p=this.size2*k;t=k/this.size-f;v=t*t;for(q=n;q<j;q++){m=p+this.size*q;s=q/this.size-b;u=s*s;for(s=o;s<h;s++)r=s/this.size-a,r=g/(1.0E-6+r*r+u+v)-e,r>0&&(this.field[m+s]+=r)}}};this.addPlaneX=function(a,b){var f,g,e,h,i,j=this.size,k=this.yd,q=this.zd,n=this.field,o=j*Math.sqrt(a/b);o>j&&(o=j);for(f=0;f<o;f++)if(g=f/j,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<j;g++){i=f+g*k;for(e=0;e<j;e++)n[q*e+i]+=h}};this.addPlaneY=function(a,b){var f,g,e,h,i,j,k=this.size,q=this.yd,
n=this.zd,o=this.field,s=k*Math.sqrt(a/b);s>k&&(s=k);for(g=0;g<s;g++)if(f=g/k,f*=f,h=a/(1.0E-4+f)-b,h>0){i=g*q;for(f=0;f<k;f++){j=i+f;for(e=0;e<k;e++)o[n*e+j]+=h}}};this.addPlaneZ=function(a,b){var f,g,e,h,i,j,k=this.size,q=this.yd,n=this.zd,o=this.field,s=k*Math.sqrt(a/b);s>k&&(s=k);for(e=0;e<s;e++)if(f=e/k,f*=f,h=a/(1.0E-4+f)-b,h>0){i=n*e;for(g=0;g<k;g++){j=i+g*q;for(f=0;f<k;f++)o[j+f]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=
function(a){this.begin();var b,f,g,e,h,i,j,k,q,n=this.size-2;for(e=1;e<n;e++){q=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(g=1;g<n;g++){k=q+this.size*g;i=(g-this.halfsize)/this.halfsize;for(f=1;f<n;f++)h=(f-this.halfsize)/this.halfsize,b=k+f,this.polygonize(h,i,j,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,f=[];this.render(function(g){var e,h,i,j,k,q,n,o;for(e=0;e<g.count;e++)n=e*3,k=n+1,o=n+2,h=g.positionArray[n],i=g.positionArray[k],j=
g.positionArray[o],q=new THREE.Vector3(h,i,j),h=g.normalArray[n],i=g.normalArray[k],j=g.normalArray[o],n=new THREE.Vector3(h,i,j),n.normalize(),k=new THREE.Vertex(q),b.vertices.push(k),f.push(n);q=g.count/3;for(e=0;e<q;e++)n=(a+e)*3,k=n+1,o=n+2,h=f[n],i=f[k],j=f[o],n=new THREE.Face3(n,k,o,[h,i,j]),b.faces.push(n);a+=q;g.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,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,-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.LensFlare=function(a,b,c,d,f){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;a!==void 0&&this.add(a,b,c,d,f)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;
THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;THREE.LensFlare.prototype.add=function(a,b,c,d,f,g){b===void 0&&(b=-1);c===void 0&&(c=0);g===void 0&&(g=1);f===void 0&&(f=new THREE.Color(16777215));if(d===void 0)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:g,color:f,blending:d})};
THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=-this.positionScreen.x*2,f=-this.positionScreen.y*2;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+f*c.distance,c.wantedRotation=c.x*Math.PI*0.25,c.rotation+=(c.wantedRotation-c.rotation)*0.25};
THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),e=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(e,a.vertexShader);b.compileShader(d);b.compileShader(e);b.attachShader(c,d);b.attachShader(c,e);b.linkProgram(c);return c}var b,c,d,f,g,e,h,i,j,k,q,n,o;this.init=function(s){b=s.context;c=s;d=new Float32Array(16);f=new Uint16Array(6);s=0;d[s++]=-1;d[s++]=-1;d[s++]=0;d[s++]=0;d[s++]=1;d[s++]=-1;d[s++]=1;d[s++]=
0;d[s++]=1;d[s++]=1;d[s++]=1;d[s++]=1;d[s++]=-1;d[s++]=1;d[s++]=0;d[s++]=1;s=0;f[s++]=0;f[s++]=1;f[s++]=2;f[s++]=0;f[s++]=2;f[s++]=3;g=b.createBuffer();e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);h=b.createTexture();i=b.createTexture();b.bindTexture(b.TEXTURE_2D,h);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(j=!1,k=a(THREE.ShaderFlares.lensFlare)):(j=!0,k=a(THREE.ShaderFlares.lensFlareVertexTexture));q={};n={};q.vertex=b.getAttribLocation(k,"position");q.uv=b.getAttribLocation(k,"uv");n.renderType=b.getUniformLocation(k,"renderType");n.map=b.getUniformLocation(k,"map");n.occlusionMap=b.getUniformLocation(k,"occlusionMap");n.opacity=b.getUniformLocation(k,"opacity");n.color=b.getUniformLocation(k,
"color");n.scale=b.getUniformLocation(k,"scale");n.rotation=b.getUniformLocation(k,"rotation");n.screenPosition=b.getUniformLocation(k,"screenPosition");o=!1};this.render=function(a,d,f,r){var a=a.__webglFlares,t=a.length;if(t){var v=new THREE.Vector3,u=r/f,w=f*0.5,y=r*0.5,F=16/r,D=new THREE.Vector2(F*u,F),G=new THREE.Vector3(1,1,0),I=new THREE.Vector2(1,1),K=n,F=q;b.useProgram(k);o||(b.enableVertexAttribArray(q.vertex),b.enableVertexAttribArray(q.uv),o=!0);b.uniform1i(K.occlusionMap,0);b.uniform1i(K.map,
1);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(F.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(F.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);b.disable(b.CULL_FACE);b.depthMask(!1);var Q,N,B,O,S;for(Q=0;Q<t;Q++)if(F=16/r,D.set(F*u,F),O=a[Q],v.set(O.matrixWorld.n14,O.matrixWorld.n24,O.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(v),d.projectionMatrix.multiplyVector3(v),G.copy(v),I.x=G.x*w+w,I.y=G.y*y+y,j||I.x>0&&I.x<f&&I.y>0&&I.y<r){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
h);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,0);b.uniform2f(K.scale,D.x,D.y);b.uniform3f(K.screenPosition,G.x,G.y,G.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,I.x-8,I.y-8,16,16,0);b.uniform1i(K.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,h);b.drawElements(b.TRIANGLES,
6,b.UNSIGNED_SHORT,0);O.positionScreen.copy(G);O.customUpdateCallback?O.customUpdateCallback(O):O.updateLensFlares();b.uniform1i(K.renderType,2);b.enable(b.BLEND);for(N=0,B=O.lensFlares.length;N<B;N++)if(S=O.lensFlares[N],S.opacity>0.0010&&S.scale>0.0010)G.x=S.x,G.y=S.y,G.z=S.z,F=S.size*S.scale/r,D.x=F*u,D.y=F,b.uniform3f(K.screenPosition,G.x,G.y,G.z),b.uniform2f(K.scale,D.x,D.y),b.uniform1f(K.rotation,S.rotation),b.uniform1f(K.opacity,S.opacity),b.uniform3f(K.color,S.color.r,S.color.g,S.color.b),
c.setBlending(S.blending),c.setTexture(S.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
THREE.ShadowMapPlugin=function(){var a,b,c,d,f=new THREE.Frustum,g=new THREE.Matrix4,e=new THREE.Vector3,h=new THREE.Vector3;this.init=function(e){a=e.context;b=e;var e=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(e.uniforms);c=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f});d=new THREE.ShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:f,morphTargets:!0});c._shadowPass=!0;d._shadowPass=!0};this.render=function(a,
c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i,j){var k,q,n,o,s,m,p,r,t,v=[];o=0;a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,q=i.__lights.length;k<q;k++)if(n=i.__lights[k],n.castShadow)if(n instanceof THREE.DirectionalLight&&n.shadowCascade)for(s=0;s<n.shadowCascadeCount;s++){var u;if(n.shadowCascadeArray[s])u=n.shadowCascadeArray[s];else{t=n;p=s;u=new THREE.DirectionalLight;u.isVirtual=
!0;u.onlyShadow=!0;u.castShadow=!0;u.shadowCameraNear=t.shadowCameraNear;u.shadowCameraFar=t.shadowCameraFar;u.shadowCameraLeft=t.shadowCameraLeft;u.shadowCameraRight=t.shadowCameraRight;u.shadowCameraBottom=t.shadowCameraBottom;u.shadowCameraTop=t.shadowCameraTop;u.shadowCameraVisible=t.shadowCameraVisible;u.shadowDarkness=t.shadowDarkness;u.shadowBias=t.shadowCascadeBias[p];u.shadowMapWidth=t.shadowCascadeWidth[p];u.shadowMapHeight=t.shadowCascadeHeight[p];u.pointsWorld=[];u.pointsFrustum=[];r=
u.pointsWorld;m=u.pointsFrustum;for(var w=0;w<8;w++)r[w]=new THREE.Vector3,m[w]=new THREE.Vector3;r=t.shadowCascadeNearZ[p];t=t.shadowCascadeFarZ[p];m[0].set(-1,-1,r);m[1].set(1,-1,r);m[2].set(-1,1,r);m[3].set(1,1,r);m[4].set(-1,-1,t);m[5].set(1,-1,t);m[6].set(-1,1,t);m[7].set(1,1,t);u.originalCamera=j;m=new THREE.Gyroscope;m.position=n.shadowCascadeOffset;m.add(u);m.add(u.target);j.add(m);n.shadowCascadeArray[s]=u;console.log("Created virtualLight",u)}p=n;r=s;t=p.shadowCascadeArray[r];t.position.copy(p.position);
t.target.position.copy(p.target.position);t.lookAt(t.target);t.shadowCameraVisible=p.shadowCameraVisible;t.shadowDarkness=p.shadowDarkness;t.shadowBias=p.shadowCascadeBias[r];m=p.shadowCascadeNearZ[r];p=p.shadowCascadeFarZ[r];t=t.pointsFrustum;t[0].z=m;t[1].z=m;t[2].z=m;t[3].z=m;t[4].z=p;t[5].z=p;t[6].z=p;t[7].z=p;v[o]=u;o++}else v[o]=n,o++;for(k=0,q=v.length;k<q;k++){n=v[k];if(!n.shadowMap)n.shadowMap=new THREE.WebGLRenderTarget(n.shadowMapWidth,n.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
format:THREE.RGBAFormat}),n.shadowMapSize=new THREE.Vector2(n.shadowMapWidth,n.shadowMapHeight),n.shadowMatrix=new THREE.Matrix4;if(!n.shadowCamera){if(n instanceof THREE.SpotLight)n.shadowCamera=new THREE.PerspectiveCamera(n.shadowCameraFov,n.shadowMapWidth/n.shadowMapHeight,n.shadowCameraNear,n.shadowCameraFar);else if(n instanceof THREE.DirectionalLight)n.shadowCamera=new THREE.OrthographicCamera(n.shadowCameraLeft,n.shadowCameraRight,n.shadowCameraTop,n.shadowCameraBottom,n.shadowCameraNear,n.shadowCameraFar);
else{console.error("Unsupported light type for shadow");continue}i.add(n.shadowCamera);b.autoUpdateScene&&i.updateMatrixWorld()}if(n.shadowCameraVisible&&!n.cameraHelper)n.cameraHelper=new THREE.CameraHelper(n.shadowCamera),n.shadowCamera.add(n.cameraHelper);if(n.isVirtual&&u.originalCamera==j){s=j;o=n.shadowCamera;m=n.pointsFrustum;t=n.pointsWorld;e.set(Infinity,Infinity,Infinity);h.set(-Infinity,-Infinity,-Infinity);for(p=0;p<8;p++){r=t[p];r.copy(m[p]);THREE.ShadowMapPlugin.__projector.unprojectVector(r,
s);o.matrixWorldInverse.multiplyVector3(r);if(r.x<e.x)e.x=r.x;if(r.x>h.x)h.x=r.x;if(r.y<e.y)e.y=r.y;if(r.y>h.y)h.y=r.y;if(r.z<e.z)e.z=r.z;if(r.z>h.z)h.z=r.z}o.left=e.x;o.right=h.x;o.top=h.y;o.bottom=e.y;o.updateProjectionMatrix()}o=n.shadowMap;m=n.shadowMatrix;s=n.shadowCamera;s.position.copy(n.matrixWorld.getPosition());s.lookAt(n.target.matrixWorld.getPosition());s.updateMatrixWorld();s.matrixWorldInverse.getInverse(s.matrixWorld);if(n.cameraHelper)n.cameraHelper.lines.visible=n.shadowCameraVisible;
n.shadowCameraVisible&&n.cameraHelper.update(n.shadowCamera);m.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);m.multiplySelf(s.projectionMatrix);m.multiplySelf(s.matrixWorldInverse);if(!s._viewMatrixArray)s._viewMatrixArray=new Float32Array(16);s.matrixWorldInverse.flattenToArray(s._viewMatrixArray);if(!s._projectionMatrixArray)s._projectionMatrixArray=new Float32Array(16);s.projectionMatrix.flattenToArray(s._projectionMatrixArray);g.multiply(s.projectionMatrix,s.matrixWorldInverse);f.setFromMatrix(g);
b.setRenderTarget(o);b.clear();t=i.__webglObjects;for(n=0,o=t.length;n<o;n++)if(p=t[n],m=p.object,p.render=!1,m.visible&&m.castShadow&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||f.contains(m)))m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),p.render=!0;for(n=0,o=t.length;n<o;n++)if(p=t[n],p.render)m=p.object,p=p.buffer,b.setObjectFaces(m),r=m.customDepthMaterial?m.customDepthMaterial:m.geometry.morphTargets.length?
d:c,p instanceof THREE.BufferGeometry?b.renderBufferDirect(s,i.__lights,null,r,p,m):b.renderBuffer(s,i.__lights,null,r,p,m);t=i.__webglObjectsImmediate;for(n=0,o=t.length;n<o;n++)p=t[n],m=p.object,m.visible&&m.castShadow&&(m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),m._modelViewMatrix.multiplyToArray(s.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),b.renderImmediateObject(s,i.__lights,null,c,m))}k=b.getClearColor();q=b.getClearAlpha();a.clearColor(k.r,k.g,k.b,
q);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};THREE.ShadowMapPlugin.__projector=new THREE.Projector;
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,f,g,e,h,i,j,k;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);f=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;f[a++]=0;f[a++]=1;f[a++]=2;f[a++]=0;f[a++]=2;f[a++]=3;g=b.createBuffer();e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,g);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
e);b.bufferData(b.ELEMENT_ARRAY_BUFFER,f,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,n=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),s=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(s,a.vertexShader);b.compileShader(o);b.compileShader(s);b.attachShader(n,o);b.attachShader(n,s);b.linkProgram(n);h=n;i={};j={};i.position=b.getAttribLocation(h,"position");i.uv=b.getAttribLocation(h,"uv");j.uvOffset=b.getUniformLocation(h,"uvOffset");j.uvScale=b.getUniformLocation(h,
"uvScale");j.rotation=b.getUniformLocation(h,"rotation");j.scale=b.getUniformLocation(h,"scale");j.alignment=b.getUniformLocation(h,"alignment");j.color=b.getUniformLocation(h,"color");j.map=b.getUniformLocation(h,"map");j.opacity=b.getUniformLocation(h,"opacity");j.useScreenCoordinates=b.getUniformLocation(h,"useScreenCoordinates");j.affectedByDistance=b.getUniformLocation(h,"affectedByDistance");j.screenPosition=b.getUniformLocation(h,"screenPosition");j.modelViewMatrix=b.getUniformLocation(h,"modelViewMatrix");
j.projectionMatrix=b.getUniformLocation(h,"projectionMatrix");k=!1};this.render=function(d,f,o,s){var d=d.__webglSprites,m=d.length;if(m){var p=i,r=j,t=s/o;o*=0.5;var v=s*0.5,u=!0;b.useProgram(h);k||(b.enableVertexAttribArray(p.position),b.enableVertexAttribArray(p.uv),k=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,g);b.vertexAttribPointer(p.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(p.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e);
b.uniformMatrix4fv(r.projectionMatrix,!1,f._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(r.map,0);for(var w,y=[],p=0;p<m;p++)if(w=d[p],w.visible&&w.opacity!==0)w.useScreenCoordinates?w.z=-w.position.z:(w._modelViewMatrix.multiplyToArray(f.matrixWorldInverse,w.matrixWorld,w._modelViewMatrixArray),w.z=-w._modelViewMatrix.n34);d.sort(a);for(p=0;p<m;p++)w=d[p],w.visible&&w.opacity!==0&&w.map&&w.map.image&&w.map.image.width&&(w.useScreenCoordinates?(b.uniform1i(r.useScreenCoordinates,
1),b.uniform3f(r.screenPosition,(w.position.x-o)/o,(v-w.position.y)/v,Math.max(0,Math.min(1,w.position.z)))):(b.uniform1i(r.useScreenCoordinates,0),b.uniform1i(r.affectedByDistance,w.affectedByDistance?1:0),b.uniformMatrix4fv(r.modelViewMatrix,!1,w._modelViewMatrixArray)),f=w.map.image.width/(w.scaleByViewport?s:1),y[0]=f*t*w.scale.x,y[1]=f*w.scale.y,b.uniform2f(r.uvScale,w.uvScale.x,w.uvScale.y),b.uniform2f(r.uvOffset,w.uvOffset.x,w.uvOffset.y),b.uniform2f(r.alignment,w.alignment.x,w.alignment.y),
b.uniform1f(r.opacity,w.opacity),b.uniform3f(r.color,w.color.r,w.color.g,w.color.b),b.uniform1f(r.rotation,w.rotation),b.uniform2fv(r.scale,y),w.mergeWith3D&&!u?(b.enable(b.DEPTH_TEST),u=!0):!w.mergeWith3D&&u&&(b.disable(b.DEPTH_TEST),u=!1),c.setBlending(w.blending),c.setTexture(w.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,f=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,e=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,q;f.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},n=new THREE.WebGLRenderTarget(512,512,a),o=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:n},mapRight:{type:"t",value:1,texture:o}},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}"}),
m=new THREE.Scene;m.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));m.add(s);this.setSize=function(a,d){c.call(b,a,d);n.width=a;n.height=d;o.width=a;o.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||q!==c.fov){i=c.aspect;j=c.near;k=c.far;q=c.fov;var t=c.projectionMatrix.clone(),v=125/30*0.5,u=v*j/125,w=j*Math.tan(q*Math.PI/360),y;e.n14=v;h.n14=-v;v=-w*i+u;y=w*i+u;t.n11=2*j/(y-v);t.n13=(y+v)/(y-v);f.projectionMatrix.copy(t);v=-w*i-u;y=w*i-u;t.n11=
2*j/(y-v);t.n13=(y+v)/(y-v);g.projectionMatrix.copy(t)}f.matrixWorld.copy(c.matrixWorld).multiplySelf(h);f.position.copy(c.position);f.near=c.near;f.far=c.far;d.call(b,a,f,n,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(e);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,o,!0);m.updateMatrixWorld();d.call(b,m,s)}};
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,f,g,e=new THREE.PerspectiveCamera;e.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);f=a/2;g=d};this.render=function(a,c){this.clear();e.fov=c.fov;e.aspect=0.5*c.aspect;e.near=c.near;e.far=
c.far;e.updateProjectionMatrix();e.position.copy(c.position);e.target.copy(c.target);e.translateX(b.separation);e.lookAt(e.target);h.projectionMatrix=e.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,f,g);d.call(b,a,e);this.setViewport(f,0,f,g);d.call(b,a,h,!1)}};
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
THREE.ShaderSprite={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:"precision mediump float;\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}"}};
THREE.ShaderExtras={screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float opacity;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},convolution:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},
uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"uniform vec2 uImageIncrement;\nvarying vec2 vUv;\nvoid main() {\nvUv = uv - ( ( KERNEL_SIZE - 1.0 ) / 2.0 ) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float cKernel[ KERNEL_SIZE ];\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nvarying vec2 vUv;\nvoid main() {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i = 0; i < KERNEL_SIZE; i ++ ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
bokeh:{uniforms:{tColor:{type:"t",value:0,texture:null},tDepth:{type:"t",value:1,texture:null},focus:{type:"f",value:1},aspect:{type:"f",value:1},aperture:{type:"f",value:0.025},maxblur:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform float maxblur;\nuniform float aperture;\nuniform float focus;\nuniform float aspect;\nvoid main() {\nvec2 aspectcorrect = vec2( 1.0, aspect );\nvec4 depth1 = texture2D( tDepth, vUv );\nfloat factor = depth1.x - focus;\nvec2 dofblur = vec2 ( clamp( factor * aperture, -maxblur, maxblur ) );\nvec2 dofblur9 = dofblur * 0.9;\nvec2 dofblur7 = dofblur * 0.7;\nvec2 dofblur4 = dofblur * 0.4;\nvec4 col = vec4( 0.0 );\ncol += texture2D( tColor, vUv.xy );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur9 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur7 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.4,   0.0  ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );\ncol += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur4 );\ngl_FragColor = col / 41.0;\ngl_FragColor.a = 1.0;\n}"},
dofmipmap:{uniforms:{tColor:{type:"t",value:0,texture:null},tDepth:{type:"t",value:1,texture:null},focus:{type:"f",value:1},maxblur:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float focus;\nuniform float maxblur;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nvarying vec2 vUv;\nvoid main() {\nvec4 depth = texture2D( tDepth, vUv );\nfloat factor = depth.x - focus;\nvec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );\ngl_FragColor = col;\ngl_FragColor.a = 1.0;\n}"},
sepia:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},amount:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float amount;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 color = texture2D( tDiffuse, vUv );\nvec3 c = color.rgb;\ncolor.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );\ncolor.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );\ncolor.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );\ngl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );\n}"},
dotscreen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},tSize:{type:"v2",value:new THREE.Vector2(256,256)},center:{type:"v2",value:new THREE.Vector2(0.5,0.5)},angle:{type:"f",value:1.57},scale:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform vec2 center;\nuniform float angle;\nuniform float scale;\nuniform vec2 tSize;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nfloat pattern() {\nfloat s = sin( angle ), c = cos( angle );\nvec2 tex = vUv * tSize - center;\nvec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;\nreturn ( sin( point.x ) * sin( point.y ) ) * 4.0;\n}\nvoid main() {\nvec4 color = texture2D( tDiffuse, vUv );\nfloat average = ( color.r + color.g + color.b ) / 3.0;\ngl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );\n}"},
vignette:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},offset:{type:"f",value:1},darkness:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float offset;\nuniform float darkness;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\nvec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );\ngl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );\n}"},
bleachbypass:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float opacity;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 base = texture2D( tDiffuse, vUv );\nvec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );\nfloat lum = dot( lumCoeff, base.rgb );\nvec3 blend = vec3( lum );\nfloat L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );\nvec3 result1 = 2.0 * base.rgb * blend;\nvec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );\nvec3 newColor = mix( result1, result2, L );\nfloat A2 = opacity * base.a;\nvec3 mixRGB = A2 * newColor.rgb;\nmixRGB += ( ( 1.0 - A2 ) * base.rgb );\ngl_FragColor = vec4( mixRGB, base.a );\n}"},
focus:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},screenWidth:{type:"f",value:1024},screenHeight:{type:"f",value:1024},sampleDistance:{type:"f",value:0.94},waveFactor:{type:"f",value:0.00125}},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 float screenWidth;\nuniform float screenHeight;\nuniform float sampleDistance;\nuniform float waveFactor;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 color, org, tmp, add;\nfloat sample_dist, f;\nvec2 vin;\nvec2 uv = vUv;\nadd += color = org = texture2D( tDiffuse, uv );\nvin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );\nsample_dist = dot( vin, vin ) * 2.0;\nf = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;\nvec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );\nadd += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );\nif( tmp.b < color.b ) color = tmp;\nadd += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );\nif( tmp.b < color.b ) color = tmp;\nadd += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );\nif( tmp.b < color.b ) color = tmp;\nadd += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );\nif( tmp.b < color.b ) color = tmp;\nadd += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );\nif( tmp.b < color.b ) color = tmp;\nadd += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );\nif( tmp.b < color.b ) color = tmp;\nadd += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );\nif( tmp.b < color.b ) color = tmp;\ncolor = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );\ncolor = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );\ngl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );\n}"},
triangleBlur:{uniforms:{texture:{type:"t",value:0,texture:null},delta:{type:"v2",value:new THREE.Vector2(1,1)}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#define ITERATIONS 10.0\nuniform sampler2D texture;\nuniform vec2 delta;\nvarying vec2 vUv;\nfloat random( vec3 scale, float seed ) {\nreturn fract( sin( dot( gl_FragCoord.xyz + seed, scale ) ) * 43758.5453 + seed );\n}\nvoid main() {\nvec4 color = vec4( 0.0 );\nfloat total = 0.0;\nfloat offset = random( vec3( 12.9898, 78.233, 151.7182 ), 0.0 );\nfor ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {\nfloat percent = ( t + offset - 0.5 ) / ITERATIONS;\nfloat weight = 1.0 - abs( percent );\ncolor += texture2D( texture, vUv + delta * percent ) * weight;\ntotal += weight;\n}\ngl_FragColor = color / total;\n}"},
basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"},horizontalBlur:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},h:{type:"f",value:1/512}},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 tDiffuse;\nuniform float h;\nvarying vec2 vUv;\nvoid main() {\nvec4 sum = vec4( 0.0 );\nsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\nsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\nsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\nsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\nsum += texture2D( tDiffuse, vec2( vUv.x, \t\t  \tvUv.y ) ) * 0.1633;\nsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\nsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\nsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\nsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\ngl_FragColor = sum;\n}"},
verticalBlur:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},v:{type:"f",value:1/512}},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 tDiffuse;\nuniform float v;\nvarying vec2 vUv;\nvoid main() {\nvec4 sum = vec4( 0.0 );\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y\t\t\t  ) ) * 0.1633;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\ngl_FragColor = sum;\n}"},
horizontalTiltShift:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},h:{type:"f",value:1/512},r:{type:"f",value:0.35}},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 tDiffuse;\nuniform float h;\nuniform float r;\nvarying vec2 vUv;\nvoid main() {\nvec4 sum = vec4( 0.0 );\nfloat hh = h * abs( r - vUv.y );\nsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;\nsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;\nsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;\nsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;\nsum += texture2D( tDiffuse, vec2( vUv.x, \t\t  \t vUv.y ) ) * 0.1633;\nsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;\nsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;\nsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;\nsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;\ngl_FragColor = sum;\n}"},
verticalTiltShift:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},v:{type:"f",value:1/512},r:{type:"f",value:0.35}},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 tDiffuse;\nuniform float v;\nuniform float r;\nvarying vec2 vUv;\nvoid main() {\nvec4 sum = vec4( 0.0 );\nfloat vv = v * abs( r - vUv.y );\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y\t\t\t   ) ) * 0.1633;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;\nsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;\ngl_FragColor = sum;\n}"},
blend:{uniforms:{tDiffuse1:{type:"t",value:0,texture:null},tDiffuse2:{type:"t",value:1,texture:null},mixRatio:{type:"f",value:0.5},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float opacity;\nuniform float mixRatio;\nuniform sampler2D tDiffuse1;\nuniform sampler2D tDiffuse2;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel1 = texture2D( tDiffuse1, vUv );\nvec4 texel2 = texture2D( tDiffuse2, vUv );\ngl_FragColor = opacity * mix( texel1, texel2, mixRatio );\n}"},
fxaa:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},resolution:{type:"v2",value:new THREE.Vector2(1/1024,1/512)}},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 tDiffuse;\nuniform vec2 resolution;\nvarying vec2 vUv;\n#define FXAA_REDUCE_MIN   (1.0/128.0)\n#define FXAA_REDUCE_MUL   (1.0/8.0)\n#define FXAA_SPAN_MAX     8.0\nvoid main() {\nvec3 rgbNW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ).xyz;\nvec3 rgbNE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ).xyz;\nvec3 rgbSW = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ).xyz;\nvec3 rgbSE = texture2D( tDiffuse, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ).xyz;\nvec3 rgbM  = texture2D( tDiffuse,  gl_FragCoord.xy  * resolution ).xyz;\nvec3 luma = vec3( 0.299, 0.587, 0.114 );\nfloat lumaNW = dot( rgbNW, luma );\nfloat lumaNE = dot( rgbNE, luma );\nfloat lumaSW = dot( rgbSW, luma );\nfloat lumaSE = dot( rgbSE, luma );\nfloat lumaM  = dot( rgbM,  luma );\nfloat lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\nfloat lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\nvec2 dir;\ndir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\ndir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));\nfloat dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\nfloat rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\ndir = min( vec2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),\nmax( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\ndir * rcpDirMin)) * resolution;\nvec3 rgbA = 0.5 * (\ntexture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ).xyz +\ntexture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ).xyz );\nvec3 rgbB = rgbA * 0.5 + 0.25 * (\ntexture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * -0.5 ).xyz +\ntexture2D( tDiffuse, gl_FragCoord.xy  * resolution + dir * 0.5 ).xyz );\nfloat lumaB = dot( rgbB, luma );\nif ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) ) {\ngl_FragColor = vec4( rgbA, 1.0 );\n} else {\ngl_FragColor = vec4( rgbB, 1.0 );\n}\n}"},
luminosity:{uniforms:{tDiffuse:{type:"t",value:0,texture:null}},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 tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\nvec3 luma = vec3( 0.299, 0.587, 0.114 );\nfloat v = dot( texel.xyz, luma );\ngl_FragColor = vec4( v, v, v, texel.w );\n}"},colorCorrection:{uniforms:{tDiffuse:{type:"t",
value:0,texture:null},powRGB:{type:"v3",value:new THREE.Vector3(2,2,2)},mulRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D tDiffuse;\nuniform vec3 powRGB;\nuniform vec3 mulRGB;\nvarying vec2 vUv;\nvoid main() {\ngl_FragColor = texture2D( tDiffuse, vUv );\ngl_FragColor.rgb = mulRGB * pow( gl_FragColor.rgb, powRGB );\n}"},
normalmap:{uniforms:{heightMap:{type:"t",value:0,texture:null},resolution:{type:"v2",value:new THREE.Vector2(512,512)},scale:{type:"v2",value:new THREE.Vector2(1,1)},height:{type:"f",value:0.05}},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 float height;\nuniform vec2 resolution;\nuniform sampler2D heightMap;\nvarying vec2 vUv;\nvoid main() {\nfloat val = texture2D( heightMap, vUv ).x;\nfloat valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;\nfloat valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;\ngl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height  ) ) + 0.5 ), 1.0 );\n}"},
ssao:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},tDepth:{type:"t",value:1,texture:null},size:{type:"v2",value:new THREE.Vector2(512,512)},cameraNear:{type:"f",value:1},cameraFar:{type:"f",value:100},fogNear:{type:"f",value:5},fogFar:{type:"f",value:100},fogEnabled:{type:"i",value:0},aoClamp:{type:"f",value:0.3}},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 float cameraNear;\nuniform float cameraFar;\nuniform float fogNear;\nuniform float fogFar;\nuniform bool fogEnabled;\nuniform vec2 size;\nuniform float aoClamp;\nuniform sampler2D tDiffuse;\nuniform sampler2D tDepth;\nvarying vec2 vUv;\n#define DL 2.399963229728653\n#define EULER 2.718281828459045\nfloat width = size.x;\nfloat height = size.y;\nfloat cameraFarPlusNear = cameraFar + cameraNear;\nfloat cameraFarMinusNear = cameraFar - cameraNear;\nfloat cameraCoef = 2.0 * cameraNear;\nconst int samples = 8;\nconst float radius = 5.0;\nconst bool useNoise = false;\nconst float noiseAmount = 0.0002;\nconst float diffArea = 0.4;\nconst float gDisplace = 0.4;\nconst bool onlyAO = false;\nconst float lumInfluence = 0.3;\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}\nvec2 rand( const vec2 coord ) {\nvec2 noise;\nif ( useNoise ) {\nfloat nx = dot ( coord, vec2( 12.9898, 78.233 ) );\nfloat ny = dot ( coord, vec2( 12.9898, 78.233 ) * 2.0 );\nnoise = clamp( fract ( 43758.5453 * sin( vec2( nx, ny ) ) ), 0.0, 1.0 );\n} else {\nfloat ff = fract( 1.0 - coord.s * ( width / 2.0 ) );\nfloat gg = fract( coord.t * ( height / 2.0 ) );\nnoise = vec2( 0.25, 0.75 ) * vec2( ff ) + vec2( 0.75, 0.25 ) * gg;\n}\nreturn ( noise * 2.0  - 1.0 ) * noiseAmount;\n}\nfloat doFog() {\nfloat zdepth = unpackDepth( texture2D( tDepth, vUv ) );\nfloat depth = -cameraFar * cameraNear / ( zdepth * cameraFarMinusNear - cameraFar );\nreturn smoothstep( fogNear, fogFar, depth );\n}\nfloat readDepth( const in vec2 coord ) {\nreturn cameraCoef / ( cameraFarPlusNear - unpackDepth( texture2D( tDepth, coord ) ) * cameraFarMinusNear );\n}\nfloat compareDepths( const in float depth1, const in float depth2, inout int far ) {\nfloat garea = 2.0;\nfloat diff = ( depth1 - depth2 ) * 100.0;\nif ( diff < gDisplace ) {\ngarea = diffArea;\n} else {\nfar = 1;\n}\nfloat dd = diff - gDisplace;\nfloat gauss = pow( EULER, -2.0 * dd * dd / ( garea * garea ) );\nreturn gauss;\n}\nfloat calcAO( float depth, float dw, float dh ) {\nfloat dd = radius - depth * radius;\nvec2 vv = vec2( dw, dh );\nvec2 coord1 = vUv + dd * vv;\nvec2 coord2 = vUv - dd * vv;\nfloat temp1 = 0.0;\nfloat temp2 = 0.0;\nint far = 0;\ntemp1 = compareDepths( depth, readDepth( coord1 ), far );\nif ( far > 0 ) {\ntemp2 = compareDepths( readDepth( coord2 ), depth, far );\ntemp1 += ( 1.0 - temp1 ) * temp2;\n}\nreturn temp1;\n}\nvoid main() {\nvec2 noise = rand( vUv );\nfloat depth = readDepth( vUv );\nfloat tt = clamp( depth, aoClamp, 1.0 );\nfloat w = ( 1.0 / width )  / tt + ( noise.x * ( 1.0 - noise.x ) );\nfloat h = ( 1.0 / height ) / tt + ( noise.y * ( 1.0 - noise.y ) );\nfloat pw;\nfloat ph;\nfloat ao;\nfloat dz = 1.0 / float( samples );\nfloat z = 1.0 - dz / 2.0;\nfloat l = 0.0;\nfor ( int i = 0; i <= samples; i ++ ) {\nfloat r = sqrt( 1.0 - z );\npw = cos( l ) * r;\nph = sin( l ) * r;\nao += calcAO( depth, pw * w, ph * h );\nz = z - dz;\nl = l + DL;\n}\nao /= float( samples );\nao = 1.0 - ao;\nif ( fogEnabled ) {\nao = mix( ao, 1.0, doFog() );\n}\nvec3 color = texture2D( tDiffuse, vUv ).rgb;\nvec3 lumcoeff = vec3( 0.299, 0.587, 0.114 );\nfloat lum = dot( color.rgb, lumcoeff );\nvec3 luminance = vec3( lum );\nvec3 final = vec3( color * mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );\nif ( onlyAO ) {\nfinal = vec3( mix( vec3( ao ), vec3( 1.0 ), luminance * lumInfluence ) );\n}\ngl_FragColor = vec4( final, 1.0 );\n}"},
colorify:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},color:{type:"c",value:new THREE.Color(16777215)}},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 vec3 color;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\nvec3 luma = vec3( 0.299, 0.587, 0.114 );\nfloat v = dot( texel.xyz, luma );\ngl_FragColor = vec4( v * color, texel.w );\n}"},
unpackDepthRGBA:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float opacity;\nuniform sampler2D tDiffuse;\nvarying vec2 vUv;\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}\nvoid main() {\nfloat depth = 1.0 - unpackDepth( texture2D( tDiffuse, vUv ) );\ngl_FragColor = opacity * vec4( vec3( depth ), 1.0 );\n}"},
buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b)c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a)),d+=c[b];for(b=0;b<g;++b)c[b]/=d;return c}};
THREE.EffectComposer=function(a,b){this.renderer=a;this.renderTarget1=b;if(this.renderTarget1===void 0)this.renderTargetParameters={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBFormat,stencilBuffer:!1},this.renderTarget1=new THREE.WebGLRenderTarget(window.innerWidth,window.innerHeight,this.renderTargetParameters);this.renderTarget2=this.renderTarget1.clone();this.writeBuffer=this.renderTarget1;this.readBuffer=this.renderTarget2;this.passes=[];this.copyPass=new THREE.ShaderPass(THREE.ShaderExtras.screen)};
THREE.EffectComposer.prototype={swapBuffers:function(){var a=this.readBuffer;this.readBuffer=this.writeBuffer;this.writeBuffer=a},addPass:function(a){this.passes.push(a)},render:function(a){this.writeBuffer=this.renderTarget1;this.readBuffer=this.renderTarget2;var b=!1,c,d,f=this.passes.length;for(d=0;d<f;d++)if(c=this.passes[d],c.enabled){c.render(this.renderer,this.writeBuffer,this.readBuffer,a,b);if(c.needsSwap){if(b){var g=this.renderer.context;g.stencilFunc(g.NOTEQUAL,1,4294967295);this.copyPass.render(this.renderer,
this.writeBuffer,this.readBuffer,a);g.stencilFunc(g.EQUAL,1,4294967295)}this.swapBuffers()}c instanceof THREE.MaskPass?b=!0:c instanceof THREE.ClearMaskPass&&(b=!1)}},reset:function(a){this.renderTarget1=a;if(this.renderTarget1===void 0)this.renderTarget1=new THREE.WebGLRenderTarget(window.innerWidth,window.innerHeight,this.renderTargetParameters);this.renderTarget2=this.renderTarget1.clone();this.writeBuffer=this.renderTarget1;this.readBuffer=this.renderTarget2;THREE.EffectComposer.quad.scale.set(window.innerWidth,
window.innerHeight,1);THREE.EffectComposer.camera.left=window.innerWidth/-2;THREE.EffectComposer.camera.right=window.innerWidth/2;THREE.EffectComposer.camera.top=window.innerHeight/2;THREE.EffectComposer.camera.bottom=window.innerHeight/-2;THREE.EffectComposer.camera.updateProjectionMatrix()}};THREE.EffectComposer.camera=new THREE.OrthographicCamera(window.innerWidth/-2,window.innerWidth/2,window.innerHeight/2,window.innerHeight/-2,-1E4,1E4);
THREE.EffectComposer.geometry=new THREE.PlaneGeometry(1,1);THREE.EffectComposer.quad=new THREE.Mesh(THREE.EffectComposer.geometry,null);THREE.EffectComposer.quad.position.z=-100;THREE.EffectComposer.quad.scale.set(window.innerWidth,window.innerHeight,1);THREE.EffectComposer.scene=new THREE.Scene;THREE.EffectComposer.scene.add(THREE.EffectComposer.quad);THREE.EffectComposer.scene.add(THREE.EffectComposer.camera);
THREE.MaskPass=function(a,b){this.scene=a;this.camera=b;this.clear=this.enabled=!0;this.inverse=this.needsSwap=!1};
THREE.MaskPass.prototype={render:function(a,b,c){var d=a.context;d.colorMask(!1,!1,!1,!1);d.depthMask(!1);var f,g;this.inverse?(f=0,g=1):(f=1,g=0);d.enable(d.STENCIL_TEST);d.stencilOp(d.REPLACE,d.REPLACE,d.REPLACE);d.stencilFunc(d.ALWAYS,f,4294967295);d.clearStencil(g);a.render(this.scene,this.camera,c,this.clear);a.render(this.scene,this.camera,b,this.clear);d.colorMask(!0,!0,!0,!0);d.depthMask(!0);d.stencilFunc(d.EQUAL,1,4294967295);d.stencilOp(d.KEEP,d.KEEP,d.KEEP)}};
THREE.ClearMaskPass=function(){this.enabled=!0};THREE.ClearMaskPass.prototype={render:function(a){a=a.context;a.disable(a.STENCIL_TEST)}};THREE.RenderPass=function(a,b,c,d,f){this.scene=a;this.camera=b;this.overrideMaterial=c;this.clearColor=d;this.clearAlpha=f!==void 0?f:1;this.oldClearColor=new THREE.Color;this.oldClearAlpha=1;this.clear=this.enabled=!0;this.needsSwap=!1};
THREE.RenderPass.prototype={render:function(a,b,c){this.scene.overrideMaterial=this.overrideMaterial;if(this.clearColor)this.oldClearColor.copy(a.getClearColor()),this.oldClearAlpha=a.getClearAlpha(),a.setClearColor(this.clearColor,this.clearAlpha);a.render(this.scene,this.camera,c,this.clear);this.clearColor&&a.setClearColor(this.oldClearColor,this.oldClearAlpha);this.scene.overrideMaterial=null}};
THREE.ShaderPass=function(a,b){this.textureID=b!==void 0?b:"tDiffuse";this.uniforms=THREE.UniformsUtils.clone(a.uniforms);this.material=new THREE.ShaderMaterial({uniforms:this.uniforms,vertexShader:a.vertexShader,fragmentShader:a.fragmentShader});this.renderToScreen=!1;this.needsSwap=this.enabled=!0;this.clear=!1};
THREE.ShaderPass.prototype={render:function(a,b,c){if(this.uniforms[this.textureID])this.uniforms[this.textureID].texture=c;THREE.EffectComposer.quad.material=this.material;this.renderToScreen?a.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera):a.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,b,this.clear)}};
THREE.BloomPass=function(a,b,c,d){var a=a!==void 0?a:1,b=b!==void 0?b:25,c=c!==void 0?c:4,d=d!==void 0?d:256,f={minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBFormat};this.renderTargetX=new THREE.WebGLRenderTarget(d,d,f);this.renderTargetY=new THREE.WebGLRenderTarget(d,d,f);d=THREE.ShaderExtras.screen;this.screenUniforms=THREE.UniformsUtils.clone(d.uniforms);this.screenUniforms.opacity.value=a;this.materialScreen=new THREE.ShaderMaterial({uniforms:this.screenUniforms,vertexShader:d.vertexShader,
fragmentShader:d.fragmentShader,blending:THREE.AdditiveBlending,transparent:!0});a=THREE.ShaderExtras.convolution;this.convolutionUniforms=THREE.UniformsUtils.clone(a.uniforms);this.convolutionUniforms.uImageIncrement.value=THREE.BloomPass.blurx;this.convolutionUniforms.cKernel.value=THREE.ShaderExtras.buildKernel(c);this.materialConvolution=new THREE.ShaderMaterial({uniforms:this.convolutionUniforms,vertexShader:"#define KERNEL_SIZE "+b+".0\n"+a.vertexShader,fragmentShader:"#define KERNEL_SIZE "+
b+"\n"+a.fragmentShader});this.enabled=!0;this.clear=this.needsSwap=!1};
THREE.BloomPass.prototype={render:function(a,b,c,d,f){f&&a.context.disable(a.context.STENCIL_TEST);THREE.EffectComposer.quad.material=this.materialConvolution;this.convolutionUniforms.tDiffuse.texture=c;this.convolutionUniforms.uImageIncrement.value=THREE.BloomPass.blurX;a.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,this.renderTargetX,!0);this.convolutionUniforms.tDiffuse.texture=this.renderTargetX;this.convolutionUniforms.uImageIncrement.value=THREE.BloomPass.blurY;a.render(THREE.EffectComposer.scene,
THREE.EffectComposer.camera,this.renderTargetY,!0);THREE.EffectComposer.quad.material=this.materialScreen;this.screenUniforms.tDiffuse.texture=this.renderTargetY;f&&a.context.enable(a.context.STENCIL_TEST);a.render(THREE.EffectComposer.scene,THREE.EffectComposer.camera,c,this.clear)}};THREE.BloomPass.blurX=new THREE.Vector2(0.001953125,0);THREE.BloomPass.blurY=new THREE.Vector2(0,0.001953125);
Detector={canvas:!!window.CanvasRenderingContext2D,webgl:function(){try{return!!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(a){return!1}}(),workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,getWebGLErrorMessage:function(){var a=document.createElement("div");a.id="webgl-error-message";a.style.fontFamily="monospace";a.style.fontSize="13px";a.style.fontWeight="normal";a.style.textAlign="center";a.style.background=
"#fff";a.style.color="#000";a.style.padding="1.5em";a.style.width="400px";a.style.margin="5em auto 0";if(!this.webgl)a.innerHTML=window.WebGLRenderingContext?'Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />\nFind out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.':'Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>\nFind out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.';
return a},addGetWebGLMessage:function(a){var b,c,a=a||{};b=a.parent!==void 0?a.parent:document.body;a=a.id!==void 0?a.id:"oldie";c=Detector.getWebGLErrorMessage();c.id=a;b.appendChild(c)}};
var SimplexNoise=function(a){a==void 0&&(a=Math);this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]];this.grad4=[[0,1,1,1],[0,1,1,-1],[0,1,-1,1],[0,1,-1,-1],[0,-1,1,1],[0,-1,1,-1],[0,-1,-1,1],[0,-1,-1,-1],[1,0,1,1],[1,0,1,-1],[1,0,-1,1],[1,0,-1,-1],[-1,0,1,1],[-1,0,1,-1],[-1,0,-1,1],[-1,0,-1,-1],[1,1,0,1],[1,1,0,-1],[1,-1,0,1],[1,-1,0,-1],[-1,1,0,1],[-1,1,0,-1],[-1,-1,0,1],[-1,-1,0,-1],[1,1,1,0],[1,1,-1,0],[1,-1,1,0],[1,-1,-1,0],
[-1,1,1,0],[-1,1,-1,0],[-1,-1,1,0],[-1,-1,-1,0]];this.p=[];for(var b=0;b<256;b++)this.p[b]=Math.floor(a.random()*256);this.perm=[];for(b=0;b<512;b++)this.perm[b]=this.p[b&255];this.simplex=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,
3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]]};SimplexNoise.prototype.dot=function(a,b,c){return a[0]*b+a[1]*c};
SimplexNoise.prototype.noise=function(a,b){var c,d,f;f=0.5*(Math.sqrt(3)-1);f*=a+b;var g=Math.floor(a+f),e=Math.floor(b+f),h=(3-Math.sqrt(3))/6;f=(g+e)*h;c=a-(g-f);var i=b-(e-f),j,k;c>i?(j=1,k=0):(j=0,k=1);d=c-j+h;var q=i-k+h;f=c-1+2*h;var h=i-1+2*h,n=g&255;e&=255;g=this.perm[n+this.perm[e]]%12;j=this.perm[n+j+this.perm[e+k]]%12;k=this.perm[n+1+this.perm[e+1]]%12;e=0.5-c*c-i*i;e<0?c=0:(e*=e,c=e*e*this.dot(this.grad3[g],c,i));i=0.5-d*d-q*q;i<0?d=0:(i*=i,d=i*i*this.dot(this.grad3[j],d,q));q=0.5-f*f-
h*h;q<0?f=0:(q*=q,f=q*q*this.dot(this.grad3[k],f,h));return 70*(c+d+f)};
SimplexNoise.prototype.noise3d=function(a,b,c){var d,f,g,e=(a+b+c)*(1/3),h=Math.floor(a+e),i=Math.floor(b+e),j=Math.floor(c+e),e=1/6;g=(h+i+j)*e;d=a-(h-g);f=b-(i-g);var k=c-(j-g),q,n,o,s,m,p;d>=f?f>=k?(q=1,o=n=0,m=s=1,p=0):(d>=k?(q=1,o=n=0):(n=q=0,o=1),s=1,m=0,p=1):f<k?(n=q=0,o=1,s=0,p=m=1):d<k?(q=0,n=1,s=o=0,p=m=1):(q=0,n=1,o=0,m=s=1,p=0);var r=d-q+e,t=f-n+e,v=k-o+e;g=d-s+2*e;var a=f-m+2*e,u=k-p+2*e,c=d-1+3*e,b=f-1+3*e,e=k-1+3*e;h&=255;var w=i&255,y=j&255,i=this.perm[h+this.perm[w+this.perm[y]]]%
12,j=this.perm[h+q+this.perm[w+n+this.perm[y+o]]]%12;s=this.perm[h+s+this.perm[w+m+this.perm[y+p]]]%12;h=this.perm[h+1+this.perm[w+1+this.perm[y+1]]]%12;m=0.6-d*d-f*f-k*k;m<0?d=0:(m*=m,d=m*m*this.dot(this.grad3[i],d,f,k));f=0.6-r*r-t*t-v*v;f<0?f=0:(f*=f,f=f*f*this.dot(this.grad3[j],r,t,v));r=0.6-g*g-a*a-u*u;r<0?g=0:(r*=r,g=r*r*this.dot(this.grad3[s],g,a,u));a=0.6-c*c-b*b-e*e;a<0?c=0:(a*=a,c=a*a*this.dot(this.grad3[h],c,b,e));return 32*(d+f+g+c)};
SimplexNoise.prototype.noise4d=function(a,b,c,d){var f=this.grad4,g=this.simplex,e=this.perm,h=(Math.sqrt(5)-1)/4,i=(5-Math.sqrt(5))/20,j,k;h*=a+b+c+d;var q=Math.floor(a+h),n=Math.floor(b+h),o=Math.floor(c+h),s=Math.floor(d+h),h=(q+n+o+s)*i;a-=q-h;j=b-(n-h);k=c-(o-h);var m=d-(s-h),d=(a>j?32:0)+(a>k?16:0)+(j>k?8:0)+(a>m?4:0)+(j>m?2:0)+(k>m?1:0),p,r,t,v,u,w,y,F,D,G,I,K;p=g[d][0]>=3?1:0;r=g[d][1]>=3?1:0;t=g[d][2]>=3?1:0;v=g[d][3]>=3?1:0;u=g[d][0]>=2?1:0;w=g[d][1]>=2?1:0;y=g[d][2]>=2?1:0;F=g[d][3]>=2?
1:0;D=g[d][0]>=1?1:0;G=g[d][1]>=1?1:0;I=g[d][2]>=1?1:0;K=g[d][3]>=1?1:0;var Q=a-p+i,N=j-r+i,B=k-t+i,O=m-v+i,S=a-u+2*i,A=j-w+2*i,l=k-y+2*i,V=m-F+2*i,b=a-D+3*i,h=j-G+3*i,E=k-I+3*i,z=m-K+3*i,g=a-1+4*i,d=j-1+4*i,c=k-1+4*i,i=m-1+4*i;q&=255;n&=255;var T=o&255;s&=255;o=e[q+e[n+e[T+e[s]]]]%32;p=e[q+p+e[n+r+e[T+t+e[s+v]]]]%32;u=e[q+u+e[n+w+e[T+y+e[s+F]]]]%32;D=e[q+D+e[n+G+e[T+I+e[s+K]]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-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,55,27,18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,
8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5,8,18,9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7,-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,-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,-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,-1,
-1,-1,-1,-1,-1,-1,23,21,4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0,-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,-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,-1,-1,-1,-1,-1,-1,18,21,18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8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-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,23,24,3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,
10,10,14,7,16,6,18,6,20,7,21,10,21,12,-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,-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,-1,-1,-1,-1,-1,-1]}a.prototype.geo=function(a,b,f,g,e){var h,i,j,k,q;h=b*112;k=this.simplex[h+1];b=2;for(j=null;b<112;)i=this.simplex[h+b],q=this.simplex[h+b+1],i!==-1?(i=new THREE.Vector3(g+i*f,e+q*f,0),j!==null&&(a.vertices.push(new THREE.Vertex(j)),a.vertices.push(new THREE.Vertex(i))),
j=i):j=null,b+=2;return k*f};a.prototype.string=function(a,b,f,g,e,h){var i,j;for(i=0,j=b.length;0<=j?i<j:i>j;0<=j?i++:i--)e+=g*this.geo(a,b[i].charCodeAt()-32,f,e,h);return e};return a}();window.Font=a}).call(this);
(function(){var a,b,c,d=function(a,b){return function(){return a.apply(b,arguments)}};b=[8,8.8,10.958680152893066,12.61650276184082,14.601560592651367,17.010347366333008,18.838289260864258,20.751585006713867,22.681140899658203,24.998794555664062,26.718717575073242,28.879898071289062,30.824119567871094,32.76889419555664,34.62220764160156,36.743682861328125,38.80118942260742,82,84.08052825927734,85.05418395996094,87.00751495361328,88.88626861572266,90.89228820800781,92.864013671875,94.76422119140625,
96.7853775024414,98.87133026123047,101.07428741455078,103.0054931640625,104.9276351928711,106.9382095336914,108.82271575927734,110.85637664794922,112.95880126953125,114.06067657470703,114.5520248413086,114.73357391357422,114.94976806640625,115.36976623535156,116.0377426147461,116.55489349365234,116.79854583740234,117.31492614746094,117.83196258544922,118.1103515625,118.54364013671875,118.82699584960938,119.25975799560547,119.82899475097656,120.07881164550781];c=function(a,b,c,d,i){return Math.pow(Math.max(0,
1-Math.abs(a-b)/c),a<b?d:i)};a=function(){function a(b){this.draw=d(this.draw,this);this.getBrightness=d(this.getBrightness,this);this.onWindowResize=d(this.onWindowResize,this);this.onDocumentKeyDown=d(this.onDocumentKeyDown,this);this.onDocumentTouchMove=d(this.onDocumentTouchMove,this);this.onDocumentTouchStart=d(this.onDocumentTouchStart,this);this.onDocumentMouseMove=d(this.onDocumentMouseMove,this);var c,f;this.mouseX=this.mouseY=0;window.demo=this;this.container=document.createElement("div");
document.body.appendChild(this.container);this.font=new Font;this.noise=new SimplexNoise;this.renderer=new THREE.WebGLRenderer({clearColor:0,clearAlpha:1,antialias:!1});this.renderer.setSize(window.innerWidth,window.innerHeight);this.renderer.autoClear=!1;this.container.appendChild(this.renderer.domElement);this.onWindowResize();window.addEventListener("resize",this.onWindowResize,!1);document.addEventListener("keydown",this.onDocumentKeyDown,!1);document.addEventListener("mousemove",this.onDocumentMouseMove,
!1);document.addEventListener("touchstart",this.onDocumentTouchStart,!1);document.addEventListener("touchmove",this.onDocumentTouchMove,!1);this.effectBloom=new THREE.BloomPass(1.3);this.effectColor=new THREE.ShaderPass(THREE.ShaderExtras.colorCorrection);f=new THREE.ShaderPass(THREE.ShaderExtras.screen);c=new THREE.ShaderPass(THREE.ShaderExtras.fxaa);c.uniforms.resolution.value.set(1/window.innerWidth,1/window.innerHeight);f.renderToScreen=!0;this.composer=new THREE.EffectComposer(this.renderer);
this.fxIntro=new FxIntro(this.font);this.composer.addPass(this.fxIntro.pass);this.fxTitle=new FxTitle(this.font);this.fxGreets=new FxGreets(this.font);this.fxEnd=new FxEnd(this.font);this.composer.addPass(c);this.composer.addPass(this.effectColor);this.composer.addPass(this.effectBloom);this.composer.addPass(f);this.audio=document.getElementById("audio");this.audio.currentTime=b;this.audio.play()}a.prototype.onDocumentMouseMove=function(a){this.mouseX=a.clientX-window.innerWidth/2;return this.mouseY=
a.clientY-window.innerHeight/2};a.prototype.onDocumentTouchStart=function(a){if(a.touches.length>1)return a.preventDefault(),this.mouseX=a.touches[0].pageX-window.innerWidth/2,this.mouseY=a.touches[0].pageY-window.innerHeight/2};a.prototype.onDocumentTouchMove=function(a){if(a.touches.length===1)return a.preventDefault(),this.mouseX=a.touches[0].pageX-window.innerWidth/2,this.mouseY=a.touches[0].pageY-window.innerHeight/2};a.prototype.onDocumentKeyDown=function(){};a.prototype.onWindowResize=function(){this.renderer.setSize(window.innerWidth,
window.innerHeight);this.renderer.domElement.style.width=window.innerWidth+"px";return this.renderer.domElement.style.height=window.innerHeight+"px"};a.prototype.getBrightness=function(a){var d,f,i;d=1;for(f=0,i=b.length;0<=i?f<i:f>i;0<=i?f++:f--){if(b[f]>a+2)break;d+=4*c(a,b[f],2,64,2)}return d};a.prototype.draw=function(){var a,b;b=this.audio.currentTime;this.level=1;if(b<40)this.fxIntro.update(b),this.composer.passes[0]=this.fxIntro.pass,this.level=Math.pow(Math.min(b/8,1),2);else if(b<82)this.fxTitle.update(b),
this.composer.passes[0]=this.fxTitle.pass;else if(b<114)this.fxGreets.update(b),this.composer.passes[0]=this.fxGreets.pass;else if(this.fxEnd.update(b),this.composer.passes[0]=this.fxEnd.pass,b>120)this.level=Math.max(0,1-(b-120)/2);a=this.getBrightness(b);this.level*=a;this.effectBloom.screenUniforms.opacity.value=1.5+Math.max(0,a-1)/4;if(b<40)this.effectColor.uniforms.powRGB.value.set(2,2,2);else if(b<114)this.effectBloom.screenUniforms.opacity.value=2.5+Math.max(0,a-1)/4,this.effectColor.uniforms.powRGB.value.set(1,
1,1);this.effectColor.uniforms.mulRGB.value.set(this.level,this.level,this.level);this.renderer.clear();return this.composer.render()};return a}();Detector.webgl||Detector.addGetWebGLMessage();window.start=function(b){var c,d;document.body.removeChild(document.getElementById("splash"));d=new a(b);c=function(){requestAnimationFrame(c);return d.draw()};return c()}}).call(this);
(function(){var a;a=256;window.FxIntro=function(){function b(){var b,d,f,g,e,h;this.scene=new THREE.Scene;this.camera=new THREE.PerspectiveCamera(15,window.innerWidth/window.innerHeight,1,1E4);this.camera.position.z=300;this.scene.add(this.camera);this.pass=new THREE.RenderPass(this.scene,this.camera);for(b=0;0<=a?b<a:b>a;0<=a?b++:b--){f=new THREE.Geometry;d=[];e=0;e+=demo.font.string(f,"vrtx .... - * - ... vrtx",1,0.75,e,0);for(g=0,h=f.vertices.length;0<=h?g<h:g>h;0<=h?g++:g--)d[g]=new THREE.Color(16777215),
d[g].setHSV(0.6,(1-Math.sin(f.vertices[g].position.x/e*Math.PI))*0.75,1);f.colors=d;for(g=0,h=f.vertices.length;0<=h?g<h:g>h;0<=h?g++:g--)d=f.vertices[g].position.clone(),d.x-=e*0.5,f.vertices[g]=new THREE.Vertex(d);g=new THREE.LineBasicMaterial({color:16777215,opacity:1,linewidth:3});g.vertexColors=!0;g.opacity=Math.pow(1-b/a,2);g.transparent=!0;g.depthTest=!1;g.blending=THREE.AdditiveAlphaBlending;e=[[g,1-b/a,[0,0,b],f]];for(g=0,h=e.length;0<=h?g<h:g>h;0<=h?g++:g--)d=e[g],f=new THREE.Line(d[3],
d[0],THREE.LinePieces),f.scale.x=f.scale.y=f.scale.z=d[1],f.position.x=d[2][0],f.position.y=d[2][1],f.position.z=d[2][2],this.scene.add(f)}}b.prototype.update=function(b){var d,f,g,e,h;this.camera.fov=b<30?160-100*b/15:-40-Math.pow((b-30)/10*2,2);this.camera.updateProjectionMatrix();f=1;b<10&&(f=b/10);b>35&&(f=(40-b)/5);this.camera.lookAt(new THREE.Vector3(0,0,0));for(d=0,h=this.scene.children.length;0<=h?d<h:d>h;0<=h?d++:d--)if(g=this.scene.children[d],g instanceof THREE.Line)e=b-d/a*4,g.position.x=
0+Math.sin(e/8*Math.PI*2)*150,g.position.y=demo.noise.noise(e*0.5+0.13251,-e*0.2135+0.7647)*5+demo.noise.noise(g.position.x/50,0)*25,g.rotation.z=e*0.2,e=demo.getBrightness(e),g.rotation.z+=e*Math.PI/4,g.rotation.y=Math.PI+e*e*Math.PI/32,g.rotation.x=Math.PI+e*e*e*Math.PI/64,g.material.opacity=(1-d/a)*f};return b}()}).call(this);
(function(){var a;a=64;window.FxTitle=function(){function b(){var b,d,f,g,e,h;this.scene=new THREE.Scene;this.camera=new THREE.PerspectiveCamera(15,window.innerWidth/window.innerHeight,1,1E4);this.camera.position.z=300;this.scene.add(this.camera);this.pass=new THREE.RenderPass(this.scene,this.camera);for(b=0;0<=a?b<a:b>a;0<=a?b++:b--){f=new THREE.Geometry;d=[];e=25;e+=demo.font.string(f,"compo/filler",1,0.75,e,0);for(g=0,h=f.vertices.length;0<=h?g<h:g>h;0<=h?g++:g--)d[g]=new THREE.Color(16777215),
d[g].setHSV(0.6,Math.pow(f.vertices[g].position.x/e,2),1);f.colors=d;g=new THREE.LineBasicMaterial({color:16777215,opacity:1,linewidth:2});g.vertexColors=!0;g.opacity=0.9;g.transparent=!0;g.depthTest=!1;g.blending=THREE.AdditiveAlphaBlending;e=[[g,1,[0,0,0],f]];for(g=0,h=e.length;0<=h?g<h:g>h;0<=h?g++:g--)d=e[g],f=new THREE.Line(d[3],d[0],THREE.LinePieces),f.scale.x=f.scale.y=f.scale.z=d[1],f.position.x=d[2][0],f.position.y=d[2][1],f.position.z=d[2][2],this.scene.add(f)}}b.prototype.update=function(a){var b,
f,g,e,h,i,j;b=10*(1+(a-40)/10);i=0+Math.pow((a-40)/25,2.5)*3;this.camera.fov=120;this.camera.position.x=0;this.camera.position.y=-75+(a-40)*b;this.camera.position.z=100;a<42&&(f=Math.pow(1-(a-40)/2,2),this.camera.position.x+=f*demo.noise.noise(a*30,(1-f)*10)*30,this.camera.position.y+=f*demo.noise.noise((1-f)*20,-a*4)*30);this.camera.fov=a<50?120:120-(a-50)*5;this.camera.updateProjectionMatrix();this.camera.lookAt(new THREE.Vector3(0,0,0));g=0;for(b=0,j=this.scene.children.length;0<=j?b<j:b>j;0<=
j?b++:b--)if(e=this.scene.children[b],e instanceof THREE.Line){h=Math.floor(g/8);e.rotation.y=a*i+Math.PI*2*(g%8)/8;e.rotation.y+=a*h*Math.PI/7;if(a>42)e.visible=a<50?g<8:!0,e.position.y=h*100,e.material.opacity=0.9;else if(e.position.y=0,e.visible=!0,h>0)e.rotation.y+=f*demo.noise.noise(-a*30,-(1-f)*10)*Math.PI,e.rotation.x=f*demo.noise.noise(-a*30,-(1-f)*10)*Math.PI/16,e.material.opacity=0.9*f+0.1;g+=1}};return b}()}).call(this);
(function(){var a,b;b=6;a="aardbei,and,asd,auld,bombsquad,brainstorm,calodox,cocoon,conspiracy,evoflash,exceed,fairlight,farbrausch,fuzzion,gl.fusion,haujobb,kewlers,kolor,matt current,melon dezign,mfx,nesnausk!,northern dragons,orion,outracks,plastic,portal process,pouet.net,powerpuff girls,pulse,rgba,spinning kids,spontz,stravaganza,sunflower,synesthetics,the black lotus,threepixels,threestate,traction,trailer park demos,sketch club,united force,demoscene.us,xplsv".split(",");window.FxGreets=function(){function c(){var c,
f,g,e,h,i,j;this.scene=new THREE.Scene;this.camera=new THREE.PerspectiveCamera(15,window.innerWidth/window.innerHeight,1,1E4);this.camera.position.z=300;this.scene.add(this.camera);this.pass=new THREE.RenderPass(this.scene,this.camera);for(f=0,i=a.length*b;0<=i?f<i:f>i;0<=i?f++:f--){g=new THREE.Geometry;c=[];h=0;h+=demo.font.string(g,a[f%a.length],1,0.75,h,0);for(e=0,j=g.vertices.length;0<=j?e<j:e>j;0<=j?e++:e--)c[e]=new THREE.Color(16777215),c[e].setHSV(0.6+(Math.random()*2-1)*0.2,Math.pow(g.vertices[e].position.x/
h,2),1);g.colors=c;for(e=0,j=g.vertices.length;0<=j?e<j:e>j;0<=j?e++:e--)c=g.vertices[e].position.clone(),c.x-=h*0.5,g.vertices[e]=new THREE.Vertex(c);e=new THREE.LineBasicMaterial({color:16777215,opacity:1,linewidth:2});e.vertexColors=!0;e.opacity=0.9;e.transparent=!0;e.depthTest=!1;e.blending=THREE.AdditiveAlphaBlending;h=[[e,1,[0,0,0],g]];for(e=0,j=h.length;0<=j?e<j:e>j;0<=j?e++:e--)c=h[e],g=new THREE.Line(c[3],c[0],THREE.LinePieces),g.scale.x=g.scale.y=g.scale.z=c[1],g.position.x=c[2][0],g.position.y=
c[2][1],g.position.z=c[2][2],this.scene.add(g)}}c.prototype.update=function(a){var b,c,e,h,i,j,k,q;b=(a-82)/32;this.camera.fov=60+30*b;this.camera.position.x=800*b;this.camera.position.y=-50+b*40;this.camera.position.z=200-b*200;this.camera.updateProjectionMatrix();this.camera.lookAt(new THREE.Vector3(200-b*300,0,0));e=0;for(c=0,q=this.scene.children.length;0<=q?c<q:c>q;0<=q?c++:c--)if(h=this.scene.children[c],h instanceof THREE.Line){i=e*0.4345+0.17295;j=e*0.2345987+0.927435;b=Math.max(0.1,Math.min(1,
demo.noise.noise(i*j,-j)*0.5+0.5));k=500+demo.noise.noise(i*i,j)*500;h.position.x=demo.noise.noise(i,j)*1E3;h.position.y=demo.noise.noise(-j,i+j)*500;h.position.z=-demo.noise.noise(-i+j,-j)*500;for(h.position.x-=a*k;h.position.x<-1E3;)h.position.x+=2E3;h.material.opacity=1;if(h.position.x>800)h.material.opacity=Math.max(0,1-(h.position.x-800)/200);if(h.position.x<-800)h.material.opacity=Math.max(0,1-(-h.position.x-800)/200);h.material.opacity*=0.8*b;e+=1}};return c}()}).call(this);
(function(){var a;a=32;window.FxEnd=function(){function b(){var b,d,f,g,e,h,i,j,k;this.scene=new THREE.Scene;this.camera=new THREE.PerspectiveCamera(33,window.innerWidth/window.innerHeight,1,1E4);this.camera.position.z=700;this.scene.add(this.camera);this.pass=new THREE.RenderPass(this.scene,this.camera);for(b=0;0<=a?b<a:b>a;0<=a?b++:b--){g=new THREE.Geometry;e=new THREE.Geometry;d=[];f=[];i=0;i+=demo.font.string(g,"vrtx @ ",10,0.75,i,0);j=0;j+=demo.font.string(e,"pixelj.am 2012",10,0.75,j,0);for(h=
0,k=g.vertices.length;0<=k?h<k:h>k;0<=k?h++:h--)d[h]=new THREE.Color(16777215),d[h].setHSV(0.6,0,1);g.colors=d;for(h=0,k=g.vertices.length;0<=k?h<k:h>k;0<=k?h++:h--)d=g.vertices[h].position.clone(),d.x-=i*0.5,g.vertices[h]=new THREE.Vertex(d);for(h=0,d=e.vertices.length;0<=d?h<d:h>d;0<=d?h++:h--)f[h]=new THREE.Color(16777215),f[h].setHSV(0.6,0,1);e.colors=f;for(h=0,f=e.vertices.length;0<=f?h<f:h>f;0<=f?h++:h--)d=e.vertices[h].position.clone(),d.x-=j*0.5,e.vertices[h]=new THREE.Vertex(d);h=new THREE.LineBasicMaterial({color:16777215,
opacity:1,linewidth:3});h.vertexColors=!0;h.opacity=0.9;h.transparent=!0;h.depthTest=!1;h.blending=THREE.AdditiveAlphaBlending;e=[[h,1,[0,0,0],g],[h,1,[0,0,0],e]];for(h=0,j=e.length;0<=j?h<j:h>j;0<=j?h++:h--)d=e[h],g=new THREE.Line(d[3],d[0],THREE.LinePieces),g.scale.x=g.scale.y=g.scale.z=d[1],g.position.x=d[2][0],g.position.y=d[2][1],g.position.z=d[2][2],this.scene.add(g)}}b.prototype.update=function(a){var b,f,g,e,h;this.camera.fov=120;this.camera.updateProjectionMatrix();this.camera.lookAt(this.scene.position);
b=demo.getBrightness(a);f=0;for(g=0,h=this.scene.children.length;0<=h?g<h:g>h;0<=h?g++:g--)if(e=this.scene.children[g],e instanceof THREE.Line)e.rotation.z=-Math.PI/4,f%2?(e.position.x=0,e.rotation.z=Math.PI/4):(e.position.x=-500,e.position.y=400),f++,e.position.x+=200,e.rotation.x=-(b-1)*Math.PI/128+demo.noise.noise(f*a*0.0625,0.2346)*Math.PI/32*Math.min(1,b-1),e.material.opacity=Math.max(Math.min(b-1.5,1),0)*0.0625};return b}()}).call(this);
