Detector={canvas:!!window.CanvasRenderingContext2D,webgl:!!window.WebGLRenderingContext,workers:!!window.Worker,fileapi:window.File&&window.FileReader&&window.FileList&&window.Blob,addGetWebGLMessage:function(b){var c=document.body,d="oldie";if(b){if(b.parent!==void 0)c=b.parent;if(b.id!==void 0)d=b.id}var b=document.createElement("center"),e=document.createElement("div");e.innerHTML='Sorry, your browser doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a><br/>\n<br/>\nPlease try with\n<a href="http://www.google.com/chrome">Chrome 9+</a> /\n<a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 4+</a> /\n<a href="http://nightly.webkit.org/">Safari 10.6+</a>';
e.id=d;d=e.style;d.fontFamily="monospace";d.fontSize="13px";d.textAlign="center";d.background="#eee";d.color="#000";d.padding="1em";d.width="475px";d.margin="5em auto 0";b.appendChild(e);c.appendChild(b);return e}};if(!window.requestAnimationFrame)window.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b){window.setTimeout(b,1E3/60)}}();var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){this.setHex(b)};
THREE.Color.prototype={copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;this.hex=b.hex},setHex:function(b){this.hex=~~b&16777215;this.updateRGB()},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;this.updateHex()},setHSV:function(b,c,d){var e,f,g,j,k,o;if(d==0)e=f=g=0;else switch(j=Math.floor(b*6),k=b*6-j,b=d*(1-c),o=d*(1-c*k),c=d*(1-c*(1-k)),j){case 1:e=o;f=d;g=b;break;case 2:e=b;f=d;g=c;break;case 3:e=b;f=o;g=d;break;case 4:e=c;f=b;g=d;break;case 5:e=d;f=b;g=o;break;case 6:case 0:e=d,f=c,g=b}this.setRGB(e,
f,g)},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(b,c){this.set(b||0,c||0)};
THREE.Vector2.prototype={set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},divideScalar:function(b){b?
(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
unit:function(){return this.normalize()},equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,d){this.set(b||0,c||0,d||0)};
THREE.Vector3.prototype={set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;return this},subSelf:function(b){this.x-=
b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){return this.divide(this,b)},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*
b.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*
b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<1.0E-4}};
THREE.Vector4=function(b,c,d,e){this.set(b||0,c||0,d||0,e||1)};
THREE.Vector4.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){return this.set(b.x,b.y,b.z,b.w||1)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=
b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):this.set(0,0,0,1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},
setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)e=e.concat(this.intersectObject(b[c]));e.sort(function(b,d){return b.distance-d.distance});return e},intersectObject:function(b){function c(b,d,c){var e;e=c.position.clone().subSelf(b).dot(d);b=b.clone().addSelf(d.clone().multiplyScalar(e));return c.position.distanceTo(b)}function d(b,d,c,e){var e=e.clone().subSelf(d),c=c.clone().subSelf(d),
f=b.clone().subSelf(d),b=e.dot(e),d=e.dot(c),e=e.dot(f),g=c.dot(c),c=c.dot(f),f=1/(b*g-d*d),g=(g*e-d*c)*f,b=(b*c-d*e)*f;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b);return!e||e>b.scale.x?[]:[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b);if(!e||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var f,g,j,k,o,p,n,t,m,u,v=b.geometry,x=v.vertices,
z=[],e=0;for(f=v.faces.length;e<f;e++)if(g=v.faces[e],m=this.origin.clone(),u=this.direction.clone(),p=b.matrixWorld,j=p.multiplyVector3(x[g.a].position.clone()),k=p.multiplyVector3(x[g.b].position.clone()),o=p.multiplyVector3(x[g.c].position.clone()),p=g instanceof THREE.Face4?p.multiplyVector3(x[g.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),t=u.dot(n),b.doubleSided||(b.flipSided?t>0:t<0))if(n=n.dot((new THREE.Vector3).sub(j,m))/t,m=m.addSelf(u.multiplyScalar(n)),
g instanceof THREE.Face3)d(m,j,k,o)&&(g={distance:this.origin.distanceTo(m),point:m,face:g,object:b},z.push(g));else if(g instanceof THREE.Face4&&(d(m,j,k,p)||d(m,k,o,p)))g={distance:this.origin.distanceTo(m),point:m,face:g,object:b},z.push(g);return z}else return[]}};
THREE.Rectangle=function(){function b(){g=e-c;j=f-d}var c,d,e,f,g,j,k=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(g,j,n,t){k=false;c=g;d=j;e=n;f=t;b()};this.addPoint=function(g,j){k?(k=false,c=g,d=j,e=g,f=j):(c=c<g?c:g,d=d<j?d:j,e=e>g?e:g,f=f>j?f:j);b()};
this.add3Points=function(g,j,n,t,m,u){k?(k=false,c=g<n?g<m?g:m:n<m?n:m,d=j<t?j<u?j:u:t<u?t:u,e=g>n?g>m?g:m:n>m?n:m,f=j>t?j>u?j:u:t>u?t:u):(c=g<n?g<m?g<c?g:c:m<c?m:c:n<m?n<c?n:c:m<c?m:c,d=j<t?j<u?j<d?j:d:u<d?u:d:t<u?t<d?t:d:u<d?u:d,e=g>n?g>m?g>e?g:e:m>e?m:e:n>m?n>e?n:e:m>e?m:e,f=j>t?j>u?j>f?j:f:u>f?u:f:t>u?t>f?t:f:u>f?u:f);b()};this.addRectangle=function(g){k?(k=false,c=g.getLeft(),d=g.getTop(),e=g.getRight(),f=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),d=d<g.getTop()?d:g.getTop(),e=e>g.getRight()?
e:g.getRight(),f=f>g.getBottom()?f:g.getBottom());b()};this.inflate=function(g){c-=g;d-=g;e+=g;f+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e<g.getRight()?e:g.getRight();f=f<g.getBottom()?f:g.getBottom();b()};this.instersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(f,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=true;f=e=d=c=0;b()};this.isEmpty=function(){return k}};
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};
THREE.Matrix4=function(b,c,d,e,f,g,j,k,o,p,n,t,m,u,v,x){this.set(b||1,c||0,d||0,e||0,f||0,g||1,j||0,k||0,o||0,p||0,n||1,t||0,m||0,u||0,v||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={set:function(b,c,d,e,f,g,j,k,o,p,n,t,m,u,v,x){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=o;this.n32=p;this.n33=n;this.n34=t;this.n41=m;this.n42=u;this.n43=v;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,c,d){var e=THREE.Matrix4.__v1,
f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(b,c).normalize();if(g.length()===0)g.z=1;e.cross(d,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(d,g).normalize());f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,f=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*f;b.y=(this.n21*c+this.n22*d+this.n23*
e+this.n24)*f;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*f;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,f=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*f;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*f;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*f;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*f;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+d*this.n32+e*this.n33;b.normalize();
return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,m=b.n33,u=b.n34,v=b.n41,x=b.n42,z=b.n43,y=b.n44,I=c.n11,C=c.n12,G=c.n13,A=c.n14,L=c.n21,K=c.n22,
E=c.n23,D=c.n24,F=c.n31,Z=c.n32,P=c.n33,W=c.n34;this.n11=d*I+e*L+f*F;this.n12=d*C+e*K+f*Z;this.n13=d*G+e*E+f*P;this.n14=d*A+e*D+f*W+g;this.n21=j*I+k*L+o*F;this.n22=j*C+k*K+o*Z;this.n23=j*G+k*E+o*P;this.n24=j*A+k*D+o*W+p;this.n31=n*I+t*L+m*F;this.n32=n*C+t*K+m*Z;this.n33=n*G+t*E+m*P;this.n34=n*A+t*D+m*W+u;this.n41=v*I+x*L+z*F;this.n42=v*C+x*K+z*Z;this.n43=v*G+x*E+z*P;this.n44=v*A+x*D+z*W+y;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=
this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=
this.n11,c=this.n12,d=this.n13,e=this.n14,f=this.n21,g=this.n22,j=this.n23,k=this.n24,o=this.n31,p=this.n32,n=this.n33,t=this.n34,m=this.n41,u=this.n42,v=this.n43,x=this.n44;return e*j*p*m-d*k*p*m-e*g*n*m+c*k*n*m+d*g*t*m-c*j*t*m-e*j*o*u+d*k*o*u+e*f*n*u-b*k*n*u-d*f*t*u+b*j*t*u+e*g*o*v-c*k*o*v-e*f*p*v+b*k*p*v+c*f*t*v-b*g*t*v-d*g*o*x+c*j*o*x+d*f*p*x-b*j*p*x-c*f*n*x+b*g*n*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=
this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;
this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=
this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,
c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),f=1-d,g=b.x,j=b.y,k=b.z,o=f*g,p=f*j;this.set(o*
g+d,o*j-e*k,o*k+e*j,0,o*j+e*k,p*j+d,p*k-e*g,0,o*k-e*j,p*k+e*g,f*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;
this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b){var c=b.x,d=b.y,e=b.z,b=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),g=Math.cos(e),e=Math.sin(e),j=b*d,k=c*d;this.n11=f*g;this.n12=-f*e;this.n13=d;this.n21=k*g+b*e;this.n22=-k*e+b*g;this.n23=-c*f;this.n31=-j*g+c*e;this.n32=j*e+c*g;this.n33=b*f;return this},
setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,f=b.w,g=c+c,j=d+d,k=e+e,b=c*g,o=c*j;c*=k;var p=d*j;d*=k;e*=k;g*=f;j*=f;f*=k;this.n11=1-(p+e);this.n12=o-f;this.n13=c+j;this.n21=o+f;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},extractPosition:function(b){this.n14=
b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,f=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*f;this.n23=b.n23*f;this.n33=b.n33*f}};
THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,f=b.n13,g=b.n14,j=b.n21,k=b.n22,o=b.n23,p=b.n24,n=b.n31,t=b.n32,m=b.n33,u=b.n34,v=b.n41,x=b.n42,z=b.n43,y=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*u*x-p*m*x+p*t*z-k*u*z-o*t*y+k*m*y;c.n12=g*m*x-f*u*x-g*t*z+e*u*z+f*t*y-e*m*y;c.n13=f*p*x-g*o*x+g*k*z-e*p*z-f*k*y+e*o*y;c.n14=g*o*t-f*p*t-g*k*m+e*p*m+f*k*u-e*o*u;c.n21=p*m*v-o*u*v-p*n*z+j*u*z+o*n*y-j*m*y;c.n22=f*u*v-g*m*v+g*n*z-d*u*z-f*n*y+d*m*y;c.n23=g*o*v-f*p*v-g*j*z+d*p*z+f*j*y-d*o*y;c.n24=
f*p*n-g*o*n+g*j*m-d*p*m-f*j*u+d*o*u;c.n31=k*u*v-p*t*v+p*n*x-j*u*x-k*n*y+j*t*y;c.n32=g*t*v-e*u*v-g*n*x+d*u*x+e*n*y-d*t*y;c.n33=f*p*v-g*k*v+g*j*x-d*p*x-e*j*y+d*k*y;c.n34=g*k*n-e*p*n-g*j*t+d*p*t+e*j*u-d*k*u;c.n41=o*t*v-k*m*v-o*n*x+j*m*x+k*n*z-j*t*z;c.n42=e*m*v-f*t*v+f*n*x-d*m*x-e*n*z+d*t*z;c.n43=f*k*v-e*o*v-f*j*x+d*o*x+e*j*z-d*k*z;c.n44=e*o*n-f*k*n+f*j*t-d*o*t-e*j*m+d*k*m;c.multiplyScalar(1/b.determinant());return c};
THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,f=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*f;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*o;d[6]=b*p;d[7]=b*n;d[8]=b*t;return c};
THREE.Matrix4.makeFrustum=function(b,c,d,e,f,g){var j;j=new THREE.Matrix4;j.n11=2*f/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*f/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+f)/(g-f);j.n34=-2*g*f/(g-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var f,b=d*Math.tan(b*Math.PI/360);f=-b;return THREE.Matrix4.makeFrustum(f*c,b*c,f,b,d,e)};
THREE.Matrix4.makeOrtho=function(b,c,d,e,f,g){var j,k,o,p;j=new THREE.Matrix4;k=c-b;o=d-e;p=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/o;j.n23=0;j.n24=-((d+e)/o);j.n31=0;j.n32=0;j.n33=-2/p;j.n34=-((g+f)/p);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=false;this.renderDepth=null;this.rotationAutoUpdate=true;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=true;this.quaternion=new THREE.Quaternion;this.useQuaternion=
false;this.boundRadius=0;this.boundRadiusScale=1;this.visible=true;this._vector=new THREE.Vector3;this.name=""};
THREE.Object3D.prototype={translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var d,e,f;d=0;for(e=this.children.length;d<e;d++){f=this.children[d];if(f.name===b)return f;if(c&&(f=f.getChildByName(b,c),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);
this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=true},update:function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=false,c=true;for(var b=0,e=this.children.length;b<e;b++)this.children[b].update(this.matrixWorld,c,d)}};THREE.Quaternion=function(b,c,d,e){this.set(b||0,c||0,d||0,e!==void 0?e:1)};
THREE.Quaternion.prototype={set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,f=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-f),f=Math.sin(-f),g=Math.cos(d),d=Math.sin(d),j=b*c,k=e*f;this.w=j*g-k*d;this.x=j*d+k*g;this.y=e*c*g+b*f*d;this.z=b*f*g-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);this.x=b.x*e;this.y=b.y*
e;this.z=b.z*e;this.w=Math.cos(d);return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},
multiplySelf:function(b){var c=this.x,d=this.y,e=this.z,f=this.w,g=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+f*g+d*k-e*j;this.y=d*b+f*j+e*g-c*k;this.z=e*b+f*k+c*j-d*g;this.w=f*b-c*g-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,f=b.z,g=this.x,j=this.y,k=this.z,o=this.w,p=o*d+j*f-k*e,n=
o*e+k*d-g*f,t=o*f+g*e-j*d,d=-g*d-j*e-k*f;c.x=p*o+d*-g+n*-k-t*-j;c.y=n*o+d*-j+t*-g-p*-k;c.z=t*o+d*-k+p*-j-n*-g;return c}};
THREE.Quaternion.slerp=function(b,c,d,e){var f=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(f)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var g=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;f=Math.sin((1-e)*g)/j;e=Math.sin(e*g)/j;d.w=b.w*f+c.w*e;d.x=b.x*f+c.x*e;d.y=b.y*f+c.y*e;d.z=b.z*f+c.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
THREE.Face3=function(b,c,d,e,f,g){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
THREE.Face4=function(b,c,d,e,f,g,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
THREE.UV.prototype={set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=false};
THREE.Geometry.prototype={computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),
d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,f,g,j,k=new THREE.Vector3,o=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(b&&g.vertexNormals.length){k.set(0,0,0);c=0;for(d=g.vertexNormals.length;c<d;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[g.a],d=this.vertices[g.b],j=this.vertices[g.c],k.sub(j.position,d.position),o.sub(c.position,d.position),k.crossSelf(o);k.isZero()||
k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),
d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,d,c,e,f,g,M){k=b.vertices[d].position;o=b.vertices[c].position;p=b.vertices[e].position;n=j[f];t=j[g];m=j[M];u=o.x-k.x;v=p.x-k.x;x=o.y-k.y;z=p.y-k.y;y=o.z-k.z;I=p.z-k.z;C=t.u-n.u;G=m.u-n.u;A=t.v-n.v;L=m.v-n.v;K=1/(C*L-G*A);Z.set((L*u-A*v)*
K,(L*x-A*z)*K,(L*y-A*I)*K);P.set((C*v-G*u)*K,(C*z-G*x)*K,(C*I-G*y)*K);D[d].addSelf(Z);D[c].addSelf(Z);D[e].addSelf(Z);F[d].addSelf(P);F[c].addSelf(P);F[e].addSelf(P)}var c,d,e,f,g,j,k,o,p,n,t,m,u,v,x,z,y,I,C,G,A,L,K,E,D=[],F=[],Z=new THREE.Vector3,P=new THREE.Vector3,W=new THREE.Vector3,R=new THREE.Vector3,ca=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)D[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)g=this.faces[c],j=this.faceVertexUvs[0][c],g instanceof
THREE.Face3?b(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(b(this,g.a,g.b,g.c,0,1,2),b(this,g.a,g.b,g.d,0,1,3));var M=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++)ca.copy(g.vertexNormals[e]),f=g[M[e]],E=D[f],W.copy(E),W.subSelf(ca.multiplyScalar(ca.dot(E))).normalize(),R.cross(g.vertexNormals[e],E),f=R.dot(F[f]),f=f<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(W.x,W.y,W.z,f)}this.hasTangents=true},computeBoundingBox:function(){var b;
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,d){return Math.min(b,d)+"_"+Math.max(b,d)}function c(b,d,c){b[d]===
void 0?(b[d]={set:{},array:[]},b[d].set[c]=1,b[d].array.push(c)):b[d].set[c]===void 0&&(b[d].set[c]=1,b[d].array.push(c))}var d,e,f,g,j,k={};d=0;for(e=this.faces.length;d<e;d++)j=this.faces[d],j instanceof THREE.Face3?(f=b(j.a,j.b),c(k,f,d),f=b(j.b,j.c),c(k,f,d),f=b(j.a,j.c),c(k,f,d)):j instanceof THREE.Face4&&(f=b(j.b,j.d),c(k,f,d),f=b(j.a,j.b),c(k,f,d),f=b(j.a,j.d),c(k,f,d),f=b(j.b,j.c),c(k,f,d),f=b(j.c,j.d),c(k,f,d));d=0;for(e=this.edges.length;d<e;d++){j=this.edges[d];f=j.vertexIndices[0];g=j.vertexIndices[1];
j.faceIndices=k[b(f,g)].array;for(f=0;f<j.faceIndices.length;f++)g=j.faceIndices[f],j.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;
THREE.Spline=function(b){function c(b,d,c,e,f,g,j){b=(c-b)*0.5;e=(e-d)*0.5;return(2*(d-c)+b+e)*j+(-3*(d-c)-2*b-e)*g+b*f+d}this.points=b;var d=[],e={x:0,y:0,z:0},f,g,j,k,o,p,n,t,m;this.initFromArray=function(b){this.points=[];for(var d=0;d<b.length;d++)this.points[d]={x:b[d][0],y:b[d][1],z:b[d][2]}};this.getPoint=function(b){f=(this.points.length-1)*b;g=Math.floor(f);j=f-g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;p=this.points[d[0]];n=this.points[d[1]];
t=this.points[d[2]];m=this.points[d[3]];k=j*j;o=j*k;e.x=c(p.x,n.x,t.x,m.x,j,k,o);e.y=c(p.y,n.y,t.y,m.y,j,k,o);e.z=c(p.z,n.z,t.z,m.z,j,k,o);return e};this.getControlPointsArray=function(){var b,d,c=this.points.length,e=[];for(b=0;b<c;b++)d=this.points[b],e[b]=[d.x,d.y,d.z];return e};this.getLength=function(b){var d,c,e=d=d=0,f=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);c=this.points.length*b;f.copy(this.points[0]);for(b=1;b<c;b++)d=b/c,position=this.getPoint(d),g.copy(position),
k+=g.distanceTo(f),f.copy(position),d*=this.points.length-1,d=Math.floor(d),d!=e&&(j[d]=k,e=d);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var d,c,e,f,g,j,k=[],o=new THREE.Vector3,p=this.getLength();k.push(o.copy(this.points[0]).clone());for(d=1;d<this.points.length;d++){c=p.chunks[d]-p.chunks[d-1];j=Math.ceil(b*c/p.total);f=(d-1)/(this.points.length-1);g=d/(this.points.length-1);for(c=1;c<j-1;c++)e=f+c*(1/j)*(g-f),position=this.getPoint(e),k.push(o.copy(position).clone());
k.push(o.copy(this.points[d]).clone())}this.points=k}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,e,f){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=true;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,e=b*d,b=Math.abs(b*c-e),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*b/this.fullWidth,e+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
THREE.Camera.prototype.setViewOffset=function(b,c,d,e,f,g){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=e;this.width=f;this.height=g;this.updateProjectionMatrix()};
THREE.Camera.prototype.update=function(b,c,d){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=true;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
false,c=true,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=d||0;this.castShadow=e!==void 0?e:false};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=d||0};
THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(b,c,d,e){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=void 0;b!==void 0&&this.add(b,c,d,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
THREE.LensFlare.prototype.add=function(b,c,d,e){c===void 0&&(c=-1);d===void 0&&(d=0);if(e===void 0)e=THREE.BillboardBlending;d=Math.min(d,Math.max(0,d));this.lensFlares.push({texture:b,size:c,distance:d,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:e})};
THREE.LensFlare.prototype.updateLensFlares=function(){var b,c=this.lensFlares.length,d,e=-this.positionScreen.x*2,f=-this.positionScreen.y*2;for(b=0;b<c;b++)d=this.lensFlares[b],d.x=this.positionScreen.x+e*d.distance,d.y=this.positionScreen.y+f*d.distance,d.wantedRotation=d.x*Math.PI*0.25,d.rotation+=(d.wantedRotation-d.rotation)*0.25};
THREE.Material=function(b){this.id=THREE.MaterialCounter.value++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:false;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:true;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:false;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:
0};THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:false};THREE.LineBasicMaterial.prototype=new THREE.Material;
THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:false;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:false;this.skinning=b.skinning!==void 0?b.skinning:false;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:false};
THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:false;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:false;this.skinning=b.skinning!==void 0?b.skinning:false;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:false};
THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;
this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:false;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==
void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:false;this.skinning=b.skinning!==void 0?b.skinning:false;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:false};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:false;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:false;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
THREE.MeshShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:false;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=
b.fog!==void 0?b.fog:false;this.lights=b.lights!==void 0?b.lights:false;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:false;this.skinning=b.skinning!==void 0?b.skinning:false;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:false};THREE.MeshShaderMaterial.prototype=new THREE.Material;THREE.MeshShaderMaterial.prototype.constructor=THREE.MeshShaderMaterial;
THREE.ShadowVolumeDynamicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:false;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:false;this.skinning=b.skinning!==void 0?b.skinning:false;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:false};
THREE.ShadowVolumeDynamicMaterial.prototype=new THREE.Material;THREE.ShadowVolumeDynamicMaterial.prototype.constructor=THREE.ShadowVolumeDynamicMaterial;
THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:true;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:false};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
THREE.Texture=function(b,c,d,e,f,g){this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=false};
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;
THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=false;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[d].name]=
d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=false};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=false,c=true;var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,true,d)}else for(e=0;e<
f;e++)this.children[e].update(this.skinMatrix,c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=true};
THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,f,g,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)f=this.geometry.bones[d],g=f.pos,j=f.rotq,k=f.scl,e=this.addBone(),e.name=f.name,e.position.set(g[0],g[1],g[2]),e.quaternion.set(j[0],j[1],j[2],j[3]),e.useQuaternion=true,k!==void 0?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)f=this.geometry.bones[d],
e=this.bones[d],f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=false,c=true;var e,f=this.children.length;for(e=0;e<f;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.identityMatrix,false,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,true);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,f=this.geometry.skinIndices[b].x,g=this.geometry.skinIndices[b].y;e=new THREE.Vector3(d.x,
d.y,d.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(e));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
THREE.Sound=function(b,c,d,e){THREE.Object3D.call(this);this.isPlaying=this.isAddedToDOM=this.isLoaded=false;this.duration=-1;this.radius=c!==void 0?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==void 0?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==void 0?e:true;this.sources=b instanceof Array?b:[b];for(var f,d=this.sources.length,b=0;b<d;b++)if(c=this.sources[b],c.toLowerCase(),c.indexOf(".mp3")!==-1?f="audio/mpeg":
c.indexOf(".ogg")!==-1?f="audio/ogg":c.indexOf(".wav")!==-1&&(f="audio/wav"),this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[b];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,true);this.domElement.load();break}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
THREE.Sound.prototype.onLoad=function(){var b=this.THREESound;if(!b.isLoaded)this.removeEventListener("canplay",this.onLoad,true),b.isLoaded=true,b.duration=this.duration,b.isPlaying&&b.play()};THREE.Sound.prototype.addToDOM=function(b){this.isAddedToDOM=true;b.appendChild(this.domElement)};THREE.Sound.prototype.play=function(b){this.isPlaying=true;if(this.isLoaded&&(this.domElement.play(),b))this.domElement.currentTime=b%this.duration};
THREE.Sound.prototype.pause=function(){this.isPlaying=false;this.domElement.pause()};THREE.Sound.prototype.stop=function(){this.isPlaying=false;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(b){b=b.length();this.domElement.volume=b<=this.radius?this.volume*(1-b/this.radius):0};
THREE.Sound.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(this.matrix.setPosition(this.position),c=true);if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=false,c=true;for(var e=this.children.length,b=0;b<e;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=false,c=true;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=true;for(var e=1;e<this.LODs.length;e++)if(b>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=
false,this.LODs[e].object3D.visible=true;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=false}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(b,c){b instanceof THREE.Mesh?(THREE.Mesh.call(this,b.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]),b.addChild(this)):THREE.Mesh.call(this,b,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);this.calculateShadowVolumeGeometry()};
THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(){if(this.geometry.edges&&this.geometry.edges.length){var b,c,d,e,f,g,j,k,o,p,n,t,m,u,v=new THREE.Geometry;v.vertices=this.geometry.vertices;e=v.faces=this.geometry.faces;var x=v.egdes=this.geometry.edges,z=v.edgeFaces=[];f=0;var y=[];b=0;for(c=e.length;b<c;b++)if(d=e[b],y.push(f),f+=d instanceof THREE.Face3?3:4,d.vertexNormals[0]=d.normal,d.vertexNormals[1]=d.normal,d.vertexNormals[2]=d.normal,d instanceof THREE.Face4)d.vertexNormals[3]=
d.normal;b=0;for(c=x.length;b<c;b++)k=x[b],d=k.faces[0],e=k.faces[1],f=k.faceIndices[0],g=k.faceIndices[1],j=k.vertexIndices[0],k=k.vertexIndices[1],d.a===j?(o="a",n=y[f]+0):d.b===j?(o="b",n=y[f]+1):d.c===j?(o="c",n=y[f]+2):d.d===j&&(o="d",n=y[f]+3),d.a===k?(o+="a",t=y[f]+0):d.b===k?(o+="b",t=y[f]+1):d.c===k?(o+="c",t=y[f]+2):d.d===k&&(o+="d",t=y[f]+3),e.a===j?(p="a",m=y[g]+0):e.b===j?(p="b",m=y[g]+1):e.c===j?(p="c",m=y[g]+2):e.d===j&&(p="d",m=y[g]+3),e.a===k?(p+="a",u=y[g]+0):e.b===k?(p+="b",u=y[g]+
1):e.c===k?(p+="c",u=y[g]+2):e.d===k&&(p+="d",u=y[g]+3),o==="ac"||o==="ad"||o==="ca"||o==="da"?n>t&&(d=n,n=t,t=d):n<t&&(d=n,n=t,t=d),p==="ac"||p==="ad"||p==="ca"||p==="da"?m>u&&(d=m,m=u,u=d):m<u&&(d=m,m=u,u=d),d=new THREE.Face4(n,t,m,u),d.normal.set(1,0,0),z.push(d);this.geometry=v}else this.calculateShadowVolumeGeometryWithoutEdgeInfo(this.geometry)};
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometryWithoutEdgeInfo=function(b){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=b.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,e=this.geometry.edgeFaces,f=b.faces,b=b.vertices,g=f.length,j,k,o,p,n,t=["a","b","c","d"];for(o=0;o<g;o++){k=c.length;j=f[o];j instanceof THREE.Face4?(p=4,k=new THREE.Face4(k,k+1,k+2,k+3)):(p=3,k=new THREE.Face3(k,k+1,k+2));k.normal.copy(j.normal);d.push(k);
for(k=0;k<p;k++)n=b[j[t[k]]],c.push(new THREE.Vertex(n.position.clone()))}for(g=0;g<f.length-1;g++){b=d[g];for(j=g+1;j<f.length;j++)k=d[j],k=this.facesShareEdge(c,b,k),k!==void 0&&(k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]),k.normal.set(1,0,0),e.push(k))}};
THREE.ShadowVolume.prototype.facesShareEdge=function(b,c,d){var e,f,g,j,k,o,p,n,t,m,u,v,x,z=0,y=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(v=0;v<e;v++){g=c[y[v]];k=b[g];for(x=0;x<f;x++)if(j=d[y[x]],o=b[j],Math.abs(k.position.x-o.position.x)<1.0E-4&&Math.abs(k.position.y-o.position.y)<1.0E-4&&Math.abs(k.position.z-o.position.z)<1.0E-4&&(z++,z===1&&(p=k,n=o,t=g,m=j,u=y[v]),z===2))return u+=y[v],u==="ad"||u==="ac"?{faces:[c,d],vertices:[p,n,o,k],indices:[t,m,
j,g],vertexTypes:[1,2,2,1],extrudable:true}:{faces:[c,d],vertices:[p,k,o,n],indices:[t,g,j,m],vertexTypes:[1,1,2,2],extrudable:true}}};
THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:true;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=true};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);
THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=false;this.collisions=this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(b instanceof THREE.Sound)this.sounds.indexOf(b)===-1&&this.sounds.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};
THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Sound?(c=this.sounds.indexOf(b),c!==-1&&this.sounds.splice(c,1)):b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
THREE.Projector=function(){function b(){var b=k[j]=k[j]||new THREE.RenderableVertex;j++;return b}function c(b,d){return d.z-b.z}var d,e,f=[],g,j,k=[],o,p,n=[],t,m=[],u,v,x=[],z,y,I=[],C=new THREE.Vector4,G=new THREE.Vector4,A=new THREE.Matrix4,L=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],E=new THREE.Vector4,D=new THREE.Vector4;this.projectVector=function(b,d){A.multiply(d.projectionMatrix,d.matrixWorldInverse);
A.multiplyVector3(b);return b};this.unprojectVector=function(b,d){A.multiply(d.matrixWorld,THREE.Matrix4.makeInvert(d.projectionMatrix));A.multiplyVector3(b);return b};this.projectObjects=function(b,g,j){var g=[],k,o,p;e=0;o=b.objects;b=0;for(k=o.length;b<k;b++){p=o[b];var t;if(!(t=!p.visible))if(t=p instanceof THREE.Mesh){a:{t=void 0;for(var m=p.matrixWorld,n=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),u=0;u<6;u++)if(t=K[u].x*m.n14+K[u].y*m.n24+K[u].z*m.n34+
K[u].w,t<=n){t=false;break a}t=true}t=!t}if(!t)t=f[e]=f[e]||new THREE.RenderableObject,e++,d=t,C.copy(p.position),A.multiplyVector3(C),d.object=p,d.z=C.z,g.push(d)}j&&g.sort(c);return g};this.projectScene=function(d,e,f){var C=[],R=e.near,ca=e.far,M,V,U,O,H,da,Q,$,ha,X,N,S,Y,T,aa,h,oa;y=v=t=p=0;e.matrixAutoUpdate&&e.update(void 0,true);d.update(void 0,false,e);A.multiply(e.projectionMatrix,e.matrixWorldInverse);K[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);K[1].set(A.n41+A.n11,A.n42+A.n12,
A.n43+A.n13,A.n44+A.n14);K[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);K[3].set(A.n41-A.n21,A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);K[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);K[5].set(A.n41+A.n31,A.n42+A.n32,A.n43+A.n33,A.n44+A.n34);for(M=0;M<6;M++)ha=K[M],ha.divideScalar(Math.sqrt(ha.x*ha.x+ha.y*ha.y+ha.z*ha.z));ha=this.projectObjects(d,e,true);d=0;for(M=ha.length;d<M;d++)if(X=ha[d].object,X.visible)if(N=X.matrixWorld,S=X.matrixRotationWorld,Y=X.materials,T=X.overdraw,j=0,
X instanceof THREE.Mesh){aa=X.geometry;O=aa.vertices;h=aa.faces;aa=aa.faceVertexUvs;V=0;for(U=O.length;V<U;V++)g=b(),g.positionWorld.copy(O[V].position),N.multiplyVector3(g.positionWorld),g.positionScreen.copy(g.positionWorld),A.multiplyVector4(g.positionScreen),g.positionScreen.x/=g.positionScreen.w,g.positionScreen.y/=g.positionScreen.w,g.visible=g.positionScreen.z>R&&g.positionScreen.z<ca;O=0;for(V=h.length;O<V;O++){U=h[O];if(U instanceof THREE.Face3)if(H=k[U.a],da=k[U.b],Q=k[U.c],H.visible&&da.visible&&
Q.visible&&(X.doubleSided||X.flipSided!=(Q.positionScreen.x-H.positionScreen.x)*(da.positionScreen.y-H.positionScreen.y)-(Q.positionScreen.y-H.positionScreen.y)*(da.positionScreen.x-H.positionScreen.x)<0))$=n[p]=n[p]||new THREE.RenderableFace3,p++,o=$,o.v1.copy(H),o.v2.copy(da),o.v3.copy(Q);else continue;else if(U instanceof THREE.Face4)if(H=k[U.a],da=k[U.b],Q=k[U.c],$=k[U.d],H.visible&&da.visible&&Q.visible&&$.visible&&(X.doubleSided||X.flipSided!=(($.positionScreen.x-H.positionScreen.x)*(da.positionScreen.y-
H.positionScreen.y)-($.positionScreen.y-H.positionScreen.y)*(da.positionScreen.x-H.positionScreen.x)<0||(da.positionScreen.x-Q.positionScreen.x)*($.positionScreen.y-Q.positionScreen.y)-(da.positionScreen.y-Q.positionScreen.y)*($.positionScreen.x-Q.positionScreen.x)<0)))oa=m[t]=m[t]||new THREE.RenderableFace4,t++,o=oa,o.v1.copy(H),o.v2.copy(da),o.v3.copy(Q),o.v4.copy($);else continue;o.normalWorld.copy(U.normal);S.multiplyVector3(o.normalWorld);o.centroidWorld.copy(U.centroid);N.multiplyVector3(o.centroidWorld);
o.centroidScreen.copy(o.centroidWorld);A.multiplyVector3(o.centroidScreen);Q=U.vertexNormals;H=0;for(da=Q.length;H<da;H++)$=o.vertexNormalsWorld[H],$.copy(Q[H]),S.multiplyVector3($);H=0;for(da=aa.length;H<da;H++)if(oa=aa[H][O]){Q=0;for($=oa.length;Q<$;Q++)o.uvs[H][Q]=oa[Q]}o.meshMaterials=Y;o.faceMaterials=U.materials;o.overdraw=T;o.z=o.centroidScreen.z;C.push(o)}}else if(X instanceof THREE.Line){L.multiply(A,N);O=X.geometry.vertices;H=b();H.positionScreen.copy(O[0].position);L.multiplyVector4(H.positionScreen);
V=1;for(U=O.length;V<U;V++){H=b();H.positionScreen.copy(O[V].position);L.multiplyVector4(H.positionScreen);da=k[j-2];E.copy(H.positionScreen);D.copy(da.positionScreen);S=E;Y=D;T=0;aa=1;h=S.z+S.w;var ga=Y.z+Y.w,ja=-S.z+S.w,qa=-Y.z+Y.w;if(h>=0&&ga>=0&&ja>=0&&qa>=0||(h<0&&ga<0||ja<0&&qa<0?0:(h<0?T=Math.max(T,h/(h-ga)):ga<0&&(aa=Math.min(aa,h/(h-ga))),ja<0?T=Math.max(T,ja/(ja-qa)):qa<0&&(aa=Math.min(aa,ja/(ja-qa))),aa<T?false:(S.lerpSelf(Y,T),Y.lerpSelf(S,1-aa),true))))E.multiplyScalar(1/E.w),D.multiplyScalar(1/
D.w),N=x[v]=x[v]||new THREE.RenderableLine,v++,u=N,u.v1.positionScreen.copy(E),u.v2.positionScreen.copy(D),u.z=Math.max(E.z,D.z),u.materials=X.materials,C.push(u)}}else if(X instanceof THREE.Particle&&(G.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),A.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))N=I[y]=I[y]||new THREE.RenderableParticle,y++,z=N,z.x=G.x/G.w,z.y=G.y/G.w,z.z=G.z,z.rotation=X.rotation.z,z.scale.x=X.scale.x*Math.abs(z.x-(G.x+e.projectionMatrix.n11)/(G.w+e.projectionMatrix.n14)),
z.scale.y=X.scale.y*Math.abs(z.y-(G.y+e.projectionMatrix.n22)/(G.w+e.projectionMatrix.n24)),z.materials=X.materials,C.push(z);f&&C.sort(c);return C}};
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,d,e,f,g;this.domElement=document.createElement("div");this.setSize=function(b,c){d=b;e=c;f=d/2;g=e/2};this.render=function(d,e){var o,p,n,t,m,u,v,x;b=c.projectScene(d,e);o=0;for(p=b.length;o<p;o++)if(m=b[o],m instanceof THREE.RenderableParticle){v=m.x*f+f;x=m.y*g+g;n=0;for(t=m.material.length;n<t;n++)if(u=m.material[n],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=v+"px",u.style.top=x+"px"}}};
THREE.CanvasRenderer=function(b){function c(b){if(y!=b)v.globalAlpha=y=b}function d(b){if(I!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}I=b}}function e(b){if(C!=b.hex)C=b.hex,v.strokeStyle="#"+g(C.toString(16))}function f(b){if(G!=b.hex)G=b.hex,v.fillStyle="#"+g(G.toString(16))}function g(b){for(;b.length<6;)b="0"+b;return b}
var j=this,k=null,o=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),n,t,m,u,v=p.getContext("2d"),x=new THREE.Color(0),z=0,y=1,I=0,C=null,G=null,A=null,L=null,K=null,E,D,F,Z,P=new THREE.RenderableVertex,W=new THREE.RenderableVertex,R,ca,M,V,U,O,H,da,Q,$,ha,X,N=new THREE.Color(0),S=new THREE.Color(0),Y=new THREE.Color(0),T=new THREE.Color(0),aa=new THREE.Color(0),h,oa,ga,ja,qa,za,Aa,wa,Ba,ua,va=new THREE.Rectangle,fa=new THREE.Rectangle,ea=new THREE.Rectangle,
ta=false,ka=new THREE.Color,pa=new THREE.Color,xa=new THREE.Color,Ea=new THREE.Color,la=new THREE.Vector3,Qa,Ra,Wa,ya,Sa,Ta,b=16;Qa=document.createElement("canvas");Qa.width=Qa.height=2;Ra=Qa.getContext("2d");Ra.fillStyle="rgba(0,0,0,1)";Ra.fillRect(0,0,2,2);Wa=Ra.getImageData(0,0,2,2);ya=Wa.data;Sa=document.createElement("canvas");Sa.width=Sa.height=b;Ta=Sa.getContext("2d");Ta.translate(-b/2,-b/2);Ta.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=true;this.data=
{vertices:0,faces:0};this.setSize=function(b,d){n=b;t=d;m=n/2;u=t/2;p.width=n;p.height=t;va.set(-m,-u,m,u);y=1;I=0;K=L=A=G=C=null};this.setClearColor=function(b,d){x=b;z=d};this.setClearColorHex=function(b,d){x.setHex(b);z=d};this.clear=function(){v.setTransform(1,0,0,-1,m,u);if(!fa.isEmpty())fa.inflate(1),fa.minSelf(va),x.hex==0&&z==0?v.clearRect(fa.getX(),fa.getY(),fa.getWidth(),fa.getHeight()):(d(THREE.NormalBlending),c(1),v.fillStyle="rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+Math.floor(x.b*
255)+","+z+")",v.fillRect(fa.getX(),fa.getY(),fa.getWidth(),fa.getHeight())),fa.empty()};this.render=function(b,g){function p(b){var d,c,e,h=b.lights;pa.setRGB(0,0,0);xa.setRGB(0,0,0);Ea.setRGB(0,0,0);b=0;for(d=h.length;b<d;b++)c=h[b],e=c.color,c instanceof THREE.AmbientLight?(pa.r+=e.r,pa.g+=e.g,pa.b+=e.b):c instanceof THREE.DirectionalLight?(xa.r+=e.r,xa.g+=e.g,xa.b+=e.b):c instanceof THREE.PointLight&&(Ea.r+=e.r,Ea.g+=e.g,Ea.b+=e.b)}function t(b,d,c,e){var h,g,f,j,k=b.lights,b=0;for(h=k.length;b<
h;b++)g=k[b],f=g.color,g instanceof THREE.DirectionalLight?(j=c.dot(g.position),j<=0||(j*=g.intensity,e.r+=f.r*j,e.g+=f.g*j,e.b+=f.b*j)):g instanceof THREE.PointLight&&(j=c.dot(la.sub(g.position,d).normalize()),j<=0||(j*=g.distance==0?1:1-Math.min(d.distanceTo(g.position)/g.distance,1),j!=0&&(j*=g.intensity,e.r+=f.r*j,e.g+=f.g*j,e.b+=f.b*j)))}function n(b,h,g){c(g.opacity);d(g.blending);var j,k,p,o,ka,t;if(g instanceof THREE.ParticleBasicMaterial){if(g.map)o=g.map.image,ka=o.width>>1,t=o.height>>
1,g=h.scale.x*m,p=h.scale.y*u,j=g*ka,k=p*t,ea.set(b.x-j,b.y-k,b.x+j,b.y+k),va.instersects(ea)&&(v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(g,-p),v.translate(-ka,-t),v.drawImage(o,0,0),v.restore())}else g instanceof THREE.ParticleCanvasMaterial&&(j=h.scale.x*m,k=h.scale.y*u,ea.set(b.x-j,b.y-k,b.x+j,b.y+k),va.instersects(ea)&&(e(g.color),f(g.color),v.save(),v.translate(b.x,b.y),v.rotate(-h.rotation),v.scale(j,k),g.program(v),v.restore()))}function y(b,h,g,f){c(f.opacity);d(f.blending);
v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(h.positionScreen.x,h.positionScreen.y);v.closePath();if(f instanceof THREE.LineBasicMaterial){b=f.linewidth;if(A!=b)v.lineWidth=A=b;b=f.linecap;if(L!=b)v.lineCap=L=b;b=f.linejoin;if(K!=b)v.lineJoin=K=b;e(f.color);v.stroke();ea.inflate(f.linewidth*2)}}function z(b,e,f,k,p,o,m,n,Ea){j.data.vertices+=3;j.data.faces++;c(n.opacity);d(n.blending);R=b.positionScreen.x;ca=b.positionScreen.y;M=e.positionScreen.x;V=e.positionScreen.y;U=
f.positionScreen.x;O=f.positionScreen.y;G(R,ca,M,V,U,O);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ja=m.uvs[0],Fa(R,ca,M,V,U,O,n.map.image,ja[k].u,ja[k].v,ja[p].u,ja[p].v,ja[o].u,ja[o].v));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=g.matrixWorldInverse,la.copy(m.vertexNormalsWorld[0]),qa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,za=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(m.vertexNormalsWorld[1]),
Aa=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,wa=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,la.copy(m.vertexNormalsWorld[2]),Ba=(la.x*b.n11+la.y*b.n12+la.z*b.n13)*0.5+0.5,ua=-(la.x*b.n21+la.y*b.n22+la.z*b.n23)*0.5+0.5,Fa(R,ca,M,V,U,O,n.envMap.image,qa,za,Aa,wa,Ba,ua)}else n.wireframe?C(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ha(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(ja=m.uvs[0],Fa(R,ca,
M,V,U,O,n.map.image,ja[k].u,ja[k].v,ja[p].u,ja[p].v,ja[o].u,ja[o].v)),d(THREE.SubtractiveBlending)),ta?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(S.r=Y.r=T.r=pa.r,S.g=Y.g=T.g=pa.g,S.b=Y.b=T.b=pa.b,t(Ea,m.v1.positionWorld,m.vertexNormalsWorld[0],S),t(Ea,m.v2.positionWorld,m.vertexNormalsWorld[1],Y),t(Ea,m.v3.positionWorld,m.vertexNormalsWorld[2],T),aa.r=(Y.r+T.r)*0.5,aa.g=(Y.g+T.g)*0.5,aa.b=(Y.b+T.b)*0.5,ga=B(S,Y,T,aa),Fa(R,ca,M,V,U,O,ga,0,0,1,0,0,1)):(ka.r=pa.r,
ka.g=pa.g,ka.b=pa.b,t(Ea,m.centroidWorld,m.normalWorld,ka),N.r=Math.max(0,Math.min(n.color.r*ka.r,1)),N.g=Math.max(0,Math.min(n.color.g*ka.g,1)),N.b=Math.max(0,Math.min(n.color.b*ka.b,1)),N.updateHex(),n.wireframe?C(N,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ha(N)):n.wireframe?C(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ha(n.color);else if(n instanceof THREE.MeshDepthMaterial)h=g.near,oa=g.far,S.r=S.g=S.b=1-La(b.positionScreen.z,h,oa),Y.r=Y.g=Y.b=1-La(e.positionScreen.z,
h,oa),T.r=T.g=T.b=1-La(f.positionScreen.z,h,oa),aa.r=(Y.r+T.r)*0.5,aa.g=(Y.g+T.g)*0.5,aa.b=(Y.b+T.b)*0.5,ga=B(S,Y,T,aa),Fa(R,ca,M,V,U,O,ga,0,0,1,0,0,1);else if(n instanceof THREE.MeshNormalMaterial)N.r=w(m.normalWorld.x),N.g=w(m.normalWorld.y),N.b=w(m.normalWorld.z),N.updateHex(),n.wireframe?C(N,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ha(N)}function x(b,e,f,k,p,o,n,m,la){j.data.vertices+=4;j.data.faces++;c(m.opacity);d(m.blending);if(m.map||m.envMap)z(b,e,k,0,1,3,n,m,la),z(p,
f,o,1,2,3,n,m,la);else if(R=b.positionScreen.x,ca=b.positionScreen.y,M=e.positionScreen.x,V=e.positionScreen.y,U=f.positionScreen.x,O=f.positionScreen.y,H=k.positionScreen.x,da=k.positionScreen.y,Q=p.positionScreen.x,$=p.positionScreen.y,ha=o.positionScreen.x,X=o.positionScreen.y,m instanceof THREE.MeshBasicMaterial)I(R,ca,M,V,U,O,H,da),m.wireframe?C(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ha(m.color);else if(m instanceof THREE.MeshLambertMaterial)ta?!m.wireframe&&m.shading==
THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(S.r=Y.r=T.r=aa.r=pa.r,S.g=Y.g=T.g=aa.g=pa.g,S.b=Y.b=T.b=aa.b=pa.b,t(la,n.v1.positionWorld,n.vertexNormalsWorld[0],S),t(la,n.v2.positionWorld,n.vertexNormalsWorld[1],Y),t(la,n.v4.positionWorld,n.vertexNormalsWorld[3],T),t(la,n.v3.positionWorld,n.vertexNormalsWorld[2],aa),ga=B(S,Y,T,aa),G(R,ca,M,V,H,da),Fa(R,ca,M,V,H,da,ga,0,0,1,0,0,1),G(Q,$,U,O,ha,X),Fa(Q,$,U,O,ha,X,ga,1,0,1,1,0,1)):(ka.r=pa.r,ka.g=pa.g,ka.b=pa.b,t(la,n.centroidWorld,n.normalWorld,
ka),N.r=Math.max(0,Math.min(m.color.r*ka.r,1)),N.g=Math.max(0,Math.min(m.color.g*ka.g,1)),N.b=Math.max(0,Math.min(m.color.b*ka.b,1)),N.updateHex(),I(R,ca,M,V,U,O,H,da),m.wireframe?C(N,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ha(N)):(I(R,ca,M,V,U,O,H,da),m.wireframe?C(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ha(m.color));else if(m instanceof THREE.MeshNormalMaterial)N.r=w(n.normalWorld.x),N.g=w(n.normalWorld.y),N.b=w(n.normalWorld.z),N.updateHex(),I(R,
ca,M,V,U,O,H,da),m.wireframe?C(N,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ha(N);else if(m instanceof THREE.MeshDepthMaterial)h=g.near,oa=g.far,S.r=S.g=S.b=1-La(b.positionScreen.z,h,oa),Y.r=Y.g=Y.b=1-La(e.positionScreen.z,h,oa),T.r=T.g=T.b=1-La(k.positionScreen.z,h,oa),aa.r=aa.g=aa.b=1-La(f.positionScreen.z,h,oa),ga=B(S,Y,T,aa),G(R,ca,M,V,H,da),Fa(R,ca,M,V,H,da,ga,0,0,1,0,0,1),G(Q,$,U,O,ha,X),Fa(Q,$,U,O,ha,X,ga,1,0,1,1,0,1)}function G(b,d,c,e,h,g){v.beginPath();v.moveTo(b,d);v.lineTo(c,
e);v.lineTo(h,g);v.lineTo(b,d);v.closePath()}function I(b,d,c,e,h,g,f,j){v.beginPath();v.moveTo(b,d);v.lineTo(c,e);v.lineTo(h,g);v.lineTo(f,j);v.lineTo(b,d);v.closePath()}function C(b,d,c,h){if(A!=d)v.lineWidth=A=d;if(L!=c)v.lineCap=L=c;if(K!=h)v.lineJoin=K=h;e(b);v.stroke();ea.inflate(d*2)}function Ha(b){f(b);v.fill()}function Fa(b,d,c,e,h,g,f,j,k,p,o,ka,n){var m,t;m=f.width-1;t=f.height-1;j*=m;k*=t;p*=m;o*=t;ka*=m;n*=t;c-=b;e-=d;h-=b;g-=d;p-=j;o-=k;ka-=j;n-=k;m=p*n-ka*o;m!=0&&(t=1/m,m=(n*c-o*h)*
t,o=(n*e-o*g)*t,c=(p*h-ka*c)*t,e=(p*g-ka*e)*t,b=b-m*j-c*k,d=d-o*j-e*k,v.save(),v.transform(m,o,c,e,b,d),v.clip(),v.drawImage(f,0,0),v.restore())}function B(b,d,c,e){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),f=~~(d.r*255),j=~~(d.g*255),d=~~(d.b*255),k=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),p=~~(e.r*255),m=~~(e.g*255),e=~~(e.b*255);ya[0]=h<0?0:h>255?255:h;ya[1]=g<0?0:g>255?255:g;ya[2]=b<0?0:b>255?255:b;ya[4]=f<0?0:f>255?255:f;ya[5]=j<0?0:j>255?255:j;ya[6]=d<0?0:d>255?255:d;ya[8]=k<0?0:k>255?255:
k;ya[9]=o<0?0:o>255?255:o;ya[10]=c<0?0:c>255?255:c;ya[12]=p<0?0:p>255?255:p;ya[13]=m<0?0:m>255?255:m;ya[14]=e<0?0:e>255?255:e;Ra.putImageData(Wa,0,0);Ta.drawImage(Qa,0,0);return Sa}function La(b,d,c){b=(b-d)/(c-d);return b*b*(3-2*b)}function w(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ia(b,d){var c=d.x-b.x,e=d.y-b.y,h=1/Math.sqrt(c*c+e*e);c*=h;e*=h;d.x+=c;d.y+=e;b.x-=c;b.y-=e}var Ua,Xa,ia,Ca,Ja,Pa,Va,ra;this.autoClear?this.clear():v.setTransform(1,0,0,-1,m,u);j.data.vertices=0;j.data.faces=0;k=
o.projectScene(b,g,this.sortElements);(ta=b.lights.length>0)&&p(b);Ua=0;for(Xa=k.length;Ua<Xa;Ua++){ia=k[Ua];ea.empty();if(ia instanceof THREE.RenderableParticle){E=ia;E.x*=m;E.y*=u;Ca=0;for(Ja=ia.materials.length;Ca<Ja;)ra=ia.materials[Ca++],ra.opacity!=0&&n(E,ia,ra,b)}else if(ia instanceof THREE.RenderableLine){if(E=ia.v1,D=ia.v2,E.positionScreen.x*=m,E.positionScreen.y*=u,D.positionScreen.x*=m,D.positionScreen.y*=u,ea.addPoint(E.positionScreen.x,E.positionScreen.y),ea.addPoint(D.positionScreen.x,
D.positionScreen.y),va.instersects(ea)){Ca=0;for(Ja=ia.materials.length;Ca<Ja;)ra=ia.materials[Ca++],ra.opacity!=0&&y(E,D,ia,ra,b)}}else if(ia instanceof THREE.RenderableFace3){if(E=ia.v1,D=ia.v2,F=ia.v3,E.positionScreen.x*=m,E.positionScreen.y*=u,D.positionScreen.x*=m,D.positionScreen.y*=u,F.positionScreen.x*=m,F.positionScreen.y*=u,ia.overdraw&&(Ia(E.positionScreen,D.positionScreen),Ia(D.positionScreen,F.positionScreen),Ia(F.positionScreen,E.positionScreen)),ea.add3Points(E.positionScreen.x,E.positionScreen.y,
D.positionScreen.x,D.positionScreen.y,F.positionScreen.x,F.positionScreen.y),va.instersects(ea)){Ca=0;for(Ja=ia.meshMaterials.length;Ca<Ja;)if(ra=ia.meshMaterials[Ca++],ra instanceof THREE.MeshFaceMaterial){Pa=0;for(Va=ia.faceMaterials.length;Pa<Va;)(ra=ia.faceMaterials[Pa++])&&ra.opacity!=0&&z(E,D,F,0,1,2,ia,ra,b)}else ra.opacity!=0&&z(E,D,F,0,1,2,ia,ra,b)}}else if(ia instanceof THREE.RenderableFace4&&(E=ia.v1,D=ia.v2,F=ia.v3,Z=ia.v4,E.positionScreen.x*=m,E.positionScreen.y*=u,D.positionScreen.x*=
m,D.positionScreen.y*=u,F.positionScreen.x*=m,F.positionScreen.y*=u,Z.positionScreen.x*=m,Z.positionScreen.y*=u,P.positionScreen.copy(D.positionScreen),W.positionScreen.copy(Z.positionScreen),ia.overdraw&&(Ia(E.positionScreen,D.positionScreen),Ia(D.positionScreen,Z.positionScreen),Ia(Z.positionScreen,E.positionScreen),Ia(F.positionScreen,P.positionScreen),Ia(F.positionScreen,W.positionScreen)),ea.addPoint(E.positionScreen.x,E.positionScreen.y),ea.addPoint(D.positionScreen.x,D.positionScreen.y),ea.addPoint(F.positionScreen.x,
F.positionScreen.y),ea.addPoint(Z.positionScreen.x,Z.positionScreen.y),va.instersects(ea))){Ca=0;for(Ja=ia.meshMaterials.length;Ca<Ja;)if(ra=ia.meshMaterials[Ca++],ra instanceof THREE.MeshFaceMaterial){Pa=0;for(Va=ia.faceMaterials.length;Pa<Va;)(ra=ia.faceMaterials[Pa++])&&ra.opacity!=0&&x(E,D,F,Z,P,W,ia,ra,b)}else ra.opacity!=0&&x(E,D,F,Z,P,W,ia,ra,b)}fa.addRectangle(ea)}v.setTransform(1,0,0,1,0,0)}};
THREE.SVGRenderer=function(){function b(b,d,c){var e,g,f,j;e=0;for(g=b.lights.length;e<g;e++)f=b.lights[e],f instanceof THREE.DirectionalLight?(j=d.normalWorld.dot(f.position)*f.intensity,j>0&&(c.r+=f.color.r*j,c.g+=f.color.g*j,c.b+=f.color.b*j)):f instanceof THREE.PointLight&&(Z.sub(f.position,d.centroidWorld),Z.normalize(),j=d.normalWorld.dot(Z)*f.intensity,j>0&&(c.r+=f.color.r*j,c.g+=f.color.g*j,c.b+=f.color.b*j))}function c(d,c,k,o,m,n){j.data.vertices+=3;j.data.faces++;R=e(ca++);R.setAttribute("d",
"M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?A.hex=m.color.hex:m instanceof THREE.MeshLambertMaterial?G?(L.r=K.r,L.g=K.g,L.b=K.b,b(n,o,L),A.r=Math.max(0,Math.min(m.color.r*L.r,1)),A.g=Math.max(0,Math.min(m.color.g*L.g,1)),A.b=Math.max(0,Math.min(m.color.b*L.b,1)),A.updateHex()):A.hex=m.color.hex:m instanceof THREE.MeshDepthMaterial?(F=1-m.__2near/(m.__farPlusNear-
o.z*m.__farMinusNear),A.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&A.setRGB(f(o.normalWorld.x),f(o.normalWorld.y),f(o.normalWorld.z));m.wireframe?R.setAttribute("style","fill: none; stroke: #"+g(A.hex.toString(16))+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):R.setAttribute("style","fill: #"+g(A.hex.toString(16))+"; fill-opacity: "+m.opacity);p.appendChild(R)}function d(d,c,k,o,
m,n,t){j.data.vertices+=4;j.data.faces++;R=e(ca++);R.setAttribute("d","M "+d.positionScreen.x+" "+d.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?A.hex=n.color.hex:n instanceof THREE.MeshLambertMaterial?G?(L.r=K.r,L.g=K.g,L.b=K.b,b(t,m,L),A.r=Math.max(0,Math.min(n.color.r*L.r,1)),A.g=Math.max(0,Math.min(n.color.g*L.g,1)),A.b=Math.max(0,Math.min(n.color.b*
L.b,1)),A.updateHex()):A.hex=n.color.hex:n instanceof THREE.MeshDepthMaterial?(F=1-n.__2near/(n.__farPlusNear-m.z*n.__farMinusNear),A.setRGB(F,F,F)):n instanceof THREE.MeshNormalMaterial&&A.setRGB(f(m.normalWorld.x),f(m.normalWorld.y),f(m.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: #"+g(A.hex.toString(16))+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style",
"fill: #"+g(A.hex.toString(16))+"; fill-opacity: "+n.opacity);p.appendChild(R)}function e(b){P[b]==null&&(P[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&P[b].setAttribute("shape-rendering","crispEdges"));return P[b]}function f(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function g(b){for(;b.length<6;)b="0"+b;return b}var j=this,k=null,o=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),n,t,m,u,v,x,z,y,I=new THREE.Rectangle,C=new THREE.Rectangle,G=
false,A=new THREE.Color(16777215),L=new THREE.Color(16777215),K=new THREE.Color(0),E=new THREE.Color(0),D=new THREE.Color(0),F,Z=new THREE.Vector3,P=[],W=[],R,ca,M,V=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=true;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":V=1;break;case "low":V=0}};this.setSize=function(b,d){n=b;t=d;m=n/2;u=t/2;p.setAttribute("viewBox",-m+" "+-u+" "+n+" "+t);p.setAttribute("width",n);p.setAttribute("height",t);I.set(-m,
-u,m,u)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=function(b,e){var f,n,t,A,F,L,N,S;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;k=o.projectScene(b,e,this.sortElements);M=ca=0;if(G=b.lights.length>0){N=b.lights;K.setRGB(0,0,0);E.setRGB(0,0,0);D.setRGB(0,0,0);f=0;for(n=N.length;f<n;f++)t=N[f],A=t.color,t instanceof THREE.AmbientLight?(K.r+=A.r,K.g+=A.g,K.b+=A.b):t instanceof THREE.DirectionalLight?(E.r+=A.r,E.g+=A.g,E.b+=A.b):t instanceof
THREE.PointLight&&(D.r+=A.r,D.g+=A.g,D.b+=A.b)}f=0;for(n=k.length;f<n;f++)if(N=k[f],C.empty(),N instanceof THREE.RenderableParticle){v=N;v.x*=m;v.y*=-u;t=0;for(A=N.materials.length;t<A;)t++}else if(N instanceof THREE.RenderableLine){if(v=N.v1,x=N.v2,v.positionScreen.x*=m,v.positionScreen.y*=-u,x.positionScreen.x*=m,x.positionScreen.y*=-u,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(x.positionScreen.x,x.positionScreen.y),I.instersects(C)){t=0;for(A=N.materials.length;t<A;)if((S=N.materials[t++])&&
S.opacity!=0){F=v;L=x;var Z=M++;W[Z]==null&&(W[Z]=document.createElementNS("http://www.w3.org/2000/svg","line"),V==0&&W[Z].setAttribute("shape-rendering","crispEdges"));R=W[Z];R.setAttribute("x1",F.positionScreen.x);R.setAttribute("y1",F.positionScreen.y);R.setAttribute("x2",L.positionScreen.x);R.setAttribute("y2",L.positionScreen.y);S instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: ##"+g(S.color.hex.toString(16))+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+
S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin),p.appendChild(R))}}}else if(N instanceof THREE.RenderableFace3){if(v=N.v1,x=N.v2,z=N.v3,v.positionScreen.x*=m,v.positionScreen.y*=-u,x.positionScreen.x*=m,x.positionScreen.y*=-u,z.positionScreen.x*=m,z.positionScreen.y*=-u,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(z.positionScreen.x,z.positionScreen.y),I.instersects(C)){t=0;for(A=N.meshMaterials.length;t<
A;)if(S=N.meshMaterials[t++],S instanceof THREE.MeshFaceMaterial){F=0;for(L=N.faceMaterials.length;F<L;)(S=N.faceMaterials[F++])&&S.opacity!=0&&c(v,x,z,N,S,b)}else S&&S.opacity!=0&&c(v,x,z,N,S,b)}}else if(N instanceof THREE.RenderableFace4&&(v=N.v1,x=N.v2,z=N.v3,y=N.v4,v.positionScreen.x*=m,v.positionScreen.y*=-u,x.positionScreen.x*=m,x.positionScreen.y*=-u,z.positionScreen.x*=m,z.positionScreen.y*=-u,y.positionScreen.x*=m,y.positionScreen.y*=-u,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(x.positionScreen.x,
x.positionScreen.y),C.addPoint(z.positionScreen.x,z.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),I.instersects(C))){t=0;for(A=N.meshMaterials.length;t<A;)if(S=N.meshMaterials[t++],S instanceof THREE.MeshFaceMaterial){F=0;for(L=N.faceMaterials.length;F<L;)(S=N.faceMaterials[F++])&&S.opacity!=0&&d(v,x,z,y,N,S,b)}else S&&S.opacity!=0&&d(v,x,z,y,N,S,b)}}};
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}",
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + vViewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif"};THREE.UniformsUtils={merge:function(b){var c,d,e,f={};for(c=0;c<b.length;c++)for(d in e=this.clone(b[c]),e)f[d]=e[d];return f},clone:function(b){var c,d,e,f={};for(c in b)for(d in f[c]={},b[c])e=b[c][d],f[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e;return f}};
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",
value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},
map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
THREE.ShaderLib={lensFlareVertexTexture:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform    int     renderType;\nuniform\tsampler2D\tocclusionMap;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvarying\tfloat\tvVisibility;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 )) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ));\nvVisibility = (       visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n(       visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvarying\tfloat\t\tvVisibility;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nuniform    int     renderType;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",
fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tsampler2D\tocclusionMap;\nuniform\tfloat\t\topacity;\nuniform    int         renderType;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 )).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 )).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 )).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 )).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
sprite:{vertexShader:"uniform\tint\t\tuseScreenCoordinates;\nuniform    int     affectedByDistance;\nuniform\tvec3\tscreenPosition;\nuniform \tmat4 \tmodelViewMatrix;\nuniform \tmat4 \tprojectionMatrix;\nuniform    float   rotation;\nuniform    vec2    scale;\nuniform    vec2    alignment;\nuniform    vec2    uvOffset;\nuniform\tvec2    uvScale;\nattribute \tvec2 \tposition;\nattribute  vec2\tuv;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}"},shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\n}"},
shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos      = objectMatrix * vec4( position, 1.0 );\nvec3 norm     = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position   = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0 );\n}"},
depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),
fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,
THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),
fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,
THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,
"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,
THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",
THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
THREE.WebGLRenderer=function(b){var c,d,e,f,g,j,k,o,p,n,t,m,u,v,x,z,y;function I(b,d,c){var e,f,g,j=b.vertices,k=j.length,o=b.colors,p=o.length,m=b.__vertexArray,n=b.__colorArray,t=b.__sortArray,u=b.__dirtyVertices,v=b.__dirtyColors;if(c.sortParticles){_projScreenMatrix.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=j[e].position,_vector3.copy(f),_projScreenMatrix.multiplyVector3(_vector3),t[e]=[_vector3.z,e];t.sort(function(b,d){return d[0]-b[0]});for(e=0;e<k;e++)f=j[t[e][1]].position,g=e*3,m[g]=
f.x,m[g+1]=f.y,m[g+2]=f.z;for(e=0;e<p;e++)g=e*3,color=o[t[e][1]],n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b}else{if(u)for(e=0;e<k;e++)f=j[e].position,g=e*3,m[g]=f.x,m[g+1]=f.y,m[g+2]=f.z;if(v)for(e=0;e<p;e++)color=o[e],g=e*3,n[g]=color.r,n[g+1]=color.g,n[g+2]=color.b}if(u||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,m,d);if(v||c.sortParticles)h.bindBuffer(h.ARRAY_BUFFER,b.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,n,d)}function C(b,d,c,e,f){e.program||
aa.initMaterial(e,d,c,f);var g=e.program,j=g.uniforms,k=e.uniforms;g!=ga&&(h.useProgram(g),ga=g);h.uniformMatrix4fv(j.projectionMatrix,false,_projectionMatrixArray);if(c&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(k.fogColor.value=c.color,c instanceof THREE.Fog)k.fogNear.value=c.near,k.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)k.fogDensity.value=
c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var o,p,m=0,n=0,t=0,u,v,z,y,x=_lights,A=x.directional.colors,G=x.directional.positions,D=x.point.colors,I=x.point.positions,C=x.point.distances,F=0,B=0,c=p=0;for(o=d.length;c<o;c++)if(p=d[c],u=p.color,v=p.position,z=p.intensity,y=p.distance,p instanceof THREE.AmbientLight)m+=u.r,n+=u.g,t+=u.b;else if(p instanceof THREE.DirectionalLight)y=F*3,A[y]=u.r*z,A[y+1]=u.g*z,A[y+2]=u.b*z,G[y]=v.x,G[y+1]=v.y,
G[y+2]=v.z,F+=1;else if(p instanceof THREE.PointLight)p=B*3,D[p]=u.r*z,D[p+1]=u.g*z,D[p+2]=u.b*z,I[p]=v.x,I[p+1]=v.y,I[p+2]=v.z,C[B]=y,B+=1;for(c=F*3;c<A.length;c++)A[c]=0;for(c=B*3;c<D.length;c++)D[c]=0;x.point.length=B;x.directional.length=F;x.ambient[0]=m;x.ambient[1]=n;x.ambient[2]=t;c=_lights;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;
k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity,(k.map.texture=e.map)&&k.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),k.lightMap.texture=e.lightMap,k.envMap.texture=e.envMap,k.reflectivity.value=e.reflectivity,k.refractionRatio.value=
e.refractionRatio,k.combine.value=e.combine,k.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)k.diffuse.value=e.color,k.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)k.psColor.value=e.color,k.opacity.value=e.opacity,k.size.value=e.size,k.scale.value=_canvas.height/2,k.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)k.ambient.value=e.ambient,k.specular.value=e.specular,k.shininess.value=
e.shininess;else if(e instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)k.opacity.value=e.opacity;for(var H in k)if(n=g.uniforms[H])if(o=k[H],m=o.type,c=o.value,m=="i")h.uniform1i(n,c);else if(m=="f")h.uniform1f(n,c);else if(m=="fv1")h.uniform1fv(n,c);else if(m=="fv")h.uniform3fv(n,c);else if(m=="v2")h.uniform2f(n,c.x,c.y);else if(m=="v3")h.uniform3f(n,c.x,c.y,c.z);else if(m=="v4")h.uniform4f(n,c.x,c.y,
c.z,c.w);else if(m=="c")h.uniform3f(n,c.r,c.g,c.b);else if(m=="t"&&(h.uniform1i(n,c),o=o.texture))if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__webglInit){h.bindTexture(h.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(m=0;m<6;++m)h.texSubImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,0,0,h.RGBA,h.UNSIGNED_BYTE,o.image[m])}else{o.image.__webglTextureCube=h.createTexture();h.bindTexture(h.TEXTURE_CUBE_MAP,o.image.__webglTextureCube);for(m=0;m<6;++m)h.texImage2D(h.TEXTURE_CUBE_MAP_POSITIVE_X+
m,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,o.image[m]);o.__webglInit=true}ha(h.TEXTURE_CUBE_MAP,o,o.image[0]);h.bindTexture(h.TEXTURE_CUBE_MAP,null);o.needsUpdate=false}h.activeTexture(h.TEXTURE0+c);h.bindTexture(h.TEXTURE_CUBE_MAP,o.image.__webglTextureCube)}}else X(o,c);h.uniformMatrix4fv(j.modelViewMatrix,false,f._modelViewMatrixArray);h.uniformMatrix3fv(j.normalMatrix,false,f._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==
null&&h.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning)&&j.objectMatrix!==null&&h.uniformMatrix4fv(j.objectMatrix,false,f._objectMatrixArray);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&j.viewMatrix!==null&&h.uniformMatrix4fv(j.viewMatrix,false,_viewMatrixArray);if(e instanceof THREE.ShadowVolumeDynamicMaterial)b=k.directionalLightDirection.value,
b[0]=-d[1].position.x,b[1]=-d[1].position.y,b[2]=-d[1].position.z,h.uniform3fv(j.directionalLightDirection,b),h.uniformMatrix4fv(j.objectMatrix,false,f._objectMatrixArray),h.uniformMatrix4fv(j.viewMatrix,false,_viewMatrixArray);e.skinning&&(h.uniformMatrix4fv(j.cameraInverseMatrix,false,_viewMatrixArray),h.uniformMatrix4fv(j.boneGlobalMatrices,false,f.boneMatrices));return g}function G(b,d,c,e,f,g){if(e.opacity!=0){var j,b=C(b,d,c,e,g).attributes;if(!e.morphTargets&&b.position>=0)h.bindBuffer(h.ARRAY_BUFFER,
f.__webglVertexBuffer),h.vertexAttribPointer(b.position,3,h.FLOAT,false,0,0);else{d=e.program.attributes;g.morphTargetBase!==-1?(h.bindBuffer(h.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),h.vertexAttribPointer(d.position,3,h.FLOAT,false,0,0)):d.position>=0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglVertexBuffer),h.vertexAttribPointer(d.position,3,h.FLOAT,false,0,0));if(g.morphTargetForcedOrder.length)for(var c=0,k=g.morphTargetForcedOrder,o=g.morphTargetInfluences;c<e.numSupportedMorphTargets&&
c<k.length;)h.bindBuffer(h.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k[c]]),h.vertexAttribPointer(d["morphTarget"+c],3,h.FLOAT,false,0,0),g.__webglMorphTargetInfluences[c]=o[k[c]],c++;else{var k=[],p=-1,m=0,o=g.morphTargetInfluences,n,t=o.length,c=0;for(g.morphTargetBase!==-1&&(k[g.morphTargetBase]=true);c<e.numSupportedMorphTargets;){for(n=0;n<t;n++)!k[n]&&o[n]>p&&(m=n,p=o[m]);h.bindBuffer(h.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[m]);h.vertexAttribPointer(d["morphTarget"+c],3,h.FLOAT,false,0,
0);g.__webglMorphTargetInfluences[c]=p;k[m]=1;p=-1;c++}}e.program.uniforms.morphTargetInfluences!==null&&h.uniform1fv(e.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(f.__webglCustomAttributes)for(j in f.__webglCustomAttributes)b[j]>=0&&(d=f.__webglCustomAttributes[j],h.bindBuffer(h.ARRAY_BUFFER,d.buffer),h.vertexAttribPointer(b[j],d.size,h.FLOAT,false,0,0));b.color>=0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglColorBuffer),h.vertexAttribPointer(b.color,3,h.FLOAT,false,0,0));
b.normal>=0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglNormalBuffer),h.vertexAttribPointer(b.normal,3,h.FLOAT,false,0,0));b.tangent>=0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglTangentBuffer),h.vertexAttribPointer(b.tangent,4,h.FLOAT,false,0,0));b.uv>=0&&(f.__webglUVBuffer?(h.bindBuffer(h.ARRAY_BUFFER,f.__webglUVBuffer),h.vertexAttribPointer(b.uv,2,h.FLOAT,false,0,0),h.enableVertexAttribArray(b.uv)):h.disableVertexAttribArray(b.uv));b.uv2>=0&&(f.__webglUV2Buffer?(h.bindBuffer(h.ARRAY_BUFFER,f.__webglUV2Buffer),
h.vertexAttribPointer(b.uv2,2,h.FLOAT,false,0,0),h.enableVertexAttribArray(b.uv2)):h.disableVertexAttribArray(b.uv2));e.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexABuffer),h.vertexAttribPointer(b.skinVertexA,4,h.FLOAT,false,0,0),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),h.vertexAttribPointer(b.skinVertexB,4,h.FLOAT,false,0,0),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),h.vertexAttribPointer(b.skinIndex,
4,h.FLOAT,false,0,0),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),h.vertexAttribPointer(b.skinWeight,4,h.FLOAT,false,0,0));g instanceof THREE.Mesh?(e.wireframe?(h.lineWidth(e.wireframeLinewidth),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),h.drawElements(h.LINES,f.__webglLineCount,h.UNSIGNED_SHORT,0)):(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),h.drawElements(h.TRIANGLES,f.__webglFaceCount,h.UNSIGNED_SHORT,0)),aa.data.vertices+=f.__webglFaceCount,aa.data.faces+=
f.__webglFaceCount/3,aa.data.drawCalls++):g instanceof THREE.Line?(g=g.type==THREE.LineStrip?h.LINE_STRIP:h.LINES,h.lineWidth(e.linewidth),h.drawArrays(g,0,f.__webglLineCount),aa.data.drawCalls++):g instanceof THREE.ParticleSystem?(h.drawArrays(h.POINTS,0,f.__webglParticleCount),aa.data.drawCalls++):g instanceof THREE.Ribbon&&(h.drawArrays(h.TRIANGLE_STRIP,0,f.__webglVertexCount),aa.data.drawCalls++)}}function A(b,d,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=h.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=
h.createBuffer();b.hasPos&&(h.bindBuffer(h.ARRAY_BUFFER,b.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,b.positionArray,h.DYNAMIC_DRAW),h.enableVertexAttribArray(d.attributes.position),h.vertexAttribPointer(d.attributes.position,3,h.FLOAT,false,0,0));if(b.hasNormal){h.bindBuffer(h.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var e,f,g,j,k,o,p,m,n,t,u=b.count*3;for(t=0;t<u;t+=9)c=b.normalArray,e=c[t],f=c[t+1],g=c[t+2],j=c[t+3],o=c[t+4],m=c[t+5],k=c[t+6],p=c[t+7],n=c[t+8],e=(e+j+
k)/3,f=(f+o+p)/3,g=(g+m+n)/3,c[t]=e,c[t+1]=f,c[t+2]=g,c[t+3]=e,c[t+4]=f,c[t+5]=g,c[t+6]=e,c[t+7]=f,c[t+8]=g}h.bufferData(h.ARRAY_BUFFER,b.normalArray,h.DYNAMIC_DRAW);h.enableVertexAttribArray(d.attributes.normal);h.vertexAttribPointer(d.attributes.normal,3,h.FLOAT,false,0,0)}h.drawArrays(h.TRIANGLES,0,b.count);b.count=0}function L(b){if(za!=b.doubleSided)b.doubleSided?h.disable(h.CULL_FACE):h.enable(h.CULL_FACE),za=b.doubleSided;if(Aa!=b.flipSided)b.flipSided?h.frontFace(h.CW):h.frontFace(h.CCW),
Aa=b.flipSided}function K(b){Ba!=b&&(b?h.enable(h.DEPTH_TEST):h.disable(h.DEPTH_TEST),Ba=b)}function E(b,d,c){ua!=b&&(b?h.enable(h.POLYGON_OFFSET_FILL):h.disable(h.POLYGON_OFFSET_FILL),ua=b);if(b&&(_oldPolygonOffsetFactor!=d||_oldPolygonOffsetUnits!=c))h.polygonOffset(d,c),_oldPolygonOffsetFactor=d,_oldPolygonOffsetUnits=c}function D(b){_frustum[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);_frustum[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);_frustum[2].set(b.n41+b.n21,b.n42+
b.n22,b.n43+b.n23,b.n44+b.n24);_frustum[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);_frustum[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);_frustum[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var d,b=0;b<6;b++)d=_frustum[b],d.divideScalar(Math.sqrt(d.x*d.x+d.y*d.y+d.z*d.z))}function F(b){for(var d=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),e=0;e<6;e++)if(b=_frustum[e].x*d.n14+_frustum[e].y*d.n24+_frustum[e].z*
d.n34+_frustum[e].w,b<=c)return false;return true}function Z(b,d){b.list[b.count]=d;b.count+=1}function P(b){var d,c,e=b.object,f=b.opaque,g=b.transparent;g.count=0;b=f.count=0;for(d=e.materials.length;b<d;b++)c=e.materials[b],c.transparent?Z(g,c):Z(f,c)}function W(b){var d,c,e,f,g=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(e=g.materials.length;b<e;b++)if(d=g.materials[b],d instanceof THREE.MeshFaceMaterial){d=0;for(c=h.materials.length;d<c;d++)(f=h.materials[d])&&(f.transparent?
Z(k,f):Z(j,f))}else(f=d)&&(f.transparent?Z(k,f):Z(j,f))}function R(b,d){return d.z-b.z}function ca(b){h.enable(h.POLYGON_OFFSET_FILL);h.polygonOffset(0.1,1);h.enable(h.STENCIL_TEST);h.enable(h.DEPTH_TEST);h.depthMask(false);h.colorMask(false,false,false,false);h.stencilFunc(h.ALWAYS,1,255);h.stencilOpSeparate(h.BACK,h.KEEP,h.INCR,h.KEEP);h.stencilOpSeparate(h.FRONT,h.KEEP,h.DECR,h.KEEP);var d,c=b.lights.length,e,f=b.lights,g=[],j,k,o,p,n,A=b.__webglShadowVolumes.length;for(d=0;d<c;d++)if(e=b.lights[d],
e instanceof THREE.DirectionalLight&&e.castShadow){g[0]=-e.position.x;g[1]=-e.position.y;g[2]=-e.position.z;for(n=0;n<A;n++)e=b.__webglShadowVolumes[n].object,j=b.__webglShadowVolumes[n].buffer,k=e.materials[0],k.program||aa.initMaterial(k,f,void 0,e),k=k.program,o=k.uniforms,p=k.attributes,ga!==k&&(h.useProgram(k),ga=k,h.uniformMatrix4fv(o.projectionMatrix,false,_projectionMatrixArray),h.uniformMatrix4fv(o.viewMatrix,false,_viewMatrixArray),h.uniform3fv(o.directionalLightDirection,g)),e.matrixWorld.flattenToArray(e._objectMatrixArray),
h.uniformMatrix4fv(o.objectMatrix,false,e._objectMatrixArray),h.bindBuffer(h.ARRAY_BUFFER,j.__webglVertexBuffer),h.vertexAttribPointer(p.position,3,h.FLOAT,false,0,0),h.bindBuffer(h.ARRAY_BUFFER,j.__webglNormalBuffer),h.vertexAttribPointer(p.normal,3,h.FLOAT,false,0,0),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),h.cullFace(h.FRONT),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0),h.cullFace(h.BACK),h.drawElements(h.TRIANGLES,j.__webglFaceCount,h.UNSIGNED_SHORT,0)}h.disable(h.POLYGON_OFFSET_FILL);
h.colorMask(true,true,true,true);h.stencilFunc(h.NOTEQUAL,0,255);h.stencilOp(h.KEEP,h.KEEP,h.KEEP);h.disable(h.DEPTH_TEST);wa=-1;ga=t;h.useProgram(t);h.uniformMatrix4fv(m,false,_projectionMatrixArray);h.uniform1f(u,v);h.bindBuffer(h.ARRAY_BUFFER,x);h.vertexAttribPointer(z,3,h.FLOAT,false,0,0);h.enableVertexAttribArray(z);h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA);h.blendEquation(h.FUNC_ADD);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,y);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.disable(h.STENCIL_TEST);
h.enable(h.DEPTH_TEST);h.depthMask(qa)}function M(b,d){var c,e,f;c=_sprite.attributes;var g=_sprite.uniforms,j=_viewportHeight/_viewportWidth,k,o=[],p=_viewportWidth*0.5,m=_viewportHeight*0.5,n=true;h.useProgram(_sprite.program);ga=_sprite.program;wa=-1;ta||(h.enableVertexAttribArray(_sprite.attributes.position),h.enableVertexAttribArray(_sprite.attributes.uv),ta=true);h.disable(h.CULL_FACE);h.enable(h.BLEND);h.depthMask(true);h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.vertexAttribPointer(c.position,
2,h.FLOAT,false,16,0);h.vertexAttribPointer(c.uv,2,h.FLOAT,false,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.uniformMatrix4fv(g.projectionMatrix,false,_projectionMatrixArray);h.activeTexture(h.TEXTURE0);h.uniform1i(g.map,0);c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);b.__webglSprites.sort(R);
c=0;for(e=b.__webglSprites.length;c<e;c++)f=b.__webglSprites[c],f.material===void 0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(h.uniform1i(g.useScreenCoordinates,1),h.uniform3f(g.screenPosition,(f.position.x-p)/p,(m-f.position.y)/m,Math.max(0,Math.min(1,f.position.z)))):(h.uniform1i(g.useScreenCoordinates,0),h.uniform1i(g.affectedByDistance,f.affectedByDistance?1:0),h.uniformMatrix4fv(g.modelViewMatrix,false,f._modelViewMatrixArray)),k=f.map.image.width/(f.scaleByViewport?_viewportHeight:
1),o[0]=k*j*f.scale.x,o[1]=k*f.scale.y,h.uniform2f(g.uvScale,f.uvScale.x,f.uvScale.y),h.uniform2f(g.uvOffset,f.uvOffset.x,f.uvOffset.y),h.uniform2f(g.alignment,f.alignment.x,f.alignment.y),h.uniform1f(g.opacity,f.opacity),h.uniform1f(g.rotation,f.rotation),h.uniform2fv(g.scale,o),f.mergeWith3D&&!n?(h.enable(h.DEPTH_TEST),n=true):!f.mergeWith3D&&n&&(h.disable(h.DEPTH_TEST),n=false),$(f.blending),X(f.map,0),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0));h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);
h.depthMask(qa)}function V(b,p){var m,n,t=b.__webglLensFlares.length,u,v,z,y=new THREE.Vector3,x=_viewportHeight/_viewportWidth,A=_viewportWidth*0.5,G=_viewportHeight*0.5,D=16/_viewportHeight,I=[D*x,D],C=[1,1,0],F=[1,1],H=c;m=d;h.useProgram(e);ga=e;wa=-1;ea||(h.enableVertexAttribArray(d.vertex),h.enableVertexAttribArray(d.uv),ea=true);h.uniform1i(H.occlusionMap,0);h.uniform1i(H.map,1);h.bindBuffer(h.ARRAY_BUFFER,f);h.vertexAttribPointer(m.vertex,2,h.FLOAT,false,16,0);h.vertexAttribPointer(m.uv,2,
h.FLOAT,false,16,8);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g);h.disable(h.CULL_FACE);h.depthMask(false);h.activeTexture(h.TEXTURE0);h.bindTexture(h.TEXTURE_2D,j);h.activeTexture(h.TEXTURE1);for(n=0;n<t;n++)if(m=b.__webglLensFlares[n].object,y.set(m.matrixWorld.n14,m.matrixWorld.n24,m.matrixWorld.n34),p.matrixWorldInverse.multiplyVector3(y),p.projectionMatrix.multiplyVector3(y),C[0]=y.x,C[1]=y.y,C[2]=y.z,F[0]=C[0]*A+A,F[1]=C[1]*G+G,k||F[0]>0&&F[0]<_viewportWidth&&F[1]>0&&F[1]<_viewportHeight){h.bindTexture(h.TEXTURE_2D,
o);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGB,F[0]-8,F[1]-8,16,16,0);h.uniform1i(H.renderType,0);h.uniform2fv(H.scale,I);h.uniform3fv(H.screenPosition,C);h.disable(h.BLEND);h.enable(h.DEPTH_TEST);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);h.bindTexture(h.TEXTURE_2D,j);h.copyTexImage2D(h.TEXTURE_2D,0,h.RGBA,F[0]-8,F[1]-8,16,16,0);h.uniform1i(H.renderType,1);h.disable(h.DEPTH_TEST);h.bindTexture(h.TEXTURE_2D,o);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0);m.positionScreen.x=C[0];m.positionScreen.y=
C[1];m.positionScreen.z=C[2];m.customUpdateCallback?m.customUpdateCallback(m):m.updateLensFlares();h.uniform1i(H.renderType,2);h.enable(h.BLEND);u=0;for(v=m.lensFlares.length;u<v;u++)if(z=m.lensFlares[u],z.opacity>0.0010&&z.scale>0.0010)C[0]=z.x,C[1]=z.y,C[2]=z.z,D=z.size*z.scale/_viewportHeight,I[0]=D*x,I[1]=D,h.uniform3fv(H.screenPosition,C),h.uniform2fv(H.scale,I),h.uniform1f(H.rotation,z.rotation),h.uniform1f(H.opacity,z.opacity),$(z.blending),X(z.texture,1),h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,
0)}h.enable(h.CULL_FACE);h.enable(h.DEPTH_TEST);h.depthMask(qa)}function U(b,d){b._modelViewMatrix.multiplyToArray(d.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function O(b){var d,c,e,f;if(b instanceof THREE.Mesh){c=b.geometry;for(d in c.geometryGroups){e=c.geometryGroups[d];a:{for(var g=f=void 0,j=void 0,k=void 0,o=void 0,o=e.__materials,g=0,j=o.length;g<j;g++)if(k=o[g],k.attributes)for(f in k.attributes)if(k.attributes[f].needsUpdate){f=
true;break a}f=false}if(c.__dirtyVertices||c.__dirtyMorphTargets||c.__dirtyElements||c.__dirtyUvs||c.__dirtyNormals||c.__dirtyColors||c.__dirtyTangents||f)if(f=e,g=b,j=h.DYNAMIC_DRAW,f.__inittedArrays){var p=void 0,m=void 0,n=void 0,t=void 0,u=void 0,v=void 0,z=void 0,y=void 0,x=void 0,A=void 0,G=void 0,C=void 0,D=void 0,F=void 0,H=void 0,B=void 0,E=void 0,w=void 0,L=void 0,M=p=p=m=L=L=void 0,K=0,N=0,S=0,Z=0,R=0,U=0,O=0,V=0,P=0,J=0,Q=0,E=B=0,T=f.__vertexArray,aa=f.__uvArray,ca=f.__uv2Array,da=f.__normalArray,
W=f.__tangentArray,Y=f.__colorArray,X=f.__skinVertexAArray,$=f.__skinVertexBArray,ma=f.__skinIndexArray,na=f.__skinWeightArray,ja=f.__morphTargetsArrays,ga=f.__webglCustomAttributes,w=void 0,ea=f.__faceArray,ha=f.__lineArray,oa=f.__needsSmoothNormals,y=f.__vertexColorType,z=f.__uvType,x=f.__normalType,fa=g.geometry,qa=fa.__dirtyVertices,va=fa.__dirtyElements,ta=fa.__dirtyUvs,wa=fa.__dirtyNormals,za=fa.__dirtyTangents,Aa=fa.__dirtyColors,Ba=fa.__dirtyMorphTargets,ua=fa.vertices,Ya=f.faces,ab=fa.faces,
Za=fa.faceVertexUvs[0],$a=fa.faceVertexUvs[1],Ma=fa.skinVerticesA,Na=fa.skinVerticesB,Oa=fa.skinIndices,Ga=fa.skinWeights,Ka=g instanceof THREE.ShadowVolume?fa.edgeFaces:void 0,Da=fa.morphTargets;if(ga)for(M in ga)ga[M].offset=0,ga[M].offsetSrc=0;k=0;for(o=Ya.length;k<o;k++)if(p=Ya[k],m=ab[p],Za&&(A=Za[p]),$a&&(G=$a[p]),p=m.vertexNormals,n=m.normal,t=m.vertexColors,u=m.color,v=m.vertexTangents,m instanceof THREE.Face3){if(qa)C=ua[m.a].position,D=ua[m.b].position,F=ua[m.c].position,T[N]=C.x,T[N+1]=
C.y,T[N+2]=C.z,T[N+3]=D.x,T[N+4]=D.y,T[N+5]=D.z,T[N+6]=F.x,T[N+7]=F.y,T[N+8]=F.z,N+=9;if(ga)for(M in ga)if(w=ga[M],w.__original.needsUpdate)B=w.offset,E=w.offsetSrc,w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[B+0]=w.value[m.a],w.array[B+1]=w.value[m.b],w.array[B+2]=w.value[m.c]):w.boundTo==="faces"?(w.array[B+0]=w.value[E],w.array[B+1]=w.value[E],w.array[B+2]=w.value[E],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[B+0]=w.value[E+0],w.array[B+1]=w.value[E+1],w.array[B+2]=
w.value[E+2],w.offsetSrc+=3),w.offset+=3):(w.boundTo===void 0||w.boundTo==="vertices"?(C=w.value[m.a],D=w.value[m.b],F=w.value[m.c]):w.boundTo==="faces"?(C=w.value[E],D=w.value[E],F=w.value[E],w.offsetSrc++):w.boundTo==="faceVertices"&&(C=w.value[E+0],D=w.value[E+1],F=w.value[E+2],w.offsetSrc+=3),w.size===2?(w.array[B+0]=C.x,w.array[B+1]=C.y,w.array[B+2]=D.x,w.array[B+3]=D.y,w.array[B+4]=F.x,w.array[B+5]=F.y,w.offset+=6):w.size===3?(w.type==="c"?(w.array[B+0]=C.r,w.array[B+1]=C.g,w.array[B+2]=C.b,
w.array[B+3]=D.r,w.array[B+4]=D.g,w.array[B+5]=D.b,w.array[B+6]=F.r,w.array[B+7]=F.g,w.array[B+8]=F.b):(w.array[B+0]=C.x,w.array[B+1]=C.y,w.array[B+2]=C.z,w.array[B+3]=D.x,w.array[B+4]=D.y,w.array[B+5]=D.z,w.array[B+6]=F.x,w.array[B+7]=F.y,w.array[B+8]=F.z),w.offset+=9):(w.array[B+0]=C.x,w.array[B+1]=C.y,w.array[B+2]=C.z,w.array[B+3]=C.w,w.array[B+4]=D.x,w.array[B+5]=D.y,w.array[B+6]=D.z,w.array[B+7]=D.w,w.array[B+8]=F.x,w.array[B+9]=F.y,w.array[B+10]=F.z,w.array[B+11]=F.w,w.offset+=12));if(Ba){B=
0;for(E=Da.length;B<E;B++)C=Da[B].vertices[m.a].position,D=Da[B].vertices[m.b].position,F=Da[B].vertices[m.c].position,w=ja[B],w[Q+0]=C.x,w[Q+1]=C.y,w[Q+2]=C.z,w[Q+3]=D.x,w[Q+4]=D.y,w[Q+5]=D.z,w[Q+6]=F.x,w[Q+7]=F.y,w[Q+8]=F.z;Q+=9}if(Ga.length)B=Ga[m.a],E=Ga[m.b],w=Ga[m.c],na[J]=B.x,na[J+1]=B.y,na[J+2]=B.z,na[J+3]=B.w,na[J+4]=E.x,na[J+5]=E.y,na[J+6]=E.z,na[J+7]=E.w,na[J+8]=w.x,na[J+9]=w.y,na[J+10]=w.z,na[J+11]=w.w,B=Oa[m.a],E=Oa[m.b],w=Oa[m.c],ma[J]=B.x,ma[J+1]=B.y,ma[J+2]=B.z,ma[J+3]=B.w,ma[J+4]=
E.x,ma[J+5]=E.y,ma[J+6]=E.z,ma[J+7]=E.w,ma[J+8]=w.x,ma[J+9]=w.y,ma[J+10]=w.z,ma[J+11]=w.w,B=Ma[m.a],E=Ma[m.b],w=Ma[m.c],X[J]=B.x,X[J+1]=B.y,X[J+2]=B.z,X[J+3]=1,X[J+4]=E.x,X[J+5]=E.y,X[J+6]=E.z,X[J+7]=1,X[J+8]=w.x,X[J+9]=w.y,X[J+10]=w.z,X[J+11]=1,B=Na[m.a],E=Na[m.b],w=Na[m.c],$[J]=B.x,$[J+1]=B.y,$[J+2]=B.z,$[J+3]=1,$[J+4]=E.x,$[J+5]=E.y,$[J+6]=E.z,$[J+7]=1,$[J+8]=w.x,$[J+9]=w.y,$[J+10]=w.z,$[J+11]=1,J+=12;if(Aa&&y)t.length==3&&y==THREE.VertexColors?(m=t[0],B=t[1],E=t[2]):E=B=m=u,Y[P]=m.r,Y[P+1]=m.g,
Y[P+2]=m.b,Y[P+3]=B.r,Y[P+4]=B.g,Y[P+5]=B.b,Y[P+6]=E.r,Y[P+7]=E.g,Y[P+8]=E.b,P+=9;if(za&&fa.hasTangents)t=v[0],u=v[1],m=v[2],W[O]=t.x,W[O+1]=t.y,W[O+2]=t.z,W[O+3]=t.w,W[O+4]=u.x,W[O+5]=u.y,W[O+6]=u.z,W[O+7]=u.w,W[O+8]=m.x,W[O+9]=m.y,W[O+10]=m.z,W[O+11]=m.w,O+=12;if(wa&&x)if(p.length==3&&oa)for(v=0;v<3;v++)n=p[v],da[U]=n.x,da[U+1]=n.y,da[U+2]=n.z,U+=3;else for(v=0;v<3;v++)da[U]=n.x,da[U+1]=n.y,da[U+2]=n.z,U+=3;if(ta&&A!==void 0&&z)for(v=0;v<3;v++)p=A[v],aa[S]=p.u,aa[S+1]=p.v,S+=2;if(ta&&G!==void 0&&
z)for(v=0;v<3;v++)p=G[v],ca[Z]=p.u,ca[Z+1]=p.v,Z+=2;va&&(ea[R]=K,ea[R+1]=K+1,ea[R+2]=K+2,R+=3,ha[V]=K,ha[V+1]=K+1,ha[V+2]=K,ha[V+3]=K+2,ha[V+4]=K+1,ha[V+5]=K+2,V+=6,K+=3)}else if(m instanceof THREE.Face4){if(qa)C=ua[m.a].position,D=ua[m.b].position,F=ua[m.c].position,H=ua[m.d].position,T[N]=C.x,T[N+1]=C.y,T[N+2]=C.z,T[N+3]=D.x,T[N+4]=D.y,T[N+5]=D.z,T[N+6]=F.x,T[N+7]=F.y,T[N+8]=F.z,T[N+9]=H.x,T[N+10]=H.y,T[N+11]=H.z,N+=12;if(ga)for(M in ga)if(w=ga[M],w.__original.needsUpdate)B=w.offset,E=w.offsetSrc,
w.size===1?(w.boundTo===void 0||w.boundTo==="vertices"?(w.array[B+0]=w.value[m.a],w.array[B+1]=w.value[m.b],w.array[B+2]=w.value[m.c],w.array[B+3]=w.value[m.d]):w.boundTo==="faces"?(w.array[B+0]=w.value[E],w.array[B+1]=w.value[E],w.array[B+2]=w.value[E],w.array[B+3]=w.value[E],w.offsetSrc++):w.boundTo==="faceVertices"&&(w.array[B+0]=w.value[E+0],w.array[B+1]=w.value[E+1],w.array[B+2]=w.value[E+2],w.array[B+3]=w.value[E+3],w.offsetSrc+=4),w.offset+=4):(w.boundTo===void 0||w.boundTo==="vertices"?(C=
w.value[m.a],D=w.value[m.b],F=w.value[m.c],H=w.value[m.d]):w.boundTo==="faces"?(C=w.value[E],D=w.value[E],F=w.value[E],H=w.value[E],w.offsetSrc++):w.boundTo==="faceVertices"&&(C=w.value[E+0],D=w.value[E+1],F=w.value[E+2],H=w.value[E+3],w.offsetSrc+=4),w.size===2?(w.array[B+0]=C.x,w.array[B+1]=C.y,w.array[B+2]=D.x,w.array[B+3]=D.y,w.array[B+4]=F.x,w.array[B+5]=F.y,w.array[B+6]=H.x,w.array[B+7]=H.y,w.offset+=8):w.size===3?(w.type==="c"?(w.array[B+0]=C.r,w.array[B+1]=C.g,w.array[B+2]=C.b,w.array[B+3]=
D.r,w.array[B+4]=D.g,w.array[B+5]=D.b,w.array[B+6]=F.r,w.array[B+7]=F.g,w.array[B+8]=F.b,w.array[B+9]=H.r,w.array[B+10]=H.g,w.array[B+11]=H.b):(w.array[B+0]=C.x,w.array[B+1]=C.y,w.array[B+2]=C.z,w.array[B+3]=D.x,w.array[B+4]=D.y,w.array[B+5]=D.z,w.array[B+6]=F.x,w.array[B+7]=F.y,w.array[B+8]=F.z,w.array[B+9]=H.x,w.array[B+10]=H.y,w.array[B+11]=H.z),w.offset+=12):(w.array[B+0]=C.x,w.array[B+1]=C.y,w.array[B+2]=C.z,w.array[B+3]=C.w,w.array[B+4]=D.x,w.array[B+5]=D.y,w.array[B+6]=D.z,w.array[B+7]=D.w,
w.array[B+8]=F.x,w.array[B+9]=F.y,w.array[B+10]=F.z,w.array[B+11]=F.w,w.array[B+12]=H.x,w.array[B+13]=H.y,w.array[B+14]=H.z,w.array[B+15]=H.w,w.offset+=16));if(Ba){B=0;for(E=Da.length;B<E;B++)C=Da[B].vertices[m.a].position,D=Da[B].vertices[m.b].position,F=Da[B].vertices[m.c].position,H=Da[B].vertices[m.d].position,w=ja[B],w[Q+0]=C.x,w[Q+1]=C.y,w[Q+2]=C.z,w[Q+3]=D.x,w[Q+4]=D.y,w[Q+5]=D.z,w[Q+6]=F.x,w[Q+7]=F.y,w[Q+8]=F.z,w[Q+9]=H.x,w[Q+10]=H.y,w[Q+11]=H.z;Q+=12}if(Ga.length)B=Ga[m.a],E=Ga[m.b],w=Ga[m.c],
L=Ga[m.d],na[J]=B.x,na[J+1]=B.y,na[J+2]=B.z,na[J+3]=B.w,na[J+4]=E.x,na[J+5]=E.y,na[J+6]=E.z,na[J+7]=E.w,na[J+8]=w.x,na[J+9]=w.y,na[J+10]=w.z,na[J+11]=w.w,na[J+12]=L.x,na[J+13]=L.y,na[J+14]=L.z,na[J+15]=L.w,B=Oa[m.a],E=Oa[m.b],w=Oa[m.c],L=Oa[m.d],ma[J]=B.x,ma[J+1]=B.y,ma[J+2]=B.z,ma[J+3]=B.w,ma[J+4]=E.x,ma[J+5]=E.y,ma[J+6]=E.z,ma[J+7]=E.w,ma[J+8]=w.x,ma[J+9]=w.y,ma[J+10]=w.z,ma[J+11]=w.w,ma[J+12]=L.x,ma[J+13]=L.y,ma[J+14]=L.z,ma[J+15]=L.w,B=Ma[m.a],E=Ma[m.b],w=Ma[m.c],L=Ma[m.d],X[J]=B.x,X[J+1]=B.y,
X[J+2]=B.z,X[J+3]=1,X[J+4]=E.x,X[J+5]=E.y,X[J+6]=E.z,X[J+7]=1,X[J+8]=w.x,X[J+9]=w.y,X[J+10]=w.z,X[J+11]=1,X[J+12]=L.x,X[J+13]=L.y,X[J+14]=L.z,X[J+15]=1,B=Na[m.a],E=Na[m.b],w=Na[m.c],m=Na[m.d],$[J]=B.x,$[J+1]=B.y,$[J+2]=B.z,$[J+3]=1,$[J+4]=E.x,$[J+5]=E.y,$[J+6]=E.z,$[J+7]=1,$[J+8]=w.x,$[J+9]=w.y,$[J+10]=w.z,$[J+11]=1,$[J+12]=m.x,$[J+13]=m.y,$[J+14]=m.z,$[J+15]=1,J+=16;if(Aa&&y)t.length==4&&y==THREE.VertexColors?(m=t[0],B=t[1],E=t[2],t=t[3]):t=E=B=m=u,Y[P]=m.r,Y[P+1]=m.g,Y[P+2]=m.b,Y[P+3]=B.r,Y[P+4]=
B.g,Y[P+5]=B.b,Y[P+6]=E.r,Y[P+7]=E.g,Y[P+8]=E.b,Y[P+9]=t.r,Y[P+10]=t.g,Y[P+11]=t.b,P+=12;if(za&&fa.hasTangents)t=v[0],u=v[1],m=v[2],v=v[3],W[O]=t.x,W[O+1]=t.y,W[O+2]=t.z,W[O+3]=t.w,W[O+4]=u.x,W[O+5]=u.y,W[O+6]=u.z,W[O+7]=u.w,W[O+8]=m.x,W[O+9]=m.y,W[O+10]=m.z,W[O+11]=m.w,W[O+12]=v.x,W[O+13]=v.y,W[O+14]=v.z,W[O+15]=v.w,O+=16;if(wa&&x)if(p.length==4&&oa)for(v=0;v<4;v++)n=p[v],da[U]=n.x,da[U+1]=n.y,da[U+2]=n.z,U+=3;else for(v=0;v<4;v++)da[U]=n.x,da[U+1]=n.y,da[U+2]=n.z,U+=3;if(ta&&A!==void 0&&z)for(v=
0;v<4;v++)p=A[v],aa[S]=p.u,aa[S+1]=p.v,S+=2;if(ta&&G!==void 0&&z)for(v=0;v<4;v++)p=G[v],ca[Z]=p.u,ca[Z+1]=p.v,Z+=2;va&&(ea[R]=K,ea[R+1]=K+1,ea[R+2]=K+3,ea[R+3]=K+1,ea[R+4]=K+2,ea[R+5]=K+3,R+=6,ha[V]=K,ha[V+1]=K+1,ha[V+2]=K,ha[V+3]=K+3,ha[V+4]=K+1,ha[V+5]=K+2,ha[V+6]=K+2,ha[V+7]=K+3,V+=8,K+=4)}if(Ka){k=0;for(o=Ka.length;k<o;k++)ea[R]=Ka[k].a,ea[R+1]=Ka[k].b,ea[R+2]=Ka[k].c,ea[R+3]=Ka[k].a,ea[R+4]=Ka[k].c,ea[R+5]=Ka[k].d,R+=6}qa&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglVertexBuffer),h.bufferData(h.ARRAY_BUFFER,
T,j));if(ga)for(M in ga)w=ga[M],w.__original.needsUpdate&&(h.bindBuffer(h.ARRAY_BUFFER,w.buffer),h.bufferData(h.ARRAY_BUFFER,w.array,j));if(Ba){B=0;for(E=Da.length;B<E;B++)h.bindBuffer(h.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[B]),h.bufferData(h.ARRAY_BUFFER,ja[B],j)}Aa&&P>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglColorBuffer),h.bufferData(h.ARRAY_BUFFER,Y,j));wa&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglNormalBuffer),h.bufferData(h.ARRAY_BUFFER,da,j));za&&fa.hasTangents&&(h.bindBuffer(h.ARRAY_BUFFER,
f.__webglTangentBuffer),h.bufferData(h.ARRAY_BUFFER,W,j));ta&&S>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglUVBuffer),h.bufferData(h.ARRAY_BUFFER,aa,j));ta&&Z>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglUV2Buffer),h.bufferData(h.ARRAY_BUFFER,ca,j));va&&(h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ea,j),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),h.bufferData(h.ELEMENT_ARRAY_BUFFER,ha,j));J>0&&(h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexABuffer),
h.bufferData(h.ARRAY_BUFFER,X,j),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),h.bufferData(h.ARRAY_BUFFER,$,j),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),h.bufferData(h.ARRAY_BUFFER,ma,j),h.bindBuffer(h.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),h.bufferData(h.ARRAY_BUFFER,na,j));g.dynamic||(delete f.__inittedArrays,delete f.__colorArray,delete f.__normalArray,delete f.__tangentArray,delete f.__uvArray,delete f.__uv2Array,delete f.__faceArray,delete f.__vertexArray,delete f.__lineArray,
delete f.__skinVertexAArray,delete f.__skinVertexBArray,delete f.__skinIndexArray,delete f.__skinWeightArray)}}c.__dirtyVertices=false;c.__dirtyMorphTargets=false;c.__dirtyElements=false;c.__dirtyUvs=false;c.__dirtyNormals=false;c.__dirtyTangents=false;c.__dirtyColors=false;var sa;e=e.__materials;c=0;for(b=e.length;c<b;c++)if(d=e[c],d.attributes)for(sa in d.attributes)d.attributes[sa].needsUpdate=false}else if(b instanceof THREE.Ribbon){c=b.geometry;if(c.__dirtyVertices||c.__dirtyColors){sa=c;b=h.DYNAMIC_DRAW;
o=sa.vertices;e=sa.colors;z=o.length;f=e.length;y=sa.__vertexArray;g=sa.__colorArray;x=sa.__dirtyColors;if(sa.__dirtyVertices){for(j=0;j<z;j++)k=o[j].position,d=j*3,y[d]=k.x,y[d+1]=k.y,y[d+2]=k.z;h.bindBuffer(h.ARRAY_BUFFER,sa.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,y,b)}if(x){for(j=0;j<f;j++)color=e[j],d=j*3,g[d]=color.r,g[d+1]=color.g,g[d+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,sa.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,g,b)}}c.__dirtyVertices=false;c.__dirtyColors=false}else if(b instanceof
THREE.Line){c=b.geometry;if(c.__dirtyVertices||c.__dirtyColors){sa=c;b=h.DYNAMIC_DRAW;o=sa.vertices;e=sa.colors;z=o.length;f=e.length;y=sa.__vertexArray;g=sa.__colorArray;x=sa.__dirtyColors;if(sa.__dirtyVertices){for(j=0;j<z;j++)k=o[j].position,d=j*3,y[d]=k.x,y[d+1]=k.y,y[d+2]=k.z;h.bindBuffer(h.ARRAY_BUFFER,sa.__webglVertexBuffer);h.bufferData(h.ARRAY_BUFFER,y,b)}if(x){for(j=0;j<f;j++)color=e[j],d=j*3,g[d]=color.r,g[d+1]=color.g,g[d+2]=color.b;h.bindBuffer(h.ARRAY_BUFFER,sa.__webglColorBuffer);h.bufferData(h.ARRAY_BUFFER,
g,b)}}c.__dirtyVertices=false;c.__dirtyColors=false}else if(b instanceof THREE.ParticleSystem)c=b.geometry,(c.__dirtyVertices||c.__dirtyColors||b.sortParticles)&&I(c,h.DYNAMIC_DRAW,b),c.__dirtyVertices=false,c.__dirtyColors=false}function H(b,d){var c;for(c=b.length-1;c>=0;c--)b[c].object==d&&b.splice(c,1)}function da(b){var d,c,e,f,g,h,j,k,m={},o=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(f=b.faces.length;e<f;e++){g=b.faces[e];h=g.materials;var p=h,n=[];d=0;for(c=
p.length;d<c;d++)p[d]==void 0?n.push("undefined"):n.push(p[d].id);j=n.join("_");m[j]==void 0&&(m[j]={hash:j,counter:0});k=m[j].hash+"_"+m[j].counter;b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:h,vertices:0,numMorphTargets:o});g=g instanceof THREE.Face3?3:4;b.geometryGroups[k].vertices+g>65535&&(m[j].counter+=1,k=m[j].hash+"_"+m[j].counter,b.geometryGroups[k]==void 0&&(b.geometryGroups[k]={faces:[],materials:h,vertices:0,numMorphTargets:o}));b.geometryGroups[k].faces.push(e);
b.geometryGroups[k].vertices+=g}}function Q(b,d,c){b.push({buffer:d,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function $(b){if(b!=wa){switch(b){case THREE.AdditiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE);break;case THREE.SubtractiveBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:h.blendEquation(h.FUNC_ADD);h.blendFunc(h.ZERO,h.SRC_COLOR);break;default:h.blendEquationSeparate(h.FUNC_ADD,
h.FUNC_ADD),h.blendFuncSeparate(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA,h.ONE,h.ONE_MINUS_SRC_ALPHA)}wa=b}}function ha(b,d,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(h.texParameteri(b,h.TEXTURE_WRAP_S,T(d.wrapS)),h.texParameteri(b,h.TEXTURE_WRAP_T,T(d.wrapT)),h.texParameteri(b,h.TEXTURE_MAG_FILTER,T(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,T(d.minFilter)),h.generateMipmap(b)):(h.texParameteri(b,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(b,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(b,
h.TEXTURE_MAG_FILTER,Y(d.magFilter)),h.texParameteri(b,h.TEXTURE_MIN_FILTER,Y(d.minFilter)))}function X(b,d){if(b.needsUpdate)b.__webglInit?(h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texSubImage2D(h.TEXTURE_2D,0,0,0,h.RGBA,h.UNSIGNED_BYTE,b.image)):(b.__webglTexture=h.createTexture(),h.bindTexture(h.TEXTURE_2D,b.__webglTexture),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,b.image),b.__webglInit=true),ha(h.TEXTURE_2D,b,b.image),h.bindTexture(h.TEXTURE_2D,null),b.needsUpdate=false;
h.activeTexture(h.TEXTURE0+d);h.bindTexture(h.TEXTURE_2D,b.__webglTexture)}function N(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=true;if(b.stencilBuffer===void 0)b.stencilBuffer=true;b.__webglFramebuffer=h.createFramebuffer();b.__webglRenderbuffer=h.createRenderbuffer();b.__webglTexture=h.createTexture();h.bindTexture(h.TEXTURE_2D,b.__webglTexture);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,T(b.wrapS));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,T(b.wrapT));h.texParameteri(h.TEXTURE_2D,
h.TEXTURE_MAG_FILTER,T(b.magFilter));h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,T(b.minFilter));h.texImage2D(h.TEXTURE_2D,0,T(b.format),b.width,b.height,0,T(b.format),T(b.type),null);h.bindRenderbuffer(h.RENDERBUFFER,b.__webglRenderbuffer);h.bindFramebuffer(h.FRAMEBUFFER,b.__webglFramebuffer);h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,
h.DEPTH_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_STENCIL,b.width,b.height),h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_STENCIL_ATTACHMENT,h.RENDERBUFFER,b.__webglRenderbuffer)):h.renderbufferStorage(h.RENDERBUFFER,h.RGBA4,b.width,b.height);h.bindTexture(h.TEXTURE_2D,null);h.bindRenderbuffer(h.RENDERBUFFER,null);h.bindFramebuffer(h.FRAMEBUFFER,null)}var d,c;b?(d=b.__webglFramebuffer,c=b.width,b=b.height):(d=null,
c=_viewportWidth,b=_viewportHeight);d!=ja&&(h.bindFramebuffer(h.FRAMEBUFFER,d),h.viewport(_viewportX,_viewportY,c,b),ja=d)}function S(b,d){var c;b=="fragment"?c=h.createShader(h.FRAGMENT_SHADER):b=="vertex"&&(c=h.createShader(h.VERTEX_SHADER));h.shaderSource(c,d);h.compileShader(c);return!h.getShaderParameter(c,h.COMPILE_STATUS)?(console.error(h.getShaderInfoLog(c)),console.error(d),null):c}function Y(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return h.NEAREST;
default:return h.LINEAR}}function T(b){switch(b){case THREE.RepeatWrapping:return h.REPEAT;case THREE.ClampToEdgeWrapping:return h.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return h.MIRRORED_REPEAT;case THREE.NearestFilter:return h.NEAREST;case THREE.NearestMipMapNearestFilter:return h.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return h.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return h.LINEAR;case THREE.LinearMipMapNearestFilter:return h.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return h.LINEAR_MIPMAP_LINEAR;
case THREE.ByteType:return h.BYTE;case THREE.UnsignedByteType:return h.UNSIGNED_BYTE;case THREE.ShortType:return h.SHORT;case THREE.UnsignedShortType:return h.UNSIGNED_SHORT;case THREE.IntType:return h.INT;case THREE.UnsignedShortType:return h.UNSIGNED_INT;case THREE.FloatType:return h.FLOAT;case THREE.AlphaFormat:return h.ALPHA;case THREE.RGBFormat:return h.RGB;case THREE.RGBAFormat:return h.RGBA;case THREE.LuminanceFormat:return h.LUMINANCE;case THREE.LuminanceAlphaFormat:return h.LUMINANCE_ALPHA}return 0}
var aa=this,h,oa=[],ga=null,ja=null,qa=true,za=null,Aa=null,wa=null,Ba=null,ua=null;_oldPolygonOffsetUnits=_oldPolygonOffsetFactor=null;_cullEnabled=true;_viewportHeight=_viewportWidth=_viewportY=_viewportX=0;_frustum=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4];_projScreenMatrix=new THREE.Matrix4;_projectionMatrixArray=new Float32Array(16);_viewMatrixArray=new Float32Array(16);_vector3=new THREE.Vector4;_lights={ambient:[0,0,0],directional:{length:0,
colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};b=b||{};_canvas=b.canvas!==void 0?b.canvas:document.createElement("canvas");_stencil=b.stencil!==void 0?b.stencil:true;_antialias=b.antialias!==void 0?b.antialias:false;_clearColor=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0);_clearAlpha=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=_canvas;this.sortObjects=this.autoClear=
true;try{if(!(h=_canvas.getContext("experimental-webgl",{antialias:_antialias,stencil:_stencil})))throw"Error creating WebGL context.";}catch(va){console.error(va)}console.log(navigator.userAgent+" | "+h.getParameter(h.VERSION)+" | "+h.getParameter(h.VENDOR)+" | "+h.getParameter(h.RENDERER)+" | "+h.getParameter(h.SHADING_LANGUAGE_VERSION));h.clearColor(0,0,0,1);h.clearDepth(1);h.enable(h.DEPTH_TEST);h.depthFunc(h.LEQUAL);h.frontFace(h.CCW);h.cullFace(h.BACK);h.enable(h.CULL_FACE);h.enable(h.BLEND);
h.blendEquation(h.FUNC_ADD);h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);h.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha);_cullEnabled=true;this.context=h;var fa=h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;_stencil&&(t=void 0,m=void 0,u=void 0,v=void 0,x=void 0,z=void 0,y=void 0,b=void 0,p=void 0,b=new Float32Array(12),p=new Uint16Array(6),v=0.5,b[0]=-20,b[1]=-20,b[2]=-1,b[3]=20,b[4]=-20,b[5]=-1,b[6]=20,b[7]=20,b[8]=-1,b[9]=-20,b[10]=20,b[11]=-1,p[0]=0,p[1]=1,p[2]=2,p[3]=
0,p[4]=2,p[5]=3,x=h.createBuffer(),y=h.createBuffer(),h.bindBuffer(h.ARRAY_BUFFER,x),h.bufferData(h.ARRAY_BUFFER,b,h.STATIC_DRAW),h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,y),h.bufferData(h.ELEMENT_ARRAY_BUFFER,p,h.STATIC_DRAW),t=h.createProgram(),h.attachShader(t,S("fragment",THREE.ShaderLib.shadowPost.fragmentShader)),h.attachShader(t,S("vertex",THREE.ShaderLib.shadowPost.vertexShader)),h.linkProgram(t),z=h.getAttribLocation(t,"position"),m=h.getUniformLocation(t,"projectionMatrix"),u=h.getUniformLocation(t,
"darkness"));c=void 0;d=void 0;e=void 0;f=void 0;g=void 0;j=void 0;k=void 0;o=void 0;p=void 0;n=void 0;p=new Float32Array(16);n=new Uint16Array(6);b=0;p[b++]=-1;p[b++]=-1;p[b++]=0;p[b++]=0;p[b++]=1;p[b++]=-1;p[b++]=1;p[b++]=0;p[b++]=1;p[b++]=1;p[b++]=1;p[b++]=1;p[b++]=-1;p[b++]=1;p[b++]=0;p[b++]=1;b=0;n[b++]=0;n[b++]=1;n[b++]=2;n[b++]=0;n[b++]=2;n[b++]=3;f=h.createBuffer();g=h.createBuffer();o=h.createTexture();j=h.createTexture();h.bindBuffer(h.ARRAY_BUFFER,f);h.bufferData(h.ARRAY_BUFFER,p,h.STATIC_DRAW);
h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,g);h.bufferData(h.ELEMENT_ARRAY_BUFFER,n,h.STATIC_DRAW);h.bindTexture(h.TEXTURE_2D,o);h.texImage2D(h.TEXTURE_2D,0,h.RGB,16,16,0,h.RGB,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.bindTexture(h.TEXTURE_2D,j);h.texImage2D(h.TEXTURE_2D,0,h.RGBA,
16,16,0,h.RGBA,h.UNSIGNED_BYTE,null);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.NEAREST);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.NEAREST);h.getParameter(h.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(k=false,e=h.createProgram(),h.attachShader(e,S("fragment",THREE.ShaderLib.lensFlare.fragmentShader)),h.attachShader(e,S("vertex",THREE.ShaderLib.lensFlare.vertexShader))):
(k=true,e=h.createProgram(),h.attachShader(e,S("fragment",THREE.ShaderLib.lensFlareVertexTexture.fragmentShader)),h.attachShader(e,S("vertex",THREE.ShaderLib.lensFlareVertexTexture.vertexShader)));h.linkProgram(e);d={};c={};d.vertex=h.getAttribLocation(e,"position");d.uv=h.getAttribLocation(e,"UV");c.renderType=h.getUniformLocation(e,"renderType");c.map=h.getUniformLocation(e,"map");c.occlusionMap=h.getUniformLocation(e,"occlusionMap");c.opacity=h.getUniformLocation(e,"opacity");c.scale=h.getUniformLocation(e,
"scale");c.rotation=h.getUniformLocation(e,"rotation");c.screenPosition=h.getUniformLocation(e,"screenPosition");var ea=false;_sprite={};_sprite.vertices=new Float32Array(16);_sprite.faces=new Uint16Array(6);b=0;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=
1;_sprite.vertices[b++]=-1;_sprite.vertices[b++]=1;_sprite.vertices[b++]=0;_sprite.vertices[b++]=1;b=0;_sprite.faces[b++]=0;_sprite.faces[b++]=1;_sprite.faces[b++]=2;_sprite.faces[b++]=0;_sprite.faces[b++]=2;_sprite.faces[b++]=3;_sprite.vertexBuffer=h.createBuffer();_sprite.elementBuffer=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,_sprite.vertexBuffer);h.bufferData(h.ARRAY_BUFFER,_sprite.vertices,h.STATIC_DRAW);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,_sprite.elementBuffer);h.bufferData(h.ELEMENT_ARRAY_BUFFER,
_sprite.faces,h.STATIC_DRAW);_sprite.program=h.createProgram();h.attachShader(_sprite.program,S("fragment",THREE.ShaderLib.sprite.fragmentShader));h.attachShader(_sprite.program,S("vertex",THREE.ShaderLib.sprite.vertexShader));h.linkProgram(_sprite.program);_sprite.attributes={};_sprite.uniforms={};_sprite.attributes.position=h.getAttribLocation(_sprite.program,"position");_sprite.attributes.uv=h.getAttribLocation(_sprite.program,"uv");_sprite.uniforms.uvOffset=h.getUniformLocation(_sprite.program,
"uvOffset");_sprite.uniforms.uvScale=h.getUniformLocation(_sprite.program,"uvScale");_sprite.uniforms.rotation=h.getUniformLocation(_sprite.program,"rotation");_sprite.uniforms.scale=h.getUniformLocation(_sprite.program,"scale");_sprite.uniforms.alignment=h.getUniformLocation(_sprite.program,"alignment");_sprite.uniforms.map=h.getUniformLocation(_sprite.program,"map");_sprite.uniforms.opacity=h.getUniformLocation(_sprite.program,"opacity");_sprite.uniforms.useScreenCoordinates=h.getUniformLocation(_sprite.program,
"useScreenCoordinates");_sprite.uniforms.affectedByDistance=h.getUniformLocation(_sprite.program,"affectedByDistance");_sprite.uniforms.screenPosition=h.getUniformLocation(_sprite.program,"screenPosition");_sprite.uniforms.modelViewMatrix=h.getUniformLocation(_sprite.program,"modelViewMatrix");_sprite.uniforms.projectionMatrix=h.getUniformLocation(_sprite.program,"projectionMatrix");var ta=false;this.setSize=function(b,d){_canvas.width=b;_canvas.height=d;this.setViewport(0,0,_canvas.width,_canvas.height)};
this.setViewport=function(b,d,c,e){_viewportX=b;_viewportY=d;_viewportWidth=c;_viewportHeight=e;h.viewport(_viewportX,_viewportY,_viewportWidth,_viewportHeight)};this.setScissor=function(b,d,c,e){h.scissor(b,d,c,e)};this.enableScissorTest=function(b){b?h.enable(h.SCISSOR_TEST):h.disable(h.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){qa=b;h.depthMask(b)};this.setClearColorHex=function(b,d){_clearColor.setHex(b);_clearAlpha=d;h.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};
this.setClearColor=function(b,d){_clearColor.copy(b);_clearAlpha=d;h.clearColor(_clearColor.r,_clearColor.g,_clearColor.b,_clearAlpha)};this.clear=function(){h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT|h.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(b){v=b};this.getContext=function(){return h};this.initMaterial=function(b,d,c,e){var f,g,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.ShadowVolumeDynamicMaterial?j="shadowVolumeDynamic":b instanceof THREE.MeshNormalMaterial?
j="normal":b instanceof THREE.MeshBasicMaterial?j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,o,p;m=p=k=0;for(o=d.length;m<o;m++)g=d[m],g instanceof THREE.DirectionalLight&&p++,g instanceof
THREE.PointLight&&k++;k+p<=4?d=p:(d=Math.ceil(4*p/(k+p)),k=4-d);g={directional:d,point:k};p=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)p=e.bones.length;var n;a:{m=b.fragmentShader;o=b.vertexShader;var k=b.uniforms,d=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:g.directional,maxPointLights:g.point,maxBones:p},
t;g=[];j?g.push(j):(g.push(m),g.push(o));for(t in c)g.push(t),g.push(c[t]);j=g.join();t=0;for(g=oa.length;t<g;t++)if(oa[t].code==j){n=oa[t].program;break a}t=h.createProgram();g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?
"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");p=[fa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
h.attachShader(t,S("fragment",g+m));h.attachShader(t,S("vertex",p+o));h.linkProgram(t);h.getProgramParameter(t,h.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+h.getProgramParameter(t,h.VALIDATE_STATUS)+", gl error ["+h.getError()+"]");t.uniforms={};t.attributes={};var u;m="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(u in k)m.push(u);u=m;k=0;for(m=u.length;k<
m;k++)o=u[k],t.uniforms[o]=h.getUniformLocation(t,o);m="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(u=0;u<c.maxMorphTargets;u++)m.push("morphTarget"+u);for(n in d)m.push(n);n=m;u=0;for(d=n.length;u<d;u++)c=n[u],t.attributes[c]=h.getAttribLocation(t,c);oa.push({program:t,code:j});n=t}b.program=n;n=b.program.attributes;n.position>=0&&h.enableVertexAttribArray(n.position);n.color>=0&&h.enableVertexAttribArray(n.color);n.normal>=0&&h.enableVertexAttribArray(n.normal);
n.tangent>=0&&h.enableVertexAttribArray(n.tangent);b.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(h.enableVertexAttribArray(n.skinVertexA),h.enableVertexAttribArray(n.skinVertexB),h.enableVertexAttribArray(n.skinIndex),h.enableVertexAttribArray(n.skinWeight));if(b.attributes)for(f in b.attributes)n[f]!==void 0&&n[f]>=0&&h.enableVertexAttribArray(n[f]);if(b.morphTargets){b.numSupportedMorphTargets=0;n.morphTarget0>=0&&(h.enableVertexAttribArray(n.morphTarget0),b.numSupportedMorphTargets++);
n.morphTarget1>=0&&(h.enableVertexAttribArray(n.morphTarget1),b.numSupportedMorphTargets++);n.morphTarget2>=0&&(h.enableVertexAttribArray(n.morphTarget2),b.numSupportedMorphTargets++);n.morphTarget3>=0&&(h.enableVertexAttribArray(n.morphTarget3),b.numSupportedMorphTargets++);n.morphTarget4>=0&&(h.enableVertexAttribArray(n.morphTarget4),b.numSupportedMorphTargets++);n.morphTarget5>=0&&(h.enableVertexAttribArray(n.morphTarget5),b.numSupportedMorphTargets++);n.morphTarget6>=0&&(h.enableVertexAttribArray(n.morphTarget6),
b.numSupportedMorphTargets++);n.morphTarget7>=0&&(h.enableVertexAttribArray(n.morphTarget7),b.numSupportedMorphTargets++);e.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);b=0;for(f=this.maxMorphTargets;b<f;b++)e.__webglMorphTargetInfluences[b]=0}};this.render=function(b,d,c,e){var f,g,j,k,m,o,n,p,t=b.lights,u=b.fog;aa.data.vertices=0;aa.data.faces=0;aa.data.drawCalls=0;d.matrixAutoUpdate&&d.update(void 0,true);b.update(void 0,false,d);d.matrixWorldInverse.flattenToArray(_viewMatrixArray);
d.projectionMatrix.flattenToArray(_projectionMatrixArray);_projScreenMatrix.multiply(d.projectionMatrix,d.matrixWorldInverse);D(_projScreenMatrix);this.initWebGLObjects(b);N(c);(this.autoClear||e)&&this.clear();m=b.__webglObjects.length;for(e=0;e<m;e++)if(f=b.__webglObjects[e],n=f.object,n.visible)if(!(n instanceof THREE.Mesh)||F(n)){if(n.matrixWorld.flattenToArray(n._objectMatrixArray),U(n,d),W(f),f.render=true,this.sortObjects)f.object.renderDepth?f.z=f.object.renderDepth:(_vector3.copy(n.position),
_projScreenMatrix.multiplyVector3(_vector3),f.z=_vector3.z)}else f.render=false;else f.render=false;this.sortObjects&&b.__webglObjects.sort(R);o=b.__webglObjectsImmediate.length;for(e=0;e<o;e++)f=b.__webglObjectsImmediate[e],n=f.object,n.visible&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),U(n,d),P(f));$(THREE.NormalBlending);for(e=0;e<m;e++)if(f=b.__webglObjects[e],f.render){n=f.object;p=f.buffer;j=f.opaque;L(n);for(f=0;f<j.count;f++)k=j.list[f],K(k.depthTest),E(k.polygonOffset,
k.polygonOffsetFactor,k.polygonOffsetUnits),G(d,t,u,k,p,n)}for(e=0;e<o;e++)if(f=b.__webglObjectsImmediate[e],n=f.object,n.visible){j=f.opaque;L(n);for(f=0;f<j.count;f++)k=j.list[f],K(k.depthTest),E(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),g=C(d,t,u,k,n),n.render(function(b){A(b,g,k.shading)})}for(e=0;e<m;e++)if(f=b.__webglObjects[e],f.render){n=f.object;p=f.buffer;j=f.transparent;L(n);for(f=0;f<j.count;f++)k=j.list[f],$(k.blending),K(k.depthTest),E(k.polygonOffset,k.polygonOffsetFactor,
k.polygonOffsetUnits),G(d,t,u,k,p,n)}for(e=0;e<o;e++)if(f=b.__webglObjectsImmediate[e],n=f.object,n.visible){j=f.transparent;L(n);for(f=0;f<j.count;f++)k=j.list[f],$(k.blending),K(k.depthTest),E(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),g=C(d,t,u,k,n),n.render(function(b){A(b,g,k.shading)})}b.__webglSprites.length&&M(b,d);_stencil&&b.__webglShadowVolumes.length&&b.lights.length&&ca(b);b.__webglLensFlares.length&&V(b,d);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&
(h.bindTexture(h.TEXTURE_2D,c.__webglTexture),h.generateMipmap(h.TEXTURE_2D),h.bindTexture(h.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglShadowVolumes=[],b.__webglLensFlares=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],c=b,e=void 0,f=void 0,g=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=
new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(e in f=d.geometry,f.geometryGroups==void 0&&da(f),f.geometryGroups){g=f.geometryGroups[e];if(!g.__webglVertexBuffer){var j=g;j.__webglVertexBuffer=h.createBuffer();j.__webglNormalBuffer=h.createBuffer();j.__webglTangentBuffer=h.createBuffer();j.__webglColorBuffer=h.createBuffer();j.__webglUVBuffer=h.createBuffer();j.__webglUV2Buffer=h.createBuffer();j.__webglSkinVertexABuffer=
h.createBuffer();j.__webglSkinVertexBBuffer=h.createBuffer();j.__webglSkinIndicesBuffer=h.createBuffer();j.__webglSkinWeightsBuffer=h.createBuffer();j.__webglFaceBuffer=h.createBuffer();j.__webglLineBuffer=h.createBuffer();if(j.numMorphTargets){var k=void 0,m=void 0;j.__webglMorphTargetsBuffers=[];k=0;for(m=j.numMorphTargets;k<m;k++)j.__webglMorphTargetsBuffers.push(h.createBuffer())}for(var j=g,k=d,n=void 0,o=void 0,p=void 0,t=void 0,u=void 0,v=void 0,z=v=m=0,y=void 0,x=void 0,p=void 0,t=k.geometry,
u=t.faces,y=j.faces,n=0,o=y.length;n<o;n++)p=y[n],p=u[p],p instanceof THREE.Face3?(m+=3,v+=1,z+=3):p instanceof THREE.Face4&&(m+=4,v+=2,z+=4);for(var n=j,o=k,A=void 0,C=void 0,A=void 0,p=[],u=0,y=o.materials.length;u<y;u++)if(A=o.materials[u],A instanceof THREE.MeshFaceMaterial){A=0;for(l=n.materials.length;A<l;A++)(C=n.materials[A])&&p.push(C)}else(C=A)&&p.push(C);n=p;j.__materials=n;a:{u=void 0;y=n.length;for(o=0;o<y;o++)if(u=n[o],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){o=true;
break a}o=false}a:{y=void 0;p=n.length;for(u=0;u<p;u++)if(y=n[u],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}y=false}a:{p=void 0;A=n.length;for(u=0;u<A;u++)if(p=n[u],p.vertexColors){p=p.vertexColors;break a}p=false}j.__vertexArray=new Float32Array(m*3);if(y)j.__normalArray=new Float32Array(m*3);if(t.hasTangents)j.__tangentArray=new Float32Array(m*4);if(p)j.__colorArray=
new Float32Array(m*3);if(o){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(m*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(m*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(m*4),j.__skinVertexBArray=new Float32Array(m*4),j.__skinIndexArray=new Float32Array(m*4),j.__skinWeightArray=new Float32Array(m*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*
6:0));j.__lineArray=new Uint16Array(z*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(u=j.numMorphTargets;t<u;t++)j.__morphTargetsArrays.push(new Float32Array(m*3))}j.__needsSmoothNormals=y==THREE.SmoothShading;j.__uvType=o;j.__vertexColorType=p;j.__normalType=y;j.__webglFaceCount=v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0);j.__webglLineCount=z*2;t=0;for(u=n.length;t<u;t++)if(o=n[t],o.attributes)for(a in j.__webglCustomAttributes={},o.attributes){p=o.attributes[a];y={};for(x in p)y[x]=
p[x];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=true,v=1,y.type==="v2"?v=2:y.type==="v3"?v=3:y.type==="v4"?v=4:y.type==="c"&&(v=3),y.size=v,y.array=new Float32Array(m*v),y.buffer=h.createBuffer(),y.buffer.belongsToAttribute=a,p.needsUpdate=true,y.__original=p;j.__webglCustomAttributes[a]=y}j.__inittedArrays=true;f.__dirtyVertices=true;f.__dirtyMorphTargets=true;f.__dirtyElements=true;f.__dirtyUvs=true;f.__dirtyNormals=true;f.__dirtyTangents=true;f.__dirtyColors=true}d instanceof
THREE.ShadowVolume?Q(c.__webglShadowVolumes,g,d):Q(c.__webglObjects,g,d)}else if(d instanceof THREE.LensFlare)Q(c.__webglLensFlares,void 0,d);else if(d instanceof THREE.Ribbon){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=f,g=e.vertices.length,e.__vertexArray=new Float32Array(g*3),e.__colorArray=new Float32Array(g*3),e.__webglVertexCount=g,f.__dirtyVertices=true,f.__dirtyColors=true;Q(c.__webglObjects,f,d)}else if(d instanceof
THREE.Line){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=f,g=e.vertices.length,e.__vertexArray=new Float32Array(g*3),e.__colorArray=new Float32Array(g*3),e.__webglLineCount=g,f.__dirtyVertices=true,f.__dirtyColors=true;Q(c.__webglObjects,f,d)}else if(d instanceof THREE.ParticleSystem){f=d.geometry;if(!f.__webglVertexBuffer)e=f,e.__webglVertexBuffer=h.createBuffer(),e.__webglColorBuffer=h.createBuffer(),e=f,g=e.vertices.length,
e.__vertexArray=new Float32Array(g*3),e.__colorArray=new Float32Array(g*3),e.__sortArray=[],e.__webglParticleCount=g,f.__dirtyVertices=true,f.__dirtyColors=true;Q(c.__webglObjects,f,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?c.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&c.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;)d=b.__objectsRemoved[0],c=b,d instanceof
THREE.ShadowVolume?H(c.__webglShadowVolumes,d):d instanceof THREE.Mesh||d instanceof THREE.ParticleSystem||d instanceof THREE.Ribbon||d instanceof THREE.Line?H(c.__webglObjects,d):d instanceof THREE.Sprite?H(c.__webglSprites,d):d instanceof THREE.LensFlare?H(c.__webglLensFlares,d):d instanceof THREE.MarchingCubes&&H(c.__webglObjectsImmediate,d),b.__objectsRemoved.splice(0,1);d=0;for(c=b.__webglObjects.length;d<c;d++)O(b.__webglObjects[d].object,b);d=0;for(c=b.__webglShadowVolumes.length;d<c;d++)O(b.__webglShadowVolumes[d].object,
b);d=0;for(c=b.__webglLensFlares.length;d<c;d++)O(b.__webglLensFlares[d].object,b)};this.setFaceCulling=function(b,d){b?(!d||d=="ccw"?h.frontFace(h.CCW):h.frontFace(h.CW),b=="back"?h.cullFace(h.BACK):b=="front"?h.cullFace(h.FRONT):h.cullFace(h.FRONT_AND_BACK),h.enable(h.CULL_FACE)):h.disable(h.CULL_FACE)};this.supportsVertexTextures=function(){return fa}};
THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:true;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:true};
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(b,c,d){d&&b.update(void 0,false,c);var d=b.sounds,e,f=d.length;for(e=0;e<f;e++)b=d[e],this.soundPosition.set(b.matrixWorld.n14,b.matrixWorld.n24,b.matrixWorld.n34),this.soundPosition.subSelf(c.position),b.isPlaying&&b.isLoaded&&(b.isAddedToDOM||b.addToDOM(this.domElement),b.calculateVolumeAndPan(this.soundPosition))}};
THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=true};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[[]];this.z=null};
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[[]];this.z=null};
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
THREE.ColorUtils={adjustHSV:function(b,c,d,e){var f=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,f);f.h=THREE.ColorUtils.clamp(f.h+c,0,1);f.s=THREE.ColorUtils.clamp(f.s+d,0,1);f.v=THREE.ColorUtils.clamp(f.v+e,0,1);b.setHSV(f.h,f.s,f.v)},rgbToHsv:function(b,c){var d=b.r,e=b.g,f=b.b,g=Math.max(Math.max(d,e),f),j=Math.min(Math.min(d,e),f);if(j==g)j=d=0;else{var k=g-j,j=k/g,d=d==g?(e-f)/k:e==g?2+(f-d)/k:4+(d-e)/k;d/=6;d<0&&(d+=1);d>1&&(d-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=d;c.s=j;c.v=g;return c},
clamp:function(b,c,d){return b<c?c:b>d?d:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
var GeometryUtils={merge:function(b,c){var d=c instanceof THREE.Mesh,e=b.vertices.length,f=d?c.geometry:c,g=b.vertices,j=f.vertices,k=b.faces,o=f.faces,p=b.faceVertexUvs[0],f=f.faceVertexUvs[0];d&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=j.length;n<t;n++){var m=new THREE.Vertex(j[n].position.clone());d&&c.matrix.multiplyVector3(m.position);g.push(m)}n=0;for(t=o.length;n<t;n++){var j=o[n],u,v,x=j.vertexNormals,m=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+e,j.b+e,j.c+e):
j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+e,j.b+e,j.c+e,j.d+e));u.normal.copy(j.normal);d=0;for(g=x.length;d<g;d++)v=x[d],u.vertexNormals.push(v.clone());u.color.copy(j.color);d=0;for(g=m.length;d<g;d++)v=m[d],u.vertexColors.push(v.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);k.push(u)}n=0;for(t=f.length;n<t;n++){e=f[n];k=[];d=0;for(g=e.length;d<g;d++)k.push(new THREE.UV(e[d].u,e[d].v));p.push(k)}}};
THREE.ImageUtils={loadTexture:function(b,c,d){var e=new Image,f=new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=true;d&&d(this)};e.src=b;return f},loadTextureCube:function(b,c,d){var e,f=[],g=new THREE.Texture(f,c),c=f.loadCount=0;for(e=b.length;c<e;++c)f[c]=new Image,f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=true;d&&d(this)},f[c].src=b[c];return g}};
THREE.SceneUtils={addMesh:function(b,c,d,e,f,g,j,k,o,p){c=new THREE.Mesh(c,p);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=j;c.rotation.y=k;c.rotation.z=o;b.addObject(c);return c},addPanoramaCubeWebGL:function(b,c,d){var e=THREE.ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new THREE.CubeGeometry(c,c,c,1,1,1,null,true),d);
b.addObject(c);return c},addPanoramaCube:function(b,c,d){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));c=new THREE.Mesh(new THREE.Cube(c,
c,c,1,1,e,true),new THREE.MeshFaceMaterial);b.addObject(c);return c},addPanoramaCubePlanes:function(b,c,d){var e=c/2,c=new THREE.Plane(c,c),f=Math.PI,g=Math.PI/2;THREE.SceneUtils.addMesh(b,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));THREE.SceneUtils.addMesh(b,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));THREE.SceneUtils.addMesh(b,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));THREE.SceneUtils.addMesh(b,
c,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));THREE.SceneUtils.addMesh(b,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}))},showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var d,e,f=b.children.length;for(e=0;e<f;e++)d=b.children[e],c(d),THREE.SceneUtils.traverseHierarchy(d,c)}};
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:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",
value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragmentShader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableSpecular;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tSpecular;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 specularTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nif( enableSpecular )\nspecularTex = texture2D( tSpecular, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = specularTex.r * pow( pointDotNormalHalf, uShininess );\npointDiffuse  += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight * pointDiffuseWeight;\nvec4 dirDiffuse  = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = specularTex.r * pow( dirDotNormalHalf, uShininess );\ndirDiffuse  += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight * dirDiffuseWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
vertexShader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,d,e,f,g=2*Math.ceil(b*3)+1;g>25&&(g=25);f=(g-1)*0.5;d=Array(g);for(c=e=0;c<g;++c)d[c]=Math.exp(-((c-f)*(c-f))/(2*b*b)),e+=d[c];for(c=0;c<g;++c)d[c]/=e;return d}};
THREE.AnimationHandler=function(){var b=[],c={},d={update:function(d){for(var c=0;c<b.length;c++)b[c].update(d)},addToUpdate:function(d){b.indexOf(d)===-1&&b.push(d)},removeFromUpdate:function(d){d=b.indexOf(d);d!==-1&&b.splice(d,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==true){for(var d=0;d<b.hierarchy.length;d++){for(var e=0;e<b.hierarchy[d].keys.length;e++){if(b.hierarchy[d].keys[e].time<
0)b.hierarchy[d].keys[e].time=0;if(b.hierarchy[d].keys[e].rot!==void 0&&!(b.hierarchy[d].keys[e].rot instanceof THREE.Quaternion)){var k=b.hierarchy[d].keys[e].rot;b.hierarchy[d].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(b.hierarchy[d].keys[0].morphTargets!==void 0){k={};for(e=0;e<b.hierarchy[d].keys.length;e++)for(var o=0;o<b.hierarchy[d].keys[e].morphTargets.length;o++){var p=b.hierarchy[d].keys[e].morphTargets[o];k[p]=-1}b.hierarchy[d].usedMorphTargets=k;for(e=0;e<b.hierarchy[d].keys.length;e++){var n=
{};for(p in k){for(o=0;o<b.hierarchy[d].keys[e].morphTargets.length;o++)if(b.hierarchy[d].keys[e].morphTargets[o]===p){n[p]=b.hierarchy[d].keys[e].morphTargetsInfluences[o];break}o===b.hierarchy[d].keys[e].morphTargets.length&&(n[p]=0)}b.hierarchy[d].keys[e].morphTargetsInfluences=n}}for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].time===b.hierarchy[d].keys[e-1].time&&(b.hierarchy[d].keys.splice(e,1),e--);for(e=1;e<b.hierarchy[d].keys.length;e++)b.hierarchy[d].keys[e].index=e}e=parseInt(b.length*
b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(d=0;d<b.hierarchy.length;d++)b.JIT.hierarchy.push(Array(e));b.initialized=true}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var d=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)d.push(b.bones[c]);else e(b,d);return d}},e=function(b,d){d.push(b);for(var c=0;c<b.children.length;c++)e(b.children[c],d)};d.LINEAR=0;d.CATMULLROM=1;
d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(b,c,d,e){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=false;this.loop=this.isPaused=true;this.interpolationType=d!==void 0?d:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:true;this.points=[];this.target=new THREE.Vector3};
THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=true;this.loop=b!==void 0?b:true;this.currentTime=c!==void 0?c:0;var d,e=this.hierarchy.length,f;for(d=0;d<e;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=true;f.matrixAutoUpdate=true;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[d].keys[0];g.rot=this.data.hierarchy[d].keys[0];g.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=false;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=false;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],d,e,f,g,j,k,o,p,n=this.data.JIT.hierarchy,t,m;this.currentTime+=b*this.timeScale;m=this.currentTime;t=this.currentTime%=this.data.length;p=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,v=this.hierarchy.length;u<v;u++)if(b=this.hierarchy[u],o=b.animationCache,this.JITCompile&&n[u][p]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=n[u][p],b.matrixAutoUpdate=false,b.matrixWorldNeedsUpdate=
false):(b.matrix=n[u][p],b.matrixAutoUpdate=false,b.matrixWorldNeedsUpdate=true);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var x=0;x<3;x++){d=c[x];j=o.prevKey[d];k=o.nextKey[d];if(k.time<=m){if(t<m)if(this.loop){j=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(d,u,1);k.time<t;)j=k,k=this.getNextKeyWith(d,u,k.index+1)}else{this.stop();return}else{do j=k,k=this.getNextKeyWith(d,u,k.index+1);while(k.time<
t)}o.prevKey[d]=j;o.nextKey[d]=k}b.matrixAutoUpdate=true;b.matrixWorldNeedsUpdate=true;e=(t-j.time)/(k.time-j.time);f=j[d];g=k[d];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+u),e=e<0?0:1;if(d==="pos")if(d=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)d.x=f[0]+(g[0]-f[0])*e,d.y=f[1]+(g[1]-f[1])*e,d.z=f[2]+(g[2]-f[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=f,this.points[2]=g,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,f=this.interpolateCatmullRom(this.points,e),d.x=f[0],d.y=f[1],d.z=f[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)e=this.interpolateCatmullRom(this.points,e*1.01),this.target.set(e[0],e[1],e[2]),this.target.subSelf(d),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,e,0)}else if(d===
"rot")THREE.Quaternion.slerp(f,g,b.quaternion,e);else if(d==="scl")d=b.scale,d.x=f[0]+(g[0]-f[0])*e,d.y=f[1]+(g[1]-f[1])*e,d.z=f[2]+(g[2]-f[2])*e}}if(this.JITCompile&&n[0][p]===void 0){this.hierarchy[0].update(void 0,true);for(u=0;u<this.hierarchy.length;u++)n[u][p]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var d=[],e=[],f,g,j,k,o,p;f=(b.length-1)*c;g=Math.floor(f);f-=g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>b.length-2?g:g+1;d[3]=g>b.length-3?g:g+2;g=b[d[0]];k=b[d[1]];o=b[d[2]];p=b[d[3]];d=f*f;j=f*d;e[0]=this.interpolate(g[0],k[0],o[0],p[0],f,d,j);e[1]=this.interpolate(g[1],k[1],o[1],p[1],f,d,j);e[2]=this.interpolate(g[2],k[2],o[2],p[2],f,d,j);return e};
THREE.Animation.prototype.interpolate=function(b,c,d,e,f,g,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*g+b*f+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,d){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d=d<e.length-1?d:e.length-1:d%=e.length;d<e.length;d++)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[0]};
THREE.Animation.prototype.getPrevKeyWith=function(b,c,d){for(var e=this.data.hierarchy[c].keys,d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+e.length;d>=0;d--)if(e[d][b]!==void 0)return e[d];return this.data.hierarchy[c].keys[e.length-1]};
THREE.QuakeCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=false;this.lookVertical=true;this.autoForward=false;this.activeLook=true;this.heightSpeed=false;this.heightCoef=1;this.heightMin=0;this.constrainVertical=false;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==
void 0)this.movementSpeed=b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=
b.heightMax;if(b.constrainVertical!==void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=false;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/
2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=true;break;case 2:this.moveBackward=true}this.mouseDragOn=true};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=false;break;case 2:this.moveBackward=false}this.mouseDragOn=false};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=
function(b){switch(b.keyCode){case 38:case 87:this.moveForward=true;break;case 37:case 65:this.moveLeft=true;break;case 40:case 83:this.moveBackward=true;break;case 39:case 68:this.moveRight=true;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=false;break;case 37:case 65:this.moveLeft=false;break;case 40:case 83:this.moveBackward=false;break;case 39:case 68:this.moveRight=false}};this.update=function(){var b=(new Date).getTime();
this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.translateZ(-(c+this.autoSpeedFactor));this.moveBackward&&this.translateZ(c);this.moveLeft&&this.translateX(-c);this.moveRight&&this.translateX(c);
c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target.position,f=this.position;b.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=f.y+100*Math.cos(this.phi);b.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta)}this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,
Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;f=this.position;b.x=f.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=f.y+100*Math.cos(this.phi);b.z=f.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},false);this.domElement.addEventListener("mousemove",
c(this,this.onMouseMove),false);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),false);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),false);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),false);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),false)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
THREE.QuakeCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
THREE.PathCamera=function(b){function c(b,d,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},g,j=d.getControlPointsArray(),k=d.getLength(),o=j.length,I=0;g=o-1;d={parent:-1,keys:[]};d.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};d.keys[g]={time:e,pos:j[g],rot:[0,0,0,1],scl:[1,1,1]};for(g=1;g<o-1;g++)I=e*k.chunks[g]/k.total,d.keys[g]={time:I,pos:j[g]};f.hierarchy[0]=d;THREE.AnimationHandler.add(f);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,false)}function d(b,
d){var c,e,f=new THREE.Geometry;for(c=0;c<b.points.length*d;c++)e=c/(b.points.length*d),e=b.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}function e(b,c){var e=d(c,10),f=d(c,10),g=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(e,g);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);f=
new THREE.SphereGeometry(1,16,8);g=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)e=new THREE.Mesh(f,g),e.position.copy(c.points[i]),e.updateMatrix(),b.addChild(e)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=true;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=true;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;
if(b.createDebugDummy!==void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=
this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(b,d,c){var e,j;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;e=this.phi%f;this.phi=e>=0?e:e+f;e=this.verticalAngleMap.srcRange;j=this.verticalAngleMap.dstRange;
var k=j[1]-j[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(j[1]-j[0])/(e[1]-e[0])+j[0]-j[0])/k)*k+j[0];e=this.horizontalAngleMap.srcRange;j=this.horizontalAngleMap.dstRange;k=j[1]-j[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-e[0])*(j[1]-j[0])/(e[1]-e[0])+j[0]-j[0])/k)*k+j[0];e=this.target.position;e.x=100*Math.sin(this.phi)*Math.cos(this.theta);e.y=100*Math.cos(this.phi);e.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,d,c)};this.onMouseMove=
function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),j=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(o,j);b.position.set(0,
10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,d){return function(){d.apply(b,arguments)}}(this,
this.onMouseMove),false)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=false;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=false;this.useQuaternion=true;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.moveForward=true;break;case 2:this.moveBackward=true}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),f=c.size[0]/2,g=c.size[1]/2;this.moveState.yawLeft=-(b.clientX-c.offset[0]-f)/f;this.moveState.pitchDown=(b.clientY-
c.offset[1]-g)/g;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=false;break;case 2:this.moveBackward=false}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*
this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVector.y*b);this.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,1).normalize();this.quaternion.multiplySelf(this.tmpQuaternion);this.matrix.setPosition(this.position);this.matrix.setRotationFromQuaternion(this.quaternion);this.matrixWorldNeedsUpdate=true;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||
this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),false);this.domElement.addEventListener("mousedown",c(this,this.mousedown),false);this.domElement.addEventListener("mouseup",c(this,this.mouseup),false);window.addEventListener("keydown",c(this,this.keydown),false);window.addEventListener("keyup",
c(this,this.keyup),false);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
THREE.RollCamera=function(b,c,d,e){THREE.Camera.call(this,b,c,d,e);this.mouseLook=true;this.autoForward=false;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=false;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Matrix4,o=false,p=1,n=0,t=0,m=0,u=0,v=0,x=window.innerWidth/2,z=window.innerHeight/
2;this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*v));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*t);this.translateY(b*m);o&&(this.roll+=this.rollSpeed*this.delta*p);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],
this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();j.copy(this.forward);g.set(0,1,0);f.cross(g,j).normalize();g.cross(j,f).normalize();this.matrix.n11=f.x;this.matrix.n12=g.x;this.matrix.n13=j.x;this.matrix.n21=f.y;this.matrix.n22=g.y;this.matrix.n23=j.y;this.matrix.n31=f.z;this.matrix.n32=g.z;this.matrix.n33=j.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=
Math.cos(this.roll);this.matrix.multiplySelf(k);this.matrixWorldNeedsUpdate=true;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=
this.matrix.n13*b;this.position.y-=this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){f.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);f.multiplyScalar(b);this.forward.subSelf(f);this.forward.normalize()};this.rotateVertically=function(b){g.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);g.multiplyScalar(b);this.forward.addSelf(g);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},false);this.domElement.addEventListener("mousemove",
function(b){u=(b.clientX-x)/window.innerWidth;v=(b.clientY-z)/window.innerHeight},false);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},false);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},false);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=
-1;break;case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:o=true;p=1;break;case 69:o=true;p=-1;break;case 82:m=1;break;case 70:m=-1}},false);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:o=false;break;case 69:o=false;break;case 82:m=0;break;case 70:m=0}},false)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
THREE.TrackballCamera=function(b){function c(b,d){return function(){d.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||false;this.noPan=b.noPan||
false;this.staticMoving=b.staticMoving||false;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=true;var d=false,e=this.STATE.NONE,f=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector2,o=new THREE.Vector2,p=new THREE.Vector2,n=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,
d){return new THREE.Vector2((b-this.screen.offsetLeft)/this.radius*0.5,(d-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,d){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-d)/this.radius,0),e=c.length();e>1?c.normalize():c.z=Math.sqrt(1-e*e);f=this.position.clone().subSelf(this.target.position);e=this.up.clone().setLength(c.y);e.addSelf(this.up.clone().crossSelf(f).setLength(c.x));
e.addSelf(f.setLength(c.z));return e};this.rotateCamera=function(){var b=Math.acos(g.dot(j)/g.length()/j.length());if(b){var d=(new THREE.Vector3).cross(g,j).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(d,-b);c.multiplyVector3(f);c.multiplyVector3(this.up);c.multiplyVector3(j);this.staticMoving?g=j:(c.setFromAxisAngle(d,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(g))}};this.zoomCamera=function(){var b=1+(o.y-k.y)*this.zoomSpeed;b!==1&&b>0&&(f.multiplyScalar(b),
this.staticMoving?k=o:k.y+=(o.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=n.clone().subSelf(p);if(b.lengthSq()){b.multiplyScalar(f.length()*this.panSpeed);var c=f.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?p=n:p.addSelf(b.sub(n,p).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*
this.maxDistance&&this.position.setLength(this.maxDistance),f.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,f.setLength(this.minDistance))};this.update=function(b,c,d){f=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,f);this.checkDistances();this.supr.update.call(this,b,c,d)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
false);this.domElement.addEventListener("mousemove",c(this,function(b){d&&(g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=o=this.getMouseOnScreen(b.clientX,b.clientY),p=n=this.getMouseOnScreen(b.clientX,b.clientY),d=false);e!==this.STATE.NONE&&(e===this.STATE.ROTATE?j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?o=this.getMouseOnScreen(b.clientX,b.clientY):e===this.STATE.PAN&&!this.noPan&&(n=this.getMouseOnScreen(b.clientX,b.clientY)))}),false);this.domElement.addEventListener("mousedown",
c(this,function(b){b.preventDefault();b.stopPropagation();if(e===this.STATE.NONE)e=b.button,e===this.STATE.ROTATE?g=j=this.getMouseProjectionOnBall(b.clientX,b.clientY):e===this.STATE.ZOOM&&!this.noZoom?k=o=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(p=n=this.getMouseOnScreen(b.clientX,b.clientY))}),false);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();e=this.STATE.NONE}),false);window.addEventListener("keydown",c(this,function(b){if(e===
this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])e=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)e=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)e=this.STATE.PAN;e!==this.STATE.NONE&&(d=true)}}),false);window.addEventListener("keyup",c(this,function(){if(e!==this.STATE.NONE)e=this.STATE.NONE}),false)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;
THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
THREE.CubeGeometry=function(b,c,d,e,f,g,j,k,o){function p(b,c,d,j,k,m,o,p){var t,u,v=e||1,x=f||1,P=k/2,W=m/2,R=n.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")t="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")t="y",x=g||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")t="x",v=g||1;var ca=v+1,M=x+1;k/=v;var V=m/x;for(u=0;u<M;u++)for(m=0;m<ca;m++){var U=new THREE.Vector3;U[b]=(m*k-P)*d;U[c]=(u*V-W)*j;U[t]=o;n.vertices.push(new THREE.Vertex(U))}for(u=0;u<x;u++)for(m=0;m<v;m++)n.faces.push(new THREE.Face4(m+ca*
u+R,m+ca*(u+1)+R,m+1+ca*(u+1)+R,m+1+ca*u+R,null,null,p)),n.faceVertexUvs[0].push([new THREE.UV(m/v,u/x),new THREE.UV(m/v,(u+1)/x),new THREE.UV((m+1)/v,(u+1)/x),new THREE.UV((m+1)/v,u/x)])}THREE.Geometry.call(this);var n=this,t=b/2,m=c/2,u=d/2,k=k?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([j])}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(o!=void 0)for(var x in o)this.sides[x]!=void 0&&
(this.sides[x]=o[x]);this.sides.px&&p("z","y",1*k,-1,d,c,-t,this.materials[0]);this.sides.nx&&p("z","y",-1*k,-1,d,c,t,this.materials[1]);this.sides.py&&p("x","z",1*k,1,b,d,m,this.materials[2]);this.sides.ny&&p("x","z",1*k,-1,b,d,-m,this.materials[3]);this.sides.pz&&p("x","y",1*k,-1,b,c,u,this.materials[4]);this.sides.nz&&p("x","y",-1*k,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],d=0,e=n.vertices.length;d<e;d++){for(var f=n.vertices[d],g=false,j=0,k=b.length;j<k;j++){var m=b[j];if(f.position.x==
m.position.x&&f.position.y==m.position.y&&f.position.z==m.position.z){c[d]=j;g=true;break}}if(!g)c[d]=b.length,b.push(new THREE.Vertex(f.position.clone()))}d=0;for(e=n.faces.length;d<e;d++)f=n.faces[d],f.a=c[f.a],f.b=c[f.b],f.c=c[f.c],f.d=c[f.d];n.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
THREE.CylinderGeometry=function(b,c,d,e,f,g){function j(b,c,d){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}THREE.Geometry.call(this);var k=this,o,p=Math.PI*2,n=e/2;for(o=0;o<b;o++)j(Math.sin(p*o/b)*c,Math.cos(p*o/b)*c,-n);for(o=0;o<b;o++)j(Math.sin(p*o/b)*d,Math.cos(p*o/b)*d,n);for(o=0;o<b;o++)k.faces.push(new THREE.Face4(o,o+b,b+(o+1)%b,(o+1)%b));if(d>0){j(0,0,-n-(g||0));for(o=b;o<b+b/2;o++)k.faces.push(new THREE.Face4(2*b,(2*o-2*b)%b,(2*o-2*b+1)%b,(2*o-2*b+2)%b))}if(c>0){j(0,0,n+
(f||0));for(o=b+b/2;o<2*b;o++)k.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o<b;o++){var c=[],d=this.faces[o],f=this.vertices[d.a],g=this.vertices[d.b],n=this.vertices[d.c],t=this.vertices[d.d];c.push(new THREE.UV(0.5+Math.atan2(f.position.x,f.position.y)/p,0.5+f.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/p,0.5+g.position.z/e));c.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.position.y)/p,0.5+n.position.z/
e));d instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(t.position.x,t.position.y)/p,0.5+t.position.z/e));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
THREE.IcosahedronGeometry=function(b){function c(b,c,d){var e=Math.sqrt(b*b+c*c+d*d);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(b/e,c/e,d/e)))-1}function d(b,c,d,e){e.faces.push(new THREE.Face3(b,c,d))}function e(b,d){var e=f.vertices[b].position,g=f.vertices[d].position;return c((e.x+g.x)/2,(e.y+g.y)/2,(e.z+g.z)/2)}var f=this,g=new THREE.Geometry,j;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);d(0,11,5,g);d(0,5,1,g);d(0,1,7,g);d(0,7,10,g);d(0,10,11,g);d(1,5,9,g);d(5,11,4,g);d(11,10,2,g);d(10,7,6,g);d(7,1,8,g);d(3,9,4,g);d(3,4,2,g);d(3,2,6,g);d(3,6,8,g);d(3,8,9,g);d(4,9,5,g);d(2,4,11,g);d(6,2,10,g);d(8,6,7,g);d(9,8,1,g);for(b=0;b<this.subdivisions;b++){j=new THREE.Geometry;for(var k in g.faces){var o=e(g.faces[k].a,g.faces[k].b),p=e(g.faces[k].b,g.faces[k].c),n=e(g.faces[k].c,g.faces[k].a);d(g.faces[k].a,o,n,j);d(g.faces[k].b,p,o,j);
d(g.faces[k].c,n,p,j);d(o,p,n,j)}g.faces=j.faces}f.faces=g.faces;delete g;delete j;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
THREE.LatheGeometry=function(b,c,d){THREE.Geometry.call(this);this.steps=c||12;this.angle=d||2*Math.PI;for(var c=this.angle/this.steps,d=[],e=[],f=[],g=[],j=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),d[k]=b[k].clone(),e[k]=this.vertices.length-1;for(var o=0;o<=this.angle+0.0010;o+=c){for(k=0;k<d.length;k++)o<this.angle?(d[k]=j.multiplyVector3(d[k].clone()),this.vertices.push(new THREE.Vertex(d[k])),f[k]=this.vertices.length-1):f=g;o==0&&(g=e);
for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(f[k],f[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-o/this.angle,k/b.length),new THREE.UV(1-o/this.angle,(k+1)/b.length),new THREE.UV(1-(o-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(o-c)/this.angle,k/b.length)]);e=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
THREE.PlaneGeometry=function(b,c,d,e){THREE.Geometry.call(this);var f,g=b/2,j=c/2,d=d||1,e=e||1,k=d+1,o=e+1;b/=d;var p=c/e;for(f=0;f<o;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-g,-(f*p-j),0)));for(f=0;f<e;f++)for(c=0;c<d;c++)this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f)),this.faceVertexUvs[0].push([new THREE.UV(c/d,f/e),new THREE.UV(c/d,(f+1)/e),new THREE.UV((c+1)/d,(f+1)/e),new THREE.UV((c+1)/d,f/e)]);this.computeCentroids();this.computeFaceNormals()};
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
THREE.SphereGeometry=function(b,c,d){THREE.Geometry.call(this);for(var b=b||50,e,f=Math.PI,g=Math.max(3,c||8),j=Math.max(2,d||6),c=[],d=0;d<j+1;d++){e=d/j;var k=b*Math.cos(e*f),o=b*Math.sin(e*f),p=[],n=0;for(e=0;e<g;e++){var t=2*e/g,m=o*Math.sin(t*f),t=o*Math.cos(t*f);(d==0||d==j)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,k,m)))-1);p.push(n)}c.push(p)}for(var u,v,x,f=c.length,d=0;d<f;d++)if(g=c[d].length,d>0)for(e=0;e<g;e++){p=e==g-1;j=c[d][p?0:e+1];k=c[d][p?g-1:e];o=c[d-1][p?
g-1:e];p=c[d-1][p?0:e+1];m=d/(f-1);u=(d-1)/(f-1);v=(e+1)/g;var t=e/g,n=new THREE.UV(1-v,m),m=new THREE.UV(1-t,m),t=new THREE.UV(1-t,u),z=new THREE.UV(1-v,u);d<c.length-1&&(u=this.vertices[j].position.clone(),v=this.vertices[k].position.clone(),x=this.vertices[o].position.clone(),u.normalize(),v.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,k,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([n,m,t]));d>1&&(u=
this.vertices[j].position.clone(),v=this.vertices[o].position.clone(),x=this.vertices[p].position.clone(),u.normalize(),v.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,o,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([n,t,z]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;THREE.TextGeometry=function(b,c){THREE.Geometry.call(this);this.parameters=c||{};this.set(b)};THREE.TextGeometry.prototype=new THREE.Geometry;THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
THREE.TextGeometry.prototype.set=function(b,c){function d(b,c,d){v.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))}function e(b,c,d,e){v.faces.push(new THREE.Face4(b,c,d,e))}this.text=b;var c=c||this.parameters,f=c.height!==void 0?c.height:50,g=c.curveSegments!==void 0?c.curveSegments:4,j=c.font!==void 0?c.font:"helvetiker",k=c.weight!==void 0?c.weight:"normal",o=c.style!==void 0?c.style:"normal",p=c.bezelThickness!==void 0?c.bezelThickness:10,n=c.bezelSize!==void 0?c.bezelSize:8,t=c.bezelEnabled!==
void 0?c.bezelEnabled:false;THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=g;THREE.FontUtils.face=j;THREE.FontUtils.weight=k;THREE.FontUtils.style=o;THREE.FontUtils.bezelSize=n;var k=THREE.FontUtils.drawText(b),g=k.points,m=k.faces,j=k.contour,u=k.bezel,v=this;v.vertices=[];v.faces=[];for(var x,o=g.length,z=m.length,n=u.length,k=0;k<o;k++)x=g[k],d(x.x,x.y,0);for(k=0;k<o;k++)x=g[k],d(x.x,x.y,f);if(t){for(k=0;k<n;k++)x=u[k],d(x.x,x.y,p);for(k=0;k<n;k++)x=u[k],d(x.x,x.y,f-
p)}for(k=0;k<z;k++)f=m[k],v.faces.push(new THREE.Face3(f[2],f[1],f[0]));for(k=0;k<z;k++)f=m[k],v.faces.push(new THREE.Face3(f[0]+o,f[1]+o,f[2]+o));var y;if(t)for(k=u.length;--k>0;){if(y){if(y.equals(j[k])){y=null;continue}}else y=j[k];p=o*2+k;m=p-1;e(p,m,m+n,p+n);for(t=0;t<o;t++)if(g[t].equals(j[k]))break;for(f=0;f<o;f++)if(g[f].equals(j[k-1]))break;e(t,f,m,p);e(p+n,m+n,f+o,t+o)}else for(k=j.length;--k>0;){if(y){if(y.equals(j[k])){y=null;continue}}else y=j[k];for(t=0;t<o;t++)if(g[t].equals(j[k]))break;
for(f=0;f<o;f++)if(g[f].equals(j[k-1]))break;e(t,f,f+o,t+o)}this.computeCentroids();this.computeFaceNormals()};
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},extractPoints:function(b,c){if(b.length<3)return console.log("not valid polygon"),
{points:b,faces:[]};var d,e,f,g,j=[],k;for(k in c){b=c[k];g=[];for(d in b)e=b[d],g.push(e.x+","+e.y);var o,p;p=g.slice(1).indexOf(g[0]);var n=this.Triangulate.area(b.slice(0,p+1))<0;e=[];for(p=-1;p<g.length;){o=p+1;p=g[o];p=g.slice(o+1).indexOf(p)+o;if(p<=o)break;var t=b.slice(o,p+1);n?this.Triangulate.area(t)<0?(o>0&&j.push({shape:f,holes:e}),f=t,e=[]):e.push(t):this.Triangulate.area(t)<0?(j.push({shape:t,holes:e}),e=[]):e.push(t);p++}n&&j.push({shape:f,holes:e})}var m,u,v,x,z,y;g=[];for(k=0;k<j.length;k++){o=
j[k];f=o.shape;e=o.holes;for(n=0;n<e.length;n++){p=e[n];v=Number.POSITIVE_INFINITY;for(t=0;t<p.length;t++){z=p[t];for(d=0;d<f.length;d++)x=f[d],x=z.distanceTo(x),x<v&&(v=x,m=t,u=d)}d=u-1>=0?u-1:f.length-1;var t=m-1>=0?m-1:p.length-1,I=[];I.push(p[m]);I.push(f[u]);I.push(f[d]);v=this.Triangulate.area(I);var C=[];C.push(p[m]);C.push(p[t]);C.push(f[u]);z=this.Triangulate.area(C);x=u;y=m;u+=1;m+=-1;u<0&&(u+=f.length);u%=f.length;m<0&&(m+=p.length);m%=f.length;d=u-1>=0?u-1:f.length-1;t=m-1>=0?m-1:p.length-
1;I=[];I.push(p[m]);I.push(f[u]);I.push(f[d]);I=this.Triangulate.area(I);C=[];C.push(p[m]);C.push(p[t]);C.push(f[u]);C=this.Triangulate.area(C);v+z>I+C&&(u=x,m=y,u<0&&(u+=f.length),u%=f.length,m<0&&(m+=p.length),m%=f.length,d=u-1>=0?u-1:f.length-1,t=m-1>=0?m-1:p.length-1);v=f.slice(0,u);z=f.slice(u);x=p.slice(m);y=p.slice(0,m);g.push(p[m]);g.push(f[u]);g.push(f[d]);g.push(p[m]);g.push(p[t]);g.push(f[u]);f=v.concat(x).concat(y).concat(z)}o.shape=f}b=[];m=[];for(k=n=0;k<j.length;k++){o=j[k];f=o.shape;
b=b.concat(f);o=THREE.FontUtils.Triangulate(f,true);for(u=0;u<o.length;u++)e=o[u],e[0]+=n,e[1]+=n,e[2]+=n;m=m.concat(o);n+=f.length}var G;for(u=0;u<g.length/3;u++){e=[];for(j=0;j<3;j++){k=false;for(f=0;f<b.length&&!k;f++)G=u*3+j,b[f].equals(g[G])&&(e.push(f),k=true);k||(b.push(g[G]),e.push(b.length-1),console.log("not found"))}m.push(e)}return{points:b,faces:m}},drawText:function(b){var c=[],d=[],e,f=this.getFace(),g=this.size/f.resolution,j=0;e=String(b).split("");for(var k=e.length,b=0;b<k;b++){var o=
this.extractGlyphPoints(e[b],f,g,j);j+=o.offset;c.push(o.points);d=d.concat(o.points)}b=j/2;for(e=0;e<d.length;e++)d[e].x-=b;c=this.extractPoints(d,c);c.contour=d;f=[];g=[];e=[];for(var j=[],k=new THREE.Vector2,p,b=d.length;--b>=0;){if(p){if(p.equals(d[b])){p=null;o=this.Triangulate.area(e)>0;j.push(o);g.push(k.divideScalar(e.length));e=[];k=new THREE.Vector2;continue}}else p=d[b];k.addSelf(d[b]);e.push(d[b])}b=d.length;e=0;for(var n;--b>=0;)o=d[b],k=g[e],o=o.clone().subSelf(k),n=this.bezelSize/o.length(),
j[e]?n+=1:n=1-n,n=o.multiplyScalar(n).addSelf(k),f.unshift(n),p?p.equals(d[b])&&(p=null,e++):p=d[b];c.bezel=f;return c},b2p0:function(b,c){var d=1-b;return d*d*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,d,e){return this.b2p0(b,c)+this.b2p1(b,d)+this.b2p2(b,e)},b3p0:function(b,c){var d=1-b;return d*d*d*c},b3p1:function(b,c){var d=1-b;return 3*d*d*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,d,e,f){return this.b3p0(b,
c)+this.b3p1(b,d)+this.b3p2(b,e)+this.b3p3(b,f)},extractGlyphPoints:function(b,c,d,e){var f=[],g,j,k,o,p,n,t,m,u,v,x=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(x){if(x.o){c=x._cachedOutline||(x._cachedOutline=x.o.split(" "));k=c.length;for(b=0;b<k;)switch(j=c[b++],j){case "m":j=c[b++]*d+e;o=c[b++]*d;f.push(new THREE.Vector2(j,o));break;case "l":j=c[b++]*d+e;o=c[b++]*d;f.push(new THREE.Vector2(j,o));break;case "q":j=c[b++]*d+e;o=c[b++]*d;t=c[b++]*d+e;m=c[b++]*d;if(g=f[f.length-1]){p=
g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++){var z=g/divisions,y=THREE.FontUtils.b2(z,p,t,j),z=THREE.FontUtils.b2(z,n,m,o);f.push(new THREE.Vector2(y,z))}}break;case "b":if(j=c[b++]*d+e,o=c[b++]*d,t=c[b++]*d+e,m=c[b++]*-d,u=c[b++]*d+e,v=c[b++]*-d,g=f[f.length-1]){p=g.x;n=g.y;g=1;for(divisions=this.divisions;g<=divisions;g++)z=g/divisions,y=THREE.FontUtils.b3(z,p,t,u,j),z=THREE.FontUtils.b3(z,n,m,v,o),f.push(new THREE.Vector2(y,z))}}}return{offset:x.ha*d,points:f}}}};
(function(b){var c=function(b){for(var c=b.length,f=0,g=c-1,j=0;j<c;g=j++)f+=b[g].x*b[j].y-b[j].x*b[g].y;return f*0.5};b.Triangulate=function(b,e){var f=b.length;if(f<3)return null;var g=[],j=[],k=[],o,p,n;if(c(b)>0)for(p=0;p<f;p++)j[p]=p;else for(p=0;p<f;p++)j[p]=f-1-p;var t=2*f;for(p=f-1;f>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");break}o=p;f<=o&&(o=0);p=o+1;f<=p&&(p=0);n=p+1;f<=n&&(n=0);var m;a:{m=b;var u=o,v=p,x=n,z=f,y=j,I=void 0,C=void 0,G=void 0,A=void 0,L=void 0,
K=void 0,E=void 0,D=void 0,F=void 0,C=m[y[u]].x,G=m[y[u]].y,A=m[y[v]].x,L=m[y[v]].y,K=m[y[x]].x,E=m[y[x]].y;if(1.0E-10>(A-C)*(E-G)-(L-G)*(K-C))m=false;else{for(I=0;I<z;I++)if(!(I==u||I==v||I==x)){var D=m[y[I]].x,F=m[y[I]].y,Z=void 0,P=void 0,W=void 0,R=void 0,ca=void 0,M=void 0,V=void 0,U=void 0,O=void 0,H=void 0,da=void 0,Q=void 0,Z=K-A,P=E-L,W=C-K,R=G-E,ca=A-C,M=L-G,V=D-C,U=F-G,O=D-A,H=F-L,da=D-K,Q=F-E,Z=Z*H-P*O,ca=ca*U-M*V,W=W*Q-R*da;if(Z>=0&&W>=0&&ca>=0){m=false;break a}}m=true}}if(m){t=j[o];
m=j[p];u=j[n];g.push(b[t]);g.push(b[m]);g.push(b[u]);k.push([j[o],j[p],j[n]]);o=p;for(n=p+1;n<f;o++,n++)j[o]=j[n];f--;t=2*f}}return e?k:g};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
THREE.TorusGeometry=function(b,c,d,e){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;b=[];for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){var e=d/this.segmentsT*2*Math.PI,f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));b.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
1;d<=this.segmentsT;++d){var e=(this.segmentsT+1)*c+d,f=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,j=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,f,g,j));this.faceVertexUvs[0].push([new THREE.UV(b[e][0],b[e][1]),new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1])])}delete b;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
THREE.TorusKnotGeometry=function(b,c,d,e,f,g,j){function k(b,c,d,e,f,g){c=d/e*b;d=Math.cos(c);return new THREE.Vector3(f*(2+d)*0.5*Math.cos(b),f*(2+d)*Math.sin(b)*0.5,g*f*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=d||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=j||1;this.grid=Array(this.segmentsR);d=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
this.segmentsT;++c){var o=b/this.segmentsR*2*this.p*Math.PI,j=c/this.segmentsT*2*Math.PI,f=k(o,j,this.q,this.p,this.radius,this.heightScale),o=k(o+0.01,j,this.q,this.p,this.radius,this.heightScale);d.x=o.x-f.x;d.y=o.y-f.y;d.z=o.z-f.z;e.x=o.x+f.x;e.y=o.y+f.y;e.z=o.z+f.z;g.cross(d,e);e.cross(g,d);g.normalize();e.normalize();o=-this.tube*Math.cos(j);j=this.tube*Math.sin(j);f.x+=o*e.x+j*g.x;f.y+=o*e.y+j*g.y;f.z+=o*e.z+j*g.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,
f.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var e=(b+1)%this.segmentsR,g=(c+1)%this.segmentsT,f=this.grid[b][c],d=this.grid[e][c],e=this.grid[e][g],g=this.grid[b][g],j=new THREE.UV(b/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(f,d,e,g));this.faceVertexUvs[0].push([j,o,p,n])}this.computeCentroids();
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,d){b.materials=[];for(var e=0;e<c.length;++e)b.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],d)]},createMaterial:function(b,c){function d(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function e(b,c){var e=new Image;e.onload=function(){if(!d(this.width)||!d(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),e=Math.pow(2,Math.round(Math.log(this.height)/
Math.LN2));b.image.width=c;b.image.height=e;b.image.getContext("2d").drawImage(this,0,0,c,e)}else b.image=this;b.needsUpdate=true};e.src=c}var f,g,j;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?f="MeshPhongMaterial":b.shading=="Basic"&&(f="MeshBasicMaterial"));if(b.blending)if(b.blending=="Additive")g.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")g.blending=THREE.SubtractiveBlending;else if(b.blending==
"Multiply")g.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)g.transparent=b.transparent;if(b.depthTest!==void 0)g.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")g.vertexColors=THREE.FaceColors;else if(b.vertexColors)g.vertexColors=THREE.VertexColors;if(b.mapDiffuse&&c){j=document.createElement("canvas");g.map=new THREE.Texture(j);g.map.sourceFile=b.mapDiffuse;if(b.mapDiffuseRepeat)g.map.repeat.set(b.mapDiffuseRepeat[0],b.mapDiffuseRepeat[1]),g.map.wrapS=
g.map.wrapT=THREE.RepeatWrapping;b.mapDiffuseOffset&&g.map.offset.set(b.mapDiffuseOffset[0],b.mapDiffuseOffset[1]);e(g.map,c+"/"+b.mapDiffuse)}else if(b.colorDiffuse)j=(b.colorDiffuse[0]*255<<16)+(b.colorDiffuse[1]*255<<8)+b.colorDiffuse[2]*255,g.color=j,g.opacity=b.transparency;else if(b.DbgColor)g.color=b.DbgColor;if(b.mapLight&&c){j=document.createElement("canvas");g.lightMap=new THREE.Texture(j);g.lightMap.sourceFile=b.mapLight;if(b.mapLightmapRepeat)g.lightMap.repeat.set(b.mapLightRepeat[0],
b.mapLightRepeat[1]),g.lightMap.wrapS=g.lightMap.wrapT=THREE.RepeatWrapping;b.mapLightmapOffset&&g.lightMap.offset.set(b.mapLightmapOffset[0],b.mapLightmapOffset[1]);e(g.lightMap,c+"/"+b.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
THREE.JSONLoader.prototype.load=function(b){var c=this,d=b.model,e=b.callback,f=b.texture_path?b.texture_path:this.extractUrlbase(d),b=new Worker(d);b.onmessage=function(b){c.createModel(b.data,e,f);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
THREE.JSONLoader.prototype.createModel=function(b,c,d){var e=new THREE.Geometry,f=b.scale!==void 0?1/b.scale:1;this.init_materials(e,b.materials,d);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var d,f,o,p,n,t,m,u,v,x,z,y,I,C,G=b.faces;t=b.vertices;var A=b.normals,L=b.colors,K=0;for(d=0;d<b.uvs.length;d++)b.uvs[d].length&&K++;for(d=0;d<K;d++)e.faceUvs[d]=[],e.faceVertexUvs[d]=[];p=0;for(n=t.length;p<n;)m=new THREE.Vertex,m.position.x=t[p++]*c,m.position.y=
t[p++]*c,m.position.z=t[p++]*c,e.vertices.push(m);p=0;for(n=G.length;p<n;){c=G[p++];t=c&1;o=c&2;d=c&4;f=c&8;u=c&16;m=c&32;x=c&64;c&=128;t?(z=new THREE.Face4,z.a=G[p++],z.b=G[p++],z.c=G[p++],z.d=G[p++],t=4):(z=new THREE.Face3,z.a=G[p++],z.b=G[p++],z.c=G[p++],t=3);if(o)o=G[p++],z.materials=e.materials[o];o=e.faces.length;if(d)for(d=0;d<K;d++)y=b.uvs[d],v=G[p++],C=y[v*2],v=y[v*2+1],e.faceUvs[d][o]=new THREE.UV(C,v);if(f)for(d=0;d<K;d++){y=b.uvs[d];I=[];for(f=0;f<t;f++)v=G[p++],C=y[v*2],v=y[v*2+1],I[f]=
new THREE.UV(C,v);e.faceVertexUvs[d][o]=I}if(u)u=G[p++]*3,f=new THREE.Vector3,f.x=A[u++],f.y=A[u++],f.z=A[u],z.normal=f;if(m)for(d=0;d<t;d++)u=G[p++]*3,f=new THREE.Vector3,f.x=A[u++],f.y=A[u++],f.z=A[u],z.vertexNormals.push(f);if(x)m=G[p++],m=new THREE.Color(L[m]),z.color=m;if(c)for(d=0;d<t;d++)m=G[p++],m=new THREE.Color(L[m]),z.vertexColors.push(m);e.faces.push(z)}}})(f);(function(){var c,d,f,o;if(b.skinWeights){c=0;for(d=b.skinWeights.length;c<d;c+=2)f=b.skinWeights[c],o=b.skinWeights[c+1],e.skinWeights.push(new THREE.Vector4(f,
o,0,0))}if(b.skinIndices){c=0;for(d=b.skinIndices.length;c<d;c+=2)f=b.skinIndices[c],o=b.skinIndices[c+1],e.skinIndices.push(new THREE.Vector4(f,o,0,0))}e.bones=b.bones;e.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var d,f,o,p,n,t,m,u,v;d=0;for(f=b.morphTargets.length;d<f;d++){e.morphTargets[d]={};e.morphTargets[d].name=b.morphTargets[d].name;e.morphTargets[d].vertices=[];u=e.morphTargets[d].vertices;v=b.morphTargets[d].vertices;o=0;for(p=v.length;o<p;o+=3)n=v[o]*c,t=v[o+1]*
c,m=v[o+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(n,t,m)))}}if(b.morphColors!==void 0){d=0;for(f=b.morphColors.length;d<f;d++){e.morphColors[d]={};e.morphColors[d].name=b.morphColors[d].name;e.morphColors[d].colors=[];p=e.morphColors[d].colors;n=b.morphColors[d].colors;c=0;for(o=n.length;c<o;c+=3)t=new THREE.Color(16755200),t.setRGB(n[c],n[c+1],n[c+2]),p.push(t)}}})(f);(function(){if(b.edges!==void 0){var c,d,f;for(c=0;c<b.edges.length;c+=2)d=b.edges[c],f=b.edges[c+1],e.edges.push(new THREE.Edge(e.vertices[d],
e.vertices[f],d,f))}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
THREE.BinaryLoader.prototype={load:function(b){var c=b.model,d=b.callback,e=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,d,f,e,g)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
c.postMessage(b)},loadAjaxBuffers:function(b,c,d,e,f,g){var j=new XMLHttpRequest,k=e+"/"+b,o=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,d,f,c):alert("Couldn't load ["+k+"] ["+j.status+"]"):j.readyState==3?g&&(o==0&&(o=j.getResponseHeader("Content-Length")),g({total:o,loaded:j.responseText.length})):j.readyState==2&&(o=j.getResponseHeader("Content-Length"))};j.open("GET",k,true);j.overrideMimeType("text/plain; charset=x-user-defined");
j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(b,c,d,e){var f=function(c){var d,f,o,p,n,t,m,u,v,x,z,y,I,C,G,A,L,K;function E(b,c){var d=P(b,c),e=P(b,c+1),f=P(b,c+2),g=P(b,c+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;return d==0&&h==-127?0:(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function D(b,c){var d=P(b,c),e=P(b,c+1),f=P(b,c+2);return(P(b,c+3)<<24)+(f<<16)+(e<<8)+d}function F(b,c){var d=P(b,c);return(P(b,c+1)<<8)+d}function Z(b,c){var d=P(b,c);return d>
127?d-256:d}function P(b,c){return b.charCodeAt(c)&255}function W(c){var d,e,f;d=D(b,c);e=D(b,c+$);f=D(b,c+ha);c=F(b,c+X);THREE.BinaryLoader.prototype.f3(O,d,e,f,c)}function R(c){var d,e,f,g,h,j;d=D(b,c);e=D(b,c+$);f=D(b,c+ha);g=F(b,c+X);h=D(b,c+N);j=D(b,c+S);c=D(b,c+Y);THREE.BinaryLoader.prototype.f3n(O,da,d,e,f,g,h,j,c)}function ca(c){var d,e,f,g;d=D(b,c);e=D(b,c+T);f=D(b,c+aa);g=D(b,c+h);c=F(b,c+oa);THREE.BinaryLoader.prototype.f4(O,d,e,f,g,c)}function M(c){var d,e,f,g,j,k,m,o;d=D(b,c);e=D(b,c+
T);f=D(b,c+aa);g=D(b,c+h);j=F(b,c+oa);k=D(b,c+ga);m=D(b,c+ja);o=D(b,c+qa);c=D(b,c+za);THREE.BinaryLoader.prototype.f4n(O,da,d,e,f,g,j,k,m,o,c)}function V(c){var d,e;d=D(b,c);e=D(b,c+Aa);c=D(b,c+wa);THREE.BinaryLoader.prototype.uv3(O.faceVertexUvs[0],Q[d*2],Q[d*2+1],Q[e*2],Q[e*2+1],Q[c*2],Q[c*2+1])}function U(c){var d,e,f;d=D(b,c);e=D(b,c+Ba);f=D(b,c+ua);c=D(b,c+va);THREE.BinaryLoader.prototype.uv4(O.faceVertexUvs[0],Q[d*2],Q[d*2+1],Q[e*2],Q[e*2+1],Q[f*2],Q[f*2+1],Q[c*2],Q[c*2+1])}var O=this,H=0,da=
[],Q=[],$,ha,X,N,S,Y,T,aa,h,oa,ga,ja,qa,za,Aa,wa,Ba,ua,va,fa,ea,ta,ka,pa,xa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(O,e,c);b.substr(H,8);c=P(b,H+8);d=P(b,H+9);f=P(b,H+10);o=P(b,H+11);p=P(b,H+12);n=P(b,H+13);t=P(b,H+14);m=P(b,H+15);u=D(b,H+16);v=D(b,H+16+4);x=D(b,H+16+8);z=D(b,H+16+12);y=D(b,H+16+16);I=D(b,H+16+20);C=D(b,H+16+24);G=D(b,H+16+28);A=D(b,H+16+32);L=D(b,H+16+36);K=D(b,H+16+40);H+=c;$=p;ha=p*2;X=p*3;N=p*3+m;S=p*3+m+n;Y=p*3+m+n*2;T=p;aa=p*2;h=p*3;oa=p*4;ga=p*4+m;ja=
p*4+m+n;qa=p*4+m+n*2;za=p*4+m+n*3;Aa=t;wa=t*2;Ba=t;ua=t*2;va=t*3;c=p*3+m;xa=p*4+m;fa=z*c;ea=y*(c+n*3);ta=I*(c+t*3);ka=C*(c+n*3+t*3);pa=G*xa;c=A*(xa+n*4);xa=L*(xa+t*4);H+=function(c){for(var e,f,g,h=d*3,k=c+u*h;c<k;c+=h)e=E(b,c),f=E(b,c+d),g=E(b,c+d*2),THREE.BinaryLoader.prototype.v(O,e,f,g);return u*h}(H);H+=function(c){for(var d,e,g,h=f*3,j=c+v*h;c<j;c+=h)d=Z(b,c),e=Z(b,c+f),g=Z(b,c+f*2),da.push(d/127,e/127,g/127);return v*h}(H);H+=function(c){for(var d,e,f=o*2,g=c+x*f;c<g;c+=f)d=E(b,c),e=E(b,c+
o),Q.push(d,e);return x*f}(H);fa=H+fa;ea=fa+ea;ta=ea+ta;ka=ta+ka;pa=ka+pa;c=pa+c;xa=c+xa;(function(b){var c,d=p*3+m,e=d+t*3,f=b+I*e;for(c=b;c<f;c+=e)W(c),V(c+d);return f-b})(ea);(function(b){var c,d=p*3+m+n*3,e=d+t*3,f=b+C*e;for(c=b;c<f;c+=e)R(c),V(c+d);return f-b})(ta);(function(b){var c,d=p*4+m,e=d+t*4,f=b+L*e;for(c=b;c<f;c+=e)ca(c),U(c+d);return f-b})(c);(function(b){var c,d=p*4+m+n*4,e=d+t*4,f=b+K*e;for(c=b;c<f;c+=e)M(c),U(c+d);return f-b})(xa);(function(b){var c,d=p*3+m,e=b+z*d;for(c=b;c<e;c+=
d)W(c);return e-b})(H);(function(b){var c,d=p*3+m+n*3,e=b+y*d;for(c=b;c<e;c+=d)R(c);return e-b})(fa);(function(b){var c,d=p*4+m,e=b+G*d;for(c=b;c<e;c+=d)ca(c);return e-b})(ka);(function(b){var c,d=p*4+m+n*4,e=b+A*d;for(c=b;c<e;c+=d)M(c);return e-b})(pa);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(d))},v:function(b,c,d,e){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(b,c,d,e,f){b.faces.push(new THREE.Face3(c,
d,e,null,null,b.materials[f]))},f4:function(b,c,d,e,f,g){b.faces.push(new THREE.Face4(c,d,e,f,null,null,b.materials[g]))},f3n:function(b,c,d,e,f,g,j,k,o){var g=b.materials[g],p=c[k*3],n=c[k*3+1],k=c[k*3+2],t=c[o*3],m=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face3(d,e,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(p,n,k),new THREE.Vector3(t,m,o)],null,g))},f4n:function(b,c,d,e,f,g,j,k,o,p,n){var j=b.materials[j],t=c[o*3],m=c[o*3+1],o=c[o*3+2],u=c[p*3],v=c[p*3+1],p=c[p*3+2],x=c[n*
3],z=c[n*3+1],n=c[n*3+2];b.faces.push(new THREE.Face4(d,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(t,m,o),new THREE.Vector3(u,v,p),new THREE.Vector3(x,z,n)],null,j))},uv3:function(b,c,d,e,f,g,j){var k=[];k.push(new THREE.UV(c,d));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,j));b.push(k)},uv4:function(b,c,d,e,f,g,j,k,o){var p=[];p.push(new THREE.UV(c,d));p.push(new THREE.UV(e,f));p.push(new THREE.UV(g,j));p.push(new THREE.UV(k,o));b.push(p)}};
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
THREE.SceneLoader.prototype={load:function(b,c){var d=this,e=new Worker(b);e.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(b);e.onmessage=function(b){function e(b,c){return c=="relativeToHTML"?b:f+"/"+b}function k(){for(u in F.objects)if(!M.objects[u])if(I=F.objects[u],I.geometry!==void 0){if(L=M.geometries[I.geometry]){D=[];for(O=0;O<I.materials.length;O++)D[O]=M.materials[I.materials[O]];C=I.position;r=I.rotation;q=I.quaternion;s=I.scale;q=0;D.length==0&&(D[0]=new THREE.MeshFaceMaterial);
D.length>1&&(D=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(L,D);object.name=u;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=true):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=I.visible;M.scene.addObject(object);M.objects[u]=object;if(I.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(object);M.scene.collisions.colliders.push(b)}if(I.castsShadow)b=new THREE.ShadowVolume(L),M.scene.addChild(b),
b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},M.triggers[object.name]=b)}}else C=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=true):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=I.visible!==void 0?I.visible:false,
M.scene.addObject(object),M.objects[u]=object,M.empties[u]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},M.triggers[object.name]=b)}function o(b){return function(c){M.geometries[b]=c;k();P-=1;d.onLoadComplete();n()}}function p(b){return function(c){M.geometries[b]=c}}function n(){d.callbackProgress({totalModels:R,totalTextures:ca,loadedModels:R-P,loadedTextures:ca-W},M);d.onLoadProgress();P==0&&W==0&&c(M)}var t,m,u,v,x,z,y,I,C,G,A,L,K,E,D,F,Z,P,W,R,ca,M;F=b.data;
b=new THREE.BinaryLoader;Z=new THREE.JSONLoader;W=P=0;M={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};var V=false;for(u in F.objects)if(I=F.objects[u],I.meshCollider){V=true;break}if(V)M.scene.collisions=new THREE.CollisionSystem;if(F.transform){V=F.transform.position;G=F.transform.rotation;var U=F.transform.scale;V&&M.scene.position.set(V[0],V[1],V[2]);G&&M.scene.rotation.set(G[0],G[1],G[2]);U&&M.scene.scale.set(U[0],
U[1],U[2]);(V||G||U)&&M.scene.updateMatrix()}V=function(){W-=1;n();d.onLoadComplete()};for(x in F.cameras){G=F.cameras[x];if(G.type=="perspective")K=new THREE.Camera(G.fov,G.aspect,G.near,G.far);else if(G.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);C=G.position;G=G.target;K.position.set(C[0],C[1],C[2]);K.target.position.set(G[0],G[1],G[2]);M.cameras[x]=K}for(v in F.lights){x=F.lights[v];K=x.color!==void 0?x.color:16777215;
G=x.intensity!==void 0?x.intensity:1;if(x.type=="directional")C=x.direction,light=new THREE.DirectionalLight(K,G),light.position.set(C[0],C[1],C[2]),light.position.normalize();else if(x.type=="point")C=x.position,light=new THREE.PointLight(K,G),light.position.set(C[0],C[1],C[2]);M.scene.addLight(light);M.lights[v]=light}for(z in F.fogs)v=F.fogs[z],v.type=="linear"?E=new THREE.Fog(0,v.near,v.far):v.type=="exp2"&&(E=new THREE.FogExp2(0,v.density)),G=v.color,E.color.setRGB(G[0],G[1],G[2]),M.fogs[z]=
E;if(M.cameras&&F.defaults.camera)M.currentCamera=M.cameras[F.defaults.camera];if(M.fogs&&F.defaults.fog)M.scene.fog=M.fogs[F.defaults.fog];G=F.defaults.bgcolor;M.bgColor=new THREE.Color;M.bgColor.setRGB(G[0],G[1],G[2]);M.bgColorAlpha=F.defaults.bgalpha;for(t in F.geometries)if(z=F.geometries[t],z.type=="bin_mesh"||z.type=="ascii_mesh")P+=1,d.onLoadStart();R=P;for(t in F.geometries)z=F.geometries[t],z.type=="cube"?(L=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,z.segmentsHeight,
z.segmentsDepth,null,z.flipped,z.sides),M.geometries[t]=L):z.type=="plane"?(L=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),M.geometries[t]=L):z.type=="sphere"?(L=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),M.geometries[t]=L):z.type=="cylinder"?(L=new THREE.CylinderGeometry(z.numSegs,z.topRad,z.botRad,z.height,z.topOffset,z.botOffset),M.geometries[t]=L):z.type=="torus"?(L=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),M.geometries[t]=
L):z.type=="icosahedron"?(L=new THREE.IcosahedronGeometry(z.subdivisions),M.geometries[t]=L):z.type=="bin_mesh"?b.load({model:e(z.url,F.urlBaseType),callback:o(t)}):z.type=="ascii_mesh"?Z.load({model:e(z.url,F.urlBaseType),callback:o(t)}):z.type=="embedded_mesh"&&(z=F.embeds[z.id])&&Z.createModel(z,p(t),"");for(y in F.textures)if(t=F.textures[y],t.url instanceof Array){W+=t.url.length;for(b=0;b<t.url.length;b++)d.onLoadStart()}else W+=1,d.onLoadStart();ca=W;for(y in F.textures){t=F.textures[y];if(t.mapping!=
void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){for(var b=[],O=0;O<t.url.length;O++)b[O]=e(t.url[O],F.urlBaseType);b=THREE.ImageUtils.loadTextureCube(b,t.mapping,V)}else{b=THREE.ImageUtils.loadTexture(e(t.url,F.urlBaseType),t.mapping,V);if(THREE[t.minFilter]!=void 0)b.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)b.magFilter=THREE[t.magFilter];if(t.repeat)b.repeat.set(t.repeat[0],t.repeat[1]),b.wrapS=b.wrapT=THREE.RepeatWrapping}M.textures[y]=
b}for(m in F.materials){y=F.materials[m];for(A in y.parameters)if(A=="envMap"||A=="map"||A=="lightMap")y.parameters[A]=M.textures[y.parameters[A]];else if(A=="shading")y.parameters[A]=y.parameters[A]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(A=="blending")y.parameters[A]=THREE[y.parameters[A]]?THREE[y.parameters[A]]:THREE.NormalBlending;else if(A=="combine")y.parameters[A]=y.parameters[A]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(A=="vertexColors")if(y.parameters[A]==
"face")y.parameters[A]=THREE.FaceColors;else if(y.parameters[A])y.parameters[A]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=true;y=new THREE[y.type](y.parameters);M.materials[m]=y}k();d.callbackSync(M)}}};
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=true;this.maxCount=4096;this.count=
0;this.hasNormal=this.hasPos=false;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,f){return b+(c-b)*f};this.VIntX=function(b,c,f,g,j,k,o,p,n,t){j=(j-n)/(t-n);n=this.normal_cache;c[g]=k+j*this.delta;c[g+1]=o;c[g+2]=p;f[g]=this.lerp(n[b],n[b+3],j);f[g+1]=this.lerp(n[b+1],n[b+4],j);f[g+2]=this.lerp(n[b+2],n[b+5],j)};this.VIntY=function(b,c,f,g,j,k,o,p,n,t){j=(j-n)/(t-n);n=this.normal_cache;c[g]=k;c[g+1]=o+j*this.delta;c[g+
2]=p;c=b+this.yd*3;f[g]=this.lerp(n[b],n[c],j);f[g+1]=this.lerp(n[b+1],n[c+1],j);f[g+2]=this.lerp(n[b+2],n[c+2],j)};this.VIntZ=function(b,c,f,g,j,k,o,p,n,t){j=(j-n)/(t-n);n=this.normal_cache;c[g]=k;c[g+1]=o;c[g+2]=p+j*this.delta;c=b+this.zd*3;f[g]=this.lerp(n[b],n[c],j);f[g+1]=this.lerp(n[b+1],n[c+1],j);f[g+2]=this.lerp(n[b+2],n[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,f,g,j,k){var o=g+1,p=g+this.yd,n=g+this.zd,t=o+this.yd,m=o+this.zd,u=g+this.yd+this.zd,v=o+this.yd+this.zd,x=0,z=this.field[g],y=this.field[o],I=this.field[p],C=this.field[t],G=this.field[n],A=this.field[m],L=this.field[u],K=this.field[v];z<j&&(x|=1);y<j&&(x|=2);I<j&&(x|=8);C<j&&(x|=4);G<j&&(x|=16);A<j&&(x|=32);L<j&&(x|=128);K<j&&(x|=64);var E=THREE.edgeTable[x];if(E==0)return 0;var D=this.delta,
F=b+D,Z=c+D,D=f+D;E&1&&(this.compNorm(g),this.compNorm(o),this.VIntX(g*3,this.vlist,this.nlist,0,j,b,c,f,z,y));E&2&&(this.compNorm(o),this.compNorm(t),this.VIntY(o*3,this.vlist,this.nlist,3,j,F,c,f,y,C));E&4&&(this.compNorm(p),this.compNorm(t),this.VIntX(p*3,this.vlist,this.nlist,6,j,b,Z,f,I,C));E&8&&(this.compNorm(g),this.compNorm(p),this.VIntY(g*3,this.vlist,this.nlist,9,j,b,c,f,z,I));E&16&&(this.compNorm(n),this.compNorm(m),this.VIntX(n*3,this.vlist,this.nlist,12,j,b,c,D,G,A));E&32&&(this.compNorm(m),
this.compNorm(v),this.VIntY(m*3,this.vlist,this.nlist,15,j,F,c,D,A,K));E&64&&(this.compNorm(u),this.compNorm(v),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,Z,D,L,K));E&128&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,21,j,b,c,D,G,L));E&256&&(this.compNorm(g),this.compNorm(n),this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,c,f,z,G));E&512&&(this.compNorm(o),this.compNorm(m),this.VIntZ(o*3,this.vlist,this.nlist,27,j,F,c,f,y,A));E&1024&&(this.compNorm(t),this.compNorm(v),this.VIntZ(t*
3,this.vlist,this.nlist,30,j,F,Z,f,C,K));E&2048&&(this.compNorm(p),this.compNorm(u),this.VIntZ(p*3,this.vlist,this.nlist,33,j,b,Z,f,I,L));x<<=4;for(j=g=0;THREE.triTable[x+j]!=-1;)b=x+j,c=b+1,f=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[f],k),j+=3,g++;return g};this.posnormtriv=function(b,c,f,g,j,k){var o=this.count*3;this.positionArray[o]=b[f];this.positionArray[o+1]=b[f+1];this.positionArray[o+2]=b[f+2];this.positionArray[o+3]=b[g];this.positionArray[o+
4]=b[g+1];this.positionArray[o+5]=b[g+2];this.positionArray[o+6]=b[j];this.positionArray[o+7]=b[j+1];this.positionArray[o+8]=b[j+2];this.normalArray[o]=c[f];this.normalArray[o+1]=c[f+1];this.normalArray[o+2]=c[f+2];this.normalArray[o+3]=c[g];this.normalArray[o+4]=c[g+1];this.normalArray[o+5]=c[g+2];this.normalArray[o+6]=c[j];this.normalArray[o+7]=c[j+1];this.normalArray[o+8]=c[j+2];this.hasNormal=this.hasPos=true;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=
0;this.hasNormal=this.hasPos=false};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,f,g,j){var k=this.size*Math.sqrt(g/j),o=f*this.size,p=c*this.size,n=b*this.size,t=Math.floor(o-k);t<1&&(t=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var m=Math.floor(p-k);m<1&&(m=1);p=Math.floor(p+k);p>this.size-1&&(p=this.size-1);var u=Math.floor(n-k);u<1&&(u=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-
1);for(var v,x,z,y,I,C;t<o;t++){n=this.size2*t;x=t/this.size-f;I=x*x;for(x=m;x<p;x++){z=n+this.size*x;v=x/this.size-c;C=v*v;for(v=u;v<k;v++)y=v/this.size-b,y=g/(1.0E-6+y*y+C+I)-j,y>0&&(this.field[z+v]+=y)}}};this.addPlaneX=function(b,c){var f,g,j,k,o,p=this.size,n=this.yd,t=this.zd,m=this.field,u=p*Math.sqrt(b/c);u>p&&(u=p);for(f=0;f<u;f++)if(g=f/p,g*=g,k=b/(1.0E-4+g)-c,k>0)for(g=0;g<p;g++){o=f+g*n;for(j=0;j<p;j++)m[t*j+o]+=k}};this.addPlaneY=function(b,c){var f,g,j,k,o,p,n=this.size,t=this.yd,m=
this.zd,u=this.field,v=n*Math.sqrt(b/c);v>n&&(v=n);for(g=0;g<v;g++)if(f=g/n,f*=f,k=b/(1.0E-4+f)-c,k>0){o=g*t;for(f=0;f<n;f++){p=o+f;for(j=0;j<n;j++)u[m*j+p]+=k}}};this.addPlaneZ=function(b,c){var f,g,j,k,o,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(f=j/size,f*=f,k=b/(1.0E-4+f)-c,k>0){o=zd*j;for(g=0;g<size;g++){p=o+g*yd;for(f=0;f<size;f++)field[p+f]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,f,g,j,k,o,p,n,t,m=this.size-2;for(j=1;j<m;j++){t=this.size2*j;p=(j-this.halfsize)/this.halfsize;for(g=1;g<m;g++){n=t+this.size*g;o=(g-this.halfsize)/this.halfsize;for(f=1;f<m;f++)k=(f-this.halfsize)/this.halfsize,c=n+f,this.polygonize(k,o,p,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,f=[];this.render(function(g){var j,k,o,p,n,t,m,u;for(j=0;j<g.count;j++)m=j*3,n=m+1,u=m+2,k=g.positionArray[m],
o=g.positionArray[n],p=g.positionArray[u],t=new THREE.Vector3(k,o,p),k=g.normalArray[m],o=g.normalArray[n],p=g.normalArray[u],m=new THREE.Vector3(k,o,p),m.normalize(),n=new THREE.Vertex(t),c.vertices.push(n),f.push(m);nfaces=g.count/3;for(j=0;j<nfaces;j++)m=(b+j)*3,n=m+1,u=m+2,t=f[m],k=f[n],o=f[u],m=new THREE.Face3(m,n,u,[t,k,o]),c.faces.push(m);b+=nfaces;g.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
THREE.Trident=function(b){function c(c){return new THREE.Mesh(new THREE.CylinderGeometry(30,0.1,b.length/20,b.length/5),new THREE.MeshBasicMaterial({color:c}))}function d(b,c){var d=new THREE.Geometry;d.vertices=[new THREE.Vertex,new THREE.Vertex(b)];return new THREE.Line(d,new THREE.LineBasicMaterial({color:c}))}THREE.Object3D.call(this);var e=Math.PI/2,f,b=b||THREE.Trident.defaultParams;if(b!==THREE.Trident.defaultParams)for(f in THREE.Trident.defaultParams)b.hasOwnProperty(f)||(b[f]=THREE.Trident.defaultParams[f]);
this.scale=new THREE.Vector3(b.scale,b.scale,b.scale);this.addChild(d(new THREE.Vector3(b.length,0,0),b.xAxisColor));this.addChild(d(new THREE.Vector3(0,b.length,0),b.yAxisColor));this.addChild(d(new THREE.Vector3(0,0,b.length),b.zAxisColor));if(b.showArrows)f=c(b.xAxisColor),f.rotation.y=-e,f.position.x=b.length,this.addChild(f),f=c(b.yAxisColor),f.rotation.x=e,f.position.y=b.length,this.addChild(f),f=c(b.zAxisColor),f.rotation.y=Math.PI,f.position.z=b.length,this.addChild(f)};
THREE.Trident.prototype=new THREE.Object3D;THREE.Trident.prototype.constructor=THREE.Trident;THREE.Trident.defaultParams={xAxisColor:16711680,yAxisColor:65280,zAxisColor:255,showArrows:true,length:100,scale:1};THREE.PlaneCollider=function(b,c){this.point=b;this.normal=c};THREE.SphereCollider=function(b,c){this.center=b;this.radius=c;this.radiusSq=c*c};THREE.BoxCollider=function(b,c){this.min=b;this.max=c;this.dynamic=true;this.normal=new THREE.Vector3};
THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.geometry.faces.length;this.normal=new THREE.Vector3};THREE.CollisionSystem=function(){this.collisionNormal=new THREE.Vector3;this.colliders=[];this.hits=[]};THREE.Collisions=new THREE.CollisionSystem;THREE.CollisionSystem.prototype.merge=function(b){this.colliders=this.colliders.concat(b.colliders);this.hits=this.hits.concat(b.hits)};
THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,d,e,f,g=0;c=0;for(d=this.colliders.length;c<d;c++)if(f=this.colliders[c],e=this.rayCast(b,f),e<Number.MAX_VALUE)f.distance=e,e>g?this.hits.push(f):this.hits.unshift(f),g=e;return this.hits};
THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var d=0;c[d]instanceof THREE.MeshCollider;){var e=this.rayMesh(b,c[d]);if(e.dist<Number.MAX_VALUE){c[d].distance=e.dist;c[d].faceIndex=e.faceIndex;break}d++}return d>c.length?null:c[d]};
THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var d=this.makeRayLocal(b,c.mesh),e=Number.MAX_VALUE,f,g=0;g<c.numFaces;g++){var j=c.mesh.geometry.faces[g],k=c.mesh.geometry.vertices[j.a].position,o=c.mesh.geometry.vertices[j.b].position,p=c.mesh.geometry.vertices[j.c].position,n=j instanceof THREE.Face4?c.mesh.geometry.vertices[j.d].position:null;j instanceof THREE.Face3?(j=this.rayTriangle(d,k,o,p,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize())):
j instanceof THREE.Face4&&(j=this.rayTriangle(d,k,o,n,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()),j=this.rayTriangle(d,o,p,n,e,this.collisionNormal),j<e&&(e=j,f=g,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:f}};
THREE.CollisionSystem.prototype.rayTriangle=function(b,c,d,e,f,g){var j=THREE.CollisionSystem.__v1,k=THREE.CollisionSystem.__v2;g.set(0,0,0);j.sub(d,c);k.sub(e,d);g.cross(j,k);k=g.dot(b.direction);if(!(k<0))return Number.MAX_VALUE;j=g.dot(c)-g.dot(b.origin);if(!(j<=0))return Number.MAX_VALUE;if(!(j>=k*f))return Number.MAX_VALUE;j/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(j);k.addSelf(b.origin);Math.abs(g.x)>Math.abs(g.y)?Math.abs(g.x)>Math.abs(g.z)?(b=k.y-c.y,g=d.y-c.y,
f=e.y-c.y,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y):Math.abs(g.y)>Math.abs(g.z)?(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.z-c.z,d=d.z-c.z,e=e.z-c.z):(b=k.x-c.x,g=d.x-c.x,f=e.x-c.x,k=k.y-c.y,d=d.y-c.y,e=e.y-c.y);c=g*e-d*f;if(c==0)return Number.MAX_VALUE;c=1/c;e=(b*e-k*f)*c;if(!(e>=0))return Number.MAX_VALUE;c*=g*k-d*b;return!(c>=0)?Number.MAX_VALUE:!(1-e-c>=0)?Number.MAX_VALUE:j};
THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var d=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,d);var e=THREE.CollisionSystem.__r;e.origin.copy(b.origin);e.direction.copy(b.direction);d.multiplyVector3(e.origin);d.rotateAxis(e.direction);e.direction.normalize();return e};
THREE.CollisionSystem.prototype.rayBox=function(b,c){var d;c.dynamic&&c.mesh&&c.mesh.matrixWorld?d=this.makeRayLocal(b,c.mesh):(d=THREE.CollisionSystem.__r,d.origin.copy(b.origin),d.direction.copy(b.direction));var e=0,f=0,g=0,j=0,k=0,o=0,p=true;d.origin.x<c.min.x?(e=c.min.x-d.origin.x,e/=d.direction.x,p=false,j=-1):d.origin.x>c.max.x&&(e=c.max.x-d.origin.x,e/=d.direction.x,p=false,j=1);d.origin.y<c.min.y?(f=c.min.y-d.origin.y,f/=d.direction.y,p=false,k=-1):d.origin.y>c.max.y&&(f=c.max.y-d.origin.y,
f/=d.direction.y,p=false,k=1);d.origin.z<c.min.z?(g=c.min.z-d.origin.z,g/=d.direction.z,p=false,o=-1):d.origin.z>c.max.z&&(g=c.max.z-d.origin.z,g/=d.direction.z,p=false,o=1);if(p)return-1;p=0;f>e&&(p=1,e=f);g>e&&(p=2,e=g);switch(p){case 0:k=d.origin.y+d.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;d=d.origin.z+d.direction.z*e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(j,0,0);break;case 1:j=d.origin.x+d.direction.x*e;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;
d=d.origin.z+d.direction.z*e;if(d<c.min.z||d>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:j=d.origin.x+d.direction.x*e;if(j<c.min.x||j>c.max.x)return Number.MAX_VALUE;k=d.origin.y+d.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,o)}return e};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var d=b.direction.dot(c.normal),e=c.point.dot(c.normal);if(d<0)d=(e-b.origin.dot(c.normal))/d;else return Number.MAX_VALUE;return d>0?d:Number.MAX_VALUE};
THREE.CollisionSystem.prototype.raySphere=function(b,c){var d=c.center.clone().subSelf(b.origin);if(d.lengthSq<c.radiusSq)return-1;var e=d.dot(b.direction.clone());if(e<=0)return Number.MAX_VALUE;d=c.radiusSq-(d.lengthSq()-e*e);return d>=0?Math.abs(e)-Math.sqrt(d):Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,d=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),d=new THREE.BoxCollider(d,c);d.mesh=b;return d};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=false;return c};
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,d=this.setSize,e=this.render,f=new THREE.Camera,g=new THREE.Camera,j=new THREE.Matrix4,k=new THREE.Matrix4,o,p,n;f.useTarget=g.useTarget=false;f.matrixAutoUpdate=g.matrixAutoUpdate=false;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),m=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:m}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
var v=new THREE.Scene;v.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,e){d.call(c,b,e);t.width=b;t.height=e;m.width=b;m.height=e};this.render=function(b,d){d.update(null,true);if(o!==d.aspect||p!==d.near||n!==d.fov){o=d.aspect;p=d.near;n=d.fov;var y=d.projectionMatrix.clone(),I=125/30*0.5,C=I*p/125,G=p*Math.tan(n*Math.PI/360),A;j.n14=I;k.n14=-I;I=-G*o+C;A=G*o+C;y.n11=2*p/(A-I);y.n13=(A+I)/(A-I);f.projectionMatrix=y.clone();I=-G*o-C;A=G*o-C;y.n11=2*p/(A-
I);y.n13=(A+I)/(A-I);g.projectionMatrix=y.clone()}f.matrix=d.matrixWorld.clone().multiplySelf(k);f.update(null,true);f.position.copy(d.position);f.near=p;f.far=d.far;e.call(c,b,f,t,true);g.matrix=d.matrixWorld.clone().multiplySelf(j);g.update(null,true);g.position.copy(d.position);g.near=p;g.far=d.far;e.call(c,b,g,m,true);e.call(c,v,u)}};
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=false;var c=this,d=this.setSize,e=this.render,f,g,j=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,e){d.call(c,b,e);f=b/2;g=e};this.render=function(b,d){this.clear();j.fov=d.fov;j.aspect=0.5*d.aspect;j.near=d.near;j.far=d.far;
j.updateProjectionMatrix();j.position.copy(d.position);j.target.position.copy(d.target.position);j.translateX(c.separation);k.projectionMatrix=j.projectionMatrix;k.position.copy(d.position);k.target.position.copy(d.target.position);k.translateX(-c.separation);this.setViewport(0,0,f,g);e.call(c,b,j);this.setViewport(f,0,f,g);e.call(c,b,k,false)}};

