Pārlūkot izejas kodu

Refactored custom attributes setting for lines.

Also here moved ifs out of the inner loop.

Starts to get hard to measure performance impact - baseline JavaScript stuff just to produce some change gets very costly. Simply calling Math.random() hundreds thousands times causes massive garbage collection :S.
alteredq 13 gadi atpakaļ
vecāks
revīzija
363ce622b0
3 mainītis faili ar 347 papildinājumiem un 323 dzēšanām
  1. 217 216
      build/Three.js
  2. 84 84
      build/custom/ThreeWebGL.js
  3. 46 23
      src/renderers/WebGLRenderer.js

+ 217 - 216
build/Three.js

@@ -17,8 +17,8 @@ c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this
 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};
 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,u){e.copy(u).subSelf(b);
 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);h.copy(a).subSelf(b);f=e.dot(e);k=e.dot(l);n=e.dot(h);t=l.dot(l);v=l.dot(h);p=1/(f*t-k*k);x=(t*n-k*v)*p;w=(f*v-k*n)*p;return x>=0&&w>=0&&x+w<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Vector3,f,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,
 l.copy(c).subSelf(b);h.copy(a).subSelf(b);f=e.dot(e);k=e.dot(l);n=e.dot(h);t=l.dot(l);v=l.dot(h);p=1/(f*t-k*k);x=(t*n-k*v)*p;w=(f*v-k*n)*p;return x>=0&&w>=0&&x+w<1}for(var e=new THREE.Vector3,l=new THREE.Vector3,h=new THREE.Vector3,f,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 E,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,E=L.multiplyVector3(z.centroid.clone()).subSelf(O),D=E.dot(K),
-!(D<=0)&&(E=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(E,O))/D,O=O.addSelf(K.multiplyScalar(D)),z instanceof THREE.Face3)b(O,E,C,H)&&(z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},
+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 E,C,H,L,R,D,O,J,N=a.geometry,K=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(),J=this.direction.clone(),L=a.matrixWorld,E=L.multiplyVector3(z.centroid.clone()).subSelf(O),D=E.dot(J),
+!(D<=0)&&(E=L.multiplyVector3(K[z.a].position.clone()),C=L.multiplyVector3(K[z.b].position.clone()),H=L.multiplyVector3(K[z.c].position.clone()),L=z instanceof THREE.Face4?L.multiplyVector3(K[z.d].position.clone()):null,R=a.matrixRotationWorld.multiplyVector3(z.normal.clone()),D=J.dot(R),a.doubleSided||(a.flipSided?D>0:D<0)))if(D=R.dot((new THREE.Vector3).sub(E,O))/D,O=O.addSelf(J.multiplyScalar(D)),z instanceof THREE.Face3)b(O,E,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,E,C,L)||b(O,C,H,L)))z={distance:this.origin.distanceTo(O),point:O,face:z,object:a},u.push(z)}return u}};
 u.push(z));else if(z instanceof THREE.Face4&&(b(O,E,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(){h=e-c;f=l-b}var c,b,e,l,h,f,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(h,f,v,p){k=!1;c=h;b=f;e=v;l=p;a()};this.addPoint=function(h,f){k?(k=!1,c=h,b=f,e=h,l=f):(c=c<h?c:h,b=b<f?b:f,e=e>h?e:h,l=l>f?l:f);a()};this.add3Points=
 THREE.Rectangle=function(){function a(){h=e-c;f=l-b}var c,b,e,l,h,f,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return h};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return l};this.set=function(h,f,v,p){k=!1;c=h;b=f;e=v;l=p;a()};this.addPoint=function(h,f){k?(k=!1,c=h,b=f,e=h,l=f):(c=c<h?c:h,b=b<f?b:f,e=e>h?e:h,l=l>f?l:f);a()};this.add3Points=
 function(h,f,v,p,x,w){k?(k=!1,c=h<v?h<x?h:x:v<x?v:x,b=f<p?f<w?f:w:p<w?p:w,e=h>v?h>x?h:x:v>x?v:x,l=f>p?f>w?f:w:p>w?p:w):(c=h<v?h<x?h<c?h:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c,b=f<p?f<w?f<b?f:b:w<b?w:b:p<w?p<b?p:b:w<b?w:b,e=h>v?h>x?h>e?h:e:x>e?x:e:v>x?v>e?v:e:x>e?x:e,l=f>p?f>w?f>l?f:l:w>l?w:l:p>w?p>l?p:l:w>l?w:l);a()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),b=h.getTop(),e=h.getRight(),l=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),b=b<h.getTop()?b:h.getTop(),e=e>h.getRight()?e:h.getRight(),l=l>
 function(h,f,v,p,x,w){k?(k=!1,c=h<v?h<x?h:x:v<x?v:x,b=f<p?f<w?f:w:p<w?p:w,e=h>v?h>x?h:x:v>x?v:x,l=f>p?f>w?f:w:p>w?p:w):(c=h<v?h<x?h<c?h:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c,b=f<p?f<w?f<b?f:b:w<b?w:b:p<w?p<b?p:b:w<b?w:b,e=h>v?h>x?h>e?h:e:x>e?x:e:v>x?v>e?v:e:x>e?x:e,l=f>p?f>w?f>l?f:l:w>l?w:l:p>w?p>l?p:l:w>l?w:l);a()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),b=h.getTop(),e=h.getRight(),l=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),b=b<h.getTop()?b:h.getTop(),e=e>h.getRight()?e:h.getRight(),l=l>
@@ -28,16 +28,16 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=
 THREE.Matrix4=function(a,c,b,e,l,h,f,k,n,t,v,p,x,w,z,u){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,h!==void 0?h:1,f||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=function(a,c,b,e,l,h,f,k,n,t,v,p,x,w,z,u){this.set(a!==void 0?a:1,c||0,b||0,e||0,l||0,h!==void 0?h:1,f||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,h,f,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=h;this.n23=f;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,
 THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,e,l,h,f,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=h;this.n23=f;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,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;e.cross(b,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(b,h).normalize());l.cross(h,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=h.x;this.n21=e.y;this.n22=l.y;this.n23=h.y;this.n31=e.z;this.n32=l.z;this.n33=h.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,h=a.n14,f=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,
 c,b){var e=THREE.Matrix4.__v1,l=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;e.cross(b,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(b,h).normalize());l.cross(h,e).normalize();this.n11=e.x;this.n12=l.x;this.n13=h.x;this.n21=e.y;this.n22=l.y;this.n23=h.y;this.n31=e.z;this.n32=l.z;this.n33=h.z;return this},multiply:function(a,c){var b=a.n11,e=a.n12,l=a.n13,h=a.n14,f=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,E=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,Y=c.n42,U=c.n43,o=c.n44;this.n11=b*E+e*R+l*N+h*ja;this.n12=b*C+e*D+l*J+h*Y;this.n13=b*H+e*O+l*M+h*U;this.n14=b*L+e*K+l*ea+h*o;this.n21=f*E+k*R+n*N+t*ja;this.n22=f*C+k*D+n*J+t*Y;this.n23=f*H+k*O+n*M+t*U;this.n24=f*L+k*K+n*ea+t*o;this.n31=v*E+p*R+x*N+w*ja;this.n32=v*C+p*D+x*J+w*Y;this.n33=v*H+p*O+x*M+w*U;this.n34=v*L+p*K+x*ea+w*o;this.n41=z*E+u*R+B*N+y*ja;this.n42=z*C+u*D+B*J+y*Y;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,h=this.n22,f=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*f*t*x-b*k*t*x-e*h*v*x+c*k*v*x+b*h*p*x-c*f*p*x-e*f*n*w+b*k*n*w+e*l*v*w-a*k*v*w-b*l*p*w+a*f*p*w+e*h*n*z-c*k*n*z-e*l*t*z+a*k*t*z+c*l*p*z-a*h*p*z-b*h*n*u+c*f*n*u+b*l*t*u-a*f*t*u-
-c*l*v*u+a*h*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,h=a.x,f=a.y,k=a.z,n=l*h,t=l*f;this.set(n*h+b,n*f-e*k,n*k+e*f,0,n*f+e*k,t*f+b,t*k-e*h,0,n*k-e*f,t*k+e*h,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,
+y=a.n44,E=c.n11,C=c.n12,H=c.n13,L=c.n14,R=c.n21,D=c.n22,O=c.n23,J=c.n24,N=c.n31,K=c.n32,M=c.n33,Y=c.n34,oa=c.n41,Z=c.n42,U=c.n43,o=c.n44;this.n11=b*E+e*R+l*N+h*oa;this.n12=b*C+e*D+l*K+h*Z;this.n13=b*H+e*O+l*M+h*U;this.n14=b*L+e*J+l*Y+h*o;this.n21=f*E+k*R+n*N+t*oa;this.n22=f*C+k*D+n*K+t*Z;this.n23=f*H+k*O+n*M+t*U;this.n24=f*L+k*J+n*Y+t*o;this.n31=v*E+p*R+x*N+w*oa;this.n32=v*C+p*D+x*K+w*Z;this.n33=v*H+p*O+x*M+w*U;this.n34=v*L+p*J+x*Y+w*o;this.n41=z*E+u*R+B*N+y*oa;this.n42=z*C+u*D+B*K+y*Z;this.n43=z*
+H+u*O+B*M+y*U;this.n44=z*L+u*J+B*Y+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,h=this.n22,f=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*f*t*x-b*k*t*x-e*h*v*x+c*k*v*x+b*h*p*x-c*f*p*x-e*f*n*w+b*k*n*w+e*l*v*w-a*k*v*w-b*l*p*w+a*f*p*w+e*h*n*z-c*k*n*z-e*l*t*z+a*k*t*z+c*l*p*z-a*h*p*z-b*h*n*u+c*f*n*u+b*l*t*u-a*f*t*u-c*l*v*u+a*h*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,h=a.x,f=a.y,k=a.z,n=l*h,t=l*f;this.set(n*h+b,n*f-e*k,n*k+e*f,0,n*f+e*k,t*f+b,t*k-e*h,0,n*k-e*f,t*k+e*h,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,h=a.n21,f=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-f*x*u-k*v*B+f*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*f*u-b*n*u-e*f*B+b*k*B;this.n14=l*k*v-e*n*v-l*f*p+b*n*p+e*f*x-b*k*x;this.n21=n*p*w-k*x*w-n*t*u+h*x*u+k*t*B-h*p*B;this.n22=e*x*w-l*p*w+
 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,h=a.n21,f=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-f*x*u-k*v*B+f*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*f*u-b*n*u-e*f*B+b*k*B;this.n14=l*k*v-e*n*v-l*f*p+b*n*p+e*f*x-b*k*x;this.n21=n*p*w-k*x*w-n*t*u+h*x*u+k*t*B-h*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*h*u+c*n*u+e*h*B-c*k*B;this.n24=e*n*t-l*k*t+l*h*p-c*n*p-e*h*x+c*k*x;this.n31=f*x*w-n*v*w+n*t*z-h*x*z-f*t*B+h*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*f*w+l*h*z-c*n*z-b*h*B+c*f*B;this.n34=l*f*t-b*n*t-l*h*v+c*n*v+b*h*x-c*f*x;this.n41=k*v*w-f*p*w-k*t*z+h*p*z+f*t*u-h*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*f*w-b*k*w-e*h*z+c*k*z+b*h*u-c*f*u;this.n44=b*k*t-e*f*t+e*h*v-c*k*v-b*h*p+c*f*p;this.multiplyScalar(1/a.determinant());
 l*t*u-c*x*u-e*t*B+c*p*B;this.n23=l*k*w-e*n*w-l*h*u+c*n*u+e*h*B-c*k*B;this.n24=e*n*t-l*k*t+l*h*p-c*n*p-e*h*x+c*k*x;this.n31=f*x*w-n*v*w+n*t*z-h*x*z-f*t*B+h*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*f*w+l*h*z-c*n*z-b*h*B+c*f*B;this.n34=l*f*t-b*n*t-l*h*v+c*n*v+b*h*x-c*f*x;this.n41=k*v*w-f*p*w-k*t*z+h*p*z+f*t*u-h*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*f*w-b*k*w-e*h*z+c*k*z+b*h*u-c*f*u;this.n44=b*k*t-e*f*t+e*h*v-c*k*v-b*h*p+c*f*p;this.multiplyScalar(1/a.determinant());
 return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,h=Math.cos(b),b=Math.sin(b),f=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=f*k,t=f*l,v=e*k,p=e*l;this.n11=n+p*b;this.n12=v*b-t;this.n13=h*e;this.n21=h*l;this.n22=h*k;this.n23=-b;this.n31=t*b-v;this.n32=p+n*b;this.n33=h*f;break;case "ZXY":n=f*k;t=f*l;v=e*k;p=e*l;this.n11=n-p*b;this.n12=-h*l;this.n13=v+t*b;this.n21=t+v*b;this.n22=h*k;this.n23=p-n*b;this.n31=-h*e;this.n32=b;this.n33=h*f;break;case "ZYX":n=
 return this},setRotationFromEuler:function(a,c){var b=a.x,e=a.y,l=a.z,h=Math.cos(b),b=Math.sin(b),f=Math.cos(e),e=Math.sin(e),k=Math.cos(l),l=Math.sin(l);switch(c){case "YXZ":var n=f*k,t=f*l,v=e*k,p=e*l;this.n11=n+p*b;this.n12=v*b-t;this.n13=h*e;this.n21=h*l;this.n22=h*k;this.n23=-b;this.n31=t*b-v;this.n32=p+n*b;this.n33=h*f;break;case "ZXY":n=f*k;t=f*l;v=e*k;p=e*l;this.n11=n-p*b;this.n12=-h*l;this.n13=v+t*b;this.n21=t+v*b;this.n22=h*k;this.n23=p-n*b;this.n31=-h*e;this.n32=b;this.n33=h*f;break;case "ZYX":n=
@@ -56,18 +56,18 @@ 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&&
 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;
 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=f[h]=f[h]||new THREE.RenderableObject;h++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,h=a.z+a.w,l=b.z+b.w,f=-a.z+a.w,k=-b.z+b.w;return h>=0&&l>=0&&f>=0&&k>=0?!0:h<0&&l<0||f<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,h,f=[],k,n,t=[],
 THREE.Projector=function(){function a(){var a=f[h]=f[h]||new THREE.RenderableObject;h++;return a}function c(){var a=t[n]=t[n]||new THREE.RenderableVertex;n++;return a}function b(a,b){return b.z-a.z}function e(a,b){var c=0,e=1,h=a.z+a.w,l=b.z+b.w,f=-a.z+a.w,k=-b.z+b.w;return h>=0&&l>=0&&f>=0&&k>=0?!0:h<0&&l<0||f<0&&k<0?!1:(h<0?c=Math.max(c,h/(h-l)):l<0&&(e=Math.min(e,h/(h-l))),f<0?c=Math.max(c,f/(f-k)):k<0&&(e=Math.min(e,f/(f-k))),e<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-e),!0))}var l,h,f=[],k,n,t=[],
-v,p,x=[],w,z=[],u,B,y=[],E,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+
+v,p,x=[],w,z=[],u,B,y=[],E,C,H=[],L={objects:[],sprites:[],lights:[],elements:[]},R=new THREE.Vector3,D=new THREE.Vector4,O=new THREE.Matrix4,J=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=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);
 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){h=0;L.objects.length=0;L.sprites.length=0;L.lights.length=0;var f=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,
 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){h=0;L.objects.length=0;L.sprites.length=0;L.lights.length=0;var f=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,
 h=-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<=h){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++)f(b.children[c])}};f(c);e&&
 h=-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<=h){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++)f(b.children[c])}};f(c);e&&
