소스 검색

Refactored custom attributes setting for meshes.

More moving ifs out of inner loops: gained 25% performance for dynamic meshes with custom attributes.

Hope I didn't break something.
alteredq 13 년 전
부모
커밋
bbe9760612
3개의 변경된 파일1015개의 추가작업 그리고 720개의 파일을 삭제
  1. 361 355
      build/Three.js
  2. 165 159
      build/custom/ThreeWebGL.js
  3. 489 206
      src/renderers/WebGLRenderer.js

+ 361 - 355
build/Three.js

@@ -15,38 +15,38 @@ Math.abs(c)>1.0E-5?(this.x=Math.atan2(-a.n23/c,a.n33/c),this.z=Math.atan2(-a.n12
 THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
 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,v){e.copy(v).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);u=l.dot(f);p=1/(h*t-k*k);x=(t*n-k*u)*p;w=(h*u-k*n)*p;return x>=0&&w>=0&&x+w<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,t,u,p,x,w,y,v=[],A=0,z=a.children.length;A<z;A++)Array.prototype.push.apply(v,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};v.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 v;var C,B,D,K,P,I,F,O,G=a.geometry,J=G.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);A=0;for(z=G.faces.length;A<z;A++)if(y=G.faces[A],F=this.origin.clone(),O=this.direction.clone(),K=a.matrixWorld,C=K.multiplyVector3(y.centroid.clone()).subSelf(F),I=C.dot(O),
-!(I<=0)&&(C=K.multiplyVector3(J[y.a].position.clone()),B=K.multiplyVector3(J[y.b].position.clone()),D=K.multiplyVector3(J[y.c].position.clone()),K=y instanceof THREE.Face4?K.multiplyVector3(J[y.d].position.clone()):null,P=a.matrixRotationWorld.multiplyVector3(y.normal.clone()),I=O.dot(P),a.doubleSided||(a.flipSided?I>0:I<0)))if(I=P.dot((new THREE.Vector3).sub(C,F))/I,F=F.addSelf(O.multiplyScalar(I)),y instanceof THREE.Face3)b(F,C,B,D)&&(y={distance:this.origin.distanceTo(F),point:F,face:y,object:a},
-v.push(y));else if(y instanceof THREE.Face4&&(b(F,C,B,K)||b(F,B,D,K)))y={distance:this.origin.distanceTo(F),point:F,face:y,object:a},v.push(y)}return v}};
-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,u,p){k=!1;c=f;b=h;e=u;l=p;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,u,p,x,w){k?(k=!1,c=f<u?f<x?f:x:u<x?u:x,b=h<p?h<w?h:w:p<w?p:w,e=f>u?f>x?f:x:u>x?u:x,l=h>p?h>w?h:w:p>w?p:w):(c=f<u?f<x?f<c?f:c:x<c?x:c:u<x?u<c?u:c:x<c?x:c,b=h<p?h<w?h<b?h:b:w<b?w:b:p<w?p<b?p:b:w<b?w:b,e=f>u?f>x?f>e?f:e:x>e?x:e:u>x?u>e?u:e:x>e?x:e,l=h>p?h>w?h>l?h:l:w>l?w:l:p>w?p>l?p:l:w>l?w: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>
+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,u){e.copy(u).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);v=l.dot(f);p=1/(h*t-k*k);x=(t*n-k*v)*p;w=(h*v-k*n)*p;return x>=0&&w>=0&&x+w<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,f=new THREE.Vector3,h,k,n,t,v,p,x,w,z,u=[],B=0,y=a.children.length;B<y;B++)Array.prototype.push.apply(u,this.intersectObject(a.children[B]));if(a instanceof THREE.Particle){B=c(this.origin,this.direction,a.matrixWorld.getPosition());if(B===null||B>a.scale.x)return[];z={distance:B,point:a.position,
+face:null,object:a};u.push(z)}else if(a instanceof THREE.Mesh){B=c(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 u;var F,C,H,L,R,D,O,K,N=a.geometry,J=N.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);B=0;for(y=N.faces.length;B<y;B++)if(z=N.faces[B],O=this.origin.clone(),K=this.direction.clone(),L=a.matrixWorld,F=L.multiplyVector3(z.centroid.clone()).subSelf(O),D=F.dot(K),
+!(D<=0)&&(F=L.multiplyVector3(J[z.a].position.clone()),C=L.multiplyVector3(J[z.b].position.clone()),H=L.multiplyVector3(J[z.c].position.clone()),L=z instanceof THREE.Face4?L.multiplyVector3(J[z.d].position.clone()):null,R=a.matrixRotationWorld.multiplyVector3(z.normal.clone()),D=K.dot(R),a.doubleSided||(a.flipSided?D>0:D<0)))if(D=R.dot((new THREE.Vector3).sub(F,O))/D,O=O.addSelf(K.multiplyScalar(D)),z instanceof THREE.Face3)b(O,F,C,H)&&(z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},
+u.push(z));else if(z instanceof THREE.Face4&&(b(O,F,C,L)||b(O,C,H,L)))z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},u.push(z)}return u}};
+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,v,p){k=!1;c=f;b=h;e=v;l=p;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,v,p,x,w){k?(k=!1,c=f<v?f<x?f:x:v<x?v:x,b=h<p?h<w?h:w:p<w?p:w,e=f>v?f>x?f:x:v>x?v:x,l=h>p?h>w?h:w:p>w?p:w):(c=f<v?f<x?f<c?f:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c,b=h<p?h<w?h<b?h:b:w<b?w:b:p<w?p<b?p:b:w<b?w:b,e=f>v?f>x?f>e?f:e:x>e?x:e:v>x?v>e?v:e:x>e?x:e,l=h>p?h>w?h>l?h:l:w>l?w:l:p>w?p>l?p:l:w>l?w: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,u,p,x,w,y,v){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,u!==void 0?u:1,p||0,x||0,w||0,y||0,v!==void 0?v: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,u,p,x,w,y,v){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=u;this.n34=p;this.n41=x;this.n42=w;this.n43=y;this.n44=v;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,u=a.n31,p=a.n32,x=a.n33,w=a.n34,y=a.n41,v=a.n42,A=a.n43,
-z=a.n44,C=c.n11,B=c.n12,D=c.n13,K=c.n14,P=c.n21,I=c.n22,F=c.n23,O=c.n24,G=c.n31,J=c.n32,L=c.n33,ea=c.n34,ma=c.n41,aa=c.n42,R=c.n43,o=c.n44;this.n11=b*C+e*P+l*G+f*ma;this.n12=b*B+e*I+l*J+f*aa;this.n13=b*D+e*F+l*L+f*R;this.n14=b*K+e*O+l*ea+f*o;this.n21=h*C+k*P+n*G+t*ma;this.n22=h*B+k*I+n*J+t*aa;this.n23=h*D+k*F+n*L+t*R;this.n24=h*K+k*O+n*ea+t*o;this.n31=u*C+p*P+x*G+w*ma;this.n32=u*B+p*I+x*J+w*aa;this.n33=u*D+p*F+x*L+w*R;this.n34=u*K+p*O+x*ea+w*o;this.n41=y*C+v*P+A*G+z*ma;this.n42=y*B+v*I+A*J+z*aa;this.n43=
-y*D+v*F+A*L+z*R;this.n44=y*K+v*O+A*ea+z*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*=
+THREE.Matrix4=function(a,c,b,e,l,f,h,k,n,t,v,p,x,w,z,u){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,v!==void 0?v:1,p||0,x||0,w||0,z||0,u!==void 0?u: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,v,p,x,w,z,u){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=v;this.n34=p;this.n41=x;this.n42=w;this.n43=z;this.n44=u;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,v=a.n31,p=a.n32,x=a.n33,w=a.n34,z=a.n41,u=a.n42,B=a.n43,
+y=a.n44,F=c.n11,C=c.n12,H=c.n13,L=c.n14,R=c.n21,D=c.n22,O=c.n23,K=c.n24,N=c.n31,J=c.n32,M=c.n33,ea=c.n34,ja=c.n41,Z=c.n42,U=c.n43,o=c.n44;this.n11=b*F+e*R+l*N+f*ja;this.n12=b*C+e*D+l*J+f*Z;this.n13=b*H+e*O+l*M+f*U;this.n14=b*L+e*K+l*ea+f*o;this.n21=h*F+k*R+n*N+t*ja;this.n22=h*C+k*D+n*J+t*Z;this.n23=h*H+k*O+n*M+t*U;this.n24=h*L+k*K+n*ea+t*o;this.n31=v*F+p*R+x*N+w*ja;this.n32=v*C+p*D+x*J+w*Z;this.n33=v*H+p*O+x*M+w*U;this.n34=v*L+p*K+x*ea+w*o;this.n41=z*F+u*R+B*N+y*ja;this.n42=z*C+u*D+B*J+y*Z;this.n43=
+z*H+u*O+B*M+y*U;this.n44=z*L+u*K+B*ea+y*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,t=this.n32,u=this.n33,p=this.n34,x=this.n41,w=this.n42,y=this.n43,v=this.n44;return e*h*t*x-b*k*t*x-e*f*u*x+c*k*u*x+b*f*p*x-c*h*p*x-e*h*n*w+b*k*n*w+e*l*u*w-a*k*u*w-b*l*p*w+a*h*p*w+e*f*n*y-c*k*n*y-e*l*t*y+a*k*t*y+c*l*p*y-a*f*p*y-b*f*n*v+c*h*n*v+b*l*t*v-a*h*t*v-
-c*l*u*v+a*f*u*v},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.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,v=this.n33,p=this.n34,x=this.n41,w=this.n42,z=this.n43,u=this.n44;return e*h*t*x-b*k*t*x-e*f*v*x+c*k*v*x+b*f*p*x-c*h*p*x-e*h*n*w+b*k*n*w+e*l*v*w-a*k*v*w-b*l*p*w+a*h*p*w+e*f*n*z-c*k*n*z-e*l*t*z+a*k*t*z+c*l*p*z-a*f*p*z-b*f*n*u+c*h*n*u+b*l*t*u-a*h*t*u-
+c*l*v*u+a*f*v*u},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,u=a.n32,p=a.n33,x=a.n34,w=a.n41,y=a.n42,v=a.n43,A=a.n44;this.n11=k*x*y-n*p*y+n*u*v-h*x*v-k*u*A+h*p*A;this.n12=l*p*y-e*x*y-l*u*v+b*x*v+e*u*A-b*p*A;this.n13=e*n*y-l*k*y+l*h*v-b*n*v-e*h*A+b*k*A;this.n14=l*k*u-e*n*u-l*h*p+b*n*p+e*h*x-b*k*x;this.n21=n*p*w-k*x*w-n*t*v+f*x*v+k*t*A-f*p*A;this.n22=e*x*w-l*p*w+
-l*t*v-c*x*v-e*t*A+c*p*A;this.n23=l*k*w-e*n*w-l*f*v+c*n*v+e*f*A-c*k*A;this.n24=e*n*t-l*k*t+l*f*p-c*n*p-e*f*x+c*k*x;this.n31=h*x*w-n*u*w+n*t*y-f*x*y-h*t*A+f*u*A;this.n32=l*u*w-b*x*w-l*t*y+c*x*y+b*t*A-c*u*A;this.n33=e*n*w-l*h*w+l*f*y-c*n*y-b*f*A+c*h*A;this.n34=l*h*t-b*n*t-l*f*u+c*n*u+b*f*x-c*h*x;this.n41=k*u*w-h*p*w-k*t*y+f*p*y+h*t*v-f*u*v;this.n42=b*p*w-e*u*w+e*t*y-c*p*y-b*t*v+c*u*v;this.n43=e*h*w-b*k*w-e*f*y+c*k*y+b*f*v-c*h*v;this.n44=b*k*t-e*h*t+e*f*u-c*k*u-b*f*p+c*h*p;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,u=e*k,p=e*l;this.n11=n+p*b;this.n12=u*b-t;this.n13=f*e;this.n21=f*l;this.n22=f*k;this.n23=-b;this.n31=t*b-u;this.n32=p+n*b;this.n33=f*h;break;case "ZXY":n=h*k;t=h*l;u=e*k;p=e*l;this.n11=n-p*b;this.n12=-f*l;this.n13=u+t*b;this.n21=t+u*b;this.n22=f*k;this.n23=p-n*b;this.n31=-f*e;this.n32=b;this.n33=f*h;break;case "ZYX":n=
-f*k;t=f*l;u=b*k;p=b*l;this.n11=h*k;this.n12=u*e-t;this.n13=n*e+p;this.n21=h*l;this.n22=p*e+n;this.n23=t*e-u;this.n31=-e;this.n32=b*h;this.n33=f*h;break;case "YZX":n=f*h;t=f*e;u=b*h;p=b*e;this.n11=h*k;this.n12=p-n*l;this.n13=u*l+t;this.n21=l;this.n22=f*k;this.n23=-b*k;this.n31=-e*k;this.n32=t*l+u;this.n33=n-p*l;break;case "XZY":n=f*h;t=f*e;u=b*h;p=b*e;this.n11=h*k;this.n12=-l;this.n13=e*k;this.n21=n*l+p;this.n22=f*k;this.n23=t*l-u;this.n31=u*l-t;this.n32=b*k;this.n33=p*l+n;break;default:n=f*k,t=f*
-l,u=b*k,p=b*l,this.n11=h*k,this.n12=-h*l,this.n13=e,this.n21=t+u*e,this.n22=n-p*e,this.n23=-b*h,this.n31=p-n*e,this.n32=u+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*=
+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,v=a.n32,p=a.n33,x=a.n34,w=a.n41,z=a.n42,u=a.n43,B=a.n44;this.n11=k*x*z-n*p*z+n*v*u-h*x*u-k*v*B+h*p*B;this.n12=l*p*z-e*x*z-l*v*u+b*x*u+e*v*B-b*p*B;this.n13=e*n*z-l*k*z+l*h*u-b*n*u-e*h*B+b*k*B;this.n14=l*k*v-e*n*v-l*h*p+b*n*p+e*h*x-b*k*x;this.n21=n*p*w-k*x*w-n*t*u+f*x*u+k*t*B-f*p*B;this.n22=e*x*w-l*p*w+
+l*t*u-c*x*u-e*t*B+c*p*B;this.n23=l*k*w-e*n*w-l*f*u+c*n*u+e*f*B-c*k*B;this.n24=e*n*t-l*k*t+l*f*p-c*n*p-e*f*x+c*k*x;this.n31=h*x*w-n*v*w+n*t*z-f*x*z-h*t*B+f*v*B;this.n32=l*v*w-b*x*w-l*t*z+c*x*z+b*t*B-c*v*B;this.n33=e*n*w-l*h*w+l*f*z-c*n*z-b*f*B+c*h*B;this.n34=l*h*t-b*n*t-l*f*v+c*n*v+b*f*x-c*h*x;this.n41=k*v*w-h*p*w-k*t*z+f*p*z+h*t*u-f*v*u;this.n42=b*p*w-e*v*w+e*t*z-c*p*z-b*t*u+c*v*u;this.n43=e*h*w-b*k*w-e*f*z+c*k*z+b*f*u-c*h*u;this.n44=b*k*t-e*h*t+e*f*v-c*k*v-b*f*p+c*h*p;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,v=e*k,p=e*l;this.n11=n+p*b;this.n12=v*b-t;this.n13=f*e;this.n21=f*l;this.n22=f*k;this.n23=-b;this.n31=t*b-v;this.n32=p+n*b;this.n33=f*h;break;case "ZXY":n=h*k;t=h*l;v=e*k;p=e*l;this.n11=n-p*b;this.n12=-f*l;this.n13=v+t*b;this.n21=t+v*b;this.n22=f*k;this.n23=p-n*b;this.n31=-f*e;this.n32=b;this.n33=f*h;break;case "ZYX":n=
+f*k;t=f*l;v=b*k;p=b*l;this.n11=h*k;this.n12=v*e-t;this.n13=n*e+p;this.n21=h*l;this.n22=p*e+n;this.n23=t*e-v;this.n31=-e;this.n32=b*h;this.n33=f*h;break;case "YZX":n=f*h;t=f*e;v=b*h;p=b*e;this.n11=h*k;this.n12=p-n*l;this.n13=v*l+t;this.n21=l;this.n22=f*k;this.n23=-b*k;this.n31=-e*k;this.n32=t*l+v;this.n33=n-p*l;break;case "XZY":n=f*h;t=f*e;v=b*h;p=b*e;this.n11=h*k;this.n12=-l;this.n13=e*k;this.n21=n*l+p;this.n22=f*k;this.n23=t*l-v;this.n31=v*l-t;this.n32=b*k;this.n33=p*l+n;break;default:n=f*k,t=f*
+l,v=b*k,p=b*l,this.n11=h*k,this.n12=-h*l,this.n13=e,this.n21=t+v*e,this.n22=n-p*e,this.n23=-b*h,this.n31=p-n*e,this.n32=v+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*=
 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,u=-a.n23*a.n11+a.n21*a.n13,p=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*u;b[8]=a*p;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,t=a.n23*a.n12-a.n22*a.n13,v=-a.n23*a.n11+a.n21*a.n13,p=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*v;b[8]=a*p;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.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=
@@ -56,23 +56,23 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi
 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,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,t=[],
-u,p,x=[],w,y=[],v,A,z=[],C,B,D=[],K={objects:[],sprites:[],lights:[],elements:[]},P=new THREE.Vector3,I=new THREE.Vector4,F=new THREE.Matrix4,O=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,L=new THREE.Vector4;this.computeFrustum=function(a){G[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);G[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);G[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);G[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);G[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);G[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=G[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);F.multiply(b.projectionMatrix,b.matrixWorldInverse);F.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
-F.multiply(b.matrixWorld,b.projectionMatrixInverse);F.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=G[k].x*e.n14+G[k].y*e.n24+G[k].z*e.n34+G[k].w,c<=f){c=!1;break a}c=!0}c?(F.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?(F.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,G,N,V,Z,ka,fa,qa,Y,ca,ja,na,da,H,oa,ga;B=A=w=p=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);F.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(F);K=this.projectGraph(a,!1);a=0;for(P=K.objects.length;a<P;a++)if(Y=K.objects[a].object,ca=Y.matrixWorld,
-na=Y.material,n=0,Y instanceof THREE.Mesh){ja=Y.geometry;da=Y.geometry.materials;V=ja.vertices;H=ja.faces;oa=ja.faceVertexUvs;ja=Y.matrixRotationWorld.extractRotation(ca);G=0;for(N=V.length;G<N;G++)k=c(),k.positionWorld.copy(V[G].position),ca.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),F.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;V=0;for(G=H.length;V<
-G;V++){N=H[V];if(N instanceof THREE.Face3)if(Z=t[N.a],ka=t[N.b],fa=t[N.c],Z.visible&&ka.visible&&fa.visible&&(Y.doubleSided||Y.flipSided!=(fa.positionScreen.x-Z.positionScreen.x)*(ka.positionScreen.y-Z.positionScreen.y)-(fa.positionScreen.y-Z.positionScreen.y)*(ka.positionScreen.x-Z.positionScreen.x)<0))qa=x[p]=x[p]||new THREE.RenderableFace3,p++,u=qa,u.v1.copy(Z),u.v2.copy(ka),u.v3.copy(fa);else continue;else if(N instanceof THREE.Face4)if(Z=t[N.a],ka=t[N.b],fa=t[N.c],qa=t[N.d],Z.visible&&ka.visible&&
-fa.visible&&qa.visible&&(Y.doubleSided||Y.flipSided!=((qa.positionScreen.x-Z.positionScreen.x)*(ka.positionScreen.y-Z.positionScreen.y)-(qa.positionScreen.y-Z.positionScreen.y)*(ka.positionScreen.x-Z.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*(qa.positionScreen.y-fa.positionScreen.y)-(ka.positionScreen.y-fa.positionScreen.y)*(qa.positionScreen.x-fa.positionScreen.x)<0)))ga=y[w]=y[w]||new THREE.RenderableFace4,w++,u=ga,u.v1.copy(Z),u.v2.copy(ka),u.v3.copy(fa),u.v4.copy(qa);else continue;
-u.normalWorld.copy(N.normal);ja.multiplyVector3(u.normalWorld);u.centroidWorld.copy(N.centroid);ca.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);F.multiplyVector3(u.centroidScreen);fa=N.vertexNormals;Z=0;for(ka=fa.length;Z<ka;Z++)qa=u.vertexNormalsWorld[Z],qa.copy(fa[Z]),ja.multiplyVector3(qa);Z=0;for(ka=oa.length;Z<ka;Z++)if(ga=oa[Z][V]){fa=0;for(qa=ga.length;fa<qa;fa++)u.uvs[Z][fa]=ga[fa]}u.material=na;u.faceMaterial=N.materialIndex!==null?da[N.materialIndex]:null;u.z=
-u.centroidScreen.z;K.elements.push(u)}}else if(Y instanceof THREE.Line){O.multiply(F,ca);V=Y.geometry.vertices;Z=c();Z.positionScreen.copy(V[0].position);O.multiplyVector4(Z.positionScreen);G=1;for(N=V.length;G<N;G++)if(Z=c(),Z.positionScreen.copy(V[G].position),O.multiplyVector4(Z.positionScreen),ka=t[n-2],J.copy(Z.positionScreen),L.copy(ka.positionScreen),e(J,L))J.multiplyScalar(1/J.w),L.multiplyScalar(1/L.w),Y=z[A]=z[A]||new THREE.RenderableLine,A++,v=Y,v.v1.positionScreen.copy(J),v.v2.positionScreen.copy(L),
-v.z=Math.max(J.z,L.z),v.material=na,K.elements.push(v)}a=0;for(P=K.sprites.length;a<P;a++)if(Y=K.sprites[a].object,ca=Y.matrixWorld,Y instanceof THREE.Particle&&(I.set(ca.n14,ca.n24,ca.n34,1),F.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))h=D[B]=D[B]||new THREE.RenderableParticle,B++,C=h,C.x=I.x/I.w,C.y=I.y/I.w,C.z=I.z,C.rotation=Y.rotation.z,C.scale.x=Y.scale.x*Math.abs(C.x-(I.x+f.projectionMatrix.n11)/(I.w+f.projectionMatrix.n14)),C.scale.y=Y.scale.y*Math.abs(C.y-(I.y+f.projectionMatrix.n22)/(I.w+
-f.projectionMatrix.n24)),C.material=Y.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)};
+v,p,x=[],w,z=[],u,B,y=[],F,C,H=[],L={objects:[],sprites:[],lights:[],elements:[]},R=new THREE.Vector3,D=new THREE.Vector4,O=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],J=new THREE.Vector4,M=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);O.multiply(b.projectionMatrix,b.matrixWorldInverse);O.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+O.multiply(b.matrixWorld,b.projectionMatrixInverse);O.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?(O.multiplyVector3(R.copy(b.position)),l=a(),l.object=b,l.z=R.z,L.objects.push(l)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(O.multiplyVector3(R.copy(b.position)),l=a(),l.object=b,l.z=R.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,f,l){var h=f.near,o=f.far,R,N,G,X,aa,na,la,ra,ia,da,S,fa,ha,I,Q,ka;C=B=w=p=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);O.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(O);L=this.projectGraph(a,!1);a=0;for(R=L.objects.length;a<R;a++)if(ia=L.objects[a].object,da=ia.matrixWorld,
+fa=ia.material,n=0,ia instanceof THREE.Mesh){S=ia.geometry;ha=ia.geometry.materials;X=S.vertices;I=S.faces;Q=S.faceVertexUvs;S=ia.matrixRotationWorld.extractRotation(da);N=0;for(G=X.length;N<G;N++)k=c(),k.positionWorld.copy(X[N].position),da.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),O.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;X=0;for(N=I.length;X<
+N;X++){G=I[X];if(G instanceof THREE.Face3)if(aa=t[G.a],na=t[G.b],la=t[G.c],aa.visible&&na.visible&&la.visible&&(ia.doubleSided||ia.flipSided!=(la.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(la.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0))ra=x[p]=x[p]||new THREE.RenderableFace3,p++,v=ra,v.v1.copy(aa),v.v2.copy(na),v.v3.copy(la);else continue;else if(G instanceof THREE.Face4)if(aa=t[G.a],na=t[G.b],la=t[G.c],ra=t[G.d],aa.visible&&
+na.visible&&la.visible&&ra.visible&&(ia.doubleSided||ia.flipSided!=((ra.positionScreen.x-aa.positionScreen.x)*(na.positionScreen.y-aa.positionScreen.y)-(ra.positionScreen.y-aa.positionScreen.y)*(na.positionScreen.x-aa.positionScreen.x)<0||(na.positionScreen.x-la.positionScreen.x)*(ra.positionScreen.y-la.positionScreen.y)-(na.positionScreen.y-la.positionScreen.y)*(ra.positionScreen.x-la.positionScreen.x)<0)))ka=z[w]=z[w]||new THREE.RenderableFace4,w++,v=ka,v.v1.copy(aa),v.v2.copy(na),v.v3.copy(la),
+v.v4.copy(ra);else continue;v.normalWorld.copy(G.normal);S.multiplyVector3(v.normalWorld);v.centroidWorld.copy(G.centroid);da.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);O.multiplyVector3(v.centroidScreen);la=G.vertexNormals;aa=0;for(na=la.length;aa<na;aa++)ra=v.vertexNormalsWorld[aa],ra.copy(la[aa]),S.multiplyVector3(ra);aa=0;for(na=Q.length;aa<na;aa++)if(ka=Q[aa][X]){la=0;for(ra=ka.length;la<ra;la++)v.uvs[aa][la]=ka[la]}v.material=fa;v.faceMaterial=G.materialIndex!==
+null?ha[G.materialIndex]:null;v.z=v.centroidScreen.z;L.elements.push(v)}}else if(ia instanceof THREE.Line){K.multiply(O,da);X=ia.geometry.vertices;aa=c();aa.positionScreen.copy(X[0].position);K.multiplyVector4(aa.positionScreen);N=1;for(G=X.length;N<G;N++)if(aa=c(),aa.positionScreen.copy(X[N].position),K.multiplyVector4(aa.positionScreen),na=t[n-2],J.copy(aa.positionScreen),M.copy(na.positionScreen),e(J,M))J.multiplyScalar(1/J.w),M.multiplyScalar(1/M.w),ia=y[B]=y[B]||new THREE.RenderableLine,B++,
+u=ia,u.v1.positionScreen.copy(J),u.v2.positionScreen.copy(M),u.z=Math.max(J.z,M.z),u.material=fa,L.elements.push(u)}a=0;for(R=L.sprites.length;a<R;a++)if(ia=L.sprites[a].object,da=ia.matrixWorld,ia instanceof THREE.Particle&&(D.set(da.n14,da.n24,da.n34,1),O.multiplyVector4(D),D.z/=D.w,D.z>0&&D.z<1))h=H[C]=H[C]||new THREE.RenderableParticle,C++,F=h,F.x=D.x/D.w,F.y=D.y/D.w,F.z=D.z,F.rotation=ia.rotation.z,F.scale.x=ia.scale.x*Math.abs(F.x-(D.x+f.projectionMatrix.n11)/(D.w+f.projectionMatrix.n14)),F.scale.y=
+ia.scale.y*Math.abs(F.y-(D.y+f.projectionMatrix.n22)/(D.w+f.projectionMatrix.n24)),F.material=ia.material,L.elements.push(F);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.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,u=n*e+k*b-f*l,p=n*l+f*e-h*b,b=-f*
-b-h*e-k*l;c.x=t*n+b*-f+u*-k-p*-h;c.y=u*n+b*-h+p*-f-t*-k;c.z=p*n+b*-k+t*-h-u*-f;return 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,v=n*e+k*b-f*l,p=n*l+f*e-h*b,b=-f*
+b-h*e-k*l;c.x=t*n+b*-f+v*-k-p*-h;c.y=v*n+b*-h+p*-f-t*-k;c.z=p*n+b*-k+t*-h-v*-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};
@@ -83,14 +83,14 @@ 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,f,l,R){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;u=h[f];p=h[l];x=h[R];w=n.x-k.x;y=t.x-k.x;v=n.y-k.y;A=t.y-k.y;z=n.z-k.z;C=t.z-k.z;B=p.u-u.u;D=x.u-u.u;K=p.v-u.v;P=x.v-u.v;I=1/(B*P-D*K);J.set((P*w-K*y)*I,(P*v-K*A)*I,(P*z-K*C)*I);L.set((B*y-D*w)*I,(B*A-D*v)*I,(B*C-D*z)*I);O[b].addSelf(J);O[c].addSelf(J);O[e].addSelf(J);G[b].addSelf(L);
-G[c].addSelf(L);G[e].addSelf(L)}var c,b,e,l,f,h,k,n,t,u,p,x,w,y,v,A,z,C,B,D,K,P,I,F,O=[],G=[],J=new THREE.Vector3,L=new THREE.Vector3,ea=new THREE.Vector3,ma=new THREE.Vector3,aa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)O[c]=new THREE.Vector3,G[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 R=["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++)aa.copy(f.vertexNormals[e]),l=f[R[e]],F=O[l],ea.copy(F),ea.subSelf(aa.multiplyScalar(aa.dot(F))).normalize(),ma.cross(f.vertexNormals[e],F),l=ma.dot(G[l]),l=l<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(ea.x,ea.y,ea.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,U){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;v=h[f];p=h[l];x=h[U];w=n.x-k.x;z=t.x-k.x;u=n.y-k.y;B=t.y-k.y;y=n.z-k.z;F=t.z-k.z;C=p.u-v.u;H=x.u-v.u;L=p.v-v.v;R=x.v-v.v;D=1/(C*R-H*L);J.set((R*w-L*z)*D,(R*u-L*B)*D,(R*y-L*F)*D);M.set((C*z-H*w)*D,(C*B-H*u)*D,(C*F-H*y)*D);K[b].addSelf(J);K[c].addSelf(J);K[e].addSelf(J);N[b].addSelf(M);
+N[c].addSelf(M);N[e].addSelf(M)}var c,b,e,l,f,h,k,n,t,v,p,x,w,z,u,B,y,F,C,H,L,R,D,O,K=[],N=[],J=new THREE.Vector3,M=new THREE.Vector3,ea=new THREE.Vector3,ja=new THREE.Vector3,Z=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 U=["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++)Z.copy(f.vertexNormals[e]),l=f[U[e]],O=K[l],ea.copy(O),ea.subSelf(Z.multiplyScalar(Z.dot(O))).normalize(),ja.cross(f.vertexNormals[e],O),l=ja.dot(N[l]),l=l<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(ea.x,ea.y,ea.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,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,t,u,p,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]];u=this.points[b[1]];
-p=this.points[b[2]];x=this.points[b[3]];k=h*h;n=h*k;e.x=c(t.x,u.x,p.x,x.x,h,k,n);e.y=c(t.y,u.y,p.y,x.y,h,k,n);e.z=c(t.z,u.z,p.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,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),
+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,t,v,p,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]];v=this.points[b[1]];
+p=this.points[b[2]];x=this.points[b[3]];k=h*h;n=h*k;e.x=c(t.x,v.x,p.x,x.x,h,k,n);e.y=c(t.y,v.y,p.y,x.y,h,k,n);e.z=c(t.z,v.z,p.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,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,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];h=Math.ceil(a*c/t.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;
@@ -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,u,p,x,w,y,v;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;v=x.y*f+f;u=0;for(p=x.material.length;u<p;u++)if(w=x.material[u],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=y+"px",w.style.top=v+"px"}}};
-THREE.CanvasRenderer=function(a){function c(a){if(C!=a)v.globalAlpha=C=a}function b(a){if(B!=a){switch(a){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}B=a}}function e(a){if(D!=a)v.strokeStyle=D=a}function l(a){if(K!=a)v.fillStyle=K=a}var f=this,h,k,n,t=new THREE.Projector,a=a||{},u=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
-p,x,w,y,v=u.getContext("2d"),A=new THREE.Color(0),z=0,C=1,B=0,D=null,K=null,P=null,I=null,F=null,O,G,J,L,ea=new THREE.RenderableVertex,ma=new THREE.RenderableVertex,aa,R,o,T,pa,N,V,Z,ka,fa,qa,Y,ca=new THREE.Color,ja=new THREE.Color,na=new THREE.Color,da=new THREE.Color,H=new THREE.Color,oa=[],ga,W,ya,ua,ta,sa,Aa,Ca,Ia,M,$=new THREE.Rectangle,Q=new THREE.Rectangle,U=new THREE.Rectangle,la=!1,ia=new THREE.Color,ha=new THREE.Color,ra=new THREE.Color,va=new THREE.Vector3,wa,Da,Fa,Ba,Ea,X,a=16;wa=document.createElement("canvas");
-wa.width=wa.height=2;Da=wa.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Fa=Da.getImageData(0,0,2,2);Ba=Fa.data;Ea=document.createElement("canvas");Ea.width=Ea.height=a;X=Ea.getContext("2d");X.translate(-a/2,-a/2);X.scale(a,a);a--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;x=b;w=Math.floor(p/2);y=Math.floor(x/2);u.width=p;u.height=x;$.set(-w,-y,w,y);Q.set(-w,-y,w,y);C=1;B=0;F=I=
-P=K=D=null};this.setClearColor=function(a,b){A.copy(a);z=b;Q.set(-w,-y,w,y)};this.setClearColorHex=function(a,b){A.setHex(a);z=b;Q.set(-w,-y,w,y)};this.clear=function(){v.setTransform(1,0,0,-1,w,y);Q.isEmpty()||(Q.minSelf($),Q.inflate(2),z<1&&v.clearRect(Math.floor(Q.getX()),Math.floor(Q.getY()),Math.floor(Q.getWidth()),Math.floor(Q.getHeight())),z>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*255)+","+z+")"),v.fillRect(Math.floor(Q.getX()),
-Math.floor(Q.getY()),Math.floor(Q.getWidth()),Math.floor(Q.getHeight()))),Q.empty())};this.render=function(a,u){function p(a){var b,c,e,f;ia.setRGB(0,0,0);ha.setRGB(0,0,0);ra.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(ia.r+=f.r,ia.g+=f.g,ia.b+=f.b):e instanceof THREE.DirectionalLight?(ha.r+=f.r,ha.g+=f.g,ha.b+=f.b):e instanceof THREE.PointLight&&(ra.r+=f.r,ra.g+=f.g,ra.b+=f.b)}function x(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(va.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 A(a,f,h){c(h.opacity);b(h.blending);var k,o,n,t,u,xa;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)t=h.map.image,u=t.width>>1,xa=
-t.height>>1,h=f.scale.x*w,n=f.scale.y*y,k=h*u,o=n*xa,U.set(a.x-k,a.y-o,a.x+k,a.y+o),$.intersects(U)&&(v.save(),v.translate(a.x,a.y),v.rotate(-f.rotation),v.scale(h,-n),v.translate(-u,-xa),v.drawImage(t,0,0),v.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=f.scale.x*w,o=f.scale.y*y,U.set(a.x-k,a.y-o,a.x+k,a.y+o),$.intersects(U)&&(e(h.color.getContextStyle()),l(h.color.getContextStyle()),v.save(),v.translate(a.x,a.y),v.rotate(-f.rotation),v.scale(k,o),h.program(v),v.restore()))}function z(a,
-f,l,h){c(h.opacity);b(h.blending);v.beginPath();v.moveTo(a.positionScreen.x,a.positionScreen.y);v.lineTo(f.positionScreen.x,f.positionScreen.y);v.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(P!=a)v.lineWidth=P=a;a=h.linecap;if(I!=a)v.lineCap=I=a;a=h.linejoin;if(F!=a)v.lineJoin=F=a;e(h.color.getContextStyle());v.stroke();U.inflate(h.linewidth*2)}}function B(a,e,h,l,k,t,w,p){f.info.render.vertices+=3;f.info.render.faces++;c(p.opacity);b(p.blending);aa=a.positionScreen.x;R=a.positionScreen.y;
-o=e.positionScreen.x;T=e.positionScreen.y;pa=h.positionScreen.x;N=h.positionScreen.y;Na(aa,R,o,T,pa,N);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ua=w.uvs[0],Ra(aa,R,o,T,pa,N,ua[l].u,ua[l].v,ua[k].u,ua[k].v,ua[t].u,ua[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=u.matrixWorldInverse,va.copy(w.vertexNormalsWorld[l]),ta=(va.x*a.n11+va.y*a.n12+va.z*a.n13)*0.5+0.5,sa=-(va.x*a.n21+va.y*a.n22+va.z*a.n23)*
-0.5+0.5,va.copy(w.vertexNormalsWorld[k]),Aa=(va.x*a.n11+va.y*a.n12+va.z*a.n13)*0.5+0.5,Ca=-(va.x*a.n21+va.y*a.n22+va.z*a.n23)*0.5+0.5,va.copy(w.vertexNormalsWorld[t]),Ia=(va.x*a.n11+va.y*a.n12+va.z*a.n13)*0.5+0.5,M=-(va.x*a.n21+va.y*a.n22+va.z*a.n23)*0.5+0.5,Ra(aa,R,o,T,pa,N,ta,sa,Aa,Ca,Ia,M,p.envMap)}else p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&
-(ua=w.uvs[0],Ra(aa,R,o,T,pa,N,ua[l].u,ua[l].v,ua[k].u,ua[k].v,ua[t].u,ua[t].v,p.map)),b(THREE.SubtractiveBlending)),la?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==3?(ja.r=na.r=da.r=ia.r,ja.g=na.g=da.g=ia.g,ja.b=na.b=da.b=ia.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],ja),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],na),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],da),ja.r=Math.max(0,Math.min(p.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(p.color.g*ja.g,1)),ja.b=
-Math.max(0,Math.min(p.color.b*ja.b,1)),na.r=Math.max(0,Math.min(p.color.r*na.r,1)),na.g=Math.max(0,Math.min(p.color.g*na.g,1)),na.b=Math.max(0,Math.min(p.color.b*na.b,1)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),H.r=(na.r+da.r)*0.5,H.g=(na.g+da.g)*0.5,H.b=(na.b+da.b)*0.5,ya=Oa(ja,na,da,H),K(aa,R,o,T,pa,N,0,0,1,0,0,1,ya)):(ca.r=ia.r,ca.g=ia.g,ca.b=ia.b,x(n,w.centroidWorld,w.normalWorld,ca),ca.r=Math.max(0,Math.min(p.color.r*
-ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.b,1)),p.wireframe?D(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ca)):p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)ga=u.near,W=u.far,ja.r=ja.g=ja.b=1-La(a.positionScreen.z,ga,W),na.r=na.g=na.b=1-La(e.positionScreen.z,ga,W),da.r=da.g=da.b=1-La(h.positionScreen.z,ga,W),H.r=(na.r+da.r)*0.5,H.g=(na.g+
-da.g)*0.5,H.b=(na.b+da.b)*0.5,ya=Oa(ja,na,da,H),K(aa,R,o,T,pa,N,0,0,1,0,0,1,ya);else if(p instanceof THREE.MeshNormalMaterial)ca.r=Ma(w.normalWorld.x),ca.g=Ma(w.normalWorld.y),ca.b=Ma(w.normalWorld.z),p.wireframe?D(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ca)}function C(a,e,h,l,k,t,w,p,v){f.info.render.vertices+=4;f.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)B(a,e,l,0,1,3,w,p,v),B(k,h,t,1,2,3,w,p,v);else if(aa=a.positionScreen.x,R=a.positionScreen.y,
-o=e.positionScreen.x,T=e.positionScreen.y,pa=h.positionScreen.x,N=h.positionScreen.y,V=l.positionScreen.x,Z=l.positionScreen.y,ka=k.positionScreen.x,fa=k.positionScreen.y,qa=t.positionScreen.x,Y=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Pa(aa,R,o,T,pa,N,V,Z),p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)la?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==4?(ja.r=
-na.r=da.r=H.r=ia.r,ja.g=na.g=da.g=H.g=ia.g,ja.b=na.b=da.b=H.b=ia.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],ja),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],na),x(n,w.v4.positionWorld,w.vertexNormalsWorld[3],da),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],H),ja.r=Math.max(0,Math.min(p.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(p.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(p.color.b*ja.b,1)),na.r=Math.max(0,Math.min(p.color.r*na.r,1)),na.g=Math.max(0,Math.min(p.color.g*na.g,1)),na.b=Math.max(0,
-Math.min(p.color.b*na.b,1)),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),H.r=Math.max(0,Math.min(p.color.r*H.r,1)),H.g=Math.max(0,Math.min(p.color.g*H.g,1)),H.b=Math.max(0,Math.min(p.color.b*H.b,1)),ya=Oa(ja,na,da,H),Na(aa,R,o,T,V,Z),K(aa,R,o,T,V,Z,0,0,1,0,0,1,ya),Na(ka,fa,pa,N,qa,Y),K(ka,fa,pa,N,qa,Y,1,0,1,1,0,1,ya)):(ca.r=ia.r,ca.g=ia.g,ca.b=ia.b,x(n,w.centroidWorld,w.normalWorld,ca),ca.r=Math.max(0,Math.min(p.color.r*
-ca.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ca.b,1)),Pa(aa,R,o,T,pa,N,V,Z),p.wireframe?D(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(ca)):(Pa(aa,R,o,T,pa,N,V,Z),p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color));else if(p instanceof THREE.MeshNormalMaterial)ca.r=Ma(w.normalWorld.x),ca.g=Ma(w.normalWorld.y),ca.b=Ma(w.normalWorld.z),Pa(aa,R,o,T,pa,N,V,Z),p.wireframe?D(ca,p.wireframeLinewidth,
-p.wireframeLinecap,p.wireframeLinejoin):Ja(ca);else if(p instanceof THREE.MeshDepthMaterial)ga=u.near,W=u.far,ja.r=ja.g=ja.b=1-La(a.positionScreen.z,ga,W),na.r=na.g=na.b=1-La(e.positionScreen.z,ga,W),da.r=da.g=da.b=1-La(l.positionScreen.z,ga,W),H.r=H.g=H.b=1-La(h.positionScreen.z,ga,W),ya=Oa(ja,na,da,H),Na(aa,R,o,T,V,Z),K(aa,R,o,T,V,Z,0,0,1,0,0,1,ya),Na(ka,fa,pa,N,qa,Y),K(ka,fa,pa,N,qa,Y,1,0,1,1,0,1,ya)}function Na(a,b,c,e,f,h){v.beginPath();v.moveTo(a,b);v.lineTo(c,e);v.lineTo(f,h);v.lineTo(a,b);
-v.closePath()}function Pa(a,b,c,e,f,h,l,k){v.beginPath();v.moveTo(a,b);v.lineTo(c,e);v.lineTo(f,h);v.lineTo(l,k);v.lineTo(a,b);v.closePath()}function D(a,b,c,f){if(P!=b)v.lineWidth=P=b;if(I!=c)v.lineCap=I=c;if(F!=f)v.lineJoin=F=f;e(a.getContextStyle());v.stroke();U.inflate(b*2)}function Ja(a){l(a.getContextStyle());v.fill()}function Ra(a,b,c,e,f,h,k,o,n,p,t,w,u){if(u.image.width!=0){if(u.needsUpdate==!0||oa[u.id]==void 0){var xa=u.wrapS==THREE.RepeatWrapping,x=u.wrapT==THREE.RepeatWrapping;oa[u.id]=
-v.createPattern(u.image,xa&&x?"repeat":xa&&!x?"repeat-x":!xa&&x?"repeat-y":"no-repeat");u.needsUpdate=!1}l(oa[u.id]);var xa=u.offset.x/u.repeat.x,x=u.offset.y/u.repeat.y,M=(u.image.width-1)*u.repeat.x,u=(u.image.height-1)*u.repeat.y,k=(k+xa)*M,o=(o+x)*u,n=(n+xa)*M,p=(p+x)*u,t=(t+xa)*M,w=(w+x)*u;c-=a;e-=b;f-=a;h-=b;n-=k;p-=o;t-=k;w-=o;xa=1/(n*w-t*p);u=(w*c-p*f)*xa;p=(w*e-p*h)*xa;c=(n*f-t*c)*xa;e=(n*h-t*e)*xa;a=a-u*k-c*o;b=b-p*k-e*o;v.save();v.transform(u,p,c,e,a,b);v.fill();v.restore()}}function K(a,
-b,c,e,f,h,l,k,o,n,p,t,w){var u,xa;u=w.width-1;xa=w.height-1;l*=u;k*=xa;o*=u;n*=xa;p*=u;t*=xa;c-=a;e-=b;f-=a;h-=b;o-=l;n-=k;p-=l;t-=k;xa=1/(o*t-p*n);u=(t*c-n*f)*xa;n=(t*e-n*h)*xa;c=(o*f-p*c)*xa;e=(o*h-p*e)*xa;a=a-u*l-c*k;b=b-n*l-e*k;v.save();v.transform(u,n,c,e,a,b);v.clip();v.drawImage(w,0,0);v.restore()}function Oa(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),p=~~(e.r*255),t=~~(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]=p<0?0:p>255?255:p;Ba[13]=t<0?0:t>255?255:t;Ba[14]=e<0?0:e>255?255:e;Da.putImageData(Fa,0,0);X.drawImage(wa,0,0);return Ea}function La(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ma(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ka(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 Qa,Sa,za,Ga;this.autoClear?this.clear():v.setTransform(1,0,0,-1,w,y);f.info.render.vertices=0;f.info.render.faces=0;h=t.projectScene(a,u,this.sortElements);k=h.elements;n=h.lights;(la=n.length>0)&&p(n);Qa=0;for(Sa=k.length;Qa<Sa;Qa++)if(za=k[Qa],Ga=za.material,Ga=Ga instanceof THREE.MeshFaceMaterial?za.faceMaterial:Ga,!(Ga==null||Ga.opacity==0)){U.empty();if(za instanceof THREE.RenderableParticle)O=za,O.x*=w,O.y*=y,A(O,za,Ga,a);else if(za instanceof
-THREE.RenderableLine)O=za.v1,G=za.v2,O.positionScreen.x*=w,O.positionScreen.y*=y,G.positionScreen.x*=w,G.positionScreen.y*=y,U.addPoint(O.positionScreen.x,O.positionScreen.y),U.addPoint(G.positionScreen.x,G.positionScreen.y),$.intersects(U)&&z(O,G,za,Ga,a);else if(za instanceof THREE.RenderableFace3)O=za.v1,G=za.v2,J=za.v3,O.positionScreen.x*=w,O.positionScreen.y*=y,G.positionScreen.x*=w,G.positionScreen.y*=y,J.positionScreen.x*=w,J.positionScreen.y*=y,Ga.overdraw&&(Ka(O.positionScreen,G.positionScreen),
-Ka(G.positionScreen,J.positionScreen),Ka(J.positionScreen,O.positionScreen)),U.add3Points(O.positionScreen.x,O.positionScreen.y,G.positionScreen.x,G.positionScreen.y,J.positionScreen.x,J.positionScreen.y),$.intersects(U)&&B(O,G,J,0,1,2,za,Ga,a);else if(za instanceof THREE.RenderableFace4)O=za.v1,G=za.v2,J=za.v3,L=za.v4,O.positionScreen.x*=w,O.positionScreen.y*=y,G.positionScreen.x*=w,G.positionScreen.y*=y,J.positionScreen.x*=w,J.positionScreen.y*=y,L.positionScreen.x*=w,L.positionScreen.y*=y,ea.positionScreen.copy(G.positionScreen),
-ma.positionScreen.copy(L.positionScreen),Ga.overdraw&&(Ka(O.positionScreen,G.positionScreen),Ka(G.positionScreen,L.positionScreen),Ka(L.positionScreen,O.positionScreen),Ka(J.positionScreen,ea.positionScreen),Ka(J.positionScreen,ma.positionScreen)),U.addPoint(O.positionScreen.x,O.positionScreen.y),U.addPoint(G.positionScreen.x,G.positionScreen.y),U.addPoint(J.positionScreen.x,J.positionScreen.y),U.addPoint(L.positionScreen.x,L.positionScreen.y),$.intersects(U)&&C(O,G,J,L,ea,ma,za,Ga,a);Q.addRectangle(U)}v.setTransform(1,
+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,v,p,x,w,z,u;a=c.projectScene(b,e);n=0;for(t=a.length;n<t;n++)if(x=a[n],x instanceof THREE.RenderableParticle){z=x.x*l+l;u=x.y*f+f;v=0;for(p=x.material.length;v<p;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=u+"px"}}};
+THREE.CanvasRenderer=function(a){function c(a){if(F!=a)u.globalAlpha=F=a}function b(a){if(C!=a){switch(a){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}C=a}}function e(a){if(H!=a)u.strokeStyle=H=a}function l(a){if(L!=a)u.fillStyle=L=a}var f=this,h,k,n,t=new THREE.Projector,a=a||{},v=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
+p,x,w,z,u=v.getContext("2d"),B=new THREE.Color(0),y=0,F=1,C=0,H=null,L=null,R=null,D=null,O=null,K,N,J,M,ea=new THREE.RenderableVertex,ja=new THREE.RenderableVertex,Z,U,o,P,pa,G,X,aa,na,la,ra,ia,da=new THREE.Color,S=new THREE.Color,fa=new THREE.Color,ha=new THREE.Color,I=new THREE.Color,Q=[],ka,ma,wa,sa,qa,Ea,ya,Aa,Ja,$,ca=new THREE.Rectangle,V=new THREE.Rectangle,W=new THREE.Rectangle,ga=!1,oa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,Y=new THREE.Vector3,Ba,Ha,Fa,xa,Ca,T,a=16;Ba=document.createElement("canvas");
+Ba.width=Ba.height=2;Ha=Ba.getContext("2d");Ha.fillStyle="rgba(0,0,0,1)";Ha.fillRect(0,0,2,2);Fa=Ha.getImageData(0,0,2,2);xa=Fa.data;Ca=document.createElement("canvas");Ca.width=Ca.height=a;T=Ca.getContext("2d");T.translate(-a/2,-a/2);T.scale(a,a);a--;this.domElement=v;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;x=b;w=Math.floor(p/2);z=Math.floor(x/2);v.width=p;v.height=x;ca.set(-w,-z,w,z);V.set(-w,-z,w,z);F=1;C=0;O=D=
+R=L=H=null};this.setClearColor=function(a,b){B.copy(a);y=b;V.set(-w,-z,w,z)};this.setClearColorHex=function(a,b){B.setHex(a);y=b;V.set(-w,-z,w,z)};this.clear=function(){u.setTransform(1,0,0,-1,w,z);V.isEmpty()||(V.minSelf(ca),V.inflate(2),y<1&&u.clearRect(Math.floor(V.getX()),Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight())),y>0&&(b(THREE.NormalBlending),c(1),l("rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+y+")"),u.fillRect(Math.floor(V.getX()),
+Math.floor(V.getY()),Math.floor(V.getWidth()),Math.floor(V.getHeight()))),V.empty())};this.render=function(a,v){function p(a){var b,c,e,f;oa.setRGB(0,0,0);ta.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],f=e.color,e instanceof THREE.AmbientLight?(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b):e instanceof THREE.DirectionalLight?(ta.r+=f.r,ta.g+=f.g,ta.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function x(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(Y.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 B(a,f,h){c(h.opacity);b(h.blending);var k,o,n,t,v,va;if(h instanceof THREE.ParticleBasicMaterial){if(h.map)t=h.map.image,v=t.width>>1,va=t.height>>
+1,h=f.scale.x*w,n=f.scale.y*z,k=h*v,o=n*va,W.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(W)&&(u.save(),u.translate(a.x,a.y),u.rotate(-f.rotation),u.scale(h,-n),u.translate(-v,-va),u.drawImage(t,0,0),u.restore())}else h instanceof THREE.ParticleCanvasMaterial&&(k=f.scale.x*w,o=f.scale.y*z,W.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(W)&&(e(h.color.getContextStyle()),l(h.color.getContextStyle()),u.save(),u.translate(a.x,a.y),u.rotate(-f.rotation),u.scale(k,o),h.program(u),u.restore()))}function y(a,
+f,l,h){c(h.opacity);b(h.blending);u.beginPath();u.moveTo(a.positionScreen.x,a.positionScreen.y);u.lineTo(f.positionScreen.x,f.positionScreen.y);u.closePath();if(h instanceof THREE.LineBasicMaterial){a=h.linewidth;if(R!=a)u.lineWidth=R=a;a=h.linecap;if(D!=a)u.lineCap=D=a;a=h.linejoin;if(O!=a)u.lineJoin=O=a;e(h.color.getContextStyle());u.stroke();W.inflate(h.linewidth*2)}}function C(a,e,h,l,k,t,w,p){f.info.render.vertices+=3;f.info.render.faces++;c(p.opacity);b(p.blending);Z=a.positionScreen.x;U=a.positionScreen.y;
+o=e.positionScreen.x;P=e.positionScreen.y;pa=h.positionScreen.x;G=h.positionScreen.y;Na(Z,U,o,P,pa,G);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=w.uvs[0],Ra(Z,U,o,P,pa,G,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[t].u,sa[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=v.matrixWorldInverse,Y.copy(w.vertexNormalsWorld[l]),qa=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,Ea=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,
+Y.copy(w.vertexNormalsWorld[k]),ya=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,Aa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Y.copy(w.vertexNormalsWorld[t]),Ja=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,$=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Ra(Z,U,o,P,pa,G,qa,Ea,ya,Aa,Ja,$,p.envMap)}else p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(sa=w.uvs[0],
+Ra(Z,U,o,P,pa,G,sa[l].u,sa[l].v,sa[k].u,sa[k].v,sa[t].u,sa[t].v,p.map)),b(THREE.SubtractiveBlending)),ga?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==3?(S.r=fa.r=ha.r=oa.r,S.g=fa.g=ha.g=oa.g,S.b=fa.b=ha.b=oa.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],S),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],fa),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],ha),S.r=Math.max(0,Math.min(p.color.r*S.r,1)),S.g=Math.max(0,Math.min(p.color.g*S.g,1)),S.b=Math.max(0,Math.min(p.color.b*
+S.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),ha.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ha.b,1)),I.r=(fa.r+ha.r)*0.5,I.g=(fa.g+ha.g)*0.5,I.b=(fa.b+ha.b)*0.5,wa=Oa(S,fa,ha,I),L(Z,U,o,P,pa,G,0,0,1,0,0,1,wa)):(da.r=oa.r,da.g=oa.g,da.b=oa.b,x(n,w.centroidWorld,w.normalWorld,da),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,
+Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)):p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshDepthMaterial)ka=v.near,ma=v.far,S.r=S.g=S.b=1-La(a.positionScreen.z,ka,ma),fa.r=fa.g=fa.b=1-La(e.positionScreen.z,ka,ma),ha.r=ha.g=ha.b=1-La(h.positionScreen.z,ka,ma),I.r=(fa.r+ha.r)*0.5,I.g=(fa.g+ha.g)*0.5,I.b=(fa.b+
+ha.b)*0.5,wa=Oa(S,fa,ha,I),L(Z,U,o,P,pa,G,0,0,1,0,0,1,wa);else if(p instanceof THREE.MeshNormalMaterial)da.r=Ma(w.normalWorld.x),da.g=Ma(w.normalWorld.y),da.b=Ma(w.normalWorld.z),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)}function F(a,e,h,l,k,t,w,p,u){f.info.render.vertices+=4;f.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)C(a,e,l,0,1,3,w,p,u),C(k,h,t,1,2,3,w,p,u);else if(Z=a.positionScreen.x,U=a.positionScreen.y,o=e.positionScreen.x,
+P=e.positionScreen.y,pa=h.positionScreen.x,G=h.positionScreen.y,X=l.positionScreen.x,aa=l.positionScreen.y,na=k.positionScreen.x,la=k.positionScreen.y,ra=t.positionScreen.x,ia=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color);else if(p instanceof THREE.MeshLambertMaterial)ga?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==4?(S.r=fa.r=ha.r=I.r=oa.r,S.g=
+fa.g=ha.g=I.g=oa.g,S.b=fa.b=ha.b=I.b=oa.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],S),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],fa),x(n,w.v4.positionWorld,w.vertexNormalsWorld[3],ha),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],I),S.r=Math.max(0,Math.min(p.color.r*S.r,1)),S.g=Math.max(0,Math.min(p.color.g*S.g,1)),S.b=Math.max(0,Math.min(p.color.b*S.b,1)),fa.r=Math.max(0,Math.min(p.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(p.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(p.color.b*fa.b,1)),
+ha.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ha.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ha.b=Math.max(0,Math.min(p.color.b*ha.b,1)),I.r=Math.max(0,Math.min(p.color.r*I.r,1)),I.g=Math.max(0,Math.min(p.color.g*I.g,1)),I.b=Math.max(0,Math.min(p.color.b*I.b,1)),wa=Oa(S,fa,ha,I),Na(Z,U,o,P,X,aa),L(Z,U,o,P,X,aa,0,0,1,0,0,1,wa),Na(na,la,pa,G,ra,ia),L(na,la,pa,G,ra,ia,1,0,1,1,0,1,wa)):(da.r=oa.r,da.g=oa.g,da.b=oa.b,x(n,w.centroidWorld,w.normalWorld,da),da.r=Math.max(0,Math.min(p.color.r*da.r,1)),da.g=Math.max(0,
+Math.min(p.color.g*da.g,1)),da.b=Math.max(0,Math.min(p.color.b*da.b,1)),Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)):(Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(p.color));else if(p instanceof THREE.MeshNormalMaterial)da.r=Ma(w.normalWorld.x),da.g=Ma(w.normalWorld.y),da.b=Ma(w.normalWorld.z),Pa(Z,U,o,P,pa,G,X,aa),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):
+Da(da);else if(p instanceof THREE.MeshDepthMaterial)ka=v.near,ma=v.far,S.r=S.g=S.b=1-La(a.positionScreen.z,ka,ma),fa.r=fa.g=fa.b=1-La(e.positionScreen.z,ka,ma),ha.r=ha.g=ha.b=1-La(l.positionScreen.z,ka,ma),I.r=I.g=I.b=1-La(h.positionScreen.z,ka,ma),wa=Oa(S,fa,ha,I),Na(Z,U,o,P,X,aa),L(Z,U,o,P,X,aa,0,0,1,0,0,1,wa),Na(na,la,pa,G,ra,ia),L(na,la,pa,G,ra,ia,1,0,1,1,0,1,wa)}function Na(a,b,c,e,f,h){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(f,h);u.lineTo(a,b);u.closePath()}function Pa(a,b,c,e,f,
+h,l,k){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(f,h);u.lineTo(l,k);u.lineTo(a,b);u.closePath()}function H(a,b,c,f){if(R!=b)u.lineWidth=R=b;if(D!=c)u.lineCap=D=c;if(O!=f)u.lineJoin=O=f;e(a.getContextStyle());u.stroke();W.inflate(b*2)}function Da(a){l(a.getContextStyle());u.fill()}function Ra(a,b,c,e,f,h,k,o,n,p,t,w,v){if(v.image.width!=0){if(v.needsUpdate==!0||Q[v.id]==void 0){var va=v.wrapS==THREE.RepeatWrapping,x=v.wrapT==THREE.RepeatWrapping;Q[v.id]=u.createPattern(v.image,va&&x?"repeat":
+va&&!x?"repeat-x":!va&&x?"repeat-y":"no-repeat");v.needsUpdate=!1}l(Q[v.id]);var va=v.offset.x/v.repeat.x,x=v.offset.y/v.repeat.y,$=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,k=(k+va)*$,o=(o+x)*v,n=(n+va)*$,p=(p+x)*v,t=(t+va)*$,w=(w+x)*v;c-=a;e-=b;f-=a;h-=b;n-=k;p-=o;t-=k;w-=o;va=1/(n*w-t*p);v=(w*c-p*f)*va;p=(w*e-p*h)*va;c=(n*f-t*c)*va;e=(n*h-t*e)*va;a=a-v*k-c*o;b=b-p*k-e*o;u.save();u.transform(v,p,c,e,a,b);u.fill();u.restore()}}function L(a,b,c,e,f,h,l,k,o,n,p,t,w){var v,va;v=w.width-
+1;va=w.height-1;l*=v;k*=va;o*=v;n*=va;p*=v;t*=va;c-=a;e-=b;f-=a;h-=b;o-=l;n-=k;p-=l;t-=k;va=1/(o*t-p*n);v=(t*c-n*f)*va;n=(t*e-n*h)*va;c=(o*f-p*c)*va;e=(o*h-p*e)*va;a=a-v*l-c*k;b=b-n*l-e*k;u.save();u.transform(v,n,c,e,a,b);u.clip();u.drawImage(w,0,0);u.restore()}function Oa(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),p=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255);xa[0]=f<0?0:f>255?255:f;xa[1]=h<0?0:h>255?255:
+h;xa[2]=a<0?0:a>255?255:a;xa[4]=l<0?0:l>255?255:l;xa[5]=k<0?0:k>255?255:k;xa[6]=b<0?0:b>255?255:b;xa[8]=o<0?0:o>255?255:o;xa[9]=n<0?0:n>255?255:n;xa[10]=c<0?0:c>255?255:c;xa[12]=p<0?0:p>255?255:p;xa[13]=t<0?0:t>255?255:t;xa[14]=e<0?0:e>255?255:e;Ha.putImageData(Fa,0,0);T.drawImage(Ba,0,0);return Ca}function La(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ma(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ka(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 Qa,Sa,za,Ia;this.autoClear?this.clear():u.setTransform(1,0,0,-1,w,z);f.info.render.vertices=0;f.info.render.faces=0;h=t.projectScene(a,v,this.sortElements);k=h.elements;n=h.lights;(ga=n.length>0)&&p(n);Qa=0;for(Sa=k.length;Qa<Sa;Qa++)if(za=k[Qa],Ia=za.material,Ia=Ia instanceof THREE.MeshFaceMaterial?za.faceMaterial:Ia,!(Ia==null||Ia.opacity==0)){W.empty();if(za instanceof THREE.RenderableParticle)K=za,K.x*=w,K.y*=z,B(K,za,Ia,a);else if(za instanceof THREE.RenderableLine)K=za.v1,N=za.v2,
+K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(N.positionScreen.x,N.positionScreen.y),ca.intersects(W)&&y(K,N,za,Ia,a);else if(za instanceof THREE.RenderableFace3)K=za.v1,N=za.v2,J=za.v3,K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,J.positionScreen.x*=w,J.positionScreen.y*=z,Ia.overdraw&&(Ka(K.positionScreen,N.positionScreen),Ka(N.positionScreen,J.positionScreen),
+Ka(J.positionScreen,K.positionScreen)),W.add3Points(K.positionScreen.x,K.positionScreen.y,N.positionScreen.x,N.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ca.intersects(W)&&C(K,N,J,0,1,2,za,Ia,a);else if(za instanceof THREE.RenderableFace4)K=za.v1,N=za.v2,J=za.v3,M=za.v4,K.positionScreen.x*=w,K.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,J.positionScreen.x*=w,J.positionScreen.y*=z,M.positionScreen.x*=w,M.positionScreen.y*=z,ea.positionScreen.copy(N.positionScreen),
+ja.positionScreen.copy(M.positionScreen),Ia.overdraw&&(Ka(K.positionScreen,N.positionScreen),Ka(N.positionScreen,M.positionScreen),Ka(M.positionScreen,K.positionScreen),Ka(J.positionScreen,ea.positionScreen),Ka(J.positionScreen,ja.positionScreen)),W.addPoint(K.positionScreen.x,K.positionScreen.y),W.addPoint(N.positionScreen.x,N.positionScreen.y),W.addPoint(J.positionScreen.x,J.positionScreen.y),W.addPoint(M.positionScreen.x,M.positionScreen.y),ca.intersects(W)&&F(K,N,J,M,ea,ja,za,Ia,a);V.addRectangle(W)}u.setTransform(1,
 0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,e){var f,h,l,k,n,p;f=0;for(h=a.length;f<h;f++)l=a[f],k=l.color,l instanceof THREE.DirectionalLight?(n=l.matrixWorld.getPosition(),p=c.dot(n),p<=0||(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)):l instanceof THREE.PointLight&&(n=l.matrixWorld.getPosition(),p=c.dot(O.sub(n,b).normalize()),p<=0||(p*=l.distance==0?1:1-Math.min(b.distanceTo(n)/l.distance,1),p!=0&&(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)))}function c(a){G[a]==null&&(G[a]=document.createElementNS("http://www.w3.org/2000/svg",
-"path"),aa==0&&G[a].setAttribute("shape-rendering","crispEdges"));return G[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,u,p,x,w,y,v,A,z=new THREE.Rectangle,C=new THREE.Rectangle,B=!1,D=new THREE.Color,K=new THREE.Color,P=new THREE.Color,I=new THREE.Color,F,O=new THREE.Vector3,G=[],J=[],L,ea,ma,aa=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":aa=1;break;case "low":aa=0}};this.setSize=function(a,b){t=a;u=b;p=t/2;x=u/2;n.setAttribute("viewBox",-p+" "+-x+" "+t+" "+u);n.setAttribute("width",t);n.setAttribute("height",u);z.set(-p,-x,p,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(t,o){var u,O,N,V;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(t,o,this.sortElements);f=l.elements;
-h=l.lights;ma=ea=0;if(B=h.length>0){K.setRGB(0,0,0);P.setRGB(0,0,0);I.setRGB(0,0,0);u=0;for(O=h.length;u<O;u++)V=h[u],N=V.color,V instanceof THREE.AmbientLight?(K.r+=N.r,K.g+=N.g,K.b+=N.b):V instanceof THREE.DirectionalLight?(P.r+=N.r,P.g+=N.g,P.b+=N.b):V instanceof THREE.PointLight&&(I.r+=N.r,I.g+=N.g,I.b+=N.b)}u=0;for(O=f.length;u<O;u++)if(N=f[u],V=N.material,V=V instanceof THREE.MeshFaceMaterial?N.faceMaterial:V,!(V==null||V.opacity==0))if(C.empty(),N instanceof THREE.RenderableParticle)w=N,w.x*=
-p,w.y*=-x,m=0,ml=N.materials.length;else if(N instanceof THREE.RenderableLine){if(w=N.v1,y=N.v2,w.positionScreen.x*=p,w.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),z.intersects(C)){N=w;var G=y,ka=ma++;J[ka]==null&&(J[ka]=document.createElementNS("http://www.w3.org/2000/svg","line"),aa==0&&J[ka].setAttribute("shape-rendering","crispEdges"));L=J[ka];L.setAttribute("x1",N.positionScreen.x);
-L.setAttribute("y1",N.positionScreen.y);L.setAttribute("x2",G.positionScreen.x);L.setAttribute("y2",G.positionScreen.y);V instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+V.color.getContextStyle()+"; stroke-width: "+V.linewidth+"; stroke-opacity: "+V.opacity+"; stroke-linecap: "+V.linecap+"; stroke-linejoin: "+V.linejoin),n.appendChild(L))}}else if(N instanceof THREE.RenderableFace3){if(w=N.v1,y=N.v2,v=N.v3,w.positionScreen.x*=p,w.positionScreen.y*=-x,y.positionScreen.x*=
-p,y.positionScreen.y*=-x,v.positionScreen.x*=p,v.positionScreen.y*=-x,C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),z.intersects(C)){var G=w,ka=y,fa=v;e.info.render.vertices+=3;e.info.render.faces++;L=c(ea++);L.setAttribute("d","M "+G.positionScreen.x+" "+G.positionScreen.y+" L "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");V instanceof THREE.MeshBasicMaterial?
-D.copy(V.color):V instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(h,N.centroidWorld,N.normalWorld,D),D.r=Math.max(0,Math.min(V.color.r*D.r,1)),D.g=Math.max(0,Math.min(V.color.g*D.g,1)),D.b=Math.max(0,Math.min(V.color.b*D.b,1))):D.copy(V.color):V instanceof THREE.MeshDepthMaterial?(F=1-V.__2near/(V.__farPlusNear-N.z*V.__farMinusNear),D.setRGB(F,F,F)):V instanceof THREE.MeshNormalMaterial&&D.setRGB(b(N.normalWorld.x),b(N.normalWorld.y),b(N.normalWorld.z));V.wireframe?L.setAttribute("style",
-"fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+V.wireframeLinewidth+"; stroke-opacity: "+V.opacity+"; stroke-linecap: "+V.wireframeLinecap+"; stroke-linejoin: "+V.wireframeLinejoin):L.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+V.opacity);n.appendChild(L)}}else if(N instanceof THREE.RenderableFace4&&(w=N.v1,y=N.v2,v=N.v3,A=N.v4,w.positionScreen.x*=p,w.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,v.positionScreen.x*=p,v.positionScreen.y*=
--x,A.positionScreen.x*=p,A.positionScreen.y*=-x,C.addPoint(w.positionScreen.x,w.positionScreen.y),C.addPoint(y.positionScreen.x,y.positionScreen.y),C.addPoint(v.positionScreen.x,v.positionScreen.y),C.addPoint(A.positionScreen.x,A.positionScreen.y),z.intersects(C))){var G=w,ka=y,fa=v,qa=A;e.info.render.vertices+=4;e.info.render.faces++;L=c(ea++);L.setAttribute("d","M "+G.positionScreen.x+" "+G.positionScreen.y+" L "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+
-" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");V instanceof THREE.MeshBasicMaterial?D.copy(V.color):V instanceof THREE.MeshLambertMaterial?B?(D.r=K.r,D.g=K.g,D.b=K.b,a(h,N.centroidWorld,N.normalWorld,D),D.r=Math.max(0,Math.min(V.color.r*D.r,1)),D.g=Math.max(0,Math.min(V.color.g*D.g,1)),D.b=Math.max(0,Math.min(V.color.b*D.b,1))):D.copy(V.color):V instanceof THREE.MeshDepthMaterial?(F=1-V.__2near/(V.__farPlusNear-N.z*V.__farMinusNear),D.setRGB(F,F,F)):V instanceof THREE.MeshNormalMaterial&&
-D.setRGB(b(N.normalWorld.x),b(N.normalWorld.y),b(N.normalWorld.z));V.wireframe?L.setAttribute("style","fill: none; stroke: "+D.getContextStyle()+"; stroke-width: "+V.wireframeLinewidth+"; stroke-opacity: "+V.opacity+"; stroke-linecap: "+V.wireframeLinecap+"; stroke-linejoin: "+V.wireframeLinejoin):L.setAttribute("style","fill: "+D.getContextStyle()+"; fill-opacity: "+V.opacity);n.appendChild(L)}}};
+THREE.SVGRenderer=function(){function a(a,b,c,e){var f,h,l,k,n,p;f=0;for(h=a.length;f<h;f++)l=a[f],k=l.color,l instanceof THREE.DirectionalLight?(n=l.matrixWorld.getPosition(),p=c.dot(n),p<=0||(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)):l instanceof THREE.PointLight&&(n=l.matrixWorld.getPosition(),p=c.dot(K.sub(n,b).normalize()),p<=0||(p*=l.distance==0?1:1-Math.min(b.distanceTo(n)/l.distance,1),p!=0&&(p*=l.intensity,e.r+=k.r*p,e.g+=k.g*p,e.b+=k.b*p)))}function c(a){N[a]==null&&(N[a]=document.createElementNS("http://www.w3.org/2000/svg",
+"path"),Z==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,v,p,x,w,z,u,B,y=new THREE.Rectangle,F=new THREE.Rectangle,C=!1,H=new THREE.Color,L=new THREE.Color,R=new THREE.Color,D=new THREE.Color,O,K=new THREE.Vector3,N=[],J=[],M,ea,ja,Z=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":Z=1;break;case "low":Z=0}};this.setSize=function(a,b){t=a;v=b;p=t/2;x=v/2;n.setAttribute("viewBox",-p+" "+-x+" "+t+" "+v);n.setAttribute("width",t);n.setAttribute("height",v);y.set(-p,-x,p,x)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(t,o){var v,K,G,X;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(t,o,this.sortElements);f=l.elements;
+h=l.lights;ja=ea=0;if(C=h.length>0){L.setRGB(0,0,0);R.setRGB(0,0,0);D.setRGB(0,0,0);v=0;for(K=h.length;v<K;v++)X=h[v],G=X.color,X instanceof THREE.AmbientLight?(L.r+=G.r,L.g+=G.g,L.b+=G.b):X instanceof THREE.DirectionalLight?(R.r+=G.r,R.g+=G.g,R.b+=G.b):X instanceof THREE.PointLight&&(D.r+=G.r,D.g+=G.g,D.b+=G.b)}v=0;for(K=f.length;v<K;v++)if(G=f[v],X=G.material,X=X instanceof THREE.MeshFaceMaterial?G.faceMaterial:X,!(X==null||X.opacity==0))if(F.empty(),G instanceof THREE.RenderableParticle)w=G,w.x*=
+p,w.y*=-x,m=0,ml=G.materials.length;else if(G instanceof THREE.RenderableLine){if(w=G.v1,z=G.v2,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),y.intersects(F)){G=w;var N=z,na=ja++;J[na]==null&&(J[na]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&J[na].setAttribute("shape-rendering","crispEdges"));M=J[na];M.setAttribute("x1",G.positionScreen.x);
+M.setAttribute("y1",G.positionScreen.y);M.setAttribute("x2",N.positionScreen.x);M.setAttribute("y2",N.positionScreen.y);X instanceof THREE.LineBasicMaterial&&(M.setAttribute("style","fill: none; stroke: "+X.color.getContextStyle()+"; stroke-width: "+X.linewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.linecap+"; stroke-linejoin: "+X.linejoin),n.appendChild(M))}}else if(G instanceof THREE.RenderableFace3){if(w=G.v1,z=G.v2,u=G.v3,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=
+p,z.positionScreen.y*=-x,u.positionScreen.x*=p,u.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(u.positionScreen.x,u.positionScreen.y),y.intersects(F)){var N=w,na=z,la=u;e.info.render.vertices+=3;e.info.render.faces++;M=c(ea++);M.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+na.positionScreen.x+" "+na.positionScreen.y+" L "+la.positionScreen.x+","+la.positionScreen.y+"z");X instanceof THREE.MeshBasicMaterial?
+H.copy(X.color):X instanceof THREE.MeshLambertMaterial?C?(H.r=L.r,H.g=L.g,H.b=L.b,a(h,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(X.color.r*H.r,1)),H.g=Math.max(0,Math.min(X.color.g*H.g,1)),H.b=Math.max(0,Math.min(X.color.b*H.b,1))):H.copy(X.color):X instanceof THREE.MeshDepthMaterial?(O=1-X.__2near/(X.__farPlusNear-G.z*X.__farMinusNear),H.setRGB(O,O,O)):X instanceof THREE.MeshNormalMaterial&&H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));X.wireframe?M.setAttribute("style",
+"fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+X.wireframeLinewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.wireframeLinecap+"; stroke-linejoin: "+X.wireframeLinejoin):M.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+X.opacity);n.appendChild(M)}}else if(G instanceof THREE.RenderableFace4&&(w=G.v1,z=G.v2,u=G.v3,B=G.v4,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,u.positionScreen.x*=p,u.positionScreen.y*=
+-x,B.positionScreen.x*=p,B.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(u.positionScreen.x,u.positionScreen.y),F.addPoint(B.positionScreen.x,B.positionScreen.y),y.intersects(F))){var N=w,na=z,la=u,ra=B;e.info.render.vertices+=4;e.info.render.faces++;M=c(ea++);M.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+na.positionScreen.x+" "+na.positionScreen.y+" L "+la.positionScreen.x+","+la.positionScreen.y+
+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");X instanceof THREE.MeshBasicMaterial?H.copy(X.color):X instanceof THREE.MeshLambertMaterial?C?(H.r=L.r,H.g=L.g,H.b=L.b,a(h,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(X.color.r*H.r,1)),H.g=Math.max(0,Math.min(X.color.g*H.g,1)),H.b=Math.max(0,Math.min(X.color.b*H.b,1))):H.copy(X.color):X instanceof THREE.MeshDepthMaterial?(O=1-X.__2near/(X.__farPlusNear-G.z*X.__farMinusNear),H.setRGB(O,O,O)):X instanceof THREE.MeshNormalMaterial&&
+H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));X.wireframe?M.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+X.wireframeLinewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.wireframeLinecap+"; stroke-linejoin: "+X.wireframeLinejoin):M.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+X.opacity);n.appendChild(M)}}};
 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",
@@ -226,123 +226,129 @@ THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"v
 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){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,p=n.length,t=a.__vertexArray,w=a.__colorArray,u=a.__sortArray,v=a.__dirtyVertices,x=a.__dirtyColors,M=a.__webglCustomAttributesList;if(c.sortParticles){ta.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=l[e].position,Ca.copy(f),ta.multiplyVector3(Ca),u[e]=[Ca.z,e];u.sort(function(a,b){return b[0]-a[0]});for(e=0;e<k;e++)f=l[u[e][1]].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;for(e=0;e<p;e++)h=e*3,color=n[u[e][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(M){n=0;for(p=M.length;n<
-p;n++)if(k=M[n],k.boundTo===void 0||k.boundTo==="vertices"){h=0;f=k.value.length;for(e=0;e<f;e++)index=u[e][1],k.size===1?k.array[h]=k.value[index]:(l=k.value[index],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}else{if(v)for(e=0;e<k;e++)f=l[e].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;if(x)for(e=
-0;e<p;e++)color=n[e],h=e*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(M){n=0;for(p=M.length;n<p;n++)if(k=M[n],k.__original.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices")){f=k.value.length;for(e=h=0;e<f;e++)offset_custom=k.offset,k.size===1?k.array[h]=k.value[e]:(l=k.value[e],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+
-2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}if(v||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,b);if(M){n=0;for(p=M.length;n<p;n++)if(k=M[n],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||R.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=
-new Float32Array(R.maxMorphTargets);for(var h=0,l=R.maxMorphTargets;h<l;h++)f.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,l=h.uniforms,n=e.uniforms;h!==pa&&(o.useProgram(h),pa=h,k=!0);if(e.id!==V)V=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,sa);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 p,t,w=0,u=0,v=0,x,y,A,Q=Ia,$=Q.directional.colors,z=Q.directional.positions,B=Q.point.colors,C=Q.point.positions,D=Q.point.distances,U=0,H=0,c=p=A=0,k=b.length;c<k;c++)if(p=b[c],t=p.color,x=p.position,y=p.intensity,A=p.distance,p instanceof THREE.AmbientLight)R.gammaInput?(w+=t.r*t.r,u+=t.g*t.g,v+=t.b*t.b):(w+=t.r,u+=t.g,v+=t.b);else if(p instanceof THREE.DirectionalLight)A=U*3,R.gammaInput?($[A]=t.r*t.r*y*y,$[A+1]=t.g*t.g*y*y,$[A+2]=t.b*t.b*y*y):($[A]=t.r*y,$[A+1]=t.g*y,$[A+2]=
-t.b*y),z[A]=x.x,z[A+1]=x.y,z[A+2]=x.z,U+=1;else if(p instanceof THREE.SpotLight)A=U*3,R.gammaInput?($[A]=t.r*t.r*y*y,$[A+1]=t.g*t.g*y*y,$[A+2]=t.b*t.b*y*y):($[A]=t.r*y,$[A+1]=t.g*y,$[A+2]=t.b*y),t=1/x.length(),z[A]=x.x*t,z[A+1]=x.y*t,z[A+2]=x.z*t,U+=1;else if(p instanceof THREE.PointLight)p=H*3,R.gammaInput?(B[p]=t.r*t.r*y*y,B[p+1]=t.g*t.g*y*y,B[p+2]=t.b*t.b*y*y):(B[p]=t.r*y,B[p+1]=t.g*y,B[p+2]=t.b*y),C[p]=x.x,C[p+1]=x.y,C[p+2]=x.z,D[H]=A,H+=1;c=U*3;for(k=$.length;c<k;c++)$[c]=0;c=H*3;for(k=B.length;c<
-k;c++)B[c]=0;Q.point.length=H;Q.directional.length=U;Q.ambient[0]=w;Q.ambient[1]=u;Q.ambient[2]=v;b=Ia;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,R.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=M.height/2,n.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)n.shininess.value=e.shininess,R.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)R.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<va.length;b++)n.shadowMatrix.value[b]=va[b],n.shadowMap.texture[b]=R.shadowMap[b];
-n.shadowDarkness.value=R.shadowMapDarkness;n.shadowBias.value=R.shadowMapBias}b=e.uniformsList;n=0;for(c=b.length;n<c;n++)if(u=h.uniforms[b[n][1]])if(w=b[n][0],v=w.type,k=w.value,v==="i")o.uniform1i(u,k);else if(v==="f")o.uniform1f(u,k);else if(v==="v2")o.uniform2f(u,k.x,k.y);else if(v==="v3")o.uniform3f(u,k.x,k.y,k.z);else if(v==="v4")o.uniform4f(u,k.x,k.y,k.z,k.w);else if(v==="c")o.uniform3f(u,k.r,k.g,k.b);else if(v==="fv1")o.uniform1fv(u,k);else if(v==="fv")o.uniform3fv(u,k);else if(v==="v3v"){if(!w._array)w._array=
-new Float32Array(3*k.length);v=0;for(x=k.length;v<x;v++)Q=v*3,w._array[Q]=k[v].x,w._array[Q+1]=k[v].y,w._array[Q+2]=k[v].z;o.uniform3fv(u,w._array)}else if(v==="m4"){if(!w._array)w._array=new Float32Array(16);k.flattenToArray(w._array);o.uniformMatrix4fv(u,!1,w._array)}else if(v==="m4v"){if(!w._array)w._array=new Float32Array(16*k.length);v=0;for(x=k.length;v<x;v++)k[v].flattenToArrayOffset(w._array,v*16);o.uniformMatrix4fv(u,!1,w._array)}else if(v==="t"){if(o.uniform1i(u,k),u=w.texture)if(u.image instanceof
-Array&&u.image.length===6){if(w=u,w.image.length===6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,w.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,w.image[k]);F(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else u instanceof
-THREE.WebGLRenderTargetCube?(w=u,o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):O(u,k)}else if(v==="tv"){if(!w._array){w._array=[];v=0;for(x=w.texture.length;v<x;v++)w._array[v]=k+v}o.uniform1iv(u,w._array);v=0;for(x=w.texture.length;v<x;v++)(u=w.texture[v])&&O(u,w._array[v])}(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,Aa);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,Aa),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!==Z&&(Z=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]),
+k=l.length,n=a.colors,p=n.length,t=a.__vertexArray,w=a.__colorArray,v=a.__sortArray,u=a.__dirtyVertices,x=a.__dirtyColors,$=a.__webglCustomAttributesList;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)f=l[e].position,Aa.copy(f),qa.multiplyVector3(Aa),v[e]=[Aa.z,e];v.sort(function(a,b){return b[0]-a[0]});for(e=0;e<k;e++)f=l[v[e][1]].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;for(e=0;e<p;e++)h=e*3,color=n[v[e][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if($){n=0;for(p=$.length;n<
+p;n++)if(k=$[n],k.boundTo===void 0||k.boundTo==="vertices"){h=0;f=k.value.length;for(e=0;e<f;e++)index=v[e][1],k.size===1?k.array[h]=k.value[index]:(l=k.value[index],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}else{if(u)for(e=0;e<k;e++)f=l[e].position,h=e*3,t[h]=f.x,t[h+1]=f.y,t[h+2]=f.z;if(x)for(e=
+0;e<p;e++)color=n[e],h=e*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if($){n=0;for(p=$.length;n<p;n++)if(k=$[n],k.__original.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices")){f=k.value.length;for(e=h=0;e<f;e++)offset_custom=k.offset,k.size===1?k.array[h]=k.value[e]:(l=k.value[e],k.size===2?(k.array[h]=l.x,k.array[h+1]=l.y):k.size===3?k.type==="c"?(k.array[h]=l.r,k.array[h+1]=l.g,k.array[h+2]=l.b):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+2]=l.z):(k.array[h]=l.x,k.array[h+1]=l.y,k.array[h+
+2]=l.z,k.array[h+3]=l.w)),h+=k.size}}}if(u||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,b);if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,a.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,b);if($){n=0;for(p=$.length;n<p;n++)if(k=$[n],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||U.initMaterial(e,b,c,f);if(e.morphTargets&&!f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=
+new Float32Array(U.maxMorphTargets);for(var h=0,l=U.maxMorphTargets;h<l;h++)f.__webglMorphTargetInfluences[h]=0}var k=!1,h=e.program,l=h.uniforms,n=e.uniforms;h!==pa&&(o.useProgram(h),pa=h,k=!0);if(e.id!==X)X=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,Ea);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 p,t,w=0,v=0,u=0,x,z,B,V=Ja,ca=V.directional.colors,y=V.directional.positions,C=V.point.colors,F=V.point.positions,H=V.point.distances,W=0,I=0,c=p=B=0,k=b.length;c<k;c++)if(p=b[c],t=p.color,x=p.position,z=p.intensity,B=p.distance,p instanceof THREE.AmbientLight)U.gammaInput?(w+=t.r*t.r,v+=t.g*t.g,u+=t.b*t.b):(w+=t.r,v+=t.g,u+=t.b);else if(p instanceof THREE.DirectionalLight)B=W*3,U.gammaInput?(ca[B]=t.r*t.r*z*z,ca[B+1]=t.g*t.g*z*z,ca[B+2]=t.b*t.b*z*z):(ca[B]=t.r*z,ca[B+1]=t.g*z,ca[B+
+2]=t.b*z),y[B]=x.x,y[B+1]=x.y,y[B+2]=x.z,W+=1;else if(p instanceof THREE.SpotLight)B=W*3,U.gammaInput?(ca[B]=t.r*t.r*z*z,ca[B+1]=t.g*t.g*z*z,ca[B+2]=t.b*t.b*z*z):(ca[B]=t.r*z,ca[B+1]=t.g*z,ca[B+2]=t.b*z),t=1/x.length(),y[B]=x.x*t,y[B+1]=x.y*t,y[B+2]=x.z*t,W+=1;else if(p instanceof THREE.PointLight)p=I*3,U.gammaInput?(C[p]=t.r*t.r*z*z,C[p+1]=t.g*t.g*z*z,C[p+2]=t.b*t.b*z*z):(C[p]=t.r*z,C[p+1]=t.g*z,C[p+2]=t.b*z),F[p]=x.x,F[p+1]=x.y,F[p+2]=x.z,H[I]=B,I+=1;c=W*3;for(k=ca.length;c<k;c++)ca[c]=0;c=I*3;
+for(k=C.length;c<k;c++)C[c]=0;V.point.length=I;V.directional.length=W;V.ambient[0]=w;V.ambient[1]=v;V.ambient[2]=u;b=Ja;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=$.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(f.receiveShadow&&!e._shadowPass&&n.shadowMatrix){for(b=0;b<Y.length;b++)n.shadowMatrix.value[b]=Y[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=h.uniforms[b[n][1]])if(w=b[n][0],u=w.type,k=w.value,u==="i")o.uniform1i(v,k);else if(u==="f")o.uniform1f(v,k);else if(u==="v2")o.uniform2f(v,k.x,k.y);else if(u==="v3")o.uniform3f(v,k.x,k.y,k.z);else if(u==="v4")o.uniform4f(v,k.x,k.y,k.z,k.w);else if(u==="c")o.uniform3f(v,k.r,k.g,k.b);else if(u==="fv1")o.uniform1fv(v,k);else if(u==="fv")o.uniform3fv(v,k);else if(u==="v3v"){if(!w._array)w._array=
+new Float32Array(3*k.length);u=0;for(x=k.length;u<x;u++)V=u*3,w._array[V]=k[u].x,w._array[V+1]=k[u].y,w._array[V+2]=k[u].z;o.uniform3fv(v,w._array)}else if(u==="m4"){if(!w._array)w._array=new Float32Array(16);k.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(u==="m4v"){if(!w._array)w._array=new Float32Array(16*k.length);u=0;for(x=k.length;u<x;u++)k[u].flattenToArrayOffset(w._array,u*16);o.uniformMatrix4fv(v,!1,w._array)}else if(u==="t"){if(o.uniform1i(v,k),v=w.texture)if(v.image instanceof
+Array&&v.image.length===6){if(w=v,w.image.length===6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+k);o.bindTexture(o.TEXTURE_CUBE_MAP,w.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,w.image[k]);O(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else v instanceof
+THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+k),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):K(v,k)}else if(u==="tv"){if(!w._array){w._array=[];u=0;for(x=w.texture.length;u<x;u++)w._array[u]=k+u}o.uniform1iv(v,w._array);u=0;for(x=w.texture.length;u<x;u++)(v=w.texture[u])&&K(v,w._array[u])}(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,ya);e.skinning&&(o.uniformMatrix4fv(l.cameraInverseMatrix,!1,ya),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!==aa&&(aa=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=[],t=-1,
-w=0;n=h.morphTargetInfluences;var u,v=n.length;k=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(u=0;u<v;u++)!p[u]&&n[u]>t&&(w=u,t=n[w]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=t;p[w]=1;t=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(e.program.uniforms.morphTargetInfluences,h.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){k=
+w=0;n=h.morphTargetInfluences;var v,u=n.length;k=0;for(h.morphTargetBase!==-1&&(p[h.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(v=0;v<u;v++)!p[v]&&n[v]>t&&(w=v,t=n[w]);o.bindBuffer(o.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(c["morphTarget"+k],3,o.FLOAT,!1,0,0);h.__webglMorphTargetInfluences[k]=t;p[w]=1;t=-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)),R.info.render.calls++,R.info.render.vertices+=f.__webglFaceCount,R.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),R.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),R.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),R.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,t,w,u,v=a.count*3;for(u=0;u<v;u+=9)c=a.normalArray,e=c[u],f=c[u+1],h=c[u+2],l=c[u+3],n=c[u+4],t=c[u+5],k=c[u+6],p=c[u+7],w=c[u+8],e=(e+l+k)/3,f=(f+n+p)/3,h=(h+t+w)/3,c[u]=e,c[u+1]=f,c[u+2]=h,c[u+3]=e,c[u+4]=f,c[u+5]=h,c[u+6]=e,c[u+7]=f,c[u+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(fa!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),fa=a.doubleSided;if(qa!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),qa=a.flipSided}function n(a){ca!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ca=a)}function t(a){ja!==a&&(o.depthMask(a),ja=a)}
-function u(a,b,c){na!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),na=a);if(a&&(da!==b||H!==c))o.polygonOffset(b,c),da=b,H=c}function p(a){ua[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ua[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ua[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ua[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ua[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ua[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+
-a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=ua[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function x(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=ua[e].x*b.n14+ua[e].y*b.n24+ua[e].z*b.n34+ua[e].w,a<=c)return!1;return!0}function w(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function y(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 v(a,b){return b.z-a.z}function A(a){var b,c,e,t=0,w,u,v,M,y=a.lights;ra||(ra=new THREE.PerspectiveCamera(R.shadowCameraFov,R.shadowMapWidth/R.shadowMapHeight,R.shadowCameraNear,R.shadowCameraFar));b=0;for(c=y.length;b<c;b++)if(e=y[b],e instanceof THREE.SpotLight&&e.castShadow){V=
--1;R.shadowMap[t]||(R.shadowMap[t]=new THREE.WebGLRenderTarget(R.shadowMapWidth,R.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));va[t]||(va[t]=new THREE.Matrix4);w=R.shadowMap[t];u=va[t];ra.position.copy(e.position);ra.lookAt(e.target.position);ra.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ra));this.autoUpdateScene&&a.updateMatrixWorld();ra.matrixWorldInverse.getInverse(ra.matrixWorld);u.set(0.5,0,0,0.5,0,0.5,
-0,0.5,0,0,0.5,0.5,0,0,0,1);u.multiplySelf(ra.projectionMatrix);u.multiplySelf(ra.matrixWorldInverse);ra.matrixWorldInverse.flattenToArray(Aa);ra.projectionMatrix.flattenToArray(sa);ta.multiply(ra.projectionMatrix,ra.matrixWorldInverse);p(ta);J(w);o.clearColor(1,1,1,1);R.clear();o.clearColor(la.r,la.g,la.b,ia);u=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(w=0;w<u;w++)v=a.__webglObjects[w],M=v.object,M.visible&&M.castShadow?!(M instanceof THREE.Mesh)||!M.frustumCulled||x(M)?(M.matrixWorld.flattenToArray(M._objectMatrixArray),
-C(M,ra,!1),v.render=!0):v.render=!1:v.render=!1;n(!0);I(THREE.NormalBlending);for(w=0;w<u;w++)if(v=a.__webglObjects[w],v.render)M=v.object,buffer=v.buffer,k(M),v=M.customDepthMaterial?M.customDepthMaterial:M.geometry.morphTargets.length?Fa:Da,f(ra,y,null,v,buffer,M);for(w=0;w<e;w++)v=a.__webglObjectsImmediate[w],M=v.object,M.visible&&M.castShadow&&(M.matrixAutoUpdate&&M.matrixWorld.flattenToArray(M._objectMatrixArray),Z=-1,C(M,ra,!1),k(M),program=l(ra,y,null,Da,M),M.immediateRenderCallback?M.immediateRenderCallback(program,
-o,ua):M.render(function(a){h(a,program,Da.shading)}));t++}}function z(a,b){var c,e,f;c=X.attributes;var h=X.uniforms,l=ya/W,k,n=[],t=W*0.5,w=ya*0.5,p=!0;o.useProgram(X.program);pa=X.program;Z=ca=Y=-1;Ha||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ha=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.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,X.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,sa);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(v);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-t)/t,(w-f.position.y)/w,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?ya: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&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),I(f.blending),O(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ja)}function C(a,
-b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function B(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 I(a){if(a!==Y){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)}Y=a}}function F(a,b,c){(c.width&c.width-
-1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,aa(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,aa(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,aa(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,aa(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,ma(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ma(b.minFilter)))}function O(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
-!0,a.__webglTexture=o.createTexture(),R.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,aa(a.format),a.image.width,a.image.height,0,aa(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);F(o.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+b),o.bindTexture(o.TEXTURE_2D,a.__webglTexture)}function G(a,b){o.bindRenderbuffer(o.RENDERBUFFER,
+(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)),U.info.render.calls++,U.info.render.vertices+=f.__webglFaceCount,U.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),U.info.render.calls++):h instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,f.__webglParticleCount),U.info.render.calls++):h instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,f.__webglVertexCount),U.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,t,w,v,u=a.count*3;for(v=0;v<u;v+=9)c=a.normalArray,e=c[v],f=c[v+1],h=c[v+2],l=c[v+3],n=c[v+4],t=c[v+5],k=c[v+6],p=c[v+7],w=c[v+8],e=(e+l+k)/3,f=(f+n+p)/3,h=(h+t+w)/3,c[v]=e,c[v+1]=f,c[v+2]=h,c[v+3]=e,c[v+4]=f,c[v+5]=h,c[v+6]=e,c[v+7]=f,c[v+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(la!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),la=a.doubleSided;if(ra!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),ra=a.flipSided}function n(a){da!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),da=a)}function t(a){S!==a&&(o.depthMask(a),S=a)}function v(a,
+b,c){fa!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),fa=a);if(a&&(ha!==b||I!==c))o.polygonOffset(b,c),ha=b,I=c}function p(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 x(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 w(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,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 u(a,b){return b.z-a.z}function B(a){var b,c,e,t=0,w,v,u,$,z=a.lights;ua||(ua=new THREE.PerspectiveCamera(U.shadowCameraFov,U.shadowMapWidth/U.shadowMapHeight,U.shadowCameraNear,U.shadowCameraFar));b=0;for(c=z.length;b<c;b++)if(e=z[b],e instanceof THREE.SpotLight&&e.castShadow){X=
+-1;U.shadowMap[t]||(U.shadowMap[t]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Y[t]||(Y[t]=new THREE.Matrix4);w=U.shadowMap[t];v=Y[t];ua.position.copy(e.position);ua.lookAt(e.target.position);ua.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(ua));this.autoUpdateScene&&a.updateMatrixWorld();ua.matrixWorldInverse.getInverse(ua.matrixWorld);v.set(0.5,0,0,0.5,0,0.5,0,
+0.5,0,0,0.5,0.5,0,0,0,1);v.multiplySelf(ua.projectionMatrix);v.multiplySelf(ua.matrixWorldInverse);ua.matrixWorldInverse.flattenToArray(ya);ua.projectionMatrix.flattenToArray(Ea);qa.multiply(ua.projectionMatrix,ua.matrixWorldInverse);p(qa);J(w);o.clearColor(1,1,1,1);U.clear();o.clearColor(ga.r,ga.g,ga.b,oa);v=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(w=0;w<v;w++)u=a.__webglObjects[w],$=u.object,$.visible&&$.castShadow?!($ instanceof THREE.Mesh)||!$.frustumCulled||x($)?($.matrixWorld.flattenToArray($._objectMatrixArray),
+F($,ua,!1),u.render=!0):u.render=!1:u.render=!1;n(!0);D(THREE.NormalBlending);for(w=0;w<v;w++)if(u=a.__webglObjects[w],u.render)$=u.object,buffer=u.buffer,k($),u=$.customDepthMaterial?$.customDepthMaterial:$.geometry.morphTargets.length?Fa:Ha,f(ua,z,null,u,buffer,$);for(w=0;w<e;w++)u=a.__webglObjectsImmediate[w],$=u.object,$.visible&&$.castShadow&&($.matrixAutoUpdate&&$.matrixWorld.flattenToArray($._objectMatrixArray),aa=-1,F($,ua,!1),k($),program=l(ua,z,null,Ha,$),$.immediateRenderCallback?$.immediateRenderCallback(program,
+o,sa):$.render(function(a){h(a,program,Ha.shading)}));t++}}function y(a,b){var c,e,f;c=T.attributes;var h=T.uniforms,l=wa/ma,k,n=[],t=ma*0.5,w=wa*0.5,p=!0;o.useProgram(T.program);pa=T.program;aa=da=ia=-1;Ga||(o.enableVertexAttribArray(T.attributes.position),o.enableVertexAttribArray(T.attributes.uv),Ga=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,T.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,T.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Ea);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(u);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-t)/t,(w-f.position.y)/w,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?wa: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&&!p?(o.enable(o.DEPTH_TEST),p=!0):!f.mergeWith3D&&p&&(o.disable(o.DEPTH_TEST),p=!1),D(f.blending),K(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(S)}function F(a,
+b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function C(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function H(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function L(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function R(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}
+function D(a){if(a!==ia){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)}ia=a}}function O(a,b,c){(c.width&c.width-
+1)===0&&(c.height&c.height-1)===0?(o.texParameteri(a,o.TEXTURE_WRAP_S,Z(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Z(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Z(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,Z(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,ja(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,ja(b.minFilter)))}function K(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,Z(a.format),a.image.width,a.image.height,0,Z(a.format),o.UNSIGNED_BYTE,a.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a.image);O(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 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=o.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];o.bindTexture(o.TEXTURE_CUBE_MAP,a.__webglTexture);F(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,aa(a.format),a.width,a.height,0,aa(a.format),aa(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);G(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=o.createFramebuffer(),a.__webglRenderbuffer=o.createRenderbuffer(),o.bindTexture(o.TEXTURE_2D,a.__webglTexture),F(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,aa(a.format),a.width,a.height,0,aa(a.format),aa(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),G(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=W,a=ya,e=oa,f=ga);b!==N&&(o.bindFramebuffer(o.FRAMEBUFFER,b),
-o.viewport(e,f,c,a),N=b)}function L(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 ea(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 ma(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function aa(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;
+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);O(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,Z(a.format),a.width,a.height,0,Z(a.format),Z(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),O(o.TEXTURE_2D,a,a),o.texImage2D(o.TEXTURE_2D,0,Z(a.format),a.width,a.height,0,Z(a.format),Z(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=ma,a=wa,e=Q,f=ka);b!==G&&(o.bindFramebuffer(o.FRAMEBUFFER,b),
+o.viewport(e,f,c,a),G=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 ea(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 ja(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Z(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 R=this,o,T=[],pa=null,N=null,V=-1,Z=null,ka=0,fa=null,qa=null,Y=null,ca=null,ja=null,na=null,da=null,H=null,oa=0,ga=0,W=0,ya=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,sa=new Float32Array(16),
-Aa=new Float32Array(16),Ca=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},M=a.canvas!==void 0?a.canvas:document.createElement("canvas"),$=a.stencil!==void 0?a.stencil:!0,Q=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,U=a.antialias!==void 0?a.antialias:!1,la=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ia=a.clearAlpha!==void 0?a.clearAlpha:0,ha=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=M;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 ra,va=[],a=THREE.ShaderLib.depthRGBA,wa=THREE.UniformsUtils.clone(a.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa}),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:wa,morphTargets:!0});Da._shadowPass=!0;Fa._shadowPass=!0;try{if(!(o=M.getContext("experimental-webgl",{antialias:U,stencil:$,
-preserveDrawingBuffer:Q})))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(la.r,la.g,la.b,ia);this.context=o;var Ea=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);$=0;X.vertices[$++]=-1;X.vertices[$++]=-1;X.vertices[$++]=0;X.vertices[$++]=1;X.vertices[$++]=1;X.vertices[$++]=-1;X.vertices[$++]=1;X.vertices[$++]=1;X.vertices[$++]=1;X.vertices[$++]=1;X.vertices[$++]=1;X.vertices[$++]=0;X.vertices[$++]=-1;X.vertices[$++]=1;X.vertices[$++]=0;$=X.vertices[$++]=0;X.faces[$++]=
-0;X.faces[$++]=1;X.faces[$++]=2;X.faces[$++]=0;X.faces[$++]=2;X.faces[$++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,ea("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,ea("vertex",THREE.ShaderLib.sprite.vertexShader));
-o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program,"uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program,"alignment");X.uniforms.color=o.getUniformLocation(X.program,
-"color");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program,"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program,
-"projectionMatrix");var Ha=!1;this.setSize=function(a,b){M.width=a;M.height=b;this.setViewport(0,0,M.width,M.height)};this.setViewport=function(a,b,c,e){oa=a;ga=b;W=c;ya=e;o.viewport(oa,ga,W,ya)};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){la.setHex(a);ia=b;o.clearColor(la.r,la.g,la.b,ia)};this.setClearColor=function(a,b){la.copy(a);ia=b;o.clearColor(la.r,la.g,la.b,
-ia)};this.getClearColor=function(){return la};this.getClearAlpha=function(){return ia};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]);R.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,o.deleteBuffer(a.__webglVertexBuffer),o.deleteBuffer(a.__webglColorBuffer),
-R.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,o.deleteTexture(a.__webglTexture),R.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 t,w,p;t=p=n=0;for(w=b.length;t<w;t++)l=b[t],l instanceof THREE.SpotLight&&p++,l instanceof THREE.DirectionalLight&&p++,l instanceof THREE.PointLight&&n++;n+p<=ha?t=p:(t=Math.ceil(ha*p/(n+p)),n=ha-t);l={directional:t,point:n};n=p=0;for(t=b.length;n<t;n++)w=b[n],w instanceof THREE.SpotLight&&w.castShadow&&
-p++;var u=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)u=e.bones.length;var v;a:{t=a.fragmentShader;w=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:u,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},x,e=[];k?e.push(k):(e.push(t),e.push(w));for(x in c)e.push(x),e.push(c[x]);k=e.join();x=0;for(e=T.length;x<e;x++)if(T[x].code===k){v=T[x].program;break a}x=o.createProgram();e=[Ea?"#define VERTEX_TEXTURES":"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.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.perPixel?"#define PHONG_PER_PIXEL":"",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:"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.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":
+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,P=[],pa=null,G=null,X=-1,aa=null,na=0,la=null,ra=null,ia=null,da=null,S=null,fa=null,ha=null,I=null,Q=0,ka=0,ma=0,wa=0,sa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],qa=new THREE.Matrix4,Ea=new Float32Array(16),
+ya=new Float32Array(16),Aa=new THREE.Vector4,Ja={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ca=a.stencil!==void 0?a.stencil:!0,V=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,W=a.antialias!==void 0?a.antialias:!1,ga=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),oa=a.clearAlpha!==void 0?a.clearAlpha:0,ta=a.maxLights!==
+void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=$;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 ua,Y=[],a=THREE.ShaderLib.depthRGBA,Ba=THREE.UniformsUtils.clone(a.uniforms),Ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ba}),Fa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Ba,morphTargets:!0});Ha._shadowPass=!0;Fa._shadowPass=!0;try{if(!(o=$.getContext("experimental-webgl",
+{antialias:W,stencil:ca,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(xa){console.error(xa)}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(ga.r,ga.g,ga.b,oa);this.context=o;var Ca=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);ca=0;T.vertices[ca++]=-1;T.vertices[ca++]=-1;T.vertices[ca++]=0;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=-1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=1;T.vertices[ca++]=0;T.vertices[ca++]=-1;T.vertices[ca++]=1;T.vertices[ca++]=
+0;ca=T.vertices[ca++]=0;T.faces[ca++]=0;T.faces[ca++]=1;T.faces[ca++]=2;T.faces[ca++]=0;T.faces[ca++]=2;T.faces[ca++]=3;T.vertexBuffer=o.createBuffer();T.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,T.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,T.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,T.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,T.faces,o.STATIC_DRAW);T.program=o.createProgram();o.attachShader(T.program,ea("fragment",THREE.ShaderLib.sprite.fragmentShader));
+o.attachShader(T.program,ea("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.position=o.getAttribLocation(T.program,"position");T.attributes.uv=o.getAttribLocation(T.program,"uv");T.uniforms.uvOffset=o.getUniformLocation(T.program,"uvOffset");T.uniforms.uvScale=o.getUniformLocation(T.program,"uvScale");T.uniforms.rotation=o.getUniformLocation(T.program,"rotation");T.uniforms.scale=o.getUniformLocation(T.program,"scale");T.uniforms.alignment=
+o.getUniformLocation(T.program,"alignment");T.uniforms.color=o.getUniformLocation(T.program,"color");T.uniforms.map=o.getUniformLocation(T.program,"map");T.uniforms.opacity=o.getUniformLocation(T.program,"opacity");T.uniforms.useScreenCoordinates=o.getUniformLocation(T.program,"useScreenCoordinates");T.uniforms.affectedByDistance=o.getUniformLocation(T.program,"affectedByDistance");T.uniforms.screenPosition=o.getUniformLocation(T.program,"screenPosition");T.uniforms.modelViewMatrix=o.getUniformLocation(T.program,
+"modelViewMatrix");T.uniforms.projectionMatrix=o.getUniformLocation(T.program,"projectionMatrix");var Ga=!1;this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,e){Q=a;ka=b;ma=c;wa=e;o.viewport(Q,ka,ma,wa)};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){ga.setHex(a);oa=b;o.clearColor(ga.r,ga.g,ga.b,oa)};
+this.setClearColor=function(a,b){ga.copy(a);oa=b;o.clearColor(ga.r,ga.g,ga.b,oa)};this.getClearColor=function(){return ga};this.getClearAlpha=function(){return oa};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 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 t,w,p;t=p=n=0;for(w=b.length;t<w;t++)l=b[t],l instanceof THREE.SpotLight&&p++,l instanceof THREE.DirectionalLight&&p++,l instanceof THREE.PointLight&&n++;n+p<=ta?t=p:(t=Math.ceil(ta*p/
+(n+p)),n=ta-t);l={directional:t,point:n};n=p=0;for(t=b.length;n<t;n++)w=b[n],w instanceof THREE.SpotLight&&w.castShadow&&p++;var v=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)v=e.bones.length;var u;a:{t=a.fragmentShader;w=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: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},x,e=[];k?e.push(k):(e.push(t),e.push(w));for(x in c)e.push(x),e.push(c[x]);k=e.join();x=0;for(e=P.length;x<e;x++)if(P[x].code===k){u=P[x].program;break a}x=o.createProgram();e=[Ca?"#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.perPixel?"#define PHONG_PER_PIXEL":
+"",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:"",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(x,ea("fragment",l+t));o.attachShader(x,
-ea("vertex",e+w));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 M,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(M in n)e.push(M);M=e;e=0;for(n=M.length;e<n;e++)t=M[e],x.uniforms[t]=o.getUniformLocation(x,
-t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(M=0;M<c.maxMorphTargets;M++)e.push("morphTarget"+M);for(v in b)e.push(v);v=e;M=0;for(b=v.length;M<b;M++)c=v[M],x.attributes[c]=o.getAttribLocation(x,c);x.id=T.length;T.push({program:x,code:k});R.info.memory.programs=T.length;v=x}a.program=v;v=a.program.attributes;v.position>=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);
-v.tangent>=0&&o.enableVertexAttribArray(v.tangent);a.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA),o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(a.attributes)for(h in a.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)M="morphTarget"+h,v[M]>=0&&(o.enableVertexAttribArray(v[M]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){J(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){A(a,b)};this.render=function(a,b,c,e){var M,Q,$,B,D,U,H,K=a.lights,ia=a.fog;V=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&A(a,b);R.info.render.calls=0;R.info.render.vertices=0;R.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(Aa);b.projectionMatrix.flattenToArray(sa);ta.multiply(b.projectionMatrix,b.matrixWorldInverse);p(ta);J(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);$=a.__webglObjects.length;for(e=0;e<$;e++)if(D=a.__webglObjects[e],U=D.object,U.visible)if(!(U instanceof THREE.Mesh)||!U.frustumCulled||x(U)){if(U.matrixWorld.flattenToArray(U._objectMatrixArray),
-C(U,b,!0),y(D),D.render=!0,this.sortObjects)U.renderDepth?D.z=U.renderDepth:(Ca.copy(U.position),ta.multiplyVector3(Ca),D.z=Ca.z)}else D.render=!1;else D.render=!1;this.sortObjects&&a.__webglObjects.sort(v);B=a.__webglObjectsImmediate.length;for(e=0;e<B;e++)D=a.__webglObjectsImmediate[e],U=D.object,U.visible&&(U.matrixAutoUpdate&&U.matrixWorld.flattenToArray(U._objectMatrixArray),C(U,b,!0),w(D));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);I(a.overrideMaterial.blending);for(e=0;e<$;e++)if(D=
-a.__webglObjects[e],D.render)U=D.object,H=D.buffer,k(U),f(b,K,ia,a.overrideMaterial,H,U);for(e=0;e<B;e++)D=a.__webglObjectsImmediate[e],U=D.object,U.visible&&(Z=-1,k(U),M=l(b,K,ia,a.overrideMaterial,U),U.immediateRenderCallback?U.immediateRenderCallback(M,o,ua):U.render(function(b){h(b,M,a.overrideMaterial.shading)}))}else{I(THREE.NormalBlending);for(e=$-1;e>=0;e--)if(D=a.__webglObjects[e],D.render&&(U=D.object,H=D.buffer,Q=D.opaque))k(U),n(Q.depthTest),t(Q.depthWrite),u(Q.polygonOffset,Q.polygonOffsetFactor,
-Q.polygonOffsetUnits),f(b,K,ia,Q,H,U);for(e=0;e<B;e++)if(D=a.__webglObjectsImmediate[e],U=D.object,U.visible&&(Z=-1,Q=D.opaque))k(U),n(Q.depthTest),t(Q.depthWrite),u(Q.polygonOffset,Q.polygonOffsetFactor,Q.polygonOffsetUnits),M=l(b,K,ia,Q,U),U.immediateRenderCallback?U.immediateRenderCallback(M,o,ua):U.render(function(a){h(a,M,Q.shading)});for(e=0;e<$;e++)if(D=a.__webglObjects[e],D.render&&(U=D.object,H=D.buffer,Q=D.transparent))k(U),I(Q.blending),n(Q.depthTest),t(Q.depthWrite),u(Q.polygonOffset,
-Q.polygonOffsetFactor,Q.polygonOffsetUnits),f(b,K,ia,Q,H,U);for(e=0;e<B;e++)if(D=a.__webglObjectsImmediate[e],U=D.object,U.visible&&(Z=-1,Q=D.transparent))k(U),I(Q.blending),n(Q.depthTest),t(Q.depthWrite),u(Q.polygonOffset,Q.polygonOffsetFactor,Q.polygonOffsetUnits),M=l(b,K,ia,Q,U),U.immediateRenderCallback?U.immediateRenderCallback(M,o,ua):U.render(function(a){h(a,M,Q.shading)})}a.__webglSprites.length&&z(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&L(c)};this.initWebGLObjects=
+ea("vertex",e+w));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 $,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for($ in n)e.push($);$=e;e=0;for(n=$.length;e<n;e++)t=$[e],x.uniforms[t]=o.getUniformLocation(x,
+t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for($=0;$<c.maxMorphTargets;$++)e.push("morphTarget"+$);for(u in b)e.push(u);u=e;$=0;for(b=u.length;$<b;$++)c=u[$],x.attributes[c]=o.getAttribLocation(x,c);x.id=P.length;P.push({program:x,code:k});U.info.memory.programs=P.length;u=x}a.program=u;u=a.program.attributes;u.position>=0&&o.enableVertexAttribArray(u.position);u.color>=0&&o.enableVertexAttribArray(u.color);u.normal>=0&&o.enableVertexAttribArray(u.normal);
+u.tangent>=0&&o.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(o.enableVertexAttribArray(u.skinVertexA),o.enableVertexAttribArray(u.skinVertexB),o.enableVertexAttribArray(u.skinIndex),o.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(h in a.attributes)u[h]!==void 0&&u[h]>=0&&o.enableVertexAttribArray(u[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)$="morphTarget"+h,u[$]>=0&&(o.enableVertexAttribArray(u[$]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){J(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,e){var $,V,ca,C,H,W,Da,I=a.lights,L=a.fog;X=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(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(ya);b.projectionMatrix.flattenToArray(Ea);qa.multiply(b.projectionMatrix,b.matrixWorldInverse);p(qa);J(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);ca=a.__webglObjects.length;for(e=0;e<ca;e++)if(H=a.__webglObjects[e],W=H.object,W.visible)if(!(W instanceof THREE.Mesh)||!W.frustumCulled||x(W)){if(W.matrixWorld.flattenToArray(W._objectMatrixArray),
+F(W,b,!0),z(H),H.render=!0,this.sortObjects)W.renderDepth?H.z=W.renderDepth:(Aa.copy(W.position),qa.multiplyVector3(Aa),H.z=Aa.z)}else H.render=!1;else H.render=!1;this.sortObjects&&a.__webglObjects.sort(u);C=a.__webglObjectsImmediate.length;for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(W.matrixAutoUpdate&&W.matrixWorld.flattenToArray(W._objectMatrixArray),F(W,b,!0),w(H));if(a.overrideMaterial){n(a.overrideMaterial.depthTest);D(a.overrideMaterial.blending);for(e=0;e<ca;e++)if(H=
+a.__webglObjects[e],H.render)W=H.object,Da=H.buffer,k(W),f(b,I,L,a.overrideMaterial,Da,W);for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,k(W),$=l(b,I,L,a.overrideMaterial,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(b){h(b,$,a.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);for(e=ca-1;e>=0;e--)if(H=a.__webglObjects[e],H.render&&(W=H.object,Da=H.buffer,V=H.opaque))k(W),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,
+V.polygonOffsetUnits),f(b,I,L,V,Da,W);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,V=H.opaque))k(W),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),$=l(b,I,L,V,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(a){h(a,$,V.shading)});for(e=0;e<ca;e++)if(H=a.__webglObjects[e],H.render&&(W=H.object,Da=H.buffer,V=H.transparent))k(W),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,
+V.polygonOffsetFactor,V.polygonOffsetUnits),f(b,I,L,V,Da,W);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],W=H.object,W.visible&&(aa=-1,V=H.transparent))k(W),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),$=l(b,I,L,V,W),W.immediateRenderCallback?W.immediateRenderCallback($,o,sa):W.render(function(a){h(a,$,V.shading)})}a.__webglSprites.length&&y(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 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,t=void 0,p=void 0,w=void 0,u=void 0,v=void 0,x=void 0,M=void 0,y={},Q=n.morphTargets.length;n.geometryGroups={};t=0;for(p=n.faces.length;t<p;t++)w=n.faces[t],u=w.materialIndex,x=u!==void 0?u:-1,y[x]===void 0&&(y[x]={hash:x,counter:0}),M=y[x].hash+"_"+y[x].counter,n.geometryGroups[M]===void 0&&(n.geometryGroups[M]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:Q}),v=w instanceof THREE.Face3?3:4,n.geometryGroups[M].vertices+v>65535&&(y[x].counter+=1,M=y[x].hash+"_"+
-y[x].counter,n.geometryGroups[M]===void 0&&(n.geometryGroups[M]={faces3:[],faces4:[],materialIndex:u,vertices:0,numMorphTargets:Q})),w instanceof THREE.Face3?n.geometryGroups[M].faces3.push(t):n.geometryGroups[M].faces4.push(t),n.geometryGroups[M].vertices+=v;n.geometryGroupsList=[];t=void 0;for(t in n.geometryGroups)n.geometryGroups[t].id=ka++,n.geometryGroupsList.push(n.geometryGroups[t])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){t=n;t.__webglVertexBuffer=o.createBuffer();
+void 0){var n=k,t=void 0,p=void 0,w=void 0,v=void 0,u=void 0,x=void 0,$=void 0,z={},V=n.morphTargets.length;n.geometryGroups={};t=0;for(p=n.faces.length;t<p;t++)w=n.faces[t],v=w.materialIndex,x=v!==void 0?v:-1,z[x]===void 0&&(z[x]={hash:x,counter:0}),$=z[x].hash+"_"+z[x].counter,n.geometryGroups[$]===void 0&&(n.geometryGroups[$]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V}),u=w instanceof THREE.Face3?3:4,n.geometryGroups[$].vertices+u>65535&&(z[x].counter+=1,$=z[x].hash+"_"+
+z[x].counter,n.geometryGroups[$]===void 0&&(n.geometryGroups[$]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V})),w instanceof THREE.Face3?n.geometryGroups[$].faces3.push(t):n.geometryGroups[$].faces4.push(t),n.geometryGroups[$].vertices+=u;n.geometryGroupsList=[];t=void 0;for(t in n.geometryGroups)n.geometryGroups[t].id=na++,n.geometryGroupsList.push(n.geometryGroups[t])}for(l in k.geometryGroups)if(n=k.geometryGroups[l],!n.__webglVertexBuffer){t=n;t.__webglVertexBuffer=o.createBuffer();
 t.__webglNormalBuffer=o.createBuffer();t.__webglTangentBuffer=o.createBuffer();t.__webglColorBuffer=o.createBuffer();t.__webglUVBuffer=o.createBuffer();t.__webglUV2Buffer=o.createBuffer();t.__webglSkinVertexABuffer=o.createBuffer();t.__webglSkinVertexBBuffer=o.createBuffer();t.__webglSkinIndicesBuffer=o.createBuffer();t.__webglSkinWeightsBuffer=o.createBuffer();t.__webglFaceBuffer=o.createBuffer();t.__webglLineBuffer=o.createBuffer();if(t.numMorphTargets){w=p=void 0;t.__webglMorphTargetsBuffers=[];
-p=0;for(w=t.numMorphTargets;p<w;p++)t.__webglMorphTargetsBuffers.push(o.createBuffer())}R.info.memory.geometries++;u=f;v=u.geometry;p=n.faces3;x=n.faces4;t=p.length*3+x.length*4;w=p.length*1+x.length*2;x=p.length*3+x.length*4;p=b(u,n);M=p.map||p.lightMap||p instanceof THREE.ShaderMaterial?!0:!1;y=p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial?!1:p&&p.shading!==void 0&&p.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;Q=p.vertexColors?p.vertexColors:
-!1;n.__vertexArray=new Float32Array(t*3);if(y)n.__normalArray=new Float32Array(t*3);if(v.hasTangents)n.__tangentArray=new Float32Array(t*4);if(Q)n.__colorArray=new Float32Array(t*3);if(M){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(u.geometry.skinWeights.length&&u.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(t*4),n.__skinVertexBArray=new Float32Array(t*4),
-n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(w*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];u=0;for(v=n.numMorphTargets;u<v;u++)n.__morphTargetsArrays.push(new Float32Array(t*3))}n.__needsSmoothNormals=y===THREE.SmoothShading;n.__uvType=M;n.__vertexColorType=Q;n.__normalType=y;n.__webglFaceCount=w*3;n.__webglLineCount=x*2;if(p.attributes){if(n.__webglCustomAttributesList===void 0)n.__webglCustomAttributesList=
-[];w=void 0;for(w in p.attributes){var u=p.attributes[w],v={},A;for(A in u)v[A]=u[A];if(!v.__webglInitialized||v.createUniqueBuffers)v.__webglInitialized=!0,x=1,v.type==="v2"?x=2:v.type==="v3"?x=3:v.type==="v4"?x=4:v.type==="c"&&(x=3),v.size=x,v.array=new Float32Array(t*x),v.buffer=o.createBuffer(),v.buffer.belongsToAttribute=w,u.needsUpdate=!0,v.__original=u;n.__webglCustomAttributesList.push(v)}}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(),R.info.memory.geometries++,n=k,t=n.vertices.length,n.__vertexArray=new Float32Array(t*3),n.__colorArray=new Float32Array(t*3),n.__webglVertexCount=t,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(),R.info.memory.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglLineCount=p,c(n,t),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(),R.info.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),
-n.__colorArray=new Float32Array(p*3),n.__sortArray=[],n.__webglParticleCount=p,c(n,t),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(A=a.__webglObjects[f].object,l=A.geometry,k=w=p=void 0,A instanceof THREE.Mesh){n=0;for(t=l.geometryGroupsList.length;n<t;n++)if(p=l.geometryGroupsList[n],k=b(A,p),w=k.attributes&&B(k),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||w)if(w=o.DYNAMIC_DRAW,u=!l.dynamic,p.__inittedArrays){var $=x=
-v=void 0,z=void 0,U=void 0,C=void 0,H=void 0,ia=void 0,J=void 0,V=void 0,O=$=C=J=void 0,I=Q=y=M=void 0,oa=void 0,N=z=void 0,la=z=J=void 0,L=void 0,G=H=void 0,F=void 0,ga=void 0,T=void 0,W=z=ga=F=G=T=ga=F=G=T=ga=F=G=void 0,ha=void 0,X=C=void 0,ca=F=$=void 0,Z=void 0,va=O=F=ha=0,ea=0,aa=W=$=0,S=G=H=oa=0,Y=0,Y=void 0,ca=p.__vertexArray,ja=p.__uvArray,S=p.__uv2Array,X=p.__normalArray,U=p.__tangentArray,N=p.__colorArray,la=p.__skinVertexAArray,L=p.__skinVertexBArray,ia=p.__skinIndexArray,da=p.__skinWeightArray,
-ga=p.__morphTargetsArrays,ra=p.__webglCustomAttributesList,E=void 0,E=p.__faceArray,Y=p.__lineArray,na=p.__needsSmoothNormals,J=p.__vertexColorType,V=p.__uvType,C=p.__normalType,fa=A.geometry,ya=fa.__dirtyElements,ma=fa.__dirtyUvs,pa=fa.__dirtyNormals,ua=fa.__dirtyTangents,qa=fa.__dirtyColors,Z=fa.__dirtyMorphTargets,Da=fa.vertices,wa=p.faces3,ta=p.faces4,sa=fa.faces,Ca=fa.faceVertexUvs[0],Ba=fa.faceVertexUvs[1],Fa=fa.skinVerticesA,Ea=fa.skinVerticesB,Aa=fa.skinIndices,Ha=fa.skinWeights,T=fa.morphTargets;
-if(fa.__dirtyVertices){v=0;for(x=wa.length;v<x;v++)z=sa[wa[v]],M=Da[z.a].position,y=Da[z.b].position,Q=Da[z.c].position,ca[F]=M.x,ca[F+1]=M.y,ca[F+2]=M.z,ca[F+3]=y.x,ca[F+4]=y.y,ca[F+5]=y.z,ca[F+6]=Q.x,ca[F+7]=Q.y,ca[F+8]=Q.z,F+=9;v=0;for(x=ta.length;v<x;v++)z=sa[ta[v]],M=Da[z.a].position,y=Da[z.b].position,Q=Da[z.c].position,I=Da[z.d].position,ca[F]=M.x,ca[F+1]=M.y,ca[F+2]=M.z,ca[F+3]=y.x,ca[F+4]=y.y,ca[F+5]=y.z,ca[F+6]=Q.x,ca[F+7]=Q.y,ca[F+8]=Q.z,ca[F+9]=I.x,ca[F+10]=I.y,ca[F+11]=I.z,F+=12;o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,ca,w)}if(Z){v=0;for(x=wa.length;v<x;v++){z=sa[wa[v]];F=0;for(ca=T.length;F<ca;F++)M=T[F].vertices[z.a].position,y=T[F].vertices[z.b].position,Q=T[F].vertices[z.c].position,Z=ga[F],Z[G]=M.x,Z[G+1]=M.y,Z[G+2]=M.z,Z[G+3]=y.x,Z[G+4]=y.y,Z[G+5]=y.z,Z[G+6]=Q.x,Z[G+7]=Q.y,Z[G+8]=Q.z;G+=9}v=0;for(x=ta.length;v<x;v++){z=sa[ta[v]];F=0;for(ca=T.length;F<ca;F++)M=T[F].vertices[z.a].position,y=T[F].vertices[z.b].position,Q=T[F].vertices[z.c].position,I=T[F].vertices[z.d].position,
-Z=ga[F],Z[G]=M.x,Z[G+1]=M.y,Z[G+2]=M.z,Z[G+3]=y.x,Z[G+4]=y.y,Z[G+5]=y.z,Z[G+6]=Q.x,Z[G+7]=Q.y,Z[G+8]=Q.z,Z[G+9]=I.x,Z[G+10]=I.y,Z[G+11]=I.z;G+=12}F=0;for(ca=T.length;F<ca;F++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[F]),o.bufferData(o.ARRAY_BUFFER,ga[F],w)}if(Ha.length){v=0;for(x=wa.length;v<x;v++)z=sa[wa[v]],G=Ha[z.a],F=Ha[z.b],ga=Ha[z.c],da[H]=G.x,da[H+1]=G.y,da[H+2]=G.z,da[H+3]=G.w,da[H+4]=F.x,da[H+5]=F.y,da[H+6]=F.z,da[H+7]=F.w,da[H+8]=ga.x,da[H+9]=ga.y,da[H+10]=ga.z,da[H+11]=
-ga.w,G=Aa[z.a],F=Aa[z.b],ga=Aa[z.c],ia[H]=G.x,ia[H+1]=G.y,ia[H+2]=G.z,ia[H+3]=G.w,ia[H+4]=F.x,ia[H+5]=F.y,ia[H+6]=F.z,ia[H+7]=F.w,ia[H+8]=ga.x,ia[H+9]=ga.y,ia[H+10]=ga.z,ia[H+11]=ga.w,G=Fa[z.a],F=Fa[z.b],ga=Fa[z.c],la[H]=G.x,la[H+1]=G.y,la[H+2]=G.z,la[H+3]=1,la[H+4]=F.x,la[H+5]=F.y,la[H+6]=F.z,la[H+7]=1,la[H+8]=ga.x,la[H+9]=ga.y,la[H+10]=ga.z,la[H+11]=1,G=Ea[z.a],F=Ea[z.b],ga=Ea[z.c],L[H]=G.x,L[H+1]=G.y,L[H+2]=G.z,L[H+3]=1,L[H+4]=F.x,L[H+5]=F.y,L[H+6]=F.z,L[H+7]=1,L[H+8]=ga.x,L[H+9]=ga.y,L[H+10]=
-ga.z,L[H+11]=1,H+=12;v=0;for(x=ta.length;v<x;v++)z=sa[ta[v]],G=Ha[z.a],F=Ha[z.b],ga=Ha[z.c],T=Ha[z.d],da[H]=G.x,da[H+1]=G.y,da[H+2]=G.z,da[H+3]=G.w,da[H+4]=F.x,da[H+5]=F.y,da[H+6]=F.z,da[H+7]=F.w,da[H+8]=ga.x,da[H+9]=ga.y,da[H+10]=ga.z,da[H+11]=ga.w,da[H+12]=T.x,da[H+13]=T.y,da[H+14]=T.z,da[H+15]=T.w,G=Aa[z.a],F=Aa[z.b],ga=Aa[z.c],T=Aa[z.d],ia[H]=G.x,ia[H+1]=G.y,ia[H+2]=G.z,ia[H+3]=G.w,ia[H+4]=F.x,ia[H+5]=F.y,ia[H+6]=F.z,ia[H+7]=F.w,ia[H+8]=ga.x,ia[H+9]=ga.y,ia[H+10]=ga.z,ia[H+11]=ga.w,ia[H+12]=T.x,
-ia[H+13]=T.y,ia[H+14]=T.z,ia[H+15]=T.w,G=Fa[z.a],F=Fa[z.b],ga=Fa[z.c],T=Fa[z.d],la[H]=G.x,la[H+1]=G.y,la[H+2]=G.z,la[H+3]=1,la[H+4]=F.x,la[H+5]=F.y,la[H+6]=F.z,la[H+7]=1,la[H+8]=ga.x,la[H+9]=ga.y,la[H+10]=ga.z,la[H+11]=1,la[H+12]=T.x,la[H+13]=T.y,la[H+14]=T.z,la[H+15]=1,G=Ea[z.a],F=Ea[z.b],ga=Ea[z.c],z=Ea[z.d],L[H]=G.x,L[H+1]=G.y,L[H+2]=G.z,L[H+3]=1,L[H+4]=F.x,L[H+5]=F.y,L[H+6]=F.z,L[H+7]=1,L[H+8]=ga.x,L[H+9]=ga.y,L[H+10]=ga.z,L[H+11]=1,L[H+12]=z.x,L[H+13]=z.y,L[H+14]=z.z,L[H+15]=1,H+=16;H>0&&(o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,la,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,L,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ia,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,da,w))}if(qa&&J){v=0;for(x=wa.length;v<x;v++)z=sa[wa[v]],H=z.vertexColors,ia=z.color,H.length===3&&J===THREE.VertexColors?(z=H[0],la=H[1],L=H[2]):L=la=z=ia,N[oa]=z.r,N[oa+1]=z.g,
-N[oa+2]=z.b,N[oa+3]=la.r,N[oa+4]=la.g,N[oa+5]=la.b,N[oa+6]=L.r,N[oa+7]=L.g,N[oa+8]=L.b,oa+=9;v=0;for(x=ta.length;v<x;v++)z=sa[ta[v]],H=z.vertexColors,ia=z.color,H.length===4&&J===THREE.VertexColors?(z=H[0],la=H[1],L=H[2],H=H[3]):H=L=la=z=ia,N[oa]=z.r,N[oa+1]=z.g,N[oa+2]=z.b,N[oa+3]=la.r,N[oa+4]=la.g,N[oa+5]=la.b,N[oa+6]=L.r,N[oa+7]=L.g,N[oa+8]=L.b,N[oa+9]=H.r,N[oa+10]=H.g,N[oa+11]=H.b,oa+=12;oa>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,N,w))}if(ua&&fa.hasTangents){v=
-0;for(x=wa.length;v<x;v++)z=sa[wa[v]],J=z.vertexTangents,oa=J[0],z=J[1],N=J[2],U[W]=oa.x,U[W+1]=oa.y,U[W+2]=oa.z,U[W+3]=oa.w,U[W+4]=z.x,U[W+5]=z.y,U[W+6]=z.z,U[W+7]=z.w,U[W+8]=N.x,U[W+9]=N.y,U[W+10]=N.z,U[W+11]=N.w,W+=12;v=0;for(x=ta.length;v<x;v++)z=sa[ta[v]],J=z.vertexTangents,oa=J[0],z=J[1],N=J[2],J=J[3],U[W]=oa.x,U[W+1]=oa.y,U[W+2]=oa.z,U[W+3]=oa.w,U[W+4]=z.x,U[W+5]=z.y,U[W+6]=z.z,U[W+7]=z.w,U[W+8]=N.x,U[W+9]=N.y,U[W+10]=N.z,U[W+11]=N.w,U[W+12]=J.x,U[W+13]=J.y,U[W+14]=J.z,U[W+15]=J.w,W+=16;o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglTangentBuffer);o.bufferData(o.ARRAY_BUFFER,U,w)}if(pa&&C){v=0;for(x=wa.length;v<x;v++)if(z=sa[wa[v]],U=z.vertexNormals,C=z.normal,U.length===3&&na)for(W=0;W<3;W++)C=U[W],X[$]=C.x,X[$+1]=C.y,X[$+2]=C.z,$+=3;else for(W=0;W<3;W++)X[$]=C.x,X[$+1]=C.y,X[$+2]=C.z,$+=3;v=0;for(x=ta.length;v<x;v++)if(z=sa[ta[v]],U=z.vertexNormals,C=z.normal,U.length===4&&na)for(W=0;W<4;W++)C=U[W],X[$]=C.x,X[$+1]=C.y,X[$+2]=C.z,$+=3;else for(W=0;W<4;W++)X[$]=C.x,X[$+1]=C.y,X[$+2]=C.z,$+=3;o.bindBuffer(o.ARRAY_BUFFER,
-p.__webglNormalBuffer);o.bufferData(o.ARRAY_BUFFER,X,w)}if(ma&&Ca&&V){v=0;for(x=wa.length;v<x;v++)if($=wa[v],$=Ca[$],$!==void 0)for(W=0;W<3;W++)X=$[W],ja[O]=X.u,ja[O+1]=X.v,O+=2;v=0;for(x=ta.length;v<x;v++)if($=ta[v],$=Ca[$],$!==void 0)for(W=0;W<4;W++)X=$[W],ja[O]=X.u,ja[O+1]=X.v,O+=2;O>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ja,w))}if(ma&&Ba&&V){v=0;for(x=wa.length;v<x;v++)if($=wa[v],O=Ba[$],O!==void 0)for(W=0;W<3;W++)$=O[W],S[va]=$.u,S[va+1]=$.v,va+=2;v=0;
-for(x=ta.length;v<x;v++)if($=ta[v],O=Ba[$],O!==void 0)for(W=0;W<4;W++)$=O[W],S[va]=$.u,S[va+1]=$.v,va+=2;va>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,S,w))}if(ya){v=0;for(x=wa.length;v<x;v++)E[ea]=ha,E[ea+1]=ha+1,E[ea+2]=ha+2,ea+=3,Y[aa]=ha,Y[aa+1]=ha+1,Y[aa+2]=ha,Y[aa+3]=ha+2,Y[aa+4]=ha+1,Y[aa+5]=ha+2,aa+=6,ha+=3;v=0;for(x=ta.length;v<x;v++)E[ea]=ha,E[ea+1]=ha+1,E[ea+2]=ha+3,E[ea+3]=ha+1,E[ea+4]=ha+2,E[ea+5]=ha+3,ea+=6,Y[aa]=ha,Y[aa+1]=ha+1,Y[aa+2]=ha,Y[aa+3]=
-ha+3,Y[aa+4]=ha+1,Y[aa+5]=ha+2,Y[aa+6]=ha+2,Y[aa+7]=ha+3,aa+=8,ha+=4;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,E,w);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,Y,w)}if(ra){W=0;for(ha=ra.length;W<ha;W++)ra[W].offset=0,ra[W].offsetSrc=0;v=0;for(x=wa.length;v<x;v++){z=sa[wa[v]];W=0;for(ha=ra.length;W<ha;W++)if(E=ra[W],E.__original.needsUpdate)S=E.offset,Y=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo===
-"vertices"?(E.array[S]=E.value[z.a],E.array[S+1]=E.value[z.b],E.array[S+2]=E.value[z.c]):E.boundTo==="faces"?(Y=E.value[Y],E.array[S]=Y,E.array[S+1]=Y,E.array[S+2]=Y,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[S]=E.value[Y],E.array[S+1]=E.value[Y+1],E.array[S+2]=E.value[Y+2],E.offsetSrc+=3),E.offset+=3):(E.boundTo===void 0||E.boundTo==="vertices"?(M=E.value[z.a],y=E.value[z.b],Q=E.value[z.c]):E.boundTo==="faces"?(Q=y=M=Y=E.value[Y],E.offsetSrc++):E.boundTo==="faceVertices"&&(M=E.value[Y],
-y=E.value[Y+1],Q=E.value[Y+2],E.offsetSrc+=3),E.size===2?(E.array[S]=M.x,E.array[S+1]=M.y,E.array[S+2]=y.x,E.array[S+3]=y.y,E.array[S+4]=Q.x,E.array[S+5]=Q.y,E.offset+=6):E.size===3?(E.type==="c"?(E.array[S]=M.r,E.array[S+1]=M.g,E.array[S+2]=M.b,E.array[S+3]=y.r,E.array[S+4]=y.g,E.array[S+5]=y.b,E.array[S+6]=Q.r,E.array[S+7]=Q.g,E.array[S+8]=Q.b):(E.array[S]=M.x,E.array[S+1]=M.y,E.array[S+2]=M.z,E.array[S+3]=y.x,E.array[S+4]=y.y,E.array[S+5]=y.z,E.array[S+6]=Q.x,E.array[S+7]=Q.y,E.array[S+8]=Q.z),
-E.offset+=9):(E.array[S]=M.x,E.array[S+1]=M.y,E.array[S+2]=M.z,E.array[S+3]=M.w,E.array[S+4]=y.x,E.array[S+5]=y.y,E.array[S+6]=y.z,E.array[S+7]=y.w,E.array[S+8]=Q.x,E.array[S+9]=Q.y,E.array[S+10]=Q.z,E.array[S+11]=Q.w,E.offset+=12))}v=0;for(x=ta.length;v<x;v++){z=sa[ta[v]];W=0;for(ha=ra.length;W<ha;W++)if(E=ra[W],E.__original.needsUpdate)S=E.offset,Y=E.offsetSrc,E.size===1?(E.boundTo===void 0||E.boundTo==="vertices"?(E.array[S]=E.value[z.a],E.array[S+1]=E.value[z.b],E.array[S+2]=E.value[z.c],E.array[S+
-3]=E.value[z.d]):E.boundTo==="faces"?(Y=E.value[Y],E.array[S]=Y,E.array[S+1]=Y,E.array[S+2]=Y,E.array[S+3]=Y,E.offsetSrc++):E.boundTo==="faceVertices"&&(E.array[S]=E.value[Y],E.array[S+1]=E.value[Y+1],E.array[S+2]=E.value[Y+2],E.array[S+3]=E.value[Y+3],E.offsetSrc+=4),E.offset+=4):(E.boundTo===void 0||E.boundTo==="vertices"?(M=E.value[z.a],y=E.value[z.b],Q=E.value[z.c],I=E.value[z.d]):E.boundTo==="faces"?(I=Q=y=M=Y=E.value[Y],E.offsetSrc++):E.boundTo==="faceVertices"&&(M=E.value[Y],y=E.value[Y+1],
-Q=E.value[Y+2],I=E.value[Y+3],E.offsetSrc+=4),E.size===2?(E.array[S]=M.x,E.array[S+1]=M.y,E.array[S+2]=y.x,E.array[S+3]=y.y,E.array[S+4]=Q.x,E.array[S+5]=Q.y,E.array[S+6]=I.x,E.array[S+7]=I.y,E.offset+=8):E.size===3?(E.type==="c"?(E.array[S]=M.r,E.array[S+1]=M.g,E.array[S+2]=M.b,E.array[S+3]=y.r,E.array[S+4]=y.g,E.array[S+5]=y.b,E.array[S+6]=Q.r,E.array[S+7]=Q.g,E.array[S+8]=Q.b,E.array[S+9]=I.r,E.array[S+10]=I.g,E.array[S+11]=I.b):(E.array[S]=M.x,E.array[S+1]=M.y,E.array[S+2]=M.z,E.array[S+3]=y.x,
-E.array[S+4]=y.y,E.array[S+5]=y.z,E.array[S+6]=Q.x,E.array[S+7]=Q.y,E.array[S+8]=Q.z,E.array[S+9]=I.x,E.array[S+10]=I.y,E.array[S+11]=I.z),E.offset+=12):(E.array[S]=M.x,E.array[S+1]=M.y,E.array[S+2]=M.z,E.array[S+3]=M.w,E.array[S+4]=y.x,E.array[S+5]=y.y,E.array[S+6]=y.z,E.array[S+7]=y.w,E.array[S+8]=Q.x,E.array[S+9]=Q.y,E.array[S+10]=Q.z,E.array[S+11]=Q.w,E.array[S+12]=I.x,E.array[S+13]=I.y,E.array[S+14]=I.z,E.array[S+15]=I.w,E.offset+=16))}W=0;for(ha=ra.length;W<ha;W++)E=ra[W],E.__original.needsUpdate&&
-(o.bindBuffer(o.ARRAY_BUFFER,E.buffer),o.bufferData(o.ARRAY_BUFFER,E.array,w))}u&&(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&&D(k)}else if(A instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;A=o.DYNAMIC_DRAW;n=v=u=u=void 0;x=k.vertices;t=k.colors;M=x.length;p=t.length;y=k.__vertexArray;w=k.__colorArray;Q=k.__dirtyColors;if(k.__dirtyVertices){for(u=0;u<M;u++)v=x[u].position,n=u*3,y[n]=v.x,y[n+1]=v.y,y[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,y,A)}if(Q){for(u=0;u<p;u++)color=t[u],n=u*3,w[n]=color.r,w[n+1]=color.g,w[n+2]=
-color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,w,A)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(A instanceof THREE.Line){k=b(A,p);w=k.attributes&&B(k);if(l.__dirtyVertices||l.__dirtyColors||w){A=l;n=o.DYNAMIC_DRAW;t=ra=x=I=void 0;x=A.vertices;p=A.colors;M=x.length;w=p.length;y=A.__vertexArray;u=A.__colorArray;Q=A.__dirtyColors;v=A.__webglCustomAttributesList;ha=sa=ta=wa=ra=I=void 0;if(A.__dirtyVertices){for(I=0;I<M;I++)ra=x[I].position,t=I*3,y[t]=ra.x,y[t+
-1]=ra.y,y[t+2]=ra.z;o.bindBuffer(o.ARRAY_BUFFER,A.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,y,n)}if(Q){for(x=0;x<w;x++)color=p[x],t=x*3,u[t]=color.r,u[t+1]=color.g,u[t+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,A.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,u,n)}if(v){I=0;for(ra=v.length;I<ra;I++)if(ha=v[I],ha.__original.needsUpdate&&(ha.boundTo===void 0||ha.boundTo==="vertices")){t=0;ta=ha.value.length;for(wa=0;wa<ta;wa++)ha.size===1?ha.array[t]=ha.value[wa]:(sa=ha.value[wa],ha.size===2?(ha.array[t]=
-sa.x,ha.array[t+1]=sa.y):ha.size===3?ha.type==="c"?(ha.array[t]=sa.r,ha.array[t+1]=sa.g,ha.array[t+2]=sa.b):(ha.array[t]=sa.x,ha.array[t+1]=sa.y,ha.array[t+2]=sa.z):(ha.array[t]=sa.x,ha.array[t+1]=sa.y,ha.array[t+2]=sa.z,ha.array[t+3]=sa.w)),t+=ha.size;o.bindBuffer(o.ARRAY_BUFFER,ha.buffer);o.bufferData(o.ARRAY_BUFFER,ha.array,n)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;k.attributes&&D(k)}else if(A instanceof THREE.ParticleSystem)k=b(A,p),w=k.attributes&&B(k),(l.__dirtyVertices||l.__dirtyColors||
-A.sortParticles||w)&&e(l,o.DYNAMIC_DRAW,A),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 Ea}};
+p=0;for(w=t.numMorphTargets;p<w;p++)t.__webglMorphTargetsBuffers.push(o.createBuffer())}U.info.memory.geometries++;v=f;u=v.geometry;p=n.faces3;x=n.faces4;t=p.length*3+x.length*4;w=p.length*1+x.length*2;x=p.length*3+x.length*4;p=b(v,n);$=p.map||p.lightMap||p instanceof THREE.ShaderMaterial?!0:!1;z=p instanceof THREE.MeshBasicMaterial&&!p.envMap||p instanceof THREE.MeshDepthMaterial?!1:p&&p.shading!==void 0&&p.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;V=p.vertexColors?p.vertexColors:
+!1;n.__vertexArray=new Float32Array(t*3);if(z)n.__normalArray=new Float32Array(t*3);if(u.hasTangents)n.__tangentArray=new Float32Array(t*4);if(V)n.__colorArray=new Float32Array(t*3);if($){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(v.geometry.skinWeights.length&&v.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(t*4),n.__skinVertexBArray=new Float32Array(t*4),
+n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(w*3);n.__lineArray=new Uint16Array(x*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];v=0;for(u=n.numMorphTargets;v<u;v++)n.__morphTargetsArrays.push(new Float32Array(t*3))}n.__needsSmoothNormals=z===THREE.SmoothShading;n.__uvType=$;n.__vertexColorType=V;n.__normalType=z;n.__webglFaceCount=w*3;n.__webglLineCount=x*2;if(p.attributes){if(n.__webglCustomAttributesList===void 0)n.__webglCustomAttributesList=
+[];w=void 0;for(w in p.attributes){var v=p.attributes[w],u={},B;for(B in v)u[B]=v[B];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,x=1,u.type==="v2"?x=2:u.type==="v3"?x=3:u.type==="v4"?x=4:u.type==="c"&&(x=3),u.size=x,u.array=new Float32Array(t*x),u.buffer=o.createBuffer(),u.buffer.belongsToAttribute=w,v.needsUpdate=!0,u.__original=v;n.__webglCustomAttributesList.push(u)}}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(),U.info.memory.geometries++,n=k,t=n.vertices.length,n.__vertexArray=new Float32Array(t*3),n.__colorArray=new Float32Array(t*3),n.__webglVertexCount=t,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(),U.info.memory.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),n.__colorArray=new Float32Array(p*3),n.__webglLineCount=p,c(n,t),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(),U.info.geometries++,n=k,t=f,p=n.vertices.length,n.__vertexArray=new Float32Array(p*3),
+n.__colorArray=new Float32Array(p*3),n.__sortArray=[],n.__webglParticleCount=p,c(n,t),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],R(h.__webglObjects,n,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(k=f.geometry,R(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)L(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)&&
+L(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(B=a.__webglObjects[f].object,l=B.geometry,k=w=p=void 0,B instanceof THREE.Mesh){n=0;for(t=l.geometryGroupsList.length;n<t;n++)if(p=l.geometryGroupsList[n],k=b(B,p),w=k.attributes&&C(k),l.__dirtyVertices||l.__dirtyMorphTargets||l.__dirtyElements||l.__dirtyUvs||l.__dirtyNormals||l.__dirtyColors||l.__dirtyTangents||w)if(w=o.DYNAMIC_DRAW,v=!l.dynamic,p.__inittedArrays){var ca=
+x=u=void 0,y=void 0,W=void 0,F=void 0,I=void 0,oa=void 0,J=void 0,X=void 0,K=ca=F=J=void 0,D=void 0,Q=void 0,G=void 0,ga=void 0,M=void 0,N=y=void 0,O=y=J=void 0,ka=void 0,P=y=G=Q=D=ga=G=Q=D=ga=G=Q=D=ga=G=Q=D=I=void 0,ma=void 0,ta=F=void 0,T=ca=void 0,da=void 0,aa=void 0,Y=K=T=ma=0,ea=0,Z=P=ca=0,ia=I=M=0,E=0,S=0,ha=void 0,da=p.__vertexArray,ua=p.__uvArray,E=p.__uv2Array,ta=p.__normalArray,W=p.__tangentArray,N=p.__colorArray,O=p.__skinVertexAArray,ka=p.__skinVertexBArray,oa=p.__skinIndexArray,fa=p.__skinWeightArray,
+la=p.__morphTargetsArrays,$=p.__webglCustomAttributesList,A=void 0,A=p.__faceArray,S=p.__lineArray,wa=p.__needsSmoothNormals,J=p.__vertexColorType,X=p.__uvType,F=p.__normalType,ja=B.geometry,ha=ja.__dirtyElements,pa=ja.__dirtyUvs,sa=ja.__dirtyNormals,ra=ja.__dirtyTangents,Ha=ja.__dirtyColors,aa=ja.__dirtyMorphTargets,Ba=ja.vertices,z=p.faces3,V=p.faces4,qa=ja.faces,Ea=ja.faceVertexUvs[0],Aa=ja.faceVertexUvs[1],xa=ja.skinVerticesA,Fa=ja.skinVerticesB,Ca=ja.skinIndices,ya=ja.skinWeights,Ga=ja.morphTargets;
+if(ja.__dirtyVertices){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],D=Ba[y.a].position,Q=Ba[y.b].position,G=Ba[y.c].position,da[T]=D.x,da[T+1]=D.y,da[T+2]=D.z,da[T+3]=Q.x,da[T+4]=Q.y,da[T+5]=Q.z,da[T+6]=G.x,da[T+7]=G.y,da[T+8]=G.z,T+=9;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],D=Ba[y.a].position,Q=Ba[y.b].position,G=Ba[y.c].position,ga=Ba[y.d].position,da[T]=D.x,da[T+1]=D.y,da[T+2]=D.z,da[T+3]=Q.x,da[T+4]=Q.y,da[T+5]=Q.z,da[T+6]=G.x,da[T+7]=G.y,da[T+8]=G.z,da[T+9]=ga.x,da[T+10]=ga.y,da[T+11]=ga.z,T+=12;o.bindBuffer(o.ARRAY_BUFFER,
+p.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,da,w)}if(aa){u=0;for(x=z.length;u<x;u++){y=qa[z[u]];T=0;for(da=Ga.length;T<da;T++)D=Ga[T].vertices[y.a].position,Q=Ga[T].vertices[y.b].position,G=Ga[T].vertices[y.c].position,aa=la[T],aa[ia]=D.x,aa[ia+1]=D.y,aa[ia+2]=D.z,aa[ia+3]=Q.x,aa[ia+4]=Q.y,aa[ia+5]=Q.z,aa[ia+6]=G.x,aa[ia+7]=G.y,aa[ia+8]=G.z;ia+=9}u=0;for(x=V.length;u<x;u++){y=qa[V[u]];T=0;for(da=Ga.length;T<da;T++)D=Ga[T].vertices[y.a].position,Q=Ga[T].vertices[y.b].position,G=Ga[T].vertices[y.c].position,
+ga=Ga[T].vertices[y.d].position,aa=la[T],aa[ia]=D.x,aa[ia+1]=D.y,aa[ia+2]=D.z,aa[ia+3]=Q.x,aa[ia+4]=Q.y,aa[ia+5]=Q.z,aa[ia+6]=G.x,aa[ia+7]=G.y,aa[ia+8]=G.z,aa[ia+9]=ga.x,aa[ia+10]=ga.y,aa[ia+11]=ga.z;ia+=12}T=0;for(da=Ga.length;T<da;T++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[T]),o.bufferData(o.ARRAY_BUFFER,la[T],w)}if(ya.length){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],D=ya[y.a],Q=ya[y.b],G=ya[y.c],fa[I]=D.x,fa[I+1]=D.y,fa[I+2]=D.z,fa[I+3]=D.w,fa[I+4]=Q.x,fa[I+5]=Q.y,fa[I+6]=Q.z,fa[I+
+7]=Q.w,fa[I+8]=G.x,fa[I+9]=G.y,fa[I+10]=G.z,fa[I+11]=G.w,D=Ca[y.a],Q=Ca[y.b],G=Ca[y.c],oa[I]=D.x,oa[I+1]=D.y,oa[I+2]=D.z,oa[I+3]=D.w,oa[I+4]=Q.x,oa[I+5]=Q.y,oa[I+6]=Q.z,oa[I+7]=Q.w,oa[I+8]=G.x,oa[I+9]=G.y,oa[I+10]=G.z,oa[I+11]=G.w,D=xa[y.a],Q=xa[y.b],G=xa[y.c],O[I]=D.x,O[I+1]=D.y,O[I+2]=D.z,O[I+3]=1,O[I+4]=Q.x,O[I+5]=Q.y,O[I+6]=Q.z,O[I+7]=1,O[I+8]=G.x,O[I+9]=G.y,O[I+10]=G.z,O[I+11]=1,D=Fa[y.a],Q=Fa[y.b],G=Fa[y.c],ka[I]=D.x,ka[I+1]=D.y,ka[I+2]=D.z,ka[I+3]=1,ka[I+4]=Q.x,ka[I+5]=Q.y,ka[I+6]=Q.z,ka[I+
+7]=1,ka[I+8]=G.x,ka[I+9]=G.y,ka[I+10]=G.z,ka[I+11]=1,I+=12;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],D=ya[y.a],Q=ya[y.b],G=ya[y.c],ga=ya[y.d],fa[I]=D.x,fa[I+1]=D.y,fa[I+2]=D.z,fa[I+3]=D.w,fa[I+4]=Q.x,fa[I+5]=Q.y,fa[I+6]=Q.z,fa[I+7]=Q.w,fa[I+8]=G.x,fa[I+9]=G.y,fa[I+10]=G.z,fa[I+11]=G.w,fa[I+12]=ga.x,fa[I+13]=ga.y,fa[I+14]=ga.z,fa[I+15]=ga.w,D=Ca[y.a],Q=Ca[y.b],G=Ca[y.c],ga=Ca[y.d],oa[I]=D.x,oa[I+1]=D.y,oa[I+2]=D.z,oa[I+3]=D.w,oa[I+4]=Q.x,oa[I+5]=Q.y,oa[I+6]=Q.z,oa[I+7]=Q.w,oa[I+8]=G.x,oa[I+9]=G.y,oa[I+
+10]=G.z,oa[I+11]=G.w,oa[I+12]=ga.x,oa[I+13]=ga.y,oa[I+14]=ga.z,oa[I+15]=ga.w,D=xa[y.a],Q=xa[y.b],G=xa[y.c],ga=xa[y.d],O[I]=D.x,O[I+1]=D.y,O[I+2]=D.z,O[I+3]=1,O[I+4]=Q.x,O[I+5]=Q.y,O[I+6]=Q.z,O[I+7]=1,O[I+8]=G.x,O[I+9]=G.y,O[I+10]=G.z,O[I+11]=1,O[I+12]=ga.x,O[I+13]=ga.y,O[I+14]=ga.z,O[I+15]=1,D=Fa[y.a],Q=Fa[y.b],G=Fa[y.c],y=Fa[y.d],ka[I]=D.x,ka[I+1]=D.y,ka[I+2]=D.z,ka[I+3]=1,ka[I+4]=Q.x,ka[I+5]=Q.y,ka[I+6]=Q.z,ka[I+7]=1,ka[I+8]=G.x,ka[I+9]=G.y,ka[I+10]=G.z,ka[I+11]=1,ka[I+12]=y.x,ka[I+13]=y.y,ka[I+
+14]=y.z,ka[I+15]=1,I+=16;I>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,O,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ka,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,oa,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,fa,w))}if(Ha&&J){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],I=y.vertexColors,oa=y.color,I.length===3&&J===THREE.VertexColors?
+(y=I[0],O=I[1],ka=I[2]):ka=O=y=oa,N[M]=y.r,N[M+1]=y.g,N[M+2]=y.b,N[M+3]=O.r,N[M+4]=O.g,N[M+5]=O.b,N[M+6]=ka.r,N[M+7]=ka.g,N[M+8]=ka.b,M+=9;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],I=y.vertexColors,oa=y.color,I.length===4&&J===THREE.VertexColors?(y=I[0],O=I[1],ka=I[2],I=I[3]):I=ka=O=y=oa,N[M]=y.r,N[M+1]=y.g,N[M+2]=y.b,N[M+3]=O.r,N[M+4]=O.g,N[M+5]=O.b,N[M+6]=ka.r,N[M+7]=ka.g,N[M+8]=ka.b,N[M+9]=I.r,N[M+10]=I.g,N[M+11]=I.b,M+=12;M>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,
+N,w))}if(ra&&ja.hasTangents){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],J=y.vertexTangents,M=J[0],y=J[1],N=J[2],W[P]=M.x,W[P+1]=M.y,W[P+2]=M.z,W[P+3]=M.w,W[P+4]=y.x,W[P+5]=y.y,W[P+6]=y.z,W[P+7]=y.w,W[P+8]=N.x,W[P+9]=N.y,W[P+10]=N.z,W[P+11]=N.w,P+=12;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],J=y.vertexTangents,M=J[0],y=J[1],N=J[2],J=J[3],W[P]=M.x,W[P+1]=M.y,W[P+2]=M.z,W[P+3]=M.w,W[P+4]=y.x,W[P+5]=y.y,W[P+6]=y.z,W[P+7]=y.w,W[P+8]=N.x,W[P+9]=N.y,W[P+10]=N.z,W[P+11]=N.w,W[P+12]=J.x,W[P+13]=J.y,W[P+14]=J.z,W[P+
+15]=J.w,P+=16;o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer);o.bufferData(o.ARRAY_BUFFER,W,w)}if(sa&&F){u=0;for(x=z.length;u<x;u++)if(y=qa[z[u]],W=y.vertexNormals,F=y.normal,W.length===3&&wa)for(P=0;P<3;P++)F=W[P],ta[ca]=F.x,ta[ca+1]=F.y,ta[ca+2]=F.z,ca+=3;else for(P=0;P<3;P++)ta[ca]=F.x,ta[ca+1]=F.y,ta[ca+2]=F.z,ca+=3;u=0;for(x=V.length;u<x;u++)if(y=qa[V[u]],W=y.vertexNormals,F=y.normal,W.length===4&&wa)for(P=0;P<4;P++)F=W[P],ta[ca]=F.x,ta[ca+1]=F.y,ta[ca+2]=F.z,ca+=3;else for(P=0;P<4;P++)ta[ca]=
+F.x,ta[ca+1]=F.y,ta[ca+2]=F.z,ca+=3;o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer);o.bufferData(o.ARRAY_BUFFER,ta,w)}if(pa&&Ea&&X){u=0;for(x=z.length;u<x;u++)if(ca=z[u],ca=Ea[ca],ca!==void 0)for(P=0;P<3;P++)ta=ca[P],ua[K]=ta.u,ua[K+1]=ta.v,K+=2;u=0;for(x=V.length;u<x;u++)if(ca=V[u],ca=Ea[ca],ca!==void 0)for(P=0;P<4;P++)ta=ca[P],ua[K]=ta.u,ua[K+1]=ta.v,K+=2;K>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ua,w))}if(pa&&Aa&&X){u=0;for(x=z.length;u<x;u++)if(ca=z[u],
+K=Aa[ca],K!==void 0)for(P=0;P<3;P++)ca=K[P],E[Y]=ca.u,E[Y+1]=ca.v,Y+=2;u=0;for(x=V.length;u<x;u++)if(ca=V[u],K=Aa[ca],K!==void 0)for(P=0;P<4;P++)ca=K[P],E[Y]=ca.u,E[Y+1]=ca.v,Y+=2;Y>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,E,w))}if(ha){u=0;for(x=z.length;u<x;u++)A[ea]=ma,A[ea+1]=ma+1,A[ea+2]=ma+2,ea+=3,S[Z]=ma,S[Z+1]=ma+1,S[Z+2]=ma,S[Z+3]=ma+2,S[Z+4]=ma+1,S[Z+5]=ma+2,Z+=6,ma+=3;u=0;for(x=V.length;u<x;u++)A[ea]=ma,A[ea+1]=ma+1,A[ea+2]=ma+3,A[ea+3]=ma+1,A[ea+4]=
+ma+2,A[ea+5]=ma+3,ea+=6,S[Z]=ma,S[Z+1]=ma+1,S[Z+2]=ma,S[Z+3]=ma+3,S[Z+4]=ma+1,S[Z+5]=ma+2,S[Z+6]=ma+2,S[Z+7]=ma+3,Z+=8,ma+=4;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,A,w);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,S,w)}if($){P=0;for(ma=$.length;P<ma;P++)if(A=$[P],A.__original.needsUpdate){S=E=0;if(A.size===1)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],A.array[E]=
+A.value[y.a],A.array[E+1]=A.value[y.b],A.array[E+2]=A.value[y.c],E+=3;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],A.array[E]=A.value[y.a],A.array[E+1]=A.value[y.b],A.array[E+2]=A.value[y.c],A.array[E+3]=A.value[y.d],E+=4}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)ha=A.value[S],A.array[E]=ha,A.array[E+1]=ha,A.array[E+2]=ha,E+=3,S+=1;u=0;for(x=V.length;u<x;u++)ha=A.value[S],A.array[E]=ha,A.array[E+1]=ha,A.array[E+2]=ha,A.array[E+3]=ha,E+=4,S+=1}else{if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<
+x;u++)A.array[E]=A.value[S],A.array[E+1]=A.value[S+1],A.array[E+2]=A.value[S+2],E+=3,S+=3;u=0;for(x=V.length;u<x;u++)A.array[E]=A.value[S],A.array[E+1]=A.value[S+1],A.array[E+2]=A.value[S+2],A.array[E+3]=A.value[S+3],E+=4,S+=4}}else if(A.size===2)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=Q.x,A.array[E+3]=Q.y,A.array[E+4]=G.x,A.array[E+5]=G.y,E+=6;u=0;for(x=V.length;u<
+x;u++)y=qa[V[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],ga=A.value[y.d],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=Q.x,A.array[E+3]=Q.y,A.array[E+4]=G.x,A.array[E+5]=G.y,A.array[E+6]=ga.x,A.array[E+7]=ga.y,E+=8}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ha=A.value[S],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=Q.x,A.array[E+3]=Q.y,A.array[E+4]=G.x,A.array[E+5]=G.y,E+=6,S+=1;u=0;for(x=V.length;u<x;u++)ga=G=Q=D=ha=A.value[S],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=Q.x,
+A.array[E+3]=Q.y,A.array[E+4]=G.x,A.array[E+5]=G.y,A.array[E+6]=ga.x,A.array[E+7]=ga.y,E+=8,S+=1}else{if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=Q.x,A.array[E+3]=Q.y,A.array[E+4]=G.x,A.array[E+5]=G.y,E+=6,S+=3;u=0;for(x=V.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],ga=A.value[S+3],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=Q.x,A.array[E+3]=Q.y,A.array[E+4]=G.x,A.array[E+5]=G.y,A.array[E+
+6]=ga.x,A.array[E+7]=ga.y,E+=8,S+=4}}else if(A.size===3)if(Y=A.type==="c"?["r","g","b"]:["x","y","z"],A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[E]=D[Y[0]],A.array[E+1]=D[Y[1]],A.array[E+2]=D[Y[2]],A.array[E+3]=Q[Y[0]],A.array[E+4]=Q[Y[1]],A.array[E+5]=Q[Y[2]],A.array[E+6]=G[Y[0]],A.array[E+7]=G[Y[1]],A.array[E+8]=G[Y[2]],E+=9;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],
+ga=A.value[y.d],A.array[E]=D[Y[0]],A.array[E+1]=D[Y[1]],A.array[E+2]=D[Y[2]],A.array[E+3]=Q[Y[0]],A.array[E+4]=Q[Y[1]],A.array[E+5]=Q[Y[2]],A.array[E+6]=G[Y[0]],A.array[E+7]=G[Y[1]],A.array[E+8]=G[Y[2]],A.array[E+9]=ga[Y[0]],A.array[E+10]=ga[Y[1]],A.array[E+11]=ga[Y[2]],E+=12,S+=1}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ha=A.value[S],A.array[E]=D[Y[0]],A.array[E+1]=D[Y[1]],A.array[E+2]=D[Y[2]],A.array[E+3]=Q[Y[0]],A.array[E+4]=Q[Y[1]],A.array[E+5]=Q[Y[2]],A.array[E+6]=G[Y[0]],
+A.array[E+7]=G[Y[1]],A.array[E+8]=G[Y[2]],E+=9,S+=1;u=0;for(x=V.length;u<x;u++)ga=G=Q=D=ha=A.value[S],A.array[E]=D[Y[0]],A.array[E+1]=D[Y[1]],A.array[E+2]=D[Y[2]],A.array[E+3]=Q[Y[0]],A.array[E+4]=Q[Y[1]],A.array[E+5]=Q[Y[2]],A.array[E+6]=G[Y[0]],A.array[E+7]=G[Y[1]],A.array[E+8]=G[Y[2]],A.array[E+9]=ga[Y[0]],A.array[E+10]=ga[Y[1]],A.array[E+11]=ga[Y[2]],E+=12,S+=1}else{if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],A.array[E]=D[Y[0]],A.array[E+
+1]=D[Y[1]],A.array[E+2]=D[Y[2]],A.array[E+3]=Q[Y[0]],A.array[E+4]=Q[Y[1]],A.array[E+5]=Q[Y[2]],A.array[E+6]=G[Y[0]],A.array[E+7]=G[Y[1]],A.array[E+8]=G[Y[2]],E+=9,S+=3;u=0;for(x=V.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],ga=A.value[S+3],A.array[E]=D[Y[0]],A.array[E+1]=D[Y[1]],A.array[E+2]=D[Y[2]],A.array[E+3]=Q[Y[0]],A.array[E+4]=Q[Y[1]],A.array[E+5]=Q[Y[2]],A.array[E+6]=G[Y[0]],A.array[E+7]=G[Y[1]],A.array[E+8]=G[Y[2]],A.array[E+9]=ga[Y[0]],A.array[E+10]=ga[Y[1]],A.array[E+11]=ga[Y[2]],
+E+=12,S+=4}}else if(A.size===4)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=qa[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,E+=12;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],ga=A.value[y.d],A.array[E]=D.x,A.array[E+1]=D.y,
+A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ha=A.value[S],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+
+10]=G.z,A.array[E+11]=G.w,E+=12,S+=1;u=0;for(x=V.length;u<x;u++)ga=G=Q=D=ha=A.value[S],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16,S+=1}else if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],A.array[E]=D.x,A.array[E+
+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,E+=12,S+=3;u=0;for(x=V.length;u<x;u++)D=A.value[S],Q=A.value[S+1],G=A.value[S+2],ga=A.value[S+3],A.array[E]=D.x,A.array[E+1]=D.y,A.array[E+2]=D.z,A.array[E+3]=D.w,A.array[E+4]=Q.x,A.array[E+5]=Q.y,A.array[E+6]=Q.z,A.array[E+7]=Q.w,A.array[E+8]=G.x,A.array[E+9]=G.y,A.array[E+10]=G.z,A.array[E+11]=G.w,A.array[E+12]=ga.x,A.array[E+
+13]=ga.y,A.array[E+14]=ga.z,A.array[E+15]=ga.w,E+=16,S+=4}o.bindBuffer(o.ARRAY_BUFFER,A.buffer);o.bufferData(o.ARRAY_BUFFER,A.array,w)}}v&&(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&&H(k)}else if(B instanceof THREE.Ribbon){if(l.__dirtyVertices||l.__dirtyColors){k=l;B=o.DYNAMIC_DRAW;n=u=v=v=void 0;x=k.vertices;t=k.colors;$=x.length;p=t.length;z=k.__vertexArray;w=k.__colorArray;V=k.__dirtyColors;if(k.__dirtyVertices){for(v=0;v<$;v++)u=x[v].position,n=v*3,z[n]=u.x,z[n+1]=u.y,z[n+2]=u.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,B)}if(V){for(v=0;v<p;v++)color=
+t[v],n=v*3,w[n]=color.r,w[n+1]=color.g,w[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,w,B)}}l.__dirtyVertices=!1;l.__dirtyColors=!1}else if(B instanceof THREE.Line){k=b(B,p);w=k.attributes&&C(k);if(l.__dirtyVertices||l.__dirtyColors||w){B=l;n=o.DYNAMIC_DRAW;t=ma=x=qa=void 0;x=B.vertices;p=B.colors;$=x.length;w=p.length;z=B.__vertexArray;v=B.__colorArray;V=B.__dirtyColors;u=B.__webglCustomAttributesList;K=Z=ea=Y=ma=qa=void 0;if(B.__dirtyVertices){for(qa=
+0;qa<$;qa++)ma=x[qa].position,t=qa*3,z[t]=ma.x,z[t+1]=ma.y,z[t+2]=ma.z;o.bindBuffer(o.ARRAY_BUFFER,B.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,n)}if(V){for(x=0;x<w;x++)color=p[x],t=x*3,v[t]=color.r,v[t+1]=color.g,v[t+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,B.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,v,n)}if(u){qa=0;for(ma=u.length;qa<ma;qa++)if(K=u[qa],K.__original.needsUpdate&&(K.boundTo===void 0||K.boundTo==="vertices")){t=0;ea=K.value.length;for(Y=0;Y<ea;Y++)K.size===1?K.array[t]=
+K.value[Y]:(Z=K.value[Y],K.size===2?(K.array[t]=Z.x,K.array[t+1]=Z.y):K.size===3?K.type==="c"?(K.array[t]=Z.r,K.array[t+1]=Z.g,K.array[t+2]=Z.b):(K.array[t]=Z.x,K.array[t+1]=Z.y,K.array[t+2]=Z.z):(K.array[t]=Z.x,K.array[t+1]=Z.y,K.array[t+2]=Z.z,K.array[t+3]=Z.w)),t+=K.size;o.bindBuffer(o.ARRAY_BUFFER,K.buffer);o.bufferData(o.ARRAY_BUFFER,K.array,n)}}}l.__dirtyVertices=!1;l.__dirtyColors=!1;k.attributes&&H(k)}else if(B instanceof THREE.ParticleSystem)k=b(B,p),w=k.attributes&&C(k),(l.__dirtyVertices||
+l.__dirtyColors||B.sortParticles||w)&&e(l,o.DYNAMIC_DRAW,B),l.__dirtyVertices=!1,l.__dirtyColors=!1,k.attributes&&H(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 Ca}};
 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};
@@ -352,19 +358,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,u=a.faceVertexUvs[0],p=f.faceVertexUvs[0],x={},w=0;w<a.materials.length;w++)x[a.materials[w].id]=w;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var w=0,y=k.length;w<y;w++){var v=new THREE.Vertex(k[w].position.clone());b&&b.multiplyVector3(v.position);h.push(v)}w=
-0;for(y=t.length;w<y;w++){var h=t[w],A,z,C=h.vertexNormals,B=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(v=C.length;k<v;k++)z=C[k].clone(),e&&e.multiplyVector3(z),A.vertexNormals.push(z);A.color.copy(h.color);k=0;for(v=B.length;k<v;k++)z=B[k],A.vertexColors.push(z.clone());if(h.materialIndex!==void 0){k=f.materials[h.materialIndex];
-v=x[k.id];if(v===void 0)v=a.materials.length,a.materials.push(k);A.materialIndex=v}A.centroid.copy(h.centroid);b&&b.multiplyVector3(A.centroid);n.push(A)}w=0;for(y=p.length;w<y;w++){b=p[w];e=[];k=0;for(v=b.length;k<v;k++)e.push(new THREE.UV(b[k].u,b[k].v));u.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,u=k.vertexNormals,p=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=u.length;e<h;e++)t=u[e],n.vertexNormals.push(t.clone());n.color.copy(k.color);e=0;for(h=p.length;e<h;e++)t=p[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,t=f.faces,v=a.faceVertexUvs[0],p=f.faceVertexUvs[0],x={},w=0;w<a.materials.length;w++)x[a.materials[w].id]=w;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,e=new THREE.Matrix4,e.extractRotation(b,c.scale);for(var w=0,z=k.length;w<z;w++){var u=new THREE.Vertex(k[w].position.clone());b&&b.multiplyVector3(u.position);h.push(u)}w=
+0;for(z=t.length;w<z;w++){var h=t[w],B,y,F=h.vertexNormals,C=h.vertexColors;h instanceof THREE.Face3?B=new THREE.Face3(h.a+l,h.b+l,h.c+l):h instanceof THREE.Face4&&(B=new THREE.Face4(h.a+l,h.b+l,h.c+l,h.d+l));B.normal.copy(h.normal);e&&e.multiplyVector3(B.normal);k=0;for(u=F.length;k<u;k++)y=F[k].clone(),e&&e.multiplyVector3(y),B.vertexNormals.push(y);B.color.copy(h.color);k=0;for(u=C.length;k<u;k++)y=C[k],B.vertexColors.push(y.clone());if(h.materialIndex!==void 0){k=f.materials[h.materialIndex];
+u=x[k.id];if(u===void 0)u=a.materials.length,a.materials.push(k);B.materialIndex=u}B.centroid.copy(h.centroid);b&&b.multiplyVector3(B.centroid);n.push(B)}w=0;for(z=p.length;w<z;w++){b=p[w];e=[];k=0;for(u=b.length;k<u;k++)e.push(new THREE.UV(b[k].u,b[k].v));v.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,v=k.vertexNormals,p=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=v.length;e<h;e++)t=v[e],n.vertexNormals.push(t.clone());n.color.copy(k.color);e=0;for(h=p.length;e<h;e++)t=p[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<
 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 f=c+Math.floor((e-c)/2);return t[f]>a?b(c,f-1):t[f]<a?b(f+1,e):f}return b(0,t.length-1)}var e,l,f=a.faces,h=a.vertices,k=f.length,n=0,t=[],u,p,x,w;for(l=0;l<k;l++){e=f[l];if(e instanceof THREE.Face3)u=h[e.a].position,p=h[e.b].position,x=h[e.c].position,e._area=THREE.GeometryUtils.triangleArea(u,p,x);else if(e instanceof
-THREE.Face4)u=h[e.a].position,p=h[e.b].position,x=h[e.c].position,w=h[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(u,p,w),e._area2=THREE.GeometryUtils.triangleArea(p,x,w),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 t[f]>a?b(c,f-1):t[f]<a?b(f+1,e):f}return b(0,t.length-1)}var e,l,f=a.faces,h=a.vertices,k=f.length,n=0,t=[],v,p,x,w;for(l=0;l<k;l++){e=f[l];if(e instanceof THREE.Face3)v=h[e.a].position,p=h[e.b].position,x=h[e.c].position,e._area=THREE.GeometryUtils.triangleArea(v,p,x);else if(e instanceof
+THREE.Face4)v=h[e.a].position,p=h[e.b].position,x=h[e.c].position,w=h[e.d].position,e._area1=THREE.GeometryUtils.triangleArea(v,p,w),e._area2=THREE.GeometryUtils.triangleArea(p,x,w),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();
 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,u=0;u<e;u++)for(var p=1;p<l;p++){var x=p-1<0?l-1:p-1,w=(p+1)%l,y=u-1<0?e-1:u-1,v=(u+1)%e,A=[],z=[0,0,k[(p*e+u)*4]/255*c];A.push([-1,0,k[(p*e+y)*4]/255*c]);A.push([-1,-1,k[(x*e+y)*4]/255*c]);A.push([0,-1,k[(x*e+u)*4]/255*c]);A.push([1,-1,k[(x*e+v)*4]/255*c]);
-A.push([1,0,k[(p*e+v)*4]/255*c]);A.push([1,1,k[(w*e+v)*4]/255*c]);A.push([0,1,k[(w*e+u)*4]/255*c]);A.push([-1,1,k[(w*e+y)*4]/255*c]);x=[];y=A.length;for(w=0;w<y;w++){var v=A[w],C=A[(w+1)%y],v=[v[0]-z[0],v[1]-z[1],v[2]-z[2]],C=[C[0]-z[0],C[1]-z[1],C[2]-z[2]];x.push(b([v[1]*C[2]-v[2]*C[1],v[2]*C[0]-v[0]*C[2],v[0]*C[1]-v[1]*C[0]]))}A=[0,0,0];for(w=0;w<x.length;w++)A[0]+=x[w][0],A[1]+=x[w][1],A[2]+=x[w][2];A[0]/=x.length;A[1]/=x.length;A[2]/=x.length;z=(p*e+u)*4;t[z]=(A[0]+1)/2*255|0;t[z+1]=(A[1]+0.5)*
-255|0;t[z+2]=A[2]*255|0;t[z+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),t=n.data,v=0;v<e;v++)for(var p=1;p<l;p++){var x=p-1<0?l-1:p-1,w=(p+1)%l,z=v-1<0?e-1:v-1,u=(v+1)%e,B=[],y=[0,0,k[(p*e+v)*4]/255*c];B.push([-1,0,k[(p*e+z)*4]/255*c]);B.push([-1,-1,k[(x*e+z)*4]/255*c]);B.push([0,-1,k[(x*e+v)*4]/255*c]);B.push([1,-1,k[(x*e+u)*4]/255*c]);
+B.push([1,0,k[(p*e+u)*4]/255*c]);B.push([1,1,k[(w*e+u)*4]/255*c]);B.push([0,1,k[(w*e+v)*4]/255*c]);B.push([-1,1,k[(w*e+z)*4]/255*c]);x=[];z=B.length;for(w=0;w<z;w++){var u=B[w],F=B[(w+1)%z],u=[u[0]-y[0],u[1]-y[1],u[2]-y[2]],F=[F[0]-y[0],F[1]-y[1],F[2]-y[2]];x.push(b([u[1]*F[2]-u[2]*F[1],u[2]*F[0]-u[0]*F[2],u[0]*F[1]-u[1]*F[0]]))}B=[0,0,0];for(w=0;w<x.length;w++)B[0]+=x[w][0],B[1]+=x[w][1],B[2]+=x[w][2];B[0]/=x.length;B[1]/=x.length;B[2]/=x.length;y=(p*e+v)*4;t[y]=(B[0]+1)/2*255|0;t[y+1]=(B[1]+0.5)*
+255|0;t[y+2]=B[2]*255|0;t[y+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",
@@ -403,36 +409,36 @@ 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,u,p,x,w,y,v;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];p=f[0];x=f[1];b.length>0?(h=b[b.length-1],w=h.x,y=h.y):(h=this.actions[e-1].args,w=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)v=h/a,f=THREE.Shape.Utils.b2(v,w,p,k),v=THREE.Shape.Utils.b2(v,y,x,
-n),b.push(new THREE.Vector2(f,v));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];p=f[0];x=f[1];t=f[2];u=f[3];b.length>0?(h=b[b.length-1],w=h.x,y=h.y):(h=this.actions[e-1].args,w=h[h.length-2],y=h[h.length-1]);for(h=1;h<=a;h++)v=h/a,f=THREE.Shape.Utils.b3(v,w,p,t,k),v=THREE.Shape.Utils.b3(v,y,x,u,n),b.push(new THREE.Vector2(f,v));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];v=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h);
-for(h=1;h<=v;h++)b.push(f.getPointAt(h/v));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];t=f[2];p=f[3];v=f[4];x=!!f[5];u=h[h.length-2];w=h[h.length-1];h.length==0&&(u=w=0);y=v-p;var A=a*2;for(h=1;h<=A;h++)v=h/A,x||(v=1-v),v=p+v*y,f=u+k+t*Math.cos(v),v=w+n+t*Math.sin(v),b.push(new THREE.Vector2(f,v))}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,u,p;k=0;for(n=h.length;k<n;k++)t=h[k],u=t.x,p=t.y,t.x=a*u+c*p+b,t.y=e*p+l*u+f;return h};
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],e,l,f,h,k,n,t,v,p,x,w,z,u;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];p=f[0];x=f[1];b.length>0?(h=b[b.length-1],w=h.x,z=h.y):(h=this.actions[e-1].args,w=h[h.length-2],z=h[h.length-1]);for(h=1;h<=a;h++)u=h/a,f=THREE.Shape.Utils.b2(u,w,p,k),u=THREE.Shape.Utils.b2(u,z,x,
+n),b.push(new THREE.Vector2(f,u));break;case THREE.PathActions.BEZIER_CURVE_TO:k=f[4];n=f[5];p=f[0];x=f[1];t=f[2];v=f[3];b.length>0?(h=b[b.length-1],w=h.x,z=h.y):(h=this.actions[e-1].args,w=h[h.length-2],z=h[h.length-1]);for(h=1;h<=a;h++)u=h/a,f=THREE.Shape.Utils.b3(u,w,p,t,k),u=THREE.Shape.Utils.b3(u,z,x,v,n),b.push(new THREE.Vector2(f,u));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[e-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];u=a*f[0].length;h=h.concat(f[0]);f=new THREE.SplineCurve(h);
+for(h=1;h<=u;h++)b.push(f.getPointAt(h/u));break;case THREE.PathActions.ARC:h=this.actions[e-1].args;k=f[0];n=f[1];t=f[2];p=f[3];u=f[4];x=!!f[5];v=h[h.length-2];w=h[h.length-1];h.length==0&&(v=w=0);z=u-p;var B=a*2;for(h=1;h<=B;h++)u=h/B,x||(u=1-u),u=p+u*z,f=v+k+t*Math.cos(u),u=w+n+t*Math.sin(u),b.push(new THREE.Vector2(f,u))}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,v,p;k=0;for(n=h.length;k<n;k++)t=h[k],v=t.x,p=t.y,t.x=a*v+c*p+b,t.y=e*p+l*v+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,u,p,x,w,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];w=[];for(p=0;p<b.length;p++)u=b[p],u=x.distanceToSquared(u),w.push(u),u<f&&(f=u,h=l,k=p)}l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;var v=[t[h],b[k],b[l]];p=THREE.FontUtils.Triangulate.area(v);var A=[t[h],t[f],b[k]];x=THREE.FontUtils.Triangulate.area(A);w=k;u=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;v=[t[h],b[k],b[l]];v=THREE.FontUtils.Triangulate.area(v);A=[t[h],t[f],b[k]];A=THREE.FontUtils.Triangulate.area(A);p+x>v+A&&(k=w,h=u,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);p=b.slice(0,k);x=b.slice(k);w=t.slice(h);u=t.slice(0,h);f=[t[h],t[f],b[k]];y.push([t[h],b[k],b[l]]);y.push(f);b=p.concat(w).concat(u).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,t,v,p,x,w,z=[];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];w=[];for(p=0;p<b.length;p++)v=b[p],v=x.distanceToSquared(v),w.push(v),v<f&&(f=v,h=l,k=p)}l=k-1>=0?k-1:b.length-1;f=h-1>=0?h-1:t.length-1;var u=[t[h],b[k],b[l]];p=THREE.FontUtils.Triangulate.area(u);var B=[t[h],t[f],b[k]];x=THREE.FontUtils.Triangulate.area(B);w=k;v=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;u=[t[h],b[k],b[l]];u=THREE.FontUtils.Triangulate.area(u);B=[t[h],t[f],b[k]];B=THREE.FontUtils.Triangulate.area(B);p+x>u+B&&(k=w,h=v,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);p=b.slice(0,k);x=b.slice(k);w=t.slice(h);v=t.slice(0,h);f=[t[h],t[f],b[k]];z.push([t[h],b[k],b[l]]);z.push(f);b=p.concat(w).concat(v).concat(x)}return{shape:b,
+isolatedPts:z,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)},
 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 u=
-{};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){u[t]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(u[t]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=u}}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 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 v=
+{};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){v[t]=a.hierarchy[b].keys[e].morphTargetsInfluences[n];break}n===a.hierarchy[b].keys[e].morphTargets.length&&(v[t]=0)}a.hierarchy[b].keys[e].morphTargetsInfluences=v}}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,u=this.data.JIT.hierarchy,p,x;this.currentTime+=a*this.timeScale;x=this.currentTime;p=this.currentTime%=this.data.length;t=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,y=this.hierarchy.length;w<y;w++)if(a=this.hierarchy[w],n=a.animationCache,this.JITCompile&&u[w][t]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=u[w][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
-!1):(a.matrix=u[w][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 v=0;v<3;v++){b=c[v];h=n.prevKey[b];k=n.nextKey[b];if(k.time<=x){if(p<x)if(this.loop){h=this.data.hierarchy[w].keys[0];for(k=this.getNextKeyWith(b,w,1);k.time<p;)h=k,k=this.getNextKeyWith(b,w,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(b,w,k.index+1);while(k.time<
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,l,f,h,k,n,t,v=this.data.JIT.hierarchy,p,x;this.currentTime+=a*this.timeScale;x=this.currentTime;p=this.currentTime%=this.data.length;t=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,z=this.hierarchy.length;w<z;w++)if(a=this.hierarchy[w],n=a.animationCache,this.JITCompile&&v[w][t]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=v[w][t],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
+!1):(a.matrix=v[w][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 u=0;u<3;u++){b=c[u];h=n.prevKey[b];k=n.nextKey[b];if(k.time<=x){if(p<x)if(this.loop){h=this.data.hierarchy[w].keys[0];for(k=this.getNextKeyWith(b,w,1);k.time<p;)h=k,k=this.getNextKeyWith(b,w,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(b,w,k.index+1);while(k.time<
 p)}n.prevKey[b]=h;n.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(p-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 "+w),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",w,h.index-1).pos,this.points[1]=l,this.points[2]=f,this.points[3]=this.getNextKeyWith("pos",w,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&&u[0][t]===void 0){this.hierarchy[0].update(null,!0);for(w=0;w<this.hierarchy.length;w++)u[w][t]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
+"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&&v[0][t]===void 0){this.hierarchy[0].update(null,!0);for(w=0;w<this.hierarchy.length;w++)v[w][t]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].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.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]};
@@ -455,7 +461,7 @@ 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 f={name:c,fps:0.6,length:e,hierarchy:[]},h,l=b.getControlPointsArray(),k=b.getLength(),A=l.length,z=0;h=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[h]={time:e,pos:l[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<A-1;h++)z=e*k.chunks[h]/k.total,b.keys[h]={time:z,pos:l[h]};f.hierarchy[0]=
+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,l=b.getControlPointsArray(),k=b.getLength(),B=l.length,y=0;h=B-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:l[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[h]={time:e,pos:l[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<B-1;h++)y=e*k.chunks[h]/k.total,b.keys[h]={time:y,pos:l[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;
@@ -473,41 +479,41 @@ 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,u=0,p=0,x=0,w=window.innerWidth/2,y=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
-this.rotateHorizontally(c*p);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*u);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,t=0,v=0,p=0,x=0,w=window.innerWidth/2,z=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
+this.rotateHorizontally(c*p);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*v);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){p=(a.clientX-w)/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:u=1;break;case 70:u=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:n=0;break;case 37:case 65: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:u=0;break;case 70:u=0}},!1)};
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){p=(a.clientX-w)/window.innerWidth;x=(a.clientY-z)/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:v=1;break;case 70:v=-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:v=0;break;case 70:v=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,u=new THREE.Vector2,p=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,t=new THREE.Vector2,v=new THREE.Vector2,p=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)/
 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+(u.y-t.y)*b.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),b.staticMoving?t=u:t.y+=(u.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(p);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));
+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+(v.y-t.y)*b.zoomSpeed;a!==1&&a>0&&(h.multiplyScalar(a),b.staticMoving?t=v:t.y+=(v.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=x.clone().subSelf(p);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?p=x:p.addSelf(a.sub(x,p).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=u=b.getMouseOnScreen(a.clientX,a.clientY),p=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?u=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=u=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=x=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
+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=v=b.getMouseOnScreen(a.clientX,a.clientY),p=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?v=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=v=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=x=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 w,v,x=e||1,y=l||1,z=k/2,o=n/2,A=t.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")w="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")w="y",y=f||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")w="x",x=f||1;var B=x+1,C=y+1;k/=x;var V=n/y;for(v=0;v<C;v++)for(n=0;n<B;n++){var Z=new THREE.Vector3;Z[a]=(n*k-z)*c;Z[b]=(v*V-o)*h;Z[w]=p;t.vertices.push(new THREE.Vertex(Z))}for(v=0;v<y;v++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
-B*v+A,n+B*(v+1)+A,n+1+B*(v+1)+A,n+1+B*v+A,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(n/x,v/y),new THREE.UV(n/x,(v+1)/y),new THREE.UV((n+1)/x,(v+1)/y),new THREE.UV((n+1)/x,v/y)])}THREE.Geometry.call(this);var t=this,u=a/2,p=c/2,x=b/2,w,y,v,A,z,C;if(h!==void 0){if(h instanceof Array)this.materials=h;else{this.materials=[];for(w=0;w<6;w++)this.materials.push(h)}w=0;A=1;y=2;z=3;v=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 B in k)this.sides[B]!=
-void 0&&(this.sides[B]=k[B]);this.sides.px&&n("z","y",-1,-1,b,c,u,w);this.sides.nx&&n("z","y",1,-1,b,c,-u,A);this.sides.py&&n("x","z",1,1,a,b,p,y);this.sides.ny&&n("x","z",1,-1,a,b,-p,z);this.sides.pz&&n("x","y",1,-1,a,c,x,v);this.sides.nz&&n("x","y",-1,-1,a,c,-x,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,t=[],u=[];for(n=0;n<=l;n++){var p=[],x=[],w=n/l,y=w*(c-a)+a;for(k=0;k<=e;k++){var v=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(v*Math.PI*2),-w*b+h,y*Math.cos(v*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(v,w))}t.push(p);u.push(x)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=t[n][k],p=t[n+1][k],x=t[n+1][k+1],w=t[n][k+1],y=
-this.vertices[b].position.clone().setY(0).normalize(),v=this.vertices[p].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),z=this.vertices[w].position.clone().setY(0).normalize(),C=u[n][k].clone(),B=u[n+1][k].clone(),D=u[n+1][k+1].clone(),K=u[n][k+1].clone();this.faces.push(new THREE.Face4(b,p,x,w,[y,v,A,z]));this.faceVertexUvs[0].push([C,B,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=t[0][k],p=t[0][k+
-1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),v=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),C=u[0][k].clone(),B=u[0][k+1].clone(),D=new THREE.UV(B.u,0),this.faces.push(new THREE.Face3(b,p,x,[y,v,A])),this.faceVertexUvs[0].push([C,B,D])}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],p=t[n][k],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),v=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),C=u[n][k+1].clone(),B=u[n][k].clone(),
-D=new THREE.UV(B.u,1),this.faces.push(new THREE.Face3(b,p,x,[y,v,A])),this.faceVertexUvs[0].push([C,B,D])}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,p,u){var v,w,x=e||1,y=l||1,z=k/2,o=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 C=x+1,G=y+1;k/=x;var F=n/y;for(w=0;w<G;w++)for(n=0;n<C;n++){var aa=new THREE.Vector3;aa[a]=(n*k-z)*c;aa[b]=(w*F-o)*h;aa[v]=p;t.vertices.push(new THREE.Vertex(aa))}for(w=0;w<y;w++)for(n=0;n<x;n++)t.faces.push(new THREE.Face4(n+
+C*w+B,n+C*(w+1)+B,n+1+C*(w+1)+B,n+1+C*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,v=a/2,p=c/2,x=b/2,w,z,u,B,y,F;if(h!==void 0){if(h instanceof Array)this.materials=h;else{this.materials=[];for(w=0;w<6;w++)this.materials.push(h)}w=0;B=1;z=2;y=3;u=4;F=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=void 0)for(var C in k)this.sides[C]!=
+void 0&&(this.sides[C]=k[C]);this.sides.px&&n("z","y",-1,-1,b,c,v,w);this.sides.nx&&n("z","y",1,-1,b,c,-v,B);this.sides.py&&n("x","z",1,1,a,b,p,z);this.sides.ny&&n("x","z",1,-1,a,b,-p,y);this.sides.pz&&n("x","y",1,-1,a,c,x,u);this.sides.nz&&n("x","y",-1,-1,a,c,-x,F);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=[],v=[];for(n=0;n<=l;n++){var p=[],x=[],w=n/l,z=w*(c-a)+a;for(k=0;k<=e;k++){var u=k/e;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(u*Math.PI*2),-w*b+h,z*Math.cos(u*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(u,w))}t.push(p);v.push(x)}for(n=0;n<l;n++)for(k=0;k<e;k++){var b=t[n][k],p=t[n+1][k],x=t[n+1][k+1],w=t[n][k+1],z=
+this.vertices[b].position.clone().setY(0).normalize(),u=this.vertices[p].position.clone().setY(0).normalize(),B=this.vertices[x].position.clone().setY(0).normalize(),y=this.vertices[w].position.clone().setY(0).normalize(),F=v[n][k].clone(),C=v[n+1][k].clone(),H=v[n+1][k+1].clone(),L=v[n][k+1].clone();this.faces.push(new THREE.Face4(b,p,x,w,[z,u,B,y]));this.faceVertexUvs[0].push([F,C,H,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],p=t[0][k+
+1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),B=new THREE.Vector3(0,1,0),F=v[0][k].clone(),C=v[0][k+1].clone(),H=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([F,C,H])}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],p=t[n][k],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),B=new THREE.Vector3(0,-1,0),F=v[n][k+1].clone(),C=v[n][k].clone(),
+H=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([F,C,H])}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,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(J=a.length;--J>=0;){ka=J;fa=J-1;fa<0&&(fa=a.length-
-1);for(var b=0,c=w+u*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=qa+ka+e,l=qa+ka+f,p=h,e=qa+fa+e,f=qa+fa+f,t=l;p+=G;e+=G;f+=G;t+=G;O.faces.push(new THREE.Face4(p,e,f,t,null,null,D));D&&(p=b/c,e=(b+1)/c,f=k+n*2,h=(O.vertices[h].position.z+n)/f,l=(O.vertices[l].position.z+n)/f,O.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){O.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function h(a,b,c){a+=G;b+=G;c+=G;O.faces.push(new THREE.Face3(a,
-b,c,null,null,B));if(B){var e=K.maxY,f=K.maxX,h=O.vertices[b].position.x,b=O.vertices[b].position.y,k=O.vertices[c].position.x,c=O.vertices[c].position.y;O.faceVertexUvs[0].push([new THREE.UV(O.vertices[a].position.x/f,O.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,t=c.bevelSize!==void 0?c.bevelSize:n-2,u=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,y=c.bendPath,v=c.extrudePath,A,z=!1,C=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,B=c.material,D=c.extrudeMaterial,K=this.shapebb;if(v)A=v.getPoints(x),w=A.length,z=!0,p=!1;p||(t=n=u=0);var P,I,F,O=this,G=this.vertices.length;y&&a.addWrapPath(y);x=C?a.extractAllSpacedPoints(x):a.extractAllPoints(x);y=x.shape;x=x.holes;if(v=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();I=0;for(F=x.length;I<F;I++)P=x[I],THREE.Shape.Utils.isClockWise(P)&&
-(x[I]=P.reverse());v=!1}v=THREE.Shape.Utils.triangulateShape(y,x);C=y;I=0;for(F=x.length;I<F;I++)P=x[I],y=y.concat(P);var J,L,ea,ma,aa,R,o=y.length,T=v.length,pa=[];J=0;L=C.length;ka=L-1;for(fa=J+1;J<L;J++,ka++,fa++)ka===L&&(ka=0),fa===L&&(fa=0),pa[J]=e(C[J],C[ka],C[fa]);var N=[],V,Z=pa.concat();I=0;for(F=x.length;I<F;I++){P=x[I];V=[];J=0;L=P.length;ka=L-1;for(fa=J+1;J<L;J++,ka++,fa++)ka===L&&(ka=0),fa===L&&(fa=0),V[J]=e(P[J],P[ka],P[fa]);N.push(V);Z=Z.concat(V)}for(ea=0;ea<u;ea++){ma=ea/u;aa=n*(1-
-ma);ma=t*Math.sin(ma*Math.PI/2);J=0;for(L=C.length;J<L;J++)R=b(C[J],pa[J],ma),f(R.x,R.y,-aa);I=0;for(F=x.length;I<F;I++){P=x[I];V=N[I];J=0;for(L=P.length;J<L;J++)R=b(P[J],V[J],ma),f(R.x,R.y,-aa)}}ma=t;for(J=0;J<o;J++)R=p?b(y[J],Z[J],ma):y[J],z?f(R.x,R.y+A[0].y,A[0].x):f(R.x,R.y,0);for(ea=1;ea<=w;ea++)for(J=0;J<o;J++)R=p?b(y[J],Z[J],ma):y[J],z?f(R.x,R.y+A[ea-1].y,A[ea-1].x):f(R.x,R.y,k/w*ea);for(ea=u-1;ea>=0;ea--){ma=ea/u;aa=n*(1-ma);ma=t*Math.sin(ma*Math.PI/2);J=0;for(L=C.length;J<L;J++)R=b(C[J],
-pa[J],ma),f(R.x,R.y,k+aa);I=0;for(F=x.length;I<F;I++){P=x[I];V=N[I];J=0;for(L=P.length;J<L;J++)R=b(P[J],V[J],ma),z?f(R.x,R.y+A[w-1].y,A[w-1].x+aa):f(R.x,R.y,k+aa)}}if(p){p=o*0;for(J=0;J<T;J++)t=v[J],h(t[2]+p,t[1]+p,t[0]+p);p=o*(w+u*2);for(J=0;J<T;J++)t=v[J],h(t[0]+p,t[1]+p,t[2]+p)}else{for(J=0;J<T;J++)t=v[J],h(t[2],t[1],t[0]);for(J=0;J<T;J++)t=v[J],h(t[0]+o*w,t[1]+o*w,t[2]+o*w)}var ka,fa,qa=0;l(C);qa+=C.length;I=0;for(F=x.length;I<F;I++)P=x[I],l(P),qa+=P.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+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(J=a.length;--J>=0;){na=J;la=J-1;la<0&&(la=a.length-
+1);for(var b=0,c=w+v*2,b=0;b<c;b++){var e=o*b,f=o*(b+1),h=ra+na+e,l=ra+na+f,p=h,e=ra+la+e,f=ra+la+f,t=l;p+=N;e+=N;f+=N;t+=N;K.faces.push(new THREE.Face4(p,e,f,t,null,null,H));H&&(p=b/c,e=(b+1)/c,f=k+n*2,h=(K.vertices[h].position.z+n)/f,l=(K.vertices[l].position.z+n)/f,K.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){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,C));if(C){var e=L.maxY,f=L.maxX,h=K.vertices[b].position.x,b=K.vertices[b].position.y,k=K.vertices[c].position.x,c=K.vertices[c].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[a].position.x/f,K.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,t=c.bevelSize!==void 0?c.bevelSize:n-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,u=c.extrudePath,B,y=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,H=c.extrudeMaterial,L=this.shapebb;if(u)B=u.getPoints(x),w=B.length,y=!0,p=!1;p||(t=n=v=0);var R,D,O,K=this,N=this.vertices.length;z&&a.addWrapPath(z);x=F?a.extractAllSpacedPoints(x):a.extractAllPoints(x);z=x.shape;x=x.holes;if(u=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();D=0;for(O=x.length;D<O;D++)R=x[D],THREE.Shape.Utils.isClockWise(R)&&
+(x[D]=R.reverse());u=!1}u=THREE.Shape.Utils.triangulateShape(z,x);F=z;D=0;for(O=x.length;D<O;D++)R=x[D],z=z.concat(R);var J,M,ea,ja,Z,U,o=z.length,P=u.length,pa=[];J=0;M=F.length;na=M-1;for(la=J+1;J<M;J++,na++,la++)na===M&&(na=0),la===M&&(la=0),pa[J]=e(F[J],F[na],F[la]);var G=[],X,aa=pa.concat();D=0;for(O=x.length;D<O;D++){R=x[D];X=[];J=0;M=R.length;na=M-1;for(la=J+1;J<M;J++,na++,la++)na===M&&(na=0),la===M&&(la=0),X[J]=e(R[J],R[na],R[la]);G.push(X);aa=aa.concat(X)}for(ea=0;ea<v;ea++){ja=ea/v;Z=n*
+(1-ja);ja=t*Math.sin(ja*Math.PI/2);J=0;for(M=F.length;J<M;J++)U=b(F[J],pa[J],ja),f(U.x,U.y,-Z);D=0;for(O=x.length;D<O;D++){R=x[D];X=G[D];J=0;for(M=R.length;J<M;J++)U=b(R[J],X[J],ja),f(U.x,U.y,-Z)}}ja=t;for(J=0;J<o;J++)U=p?b(z[J],aa[J],ja):z[J],y?f(U.x,U.y+B[0].y,B[0].x):f(U.x,U.y,0);for(ea=1;ea<=w;ea++)for(J=0;J<o;J++)U=p?b(z[J],aa[J],ja):z[J],y?f(U.x,U.y+B[ea-1].y,B[ea-1].x):f(U.x,U.y,k/w*ea);for(ea=v-1;ea>=0;ea--){ja=ea/v;Z=n*(1-ja);ja=t*Math.sin(ja*Math.PI/2);J=0;for(M=F.length;J<M;J++)U=b(F[J],
+pa[J],ja),f(U.x,U.y,k+Z);D=0;for(O=x.length;D<O;D++){R=x[D];X=G[D];J=0;for(M=R.length;J<M;J++)U=b(R[J],X[J],ja),y?f(U.x,U.y+B[w-1].y,B[w-1].x+Z):f(U.x,U.y,k+Z)}}if(p){p=o*0;for(J=0;J<P;J++)t=u[J],h(t[2]+p,t[1]+p,t[0]+p);p=o*(w+v*2);for(J=0;J<P;J++)t=u[J],h(t[0]+p,t[1]+p,t[2]+p)}else{for(J=0;J<P;J++)t=u[J],h(t[2],t[1],t[0]);for(J=0;J<P;J++)t=u[J],h(t[0]+o*w,t[1]+o*w,t[2]+o*w)}var na,la,ra=0;l(F);ra+=F.length;D=0;for(O=x.length;D<O;D++)R=x[D],l(R),ra+=R.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),t=e(f.faces[k].b,f.faces[k].c),u=e(f.faces[k].c,f.faces[k].a);b(f.faces[k].a,n,u,a);b(f.faces[k].b,t,
-n,a);b(f.faces[k].c,u,t,a);b(n,t,u,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;
+-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),v=e(f.faces[k].c,f.faces[k].a);b(f.faces[k].a,n,v,a);b(f.faces[k].b,t,
+n,a);b(f.faces[k].c,v,t,a);b(n,t,v,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(),
@@ -516,33 +522,33 @@ h.faces.push(k),k=Math.atan2(k.centroid.z,-k.centroid.x),h.faceVertexUvs[0].push
 {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.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=[],u=0;for(e=0;e<f;e++){var p=2*e/f,x=n*Math.sin(p*l),p=n*Math.cos(p*l);(b==0||b==h)&&e>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,x)))-1);t.push(u)}c.push(t)}for(var w,y,v,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);w=(b-1)/(l-1);y=(e+1)/f;var p=e/f,u=new THREE.UV(1-y,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,w),A=new THREE.UV(1-y,w);b<c.length-1&&(w=this.vertices[h].position.clone(),y=this.vertices[k].position.clone(),v=this.vertices[n].position.clone(),w.normalize(),y.normalize(),v.normalize(),this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([u,x,p]));b>1&&(w=
-this.vertices[h].position.clone(),y=this.vertices[n].position.clone(),v=this.vertices[t].position.clone(),w.normalize(),y.normalize(),v.normalize(),this.faces.push(new THREE.Face3(h,n,t,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(v.x,v.y,v.z)])),this.faceVertexUvs[0].push([u,p,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),t=[],v=0;for(e=0;e<f;e++){var p=2*e/f,x=n*Math.sin(p*l),p=n*Math.cos(p*l);(b==0||b==h)&&e>0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,k,x)))-1);t.push(v)}c.push(t)}for(var w,z,u,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);w=(b-1)/(l-1);z=(e+1)/f;var p=e/f,v=new THREE.UV(1-z,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,w),B=new THREE.UV(1-z,w);b<c.length-1&&(w=this.vertices[h].position.clone(),z=this.vertices[k].position.clone(),u=this.vertices[n].position.clone(),w.normalize(),z.normalize(),u.normalize(),this.faces.push(new THREE.Face3(h,k,n,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([v,x,p]));b>1&&(w=
+this.vertices[h].position.clone(),z=this.vertices[n].position.clone(),u=this.vertices[t].position.clone(),w.normalize(),z.normalize(),u.normalize(),this.faces.push(new THREE.Face3(h,n,t,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(u.x,u.y,u.z)])),this.faceVertexUvs[0].push([v,p,B]))}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,u,p,x,w,y,v,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;w=c[a++]*b;l.quadraticCurveTo(x,w,k,t);if(h=f[f.length-1]){u=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var z=h/divisions,C=THREE.Shape.Utils.b2(z,u,x,k),z=THREE.Shape.Utils.b2(z,p,w,t);f.push(new THREE.Vector2(C,z))}}break;case "b":if(k=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,w=c[a++]*-b,y=c[a++]*b+e,v=c[a++]*-b,l.bezierCurveTo(k,t,
-x,w,y,v),h=f[f.length-1]){u=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)z=h/divisions,C=THREE.Shape.Utils.b3(z,u,x,y,k),z=THREE.Shape.Utils.b3(z,p,w,v,t),f.push(new THREE.Vector2(C,z))}}}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,u;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 p=2*l;for(t=l-1;l>2;){if(p--<=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);u=t+1;l<=u&&(u=0);var x;a:{x=a;var w=n,y=t,v=u,A=l,z=h,C=void 0,B=void 0,D=void 0,
-K=void 0,P=void 0,I=void 0,F=void 0,O=void 0,G=void 0,B=x[z[w]].x,D=x[z[w]].y,K=x[z[y]].x,P=x[z[y]].y,I=x[z[v]].x,F=x[z[v]].y;if(1.0E-10>(K-B)*(F-D)-(P-D)*(I-B))x=!1;else{for(C=0;C<A;C++)if(!(C==w||C==y||C==v)){var O=x[z[C]].x,G=x[z[C]].y,J=void 0,L=void 0,ea=void 0,ma=void 0,aa=void 0,R=void 0,o=void 0,T=void 0,pa=void 0,N=void 0,V=void 0,Z=void 0,J=ea=aa=void 0,J=I-K,L=F-P,ea=B-I,ma=D-F,aa=K-B,R=P-D,o=O-B,T=G-D,pa=O-K,N=G-P,V=O-I,Z=G-F,J=J*N-L*pa,aa=aa*T-R*o,ea=ea*Z-ma*V;if(J>=0&&ea>=0&&aa>=0){x=
-!1;break a}}x=!0}}if(x){f.push([a[h[n]],a[h[t]],a[h[u]]]);k.push([h[n],h[t],h[u]]);n=t;for(u=t+1;u<l;n++,u++)h[n]=h[u];l--;p=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,t,v,p,x,w,z,u,B=c.glyphs[a]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.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;w=c[a++]*b;l.quadraticCurveTo(x,w,k,t);if(h=f[f.length-1]){v=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var y=h/divisions,F=THREE.Shape.Utils.b2(y,v,x,k),y=THREE.Shape.Utils.b2(y,p,w,t);f.push(new THREE.Vector2(F,y))}}break;case "b":if(k=c[a++]*b+e,t=c[a++]*b,x=c[a++]*b+e,w=c[a++]*-b,z=c[a++]*b+e,u=c[a++]*-b,l.bezierCurveTo(k,t,
+x,w,z,u),h=f[f.length-1]){v=h.x;p=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)y=h/divisions,F=THREE.Shape.Utils.b3(y,v,x,z,k),y=THREE.Shape.Utils.b3(y,p,w,u,t),f.push(new THREE.Vector2(F,y))}}}return{offset:B.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,v;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 p=2*l;for(t=l-1;l>2;){if(p--<=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);v=t+1;l<=v&&(v=0);var x;a:{x=a;var w=n,z=t,u=v,B=l,y=h,F=void 0,C=void 0,H=void 0,
+L=void 0,R=void 0,D=void 0,O=void 0,K=void 0,N=void 0,C=x[y[w]].x,H=x[y[w]].y,L=x[y[z]].x,R=x[y[z]].y,D=x[y[u]].x,O=x[y[u]].y;if(1.0E-10>(L-C)*(O-H)-(R-H)*(D-C))x=!1;else{for(F=0;F<B;F++)if(!(F==w||F==z||F==u)){var K=x[y[F]].x,N=x[y[F]].y,J=void 0,M=void 0,ea=void 0,ja=void 0,Z=void 0,U=void 0,o=void 0,P=void 0,pa=void 0,G=void 0,X=void 0,aa=void 0,J=ea=Z=void 0,J=D-L,M=O-R,ea=C-D,ja=H-O,Z=L-C,U=R-H,o=K-C,P=N-H,pa=K-L,G=N-R,X=K-D,aa=N-O,J=J*G-M*pa,Z=Z*P-U*o,ea=ea*aa-ja*X;if(J>=0&&ea>=0&&Z>=0){x=!1;
+break a}}x=!0}}if(x){f.push([a[h[n]],a[h[t]],a[h[v]]]);k.push([h[n],h[t],h[v]]);n=t;for(v=t+1;v<l;n++,v++)h[n]=h[v];l--;p=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,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),u=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,u])}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),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),v=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,v])}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,w,v,u=0;u<4;u++){v=n[u];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<v.length;y++)w=k.vertexColors[v[y]-1],t.r+=w.r,t.g+=w.g,t.b+=w.b;t.r/=v.length;t.g/=v.length;t.b/=v.length;p.vertexColors[u]=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=[],u={},p={},x=[],w,y,v,A,z,C=a.faceVertexUvs[0];w=0;for(y=C.length;w<y;w++){v=0;for(A=C[w].length;v<A;v++)z=e[w]["abcd".charAt(v)],x[z]||(x[z]=C[w][v])}var B;w=0;for(y=e.length;w<y;w++)if(z=e[w],t.push(z.centroid),n.push(new THREE.Vertex(z.centroid)),h.supportUVs&&x.length!=0){B=new THREE.UV;if(z instanceof THREE.Face3)B.u=x[z.a].u+x[z.b].u+x[z.c].u,B.v=x[z.a].v+x[z.b].v+x[z.c].v,B.u/=3,B.v/=3;else if(z instanceof THREE.Face4)B.u=
-x[z.a].u+x[z.b].u+x[z.c].u+x[z.d].u,B.v=x[z.a].v+x[z.b].v+x[z.c].v+x[z.d].v,B.u/=4,B.v/=4;x.push(B)}y=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,I={},F={},O=function(a,
-b){I[a]===void 0&&(I[a]=[]);I[a].push(b)},G=function(a,b){F[a]===void 0&&(F[a]={});F[a][b]=null};for(w in y){B=y[w];K=w.split("_");P=K[0];K=K[1];O(P,[P,K]);O(K,[P,K]);v=0;for(A=B.length;v<A;v++)z=B[v],G(P,z,w),G(K,z,w);B.length<2&&(p[w]=!0)}for(w in y)if(B=y[w],z=B[0],B=B[1],K=w.split("_"),P=K[0],K=K[1],A=new THREE.Vector3,p[w]?(A.addSelf(k[P].position),A.addSelf(k[K].position),A.multiplyScalar(0.5)):(A.addSelf(t[z]),A.addSelf(t[B]),A.addSelf(k[P].position),A.addSelf(k[K].position),A.multiplyScalar(0.25)),
-u[w]=C+e.length+D,n.push(new THREE.Vertex(A)),D++,h.supportUVs&&x.length!=0)B=new THREE.UV,B.u=x[P].u+x[K].u,B.v=x[P].v+x[K].v,B.u/=2,B.v/=2,x.push(B);var J,L;K=["123","12","2","23"];A=["123","23","3","31"];var O=["123","31","1","12"],G=["1234","12","2","23"],ea=["1234","23","3","34"],ma=["1234","34","4","41"],aa=["1234","41","1","12"];w=0;for(y=t.length;w<y;w++)z=e[w],B=C+w,z instanceof THREE.Face3?(D=b(z.a,z.b),P=b(z.b,z.c),J=b(z.c,z.a),c(B,u[D],z.b,u[P],z,K),c(B,u[P],z.c,u[J],z,A),c(B,u[J],z.a,
-u[D],z,O)):z instanceof THREE.Face4?(D=b(z.a,z.b),P=b(z.b,z.c),J=b(z.c,z.d),L=b(z.d,z.a),c(B,u[D],z.b,u[P],z,G),c(B,u[P],z.c,u[J],z,ea),c(B,u[J],z.d,u[L],z,ma),c(B,u[L],z.a,u[D],z,aa)):console.log("face should be a face!",z);e=n;n=new THREE.Vector3;u=new THREE.Vector3;w=0;for(y=k.length;w<y;w++)if(I[w]!==void 0){n.set(0,0,0);u.set(0,0,0);z=new THREE.Vector3(0,0,0);B=0;for(v in F[w])n.addSelf(t[v]),B++;D=0;C=I[w].length;for(v=0;v<C;v++)p[b(I[w][v][0],I[w][v][1])]&&D++;if(D!=2){n.divideScalar(B);for(v=
-0;v<C;v++)B=I[w][v],B=k[B[0]].position.clone().addSelf(k[B[1]].position).divideScalar(2),u.addSelf(B);u.divideScalar(C);z.addSelf(k[w].position);z.multiplyScalar(C-3);z.addSelf(n);z.addSelf(u.multiplyScalar(2));z.divideScalar(C);e[w].position=z}}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,w,v=0;v<4;v++){w=n[v];t=new THREE.Color;t.setRGB(0,0,0);for(var y=0;y<w.length;y++)u=k.vertexColors[w[y]-1],t.r+=u.r,t.g+=u.g,t.b+=u.b;t.r/=w.length;t.g/=w.length;t.b/=w.length;p.vertexColors[v]=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=[],v={},p={},x=[],w,z,u,B,y,F=a.faceVertexUvs[0];w=0;for(z=F.length;w<z;w++){u=0;for(B=F[w].length;u<B;u++)y=e[w]["abcd".charAt(u)],x[y]||(x[y]=F[w][u])}var C;w=0;for(z=e.length;w<z;w++)if(y=e[w],t.push(y.centroid),n.push(new THREE.Vertex(y.centroid)),h.supportUVs&&x.length!=0){C=new THREE.UV;if(y instanceof THREE.Face3)C.u=x[y.a].u+x[y.b].u+x[y.c].u,C.v=x[y.a].v+x[y.b].v+x[y.c].v,C.u/=3,C.v/=3;else if(y instanceof THREE.Face4)C.u=
+x[y.a].u+x[y.b].u+x[y.c].u+x[y.d].u,C.v=x[y.a].v+x[y.b].v+x[y.c].v+x[y.d].v,C.u/=4,C.v/=4;x.push(C)}z=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 H=0,F=k.length,L,R,D={},O={},K=function(a,
+b){D[a]===void 0&&(D[a]=[]);D[a].push(b)},N=function(a,b){O[a]===void 0&&(O[a]={});O[a][b]=null};for(w in z){C=z[w];L=w.split("_");R=L[0];L=L[1];K(R,[R,L]);K(L,[R,L]);u=0;for(B=C.length;u<B;u++)y=C[u],N(R,y,w),N(L,y,w);C.length<2&&(p[w]=!0)}for(w in z)if(C=z[w],y=C[0],C=C[1],L=w.split("_"),R=L[0],L=L[1],B=new THREE.Vector3,p[w]?(B.addSelf(k[R].position),B.addSelf(k[L].position),B.multiplyScalar(0.5)):(B.addSelf(t[y]),B.addSelf(t[C]),B.addSelf(k[R].position),B.addSelf(k[L].position),B.multiplyScalar(0.25)),
+v[w]=F+e.length+H,n.push(new THREE.Vertex(B)),H++,h.supportUVs&&x.length!=0)C=new THREE.UV,C.u=x[R].u+x[L].u,C.v=x[R].v+x[L].v,C.u/=2,C.v/=2,x.push(C);var J,M;L=["123","12","2","23"];B=["123","23","3","31"];var K=["123","31","1","12"],N=["1234","12","2","23"],ea=["1234","23","3","34"],ja=["1234","34","4","41"],Z=["1234","41","1","12"];w=0;for(z=t.length;w<z;w++)y=e[w],C=F+w,y instanceof THREE.Face3?(H=b(y.a,y.b),R=b(y.b,y.c),J=b(y.c,y.a),c(C,v[H],y.b,v[R],y,L),c(C,v[R],y.c,v[J],y,B),c(C,v[J],y.a,
+v[H],y,K)):y instanceof THREE.Face4?(H=b(y.a,y.b),R=b(y.b,y.c),J=b(y.c,y.d),M=b(y.d,y.a),c(C,v[H],y.b,v[R],y,N),c(C,v[R],y.c,v[J],y,ea),c(C,v[J],y.d,v[M],y,ja),c(C,v[M],y.a,v[H],y,Z)):console.log("face should be a face!",y);e=n;n=new THREE.Vector3;v=new THREE.Vector3;w=0;for(z=k.length;w<z;w++)if(D[w]!==void 0){n.set(0,0,0);v.set(0,0,0);y=new THREE.Vector3(0,0,0);C=0;for(u in O[w])n.addSelf(t[u]),C++;H=0;F=D[w].length;for(u=0;u<F;u++)p[b(D[w][u][0],D[w][u][1])]&&H++;if(H!=2){n.divideScalar(C);for(u=
+0;u<F;u++)C=D[w][u],C=k[C[0]].position.clone().addSelf(k[C[1]].position).divideScalar(2),v.addSelf(C);v.divideScalar(F);y.addSelf(k[w].position);y.multiplyScalar(F-3);y.addSelf(n);y.addSelf(v.multiplyScalar(2));y.divideScalar(F);e[w].position=y}}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)==
@@ -550,123 +556,123 @@ a}function e(a,c){var e=new Image;e.onload=function(){if(!b(this.width)||!b(this
 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,u=THREE.UniformsUtils.clone(t.uniforms),p=h.color;k=h.specular;n=h.ambient;var x=h.shininess;u.tNormal.texture=h.normalMap;if(a.mapNormalFactor)u.uNormalScale.value=a.mapNormalFactor;if(h.map)u.tDiffuse.texture=h.map,u.enableDiffuse.value=!0;if(h.specularMap)u.tSpecular.texture=h.specularMap,u.enableSpecular.value=!0;if(h.lightMap)u.tAO.texture=
-h.lightMap,u.enableAO.value=!0;u.uDiffuseColor.value.setHex(p);u.uSpecularColor.value.setHex(k);u.uAmbientColor.value.setHex(n);u.uShininess.value=x;if(h.opacity)u.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:u,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 t=THREE.ShaderUtils.lib.normal,v=THREE.UniformsUtils.clone(t.uniforms),p=h.color;k=h.specular;n=h.ambient;var x=h.shininess;v.tNormal.texture=h.normalMap;if(a.mapNormalFactor)v.uNormalScale.value=a.mapNormalFactor;if(h.map)v.tDiffuse.texture=h.map,v.enableDiffuse.value=!0;if(h.specularMap)v.tSpecular.texture=h.specularMap,v.enableSpecular.value=!0;if(h.lightMap)v.tAO.texture=
+h.lightMap,v.enableAO.value=!0;v.uDiffuseColor.value.setHex(p);v.uSpecularColor.value.setHex(k);v.uAmbientColor.value.setHex(n);v.uShininess.value=x;if(h.opacity)v.uOpacity.value=h.opacity;h=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:v,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=u(a,b),f=u(a,b+1),h=u(a,b+2),k=u(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=u(a,b),e=u(a,b+1),f=u(a,b+2);return(u(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=u(a,b);return(u(a,b+1)<<8)+c}function t(a,b){var c=u(a,b);return c>127?c-256:c}function u(a,b){return a.charCodeAt(b)&255}function p(b){var c,
-e,f;c=k(a,b);e=k(a,b+P);f=k(a,b+I);b=l(a,b+F);z.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+P);f=k(a,b+I);h=l(a,b+F);o=k(a,b+O);p=k(a,b+G);t=k(a,b+J);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];z.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 w(b){var c,e,f,h;c=k(a,b);e=k(a,b+L);f=k(a,b+ea);h=k(a,b+ma);b=l(a,b+aa);z.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+L);f=k(a,b+ea);h=k(a,b+ma);p=l(a,b+aa);t=k(a,b+R);u=k(a,b+o);v=k(a,b+T);w=k(a,b+pa);var b=D[u*3],x=D[u*3+1];u=D[u*3+2];var M=D[v*3],y=D[v*3+1];v=D[v*3+2];var Q=D[w*3],A=D[w*3+1];w=D[w*3+2];z.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(M,y,v),new THREE.Vector3(Q,A,w)],null,p))}function v(b){var c,e,f,h;c=k(a,b);e=k(a,b+N);f=k(a,b+V);b=K[c*2];h=K[c*
-2+1];c=K[e*2];var l=z.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 A(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+Z);f=k(a,b+ka);h=k(a,b+fa);b=K[c*2];l=K[c*2+1];c=K[e*2];n=K[e*2+1];e=K[f*2];var o=z.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 z=this,C=0,B,D=[],K=
-[],P,I,F,O,G,J,L,ea,ma,aa,R,o,T,pa,N,V,Z,ka,fa,qa,Y,ca,ja,na,da;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(z,e,b);B={signature:a.substr(C,8),header_bytes:u(a,C+8),vertex_coordinate_bytes:u(a,C+9),normal_coordinate_bytes:u(a,C+10),uv_coordinate_bytes:u(a,C+11),vertex_index_bytes:u(a,C+12),normal_index_bytes:u(a,C+13),uv_index_bytes:u(a,C+14),material_index_bytes:u(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+=B.header_bytes;P=B.vertex_index_bytes;I=B.vertex_index_bytes*2;F=B.vertex_index_bytes*3;O=B.vertex_index_bytes*3+B.material_index_bytes;G=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;J=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;L=B.vertex_index_bytes;ea=B.vertex_index_bytes*2;ma=B.vertex_index_bytes*3;aa=
-B.vertex_index_bytes*4;R=B.vertex_index_bytes*4+B.material_index_bytes;o=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;T=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;pa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;N=B.uv_index_bytes;V=B.uv_index_bytes*2;Z=B.uv_index_bytes;ka=B.uv_index_bytes*2;fa=B.uv_index_bytes*3;b=B.vertex_index_bytes*3+B.material_index_bytes;da=B.vertex_index_bytes*4+B.material_index_bytes;qa=B.ntri_flat*b;Y=
-B.ntri_smooth*(b+B.normal_index_bytes*3);ca=B.ntri_flat_uv*(b+B.uv_index_bytes*3);ja=B.ntri_smooth_uv*(b+B.normal_index_bytes*3+B.uv_index_bytes*3);na=B.nquad_flat*da;b=B.nquad_smooth*(da+B.normal_index_bytes*4);da=B.nquad_flat_uv*(da+B.uv_index_bytes*4);C+=function(b){for(var e,f,k,l=B.vertex_coordinate_bytes*3,n=b+B.nvertices*l;b<n;b+=l)e=c(a,b),f=c(a,b+B.vertex_coordinate_bytes),k=c(a,b+B.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,k)));return B.nvertices*
-l}(C);C+=function(b){for(var c,e,f,h=B.normal_coordinate_bytes*3,k=b+B.nnormals*h;b<k;b+=h)c=t(a,b),e=t(a,b+B.normal_coordinate_bytes),f=t(a,b+B.normal_coordinate_bytes*2),D.push(c/127,e/127,f/127);return B.nnormals*h}(C);C+=function(b){for(var e,f,k=B.uv_coordinate_bytes*2,l=b+B.nuvs*k;b<l;b+=k)e=c(a,b),f=c(a,b+B.uv_coordinate_bytes),K.push(e,f);return B.nuvs*k}(C);qa=C+qa;Y=qa+Y;ca=Y+ca;ja=ca+ja;na=ja+na;b=na+b;da=b+da;(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=c+B.uv_index_bytes*
-3,f=a+B.ntri_flat_uv*e;for(b=a;b<f;b+=e)p(b),v(b+c);return f-a})(Y);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=c+B.uv_index_bytes*3,f=a+B.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),v(b+c);return f-a})(ca);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=c+B.uv_index_bytes*4,f=a+B.nquad_flat_uv*e;for(b=a;b<f;b+=e)w(b),A(b+c);return f-a})(b);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,e=c+
-B.uv_index_bytes*4,f=a+B.nquad_smooth_uv*e;for(b=a;b<f;b+=e)y(b),A(b+c);return f-a})(da);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes,e=a+B.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(C);(function(a){var b,c=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,e=a+B.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(qa);(function(a){var b,c=B.vertex_index_bytes*4+B.material_index_bytes,e=a+B.nquad_flat*c;for(b=a;b<e;b+=c)w(b);return e-a})(ja);(function(a){var b,
-c=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,e=a+B.nquad_smooth*c;for(b=a;b<e;b+=c)y(b);return e-a})(na);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){Y=a;e=e||na;l!==void 0&&(a=l.split("/"),a.pop(),sa=a.length<1?"":a.join("/")+"/");H=c("//dae:library_images/dae:image",h,"image");ya=c("//dae:library_materials/dae:material",F,"material");ua=c("//dae:library_effects/dae:effect",ea,"effect");W=c("//dae:library_geometries/dae:geometry",A,"geometry");ga=c("//dae:library_controllers/dae:controller",k,"controller");oa=c("//dae:library_animations/dae:animation",aa,"animation");ta=c(".//dae:library_visual_scenes/dae:visual_scene",
-u,"visual_scene");Aa=[];Ca=[];(a=Y.evaluate(".//dae:scene/dae:instance_visual_scene",Y,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ja=ta[a]):ja=null;ca=new THREE.Object3D;for(a=0;a<ja.nodes.length;a++)ca.add(f(ja.nodes[a]));b();for(var n in oa);n={scene:ca,morphs:Aa,skins:Ca,dae:{images:H,materials:ya,effects:ua,geometries:W,controllers:ga,animations:oa,visualScenes:ta,scene:ja}};e&&e(n);return n}function c(a,b,c){for(var a=Y.evaluate(a,
-Y,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 oa)for(var f=oa[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=ga[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=ja.getChildById(c.skeleton[0],!0)||ja.getChildBySid(c.skeleton[0],!0),l,n,o,p,t=new THREE.Vector3,
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,e){var l=function(b){function c(a,b){var e=v(a,b),f=v(a,b+1),h=v(a,b+2),k=v(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=v(a,b),e=v(a,b+1),f=v(a,b+2);return(v(a,b+3)<<24)+(f<<16)+(e<<8)+c}function l(a,b){var c=v(a,b);return(v(a,b+1)<<8)+c}function t(a,b){var c=v(a,b);return c>127?c-256:c}function v(a,b){return a.charCodeAt(b)&255}function p(b){var c,
+e,f;c=k(a,b);e=k(a,b+R);f=k(a,b+D);b=l(a,b+O);y.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+R);f=k(a,b+D);h=l(a,b+O);o=k(a,b+K);p=k(a,b+N);t=k(a,b+J);var b=H[p*3],u=H[p*3+1];p=H[p*3+2];var v=H[t*3],w=H[t*3+1];t=H[t*3+2];y.faces.push(new THREE.Face3(c,e,f,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(b,u,p),new THREE.Vector3(v,w,t)],null,h))}function w(b){var c,e,f,h;c=k(a,b);e=k(a,b+M);f=k(a,b+ea);h=k(a,b+ja);b=l(a,b+Z);y.faces.push(new THREE.Face4(c,
+e,f,h,null,null,b))}function z(b){var c,e,f,h,p,t,u,v,w;c=k(a,b);e=k(a,b+M);f=k(a,b+ea);h=k(a,b+ja);p=l(a,b+Z);t=k(a,b+U);u=k(a,b+o);v=k(a,b+P);w=k(a,b+pa);var b=H[u*3],x=H[u*3+1];u=H[u*3+2];var $=H[v*3],z=H[v*3+1];v=H[v*3+2];var V=H[w*3],B=H[w*3+1];w=H[w*3+2];y.faces.push(new THREE.Face4(c,e,f,h,[new THREE.Vector3(H[t*3],H[t*3+1],H[t*3+2]),new THREE.Vector3(b,x,u),new THREE.Vector3($,z,v),new THREE.Vector3(V,B,w)],null,p))}function u(b){var c,e,f,h;c=k(a,b);e=k(a,b+G);f=k(a,b+X);b=L[c*2];h=L[c*2+
+1];c=L[e*2];var l=y.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 B(b){var c,e,f,h,l,n;c=k(a,b);e=k(a,b+aa);f=k(a,b+na);h=k(a,b+la);b=L[c*2];l=L[c*2+1];c=L[e*2];n=L[e*2+1];e=L[f*2];var o=y.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 y=this,F=0,C,H=[],L=[],
+R,D,O,K,N,J,M,ea,ja,Z,U,o,P,pa,G,X,aa,na,la,ra,ia,da,S,fa,ha;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);C={signature:a.substr(F,8),header_bytes:v(a,F+8),vertex_coordinate_bytes:v(a,F+9),normal_coordinate_bytes:v(a,F+10),uv_coordinate_bytes:v(a,F+11),vertex_index_bytes:v(a,F+12),normal_index_bytes:v(a,F+13),uv_index_bytes:v(a,F+14),material_index_bytes:v(a,F+15),nvertices:k(a,F+16),nnormals:k(a,F+16+4),nuvs:k(a,F+16+8),ntri_flat:k(a,F+16+12),ntri_smooth:k(a,F+16+16),ntri_flat_uv:k(a,
+F+16+20),ntri_smooth_uv:k(a,F+16+24),nquad_flat:k(a,F+16+28),nquad_smooth:k(a,F+16+32),nquad_flat_uv:k(a,F+16+36),nquad_smooth_uv:k(a,F+16+40)};F+=C.header_bytes;R=C.vertex_index_bytes;D=C.vertex_index_bytes*2;O=C.vertex_index_bytes*3;K=C.vertex_index_bytes*3+C.material_index_bytes;N=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;J=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes;ea=C.vertex_index_bytes*2;ja=C.vertex_index_bytes*3;Z=C.vertex_index_bytes*
+4;U=C.vertex_index_bytes*4+C.material_index_bytes;o=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;P=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;pa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;G=C.uv_index_bytes;X=C.uv_index_bytes*2;aa=C.uv_index_bytes;na=C.uv_index_bytes*2;la=C.uv_index_bytes*3;b=C.vertex_index_bytes*3+C.material_index_bytes;ha=C.vertex_index_bytes*4+C.material_index_bytes;ra=C.ntri_flat*b;ia=C.ntri_smooth*(b+C.normal_index_bytes*
+3);da=C.ntri_flat_uv*(b+C.uv_index_bytes*3);S=C.ntri_smooth_uv*(b+C.normal_index_bytes*3+C.uv_index_bytes*3);fa=C.nquad_flat*ha;b=C.nquad_smooth*(ha+C.normal_index_bytes*4);ha=C.nquad_flat_uv*(ha+C.uv_index_bytes*4);F+=function(b){for(var e,f,k,l=C.vertex_coordinate_bytes*3,n=b+C.nvertices*l;b<n;b+=l)e=c(a,b),f=c(a,b+C.vertex_coordinate_bytes),k=c(a,b+C.vertex_coordinate_bytes*2),y.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,k)));return C.nvertices*l}(F);F+=function(b){for(var c,e,f,h=C.normal_coordinate_bytes*
+3,k=b+C.nnormals*h;b<k;b+=h)c=t(a,b),e=t(a,b+C.normal_coordinate_bytes),f=t(a,b+C.normal_coordinate_bytes*2),H.push(c/127,e/127,f/127);return C.nnormals*h}(F);F+=function(b){for(var e,f,k=C.uv_coordinate_bytes*2,l=b+C.nuvs*k;b<l;b+=k)e=c(a,b),f=c(a,b+C.uv_coordinate_bytes),L.push(e,f);return C.nuvs*k}(F);ra=F+ra;ia=ra+ia;da=ia+da;S=da+S;fa=S+fa;b=fa+b;ha=b+ha;(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=c+C.uv_index_bytes*3,f=a+C.ntri_flat_uv*e;for(b=a;b<f;b+=e)p(b),u(b+c);
+return f-a})(ia);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=c+C.uv_index_bytes*3,f=a+C.ntri_smooth_uv*e;for(b=a;b<f;b+=e)x(b),u(b+c);return f-a})(da);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=c+C.uv_index_bytes*4,f=a+C.nquad_flat_uv*e;for(b=a;b<f;b+=e)w(b),B(b+c);return f-a})(b);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,e=c+C.uv_index_bytes*4,f=a+C.nquad_smooth_uv*e;for(b=a;b<
+f;b+=e)z(b),B(b+c);return f-a})(ha);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes,e=a+C.ntri_flat*c;for(b=a;b<e;b+=c)p(b);return e-a})(F);(function(a){var b,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,e=a+C.ntri_smooth*c;for(b=a;b<e;b+=c)x(b);return e-a})(ra);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes,e=a+C.nquad_flat*c;for(b=a;b<e;b+=c)w(b);return e-a})(S);(function(a){var b,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
+4,e=a+C.nquad_smooth*c;for(b=a;b<e;b+=c)z(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){ia=a;e=e||fa;l!==void 0&&(a=l.split("/"),a.pop(),Ea=a.length<1?"":a.join("/")+"/");I=c("//dae:library_images/dae:image",h,"image");wa=c("//dae:library_materials/dae:material",O,"material");sa=c("//dae:library_effects/dae:effect",ea,"effect");ma=c("//dae:library_geometries/dae:geometry",B,"geometry");ka=c("//dae:library_controllers/dae:controller",k,"controller");Q=c("//dae:library_animations/dae:animation",Z,"animation");qa=c(".//dae:library_visual_scenes/dae:visual_scene",
+v,"visual_scene");ya=[];Aa=[];(a=ia.evaluate(".//dae:scene/dae:instance_visual_scene",ia,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),S=qa[a]):S=null;da=new THREE.Object3D;for(a=0;a<S.nodes.length;a++)da.add(f(S.nodes[a]));b();for(var n in Q);n={scene:da,morphs:ya,skins:Aa,dae:{images:I,materials:wa,effects:sa,geometries:ma,controllers:ka,animations:Q,visualScenes:qa,scene:S}};e&&e(n);return n}function c(a,b,c){for(var a=ia.evaluate(a,ia,
+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 Q)for(var f=Q[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=ka[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=S.getChildById(c.skeleton[0],!0)||S.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=ga[a.controllers[h].url];switch(k.type){case "skin":if(W[k.skin.source]){var n=new v;n.url=k.skin.source;n.instance_material=a.controllers[h].instance_material;a.geometries.push(n);c=a.controllers[h]}else if(ga[k.skin.source]&&(e=k=ga[k.skin.source],k.morph&&W[k.morph.source]))n=new v,n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n);break;case "morph":if(W[k.morph.source])n=new v,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=W[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=ua[ya[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=ga[c.url],n.skinInstanceController=c,n.name="skin_"+Ca.length,Ca.push(n);else if(e!==void 0){o=k;p=e instanceof w?ga[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=W[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_"+Aa.length;Aa.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 u(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){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 w(){this.url="";this.skeleton=[];this.instance_material=[]}function y(){this.target=this.symbol=""}function v(){this.url="";this.instance_material=[]}function A(){this.id="";this.mesh=null}function z(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function B(){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 I(a){this.id=a;this.type=null}function F(){this.name=this.id="";this.instance_effect=null}function O(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function G(a,
-b){this.type=a;this.effect=b;this.material=null}function J(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function ea(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ma(){this.url=""}function aa(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function R(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 T(a){var b=a.getAttribute("id");if(da[b]!=void 0)return da[b];da[b]=(new I(b)).parse(a);return da[b]}function pa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function N(a){for(var a=Z(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function V(a){for(var a=Z(a),b=[],c=
-0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function Z(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ka(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function fa(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 qa(a,b){var c="";c+=fa(a.x,b)+",";c+=fa(a.y,b)+",";c+=fa(a.z,b);return c}var Y=null,ca=null,ja,
-na=null,da={},H={},oa={},ga={},W={},ya={},ua={},ta,sa,Aa,Ca,Ia=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 P).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=
-N(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 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()}}};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 P).parse(k));break;case "v":c=V(k.textContent);break;case "vcount":e=V(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)}};u.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};u.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};u.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 p).parse(c))}}return this};p.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};p.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};p.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};p.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};p.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 p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new w).parse(b));break;case "instance_geometry":this.geometries.push((new v).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=Y.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",Y,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).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 oa)for(var f=oa[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,t,n=0;n<o.input.length-1;n++)if(o.input[n+1]>b){t=o.output[n];break}k=t!==void 0?t instanceof THREE.Matrix4?
-k.multiply(k,t):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};p.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=N(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};w.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=Y.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};v.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=Y.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 z(this)).parse(c)}}return this};z.prototype.parse=function(a){function b(a,c){var e=qa(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":T(e);break;case "vertices":this.vertices=(new K).parse(e);break;case "triangles":this.primitives.push((new B).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=da[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};z.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=da[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=qa(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 A;u==3?A=new THREE.Face3(w[0],w[1],w[2],[x[0],x[1],x[2]],z.length?z:new THREE.Color):u==4&&(A=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));A.daeMaterial=a.material;b.faces.push(A);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 B;C.prototype.constructor=C;B.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};B.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=ka(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=V(c.textContent);break;case "p":this.p=V(c.textContent)}}return this};D.prototype.parse=
-function(a){this.params=[];this.source=a.getAttribute("source");this.count=ka(a,"count",0);this.stride=ka(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=ka(a,"set",-1);this.offset=ka(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=Z(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=N(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=V(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=Z(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};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};F.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 ma).parse(a.childNodes[b]);break}return this};O.prototype.isColor=function(){return this.texture==null};O.prototype.isTexture=function(){return this.texture!=null};O.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=N(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};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new O).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=Y.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};G.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 O)if(e.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(e=H[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(sa+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=Ia;return this.material=new THREE.MeshLambertMaterial(a)};J.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};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 "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};ea.prototype.create=function(){if(this.shader==null)return null};ea.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};ea.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 J(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};ea.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};ea.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 G(c.nodeName,this)).parse(c)}}};ma.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};aa.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 o(this)).parse(c));break;case "channel":this.channel.push((new R(this)).parse(c))}}return this};R.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};
+new THREE.Object3D,c,e,h;for(h=0;h<a.controllers.length;h++){var k=ka[a.controllers[h].url];switch(k.type){case "skin":if(ma[k.skin.source]){var n=new u;n.url=k.skin.source;n.instance_material=a.controllers[h].instance_material;a.geometries.push(n);c=a.controllers[h]}else if(ka[k.skin.source]&&(e=k=ka[k.skin.source],k.morph&&ma[k.morph.source]))n=new u,n.url=k.morph.source,n.instance_material=a.controllers[h].instance_material,a.geometries.push(n);break;case "morph":if(ma[k.morph.source])n=new u,
+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=ma[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=sa[wa[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=ka[c.url],n.skinInstanceController=c,n.name="skin_"+Aa.length,Aa.push(n);else if(e!==void 0){o=k;p=e instanceof w?ka[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=ma[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_"+ya.length;ya.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 v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){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 w(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function u(){this.url="";this.instance_material=[]}function B(){this.id="";this.mesh=null}function y(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function C(){this.material="";this.count=
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function H(){this.source="";this.stride=this.count=0;this.params=[]}function L(){this.input={}}function R(){this.semantic="";this.offset=0;this.source="";this.set=0}function D(a){this.id=a;this.type=null}function O(){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 J(a){this.effect=a;this.format=this.init_from=null}function M(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function ea(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ja(){this.url=""}function Z(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function U(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 P(a){var b=a.getAttribute("id");if(ha[b]!=void 0)return ha[b];ha[b]=(new D(b)).parse(a);return ha[b]}function pa(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function G(a){for(var a=aa(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function X(a){for(var a=aa(a),b=[],
+c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function aa(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function na(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function la(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 ra(a,b){var c="";c+=la(a.x,b)+",";c+=la(a.y,b)+",";c+=la(a.z,b);return c}var ia=null,da=null,
+S,fa=null,ha={},I={},Q={},ka={},ma={},wa={},sa={},qa,Ea,ya,Aa,Ja=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 D).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 R).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=G(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 D).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 R).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 R).parse(k));break;case "v":c=X(k.textContent);break;case "vcount":e=X(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)}};v.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};v.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};v.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 p).parse(c))}}return this};p.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};p.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};p.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};p.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};p.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 p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new w).parse(b));break;case "instance_geometry":this.geometries.push((new u).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ia.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ia,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
+null).iterateNext())&&this.nodes.push((new p).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 Q)for(var f=Q[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,t,n=0;n<o.input.length-1;n++)if(o.input[n+
+1]>b){t=o.output[n];break}k=t!==void 0?t instanceof THREE.Matrix4?k.multiply(k,t):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};p.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=G(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};w.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=ia.evaluate(".//dae:instance_material",c,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var e=c.iterateNext();e;)this.instance_material.push((new z).parse(e)),e=c.iterateNext()}}return this};z.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};u.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=ia.evaluate(".//dae:instance_material",c,pa,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new z).parse(b)),b=a.iterateNext();break}}return this};B.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 y(this)).parse(c)}}return this};y.prototype.parse=function(a){function b(a,
+c){var e=ra(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":P(e);break;case "vertices":this.vertices=(new L).parse(e);break;case "triangles":this.primitives.push((new C).parse(e));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ha[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};y.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=ha[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=ra(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}};F.prototype=new C;F.prototype.constructor=F;C.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};C.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=na(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 R).parse(a.childNodes[b]));break;case "vcount":this.vcount=
+X(c.textContent);break;case "p":this.p=X(c.textContent)}}return this};H.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=na(a,"count",0);this.stride=na(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 R).parse(a.childNodes[b]),this.input[input.semantic]=input);return this};R.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=na(a,"set",-1);this.offset=na(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};D.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=
+aa(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=G(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=X(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=aa(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 H).parse(c.childNodes[e]);break}}}return this};
+D.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};O.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 ja).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=G(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=ia.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=I[this.effect.surface.init_from]))a.map=
+THREE.ImageUtils.loadTexture(Ea+e.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else 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=Ja;return this.material=new THREE.MeshLambertMaterial(a)};J.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};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 "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};ea.prototype.create=function(){if(this.shader==null)return null};ea.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};
+ea.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 J(this)).parse(e);this.surface.sid=b;break;case "sampler2D":this.sampler=(new M(this)).parse(e);this.sampler.sid=b;break;case "extra":break;default:console.log(e.nodeName)}}};ea.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};ea.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)}}};ja.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Z.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 D).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 U(this)).parse(c))}}return this};U.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 R).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))na=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){Ia=a},applySkin:l,geometries:W}};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){Ja=a},applySkin:l,geometries:ma}};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,u,p,x,w,y,v,A,z,C,B,D=a.faces;p=a.vertices;var K=a.normals,P=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(u=p.length;t<u;)x=new THREE.Vertex,x.position.x=p[t++]*b,x.position.y=
-p[t++]*b,x.position.z=p[t++]*b,e.vertices.push(x);t=0;for(u=D.length;t<u;){b=D[t++];p=b&1;l=b&2;c=b&4;k=b&8;w=b&16;x=b&32;v=b&64;b&=128;p?(A=new THREE.Face4,A.a=D[t++],A.b=D[t++],A.c=D[t++],A.d=D[t++],p=4):(A=new THREE.Face3,A.a=D[t++],A.b=D[t++],A.c=D[t++],p=3);if(l)l=D[t++],A.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<I;c++)z=a.uvs[c],y=D[t++],B=z[y*2],y=z[y*2+1],e.faceUvs[c][l]=new THREE.UV(B,y);if(k)for(c=0;c<I;c++){z=a.uvs[c];C=[];for(k=0;k<p;k++)y=D[t++],B=z[y*2],y=z[y*2+1],C[k]=new THREE.UV(B,
-y);e.faceVertexUvs[c][l]=C}if(w)w=D[t++]*3,k=new THREE.Vector3,k.x=K[w++],k.y=K[w++],k.z=K[w],A.normal=k;if(x)for(c=0;c<p;c++)w=D[t++]*3,k=new THREE.Vector3,k.x=K[w++],k.y=K[w++],k.z=K[w],A.vertexNormals.push(k);if(v)x=D[t++],x=new THREE.Color(P[x]),A.color=x;if(b)for(c=0;c<p;c++)x=D[t++],x=new THREE.Color(P[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,u,p,x,w,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=[];w=e.morphTargets[c].vertices;y=a.morphTargets[c].vertices;l=0;for(t=y.length;l<t;l+=3)u=y[l]*b,p=y[l+1]*
-b,x=y[l+2]*b,w.push(new THREE.Vertex(new THREE.Vector3(u,p,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;u=a.morphColors[c].colors;b=0;for(l=u.length;b<l;b+=3)p=new THREE.Color(16755200),p.setRGB(u[b],u[b+1],u[b+2]),t.push(p)}}})(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,t,v,p,x,w,z,u,B,y,F,C,H=a.faces;p=a.vertices;var L=a.normals,R=a.colors,D=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&D++;for(c=0;c<D;c++)e.faceUvs[c]=[],e.faceVertexUvs[c]=[];t=0;for(v=p.length;t<v;)x=new THREE.Vertex,x.position.x=p[t++]*b,x.position.y=
+p[t++]*b,x.position.z=p[t++]*b,e.vertices.push(x);t=0;for(v=H.length;t<v;){b=H[t++];p=b&1;l=b&2;c=b&4;k=b&8;w=b&16;x=b&32;u=b&64;b&=128;p?(B=new THREE.Face4,B.a=H[t++],B.b=H[t++],B.c=H[t++],B.d=H[t++],p=4):(B=new THREE.Face3,B.a=H[t++],B.b=H[t++],B.c=H[t++],p=3);if(l)l=H[t++],B.materialIndex=l;l=e.faces.length;if(c)for(c=0;c<D;c++)y=a.uvs[c],z=H[t++],C=y[z*2],z=y[z*2+1],e.faceUvs[c][l]=new THREE.UV(C,z);if(k)for(c=0;c<D;c++){y=a.uvs[c];F=[];for(k=0;k<p;k++)z=H[t++],C=y[z*2],z=y[z*2+1],F[k]=new THREE.UV(C,
+z);e.faceVertexUvs[c][l]=F}if(w)w=H[t++]*3,k=new THREE.Vector3,k.x=L[w++],k.y=L[w++],k.z=L[w],B.normal=k;if(x)for(c=0;c<p;c++)w=H[t++]*3,k=new THREE.Vector3,k.x=L[w++],k.y=L[w++],k.z=L[w],B.vertexNormals.push(k);if(u)x=H[t++],x=new THREE.Color(R[x]),B.color=x;if(b)for(c=0;c<p;c++)x=H[t++],x=new THREE.Color(R[x]),B.vertexColors.push(x);e.faces.push(B)}}})(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,v,p,x,w,z;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=[];w=e.morphTargets[c].vertices;z=a.morphTargets[c].vertices;l=0;for(t=z.length;l<t;l+=3)v=z[l]*b,p=z[l+1]*
+b,x=z[l+2]*b,w.push(new THREE.Vertex(new THREE.Vector3(v,p,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;v=a.morphColors[c].colors;b=0;for(l=v.length;b<l;b+=3)p=new THREE.Color(16755200),p.setRGB(v[b],v[b+1],v[b+2]),t.push(p)}}})(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(w in L.objects)if(!T.objects[w])if(C=L.objects[w],C.geometry!==void 0){if(P=T.geometries[C.geometry]){var a=!1;for(N=0;N<C.materials.length;N++)G=T.materials[C.materials[N]],a=G instanceof THREE.ShaderMaterial;a&&P.computeTangents();B=C.position;r=C.rotation;q=C.quaternion;
-s=C.scale;q=0;G.length==0&&(G=new THREE.MeshFaceMaterial);G.length>1&&(G=new THREE.MeshFaceMaterial);object=new THREE.Mesh(P,G);object.name=w;object.position.set(B[0],B[1],B[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;T.scene.add(object);T.objects[w]=object;C.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(a));if(C.castsShadow)a=
-new THREE.ShadowVolume(P),T.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},T.triggers[object.name]=a)}}else B=C.position,r=C.rotation,q=C.quaternion,s=C.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(B[0],B[1],B[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,T.scene.add(object),T.objects[w]=object,T.empties[w]=object,C.trigger&&C.trigger.toLowerCase()!="none"&&(a={type:C.trigger,object:C},T.triggers[object.name]=a)}function n(a){return function(c){T.geometries[a]=c;k();ma-=1;b.onLoadComplete();u()}}function t(a){return function(b){T.geometries[a]=b}}function u(){b.callbackProgress({totalModels:R,totalTextures:o,loadedModels:R-ma,loadedTextures:o-aa},T);b.onLoadProgress();ma==0&&aa==0&&c(T)}var p,x,w,y,v,A,z,C,B,D,K,P,I,
-F,O,G,J,L,ea,ma,aa,R,o,T;L=a.data;O=new THREE.BinaryLoader;ea=new THREE.JSONLoader;aa=ma=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(w in L.objects)if(C=L.objects[w],C.meshCollider){a=!0;break}if(a)T.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;D=L.transform.rotation;var pa=L.transform.scale;a&&T.scene.position.set(a[0],a[1],a[2]);D&&T.scene.rotation.set(D[0],D[1],D[2]);
-pa&&T.scene.scale.set(pa[0],pa[1],pa[2]);(a||D||pa)&&T.scene.updateMatrix()}a=function(){aa-=1;u();b.onLoadComplete()};for(v in L.cameras)D=L.cameras[v],D.type=="perspective"?I=new THREE.PerspectiveCamera(D.fov,D.aspect,D.near,D.far):D.type=="ortho"&&(I=new THREE.OrthographicCamera(D.left,D.right,D.top,D.bottom,D.near,D.far)),B=D.position,D=D.target,I.position.set(B[0],B[1],B[2]),I.target=new THREE.Vector3(D[0],D[1],D[2]),T.cameras[v]=I;for(y in L.lights)v=L.lights[y],I=v.color!==void 0?v.color:16777215,
-D=v.intensity!==void 0?v.intensity:1,v.type=="directional"?(B=v.direction,J=new THREE.DirectionalLight(I,D),J.position.set(B[0],B[1],B[2]),J.position.normalize()):v.type=="point"?(B=v.position,d=v.distance,J=new THREE.PointLight(I,D,d),J.position.set(B[0],B[1],B[2])):v.type=="ambient"&&(J=new THREE.AmbientLight(I)),T.scene.add(J),T.lights[y]=J;for(A in L.fogs)y=L.fogs[A],y.type=="linear"?F=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(F=new THREE.FogExp2(0,y.density)),D=y.color,F.color.setRGB(D[0],
-D[1],D[2]),T.fogs[A]=F;if(T.cameras&&L.defaults.camera)T.currentCamera=T.cameras[L.defaults.camera];if(T.fogs&&L.defaults.fog)T.scene.fog=T.fogs[L.defaults.fog];D=L.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(D[0],D[1],D[2]);T.bgColorAlpha=L.defaults.bgalpha;for(p in L.geometries)if(A=L.geometries[p],A.type=="bin_mesh"||A.type=="ascii_mesh")ma+=1,b.onLoadStart();R=ma;for(p in L.geometries)A=L.geometries[p],A.type=="cube"?(P=new THREE.CubeGeometry(A.width,A.height,A.depth,A.segmentsWidth,
-A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[p]=P):A.type=="plane"?(P=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[p]=P):A.type=="sphere"?(P=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[p]=P):A.type=="cylinder"?(P=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[p]=P):A.type=="torus"?(P=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,A.segmentsT),T.geometries[p]=
-P):A.type=="icosahedron"?(P=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[p]=P):A.type=="bin_mesh"?O.load(e(A.url,L.urlBaseType),n(p)):A.type=="ascii_mesh"?ea.load(e(A.url,L.urlBaseType),n(p)):A.type=="embedded_mesh"&&(A=L.embeds[A.id])&&ea.createModel(A,t(p),"");for(z in L.textures)if(p=L.textures[z],p.url instanceof Array){aa+=p.url.length;for(O=0;O<p.url.length;O++)b.onLoadStart()}else aa+=1,b.onLoadStart();o=aa;for(z in L.textures){p=L.textures[z];if(p.mapping!=void 0&&THREE[p.mapping]!=
-void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){O=[];for(var N=0;N<p.url.length;N++)O[N]=e(p.url[N],L.urlBaseType);O=THREE.ImageUtils.loadTextureCube(O,p.mapping,a)}else{O=THREE.ImageUtils.loadTexture(e(p.url,L.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)O.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)O.magFilter=THREE[p.magFilter];if(p.repeat){O.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)O.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)O.wrapT=THREE.RepeatWrapping}p.offset&&
-O.offset.set(p.offset[0],p.offset[1]);if(p.wrap){ea={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(ea[p.wrap[0]]!==void 0)O.wrapS=ea[p.wrap[0]];if(ea[p.wrap[1]]!==void 0)O.wrapT=ea[p.wrap[1]]}}T.textures[z]=O}for(x in L.materials){z=L.materials[x];for(K in z.parameters)if(K=="envMap"||K=="map"||K=="lightMap")z.parameters[K]=T.textures[z.parameters[K]];else if(K=="shading")z.parameters[K]=z.parameters[K]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")z.parameters[K]=
-THREE[z.parameters[K]]?THREE[z.parameters[K]]:THREE.NormalBlending;else if(K=="combine")z.parameters[K]=z.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(z.parameters[K]=="face")z.parameters[K]=THREE.FaceColors;else if(z.parameters[K])z.parameters[K]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=!0;if(z.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
-O=z.parameters.color;ea=z.parameters.specular;A=z.parameters.ambient;F=z.parameters.shininess;a.tNormal.texture=T.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)a.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)a.tDiffuse.texture=z.parameters.map,a.enableDiffuse.value=!0;if(z.parameters.lightMap)a.tAO.texture=z.parameters.lightMap,a.enableAO.value=!0;if(z.parameters.specularMap)a.tSpecular.texture=T.textures[z.parameters.specularMap],a.enableSpecular.value=!0;
-a.uDiffuseColor.value.setHex(O);a.uSpecularColor.value.setHex(ea);a.uAmbientColor.value.setHex(A);a.uShininess.value=F;if(z.parameters.opacity)a.uOpacity.value=z.parameters.opacity;z=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);T.materials[x]=z}k();b.callbackSync(T);u()}},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(w in M.objects)if(!P.objects[w])if(F=M.objects[w],F.geometry!==void 0){if(R=P.geometries[F.geometry]){var a=!1;for(G=0;G<F.materials.length;G++)N=P.materials[F.materials[G]],a=N instanceof THREE.ShaderMaterial;a&&R.computeTangents();C=F.position;r=F.rotation;q=F.quaternion;
+s=F.scale;q=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);object=new THREE.Mesh(R,N);object.name=w;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;P.scene.add(object);P.objects[w]=object;F.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(a));if(F.castsShadow)a=
+new THREE.ShadowVolume(R),P.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(a={type:F.trigger,object:F},P.triggers[object.name]=a)}}else C=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=w,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],s[1],s[2]),object.visible=
+F.visible!==void 0?F.visible:!1,P.scene.add(object),P.objects[w]=object,P.empties[w]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(a={type:F.trigger,object:F},P.triggers[object.name]=a)}function n(a){return function(c){P.geometries[a]=c;k();ja-=1;b.onLoadComplete();v()}}function t(a){return function(b){P.geometries[a]=b}}function v(){b.callbackProgress({totalModels:U,totalTextures:o,loadedModels:U-ja,loadedTextures:o-Z},P);b.onLoadProgress();ja==0&&Z==0&&c(P)}var p,x,w,z,u,B,y,F,C,H,L,R,D,O,
+K,N,J,M,ea,ja,Z,U,o,P;M=a.data;K=new THREE.BinaryLoader;ea=new THREE.JSONLoader;Z=ja=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(w in M.objects)if(F=M.objects[w],F.meshCollider){a=!0;break}if(a)P.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;H=M.transform.rotation;var pa=M.transform.scale;a&&P.scene.position.set(a[0],a[1],a[2]);H&&P.scene.rotation.set(H[0],H[1],H[2]);
+pa&&P.scene.scale.set(pa[0],pa[1],pa[2]);(a||H||pa)&&P.scene.updateMatrix()}a=function(){Z-=1;v();b.onLoadComplete()};for(u in M.cameras)H=M.cameras[u],H.type=="perspective"?D=new THREE.PerspectiveCamera(H.fov,H.aspect,H.near,H.far):H.type=="ortho"&&(D=new THREE.OrthographicCamera(H.left,H.right,H.top,H.bottom,H.near,H.far)),C=H.position,H=H.target,D.position.set(C[0],C[1],C[2]),D.target=new THREE.Vector3(H[0],H[1],H[2]),P.cameras[u]=D;for(z in M.lights)u=M.lights[z],D=u.color!==void 0?u.color:16777215,
+H=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(C=u.direction,J=new THREE.DirectionalLight(D,H),J.position.set(C[0],C[1],C[2]),J.position.normalize()):u.type=="point"?(C=u.position,d=u.distance,J=new THREE.PointLight(D,H,d),J.position.set(C[0],C[1],C[2])):u.type=="ambient"&&(J=new THREE.AmbientLight(D)),P.scene.add(J),P.lights[z]=J;for(B in M.fogs)z=M.fogs[B],z.type=="linear"?O=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(O=new THREE.FogExp2(0,z.density)),H=z.color,O.color.setRGB(H[0],
+H[1],H[2]),P.fogs[B]=O;if(P.cameras&&M.defaults.camera)P.currentCamera=P.cameras[M.defaults.camera];if(P.fogs&&M.defaults.fog)P.scene.fog=P.fogs[M.defaults.fog];H=M.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(H[0],H[1],H[2]);P.bgColorAlpha=M.defaults.bgalpha;for(p in M.geometries)if(B=M.geometries[p],B.type=="bin_mesh"||B.type=="ascii_mesh")ja+=1,b.onLoadStart();U=ja;for(p in M.geometries)B=M.geometries[p],B.type=="cube"?(R=new THREE.CubeGeometry(B.width,B.height,B.depth,B.segmentsWidth,
+B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),P.geometries[p]=R):B.type=="plane"?(R=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),P.geometries[p]=R):B.type=="sphere"?(R=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),P.geometries[p]=R):B.type=="cylinder"?(R=new THREE.CylinderGeometry(B.topRad,B.botRad,B.height,B.radSegs,B.heightSegs),P.geometries[p]=R):B.type=="torus"?(R=new THREE.TorusGeometry(B.radius,B.tube,B.segmentsR,B.segmentsT),P.geometries[p]=
+R):B.type=="icosahedron"?(R=new THREE.IcosahedronGeometry(B.subdivisions),P.geometries[p]=R):B.type=="bin_mesh"?K.load(e(B.url,M.urlBaseType),n(p)):B.type=="ascii_mesh"?ea.load(e(B.url,M.urlBaseType),n(p)):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&ea.createModel(B,t(p),"");for(y in M.textures)if(p=M.textures[y],p.url instanceof Array){Z+=p.url.length;for(K=0;K<p.url.length;K++)b.onLoadStart()}else Z+=1,b.onLoadStart();o=Z;for(y in M.textures){p=M.textures[y];if(p.mapping!=void 0&&THREE[p.mapping]!=
+void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){K=[];for(var G=0;G<p.url.length;G++)K[G]=e(p.url[G],M.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,p.mapping,a)}else{K=THREE.ImageUtils.loadTexture(e(p.url,M.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)K.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)K.magFilter=THREE[p.magFilter];if(p.repeat){K.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}p.offset&&
+K.offset.set(p.offset[0],p.offset[1]);if(p.wrap){ea={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(ea[p.wrap[0]]!==void 0)K.wrapS=ea[p.wrap[0]];if(ea[p.wrap[1]]!==void 0)K.wrapT=ea[p.wrap[1]]}}P.textures[y]=K}for(x in M.materials){y=M.materials[x];for(L in y.parameters)if(L=="envMap"||L=="map"||L=="lightMap")y.parameters[L]=P.textures[y.parameters[L]];else if(L=="shading")y.parameters[L]=y.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")y.parameters[L]=
+THREE[y.parameters[L]]?THREE[y.parameters[L]]:THREE.NormalBlending;else if(L=="combine")y.parameters[L]=y.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(y.parameters[L]=="face")y.parameters[L]=THREE.FaceColors;else if(y.parameters[L])y.parameters[L]=THREE.VertexColors;if(y.parameters.opacity!==void 0&&y.parameters.opacity<1)y.parameters.transparent=!0;if(y.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(p.uniforms);
+K=y.parameters.color;ea=y.parameters.specular;B=y.parameters.ambient;O=y.parameters.shininess;a.tNormal.texture=P.textures[y.parameters.normalMap];if(y.parameters.normalMapFactor)a.uNormalScale.value=y.parameters.normalMapFactor;if(y.parameters.map)a.tDiffuse.texture=y.parameters.map,a.enableDiffuse.value=!0;if(y.parameters.lightMap)a.tAO.texture=y.parameters.lightMap,a.enableAO.value=!0;if(y.parameters.specularMap)a.tSpecular.texture=P.textures[y.parameters.specularMap],a.enableSpecular.value=!0;
+a.uDiffuseColor.value.setHex(K);a.uSpecularColor.value.setHex(ea);a.uAmbientColor.value.setHex(B);a.uShininess.value=O;if(y.parameters.opacity)a.uOpacity.value=y.parameters.opacity;y=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:a,lights:!0,fog:!0})}else y=new THREE[y.type](y.parameters);P.materials[x]=y}k();b.callbackSync(P);v()}},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=[],u=[];(function(a,h,n){for(var t,u,A,z=a.length;n<z;n+=h)t=a[n],u=a[n+1],A=a[n+2],t=t/16383*b,u=u/16383*b,A=A/16383*b,t+=e,u+=l,A+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,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,u.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,C,B,D,K=a.length;for(b=0;b<K;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;B=e;D=f;n=h;C=e;var P=f,I=h,F=l.materials[0],O=t[P*3],G=t[P*3+1],P=t[P*3+2],J=t[I*3],L=t[I*3+1],I=t[I*3+2];C=new THREE.Vector3(t[C*3],t[C*3+1],t[C*3+2]);P=new THREE.Vector3(O,G,P);I=new THREE.Vector3(J,L,I);l.faces.push(new THREE.Face3(B,D,n,[C,P,I],null,F));l=u[e*2];e=u[e*2+
-1];n=u[f*2];C=u[f*2+1];B=u[h*2];D=u[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(B,D));h.push(C)}})(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),t=[],v=[];(function(a,h,n){for(var t,u,v,y=a.length;n<y;n+=h)t=a[n],u=a[n+1],v=a[n+2],t=t/16383*b,u=u/16383*b,v=v/16383*b,t+=e,u+=l,v+=f,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,v)))})(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,v.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,F,C,H,L=a.length;for(b=0;b<L;b+=3){e=a[b];f=a[b+1];h=a[b+2];l=c;C=e;H=f;n=h;F=e;var R=f,D=h,O=l.materials[0],K=t[R*3],N=t[R*3+1],R=t[R*3+2],J=t[D*3],M=t[D*3+1],D=t[D*3+2];F=new THREE.Vector3(t[F*3],t[F*3+1],t[F*3+2]);R=new THREE.Vector3(K,N,R);D=new THREE.Vector3(J,M,D);l.faces.push(new THREE.Face3(C,H,n,[F,R,D],null,O));l=v[e*2];e=v[e*2+
+1];n=v[f*2];F=v[f*2+1];C=v[h*2];H=v[h*2+1];h=c.faceVertexUvs[0];f=n;n=F;F=[];F.push(new THREE.UV(l,e));F.push(new THREE.UV(f,n));F.push(new THREE.UV(C,H));h.push(F)}})(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,u,p){h=(h-u)/(p-u);u=this.normal_cache;c[f]=k+h*this.delta;c[f+1]=n;c[f+2]=t;l[f]=this.lerp(u[a],u[a+3],h);l[f+1]=this.lerp(u[a+1],u[a+4],h);l[f+2]=this.lerp(u[a+2],u[a+5],h)};this.VIntY=function(a,c,l,f,h,k,n,t,u,p){h=(h-u)/(p-u);u=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(u[a],u[c],h);l[f+1]=this.lerp(u[a+1],u[c+1],h);l[f+2]=this.lerp(u[a+2],u[c+2],h)};this.VIntZ=function(a,c,l,f,h,k,n,t,u,p){h=(h-u)/(p-u);u=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(u[a],u[c],h);l[f+1]=this.lerp(u[a+1],u[c+1],h);l[f+2]=this.lerp(u[a+2],u[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,u=f+this.zd,p=n+this.yd,x=n+this.zd,w=f+this.yd+this.zd,y=n+this.yd+this.zd,v=0,A=this.field[f],z=this.field[n],C=this.field[t],B=this.field[p],D=this.field[u],K=this.field[x],P=this.field[w],I=this.field[y];A<h&&(v|=1);z<h&&(v|=2);C<h&&(v|=8);B<h&&(v|=4);D<h&&(v|=16);K<h&&(v|=32);P<h&&(v|=128);I<h&&(v|=64);var F=THREE.edgeTable[v];if(F===0)return 0;
-var O=this.delta,G=a+O,J=c+O,O=l+O;F&1&&(this.compNorm(f),this.compNorm(n),this.VIntX(f*3,this.vlist,this.nlist,0,h,a,c,l,A,z));F&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,h,G,c,l,z,B));F&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,a,J,l,C,B));F&8&&(this.compNorm(f),this.compNorm(t),this.VIntY(f*3,this.vlist,this.nlist,9,h,a,c,l,A,C));F&16&&(this.compNorm(u),this.compNorm(x),this.VIntX(u*3,this.vlist,this.nlist,12,h,a,c,O,D,K));
-F&32&&(this.compNorm(x),this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,h,G,c,O,K,I));F&64&&(this.compNorm(w),this.compNorm(y),this.VIntX(w*3,this.vlist,this.nlist,18,h,a,J,O,P,I));F&128&&(this.compNorm(u),this.compNorm(w),this.VIntY(u*3,this.vlist,this.nlist,21,h,a,c,O,D,P));F&256&&(this.compNorm(f),this.compNorm(u),this.VIntZ(f*3,this.vlist,this.nlist,24,h,a,c,l,A,D));F&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,h,G,c,l,z,K));F&1024&&(this.compNorm(p),
-this.compNorm(y),this.VIntZ(p*3,this.vlist,this.nlist,30,h,G,J,l,B,I));F&2048&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*3,this.vlist,this.nlist,33,h,a,J,l,C,P));v<<=4;for(h=f=0;THREE.triTable[v+h]!=-1;)a=v+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,t,v,p){h=(h-v)/(p-v);v=this.normal_cache;c[f]=k+h*this.delta;c[f+1]=n;c[f+2]=t;l[f]=this.lerp(v[a],v[a+3],h);l[f+1]=this.lerp(v[a+1],v[a+4],h);l[f+2]=this.lerp(v[a+2],v[a+5],h)};this.VIntY=function(a,c,l,f,h,k,n,t,v,p){h=(h-v)/(p-v);v=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(v[a],v[c],h);l[f+1]=this.lerp(v[a+1],v[c+1],h);l[f+2]=this.lerp(v[a+2],v[c+2],h)};this.VIntZ=function(a,c,l,f,h,k,n,t,v,p){h=(h-v)/(p-v);v=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(v[a],v[c],h);l[f+1]=this.lerp(v[a+1],v[c+1],h);l[f+2]=this.lerp(v[a+2],v[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,v=f+this.zd,p=n+this.yd,x=n+this.zd,w=f+this.yd+this.zd,z=n+this.yd+this.zd,u=0,B=this.field[f],y=this.field[n],F=this.field[t],C=this.field[p],H=this.field[v],L=this.field[x],R=this.field[w],D=this.field[z];B<h&&(u|=1);y<h&&(u|=2);F<h&&(u|=8);C<h&&(u|=4);H<h&&(u|=16);L<h&&(u|=32);R<h&&(u|=128);D<h&&(u|=64);var O=THREE.edgeTable[u];if(O===0)return 0;
+var K=this.delta,N=a+K,J=c+K,K=l+K;O&1&&(this.compNorm(f),this.compNorm(n),this.VIntX(f*3,this.vlist,this.nlist,0,h,a,c,l,B,y));O&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,h,N,c,l,y,C));O&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,h,a,J,l,F,C));O&8&&(this.compNorm(f),this.compNorm(t),this.VIntY(f*3,this.vlist,this.nlist,9,h,a,c,l,B,F));O&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,h,a,c,K,H,L));
+O&32&&(this.compNorm(x),this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,h,N,c,K,L,D));O&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,h,a,J,K,R,D));O&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,h,a,c,K,H,R));O&256&&(this.compNorm(f),this.compNorm(v),this.VIntZ(f*3,this.vlist,this.nlist,24,h,a,c,l,B,H));O&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,h,N,c,l,y,L));O&1024&&(this.compNorm(p),
+this.compNorm(z),this.VIntZ(p*3,this.vlist,this.nlist,30,h,N,J,l,C,D));O&2048&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*3,this.vlist,this.nlist,33,h,a,J,l,F,R));u<<=4;for(h=f=0;THREE.triTable[u+h]!=-1;)a=u+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,u=a*this.size,p=Math.floor(n-k);p<1&&(p=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 w=Math.floor(u-k);w<1&&(w=1);k=Math.floor(u+k);
-k>this.size-1&&(k=this.size-1);for(var y,v,A,z,C,B;p<n;p++){u=this.size2*p;v=p/this.size-l;C=v*v;for(v=x;v<t;v++){A=u+this.size*v;y=v/this.size-c;B=y*y;for(y=w;y<k;y++)z=y/this.size-a,z=f/(1.0E-6+z*z+B+C)-h,z>0&&(this.field[A+y]+=z)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,t=this.size,u=this.yd,p=this.zd,x=this.field,w=t*Math.sqrt(a/c);w>t&&(w=t);for(l=0;l<w;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*u;for(h=0;h<t;h++)x[p*h+n]+=k}};this.addPlaneY=function(a,c){var l,f,h,k,
-n,t,u=this.size,p=this.yd,x=this.zd,w=this.field,y=u*Math.sqrt(a/c);y>u&&(y=u);for(f=0;f<y;f++)if(l=f/u,l*=l,k=a/(1.0E-4+l)-c,k>0){n=f*p;for(l=0;l<u;l++){t=n+l;for(h=0;h<u;h++)w[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,u,p,x=this.size-2;for(h=1;h<x;h++){p=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(f=1;f<x;f++){u=p+this.size*f;n=(f-this.halfsize)/this.halfsize;for(l=1;l<x;l++)k=(l-this.halfsize)/this.halfsize,c=u+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,u,p,x,w;for(h=0;h<f.count;h++)x=
-h*3,u=x+1,w=x+2,k=f.positionArray[x],n=f.positionArray[u],t=f.positionArray[w],p=new THREE.Vector3(k,n,t),k=f.normalArray[x],n=f.normalArray[u],t=f.normalArray[w],x=new THREE.Vector3(k,n,t),x.normalize(),u=new THREE.Vertex(p),c.vertices.push(u),l.push(x);nfaces=f.count/3;for(h=0;h<nfaces;h++)x=(a+h)*3,u=x+1,w=x+2,p=l[x],k=l[u],n=l[w],x=new THREE.Face3(x,u,w,[p,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,t=c*this.size,v=a*this.size,p=Math.floor(n-k);p<1&&(p=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 w=Math.floor(v-k);w<1&&(w=1);k=Math.floor(v+k);
+k>this.size-1&&(k=this.size-1);for(var z,u,B,y,F,C;p<n;p++){v=this.size2*p;u=p/this.size-l;F=u*u;for(u=x;u<t;u++){B=v+this.size*u;z=u/this.size-c;C=z*z;for(z=w;z<k;z++)y=z/this.size-a,y=f/(1.0E-6+y*y+C+F)-h,y>0&&(this.field[B+z]+=y)}}};this.addPlaneX=function(a,c){var l,f,h,k,n,t=this.size,v=this.yd,p=this.zd,x=this.field,w=t*Math.sqrt(a/c);w>t&&(w=t);for(l=0;l<w;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*v;for(h=0;h<t;h++)x[p*h+n]+=k}};this.addPlaneY=function(a,c){var l,f,h,k,
+n,t,v=this.size,p=this.yd,x=this.zd,w=this.field,z=v*Math.sqrt(a/c);z>v&&(z=v);for(f=0;f<z;f++)if(l=f/v,l*=l,k=a/(1.0E-4+l)-c,k>0){n=f*p;for(l=0;l<v;l++){t=n+l;for(h=0;h<v;h++)w[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,v,p,x=this.size-2;for(h=1;h<x;h++){p=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(f=1;f<x;f++){v=p+this.size*f;n=(f-this.halfsize)/this.halfsize;for(l=1;l<x;l++)k=(l-this.halfsize)/this.halfsize,c=v+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,v,p,x,w;for(h=0;h<f.count;h++)x=
+h*3,v=x+1,w=x+2,k=f.positionArray[x],n=f.positionArray[v],t=f.positionArray[w],p=new THREE.Vector3(k,n,t),k=f.normalArray[x],n=f.normalArray[v],t=f.normalArray[w],x=new THREE.Vector3(k,n,t),x.normalize(),v=new THREE.Vertex(p),c.vertices.push(v),l.push(x);nfaces=f.count/3;for(h=0;h<nfaces;h++)x=(a+h)*3,v=x+1,w=x+2,p=l[x],k=l[v],n=l[w],x=new THREE.Face3(x,v,w,[p,k,n]),c.faces.push(x);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,
@@ -696,8 +702,8 @@ 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,u=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,u,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,u,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,t=c.mesh.geometry.vertices[h.c].position,v=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,v,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,v,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};
@@ -707,9 +713,9 @@ e;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case
 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,u,p;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),w=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:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var v=new THREE.Scene;v.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));v.add(y);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;w.width=a;w.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||u!==b.far||p!==b.fov){n=b.aspect;t=b.near;u=b.far;p=b.fov;var C=b.projectionMatrix.clone(),B=125/30*0.5,D=B*t/125,K=t*Math.tan(p*Math.PI/360),P;h.n14=B;k.n14=-B;B=-K*n+D;P=K*n+D;C.n11=2*t/(P-B);C.n13=(P+B)/(P-B);l.projectionMatrix.copy(C);B=-K*n-D;
-P=K*n-D;C.n11=2*t/(P-B);C.n13=(P+B)/(P-B);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,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,w,!0);v.updateMatrixWorld();e.call(c,v,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,t,v,p;l.matrixAutoUpdate=f.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},x=new THREE.WebGLRenderTarget(512,512,a),w=new THREE.WebGLRenderTarget(512,512,a),z=new THREE.PerspectiveCamera(53,
+1,1,1E4);z.position.z=2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:x},mapRight:{type:"t",value:1,texture:w}},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 u=new THREE.Scene;u.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));u.add(z);this.setSize=function(a,e){b.call(c,a,e);x.width=a;x.height=e;w.width=a;w.height=e};this.render=function(a,b){a.updateMatrixWorld();if(n!==b.aspect||t!==b.near||v!==b.far||p!==b.fov){n=b.aspect;t=b.near;v=b.far;p=b.fov;var F=b.projectionMatrix.clone(),C=125/30*0.5,H=C*t/125,L=t*Math.tan(p*Math.PI/360),R;h.n14=C;k.n14=-C;C=-L*n+H;R=L*n+H;F.n11=2*t/(R-C);F.n13=(R+C)/(R-C);l.projectionMatrix.copy(F);C=-L*n-H;
+R=L*n-H;F.n11=2*t/(R-C);F.n13=(R+C)/(R-C);f.projectionMatrix.copy(F)}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,w,!0);u.updateMatrixWorld();e.call(c,u,z)}};
 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)}};

+ 165 - 159
build/custom/ThreeWebGL.js

@@ -14,64 +14,64 @@ 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,A){e.copy(A).subSelf(b);
-h.copy(c).subSelf(b);f.copy(a).subSelf(b);i=e.dot(e);j=e.dot(h);m=e.dot(f);o=h.dot(h);k=h.dot(f);p=1/(i*o-j*j);z=(o*m-j*k)*p;y=(i*k-j*m)*p;return z>=0&&y>=0&&z+y<1}for(var e=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,i,j,m,o,k,p,z,y,A,D=[],B=0,ra=a.children.length;B<ra;B++)Array.prototype.push.apply(D,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[];A={distance:B,point:a.position,
-face:null,object:a};D.push(A)}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 D;var J,ka,oa,S,ca,G,R,$,F=a.geometry,N=F.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);B=0;for(ra=F.faces.length;B<ra;B++)if(A=F.faces[B],R=this.origin.clone(),$=this.direction.clone(),S=a.matrixWorld,J=S.multiplyVector3(A.centroid.clone()).subSelf(R),G=J.dot($),
-!(G<=0)&&(J=S.multiplyVector3(N[A.a].position.clone()),ka=S.multiplyVector3(N[A.b].position.clone()),oa=S.multiplyVector3(N[A.c].position.clone()),S=A instanceof THREE.Face4?S.multiplyVector3(N[A.d].position.clone()):null,ca=a.matrixRotationWorld.multiplyVector3(A.normal.clone()),G=$.dot(ca),a.doubleSided||(a.flipSided?G>0:G<0)))if(G=ca.dot((new THREE.Vector3).sub(J,R))/G,R=R.addSelf($.multiplyScalar(G)),A instanceof THREE.Face3)c(R,J,ka,oa)&&(A={distance:this.origin.distanceTo(R),point:R,face:A,
-object:a},D.push(A));else if(A instanceof THREE.Face4&&(c(R,J,ka,S)||c(R,ka,oa,S)))A={distance:this.origin.distanceTo(R),point:R,face:A,object:a},D.push(A)}return D}};
-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,p){j=!1;b=f;c=i;e=k;h=p;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,p,z,y){j?(j=!1,b=f<k?f<z?f:z:k<z?k:z,c=i<p?i<y?i:y:p<y?p:y,e=f>k?f>z?f:z:k>z?k:z,h=i>p?i>y?i:y:p>y?p:y):(b=f<k?f<z?f<b?f:b:z<b?z:b:k<z?k<b?k:b:z<b?z:b,c=i<p?i<y?i<c?i:c:y<c?y:c:p<y?p<c?p:c:y<c?y:c,e=f>k?f>z?f>e?f:e:z>e?z:e:k>z?k>e?k:e:z>e?z:e,h=i>p?i>y?i>h?i:h:y>h?y:h:p>y?p>h?p:h:y>h?y: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.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,D){e.copy(D).subSelf(b);
+h.copy(c).subSelf(b);f.copy(a).subSelf(b);i=e.dot(e);k=e.dot(h);r=e.dot(f);n=h.dot(h);l=h.dot(f);t=1/(i*n-k*k);B=(n*r-k*l)*t;C=(i*l-k*r)*t;return B>=0&&C>=0&&B+C<1}for(var e=new THREE.Vector3,h=new THREE.Vector3,f=new THREE.Vector3,i,k,r,n,l,t,B,C,D,F=[],E=0,ra=a.children.length;E<ra;E++)Array.prototype.push.apply(F,this.intersectObject(a.children[E]));if(a instanceof THREE.Particle){E=b(this.origin,this.direction,a.matrixWorld.getPosition());if(E===null||E>a.scale.x)return[];D={distance:E,point:a.position,
+face:null,object:a};F.push(D)}else if(a instanceof THREE.Mesh){E=b(this.origin,this.direction,a.matrixWorld.getPosition());if(E===null||E>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return F;var O,la,na,R,da,K,U,X,J=a.geometry,Y=J.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);E=0;for(ra=J.faces.length;E<ra;E++)if(D=J.faces[E],U=this.origin.clone(),X=this.direction.clone(),R=a.matrixWorld,O=R.multiplyVector3(D.centroid.clone()).subSelf(U),K=O.dot(X),
+!(K<=0)&&(O=R.multiplyVector3(Y[D.a].position.clone()),la=R.multiplyVector3(Y[D.b].position.clone()),na=R.multiplyVector3(Y[D.c].position.clone()),R=D instanceof THREE.Face4?R.multiplyVector3(Y[D.d].position.clone()):null,da=a.matrixRotationWorld.multiplyVector3(D.normal.clone()),K=X.dot(da),a.doubleSided||(a.flipSided?K>0:K<0)))if(K=da.dot((new THREE.Vector3).sub(O,U))/K,U=U.addSelf(X.multiplyScalar(K)),D instanceof THREE.Face3)c(U,O,la,na)&&(D={distance:this.origin.distanceTo(U),point:U,face:D,
+object:a},F.push(D));else if(D instanceof THREE.Face4&&(c(U,O,la,R)||c(U,la,na,R)))D={distance:this.origin.distanceTo(U),point:U,face:D,object:a},F.push(D)}return F}};
+THREE.Rectangle=function(){function a(){f=e-b;i=h-c}var b,c,e,h,f,i,k=!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,l,t){k=!1;b=f;c=i;e=l;h=t;a()};this.addPoint=function(f,i){k?(k=!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,l,t,B,C){k?(k=!1,b=f<l?f<B?f:B:l<B?l:B,c=i<t?i<C?i:C:t<C?t:C,e=f>l?f>B?f:B:l>B?l:B,h=i>t?i>C?i:C:t>C?t:C):(b=f<l?f<B?f<b?f:b:B<b?B:b:l<B?l<b?l:b:B<b?B:b,c=i<t?i<C?i<c?i:c:C<c?C:c:t<C?t<c?t:c:C<c?C:c,e=f>l?f>B?f>e?f:e:B>e?B:e:l>B?l>e?l:e:B>e?B:e,h=i>t?i>C?i>h?i:h:C>h?C:h:t>C?t>h?t:h:C>h?C:h);a()};this.addRectangle=function(f){k?(k=!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(){k=!0;h=e=c=b=0;a()};this.isEmpty=function(){return k}};
 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,h,f,i,j,m,o,k,p,z,y,A,D){this.set(a!==void 0?a:1,b||0,c||0,e||0,h||0,f!==void 0?f:1,i||0,j||0,m||0,o||0,k!==void 0?k:1,p||0,z||0,y||0,A||0,D!==void 0?D: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,m,o,k,p,z,y,A,D){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=m;this.n32=o;this.n33=k;this.n34=p;this.n41=z;this.n42=y;this.n43=A;this.n44=D;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,m=a.n23,o=a.n24,k=a.n31,p=a.n32,z=a.n33,y=a.n34,A=a.n41,D=a.n42,B=a.n43,
-ra=a.n44,J=b.n11,ka=b.n12,oa=b.n13,S=b.n14,ca=b.n21,G=b.n22,R=b.n23,$=b.n24,F=b.n31,N=b.n32,na=b.n33,ua=b.n34,ta=b.n41,U=b.n42,K=b.n43,d=b.n44;this.n11=c*J+e*ca+h*F+f*ta;this.n12=c*ka+e*G+h*N+f*U;this.n13=c*oa+e*R+h*na+f*K;this.n14=c*S+e*$+h*ua+f*d;this.n21=i*J+j*ca+m*F+o*ta;this.n22=i*ka+j*G+m*N+o*U;this.n23=i*oa+j*R+m*na+o*K;this.n24=i*S+j*$+m*ua+o*d;this.n31=k*J+p*ca+z*F+y*ta;this.n32=k*ka+p*G+z*N+y*U;this.n33=k*oa+p*R+z*na+y*K;this.n34=k*S+p*$+z*ua+y*d;this.n41=A*J+D*ca+B*F+ra*ta;this.n42=A*ka+
-D*G+B*N+ra*U;this.n43=A*oa+D*R+B*na+ra*K;this.n44=A*S+D*$+B*ua+ra*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*=
+THREE.Matrix4=function(a,b,c,e,h,f,i,k,r,n,l,t,B,C,D,F){this.set(a!==void 0?a:1,b||0,c||0,e||0,h||0,f!==void 0?f:1,i||0,k||0,r||0,n||0,l!==void 0?l:1,t||0,B||0,C||0,D||0,F!==void 0?F: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,k,r,n,l,t,B,C,D,F){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=h;this.n22=f;this.n23=i;this.n24=k;this.n31=r;this.n32=n;this.n33=l;this.n34=t;this.n41=B;this.n42=C;this.n43=D;this.n44=F;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,k=a.n22,r=a.n23,n=a.n24,l=a.n31,t=a.n32,B=a.n33,C=a.n34,D=a.n41,F=a.n42,E=a.n43,
+ra=a.n44,O=b.n11,la=b.n12,na=b.n13,R=b.n14,da=b.n21,K=b.n22,U=b.n23,X=b.n24,J=b.n31,Y=b.n32,aa=b.n33,ma=b.n34,xa=b.n41,ka=b.n42,N=b.n43,d=b.n44;this.n11=c*O+e*da+h*J+f*xa;this.n12=c*la+e*K+h*Y+f*ka;this.n13=c*na+e*U+h*aa+f*N;this.n14=c*R+e*X+h*ma+f*d;this.n21=i*O+k*da+r*J+n*xa;this.n22=i*la+k*K+r*Y+n*ka;this.n23=i*na+k*U+r*aa+n*N;this.n24=i*R+k*X+r*ma+n*d;this.n31=l*O+t*da+B*J+C*xa;this.n32=l*la+t*K+B*Y+C*ka;this.n33=l*na+t*U+B*aa+C*N;this.n34=l*R+t*X+B*ma+C*d;this.n41=D*O+F*da+E*J+ra*xa;this.n42=
+D*la+F*K+E*Y+ra*ka;this.n43=D*na+F*U+E*aa+ra*N;this.n44=D*R+F*X+E*ma+ra*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,m=this.n31,o=this.n32,k=this.n33,p=this.n34,z=this.n41,y=this.n42,A=this.n43,D=this.n44;return e*i*o*z-c*j*o*z-e*f*k*z+b*j*k*z+c*f*p*z-b*i*p*z-e*i*m*y+c*j*m*y+e*h*k*y-a*j*k*y-c*h*p*y+a*i*p*y+e*f*m*A-b*j*m*A-e*h*o*A+a*j*o*A+b*h*p*A-a*f*p*A-c*f*m*D+b*i*m*D+
-c*h*o*D-a*i*o*D-b*h*k*D+a*f*k*D},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.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,k=this.n24,r=this.n31,n=this.n32,l=this.n33,t=this.n34,B=this.n41,C=this.n42,D=this.n43,F=this.n44;return e*i*n*B-c*k*n*B-e*f*l*B+b*k*l*B+c*f*t*B-b*i*t*B-e*i*r*C+c*k*r*C+e*h*l*C-a*k*l*C-c*h*t*C+a*i*t*C+e*f*r*D-b*k*r*D-e*h*n*D+a*k*n*D+b*h*t*D-a*f*t*D-c*f*r*F+b*i*r*F+
+c*h*n*F-a*i*n*F-b*h*l*F+a*f*l*F},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),h=1-c,f=a.x,i=a.y,j=a.z,m=h*f,o=h*i;this.set(m*f+c,m*i-e*j,m*j+e*i,0,m*i+e*j,o*i+c,o*j-e*f,0,m*j-e*i,o*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,m=a.n24,o=a.n31,k=a.n32,p=a.n33,z=a.n34,y=a.n41,A=a.n42,D=a.n43,B=a.n44;this.n11=j*z*A-m*p*A+m*k*D-i*z*D-j*k*B+i*p*B;this.n12=h*p*A-e*z*A-h*k*D+c*z*D+e*k*B-c*p*B;this.n13=e*m*A-h*j*A+h*i*D-c*m*D-e*i*B+c*j*B;this.n14=h*j*k-e*m*k-h*i*p+c*m*p+e*i*z-c*j*z;this.n21=m*p*y-j*z*y-m*o*D+f*z*D+j*o*B-f*p*B;this.n22=e*z*y-h*p*y+
-h*o*D-b*z*D-e*o*B+b*p*B;this.n23=h*j*y-e*m*y-h*f*D+b*m*D+e*f*B-b*j*B;this.n24=e*m*o-h*j*o+h*f*p-b*m*p-e*f*z+b*j*z;this.n31=i*z*y-m*k*y+m*o*A-f*z*A-i*o*B+f*k*B;this.n32=h*k*y-c*z*y-h*o*A+b*z*A+c*o*B-b*k*B;this.n33=e*m*y-h*i*y+h*f*A-b*m*A-c*f*B+b*i*B;this.n34=h*i*o-c*m*o-h*f*k+b*m*k+c*f*z-b*i*z;this.n41=j*k*y-i*p*y-j*o*A+f*p*A+i*o*D-f*k*D;this.n42=c*p*y-e*k*y+e*o*A-b*p*A-c*o*D+b*k*D;this.n43=e*i*y-c*j*y-e*f*A+b*j*A+c*f*D-b*i*D;this.n44=c*j*o-e*i*o+e*f*k-b*j*k-c*f*p+b*i*p;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 m=i*j,o=i*h,k=e*j,p=e*h;this.n11=m+p*c;this.n12=k*c-o;this.n13=f*e;this.n21=f*h;this.n22=f*j;this.n23=-c;this.n31=o*c-k;this.n32=p+m*c;this.n33=f*i;break;case "ZXY":m=i*j;o=i*h;k=e*j;p=e*h;this.n11=m-p*c;this.n12=-f*h;this.n13=k+o*c;this.n21=o+k*c;this.n22=f*j;this.n23=p-m*c;this.n31=-f*e;this.n32=c;this.n33=f*i;break;case "ZYX":m=
-f*j;o=f*h;k=c*j;p=c*h;this.n11=i*j;this.n12=k*e-o;this.n13=m*e+p;this.n21=i*h;this.n22=p*e+m;this.n23=o*e-k;this.n31=-e;this.n32=c*i;this.n33=f*i;break;case "YZX":m=f*i;o=f*e;k=c*i;p=c*e;this.n11=i*j;this.n12=p-m*h;this.n13=k*h+o;this.n21=h;this.n22=f*j;this.n23=-c*j;this.n31=-e*j;this.n32=o*h+k;this.n33=m-p*h;break;case "XZY":m=f*i;o=f*e;k=c*i;p=c*e;this.n11=i*j;this.n12=-h;this.n13=e*j;this.n21=m*h+p;this.n22=f*j;this.n23=o*h-k;this.n31=k*h-o;this.n32=c*j;this.n33=p*h+m;break;default:m=f*j,o=f*
-h,k=c*j,p=c*h,this.n11=i*j,this.n12=-i*h,this.n13=e,this.n21=o+k*e,this.n22=m-p*e,this.n23=-c*i,this.n31=p-m*e,this.n32=k+o*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,m=b*i;b*=j;var o=c*i;c*=j;e*=j;f*=h;i*=h;h*=j;this.n11=1-(o+e);this.n12=m-h;this.n13=b+i;this.n21=m+h;this.n22=1-(a+e);this.n23=c-f;this.n31=b-i;this.n32=c+f;this.n33=1-(a+o);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
+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,k=a.z,r=h*f,n=h*i;this.set(r*f+c,r*i-e*k,r*k+e*i,0,r*i+e*k,n*i+c,n*k-e*f,0,r*k-e*i,n*k+e*f,h*k*k+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,k=a.n23,r=a.n24,n=a.n31,l=a.n32,t=a.n33,B=a.n34,C=a.n41,D=a.n42,F=a.n43,E=a.n44;this.n11=k*B*D-r*t*D+r*l*F-i*B*F-k*l*E+i*t*E;this.n12=h*t*D-e*B*D-h*l*F+c*B*F+e*l*E-c*t*E;this.n13=e*r*D-h*k*D+h*i*F-c*r*F-e*i*E+c*k*E;this.n14=h*k*l-e*r*l-h*i*t+c*r*t+e*i*B-c*k*B;this.n21=r*t*C-k*B*C-r*n*F+f*B*F+k*n*E-f*t*E;this.n22=e*B*C-h*t*C+
+h*n*F-b*B*F-e*n*E+b*t*E;this.n23=h*k*C-e*r*C-h*f*F+b*r*F+e*f*E-b*k*E;this.n24=e*r*n-h*k*n+h*f*t-b*r*t-e*f*B+b*k*B;this.n31=i*B*C-r*l*C+r*n*D-f*B*D-i*n*E+f*l*E;this.n32=h*l*C-c*B*C-h*n*D+b*B*D+c*n*E-b*l*E;this.n33=e*r*C-h*i*C+h*f*D-b*r*D-c*f*E+b*i*E;this.n34=h*i*n-c*r*n-h*f*l+b*r*l+c*f*B-b*i*B;this.n41=k*l*C-i*t*C-k*n*D+f*t*D+i*n*F-f*l*F;this.n42=c*t*C-e*l*C+e*n*D-b*t*D-c*n*F+b*l*F;this.n43=e*i*C-c*k*C-e*f*D+b*k*D+c*f*F-b*i*F;this.n44=c*k*n-e*i*n+e*f*l-b*k*l-c*f*t+b*i*t;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),k=Math.cos(h),h=Math.sin(h);switch(b){case "YXZ":var r=i*k,n=i*h,l=e*k,t=e*h;this.n11=r+t*c;this.n12=l*c-n;this.n13=f*e;this.n21=f*h;this.n22=f*k;this.n23=-c;this.n31=n*c-l;this.n32=t+r*c;this.n33=f*i;break;case "ZXY":r=i*k;n=i*h;l=e*k;t=e*h;this.n11=r-t*c;this.n12=-f*h;this.n13=l+n*c;this.n21=n+l*c;this.n22=f*k;this.n23=t-r*c;this.n31=-f*e;this.n32=c;this.n33=f*i;break;case "ZYX":r=
+f*k;n=f*h;l=c*k;t=c*h;this.n11=i*k;this.n12=l*e-n;this.n13=r*e+t;this.n21=i*h;this.n22=t*e+r;this.n23=n*e-l;this.n31=-e;this.n32=c*i;this.n33=f*i;break;case "YZX":r=f*i;n=f*e;l=c*i;t=c*e;this.n11=i*k;this.n12=t-r*h;this.n13=l*h+n;this.n21=h;this.n22=f*k;this.n23=-c*k;this.n31=-e*k;this.n32=n*h+l;this.n33=r-t*h;break;case "XZY":r=f*i;n=f*e;l=c*i;t=c*e;this.n11=i*k;this.n12=-h;this.n13=e*k;this.n21=r*h+t;this.n22=f*k;this.n23=n*h-l;this.n31=l*h-n;this.n32=c*k;this.n33=t*h+r;break;default:r=f*k,n=f*
+h,l=c*k,t=c*h,this.n11=i*k,this.n12=-i*h,this.n13=e,this.n21=n+l*e,this.n22=r-t*e,this.n23=-c*i,this.n31=t-r*e,this.n32=l+n*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,k=e+e,a=b*f,r=b*i;b*=k;var n=c*i;c*=k;e*=k;f*=h;i*=h;h*=k;this.n11=1-(n+e);this.n12=r-h;this.n13=b+i;this.n21=r+h;this.n22=1-(a+e);this.n23=c-f;this.n31=b-i;this.n32=c+f;this.n33=1-(a+n);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,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,m=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,k=-a.n23*a.n11+a.n21*a.n13,p=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*o;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*m;c[6]=a*o;c[7]=a*k;c[8]=a*p;return b};
+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,k=a.n33*a.n11-a.n31*a.n13,r=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12,a=a.n11*e+a.n21*i+a.n31*n;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*k;c[5]=a*r;c[6]=a*n;c[7]=a*l;c[8]=a*t;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,m,o;i=new THREE.Matrix4;j=b-a;m=c-e;o=f-h;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/o;i.n34=-((f+h)/o);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.makeOrtho=function(a,b,c,e,h,f){var i,k,r,n;i=new THREE.Matrix4;k=b-a;r=c-e;n=f-h;i.n11=2/k;i.n12=0;i.n13=0;i.n14=-((b+a)/k);i.n21=0;i.n22=2/r;i.n23=0;i.n24=-((c+e)/r);i.n31=0;i.n32=0;i.n33=-2/n;i.n34=-((f+h)/n);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,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[f]=i[f]||new THREE.RenderableObject;f++;return a}function b(){var a=o[m]=o[m]||new THREE.RenderableVertex;m++;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,m,o=[],
-k,p,z=[],y,A=[],D,B,ra=[],J,ka,oa=[],S={objects:[],sprites:[],lights:[],elements:[]},ca=new THREE.Vector3,G=new THREE.Vector4,R=new THREE.Matrix4,$=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Vector4,na=new THREE.Vector4;this.computeFrustum=function(a){F[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);F[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);F[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
-a.n23,a.n44+a.n24);F[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);F[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);F[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=F[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(b,e){f=0;S.objects.length=0;S.sprites.length=0;S.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=F[f].x*c.n14+F[f].y*c.n24+F[f].z*c.n34+F[f].w,d<=e){d=!1;break a}d=!0}d?(R.multiplyVector3(ca.copy(b.position)),h=a(),h.object=b,h.z=ca.z,S.objects.push(h)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(R.multiplyVector3(ca.copy(b.position)),h=a(),h.object=b,h.z=ca.z,S.sprites.push(h)):b instanceof THREE.Light&&S.lights.push(b);d=0;for(c=b.children.length;d<c;d++)i(b.children[d])}};i(b);
-e&&S.objects.sort(c);return S};this.projectScene=function(a,f,h){var i=f.near,d=f.far,F,ca,ha,pa,L,qa,V,sa,P,va,ya,Fa,Ja,Ga,za,wa;ka=B=y=p=0;S.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);R.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(R);S=this.projectGraph(a,!1);a=0;for(F=S.objects.length;a<F;a++)if(P=S.objects[a].object,va=
-P.matrixWorld,Fa=P.material,m=0,P instanceof THREE.Mesh){ya=P.geometry;Ja=P.geometry.materials;pa=ya.vertices;Ga=ya.faces;za=ya.faceVertexUvs;ya=P.matrixRotationWorld.extractRotation(va);ca=0;for(ha=pa.length;ca<ha;ca++)j=b(),j.positionWorld.copy(pa[ca].position),va.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),R.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;pa=0;for(ca=Ga.length;pa<ca;pa++){ha=Ga[pa];if(ha instanceof THREE.Face3)if(L=o[ha.a],qa=o[ha.b],V=o[ha.c],L.visible&&qa.visible&&V.visible&&(P.doubleSided||P.flipSided!=(V.positionScreen.x-L.positionScreen.x)*(qa.positionScreen.y-L.positionScreen.y)-(V.positionScreen.y-L.positionScreen.y)*(qa.positionScreen.x-L.positionScreen.x)<0))sa=z[p]=z[p]||new THREE.RenderableFace3,p++,k=sa,k.v1.copy(L),k.v2.copy(qa),k.v3.copy(V);else continue;else if(ha instanceof THREE.Face4)if(L=o[ha.a],qa=o[ha.b],V=o[ha.c],
-sa=o[ha.d],L.visible&&qa.visible&&V.visible&&sa.visible&&(P.doubleSided||P.flipSided!=((sa.positionScreen.x-L.positionScreen.x)*(qa.positionScreen.y-L.positionScreen.y)-(sa.positionScreen.y-L.positionScreen.y)*(qa.positionScreen.x-L.positionScreen.x)<0||(qa.positionScreen.x-V.positionScreen.x)*(sa.positionScreen.y-V.positionScreen.y)-(qa.positionScreen.y-V.positionScreen.y)*(sa.positionScreen.x-V.positionScreen.x)<0)))wa=A[y]=A[y]||new THREE.RenderableFace4,y++,k=wa,k.v1.copy(L),k.v2.copy(qa),k.v3.copy(V),
-k.v4.copy(sa);else continue;k.normalWorld.copy(ha.normal);ya.multiplyVector3(k.normalWorld);k.centroidWorld.copy(ha.centroid);va.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);R.multiplyVector3(k.centroidScreen);V=ha.vertexNormals;L=0;for(qa=V.length;L<qa;L++)sa=k.vertexNormalsWorld[L],sa.copy(V[L]),ya.multiplyVector3(sa);L=0;for(qa=za.length;L<qa;L++)if(wa=za[L][pa]){V=0;for(sa=wa.length;V<sa;V++)k.uvs[L][V]=wa[V]}k.material=Fa;k.faceMaterial=ha.materialIndex!==null?Ja[ha.materialIndex]:
-null;k.z=k.centroidScreen.z;S.elements.push(k)}}else if(P instanceof THREE.Line){$.multiply(R,va);pa=P.geometry.vertices;L=b();L.positionScreen.copy(pa[0].position);$.multiplyVector4(L.positionScreen);ca=1;for(ha=pa.length;ca<ha;ca++)if(L=b(),L.positionScreen.copy(pa[ca].position),$.multiplyVector4(L.positionScreen),qa=o[m-2],N.copy(L.positionScreen),na.copy(qa.positionScreen),e(N,na))N.multiplyScalar(1/N.w),na.multiplyScalar(1/na.w),P=ra[B]=ra[B]||new THREE.RenderableLine,B++,D=P,D.v1.positionScreen.copy(N),
-D.v2.positionScreen.copy(na),D.z=Math.max(N.z,na.z),D.material=Fa,S.elements.push(D)}a=0;for(F=S.sprites.length;a<F;a++)if(P=S.sprites[a].object,va=P.matrixWorld,P instanceof THREE.Particle&&(G.set(va.n14,va.n24,va.n34,1),R.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))i=oa[ka]=oa[ka]||new THREE.RenderableParticle,ka++,J=i,J.x=G.x/G.w,J.y=G.y/G.w,J.z=G.z,J.rotation=P.rotation.z,J.scale.x=P.scale.x*Math.abs(J.x-(G.x+f.projectionMatrix.n11)/(G.w+f.projectionMatrix.n14)),J.scale.y=P.scale.y*Math.abs(J.y-
-(G.y+f.projectionMatrix.n22)/(G.w+f.projectionMatrix.n24)),J.material=P.material,S.elements.push(J);h&&S.elements.sort(c);return S}};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);
+THREE.Projector=function(){function a(){var a=i[f]=i[f]||new THREE.RenderableObject;f++;return a}function b(){var a=n[r]=n[r]||new THREE.RenderableVertex;r++;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=[],k,r,n=[],
+l,t,B=[],C,D=[],F,E,ra=[],O,la,na=[],R={objects:[],sprites:[],lights:[],elements:[]},da=new THREE.Vector3,K=new THREE.Vector4,U=new THREE.Matrix4,X=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Vector4,aa=new THREE.Vector4;this.computeFrustum=function(a){J[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);J[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);J[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
+a.n23,a.n44+a.n24);J[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);J[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);J[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=J[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);U.multiply(b.projectionMatrix,b.matrixWorldInverse);U.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+U.multiply(b.matrixWorld,b.projectionMatrixInverse);U.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;R.objects.length=0;R.sprites.length=0;R.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=J[f].x*c.n14+J[f].y*c.n24+J[f].z*c.n34+J[f].w,d<=e){d=!1;break a}d=!0}d?(U.multiplyVector3(da.copy(b.position)),h=a(),h.object=b,h.z=da.z,R.objects.push(h)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(U.multiplyVector3(da.copy(b.position)),h=a(),h.object=b,h.z=da.z,R.sprites.push(h)):b instanceof THREE.Light&&R.lights.push(b);d=0;for(c=b.children.length;d<c;d++)i(b.children[d])}};i(b);
+e&&R.objects.sort(c);return R};this.projectScene=function(a,f,h){var i=f.near,d=f.far,J,da,ja,sa,H,qa,ga,ta,P,oa,ua,Fa,Ja,Ga,Aa,ya;la=E=C=t=0;R.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);U.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(U);R=this.projectGraph(a,!1);a=0;for(J=R.objects.length;a<J;a++)if(P=R.objects[a].object,oa=
+P.matrixWorld,Fa=P.material,r=0,P instanceof THREE.Mesh){ua=P.geometry;Ja=P.geometry.materials;sa=ua.vertices;Ga=ua.faces;Aa=ua.faceVertexUvs;ua=P.matrixRotationWorld.extractRotation(oa);da=0;for(ja=sa.length;da<ja;da++)k=b(),k.positionWorld.copy(sa[da].position),oa.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),U.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>i&&k.positionScreen.z<
+d;sa=0;for(da=Ga.length;sa<da;sa++){ja=Ga[sa];if(ja instanceof THREE.Face3)if(H=n[ja.a],qa=n[ja.b],ga=n[ja.c],H.visible&&qa.visible&&ga.visible&&(P.doubleSided||P.flipSided!=(ga.positionScreen.x-H.positionScreen.x)*(qa.positionScreen.y-H.positionScreen.y)-(ga.positionScreen.y-H.positionScreen.y)*(qa.positionScreen.x-H.positionScreen.x)<0))ta=B[t]=B[t]||new THREE.RenderableFace3,t++,l=ta,l.v1.copy(H),l.v2.copy(qa),l.v3.copy(ga);else continue;else if(ja instanceof THREE.Face4)if(H=n[ja.a],qa=n[ja.b],
+ga=n[ja.c],ta=n[ja.d],H.visible&&qa.visible&&ga.visible&&ta.visible&&(P.doubleSided||P.flipSided!=((ta.positionScreen.x-H.positionScreen.x)*(qa.positionScreen.y-H.positionScreen.y)-(ta.positionScreen.y-H.positionScreen.y)*(qa.positionScreen.x-H.positionScreen.x)<0||(qa.positionScreen.x-ga.positionScreen.x)*(ta.positionScreen.y-ga.positionScreen.y)-(qa.positionScreen.y-ga.positionScreen.y)*(ta.positionScreen.x-ga.positionScreen.x)<0)))ya=D[C]=D[C]||new THREE.RenderableFace4,C++,l=ya,l.v1.copy(H),l.v2.copy(qa),
+l.v3.copy(ga),l.v4.copy(ta);else continue;l.normalWorld.copy(ja.normal);ua.multiplyVector3(l.normalWorld);l.centroidWorld.copy(ja.centroid);oa.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);U.multiplyVector3(l.centroidScreen);ga=ja.vertexNormals;H=0;for(qa=ga.length;H<qa;H++)ta=l.vertexNormalsWorld[H],ta.copy(ga[H]),ua.multiplyVector3(ta);H=0;for(qa=Aa.length;H<qa;H++)if(ya=Aa[H][sa]){ga=0;for(ta=ya.length;ga<ta;ga++)l.uvs[H][ga]=ya[ga]}l.material=Fa;l.faceMaterial=ja.materialIndex!==
+null?Ja[ja.materialIndex]:null;l.z=l.centroidScreen.z;R.elements.push(l)}}else if(P instanceof THREE.Line){X.multiply(U,oa);sa=P.geometry.vertices;H=b();H.positionScreen.copy(sa[0].position);X.multiplyVector4(H.positionScreen);da=1;for(ja=sa.length;da<ja;da++)if(H=b(),H.positionScreen.copy(sa[da].position),X.multiplyVector4(H.positionScreen),qa=n[r-2],Y.copy(H.positionScreen),aa.copy(qa.positionScreen),e(Y,aa))Y.multiplyScalar(1/Y.w),aa.multiplyScalar(1/aa.w),P=ra[E]=ra[E]||new THREE.RenderableLine,
+E++,F=P,F.v1.positionScreen.copy(Y),F.v2.positionScreen.copy(aa),F.z=Math.max(Y.z,aa.z),F.material=Fa,R.elements.push(F)}a=0;for(J=R.sprites.length;a<J;a++)if(P=R.sprites[a].object,oa=P.matrixWorld,P instanceof THREE.Particle&&(K.set(oa.n14,oa.n24,oa.n34,1),U.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))i=na[la]=na[la]||new THREE.RenderableParticle,la++,O=i,O.x=K.x/K.w,O.y=K.y/K.w,O.z=K.z,O.rotation=P.rotation.z,O.scale.x=P.scale.x*Math.abs(O.x-(K.x+f.projectionMatrix.n11)/(K.w+f.projectionMatrix.n14)),
+O.scale.y=P.scale.y*Math.abs(O.y-(K.y+f.projectionMatrix.n22)/(K.w+f.projectionMatrix.n24)),O.material=P.material,R.elements.push(O);h&&R.elements.sort(c);return R}};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,k=e*h;this.w=i*f-k*c;this.x=i*c+k*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,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,m=this.w,o=m*c+i*h-j*e,k=m*e+j*c-f*h,p=m*h+f*e-i*c,c=-f*
-c-i*e-j*h;b.x=o*m+c*-f+k*-j-p*-i;b.y=k*m+c*-i+p*-f-o*-j;b.z=p*m+c*-j+o*-i-k*-f;return b}};
+this.x,c=this.y,e=this.z,h=this.w,f=a.x,i=a.y,k=a.z,a=a.w;this.x=b*a+h*f+c*k-e*i;this.y=c*a+h*i+e*f-b*k;this.z=e*a+h*k+b*i-c*f;this.w=h*a-b*f-c*i-e*k;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,k=this.z,r=this.w,n=r*c+i*h-k*e,l=r*e+k*c-f*h,t=r*h+f*e-i*c,c=-f*
+c-i*e-k*h;b.x=n*r+c*-f+l*-k-t*-i;b.y=l*r+c*-i+t*-f-n*-k;b.z=t*r+c*-k+n*-i-l*-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};
@@ -79,19 +79,19 @@ THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;ret
 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 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,h,f,i,j=new THREE.Vector3,m=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),m.sub(b.position,c.position),j.crossSelf(m);j.isZero()||j.normalize();f.normal.copy(j)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
+c,e,h,f,i,k=new THREE.Vector3,r=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){f=this.faces[e];if(a&&f.vertexNormals.length){k.set(0,0,0);b=0;for(c=f.vertexNormals.length;b<c;b++)k.addSelf(f.vertexNormals[b]);k.divideScalar(3)}else b=this.vertices[f.a],c=this.vertices[f.b],i=this.vertices[f.c],k.sub(i.position,c.position),r.sub(b.position,c.position),k.crossSelf(r);k.isZero()||k.normalize();f.normal.copy(k)}},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,b,c,e,f,h,K){j=a.vertices[b].position;m=a.vertices[c].position;o=a.vertices[e].position;k=i[f];p=i[h];z=i[K];y=m.x-j.x;A=o.x-j.x;D=m.y-j.y;B=o.y-j.y;ra=m.z-j.z;J=o.z-j.z;ka=p.u-k.u;oa=z.u-k.u;S=p.v-k.v;ca=z.v-k.v;G=1/(ka*ca-oa*S);N.set((ca*y-S*A)*G,(ca*D-S*B)*G,(ca*ra-S*J)*G);na.set((ka*A-oa*y)*G,(ka*B-oa*D)*G,(ka*J-oa*ra)*G);$[b].addSelf(N);$[c].addSelf(N);$[e].addSelf(N);
-F[b].addSelf(na);F[c].addSelf(na);F[e].addSelf(na)}var b,c,e,h,f,i,j,m,o,k,p,z,y,A,D,B,ra,J,ka,oa,S,ca,G,R,$=[],F=[],N=new THREE.Vector3,na=new THREE.Vector3,ua=new THREE.Vector3,ta=new THREE.Vector3,U=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)$[b]=new THREE.Vector3,F[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 K=["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++)U.copy(f.vertexNormals[e]),h=f[K[e]],R=$[h],ua.copy(R),ua.subSelf(U.multiplyScalar(U.dot(R))).normalize(),ta.cross(f.vertexNormals[e],R),h=ta.dot(F[h]),h=h<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(ua.x,ua.y,ua.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],
+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,N){k=a.vertices[b].position;r=a.vertices[c].position;n=a.vertices[e].position;l=i[f];t=i[h];B=i[N];C=r.x-k.x;D=n.x-k.x;F=r.y-k.y;E=n.y-k.y;ra=r.z-k.z;O=n.z-k.z;la=t.u-l.u;na=B.u-l.u;R=t.v-l.v;da=B.v-l.v;K=1/(la*da-na*R);Y.set((da*C-R*D)*K,(da*F-R*E)*K,(da*ra-R*O)*K);aa.set((la*D-na*C)*K,(la*E-na*F)*K,(la*O-na*ra)*K);X[b].addSelf(Y);X[c].addSelf(Y);X[e].addSelf(Y);
+J[b].addSelf(aa);J[c].addSelf(aa);J[e].addSelf(aa)}var b,c,e,h,f,i,k,r,n,l,t,B,C,D,F,E,ra,O,la,na,R,da,K,U,X=[],J=[],Y=new THREE.Vector3,aa=new THREE.Vector3,ma=new THREE.Vector3,xa=new THREE.Vector3,ka=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)X[b]=new THREE.Vector3,J[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 N=["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++)ka.copy(f.vertexNormals[e]),h=f[N[e]],U=X[h],ma.copy(U),ma.subSelf(ka.multiplyScalar(ka.dot(U))).normalize(),xa.cross(f.vertexNormals[e],U),h=xa.dot(J[h]),h=h<0?-1:1,f.vertexTangents[e]=new THREE.Vector4(ma.x,ma.y,ma.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,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,m,o,k,p,z;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;o=this.points[c[0]];k=this.points[c[1]];
-p=this.points[c[2]];z=this.points[c[3]];j=i*i;m=i*j;e.x=b(o.x,k.x,p.x,z.x,i,j,m);e.y=b(o.y,k.y,p.y,z.y,i,j,m);e.z=b(o.z,k.z,p.z,z.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,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,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);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.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,k,r,n,l,t,B;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;n=this.points[c[0]];l=this.points[c[1]];
+t=this.points[c[2]];B=this.points[c[3]];k=i*i;r=i*k;e.x=b(n.x,l.x,t.x,B.x,i,k,r);e.y=b(n.y,l.y,t.y,B.y,i,k,r);e.z=b(n.z,l.z,t.z,B.z,i,k,r);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=[],k=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),
+k+=h.distanceTo(f),f.copy(position),b*=this.points.length-1,b=Math.floor(b),b!=e&&(i[b]=k,e=b);i[i.length]=k;return{chunks:i,total:k}};this.reparametrizeByArcLength=function(a){var b,c,e,f,h,i,k=[],l=new THREE.Vector3,r=this.getLength();k.push(l.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=r.chunks[b]-r.chunks[b-1];i=Math.ceil(a*c/r.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),k.push(l.copy(position).clone());
+k.push(l.copy(this.points[b]).clone())}this.points=k}};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,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;
@@ -121,14 +121,14 @@ void 0?a.fog:!1;this.lights=a.lights!==void 0?a.lights:!1;this.vertexColors=a.ve
 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,h,f,i,j,m){THREE.Texture.call(this,null,h,f,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,k,r){THREE.Texture.call(this,null,h,f,i,k,r);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.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,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],
+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,k;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,k=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,k!==void 0?e.scale.set(k[0],k[1],k[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)};
@@ -179,123 +179,129 @@ THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"v
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,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,
-l=i.length,r=a.colors,j=r.length,q=a.__vertexArray,s=a.__colorArray,Y=a.__sortArray,u=a.__dirtyVertices,k=a.__dirtyColors,m=a.__webglCustomAttributesList;if(c.sortParticles){Ba.multiplySelf(c.matrixWorld);for(e=0;e<l;e++)f=i[e].position,Ha.copy(f),Ba.multiplyVector3(Ha),Y[e]=[Ha.z,e];Y.sort(function(a,b){return b[0]-a[0]});for(e=0;e<l;e++)f=i[Y[e][1]].position,h=e*3,q[h]=f.x,q[h+1]=f.y,q[h+2]=f.z;for(e=0;e<j;e++)h=e*3,color=r[Y[e][1]],s[h]=color.r,s[h+1]=color.g,s[h+2]=color.b;if(m){r=0;for(j=m.length;r<
-j;r++)if(l=m[r],l.boundTo===void 0||l.boundTo==="vertices"){h=0;f=l.value.length;for(e=0;e<f;e++)index=Y[e][1],l.size===1?l.array[h]=l.value[index]:(i=l.value[index],l.size===2?(l.array[h]=i.x,l.array[h+1]=i.y):l.size===3?l.type==="c"?(l.array[h]=i.r,l.array[h+1]=i.g,l.array[h+2]=i.b):(l.array[h]=i.x,l.array[h+1]=i.y,l.array[h+2]=i.z):(l.array[h]=i.x,l.array[h+1]=i.y,l.array[h+2]=i.z,l.array[h+3]=i.w)),h+=l.size}}}else{if(u)for(e=0;e<l;e++)f=i[e].position,h=e*3,q[h]=f.x,q[h+1]=f.y,q[h+2]=f.z;if(k)for(e=
-0;e<j;e++)color=r[e],h=e*3,s[h]=color.r,s[h+1]=color.g,s[h+2]=color.b;if(m){r=0;for(j=m.length;r<j;r++)if(l=m[r],l.__original.needsUpdate&&(l.boundTo===void 0||l.boundTo==="vertices")){f=l.value.length;for(e=h=0;e<f;e++)offset_custom=l.offset,l.size===1?l.array[h]=l.value[e]:(i=l.value[e],l.size===2?(l.array[h]=i.x,l.array[h+1]=i.y):l.size===3?l.type==="c"?(l.array[h]=i.r,l.array[h+1]=i.g,l.array[h+2]=i.b):(l.array[h]=i.x,l.array[h+1]=i.y,l.array[h+2]=i.z):(l.array[h]=i.x,l.array[h+1]=i.y,l.array[h+
-2]=i.z,l.array[h+3]=i.w)),h+=l.size}}}if(u||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,q,b);if(k||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,s,b);if(m){r=0;for(j=m.length;r<j;r++)if(l=m[r],l.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,l.buffer),d.bufferData(d.ARRAY_BUFFER,l.array,b)}}function h(a,b,c,e,h){e.program||K.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=
-new Float32Array(K.maxMorphTargets);for(var f=0,i=K.maxMorphTargets;f<i;f++)h.__webglMorphTargetInfluences[f]=0}var l=!1,f=e.program,i=f.uniforms,r=e.uniforms;f!==Qa&&(d.useProgram(f),Qa=f,l=!0);if(e.id!==pa)pa=e.id,l=!0;if(l){d.uniformMatrix4fv(i.projectionMatrix,!1,Na);if(c&&e.fog)if(r.fogColor.value=c.color,c instanceof THREE.Fog)r.fogNear.value=c.near,r.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)r.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
-e.lights){for(var j,q,s=0,Y=0,u=0,k,m,o,w=Sa,p=w.directional.colors,z=w.directional.positions,v=w.point.colors,t=w.point.positions,y=w.point.distances,A=0,D=0,c=j=o=0,l=b.length;c<l;c++)if(j=b[c],q=j.color,k=j.position,m=j.intensity,o=j.distance,j instanceof THREE.AmbientLight)K.gammaInput?(s+=q.r*q.r,Y+=q.g*q.g,u+=q.b*q.b):(s+=q.r,Y+=q.g,u+=q.b);else if(j instanceof THREE.DirectionalLight)o=A*3,K.gammaInput?(p[o]=q.r*q.r*m*m,p[o+1]=q.g*q.g*m*m,p[o+2]=q.b*q.b*m*m):(p[o]=q.r*m,p[o+1]=q.g*m,p[o+2]=
-q.b*m),z[o]=k.x,z[o+1]=k.y,z[o+2]=k.z,A+=1;else if(j instanceof THREE.SpotLight)o=A*3,K.gammaInput?(p[o]=q.r*q.r*m*m,p[o+1]=q.g*q.g*m*m,p[o+2]=q.b*q.b*m*m):(p[o]=q.r*m,p[o+1]=q.g*m,p[o+2]=q.b*m),q=1/k.length(),z[o]=k.x*q,z[o+1]=k.y*q,z[o+2]=k.z*q,A+=1;else if(j instanceof THREE.PointLight)j=D*3,K.gammaInput?(v[j]=q.r*q.r*m*m,v[j+1]=q.g*q.g*m*m,v[j+2]=q.b*q.b*m*m):(v[j]=q.r*m,v[j+1]=q.g*m,v[j+2]=q.b*m),t[j]=k.x,t[j+1]=k.y,t[j+2]=k.z,y[D]=o,D+=1;c=A*3;for(l=p.length;c<l;c++)p[c]=0;c=D*3;for(l=v.length;c<
-l;c++)v[c]=0;w.point.length=D;w.directional.length=A;w.ambient[0]=s;w.ambient[1]=Y;w.ambient[2]=u;b=Sa;r.enableLighting.value=b.directional.length+b.point.length;r.ambientLightColor.value=b.ambient;r.directionalLightColor.value=b.directional.colors;r.directionalLightDirection.value=b.directional.positions;r.pointLightColor.value=b.point.colors;r.pointLightPosition.value=b.point.positions;r.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||
-e instanceof THREE.MeshPhongMaterial)r.opacity.value=e.opacity,K.gammaInput?r.diffuse.value.copyGammaToLinear(e.color):r.diffuse.value=e.color,(r.map.texture=e.map)&&r.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),r.lightMap.texture=e.lightMap,r.envMap.texture=e.envMap,r.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,r.reflectivity.value=e.reflectivity,r.refractionRatio.value=e.refractionRatio,r.combine.value=e.combine,r.useRefract.value=
-e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)r.diffuse.value=e.color,r.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)r.psColor.value=e.color,r.opacity.value=e.opacity,r.size.value=e.size,r.scale.value=Ca.height/2,r.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)r.shininess.value=e.shininess,K.gammaInput?(r.ambient.value.copyGammaToLinear(e.ambient),r.specular.value.copyGammaToLinear(e.specular)):
-(r.ambient.value=e.ambient,r.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)K.gammaInput?r.ambient.value.copyGammaToLinear(e.ambient):r.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)r.mNear.value=a.near,r.mFar.value=a.far,r.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)r.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&r.shadowMatrix){for(b=0;b<La.length;b++)r.shadowMatrix.value[b]=La[b],r.shadowMap.texture[b]=K.shadowMap[b];
-r.shadowDarkness.value=K.shadowMapDarkness;r.shadowBias.value=K.shadowMapBias}b=e.uniformsList;r=0;for(c=b.length;r<c;r++)if(Y=f.uniforms[b[r][1]])if(s=b[r][0],u=s.type,l=s.value,u==="i")d.uniform1i(Y,l);else if(u==="f")d.uniform1f(Y,l);else if(u==="v2")d.uniform2f(Y,l.x,l.y);else if(u==="v3")d.uniform3f(Y,l.x,l.y,l.z);else if(u==="v4")d.uniform4f(Y,l.x,l.y,l.z,l.w);else if(u==="c")d.uniform3f(Y,l.r,l.g,l.b);else if(u==="fv1")d.uniform1fv(Y,l);else if(u==="fv")d.uniform3fv(Y,l);else if(u==="v3v"){if(!s._array)s._array=
-new Float32Array(3*l.length);u=0;for(k=l.length;u<k;u++)w=u*3,s._array[w]=l[u].x,s._array[w+1]=l[u].y,s._array[w+2]=l[u].z;d.uniform3fv(Y,s._array)}else if(u==="m4"){if(!s._array)s._array=new Float32Array(16);l.flattenToArray(s._array);d.uniformMatrix4fv(Y,!1,s._array)}else if(u==="m4v"){if(!s._array)s._array=new Float32Array(16*l.length);u=0;for(k=l.length;u<k;u++)l[u].flattenToArrayOffset(s._array,u*16);d.uniformMatrix4fv(Y,!1,s._array)}else if(u==="t"){if(d.uniform1i(Y,l),Y=s.texture)if(Y.image instanceof
-Array&&Y.image.length===6){if(s=Y,s.image.length===6)if(s.needsUpdate){if(!s.image.__webglTextureCube)s.image.__webglTextureCube=d.createTexture();d.activeTexture(d.TEXTURE0+l);d.bindTexture(d.TEXTURE_CUBE_MAP,s.image.__webglTextureCube);for(l=0;l<6;l++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,s.image[l]);R(d.TEXTURE_CUBE_MAP,s,s.image[0]);s.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,s.image.__webglTextureCube)}else Y instanceof
-THREE.WebGLRenderTargetCube?(s=Y,d.activeTexture(d.TEXTURE0+l),d.bindTexture(d.TEXTURE_CUBE_MAP,s.__webglTexture)):$(Y,l)}else if(u==="tv"){if(!s._array){s._array=[];u=0;for(k=s.texture.length;u<k;u++)s._array[u]=l+u}d.uniform1iv(Y,s._array);u=0;for(k=s.texture.length;u<k;u++)(Y=s.texture[u])&&$(Y,s._array[u])}(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
+o=i.length,s=a.colors,k=s.length,m=a.__vertexArray,q=a.__colorArray,l=a.__sortArray,x=a.__dirtyVertices,r=a.__dirtyColors,n=a.__webglCustomAttributesList;if(c.sortParticles){Ba.multiplySelf(c.matrixWorld);for(e=0;e<o;e++)f=i[e].position,Ha.copy(f),Ba.multiplyVector3(Ha),l[e]=[Ha.z,e];l.sort(function(a,b){return b[0]-a[0]});for(e=0;e<o;e++)f=i[l[e][1]].position,h=e*3,m[h]=f.x,m[h+1]=f.y,m[h+2]=f.z;for(e=0;e<k;e++)h=e*3,color=s[l[e][1]],q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(n){s=0;for(k=n.length;s<
+k;s++)if(o=n[s],o.boundTo===void 0||o.boundTo==="vertices"){h=0;f=o.value.length;for(e=0;e<f;e++)index=l[e][1],o.size===1?o.array[h]=o.value[index]:(i=o.value[index],o.size===2?(o.array[h]=i.x,o.array[h+1]=i.y):o.size===3?o.type==="c"?(o.array[h]=i.r,o.array[h+1]=i.g,o.array[h+2]=i.b):(o.array[h]=i.x,o.array[h+1]=i.y,o.array[h+2]=i.z):(o.array[h]=i.x,o.array[h+1]=i.y,o.array[h+2]=i.z,o.array[h+3]=i.w)),h+=o.size}}}else{if(x)for(e=0;e<o;e++)f=i[e].position,h=e*3,m[h]=f.x,m[h+1]=f.y,m[h+2]=f.z;if(r)for(e=
+0;e<k;e++)color=s[e],h=e*3,q[h]=color.r,q[h+1]=color.g,q[h+2]=color.b;if(n){s=0;for(k=n.length;s<k;s++)if(o=n[s],o.__original.needsUpdate&&(o.boundTo===void 0||o.boundTo==="vertices")){f=o.value.length;for(e=h=0;e<f;e++)offset_custom=o.offset,o.size===1?o.array[h]=o.value[e]:(i=o.value[e],o.size===2?(o.array[h]=i.x,o.array[h+1]=i.y):o.size===3?o.type==="c"?(o.array[h]=i.r,o.array[h+1]=i.g,o.array[h+2]=i.b):(o.array[h]=i.x,o.array[h+1]=i.y,o.array[h+2]=i.z):(o.array[h]=i.x,o.array[h+1]=i.y,o.array[h+
+2]=i.z,o.array[h+3]=i.w)),h+=o.size}}}if(x||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d.bufferData(d.ARRAY_BUFFER,m,b);if(r||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,a.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,q,b);if(n){s=0;for(k=n.length;s<k;s++)if(o=n[s],o.__original.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,o.buffer),d.bufferData(d.ARRAY_BUFFER,o.array,b)}}function h(a,b,c,e,h){e.program||N.initMaterial(e,b,c,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=
+new Float32Array(N.maxMorphTargets);for(var f=0,i=N.maxMorphTargets;f<i;f++)h.__webglMorphTargetInfluences[f]=0}var o=!1,f=e.program,i=f.uniforms,s=e.uniforms;f!==Qa&&(d.useProgram(f),Qa=f,o=!0);if(e.id!==sa)sa=e.id,o=!0;if(o){d.uniformMatrix4fv(i.projectionMatrix,!1,Na);if(c&&e.fog)if(s.fogColor.value=c.color,c instanceof THREE.Fog)s.fogNear.value=c.near,s.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)s.fogDensity.value=c.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||
+e.lights){for(var k,m,q=0,l=0,x=0,r,n,t,u=Sa,B=u.directional.colors,w=u.directional.positions,v=u.point.colors,C=u.point.positions,D=u.point.distances,F=0,E=0,c=k=t=0,o=b.length;c<o;c++)if(k=b[c],m=k.color,r=k.position,n=k.intensity,t=k.distance,k instanceof THREE.AmbientLight)N.gammaInput?(q+=m.r*m.r,l+=m.g*m.g,x+=m.b*m.b):(q+=m.r,l+=m.g,x+=m.b);else if(k instanceof THREE.DirectionalLight)t=F*3,N.gammaInput?(B[t]=m.r*m.r*n*n,B[t+1]=m.g*m.g*n*n,B[t+2]=m.b*m.b*n*n):(B[t]=m.r*n,B[t+1]=m.g*n,B[t+2]=
+m.b*n),w[t]=r.x,w[t+1]=r.y,w[t+2]=r.z,F+=1;else if(k instanceof THREE.SpotLight)t=F*3,N.gammaInput?(B[t]=m.r*m.r*n*n,B[t+1]=m.g*m.g*n*n,B[t+2]=m.b*m.b*n*n):(B[t]=m.r*n,B[t+1]=m.g*n,B[t+2]=m.b*n),m=1/r.length(),w[t]=r.x*m,w[t+1]=r.y*m,w[t+2]=r.z*m,F+=1;else if(k instanceof THREE.PointLight)k=E*3,N.gammaInput?(v[k]=m.r*m.r*n*n,v[k+1]=m.g*m.g*n*n,v[k+2]=m.b*m.b*n*n):(v[k]=m.r*n,v[k+1]=m.g*n,v[k+2]=m.b*n),C[k]=r.x,C[k+1]=r.y,C[k+2]=r.z,D[E]=t,E+=1;c=F*3;for(o=B.length;c<o;c++)B[c]=0;c=E*3;for(o=v.length;c<
+o;c++)v[c]=0;u.point.length=E;u.directional.length=F;u.ambient[0]=q;u.ambient[1]=l;u.ambient[2]=x;b=Sa;s.enableLighting.value=b.directional.length+b.point.length;s.ambientLightColor.value=b.ambient;s.directionalLightColor.value=b.directional.colors;s.directionalLightDirection.value=b.directional.positions;s.pointLightColor.value=b.point.colors;s.pointLightPosition.value=b.point.positions;s.pointLightDistance.value=b.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||
+e instanceof THREE.MeshPhongMaterial)s.opacity.value=e.opacity,N.gammaInput?s.diffuse.value.copyGammaToLinear(e.color):s.diffuse.value=e.color,(s.map.texture=e.map)&&s.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),s.lightMap.texture=e.lightMap,s.envMap.texture=e.envMap,s.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,s.reflectivity.value=e.reflectivity,s.refractionRatio.value=e.refractionRatio,s.combine.value=e.combine,s.useRefract.value=
+e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)s.diffuse.value=e.color,s.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)s.psColor.value=e.color,s.opacity.value=e.opacity,s.size.value=e.size,s.scale.value=Ca.height/2,s.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)s.shininess.value=e.shininess,N.gammaInput?(s.ambient.value.copyGammaToLinear(e.ambient),s.specular.value.copyGammaToLinear(e.specular)):
+(s.ambient.value=e.ambient,s.specular.value=e.specular);else if(e instanceof THREE.MeshLambertMaterial)N.gammaInput?s.ambient.value.copyGammaToLinear(e.ambient):s.ambient.value=e.ambient;else if(e instanceof THREE.MeshDepthMaterial)s.mNear.value=a.near,s.mFar.value=a.far,s.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)s.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&s.shadowMatrix){for(b=0;b<La.length;b++)s.shadowMatrix.value[b]=La[b],s.shadowMap.texture[b]=N.shadowMap[b];
+s.shadowDarkness.value=N.shadowMapDarkness;s.shadowBias.value=N.shadowMapBias}b=e.uniformsList;s=0;for(c=b.length;s<c;s++)if(l=f.uniforms[b[s][1]])if(q=b[s][0],x=q.type,o=q.value,x==="i")d.uniform1i(l,o);else if(x==="f")d.uniform1f(l,o);else if(x==="v2")d.uniform2f(l,o.x,o.y);else if(x==="v3")d.uniform3f(l,o.x,o.y,o.z);else if(x==="v4")d.uniform4f(l,o.x,o.y,o.z,o.w);else if(x==="c")d.uniform3f(l,o.r,o.g,o.b);else if(x==="fv1")d.uniform1fv(l,o);else if(x==="fv")d.uniform3fv(l,o);else if(x==="v3v"){if(!q._array)q._array=
+new Float32Array(3*o.length);x=0;for(r=o.length;x<r;x++)u=x*3,q._array[u]=o[x].x,q._array[u+1]=o[x].y,q._array[u+2]=o[x].z;d.uniform3fv(l,q._array)}else if(x==="m4"){if(!q._array)q._array=new Float32Array(16);o.flattenToArray(q._array);d.uniformMatrix4fv(l,!1,q._array)}else if(x==="m4v"){if(!q._array)q._array=new Float32Array(16*o.length);x=0;for(r=o.length;x<r;x++)o[x].flattenToArrayOffset(q._array,x*16);d.uniformMatrix4fv(l,!1,q._array)}else if(x==="t"){if(d.uniform1i(l,o),l=q.texture)if(l.image instanceof
+Array&&l.image.length===6){if(q=l,q.image.length===6)if(q.needsUpdate){if(!q.image.__webglTextureCube)q.image.__webglTextureCube=d.createTexture();d.activeTexture(d.TEXTURE0+o);d.bindTexture(d.TEXTURE_CUBE_MAP,q.image.__webglTextureCube);for(o=0;o<6;o++)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,q.image[o]);U(d.TEXTURE_CUBE_MAP,q,q.image[0]);q.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+o),d.bindTexture(d.TEXTURE_CUBE_MAP,q.image.__webglTextureCube)}else l instanceof
+THREE.WebGLRenderTargetCube?(q=l,d.activeTexture(d.TEXTURE0+o),d.bindTexture(d.TEXTURE_CUBE_MAP,q.__webglTexture)):X(l,o)}else if(x==="tv"){if(!q._array){q._array=[];x=0;for(r=q.texture.length;x<r;x++)q._array[x]=o+x}d.uniform1iv(l,q._array);x=0;for(r=q.texture.length;x<r;x++)(l=q.texture[x])&&X(l,q._array[x])}(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,Oa);e.skinning&&(d.uniformMatrix4fv(i.cameraInverseMatrix,!1,Oa),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,e,f,i){if(e.opacity!==0){var j,l,c=h(a,b,c,e,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==L&&(L=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 r=i.morphTargetForcedOrder;for(l=i.morphTargetInfluences;j<e.numSupportedMorphTargets&&j<r.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[r[j]]),d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[j]=l[r[j]],j++}else{var r=[],m=-1,
-q=0;l=i.morphTargetInfluences;var s,k=l.length;j=0;for(i.morphTargetBase!==-1&&(r[i.morphTargetBase]=!0);j<e.numSupportedMorphTargets;){for(s=0;s<k;s++)!r[s]&&l[s]>m&&(q=s,m=l[q]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[q]);d.vertexAttribPointer(c["morphTarget"+j],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[j]=m;r[q]=1;m=-1;j++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){j=
-0;for(l=f.__webglCustomAttributesList.length;j<l;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,
+i.objectMatrix!==null&&d.uniformMatrix4fv(i.objectMatrix,!1,h._objectMatrixArray);return f}function f(a,b,c,e,f,i){if(e.opacity!==0){var k,o,c=h(a,b,c,e,i),a=c.attributes,b=!1,c=f.id*16777215+c.id*2+(e.wireframe?1:0);c!==H&&(H=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){k=0;var s=i.morphTargetForcedOrder;for(o=i.morphTargetInfluences;k<e.numSupportedMorphTargets&&k<s.length;)d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[s[k]]),d.vertexAttribPointer(c["morphTarget"+k],3,d.FLOAT,!1,0,0),i.__webglMorphTargetInfluences[k]=o[s[k]],k++}else{var s=[],l=-1,
+m=0;o=i.morphTargetInfluences;var q,n=o.length;k=0;for(i.morphTargetBase!==-1&&(s[i.morphTargetBase]=!0);k<e.numSupportedMorphTargets;){for(q=0;q<n;q++)!s[q]&&o[q]>l&&(m=q,l=o[m]);d.bindBuffer(d.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[m]);d.vertexAttribPointer(c["morphTarget"+k],3,d.FLOAT,!1,0,0);i.__webglMorphTargetInfluences[k]=l;s[m]=1;l=-1;k++}}e.program.uniforms.morphTargetInfluences!==null&&d.uniform1fv(e.program.uniforms.morphTargetInfluences,i.__webglMorphTargetInfluences)}if(b){if(f.__webglCustomAttributesList){k=
+0;for(o=f.__webglCustomAttributesList.length;k<o;k++)c=f.__webglCustomAttributesList[k],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)),K.info.render.calls++,K.info.render.vertices+=f.__webglFaceCount,K.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),K.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),K.info.render.calls++):i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),K.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,l,j,m,q,s,k,u=a.count*3;for(k=0;k<u;k+=9)c=a.normalArray,e=c[k],f=c[k+1],h=c[k+2],i=c[k+3],j=c[k+4],q=c[k+5],l=c[k+6],m=c[k+7],s=c[k+8],e=(e+i+l)/3,f=(f+j+m)/3,h=(h+q+s)/3,c[k]=e,c[k+1]=f,c[k+2]=h,c[k+3]=e,c[k+4]=f,c[k+5]=h,c[k+6]=e,c[k+7]=f,c[k+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(V!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),V=a.doubleSided;if(sa!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),sa=a.flipSided}function m(a){va!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),va=a)}function o(a){ya!==a&&(d.depthMask(a),ya=a)}function k(a,
-b,c){Fa!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Fa=a);if(a&&(Ja!==b||Ga!==c))d.polygonOffset(b,c),Ja=b,Ga=c}function p(a){xa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);xa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);xa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);xa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);xa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);xa[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=xa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function z(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=xa[c].x*b.n14+xa[c].y*b.n24+xa[c].z*b.n34+xa[c].w,a<=d)return!1;return!0}function y(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function A(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 D(a,b){return b.z-a.z}function B(a){var b,c,e,k=0,Q,o,l,r,M=a.lights;Z||(Z=new THREE.PerspectiveCamera(K.shadowCameraFov,K.shadowMapWidth/K.shadowMapHeight,K.shadowCameraNear,K.shadowCameraFar));b=0;for(c=M.length;b<c;b++)if(e=M[b],e instanceof THREE.SpotLight&&e.castShadow){pa=
--1;K.shadowMap[k]||(K.shadowMap[k]=new THREE.WebGLRenderTarget(K.shadowMapWidth,K.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));La[k]||(La[k]=new THREE.Matrix4);Q=K.shadowMap[k];o=La[k];Z.position.copy(e.position);Z.lookAt(e.target.position);Z.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(Z));this.autoUpdateScene&&a.updateMatrixWorld();Z.matrixWorldInverse.getInverse(Z.matrixWorld);o.set(0.5,0,0,0.5,0,0.5,0,0.5,
-0,0,0.5,0.5,0,0,0,1);o.multiplySelf(Z.projectionMatrix);o.multiplySelf(Z.matrixWorldInverse);Z.matrixWorldInverse.flattenToArray(Oa);Z.projectionMatrix.flattenToArray(Na);Ba.multiply(Z.projectionMatrix,Z.matrixWorldInverse);p(Ba);N(Q);d.clearColor(1,1,1,1);K.clear();d.clearColor(la.r,la.g,la.b,Da);o=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(Q=0;Q<o;Q++)l=a.__webglObjects[Q],r=l.object,r.visible&&r.castShadow?!(r instanceof THREE.Mesh)||!r.frustumCulled||z(r)?(r.matrixWorld.flattenToArray(r._objectMatrixArray),
-J(r,Z,!1),l.render=!0):l.render=!1:l.render=!1;m(!0);G(THREE.NormalBlending);for(Q=0;Q<o;Q++)if(l=a.__webglObjects[Q],l.render)r=l.object,buffer=l.buffer,j(r),l=r.customDepthMaterial?r.customDepthMaterial:r.geometry.morphTargets.length?Ta:Pa,f(Z,M,null,l,buffer,r);for(Q=0;Q<e;Q++)l=a.__webglObjectsImmediate[Q],r=l.object,r.visible&&r.castShadow&&(r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray),L=-1,J(r,Z,!1),j(r),program=h(Z,M,null,Pa,r),r.immediateRenderCallback?r.immediateRenderCallback(program,
-d,xa):r.render(function(a){i(a,program,Pa.shading)}));k++}}function ra(a,b){var c,e,f;c=t.attributes;var h=t.uniforms,i=Ia/Ma,l,j=[],k=Ma*0.5,q=Ia*0.5,s=!0;d.useProgram(t.program);Qa=t.program;L=va=P=-1;Ua||(d.enableVertexAttribArray(t.attributes.position),d.enableVertexAttribArray(t.attributes.uv),Ua=!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,Na);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(D);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-k)/k,(q-f.position.y)/q,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)),l=f.map.image.width/(f.scaleByViewport?Ia:1),j[0]=l*i*f.scale.x,j[1]=l*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,j),f.mergeWith3D&&!s?(d.enable(d.DEPTH_TEST),s=!0):!f.mergeWith3D&&s&&(d.disable(d.DEPTH_TEST),s=!1),G(f.blending),$(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(ya)}function J(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 oa(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function S(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function ca(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}
-function G(a){if(a!==P){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)}P=a}}function R(a,b,c){(c.width&c.width-
-1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,U(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,U(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,U(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,U(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,ta(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,ta(b.minFilter)))}function $(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
-!0,a.__webglTexture=d.createTexture(),K.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,U(a.format),a.image.width,a.image.height,0,U(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);R(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function F(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 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=d.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];d.bindTexture(d.TEXTURE_CUBE_MAP,a.__webglTexture);R(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,U(a.format),a.width,a.height,0,U(a.format),U(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);F(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),R(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,U(a.format),a.width,a.height,0,U(a.format),U(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),F(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=Ma,a=Ia,e=za,f=wa);b!==ha&&(d.bindFramebuffer(d.FRAMEBUFFER,
-b),d.viewport(e,f,c,a),ha=b)}function na(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 ua(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 ta(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function U(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;
+(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)),N.info.render.calls++,N.info.render.vertices+=f.__webglFaceCount,N.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),N.info.render.calls++):i instanceof THREE.ParticleSystem?(d.drawArrays(d.POINTS,0,f.__webglParticleCount),N.info.render.calls++):i instanceof THREE.Ribbon&&(d.drawArrays(d.TRIANGLE_STRIP,0,f.__webglVertexCount),N.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,o,k,l,m,q,n,x=a.count*3;for(n=0;n<x;n+=9)c=a.normalArray,e=c[n],f=c[n+1],h=c[n+2],i=c[n+3],k=c[n+4],m=c[n+5],o=c[n+6],l=c[n+7],q=c[n+8],e=(e+i+o)/3,f=(f+k+l)/3,h=(h+m+q)/3,c[n]=e,c[n+1]=f,c[n+2]=h,c[n+3]=e,c[n+4]=f,c[n+5]=h,c[n+6]=e,c[n+7]=f,c[n+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 k(a){if(ga!==a.doubleSided)a.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE),ga=a.doubleSided;if(ta!==a.flipSided)a.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW),ta=a.flipSided}function r(a){oa!==a&&(a?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST),oa=a)}function n(a){ua!==a&&(d.depthMask(a),ua=a)}
+function l(a,b,c){Fa!==a&&(a?d.enable(d.POLYGON_OFFSET_FILL):d.disable(d.POLYGON_OFFSET_FILL),Fa=a);if(a&&(Ja!==b||Ga!==c))d.polygonOffset(b,c),Ja=b,Ga=c}function t(a){va[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);va[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);va[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);va[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);va[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);va[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=va[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function B(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=va[c].x*b.n14+va[c].y*b.n24+va[c].z*b.n34+va[c].w,a<=d)return!1;return!0}function C(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function D(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 F(a,b){return b.z-a.z}function E(a){var b,c,e,l=0,T,n,o,s,Q=a.lights;pa||(pa=new THREE.PerspectiveCamera(N.shadowCameraFov,N.shadowMapWidth/N.shadowMapHeight,N.shadowCameraNear,N.shadowCameraFar));b=0;for(c=Q.length;b<c;b++)if(e=Q[b],e instanceof THREE.SpotLight&&e.castShadow){sa=
+-1;N.shadowMap[l]||(N.shadowMap[l]=new THREE.WebGLRenderTarget(N.shadowMapWidth,N.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));La[l]||(La[l]=new THREE.Matrix4);T=N.shadowMap[l];n=La[l];pa.position.copy(e.position);pa.lookAt(e.target.position);pa.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(pa));this.autoUpdateScene&&a.updateMatrixWorld();pa.matrixWorldInverse.getInverse(pa.matrixWorld);n.set(0.5,0,0,0.5,0,0.5,
+0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(pa.projectionMatrix);n.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(Oa);pa.projectionMatrix.flattenToArray(Na);Ba.multiply(pa.projectionMatrix,pa.matrixWorldInverse);t(Ba);Y(T);d.clearColor(1,1,1,1);N.clear();d.clearColor(wa.r,wa.g,wa.b,Da);n=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(T=0;T<n;T++)o=a.__webglObjects[T],s=o.object,s.visible&&s.castShadow?!(s instanceof THREE.Mesh)||!s.frustumCulled||B(s)?(s.matrixWorld.flattenToArray(s._objectMatrixArray),
+O(s,pa,!1),o.render=!0):o.render=!1:o.render=!1;r(!0);K(THREE.NormalBlending);for(T=0;T<n;T++)if(o=a.__webglObjects[T],o.render)s=o.object,buffer=o.buffer,k(s),o=s.customDepthMaterial?s.customDepthMaterial:s.geometry.morphTargets.length?Ta:Pa,f(pa,Q,null,o,buffer,s);for(T=0;T<e;T++)o=a.__webglObjectsImmediate[T],s=o.object,s.visible&&s.castShadow&&(s.matrixAutoUpdate&&s.matrixWorld.flattenToArray(s._objectMatrixArray),H=-1,O(s,pa,!1),k(s),program=h(pa,Q,null,Pa,s),s.immediateRenderCallback?s.immediateRenderCallback(program,
+d,va):s.render(function(a){i(a,program,Pa.shading)}));l++}}function ra(a,b){var c,e,f;c=w.attributes;var h=w.uniforms,i=Ia/Ma,o,k=[],l=Ma*0.5,m=Ia*0.5,q=!0;d.useProgram(w.program);Qa=w.program;H=oa=P=-1;Ua||(d.enableVertexAttribArray(w.attributes.position),d.enableVertexAttribArray(w.attributes.uv),Ua=!0);d.disable(d.CULL_FACE);d.enable(d.BLEND);d.depthMask(!0);d.bindBuffer(d.ARRAY_BUFFER,w.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,w.elementBuffer);d.uniformMatrix4fv(h.projectionMatrix,!1,Na);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(F);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-l)/l,(m-f.position.y)/m,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)),o=f.map.image.width/(f.scaleByViewport?Ia:1),k[0]=o*i*f.scale.x,k[1]=o*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&&!q?(d.enable(d.DEPTH_TEST),q=!0):!f.mergeWith3D&&q&&(d.disable(d.DEPTH_TEST),q=!1),K(f.blending),X(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(ua)}function O(a,
+b,d){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function la(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 R(a,b){for(var d=a.length-1;d>=0;d--)a[d].object===b&&a.splice(d,1)}function da(a,b,d){a.push({buffer:b,object:d,opaque:null,transparent:null})}
+function K(a){if(a!==P){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)}P=a}}function U(a,b,c){(c.width&c.width-
+1)===0&&(c.height&c.height-1)===0?(d.texParameteri(a,d.TEXTURE_WRAP_S,ka(b.wrapS)),d.texParameteri(a,d.TEXTURE_WRAP_T,ka(b.wrapT)),d.texParameteri(a,d.TEXTURE_MAG_FILTER,ka(b.magFilter)),d.texParameteri(a,d.TEXTURE_MIN_FILTER,ka(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 X(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
+!0,a.__webglTexture=d.createTexture(),N.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,ka(a.format),a.image.width,a.image.height,0,ka(a.format),d.UNSIGNED_BYTE,a.image.data):d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,a.image);U(d.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else d.activeTexture(d.TEXTURE0+b),d.bindTexture(d.TEXTURE_2D,a.__webglTexture)}function J(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 Y(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);U(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,ka(a.format),a.width,a.height,0,ka(a.format),ka(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);J(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=d.createFramebuffer(),a.__webglRenderbuffer=d.createRenderbuffer(),d.bindTexture(d.TEXTURE_2D,a.__webglTexture),U(d.TEXTURE_2D,a,a),d.texImage2D(d.TEXTURE_2D,0,ka(a.format),a.width,a.height,0,ka(a.format),ka(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),J(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=Ma,a=Ia,e=Aa,f=ya);b!==ja&&(d.bindFramebuffer(d.FRAMEBUFFER,
+b),d.viewport(e,f,c,a),ja=b)}function aa(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 ma(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 ka(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 K=this,d,Ea=[],Qa=null,ha=null,pa=-1,L=null,qa=0,V=null,sa=null,P=null,va=null,ya=null,Fa=null,Ja=null,Ga=null,za=0,wa=0,Ma=0,Ia=0,xa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Matrix4,Na=new Float32Array(16),
-Oa=new Float32Array(16),Ha=new THREE.Vector4,Sa={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"),da=a.stencil!==void 0?a.stencil:!0,Xa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,Ya=a.antialias!==void 0?a.antialias:!1,la=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Da=a.clearAlpha!==void 0?a.clearAlpha:0,Ra=a.maxLights!==
+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 N=this,d,Ea=[],Qa=null,ja=null,sa=-1,H=null,qa=0,ga=null,ta=null,P=null,oa=null,ua=null,Fa=null,Ja=null,Ga=null,Aa=0,ya=0,Ma=0,Ia=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Matrix4,Na=new Float32Array(16),
+Oa=new Float32Array(16),Ha=new THREE.Vector4,Sa={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"),S=a.stencil!==void 0?a.stencil:!0,Xa=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,Ya=a.antialias!==void 0?a.antialias:!1,wa=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),Da=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 Z,La=[],a=THREE.ShaderLib.depthRGBA,Va=THREE.UniformsUtils.clone(a.uniforms),Pa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Va}),Ta=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Va,morphTargets:!0});Pa._shadowPass=!0;Ta._shadowPass=!0;try{if(!(d=Ca.getContext("experimental-webgl",
-{antialias:Ya,stencil:da,preserveDrawingBuffer:Xa})))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(Za){console.error(Za)}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(la.r,la.g,la.b,Da);this.context=d;var Wa=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);da=0;t.vertices[da++]=-1;t.vertices[da++]=-1;t.vertices[da++]=0;t.vertices[da++]=1;t.vertices[da++]=1;t.vertices[da++]=-1;t.vertices[da++]=1;t.vertices[da++]=1;t.vertices[da++]=1;t.vertices[da++]=1;t.vertices[da++]=1;t.vertices[da++]=0;t.vertices[da++]=-1;t.vertices[da++]=1;t.vertices[da++]=
-0;da=t.vertices[da++]=0;t.faces[da++]=0;t.faces[da++]=1;t.faces[da++]=2;t.faces[da++]=0;t.faces[da++]=2;t.faces[da++]=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,ua("fragment",THREE.ShaderLib.sprite.fragmentShader));
-d.attachShader(t.program,ua("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 Ua=!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){za=a;wa=b;Ma=c;Ia=e;d.viewport(za,wa,Ma,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){la.setHex(a);Da=b;d.clearColor(la.r,la.g,la.b,
-Da)};this.setClearColor=function(a,b){la.copy(a);Da=b;d.clearColor(la.r,la.g,la.b,Da)};this.getClearColor=function(){return la};this.getClearAlpha=function(){return Da};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,
+5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var pa,La=[],a=THREE.ShaderLib.depthRGBA,Va=THREE.UniformsUtils.clone(a.uniforms),Pa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Va}),Ta=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:Va,morphTargets:!0});Pa._shadowPass=!0;Ta._shadowPass=!0;try{if(!(d=Ca.getContext("experimental-webgl",
+{antialias:Ya,stencil:S,preserveDrawingBuffer:Xa})))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(Za){console.error(Za)}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(wa.r,wa.g,wa.b,Da);this.context=d;var Wa=d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,w={};w.vertices=new Float32Array(16);w.faces=new Uint16Array(6);S=0;w.vertices[S++]=-1;w.vertices[S++]=-1;w.vertices[S++]=0;w.vertices[S++]=1;w.vertices[S++]=1;w.vertices[S++]=-1;w.vertices[S++]=1;w.vertices[S++]=1;w.vertices[S++]=1;w.vertices[S++]=1;w.vertices[S++]=1;w.vertices[S++]=0;w.vertices[S++]=-1;w.vertices[S++]=1;w.vertices[S++]=0;S=w.vertices[S++]=
+0;w.faces[S++]=0;w.faces[S++]=1;w.faces[S++]=2;w.faces[S++]=0;w.faces[S++]=2;w.faces[S++]=3;w.vertexBuffer=d.createBuffer();w.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,w.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,w.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,w.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,w.faces,d.STATIC_DRAW);w.program=d.createProgram();d.attachShader(w.program,ma("fragment",THREE.ShaderLib.sprite.fragmentShader));d.attachShader(w.program,ma("vertex",
+THREE.ShaderLib.sprite.vertexShader));d.linkProgram(w.program);w.attributes={};w.uniforms={};w.attributes.position=d.getAttribLocation(w.program,"position");w.attributes.uv=d.getAttribLocation(w.program,"uv");w.uniforms.uvOffset=d.getUniformLocation(w.program,"uvOffset");w.uniforms.uvScale=d.getUniformLocation(w.program,"uvScale");w.uniforms.rotation=d.getUniformLocation(w.program,"rotation");w.uniforms.scale=d.getUniformLocation(w.program,"scale");w.uniforms.alignment=d.getUniformLocation(w.program,
+"alignment");w.uniforms.color=d.getUniformLocation(w.program,"color");w.uniforms.map=d.getUniformLocation(w.program,"map");w.uniforms.opacity=d.getUniformLocation(w.program,"opacity");w.uniforms.useScreenCoordinates=d.getUniformLocation(w.program,"useScreenCoordinates");w.uniforms.affectedByDistance=d.getUniformLocation(w.program,"affectedByDistance");w.uniforms.screenPosition=d.getUniformLocation(w.program,"screenPosition");w.uniforms.modelViewMatrix=d.getUniformLocation(w.program,"modelViewMatrix");
+w.uniforms.projectionMatrix=d.getUniformLocation(w.program,"projectionMatrix");var Ua=!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){Aa=a;ya=b;Ma=c;Ia=e;d.viewport(Aa,ya,Ma,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){wa.setHex(a);Da=b;d.clearColor(wa.r,wa.g,wa.b,Da)};this.setClearColor=
+function(a,b){wa.copy(a);Da=b;d.clearColor(wa.r,wa.g,wa.b,Da)};this.getClearColor=function(){return wa};this.getClearAlpha=function(){return Da};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]);K.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--;
-else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),K.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),K.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,l;a instanceof THREE.MeshDepthMaterial?l="depth":a instanceof THREE.MeshNormalMaterial?l="normal":a instanceof THREE.MeshBasicMaterial?l="basic":a instanceof THREE.MeshLambertMaterial?
-l="lambert":a instanceof THREE.MeshPhongMaterial?l="phong":a instanceof THREE.LineBasicMaterial?l="basic":a instanceof THREE.ParticleBasicMaterial&&(l="particle_basic");if(l){var j=THREE.ShaderLib[l];a.uniforms=THREE.UniformsUtils.clone(j.uniforms);a.vertexShader=j.vertexShader;a.fragmentShader=j.fragmentShader}var k,q,s;k=s=j=0;for(q=b.length;k<q;k++)i=b[k],i instanceof THREE.SpotLight&&s++,i instanceof THREE.DirectionalLight&&s++,i instanceof THREE.PointLight&&j++;j+s<=Ra?k=s:(k=Math.ceil(Ra*s/
-(j+s)),j=Ra-k);i={directional:k,point:j};j=s=0;for(k=b.length;j<k;j++)q=b[j],q instanceof THREE.SpotLight&&q.castShadow&&s++;var m=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)m=e.bones.length;var u;a:{k=a.fragmentShader;q=a.vertexShader;var j=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:i.directional,
-maxPointLights:i.point,maxBones:m,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:s,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},o,e=[];l?e.push(l):(e.push(k),e.push(q));for(o in c)e.push(o),e.push(c[o]);l=e.join();o=0;for(e=Ea.length;o<e;o++)if(Ea[o].code===l){u=Ea[o].program;break a}o=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",K.gammaInput?"#define GAMMA_INPUT":
-"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.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.perPixel?"#define PHONG_PER_PIXEL":
+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]);N.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),N.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),N.info.memory.geometries--;
+else if(a instanceof THREE.ParticleSystem)a=a.geometry,d.deleteBuffer(a.__webglVertexBuffer),d.deleteBuffer(a.__webglColorBuffer),N.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,d.deleteTexture(a.__webglTexture),N.info.memory.textures--};this.initMaterial=function(a,b,c,e){var f,h,i,o;a instanceof THREE.MeshDepthMaterial?o="depth":a instanceof THREE.MeshNormalMaterial?o="normal":a instanceof THREE.MeshBasicMaterial?o="basic":a instanceof THREE.MeshLambertMaterial?
+o="lambert":a instanceof THREE.MeshPhongMaterial?o="phong":a instanceof THREE.LineBasicMaterial?o="basic":a instanceof THREE.ParticleBasicMaterial&&(o="particle_basic");if(o){var k=THREE.ShaderLib[o];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;a.fragmentShader=k.fragmentShader}var l,m,q;l=q=k=0;for(m=b.length;l<m;l++)i=b[l],i instanceof THREE.SpotLight&&q++,i instanceof THREE.DirectionalLight&&q++,i instanceof THREE.PointLight&&k++;k+q<=Ra?l=q:(l=Math.ceil(Ra*q/
+(k+q)),k=Ra-l);i={directional:l,point:k};k=q=0;for(l=b.length;k<l;k++)m=b[k],m instanceof THREE.SpotLight&&m.castShadow&&q++;var n=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)n=e.bones.length;var x;a:{l=a.fragmentShader;m=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:n,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},r,e=[];o?e.push(o):(e.push(l),e.push(m));for(r in c)e.push(r),e.push(c[r]);o=e.join();r=0;for(e=Ea.length;r<e;r++)if(Ea[r].code===o){x=Ea[r].program;break a}r=d.createProgram();e=[Wa?"#define VERTEX_TEXTURES":"",N.gammaInput?"#define GAMMA_INPUT":
+"",N.gammaOutput?"#define GAMMA_OUTPUT":"",N.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.perPixel?"#define PHONG_PER_PIXEL":
 "",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:"",K.gammaInput?"#define GAMMA_INPUT":"",K.gammaOutput?"#define GAMMA_OUTPUT":"",K.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(o,ua("fragment",i+k));d.attachShader(o,
-ua("vertex",e+q));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};var p,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(p in j)e.push(p);p=e;e=0;for(j=p.length;e<j;e++)k=p[e],o.uniforms[k]=d.getUniformLocation(o,
-k);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(p=0;p<c.maxMorphTargets;p++)e.push("morphTarget"+p);for(u in b)e.push(u);u=e;p=0;for(b=u.length;p<b;p++)c=u[p],o.attributes[c]=d.getAttribLocation(o,c);o.id=Ea.length;Ea.push({program:o,code:l});K.info.memory.programs=Ea.length;u=o}a.program=u;u=a.program.attributes;u.position>=0&&d.enableVertexAttribArray(u.position);u.color>=0&&d.enableVertexAttribArray(u.color);u.normal>=0&&d.enableVertexAttribArray(u.normal);
-u.tangent>=0&&d.enableVertexAttribArray(u.tangent);a.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(d.enableVertexAttribArray(u.skinVertexA),d.enableVertexAttribArray(u.skinVertexB),d.enableVertexAttribArray(u.skinIndex),d.enableVertexAttribArray(u.skinWeight));if(a.attributes)for(h in a.attributes)u[h]!==void 0&&u[h]>=0&&d.enableVertexAttribArray(u[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)p="morphTarget"+h,u[p]>=0&&(d.enableVertexAttribArray(u[p]),
-a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){N(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,e){var t,Q,Ka,l,r,M,q,s=a.lights,Y=a.fog;pa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&B(a,b);K.info.render.calls=0;K.info.render.vertices=0;K.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(Oa);b.projectionMatrix.flattenToArray(Na);Ba.multiply(b.projectionMatrix,b.matrixWorldInverse);p(Ba);N(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ka=a.__webglObjects.length;for(e=0;e<Ka;e++)if(r=a.__webglObjects[e],M=r.object,M.visible)if(!(M instanceof THREE.Mesh)||!M.frustumCulled||z(M)){if(M.matrixWorld.flattenToArray(M._objectMatrixArray),
-J(M,b,!0),A(r),r.render=!0,this.sortObjects)M.renderDepth?r.z=M.renderDepth:(Ha.copy(M.position),Ba.multiplyVector3(Ha),r.z=Ha.z)}else r.render=!1;else r.render=!1;this.sortObjects&&a.__webglObjects.sort(D);l=a.__webglObjectsImmediate.length;for(e=0;e<l;e++)r=a.__webglObjectsImmediate[e],M=r.object,M.visible&&(M.matrixAutoUpdate&&M.matrixWorld.flattenToArray(M._objectMatrixArray),J(M,b,!0),y(r));if(a.overrideMaterial){m(a.overrideMaterial.depthTest);G(a.overrideMaterial.blending);for(e=0;e<Ka;e++)if(r=
-a.__webglObjects[e],r.render)M=r.object,q=r.buffer,j(M),f(b,s,Y,a.overrideMaterial,q,M);for(e=0;e<l;e++)r=a.__webglObjectsImmediate[e],M=r.object,M.visible&&(L=-1,j(M),t=h(b,s,Y,a.overrideMaterial,M),M.immediateRenderCallback?M.immediateRenderCallback(t,d,xa):M.render(function(b){i(b,t,a.overrideMaterial.shading)}))}else{G(THREE.NormalBlending);for(e=Ka-1;e>=0;e--)if(r=a.__webglObjects[e],r.render&&(M=r.object,q=r.buffer,Q=r.opaque))j(M),m(Q.depthTest),o(Q.depthWrite),k(Q.polygonOffset,Q.polygonOffsetFactor,
-Q.polygonOffsetUnits),f(b,s,Y,Q,q,M);for(e=0;e<l;e++)if(r=a.__webglObjectsImmediate[e],M=r.object,M.visible&&(L=-1,Q=r.opaque))j(M),m(Q.depthTest),o(Q.depthWrite),k(Q.polygonOffset,Q.polygonOffsetFactor,Q.polygonOffsetUnits),t=h(b,s,Y,Q,M),M.immediateRenderCallback?M.immediateRenderCallback(t,d,xa):M.render(function(a){i(a,t,Q.shading)});for(e=0;e<Ka;e++)if(r=a.__webglObjects[e],r.render&&(M=r.object,q=r.buffer,Q=r.transparent))j(M),G(Q.blending),m(Q.depthTest),o(Q.depthWrite),k(Q.polygonOffset,Q.polygonOffsetFactor,
-Q.polygonOffsetUnits),f(b,s,Y,Q,q,M);for(e=0;e<l;e++)if(r=a.__webglObjectsImmediate[e],M=r.object,M.visible&&(L=-1,Q=r.transparent))j(M),G(Q.blending),m(Q.depthTest),o(Q.depthWrite),k(Q.polygonOffset,Q.polygonOffsetFactor,Q.polygonOffsetUnits),t=h(b,s,Y,Q,M),M.immediateRenderCallback?M.immediateRenderCallback(t,d,xa):M.render(function(a){i(a,t,Q.shading)})}a.__webglSprites.length&&ra(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&na(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,m=void 0,l=void 0,r=void 0,o=void 0,
-q=void 0,s=void 0,p=void 0,u={},t=k.morphTargets.length;k.geometryGroups={};m=0;for(l=k.faces.length;m<l;m++)r=k.faces[m],o=r.materialIndex,s=o!==void 0?o:-1,u[s]===void 0&&(u[s]={hash:s,counter:0}),p=u[s].hash+"_"+u[s].counter,k.geometryGroups[p]===void 0&&(k.geometryGroups[p]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:t}),q=r instanceof THREE.Face3?3:4,k.geometryGroups[p].vertices+q>65535&&(u[s].counter+=1,p=u[s].hash+"_"+u[s].counter,k.geometryGroups[p]===void 0&&(k.geometryGroups[p]=
-{faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:t})),r instanceof THREE.Face3?k.geometryGroups[p].faces3.push(m):k.geometryGroups[p].faces4.push(m),k.geometryGroups[p].vertices+=q;k.geometryGroupsList=[];m=void 0;for(m in k.geometryGroups)k.geometryGroups[m].id=qa++,k.geometryGroupsList.push(k.geometryGroups[m])}for(i in j.geometryGroups)if(k=j.geometryGroups[i],!k.__webglVertexBuffer){m=k;m.__webglVertexBuffer=d.createBuffer();m.__webglNormalBuffer=d.createBuffer();m.__webglTangentBuffer=
-d.createBuffer();m.__webglColorBuffer=d.createBuffer();m.__webglUVBuffer=d.createBuffer();m.__webglUV2Buffer=d.createBuffer();m.__webglSkinVertexABuffer=d.createBuffer();m.__webglSkinVertexBBuffer=d.createBuffer();m.__webglSkinIndicesBuffer=d.createBuffer();m.__webglSkinWeightsBuffer=d.createBuffer();m.__webglFaceBuffer=d.createBuffer();m.__webglLineBuffer=d.createBuffer();if(m.numMorphTargets){r=l=void 0;m.__webglMorphTargetsBuffers=[];l=0;for(r=m.numMorphTargets;l<r;l++)m.__webglMorphTargetsBuffers.push(d.createBuffer())}K.info.memory.geometries++;
-o=f;q=o.geometry;l=k.faces3;s=k.faces4;m=l.length*3+s.length*4;r=l.length*1+s.length*2;s=l.length*3+s.length*4;l=c(o,k);p=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;u=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;t=l.vertexColors?l.vertexColors:!1;k.__vertexArray=new Float32Array(m*3);if(u)k.__normalArray=new Float32Array(m*3);if(q.hasTangents)k.__tangentArray=
-new Float32Array(m*4);if(t)k.__colorArray=new Float32Array(m*3);if(p){if(q.faceUvs.length>0||q.faceVertexUvs.length>0)k.__uvArray=new Float32Array(m*2);if(q.faceUvs.length>1||q.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(m*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(m*4),k.__skinVertexBArray=new Float32Array(m*4),k.__skinIndexArray=new Float32Array(m*4),k.__skinWeightArray=new Float32Array(m*4);k.__faceArray=new Uint16Array(r*3);
-k.__lineArray=new Uint16Array(s*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];o=0;for(q=k.numMorphTargets;o<q;o++)k.__morphTargetsArrays.push(new Float32Array(m*3))}k.__needsSmoothNormals=u===THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=t;k.__normalType=u;k.__webglFaceCount=r*3;k.__webglLineCount=s*2;if(l.attributes){if(k.__webglCustomAttributesList===void 0)k.__webglCustomAttributesList=[];r=void 0;for(r in l.attributes){var o=l.attributes[r],q={},z;for(z in o)q[z]=o[z];if(!q.__webglInitialized||
-q.createUniqueBuffers)q.__webglInitialized=!0,s=1,q.type==="v2"?s=2:q.type==="v3"?s=3:q.type==="v4"?s=4:q.type==="c"&&(s=3),q.size=s,q.array=new Float32Array(m*s),q.buffer=d.createBuffer(),q.buffer.belongsToAttribute=r,o.needsUpdate=!0,q.__original=o;k.__webglCustomAttributesList.push(q)}}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(),K.info.memory.geometries++,k=j,m=k.vertices.length,k.__vertexArray=new Float32Array(m*3),k.__colorArray=new Float32Array(m*3),k.__webglVertexCount=m,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(),K.info.memory.geometries++,k=j,m=f,l=k.vertices.length,
-k.__vertexArray=new Float32Array(l*3),k.__colorArray=new Float32Array(l*3),k.__webglLineCount=l,b(k,m),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(),K.info.geometries++,k=j,m=f,l=k.vertices.length,k.__vertexArray=new Float32Array(l*3),k.__colorArray=new Float32Array(l*3),k.__sortArray=[],k.__webglParticleCount=l,b(k,m),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],ca(h.__webglObjects,k,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(j=f.geometry,ca(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)S(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)&&S(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(z=
-a.__webglObjects[f].object,i=z.geometry,j=r=l=void 0,z instanceof THREE.Mesh){k=0;for(m=i.geometryGroupsList.length;k<m;k++)if(l=i.geometryGroupsList[k],j=c(z,l),r=j.attributes&&ka(j),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||r)if(r=d.DYNAMIC_DRAW,o=!i.dynamic,l.__inittedArrays){var y=s=q=void 0,w=void 0,A=void 0,D=void 0,v=void 0,B=void 0,G=void 0,R=void 0,L=y=D=G=void 0,F=t=u=p=void 0,aa=void 0,ea=w=void 0,W=
-w=G=void 0,X=void 0,H=v=void 0,C=void 0,T=void 0,J=void 0,E=w=T=C=H=J=T=C=H=J=T=C=H=void 0,I=void 0,P=D=void 0,fa=C=y=void 0,N=void 0,da=L=C=I=0,$=0,V=E=y=0,x=H=v=aa=0,O=0,O=void 0,fa=l.__vertexArray,ha=l.__uvArray,x=l.__uv2Array,P=l.__normalArray,A=l.__tangentArray,ea=l.__colorArray,W=l.__skinVertexAArray,X=l.__skinVertexBArray,B=l.__skinIndexArray,ga=l.__skinWeightArray,T=l.__morphTargetsArrays,U=l.__webglCustomAttributesList,n=void 0,n=l.__faceArray,O=l.__lineArray,na=l.__needsSmoothNormals,G=
-l.__vertexColorType,R=l.__uvType,D=l.__normalType,Z=z.geometry,ra=Z.__dirtyElements,pa=Z.__dirtyUvs,sa=Z.__dirtyNormals,ua=Z.__dirtyTangents,xa=Z.__dirtyColors,N=Z.__dirtyMorphTargets,la=Z.vertices,ja=l.faces3,ma=l.faces4,ia=Z.faces,va=Z.faceVertexUvs[0],ya=Z.faceVertexUvs[1],ta=Z.skinVerticesA,wa=Z.skinVerticesB,za=Z.skinIndices,Aa=Z.skinWeights,J=Z.morphTargets;if(Z.__dirtyVertices){q=0;for(s=ja.length;q<s;q++)w=ia[ja[q]],p=la[w.a].position,u=la[w.b].position,t=la[w.c].position,fa[C]=p.x,fa[C+1]=
-p.y,fa[C+2]=p.z,fa[C+3]=u.x,fa[C+4]=u.y,fa[C+5]=u.z,fa[C+6]=t.x,fa[C+7]=t.y,fa[C+8]=t.z,C+=9;q=0;for(s=ma.length;q<s;q++)w=ia[ma[q]],p=la[w.a].position,u=la[w.b].position,t=la[w.c].position,F=la[w.d].position,fa[C]=p.x,fa[C+1]=p.y,fa[C+2]=p.z,fa[C+3]=u.x,fa[C+4]=u.y,fa[C+5]=u.z,fa[C+6]=t.x,fa[C+7]=t.y,fa[C+8]=t.z,fa[C+9]=F.x,fa[C+10]=F.y,fa[C+11]=F.z,C+=12;d.bindBuffer(d.ARRAY_BUFFER,l.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r)}if(N){q=0;for(s=ja.length;q<s;q++){w=ia[ja[q]];C=0;for(fa=
-J.length;C<fa;C++)p=J[C].vertices[w.a].position,u=J[C].vertices[w.b].position,t=J[C].vertices[w.c].position,N=T[C],N[H]=p.x,N[H+1]=p.y,N[H+2]=p.z,N[H+3]=u.x,N[H+4]=u.y,N[H+5]=u.z,N[H+6]=t.x,N[H+7]=t.y,N[H+8]=t.z;H+=9}q=0;for(s=ma.length;q<s;q++){w=ia[ma[q]];C=0;for(fa=J.length;C<fa;C++)p=J[C].vertices[w.a].position,u=J[C].vertices[w.b].position,t=J[C].vertices[w.c].position,F=J[C].vertices[w.d].position,N=T[C],N[H]=p.x,N[H+1]=p.y,N[H+2]=p.z,N[H+3]=u.x,N[H+4]=u.y,N[H+5]=u.z,N[H+6]=t.x,N[H+7]=t.y,N[H+
-8]=t.z,N[H+9]=F.x,N[H+10]=F.y,N[H+11]=F.z;H+=12}C=0;for(fa=J.length;C<fa;C++)d.bindBuffer(d.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[C]),d.bufferData(d.ARRAY_BUFFER,T[C],r)}if(Aa.length){q=0;for(s=ja.length;q<s;q++)w=ia[ja[q]],H=Aa[w.a],C=Aa[w.b],T=Aa[w.c],ga[v]=H.x,ga[v+1]=H.y,ga[v+2]=H.z,ga[v+3]=H.w,ga[v+4]=C.x,ga[v+5]=C.y,ga[v+6]=C.z,ga[v+7]=C.w,ga[v+8]=T.x,ga[v+9]=T.y,ga[v+10]=T.z,ga[v+11]=T.w,H=za[w.a],C=za[w.b],T=za[w.c],B[v]=H.x,B[v+1]=H.y,B[v+2]=H.z,B[v+3]=H.w,B[v+4]=C.x,B[v+5]=C.y,B[v+6]=
-C.z,B[v+7]=C.w,B[v+8]=T.x,B[v+9]=T.y,B[v+10]=T.z,B[v+11]=T.w,H=ta[w.a],C=ta[w.b],T=ta[w.c],W[v]=H.x,W[v+1]=H.y,W[v+2]=H.z,W[v+3]=1,W[v+4]=C.x,W[v+5]=C.y,W[v+6]=C.z,W[v+7]=1,W[v+8]=T.x,W[v+9]=T.y,W[v+10]=T.z,W[v+11]=1,H=wa[w.a],C=wa[w.b],T=wa[w.c],X[v]=H.x,X[v+1]=H.y,X[v+2]=H.z,X[v+3]=1,X[v+4]=C.x,X[v+5]=C.y,X[v+6]=C.z,X[v+7]=1,X[v+8]=T.x,X[v+9]=T.y,X[v+10]=T.z,X[v+11]=1,v+=12;q=0;for(s=ma.length;q<s;q++)w=ia[ma[q]],H=Aa[w.a],C=Aa[w.b],T=Aa[w.c],J=Aa[w.d],ga[v]=H.x,ga[v+1]=H.y,ga[v+2]=H.z,ga[v+3]=
-H.w,ga[v+4]=C.x,ga[v+5]=C.y,ga[v+6]=C.z,ga[v+7]=C.w,ga[v+8]=T.x,ga[v+9]=T.y,ga[v+10]=T.z,ga[v+11]=T.w,ga[v+12]=J.x,ga[v+13]=J.y,ga[v+14]=J.z,ga[v+15]=J.w,H=za[w.a],C=za[w.b],T=za[w.c],J=za[w.d],B[v]=H.x,B[v+1]=H.y,B[v+2]=H.z,B[v+3]=H.w,B[v+4]=C.x,B[v+5]=C.y,B[v+6]=C.z,B[v+7]=C.w,B[v+8]=T.x,B[v+9]=T.y,B[v+10]=T.z,B[v+11]=T.w,B[v+12]=J.x,B[v+13]=J.y,B[v+14]=J.z,B[v+15]=J.w,H=ta[w.a],C=ta[w.b],T=ta[w.c],J=ta[w.d],W[v]=H.x,W[v+1]=H.y,W[v+2]=H.z,W[v+3]=1,W[v+4]=C.x,W[v+5]=C.y,W[v+6]=C.z,W[v+7]=1,W[v+8]=
-T.x,W[v+9]=T.y,W[v+10]=T.z,W[v+11]=1,W[v+12]=J.x,W[v+13]=J.y,W[v+14]=J.z,W[v+15]=1,H=wa[w.a],C=wa[w.b],T=wa[w.c],w=wa[w.d],X[v]=H.x,X[v+1]=H.y,X[v+2]=H.z,X[v+3]=1,X[v+4]=C.x,X[v+5]=C.y,X[v+6]=C.z,X[v+7]=1,X[v+8]=T.x,X[v+9]=T.y,X[v+10]=T.z,X[v+11]=1,X[v+12]=w.x,X[v+13]=w.y,X[v+14]=w.z,X[v+15]=1,v+=16;v>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,W,r),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,X,r),d.bindBuffer(d.ARRAY_BUFFER,
-l.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,B,r),d.bindBuffer(d.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ga,r))}if(xa&&G){q=0;for(s=ja.length;q<s;q++)w=ia[ja[q]],v=w.vertexColors,B=w.color,v.length===3&&G===THREE.VertexColors?(w=v[0],W=v[1],X=v[2]):X=W=w=B,ea[aa]=w.r,ea[aa+1]=w.g,ea[aa+2]=w.b,ea[aa+3]=W.r,ea[aa+4]=W.g,ea[aa+5]=W.b,ea[aa+6]=X.r,ea[aa+7]=X.g,ea[aa+8]=X.b,aa+=9;q=0;for(s=ma.length;q<s;q++)w=ia[ma[q]],v=w.vertexColors,B=w.color,v.length===4&&G===
-THREE.VertexColors?(w=v[0],W=v[1],X=v[2],v=v[3]):v=X=W=w=B,ea[aa]=w.r,ea[aa+1]=w.g,ea[aa+2]=w.b,ea[aa+3]=W.r,ea[aa+4]=W.g,ea[aa+5]=W.b,ea[aa+6]=X.r,ea[aa+7]=X.g,ea[aa+8]=X.b,ea[aa+9]=v.r,ea[aa+10]=v.g,ea[aa+11]=v.b,aa+=12;aa>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,ea,r))}if(ua&&Z.hasTangents){q=0;for(s=ja.length;q<s;q++)w=ia[ja[q]],G=w.vertexTangents,aa=G[0],w=G[1],ea=G[2],A[E]=aa.x,A[E+1]=aa.y,A[E+2]=aa.z,A[E+3]=aa.w,A[E+4]=w.x,A[E+5]=w.y,A[E+6]=w.z,A[E+
-7]=w.w,A[E+8]=ea.x,A[E+9]=ea.y,A[E+10]=ea.z,A[E+11]=ea.w,E+=12;q=0;for(s=ma.length;q<s;q++)w=ia[ma[q]],G=w.vertexTangents,aa=G[0],w=G[1],ea=G[2],G=G[3],A[E]=aa.x,A[E+1]=aa.y,A[E+2]=aa.z,A[E+3]=aa.w,A[E+4]=w.x,A[E+5]=w.y,A[E+6]=w.z,A[E+7]=w.w,A[E+8]=ea.x,A[E+9]=ea.y,A[E+10]=ea.z,A[E+11]=ea.w,A[E+12]=G.x,A[E+13]=G.y,A[E+14]=G.z,A[E+15]=G.w,E+=16;d.bindBuffer(d.ARRAY_BUFFER,l.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,A,r)}if(sa&&D){q=0;for(s=ja.length;q<s;q++)if(w=ia[ja[q]],A=w.vertexNormals,
-D=w.normal,A.length===3&&na)for(E=0;E<3;E++)D=A[E],P[y]=D.x,P[y+1]=D.y,P[y+2]=D.z,y+=3;else for(E=0;E<3;E++)P[y]=D.x,P[y+1]=D.y,P[y+2]=D.z,y+=3;q=0;for(s=ma.length;q<s;q++)if(w=ia[ma[q]],A=w.vertexNormals,D=w.normal,A.length===4&&na)for(E=0;E<4;E++)D=A[E],P[y]=D.x,P[y+1]=D.y,P[y+2]=D.z,y+=3;else for(E=0;E<4;E++)P[y]=D.x,P[y+1]=D.y,P[y+2]=D.z,y+=3;d.bindBuffer(d.ARRAY_BUFFER,l.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,P,r)}if(pa&&va&&R){q=0;for(s=ja.length;q<s;q++)if(y=ja[q],y=va[y],y!==void 0)for(E=
-0;E<3;E++)P=y[E],ha[L]=P.u,ha[L+1]=P.v,L+=2;q=0;for(s=ma.length;q<s;q++)if(y=ma[q],y=va[y],y!==void 0)for(E=0;E<4;E++)P=y[E],ha[L]=P.u,ha[L+1]=P.v,L+=2;L>0&&(d.bindBuffer(d.ARRAY_BUFFER,l.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ha,r))}if(pa&&ya&&R){q=0;for(s=ja.length;q<s;q++)if(y=ja[q],L=ya[y],L!==void 0)for(E=0;E<3;E++)y=L[E],x[da]=y.u,x[da+1]=y.v,da+=2;q=0;for(s=ma.length;q<s;q++)if(y=ma[q],L=ya[y],L!==void 0)for(E=0;E<4;E++)y=L[E],x[da]=y.u,x[da+1]=y.v,da+=2;da>0&&(d.bindBuffer(d.ARRAY_BUFFER,
-l.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,x,r))}if(ra){q=0;for(s=ja.length;q<s;q++)n[$]=I,n[$+1]=I+1,n[$+2]=I+2,$+=3,O[V]=I,O[V+1]=I+1,O[V+2]=I,O[V+3]=I+2,O[V+4]=I+1,O[V+5]=I+2,V+=6,I+=3;q=0;for(s=ma.length;q<s;q++)n[$]=I,n[$+1]=I+1,n[$+2]=I+3,n[$+3]=I+1,n[$+4]=I+2,n[$+5]=I+3,$+=6,O[V]=I,O[V+1]=I+1,O[V+2]=I,O[V+3]=I+3,O[V+4]=I+1,O[V+5]=I+2,O[V+6]=I+2,O[V+7]=I+3,V+=8,I+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,n,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
-l.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,O,r)}if(U){E=0;for(I=U.length;E<I;E++)U[E].offset=0,U[E].offsetSrc=0;q=0;for(s=ja.length;q<s;q++){w=ia[ja[q]];E=0;for(I=U.length;E<I;E++)if(n=U[E],n.__original.needsUpdate)x=n.offset,O=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[x]=n.value[w.a],n.array[x+1]=n.value[w.b],n.array[x+2]=n.value[w.c]):n.boundTo==="faces"?(O=n.value[O],n.array[x]=O,n.array[x+1]=O,n.array[x+2]=O,n.offsetSrc++):n.boundTo==="faceVertices"&&
-(n.array[x]=n.value[O],n.array[x+1]=n.value[O+1],n.array[x+2]=n.value[O+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(p=n.value[w.a],u=n.value[w.b],t=n.value[w.c]):n.boundTo==="faces"?(t=u=p=O=n.value[O],n.offsetSrc++):n.boundTo==="faceVertices"&&(p=n.value[O],u=n.value[O+1],t=n.value[O+2],n.offsetSrc+=3),n.size===2?(n.array[x]=p.x,n.array[x+1]=p.y,n.array[x+2]=u.x,n.array[x+3]=u.y,n.array[x+4]=t.x,n.array[x+5]=t.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[x]=p.r,
-n.array[x+1]=p.g,n.array[x+2]=p.b,n.array[x+3]=u.r,n.array[x+4]=u.g,n.array[x+5]=u.b,n.array[x+6]=t.r,n.array[x+7]=t.g,n.array[x+8]=t.b):(n.array[x]=p.x,n.array[x+1]=p.y,n.array[x+2]=p.z,n.array[x+3]=u.x,n.array[x+4]=u.y,n.array[x+5]=u.z,n.array[x+6]=t.x,n.array[x+7]=t.y,n.array[x+8]=t.z),n.offset+=9):(n.array[x]=p.x,n.array[x+1]=p.y,n.array[x+2]=p.z,n.array[x+3]=p.w,n.array[x+4]=u.x,n.array[x+5]=u.y,n.array[x+6]=u.z,n.array[x+7]=u.w,n.array[x+8]=t.x,n.array[x+9]=t.y,n.array[x+10]=t.z,n.array[x+11]=
-t.w,n.offset+=12))}q=0;for(s=ma.length;q<s;q++){w=ia[ma[q]];E=0;for(I=U.length;E<I;E++)if(n=U[E],n.__original.needsUpdate)x=n.offset,O=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[x]=n.value[w.a],n.array[x+1]=n.value[w.b],n.array[x+2]=n.value[w.c],n.array[x+3]=n.value[w.d]):n.boundTo==="faces"?(O=n.value[O],n.array[x]=O,n.array[x+1]=O,n.array[x+2]=O,n.array[x+3]=O,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[x]=n.value[O],n.array[x+1]=n.value[O+1],n.array[x+2]=
-n.value[O+2],n.array[x+3]=n.value[O+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(p=n.value[w.a],u=n.value[w.b],t=n.value[w.c],F=n.value[w.d]):n.boundTo==="faces"?(F=t=u=p=O=n.value[O],n.offsetSrc++):n.boundTo==="faceVertices"&&(p=n.value[O],u=n.value[O+1],t=n.value[O+2],F=n.value[O+3],n.offsetSrc+=4),n.size===2?(n.array[x]=p.x,n.array[x+1]=p.y,n.array[x+2]=u.x,n.array[x+3]=u.y,n.array[x+4]=t.x,n.array[x+5]=t.y,n.array[x+6]=F.x,n.array[x+7]=F.y,n.offset+=8):n.size===
-3?(n.type==="c"?(n.array[x]=p.r,n.array[x+1]=p.g,n.array[x+2]=p.b,n.array[x+3]=u.r,n.array[x+4]=u.g,n.array[x+5]=u.b,n.array[x+6]=t.r,n.array[x+7]=t.g,n.array[x+8]=t.b,n.array[x+9]=F.r,n.array[x+10]=F.g,n.array[x+11]=F.b):(n.array[x]=p.x,n.array[x+1]=p.y,n.array[x+2]=p.z,n.array[x+3]=u.x,n.array[x+4]=u.y,n.array[x+5]=u.z,n.array[x+6]=t.x,n.array[x+7]=t.y,n.array[x+8]=t.z,n.array[x+9]=F.x,n.array[x+10]=F.y,n.array[x+11]=F.z),n.offset+=12):(n.array[x]=p.x,n.array[x+1]=p.y,n.array[x+2]=p.z,n.array[x+
-3]=p.w,n.array[x+4]=u.x,n.array[x+5]=u.y,n.array[x+6]=u.z,n.array[x+7]=u.w,n.array[x+8]=t.x,n.array[x+9]=t.y,n.array[x+10]=t.z,n.array[x+11]=t.w,n.array[x+12]=F.x,n.array[x+13]=F.y,n.array[x+14]=F.z,n.array[x+15]=F.w,n.offset+=16))}E=0;for(I=U.length;E<I;E++)n=U[E],n.__original.needsUpdate&&(d.bindBuffer(d.ARRAY_BUFFER,n.buffer),d.bufferData(d.ARRAY_BUFFER,n.array,r))}o&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,
-delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;j.attributes&&oa(j)}else if(z instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){j=i;z=d.DYNAMIC_DRAW;k=q=o=o=void 0;s=j.vertices;m=j.colors;p=s.length;l=m.length;u=j.__vertexArray;
-r=j.__colorArray;t=j.__dirtyColors;if(j.__dirtyVertices){for(o=0;o<p;o++)q=s[o].position,k=o*3,u[k]=q.x,u[k+1]=q.y,u[k+2]=q.z;d.bindBuffer(d.ARRAY_BUFFER,j.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,u,z)}if(t){for(o=0;o<l;o++)color=m[o],k=o*3,r[k]=color.r,r[k+1]=color.g,r[k+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,j.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,r,z)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(z instanceof THREE.Line){j=c(z,l);r=j.attributes&&ka(j);if(i.__dirtyVertices||
-i.__dirtyColors||r){z=i;k=d.DYNAMIC_DRAW;m=U=s=F=void 0;s=z.vertices;l=z.colors;p=s.length;r=l.length;u=z.__vertexArray;o=z.__colorArray;t=z.__dirtyColors;q=z.__webglCustomAttributesList;I=ia=ma=ja=U=F=void 0;if(z.__dirtyVertices){for(F=0;F<p;F++)U=s[F].position,m=F*3,u[m]=U.x,u[m+1]=U.y,u[m+2]=U.z;d.bindBuffer(d.ARRAY_BUFFER,z.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,u,k)}if(t){for(s=0;s<r;s++)color=l[s],m=s*3,o[m]=color.r,o[m+1]=color.g,o[m+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,z.__webglColorBuffer);
-d.bufferData(d.ARRAY_BUFFER,o,k)}if(q){F=0;for(U=q.length;F<U;F++)if(I=q[F],I.__original.needsUpdate&&(I.boundTo===void 0||I.boundTo==="vertices")){m=0;ma=I.value.length;for(ja=0;ja<ma;ja++)I.size===1?I.array[m]=I.value[ja]:(ia=I.value[ja],I.size===2?(I.array[m]=ia.x,I.array[m+1]=ia.y):I.size===3?I.type==="c"?(I.array[m]=ia.r,I.array[m+1]=ia.g,I.array[m+2]=ia.b):(I.array[m]=ia.x,I.array[m+1]=ia.y,I.array[m+2]=ia.z):(I.array[m]=ia.x,I.array[m+1]=ia.y,I.array[m+2]=ia.z,I.array[m+3]=ia.w)),m+=I.size;
-d.bindBuffer(d.ARRAY_BUFFER,I.buffer);d.bufferData(d.ARRAY_BUFFER,I.array,k)}}}i.__dirtyVertices=!1;i.__dirtyColors=!1;j.attributes&&oa(j)}else if(z instanceof THREE.ParticleSystem)j=c(z,l),r=j.attributes&&ka(j),(i.__dirtyVertices||i.__dirtyColors||z.sortParticles||r)&&e(i,d.DYNAMIC_DRAW,z),i.__dirtyVertices=!1,i.__dirtyColors=!1,j.attributes&&oa(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 Wa}};
+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:"",N.gammaInput?"#define GAMMA_INPUT":"",N.gammaOutput?"#define GAMMA_OUTPUT":"",N.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(r,ma("fragment",i+l));d.attachShader(r,
+ma("vertex",e+m));d.linkProgram(r);d.getProgramParameter(r,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(r,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");r.uniforms={};r.attributes={};var t,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in k)e.push(t);t=e;e=0;for(k=t.length;e<k;e++)l=t[e],r.uniforms[l]=d.getUniformLocation(r,
+l);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<c.maxMorphTargets;t++)e.push("morphTarget"+t);for(x in b)e.push(x);x=e;t=0;for(b=x.length;t<b;t++)c=x[t],r.attributes[c]=d.getAttribLocation(r,c);r.id=Ea.length;Ea.push({program:r,code:o});N.info.memory.programs=Ea.length;x=r}a.program=x;x=a.program.attributes;x.position>=0&&d.enableVertexAttribArray(x.position);x.color>=0&&d.enableVertexAttribArray(x.color);x.normal>=0&&d.enableVertexAttribArray(x.normal);
+x.tangent>=0&&d.enableVertexAttribArray(x.tangent);a.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(d.enableVertexAttribArray(x.skinVertexA),d.enableVertexAttribArray(x.skinVertexB),d.enableVertexAttribArray(x.skinIndex),d.enableVertexAttribArray(x.skinWeight));if(a.attributes)for(h in a.attributes)x[h]!==void 0&&x[h]>=0&&d.enableVertexAttribArray(x[h]);if(a.morphTargets)for(h=a.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)t="morphTarget"+h,x[t]>=0&&(d.enableVertexAttribArray(x[t]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){Y(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){E(a,b)};this.render=function(a,b,c,e){var w,T,Ka,o,s,Q,m,q=a.lights,R=a.fog;sa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&E(a,b);N.info.render.calls=0;N.info.render.vertices=0;N.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(Oa);b.projectionMatrix.flattenToArray(Na);Ba.multiply(b.projectionMatrix,b.matrixWorldInverse);t(Ba);Y(c);(this.autoClear||e)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);Ka=a.__webglObjects.length;for(e=0;e<Ka;e++)if(s=a.__webglObjects[e],Q=s.object,Q.visible)if(!(Q instanceof THREE.Mesh)||!Q.frustumCulled||B(Q)){if(Q.matrixWorld.flattenToArray(Q._objectMatrixArray),
+O(Q,b,!0),D(s),s.render=!0,this.sortObjects)Q.renderDepth?s.z=Q.renderDepth:(Ha.copy(Q.position),Ba.multiplyVector3(Ha),s.z=Ha.z)}else s.render=!1;else s.render=!1;this.sortObjects&&a.__webglObjects.sort(F);o=a.__webglObjectsImmediate.length;for(e=0;e<o;e++)s=a.__webglObjectsImmediate[e],Q=s.object,Q.visible&&(Q.matrixAutoUpdate&&Q.matrixWorld.flattenToArray(Q._objectMatrixArray),O(Q,b,!0),C(s));if(a.overrideMaterial){r(a.overrideMaterial.depthTest);K(a.overrideMaterial.blending);for(e=0;e<Ka;e++)if(s=
+a.__webglObjects[e],s.render)Q=s.object,m=s.buffer,k(Q),f(b,q,R,a.overrideMaterial,m,Q);for(e=0;e<o;e++)s=a.__webglObjectsImmediate[e],Q=s.object,Q.visible&&(H=-1,k(Q),w=h(b,q,R,a.overrideMaterial,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(w,d,va):Q.render(function(b){i(b,w,a.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(e=Ka-1;e>=0;e--)if(s=a.__webglObjects[e],s.render&&(Q=s.object,m=s.buffer,T=s.opaque))k(Q),r(T.depthTest),n(T.depthWrite),l(T.polygonOffset,T.polygonOffsetFactor,
+T.polygonOffsetUnits),f(b,q,R,T,m,Q);for(e=0;e<o;e++)if(s=a.__webglObjectsImmediate[e],Q=s.object,Q.visible&&(H=-1,T=s.opaque))k(Q),r(T.depthTest),n(T.depthWrite),l(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),w=h(b,q,R,T,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(w,d,va):Q.render(function(a){i(a,w,T.shading)});for(e=0;e<Ka;e++)if(s=a.__webglObjects[e],s.render&&(Q=s.object,m=s.buffer,T=s.transparent))k(Q),K(T.blending),r(T.depthTest),n(T.depthWrite),l(T.polygonOffset,T.polygonOffsetFactor,
+T.polygonOffsetUnits),f(b,q,R,T,m,Q);for(e=0;e<o;e++)if(s=a.__webglObjectsImmediate[e],Q=s.object,Q.visible&&(H=-1,T=s.transparent))k(Q),K(T.blending),r(T.depthTest),n(T.depthWrite),l(T.polygonOffset,T.polygonOffsetFactor,T.polygonOffsetUnits),w=h(b,q,R,T,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(w,d,va):Q.render(function(a){i(a,w,T.shading)})}a.__webglSprites.length&&ra(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&aa(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,k=void 0,l=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 l=k,n=void 0,o=void 0,s=void 0,r=void 0,
+m=void 0,q=void 0,t=void 0,x={},w=l.morphTargets.length;l.geometryGroups={};n=0;for(o=l.faces.length;n<o;n++)s=l.faces[n],r=s.materialIndex,q=r!==void 0?r:-1,x[q]===void 0&&(x[q]={hash:q,counter:0}),t=x[q].hash+"_"+x[q].counter,l.geometryGroups[t]===void 0&&(l.geometryGroups[t]={faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w}),m=s instanceof THREE.Face3?3:4,l.geometryGroups[t].vertices+m>65535&&(x[q].counter+=1,t=x[q].hash+"_"+x[q].counter,l.geometryGroups[t]===void 0&&(l.geometryGroups[t]=
+{faces3:[],faces4:[],materialIndex:r,vertices:0,numMorphTargets:w})),s instanceof THREE.Face3?l.geometryGroups[t].faces3.push(n):l.geometryGroups[t].faces4.push(n),l.geometryGroups[t].vertices+=m;l.geometryGroupsList=[];n=void 0;for(n in l.geometryGroups)l.geometryGroups[n].id=qa++,l.geometryGroupsList.push(l.geometryGroups[n])}for(i in k.geometryGroups)if(l=k.geometryGroups[i],!l.__webglVertexBuffer){n=l;n.__webglVertexBuffer=d.createBuffer();n.__webglNormalBuffer=d.createBuffer();n.__webglTangentBuffer=
+d.createBuffer();n.__webglColorBuffer=d.createBuffer();n.__webglUVBuffer=d.createBuffer();n.__webglUV2Buffer=d.createBuffer();n.__webglSkinVertexABuffer=d.createBuffer();n.__webglSkinVertexBBuffer=d.createBuffer();n.__webglSkinIndicesBuffer=d.createBuffer();n.__webglSkinWeightsBuffer=d.createBuffer();n.__webglFaceBuffer=d.createBuffer();n.__webglLineBuffer=d.createBuffer();if(n.numMorphTargets){s=o=void 0;n.__webglMorphTargetsBuffers=[];o=0;for(s=n.numMorphTargets;o<s;o++)n.__webglMorphTargetsBuffers.push(d.createBuffer())}N.info.memory.geometries++;
+r=f;m=r.geometry;o=l.faces3;q=l.faces4;n=o.length*3+q.length*4;s=o.length*1+q.length*2;q=o.length*3+q.length*4;o=c(r,l);t=o.map||o.lightMap||o instanceof THREE.ShaderMaterial?!0:!1;x=o instanceof THREE.MeshBasicMaterial&&!o.envMap||o instanceof THREE.MeshDepthMaterial?!1:o&&o.shading!==void 0&&o.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;w=o.vertexColors?o.vertexColors:!1;l.__vertexArray=new Float32Array(n*3);if(x)l.__normalArray=new Float32Array(n*3);if(m.hasTangents)l.__tangentArray=
+new Float32Array(n*4);if(w)l.__colorArray=new Float32Array(n*3);if(t){if(m.faceUvs.length>0||m.faceVertexUvs.length>0)l.__uvArray=new Float32Array(n*2);if(m.faceUvs.length>1||m.faceVertexUvs.length>1)l.__uv2Array=new Float32Array(n*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length)l.__skinVertexAArray=new Float32Array(n*4),l.__skinVertexBArray=new Float32Array(n*4),l.__skinIndexArray=new Float32Array(n*4),l.__skinWeightArray=new Float32Array(n*4);l.__faceArray=new Uint16Array(s*3);
+l.__lineArray=new Uint16Array(q*2);if(l.numMorphTargets){l.__morphTargetsArrays=[];r=0;for(m=l.numMorphTargets;r<m;r++)l.__morphTargetsArrays.push(new Float32Array(n*3))}l.__needsSmoothNormals=x===THREE.SmoothShading;l.__uvType=t;l.__vertexColorType=w;l.__normalType=x;l.__webglFaceCount=s*3;l.__webglLineCount=q*2;if(o.attributes){if(l.__webglCustomAttributesList===void 0)l.__webglCustomAttributesList=[];s=void 0;for(s in o.attributes){var r=o.attributes[s],m={},B;for(B in r)m[B]=r[B];if(!m.__webglInitialized||
+m.createUniqueBuffers)m.__webglInitialized=!0,q=1,m.type==="v2"?q=2:m.type==="v3"?q=3:m.type==="v4"?q=4:m.type==="c"&&(q=3),m.size=q,m.array=new Float32Array(n*q),m.buffer=d.createBuffer(),m.buffer.belongsToAttribute=s,r.needsUpdate=!0,m.__original=r;l.__webglCustomAttributesList.push(m)}}l.__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)l=k,l.__webglVertexBuffer=d.createBuffer(),l.__webglColorBuffer=d.createBuffer(),N.info.memory.geometries++,l=k,n=l.vertices.length,l.__vertexArray=new Float32Array(n*3),l.__colorArray=new Float32Array(n*3),l.__webglVertexCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.Line){if(k=f.geometry,!k.__webglVertexBuffer)l=k,l.__webglVertexBuffer=d.createBuffer(),l.__webglColorBuffer=d.createBuffer(),N.info.memory.geometries++,l=k,n=f,o=l.vertices.length,
+l.__vertexArray=new Float32Array(o*3),l.__colorArray=new Float32Array(o*3),l.__webglLineCount=o,b(l,n),k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(f instanceof THREE.ParticleSystem&&(k=f.geometry,!k.__webglVertexBuffer))l=k,l.__webglVertexBuffer=d.createBuffer(),l.__webglColorBuffer=d.createBuffer(),N.info.geometries++,l=k,n=f,o=l.vertices.length,l.__vertexArray=new Float32Array(o*3),l.__colorArray=new Float32Array(o*3),l.__sortArray=[],l.__webglParticleCount=o,b(l,n),k.__dirtyVertices=!0,k.__dirtyColors=
+!0;if(!f.__webglActive){if(f instanceof THREE.Mesh)for(i in k=f.geometry,k.geometryGroups)l=k.geometryGroups[i],da(h.__webglObjects,l,f);else f instanceof THREE.Ribbon||f instanceof THREE.Line||f instanceof THREE.ParticleSystem?(k=f.geometry,da(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)R(h.__webglObjects,f);else if(f instanceof THREE.Sprite){h=h.__webglSprites;i=f;for(k=h.length-1;k>=0;k--)h[k]===i&&h.splice(k,1)}else(f instanceof THREE.MarchingCubes||f.immediateRenderCallback)&&R(h.__webglObjectsImmediate,f);f.__webglActive=!1;a.__objectsRemoved.splice(0,1)}f=0;for(h=a.__webglObjects.length;f<h;f++)if(B=
+a.__webglObjects[f].object,i=B.geometry,k=s=o=void 0,B instanceof THREE.Mesh){l=0;for(n=i.geometryGroupsList.length;l<n;l++)if(o=i.geometryGroupsList[l],k=c(B,o),s=k.attributes&&la(k),i.__dirtyVertices||i.__dirtyMorphTargets||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents||s)if(s=d.DYNAMIC_DRAW,r=!i.dynamic,o.__inittedArrays){var C=q=m=void 0,u=void 0,D=void 0,F=void 0,v=void 0,E=void 0,K=void 0,U=void 0,W=C=F=K=void 0,y=void 0,z=void 0,A=void 0,M=void 0,H=void 0,
+J=u=void 0,Z=u=K=void 0,$=void 0,L=u=A=z=y=M=A=z=y=M=A=z=y=M=A=z=y=v=void 0,ca=void 0,O=F=void 0,V=C=void 0,ha=void 0,P=void 0,G=W=V=ca=0,Y=0,fa=L=C=0,S=v=H=0,p=0,I=0,X=void 0,ha=o.__vertexArray,ga=o.__uvArray,p=o.__uv2Array,O=o.__normalArray,D=o.__tangentArray,J=o.__colorArray,Z=o.__skinVertexAArray,$=o.__skinVertexBArray,E=o.__skinIndexArray,ia=o.__skinWeightArray,ja=o.__morphTargetsArrays,t=o.__webglCustomAttributesList,j=void 0,j=o.__faceArray,I=o.__lineArray,ka=o.__needsSmoothNormals,K=o.__vertexColorType,
+U=o.__uvType,F=o.__normalType,aa=B.geometry,X=aa.__dirtyElements,pa=aa.__dirtyUvs,ra=aa.__dirtyNormals,sa=aa.__dirtyTangents,ta=aa.__dirtyColors,P=aa.__dirtyMorphTargets,ma=aa.vertices,x=o.faces3,w=o.faces4,ea=aa.faces,va=aa.faceVertexUvs[0],wa=aa.faceVertexUvs[1],oa=aa.skinVerticesA,ua=aa.skinVerticesB,xa=aa.skinIndices,ya=aa.skinWeights,za=aa.morphTargets;if(aa.__dirtyVertices){m=0;for(q=x.length;m<q;m++)u=ea[x[m]],y=ma[u.a].position,z=ma[u.b].position,A=ma[u.c].position,ha[V]=y.x,ha[V+1]=y.y,ha[V+
+2]=y.z,ha[V+3]=z.x,ha[V+4]=z.y,ha[V+5]=z.z,ha[V+6]=A.x,ha[V+7]=A.y,ha[V+8]=A.z,V+=9;m=0;for(q=w.length;m<q;m++)u=ea[w[m]],y=ma[u.a].position,z=ma[u.b].position,A=ma[u.c].position,M=ma[u.d].position,ha[V]=y.x,ha[V+1]=y.y,ha[V+2]=y.z,ha[V+3]=z.x,ha[V+4]=z.y,ha[V+5]=z.z,ha[V+6]=A.x,ha[V+7]=A.y,ha[V+8]=A.z,ha[V+9]=M.x,ha[V+10]=M.y,ha[V+11]=M.z,V+=12;d.bindBuffer(d.ARRAY_BUFFER,o.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ha,s)}if(P){m=0;for(q=x.length;m<q;m++){u=ea[x[m]];V=0;for(ha=za.length;V<
+ha;V++)y=za[V].vertices[u.a].position,z=za[V].vertices[u.b].position,A=za[V].vertices[u.c].position,P=ja[V],P[S]=y.x,P[S+1]=y.y,P[S+2]=y.z,P[S+3]=z.x,P[S+4]=z.y,P[S+5]=z.z,P[S+6]=A.x,P[S+7]=A.y,P[S+8]=A.z;S+=9}m=0;for(q=w.length;m<q;m++){u=ea[w[m]];V=0;for(ha=za.length;V<ha;V++)y=za[V].vertices[u.a].position,z=za[V].vertices[u.b].position,A=za[V].vertices[u.c].position,M=za[V].vertices[u.d].position,P=ja[V],P[S]=y.x,P[S+1]=y.y,P[S+2]=y.z,P[S+3]=z.x,P[S+4]=z.y,P[S+5]=z.z,P[S+6]=A.x,P[S+7]=A.y,P[S+
+8]=A.z,P[S+9]=M.x,P[S+10]=M.y,P[S+11]=M.z;S+=12}V=0;for(ha=za.length;V<ha;V++)d.bindBuffer(d.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[V]),d.bufferData(d.ARRAY_BUFFER,ja[V],s)}if(ya.length){m=0;for(q=x.length;m<q;m++)u=ea[x[m]],y=ya[u.a],z=ya[u.b],A=ya[u.c],ia[v]=y.x,ia[v+1]=y.y,ia[v+2]=y.z,ia[v+3]=y.w,ia[v+4]=z.x,ia[v+5]=z.y,ia[v+6]=z.z,ia[v+7]=z.w,ia[v+8]=A.x,ia[v+9]=A.y,ia[v+10]=A.z,ia[v+11]=A.w,y=xa[u.a],z=xa[u.b],A=xa[u.c],E[v]=y.x,E[v+1]=y.y,E[v+2]=y.z,E[v+3]=y.w,E[v+4]=z.x,E[v+5]=z.y,E[v+6]=
+z.z,E[v+7]=z.w,E[v+8]=A.x,E[v+9]=A.y,E[v+10]=A.z,E[v+11]=A.w,y=oa[u.a],z=oa[u.b],A=oa[u.c],Z[v]=y.x,Z[v+1]=y.y,Z[v+2]=y.z,Z[v+3]=1,Z[v+4]=z.x,Z[v+5]=z.y,Z[v+6]=z.z,Z[v+7]=1,Z[v+8]=A.x,Z[v+9]=A.y,Z[v+10]=A.z,Z[v+11]=1,y=ua[u.a],z=ua[u.b],A=ua[u.c],$[v]=y.x,$[v+1]=y.y,$[v+2]=y.z,$[v+3]=1,$[v+4]=z.x,$[v+5]=z.y,$[v+6]=z.z,$[v+7]=1,$[v+8]=A.x,$[v+9]=A.y,$[v+10]=A.z,$[v+11]=1,v+=12;m=0;for(q=w.length;m<q;m++)u=ea[w[m]],y=ya[u.a],z=ya[u.b],A=ya[u.c],M=ya[u.d],ia[v]=y.x,ia[v+1]=y.y,ia[v+2]=y.z,ia[v+3]=y.w,
+ia[v+4]=z.x,ia[v+5]=z.y,ia[v+6]=z.z,ia[v+7]=z.w,ia[v+8]=A.x,ia[v+9]=A.y,ia[v+10]=A.z,ia[v+11]=A.w,ia[v+12]=M.x,ia[v+13]=M.y,ia[v+14]=M.z,ia[v+15]=M.w,y=xa[u.a],z=xa[u.b],A=xa[u.c],M=xa[u.d],E[v]=y.x,E[v+1]=y.y,E[v+2]=y.z,E[v+3]=y.w,E[v+4]=z.x,E[v+5]=z.y,E[v+6]=z.z,E[v+7]=z.w,E[v+8]=A.x,E[v+9]=A.y,E[v+10]=A.z,E[v+11]=A.w,E[v+12]=M.x,E[v+13]=M.y,E[v+14]=M.z,E[v+15]=M.w,y=oa[u.a],z=oa[u.b],A=oa[u.c],M=oa[u.d],Z[v]=y.x,Z[v+1]=y.y,Z[v+2]=y.z,Z[v+3]=1,Z[v+4]=z.x,Z[v+5]=z.y,Z[v+6]=z.z,Z[v+7]=1,Z[v+8]=A.x,
+Z[v+9]=A.y,Z[v+10]=A.z,Z[v+11]=1,Z[v+12]=M.x,Z[v+13]=M.y,Z[v+14]=M.z,Z[v+15]=1,y=ua[u.a],z=ua[u.b],A=ua[u.c],u=ua[u.d],$[v]=y.x,$[v+1]=y.y,$[v+2]=y.z,$[v+3]=1,$[v+4]=z.x,$[v+5]=z.y,$[v+6]=z.z,$[v+7]=1,$[v+8]=A.x,$[v+9]=A.y,$[v+10]=A.z,$[v+11]=1,$[v+12]=u.x,$[v+13]=u.y,$[v+14]=u.z,$[v+15]=1,v+=16;v>0&&(d.bindBuffer(d.ARRAY_BUFFER,o.__webglSkinVertexABuffer),d.bufferData(d.ARRAY_BUFFER,Z,s),d.bindBuffer(d.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),d.bufferData(d.ARRAY_BUFFER,$,s),d.bindBuffer(d.ARRAY_BUFFER,
+o.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,E,s),d.bindBuffer(d.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),d.bufferData(d.ARRAY_BUFFER,ia,s))}if(ta&&K){m=0;for(q=x.length;m<q;m++)u=ea[x[m]],v=u.vertexColors,E=u.color,v.length===3&&K===THREE.VertexColors?(u=v[0],Z=v[1],$=v[2]):$=Z=u=E,J[H]=u.r,J[H+1]=u.g,J[H+2]=u.b,J[H+3]=Z.r,J[H+4]=Z.g,J[H+5]=Z.b,J[H+6]=$.r,J[H+7]=$.g,J[H+8]=$.b,H+=9;m=0;for(q=w.length;m<q;m++)u=ea[w[m]],v=u.vertexColors,E=u.color,v.length===4&&K===THREE.VertexColors?(u=
+v[0],Z=v[1],$=v[2],v=v[3]):v=$=Z=u=E,J[H]=u.r,J[H+1]=u.g,J[H+2]=u.b,J[H+3]=Z.r,J[H+4]=Z.g,J[H+5]=Z.b,J[H+6]=$.r,J[H+7]=$.g,J[H+8]=$.b,J[H+9]=v.r,J[H+10]=v.g,J[H+11]=v.b,H+=12;H>0&&(d.bindBuffer(d.ARRAY_BUFFER,o.__webglColorBuffer),d.bufferData(d.ARRAY_BUFFER,J,s))}if(sa&&aa.hasTangents){m=0;for(q=x.length;m<q;m++)u=ea[x[m]],K=u.vertexTangents,H=K[0],u=K[1],J=K[2],D[L]=H.x,D[L+1]=H.y,D[L+2]=H.z,D[L+3]=H.w,D[L+4]=u.x,D[L+5]=u.y,D[L+6]=u.z,D[L+7]=u.w,D[L+8]=J.x,D[L+9]=J.y,D[L+10]=J.z,D[L+11]=J.w,L+=
+12;m=0;for(q=w.length;m<q;m++)u=ea[w[m]],K=u.vertexTangents,H=K[0],u=K[1],J=K[2],K=K[3],D[L]=H.x,D[L+1]=H.y,D[L+2]=H.z,D[L+3]=H.w,D[L+4]=u.x,D[L+5]=u.y,D[L+6]=u.z,D[L+7]=u.w,D[L+8]=J.x,D[L+9]=J.y,D[L+10]=J.z,D[L+11]=J.w,D[L+12]=K.x,D[L+13]=K.y,D[L+14]=K.z,D[L+15]=K.w,L+=16;d.bindBuffer(d.ARRAY_BUFFER,o.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,D,s)}if(ra&&F){m=0;for(q=x.length;m<q;m++)if(u=ea[x[m]],D=u.vertexNormals,F=u.normal,D.length===3&&ka)for(L=0;L<3;L++)F=D[L],O[C]=F.x,O[C+1]=F.y,O[C+
+2]=F.z,C+=3;else for(L=0;L<3;L++)O[C]=F.x,O[C+1]=F.y,O[C+2]=F.z,C+=3;m=0;for(q=w.length;m<q;m++)if(u=ea[w[m]],D=u.vertexNormals,F=u.normal,D.length===4&&ka)for(L=0;L<4;L++)F=D[L],O[C]=F.x,O[C+1]=F.y,O[C+2]=F.z,C+=3;else for(L=0;L<4;L++)O[C]=F.x,O[C+1]=F.y,O[C+2]=F.z,C+=3;d.bindBuffer(d.ARRAY_BUFFER,o.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,O,s)}if(pa&&va&&U){m=0;for(q=x.length;m<q;m++)if(C=x[m],C=va[C],C!==void 0)for(L=0;L<3;L++)O=C[L],ga[W]=O.u,ga[W+1]=O.v,W+=2;m=0;for(q=w.length;m<q;m++)if(C=
+w[m],C=va[C],C!==void 0)for(L=0;L<4;L++)O=C[L],ga[W]=O.u,ga[W+1]=O.v,W+=2;W>0&&(d.bindBuffer(d.ARRAY_BUFFER,o.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ga,s))}if(pa&&wa&&U){m=0;for(q=x.length;m<q;m++)if(C=x[m],W=wa[C],W!==void 0)for(L=0;L<3;L++)C=W[L],p[G]=C.u,p[G+1]=C.v,G+=2;m=0;for(q=w.length;m<q;m++)if(C=w[m],W=wa[C],W!==void 0)for(L=0;L<4;L++)C=W[L],p[G]=C.u,p[G+1]=C.v,G+=2;G>0&&(d.bindBuffer(d.ARRAY_BUFFER,o.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,p,s))}if(X){m=0;for(q=x.length;m<q;m++)j[Y]=
+ca,j[Y+1]=ca+1,j[Y+2]=ca+2,Y+=3,I[fa]=ca,I[fa+1]=ca+1,I[fa+2]=ca,I[fa+3]=ca+2,I[fa+4]=ca+1,I[fa+5]=ca+2,fa+=6,ca+=3;m=0;for(q=w.length;m<q;m++)j[Y]=ca,j[Y+1]=ca+1,j[Y+2]=ca+3,j[Y+3]=ca+1,j[Y+4]=ca+2,j[Y+5]=ca+3,Y+=6,I[fa]=ca,I[fa+1]=ca+1,I[fa+2]=ca,I[fa+3]=ca+3,I[fa+4]=ca+1,I[fa+5]=ca+2,I[fa+6]=ca+2,I[fa+7]=ca+3,fa+=8,ca+=4;d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,j,s);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,
+I,s)}if(t){L=0;for(ca=t.length;L<ca;L++)if(j=t[L],j.__original.needsUpdate){I=p=0;if(j.size===1)if(j.boundTo===void 0||j.boundTo==="vertices"){m=0;for(q=x.length;m<q;m++)u=ea[x[m]],j.array[p]=j.value[u.a],j.array[p+1]=j.value[u.b],j.array[p+2]=j.value[u.c],p+=3;m=0;for(q=w.length;m<q;m++)u=ea[w[m]],j.array[p]=j.value[u.a],j.array[p+1]=j.value[u.b],j.array[p+2]=j.value[u.c],j.array[p+3]=j.value[u.d],p+=4}else if(j.boundTo==="faces"){m=0;for(q=x.length;m<q;m++)X=j.value[I],j.array[p]=X,j.array[p+1]=
+X,j.array[p+2]=X,p+=3,I+=1;m=0;for(q=w.length;m<q;m++)X=j.value[I],j.array[p]=X,j.array[p+1]=X,j.array[p+2]=X,j.array[p+3]=X,p+=4,I+=1}else{if(j.boundTo==="faceVertices"){m=0;for(q=x.length;m<q;m++)j.array[p]=j.value[I],j.array[p+1]=j.value[I+1],j.array[p+2]=j.value[I+2],p+=3,I+=3;m=0;for(q=w.length;m<q;m++)j.array[p]=j.value[I],j.array[p+1]=j.value[I+1],j.array[p+2]=j.value[I+2],j.array[p+3]=j.value[I+3],p+=4,I+=4}}else if(j.size===2)if(j.boundTo===void 0||j.boundTo==="vertices"){m=0;for(q=x.length;m<
+q;m++)u=ea[x[m]],y=j.value[u.a],z=j.value[u.b],A=j.value[u.c],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=z.x,j.array[p+3]=z.y,j.array[p+4]=A.x,j.array[p+5]=A.y,p+=6;m=0;for(q=w.length;m<q;m++)u=ea[w[m]],y=j.value[u.a],z=j.value[u.b],A=j.value[u.c],M=j.value[u.d],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=z.x,j.array[p+3]=z.y,j.array[p+4]=A.x,j.array[p+5]=A.y,j.array[p+6]=M.x,j.array[p+7]=M.y,p+=8}else if(j.boundTo==="faces"){m=0;for(q=x.length;m<q;m++)A=z=y=X=j.value[I],j.array[p]=y.x,j.array[p+
+1]=y.y,j.array[p+2]=z.x,j.array[p+3]=z.y,j.array[p+4]=A.x,j.array[p+5]=A.y,p+=6,I+=1;m=0;for(q=w.length;m<q;m++)M=A=z=y=X=j.value[I],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=z.x,j.array[p+3]=z.y,j.array[p+4]=A.x,j.array[p+5]=A.y,j.array[p+6]=M.x,j.array[p+7]=M.y,p+=8,I+=1}else{if(j.boundTo==="faceVertices"){m=0;for(q=x.length;m<q;m++)y=j.value[I],z=j.value[I+1],A=j.value[I+2],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=z.x,j.array[p+3]=z.y,j.array[p+4]=A.x,j.array[p+5]=A.y,p+=6,I+=3;m=0;for(q=
+w.length;m<q;m++)y=j.value[I],z=j.value[I+1],A=j.value[I+2],M=j.value[I+3],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=z.x,j.array[p+3]=z.y,j.array[p+4]=A.x,j.array[p+5]=A.y,j.array[p+6]=M.x,j.array[p+7]=M.y,p+=8,I+=4}}else if(j.size===3)if(G=j.type==="c"?["r","g","b"]:["x","y","z"],j.boundTo===void 0||j.boundTo==="vertices"){m=0;for(q=x.length;m<q;m++)u=ea[x[m]],y=j.value[u.a],z=j.value[u.b],A=j.value[u.c],j.array[p]=y[G[0]],j.array[p+1]=y[G[1]],j.array[p+2]=y[G[2]],j.array[p+3]=z[G[0]],j.array[p+
+4]=z[G[1]],j.array[p+5]=z[G[2]],j.array[p+6]=A[G[0]],j.array[p+7]=A[G[1]],j.array[p+8]=A[G[2]],p+=9;m=0;for(q=w.length;m<q;m++)u=ea[w[m]],y=j.value[u.a],z=j.value[u.b],A=j.value[u.c],M=j.value[u.d],j.array[p]=y[G[0]],j.array[p+1]=y[G[1]],j.array[p+2]=y[G[2]],j.array[p+3]=z[G[0]],j.array[p+4]=z[G[1]],j.array[p+5]=z[G[2]],j.array[p+6]=A[G[0]],j.array[p+7]=A[G[1]],j.array[p+8]=A[G[2]],j.array[p+9]=M[G[0]],j.array[p+10]=M[G[1]],j.array[p+11]=M[G[2]],p+=12,I+=1}else if(j.boundTo==="faces"){m=0;for(q=x.length;m<
+q;m++)A=z=y=X=j.value[I],j.array[p]=y[G[0]],j.array[p+1]=y[G[1]],j.array[p+2]=y[G[2]],j.array[p+3]=z[G[0]],j.array[p+4]=z[G[1]],j.array[p+5]=z[G[2]],j.array[p+6]=A[G[0]],j.array[p+7]=A[G[1]],j.array[p+8]=A[G[2]],p+=9,I+=1;m=0;for(q=w.length;m<q;m++)M=A=z=y=X=j.value[I],j.array[p]=y[G[0]],j.array[p+1]=y[G[1]],j.array[p+2]=y[G[2]],j.array[p+3]=z[G[0]],j.array[p+4]=z[G[1]],j.array[p+5]=z[G[2]],j.array[p+6]=A[G[0]],j.array[p+7]=A[G[1]],j.array[p+8]=A[G[2]],j.array[p+9]=M[G[0]],j.array[p+10]=M[G[1]],j.array[p+
+11]=M[G[2]],p+=12,I+=1}else{if(j.boundTo==="faceVertices"){m=0;for(q=x.length;m<q;m++)y=j.value[I],z=j.value[I+1],A=j.value[I+2],j.array[p]=y[G[0]],j.array[p+1]=y[G[1]],j.array[p+2]=y[G[2]],j.array[p+3]=z[G[0]],j.array[p+4]=z[G[1]],j.array[p+5]=z[G[2]],j.array[p+6]=A[G[0]],j.array[p+7]=A[G[1]],j.array[p+8]=A[G[2]],p+=9,I+=3;m=0;for(q=w.length;m<q;m++)y=j.value[I],z=j.value[I+1],A=j.value[I+2],M=j.value[I+3],j.array[p]=y[G[0]],j.array[p+1]=y[G[1]],j.array[p+2]=y[G[2]],j.array[p+3]=z[G[0]],j.array[p+
+4]=z[G[1]],j.array[p+5]=z[G[2]],j.array[p+6]=A[G[0]],j.array[p+7]=A[G[1]],j.array[p+8]=A[G[2]],j.array[p+9]=M[G[0]],j.array[p+10]=M[G[1]],j.array[p+11]=M[G[2]],p+=12,I+=4}}else if(j.size===4)if(j.boundTo===void 0||j.boundTo==="vertices"){m=0;for(q=x.length;m<q;m++)u=ea[x[m]],y=j.value[u.a],z=j.value[u.b],A=j.value[u.c],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=y.z,j.array[p+3]=y.w,j.array[p+4]=z.x,j.array[p+5]=z.y,j.array[p+6]=z.z,j.array[p+7]=z.w,j.array[p+8]=A.x,j.array[p+9]=A.y,j.array[p+10]=
+A.z,j.array[p+11]=A.w,p+=12;m=0;for(q=w.length;m<q;m++)u=ea[w[m]],y=j.value[u.a],z=j.value[u.b],A=j.value[u.c],M=j.value[u.d],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=y.z,j.array[p+3]=y.w,j.array[p+4]=z.x,j.array[p+5]=z.y,j.array[p+6]=z.z,j.array[p+7]=z.w,j.array[p+8]=A.x,j.array[p+9]=A.y,j.array[p+10]=A.z,j.array[p+11]=A.w,j.array[p+12]=M.x,j.array[p+13]=M.y,j.array[p+14]=M.z,j.array[p+15]=M.w,p+=16}else if(j.boundTo==="faces"){m=0;for(q=x.length;m<q;m++)A=z=y=X=j.value[I],j.array[p]=y.x,j.array[p+
+1]=y.y,j.array[p+2]=y.z,j.array[p+3]=y.w,j.array[p+4]=z.x,j.array[p+5]=z.y,j.array[p+6]=z.z,j.array[p+7]=z.w,j.array[p+8]=A.x,j.array[p+9]=A.y,j.array[p+10]=A.z,j.array[p+11]=A.w,p+=12,I+=1;m=0;for(q=w.length;m<q;m++)M=A=z=y=X=j.value[I],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=y.z,j.array[p+3]=y.w,j.array[p+4]=z.x,j.array[p+5]=z.y,j.array[p+6]=z.z,j.array[p+7]=z.w,j.array[p+8]=A.x,j.array[p+9]=A.y,j.array[p+10]=A.z,j.array[p+11]=A.w,j.array[p+12]=M.x,j.array[p+13]=M.y,j.array[p+14]=M.z,j.array[p+
+15]=M.w,p+=16,I+=1}else if(j.boundTo==="faceVertices"){m=0;for(q=x.length;m<q;m++)y=j.value[I],z=j.value[I+1],A=j.value[I+2],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=y.z,j.array[p+3]=y.w,j.array[p+4]=z.x,j.array[p+5]=z.y,j.array[p+6]=z.z,j.array[p+7]=z.w,j.array[p+8]=A.x,j.array[p+9]=A.y,j.array[p+10]=A.z,j.array[p+11]=A.w,p+=12,I+=3;m=0;for(q=w.length;m<q;m++)y=j.value[I],z=j.value[I+1],A=j.value[I+2],M=j.value[I+3],j.array[p]=y.x,j.array[p+1]=y.y,j.array[p+2]=y.z,j.array[p+3]=y.w,j.array[p+
+4]=z.x,j.array[p+5]=z.y,j.array[p+6]=z.z,j.array[p+7]=z.w,j.array[p+8]=A.x,j.array[p+9]=A.y,j.array[p+10]=A.z,j.array[p+11]=A.w,j.array[p+12]=M.x,j.array[p+13]=M.y,j.array[p+14]=M.z,j.array[p+15]=M.w,p+=16,I+=4}d.bindBuffer(d.ARRAY_BUFFER,j.buffer);d.bufferData(d.ARRAY_BUFFER,j.array,s)}}r&&(delete o.__inittedArrays,delete o.__colorArray,delete o.__normalArray,delete o.__tangentArray,delete o.__uvArray,delete o.__uv2Array,delete o.__faceArray,delete o.__vertexArray,delete o.__lineArray,delete o.__skinVertexAArray,
+delete o.__skinVertexBArray,delete o.__skinIndexArray,delete o.__skinWeightArray)}i.__dirtyVertices=!1;i.__dirtyMorphTargets=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyColors=!1;i.__dirtyTangents=!1;k.attributes&&na(k)}else if(B instanceof THREE.Ribbon){if(i.__dirtyVertices||i.__dirtyColors){k=i;B=d.DYNAMIC_DRAW;l=m=r=r=void 0;q=k.vertices;n=k.colors;t=q.length;o=n.length;x=k.__vertexArray;s=k.__colorArray;w=k.__dirtyColors;if(k.__dirtyVertices){for(r=0;r<t;r++)m=q[r].position,
+l=r*3,x[l]=m.x,x[l+1]=m.y,x[l+2]=m.z;d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,x,B)}if(w){for(r=0;r<o;r++)color=n[r],l=r*3,s[l]=color.r,s[l+1]=color.g,s[l+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,s,B)}}i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(B instanceof THREE.Line){k=c(B,o);s=k.attributes&&la(k);if(i.__dirtyVertices||i.__dirtyColors||s){B=i;l=d.DYNAMIC_DRAW;n=ca=q=ea=void 0;q=B.vertices;o=B.colors;t=q.length;
+s=o.length;x=B.__vertexArray;r=B.__colorArray;w=B.__dirtyColors;m=B.__webglCustomAttributesList;W=fa=Y=G=ca=ea=void 0;if(B.__dirtyVertices){for(ea=0;ea<t;ea++)ca=q[ea].position,n=ea*3,x[n]=ca.x,x[n+1]=ca.y,x[n+2]=ca.z;d.bindBuffer(d.ARRAY_BUFFER,B.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,x,l)}if(w){for(q=0;q<s;q++)color=o[q],n=q*3,r[n]=color.r,r[n+1]=color.g,r[n+2]=color.b;d.bindBuffer(d.ARRAY_BUFFER,B.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,r,l)}if(m){ea=0;for(ca=m.length;ea<ca;ea++)if(W=
+m[ea],W.__original.needsUpdate&&(W.boundTo===void 0||W.boundTo==="vertices")){n=0;Y=W.value.length;for(G=0;G<Y;G++)W.size===1?W.array[n]=W.value[G]:(fa=W.value[G],W.size===2?(W.array[n]=fa.x,W.array[n+1]=fa.y):W.size===3?W.type==="c"?(W.array[n]=fa.r,W.array[n+1]=fa.g,W.array[n+2]=fa.b):(W.array[n]=fa.x,W.array[n+1]=fa.y,W.array[n+2]=fa.z):(W.array[n]=fa.x,W.array[n+1]=fa.y,W.array[n+2]=fa.z,W.array[n+3]=fa.w)),n+=W.size;d.bindBuffer(d.ARRAY_BUFFER,W.buffer);d.bufferData(d.ARRAY_BUFFER,W.array,l)}}}i.__dirtyVertices=
+!1;i.__dirtyColors=!1;k.attributes&&na(k)}else if(B instanceof THREE.ParticleSystem)k=c(B,o),s=k.attributes&&la(k),(i.__dirtyVertices||i.__dirtyColors||B.sortParticles||s)&&e(i,d.DYNAMIC_DRAW,B),i.__dirtyVertices=!1,i.__dirtyColors=!1,k.attributes&&na(k)};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 Wa}};
 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};

+ 489 - 206
src/renderers/WebGLRenderer.js

@@ -1804,340 +1804,623 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			for ( i = 0, il = customAttributes.length; i < il; i ++ ) {
 
-				customAttributes[ i ].offset = 0;
-				customAttributes[ i ].offsetSrc = 0;
+				customAttribute = customAttributes[ i ];
 
-			}
+				if ( ! customAttribute.__original.needsUpdate ) continue;
 
-			for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
+				offset_custom = 0;
+				offset_customSrc = 0;
 
-				face = obj_faces[ chunk_faces3[ f ]	];
+				if ( customAttribute.size === 1 ) {
 
-				for ( i = 0, il = customAttributes.length; i < il; i ++ ) {
+					if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
 
-					customAttribute = customAttributes[ i ];
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
 
-					if ( customAttribute.__original.needsUpdate ) {
+							face = obj_faces[ chunk_faces3[ f ]	];
 
-						offset_custom = customAttribute.offset;
-						offset_customSrc = customAttribute.offsetSrc;
+							customAttribute.array[ offset_custom ] 	   = customAttribute.value[ face.a ];
+							customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ];
+							customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ];
 
-						if ( customAttribute.size === 1 ) {
+							offset_custom += 3;
 
-							if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
+						}
 
-								customAttribute.array[ offset_custom ] 	   = customAttribute.value[ face.a ];
-								customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ];
-								customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ];
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
 
-							} else if ( customAttribute.boundTo === "faces" ) {
+							face = obj_faces[ chunk_faces4[ f ] ];
 
-								value = customAttribute.value[ offset_customSrc ];
+							customAttribute.array[ offset_custom ] 	   = customAttribute.value[ face.a ];
+							customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ];
+							customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ];
+							customAttribute.array[ offset_custom + 3 ] = customAttribute.value[ face.d ];
 
-								customAttribute.array[ offset_custom ] 	   = value;
-								customAttribute.array[ offset_custom + 1 ] = value;
-								customAttribute.array[ offset_custom + 2 ] = value;
+							offset_custom += 4;
 
-								customAttribute.offsetSrc ++;
+						}
 
-							} else if ( customAttribute.boundTo === "faceVertices" ) {
+					} else if ( customAttribute.boundTo === "faces" ) {
 
-								customAttribute.array[ offset_custom ] 	   = customAttribute.value[ offset_customSrc ];
-								customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ offset_customSrc + 1 ];
-								customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ offset_customSrc + 2 ];
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
 
-								customAttribute.offsetSrc += 3;
+							value = customAttribute.value[ offset_customSrc ];
 
-							}
+							customAttribute.array[ offset_custom ] 	   = value;
+							customAttribute.array[ offset_custom + 1 ] = value;
+							customAttribute.array[ offset_custom + 2 ] = value;
 
-							customAttribute.offset += 3;
+							offset_custom += 3;
+							offset_customSrc += 1;
 
-						} else {
+						}
 
-							if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
 
-								v1 = customAttribute.value[ face.a ];
-								v2 = customAttribute.value[ face.b ];
-								v3 = customAttribute.value[ face.c ];
+							value = customAttribute.value[ offset_customSrc ];
 
-							} else if ( customAttribute.boundTo === "faces" ) {
+							customAttribute.array[ offset_custom ] 	   = value;
+							customAttribute.array[ offset_custom + 1 ] = value;
+							customAttribute.array[ offset_custom + 2 ] = value;
+							customAttribute.array[ offset_custom + 3 ] = value;
 
-								value = customAttribute.value[ offset_customSrc ];
+							offset_custom += 4;
+							offset_customSrc += 1;
 
-								v1 = value;
-								v2 = value;
-								v3 = value;
+						}
 
-								customAttribute.offsetSrc ++;
+					} else if ( customAttribute.boundTo === "faceVertices" ) {
 
-							} else if ( customAttribute.boundTo === "faceVertices" ) {
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
 
-								v1 = customAttribute.value[ offset_customSrc ];
-								v2 = customAttribute.value[ offset_customSrc + 1 ];
-								v3 = customAttribute.value[ offset_customSrc + 2 ];
+							customAttribute.array[ offset_custom ] 	   = customAttribute.value[ offset_customSrc ];
+							customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ offset_customSrc + 1 ];
+							customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ offset_customSrc + 2 ];
 
-								customAttribute.offsetSrc += 3;
+							offset_custom += 3;
+							offset_customSrc += 3;
 
-							}
+						}
 
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
 
-							if ( customAttribute.size === 2 ) {
+							customAttribute.array[ offset_custom ] 	   = customAttribute.value[ offset_customSrc ];
+							customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ offset_customSrc + 1 ];
+							customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ offset_customSrc + 2 ];
+							customAttribute.array[ offset_custom + 3 ] = customAttribute.value[ offset_customSrc + 3 ];
 
-								customAttribute.array[ offset_custom ] 	   = v1.x;
-								customAttribute.array[ offset_custom + 1 ] = v1.y;
+							offset_custom += 4;
+							offset_customSrc += 4;
 
-								customAttribute.array[ offset_custom + 2 ] = v2.x;
-								customAttribute.array[ offset_custom + 3 ] = v2.y;
+						}
 
-								customAttribute.array[ offset_custom + 4 ] = v3.x;
-								customAttribute.array[ offset_custom + 5 ] = v3.y;
+					}
 
-								customAttribute.offset += 6;
+				} else if ( customAttribute.size === 2 ) {
 
-							} else if ( customAttribute.size === 3 ) {
+					if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
 
-								if ( customAttribute.type === "c" ) {
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
 
-									customAttribute.array[ offset_custom ] 	   = v1.r;
-									customAttribute.array[ offset_custom + 1 ] = v1.g;
-									customAttribute.array[ offset_custom + 2 ] = v1.b;
+							face = obj_faces[ chunk_faces3[ f ]	];
 
-									customAttribute.array[ offset_custom + 3 ] = v2.r;
-									customAttribute.array[ offset_custom + 4 ] = v2.g;
-									customAttribute.array[ offset_custom + 5 ] = v2.b;
+							v1 = customAttribute.value[ face.a ];
+							v2 = customAttribute.value[ face.b ];
+							v3 = customAttribute.value[ face.c ];
 
-									customAttribute.array[ offset_custom + 6 ] = v3.r;
-									customAttribute.array[ offset_custom + 7 ] = v3.g;
-									customAttribute.array[ offset_custom + 8 ] = v3.b;
+							customAttribute.array[ offset_custom ] 	   = v1.x;
+							customAttribute.array[ offset_custom + 1 ] = v1.y;
 
-								} else {
+							customAttribute.array[ offset_custom + 2 ] = v2.x;
+							customAttribute.array[ offset_custom + 3 ] = v2.y;
 
-									customAttribute.array[ offset_custom ] 	   = v1.x;
-									customAttribute.array[ offset_custom + 1 ] = v1.y;
-									customAttribute.array[ offset_custom + 2 ] = v1.z;
+							customAttribute.array[ offset_custom + 4 ] = v3.x;
+							customAttribute.array[ offset_custom + 5 ] = v3.y;
 
-									customAttribute.array[ offset_custom + 3 ] = v2.x;
-									customAttribute.array[ offset_custom + 4 ] = v2.y;
-									customAttribute.array[ offset_custom + 5 ] = v2.z;
+							offset_custom += 6;
 
-									customAttribute.array[ offset_custom + 6 ] = v3.x;
-									customAttribute.array[ offset_custom + 7 ] = v3.y;
-									customAttribute.array[ offset_custom + 8 ] = v3.z;
+						}
 
-								}
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
 
-								customAttribute.offset += 9;
+							face = obj_faces[ chunk_faces4[ f ] ];
 
-							} else {
+							v1 = customAttribute.value[ face.a ];
+							v2 = customAttribute.value[ face.b ];
+							v3 = customAttribute.value[ face.c ];
+							v4 = customAttribute.value[ face.d ];
 
-								customAttribute.array[ offset_custom  ] 	= v1.x;
-								customAttribute.array[ offset_custom + 1  ] = v1.y;
-								customAttribute.array[ offset_custom + 2  ] = v1.z;
-								customAttribute.array[ offset_custom + 3  ] = v1.w;
+							customAttribute.array[ offset_custom ] 	   = v1.x;
+							customAttribute.array[ offset_custom + 1 ] = v1.y;
 
-								customAttribute.array[ offset_custom + 4  ] = v2.x;
-								customAttribute.array[ offset_custom + 5  ] = v2.y;
-								customAttribute.array[ offset_custom + 6  ] = v2.z;
-								customAttribute.array[ offset_custom + 7  ] = v2.w;
+							customAttribute.array[ offset_custom + 2 ] = v2.x;
+							customAttribute.array[ offset_custom + 3 ] = v2.y;
 
-								customAttribute.array[ offset_custom + 8  ] = v3.x;
-								customAttribute.array[ offset_custom + 9  ] = v3.y;
-								customAttribute.array[ offset_custom + 10 ] = v3.z;
-								customAttribute.array[ offset_custom + 11 ] = v3.w;
+							customAttribute.array[ offset_custom + 4 ] = v3.x;
+							customAttribute.array[ offset_custom + 5 ] = v3.y;
 
-								customAttribute.offset += 12;
+							customAttribute.array[ offset_custom + 6 ] = v4.x;
+							customAttribute.array[ offset_custom + 7 ] = v4.y;
 
-							}
+							offset_custom += 8;
+
+						}
+
+					} else if ( customAttribute.boundTo === "faces" ) {
+
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
+
+							value = customAttribute.value[ offset_customSrc ];
+
+							v1 = value;
+							v2 = value;
+							v3 = value;
+
+							customAttribute.array[ offset_custom ] 	   = v1.x;
+							customAttribute.array[ offset_custom + 1 ] = v1.y;
+
+							customAttribute.array[ offset_custom + 2 ] = v2.x;
+							customAttribute.array[ offset_custom + 3 ] = v2.y;
+
+							customAttribute.array[ offset_custom + 4 ] = v3.x;
+							customAttribute.array[ offset_custom + 5 ] = v3.y;
+
+							offset_custom += 6;
+							offset_customSrc += 1;
+
+						}
+
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
+
+							value = customAttribute.value[ offset_customSrc ];
+
+							v1 = value;
+							v2 = value;
+							v3 = value;
+							v4 = value;
+
+							customAttribute.array[ offset_custom ] 	   = v1.x;
+							customAttribute.array[ offset_custom + 1 ] = v1.y;
+
+							customAttribute.array[ offset_custom + 2 ] = v2.x;
+							customAttribute.array[ offset_custom + 3 ] = v2.y;
+
+							customAttribute.array[ offset_custom + 4 ] = v3.x;
+							customAttribute.array[ offset_custom + 5 ] = v3.y;
+
+							customAttribute.array[ offset_custom + 6 ] = v4.x;
+							customAttribute.array[ offset_custom + 7 ] = v4.y;
+
+							offset_custom += 8;
+							offset_customSrc += 1;
+
+						}
+
+					} else if ( customAttribute.boundTo === "faceVertices" ) {
+
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
+
+							v1 = customAttribute.value[ offset_customSrc ];
+							v2 = customAttribute.value[ offset_customSrc + 1 ];
+							v3 = customAttribute.value[ offset_customSrc + 2 ];
+
+							customAttribute.array[ offset_custom ] 	   = v1.x;
+							customAttribute.array[ offset_custom + 1 ] = v1.y;
+
+							customAttribute.array[ offset_custom + 2 ] = v2.x;
+							customAttribute.array[ offset_custom + 3 ] = v2.y;
+
+							customAttribute.array[ offset_custom + 4 ] = v3.x;
+							customAttribute.array[ offset_custom + 5 ] = v3.y;
+
+							offset_custom += 6;
+							offset_customSrc += 3;
+
+						}
+
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
+
+							v1 = customAttribute.value[ offset_customSrc ];
+							v2 = customAttribute.value[ offset_customSrc + 1 ];
+							v3 = customAttribute.value[ offset_customSrc + 2 ];
+							v4 = customAttribute.value[ offset_customSrc + 3 ];
+
+							customAttribute.array[ offset_custom ] 	   = v1.x;
+							customAttribute.array[ offset_custom + 1 ] = v1.y;
+
+							customAttribute.array[ offset_custom + 2 ] = v2.x;
+							customAttribute.array[ offset_custom + 3 ] = v2.y;
+
+							customAttribute.array[ offset_custom + 4 ] = v3.x;
+							customAttribute.array[ offset_custom + 5 ] = v3.y;
+
+							customAttribute.array[ offset_custom + 6 ] = v4.x;
+							customAttribute.array[ offset_custom + 7 ] = v4.y;
+
+							offset_custom += 8;
+							offset_customSrc += 4;
 
 						}
 
 					}
 
-				}
+				} else if ( customAttribute.size === 3 ) {
 
-			}
+					var pp;
 
-			for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
+					if ( customAttribute.type === "c" ) {
 
-				face = obj_faces[ chunk_faces4[ f ] ];
+						pp = [ "r", "g", "b" ];
 
-				for ( i = 0, il = customAttributes.length; i < il; i ++ ) {
+					} else {
 
-					customAttribute = customAttributes[ i ];
+						pp = [ "x", "y", "z" ];
 
-					if ( customAttribute.__original.needsUpdate ) {
+					}
 
-						offset_custom = customAttribute.offset;
-						offset_customSrc = customAttribute.offsetSrc;
+					if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
 
-						if ( customAttribute.size === 1 ) {
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
 
-							if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
+							face = obj_faces[ chunk_faces3[ f ]	];
 
-								customAttribute.array[ offset_custom ] 	   = customAttribute.value[ face.a ];
-								customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ face.b ];
-								customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ face.c ];
-								customAttribute.array[ offset_custom + 3 ] = customAttribute.value[ face.d ];
+							v1 = customAttribute.value[ face.a ];
+							v2 = customAttribute.value[ face.b ];
+							v3 = customAttribute.value[ face.c ];
 
-							} else if ( customAttribute.boundTo === "faces" ) {
+							customAttribute.array[ offset_custom ] 	   = v1[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ];
 
-								value = customAttribute.value[ offset_customSrc ];
+							customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ];
 
-								customAttribute.array[ offset_custom ] 	   = value;
-								customAttribute.array[ offset_custom + 1 ] = value;
-								customAttribute.array[ offset_custom + 2 ] = value;
-								customAttribute.array[ offset_custom + 3 ] = value;
+							customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ];
 
-								customAttribute.offsetSrc ++;
+							offset_custom += 9;
 
-							} else if ( customAttribute.boundTo === "faceVertices" ) {
+						}
 
-								customAttribute.array[ offset_custom ] 	   = customAttribute.value[ offset_customSrc ];
-								customAttribute.array[ offset_custom + 1 ] = customAttribute.value[ offset_customSrc + 1 ];
-								customAttribute.array[ offset_custom + 2 ] = customAttribute.value[ offset_customSrc + 2 ];
-								customAttribute.array[ offset_custom + 3 ] = customAttribute.value[ offset_customSrc + 3 ];
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
 
-								customAttribute.offsetSrc += 4;
+							face = obj_faces[ chunk_faces4[ f ] ];
 
-							}
+							v1 = customAttribute.value[ face.a ];
+							v2 = customAttribute.value[ face.b ];
+							v3 = customAttribute.value[ face.c ];
+							v4 = customAttribute.value[ face.d ];
 
-							customAttribute.offset += 4;
+							customAttribute.array[ offset_custom  ] 	= v1[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 1  ] = v1[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 2  ] = v1[ pp[ 2 ] ];
 
-						} else {
+							customAttribute.array[ offset_custom + 3  ] = v2[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 4  ] = v2[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 5  ] = v2[ pp[ 2 ] ];
 
-							if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
+							customAttribute.array[ offset_custom + 6  ] = v3[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 7  ] = v3[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 8  ] = v3[ pp[ 2 ] ];
 
-								v1 = customAttribute.value[ face.a ];
-								v2 = customAttribute.value[ face.b ];
-								v3 = customAttribute.value[ face.c ];
-								v4 = customAttribute.value[ face.d ];
+							customAttribute.array[ offset_custom + 9  ] = v4[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 10 ] = v4[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 11 ] = v4[ pp[ 2 ] ];
 
-							} else if ( customAttribute.boundTo === "faces" ) {
+							offset_custom += 12;
+							offset_customSrc += 1;
 
-								value = customAttribute.value[ offset_customSrc ];
+						}
 
-								v1 = value;
-								v2 = value;
-								v3 = value;
-								v4 = value;
+					} else if ( customAttribute.boundTo === "faces" ) {
 
-								customAttribute.offsetSrc ++;
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
 
-							} else if ( customAttribute.boundTo === "faceVertices" ) {
+							value = customAttribute.value[ offset_customSrc ];
 
-								v1 = customAttribute.value[ offset_customSrc ];
-								v2 = customAttribute.value[ offset_customSrc + 1 ];
-								v3 = customAttribute.value[ offset_customSrc + 2 ];
-								v4 = customAttribute.value[ offset_customSrc + 3 ];
+							v1 = value;
+							v2 = value;
+							v3 = value;
 
-								customAttribute.offsetSrc += 4;
+							customAttribute.array[ offset_custom ] 	   = v1[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ];
 
-							}
+							customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ];
 
+							customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ];
 
-							if ( customAttribute.size === 2 ) {
+							offset_custom += 9;
+							offset_customSrc += 1;
 
-								customAttribute.array[ offset_custom ] 	   = v1.x;
-								customAttribute.array[ offset_custom + 1 ] = v1.y;
+						}
 
-								customAttribute.array[ offset_custom + 2 ] = v2.x;
-								customAttribute.array[ offset_custom + 3 ] = v2.y;
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
 
-								customAttribute.array[ offset_custom + 4 ] = v3.x;
-								customAttribute.array[ offset_custom + 5 ] = v3.y;
+							value = customAttribute.value[ offset_customSrc ];
 
-								customAttribute.array[ offset_custom + 6 ] = v4.x;
-								customAttribute.array[ offset_custom + 7 ] = v4.y;
+							v1 = value;
+							v2 = value;
+							v3 = value;
+							v4 = value;
 
-								customAttribute.offset += 8;
+							customAttribute.array[ offset_custom  ] 	= v1[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 1  ] = v1[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 2  ] = v1[ pp[ 2 ] ];
 
-							} else if ( customAttribute.size === 3 ) {
+							customAttribute.array[ offset_custom + 3  ] = v2[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 4  ] = v2[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 5  ] = v2[ pp[ 2 ] ];
 
-								if ( customAttribute.type === "c" ) {
+							customAttribute.array[ offset_custom + 6  ] = v3[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 7  ] = v3[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 8  ] = v3[ pp[ 2 ] ];
 
-									customAttribute.array[ offset_custom  ] 	= v1.r;
-									customAttribute.array[ offset_custom + 1  ] = v1.g;
-									customAttribute.array[ offset_custom + 2  ] = v1.b;
+							customAttribute.array[ offset_custom + 9  ] = v4[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 10 ] = v4[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 11 ] = v4[ pp[ 2 ] ];
 
-									customAttribute.array[ offset_custom + 3  ] = v2.r;
-									customAttribute.array[ offset_custom + 4  ] = v2.g;
-									customAttribute.array[ offset_custom + 5  ] = v2.b;
+							offset_custom += 12;
+							offset_customSrc += 1;
 
-									customAttribute.array[ offset_custom + 6  ] = v3.r;
-									customAttribute.array[ offset_custom + 7  ] = v3.g;
-									customAttribute.array[ offset_custom + 8  ] = v3.b;
+						}
 
-									customAttribute.array[ offset_custom + 9  ] = v4.r;
-									customAttribute.array[ offset_custom + 10 ] = v4.g;
-									customAttribute.array[ offset_custom + 11 ] = v4.b;
+					} else if ( customAttribute.boundTo === "faceVertices" ) {
 
-								} else {
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
 
-									customAttribute.array[ offset_custom  ] 	= v1.x;
-									customAttribute.array[ offset_custom + 1  ] = v1.y;
-									customAttribute.array[ offset_custom + 2  ] = v1.z;
+							v1 = customAttribute.value[ offset_customSrc ];
+							v2 = customAttribute.value[ offset_customSrc + 1 ];
+							v3 = customAttribute.value[ offset_customSrc + 2 ];
 
-									customAttribute.array[ offset_custom + 3  ] = v2.x;
-									customAttribute.array[ offset_custom + 4  ] = v2.y;
-									customAttribute.array[ offset_custom + 5  ] = v2.z;
+							customAttribute.array[ offset_custom ] 	   = v1[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 1 ] = v1[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 2 ] = v1[ pp[ 2 ] ];
 
-									customAttribute.array[ offset_custom + 6  ] = v3.x;
-									customAttribute.array[ offset_custom + 7  ] = v3.y;
-									customAttribute.array[ offset_custom + 8  ] = v3.z;
+							customAttribute.array[ offset_custom + 3 ] = v2[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 4 ] = v2[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 5 ] = v2[ pp[ 2 ] ];
 
-									customAttribute.array[ offset_custom + 9  ] = v4.x;
-									customAttribute.array[ offset_custom + 10 ] = v4.y;
-									customAttribute.array[ offset_custom + 11 ] = v4.z;
+							customAttribute.array[ offset_custom + 6 ] = v3[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 7 ] = v3[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 8 ] = v3[ pp[ 2 ] ];
 
-								}
+							offset_custom += 9;
+							offset_customSrc += 3;
 
-								customAttribute.offset += 12;
+						}
 
-							} else {
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
 
-								customAttribute.array[ offset_custom  ] 	= v1.x;
-								customAttribute.array[ offset_custom + 1  ] = v1.y;
-								customAttribute.array[ offset_custom + 2  ] = v1.z;
-								customAttribute.array[ offset_custom + 3  ] = v1.w;
+							v1 = customAttribute.value[ offset_customSrc ];
+							v2 = customAttribute.value[ offset_customSrc + 1 ];
+							v3 = customAttribute.value[ offset_customSrc + 2 ];
+							v4 = customAttribute.value[ offset_customSrc + 3 ];
 
-								customAttribute.array[ offset_custom + 4  ] = v2.x;
-								customAttribute.array[ offset_custom + 5  ] = v2.y;
-								customAttribute.array[ offset_custom + 6  ] = v2.z;
-								customAttribute.array[ offset_custom + 7  ] = v2.w;
+							customAttribute.array[ offset_custom  ] 	= v1[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 1  ] = v1[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 2  ] = v1[ pp[ 2 ] ];
 
-								customAttribute.array[ offset_custom + 8  ] = v3.x;
-								customAttribute.array[ offset_custom + 9  ] = v3.y;
-								customAttribute.array[ offset_custom + 10 ] = v3.z;
-								customAttribute.array[ offset_custom + 11 ] = v3.w;
+							customAttribute.array[ offset_custom + 3  ] = v2[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 4  ] = v2[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 5  ] = v2[ pp[ 2 ] ];
 
-								customAttribute.array[ offset_custom + 12 ] = v4.x;
-								customAttribute.array[ offset_custom + 13 ] = v4.y;
-								customAttribute.array[ offset_custom + 14 ] = v4.z;
-								customAttribute.array[ offset_custom + 15 ] = v4.w;
+							customAttribute.array[ offset_custom + 6  ] = v3[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 7  ] = v3[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 8  ] = v3[ pp[ 2 ] ];
 
-								customAttribute.offset += 16;
+							customAttribute.array[ offset_custom + 9  ] = v4[ pp[ 0 ] ];
+							customAttribute.array[ offset_custom + 10 ] = v4[ pp[ 1 ] ];
+							customAttribute.array[ offset_custom + 11 ] = v4[ pp[ 2 ] ];
 
-							}
+							offset_custom += 12;
+							offset_customSrc += 4;
 
 						}
 
 					}
 
-				}
+				} else if ( customAttribute.size === 4 ) {
 
-			}
+					if ( customAttribute.boundTo === undefined || customAttribute.boundTo === "vertices" ) {
 
-			for ( i = 0, il = customAttributes.length; i < il; i ++ ) {
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
 
-				customAttribute = customAttributes[ i ];
+							face = obj_faces[ chunk_faces3[ f ]	];
 
-				if ( customAttribute.__original.needsUpdate ) {
+							v1 = customAttribute.value[ face.a ];
+							v2 = customAttribute.value[ face.b ];
+							v3 = customAttribute.value[ face.c ];
 
-					_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );
-					_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );
+							customAttribute.array[ offset_custom  ] 	= v1.x;
+							customAttribute.array[ offset_custom + 1  ] = v1.y;
+							customAttribute.array[ offset_custom + 2  ] = v1.z;
+							customAttribute.array[ offset_custom + 3  ] = v1.w;
+
+							customAttribute.array[ offset_custom + 4  ] = v2.x;
+							customAttribute.array[ offset_custom + 5  ] = v2.y;
+							customAttribute.array[ offset_custom + 6  ] = v2.z;
+							customAttribute.array[ offset_custom + 7  ] = v2.w;
+
+							customAttribute.array[ offset_custom + 8  ] = v3.x;
+							customAttribute.array[ offset_custom + 9  ] = v3.y;
+							customAttribute.array[ offset_custom + 10 ] = v3.z;
+							customAttribute.array[ offset_custom + 11 ] = v3.w;
+
+							offset_custom += 12;
+
+						}
+
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
+
+							face = obj_faces[ chunk_faces4[ f ] ];
+
+							v1 = customAttribute.value[ face.a ];
+							v2 = customAttribute.value[ face.b ];
+							v3 = customAttribute.value[ face.c ];
+							v4 = customAttribute.value[ face.d ];
+
+							customAttribute.array[ offset_custom  ] 	= v1.x;
+							customAttribute.array[ offset_custom + 1  ] = v1.y;
+							customAttribute.array[ offset_custom + 2  ] = v1.z;
+							customAttribute.array[ offset_custom + 3  ] = v1.w;
+
+							customAttribute.array[ offset_custom + 4  ] = v2.x;
+							customAttribute.array[ offset_custom + 5  ] = v2.y;
+							customAttribute.array[ offset_custom + 6  ] = v2.z;
+							customAttribute.array[ offset_custom + 7  ] = v2.w;
+
+							customAttribute.array[ offset_custom + 8  ] = v3.x;
+							customAttribute.array[ offset_custom + 9  ] = v3.y;
+							customAttribute.array[ offset_custom + 10 ] = v3.z;
+							customAttribute.array[ offset_custom + 11 ] = v3.w;
+
+							customAttribute.array[ offset_custom + 12 ] = v4.x;
+							customAttribute.array[ offset_custom + 13 ] = v4.y;
+							customAttribute.array[ offset_custom + 14 ] = v4.z;
+							customAttribute.array[ offset_custom + 15 ] = v4.w;
+
+							offset_custom += 16;
+
+						}
+
+					} else if ( customAttribute.boundTo === "faces" ) {
+
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
+
+							value = customAttribute.value[ offset_customSrc ];
+
+							v1 = value;
+							v2 = value;
+							v3 = value;
+
+							customAttribute.array[ offset_custom  ] 	= v1.x;
+							customAttribute.array[ offset_custom + 1  ] = v1.y;
+							customAttribute.array[ offset_custom + 2  ] = v1.z;
+							customAttribute.array[ offset_custom + 3  ] = v1.w;
+
+							customAttribute.array[ offset_custom + 4  ] = v2.x;
+							customAttribute.array[ offset_custom + 5  ] = v2.y;
+							customAttribute.array[ offset_custom + 6  ] = v2.z;
+							customAttribute.array[ offset_custom + 7  ] = v2.w;
+
+							customAttribute.array[ offset_custom + 8  ] = v3.x;
+							customAttribute.array[ offset_custom + 9  ] = v3.y;
+							customAttribute.array[ offset_custom + 10 ] = v3.z;
+							customAttribute.array[ offset_custom + 11 ] = v3.w;
+
+							offset_custom += 12;
+							offset_customSrc += 1;
+
+						}
+
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
+
+							value = customAttribute.value[ offset_customSrc ];
+
+							v1 = value;
+							v2 = value;
+							v3 = value;
+							v4 = value;
+
+							customAttribute.array[ offset_custom  ] 	= v1.x;
+							customAttribute.array[ offset_custom + 1  ] = v1.y;
+							customAttribute.array[ offset_custom + 2  ] = v1.z;
+							customAttribute.array[ offset_custom + 3  ] = v1.w;
+
+							customAttribute.array[ offset_custom + 4  ] = v2.x;
+							customAttribute.array[ offset_custom + 5  ] = v2.y;
+							customAttribute.array[ offset_custom + 6  ] = v2.z;
+							customAttribute.array[ offset_custom + 7  ] = v2.w;
+
+							customAttribute.array[ offset_custom + 8  ] = v3.x;
+							customAttribute.array[ offset_custom + 9  ] = v3.y;
+							customAttribute.array[ offset_custom + 10 ] = v3.z;
+							customAttribute.array[ offset_custom + 11 ] = v3.w;
+
+							customAttribute.array[ offset_custom + 12 ] = v4.x;
+							customAttribute.array[ offset_custom + 13 ] = v4.y;
+							customAttribute.array[ offset_custom + 14 ] = v4.z;
+							customAttribute.array[ offset_custom + 15 ] = v4.w;
+
+							offset_custom += 16;
+							offset_customSrc += 1;
+
+						}
+
+					} else if ( customAttribute.boundTo === "faceVertices" ) {
+
+						for ( f = 0, fl = chunk_faces3.length; f < fl; f ++ ) {
+
+							v1 = customAttribute.value[ offset_customSrc ];
+							v2 = customAttribute.value[ offset_customSrc + 1 ];
+							v3 = customAttribute.value[ offset_customSrc + 2 ];
+
+							customAttribute.array[ offset_custom  ] 	= v1.x;
+							customAttribute.array[ offset_custom + 1  ] = v1.y;
+							customAttribute.array[ offset_custom + 2  ] = v1.z;
+							customAttribute.array[ offset_custom + 3  ] = v1.w;
+
+							customAttribute.array[ offset_custom + 4  ] = v2.x;
+							customAttribute.array[ offset_custom + 5  ] = v2.y;
+							customAttribute.array[ offset_custom + 6  ] = v2.z;
+							customAttribute.array[ offset_custom + 7  ] = v2.w;
+
+							customAttribute.array[ offset_custom + 8  ] = v3.x;
+							customAttribute.array[ offset_custom + 9  ] = v3.y;
+							customAttribute.array[ offset_custom + 10 ] = v3.z;
+							customAttribute.array[ offset_custom + 11 ] = v3.w;
+
+							offset_custom += 12;
+							offset_customSrc += 3;
+
+						}
+
+						for ( f = 0, fl = chunk_faces4.length; f < fl; f ++ ) {
+
+							v1 = customAttribute.value[ offset_customSrc ];
+							v2 = customAttribute.value[ offset_customSrc + 1 ];
+							v3 = customAttribute.value[ offset_customSrc + 2 ];
+							v4 = customAttribute.value[ offset_customSrc + 3 ];
+
+							customAttribute.array[ offset_custom  ] 	= v1.x;
+							customAttribute.array[ offset_custom + 1  ] = v1.y;
+							customAttribute.array[ offset_custom + 2  ] = v1.z;
+							customAttribute.array[ offset_custom + 3  ] = v1.w;
+
+							customAttribute.array[ offset_custom + 4  ] = v2.x;
+							customAttribute.array[ offset_custom + 5  ] = v2.y;
+							customAttribute.array[ offset_custom + 6  ] = v2.z;
+							customAttribute.array[ offset_custom + 7  ] = v2.w;
+
+							customAttribute.array[ offset_custom + 8  ] = v3.x;
+							customAttribute.array[ offset_custom + 9  ] = v3.y;
+							customAttribute.array[ offset_custom + 10 ] = v3.z;
+							customAttribute.array[ offset_custom + 11 ] = v3.w;
+
+							customAttribute.array[ offset_custom + 12 ] = v4.x;
+							customAttribute.array[ offset_custom + 13 ] = v4.y;
+							customAttribute.array[ offset_custom + 14 ] = v4.z;
+							customAttribute.array[ offset_custom + 15 ] = v4.w;
+
+							offset_custom += 16;
+							offset_customSrc += 4;
+
+						}
+
+					}
 
 				}
 
+				_gl.bindBuffer( _gl.ARRAY_BUFFER, customAttribute.buffer );
+				_gl.bufferData( _gl.ARRAY_BUFFER, customAttribute.array, hint );
+
 			}
 
 		}