浏览代码

Added custom attributes for lines.

alteredq 13 年之前
父节点
当前提交
046f4bfeb6

+ 399 - 398
build/Three.js

@@ -1,6 +1,6 @@
 // Three.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Clock=function(a){this.autoStart=a!==void 0?a:!0;this.elapsedTime=this.oldTime=this.startTime=0;this.running=!1};THREE.Clock.prototype.start=function(){this.oldTime=this.startTime=Date.now();this.running=!0};THREE.Clock.prototype.stop=function(){this.getElapsedTime();this.running=!1};THREE.Clock.prototype.getElapsedTime=function(){this.elapsedTime+=this.getDelta();return this.elapsedTime};
-THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.001*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
+THREE.Clock.prototype.getDelta=function(){var a=0;this.autoStart&&!this.running&&this.start();if(this.running){var c=Date.now(),a=0.0010*(c-this.oldTime);this.oldTime=c;this.elapsedTime+=a}return a};THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
 THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;return this},setHSV:function(a,c,b){var e,l,f;if(b===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),l=a*6-e,a=b*(1-c),f=b*(1-
 c*l),c=b*(1-c*(1-l)),e){case 1:this.r=f;this.g=b;this.b=a;break;case 2:this.r=a;this.g=b;this.b=c;break;case 3:this.r=a;this.g=f;this.b=b;break;case 4:this.r=c;this.g=a;this.b=b;break;case 5:this.r=b;this.g=a;this.b=f;break;case 6:case 0:this.r=b,this.g=c,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
@@ -16,64 +16,64 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,e){this.x=
 c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,e=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(e,this.intersectObject(a[c]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function c(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function b(a,b,c,w){e.copy(w).subSelf(b);
-l.copy(c).subSelf(b);f.copy(a).subSelf(b);h=e.dot(e);k=e.dot(l);n=e.dot(f);t=l.dot(l);p=l.dot(f);v=1/(h*t-k*k);x=(t*n-k*p)*v;u=(h*p-k*n)*v;return x>=0&&u>=0&&x+u<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,t,p,v,x,u,y,w=[],A=0,B=a.children.length;A<B;A++)Array.prototype.push.apply(w,this.intersectObject(a.children[A]));if(a instanceof THREE.Particle){A=c(this.origin,this.direction,a.matrixWorld.getPosition());if(A===null||A>a.scale.x)return[];y={distance:A,point:a.position,
-face:null,object:a};w.push(y)}else if(a instanceof THREE.Mesh){A=c(this.origin,this.direction,a.matrixWorld.getPosition());if(A===null||A>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return w;var D,z,C,L,H,I,R,K,N=a.geometry,M=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);A=0;for(B=N.faces.length;A<B;A++)if(y=N.faces[A],R=this.origin.clone(),K=this.direction.clone(),L=a.matrixWorld,D=L.multiplyVector3(y.centroid.clone()).subSelf(R),I=D.dot(K),
-!(I<=0)&&(D=L.multiplyVector3(M[y.a].position.clone()),z=L.multiplyVector3(M[y.b].position.clone()),C=L.multiplyVector3(M[y.c].position.clone()),L=y instanceof THREE.Face4?L.multiplyVector3(M[y.d].position.clone()):null,H=a.matrixRotationWorld.multiplyVector3(y.normal.clone()),I=K.dot(H),a.doubleSided||(a.flipSided?I>0:I<0)))if(I=H.dot((new THREE.Vector3).sub(D,R))/I,R=R.addSelf(K.multiplyScalar(I)),y instanceof THREE.Face3)b(R,D,z,C)&&(y={distance:this.origin.distanceTo(R),point:R,face:y,object:a},
-w.push(y));else if(y instanceof THREE.Face4&&(b(R,D,z,L)||b(R,z,C,L)))y={distance:this.origin.distanceTo(R),point:R,face:y,object:a},w.push(y)}return w}};
-THREE.Rectangle=function(){function a(){f=e-c;h=l-b}var c,b,e,l,f,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(h,f,p,v){k=!1;c=h;b=f;e=p;l=v;a()};this.addPoint=function(h,f){k?(k=!1,c=h,b=f,e=h,l=f):(c=c<h?c:h,b=b<f?b:f,e=e>h?e:h,l=l>f?l:f);a()};this.add3Points=
-function(h,f,p,v,x,u){k?(k=!1,c=h<p?h<x?h:x:p<x?p:x,b=f<v?f<u?f:u:v<u?v:u,e=h>p?h>x?h:x:p>x?p:x,l=f>v?f>u?f:u:v>u?v:u):(c=h<p?h<x?h<c?h:c:x<c?x:c:p<x?p<c?p:c:x<c?x:c,b=f<v?f<u?f<b?f:b:u<b?u:b:v<u?v<b?v:b:u<b?u:b,e=h>p?h>x?h>e?h:e:x>e?x:e:p>x?p>e?p:e:x>e?x:e,l=f>v?f>u?f>l?f:l:u>l?u:l:v>u?v>l?v:l:u>l?u:l);a()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),b=h.getTop(),e=h.getRight(),l=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),b=b<h.getTop()?b:h.getTop(),e=e>h.getRight()?e:h.getRight(),l=l>
-h.getBottom()?l:h.getBottom());a()};this.inflate=function(h){c-=h;b-=h;e+=h;l+=h;a()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();b=b>h.getTop()?b:h.getTop();e=e<h.getRight()?e:h.getRight();l=l<h.getBottom()?l:h.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}};
+l.copy(c).subSelf(b);f.copy(a).subSelf(b);h=e.dot(e);k=e.dot(l);n=e.dot(f);p=l.dot(l);t=l.dot(f);u=1/(h*p-k*k);y=(p*n-k*t)*u;v=(h*t-k*n)*u;return y>=0&&v>=0&&y+v<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,p,t,u,y,v,x,w=[],z=0,B=a.children.length;z<B;z++)Array.prototype.push.apply(w,this.intersectObject(a.children[z]));if(a instanceof THREE.Particle){z=c(this.origin,this.direction,a.matrixWorld.getPosition());if(z===null||z>a.scale.x)return[];x={distance:z,point:a.position,
+face:null,object:a};w.push(x)}else if(a instanceof THREE.Mesh){z=c(this.origin,this.direction,a.matrixWorld.getPosition());if(z===null||z>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return w;var C,A,D,K,P,F,Q,H,N=a.geometry,L=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);z=0;for(B=N.faces.length;z<B;z++)if(x=N.faces[z],Q=this.origin.clone(),H=this.direction.clone(),K=a.matrixWorld,C=K.multiplyVector3(x.centroid.clone()).subSelf(Q),F=C.dot(H),
+!(F<=0)&&(C=K.multiplyVector3(L[x.a].position.clone()),A=K.multiplyVector3(L[x.b].position.clone()),D=K.multiplyVector3(L[x.c].position.clone()),K=x instanceof THREE.Face4?K.multiplyVector3(L[x.d].position.clone()):null,P=a.matrixRotationWorld.multiplyVector3(x.normal.clone()),F=H.dot(P),a.doubleSided||(a.flipSided?F>0:F<0)))if(F=P.dot((new THREE.Vector3).sub(C,Q))/F,Q=Q.addSelf(H.multiplyScalar(F)),x instanceof THREE.Face3)b(Q,C,A,D)&&(x={distance:this.origin.distanceTo(Q),point:Q,face:x,object:a},
+w.push(x));else if(x instanceof THREE.Face4&&(b(Q,C,A,K)||b(Q,A,D,K)))x={distance:this.origin.distanceTo(Q),point:Q,face:x,object:a},w.push(x)}return w}};
+THREE.Rectangle=function(){function a(){f=e-c;h=l-b}var c,b,e,l,f,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(f,h,t,u){k=!1;c=f;b=h;e=t;l=u;a()};this.addPoint=function(f,h){k?(k=!1,c=f,b=h,e=f,l=h):(c=c<f?c:f,b=b<h?b:h,e=e>f?e:f,l=l>h?l:h);a()};this.add3Points=
+function(f,h,t,u,y,v){k?(k=!1,c=f<t?f<y?f:y:t<y?t:y,b=h<u?h<v?h:v:u<v?u:v,e=f>t?f>y?f:y:t>y?t:y,l=h>u?h>v?h:v:u>v?u:v):(c=f<t?f<y?f<c?f:c:y<c?y:c:t<y?t<c?t:c:y<c?y:c,b=h<u?h<v?h<b?h:b:v<b?v:b:u<v?u<b?u:b:v<b?v:b,e=f>t?f>y?f>e?f:e:y>e?y:e:t>y?t>e?t:e:y>e?y:e,l=h>u?h>v?h>l?h:l:v>l?v:l:u>v?u>l?u:l:v>l?v:l);a()};this.addRectangle=function(f){k?(k=!1,c=f.getLeft(),b=f.getTop(),e=f.getRight(),l=f.getBottom()):(c=c<f.getLeft()?c:f.getLeft(),b=b<f.getTop()?b:f.getTop(),e=e>f.getRight()?e:f.getRight(),l=l>
+f.getBottom()?l:f.getBottom());a()};this.inflate=function(f){c-=f;b-=f;e+=f;l+=f;a()};this.minSelf=function(f){c=c>f.getLeft()?c:f.getLeft();b=b>f.getTop()?b:f.getTop();e=e<f.getRight()?e:f.getRight();l=l<f.getBottom()?l:f.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(l,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){k=!0;l=e=b=c=0;a()};this.isEmpty=function(){return k}};
 THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,e,l){return e+(a-c)*(l-e)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,e,l,f,h,k,n,t,p,v,x,u,y,w){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,f!==void 0?f:1,h||0,k||0,n||0,t||0,p!==void 0?p:1,v||0,x||0,u||0,y||0,w!==void 0?w:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,l,f,h,k,n,t,p,v,x,u,y,w){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=l;this.n22=f;this.n23=h;this.n24=k;this.n31=n;this.n32=t;this.n33=p;this.n34=v;this.n41=x;this.n42=u;this.n43=y;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,c).normalize();if(f.length()===0)f.z=1;e.cross(b,f).normalize();e.length()===0&&(f.x+=1.0E-4,e.cross(b,f).normalize());l.cross(f,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=f.x;this.n21=e.y;this.n22=l.y;this.n23=f.y;this.n31=e.z;this.n32=l.z;this.n33=f.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,f=a.n14,h=a.n21,k=a.n22,n=a.n23,t=a.n24,p=a.n31,v=a.n32,x=a.n33,u=a.n34,y=a.n41,w=a.n42,A=a.n43,
-B=a.n44,D=c.n11,z=c.n12,C=c.n13,L=c.n14,H=c.n21,I=c.n22,R=c.n23,K=c.n24,N=c.n31,M=c.n32,G=c.n33,Z=c.n34,$=c.n41,U=c.n42,o=c.n43,da=c.n44;this.n11=b*D+e*H+l*N+f*$;this.n12=b*z+e*I+l*M+f*U;this.n13=b*C+e*R+l*G+f*o;this.n14=b*L+e*K+l*Z+f*da;this.n21=h*D+k*H+n*N+t*$;this.n22=h*z+k*I+n*M+t*U;this.n23=h*C+k*R+n*G+t*o;this.n24=h*L+k*K+n*Z+t*da;this.n31=p*D+v*H+x*N+u*$;this.n32=p*z+v*I+x*M+u*U;this.n33=p*C+v*R+x*G+u*o;this.n34=p*L+v*K+x*Z+u*da;this.n41=y*D+w*H+A*N+B*$;this.n42=y*z+w*I+A*M+B*U;this.n43=y*
-C+w*R+A*G+B*o;this.n44=y*L+w*K+A*Z+B*da;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;
-this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,l=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*l;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*l;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*l;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,l=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*l;a.y=this.n21*
-c+this.n22*b+this.n23*e+this.n24*l;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*l;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*l;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*
-a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,l=this.n21,f=this.n22,h=this.n23,k=this.n24,n=this.n31,t=this.n32,p=this.n33,v=this.n34,x=this.n41,u=this.n42,y=this.n43,w=this.n44;return e*h*t*x-b*k*t*x-e*f*p*x+c*k*p*x+b*f*v*x-c*h*v*x-e*h*n*u+b*k*n*u+e*l*p*u-a*k*p*u-b*l*v*u+a*h*v*u+e*f*n*y-c*k*n*y-e*l*t*y+a*k*t*y+c*l*v*y-a*f*v*y-b*f*n*w+c*h*n*w+b*l*t*w-a*h*t*w-c*l*p*w+a*f*p*
-w},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;
-a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;
-a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;
-a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,
-0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),l=1-b,f=a.x,h=a.y,k=a.z,n=l*f,t=l*h;this.set(n*f+b,n*h-e*k,n*k+e*h,0,n*h+e*k,t*h+b,t*k-e*f,0,n*k-e*h,t*k+e*f,l*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,l=a.n14,f=a.n21,h=a.n22,k=a.n23,n=a.n24,t=a.n31,p=a.n32,v=a.n33,x=a.n34,u=a.n41,y=a.n42,w=a.n43,A=a.n44;this.n11=k*x*y-n*v*y+n*p*w-h*x*w-k*p*A+h*v*A;this.n12=l*v*y-e*x*y-l*p*w+b*x*w+e*p*A-b*v*A;this.n13=e*n*y-l*k*y+l*h*w-b*n*w-e*h*A+b*k*A;this.n14=l*k*p-e*n*p-l*h*v+b*n*v+e*h*x-b*k*x;this.n21=n*v*u-k*x*u-n*t*w+f*x*w+k*t*A-f*v*A;this.n22=e*x*u-l*v*u+
-l*t*w-c*x*w-e*t*A+c*v*A;this.n23=l*k*u-e*n*u-l*f*w+c*n*w+e*f*A-c*k*A;this.n24=e*n*t-l*k*t+l*f*v-c*n*v-e*f*x+c*k*x;this.n31=h*x*u-n*p*u+n*t*y-f*x*y-h*t*A+f*p*A;this.n32=l*p*u-b*x*u-l*t*y+c*x*y+b*t*A-c*p*A;this.n33=e*n*u-l*h*u+l*f*y-c*n*y-b*f*A+c*h*A;this.n34=l*h*t-b*n*t-l*f*p+c*n*p+b*f*x-c*h*x;this.n41=k*p*u-h*v*u-k*t*y+f*v*y+h*t*w-f*p*w;this.n42=b*v*u-e*p*u+e*t*y-c*v*y-b*t*w+c*p*w;this.n43=e*h*u-b*k*u-e*f*y+c*k*y+b*f*w-c*h*w;this.n44=b*k*t-e*h*t+e*f*p-c*k*p-b*f*v+c*h*v;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,f=Math.cos(b),b=Math.sin(b),h=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=h*k,t=h*l,p=e*k,v=e*l;this.n11=n+v*b;this.n12=p*b-t;this.n13=f*e;this.n21=f*l;this.n22=f*k;this.n23=-b;this.n31=t*b-p;this.n32=v+n*b;this.n33=f*h;break;case "ZXY":n=h*k;t=h*l;p=e*k;v=e*l;this.n11=n-v*b;this.n12=-f*l;this.n13=p+t*b;this.n21=t+p*b;this.n22=f*k;this.n23=v-n*b;this.n31=-f*e;this.n32=b;this.n33=f*h;break;case "ZYX":n=
-f*k;t=f*l;p=b*k;v=b*l;this.n11=h*k;this.n12=p*e-t;this.n13=n*e+v;this.n21=h*l;this.n22=v*e+n;this.n23=t*e-p;this.n31=-e;this.n32=b*h;this.n33=f*h;break;case "YZX":n=f*h;t=f*e;p=b*h;v=b*e;this.n11=h*k;this.n12=v-n*l;this.n13=p*l+t;this.n21=l;this.n22=f*k;this.n23=-b*k;this.n31=-e*k;this.n32=t*l+p;this.n33=n-v*l;break;case "XZY":n=f*h;t=f*e;p=b*h;v=b*e;this.n11=h*k;this.n12=-l;this.n13=e*k;this.n21=n*l+v;this.n22=f*k;this.n23=t*l-p;this.n31=p*l-t;this.n32=b*k;this.n33=v*l+n;break;default:n=f*k,t=f*
-l,p=b*k,v=b*l,this.n11=h*k,this.n12=-h*l,this.n13=e,this.n21=t+p*e,this.n22=n-v*e,this.n23=-b*h,this.n31=v-n*e,this.n32=p+t*e,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,l=a.w,f=c+c,h=b+b,k=e+e,a=c*f,n=c*h;c*=k;var t=b*h;b*=k;e*=k;f*=l;h*=l;l*=k;this.n11=1-(t+e);this.n12=n-l;this.n13=c+h;this.n21=n+l;this.n22=1-(a+e);this.n23=b-f;this.n31=c-h;this.n32=b+f;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
+THREE.Matrix4=function(a,c,b,e,l,f,h,k,n,p,t,u,y,v,x,w){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,f!==void 0?f:1,h||0,k||0,n||0,p||0,t!==void 0?t:1,u||0,y||0,v||0,x||0,w!==void 0?w:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,l,f,h,k,n,p,t,u,y,v,x,w){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=l;this.n22=f;this.n23=h;this.n24=k;this.n31=n;this.n32=p;this.n33=t;this.n34=u;this.n41=y;this.n42=v;this.n43=x;this.n44=w;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,c).normalize();if(f.length()===0)f.z=1;e.cross(b,f).normalize();e.length()===0&&(f.x+=1.0E-4,e.cross(b,f).normalize());l.cross(f,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=f.x;this.n21=e.y;this.n22=l.y;this.n23=f.y;this.n31=e.z;this.n32=l.z;this.n33=f.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,f=a.n14,h=a.n21,k=a.n22,n=a.n23,p=a.n24,t=a.n31,u=a.n32,y=a.n33,v=a.n34,x=a.n41,w=a.n42,z=a.n43,
+B=a.n44,C=c.n11,A=c.n12,D=c.n13,K=c.n14,P=c.n21,F=c.n22,Q=c.n23,H=c.n24,N=c.n31,L=c.n32,G=c.n33,V=c.n34,ca=c.n41,W=c.n42,T=c.n43,o=c.n44;this.n11=b*C+e*P+l*N+f*ca;this.n12=b*A+e*F+l*L+f*W;this.n13=b*D+e*Q+l*G+f*T;this.n14=b*K+e*H+l*V+f*o;this.n21=h*C+k*P+n*N+p*ca;this.n22=h*A+k*F+n*L+p*W;this.n23=h*D+k*Q+n*G+p*T;this.n24=h*K+k*H+n*V+p*o;this.n31=t*C+u*P+y*N+v*ca;this.n32=t*A+u*F+y*L+v*W;this.n33=t*D+u*Q+y*G+v*T;this.n34=t*K+u*H+y*V+v*o;this.n41=x*C+w*P+z*N+B*ca;this.n42=x*A+w*F+z*L+B*W;this.n43=x*
+D+w*Q+z*G+B*T;this.n44=x*K+w*H+z*V+B*o;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);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 this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=
+a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,l=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*l;a.y=(this.n21*c+this.n22*b+this.n23*e+this.n24)*l;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*l;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,l=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*l;a.y=this.n21*c+this.n22*
+b+this.n23*e+this.n24*l;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*l;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*l;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*
+a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,l=this.n21,f=this.n22,h=this.n23,k=this.n24,n=this.n31,p=this.n32,t=this.n33,u=this.n34,y=this.n41,v=this.n42,x=this.n43,w=this.n44;return e*h*p*y-b*k*p*y-e*f*t*y+c*k*t*y+b*f*u*y-c*h*u*y-e*h*n*v+b*k*n*v+e*l*t*v-a*k*t*v-b*l*u*v+a*h*u*v+e*f*n*x-c*k*n*x-e*l*p*x+a*k*p*x+c*l*u*x-a*f*u*x-b*f*n*w+c*h*n*w+b*l*p*w-a*h*p*w-c*l*t*w+a*f*t*w},transpose:function(){var a;
+a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
+a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
+a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},
+setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a),a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},
+setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),l=1-b,f=a.x,h=a.y,k=a.z,n=l*f,p=l*h;this.set(n*f+b,n*h-e*k,n*k+e*h,0,n*h+e*k,p*h+b,p*k-e*f,0,n*k-e*h,p*k+e*f,l*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,e=a.n13,l=a.n14,f=a.n21,h=a.n22,k=a.n23,n=a.n24,p=a.n31,t=a.n32,u=a.n33,y=a.n34,v=a.n41,x=a.n42,w=a.n43,z=a.n44;this.n11=k*y*x-n*u*x+n*t*w-h*y*w-k*t*z+h*u*z;this.n12=l*u*x-e*y*x-l*t*w+b*y*w+e*t*z-b*u*z;this.n13=e*n*x-l*k*x+l*h*w-b*n*w-e*h*z+b*k*z;this.n14=l*k*t-e*n*t-l*h*u+b*n*u+e*h*y-b*k*y;this.n21=n*u*v-k*y*v-n*p*w+f*y*w+k*p*z-f*u*z;this.n22=e*y*v-l*u*v+
+l*p*w-c*y*w-e*p*z+c*u*z;this.n23=l*k*v-e*n*v-l*f*w+c*n*w+e*f*z-c*k*z;this.n24=e*n*p-l*k*p+l*f*u-c*n*u-e*f*y+c*k*y;this.n31=h*y*v-n*t*v+n*p*x-f*y*x-h*p*z+f*t*z;this.n32=l*t*v-b*y*v-l*p*x+c*y*x+b*p*z-c*t*z;this.n33=e*n*v-l*h*v+l*f*x-c*n*x-b*f*z+c*h*z;this.n34=l*h*p-b*n*p-l*f*t+c*n*t+b*f*y-c*h*y;this.n41=k*t*v-h*u*v-k*p*x+f*u*x+h*p*w-f*t*w;this.n42=b*u*v-e*t*v+e*p*x-c*u*x-b*p*w+c*t*w;this.n43=e*h*v-b*k*v-e*f*x+c*k*x+b*f*w-c*h*w;this.n44=b*k*p-e*h*p+e*f*t-c*k*t-b*f*u+c*h*u;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,f=Math.cos(b),b=Math.sin(b),h=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=h*k,p=h*l,t=e*k,u=e*l;this.n11=n+u*b;this.n12=t*b-p;this.n13=f*e;this.n21=f*l;this.n22=f*k;this.n23=-b;this.n31=p*b-t;this.n32=u+n*b;this.n33=f*h;break;case "ZXY":n=h*k;p=h*l;t=e*k;u=e*l;this.n11=n-u*b;this.n12=-f*l;this.n13=t+p*b;this.n21=p+t*b;this.n22=f*k;this.n23=u-n*b;this.n31=-f*e;this.n32=b;this.n33=f*h;break;case "ZYX":n=
+f*k;p=f*l;t=b*k;u=b*l;this.n11=h*k;this.n12=t*e-p;this.n13=n*e+u;this.n21=h*l;this.n22=u*e+n;this.n23=p*e-t;this.n31=-e;this.n32=b*h;this.n33=f*h;break;case "YZX":n=f*h;p=f*e;t=b*h;u=b*e;this.n11=h*k;this.n12=u-n*l;this.n13=t*l+p;this.n21=l;this.n22=f*k;this.n23=-b*k;this.n31=-e*k;this.n32=p*l+t;this.n33=n-u*l;break;case "XZY":n=f*h;p=f*e;t=b*h;u=b*e;this.n11=h*k;this.n12=-l;this.n13=e*k;this.n21=n*l+u;this.n22=f*k;this.n23=p*l-t;this.n31=t*l-p;this.n32=b*k;this.n33=u*l+n;break;default:n=f*k,p=f*
+l,t=b*k,u=b*l,this.n11=h*k,this.n12=-h*l,this.n13=e,this.n21=p+t*e,this.n22=n-u*e,this.n23=-b*h,this.n31=u-n*e,this.n32=t+p*e,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,l=a.w,f=c+c,h=b+b,k=e+e,a=c*f,n=c*h;c*=k;var p=b*h;b*=k;e*=k;f*=l;h*=l;l*=k;this.n11=1-(p+e);this.n12=n-l;this.n13=c+h;this.n21=n+l;this.n22=1-(a+e);this.n23=b-f;this.n31=c-h;this.n32=b+f;this.n33=1-(a+p);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
 a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var e=THREE.Matrix4.__m1,l=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(c);l.setScale(b.x,b.y,b.z);this.multiply(e,l);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);l.set(this.n12,this.n22,this.n32);f.set(this.n13,
 this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=e.length();b.y=l.length();b.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=b.x;e.n21/=b.x;e.n31/=b.x;e.n12/=b.y;e.n22/=b.y;e.n32/=b.y;e.n13/=b.z;e.n23/=b.z;e.n33/=b.z;c.setFromRotationMatrix(e);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),e=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,l=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,v=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*h+a.n31*t;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*l;b[2]=a*f;b[3]=a*h;b[4]=a*k;b[5]=a*n;b[6]=a*t;b[7]=a*p;b[8]=a*v;return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=a.n33*a.n22-a.n32*a.n23,l=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,p=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,u=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*h+a.n31*p;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*e;b[1]=a*l;b[2]=a*f;b[3]=a*h;b[4]=a*k;b[5]=a*n;b[6]=a*p;b[7]=a*t;b[8]=a*u;return c};
 THREE.Matrix4.makeFrustum=function(a,c,b,e,l,f){var h;h=new THREE.Matrix4;h.n11=2*l/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*l/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+l)/(f-l);h.n34=-2*f*l/(f-l);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,e){var l,a=b*Math.tan(a*Math.PI/360);l=-a;return THREE.Matrix4.makeFrustum(l*c,a*c,l,a,b,e)};
-THREE.Matrix4.makeOrtho=function(a,c,b,e,l,f){var h,k,n,t;h=new THREE.Matrix4;k=c-a;n=b-e;t=f-l;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((b+e)/n);h.n31=0;h.n32=0;h.n33=-2/t;h.n34=-((f+l)/t);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(a,c,b,e,l,f){var h,k,n,p;h=new THREE.Matrix4;k=c-a;n=b-e;p=f-l;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/n;h.n23=0;h.n24=-((b+e)/n);h.n31=0;h.n32=0;h.n33=-2/p;h.n34=-((f+l)/p);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
 -1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,e,l;b=0;for(e=this.children.length;b<e;b++){l=this.children[b];if(l.name===a)return l;
 if(c&&(l=l.getChildByName(a,c),l!==void 0))return l}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,h=a.z+a.w,l=b.z+b.w,f=-a.z+a.w,k=-b.z+b.w;return h>=0&&l>=0&&f>=0&&k>=0?!0:h<0&&l<0||f<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,f,h=[],k,n,t=[],
-p,v,x=[],u,y=[],w,A,B=[],D,z,C=[],L={objects:[],sprites:[],lights:[],elements:[]},H=new THREE.Vector3,I=new THREE.Vector4,R=new THREE.Matrix4,K=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,G=new THREE.Vector4;this.computeFrustum=function(a){N[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);N[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);N[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);N[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);N[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);N[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=N[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);R.multiply(b.projectionMatrix,b.matrixWorldInverse);R.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-R.multiply(b.matrixWorld,b.projectionMatrixInverse);R.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,e){f=0;L.objects.length=0;L.sprites.length=0;L.lights.length=0;var h=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
-f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),k=0;k<6;k++)if(c=N[k].x*e.n14+N[k].y*e.n24+N[k].z*e.n34+N[k].w,c<=f){c=!1;break a}c=!0}c?(R.multiplyVector3(H.copy(b.position)),l=a(),l.object=b,l.z=H.z,L.objects.push(l)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(R.multiplyVector3(H.copy(b.position)),l=a(),l.object=b,l.z=H.z,L.sprites.push(l)):b instanceof THREE.Light&&L.lights.push(b);c=0;for(e=b.children.length;c<e;c++)h(b.children[c])}};h(c);e&&
-L.objects.sort(b);return L};this.projectScene=function(a,h,l){var f=h.near,H=h.far,Y,N,P,T,ja,ea,aa,na,ga,ca,la,fa,ka,ha,O,ta;z=A=u=v=0;L.elements.length=0;h.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(h));a.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);R.multiply(h.projectionMatrix,h.matrixWorldInverse);this.computeFrustum(R);L=this.projectGraph(a,!1);a=0;for(Y=L.objects.length;a<Y;a++)if(ga=L.objects[a].object,ca=ga.matrixWorld,
-fa=ga.material,n=0,ga instanceof THREE.Mesh){la=ga.geometry;ka=ga.geometry.materials;T=la.vertices;ha=la.faces;O=la.faceVertexUvs;la=ga.matrixRotationWorld.extractRotation(ca);N=0;for(P=T.length;N<P;N++)k=c(),k.positionWorld.copy(T[N].position),ca.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),R.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>f&&k.positionScreen.z<H;T=0;for(N=ha.length;T<
-N;T++){P=ha[T];if(P instanceof THREE.Face3)if(ja=t[P.a],ea=t[P.b],aa=t[P.c],ja.visible&&ea.visible&&aa.visible&&(ga.doubleSided||ga.flipSided!=(aa.positionScreen.x-ja.positionScreen.x)*(ea.positionScreen.y-ja.positionScreen.y)-(aa.positionScreen.y-ja.positionScreen.y)*(ea.positionScreen.x-ja.positionScreen.x)<0))na=x[v]=x[v]||new THREE.RenderableFace3,v++,p=na,p.v1.copy(ja),p.v2.copy(ea),p.v3.copy(aa);else continue;else if(P instanceof THREE.Face4)if(ja=t[P.a],ea=t[P.b],aa=t[P.c],na=t[P.d],ja.visible&&
-ea.visible&&aa.visible&&na.visible&&(ga.doubleSided||ga.flipSided!=((na.positionScreen.x-ja.positionScreen.x)*(ea.positionScreen.y-ja.positionScreen.y)-(na.positionScreen.y-ja.positionScreen.y)*(ea.positionScreen.x-ja.positionScreen.x)<0||(ea.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(ea.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0)))ta=y[u]=y[u]||new THREE.RenderableFace4,u++,p=ta,p.v1.copy(ja),p.v2.copy(ea),p.v3.copy(aa),
-p.v4.copy(na);else continue;p.normalWorld.copy(P.normal);la.multiplyVector3(p.normalWorld);p.centroidWorld.copy(P.centroid);ca.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);R.multiplyVector3(p.centroidScreen);aa=P.vertexNormals;ja=0;for(ea=aa.length;ja<ea;ja++)na=p.vertexNormalsWorld[ja],na.copy(aa[ja]),la.multiplyVector3(na);ja=0;for(ea=O.length;ja<ea;ja++)if(ta=O[ja][T]){aa=0;for(na=ta.length;aa<na;aa++)p.uvs[ja][aa]=ta[aa]}p.material=fa;p.faceMaterial=P.materialIndex!==
-null?ka[P.materialIndex]:null;p.z=p.centroidScreen.z;L.elements.push(p)}}else if(ga instanceof THREE.Line){K.multiply(R,ca);T=ga.geometry.vertices;ja=c();ja.positionScreen.copy(T[0].position);K.multiplyVector4(ja.positionScreen);N=1;for(P=T.length;N<P;N++)if(ja=c(),ja.positionScreen.copy(T[N].position),K.multiplyVector4(ja.positionScreen),ea=t[n-2],M.copy(ja.positionScreen),G.copy(ea.positionScreen),e(M,G))M.multiplyScalar(1/M.w),G.multiplyScalar(1/G.w),ga=B[A]=B[A]||new THREE.RenderableLine,A++,
-w=ga,w.v1.positionScreen.copy(M),w.v2.positionScreen.copy(G),w.z=Math.max(M.z,G.z),w.material=fa,L.elements.push(w)}a=0;for(Y=L.sprites.length;a<Y;a++)if(ga=L.sprites[a].object,ca=ga.matrixWorld,ga instanceof THREE.Particle&&(I.set(ca.n14,ca.n24,ca.n34,1),R.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))f=C[z]=C[z]||new THREE.RenderableParticle,z++,D=f,D.x=I.x/I.w,D.y=I.y/I.w,D.z=I.z,D.rotation=ga.rotation.z,D.scale.x=ga.scale.x*Math.abs(D.x-(I.x+h.projectionMatrix.n11)/(I.w+h.projectionMatrix.n14)),D.scale.y=
-ga.scale.y*Math.abs(D.y-(I.y+h.projectionMatrix.n22)/(I.w+h.projectionMatrix.n24)),D.material=ga.material,L.elements.push(D);l&&L.elements.sort(b);return L}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
+THREE.Projector=function(){function a(){var a=h[f]=h[f]||new THREE.RenderableObject;f++;return a}function c(){var a=p[n]=p[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,f=a.z+a.w,l=b.z+b.w,h=-a.z+a.w,k=-b.z+b.w;return f>=0&&l>=0&&h>=0&&k>=0?!0:f<0&&l<0||h<0&&k<0?!1:(f<0?c=Math.max(c,f/(f-l)):l<0&&(e=Math.min(e,f/(f-l))),h<0?c=Math.max(c,h/(h-k)):k<0&&(e=Math.min(e,h/(h-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,f,h=[],k,n,p=[],
+t,u,y=[],v,x=[],w,z,B=[],C,A,D=[],K={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,F=new THREE.Vector4,Q=new THREE.Matrix4,H=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],L=new THREE.Vector4,G=new THREE.Vector4;this.computeFrustum=function(a){N[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);N[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);N[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);N[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);N[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);N[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=N[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);Q.multiply(b.projectionMatrix,b.matrixWorldInverse);Q.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+Q.multiply(b.matrixWorld,b.projectionMatrixInverse);Q.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,e){f=0;K.objects.length=0;K.sprites.length=0;K.lights.length=0;var h=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var e=b.matrixWorld,
+f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),k=0;k<6;k++)if(c=N[k].x*e.n14+N[k].y*e.n24+N[k].z*e.n34+N[k].w,c<=f){c=!1;break a}c=!0}c?(Q.multiplyVector3(P.copy(b.position)),l=a(),l.object=b,l.z=P.z,K.objects.push(l)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(Q.multiplyVector3(P.copy(b.position)),l=a(),l.object=b,l.z=P.z,K.sprites.push(l)):b instanceof THREE.Light&&K.lights.push(b);c=0;for(e=b.children.length;c<e;c++)h(b.children[c])}};h(c);e&&
+K.objects.sort(b);return K};this.projectScene=function(a,f,l){var h=f.near,o=f.far,P,N,M,R,X,la,$,ma,na,ea,ka,fa,ia,ga,da,ta;A=z=v=u=0;K.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);Q.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(Q);K=this.projectGraph(a,!1);a=0;for(P=K.objects.length;a<P;a++)if(na=K.objects[a].object,ea=na.matrixWorld,
+fa=na.material,n=0,na instanceof THREE.Mesh){ka=na.geometry;ia=na.geometry.materials;R=ka.vertices;ga=ka.faces;da=ka.faceVertexUvs;ka=na.matrixRotationWorld.extractRotation(ea);N=0;for(M=R.length;N<M;N++)k=c(),k.positionWorld.copy(R[N].position),ea.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),Q.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>h&&k.positionScreen.z<o;R=0;for(N=ga.length;R<
+N;R++){M=ga[R];if(M instanceof THREE.Face3)if(X=p[M.a],la=p[M.b],$=p[M.c],X.visible&&la.visible&&$.visible&&(na.doubleSided||na.flipSided!=($.positionScreen.x-X.positionScreen.x)*(la.positionScreen.y-X.positionScreen.y)-($.positionScreen.y-X.positionScreen.y)*(la.positionScreen.x-X.positionScreen.x)<0))ma=y[u]=y[u]||new THREE.RenderableFace3,u++,t=ma,t.v1.copy(X),t.v2.copy(la),t.v3.copy($);else continue;else if(M instanceof THREE.Face4)if(X=p[M.a],la=p[M.b],$=p[M.c],ma=p[M.d],X.visible&&la.visible&&
+$.visible&&ma.visible&&(na.doubleSided||na.flipSided!=((ma.positionScreen.x-X.positionScreen.x)*(la.positionScreen.y-X.positionScreen.y)-(ma.positionScreen.y-X.positionScreen.y)*(la.positionScreen.x-X.positionScreen.x)<0||(la.positionScreen.x-$.positionScreen.x)*(ma.positionScreen.y-$.positionScreen.y)-(la.positionScreen.y-$.positionScreen.y)*(ma.positionScreen.x-$.positionScreen.x)<0)))ta=x[v]=x[v]||new THREE.RenderableFace4,v++,t=ta,t.v1.copy(X),t.v2.copy(la),t.v3.copy($),t.v4.copy(ma);else continue;
+t.normalWorld.copy(M.normal);ka.multiplyVector3(t.normalWorld);t.centroidWorld.copy(M.centroid);ea.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);Q.multiplyVector3(t.centroidScreen);$=M.vertexNormals;X=0;for(la=$.length;X<la;X++)ma=t.vertexNormalsWorld[X],ma.copy($[X]),ka.multiplyVector3(ma);X=0;for(la=da.length;X<la;X++)if(ta=da[X][R]){$=0;for(ma=ta.length;$<ma;$++)t.uvs[X][$]=ta[$]}t.material=fa;t.faceMaterial=M.materialIndex!==null?ia[M.materialIndex]:null;t.z=t.centroidScreen.z;
+K.elements.push(t)}}else if(na instanceof THREE.Line){H.multiply(Q,ea);R=na.geometry.vertices;X=c();X.positionScreen.copy(R[0].position);H.multiplyVector4(X.positionScreen);N=1;for(M=R.length;N<M;N++)if(X=c(),X.positionScreen.copy(R[N].position),H.multiplyVector4(X.positionScreen),la=p[n-2],L.copy(X.positionScreen),G.copy(la.positionScreen),e(L,G))L.multiplyScalar(1/L.w),G.multiplyScalar(1/G.w),na=B[z]=B[z]||new THREE.RenderableLine,z++,w=na,w.v1.positionScreen.copy(L),w.v2.positionScreen.copy(G),
+w.z=Math.max(L.z,G.z),w.material=fa,K.elements.push(w)}a=0;for(P=K.sprites.length;a<P;a++)if(na=K.sprites[a].object,ea=na.matrixWorld,na instanceof THREE.Particle&&(F.set(ea.n14,ea.n24,ea.n34,1),Q.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))h=D[A]=D[A]||new THREE.RenderableParticle,A++,C=h,C.x=F.x/F.w,C.y=F.y/F.w,C.z=F.z,C.rotation=na.rotation.z,C.scale.x=na.scale.x*Math.abs(C.x-(F.x+f.projectionMatrix.n11)/(F.w+f.projectionMatrix.n14)),C.scale.y=na.scale.y*Math.abs(C.y-(F.y+f.projectionMatrix.n22)/
+(F.w+f.projectionMatrix.n24)),C.material=na.material,K.elements.push(C);l&&K.elements.sort(b);return K}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==void 0?e:1)};
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,e=a.y*c,l=a.z*c,a=Math.cos(e),e=Math.sin(e),c=Math.cos(-l),l=Math.sin(-l),f=Math.cos(b),b=Math.sin(b),h=a*c,k=e*l;this.w=h*f-k*b;this.x=h*b+k*f;this.y=e*c*f+a*l*b;this.z=a*l*f-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
-this.x,b=this.y,e=this.z,l=this.w,f=a.x,h=a.y,k=a.z,a=a.w;this.x=c*a+l*f+b*k-e*h;this.y=b*a+l*h+e*f-c*k;this.z=e*a+l*k+c*h-b*f;this.w=l*a-c*f-b*h-e*k;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,l=a.z,f=this.x,h=this.y,k=this.z,n=this.w,t=n*b+h*l-k*e,p=n*e+k*b-f*l,v=n*l+f*e-h*b,b=-f*
-b-h*e-k*l;c.x=t*n+b*-f+p*-k-v*-h;c.y=p*n+b*-h+v*-f-t*-k;c.z=v*n+b*-k+t*-h-p*-f;return c}};
-THREE.Quaternion.slerp=function(a,c,b,e){var l=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;l<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,l=-l):b.copy(c);if(Math.abs(l)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var f=Math.acos(l),l=Math.sqrt(1-l*l);if(Math.abs(l)<0.001)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*f)/l;e=Math.sin(e*f)/l;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+this.x,b=this.y,e=this.z,l=this.w,f=a.x,h=a.y,k=a.z,a=a.w;this.x=c*a+l*f+b*k-e*h;this.y=b*a+l*h+e*f-c*k;this.z=e*a+l*k+c*h-b*f;this.w=l*a-c*f-b*h-e*k;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,l=a.z,f=this.x,h=this.y,k=this.z,n=this.w,p=n*b+h*l-k*e,t=n*e+k*b-f*l,u=n*l+f*e-h*b,b=-f*
+b-h*e-k*l;c.x=p*n+b*-f+t*-k-u*-h;c.y=t*n+b*-h+u*-f-p*-k;c.z=u*n+b*-k+p*-h-t*-f;return c}};
+THREE.Quaternion.slerp=function(a,c,b,e){var l=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;l<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,l=-l):b.copy(c);if(Math.abs(l)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var f=Math.acos(l),l=Math.sqrt(1-l*l);if(Math.abs(l)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-e)*f)/l;e=Math.sin(e*f)/l;b.w=a.w*c+b.w*e;b.x=a.x*c+b.x*e;b.y=a.y*c+b.y*e;b.z=a.z*c+b.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,c,b,e,l,f){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=l instanceof THREE.Color?l:new THREE.Color;this.vertexColors=l instanceof Array?l:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,c,b,e,l,f,h){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=l instanceof THREE.Vector3?l:new THREE.Vector3;this.vertexNormals=l instanceof Array?l:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -83,15 +83,15 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
 b,e,l,f,h,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e<l;e++){f=this.faces[e];if(a&&f.vertexNormals.length){k.set(0,0,0);c=0;for(b=f.vertexNormals.length;c<b;c++)k.addSelf(f.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[f.a],b=this.vertices[f.b],h=this.vertices[f.c],k.sub(h.position,b.position),n.sub(c.position,b.position),k.crossSelf(n);k.isZero()||k.normalize();f.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
 THREE.Face3?(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(e[b.a].addSelf(b.normal),e[b.b].addSelf(b.normal),e[b.c].addSelf(b.normal),e[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(e[b.a]),b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(e[b.a]),
-b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,l,f,o){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;p=h[l];v=h[f];x=h[o];u=n.x-k.x;y=t.x-k.x;w=n.y-k.y;A=t.y-k.y;B=n.z-k.z;D=t.z-k.z;z=v.u-p.u;C=x.u-p.u;L=v.v-p.v;H=x.v-p.v;I=1/(z*H-C*L);M.set((H*u-L*y)*I,(H*w-L*A)*I,(H*B-L*D)*I);G.set((z*y-C*u)*I,(z*A-C*w)*I,(z*D-C*B)*I);K[b].addSelf(M);K[c].addSelf(M);K[e].addSelf(M);N[b].addSelf(G);
-N[c].addSelf(G);N[e].addSelf(G)}var c,b,e,l,f,h,k,n,t,p,v,x,u,y,w,A,B,D,z,C,L,H,I,R,K=[],N=[],M=new THREE.Vector3,G=new THREE.Vector3,Z=new THREE.Vector3,$=new THREE.Vector3,U=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)K[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)f=this.faces[c],h=this.faceVertexUvs[0][c],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var o=["a","b",
-"c","d"];c=0;for(b=this.faces.length;c<b;c++){f=this.faces[c];for(e=0;e<f.vertexNormals.length;e++)U.copy(f.vertexNormals[e]),l=f[o[e]],R=K[l],Z.copy(R),Z.subSelf(U.multiplyScalar(U.dot(R))).normalize(),$.cross(f.vertexNormals[e],R),l=$.dot(N[l]),l=l<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(Z.x,Z.y,Z.z,l)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
+b.vertexNormals[1].copy(e[b.b]),b.vertexNormals[2].copy(e[b.c]),b.vertexNormals[3].copy(e[b.d]))},computeTangents:function(){function a(a,b,c,e,f,l,T){k=a.vertices[b].position;n=a.vertices[c].position;p=a.vertices[e].position;t=h[f];u=h[l];y=h[T];v=n.x-k.x;x=p.x-k.x;w=n.y-k.y;z=p.y-k.y;B=n.z-k.z;C=p.z-k.z;A=u.u-t.u;D=y.u-t.u;K=u.v-t.v;P=y.v-t.v;F=1/(A*P-D*K);L.set((P*v-K*x)*F,(P*w-K*z)*F,(P*B-K*C)*F);G.set((A*x-D*v)*F,(A*z-D*w)*F,(A*C-D*B)*F);H[b].addSelf(L);H[c].addSelf(L);H[e].addSelf(L);N[b].addSelf(G);
+N[c].addSelf(G);N[e].addSelf(G)}var c,b,e,l,f,h,k,n,p,t,u,y,v,x,w,z,B,C,A,D,K,P,F,Q,H=[],N=[],L=new THREE.Vector3,G=new THREE.Vector3,V=new THREE.Vector3,ca=new THREE.Vector3,W=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)H[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)f=this.faces[c],h=this.faceVertexUvs[0][c],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var T=["a",
+"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){f=this.faces[c];for(e=0;e<f.vertexNormals.length;e++)W.copy(f.vertexNormals[e]),l=f[T[e]],Q=H[l],V.copy(Q),V.subSelf(W.multiplyScalar(W.dot(Q))).normalize(),ca.cross(f.vertexNormals[e],Q),l=ca.dot(N[l]),l=l<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(V.x,V.y,V.z,l)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,
 this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=
 a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],e,l=Math.pow(10,4),f,h;f=0;for(h=this.vertices.length;f<h;f++)e=this.vertices[f].position,e=[Math.round(e.x*l),Math.round(e.y*l),Math.round(e.z*l)].join("_"),a[e]===void 0?(a[e]=f,c.push(this.vertices[f]),
 b[f]=c.length-1):b[f]=b[a[e]];f=0;for(h=this.faces.length;f<h;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function c(a,b,c,e,h,l,f){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*f+(-3*(b-c)-2*a-e)*l+a*h+b}this.points=a;var b=[],e={x:0,y:0,z:0},l,f,h,k,n,t,p,v,x;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){l=(this.points.length-1)*a;f=Math.floor(l);h=l-f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>this.points.length-2?f:f+1;b[3]=f>this.points.length-3?f:f+2;t=this.points[b[0]];p=this.points[b[1]];
-v=this.points[b[2]];x=this.points[b[3]];k=h*h;n=h*k;e.x=c(t.x,p.x,v.x,x.x,h,k,n);e.y=c(t.y,p.y,v.y,x.y,h,k,n);e.z=c(t.z,p.z,v.z,x.z,h,k,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,l=new THREE.Vector3,f=[],k=0;f[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),l.copy(position),
-k+=l.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(f[b]=k,e=b);f[f.length]=k;return{chunks:f,total:k}};this.reparametrizeByArcLength=function(a){var b,c,e,h,l,f,k=[],n=new THREE.Vector3,t=this.getLength();k.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=t.chunks[b]-t.chunks[b-1];f=Math.ceil(a*c/t.total);h=(b-1)/(this.points.length-1);l=b/(this.points.length-1);for(c=1;c<f-1;c++)e=h+c*(1/f)*(l-h),position=this.getPoint(e),k.push(n.copy(position).clone());
+THREE.Spline=function(a){function c(a,b,c,e,f,l,h){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*h+(-3*(b-c)-2*a-e)*l+a*f+b}this.points=a;var b=[],e={x:0,y:0,z:0},l,f,h,k,n,p,t,u,y;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){l=(this.points.length-1)*a;f=Math.floor(l);h=l-f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>this.points.length-2?f:f+1;b[3]=f>this.points.length-3?f:f+2;p=this.points[b[0]];t=this.points[b[1]];
+u=this.points[b[2]];y=this.points[b[3]];k=h*h;n=h*k;e.x=c(p.x,t.x,u.x,y.x,h,k,n);e.y=c(p.y,t.y,u.y,y.y,h,k,n);e.z=c(p.z,t.z,u.z,y.z,h,k,n);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,f=new THREE.Vector3,l=new THREE.Vector3,h=[],k=0;h[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),l.copy(position),
+k+=l.distanceTo(f),f.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=k,e=b);h[h.length]=k;return{chunks:h,total:k}};this.reparametrizeByArcLength=function(a){var b,c,e,f,l,h,k=[],n=new THREE.Vector3,p=this.getLength();k.push(n.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=p.chunks[b]-p.chunks[b-1];h=Math.ceil(a*c/p.total);f=(b-1)/(this.points.length-1);l=b/(this.points.length-1);for(c=1;c<h-1;c++)e=f+c*(1/h)*(l-f),position=this.getPoint(e),k.push(n.copy(position).clone());
 k.push(n.copy(this.points[b]).clone())}this.points=k}};THREE.Edge=function(a,c,b,e){this.vertices=[a,c];this.vertexIndices=[b,e];this.faces=[];this.faceIndices=[]};
 THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
 THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,e,l,f){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=e;this.near=l!==void 0?l:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
@@ -125,7 +125,7 @@ THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new TH
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
 THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,c,b,e,l,f,h,k,n){THREE.Texture.call(this,null,l,f,h,k,n);this.image={data:a,width:c,height:b};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c;this.sortParticles=!1};
-THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.material=c;this.type=b!=void 0?b:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.material=c;this.type=b!==void 0?b:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.material=c;if(c instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=c[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
 for(var b=0;b<this.geometry.morphTargets.length;b++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
@@ -149,47 +149,47 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
 THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
 THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
 THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,l,f;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;f=e/2};this.render=function(b,e){var n,t,p,v,x,u,y,w;a=c.projectScene(b,e);n=0;for(t=a.length;n<t;n++)if(x=a[n],x instanceof THREE.RenderableParticle){y=x.x*l+l;w=x.y*f+f;p=0;for(v=x.material.length;p<v;p++)if(u=x.material[p],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=y+"px",u.style.top=w+"px"}}};
-THREE.CanvasRenderer=function(a){function c(a){if(D!=a)w.globalAlpha=D=a}function b(a){if(z!=a){switch(a){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}z=a}}function e(a){if(C!=a)w.strokeStyle=C=a}function l(a){if(L!=a)w.fillStyle=L=a}var f=this,h,k,n,t=new THREE.Projector,a=a||{},p=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-v,x,u,y,w=p.getContext("2d"),A=new THREE.Color(0),B=0,D=1,z=0,C=null,L=null,H=null,I=null,R=null,K,N,M,G,Z=new THREE.RenderableVertex,$=new THREE.RenderableVertex,U,o,da,Y,pa,P,T,ja,ea,aa,na,ga,ca=new THREE.Color,la=new THREE.Color,fa=new THREE.Color,ka=new THREE.Color,ha=new THREE.Color,O=[],ta,qa,ma,ua,xa,Da,Ba,Ea,Ca,E,V=new THREE.Rectangle,ia=new THREE.Rectangle,X=new THREE.Rectangle,va=!1,ra=new THREE.Color,wa=new THREE.Color,sa=new THREE.Color,oa=new THREE.Vector3,Fa,ya,Ga,Aa,W,Ia,a=16;Fa=document.createElement("canvas");
-Fa.width=Fa.height=2;ya=Fa.getContext("2d");ya.fillStyle="rgba(0,0,0,1)";ya.fillRect(0,0,2,2);Ga=ya.getImageData(0,0,2,2);Aa=Ga.data;W=document.createElement("canvas");W.width=W.height=a;Ia=W.getContext("2d");Ia.translate(-a/2,-a/2);Ia.scale(a,a);a--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){v=a;x=b;u=Math.floor(v/2);y=Math.floor(x/2);p.width=v;p.height=x;V.set(-u,-y,u,y);ia.set(-u,-y,u,y);D=1;z=0;R=I=
-H=L=C=null};this.setClearColor=function(a,b){A.copy(a);B=b;ia.set(-u,-y,u,y)};this.setClearColorHex=function(a,b){A.setHex(a);B=b;ia.set(-u,-y,u,y)};this.clear=function(){w.setTransform(1,0,0,-1,u,y);ia.isEmpty()||(ia.minSelf(V),ia.inflate(2),B<1&&w.clearRect(Math.floor(ia.getX()),Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight())),B>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*255)+","+B+")"),w.fillRect(Math.floor(ia.getX()),
-Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(a,p){function v(a){var b,c,e,h;ra.setRGB(0,0,0);wa.setRGB(0,0,0);sa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],h=e.color,e instanceof THREE.AmbientLight?(ra.r+=h.r,ra.g+=h.g,ra.b+=h.b):e instanceof THREE.DirectionalLight?(wa.r+=h.r,wa.g+=h.g,wa.b+=h.b):e instanceof THREE.PointLight&&(sa.r+=h.r,sa.g+=h.g,sa.b+=h.b)}function x(a,b,c,e){var h,l,f,o,k,n;h=0;for(l=a.length;h<l;h++)f=a[h],
-o=f.color,f instanceof THREE.DirectionalLight?(k=f.matrixWorld.getPosition(),n=c.dot(k),n<=0||(n*=f.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)):f instanceof THREE.PointLight&&(k=f.matrixWorld.getPosition(),n=c.dot(oa.sub(k,b).normalize()),n<=0||(n*=f.distance==0?1:1-Math.min(b.distanceTo(k)/f.distance,1),n!=0&&(n*=f.intensity,e.r+=o.r*n,e.g+=o.g*n,e.b+=o.b*n)))}function A(a,h,f){c(f.opacity);b(f.blending);var o,k,n,t,p,Q;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)t=f.map.image,p=t.width>>
-1,Q=t.height>>1,f=h.scale.x*u,n=h.scale.y*y,o=f*p,k=n*Q,X.set(a.x-o,a.y-k,a.x+o,a.y+k),V.intersects(X)&&(w.save(),w.translate(a.x,a.y),w.rotate(-h.rotation),w.scale(f,-n),w.translate(-p,-Q),w.drawImage(t,0,0),w.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(o=h.scale.x*u,k=h.scale.y*y,X.set(a.x-o,a.y-k,a.x+o,a.y+k),V.intersects(X)&&(e(f.color.getContextStyle()),l(f.color.getContextStyle()),w.save(),w.translate(a.x,a.y),w.rotate(-h.rotation),w.scale(o,k),f.program(w),w.restore()))}function B(a,
-h,f,l){c(l.opacity);b(l.blending);w.beginPath();w.moveTo(a.positionScreen.x,a.positionScreen.y);w.lineTo(h.positionScreen.x,h.positionScreen.y);w.closePath();if(l instanceof THREE.LineBasicMaterial){a=l.linewidth;if(H!=a)w.lineWidth=H=a;a=l.linecap;if(I!=a)w.lineCap=I=a;a=l.linejoin;if(R!=a)w.lineJoin=R=a;e(l.color.getContextStyle());w.stroke();X.inflate(l.linewidth*2)}}function z(a,e,h,l,k,t,u,Q){f.info.render.vertices+=3;f.info.render.faces++;c(Q.opacity);b(Q.blending);U=a.positionScreen.x;o=a.positionScreen.y;
-da=e.positionScreen.x;Y=e.positionScreen.y;pa=h.positionScreen.x;P=h.positionScreen.y;Ua(U,o,da,Y,pa,P);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.mapping instanceof THREE.UVMapping&&(ua=u.uvs[0],Xa(U,o,da,Y,pa,P,ua[l].u,ua[l].v,ua[k].u,ua[k].v,ua[t].u,ua[t].v,Q.map));else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=p.matrixWorldInverse,oa.copy(u.vertexNormalsWorld[l]),xa=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,Da=-(oa.x*a.n21+oa.y*a.n22+oa.z*a.n23)*
-0.5+0.5,oa.copy(u.vertexNormalsWorld[k]),Ba=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,Ea=-(oa.x*a.n21+oa.y*a.n22+oa.z*a.n23)*0.5+0.5,oa.copy(u.vertexNormalsWorld[t]),Ca=(oa.x*a.n11+oa.y*a.n12+oa.z*a.n13)*0.5+0.5,E=-(oa.x*a.n21+oa.y*a.n22+oa.z*a.n23)*0.5+0.5,Xa(U,o,da,Y,pa,P,xa,Da,Ba,Ea,Ca,E,Q.envMap)}else Q.wireframe?L(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)Q.map&&!Q.wireframe&&(Q.map.mapping instanceof THREE.UVMapping&&
-(ua=u.uvs[0],Xa(U,o,da,Y,pa,P,ua[l].u,ua[l].v,ua[k].u,ua[k].v,ua[t].u,ua[t].v,Q.map)),b(THREE.SubtractiveBlending)),va?!Q.wireframe&&Q.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(la.r=fa.r=ka.r=ra.r,la.g=fa.g=ka.g=ra.g,la.b=fa.b=ka.b=ra.b,x(n,u.v1.positionWorld,u.vertexNormalsWorld[0],la),x(n,u.v2.positionWorld,u.vertexNormalsWorld[1],fa),x(n,u.v3.positionWorld,u.vertexNormalsWorld[2],ka),la.r=Math.max(0,Math.min(Q.color.r*la.r,1)),la.g=Math.max(0,Math.min(Q.color.g*la.g,1)),la.b=
-Math.max(0,Math.min(Q.color.b*la.b,1)),fa.r=Math.max(0,Math.min(Q.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(Q.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(Q.color.b*fa.b,1)),ka.r=Math.max(0,Math.min(Q.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(Q.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(Q.color.b*ka.b,1)),ha.r=(fa.r+ka.r)*0.5,ha.g=(fa.g+ka.g)*0.5,ha.b=(fa.b+ka.b)*0.5,ma=Va(la,fa,ka,ha),Sa(U,o,da,Y,pa,P,0,0,1,0,0,1,ma)):(ca.r=ra.r,ca.g=ra.g,ca.b=ra.b,x(n,u.centroidWorld,u.normalWorld,ca),ca.r=Math.max(0,
-Math.min(Q.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Q.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Q.color.b*ca.b,1)),Q.wireframe?L(ca,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(ca)):Q.wireframe?L(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(Q.color);else if(Q instanceof THREE.MeshDepthMaterial)ta=p.near,qa=p.far,la.r=la.g=la.b=1-Na(a.positionScreen.z,ta,qa),fa.r=fa.g=fa.b=1-Na(e.positionScreen.z,ta,qa),ka.r=ka.g=ka.b=1-Na(h.positionScreen.z,ta,qa),ha.r=
-(fa.r+ka.r)*0.5,ha.g=(fa.g+ka.g)*0.5,ha.b=(fa.b+ka.b)*0.5,ma=Va(la,fa,ka,ha),Sa(U,o,da,Y,pa,P,0,0,1,0,0,1,ma);else if(Q instanceof THREE.MeshNormalMaterial)ca.r=Ta(u.normalWorld.x),ca.g=Ta(u.normalWorld.y),ca.b=Ta(u.normalWorld.z),Q.wireframe?L(ca,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(ca)}function D(a,e,h,l,k,t,u,Q,v){f.info.render.vertices+=4;f.info.render.faces++;c(Q.opacity);b(Q.blending);if(Q.map||Q.envMap)z(a,e,l,0,1,3,u,Q,v),z(k,h,t,1,2,3,u,Q,v);else if(U=a.positionScreen.x,
-o=a.positionScreen.y,da=e.positionScreen.x,Y=e.positionScreen.y,pa=h.positionScreen.x,P=h.positionScreen.y,T=l.positionScreen.x,ja=l.positionScreen.y,ea=k.positionScreen.x,aa=k.positionScreen.y,na=t.positionScreen.x,ga=t.positionScreen.y,Q instanceof THREE.MeshBasicMaterial)C(U,o,da,Y,pa,P,T,ja),Q.wireframe?L(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(Q.color);else if(Q instanceof THREE.MeshLambertMaterial)va?!Q.wireframe&&Q.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==
-4?(la.r=fa.r=ka.r=ha.r=ra.r,la.g=fa.g=ka.g=ha.g=ra.g,la.b=fa.b=ka.b=ha.b=ra.b,x(n,u.v1.positionWorld,u.vertexNormalsWorld[0],la),x(n,u.v2.positionWorld,u.vertexNormalsWorld[1],fa),x(n,u.v4.positionWorld,u.vertexNormalsWorld[3],ka),x(n,u.v3.positionWorld,u.vertexNormalsWorld[2],ha),la.r=Math.max(0,Math.min(Q.color.r*la.r,1)),la.g=Math.max(0,Math.min(Q.color.g*la.g,1)),la.b=Math.max(0,Math.min(Q.color.b*la.b,1)),fa.r=Math.max(0,Math.min(Q.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(Q.color.g*fa.g,1)),
-fa.b=Math.max(0,Math.min(Q.color.b*fa.b,1)),ka.r=Math.max(0,Math.min(Q.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(Q.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(Q.color.b*ka.b,1)),ha.r=Math.max(0,Math.min(Q.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(Q.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(Q.color.b*ha.b,1)),ma=Va(la,fa,ka,ha),Ua(U,o,da,Y,T,ja),Sa(U,o,da,Y,T,ja,0,0,1,0,0,1,ma),Ua(ea,aa,pa,P,na,ga),Sa(ea,aa,pa,P,na,ga,1,0,1,1,0,1,ma)):(ca.r=ra.r,ca.g=ra.g,ca.b=ra.b,x(n,u.centroidWorld,u.normalWorld,
-ca),ca.r=Math.max(0,Math.min(Q.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Q.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Q.color.b*ca.b,1)),C(U,o,da,Y,pa,P,T,ja),Q.wireframe?L(ca,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(ca)):(C(U,o,da,Y,pa,P,T,ja),Q.wireframe?L(Q.color,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(Q.color));else if(Q instanceof THREE.MeshNormalMaterial)ca.r=Ta(u.normalWorld.x),ca.g=Ta(u.normalWorld.y),ca.b=Ta(u.normalWorld.z),C(U,o,da,Y,pa,P,T,
-ja),Q.wireframe?L(ca,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):La(ca);else if(Q instanceof THREE.MeshDepthMaterial)ta=p.near,qa=p.far,la.r=la.g=la.b=1-Na(a.positionScreen.z,ta,qa),fa.r=fa.g=fa.b=1-Na(e.positionScreen.z,ta,qa),ka.r=ka.g=ka.b=1-Na(l.positionScreen.z,ta,qa),ha.r=ha.g=ha.b=1-Na(h.positionScreen.z,ta,qa),ma=Va(la,fa,ka,ha),Ua(U,o,da,Y,T,ja),Sa(U,o,da,Y,T,ja,0,0,1,0,0,1,ma),Ua(ea,aa,pa,P,na,ga),Sa(ea,aa,pa,P,na,ga,1,0,1,1,0,1,ma)}function Ua(a,b,c,e,h,l){w.beginPath();
-w.moveTo(a,b);w.lineTo(c,e);w.lineTo(h,l);w.lineTo(a,b);w.closePath()}function C(a,b,c,e,h,l,f,o){w.beginPath();w.moveTo(a,b);w.lineTo(c,e);w.lineTo(h,l);w.lineTo(f,o);w.lineTo(a,b);w.closePath()}function L(a,b,c,h){if(H!=b)w.lineWidth=H=b;if(I!=c)w.lineCap=I=c;if(R!=h)w.lineJoin=R=h;e(a.getContextStyle());w.stroke();X.inflate(b*2)}function La(a){l(a.getContextStyle());w.fill()}function Xa(a,b,c,e,h,f,o,k,n,Q,t,u,p){if(p.image.width!=0){if(p.needsUpdate==!0||O[p.id]==void 0){var v=p.wrapS==THREE.RepeatWrapping,
-x=p.wrapT==THREE.RepeatWrapping;O[p.id]=w.createPattern(p.image,v&&x?"repeat":v&&!x?"repeat-x":!v&&x?"repeat-y":"no-repeat");p.needsUpdate=!1}l(O[p.id]);var v=p.offset.x/p.repeat.x,x=p.offset.y/p.repeat.y,E=(p.image.width-1)*p.repeat.x,p=(p.image.height-1)*p.repeat.y,o=(o+v)*E,k=(k+x)*p,n=(n+v)*E,Q=(Q+x)*p,t=(t+v)*E,u=(u+x)*p;c-=a;e-=b;h-=a;f-=b;n-=o;Q-=k;t-=o;u-=k;v=1/(n*u-t*Q);p=(u*c-Q*h)*v;Q=(u*e-Q*f)*v;c=(n*h-t*c)*v;e=(n*f-t*e)*v;a=a-p*o-c*k;b=b-Q*o-e*k;w.save();w.transform(p,Q,c,e,a,b);w.fill();
-w.restore()}}function Sa(a,b,c,e,h,l,f,o,k,n,Q,t,u){var p,v;p=u.width-1;v=u.height-1;f*=p;o*=v;k*=p;n*=v;Q*=p;t*=v;c-=a;e-=b;h-=a;l-=b;k-=f;n-=o;Q-=f;t-=o;v=1/(k*t-Q*n);p=(t*c-n*h)*v;n=(t*e-n*l)*v;c=(k*h-Q*c)*v;e=(k*l-Q*e)*v;a=a-p*f-c*o;b=b-n*f-e*o;w.save();w.transform(p,n,c,e,a,b);w.clip();w.drawImage(u,0,0);w.restore()}function Va(a,b,c,e){var h=~~(a.r*255),l=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),o=~~(b.g*255),b=~~(b.b*255),k=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),Q=~~(e.r*255),t=~~(e.g*255),
-e=~~(e.b*255);Aa[0]=h<0?0:h>255?255:h;Aa[1]=l<0?0:l>255?255:l;Aa[2]=a<0?0:a>255?255:a;Aa[4]=f<0?0:f>255?255:f;Aa[5]=o<0?0:o>255?255:o;Aa[6]=b<0?0:b>255?255:b;Aa[8]=k<0?0:k>255?255:k;Aa[9]=n<0?0:n>255?255:n;Aa[10]=c<0?0:c>255?255:c;Aa[12]=Q<0?0:Q>255?255:Q;Aa[13]=t<0?0:t>255?255:t;Aa[14]=e<0?0:e>255?255:e;ya.putImageData(Ga,0,0);Ia.drawImage(Fa,0,0);return W}function Na(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ma(a,b){var c=b.x-a.x,e=b.y-a.y,
-h=c*c+e*e;h!=0&&(h=1/Math.sqrt(h),c*=h,e*=h,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Wa,Ya,za,Ha;this.autoClear?this.clear():w.setTransform(1,0,0,-1,u,y);f.info.render.vertices=0;f.info.render.faces=0;h=t.projectScene(a,p,this.sortElements);k=h.elements;n=h.lights;(va=n.length>0)&&v(n);Wa=0;for(Ya=k.length;Wa<Ya;Wa++)if(za=k[Wa],Ha=za.material,Ha=Ha instanceof THREE.MeshFaceMaterial?za.faceMaterial:Ha,!(Ha==null||Ha.opacity==0)){X.empty();if(za instanceof THREE.RenderableParticle)K=za,K.x*=u,K.y*=y,A(K,za,
-Ha,a);else if(za instanceof THREE.RenderableLine)K=za.v1,N=za.v2,K.positionScreen.x*=u,K.positionScreen.y*=y,N.positionScreen.x*=u,N.positionScreen.y*=y,X.addPoint(K.positionScreen.x,K.positionScreen.y),X.addPoint(N.positionScreen.x,N.positionScreen.y),V.intersects(X)&&B(K,N,za,Ha,a);else if(za instanceof THREE.RenderableFace3)K=za.v1,N=za.v2,M=za.v3,K.positionScreen.x*=u,K.positionScreen.y*=y,N.positionScreen.x*=u,N.positionScreen.y*=y,M.positionScreen.x*=u,M.positionScreen.y*=y,Ha.overdraw&&(Ma(K.positionScreen,
-N.positionScreen),Ma(N.positionScreen,M.positionScreen),Ma(M.positionScreen,K.positionScreen)),X.add3Points(K.positionScreen.x,K.positionScreen.y,N.positionScreen.x,N.positionScreen.y,M.positionScreen.x,M.positionScreen.y),V.intersects(X)&&z(K,N,M,0,1,2,za,Ha,a);else if(za instanceof THREE.RenderableFace4)K=za.v1,N=za.v2,M=za.v3,G=za.v4,K.positionScreen.x*=u,K.positionScreen.y*=y,N.positionScreen.x*=u,N.positionScreen.y*=y,M.positionScreen.x*=u,M.positionScreen.y*=y,G.positionScreen.x*=u,G.positionScreen.y*=
-y,Z.positionScreen.copy(N.positionScreen),$.positionScreen.copy(G.positionScreen),Ha.overdraw&&(Ma(K.positionScreen,N.positionScreen),Ma(N.positionScreen,G.positionScreen),Ma(G.positionScreen,K.positionScreen),Ma(M.positionScreen,Z.positionScreen),Ma(M.positionScreen,$.positionScreen)),X.addPoint(K.positionScreen.x,K.positionScreen.y),X.addPoint(N.positionScreen.x,N.positionScreen.y),X.addPoint(M.positionScreen.x,M.positionScreen.y),X.addPoint(G.positionScreen.x,G.positionScreen.y),V.intersects(X)&&
-D(K,N,M,G,Z,$,za,Ha,a);ia.addRectangle(X)}w.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,e){var h,l,f,k,n,t;h=0;for(l=a.length;h<l;h++)f=a[h],k=f.color,f instanceof THREE.DirectionalLight?(n=f.matrixWorld.getPosition(),t=c.dot(n),t<=0||(t*=f.intensity,e.r+=k.r*t,e.g+=k.g*t,e.b+=k.b*t)):f instanceof THREE.PointLight&&(n=f.matrixWorld.getPosition(),t=c.dot(K.sub(n,b).normalize()),t<=0||(t*=f.distance==0?1:1-Math.min(b.distanceTo(n)/f.distance,1),t!=0&&(t*=f.intensity,e.r+=k.r*t,e.g+=k.g*t,e.b+=k.b*t)))}function c(a){N[a]==null&&(N[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),U==0&&N[a].setAttribute("shape-rendering","crispEdges"));return N[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,l,f,h,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,p,v,x,u,y,w,A,B=new THREE.Rectangle,D=new THREE.Rectangle,z=!1,C=new THREE.Color,L=new THREE.Color,H=new THREE.Color,I=new THREE.Color,R,K=new THREE.Vector3,N=[],M=[],G,Z,$,U=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
-faces:0}};this.setQuality=function(a){switch(a){case "high":U=1;break;case "low":U=0}};this.setSize=function(a,b){t=a;p=b;v=t/2;x=p/2;n.setAttribute("viewBox",-v+" "+-x+" "+t+" "+p);n.setAttribute("width",t);n.setAttribute("height",p);B.set(-v,-x,v,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(o,t){var p,K,P,T;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(o,t,this.sortElements);f=l.elements;
-h=l.lights;$=Z=0;if(z=h.length>0){L.setRGB(0,0,0);H.setRGB(0,0,0);I.setRGB(0,0,0);p=0;for(K=h.length;p<K;p++)T=h[p],P=T.color,T instanceof THREE.AmbientLight?(L.r+=P.r,L.g+=P.g,L.b+=P.b):T instanceof THREE.DirectionalLight?(H.r+=P.r,H.g+=P.g,H.b+=P.b):T instanceof THREE.PointLight&&(I.r+=P.r,I.g+=P.g,I.b+=P.b)}p=0;for(K=f.length;p<K;p++)if(P=f[p],T=P.material,T=T instanceof THREE.MeshFaceMaterial?P.faceMaterial:T,!(T==null||T.opacity==0))if(D.empty(),P instanceof THREE.RenderableParticle)u=P,u.x*=
-v,u.y*=-x,m=0,ml=P.materials.length;else if(P instanceof THREE.RenderableLine){if(u=P.v1,y=P.v2,u.positionScreen.x*=v,u.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,D.addPoint(u.positionScreen.x,u.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),B.intersects(D)){P=u;var N=y,ea=$++;M[ea]==null&&(M[ea]=document.createElementNS("http://www.w3.org/2000/svg","line"),U==0&&M[ea].setAttribute("shape-rendering","crispEdges"));G=M[ea];G.setAttribute("x1",P.positionScreen.x);
-G.setAttribute("y1",P.positionScreen.y);G.setAttribute("x2",N.positionScreen.x);G.setAttribute("y2",N.positionScreen.y);T instanceof THREE.LineBasicMaterial&&(G.setAttribute("style","fill: none; stroke: "+T.color.getContextStyle()+"; stroke-width: "+T.linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.linecap+"; stroke-linejoin: "+T.linejoin),n.appendChild(G))}}else if(P instanceof THREE.RenderableFace3){if(u=P.v1,y=P.v2,w=P.v3,u.positionScreen.x*=v,u.positionScreen.y*=-x,y.positionScreen.x*=
-v,y.positionScreen.y*=-x,w.positionScreen.x*=v,w.positionScreen.y*=-x,D.addPoint(u.positionScreen.x,u.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(w.positionScreen.x,w.positionScreen.y),B.intersects(D)){var N=u,ea=y,aa=w;e.info.render.vertices+=3;e.info.render.faces++;G=c(Z++);G.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+"z");T instanceof THREE.MeshBasicMaterial?
-C.copy(T.color):T instanceof THREE.MeshLambertMaterial?z?(C.r=L.r,C.g=L.g,C.b=L.b,a(h,P.centroidWorld,P.normalWorld,C),C.r=Math.max(0,Math.min(T.color.r*C.r,1)),C.g=Math.max(0,Math.min(T.color.g*C.g,1)),C.b=Math.max(0,Math.min(T.color.b*C.b,1))):C.copy(T.color):T instanceof THREE.MeshDepthMaterial?(R=1-T.__2near/(T.__farPlusNear-P.z*T.__farMinusNear),C.setRGB(R,R,R)):T instanceof THREE.MeshNormalMaterial&&C.setRGB(b(P.normalWorld.x),b(P.normalWorld.y),b(P.normalWorld.z));T.wireframe?G.setAttribute("style",
-"fill: none; stroke: "+C.getContextStyle()+"; stroke-width: "+T.wireframeLinewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.wireframeLinecap+"; stroke-linejoin: "+T.wireframeLinejoin):G.setAttribute("style","fill: "+C.getContextStyle()+"; fill-opacity: "+T.opacity);n.appendChild(G)}}else if(P instanceof THREE.RenderableFace4&&(u=P.v1,y=P.v2,w=P.v3,A=P.v4,u.positionScreen.x*=v,u.positionScreen.y*=-x,y.positionScreen.x*=v,y.positionScreen.y*=-x,w.positionScreen.x*=v,w.positionScreen.y*=
--x,A.positionScreen.x*=v,A.positionScreen.y*=-x,D.addPoint(u.positionScreen.x,u.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(w.positionScreen.x,w.positionScreen.y),D.addPoint(A.positionScreen.x,A.positionScreen.y),B.intersects(D))){var N=u,ea=y,aa=w,na=A;e.info.render.vertices+=4;e.info.render.faces++;G=c(Z++);G.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+ea.positionScreen.x+" "+ea.positionScreen.y+" L "+aa.positionScreen.x+","+aa.positionScreen.y+
-" L "+na.positionScreen.x+","+na.positionScreen.y+"z");T instanceof THREE.MeshBasicMaterial?C.copy(T.color):T instanceof THREE.MeshLambertMaterial?z?(C.r=L.r,C.g=L.g,C.b=L.b,a(h,P.centroidWorld,P.normalWorld,C),C.r=Math.max(0,Math.min(T.color.r*C.r,1)),C.g=Math.max(0,Math.min(T.color.g*C.g,1)),C.b=Math.max(0,Math.min(T.color.b*C.b,1))):C.copy(T.color):T instanceof THREE.MeshDepthMaterial?(R=1-T.__2near/(T.__farPlusNear-P.z*T.__farMinusNear),C.setRGB(R,R,R)):T instanceof THREE.MeshNormalMaterial&&
-C.setRGB(b(P.normalWorld.x),b(P.normalWorld.y),b(P.normalWorld.z));T.wireframe?G.setAttribute("style","fill: none; stroke: "+C.getContextStyle()+"; stroke-width: "+T.wireframeLinewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.wireframeLinecap+"; stroke-linejoin: "+T.wireframeLinejoin):G.setAttribute("style","fill: "+C.getContextStyle()+"; fill-opacity: "+T.opacity);n.appendChild(G)}}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,l,f;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;f=e/2};this.render=function(b,e){var n,p,t,u,y,v,x,w;a=c.projectScene(b,e);n=0;for(p=a.length;n<p;n++)if(y=a[n],y instanceof THREE.RenderableParticle){x=y.x*l+l;w=y.y*f+f;t=0;for(u=y.material.length;t<u;t++)if(v=y.material[t],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=x+"px",v.style.top=w+"px"}}};
+THREE.CanvasRenderer=function(a){function c(a){if(C!=a)w.globalAlpha=C=a}function b(a){if(A!=a){switch(a){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}A=a}}function e(a){if(D!=a)w.strokeStyle=D=a}function l(a){if(K!=a)w.fillStyle=K=a}var f=this,h,k,n,p=new THREE.Projector,a=a||{},t=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+u,y,v,x,w=t.getContext("2d"),z=new THREE.Color(0),B=0,C=1,A=0,D=null,K=null,P=null,F=null,Q=null,H,N,L,G,V=new THREE.RenderableVertex,ca=new THREE.RenderableVertex,W,T,o,Z,ha,M,R,X,la,$,ma,na,ea=new THREE.Color,ka=new THREE.Color,fa=new THREE.Color,ia=new THREE.Color,ga=new THREE.Color,da=[],ta,ua,qa,sa,Da,va,Ea,Ca,Ga,aa,ja=new THREE.Rectangle,Y=new THREE.Rectangle,J=new THREE.Rectangle,O=!1,ra=new THREE.Color,xa=new THREE.Color,oa=new THREE.Color,pa=new THREE.Vector3,ya,za,Fa,Ba,Ha,U,a=16;ya=document.createElement("canvas");
+ya.width=ya.height=2;za=ya.getContext("2d");za.fillStyle="rgba(0,0,0,1)";za.fillRect(0,0,2,2);Fa=za.getImageData(0,0,2,2);Ba=Fa.data;Ha=document.createElement("canvas");Ha.width=Ha.height=a;U=Ha.getContext("2d");U.translate(-a/2,-a/2);U.scale(a,a);a--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){u=a;y=b;v=Math.floor(u/2);x=Math.floor(y/2);t.width=u;t.height=y;ja.set(-v,-x,v,x);Y.set(-v,-x,v,x);C=1;A=0;Q=F=
+P=K=D=null};this.setClearColor=function(a,b){z.copy(a);B=b;Y.set(-v,-x,v,x)};this.setClearColorHex=function(a,b){z.setHex(a);B=b;Y.set(-v,-x,v,x)};this.clear=function(){w.setTransform(1,0,0,-1,v,x);Y.isEmpty()||(Y.minSelf(ja),Y.inflate(2),B<1&&w.clearRect(Math.floor(Y.getX()),Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight())),B>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+B+")"),w.fillRect(Math.floor(Y.getX()),
+Math.floor(Y.getY()),Math.floor(Y.getWidth()),Math.floor(Y.getHeight()))),Y.empty())};this.render=function(a,t){function u(a){var b,c,e,f;ra.setRGB(0,0,0);xa.setRGB(0,0,0);oa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(ra.r+=f.r,ra.g+=f.g,ra.b+=f.b):e instanceof THREE.DirectionalLight?(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b):e instanceof THREE.PointLight&&(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b)}function y(a,b,c,e){var f,l,h,k,o,n;f=0;for(l=a.length;f<l;f++)h=a[f],k=h.color,
+h instanceof THREE.DirectionalLight?(o=h.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=h.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)):h instanceof THREE.PointLight&&(o=h.matrixWorld.getPosition(),n=c.dot(pa.sub(o,b).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(b.distanceTo(o)/h.distance,1),n!=0&&(n*=h.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)))}function z(a,f,h){c(h.opacity);b(h.blending);var k,o,n,p,t,wa;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)p=h.map.image,t=p.width>>1,wa=
+p.height>>1,h=f.scale.x*v,n=f.scale.y*x,k=h*t,o=n*wa,J.set(a.x-k,a.y-o,a.x+k,a.y+o),ja.intersects(J)&&(w.save(),w.translate(a.x,a.y),w.rotate(-f.rotation),w.scale(h,-n),w.translate(-t,-wa),w.drawImage(p,0,0),w.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=f.scale.x*v,o=f.scale.y*x,J.set(a.x-k,a.y-o,a.x+k,a.y+o),ja.intersects(J)&&(e(h.color.getContextStyle()),l(h.color.getContextStyle()),w.save(),w.translate(a.x,a.y),w.rotate(-f.rotation),w.scale(k,o),h.program(w),w.restore()))}function B(a,
+f,l,h){c(h.opacity);b(h.blending);w.beginPath();w.moveTo(a.positionScreen.x,a.positionScreen.y);w.lineTo(f.positionScreen.x,f.positionScreen.y);w.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(P!=a)w.lineWidth=P=a;a=h.linecap;if(F!=a)w.lineCap=F=a;a=h.linejoin;if(Q!=a)w.lineJoin=Q=a;e(h.color.getContextStyle());w.stroke();J.inflate(h.linewidth*2)}}function A(a,e,h,l,k,p,v,u){f.info.render.vertices+=3;f.info.render.faces++;c(u.opacity);b(u.blending);W=a.positionScreen.x;T=a.positionScreen.y;
+o=e.positionScreen.x;Z=e.positionScreen.y;ha=h.positionScreen.x;M=h.positionScreen.y;Ua(W,T,o,Z,ha,M);if(u instanceof THREE.MeshBasicMaterial)if(u.map)u.map.mapping instanceof THREE.UVMapping&&(sa=v.uvs[0],Ya(W,T,o,Z,ha,M,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[p].u,sa[p].v,u.map));else if(u.envMap){if(u.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=t.matrixWorldInverse,pa.copy(v.vertexNormalsWorld[l]),Da=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,va=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*
+0.5+0.5,pa.copy(v.vertexNormalsWorld[k]),Ea=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,Ca=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,pa.copy(v.vertexNormalsWorld[p]),Ga=(pa.x*a.n11+pa.y*a.n12+pa.z*a.n13)*0.5+0.5,aa=-(pa.x*a.n21+pa.y*a.n22+pa.z*a.n23)*0.5+0.5,Ya(W,T,o,Z,ha,M,Da,va,Ea,Ca,Ga,aa,u.envMap)}else u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(u.color);else if(u instanceof THREE.MeshLambertMaterial)u.map&&!u.wireframe&&(u.map.mapping instanceof THREE.UVMapping&&
+(sa=v.uvs[0],Ya(W,T,o,Z,ha,M,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[p].u,sa[p].v,u.map)),b(THREE.SubtractiveBlending)),O?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==3?(ka.r=fa.r=ia.r=ra.r,ka.g=fa.g=ia.g=ra.g,ka.b=fa.b=ia.b=ra.b,y(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ka),y(n,v.v2.positionWorld,v.vertexNormalsWorld[1],fa),y(n,v.v3.positionWorld,v.vertexNormalsWorld[2],ia),ka.r=Math.max(0,Math.min(u.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(u.color.g*ka.g,1)),ka.b=
+Math.max(0,Math.min(u.color.b*ka.b,1)),fa.r=Math.max(0,Math.min(u.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),ga.r=(fa.r+ia.r)*0.5,ga.g=(fa.g+ia.g)*0.5,ga.b=(fa.b+ia.b)*0.5,qa=Va(ka,fa,ia,ga),Sa(W,T,o,Z,ha,M,0,0,1,0,0,1,qa)):(ea.r=ra.r,ea.g=ra.g,ea.b=ra.b,y(n,v.centroidWorld,v.normalWorld,ea),ea.r=Math.max(0,
+Math.min(u.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(u.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(u.color.b*ea.b,1)),u.wireframe?D(ea,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(ea)):u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(u.color);else if(u instanceof THREE.MeshDepthMaterial)ta=t.near,ua=t.far,ka.r=ka.g=ka.b=1-Ma(a.positionScreen.z,ta,ua),fa.r=fa.g=fa.b=1-Ma(e.positionScreen.z,ta,ua),ia.r=ia.g=ia.b=1-Ma(h.positionScreen.z,ta,ua),ga.r=
+(fa.r+ia.r)*0.5,ga.g=(fa.g+ia.g)*0.5,ga.b=(fa.b+ia.b)*0.5,qa=Va(ka,fa,ia,ga),Sa(W,T,o,Z,ha,M,0,0,1,0,0,1,qa);else if(u instanceof THREE.MeshNormalMaterial)ea.r=Ta(v.normalWorld.x),ea.g=Ta(v.normalWorld.y),ea.b=Ta(v.normalWorld.z),u.wireframe?D(ea,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(ea)}function C(a,e,h,l,k,p,v,u,w){f.info.render.vertices+=4;f.info.render.faces++;c(u.opacity);b(u.blending);if(u.map||u.envMap)A(a,e,l,0,1,3,v,u,w),A(k,h,p,1,2,3,v,u,w);else if(W=a.positionScreen.x,
+T=a.positionScreen.y,o=e.positionScreen.x,Z=e.positionScreen.y,ha=h.positionScreen.x,M=h.positionScreen.y,R=l.positionScreen.x,X=l.positionScreen.y,la=k.positionScreen.x,$=k.positionScreen.y,ma=p.positionScreen.x,na=p.positionScreen.y,u instanceof THREE.MeshBasicMaterial)Wa(W,T,o,Z,ha,M,R,X),u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(u.color);else if(u instanceof THREE.MeshLambertMaterial)O?!u.wireframe&&u.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
+4?(ka.r=fa.r=ia.r=ga.r=ra.r,ka.g=fa.g=ia.g=ga.g=ra.g,ka.b=fa.b=ia.b=ga.b=ra.b,y(n,v.v1.positionWorld,v.vertexNormalsWorld[0],ka),y(n,v.v2.positionWorld,v.vertexNormalsWorld[1],fa),y(n,v.v4.positionWorld,v.vertexNormalsWorld[3],ia),y(n,v.v3.positionWorld,v.vertexNormalsWorld[2],ga),ka.r=Math.max(0,Math.min(u.color.r*ka.r,1)),ka.g=Math.max(0,Math.min(u.color.g*ka.g,1)),ka.b=Math.max(0,Math.min(u.color.b*ka.b,1)),fa.r=Math.max(0,Math.min(u.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(u.color.g*fa.g,1)),
+fa.b=Math.max(0,Math.min(u.color.b*fa.b,1)),ia.r=Math.max(0,Math.min(u.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(u.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(u.color.b*ia.b,1)),ga.r=Math.max(0,Math.min(u.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(u.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(u.color.b*ga.b,1)),qa=Va(ka,fa,ia,ga),Ua(W,T,o,Z,R,X),Sa(W,T,o,Z,R,X,0,0,1,0,0,1,qa),Ua(la,$,ha,M,ma,na),Sa(la,$,ha,M,ma,na,1,0,1,1,0,1,qa)):(ea.r=ra.r,ea.g=ra.g,ea.b=ra.b,y(n,v.centroidWorld,v.normalWorld,ea),ea.r=
+Math.max(0,Math.min(u.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(u.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(u.color.b*ea.b,1)),Wa(W,T,o,Z,ha,M,R,X),u.wireframe?D(ea,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(ea)):(Wa(W,T,o,Z,ha,M,R,X),u.wireframe?D(u.color,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(u.color));else if(u instanceof THREE.MeshNormalMaterial)ea.r=Ta(v.normalWorld.x),ea.g=Ta(v.normalWorld.y),ea.b=Ta(v.normalWorld.z),Wa(W,T,o,Z,ha,M,R,X),u.wireframe?
+D(ea,u.wireframeLinewidth,u.wireframeLinecap,u.wireframeLinejoin):K(ea);else if(u instanceof THREE.MeshDepthMaterial)ta=t.near,ua=t.far,ka.r=ka.g=ka.b=1-Ma(a.positionScreen.z,ta,ua),fa.r=fa.g=fa.b=1-Ma(e.positionScreen.z,ta,ua),ia.r=ia.g=ia.b=1-Ma(l.positionScreen.z,ta,ua),ga.r=ga.g=ga.b=1-Ma(h.positionScreen.z,ta,ua),qa=Va(ka,fa,ia,ga),Ua(W,T,o,Z,R,X),Sa(W,T,o,Z,R,X,0,0,1,0,0,1,qa),Ua(la,$,ha,M,ma,na),Sa(la,$,ha,M,ma,na,1,0,1,1,0,1,qa)}function Ua(a,b,c,e,f,h){w.beginPath();w.moveTo(a,b);w.lineTo(c,
+e);w.lineTo(f,h);w.lineTo(a,b);w.closePath()}function Wa(a,b,c,e,f,h,l,k){w.beginPath();w.moveTo(a,b);w.lineTo(c,e);w.lineTo(f,h);w.lineTo(l,k);w.lineTo(a,b);w.closePath()}function D(a,b,c,f){if(P!=b)w.lineWidth=P=b;if(F!=c)w.lineCap=F=c;if(Q!=f)w.lineJoin=Q=f;e(a.getContextStyle());w.stroke();J.inflate(b*2)}function K(a){l(a.getContextStyle());w.fill()}function Ya(a,b,c,e,f,h,k,o,n,u,p,v,t){if(t.image.width!=0){if(t.needsUpdate==!0||da[t.id]==void 0){var wa=t.wrapS==THREE.RepeatWrapping,y=t.wrapT==
+THREE.RepeatWrapping;da[t.id]=w.createPattern(t.image,wa&&y?"repeat":wa&&!y?"repeat-x":!wa&&y?"repeat-y":"no-repeat");t.needsUpdate=!1}l(da[t.id]);var wa=t.offset.x/t.repeat.x,y=t.offset.y/t.repeat.y,aa=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,k=(k+wa)*aa,o=(o+y)*t,n=(n+wa)*aa,u=(u+y)*t,p=(p+wa)*aa,v=(v+y)*t;c-=a;e-=b;f-=a;h-=b;n-=k;u-=o;p-=k;v-=o;wa=1/(n*v-p*u);t=(v*c-u*f)*wa;u=(v*e-u*h)*wa;c=(n*f-p*c)*wa;e=(n*h-p*e)*wa;a=a-t*k-c*o;b=b-u*k-e*o;w.save();w.transform(t,u,c,e,a,b);
+w.fill();w.restore()}}function Sa(a,b,c,e,f,h,l,k,o,n,u,p,v){var t,wa;t=v.width-1;wa=v.height-1;l*=t;k*=wa;o*=t;n*=wa;u*=t;p*=wa;c-=a;e-=b;f-=a;h-=b;o-=l;n-=k;u-=l;p-=k;wa=1/(o*p-u*n);t=(p*c-n*f)*wa;n=(p*e-n*h)*wa;c=(o*f-u*c)*wa;e=(o*h-u*e)*wa;a=a-t*l-c*k;b=b-n*l-e*k;w.save();w.transform(t,n,c,e,a,b);w.clip();w.drawImage(v,0,0);w.restore()}function Va(a,b,c,e){var f=~~(a.r*255),h=~~(a.g*255),a=~~(a.b*255),l=~~(b.r*255),k=~~(b.g*255),b=~~(b.b*255),o=~~(c.r*255),n=~~(c.g*255),c=~~(c.b*255),u=~~(e.r*
+255),p=~~(e.g*255),e=~~(e.b*255);Ba[0]=f<0?0:f>255?255:f;Ba[1]=h<0?0:h>255?255:h;Ba[2]=a<0?0:a>255?255:a;Ba[4]=l<0?0:l>255?255:l;Ba[5]=k<0?0:k>255?255:k;Ba[6]=b<0?0:b>255?255:b;Ba[8]=o<0?0:o>255?255:o;Ba[9]=n<0?0:n>255?255:n;Ba[10]=c<0?0:c>255?255:c;Ba[12]=u<0?0:u>255?255:u;Ba[13]=p<0?0:p>255?255:p;Ba[14]=e<0?0:e>255?255:e;za.putImageData(Fa,0,0);U.drawImage(ya,0,0);return Ha}function Ma(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ta(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function La(a,b){var c=
+b.x-a.x,e=b.y-a.y,f=c*c+e*e;f!=0&&(f=1/Math.sqrt(f),c*=f,e*=f,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Xa,Za,Aa,Ia;this.autoClear?this.clear():w.setTransform(1,0,0,-1,v,x);f.info.render.vertices=0;f.info.render.faces=0;h=p.projectScene(a,t,this.sortElements);k=h.elements;n=h.lights;(O=n.length>0)&&u(n);Xa=0;for(Za=k.length;Xa<Za;Xa++)if(Aa=k[Xa],Ia=Aa.material,Ia=Ia instanceof THREE.MeshFaceMaterial?Aa.faceMaterial:Ia,!(Ia==null||Ia.opacity==0)){J.empty();if(Aa instanceof THREE.RenderableParticle)H=Aa,H.x*=
+v,H.y*=x,z(H,Aa,Ia,a);else if(Aa instanceof THREE.RenderableLine)H=Aa.v1,N=Aa.v2,H.positionScreen.x*=v,H.positionScreen.y*=x,N.positionScreen.x*=v,N.positionScreen.y*=x,J.addPoint(H.positionScreen.x,H.positionScreen.y),J.addPoint(N.positionScreen.x,N.positionScreen.y),ja.intersects(J)&&B(H,N,Aa,Ia,a);else if(Aa instanceof THREE.RenderableFace3)H=Aa.v1,N=Aa.v2,L=Aa.v3,H.positionScreen.x*=v,H.positionScreen.y*=x,N.positionScreen.x*=v,N.positionScreen.y*=x,L.positionScreen.x*=v,L.positionScreen.y*=x,
+Ia.overdraw&&(La(H.positionScreen,N.positionScreen),La(N.positionScreen,L.positionScreen),La(L.positionScreen,H.positionScreen)),J.add3Points(H.positionScreen.x,H.positionScreen.y,N.positionScreen.x,N.positionScreen.y,L.positionScreen.x,L.positionScreen.y),ja.intersects(J)&&A(H,N,L,0,1,2,Aa,Ia,a);else if(Aa instanceof THREE.RenderableFace4)H=Aa.v1,N=Aa.v2,L=Aa.v3,G=Aa.v4,H.positionScreen.x*=v,H.positionScreen.y*=x,N.positionScreen.x*=v,N.positionScreen.y*=x,L.positionScreen.x*=v,L.positionScreen.y*=
+x,G.positionScreen.x*=v,G.positionScreen.y*=x,V.positionScreen.copy(N.positionScreen),ca.positionScreen.copy(G.positionScreen),Ia.overdraw&&(La(H.positionScreen,N.positionScreen),La(N.positionScreen,G.positionScreen),La(G.positionScreen,H.positionScreen),La(L.positionScreen,V.positionScreen),La(L.positionScreen,ca.positionScreen)),J.addPoint(H.positionScreen.x,H.positionScreen.y),J.addPoint(N.positionScreen.x,N.positionScreen.y),J.addPoint(L.positionScreen.x,L.positionScreen.y),J.addPoint(G.positionScreen.x,
+G.positionScreen.y),ja.intersects(J)&&C(H,N,L,G,V,ca,Aa,Ia,a);Y.addRectangle(J)}w.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,e){var f,h,l,k,n,u;f=0;for(h=a.length;f<h;f++)l=a[f],k=l.color,l instanceof THREE.DirectionalLight?(n=l.matrixWorld.getPosition(),u=c.dot(n),u<=0||(u*=l.intensity,e.r+=k.r*u,e.g+=k.g*u,e.b+=k.b*u)):l instanceof THREE.PointLight&&(n=l.matrixWorld.getPosition(),u=c.dot(H.sub(n,b).normalize()),u<=0||(u*=l.distance==0?1:1-Math.min(b.distanceTo(n)/l.distance,1),u!=0&&(u*=l.intensity,e.r+=k.r*u,e.g+=k.g*u,e.b+=k.b*u)))}function c(a){N[a]==null&&(N[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),W==0&&N[a].setAttribute("shape-rendering","crispEdges"));return N[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var e=this,l,f,h,k=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),p,t,u,y,v,x,w,z,B=new THREE.Rectangle,C=new THREE.Rectangle,A=!1,D=new THREE.Color,K=new THREE.Color,P=new THREE.Color,F=new THREE.Color,Q,H=new THREE.Vector3,N=[],L=[],G,V,ca,W=1;this.domElement=n;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
+faces:0}};this.setQuality=function(a){switch(a){case "high":W=1;break;case "low":W=0}};this.setSize=function(a,b){p=a;t=b;u=p/2;y=t/2;n.setAttribute("viewBox",-u+" "+-y+" "+p+" "+t);n.setAttribute("width",p);n.setAttribute("height",t);B.set(-u,-y,u,y)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(p,o){var t,H,M,R;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(p,o,this.sortElements);f=l.elements;
+h=l.lights;ca=V=0;if(A=h.length>0){K.setRGB(0,0,0);P.setRGB(0,0,0);F.setRGB(0,0,0);t=0;for(H=h.length;t<H;t++)R=h[t],M=R.color,R instanceof THREE.AmbientLight?(K.r+=M.r,K.g+=M.g,K.b+=M.b):R instanceof THREE.DirectionalLight?(P.r+=M.r,P.g+=M.g,P.b+=M.b):R instanceof THREE.PointLight&&(F.r+=M.r,F.g+=M.g,F.b+=M.b)}t=0;for(H=f.length;t<H;t++)if(M=f[t],R=M.material,R=R instanceof THREE.MeshFaceMaterial?M.faceMaterial:R,!(R==null||R.opacity==0))if(C.empty(),M instanceof THREE.RenderableParticle)v=M,v.x*=
+u,v.y*=-y,m=0,ml=M.materials.length;else if(M instanceof THREE.RenderableLine){if(v=M.v1,x=M.v2,v.positionScreen.x*=u,v.positionScreen.y*=-y,x.positionScreen.x*=u,x.positionScreen.y*=-y,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(x.positionScreen.x,x.positionScreen.y),B.intersects(C)){M=v;var N=x,la=ca++;L[la]==null&&(L[la]=document.createElementNS("http://www.w3.org/2000/svg","line"),W==0&&L[la].setAttribute("shape-rendering","crispEdges"));G=L[la];G.setAttribute("x1",M.positionScreen.x);
+G.setAttribute("y1",M.positionScreen.y);G.setAttribute("x2",N.positionScreen.x);G.setAttribute("y2",N.positionScreen.y);R instanceof THREE.LineBasicMaterial&&(G.setAttribute("style","fill: none; stroke: "+R.color.getContextStyle()+"; stroke-width: "+R.linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.linecap+"; stroke-linejoin: "+R.linejoin),n.appendChild(G))}}else if(M instanceof THREE.RenderableFace3){if(v=M.v1,x=M.v2,w=M.v3,v.positionScreen.x*=u,v.positionScreen.y*=-y,x.positionScreen.x*=
+u,x.positionScreen.y*=-y,w.positionScreen.x*=u,w.positionScreen.y*=-y,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(w.positionScreen.x,w.positionScreen.y),B.intersects(C)){var N=v,la=x,$=w;e.info.render.vertices+=3;e.info.render.faces++;G=c(V++);G.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+la.positionScreen.x+" "+la.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+"z");R instanceof THREE.MeshBasicMaterial?
+D.copy(R.color):R instanceof THREE.MeshLambertMaterial?A?(D.r=K.r,D.g=K.g,D.b=K.b,a(h,M.centroidWorld,M.normalWorld,D),D.r=Math.max(0,Math.min(R.color.r*D.r,1)),D.g=Math.max(0,Math.min(R.color.g*D.g,1)),D.b=Math.max(0,Math.min(R.color.b*D.b,1))):D.copy(R.color):R instanceof THREE.MeshDepthMaterial?(Q=1-R.__2near/(R.__farPlusNear-M.z*R.__farMinusNear),D.setRGB(Q,Q,Q)):R instanceof THREE.MeshNormalMaterial&&D.setRGB(b(M.normalWorld.x),b(M.normalWorld.y),b(M.normalWorld.z));R.wireframe?G.setAttribute("style",
+"fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+R.wireframeLinewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframeLinecap+"; stroke-linejoin: "+R.wireframeLinejoin):G.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+R.opacity);n.appendChild(G)}}else if(M instanceof THREE.RenderableFace4&&(v=M.v1,x=M.v2,w=M.v3,z=M.v4,v.positionScreen.x*=u,v.positionScreen.y*=-y,x.positionScreen.x*=u,x.positionScreen.y*=-y,w.positionScreen.x*=u,w.positionScreen.y*=
+-y,z.positionScreen.x*=u,z.positionScreen.y*=-y,C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(x.positionScreen.x,x.positionScreen.y),C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(z.positionScreen.x,z.positionScreen.y),B.intersects(C))){var N=v,la=x,$=w,ma=z;e.info.render.vertices+=4;e.info.render.faces++;G=c(V++);G.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+la.positionScreen.x+" "+la.positionScreen.y+" L "+$.positionScreen.x+","+$.positionScreen.y+
+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");R instanceof THREE.MeshBasicMaterial?D.copy(R.color):R instanceof THREE.MeshLambertMaterial?A?(D.r=K.r,D.g=K.g,D.b=K.b,a(h,M.centroidWorld,M.normalWorld,D),D.r=Math.max(0,Math.min(R.color.r*D.r,1)),D.g=Math.max(0,Math.min(R.color.g*D.g,1)),D.b=Math.max(0,Math.min(R.color.b*D.b,1))):D.copy(R.color):R instanceof THREE.MeshDepthMaterial?(Q=1-R.__2near/(R.__farPlusNear-M.z*R.__farMinusNear),D.setRGB(Q,Q,Q)):R instanceof THREE.MeshNormalMaterial&&
+D.setRGB(b(M.normalWorld.x),b(M.normalWorld.y),b(M.normalWorld.z));R.wireframe?G.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+R.wireframeLinewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframeLinecap+"; stroke-linejoin: "+R.wireframeLinejoin):G.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+R.opacity);n.appendChild(G)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",
 envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
@@ -224,123 +224,124 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function b(a,b,c){var e,h,f,l=a.vertices,k=l.length,n=a.colors,t=n.length,u=a.__vertexArray,p=a.__colorArray,v=a.__sortArray,w=a.__dirtyVertices,x=a.__dirtyColors,E=a.__webglCustomAttributesList,y;if(E){f=0;for(e=E.length;f<e;f++)E[f].offset=0}if(c.sortParticles){ua.multiplySelf(c.matrixWorld);for(e=
-0;e<k;e++)h=l[e].position,Ba.copy(h),ua.multiplyVector3(Ba),v[e]=[Ba.z,e];v.sort(function(a,b){return b[0]-a[0]});for(e=0;e<k;e++)h=l[v[e][1]].position,f=e*3,u[f]=h.x,u[f+1]=h.y,u[f+2]=h.z;for(e=0;e<t;e++)f=e*3,color=n[v[e][1]],p[f]=color.r,p[f+1]=color.g,p[f+2]=color.b;if(E){f=0;for(e=E.length;f<e;f++){k=E[f];t=k.value.length;for(n=0;n<t;n++){index=v[n][1];l=k.offset;if(k.size===1){if(k.boundTo===void 0||k.boundTo==="vertices")k.array[l]=k.value[index]}else{if(k.boundTo===void 0||k.boundTo==="vertices")y=
-k.value[index];k.size===2?(k.array[l]=y.x,k.array[l+1]=y.y):k.size===3?k.type==="c"?(k.array[l]=y.r,k.array[l+1]=y.g,k.array[l+2]=y.b):(k.array[l]=y.x,k.array[l+1]=y.y,k.array[l+2]=y.z):(k.array[l]=y.x,k.array[l+1]=y.y,k.array[l+2]=y.z,k.array[l+3]=y.w)}k.offset+=k.size}}}}else{if(w)for(e=0;e<k;e++)h=l[e].position,f=e*3,u[f]=h.x,u[f+1]=h.y,u[f+2]=h.z;if(x)for(e=0;e<t;e++)color=n[e],f=e*3,p[f]=color.r,p[f+1]=color.g,p[f+2]=color.b;if(E){f=0;for(e=E.length;f<e;f++)if(k=E[f],k.__original.needsUpdate){t=
-k.value.length;for(n=0;n<t;n++){l=k.offset;if(k.size===1){if(k.boundTo===void 0||k.boundTo==="vertices")k.array[l]=k.value[n]}else{if(k.boundTo===void 0||k.boundTo==="vertices")y=k.value[n];k.size===2?(k.array[l]=y.x,k.array[l+1]=y.y):k.size===3?k.type==="c"?(k.array[l]=y.r,k.array[l+1]=y.g,k.array[l+2]=y.b):(k.array[l]=y.x,k.array[l+1]=y.y,k.array[l+2]=y.z):(k.array[l]=y.x,k.array[l+1]=y.y,k.array[l+2]=y.z,k.array[l+3]=y.w)}k.offset+=k.size}}}}if(w||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),
-o.bufferData(o.ARRAY_BUFFER,u,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,p,b);if(E){f=0;for(e=E.length;f<e;f++)if(k=E[f],k.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,k.buffer),o.bufferData(o.ARRAY_BUFFER,k.array,b)}}function e(a,b,c,e,h){e.program||U.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(U.maxMorphTargets);for(var f=0,l=U.maxMorphTargets;f<
-l;f++)h.__webglMorphTargetInfluences[f]=0}var k=!1,f=e.program,l=f.uniforms,n=e.uniforms;f!==Y&&(o.useProgram(f),Y=f,k=!0);if(e.id!==P)P=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,xa);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var t,u,p=0,v=0,w=0,x,E,y,A=Ea,ia=A.directional.colors,
-B=A.directional.positions,z=A.point.colors,V=A.point.positions,D=A.point.distances,C=0,X=0,c=t=y=0,k=b.length;c<k;c++)if(t=b[c],u=t.color,x=t.position,E=t.intensity,y=t.distance,t instanceof THREE.AmbientLight)U.gammaInput?(p+=u.r*u.r,v+=u.g*u.g,w+=u.b*u.b):(p+=u.r,v+=u.g,w+=u.b);else if(t instanceof THREE.DirectionalLight)y=C*3,U.gammaInput?(ia[y]=u.r*u.r*E*E,ia[y+1]=u.g*u.g*E*E,ia[y+2]=u.b*u.b*E*E):(ia[y]=u.r*E,ia[y+1]=u.g*E,ia[y+2]=u.b*E),B[y]=x.x,B[y+1]=x.y,B[y+2]=x.z,C+=1;else if(t instanceof
-THREE.SpotLight)y=C*3,U.gammaInput?(ia[y]=u.r*u.r*E*E,ia[y+1]=u.g*u.g*E*E,ia[y+2]=u.b*u.b*E*E):(ia[y]=u.r*E,ia[y+1]=u.g*E,ia[y+2]=u.b*E),u=1/x.length(),B[y]=x.x*u,B[y+1]=x.y*u,B[y+2]=x.z*u,C+=1;else if(t instanceof THREE.PointLight)t=X*3,U.gammaInput?(z[t]=u.r*u.r*E*E,z[t+1]=u.g*u.g*E*E,z[t+2]=u.b*u.b*E*E):(z[t]=u.r*E,z[t+1]=u.g*E,z[t+2]=u.b*E),V[t]=x.x,V[t+1]=x.y,V[t+2]=x.z,D[X]=y,X+=1;c=C*3;for(k=ia.length;c<k;c++)ia[c]=0;c=X*3;for(k=z.length;c<k;c++)z[c]=0;A.point.length=X;A.directional.length=
-C;A.ambient[0]=p;A.ambient[1]=v;A.ambient[2]=w;b=Ea;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=
-e.opacity,U.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;
-if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=e.opacity,n.size.value=e.size,n.scale.value=Ca.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,U.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof
-THREE.MeshLambertMaterial)U.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<sa.length;b++)n.shadowMatrix.value[b]=sa[b],n.shadowMap.texture[b]=U.shadowMap[b];n.shadowDarkness.value=U.shadowMapDarkness;n.shadowBias.value=U.shadowMapBias}b=
-e.uniformsList;n=0;for(c=b.length;n<c;n++)if(v=f.uniforms[b[n][1]])if(p=b[n][0],w=p.type,k=p.value,w==="i")o.uniform1i(v,k);else if(w==="f")o.uniform1f(v,k);else if(w==="v2")o.uniform2f(v,k.x,k.y);else if(w==="v3")o.uniform3f(v,k.x,k.y,k.z);else if(w==="v4")o.uniform4f(v,k.x,k.y,k.z,k.w);else if(w==="c")o.uniform3f(v,k.r,k.g,k.b);else if(w==="fv1")o.uniform1fv(v,k);else if(w==="fv")o.uniform3fv(v,k);else if(w==="v3v"){if(!p._array)p._array=new Float32Array(3*k.length);w=0;for(x=k.length;w<x;w++)A=
-w*3,p._array[A]=k[w].x,p._array[A+1]=k[w].y,p._array[A+2]=k[w].z;o.uniform3fv(v,p._array)}else if(w==="m4"){if(!p._array)p._array=new Float32Array(16);k.flattenToArray(p._array);o.uniformMatrix4fv(v,!1,p._array)}else if(w==="m4v"){if(!p._array)p._array=new Float32Array(16*k.length);w=0;for(x=k.length;w<x;w++)k[w].flattenToArrayOffset(p._array,w*16);o.uniformMatrix4fv(v,!1,p._array)}else if(w==="t"){if(o.uniform1i(v,k),v=p.texture)if(v.image instanceof Array&&v.image.length===6){if(p=v,p.image.length===
-6)if(p.needsUpdate){if(!p.image.__webglTextureCube)p.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,p.image.__webglTextureCube);for(k=0;k<6;k++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,p.image[k]);I(o.TEXTURE_CUBE_MAP,p,p.image[0]);p.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,p.image.__webglTextureCube)}else v instanceof THREE.WebGLRenderTargetCube?(p=v,o.activeTexture(o.TEXTURE0+
-k),o.bindTexture(o.TEXTURE_CUBE_MAP,p.__webglTexture)):R(v,k)}else if(w==="tv"){if(!p._array){p._array=[];w=0;for(x=p.texture.length;w<x;w++)p._array[w]=k+w}o.uniform1iv(v,p._array);w=0;for(x=p.texture.length;w<x;w++)(v=p.texture[w])&&R(v,p._array[w])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&l.cameraPosition!==null&&o.uniform3f(l.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
-e instanceof THREE.ShaderMaterial||e.skinning)&&l.viewMatrix!==null&&o.uniformMatrix4fv(l.viewMatrix,!1,Da);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,Da),o.uniformMatrix4fv(l.boneGlobalMatrices,!1,h.boneMatrices))}o.uniformMatrix4fv(l.modelViewMatrix,!1,h._modelViewMatrixArray);l.normalMatrix&&o.uniformMatrix3fv(l.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&l.objectMatrix!==null&&o.uniformMatrix4fv(l.objectMatrix,
-!1,h._objectMatrixArray);return f}function l(a,b,c,h,l,f){if(h.opacity!==0){var k,n,c=e(a,b,c,h,f),a=c.attributes,b=!1,c=l.id*16777215+c.id*2+(h.wireframe?1:0);c!==T&&(T=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(f.morphTargetBase){c=h.program.attributes;f.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[f.morphTargetBase]),o.vertexAttribPointer(c.position,
-3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){k=0;var t=f.morphTargetForcedOrder;for(n=f.morphTargetInfluences;k<h.numSupportedMorphTargets&&k<t.length;)o.bindBuffer(o.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[t[k]]),o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[k]=n[t[k]],k++}else{var t=[],u=-1,p=0;n=f.morphTargetInfluences;var v,
-w=n.length;k=0;for(f.morphTargetBase!==-1&&(t[f.morphTargetBase]=!0);k<h.numSupportedMorphTargets;){for(v=0;v<w;v++)!t[v]&&n[v]>u&&(p=v,u=n[p]);o.bindBuffer(o.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[p]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[k]=u;t[p]=1;u=-1;k++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(b){if(l.__webglCustomAttributesList){k=0;for(n=
-l.__webglCustomAttributesList.length;k<n;k++)c=l.__webglCustomAttributesList[k],a[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
-l.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(l.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,l.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):o.disableVertexAttribArray(a.uv));a.uv2>=0&&(l.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,l.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>=
-0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,l.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(h.wireframe?
-(o.lineWidth(h.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer),o.drawElements(o.LINES,l.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer),o.drawElements(o.TRIANGLES,l.__webglFaceCount,o.UNSIGNED_SHORT,0)),U.info.render.calls++,U.info.render.vertices+=l.__webglFaceCount,U.info.render.faces+=l.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(f,
-0,l.__webglLineCount),U.info.render.calls++):f instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,l.__webglParticleCount),U.info.render.calls++):f instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,l.__webglVertexCount),U.info.render.calls++)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,
-o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,h,l,f,k,n,t,u,p,v,w=a.count*3;for(v=0;v<w;v+=9)c=a.normalArray,e=c[v],h=c[v+1],l=c[v+2],f=c[v+3],n=c[v+4],u=c[v+5],k=c[v+6],t=c[v+7],p=c[v+8],e=(e+f+k)/3,h=(h+n+t)/3,l=(l+u+p)/3,c[v]=e,c[v+1]=h,c[v+2]=l,c[v+3]=e,c[v+4]=h,c[v+5]=l,c[v+6]=e,c[v+7]=h,c[v+8]=l}o.bufferData(o.ARRAY_BUFFER,
-a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function h(a){if(ea!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ea=a.doubleSided;if(aa!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),aa=a.flipSided}function k(a){ga!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ga=a)}function n(a){ca!==a&&(o.depthMask(a),ca=a)}
-function t(a,b,c){la!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),la=a);if(a&&(fa!==b||ka!==c))o.polygonOffset(b,c),fa=b,ka=c}function p(a){ma[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ma[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ma[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ma[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ma[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ma[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+
-a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ma[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function v(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=ma[e].x*b.n14+ma[e].y*b.n24+ma[e].z*b.n34+ma[e].w,a<=c)return!1;return!0}function x(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function u(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=
-c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function y(a,b){return b.z-a.z}function w(a){var b,c,n,t=0,u,w,x,E,y=a.lights;wa||(wa=new THREE.PerspectiveCamera(U.shadowCameraFov,U.shadowMapWidth/U.shadowMapHeight,U.shadowCameraNear,U.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(n=y[b],n instanceof THREE.SpotLight&&n.castShadow){P=
--1;U.shadowMap[t]||(U.shadowMap[t]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));sa[t]||(sa[t]=new THREE.Matrix4);u=U.shadowMap[t];w=sa[t];wa.position.copy(n.position);wa.lookAt(n.target.position);wa.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(wa));this.autoUpdateScene&&a.updateMatrixWorld();wa.matrixWorldInverse.getInverse(wa.matrixWorld);w.set(0.5,0,0,0.5,0,0.5,
-0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf(wa.projectionMatrix);w.multiplySelf(wa.matrixWorldInverse);wa.matrixWorldInverse.flattenToArray(Da);wa.projectionMatrix.flattenToArray(xa);ua.multiply(wa.projectionMatrix,wa.matrixWorldInverse);p(ua);N(u);o.clearColor(1,1,1,1);U.clear();o.clearColor(X.r,X.g,X.b,va);w=a.__webglObjects.length;n=a.__webglObjectsImmediate.length;for(u=0;u<w;u++)x=a.__webglObjects[u],E=x.object,E.visible&&E.castShadow?!(E instanceof THREE.Mesh)||!E.frustumCulled||v(E)?(E.matrixWorld.flattenToArray(E._objectMatrixArray),
-B(E,wa,!1),x.render=!0):x.render=!1:x.render=!1;k(!0);H(THREE.NormalBlending);for(u=0;u<w;u++)if(x=a.__webglObjects[u],x.render)E=x.object,buffer=x.buffer,h(E),x=E.customDepthMaterial?E.customDepthMaterial:E.geometry.morphTargets.length?ya:Fa,l(wa,y,null,x,buffer,E);for(u=0;u<n;u++)x=a.__webglObjectsImmediate[u],E=x.object,E.visible&&E.castShadow&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),T=-1,B(E,wa,!1),h(E),program=e(wa,y,null,Fa,E),E.immediateRenderCallback?E.immediateRenderCallback(program,
-o,ma):E.render(function(a){f(a,program,Fa.shading)}));t++}}function A(a,b){var c,e,h;c=W.attributes;var l=W.uniforms,f=qa/ta,k,n=[],u=ta*0.5,t=qa*0.5,p=!0;o.useProgram(W.program);Y=W.program;T=ga=na=-1;Ia||(o.enableVertexAttribArray(W.attributes.position),o.enableVertexAttribArray(W.attributes.uv),Ia=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,
-8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.uniformMatrix4fv(l.projectionMatrix,!1,xa);o.activeTexture(o.TEXTURE0);o.uniform1i(l.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(h=a.__webglSprites[c],h.visible&&h.opacity!==0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);a.__webglSprites.sort(y);c=0;for(e=a.__webglSprites.length;c<e;c++)h=a.__webglSprites[c],h.visible&&
-h.opacity!==0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(l.useScreenCoordinates,1),o.uniform3f(l.screenPosition,(h.position.x-u)/u,(t-h.position.y)/t,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(l.useScreenCoordinates,0),o.uniform1i(l.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(l.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/(h.scaleByViewport?qa:1),n[0]=k*f*h.scale.x,n[1]=k*h.scale.y,o.uniform2f(l.uvScale,h.uvScale.x,
-h.uvScale.y),o.uniform2f(l.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(l.alignment,h.alignment.x,h.alignment.y),o.uniform1f(l.opacity,h.opacity),o.uniform3f(l.color,h.color.r,h.color.g,h.color.b),o.uniform1f(l.rotation,h.rotation),o.uniform2fv(l.scale,n),h.mergeWith3D&&!p?(o.enable(o.DEPTH_TEST),p=!0):!h.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),H(h.blending),R(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ca)}function B(a,
-b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function D(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function z(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function C(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function L(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
-function H(a){if(a!==na){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}na=a}}function I(a,b,c){(c.width&c.width-
-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,$(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,$(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,$(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,$(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Z(b.minFilter)))}function R(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
-!0,a.__webglTexture=o.createTexture(),U.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,$(a.format),a.image.width,a.image.height,0,$(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);I(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function K(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
-a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function N(a){var b=a instanceof THREE.WebGLRenderTargetCube;
-if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);I(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type),
-null);var e=a,h=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,h,e.__webglTexture,0);K(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),I(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,$(a.format),a.width,a.height,0,$(a.format),$(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,
-a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),K(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,h=e=0):(b=null,c=ta,a=qa,e=ha,h=O);b!==pa&&(o.bindFramebuffer(o.FRAMEBUFFER,
-b),o.viewport(e,h,c,a),pa=b)}function M(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function G(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,
-o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function Z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function $(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;
-case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;
-case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var U=this,o,da=[],Y=null,pa=null,P=-1,T=null,ja=0,ea=null,aa=null,na=null,ga=null,ca=null,la=null,fa=null,ka=null,ha=0,O=0,ta=0,qa=0,ma=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,xa=new Float32Array(16),
-Da=new Float32Array(16),Ba=new THREE.Vector4,Ea={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ca=a.canvas!==void 0?a.canvas:document.createElement("canvas"),E=a.stencil!==void 0?a.stencil:!0,V=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,ia=a.antialias!==void 0?a.antialias:!1,X=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),va=a.clearAlpha!==void 0?a.clearAlpha:0,ra=a.maxLights!==
-void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ca;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=
-5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var wa,sa=[],a=THREE.ShaderLib.depthRGBA,oa=THREE.UniformsUtils.clone(a.uniforms),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:oa}),ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:oa,morphTargets:!0});Fa._shadowPass=!0;ya._shadowPass=!0;try{if(!(o=Ca.getContext("experimental-webgl",
-{antialias:ia,stencil:E,preserveDrawingBuffer:V})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);
-o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(X.r,X.g,X.b,va);this.context=o;var Aa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,W={};W.vertices=new Float32Array(16);W.faces=new Uint16Array(6);E=0;W.vertices[E++]=-1;W.vertices[E++]=-1;W.vertices[E++]=0;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=-1;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=1;W.vertices[E++]=0;W.vertices[E++]=-1;W.vertices[E++]=1;W.vertices[E++]=0;E=W.vertices[E++]=
-0;W.faces[E++]=0;W.faces[E++]=1;W.faces[E++]=2;W.faces[E++]=0;W.faces[E++]=2;W.faces[E++]=3;W.vertexBuffer=o.createBuffer();W.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,W.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,W.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,W.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,W.faces,o.STATIC_DRAW);W.program=o.createProgram();o.attachShader(W.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(W.program,G("vertex",
-THREE.ShaderLib.sprite.vertexShader));o.linkProgram(W.program);W.attributes={};W.uniforms={};W.attributes.position=o.getAttribLocation(W.program,"position");W.attributes.uv=o.getAttribLocation(W.program,"uv");W.uniforms.uvOffset=o.getUniformLocation(W.program,"uvOffset");W.uniforms.uvScale=o.getUniformLocation(W.program,"uvScale");W.uniforms.rotation=o.getUniformLocation(W.program,"rotation");W.uniforms.scale=o.getUniformLocation(W.program,"scale");W.uniforms.alignment=o.getUniformLocation(W.program,
-"alignment");W.uniforms.color=o.getUniformLocation(W.program,"color");W.uniforms.map=o.getUniformLocation(W.program,"map");W.uniforms.opacity=o.getUniformLocation(W.program,"opacity");W.uniforms.useScreenCoordinates=o.getUniformLocation(W.program,"useScreenCoordinates");W.uniforms.affectedByDistance=o.getUniformLocation(W.program,"affectedByDistance");W.uniforms.screenPosition=o.getUniformLocation(W.program,"screenPosition");W.uniforms.modelViewMatrix=o.getUniformLocation(W.program,"modelViewMatrix");
-W.uniforms.projectionMatrix=o.getUniformLocation(W.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){Ca.width=a;Ca.height=b;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(a,b,c,e){ha=a;O=b;ta=c;qa=e;o.viewport(ha,O,ta,qa)};this.setScissor=function(a,b,c,e){o.scissor(a,b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){X.setHex(a);va=b;o.clearColor(X.r,X.g,X.b,va)};this.setClearColor=
-function(a,b){X.copy(a);va=b;o.clearColor(X.r,X.g,X.b,va)};this.getClearColor=function(){return X};this.getClearAlpha=function(){return va};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,
-a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);
-o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);U.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
-a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),U.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),U.info.memory.textures--};this.initMaterial=function(a,b,c,e){var h,l,f,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":a instanceof THREE.MeshLambertMaterial?k="lambert":a instanceof THREE.MeshPhongMaterial?
-k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var u,t,p;u=p=n=0;for(t=b.length;u<t;u++)f=b[u],f instanceof THREE.SpotLight&&p++,f instanceof THREE.DirectionalLight&&p++,f instanceof THREE.PointLight&&n++;n+p<=ra?u=p:(u=Math.ceil(ra*p/(n+p)),n=ra-u);f={directional:u,point:n};n=p=0;for(u=
-b.length;n<u;n++)t=b[n],t instanceof THREE.SpotLight&&t.castShadow&&p++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var w;a:{u=a.fragmentShader;t=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:v,
-shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},E,e=[];k?e.push(k):(e.push(u),e.push(t));for(E in c)e.push(E),e.push(c[E]);k=e.join();E=0;for(e=da.length;E<e;E++)if(da[E].code===k){w=da[E].program;break a}E=o.createProgram();e=[Aa?"#define VERTEX_TEXTURES":"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":
-"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-f=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",U.gammaInput?"#define GAMMA_INPUT":"",U.gammaOutput?"#define GAMMA_OUTPUT":"",U.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(E,G("fragment",f+u));o.attachShader(E,
-G("vertex",e+t));o.linkProgram(E);o.getProgramParameter(E,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(E,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");E.uniforms={};E.attributes={};var x,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in n)e.push(x);x=e;e=0;for(n=x.length;e<n;e++)u=x[e],E.uniforms[u]=o.getUniformLocation(E,
-u);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)e.push("morphTarget"+x);for(w in b)e.push(w);w=e;x=0;for(b=w.length;x<b;x++)c=w[x],E.attributes[c]=o.getAttribLocation(E,c);E.id=da.length;da.push({program:E,code:k});U.info.memory.programs=da.length;w=E}a.program=w;w=a.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);
-w.tangent>=0&&o.enableVertexAttribArray(w.tangent);a.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(a.attributes)for(l in a.attributes)w[l]!==void 0&&w[l]>=0&&o.enableVertexAttribArray(w[l]);if(a.morphTargets)for(l=a.numSupportedMorphTargets=0;l<this.maxMorphTargets;l++)x="morphTarget"+l,w[x]>=0&&(o.enableVertexAttribArray(w[x]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.clearTarget=function(a,b,c,e){N(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){w(a,b)};this.render=function(a,b,c,E){var ia,z,V,D,C,X,ha,L=a.lights,ra=a.fog;P=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&w(a,b);U.info.render.calls=0;U.info.render.vertices=0;U.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Da);b.projectionMatrix.flattenToArray(xa);ua.multiply(b.projectionMatrix,b.matrixWorldInverse);p(ua);N(c);(this.autoClear||E)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);V=a.__webglObjects.length;for(E=0;E<V;E++)if(C=a.__webglObjects[E],X=C.object,X.visible)if(!(X instanceof THREE.Mesh)||!X.frustumCulled||v(X)){if(X.matrixWorld.flattenToArray(X._objectMatrixArray),
-B(X,b,!0),u(C),C.render=!0,this.sortObjects)X.renderDepth?C.z=X.renderDepth:(Ba.copy(X.position),ua.multiplyVector3(Ba),C.z=Ba.z)}else C.render=!1;else C.render=!1;this.sortObjects&&a.__webglObjects.sort(y);D=a.__webglObjectsImmediate.length;for(E=0;E<D;E++)C=a.__webglObjectsImmediate[E],X=C.object,X.visible&&(X.matrixAutoUpdate&&X.matrixWorld.flattenToArray(X._objectMatrixArray),B(X,b,!0),x(C));if(a.overrideMaterial){k(a.overrideMaterial.depthTest);H(a.overrideMaterial.blending);for(E=0;E<V;E++)if(C=
-a.__webglObjects[E],C.render)X=C.object,ha=C.buffer,h(X),l(b,L,ra,a.overrideMaterial,ha,X);for(E=0;E<D;E++)C=a.__webglObjectsImmediate[E],X=C.object,X.visible&&(T=-1,h(X),ia=e(b,L,ra,a.overrideMaterial,X),X.immediateRenderCallback?X.immediateRenderCallback(ia,o,ma):X.render(function(b){f(b,ia,a.overrideMaterial.shading)}))}else{H(THREE.NormalBlending);for(E=V-1;E>=0;E--)if(C=a.__webglObjects[E],C.render&&(X=C.object,ha=C.buffer,z=C.opaque))h(X),k(z.depthTest),n(z.depthWrite),t(z.polygonOffset,z.polygonOffsetFactor,
-z.polygonOffsetUnits),l(b,L,ra,z,ha,X);for(E=0;E<D;E++)if(C=a.__webglObjectsImmediate[E],X=C.object,X.visible&&(T=-1,z=C.opaque))h(X),k(z.depthTest),n(z.depthWrite),t(z.polygonOffset,z.polygonOffsetFactor,z.polygonOffsetUnits),ia=e(b,L,ra,z,X),X.immediateRenderCallback?X.immediateRenderCallback(ia,o,ma):X.render(function(a){f(a,ia,z.shading)});for(E=0;E<V;E++)if(C=a.__webglObjects[E],C.render&&(X=C.object,ha=C.buffer,z=C.transparent))h(X),H(z.blending),k(z.depthTest),n(z.depthWrite),t(z.polygonOffset,
-z.polygonOffsetFactor,z.polygonOffsetUnits),l(b,L,ra,z,ha,X);for(E=0;E<D;E++)if(C=a.__webglObjectsImmediate[E],X=C.object,X.visible&&(T=-1,z=C.transparent))h(X),H(z.blending),k(z.depthTest),n(z.depthWrite),t(z.polygonOffset,z.polygonOffsetFactor,z.polygonOffsetUnits),ia=e(b,L,ra,z,X),X.immediateRenderCallback?X.immediateRenderCallback(ia,o,ma):X.render(function(a){f(a,ia,z.shading)})}a.__webglSprites.length&&A(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&M(c)};this.initWebGLObjects=
-function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],h=a,l=void 0,f=void 0,k=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){f=e.geometry;if(f.geometryGroups===
-void 0){var k=f,n=void 0,u=void 0,t=void 0,p=void 0,v=t=void 0,w=void 0,E={},x=k.morphTargets.length;k.geometryGroups={};n=0;for(u=k.faces.length;n<u;n++)t=k.faces[n],p=t.materialIndex,v=p!==void 0?p:-1,E[v]===void 0&&(E[v]={hash:v,counter:0}),w=E[v].hash+"_"+E[v].counter,k.geometryGroups[w]===void 0&&(k.geometryGroups[w]={faces:[],materialIndex:p,vertices:0,numMorphTargets:x}),t=t instanceof THREE.Face3?3:4,k.geometryGroups[w].vertices+t>65535&&(E[v].counter+=1,w=E[v].hash+"_"+E[v].counter,k.geometryGroups[w]===
-void 0&&(k.geometryGroups[w]={faces:[],materialIndex:p,vertices:0,numMorphTargets:x})),k.geometryGroups[w].faces.push(n),k.geometryGroups[w].vertices+=t;k.geometryGroupsList=[];n=void 0;for(n in k.geometryGroups)k.geometryGroups[n].id=ja++,k.geometryGroupsList.push(k.geometryGroups[n])}for(l in f.geometryGroups)if(k=f.geometryGroups[l],!k.__webglVertexBuffer){n=k;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=
-o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){p=u=void 0;n.__webglMorphTargetsBuffers=[];u=0;for(p=n.numMorphTargets;u<p;u++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}U.info.memory.geometries++;
-for(var p=e,y=t=E=void 0,v=y=x=y=void 0,w=v=n=0,ia=t=void 0,A=void 0,t=u=x=E=void 0,x=p.geometry,ia=x.faces,A=k.faces,E=0,t=A.length;E<t;E++)y=A[E],y=ia[y],y instanceof THREE.Face3?(n+=3,v+=1,w+=3):y instanceof THREE.Face4&&(n+=4,v+=2,w+=4);E=c(p,k);t=E.map||E.lightMap||E instanceof THREE.ShaderMaterial?!0:!1;A=E instanceof THREE.MeshBasicMaterial&&!E.envMap||E instanceof THREE.MeshDepthMaterial?!1:E&&E.shading!==void 0&&E.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;ia=E.vertexColors?
-E.vertexColors:!1;k.__vertexArray=new Float32Array(n*3);if(A)k.__normalArray=new Float32Array(n*3);if(x.hasTangents)k.__tangentArray=new Float32Array(n*4);if(ia)k.__colorArray=new Float32Array(n*3);if(t){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)k.__uvArray=new Float32Array(n*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(n*4),k.__skinVertexBArray=new Float32Array(n*
-4),k.__skinIndexArray=new Float32Array(n*4),k.__skinWeightArray=new Float32Array(n*4);k.__faceArray=new Uint16Array(v*3);k.__lineArray=new Uint16Array(w*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];x=0;for(y=k.numMorphTargets;x<y;x++)k.__morphTargetsArrays.push(new Float32Array(n*3))}k.__needsSmoothNormals=A===THREE.SmoothShading;k.__uvType=t;k.__vertexColorType=ia;k.__normalType=A;k.__webglFaceCount=v*3;k.__webglLineCount=w*2;if(E.attributes){if(k.__webglCustomAttributesList===void 0)k.__webglCustomAttributesList=
-[];p=void 0;for(p in E.attributes){t=E.attributes[p];x={};for(u in t)x[u]=t[u];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=new Float32Array(n*v),x.buffer=o.createBuffer(),x.buffer.belongsToAttribute=p,t.needsUpdate=!0,x.__original=t;k.__webglCustomAttributesList.push(x)}}k.__inittedArrays=!0;f.__dirtyVertices=!0;f.__dirtyMorphTargets=!0;f.__dirtyElements=!0;f.__dirtyUvs=!0;f.__dirtyNormals=
-!0;f.__dirtyTangents=!0;f.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(f=e.geometry,!f.__webglVertexBuffer)k=f,k.__webglVertexBuffer=o.createBuffer(),k.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,k=f,n=k.vertices.length,k.__vertexArray=new Float32Array(n*3),k.__colorArray=new Float32Array(n*3),k.__webglVertexCount=n,f.__dirtyVertices=!0,f.__dirtyColors=!0}else if(e instanceof THREE.Line){if(f=e.geometry,!f.__webglVertexBuffer)k=f,k.__webglVertexBuffer=o.createBuffer(),
-k.__webglColorBuffer=o.createBuffer(),U.info.memory.geometries++,k=f,n=k.vertices.length,k.__vertexArray=new Float32Array(n*3),k.__colorArray=new Float32Array(n*3),k.__webglLineCount=n,f.__dirtyVertices=!0,f.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(f=e.geometry,!f.__webglVertexBuffer)){k=f;k.__webglVertexBuffer=o.createBuffer();k.__webglColorBuffer=o.createBuffer();U.info.geometries++;k=f;u=e;n=k.vertices.length;k.__vertexArray=new Float32Array(n*3);k.__colorArray=new Float32Array(n*
-3);k.__sortArray=[];k.__webglParticleCount=n;u=u.material;if(u.attributes){if(k.__webglCustomAttributesList===void 0)k.__webglCustomAttributesList=[];p=void 0;for(p in u.attributes){originalAttribute=u.attributes[p];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
-attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(n*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=p,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;k.__webglCustomAttributesList.push(attribute)}}f.__dirtyVertices=!0;f.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(l in f=e.geometry,f.geometryGroups)k=f.geometryGroups[l],L(h.__webglObjects,k,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
-e instanceof THREE.ParticleSystem?(f=e.geometry,L(h.__webglObjects,f,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?h.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&h.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];h=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)C(h.__webglObjects,
-e);else if(e instanceof THREE.Sprite){h=h.__webglSprites;l=e;for(f=h.length-1;f>=0;f--)h[f]===l&&h.splice(f,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&C(h.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(h=a.__webglObjects.length;e<h;e++)if(f=a.__webglObjects[e].object,l=f.geometry,k=v=p=void 0,f instanceof THREE.Mesh){n=0;for(u=l.geometryGroupsList.length;n<u;n++)if(p=l.geometryGroupsList[n],k=c(f,p),v=k.attributes&&D(k),l.__dirtyVertices||
-l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||v)if(v=o.DYNAMIC_DRAW,w=!l.dynamic,p.__inittedArrays){var B=x=E=void 0,V=void 0,X=B=void 0,ha=void 0,ra=void 0,M=void 0,T=y=A=ia=t=void 0,K=void 0,H=void 0,I=void 0,P=void 0,O=V=M=V=ra=ha=void 0,G=void 0,J=G=O=ha=void 0,F=void 0,J=G=O=B=B=X=G=O=V=J=G=O=F=J=G=O=F=J=G=O=void 0,N=0,va=0,R=0,ta=0,wa=0,Y=0,W=0,qa=0,ca=0,S=0,oa=0,Z=J=0,Z=void 0,ga=p.__vertexArray,ka=p.__uvArray,la=p.__uv2Array,
-ea=p.__normalArray,ma=p.__tangentArray,fa=p.__colorArray,da=p.__skinVertexAArray,$=p.__skinVertexBArray,aa=p.__skinIndexArray,sa=p.__skinWeightArray,pa=p.__morphTargetsArrays,na=p.__webglCustomAttributesList,F=void 0,ua=p.__faceArray,ya=p.__lineArray,Fa=p.__needsSmoothNormals,ia=p.__vertexColorType,t=p.__uvType,A=p.__normalType,xa=f.geometry,Da=xa.__dirtyVertices,Aa=xa.__dirtyElements,Ga=xa.__dirtyUvs,Ba=xa.__dirtyNormals,Ea=xa.__dirtyTangents,Ia=xa.__dirtyColors,Ca=xa.__dirtyMorphTargets,Oa=xa.vertices,
-Za=p.faces,bb=xa.faces,$a=xa.faceVertexUvs[0],ab=xa.faceVertexUvs[1],Pa=xa.skinVerticesA,Qa=xa.skinVerticesB,Ra=xa.skinIndices,Ka=xa.skinWeights,Ja=xa.morphTargets;if(na){O=0;for(G=na.length;O<G;O++)na[O].offset=0,na[O].offsetSrc=0}E=0;for(x=Za.length;E<x;E++)if(B=Za[E],V=bb[B],$a&&(y=$a[B]),ab&&(T=ab[B]),B=V.vertexNormals,X=V.normal,ha=V.vertexColors,ra=V.color,M=V.vertexTangents,V instanceof THREE.Face3){if(Da)K=Oa[V.a].position,H=Oa[V.b].position,I=Oa[V.c].position,ga[va]=K.x,ga[va+1]=K.y,ga[va+
-2]=K.z,ga[va+3]=H.x,ga[va+4]=H.y,ga[va+5]=H.z,ga[va+6]=I.x,ga[va+7]=I.y,ga[va+8]=I.z,va+=9;if(na){O=0;for(G=na.length;O<G;O++)if(F=na[O],F.__original.needsUpdate)J=F.offset,Z=F.offsetSrc,F.size===1?(F.boundTo===void 0||F.boundTo==="vertices"?(F.array[J]=F.value[V.a],F.array[J+1]=F.value[V.b],F.array[J+2]=F.value[V.c]):F.boundTo==="faces"?(Z=F.value[Z],F.array[J]=Z,F.array[J+1]=Z,F.array[J+2]=Z,F.offsetSrc++):F.boundTo==="faceVertices"&&(F.array[J]=F.value[Z],F.array[J+1]=F.value[Z+1],F.array[J+2]=
-F.value[Z+2],F.offsetSrc+=3),F.offset+=3):(F.boundTo===void 0||F.boundTo==="vertices"?(K=F.value[V.a],H=F.value[V.b],I=F.value[V.c]):F.boundTo==="faces"?(I=H=K=Z=F.value[Z],F.offsetSrc++):F.boundTo==="faceVertices"&&(K=F.value[Z],H=F.value[Z+1],I=F.value[Z+2],F.offsetSrc+=3),F.size===2?(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=H.x,F.array[J+3]=H.y,F.array[J+4]=I.x,F.array[J+5]=I.y,F.offset+=6):F.size===3?(F.type==="c"?(F.array[J]=K.r,F.array[J+1]=K.g,F.array[J+2]=K.b,F.array[J+3]=H.r,F.array[J+
-4]=H.g,F.array[J+5]=H.b,F.array[J+6]=I.r,F.array[J+7]=I.g,F.array[J+8]=I.b):(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=K.z,F.array[J+3]=H.x,F.array[J+4]=H.y,F.array[J+5]=H.z,F.array[J+6]=I.x,F.array[J+7]=I.y,F.array[J+8]=I.z),F.offset+=9):(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=K.z,F.array[J+3]=K.w,F.array[J+4]=H.x,F.array[J+5]=H.y,F.array[J+6]=H.z,F.array[J+7]=H.w,F.array[J+8]=I.x,F.array[J+9]=I.y,F.array[J+10]=I.z,F.array[J+11]=I.w,F.offset+=12))}if(Ca){O=0;for(G=Ja.length;O<G;O++)K=Ja[O].vertices[V.a].position,
-H=Ja[O].vertices[V.b].position,I=Ja[O].vertices[V.c].position,J=pa[O],J[oa]=K.x,J[oa+1]=K.y,J[oa+2]=K.z,J[oa+3]=H.x,J[oa+4]=H.y,J[oa+5]=H.z,J[oa+6]=I.x,J[oa+7]=I.y,J[oa+8]=I.z;oa+=9}if(Ka.length)O=Ka[V.a],G=Ka[V.b],J=Ka[V.c],sa[S]=O.x,sa[S+1]=O.y,sa[S+2]=O.z,sa[S+3]=O.w,sa[S+4]=G.x,sa[S+5]=G.y,sa[S+6]=G.z,sa[S+7]=G.w,sa[S+8]=J.x,sa[S+9]=J.y,sa[S+10]=J.z,sa[S+11]=J.w,O=Ra[V.a],G=Ra[V.b],J=Ra[V.c],aa[S]=O.x,aa[S+1]=O.y,aa[S+2]=O.z,aa[S+3]=O.w,aa[S+4]=G.x,aa[S+5]=G.y,aa[S+6]=G.z,aa[S+7]=G.w,aa[S+8]=
-J.x,aa[S+9]=J.y,aa[S+10]=J.z,aa[S+11]=J.w,O=Pa[V.a],G=Pa[V.b],J=Pa[V.c],da[S]=O.x,da[S+1]=O.y,da[S+2]=O.z,da[S+3]=1,da[S+4]=G.x,da[S+5]=G.y,da[S+6]=G.z,da[S+7]=1,da[S+8]=J.x,da[S+9]=J.y,da[S+10]=J.z,da[S+11]=1,O=Qa[V.a],G=Qa[V.b],J=Qa[V.c],$[S]=O.x,$[S+1]=O.y,$[S+2]=O.z,$[S+3]=1,$[S+4]=G.x,$[S+5]=G.y,$[S+6]=G.z,$[S+7]=1,$[S+8]=J.x,$[S+9]=J.y,$[S+10]=J.z,$[S+11]=1,S+=12;if(Ia&&ia)ha.length===3&&ia===THREE.VertexColors?(V=ha[0],O=ha[1],G=ha[2]):G=O=V=ra,fa[ca]=V.r,fa[ca+1]=V.g,fa[ca+2]=V.b,fa[ca+3]=
-O.r,fa[ca+4]=O.g,fa[ca+5]=O.b,fa[ca+6]=G.r,fa[ca+7]=G.g,fa[ca+8]=G.b,ca+=9;if(Ea&&xa.hasTangents)ha=M[0],ra=M[1],V=M[2],ma[W]=ha.x,ma[W+1]=ha.y,ma[W+2]=ha.z,ma[W+3]=ha.w,ma[W+4]=ra.x,ma[W+5]=ra.y,ma[W+6]=ra.z,ma[W+7]=ra.w,ma[W+8]=V.x,ma[W+9]=V.y,ma[W+10]=V.z,ma[W+11]=V.w,W+=12;if(Ba&&A)if(B.length===3&&Fa)for(O=0;O<3;O++)X=B[O],ea[Y]=X.x,ea[Y+1]=X.y,ea[Y+2]=X.z,Y+=3;else for(O=0;O<3;O++)ea[Y]=X.x,ea[Y+1]=X.y,ea[Y+2]=X.z,Y+=3;if(Ga&&y!==void 0&&t)for(O=0;O<3;O++)B=y[O],ka[R]=B.u,ka[R+1]=B.v,R+=2;if(Ga&&
-T!==void 0&&t)for(O=0;O<3;O++)B=T[O],la[ta]=B.u,la[ta+1]=B.v,ta+=2;Aa&&(ua[wa]=N,ua[wa+1]=N+1,ua[wa+2]=N+2,wa+=3,ya[qa]=N,ya[qa+1]=N+1,ya[qa+2]=N,ya[qa+3]=N+2,ya[qa+4]=N+1,ya[qa+5]=N+2,qa+=6,N+=3)}else if(V instanceof THREE.Face4){if(Da)K=Oa[V.a].position,H=Oa[V.b].position,I=Oa[V.c].position,P=Oa[V.d].position,ga[va]=K.x,ga[va+1]=K.y,ga[va+2]=K.z,ga[va+3]=H.x,ga[va+4]=H.y,ga[va+5]=H.z,ga[va+6]=I.x,ga[va+7]=I.y,ga[va+8]=I.z,ga[va+9]=P.x,ga[va+10]=P.y,ga[va+11]=P.z,va+=12;if(na){O=0;for(G=na.length;O<
-G;O++)if(F=na[O],F.__original.needsUpdate)J=F.offset,Z=F.offsetSrc,F.size===1?(F.boundTo===void 0||F.boundTo==="vertices"?(F.array[J]=F.value[V.a],F.array[J+1]=F.value[V.b],F.array[J+2]=F.value[V.c],F.array[J+3]=F.value[V.d]):F.boundTo==="faces"?(Z=F.value[Z],F.array[J]=Z,F.array[J+1]=Z,F.array[J+2]=Z,F.array[J+3]=Z,F.offsetSrc++):F.boundTo==="faceVertices"&&(F.array[J]=F.value[Z],F.array[J+1]=F.value[Z+1],F.array[J+2]=F.value[Z+2],F.array[J+3]=F.value[Z+3],F.offsetSrc+=4),F.offset+=4):(F.boundTo===
-void 0||F.boundTo==="vertices"?(K=F.value[V.a],H=F.value[V.b],I=F.value[V.c],P=F.value[V.d]):F.boundTo==="faces"?(P=I=H=K=Z=F.value[Z],F.offsetSrc++):F.boundTo==="faceVertices"&&(K=F.value[Z],H=F.value[Z+1],I=F.value[Z+2],P=F.value[Z+3],F.offsetSrc+=4),F.size===2?(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=H.x,F.array[J+3]=H.y,F.array[J+4]=I.x,F.array[J+5]=I.y,F.array[J+6]=P.x,F.array[J+7]=P.y,F.offset+=8):F.size===3?(F.type==="c"?(F.array[J]=K.r,F.array[J+1]=K.g,F.array[J+2]=K.b,F.array[J+3]=H.r,
-F.array[J+4]=H.g,F.array[J+5]=H.b,F.array[J+6]=I.r,F.array[J+7]=I.g,F.array[J+8]=I.b,F.array[J+9]=P.r,F.array[J+10]=P.g,F.array[J+11]=P.b):(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=K.z,F.array[J+3]=H.x,F.array[J+4]=H.y,F.array[J+5]=H.z,F.array[J+6]=I.x,F.array[J+7]=I.y,F.array[J+8]=I.z,F.array[J+9]=P.x,F.array[J+10]=P.y,F.array[J+11]=P.z),F.offset+=12):(F.array[J]=K.x,F.array[J+1]=K.y,F.array[J+2]=K.z,F.array[J+3]=K.w,F.array[J+4]=H.x,F.array[J+5]=H.y,F.array[J+6]=H.z,F.array[J+7]=H.w,F.array[J+
-8]=I.x,F.array[J+9]=I.y,F.array[J+10]=I.z,F.array[J+11]=I.w,F.array[J+12]=P.x,F.array[J+13]=P.y,F.array[J+14]=P.z,F.array[J+15]=P.w,F.offset+=16))}if(Ca){O=0;for(G=Ja.length;O<G;O++)K=Ja[O].vertices[V.a].position,H=Ja[O].vertices[V.b].position,I=Ja[O].vertices[V.c].position,P=Ja[O].vertices[V.d].position,J=pa[O],J[oa]=K.x,J[oa+1]=K.y,J[oa+2]=K.z,J[oa+3]=H.x,J[oa+4]=H.y,J[oa+5]=H.z,J[oa+6]=I.x,J[oa+7]=I.y,J[oa+8]=I.z,J[oa+9]=P.x,J[oa+10]=P.y,J[oa+11]=P.z;oa+=12}if(Ka.length)O=Ka[V.a],G=Ka[V.b],J=Ka[V.c],
-F=Ka[V.d],sa[S]=O.x,sa[S+1]=O.y,sa[S+2]=O.z,sa[S+3]=O.w,sa[S+4]=G.x,sa[S+5]=G.y,sa[S+6]=G.z,sa[S+7]=G.w,sa[S+8]=J.x,sa[S+9]=J.y,sa[S+10]=J.z,sa[S+11]=J.w,sa[S+12]=F.x,sa[S+13]=F.y,sa[S+14]=F.z,sa[S+15]=F.w,O=Ra[V.a],G=Ra[V.b],J=Ra[V.c],F=Ra[V.d],aa[S]=O.x,aa[S+1]=O.y,aa[S+2]=O.z,aa[S+3]=O.w,aa[S+4]=G.x,aa[S+5]=G.y,aa[S+6]=G.z,aa[S+7]=G.w,aa[S+8]=J.x,aa[S+9]=J.y,aa[S+10]=J.z,aa[S+11]=J.w,aa[S+12]=F.x,aa[S+13]=F.y,aa[S+14]=F.z,aa[S+15]=F.w,O=Pa[V.a],G=Pa[V.b],J=Pa[V.c],F=Pa[V.d],da[S]=O.x,da[S+1]=O.y,
-da[S+2]=O.z,da[S+3]=1,da[S+4]=G.x,da[S+5]=G.y,da[S+6]=G.z,da[S+7]=1,da[S+8]=J.x,da[S+9]=J.y,da[S+10]=J.z,da[S+11]=1,da[S+12]=F.x,da[S+13]=F.y,da[S+14]=F.z,da[S+15]=1,O=Qa[V.a],G=Qa[V.b],J=Qa[V.c],V=Qa[V.d],$[S]=O.x,$[S+1]=O.y,$[S+2]=O.z,$[S+3]=1,$[S+4]=G.x,$[S+5]=G.y,$[S+6]=G.z,$[S+7]=1,$[S+8]=J.x,$[S+9]=J.y,$[S+10]=J.z,$[S+11]=1,$[S+12]=V.x,$[S+13]=V.y,$[S+14]=V.z,$[S+15]=1,S+=16;if(Ia&&ia)ha.length===4&&ia===THREE.VertexColors?(V=ha[0],O=ha[1],G=ha[2],ha=ha[3]):ha=G=O=V=ra,fa[ca]=V.r,fa[ca+1]=V.g,
-fa[ca+2]=V.b,fa[ca+3]=O.r,fa[ca+4]=O.g,fa[ca+5]=O.b,fa[ca+6]=G.r,fa[ca+7]=G.g,fa[ca+8]=G.b,fa[ca+9]=ha.r,fa[ca+10]=ha.g,fa[ca+11]=ha.b,ca+=12;if(Ea&&xa.hasTangents)ha=M[0],ra=M[1],V=M[2],M=M[3],ma[W]=ha.x,ma[W+1]=ha.y,ma[W+2]=ha.z,ma[W+3]=ha.w,ma[W+4]=ra.x,ma[W+5]=ra.y,ma[W+6]=ra.z,ma[W+7]=ra.w,ma[W+8]=V.x,ma[W+9]=V.y,ma[W+10]=V.z,ma[W+11]=V.w,ma[W+12]=M.x,ma[W+13]=M.y,ma[W+14]=M.z,ma[W+15]=M.w,W+=16;if(Ba&&A)if(B.length===4&&Fa)for(O=0;O<4;O++)X=B[O],ea[Y]=X.x,ea[Y+1]=X.y,ea[Y+2]=X.z,Y+=3;else for(O=
-0;O<4;O++)ea[Y]=X.x,ea[Y+1]=X.y,ea[Y+2]=X.z,Y+=3;if(Ga&&y!==void 0&&t)for(O=0;O<4;O++)B=y[O],ka[R]=B.u,ka[R+1]=B.v,R+=2;if(Ga&&T!==void 0&&t)for(O=0;O<4;O++)B=T[O],la[ta]=B.u,la[ta+1]=B.v,ta+=2;Aa&&(ua[wa]=N,ua[wa+1]=N+1,ua[wa+2]=N+3,ua[wa+3]=N+1,ua[wa+4]=N+2,ua[wa+5]=N+3,wa+=6,ya[qa]=N,ya[qa+1]=N+1,ya[qa+2]=N,ya[qa+3]=N+3,ya[qa+4]=N+1,ya[qa+5]=N+2,ya[qa+6]=N+2,ya[qa+7]=N+3,qa+=8,N+=4)}Da&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,v));if(na){O=0;for(G=na.length;O<
-G;O++)F=na[O],F.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,F.buffer),o.bufferData(o.ARRAY_BUFFER,F.array,v))}if(Ca){O=0;for(G=Ja.length;O<G;O++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[O]),o.bufferData(o.ARRAY_BUFFER,pa[O],v)}Ia&&ca>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,v));Ba&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ea,v));Ea&&xa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),
-o.bufferData(o.ARRAY_BUFFER,ma,v));Ga&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ka,v));Ga&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,la,v));Aa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ua,v),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,v));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,
-da,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,$,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,aa,v),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,sa,v));w&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,
-delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}l.__dirtyVertices=!1;l.__dirtyMorphTargets=!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;k.attributes&&z(k)}else if(f instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){f=l;k=o.DYNAMIC_DRAW;n=E=w=w=void 0;x=f.vertices;u=f.colors;t=x.length;p=u.length;ia=f.__vertexArray;v=f.__colorArray;A=f.__dirtyColors;if(f.__dirtyVertices){for(w=0;w<t;w++)E=x[w].position,
-n=w*3,ia[n]=E.x,ia[n+1]=E.y,ia[n+2]=E.z;o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,ia,k)}if(A){for(w=0;w<p;w++)color=u[w],n=w*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,k)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(f instanceof THREE.Line){if(l.__dirtyVertices||l.__dirtyColors){f=l;k=o.DYNAMIC_DRAW;n=E=w=w=void 0;x=f.vertices;u=f.colors;t=x.length;p=u.length;ia=f.__vertexArray;
-v=f.__colorArray;A=f.__dirtyColors;if(f.__dirtyVertices){for(w=0;w<t;w++)E=x[w].position,n=w*3,ia[n]=E.x,ia[n+1]=E.y,ia[n+2]=E.z;o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,ia,k)}if(A){for(w=0;w<p;w++)color=u[w],n=w*3,v[n]=color.r,v[n+1]=color.g,v[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,k)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(f instanceof THREE.ParticleSystem)k=c(f,p),v=k.attributes&&D(k),(l.__dirtyVertices||
-l.__dirtyColors||f.sortParticles||v)&&b(l,o.DYNAMIC_DRAW,f),l.__dirtyVertices=!1,l.__dirtyColors=!1,k.attributes&&z(k)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Aa}};
+THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in e.attributes){originalAttribute=e.attributes[f];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type===
+"v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(c*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=f,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;a.__webglCustomAttributesList.push(attribute)}}}function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,f,h,l=a.vertices,
+k=l.length,n=a.colors,u=n.length,p=a.__vertexArray,v=a.__colorArray,t=a.__sortArray,w=a.__dirtyVertices,y=a.__dirtyColors,aa=a.__webglCustomAttributesList,x;if(aa){h=0;for(e=aa.length;h<e;h++)aa[h].offset=0}if(c.sortParticles){Da.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=l[e].position,Ca.copy(f),Da.multiplyVector3(Ca),t[e]=[Ca.z,e];t.sort(function(a,b){return b[0]-a[0]});for(e=0;e<k;e++)f=l[t[e][1]].position,h=e*3,p[h]=f.x,p[h+1]=f.y,p[h+2]=f.z;for(e=0;e<u;e++)h=e*3,color=n[t[e][1]],v[h]=color.r,
+v[h+1]=color.g,v[h+2]=color.b;if(aa){h=0;for(e=aa.length;h<e;h++){k=aa[h];u=k.value.length;for(n=0;n<u;n++){index=t[n][1];l=k.offset;if(k.size===1){if(k.boundTo===void 0||k.boundTo==="vertices")k.array[l]=k.value[index]}else{if(k.boundTo===void 0||k.boundTo==="vertices")x=k.value[index];k.size===2?(k.array[l]=x.x,k.array[l+1]=x.y):k.size===3?k.type==="c"?(k.array[l]=x.r,k.array[l+1]=x.g,k.array[l+2]=x.b):(k.array[l]=x.x,k.array[l+1]=x.y,k.array[l+2]=x.z):(k.array[l]=x.x,k.array[l+1]=x.y,k.array[l+
+2]=x.z,k.array[l+3]=x.w)}k.offset+=k.size}}}}else{if(w)for(e=0;e<k;e++)f=l[e].position,h=e*3,p[h]=f.x,p[h+1]=f.y,p[h+2]=f.z;if(y)for(e=0;e<u;e++)color=n[e],h=e*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(aa){h=0;for(e=aa.length;h<e;h++)if(k=aa[h],k.__original.needsUpdate){u=k.value.length;for(n=0;n<u;n++){l=k.offset;if(k.size===1){if(k.boundTo===void 0||k.boundTo==="vertices")k.array[l]=k.value[n]}else{if(k.boundTo===void 0||k.boundTo==="vertices")x=k.value[n];k.size===2?(k.array[l]=x.x,k.array[l+
+1]=x.y):k.size===3?k.type==="c"?(k.array[l]=x.r,k.array[l+1]=x.g,k.array[l+2]=x.b):(k.array[l]=x.x,k.array[l+1]=x.y,k.array[l+2]=x.z):(k.array[l]=x.x,k.array[l+1]=x.y,k.array[l+2]=x.z,k.array[l+3]=x.w)}k.offset+=k.size}}}}if(w||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,p,b);if(y||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,b);if(aa){h=0;for(e=aa.length;h<e;h++)if(k=aa[h],k.__original.needsUpdate||
+c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,k.buffer),o.bufferData(o.ARRAY_BUFFER,k.array,b)}}function l(a,b,c,e,f){e.program||T.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(T.maxMorphTargets);for(var h=0,l=T.maxMorphTargets;h<l;h++)f.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,l=h.uniforms,n=e.uniforms;h!==ha&&(o.useProgram(h),ha=h,k=!0);if(e.id!==R)R=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,va);
+if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var u,p,v=0,t=0,w=0,y,x,z,Y=Ga,ja=Y.directional.colors,B=Y.directional.positions,A=Y.point.colors,C=Y.point.positions,D=Y.point.distances,J=0,ga=0,c=u=z=0,k=b.length;c<k;c++)if(u=b[c],p=u.color,y=u.position,x=u.intensity,z=u.distance,u instanceof
+THREE.AmbientLight)T.gammaInput?(v+=p.r*p.r,t+=p.g*p.g,w+=p.b*p.b):(v+=p.r,t+=p.g,w+=p.b);else if(u instanceof THREE.DirectionalLight)z=J*3,T.gammaInput?(ja[z]=p.r*p.r*x*x,ja[z+1]=p.g*p.g*x*x,ja[z+2]=p.b*p.b*x*x):(ja[z]=p.r*x,ja[z+1]=p.g*x,ja[z+2]=p.b*x),B[z]=y.x,B[z+1]=y.y,B[z+2]=y.z,J+=1;else if(u instanceof THREE.SpotLight)z=J*3,T.gammaInput?(ja[z]=p.r*p.r*x*x,ja[z+1]=p.g*p.g*x*x,ja[z+2]=p.b*p.b*x*x):(ja[z]=p.r*x,ja[z+1]=p.g*x,ja[z+2]=p.b*x),p=1/y.length(),B[z]=y.x*p,B[z+1]=y.y*p,B[z+2]=y.z*p,
+J+=1;else if(u instanceof THREE.PointLight)u=ga*3,T.gammaInput?(A[u]=p.r*p.r*x*x,A[u+1]=p.g*p.g*x*x,A[u+2]=p.b*p.b*x*x):(A[u]=p.r*x,A[u+1]=p.g*x,A[u+2]=p.b*x),C[u]=y.x,C[u+1]=y.y,C[u+2]=y.z,D[ga]=z,ga+=1;c=J*3;for(k=ja.length;c<k;c++)ja[c]=0;c=ga*3;for(k=A.length;c<k;c++)A[c]=0;Y.point.length=ga;Y.directional.length=J;Y.ambient[0]=v;Y.ambient[1]=t;Y.ambient[2]=w;b=Ga;n.enableLighting.value=b.directional.length+b.point.length;n.ambientLightColor.value=b.ambient;n.directionalLightColor.value=b.directional.colors;
+n.directionalLightDirection.value=b.directional.positions;n.pointLightColor.value=b.point.colors;n.pointLightPosition.value=b.point.positions;n.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)n.opacity.value=e.opacity,T.gammaInput?n.diffuse.value.copyGammaToLinear(e.color):n.diffuse.value=e.color,(n.map.texture=e.map)&&n.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,
+e.map.repeat.y),n.lightMap.texture=e.lightMap,n.envMap.texture=e.envMap,n.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,n.reflectivity.value=e.reflectivity,n.refractionRatio.value=e.refractionRatio,n.combine.value=e.combine,n.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)n.diffuse.value=e.color,n.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)n.psColor.value=e.color,n.opacity.value=
+e.opacity,n.size.value=e.size,n.scale.value=aa.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,T.gammaInput?(n.ambient.value.copyGammaToLinear(e.ambient),n.specular.value.copyGammaToLinear(e.specular)):(n.ambient.value=e.ambient,n.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)T.gammaInput?n.ambient.value.copyGammaToLinear(e.ambient):n.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)n.mNear.value=
+a.near,n.mFar.value=a.far,n.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)n.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<pa.length;b++)n.shadowMatrix.value[b]=pa[b],n.shadowMap.texture[b]=T.shadowMap[b];n.shadowDarkness.value=T.shadowMapDarkness;n.shadowBias.value=T.shadowMapBias}b=e.uniformsList;n=0;for(c=b.length;n<c;n++)if(t=h.uniforms[b[n][1]])if(v=b[n][0],w=v.type,k=v.value,w==="i")o.uniform1i(t,k);else if(w==="f")o.uniform1f(t,
+k);else if(w==="v2")o.uniform2f(t,k.x,k.y);else if(w==="v3")o.uniform3f(t,k.x,k.y,k.z);else if(w==="v4")o.uniform4f(t,k.x,k.y,k.z,k.w);else if(w==="c")o.uniform3f(t,k.r,k.g,k.b);else if(w==="fv1")o.uniform1fv(t,k);else if(w==="fv")o.uniform3fv(t,k);else if(w==="v3v"){if(!v._array)v._array=new Float32Array(3*k.length);w=0;for(y=k.length;w<y;w++)Y=w*3,v._array[Y]=k[w].x,v._array[Y+1]=k[w].y,v._array[Y+2]=k[w].z;o.uniform3fv(t,v._array)}else if(w==="m4"){if(!v._array)v._array=new Float32Array(16);k.flattenToArray(v._array);
+o.uniformMatrix4fv(t,!1,v._array)}else if(w==="m4v"){if(!v._array)v._array=new Float32Array(16*k.length);w=0;for(y=k.length;w<y;w++)k[w].flattenToArrayOffset(v._array,w*16);o.uniformMatrix4fv(t,!1,v._array)}else if(w==="t"){if(o.uniform1i(t,k),t=v.texture)if(t.image instanceof Array&&t.image.length===6){if(v=t,v.image.length===6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);
+for(k=0;k<6;k++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[k]);Q(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(v=t,o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):H(t,k)}else if(w==="tv"){if(!v._array){v._array=[];w=0;for(y=v.texture.length;w<y;w++)v._array[w]=k+w}o.uniform1iv(t,
+v._array);w=0;for(y=v.texture.length;w<y;w++)(t=v.texture[w])&&H(t,v._array[w])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&l.cameraPosition!==null&&o.uniform3f(l.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&l.viewMatrix!==null&&o.uniformMatrix4fv(l.viewMatrix,!1,Ea);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,
+Ea),o.uniformMatrix4fv(l.boneGlobalMatrices,!1,f.boneMatrices))}o.uniformMatrix4fv(l.modelViewMatrix,!1,f._modelViewMatrixArray);l.normalMatrix&&o.uniformMatrix3fv(l.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&l.objectMatrix!==null&&o.uniformMatrix4fv(l.objectMatrix,!1,f._objectMatrixArray);return h}function f(a,b,c,e,f,h){if(e.opacity!==0){var k,n,c=l(a,b,c,e,h),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==
+X&&(X=c,b=!0);if(!e.morphTargets&&a.position>=0)b&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(a.position,3,o.FLOAT,!1,0,0));else if(h.morphTargetBase){c=e.program.attributes;h.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[h.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(h.morphTargetForcedOrder.length){k=
+0;var p=h.morphTargetForcedOrder;for(n=h.morphTargetInfluences;k<e.numSupportedMorphTargets&&k<p.length;)o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[p[k]]),o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0),h.__webglMorphTargetInfluences[k]=n[p[k]],k++}else{var p=[],u=-1,v=0;n=h.morphTargetInfluences;var t,w=n.length;k=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(t=0;t<w;t++)!p[t]&&n[t]>u&&(v=t,u=n[v]);o.bindBuffer(o.ARRAY_BUFFER,
+f.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=u;p[v]=1;u=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){k=0;for(n=f.__webglCustomAttributesList.length;k<n;k++)c=f.__webglCustomAttributesList[k],a[c.buffer.belongsToAttribute]>=0&&(o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(a[c.buffer.belongsToAttribute],
+c.size,o.FLOAT,!1,0,0))}a.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglColorBuffer),o.vertexAttribPointer(a.color,3,o.FLOAT,!1,0,0));a.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglNormalBuffer),o.vertexAttribPointer(a.normal,3,o.FLOAT,!1,0,0));a.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglTangentBuffer),o.vertexAttribPointer(a.tangent,4,o.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUVBuffer),o.vertexAttribPointer(a.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv)):
+o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,f.__webglUV2Buffer),o.vertexAttribPointer(a.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(a.uv2)):o.disableVertexAttribArray(a.uv2));e.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexABuffer),o.vertexAttribPointer(a.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),o.vertexAttribPointer(a.skinVertexB,
+4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),o.vertexAttribPointer(a.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),o.vertexAttribPointer(a.skinWeight,4,o.FLOAT,!1,0,0))}h instanceof THREE.Mesh?(e.wireframe?(o.lineWidth(e.wireframeLinewidth),b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),o.drawElements(o.LINES,f.__webglLineCount,o.UNSIGNED_SHORT,0)):(b&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),o.drawElements(o.TRIANGLES,
+f.__webglFaceCount,o.UNSIGNED_SHORT,0)),T.info.render.calls++,T.info.render.vertices+=f.__webglFaceCount,T.info.render.faces+=f.__webglFaceCount/3):h instanceof THREE.Line?(h=h.type===THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(e.linewidth),o.drawArrays(h,0,f.__webglLineCount),T.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),T.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),T.info.render.calls++)}}
+function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,l,k,n,p,u,v,t,w=
+a.count*3;for(t=0;t<w;t+=9)c=a.normalArray,e=c[t],f=c[t+1],h=c[t+2],l=c[t+3],n=c[t+4],u=c[t+5],k=c[t+6],p=c[t+7],v=c[t+8],e=(e+l+k)/3,f=(f+n+p)/3,h=(h+u+v)/3,c[t]=e,c[t+1]=f,c[t+2]=h,c[t+3]=e,c[t+4]=f,c[t+5]=h,c[t+6]=e,c[t+7]=f,c[t+8]=h}o.bufferData(o.ARRAY_BUFFER,a.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(b.attributes.normal);o.vertexAttribPointer(b.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,a.count);a.count=0}function k(a){if($!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):
+o.enable(o.CULL_FACE),$=a.doubleSided;if(ma!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ma=a.flipSided}function n(a){ea!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ea=a)}function p(a){ka!==a&&(o.depthMask(a),ka=a)}function t(a,b,c){fa!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=a);if(a&&(ia!==b||ga!==c))o.polygonOffset(b,c),ia=b,ga=c}function u(a){sa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);sa[1].set(a.n41+a.n11,a.n42+a.n12,
+a.n43+a.n13,a.n44+a.n14);sa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);sa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);sa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);sa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=sa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function y(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),e=0;e<6;e++)if(a=sa[e].x*b.n14+sa[e].y*
+b.n24+sa[e].z*b.n34+sa[e].w,a<=c)return!1;return!0}function v(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function x(a){var b=a.object,c=a.buffer,e;e=b.material;if(e instanceof THREE.MeshFaceMaterial){if(c=c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=e)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function w(a,b){return b.z-
+a.z}function z(a){var b,c,e,p=0,v,t,w,x,aa=a.lights;oa||(oa=new THREE.PerspectiveCamera(T.shadowCameraFov,T.shadowMapWidth/T.shadowMapHeight,T.shadowCameraNear,T.shadowCameraFar));b=0;for(c=aa.length;b<c;b++)if(e=aa[b],e instanceof THREE.SpotLight&&e.castShadow){R=-1;T.shadowMap[p]||(T.shadowMap[p]=new THREE.WebGLRenderTarget(T.shadowMapWidth,T.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[p]||(pa[p]=new THREE.Matrix4);v=T.shadowMap[p];t=
+pa[p];oa.position.copy(e.position);oa.lookAt(e.target.position);oa.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(oa));this.autoUpdateScene&&a.updateMatrixWorld();oa.matrixWorldInverse.getInverse(oa.matrixWorld);t.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);t.multiplySelf(oa.projectionMatrix);t.multiplySelf(oa.matrixWorldInverse);oa.matrixWorldInverse.flattenToArray(Ea);oa.projectionMatrix.flattenToArray(va);Da.multiply(oa.projectionMatrix,oa.matrixWorldInverse);
+u(Da);L(v);o.clearColor(1,1,1,1);T.clear();o.clearColor(O.r,O.g,O.b,ra);t=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(v=0;v<t;v++)w=a.__webglObjects[v],x=w.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||!x.frustumCulled||y(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),C(x,oa,!1),w.render=!0):w.render=!1:w.render=!1;n(!0);F(THREE.NormalBlending);for(v=0;v<t;v++)if(w=a.__webglObjects[v],w.render)x=w.object,buffer=w.buffer,k(x),w=x.customDepthMaterial?x.customDepthMaterial:
+x.geometry.morphTargets.length?Fa:za,f(oa,aa,null,w,buffer,x);for(v=0;v<e;v++)w=a.__webglObjectsImmediate[v],x=w.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),X=-1,C(x,oa,!1),k(x),program=l(oa,aa,null,za,x),x.immediateRenderCallback?x.immediateRenderCallback(program,o,sa):x.render(function(a){h(a,program,za.shading)}));p++}}function B(a,b){var c,e,f;c=U.attributes;var h=U.uniforms,l=qa/ua,k,n=[],p=ua*0.5,v=qa*0.5,u=!0;o.useProgram(U.program);
+ha=U.program;X=ea=na=-1;Ra||(o.enableVertexAttribArray(U.attributes.position),o.enableVertexAttribArray(U.attributes.uv),Ra=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,U.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,U.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,va);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<
+e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(w);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(f.position.x-p)/p,(v-f.position.y)/
+v,Math.max(0,Math.min(1,f.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),k=f.map.image.width/(f.scaleByViewport?qa:1),n[0]=k*l*f.scale.x,n[1]=k*f.scale.y,o.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),o.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),o.uniform2f(h.alignment,f.alignment.x,f.alignment.y),o.uniform1f(h.opacity,f.opacity),o.uniform3f(h.color,f.color.r,f.color.g,
+f.color.b),o.uniform1f(h.rotation,f.rotation),o.uniform2fv(h.scale,n),f.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!f.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),F(f.blending),H(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ka)}function C(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
+function A(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function D(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function K(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function P(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function F(a){if(a!==na){switch(a){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,
+o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}na=a}}function Q(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,W(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,W(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,W(b.magFilter)),o.texParameteri(a,
+o.TEXTURE_MIN_FILTER,W(b.minFilter)),o.generateMipmap(a)):(o.texParameteri(a,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(a,o.TEXTURE_MAG_FILTER,ca(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ca(b.minFilter)))}function H(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=o.createTexture(),T.info.memory.textures++;o.activeTexture(o.TEXTURE0+b);o.bindTexture(o.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?
+o.texImage2D(o.TEXTURE_2D,0,W(a.format),a.image.width,a.image.height,0,W(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);Q(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function N(a,b){o.bindRenderbuffer(o.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,
+o.DEPTH_ATTACHMENT,o.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,a)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height)}function L(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=o.createTexture();
+if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);Q(o.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=o.createFramebuffer();a.__webglRenderbuffer[c]=o.createRenderbuffer();o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,W(a.format),a.width,a.height,0,W(a.format),W(a.type),null);var e=a,f=o.TEXTURE_CUBE_MAP_POSITIVE_X+c;o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer[c]);o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,
+f,e.__webglTexture,0);N(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),Q(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,W(a.format),a.width,a.height,0,W(a.format),W(a.type),null),c=o.TEXTURE_2D,o.bindFramebuffer(o.FRAMEBUFFER,a.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,c,a.__webglTexture,0),o.bindRenderbuffer(o.RENDERBUFFER,a.__webglRenderbuffer),
+N(a.__webglRenderbuffer,a);b?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,null);o.bindFramebuffer(o.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ua,a=qa,e=da,f=ta);b!==M&&(o.bindFramebuffer(o.FRAMEBUFFER,b),o.viewport(e,f,c,a),M=b)}function G(a){a instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),
+o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,a.__webglTexture),o.generateMipmap(o.TEXTURE_2D),o.bindTexture(o.TEXTURE_2D,null))}function V(a,b){var c;a==="fragment"?c=o.createShader(o.FRAGMENT_SHADER):a==="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,b);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(b),null;return c}function ca(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;
+default:return o.LINEAR}}function W(a){switch(a){case THREE.RepeatWrapping:return o.REPEAT;case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}
+var T=this,o,Z=[],ha=null,M=null,R=-1,X=null,la=0,$=null,ma=null,na=null,ea=null,ka=null,fa=null,ia=null,ga=null,da=0,ta=0,ua=0,qa=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,va=new Float32Array(16),Ea=new Float32Array(16),Ca=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},aa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+ja=a.stencil!==void 0?a.stencil:!0,Y=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,J=a.antialias!==void 0?a.antialias:!1,O=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ra=a.clearAlpha!==void 0?a.clearAlpha:0,xa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=aa;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var oa,pa=[],a=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(a.uniforms),za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:ya}),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ya,morphTargets:!0});za._shadowPass=!0;Fa._shadowPass=!0;try{if(!(o=aa.getContext("experimental-webgl",{antialias:J,stencil:ja,preserveDrawingBuffer:Y})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(Ba){console.error(Ba)}o.clearColor(0,
+0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(O.r,O.g,O.b,ra);this.context=o;var Ha=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,U={};U.vertices=new Float32Array(16);U.faces=new Uint16Array(6);ja=0;U.vertices[ja++]=-1;U.vertices[ja++]=-1;U.vertices[ja++]=0;U.vertices[ja++]=1;U.vertices[ja++]=
+1;U.vertices[ja++]=-1;U.vertices[ja++]=1;U.vertices[ja++]=1;U.vertices[ja++]=1;U.vertices[ja++]=1;U.vertices[ja++]=1;U.vertices[ja++]=0;U.vertices[ja++]=-1;U.vertices[ja++]=1;U.vertices[ja++]=0;ja=U.vertices[ja++]=0;U.faces[ja++]=0;U.faces[ja++]=1;U.faces[ja++]=2;U.faces[ja++]=0;U.faces[ja++]=2;U.faces[ja++]=3;U.vertexBuffer=o.createBuffer();U.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,U.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,U.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
+U.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,U.faces,o.STATIC_DRAW);U.program=o.createProgram();o.attachShader(U.program,V("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(U.program,V("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(U.program);U.attributes={};U.uniforms={};U.attributes.position=o.getAttribLocation(U.program,"position");U.attributes.uv=o.getAttribLocation(U.program,"uv");U.uniforms.uvOffset=o.getUniformLocation(U.program,"uvOffset");U.uniforms.uvScale=
+o.getUniformLocation(U.program,"uvScale");U.uniforms.rotation=o.getUniformLocation(U.program,"rotation");U.uniforms.scale=o.getUniformLocation(U.program,"scale");U.uniforms.alignment=o.getUniformLocation(U.program,"alignment");U.uniforms.color=o.getUniformLocation(U.program,"color");U.uniforms.map=o.getUniformLocation(U.program,"map");U.uniforms.opacity=o.getUniformLocation(U.program,"opacity");U.uniforms.useScreenCoordinates=o.getUniformLocation(U.program,"useScreenCoordinates");U.uniforms.affectedByDistance=
+o.getUniformLocation(U.program,"affectedByDistance");U.uniforms.screenPosition=o.getUniformLocation(U.program,"screenPosition");U.uniforms.modelViewMatrix=o.getUniformLocation(U.program,"modelViewMatrix");U.uniforms.projectionMatrix=o.getUniformLocation(U.program,"projectionMatrix");var Ra=!1;this.setSize=function(a,b){aa.width=a;aa.height=b;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(a,b,c,e){da=a;ta=b;ua=c;qa=e;o.viewport(da,ta,ua,qa)};this.setScissor=function(a,b,c,e){o.scissor(a,
+b,c,e)};this.enableScissorTest=function(a){a?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(a,b){O.setHex(a);ra=b;o.clearColor(O.r,O.g,O.b,ra)};this.setClearColor=function(a,b){O.copy(a);ra=b;o.clearColor(O.r,O.g,O.b,ra)};this.getClearColor=function(){return O};this.getClearAlpha=function(){return ra};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=o.COLOR_BUFFER_BIT;if(b===void 0||b)e|=o.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=o.STENCIL_BUFFER_BIT;o.clear(e)};
+this.getContext=function(){return o};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];o.deleteBuffer(b.__webglVertexBuffer);o.deleteBuffer(b.__webglNormalBuffer);o.deleteBuffer(b.__webglTangentBuffer);o.deleteBuffer(b.__webglColorBuffer);o.deleteBuffer(b.__webglUVBuffer);
+o.deleteBuffer(b.__webglUV2Buffer);o.deleteBuffer(b.__webglSkinVertexABuffer);o.deleteBuffer(b.__webglSkinVertexBBuffer);o.deleteBuffer(b.__webglSkinIndicesBuffer);o.deleteBuffer(b.__webglSkinWeightsBuffer);o.deleteBuffer(b.__webglFaceBuffer);o.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)o.deleteBuffer(b.__webglMorphTargetsBuffers[c]);T.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),
+T.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),T.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),T.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),T.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,
+h,l,k;a instanceof THREE.MeshDepthMaterial?k="depth":a instanceof THREE.MeshNormalMaterial?k="normal":a instanceof THREE.MeshBasicMaterial?k="basic":a instanceof THREE.MeshLambertMaterial?k="lambert":a instanceof THREE.MeshPhongMaterial?k="phong":a instanceof THREE.LineBasicMaterial?k="basic":a instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var n=THREE.ShaderLib[k];a.uniforms=THREE.UniformsUtils.clone(n.uniforms);a.vertexShader=n.vertexShader;a.fragmentShader=n.fragmentShader}var p,
+v,u;p=u=n=0;for(v=b.length;p<v;p++)l=b[p],l instanceof THREE.SpotLight&&u++,l instanceof THREE.DirectionalLight&&u++,l instanceof THREE.PointLight&&n++;n+u<=xa?p=u:(p=Math.ceil(xa*u/(n+u)),n=xa-p);l={directional:p,point:n};n=u=0;for(p=b.length;n<p;n++)v=b[n],v instanceof THREE.SpotLight&&v.castShadow&&u++;var t=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)t=e.bones.length;var w;a:{p=a.fragmentShader;v=a.vertexShader;var n=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,
+vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:l.directional,maxPointLights:l.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},x,e=[];k?e.push(k):(e.push(p),e.push(v));for(x in c)e.push(x),
+e.push(c[x]);k=e.join();x=0;for(e=Z.length;x<e;x++)if(Z[x].code===k){w=Z[x].program;break a}x=o.createProgram();e=[Ha?"#define VERTEX_TEXTURES":"",T.gammaInput?"#define GAMMA_INPUT":"",T.gammaOutput?"#define GAMMA_OUTPUT":"",T.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",
+c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+l=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",T.gammaInput?"#define GAMMA_INPUT":"",T.gammaOutput?"#define GAMMA_OUTPUT":"",T.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,V("fragment",l+p));o.attachShader(x,
+V("vertex",e+v));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms={};x.attributes={};var y,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in n)e.push(y);y=e;e=0;for(n=y.length;e<n;e++)p=y[e],x.uniforms[p]=o.getUniformLocation(x,
+p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<c.maxMorphTargets;y++)e.push("morphTarget"+y);for(w in b)e.push(w);w=e;y=0;for(b=w.length;y<b;y++)c=w[y],x.attributes[c]=o.getAttribLocation(x,c);x.id=Z.length;Z.push({program:x,code:k});T.info.memory.programs=Z.length;w=x}a.program=w;w=a.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);
+w.tangent>=0&&o.enableVertexAttribArray(w.tangent);a.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),o.enableVertexAttribArray(w.skinWeight));if(a.attributes)for(h in a.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)y="morphTarget"+h,w[y]>=0&&(o.enableVertexAttribArray(w[y]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){L(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){z(a,b)};this.render=function(a,b,c,e){var aa,Y,ja,A,D,J,ga,K=a.lights,ra=a.fog;R=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&z(a,b);T.info.render.calls=0;T.info.render.vertices=0;T.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ea);b.projectionMatrix.flattenToArray(va);Da.multiply(b.projectionMatrix,b.matrixWorldInverse);u(Da);L(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);ja=a.__webglObjects.length;for(e=0;e<ja;e++)if(D=a.__webglObjects[e],J=D.object,J.visible)if(!(J instanceof THREE.Mesh)||!J.frustumCulled||y(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),
+C(J,b,!0),x(D),D.render=!0,this.sortObjects)J.renderDepth?D.z=J.renderDepth:(Ca.copy(J.position),Da.multiplyVector3(Ca),D.z=Ca.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(w);A=a.__webglObjectsImmediate.length;for(e=0;e<A;e++)D=a.__webglObjectsImmediate[e],J=D.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),C(J,b,!0),v(D));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);F(a.overrideMaterial.blending);for(e=0;e<ja;e++)if(D=
+a.__webglObjects[e],D.render)J=D.object,ga=D.buffer,k(J),f(b,K,ra,a.overrideMaterial,ga,J);for(e=0;e<A;e++)D=a.__webglObjectsImmediate[e],J=D.object,J.visible&&(X=-1,k(J),aa=l(b,K,ra,a.overrideMaterial,J),J.immediateRenderCallback?J.immediateRenderCallback(aa,o,sa):J.render(function(b){h(b,aa,a.overrideMaterial.shading)}))}else{F(THREE.NormalBlending);for(e=ja-1;e>=0;e--)if(D=a.__webglObjects[e],D.render&&(J=D.object,ga=D.buffer,Y=D.opaque))k(J),n(Y.depthTest),p(Y.depthWrite),t(Y.polygonOffset,Y.polygonOffsetFactor,
+Y.polygonOffsetUnits),f(b,K,ra,Y,ga,J);for(e=0;e<A;e++)if(D=a.__webglObjectsImmediate[e],J=D.object,J.visible&&(X=-1,Y=D.opaque))k(J),n(Y.depthTest),p(Y.depthWrite),t(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),aa=l(b,K,ra,Y,J),J.immediateRenderCallback?J.immediateRenderCallback(aa,o,sa):J.render(function(a){h(a,aa,Y.shading)});for(e=0;e<ja;e++)if(D=a.__webglObjects[e],D.render&&(J=D.object,ga=D.buffer,Y=D.transparent))k(J),F(Y.blending),n(Y.depthTest),p(Y.depthWrite),t(Y.polygonOffset,
+Y.polygonOffsetFactor,Y.polygonOffsetUnits),f(b,K,ra,Y,ga,J);for(e=0;e<A;e++)if(D=a.__webglObjectsImmediate[e],J=D.object,J.visible&&(X=-1,Y=D.transparent))k(J),F(Y.blending),n(Y.depthTest),p(Y.depthWrite),t(Y.polygonOffset,Y.polygonOffsetFactor,Y.polygonOffsetUnits),aa=l(b,K,ra,Y,J),J.immediateRenderCallback?J.immediateRenderCallback(aa,o,sa):J.render(function(a){h(a,aa,Y.shading)})}a.__webglSprites.length&&B(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&G(c)};this.initWebGLObjects=
+function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,l=void 0,k=void 0,n=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){k=f.geometry;if(k.geometryGroups===
+void 0){var n=k,p=void 0,v=void 0,u=void 0,t=void 0,w=u=void 0,x=void 0,y={},aa=n.morphTargets.length;n.geometryGroups={};p=0;for(v=n.faces.length;p<v;p++)u=n.faces[p],t=u.materialIndex,w=t!==void 0?t:-1,y[w]===void 0&&(y[w]={hash:w,counter:0}),x=y[w].hash+"_"+y[w].counter,n.geometryGroups[x]===void 0&&(n.geometryGroups[x]={faces:[],materialIndex:t,vertices:0,numMorphTargets:aa}),u=u instanceof THREE.Face3?3:4,n.geometryGroups[x].vertices+u>65535&&(y[w].counter+=1,x=y[w].hash+"_"+y[w].counter,n.geometryGroups[x]===
+void 0&&(n.geometryGroups[x]={faces:[],materialIndex:t,vertices:0,numMorphTargets:aa})),n.geometryGroups[x].faces.push(p),n.geometryGroups[x].vertices+=u;n.geometryGroupsList=[];p=void 0;for(p in n.geometryGroups)n.geometryGroups[p].id=la++,n.geometryGroupsList.push(n.geometryGroups[p])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){p=n;p.__webglVertexBuffer=o.createBuffer();p.__webglNormalBuffer=o.createBuffer();p.__webglTangentBuffer=o.createBuffer();p.__webglColorBuffer=
+o.createBuffer();p.__webglUVBuffer=o.createBuffer();p.__webglUV2Buffer=o.createBuffer();p.__webglSkinVertexABuffer=o.createBuffer();p.__webglSkinVertexBBuffer=o.createBuffer();p.__webglSkinIndicesBuffer=o.createBuffer();p.__webglSkinWeightsBuffer=o.createBuffer();p.__webglFaceBuffer=o.createBuffer();p.__webglLineBuffer=o.createBuffer();if(p.numMorphTargets){t=v=void 0;p.__webglMorphTargetsBuffers=[];v=0;for(t=p.numMorphTargets;v<t;v++)p.__webglMorphTargetsBuffers.push(o.createBuffer())}T.info.memory.geometries++;
+for(var t=f,Y=u=y=void 0,w=Y=aa=Y=void 0,x=w=p=0,z=u=void 0,ja=void 0,u=v=aa=y=void 0,aa=t.geometry,z=aa.faces,ja=n.faces,y=0,u=ja.length;y<u;y++)Y=ja[y],Y=z[Y],Y instanceof THREE.Face3?(p+=3,w+=1,x+=3):Y instanceof THREE.Face4&&(p+=4,w+=2,x+=4);y=b(t,n);u=y.map||y.lightMap||y instanceof THREE.ShaderMaterial?!0:!1;ja=y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial?!1:y&&y.shading!==void 0&&y.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;
+z=y.vertexColors?y.vertexColors:!1;n.__vertexArray=new Float32Array(p*3);if(ja)n.__normalArray=new Float32Array(p*3);if(aa.hasTangents)n.__tangentArray=new Float32Array(p*4);if(z)n.__colorArray=new Float32Array(p*3);if(u){if(aa.faceUvs.length>0||aa.faceVertexUvs.length>0)n.__uvArray=new Float32Array(p*2);if(aa.faceUvs.length>1||aa.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(t.geometry.skinWeights.length&&t.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=
+new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(w*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];aa=0;for(Y=n.numMorphTargets;aa<Y;aa++)n.__morphTargetsArrays.push(new Float32Array(p*3))}n.__needsSmoothNormals=ja===THREE.SmoothShading;n.__uvType=u;n.__vertexColorType=z;n.__normalType=ja;n.__webglFaceCount=w*3;n.__webglLineCount=x*2;if(y.attributes){if(n.__webglCustomAttributesList===
+void 0)n.__webglCustomAttributesList=[];t=void 0;for(t in y.attributes){u=y.attributes[t];aa={};for(v in u)aa[v]=u[v];if(!aa.__webglInitialized||aa.createUniqueBuffers)aa.__webglInitialized=!0,w=1,aa.type==="v2"?w=2:aa.type==="v3"?w=3:aa.type==="v4"?w=4:aa.type==="c"&&(w=3),aa.size=w,aa.array=new Float32Array(p*w),aa.buffer=o.createBuffer(),aa.buffer.belongsToAttribute=t,u.needsUpdate=!0,aa.__original=u;n.__webglCustomAttributesList.push(aa)}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=
+!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(k=f.geometry,!k.__webglVertexBuffer)n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),T.info.memory.geometries++,n=k,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglVertexCount=p,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.Line){if(k=f.geometry,!k.__webglVertexBuffer)n=
+k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),T.info.memory.geometries++,n=k,p=f,v=n.vertices.length,n.__vertexArray=new Float32Array(v*3),n.__colorArray=new Float32Array(v*3),n.__webglLineCount=v,c(n,p),k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(k=f.geometry,!k.__webglVertexBuffer))n=k,n.__webglVertexBuffer=o.createBuffer(),n.__webglColorBuffer=o.createBuffer(),T.info.geometries++,n=k,p=f,v=n.vertices.length,n.__vertexArray=
+new Float32Array(v*3),n.__colorArray=new Float32Array(v*3),n.__sortArray=[],n.__webglParticleCount=v,c(n,p),k.__dirtyVertices=!0,k.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(l in k=f.geometry,k.geometryGroups)n=k.geometryGroups[l],P(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(k=f.geometry,P(h.__webglObjects,k,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?
+h.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):f instanceof THREE.Sprite&&h.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];h=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)K(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;l=f;for(k=h.length-1;k>=0;k--)h[k]===l&&h.splice(k,1)}else(f instanceof THREE.MarchingCubes||
+f.immediateRenderCallback)&&K(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(n=a.__webglObjects[f].object,l=n.geometry,k=w=t=void 0,n instanceof THREE.Mesh){p=0;for(v=l.geometryGroupsList.length;p<v;p++)if(t=l.geometryGroupsList[p],k=b(n,t),w=k.attributes&&A(k),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||w)if(w=o.DYNAMIC_DRAW,x=!l.dynamic,
+t.__inittedArrays){var B=aa=y=void 0,J=void 0,C=B=void 0,ga=void 0,ra=void 0,L=void 0,R=Y=ja=z=u=void 0,H=void 0,F=void 0,da=void 0,M=void 0,O=J=L=J=ra=ga=void 0,G=void 0,I=G=O=ga=void 0,E=void 0,I=G=O=B=B=C=G=O=J=I=G=O=E=I=G=O=E=I=G=O=void 0,N=0,Q=0,ta=0,Z=0,ua=0,xa=0,U=0,ea=0,X=0,S=0,pa=0,V=I=0,V=void 0,W=t.__vertexArray,na=t.__uvArray,ka=t.__uv2Array,ia=t.__normalArray,oa=t.__tangentArray,fa=t.__colorArray,$=t.__skinVertexAArray,qa=t.__skinVertexBArray,ca=t.__skinIndexArray,ha=t.__skinWeightArray,
+sa=t.__morphTargetsArrays,ma=t.__webglCustomAttributesList,E=void 0,za=t.__faceArray,ya=t.__lineArray,Da=t.__needsSmoothNormals,z=t.__vertexColorType,u=t.__uvType,ja=t.__normalType,va=n.geometry,Ca=va.__dirtyVertices,Ba=va.__dirtyElements,Fa=va.__dirtyUvs,Ha=va.__dirtyNormals,Ea=va.__dirtyTangents,Ra=va.__dirtyColors,Ga=va.__dirtyMorphTargets,Na=va.vertices,$a=t.faces,cb=va.faces,ab=va.faceVertexUvs[0],bb=va.faceVertexUvs[1],Oa=va.skinVerticesA,Pa=va.skinVerticesB,Qa=va.skinIndices,Ka=va.skinWeights,
+Ja=va.morphTargets;if(ma){O=0;for(G=ma.length;O<G;O++)ma[O].offset=0,ma[O].offsetSrc=0}y=0;for(aa=$a.length;y<aa;y++)if(B=$a[y],J=cb[B],ab&&(Y=ab[B]),bb&&(R=bb[B]),B=J.vertexNormals,C=J.normal,ga=J.vertexColors,ra=J.color,L=J.vertexTangents,J instanceof THREE.Face3){if(Ca)H=Na[J.a].position,F=Na[J.b].position,da=Na[J.c].position,W[Q]=H.x,W[Q+1]=H.y,W[Q+2]=H.z,W[Q+3]=F.x,W[Q+4]=F.y,W[Q+5]=F.z,W[Q+6]=da.x,W[Q+7]=da.y,W[Q+8]=da.z,Q+=9;if(ma){O=0;for(G=ma.length;O<G;O++)if(E=ma[O],E.__original.needsUpdate)I=
+E.offset,V=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[J.a],E.array[I+1]=E.value[J.b],E.array[I+2]=E.value[J.c]):E.boundTo==="faces"?(V=E.value[V],E.array[I]=V,E.array[I+1]=V,E.array[I+2]=V,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[V],E.array[I+1]=E.value[V+1],E.array[I+2]=E.value[V+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(H=E.value[J.a],F=E.value[J.b],da=E.value[J.c]):E.boundTo==="faces"?(da=F=H=V=
+E.value[V],E.offsetSrc++):E.boundTo==="faceVertices"&&(H=E.value[V],F=E.value[V+1],da=E.value[V+2],E.offsetSrc+=3),E.size===2?(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=F.x,E.array[I+3]=F.y,E.array[I+4]=da.x,E.array[I+5]=da.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[I]=H.r,E.array[I+1]=H.g,E.array[I+2]=H.b,E.array[I+3]=F.r,E.array[I+4]=F.g,E.array[I+5]=F.b,E.array[I+6]=da.r,E.array[I+7]=da.g,E.array[I+8]=da.b):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=F.x,E.array[I+4]=
+F.y,E.array[I+5]=F.z,E.array[I+6]=da.x,E.array[I+7]=da.y,E.array[I+8]=da.z),E.offset+=9):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=H.w,E.array[I+4]=F.x,E.array[I+5]=F.y,E.array[I+6]=F.z,E.array[I+7]=F.w,E.array[I+8]=da.x,E.array[I+9]=da.y,E.array[I+10]=da.z,E.array[I+11]=da.w,E.offset+=12))}if(Ga){O=0;for(G=Ja.length;O<G;O++)H=Ja[O].vertices[J.a].position,F=Ja[O].vertices[J.b].position,da=Ja[O].vertices[J.c].position,I=sa[O],I[pa]=H.x,I[pa+1]=H.y,I[pa+2]=H.z,I[pa+3]=F.x,I[pa+
+4]=F.y,I[pa+5]=F.z,I[pa+6]=da.x,I[pa+7]=da.y,I[pa+8]=da.z;pa+=9}if(Ka.length)O=Ka[J.a],G=Ka[J.b],I=Ka[J.c],ha[S]=O.x,ha[S+1]=O.y,ha[S+2]=O.z,ha[S+3]=O.w,ha[S+4]=G.x,ha[S+5]=G.y,ha[S+6]=G.z,ha[S+7]=G.w,ha[S+8]=I.x,ha[S+9]=I.y,ha[S+10]=I.z,ha[S+11]=I.w,O=Qa[J.a],G=Qa[J.b],I=Qa[J.c],ca[S]=O.x,ca[S+1]=O.y,ca[S+2]=O.z,ca[S+3]=O.w,ca[S+4]=G.x,ca[S+5]=G.y,ca[S+6]=G.z,ca[S+7]=G.w,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=I.w,O=Oa[J.a],G=Oa[J.b],I=Oa[J.c],$[S]=O.x,$[S+1]=O.y,$[S+2]=O.z,$[S+3]=1,$[S+4]=
+G.x,$[S+5]=G.y,$[S+6]=G.z,$[S+7]=1,$[S+8]=I.x,$[S+9]=I.y,$[S+10]=I.z,$[S+11]=1,O=Pa[J.a],G=Pa[J.b],I=Pa[J.c],qa[S]=O.x,qa[S+1]=O.y,qa[S+2]=O.z,qa[S+3]=1,qa[S+4]=G.x,qa[S+5]=G.y,qa[S+6]=G.z,qa[S+7]=1,qa[S+8]=I.x,qa[S+9]=I.y,qa[S+10]=I.z,qa[S+11]=1,S+=12;if(Ra&&z)ga.length===3&&z===THREE.VertexColors?(J=ga[0],O=ga[1],G=ga[2]):G=O=J=ra,fa[X]=J.r,fa[X+1]=J.g,fa[X+2]=J.b,fa[X+3]=O.r,fa[X+4]=O.g,fa[X+5]=O.b,fa[X+6]=G.r,fa[X+7]=G.g,fa[X+8]=G.b,X+=9;if(Ea&&va.hasTangents)ga=L[0],ra=L[1],J=L[2],oa[U]=ga.x,
+oa[U+1]=ga.y,oa[U+2]=ga.z,oa[U+3]=ga.w,oa[U+4]=ra.x,oa[U+5]=ra.y,oa[U+6]=ra.z,oa[U+7]=ra.w,oa[U+8]=J.x,oa[U+9]=J.y,oa[U+10]=J.z,oa[U+11]=J.w,U+=12;if(Ha&&ja)if(B.length===3&&Da)for(O=0;O<3;O++)C=B[O],ia[xa]=C.x,ia[xa+1]=C.y,ia[xa+2]=C.z,xa+=3;else for(O=0;O<3;O++)ia[xa]=C.x,ia[xa+1]=C.y,ia[xa+2]=C.z,xa+=3;if(Fa&&Y!==void 0&&u)for(O=0;O<3;O++)B=Y[O],na[ta]=B.u,na[ta+1]=B.v,ta+=2;if(Fa&&R!==void 0&&u)for(O=0;O<3;O++)B=R[O],ka[Z]=B.u,ka[Z+1]=B.v,Z+=2;Ba&&(za[ua]=N,za[ua+1]=N+1,za[ua+2]=N+2,ua+=3,ya[ea]=
+N,ya[ea+1]=N+1,ya[ea+2]=N,ya[ea+3]=N+2,ya[ea+4]=N+1,ya[ea+5]=N+2,ea+=6,N+=3)}else if(J instanceof THREE.Face4){if(Ca)H=Na[J.a].position,F=Na[J.b].position,da=Na[J.c].position,M=Na[J.d].position,W[Q]=H.x,W[Q+1]=H.y,W[Q+2]=H.z,W[Q+3]=F.x,W[Q+4]=F.y,W[Q+5]=F.z,W[Q+6]=da.x,W[Q+7]=da.y,W[Q+8]=da.z,W[Q+9]=M.x,W[Q+10]=M.y,W[Q+11]=M.z,Q+=12;if(ma){O=0;for(G=ma.length;O<G;O++)if(E=ma[O],E.__original.needsUpdate)I=E.offset,V=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[I]=E.value[J.a],
+E.array[I+1]=E.value[J.b],E.array[I+2]=E.value[J.c],E.array[I+3]=E.value[J.d]):E.boundTo==="faces"?(V=E.value[V],E.array[I]=V,E.array[I+1]=V,E.array[I+2]=V,E.array[I+3]=V,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[I]=E.value[V],E.array[I+1]=E.value[V+1],E.array[I+2]=E.value[V+2],E.array[I+3]=E.value[V+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(H=E.value[J.a],F=E.value[J.b],da=E.value[J.c],M=E.value[J.d]):E.boundTo==="faces"?(M=da=F=H=V=E.value[V],E.offsetSrc++):
+E.boundTo==="faceVertices"&&(H=E.value[V],F=E.value[V+1],da=E.value[V+2],M=E.value[V+3],E.offsetSrc+=4),E.size===2?(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=F.x,E.array[I+3]=F.y,E.array[I+4]=da.x,E.array[I+5]=da.y,E.array[I+6]=M.x,E.array[I+7]=M.y,E.offset+=8):E.size===3?(E.type==="c"?(E.array[I]=H.r,E.array[I+1]=H.g,E.array[I+2]=H.b,E.array[I+3]=F.r,E.array[I+4]=F.g,E.array[I+5]=F.b,E.array[I+6]=da.r,E.array[I+7]=da.g,E.array[I+8]=da.b,E.array[I+9]=M.r,E.array[I+10]=M.g,E.array[I+11]=M.b):(E.array[I]=
+H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=F.x,E.array[I+4]=F.y,E.array[I+5]=F.z,E.array[I+6]=da.x,E.array[I+7]=da.y,E.array[I+8]=da.z,E.array[I+9]=M.x,E.array[I+10]=M.y,E.array[I+11]=M.z),E.offset+=12):(E.array[I]=H.x,E.array[I+1]=H.y,E.array[I+2]=H.z,E.array[I+3]=H.w,E.array[I+4]=F.x,E.array[I+5]=F.y,E.array[I+6]=F.z,E.array[I+7]=F.w,E.array[I+8]=da.x,E.array[I+9]=da.y,E.array[I+10]=da.z,E.array[I+11]=da.w,E.array[I+12]=M.x,E.array[I+13]=M.y,E.array[I+14]=M.z,E.array[I+15]=M.w,E.offset+=
+16))}if(Ga){O=0;for(G=Ja.length;O<G;O++)H=Ja[O].vertices[J.a].position,F=Ja[O].vertices[J.b].position,da=Ja[O].vertices[J.c].position,M=Ja[O].vertices[J.d].position,I=sa[O],I[pa]=H.x,I[pa+1]=H.y,I[pa+2]=H.z,I[pa+3]=F.x,I[pa+4]=F.y,I[pa+5]=F.z,I[pa+6]=da.x,I[pa+7]=da.y,I[pa+8]=da.z,I[pa+9]=M.x,I[pa+10]=M.y,I[pa+11]=M.z;pa+=12}if(Ka.length)O=Ka[J.a],G=Ka[J.b],I=Ka[J.c],E=Ka[J.d],ha[S]=O.x,ha[S+1]=O.y,ha[S+2]=O.z,ha[S+3]=O.w,ha[S+4]=G.x,ha[S+5]=G.y,ha[S+6]=G.z,ha[S+7]=G.w,ha[S+8]=I.x,ha[S+9]=I.y,ha[S+
+10]=I.z,ha[S+11]=I.w,ha[S+12]=E.x,ha[S+13]=E.y,ha[S+14]=E.z,ha[S+15]=E.w,O=Qa[J.a],G=Qa[J.b],I=Qa[J.c],E=Qa[J.d],ca[S]=O.x,ca[S+1]=O.y,ca[S+2]=O.z,ca[S+3]=O.w,ca[S+4]=G.x,ca[S+5]=G.y,ca[S+6]=G.z,ca[S+7]=G.w,ca[S+8]=I.x,ca[S+9]=I.y,ca[S+10]=I.z,ca[S+11]=I.w,ca[S+12]=E.x,ca[S+13]=E.y,ca[S+14]=E.z,ca[S+15]=E.w,O=Oa[J.a],G=Oa[J.b],I=Oa[J.c],E=Oa[J.d],$[S]=O.x,$[S+1]=O.y,$[S+2]=O.z,$[S+3]=1,$[S+4]=G.x,$[S+5]=G.y,$[S+6]=G.z,$[S+7]=1,$[S+8]=I.x,$[S+9]=I.y,$[S+10]=I.z,$[S+11]=1,$[S+12]=E.x,$[S+13]=E.y,$[S+
+14]=E.z,$[S+15]=1,O=Pa[J.a],G=Pa[J.b],I=Pa[J.c],J=Pa[J.d],qa[S]=O.x,qa[S+1]=O.y,qa[S+2]=O.z,qa[S+3]=1,qa[S+4]=G.x,qa[S+5]=G.y,qa[S+6]=G.z,qa[S+7]=1,qa[S+8]=I.x,qa[S+9]=I.y,qa[S+10]=I.z,qa[S+11]=1,qa[S+12]=J.x,qa[S+13]=J.y,qa[S+14]=J.z,qa[S+15]=1,S+=16;if(Ra&&z)ga.length===4&&z===THREE.VertexColors?(J=ga[0],O=ga[1],G=ga[2],ga=ga[3]):ga=G=O=J=ra,fa[X]=J.r,fa[X+1]=J.g,fa[X+2]=J.b,fa[X+3]=O.r,fa[X+4]=O.g,fa[X+5]=O.b,fa[X+6]=G.r,fa[X+7]=G.g,fa[X+8]=G.b,fa[X+9]=ga.r,fa[X+10]=ga.g,fa[X+11]=ga.b,X+=12;if(Ea&&
+va.hasTangents)ga=L[0],ra=L[1],J=L[2],L=L[3],oa[U]=ga.x,oa[U+1]=ga.y,oa[U+2]=ga.z,oa[U+3]=ga.w,oa[U+4]=ra.x,oa[U+5]=ra.y,oa[U+6]=ra.z,oa[U+7]=ra.w,oa[U+8]=J.x,oa[U+9]=J.y,oa[U+10]=J.z,oa[U+11]=J.w,oa[U+12]=L.x,oa[U+13]=L.y,oa[U+14]=L.z,oa[U+15]=L.w,U+=16;if(Ha&&ja)if(B.length===4&&Da)for(O=0;O<4;O++)C=B[O],ia[xa]=C.x,ia[xa+1]=C.y,ia[xa+2]=C.z,xa+=3;else for(O=0;O<4;O++)ia[xa]=C.x,ia[xa+1]=C.y,ia[xa+2]=C.z,xa+=3;if(Fa&&Y!==void 0&&u)for(O=0;O<4;O++)B=Y[O],na[ta]=B.u,na[ta+1]=B.v,ta+=2;if(Fa&&R!==void 0&&
+u)for(O=0;O<4;O++)B=R[O],ka[Z]=B.u,ka[Z+1]=B.v,Z+=2;Ba&&(za[ua]=N,za[ua+1]=N+1,za[ua+2]=N+3,za[ua+3]=N+1,za[ua+4]=N+2,za[ua+5]=N+3,ua+=6,ya[ea]=N,ya[ea+1]=N+1,ya[ea+2]=N,ya[ea+3]=N+3,ya[ea+4]=N+1,ya[ea+5]=N+2,ya[ea+6]=N+2,ya[ea+7]=N+3,ea+=8,N+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,W,w));if(ma){O=0;for(G=ma.length;O<G;O++)E=ma[O],E.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,w))}if(Ga){O=0;for(G=
+Ja.length;O<G;O++)o.bindBuffer(o.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[O]),o.bufferData(o.ARRAY_BUFFER,sa[O],w)}Ra&&X>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,w));Ha&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,ia,w));Ea&&va.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,oa,w));Fa&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,na,w));
+Fa&&Z>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ka,w));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,za,w),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ya,w));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,$,w),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,qa,w),o.bindBuffer(o.ARRAY_BUFFER,
+t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ca,w),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ha,w));x&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}l.__dirtyVertices=!1;l.__dirtyMorphTargets=
+!1;l.__dirtyElements=!1;l.__dirtyUvs=!1;l.__dirtyNormals=!1;l.__dirtyColors=!1;l.__dirtyTangents=!1;k.attributes&&D(k)}else if(n instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;n=o.DYNAMIC_DRAW;p=y=x=x=void 0;aa=k.vertices;v=k.colors;u=aa.length;t=v.length;z=k.__vertexArray;w=k.__colorArray;ja=k.__dirtyColors;if(k.__dirtyVertices){for(x=0;x<u;x++)y=aa[x].position,p=x*3,z[p]=y.x,z[p+1]=y.y,z[p+2]=y.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,
+z,n)}if(ja){for(x=0;x<t;x++)color=v[x],p=x*3,w[p]=color.r,w[p+1]=color.g,w[p+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,w,n)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(n instanceof THREE.Line){k=b(n,t);w=k.attributes&&A(k);if(l.__dirtyVertices||l.__dirtyColors||w){n=l;p=o.DYNAMIC_DRAW;v=R=aa=Y=void 0;aa=n.vertices;t=n.colors;u=aa.length;w=t.length;z=n.__vertexArray;x=n.__colorArray;ja=n.__dirtyColors;y=n.__webglCustomAttributesList;M=da=F=H=R=Y=
+void 0;if(n.__dirtyVertices){for(Y=0;Y<u;Y++)R=aa[Y].position,v=Y*3,z[v]=R.x,z[v+1]=R.y,z[v+2]=R.z;o.bindBuffer(o.ARRAY_BUFFER,n.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,p)}if(ja){for(aa=0;aa<w;aa++)color=t[aa],v=aa*3,x[v]=color.r,x[v+1]=color.g,x[v+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,n.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,x,p)}if(y){Y=0;for(R=y.length;Y<R;Y++)if(M=y[Y],M.__original.needsUpdate&&(M.boundTo===void 0||M.boundTo==="vertices")){v=0;F=M.value.length;for(H=0;H<F;H++)M.size===
+1?M.array[v]=M.value[H]:(da=M.value[H],M.size===2?(M.array[v]=da.x,M.array[v+1]=da.y):M.size===3?M.type==="c"?(M.array[v]=da.r,M.array[v+1]=da.g,M.array[v+2]=da.b):(M.array[v]=da.x,M.array[v+1]=da.y,M.array[v+2]=da.z):(M.array[v]=da.x,M.array[v+1]=da.y,M.array[v+2]=da.z,M.array[v+3]=da.w)),v+=M.size;o.bindBuffer(o.ARRAY_BUFFER,M.buffer);o.bufferData(o.ARRAY_BUFFER,M.array,p)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;k.attributes&&D(k)}else if(n instanceof THREE.ParticleSystem)k=b(n,t),w=k.attributes&&
+A(k),(l.__dirtyVertices||l.__dirtyColors||n.sortParticles||w)&&e(l,o.DYNAMIC_DRAW,n),l.__dirtyVertices=!1,l.__dirtyColors=!1,k.attributes&&D(k)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),a==="back"?o.cullFace(o.BACK):a==="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ha}};
 THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
 THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
@@ -350,19 +351,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
 THREE.ColorUtils={adjustHSV:function(a,c,b,e){var l=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,l);l.h=THREE.Math.clamp(l.h+c,0,1);l.s=THREE.Math.clamp(l.s+b,0,1);l.v=THREE.Math.clamp(l.v+e,0,1);a.setHSV(l.h,l.s,l.v)},rgbToHsv:function(a,c){var b=a.r,e=a.g,l=a.b,f=Math.max(Math.max(b,e),l),h=Math.min(Math.min(b,e),l);if(h===f)h=b=0;else{var k=f-h,h=k/f,b=b===f?(e-l)/k:e===f?2+(l-b)/k:4+(b-e)/k;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=h;c.v=f;return c}};
 THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(a,c){for(var b,e,l=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,h=a.vertices,k=f.vertices,n=a.faces,t=f.faces,p=a.faceVertexUvs[0],v=f.faceVertexUvs[0],x={},u=0;u<a.materials.length;u++)x[a.materials[u].id]=u;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var u=0,y=k.length;u<y;u++){var w=new THREE.Vertex(k[u].position.clone());b&&b.multiplyVector3(w.position);h.push(w)}u=
-0;for(y=t.length;u<y;u++){var h=t[u],A,B,D=h.vertexNormals,z=h.vertexColors;h instanceof THREE.Face3?A=new THREE.Face3(h.a+l,h.b+l,h.c+l):h instanceof THREE.Face4&&(A=new THREE.Face4(h.a+l,h.b+l,h.c+l,h.d+l));A.normal.copy(h.normal);e&&e.multiplyVector3(A.normal);k=0;for(w=D.length;k<w;k++)B=D[k].clone(),e&&e.multiplyVector3(B),A.vertexNormals.push(B);A.color.copy(h.color);k=0;for(w=z.length;k<w;k++)B=z[k],A.vertexColors.push(B.clone());if(h.materialIndex!==void 0){k=f.materials[h.materialIndex];
-w=x[k.id];if(w===void 0)w=a.materials.length,a.materials.push(k);A.materialIndex=w}A.centroid.copy(h.centroid);b&&b.multiplyVector3(A.centroid);n.push(A)}u=0;for(y=v.length;u<y;u++){b=v[u];e=[];k=0;for(w=b.length;k<w;k++)e.push(new THREE.UV(b[k].u,b[k].v));p.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,l=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var h=new THREE.Vertex(e[a].position.clone());c.vertices.push(h)}a=0;
-for(b=l.length;a<b;a++){var k=l[a],n,t,p=k.vertexNormals,v=k.vertexColors;k instanceof THREE.Face3?n=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(n=new THREE.Face4(k.a,k.b,k.c,k.d));n.normal.copy(k.normal);e=0;for(h=p.length;e<h;e++)t=p[e],n.vertexNormals.push(t.clone());n.color.copy(k.color);e=0;for(h=v.length;e<h;e++)t=v[e],n.vertexColors.push(t.clone());n.materialIndex=k.materialIndex;n.centroid.copy(k.centroid);c.faces.push(n)}a=0;for(b=f.length;a<b;a++){l=f[a];n=[];e=0;for(h=l.length;e<
+THREE.GeometryUtils={merge:function(a,c){for(var b,e,l=a.vertices.length,f=c instanceof THREE.Mesh?c.geometry:c,h=a.vertices,k=f.vertices,n=a.faces,p=f.faces,t=a.faceVertexUvs[0],u=f.faceVertexUvs[0],y={},v=0;v<a.materials.length;v++)y[a.materials[v].id]=v;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var v=0,x=k.length;v<x;v++){var w=new THREE.Vertex(k[v].position.clone());b&&b.multiplyVector3(w.position);h.push(w)}v=
+0;for(x=p.length;v<x;v++){var h=p[v],z,B,C=h.vertexNormals,A=h.vertexColors;h instanceof THREE.Face3?z=new THREE.Face3(h.a+l,h.b+l,h.c+l):h instanceof THREE.Face4&&(z=new THREE.Face4(h.a+l,h.b+l,h.c+l,h.d+l));z.normal.copy(h.normal);e&&e.multiplyVector3(z.normal);k=0;for(w=C.length;k<w;k++)B=C[k].clone(),e&&e.multiplyVector3(B),z.vertexNormals.push(B);z.color.copy(h.color);k=0;for(w=A.length;k<w;k++)B=A[k],z.vertexColors.push(B.clone());if(h.materialIndex!==void 0){k=f.materials[h.materialIndex];
+w=y[k.id];if(w===void 0)w=a.materials.length,a.materials.push(k);z.materialIndex=w}z.centroid.copy(h.centroid);b&&b.multiplyVector3(z.centroid);n.push(z)}v=0;for(x=u.length;v<x;v++){b=u[v];e=[];k=0;for(w=b.length;k<w;k++)e.push(new THREE.UV(b[k].u,b[k].v));t.push(e)}},clone:function(a){var c=new THREE.Geometry,b,e=a.vertices,l=a.faces,f=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=e.length;a<b;a++){var h=new THREE.Vertex(e[a].position.clone());c.vertices.push(h)}a=0;
+for(b=l.length;a<b;a++){var k=l[a],n,p,t=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?n=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(n=new THREE.Face4(k.a,k.b,k.c,k.d));n.normal.copy(k.normal);e=0;for(h=t.length;e<h;e++)p=t[e],n.vertexNormals.push(p.clone());n.color.copy(k.color);e=0;for(h=u.length;e<h;e++)p=u[e],n.vertexColors.push(p.clone());n.materialIndex=k.materialIndex;n.centroid.copy(k.centroid);c.faces.push(n)}a=0;for(b=f.length;a<b;a++){l=f[a];n=[];e=0;for(h=l.length;e<
 h;e++)n.push(new THREE.UV(l[e].u,l[e].v));c.faceVertexUvs[0].push(n)}return c},randomPointInTriangle:function(a,c,b){var e,l,f,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;e=THREE.GeometryUtils.random();l=THREE.GeometryUtils.random();e+l>1&&(e=1-e,l=1-l);f=1-e-l;h.copy(a);h.multiplyScalar(e);k.copy(c);k.multiplyScalar(l);h.addSelf(k);k.copy(b);k.multiplyScalar(f);h.addSelf(k);return h},randomPointInFace:function(a,c,b){var e,l,f;if(a instanceof THREE.Face3)return e=c.vertices[a.a].position,l=c.vertices[a.b].position,
 f=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(e,l,f);else if(a instanceof THREE.Face4){e=c.vertices[a.a].position;l=c.vertices[a.b].position;f=c.vertices[a.c].position;var c=c.vertices[a.d].position,h;b?a._area1&&a._area2?(b=a._area1,h=a._area2):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c),a._area1=b,a._area2=h):(b=THREE.GeometryUtils.triangleArea(e,l,c),h=THREE.GeometryUtils.triangleArea(l,f,c));return THREE.GeometryUtils.random()*(b+
-h)<b?THREE.GeometryUtils.randomPointInTriangle(e,l,c):THREE.GeometryUtils.randomPointInTriangle(l,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var h=c+Math.floor((e-c)/2);return t[h]>a?b(c,h-1):t[h]<a?b(h+1,e):h}return b(0,t.length-1)}var e,l,f=a.faces,h=a.vertices,k=f.length,n=0,t=[],p,v,x,u;for(l=0;l<k;l++){e=f[l];if(e instanceof THREE.Face3)p=h[e.a].position,v=h[e.b].position,x=h[e.c].position,e._area=THREE.GeometryUtils.triangleArea(p,v,x);else if(e instanceof
-THREE.Face4)p=h[e.a].position,v=h[e.b].position,x=h[e.c].position,u=h[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(p,v,u),e._area2=THREE.GeometryUtils.triangleArea(v,x,u),e._area=e._area1+e._area2;n+=e._area;t[l]=n}e=[];h={};for(l=0;l<c;l++)k=THREE.GeometryUtils.random()*n,k=b(k),e[l]=THREE.GeometryUtils.randomPointInFace(f[k],a,!0),h[k]?h[k]+=1:h[k]=1;return e},triangleArea:function(a,c,b){var e,l=THREE.GeometryUtils.__v1;l.sub(a,c);e=l.length();l.sub(a,b);a=l.length();l.sub(c,b);b=l.length();
+h)<b?THREE.GeometryUtils.randomPointInTriangle(e,l,c):THREE.GeometryUtils.randomPointInTriangle(l,f,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,e){if(e<c)return c;var f=c+Math.floor((e-c)/2);return p[f]>a?b(c,f-1):p[f]<a?b(f+1,e):f}return b(0,p.length-1)}var e,l,f=a.faces,h=a.vertices,k=f.length,n=0,p=[],t,u,y,v;for(l=0;l<k;l++){e=f[l];if(e instanceof THREE.Face3)t=h[e.a].position,u=h[e.b].position,y=h[e.c].position,e._area=THREE.GeometryUtils.triangleArea(t,u,y);else if(e instanceof
+THREE.Face4)t=h[e.a].position,u=h[e.b].position,y=h[e.c].position,v=h[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(t,u,v),e._area2=THREE.GeometryUtils.triangleArea(u,y,v),e._area=e._area1+e._area2;n+=e._area;p[l]=n}e=[];h={};for(l=0;l<c;l++)k=THREE.GeometryUtils.random()*n,k=b(k),e[l]=THREE.GeometryUtils.randomPointInFace(f[k],a,!0),h[k]?h[k]+=1:h[k]=1;return e},triangleArea:function(a,c,b){var e,l=THREE.GeometryUtils.__v1;l.sub(a,c);e=l.length();l.sub(a,b);a=l.length();l.sub(c,b);b=l.length();
 c=0.5*(e+a+b);return Math.sqrt(c*(c-e)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(a,c,b){var e=new Image,l=new THREE.Texture(e,c);e.onload=function(){l.needsUpdate=!0;b&&b(this)};e.crossOrigin="";e.src=a;return l},loadTextureCube:function(a,c,b){var e,l=[],f=new THREE.Texture(l,c),c=l.loadCount=0;for(e=a.length;c<e;++c)l[c]=new Image,l[c].onload=function(){l.loadCount+=1;if(l.loadCount===6)f.needsUpdate=!0;b&&b(this)},l[c].crossOrigin="",l[c].src=a[c];return f},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,l=a.height,f=document.createElement("canvas");f.width=e;f.height=l;var h=f.getContext("2d");h.drawImage(a,0,0);for(var k=h.getImageData(0,0,e,l).data,n=h.createImageData(e,l),t=n.data,p=0;p<e;p++)for(var v=1;v<l;v++){var x=v-1<0?l-1:v-1,u=(v+1)%l,y=p-1<0?e-1:p-1,w=(p+1)%e,A=[],B=[0,0,k[(v*e+p)*4]/255*c];A.push([-1,0,k[(v*e+y)*4]/255*c]);A.push([-1,-1,k[(x*e+y)*4]/255*c]);A.push([0,-1,k[(x*e+p)*4]/255*c]);A.push([1,-1,k[(x*e+w)*4]/255*c]);
-A.push([1,0,k[(v*e+w)*4]/255*c]);A.push([1,1,k[(u*e+w)*4]/255*c]);A.push([0,1,k[(u*e+p)*4]/255*c]);A.push([-1,1,k[(u*e+y)*4]/255*c]);x=[];y=A.length;for(u=0;u<y;u++){var w=A[u],D=A[(u+1)%y],w=[w[0]-B[0],w[1]-B[1],w[2]-B[2]],D=[D[0]-B[0],D[1]-B[1],D[2]-B[2]];x.push(b([w[1]*D[2]-w[2]*D[1],w[2]*D[0]-w[0]*D[2],w[0]*D[1]-w[1]*D[0]]))}A=[0,0,0];for(u=0;u<x.length;u++)A[0]+=x[u][0],A[1]+=x[u][1],A[2]+=x[u][2];A[0]/=x.length;A[1]/=x.length;A[2]/=x.length;B=(v*e+p)*4;t[B]=(A[0]+1)/2*255|0;t[B+1]=(A[1]+0.5)*
-255|0;t[B+2]=A[2]*255|0;t[B+3]=255}h.putImageData(n,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,l=a.children.length;for(e=0;e<l;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,l=new THREE.Object3D;for(b=0;b<e;b++){var f=new THREE.Mesh(a,c[b]);l.add(f)}return l}};
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var e=a.width,l=a.height,f=document.createElement("canvas");f.width=e;f.height=l;var h=f.getContext("2d");h.drawImage(a,0,0);for(var k=h.getImageData(0,0,e,l).data,n=h.createImageData(e,l),p=n.data,t=0;t<e;t++)for(var u=1;u<l;u++){var y=u-1<0?l-1:u-1,v=(u+1)%l,x=t-1<0?e-1:t-1,w=(t+1)%e,z=[],B=[0,0,k[(u*e+t)*4]/255*c];z.push([-1,0,k[(u*e+x)*4]/255*c]);z.push([-1,-1,k[(y*e+x)*4]/255*c]);z.push([0,-1,k[(y*e+t)*4]/255*c]);z.push([1,-1,k[(y*e+w)*4]/255*c]);
+z.push([1,0,k[(u*e+w)*4]/255*c]);z.push([1,1,k[(v*e+w)*4]/255*c]);z.push([0,1,k[(v*e+t)*4]/255*c]);z.push([-1,1,k[(v*e+x)*4]/255*c]);y=[];x=z.length;for(v=0;v<x;v++){var w=z[v],C=z[(v+1)%x],w=[w[0]-B[0],w[1]-B[1],w[2]-B[2]],C=[C[0]-B[0],C[1]-B[1],C[2]-B[2]];y.push(b([w[1]*C[2]-w[2]*C[1],w[2]*C[0]-w[0]*C[2],w[0]*C[1]-w[1]*C[0]]))}z=[0,0,0];for(v=0;v<y.length;v++)z[0]+=y[v][0],z[1]+=y[v][1],z[2]+=y[v][2];z[0]/=y.length;z[1]/=y.length;z[2]/=y.length;B=(u*e+t)*4;p[B]=(z[0]+1)/2*255|0;p[B+1]=(z[1]+0.5)*
+255|0;p[B+2]=z[2]*255|0;p[B+3]=255}h.putImageData(n,0,0);return f}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,e,l=a.children.length;for(e=0;e<l;e++)b=a.children[e],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,e=c.length,l=new THREE.Object3D;for(b=0;b<e;b++){var f=new THREE.Mesh(a,c[b]);l.add(f)}return l}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
@@ -401,37 +402,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,e){var l=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(a,c,b,e,l,f){var h=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,e),new THREE.Vector2(l,f)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h})};
 THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
 THREE.Path.prototype.arc=function(a,c,b,e,l,f){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,e,l,f));this.actions.push({action:THREE.PathActions.ARC,args:h})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,l,f,h,k,n,t,p,v,x,u,y,w;e=0;for(l=this.actions.length;e<l;e++)switch(f=this.actions[e],h=f.action,f=f.args,h){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=f[2];n=f[3];v=f[0];x=f[1];b.length>0?(h=b[b.length-1],u=h.x,y=h.y):(h=this.actions[e-1].args,u=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b2(w,u,v,k),w=THREE.Shape.Utils.b2(w,y,x,
-n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];v=f[0];x=f[1];t=f[2];p=f[3];b.length>0?(h=b[b.length-1],u=h.x,y=h.y):(h=this.actions[e-1].args,u=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b3(w,u,v,t,k),w=THREE.Shape.Utils.b3(w,y,x,p,n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h);
-for(h=1;h<=w;h++)b.push(f.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];t=f[2];v=f[3];w=f[4];x=!!f[5];p=h[h.length-2];u=h[h.length-1];h.length==0&&(p=u=0);y=w-v;var A=a*2;for(h=1;h<=A;h++)w=h/A,x||(w=1-w),w=v+w*y,f=p+k+t*Math.cos(w),w=u+n+t*Math.sin(w),b.push(new THREE.Vector2(f,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
-THREE.Path.prototype.nltransform=function(a,c,b,e,l,f){var h=this.getPoints(),k,n,t,p,v;k=0;for(n=h.length;k<n;k++)t=h[k],p=t.x,v=t.y,t.x=a*p+c*v+b,t.y=e*v+l*p+f;return h};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,l,f,h,k,n,p,t,u,y,v,x,w;e=0;for(l=this.actions.length;e<l;e++)switch(f=this.actions[e],h=f.action,f=f.args,h){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(f[0],f[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=f[2];n=f[3];u=f[0];y=f[1];b.length>0?(h=b[b.length-1],v=h.x,x=h.y):(h=this.actions[e-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b2(w,v,u,k),w=THREE.Shape.Utils.b2(w,x,y,
+n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];u=f[0];y=f[1];p=f[2];t=f[3];b.length>0?(h=b[b.length-1],v=h.x,x=h.y):(h=this.actions[e-1].args,v=h[h.length-2],x=h[h.length-1]);for(h=1;h<=a;h++)w=h/a,f=THREE.Shape.Utils.b3(w,v,u,p,k),w=THREE.Shape.Utils.b3(w,x,y,t,n),b.push(new THREE.Vector2(f,w));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];w=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h);
+for(h=1;h<=w;h++)b.push(f.getPointAt(h/w));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];p=f[2];u=f[3];w=f[4];y=!!f[5];t=h[h.length-2];v=h[h.length-1];h.length==0&&(t=v=0);x=w-u;var z=a*2;for(h=1;h<=z;h++)w=h/z,y||(w=1-w),w=u+w*x,f=t+k+p*Math.cos(w),w=v+n+p*Math.sin(w),b.push(new THREE.Vector2(f,w))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
+THREE.Path.prototype.nltransform=function(a,c,b,e,l,f){var h=this.getPoints(),k,n,p,t,u;k=0;for(n=h.length;k<n;k++)p=h[k],t=p.x,u=p.y,p.x=a*t+c*u+b,p.y=e*u+l*t+f;return h};
 THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,e,l,a=0;for(b=this.actions.length;a<b;a++)e=this.actions[a],l=e.args,e=e.action,e!=THREE.PathActions.CSPLINE_THRU&&c[e].apply(c,l);c.stroke();c.closePath();c.strokeStyle="red";e=
 this.getPoints();a=0;for(b=e.length;a<b;a++)l=e[a],c.beginPath(),c.arc(l.x,l.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var a,c,b,e,l=[],f=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],e=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&f.actions.length!=0&&(l.push(f),f=new THREE.Path),f[b].apply(f,e);f.actions.length!=0&&l.push(f);if(l.length==0)return[];var h,f=[];if(THREE.Shape.Utils.isClockWise(l[0].getPoints())){a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(h&&f.push(h),h=new THREE.Shape,h.actions=e.actions,h.curves=
 e.curves):h.holes.push(e);f.push(h)}else{h=new THREE.Shape;a=0;for(c=l.length;a<c;a++)e=l[a],THREE.Shape.Utils.isClockWise(e.getPoints())?(h.actions=e.actions,h.curves=e.curves,f.push(h),h=new THREE.Shape):h.holes.push(e)}return f};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
 THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedPoints(a,this.bends);return e};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,e=[];for(c=0;c<b;c++)e[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return e};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),l,f,h,k,n,t,p,v,x,u,y=[];for(n=0;n<c.length;n++){t=c[n];Array.prototype.push.apply(e,t);f=Number.POSITIVE_INFINITY;for(l=0;l<t.length;l++){x=t[l];u=[];for(v=0;v<b.length;v++)p=b[v],p=x.distanceToSquared(p),u.push(p),p<f&&(f=p,h=l,k=v)}l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;var w=[t[h],b[k],b[l]];v=THREE.FontUtils.Triangulate.area(w);var A=[t[h],t[f],b[k]];x=THREE.FontUtils.Triangulate.area(A);u=k;p=h;k+=1;h+=-1;k<
-0&&(k+=b.length);k%=b.length;h<0&&(h+=t.length);h%=t.length;l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;w=[t[h],b[k],b[l]];w=THREE.FontUtils.Triangulate.area(w);A=[t[h],t[f],b[k]];A=THREE.FontUtils.Triangulate.area(A);v+x>w+A&&(k=u,h=p,k<0&&(k+=b.length),k%=b.length,h<0&&(h+=t.length),h%=t.length,l=k-1>=0?k-1:b.length-1,f=h-1>=0?h-1:t.length-1);v=b.slice(0,k);x=b.slice(k);u=t.slice(h);p=t.slice(0,h);f=[t[h],t[f],b[k]];y.push([t[h],b[k],b[l]]);y.push(f);b=v.concat(u).concat(p).concat(x)}return{shape:b,
-isolatedPts:y,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,h,k,n,t={};f=0;for(h=e.length;f<h;f++)n=e[f].x+":"+e[f].y,t[n]!==void 0&&console.log("Duplicate point",n),t[n]=f;f=0;for(h=b.length;f<h;f++){k=b[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}f=0;for(h=l.length;f<h;f++){k=l[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=t[n],n!==void 0&&(k[e]=n)}return b.concat(l)},
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),e=b.concat(),l,f,h,k,n,p,t,u,y,v,x=[];for(n=0;n<c.length;n++){p=c[n];Array.prototype.push.apply(e,p);f=Number.POSITIVE_INFINITY;for(l=0;l<p.length;l++){y=p[l];v=[];for(u=0;u<b.length;u++)t=b[u],t=y.distanceToSquared(t),v.push(t),t<f&&(f=t,h=l,k=u)}l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:p.length-1;var w=[p[h],b[k],b[l]];u=THREE.FontUtils.Triangulate.area(w);var z=[p[h],p[f],b[k]];y=THREE.FontUtils.Triangulate.area(z);v=k;t=h;k+=1;h+=-1;k<
+0&&(k+=b.length);k%=b.length;h<0&&(h+=p.length);h%=p.length;l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:p.length-1;w=[p[h],b[k],b[l]];w=THREE.FontUtils.Triangulate.area(w);z=[p[h],p[f],b[k]];z=THREE.FontUtils.Triangulate.area(z);u+y>w+z&&(k=v,h=t,k<0&&(k+=b.length),k%=b.length,h<0&&(h+=p.length),h%=p.length,l=k-1>=0?k-1:b.length-1,f=h-1>=0?h-1:p.length-1);u=b.slice(0,k);y=b.slice(k);v=p.slice(h);t=p.slice(0,h);f=[p[h],p[f],b[k]];x.push([p[h],b[k],b[l]]);x.push(f);b=u.concat(v).concat(t).concat(y)}return{shape:b,
+isolatedPts:x,allpoints:e}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),e=b.allpoints,l=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),f,h,k,n,p={};f=0;for(h=e.length;f<h;f++)n=e[f].x+":"+e[f].y,p[n]!==void 0&&console.log("Duplicate point",n),p[n]=f;f=0;for(h=b.length;f<h;f++){k=b[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=p[n],n!==void 0&&(k[e]=n)}f=0;for(h=l.length;f<h;f++){k=l[f];for(e=0;e<3;e++)n=k[e].x+":"+k[e].y,n=p[n],n!==void 0&&(k[e]=n)}return b.concat(l)},
 isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,e){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,e)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,e,l){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,e)+
 this.b3p3(a,l)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,e=c.font!==void 0?c.font:"helvetiker",l=c.weight!==void 0?c.weight:"normal",f=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=e;THREE.FontUtils.weight=l;THREE.FontUtils.style=f};
 THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,e=a.length;b<e;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
 THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var e=0;e<a.hierarchy[b].keys.length;e++){if(a.hierarchy[b].keys[e].time<
-0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var t=a.hierarchy[b].keys[e].morphTargets[n];k[t]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var p=
-{};for(t in k){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===t){p[t]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(p[t]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=p}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
+0)a.hierarchy[b].keys[e].time=0;if(a.hierarchy[b].keys[e].rot!==void 0&&!(a.hierarchy[b].keys[e].rot instanceof THREE.Quaternion)){var k=a.hierarchy[b].keys[e].rot;a.hierarchy[b].keys[e].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){k={};for(e=0;e<a.hierarchy[b].keys.length;e++)for(var n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++){var p=a.hierarchy[b].keys[e].morphTargets[n];k[p]=-1}a.hierarchy[b].usedMorphTargets=k;for(e=0;e<a.hierarchy[b].keys.length;e++){var t=
+{};for(p in k){for(n=0;n<a.hierarchy[b].keys[e].morphTargets.length;n++)if(a.hierarchy[b].keys[e].morphTargets[n]===p){t[p]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(t[p]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=t}}for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].time===a.hierarchy[b].keys[e-1].time&&(a.hierarchy[b].keys.splice(e,1),e--);for(e=1;e<a.hierarchy[b].keys.length;e++)a.hierarchy[b].keys[e].index=e}e=parseInt(a.length*
 a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(e));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else e(a,b);return b}},e=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)e(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
 2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==void 0?e:!0;this.points=[];this.target=new THREE.Vector3};
 THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,e=this.hierarchy.length,l;for(b=0;b<e;b++){l=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)l.useQuaternion=!0;l.matrixAutoUpdate=!0;if(l.animationCache===void 0)l.animationCache={},l.animationCache.prevKey={pos:0,rot:0,scl:0},l.animationCache.nextKey={pos:0,rot:0,scl:0},l.animationCache.originalMatrix=l instanceof
 THREE.Bone?l.skinMatrix:l.matrix;var f=l.animationCache.prevKey;l=l.animationCache.nextKey;f.pos=this.data.hierarchy[b].keys[0];f.rot=this.data.hierarchy[b].keys[0];f.scl=this.data.hierarchy[b].keys[0];l.pos=this.getNextKeyWith("pos",b,1);l.rot=this.getNextKeyWith("rot",b,1);l.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,l,f,h,k,n,t,p=this.data.JIT.hierarchy,v,x;this.currentTime+=a*this.timeScale;x=this.currentTime;v=this.currentTime%=this.data.length;t=parseInt(Math.min(v*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,y=this.hierarchy.length;u<y;u++)if(a=this.hierarchy[u],n=a.animationCache,this.JITCompile&&p[u][t]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=p[u][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=p[u][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){b=c[w];h=n.prevKey[b];k=n.nextKey[b];if(k.time<=x){if(v<x)if(this.loop){h=this.data.hierarchy[u].keys[0];for(k=this.getNextKeyWith(b,u,1);k.time<v;)h=k,k=this.getNextKeyWith(b,u,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(b,u,k.index+1);while(k.time<
-v)}n.prevKey[b]=h;n.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(v-h.time)/(k.time-h.time);l=h[b];f=k[b];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(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",u,h.index-1).pos,this.points[1]=l,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",u,k.index+1).pos,e=e*0.33+0.33,l=this.interpolateCatmullRom(this.points,e),b.x=l[0],b.y=l[1],b.z=l[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(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
-"rot")THREE.Quaternion.slerp(l,f,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e}}if(this.JITCompile&&p[0][t]===void 0){this.hierarchy[0].update(null,!0);for(u=0;u<this.hierarchy.length;u++)p[u][t]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],l,f,h,k,n,t;l=(a.length-1)*c;f=Math.floor(l);l-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];k=a[b[1]];n=a[b[2]];t=a[b[3]];b=l*l;h=l*b;e[0]=this.interpolate(f[0],k[0],n[0],t[0],l,b,h);e[1]=this.interpolate(f[1],k[1],n[1],t[1],l,b,h);e[2]=this.interpolate(f[2],k[2],n[2],t[2],l,b,h);return e};
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,l,f,h,k,n,p,t=this.data.JIT.hierarchy,u,y;this.currentTime+=a*this.timeScale;y=this.currentTime;u=this.currentTime%=this.data.length;p=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,x=this.hierarchy.length;v<x;v++)if(a=this.hierarchy[v],n=a.animationCache,this.JITCompile&&t[v][p]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=t[v][p],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=t[v][p],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var w=0;w<3;w++){b=c[w];h=n.prevKey[b];k=n.nextKey[b];if(k.time<=y){if(u<y)if(this.loop){h=this.data.hierarchy[v].keys[0];for(k=this.getNextKeyWith(b,v,1);k.time<u;)h=k,k=this.getNextKeyWith(b,v,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(b,v,k.index+1);while(k.time<
+u)}n.prevKey[b]=h;n.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(u-h.time)/(k.time-h.time);l=h[b];f=k[b];if(e<0||e>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+v),e=e<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",v,h.index-1).pos,this.points[1]=l,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",v,k.index+1).pos,e=e*0.33+0.33,l=this.interpolateCatmullRom(this.points,e),b.x=l[0],b.y=l[1],b.z=l[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(b),this.target.y=0,this.target.normalize(),e=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,e,0)}else if(b===
+"rot")THREE.Quaternion.slerp(l,f,a.quaternion,e);else if(b==="scl")b=a.scale,b.x=l[0]+(f[0]-l[0])*e,b.y=l[1]+(f[1]-l[1])*e,b.z=l[2]+(f[2]-l[2])*e}}if(this.JITCompile&&t[0][p]===void 0){this.hierarchy[0].update(null,!0);for(v=0;v<this.hierarchy.length;v++)t[v][p]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],l,f,h,k,n,p;l=(a.length-1)*c;f=Math.floor(l);l-=f;b[0]=f===0?f:f-1;b[1]=f;b[2]=f>a.length-2?f:f+1;b[3]=f>a.length-3?f:f+2;f=a[b[0]];k=a[b[1]];n=a[b[2]];p=a[b[3]];b=l*l;h=l*b;e[0]=this.interpolate(f[0],k[0],n[0],p[0],l,b,h);e[1]=this.interpolate(f[1],k[1],n[1],p[1],l,b,h);e[2]=this.interpolate(f[2],k[2],n[2],p[2],l,b,h);return e};
 THREE.Animation.prototype.interpolate=function(a,c,b,e,l,f,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*f+a*l+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<e.length-1?b:e.length-1:b%=e.length;b<e.length;b++)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var e=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==void 0)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
 THREE.CubeCamera=function(a,c,b,e){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
@@ -445,7 +446,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -453,16 +454,16 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
 this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
 (a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function l(a,b,c,e){var h={name:c,fps:0.6,length:e,hierarchy:[]},f,l=b.getControlPointsArray(),k=b.getLength(),A=l.length,B=0;f=A-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:e,pos:l[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<A-1;f++)B=e*k.chunks[f]/k.total,b.keys[f]={time:B,pos:l[f]};h.hierarchy[0]=
-b;THREE.AnimationHandler.add(h);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,e,h=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return h}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function l(a,b,c,e){var f={name:c,fps:0.6,length:e,hierarchy:[]},h,k=b.getControlPointsArray(),l=b.getLength(),z=k.length,B=0;h=z-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:k[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:k[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<z-1;h++)B=e*l.chunks[h]/l.total,b.keys[h]={time:B,pos:k[h]};f.hierarchy[0]=
+b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function f(a,b){var c,e,f=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)e=c/(a.points.length*b),e=a.getPoint(e),f.vertices[c]=new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,k=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%h;this.phi=a>=0?a:a+h;c=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var e=a[1]-a[0];this.phi=b((c-a[0])/e)*e+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);e=a[1]-a[0];this.theta=b((c-a[0])/e)*e+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),h=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(h,b);a.position.set(0,10,0);this.animation=l(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=l(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,c=f(b,10),h=f(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(h,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);h=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(h,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
 e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -471,200 +472,200 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
 this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
 -this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
 this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Matrix4,h=!1,k=1,n=0,t=0,p=0,v=0,x=0,u=window.innerWidth/2,y=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*v);this.rotateVertically(c*x)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*t);this.object.translateY(c*p);h&&(this.roll+=this.rollSpeed*a*k);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();l.copy(this.forward);e.set(0,1,0);b.cross(e,
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Matrix4,h=!1,k=1,n=0,p=0,t=0,u=0,y=0,v=window.innerWidth/2,x=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*u);this.rotateVertically(c*y)}c=a*this.movementSpeed;this.object.translateZ(-c*(n>0||this.autoForward&&!(n<0)?1:n));this.object.translateX(c*p);this.object.translateY(c*t);h&&(this.roll+=this.rollSpeed*a*k);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();l.copy(this.forward);e.set(0,1,0);b.cross(e,
 l).normalize();e.cross(l,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=e.x;this.object.matrix.n13=l.x;this.object.matrix.n21=b.y;this.object.matrix.n22=e.y;this.object.matrix.n23=l.y;this.object.matrix.n31=b.z;this.object.matrix.n32=e.z;this.object.matrix.n33=l.z;f.identity();f.n11=Math.cos(this.roll);f.n12=-Math.sin(this.roll);f.n21=Math.sin(this.roll);f.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(f);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
 this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
 a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){e.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);e.multiplyScalar(a);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){v=(a.clientX-u)/window.innerWidth;x=(a.clientY-y)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
-function(a){switch(a.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break;case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:h=!0;k=1;break;case 69:h=!0;k=-1;break;case 82:p=1;break;case 70:p=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.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:h=!1;break;case 69:h=!1;break;case 82:p=0;break;case 70:p=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){u=(a.clientX-v)/window.innerWidth;y=(a.clientY-x)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",
+function(a){switch(a.keyCode){case 38:case 87:n=1;break;case 37:case 65:p=-1;break;case 40:case 83:n=-1;break;case 39:case 68:p=1;break;case 81:h=!0;k=1;break;case 69:h=!0;k=-1;break;case 82:t=1;break;case 70:t=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65:p=0;break;case 40:case 83:n=0;break;case 39:case 68:p=0;break;case 81:h=!1;break;case 69:h=!1;break;case 82:t=0;break;case 70:t=0}},!1)};
 THREE.TrackballControls=function(a,c){var b=this,e={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
-new THREE.Vector3(0,0,0);var l=!1,f=e.NONE,h=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector2,p=new THREE.Vector2,v=new THREE.Vector2,x=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
+new THREE.Vector3(0,0,0);var l=!1,f=e.NONE,h=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector3,p=new THREE.Vector2,t=new THREE.Vector2,u=new THREE.Vector2,y=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var e=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
 b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);h.copy(b.object.position).subSelf(b.target);f=b.object.up.clone().setLength(e.y);f.addSelf(b.object.up.clone().crossSelf(h).setLength(e.x));f.addSelf(h.setLength(e.z));return f};this.rotateCamera=function(){var a=Math.acos(k.dot(n)/k.length()/n.length());if(a){var c=(new THREE.Vector3).cross(k,n).normalize(),e=new THREE.Quaternion;a*=b.rotateSpeed;e.setFromAxisAngle(c,-a);e.multiplyVector3(h);
-e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?k=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(p.y-t.y)*b.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),b.staticMoving?t=p:t.y+=(p.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(v);if(a.lengthSq()){a.multiplyScalar(h.length()*b.panSpeed);var c=h.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?v=x:v.addSelf(a.sub(x,v).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),h.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,h.setLength(b.minDistance))};this.update=function(){h.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
-b.panCamera();b.object.position.add(b.target,h);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(l&&(k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),t=p=b.getMouseOnScreen(a.clientX,a.clientY),v=x=b.getMouseOnScreen(a.clientX,a.clientY),l=!1),f!==e.NONE&&(f===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?p=b.getMouseOnScreen(a.clientX,
-a.clientY):f===e.PAN&&!b.noPan&&(x=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===e.NONE))f=a.button,f===e.ROTATE?k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?t=p=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(v=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+e.multiplyVector3(b.object.up);e.multiplyVector3(n);b.staticMoving?k=n:(e.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),e.multiplyVector3(k))}};this.zoomCamera=function(){var a=1+(t.y-p.y)*b.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),b.staticMoving?p=t:p.y+=(t.y-p.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=y.clone().subSelf(u);if(a.lengthSq()){a.multiplyScalar(h.length()*b.panSpeed);var c=h.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?u=y:u.addSelf(a.sub(y,u).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),h.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,h.setLength(b.minDistance))};this.update=function(){h.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
+b.panCamera();b.object.position.add(b.target,h);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(l&&(k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY),p=t=b.getMouseOnScreen(a.clientX,a.clientY),u=y=b.getMouseOnScreen(a.clientX,a.clientY),l=!1),f!==e.NONE&&(f===e.ROTATE?n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?t=b.getMouseOnScreen(a.clientX,
+a.clientY):f===e.PAN&&!b.noPan&&(y=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),f===e.NONE))f=a.button,f===e.ROTATE?k=n=b.getMouseProjectionOnBall(a.clientX,a.clientY):f===e.ZOOM&&!b.noZoom?p=t=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(u=y=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
 f=e.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&f===e.NONE){if(a.keyCode===b.keys[e.ROTATE])f=e.ROTATE;else if(a.keyCode===b.keys[e.ZOOM]&&!b.noZoom)f=e.ZOOM;else if(a.keyCode===b.keys[e.PAN]&&!b.noPan)f=e.PAN;f!==e.NONE&&(l=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&f!==e.NONE)f=e.NONE},!1)};
-THREE.CubeGeometry=function(a,c,b,e,l,f,h,k){function n(a,b,c,h,k,n,p,u){var v,w,x=e||1,y=l||1,o=k/2,A=n/2,B=t.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",y=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",x=f||1;var z=x+1,D=y+1;k/=x;var T=n/y;for(w=0;w<D;w++)for(n=0;n<z;n++){var ja=new THREE.Vector3;ja[a]=(n*k-o)*c;ja[b]=(w*T-A)*h;ja[v]=p;t.vertices.push(new THREE.Vertex(ja))}for(w=0;w<y;w++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
-z*w+B,n+z*(w+1)+B,n+1+z*(w+1)+B,n+1+z*w+B,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(n/x,w/y),new THREE.UV(n/x,(w+1)/y),new THREE.UV((n+1)/x,(w+1)/y),new THREE.UV((n+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,p=a/2,v=c/2,x=b/2,u,y,w,A,B,D;if(h!==void 0){if(h instanceof Array)this.materials=h;else{this.materials=[];for(u=0;u<6;u++)this.materials.push(h)}u=0;A=1;y=2;B=3;w=4;D=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var z in k)this.sides[z]!=
-void 0&&(this.sides[z]=k[z]);this.sides.px&&n("z","y",-1,-1,b,c,p,u);this.sides.nx&&n("z","y",1,-1,b,c,-p,A);this.sides.py&&n("x","z",1,1,a,b,v,y);this.sides.ny&&n("x","z",1,-1,a,b,-v,B);this.sides.pz&&n("x","y",1,-1,a,c,x,w);this.sides.nz&&n("x","y",-1,-1,a,c,-x,D);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(a,c,b,e,l,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,h=b/2,e=e||8,l=l||1,k,n,t=[],p=[];for(n=0;n<=l;n++){var v=[],x=[],u=n/l,y=u*(c-a)+a;for(k=0;k<=e;k++){var w=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(w*Math.PI*2),-u*b+h,y*Math.cos(w*Math.PI*2))));v.push(this.vertices.length-1);x.push(new THREE.UV(w,u))}t.push(v);p.push(x)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=t[n][k],v=t[n+1][k],x=t[n+1][k+1],u=t[n][k+1],y=
-this.vertices[b].position.clone().setY(0).normalize(),w=this.vertices[v].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),B=this.vertices[u].position.clone().setY(0).normalize(),D=p[n][k].clone(),z=p[n+1][k].clone(),C=p[n+1][k+1].clone(),L=p[n][k+1].clone();this.faces.push(new THREE.Face4(b,v,x,u,[y,w,A,B]));this.faceVertexUvs[0].push([D,z,C,L])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(k=0;k<e;k++)b=t[0][k],v=t[0][k+
-1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),D=p[0][k].clone(),z=p[0][k+1].clone(),C=new THREE.UV(z.u,0),this.faces.push(new THREE.Face3(b,v,x,[y,w,A])),this.faceVertexUvs[0].push([D,z,C])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(k=0;k<e;k++)b=t[n][k+1],v=t[n][k],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),D=p[n][k+1].clone(),z=p[n][k].clone(),
-C=new THREE.UV(z.u,1),this.faces.push(new THREE.Face3(b,v,x,[y,w,A])),this.faceVertexUvs[0].push([D,z,C])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
+THREE.CubeGeometry=function(a,c,b,e,l,f,h,k){function n(a,b,c,h,k,n,t,u){var v,w,y=e||1,x=l||1,z=k/2,o=n/2,B=p.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")v="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")v="y",x=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")v="x",y=f||1;var A=y+1,C=x+1;k/=y;var R=n/x;for(w=0;w<C;w++)for(n=0;n<A;n++){var X=new THREE.Vector3;X[a]=(n*k-z)*c;X[b]=(w*R-o)*h;X[v]=t;p.vertices.push(new THREE.Vertex(X))}for(w=0;w<x;w++)for(n=0;n<y;n++)p.faces.push(new THREE.Face4(n+
+A*w+B,n+A*(w+1)+B,n+1+A*(w+1)+B,n+1+A*w+B,null,null,u)),p.faceVertexUvs[0].push([new THREE.UV(n/y,w/x),new THREE.UV(n/y,(w+1)/x),new THREE.UV((n+1)/y,(w+1)/x),new THREE.UV((n+1)/y,w/x)])}THREE.Geometry.call(this);var p=this,t=a/2,u=c/2,y=b/2,v,x,w,z,B,C;if(h!==void 0){if(h instanceof Array)this.materials=h;else{this.materials=[];for(v=0;v<6;v++)this.materials.push(h)}v=0;z=1;x=2;B=3;w=4;C=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var A in k)this.sides[A]!=
+void 0&&(this.sides[A]=k[A]);this.sides.px&&n("z","y",-1,-1,b,c,t,v);this.sides.nx&&n("z","y",1,-1,b,c,-t,z);this.sides.py&&n("x","z",1,1,a,b,u,x);this.sides.ny&&n("x","z",1,-1,a,b,-u,B);this.sides.pz&&n("x","y",1,-1,a,c,y,w);this.sides.nz&&n("x","y",-1,-1,a,c,-y,C);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
+THREE.CylinderGeometry=function(a,c,b,e,l,f){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,h=b/2,e=e||8,l=l||1,k,n,p=[],t=[];for(n=0;n<=l;n++){var u=[],y=[],v=n/l,x=v*(c-a)+a;for(k=0;k<=e;k++){var w=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(x*Math.sin(w*Math.PI*2),-v*b+h,x*Math.cos(w*Math.PI*2))));u.push(this.vertices.length-1);y.push(new THREE.UV(w,v))}p.push(u);t.push(y)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=p[n][k],u=p[n+1][k],y=p[n+1][k+1],v=p[n][k+1],x=
+this.vertices[b].position.clone().setY(0).normalize(),w=this.vertices[u].position.clone().setY(0).normalize(),z=this.vertices[y].position.clone().setY(0).normalize(),B=this.vertices[v].position.clone().setY(0).normalize(),C=t[n][k].clone(),A=t[n+1][k].clone(),D=t[n+1][k+1].clone(),K=t[n][k+1].clone();this.faces.push(new THREE.Face4(b,u,y,v,[x,w,z,B]));this.faceVertexUvs[0].push([C,A,D,K])}if(!f&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,h,0)));for(k=0;k<e;k++)b=p[0][k],u=p[0][k+
+1],y=this.vertices.length-1,x=new THREE.Vector3(0,1,0),w=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),C=t[0][k].clone(),A=t[0][k+1].clone(),D=new THREE.UV(A.u,0),this.faces.push(new THREE.Face3(b,u,y,[x,w,z])),this.faceVertexUvs[0].push([C,A,D])}if(!f&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-h,0)));for(k=0;k<e;k++)b=p[n][k+1],u=p[n][k],y=this.vertices.length-1,x=new THREE.Vector3(0,-1,0),w=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),C=t[n][k+1].clone(),A=t[n][k].clone(),
+D=new THREE.UV(A.u,1),this.faces.push(new THREE.Face3(b,u,y,[x,w,z])),this.faceVertexUvs[0].push([C,A,D])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,e=a.length,l;this.shapebb=a[e-1].getBoundingBox();for(b=0;b<e;b++)l=a[b],this.addShape(l,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
-THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,h=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,l=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);h.set(a.x-c.x,a.y-c.y);e=e.normalize();h=h.normalize();f.set(-e.y,e.x);l.set(h.y,-h.x);k.copy(a).addSelf(f);n.copy(a).addSelf(l);if(k.equals(n))return l.clone();
-k.copy(b).addSelf(f);n.copy(c).addSelf(l);f=e.dot(l);l=n.subSelf(k).dot(l);f===0&&(console.log("Either infinite or no solutions!"),l===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));l/=f;if(l<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(l).addSelf(k).subSelf(a).clone()}function l(a){for(M=a.length;--M>=0;){ea=M;aa=M-1;aa<0&&(aa=a.length-
-1);for(var b=0,c=u+p*2,b=0;b<c;b++){var e=da*b,h=da*(b+1),f=na+ea+e,l=na+ea+h,o=f,e=na+aa+e,h=na+aa+h,t=l;o+=N;e+=N;h+=N;t+=N;K.faces.push(new THREE.Face4(o,e,h,t,null,null,C));C&&(o=b/c,e=(b+1)/c,h=k+n*2,f=(K.vertices[f].position.z+n)/h,l=(K.vertices[l].position.z+n)/h,K.faceVertexUvs[0].push([new THREE.UV(f,o),new THREE.UV(l,o),new THREE.UV(l,e),new THREE.UV(f,e)]))}}}function f(a,b,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function h(a,b,c){a+=N;b+=N;c+=N;K.faces.push(new THREE.Face3(a,
-b,c,null,null,z));if(z){var e=L.maxY,h=L.maxX,f=K.vertices[b].position.x,b=K.vertices[b].position.y,l=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[a].position.x/h,K.vertices[a].position.y/e),new THREE.UV(f/h,b/e),new THREE.UV(l/h,c/e)])}}var k=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:n-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,v=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,y=c.bendPath,w=c.extrudePath,A,B=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,z=c.material,C=c.extrudeMaterial,L=this.shapebb;if(w)A=w.getPoints(x),u=A.length,B=!0,v=!1;v||(t=n=p=0);var H,I,R,K=this,N=this.vertices.length;y&&a.addWrapPath(y);x=D?a.extractAllSpacedPoints(x):a.extractAllPoints(x);y=x.shape;x=x.holes;if(w=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();I=0;for(R=x.length;I<R;I++)H=x[I],THREE.Shape.Utils.isClockWise(H)&&
-(x[I]=H.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(y,x);D=y;I=0;for(R=x.length;I<R;I++)H=x[I],y=y.concat(H);var M,G,Z,$,U,o,da=y.length,Y=w.length,pa=[];M=0;G=D.length;ea=G-1;for(aa=M+1;M<G;M++,ea++,aa++)ea===G&&(ea=0),aa===G&&(aa=0),pa[M]=e(D[M],D[ea],D[aa]);var P=[],T,ja=pa.concat();I=0;for(R=x.length;I<R;I++){H=x[I];T=[];M=0;G=H.length;ea=G-1;for(aa=M+1;M<G;M++,ea++,aa++)ea===G&&(ea=0),aa===G&&(aa=0),T[M]=e(H[M],H[ea],H[aa]);P.push(T);ja=ja.concat(T)}for(Z=0;Z<p;Z++){$=Z/p;U=n*(1-$);
-$=t*Math.sin($*Math.PI/2);M=0;for(G=D.length;M<G;M++)o=b(D[M],pa[M],$),f(o.x,o.y,-U);I=0;for(R=x.length;I<R;I++){H=x[I];T=P[I];M=0;for(G=H.length;M<G;M++)o=b(H[M],T[M],$),f(o.x,o.y,-U)}}$=t;for(M=0;M<da;M++)o=v?b(y[M],ja[M],$):y[M],B?f(o.x,o.y+A[0].y,A[0].x):f(o.x,o.y,0);for(Z=1;Z<=u;Z++)for(M=0;M<da;M++)o=v?b(y[M],ja[M],$):y[M],B?f(o.x,o.y+A[Z-1].y,A[Z-1].x):f(o.x,o.y,k/u*Z);for(Z=p-1;Z>=0;Z--){$=Z/p;U=n*(1-$);$=t*Math.sin($*Math.PI/2);M=0;for(G=D.length;M<G;M++)o=b(D[M],pa[M],$),f(o.x,o.y,k+U);
-I=0;for(R=x.length;I<R;I++){H=x[I];T=P[I];M=0;for(G=H.length;M<G;M++)o=b(H[M],T[M],$),B?f(o.x,o.y+A[u-1].y,A[u-1].x+U):f(o.x,o.y,k+U)}}if(v){v=da*0;for(M=0;M<Y;M++)t=w[M],h(t[2]+v,t[1]+v,t[0]+v);v=da*(u+p*2);for(M=0;M<Y;M++)t=w[M],h(t[0]+v,t[1]+v,t[2]+v)}else{for(M=0;M<Y;M++)t=w[M],h(t[2],t[1],t[0]);for(M=0;M<Y;M++)t=w[M],h(t[0]+da*u,t[1]+da*u,t[2]+da*u)}var ea,aa,na=0;l(D);na+=D.length;I=0;for(R=x.length;I<R;I++)H=x[I],l(H),na+=H.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
-THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
-THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return l.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=l.vertices[a].position,h=l.vertices[b].position;return c((e.x+h.x)/2,(e.y+h.y)/2,(e.z+h.z)/2)}var l=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var h=0;h<this.subdivisions;h++){var a=new THREE.Geometry,k;for(k in f.faces){var n=e(f.faces[k].a,f.faces[k].b),t=e(f.faces[k].b,f.faces[k].c),p=e(f.faces[k].c,f.faces[k].a);b(f.faces[k].a,n,p,a);b(f.faces[k].b,t,
-n,a);b(f.faces[k].c,p,t,a);b(n,t,p,a)}f.faces=a.faces}l.faces=f.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],l=[],f=[],h=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var n=0;n<=this.angle+0.001;n+=c){for(k=0;k<b.length;k++)n<this.angle?(b[k]=h.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),l[k]=this.vertices.length-1):l=f;n==0&&(f=e);
+THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function e(a,b,c){var e=THREE.ExtrudeGeometry.__v1,f=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,l=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;e.set(a.x-b.x,a.y-b.y);f.set(a.x-c.x,a.y-c.y);e=e.normalize();f=f.normalize();h.set(-e.y,e.x);k.set(f.y,-f.x);l.copy(a).addSelf(h);n.copy(a).addSelf(k);if(l.equals(n))return k.clone();
+l.copy(b).addSelf(h);n.copy(c).addSelf(k);h=e.dot(k);k=n.subSelf(l).dot(k);h===0&&(console.log("Either infinite or no solutions!"),k===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));k/=h;if(k<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),anglec=(b+a)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return e.multiplyScalar(k).addSelf(l).subSelf(a).clone()}function l(a){for(L=a.length;--L>=0;){la=L;$=L-1;$<0&&($=a.length-
+1);for(var b=0,c=v+t*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=ma+la+e,l=ma+la+f,p=h,e=ma+$+e,f=ma+$+f,u=l;p+=N;e+=N;f+=N;u+=N;H.faces.push(new THREE.Face4(p,e,f,u,null,null,D));D&&(p=b/c,e=(b+1)/c,f=k+n*2,h=(H.vertices[h].position.z+n)/f,l=(H.vertices[l].position.z+n)/f,H.faceVertexUvs[0].push([new THREE.UV(h,p),new THREE.UV(l,p),new THREE.UV(l,e),new THREE.UV(h,e)]))}}}function f(a,b,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function h(a,b,c){a+=N;b+=N;c+=N;H.faces.push(new THREE.Face3(a,
+b,c,null,null,A));if(A){var e=K.maxY,f=K.maxX,h=H.vertices[b].position.x,b=H.vertices[b].position.y,k=H.vertices[c].position.x,c=H.vertices[c].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/f,H.vertices[a].position.y/e),new THREE.UV(h/f,b/e),new THREE.UV(k/f,c/e)])}}var k=c.amount!==void 0?c.amount:100,n=c.bevelThickness!==void 0?c.bevelThickness:6,p=c.bevelSize!==void 0?c.bevelSize:n-2,t=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,y=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,x=c.bendPath,w=c.extrudePath,z,B=!1,C=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,A=c.material,D=c.extrudeMaterial,K=this.shapebb;if(w)z=w.getPoints(y),v=z.length,B=!0,u=!1;u||(p=n=t=0);var P,F,Q,H=this,N=this.vertices.length;x&&a.addWrapPath(x);y=C?a.extractAllSpacedPoints(y):a.extractAllPoints(y);x=y.shape;y=y.holes;if(w=!THREE.Shape.Utils.isClockWise(x)){x=x.reverse();F=0;for(Q=y.length;F<Q;F++)P=y[F],THREE.Shape.Utils.isClockWise(P)&&
+(y[F]=P.reverse());w=!1}w=THREE.Shape.Utils.triangulateShape(x,y);C=x;F=0;for(Q=y.length;F<Q;F++)P=y[F],x=x.concat(P);var L,G,V,ca,W,T,o=x.length,Z=w.length,ha=[];L=0;G=C.length;la=G-1;for($=L+1;L<G;L++,la++,$++)la===G&&(la=0),$===G&&($=0),ha[L]=e(C[L],C[la],C[$]);var M=[],R,X=ha.concat();F=0;for(Q=y.length;F<Q;F++){P=y[F];R=[];L=0;G=P.length;la=G-1;for($=L+1;L<G;L++,la++,$++)la===G&&(la=0),$===G&&($=0),R[L]=e(P[L],P[la],P[$]);M.push(R);X=X.concat(R)}for(V=0;V<t;V++){ca=V/t;W=n*(1-ca);ca=p*Math.sin(ca*
+Math.PI/2);L=0;for(G=C.length;L<G;L++)T=b(C[L],ha[L],ca),f(T.x,T.y,-W);F=0;for(Q=y.length;F<Q;F++){P=y[F];R=M[F];L=0;for(G=P.length;L<G;L++)T=b(P[L],R[L],ca),f(T.x,T.y,-W)}}ca=p;for(L=0;L<o;L++)T=u?b(x[L],X[L],ca):x[L],B?f(T.x,T.y+z[0].y,z[0].x):f(T.x,T.y,0);for(V=1;V<=v;V++)for(L=0;L<o;L++)T=u?b(x[L],X[L],ca):x[L],B?f(T.x,T.y+z[V-1].y,z[V-1].x):f(T.x,T.y,k/v*V);for(V=t-1;V>=0;V--){ca=V/t;W=n*(1-ca);ca=p*Math.sin(ca*Math.PI/2);L=0;for(G=C.length;L<G;L++)T=b(C[L],ha[L],ca),f(T.x,T.y,k+W);F=0;for(Q=
+y.length;F<Q;F++){P=y[F];R=M[F];L=0;for(G=P.length;L<G;L++)T=b(P[L],R[L],ca),B?f(T.x,T.y+z[v-1].y,z[v-1].x+W):f(T.x,T.y,k+W)}}if(u){u=o*0;for(L=0;L<Z;L++)p=w[L],h(p[2]+u,p[1]+u,p[0]+u);u=o*(v+t*2);for(L=0;L<Z;L++)p=w[L],h(p[0]+u,p[1]+u,p[2]+u)}else{for(L=0;L<Z;L++)p=w[L],h(p[2],p[1],p[0]);for(L=0;L<Z;L++)p=w[L],h(p[0]+o*v,p[1]+o*v,p[2]+o*v)}var la,$,ma=0;l(C);ma+=C.length;F=0;for(Q=y.length;F<Q;F++)P=y[F],l(P),ma+=P.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
+THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
+THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return l.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=l.vertices[a].position,f=l.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var l=this,f=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(var h=0;h<this.subdivisions;h++){var a=new THREE.Geometry,k;for(k in f.faces){var n=e(f.faces[k].a,f.faces[k].b),p=e(f.faces[k].b,f.faces[k].c),t=e(f.faces[k].c,f.faces[k].a);b(f.faces[k].a,n,t,a);b(f.faces[k].b,p,
+n,a);b(f.faces[k].c,t,p,a);b(n,p,t,a)}f.faces=a.faces}l.faces=f.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],l=[],f=[],h=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var n=0;n<=this.angle+0.0010;n+=c){for(k=0;k<b.length;k++)n<this.angle?(b[k]=h.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),l[k]=this.vertices.length-1):l=f;n==0&&(f=e);
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(l[k],l[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-n/this.angle,k/a.length),new THREE.UV(1-n/this.angle,(k+1)/a.length),new THREE.UV(1-(n-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(n-c)/this.angle,k/a.length)]);e=l;l=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=h.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
 h.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),h.faceVertexUvs[0].push([f(a.uv,a.position,k),f(b.uv,b.position,k),f(c.uv,c.position,k)])):(k-=1,e(a,l(a,b),l(a,c),k),e(l(a,b),b,l(b,c),k),e(l(a,c),l(b,c),c,k),e(l(a,b),l(b,c),l(a,c),k))}function l(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function f(a,b,c){c<0&&a.u===
 1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,h=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var k=[],n=this.vertices;e(n[0],n[2],n[4],c);e(n[0],n[4],n[3],c);e(n[0],n[3],n[5],c);e(n[0],n[5],n[2],c);e(n[1],n[2],n[5],c);e(n[1],n[5],n[3],c);e(n[1],n[3],n[4],c);e(n[1],n[4],n[2],c);this.boundingSphere=
 {radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
-THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var l,f=a/2,h=c/2,b=b||1,e=e||1,k=b+1,n=e+1;a/=b;var t=c/e;for(l=0;l<n;l++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(l*t-h),0)));for(l=0;l<e;l++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*l,c+k*(l+1),c+1+k*(l+1),c+1+k*l)),this.faceVertexUvs[0].push([new THREE.UV(c/b,l/e),new THREE.UV(c/b,(l+1)/e),new THREE.UV((c+1)/b,(l+1)/e),new THREE.UV((c+1)/b,l/e)]);this.computeCentroids();this.computeFaceNormals()};
+THREE.PlaneGeometry=function(a,c,b,e){THREE.Geometry.call(this);var l,f=a/2,h=c/2,b=b||1,e=e||1,k=b+1,n=e+1;a/=b;var p=c/e;for(l=0;l<n;l++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-f,-(l*p-h),0)));for(l=0;l<e;l++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+k*l,c+k*(l+1),c+1+k*(l+1),c+1+k*l)),this.faceVertexUvs[0].push([new THREE.UV(c/b,l/e),new THREE.UV(c/b,(l+1)/e),new THREE.UV((c+1)/b,(l+1)/e),new THREE.UV((c+1)/b,l/e)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,l=Math.PI,f=Math.max(3,c||8),h=Math.max(2,b||6),c=[],b=0;b<h+1;b++){e=b/h;var k=a*Math.cos(e*l),n=a*Math.sin(e*l),t=[],p=0;for(e=0;e<f;e++){var v=2*e/f,x=n*Math.sin(v*l),v=n*Math.cos(v*l);(b==0||b==h)&&e>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,k,x)))-1);t.push(p)}c.push(t)}for(var u,y,w,l=c.length,b=0;b<l;b++)if(f=c[b].length,b>0)for(e=0;e<f;e++){t=e==f-1;h=c[b][t?0:e+1];k=c[b][t?f-1:e];n=c[b-1][t?
-f-1:e];t=c[b-1][t?0:e+1];x=b/(l-1);u=(b-1)/(l-1);y=(e+1)/f;var v=e/f,p=new THREE.UV(1-y,x),x=new THREE.UV(1-v,x),v=new THREE.UV(1-v,u),A=new THREE.UV(1-y,u);b<c.length-1&&(u=this.vertices[h].position.clone(),y=this.vertices[k].position.clone(),w=this.vertices[n].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([p,x,v]));b>1&&(u=
-this.vertices[h].position.clone(),y=this.vertices[n].position.clone(),w=this.vertices[t].position.clone(),u.normalize(),y.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,n,t,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([p,v,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,e,l=Math.PI,f=Math.max(3,c||8),h=Math.max(2,b||6),c=[],b=0;b<h+1;b++){e=b/h;var k=a*Math.cos(e*l),n=a*Math.sin(e*l),p=[],t=0;for(e=0;e<f;e++){var u=2*e/f,y=n*Math.sin(u*l),u=n*Math.cos(u*l);(b==0||b==h)&&e>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,y)))-1);p.push(t)}c.push(p)}for(var v,x,w,l=c.length,b=0;b<l;b++)if(f=c[b].length,b>0)for(e=0;e<f;e++){p=e==f-1;h=c[b][p?0:e+1];k=c[b][p?f-1:e];n=c[b-1][p?
+f-1:e];p=c[b-1][p?0:e+1];y=b/(l-1);v=(b-1)/(l-1);x=(e+1)/f;var u=e/f,t=new THREE.UV(1-x,y),y=new THREE.UV(1-u,y),u=new THREE.UV(1-u,v),z=new THREE.UV(1-x,v);b<c.length-1&&(v=this.vertices[h].position.clone(),x=this.vertices[k].position.clone(),w=this.vertices[n].position.clone(),v.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([t,y,u]));b>1&&(v=
+this.vertices[h].position.clone(),x=this.vertices[n].position.clone(),w=this.vertices[p].position.clone(),v.normalize(),x.normalize(),w.normalize(),this.faces.push(new THREE.Face3(h,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(w.x,w.y,w.z)])),this.faceVertexUvs[0].push([t,u,z]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var e=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(e/2,120),new THREE.Vector2(e,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(a,c){return(new TextPath(a,c)).toShapes()},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=
-this.getFace(),b=this.size/c.resolution,e=0,l=String(a).split(""),f=l.length,h=[],a=0;a<f;a++){var k=new THREE.Path,k=this.extractGlyphPoints(l[a],c,b,e,k);e+=k.offset;h.push(k.path)}return{paths:h,offset:e/2}},extractGlyphPoints:function(a,c,b,e,l){var f=[],h,k,n,t,p,v,x,u,y,w,A=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));n=c.length;for(a=0;a<n;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(k,
-t));l.moveTo(k,t);break;case "l":k=c[a++]*b+e;t=c[a++]*b;f.push(new THREE.Vector2(k,t));l.lineTo(k,t);break;case "q":k=c[a++]*b+e;t=c[a++]*b;x=c[a++]*b+e;u=c[a++]*b;l.quadraticCurveTo(x,u,k,t);if(h=f[f.length-1]){p=h.x;v=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var B=h/divisions,D=THREE.Shape.Utils.b2(B,p,x,k),B=THREE.Shape.Utils.b2(B,v,u,t);f.push(new THREE.Vector2(D,B))}}break;case "b":if(k=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,u=c[a++]*-b,y=c[a++]*b+e,w=c[a++]*-b,l.bezierCurveTo(k,t,
-x,u,y,w),h=f[f.length-1]){p=h.x;v=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)B=h/divisions,D=THREE.Shape.Utils.b3(B,p,x,y,k),B=THREE.Shape.Utils.b3(B,v,u,w,t),f.push(new THREE.Vector2(D,B))}}}return{offset:A.ha*b,points:f,path:l}}}};
-(function(a){var c=function(a){for(var c=a.length,l=0,f=c-1,h=0;h<c;f=h++)l+=a[f].x*a[h].y-a[h].x*a[f].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var f=[],h=[],k=[],n,t,p;if(c(a)>0)for(t=0;t<l;t++)h[t]=t;else for(t=0;t<l;t++)h[t]=l-1-t;var v=2*l;for(t=l-1;l>2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return f}n=t;l<=n&&(n=0);t=n+1;l<=t&&(t=0);p=t+1;l<=p&&(p=0);var x;a:{x=a;var u=n,y=t,w=p,A=l,B=h,D=void 0,z=void 0,C=void 0,
-L=void 0,H=void 0,I=void 0,R=void 0,K=void 0,N=void 0,z=x[B[u]].x,C=x[B[u]].y,L=x[B[y]].x,H=x[B[y]].y,I=x[B[w]].x,R=x[B[w]].y;if(1.0E-10>(L-z)*(R-C)-(H-C)*(I-z))x=!1;else{for(D=0;D<A;D++)if(!(D==u||D==y||D==w)){var K=x[B[D]].x,N=x[B[D]].y,M=void 0,G=void 0,Z=void 0,$=void 0,U=void 0,o=void 0,da=void 0,Y=void 0,pa=void 0,P=void 0,T=void 0,ja=void 0,M=Z=U=void 0,M=I-L,G=R-H,Z=z-I,$=C-R,U=L-z,o=H-C,da=K-z,Y=N-C,pa=K-L,P=N-H,T=K-I,ja=N-R,M=M*P-G*pa,U=U*Y-o*da,Z=Z*ja-$*T;if(M>=0&&Z>=0&&U>=0){x=!1;break a}}x=
-!0}}if(x){f.push([a[h[n]],a[h[t]],a[h[p]]]);k.push([h[n],h[t],h[p]]);n=t;for(p=t+1;p<l;n++,p++)h[n]=h[p];l--;v=2*l}}if(e)return k;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+this.getFace(),b=this.size/c.resolution,e=0,l=String(a).split(""),f=l.length,h=[],a=0;a<f;a++){var k=new THREE.Path,k=this.extractGlyphPoints(l[a],c,b,e,k);e+=k.offset;h.push(k.path)}return{paths:h,offset:e/2}},extractGlyphPoints:function(a,c,b,e,l){var f=[],h,k,n,p,t,u,y,v,x,w,z=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));n=c.length;for(a=0;a<n;)switch(k=c[a++],k){case "m":k=c[a++]*b+e;p=c[a++]*b;f.push(new THREE.Vector2(k,
+p));l.moveTo(k,p);break;case "l":k=c[a++]*b+e;p=c[a++]*b;f.push(new THREE.Vector2(k,p));l.lineTo(k,p);break;case "q":k=c[a++]*b+e;p=c[a++]*b;y=c[a++]*b+e;v=c[a++]*b;l.quadraticCurveTo(y,v,k,p);if(h=f[f.length-1]){t=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var B=h/divisions,C=THREE.Shape.Utils.b2(B,t,y,k),B=THREE.Shape.Utils.b2(B,u,v,p);f.push(new THREE.Vector2(C,B))}}break;case "b":if(k=c[a++]*b+e,p=c[a++]*b,y=c[a++]*b+e,v=c[a++]*-b,x=c[a++]*b+e,w=c[a++]*-b,l.bezierCurveTo(k,p,
+y,v,x,w),h=f[f.length-1]){t=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)B=h/divisions,C=THREE.Shape.Utils.b3(B,t,y,x,k),B=THREE.Shape.Utils.b3(B,u,v,w,p),f.push(new THREE.Vector2(C,B))}}}return{offset:z.ha*b,points:f,path:l}}}};
+(function(a){var c=function(a){for(var c=a.length,l=0,f=c-1,h=0;h<c;f=h++)l+=a[f].x*a[h].y-a[h].x*a[f].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var f=[],h=[],k=[],n,p,t;if(c(a)>0)for(p=0;p<l;p++)h[p]=p;else for(p=0;p<l;p++)h[p]=l-1-p;var u=2*l;for(p=l-1;l>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(e)return k;return f}n=p;l<=n&&(n=0);p=n+1;l<=p&&(p=0);t=p+1;l<=t&&(t=0);var y;a:{y=a;var v=n,x=p,w=t,z=l,B=h,C=void 0,A=void 0,D=void 0,
+K=void 0,P=void 0,F=void 0,Q=void 0,H=void 0,N=void 0,A=y[B[v]].x,D=y[B[v]].y,K=y[B[x]].x,P=y[B[x]].y,F=y[B[w]].x,Q=y[B[w]].y;if(1.0E-10>(K-A)*(Q-D)-(P-D)*(F-A))y=!1;else{for(C=0;C<z;C++)if(!(C==v||C==x||C==w)){var H=y[B[C]].x,N=y[B[C]].y,L=void 0,G=void 0,V=void 0,ca=void 0,W=void 0,T=void 0,o=void 0,Z=void 0,ha=void 0,M=void 0,R=void 0,X=void 0,L=V=W=void 0,L=F-K,G=Q-P,V=A-F,ca=D-Q,W=K-A,T=P-D,o=H-A,Z=N-D,ha=H-K,M=N-P,R=H-F,X=N-Q,L=L*M-G*ha,W=W*Z-T*o,V=V*X-ca*R;if(L>=0&&V>=0&&W>=0){y=!1;break a}}y=
+!0}}if(y){f.push([a[h[n]],a[h[p]],a[h[t]]]);k.push([h[n],h[p],h[t]]);n=p;for(t=p+1;t<l;n++,t++)h[n]=h[t];l--;u=2*l}}if(e)return k;return f};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(a,c,b,e,l){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;this.arc=l||Math.PI*2;l=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(e=0;e<=this.segmentsT;e++){var f=e/this.segmentsT*this.arc,h=b/this.segmentsR*Math.PI*2;l.x=this.radius*Math.cos(f);l.y=this.radius*Math.sin(f);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(h))*Math.cos(f);k.y=(this.radius+this.tube*Math.cos(h))*Math.sin(f);k.z=
 this.tube*Math.sin(h);this.vertices.push(new THREE.Vertex(k));a.push(new THREE.UV(e/this.segmentsT,1-b/this.segmentsR));c.push(k.clone().subSelf(l).normalize())}for(b=1;b<=this.segmentsR;b++)for(e=1;e<=this.segmentsT;e++){var l=(this.segmentsT+1)*b+e-1,f=(this.segmentsT+1)*(b-1)+e-1,h=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,n=new THREE.Face4(l,f,h,k,[c[l],c[f],c[h],c[k]]);n.normal.addSelf(c[l]);n.normal.addSelf(c[f]);n.normal.addSelf(c[h]);n.normal.addSelf(c[k]);n.normal.normalize();this.faces.push(n);
 this.faceVertexUvs[0].push([a[l].clone(),a[f].clone(),a[h].clone(),a[k].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
-THREE.TorusKnotGeometry=function(a,c,b,e,l,f,h){function k(a,b,c,e,h,f){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(a),h*(2+c)*Math.sin(a)*0.5,f*h*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=l||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
+THREE.TorusKnotGeometry=function(a,c,b,e,l,f,h){function k(a,b,c,e,f,h){b=c/e*a;c=Math.cos(b);return new THREE.Vector3(f*(2+c)*0.5*Math.cos(a),f*(2+c)*Math.sin(a)*0.5,h*f*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=l||2;this.q=f||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
 this.segmentsT;++c){var n=a/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,l=k(n,h,this.q,this.p,this.radius,this.heightScale),n=k(n+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=n.x-l.x;b.y=n.y-l.y;b.z=n.z-l.z;e.x=n.x+l.x;e.y=n.y+l.y;e.z=n.z+l.z;f.cross(b,e);e.cross(f,b);f.normalize();e.normalize();n=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);l.x+=n*e.x+h*f.x;l.y+=n*e.y+h*f.y;l.z+=n*e.z+h*f.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(l.x,l.y,
-l.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,l=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(l,b,e,f));this.faceVertexUvs[0].push([h,n,t,p])}this.computeCentroids();
+l.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)%this.segmentsR,f=(c+1)%this.segmentsT,l=this.grid[a][c],b=this.grid[e][c],e=this.grid[e][f],f=this.grid[a][f],h=new THREE.UV(a/this.segmentsR,c/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(l,b,e,f));this.faceVertexUvs[0].push([h,n,p,t])}this.computeCentroids();
 this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,n){var p=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(h.useOldVertexColors){p.vertexColors=[];for(var t,u,v,w=0;w<4;w++){v=n[w];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<v.length;y++)u=k.vertexColors[v[y]-1],t.r+=u.r,t.g+=u.g,t.b+=u.b;t.r/=v.length;t.g/=v.length;t.b/=v.length;p.vertexColors[w]=t}}l.push(p);(!h.supportUVs||x.length!=0)&&f.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
-b)}var e=[],l=[],f=[],h=this,k=a.vertices,e=a.faces,n=k.concat(),t=[],p={},v={},x=[],u,y,w,A,B,D=a.faceVertexUvs[0];u=0;for(y=D.length;u<y;u++){w=0;for(A=D[u].length;w<A;w++)B=e[u]["abcd".charAt(w)],x[B]||(x[B]=D[u][w])}var z;u=0;for(y=e.length;u<y;u++)if(B=e[u],t.push(B.centroid),n.push(new THREE.Vertex(B.centroid)),h.supportUVs&&x.length!=0){z=new THREE.UV;if(B instanceof THREE.Face3)z.u=x[B.a].u+x[B.b].u+x[B.c].u,z.v=x[B.a].v+x[B.b].v+x[B.c].v,z.u/=3,z.v/=3;else if(B instanceof THREE.Face4)z.u=
-x[B.a].u+x[B.b].u+x[B.c].u+x[B.d].u,z.v=x[B.a].v+x[B.b].v+x[B.c].v+x[B.d].v,z.u/=4,z.v/=4;x.push(z)}y=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,h,f,k,l={};e=0;for(h=a.faces.length;e<h;e++)f=a.faces[e],f instanceof THREE.Face3?(k=b(f.a,f.b),c(l,k,e),k=b(f.b,f.c),c(l,k,e),k=b(f.c,f.a),c(l,k,e)):f instanceof THREE.Face4&&(k=b(f.a,f.b),c(l,k,e),k=b(f.b,f.c),c(l,k,e),k=b(f.c,f.d),c(l,k,e),k=b(f.d,f.a),c(l,k,e));return l}(a);var C=0,D=k.length,L,H,I={},R={},K=function(a,
-b){I[a]===void 0&&(I[a]=[]);I[a].push(b)},N=function(a,b){R[a]===void 0&&(R[a]={});R[a][b]=null};for(u in y){z=y[u];L=u.split("_");H=L[0];L=L[1];K(H,[H,L]);K(L,[H,L]);w=0;for(A=z.length;w<A;w++)B=z[w],N(H,B,u),N(L,B,u);z.length<2&&(v[u]=!0)}for(u in y)if(z=y[u],B=z[0],z=z[1],L=u.split("_"),H=L[0],L=L[1],A=new THREE.Vector3,v[u]?(A.addSelf(k[H].position),A.addSelf(k[L].position),A.multiplyScalar(0.5)):(A.addSelf(t[B]),A.addSelf(t[z]),A.addSelf(k[H].position),A.addSelf(k[L].position),A.multiplyScalar(0.25)),
-p[u]=D+e.length+C,n.push(new THREE.Vertex(A)),C++,h.supportUVs&&x.length!=0)z=new THREE.UV,z.u=x[H].u+x[L].u,z.v=x[H].v+x[L].v,z.u/=2,z.v/=2,x.push(z);var M,G;L=["123","12","2","23"];A=["123","23","3","31"];var K=["123","31","1","12"],N=["1234","12","2","23"],Z=["1234","23","3","34"],$=["1234","34","4","41"],U=["1234","41","1","12"];u=0;for(y=t.length;u<y;u++)B=e[u],z=D+u,B instanceof THREE.Face3?(C=b(B.a,B.b),H=b(B.b,B.c),M=b(B.c,B.a),c(z,p[C],B.b,p[H],B,L),c(z,p[H],B.c,p[M],B,A),c(z,p[M],B.a,p[C],
-B,K)):B instanceof THREE.Face4?(C=b(B.a,B.b),H=b(B.b,B.c),M=b(B.c,B.d),G=b(B.d,B.a),c(z,p[C],B.b,p[H],B,N),c(z,p[H],B.c,p[M],B,Z),c(z,p[M],B.d,p[G],B,$),c(z,p[G],B.a,p[C],B,U)):console.log("face should be a face!",B);e=n;n=new THREE.Vector3;p=new THREE.Vector3;u=0;for(y=k.length;u<y;u++)if(I[u]!==void 0){n.set(0,0,0);p.set(0,0,0);B=new THREE.Vector3(0,0,0);z=0;for(w in R[u])n.addSelf(t[w]),z++;C=0;D=I[u].length;for(w=0;w<D;w++)v[b(I[u][w][0],I[u][w][1])]&&C++;if(C!=2){n.divideScalar(z);for(w=0;w<
-D;w++)z=I[u][w],z=k[z[0]].position.clone().addSelf(k[z[1]].position).divideScalar(2),p.addSelf(z);p.divideScalar(D);B.addSelf(k[u].position);B.multiplyScalar(D-3);B.addSelf(n);B.addSelf(p.multiplyScalar(2));B.divideScalar(D);e[u].position=B}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,e,k,n){var p=new THREE.Face4(a,b,c,e,null,k.color,k.material);if(h.useOldVertexColors){p.vertexColors=[];for(var t,u,v,w=0;w<4;w++){v=n[w];t=new THREE.Color;t.setRGB(0,0,0);for(var x=0;x<v.length;x++)u=k.vertexColors[v[x]-1],t.r+=u.r,t.g+=u.g,t.b+=u.b;t.r/=v.length;t.g/=v.length;t.b/=v.length;p.vertexColors[w]=t}}l.push(p);(!h.supportUVs||y.length!=0)&&f.push([y[a],y[b],y[c],y[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
+b)}var e=[],l=[],f=[],h=this,k=a.vertices,e=a.faces,n=k.concat(),p=[],t={},u={},y=[],v,x,w,z,B,C=a.faceVertexUvs[0];v=0;for(x=C.length;v<x;v++){w=0;for(z=C[v].length;w<z;w++)B=e[v]["abcd".charAt(w)],y[B]||(y[B]=C[v][w])}var A;v=0;for(x=e.length;v<x;v++)if(B=e[v],p.push(B.centroid),n.push(new THREE.Vertex(B.centroid)),h.supportUVs&&y.length!=0){A=new THREE.UV;if(B instanceof THREE.Face3)A.u=y[B.a].u+y[B.b].u+y[B.c].u,A.v=y[B.a].v+y[B.b].v+y[B.c].v,A.u/=3,A.v/=3;else if(B instanceof THREE.Face4)A.u=
+y[B.a].u+y[B.b].u+y[B.c].u+y[B.d].u,A.v=y[B.a].v+y[B.b].v+y[B.c].v+y[B.d].v,A.u/=4,A.v/=4;y.push(A)}x=function(a){function c(a,b,e){a[b]===void 0&&(a[b]=[]);a[b].push(e)}var e,f,h,k,l={};e=0;for(f=a.faces.length;e<f;e++)h=a.faces[e],h instanceof THREE.Face3?(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.a),c(l,k,e)):h instanceof THREE.Face4&&(k=b(h.a,h.b),c(l,k,e),k=b(h.b,h.c),c(l,k,e),k=b(h.c,h.d),c(l,k,e),k=b(h.d,h.a),c(l,k,e));return l}(a);var D=0,C=k.length,K,P,F={},Q={},H=function(a,
+b){F[a]===void 0&&(F[a]=[]);F[a].push(b)},N=function(a,b){Q[a]===void 0&&(Q[a]={});Q[a][b]=null};for(v in x){A=x[v];K=v.split("_");P=K[0];K=K[1];H(P,[P,K]);H(K,[P,K]);w=0;for(z=A.length;w<z;w++)B=A[w],N(P,B,v),N(K,B,v);A.length<2&&(u[v]=!0)}for(v in x)if(A=x[v],B=A[0],A=A[1],K=v.split("_"),P=K[0],K=K[1],z=new THREE.Vector3,u[v]?(z.addSelf(k[P].position),z.addSelf(k[K].position),z.multiplyScalar(0.5)):(z.addSelf(p[B]),z.addSelf(p[A]),z.addSelf(k[P].position),z.addSelf(k[K].position),z.multiplyScalar(0.25)),
+t[v]=C+e.length+D,n.push(new THREE.Vertex(z)),D++,h.supportUVs&&y.length!=0)A=new THREE.UV,A.u=y[P].u+y[K].u,A.v=y[P].v+y[K].v,A.u/=2,A.v/=2,y.push(A);var L,G;K=["123","12","2","23"];z=["123","23","3","31"];var H=["123","31","1","12"],N=["1234","12","2","23"],V=["1234","23","3","34"],ca=["1234","34","4","41"],W=["1234","41","1","12"];v=0;for(x=p.length;v<x;v++)B=e[v],A=C+v,B instanceof THREE.Face3?(D=b(B.a,B.b),P=b(B.b,B.c),L=b(B.c,B.a),c(A,t[D],B.b,t[P],B,K),c(A,t[P],B.c,t[L],B,z),c(A,t[L],B.a,t[D],
+B,H)):B instanceof THREE.Face4?(D=b(B.a,B.b),P=b(B.b,B.c),L=b(B.c,B.d),G=b(B.d,B.a),c(A,t[D],B.b,t[P],B,N),c(A,t[P],B.c,t[L],B,V),c(A,t[L],B.d,t[G],B,ca),c(A,t[G],B.a,t[D],B,W)):console.log("face should be a face!",B);e=n;n=new THREE.Vector3;t=new THREE.Vector3;v=0;for(x=k.length;v<x;v++)if(F[v]!==void 0){n.set(0,0,0);t.set(0,0,0);B=new THREE.Vector3(0,0,0);A=0;for(w in Q[v])n.addSelf(p[w]),A++;D=0;C=F[v].length;for(w=0;w<C;w++)u[b(F[v][w][0],F[v][w][1])]&&D++;if(D!=2){n.divideScalar(A);for(w=0;w<
+C;w++)A=F[v][w],A=k[A[0]].position.clone().addSelf(k[A[1]].position).divideScalar(2),t.addSelf(A);t.divideScalar(C);B.addSelf(k[v].position);B.multiplyScalar(C-3);B.addSelf(n);B.addSelf(t.multiplyScalar(2));B.divideScalar(C);e[v].position=B}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=f;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
 THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
 THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
 1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=THREE.Loader.prototype.createMaterial(c[e],b)},hasNormals:function(a){var c,b,e=a.materials.length;for(b=0;b<e;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
-a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(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));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function l(a,b,h,f,k,l){var n=document.createElement("canvas");a[b]=new THREE.Texture(n);a[b].sourceFile=h;if(f){a[b].repeat.set(f[0],f[1]);if(f[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
-if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}k&&a[b].offset.set(k[0],k[1]);if(l){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[l[0]]!==void 0)a[b].wrapS=f[l[0]];if(f[l[1]]!==void 0)a[b].wrapT=f[l[1]]}e(a[b],c+"/"+h)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h,k,n;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
+a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(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));a.image.width=c;a.image.height=e;a.image.getContext("2d").drawImage(this,0,0,c,e)}else a.image=this;a.needsUpdate=!0};e.src=c}function l(a,b,f,h,k,l){var n=document.createElement("canvas");a[b]=new THREE.Texture(n);a[b].sourceFile=f;if(h){a[b].repeat.set(h[0],h[1]);if(h[0]!=1)a[b].wrapS=THREE.RepeatWrapping;
+if(h[1]!=1)a[b].wrapT=THREE.RepeatWrapping}k&&a[b].offset.set(k[0],k[1]);if(l){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[l[0]]!==void 0)a[b].wrapS=h[l[0]];if(h[l[1]]!==void 0)a[b].wrapT=h[l[1]]}e(a[b],c+"/"+f)}function f(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var h,k,n;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?k="MeshPhongMaterial":a.shading=="Basic"&&(k="MeshBasicMaterial"));
 if(a.blending)if(a.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)h.transparent=a.transparent;if(a.depthTest!==void 0)h.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(a.vertexColors)h.vertexColors=THREE.VertexColors;if(a.colorDiffuse)h.color=f(a.colorDiffuse);
 else if(a.DbgColor)h.color=a.DbgColor;if(a.colorSpecular)h.specular=f(a.colorSpecular);if(a.colorAmbient)h.ambient=f(a.colorAmbient);if(a.transparency)h.opacity=a.transparency;if(a.specularCoef)h.shininess=a.specularCoef;a.mapDiffuse&&c&&l(h,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&l(h,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&l(h,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
-a.mapSpecular&&c&&l(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var t=THREE.ShaderUtils.lib.normal,p=THREE.UniformsUtils.clone(t.uniforms),v=h.color;k=h.specular;n=h.ambient;var x=h.shininess;p.tNormal.texture=h.normalMap;if(a.mapNormalFactor)p.uNormalScale.value=a.mapNormalFactor;if(h.map)p.tDiffuse.texture=h.map,p.enableDiffuse.value=!0;if(h.specularMap)p.tSpecular.texture=h.specularMap,p.enableSpecular.value=!0;if(h.lightMap)p.tAO.texture=
-h.lightMap,p.enableAO.value=!0;p.uDiffuseColor.value.setHex(v);p.uSpecularColor.value.setHex(k);p.uAmbientColor.value.setHex(n);p.uShininess.value=x;if(h.opacity)p.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:p,lights:!0,fog:!0})}else h=new THREE[k](h);return h}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
+a.mapSpecular&&c&&l(h,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var p=THREE.ShaderUtils.lib.normal,t=THREE.UniformsUtils.clone(p.uniforms),u=h.color;k=h.specular;n=h.ambient;var y=h.shininess;t.tNormal.texture=h.normalMap;if(a.mapNormalFactor)t.uNormalScale.value=a.mapNormalFactor;if(h.map)t.tDiffuse.texture=h.map,t.enableDiffuse.value=!0;if(h.specularMap)t.tSpecular.texture=h.specularMap,t.enableSpecular.value=!0;if(h.lightMap)t.tAO.texture=
+h.lightMap,t.enableAO.value=!0;t.uDiffuseColor.value.setHex(u);t.uSpecularColor.value.setHex(k);t.uAmbientColor.value.setHex(n);t.uShininess.value=y;if(h.opacity)t.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:t,lights:!0,fog:!0})}else h=new THREE[k](h);return h}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
 THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(a,c,b,e){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var l=a,a=l.model,c=l.callback,b=l.texture_path,e=l.bin_path}var b=b?b:this.extractUrlbase(a),e=e?e:this.extractUrlbase(a),l=Date.now(),a=new Worker(a),f=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
 c,e,b,f)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(l)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,l,f){var h=new XMLHttpRequest,k=e+"/"+a,n=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,l,c):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?f&&(n==0&&(n=h.getResponseHeader("Content-Length")),f({total:n,loaded:h.responseText.length})):h.readyState==2&&(n=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
 h.setRequestHeader("Content-Type","text/plain");h.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var l=function(b){function c(a,b){var e=p(a,b),f=p(a,b+1),h=p(a,b+2),k=p(a,b+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=p(a,b),e=p(a,b+1),f=p(a,b+2);return(p(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=p(a,b);return(p(a,b+1)<<8)+c}function t(a,b){var c=p(a,b);return c>127?c-256:c}function p(a,b){return a.charCodeAt(b)&255}function v(b){var c,
-e,f;c=k(a,b);e=k(a,b+H);f=k(a,b+I);b=l(a,b+R);B.faces.push(new THREE.Face3(c,e,f,null,null,b))}function x(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+H);f=k(a,b+I);h=l(a,b+R);o=k(a,b+K);p=k(a,b+N);t=k(a,b+M);var b=C[p*3],u=C[p*3+1];p=C[p*3+2];var v=C[t*3],w=C[t*3+1];t=C[t*3+2];B.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(C[o*3],C[o*3+1],C[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function u(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+Z);h=k(a,b+$);b=l(a,b+U);B.faces.push(new THREE.Face4(c,
-e,f,h,null,null,b))}function y(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+G);f=k(a,b+Z);h=k(a,b+$);p=l(a,b+U);t=k(a,b+o);u=k(a,b+da);v=k(a,b+Y);w=k(a,b+pa);var b=C[u*3],x=C[u*3+1];u=C[u*3+2];var E=C[v*3],y=C[v*3+1];v=C[v*3+2];var ia=C[w*3],z=C[w*3+1];w=C[w*3+2];B.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(C[t*3],C[t*3+1],C[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(E,y,v),new THREE.Vector3(ia,z,w)],null,p))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+P);f=k(a,b+T);b=L[c*2];h=L[c*
-2+1];c=L[e*2];var l=B.faceVertexUvs[0];e=L[e*2+1];var n=L[f*2];f=L[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function A(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+ja);f=k(a,b+ea);h=k(a,b+aa);b=L[c*2];l=L[c*2+1];c=L[e*2];n=L[e*2+1];e=L[f*2];var o=B.faceVertexUvs[0];f=L[f*2+1];var p=L[h*2];h=L[h*2+1];var t=[];t.push(new THREE.UV(b,l));t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}var B=this,D=0,z,C=[],L=
-[],H,I,R,K,N,M,G,Z,$,U,o,da,Y,pa,P,T,ja,ea,aa,na,ga,ca,la,fa,ka;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(B,e,b);z={signature:a.substr(D,8),header_bytes:p(a,D+8),vertex_coordinate_bytes:p(a,D+9),normal_coordinate_bytes:p(a,D+10),uv_coordinate_bytes:p(a,D+11),vertex_index_bytes:p(a,D+12),normal_index_bytes:p(a,D+13),uv_index_bytes:p(a,D+14),material_index_bytes:p(a,D+15),nvertices:k(a,D+16),nnormals:k(a,D+16+4),nuvs:k(a,D+16+8),ntri_flat:k(a,D+16+12),ntri_smooth:k(a,D+16+16),ntri_flat_uv:k(a,
-D+16+20),ntri_smooth_uv:k(a,D+16+24),nquad_flat:k(a,D+16+28),nquad_smooth:k(a,D+16+32),nquad_flat_uv:k(a,D+16+36),nquad_smooth_uv:k(a,D+16+40)};D+=z.header_bytes;H=z.vertex_index_bytes;I=z.vertex_index_bytes*2;R=z.vertex_index_bytes*3;K=z.vertex_index_bytes*3+z.material_index_bytes;N=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;M=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;G=z.vertex_index_bytes;Z=z.vertex_index_bytes*2;$=z.vertex_index_bytes*3;U=z.vertex_index_bytes*
-4;o=z.vertex_index_bytes*4+z.material_index_bytes;da=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;Y=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;pa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;P=z.uv_index_bytes;T=z.uv_index_bytes*2;ja=z.uv_index_bytes;ea=z.uv_index_bytes*2;aa=z.uv_index_bytes*3;b=z.vertex_index_bytes*3+z.material_index_bytes;ka=z.vertex_index_bytes*4+z.material_index_bytes;na=z.ntri_flat*b;ga=z.ntri_smooth*(b+
-z.normal_index_bytes*3);ca=z.ntri_flat_uv*(b+z.uv_index_bytes*3);la=z.ntri_smooth_uv*(b+z.normal_index_bytes*3+z.uv_index_bytes*3);fa=z.nquad_flat*ka;b=z.nquad_smooth*(ka+z.normal_index_bytes*4);ka=z.nquad_flat_uv*(ka+z.uv_index_bytes*4);D+=function(b){for(var e,f,l,k=z.vertex_coordinate_bytes*3,n=b+z.nvertices*k;b<n;b+=k)e=c(a,b),f=c(a,b+z.vertex_coordinate_bytes),l=c(a,b+z.vertex_coordinate_bytes*2),B.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,l)));return z.nvertices*k}(D);D+=function(b){for(var c,
-e,f,h=z.normal_coordinate_bytes*3,l=b+z.nnormals*h;b<l;b+=h)c=t(a,b),e=t(a,b+z.normal_coordinate_bytes),f=t(a,b+z.normal_coordinate_bytes*2),C.push(c/127,e/127,f/127);return z.nnormals*h}(D);D+=function(b){for(var e,f,l=z.uv_coordinate_bytes*2,k=b+z.nuvs*l;b<k;b+=l)e=c(a,b),f=c(a,b+z.uv_coordinate_bytes),L.push(e,f);return z.nuvs*l}(D);na=D+na;ga=na+ga;ca=ga+ca;la=ca+la;fa=la+fa;b=fa+b;ka=b+ka;(function(a){var b,c=z.vertex_index_bytes*3+z.material_index_bytes,e=c+z.uv_index_bytes*3,f=a+z.ntri_flat_uv*
-e;for(b=a;b<f;b+=e)v(b),w(b+c);return f-a})(ga);(function(a){var b,c=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,e=c+z.uv_index_bytes*3,f=a+z.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),w(b+c);return f-a})(ca);(function(a){var b,c=z.vertex_index_bytes*4+z.material_index_bytes,e=c+z.uv_index_bytes*4,f=a+z.nquad_flat_uv*e;for(b=a;b<f;b+=e)u(b),A(b+c);return f-a})(b);(function(a){var b,c=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,e=c+z.uv_index_bytes*4,f=
-a+z.nquad_smooth_uv*e;for(b=a;b<f;b+=e)y(b),A(b+c);return f-a})(ka);(function(a){var b,c=z.vertex_index_bytes*3+z.material_index_bytes,e=a+z.ntri_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(D);(function(a){var b,c=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,e=a+z.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(na);(function(a){var b,c=z.vertex_index_bytes*4+z.material_index_bytes,e=a+z.nquad_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(la);(function(a){var b,c=z.vertex_index_bytes*
-4+z.material_index_bytes+z.normal_index_bytes*4,e=a+z.nquad_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(fa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};l.prototype=new THREE.Geometry;l.prototype.constructor=l;c(new l(b))};
-THREE.ColladaLoader=function(){function a(a,e,l){ga=a;e=e||fa;l!==void 0&&(a=l.split("/"),a.pop(),Da=a.length<1?"":a.join("/")+"/");ha=c("//dae:library_images/dae:image",h,"image");ma=c("//dae:library_materials/dae:material",R,"material");ua=c("//dae:library_effects/dae:effect",Z,"effect");qa=c("//dae:library_geometries/dae:geometry",A,"geometry");ta=c("//dae:library_controllers/dae:controller",k,"controller");O=c("//dae:library_animations/dae:animation",U,"animation");xa=c(".//dae:library_visual_scenes/dae:visual_scene",
-p,"visual_scene");Ba=[];Ea=[];(a=ga.evaluate(".//dae:scene/dae:instance_visual_scene",ga,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),la=xa[a]):la=null;ca=new THREE.Object3D;for(a=0;a<la.nodes.length;a++)ca.add(f(la.nodes[a]));b();for(var n in O);n={scene:ca,morphs:Ba,skins:Ea,dae:{images:ha,materials:ma,effects:ua,geometries:qa,controllers:ta,animations:O,visualScenes:xa,scene:la}};e&&e(n);return n}function c(a,b,c){for(var a=ga.evaluate(a,
-ga,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in O)for(var f=O[e],h=0;h<f.sampler.length;h++){var l=f.sampler[h];l.create();a=Math.min(a,l.startTime);b=Math.max(b,l.endTime);c=Math.max(c,l.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=
-a.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function l(a,c,f){var h=ta[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var l=b(),c=la.getChildById(c.skeleton[0],!0)||la.getChildBySid(c.skeleton[0],!0),k,n,o,p,t=new THREE.Vector3,
-u;for(k=0;k<a.vertices.length;k++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[k].position);for(f=0;f<l.frames;f++){var v=[],w=[];for(k=0;k<a.vertices.length;k++)w.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);k=v;n=h.skin;for(p=0;p<k.length;p++)if(o=k[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
-0;y<n.weights[x].length;y++){var z=n.weights[x][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(k=0;k<v.length;k++)if(v[k].type=="JOINT")for(n=0;n<v[k].weights.length;n++)o=v[k].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=w[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[k].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:w})}}}function f(a){var b=
-new THREE.Object3D,c,e,h;for(h=0;h<a.controllers.length;h++){var k=ta[a.controllers[h].url];switch(k.type){case "skin":if(qa[k.skin.source]){var n=new w;n.url=k.skin.source;n.instance_material=a.controllers[h].instance_material;a.geometries.push(n);c=a.controllers[h]}else if(ta[k.skin.source]&&(e=k=ta[k.skin.source],k.morph&&qa[k.morph.source]))n=new w,n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n);break;case "morph":if(qa[k.morph.source])n=new w,
-n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n),e=a.controllers[h];console.log("ColladaLoader: Morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],n=k.instance_material,k=qa[k.url],o={},p=0,t;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(n)for(j=0;j<n.length;j++){t=n[j];var v=ua[ma[t.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;t=o[t.symbol]=
-v.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)p=k.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)l(k,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(k,n),n.skeleton=c.skeleton,n.skinController=ta[c.url],n.skinInstanceController=c,n.name="skin_"+Ea.length,Ea.push(n);else if(e!==void 0){o=k;p=e instanceof u?ta[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
-else{p=p.morph;for(v=0;v<p.targets.length;v++){var x=qa[p.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(k,n);n.name="morph_"+Ba.length;Ba.push(n)}else n=new THREE.Mesh(k,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
-b.scale);for(h=0;h<a.nodes.length;h++)b.add(f(a.nodes[h],a));return b}function h(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function p(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function v(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function u(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function w(){this.url="";this.instance_material=[]}function A(){this.id="";this.mesh=null}function B(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function D(){}function z(){this.material="";this.count=
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function C(){this.source="";this.stride=this.count=0;this.params=[]}function L(){this.input={}}function H(){this.semantic="";this.offset=0;this.source="";this.set=0}function I(a){this.id=a;this.type=null}function R(){this.name=this.id="";this.instance_effect=null}function K(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function N(a,
-b){this.type=a;this.effect=b;this.material=null}function M(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Z(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function U(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function o(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
-this.dotSyntax=this.sid=null}function da(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function Y(a){var b=a.getAttribute("id");if(ka[b]!=void 0)return ka[b];ka[b]=(new I(b)).parse(a);return ka[b]}function pa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function P(a){for(var a=ja(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function T(a){for(var a=ja(a),b=[],
-c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function ja(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ea(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function aa(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function na(a,b){var c="";c+=aa(a.x,b)+",";c+=aa(a.y,b)+",";c+=aa(a.z,b);return c}var ga=null,ca=null,
-la,fa=null,ka={},ha={},O={},ta={},qa={},ma={},ua={},xa,Da,Ba,Ea,Ca=THREE.SmoothShading;h.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);
-this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new I).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],
-a.semantic){case "MORPH_TARGET":this.targets=f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new H).parse(e))}}return b};t.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];
-if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=P(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new I).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};t.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=
-a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=(new H).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};t.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var k=a.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "input":f.push((new H).parse(k));break;case "v":c=T(k.textContent);break;case "vcount":e=T(k.textContent)}}for(h=k=0;h<e.length;h++){for(var l=
-e[h],n=[],o=0;o<l;o++){for(var p={},t=0;t<f.length;t++){var u=f[t],v=c[k+u.offset];switch(u.semantic){case "JOINT":p.joint=v;break;case "WEIGHT":p.weight=b[u.source].data[v]}}n.push(p);k+=f.length}for(o=0;o<n.length;o++)n[o].index=h;this.weights.push(n)}};p.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};p.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,
-b);if(e)return e}return null};p.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new v).parse(c))}}return this};v.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,k=f.indexOf("(")>=0,l;if(h)e=f.split("."),
-f=e.shift(),e.shift();else if(k){l=f.split("(");f=l.shift();for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:k,arrIndices:l},c}return null};v.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};v.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,
-b);if(e)return e}return null};v.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};v.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=
-0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new v).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new u).parse(b));break;case "instance_geometry":this.geometries.push((new w).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ga.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ga,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null).iterateNext())&&this.nodes.push((new v).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in O)for(var f=O[e],h=0;h<f.channel.length;h++){var k=f.channel[h],l=f.sampler[h];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(k)}if(a.length)this.startTime=
-c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},n=h=void 0,h=0;h<this.channels.length;h++)n=this.channels[h],f[n.sid]=n;k=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(l=this.transforms[h],n=f[l.sid],n!==void 0){for(var o=n.sampler,p,n=0;n<o.input.length-1;n++)if(o.input[n+
-1]>b){p=o.output[n];break}k=p!==void 0?p instanceof THREE.Matrix4?k.multiply(k,p):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);b=k;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};v.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};x.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=
-a.nodeName;this.data=P(a.textContent);this.updateMatrix();return this};x.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=
-this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};u.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));
-break;case "bind_material":if(c=ga.evaluate(".//dae:instance_material",c,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new y).parse(e)),e=c.iterateNext()}}return this};y.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};w.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=
-a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=ga.evaluate(".//dae:instance_material",c,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new y).parse(b)),b=a.iterateNext();break}}return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new B(this)).parse(c)}}return this};B.prototype.parse=function(a){function b(a,
-c){var e=na(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":Y(e);break;case "vertices":this.vertices=(new L).parse(e);break;case "triangles":this.primitives.push((new z).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new D).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ka[this.vertices.input.POSITION.source].data;
-for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};B.prototype.handlePrimitive=function(a,b,c){var e=
-0,f,h,k=a.p,l=a.inputs,n,o,p,t=0,u=3,v=[];for(f=0;f<l.length;f++)switch(n=l[f],n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(h=0;h<l.length;h++)switch(n=l[h],source=ka[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=na(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+
-2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;u==3?B=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):u==4&&(B=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));B.daeMaterial=a.material;b.faces.push(B);for(h=0;h<v.length;h++)f=y[v[h]],b.faceVertexUvs[h].push([f[0],
-f[1],f[2]]);e+=l.length*u}};D.prototype=new z;D.prototype.constructor=D;z.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};z.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ea(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new H).parse(a.childNodes[b]));break;case "vcount":this.vcount=
-T(c.textContent);break;case "p":this.p=T(c.textContent)}}return this};C.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=ea(a,"count",0);this.stride=ea(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName==
-"input"&&(input=(new H).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};H.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=ea(a,"set",-1);this.offset=ea(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};I.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=
-ja(c.textContent),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=T(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ja(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new C).parse(c.childNodes[e]);break}}}return this};
-I.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};R.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new $).parse(a.childNodes[b]);break}return this};K.prototype.isColor=function(){return this.texture==null};K.prototype.isTexture=function(){return this.texture!=null};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=P(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],
-c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new K).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=ga.evaluate(".//dae:float",c,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
-null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};N.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof K)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ha[this.effect.surface.init_from]))a.map=
-THREE.ImageUtils.loadTexture(Da+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Ca;return this.material=new THREE.MeshLambertMaterial(a)};M.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
-if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=
-c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};Z.prototype.create=function(){if(this.shader==null)return null};Z.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
-Z.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new M(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};Z.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
-break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};Z.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new N(c.nodeName,this)).parse(c)}}};$.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};U.prototype.parse=function(a){this.id=a.getAttribute("id");
-this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new I).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new da(this)).parse(c));break;case "channel":this.channel.push((new o(this)).parse(c))}}return this};o.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
-b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};da.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new H).parse(c))}}return this};
-da.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var l=function(b){function c(a,b){var e=t(a,b),f=t(a,b+1),h=t(a,b+2),k=t(a,b+3),l=(k<<1&255|h>>7)-127;e|=(h&127)<<16|f<<8;if(e==0&&l==-127)return 0;return(1-2*(k>>7))*(1+e*Math.pow(2,-23))*Math.pow(2,l)}function k(a,b){var c=t(a,b),e=t(a,b+1),f=t(a,b+2);return(t(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=t(a,b);return(t(a,b+1)<<8)+c}function p(a,b){var c=t(a,b);return c>127?c-256:c}function t(a,b){return a.charCodeAt(b)&255}function u(b){var c,
+e,f;c=k(a,b);e=k(a,b+P);f=k(a,b+F);b=l(a,b+Q);B.faces.push(new THREE.Face3(c,e,f,null,null,b))}function y(b){var c,e,f,h,o,p,t;c=k(a,b);e=k(a,b+P);f=k(a,b+F);h=l(a,b+Q);o=k(a,b+H);p=k(a,b+N);t=k(a,b+L);var b=D[p*3],u=D[p*3+1];p=D[p*3+2];var v=D[t*3],w=D[t*3+1];t=D[t*3+2];B.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(D[o*3],D[o*3+1],D[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function v(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+V);h=k(a,b+ca);b=l(a,b+W);B.faces.push(new THREE.Face4(c,
+e,f,h,null,null,b))}function x(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+G);f=k(a,b+V);h=k(a,b+ca);p=l(a,b+W);t=k(a,b+T);u=k(a,b+o);v=k(a,b+Z);w=k(a,b+ha);var b=D[u*3],x=D[u*3+1];u=D[u*3+2];var y=D[v*3],ja=D[v*3+1];v=D[v*3+2];var Y=D[w*3],J=D[w*3+1];w=D[w*3+2];B.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(D[t*3],D[t*3+1],D[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3(y,ja,v),new THREE.Vector3(Y,J,w)],null,p))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+M);f=k(a,b+R);b=K[c*2];h=K[c*
+2+1];c=K[e*2];var l=B.faceVertexUvs[0];e=K[e*2+1];var n=K[f*2];f=K[f*2+1];var o=[];o.push(new THREE.UV(b,h));o.push(new THREE.UV(c,e));o.push(new THREE.UV(n,f));l.push(o)}function z(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+X);f=k(a,b+la);h=k(a,b+$);b=K[c*2];l=K[c*2+1];c=K[e*2];n=K[e*2+1];e=K[f*2];var o=B.faceVertexUvs[0];f=K[f*2+1];var p=K[h*2];h=K[h*2+1];var t=[];t.push(new THREE.UV(b,l));t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,h));o.push(t)}var B=this,C=0,A,D=[],K=[],
+P,F,Q,H,N,L,G,V,ca,W,T,o,Z,ha,M,R,X,la,$,ma,na,ea,ka,fa,ia;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(B,e,b);A={signature:a.substr(C,8),header_bytes:t(a,C+8),vertex_coordinate_bytes:t(a,C+9),normal_coordinate_bytes:t(a,C+10),uv_coordinate_bytes:t(a,C+11),vertex_index_bytes:t(a,C+12),normal_index_bytes:t(a,C+13),uv_index_bytes:t(a,C+14),material_index_bytes:t(a,C+15),nvertices:k(a,C+16),nnormals:k(a,C+16+4),nuvs:k(a,C+16+8),ntri_flat:k(a,C+16+12),ntri_smooth:k(a,C+16+16),ntri_flat_uv:k(a,
+C+16+20),ntri_smooth_uv:k(a,C+16+24),nquad_flat:k(a,C+16+28),nquad_smooth:k(a,C+16+32),nquad_flat_uv:k(a,C+16+36),nquad_smooth_uv:k(a,C+16+40)};C+=A.header_bytes;P=A.vertex_index_bytes;F=A.vertex_index_bytes*2;Q=A.vertex_index_bytes*3;H=A.vertex_index_bytes*3+A.material_index_bytes;N=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;L=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;G=A.vertex_index_bytes;V=A.vertex_index_bytes*2;ca=A.vertex_index_bytes*3;W=A.vertex_index_bytes*
+4;T=A.vertex_index_bytes*4+A.material_index_bytes;o=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;Z=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;ha=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;M=A.uv_index_bytes;R=A.uv_index_bytes*2;X=A.uv_index_bytes;la=A.uv_index_bytes*2;$=A.uv_index_bytes*3;b=A.vertex_index_bytes*3+A.material_index_bytes;ia=A.vertex_index_bytes*4+A.material_index_bytes;ma=A.ntri_flat*b;na=A.ntri_smooth*(b+A.normal_index_bytes*
+3);ea=A.ntri_flat_uv*(b+A.uv_index_bytes*3);ka=A.ntri_smooth_uv*(b+A.normal_index_bytes*3+A.uv_index_bytes*3);fa=A.nquad_flat*ia;b=A.nquad_smooth*(ia+A.normal_index_bytes*4);ia=A.nquad_flat_uv*(ia+A.uv_index_bytes*4);C+=function(b){for(var e,f,k,l=A.vertex_coordinate_bytes*3,n=b+A.nvertices*l;b<n;b+=l)e=c(a,b),f=c(a,b+A.vertex_coordinate_bytes),k=c(a,b+A.vertex_coordinate_bytes*2),B.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,k)));return A.nvertices*l}(C);C+=function(b){for(var c,e,f,h=A.normal_coordinate_bytes*
+3,k=b+A.nnormals*h;b<k;b+=h)c=p(a,b),e=p(a,b+A.normal_coordinate_bytes),f=p(a,b+A.normal_coordinate_bytes*2),D.push(c/127,e/127,f/127);return A.nnormals*h}(C);C+=function(b){for(var e,f,k=A.uv_coordinate_bytes*2,l=b+A.nuvs*k;b<l;b+=k)e=c(a,b),f=c(a,b+A.uv_coordinate_bytes),K.push(e,f);return A.nuvs*k}(C);ma=C+ma;na=ma+na;ea=na+ea;ka=ea+ka;fa=ka+fa;b=fa+b;ia=b+ia;(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes,e=c+A.uv_index_bytes*3,f=a+A.ntri_flat_uv*e;for(b=a;b<f;b+=e)u(b),w(b+
+c);return f-a})(na);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=c+A.uv_index_bytes*3,f=a+A.ntri_smooth_uv*e;for(b=a;b<f;b+=e)y(b),w(b+c);return f-a})(ea);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes,e=c+A.uv_index_bytes*4,f=a+A.nquad_flat_uv*e;for(b=a;b<f;b+=e)v(b),z(b+c);return f-a})(b);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,e=c+A.uv_index_bytes*4,f=a+A.nquad_smooth_uv*e;for(b=
+a;b<f;b+=e)x(b),z(b+c);return f-a})(ia);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes,e=a+A.ntri_flat*c;for(b=a;b<e;b+=c)u(b);return e-a})(C);(function(a){var b,c=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,e=a+A.ntri_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(ma);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes,e=a+A.nquad_flat*c;for(b=a;b<e;b+=c)v(b);return e-a})(ka);(function(a){var b,c=A.vertex_index_bytes*4+A.material_index_bytes+
+A.normal_index_bytes*4,e=a+A.nquad_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(fa);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};l.prototype=new THREE.Geometry;l.prototype.constructor=l;c(new l(b))};
+THREE.ColladaLoader=function(){function a(a,e,l){na=a;e=e||fa;l!==void 0&&(a=l.split("/"),a.pop(),va=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",h,"image");qa=c("//dae:library_materials/dae:material",Q,"material");sa=c("//dae:library_effects/dae:effect",V,"effect");ua=c("//dae:library_geometries/dae:geometry",z,"geometry");ta=c("//dae:library_controllers/dae:controller",k,"controller");da=c("//dae:library_animations/dae:animation",W,"animation");Da=c(".//dae:library_visual_scenes/dae:visual_scene",
+t,"visual_scene");Ea=[];Ca=[];(a=na.evaluate(".//dae:scene/dae:instance_visual_scene",na,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ka=Da[a]):ka=null;ea=new THREE.Object3D;for(a=0;a<ka.nodes.length;a++)ea.add(f(ka.nodes[a]));b();for(var n in da);n={scene:ea,morphs:Ea,skins:Ca,dae:{images:ga,materials:qa,effects:sa,geometries:ua,controllers:ta,animations:da,visualScenes:Da,scene:ka}};e&&e(n);return n}function c(a,b,c){for(var a=na.evaluate(a,
+na,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),e={},f=a.iterateNext(),h=0;f;){f=(new b).parse(f);if(f.id.length==0)f.id=c+h++;e[f.id]=f;f=a.iterateNext()}return e}function b(){var a=1E6,b=-a,c=0,e;for(e in da)for(var f=da[e],h=0;h<f.sampler.length;h++){var k=f.sampler[h];k.create();a=Math.min(a,k.startTime);b=Math.max(b,k.endTime);c=Math.max(c,k.input.length)}return{start:a,end:b,frames:c}}function e(a,b,c,f){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var h=
+a.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&a.world.copy(h)}f&&a.world.multiply(f,a.world);b.push(a);for(f=0;f<a.nodes.length;f++)e(a.nodes[f],b,c,a.world)}function l(a,c,f){var h=ta[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var k=b(),c=ka.getChildById(c.skeleton[0],!0)||ka.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
+u;for(l=0;l<a.vertices.length;l++)h.skin.bindShapeMatrix.multiplyVector3(a.vertices[l].position);for(f=0;f<k.frames;f++){var v=[],w=[];for(l=0;l<a.vertices.length;l++)w.push(new THREE.Vertex(new THREE.Vector3));e(c,v,f);l=v;n=h.skin;for(p=0;p<l.length;p++)if(o=l[p],u=-1,o.type=="JOINT"){for(var x=0;x<n.joints.length;x++)if(o.sid==n.joints[x]){u=x;break}if(u>=0){x=n.invBindMatrices[u];o.invBindMatrix=x;o.skinningMatrix=new THREE.Matrix4;o.skinningMatrix.multiply(o.world,x);o.weights=[];for(x=0;x<n.weights.length;x++)for(var y=
+0;y<n.weights[x].length;y++){var z=n.weights[x][y];z.joint==u&&o.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+o.sid+"'.";}for(l=0;l<v.length;l++)if(v[l].type=="JOINT")for(n=0;n<v[l].weights.length;n++)o=v[l].weights[n],p=o.index,o=o.weight,u=a.vertices[p],p=w[p],t.x=u.position.x,t.y=u.position.y,t.z=u.position.z,v[l].skinningMatrix.multiplyVector3(t),p.position.x+=t.x*o,p.position.y+=t.y*o,p.position.z+=t.z*o;a.morphTargets.push({name:"target_"+f,vertices:w})}}}function f(a){var b=
+new THREE.Object3D,c,e,h;for(h=0;h<a.controllers.length;h++){var k=ta[a.controllers[h].url];switch(k.type){case "skin":if(ua[k.skin.source]){var n=new w;n.url=k.skin.source;n.instance_material=a.controllers[h].instance_material;a.geometries.push(n);c=a.controllers[h]}else if(ta[k.skin.source]&&(e=k=ta[k.skin.source],k.morph&&ua[k.morph.source]))n=new w,n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n);break;case "morph":if(ua[k.morph.source])n=new w,
+n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n),e=a.controllers[h];console.log("ColladaLoader: Morph-controller partially supported.")}}for(h=0;h<a.geometries.length;h++){var k=a.geometries[h],n=k.instance_material,k=ua[k.url],o={},p=0,t;if(k&&k.mesh&&k.mesh.primitives){if(b.name.length==0)b.name=k.id;if(n)for(j=0;j<n.length;j++){t=n[j];var u=sa[qa[t.target].instance_effect.url].shader;u.material.opacity=!u.material.opacity?1:u.material.opacity;t=o[t.symbol]=
+u.material;p++}n=t||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});k=k.mesh.geometry3js;if(p>1){n=new THREE.MeshFaceMaterial;for(j=0;j<k.faces.length;j++)p=k.faces[j],p.materials=[o[p.daeMaterial]]}if(c!==void 0)l(k,c),n.morphTargets=!0,n=new THREE.SkinnedMesh(k,n),n.skeleton=c.skeleton,n.skinController=ta[c.url],n.skinInstanceController=c,n.name="skin_"+Ca.length,Ca.push(n);else if(e!==void 0){o=k;p=e instanceof v?ta[e.url]:e;if(!p||!p.morph)console.log("could not find morph controller!");
+else{p=p.morph;for(u=0;u<p.targets.length;u++){var x=ua[p.targets[u]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===o.vertices.length&&o.morphTargets.push({name:"target_1",vertices:x.vertices})}o.morphTargets.push({name:"target_Z",vertices:o.vertices})}n.morphTargets=!0;n=new THREE.Mesh(k,n);n.name="morph_"+Ea.length;Ea.push(n)}else n=new THREE.Mesh(k,n);a.geometries.length>1?b.add(n):b=n}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
+b.scale);for(h=0;h<a.nodes.length;h++)b.add(f(a.nodes[h],a));return b}function h(){this.init_from=this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function t(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function u(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function y(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function x(){this.target=this.symbol=""}function w(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function B(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function A(){this.material="";this.count=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function P(){this.semantic="";this.offset=0;this.source="";this.set=0}function F(a){this.id=a;this.type=null}function Q(){this.name=this.id="";this.instance_effect=null}function H(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function N(a,
+b){this.type=a;this.effect=b;this.material=null}function L(a){this.effect=a;this.format=this.init_from=null}function G(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function V(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ca(){this.url=""}function W(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function T(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
+this.dotSyntax=this.sid=null}function o(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function Z(a){var b=a.getAttribute("id");if(ia[b]!=void 0)return ia[b];ia[b]=(new F(b)).parse(a);return ia[b]}function ha(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function M(a){for(var a=X(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function R(a){for(var a=X(a),b=[],c=
+0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function X(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function $(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ma(a,b){var c="";c+=$(a.x,b)+",";c+=$(a.y,b)+",";c+=$(a.z,b);return c}var na=null,ea=null,ka,fa=
+null,ia={},ga={},da={},ta={},ua={},qa={},sa={},Da,va,Ea,Ca,Ga=THREE.SmoothShading;h.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new p).parse(c);this.type=
+c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(a){var b={},c=[],e;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "source":f=(new F).parse(f);b[f.id]=f;break;case "targets":c=this.parseInputs(f);break;default:console.log(f.nodeName)}}for(e=0;e<c.length;e++)switch(a=c[e],f=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
+f.read();break;case "MORPH_WEIGHT":this.weights=f.read()}return this};n.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":b.push((new P).parse(e))}}return b};p.prototype.parse=function(a){var b={},c,e;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var f=0;f<a.childNodes.length;f++){var h=a.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=
+M(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new F).parse(h);b[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":e=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,b);this.parseWeights(e,b);return this};p.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":var e=
+(new P).parse(e),f=b[e.source];if(e.semantic=="JOINT")this.joints=f.read();else if(e.semantic=="INV_BIND_MATRIX")this.invBindMatrices=f.read()}}};p.prototype.parseWeights=function(a,b){for(var c,e,f=[],h=0;h<a.childNodes.length;h++){var k=a.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "input":f.push((new P).parse(k));break;case "v":c=R(k.textContent);break;case "vcount":e=R(k.textContent)}}for(h=k=0;h<e.length;h++){for(var l=e[h],n=[],o=0;o<l;o++){for(var p={},t=0;t<f.length;t++){var u=
+f[t],v=c[k+u.offset];switch(u.semantic){case "JOINT":p.joint=v;break;case "WEIGHT":p.weight=b[u.source].data[v]}}n.push(p);k+=f.length}for(o=0;o<n.length;o++)n[o].index=h;this.weights.push(n)}};t.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};t.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};t.prototype.parse=function(a){this.id=
+a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new u).parse(c))}}return this};u.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],e=c.target.split("/");e.shift();var f=e.shift(),h=f.indexOf(".")>=0,k=f.indexOf("(")>=0,l;if(h)e=f.split("."),f=e.shift(),e.shift();else if(k){l=f.split("(");f=l.shift();
+for(e=0;e<l.length;e++)l[e]=parseInt(l[e].replace(/\)/,""))}if(f==a)return c.info={sid:f,dotSyntax:h,arrSyntax:k,arrIndices:l},c}return null};u.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildById(a,b);if(e)return e}return null};u.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var e=this.nodes[c].getChildBySid(a,b);if(e)return e}return null};u.prototype.getTransformBySid=
+function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};u.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
+1)switch(b.nodeName){case "node":this.nodes.push((new u).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).parse(b));break;case "instance_geometry":this.geometries.push((new w).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=na.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",na,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new u).parse(b));break;
+case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new y).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var e in da)for(var f=da[e],h=0;h<f.channel.length;h++){var k=f.channel[h],l=f.sampler[h];e=k.target.split("/")[0];if(e==this.id)l.create(),k.sampler=l,c=Math.min(c,l.startTime),b=Math.max(b,l.endTime),a.push(k)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){e=
+1E7;for(i=0;i<this.channels.length;i++){a=this.channels[i].sampler;for(c=0;c<a.input.length-1;c++)e=Math.min(e,a.input[c+1]-a.input[c])}c=[];for(a=this.startTime;a<this.endTime;a+=e){b=a;for(var f={},n=h=void 0,h=0;h<this.channels.length;h++)n=this.channels[h],f[n.sid]=n;k=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(l=this.transforms[h],n=f[l.sid],n!==void 0){for(var o=n.sampler,p,n=0;n<o.input.length-1;n++)if(o.input[n+1]>b){p=o.output[n];break}k=p!==void 0?p instanceof THREE.Matrix4?
+k.multiply(k,p):k.multiply(k,l.matrix):k.multiply(k,l.matrix)}else k=k.multiply(k,l.matrix);b=k;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};u.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};y.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=M(a.textContent);this.updateMatrix();return this};
+y.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
+this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};v.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=na.evaluate(".//dae:instance_material",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null))for(var e=c.iterateNext();e;)this.instance_material.push((new x).parse(e)),e=c.iterateNext()}}return this};x.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};w.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=na.evaluate(".//dae:instance_material",
+c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new x).parse(b)),b=a.iterateNext();break}}return this};z.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new B(this)).parse(c)}}return this};B.prototype.parse=function(a){function b(a,c){var e=ma(a.position);f[e]===void 0&&(f[e]={v:a,index:c});return f[e]}this.primitives=[];var c;for(c=
+0;c<a.childNodes.length;c++){var e=a.childNodes[c];switch(e.nodeName){case "source":Z(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new A).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new C).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ia[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
+1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};B.prototype.handlePrimitive=function(a,b,c){var e=0,f,h,k=a.p,l=a.inputs,n,o,p,t=0,u=3,v=[];for(f=0;f<l.length;f++)switch(n=l[f],
+n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(h=0;h<l.length;h++)switch(n=l[h],source=ia[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=ma(b.vertices[o].position);w.push(c[n].index);break;case "NORMAL":x.push(new THREE.Vector3(source.data[p],source.data[p+1],source.data[p+2]));break;case "TEXCOORD":y[n.set]===void 0&&(y[n.set]=[]);y[n.set].push(new THREE.UV(source.data[p],
+source.data[p+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[p],source.data[p+1],source.data[p+2]))}var B;u==3?B=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):u==4&&(B=new THREE.Face4(w[0],w[1],w[2],w[3],[x[0],x[1],x[2],x[3]],z.length?z:new THREE.Color));B.daeMaterial=a.material;b.faces.push(B);for(h=0;h<v.length;h++)f=y[v[h]],b.faceVertexUvs[h].push([f[0],f[1],f[2]]);e+=l.length*u}};C.prototype=new A;C.prototype.constructor=C;A.prototype.setVertices=
+function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};A.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=la(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new P).parse(a.childNodes[b]));break;case "vcount":this.vcount=R(c.textContent);break;case "p":this.p=R(c.textContent)}}return this};D.prototype.parse=
+function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};K.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)a.childNodes[b].nodeName=="input"&&(input=(new P).parse(a.childNodes[b]),this.input[input.semantic]=
+input);return this};P.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=la(a,"set",-1);this.offset=la(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};F.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var e=X(c.textContent),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?
+!0:!1);this.data=f;this.type=c.nodeName;break;case "float_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=R(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=X(c.textContent);this.type=c.nodeName;break;case "technique_common":for(e=0;e<c.childNodes.length;e++)if(c.childNodes[e].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[e]);break}}}return this};F.prototype.read=function(){var a=[],b=this.accessor.params[0];
+switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),e=new THREE.Matrix4;e.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(e)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};Q.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
+"instance_effect"){this.instance_effect=(new ca).parse(a.childNodes[b]);break}return this};H.prototype.isColor=function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=M(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),
+this.texcoord=c.getAttribute("texcoord")}}return this};N.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=na.evaluate(".//dae:float",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var f=e.iterateNext(),h=[];f;)h.push(f),f=e.iterateNext();
+e=h;e.length>0&&(this[c.nodeName]=parseFloat(e[0].textContent))}}this.create();return this};N.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var e=this[c];if(e instanceof H)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=ga[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(va+e.init_from),
+a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=e.color.getHex():b||(a[c]=e.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Ga;return this.material=new THREE.MeshLambertMaterial(a)};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=
+c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};G.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;
+break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};V.prototype.create=function(){if(this.shader==null)return null};V.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};V.prototype.parseNewparam=
+function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "surface":this.surface=(new L(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new G(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};V.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var e=a.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "profile_COMMON":this.parseProfileCOMMON(e);
+break;case "technique":b=e;break;case "newparam":this.parseNewparam(e);break;case "extra":break;default:console.log(e.nodeName)}}return b};V.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new N(c.nodeName,this)).parse(c)}}};ca.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};W.prototype.parse=function(a){this.id=a.getAttribute("id");
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new F).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new T(this)).parse(c))}}return this};T.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
+b.shift(),c=a.indexOf(".")>=0,e=a.indexOf("(")>=0,f,h;if(c)b=a.split("."),a=b.shift(),h=b.shift();else if(e){f=a.split("(");a=f.shift();for(b=0;b<f.length;b++)f[b]=parseInt(f[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=e;this.arrIndices=f;this.member=h;return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new P).parse(c))}}return this};
+o.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
-200))fa=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ca=a},applySkin:l,geometries:qa}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
+200))fa=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){Ga=a},applySkin:l,geometries:ua}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
 THREE.JSONLoader.prototype.load=function(a,c,b){var e,l=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),e=a,a=e.model,c=e.callback,b=e.texture_path;e=new Worker(a);b=b?b:this.extractUrlbase(a);e.onmessage=function(a){l.createModel(a.data,c,b);l.onLoadComplete()};this.onLoadStart();e.postMessage(Date.now())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,l=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,l,t,p,v,x,u,y,w,A,B,D,z,C=a.faces;v=a.vertices;var L=a.normals,H=a.colors,I=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&I++;for(c=0;c<I;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];t=0;for(p=v.length;t<p;)x=new THREE.Vertex,x.position.x=v[t++]*b,x.position.y=
-v[t++]*b,x.position.z=v[t++]*b,e.vertices.push(x);t=0;for(p=C.length;t<p;){b=C[t++];v=b&1;l=b&2;c=b&4;k=b&8;u=b&16;x=b&32;w=b&64;b&=128;v?(A=new THREE.Face4,A.a=C[t++],A.b=C[t++],A.c=C[t++],A.d=C[t++],v=4):(A=new THREE.Face3,A.a=C[t++],A.b=C[t++],A.c=C[t++],v=3);if(l)l=C[t++],A.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<I;c++)B=a.uvs[c],y=C[t++],z=B[y*2],y=B[y*2+1],e.faceUvs[c][l]=new THREE.UV(z,y);if(k)for(c=0;c<I;c++){B=a.uvs[c];D=[];for(k=0;k<v;k++)y=C[t++],z=B[y*2],y=B[y*2+1],D[k]=new THREE.UV(z,
-y);e.faceVertexUvs[c][l]=D}if(u)u=C[t++]*3,k=new THREE.Vector3,k.x=L[u++],k.y=L[u++],k.z=L[u],A.normal=k;if(x)for(c=0;c<v;c++)u=C[t++]*3,k=new THREE.Vector3,k.x=L[u++],k.y=L[u++],k.z=L[u],A.vertexNormals.push(k);if(w)x=C[t++],x=new THREE.Color(H[x]),A.color=x;if(b)for(c=0;c<v;c++)x=C[t++],x=new THREE.Color(H[x]),A.vertexColors.push(x);e.faces.push(A)}}})(l);(function(){var b,c,k,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
-l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,l,t,p,v,x,u,y;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];u=e.morphTargets[c].vertices;y=a.morphTargets[c].vertices;l=0;for(t=y.length;l<t;l+=3)p=y[l]*b,v=y[l+1]*
-b,x=y[l+2]*b,u.push(new THREE.Vertex(new THREE.Vector3(p,v,x)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];t=e.morphColors[c].colors;p=a.morphColors[c].colors;b=0;for(l=p.length;b<l;b+=3)v=new THREE.Color(16755200),v.setRGB(p[b],p[b+1],p[b+2]),t.push(v)}}})(l);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry,l=a.scale!==void 0?1/a.scale:1;this.initMaterials(e,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,k,l,p,t,u,y,v,x,w,z,B,C,A,D=a.faces;u=a.vertices;var K=a.normals,P=a.colors,F=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&F++;for(c=0;c<F;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];p=0;for(t=u.length;p<t;)y=new THREE.Vertex,y.position.x=u[p++]*b,y.position.y=
+u[p++]*b,y.position.z=u[p++]*b,e.vertices.push(y);p=0;for(t=D.length;p<t;){b=D[p++];u=b&1;l=b&2;c=b&4;k=b&8;v=b&16;y=b&32;w=b&64;b&=128;u?(z=new THREE.Face4,z.a=D[p++],z.b=D[p++],z.c=D[p++],z.d=D[p++],u=4):(z=new THREE.Face3,z.a=D[p++],z.b=D[p++],z.c=D[p++],u=3);if(l)l=D[p++],z.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<F;c++)B=a.uvs[c],x=D[p++],A=B[x*2],x=B[x*2+1],e.faceUvs[c][l]=new THREE.UV(A,x);if(k)for(c=0;c<F;c++){B=a.uvs[c];C=[];for(k=0;k<u;k++)x=D[p++],A=B[x*2],x=B[x*2+1],C[k]=new THREE.UV(A,
+x);e.faceVertexUvs[c][l]=C}if(v)v=D[p++]*3,k=new THREE.Vector3,k.x=K[v++],k.y=K[v++],k.z=K[v],z.normal=k;if(y)for(c=0;c<u;c++)v=D[p++]*3,k=new THREE.Vector3,k.x=K[v++],k.y=K[v++],k.z=K[v],z.vertexNormals.push(k);if(w)y=D[p++],y=new THREE.Color(P[y]),z.color=y;if(b)for(c=0;c<u;c++)y=D[p++],y=new THREE.Color(P[y]),z.vertexColors.push(y);e.faces.push(z)}}})(l);(function(){var b,c,k,l;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)k=a.skinWeights[b],l=a.skinWeights[b+1],e.skinWeights.push(new THREE.Vector4(k,
+l,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)k=a.skinIndices[b],l=a.skinIndices[b+1],e.skinIndices.push(new THREE.Vector4(k,l,0,0))}e.bones=a.bones;e.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,k,l,p,t,u,y,v,x;c=0;for(k=a.morphTargets.length;c<k;c++){e.morphTargets[c]={};e.morphTargets[c].name=a.morphTargets[c].name;e.morphTargets[c].vertices=[];v=e.morphTargets[c].vertices;x=a.morphTargets[c].vertices;l=0;for(p=x.length;l<p;l+=3)t=x[l]*b,u=x[l+1]*
+b,y=x[l+2]*b,v.push(new THREE.Vertex(new THREE.Vector3(t,u,y)))}}if(a.morphColors!==void 0){c=0;for(k=a.morphColors.length;c<k;c++){e.morphColors[c]={};e.morphColors[c].name=a.morphColors[c].name;e.morphColors[c].colors=[];p=e.morphColors[c].colors;t=a.morphColors[c].colors;b=0;for(l=t.length;b<l;b+=3)u=new THREE.Color(16755200),u.setRGB(t[b],t[b+1],t[b+2]),p.push(u)}}})(l);e.computeCentroids();e.computeFaceNormals();this.hasNormals(e)&&e.computeTangents();c(e)};
 THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var l=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:l+"/"+a}function k(){for(u in G.objects)if(!Y.objects[u])if(D=G.objects[u],D.geometry!==void 0){if(H=Y.geometries[D.geometry]){var a=!1;for(P=0;P<D.materials.length;P++)N=Y.materials[D.materials[P]],a=N instanceof THREE.ShaderMaterial;a&&H.computeTangents();z=D.position;r=D.rotation;q=D.quaternion;
-s=D.scale;q=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(H,N);object.name=u;object.position.set(z[0],z[1],z[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;Y.scene.add(object);Y.objects[u]=object;D.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Y.scene.collisions.colliders.push(a));if(D.castsShadow)a=
-new THREE.ShadowVolume(H),Y.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(a={type:D.trigger,object:D},Y.triggers[object.name]=a)}}else z=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(z[0],z[1],z[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
-D.visible!==void 0?D.visible:!1,Y.scene.add(object),Y.objects[u]=object,Y.empties[u]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(a={type:D.trigger,object:D},Y.triggers[object.name]=a)}function n(a){return function(c){Y.geometries[a]=c;k();$-=1;b.onLoadComplete();p()}}function t(a){return function(b){Y.geometries[a]=b}}function p(){b.callbackProgress({totalModels:o,totalTextures:da,loadedModels:o-$,loadedTextures:da-U},Y);b.onLoadProgress();$==0&&U==0&&c(Y)}var v,x,u,y,w,A,B,D,z,C,L,H,I,R,
-K,N,M,G,Z,$,U,o,da,Y;G=a.data;K=new THREE.BinaryLoader;Z=new THREE.JSONLoader;U=$=0;Y={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(u in G.objects)if(D=G.objects[u],D.meshCollider){a=!0;break}if(a)Y.scene.collisions=new THREE.CollisionSystem;if(G.transform){a=G.transform.position;C=G.transform.rotation;var pa=G.transform.scale;a&&Y.scene.position.set(a[0],a[1],a[2]);C&&Y.scene.rotation.set(C[0],C[1],C[2]);pa&&
-Y.scene.scale.set(pa[0],pa[1],pa[2]);(a||C||pa)&&Y.scene.updateMatrix()}a=function(){U-=1;p();b.onLoadComplete()};for(w in G.cameras)C=G.cameras[w],C.type=="perspective"?I=new THREE.PerspectiveCamera(C.fov,C.aspect,C.near,C.far):C.type=="ortho"&&(I=new THREE.OrthographicCamera(C.left,C.right,C.top,C.bottom,C.near,C.far)),z=C.position,C=C.target,I.position.set(z[0],z[1],z[2]),I.target=new THREE.Vector3(C[0],C[1],C[2]),Y.cameras[w]=I;for(y in G.lights)w=G.lights[y],I=w.color!==void 0?w.color:16777215,
-C=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(z=w.direction,M=new THREE.DirectionalLight(I,C),M.position.set(z[0],z[1],z[2]),M.position.normalize()):w.type=="point"?(z=w.position,d=w.distance,M=new THREE.PointLight(I,C,d),M.position.set(z[0],z[1],z[2])):w.type=="ambient"&&(M=new THREE.AmbientLight(I)),Y.scene.add(M),Y.lights[y]=M;for(A in G.fogs)y=G.fogs[A],y.type=="linear"?R=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(R=new THREE.FogExp2(0,y.density)),C=y.color,R.color.setRGB(C[0],
-C[1],C[2]),Y.fogs[A]=R;if(Y.cameras&&G.defaults.camera)Y.currentCamera=Y.cameras[G.defaults.camera];if(Y.fogs&&G.defaults.fog)Y.scene.fog=Y.fogs[G.defaults.fog];C=G.defaults.bgcolor;Y.bgColor=new THREE.Color;Y.bgColor.setRGB(C[0],C[1],C[2]);Y.bgColorAlpha=G.defaults.bgalpha;for(v in G.geometries)if(A=G.geometries[v],A.type=="bin_mesh"||A.type=="ascii_mesh")$+=1,b.onLoadStart();o=$;for(v in G.geometries)A=G.geometries[v],A.type=="cube"?(H=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,
-A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),Y.geometries[v]=H):A.type=="plane"?(H=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),Y.geometries[v]=H):A.type=="sphere"?(H=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),Y.geometries[v]=H):A.type=="cylinder"?(H=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),Y.geometries[v]=H):A.type=="torus"?(H=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),Y.geometries[v]=
-H):A.type=="icosahedron"?(H=new THREE.IcosahedronGeometry(A.subdivisions),Y.geometries[v]=H):A.type=="bin_mesh"?K.load(e(A.url,G.urlBaseType),n(v)):A.type=="ascii_mesh"?Z.load(e(A.url,G.urlBaseType),n(v)):A.type=="embedded_mesh"&&(A=G.embeds[A.id])&&Z.createModel(A,t(v),"");for(B in G.textures)if(v=G.textures[B],v.url instanceof Array){U+=v.url.length;for(K=0;K<v.url.length;K++)b.onLoadStart()}else U+=1,b.onLoadStart();da=U;for(B in G.textures){v=G.textures[B];if(v.mapping!=void 0&&THREE[v.mapping]!=
-void 0)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){K=[];for(var P=0;P<v.url.length;P++)K[P]=e(v.url[P],G.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,v.mapping,a)}else{K=THREE.ImageUtils.loadTexture(e(v.url,G.urlBaseType),v.mapping,a);if(THREE[v.minFilter]!=void 0)K.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=void 0)K.magFilter=THREE[v.magFilter];if(v.repeat){K.repeat.set(v.repeat[0],v.repeat[1]);if(v.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(v.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}v.offset&&
-K.offset.set(v.offset[0],v.offset[1]);if(v.wrap){Z={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Z[v.wrap[0]]!==void 0)K.wrapS=Z[v.wrap[0]];if(Z[v.wrap[1]]!==void 0)K.wrapT=Z[v.wrap[1]]}}Y.textures[B]=K}for(x in G.materials){B=G.materials[x];for(L in B.parameters)if(L=="envMap"||L=="map"||L=="lightMap")B.parameters[L]=Y.textures[B.parameters[L]];else if(L=="shading")B.parameters[L]=B.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")B.parameters[L]=
-THREE[B.parameters[L]]?THREE[B.parameters[L]]:THREE.NormalBlending;else if(L=="combine")B.parameters[L]=B.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(B.parameters[L]=="face")B.parameters[L]=THREE.FaceColors;else if(B.parameters[L])B.parameters[L]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=!0;if(B.parameters.normalMap){v=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(v.uniforms);
-K=B.parameters.color;Z=B.parameters.specular;A=B.parameters.ambient;R=B.parameters.shininess;a.tNormal.texture=Y.textures[B.parameters.normalMap];if(B.parameters.normalMapFactor)a.uNormalScale.value=B.parameters.normalMapFactor;if(B.parameters.map)a.tDiffuse.texture=B.parameters.map,a.enableDiffuse.value=!0;if(B.parameters.lightMap)a.tAO.texture=B.parameters.lightMap,a.enableAO.value=!0;if(B.parameters.specularMap)a.tSpecular.texture=Y.textures[B.parameters.specularMap],a.enableSpecular.value=!0;
-a.uDiffuseColor.value.setHex(K);a.uSpecularColor.value.setHex(Z);a.uAmbientColor.value.setHex(A);a.uShininess.value=R;if(B.parameters.opacity)a.uOpacity.value=B.parameters.opacity;B=new THREE.ShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:a,lights:!0,fog:!0})}else B=new THREE[B.type](B.parameters);Y.materials[x]=B}k();b.callbackSync(Y);p()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,e=new Worker(a);e.postMessage(0);var l=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(a){function e(a,b){return b=="relativeToHTML"?a:l+"/"+a}function k(){for(v in G.objects)if(!Z.objects[v])if(C=G.objects[v],C.geometry!==void 0){if(P=Z.geometries[C.geometry]){var a=!1;for(M=0;M<C.materials.length;M++)N=Z.materials[C.materials[M]],a=N instanceof THREE.ShaderMaterial;a&&P.computeTangents();A=C.position;r=C.rotation;q=C.quaternion;
+s=C.scale;q=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(P,N);object.name=v;object.position.set(A[0],A[1],A[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;Z.scene.add(object);Z.objects[v]=object;C.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),Z.scene.collisions.colliders.push(a));if(C.castsShadow)a=
+new THREE.ShadowVolume(P),Z.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},Z.triggers[object.name]=a)}}else A=C.position,r=C.rotation,q=C.quaternion,s=C.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(A[0],A[1],A[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
+C.visible!==void 0?C.visible:!1,Z.scene.add(object),Z.objects[v]=object,Z.empties[v]=object,C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},Z.triggers[object.name]=a)}function n(a){return function(c){Z.geometries[a]=c;k();ca-=1;b.onLoadComplete();t()}}function p(a){return function(b){Z.geometries[a]=b}}function t(){b.callbackProgress({totalModels:T,totalTextures:o,loadedModels:T-ca,loadedTextures:o-W},Z);b.onLoadProgress();ca==0&&W==0&&c(Z)}var u,y,v,x,w,z,B,C,A,D,K,P,F,Q,
+H,N,L,G,V,ca,W,T,o,Z;G=a.data;H=new THREE.BinaryLoader;V=new THREE.JSONLoader;W=ca=0;Z={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(v in G.objects)if(C=G.objects[v],C.meshCollider){a=!0;break}if(a)Z.scene.collisions=new THREE.CollisionSystem;if(G.transform){a=G.transform.position;D=G.transform.rotation;var ha=G.transform.scale;a&&Z.scene.position.set(a[0],a[1],a[2]);D&&Z.scene.rotation.set(D[0],D[1],D[2]);ha&&
+Z.scene.scale.set(ha[0],ha[1],ha[2]);(a||D||ha)&&Z.scene.updateMatrix()}a=function(){W-=1;t();b.onLoadComplete()};for(w in G.cameras)D=G.cameras[w],D.type=="perspective"?F=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(F=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),A=D.position,D=D.target,F.position.set(A[0],A[1],A[2]),F.target=new THREE.Vector3(D[0],D[1],D[2]),Z.cameras[w]=F;for(x in G.lights)w=G.lights[x],F=w.color!==void 0?w.color:16777215,
+D=w.intensity!==void 0?w.intensity:1,w.type=="directional"?(A=w.direction,L=new THREE.DirectionalLight(F,D),L.position.set(A[0],A[1],A[2]),L.position.normalize()):w.type=="point"?(A=w.position,d=w.distance,L=new THREE.PointLight(F,D,d),L.position.set(A[0],A[1],A[2])):w.type=="ambient"&&(L=new THREE.AmbientLight(F)),Z.scene.add(L),Z.lights[x]=L;for(z in G.fogs)x=G.fogs[z],x.type=="linear"?Q=new THREE.Fog(0,x.near,x.far):x.type=="exp2"&&(Q=new THREE.FogExp2(0,x.density)),D=x.color,Q.color.setRGB(D[0],
+D[1],D[2]),Z.fogs[z]=Q;if(Z.cameras&&G.defaults.camera)Z.currentCamera=Z.cameras[G.defaults.camera];if(Z.fogs&&G.defaults.fog)Z.scene.fog=Z.fogs[G.defaults.fog];D=G.defaults.bgcolor;Z.bgColor=new THREE.Color;Z.bgColor.setRGB(D[0],D[1],D[2]);Z.bgColorAlpha=G.defaults.bgalpha;for(u in G.geometries)if(z=G.geometries[u],z.type=="bin_mesh"||z.type=="ascii_mesh")ca+=1,b.onLoadStart();T=ca;for(u in G.geometries)z=G.geometries[u],z.type=="cube"?(P=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,
+z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),Z.geometries[u]=P):z.type=="plane"?(P=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),Z.geometries[u]=P):z.type=="sphere"?(P=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),Z.geometries[u]=P):z.type=="cylinder"?(P=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),Z.geometries[u]=P):z.type=="torus"?(P=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),Z.geometries[u]=
+P):z.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(z.subdivisions),Z.geometries[u]=P):z.type=="bin_mesh"?H.load(e(z.url,G.urlBaseType),n(u)):z.type=="ascii_mesh"?V.load(e(z.url,G.urlBaseType),n(u)):z.type=="embedded_mesh"&&(z=G.embeds[z.id])&&V.createModel(z,p(u),"");for(B in G.textures)if(u=G.textures[B],u.url instanceof Array){W+=u.url.length;for(H=0;H<u.url.length;H++)b.onLoadStart()}else W+=1,b.onLoadStart();o=W;for(B in G.textures){u=G.textures[B];if(u.mapping!=void 0&&THREE[u.mapping]!=
+void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){H=[];for(var M=0;M<u.url.length;M++)H[M]=e(u.url[M],G.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,u.mapping,a)}else{H=THREE.ImageUtils.loadTexture(e(u.url,G.urlBaseType),u.mapping,a);if(THREE[u.minFilter]!=void 0)H.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)H.magFilter=THREE[u.magFilter];if(u.repeat){H.repeat.set(u.repeat[0],u.repeat[1]);if(u.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}u.offset&&
+H.offset.set(u.offset[0],u.offset[1]);if(u.wrap){V={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(V[u.wrap[0]]!==void 0)H.wrapS=V[u.wrap[0]];if(V[u.wrap[1]]!==void 0)H.wrapT=V[u.wrap[1]]}}Z.textures[B]=H}for(y in G.materials){B=G.materials[y];for(K in B.parameters)if(K=="envMap"||K=="map"||K=="lightMap")B.parameters[K]=Z.textures[B.parameters[K]];else if(K=="shading")B.parameters[K]=B.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")B.parameters[K]=
+THREE[B.parameters[K]]?THREE[B.parameters[K]]:THREE.NormalBlending;else if(K=="combine")B.parameters[K]=B.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(B.parameters[K]=="face")B.parameters[K]=THREE.FaceColors;else if(B.parameters[K])B.parameters[K]=THREE.VertexColors;if(B.parameters.opacity!==void 0&&B.parameters.opacity<1)B.parameters.transparent=!0;if(B.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(u.uniforms);
+H=B.parameters.color;V=B.parameters.specular;z=B.parameters.ambient;Q=B.parameters.shininess;a.tNormal.texture=Z.textures[B.parameters.normalMap];if(B.parameters.normalMapFactor)a.uNormalScale.value=B.parameters.normalMapFactor;if(B.parameters.map)a.tDiffuse.texture=B.parameters.map,a.enableDiffuse.value=!0;if(B.parameters.lightMap)a.tAO.texture=B.parameters.lightMap,a.enableAO.value=!0;if(B.parameters.specularMap)a.tSpecular.texture=Z.textures[B.parameters.specularMap],a.enableSpecular.value=!0;
+a.uDiffuseColor.value.setHex(H);a.uSpecularColor.value.setHex(V);a.uAmbientColor.value.setHex(z);a.uShininess.value=Q;if(B.parameters.opacity)a.uOpacity.value=B.parameters.opacity;B=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:a,lights:!0,fog:!0})}else B=new THREE[B.type](B.parameters);Z.materials[y]=B}k();b.callbackSync(Z);t()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var e=new XMLHttpRequest,l=b.scale!==void 0?b.scale:1,f=b.offsetX!==void 0?b.offsetX:0,h=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.UTF8Loader.prototype.createModel(e.responseText,
 c,l,f,h,k):alert("Couldn't load ["+a+"] ["+e.status+"]"):e.readyState!=3&&e.readyState==2&&e.getResponseHeader("Content-Length")};e.open("GET",a,!0);e.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),e=1,l=0;l<8;l++){for(var f=0,h=0;h<c;++h){var k=a.charCodeAt(h+e);f+=k>>1^-(k&1);b[8*h+l]=f}e+=c}c=a.length-e;f=new Uint16Array(c);for(l=h=0;l<c;l++)k=a.charCodeAt(l+e),f[l]=h-k,k==0&&h++;return[b,f]};
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,f){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],p=[];(function(a,h,n){for(var p,t,A,B=a.length;n<B;n+=h)p=a[n],t=a[n+1],A=a[n+2],p=p/16383*b,t=t/16383*b,A=A/16383*b,p+=e,t+=l,A+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,A)))})(h[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,p.push(e,1-f)})(h[0],8,3);(function(a,
-b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,t.push(e,f,h)})(h[0],8,5);(function(a){var b,e,f,h,l,n,D,z,C,L=a.length;for(b=0;b<L;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;z=e;C=f;n=h;D=e;var H=f,I=h,R=l.materials[0],K=t[H*3],N=t[H*3+1],H=t[H*3+2],M=t[I*3],G=t[I*3+1],I=t[I*3+2];D=new THREE.Vector3(t[D*3],t[D*3+1],t[D*3+2]);H=new THREE.Vector3(K,N,H);I=new THREE.Vector3(M,G,I);l.faces.push(new THREE.Face3(z,C,n,[D,H,I],null,R));l=p[e*2];e=p[e*2+
-1];n=p[f*2];D=p[f*2+1];z=p[h*2];C=p[h*2+1];h=c.faceVertexUvs[0];f=n;n=D;D=[];D.push(new THREE.UV(l,e));D.push(new THREE.UV(f,n));D.push(new THREE.UV(z,C));h.push(D)}})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)};
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,f){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(a),p=[],t=[];(function(a,h,n){for(var p,t,z,B=a.length;n<B;n+=h)p=a[n],t=a[n+1],z=a[n+2],p=p/16383*b,t=t/16383*b,z=z/16383*b,p+=e,t+=l,z+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,z)))})(h[0],8,0);(function(a,b,c){for(var e,f,h=a.length;c<h;c+=b)e=a[c],f=a[c+1],e/=1023,f/=1023,t.push(e,1-f)})(h[0],8,3);(function(a,
+b,c){for(var e,f,h,k=a.length;c<k;c+=b)e=a[c],f=a[c+1],h=a[c+2],e=(e-512)/511,f=(f-512)/511,h=(h-512)/511,p.push(e,f,h)})(h[0],8,5);(function(a){var b,e,f,h,l,n,C,A,D,K=a.length;for(b=0;b<K;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;A=e;D=f;n=h;C=e;var P=f,F=h,Q=l.materials[0],H=p[P*3],N=p[P*3+1],P=p[P*3+2],L=p[F*3],G=p[F*3+1],F=p[F*3+2];C=new THREE.Vector3(p[C*3],p[C*3+1],p[C*3+2]);P=new THREE.Vector3(H,N,P);F=new THREE.Vector3(L,G,F);l.faces.push(new THREE.Face3(A,D,n,[C,P,F],null,Q));l=t[e*2];e=t[e*2+
+1];n=t[f*2];C=t[f*2+1];A=t[h*2];D=t[h*2+1];h=c.faceVertexUvs[0];f=n;n=C;C=[];C.push(new THREE.UV(l,e));C.push(new THREE.UV(f,n));C.push(new THREE.UV(A,D));h.push(C)}})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)};
 THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
 b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,l){return a+(c-a)*l};this.VIntX=function(a,c,l,f,h,k,n,t,p,v){h=(h-p)/(v-p);p=this.normal_cache;c[f]=k+h*this.delta;c[f+1]=n;c[f+2]=t;l[f]=this.lerp(p[a],p[a+3],h);l[f+1]=this.lerp(p[a+1],p[a+4],h);l[f+2]=this.lerp(p[a+2],p[a+5],h)};this.VIntY=function(a,c,l,f,h,k,n,t,p,v){h=(h-p)/(v-p);p=this.normal_cache;c[f]=k;c[f+1]=n+h*this.delta;c[f+
-2]=t;c=a+this.yd*3;l[f]=this.lerp(p[a],p[c],h);l[f+1]=this.lerp(p[a+1],p[c+1],h);l[f+2]=this.lerp(p[a+2],p[c+2],h)};this.VIntZ=function(a,c,l,f,h,k,n,t,p,v){h=(h-p)/(v-p);p=this.normal_cache;c[f]=k;c[f+1]=n;c[f+2]=t+h*this.delta;c=a+this.zd*3;l[f]=this.lerp(p[a],p[c],h);l[f+1]=this.lerp(p[a+1],p[c+1],h);l[f+2]=this.lerp(p[a+2],p[c+2],h)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,l,f,h,k){var n=f+1,t=f+this.yd,p=f+this.zd,v=n+this.yd,x=n+this.zd,u=f+this.yd+this.zd,y=n+this.yd+this.zd,w=0,A=this.field[f],B=this.field[n],D=this.field[t],z=this.field[v],C=this.field[p],L=this.field[x],H=this.field[u],I=this.field[y];A<h&&(w|=1);B<h&&(w|=2);D<h&&(w|=8);z<h&&(w|=4);C<h&&(w|=16);L<h&&(w|=32);H<h&&(w|=128);I<h&&(w|=64);var R=THREE.edgeTable[w];if(R===0)return 0;
-var K=this.delta,N=a+K,M=c+K,K=l+K;R&1&&(this.compNorm(f),this.compNorm(n),this.VIntX(f*3,this.vlist,this.nlist,0,h,a,c,l,A,B));R&2&&(this.compNorm(n),this.compNorm(v),this.VIntY(n*3,this.vlist,this.nlist,3,h,N,c,l,B,z));R&4&&(this.compNorm(t),this.compNorm(v),this.VIntX(t*3,this.vlist,this.nlist,6,h,a,M,l,D,z));R&8&&(this.compNorm(f),this.compNorm(t),this.VIntY(f*3,this.vlist,this.nlist,9,h,a,c,l,A,D));R&16&&(this.compNorm(p),this.compNorm(x),this.VIntX(p*3,this.vlist,this.nlist,12,h,a,c,K,C,L));
-R&32&&(this.compNorm(x),this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,h,N,c,K,L,I));R&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,h,a,M,K,H,I));R&128&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,21,h,a,c,K,C,H));R&256&&(this.compNorm(f),this.compNorm(p),this.VIntZ(f*3,this.vlist,this.nlist,24,h,a,c,l,A,C));R&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,h,N,c,l,B,L));R&1024&&(this.compNorm(v),
-this.compNorm(y),this.VIntZ(v*3,this.vlist,this.nlist,30,h,N,M,l,z,I));R&2048&&(this.compNorm(t),this.compNorm(u),this.VIntZ(t*3,this.vlist,this.nlist,33,h,a,M,l,D,H));w<<=4;for(h=f=0;THREE.triTable[w+h]!=-1;)a=w+h,c=a+1,l=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[l],k),h+=3,f++;return f};this.posnormtriv=function(a,c,l,f,h,k){var n=this.count*3;this.positionArray[n]=a[l];this.positionArray[n+1]=a[l+1];this.positionArray[n+2]=a[l+2];this.positionArray[n+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,l){return a+(c-a)*l};this.VIntX=function(a,c,l,f,h,k,n,p,t,u){h=(h-t)/(u-t);t=this.normal_cache;c[f]=k+h*this.delta;c[f+1]=n;c[f+2]=p;l[f]=this.lerp(t[a],t[a+3],h);l[f+1]=this.lerp(t[a+1],t[a+4],h);l[f+2]=this.lerp(t[a+2],t[a+5],h)};this.VIntY=function(a,c,l,f,h,k,n,p,t,u){h=(h-t)/(u-t);t=this.normal_cache;c[f]=k;c[f+1]=n+h*this.delta;c[f+
+2]=p;c=a+this.yd*3;l[f]=this.lerp(t[a],t[c],h);l[f+1]=this.lerp(t[a+1],t[c+1],h);l[f+2]=this.lerp(t[a+2],t[c+2],h)};this.VIntZ=function(a,c,l,f,h,k,n,p,t,u){h=(h-t)/(u-t);t=this.normal_cache;c[f]=k;c[f+1]=n;c[f+2]=p+h*this.delta;c=a+this.zd*3;l[f]=this.lerp(t[a],t[c],h);l[f+1]=this.lerp(t[a+1],t[c+1],h);l[f+2]=this.lerp(t[a+2],t[c+2],h)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,l,f,h,k){var n=f+1,p=f+this.yd,t=f+this.zd,u=n+this.yd,y=n+this.zd,v=f+this.yd+this.zd,x=n+this.yd+this.zd,w=0,z=this.field[f],B=this.field[n],C=this.field[p],A=this.field[u],D=this.field[t],K=this.field[y],P=this.field[v],F=this.field[x];z<h&&(w|=1);B<h&&(w|=2);C<h&&(w|=8);A<h&&(w|=4);D<h&&(w|=16);K<h&&(w|=32);P<h&&(w|=128);F<h&&(w|=64);var Q=THREE.edgeTable[w];if(Q===0)return 0;
+var H=this.delta,N=a+H,L=c+H,H=l+H;Q&1&&(this.compNorm(f),this.compNorm(n),this.VIntX(f*3,this.vlist,this.nlist,0,h,a,c,l,z,B));Q&2&&(this.compNorm(n),this.compNorm(u),this.VIntY(n*3,this.vlist,this.nlist,3,h,N,c,l,B,A));Q&4&&(this.compNorm(p),this.compNorm(u),this.VIntX(p*3,this.vlist,this.nlist,6,h,a,L,l,C,A));Q&8&&(this.compNorm(f),this.compNorm(p),this.VIntY(f*3,this.vlist,this.nlist,9,h,a,c,l,z,C));Q&16&&(this.compNorm(t),this.compNorm(y),this.VIntX(t*3,this.vlist,this.nlist,12,h,a,c,H,D,K));
+Q&32&&(this.compNorm(y),this.compNorm(x),this.VIntY(y*3,this.vlist,this.nlist,15,h,N,c,H,K,F));Q&64&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,18,h,a,L,H,P,F));Q&128&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,21,h,a,c,H,D,P));Q&256&&(this.compNorm(f),this.compNorm(t),this.VIntZ(f*3,this.vlist,this.nlist,24,h,a,c,l,z,D));Q&512&&(this.compNorm(n),this.compNorm(y),this.VIntZ(n*3,this.vlist,this.nlist,27,h,N,c,l,B,K));Q&1024&&(this.compNorm(u),
+this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,30,h,N,L,l,A,F));Q&2048&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,33,h,a,L,l,C,P));w<<=4;for(h=f=0;THREE.triTable[w+h]!=-1;)a=w+h,c=a+1,l=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[l],k),h+=3,f++;return f};this.posnormtriv=function(a,c,l,f,h,k){var n=this.count*3;this.positionArray[n]=a[l];this.positionArray[n+1]=a[l+1];this.positionArray[n+2]=a[l+2];this.positionArray[n+
 3]=a[f];this.positionArray[n+4]=a[f+1];this.positionArray[n+5]=a[f+2];this.positionArray[n+6]=a[h];this.positionArray[n+7]=a[h+1];this.positionArray[n+8]=a[h+2];this.normalArray[n]=c[l];this.normalArray[n+1]=c[l+1];this.normalArray[n+2]=c[l+2];this.normalArray[n+3]=c[f];this.normalArray[n+4]=c[f+1];this.normalArray[n+5]=c[f+2];this.normalArray[n+6]=c[h];this.normalArray[n+7]=c[h+1];this.normalArray[n+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,l,f,h){var k=this.size*Math.sqrt(f/h),n=l*this.size,t=c*this.size,p=a*this.size,v=Math.floor(n-k);v<1&&(v=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var x=Math.floor(t-k);x<1&&(x=1);t=Math.floor(t+k);t>this.size-1&&(t=this.size-1);var u=Math.floor(p-k);u<1&&(u=1);k=Math.floor(p+k);
-k>this.size-1&&(k=this.size-1);for(var y,w,A,B,D,z;v<n;v++){p=this.size2*v;w=v/this.size-l;D=w*w;for(w=x;w<t;w++){A=p+this.size*w;y=w/this.size-c;z=y*y;for(y=u;y<k;y++)B=y/this.size-a,B=f/(1.0E-6+B*B+z+D)-h,B>0&&(this.field[A+y]+=B)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,t=this.size,p=this.yd,v=this.zd,x=this.field,u=t*Math.sqrt(a/c);u>t&&(u=t);for(l=0;l<u;l++)if(f=l/t,f*=f,k=a/(1.0E-4+f)-c,k>0)for(f=0;f<t;f++){n=l+f*p;for(h=0;h<t;h++)x[v*h+n]+=k}};this.addPlaneY=function(a,c){var l,f,h,k,
-n,t,p=this.size,v=this.yd,x=this.zd,u=this.field,y=p*Math.sqrt(a/c);y>p&&(y=p);for(f=0;f<y;f++)if(l=f/p,l*=l,k=a/(1.0E-4+l)-c,k>0){n=f*v;for(l=0;l<p;l++){t=n+l;for(h=0;h<p;h++)u[x*h+t]+=k}}};this.addPlaneZ=function(a,c){var l,f,h,k,n,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(l=h/size,l*=l,k=a/(1.0E-4+l)-c,k>0){n=zd*h;for(f=0;f<size;f++){t=n+f*yd;for(l=0;l<size;l++)field[t+l]+=k}}};this.reset=function(){var a;for(a=
-0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,l,f,h,k,n,t,p,v,x=this.size-2;for(h=1;h<x;h++){v=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(f=1;f<x;f++){p=v+this.size*f;n=(f-this.halfsize)/this.halfsize;for(l=1;l<x;l++)k=(l-this.halfsize)/this.halfsize,c=p+l,this.polygonize(k,n,t,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,l=[];this.render(function(f){var h,k,n,t,p,v,x,u;for(h=0;h<f.count;h++)x=
-h*3,p=x+1,u=x+2,k=f.positionArray[x],n=f.positionArray[p],t=f.positionArray[u],v=new THREE.Vector3(k,n,t),k=f.normalArray[x],n=f.normalArray[p],t=f.normalArray[u],x=new THREE.Vector3(k,n,t),x.normalize(),p=new THREE.Vertex(v),c.vertices.push(p),l.push(x);nfaces=f.count/3;for(h=0;h<nfaces;h++)x=(a+h)*3,p=x+1,u=x+2,v=l[x],k=l[p],n=l[u],x=new THREE.Face3(x,p,u,[v,k,n]),c.faces.push(x);a+=nfaces;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,l,f,h){var k=this.size*Math.sqrt(f/h),n=l*this.size,p=c*this.size,t=a*this.size,u=Math.floor(n-k);u<1&&(u=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);p=Math.floor(p+k);p>this.size-1&&(p=this.size-1);var v=Math.floor(t-k);v<1&&(v=1);k=Math.floor(t+k);
+k>this.size-1&&(k=this.size-1);for(var x,w,z,B,C,A;u<n;u++){t=this.size2*u;w=u/this.size-l;C=w*w;for(w=y;w<p;w++){z=t+this.size*w;x=w/this.size-c;A=x*x;for(x=v;x<k;x++)B=x/this.size-a,B=f/(1.0E-6+B*B+A+C)-h,B>0&&(this.field[z+x]+=B)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,p=this.size,t=this.yd,u=this.zd,y=this.field,v=p*Math.sqrt(a/c);v>p&&(v=p);for(l=0;l<v;l++)if(f=l/p,f*=f,k=a/(1.0E-4+f)-c,k>0)for(f=0;f<p;f++){n=l+f*t;for(h=0;h<p;h++)y[u*h+n]+=k}};this.addPlaneY=function(a,c){var l,f,h,k,
+n,p,t=this.size,u=this.yd,y=this.zd,v=this.field,x=t*Math.sqrt(a/c);x>t&&(x=t);for(f=0;f<x;f++)if(l=f/t,l*=l,k=a/(1.0E-4+l)-c,k>0){n=f*u;for(l=0;l<t;l++){p=n+l;for(h=0;h<t;h++)v[y*h+p]+=k}}};this.addPlaneZ=function(a,c){var l,f,h,k,n,p;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(a/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(l=h/size,l*=l,k=a/(1.0E-4+l)-c,k>0){n=zd*h;for(f=0;f<size;f++){p=n+f*yd;for(l=0;l<size;l++)field[p+l]+=k}}};this.reset=function(){var a;for(a=
+0;a<this.size3;a++)this.normal_cache[a*3]=0,this.field[a]=0};this.render=function(a){this.begin();var c,l,f,h,k,n,p,t,u,y=this.size-2;for(h=1;h<y;h++){u=this.size2*h;p=(h-this.halfsize)/this.halfsize;for(f=1;f<y;f++){t=u+this.size*f;n=(f-this.halfsize)/this.halfsize;for(l=1;l<y;l++)k=(l-this.halfsize)/this.halfsize,c=t+l,this.polygonize(k,n,p,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,l=[];this.render(function(f){var h,k,n,p,t,u,y,v;for(h=0;h<f.count;h++)y=
+h*3,t=y+1,v=y+2,k=f.positionArray[y],n=f.positionArray[t],p=f.positionArray[v],u=new THREE.Vector3(k,n,p),k=f.normalArray[y],n=f.normalArray[t],p=f.normalArray[v],y=new THREE.Vector3(k,n,p),y.normalize(),t=new THREE.Vertex(u),c.vertices.push(t),l.push(y);nfaces=f.count/3;for(h=0;h<nfaces;h++)y=(a+h)*3,t=y+1,v=y+2,u=l[y],k=l[t],n=l[v],y=new THREE.Face3(y,t,v,[u,k,n]),c.faces.push(y);a+=nfaces;f.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;
 THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
@@ -694,20 +695,20 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
 THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,e,l,f=0;c=0;for(b=this.colliders.length;c<b;c++)if(l=this.colliders[c],e=this.rayCast(a,l),e<Number.MAX_VALUE)l.distance=e,e>f?this.hits.push(l):this.hits.unshift(l),f=e;return this.hits};
 THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var e=this.rayMesh(a,c[b]);if(e.dist<Number.MAX_VALUE){c[b].distance=e.dist;c[b].faceIndex=e.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
 THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,l,f=0;f<c.numFaces;f++){var h=c.mesh.geometry.faces[f],k=c.mesh.geometry.vertices[h.a].position,n=c.mesh.geometry.vertices[h.b].position,t=c.mesh.geometry.vertices[h.c].position,p=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(b,k,n,t,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
-h instanceof THREE.Face4&&(h=this.rayTriangle(b,k,n,p,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(b,n,t,p,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:l}};
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),e=Number.MAX_VALUE,l,f=0;f<c.numFaces;f++){var h=c.mesh.geometry.faces[f],k=c.mesh.geometry.vertices[h.a].position,n=c.mesh.geometry.vertices[h.b].position,p=c.mesh.geometry.vertices[h.c].position,t=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(b,k,n,p,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize())):
+h instanceof THREE.Face4&&(h=this.rayTriangle(b,k,n,t,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(b,n,p,t,e,this.collisionNormal,c.mesh),h<e&&(e=h,l=f,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:e,faceIndex:l}};
 THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,e,l,f,h){var k=THREE.CollisionSystem.__v1,n=THREE.CollisionSystem.__v2;f.set(0,0,0);k.sub(b,c);n.sub(e,b);f.cross(k,n);k=f.dot(a.direction);if(!(k<0))if(h.doubleSided||h.flipSided)f.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;h=f.dot(c)-f.dot(a.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=k*l))return Number.MAX_VALUE;h/=k;k=THREE.CollisionSystem.__v3;k.copy(a.direction);k.multiplyScalar(h);k.addSelf(a.origin);Math.abs(f.x)>
 Math.abs(f.y)?Math.abs(f.x)>Math.abs(f.z)?(a=k.y-c.y,f=b.y-c.y,l=e.y-c.y,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y):Math.abs(f.y)>Math.abs(f.z)?(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.z-c.z,b=b.z-c.z,e=e.z-c.z):(a=k.x-c.x,f=b.x-c.x,l=e.x-c.x,k=k.y-c.y,b=b.y-c.y,e=e.y-c.y);c=f*e-b*l;if(c==0)return Number.MAX_VALUE;c=1/c;e=(a*e-k*l)*c;if(!(e>=0))return Number.MAX_VALUE;c*=f*k-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-e-c>=0))return Number.MAX_VALUE;return h};
 THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var e=THREE.CollisionSystem.__r;e.origin.copy(a.origin);e.direction.copy(a.direction);b.multiplyVector3(e.origin);b.rotateAxis(e.direction);e.direction.normalize();return e};
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,l=0,f=0,h=0,k=0,n=0,t=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,t=!1,h=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,t=!1,h=1);b.origin.y<c.min.y?(l=c.min.y-b.origin.y,l/=b.direction.y,t=!1,k=-1):b.origin.y>c.max.y&&(l=c.max.y-b.origin.y,l/=b.direction.y,
-t=!1,k=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,t=!1,n=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,t=!1,n=1);if(t)return-1;t=0;l>e&&(t=1,e=l);f>e&&(t=2,e=f);switch(t){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=b.origin.x+b.direction.x*e;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var e=0,l=0,f=0,h=0,k=0,n=0,p=!0;b.origin.x<c.min.x?(e=c.min.x-b.origin.x,e/=b.direction.x,p=!1,h=-1):b.origin.x>c.max.x&&(e=c.max.x-b.origin.x,e/=b.direction.x,p=!1,h=1);b.origin.y<c.min.y?(l=c.min.y-b.origin.y,l/=b.direction.y,p=!1,k=-1):b.origin.y>c.max.y&&(l=c.max.y-b.origin.y,l/=b.direction.y,
+p=!1,k=1);b.origin.z<c.min.z?(f=c.min.z-b.origin.z,f/=b.direction.z,p=!1,n=-1):b.origin.z>c.max.z&&(f=c.max.z-b.origin.z,f/=b.direction.z,p=!1,n=1);if(p)return-1;p=0;l>e&&(p=1,e=l);f>e&&(p=2,e=f);switch(p){case 0:k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=b.origin.x+b.direction.x*e;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
 e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:h=b.origin.x+b.direction.x*e;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;k=b.origin.y+b.direction.y*e;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,n)}return e};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),e=c.point.dot(c.normal);if(b<0)b=(e-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
 THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var e=b.dot(a.direction.clone());if(e<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-e*e);if(b>=0)return Math.abs(e)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=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]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,h=new THREE.Matrix4,k=new THREE.Matrix4,n,t,p,v;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),u=new THREE.WebGLRenderTarget(512,512,a),y=new THREE.PerspectiveCamera(53,
-1,1,1E4);y.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:u}},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 w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(y);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;u.width=a;u.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||p!==b.far||v!==b.fov){n=b.aspect;t=b.near;p=b.far;v=b.fov;var D=b.projectionMatrix.clone(),z=125/30*0.5,C=z*t/125,L=t*Math.tan(v*Math.PI/360),H;h.n14=z;k.n14=-z;z=-L*n+C;H=L*n+C;D.n11=2*t/(H-z);D.n13=(H+z)/(H-z);l.projectionMatrix.copy(D);z=-L*n-C;
-H=L*n-C;D.n11=2*t/(H-z);D.n13=(H+z)/(H-z);f.projectionMatrix.copy(D)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,x,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;e.call(c,a,f,u,!0);w.updateMatrixWorld();e.call(c,w,y)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,e=this.render,l=new THREE.PerspectiveCamera,f=new THREE.PerspectiveCamera,h=new THREE.Matrix4,k=new THREE.Matrix4,n,p,t,u;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},y=new THREE.WebGLRenderTarget(512,512,a),v=new THREE.WebGLRenderTarget(512,512,a),x=new THREE.PerspectiveCamera(53,
+1,1,1E4);x.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:y},mapRight:{type:"t",value:1,texture:v}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var w=new THREE.Scene;w.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));w.add(x);this.setSize=function(a,e){b.call(c,a,e);y.width=a;y.height=e;v.width=a;v.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||p!==b.near||t!==b.far||u!==b.fov){n=b.aspect;p=b.near;t=b.far;u=b.fov;var C=b.projectionMatrix.clone(),A=125/30*0.5,D=A*p/125,K=p*Math.tan(u*Math.PI/360),P;h.n14=A;k.n14=-A;A=-K*n+D;P=K*n+D;C.n11=2*p/(P-A);C.n13=(P+A)/(P-A);l.projectionMatrix.copy(C);A=-K*n-D;
+P=K*n-D;C.n11=2*p/(P-A);C.n13=(P+A)/(P-A);f.projectionMatrix.copy(C)}l.matrixWorld.copy(b.matrixWorld).multiplySelf(k);l.position.copy(b.position);l.near=b.near;l.far=b.far;e.call(c,a,l,y,!0);f.matrixWorld.copy(b.matrixWorld).multiplySelf(h);f.position.copy(b.position);f.near=b.near;f.far=b.far;e.call(c,a,f,v,!0);w.updateMatrixWorld();e.call(c,w,x)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,e=this.render,l,f,h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);var k=new THREE.PerspectiveCamera;k.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,e){b.call(c,a,e);l=a/2;f=e};this.render=function(a,b){this.clear();h.fov=b.fov;h.aspect=0.5*b.aspect;h.near=b.near;h.far=
 b.far;h.updateProjectionMatrix();h.position.copy(b.position);h.target.copy(b.target);h.translateX(c.separation);h.lookAt(h.target);k.projectionMatrix=h.projectionMatrix;k.position.copy(b.position);k.target.copy(b.target);k.translateX(-c.separation);k.lookAt(k.target);this.setViewport(0,0,l,f);e.call(c,a,h);this.setViewport(l,0,l,f);e.call(c,a,k,!1)}};

+ 2 - 2
build/custom/ThreeCanvas.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,l=this.w,n=l*c+g*f-h*d,j=l*d+h*c-e*f,i=l*f+e*d-g*c,c=-e*
 c-g*d-h*f;b.x=n*l+c*-e+j*-h-i*-g;b.y=j*l+c*-g+i*-e-n*-h;b.z=i*l+c*-h+n*-g-j*-e;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -115,7 +115,7 @@ THREE.ParticleCanvasMaterial=function(a){THREE.Material.call(this,a);a=a||{};thi
 THREE.Texture=function(a,b,c,d,f,e){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=d!==void 0?d:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=e!==void 0?e:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};
 THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
 for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;

+ 1 - 1
build/custom/ThreeDOM.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+e*f+c*h-d*g;this.y=c*a+e*g+d*f-b*h;this.z=d*a+e*h+b*g-c*f;this.w=e*a-b*f-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,h=this.z,j=this.w,k=j*c+g*e-h*d,i=j*d+h*c-f*e,l=j*e+f*d-g*c,c=-f*
 c-g*d-h*e;b.x=k*j+c*-f+i*-h-l*-g;b.y=i*j+c*-g+l*-f-k*-h;b.z=l*j+c*-h+k*-g-i*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;e<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,e=-e):c.copy(b);if(Math.abs(e)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(e),e=Math.sqrt(1-e*e);if(Math.abs(e)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*f)/e;d=Math.sin(d*f)/e;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,e,f,g){this.a=a;this.b=b;this.c=c;this.d=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.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};

+ 4 - 4
build/custom/ThreeExtras.js

@@ -96,7 +96,7 @@ THREE.CombinedCamera.prototype.toOrthographic=function(){var a=Math.tan(this.fov
 THREE.CombinedCamera.prototype.setFov=function(a){this.fov=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};THREE.CombinedCamera.prototype.setLens=function(a,c){c||(c=43.25);var b=2*Math.atan(c/(a*2));b*=180/Math.PI;this.setFov(b);return b};THREE.CombinedCamera.prototype.setZoom=function(a){this.zoom=a;this.inPersepectiveMode?this.toPerspective():this.toOrthographic()};
 THREE.CombinedCamera.prototype.toFrontView=function(){this.rotation.x=0;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBackView=function(){this.rotation.x=0;this.rotation.y=Math.PI;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toLeftView=function(){this.rotation.x=0;this.rotation.y=-Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};
 THREE.CombinedCamera.prototype.toRightView=function(){this.rotation.x=0;this.rotation.y=Math.PI/2;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toTopView=function(){this.rotation.x=-Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};THREE.CombinedCamera.prototype.toBottomView=function(){this.rotation.x=Math.PI/2;this.rotation.y=0;this.rotation.z=0;this.rotationAutoUpdate=!1};
-THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
+THREE.FirstPersonControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=Math.PI;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=
 0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=
 !0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(a){a.preventDefault();a.stopPropagation();if(this.activeLook)switch(a.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
 function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
@@ -106,14 +106,14 @@ this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b)
 this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
 THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function e(a,b){return function(){b.apply(a,arguments)}}function g(a,b,e,c){var f={name:e,fps:0.6,length:c,hierarchy:[]},h,g=b.getControlPointsArray(),k=b.getLength(),x=g.length,v=0;h=x-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:c,pos:g[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<x-1;h++)v=c*k.chunks[h]/k.total,b.keys[h]={time:v,pos:g[h]};f.hierarchy[0]=
 b;THREE.AnimationHandler.add(f);return new THREE.Animation(a,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function h(a,b){var e,c,f=new THREE.Geometry;for(e=0;e<a.points.length*b;e++)c=e/(a.points.length*b),c=a.getPoint(c),f.vertices[e]=new THREE.Vertex(new THREE.Vector3(c.x,c.y,c.z));return f}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
-new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
+new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
 this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,k=Math.PI/180;this.update=function(a){var e;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*k;this.theta=this.lon*k;a=this.phi%f;this.phi=a>=0?a:a+f;e=this.verticalAngleMap.srcRange;
 a=this.verticalAngleMap.dstRange;e=THREE.Math.mapLinear(this.phi,e[0],e[1],a[0],a[1]);var c=a[1]-a[0];this.phi=b((e-a[0])/c)*c+a[0];e=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;e=THREE.Math.mapLinear(this.theta,e[0],e[1],a[0],a[1]);c=a[1]-a[0];this.theta=b((e-a[0])/c)*c+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
 function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
 c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
 this.debugPath,b=this.spline,c=h(b,10),f=h(b,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(c,k);particleObj=new THREE.ParticleSystem(f,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);a.add(lineObj);particleObj.scale.set(1,1,1);a.add(particleObj);f=new THREE.SphereGeometry(1,16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<b.points.length;i++)c=new THREE.Mesh(f,k),c.position.copy(b.points[i]),a.add(c)}this.domElement.addEventListener("mousemove",
 e(this,this.onMouseMove),!1)}};THREE.PathControlsIdCounter=0;
-THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.005;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
+THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
 0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
 1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};this.keyup=function(a){switch(a.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=
 0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(a){this.domElement!==document&&this.domElement.focus();a.preventDefault();a.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(a.button){case 0:this.object.moveForward=
@@ -157,7 +157,7 @@ THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THRE
 THREE.IcosahedronGeometry=function(a){function c(a,b,c){var e=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/e,b/e,c/e)))-1}function b(a,b,c,e){e.faces.push(new THREE.Face3(a,b,c))}function e(a,b){var e=g.vertices[a].position,f=g.vertices[b].position;return c((e.x+f.x)/2,(e.y+f.y)/2,(e.z+f.z)/2)}var g=this,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var l=e(h.faces[k].a,h.faces[k].b),m=e(h.faces[k].b,h.faces[k].c),n=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,l,n,a);b(h.faces[k].b,m,
 l,a);b(h.faces[k].c,n,m,a);b(l,m,n,a)}h.faces=a.faces}g.faces=h.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
-THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.001;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
+THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],e=[],g=[],h=[],f=(new THREE.Matrix4).setRotationZ(c),k=0;k<a.length;k++)this.vertices.push(new THREE.Vertex(a[k])),b[k]=a[k].clone(),e[k]=this.vertices.length-1;for(var l=0;l<=this.angle+0.0010;l+=c){for(k=0;k<b.length;k++)l<this.angle?(b[k]=f.multiplyVector3(b[k].clone()),this.vertices.push(new THREE.Vertex(b[k])),g[k]=this.vertices.length-1):g=h;l==0&&(h=e);
 for(k=0;k<e.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],e[k+1],e[k])),this.faceVertexUvs[0].push([new THREE.UV(1-l/this.angle,k/a.length),new THREE.UV(1-l/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,(k+1)/a.length),new THREE.UV(1-(l-c)/this.angle,k/a.length)]);e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function e(a,b,c,k){k<1?(k=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),k.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),k.normal=k.centroid.clone().normalize(),
 f.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),f.faceVertexUvs[0].push([h(a.uv,a.position,k),h(b.uv,b.position,k),h(c.uv,c.position,k)])):(k-=1,e(a,g(a,b),g(a,c),k),e(g(a,b),b,g(b,c),k),e(g(a,c),g(b,c),c,k),e(g(a,b),g(b,c),g(a,c),k))}function g(a,c){k[a.index]||(k[a.index]=[]);k[c.index]||(k[c.index]=[]);var e=k[a.index][c.index];e===void 0&&(k[a.index][c.index]=k[c.index][a.index]=e=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return e}function h(a,b,c){c<0&&a.u===

+ 2 - 2
build/custom/ThreeSVG.js

@@ -72,7 +72,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
 this.x,c=this.y,d=this.z,f=this.w,e=a.x,g=a.y,h=a.z,a=a.w;this.x=b*a+f*e+c*h-d*g;this.y=c*a+f*g+d*e-b*h;this.z=d*a+f*h+b*g-c*e;this.w=f*a-b*e-c*g-d*h;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,e=this.x,g=this.y,h=this.z,j=this.w,l=j*c+g*f-h*d,i=j*d+h*c-e*f,k=j*f+e*d-g*c,c=-e*
 c-g*d-h*f;b.x=l*j+c*-e+i*-h-k*-g;b.y=i*j+c*-g+k*-e-l*-h;b.z=k*j+c*-h+l*-g-i*-e;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var e=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-d)*e)/f;d=Math.sin(d*e)/f;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
 THREE.Face3=function(a,b,c,d,f,e){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
 THREE.Face4=function(a,b,c,d,f,e,g){this.a=a;this.b=b;this.c=c;this.d=d;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=g;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -111,7 +111,7 @@ a.wireframeLinecap!==void 0?a.wireframeLinecap:"round";this.wireframeLinejoin=a.
 THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
 THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
-THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
 for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;

+ 189 - 187
build/custom/ThreeWebGL.js

@@ -1,7 +1,7 @@
 // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
 var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;THREE.Color=function(a){a!==void 0&&this.setHex(a);return this};
-THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,f,h;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),f=a*6-e,a=c*(1-b),h=c*(1-
-b*f),b=c*(1-b*(1-f)),e){case 1:this.r=h;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=h;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=h;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
+THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var e,h,f;if(c===0)this.r=this.g=this.b=0;else switch(e=Math.floor(a*6),h=a*6-e,a=c*(1-b),f=c*(1-
+b*h),b=c*(1-b*(1-h)),e){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+
 Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
 THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
 divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
@@ -14,88 +14,88 @@ Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12
 THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
 b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
 normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,y){e.copy(y).subSelf(b);
-f.copy(c).subSelf(b);h.copy(a).subSelf(b);i=e.dot(e);j=e.dot(f);m=e.dot(h);l=f.dot(f);k=f.dot(h);o=1/(i*l-j*j);t=(l*m-j*k)*o;z=(i*k-j*m)*o;return t>=0&&z>=0&&t+z<1}for(var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,i,j,m,l,k,o,t,z,y,A=[],B=0,ja=a.children.length;B<ja;B++)Array.prototype.push.apply(A,this.intersectObject(a.children[B]));if(a instanceof THREE.Particle){B=b(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.scale.x)return[];y={distance:B,point:a.position,
-face:null,object:a};A.push(y)}else if(a instanceof THREE.Mesh){B=b(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return A;var aa,na,sa,G,M,F,H,S,C=a.geometry,Y=C.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);B=0;for(ja=C.faces.length;B<ja;B++)if(y=C.faces[B],H=this.origin.clone(),S=this.direction.clone(),G=a.matrixWorld,aa=G.multiplyVector3(y.centroid.clone()).subSelf(H),F=aa.dot(S),
-!(F<=0)&&(aa=G.multiplyVector3(Y[y.a].position.clone()),na=G.multiplyVector3(Y[y.b].position.clone()),sa=G.multiplyVector3(Y[y.c].position.clone()),G=y instanceof THREE.Face4?G.multiplyVector3(Y[y.d].position.clone()):null,M=a.matrixRotationWorld.multiplyVector3(y.normal.clone()),F=S.dot(M),a.doubleSided||(a.flipSided?F>0:F<0)))if(F=M.dot((new THREE.Vector3).sub(aa,H))/F,H=H.addSelf(S.multiplyScalar(F)),y instanceof THREE.Face3)c(H,aa,na,sa)&&(y={distance:this.origin.distanceTo(H),point:H,face:y,
-object:a},A.push(y));else if(y instanceof THREE.Face4&&(c(H,aa,na,G)||c(H,na,sa,G)))y={distance:this.origin.distanceTo(H),point:H,face:y,object:a},A.push(y)}return A}};
-THREE.Rectangle=function(){function a(){h=e-b;i=f-c}var b,c,e,f,h,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(h,i,k,o){j=!1;b=h;c=i;e=k;f=o;a()};this.addPoint=function(h,i){j?(j=!1,b=h,c=i,e=h,f=i):(b=b<h?b:h,c=c<i?c:i,e=e>h?e:h,f=f>i?f:i);a()};this.add3Points=
-function(h,i,k,o,t,z){j?(j=!1,b=h<k?h<t?h:t:k<t?k:t,c=i<o?i<z?i:z:o<z?o:z,e=h>k?h>t?h:t:k>t?k:t,f=i>o?i>z?i:z:o>z?o:z):(b=h<k?h<t?h<b?h:b:t<b?t:b:k<t?k<b?k:b:t<b?t:b,c=i<o?i<z?i<c?i:c:z<c?z:c:o<z?o<c?o:c:z<c?z:c,e=h>k?h>t?h>e?h:e:t>e?t:e:k>t?k>e?k:e:t>e?t:e,f=i>o?i>z?i>f?i:f:z>f?z:f:o>z?o>f?o:f:z>f?z:f);a()};this.addRectangle=function(h){j?(j=!1,b=h.getLeft(),c=h.getTop(),e=h.getRight(),f=h.getBottom()):(b=b<h.getLeft()?b:h.getLeft(),c=c<h.getTop()?c:h.getTop(),e=e>h.getRight()?e:h.getRight(),f=f>
-h.getBottom()?f:h.getBottom());a()};this.inflate=function(h){b-=h;c-=h;e+=h;f+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();e=e<h.getRight()?e:h.getRight();f=f<h.getBottom()?f:h.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(f,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){j=!0;f=e=c=b=0;a()};this.isEmpty=function(){return j}};
-THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,e,f){return e+(a-b)*(f-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var b,c,e=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(e,this.intersectObject(a[b]));e.sort(function(a,b){return a.distance-b.distance});return e},intersectObject:function(a){function b(a,b,c){var e;e=c.clone().subSelf(a).dot(b);if(e<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(e));return c.distanceTo(a)}function c(a,b,c,z){e.copy(z).subSelf(b);
+h.copy(c).subSelf(b);f.copy(a).subSelf(b);i=e.dot(e);j=e.dot(h);o=e.dot(f);l=h.dot(h);k=h.dot(f);s=1/(i*l-j*j);m=(l*o-j*k)*s;u=(i*k-j*o)*s;return m>=0&&u>=0&&m+u<1}for(var e=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,i,j,o,l,k,s,m,u,z,A=[],C=0,na=a.children.length;C<na;C++)Array.prototype.push.apply(A,this.intersectObject(a.children[C]));if(a instanceof THREE.Particle){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.scale.x)return[];z={distance:C,point:a.position,
+face:null,object:a};A.push(z)}else if(a instanceof THREE.Mesh){C=b(this.origin,this.direction,a.matrixWorld.getPosition());if(C===null||C>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return A;var P,ka,ra,L,W,B,I,Y,M=a.geometry,J=M.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);C=0;for(na=M.faces.length;C<na;C++)if(z=M.faces[C],I=this.origin.clone(),Y=this.direction.clone(),L=a.matrixWorld,P=L.multiplyVector3(z.centroid.clone()).subSelf(I),B=P.dot(Y),
+!(B<=0)&&(P=L.multiplyVector3(J[z.a].position.clone()),ka=L.multiplyVector3(J[z.b].position.clone()),ra=L.multiplyVector3(J[z.c].position.clone()),L=z instanceof THREE.Face4?L.multiplyVector3(J[z.d].position.clone()):null,W=a.matrixRotationWorld.multiplyVector3(z.normal.clone()),B=Y.dot(W),a.doubleSided||(a.flipSided?B>0:B<0)))if(B=W.dot((new THREE.Vector3).sub(P,I))/B,I=I.addSelf(Y.multiplyScalar(B)),z instanceof THREE.Face3)c(I,P,ka,ra)&&(z={distance:this.origin.distanceTo(I),point:I,face:z,object:a},
+A.push(z));else if(z instanceof THREE.Face4&&(c(I,P,ka,L)||c(I,ka,ra,L)))z={distance:this.origin.distanceTo(I),point:I,face:z,object:a},A.push(z)}return A}};
+THREE.Rectangle=function(){function a(){f=e-b;i=h-c}var b,c,e,h,f,i,j=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return i};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(f,i,k,s){j=!1;b=f;c=i;e=k;h=s;a()};this.addPoint=function(f,i){j?(j=!1,b=f,c=i,e=f,h=i):(b=b<f?b:f,c=c<i?c:i,e=e>f?e:f,h=h>i?h:i);a()};this.add3Points=
+function(f,i,k,s,m,u){j?(j=!1,b=f<k?f<m?f:m:k<m?k:m,c=i<s?i<u?i:u:s<u?s:u,e=f>k?f>m?f:m:k>m?k:m,h=i>s?i>u?i:u:s>u?s:u):(b=f<k?f<m?f<b?f:b:m<b?m:b:k<m?k<b?k:b:m<b?m:b,c=i<s?i<u?i<c?i:c:u<c?u:c:s<u?s<c?s:c:u<c?u:c,e=f>k?f>m?f>e?f:e:m>e?m:e:k>m?k>e?k:e:m>e?m:e,h=i>s?i>u?i>h?i:h:u>h?u:h:s>u?s>h?s:h:u>h?u:h);a()};this.addRectangle=function(f){j?(j=!1,b=f.getLeft(),c=f.getTop(),e=f.getRight(),h=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),e=e>f.getRight()?e:f.getRight(),h=h>
+f.getBottom()?h:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;e+=f;h+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();e=e<f.getRight()?e:f.getRight();h=h<f.getBottom()?h:f.getBottom();a()};this.intersects=function(a){return Math.min(e,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(h,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){j=!0;h=e=c=b=0;a()};this.isEmpty=function(){return j}};
+THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,e,h){return e+(a-b)*(h-e)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
 THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,e,f,h,i,j,m,l,k,o,t,z,y,A){this.set(a!==void 0?a:1,b||0,c||0,e||0,f||0,h!==void 0?h:1,i||0,j||0,m||0,l||0,k!==void 0?k:1,o||0,t||0,z||0,y||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,f,h,i,j,m,l,k,o,t,z,y,A){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=f;this.n22=h;this.n23=i;this.n24=j;this.n31=m;this.n32=l;this.n33=k;this.n34=o;this.n41=t;this.n42=z;this.n43=y;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
-b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;e.cross(c,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(c,h).normalize());f.cross(h,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=h.x;this.n21=e.y;this.n22=f.y;this.n23=h.y;this.n31=e.z;this.n32=f.z;this.n33=h.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,j=a.n22,m=a.n23,l=a.n24,k=a.n31,o=a.n32,t=a.n33,z=a.n34,y=a.n41,A=a.n42,B=a.n43,
-ja=a.n44,aa=b.n11,na=b.n12,sa=b.n13,G=b.n14,M=b.n21,F=b.n22,H=b.n23,S=b.n24,C=b.n31,Y=b.n32,Q=b.n33,xa=b.n34,ia=b.n41,E=b.n42,d=b.n43,ya=b.n44;this.n11=c*aa+e*M+f*C+h*ia;this.n12=c*na+e*F+f*Y+h*E;this.n13=c*sa+e*H+f*Q+h*d;this.n14=c*G+e*S+f*xa+h*ya;this.n21=i*aa+j*M+m*C+l*ia;this.n22=i*na+j*F+m*Y+l*E;this.n23=i*sa+j*H+m*Q+l*d;this.n24=i*G+j*S+m*xa+l*ya;this.n31=k*aa+o*M+t*C+z*ia;this.n32=k*na+o*F+t*Y+z*E;this.n33=k*sa+o*H+t*Q+z*d;this.n34=k*G+o*S+t*xa+z*ya;this.n41=y*aa+A*M+B*C+ja*ia;this.n42=y*na+
-A*F+B*Y+ja*E;this.n43=y*sa+A*H+B*Q+ja*d;this.n44=y*G+A*S+B*xa+ja*ya;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=
-a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,f=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*
-e+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*
-a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,f=this.n21,h=this.n22,i=this.n23,j=this.n24,m=this.n31,l=this.n32,k=this.n33,o=this.n34,t=this.n41,z=this.n42,y=this.n43,A=this.n44;return e*i*l*t-c*j*l*t-e*h*k*t+b*j*k*t+c*h*o*t-b*i*o*t-e*i*m*z+c*j*m*z+e*f*k*z-a*j*k*z-c*f*o*z+a*i*o*z+e*h*m*y-b*j*m*y-e*f*l*y+a*j*l*y+b*f*o*y-a*h*o*y-c*h*m*A+b*i*m*A+
-c*f*l*A-a*i*l*A-b*f*k*A+a*h*k*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;
-a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
+THREE.Matrix4=function(a,b,c,e,h,f,i,j,o,l,k,s,m,u,z,A){this.set(a!==void 0?a:1,b||0,c||0,e||0,h||0,f!==void 0?f:1,i||0,j||0,o||0,l||0,k!==void 0?k:1,s||0,m||0,u||0,z||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,e,h,f,i,j,o,l,k,s,m,u,z,A){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=h;this.n22=f;this.n23=i;this.n24=j;this.n31=o;this.n32=l;this.n33=k;this.n34=s;this.n41=m;this.n42=u;this.n43=z;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
+b,c){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(f.length()===0)f.z=1;e.cross(c,f).normalize();e.length()===0&&(f.x+=1.0E-4,e.cross(c,f).normalize());h.cross(f,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=f.x;this.n21=e.y;this.n22=h.y;this.n23=f.y;this.n31=e.z;this.n32=h.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,e=a.n12,h=a.n13,f=a.n14,i=a.n21,j=a.n22,o=a.n23,l=a.n24,k=a.n31,s=a.n32,m=a.n33,u=a.n34,z=a.n41,A=a.n42,C=a.n43,
+na=a.n44,P=b.n11,ka=b.n12,ra=b.n13,L=b.n14,W=b.n21,B=b.n22,I=b.n23,Y=b.n24,M=b.n31,J=b.n32,U=b.n33,da=b.n34,ya=b.n41,T=b.n42,G=b.n43,d=b.n44;this.n11=c*P+e*W+h*M+f*ya;this.n12=c*ka+e*B+h*J+f*T;this.n13=c*ra+e*I+h*U+f*G;this.n14=c*L+e*Y+h*da+f*d;this.n21=i*P+j*W+o*M+l*ya;this.n22=i*ka+j*B+o*J+l*T;this.n23=i*ra+j*I+o*U+l*G;this.n24=i*L+j*Y+o*da+l*d;this.n31=k*P+s*W+m*M+u*ya;this.n32=k*ka+s*B+m*J+u*T;this.n33=k*ra+s*I+m*U+u*G;this.n34=k*L+s*Y+m*da+u*d;this.n41=z*P+A*W+C*M+na*ya;this.n42=z*ka+A*B+C*J+
+na*T;this.n43=z*ra+A*I+C*U+na*G;this.n44=z*L+A*Y+C*da+na*d;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=
+a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,h=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*h;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*h;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*
+h;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*h;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*h;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*h;return a},rotateAxis:function(a){var b=a.x,c=a.y,e=a.z;a.x=b*this.n11+c*this.n12+e*this.n13;a.y=b*this.n21+c*this.n22+e*this.n23;a.z=b*this.n31+c*this.n32+e*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*
+a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,h=this.n21,f=this.n22,i=this.n23,j=this.n24,o=this.n31,l=this.n32,k=this.n33,s=this.n34,m=this.n41,u=this.n42,z=this.n43,A=this.n44;return e*i*l*m-c*j*l*m-e*f*k*m+b*j*k*m+c*f*s*m-b*i*s*m-e*i*o*u+c*j*o*u+e*h*k*u-a*j*k*u-c*h*s*u+a*i*s*u+e*f*o*z-b*j*o*z-e*h*l*z+a*j*l*z+b*h*s*z-a*f*s*z-c*f*o*A+b*i*o*A+c*h*l*A-a*i*l*A-
+b*h*k*A+a*f*k*A},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;
+a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=
 this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=
 this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,
-0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),f=1-c,h=a.x,i=a.y,j=a.z,m=f*h,l=f*i;this.set(m*h+c,m*i-e*j,m*j+e*i,0,m*i+e*j,l*i+c,l*j-e*h,0,m*j-e*i,l*j+e*h,f*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,e=a.n13,f=a.n14,h=a.n21,i=a.n22,j=a.n23,m=a.n24,l=a.n31,k=a.n32,o=a.n33,t=a.n34,z=a.n41,y=a.n42,A=a.n43,B=a.n44;this.n11=j*t*y-m*o*y+m*k*A-i*t*A-j*k*B+i*o*B;this.n12=f*o*y-e*t*y-f*k*A+c*t*A+e*k*B-c*o*B;this.n13=e*m*y-f*j*y+f*i*A-c*m*A-e*i*B+c*j*B;this.n14=f*j*k-e*m*k-f*i*o+c*m*o+e*i*t-c*j*t;this.n21=m*o*z-j*t*z-m*l*A+h*t*A+j*l*B-h*o*B;this.n22=e*t*z-f*o*z+
-f*l*A-b*t*A-e*l*B+b*o*B;this.n23=f*j*z-e*m*z-f*h*A+b*m*A+e*h*B-b*j*B;this.n24=e*m*l-f*j*l+f*h*o-b*m*o-e*h*t+b*j*t;this.n31=i*t*z-m*k*z+m*l*y-h*t*y-i*l*B+h*k*B;this.n32=f*k*z-c*t*z-f*l*y+b*t*y+c*l*B-b*k*B;this.n33=e*m*z-f*i*z+f*h*y-b*m*y-c*h*B+b*i*B;this.n34=f*i*l-c*m*l-f*h*k+b*m*k+c*h*t-b*i*t;this.n41=j*k*z-i*o*z-j*l*y+h*o*y+i*l*A-h*k*A;this.n42=c*o*z-e*k*z+e*l*y-b*o*y-c*l*A+b*k*A;this.n43=e*i*z-c*j*z-e*h*y+b*j*y+c*h*A-b*i*A;this.n44=c*j*l-e*i*l+e*h*k-b*j*k-c*h*o+b*i*o;this.multiplyScalar(1/a.determinant());
-return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,f=a.z,h=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f);switch(b){case "YXZ":var m=i*j,l=i*f,k=e*j,o=e*f;this.n11=m+o*c;this.n12=k*c-l;this.n13=h*e;this.n21=h*f;this.n22=h*j;this.n23=-c;this.n31=l*c-k;this.n32=o+m*c;this.n33=h*i;break;case "ZXY":m=i*j;l=i*f;k=e*j;o=e*f;this.n11=m-o*c;this.n12=-h*f;this.n13=k+l*c;this.n21=l+k*c;this.n22=h*j;this.n23=o-m*c;this.n31=-h*e;this.n32=c;this.n33=h*i;break;case "ZYX":m=
-h*j;l=h*f;k=c*j;o=c*f;this.n11=i*j;this.n12=k*e-l;this.n13=m*e+o;this.n21=i*f;this.n22=o*e+m;this.n23=l*e-k;this.n31=-e;this.n32=c*i;this.n33=h*i;break;case "YZX":m=h*i;l=h*e;k=c*i;o=c*e;this.n11=i*j;this.n12=o-m*f;this.n13=k*f+l;this.n21=f;this.n22=h*j;this.n23=-c*j;this.n31=-e*j;this.n32=l*f+k;this.n33=m-o*f;break;case "XZY":m=h*i;l=h*e;k=c*i;o=c*e;this.n11=i*j;this.n12=-f;this.n13=e*j;this.n21=m*f+o;this.n22=h*j;this.n23=l*f-k;this.n31=k*f-l;this.n32=c*j;this.n33=o*f+m;break;default:m=h*j,l=h*
-f,k=c*j,o=c*f,this.n11=i*j,this.n12=-i*f,this.n13=e,this.n21=l+k*e,this.n22=m-o*e,this.n23=-c*i,this.n31=o-m*e,this.n32=k+l*e,this.n33=h*i}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,f=a.w,h=b+b,i=c+c,j=e+e,a=b*h,m=b*i;b*=j;var l=c*i;c*=j;e*=j;h*=f;i*=f;f*=j;this.n11=1-(l+e);this.n12=m-f;this.n13=b+i;this.n21=m+f;this.n22=1-(a+e);this.n23=c-h;this.n31=b-i;this.n32=c+h;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
-a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,f=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);f.setScale(c.x,c.y,c.z);this.multiply(e,f);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);f.set(this.n12,this.n22,this.n32);h.set(this.n13,
-this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=f.length();c.z=h.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
+0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),h=1-c,f=a.x,i=a.y,j=a.z,o=h*f,l=h*i;this.set(o*f+c,o*i-e*j,o*j+e*i,0,o*i+e*j,l*i+c,l*j-e*f,0,o*j-e*i,l*j+e*f,h*j*j+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,e=a.n13,h=a.n14,f=a.n21,i=a.n22,j=a.n23,o=a.n24,l=a.n31,k=a.n32,s=a.n33,m=a.n34,u=a.n41,z=a.n42,A=a.n43,C=a.n44;this.n11=j*m*z-o*s*z+o*k*A-i*m*A-j*k*C+i*s*C;this.n12=h*s*z-e*m*z-h*k*A+c*m*A+e*k*C-c*s*C;this.n13=e*o*z-h*j*z+h*i*A-c*o*A-e*i*C+c*j*C;this.n14=h*j*k-e*o*k-h*i*s+c*o*s+e*i*m-c*j*m;this.n21=o*s*u-j*m*u-o*l*A+f*m*A+j*l*C-f*s*C;this.n22=e*m*u-h*s*u+
+h*l*A-b*m*A-e*l*C+b*s*C;this.n23=h*j*u-e*o*u-h*f*A+b*o*A+e*f*C-b*j*C;this.n24=e*o*l-h*j*l+h*f*s-b*o*s-e*f*m+b*j*m;this.n31=i*m*u-o*k*u+o*l*z-f*m*z-i*l*C+f*k*C;this.n32=h*k*u-c*m*u-h*l*z+b*m*z+c*l*C-b*k*C;this.n33=e*o*u-h*i*u+h*f*z-b*o*z-c*f*C+b*i*C;this.n34=h*i*l-c*o*l-h*f*k+b*o*k+c*f*m-b*i*m;this.n41=j*k*u-i*s*u-j*l*z+f*s*z+i*l*A-f*k*A;this.n42=c*s*u-e*k*u+e*l*z-b*s*z-c*l*A+b*k*A;this.n43=e*i*u-c*j*u-e*f*z+b*j*z+c*f*A-b*i*A;this.n44=c*j*l-e*i*l+e*f*k-b*j*k-c*f*s+b*i*s;this.multiplyScalar(1/a.determinant());
+return this},setRotationFromEuler:function(a,b){var c=a.x,e=a.y,h=a.z,f=Math.cos(c),c=Math.sin(c),i=Math.cos(e),e=Math.sin(e),j=Math.cos(h),h=Math.sin(h);switch(b){case "YXZ":var o=i*j,l=i*h,k=e*j,s=e*h;this.n11=o+s*c;this.n12=k*c-l;this.n13=f*e;this.n21=f*h;this.n22=f*j;this.n23=-c;this.n31=l*c-k;this.n32=s+o*c;this.n33=f*i;break;case "ZXY":o=i*j;l=i*h;k=e*j;s=e*h;this.n11=o-s*c;this.n12=-f*h;this.n13=k+l*c;this.n21=l+k*c;this.n22=f*j;this.n23=s-o*c;this.n31=-f*e;this.n32=c;this.n33=f*i;break;case "ZYX":o=
+f*j;l=f*h;k=c*j;s=c*h;this.n11=i*j;this.n12=k*e-l;this.n13=o*e+s;this.n21=i*h;this.n22=s*e+o;this.n23=l*e-k;this.n31=-e;this.n32=c*i;this.n33=f*i;break;case "YZX":o=f*i;l=f*e;k=c*i;s=c*e;this.n11=i*j;this.n12=s-o*h;this.n13=k*h+l;this.n21=h;this.n22=f*j;this.n23=-c*j;this.n31=-e*j;this.n32=l*h+k;this.n33=o-s*h;break;case "XZY":o=f*i;l=f*e;k=c*i;s=c*e;this.n11=i*j;this.n12=-h;this.n13=e*j;this.n21=o*h+s;this.n22=f*j;this.n23=l*h-k;this.n31=k*h-l;this.n32=c*j;this.n33=s*h+o;break;default:o=f*j,l=f*
+h,k=c*j,s=c*h,this.n11=i*j,this.n12=-i*h,this.n13=e,this.n21=l+k*e,this.n22=o-s*e,this.n23=-c*i,this.n31=s-o*e,this.n32=k+l*e,this.n33=f*i}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,e=a.z,h=a.w,f=b+b,i=c+c,j=e+e,a=b*f,o=b*i;b*=j;var l=c*i;c*=j;e*=j;f*=h;i*=h;h*=j;this.n11=1-(l+e);this.n12=o-h;this.n13=b+i;this.n21=o+h;this.n22=1-(a+e);this.n23=c-f;this.n31=b-i;this.n32=c+f;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},compose:function(a,b,c){var e=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;e.identity();e.setRotationFromQuaternion(b);h.setScale(c.x,c.y,c.z);this.multiply(e,h);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);f.set(this.n13,
+this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=e.length();c.y=h.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=c.x;e.n21/=c.x;e.n31/=c.x;e.n12/=c.y;e.n22/=c.y;e.n32/=c.y;e.n13/=c.z;e.n23/=c.z;e.n33/=c.z;b.setFromRotationMatrix(e);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
 return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),e=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this}};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,o=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*f;c[2]=a*h;c[3]=a*i;c[4]=a*j;c[5]=a*m;c[6]=a*l;c[7]=a*k;c[8]=a*o;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,e,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*f/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var f,a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,e)};
-THREE.Matrix4.makeOrtho=function(a,b,c,e,f,h){var i,j,m,l;i=new THREE.Matrix4;j=b-a;m=c-e;l=h-f;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/m;i.n23=0;i.n24=-((c+e)/m);i.n31=0;i.n32=0;i.n33=-2/l;i.n34=-((h+f)/l);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,s=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;c[0]=a*e;c[1]=a*h;c[2]=a*f;c[3]=a*i;c[4]=a*j;c[5]=a*o;c[6]=a*l;c[7]=a*k;c[8]=a*s;return b};
+THREE.Matrix4.makeFrustum=function(a,b,c,e,h,f){var i;i=new THREE.Matrix4;i.n11=2*h/(b-a);i.n12=0;i.n13=(b+a)/(b-a);i.n14=0;i.n21=0;i.n22=2*h/(e-c);i.n23=(e+c)/(e-c);i.n24=0;i.n31=0;i.n32=0;i.n33=-(f+h)/(f-h);i.n34=-2*f*h/(f-h);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,b,c,e){var h,a=c*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,c,e)};
+THREE.Matrix4.makeOrtho=function(a,b,c,e,h,f){var i,j,o,l;i=new THREE.Matrix4;j=b-a;o=c-e;l=f-h;i.n11=2/j;i.n12=0;i.n13=0;i.n14=-((b+a)/j);i.n21=0;i.n22=2/o;i.n23=0;i.n24=-((c+e)/o);i.n31=0;i.n32=0;i.n33=-2/l;i.n34=-((f+h)/l);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
--1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,e,f;c=0;for(e=this.children.length;c<e;c++){f=this.children[c];if(f.name===a)return f;
-if(b&&(f=f.getChildByName(a,b),f!==void 0))return f}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
+-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=void 0;this.children.splice(b,1);for(b=this;b.parent!==void 0;)b=b.parent;b!==void 0&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,e,h;c=0;for(e=this.children.length;c<e;c++){h=this.children[c];if(h.name===a)return h;
+if(b&&(h=h.getChildByName(a,b),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
 this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
-THREE.Projector=function(){function a(){var a=i[h]=i[h]||new THREE.RenderableObject;h++;return a}function b(){var a=l[m]=l[m]||new THREE.RenderableVertex;m++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,d=1,e=a.z+a.w,h=b.z+b.w,f=-a.z+a.w,i=-b.z+b.w;return e>=0&&h>=0&&f>=0&&i>=0?!0:e<0&&h<0||f<0&&i<0?!1:(e<0?c=Math.max(c,e/(e-h)):h<0&&(d=Math.min(d,e/(e-h))),f<0?c=Math.max(c,f/(f-i)):i<0&&(d=Math.min(d,f/(f-i))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var f,h,i=[],j,m,l=[],
-k,o,t=[],z,y=[],A,B,ja=[],aa,na,sa=[],G={objects:[],sprites:[],lights:[],elements:[]},M=new THREE.Vector3,F=new THREE.Vector4,H=new THREE.Matrix4,S=new THREE.Matrix4,C=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Vector4,Q=new THREE.Vector4;this.computeFrustum=function(a){C[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);C[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);C[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);C[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);C[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);C[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=C[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);H.multiply(b.projectionMatrix,b.matrixWorldInverse);H.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-H.multiply(b.matrixWorld,b.projectionMatrixInverse);H.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,e){h=0;G.objects.length=0;G.sprites.length=0;G.lights.length=0;var i=function(d){if(d.visible!==!1){var b;if(b=d instanceof THREE.Mesh||d instanceof THREE.Line)if(!(b=d.frustumCulled===!1))a:{for(var c=d.matrixWorld,
-e=-d.geometry.boundingSphere.radius*Math.max(d.scale.x,Math.max(d.scale.y,d.scale.z)),h=0;h<6;h++)if(b=C[h].x*c.n14+C[h].y*c.n24+C[h].z*c.n34+C[h].w,b<=e){b=!1;break a}b=!0}b?(H.multiplyVector3(M.copy(d.position)),f=a(),f.object=d,f.z=M.z,G.objects.push(f)):d instanceof THREE.Sprite||d instanceof THREE.Particle?(H.multiplyVector3(M.copy(d.position)),f=a(),f.object=d,f.z=M.z,G.sprites.push(f)):d instanceof THREE.Light&&G.lights.push(d);b=0;for(c=d.children.length;b<c;b++)i(d.children[b])}};i(b);e&&
-G.objects.sort(c);return G};this.projectScene=function(a,h,f){var d=h.near,i=h.far,M,C,K,T,U,R,Z,pa,V,va,Aa,Ka,Pa,Ca,Da,ua;na=B=z=o=0;G.elements.length=0;h.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(h));a.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);H.multiply(h.projectionMatrix,h.matrixWorldInverse);this.computeFrustum(H);G=this.projectGraph(a,!1);a=0;for(M=G.objects.length;a<M;a++)if(V=G.objects[a].object,va=V.matrixWorld,
-Ka=V.material,m=0,V instanceof THREE.Mesh){Aa=V.geometry;Pa=V.geometry.materials;T=Aa.vertices;Ca=Aa.faces;Da=Aa.faceVertexUvs;Aa=V.matrixRotationWorld.extractRotation(va);C=0;for(K=T.length;C<K;C++)j=b(),j.positionWorld.copy(T[C].position),va.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),H.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>d&&j.positionScreen.z<i;T=0;for(C=Ca.length;T<
-C;T++){K=Ca[T];if(K instanceof THREE.Face3)if(U=l[K.a],R=l[K.b],Z=l[K.c],U.visible&&R.visible&&Z.visible&&(V.doubleSided||V.flipSided!=(Z.positionScreen.x-U.positionScreen.x)*(R.positionScreen.y-U.positionScreen.y)-(Z.positionScreen.y-U.positionScreen.y)*(R.positionScreen.x-U.positionScreen.x)<0))pa=t[o]=t[o]||new THREE.RenderableFace3,o++,k=pa,k.v1.copy(U),k.v2.copy(R),k.v3.copy(Z);else continue;else if(K instanceof THREE.Face4)if(U=l[K.a],R=l[K.b],Z=l[K.c],pa=l[K.d],U.visible&&R.visible&&Z.visible&&
-pa.visible&&(V.doubleSided||V.flipSided!=((pa.positionScreen.x-U.positionScreen.x)*(R.positionScreen.y-U.positionScreen.y)-(pa.positionScreen.y-U.positionScreen.y)*(R.positionScreen.x-U.positionScreen.x)<0||(R.positionScreen.x-Z.positionScreen.x)*(pa.positionScreen.y-Z.positionScreen.y)-(R.positionScreen.y-Z.positionScreen.y)*(pa.positionScreen.x-Z.positionScreen.x)<0)))ua=y[z]=y[z]||new THREE.RenderableFace4,z++,k=ua,k.v1.copy(U),k.v2.copy(R),k.v3.copy(Z),k.v4.copy(pa);else continue;k.normalWorld.copy(K.normal);
-Aa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(K.centroid);va.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);H.multiplyVector3(k.centroidScreen);Z=K.vertexNormals;U=0;for(R=Z.length;U<R;U++)pa=k.vertexNormalsWorld[U],pa.copy(Z[U]),Aa.multiplyVector3(pa);U=0;for(R=Da.length;U<R;U++)if(ua=Da[U][T]){Z=0;for(pa=ua.length;Z<pa;Z++)k.uvs[U][Z]=ua[Z]}k.material=Ka;k.faceMaterial=K.materialIndex!==null?Pa[K.materialIndex]:null;k.z=k.centroidScreen.z;G.elements.push(k)}}else if(V instanceof
-THREE.Line){S.multiply(H,va);T=V.geometry.vertices;U=b();U.positionScreen.copy(T[0].position);S.multiplyVector4(U.positionScreen);C=1;for(K=T.length;C<K;C++)if(U=b(),U.positionScreen.copy(T[C].position),S.multiplyVector4(U.positionScreen),R=l[m-2],Y.copy(U.positionScreen),Q.copy(R.positionScreen),e(Y,Q))Y.multiplyScalar(1/Y.w),Q.multiplyScalar(1/Q.w),V=ja[B]=ja[B]||new THREE.RenderableLine,B++,A=V,A.v1.positionScreen.copy(Y),A.v2.positionScreen.copy(Q),A.z=Math.max(Y.z,Q.z),A.material=Ka,G.elements.push(A)}a=
-0;for(M=G.sprites.length;a<M;a++)if(V=G.sprites[a].object,va=V.matrixWorld,V instanceof THREE.Particle&&(F.set(va.n14,va.n24,va.n34,1),H.multiplyVector4(F),F.z/=F.w,F.z>0&&F.z<1))d=sa[na]=sa[na]||new THREE.RenderableParticle,na++,aa=d,aa.x=F.x/F.w,aa.y=F.y/F.w,aa.z=F.z,aa.rotation=V.rotation.z,aa.scale.x=V.scale.x*Math.abs(aa.x-(F.x+h.projectionMatrix.n11)/(F.w+h.projectionMatrix.n14)),aa.scale.y=V.scale.y*Math.abs(aa.y-(F.y+h.projectionMatrix.n22)/(F.w+h.projectionMatrix.n24)),aa.material=V.material,
-G.elements.push(aa);f&&G.elements.sort(c);return G}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
-THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,f=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-f),f=Math.sin(-f),h=Math.cos(c),c=Math.sin(c),i=a*b,j=e*f;this.w=i*h-j*c;this.x=i*c+j*h;this.y=e*b*h+a*f*c;this.z=a*f*h-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
+THREE.Projector=function(){function a(){var a=i[f]=i[f]||new THREE.RenderableObject;f++;return a}function b(){var a=l[o]=l[o]||new THREE.RenderableVertex;o++;return a}function c(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,d=a.z+a.w,f=b.z+b.w,h=-a.z+a.w,i=-b.z+b.w;return d>=0&&f>=0&&h>=0&&i>=0?!0:d<0&&f<0||h<0&&i<0?!1:(d<0?c=Math.max(c,d/(d-f)):f<0&&(e=Math.min(e,d/(d-f))),h<0?c=Math.max(c,h/(h-i)):i<0&&(e=Math.min(e,h/(h-i))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var h,f,i=[],j,o,l=[],
+k,s,m=[],u,z=[],A,C,na=[],P,ka,ra=[],L={objects:[],sprites:[],lights:[],elements:[]},W=new THREE.Vector3,B=new THREE.Vector4,I=new THREE.Matrix4,Y=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,U=new THREE.Vector4;this.computeFrustum=function(a){M[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);M[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);M[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);M[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);M[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);M[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=M[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);I.multiply(b.projectionMatrix,b.matrixWorldInverse);I.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+I.multiply(b.matrixWorld,b.projectionMatrixInverse);I.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(b,e){f=0;L.objects.length=0;L.sprites.length=0;L.lights.length=0;var i=function(b){if(b.visible!==!1){var d;if(d=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(d=b.frustumCulled===!1))a:{for(var c=b.matrixWorld,
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(d=M[f].x*c.n14+M[f].y*c.n24+M[f].z*c.n34+M[f].w,d<=e){d=!1;break a}d=!0}d?(I.multiplyVector3(W.copy(b.position)),h=a(),h.object=b,h.z=W.z,L.objects.push(h)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(I.multiplyVector3(W.copy(b.position)),h=a(),h.object=b,h.z=W.z,L.sprites.push(h)):b instanceof THREE.Light&&L.lights.push(b);d=0;for(c=b.children.length;d<c;d++)i(b.children[d])}};i(b);e&&
+L.objects.sort(c);return L};this.projectScene=function(a,f,h){var i=f.near,d=f.far,M,W,V,Z,D,ta,$,sa,S,va,xa,Ia,Qa,Fa,za,wa;ka=C=u=s=0;L.elements.length=0;f.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(f));a.updateMatrixWorld();f.matrixWorldInverse.getInverse(f.matrixWorld);I.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(I);L=this.projectGraph(a,!1);a=0;for(M=L.objects.length;a<M;a++)if(S=L.objects[a].object,va=S.matrixWorld,
+Ia=S.material,o=0,S instanceof THREE.Mesh){xa=S.geometry;Qa=S.geometry.materials;Z=xa.vertices;Fa=xa.faces;za=xa.faceVertexUvs;xa=S.matrixRotationWorld.extractRotation(va);W=0;for(V=Z.length;W<V;W++)j=b(),j.positionWorld.copy(Z[W].position),va.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),I.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>i&&j.positionScreen.z<d;Z=0;for(W=Fa.length;Z<
+W;Z++){V=Fa[Z];if(V instanceof THREE.Face3)if(D=l[V.a],ta=l[V.b],$=l[V.c],D.visible&&ta.visible&&$.visible&&(S.doubleSided||S.flipSided!=($.positionScreen.x-D.positionScreen.x)*(ta.positionScreen.y-D.positionScreen.y)-($.positionScreen.y-D.positionScreen.y)*(ta.positionScreen.x-D.positionScreen.x)<0))sa=m[s]=m[s]||new THREE.RenderableFace3,s++,k=sa,k.v1.copy(D),k.v2.copy(ta),k.v3.copy($);else continue;else if(V instanceof THREE.Face4)if(D=l[V.a],ta=l[V.b],$=l[V.c],sa=l[V.d],D.visible&&ta.visible&&
+$.visible&&sa.visible&&(S.doubleSided||S.flipSided!=((sa.positionScreen.x-D.positionScreen.x)*(ta.positionScreen.y-D.positionScreen.y)-(sa.positionScreen.y-D.positionScreen.y)*(ta.positionScreen.x-D.positionScreen.x)<0||(ta.positionScreen.x-$.positionScreen.x)*(sa.positionScreen.y-$.positionScreen.y)-(ta.positionScreen.y-$.positionScreen.y)*(sa.positionScreen.x-$.positionScreen.x)<0)))wa=z[u]=z[u]||new THREE.RenderableFace4,u++,k=wa,k.v1.copy(D),k.v2.copy(ta),k.v3.copy($),k.v4.copy(sa);else continue;
+k.normalWorld.copy(V.normal);xa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(V.centroid);va.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);I.multiplyVector3(k.centroidScreen);$=V.vertexNormals;D=0;for(ta=$.length;D<ta;D++)sa=k.vertexNormalsWorld[D],sa.copy($[D]),xa.multiplyVector3(sa);D=0;for(ta=za.length;D<ta;D++)if(wa=za[D][Z]){$=0;for(sa=wa.length;$<sa;$++)k.uvs[D][$]=wa[$]}k.material=Ia;k.faceMaterial=V.materialIndex!==null?Qa[V.materialIndex]:null;k.z=k.centroidScreen.z;
+L.elements.push(k)}}else if(S instanceof THREE.Line){Y.multiply(I,va);Z=S.geometry.vertices;D=b();D.positionScreen.copy(Z[0].position);Y.multiplyVector4(D.positionScreen);W=1;for(V=Z.length;W<V;W++)if(D=b(),D.positionScreen.copy(Z[W].position),Y.multiplyVector4(D.positionScreen),ta=l[o-2],J.copy(D.positionScreen),U.copy(ta.positionScreen),e(J,U))J.multiplyScalar(1/J.w),U.multiplyScalar(1/U.w),S=na[C]=na[C]||new THREE.RenderableLine,C++,A=S,A.v1.positionScreen.copy(J),A.v2.positionScreen.copy(U),A.z=
+Math.max(J.z,U.z),A.material=Ia,L.elements.push(A)}a=0;for(M=L.sprites.length;a<M;a++)if(S=L.sprites[a].object,va=S.matrixWorld,S instanceof THREE.Particle&&(B.set(va.n14,va.n24,va.n34,1),I.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))i=ra[ka]=ra[ka]||new THREE.RenderableParticle,ka++,P=i,P.x=B.x/B.w,P.y=B.y/B.w,P.z=B.z,P.rotation=S.rotation.z,P.scale.x=S.scale.x*Math.abs(P.x-(B.x+f.projectionMatrix.n11)/(B.w+f.projectionMatrix.n14)),P.scale.y=S.scale.y*Math.abs(P.y-(B.y+f.projectionMatrix.n22)/(B.w+
+f.projectionMatrix.n24)),P.material=S.material,L.elements.push(P);h&&L.elements.sort(c);return L}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==void 0?e:1)};
+THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,e=a.y*b,h=a.z*b,a=Math.cos(e),e=Math.sin(e),b=Math.cos(-h),h=Math.sin(-h),f=Math.cos(c),c=Math.sin(c),i=a*b,j=e*h;this.w=i*f-j*c;this.x=i*c+j*f;this.y=e*b*f+a*h*c;this.z=a*h*f-e*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,e=Math.sin(c);
 this.x=a.x*e;this.y=a.y*e;this.z=a.z*e;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
 this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
-this.x,c=this.y,e=this.z,f=this.w,h=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+f*h+c*j-e*i;this.y=c*a+f*i+e*h-b*j;this.z=e*a+f*j+b*i-c*h;this.w=f*a-b*h-c*i-e*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,f=a.z,h=this.x,i=this.y,j=this.z,m=this.w,l=m*c+i*f-j*e,k=m*e+j*c-h*f,o=m*f+h*e-i*c,c=-h*
-c-i*e-j*f;b.x=l*m+c*-h+k*-j-o*-i;b.y=k*m+c*-i+o*-h-l*-j;b.z=o*m+c*-j+l*-i-k*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,e){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;f<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,f=-f):c.copy(b);if(Math.abs(f)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var h=Math.acos(f),f=Math.sqrt(1-f*f);if(Math.abs(f)<0.001)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*h)/f;e=Math.sin(e*h)/f;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,e,f,h){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=h;this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,e,f,h,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
+this.x,c=this.y,e=this.z,h=this.w,f=a.x,i=a.y,j=a.z,a=a.w;this.x=b*a+h*f+c*j-e*i;this.y=c*a+h*i+e*f-b*j;this.z=e*a+h*j+b*i-c*f;this.w=h*a-b*f-c*i-e*j;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,e=a.y,h=a.z,f=this.x,i=this.y,j=this.z,o=this.w,l=o*c+i*h-j*e,k=o*e+j*c-f*h,s=o*h+f*e-i*c,c=-f*
+c-i*e-j*h;b.x=l*o+c*-f+k*-j-s*-i;b.y=k*o+c*-i+s*-f-l*-j;b.z=s*o+c*-j+l*-i-k*-f;return b}};
+THREE.Quaternion.slerp=function(a,b,c,e){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;h<0?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,h=-h):c.copy(b);if(Math.abs(h)>=1)return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(h),h=Math.sqrt(1-h*h);if(Math.abs(h)<0.0010)return c.w=0.5*(a.w+b.w),c.x=0.5*(a.x+b.x),c.y=0.5*(a.y+b.y),c.z=0.5*(a.z+b.z),c;b=Math.sin((1-e)*f)/h;e=Math.sin(e*f)/h;c.w=a.w*b+c.w*e;c.x=a.x*b+c.x*e;c.y=a.y*b+c.y*e;c.z=a.z*b+c.z*e;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,b,c,e,h,f){this.a=a;this.b=b;this.c=c;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,b,c,e,h,f,i){this.a=a;this.b=b;this.c=c;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materialIndex=i;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
 THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
-THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var f=this.faces[c];b.multiplyVector3(f.normal);for(var h=0,i=f.vertexNormals.length;h<i;h++)b.multiplyVector3(f.vertexNormals[h]);a.multiplyVector3(f.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
+THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,e=this.vertices.length;c<e;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(e=this.faces.length;c<e;c++){var h=this.faces[c];b.multiplyVector3(h.normal);for(var f=0,i=h.vertexNormals.length;f<i;f++)b.multiplyVector3(h.vertexNormals[f]);a.multiplyVector3(h.centroid)}},computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<
 b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.divideScalar(3)):c instanceof THREE.Face4&&(c.centroid.addSelf(this.vertices[c.a].position),c.centroid.addSelf(this.vertices[c.b].position),c.centroid.addSelf(this.vertices[c.c].position),c.centroid.addSelf(this.vertices[c.d].position),c.centroid.divideScalar(4))},computeFaceNormals:function(a){var b,
-c,e,f,h,i,j=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){h=this.faces[e];if(a&&h.vertexNormals.length){j.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)j.addSelf(h.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[h.a],c=this.vertices[h.b],i=this.vertices[h.c],j.sub(i.position,c.position),m.sub(b.position,c.position),j.crossSelf(m);j.isZero()||j.normalize();h.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
+c,e,h,f,i,j=new THREE.Vector3,o=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){f=this.faces[e];if(a&&f.vertexNormals.length){j.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)j.addSelf(f.vertexNormals[b]);j.divideScalar(3)}else b=this.vertices[f.a],c=this.vertices[f.b],i=this.vertices[f.c],j.sub(i.position,c.position),o.sub(b.position,c.position),j.crossSelf(o);j.isZero()||j.normalize();f.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof
 THREE.Face3?(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(e[c.a].addSelf(c.normal),e[c.b].addSelf(c.normal),e[c.c].addSelf(c.normal),e[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(e[c.a]),c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(e[c.a]),
-c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,d,b,c,e,h,f){j=a.vertices[d].position;m=a.vertices[b].position;l=a.vertices[c].position;k=i[e];o=i[h];t=i[f];z=m.x-j.x;y=l.x-j.x;A=m.y-j.y;B=l.y-j.y;ja=m.z-j.z;aa=l.z-j.z;na=o.u-k.u;sa=t.u-k.u;G=o.v-k.v;M=t.v-k.v;F=1/(na*M-sa*G);Y.set((M*z-G*y)*F,(M*A-G*B)*F,(M*ja-G*aa)*F);Q.set((na*y-sa*z)*F,(na*B-sa*A)*F,(na*aa-sa*ja)*F);S[d].addSelf(Y);S[b].addSelf(Y);S[c].addSelf(Y);
-C[d].addSelf(Q);C[b].addSelf(Q);C[c].addSelf(Q)}var b,c,e,f,h,i,j,m,l,k,o,t,z,y,A,B,ja,aa,na,sa,G,M,F,H,S=[],C=[],Y=new THREE.Vector3,Q=new THREE.Vector3,xa=new THREE.Vector3,ia=new THREE.Vector3,E=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)S[b]=new THREE.Vector3,C[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)h=this.faces[b],i=this.faceVertexUvs[0][b],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,
-0,1,3));var d=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(e=0;e<h.vertexNormals.length;e++)E.copy(h.vertexNormals[e]),f=h[d[e]],H=S[f],xa.copy(H),xa.subSelf(E.multiplyScalar(E.dot(H))).normalize(),ia.cross(h.vertexNormals[e],H),f=ia.dot(C[f]),f=f<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(xa.x,xa.y,xa.z,f)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
+c.vertexNormals[1].copy(e[c.b]),c.vertexNormals[2].copy(e[c.c]),c.vertexNormals[3].copy(e[c.d]))},computeTangents:function(){function a(a,b,c,e,f,h,G){j=a.vertices[b].position;o=a.vertices[c].position;l=a.vertices[e].position;k=i[f];s=i[h];m=i[G];u=o.x-j.x;z=l.x-j.x;A=o.y-j.y;C=l.y-j.y;na=o.z-j.z;P=l.z-j.z;ka=s.u-k.u;ra=m.u-k.u;L=s.v-k.v;W=m.v-k.v;B=1/(ka*W-ra*L);J.set((W*u-L*z)*B,(W*A-L*C)*B,(W*na-L*P)*B);U.set((ka*z-ra*u)*B,(ka*C-ra*A)*B,(ka*P-ra*na)*B);Y[b].addSelf(J);Y[c].addSelf(J);Y[e].addSelf(J);
+M[b].addSelf(U);M[c].addSelf(U);M[e].addSelf(U)}var b,c,e,h,f,i,j,o,l,k,s,m,u,z,A,C,na,P,ka,ra,L,W,B,I,Y=[],M=[],J=new THREE.Vector3,U=new THREE.Vector3,da=new THREE.Vector3,ya=new THREE.Vector3,T=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)Y[b]=new THREE.Vector3,M[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)f=this.faces[b],i=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,
+0,1,3));var G=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){f=this.faces[b];for(e=0;e<f.vertexNormals.length;e++)T.copy(f.vertexNormals[e]),h=f[G[e]],I=Y[h],da.copy(I),da.subSelf(T.multiplyScalar(T.dot(I))).normalize(),ya.cross(f.vertexNormals[e],I),h=ya.dot(M[h]),h=h<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(da.x,da.y,da.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],
 y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<
-this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,f=Math.pow(10,4),h,i;h=0;for(i=this.vertices.length;h<i;h++)e=this.vertices[h].position,e=[Math.round(e.x*f),Math.round(e.y*f),Math.round(e.z*f)].join("_"),
-a[e]===void 0?(a[e]=h,b.push(this.vertices[h]),c[h]=b.length-1):c[h]=c[a[e]];h=0;for(i=this.faces.length;h<i;h++)if(a=this.faces[h],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
-THREE.Spline=function(a){function b(a,b,c,e,h,f,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*f+a*h+b}this.points=a;var c=[],e={x:0,y:0,z:0},f,h,i,j,m,l,k,o,t;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){f=(this.points.length-1)*a;h=Math.floor(f);i=f-h;c[0]=h===0?h:h-1;c[1]=h;c[2]=h>this.points.length-2?h:h+1;c[3]=h>this.points.length-3?h:h+2;l=this.points[c[0]];k=this.points[c[1]];
-o=this.points[c[2]];t=this.points[c[3]];j=i*i;m=i*j;e.x=b(l.x,k.x,o.x,t.x,i,j,m);e.y=b(l.y,k.y,o.y,t.y,i,j,m);e.z=b(l.z,k.z,o.z,t.z,i,j,m);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,h=new THREE.Vector3,f=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;h.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),f.copy(position),
-j+=f.distanceTo(h),h.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,h,f,i,j=[],k=new THREE.Vector3,m=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=m.chunks[b]-m.chunks[b-1];i=Math.ceil(a*c/m.total);h=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<i-1;c++)e=h+c*(1/i)*(f-h),position=this.getPoint(e),j.push(k.copy(position).clone());
+this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=0,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],e,h=Math.pow(10,4),f,i;f=0;for(i=this.vertices.length;f<i;f++)e=this.vertices[f].position,e=[Math.round(e.x*h),Math.round(e.y*h),Math.round(e.z*h)].join("_"),
+a[e]===void 0?(a[e]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[e]];f=0;for(i=this.faces.length;f<i;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
+THREE.Spline=function(a){function b(a,b,c,e,f,h,i){a=(c-a)*0.5;e=(e-b)*0.5;return(2*(b-c)+a+e)*i+(-3*(b-c)-2*a-e)*h+a*f+b}this.points=a;var c=[],e={x:0,y:0,z:0},h,f,i,j,o,l,k,s,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){h=(this.points.length-1)*a;f=Math.floor(h);i=h-f;c[0]=f===0?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];k=this.points[c[1]];
+s=this.points[c[2]];m=this.points[c[3]];j=i*i;o=i*j;e.x=b(l.x,k.x,s.x,m.x,i,j,o);e.y=b(l.y,k.y,s.y,m.y,i,j,o);e.z=b(l.z,k.z,s.z,m.z,i,j,o);return e};this.getControlPointsArray=function(){var a,b,c=this.points.length,e=[];for(a=0;a<c;a++)b=this.points[a],e[a]=[b.x,b.y,b.z];return e};this.getLength=function(a){var b,c,e=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,position=this.getPoint(b),h.copy(position),
+j+=h.distanceTo(f),f.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=j,e=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,e,f,h,i,j=[],k=new THREE.Vector3,o=this.getLength();j.push(k.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=o.chunks[b]-o.chunks[b-1];i=Math.ceil(a*c/o.total);f=(b-1)/(this.points.length-1);h=b/(this.points.length-1);for(c=1;c<i-1;c++)e=f+c*(1/i)*(h-f),position=this.getPoint(e),j.push(k.copy(position).clone());
 j.push(k.copy(this.points[b]).clone())}this.points=j}};THREE.Edge=function(a,b,c,e){this.vertices=[a,b];this.vertexIndices=[c,e];this.faces=[];this.faceIndices=[]};
 THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
-THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,e,f,h){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=f!==void 0?f:0.1;this.far=h!==void 0?h:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
+THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,e,h,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=e;this.near=h!==void 0?h:0.1;this.far=f!==void 0?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
 THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,e){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=b!==void 0?b:1;this.near=c!==void 0?c:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
-THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,e,f,h){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=e;this.width=f;this.height=h;this.updateProjectionMatrix()};
+THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((b!==void 0?b:43.25)/(a*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,e,h,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=e;this.width=h;this.height=f;this.updateProjectionMatrix()};
 THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,e=a*c,a=Math.abs(a*b-e),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*a/this.fullWidth,e+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
 this.far)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=b!==void 0?b:1;this.distance=c!==void 0?c:0};THREE.PointLight.prototype=new THREE.Light;
@@ -118,22 +118,22 @@ THREE.MeshShaderMaterial=function(a){console.warn("DEPRECATED: MeshShaderMateria
 THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map!==void 0?a.map:null;this.size=a.size!==void 0?a.size:1;this.sizeAttenuation=a.sizeAttenuation!==void 0?a.sizeAttenuation:!0;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.fog=a.fog!==void 0?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
 THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=a.fragmentShader!==void 0?a.fragmentShader:"void main() {}";this.vertexShader=a.vertexShader!==void 0?a.vertexShader:"void main() {}";this.uniforms=a.uniforms!==void 0?a.uniforms:{};this.attributes=a.attributes;this.shading=a.shading!==void 0?a.shading:THREE.SmoothShading;this.wireframe=a.wireframe!==void 0?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth!==void 0?a.wireframeLinewidth:1;this.fog=a.fog!==
 void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.vertexColors!==void 0?a.vertexColors:!1;this.skinning=a.skinning!==void 0?a.skinning:!1;this.morphTargets=a.morphTargets!==void 0?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
-THREE.Texture=function(a,b,c,e,f,h){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==void 0?f:THREE.LinearFilter;this.minFilter=h!==void 0?h:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
+THREE.Texture=function(a,b,c,e,h,f){this.id=THREE.TextureCount++;this.image=a;this.mapping=b!==void 0?b:new THREE.UVMapping;this.wrapS=c!==void 0?c:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=f!==void 0?f:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
 THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,e,f,h,i,j,m){THREE.Texture.call(this,null,f,h,i,j,m);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(a,b,c,e,h,f,i,j,o){THREE.Texture.call(this,null,h,f,i,j,o);this.image={data:a,width:b,height:c};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
 THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1};
-THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!=void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
+THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=c!==void 0?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
 for(var c=0;c<this.geometry.morphTargets.length;c++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==void 0)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,b){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate)a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;var c,e=this.children.length;for(c=0;c<e;c++)this.children[c].update(this.skinMatrix,b)};
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,f,h,i,j;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)f=this.geometry.bones[c],h=f.pos,i=f.rotq,j=f.scl,e=this.addBone(),e.name=f.name,e.position.set(h[0],h[1],h[2]),e.quaternion.set(i[0],i[1],i[2],i[3]),e.useQuaternion=!0,j!==void 0?e.scale.set(j[0],j[1],j[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)f=this.geometry.bones[c],
-e=this.bones[c],f.parent===-1?this.add(e):this.bones[f.parent].add(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,e,h,f,i,j;if(this.geometry.bones!==void 0){for(c=0;c<this.geometry.bones.length;c++)h=this.geometry.bones[c],f=h.pos,i=h.rotq,j=h.scl,e=this.addBone(),e.name=h.name,e.position.set(f[0],f[1],f[2]),e.quaternion.set(i[0],i[1],i[2],i[3]),e.useQuaternion=!0,j!==void 0?e.scale.set(j[0],j[1],j[2]):e.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)h=this.geometry.bones[c],
+e=this.bones[c],h.parent===-1?this.add(e):this.bones[h.parent].add(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;THREE.SkinnedMesh.prototype.addBone=function(a){a===void 0&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(a=0;a<b;a++)ba[a].skinMatrix.flattenToArrayOffset(bm,
 a*16)};
-THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var e=new THREE.Matrix4;e.getInverse(a.skinMatrix);b.push(e);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y,e=
-new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(e));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
+THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var e=new THREE.Matrix4;e.getInverse(a.skinMatrix);b.push(e);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,h=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,e=
+new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[h].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[f].multiplyVector3(e));this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1&&(c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5,this.geometry.skinWeights[a].x+=c,this.geometry.skinWeights[a].y+=c)}}};THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b};
 THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.addLevel=function(a,b){b===void 0&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
 THREE.LOD.prototype.update=function(a){if(this.LODs.length>1){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
 THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=a.color!==void 0?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map instanceof THREE.Texture?a.map:THREE.ImageUtils.loadTexture(a.map);this.blending=a.blending!==void 0?a.blending:THREE.NormalBlending;this.useScreenCoordinates=a.useScreenCoordinates!==void 0?a.useScreenCoordinates:!0;this.mergeWith3D=a.mergeWith3D!==void 0?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=a.affectedByDistance!==void 0?a.affectedByDistance:
@@ -157,7 +157,7 @@ morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInflu
 default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
 shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
 shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
-THREE.UniformsUtils={merge:function(a){var b,c,e,f={};for(b=0;b<a.length;b++)for(c in e=this.clone(a[b]),e)f[c]=e[c];return f},clone:function(a){var b,c,e,f={};for(b in a)for(c in f[b]={},a[b])e=a[b][c],f[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return f}};
+THREE.UniformsUtils={merge:function(a){var b,c,e,h={};for(b=0;b<a.length;b++)for(c in e=this.clone(a[b]),e)h[c]=e[c];return h},clone:function(a){var b,c,e,h={};for(b in a)for(c in h[b]={},a[b])e=a[b][c],h[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return h}};
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
 value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",
 value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
@@ -177,122 +177,124 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
 THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
-THREE.WebGLRenderer=function(a){function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function c(a,b,c){var e,h,f,i=a.vertices,u=i.length,q=a.colors,r=q.length,j=a.__vertexArray,Ba=a.__colorArray,k=a.__sortArray,P=a.__dirtyVertices,m=a.__dirtyColors,l=a.__webglCustomAttributesList,o;if(l){f=0;for(e=l.length;f<e;f++)l[f].offset=0}if(c.sortParticles){Ea.multiplySelf(c.matrixWorld);for(e=
-0;e<u;e++)h=i[e].position,Ha.copy(h),Ea.multiplyVector3(Ha),k[e]=[Ha.z,e];k.sort(function(a,b){return b[0]-a[0]});for(e=0;e<u;e++)h=i[k[e][1]].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;for(e=0;e<r;e++)f=e*3,color=q[k[e][1]],Ba[f]=color.r,Ba[f+1]=color.g,Ba[f+2]=color.b;if(l){f=0;for(e=l.length;f<e;f++){u=l[f];r=u.value.length;for(q=0;q<r;q++){index=k[q][1];i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[index]}else{if(u.boundTo===void 0||u.boundTo===
-"vertices")o=u.value[index];u.size===2?(u.array[i]=o.x,u.array[i+1]=o.y):u.size===3?u.type==="c"?(u.array[i]=o.r,u.array[i+1]=o.g,u.array[i+2]=o.b):(u.array[i]=o.x,u.array[i+1]=o.y,u.array[i+2]=o.z):(u.array[i]=o.x,u.array[i+1]=o.y,u.array[i+2]=o.z,u.array[i+3]=o.w)}u.offset+=u.size}}}}else{if(P)for(e=0;e<u;e++)h=i[e].position,f=e*3,j[f]=h.x,j[f+1]=h.y,j[f+2]=h.z;if(m)for(e=0;e<r;e++)color=q[e],f=e*3,Ba[f]=color.r,Ba[f+1]=color.g,Ba[f+2]=color.b;if(l){f=0;for(e=l.length;f<e;f++)if(u=l[f],u.__original.needsUpdate){r=
-u.value.length;for(q=0;q<r;q++){i=u.offset;if(u.size===1){if(u.boundTo===void 0||u.boundTo==="vertices")u.array[i]=u.value[q]}else{if(u.boundTo===void 0||u.boundTo==="vertices")o=u.value[q];u.size===2?(u.array[i]=o.x,u.array[i+1]=o.y):u.size===3?u.type==="c"?(u.array[i]=o.r,u.array[i+1]=o.g,u.array[i+2]=o.b):(u.array[i]=o.x,u.array[i+1]=o.y,u.array[i+2]=o.z):(u.array[i]=o.x,u.array[i+1]=o.y,u.array[i+2]=o.z,u.array[i+3]=o.w)}u.offset+=u.size}}}}if(P||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),
-d.bufferData(d.ARRAY_BUFFER,j,b);if(m||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,Ba,b);if(l){f=0;for(e=l.length;f<e;f++)if(u=l[f],u.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,u.buffer),d.bufferData(d.ARRAY_BUFFER,u.array,b)}}function e(a,b,c,e,h){e.program||E.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var f=0,i=E.maxMorphTargets;f<
-i;f++)h.__webglMorphTargetInfluences[f]=0}var u=!1,f=e.program,i=f.uniforms,q=e.uniforms;f!==Va&&(d.useProgram(f),Va=f,u=!0);if(e.id!==K)K=e.id,u=!0;if(u){d.uniformMatrix4fv(i.projectionMatrix,!1,Sa);if(c&&e.fog)if(q.fogColor.value=c.color,c instanceof THREE.Fog)q.fogNear.value=c.near,q.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)q.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var r,j,k=0,o=0,P=0,l,m,p,t=Ya,x=t.directional.colors,
-z=t.directional.positions,y=t.point.colors,A=t.point.positions,B=t.point.distances,G=0,I=0,c=r=p=0,u=b.length;c<u;c++)if(r=b[c],j=r.color,l=r.position,m=r.intensity,p=r.distance,r instanceof THREE.AmbientLight)E.gammaInput?(k+=j.r*j.r,o+=j.g*j.g,P+=j.b*j.b):(k+=j.r,o+=j.g,P+=j.b);else if(r instanceof THREE.DirectionalLight)p=G*3,E.gammaInput?(x[p]=j.r*j.r*m*m,x[p+1]=j.g*j.g*m*m,x[p+2]=j.b*j.b*m*m):(x[p]=j.r*m,x[p+1]=j.g*m,x[p+2]=j.b*m),z[p]=l.x,z[p+1]=l.y,z[p+2]=l.z,G+=1;else if(r instanceof THREE.SpotLight)p=
-G*3,E.gammaInput?(x[p]=j.r*j.r*m*m,x[p+1]=j.g*j.g*m*m,x[p+2]=j.b*j.b*m*m):(x[p]=j.r*m,x[p+1]=j.g*m,x[p+2]=j.b*m),j=1/l.length(),z[p]=l.x*j,z[p+1]=l.y*j,z[p+2]=l.z*j,G+=1;else if(r instanceof THREE.PointLight)r=I*3,E.gammaInput?(y[r]=j.r*j.r*m*m,y[r+1]=j.g*j.g*m*m,y[r+2]=j.b*j.b*m*m):(y[r]=j.r*m,y[r+1]=j.g*m,y[r+2]=j.b*m),A[r]=l.x,A[r+1]=l.y,A[r+2]=l.z,B[I]=p,I+=1;c=G*3;for(u=x.length;c<u;c++)x[c]=0;c=I*3;for(u=y.length;c<u;c++)y[c]=0;t.point.length=I;t.directional.length=G;t.ambient[0]=k;t.ambient[1]=
-o;t.ambient[2]=P;b=Ya;q.enableLighting.value=b.directional.length+b.point.length;q.ambientLightColor.value=b.ambient;q.directionalLightColor.value=b.directional.colors;q.directionalLightDirection.value=b.directional.positions;q.pointLightColor.value=b.point.colors;q.pointLightPosition.value=b.point.positions;q.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)q.opacity.value=e.opacity,E.gammaInput?
-q.diffuse.value.copyGammaToLinear(e.color):q.diffuse.value=e.color,(q.map.texture=e.map)&&q.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),q.lightMap.texture=e.lightMap,q.envMap.texture=e.envMap,q.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,q.reflectivity.value=e.reflectivity,q.refractionRatio.value=e.refractionRatio,q.combine.value=e.combine,q.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof
-THREE.LineBasicMaterial)q.diffuse.value=e.color,q.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)q.psColor.value=e.color,q.opacity.value=e.opacity,q.size.value=e.size,q.scale.value=za.height/2,q.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)q.shininess.value=e.shininess,E.gammaInput?(q.ambient.value.copyGammaToLinear(e.ambient),q.specular.value.copyGammaToLinear(e.specular)):(q.ambient.value=e.ambient,q.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)E.gammaInput?
-q.ambient.value.copyGammaToLinear(e.ambient):q.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)q.mNear.value=a.near,q.mFar.value=a.far,q.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)q.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&q.shadowMatrix){for(b=0;b<Ra.length;b++)q.shadowMatrix.value[b]=Ra[b],q.shadowMap.texture[b]=E.shadowMap[b];q.shadowDarkness.value=E.shadowMapDarkness;q.shadowBias.value=E.shadowMapBias}b=e.uniformsList;q=0;for(c=
-b.length;q<c;q++)if(o=f.uniforms[b[q][1]])if(k=b[q][0],P=k.type,u=k.value,P==="i")d.uniform1i(o,u);else if(P==="f")d.uniform1f(o,u);else if(P==="v2")d.uniform2f(o,u.x,u.y);else if(P==="v3")d.uniform3f(o,u.x,u.y,u.z);else if(P==="v4")d.uniform4f(o,u.x,u.y,u.z,u.w);else if(P==="c")d.uniform3f(o,u.r,u.g,u.b);else if(P==="fv1")d.uniform1fv(o,u);else if(P==="fv")d.uniform3fv(o,u);else if(P==="v3v"){if(!k._array)k._array=new Float32Array(3*u.length);P=0;for(l=u.length;P<l;P++)t=P*3,k._array[t]=u[P].x,k._array[t+
-1]=u[P].y,k._array[t+2]=u[P].z;d.uniform3fv(o,k._array)}else if(P==="m4"){if(!k._array)k._array=new Float32Array(16);u.flattenToArray(k._array);d.uniformMatrix4fv(o,!1,k._array)}else if(P==="m4v"){if(!k._array)k._array=new Float32Array(16*u.length);P=0;for(l=u.length;P<l;P++)u[P].flattenToArrayOffset(k._array,P*16);d.uniformMatrix4fv(o,!1,k._array)}else if(P==="t"){if(d.uniform1i(o,u),o=k.texture)if(o.image instanceof Array&&o.image.length===6){if(k=o,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=
-d.createTexture();d.activeTexture(d.TEXTURE0+u);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(u=0;u<6;u++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[u]);F(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else o instanceof THREE.WebGLRenderTargetCube?(k=o,d.activeTexture(d.TEXTURE0+u),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):H(o,u)}else if(P===
-"tv"){if(!k._array){k._array=[];P=0;for(l=k.texture.length;P<l;P++)k._array[P]=u+P}d.uniform1iv(o,k._array);P=0;for(l=k.texture.length;P<l;P++)(o=k.texture[P])&&H(o,k._array[P])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&
-d.uniformMatrix4fv(i.viewMatrix,!1,Ta);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Ta),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,h.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function f(a,b,c,h,f,i){if(h.opacity!==
-0){var j,u,c=e(a,b,c,h,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(h.wireframe?1:0);c!==T&&(T=c,b=!0);if(!h.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=h.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
-d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var q=i.morphTargetForcedOrder;for(u=i.morphTargetInfluences;j<h.numSupportedMorphTargets&&j<q.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[q[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=u[q[j]],j++}else{var q=[],r=-1,k=0;u=i.morphTargetInfluences;var o,m=u.length;j=0;for(i.morphTargetBase!==-1&&(q[i.morphTargetBase]=!0);j<h.numSupportedMorphTargets;){for(o=
-0;o<m;o++)!q[o]&&u[o]>r&&(k=o,r=u[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=r;q[k]=1;r=-1;j++}}h.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(h.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(u=f.__webglCustomAttributesList.length;j<u;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=
-0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,
-f.__webglUVBuffer),d.vertexAttribPointer(a.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv)):d.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),d.vertexAttribPointer(a.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv2)):d.disableVertexAttribArray(a.uv2));h.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(a.skinVertexA,4,
-d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(a.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(a.skinIndex,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(a.skinWeight,4,d.FLOAT,!1,0,0))}i instanceof THREE.Mesh?(h.wireframe?(d.lineWidth(h.wireframeLinewidth),b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,
-d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=f.__webglFaceCount,E.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(h.linewidth),d.drawArrays(i,0,f.__webglLineCount),E.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),E.info.render.calls++):
-i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),E.info.render.calls++)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,
-a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,i,j,q,r,k,o,m,l=a.count*3;for(m=0;m<l;m+=9)c=a.normalArray,e=c[m],f=c[m+1],h=c[m+2],i=c[m+3],q=c[m+4],k=c[m+5],j=c[m+6],r=c[m+7],o=c[m+8],e=(e+i+j)/3,f=(f+q+r)/3,h=(h+k+o)/3,c[m]=e,c[m+1]=f,c[m+2]=h,c[m+3]=e,c[m+4]=f,c[m+5]=h,c[m+6]=e,c[m+7]=f,c[m+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,
-0,a.count);a.count=0}function i(a){if(R!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),R=a.doubleSided;if(Z!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),Z=a.flipSided}function j(a){V!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),V=a)}function m(a){va!==a&&(d.depthMask(a),va=a)}function l(a,b,c){Aa!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Aa=a);if(a&&(Ka!==b||Pa!==c))d.polygonOffset(b,c),Ka=b,Pa=c}function k(a){ka[0].set(a.n41-
-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ka[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ka[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ka[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ka[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ka[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ka[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function o(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,
-Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=ka[c].x*b.n14+ka[c].y*b.n24+ka[c].z*b.n34+ka[c].w,a<=d)return!1;return!0}function t(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a){var b=a.object,d=a.buffer,c;c=b.material;if(c instanceof THREE.MeshFaceMaterial){if(d=d.materialIndex,d>=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=
-b,a.opaque=null):(a.opaque=b,a.transparent=null)}function y(a,b){return b.z-a.z}function A(a){var b,c,m,wa=0,L,l,u,q,r=a.lights;W||(W=new THREE.PerspectiveCamera(E.shadowCameraFov,E.shadowMapWidth/E.shadowMapHeight,E.shadowCameraNear,E.shadowCameraFar));b=0;for(c=r.length;b<c;b++)if(m=r[b],m instanceof THREE.SpotLight&&m.castShadow){K=-1;E.shadowMap[wa]||(E.shadowMap[wa]=new THREE.WebGLRenderTarget(E.shadowMapWidth,E.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));
-Ra[wa]||(Ra[wa]=new THREE.Matrix4);L=E.shadowMap[wa];l=Ra[wa];W.position.copy(m.position);W.lookAt(m.target.position);W.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(W));this.autoUpdateScene&&a.updateMatrixWorld();W.matrixWorldInverse.getInverse(W.matrixWorld);l.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);l.multiplySelf(W.projectionMatrix);l.multiplySelf(W.matrixWorldInverse);W.matrixWorldInverse.flattenToArray(Ta);W.projectionMatrix.flattenToArray(Sa);Ea.multiply(W.projectionMatrix,
-W.matrixWorldInverse);k(Ea);C(L);d.clearColor(1,1,1,1);E.clear();d.clearColor($.r,$.g,$.b,Fa);l=a.__webglObjects.length;m=a.__webglObjectsImmediate.length;for(L=0;L<l;L++)u=a.__webglObjects[L],q=u.object,q.visible&&q.castShadow?!(q instanceof THREE.Mesh)||!q.frustumCulled||o(q)?(q.matrixWorld.flattenToArray(q._objectMatrixArray),ja(q,W,!1),u.render=!0):u.render=!1:u.render=!1;j(!0);M(THREE.NormalBlending);for(L=0;L<l;L++)if(u=a.__webglObjects[L],u.render)q=u.object,buffer=u.buffer,i(q),u=q.customDepthMaterial?
-q.customDepthMaterial:q.geometry.morphTargets.length?Za:Ua,f(W,r,null,u,buffer,q);for(L=0;L<m;L++)u=a.__webglObjectsImmediate[L],q=u.object,q.visible&&q.castShadow&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),T=-1,ja(q,W,!1),i(q),program=e(W,r,null,Ua,q),q.immediateRenderCallback?q.immediateRenderCallback(program,d,ka):q.render(function(a){h(a,program,Ua.shading)}));wa++}}function B(a,b){var c,e,f;c=p.attributes;var h=p.uniforms,i=Ia/ua,j,q=[],r=ua*0.5,k=Ia*0.5,m=!0;d.useProgram(p.program);
-Va=p.program;T=V=pa=-1;$a||(d.enableVertexAttribArray(p.attributes.position),d.enableVertexAttribArray(p.attributes.uv),$a=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,p.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Sa);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<
-e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(y);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-r)/r,(k-f.position.y)/
-k,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?Ia:1),q[0]=j*i*f.scale.x,q[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,
-f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,q),f.mergeWith3D&&!m?(d.enable(d.DEPTH_TEST),m=!0):!f.mergeWith3D&&m&&(d.disable(d.DEPTH_TEST),m=!1),M(f.blending),H(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(va)}function ja(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}
-function aa(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function na(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function sa(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function G(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function M(a){if(a!==pa){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);
-d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}pa=a}}function F(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,ia(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,ia(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,ia(b.magFilter)),
-d.texParameteri(a,d.TEXTURE_MIN_FILTER,ia(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_MAG_FILTER,xa(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,xa(b.minFilter)))}function H(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),E.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof
-THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,ia(a.format),a.image.width,a.image.height,0,ia(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);F(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function S(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,
-d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function C(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();
-if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);F(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,ia(a.format),a.width,a.height,0,ia(a.format),ia(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,
-f,e.__webglTexture,0);S(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),F(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,ia(a.format),a.width,a.height,0,ia(a.format),ia(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),
-S(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=ua,a=Ia,e=Ca,f=Da);b!==Xa&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),Xa=b)}function Y(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),
-d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function Q(a,b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function xa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
-default:return d.LINEAR}}function ia(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
-var E=this,d,ya=[],Va=null,Xa=null,K=-1,T=null,U=0,R=null,Z=null,pa=null,V=null,va=null,Aa=null,Ka=null,Pa=null,Ca=0,Da=0,ua=0,Ia=0,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ea=new THREE.Matrix4,Sa=new Float32Array(16),Ta=new Float32Array(16),Ha=new THREE.Vector4,Ya={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},za=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-J=a.stencil!==void 0?a.stencil:!0,cb=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,db=a.antialias!==void 0?a.antialias:!1,$=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Fa=a.clearAlpha!==void 0?a.clearAlpha:0,Wa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=za;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
-this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var W,Ra=[],a=THREE.ShaderLib.depthRGBA,ab=THREE.UniformsUtils.clone(a.uniforms),Ua=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
-vertexShader:a.vertexShader,uniforms:ab}),Za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ab,morphTargets:!0});Ua._shadowPass=!0;Za._shadowPass=!0;try{if(!(d=za.getContext("experimental-webgl",{antialias:db,stencil:J,preserveDrawingBuffer:cb})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(eb){console.error(eb)}d.clearColor(0,
-0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor($.r,$.g,$.b,Fa);this.context=d;var bb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,p={};p.vertices=new Float32Array(16);p.faces=new Uint16Array(6);J=0;p.vertices[J++]=-1;p.vertices[J++]=-1;p.vertices[J++]=0;p.vertices[J++]=1;p.vertices[J++]=1;
-p.vertices[J++]=-1;p.vertices[J++]=1;p.vertices[J++]=1;p.vertices[J++]=1;p.vertices[J++]=1;p.vertices[J++]=1;p.vertices[J++]=0;p.vertices[J++]=-1;p.vertices[J++]=1;p.vertices[J++]=0;J=p.vertices[J++]=0;p.faces[J++]=0;p.faces[J++]=1;p.faces[J++]=2;p.faces[J++]=0;p.faces[J++]=2;p.faces[J++]=3;p.vertexBuffer=d.createBuffer();p.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,p.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,p.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.elementBuffer);
-d.bufferData(d.ELEMENT_ARRAY_BUFFER,p.faces,d.STATIC_DRAW);p.program=d.createProgram();d.attachShader(p.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(p.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(p.program);p.attributes={};p.uniforms={};p.attributes.position=d.getAttribLocation(p.program,"position");p.attributes.uv=d.getAttribLocation(p.program,"uv");p.uniforms.uvOffset=d.getUniformLocation(p.program,"uvOffset");p.uniforms.uvScale=d.getUniformLocation(p.program,
-"uvScale");p.uniforms.rotation=d.getUniformLocation(p.program,"rotation");p.uniforms.scale=d.getUniformLocation(p.program,"scale");p.uniforms.alignment=d.getUniformLocation(p.program,"alignment");p.uniforms.color=d.getUniformLocation(p.program,"color");p.uniforms.map=d.getUniformLocation(p.program,"map");p.uniforms.opacity=d.getUniformLocation(p.program,"opacity");p.uniforms.useScreenCoordinates=d.getUniformLocation(p.program,"useScreenCoordinates");p.uniforms.affectedByDistance=d.getUniformLocation(p.program,
-"affectedByDistance");p.uniforms.screenPosition=d.getUniformLocation(p.program,"screenPosition");p.uniforms.modelViewMatrix=d.getUniformLocation(p.program,"modelViewMatrix");p.uniforms.projectionMatrix=d.getUniformLocation(p.program,"projectionMatrix");var $a=!1;this.setSize=function(a,b){za.width=a;za.height=b;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(a,b,c,e){Ca=a;Da=b;ua=c;Ia=e;d.viewport(Ca,Da,ua,Ia)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
-function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){$.setHex(a);Fa=b;d.clearColor($.r,$.g,$.b,Fa)};this.setClearColor=function(a,b){$.copy(a);Fa=b;d.clearColor($.r,$.g,$.b,Fa)};this.getClearColor=function(){return $};this.getClearAlpha=function(){return Fa};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
+THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,e=b.material;if(e.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var f in e.attributes){originalAttribute=e.attributes[f];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type===
+"v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(c*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=f,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;a.__webglCustomAttributesList.push(attribute)}}}function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function e(a,b,c){var e,f,h,i=a.vertices,
+p=i.length,v=a.colors,q=v.length,j=a.__vertexArray,k=a.__colorArray,o=a.__sortArray,R=a.__dirtyVertices,l=a.__dirtyColors,s=a.__webglCustomAttributesList,m;if(s){h=0;for(e=s.length;h<e;h++)s[h].offset=0}if(c.sortParticles){Aa.multiplySelf(c.matrixWorld);for(e=0;e<p;e++)f=i[e].position,Ga.copy(f),Aa.multiplyVector3(Ga),o[e]=[Ga.z,e];o.sort(function(a,b){return b[0]-a[0]});for(e=0;e<p;e++)f=i[o[e][1]].position,h=e*3,j[h]=f.x,j[h+1]=f.y,j[h+2]=f.z;for(e=0;e<q;e++)h=e*3,color=v[o[e][1]],k[h]=color.r,
+k[h+1]=color.g,k[h+2]=color.b;if(s){h=0;for(e=s.length;h<e;h++){p=s[h];q=p.value.length;for(v=0;v<q;v++){index=o[v][1];i=p.offset;if(p.size===1){if(p.boundTo===void 0||p.boundTo==="vertices")p.array[i]=p.value[index]}else{if(p.boundTo===void 0||p.boundTo==="vertices")m=p.value[index];p.size===2?(p.array[i]=m.x,p.array[i+1]=m.y):p.size===3?p.type==="c"?(p.array[i]=m.r,p.array[i+1]=m.g,p.array[i+2]=m.b):(p.array[i]=m.x,p.array[i+1]=m.y,p.array[i+2]=m.z):(p.array[i]=m.x,p.array[i+1]=m.y,p.array[i+2]=
+m.z,p.array[i+3]=m.w)}p.offset+=p.size}}}}else{if(R)for(e=0;e<p;e++)f=i[e].position,h=e*3,j[h]=f.x,j[h+1]=f.y,j[h+2]=f.z;if(l)for(e=0;e<q;e++)color=v[e],h=e*3,k[h]=color.r,k[h+1]=color.g,k[h+2]=color.b;if(s){h=0;for(e=s.length;h<e;h++)if(p=s[h],p.__original.needsUpdate){q=p.value.length;for(v=0;v<q;v++){i=p.offset;if(p.size===1){if(p.boundTo===void 0||p.boundTo==="vertices")p.array[i]=p.value[v]}else{if(p.boundTo===void 0||p.boundTo==="vertices")m=p.value[v];p.size===2?(p.array[i]=m.x,p.array[i+1]=
+m.y):p.size===3?p.type==="c"?(p.array[i]=m.r,p.array[i+1]=m.g,p.array[i+2]=m.b):(p.array[i]=m.x,p.array[i+1]=m.y,p.array[i+2]=m.z):(p.array[i]=m.x,p.array[i+1]=m.y,p.array[i+2]=m.z,p.array[i+3]=m.w)}p.offset+=p.size}}}}if(R||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,j,b);if(l||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,k,b);if(s){h=0;for(e=s.length;h<e;h++)if(p=s[h],p.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,
+p.buffer),d.bufferData(d.ARRAY_BUFFER,p.array,b)}}function h(a,b,c,e,f){e.program||G.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(G.maxMorphTargets);for(var h=0,i=G.maxMorphTargets;h<i;h++)f.__webglMorphTargetInfluences[h]=0}var p=!1,h=e.program,i=h.uniforms,v=e.uniforms;h!==Xa&&(d.useProgram(h),Xa=h,p=!0);if(e.id!==Z)Z=e.id,p=!0;if(p){d.uniformMatrix4fv(i.projectionMatrix,!1,Ua);if(c&&e.fog)if(v.fogColor.value=c.color,c instanceof
+THREE.Fog)v.fogNear.value=c.near,v.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)v.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var q,j,k=0,o=0,R=0,s,l,m,t=Za,y=t.directional.colors,u=t.directional.positions,z=t.point.colors,A=t.point.positions,C=t.point.distances,B=0,H=0,c=q=m=0,p=b.length;c<p;c++)if(q=b[c],j=q.color,s=q.position,l=q.intensity,m=q.distance,q instanceof THREE.AmbientLight)G.gammaInput?(k+=j.r*j.r,
+o+=j.g*j.g,R+=j.b*j.b):(k+=j.r,o+=j.g,R+=j.b);else if(q instanceof THREE.DirectionalLight)m=B*3,G.gammaInput?(y[m]=j.r*j.r*l*l,y[m+1]=j.g*j.g*l*l,y[m+2]=j.b*j.b*l*l):(y[m]=j.r*l,y[m+1]=j.g*l,y[m+2]=j.b*l),u[m]=s.x,u[m+1]=s.y,u[m+2]=s.z,B+=1;else if(q instanceof THREE.SpotLight)m=B*3,G.gammaInput?(y[m]=j.r*j.r*l*l,y[m+1]=j.g*j.g*l*l,y[m+2]=j.b*j.b*l*l):(y[m]=j.r*l,y[m+1]=j.g*l,y[m+2]=j.b*l),j=1/s.length(),u[m]=s.x*j,u[m+1]=s.y*j,u[m+2]=s.z*j,B+=1;else if(q instanceof THREE.PointLight)q=H*3,G.gammaInput?
+(z[q]=j.r*j.r*l*l,z[q+1]=j.g*j.g*l*l,z[q+2]=j.b*j.b*l*l):(z[q]=j.r*l,z[q+1]=j.g*l,z[q+2]=j.b*l),A[q]=s.x,A[q+1]=s.y,A[q+2]=s.z,C[H]=m,H+=1;c=B*3;for(p=y.length;c<p;c++)y[c]=0;c=H*3;for(p=z.length;c<p;c++)z[c]=0;t.point.length=H;t.directional.length=B;t.ambient[0]=k;t.ambient[1]=o;t.ambient[2]=R;b=Za;v.enableLighting.value=b.directional.length+b.point.length;v.ambientLightColor.value=b.ambient;v.directionalLightColor.value=b.directional.colors;v.directionalLightDirection.value=b.directional.positions;
+v.pointLightColor.value=b.point.colors;v.pointLightPosition.value=b.point.positions;v.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)v.opacity.value=e.opacity,G.gammaInput?v.diffuse.value.copyGammaToLinear(e.color):v.diffuse.value=e.color,(v.map.texture=e.map)&&v.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),v.lightMap.texture=e.lightMap,v.envMap.texture=
+e.envMap,v.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,v.reflectivity.value=e.reflectivity,v.refractionRatio.value=e.refractionRatio,v.combine.value=e.combine,v.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)v.diffuse.value=e.color,v.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)v.psColor.value=e.color,v.opacity.value=e.opacity,v.size.value=e.size,v.scale.value=Ba.height/
+2,v.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)v.shininess.value=e.shininess,G.gammaInput?(v.ambient.value.copyGammaToLinear(e.ambient),v.specular.value.copyGammaToLinear(e.specular)):(v.ambient.value=e.ambient,v.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)G.gammaInput?v.ambient.value.copyGammaToLinear(e.ambient):v.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)v.mNear.value=a.near,v.mFar.value=a.far,v.opacity.value=e.opacity;
+else if(e instanceof THREE.MeshNormalMaterial)v.opacity.value=e.opacity;if(f.receiveShadow&&!e._shadowPass&&v.shadowMatrix){for(b=0;b<Sa.length;b++)v.shadowMatrix.value[b]=Sa[b],v.shadowMap.texture[b]=G.shadowMap[b];v.shadowDarkness.value=G.shadowMapDarkness;v.shadowBias.value=G.shadowMapBias}b=e.uniformsList;v=0;for(c=b.length;v<c;v++)if(o=h.uniforms[b[v][1]])if(k=b[v][0],R=k.type,p=k.value,R==="i")d.uniform1i(o,p);else if(R==="f")d.uniform1f(o,p);else if(R==="v2")d.uniform2f(o,p.x,p.y);else if(R===
+"v3")d.uniform3f(o,p.x,p.y,p.z);else if(R==="v4")d.uniform4f(o,p.x,p.y,p.z,p.w);else if(R==="c")d.uniform3f(o,p.r,p.g,p.b);else if(R==="fv1")d.uniform1fv(o,p);else if(R==="fv")d.uniform3fv(o,p);else if(R==="v3v"){if(!k._array)k._array=new Float32Array(3*p.length);R=0;for(s=p.length;R<s;R++)t=R*3,k._array[t]=p[R].x,k._array[t+1]=p[R].y,k._array[t+2]=p[R].z;d.uniform3fv(o,k._array)}else if(R==="m4"){if(!k._array)k._array=new Float32Array(16);p.flattenToArray(k._array);d.uniformMatrix4fv(o,!1,k._array)}else if(R===
+"m4v"){if(!k._array)k._array=new Float32Array(16*p.length);R=0;for(s=p.length;R<s;R++)p[R].flattenToArrayOffset(k._array,R*16);d.uniformMatrix4fv(o,!1,k._array)}else if(R==="t"){if(d.uniform1i(o,p),o=k.texture)if(o.image instanceof Array&&o.image.length===6){if(k=o,k.image.length===6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=d.createTexture();d.activeTexture(d.TEXTURE0+p);d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(p=0;p<6;p++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+
+p,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image[p]);I(d.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+p),d.bindTexture(d.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else o instanceof THREE.WebGLRenderTargetCube?(k=o,d.activeTexture(d.TEXTURE0+p),d.bindTexture(d.TEXTURE_CUBE_MAP,k.__webglTexture)):Y(o,p)}else if(R==="tv"){if(!k._array){k._array=[];R=0;for(s=k.texture.length;R<s;R++)k._array[R]=p+R}d.uniform1iv(o,k._array);R=0;for(s=k.texture.length;R<s;R++)(o=k.texture[R])&&
+Y(o,k._array[R])}(e instanceof THREE.ShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&i.cameraPosition!==null&&d.uniform3f(i.cameraPosition,a.position.x,a.position.y,a.position.z);(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&i.viewMatrix!==null&&d.uniformMatrix4fv(i.viewMatrix,!1,Va);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Va),d.uniformMatrix4fv(i.boneGlobalMatrices,!1,f.boneMatrices))}d.uniformMatrix4fv(i.modelViewMatrix,
+!1,f._modelViewMatrixArray);i.normalMatrix&&d.uniformMatrix3fv(i.normalMatrix,!1,f._normalMatrixArray);(e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||f.receiveShadow)&&i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,f._objectMatrixArray);return h}function f(a,b,c,e,f,i){if(e.opacity!==0){var j,p,c=h(a,b,c,e,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==D&&(D=c,b=!0);if(!e.morphTargets&&a.position>=0)b&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),
+d.vertexAttribPointer(a.position,3,d.FLOAT,!1,0,0));else if(i.morphTargetBase){c=e.program.attributes;i.morphTargetBase!==-1?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[i.morphTargetBase]),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0)):c.position>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglVertexBuffer),d.vertexAttribPointer(c.position,3,d.FLOAT,!1,0,0));if(i.morphTargetForcedOrder.length){j=0;var v=i.morphTargetForcedOrder;for(p=i.morphTargetInfluences;j<e.numSupportedMorphTargets&&
+j<v.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[v[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=p[v[j]],j++}else{var v=[],q=-1,k=0;p=i.morphTargetInfluences;var o,l=p.length;j=0;for(i.morphTargetBase!==-1&&(v[i.morphTargetBase]=!0);j<e.numSupportedMorphTargets;){for(o=0;o<l;o++)!v[o]&&p[o]>q&&(k=o,q=p[k]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=
+q;v[k]=1;q=-1;j++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=0;for(p=f.__webglCustomAttributesList.length;j<p;j++)c=f.__webglCustomAttributesList[j],a[c.buffer.belongsToAttribute]>=0&&(d.bindBuffer(d.ARRAY_BUFFER,c.buffer),d.vertexAttribPointer(a[c.buffer.belongsToAttribute],c.size,d.FLOAT,!1,0,0))}a.color>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglColorBuffer),d.vertexAttribPointer(a.color,
+3,d.FLOAT,!1,0,0));a.normal>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglNormalBuffer),d.vertexAttribPointer(a.normal,3,d.FLOAT,!1,0,0));a.tangent>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglTangentBuffer),d.vertexAttribPointer(a.tangent,4,d.FLOAT,!1,0,0));a.uv>=0&&(f.__webglUVBuffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUVBuffer),d.vertexAttribPointer(a.uv,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv)):d.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(d.bindBuffer(d.ARRAY_BUFFER,f.__webglUV2Buffer),
+d.vertexAttribPointer(a.uv2,2,d.FLOAT,!1,0,0),d.enableVertexAttribArray(a.uv2)):d.disableVertexAttribArray(a.uv2));e.skinning&&a.skinVertexA>=0&&a.skinVertexB>=0&&a.skinIndex>=0&&a.skinWeight>=0&&(d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexABuffer),d.vertexAttribPointer(a.skinVertexA,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),d.vertexAttribPointer(a.skinVertexB,4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),d.vertexAttribPointer(a.skinIndex,
+4,d.FLOAT,!1,0,0),d.bindBuffer(d.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),d.vertexAttribPointer(a.skinWeight,4,d.FLOAT,!1,0,0))}i instanceof THREE.Mesh?(e.wireframe?(d.lineWidth(e.wireframeLinewidth),b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),d.drawElements(d.LINES,f.__webglLineCount,d.UNSIGNED_SHORT,0)):(b&&d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),d.drawElements(d.TRIANGLES,f.__webglFaceCount,d.UNSIGNED_SHORT,0)),G.info.render.calls++,G.info.render.vertices+=f.__webglFaceCount,
+G.info.render.faces+=f.__webglFaceCount/3):i instanceof THREE.Line?(i=i.type===THREE.LineStrip?d.LINE_STRIP:d.LINES,d.lineWidth(e.linewidth),d.drawArrays(i,0,f.__webglLineCount),G.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),G.info.render.calls++):i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),G.info.render.calls++)}}function i(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=d.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=
+d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,a.positionArray,d.DYNAMIC_DRAW),d.enableVertexAttribArray(b.attributes.position),d.vertexAttribPointer(b.attributes.position,3,d.FLOAT,!1,0,0));if(a.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,i,j,v,q,k,o,l,s=a.count*3;for(l=0;l<s;l+=9)c=a.normalArray,e=c[l],f=c[l+1],h=c[l+2],i=c[l+3],v=c[l+4],k=c[l+5],j=c[l+6],q=c[l+7],o=c[l+8],e=(e+i+j)/
+3,f=(f+v+q)/3,h=(h+k+o)/3,c[l]=e,c[l+1]=f,c[l+2]=h,c[l+3]=e,c[l+4]=f,c[l+5]=h,c[l+6]=e,c[l+7]=f,c[l+8]=h}d.bufferData(d.ARRAY_BUFFER,a.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(b.attributes.normal);d.vertexAttribPointer(b.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,a.count);a.count=0}function j(a){if($!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),$=a.doubleSided;if(sa!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),sa=a.flipSided}
+function o(a){va!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),va=a)}function l(a){xa!==a&&(d.depthMask(a),xa=a)}function k(a,b,c){Ia!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Ia=a);if(a&&(Qa!==b||Fa!==c))d.polygonOffset(b,c),Qa=b,Fa=c}function s(a){ja[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ja[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ja[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ja[3].set(a.n41-a.n21,a.n42-a.n22,
+a.n43-a.n23,a.n44-a.n24);ja[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ja[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ja[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function m(a){for(var b=a.matrixWorld,d=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),c=0;c<6;c++)if(a=ja[c].x*b.n14+ja[c].y*b.n24+ja[c].z*b.n34+ja[c].w,a<=d)return!1;return!0}function u(a){var b=a.object.material;b.transparent?(a.transparent=
+b,a.opaque=null):(a.opaque=b,a.transparent=null)}function z(a){var b=a.object,d=a.buffer,c;c=b.material;if(c instanceof THREE.MeshFaceMaterial){if(d=d.materialIndex,d>=0)b=b.geometry.materials[d],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=c)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function A(a,b){return b.z-a.z}function C(a){var b,c,e,k=0,Q,l,p,v,q=a.lights;la||(la=new THREE.PerspectiveCamera(G.shadowCameraFov,G.shadowMapWidth/
+G.shadowMapHeight,G.shadowCameraNear,G.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(e=q[b],e instanceof THREE.SpotLight&&e.castShadow){Z=-1;G.shadowMap[k]||(G.shadowMap[k]=new THREE.WebGLRenderTarget(G.shadowMapWidth,G.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Sa[k]||(Sa[k]=new THREE.Matrix4);Q=G.shadowMap[k];l=Sa[k];la.position.copy(e.position);la.lookAt(e.target.position);la.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),
+a.add(la));this.autoUpdateScene&&a.updateMatrixWorld();la.matrixWorldInverse.getInverse(la.matrixWorld);l.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);l.multiplySelf(la.projectionMatrix);l.multiplySelf(la.matrixWorldInverse);la.matrixWorldInverse.flattenToArray(Va);la.projectionMatrix.flattenToArray(Ua);Aa.multiply(la.projectionMatrix,la.matrixWorldInverse);s(Aa);J(Q);d.clearColor(1,1,1,1);G.clear();d.clearColor(aa.r,aa.g,aa.b,Ca);l=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(Q=
+0;Q<l;Q++)p=a.__webglObjects[Q],v=p.object,v.visible&&v.castShadow?!(v instanceof THREE.Mesh)||!v.frustumCulled||m(v)?(v.matrixWorld.flattenToArray(v._objectMatrixArray),P(v,la,!1),p.render=!0):p.render=!1:p.render=!1;o(!0);B(THREE.NormalBlending);for(Q=0;Q<l;Q++)if(p=a.__webglObjects[Q],p.render)v=p.object,buffer=p.buffer,j(v),p=v.customDepthMaterial?v.customDepthMaterial:v.geometry.morphTargets.length?$a:Wa,f(la,q,null,p,buffer,v);for(Q=0;Q<e;Q++)p=a.__webglObjectsImmediate[Q],v=p.object,v.visible&&
+v.castShadow&&(v.matrixAutoUpdate&&v.matrixWorld.flattenToArray(v._objectMatrixArray),D=-1,P(v,la,!1),j(v),program=h(la,q,null,Wa,v),v.immediateRenderCallback?v.immediateRenderCallback(program,d,ja):v.render(function(a){i(a,program,Wa.shading)}));k++}}function na(a,b){var c,e,f;c=t.attributes;var h=t.uniforms,i=Pa/Ta,j,k=[],q=Ta*0.5,l=Pa*0.5,o=!0;d.useProgram(t.program);Xa=t.program;D=va=S=-1;ab||(d.enableVertexAttribArray(t.attributes.position),d.enableVertexAttribArray(t.attributes.uv),ab=!0);d.disable(d.CULL_FACE);
+d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.vertexAttribPointer(c.position,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(c.uv,2,d.FLOAT,!1,16,8);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Ua);d.activeTexture(d.TEXTURE0);d.uniform1i(h.map,0);c=0;for(e=a.__webglSprites.length;c<e;c++)if(f=a.__webglSprites[c],f.visible&&f.opacity!==0)f.useScreenCoordinates?f.z=-f.position.z:(f._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
+f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(A);c=0;for(e=a.__webglSprites.length;c<e;c++)f=a.__webglSprites[c],f.visible&&f.opacity!==0&&f.map&&f.map.image&&f.map.image.width&&(f.useScreenCoordinates?(d.uniform1i(h.useScreenCoordinates,1),d.uniform3f(h.screenPosition,(f.position.x-q)/q,(l-f.position.y)/l,Math.max(0,Math.min(1,f.position.z)))):(d.uniform1i(h.useScreenCoordinates,0),d.uniform1i(h.affectedByDistance,f.affectedByDistance?1:0),d.uniformMatrix4fv(h.modelViewMatrix,
+!1,f._modelViewMatrixArray)),j=f.map.image.width/(f.scaleByViewport?Pa:1),k[0]=j*i*f.scale.x,k[1]=j*f.scale.y,d.uniform2f(h.uvScale,f.uvScale.x,f.uvScale.y),d.uniform2f(h.uvOffset,f.uvOffset.x,f.uvOffset.y),d.uniform2f(h.alignment,f.alignment.x,f.alignment.y),d.uniform1f(h.opacity,f.opacity),d.uniform3f(h.color,f.color.r,f.color.g,f.color.b),d.uniform1f(h.rotation,f.rotation),d.uniform2fv(h.scale,k),f.mergeWith3D&&!o?(d.enable(d.DEPTH_TEST),o=!0):!f.mergeWith3D&&o&&(d.disable(d.DEPTH_TEST),o=!1),
+B(f.blending),Y(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(xa)}function P(a,b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function ka(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function ra(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}
+function L(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function W(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}function B(a){if(a!==S){switch(a){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,
+d.FUNC_ADD),d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}S=a}}function I(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,T(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,T(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,T(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,T(b.minFilter)),d.generateMipmap(a)):(d.texParameteri(a,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE),d.texParameteri(a,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE),d.texParameteri(a,
+d.TEXTURE_MAG_FILTER,ya(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,ya(b.minFilter)))}function Y(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=d.createTexture(),G.info.memory.textures++;d.activeTexture(d.TEXTURE0+b);d.bindTexture(d.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?d.texImage2D(d.TEXTURE_2D,0,T(a.format),a.image.width,a.image.height,0,T(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,
+a.image);I(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function M(a,b){d.bindRenderbuffer(d.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_STENCIL,b.width,b.height),d.framebufferRenderbuffer(d.FRAMEBUFFER,
+d.DEPTH_STENCIL_ATTACHMENT,d.RENDERBUFFER,a)):d.renderbufferStorage(d.RENDERBUFFER,d.RGBA4,b.width,b.height)}function J(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);I(d.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=
+d.createFramebuffer();a.__webglRenderbuffer[c]=d.createRenderbuffer();d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null);var e=a,f=d.TEXTURE_CUBE_MAP_POSITIVE_X+c;d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer[c]);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,f,e.__webglTexture,0);M(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,
+a.__webglTexture),I(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,T(a.format),a.width,a.height,0,T(a.format),T(a.type),null),c=d.TEXTURE_2D,d.bindFramebuffer(d.FRAMEBUFFER,a.__webglFramebuffer),d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,c,a.__webglTexture,0),d.bindRenderbuffer(d.RENDERBUFFER,a.__webglRenderbuffer),M(a.__webglRenderbuffer,a);b?d.bindTexture(d.TEXTURE_CUBE_MAP,null):d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,
+null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,f=e=0):(b=null,c=Ta,a=Pa,e=za,f=wa);b!==V&&(d.bindFramebuffer(d.FRAMEBUFFER,b),d.viewport(e,f,c,a),V=b)}function U(a){a instanceof THREE.WebGLRenderTargetCube?(d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture),d.generateMipmap(d.TEXTURE_CUBE_MAP),d.bindTexture(d.TEXTURE_CUBE_MAP,null)):(d.bindTexture(d.TEXTURE_2D,a.__webglTexture),d.generateMipmap(d.TEXTURE_2D),d.bindTexture(d.TEXTURE_2D,null))}function da(a,
+b){var c;a==="fragment"?c=d.createShader(d.FRAGMENT_SHADER):a==="vertex"&&(c=d.createShader(d.VERTEX_SHADER));d.shaderSource(c,b);d.compileShader(c);if(!d.getShaderParameter(c,d.COMPILE_STATUS))return console.error(d.getShaderInfoLog(c)),console.error(b),null;return c}function ya(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function T(a){switch(a){case THREE.RepeatWrapping:return d.REPEAT;
+case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;
+case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var G=this,d,Ea=[],Xa=
+null,V=null,Z=-1,D=null,ta=0,$=null,sa=null,S=null,va=null,xa=null,Ia=null,Qa=null,Fa=null,za=0,wa=0,Ta=0,Pa=0,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Aa=new THREE.Matrix4,Ua=new Float32Array(16),Va=new Float32Array(16),Ga=new THREE.Vector4,Za={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},Ba=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+N=a.stencil!==void 0?a.stencil:!0,db=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,eb=a.antialias!==void 0?a.antialias:!1,aa=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Ca=a.clearAlpha!==void 0?a.clearAlpha:0,Ya=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ba;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var la,Sa=[],a=THREE.ShaderLib.depthRGBA,bb=THREE.UniformsUtils.clone(a.uniforms),Wa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:bb}),$a=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:bb,morphTargets:!0});Wa._shadowPass=!0;$a._shadowPass=!0;try{if(!(d=Ba.getContext("experimental-webgl",{antialias:eb,stencil:N,preserveDrawingBuffer:db})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+d.getParameter(d.VERSION)+" | "+d.getParameter(d.VENDOR)+" | "+d.getParameter(d.RENDERER)+" | "+d.getParameter(d.SHADING_LANGUAGE_VERSION))}catch(fb){console.error(fb)}d.clearColor(0,
+0,0,1);d.clearDepth(1);d.clearStencil(0);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(aa.r,aa.g,aa.b,Ca);this.context=d;var cb=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);N=0;t.vertices[N++]=-1;t.vertices[N++]=-1;t.vertices[N++]=0;t.vertices[N++]=1;t.vertices[N++]=
+1;t.vertices[N++]=-1;t.vertices[N++]=1;t.vertices[N++]=1;t.vertices[N++]=1;t.vertices[N++]=1;t.vertices[N++]=1;t.vertices[N++]=0;t.vertices[N++]=-1;t.vertices[N++]=1;t.vertices[N++]=0;N=t.vertices[N++]=0;t.faces[N++]=0;t.faces[N++]=1;t.faces[N++]=2;t.faces[N++]=0;t.faces[N++]=2;t.faces[N++]=3;t.vertexBuffer=d.createBuffer();t.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,t.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,t.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,t.elementBuffer);
+d.bufferData(d.ELEMENT_ARRAY_BUFFER,t.faces,d.STATIC_DRAW);t.program=d.createProgram();d.attachShader(t.program,da("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(t.program,da("vertex",THREE.ShaderLib.sprite.vertexShader));d.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=d.getAttribLocation(t.program,"position");t.attributes.uv=d.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=d.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=d.getUniformLocation(t.program,
+"uvScale");t.uniforms.rotation=d.getUniformLocation(t.program,"rotation");t.uniforms.scale=d.getUniformLocation(t.program,"scale");t.uniforms.alignment=d.getUniformLocation(t.program,"alignment");t.uniforms.color=d.getUniformLocation(t.program,"color");t.uniforms.map=d.getUniformLocation(t.program,"map");t.uniforms.opacity=d.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=d.getUniformLocation(t.program,"useScreenCoordinates");t.uniforms.affectedByDistance=d.getUniformLocation(t.program,
+"affectedByDistance");t.uniforms.screenPosition=d.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=d.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=d.getUniformLocation(t.program,"projectionMatrix");var ab=!1;this.setSize=function(a,b){Ba.width=a;Ba.height=b;this.setViewport(0,0,Ba.width,Ba.height)};this.setViewport=function(a,b,c,e){za=a;wa=b;Ta=c;Pa=e;d.viewport(za,wa,Ta,Pa)};this.setScissor=function(a,b,c,e){d.scissor(a,b,c,e)};this.enableScissorTest=
+function(a){a?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.setClearColorHex=function(a,b){aa.setHex(a);Ca=b;d.clearColor(aa.r,aa.g,aa.b,Ca)};this.setClearColor=function(a,b){aa.copy(a);Ca=b;d.clearColor(aa.r,aa.g,aa.b,Ca)};this.getClearColor=function(){return aa};this.getClearAlpha=function(){return Ca};this.clear=function(a,b,c){var e=0;if(a===void 0||a)e|=d.COLOR_BUFFER_BIT;if(b===void 0||b)e|=d.DEPTH_BUFFER_BIT;if(c===void 0||c)e|=d.STENCIL_BUFFER_BIT;d.clear(e)};this.getContext=function(){return d};
 this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(g in a.geometry.geometryGroups){var b=a.geometry.geometryGroups[g];d.deleteBuffer(b.__webglVertexBuffer);d.deleteBuffer(b.__webglNormalBuffer);d.deleteBuffer(b.__webglTangentBuffer);d.deleteBuffer(b.__webglColorBuffer);d.deleteBuffer(b.__webglUVBuffer);d.deleteBuffer(b.__webglUV2Buffer);d.deleteBuffer(b.__webglSkinVertexABuffer);
-d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);E.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof
-THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),E.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),E.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
-a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var q=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(q.uniforms);a.vertexShader=q.vertexShader;a.fragmentShader=q.fragmentShader}var r,k,m;r=m=q=0;for(k=b.length;r<k;r++)i=b[r],i instanceof
-THREE.SpotLight&&m++,i instanceof THREE.DirectionalLight&&m++,i instanceof THREE.PointLight&&q++;q+m<=Wa?r=m:(r=Math.ceil(Wa*m/(q+m)),q=Wa-r);i={directional:r,point:q};q=m=0;for(r=b.length;q<r;q++)k=b[q],k instanceof THREE.SpotLight&&k.castShadow&&m++;var o=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)o=e.bones.length;var l;a:{r=a.fragmentShader;k=a.vertexShader;var q=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
-sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:o,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,e=[];j?e.push(j):(e.push(r),e.push(k));for(p in c)e.push(p),e.push(c[p]);j=e.join();p=0;
-for(e=ya.length;p<e;p++)if(ya[p].code===j){l=ya[p].program;break a}p=d.createProgram();e=[bb?"#define VERTEX_TEXTURES":"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
+d.deleteBuffer(b.__webglSkinVertexBBuffer);d.deleteBuffer(b.__webglSkinIndicesBuffer);d.deleteBuffer(b.__webglSkinWeightsBuffer);d.deleteBuffer(b.__webglFaceBuffer);d.deleteBuffer(b.__webglLineBuffer);if(b.numMorphTargets)for(var c=0,e=b.numMorphTargets;c<e;c++)d.deleteBuffer(b.__webglMorphTargetsBuffers[c]);G.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof
+THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),G.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),G.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":
+a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var q,l,o;q=o=k=0;for(l=b.length;q<l;q++)i=b[q],i instanceof
+THREE.SpotLight&&o++,i instanceof THREE.DirectionalLight&&o++,i instanceof THREE.PointLight&&k++;k+o<=Ya?q=o:(q=Math.ceil(Ya*o/(k+o)),k=Ya-q);i={directional:q,point:k};k=o=0;for(q=b.length;k<q;k++)l=b[k],l instanceof THREE.SpotLight&&l.castShadow&&o++;var s=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)s=e.bones.length;var m;a:{q=a.fragmentShader;l=a.vertexShader;var k=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,
+sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,maxPointLights:i.point,maxBones:s,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:o,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},t,e=[];j?e.push(j):(e.push(q),e.push(l));for(t in c)e.push(t),e.push(c[t]);j=e.join();t=0;
+for(e=Ea.length;t<e;t++)if(Ea[t].code===j){m=Ea[t].program;break a}t=d.createProgram();e=[cb?"#define VERTEX_TEXTURES":"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":
 "",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",E.gammaInput?"#define GAMMA_INPUT":"",E.gammaOutput?"#define GAMMA_OUTPUT":"",E.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(p,Q("fragment",i+r));d.attachShader(p,
-Q("vertex",e+k));d.linkProgram(p);d.getProgramParameter(p,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(p,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");p.uniforms={};p.attributes={};var t,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in q)e.push(t);t=e;e=0;for(q=t.length;e<q;e++)r=t[e],p.uniforms[r]=d.getUniformLocation(p,
-r);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<c.maxMorphTargets;t++)e.push("morphTarget"+t);for(l in b)e.push(l);l=e;t=0;for(b=l.length;t<b;t++)c=l[t],p.attributes[c]=d.getAttribLocation(p,c);p.id=ya.length;ya.push({program:p,code:j});E.info.memory.programs=ya.length;l=p}a.program=l;l=a.program.attributes;l.position>=0&&d.enableVertexAttribArray(l.position);l.color>=0&&d.enableVertexAttribArray(l.color);l.normal>=0&&d.enableVertexAttribArray(l.normal);
-l.tangent>=0&&d.enableVertexAttribArray(l.tangent);a.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0&&(d.enableVertexAttribArray(l.skinVertexA),d.enableVertexAttribArray(l.skinVertexB),d.enableVertexAttribArray(l.skinIndex),d.enableVertexAttribArray(l.skinWeight));if(a.attributes)for(h in a.attributes)l[h]!==void 0&&l[h]>=0&&d.enableVertexAttribArray(l[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)t="morphTarget"+h,l[t]>=0&&(d.enableVertexAttribArray(l[t]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){C(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){A(a,b)};this.render=function(a,b,c,p){var wa,L,Qa,u,q,r,Oa,Ba=a.lights,G=a.fog;K=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&A(a,b);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Ta);b.projectionMatrix.flattenToArray(Sa);Ea.multiply(b.projectionMatrix,b.matrixWorldInverse);k(Ea);C(c);(this.autoClear||p)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Qa=a.__webglObjects.length;for(p=0;p<Qa;p++)if(q=a.__webglObjects[p],r=q.object,r.visible)if(!(r instanceof THREE.Mesh)||!r.frustumCulled||o(r)){if(r.matrixWorld.flattenToArray(r._objectMatrixArray),
-ja(r,b,!0),z(q),q.render=!0,this.sortObjects)r.renderDepth?q.z=r.renderDepth:(Ha.copy(r.position),Ea.multiplyVector3(Ha),q.z=Ha.z)}else q.render=!1;else q.render=!1;this.sortObjects&&a.__webglObjects.sort(y);u=a.__webglObjectsImmediate.length;for(p=0;p<u;p++)q=a.__webglObjectsImmediate[p],r=q.object,r.visible&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),ja(r,b,!0),t(q));if(a.overrideMaterial){j(a.overrideMaterial.depthTest);M(a.overrideMaterial.blending);for(p=0;p<Qa;p++)if(q=
-a.__webglObjects[p],q.render)r=q.object,Oa=q.buffer,i(r),f(b,Ba,G,a.overrideMaterial,Oa,r);for(p=0;p<u;p++)q=a.__webglObjectsImmediate[p],r=q.object,r.visible&&(T=-1,i(r),wa=e(b,Ba,G,a.overrideMaterial,r),r.immediateRenderCallback?r.immediateRenderCallback(wa,d,ka):r.render(function(b){h(b,wa,a.overrideMaterial.shading)}))}else{M(THREE.NormalBlending);for(p=Qa-1;p>=0;p--)if(q=a.__webglObjects[p],q.render&&(r=q.object,Oa=q.buffer,L=q.opaque))i(r),j(L.depthTest),m(L.depthWrite),l(L.polygonOffset,L.polygonOffsetFactor,
-L.polygonOffsetUnits),f(b,Ba,G,L,Oa,r);for(p=0;p<u;p++)if(q=a.__webglObjectsImmediate[p],r=q.object,r.visible&&(T=-1,L=q.opaque))i(r),j(L.depthTest),m(L.depthWrite),l(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),wa=e(b,Ba,G,L,r),r.immediateRenderCallback?r.immediateRenderCallback(wa,d,ka):r.render(function(a){h(a,wa,L.shading)});for(p=0;p<Qa;p++)if(q=a.__webglObjects[p],q.render&&(r=q.object,Oa=q.buffer,L=q.transparent))i(r),M(L.blending),j(L.depthTest),m(L.depthWrite),l(L.polygonOffset,
-L.polygonOffsetFactor,L.polygonOffsetUnits),f(b,Ba,G,L,Oa,r);for(p=0;p<u;p++)if(q=a.__webglObjectsImmediate[p],r=q.object,r.visible&&(T=-1,L=q.transparent))i(r),M(L.blending),j(L.depthTest),m(L.depthWrite),l(L.polygonOffset,L.polygonOffsetFactor,L.polygonOffsetUnits),wa=e(b,Ba,G,L,r),r.immediateRenderCallback?r.immediateRenderCallback(wa,d,ka):r.render(function(a){h(a,wa,L.shading)})}a.__webglSprites.length&&B(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&Y(c)};this.initWebGLObjects=
-function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,h=void 0,i=void 0,j=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){i=e.geometry;if(i.geometryGroups===
-void 0){var j=i,k=void 0,m=void 0,q=void 0,r=void 0,l=q=void 0,o=void 0,p={},t=j.morphTargets.length;j.geometryGroups={};k=0;for(m=j.faces.length;k<m;k++)q=j.faces[k],r=q.materialIndex,l=r!==void 0?r:-1,p[l]===void 0&&(p[l]={hash:l,counter:0}),o=p[l].hash+"_"+p[l].counter,j.geometryGroups[o]===void 0&&(j.geometryGroups[o]={faces:[],materialIndex:r,vertices:0,numMorphTargets:t}),q=q instanceof THREE.Face3?3:4,j.geometryGroups[o].vertices+q>65535&&(p[l].counter+=1,o=p[l].hash+"_"+p[l].counter,j.geometryGroups[o]===
-void 0&&(j.geometryGroups[o]={faces:[],materialIndex:r,vertices:0,numMorphTargets:t})),j.geometryGroups[o].faces.push(k),j.geometryGroups[o].vertices+=q;j.geometryGroupsList=[];k=void 0;for(k in j.geometryGroups)j.geometryGroups[k].id=U++,j.geometryGroupsList.push(j.geometryGroups[k])}for(h in i.geometryGroups)if(j=i.geometryGroups[h],!j.__webglVertexBuffer){k=j;k.__webglVertexBuffer=d.createBuffer();k.__webglNormalBuffer=d.createBuffer();k.__webglTangentBuffer=d.createBuffer();k.__webglColorBuffer=
-d.createBuffer();k.__webglUVBuffer=d.createBuffer();k.__webglUV2Buffer=d.createBuffer();k.__webglSkinVertexABuffer=d.createBuffer();k.__webglSkinVertexBBuffer=d.createBuffer();k.__webglSkinIndicesBuffer=d.createBuffer();k.__webglSkinWeightsBuffer=d.createBuffer();k.__webglFaceBuffer=d.createBuffer();k.__webglLineBuffer=d.createBuffer();if(k.numMorphTargets){r=m=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(r=k.numMorphTargets;m<r;m++)k.__webglMorphTargetsBuffers.push(d.createBuffer())}E.info.memory.geometries++;
-for(var r=e,z=q=p=void 0,l=z=t=z=void 0,o=l=k=0,y=q=void 0,A=void 0,q=m=t=p=void 0,t=r.geometry,y=t.faces,A=j.faces,p=0,q=A.length;p<q;p++)z=A[p],z=y[z],z instanceof THREE.Face3?(k+=3,l+=1,o+=3):z instanceof THREE.Face4&&(k+=4,l+=2,o+=4);p=b(r,j);q=p.map||p.lightMap||p instanceof THREE.ShaderMaterial?!0:!1;A=p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial?!1:p&&p.shading!==void 0&&p.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;y=p.vertexColors?
-p.vertexColors:!1;j.__vertexArray=new Float32Array(k*3);if(A)j.__normalArray=new Float32Array(k*3);if(t.hasTangents)j.__tangentArray=new Float32Array(k*4);if(y)j.__colorArray=new Float32Array(k*3);if(q){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(k*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(k*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(k*4),j.__skinVertexBArray=new Float32Array(k*
-4),j.__skinIndexArray=new Float32Array(k*4),j.__skinWeightArray=new Float32Array(k*4);j.__faceArray=new Uint16Array(l*3);j.__lineArray=new Uint16Array(o*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(z=j.numMorphTargets;t<z;t++)j.__morphTargetsArrays.push(new Float32Array(k*3))}j.__needsSmoothNormals=A===THREE.SmoothShading;j.__uvType=q;j.__vertexColorType=y;j.__normalType=A;j.__webglFaceCount=l*3;j.__webglLineCount=o*2;if(p.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=
-[];r=void 0;for(r in p.attributes){q=p.attributes[r];t={};for(m in q)t[m]=q[m];if(!t.__webglInitialized||t.createUniqueBuffers)t.__webglInitialized=!0,l=1,t.type==="v2"?l=2:t.type==="v3"?l=3:t.type==="v4"?l=4:t.type==="c"&&(l=3),t.size=l,t.array=new Float32Array(k*l),t.buffer=d.createBuffer(),t.buffer.belongsToAttribute=r,q.needsUpdate=!0,t.__original=q;j.__webglCustomAttributesList.push(t)}}j.__inittedArrays=!0;i.__dirtyVertices=!0;i.__dirtyMorphTargets=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
-!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),j.__webglColorBuffer=d.createBuffer(),E.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglVertexCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.Line){if(i=e.geometry,!i.__webglVertexBuffer)j=i,j.__webglVertexBuffer=d.createBuffer(),
-j.__webglColorBuffer=d.createBuffer(),E.info.memory.geometries++,j=i,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,i.__dirtyVertices=!0,i.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(i=e.geometry,!i.__webglVertexBuffer)){j=i;j.__webglVertexBuffer=d.createBuffer();j.__webglColorBuffer=d.createBuffer();E.info.geometries++;j=i;m=e;k=j.vertices.length;j.__vertexArray=new Float32Array(k*3);j.__colorArray=new Float32Array(k*
-3);j.__sortArray=[];j.__webglParticleCount=k;m=m.material;if(m.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];r=void 0;for(r in m.attributes){originalAttribute=m.attributes[r];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:
-attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=d.createBuffer(),attribute.buffer.belongsToAttribute=r,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributesList.push(attribute)}}i.__dirtyVertices=!0;i.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in i=e.geometry,i.geometryGroups)j=i.geometryGroups[h],G(f.__webglObjects,j,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||
-e instanceof THREE.ParticleSystem?(i=e.geometry,G(f.__webglObjects,i,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)sa(f.__webglObjects,
-e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;for(i=f.length-1;i>=0;i--)f[i]===h&&f.splice(i,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&sa(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(i=a.__webglObjects[e].object,h=i.geometry,j=l=r=void 0,i instanceof THREE.Mesh){k=0;for(m=h.geometryGroupsList.length;k<m;k++)if(r=h.geometryGroupsList[k],j=b(i,r),l=j.attributes&&aa(j),h.__dirtyVertices||
-h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||l)if(l=d.DYNAMIC_DRAW,o=!h.dynamic,r.__inittedArrays){var B=t=p=void 0,x=void 0,F=B=void 0,C=void 0,H=void 0,M=void 0,V=z=A=y=q=void 0,I=void 0,N=void 0,O=void 0,J=void 0,v=x=M=x=H=C=void 0,D=void 0,s=D=v=C=void 0,n=void 0,s=D=v=B=B=F=D=v=x=s=D=v=n=s=D=v=n=s=D=v=void 0,la=0,K=0,Y=0,Z=0,S=0,Q=0,ca=0,R=0,ma=0,w=0,oa=0,X=s=0,X=void 0,qa=r.__vertexArray,ia=r.__uvArray,ja=r.__uv2Array,T=r.__normalArray,
-da=r.__tangentArray,ra=r.__colorArray,ea=r.__skinVertexAArray,fa=r.__skinVertexBArray,ga=r.__skinIndexArray,ha=r.__skinWeightArray,pa=r.__morphTargetsArrays,W=r.__webglCustomAttributesList,n=void 0,ka=r.__faceArray,$=r.__lineArray,xa=r.__needsSmoothNormals,y=r.__vertexColorType,q=r.__uvType,A=r.__normalType,ta=i.geometry,va=ta.__dirtyVertices,ya=ta.__dirtyElements,ua=ta.__dirtyUvs,Aa=ta.__dirtyNormals,Ca=ta.__dirtyTangents,Da=ta.__dirtyColors,Ea=ta.__dirtyMorphTargets,za=ta.vertices,Fa=r.faces,Ka=
-ta.faces,Ha=ta.faceVertexUvs[0],Ia=ta.faceVertexUvs[1],La=ta.skinVerticesA,Ma=ta.skinVerticesB,Na=ta.skinIndices,Ja=ta.skinWeights,Ga=ta.morphTargets;if(W){v=0;for(D=W.length;v<D;v++)W[v].offset=0,W[v].offsetSrc=0}p=0;for(t=Fa.length;p<t;p++)if(B=Fa[p],x=Ka[B],Ha&&(z=Ha[B]),Ia&&(V=Ia[B]),B=x.vertexNormals,F=x.normal,C=x.vertexColors,H=x.color,M=x.vertexTangents,x instanceof THREE.Face3){if(va)I=za[x.a].position,N=za[x.b].position,O=za[x.c].position,qa[K]=I.x,qa[K+1]=I.y,qa[K+2]=I.z,qa[K+3]=N.x,qa[K+
-4]=N.y,qa[K+5]=N.z,qa[K+6]=O.x,qa[K+7]=O.y,qa[K+8]=O.z,K+=9;if(W){v=0;for(D=W.length;v<D;v++)if(n=W[v],n.__original.needsUpdate)s=n.offset,X=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[x.a],n.array[s+1]=n.value[x.b],n.array[s+2]=n.value[x.c]):n.boundTo==="faces"?(X=n.value[X],n.array[s]=X,n.array[s+1]=X,n.array[s+2]=X,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[X],n.array[s+1]=n.value[X+1],n.array[s+2]=n.value[X+2],n.offsetSrc+=3),n.offset+=
-3):(n.boundTo===void 0||n.boundTo==="vertices"?(I=n.value[x.a],N=n.value[x.b],O=n.value[x.c]):n.boundTo==="faces"?(O=N=I=X=n.value[X],n.offsetSrc++):n.boundTo==="faceVertices"&&(I=n.value[X],N=n.value[X+1],O=n.value[X+2],n.offsetSrc+=3),n.size===2?(n.array[s]=I.x,n.array[s+1]=I.y,n.array[s+2]=N.x,n.array[s+3]=N.y,n.array[s+4]=O.x,n.array[s+5]=O.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[s]=I.r,n.array[s+1]=I.g,n.array[s+2]=I.b,n.array[s+3]=N.r,n.array[s+4]=N.g,n.array[s+5]=N.b,n.array[s+6]=
-O.r,n.array[s+7]=O.g,n.array[s+8]=O.b):(n.array[s]=I.x,n.array[s+1]=I.y,n.array[s+2]=I.z,n.array[s+3]=N.x,n.array[s+4]=N.y,n.array[s+5]=N.z,n.array[s+6]=O.x,n.array[s+7]=O.y,n.array[s+8]=O.z),n.offset+=9):(n.array[s]=I.x,n.array[s+1]=I.y,n.array[s+2]=I.z,n.array[s+3]=I.w,n.array[s+4]=N.x,n.array[s+5]=N.y,n.array[s+6]=N.z,n.array[s+7]=N.w,n.array[s+8]=O.x,n.array[s+9]=O.y,n.array[s+10]=O.z,n.array[s+11]=O.w,n.offset+=12))}if(Ea){v=0;for(D=Ga.length;v<D;v++)I=Ga[v].vertices[x.a].position,N=Ga[v].vertices[x.b].position,
-O=Ga[v].vertices[x.c].position,s=pa[v],s[oa]=I.x,s[oa+1]=I.y,s[oa+2]=I.z,s[oa+3]=N.x,s[oa+4]=N.y,s[oa+5]=N.z,s[oa+6]=O.x,s[oa+7]=O.y,s[oa+8]=O.z;oa+=9}if(Ja.length)v=Ja[x.a],D=Ja[x.b],s=Ja[x.c],ha[w]=v.x,ha[w+1]=v.y,ha[w+2]=v.z,ha[w+3]=v.w,ha[w+4]=D.x,ha[w+5]=D.y,ha[w+6]=D.z,ha[w+7]=D.w,ha[w+8]=s.x,ha[w+9]=s.y,ha[w+10]=s.z,ha[w+11]=s.w,v=Na[x.a],D=Na[x.b],s=Na[x.c],ga[w]=v.x,ga[w+1]=v.y,ga[w+2]=v.z,ga[w+3]=v.w,ga[w+4]=D.x,ga[w+5]=D.y,ga[w+6]=D.z,ga[w+7]=D.w,ga[w+8]=s.x,ga[w+9]=s.y,ga[w+10]=s.z,ga[w+
-11]=s.w,v=La[x.a],D=La[x.b],s=La[x.c],ea[w]=v.x,ea[w+1]=v.y,ea[w+2]=v.z,ea[w+3]=1,ea[w+4]=D.x,ea[w+5]=D.y,ea[w+6]=D.z,ea[w+7]=1,ea[w+8]=s.x,ea[w+9]=s.y,ea[w+10]=s.z,ea[w+11]=1,v=Ma[x.a],D=Ma[x.b],s=Ma[x.c],fa[w]=v.x,fa[w+1]=v.y,fa[w+2]=v.z,fa[w+3]=1,fa[w+4]=D.x,fa[w+5]=D.y,fa[w+6]=D.z,fa[w+7]=1,fa[w+8]=s.x,fa[w+9]=s.y,fa[w+10]=s.z,fa[w+11]=1,w+=12;if(Da&&y)C.length===3&&y===THREE.VertexColors?(x=C[0],v=C[1],D=C[2]):D=v=x=H,ra[ma]=x.r,ra[ma+1]=x.g,ra[ma+2]=x.b,ra[ma+3]=v.r,ra[ma+4]=v.g,ra[ma+5]=v.b,
-ra[ma+6]=D.r,ra[ma+7]=D.g,ra[ma+8]=D.b,ma+=9;if(Ca&&ta.hasTangents)C=M[0],H=M[1],x=M[2],da[ca]=C.x,da[ca+1]=C.y,da[ca+2]=C.z,da[ca+3]=C.w,da[ca+4]=H.x,da[ca+5]=H.y,da[ca+6]=H.z,da[ca+7]=H.w,da[ca+8]=x.x,da[ca+9]=x.y,da[ca+10]=x.z,da[ca+11]=x.w,ca+=12;if(Aa&&A)if(B.length===3&&xa)for(v=0;v<3;v++)F=B[v],T[Q]=F.x,T[Q+1]=F.y,T[Q+2]=F.z,Q+=3;else for(v=0;v<3;v++)T[Q]=F.x,T[Q+1]=F.y,T[Q+2]=F.z,Q+=3;if(ua&&z!==void 0&&q)for(v=0;v<3;v++)B=z[v],ia[Y]=B.u,ia[Y+1]=B.v,Y+=2;if(ua&&V!==void 0&&q)for(v=0;v<3;v++)B=
-V[v],ja[Z]=B.u,ja[Z+1]=B.v,Z+=2;ya&&(ka[S]=la,ka[S+1]=la+1,ka[S+2]=la+2,S+=3,$[R]=la,$[R+1]=la+1,$[R+2]=la,$[R+3]=la+2,$[R+4]=la+1,$[R+5]=la+2,R+=6,la+=3)}else if(x instanceof THREE.Face4){if(va)I=za[x.a].position,N=za[x.b].position,O=za[x.c].position,J=za[x.d].position,qa[K]=I.x,qa[K+1]=I.y,qa[K+2]=I.z,qa[K+3]=N.x,qa[K+4]=N.y,qa[K+5]=N.z,qa[K+6]=O.x,qa[K+7]=O.y,qa[K+8]=O.z,qa[K+9]=J.x,qa[K+10]=J.y,qa[K+11]=J.z,K+=12;if(W){v=0;for(D=W.length;v<D;v++)if(n=W[v],n.__original.needsUpdate)s=n.offset,X=
-n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[x.a],n.array[s+1]=n.value[x.b],n.array[s+2]=n.value[x.c],n.array[s+3]=n.value[x.d]):n.boundTo==="faces"?(X=n.value[X],n.array[s]=X,n.array[s+1]=X,n.array[s+2]=X,n.array[s+3]=X,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[X],n.array[s+1]=n.value[X+1],n.array[s+2]=n.value[X+2],n.array[s+3]=n.value[X+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(I=n.value[x.a],N=n.value[x.b],
-O=n.value[x.c],J=n.value[x.d]):n.boundTo==="faces"?(J=O=N=I=X=n.value[X],n.offsetSrc++):n.boundTo==="faceVertices"&&(I=n.value[X],N=n.value[X+1],O=n.value[X+2],J=n.value[X+3],n.offsetSrc+=4),n.size===2?(n.array[s]=I.x,n.array[s+1]=I.y,n.array[s+2]=N.x,n.array[s+3]=N.y,n.array[s+4]=O.x,n.array[s+5]=O.y,n.array[s+6]=J.x,n.array[s+7]=J.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[s]=I.r,n.array[s+1]=I.g,n.array[s+2]=I.b,n.array[s+3]=N.r,n.array[s+4]=N.g,n.array[s+5]=N.b,n.array[s+6]=O.r,n.array[s+
-7]=O.g,n.array[s+8]=O.b,n.array[s+9]=J.r,n.array[s+10]=J.g,n.array[s+11]=J.b):(n.array[s]=I.x,n.array[s+1]=I.y,n.array[s+2]=I.z,n.array[s+3]=N.x,n.array[s+4]=N.y,n.array[s+5]=N.z,n.array[s+6]=O.x,n.array[s+7]=O.y,n.array[s+8]=O.z,n.array[s+9]=J.x,n.array[s+10]=J.y,n.array[s+11]=J.z),n.offset+=12):(n.array[s]=I.x,n.array[s+1]=I.y,n.array[s+2]=I.z,n.array[s+3]=I.w,n.array[s+4]=N.x,n.array[s+5]=N.y,n.array[s+6]=N.z,n.array[s+7]=N.w,n.array[s+8]=O.x,n.array[s+9]=O.y,n.array[s+10]=O.z,n.array[s+11]=O.w,
-n.array[s+12]=J.x,n.array[s+13]=J.y,n.array[s+14]=J.z,n.array[s+15]=J.w,n.offset+=16))}if(Ea){v=0;for(D=Ga.length;v<D;v++)I=Ga[v].vertices[x.a].position,N=Ga[v].vertices[x.b].position,O=Ga[v].vertices[x.c].position,J=Ga[v].vertices[x.d].position,s=pa[v],s[oa]=I.x,s[oa+1]=I.y,s[oa+2]=I.z,s[oa+3]=N.x,s[oa+4]=N.y,s[oa+5]=N.z,s[oa+6]=O.x,s[oa+7]=O.y,s[oa+8]=O.z,s[oa+9]=J.x,s[oa+10]=J.y,s[oa+11]=J.z;oa+=12}if(Ja.length)v=Ja[x.a],D=Ja[x.b],s=Ja[x.c],n=Ja[x.d],ha[w]=v.x,ha[w+1]=v.y,ha[w+2]=v.z,ha[w+3]=v.w,
-ha[w+4]=D.x,ha[w+5]=D.y,ha[w+6]=D.z,ha[w+7]=D.w,ha[w+8]=s.x,ha[w+9]=s.y,ha[w+10]=s.z,ha[w+11]=s.w,ha[w+12]=n.x,ha[w+13]=n.y,ha[w+14]=n.z,ha[w+15]=n.w,v=Na[x.a],D=Na[x.b],s=Na[x.c],n=Na[x.d],ga[w]=v.x,ga[w+1]=v.y,ga[w+2]=v.z,ga[w+3]=v.w,ga[w+4]=D.x,ga[w+5]=D.y,ga[w+6]=D.z,ga[w+7]=D.w,ga[w+8]=s.x,ga[w+9]=s.y,ga[w+10]=s.z,ga[w+11]=s.w,ga[w+12]=n.x,ga[w+13]=n.y,ga[w+14]=n.z,ga[w+15]=n.w,v=La[x.a],D=La[x.b],s=La[x.c],n=La[x.d],ea[w]=v.x,ea[w+1]=v.y,ea[w+2]=v.z,ea[w+3]=1,ea[w+4]=D.x,ea[w+5]=D.y,ea[w+6]=
-D.z,ea[w+7]=1,ea[w+8]=s.x,ea[w+9]=s.y,ea[w+10]=s.z,ea[w+11]=1,ea[w+12]=n.x,ea[w+13]=n.y,ea[w+14]=n.z,ea[w+15]=1,v=Ma[x.a],D=Ma[x.b],s=Ma[x.c],x=Ma[x.d],fa[w]=v.x,fa[w+1]=v.y,fa[w+2]=v.z,fa[w+3]=1,fa[w+4]=D.x,fa[w+5]=D.y,fa[w+6]=D.z,fa[w+7]=1,fa[w+8]=s.x,fa[w+9]=s.y,fa[w+10]=s.z,fa[w+11]=1,fa[w+12]=x.x,fa[w+13]=x.y,fa[w+14]=x.z,fa[w+15]=1,w+=16;if(Da&&y)C.length===4&&y===THREE.VertexColors?(x=C[0],v=C[1],D=C[2],C=C[3]):C=D=v=x=H,ra[ma]=x.r,ra[ma+1]=x.g,ra[ma+2]=x.b,ra[ma+3]=v.r,ra[ma+4]=v.g,ra[ma+
-5]=v.b,ra[ma+6]=D.r,ra[ma+7]=D.g,ra[ma+8]=D.b,ra[ma+9]=C.r,ra[ma+10]=C.g,ra[ma+11]=C.b,ma+=12;if(Ca&&ta.hasTangents)C=M[0],H=M[1],x=M[2],M=M[3],da[ca]=C.x,da[ca+1]=C.y,da[ca+2]=C.z,da[ca+3]=C.w,da[ca+4]=H.x,da[ca+5]=H.y,da[ca+6]=H.z,da[ca+7]=H.w,da[ca+8]=x.x,da[ca+9]=x.y,da[ca+10]=x.z,da[ca+11]=x.w,da[ca+12]=M.x,da[ca+13]=M.y,da[ca+14]=M.z,da[ca+15]=M.w,ca+=16;if(Aa&&A)if(B.length===4&&xa)for(v=0;v<4;v++)F=B[v],T[Q]=F.x,T[Q+1]=F.y,T[Q+2]=F.z,Q+=3;else for(v=0;v<4;v++)T[Q]=F.x,T[Q+1]=F.y,T[Q+2]=F.z,
-Q+=3;if(ua&&z!==void 0&&q)for(v=0;v<4;v++)B=z[v],ia[Y]=B.u,ia[Y+1]=B.v,Y+=2;if(ua&&V!==void 0&&q)for(v=0;v<4;v++)B=V[v],ja[Z]=B.u,ja[Z+1]=B.v,Z+=2;ya&&(ka[S]=la,ka[S+1]=la+1,ka[S+2]=la+3,ka[S+3]=la+1,ka[S+4]=la+2,ka[S+5]=la+3,S+=6,$[R]=la,$[R+1]=la+1,$[R+2]=la,$[R+3]=la+3,$[R+4]=la+1,$[R+5]=la+2,$[R+6]=la+2,$[R+7]=la+3,R+=8,la+=4)}va&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,qa,l));if(W){v=0;for(D=W.length;v<D;v++)n=W[v],n.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,
-n.buffer),d.bufferData(d.ARRAY_BUFFER,n.array,l))}if(Ea){v=0;for(D=Ga.length;v<D;v++)d.bindBuffer(d.ARRAY_BUFFER,r.__webglMorphTargetsBuffers[v]),d.bufferData(d.ARRAY_BUFFER,pa[v],l)}Da&&ma>0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,ra,l));Aa&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,T,l));Ca&&ta.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,da,l));ua&&Y>0&&(d.bindBuffer(d.ARRAY_BUFFER,
-r.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ia,l));ua&&Z>0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,ja,l));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ka,l),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,r.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,$,l));w>0&&(d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,ea,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinVertexBBuffer),
-d.bufferData(d.ARRAY_BUFFER,fa,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,ga,l),d.bindBuffer(d.ARRAY_BUFFER,r.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ha,l));o&&(delete r.__inittedArrays,delete r.__colorArray,delete r.__normalArray,delete r.__tangentArray,delete r.__uvArray,delete r.__uv2Array,delete r.__faceArray,delete r.__vertexArray,delete r.__lineArray,delete r.__skinVertexAArray,delete r.__skinVertexBArray,delete r.__skinIndexArray,delete r.__skinWeightArray)}h.__dirtyVertices=
-!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyColors=!1;h.__dirtyTangents=!1;j.attributes&&na(j)}else if(i instanceof THREE.Ribbon){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=p=o=o=void 0;t=i.vertices;m=i.colors;q=t.length;r=m.length;y=i.__vertexArray;l=i.__colorArray;A=i.__dirtyColors;if(i.__dirtyVertices){for(o=0;o<q;o++)p=t[o].position,k=o*3,y[k]=p.x,y[k+1]=p.y,y[k+2]=p.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
-y,j)}if(A){for(o=0;o<r;o++)color=m[o],k=o*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.Line){if(h.__dirtyVertices||h.__dirtyColors){i=h;j=d.DYNAMIC_DRAW;k=p=o=o=void 0;t=i.vertices;m=i.colors;q=t.length;r=m.length;y=i.__vertexArray;l=i.__colorArray;A=i.__dirtyColors;if(i.__dirtyVertices){for(o=0;o<q;o++)p=t[o].position,k=o*3,y[k]=p.x,y[k+1]=p.y,y[k+
-2]=p.z;d.bindBuffer(d.ARRAY_BUFFER,i.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,y,j)}if(A){for(o=0;o<r;o++)color=m[o],k=o*3,l[k]=color.r,l[k+1]=color.g,l[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,i.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,l,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem)j=b(i,r),l=j.attributes&&aa(j),(h.__dirtyVertices||h.__dirtyColors||i.sortParticles||l)&&c(h,d.DYNAMIC_DRAW,i),h.__dirtyVertices=!1,h.__dirtyColors=!1,j.attributes&&
-na(j)};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return bb}};
+i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",G.gammaInput?"#define GAMMA_INPUT":"",G.gammaOutput?"#define GAMMA_OUTPUT":"",G.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");d.attachShader(t,da("fragment",i+q));d.attachShader(t,
+da("vertex",e+l));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in k)e.push(u);u=e;e=0;for(k=u.length;e<k;e++)q=u[e],t.uniforms[q]=d.getUniformLocation(t,
+q);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<c.maxMorphTargets;u++)e.push("morphTarget"+u);for(m in b)e.push(m);m=e;u=0;for(b=m.length;u<b;u++)c=m[u],t.attributes[c]=d.getAttribLocation(t,c);t.id=Ea.length;Ea.push({program:t,code:j});G.info.memory.programs=Ea.length;m=t}a.program=m;m=a.program.attributes;m.position>=0&&d.enableVertexAttribArray(m.position);m.color>=0&&d.enableVertexAttribArray(m.color);m.normal>=0&&d.enableVertexAttribArray(m.normal);
+m.tangent>=0&&d.enableVertexAttribArray(m.tangent);a.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0&&(d.enableVertexAttribArray(m.skinVertexA),d.enableVertexAttribArray(m.skinVertexB),d.enableVertexAttribArray(m.skinIndex),d.enableVertexAttribArray(m.skinWeight));if(a.attributes)for(h in a.attributes)m[h]!==void 0&&m[h]>=0&&d.enableVertexAttribArray(m[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)u="morphTarget"+h,m[u]>=0&&(d.enableVertexAttribArray(m[u]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){J(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){C(a,b)};this.render=function(a,b,c,e){var t,Q,Ra,p,v,q,Na,L=a.lights,Oa=a.fog;Z=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&C(a,b);G.info.render.calls=0;G.info.render.vertices=0;G.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
+a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(Va);b.projectionMatrix.flattenToArray(Ua);Aa.multiply(b.projectionMatrix,b.matrixWorldInverse);s(Aa);J(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ra=a.__webglObjects.length;for(e=0;e<Ra;e++)if(v=a.__webglObjects[e],q=v.object,q.visible)if(!(q instanceof THREE.Mesh)||!q.frustumCulled||m(q)){if(q.matrixWorld.flattenToArray(q._objectMatrixArray),
+P(q,b,!0),z(v),v.render=!0,this.sortObjects)q.renderDepth?v.z=q.renderDepth:(Ga.copy(q.position),Aa.multiplyVector3(Ga),v.z=Ga.z)}else v.render=!1;else v.render=!1;this.sortObjects&&a.__webglObjects.sort(A);p=a.__webglObjectsImmediate.length;for(e=0;e<p;e++)v=a.__webglObjectsImmediate[e],q=v.object,q.visible&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),P(q,b,!0),u(v));if(a.overrideMaterial){o(a.overrideMaterial.depthTest);B(a.overrideMaterial.blending);for(e=0;e<Ra;e++)if(v=
+a.__webglObjects[e],v.render)q=v.object,Na=v.buffer,j(q),f(b,L,Oa,a.overrideMaterial,Na,q);for(e=0;e<p;e++)v=a.__webglObjectsImmediate[e],q=v.object,q.visible&&(D=-1,j(q),t=h(b,L,Oa,a.overrideMaterial,q),q.immediateRenderCallback?q.immediateRenderCallback(t,d,ja):q.render(function(b){i(b,t,a.overrideMaterial.shading)}))}else{B(THREE.NormalBlending);for(e=Ra-1;e>=0;e--)if(v=a.__webglObjects[e],v.render&&(q=v.object,Na=v.buffer,Q=v.opaque))j(q),o(Q.depthTest),l(Q.depthWrite),k(Q.polygonOffset,Q.polygonOffsetFactor,
+Q.polygonOffsetUnits),f(b,L,Oa,Q,Na,q);for(e=0;e<p;e++)if(v=a.__webglObjectsImmediate[e],q=v.object,q.visible&&(D=-1,Q=v.opaque))j(q),o(Q.depthTest),l(Q.depthWrite),k(Q.polygonOffset,Q.polygonOffsetFactor,Q.polygonOffsetUnits),t=h(b,L,Oa,Q,q),q.immediateRenderCallback?q.immediateRenderCallback(t,d,ja):q.render(function(a){i(a,t,Q.shading)});for(e=0;e<Ra;e++)if(v=a.__webglObjects[e],v.render&&(q=v.object,Na=v.buffer,Q=v.transparent))j(q),B(Q.blending),o(Q.depthTest),l(Q.depthWrite),k(Q.polygonOffset,
+Q.polygonOffsetFactor,Q.polygonOffsetUnits),f(b,L,Oa,Q,Na,q);for(e=0;e<p;e++)if(v=a.__webglObjectsImmediate[e],q=v.object,q.visible&&(D=-1,Q=v.transparent))j(q),B(Q.blending),o(Q.depthTest),l(Q.depthWrite),k(Q.polygonOffset,Q.polygonOffsetFactor,Q.polygonOffsetUnits),t=h(b,L,Oa,Q,q),q.immediateRenderCallback?q.immediateRenderCallback(t,d,ja):q.render(function(a){i(a,t,Q.shading)})}a.__webglSprites.length&&na(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&U(c)};this.initWebGLObjects=
+function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var f=a.__objectsAdded[0],h=a,i=void 0,j=void 0,k=void 0;if(!f.__webglInit)if(f.__webglInit=!0,f._modelViewMatrix=new THREE.Matrix4,f._normalMatrixArray=new Float32Array(9),f._modelViewMatrixArray=new Float32Array(16),f._objectMatrixArray=new Float32Array(16),f.matrixWorld.flattenToArray(f._objectMatrixArray),f instanceof THREE.Mesh){j=f.geometry;if(j.geometryGroups===
+void 0){var k=j,l=void 0,p=void 0,o=void 0,q=void 0,m=o=void 0,s=void 0,t={},u=k.morphTargets.length;k.geometryGroups={};l=0;for(p=k.faces.length;l<p;l++)o=k.faces[l],q=o.materialIndex,m=q!==void 0?q:-1,t[m]===void 0&&(t[m]={hash:m,counter:0}),s=t[m].hash+"_"+t[m].counter,k.geometryGroups[s]===void 0&&(k.geometryGroups[s]={faces:[],materialIndex:q,vertices:0,numMorphTargets:u}),o=o instanceof THREE.Face3?3:4,k.geometryGroups[s].vertices+o>65535&&(t[m].counter+=1,s=t[m].hash+"_"+t[m].counter,k.geometryGroups[s]===
+void 0&&(k.geometryGroups[s]={faces:[],materialIndex:q,vertices:0,numMorphTargets:u})),k.geometryGroups[s].faces.push(l),k.geometryGroups[s].vertices+=o;k.geometryGroupsList=[];l=void 0;for(l in k.geometryGroups)k.geometryGroups[l].id=ta++,k.geometryGroupsList.push(k.geometryGroups[l])}for(i in j.geometryGroups)if(k=j.geometryGroups[i],!k.__webglVertexBuffer){l=k;l.__webglVertexBuffer=d.createBuffer();l.__webglNormalBuffer=d.createBuffer();l.__webglTangentBuffer=d.createBuffer();l.__webglColorBuffer=
+d.createBuffer();l.__webglUVBuffer=d.createBuffer();l.__webglUV2Buffer=d.createBuffer();l.__webglSkinVertexABuffer=d.createBuffer();l.__webglSkinVertexBBuffer=d.createBuffer();l.__webglSkinIndicesBuffer=d.createBuffer();l.__webglSkinWeightsBuffer=d.createBuffer();l.__webglFaceBuffer=d.createBuffer();l.__webglLineBuffer=d.createBuffer();if(l.numMorphTargets){q=p=void 0;l.__webglMorphTargetsBuffers=[];p=0;for(q=l.numMorphTargets;p<q;p++)l.__webglMorphTargetsBuffers.push(d.createBuffer())}G.info.memory.geometries++;
+for(var q=f,z=o=t=void 0,m=z=u=z=void 0,s=m=l=0,A=o=void 0,C=void 0,o=p=u=t=void 0,u=q.geometry,A=u.faces,C=k.faces,t=0,o=C.length;t<o;t++)z=C[t],z=A[z],z instanceof THREE.Face3?(l+=3,m+=1,s+=3):z instanceof THREE.Face4&&(l+=4,m+=2,s+=4);t=c(q,k);o=t.map||t.lightMap||t instanceof THREE.ShaderMaterial?!0:!1;C=t instanceof THREE.MeshBasicMaterial&&!t.envMap||t instanceof THREE.MeshDepthMaterial?!1:t&&t.shading!==void 0&&t.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;A=t.vertexColors?
+t.vertexColors:!1;k.__vertexArray=new Float32Array(l*3);if(C)k.__normalArray=new Float32Array(l*3);if(u.hasTangents)k.__tangentArray=new Float32Array(l*4);if(A)k.__colorArray=new Float32Array(l*3);if(o){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)k.__uvArray=new Float32Array(l*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(l*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(l*4),k.__skinVertexBArray=new Float32Array(l*
+4),k.__skinIndexArray=new Float32Array(l*4),k.__skinWeightArray=new Float32Array(l*4);k.__faceArray=new Uint16Array(m*3);k.__lineArray=new Uint16Array(s*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];u=0;for(z=k.numMorphTargets;u<z;u++)k.__morphTargetsArrays.push(new Float32Array(l*3))}k.__needsSmoothNormals=C===THREE.SmoothShading;k.__uvType=o;k.__vertexColorType=A;k.__normalType=C;k.__webglFaceCount=m*3;k.__webglLineCount=s*2;if(t.attributes){if(k.__webglCustomAttributesList===void 0)k.__webglCustomAttributesList=
+[];q=void 0;for(q in t.attributes){o=t.attributes[q];u={};for(p in o)u[p]=o[p];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,m=1,u.type==="v2"?m=2:u.type==="v3"?m=3:u.type==="v4"?m=4:u.type==="c"&&(m=3),u.size=m,u.array=new Float32Array(l*m),u.buffer=d.createBuffer(),u.buffer.belongsToAttribute=q,o.needsUpdate=!0,u.__original=o;k.__webglCustomAttributesList.push(u)}}k.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=
+!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}}else if(f instanceof THREE.Ribbon){if(j=f.geometry,!j.__webglVertexBuffer)k=j,k.__webglVertexBuffer=d.createBuffer(),k.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,k=j,l=k.vertices.length,k.__vertexArray=new Float32Array(l*3),k.__colorArray=new Float32Array(l*3),k.__webglVertexCount=l,j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(f instanceof THREE.Line){if(j=f.geometry,!j.__webglVertexBuffer)k=j,k.__webglVertexBuffer=d.createBuffer(),
+k.__webglColorBuffer=d.createBuffer(),G.info.memory.geometries++,k=j,l=f,p=k.vertices.length,k.__vertexArray=new Float32Array(p*3),k.__colorArray=new Float32Array(p*3),k.__webglLineCount=p,b(k,l),j.__dirtyVertices=!0,j.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(j=f.geometry,!j.__webglVertexBuffer))k=j,k.__webglVertexBuffer=d.createBuffer(),k.__webglColorBuffer=d.createBuffer(),G.info.geometries++,k=j,l=f,p=k.vertices.length,k.__vertexArray=new Float32Array(p*3),k.__colorArray=new Float32Array(p*
+3),k.__sortArray=[],k.__webglParticleCount=p,b(k,l),j.__dirtyVertices=!0,j.__dirtyColors=!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(i in j=f.geometry,j.geometryGroups)k=j.geometryGroups[i],W(h.__webglObjects,k,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(j=f.geometry,W(h.__webglObjects,j,f)):THREE.MarchingCubes!==void 0&&f instanceof THREE.MarchingCubes||f.immediateRenderCallback?h.__webglObjectsImmediate.push({object:f,opaque:null,transparent:null}):
+f instanceof THREE.Sprite&&h.__webglSprites.push(f);f.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){f=a.__objectsRemoved[0];h=a;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)L(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;i=f;for(j=h.length-1;j>=0;j--)h[j]===i&&h.splice(j,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&L(h.__webglObjectsImmediate,f);
+f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(k=a.__webglObjects[f].object,i=k.geometry,j=m=q=void 0,k instanceof THREE.Mesh){l=0;for(p=i.geometryGroupsList.length;l<p;l++)if(q=i.geometryGroupsList[l],j=c(k,q),m=j.attributes&&ka(j),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||m)if(m=d.DYNAMIC_DRAW,s=!i.dynamic,q.__inittedArrays){var B=u=t=void 0,y=void 0,I=B=void 0,
+D=void 0,M=void 0,P=void 0,S=z=C=A=o=void 0,H=void 0,O=void 0,F=void 0,K=void 0,w=y=P=y=M=D=void 0,E=void 0,r=E=w=D=void 0,n=void 0,r=E=w=B=B=I=E=w=y=r=E=w=n=r=E=w=n=r=E=w=void 0,J=0,N=0,Y=0,$=0,V=0,T=0,ca=0,U=0,ma=0,x=0,oa=0,X=r=0,X=void 0,pa=q.__vertexArray,la=q.__uvArray,na=q.__uv2Array,Z=q.__normalArray,ea=q.__tangentArray,qa=q.__colorArray,fa=q.__skinVertexAArray,ga=q.__skinVertexBArray,ha=q.__skinIndexArray,ia=q.__skinWeightArray,sa=q.__morphTargetsArrays,da=q.__webglCustomAttributesList,n=
+void 0,ja=q.__faceArray,aa=q.__lineArray,va=q.__needsSmoothNormals,A=q.__vertexColorType,o=q.__uvType,C=q.__normalType,ua=k.geometry,xa=ua.__dirtyVertices,ya=ua.__dirtyElements,wa=ua.__dirtyUvs,za=ua.__dirtyNormals,Aa=ua.__dirtyTangents,Ba=ua.__dirtyColors,Ca=ua.__dirtyMorphTargets,Ja=ua.vertices,Ea=q.faces,Ia=ua.faces,Fa=ua.faceVertexUvs[0],Ga=ua.faceVertexUvs[1],Ka=ua.skinVerticesA,La=ua.skinVerticesB,Ma=ua.skinIndices,Ha=ua.skinWeights,Da=ua.morphTargets;if(da){w=0;for(E=da.length;w<E;w++)da[w].offset=
+0,da[w].offsetSrc=0}t=0;for(u=Ea.length;t<u;t++)if(B=Ea[t],y=Ia[B],Fa&&(z=Fa[B]),Ga&&(S=Ga[B]),B=y.vertexNormals,I=y.normal,D=y.vertexColors,M=y.color,P=y.vertexTangents,y instanceof THREE.Face3){if(xa)H=Ja[y.a].position,O=Ja[y.b].position,F=Ja[y.c].position,pa[N]=H.x,pa[N+1]=H.y,pa[N+2]=H.z,pa[N+3]=O.x,pa[N+4]=O.y,pa[N+5]=O.z,pa[N+6]=F.x,pa[N+7]=F.y,pa[N+8]=F.z,N+=9;if(da){w=0;for(E=da.length;w<E;w++)if(n=da[w],n.__original.needsUpdate)r=n.offset,X=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo===
+"vertices"?(n.array[r]=n.value[y.a],n.array[r+1]=n.value[y.b],n.array[r+2]=n.value[y.c]):n.boundTo==="faces"?(X=n.value[X],n.array[r]=X,n.array[r+1]=X,n.array[r+2]=X,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[r]=n.value[X],n.array[r+1]=n.value[X+1],n.array[r+2]=n.value[X+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(H=n.value[y.a],O=n.value[y.b],F=n.value[y.c]):n.boundTo==="faces"?(F=O=H=X=n.value[X],n.offsetSrc++):n.boundTo==="faceVertices"&&(H=n.value[X],
+O=n.value[X+1],F=n.value[X+2],n.offsetSrc+=3),n.size===2?(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=O.x,n.array[r+3]=O.y,n.array[r+4]=F.x,n.array[r+5]=F.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[r]=H.r,n.array[r+1]=H.g,n.array[r+2]=H.b,n.array[r+3]=O.r,n.array[r+4]=O.g,n.array[r+5]=O.b,n.array[r+6]=F.r,n.array[r+7]=F.g,n.array[r+8]=F.b):(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=H.z,n.array[r+3]=O.x,n.array[r+4]=O.y,n.array[r+5]=O.z,n.array[r+6]=F.x,n.array[r+7]=F.y,n.array[r+8]=F.z),
+n.offset+=9):(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=H.z,n.array[r+3]=H.w,n.array[r+4]=O.x,n.array[r+5]=O.y,n.array[r+6]=O.z,n.array[r+7]=O.w,n.array[r+8]=F.x,n.array[r+9]=F.y,n.array[r+10]=F.z,n.array[r+11]=F.w,n.offset+=12))}if(Ca){w=0;for(E=Da.length;w<E;w++)H=Da[w].vertices[y.a].position,O=Da[w].vertices[y.b].position,F=Da[w].vertices[y.c].position,r=sa[w],r[oa]=H.x,r[oa+1]=H.y,r[oa+2]=H.z,r[oa+3]=O.x,r[oa+4]=O.y,r[oa+5]=O.z,r[oa+6]=F.x,r[oa+7]=F.y,r[oa+8]=F.z;oa+=9}if(Ha.length)w=Ha[y.a],
+E=Ha[y.b],r=Ha[y.c],ia[x]=w.x,ia[x+1]=w.y,ia[x+2]=w.z,ia[x+3]=w.w,ia[x+4]=E.x,ia[x+5]=E.y,ia[x+6]=E.z,ia[x+7]=E.w,ia[x+8]=r.x,ia[x+9]=r.y,ia[x+10]=r.z,ia[x+11]=r.w,w=Ma[y.a],E=Ma[y.b],r=Ma[y.c],ha[x]=w.x,ha[x+1]=w.y,ha[x+2]=w.z,ha[x+3]=w.w,ha[x+4]=E.x,ha[x+5]=E.y,ha[x+6]=E.z,ha[x+7]=E.w,ha[x+8]=r.x,ha[x+9]=r.y,ha[x+10]=r.z,ha[x+11]=r.w,w=Ka[y.a],E=Ka[y.b],r=Ka[y.c],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=1,fa[x+4]=E.x,fa[x+5]=E.y,fa[x+6]=E.z,fa[x+7]=1,fa[x+8]=r.x,fa[x+9]=r.y,fa[x+10]=r.z,fa[x+11]=
+1,w=La[y.a],E=La[y.b],r=La[y.c],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=w.z,ga[x+3]=1,ga[x+4]=E.x,ga[x+5]=E.y,ga[x+6]=E.z,ga[x+7]=1,ga[x+8]=r.x,ga[x+9]=r.y,ga[x+10]=r.z,ga[x+11]=1,x+=12;if(Ba&&A)D.length===3&&A===THREE.VertexColors?(y=D[0],w=D[1],E=D[2]):E=w=y=M,qa[ma]=y.r,qa[ma+1]=y.g,qa[ma+2]=y.b,qa[ma+3]=w.r,qa[ma+4]=w.g,qa[ma+5]=w.b,qa[ma+6]=E.r,qa[ma+7]=E.g,qa[ma+8]=E.b,ma+=9;if(Aa&&ua.hasTangents)D=P[0],M=P[1],y=P[2],ea[ca]=D.x,ea[ca+1]=D.y,ea[ca+2]=D.z,ea[ca+3]=D.w,ea[ca+4]=M.x,ea[ca+5]=M.y,ea[ca+6]=
+M.z,ea[ca+7]=M.w,ea[ca+8]=y.x,ea[ca+9]=y.y,ea[ca+10]=y.z,ea[ca+11]=y.w,ca+=12;if(za&&C)if(B.length===3&&va)for(w=0;w<3;w++)I=B[w],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;else for(w=0;w<3;w++)Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;if(wa&&z!==void 0&&o)for(w=0;w<3;w++)B=z[w],la[Y]=B.u,la[Y+1]=B.v,Y+=2;if(wa&&S!==void 0&&o)for(w=0;w<3;w++)B=S[w],na[$]=B.u,na[$+1]=B.v,$+=2;ya&&(ja[V]=J,ja[V+1]=J+1,ja[V+2]=J+2,V+=3,aa[U]=J,aa[U+1]=J+1,aa[U+2]=J,aa[U+3]=J+2,aa[U+4]=J+1,aa[U+5]=J+2,U+=6,J+=3)}else if(y instanceof
+THREE.Face4){if(xa)H=Ja[y.a].position,O=Ja[y.b].position,F=Ja[y.c].position,K=Ja[y.d].position,pa[N]=H.x,pa[N+1]=H.y,pa[N+2]=H.z,pa[N+3]=O.x,pa[N+4]=O.y,pa[N+5]=O.z,pa[N+6]=F.x,pa[N+7]=F.y,pa[N+8]=F.z,pa[N+9]=K.x,pa[N+10]=K.y,pa[N+11]=K.z,N+=12;if(da){w=0;for(E=da.length;w<E;w++)if(n=da[w],n.__original.needsUpdate)r=n.offset,X=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[r]=n.value[y.a],n.array[r+1]=n.value[y.b],n.array[r+2]=n.value[y.c],n.array[r+3]=n.value[y.d]):n.boundTo===
+"faces"?(X=n.value[X],n.array[r]=X,n.array[r+1]=X,n.array[r+2]=X,n.array[r+3]=X,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[r]=n.value[X],n.array[r+1]=n.value[X+1],n.array[r+2]=n.value[X+2],n.array[r+3]=n.value[X+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(H=n.value[y.a],O=n.value[y.b],F=n.value[y.c],K=n.value[y.d]):n.boundTo==="faces"?(K=F=O=H=X=n.value[X],n.offsetSrc++):n.boundTo==="faceVertices"&&(H=n.value[X],O=n.value[X+1],F=n.value[X+2],K=n.value[X+3],
+n.offsetSrc+=4),n.size===2?(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=O.x,n.array[r+3]=O.y,n.array[r+4]=F.x,n.array[r+5]=F.y,n.array[r+6]=K.x,n.array[r+7]=K.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[r]=H.r,n.array[r+1]=H.g,n.array[r+2]=H.b,n.array[r+3]=O.r,n.array[r+4]=O.g,n.array[r+5]=O.b,n.array[r+6]=F.r,n.array[r+7]=F.g,n.array[r+8]=F.b,n.array[r+9]=K.r,n.array[r+10]=K.g,n.array[r+11]=K.b):(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=H.z,n.array[r+3]=O.x,n.array[r+4]=O.y,n.array[r+5]=
+O.z,n.array[r+6]=F.x,n.array[r+7]=F.y,n.array[r+8]=F.z,n.array[r+9]=K.x,n.array[r+10]=K.y,n.array[r+11]=K.z),n.offset+=12):(n.array[r]=H.x,n.array[r+1]=H.y,n.array[r+2]=H.z,n.array[r+3]=H.w,n.array[r+4]=O.x,n.array[r+5]=O.y,n.array[r+6]=O.z,n.array[r+7]=O.w,n.array[r+8]=F.x,n.array[r+9]=F.y,n.array[r+10]=F.z,n.array[r+11]=F.w,n.array[r+12]=K.x,n.array[r+13]=K.y,n.array[r+14]=K.z,n.array[r+15]=K.w,n.offset+=16))}if(Ca){w=0;for(E=Da.length;w<E;w++)H=Da[w].vertices[y.a].position,O=Da[w].vertices[y.b].position,
+F=Da[w].vertices[y.c].position,K=Da[w].vertices[y.d].position,r=sa[w],r[oa]=H.x,r[oa+1]=H.y,r[oa+2]=H.z,r[oa+3]=O.x,r[oa+4]=O.y,r[oa+5]=O.z,r[oa+6]=F.x,r[oa+7]=F.y,r[oa+8]=F.z,r[oa+9]=K.x,r[oa+10]=K.y,r[oa+11]=K.z;oa+=12}if(Ha.length)w=Ha[y.a],E=Ha[y.b],r=Ha[y.c],n=Ha[y.d],ia[x]=w.x,ia[x+1]=w.y,ia[x+2]=w.z,ia[x+3]=w.w,ia[x+4]=E.x,ia[x+5]=E.y,ia[x+6]=E.z,ia[x+7]=E.w,ia[x+8]=r.x,ia[x+9]=r.y,ia[x+10]=r.z,ia[x+11]=r.w,ia[x+12]=n.x,ia[x+13]=n.y,ia[x+14]=n.z,ia[x+15]=n.w,w=Ma[y.a],E=Ma[y.b],r=Ma[y.c],n=
+Ma[y.d],ha[x]=w.x,ha[x+1]=w.y,ha[x+2]=w.z,ha[x+3]=w.w,ha[x+4]=E.x,ha[x+5]=E.y,ha[x+6]=E.z,ha[x+7]=E.w,ha[x+8]=r.x,ha[x+9]=r.y,ha[x+10]=r.z,ha[x+11]=r.w,ha[x+12]=n.x,ha[x+13]=n.y,ha[x+14]=n.z,ha[x+15]=n.w,w=Ka[y.a],E=Ka[y.b],r=Ka[y.c],n=Ka[y.d],fa[x]=w.x,fa[x+1]=w.y,fa[x+2]=w.z,fa[x+3]=1,fa[x+4]=E.x,fa[x+5]=E.y,fa[x+6]=E.z,fa[x+7]=1,fa[x+8]=r.x,fa[x+9]=r.y,fa[x+10]=r.z,fa[x+11]=1,fa[x+12]=n.x,fa[x+13]=n.y,fa[x+14]=n.z,fa[x+15]=1,w=La[y.a],E=La[y.b],r=La[y.c],y=La[y.d],ga[x]=w.x,ga[x+1]=w.y,ga[x+2]=
+w.z,ga[x+3]=1,ga[x+4]=E.x,ga[x+5]=E.y,ga[x+6]=E.z,ga[x+7]=1,ga[x+8]=r.x,ga[x+9]=r.y,ga[x+10]=r.z,ga[x+11]=1,ga[x+12]=y.x,ga[x+13]=y.y,ga[x+14]=y.z,ga[x+15]=1,x+=16;if(Ba&&A)D.length===4&&A===THREE.VertexColors?(y=D[0],w=D[1],E=D[2],D=D[3]):D=E=w=y=M,qa[ma]=y.r,qa[ma+1]=y.g,qa[ma+2]=y.b,qa[ma+3]=w.r,qa[ma+4]=w.g,qa[ma+5]=w.b,qa[ma+6]=E.r,qa[ma+7]=E.g,qa[ma+8]=E.b,qa[ma+9]=D.r,qa[ma+10]=D.g,qa[ma+11]=D.b,ma+=12;if(Aa&&ua.hasTangents)D=P[0],M=P[1],y=P[2],P=P[3],ea[ca]=D.x,ea[ca+1]=D.y,ea[ca+2]=D.z,ea[ca+
+3]=D.w,ea[ca+4]=M.x,ea[ca+5]=M.y,ea[ca+6]=M.z,ea[ca+7]=M.w,ea[ca+8]=y.x,ea[ca+9]=y.y,ea[ca+10]=y.z,ea[ca+11]=y.w,ea[ca+12]=P.x,ea[ca+13]=P.y,ea[ca+14]=P.z,ea[ca+15]=P.w,ca+=16;if(za&&C)if(B.length===4&&va)for(w=0;w<4;w++)I=B[w],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;else for(w=0;w<4;w++)Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,T+=3;if(wa&&z!==void 0&&o)for(w=0;w<4;w++)B=z[w],la[Y]=B.u,la[Y+1]=B.v,Y+=2;if(wa&&S!==void 0&&o)for(w=0;w<4;w++)B=S[w],na[$]=B.u,na[$+1]=B.v,$+=2;ya&&(ja[V]=J,ja[V+1]=J+1,ja[V+2]=J+3,ja[V+
+3]=J+1,ja[V+4]=J+2,ja[V+5]=J+3,V+=6,aa[U]=J,aa[U+1]=J+1,aa[U+2]=J,aa[U+3]=J+3,aa[U+4]=J+1,aa[U+5]=J+2,aa[U+6]=J+2,aa[U+7]=J+3,U+=8,J+=4)}xa&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,pa,m));if(da){w=0;for(E=da.length;w<E;w++)n=da[w],n.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,n.buffer),d.bufferData(d.ARRAY_BUFFER,n.array,m))}if(Ca){w=0;for(E=Da.length;w<E;w++)d.bindBuffer(d.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[w]),d.bufferData(d.ARRAY_BUFFER,sa[w],
+m)}Ba&&ma>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,qa,m));za&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglNormalBuffer),d.bufferData(d.ARRAY_BUFFER,Z,m));Aa&&ua.hasTangents&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglTangentBuffer),d.bufferData(d.ARRAY_BUFFER,ea,m));wa&&Y>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,la,m));wa&&$>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,na,m));ya&&(d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
+q.__webglFaceBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,ja,m),d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webglLineBuffer),d.bufferData(d.ELEMENT_ARRAY_BUFFER,aa,m));x>0&&(d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,fa,m),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,ga,m),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,ha,m),d.bindBuffer(d.ARRAY_BUFFER,q.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,
+ia,m));s&&(delete q.__inittedArrays,delete q.__colorArray,delete q.__normalArray,delete q.__tangentArray,delete q.__uvArray,delete q.__uv2Array,delete q.__faceArray,delete q.__vertexArray,delete q.__lineArray,delete q.__skinVertexAArray,delete q.__skinVertexBArray,delete q.__skinIndexArray,delete q.__skinWeightArray)}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;j.attributes&&ra(j)}else if(k instanceof
+THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){j=i;k=d.DYNAMIC_DRAW;l=t=s=s=void 0;u=j.vertices;p=j.colors;o=u.length;q=p.length;A=j.__vertexArray;m=j.__colorArray;C=j.__dirtyColors;if(j.__dirtyVertices){for(s=0;s<o;s++)t=u[s].position,l=s*3,A[l]=t.x,A[l+1]=t.y,A[l+2]=t.z;d.bindBuffer(d.ARRAY_BUFFER,j.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,A,k)}if(C){for(s=0;s<q;s++)color=p[s],l=s*3,m[l]=color.r,m[l+1]=color.g,m[l+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,j.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,
+m,k)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(k instanceof THREE.Line){j=c(k,q);m=j.attributes&&ka(j);if(i.__dirtyVertices||i.__dirtyColors||m){k=i;l=d.DYNAMIC_DRAW;p=S=u=z=void 0;u=k.vertices;q=k.colors;o=u.length;m=q.length;A=k.__vertexArray;s=k.__colorArray;C=k.__dirtyColors;t=k.__webglCustomAttributesList;K=F=O=H=S=z=void 0;if(k.__dirtyVertices){for(z=0;z<o;z++)S=u[z].position,p=z*3,A[p]=S.x,A[p+1]=S.y,A[p+2]=S.z;d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,
+A,l)}if(C){for(u=0;u<m;u++)color=q[u],p=u*3,s[p]=color.r,s[p+1]=color.g,s[p+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,s,l)}if(t){z=0;for(S=t.length;z<S;z++)if(K=t[z],K.__original.needsUpdate&&(K.boundTo===void 0||K.boundTo==="vertices")){p=0;O=K.value.length;for(H=0;H<O;H++)K.size===1?K.array[p]=K.value[H]:(F=K.value[H],K.size===2?(K.array[p]=F.x,K.array[p+1]=F.y):K.size===3?K.type==="c"?(K.array[p]=F.r,K.array[p+1]=F.g,K.array[p+2]=F.b):(K.array[p]=
+F.x,K.array[p+1]=F.y,K.array[p+2]=F.z):(K.array[p]=F.x,K.array[p+1]=F.y,K.array[p+2]=F.z,K.array[p+3]=F.w)),p+=K.size;d.bindBuffer(d.ARRAY_BUFFER,K.buffer);d.bufferData(d.ARRAY_BUFFER,K.array,l)}}}i.__dirtyVertices=!1;i.__dirtyColors=!1;j.attributes&&ra(j)}else if(k instanceof THREE.ParticleSystem)j=c(k,q),m=j.attributes&&ka(j),(i.__dirtyVertices||i.__dirtyColors||k.sortParticles||m)&&e(i,d.DYNAMIC_DRAW,k),i.__dirtyVertices=!1,i.__dirtyColors=!1,j.attributes&&ra(j)};this.setFaceCulling=function(a,
+b){a?(!b||b==="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW),a==="back"?d.cullFace(d.BACK):a==="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK),d.enable(d.CULL_FACE)):d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return cb}};
 THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
 THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};

+ 249 - 0
examples/webgl_custom_attributes_lines.html

@@ -0,0 +1,249 @@
+<!doctype html>
+<html lang="en">
+	<head>
+		<title>three.js webgl - custom attributes [lines]</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+		<style>
+			body {
+				color: #ffffff;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+				font-weight: bold;
+
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+			}
+			#info {
+				color: #fff;
+				position: absolute;
+				top: 0px; width: 100%;
+				padding: 5px;
+				z-index:100;
+			}
+
+		</style>
+	</head>
+
+	<body>
+		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - custom attributes example</div>
+		<div id="container"></div>
+
+		<script src="js/RequestAnimationFrame.js"></script>
+		<script src="js/Detector.js"></script>
+		<script src="js/Stats.js"></script>
+
+		<script src="../build/Three.js"></script>
+
+		<script src="fonts/helvetiker_bold.typeface.js"></script>
+
+		<script type="x-shader/x-vertex" id="vertexshader">
+
+			uniform float amplitude;
+
+			attribute vec3 displacement;
+			attribute vec3 customColor;
+
+			varying vec3 vColor;
+
+			void main() {
+
+				vec3 newPosition = position + amplitude * displacement;
+
+				vColor = customColor;
+
+				gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );
+
+			}
+
+		</script>
+
+		<script type="x-shader/x-fragment" id="fragmentshader">
+
+			uniform vec3 color;
+			uniform float opacity;
+
+			varying vec3 vColor;
+
+			void main() {
+
+				gl_FragColor = vec4( vColor * color, opacity );
+
+			}
+
+		</script>
+
+
+		<script>
+
+		if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+		var renderer, scene, camera, stats;
+
+		var object, uniforms, attributes;
+
+		var text = "three.js",
+
+			height = 15,
+			size = 50,
+
+			curveSegments = 10,
+			steps = 20,
+
+			bevelThickness = 5,
+			bevelSize = 1.5,
+			bevelSegments = 3,
+			bevelEnabled = true,
+			bend = false,
+
+			font = "helvetiker", 		// helvetiker, optimer, gentilis, droid sans, droid serif
+			weight = "bold",		// normal bold
+			style = "normal";		// normal italic
+
+		var WIDTH = window.innerWidth,
+			HEIGHT = window.innerHeight;
+
+		init();
+		animate();
+
+		function init() {
+
+			scene = new THREE.Scene();
+
+			camera = new THREE.PerspectiveCamera( 30, WIDTH / HEIGHT, 1, 10000 );
+			camera.position.z = 400;
+
+			scene.add( camera );
+
+			attributes = {
+
+				displacement: {	type: 'v3', value: [] },
+				customColor: {	type: 'c', value: [] }
+
+			};
+
+			uniforms = {
+
+				amplitude: { type: "f", value: 5.0 },
+				opacity:   { type: "f", value: 0.3 },
+				color:     { type: "c", value: new THREE.Color( 0xff0000 ) }
+
+			};
+
+			var shaderMaterial = new THREE.ShaderMaterial( {
+
+				uniforms: 		uniforms,
+				attributes:     attributes,
+				vertexShader:   document.getElementById( 'vertexshader' ).textContent,
+				fragmentShader: document.getElementById( 'fragmentshader' ).textContent,
+				blending: 		THREE.AdditiveBlending,
+				depthTest:		false,
+				transparent:	true
+
+			});
+
+			shaderMaterial.linewidth = 1;
+
+			geometry = new THREE.TextGeometry( text, {
+
+				size: size,
+				height: height,
+				curveSegments: curveSegments,
+
+				font: font,
+				weight: weight,
+				style: style,
+
+				bevelThickness: bevelThickness,
+				bevelSize: bevelSize,
+				bevelEnabled: bevelEnabled,
+
+				bend: bend,
+
+				steps: steps
+
+			});
+
+			geometry.dynamic = true;
+
+			THREE.GeometryUtils.center( geometry );
+
+			object = new THREE.Line( geometry, shaderMaterial, THREE.LineStrip );
+
+			var vertices = object.geometry.vertices;
+
+			var displacement = attributes.displacement.value;
+			var color = attributes.customColor.value;
+
+			for( var v = 0; v < vertices.length; v ++ ) {
+
+				displacement[ v ] = new THREE.Vector3( 0, 0, 0 );
+
+				color[ v ] = new THREE.Color( 0xffffff );
+				color[ v ].setHSV( v / vertices.length, 0.9, 0.9 );
+
+			}
+
+			object.rotation.x = 0.2;
+
+			scene.add( object );
+
+			renderer = new THREE.WebGLRenderer( { clearColor: 0x050505, clearAlpha: 1, antialias: true } );
+			renderer.setSize( WIDTH, HEIGHT );
+
+			renderer.autoClearColor = false;
+
+			var container = document.getElementById( 'container' );
+			container.appendChild( renderer.domElement );
+
+			stats = new Stats();
+			stats.domElement.style.position = 'absolute';
+			stats.domElement.style.top = '0px';
+			container.appendChild( stats.domElement );
+
+		}
+
+		function animate() {
+
+			requestAnimationFrame( animate );
+
+			render();
+			stats.update();
+
+		}
+
+		function render() {
+
+			var time = Date.now() * 0.001;
+
+			object.rotation.y = 0.25 * time;
+
+			uniforms.amplitude.value = 0.5 * Math.sin( 0.5 * time );
+			THREE.ColorUtils.adjustHSV( uniforms.color.value, 0.0005, 0, 0 );
+
+			for( var i = 0; i < attributes.displacement.value.length; i ++ ) {
+
+				nx = 0.3 * ( 0.5 - Math.random() );
+				ny = 0.3 * ( 0.5 - Math.random() );
+				nz = 0.3 * ( 0.5 - Math.random() );
+
+				attributes.displacement.value[ i ].x += nx;
+				attributes.displacement.value[ i ].y += ny;
+				attributes.displacement.value[ i ].z += nz;
+
+			}
+
+			attributes.displacement.needsUpdate = true;
+
+			renderer.render( scene, camera );
+
+		}
+
+
+	</script>
+
+</body>
+
+</html>

+ 1 - 1
src/objects/Line.js

@@ -9,7 +9,7 @@ THREE.Line = function ( geometry, material, type ) {
 	this.geometry = geometry;
 	this.material = material;
 
-	this.type = ( type != undefined ) ? type : THREE.LineStrip;
+	this.type = ( type !== undefined ) ? type : THREE.LineStrip;
 
 	if ( this.geometry ) {
 

+ 129 - 37
src/renderers/WebGLRenderer.js

@@ -658,41 +658,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	//
 
-	function initLineBuffers ( geometry ) {
+	function initCustomAttributes ( geometry, object ) {
 
 		var nvertices = geometry.vertices.length;
 
-		geometry.__vertexArray = new Float32Array( nvertices * 3 );
-		geometry.__colorArray = new Float32Array( nvertices * 3 );
-
-		geometry.__webglLineCount = nvertices;
-
-	};
-
-	function initRibbonBuffers ( geometry ) {
-
-		var nvertices = geometry.vertices.length;
-
-		geometry.__vertexArray = new Float32Array( nvertices * 3 );
-		geometry.__colorArray = new Float32Array( nvertices * 3 );
-
-		geometry.__webglVertexCount = nvertices;
-
-	};
-
-	function initParticleBuffers ( geometry, object ) {
-
-		var nvertices = geometry.vertices.length;
-
-		geometry.__vertexArray = new Float32Array( nvertices * 3 );
-		geometry.__colorArray = new Float32Array( nvertices * 3 );
-
-		geometry.__sortArray = [];
-
-		geometry.__webglParticleCount = nvertices;
-
-		// custom attributes
-
 		var material = object.material;
 
 		if ( material.attributes ) {
@@ -751,6 +720,49 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	//
+
+	function initLineBuffers ( geometry, object ) {
+
+		var nvertices = geometry.vertices.length;
+
+		geometry.__vertexArray = new Float32Array( nvertices * 3 );
+		geometry.__colorArray = new Float32Array( nvertices * 3 );
+
+		geometry.__webglLineCount = nvertices;
+
+		initCustomAttributes ( geometry, object );
+
+	};
+
+	function initParticleBuffers ( geometry, object ) {
+
+		var nvertices = geometry.vertices.length;
+
+		geometry.__vertexArray = new Float32Array( nvertices * 3 );
+		geometry.__colorArray = new Float32Array( nvertices * 3 );
+
+		geometry.__sortArray = [];
+
+		geometry.__webglParticleCount = nvertices;
+
+		initCustomAttributes ( geometry, object );
+
+	};
+
+	function initRibbonBuffers ( geometry ) {
+
+		var nvertices = geometry.vertices.length;
+
+		geometry.__vertexArray = new Float32Array( nvertices * 3 );
+		geometry.__colorArray = new Float32Array( nvertices * 3 );
+
+		geometry.__webglVertexCount = nvertices;
+
+	};
+
+	//
+
 	function getBufferMaterial( object, geometryGroup ) {
 
 		if ( object.material && ! ( object.material instanceof THREE.MeshFaceMaterial ) ) {
@@ -936,7 +948,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-
 	function setMeshBuffers( geometryGroup, object, hint, dispose ) {
 
 		if ( ! geometryGroup.__inittedArrays ) {
@@ -2138,7 +2149,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 		colorArray = geometry.__colorArray,
 
 		dirtyVertices = geometry.__dirtyVertices,
-		dirtyColors = geometry.__dirtyColors;
+		dirtyColors = geometry.__dirtyColors,
+
+		customAttributes = geometry.__webglCustomAttributesList,
+		i, il,
+		a, ca, cal, value,
+		customAttribute;
 
 		if ( dirtyVertices ) {
 
@@ -2178,6 +2194,76 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		if ( customAttributes ) {
+
+			for ( i = 0, il = customAttributes.length; i < il; i ++ ) {
+
+				customAttribute = customAttributes[ i ];
+
+				if ( customAttribute.__original.needsUpdate &&
+					 ( customAttribute.boundTo === undefined ||
+					   customAttribute.boundTo === "vertices" ) ) {
+
+					offset = 0;
+
+					cal = customAttribute.value.length;
+
+					for ( ca = 0; ca < cal; ca ++ ) {
+
+						if ( customAttribute.size === 1 ) {
+
+							customAttribute.array[ offset ] = customAttribute.value[ ca ];
+
+						} else {
+
+							value = customAttribute.value[ ca ];
+
+							if ( customAttribute.size === 2 ) {
+
+								customAttribute.array[ offset ] 	= value.x;
+								customAttribute.array[ offset + 1 ] = value.y;
+
+							} else if ( customAttribute.size === 3 ) {
+
+								if ( customAttribute.type === "c" ) {
+
+									customAttribute.array[ offset ] 	= value.r;
+									customAttribute.array[ offset + 1 ] = value.g;
+									customAttribute.array[ offset + 2 ] = value.b;
+
+
+								} else {
+
+									customAttribute.array[ offset ] 	= value.x;
+									customAttribute.array[ offset + 1 ] = value.y;
+									customAttribute.array[ offset + 2 ] = value.z;
+
+								}
+
+							} else {
+
+								customAttribute.array[ offset ] 	 = value.x;
+								customAttribute.array[ offset + 1  ] = value.y;
+								customAttribute.array[ offset + 2  ] = value.z;
+								customAttribute.array[ offset + 3  ] = value.w;
+
+							}
+
+						}
+
+						offset += customAttribute.size;
+
+					}
+
+					_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );
+					_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );
+
+				}
+
+			}
+
+		}
+
 	};
 
 	function setRibbonBuffers ( geometry, hint ) {
@@ -2319,7 +2405,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 					for ( ca = 0; ca < cal; ca ++ ) {
 
-						index = sortArray[ca][1];
+						index = sortArray[ ca ][ 1 ];
 
 						offset_custom = customAttribute.offset;
 
@@ -4367,7 +4453,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 				if( ! geometry.__webglVertexBuffer ) {
 
 					createLineBuffers( geometry );
-					initLineBuffers( geometry );
+					initLineBuffers( geometry, object );
 
 					geometry.__dirtyVertices = true;
 					geometry.__dirtyColors = true;
@@ -4501,7 +4587,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		} else if ( object instanceof THREE.Line ) {
 
-			if ( geometry.__dirtyVertices ||  geometry.__dirtyColors ) {
+			material = getBufferMaterial( object, geometryGroup );
+
+			customAttributesDirty = material.attributes && areCustomAttributesDirty( material );
+
+			if ( geometry.__dirtyVertices ||  geometry.__dirtyColors || customAttributesDirty ) {
 
 				setLineBuffers( geometry, _gl.DYNAMIC_DRAW );
 
@@ -4510,6 +4600,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 			geometry.__dirtyVertices = false;
 			geometry.__dirtyColors = false;
 
+			material.attributes && clearCustomAttributes( material );
+
 		} else if ( object instanceof THREE.ParticleSystem ) {
 
 			material = getBufferMaterial( object, geometryGroup );