-L.objects.sort(b);return L};this.projectScene=function(a,h,l){var f=h.near,o=h.far,R,N,G,W,$,na,la,ra,ia,da,S,fa,ha,I,Q,ka;C=B=w=p=0;L.elements.length=0;h.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(h));a.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);O.multiply(h.projectionMatrix,h.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;W=S.vertices;I=S.faces;Q=S.faceVertexUvs;S=ia.matrixRotationWorld.extractRotation(da);N=0;for(G=W.length;N<G;N++)k=c(),k.positionWorld.copy(W[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>f&&k.positionScreen.z<o;W=0;for(N=I.length;W<
-N;W++){G=I[W];if(G instanceof THREE.Face3)if($=t[G.a],na=t[G.b],la=t[G.c],$.visible&&na.visible&&la.visible&&(ia.doubleSided||ia.flipSided!=(la.positionScreen.x-$.positionScreen.x)*(na.positionScreen.y-$.positionScreen.y)-(la.positionScreen.y-$.positionScreen.y)*(na.positionScreen.x-$.positionScreen.x)<0))ra=x[p]=x[p]||new THREE.RenderableFace3,p++,v=ra,v.v1.copy($),v.v2.copy(na),v.v3.copy(la);else continue;else if(G instanceof THREE.Face4)if($=t[G.a],na=t[G.b],la=t[G.c],ra=t[G.d],$.visible&&na.visible&&
-la.visible&&ra.visible&&(ia.doubleSided||ia.flipSided!=((ra.positionScreen.x-$.positionScreen.x)*(na.positionScreen.y-$.positionScreen.y)-(ra.positionScreen.y-$.positionScreen.y)*(na.positionScreen.x-$.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($),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;$=0;for(na=la.length;$<na;$++)ra=v.vertexNormalsWorld[$],ra.copy(la[$]),S.multiplyVector3(ra);$=0;for(na=Q.length;$<na;$++)if(ka=Q[$][W]){la=0;for(ra=ka.length;la<ra;la++)v.uvs[$][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);W=ia.geometry.vertices;$=c();$.positionScreen.copy(W[0].position);K.multiplyVector4($.positionScreen);N=1;for(G=W.length;N<G;N++)if($=c(),$.positionScreen.copy(W[N].position),K.multiplyVector4($.positionScreen),na=t[n-2],J.copy($.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))f=H[C]=H[C]||new THREE.RenderableParticle,C++,E=f,E.x=D.x/D.w,E.y=D.y/D.w,E.z=D.z,E.rotation=ia.rotation.z,E.scale.x=ia.scale.x*Math.abs(E.x-(D.x+h.projectionMatrix.n11)/(D.w+h.projectionMatrix.n14)),E.scale.y=ia.scale.y*Math.abs(E.y-(D.y+h.projectionMatrix.n22)/
-(D.w+h.projectionMatrix.n24)),E.material=ia.material,L.elements.push(E);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)};
+L.objects.sort(b);return L};this.projectScene=function(a,h,l){var f=h.near,o=h.far,R,N,G,W,$,la,ja,sa,T,ea,ga,na,ia,I,Q,ha;C=B=w=p=0;L.elements.length=0;h.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(h));a.updateMatrixWorld();h.matrixWorldInverse.getInverse(h.matrixWorld);O.multiply(h.projectionMatrix,h.matrixWorldInverse);this.computeFrustum(O);L=this.projectGraph(a,!1);a=0;for(R=L.objects.length;a<R;a++)if(T=L.objects[a].object,ea=T.matrixWorld,
+na=T.material,n=0,T instanceof THREE.Mesh){ga=T.geometry;ia=T.geometry.materials;W=ga.vertices;I=ga.faces;Q=ga.faceVertexUvs;ga=T.matrixRotationWorld.extractRotation(ea);N=0;for(G=W.length;N<G;N++)k=c(),k.positionWorld.copy(W[N].position),ea.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>f&&k.positionScreen.z<o;W=0;for(N=I.length;W<
+N;W++){G=I[W];if(G instanceof THREE.Face3)if($=t[G.a],la=t[G.b],ja=t[G.c],$.visible&&la.visible&&ja.visible&&(T.doubleSided||T.flipSided!=(ja.positionScreen.x-$.positionScreen.x)*(la.positionScreen.y-$.positionScreen.y)-(ja.positionScreen.y-$.positionScreen.y)*(la.positionScreen.x-$.positionScreen.x)<0))sa=x[p]=x[p]||new THREE.RenderableFace3,p++,v=sa,v.v1.copy($),v.v2.copy(la),v.v3.copy(ja);else continue;else if(G instanceof THREE.Face4)if($=t[G.a],la=t[G.b],ja=t[G.c],sa=t[G.d],$.visible&&la.visible&&
+ja.visible&&sa.visible&&(T.doubleSided||T.flipSided!=((sa.positionScreen.x-$.positionScreen.x)*(la.positionScreen.y-$.positionScreen.y)-(sa.positionScreen.y-$.positionScreen.y)*(la.positionScreen.x-$.positionScreen.x)<0||(la.positionScreen.x-ja.positionScreen.x)*(sa.positionScreen.y-ja.positionScreen.y)-(la.positionScreen.y-ja.positionScreen.y)*(sa.positionScreen.x-ja.positionScreen.x)<0)))ha=z[w]=z[w]||new THREE.RenderableFace4,w++,v=ha,v.v1.copy($),v.v2.copy(la),v.v3.copy(ja),v.v4.copy(sa);else continue;
+v.normalWorld.copy(G.normal);ga.multiplyVector3(v.normalWorld);v.centroidWorld.copy(G.centroid);ea.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);O.multiplyVector3(v.centroidScreen);ja=G.vertexNormals;$=0;for(la=ja.length;$<la;$++)sa=v.vertexNormalsWorld[$],sa.copy(ja[$]),ga.multiplyVector3(sa);$=0;for(la=Q.length;$<la;$++)if(ha=Q[$][W]){ja=0;for(sa=ha.length;ja<sa;ja++)v.uvs[$][ja]=ha[ja]}v.material=na;v.faceMaterial=G.materialIndex!==null?ia[G.materialIndex]:null;v.z=v.centroidScreen.z;
+L.elements.push(v)}}else if(T instanceof THREE.Line){J.multiply(O,ea);W=T.geometry.vertices;$=c();$.positionScreen.copy(W[0].position);J.multiplyVector4($.positionScreen);N=1;for(G=W.length;N<G;N++)if($=c(),$.positionScreen.copy(W[N].position),J.multiplyVector4($.positionScreen),la=t[n-2],K.copy($.positionScreen),M.copy(la.positionScreen),e(K,M))K.multiplyScalar(1/K.w),M.multiplyScalar(1/M.w),T=y[B]=y[B]||new THREE.RenderableLine,B++,u=T,u.v1.positionScreen.copy(K),u.v2.positionScreen.copy(M),u.z=
+Math.max(K.z,M.z),u.material=na,L.elements.push(u)}a=0;for(R=L.sprites.length;a<R;a++)if(T=L.sprites[a].object,ea=T.matrixWorld,T instanceof THREE.Particle&&(D.set(ea.n14,ea.n24,ea.n34,1),O.multiplyVector4(D),D.z/=D.w,D.z>0&&D.z<1))f=H[C]=H[C]||new THREE.RenderableParticle,C++,E=f,E.x=D.x/D.w,E.y=D.y/D.w,E.z=D.z,E.rotation=T.rotation.z,E.scale.x=T.scale.x*Math.abs(E.x-(D.x+h.projectionMatrix.n11)/(D.w+h.projectionMatrix.n14)),E.scale.y=T.scale.y*Math.abs(E.y-(D.y+h.projectionMatrix.n22)/(D.w+h.projectionMatrix.n24)),
+E.material=T.material,L.elements.push(E);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),h=Math.cos(b),b=Math.sin(b),f=a*c,k=e*l;this.w=f*h-k*b;this.x=f*b+k*h;this.y=e*c*h+a*l*b;this.z=a*l*h-e*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,e=Math.sin(b);
 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),h=Math.cos(b),b=Math.sin(b),f=a*c,k=e*l;this.w=f*h-k*b;this.x=f*b+k*h;this.y=e*c*h+a*l*b;this.z=a*l*h-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.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.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=
@@ -83,9 +83,9 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
 b,e,l,h,f,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e<l;e++){h=this.faces[e];if(a&&h.vertexNormals.length){k.set(0,0,0);c=0;for(b=h.vertexNormals.length;c<b;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],b=this.vertices[h.b],f=this.vertices[h.c],k.sub(f.position,b.position),n.sub(c.position,b.position),k.crossSelf(n);k.isZero()||k.normalize();h.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices===void 0){e=this.__tmpVertices=
 b,e,l,h,f,k=new THREE.Vector3,n=new THREE.Vector3;e=0;for(l=this.faces.length;e<l;e++){h=this.faces[e];if(a&&h.vertexNormals.length){k.set(0,0,0);c=0;for(b=h.vertexNormals.length;c<b;c++)k.addSelf(h.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[h.a],b=this.vertices[h.b],f=this.vertices[h.c],k.sub(f.position,b.position),n.sub(c.position,b.position),k.crossSelf(n);k.isZero()||k.normalize();h.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
 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]),
 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,h,l,U){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;v=f[h];p=f[l];x=f[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;E=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*E)*D);M.set((C*z-H*w)*D,(C*B-H*u)*D,(C*E-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,h,f,k,n,t,v,p,x,w,z,u,B,y,E,C,H,L,R,D,O,K=[],N=[],J=new THREE.Vector3,M=new THREE.Vector3,ea=new THREE.Vector3,ja=new THREE.Vector3,Y=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++)h=this.faces[c],f=this.faceVertexUvs[0][c],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var U=["a",
-"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)Y.copy(h.vertexNormals[e]),l=h[U[e]],O=K[l],ea.copy(O),ea.subSelf(Y.multiplyScalar(Y.dot(O))).normalize(),ja.cross(h.vertexNormals[e],O),l=ja.dot(N[l]),l=l<0?-1:1,h.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,h,l,U){k=a.vertices[b].position;n=a.vertices[c].position;t=a.vertices[e].position;v=f[h];p=f[l];x=f[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;E=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);K.set((R*w-L*z)*D,(R*u-L*B)*D,(R*y-L*E)*D);M.set((C*z-H*w)*D,(C*B-H*u)*D,(C*E-H*y)*D);J[b].addSelf(K);J[c].addSelf(K);J[e].addSelf(K);N[b].addSelf(M);
+N[c].addSelf(M);N[e].addSelf(M)}var c,b,e,l,h,f,k,n,t,v,p,x,w,z,u,B,y,E,C,H,L,R,D,O,J=[],N=[],K=new THREE.Vector3,M=new THREE.Vector3,Y=new THREE.Vector3,oa=new THREE.Vector3,Z=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)J[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)h=this.faces[c],f=this.faceVertexUvs[0][c],h instanceof THREE.Face3?a(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(a(this,h.a,h.b,h.c,0,1,2),a(this,h.a,h.b,h.d,0,1,3));var U=["a",
+"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)Z.copy(h.vertexNormals[e]),l=h[U[e]],O=J[l],Y.copy(O),Y.subSelf(Z.multiplyScalar(Z.dot(O))).normalize(),oa.cross(h.vertexNormals[e],O),l=oa.dot(N[l]),l=l<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(Y.x,Y.y,Y.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]=
 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),h,f;h=0;for(f=this.vertices.length;h<f;h++)e=this.vertices[h].position,e=[Math.round(e.x*l),Math.round(e.y*l),Math.round(e.z*l)].join("_"),a[e]===void 0?(a[e]=h,c.push(this.vertices[h]),
 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),h,f;h=0;for(f=this.vertices.length;h<f;h++)e=this.vertices[h].position,e=[Math.round(e.x*l),Math.round(e.y*l),Math.round(e.z*l)].join("_"),a[e]===void 0?(a[e]=h,c.push(this.vertices[h]),
 b[h]=c.length-1):b[h]=b[a[e]];h=0;for(f=this.faces.length;h<f;h++)if(a=this.faces[h],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;
 b[h]=c.length-1):b[h]=b[a[e]];h=0;for(f=this.faces.length;h<f;h++)if(a=this.faces[h],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;
@@ -151,44 +151,44 @@ THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var
 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.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,h;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;h=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*h+h;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.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,l,h;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;e=c;l=b/2;h=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*h+h;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(E!=a)u.globalAlpha=E=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 h=this,f,k,n,t=new THREE.Projector,a=a||{},v=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
 THREE.CanvasRenderer=function(a){function c(a){if(E!=a)u.globalAlpha=E=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 h=this,f,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,E=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,Y,U,o,P,pa,G,W,$,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,Z,ca=new THREE.Rectangle,V=new THREE.Rectangle,aa=new THREE.Rectangle,ga=!1,oa=new THREE.Color,ta=new THREE.Color,ua=new THREE.Color,X=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);E=1;C=0;O=D=
+p,x,w,z,u=v.getContext("2d"),B=new THREE.Color(0),y=0,E=1,C=0,H=null,L=null,R=null,D=null,O=null,J,N,K,M,Y=new THREE.RenderableVertex,oa=new THREE.RenderableVertex,Z,U,o,P,ra,G,W,$,la,ja,sa,T,ea=new THREE.Color,ga=new THREE.Color,na=new THREE.Color,ia=new THREE.Color,I=new THREE.Color,Q=[],ha,ka,ua,va,Ca,Ga,ya,Aa,Ja,X,ca=new THREE.Rectangle,V=new THREE.Rectangle,aa=new THREE.Rectangle,fa=!1,ma=new THREE.Color,wa=new THREE.Color,pa=new THREE.Color,qa=new THREE.Vector3,ta,Da,Ha,za,Ea,S,a=16;ta=document.createElement("canvas");
+ta.width=ta.height=2;Da=ta.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ha=Da.getImageData(0,0,2,2);za=Ha.data;Ea=document.createElement("canvas");Ea.width=Ea.height=a;S=Ea.getContext("2d");S.translate(-a/2,-a/2);S.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);E=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()),
 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,h;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],h=e.color,e instanceof THREE.AmbientLight?(oa.r+=h.r,oa.g+=h.g,oa.b+=h.b):e instanceof THREE.DirectionalLight?(ta.r+=h.r,ta.g+=h.g,ta.b+=h.b):e instanceof THREE.PointLight&&(ua.r+=h.r,ua.g+=h.g,ua.b+=h.b)}function x(a,b,c,e){var h,l,f,k,o,n;h=0;for(l=a.length;h<l;h++)f=a[h],k=f.color,
-f instanceof THREE.DirectionalLight?(o=f.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=f.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)):f instanceof THREE.PointLight&&(o=f.matrixWorld.getPosition(),n=c.dot(X.sub(o,b).normalize()),n<=0||(n*=f.distance==0?1:1-Math.min(b.distanceTo(o)/f.distance,1),n!=0&&(n*=f.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)))}function B(a,h,f){c(f.opacity);b(f.blending);var k,o,n,t,v,va;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)t=f.map.image,v=t.width>>1,va=t.height>>
-1,f=h.scale.x*w,n=h.scale.y*z,k=f*v,o=n*va,aa.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(aa)&&(u.save(),u.translate(a.x,a.y),u.rotate(-h.rotation),u.scale(f,-n),u.translate(-v,-va),u.drawImage(t,0,0),u.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*w,o=h.scale.y*z,aa.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(aa)&&(e(f.color.getContextStyle()),l(f.color.getContextStyle()),u.save(),u.translate(a.x,a.y),u.rotate(-h.rotation),u.scale(k,o),f.program(u),u.restore()))}function y(a,
-h,l,f){c(f.opacity);b(f.blending);u.beginPath();u.moveTo(a.positionScreen.x,a.positionScreen.y);u.lineTo(h.positionScreen.x,h.positionScreen.y);u.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(R!=a)u.lineWidth=R=a;a=f.linecap;if(D!=a)u.lineCap=D=a;a=f.linejoin;if(O!=a)u.lineJoin=O=a;e(f.color.getContextStyle());u.stroke();aa.inflate(f.linewidth*2)}}function Qa(a,e,f,l,k,t,w,p){h.info.render.vertices+=3;h.info.render.faces++;c(p.opacity);b(p.blending);Y=a.positionScreen.x;U=
-a.positionScreen.y;o=e.positionScreen.x;P=e.positionScreen.y;pa=f.positionScreen.x;G=f.positionScreen.y;Na(Y,U,o,P,pa,G);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(sa=w.uvs[0],Ra(Y,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,X.copy(w.vertexNormalsWorld[l]),qa=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,Ea=-(X.x*a.n21+X.y*a.n22+
-X.z*a.n23)*0.5+0.5,X.copy(w.vertexNormalsWorld[k]),ya=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,Aa=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,X.copy(w.vertexNormalsWorld[t]),Ja=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,Z=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,Ra(Y,U,o,P,pa,G,qa,Ea,ya,Aa,Ja,Z,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(Y,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(Y,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(f.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(Y,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 C(a,e,f,l,k,t,w,p,u){h.info.render.vertices+=4;h.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)Qa(a,e,l,0,1,3,w,p,u),Qa(k,f,t,1,2,3,w,p,u);else if(Y=a.positionScreen.x,U=a.positionScreen.y,
-o=e.positionScreen.x,P=e.positionScreen.y,pa=f.positionScreen.x,G=f.positionScreen.y,W=l.positionScreen.x,$=l.positionScreen.y,na=k.positionScreen.x,la=k.positionScreen.y,ra=t.positionScreen.x,ia=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)E(Y,U,o,P,pa,G,W,$),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(Y,U,o,P,W,$),L(Y,U,o,P,W,$,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)),E(Y,U,o,P,pa,G,W,$),p.wireframe?H(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Da(da)):(E(Y,U,o,P,pa,G,W,$),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),E(Y,U,o,P,pa,G,W,$),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(f.positionScreen.z,ka,ma),wa=Oa(S,fa,ha,I),Na(Y,U,o,P,W,$),L(Y,U,o,P,W,$,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,h,f){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(h,f);u.lineTo(a,b);u.closePath()}function E(a,
-b,c,e,h,f,l,k){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(h,f);u.lineTo(l,k);u.lineTo(a,b);u.closePath()}function H(a,b,c,h){if(R!=b)u.lineWidth=R=b;if(D!=c)u.lineCap=D=c;if(O!=h)u.lineJoin=O=h;e(a.getContextStyle());u.stroke();aa.inflate(b*2)}function Da(a){l(a.getContextStyle());u.fill()}function Ra(a,b,c,e,h,f,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,Z=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,k=(k+va)*Z,o=(o+x)*v,n=(n+va)*Z,p=(p+x)*v,t=(t+va)*Z,w=(w+x)*v;c-=a;e-=b;h-=a;f-=b;n-=k;p-=o;t-=k;w-=o;va=1/(n*w-t*p);v=(w*c-p*h)*va;p=(w*e-p*f)*va;c=(n*h-t*c)*va;e=(n*f-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,h,f,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;h-=a;f-=b;o-=l;n-=k;p-=l;t-=k;va=1/(o*t-p*n);v=(t*c-n*h)*va;n=(t*e-n*f)*va;c=(o*h-p*c)*va;e=(o*f-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 h=~~(a.r*255),f=~~(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]=h<0?0:h>255?255:h;xa[1]=f<0?
-0:f>255?255:f;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,h=c*c+e*e;h!=0&&(h=1/Math.sqrt(h),c*=h,e*=h,b.x+=
-c,b.y+=e,a.x-=c,a.y-=e)}var Pa,Sa,za,Ia;this.autoClear?this.clear():u.setTransform(1,0,0,-1,w,z);h.info.render.vertices=0;h.info.render.faces=0;f=t.projectScene(a,v,this.sortElements);k=f.elements;n=f.lights;(ga=n.length>0)&&p(n);Pa=0;for(Sa=k.length;Pa<Sa;Pa++)if(za=k[Pa],Ia=za.material,Ia=Ia instanceof THREE.MeshFaceMaterial?za.faceMaterial:Ia,!(Ia==null||Ia.opacity==0)){aa.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,aa.addPoint(K.positionScreen.x,K.positionScreen.y),aa.addPoint(N.positionScreen.x,N.positionScreen.y),ca.intersects(aa)&&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)),aa.add3Points(K.positionScreen.x,K.positionScreen.y,N.positionScreen.x,N.positionScreen.y,J.positionScreen.x,J.positionScreen.y),ca.intersects(aa)&&Qa(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)),aa.addPoint(K.positionScreen.x,K.positionScreen.y),aa.addPoint(N.positionScreen.x,N.positionScreen.y),aa.addPoint(J.positionScreen.x,J.positionScreen.y),aa.addPoint(M.positionScreen.x,M.positionScreen.y),ca.intersects(aa)&&C(K,N,J,M,ea,ja,za,Ia,a);V.addRectangle(aa)}u.setTransform(1,
-0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(a,b,c,e){var h,f,l,k,n,p;h=0;for(f=a.length;h<f;h++)l=a[h],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"),Y==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,h,f,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,E=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,Y=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":Y=1;break;case "low":Y=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,W;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(t,o,this.sortElements);h=l.elements;
-f=l.lights;ja=ea=0;if(C=f.length>0){L.setRGB(0,0,0);R.setRGB(0,0,0);D.setRGB(0,0,0);v=0;for(K=f.length;v<K;v++)W=f[v],G=W.color,W instanceof THREE.AmbientLight?(L.r+=G.r,L.g+=G.g,L.b+=G.b):W instanceof THREE.DirectionalLight?(R.r+=G.r,R.g+=G.g,R.b+=G.b):W instanceof THREE.PointLight&&(D.r+=G.r,D.g+=G.g,D.b+=G.b)}v=0;for(K=h.length;v<K;v++)if(G=h[v],W=G.material,W=W instanceof THREE.MeshFaceMaterial?G.faceMaterial:W,!(W==null||W.opacity==0))if(E.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,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),y.intersects(E)){G=w;var N=z,na=ja++;J[na]==null&&(J[na]=document.createElementNS("http://www.w3.org/2000/svg","line"),Y==0&&J[na].setAttribute("shape-rendering","crispEdges"));M=J[na];M.setAttribute("x1",G.positionScreen.x);
+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,h;ma.setRGB(0,0,0);wa.setRGB(0,0,0);pa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)e=a[b],h=e.color,e instanceof THREE.AmbientLight?(ma.r+=h.r,ma.g+=h.g,ma.b+=h.b):e instanceof THREE.DirectionalLight?(wa.r+=h.r,wa.g+=h.g,wa.b+=h.b):e instanceof THREE.PointLight&&(pa.r+=h.r,pa.g+=h.g,pa.b+=h.b)}function x(a,b,c,e){var h,l,f,k,o,n;h=0;for(l=a.length;h<l;h++)f=a[h],k=f.color,
+f instanceof THREE.DirectionalLight?(o=f.matrixWorld.getPosition(),n=c.dot(o),n<=0||(n*=f.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)):f instanceof THREE.PointLight&&(o=f.matrixWorld.getPosition(),n=c.dot(qa.sub(o,b).normalize()),n<=0||(n*=f.distance==0?1:1-Math.min(b.distanceTo(o)/f.distance,1),n!=0&&(n*=f.intensity,e.r+=k.r*n,e.g+=k.g*n,e.b+=k.b*n)))}function B(a,h,f){c(f.opacity);b(f.blending);var k,o,n,t,v,xa;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)t=f.map.image,v=t.width>>1,xa=
+t.height>>1,f=h.scale.x*w,n=h.scale.y*z,k=f*v,o=n*xa,aa.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(aa)&&(u.save(),u.translate(a.x,a.y),u.rotate(-h.rotation),u.scale(f,-n),u.translate(-v,-xa),u.drawImage(t,0,0),u.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*w,o=h.scale.y*z,aa.set(a.x-k,a.y-o,a.x+k,a.y+o),ca.intersects(aa)&&(e(f.color.getContextStyle()),l(f.color.getContextStyle()),u.save(),u.translate(a.x,a.y),u.rotate(-h.rotation),u.scale(k,o),f.program(u),u.restore()))}
+function y(a,h,l,f){c(f.opacity);b(f.blending);u.beginPath();u.moveTo(a.positionScreen.x,a.positionScreen.y);u.lineTo(h.positionScreen.x,h.positionScreen.y);u.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(R!=a)u.lineWidth=R=a;a=f.linecap;if(D!=a)u.lineCap=D=a;a=f.linejoin;if(O!=a)u.lineJoin=O=a;e(f.color.getContextStyle());u.stroke();aa.inflate(f.linewidth*2)}}function Qa(a,e,f,l,k,t,w,p){h.info.render.vertices+=3;h.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;ra=f.positionScreen.x;G=f.positionScreen.y;Na(Z,U,o,P,ra,G);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(va=w.uvs[0],Ra(Z,U,o,P,ra,G,va[l].u,va[l].v,va[k].u,va[k].v,va[t].u,va[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=v.matrixWorldInverse,qa.copy(w.vertexNormalsWorld[l]),Ca=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,Ga=-(qa.x*a.n21+qa.y*
+a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(w.vertexNormalsWorld[k]),ya=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,Aa=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,qa.copy(w.vertexNormalsWorld[t]),Ja=(qa.x*a.n11+qa.y*a.n12+qa.z*a.n13)*0.5+0.5,X=-(qa.x*a.n21+qa.y*a.n22+qa.z*a.n23)*0.5+0.5,Ra(Z,U,o,P,ra,G,Ca,Ga,ya,Aa,Ja,X,p.envMap)}else p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&(p.map.mapping instanceof
+THREE.UVMapping&&(va=w.uvs[0],Ra(Z,U,o,P,ra,G,va[l].u,va[l].v,va[k].u,va[k].v,va[t].u,va[t].v,p.map)),b(THREE.SubtractiveBlending)),fa?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==3?(ga.r=na.r=ia.r=ma.r,ga.g=na.g=ia.g=ma.g,ga.b=na.b=ia.b=ma.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],ga),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],na),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],ia),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*
+ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),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)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.b,1)),I.r=(na.r+ia.r)*0.5,I.g=(na.g+ia.g)*0.5,I.b=(na.b+ia.b)*0.5,ua=Oa(ga,na,ia,I),L(Z,U,o,P,ra,G,0,0,1,0,0,1,ua)):(ea.r=ma.r,ea.g=ma.g,ea.b=ma.b,x(n,w.centroidWorld,w.normalWorld,ea),ea.r=
+Math.max(0,Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(p.color.b*ea.b,1)),p.wireframe?H(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(ea)):p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(p.color);else if(p instanceof THREE.MeshDepthMaterial)ha=v.near,ka=v.far,ga.r=ga.g=ga.b=1-La(a.positionScreen.z,ha,ka),na.r=na.g=na.b=1-La(e.positionScreen.z,ha,ka),ia.r=ia.g=ia.b=1-La(f.positionScreen.z,
+ha,ka),I.r=(na.r+ia.r)*0.5,I.g=(na.g+ia.g)*0.5,I.b=(na.b+ia.b)*0.5,ua=Oa(ga,na,ia,I),L(Z,U,o,P,ra,G,0,0,1,0,0,1,ua);else if(p instanceof THREE.MeshNormalMaterial)ea.r=Ma(w.normalWorld.x),ea.g=Ma(w.normalWorld.y),ea.b=Ma(w.normalWorld.z),p.wireframe?H(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(ea)}function C(a,e,f,l,k,t,w,p,u){h.info.render.vertices+=4;h.info.render.faces++;c(p.opacity);b(p.blending);if(p.map||p.envMap)Qa(a,e,l,0,1,3,w,p,u),Qa(k,f,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,ra=f.positionScreen.x,G=f.positionScreen.y,W=l.positionScreen.x,$=l.positionScreen.y,la=k.positionScreen.x,ja=k.positionScreen.y,sa=t.positionScreen.x,T=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)E(Z,U,o,P,ra,G,W,$),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(p.color);else if(p instanceof THREE.MeshLambertMaterial)fa?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==
+4?(ga.r=na.r=ia.r=I.r=ma.r,ga.g=na.g=ia.g=I.g=ma.g,ga.b=na.b=ia.b=I.b=ma.b,x(n,w.v1.positionWorld,w.vertexNormalsWorld[0],ga),x(n,w.v2.positionWorld,w.vertexNormalsWorld[1],na),x(n,w.v4.positionWorld,w.vertexNormalsWorld[3],ia),x(n,w.v3.positionWorld,w.vertexNormalsWorld[2],I),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),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)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.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)),ua=Oa(ga,na,ia,I),Na(Z,U,o,P,W,$),L(Z,U,o,P,W,$,0,0,1,0,0,1,ua),Na(la,ja,ra,G,sa,T),L(la,ja,ra,G,sa,T,1,0,1,1,0,1,ua)):(ea.r=ma.r,ea.g=ma.g,ea.b=ma.b,x(n,w.centroidWorld,w.normalWorld,ea),ea.r=Math.max(0,
+Math.min(p.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(p.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(p.color.b*ea.b,1)),E(Z,U,o,P,ra,G,W,$),p.wireframe?H(ea,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(ea)):(E(Z,U,o,P,ra,G,W,$),p.wireframe?H(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Fa(p.color));else if(p instanceof THREE.MeshNormalMaterial)ea.r=Ma(w.normalWorld.x),ea.g=Ma(w.normalWorld.y),ea.b=Ma(w.normalWorld.z),E(Z,U,o,P,ra,G,W,$),p.wireframe?H(ea,p.wireframeLinewidth,
+p.wireframeLinecap,p.wireframeLinejoin):Fa(ea);else if(p instanceof THREE.MeshDepthMaterial)ha=v.near,ka=v.far,ga.r=ga.g=ga.b=1-La(a.positionScreen.z,ha,ka),na.r=na.g=na.b=1-La(e.positionScreen.z,ha,ka),ia.r=ia.g=ia.b=1-La(l.positionScreen.z,ha,ka),I.r=I.g=I.b=1-La(f.positionScreen.z,ha,ka),ua=Oa(ga,na,ia,I),Na(Z,U,o,P,W,$),L(Z,U,o,P,W,$,0,0,1,0,0,1,ua),Na(la,ja,ra,G,sa,T),L(la,ja,ra,G,sa,T,1,0,1,1,0,1,ua)}function Na(a,b,c,e,h,f){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(h,f);u.lineTo(a,
+b);u.closePath()}function E(a,b,c,e,h,f,l,k){u.beginPath();u.moveTo(a,b);u.lineTo(c,e);u.lineTo(h,f);u.lineTo(l,k);u.lineTo(a,b);u.closePath()}function H(a,b,c,h){if(R!=b)u.lineWidth=R=b;if(D!=c)u.lineCap=D=c;if(O!=h)u.lineJoin=O=h;e(a.getContextStyle());u.stroke();aa.inflate(b*2)}function Fa(a){l(a.getContextStyle());u.fill()}function Ra(a,b,c,e,h,f,k,o,n,p,t,w,v){if(v.image.width!=0){if(v.needsUpdate==!0||Q[v.id]==void 0){var xa=v.wrapS==THREE.RepeatWrapping,x=v.wrapT==THREE.RepeatWrapping;Q[v.id]=
+u.createPattern(v.image,xa&&x?"repeat":xa&&!x?"repeat-x":!xa&&x?"repeat-y":"no-repeat");v.needsUpdate=!1}l(Q[v.id]);var xa=v.offset.x/v.repeat.x,x=v.offset.y/v.repeat.y,X=(v.image.width-1)*v.repeat.x,v=(v.image.height-1)*v.repeat.y,k=(k+xa)*X,o=(o+x)*v,n=(n+xa)*X,p=(p+x)*v,t=(t+xa)*X,w=(w+x)*v;c-=a;e-=b;h-=a;f-=b;n-=k;p-=o;t-=k;w-=o;xa=1/(n*w-t*p);v=(w*c-p*h)*xa;p=(w*e-p*f)*xa;c=(n*h-t*c)*xa;e=(n*f-t*e)*xa;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,h,f,l,k,o,n,p,t,w){var v,xa;v=w.width-1;xa=w.height-1;l*=v;k*=xa;o*=v;n*=xa;p*=v;t*=xa;c-=a;e-=b;h-=a;f-=b;o-=l;n-=k;p-=l;t-=k;xa=1/(o*t-p*n);v=(t*c-n*h)*xa;n=(t*e-n*f)*xa;c=(o*h-p*c)*xa;e=(o*f-p*e)*xa;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 h=~~(a.r*255),f=~~(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);za[0]=
+h<0?0:h>255?255:h;za[1]=f<0?0:f>255?255:f;za[2]=a<0?0:a>255?255:a;za[4]=l<0?0:l>255?255:l;za[5]=k<0?0:k>255?255:k;za[6]=b<0?0:b>255?255:b;za[8]=o<0?0:o>255?255:o;za[9]=n<0?0:n>255?255:n;za[10]=c<0?0:c>255?255:c;za[12]=p<0?0:p>255?255:p;za[13]=t<0?0:t>255?255:t;za[14]=e<0?0:e>255?255:e;Da.putImageData(Ha,0,0);S.drawImage(ta,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,h=c*c+e*e;h!=0&&(h=1/
+Math.sqrt(h),c*=h,e*=h,b.x+=c,b.y+=e,a.x-=c,a.y-=e)}var Pa,Ta,Ba,Ia;this.autoClear?this.clear():u.setTransform(1,0,0,-1,w,z);h.info.render.vertices=0;h.info.render.faces=0;f=t.projectScene(a,v,this.sortElements);k=f.elements;n=f.lights;(fa=n.length>0)&&p(n);Pa=0;for(Ta=k.length;Pa<Ta;Pa++)if(Ba=k[Pa],Ia=Ba.material,Ia=Ia instanceof THREE.MeshFaceMaterial?Ba.faceMaterial:Ia,!(Ia==null||Ia.opacity==0)){aa.empty();if(Ba instanceof THREE.RenderableParticle)J=Ba,J.x*=w,J.y*=z,B(J,Ba,Ia,a);else if(Ba instanceof
+THREE.RenderableLine)J=Ba.v1,N=Ba.v2,J.positionScreen.x*=w,J.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,aa.addPoint(J.positionScreen.x,J.positionScreen.y),aa.addPoint(N.positionScreen.x,N.positionScreen.y),ca.intersects(aa)&&y(J,N,Ba,Ia,a);else if(Ba instanceof THREE.RenderableFace3)J=Ba.v1,N=Ba.v2,K=Ba.v3,J.positionScreen.x*=w,J.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,K.positionScreen.x*=w,K.positionScreen.y*=z,Ia.overdraw&&(Ka(J.positionScreen,N.positionScreen),
+Ka(N.positionScreen,K.positionScreen),Ka(K.positionScreen,J.positionScreen)),aa.add3Points(J.positionScreen.x,J.positionScreen.y,N.positionScreen.x,N.positionScreen.y,K.positionScreen.x,K.positionScreen.y),ca.intersects(aa)&&Qa(J,N,K,0,1,2,Ba,Ia,a);else if(Ba instanceof THREE.RenderableFace4)J=Ba.v1,N=Ba.v2,K=Ba.v3,M=Ba.v4,J.positionScreen.x*=w,J.positionScreen.y*=z,N.positionScreen.x*=w,N.positionScreen.y*=z,K.positionScreen.x*=w,K.positionScreen.y*=z,M.positionScreen.x*=w,M.positionScreen.y*=z,
+Y.positionScreen.copy(N.positionScreen),oa.positionScreen.copy(M.positionScreen),Ia.overdraw&&(Ka(J.positionScreen,N.positionScreen),Ka(N.positionScreen,M.positionScreen),Ka(M.positionScreen,J.positionScreen),Ka(K.positionScreen,Y.positionScreen),Ka(K.positionScreen,oa.positionScreen)),aa.addPoint(J.positionScreen.x,J.positionScreen.y),aa.addPoint(N.positionScreen.x,N.positionScreen.y),aa.addPoint(K.positionScreen.x,K.positionScreen.y),aa.addPoint(M.positionScreen.x,M.positionScreen.y),ca.intersects(aa)&&
+C(J,N,K,M,Y,oa,Ba,Ia,a);V.addRectangle(aa)}u.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(a,b,c,e){var h,f,l,k,n,p;h=0;for(f=a.length;h<f;h++)l=a[h],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(J.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,h,f,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,E=new THREE.Rectangle,C=!1,H=new THREE.Color,L=new THREE.Color,R=new THREE.Color,D=new THREE.Color,O,J=new THREE.Vector3,N=[],K=[],M,Y,oa,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,J,G,W;this.autoClear&&this.clear();e.info.render.vertices=0;e.info.render.faces=0;l=k.projectScene(t,o,this.sortElements);h=l.elements;
+f=l.lights;oa=Y=0;if(C=f.length>0){L.setRGB(0,0,0);R.setRGB(0,0,0);D.setRGB(0,0,0);v=0;for(J=f.length;v<J;v++)W=f[v],G=W.color,W instanceof THREE.AmbientLight?(L.r+=G.r,L.g+=G.g,L.b+=G.b):W instanceof THREE.DirectionalLight?(R.r+=G.r,R.g+=G.g,R.b+=G.b):W instanceof THREE.PointLight&&(D.r+=G.r,D.g+=G.g,D.b+=G.b)}v=0;for(J=h.length;v<J;v++)if(G=h[v],W=G.material,W=W instanceof THREE.MeshFaceMaterial?G.faceMaterial:W,!(W==null||W.opacity==0))if(E.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,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),y.intersects(E)){G=w;var N=z,la=oa++;K[la]==null&&(K[la]=document.createElementNS("http://www.w3.org/2000/svg","line"),Z==0&&K[la].setAttribute("shape-rendering","crispEdges"));M=K[la];M.setAttribute("x1",G.positionScreen.x);
 M.setAttribute("y1",G.positionScreen.y);M.setAttribute("x2",N.positionScreen.x);M.setAttribute("y2",N.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(M.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.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*=
 M.setAttribute("y1",G.positionScreen.y);M.setAttribute("x2",N.positionScreen.x);M.setAttribute("y2",N.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(M.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.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,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(u.positionScreen.x,u.positionScreen.y),y.intersects(E)){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");W instanceof THREE.MeshBasicMaterial?
+p,z.positionScreen.y*=-x,u.positionScreen.x*=p,u.positionScreen.y*=-x,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(u.positionScreen.x,u.positionScreen.y),y.intersects(E)){var N=w,la=z,ja=u;e.info.render.vertices+=3;e.info.render.faces++;M=c(Y++);M.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+la.positionScreen.x+" "+la.positionScreen.y+" L "+ja.positionScreen.x+","+ja.positionScreen.y+"z");W instanceof THREE.MeshBasicMaterial?
 H.copy(W.color):W instanceof THREE.MeshLambertMaterial?C?(H.r=L.r,H.g=L.g,H.b=L.b,a(f,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(W.color.r*H.r,1)),H.g=Math.max(0,Math.min(W.color.g*H.g,1)),H.b=Math.max(0,Math.min(W.color.b*H.b,1))):H.copy(W.color):W instanceof THREE.MeshDepthMaterial?(O=1-W.__2near/(W.__farPlusNear-G.z*W.__farMinusNear),H.setRGB(O,O,O)):W instanceof THREE.MeshNormalMaterial&&H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));W.wireframe?M.setAttribute("style",
 H.copy(W.color):W instanceof THREE.MeshLambertMaterial?C?(H.r=L.r,H.g=L.g,H.b=L.b,a(f,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(W.color.r*H.r,1)),H.g=Math.max(0,Math.min(W.color.g*H.g,1)),H.b=Math.max(0,Math.min(W.color.b*H.b,1))):H.copy(W.color):W instanceof THREE.MeshDepthMaterial?(O=1-W.__2near/(W.__farPlusNear-G.z*W.__farMinusNear),H.setRGB(O,O,O)):W instanceof THREE.MeshNormalMaterial&&H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));W.wireframe?M.setAttribute("style",
 "fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+W.wireframeLinewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframeLinecap+"; stroke-linejoin: "+W.wireframeLinejoin):M.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+W.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*=
 "fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+W.wireframeLinewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframeLinecap+"; stroke-linejoin: "+W.wireframeLinejoin):M.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+W.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,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),y.intersects(E))){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");W instanceof THREE.MeshBasicMaterial?H.copy(W.color):W instanceof THREE.MeshLambertMaterial?C?(H.r=L.r,H.g=L.g,H.b=L.b,a(f,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(W.color.r*H.r,1)),H.g=Math.max(0,Math.min(W.color.g*H.g,1)),H.b=Math.max(0,Math.min(W.color.b*H.b,1))):H.copy(W.color):W instanceof THREE.MeshDepthMaterial?(O=1-W.__2near/(W.__farPlusNear-G.z*W.__farMinusNear),H.setRGB(O,O,O)):W instanceof THREE.MeshNormalMaterial&&
+-x,B.positionScreen.x*=p,B.positionScreen.y*=-x,E.addPoint(w.positionScreen.x,w.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(u.positionScreen.x,u.positionScreen.y),E.addPoint(B.positionScreen.x,B.positionScreen.y),y.intersects(E))){var N=w,la=z,ja=u,sa=B;e.info.render.vertices+=4;e.info.render.faces++;M=c(Y++);M.setAttribute("d","M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+la.positionScreen.x+" "+la.positionScreen.y+" L "+ja.positionScreen.x+","+ja.positionScreen.y+
+" L "+sa.positionScreen.x+","+sa.positionScreen.y+"z");W instanceof THREE.MeshBasicMaterial?H.copy(W.color):W instanceof THREE.MeshLambertMaterial?C?(H.r=L.r,H.g=L.g,H.b=L.b,a(f,G.centroidWorld,G.normalWorld,H),H.r=Math.max(0,Math.min(W.color.r*H.r,1)),H.g=Math.max(0,Math.min(W.color.g*H.g,1)),H.b=Math.max(0,Math.min(W.color.b*H.b,1))):H.copy(W.color):W instanceof THREE.MeshDepthMaterial?(O=1-W.__2near/(W.__farPlusNear-G.z*W.__farMinusNear),H.setRGB(O,O,O)):W instanceof THREE.MeshNormalMaterial&&
 H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));W.wireframe?M.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+W.wireframeLinewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframeLinecap+"; stroke-linejoin: "+W.wireframeLinejoin):M.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+W.opacity);n.appendChild(M)}}};
 H.setRGB(b(G.normalWorld.x),b(G.normalWorld.y),b(G.normalWorld.z));W.wireframe?M.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+W.wireframeLinewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframeLinecap+"; stroke-linejoin: "+W.wireframeLinejoin):M.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+W.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",
 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_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",
@@ -225,22 +225,22 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
 THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
 THREE.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 h in e.attributes){var f=e.attributes[h];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var l=1;f.type==="v2"?l=2:f.type==="v3"?l=3:f.type==="v4"?l=4:f.type==="c"&&(l=3);f.size=l;f.array=new Float32Array(c*l);f.buffer=o.createBuffer();f.buffer.belongsToAttribute=h;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
 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 h in e.attributes){var f=e.attributes[h];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var l=1;f.type==="v2"?l=2:f.type==="v3"?l=3:f.type==="v4"?l=4:f.type==="c"&&(l=3);f.size=l;f.array=new Float32Array(c*l);f.buffer=o.createBuffer();f.buffer.belongsToAttribute=h;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
-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,h,f,l=a.vertices,k=l.length,n=a.colors,p=n.length,t=a.__vertexArray,w=a.__colorArray,v=a.__sortArray,u=a.__dirtyVertices,x=a.__dirtyColors,Z=a.__webglCustomAttributesList;if(c.sortParticles){qa.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)h=l[e].position,Aa.copy(h),qa.multiplyVector3(Aa),v[e]=[Aa.z,e];v.sort(function(a,
-b){return b[0]-a[0]});for(e=0;e<k;e++)h=l[v[e][1]].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;for(e=0;e<p;e++)f=e*3,color=n[v[e][1]],w[f]=color.r,w[f+1]=color.g,w[f+2]=color.b;if(Z){n=0;for(p=Z.length;n<p;n++)if(k=Z[n],k.boundTo===void 0||k.boundTo==="vertices"){f=0;h=k.value.length;for(e=0;e<h;e++)index=v[e][1],k.size===1?k.array[f]=k.value[index]:(l=k.value[index],k.size===2?(k.array[f]=l.x,k.array[f+1]=l.y):k.size===3?k.type==="c"?(k.array[f]=l.r,k.array[f+1]=l.g,k.array[f+2]=l.b):(k.array[f]=
-l.x,k.array[f+1]=l.y,k.array[f+2]=l.z):(k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,k.array[f+3]=l.w)),f+=k.size}}}else{if(u)for(e=0;e<k;e++)h=l[e].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;if(x)for(e=0;e<p;e++)color=n[e],f=e*3,w[f]=color.r,w[f+1]=color.g,w[f+2]=color.b;if(Z){n=0;for(p=Z.length;n<p;n++)if(k=Z[n],k.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices")){h=k.value.length;for(e=f=0;e<h;e++)offset_custom=k.offset,k.size===1?k.array[f]=k.value[e]:(l=k.value[e],k.size===2?(k.array[f]=
-l.x,k.array[f+1]=l.y):k.size===3?k.type==="c"?(k.array[f]=l.r,k.array[f+1]=l.g,k.array[f+2]=l.b):(k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z):(k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,k.array[f+3]=l.w)),f+=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(Z){n=0;for(p=Z.length;n<p;n++)if(k=Z[n],k.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!==W)W=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,Ea);if(c&&e.fog)if(n.fogColor.value=c.color,c instanceof
+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,h,f,l=a.vertices,k=l.length,n=a.colors,p=n.length,t=a.__vertexArray,w=a.__colorArray,v=a.__sortArray,u=a.__dirtyVertices,x=a.__dirtyColors,X=a.__webglCustomAttributesList;if(c.sortParticles){Ca.multiplySelf(c.matrixWorld);for(e=0;e<k;e++)h=l[e].position,Aa.copy(h),Ca.multiplyVector3(Aa),v[e]=[Aa.z,e];v.sort(function(a,
+b){return b[0]-a[0]});for(e=0;e<k;e++)h=l[v[e][1]].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;for(e=0;e<p;e++)f=e*3,color=n[v[e][1]],w[f]=color.r,w[f+1]=color.g,w[f+2]=color.b;if(X){n=0;for(p=X.length;n<p;n++)if(k=X[n],k.boundTo===void 0||k.boundTo==="vertices"){f=0;h=k.value.length;for(e=0;e<h;e++)index=v[e][1],k.size===1?k.array[f]=k.value[index]:(l=k.value[index],k.size===2?(k.array[f]=l.x,k.array[f+1]=l.y):k.size===3?k.type==="c"?(k.array[f]=l.r,k.array[f+1]=l.g,k.array[f+2]=l.b):(k.array[f]=
+l.x,k.array[f+1]=l.y,k.array[f+2]=l.z):(k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,k.array[f+3]=l.w)),f+=k.size}}}else{if(u)for(e=0;e<k;e++)h=l[e].position,f=e*3,t[f]=h.x,t[f+1]=h.y,t[f+2]=h.z;if(x)for(e=0;e<p;e++)color=n[e],f=e*3,w[f]=color.r,w[f+1]=color.g,w[f+2]=color.b;if(X){n=0;for(p=X.length;n<p;n++)if(k=X[n],k.needsUpdate&&(k.boundTo===void 0||k.boundTo==="vertices")){h=k.value.length;for(e=f=0;e<h;e++)offset_custom=k.offset,k.size===1?k.array[f]=k.value[e]:(l=k.value[e],k.size===2?(k.array[f]=
+l.x,k.array[f+1]=l.y):k.size===3?k.type==="c"?(k.array[f]=l.r,k.array[f+1]=l.g,k.array[f+2]=l.b):(k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z):(k.array[f]=l.x,k.array[f+1]=l.y,k.array[f+2]=l.z,k.array[f+3]=l.w)),f+=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(X){n=0;for(p=X.length;n<p;n++)if(k=X[n],k.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!==ra&&(o.useProgram(h),ra=h,k=!0);if(e.id!==W)W=e.id,k=!0;if(k){o.uniformMatrix4fv(l.projectionMatrix,!1,Ga);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,E=V.point.positions,H=V.point.distances,aa=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,
 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,E=V.point.positions,H=V.point.distances,aa=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=aa*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,aa+=1;else if(p instanceof THREE.SpotLight)B=aa*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,aa+=1;else if(p instanceof THREE.PointLight)p=
 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=aa*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,aa+=1;else if(p instanceof THREE.SpotLight)B=aa*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,aa+=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),E[p]=x.x,E[p+1]=x.y,E[p+2]=x.z,H[I]=B,I+=1;c=aa*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=aa;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=
 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),E[p]=x.x,E[p+1]=x.y,E[p+2]=x.z,H[I]=B,I+=1;c=aa*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=aa;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=
 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,
 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=Z.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<X.length;b++)n.shadowMatrix.value[b]=X[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);
+n.scale.value=X.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<qa.length;b++)n.shadowMatrix.value[b]=qa[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,
 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=
 !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,
+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)):J(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])&&J(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 h(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!==$&&($=c,b=!0);if(!e.morphTargets&&a.position>=
 !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 h(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!==$&&($=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;
 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 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]);
 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 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]);
@@ -250,104 +250,105 @@ o.disableVertexAttribArray(a.uv));a.uv2>=0&&(f.__webglUV2Buffer?(o.bindBuffer(o.
 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,
 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)),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++)}}
 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 f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,f,h,l,k,n,p,t,w,v,u=
 function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=o.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=o.createBuffer();a.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,a.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,a.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(b.attributes.position),o.vertexAttribPointer(b.attributes.position,3,o.FLOAT,!1,0,0));if(a.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var e,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,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){W=-1;U.shadowMap[t]||(U.shadowMap[t]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));X[t]||(X[t]=new THREE.Matrix4);w=U.shadowMap[t];v=X[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],Z=u.object,Z.visible&&Z.castShadow?!(Z instanceof THREE.Mesh)||!Z.frustumCulled||x(Z)?(Z.matrixWorld.flattenToArray(Z._objectMatrixArray),E(Z,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)Z=u.object,buffer=u.buffer,k(Z),u=Z.customDepthMaterial?Z.customDepthMaterial:
-Z.geometry.morphTargets.length?Fa:Ha,h(ua,z,null,u,buffer,Z);for(w=0;w<e;w++)u=a.__webglObjectsImmediate[w],Z=u.object,Z.visible&&Z.castShadow&&(Z.matrixAutoUpdate&&Z.matrixWorld.flattenToArray(Z._objectMatrixArray),$=-1,E(Z,ua,!1),k(Z),program=l(ua,z,null,Ha,Z),Z.immediateRenderCallback?Z.immediateRenderCallback(program,o,sa):Z.render(function(a){f(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;$=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<
+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(ja!==a.doubleSided)a.doubleSided?o.disable(o.CULL_FACE):
+o.enable(o.CULL_FACE),ja=a.doubleSided;if(sa!==a.flipSided)a.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),sa=a.flipSided}function n(a){ea!==a&&(a?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ea=a)}function t(a){ga!==a&&(o.depthMask(a),ga=a)}function v(a,b,c){na!==a&&(a?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),na=a);if(a&&(ia!==b||I!==c))o.polygonOffset(b,c),ia=b,I=c}function p(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 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=va[e].x*b.n14+va[e].y*
+b.n24+va[e].z*b.n34+va[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,X,z=a.lights;pa||(pa=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){W=-1;U.shadowMap[t]||(U.shadowMap[t]=new THREE.WebGLRenderTarget(U.shadowMapWidth,U.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));qa[t]||(qa[t]=new THREE.Matrix4);w=U.shadowMap[t];v=qa[t];
+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);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(pa.projectionMatrix);v.multiplySelf(pa.matrixWorldInverse);pa.matrixWorldInverse.flattenToArray(ya);pa.projectionMatrix.flattenToArray(Ga);Ca.multiply(pa.projectionMatrix,pa.matrixWorldInverse);p(Ca);
+K(w);o.clearColor(1,1,1,1);U.clear();o.clearColor(fa.r,fa.g,fa.b,ma);v=a.__webglObjects.length;e=a.__webglObjectsImmediate.length;for(w=0;w<v;w++)u=a.__webglObjects[w],X=u.object,X.visible&&X.castShadow?!(X instanceof THREE.Mesh)||!X.frustumCulled||x(X)?(X.matrixWorld.flattenToArray(X._objectMatrixArray),E(X,pa,!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)X=u.object,buffer=u.buffer,k(X),u=X.customDepthMaterial?X.customDepthMaterial:
+X.geometry.morphTargets.length?Ha:Da,h(pa,z,null,u,buffer,X);for(w=0;w<e;w++)u=a.__webglObjectsImmediate[w],X=u.object,X.visible&&X.castShadow&&(X.matrixAutoUpdate&&X.matrixWorld.flattenToArray(X._objectMatrixArray),$=-1,E(X,pa,!1),k(X),program=l(pa,z,null,Da,X),X.immediateRenderCallback?X.immediateRenderCallback(program,o,va):X.render(function(a){f(a,program,Da.shading)}));t++}}function y(a,b){var c,e,f;c=S.attributes;var h=S.uniforms,l=ua/ka,k,n=[],t=ka*0.5,w=ua*0.5,p=!0;o.useProgram(S.program);
+ra=S.program;$=ea=T=-1;Sa||(o.enableVertexAttribArray(S.attributes.position),o.enableVertexAttribArray(S.attributes.uv),Sa=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,S.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,S.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Ga);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)/
 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 E(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,Y(b.wrapS)),o.texParameteri(a,o.TEXTURE_WRAP_T,Y(b.wrapT)),o.texParameteri(a,o.TEXTURE_MAG_FILTER,Y(b.magFilter)),o.texParameteri(a,
-o.TEXTURE_MIN_FILTER,Y(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,Y(a.format),a.image.width,a.image.height,0,Y(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);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,Y(a.format),a.width,a.height,0,Y(a.format),Y(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,Y(a.format),a.width,a.height,0,Y(a.format),Y(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 Y(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;
+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?ua: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),J(f.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ga)}function E(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!==T){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)}T=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,oa(b.magFilter)),o.texParameteri(a,o.TEXTURE_MIN_FILTER,oa(b.minFilter)))}function J(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 K(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);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=ka,a=ua,e=Q,f=ha);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 Y(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 oa(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}
 case THREE.ByteType:return o.BYTE;case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}
-var U=this,o,P=[],pa=null,G=null,W=-1,$=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||{},Z=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,aa=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=Z;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,X=[],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=Z.getContext("experimental-webgl",{antialias:aa,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){Z.width=a;Z.height=b;this.setViewport(0,0,Z.width,Z.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;
+var U=this,o,P=[],ra=null,G=null,W=-1,$=null,la=0,ja=null,sa=null,T=null,ea=null,ga=null,na=null,ia=null,I=null,Q=0,ha=0,ka=0,ua=0,va=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ga=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||{},X=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,aa=a.antialias!==void 0?a.antialias:!1,fa=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ma=a.clearAlpha!==void 0?a.clearAlpha:0,wa=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=X;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 pa,qa=[],a=THREE.ShaderLib.depthRGBA,ta=THREE.UniformsUtils.clone(a.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
+vertexShader:a.vertexShader,uniforms:ta}),Ha=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ta,morphTargets:!0});Da._shadowPass=!0;Ha._shadowPass=!0;try{if(!(o=X.getContext("experimental-webgl",{antialias:aa,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(za){console.error(za)}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(fa.r,fa.g,fa.b,ma);this.context=o;var Ea=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,S={};S.vertices=new Float32Array(16);S.faces=new Uint16Array(6);ca=0;S.vertices[ca++]=-1;S.vertices[ca++]=-1;S.vertices[ca++]=0;S.vertices[ca++]=1;S.vertices[ca++]=
+1;S.vertices[ca++]=-1;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=1;S.vertices[ca++]=0;S.vertices[ca++]=-1;S.vertices[ca++]=1;S.vertices[ca++]=0;ca=S.vertices[ca++]=0;S.faces[ca++]=0;S.faces[ca++]=1;S.faces[ca++]=2;S.faces[ca++]=0;S.faces[ca++]=2;S.faces[ca++]=3;S.vertexBuffer=o.createBuffer();S.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,S.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,S.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
+S.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,S.faces,o.STATIC_DRAW);S.program=o.createProgram();o.attachShader(S.program,Y("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(S.program,Y("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(S.program);S.attributes={};S.uniforms={};S.attributes.position=o.getAttribLocation(S.program,"position");S.attributes.uv=o.getAttribLocation(S.program,"uv");S.uniforms.uvOffset=o.getUniformLocation(S.program,"uvOffset");S.uniforms.uvScale=
+o.getUniformLocation(S.program,"uvScale");S.uniforms.rotation=o.getUniformLocation(S.program,"rotation");S.uniforms.scale=o.getUniformLocation(S.program,"scale");S.uniforms.alignment=o.getUniformLocation(S.program,"alignment");S.uniforms.color=o.getUniformLocation(S.program,"color");S.uniforms.map=o.getUniformLocation(S.program,"map");S.uniforms.opacity=o.getUniformLocation(S.program,"opacity");S.uniforms.useScreenCoordinates=o.getUniformLocation(S.program,"useScreenCoordinates");S.uniforms.affectedByDistance=
+o.getUniformLocation(S.program,"affectedByDistance");S.uniforms.screenPosition=o.getUniformLocation(S.program,"screenPosition");S.uniforms.modelViewMatrix=o.getUniformLocation(S.program,"modelViewMatrix");S.uniforms.projectionMatrix=o.getUniformLocation(S.program,"projectionMatrix");var Sa=!1;this.setSize=function(a,b){X.width=a;X.height=b;this.setViewport(0,0,X.width,X.height)};this.setViewport=function(a,b,c,e){Q=a;ha=b;ka=c;ua=e;o.viewport(Q,ha,ka,ua)};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){fa.setHex(a);ma=b;o.clearColor(fa.r,fa.g,fa.b,ma)};this.setClearColor=function(a,b){fa.copy(a);ma=b;o.clearColor(fa.r,fa.g,fa.b,ma)};this.getClearColor=function(){return fa};this.getClearAlpha=function(){return ma};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.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),
 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,
 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,
 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,
+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<=wa?t=p:(t=Math.ceil(wa*p/(n+p)),n=wa-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),
 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":"",
+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=[Ea?"#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");
 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":
 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 Z,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(Z in n)e.push(Z);Z=e;e=0;for(n=Z.length;e<n;e++)t=Z[e],x.uniforms[t]=o.getUniformLocation(x,
-t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(Z=0;Z<c.maxMorphTargets;Z++)e.push("morphTarget"+Z);for(u in b)e.push(u);u=e;Z=0;for(b=u.length;Z<b;Z++)c=u[Z],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++)Z="morphTarget"+h,u[Z]>=0&&(o.enableVertexAttribArray(u[Z]),
-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 Z,V,ca,C,H,aa,Da,I=a.lights,L=a.fog;W=-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],aa=H.object,aa.visible)if(!(aa instanceof THREE.Mesh)||!aa.frustumCulled||x(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),
-E(aa,b,!0),z(H),H.render=!0,this.sortObjects)aa.renderDepth?H.z=aa.renderDepth:(Aa.copy(aa.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],aa=H.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),E(aa,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)aa=H.object,Da=H.buffer,k(aa),h(b,I,L,a.overrideMaterial,Da,aa);for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,k(aa),Z=l(b,I,L,a.overrideMaterial,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(Z,o,sa):aa.render(function(b){f(b,Z,a.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);for(e=ca-1;e>=0;e--)if(H=a.__webglObjects[e],H.render&&(aa=H.object,Da=H.buffer,V=H.opaque))k(aa),n(V.depthTest),t(V.depthWrite),
-v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),h(b,I,L,V,Da,aa);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,V=H.opaque))k(aa),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),Z=l(b,I,L,V,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(Z,o,sa):aa.render(function(a){f(a,Z,V.shading)});for(e=0;e<ca;e++)if(H=a.__webglObjects[e],H.render&&(aa=H.object,Da=H.buffer,V=H.transparent))k(aa),D(V.blending),
-n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),h(b,I,L,V,Da,aa);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,V=H.transparent))k(aa),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),Z=l(b,I,L,V,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(Z,o,sa):aa.render(function(a){f(a,Z,V.shading)})}a.__webglSprites.length&&y(a,b);c&&c.minFilter!==THREE.NearestFilter&&
+"",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,Y("fragment",l+t));o.attachShader(x,
+Y("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 X,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(X in n)e.push(X);X=e;e=0;for(n=X.length;e<n;e++)t=X[e],x.uniforms[t]=o.getUniformLocation(x,
+t);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(X=0;X<c.maxMorphTargets;X++)e.push("morphTarget"+X);for(u in b)e.push(u);u=e;X=0;for(b=u.length;X<b;X++)c=u[X],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++)X="morphTarget"+h,u[X]>=0&&(o.enableVertexAttribArray(u[X]),
+a.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,e){K(a);this.clear(b,c,e)};this.updateShadowMap=function(a,b){B(a,b)};this.render=function(a,b,c,e){var X,V,ca,C,H,aa,Fa,I=a.lights,L=a.fog;W=-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(Ga);Ca.multiply(b.projectionMatrix,b.matrixWorldInverse);p(Ca);K(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],aa=H.object,aa.visible)if(!(aa instanceof THREE.Mesh)||!aa.frustumCulled||x(aa)){if(aa.matrixWorld.flattenToArray(aa._objectMatrixArray),
+E(aa,b,!0),z(H),H.render=!0,this.sortObjects)aa.renderDepth?H.z=aa.renderDepth:(Aa.copy(aa.position),Ca.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],aa=H.object,aa.visible&&(aa.matrixAutoUpdate&&aa.matrixWorld.flattenToArray(aa._objectMatrixArray),E(aa,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)aa=H.object,Fa=H.buffer,k(aa),h(b,I,L,a.overrideMaterial,Fa,aa);for(e=0;e<C;e++)H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,k(aa),X=l(b,I,L,a.overrideMaterial,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(X,o,va):aa.render(function(b){f(b,X,a.overrideMaterial.shading)}))}else{D(THREE.NormalBlending);for(e=ca-1;e>=0;e--)if(H=a.__webglObjects[e],H.render&&(aa=H.object,Fa=H.buffer,V=H.opaque))k(aa),n(V.depthTest),t(V.depthWrite),
+v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),h(b,I,L,V,Fa,aa);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,V=H.opaque))k(aa),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),X=l(b,I,L,V,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(X,o,va):aa.render(function(a){f(a,X,V.shading)});for(e=0;e<ca;e++)if(H=a.__webglObjects[e],H.render&&(aa=H.object,Fa=H.buffer,V=H.transparent))k(aa),D(V.blending),
+n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),h(b,I,L,V,Fa,aa);for(e=0;e<C;e++)if(H=a.__webglObjectsImmediate[e],aa=H.object,aa.visible&&($=-1,V=H.transparent))k(aa),D(V.blending),n(V.depthTest),t(V.depthWrite),v(V.polygonOffset,V.polygonOffsetFactor,V.polygonOffsetUnits),X=l(b,I,L,V,aa),aa.immediateRenderCallback?aa.immediateRenderCallback(X,o,va):aa.render(function(a){f(a,X,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),
 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,v=void 0,u=void 0,x=void 0,Z=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=z[x].hash+"_"+z[x].counter,n.geometryGroups[Z]===void 0&&(n.geometryGroups[Z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V}),u=w instanceof THREE.Face3?3:4,n.geometryGroups[Z].vertices+
-u>65535&&(z[x].counter+=1,Z=z[x].hash+"_"+z[x].counter,n.geometryGroups[Z]===void 0&&(n.geometryGroups[Z]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V})),w instanceof THREE.Face3?n.geometryGroups[Z].faces3.push(t):n.geometryGroups[Z].faces4.push(t),n.geometryGroups[Z].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=
+f instanceof THREE.Mesh){k=f.geometry;if(k.geometryGroups===void 0){var n=k,t=void 0,p=void 0,w=void 0,v=void 0,u=void 0,x=void 0,X=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}),X=z[x].hash+"_"+z[x].counter,n.geometryGroups[X]===void 0&&(n.geometryGroups[X]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V}),u=w instanceof THREE.Face3?3:4,n.geometryGroups[X].vertices+
+u>65535&&(z[x].counter+=1,X=z[x].hash+"_"+z[x].counter,n.geometryGroups[X]===void 0&&(n.geometryGroups[X]={faces3:[],faces4:[],materialIndex:v,vertices:0,numMorphTargets:V})),w instanceof THREE.Face3?n.geometryGroups[X].faces3.push(t):n.geometryGroups[X].faces4.push(t),n.geometryGroups[X].vertices+=u;n.geometryGroupsList=[];t=void 0;for(t in n.geometryGroups)n.geometryGroups[t].id=la++,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=
 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())}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);Z=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(Z){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=Z;n.__vertexColorType=V;n.__normalType=z;n.__webglFaceCount=w*3;n.__webglLineCount=x*2;if(p.attributes){if(n.__webglCustomAttributesList===
+p=void 0;t.__webglMorphTargetsBuffers=[];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);X=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(X){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=X;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=
 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=
 !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=
 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?
 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||
 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,
 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,E=void 0,aa=void 0,I=void 0,oa=void 0,J=void 0,W=void 0,K=ca=aa=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=aa=void 0,T=ca=void 0,da=void 0,$=void 0,X=K=T=ma=0,ea=0,Y=P=ca=0,ia=I=M=0,F=0,S=0,ha=void 0,da=p.__vertexArray,ua=p.__uvArray,F=p.__uv2Array,ta=p.__normalArray,E=p.__tangentArray,N=p.__colorArray,O=p.__skinVertexAArray,ka=p.__skinVertexBArray,
-oa=p.__skinIndexArray,fa=p.__skinWeightArray,la=p.__morphTargetsArrays,Z=p.__webglCustomAttributesList,A=void 0,A=p.__faceArray,S=p.__lineArray,wa=p.__needsSmoothNormals,J=p.__vertexColorType,W=p.__uvType,aa=p.__normalType,ja=B.geometry,ha=ja.__dirtyElements,pa=ja.__dirtyUvs,sa=ja.__dirtyNormals,ra=ja.__dirtyTangents,Ha=ja.__dirtyColors,$=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($){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,$=la[T],$[ia]=D.x,$[ia+1]=D.y,$[ia+2]=D.z,$[ia+3]=Q.x,$[ia+4]=Q.y,$[ia+5]=Q.z,$[ia+6]=G.x,$[ia+7]=G.y,$[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,$=la[T],$[ia]=D.x,$[ia+1]=D.y,$[ia+2]=D.z,$[ia+3]=Q.x,$[ia+4]=Q.y,$[ia+5]=Q.z,$[ia+6]=G.x,$[ia+7]=G.y,$[ia+8]=G.z,$[ia+9]=ga.x,$[ia+10]=ga.y,$[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],E[P]=M.x,E[P+1]=M.y,E[P+2]=M.z,E[P+3]=M.w,E[P+4]=y.x,E[P+5]=y.y,E[P+6]=y.z,E[P+7]=y.w,E[P+8]=N.x,E[P+9]=N.y,E[P+10]=N.z,E[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],E[P]=M.x,E[P+1]=M.y,E[P+2]=M.z,E[P+3]=M.w,E[P+4]=y.x,E[P+5]=y.y,E[P+6]=y.z,E[P+7]=y.w,E[P+8]=N.x,E[P+9]=N.y,E[P+10]=N.z,E[P+
-11]=N.w,E[P+12]=J.x,E[P+13]=J.y,E[P+14]=J.z,E[P+15]=J.w,P+=16;o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer);o.bufferData(o.ARRAY_BUFFER,E,w)}if(sa&&aa){u=0;for(x=z.length;u<x;u++)if(y=qa[z[u]],E=y.vertexNormals,aa=y.normal,E.length===3&&wa)for(P=0;P<3;P++)aa=E[P],ta[ca]=aa.x,ta[ca+1]=aa.y,ta[ca+2]=aa.z,ca+=3;else for(P=0;P<3;P++)ta[ca]=aa.x,ta[ca+1]=aa.y,ta[ca+2]=aa.z,ca+=3;u=0;for(x=V.length;u<x;u++)if(y=qa[V[u]],E=y.vertexNormals,aa=y.normal,E.length===4&&wa)for(P=0;P<4;P++)aa=E[P],ta[ca]=
-aa.x,ta[ca+1]=aa.y,ta[ca+2]=aa.z,ca+=3;else for(P=0;P<4;P++)ta[ca]=aa.x,ta[ca+1]=aa.y,ta[ca+2]=aa.z,ca+=3;o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer);o.bufferData(o.ARRAY_BUFFER,ta,w)}if(pa&&Ea&&W){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&&W){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],F[X]=ca.u,F[X+1]=ca.v,X+=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],F[X]=ca.u,F[X+1]=ca.v,X+=2;X>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,F,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[Y]=ma,S[Y+1]=ma+1,S[Y+2]=ma,S[Y+3]=ma+2,S[Y+4]=ma+1,S[Y+5]=ma+2,Y+=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[Y]=ma,S[Y+1]=ma+1,S[Y+2]=ma,S[Y+3]=ma+3,S[Y+4]=ma+1,S[Y+5]=ma+2,S[Y+6]=ma+2,S[Y+7]=ma+3,Y+=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(Z){P=0;for(ma=Z.length;P<ma;P++)if(A=Z[P],A.__original.needsUpdate){S=F=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[F]=A.value[y.a],A.array[F+1]=A.value[y.b],A.array[F+2]=A.value[y.c],F+=3;u=0;for(x=V.length;u<x;u++)y=qa[V[u]],A.array[F]=A.value[y.a],A.array[F+1]=A.value[y.b],A.array[F+2]=A.value[y.c],A.array[F+3]=A.value[y.d],F+=4}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)ha=A.value[S],A.array[F]=ha,A.array[F+1]=ha,A.array[F+2]=ha,F+=3,S+=1;u=0;for(x=V.length;u<x;u++)ha=A.value[S],A.array[F]=ha,A.array[F+1]=ha,A.array[F+2]=ha,A.array[F+3]=ha,F+=4,S+=1}else{if(A.boundTo===
-"faceVertices"){u=0;for(x=z.length;u<x;u++)A.array[F]=A.value[S],A.array[F+1]=A.value[S+1],A.array[F+2]=A.value[S+2],F+=3,S+=3;u=0;for(x=V.length;u<x;u++)A.array[F]=A.value[S],A.array[F+1]=A.value[S+1],A.array[F+2]=A.value[S+2],A.array[F+3]=A.value[S+3],F+=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[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+
-5]=G.y,F+=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[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,A.array[F+6]=ga.x,A.array[F+7]=ga.y,F+=8}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ha=A.value[S],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,F+=6,S+=1;u=0;for(x=V.length;u<x;u++)ga=G=Q=D=ha=A.value[S],A.array[F]=D.x,
-A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,A.array[F+6]=ga.x,A.array[F+7]=ga.y,F+=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[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,F+=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[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+
-4]=G.x,A.array[F+5]=G.y,A.array[F+6]=ga.x,A.array[F+7]=ga.y,F+=8,S+=4}}else if(A.size===3)if(X=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[F]=D[X[0]],A.array[F+1]=D[X[1]],A.array[F+2]=D[X[2]],A.array[F+3]=Q[X[0]],A.array[F+4]=Q[X[1]],A.array[F+5]=Q[X[2]],A.array[F+6]=G[X[0]],A.array[F+7]=G[X[1]],A.array[F+8]=G[X[2]],F+=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[F]=D[X[0]],A.array[F+1]=D[X[1]],A.array[F+2]=D[X[2]],A.array[F+3]=Q[X[0]],A.array[F+4]=Q[X[1]],A.array[F+5]=Q[X[2]],A.array[F+6]=G[X[0]],A.array[F+7]=G[X[1]],A.array[F+8]=G[X[2]],A.array[F+9]=ga[X[0]],A.array[F+10]=ga[X[1]],A.array[F+11]=ga[X[2]],F+=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[F]=D[X[0]],A.array[F+1]=D[X[1]],A.array[F+2]=D[X[2]],A.array[F+3]=Q[X[0]],A.array[F+4]=Q[X[1]],A.array[F+
-5]=Q[X[2]],A.array[F+6]=G[X[0]],A.array[F+7]=G[X[1]],A.array[F+8]=G[X[2]],F+=9,S+=1;u=0;for(x=V.length;u<x;u++)ga=G=Q=D=ha=A.value[S],A.array[F]=D[X[0]],A.array[F+1]=D[X[1]],A.array[F+2]=D[X[2]],A.array[F+3]=Q[X[0]],A.array[F+4]=Q[X[1]],A.array[F+5]=Q[X[2]],A.array[F+6]=G[X[0]],A.array[F+7]=G[X[1]],A.array[F+8]=G[X[2]],A.array[F+9]=ga[X[0]],A.array[F+10]=ga[X[1]],A.array[F+11]=ga[X[2]],F+=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[F]=D[X[0]],A.array[F+1]=D[X[1]],A.array[F+2]=D[X[2]],A.array[F+3]=Q[X[0]],A.array[F+4]=Q[X[1]],A.array[F+5]=Q[X[2]],A.array[F+6]=G[X[0]],A.array[F+7]=G[X[1]],A.array[F+8]=G[X[2]],F+=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[F]=D[X[0]],A.array[F+1]=D[X[1]],A.array[F+2]=D[X[2]],A.array[F+3]=Q[X[0]],A.array[F+4]=Q[X[1]],A.array[F+5]=Q[X[2]],A.array[F+6]=G[X[0]],A.array[F+7]=G[X[1]],A.array[F+8]=G[X[2]],A.array[F+9]=ga[X[0]],A.array[F+
-10]=ga[X[1]],A.array[F+11]=ga[X[2]],F+=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[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=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[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,A.array[F+12]=ga.x,A.array[F+13]=ga.y,A.array[F+14]=ga.z,A.array[F+15]=ga.w,F+=16}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ha=A.value[S],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+
-8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=12,S+=1;u=0;for(x=V.length;u<x;u++)ga=G=Q=D=ha=A.value[S],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,A.array[F+12]=ga.x,A.array[F+13]=ga.y,A.array[F+14]=ga.z,A.array[F+15]=ga.w,F+=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[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=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[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,
-A.array[F+11]=G.w,A.array[F+12]=ga.x,A.array[F+13]=ga.y,A.array[F+14]=ga.z,A.array[F+15]=ga.w,F+=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;Z=x.length;p=t.length;z=k.__vertexArray;w=k.__colorArray;V=k.__dirtyColors;if(k.__dirtyVertices){for(v=0;v<Z;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;Z=x.length;w=p.length;z=B.__vertexArray;v=B.__colorArray;V=B.__dirtyColors;u=B.__webglCustomAttributesList;K=Y=ea=X=ma=qa=void 0;
-if(B.__dirtyVertices){for(qa=0;qa<Z;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.needsUpdate&&(K.boundTo===void 0||K.boundTo==="vertices")){t=0;ea=K.value.length;for(X=0;X<ea;X++)K.size===
-1?K.array[t]=K.value[X]:(Y=K.value[X],K.size===2?(K.array[t]=Y.x,K.array[t+1]=Y.y):K.size===3?K.type==="c"?(K.array[t]=Y.r,K.array[t+1]=Y.g,K.array[t+2]=Y.b):(K.array[t]=Y.x,K.array[t+1]=Y.y,K.array[t+2]=Y.z):(K.array[t]=Y.x,K.array[t+1]=Y.y,K.array[t+2]=Y.z,K.array[t+3]=Y.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}};
+p.__inittedArrays){var ca=x=u=void 0,y=void 0,E=void 0,aa=void 0,I=void 0,ma=void 0,K=void 0,W=void 0,J=ca=aa=K=void 0,D=void 0,Q=void 0,G=void 0,fa=void 0,M=void 0,N=y=void 0,O=y=K=void 0,ha=void 0,P=y=G=Q=D=fa=G=Q=D=fa=G=Q=D=fa=G=Q=D=I=void 0,ka=void 0,wa=aa=void 0,S=ca=void 0,ea=void 0,$=void 0,da=J=S=ka=0,qa=0,Y=P=ca=0,Z=I=M=0,F=0,T=0,ga=void 0,ea=p.__vertexArray,ia=p.__uvArray,F=p.__uv2Array,wa=p.__normalArray,E=p.__tangentArray,N=p.__colorArray,O=p.__skinVertexAArray,ha=p.__skinVertexBArray,
+ma=p.__skinIndexArray,pa=p.__skinWeightArray,na=p.__morphTargetsArrays,X=p.__webglCustomAttributesList,A=void 0,A=p.__faceArray,T=p.__lineArray,ja=p.__needsSmoothNormals,K=p.__vertexColorType,W=p.__uvType,aa=p.__normalType,ua=B.geometry,ga=ua.__dirtyElements,oa=ua.__dirtyUvs,ra=ua.__dirtyNormals,va=ua.__dirtyTangents,sa=ua.__dirtyColors,$=ua.__dirtyMorphTargets,Da=ua.vertices,z=p.faces3,V=p.faces4,ta=ua.faces,Ca=ua.faceVertexUvs[0],Ga=ua.faceVertexUvs[1],Aa=ua.skinVerticesA,za=ua.skinVerticesB,Ha=
+ua.skinIndices,Ea=ua.skinWeights,ya=ua.morphTargets;if(ua.__dirtyVertices){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=Da[y.a].position,Q=Da[y.b].position,G=Da[y.c].position,ea[S]=D.x,ea[S+1]=D.y,ea[S+2]=D.z,ea[S+3]=Q.x,ea[S+4]=Q.y,ea[S+5]=Q.z,ea[S+6]=G.x,ea[S+7]=G.y,ea[S+8]=G.z,S+=9;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],D=Da[y.a].position,Q=Da[y.b].position,G=Da[y.c].position,fa=Da[y.d].position,ea[S]=D.x,ea[S+1]=D.y,ea[S+2]=D.z,ea[S+3]=Q.x,ea[S+4]=Q.y,ea[S+5]=Q.z,ea[S+6]=G.x,ea[S+7]=G.y,ea[S+8]=G.z,
+ea[S+9]=fa.x,ea[S+10]=fa.y,ea[S+11]=fa.z,S+=12;o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,ea,w)}if($){u=0;for(x=z.length;u<x;u++){y=ta[z[u]];S=0;for(ea=ya.length;S<ea;S++)D=ya[S].vertices[y.a].position,Q=ya[S].vertices[y.b].position,G=ya[S].vertices[y.c].position,$=na[S],$[Z]=D.x,$[Z+1]=D.y,$[Z+2]=D.z,$[Z+3]=Q.x,$[Z+4]=Q.y,$[Z+5]=Q.z,$[Z+6]=G.x,$[Z+7]=G.y,$[Z+8]=G.z;Z+=9}u=0;for(x=V.length;u<x;u++){y=ta[V[u]];S=0;for(ea=ya.length;S<ea;S++)D=ya[S].vertices[y.a].position,
+Q=ya[S].vertices[y.b].position,G=ya[S].vertices[y.c].position,fa=ya[S].vertices[y.d].position,$=na[S],$[Z]=D.x,$[Z+1]=D.y,$[Z+2]=D.z,$[Z+3]=Q.x,$[Z+4]=Q.y,$[Z+5]=Q.z,$[Z+6]=G.x,$[Z+7]=G.y,$[Z+8]=G.z,$[Z+9]=fa.x,$[Z+10]=fa.y,$[Z+11]=fa.z;Z+=12}S=0;for(ea=ya.length;S<ea;S++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[S]),o.bufferData(o.ARRAY_BUFFER,na[S],w)}if(Ea.length){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=Ea[y.a],Q=Ea[y.b],G=Ea[y.c],pa[I]=D.x,pa[I+1]=D.y,pa[I+2]=D.z,pa[I+3]=D.w,pa[I+
+4]=Q.x,pa[I+5]=Q.y,pa[I+6]=Q.z,pa[I+7]=Q.w,pa[I+8]=G.x,pa[I+9]=G.y,pa[I+10]=G.z,pa[I+11]=G.w,D=Ha[y.a],Q=Ha[y.b],G=Ha[y.c],ma[I]=D.x,ma[I+1]=D.y,ma[I+2]=D.z,ma[I+3]=D.w,ma[I+4]=Q.x,ma[I+5]=Q.y,ma[I+6]=Q.z,ma[I+7]=Q.w,ma[I+8]=G.x,ma[I+9]=G.y,ma[I+10]=G.z,ma[I+11]=G.w,D=Aa[y.a],Q=Aa[y.b],G=Aa[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=za[y.a],Q=za[y.b],G=za[y.c],ha[I]=D.x,ha[I+1]=D.y,ha[I+2]=D.z,ha[I+3]=1,ha[I+
+4]=Q.x,ha[I+5]=Q.y,ha[I+6]=Q.z,ha[I+7]=1,ha[I+8]=G.x,ha[I+9]=G.y,ha[I+10]=G.z,ha[I+11]=1,I+=12;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],D=Ea[y.a],Q=Ea[y.b],G=Ea[y.c],fa=Ea[y.d],pa[I]=D.x,pa[I+1]=D.y,pa[I+2]=D.z,pa[I+3]=D.w,pa[I+4]=Q.x,pa[I+5]=Q.y,pa[I+6]=Q.z,pa[I+7]=Q.w,pa[I+8]=G.x,pa[I+9]=G.y,pa[I+10]=G.z,pa[I+11]=G.w,pa[I+12]=fa.x,pa[I+13]=fa.y,pa[I+14]=fa.z,pa[I+15]=fa.w,D=Ha[y.a],Q=Ha[y.b],G=Ha[y.c],fa=Ha[y.d],ma[I]=D.x,ma[I+1]=D.y,ma[I+2]=D.z,ma[I+3]=D.w,ma[I+4]=Q.x,ma[I+5]=Q.y,ma[I+6]=Q.z,ma[I+
+7]=Q.w,ma[I+8]=G.x,ma[I+9]=G.y,ma[I+10]=G.z,ma[I+11]=G.w,ma[I+12]=fa.x,ma[I+13]=fa.y,ma[I+14]=fa.z,ma[I+15]=fa.w,D=Aa[y.a],Q=Aa[y.b],G=Aa[y.c],fa=Aa[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]=fa.x,O[I+13]=fa.y,O[I+14]=fa.z,O[I+15]=1,D=za[y.a],Q=za[y.b],G=za[y.c],y=za[y.d],ha[I]=D.x,ha[I+1]=D.y,ha[I+2]=D.z,ha[I+3]=1,ha[I+4]=Q.x,ha[I+5]=Q.y,ha[I+6]=Q.z,ha[I+7]=1,ha[I+8]=G.x,ha[I+9]=G.y,ha[I+10]=G.z,ha[I+
+11]=1,ha[I+12]=y.x,ha[I+13]=y.y,ha[I+14]=y.z,ha[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,ha,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ma,w),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,pa,w))}if(sa&&K){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],I=y.vertexColors,ma=y.color,
+I.length===3&&K===THREE.VertexColors?(y=I[0],O=I[1],ha=I[2]):ha=O=y=ma,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]=ha.r,N[M+7]=ha.g,N[M+8]=ha.b,M+=9;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],I=y.vertexColors,ma=y.color,I.length===4&&K===THREE.VertexColors?(y=I[0],O=I[1],ha=I[2],I=I[3]):I=ha=O=y=ma,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]=ha.r,N[M+7]=ha.g,N[M+8]=ha.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(va&&ua.hasTangents){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],K=y.vertexTangents,M=K[0],y=K[1],N=K[2],E[P]=M.x,E[P+1]=M.y,E[P+2]=M.z,E[P+3]=M.w,E[P+4]=y.x,E[P+5]=y.y,E[P+6]=y.z,E[P+7]=y.w,E[P+8]=N.x,E[P+9]=N.y,E[P+10]=N.z,E[P+11]=N.w,P+=12;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],K=y.vertexTangents,M=K[0],y=K[1],N=K[2],K=K[3],E[P]=M.x,E[P+1]=M.y,E[P+2]=M.z,E[P+3]=M.w,E[P+4]=y.x,E[P+5]=y.y,E[P+6]=y.z,E[P+7]=y.w,E[P+8]=N.x,E[P+9]=N.y,E[P+10]=N.z,E[P+11]=N.w,E[P+12]=K.x,
+E[P+13]=K.y,E[P+14]=K.z,E[P+15]=K.w,P+=16;o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer);o.bufferData(o.ARRAY_BUFFER,E,w)}if(ra&&aa){u=0;for(x=z.length;u<x;u++)if(y=ta[z[u]],E=y.vertexNormals,aa=y.normal,E.length===3&&ja)for(P=0;P<3;P++)aa=E[P],wa[ca]=aa.x,wa[ca+1]=aa.y,wa[ca+2]=aa.z,ca+=3;else for(P=0;P<3;P++)wa[ca]=aa.x,wa[ca+1]=aa.y,wa[ca+2]=aa.z,ca+=3;u=0;for(x=V.length;u<x;u++)if(y=ta[V[u]],E=y.vertexNormals,aa=y.normal,E.length===4&&ja)for(P=0;P<4;P++)aa=E[P],wa[ca]=aa.x,wa[ca+1]=aa.y,
+wa[ca+2]=aa.z,ca+=3;else for(P=0;P<4;P++)wa[ca]=aa.x,wa[ca+1]=aa.y,wa[ca+2]=aa.z,ca+=3;o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer);o.bufferData(o.ARRAY_BUFFER,wa,w)}if(oa&&Ca&&W){u=0;for(x=z.length;u<x;u++)if(ca=z[u],ca=Ca[ca],ca!==void 0)for(P=0;P<3;P++)wa=ca[P],ia[J]=wa.u,ia[J+1]=wa.v,J+=2;u=0;for(x=V.length;u<x;u++)if(ca=V[u],ca=Ca[ca],ca!==void 0)for(P=0;P<4;P++)wa=ca[P],ia[J]=wa.u,ia[J+1]=wa.v,J+=2;J>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,ia,w))}if(oa&&
+Ga&&W){u=0;for(x=z.length;u<x;u++)if(ca=z[u],J=Ga[ca],J!==void 0)for(P=0;P<3;P++)ca=J[P],F[da]=ca.u,F[da+1]=ca.v,da+=2;u=0;for(x=V.length;u<x;u++)if(ca=V[u],J=Ga[ca],J!==void 0)for(P=0;P<4;P++)ca=J[P],F[da]=ca.u,F[da+1]=ca.v,da+=2;da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,F,w))}if(ga){u=0;for(x=z.length;u<x;u++)A[qa]=ka,A[qa+1]=ka+1,A[qa+2]=ka+2,qa+=3,T[Y]=ka,T[Y+1]=ka+1,T[Y+2]=ka,T[Y+3]=ka+2,T[Y+4]=ka+1,T[Y+5]=ka+2,Y+=6,ka+=3;u=0;for(x=V.length;u<x;u++)A[qa]=
+ka,A[qa+1]=ka+1,A[qa+2]=ka+3,A[qa+3]=ka+1,A[qa+4]=ka+2,A[qa+5]=ka+3,qa+=6,T[Y]=ka,T[Y+1]=ka+1,T[Y+2]=ka,T[Y+3]=ka+3,T[Y+4]=ka+1,T[Y+5]=ka+2,T[Y+6]=ka+2,T[Y+7]=ka+3,Y+=8,ka+=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,T,w)}if(X){P=0;for(ka=X.length;P<ka;P++)if(A=X[P],A.__original.needsUpdate){T=F=0;if(A.size===1)if(A.boundTo===void 0||A.boundTo==="vertices"){u=
+0;for(x=z.length;u<x;u++)y=ta[z[u]],A.array[F]=A.value[y.a],A.array[F+1]=A.value[y.b],A.array[F+2]=A.value[y.c],F+=3;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],A.array[F]=A.value[y.a],A.array[F+1]=A.value[y.b],A.array[F+2]=A.value[y.c],A.array[F+3]=A.value[y.d],F+=4}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)ga=A.value[T],A.array[F]=ga,A.array[F+1]=ga,A.array[F+2]=ga,F+=3,T+=1;u=0;for(x=V.length;u<x;u++)ga=A.value[T],A.array[F]=ga,A.array[F+1]=ga,A.array[F+2]=ga,A.array[F+3]=ga,F+=4,T+=1}else{if(A.boundTo===
+"faceVertices"){u=0;for(x=z.length;u<x;u++)A.array[F]=A.value[T],A.array[F+1]=A.value[T+1],A.array[F+2]=A.value[T+2],F+=3,T+=3;u=0;for(x=V.length;u<x;u++)A.array[F]=A.value[T],A.array[F+1]=A.value[T+1],A.array[F+2]=A.value[T+2],A.array[F+3]=A.value[T+3],F+=4,T+=4}}else if(A.size===2)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+
+5]=G.y,F+=6;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],fa=A.value[y.d],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,A.array[F+6]=fa.x,A.array[F+7]=fa.y,F+=8}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ga=A.value[T],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,F+=6,T+=1;u=0;for(x=V.length;u<x;u++)fa=G=Q=D=ga=A.value[T],A.array[F]=D.x,
+A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,A.array[F+6]=fa.x,A.array[F+7]=fa.y,F+=8,T+=1}else{if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+4]=G.x,A.array[F+5]=G.y,F+=6,T+=3;u=0;for(x=V.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],fa=A.value[T+3],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=Q.x,A.array[F+3]=Q.y,A.array[F+
+4]=G.x,A.array[F+5]=G.y,A.array[F+6]=fa.x,A.array[F+7]=fa.y,F+=8,T+=4}}else if(A.size===3)if(da=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=ta[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],F+=9;u=0;for(x=V.length;u<x;u++)y=ta[V[u]],
+D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],fa=A.value[y.d],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],A.array[F+9]=fa[da[0]],A.array[F+10]=fa[da[1]],A.array[F+11]=fa[da[2]],F+=12,T+=1}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ga=A.value[T],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],
+A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],F+=9,T+=1;u=0;for(x=V.length;u<x;u++)fa=G=Q=D=ga=A.value[T],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],A.array[F+9]=fa[da[0]],A.array[F+10]=fa[da[1]],A.array[F+11]=fa[da[2]],F+=12,T+=1}else{if(A.boundTo==="faceVertices"){u=0;for(x=z.length;u<
+x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+7]=G[da[1]],A.array[F+8]=G[da[2]],F+=9,T+=3;u=0;for(x=V.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],fa=A.value[T+3],A.array[F]=D[da[0]],A.array[F+1]=D[da[1]],A.array[F+2]=D[da[2]],A.array[F+3]=Q[da[0]],A.array[F+4]=Q[da[1]],A.array[F+5]=Q[da[2]],A.array[F+6]=G[da[0]],A.array[F+
+7]=G[da[1]],A.array[F+8]=G[da[2]],A.array[F+9]=fa[da[0]],A.array[F+10]=fa[da[1]],A.array[F+11]=fa[da[2]],F+=12,T+=4}}else if(A.size===4)if(A.boundTo===void 0||A.boundTo==="vertices"){u=0;for(x=z.length;u<x;u++)y=ta[z[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=12;u=0;for(x=V.length;u<x;u++)y=
+ta[V[u]],D=A.value[y.a],Q=A.value[y.b],G=A.value[y.c],fa=A.value[y.d],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,A.array[F+12]=fa.x,A.array[F+13]=fa.y,A.array[F+14]=fa.z,A.array[F+15]=fa.w,F+=16}else if(A.boundTo==="faces"){u=0;for(x=z.length;u<x;u++)G=Q=D=ga=A.value[T],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+
+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=12,T+=1;u=0;for(x=V.length;u<x;u++)fa=G=Q=D=ga=A.value[T],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,A.array[F+12]=fa.x,A.array[F+13]=fa.y,A.array[F+14]=fa.z,A.array[F+15]=fa.w,F+=16,T+=1}else if(A.boundTo==="faceVertices"){u=
+0;for(x=z.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,F+=12,T+=3;u=0;for(x=V.length;u<x;u++)D=A.value[T],Q=A.value[T+1],G=A.value[T+2],fa=A.value[T+3],A.array[F]=D.x,A.array[F+1]=D.y,A.array[F+2]=D.z,A.array[F+3]=D.w,A.array[F+4]=Q.x,A.array[F+5]=Q.y,A.array[F+6]=Q.z,A.array[F+7]=Q.w,
+A.array[F+8]=G.x,A.array[F+9]=G.y,A.array[F+10]=G.z,A.array[F+11]=G.w,A.array[F+12]=fa.x,A.array[F+13]=fa.y,A.array[F+14]=fa.z,A.array[F+15]=fa.w,F+=16,T+=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=x.length;p=t.length;z=k.__vertexArray;w=k.__colorArray;V=k.__dirtyColors;if(k.__dirtyVertices){for(v=0;v<X;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=ka=x=ta=void 0;x=B.vertices;p=B.colors;X=x.length;w=p.length;z=B.__vertexArray;v=B.__colorArray;V=B.__dirtyColors;
+u=B.__webglCustomAttributesList;J=Y=qa=da=ka=ta=void 0;if(B.__dirtyVertices){for(ta=0;ta<X;ta++)ka=x[ta].position,t=ta*3,z[t]=ka.x,z[t+1]=ka.y,z[t+2]=ka.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){ta=0;for(ka=u.length;ta<ka;ta++)if(J=u[ta],J.needsUpdate&&(J.boundTo===void 0||J.boundTo===
+"vertices")){t=0;qa=J.value.length;if(J.size===1)for(da=0;da<qa;da++)J.array[da]=J.value[da];else if(J.size===2)for(da=0;da<qa;da++)Y=J.value[da],J.array[t]=Y.x,J.array[t+1]=Y.y,t+=2;else if(J.size===3)if(J.type==="c")for(da=0;da<qa;da++)Y=J.value[da],J.array[t]=Y.r,J.array[t+1]=Y.g,J.array[t+2]=Y.b,t+=3;else for(da=0;da<qa;da++)Y=J.value[da],J.array[t]=Y.x,J.array[t+1]=Y.y,J.array[t+2]=Y.z,t+=3;else if(J.size===4)for(da=0;da<qa;da++)Y=J.value[da],J.array[t]=Y.x,J.array[t+1]=Y.y,J.array[t+2]=Y.z,
+J.array[t+3]=Y.w,t+=4;o.bindBuffer(o.ARRAY_BUFFER,J.buffer);o.bufferData(o.ARRAY_BUFFER,J.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 Ea}};
 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.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.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};
 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};
@@ -502,13 +503,13 @@ this.vertices[b].position.clone().setY(0).normalize(),u=this.vertices[p].positio
 H=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([E,C,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
 H=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(b,p,x,[z,u,B])),this.faceVertexUvs[0].push([E,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=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();
 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;){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 h(a,b,c){K.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(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,E=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=E?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);E=z;D=0;for(O=x.length;D<O;D++)R=x[D],z=z.concat(R);var J,M,ea,ja,Y,U,o=z.length,P=u.length,pa=[];J=0;M=E.length;na=M-1;for(la=J+1;J<M;J++,na++,la++)na===M&&(na=0),la===M&&(la=0),pa[J]=e(E[J],E[na],E[la]);var G=[],W,$=pa.concat();D=0;for(O=x.length;D<O;D++){R=x[D];W=[];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),W[J]=e(R[J],R[na],R[la]);G.push(W);$=$.concat(W)}for(ea=0;ea<v;ea++){ja=ea/v;Y=n*(1-
-ja);ja=t*Math.sin(ja*Math.PI/2);J=0;for(M=E.length;J<M;J++)U=b(E[J],pa[J],ja),h(U.x,U.y,-Y);D=0;for(O=x.length;D<O;D++){R=x[D];W=G[D];J=0;for(M=R.length;J<M;J++)U=b(R[J],W[J],ja),h(U.x,U.y,-Y)}}ja=t;for(J=0;J<o;J++)U=p?b(z[J],$[J],ja):z[J],y?h(U.x,U.y+B[0].y,B[0].x):h(U.x,U.y,0);for(ea=1;ea<=w;ea++)for(J=0;J<o;J++)U=p?b(z[J],$[J],ja):z[J],y?h(U.x,U.y+B[ea-1].y,B[ea-1].x):h(U.x,U.y,k/w*ea);for(ea=v-1;ea>=0;ea--){ja=ea/v;Y=n*(1-ja);ja=t*Math.sin(ja*Math.PI/2);J=0;for(M=E.length;J<M;J++)U=b(E[J],pa[J],
-ja),h(U.x,U.y,k+Y);D=0;for(O=x.length;D<O;D++){R=x[D];W=G[D];J=0;for(M=R.length;J<M;J++)U=b(R[J],W[J],ja),y?h(U.x,U.y+B[w-1].y,B[w-1].x+Y):h(U.x,U.y,k+Y)}}if(p){p=o*0;for(J=0;J<P;J++)t=u[J],f(t[2]+p,t[1]+p,t[0]+p);p=o*(w+v*2);for(J=0;J<P;J++)t=u[J],f(t[0]+p,t[1]+p,t[2]+p)}else{for(J=0;J<P;J++)t=u[J],f(t[2],t[1],t[0]);for(J=0;J<P;J++)t=u[J],f(t[0]+o*w,t[1]+o*w,t[2]+o*w)}var na,la,ra=0;l(E);ra+=E.length;D=0;for(O=x.length;D<O;D++)R=x[D],l(R),ra+=R.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(K=a.length;--K>=0;){la=K;ja=K-1;ja<0&&(ja=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=sa+la+e,l=sa+la+f,p=h,e=sa+ja+e,f=sa+ja+f,t=l;p+=N;e+=N;f+=N;t+=N;J.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=(J.vertices[h].position.z+n)/f,l=(J.vertices[l].position.z+n)/f,J.faceVertexUvs[0].push([new THREE.UV(h,p),new THREE.UV(l,p),new THREE.UV(l,e),new THREE.UV(h,e)]))}}}function h(a,b,c){J.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=N;b+=N;c+=N;J.faces.push(new THREE.Face3(a,
+b,c,null,null,C));if(C){var e=L.maxY,f=L.maxX,h=J.vertices[b].position.x,b=J.vertices[b].position.y,k=J.vertices[c].position.x,c=J.vertices[c].position.y;J.faceVertexUvs[0].push([new THREE.UV(J.vertices[a].position.x/f,J.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,E=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,J=this,N=this.vertices.length;z&&a.addWrapPath(z);x=E?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);E=z;D=0;for(O=x.length;D<O;D++)R=x[D],z=z.concat(R);var K,M,Y,oa,Z,U,o=z.length,P=u.length,ra=[];K=0;M=E.length;la=M-1;for(ja=K+1;K<M;K++,la++,ja++)la===M&&(la=0),ja===M&&(ja=0),ra[K]=e(E[K],E[la],E[ja]);var G=[],W,$=ra.concat();D=0;for(O=x.length;D<O;D++){R=x[D];W=[];K=0;M=R.length;la=M-1;for(ja=K+1;K<M;K++,la++,ja++)la===M&&(la=0),ja===M&&(ja=0),W[K]=e(R[K],R[la],R[ja]);G.push(W);$=$.concat(W)}for(Y=0;Y<v;Y++){oa=Y/v;Z=n*(1-oa);oa=
+t*Math.sin(oa*Math.PI/2);K=0;for(M=E.length;K<M;K++)U=b(E[K],ra[K],oa),h(U.x,U.y,-Z);D=0;for(O=x.length;D<O;D++){R=x[D];W=G[D];K=0;for(M=R.length;K<M;K++)U=b(R[K],W[K],oa),h(U.x,U.y,-Z)}}oa=t;for(K=0;K<o;K++)U=p?b(z[K],$[K],oa):z[K],y?h(U.x,U.y+B[0].y,B[0].x):h(U.x,U.y,0);for(Y=1;Y<=w;Y++)for(K=0;K<o;K++)U=p?b(z[K],$[K],oa):z[K],y?h(U.x,U.y+B[Y-1].y,B[Y-1].x):h(U.x,U.y,k/w*Y);for(Y=v-1;Y>=0;Y--){oa=Y/v;Z=n*(1-oa);oa=t*Math.sin(oa*Math.PI/2);K=0;for(M=E.length;K<M;K++)U=b(E[K],ra[K],oa),h(U.x,U.y,
+k+Z);D=0;for(O=x.length;D<O;D++){R=x[D];W=G[D];K=0;for(M=R.length;K<M;K++)U=b(R[K],W[K],oa),y?h(U.x,U.y+B[w-1].y,B[w-1].x+Z):h(U.x,U.y,k+Z)}}if(p){p=o*0;for(K=0;K<P;K++)t=u[K],f(t[2]+p,t[1]+p,t[0]+p);p=o*(w+v*2);for(K=0;K<P;K++)t=u[K],f(t[0]+p,t[1]+p,t[2]+p)}else{for(K=0;K<P;K++)t=u[K],f(t[2],t[1],t[0]);for(K=0;K<P;K++)t=u[K],f(t[0]+o*w,t[1]+o*w,t[2]+o*w)}var la,ja,sa=0;l(E);sa+=E.length;D=0;for(O=x.length;D<O;D++)R=x[D],l(R),sa+=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.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,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 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,h=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var n=e(h.faces[k].a,h.faces[k].b),t=e(h.faces[k].b,h.faces[k].c),v=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,n,v,a);b(h.faces[k].b,t,
 -a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,h);b(0,5,1,h);b(0,1,7,h);b(0,7,10,h);b(0,10,11,h);b(1,5,9,h);b(5,11,4,h);b(11,10,2,h);b(10,7,6,h);b(7,1,8,h);b(3,9,4,h);b(3,4,2,h);b(3,2,6,h);b(3,6,8,h);b(3,8,9,h);b(4,9,5,h);b(2,4,11,h);b(6,2,10,h);b(8,6,7,h);b(9,8,1,h);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,k;for(k in h.faces){var n=e(h.faces[k].a,h.faces[k].b),t=e(h.faces[k].b,h.faces[k].c),v=e(h.faces[k].c,h.faces[k].a);b(h.faces[k].a,n,v,a);b(h.faces[k].b,t,
@@ -532,7 +533,7 @@ this.getFace(),b=this.size/c.resolution,e=0,l=String(a).split(""),h=l.length,f=[
 t));l.moveTo(k,t);break;case "l":k=c[a++]*b+e;t=c[a++]*b;h.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(f=h[h.length-1]){v=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var y=f/divisions,E=THREE.Shape.Utils.b2(y,v,x,k),y=THREE.Shape.Utils.b2(y,p,w,t);h.push(new THREE.Vector2(E,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,
 t));l.moveTo(k,t);break;case "l":k=c[a++]*b+e;t=c[a++]*b;h.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(f=h[h.length-1]){v=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++){var y=f/divisions,E=THREE.Shape.Utils.b2(y,v,x,k),y=THREE.Shape.Utils.b2(y,p,w,t);h.push(new THREE.Vector2(E,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),f=h[h.length-1]){v=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)y=f/divisions,E=THREE.Shape.Utils.b3(y,v,x,z,k),y=THREE.Shape.Utils.b3(y,p,w,u,t),h.push(new THREE.Vector2(E,y))}}}return{offset:B.ha*b,points:h,path:l}}}};
 x,w,z,u),f=h[h.length-1]){v=f.x;p=f.y;f=1;for(divisions=this.divisions;f<=divisions;f++)y=f/divisions,E=THREE.Shape.Utils.b3(y,v,x,z,k),y=THREE.Shape.Utils.b3(y,p,w,u,t),h.push(new THREE.Vector2(E,y))}}}return{offset:B.ha*b,points:h,path:l}}}};
 (function(a){var c=function(a){for(var c=a.length,l=0,h=c-1,f=0;f<c;h=f++)l+=a[h].x*a[f].y-a[f].x*a[h].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var h=[],f=[],k=[],n,t,v;if(c(a)>0)for(t=0;t<l;t++)f[t]=t;else for(t=0;t<l;t++)f[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 h}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=f,E=void 0,C=void 0,H=void 0,
 (function(a){var c=function(a){for(var c=a.length,l=0,h=c-1,f=0;f<c;h=f++)l+=a[h].x*a[f].y-a[f].x*a[h].y;return l*0.5};a.Triangulate=function(a,e){var l=a.length;if(l<3)return null;var h=[],f=[],k=[],n,t,v;if(c(a)>0)for(t=0;t<l;t++)f[t]=t;else for(t=0;t<l;t++)f[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 h}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=f,E=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(E=0;E<B;E++)if(!(E==w||E==z||E==u)){var K=x[y[E]].x,N=x[y[E]].y,J=void 0,M=void 0,ea=void 0,ja=void 0,Y=void 0,U=void 0,o=void 0,P=void 0,pa=void 0,G=void 0,W=void 0,$=void 0,J=ea=Y=void 0,J=D-L,M=O-R,ea=C-D,ja=H-O,Y=L-C,U=R-H,o=K-C,P=N-H,pa=K-L,G=N-R,W=K-D,$=N-O,J=J*G-M*pa,Y=Y*P-U*o,ea=ea*$-ja*W;if(J>=0&&ea>=0&&Y>=0){x=!1;break a}}x=
+L=void 0,R=void 0,D=void 0,O=void 0,J=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(E=0;E<B;E++)if(!(E==w||E==z||E==u)){var J=x[y[E]].x,N=x[y[E]].y,K=void 0,M=void 0,Y=void 0,oa=void 0,Z=void 0,U=void 0,o=void 0,P=void 0,ra=void 0,G=void 0,W=void 0,$=void 0,K=Y=Z=void 0,K=D-L,M=O-R,Y=C-D,oa=H-O,Z=L-C,U=R-H,o=J-C,P=N-H,ra=J-L,G=N-R,W=J-D,$=N-O,K=K*G-M*ra,Z=Z*P-U*o,Y=Y*$-oa*W;if(K>=0&&Y>=0&&Z>=0){x=!1;break a}}x=
 !0}}if(x){h.push([a[f[n]],a[f[t]],a[f[v]]]);k.push([f[n],f[t],f[v]]);n=t;for(v=t+1;v<l;n++,v++)f[n]=f[v];l--;p=2*l}}if(e)return k;return h};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 !0}}if(x){h.push([a[f[n]],a[f[t]],a[f[v]]]);k.push([f[n],f[t],f[v]]);n=t;for(v=t+1;v<l;n++,v++)f[n]=f[v];l--;p=2*l}}if(e)return k;return h};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 h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;l.x=this.radius*Math.cos(h);l.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
 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 h=e/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;l.x=this.radius*Math.cos(h);l.y=this.radius*Math.sin(h);var k=new THREE.Vector3;k.x=(this.radius+this.tube*Math.cos(f))*Math.cos(h);k.y=(this.radius+this.tube*Math.cos(f))*Math.sin(h);k.z=
 this.tube*Math.sin(f);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,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,n=new THREE.Face4(l,h,f,k,[c[l],c[h],c[f],c[k]]);n.normal.addSelf(c[l]);n.normal.addSelf(c[h]);n.normal.addSelf(c[f]);n.normal.addSelf(c[k]);n.normal.normalize();this.faces.push(n);
 this.tube*Math.sin(f);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,h=(this.segmentsT+1)*(b-1)+e-1,f=(this.segmentsT+1)*(b-1)+e,k=(this.segmentsT+1)*b+e,n=new THREE.Face4(l,h,f,k,[c[l],c[h],c[f],c[k]]);n.normal.addSelf(c[l]);n.normal.addSelf(c[h]);n.normal.addSelf(c[f]);n.normal.addSelf(c[k]);n.normal.normalize();this.faces.push(n);
@@ -543,11 +544,11 @@ l.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var e=(a+1)
 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)};
 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(f.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);(!f.supportUVs||x.length!=0)&&h.push([x[a],x[b],x[c],x[e]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(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(f.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);(!f.supportUVs||x.length!=0)&&h.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=[],h=[],f=this,k=a.vertices,e=a.faces,n=k.concat(),t=[],v={},p={},x=[],w,z,u,B,y,E=a.faceVertexUvs[0];w=0;for(z=E.length;w<z;w++){u=0;for(B=E[w].length;u<B;u++)y=e[w]["abcd".charAt(u)],x[y]||(x[y]=E[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)),f.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=
 b)}var e=[],l=[],h=[],f=this,k=a.vertices,e=a.faces,n=k.concat(),t=[],v={},p={},x=[],w,z,u,B,y,E=a.faceVertexUvs[0];w=0;for(z=E.length;w<z;w++){u=0;for(B=E[w].length;u<B;u++)y=e[w]["abcd".charAt(u)],x[y]||(x[y]=E[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)),f.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,E=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]=E+e.length+H,n.push(new THREE.Vertex(B)),H++,f.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"],Y=["1234","41","1","12"];w=0;for(z=t.length;w<z;w++)y=e[w],C=E+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,Y)):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;E=D[w].length;for(u=0;u<E;u++)p[b(D[w][u][0],D[w][u][1])]&&H++;if(H!=2){n.divideScalar(C);for(u=
-0;u<E;u++)C=D[w][u],C=k[C[0]].position.clone().addSelf(k[C[1]].position).divideScalar(2),v.addSelf(C);v.divideScalar(E);y.addSelf(k[w].position);y.multiplyScalar(E-3);y.addSelf(n);y.addSelf(v.multiplyScalar(2));y.divideScalar(E);e[w].position=y}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=h;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
+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,E=k.length,L,R,D={},O={},J=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];J(R,[R,L]);J(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]=E+e.length+H,n.push(new THREE.Vertex(B)),H++,f.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 K,M;L=["123","12","2","23"];B=["123","23","3","31"];var J=["123","31","1","12"],N=["1234","12","2","23"],Y=["1234","23","3","34"],oa=["1234","34","4","41"],Z=["1234","41","1","12"];w=0;for(z=t.length;w<z;w++)y=e[w],C=E+w,y instanceof THREE.Face3?(H=b(y.a,y.b),R=b(y.b,y.c),K=b(y.c,y.a),c(C,v[H],y.b,v[R],y,L),c(C,v[R],y.c,v[K],y,B),c(C,v[K],y.a,v[H],
+y,J)):y instanceof THREE.Face4?(H=b(y.a,y.b),R=b(y.b,y.c),K=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[K],y,Y),c(C,v[K],y.d,v[M],y,oa),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;E=D[w].length;for(u=0;u<E;u++)p[b(D[w][u][0],D[w][u][1])]&&H++;if(H!=2){n.divideScalar(C);for(u=0;u<
+E;u++)C=D[w][u],C=k[C[0]].position.clone().addSelf(k[C[1]].position).divideScalar(2),v.addSelf(C);v.divideScalar(E);y.addSelf(k[w].position);y.multiplyScalar(E-3);y.addSelf(n);y.addSelf(v.multiplyScalar(2));y.divideScalar(E);e[w].position=y}}a.vertices=e;a.faces=l;a.faceVertexUvs[0]=h;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=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/
 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)==
 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)==
@@ -563,34 +564,34 @@ c,e,b,h)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,l,h){var f=new XMLHttpRequest,k=e+"/"+a,n=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,l,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(n==0&&(n=f.getResponseHeader("Content-Length")),h({total:n,loaded:f.responseText.length})):f.readyState==2&&(n=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,e,l,h){var f=new XMLHttpRequest,k=e+"/"+a,n=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,l,c):alert("Couldn't load ["+k+"] ["+f.status+"]"):f.readyState==3?h&&(n==0&&(n=f.getResponseHeader("Content-Length")),h({total:n,loaded:f.responseText.length})):f.readyState==2&&(n=f.getResponseHeader("Content-Length"))};f.open("GET",k,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 f.setRequestHeader("Content-Type","text/plain");f.send(null)};
 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,
 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+Y);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+Y);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 Z=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,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+W);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+$);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,E=0,C,H=[],L=[],
-R,D,O,K,N,J,M,ea,ja,Y,U,o,P,pa,G,W,$,na,la,ra,ia,da,S,fa,ha;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);C={signature:a.substr(E,8),header_bytes:v(a,E+8),vertex_coordinate_bytes:v(a,E+9),normal_coordinate_bytes:v(a,E+10),uv_coordinate_bytes:v(a,E+11),vertex_index_bytes:v(a,E+12),normal_index_bytes:v(a,E+13),uv_index_bytes:v(a,E+14),material_index_bytes:v(a,E+15),nvertices:k(a,E+16),nnormals:k(a,E+16+4),nuvs:k(a,E+16+8),ntri_flat:k(a,E+16+12),ntri_smooth:k(a,E+16+16),ntri_flat_uv:k(a,
-E+16+20),ntri_smooth_uv:k(a,E+16+24),nquad_flat:k(a,E+16+28),nquad_smooth:k(a,E+16+32),nquad_flat_uv:k(a,E+16+36),nquad_smooth_uv:k(a,E+16+40)};E+=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;Y=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;W=C.uv_index_bytes*2;$=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);E+=function(b){for(var e,h,k,l=C.vertex_coordinate_bytes*3,n=b+C.nvertices*l;b<n;b+=l)e=c(a,b),h=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,h,k)));return C.nvertices*l}(E);E+=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}(E);E+=function(b){for(var e,h,k=C.uv_coordinate_bytes*2,l=b+C.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+C.uv_coordinate_bytes),L.push(e,h);return C.nuvs*k}(E);ra=E+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})(E);(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",f,"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",Y,"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(h(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,
+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+J);p=k(a,b+N);t=k(a,b+K);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+Y);h=k(a,b+oa);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+Y);h=k(a,b+oa);p=l(a,b+Z);t=k(a,b+U);u=k(a,b+o);v=k(a,b+P);w=k(a,b+ra);var b=H[u*3],x=H[u*3+1];u=H[u*3+2];var X=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(X,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+W);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+$);f=k(a,b+la);h=k(a,b+ja);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,E=0,C,H=[],L=[],
+R,D,O,J,N,K,M,Y,oa,Z,U,o,P,ra,G,W,$,la,ja,sa,T,ea,ga,na,ia;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(y,e,b);C={signature:a.substr(E,8),header_bytes:v(a,E+8),vertex_coordinate_bytes:v(a,E+9),normal_coordinate_bytes:v(a,E+10),uv_coordinate_bytes:v(a,E+11),vertex_index_bytes:v(a,E+12),normal_index_bytes:v(a,E+13),uv_index_bytes:v(a,E+14),material_index_bytes:v(a,E+15),nvertices:k(a,E+16),nnormals:k(a,E+16+4),nuvs:k(a,E+16+8),ntri_flat:k(a,E+16+12),ntri_smooth:k(a,E+16+16),ntri_flat_uv:k(a,
+E+16+20),ntri_smooth_uv:k(a,E+16+24),nquad_flat:k(a,E+16+28),nquad_smooth:k(a,E+16+32),nquad_flat_uv:k(a,E+16+36),nquad_smooth_uv:k(a,E+16+40)};E+=C.header_bytes;R=C.vertex_index_bytes;D=C.vertex_index_bytes*2;O=C.vertex_index_bytes*3;J=C.vertex_index_bytes*3+C.material_index_bytes;N=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;K=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes;Y=C.vertex_index_bytes*2;oa=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;ra=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;G=C.uv_index_bytes;W=C.uv_index_bytes*2;$=C.uv_index_bytes;la=C.uv_index_bytes*2;ja=C.uv_index_bytes*3;b=C.vertex_index_bytes*3+C.material_index_bytes;ia=C.vertex_index_bytes*4+C.material_index_bytes;sa=C.ntri_flat*b;T=C.ntri_smooth*(b+C.normal_index_bytes*
+3);ea=C.ntri_flat_uv*(b+C.uv_index_bytes*3);ga=C.ntri_smooth_uv*(b+C.normal_index_bytes*3+C.uv_index_bytes*3);na=C.nquad_flat*ia;b=C.nquad_smooth*(ia+C.normal_index_bytes*4);ia=C.nquad_flat_uv*(ia+C.uv_index_bytes*4);E+=function(b){for(var e,h,k,l=C.vertex_coordinate_bytes*3,n=b+C.nvertices*l;b<n;b+=l)e=c(a,b),h=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,h,k)));return C.nvertices*l}(E);E+=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}(E);E+=function(b){for(var e,h,k=C.uv_coordinate_bytes*2,l=b+C.nuvs*k;b<l;b+=k)e=c(a,b),h=c(a,b+C.uv_coordinate_bytes),L.push(e,h);return C.nuvs*k}(E);sa=E+sa;T=sa+T;ea=T+ea;ga=ea+ga;na=ga+na;b=na+b;ia=b+ia;(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})(T);(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})(ea);(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})(ia);(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})(E);(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})(sa);(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})(ga);(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})(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){T=a;e=e||na;l!==void 0&&(a=l.split("/"),a.pop(),Ga=a.length<1?"":a.join("/")+"/");I=c("//dae:library_images/dae:image",f,"image");ua=c("//dae:library_materials/dae:material",O,"material");va=c("//dae:library_effects/dae:effect",Y,"effect");ka=c("//dae:library_geometries/dae:geometry",B,"geometry");ha=c("//dae:library_controllers/dae:controller",k,"controller");Q=c("//dae:library_animations/dae:animation",Z,"animation");Ca=c(".//dae:library_visual_scenes/dae:visual_scene",
+v,"visual_scene");ya=[];Aa=[];(a=T.evaluate(".//dae:scene/dae:instance_visual_scene",T,ra,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ga=Ca[a]):ga=null;ea=new THREE.Object3D;for(a=0;a<ga.nodes.length;a++)ea.add(h(ga.nodes[a]));b();for(var n in Q);n={scene:ea,morphs:ya,skins:Aa,dae:{images:I,materials:ua,effects:va,geometries:ka,controllers:ha,animations:Q,visualScenes:Ca,scene:ga}};e&&e(n);return n}function c(a,b,c){for(var a=T.evaluate(a,
+T,ra,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=ha[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=ga.getChildById(c.skeleton[0],!0)||ga.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=
 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 h(a){var b=
 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 h(a){var b=
-new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=ka[a.controllers[f].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[f].instance_material;a.geometries.push(n);c=a.controllers[f]}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[f].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[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var k=a.geometries[f],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,
+new THREE.Object3D,c,e,f;for(f=0;f<a.controllers.length;f++){var k=ha[a.controllers[f].url];switch(k.type){case "skin":if(ka[k.skin.source]){var n=new u;n.url=k.skin.source;n.instance_material=a.controllers[f].instance_material;a.geometries.push(n);c=a.controllers[f]}else if(ha[k.skin.source]&&(e=k=ha[k.skin.source],k.morph&&ka[k.morph.source]))n=new u,n.url=k.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n);break;case "morph":if(ka[k.morph.source])n=new u,
+n.url=k.morph.source,n.instance_material=a.controllers[f].instance_material,a.geometries.push(n),e=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var k=a.geometries[f],n=k.instance_material,k=ka[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=va[ua[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=ha[c.url],n.skinInstanceController=c,n.name="skin_"+Aa.length,Aa.push(n);else if(e!==void 0){o=k;p=e instanceof w?ha[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=ka[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(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){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=
 b.scale);for(f=0;f<a.nodes.length;f++)b.add(h(a.nodes[f],a));return b}function f(){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 E(){}function C(){this.material="";this.count=
 [];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 E(){}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 Y(){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=$(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function W(a){for(var a=$(a),b=[],c=
-0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function $(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;f.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=
+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 J(){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 K(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 Y(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function oa(){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(ia[b]!=void 0)return ia[b];ia[b]=(new D(b)).parse(a);return ia[b]}function ra(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function G(a){for(var a=$(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function W(a){for(var a=$(a),b=[],c=
+0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function $(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function la(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function ja(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 sa(a,b){var c="";c+=ja(a.x,b)+",";c+=ja(a.y,b)+",";c+=ja(a.z,b);return c}var T=null,ea=null,ga,
+na=null,ia={},I={},Q={},ha={},ka={},ua={},va={},Ca,Ga,ya,Aa,Ja=THREE.SmoothShading;f.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=
 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=
 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=
 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=
@@ -599,36 +600,36 @@ f[t],v=c[k+u.offset];switch(u.semantic){case "JOINT":p.joint=v;break;case "WEIGH
 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();
 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=
 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==
 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;
+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=T.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",T,ra,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=
 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?
 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};
 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],
 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 E).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+
+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=T.evaluate(".//dae:instance_material",c,ra,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=T.evaluate(".//dae:instance_material",
+c,ra,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=sa(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 E).parse(e))}}var f={};this.geometry3js=new THREE.Geometry;e=ia[this.vertices.input.POSITION.source].data;for(a=c=0;c<e.length;c+=3,a++){var h=new THREE.Vertex(new THREE.Vector3(e[c],e[c+
 1],e[c+2]));b(h,a);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,f);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};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],
 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],
+n.semantic){case "TEXCOORD":v.push(n.set)}for(;e<k.length;){var w=[],x=[],y={},z=[];a.vcount&&(u=a.vcount[t++]);for(f=0;f<u;f++)for(h=0;h<l.length;h++)switch(n=l[h],source=ia[n.source],o=k[e+f*l.length+n.offset],numParams=source.accessor.params.length,p=o*numParams,n.semantic){case "VERTEX":n=sa(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}};E.prototype=new C;E.prototype.constructor=E;C.prototype.setVertices=
 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}};E.prototype=new C;E.prototype.constructor=E;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=W(c.textContent);break;case "p":this.p=W(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=$(c.textContent),f=[],h=0;h<e.length;h++)f.push(e[h]=="true"||e[h]=="1"?
+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=la(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new R).parse(a.childNodes[b]));break;case "vcount":this.vcount=W(c.textContent);break;case "p":this.p=W(c.textContent)}}return this};H.prototype.parse=
+function(a){this.params=[];this.source=a.getAttribute("source");this.count=la(a,"count",0);this.stride=la(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var e={};e.name=c.getAttribute("name");e.type=c.getAttribute("type");this.params.push(e)}}return this};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=la(a,"set",-1);this.offset=la(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=$(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=W(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=$(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];
 !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=W(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=$(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==
 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=
+"instance_effect"){this.instance_effect=(new oa).parse(a.childNodes[b]);break}return this};J.prototype.isColor=function(){return this.texture==null};J.prototype.isTexture=function(){return this.texture!=null};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 "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 J).parse(c);break;case "shininess":case "reflectivity":case "transparency":var e;e=T.evaluate(".//dae:float",c,ra,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 J)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(Ga+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)};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=
 c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+c.nodeName)}}return this};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;
 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};Y.prototype.parse=function(a){this.id=a.getAttribute("id");
+break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};Y.prototype.create=function(){if(this.shader==null)return null};Y.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};Y.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 K(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)}}};Y.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};Y.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)}}};oa.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=
 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};
 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=
 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==
 Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var e=new XMLHttpRequest;e.overrideMimeType&&e.overrideMimeType("text/xml");e.onreadystatechange=function(){if(e.readyState==4&&(e.status==0||e.status==
-200))fa=c,a(e.responseXML,void 0,b)};e.open("GET",b,!0);e.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){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;
+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){Ja=a},applySkin:l,geometries:ka}};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.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,v,p,x,w,z,u,B,y,E,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=
 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,E,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];E=[];for(k=0;k<p;k++)z=H[t++],C=y[z*2],z=y[z*2+1],E[k]=new THREE.UV(C,
 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];E=[];for(k=0;k<p;k++)z=H[t++],C=y[z*2],z=y[z*2+1],E[k]=new THREE.UV(C,
@@ -639,23 +640,23 @@ THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=f
 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(E=M.objects[w],E.geometry!==void 0){if(R=P.geometries[E.geometry]){var a=!1;for(G=0;G<E.materials.length;G++)N=P.materials[E.materials[G]],a=N instanceof THREE.ShaderMaterial;a&&R.computeTangents();C=E.position;r=E.rotation;q=E.quaternion;
 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(E=M.objects[w],E.geometry!==void 0){if(R=P.geometries[E.geometry]){var a=!1;for(G=0;G<E.materials.length;G++)N=P.materials[E.materials[G]],a=N instanceof THREE.ShaderMaterial;a&&R.computeTangents();C=E.position;r=E.rotation;q=E.quaternion;
 s=E.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=E.visible;P.scene.add(object);P.objects[w]=object;E.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(a));if(E.castsShadow)a=
 s=E.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=E.visible;P.scene.add(object);P.objects[w]=object;E.meshCollider&&(a=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(a));if(E.castsShadow)a=
 new THREE.ShadowVolume(R),P.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(a={type:E.trigger,object:E},P.triggers[object.name]=a)}}else C=E.position,r=E.rotation,q=E.quaternion,s=E.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=
 new THREE.ShadowVolume(R),P.scene.add(a),a.position=object.position,a.rotation=object.rotation,a.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(a={type:E.trigger,object:E},P.triggers[object.name]=a)}}else C=E.position,r=E.rotation,q=E.quaternion,s=E.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=
-E.visible!==void 0?E.visible:!1,P.scene.add(object),P.objects[w]=object,P.empties[w]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(a={type:E.trigger,object:E},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-Y},P);b.onLoadProgress();ja==0&&Y==0&&c(P)}var p,x,w,z,u,B,y,E,C,H,L,R,D,O,
-K,N,J,M,ea,ja,Y,U,o,P;M=a.data;K=new THREE.BinaryLoader;ea=new THREE.JSONLoader;Y=ja=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(w in M.objects)if(E=M.objects[w],E.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(){Y-=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,
+E.visible!==void 0?E.visible:!1,P.scene.add(object),P.objects[w]=object,P.empties[w]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(a={type:E.trigger,object:E},P.triggers[object.name]=a)}function n(a){return function(c){P.geometries[a]=c;k();oa-=1;b.onLoadComplete();v()}}function t(a){return function(b){P.geometries[a]=b}}function v(){b.callbackProgress({totalModels:U,totalTextures:o,loadedModels:U-oa,loadedTextures:o-Z},P);b.onLoadProgress();oa==0&&Z==0&&c(P)}var p,x,w,z,u,B,y,E,C,H,L,R,D,O,
+J,N,K,M,Y,oa,Z,U,o,P;M=a.data;J=new THREE.BinaryLoader;Y=new THREE.JSONLoader;Z=oa=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(w in M.objects)if(E=M.objects[w],E.meshCollider){a=!0;break}if(a)P.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;H=M.transform.rotation;var ra=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]);ra&&
+P.scene.scale.set(ra[0],ra[1],ra[2]);(a||H||ra)&&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,K=new THREE.DirectionalLight(D,H),K.position.set(C[0],C[1],C[2]),K.position.normalize()):u.type=="point"?(C=u.position,d=u.distance,K=new THREE.PointLight(D,H,d),K.position.set(C[0],C[1],C[2])):u.type=="ambient"&&(K=new THREE.AmbientLight(D)),P.scene.add(K),P.lights[z]=K;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")oa+=1,b.onLoadStart();U=oa;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]=
 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){Y+=p.url.length;for(K=0;K<p.url.length;K++)b.onLoadStart()}else Y+=1,b.onLoadStart();o=Y;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]=
+R):B.type=="icosahedron"?(R=new THREE.IcosahedronGeometry(B.subdivisions),P.geometries[p]=R):B.type=="bin_mesh"?J.load(e(B.url,M.urlBaseType),n(p)):B.type=="ascii_mesh"?Y.load(e(B.url,M.urlBaseType),n(p)):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&Y.createModel(B,t(p),"");for(y in M.textures)if(p=M.textures[y],p.url instanceof Array){Z+=p.url.length;for(J=0;J<p.url.length;J++)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){J=[];for(var G=0;G<p.url.length;G++)J[G]=e(p.url[G],M.urlBaseType);J=THREE.ImageUtils.loadTextureCube(J,p.mapping,a)}else{J=THREE.ImageUtils.loadTexture(e(p.url,M.urlBaseType),p.mapping,a);if(THREE[p.minFilter]!=void 0)J.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)J.magFilter=THREE[p.magFilter];if(p.repeat){J.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=1)J.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)J.wrapT=THREE.RepeatWrapping}p.offset&&
+J.offset.set(p.offset[0],p.offset[1]);if(p.wrap){Y={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Y[p.wrap[0]]!==void 0)J.wrapS=Y[p.wrap[0]];if(Y[p.wrap[1]]!==void 0)J.wrapT=Y[p.wrap[1]]}}P.textures[y]=J}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);
 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;
+J=y.parameters.color;Y=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(J);a.uSpecularColor.value.setHex(Y);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.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,h=b.offsetX!==void 0?b.offsetX:0,f=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,
 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,h=b.offsetX!==void 0?b.offsetX:0,f=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,h,f,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 h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+l]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(l=f=0;l<c;l++)k=a.charCodeAt(l+e),h[l]=f-k,k==0&&f++;return[b,h]};
 c,l,h,f,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 h=0,f=0;f<c;++f){var k=a.charCodeAt(f+e);h+=k>>1^-(k&1);b[8*f+l]=h}e+=c}c=a.length-e;h=new Uint16Array(c);for(l=f=0;l<c;l++)k=a.charCodeAt(l+e),h[l]=f-k,k==0&&f++;return[b,h]};
 THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],v=[];(function(a,f,n){for(var t,u,v,y=a.length;n<y;n+=f)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+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,v)))})(f[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)})(f[0],8,3);(function(a,
 THREE.UTF8Loader.prototype.createModel=function(a,c,b,e,l,h){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),t=[],v=[];(function(a,f,n){for(var t,u,v,y=a.length;n<y;n+=f)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+=h,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,u,v)))})(f[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)})(f[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)})(f[0],8,5);(function(a){var b,e,f,h,l,n,E,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;E=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];E=new THREE.Vector3(t[E*3],t[E*3+1],t[E*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,[E,R,D],null,O));l=v[e*2];e=v[e*2+
+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)})(f[0],8,5);(function(a){var b,e,f,h,l,n,E,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;E=e;var R=f,D=h,O=l.materials[0],J=t[R*3],N=t[R*3+1],R=t[R*3+2],K=t[D*3],M=t[D*3+1],D=t[D*3+2];E=new THREE.Vector3(t[E*3],t[E*3+1],t[E*3+2]);R=new THREE.Vector3(J,N,R);D=new THREE.Vector3(K,M,D);l.faces.push(new THREE.Face3(C,H,n,[E,R,D],null,O));l=v[e*2];e=v[e*2+
 1];n=v[f*2];E=v[f*2+1];C=v[h*2];H=v[h*2+1];h=c.faceVertexUvs[0];f=n;n=E;E=[];E.push(new THREE.UV(l,e));E.push(new THREE.UV(f,n));E.push(new THREE.UV(C,H));h.push(E)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 1];n=v[f*2];E=v[f*2+1];C=v[h*2];H=v[h*2+1];h=c.faceVertexUvs[0];f=n;n=E;E=[];E.push(new THREE.UV(l,e));E.push(new THREE.UV(f,n));E.push(new THREE.UV(C,H));h.push(E)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
 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);
 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;
 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;
@@ -663,9 +664,9 @@ THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c ins
 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,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=n;c[h+2]=t;l[h]=this.lerp(v[a],v[a+3],f);l[h+1]=this.lerp(v[a+1],v[a+4],f);l[h+2]=this.lerp(v[a+2],v[a+5],f)};this.VIntY=function(a,c,l,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k;c[h+1]=n+f*this.delta;c[h+
 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,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k+f*this.delta;c[h+1]=n;c[h+2]=t;l[h]=this.lerp(v[a],v[a+3],f);l[h+1]=this.lerp(v[a+1],v[a+4],f);l[h+2]=this.lerp(v[a+2],v[a+5],f)};this.VIntY=function(a,c,l,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k;c[h+1]=n+f*this.delta;c[h+
 2]=t;c=a+this.yd*3;l[h]=this.lerp(v[a],v[c],f);l[h+1]=this.lerp(v[a+1],v[c+1],f);l[h+2]=this.lerp(v[a+2],v[c+2],f)};this.VIntZ=function(a,c,l,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k;c[h+1]=n;c[h+2]=t+f*this.delta;c=a+this.zd*3;l[h]=this.lerp(v[a],v[c],f);l[h+1]=this.lerp(v[a+1],v[c+1],f);l[h+2]=this.lerp(v[a+2],v[c+2],f)};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]-
 2]=t;c=a+this.yd*3;l[h]=this.lerp(v[a],v[c],f);l[h+1]=this.lerp(v[a+1],v[c+1],f);l[h+2]=this.lerp(v[a+2],v[c+2],f)};this.VIntZ=function(a,c,l,h,f,k,n,t,v,p){f=(f-v)/(p-v);v=this.normal_cache;c[h]=k;c[h+1]=n;c[h+2]=t+f*this.delta;c=a+this.zd*3;l[h]=this.lerp(v[a],v[c],f);l[h+1]=this.lerp(v[a+1],v[c+1],f);l[h+2]=this.lerp(v[a+2],v[c+2],f)};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,h,f,k){var n=h+1,t=h+this.yd,v=h+this.zd,p=n+this.yd,x=n+this.zd,w=h+this.yd+this.zd,z=n+this.yd+this.zd,u=0,B=this.field[h],y=this.field[n],E=this.field[t],C=this.field[p],H=this.field[v],L=this.field[x],R=this.field[w],D=this.field[z];B<f&&(u|=1);y<f&&(u|=2);E<f&&(u|=8);C<f&&(u|=4);H<f&&(u|=16);L<f&&(u|=32);R<f&&(u|=128);D<f&&(u|=64);var O=THREE.edgeTable[u];if(O===0)return 0;
 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,h,f,k){var n=h+1,t=h+this.yd,v=h+this.zd,p=n+this.yd,x=n+this.zd,w=h+this.yd+this.zd,z=n+this.yd+this.zd,u=0,B=this.field[h],y=this.field[n],E=this.field[t],C=this.field[p],H=this.field[v],L=this.field[x],R=this.field[w],D=this.field[z];B<f&&(u|=1);y<f&&(u|=2);E<f&&(u|=8);C<f&&(u|=4);H<f&&(u|=16);L<f&&(u|=32);R<f&&(u|=128);D<f&&(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(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,l,B,y));O&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,f,N,c,l,y,C));O&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,f,a,J,l,E,C));O&8&&(this.compNorm(h),this.compNorm(t),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,l,B,E));O&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,f,a,c,K,H,L));
-O&32&&(this.compNorm(x),this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,f,N,c,K,L,D));O&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,f,a,J,K,R,D));O&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,f,a,c,K,H,R));O&256&&(this.compNorm(h),this.compNorm(v),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,l,B,H));O&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,f,N,c,l,y,L));O&1024&&(this.compNorm(p),
-this.compNorm(z),this.VIntZ(p*3,this.vlist,this.nlist,30,f,N,J,l,C,D));O&2048&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*3,this.vlist,this.nlist,33,f,a,J,l,E,R));u<<=4;for(f=h=0;THREE.triTable[u+f]!=-1;)a=u+f,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),f+=3,h++;return h};this.posnormtriv=function(a,c,l,h,f,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+
+var J=this.delta,N=a+J,K=c+J,J=l+J;O&1&&(this.compNorm(h),this.compNorm(n),this.VIntX(h*3,this.vlist,this.nlist,0,f,a,c,l,B,y));O&2&&(this.compNorm(n),this.compNorm(p),this.VIntY(n*3,this.vlist,this.nlist,3,f,N,c,l,y,C));O&4&&(this.compNorm(t),this.compNorm(p),this.VIntX(t*3,this.vlist,this.nlist,6,f,a,K,l,E,C));O&8&&(this.compNorm(h),this.compNorm(t),this.VIntY(h*3,this.vlist,this.nlist,9,f,a,c,l,B,E));O&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,f,a,c,J,H,L));
+O&32&&(this.compNorm(x),this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,f,N,c,J,L,D));O&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,f,a,K,J,R,D));O&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,f,a,c,J,H,R));O&256&&(this.compNorm(h),this.compNorm(v),this.VIntZ(h*3,this.vlist,this.nlist,24,f,a,c,l,B,H));O&512&&(this.compNorm(n),this.compNorm(x),this.VIntZ(n*3,this.vlist,this.nlist,27,f,N,c,l,y,L));O&1024&&(this.compNorm(p),
+this.compNorm(z),this.VIntZ(p*3,this.vlist,this.nlist,30,f,N,K,l,C,D));O&2048&&(this.compNorm(t),this.compNorm(w),this.VIntZ(t*3,this.vlist,this.nlist,33,f,a,K,l,E,R));u<<=4;for(f=h=0;THREE.triTable[u+f]!=-1;)a=u+f,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),f+=3,h++;return h};this.posnormtriv=function(a,c,l,h,f,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[h];this.positionArray[n+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[f];this.positionArray[n+7]=a[f+1];this.positionArray[n+8]=a[f+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[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[f];this.normalArray[n+7]=c[f+1];this.normalArray[n+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
 3]=a[h];this.positionArray[n+4]=a[h+1];this.positionArray[n+5]=a[h+2];this.positionArray[n+6]=a[f];this.positionArray[n+7]=a[f+1];this.positionArray[n+8]=a[f+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[h];this.normalArray[n+4]=c[h+1];this.normalArray[n+5]=c[h+2];this.normalArray[n+6]=c[f];this.normalArray[n+7]=c[f+1];this.normalArray[n+8]=c[f+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,h,f){var k=this.size*Math.sqrt(h/f),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);
 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,h,f){var k=this.size*Math.sqrt(h/f),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,E,C;p<n;p++){v=this.size2*p;u=p/this.size-l;E=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=h/(1.0E-6+y*y+C+E)-f,y>0&&(this.field[B+z]+=y)}}};this.addPlaneX=function(a,c){var l,h,f,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(h=l/t,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<t;h++){n=l+h*v;for(f=0;f<t;f++)x[p*f+n]+=k}};this.addPlaneY=function(a,c){var l,h,f,k,
 k>this.size-1&&(k=this.size-1);for(var z,u,B,y,E,C;p<n;p++){v=this.size2*p;u=p/this.size-l;E=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=h/(1.0E-6+y*y+C+E)-f,y>0&&(this.field[B+z]+=y)}}};this.addPlaneX=function(a,c){var l,h,f,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(h=l/t,h*=h,k=a/(1.0E-4+h)-c,k>0)for(h=0;h<t;h++){n=l+h*v;for(f=0;f<t;f++)x[p*f+n]+=k}};this.addPlaneY=function(a,c){var l,h,f,k,

+ 84 - 84
build/custom/ThreeWebGL.js

@@ -15,30 +15,30 @@ THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,e){this.x=
 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())},
 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};
 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,D){e.copy(D).subSelf(b);
 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}};
+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,G=[],F=0,ra=a.children.length;F<ra;F++)Array.prototype.push.apply(G,this.intersectObject(a.children[F]));if(a instanceof THREE.Particle){F=b(this.origin,this.direction,a.matrixWorld.getPosition());if(F===null||F>a.scale.x)return[];D={distance:F,point:a.position,
+face:null,object:a};G.push(D)}else if(a instanceof THREE.Mesh){F=b(this.origin,this.direction,a.matrixWorld.getPosition());if(F===null||F>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return G;var O,la,na,S,da,K,V,Y,J=a.geometry,W=J.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);F=0;for(ra=J.faces.length;F<ra;F++)if(D=J.faces[F],V=this.origin.clone(),Y=this.direction.clone(),S=a.matrixWorld,O=S.multiplyVector3(D.centroid.clone()).subSelf(V),K=O.dot(Y),
+!(K<=0)&&(O=S.multiplyVector3(W[D.a].position.clone()),la=S.multiplyVector3(W[D.b].position.clone()),na=S.multiplyVector3(W[D.c].position.clone()),S=D instanceof THREE.Face4?S.multiplyVector3(W[D.d].position.clone()):null,da=a.matrixRotationWorld.multiplyVector3(D.normal.clone()),K=Y.dot(da),a.doubleSided||(a.flipSided?K>0:K<0)))if(K=da.dot((new THREE.Vector3).sub(O,V))/K,V=V.addSelf(Y.multiplyScalar(K)),D instanceof THREE.Face3)c(V,O,la,na)&&(D={distance:this.origin.distanceTo(V),point:V,face:D,
+object:a},G.push(D));else if(D instanceof THREE.Face4&&(c(V,O,la,S)||c(V,la,na,S)))D={distance:this.origin.distanceTo(V),point:V,face:D,object:a},G.push(D)}return G}};
 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=
 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>
 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}};
 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.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.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,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*=
+THREE.Matrix4=function(a,b,c,e,h,f,i,k,r,n,l,t,B,C,D,G){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,G!==void 0?G: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,G){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=G;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,G=a.n42,F=a.n43,
+ra=a.n44,O=b.n11,la=b.n12,na=b.n13,S=b.n14,da=b.n21,K=b.n22,V=b.n23,Y=b.n24,J=b.n31,W=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*W+f*ka;this.n13=c*na+e*V+h*aa+f*N;this.n14=c*S+e*Y+h*ma+f*d;this.n21=i*O+k*da+r*J+n*xa;this.n22=i*la+k*K+r*W+n*ka;this.n23=i*na+k*V+r*aa+n*N;this.n24=i*S+k*Y+r*ma+n*d;this.n31=l*O+t*da+B*J+C*xa;this.n32=l*la+t*K+B*W+C*ka;this.n33=l*na+t*V+B*aa+C*N;this.n34=l*S+t*Y+B*ma+C*d;this.n41=D*O+G*da+F*J+ra*xa;this.n42=
+D*la+G*K+F*W+ra*ka;this.n43=D*na+G*V+F*aa+ra*N;this.n44=D*S+G*Y+F*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*
 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*
 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,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.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,G=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*G+b*i*r*G+
+c*h*n*G-a*i*n*G-b*h*l*G+a*f*l*G},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]=
 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.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,
 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,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,
 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());
+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,G=a.n43,F=a.n44;this.n11=k*B*D-r*t*D+r*l*G-i*B*G-k*l*F+i*t*F;this.n12=h*t*D-e*B*D-h*l*G+c*B*G+e*l*F-c*t*F;this.n13=e*r*D-h*k*D+h*i*G-c*r*G-e*i*F+c*k*F;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*G+f*B*G+k*n*F-f*t*F;this.n22=e*B*C-h*t*C+
+h*n*G-b*B*G-e*n*F+b*t*F;this.n23=h*k*C-e*r*C-h*f*G+b*r*G+e*f*F-b*k*F;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*F+f*l*F;this.n32=h*l*C-c*B*C-h*n*D+b*B*D+c*n*F-b*l*F;this.n33=e*r*C-h*i*C+h*f*D-b*r*D-c*f*F+b*i*F;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*G-f*l*G;this.n42=c*t*C-e*l*C+e*n*D-b*t*D-c*n*G+b*l*G;this.n43=e*i*C-c*k*C-e*f*D+b*k*D+c*f*G-b*i*G;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=
 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*
 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*=
 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*=
@@ -55,18 +55,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
 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&&
 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;
 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=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=[],
 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<
+l,t,B=[],C,D=[],G,F,ra=[],O,la,na=[],S={objects:[],sprites:[],lights:[],elements:[]},da=new THREE.Vector3,K=new THREE.Vector4,V=new THREE.Matrix4,Y=new THREE.Matrix4,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],W=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);V.multiply(b.projectionMatrix,b.matrixWorldInverse);V.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
+V.multiply(b.matrixWorld,b.projectionMatrixInverse);V.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=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?(V.multiplyVector3(da.copy(b.position)),h=a(),h.object=b,h.z=da.z,S.objects.push(h)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(V.multiplyVector3(da.copy(b.position)),h=a(),h.object=b,h.z=da.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,J,da,ja,sa,H,qa,ga,ta,P,oa,ua,Fa,Ja,Ga,Aa,ya;la=F=C=t=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);V.multiply(f.projectionMatrix,f.matrixWorldInverse);this.computeFrustum(V);S=this.projectGraph(a,!1);a=0;for(J=S.objects.length;a<J;a++)if(P=S.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),V.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],
 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),
 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)};
+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);V.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;S.elements.push(l)}}else if(P instanceof THREE.Line){Y.multiply(V,oa);sa=P.geometry.vertices;H=b();H.positionScreen.copy(sa[0].position);Y.multiplyVector4(H.positionScreen);da=1;for(ja=sa.length;da<ja;da++)if(H=b(),H.positionScreen.copy(sa[da].position),Y.multiplyVector4(H.positionScreen),qa=n[r-2],W.copy(H.positionScreen),aa.copy(qa.positionScreen),e(W,aa))W.multiplyScalar(1/W.w),aa.multiplyScalar(1/aa.w),P=ra[F]=ra[F]||new THREE.RenderableLine,
+F++,G=P,G.v1.positionScreen.copy(W),G.v2.positionScreen.copy(aa),G.z=Math.max(W.z,aa.z),G.material=Fa,S.elements.push(G)}a=0;for(J=S.sprites.length;a<J;a++)if(P=S.sprites[a].object,oa=P.matrixWorld,P instanceof THREE.Particle&&(K.set(oa.n14,oa.n24,oa.n34,1),V.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,S.elements.push(O);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,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);
 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.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.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=
@@ -82,9 +82,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
 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=
 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
 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]),
 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,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],
+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;G=r.y-k.y;F=n.y-k.y;ra=r.z-k.z;O=n.z-k.z;la=t.u-l.u;na=B.u-l.u;S=t.v-l.v;da=B.v-l.v;K=1/(la*da-na*S);W.set((da*C-S*D)*K,(da*G-S*F)*K,(da*ra-S*O)*K);aa.set((la*D-na*C)*K,(la*F-na*G)*K,(la*O-na*ra)*K);Y[b].addSelf(W);Y[c].addSelf(W);Y[e].addSelf(W);
+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,G,F,ra,O,la,na,S,da,K,V,Y=[],J=[],W=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++)Y[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]],V=Y[h],ma.copy(V),ma.subSelf(ka.multiplyScalar(ka.dot(V))).normalize(),xa.cross(f.vertexNormals[e],V),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<
 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("_"),
 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;
 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;
@@ -183,17 +183,17 @@ 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
 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.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.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.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.needsUpdate||c.sortParticles)d.bindBuffer(d.ARRAY_BUFFER,
 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.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,
 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;
+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,G=0,R=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=G*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,G+=1;else if(k instanceof THREE.SpotLight)t=G*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,G+=1;else if(k instanceof THREE.PointLight)k=
+R*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[R]=t,R+=1;c=G*3;for(o=B.length;c<o;c++)B[c]=0;c=R*3;for(o=v.length;c<o;c++)v[c]=0;u.point.length=R;u.directional.length=G;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=
 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/
 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;
 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===
 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===
 "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+
 "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,
+o,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,q.image[o]);V(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)):Y(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])&&
+Y(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 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),
 !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 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&&
 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]=
 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]=
@@ -206,32 +206,32 @@ d.createBuffer();a.hasPos&&(d.bindBuffer(d.ARRAY_BUFFER,a.__webglVertexBuffer),d
 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}
 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,
 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=
 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&&
+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 G(a,b){return b.z-a.z}function F(a){var b,c,e,l=0,U,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);U=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);W(U);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(U=
+0;U<n;U++)o=a.__webglObjects[U],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(U=0;U<n;U++)if(o=a.__webglObjects[U],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(U=0;U<e;U++)o=a.__webglObjectsImmediate[U],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);
 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,
 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,
+f.matrixWorld,f._modelViewMatrixArray),f.z=-f._modelViewMatrix.n34);a.__webglSprites.sort(G);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),
 !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]=
+K(f.blending),Y(f.map,0),d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0));d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(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 S(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 V(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 Y(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);V(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 W(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);V(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,
 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,
+a.__webglTexture),V(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,
 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;
 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.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 N=this,d,Ea=[],Qa=
 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 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"),
 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=
+T=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 pa,La=[],a=THREE.ShaderLib.depthRGBA,Va=THREE.UniformsUtils.clone(a.uniforms),Pa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
 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 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);
+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:T,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);T=0;w.vertices[T++]=-1;w.vertices[T++]=-1;w.vertices[T++]=0;w.vertices[T++]=1;w.vertices[T++]=
+1;w.vertices[T++]=-1;w.vertices[T++]=1;w.vertices[T++]=1;w.vertices[T++]=1;w.vertices[T++]=1;w.vertices[T++]=1;w.vertices[T++]=0;w.vertices[T++]=-1;w.vertices[T++]=1;w.vertices[T++]=0;T=w.vertices[T++]=0;w.faces[T++]=0;w.faces[T++]=1;w.faces[T++]=2;w.faces[T++]=0;w.faces[T++]=2;w.faces[T++]=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,
 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,
 "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=
 "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=
@@ -249,12 +249,12 @@ i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.ma
 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,
 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);
 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]),
 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.numSupportedMorphTargets++);a.uniformsList=[];for(f in a.uniforms)a.uniformsList.push([a.uniforms[f],f])};this.clearTarget=function(a,b,c,d){W(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){F(a,b)};this.render=function(a,b,c,e){var w,U,Ka,o,s,Q,m,q=a.lights,S=a.fog;sa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&F(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);W(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(G);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,S,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,S,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,U=s.opaque))k(Q),r(U.depthTest),n(U.depthWrite),l(U.polygonOffset,U.polygonOffsetFactor,
+U.polygonOffsetUnits),f(b,q,S,U,m,Q);for(e=0;e<o;e++)if(s=a.__webglObjectsImmediate[e],Q=s.object,Q.visible&&(H=-1,U=s.opaque))k(Q),r(U.depthTest),n(U.depthWrite),l(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),w=h(b,q,S,U,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(w,d,va):Q.render(function(a){i(a,w,U.shading)});for(e=0;e<Ka;e++)if(s=a.__webglObjects[e],s.render&&(Q=s.object,m=s.buffer,U=s.transparent))k(Q),K(U.blending),r(U.depthTest),n(U.depthWrite),l(U.polygonOffset,U.polygonOffsetFactor,
+U.polygonOffsetUnits),f(b,q,S,U,m,Q);for(e=0;e<o;e++)if(s=a.__webglObjectsImmediate[e],Q=s.object,Q.visible&&(H=-1,U=s.transparent))k(Q),K(U.blending),r(U.depthTest),n(U.depthWrite),l(U.polygonOffset,U.polygonOffsetFactor,U.polygonOffsetUnits),w=h(b,q,S,U,Q),Q.immediateRenderCallback?Q.immediateRenderCallback(w,d,va):Q.render(function(a){i(a,w,U.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,
 [],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]=
 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=
 {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=
@@ -266,41 +266,41 @@ m.createUniqueBuffers)m.__webglInitialized=!0,q=1,m.type==="v2"?q=2:m.type==="v3
 !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,
 !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=
 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,
 !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,
+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(k=h.length-1;k>=0;k--)h[k]===i&&h.splice(k,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(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,G=void 0,v=void 0,F=void 0,K=void 0,V=void 0,R=C=G=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=G=void 0,X=C=void 0,ha=void 0,P=void 0,E=R=X=ca=0,W=0,ea=L=C=0,T=v=H=0,p=0,I=0,Y=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,F=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,
+V=o.__uvType,G=o.__normalType,aa=B.geometry,Y=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,fa=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=fa[x[m]],y=ma[u.a].position,z=ma[u.b].position,A=ma[u.c].position,ha[X]=y.x,ha[X+1]=y.y,ha[X+
+2]=y.z,ha[X+3]=z.x,ha[X+4]=z.y,ha[X+5]=z.z,ha[X+6]=A.x,ha[X+7]=A.y,ha[X+8]=A.z,X+=9;m=0;for(q=w.length;m<q;m++)u=fa[w[m]],y=ma[u.a].position,z=ma[u.b].position,A=ma[u.c].position,M=ma[u.d].position,ha[X]=y.x,ha[X+1]=y.y,ha[X+2]=y.z,ha[X+3]=z.x,ha[X+4]=z.y,ha[X+5]=z.z,ha[X+6]=A.x,ha[X+7]=A.y,ha[X+8]=A.z,ha[X+9]=M.x,ha[X+10]=M.y,ha[X+11]=M.z,X+=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=fa[x[m]];X=0;for(ha=za.length;X<
+ha;X++)y=za[X].vertices[u.a].position,z=za[X].vertices[u.b].position,A=za[X].vertices[u.c].position,P=ja[X],P[T]=y.x,P[T+1]=y.y,P[T+2]=y.z,P[T+3]=z.x,P[T+4]=z.y,P[T+5]=z.z,P[T+6]=A.x,P[T+7]=A.y,P[T+8]=A.z;T+=9}m=0;for(q=w.length;m<q;m++){u=fa[w[m]];X=0;for(ha=za.length;X<ha;X++)y=za[X].vertices[u.a].position,z=za[X].vertices[u.b].position,A=za[X].vertices[u.c].position,M=za[X].vertices[u.d].position,P=ja[X],P[T]=y.x,P[T+1]=y.y,P[T+2]=y.z,P[T+3]=z.x,P[T+4]=z.y,P[T+5]=z.z,P[T+6]=A.x,P[T+7]=A.y,P[T+
+8]=A.z,P[T+9]=M.x,P[T+10]=M.y,P[T+11]=M.z;T+=12}X=0;for(ha=za.length;X<ha;X++)d.bindBuffer(d.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[X]),d.bufferData(d.ARRAY_BUFFER,ja[X],s)}if(ya.length){m=0;for(q=x.length;m<q;m++)u=fa[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],F[v]=y.x,F[v+1]=y.y,F[v+2]=y.z,F[v+3]=y.w,F[v+4]=z.x,F[v+5]=z.y,F[v+6]=
+z.z,F[v+7]=z.w,F[v+8]=A.x,F[v+9]=A.y,F[v+10]=A.z,F[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=fa[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],F[v]=y.x,F[v+1]=y.y,F[v+2]=y.z,F[v+3]=y.w,F[v+4]=z.x,F[v+5]=z.y,F[v+6]=z.z,F[v+7]=z.w,F[v+8]=A.x,F[v+9]=A.y,F[v+10]=A.z,F[v+11]=A.w,F[v+12]=M.x,F[v+13]=M.y,F[v+14]=M.z,F[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,
 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+
+o.__webglSkinIndicesBuffer),d.bufferData(d.ARRAY_BUFFER,F,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=fa[x[m]],v=u.vertexColors,F=u.color,v.length===3&&K===THREE.VertexColors?(u=v[0],Z=v[1],$=v[2]):$=Z=u=F,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=fa[w[m]],v=u.vertexColors,F=u.color,v.length===4&&K===THREE.VertexColors?(u=
+v[0],Z=v[1],$=v[2],v=v[3]):v=$=Z=u=F,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=fa[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=fa[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&&G){m=0;for(q=x.length;m<q;m++)if(u=fa[x[m]],D=u.vertexNormals,G=u.normal,D.length===3&&ka)for(L=0;L<3;L++)G=D[L],O[C]=G.x,O[C+1]=G.y,O[C+
+2]=G.z,C+=3;else for(L=0;L<3;L++)O[C]=G.x,O[C+1]=G.y,O[C+2]=G.z,C+=3;m=0;for(q=w.length;m<q;m++)if(u=fa[w[m]],D=u.vertexNormals,G=u.normal,D.length===4&&ka)for(L=0;L<4;L++)G=D[L],O[C]=G.x,O[C+1]=G.y,O[C+2]=G.z,C+=3;else for(L=0;L<4;L++)O[C]=G.x,O[C+1]=G.y,O[C+2]=G.z,C+=3;d.bindBuffer(d.ARRAY_BUFFER,o.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,O,s)}if(pa&&va&&V){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[R]=O.u,ga[R+1]=O.v,R+=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[R]=O.u,ga[R+1]=O.v,R+=2;R>0&&(d.bindBuffer(d.ARRAY_BUFFER,o.__webglUVBuffer),d.bufferData(d.ARRAY_BUFFER,ga,s))}if(pa&&wa&&V){m=0;for(q=x.length;m<q;m++)if(C=x[m],R=wa[C],R!==void 0)for(L=0;L<3;L++)C=R[L],p[E]=C.u,p[E+1]=C.v,E+=2;m=0;for(q=w.length;m<q;m++)if(C=w[m],R=wa[C],R!==void 0)for(L=0;L<4;L++)C=R[L],p[E]=C.u,p[E+1]=C.v,E+=2;E>0&&(d.bindBuffer(d.ARRAY_BUFFER,o.__webglUV2Buffer),d.bufferData(d.ARRAY_BUFFER,p,s))}if(Y){m=0;for(q=x.length;m<q;m++)j[W]=
+ca,j[W+1]=ca+1,j[W+2]=ca+2,W+=3,I[ea]=ca,I[ea+1]=ca+1,I[ea+2]=ca,I[ea+3]=ca+2,I[ea+4]=ca+1,I[ea+5]=ca+2,ea+=6,ca+=3;m=0;for(q=w.length;m<q;m++)j[W]=ca,j[W+1]=ca+1,j[W+2]=ca+3,j[W+3]=ca+1,j[W+4]=ca+2,j[W+5]=ca+3,W+=6,I[ea]=ca,I[ea+1]=ca+1,I[ea+2]=ca,I[ea+3]=ca+3,I[ea+4]=ca+1,I[ea+5]=ca+2,I[ea+6]=ca+2,I[ea+7]=ca+3,ea+=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=fa[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=fa[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++)Y=j.value[I],j.array[p]=Y,j.array[p+1]=
+Y,j.array[p+2]=Y,p+=3,I+=1;m=0;for(q=w.length;m<q;m++)Y=j.value[I],j.array[p]=Y,j.array[p+1]=Y,j.array[p+2]=Y,j.array[p+3]=Y,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=fa[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=fa[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=Y=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=Y=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(E=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=fa[x[m]],y=j.value[u.a],z=j.value[u.b],A=j.value[u.c],j.array[p]=y[E[0]],j.array[p+1]=y[E[1]],j.array[p+2]=y[E[2]],j.array[p+3]=z[E[0]],j.array[p+
+4]=z[E[1]],j.array[p+5]=z[E[2]],j.array[p+6]=A[E[0]],j.array[p+7]=A[E[1]],j.array[p+8]=A[E[2]],p+=9;m=0;for(q=w.length;m<q;m++)u=fa[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[E[0]],j.array[p+1]=y[E[1]],j.array[p+2]=y[E[2]],j.array[p+3]=z[E[0]],j.array[p+4]=z[E[1]],j.array[p+5]=z[E[2]],j.array[p+6]=A[E[0]],j.array[p+7]=A[E[1]],j.array[p+8]=A[E[2]],j.array[p+9]=M[E[0]],j.array[p+10]=M[E[1]],j.array[p+11]=M[E[2]],p+=12,I+=1}else if(j.boundTo==="faces"){m=0;for(q=x.length;m<
+q;m++)A=z=y=Y=j.value[I],j.array[p]=y[E[0]],j.array[p+1]=y[E[1]],j.array[p+2]=y[E[2]],j.array[p+3]=z[E[0]],j.array[p+4]=z[E[1]],j.array[p+5]=z[E[2]],j.array[p+6]=A[E[0]],j.array[p+7]=A[E[1]],j.array[p+8]=A[E[2]],p+=9,I+=1;m=0;for(q=w.length;m<q;m++)M=A=z=y=Y=j.value[I],j.array[p]=y[E[0]],j.array[p+1]=y[E[1]],j.array[p+2]=y[E[2]],j.array[p+3]=z[E[0]],j.array[p+4]=z[E[1]],j.array[p+5]=z[E[2]],j.array[p+6]=A[E[0]],j.array[p+7]=A[E[1]],j.array[p+8]=A[E[2]],j.array[p+9]=M[E[0]],j.array[p+10]=M[E[1]],j.array[p+
+11]=M[E[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[E[0]],j.array[p+1]=y[E[1]],j.array[p+2]=y[E[2]],j.array[p+3]=z[E[0]],j.array[p+4]=z[E[1]],j.array[p+5]=z[E[2]],j.array[p+6]=A[E[0]],j.array[p+7]=A[E[1]],j.array[p+8]=A[E[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[E[0]],j.array[p+1]=y[E[1]],j.array[p+2]=y[E[2]],j.array[p+3]=z[E[0]],j.array[p+
+4]=z[E[1]],j.array[p+5]=z[E[2]],j.array[p+6]=A[E[0]],j.array[p+7]=A[E[1]],j.array[p+8]=A[E[2]],j.array[p+9]=M[E[0]],j.array[p+10]=M[E[1]],j.array[p+11]=M[E[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=fa[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=fa[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=Y=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=Y=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+
 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,
 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,
 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.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}};
+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=fa=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;R=ea=W=E=ca=fa=void 0;if(B.__dirtyVertices){for(fa=0;fa<t;fa++)ca=q[fa].position,n=fa*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){fa=0;for(ca=m.length;fa<ca;fa++)if(R=
+m[fa],R.needsUpdate&&(R.boundTo===void 0||R.boundTo==="vertices")){n=0;W=R.value.length;if(R.size===1)for(E=0;E<W;E++)R.array[E]=R.value[E];else if(R.size===2)for(E=0;E<W;E++)ea=R.value[E],R.array[n]=ea.x,R.array[n+1]=ea.y,n+=2;else if(R.size===3)if(R.type==="c")for(E=0;E<W;E++)ea=R.value[E],R.array[n]=ea.r,R.array[n+1]=ea.g,R.array[n+2]=ea.b,n+=3;else for(E=0;E<W;E++)ea=R.value[E],R.array[n]=ea.x,R.array[n+1]=ea.y,R.array[n+2]=ea.z,n+=3;else if(R.size===4)for(E=0;E<W;E++)ea=R.value[E],R.array[n]=
+ea.x,R.array[n+1]=ea.y,R.array[n+2]=ea.z,R.array[n+3]=ea.w,n+=4;d.bindBuffer(d.ARRAY_BUFFER,R.buffer);d.bufferData(d.ARRAY_BUFFER,R.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.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.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};
 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};

+ 46 - 23
src/renderers/WebGLRenderer.js

@@ -2504,50 +2504,73 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 					cal = customAttribute.value.length;
 					cal = customAttribute.value.length;
 
 
-					for ( ca = 0; ca < cal; ca ++ ) {
+					if ( customAttribute.size === 1 ) {
 
 
-						if ( customAttribute.size === 1 ) {
+						for ( ca = 0; ca < cal; ca ++ ) {
 
 
-							customAttribute.array[ offset ] = customAttribute.value[ ca ];
+							customAttribute.array[ ca ] = customAttribute.value[ ca ];
 
 
-						} else {
+						}
+
+					} else if ( customAttribute.size === 2 ) {
+
+						for ( ca = 0; ca < cal; ca ++ ) {
 
 
 							value = customAttribute.value[ ca ];
 							value = customAttribute.value[ ca ];
 
 
-							if ( customAttribute.size === 2 ) {
+							customAttribute.array[ offset ] 	= value.x;
+							customAttribute.array[ offset + 1 ] = value.y;
 
 
-								customAttribute.array[ offset ] 	= value.x;
-								customAttribute.array[ offset + 1 ] = value.y;
+							offset += 2;
 
 
-							} else if ( customAttribute.size === 3 ) {
+						}
 
 
-								if ( customAttribute.type === "c" ) {
+					} else if ( customAttribute.size === 3 ) {
 
 
-									customAttribute.array[ offset ] 	= value.r;
-									customAttribute.array[ offset + 1 ] = value.g;
-									customAttribute.array[ offset + 2 ] = value.b;
+						if ( customAttribute.type === "c" ) {
 
 
+							for ( ca = 0; ca < cal; ca ++ ) {
 
 
-								} else {
+								value = customAttribute.value[ ca ];
 
 
-									customAttribute.array[ offset ] 	= value.x;
-									customAttribute.array[ offset + 1 ] = value.y;
-									customAttribute.array[ offset + 2 ] = value.z;
+								customAttribute.array[ offset ] 	= value.r;
+								customAttribute.array[ offset + 1 ] = value.g;
+								customAttribute.array[ offset + 2 ] = value.b;
 
 
-								}
+								offset += 3;
 
 
-							} else {
+							}
 
 
-								customAttribute.array[ offset ] 	 = value.x;
-								customAttribute.array[ offset + 1  ] = value.y;
-								customAttribute.array[ offset + 2  ] = value.z;
-								customAttribute.array[ offset + 3  ] = value.w;
+						} else {
+
+							for ( ca = 0; ca < cal; ca ++ ) {
+
+								value = customAttribute.value[ ca ];
+
+								customAttribute.array[ offset ] 	= value.x;
+								customAttribute.array[ offset + 1 ] = value.y;
+								customAttribute.array[ offset + 2 ] = value.z;
+
+								offset += 3;
 
 
 							}
 							}
 
 
 						}
 						}
 
 
-						offset += customAttribute.size;
+					} else if ( customAttribute.size === 4 ) {
+
+						for ( ca = 0; ca < cal; ca ++ ) {
+
+							value = customAttribute.value[ ca ];
+
+							customAttribute.array[ offset ] 	 = value.x;
+							customAttribute.array[ offset + 1  ] = value.y;
+							customAttribute.array[ offset + 2  ] = value.z;
+							customAttribute.array[ offset + 3  ] = value.w;
+
+							offset += 4;
+
+						}
 
 
 					}
 					}