Browse Source

Removed surprising bottleneck in WebGLRenderer.

I knew for loops iterating over properties were slower than numerical for loops but I didn't realize how bad it was.

Gained about 10 fps in performance test, and that was for for loop iterating over single property.

Also fixed broken examples with postprocessing.
alteredq 14 years ago
parent
commit
ca05c86fc5

+ 266 - 266
build/Three.js

@@ -16,34 +16,34 @@ b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;thi
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f;f=c.clone().subSelf(b).dot(e);if(f<=0)return null;b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),
 c=c.clone().subSelf(e),h=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(h),j=c.dot(c),c=c.dot(h),h=1/(b*j-e*e),j=(j*f-e*c)*h,b=(b*c-e*f)*h;return j>0&&b>0&&j+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)))return[];var h,k,j,m,p,o,t,v,w,u,y=b.geometry,x=y.vertices,B=[],f=0;for(h=y.faces.length;f<h;f++)if(k=y.faces[f],w=this.origin.clone(),u=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(k.centroid.clone()).subSelf(w),v=j.dot(u),!(v<=0)&&(j=o.multiplyVector3(x[k.a].position.clone()),m=o.multiplyVector3(x[k.b].position.clone()),p=o.multiplyVector3(x[k.c].position.clone()),o=k instanceof THREE.Face4?o.multiplyVector3(x[k.d].position.clone()):null,t=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),
-v=u.dot(t),b.doubleSided||(b.flipSided?v>0:v<0)))if(v=t.dot((new THREE.Vector3).sub(j,w))/v,w=w.addSelf(u.multiplyScalar(v)),k instanceof THREE.Face3)e(w,j,m,p)&&(k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k));else if(k instanceof THREE.Face4&&(e(w,j,m,o)||e(w,m,p,o)))k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k);B.sort(function(b,e){return b.distance-e.distance});return B}else return[]}};
-THREE.Rectangle=function(){function b(){k=f-c;j=h-e}var c,e,f,h,k,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,k,t,v){m=!1;c=j;e=k;f=t;h=v;b()};this.addPoint=function(j,k){m?(m=!1,c=j,e=k,f=j,h=k):(c=c<j?c:j,e=e<k?e:k,f=f>j?f:j,h=h>k?h:k);b()};this.add3Points=
-function(j,k,t,v,w,u){m?(m=!1,c=j<t?j<w?j:w:t<w?t:w,e=k<v?k<u?k:u:v<u?v:u,f=j>t?j>w?j:w:t>w?t:w,h=k>v?k>u?k:u:v>u?v:u):(c=j<t?j<w?j<c?j:c:w<c?w:c:t<w?t<c?t:c:w<c?w:c,e=k<v?k<u?k<e?k:e:u<e?u:e:v<u?v<e?v:e:u<e?u:e,f=j>t?j>w?j>f?j:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f,h=k>v?k>u?k>h?k:h:u>h?u:h:v>u?v>h?v:h:u>h?u:h);b()};this.addRectangle=function(j){m?(m=!1,c=j.getLeft(),e=j.getTop(),f=j.getRight(),h=j.getBottom()):(c=c<j.getLeft()?c:j.getLeft(),e=e<j.getTop()?e:j.getTop(),f=f>j.getRight()?f:j.getRight(),h=h>
+Math.max(b.scale.y,b.scale.z)))return[];var h,k,j,m,p,o,t,u,w,v,y=b.geometry,x=y.vertices,B=[],f=0;for(h=y.faces.length;f<h;f++)if(k=y.faces[f],w=this.origin.clone(),v=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(k.centroid.clone()).subSelf(w),u=j.dot(v),!(u<=0)&&(j=o.multiplyVector3(x[k.a].position.clone()),m=o.multiplyVector3(x[k.b].position.clone()),p=o.multiplyVector3(x[k.c].position.clone()),o=k instanceof THREE.Face4?o.multiplyVector3(x[k.d].position.clone()):null,t=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),
+u=v.dot(t),b.doubleSided||(b.flipSided?u>0:u<0)))if(u=t.dot((new THREE.Vector3).sub(j,w))/u,w=w.addSelf(v.multiplyScalar(u)),k instanceof THREE.Face3)e(w,j,m,p)&&(k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k));else if(k instanceof THREE.Face4&&(e(w,j,m,o)||e(w,m,p,o)))k={distance:this.origin.distanceTo(w),point:w,face:k,object:b},B.push(k);B.sort(function(b,e){return b.distance-e.distance});return B}else return[]}};
+THREE.Rectangle=function(){function b(){k=f-c;j=h-e}var c,e,f,h,k,j,m=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(j,k,t,u){m=!1;c=j;e=k;f=t;h=u;b()};this.addPoint=function(j,k){m?(m=!1,c=j,e=k,f=j,h=k):(c=c<j?c:j,e=e<k?e:k,f=f>j?f:j,h=h>k?h:k);b()};this.add3Points=
+function(j,k,t,u,w,v){m?(m=!1,c=j<t?j<w?j:w:t<w?t:w,e=k<u?k<v?k:v:u<v?u:v,f=j>t?j>w?j:w:t>w?t:w,h=k>u?k>v?k:v:u>v?u:v):(c=j<t?j<w?j<c?j:c:w<c?w:c:t<w?t<c?t:c:w<c?w:c,e=k<u?k<v?k<e?k:e:v<e?v:e:u<v?u<e?u:e:v<e?v:e,f=j>t?j>w?j>f?j:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f,h=k>u?k>v?k>h?k:h:v>h?v:h:u>v?u>h?u:h:v>h?v:h);b()};this.addRectangle=function(j){m?(m=!1,c=j.getLeft(),e=j.getTop(),f=j.getRight(),h=j.getBottom()):(c=c<j.getLeft()?c:j.getLeft(),e=e<j.getTop()?e:j.getTop(),f=f>j.getRight()?f:j.getRight(),h=h>
 j.getBottom()?h:j.getBottom());b()};this.inflate=function(j){c-=j;e-=j;f+=j;h+=j;b()};this.minSelf=function(j){c=c>j.getLeft()?c:j.getLeft();e=e>j.getTop()?e:j.getTop();f=f<j.getRight()?f:j.getRight();h=h<j.getBottom()?h:j.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){m=!0;h=f=e=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,k,j,m,p,o,t,v,w,u,y,x){this.set(b||1,c||0,e||0,f||0,h||0,k||1,j||0,m||0,p||0,o||0,t||1,v||0,w||0,u||0,y||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,j,m,p,o,t,v,w,u,y,x){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=j;this.n24=m;this.n31=p;this.n32=o;this.n33=t;this.n34=v;this.n41=w;this.n42=u;this.n43=y;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,h,k,j,m,p,o,t,u,w,v,y,x){this.set(b||1,c||0,e||0,f||0,h||0,k||1,j||0,m||0,p||0,o||0,t||1,u||0,w||0,v||0,y||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,j,m,p,o,t,u,w,v,y,x){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=j;this.n24=m;this.n31=p;this.n32=o;this.n33=t;this.n34=u;this.n41=w;this.n42=v;this.n43=y;this.n44=x;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h;
 b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,p=b.n23,o=b.n24,t=b.n31,v=b.n32,w=b.n33,u=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44,D=c.n11,C=c.n12,
-E=c.n13,J=c.n14,O=c.n21,K=c.n22,I=c.n23,F=c.n24,Y=c.n31,G=c.n32,M=c.n33,L=c.n34,S=c.n41,n=c.n42,V=c.n43,fa=c.n44;this.n11=e*D+f*O+h*Y+k*S;this.n12=e*C+f*K+h*G+k*n;this.n13=e*E+f*I+h*M+k*V;this.n14=e*J+f*F+h*L+k*fa;this.n21=j*D+m*O+p*Y+o*S;this.n22=j*C+m*K+p*G+o*n;this.n23=j*E+m*I+p*M+o*V;this.n24=j*J+m*F+p*L+o*fa;this.n31=t*D+v*O+w*Y+u*S;this.n32=t*C+v*K+w*G+u*n;this.n33=t*E+v*I+w*M+u*V;this.n34=t*J+v*F+w*L+u*fa;this.n41=y*D+x*O+B*Y+z*S;this.n42=y*C+x*K+B*G+z*n;this.n43=y*E+x*I+B*M+z*V;this.n44=y*
-J+x*F+B*L+z*fa;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
-b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,j=this.n23,m=this.n24,p=this.n31,o=this.n32,t=this.n33,v=this.n34,w=this.n41,u=this.n42,y=this.n43,x=this.n44;return f*j*o*w-e*m*o*w-f*k*t*w+c*m*t*w+e*k*v*w-c*j*v*w-f*j*p*u+e*m*p*u+f*h*t*u-b*m*t*u-e*h*v*u+b*j*v*u+f*k*p*y-c*m*p*y-f*h*o*y+b*m*o*y+c*h*v*y-b*k*v*y-e*k*p*x+c*j*p*x+e*h*o*x-b*j*o*x-c*h*
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,p=b.n23,o=b.n24,t=b.n31,u=b.n32,w=b.n33,v=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44,D=c.n11,C=c.n12,
+E=c.n13,J=c.n14,O=c.n21,K=c.n22,H=c.n23,F=c.n24,T=c.n31,G=c.n32,M=c.n33,L=c.n34,P=c.n41,n=c.n42,X=c.n43,la=c.n44;this.n11=e*D+f*O+h*T+k*P;this.n12=e*C+f*K+h*G+k*n;this.n13=e*E+f*H+h*M+k*X;this.n14=e*J+f*F+h*L+k*la;this.n21=j*D+m*O+p*T+o*P;this.n22=j*C+m*K+p*G+o*n;this.n23=j*E+m*H+p*M+o*X;this.n24=j*J+m*F+p*L+o*la;this.n31=t*D+u*O+w*T+v*P;this.n32=t*C+u*K+w*G+v*n;this.n33=t*E+u*H+w*M+v*X;this.n34=t*J+u*F+w*L+v*la;this.n41=y*D+x*O+B*T+z*P;this.n42=y*C+x*K+B*G+z*n;this.n43=y*E+x*H+B*M+z*X;this.n44=y*
+J+x*F+B*L+z*la;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=
+b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,j=this.n23,m=this.n24,p=this.n31,o=this.n32,t=this.n33,u=this.n34,w=this.n41,v=this.n42,y=this.n43,x=this.n44;return f*j*o*w-e*m*o*w-f*k*t*w+c*m*t*w+e*k*u*w-c*j*u*w-f*j*p*v+e*m*p*v+f*h*t*v-b*m*t*v-e*h*u*v+b*j*u*v+f*k*p*y-c*m*p*y-f*h*o*y+b*m*o*y+c*h*u*y-b*k*u*y-e*k*p*x+c*j*p*x+e*h*o*x-b*j*o*x-c*h*
 t*x+b*k*t*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=
 this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
 this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
 this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
 0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),h=1-e,k=b.x,j=b.y,m=b.z,p=h*k,o=h*j;this.set(p*k+e,p*j-f*m,p*m+f*j,0,p*j+f*m,o*j+e,o*m-f*k,0,p*m-f*j,o*m+f*k,h*m*m+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
 new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,h=b.z,k=Math.cos(e),e=Math.sin(e),j=Math.cos(f),f=Math.sin(f),m=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var p=
-j*m,o=j*h,t=f*m,v=f*h;this.n11=p+v*e;this.n12=t*e-o;this.n13=k*f;this.n21=k*h;this.n22=k*m;this.n23=-e;this.n31=o*e-t;this.n32=v+p*e;this.n33=k*j;break;case "ZXY":p=j*m;o=j*h;t=f*m;v=f*h;this.n11=p-v*e;this.n12=-k*h;this.n13=t+o*e;this.n21=o+t*e;this.n22=k*m;this.n23=v-p*e;this.n31=-k*f;this.n32=e;this.n33=k*j;break;case "ZYX":p=k*m;o=k*h;t=e*m;v=e*h;this.n11=j*m;this.n12=t*f-o;this.n13=p*f+v;this.n21=j*h;this.n22=v*f+p;this.n23=o*f-t;this.n31=-f;this.n32=e*j;this.n33=k*j;break;case "YZX":p=k*j;o=
-k*f;t=e*j;v=e*f;this.n11=j*m;this.n12=v-p*h;this.n13=t*h+o;this.n21=h;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=o*h+t;this.n33=p-v*h;break;case "XZY":p=k*j;o=k*f;t=e*j;v=e*f;this.n11=j*m;this.n12=-h;this.n13=f*m;this.n21=p*h+v;this.n22=k*m;this.n23=o*h-t;this.n31=t*h-o;this.n32=e*m;this.n33=v*h+p;break;default:p=k*m,o=k*h,t=e*m,v=e*h,this.n11=j*m,this.n12=-j*h,this.n13=f,this.n21=o+t*f,this.n22=p-v*f,this.n23=-e*j,this.n31=v-p*f,this.n32=t+o*f,this.n33=k*j}return this},setRotationFromQuaternion:function(b){var c=
+j*m,o=j*h,t=f*m,u=f*h;this.n11=p+u*e;this.n12=t*e-o;this.n13=k*f;this.n21=k*h;this.n22=k*m;this.n23=-e;this.n31=o*e-t;this.n32=u+p*e;this.n33=k*j;break;case "ZXY":p=j*m;o=j*h;t=f*m;u=f*h;this.n11=p-u*e;this.n12=-k*h;this.n13=t+o*e;this.n21=o+t*e;this.n22=k*m;this.n23=u-p*e;this.n31=-k*f;this.n32=e;this.n33=k*j;break;case "ZYX":p=k*m;o=k*h;t=e*m;u=e*h;this.n11=j*m;this.n12=t*f-o;this.n13=p*f+u;this.n21=j*h;this.n22=u*f+p;this.n23=o*f-t;this.n31=-f;this.n32=e*j;this.n33=k*j;break;case "YZX":p=k*j;o=
+k*f;t=e*j;u=e*f;this.n11=j*m;this.n12=u-p*h;this.n13=t*h+o;this.n21=h;this.n22=k*m;this.n23=-e*m;this.n31=-f*m;this.n32=o*h+t;this.n33=p-u*h;break;case "XZY":p=k*j;o=k*f;t=e*j;u=e*f;this.n11=j*m;this.n12=-h;this.n13=f*m;this.n21=p*h+u;this.n22=k*m;this.n23=o*h-t;this.n31=t*h-o;this.n32=e*m;this.n33=u*h+p;break;default:p=k*m,o=k*h,t=e*m,u=e*h,this.n11=j*m,this.n12=-j*h,this.n13=f,this.n21=o+t*f,this.n22=p-u*f,this.n23=-e*j,this.n31=u-p*f,this.n32=t+o*f,this.n33=k*j}return this},setRotationFromQuaternion:function(b){var c=
 b.x,e=b.y,f=b.z,h=b.w,k=c+c,j=e+e,m=f+f,b=c*k,p=c*j;c*=m;var o=e*j;e*=m;f*=m;k*=h;j*=h;h*=m;this.n11=1-(o+f);this.n12=p-h;this.n13=c+j;this.n21=p+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-j;this.n32=e+k;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;
 f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length();
 e.y=h.length();e.z=k.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23=
 b.n23*h;this.n33=b.n33*h}};
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,p=b.n23,o=b.n24,t=b.n31,v=b.n32,w=b.n33,u=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*u*x-o*w*x+o*v*B-m*u*B-p*v*z+m*w*z;c.n12=k*w*x-h*u*x-k*v*B+f*u*B+h*v*z-f*w*z;c.n13=h*o*x-k*p*x+k*m*B-f*o*B-h*m*z+f*p*z;c.n14=k*p*v-h*o*v-k*m*w+f*o*w+h*m*u-f*p*u;c.n21=o*w*y-p*u*y-o*t*B+j*u*B+p*t*z-j*w*z;c.n22=h*u*y-k*w*y+k*t*B-e*u*B-h*t*z+e*w*z;c.n23=k*p*y-h*o*y-k*j*B+e*o*B+h*j*z-e*p*z;c.n24=
-h*o*t-k*p*t+k*j*w-e*o*w-h*j*u+e*p*u;c.n31=m*u*y-o*v*y+o*t*x-j*u*x-m*t*z+j*v*z;c.n32=k*v*y-f*u*y-k*t*x+e*u*x+f*t*z-e*v*z;c.n33=h*o*y-k*m*y+k*j*x-e*o*x-f*j*z+e*m*z;c.n34=k*m*t-f*o*t-k*j*v+e*o*v+f*j*u-e*m*u;c.n41=p*v*y-m*w*y-p*t*x+j*w*x+m*t*B-j*v*B;c.n42=f*w*y-h*v*y+h*t*x-e*w*x-f*t*B+e*v*B;c.n43=h*m*y-f*p*y-h*j*x+e*p*x+f*j*B-e*m*B;c.n44=f*p*t-h*m*t+h*j*v-e*p*v-f*j*w+e*m*w;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,v=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*j;e[4]=b*m;e[5]=b*p;e[6]=b*o;e[7]=b*t;e[8]=b*v;return c};
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,j=b.n21,m=b.n22,p=b.n23,o=b.n24,t=b.n31,u=b.n32,w=b.n33,v=b.n34,y=b.n41,x=b.n42,B=b.n43,z=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*x-o*w*x+o*u*B-m*v*B-p*u*z+m*w*z;c.n12=k*w*x-h*v*x-k*u*B+f*v*B+h*u*z-f*w*z;c.n13=h*o*x-k*p*x+k*m*B-f*o*B-h*m*z+f*p*z;c.n14=k*p*u-h*o*u-k*m*w+f*o*w+h*m*v-f*p*v;c.n21=o*w*y-p*v*y-o*t*B+j*v*B+p*t*z-j*w*z;c.n22=h*v*y-k*w*y+k*t*B-e*v*B-h*t*z+e*w*z;c.n23=k*p*y-h*o*y-k*j*B+e*o*B+h*j*z-e*p*z;c.n24=
+h*o*t-k*p*t+k*j*w-e*o*w-h*j*v+e*p*v;c.n31=m*v*y-o*u*y+o*t*x-j*v*x-m*t*z+j*u*z;c.n32=k*u*y-f*v*y-k*t*x+e*v*x+f*t*z-e*u*z;c.n33=h*o*y-k*m*y+k*j*x-e*o*x-f*j*z+e*m*z;c.n34=k*m*t-f*o*t-k*j*u+e*o*u+f*j*v-e*m*v;c.n41=p*u*y-m*w*y-p*t*x+j*w*x+m*t*B-j*u*B;c.n42=f*w*y-h*u*y+h*t*x-e*w*x-f*t*B+e*u*B;c.n43=h*m*y-f*p*y-h*j*x+e*p*x+f*j*B-e*m*B;c.n44=f*p*t-h*m*t+h*j*u-e*p*u-f*j*w+e*m*w;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,t=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*j;e[4]=b*m;e[5]=b*p;e[6]=b*o;e[7]=b*t;e[8]=b*u;return c};
 THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(f-e);j.n23=(f+e)/(f-e);j.n24=0;j.n31=0;j.n32=0;j.n33=-(k+h)/(k-h);j.n34=-2*k*h/(k-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)};
 THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var j,m,p,o;j=new THREE.Matrix4;m=c-b;p=e-f;o=k-h;j.n11=2/m;j.n12=0;j.n13=0;j.n14=-((c+b)/m);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((e+f)/p);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((k+h)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
@@ -55,8 +55,8 @@ this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matri
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),j=b*c,m=f*h;this.w=j*k-m*e;this.x=j*e+m*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
 this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
-this.x,e=this.y,f=this.z,h=this.w,k=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+h*k+e*m-f*j;this.y=e*b+h*j+f*k-c*m;this.z=f*b+h*m+c*j-e*k;this.w=h*b-c*k-e*j-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,k=this.x,j=this.y,m=this.z,p=this.w,o=p*e+j*h-m*f,t=p*f+m*e-k*h,v=p*h+k*f-j*e,e=-k*
-e-j*f-m*h;c.x=o*p+e*-k+t*-m-v*-j;c.y=t*p+e*-j+v*-k-o*-m;c.z=v*p+e*-m+o*-j-t*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*k)/j;f=Math.sin(f*k)/j;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
+this.x,e=this.y,f=this.z,h=this.w,k=b.x,j=b.y,m=b.z,b=b.w;this.x=c*b+h*k+e*m-f*j;this.y=e*b+h*j+f*k-c*m;this.z=f*b+h*m+c*j-e*k;this.w=h*b-c*k-e*j-f*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,h=b.z,k=this.x,j=this.y,m=this.z,p=this.w,o=p*e+j*h-m*f,t=p*f+m*e-k*h,u=p*h+k*f-j*e,e=-k*
+e-j*f-m*h;c.x=o*p+e*-k+t*-m-u*-j;c.y=t*p+e*-j+u*-k-o*-m;c.z=u*p+e*-m+o*-j-t*-k;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var k=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;h=Math.sin((1-f)*k)/j;f=Math.sin(f*k)/j;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,k){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,e,f,h,k,j){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -65,16 +65,16 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function()
 e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,h,k,j,m=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){m.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)m.addSelf(k.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],j=this.vertices[k.c],m.sub(j.position,e.position),p.sub(c.position,e.position),m.crossSelf(p);m.isZero()||
 m.normalize();k.normal.copy(m)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,k,n){m=b.vertices[e].position;p=b.vertices[c].position;o=b.vertices[f].position;t=j[h];v=j[k];w=j[n];u=p.x-m.x;y=o.x-m.x;x=p.y-m.y;B=o.y-m.y;z=p.z-m.z;D=o.z-m.z;C=v.u-t.u;E=w.u-t.u;J=v.v-t.v;O=w.v-t.v;K=1/(C*O-E*J);G.set((O*u-J*y)*
-K,(O*x-J*B)*K,(O*z-J*D)*K);M.set((C*y-E*u)*K,(C*B-E*x)*K,(C*D-E*z)*K);F[e].addSelf(G);F[c].addSelf(G);F[f].addSelf(G);Y[e].addSelf(M);Y[c].addSelf(M);Y[f].addSelf(M)}var c,e,f,h,k,j,m,p,o,t,v,w,u,y,x,B,z,D,C,E,J,O,K,I,F=[],Y=[],G=new THREE.Vector3,M=new THREE.Vector3,L=new THREE.Vector3,S=new THREE.Vector3,n=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)F[c]=new THREE.Vector3,Y[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],j=this.faceVertexUvs[0][c],k instanceof
-THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var V=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)n.copy(k.vertexNormals[f]),h=k[V[f]],I=F[h],L.copy(I),L.subSelf(n.multiplyScalar(n.dot(I))).normalize(),S.cross(k.vertexNormals[f],I),h=S.dot(Y[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(L.x,L.y,L.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,e,c,f,h,k,n){m=b.vertices[e].position;p=b.vertices[c].position;o=b.vertices[f].position;t=j[h];u=j[k];w=j[n];v=p.x-m.x;y=o.x-m.x;x=p.y-m.y;B=o.y-m.y;z=p.z-m.z;D=o.z-m.z;C=u.u-t.u;E=w.u-t.u;J=u.v-t.v;O=w.v-t.v;K=1/(C*O-E*J);G.set((O*v-J*y)*
+K,(O*x-J*B)*K,(O*z-J*D)*K);M.set((C*y-E*v)*K,(C*B-E*x)*K,(C*D-E*z)*K);F[e].addSelf(G);F[c].addSelf(G);F[f].addSelf(G);T[e].addSelf(M);T[c].addSelf(M);T[f].addSelf(M)}var c,e,f,h,k,j,m,p,o,t,u,w,v,y,x,B,z,D,C,E,J,O,K,H,F=[],T=[],G=new THREE.Vector3,M=new THREE.Vector3,L=new THREE.Vector3,P=new THREE.Vector3,n=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)F[c]=new THREE.Vector3,T[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],j=this.faceVertexUvs[0][c],k instanceof
+THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var X=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)n.copy(k.vertexNormals[f]),h=k[X[f]],H=F[h],L.copy(H),L.subSelf(n.multiplyScalar(n.dot(H))).normalize(),P.cross(k.vertexNormals[f],H),h=P.dot(T[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(L.x,L.y,L.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===
 void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,k,j,m={};e=0;for(f=this.faces.length;e<f;e++)j=this.faces[e],j instanceof THREE.Face3?(h=b(j.a,j.b),c(m,h,e),h=b(j.b,j.c),c(m,h,e),h=b(j.a,j.c),c(m,h,e)):j instanceof THREE.Face4&&(h=b(j.b,j.d),c(m,h,e),h=b(j.a,j.b),c(m,h,e),h=b(j.a,j.d),c(m,h,e),h=b(j.b,j.c),c(m,h,e),h=b(j.c,j.d),c(m,h,e));e=0;for(f=this.edges.length;e<f;e++){j=this.edges[e];h=j.vertexIndices[0];k=j.vertexIndices[1];
 j.faceIndices=m[b(h,k)].array;for(h=0;h<j.faceIndices.length;h++)k=j.faceIndices[h],j.faces.push(this.faces[k])}}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,e,c,f,j,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*j+e}this.points=b;var e=[],f={x:0,y:0,z:0},h,k,j,m,p,o,t,v,w;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;k=Math.floor(h);j=h-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;o=this.points[e[0]];t=this.points[e[1]];
-v=this.points[e[2]];w=this.points[e[3]];m=j*j;p=j*m;f.x=c(o.x,t.x,v.x,w.x,j,m,p);f.y=c(o.y,t.y,v.y,w.y,j,m,p);f.z=c(o.z,t.z,v.z,w.z,j,m,p);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;j.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
-m+=h.distanceTo(j),j.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,j,h,k,m=[],p=new THREE.Vector3,v=this.getLength();m.push(p.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=v.chunks[e]-v.chunks[e-1];k=Math.ceil(b*c/v.total);j=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<k-1;c++)f=j+c*(1/k)*(h-j),position=this.getPoint(f),m.push(p.copy(position).clone());
+THREE.Spline=function(b){function c(b,e,c,f,j,h,k){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*k+(-3*(e-c)-2*b-f)*h+b*j+e}this.points=b;var e=[],f={x:0,y:0,z:0},h,k,j,m,p,o,t,u,w;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;k=Math.floor(h);j=h-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;o=this.points[e[0]];t=this.points[e[1]];
+u=this.points[e[2]];w=this.points[e[3]];m=j*j;p=j*m;f.x=c(o.x,t.x,u.x,w.x,j,m,p);f.y=c(o.y,t.y,u.y,w.y,j,m,p);f.z=c(o.z,t.z,u.z,w.z,j,m,p);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);c=this.points.length*b;j.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
+m+=h.distanceTo(j),j.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(k[e]=m,f=e);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var e,c,f,j,h,k,m=[],p=new THREE.Vector3,u=this.getLength();m.push(p.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=u.chunks[e]-u.chunks[e-1];k=Math.ceil(b*c/u.total);j=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<k-1;c++)f=j+c*(1/k)*(h-j),position=this.getPoint(f),m.push(p.copy(position).clone());
 m.push(p.copy(this.points[e]).clone())}this.points=m}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
@@ -131,58 +131,58 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
 THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=p[m]=p[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,j=b.z+b.w,h=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return j>=0&&h>=0&&k>=0&&m>=0?!0:j<0&&h<0||k<0&&m<0?!1:(j<0?c=Math.max(c,j/(j-h)):h<0&&(f=Math.min(f,j/(j-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,k=[],j,m,p=[],o,t,v=[],w,u=[],y,x,B=[],z,D,C=[],E=[],J=[],O=new THREE.Vector4,K=new THREE.Vector4,
-I=new THREE.Matrix4,F=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(b,e){I.multiply(e.projectionMatrix,e.matrixWorldInverse);I.multiplyVector3(b);return b};this.unprojectVector=function(b,e){I.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));I.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var m,p;h=E.length=0;
-m=b.objects;b=0;for(e=m.length;b<e;b++){p=m[b];var v;if(!(v=!p.visible))if(v=p instanceof THREE.Mesh){a:{v=void 0;for(var o=p.matrixWorld,u=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),t=0;t<6;t++)if(v=Y[t].x*o.n14+Y[t].y*o.n24+Y[t].z*o.n34+Y[t].w,v<=u){v=!1;break a}v=!0}v=!v}if(!v)v=k[h]=k[h]||new THREE.RenderableObject,h++,f=v,O.copy(p.position),I.multiplyVector3(O),f.object=p,f.z=O.z,E.push(f)}j&&E.sort(c);return E};this.projectScene=function(f,h,k){var E=
-h.near,O=h.far,Q,da,$,ka,U,aa,ja,ha,X,ca,ga,ia,ma,Z,N,ra,la;D=x=w=t=J.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);I.multiply(h.projectionMatrix,h.matrixWorldInverse);Y[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);Y[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);Y[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);Y[3].set(I.n41-I.n21,I.n42-I.n22,I.n43-I.n23,I.n44-I.n24);Y[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);Y[5].set(I.n41+I.n31,
-I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(Q=0;Q<6;Q++)X=Y[Q],X.divideScalar(Math.sqrt(X.x*X.x+X.y*X.y+X.z*X.z));X=this.projectObjects(f,h,!0);f=0;for(Q=X.length;f<Q;f++)if(ca=X[f].object,ca.visible)if(ga=ca.matrixWorld,ia=ca.matrixRotationWorld,ma=ca.materials,Z=ca.overdraw,m=0,ca instanceof THREE.Mesh){N=ca.geometry;ka=N.vertices;ra=N.faces;N=N.faceVertexUvs;da=0;for($=ka.length;da<$;da++)j=b(),j.positionWorld.copy(ka[da].position),ga.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
-I.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>E&&j.positionScreen.z<O;ka=0;for(da=ra.length;ka<da;ka++){$=ra[ka];if($ instanceof THREE.Face3)if(U=p[$.a],aa=p[$.b],ja=p[$.c],U.visible&&aa.visible&&ja.visible&&(ca.doubleSided||ca.flipSided!=(ja.positionScreen.x-U.positionScreen.x)*(aa.positionScreen.y-U.positionScreen.y)-(ja.positionScreen.y-U.positionScreen.y)*(aa.positionScreen.x-U.positionScreen.x)<0))ha=
-v[t]=v[t]||new THREE.RenderableFace3,t++,o=ha,o.v1.copy(U),o.v2.copy(aa),o.v3.copy(ja);else continue;else if($ instanceof THREE.Face4)if(U=p[$.a],aa=p[$.b],ja=p[$.c],ha=p[$.d],U.visible&&aa.visible&&ja.visible&&ha.visible&&(ca.doubleSided||ca.flipSided!=((ha.positionScreen.x-U.positionScreen.x)*(aa.positionScreen.y-U.positionScreen.y)-(ha.positionScreen.y-U.positionScreen.y)*(aa.positionScreen.x-U.positionScreen.x)<0||(aa.positionScreen.x-ja.positionScreen.x)*(ha.positionScreen.y-ja.positionScreen.y)-
-(aa.positionScreen.y-ja.positionScreen.y)*(ha.positionScreen.x-ja.positionScreen.x)<0)))la=u[w]=u[w]||new THREE.RenderableFace4,w++,o=la,o.v1.copy(U),o.v2.copy(aa),o.v3.copy(ja),o.v4.copy(ha);else continue;o.normalWorld.copy($.normal);ia.multiplyVector3(o.normalWorld);o.centroidWorld.copy($.centroid);ga.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);I.multiplyVector3(o.centroidScreen);ja=$.vertexNormals;U=0;for(aa=ja.length;U<aa;U++)ha=o.vertexNormalsWorld[U],ha.copy(ja[U]),
-ia.multiplyVector3(ha);U=0;for(aa=N.length;U<aa;U++)if(la=N[U][ka]){ja=0;for(ha=la.length;ja<ha;ja++)o.uvs[U][ja]=la[ja]}o.meshMaterials=ma;o.faceMaterials=$.materials;o.overdraw=Z;o.z=o.centroidScreen.z;J.push(o)}}else if(ca instanceof THREE.Line){F.multiply(I,ga);ka=ca.geometry.vertices;U=b();U.positionScreen.copy(ka[0].position);F.multiplyVector4(U.positionScreen);da=1;for($=ka.length;da<$;da++)if(U=b(),U.positionScreen.copy(ka[da].position),F.multiplyVector4(U.positionScreen),aa=p[m-2],G.copy(U.positionScreen),
-M.copy(aa.positionScreen),e(G,M))G.multiplyScalar(1/G.w),M.multiplyScalar(1/M.w),ga=B[x]=B[x]||new THREE.RenderableLine,x++,y=ga,y.v1.positionScreen.copy(G),y.v2.positionScreen.copy(M),y.z=Math.max(G.z,M.z),y.materials=ca.materials,J.push(y)}else if(ca instanceof THREE.Particle&&(K.set(ca.matrixWorld.n14,ca.matrixWorld.n24,ca.matrixWorld.n34,1),I.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=C[D]=C[D]||new THREE.RenderableParticle,D++,z=ga,z.x=K.x/K.w,z.y=K.y/K.w,z.z=K.z,z.rotation=ca.rotation.z,z.scale.x=
-ca.scale.x*Math.abs(z.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),z.scale.y=ca.scale.y*Math.abs(z.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),z.materials=ca.materials,J.push(z);k&&J.sort(c);return J}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,o,t,v,w,u,y,x;b=c.projectScene(e,f);p=0;for(o=b.length;p<o;p++)if(w=b[p],w instanceof THREE.RenderableParticle){y=w.x*h+h;x=w.y*k+k;t=0;for(v=w.material.length;t<v;t++)if(u=w.material[t],u instanceof THREE.ParticleDOMMaterial)u=u.domElement,u.style.left=y+"px",u.style.top=x+"px"}}};
-THREE.CanvasRenderer=function(b){function c(b){if(B!=b)u.globalAlpha=B=b}function e(b){if(z!=b){switch(b){case THREE.NormalBlending:u.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:u.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:u.globalCompositeOperation="darker"}z=b}}function f(b){if(D!=b)u.strokeStyle=D=b}function h(b){if(C!=b)u.fillStyle=C=b}var k=this,j=null,m=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
-o,t,v,w,u=p.getContext("2d"),y=new THREE.Color(0),x=0,B=1,z=0,D=null,C=null,E=null,J=null,O=null,K,I,F,Y,G=new THREE.RenderableVertex,M=new THREE.RenderableVertex,L,S,n,V,fa,Q,da,$,ka,U,aa,ja,ha=new THREE.Color(0),X=new THREE.Color(0),ca=new THREE.Color(0),ga=new THREE.Color(0),ia=new THREE.Color(0),ma=[],Z,N,ra,la,sa,Ha,oa,va,Ja,Da,pa=new THREE.Rectangle,ta=new THREE.Rectangle,ea=new THREE.Rectangle,ya=!1,xa=new THREE.Color,wa=new THREE.Color,Ea=new THREE.Color,Fa=new THREE.Color,na=new THREE.Vector3,
-T,Aa,W,za,Va,Ba,b=16;T=document.createElement("canvas");T.width=T.height=2;Aa=T.getContext("2d");Aa.fillStyle="rgba(0,0,0,1)";Aa.fillRect(0,0,2,2);W=Aa.getImageData(0,0,2,2);za=W.data;Va=document.createElement("canvas");Va.width=Va.height=b;Ba=Va.getContext("2d");Ba.translate(-b/2,-b/2);Ba.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){o=b;t=e;v=Math.floor(o/2);w=Math.floor(t/2);p.width=o;p.height=t;pa.set(-v,
--w,v,w);ta.set(-v,-w,v,w);B=1;z=0;O=J=E=C=D=null};this.setClearColor=function(b,e){y.copy(b);x=e;ta.set(-v,-w,v,w)};this.setClearColorHex=function(b,e){y.setHex(b);x=e;ta.set(-v,-w,v,w)};this.clear=function(){u.setTransform(1,0,0,-1,v,w);ta.isEmpty()||(ta.minSelf(pa),ta.inflate(2),x<1&&u.clearRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight())),x>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
-255)+","+x+")"),u.fillRect(Math.floor(ta.getX()),Math.floor(ta.getY()),Math.floor(ta.getWidth()),Math.floor(ta.getHeight()))),ta.empty())};this.render=function(b,p){function o(b){var e,c,f,j=b.lights;wa.setRGB(0,0,0);Ea.setRGB(0,0,0);Fa.setRGB(0,0,0);b=0;for(e=j.length;b<e;b++)c=j[b],f=c.color,c instanceof THREE.AmbientLight?(wa.r+=f.r,wa.g+=f.g,wa.b+=f.b):c instanceof THREE.DirectionalLight?(Ea.r+=f.r,Ea.g+=f.g,Ea.b+=f.b):c instanceof THREE.PointLight&&(Fa.r+=f.r,Fa.g+=f.g,Fa.b+=f.b)}function t(b,
-e,c,f){var j,h,k,n,m=b.lights,b=0;for(j=m.length;b<j;b++)h=m[b],k=h.color,h instanceof THREE.DirectionalLight?(n=c.dot(h.position),n<=0||(n*=h.intensity,f.r+=k.r*n,f.g+=k.g*n,f.b+=k.b*n)):h instanceof THREE.PointLight&&(n=c.dot(na.sub(h.position,e).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),n!=0&&(n*=h.intensity,f.r+=k.r*n,f.g+=k.g*n,f.b+=k.b*n)))}function y(b,j,k){c(k.opacity);e(k.blending);var n,m,p,o,W,t;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)o=
-k.map.image,W=o.width>>1,t=o.height>>1,k=j.scale.x*v,p=j.scale.y*w,n=k*W,m=p*t,ea.set(b.x-n,b.y-m,b.x+n,b.y+m),pa.instersects(ea)&&(u.save(),u.translate(b.x,b.y),u.rotate(-j.rotation),u.scale(k,-p),u.translate(-W,-t),u.drawImage(o,0,0),u.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(n=j.scale.x*v,m=j.scale.y*w,ea.set(b.x-n,b.y-m,b.x+n,b.y+m),pa.instersects(ea)&&(f(k.color.getContextStyle()),h(k.color.getContextStyle()),u.save(),u.translate(b.x,b.y),u.rotate(-j.rotation),u.scale(n,m),
-k.program(u),u.restore()))}function B(b,j,h,k){c(k.opacity);e(k.blending);u.beginPath();u.moveTo(b.positionScreen.x,b.positionScreen.y);u.lineTo(j.positionScreen.x,j.positionScreen.y);u.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(E!=b)u.lineWidth=E=b;b=k.linecap;if(J!=b)u.lineCap=J=b;b=k.linejoin;if(O!=b)u.lineJoin=O=b;f(k.color.getContextStyle());u.stroke();ea.inflate(k.linewidth*2)}}function x(b,f,j,h,m,v,o,W,u){k.data.vertices+=3;k.data.faces++;c(W.opacity);e(W.blending);
-L=b.positionScreen.x;S=b.positionScreen.y;n=f.positionScreen.x;V=f.positionScreen.y;fa=j.positionScreen.x;Q=j.positionScreen.y;D(L,S,n,V,fa,Q);if(W instanceof THREE.MeshBasicMaterial)if(W.map)W.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Ya(L,S,n,V,fa,Q,la[h].u,la[h].v,la[m].u,la[m].v,la[v].u,la[v].v,W.map));else if(W.envMap){if(W.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,na.copy(o.vertexNormalsWorld[0]),sa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,
-Ha=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(o.vertexNormalsWorld[1]),oa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,va=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(o.vertexNormalsWorld[2]),Ja=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Da=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,Ya(L,S,n,V,fa,Q,sa,Ha,oa,va,Ja,Da,W.envMap)}else W.wireframe?Ka(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):La(W.color);else if(W instanceof THREE.MeshLambertMaterial)W.map&&!W.wireframe&&
-(W.map.mapping instanceof THREE.UVMapping&&(la=o.uvs[0],Ya(L,S,n,V,fa,Q,la[h].u,la[h].v,la[m].u,la[m].v,la[v].u,la[v].v,W.map)),e(THREE.SubtractiveBlending)),ya?!W.wireframe&&W.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(X.r=ca.r=ga.r=wa.r,X.g=ca.g=ga.g=wa.g,X.b=ca.b=ga.b=wa.b,t(u,o.v1.positionWorld,o.vertexNormalsWorld[0],X),t(u,o.v2.positionWorld,o.vertexNormalsWorld[1],ca),t(u,o.v3.positionWorld,o.vertexNormalsWorld[2],ga),ia.r=(ca.r+ga.r)*0.5,ia.g=(ca.g+ga.g)*0.5,ia.b=(ca.b+
-ga.b)*0.5,ra=Wa(X,ca,ga,ia),Ta(L,S,n,V,fa,Q,0,0,1,0,0,1,ra)):(xa.r=wa.r,xa.g=wa.g,xa.b=wa.b,t(u,o.centroidWorld,o.normalWorld,xa),ha.r=Math.max(0,Math.min(W.color.r*xa.r,1)),ha.g=Math.max(0,Math.min(W.color.g*xa.g,1)),ha.b=Math.max(0,Math.min(W.color.b*xa.b,1)),W.wireframe?Ka(ha,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):La(ha)):W.wireframe?Ka(W.color,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):La(W.color);else if(W instanceof THREE.MeshDepthMaterial)Z=p.near,N=
-p.far,X.r=X.g=X.b=1-Oa(b.positionScreen.z,Z,N),ca.r=ca.g=ca.b=1-Oa(f.positionScreen.z,Z,N),ga.r=ga.g=ga.b=1-Oa(j.positionScreen.z,Z,N),ia.r=(ca.r+ga.r)*0.5,ia.g=(ca.g+ga.g)*0.5,ia.b=(ca.b+ga.b)*0.5,ra=Wa(X,ca,ga,ia),Ta(L,S,n,V,fa,Q,0,0,1,0,0,1,ra);else if(W instanceof THREE.MeshNormalMaterial)ha.r=Ua(o.normalWorld.x),ha.g=Ua(o.normalWorld.y),ha.b=Ua(o.normalWorld.z),W.wireframe?Ka(ha,W.wireframeLinewidth,W.wireframeLinecap,W.wireframeLinejoin):La(ha)}function z(b,f,j,h,m,v,W,o,u){k.data.vertices+=
-4;k.data.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)x(b,f,h,0,1,3,W,o,u),x(m,j,v,1,2,3,W,o,u);else if(L=b.positionScreen.x,S=b.positionScreen.y,n=f.positionScreen.x,V=f.positionScreen.y,fa=j.positionScreen.x,Q=j.positionScreen.y,da=h.positionScreen.x,$=h.positionScreen.y,ka=m.positionScreen.x,U=m.positionScreen.y,aa=v.positionScreen.x,ja=v.positionScreen.y,o instanceof THREE.MeshBasicMaterial)C(L,S,n,V,fa,Q,da,$),o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):
-La(o.color);else if(o instanceof THREE.MeshLambertMaterial)ya?!o.wireframe&&o.shading==THREE.SmoothShading&&W.vertexNormalsWorld.length==4?(X.r=ca.r=ga.r=ia.r=wa.r,X.g=ca.g=ga.g=ia.g=wa.g,X.b=ca.b=ga.b=ia.b=wa.b,t(u,W.v1.positionWorld,W.vertexNormalsWorld[0],X),t(u,W.v2.positionWorld,W.vertexNormalsWorld[1],ca),t(u,W.v4.positionWorld,W.vertexNormalsWorld[3],ga),t(u,W.v3.positionWorld,W.vertexNormalsWorld[2],ia),ra=Wa(X,ca,ga,ia),D(L,S,n,V,da,$),Ta(L,S,n,V,da,$,0,0,1,0,0,1,ra),D(ka,U,fa,Q,aa,ja),Ta(ka,
-U,fa,Q,aa,ja,1,0,1,1,0,1,ra)):(xa.r=wa.r,xa.g=wa.g,xa.b=wa.b,t(u,W.centroidWorld,W.normalWorld,xa),ha.r=Math.max(0,Math.min(o.color.r*xa.r,1)),ha.g=Math.max(0,Math.min(o.color.g*xa.g,1)),ha.b=Math.max(0,Math.min(o.color.b*xa.b,1)),C(L,S,n,V,fa,Q,da,$),o.wireframe?Ka(ha,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(ha)):(C(L,S,n,V,fa,Q,da,$),o.wireframe?Ka(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(o.color));else if(o instanceof THREE.MeshNormalMaterial)ha.r=
-Ua(W.normalWorld.x),ha.g=Ua(W.normalWorld.y),ha.b=Ua(W.normalWorld.z),C(L,S,n,V,fa,Q,da,$),o.wireframe?Ka(ha,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):La(ha);else if(o instanceof THREE.MeshDepthMaterial)Z=p.near,N=p.far,X.r=X.g=X.b=1-Oa(b.positionScreen.z,Z,N),ca.r=ca.g=ca.b=1-Oa(f.positionScreen.z,Z,N),ga.r=ga.g=ga.b=1-Oa(h.positionScreen.z,Z,N),ia.r=ia.g=ia.b=1-Oa(j.positionScreen.z,Z,N),ra=Wa(X,ca,ga,ia),D(L,S,n,V,da,$),Ta(L,S,n,V,da,$,0,0,1,0,0,1,ra),D(ka,U,fa,Q,aa,ja),Ta(ka,
-U,fa,Q,aa,ja,1,0,1,1,0,1,ra)}function D(b,e,c,f,j,h){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(j,h);u.lineTo(b,e);u.closePath()}function C(b,e,c,f,j,h,k,n){u.beginPath();u.moveTo(b,e);u.lineTo(c,f);u.lineTo(j,h);u.lineTo(k,n);u.lineTo(b,e);u.closePath()}function Ka(b,e,c,j){if(E!=e)u.lineWidth=E=e;if(J!=c)u.lineCap=J=c;if(O!=j)u.lineJoin=O=j;f(b.getContextStyle());u.stroke();ea.inflate(e*2)}function La(b){h(b.getContextStyle());u.fill()}function Ya(b,e,c,f,j,k,n,m,o,W,p,v,t){if(t.image.width!=
-0){if(t.needsUpdate==!0||ma[t.id]==void 0){var w=t.wrapS==THREE.RepeatWrapping,Ba=t.wrapT==THREE.RepeatWrapping;ma[t.id]=u.createPattern(t.image,w&&Ba?"repeat":w&&!Ba?"repeat-x":!w&&Ba?"repeat-y":"no-repeat");t.needsUpdate=!1}h(ma[t.id]);var w=t.offset.x/t.repeat.x,Ba=t.offset.y/t.repeat.y,y=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,n=(n+w)*y,m=(m+Ba)*t,o=(o+w)*y,W=(W+Ba)*t,p=(p+w)*y,v=(v+Ba)*t;c-=b;f-=e;j-=b;k-=e;o-=n;W-=m;p-=n;v-=m;w=1/(o*v-p*W);t=(v*c-W*j)*w;W=(v*f-W*k)*w;c=
-(o*j-p*c)*w;f=(o*k-p*f)*w;b=b-t*n-c*m;e=e-W*n-f*m;u.save();u.transform(t,W,c,f,b,e);u.fill();u.restore()}}function Ta(b,e,c,f,j,h,k,n,m,o,W,p,v){var t,w;t=v.width-1;w=v.height-1;k*=t;n*=w;m*=t;o*=w;W*=t;p*=w;c-=b;f-=e;j-=b;h-=e;m-=k;o-=n;W-=k;p-=n;w=1/(m*p-W*o);t=(p*c-o*j)*w;o=(p*f-o*h)*w;c=(m*j-W*c)*w;f=(m*h-W*f)*w;b=b-t*k-c*n;e=e-o*k-f*n;u.save();u.transform(t,o,c,f,b,e);u.clip();u.drawImage(v,0,0);u.restore()}function Wa(b,e,c,f){var j=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),n=~~(e.g*
-255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);za[0]=j<0?0:j>255?255:j;za[1]=h<0?0:h>255?255:h;za[2]=b<0?0:b>255?255:b;za[4]=k<0?0:k>255?255:k;za[5]=n<0?0:n>255?255:n;za[6]=e<0?0:e>255?255:e;za[8]=m<0?0:m>255?255:m;za[9]=o<0?0:o>255?255:o;za[10]=c<0?0:c>255?255:c;za[12]=p<0?0:p>255?255:p;za[13]=v<0?0:v>255?255:v;za[14]=f<0?0:f>255?255:f;Aa.putImageData(W,0,0);Ba.drawImage(T,0,0);return Va}function Oa(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ua(b){b=
-(b+1)*0.5;return b<0?0:b>1?1:b}function Ma(b,e){var c=e.x-b.x,f=e.y-b.y,j=c*c+f*f;j!=0&&(j=1/Math.sqrt(j),c*=j,f*=j,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Xa,Za,qa,Ca,Na,H,A,P;this.autoClear?this.clear():u.setTransform(1,0,0,-1,v,w);k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,p,this.sortElements);(ya=b.lights.length>0)&&o(b);Xa=0;for(Za=j.length;Xa<Za;Xa++){qa=j[Xa];ea.empty();if(qa instanceof THREE.RenderableParticle){K=qa;K.x*=v;K.y*=w;Ca=0;for(Na=qa.materials.length;Ca<Na;)P=qa.materials[Ca++],
-P.opacity!=0&&y(K,qa,P,b)}else if(qa instanceof THREE.RenderableLine){if(K=qa.v1,I=qa.v2,K.positionScreen.x*=v,K.positionScreen.y*=w,I.positionScreen.x*=v,I.positionScreen.y*=w,ea.addPoint(K.positionScreen.x,K.positionScreen.y),ea.addPoint(I.positionScreen.x,I.positionScreen.y),pa.instersects(ea)){Ca=0;for(Na=qa.materials.length;Ca<Na;)P=qa.materials[Ca++],P.opacity!=0&&B(K,I,qa,P,b)}}else if(qa instanceof THREE.RenderableFace3){if(K=qa.v1,I=qa.v2,F=qa.v3,K.positionScreen.x*=v,K.positionScreen.y*=
-w,I.positionScreen.x*=v,I.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,qa.overdraw&&(Ma(K.positionScreen,I.positionScreen),Ma(I.positionScreen,F.positionScreen),Ma(F.positionScreen,K.positionScreen)),ea.add3Points(K.positionScreen.x,K.positionScreen.y,I.positionScreen.x,I.positionScreen.y,F.positionScreen.x,F.positionScreen.y),pa.instersects(ea)){Ca=0;for(Na=qa.meshMaterials.length;Ca<Na;)if(P=qa.meshMaterials[Ca++],P instanceof THREE.MeshFaceMaterial){H=0;for(A=qa.faceMaterials.length;H<
-A;)(P=qa.faceMaterials[H++])&&P.opacity!=0&&x(K,I,F,0,1,2,qa,P,b)}else P.opacity!=0&&x(K,I,F,0,1,2,qa,P,b)}}else if(qa instanceof THREE.RenderableFace4&&(K=qa.v1,I=qa.v2,F=qa.v3,Y=qa.v4,K.positionScreen.x*=v,K.positionScreen.y*=w,I.positionScreen.x*=v,I.positionScreen.y*=w,F.positionScreen.x*=v,F.positionScreen.y*=w,Y.positionScreen.x*=v,Y.positionScreen.y*=w,G.positionScreen.copy(I.positionScreen),M.positionScreen.copy(Y.positionScreen),qa.overdraw&&(Ma(K.positionScreen,I.positionScreen),Ma(I.positionScreen,
-Y.positionScreen),Ma(Y.positionScreen,K.positionScreen),Ma(F.positionScreen,G.positionScreen),Ma(F.positionScreen,M.positionScreen)),ea.addPoint(K.positionScreen.x,K.positionScreen.y),ea.addPoint(I.positionScreen.x,I.positionScreen.y),ea.addPoint(F.positionScreen.x,F.positionScreen.y),ea.addPoint(Y.positionScreen.x,Y.positionScreen.y),pa.instersects(ea))){Ca=0;for(Na=qa.meshMaterials.length;Ca<Na;)if(P=qa.meshMaterials[Ca++],P instanceof THREE.MeshFaceMaterial){H=0;for(A=qa.faceMaterials.length;H<
-A;)(P=qa.faceMaterials[H++])&&P.opacity!=0&&z(K,I,F,Y,G,M,qa,P,b)}else P.opacity!=0&&z(K,I,F,Y,G,M,qa,P,b)}ta.addRectangle(ea)}u.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function b(b,e,c){var f,j,h,k;f=0;for(j=b.lights.length;f<j;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(h.position)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k)):h instanceof THREE.PointLight&&(Y.sub(h.position,e.centroidWorld),Y.normalize(),k=e.normalWorld.dot(Y)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k))}function c(e,c,j,n,m,o){k.data.vertices+=3;k.data.faces++;L=f(S++);L.setAttribute("d",
+THREE.Projector=function(){function b(){var b=p[m]=p[m]||new THREE.RenderableVertex;m++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,j=b.z+b.w,h=e.z+e.w,k=-b.z+b.w,m=-e.z+e.w;return j>=0&&h>=0&&k>=0&&m>=0?!0:j<0&&h<0||k<0&&m<0?!1:(j<0?c=Math.max(c,j/(j-h)):h<0&&(f=Math.min(f,j/(j-h))),k<0?c=Math.max(c,k/(k-m)):m<0&&(f=Math.min(f,k/(k-m))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,k=[],j,m,p=[],o,t,u=[],w,v=[],y,x,B=[],z,D,C=[],E=[],J=[],O=new THREE.Vector4,K=new THREE.Vector4,
+H=new THREE.Matrix4,F=new THREE.Matrix4,T=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],G=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(b,e){H.multiply(e.projectionMatrix,e.matrixWorldInverse);H.multiplyVector3(b);return b};this.unprojectVector=function(b,e){H.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));H.multiplyVector3(b);return b};this.projectObjects=function(b,e,j){var m,p;h=E.length=0;
+m=b.objects;b=0;for(e=m.length;b<e;b++){p=m[b];var u;if(!(u=!p.visible))if(u=p instanceof THREE.Mesh){a:{u=void 0;for(var o=p.matrixWorld,v=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),t=0;t<6;t++)if(u=T[t].x*o.n14+T[t].y*o.n24+T[t].z*o.n34+T[t].w,u<=v){u=!1;break a}u=!0}u=!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,O.copy(p.position),H.multiplyVector3(O),f.object=p,f.z=O.z,E.push(f)}j&&E.sort(c);return E};this.projectScene=function(f,h,k){var E=
+h.near,O=h.far,R,ga,Z,da,ca,ha,ka,$,U,W,ja,ia,ma,Y,N,ra,aa;D=x=w=t=J.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);H.multiply(h.projectionMatrix,h.matrixWorldInverse);T[0].set(H.n41-H.n11,H.n42-H.n12,H.n43-H.n13,H.n44-H.n14);T[1].set(H.n41+H.n11,H.n42+H.n12,H.n43+H.n13,H.n44+H.n14);T[2].set(H.n41+H.n21,H.n42+H.n22,H.n43+H.n23,H.n44+H.n24);T[3].set(H.n41-H.n21,H.n42-H.n22,H.n43-H.n23,H.n44-H.n24);T[4].set(H.n41-H.n31,H.n42-H.n32,H.n43-H.n33,H.n44-H.n34);T[5].set(H.n41+H.n31,
+H.n42+H.n32,H.n43+H.n33,H.n44+H.n34);for(R=0;R<6;R++)U=T[R],U.divideScalar(Math.sqrt(U.x*U.x+U.y*U.y+U.z*U.z));U=this.projectObjects(f,h,!0);f=0;for(R=U.length;f<R;f++)if(W=U[f].object,W.visible)if(ja=W.matrixWorld,ia=W.matrixRotationWorld,ma=W.materials,Y=W.overdraw,m=0,W instanceof THREE.Mesh){N=W.geometry;da=N.vertices;ra=N.faces;N=N.faceVertexUvs;ga=0;for(Z=da.length;ga<Z;ga++)j=b(),j.positionWorld.copy(da[ga].position),ja.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
+H.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>E&&j.positionScreen.z<O;da=0;for(ga=ra.length;da<ga;da++){Z=ra[da];if(Z instanceof THREE.Face3)if(ca=p[Z.a],ha=p[Z.b],ka=p[Z.c],ca.visible&&ha.visible&&ka.visible&&(W.doubleSided||W.flipSided!=(ka.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-(ka.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<
+0))$=u[t]=u[t]||new THREE.RenderableFace3,t++,o=$,o.v1.copy(ca),o.v2.copy(ha),o.v3.copy(ka);else continue;else if(Z instanceof THREE.Face4)if(ca=p[Z.a],ha=p[Z.b],ka=p[Z.c],$=p[Z.d],ca.visible&&ha.visible&&ka.visible&&$.visible&&(W.doubleSided||W.flipSided!=(($.positionScreen.x-ca.positionScreen.x)*(ha.positionScreen.y-ca.positionScreen.y)-($.positionScreen.y-ca.positionScreen.y)*(ha.positionScreen.x-ca.positionScreen.x)<0||(ha.positionScreen.x-ka.positionScreen.x)*($.positionScreen.y-ka.positionScreen.y)-
+(ha.positionScreen.y-ka.positionScreen.y)*($.positionScreen.x-ka.positionScreen.x)<0)))aa=v[w]=v[w]||new THREE.RenderableFace4,w++,o=aa,o.v1.copy(ca),o.v2.copy(ha),o.v3.copy(ka),o.v4.copy($);else continue;o.normalWorld.copy(Z.normal);ia.multiplyVector3(o.normalWorld);o.centroidWorld.copy(Z.centroid);ja.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);H.multiplyVector3(o.centroidScreen);ka=Z.vertexNormals;ca=0;for(ha=ka.length;ca<ha;ca++)$=o.vertexNormalsWorld[ca],$.copy(ka[ca]),
+ia.multiplyVector3($);ca=0;for(ha=N.length;ca<ha;ca++)if(aa=N[ca][da]){ka=0;for($=aa.length;ka<$;ka++)o.uvs[ca][ka]=aa[ka]}o.meshMaterials=ma;o.faceMaterials=Z.materials;o.overdraw=Y;o.z=o.centroidScreen.z;J.push(o)}}else if(W instanceof THREE.Line){F.multiply(H,ja);da=W.geometry.vertices;ca=b();ca.positionScreen.copy(da[0].position);F.multiplyVector4(ca.positionScreen);ga=1;for(Z=da.length;ga<Z;ga++)if(ca=b(),ca.positionScreen.copy(da[ga].position),F.multiplyVector4(ca.positionScreen),ha=p[m-2],
+G.copy(ca.positionScreen),M.copy(ha.positionScreen),e(G,M))G.multiplyScalar(1/G.w),M.multiplyScalar(1/M.w),ja=B[x]=B[x]||new THREE.RenderableLine,x++,y=ja,y.v1.positionScreen.copy(G),y.v2.positionScreen.copy(M),y.z=Math.max(G.z,M.z),y.materials=W.materials,J.push(y)}else if(W instanceof THREE.Particle&&(K.set(W.matrixWorld.n14,W.matrixWorld.n24,W.matrixWorld.n34,1),H.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ja=C[D]=C[D]||new THREE.RenderableParticle,D++,z=ja,z.x=K.x/K.w,z.y=K.y/K.w,z.z=K.z,z.rotation=
+W.rotation.z,z.scale.x=W.scale.x*Math.abs(z.x-(K.x+h.projectionMatrix.n11)/(K.w+h.projectionMatrix.n14)),z.scale.y=W.scale.y*Math.abs(z.y-(K.y+h.projectionMatrix.n22)/(K.w+h.projectionMatrix.n24)),z.materials=W.materials,J.push(z);k&&J.sort(c);return J}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,o,t,u,w,v,y,x;b=c.projectScene(e,f);p=0;for(o=b.length;p<o;p++)if(w=b[p],w instanceof THREE.RenderableParticle){y=w.x*h+h;x=w.y*k+k;t=0;for(u=w.material.length;t<u;t++)if(v=w.material[t],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=y+"px",v.style.top=x+"px"}}};
+THREE.CanvasRenderer=function(b){function c(b){if(B!=b)v.globalAlpha=B=b}function e(b){if(z!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}z=b}}function f(b){if(D!=b)v.strokeStyle=D=b}function h(b){if(C!=b)v.fillStyle=C=b}var k=this,j=null,m=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
+o,t,u,w,v=p.getContext("2d"),y=new THREE.Color(0),x=0,B=1,z=0,D=null,C=null,E=null,J=null,O=null,K,H,F,T,G=new THREE.RenderableVertex,M=new THREE.RenderableVertex,L,P,n,X,la,R,ga,Z,da,ca,ha,ka,$=new THREE.Color(0),U=new THREE.Color(0),W=new THREE.Color(0),ja=new THREE.Color(0),ia=new THREE.Color(0),ma=[],Y,N,ra,aa,va,Ia,oa,wa,Ka,Ea,pa=new THREE.Rectangle,sa=new THREE.Rectangle,ea=new THREE.Rectangle,za=!1,ya=new THREE.Color,xa=new THREE.Color,Fa=new THREE.Color,Ga=new THREE.Color,na=new THREE.Vector3,
+V,Ba,fa,Aa,Xa,Ca,b=16;V=document.createElement("canvas");V.width=V.height=2;Ba=V.getContext("2d");Ba.fillStyle="rgba(0,0,0,1)";Ba.fillRect(0,0,2,2);fa=Ba.getImageData(0,0,2,2);Aa=fa.data;Xa=document.createElement("canvas");Xa.width=Xa.height=b;Ca=Xa.getContext("2d");Ca.translate(-b/2,-b/2);Ca.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){o=b;t=e;u=Math.floor(o/2);w=Math.floor(t/2);p.width=o;p.height=
+t;pa.set(-u,-w,u,w);sa.set(-u,-w,u,w);B=1;z=0;O=J=E=C=D=null};this.setClearColor=function(b,e){y.copy(b);x=e;sa.set(-u,-w,u,w)};this.setClearColorHex=function(b,e){y.setHex(b);x=e;sa.set(-u,-w,u,w)};this.clear=function(){v.setTransform(1,0,0,-1,u,w);sa.isEmpty()||(sa.minSelf(pa),sa.inflate(2),x<1&&v.clearRect(Math.floor(sa.getX()),Math.floor(sa.getY()),Math.floor(sa.getWidth()),Math.floor(sa.getHeight())),x>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+
+Math.floor(y.b*255)+","+x+")"),v.fillRect(Math.floor(sa.getX()),Math.floor(sa.getY()),Math.floor(sa.getWidth()),Math.floor(sa.getHeight()))),sa.empty())};this.render=function(b,p){function o(b){var e,c,f,j=b.lights;xa.setRGB(0,0,0);Fa.setRGB(0,0,0);Ga.setRGB(0,0,0);b=0;for(e=j.length;b<e;b++)c=j[b],f=c.color,c instanceof THREE.AmbientLight?(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b):c instanceof THREE.DirectionalLight?(Fa.r+=f.r,Fa.g+=f.g,Fa.b+=f.b):c instanceof THREE.PointLight&&(Ga.r+=f.r,Ga.g+=f.g,Ga.b+=f.b)}
+function t(b,e,c,f){var j,h,k,n,m=b.lights,b=0;for(j=m.length;b<j;b++)h=m[b],k=h.color,h instanceof THREE.DirectionalLight?(n=c.dot(h.position),n<=0||(n*=h.intensity,f.r+=k.r*n,f.g+=k.g*n,f.b+=k.b*n)):h instanceof THREE.PointLight&&(n=c.dot(na.sub(h.position,e).normalize()),n<=0||(n*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),n!=0&&(n*=h.intensity,f.r+=k.r*n,f.g+=k.g*n,f.b+=k.b*n)))}function y(b,j,k){c(k.opacity);e(k.blending);var n,m,p,o,fa,t;if(k instanceof THREE.ParticleBasicMaterial){if(k.map)o=
+k.map.image,fa=o.width>>1,t=o.height>>1,k=j.scale.x*u,p=j.scale.y*w,n=k*fa,m=p*t,ea.set(b.x-n,b.y-m,b.x+n,b.y+m),pa.instersects(ea)&&(v.save(),v.translate(b.x,b.y),v.rotate(-j.rotation),v.scale(k,-p),v.translate(-fa,-t),v.drawImage(o,0,0),v.restore())}else k instanceof THREE.ParticleCanvasMaterial&&(n=j.scale.x*u,m=j.scale.y*w,ea.set(b.x-n,b.y-m,b.x+n,b.y+m),pa.instersects(ea)&&(f(k.color.getContextStyle()),h(k.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-j.rotation),v.scale(n,
+m),k.program(v),v.restore()))}function B(b,j,h,k){c(k.opacity);e(k.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(j.positionScreen.x,j.positionScreen.y);v.closePath();if(k instanceof THREE.LineBasicMaterial){b=k.linewidth;if(E!=b)v.lineWidth=E=b;b=k.linecap;if(J!=b)v.lineCap=J=b;b=k.linejoin;if(O!=b)v.lineJoin=O=b;f(k.color.getContextStyle());v.stroke();ea.inflate(k.linewidth*2)}}function x(b,f,j,h,m,u,o,fa,v){k.data.vertices+=3;k.data.faces++;c(fa.opacity);e(fa.blending);
+L=b.positionScreen.x;P=b.positionScreen.y;n=f.positionScreen.x;X=f.positionScreen.y;la=j.positionScreen.x;R=j.positionScreen.y;D(L,P,n,X,la,R);if(fa instanceof THREE.MeshBasicMaterial)if(fa.map)fa.map.mapping instanceof THREE.UVMapping&&(aa=o.uvs[0],$a(L,P,n,X,la,R,aa[h].u,aa[h].v,aa[m].u,aa[m].v,aa[u].u,aa[u].v,fa.map));else if(fa.envMap){if(fa.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,na.copy(o.vertexNormalsWorld[0]),va=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*
+0.5+0.5,Ia=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(o.vertexNormalsWorld[1]),oa=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,wa=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,na.copy(o.vertexNormalsWorld[2]),Ka=(na.x*b.n11+na.y*b.n12+na.z*b.n13)*0.5+0.5,Ea=-(na.x*b.n21+na.y*b.n22+na.z*b.n23)*0.5+0.5,$a(L,P,n,X,la,R,va,Ia,oa,wa,Ka,Ea,fa.envMap)}else fa.wireframe?La(fa.color,fa.wireframeLinewidth,fa.wireframeLinecap,fa.wireframeLinejoin):Ma(fa.color);else if(fa instanceof THREE.MeshLambertMaterial)fa.map&&
+!fa.wireframe&&(fa.map.mapping instanceof THREE.UVMapping&&(aa=o.uvs[0],$a(L,P,n,X,la,R,aa[h].u,aa[h].v,aa[m].u,aa[m].v,aa[u].u,aa[u].v,fa.map)),e(THREE.SubtractiveBlending)),za?!fa.wireframe&&fa.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(U.r=W.r=ja.r=xa.r,U.g=W.g=ja.g=xa.g,U.b=W.b=ja.b=xa.b,t(v,o.v1.positionWorld,o.vertexNormalsWorld[0],U),t(v,o.v2.positionWorld,o.vertexNormalsWorld[1],W),t(v,o.v3.positionWorld,o.vertexNormalsWorld[2],ja),ia.r=(W.r+ja.r)*0.5,ia.g=(W.g+ja.g)*0.5,
+ia.b=(W.b+ja.b)*0.5,ra=Ya(U,W,ja,ia),Ua(L,P,n,X,la,R,0,0,1,0,0,1,ra)):(ya.r=xa.r,ya.g=xa.g,ya.b=xa.b,t(v,o.centroidWorld,o.normalWorld,ya),$.r=Math.max(0,Math.min(fa.color.r*ya.r,1)),$.g=Math.max(0,Math.min(fa.color.g*ya.g,1)),$.b=Math.max(0,Math.min(fa.color.b*ya.b,1)),fa.wireframe?La($,fa.wireframeLinewidth,fa.wireframeLinecap,fa.wireframeLinejoin):Ma($)):fa.wireframe?La(fa.color,fa.wireframeLinewidth,fa.wireframeLinecap,fa.wireframeLinejoin):Ma(fa.color);else if(fa instanceof THREE.MeshDepthMaterial)Y=
+p.near,N=p.far,U.r=U.g=U.b=1-Pa(b.positionScreen.z,Y,N),W.r=W.g=W.b=1-Pa(f.positionScreen.z,Y,N),ja.r=ja.g=ja.b=1-Pa(j.positionScreen.z,Y,N),ia.r=(W.r+ja.r)*0.5,ia.g=(W.g+ja.g)*0.5,ia.b=(W.b+ja.b)*0.5,ra=Ya(U,W,ja,ia),Ua(L,P,n,X,la,R,0,0,1,0,0,1,ra);else if(fa instanceof THREE.MeshNormalMaterial)$.r=Va(o.normalWorld.x),$.g=Va(o.normalWorld.y),$.b=Va(o.normalWorld.z),fa.wireframe?La($,fa.wireframeLinewidth,fa.wireframeLinecap,fa.wireframeLinejoin):Ma($)}function z(b,f,j,h,m,fa,u,o,v){k.data.vertices+=
+4;k.data.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)x(b,f,h,0,1,3,u,o,v),x(m,j,fa,1,2,3,u,o,v);else if(L=b.positionScreen.x,P=b.positionScreen.y,n=f.positionScreen.x,X=f.positionScreen.y,la=j.positionScreen.x,R=j.positionScreen.y,ga=h.positionScreen.x,Z=h.positionScreen.y,da=m.positionScreen.x,ca=m.positionScreen.y,ha=fa.positionScreen.x,ka=fa.positionScreen.y,o instanceof THREE.MeshBasicMaterial)C(L,P,n,X,la,R,ga,Z),o.wireframe?La(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):
+Ma(o.color);else if(o instanceof THREE.MeshLambertMaterial)za?!o.wireframe&&o.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4?(U.r=W.r=ja.r=ia.r=xa.r,U.g=W.g=ja.g=ia.g=xa.g,U.b=W.b=ja.b=ia.b=xa.b,t(v,u.v1.positionWorld,u.vertexNormalsWorld[0],U),t(v,u.v2.positionWorld,u.vertexNormalsWorld[1],W),t(v,u.v4.positionWorld,u.vertexNormalsWorld[3],ja),t(v,u.v3.positionWorld,u.vertexNormalsWorld[2],ia),ra=Ya(U,W,ja,ia),D(L,P,n,X,ga,Z),Ua(L,P,n,X,ga,Z,0,0,1,0,0,1,ra),D(da,ca,la,R,ha,ka),Ua(da,
+ca,la,R,ha,ka,1,0,1,1,0,1,ra)):(ya.r=xa.r,ya.g=xa.g,ya.b=xa.b,t(v,u.centroidWorld,u.normalWorld,ya),$.r=Math.max(0,Math.min(o.color.r*ya.r,1)),$.g=Math.max(0,Math.min(o.color.g*ya.g,1)),$.b=Math.max(0,Math.min(o.color.b*ya.b,1)),C(L,P,n,X,la,R,ga,Z),o.wireframe?La($,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Ma($)):(C(L,P,n,X,la,R,ga,Z),o.wireframe?La(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Ma(o.color));else if(o instanceof THREE.MeshNormalMaterial)$.r=
+Va(u.normalWorld.x),$.g=Va(u.normalWorld.y),$.b=Va(u.normalWorld.z),C(L,P,n,X,la,R,ga,Z),o.wireframe?La($,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Ma($);else if(o instanceof THREE.MeshDepthMaterial)Y=p.near,N=p.far,U.r=U.g=U.b=1-Pa(b.positionScreen.z,Y,N),W.r=W.g=W.b=1-Pa(f.positionScreen.z,Y,N),ja.r=ja.g=ja.b=1-Pa(h.positionScreen.z,Y,N),ia.r=ia.g=ia.b=1-Pa(j.positionScreen.z,Y,N),ra=Ya(U,W,ja,ia),D(L,P,n,X,ga,Z),Ua(L,P,n,X,ga,Z,0,0,1,0,0,1,ra),D(da,ca,la,R,ha,ka),Ua(da,ca,la,
+R,ha,ka,1,0,1,1,0,1,ra)}function D(b,e,c,f,j,h){v.beginPath();v.moveTo(b,e);v.lineTo(c,f);v.lineTo(j,h);v.lineTo(b,e);v.closePath()}function C(b,e,c,f,j,h,k,n){v.beginPath();v.moveTo(b,e);v.lineTo(c,f);v.lineTo(j,h);v.lineTo(k,n);v.lineTo(b,e);v.closePath()}function La(b,e,c,j){if(E!=e)v.lineWidth=E=e;if(J!=c)v.lineCap=J=c;if(O!=j)v.lineJoin=O=j;f(b.getContextStyle());v.stroke();ea.inflate(e*2)}function Ma(b){h(b.getContextStyle());v.fill()}function $a(b,e,c,f,j,k,n,m,o,u,p,fa,t){if(t.image.width!=
+0){if(t.needsUpdate==!0||ma[t.id]==void 0){var w=t.wrapS==THREE.RepeatWrapping,Ca=t.wrapT==THREE.RepeatWrapping;ma[t.id]=v.createPattern(t.image,w&&Ca?"repeat":w&&!Ca?"repeat-x":!w&&Ca?"repeat-y":"no-repeat");t.needsUpdate=!1}h(ma[t.id]);var w=t.offset.x/t.repeat.x,Ca=t.offset.y/t.repeat.y,y=(t.image.width-1)*t.repeat.x,t=(t.image.height-1)*t.repeat.y,n=(n+w)*y,m=(m+Ca)*t,o=(o+w)*y,u=(u+Ca)*t,p=(p+w)*y,fa=(fa+Ca)*t;c-=b;f-=e;j-=b;k-=e;o-=n;u-=m;p-=n;fa-=m;w=1/(o*fa-p*u);t=(fa*c-u*j)*w;u=(fa*f-u*k)*
+w;c=(o*j-p*c)*w;f=(o*k-p*f)*w;b=b-t*n-c*m;e=e-u*n-f*m;v.save();v.transform(t,u,c,f,b,e);v.fill();v.restore()}}function Ua(b,e,c,f,j,h,k,n,m,o,u,p,fa){var t,w;t=fa.width-1;w=fa.height-1;k*=t;n*=w;m*=t;o*=w;u*=t;p*=w;c-=b;f-=e;j-=b;h-=e;m-=k;o-=n;u-=k;p-=n;w=1/(m*p-u*o);t=(p*c-o*j)*w;o=(p*f-o*h)*w;c=(m*j-u*c)*w;f=(m*h-u*f)*w;b=b-t*k-c*n;e=e-o*k-f*n;v.save();v.transform(t,o,c,f,b,e);v.clip();v.drawImage(fa,0,0);v.restore()}function Ya(b,e,c,f){var j=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),k=~~(e.r*255),
+n=~~(e.g*255),e=~~(e.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),u=~~(f.r*255),p=~~(f.g*255),f=~~(f.b*255);Aa[0]=j<0?0:j>255?255:j;Aa[1]=h<0?0:h>255?255:h;Aa[2]=b<0?0:b>255?255:b;Aa[4]=k<0?0:k>255?255:k;Aa[5]=n<0?0:n>255?255:n;Aa[6]=e<0?0:e>255?255:e;Aa[8]=m<0?0:m>255?255:m;Aa[9]=o<0?0:o>255?255:o;Aa[10]=c<0?0:c>255?255:c;Aa[12]=u<0?0:u>255?255:u;Aa[13]=p<0?0:p>255?255:p;Aa[14]=f<0?0:f>255?255:f;Ba.putImageData(fa,0,0);Ca.drawImage(V,0,0);return Xa}function Pa(b,e,c){b=(b-e)/(c-e);return b*b*
+(3-2*b)}function Va(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Na(b,e){var c=e.x-b.x,f=e.y-b.y,j=c*c+f*f;j!=0&&(j=1/Math.sqrt(j),c*=j,f*=j,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Za,ab,qa,Da,Oa,Wa,I,A;this.autoClear?this.clear():v.setTransform(1,0,0,-1,u,w);k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,p,this.sortElements);(za=b.lights.length>0)&&o(b);Za=0;for(ab=j.length;Za<ab;Za++){qa=j[Za];ea.empty();if(qa instanceof THREE.RenderableParticle){K=qa;K.x*=u;K.y*=w;Da=0;for(Oa=qa.materials.length;Da<
+Oa;)A=qa.materials[Da++],A.opacity!=0&&y(K,qa,A,b)}else if(qa instanceof THREE.RenderableLine){if(K=qa.v1,H=qa.v2,K.positionScreen.x*=u,K.positionScreen.y*=w,H.positionScreen.x*=u,H.positionScreen.y*=w,ea.addPoint(K.positionScreen.x,K.positionScreen.y),ea.addPoint(H.positionScreen.x,H.positionScreen.y),pa.instersects(ea)){Da=0;for(Oa=qa.materials.length;Da<Oa;)A=qa.materials[Da++],A.opacity!=0&&B(K,H,qa,A,b)}}else if(qa instanceof THREE.RenderableFace3){if(K=qa.v1,H=qa.v2,F=qa.v3,K.positionScreen.x*=
+u,K.positionScreen.y*=w,H.positionScreen.x*=u,H.positionScreen.y*=w,F.positionScreen.x*=u,F.positionScreen.y*=w,qa.overdraw&&(Na(K.positionScreen,H.positionScreen),Na(H.positionScreen,F.positionScreen),Na(F.positionScreen,K.positionScreen)),ea.add3Points(K.positionScreen.x,K.positionScreen.y,H.positionScreen.x,H.positionScreen.y,F.positionScreen.x,F.positionScreen.y),pa.instersects(ea)){Da=0;for(Oa=qa.meshMaterials.length;Da<Oa;)if(A=qa.meshMaterials[Da++],A instanceof THREE.MeshFaceMaterial){Wa=
+0;for(I=qa.faceMaterials.length;Wa<I;)(A=qa.faceMaterials[Wa++])&&A.opacity!=0&&x(K,H,F,0,1,2,qa,A,b)}else A.opacity!=0&&x(K,H,F,0,1,2,qa,A,b)}}else if(qa instanceof THREE.RenderableFace4&&(K=qa.v1,H=qa.v2,F=qa.v3,T=qa.v4,K.positionScreen.x*=u,K.positionScreen.y*=w,H.positionScreen.x*=u,H.positionScreen.y*=w,F.positionScreen.x*=u,F.positionScreen.y*=w,T.positionScreen.x*=u,T.positionScreen.y*=w,G.positionScreen.copy(H.positionScreen),M.positionScreen.copy(T.positionScreen),qa.overdraw&&(Na(K.positionScreen,
+H.positionScreen),Na(H.positionScreen,T.positionScreen),Na(T.positionScreen,K.positionScreen),Na(F.positionScreen,G.positionScreen),Na(F.positionScreen,M.positionScreen)),ea.addPoint(K.positionScreen.x,K.positionScreen.y),ea.addPoint(H.positionScreen.x,H.positionScreen.y),ea.addPoint(F.positionScreen.x,F.positionScreen.y),ea.addPoint(T.positionScreen.x,T.positionScreen.y),pa.instersects(ea))){Da=0;for(Oa=qa.meshMaterials.length;Da<Oa;)if(A=qa.meshMaterials[Da++],A instanceof THREE.MeshFaceMaterial){Wa=
+0;for(I=qa.faceMaterials.length;Wa<I;)(A=qa.faceMaterials[Wa++])&&A.opacity!=0&&z(K,H,F,T,G,M,qa,A,b)}else A.opacity!=0&&z(K,H,F,T,G,M,qa,A,b)}sa.addRectangle(ea)}v.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function b(b,e,c){var f,j,h,k;f=0;for(j=b.lights.length;f<j;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(k=e.normalWorld.dot(h.position)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k)):h instanceof THREE.PointLight&&(T.sub(h.position,e.centroidWorld),T.normalize(),k=e.normalWorld.dot(T)*h.intensity,k>0&&(c.r+=h.color.r*k,c.g+=h.color.g*k,c.b+=h.color.b*k))}function c(e,c,j,n,m,o){k.data.vertices+=3;k.data.faces++;L=f(P++);L.setAttribute("d",
 "M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?E.copy(m.color):m instanceof THREE.MeshLambertMaterial?C?(J.r=O.r,J.g=O.g,J.b=O.b,b(o,n,J),E.r=Math.max(0,Math.min(m.color.r*J.r,1)),E.g=Math.max(0,Math.min(m.color.g*J.g,1)),E.b=Math.max(0,Math.min(m.color.b*J.b,1))):E.copy(m.color):m instanceof THREE.MeshDepthMaterial?(F=1-m.__2near/(m.__farPlusNear-n.z*m.__farMinusNear),
-E.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&E.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));m.wireframe?L.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):L.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+m.opacity);p.appendChild(L)}function e(e,c,j,n,m,o,v){k.data.vertices+=4;k.data.faces++;
-L=f(S++);L.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?E.copy(o.color):o instanceof THREE.MeshLambertMaterial?C?(J.r=O.r,J.g=O.g,J.b=O.b,b(v,m,J),E.r=Math.max(0,Math.min(o.color.r*J.r,1)),E.g=Math.max(0,Math.min(o.color.g*J.g,1)),E.b=Math.max(0,Math.min(o.color.b*J.b,1))):E.copy(o.color):o instanceof
+E.setRGB(F,F,F)):m instanceof THREE.MeshNormalMaterial&&E.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));m.wireframe?L.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):L.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+m.opacity);p.appendChild(L)}function e(e,c,j,n,m,o,u){k.data.vertices+=4;k.data.faces++;
+L=f(P++);L.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?E.copy(o.color):o instanceof THREE.MeshLambertMaterial?C?(J.r=O.r,J.g=O.g,J.b=O.b,b(u,m,J),E.r=Math.max(0,Math.min(o.color.r*J.r,1)),E.g=Math.max(0,Math.min(o.color.g*J.g,1)),E.b=Math.max(0,Math.min(o.color.b*J.b,1))):E.copy(o.color):o instanceof
 THREE.MeshDepthMaterial?(F=1-o.__2near/(o.__farPlusNear-m.z*o.__farMinusNear),E.setRGB(F,F,F)):o instanceof THREE.MeshNormalMaterial&&E.setRGB(h(m.normalWorld.x),h(m.normalWorld.y),h(m.normalWorld.z));o.wireframe?L.setAttribute("style","fill: none; stroke: "+E.getContextStyle()+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):L.setAttribute("style","fill: "+E.getContextStyle()+"; fill-opacity: "+
-o.opacity);p.appendChild(L)}function f(b){G[b]==null&&(G[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&G[b].setAttribute("shape-rendering","crispEdges"));return G[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,j=null,m=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,v,w,u,y,x,B,z=new THREE.Rectangle,D=new THREE.Rectangle,C=!1,E=new THREE.Color(16777215),J=new THREE.Color(16777215),O=new THREE.Color(0),K=new THREE.Color(0),
-I=new THREE.Color(0),F,Y=new THREE.Vector3,G=[],M=[],L,S,n,V=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":V=1;break;case "low":V=0}};this.setSize=function(b,e){o=b;t=e;v=o/2;w=t/2;p.setAttribute("viewBox",-v+" "+-w+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);z.set(-v,-w,v,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=
-function(b,f){var h,o,t,E,J,G,F,X;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,f,this.sortElements);n=S=0;if(C=b.lights.length>0){F=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(o=F.length;h<o;h++)t=F[h],E=t.color,t instanceof THREE.AmbientLight?(O.r+=E.r,O.g+=E.g,O.b+=E.b):t instanceof THREE.DirectionalLight?(K.r+=E.r,K.g+=E.g,K.b+=E.b):t instanceof THREE.PointLight&&(I.r+=E.r,I.g+=E.g,I.b+=E.b)}h=0;for(o=j.length;h<o;h++)if(F=j[h],D.empty(),
-F instanceof THREE.RenderableParticle){u=F;u.x*=v;u.y*=-w;t=0;for(E=F.materials.length;t<E;)t++}else if(F instanceof THREE.RenderableLine){if(u=F.v1,y=F.v2,u.positionScreen.x*=v,u.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,D.addPoint(u.positionScreen.x,u.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),z.instersects(D)){t=0;for(E=F.materials.length;t<E;)if((X=F.materials[t++])&&X.opacity!=0){J=u;G=y;var ca=n++;M[ca]==null&&(M[ca]=document.createElementNS("http://www.w3.org/2000/svg",
-"line"),V==0&&M[ca].setAttribute("shape-rendering","crispEdges"));L=M[ca];L.setAttribute("x1",J.positionScreen.x);L.setAttribute("y1",J.positionScreen.y);L.setAttribute("x2",G.positionScreen.x);L.setAttribute("y2",G.positionScreen.y);X instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+X.color.getContextStyle()+"; stroke-width: "+X.linewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.linecap+"; stroke-linejoin: "+X.linejoin),p.appendChild(L))}}}else if(F instanceof
-THREE.RenderableFace3){if(u=F.v1,y=F.v2,x=F.v3,u.positionScreen.x*=v,u.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,x.positionScreen.x*=v,x.positionScreen.y*=-w,D.addPoint(u.positionScreen.x,u.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(x.positionScreen.x,x.positionScreen.y),z.instersects(D)){t=0;for(E=F.meshMaterials.length;t<E;)if(X=F.meshMaterials[t++],X instanceof THREE.MeshFaceMaterial){J=0;for(G=F.faceMaterials.length;J<G;)(X=F.faceMaterials[J++])&&
-X.opacity!=0&&c(u,y,x,F,X,b)}else X&&X.opacity!=0&&c(u,y,x,F,X,b)}}else if(F instanceof THREE.RenderableFace4&&(u=F.v1,y=F.v2,x=F.v3,B=F.v4,u.positionScreen.x*=v,u.positionScreen.y*=-w,y.positionScreen.x*=v,y.positionScreen.y*=-w,x.positionScreen.x*=v,x.positionScreen.y*=-w,B.positionScreen.x*=v,B.positionScreen.y*=-w,D.addPoint(u.positionScreen.x,u.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(x.positionScreen.x,x.positionScreen.y),D.addPoint(B.positionScreen.x,B.positionScreen.y),
-z.instersects(D))){t=0;for(E=F.meshMaterials.length;t<E;)if(X=F.meshMaterials[t++],X instanceof THREE.MeshFaceMaterial){J=0;for(G=F.faceMaterials.length;J<G;)(X=F.faceMaterials[J++])&&X.opacity!=0&&e(u,y,x,B,F,X,b)}else X&&X.opacity!=0&&e(u,y,x,B,F,X,b)}}};
+o.opacity);p.appendChild(L)}function f(b){G[b]==null&&(G[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),X==0&&G[b].setAttribute("shape-rendering","crispEdges"));return G[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,j=null,m=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,t,u,w,v,y,x,B,z=new THREE.Rectangle,D=new THREE.Rectangle,C=!1,E=new THREE.Color(16777215),J=new THREE.Color(16777215),O=new THREE.Color(0),K=new THREE.Color(0),
+H=new THREE.Color(0),F,T=new THREE.Vector3,G=[],M=[],L,P,n,X=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":X=1;break;case "low":X=0}};this.setSize=function(b,e){o=b;t=e;u=o/2;w=t/2;p.setAttribute("viewBox",-u+" "+-w+" "+o+" "+t);p.setAttribute("width",o);p.setAttribute("height",t);z.set(-u,-w,u,w)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=
+function(b,f){var h,o,t,E,J,G,F,U;this.autoClear&&this.clear();k.data.vertices=0;k.data.faces=0;j=m.projectScene(b,f,this.sortElements);n=P=0;if(C=b.lights.length>0){F=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);H.setRGB(0,0,0);h=0;for(o=F.length;h<o;h++)t=F[h],E=t.color,t instanceof THREE.AmbientLight?(O.r+=E.r,O.g+=E.g,O.b+=E.b):t instanceof THREE.DirectionalLight?(K.r+=E.r,K.g+=E.g,K.b+=E.b):t instanceof THREE.PointLight&&(H.r+=E.r,H.g+=E.g,H.b+=E.b)}h=0;for(o=j.length;h<o;h++)if(F=j[h],D.empty(),
+F instanceof THREE.RenderableParticle){v=F;v.x*=u;v.y*=-w;t=0;for(E=F.materials.length;t<E;)t++}else if(F instanceof THREE.RenderableLine){if(v=F.v1,y=F.v2,v.positionScreen.x*=u,v.positionScreen.y*=-w,y.positionScreen.x*=u,y.positionScreen.y*=-w,D.addPoint(v.positionScreen.x,v.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),z.instersects(D)){t=0;for(E=F.materials.length;t<E;)if((U=F.materials[t++])&&U.opacity!=0){J=v;G=y;var W=n++;M[W]==null&&(M[W]=document.createElementNS("http://www.w3.org/2000/svg",
+"line"),X==0&&M[W].setAttribute("shape-rendering","crispEdges"));L=M[W];L.setAttribute("x1",J.positionScreen.x);L.setAttribute("y1",J.positionScreen.y);L.setAttribute("x2",G.positionScreen.x);L.setAttribute("y2",G.positionScreen.y);U instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+U.color.getContextStyle()+"; stroke-width: "+U.linewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.linecap+"; stroke-linejoin: "+U.linejoin),p.appendChild(L))}}}else if(F instanceof
+THREE.RenderableFace3){if(v=F.v1,y=F.v2,x=F.v3,v.positionScreen.x*=u,v.positionScreen.y*=-w,y.positionScreen.x*=u,y.positionScreen.y*=-w,x.positionScreen.x*=u,x.positionScreen.y*=-w,D.addPoint(v.positionScreen.x,v.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(x.positionScreen.x,x.positionScreen.y),z.instersects(D)){t=0;for(E=F.meshMaterials.length;t<E;)if(U=F.meshMaterials[t++],U instanceof THREE.MeshFaceMaterial){J=0;for(G=F.faceMaterials.length;J<G;)(U=F.faceMaterials[J++])&&
+U.opacity!=0&&c(v,y,x,F,U,b)}else U&&U.opacity!=0&&c(v,y,x,F,U,b)}}else if(F instanceof THREE.RenderableFace4&&(v=F.v1,y=F.v2,x=F.v3,B=F.v4,v.positionScreen.x*=u,v.positionScreen.y*=-w,y.positionScreen.x*=u,y.positionScreen.y*=-w,x.positionScreen.x*=u,x.positionScreen.y*=-w,B.positionScreen.x*=u,B.positionScreen.y*=-w,D.addPoint(v.positionScreen.x,v.positionScreen.y),D.addPoint(y.positionScreen.x,y.positionScreen.y),D.addPoint(x.positionScreen.x,x.positionScreen.y),D.addPoint(B.positionScreen.x,B.positionScreen.y),
+z.instersects(D))){t=0;for(E=F.meshMaterials.length;t<E;)if(U=F.meshMaterials[t++],U instanceof THREE.MeshFaceMaterial){J=0;for(G=F.faceMaterials.length;J<G;)(U=F.faceMaterials[J++])&&U.opacity!=0&&e(v,y,x,B,F,U,b)}else U&&U.opacity!=0&&e(v,y,x,B,F,U,b)}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -218,119 +218,119 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "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"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},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}",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")}};
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,j,h,k=b.vertices,m=k.length,o=b.colors,p=o.length,v=b.__vertexArray,t=b.__colorArray,u=b.__sortArray,w=b.__dirtyVertices,y=b.__dirtyColors,x=b.__webglCustomAttributes,B,z;if(x)for(B in x)x[B].offset=0;if(c.sortParticles){N.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)j=k[f].position,sa.copy(j),N.multiplyVector3(sa),u[f]=[sa.z,f];u.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)j=k[u[f][1]].position,h=f*3,v[h]=j.x,v[h+1]=j.y,v[h+2]=j.z;
-for(f=0;f<p;f++)h=f*3,color=o[u[f][1]],t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(x)for(B in x){f=x[B];o=f.value.length;for(h=0;h<o;h++){index=u[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[index];f.size===2?(f.array[p]=z.x,f.array[p+1]=z.y):f.size===3?f.type==="c"?(f.array[p]=z.r,f.array[p+1]=z.g,f.array[p+2]=z.b):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z):(f.array[p]=
-z.x,f.array[p+1]=z.y,f.array[p+2]=z.z,f.array[p+3]=z.w)}f.offset+=f.size}}}else{if(w)for(f=0;f<m;f++)j=k[f].position,h=f*3,v[h]=j.x,v[h+1]=j.y,v[h+2]=j.z;if(y)for(f=0;f<p;f++)color=o[f],h=f*3,t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(x)for(B in x)if(f=x[B],f.__original.needsUpdate){o=f.value.length;for(h=0;h<o;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[h];f.size===2?(f.array[p]=
-z.x,f.array[p+1]=z.y):f.size===3?f.type==="c"?(f.array[p]=z.r,f.array[p+1]=z.g,f.array[p+2]=z.b):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z,f.array[p+3]=z.w)}f.offset+=f.size}}}if(w||c.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,v,e);if(y||c.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,t,e);if(x)for(B in x)if(f=x[B],f.__original.needsUpdate||c.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,
-f.buffer),n.bufferData(n.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,h){f.program||S.initMaterial(f,e,c,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);for(var j=0,k=S.maxMorphTargets;j<k;j++)h.__webglMorphTargetInfluences[j]=0}var j=f.program,k=j.uniforms,m=f.uniforms;j!=fa&&(n.useProgram(j),fa=j);n.uniformMatrix4fv(k.projectionMatrix,!1,ra);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
-f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var o,p,v,t=0,u=0,w=0,y,z,x,B=Ha,D=B.directional.colors,C=B.directional.positions,E=B.point.colors,Z=B.point.positions,F=B.point.distances,
-J=0,N=0,c=p=x=0;for(o=e.length;c<o;c++)if(p=e[c],v=p.color,y=p.position,z=p.intensity,x=p.distance,p instanceof THREE.AmbientLight)t+=v.r,u+=v.g,w+=v.b;else if(p instanceof THREE.DirectionalLight)x=J*3,D[x]=v.r*z,D[x+1]=v.g*z,D[x+2]=v.b*z,C[x]=y.x,C[x+1]=y.y,C[x+2]=y.z,J+=1;else if(p instanceof THREE.SpotLight)x=J*3,D[x]=v.r*z,D[x+1]=v.g*z,D[x+2]=v.b*z,v=1/y.length(),C[x]=y.x*v,C[x+1]=y.y*v,C[x+2]=y.z*v,J+=1;else if(p instanceof THREE.PointLight)p=N*3,E[p]=v.r*z,E[p+1]=v.g*z,E[p+2]=v.b*z,Z[p]=y.x,
-Z[p+1]=y.y,Z[p+2]=y.z,F[N]=x,N+=1;for(c=J*3;c<D.length;c++)D[c]=0;for(c=N*3;c<E.length;c++)E[c]=0;B.point.length=N;B.directional.length=J;B.ambient[0]=t;B.ambient[1]=u;B.ambient[2]=w;e=Ha;m.enableLighting.value=e.directional.length+e.point.length;m.ambientLightColor.value=e.ambient;m.directionalLightColor.value=e.directional.colors;m.directionalLightDirection.value=e.directional.positions;m.pointLightColor.value=e.point.colors;m.pointLightPosition.value=e.point.positions;m.pointLightDistance.value=
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,j,h,k=b.vertices,m=k.length,o=b.colors,u=o.length,p=b.__vertexArray,t=b.__colorArray,v=b.__sortArray,w=b.__dirtyVertices,y=b.__dirtyColors,x=b.__webglCustomAttributes,B,z;if(x)for(B in x)x[B].offset=0;if(c.sortParticles){N.multiplySelf(c.matrixWorld);for(f=0;f<m;f++)j=k[f].position,va.copy(j),N.multiplyVector3(va),v[f]=[va.z,f];v.sort(function(b,e){return e[0]-b[0]});for(f=0;f<m;f++)j=k[v[f][1]].position,h=f*3,p[h]=j.x,p[h+1]=j.y,p[h+2]=j.z;
+for(f=0;f<u;f++)h=f*3,color=o[v[f][1]],t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(x)for(B in x){f=x[B];o=f.value.length;for(h=0;h<o;h++){index=v[h][1];u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[index];f.size===2?(f.array[u]=z.x,f.array[u+1]=z.y):f.size===3?f.type==="c"?(f.array[u]=z.r,f.array[u+1]=z.g,f.array[u+2]=z.b):(f.array[u]=z.x,f.array[u+1]=z.y,f.array[u+2]=z.z):(f.array[u]=
+z.x,f.array[u+1]=z.y,f.array[u+2]=z.z,f.array[u+3]=z.w)}f.offset+=f.size}}}else{if(w)for(f=0;f<m;f++)j=k[f].position,h=f*3,p[h]=j.x,p[h+1]=j.y,p[h+2]=j.z;if(y)for(f=0;f<u;f++)color=o[f],h=f*3,t[h]=color.r,t[h+1]=color.g,t[h+2]=color.b;if(x)for(B in x)if(f=x[B],f.__original.needsUpdate){o=f.value.length;for(h=0;h<o;h++){u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[h];f.size===2?(f.array[u]=
+z.x,f.array[u+1]=z.y):f.size===3?f.type==="c"?(f.array[u]=z.r,f.array[u+1]=z.g,f.array[u+2]=z.b):(f.array[u]=z.x,f.array[u+1]=z.y,f.array[u+2]=z.z):(f.array[u]=z.x,f.array[u+1]=z.y,f.array[u+2]=z.z,f.array[u+3]=z.w)}f.offset+=f.size}}}if(w||c.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,p,e);if(y||c.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,t,e);if(x)for(B in x)if(f=x[B],f.__original.needsUpdate||c.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,
+f.buffer),n.bufferData(n.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,h){f.program||P.initMaterial(f,e,c,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(P.maxMorphTargets);for(var j=0,k=P.maxMorphTargets;j<k;j++)h.__webglMorphTargetInfluences[j]=0}var j=f.program,k=j.uniforms,m=f.uniforms;j!=la&&(n.useProgram(j),la=j);n.uniformMatrix4fv(k.projectionMatrix,!1,ra);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
+f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(m.fogColor.value=c.color,c instanceof THREE.Fog)m.fogNear.value=c.near,m.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)m.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var o,u,p,t=0,v=0,w=0,y,z,x,B=Ia,D=B.directional.colors,C=B.directional.positions,E=B.point.colors,Y=B.point.positions,F=B.point.distances,
+J=0,N=0,c=u=x=0;for(o=e.length;c<o;c++)if(u=e[c],p=u.color,y=u.position,z=u.intensity,x=u.distance,u instanceof THREE.AmbientLight)t+=p.r,v+=p.g,w+=p.b;else if(u instanceof THREE.DirectionalLight)x=J*3,D[x]=p.r*z,D[x+1]=p.g*z,D[x+2]=p.b*z,C[x]=y.x,C[x+1]=y.y,C[x+2]=y.z,J+=1;else if(u instanceof THREE.SpotLight)x=J*3,D[x]=p.r*z,D[x+1]=p.g*z,D[x+2]=p.b*z,p=1/y.length(),C[x]=y.x*p,C[x+1]=y.y*p,C[x+2]=y.z*p,J+=1;else if(u instanceof THREE.PointLight)u=N*3,E[u]=p.r*z,E[u+1]=p.g*z,E[u+2]=p.b*z,Y[u]=y.x,
+Y[u+1]=y.y,Y[u+2]=y.z,F[N]=x,N+=1;for(c=J*3;c<D.length;c++)D[c]=0;for(c=N*3;c<E.length;c++)E[c]=0;B.point.length=N;B.directional.length=J;B.ambient[0]=t;B.ambient[1]=v;B.ambient[2]=w;e=Ia;m.enableLighting.value=e.directional.length+e.point.length;m.ambientLightColor.value=e.ambient;m.directionalLightColor.value=e.directional.colors;m.directionalLightDirection.value=e.directional.positions;m.pointLightColor.value=e.point.colors;m.pointLightPosition.value=e.point.positions;m.pointLightDistance.value=
 e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity,(m.map.texture=f.map)&&m.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),m.lightMap.texture=f.lightMap,m.envMap.texture=f.envMap,m.reflectivity.value=f.reflectivity,m.refractionRatio.value=f.refractionRatio,m.combine.value=f.combine,m.useRefract.value=f.envMap&&f.envMap.mapping instanceof
 THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)m.diffuse.value=f.color,m.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)m.psColor.value=f.color,m.opacity.value=f.opacity,m.size.value=f.size,m.scale.value=oa.height/2,m.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)m.ambient.value=f.ambient,m.specular.value=f.specular,m.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(e=0;e<ya.length;e++)m.shadowMatrix.value[e]=ya[e],m.shadowMap.texture[e]=S.shadowMap[e];m.shadowDarkness.value=S.shadowMapDarkness;m.shadowBias.value=S.shadowMapBias}for(var G in m)if(o=j.uniforms[G])if(c=m[G],t=c.type,e=c.value,t=="i")n.uniform1i(o,e);else if(t=="f")n.uniform1f(o,e);else if(t=="v2")n.uniform2f(o,e.x,e.y);else if(t=="v3")n.uniform3f(o,e.x,e.y,e.z);
-else if(t=="v4")n.uniform4f(o,e.x,e.y,e.z,e.w);else if(t=="c")n.uniform3f(o,e.r,e.g,e.b);else if(t=="fv1")n.uniform1fv(o,e);else if(t=="fv")n.uniform3fv(o,e);else if(t=="v3v"){if(!c._array)c._array=new Float32Array(3*e.length);t=0;for(u=e.length;t<u;t++)w=t*3,c._array[w]=e[t].x,c._array[w+1]=e[t].y,c._array[w+2]=e[t].z;n.uniform3fv(o,c._array)}else if(t=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);n.uniformMatrix4fv(o,!1,c._array)}else if(t=="m4v"){if(!c._array)c._array=
-new Float32Array(16*e.length);t=0;for(u=e.length;t<u;t++)e[t].flattenToArrayOffset(c._array,t*16);n.uniformMatrix4fv(o,!1,c._array)}else if(t=="t"){if(n.uniform1i(o,e),o=c.texture)if(o.image instanceof Array&&o.image.length==6){if(c=o,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=n.createTexture();n.activeTexture(n.TEXTURE0+e);n.bindTexture(n.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,
-n.RGBA,n.RGBA,n.UNSIGNED_BYTE,c.image[e]);K(n.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else o instanceof THREE.WebGLRenderTargetCube?(c=o,n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_CUBE_MAP,c.__webglTexture)):I(o,e)}else if(t=="tv"){if(!c._array){c._array=[];t=0;for(u=c.texture.length;t<u;t++)c._array[t]=e+t}n.uniform1iv(o,c._array);t=0;for(u=c.texture.length;t<u;t++)(o=c.texture[t])&&
-I(o,c._array[t])}n.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray);k.normalMatrix&&n.uniformMatrix3fv(k.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&n.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&k.objectMatrix!==null&&n.uniformMatrix4fv(k.objectMatrix,!1,h._objectMatrixArray);
-(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&n.uniformMatrix4fv(k.viewMatrix,!1,la);f.skinning&&(n.uniformMatrix4fv(k.cameraInverseMatrix,!1,la),n.uniformMatrix4fv(k.boneGlobalMatrices,!1,h.boneMatrices));return j}function f(b,c,f,h,j,k){if(h.opacity!=0){var m,b=e(b,c,f,h,k).attributes;if(!h.morphTargets&&b.position>=0)n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer),n.vertexAttribPointer(b.position,
-3,n.FLOAT,!1,0,0);else if(k.morphTargetBase){c=h.program.attributes;k.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[k.morphTargetBase]),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,p=k.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<o.length;)n.bindBuffer(n.ARRAY_BUFFER,
-j.__webglMorphTargetsBuffers[o[f]]),n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=p[o[f]],f++;else{var o=[],v=-1,t=0,p=k.morphTargetInfluences,u,w=p.length,f=0;for(k.morphTargetBase!==-1&&(o[k.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(u=0;u<w;u++)!o[u]&&p[u]>v&&(t=u,v=p[t]);n.bindBuffer(n.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[t]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=v;o[t]=1;v=
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)m.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&m.shadowMatrix){for(e=0;e<za.length;e++)m.shadowMatrix.value[e]=za[e],m.shadowMap.texture[e]=P.shadowMap[e];m.shadowDarkness.value=P.shadowMapDarkness;m.shadowBias.value=P.shadowMapBias}for(var G in m)if(o=j.uniforms[G])if(c=m[G],t=c.type,e=c.value,t=="i")n.uniform1i(o,e);else if(t=="f")n.uniform1f(o,e);else if(t=="v2")n.uniform2f(o,e.x,e.y);else if(t=="v3")n.uniform3f(o,e.x,e.y,e.z);
+else if(t=="v4")n.uniform4f(o,e.x,e.y,e.z,e.w);else if(t=="c")n.uniform3f(o,e.r,e.g,e.b);else if(t=="fv1")n.uniform1fv(o,e);else if(t=="fv")n.uniform3fv(o,e);else if(t=="v3v"){if(!c._array)c._array=new Float32Array(3*e.length);t=0;for(v=e.length;t<v;t++)w=t*3,c._array[w]=e[t].x,c._array[w+1]=e[t].y,c._array[w+2]=e[t].z;n.uniform3fv(o,c._array)}else if(t=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);n.uniformMatrix4fv(o,!1,c._array)}else if(t=="m4v"){if(!c._array)c._array=
+new Float32Array(16*e.length);t=0;for(v=e.length;t<v;t++)e[t].flattenToArrayOffset(c._array,t*16);n.uniformMatrix4fv(o,!1,c._array)}else if(t=="t"){if(n.uniform1i(o,e),o=c.texture)if(o.image instanceof Array&&o.image.length==6){if(c=o,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=n.createTexture();n.activeTexture(n.TEXTURE0+e);n.bindTexture(n.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,
+n.RGBA,n.RGBA,n.UNSIGNED_BYTE,c.image[e]);K(n.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else o instanceof THREE.WebGLRenderTargetCube?(c=o,n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_CUBE_MAP,c.__webglTexture)):H(o,e)}else if(t=="tv"){if(!c._array){c._array=[];t=0;for(v=c.texture.length;t<v;t++)c._array[t]=e+t}n.uniform1iv(o,c._array);t=0;for(v=c.texture.length;t<v;t++)(o=c.texture[t])&&
+H(o,c._array[t])}n.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray);k.normalMatrix&&n.uniformMatrix3fv(k.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&k.cameraPosition!==null&&n.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&k.objectMatrix!==null&&n.uniformMatrix4fv(k.objectMatrix,!1,h._objectMatrixArray);
+(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&k.viewMatrix!==null&&n.uniformMatrix4fv(k.viewMatrix,!1,aa);f.skinning&&(n.uniformMatrix4fv(k.cameraInverseMatrix,!1,aa),n.uniformMatrix4fv(k.boneGlobalMatrices,!1,h.boneMatrices));return j}function f(b,c,f,h,j,k){if(h.opacity!=0){var m,b=e(b,c,f,h,k).attributes;if(!h.morphTargets&&b.position>=0)n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer),n.vertexAttribPointer(b.position,
+3,n.FLOAT,!1,0,0);else if(k.morphTargetBase){c=h.program.attributes;k.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[k.morphTargetBase]),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var f=0,o=k.morphTargetForcedOrder,u=k.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<o.length;)n.bindBuffer(n.ARRAY_BUFFER,
+j.__webglMorphTargetsBuffers[o[f]]),n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[f]=u[o[f]],f++;else{var o=[],p=-1,t=0,u=k.morphTargetInfluences,v,w=u.length,f=0;for(k.morphTargetBase!==-1&&(o[k.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(v=0;v<w;v++)!o[v]&&u[v]>p&&(t=v,p=u[t]);n.bindBuffer(n.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[t]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[f]=p;o[t]=1;p=
 -1;f++}}h.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(h.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(j.__webglCustomAttributes)for(m in j.__webglCustomAttributes)b[m]>=0&&(c=j.__webglCustomAttributes[m],n.bindBuffer(n.ARRAY_BUFFER,c.buffer),n.vertexAttribPointer(b[m],c.size,n.FLOAT,!1,0,0));b.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglColorBuffer),n.vertexAttribPointer(b.color,3,n.FLOAT,!1,0,0));b.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglNormalBuffer),
 n.vertexAttribPointer(b.normal,3,n.FLOAT,!1,0,0));b.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglTangentBuffer),n.vertexAttribPointer(b.tangent,4,n.FLOAT,!1,0,0));b.uv>=0&&(j.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,j.__webglUVBuffer),n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv)):n.disableVertexAttribArray(b.uv));b.uv2>=0&&(j.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,j.__webglUV2Buffer),n.vertexAttribPointer(b.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv2)):
 n.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,j.__webglSkinVertexABuffer),n.vertexAttribPointer(b.skinVertexA,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,j.__webglSkinVertexBBuffer),n.vertexAttribPointer(b.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,j.__webglSkinIndicesBuffer),n.vertexAttribPointer(b.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,j.__webglSkinWeightsBuffer),
-n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));k instanceof THREE.Mesh?(h.wireframe?(n.lineWidth(h.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,j.__webglLineBuffer),n.drawElements(n.LINES,j.__webglLineCount,n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),n.drawElements(n.TRIANGLES,j.__webglFaceCount,n.UNSIGNED_SHORT,0)),S.data.vertices+=j.__webglFaceCount,S.data.faces+=j.__webglFaceCount/3,S.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?
-n.LINE_STRIP:n.LINES,n.lineWidth(h.linewidth),n.drawArrays(k,0,j.__webglLineCount),S.data.drawCalls++):k instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,j.__webglParticleCount),S.data.drawCalls++):k instanceof THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,j.__webglVertexCount),S.data.drawCalls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),
-n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(e.attributes.position),n.vertexAttribPointer(e.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,j,h,k,m,o,p,v,t,u,w=b.count*3;for(u=0;u<w;u+=9)c=b.normalArray,f=c[u],j=c[u+1],h=c[u+2],k=c[u+3],o=c[u+4],v=c[u+5],m=c[u+6],p=c[u+7],t=c[u+8],f=(f+k+m)/3,j=(j+o+p)/3,h=(h+v+t)/3,c[u]=f,c[u+1]=j,c[u+2]=h,c[u+3]=f,c[u+4]=j,c[u+5]=h,c[u+
-6]=f,c[u+7]=j,c[u+8]=h}n.bufferData(n.ARRAY_BUFFER,b.normalArray,n.DYNAMIC_DRAW);n.enableVertexAttribArray(e.attributes.normal);n.vertexAttribPointer(e.attributes.normal,3,n.FLOAT,!1,0,0)}n.drawArrays(n.TRIANGLES,0,b.count);b.count=0}function k(b){if($!=b.doubleSided)b.doubleSided?n.disable(n.CULL_FACE):n.enable(n.CULL_FACE),$=b.doubleSided;if(ka!=b.flipSided)b.flipSided?n.frontFace(n.CW):n.frontFace(n.CCW),ka=b.flipSided}function j(b){aa!=b&&(b?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),aa=b)}
-function m(b,e,c){ja!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_OFFSET_FILL),ja=b);if(b&&(ha!=e||X!=c))n.polygonOffset(e,c),ha=e,X=c}function p(b){Z[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Z[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);Z[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Z[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Z[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);Z[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+
-b.n34);for(var e,b=0;b<6;b++)e=Z[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function o(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=Z[f].x*e.n14+Z[f].y*e.n24+Z[f].z*e.n34+Z[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function v(b){var e,c,f=b.object,j=b.opaque,h=b.transparent;h.count=0;b=j.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?t(h,c):t(j,c)}
-function w(b){var e,c,f,j,h=b.object,k=b.buffer,m=b.opaque,n=b.transparent;n.count=0;b=m.count=0;for(f=h.materials.length;b<f;b++)if(e=h.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=k.materials.length;e<c;e++)(j=k.materials[e])&&(j.transparent?t(n,j):t(m,j))}else(j=e)&&(j.transparent?t(n,j):t(m,j))}function u(b,e){return e.z-b.z}function y(b,c){var m,v,t,u=0,w,y,z,x,D=b.lights;ea||(ea=new THREE.Camera(S.shadowCameraFov,c.aspect,S.shadowCameraNear,S.shadowCameraFar));m=0;for(v=D.length;m<
-v;m++)if(t=D[m],t instanceof THREE.SpotLight&&t.castShadow){S.shadowMap[u]||(S.shadowMap[u]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ya[u]||(ya[u]=new THREE.Matrix4);w=S.shadowMap[u];y=ya[u];ea.position.copy(t.position);ea.target.position.copy(t.target.position);ea.update(void 0,!0);b.update(void 0,!1,ea);y.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(ea.projectionMatrix);
-y.multiplySelf(ea.matrixWorldInverse);ea.matrixWorldInverse.flattenToArray(la);ea.projectionMatrix.flattenToArray(ra);N.multiply(ea.projectionMatrix,ea.matrixWorldInverse);p(N);S.initWebGLObjects(b);F(w);n.clearColor(1,1,1,1);S.clear();n.clearColor(pa.r,pa.g,pa.b,ta);y=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(w=0;w<y;w++)z=b.__webglObjects[w],x=z.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||!x.frustumCulled||o(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),
-B(x,ea,!1),z.render=!0):z.render=!1:z.render=!1;j(!0);O(THREE.NormalBlending);for(w=0;w<y;w++)if(z=b.__webglObjects[w],z.render)x=z.object,buffer=z.buffer,k(x),z=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?Ea:wa,f(ea,D,null,z,buffer,x);for(w=0;w<t;w++)z=b.__webglObjectsImmediate[w],x=z.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),B(x,ea,!1),k(x),program=e(ea,D,null,wa,x),x.render(function(b){h(b,program,wa.shading)}));
-u++}}function x(b,e){var c,f,j;c=T.attributes;var h=T.uniforms,k=ma/ia,m,o=[],p=ia*0.5,v=ma*0.5,t=!0;n.useProgram(T.program);fa=T.program;aa=U=-1;Aa||(n.enableVertexAttribArray(T.attributes.position),n.enableVertexAttribArray(T.attributes.uv),Aa=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,T.vertexBuffer);n.vertexAttribPointer(c.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(c.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,T.elementBuffer);
-n.uniformMatrix4fv(h.projectionMatrix,!1,ra);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.useScreenCoordinates?j.z=-j.position.z:(j._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray),j.z=-j._modelViewMatrix.n34);b.__webglSprites.sort(u);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.material===void 0&&j.map&&j.map.image&&j.map.image.width&&(j.useScreenCoordinates?(n.uniform1i(h.useScreenCoordinates,
-1),n.uniform3f(h.screenPosition,(j.position.x-p)/p,(v-j.position.y)/v,Math.max(0,Math.min(1,j.position.z)))):(n.uniform1i(h.useScreenCoordinates,0),n.uniform1i(h.affectedByDistance,j.affectedByDistance?1:0),n.uniformMatrix4fv(h.modelViewMatrix,!1,j._modelViewMatrixArray)),m=j.map.image.width/(j.scaleByViewport?ma:1),o[0]=m*k*j.scale.x,o[1]=m*j.scale.y,n.uniform2f(h.uvScale,j.uvScale.x,j.uvScale.y),n.uniform2f(h.uvOffset,j.uvOffset.x,j.uvOffset.y),n.uniform2f(h.alignment,j.alignment.x,j.alignment.y),
-n.uniform1f(h.opacity,j.opacity),n.uniform1f(h.rotation,j.rotation),n.uniform2fv(h.scale,o),j.mergeWith3D&&!t?(n.enable(n.DEPTH_TEST),t=!0):!j.mergeWith3D&&t&&(n.disable(n.DEPTH_TEST),t=!1),O(j.blending),I(j.map,0),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(da)}function B(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
+n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));k instanceof THREE.Mesh?(h.wireframe?(n.lineWidth(h.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,j.__webglLineBuffer),n.drawElements(n.LINES,j.__webglLineCount,n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,j.__webglFaceBuffer),n.drawElements(n.TRIANGLES,j.__webglFaceCount,n.UNSIGNED_SHORT,0)),P.data.vertices+=j.__webglFaceCount,P.data.faces+=j.__webglFaceCount/3,P.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?
+n.LINE_STRIP:n.LINES,n.lineWidth(h.linewidth),n.drawArrays(k,0,j.__webglLineCount),P.data.drawCalls++):k instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,j.__webglParticleCount),P.data.drawCalls++):k instanceof THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,j.__webglVertexCount),P.data.drawCalls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),
+n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(e.attributes.position),n.vertexAttribPointer(e.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,j,h,k,m,o,u,p,t,v,w=b.count*3;for(v=0;v<w;v+=9)c=b.normalArray,f=c[v],j=c[v+1],h=c[v+2],k=c[v+3],o=c[v+4],p=c[v+5],m=c[v+6],u=c[v+7],t=c[v+8],f=(f+k+m)/3,j=(j+o+u)/3,h=(h+p+t)/3,c[v]=f,c[v+1]=j,c[v+2]=h,c[v+3]=f,c[v+4]=j,c[v+5]=h,c[v+
+6]=f,c[v+7]=j,c[v+8]=h}n.bufferData(n.ARRAY_BUFFER,b.normalArray,n.DYNAMIC_DRAW);n.enableVertexAttribArray(e.attributes.normal);n.vertexAttribPointer(e.attributes.normal,3,n.FLOAT,!1,0,0)}n.drawArrays(n.TRIANGLES,0,b.count);b.count=0}function k(b){if(Z!=b.doubleSided)b.doubleSided?n.disable(n.CULL_FACE):n.enable(n.CULL_FACE),Z=b.doubleSided;if(da!=b.flipSided)b.flipSided?n.frontFace(n.CW):n.frontFace(n.CCW),da=b.flipSided}function j(b){ha!=b&&(b?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),ha=b)}
+function m(b,e,c){ka!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_OFFSET_FILL),ka=b);if(b&&($!=e||U!=c))n.polygonOffset(e,c),$=e,U=c}function p(b){Y[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);Y[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);Y[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);Y[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);Y[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);Y[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+
+b.n34);for(var e,b=0;b<6;b++)e=Y[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function o(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=Y[f].x*e.n14+Y[f].y*e.n24+Y[f].z*e.n34+Y[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function u(b){var e,c,f=b.object,j=b.opaque,h=b.transparent;h.count=0;b=j.count=0;for(e=f.materials.length;b<e;b++)c=f.materials[b],c.transparent?t(h,c):t(j,c)}
+function w(b){var e,c,f,j,h=b.object,k=b.buffer,m=b.opaque,n=b.transparent;n.count=0;b=m.count=0;for(f=h.materials.length;b<f;b++)if(e=h.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=k.materials.length;e<c;e++)(j=k.materials[e])&&(j.transparent?t(n,j):t(m,j))}else(j=e)&&(j.transparent?t(n,j):t(m,j))}function v(b,e){return e.z-b.z}function y(b,c){var m,u,t,v=0,w,y,z,x,D=b.lights;ea||(ea=new THREE.Camera(P.shadowCameraFov,c.aspect,P.shadowCameraNear,P.shadowCameraFar));m=0;for(u=D.length;m<
+u;m++)if(t=D[m],t instanceof THREE.SpotLight&&t.castShadow){P.shadowMap[v]||(P.shadowMap[v]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));za[v]||(za[v]=new THREE.Matrix4);w=P.shadowMap[v];y=za[v];ea.position.copy(t.position);ea.target.position.copy(t.target.position);ea.update(void 0,!0);b.update(void 0,!1,ea);y.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);y.multiplySelf(ea.projectionMatrix);
+y.multiplySelf(ea.matrixWorldInverse);ea.matrixWorldInverse.flattenToArray(aa);ea.projectionMatrix.flattenToArray(ra);N.multiply(ea.projectionMatrix,ea.matrixWorldInverse);p(N);P.initWebGLObjects(b);F(w);n.clearColor(1,1,1,1);P.clear();n.clearColor(pa.r,pa.g,pa.b,sa);y=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(w=0;w<y;w++)z=b.__webglObjects[w],x=z.object,x.visible&&x.castShadow?!(x instanceof THREE.Mesh)||!x.frustumCulled||o(x)?(x.matrixWorld.flattenToArray(x._objectMatrixArray),
+B(x,ea,!1),z.render=!0):z.render=!1:z.render=!1;j(!0);O(THREE.NormalBlending);for(w=0;w<y;w++)if(z=b.__webglObjects[w],z.render)x=z.object,buffer=z.buffer,k(x),z=x.customDepthMaterial?x.customDepthMaterial:x.geometry.morphTargets.length?Fa:xa,f(ea,D,null,z,buffer,x);for(w=0;w<t;w++)z=b.__webglObjectsImmediate[w],x=z.object,x.visible&&x.castShadow&&(x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray),B(x,ea,!1),k(x),program=e(ea,D,null,xa,x),x.render(function(b){h(b,program,xa.shading)}));
+v++}}function x(b,e){var c,f,j;c=V.attributes;var h=V.uniforms,k=ma/ia,m,o=[],u=ia*0.5,p=ma*0.5,t=!0;n.useProgram(V.program);la=V.program;ha=ca=-1;Ba||(n.enableVertexAttribArray(V.attributes.position),n.enableVertexAttribArray(V.attributes.uv),Ba=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,V.vertexBuffer);n.vertexAttribPointer(c.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(c.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,V.elementBuffer);
+n.uniformMatrix4fv(h.projectionMatrix,!1,ra);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.useScreenCoordinates?j.z=-j.position.z:(j._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray),j.z=-j._modelViewMatrix.n34);b.__webglSprites.sort(v);c=0;for(f=b.__webglSprites.length;c<f;c++)j=b.__webglSprites[c],j.material===void 0&&j.map&&j.map.image&&j.map.image.width&&(j.useScreenCoordinates?(n.uniform1i(h.useScreenCoordinates,
+1),n.uniform3f(h.screenPosition,(j.position.x-u)/u,(p-j.position.y)/p,Math.max(0,Math.min(1,j.position.z)))):(n.uniform1i(h.useScreenCoordinates,0),n.uniform1i(h.affectedByDistance,j.affectedByDistance?1:0),n.uniformMatrix4fv(h.modelViewMatrix,!1,j._modelViewMatrixArray)),m=j.map.image.width/(j.scaleByViewport?ma:1),o[0]=m*k*j.scale.x,o[1]=m*j.scale.y,n.uniform2f(h.uvScale,j.uvScale.x,j.uvScale.y),n.uniform2f(h.uvOffset,j.uvOffset.x,j.uvOffset.y),n.uniform2f(h.alignment,j.alignment.x,j.alignment.y),
+n.uniform1f(h.opacity,j.opacity),n.uniform1f(h.rotation,j.rotation),n.uniform2fv(h.scale,o),j.mergeWith3D&&!t?(n.enable(n.DEPTH_TEST),t=!0):!j.mergeWith3D&&t&&(n.disable(n.DEPTH_TEST),t=!1),O(j.blending),H(j.map,0),n.drawElements(n.TRIANGLES,6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(ga)}function B(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
 function z(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function D(b){var e,c,f,j;j=b.__materials;b=0;for(c=j.length;b<c;b++)if(f=j[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function C(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function E(b){function e(b){var j=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?j.push("undefined"):j.push(b[c].id);return j.join("_")}
-var c,f,j,h,k,m,n,o,p={},v=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};j=0;for(h=b.faces.length;j<h;j++)k=b.faces[j],m=k.materials,n=e(m),p[n]==void 0&&(p[n]={hash:n,counter:0}),o=p[n].hash+"_"+p[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:m,vertices:0,numMorphTargets:v}),k=k instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+k>65535&&(p[n].counter+=1,o=p[n].hash+"_"+p[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],
-materials:m,vertices:0,numMorphTargets:v})),b.geometryGroups[o].faces.push(j),b.geometryGroups[o].vertices+=k}function J(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(b){if(b!=U){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,
-n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}U=b}}function K(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,L(e.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,L(e.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,L(e.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,L(e.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),
-n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,M(e.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,M(e.minFilter)))}function I(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=n.createTexture();n.activeTexture(n.TEXTURE0+e);n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,0,L(b.format),b.image.width,b.image.height,0,L(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D,
-0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);K(n.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function F(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();if(e){n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture);K(n.TEXTURE_CUBE_MAP,
-b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=n.createFramebuffer(),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type),null)}else b.__webglFramebuffer=n.createFramebuffer(),n.bindTexture(n.TEXTURE_2D,b.__webglTexture),K(n.TEXTURE_2D,b,b),n.texImage2D(n.TEXTURE_2D,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type),null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)n.bindFramebuffer(n.FRAMEBUFFER,
-b.__webglFramebuffer[c]),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&
-b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);e?n.bindTexture(n.TEXTURE_CUBE_MAP,null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}var f,j;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,
-j=f=0):(e=null,c=ia,b=ma,f=ca,j=ga);e!=Q&&(n.bindFramebuffer(n.FRAMEBUFFER,e),n.viewport(f,j,c,b),Q=e)}function Y(b){b instanceof THREE.WebGLRenderTargetCube?(n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture),n.generateMipmap(n.TEXTURE_CUBE_MAP),n.bindTexture(n.TEXTURE_CUBE_MAP,null)):(n.bindTexture(n.TEXTURE_2D,b.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))}function G(b,e){var c;b=="fragment"?c=n.createShader(n.FRAGMENT_SHADER):b=="vertex"&&(c=n.createShader(n.VERTEX_SHADER));
-n.shaderSource(c,e);n.compileShader(c);if(!n.getShaderParameter(c,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(c)),console.error(e),null;return c}function M(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function L(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT;
-case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;case THREE.UnsignedShortType:return n.UNSIGNED_SHORT;
-case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var S=this,n,V=[],fa=null,Q=null,da=!0,$=null,ka=null,U=null,aa=null,ja=null,ha=null,X=null,ca=0,ga=0,ia=0,ma=0,Z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Matrix4,ra=new Float32Array(16),la=new Float32Array(16),sa=new THREE.Vector4,Ha={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},oa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),va=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Da=b.antialias!==void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):
-new THREE.Color(0),ta=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.sortObjects=this.autoClear=!0;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=!0;var ea,ya=[],b=THREE.ShaderLib.depthRGBA,
-xa=THREE.UniformsUtils.clone(b.uniforms),wa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa}),Ea=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:xa,morphTargets:!0});wa._shadowPass=!0;Ea._shadowPass=!0;try{if(!(n=oa.getContext("experimental-webgl",{antialias:Da,stencil:va,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+
-" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Fa){console.error(Fa)}n.clearColor(0,0,0,1);n.clearDepth(1);n.clearStencil(0);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(pa.r,pa.g,pa.b,ta);this.context=n;var na=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,
-T={};T.vertices=new Float32Array(16);T.faces=new Uint16Array(6);i=0;T.vertices[i++]=-1;T.vertices[i++]=-1;T.vertices[i++]=0;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=-1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=1;T.vertices[i++]=0;T.vertices[i++]=-1;T.vertices[i++]=1;T.vertices[i++]=0;i=T.vertices[i++]=0;T.faces[i++]=0;T.faces[i++]=1;T.faces[i++]=2;T.faces[i++]=0;T.faces[i++]=2;T.faces[i++]=3;T.vertexBuffer=n.createBuffer();T.elementBuffer=n.createBuffer();
-n.bindBuffer(n.ARRAY_BUFFER,T.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,T.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,T.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,T.faces,n.STATIC_DRAW);T.program=n.createProgram();n.attachShader(T.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(T.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(T.program);T.attributes={};T.uniforms={};T.attributes.position=n.getAttribLocation(T.program,"position");
-T.attributes.uv=n.getAttribLocation(T.program,"uv");T.uniforms.uvOffset=n.getUniformLocation(T.program,"uvOffset");T.uniforms.uvScale=n.getUniformLocation(T.program,"uvScale");T.uniforms.rotation=n.getUniformLocation(T.program,"rotation");T.uniforms.scale=n.getUniformLocation(T.program,"scale");T.uniforms.alignment=n.getUniformLocation(T.program,"alignment");T.uniforms.map=n.getUniformLocation(T.program,"map");T.uniforms.opacity=n.getUniformLocation(T.program,"opacity");T.uniforms.useScreenCoordinates=
-n.getUniformLocation(T.program,"useScreenCoordinates");T.uniforms.affectedByDistance=n.getUniformLocation(T.program,"affectedByDistance");T.uniforms.screenPosition=n.getUniformLocation(T.program,"screenPosition");T.uniforms.modelViewMatrix=n.getUniformLocation(T.program,"modelViewMatrix");T.uniforms.projectionMatrix=n.getUniformLocation(T.program,"projectionMatrix");var Aa=!1;this.setSize=function(b,e){oa.width=b;oa.height=e;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(b,e,
-c,f){ca=b;ga=e;ia=c;ma=f;n.viewport(ca,ga,ia,ma)};this.setScissor=function(b,e,c,f){n.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){da=b;n.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);ta=e;n.clearColor(pa.r,pa.g,pa.b,ta)};this.setClearColor=function(b,e){pa.copy(b);ta=e;n.clearColor(pa.r,pa.g,pa.b,ta)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};
-this.getContext=function(){return n};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];n.deleteBuffer(e.__webglVertexBuffer);n.deleteBuffer(e.__webglNormalBuffer);n.deleteBuffer(e.__webglTangentBuffer);n.deleteBuffer(e.__webglColorBuffer);n.deleteBuffer(e.__webglUVBuffer);
-n.deleteBuffer(e.__webglUV2Buffer);n.deleteBuffer(e.__webglSkinVertexABuffer);n.deleteBuffer(e.__webglSkinVertexBBuffer);n.deleteBuffer(e.__webglSkinIndicesBuffer);n.deleteBuffer(e.__webglSkinWeightsBuffer);n.deleteBuffer(e.__webglFaceBuffer);n.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)n.deleteBuffer(e.__webglMorphTargetsBuffers[c])}else if(b instanceof THREE.Ribbon)b=b.geometry,n.deleteBuffer(b.__webglVertexBuffer),n.deleteBuffer(b.__webglColorBuffer);
-else if(b instanceof THREE.Line)b=b.geometry,n.deleteBuffer(b.__webglVertexBuffer),n.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.ParticleSystem)b=b.geometry,n.deleteBuffer(b.__webglVertexBuffer),n.deleteBuffer(b.__webglColorBuffer)};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,n.deleteTexture(b.__webglTexture)};this.initMaterial=function(b,e,c,f){var j,h,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof
-THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,p,v;o=v=m=0;for(p=e.length;o<p;o++)h=e[o],h instanceof THREE.SpotLight&&v++,h instanceof THREE.DirectionalLight&&
-v++,h instanceof THREE.PointLight&&m++;m+v<=_maxLights?o=v:(o=Math.ceil(_maxLights*v/(m+v)),m=_maxLights-o);h={directional:o,point:m};m=v=0;for(o=e.length;m<o;m++)p=e[m],p instanceof THREE.SpotLight&&p.castShadow&&v++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var u;a:{o=b.fragmentShader;p=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,
-morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},w,f=[];k?f.push(k):(f.push(o),f.push(p));for(w in c)f.push(w),f.push(c[w]);k=f.join();w=0;for(f=V.length;w<f;w++)if(V[w].code==k){u=V[w].program;break a}w=n.createProgram();f=[na?
-"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?
+var c,f,j,h,k,m,n,o,u={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};j=0;for(h=b.faces.length;j<h;j++)k=b.faces[j],m=k.materials,n=e(m),u[n]==void 0&&(u[n]={hash:n,counter:0}),o=u[n].hash+"_"+u[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:m,vertices:0,numMorphTargets:p}),k=k instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+k>65535&&(u[n].counter+=1,o=u[n].hash+"_"+u[n].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],
+materials:m,vertices:0,numMorphTargets:p})),b.geometryGroups[o].faces.push(j),b.geometryGroups[o].vertices+=k;b.geometryGroupsList=[];for(var t in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[t])}function J(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function O(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,
+n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}ca=b}}function K(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,L(e.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,L(e.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,L(e.magFilter)),n.texParameteri(b,
+n.TEXTURE_MIN_FILTER,L(e.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,M(e.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,M(e.minFilter)))}function H(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=n.createTexture();n.activeTexture(n.TEXTURE0+e);n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?n.texImage2D(n.TEXTURE_2D,
+0,L(b.format),b.image.width,b.image.height,0,L(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);K(n.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function F(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=n.createRenderbuffer();
+b.__webglTexture=n.createTexture();if(e){n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture);K(n.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=n.createFramebuffer(),n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type),null)}else b.__webglFramebuffer=n.createFramebuffer(),n.bindTexture(n.TEXTURE_2D,b.__webglTexture),K(n.TEXTURE_2D,b,b),n.texImage2D(n.TEXTURE_2D,0,L(b.format),b.width,b.height,0,L(b.format),L(b.type),
+null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer[c]),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height),
+n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);e?n.bindTexture(n.TEXTURE_CUBE_MAP,null):n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,
+null)}var f,j;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,j=f=0):(e=null,c=ia,b=ma,f=W,j=ja);e!=R&&(n.bindFramebuffer(n.FRAMEBUFFER,e),n.viewport(f,j,c,b),R=e)}function T(b){b instanceof THREE.WebGLRenderTargetCube?(n.bindTexture(n.TEXTURE_CUBE_MAP,b.__webglTexture),n.generateMipmap(n.TEXTURE_CUBE_MAP),n.bindTexture(n.TEXTURE_CUBE_MAP,null)):(n.bindTexture(n.TEXTURE_2D,b.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))}function G(b,
+e){var c;b=="fragment"?c=n.createShader(n.FRAGMENT_SHADER):b=="vertex"&&(c=n.createShader(n.VERTEX_SHADER));n.shaderSource(c,e);n.compileShader(c);if(!n.getShaderParameter(c,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(c)),console.error(e),null;return c}function M(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function L(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;
+case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT;case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;
+case THREE.UnsignedShortType:return n.UNSIGNED_SHORT;case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var P=this,n,X=[],la=null,R=null,ga=!0,Z=null,da=null,ca=null,ha=null,ka=null,$=null,U=null,W=0,ja=0,ia=0,ma=
+0,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],N=new THREE.Matrix4,ra=new Float32Array(16),aa=new Float32Array(16),va=new THREE.Vector4,Ia={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},oa=b.canvas!==void 0?b.canvas:document.createElement("canvas"),wa=b.stencil!==void 0?b.stencil:!0,Ka=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ea=b.antialias!==
+void 0?b.antialias:!1,pa=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),sa=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=oa;this.sortObjects=this.autoClear=!0;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=!0;var ea,za=[],b=THREE.ShaderLib.depthRGBA,ya=THREE.UniformsUtils.clone(b.uniforms),xa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ya}),Fa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:ya,morphTargets:!0});xa._shadowPass=!0;Fa._shadowPass=!0;try{if(!(n=oa.getContext("experimental-webgl",{antialias:Ea,stencil:wa,preserveDrawingBuffer:Ka})))throw"Error creating WebGL context.";
+console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,0,0,1);n.clearDepth(1);n.clearStencil(0);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(pa.r,pa.g,pa.b,sa);this.context=
+n;var na=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);i=0;V.vertices[i++]=-1;V.vertices[i++]=-1;V.vertices[i++]=0;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=-1;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=1;V.vertices[i++]=0;V.vertices[i++]=-1;V.vertices[i++]=1;V.vertices[i++]=0;i=V.vertices[i++]=0;V.faces[i++]=0;V.faces[i++]=1;V.faces[i++]=2;V.faces[i++]=0;V.faces[i++]=2;V.faces[i++]=
+3;V.vertexBuffer=n.createBuffer();V.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,V.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,V.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,V.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,V.faces,n.STATIC_DRAW);V.program=n.createProgram();n.attachShader(V.program,G("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(V.program,G("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(V.program);V.attributes={};V.uniforms=
+{};V.attributes.position=n.getAttribLocation(V.program,"position");V.attributes.uv=n.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=n.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=n.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=n.getUniformLocation(V.program,"rotation");V.uniforms.scale=n.getUniformLocation(V.program,"scale");V.uniforms.alignment=n.getUniformLocation(V.program,"alignment");V.uniforms.map=n.getUniformLocation(V.program,"map");V.uniforms.opacity=n.getUniformLocation(V.program,
+"opacity");V.uniforms.useScreenCoordinates=n.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=n.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=n.getUniformLocation(V.program,"screenPosition");V.uniforms.modelViewMatrix=n.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=n.getUniformLocation(V.program,"projectionMatrix");var Ba=!1;this.setSize=function(b,e){oa.width=b;oa.height=e;this.setViewport(0,0,oa.width,
+oa.height)};this.setViewport=function(b,e,c,f){W=b;ja=e;ia=c;ma=f;n.viewport(W,ja,ia,ma)};this.setScissor=function(b,e,c,f){n.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ga=b;n.depthMask(b)};this.setClearColorHex=function(b,e){pa.setHex(b);sa=e;n.clearColor(pa.r,pa.g,pa.b,sa)};this.setClearColor=function(b,e){pa.copy(b);sa=e;n.clearColor(pa.r,pa.g,pa.b,sa)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|
+n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];n.deleteBuffer(e.__webglVertexBuffer);n.deleteBuffer(e.__webglNormalBuffer);n.deleteBuffer(e.__webglTangentBuffer);n.deleteBuffer(e.__webglColorBuffer);
+n.deleteBuffer(e.__webglUVBuffer);n.deleteBuffer(e.__webglUV2Buffer);n.deleteBuffer(e.__webglSkinVertexABuffer);n.deleteBuffer(e.__webglSkinVertexBBuffer);n.deleteBuffer(e.__webglSkinIndicesBuffer);n.deleteBuffer(e.__webglSkinWeightsBuffer);n.deleteBuffer(e.__webglFaceBuffer);n.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)n.deleteBuffer(e.__webglMorphTargetsBuffers[c])}else if(b instanceof THREE.Ribbon)b=b.geometry,n.deleteBuffer(b.__webglVertexBuffer),
+n.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.Line)b=b.geometry,n.deleteBuffer(b.__webglVertexBuffer),n.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.ParticleSystem)b=b.geometry,n.deleteBuffer(b.__webglVertexBuffer),n.deleteBuffer(b.__webglColorBuffer)};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,n.deleteTexture(b.__webglTexture)};this.initMaterial=function(b,e,c,f){var j,h,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?
+k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var o,u,p;o=p=m=0;for(u=e.length;o<u;o++)h=e[o],h instanceof THREE.SpotLight&&p++,h instanceof
+THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&m++;m+p<=_maxLights?o=p:(o=Math.ceil(_maxLights*p/(m+p)),m=_maxLights-o);h={directional:o,point:m};m=p=0;for(o=e.length;m<o;m++)u=e[m],u instanceof THREE.SpotLight&&u.castShadow&&p++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var v;a:{o=b.fragmentShader;u=b.vertexShader;var m=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,
+skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},w,f=[];k?f.push(k):(f.push(o),f.push(u));for(w in c)f.push(w),f.push(c[w]);k=f.join();w=0;for(f=X.length;w<f;w++)if(X[w].code==k){v=X[w].program;break a}w=n.createProgram();
+f=[na?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?
 "#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
 h=["#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:"",c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",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");n.attachShader(w,G("fragment",h+o));n.attachShader(w,G("vertex",f+p));n.linkProgram(w);n.getProgramParameter(w,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(w,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");w.uniforms=
-{};w.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in m)f.push(x);x=f;f=0;for(m=x.length;f<m;f++)o=x[f],w.uniforms[o]=n.getUniformLocation(w,o);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)f.push("morphTarget"+x);for(u in e)f.push(u);u=f;x=0;for(e=u.length;x<e;x++)c=
-u[x],w.attributes[c]=n.getAttribLocation(w,c);V.push({program:w,code:k});u=w}b.program=u;u=b.program.attributes;u.position>=0&&n.enableVertexAttribArray(u.position);u.color>=0&&n.enableVertexAttribArray(u.color);u.normal>=0&&n.enableVertexAttribArray(u.normal);u.tangent>=0&&n.enableVertexAttribArray(u.tangent);b.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0&&(n.enableVertexAttribArray(u.skinVertexA),n.enableVertexAttribArray(u.skinVertexB),n.enableVertexAttribArray(u.skinIndex),
-n.enableVertexAttribArray(u.skinWeight));if(b.attributes)for(j in b.attributes)u[j]!==void 0&&u[j]>=0&&n.enableVertexAttribArray(u[j]);if(b.morphTargets)for(j=b.numSupportedMorphTargets=0;j<this.maxMorphTargets;j++)x="morphTarget"+j,u[x]>=0&&(n.enableVertexAttribArray(u[x]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,e,f){F(b);b=0;c&&(b|=n.COLOR_BUFFER_BIT);e&&(b|=n.DEPTH_BUFFER_BIT);f&&(b|=n.STENCIL_BUFFER_BIT);n.clear(b)};this.render=function(b,c,n,t){var z,D,C,E,Z,I,J,G,K=b.lights,
-M=b.fog;this.shadowMapEnabled&&y(b,c);S.data.vertices=0;S.data.faces=0;S.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(la);c.projectionMatrix.flattenToArray(ra);N.multiply(c.projectionMatrix,c.matrixWorldInverse);p(N);this.initWebGLObjects(b);F(n);(this.autoClear||t)&&this.clear();Z=b.__webglObjects.length;for(t=0;t<Z;t++)if(z=b.__webglObjects[t],J=z.object,J.visible)if(!(J instanceof THREE.Mesh)||!J.frustumCulled||o(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),
-B(J,c,!0),w(z),z.render=!0,this.sortObjects)z.object.renderDepth?z.z=z.object.renderDepth:(sa.copy(J.position),N.multiplyVector3(sa),z.z=sa.z)}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(u);I=b.__webglObjectsImmediate.length;for(t=0;t<I;t++)z=b.__webglObjectsImmediate[t],J=z.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),B(J,c,!0),v(z));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);O(b.overrideMaterial.blending);for(t=
-0;t<Z;t++)if(z=b.__webglObjects[t],z.render)J=z.object,G=z.buffer,k(J),f(c,K,M,b.overrideMaterial,G,J);for(t=0;t<I;t++)z=b.__webglObjectsImmediate[t],J=z.object,J.visible&&(k(J),D=e(c,K,M,b.overrideMaterial,J),J.render(function(c){h(c,D,b.overrideMaterial.shading)}))}else{O(THREE.NormalBlending);for(t=Z-1;t>=0;t--)if(z=b.__webglObjects[t],z.render){J=z.object;G=z.buffer;C=z.opaque;k(J);for(z=0;z<C.count;z++)E=C.list[z],j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,
-K,M,E,G,J)}for(t=0;t<I;t++)if(z=b.__webglObjectsImmediate[t],J=z.object,J.visible){C=z.opaque;k(J);for(z=0;z<C.count;z++)E=C.list[z],j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),D=e(c,K,M,E,J),J.render(function(b){h(b,D,E.shading)})}for(t=0;t<Z;t++)if(z=b.__webglObjects[t],z.render){J=z.object;G=z.buffer;C=z.transparent;k(J);for(z=0;z<C.count;z++)E=C.list[z],O(E.blending),j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,K,M,E,G,J)}for(t=
-0;t<I;t++)if(z=b.__webglObjectsImmediate[t],J=z.object,J.visible){C=z.transparent;k(J);for(z=0;z<C.count;z++)E=C.list[z],O(E.blending),j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),D=e(c,K,M,E,J),J.render(function(b){h(b,D,E.shading)})}}b.__webglSprites.length&&x(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&Y(n)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];
+"",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");n.attachShader(w,G("fragment",h+o));n.attachShader(w,G("vertex",f+u));n.linkProgram(w);n.getProgramParameter(w,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(w,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");w.uniforms=
+{};w.attributes={};var x,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(x in m)f.push(x);x=f;f=0;for(m=x.length;f<m;f++)o=x[f],w.uniforms[o]=n.getUniformLocation(w,o);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(x=0;x<c.maxMorphTargets;x++)f.push("morphTarget"+x);for(v in e)f.push(v);v=f;x=0;for(e=v.length;x<e;x++)c=
+v[x],w.attributes[c]=n.getAttribLocation(w,c);X.push({program:w,code:k});v=w}b.program=v;v=b.program.attributes;v.position>=0&&n.enableVertexAttribArray(v.position);v.color>=0&&n.enableVertexAttribArray(v.color);v.normal>=0&&n.enableVertexAttribArray(v.normal);v.tangent>=0&&n.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(n.enableVertexAttribArray(v.skinVertexA),n.enableVertexAttribArray(v.skinVertexB),n.enableVertexAttribArray(v.skinIndex),
+n.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(j in b.attributes)v[j]!==void 0&&v[j]>=0&&n.enableVertexAttribArray(v[j]);if(b.morphTargets)for(j=b.numSupportedMorphTargets=0;j<this.maxMorphTargets;j++)x="morphTarget"+j,v[x]>=0&&(n.enableVertexAttribArray(v[x]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,e,f){F(b);b=0;c&&(b|=n.COLOR_BUFFER_BIT);e&&(b|=n.DEPTH_BUFFER_BIT);f&&(b|=n.STENCIL_BUFFER_BIT);n.clear(b)};this.render=function(b,c,n,t){var z,D,C,E,Y,H,J,G,K=b.lights,
+M=b.fog;this.shadowMapEnabled&&y(b,c);P.data.vertices=0;P.data.faces=0;P.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(aa);c.projectionMatrix.flattenToArray(ra);N.multiply(c.projectionMatrix,c.matrixWorldInverse);p(N);this.initWebGLObjects(b);F(n);(this.autoClear||t)&&this.clear();Y=b.__webglObjects.length;for(t=0;t<Y;t++)if(z=b.__webglObjects[t],J=z.object,J.visible)if(!(J instanceof THREE.Mesh)||!J.frustumCulled||o(J)){if(J.matrixWorld.flattenToArray(J._objectMatrixArray),
+B(J,c,!0),w(z),z.render=!0,this.sortObjects)z.object.renderDepth?z.z=z.object.renderDepth:(va.copy(J.position),N.multiplyVector3(va),z.z=va.z)}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(v);H=b.__webglObjectsImmediate.length;for(t=0;t<H;t++)z=b.__webglObjectsImmediate[t],J=z.object,J.visible&&(J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray),B(J,c,!0),u(z));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);O(b.overrideMaterial.blending);for(t=
+0;t<Y;t++)if(z=b.__webglObjects[t],z.render)J=z.object,G=z.buffer,k(J),f(c,K,M,b.overrideMaterial,G,J);for(t=0;t<H;t++)z=b.__webglObjectsImmediate[t],J=z.object,J.visible&&(k(J),D=e(c,K,M,b.overrideMaterial,J),J.render(function(c){h(c,D,b.overrideMaterial.shading)}))}else{O(THREE.NormalBlending);for(t=Y-1;t>=0;t--)if(z=b.__webglObjects[t],z.render){J=z.object;G=z.buffer;C=z.opaque;k(J);for(z=0;z<C.count;z++)E=C.list[z],j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,
+K,M,E,G,J)}for(t=0;t<H;t++)if(z=b.__webglObjectsImmediate[t],J=z.object,J.visible){C=z.opaque;k(J);for(z=0;z<C.count;z++)E=C.list[z],j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),D=e(c,K,M,E,J),J.render(function(b){h(b,D,E.shading)})}for(t=0;t<Y;t++)if(z=b.__webglObjects[t],z.render){J=z.object;G=z.buffer;C=z.transparent;k(J);for(z=0;z<C.count;z++)E=C.list[z],O(E.blending),j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),f(c,K,M,E,G,J)}for(t=
+0;t<H;t++)if(z=b.__webglObjectsImmediate[t],J=z.object,J.visible){C=z.transparent;k(J);for(z=0;z<C.count;z++)E=C.list[z],O(E.blending),j(E.depthTest),m(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),D=e(c,K,M,E,J),J.render(function(b){h(b,D,E.shading)})}}b.__webglSprites.length&&x(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&T(n)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];
 for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,j=void 0,h=void 0,k=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh)for(j in h=e.geometry,h.geometryGroups==void 0&&E(h),h.geometryGroups){k=h.geometryGroups[j];if(!k.__webglVertexBuffer){var m=k;m.__webglVertexBuffer=
-n.createBuffer();m.__webglNormalBuffer=n.createBuffer();m.__webglTangentBuffer=n.createBuffer();m.__webglColorBuffer=n.createBuffer();m.__webglUVBuffer=n.createBuffer();m.__webglUV2Buffer=n.createBuffer();m.__webglSkinVertexABuffer=n.createBuffer();m.__webglSkinVertexBBuffer=n.createBuffer();m.__webglSkinIndicesBuffer=n.createBuffer();m.__webglSkinWeightsBuffer=n.createBuffer();m.__webglFaceBuffer=n.createBuffer();m.__webglLineBuffer=n.createBuffer();if(m.numMorphTargets){var o=void 0,p=void 0;m.__webglMorphTargetsBuffers=
-[];o=0;for(p=m.numMorphTargets;o<p;o++)m.__webglMorphTargetsBuffers.push(n.createBuffer())}for(var m=k,o=e,t=void 0,v=void 0,u=void 0,w=u=void 0,x=void 0,y=void 0,B=y=p=0,Z=u=v=void 0,I=Z=v=t=void 0,u=void 0,w=o.geometry,x=w.faces,Z=m.faces,t=0,v=Z.length;t<v;t++)u=Z[t],u=x[u],u instanceof THREE.Face3?(p+=3,y+=1,B+=3):u instanceof THREE.Face4&&(p+=4,y+=2,B+=4);for(var t=m,v=o,F=Z=x=void 0,G=void 0,F=void 0,u=[],x=0,Z=v.materials.length;x<Z;x++)if(F=v.materials[x],F instanceof THREE.MeshFaceMaterial){F=
-0;for(l=t.materials.length;F<l;F++)(G=t.materials[F])&&u.push(G)}else(G=F)&&u.push(G);t=u;m.__materials=t;a:{x=v=void 0;Z=t.length;for(v=0;v<Z;v++)if(x=t[v],x.map||x.lightMap||x instanceof THREE.MeshShaderMaterial){v=!0;break a}v=!1}a:{Z=x=void 0;u=t.length;for(x=0;x<u;x++)if(Z=t[x],!(Z instanceof THREE.MeshBasicMaterial&&!Z.envMap||Z instanceof THREE.MeshDepthMaterial)){Z=Z&&Z.shading!=void 0&&Z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}Z=!1}a:{u=x=void 0;F=t.length;
-for(x=0;x<F;x++)if(u=t[x],u.vertexColors){u=u.vertexColors;break a}u=!1}m.__vertexArray=new Float32Array(p*3);if(Z)m.__normalArray=new Float32Array(p*3);if(w.hasTangents)m.__tangentArray=new Float32Array(p*4);if(u)m.__colorArray=new Float32Array(p*3);if(v){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)m.__skinVertexAArray=
-new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(x=m.numMorphTargets;w<x;w++)m.__morphTargetsArrays.push(new Float32Array(p*3))}m.__needsSmoothNormals=Z==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=u;m.__normalType=
-Z;m.__webglFaceCount=y*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0);m.__webglLineCount=B*2;w=0;for(x=t.length;w<x;w++)if(v=t[w],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){u=v.attributes[a];Z={};for(I in u)Z[I]=u[I];if(!Z.__webglInitialized||Z.createUniqueBuffers)Z.__webglInitialized=!0,y=1,Z.type==="v2"?y=2:Z.type==="v3"?y=3:Z.type==="v4"?y=4:Z.type==="c"&&(y=3),Z.size=y,Z.array=new Float32Array(p*y),Z.buffer=n.createBuffer(),
-Z.buffer.belongsToAttribute=a,u.needsUpdate=!0,Z.__original=u;m.__webglCustomAttributes[a]=Z}}m.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}J(f.__webglObjects,k,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=n.createBuffer(),j.__webglColorBuffer=n.createBuffer(),j=h,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=
+n.createBuffer();m.__webglNormalBuffer=n.createBuffer();m.__webglTangentBuffer=n.createBuffer();m.__webglColorBuffer=n.createBuffer();m.__webglUVBuffer=n.createBuffer();m.__webglUV2Buffer=n.createBuffer();m.__webglSkinVertexABuffer=n.createBuffer();m.__webglSkinVertexBBuffer=n.createBuffer();m.__webglSkinIndicesBuffer=n.createBuffer();m.__webglSkinWeightsBuffer=n.createBuffer();m.__webglFaceBuffer=n.createBuffer();m.__webglLineBuffer=n.createBuffer();if(m.numMorphTargets){var o=void 0,u=void 0;m.__webglMorphTargetsBuffers=
+[];o=0;for(u=m.numMorphTargets;o<u;o++)m.__webglMorphTargetsBuffers.push(n.createBuffer())}for(var m=k,o=e,t=void 0,p=void 0,v=void 0,w=v=void 0,x=void 0,y=void 0,B=y=u=0,Y=v=p=void 0,H=Y=p=t=void 0,v=void 0,w=o.geometry,x=w.faces,Y=m.faces,t=0,p=Y.length;t<p;t++)v=Y[t],v=x[v],v instanceof THREE.Face3?(u+=3,y+=1,B+=3):v instanceof THREE.Face4&&(u+=4,y+=2,B+=4);for(var t=m,p=o,F=Y=x=void 0,G=void 0,F=void 0,v=[],x=0,Y=p.materials.length;x<Y;x++)if(F=p.materials[x],F instanceof THREE.MeshFaceMaterial){F=
+0;for(l=t.materials.length;F<l;F++)(G=t.materials[F])&&v.push(G)}else(G=F)&&v.push(G);t=v;m.__materials=t;a:{x=p=void 0;Y=t.length;for(p=0;p<Y;p++)if(x=t[p],x.map||x.lightMap||x instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{Y=x=void 0;v=t.length;for(x=0;x<v;x++)if(Y=t[x],!(Y instanceof THREE.MeshBasicMaterial&&!Y.envMap||Y instanceof THREE.MeshDepthMaterial)){Y=Y&&Y.shading!=void 0&&Y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}Y=!1}a:{v=x=void 0;F=t.length;
+for(x=0;x<F;x++)if(v=t[x],v.vertexColors){v=v.vertexColors;break a}v=!1}m.__vertexArray=new Float32Array(u*3);if(Y)m.__normalArray=new Float32Array(u*3);if(w.hasTangents)m.__tangentArray=new Float32Array(u*4);if(v)m.__colorArray=new Float32Array(u*3);if(p){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(u*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(u*2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)m.__skinVertexAArray=
+new Float32Array(u*4),m.__skinVertexBArray=new Float32Array(u*4),m.__skinIndexArray=new Float32Array(u*4),m.__skinWeightArray=new Float32Array(u*4);m.__faceArray=new Uint16Array(y*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(x=m.numMorphTargets;w<x;w++)m.__morphTargetsArrays.push(new Float32Array(u*3))}m.__needsSmoothNormals=Y==THREE.SmoothShading;m.__uvType=p;m.__vertexColorType=v;m.__normalType=
+Y;m.__webglFaceCount=y*3+(o.geometry.edgeFaces?o.geometry.edgeFaces.length*6:0);m.__webglLineCount=B*2;w=0;for(x=t.length;w<x;w++)if(p=t[w],p.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in p.attributes){v=p.attributes[a];Y={};for(H in v)Y[H]=v[H];if(!Y.__webglInitialized||Y.createUniqueBuffers)Y.__webglInitialized=!0,y=1,Y.type==="v2"?y=2:Y.type==="v3"?y=3:Y.type==="v4"?y=4:Y.type==="c"&&(y=3),Y.size=y,Y.array=new Float32Array(u*y),Y.buffer=n.createBuffer(),
+Y.buffer.belongsToAttribute=a,v.needsUpdate=!0,Y.__original=v;m.__webglCustomAttributes[a]=Y}}m.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}J(f.__webglObjects,k,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=n.createBuffer(),j.__webglColorBuffer=n.createBuffer(),j=h,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=
 new Float32Array(k*3),j.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0;J(f.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)j=h,j.__webglVertexBuffer=n.createBuffer(),j.__webglColorBuffer=n.createBuffer(),j=h,k=j.vertices.length,j.__vertexArray=new Float32Array(k*3),j.__colorArray=new Float32Array(k*3),j.__webglLineCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0;J(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;
-if(!h.__webglVertexBuffer){j=h;j.__webglVertexBuffer=n.createBuffer();j.__webglColorBuffer=n.createBuffer();j=h;k=e;m=j.vertices.length;j.__vertexArray=new Float32Array(m*3);j.__colorArray=new Float32Array(m*3);j.__sortArray=[];j.__webglParticleCount=m;j.__materials=k.materials;I=p=o=void 0;o=0;for(p=k.materials.length;o<p;o++)if(I=k.materials[o],I.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in I.attributes){originalAttribute=I.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
+if(!h.__webglVertexBuffer){j=h;j.__webglVertexBuffer=n.createBuffer();j.__webglColorBuffer=n.createBuffer();j=h;k=e;m=j.vertices.length;j.__vertexArray=new Float32Array(m*3);j.__colorArray=new Float32Array(m*3);j.__sortArray=[];j.__webglParticleCount=m;j.__materials=k.materials;H=u=o=void 0;o=0;for(u=k.materials.length;o<u;o++)if(H=k.materials[o],H.attributes){if(j.__webglCustomAttributes===void 0)j.__webglCustomAttributes={};for(a in H.attributes){originalAttribute=H.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
 originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(m*size),attribute.buffer=n.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;j.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
 !0;h.__dirtyColors=!0}J(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)C(e.__webglObjects,f);else if(f instanceof
-THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&C(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(j=b.__webglObjects[e].object,o=m=h=k=void 0,j instanceof THREE.Mesh){h=j.geometry;for(k in h.geometryGroups)if(m=h.geometryGroups[k],o=z(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
-o)if(o=m,p=n.DYNAMIC_DRAW,I=!h.dynamic,o.__inittedArrays){var K=B=y=void 0,N=void 0,O=K=void 0,M=void 0,ra=void 0,L=void 0,la=G=F=u=Z=x=v=t=w=void 0,H=N=L=N=ra=M=void 0,A=void 0,P=A=H=M=void 0,X=void 0,ca=P=A=H=K=K=O=L=N=P=A=H=X=P=A=H=X=P=A=H=void 0,Q=0,S=0,Y=0,T=0,V=0,ga=0,U=0,ka=0,sa=0,R=0,ia=0,P=H=0,P=void 0,$=o.__vertexArray,ha=o.__uvArray,ja=o.__uv2Array,fa=o.__normalArray,aa=o.__tangentArray,ma=o.__colorArray,da=o.__skinVertexAArray,ea=o.__skinVertexBArray,oa=o.__skinIndexArray,ua=o.__skinWeightArray,
-Ha=o.__morphTargetsArrays,pa=o.__webglCustomAttributes,A=void 0,ta=o.__faceArray,na=o.__lineArray,wa=o.__needsSmoothNormals,t=o.__vertexColorType,w=o.__uvType,v=o.__normalType,va=j.geometry,xa=va.__dirtyVertices,Ja=va.__dirtyElements,Da=va.__dirtyUvs,ya=va.__dirtyNormals,Aa=va.__dirtyTangents,Ea=va.__dirtyColors,Fa=va.__dirtyMorphTargets,Pa=va.vertices,$a=o.faces,cb=va.faces,ab=va.faceVertexUvs[0],bb=va.faceVertexUvs[1],Qa=va.skinVerticesA,Ra=va.skinVerticesB,Sa=va.skinIndices,Ia=va.skinWeights,Ga=
-va.morphTargets;if(pa)for(ca in pa)pa[ca].offset=0,pa[ca].offsetSrc=0;y=0;for(B=$a.length;y<B;y++)if(K=$a[y],N=cb[K],ab&&(x=ab[K]),bb&&(Z=bb[K]),K=N.vertexNormals,O=N.normal,M=N.vertexColors,ra=N.color,L=N.vertexTangents,N instanceof THREE.Face3){if(xa)u=Pa[N.a].position,F=Pa[N.b].position,G=Pa[N.c].position,$[S]=u.x,$[S+1]=u.y,$[S+2]=u.z,$[S+3]=F.x,$[S+4]=F.y,$[S+5]=F.z,$[S+6]=G.x,$[S+7]=G.y,$[S+8]=G.z,S+=9;if(pa)for(ca in pa)if(A=pa[ca],A.__original.needsUpdate)H=A.offset,P=A.offsetSrc,A.size===
-1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[H]=A.value[N.a],A.array[H+1]=A.value[N.b],A.array[H+2]=A.value[N.c]):A.boundTo==="faces"?(P=A.value[P],A.array[H]=P,A.array[H+1]=P,A.array[H+2]=P,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[H]=A.value[P],A.array[H+1]=A.value[P+1],A.array[H+2]=A.value[P+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(u=A.value[N.a],F=A.value[N.b],G=A.value[N.c]):A.boundTo==="faces"?(G=F=u=P=A.value[P],A.offsetSrc++):A.boundTo===
-"faceVertices"&&(u=A.value[P],F=A.value[P+1],G=A.value[P+2],A.offsetSrc+=3),A.size===2?(A.array[H]=u.x,A.array[H+1]=u.y,A.array[H+2]=F.x,A.array[H+3]=F.y,A.array[H+4]=G.x,A.array[H+5]=G.y,A.offset+=6):A.size===3?(A.type==="c"?(A.array[H]=u.r,A.array[H+1]=u.g,A.array[H+2]=u.b,A.array[H+3]=F.r,A.array[H+4]=F.g,A.array[H+5]=F.b,A.array[H+6]=G.r,A.array[H+7]=G.g,A.array[H+8]=G.b):(A.array[H]=u.x,A.array[H+1]=u.y,A.array[H+2]=u.z,A.array[H+3]=F.x,A.array[H+4]=F.y,A.array[H+5]=F.z,A.array[H+6]=G.x,A.array[H+
-7]=G.y,A.array[H+8]=G.z),A.offset+=9):(A.array[H]=u.x,A.array[H+1]=u.y,A.array[H+2]=u.z,A.array[H+3]=u.w,A.array[H+4]=F.x,A.array[H+5]=F.y,A.array[H+6]=F.z,A.array[H+7]=F.w,A.array[H+8]=G.x,A.array[H+9]=G.y,A.array[H+10]=G.z,A.array[H+11]=G.w,A.offset+=12));if(Fa){H=0;for(A=Ga.length;H<A;H++)u=Ga[H].vertices[N.a].position,F=Ga[H].vertices[N.b].position,G=Ga[H].vertices[N.c].position,P=Ha[H],P[ia]=u.x,P[ia+1]=u.y,P[ia+2]=u.z,P[ia+3]=F.x,P[ia+4]=F.y,P[ia+5]=F.z,P[ia+6]=G.x,P[ia+7]=G.y,P[ia+8]=G.z;ia+=
-9}if(Ia.length)H=Ia[N.a],A=Ia[N.b],P=Ia[N.c],ua[R]=H.x,ua[R+1]=H.y,ua[R+2]=H.z,ua[R+3]=H.w,ua[R+4]=A.x,ua[R+5]=A.y,ua[R+6]=A.z,ua[R+7]=A.w,ua[R+8]=P.x,ua[R+9]=P.y,ua[R+10]=P.z,ua[R+11]=P.w,H=Sa[N.a],A=Sa[N.b],P=Sa[N.c],oa[R]=H.x,oa[R+1]=H.y,oa[R+2]=H.z,oa[R+3]=H.w,oa[R+4]=A.x,oa[R+5]=A.y,oa[R+6]=A.z,oa[R+7]=A.w,oa[R+8]=P.x,oa[R+9]=P.y,oa[R+10]=P.z,oa[R+11]=P.w,H=Qa[N.a],A=Qa[N.b],P=Qa[N.c],da[R]=H.x,da[R+1]=H.y,da[R+2]=H.z,da[R+3]=1,da[R+4]=A.x,da[R+5]=A.y,da[R+6]=A.z,da[R+7]=1,da[R+8]=P.x,da[R+9]=
-P.y,da[R+10]=P.z,da[R+11]=1,H=Ra[N.a],A=Ra[N.b],P=Ra[N.c],ea[R]=H.x,ea[R+1]=H.y,ea[R+2]=H.z,ea[R+3]=1,ea[R+4]=A.x,ea[R+5]=A.y,ea[R+6]=A.z,ea[R+7]=1,ea[R+8]=P.x,ea[R+9]=P.y,ea[R+10]=P.z,ea[R+11]=1,R+=12;if(Ea&&t)M.length==3&&t==THREE.VertexColors?(N=M[0],H=M[1],A=M[2]):A=H=N=ra,ma[sa]=N.r,ma[sa+1]=N.g,ma[sa+2]=N.b,ma[sa+3]=H.r,ma[sa+4]=H.g,ma[sa+5]=H.b,ma[sa+6]=A.r,ma[sa+7]=A.g,ma[sa+8]=A.b,sa+=9;if(Aa&&va.hasTangents)M=L[0],ra=L[1],N=L[2],aa[U]=M.x,aa[U+1]=M.y,aa[U+2]=M.z,aa[U+3]=M.w,aa[U+4]=ra.x,
-aa[U+5]=ra.y,aa[U+6]=ra.z,aa[U+7]=ra.w,aa[U+8]=N.x,aa[U+9]=N.y,aa[U+10]=N.z,aa[U+11]=N.w,U+=12;if(ya&&v)if(K.length==3&&wa)for(L=0;L<3;L++)O=K[L],fa[ga]=O.x,fa[ga+1]=O.y,fa[ga+2]=O.z,ga+=3;else for(L=0;L<3;L++)fa[ga]=O.x,fa[ga+1]=O.y,fa[ga+2]=O.z,ga+=3;if(Da&&x!==void 0&&w)for(L=0;L<3;L++)K=x[L],ha[Y]=K.u,ha[Y+1]=K.v,Y+=2;if(Da&&Z!==void 0&&w)for(L=0;L<3;L++)K=Z[L],ja[T]=K.u,ja[T+1]=K.v,T+=2;Ja&&(ta[V]=Q,ta[V+1]=Q+1,ta[V+2]=Q+2,V+=3,na[ka]=Q,na[ka+1]=Q+1,na[ka+2]=Q,na[ka+3]=Q+2,na[ka+4]=Q+1,na[ka+
-5]=Q+2,ka+=6,Q+=3)}else if(N instanceof THREE.Face4){if(xa)u=Pa[N.a].position,F=Pa[N.b].position,G=Pa[N.c].position,la=Pa[N.d].position,$[S]=u.x,$[S+1]=u.y,$[S+2]=u.z,$[S+3]=F.x,$[S+4]=F.y,$[S+5]=F.z,$[S+6]=G.x,$[S+7]=G.y,$[S+8]=G.z,$[S+9]=la.x,$[S+10]=la.y,$[S+11]=la.z,S+=12;if(pa)for(ca in pa)if(A=pa[ca],A.__original.needsUpdate)H=A.offset,P=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[H]=A.value[N.a],A.array[H+1]=A.value[N.b],A.array[H+2]=A.value[N.c],A.array[H+3]=
-A.value[N.d]):A.boundTo==="faces"?(P=A.value[P],A.array[H]=P,A.array[H+1]=P,A.array[H+2]=P,A.array[H+3]=P,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[H]=A.value[P],A.array[H+1]=A.value[P+1],A.array[H+2]=A.value[P+2],A.array[H+3]=A.value[P+3],A.offsetSrc+=4),A.offset+=4):(A.boundTo===void 0||A.boundTo==="vertices"?(u=A.value[N.a],F=A.value[N.b],G=A.value[N.c],la=A.value[N.d]):A.boundTo==="faces"?(la=G=F=u=P=A.value[P],A.offsetSrc++):A.boundTo==="faceVertices"&&(u=A.value[P],F=A.value[P+1],
-G=A.value[P+2],la=A.value[P+3],A.offsetSrc+=4),A.size===2?(A.array[H]=u.x,A.array[H+1]=u.y,A.array[H+2]=F.x,A.array[H+3]=F.y,A.array[H+4]=G.x,A.array[H+5]=G.y,A.array[H+6]=la.x,A.array[H+7]=la.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[H]=u.r,A.array[H+1]=u.g,A.array[H+2]=u.b,A.array[H+3]=F.r,A.array[H+4]=F.g,A.array[H+5]=F.b,A.array[H+6]=G.r,A.array[H+7]=G.g,A.array[H+8]=G.b,A.array[H+9]=la.r,A.array[H+10]=la.g,A.array[H+11]=la.b):(A.array[H]=u.x,A.array[H+1]=u.y,A.array[H+2]=u.z,A.array[H+
-3]=F.x,A.array[H+4]=F.y,A.array[H+5]=F.z,A.array[H+6]=G.x,A.array[H+7]=G.y,A.array[H+8]=G.z,A.array[H+9]=la.x,A.array[H+10]=la.y,A.array[H+11]=la.z),A.offset+=12):(A.array[H]=u.x,A.array[H+1]=u.y,A.array[H+2]=u.z,A.array[H+3]=u.w,A.array[H+4]=F.x,A.array[H+5]=F.y,A.array[H+6]=F.z,A.array[H+7]=F.w,A.array[H+8]=G.x,A.array[H+9]=G.y,A.array[H+10]=G.z,A.array[H+11]=G.w,A.array[H+12]=la.x,A.array[H+13]=la.y,A.array[H+14]=la.z,A.array[H+15]=la.w,A.offset+=16));if(Fa){H=0;for(A=Ga.length;H<A;H++)u=Ga[H].vertices[N.a].position,
-F=Ga[H].vertices[N.b].position,G=Ga[H].vertices[N.c].position,la=Ga[H].vertices[N.d].position,P=Ha[H],P[ia]=u.x,P[ia+1]=u.y,P[ia+2]=u.z,P[ia+3]=F.x,P[ia+4]=F.y,P[ia+5]=F.z,P[ia+6]=G.x,P[ia+7]=G.y,P[ia+8]=G.z,P[ia+9]=la.x,P[ia+10]=la.y,P[ia+11]=la.z;ia+=12}if(Ia.length)H=Ia[N.a],A=Ia[N.b],P=Ia[N.c],X=Ia[N.d],ua[R]=H.x,ua[R+1]=H.y,ua[R+2]=H.z,ua[R+3]=H.w,ua[R+4]=A.x,ua[R+5]=A.y,ua[R+6]=A.z,ua[R+7]=A.w,ua[R+8]=P.x,ua[R+9]=P.y,ua[R+10]=P.z,ua[R+11]=P.w,ua[R+12]=X.x,ua[R+13]=X.y,ua[R+14]=X.z,ua[R+15]=
-X.w,H=Sa[N.a],A=Sa[N.b],P=Sa[N.c],X=Sa[N.d],oa[R]=H.x,oa[R+1]=H.y,oa[R+2]=H.z,oa[R+3]=H.w,oa[R+4]=A.x,oa[R+5]=A.y,oa[R+6]=A.z,oa[R+7]=A.w,oa[R+8]=P.x,oa[R+9]=P.y,oa[R+10]=P.z,oa[R+11]=P.w,oa[R+12]=X.x,oa[R+13]=X.y,oa[R+14]=X.z,oa[R+15]=X.w,H=Qa[N.a],A=Qa[N.b],P=Qa[N.c],X=Qa[N.d],da[R]=H.x,da[R+1]=H.y,da[R+2]=H.z,da[R+3]=1,da[R+4]=A.x,da[R+5]=A.y,da[R+6]=A.z,da[R+7]=1,da[R+8]=P.x,da[R+9]=P.y,da[R+10]=P.z,da[R+11]=1,da[R+12]=X.x,da[R+13]=X.y,da[R+14]=X.z,da[R+15]=1,H=Ra[N.a],A=Ra[N.b],P=Ra[N.c],N=Ra[N.d],
-ea[R]=H.x,ea[R+1]=H.y,ea[R+2]=H.z,ea[R+3]=1,ea[R+4]=A.x,ea[R+5]=A.y,ea[R+6]=A.z,ea[R+7]=1,ea[R+8]=P.x,ea[R+9]=P.y,ea[R+10]=P.z,ea[R+11]=1,ea[R+12]=N.x,ea[R+13]=N.y,ea[R+14]=N.z,ea[R+15]=1,R+=16;if(Ea&&t)M.length==4&&t==THREE.VertexColors?(N=M[0],H=M[1],A=M[2],M=M[3]):M=A=H=N=ra,ma[sa]=N.r,ma[sa+1]=N.g,ma[sa+2]=N.b,ma[sa+3]=H.r,ma[sa+4]=H.g,ma[sa+5]=H.b,ma[sa+6]=A.r,ma[sa+7]=A.g,ma[sa+8]=A.b,ma[sa+9]=M.r,ma[sa+10]=M.g,ma[sa+11]=M.b,sa+=12;if(Aa&&va.hasTangents)M=L[0],ra=L[1],N=L[2],L=L[3],aa[U]=M.x,
-aa[U+1]=M.y,aa[U+2]=M.z,aa[U+3]=M.w,aa[U+4]=ra.x,aa[U+5]=ra.y,aa[U+6]=ra.z,aa[U+7]=ra.w,aa[U+8]=N.x,aa[U+9]=N.y,aa[U+10]=N.z,aa[U+11]=N.w,aa[U+12]=L.x,aa[U+13]=L.y,aa[U+14]=L.z,aa[U+15]=L.w,U+=16;if(ya&&v)if(K.length==4&&wa)for(L=0;L<4;L++)O=K[L],fa[ga]=O.x,fa[ga+1]=O.y,fa[ga+2]=O.z,ga+=3;else for(L=0;L<4;L++)fa[ga]=O.x,fa[ga+1]=O.y,fa[ga+2]=O.z,ga+=3;if(Da&&x!==void 0&&w)for(L=0;L<4;L++)K=x[L],ha[Y]=K.u,ha[Y+1]=K.v,Y+=2;if(Da&&Z!==void 0&&w)for(L=0;L<4;L++)K=Z[L],ja[T]=K.u,ja[T+1]=K.v,T+=2;Ja&&(ta[V]=
-Q,ta[V+1]=Q+1,ta[V+2]=Q+3,ta[V+3]=Q+1,ta[V+4]=Q+2,ta[V+5]=Q+3,V+=6,na[ka]=Q,na[ka+1]=Q+1,na[ka+2]=Q,na[ka+3]=Q+3,na[ka+4]=Q+1,na[ka+5]=Q+2,na[ka+6]=Q+2,na[ka+7]=Q+3,ka+=8,Q+=4)}xa&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,$,p));if(pa)for(ca in pa)A=pa[ca],A.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,A.buffer),n.bufferData(n.ARRAY_BUFFER,A.array,p));if(Fa){H=0;for(A=Ga.length;H<A;H++)n.bindBuffer(n.ARRAY_BUFFER,o.__webglMorphTargetsBuffers[H]),n.bufferData(n.ARRAY_BUFFER,
-Ha[H],p)}Ea&&sa>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,ma,p));ya&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,fa,p));Aa&&va.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,aa,p));Da&&Y>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ha,p));Da&&T>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,ja,p));Ja&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
-o.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ta,p),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,o.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,na,p));R>0&&(n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,da,p),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,ea,p),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,oa,p),n.bindBuffer(n.ARRAY_BUFFER,o.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,
-ua,p));I&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(j instanceof THREE.Ribbon){h=
-j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=n.DYNAMIC_DRAW;m=B=y=y=void 0;w=j.vertices;o=j.colors;t=w.length;p=o.length;v=j.__vertexArray;I=j.__colorArray;x=j.__dirtyColors;if(j.__dirtyVertices){for(y=0;y<t;y++)B=w[y].position,m=y*3,v[m]=B.x,v[m+1]=B.y,v[m+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,v,k)}if(x){for(y=0;y<p;y++)color=o[y],m=y*3,I[m]=color.r,I[m+1]=color.g,I[m+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,j.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,
-I,k)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(j instanceof THREE.Line){h=j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=n.DYNAMIC_DRAW;m=B=y=y=void 0;w=j.vertices;o=j.colors;t=w.length;p=o.length;v=j.__vertexArray;I=j.__colorArray;x=j.__dirtyColors;if(j.__dirtyVertices){for(y=0;y<t;y++)B=w[y].position,m=y*3,v[m]=B.x,v[m+1]=B.y,v[m+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,v,k)}if(x){for(y=0;y<p;y++)color=o[y],m=y*3,I[m]=color.r,I[m+1]=color.g,
-I[m+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,j.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,I,k)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem)h=j.geometry,o=z(h),(h.__dirtyVertices||h.__dirtyColors||j.sortParticles||o)&&c(h,n.DYNAMIC_DRAW,j),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),
-n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=function(){return na}};
+THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&C(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(j=b.__webglObjects[e].object,u=k=h=void 0,j instanceof THREE.Mesh){h=j.geometry;m=0;for(o=h.geometryGroupsList.length;m<o;m++)if(k=h.geometryGroupsList[m],u=z(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||
+h.__dirtyTangents||u)if(u=k,H=n.DYNAMIC_DRAW,y=!h.dynamic,u.__inittedArrays){var K=w=B=void 0,N=void 0,O=K=void 0,M=void 0,ra=void 0,L=void 0,aa=G=F=v=Y=x=p=t=void 0,U=void 0,I=N=L=N=ra=M=void 0,A=void 0,S=A=I=M=void 0,W=void 0,R=S=A=I=K=K=O=L=N=S=A=I=W=S=A=I=W=S=A=I=void 0,P=0,T=0,V=0,X=0,ja=0,ca=0,da=0,va=0,ia=0,Q=0,Z=0,S=I=0,S=void 0,$=u.__vertexArray,ka=u.__uvArray,la=u.__uv2Array,ha=u.__normalArray,ma=u.__tangentArray,ga=u.__colorArray,ea=u.__skinVertexAArray,oa=u.__skinVertexBArray,ta=u.__skinIndexArray,
+ua=u.__skinWeightArray,Ia=u.__morphTargetsArrays,pa=u.__webglCustomAttributes,A=void 0,sa=u.__faceArray,na=u.__lineArray,xa=u.__needsSmoothNormals,p=u.__vertexColorType,t=u.__uvType,x=u.__normalType,wa=j.geometry,ya=wa.__dirtyVertices,Ka=wa.__dirtyElements,Ea=wa.__dirtyUvs,za=wa.__dirtyNormals,Ba=wa.__dirtyTangents,Fa=wa.__dirtyColors,Ga=wa.__dirtyMorphTargets,Qa=wa.vertices,bb=u.faces,eb=wa.faces,cb=wa.faceVertexUvs[0],db=wa.faceVertexUvs[1],Ra=wa.skinVerticesA,Sa=wa.skinVerticesB,Ta=wa.skinIndices,
+Ja=wa.skinWeights,Ha=wa.morphTargets;if(pa)for(R in pa)pa[R].offset=0,pa[R].offsetSrc=0;B=0;for(w=bb.length;B<w;B++)if(K=bb[B],N=eb[K],cb&&(Y=cb[K]),db&&(v=db[K]),K=N.vertexNormals,O=N.normal,M=N.vertexColors,ra=N.color,L=N.vertexTangents,N instanceof THREE.Face3){if(ya)F=Qa[N.a].position,G=Qa[N.b].position,aa=Qa[N.c].position,$[T]=F.x,$[T+1]=F.y,$[T+2]=F.z,$[T+3]=G.x,$[T+4]=G.y,$[T+5]=G.z,$[T+6]=aa.x,$[T+7]=aa.y,$[T+8]=aa.z,T+=9;if(pa)for(R in pa)if(A=pa[R],A.__original.needsUpdate)I=A.offset,S=
+A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[I]=A.value[N.a],A.array[I+1]=A.value[N.b],A.array[I+2]=A.value[N.c]):A.boundTo==="faces"?(S=A.value[S],A.array[I]=S,A.array[I+1]=S,A.array[I+2]=S,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[I]=A.value[S],A.array[I+1]=A.value[S+1],A.array[I+2]=A.value[S+2],A.offsetSrc+=3),A.offset+=3):(A.boundTo===void 0||A.boundTo==="vertices"?(F=A.value[N.a],G=A.value[N.b],aa=A.value[N.c]):A.boundTo==="faces"?(aa=G=F=S=A.value[S],
+A.offsetSrc++):A.boundTo==="faceVertices"&&(F=A.value[S],G=A.value[S+1],aa=A.value[S+2],A.offsetSrc+=3),A.size===2?(A.array[I]=F.x,A.array[I+1]=F.y,A.array[I+2]=G.x,A.array[I+3]=G.y,A.array[I+4]=aa.x,A.array[I+5]=aa.y,A.offset+=6):A.size===3?(A.type==="c"?(A.array[I]=F.r,A.array[I+1]=F.g,A.array[I+2]=F.b,A.array[I+3]=G.r,A.array[I+4]=G.g,A.array[I+5]=G.b,A.array[I+6]=aa.r,A.array[I+7]=aa.g,A.array[I+8]=aa.b):(A.array[I]=F.x,A.array[I+1]=F.y,A.array[I+2]=F.z,A.array[I+3]=G.x,A.array[I+4]=G.y,A.array[I+
+5]=G.z,A.array[I+6]=aa.x,A.array[I+7]=aa.y,A.array[I+8]=aa.z),A.offset+=9):(A.array[I]=F.x,A.array[I+1]=F.y,A.array[I+2]=F.z,A.array[I+3]=F.w,A.array[I+4]=G.x,A.array[I+5]=G.y,A.array[I+6]=G.z,A.array[I+7]=G.w,A.array[I+8]=aa.x,A.array[I+9]=aa.y,A.array[I+10]=aa.z,A.array[I+11]=aa.w,A.offset+=12));if(Ga){I=0;for(A=Ha.length;I<A;I++)F=Ha[I].vertices[N.a].position,G=Ha[I].vertices[N.b].position,aa=Ha[I].vertices[N.c].position,S=Ia[I],S[Z]=F.x,S[Z+1]=F.y,S[Z+2]=F.z,S[Z+3]=G.x,S[Z+4]=G.y,S[Z+5]=G.z,S[Z+
+6]=aa.x,S[Z+7]=aa.y,S[Z+8]=aa.z;Z+=9}if(Ja.length)I=Ja[N.a],A=Ja[N.b],S=Ja[N.c],ua[Q]=I.x,ua[Q+1]=I.y,ua[Q+2]=I.z,ua[Q+3]=I.w,ua[Q+4]=A.x,ua[Q+5]=A.y,ua[Q+6]=A.z,ua[Q+7]=A.w,ua[Q+8]=S.x,ua[Q+9]=S.y,ua[Q+10]=S.z,ua[Q+11]=S.w,I=Ta[N.a],A=Ta[N.b],S=Ta[N.c],ta[Q]=I.x,ta[Q+1]=I.y,ta[Q+2]=I.z,ta[Q+3]=I.w,ta[Q+4]=A.x,ta[Q+5]=A.y,ta[Q+6]=A.z,ta[Q+7]=A.w,ta[Q+8]=S.x,ta[Q+9]=S.y,ta[Q+10]=S.z,ta[Q+11]=S.w,I=Ra[N.a],A=Ra[N.b],S=Ra[N.c],ea[Q]=I.x,ea[Q+1]=I.y,ea[Q+2]=I.z,ea[Q+3]=1,ea[Q+4]=A.x,ea[Q+5]=A.y,ea[Q+
+6]=A.z,ea[Q+7]=1,ea[Q+8]=S.x,ea[Q+9]=S.y,ea[Q+10]=S.z,ea[Q+11]=1,I=Sa[N.a],A=Sa[N.b],S=Sa[N.c],oa[Q]=I.x,oa[Q+1]=I.y,oa[Q+2]=I.z,oa[Q+3]=1,oa[Q+4]=A.x,oa[Q+5]=A.y,oa[Q+6]=A.z,oa[Q+7]=1,oa[Q+8]=S.x,oa[Q+9]=S.y,oa[Q+10]=S.z,oa[Q+11]=1,Q+=12;if(Fa&&p)M.length==3&&p==THREE.VertexColors?(N=M[0],I=M[1],A=M[2]):A=I=N=ra,ga[ia]=N.r,ga[ia+1]=N.g,ga[ia+2]=N.b,ga[ia+3]=I.r,ga[ia+4]=I.g,ga[ia+5]=I.b,ga[ia+6]=A.r,ga[ia+7]=A.g,ga[ia+8]=A.b,ia+=9;if(Ba&&wa.hasTangents)M=L[0],ra=L[1],N=L[2],ma[da]=M.x,ma[da+1]=M.y,
+ma[da+2]=M.z,ma[da+3]=M.w,ma[da+4]=ra.x,ma[da+5]=ra.y,ma[da+6]=ra.z,ma[da+7]=ra.w,ma[da+8]=N.x,ma[da+9]=N.y,ma[da+10]=N.z,ma[da+11]=N.w,da+=12;if(za&&x)if(K.length==3&&xa)for(L=0;L<3;L++)O=K[L],ha[ca]=O.x,ha[ca+1]=O.y,ha[ca+2]=O.z,ca+=3;else for(L=0;L<3;L++)ha[ca]=O.x,ha[ca+1]=O.y,ha[ca+2]=O.z,ca+=3;if(Ea&&Y!==void 0&&t)for(L=0;L<3;L++)K=Y[L],ka[V]=K.u,ka[V+1]=K.v,V+=2;if(Ea&&v!==void 0&&t)for(L=0;L<3;L++)K=v[L],la[X]=K.u,la[X+1]=K.v,X+=2;Ka&&(sa[ja]=P,sa[ja+1]=P+1,sa[ja+2]=P+2,ja+=3,na[va]=P,na[va+
+1]=P+1,na[va+2]=P,na[va+3]=P+2,na[va+4]=P+1,na[va+5]=P+2,va+=6,P+=3)}else if(N instanceof THREE.Face4){if(ya)F=Qa[N.a].position,G=Qa[N.b].position,aa=Qa[N.c].position,U=Qa[N.d].position,$[T]=F.x,$[T+1]=F.y,$[T+2]=F.z,$[T+3]=G.x,$[T+4]=G.y,$[T+5]=G.z,$[T+6]=aa.x,$[T+7]=aa.y,$[T+8]=aa.z,$[T+9]=U.x,$[T+10]=U.y,$[T+11]=U.z,T+=12;if(pa)for(R in pa)if(A=pa[R],A.__original.needsUpdate)I=A.offset,S=A.offsetSrc,A.size===1?(A.boundTo===void 0||A.boundTo==="vertices"?(A.array[I]=A.value[N.a],A.array[I+1]=A.value[N.b],
+A.array[I+2]=A.value[N.c],A.array[I+3]=A.value[N.d]):A.boundTo==="faces"?(S=A.value[S],A.array[I]=S,A.array[I+1]=S,A.array[I+2]=S,A.array[I+3]=S,A.offsetSrc++):A.boundTo==="faceVertices"&&(A.array[I]=A.value[S],A.array[I+1]=A.value[S+1],A.array[I+2]=A.value[S+2],A.array[I+3]=A.value[S+3],A.offsetSrc+=4),A.offset+=4):(A.boundTo===void 0||A.boundTo==="vertices"?(F=A.value[N.a],G=A.value[N.b],aa=A.value[N.c],U=A.value[N.d]):A.boundTo==="faces"?(U=aa=G=F=S=A.value[S],A.offsetSrc++):A.boundTo==="faceVertices"&&
+(F=A.value[S],G=A.value[S+1],aa=A.value[S+2],U=A.value[S+3],A.offsetSrc+=4),A.size===2?(A.array[I]=F.x,A.array[I+1]=F.y,A.array[I+2]=G.x,A.array[I+3]=G.y,A.array[I+4]=aa.x,A.array[I+5]=aa.y,A.array[I+6]=U.x,A.array[I+7]=U.y,A.offset+=8):A.size===3?(A.type==="c"?(A.array[I]=F.r,A.array[I+1]=F.g,A.array[I+2]=F.b,A.array[I+3]=G.r,A.array[I+4]=G.g,A.array[I+5]=G.b,A.array[I+6]=aa.r,A.array[I+7]=aa.g,A.array[I+8]=aa.b,A.array[I+9]=U.r,A.array[I+10]=U.g,A.array[I+11]=U.b):(A.array[I]=F.x,A.array[I+1]=F.y,
+A.array[I+2]=F.z,A.array[I+3]=G.x,A.array[I+4]=G.y,A.array[I+5]=G.z,A.array[I+6]=aa.x,A.array[I+7]=aa.y,A.array[I+8]=aa.z,A.array[I+9]=U.x,A.array[I+10]=U.y,A.array[I+11]=U.z),A.offset+=12):(A.array[I]=F.x,A.array[I+1]=F.y,A.array[I+2]=F.z,A.array[I+3]=F.w,A.array[I+4]=G.x,A.array[I+5]=G.y,A.array[I+6]=G.z,A.array[I+7]=G.w,A.array[I+8]=aa.x,A.array[I+9]=aa.y,A.array[I+10]=aa.z,A.array[I+11]=aa.w,A.array[I+12]=U.x,A.array[I+13]=U.y,A.array[I+14]=U.z,A.array[I+15]=U.w,A.offset+=16));if(Ga){I=0;for(A=
+Ha.length;I<A;I++)F=Ha[I].vertices[N.a].position,G=Ha[I].vertices[N.b].position,aa=Ha[I].vertices[N.c].position,U=Ha[I].vertices[N.d].position,S=Ia[I],S[Z]=F.x,S[Z+1]=F.y,S[Z+2]=F.z,S[Z+3]=G.x,S[Z+4]=G.y,S[Z+5]=G.z,S[Z+6]=aa.x,S[Z+7]=aa.y,S[Z+8]=aa.z,S[Z+9]=U.x,S[Z+10]=U.y,S[Z+11]=U.z;Z+=12}if(Ja.length)I=Ja[N.a],A=Ja[N.b],S=Ja[N.c],W=Ja[N.d],ua[Q]=I.x,ua[Q+1]=I.y,ua[Q+2]=I.z,ua[Q+3]=I.w,ua[Q+4]=A.x,ua[Q+5]=A.y,ua[Q+6]=A.z,ua[Q+7]=A.w,ua[Q+8]=S.x,ua[Q+9]=S.y,ua[Q+10]=S.z,ua[Q+11]=S.w,ua[Q+12]=W.x,
+ua[Q+13]=W.y,ua[Q+14]=W.z,ua[Q+15]=W.w,I=Ta[N.a],A=Ta[N.b],S=Ta[N.c],W=Ta[N.d],ta[Q]=I.x,ta[Q+1]=I.y,ta[Q+2]=I.z,ta[Q+3]=I.w,ta[Q+4]=A.x,ta[Q+5]=A.y,ta[Q+6]=A.z,ta[Q+7]=A.w,ta[Q+8]=S.x,ta[Q+9]=S.y,ta[Q+10]=S.z,ta[Q+11]=S.w,ta[Q+12]=W.x,ta[Q+13]=W.y,ta[Q+14]=W.z,ta[Q+15]=W.w,I=Ra[N.a],A=Ra[N.b],S=Ra[N.c],W=Ra[N.d],ea[Q]=I.x,ea[Q+1]=I.y,ea[Q+2]=I.z,ea[Q+3]=1,ea[Q+4]=A.x,ea[Q+5]=A.y,ea[Q+6]=A.z,ea[Q+7]=1,ea[Q+8]=S.x,ea[Q+9]=S.y,ea[Q+10]=S.z,ea[Q+11]=1,ea[Q+12]=W.x,ea[Q+13]=W.y,ea[Q+14]=W.z,ea[Q+15]=
+1,I=Sa[N.a],A=Sa[N.b],S=Sa[N.c],N=Sa[N.d],oa[Q]=I.x,oa[Q+1]=I.y,oa[Q+2]=I.z,oa[Q+3]=1,oa[Q+4]=A.x,oa[Q+5]=A.y,oa[Q+6]=A.z,oa[Q+7]=1,oa[Q+8]=S.x,oa[Q+9]=S.y,oa[Q+10]=S.z,oa[Q+11]=1,oa[Q+12]=N.x,oa[Q+13]=N.y,oa[Q+14]=N.z,oa[Q+15]=1,Q+=16;if(Fa&&p)M.length==4&&p==THREE.VertexColors?(N=M[0],I=M[1],A=M[2],M=M[3]):M=A=I=N=ra,ga[ia]=N.r,ga[ia+1]=N.g,ga[ia+2]=N.b,ga[ia+3]=I.r,ga[ia+4]=I.g,ga[ia+5]=I.b,ga[ia+6]=A.r,ga[ia+7]=A.g,ga[ia+8]=A.b,ga[ia+9]=M.r,ga[ia+10]=M.g,ga[ia+11]=M.b,ia+=12;if(Ba&&wa.hasTangents)M=
+L[0],ra=L[1],N=L[2],L=L[3],ma[da]=M.x,ma[da+1]=M.y,ma[da+2]=M.z,ma[da+3]=M.w,ma[da+4]=ra.x,ma[da+5]=ra.y,ma[da+6]=ra.z,ma[da+7]=ra.w,ma[da+8]=N.x,ma[da+9]=N.y,ma[da+10]=N.z,ma[da+11]=N.w,ma[da+12]=L.x,ma[da+13]=L.y,ma[da+14]=L.z,ma[da+15]=L.w,da+=16;if(za&&x)if(K.length==4&&xa)for(L=0;L<4;L++)O=K[L],ha[ca]=O.x,ha[ca+1]=O.y,ha[ca+2]=O.z,ca+=3;else for(L=0;L<4;L++)ha[ca]=O.x,ha[ca+1]=O.y,ha[ca+2]=O.z,ca+=3;if(Ea&&Y!==void 0&&t)for(L=0;L<4;L++)K=Y[L],ka[V]=K.u,ka[V+1]=K.v,V+=2;if(Ea&&v!==void 0&&t)for(L=
+0;L<4;L++)K=v[L],la[X]=K.u,la[X+1]=K.v,X+=2;Ka&&(sa[ja]=P,sa[ja+1]=P+1,sa[ja+2]=P+3,sa[ja+3]=P+1,sa[ja+4]=P+2,sa[ja+5]=P+3,ja+=6,na[va]=P,na[va+1]=P+1,na[va+2]=P,na[va+3]=P+3,na[va+4]=P+1,na[va+5]=P+2,na[va+6]=P+2,na[va+7]=P+3,va+=8,P+=4)}ya&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,$,H));if(pa)for(R in pa)A=pa[R],A.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,A.buffer),n.bufferData(n.ARRAY_BUFFER,A.array,H));if(Ga){I=0;for(A=Ha.length;I<A;I++)n.bindBuffer(n.ARRAY_BUFFER,
+u.__webglMorphTargetsBuffers[I]),n.bufferData(n.ARRAY_BUFFER,Ia[I],H)}Fa&&ia>0&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,ga,H));za&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,ha,H));Ba&&wa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,ma,H));Ea&&V>0&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ka,H));Ea&&X>0&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglUV2Buffer),
+n.bufferData(n.ARRAY_BUFFER,la,H));Ka&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,u.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,sa,H),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,u.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,na,H));Q>0&&(n.bindBuffer(n.ARRAY_BUFFER,u.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,ea,H),n.bindBuffer(n.ARRAY_BUFFER,u.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,oa,H),n.bindBuffer(n.ARRAY_BUFFER,u.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,
+ta,H),n.bindBuffer(n.ARRAY_BUFFER,u.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,ua,H));y&&(delete u.__inittedArrays,delete u.__colorArray,delete u.__normalArray,delete u.__tangentArray,delete u.__uvArray,delete u.__uv2Array,delete u.__faceArray,delete u.__vertexArray,delete u.__lineArray,delete u.__skinVertexAArray,delete u.__skinVertexBArray,delete u.__skinIndexArray,delete u.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=
+!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(k)}else if(j instanceof THREE.Ribbon){h=j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=n.DYNAMIC_DRAW;m=B=y=y=void 0;w=j.vertices;o=j.colors;t=w.length;u=o.length;p=j.__vertexArray;H=j.__colorArray;x=j.__dirtyColors;if(j.__dirtyVertices){for(y=0;y<t;y++)B=w[y].position,m=y*3,p[m]=B.x,p[m+1]=B.y,p[m+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,k)}if(x){for(y=0;y<u;y++)color=o[y],m=y*3,H[m]=color.r,H[m+
+1]=color.g,H[m+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,j.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,H,k)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(j instanceof THREE.Line){h=j.geometry;if(h.__dirtyVertices||h.__dirtyColors){j=h;k=n.DYNAMIC_DRAW;m=B=y=y=void 0;w=j.vertices;o=j.colors;t=w.length;u=o.length;p=j.__vertexArray;H=j.__colorArray;x=j.__dirtyColors;if(j.__dirtyVertices){for(y=0;y<t;y++)B=w[y].position,m=y*3,p[m]=B.x,p[m+1]=B.y,p[m+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,j.__webglVertexBuffer);
+n.bufferData(n.ARRAY_BUFFER,p,k)}if(x){for(y=0;y<u;y++)color=o[y],m=y*3,H[m]=color.r,H[m+1]=color.g,H[m+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,j.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,H,k)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem)h=j.geometry,u=z(h),(h.__dirtyVertices||h.__dirtyColors||j.sortParticles||u)&&c(h,n.DYNAMIC_DRAW,j),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),
+b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=function(){return na}};
 THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
 THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
@@ -340,17 +340,17 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
 THREE.ColorUtils={adjustHSV:function(b,c,e,f){var h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,k=Math.max(Math.max(e,f),h),j=Math.min(Math.min(e,f),h);if(j==k)j=e=0;else{var m=k-j,j=m/k,e=e==k?(f-h)/m:f==k?2+(h-e)/m:4+(e-f)/m;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=j;c.v=k;return c},
 clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
-THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,k=b.vertices,j=h.vertices,m=b.faces,p=h.faces,o=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,v=j.length;t<v;t++){var w=new THREE.Vertex(j[t].position.clone());e&&c.matrix.multiplyVector3(w.position);k.push(w)}t=0;for(v=p.length;t<v;t++){var j=p[t],u,y,x=j.vertexNormals,w=j.vertexColors;j instanceof THREE.Face3?u=new THREE.Face3(j.a+f,j.b+f,j.c+
-f):j instanceof THREE.Face4&&(u=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));u.normal.copy(j.normal);e=0;for(k=x.length;e<k;e++)y=x[e],u.vertexNormals.push(y.clone());u.color.copy(j.color);e=0;for(k=w.length;e<k;e++)y=w[e],u.vertexColors.push(y.clone());u.materials=j.materials.slice();u.centroid.copy(j.centroid);m.push(u)}t=0;for(v=h.length;t<v;t++){f=h[t];m=[];e=0;for(k=f.length;e<k;e++)m.push(new THREE.UV(f[e].u,f[e].v));o.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,
-k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var j=new THREE.Vertex(f[b].position.clone());c.vertices.push(j)}b=0;for(e=h.length;b<e;b++){var m=h[b],p,o,t=m.vertexNormals,v=m.vertexColors;m instanceof THREE.Face3?p=new THREE.Face3(m.a,m.b,m.c):m instanceof THREE.Face4&&(p=new THREE.Face4(m.a,m.b,m.c,m.d));p.normal.copy(m.normal);f=0;for(j=t.length;f<j;f++)o=t[f],p.vertexNormals.push(o.clone());p.color.copy(m.color);f=0;for(j=v.length;f<j;f++)o=v[f],p.vertexColors.push(o.clone());p.materials=m.materials.slice();
+THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,h=e?c.geometry:c,k=b.vertices,j=h.vertices,m=b.faces,p=h.faces,o=b.faceVertexUvs[0],h=h.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,u=j.length;t<u;t++){var w=new THREE.Vertex(j[t].position.clone());e&&c.matrix.multiplyVector3(w.position);k.push(w)}t=0;for(u=p.length;t<u;t++){var j=p[t],v,y,x=j.vertexNormals,w=j.vertexColors;j instanceof THREE.Face3?v=new THREE.Face3(j.a+f,j.b+f,j.c+
+f):j instanceof THREE.Face4&&(v=new THREE.Face4(j.a+f,j.b+f,j.c+f,j.d+f));v.normal.copy(j.normal);e=0;for(k=x.length;e<k;e++)y=x[e],v.vertexNormals.push(y.clone());v.color.copy(j.color);e=0;for(k=w.length;e<k;e++)y=w[e],v.vertexColors.push(y.clone());v.materials=j.materials.slice();v.centroid.copy(j.centroid);m.push(v)}t=0;for(u=h.length;t<u;t++){f=h[t];m=[];e=0;for(k=f.length;e<k;e++)m.push(new THREE.UV(f[e].u,f[e].v));o.push(m)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,
+k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var j=new THREE.Vertex(f[b].position.clone());c.vertices.push(j)}b=0;for(e=h.length;b<e;b++){var m=h[b],p,o,t=m.vertexNormals,u=m.vertexColors;m instanceof THREE.Face3?p=new THREE.Face3(m.a,m.b,m.c):m instanceof THREE.Face4&&(p=new THREE.Face4(m.a,m.b,m.c,m.d));p.normal.copy(m.normal);f=0;for(j=t.length;f<j;f++)o=t[f],p.vertexNormals.push(o.clone());p.color.copy(m.color);f=0;for(j=u.length;f<j;f++)o=u[f],p.vertexColors.push(o.clone());p.materials=m.materials.slice();
 p.centroid.copy(m.centroid);c.faces.push(p)}b=0;for(e=k.length;b<e;b++){h=k[b];p=[];f=0;for(j=h.length;f<j;f++)p.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,h,k,j=new THREE.Vector3,m=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();f+h>1&&(f=1-f,h=1-h);k=1-f-h;j.copy(b);j.multiplyScalar(f);m.copy(c);m.multiplyScalar(h);j.addSelf(m);m.copy(e);m.multiplyScalar(k);j.addSelf(m);return j},randomPointInFace:function(b,
 c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,j;e?b._area1&&b._area2?(e=b._area1,j=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),j=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=j):(e=THREE.GeometryUtils.triangleArea(f,
-h,c),j=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+j)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var j=c+Math.floor((f-c)/2);return o[j]>b?e(c,j-1):o[j]<b?e(j+1,f):j}return e(0,o.length-1)}var f,h,k=b.faces,j=b.vertices,m=k.length,p=0,o=[],t,v,w,u;for(h=0;h<m;h++){f=k[h];if(f instanceof THREE.Face3)t=j[f.a].position,v=j[f.b].position,
-w=j[f.c].position,f._area=THREE.GeometryUtils.triangleArea(t,v,w);else if(f instanceof THREE.Face4)t=j[f.a].position,v=j[f.b].position,w=j[f.c].position,u=j[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(t,v,u),f._area2=THREE.GeometryUtils.triangleArea(v,w,u),f._area=f._area1+f._area2;p+=f._area;o[h]=p}f=[];j={};for(h=0;h<c;h++)m=THREE.GeometryUtils.random()*p,m=e(m),f[h]=THREE.GeometryUtils.randomPointInFace(k[m],b,!0),j[m]?j[m]+=1:j[m]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;
+h,c),j=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+j)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var j=c+Math.floor((f-c)/2);return o[j]>b?e(c,j-1):o[j]<b?e(j+1,f):j}return e(0,o.length-1)}var f,h,k=b.faces,j=b.vertices,m=k.length,p=0,o=[],t,u,w,v;for(h=0;h<m;h++){f=k[h];if(f instanceof THREE.Face3)t=j[f.a].position,u=j[f.b].position,
+w=j[f.c].position,f._area=THREE.GeometryUtils.triangleArea(t,u,w);else if(f instanceof THREE.Face4)t=j[f.a].position,u=j[f.b].position,w=j[f.c].position,v=j[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(t,u,v),f._area2=THREE.GeometryUtils.triangleArea(u,w,v),f._area=f._area1+f._area2;p+=f._area;o[h]=p}f=[];j={};for(h=0;h<c;h++)m=THREE.GeometryUtils.random()*p,m=e(m),f[h]=THREE.GeometryUtils.randomPointInFace(k[m],b,!0),j[m]?j[m]+=1:j[m]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;
 h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
 THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,h=new THREE.Texture(f,c);f.onload=function(){h.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return h},loadTextureCube:function(b,c,e){var f,h=[],k=new THREE.Texture(h,c),c=h.loadCount=0;for(f=b.length;c<f;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)k.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return k},getNormalMap:function(b,c){var e=function(b){var e=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
-b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,k=document.createElement("canvas");k.width=f;k.height=h;var j=k.getContext("2d");j.drawImage(b,0,0);for(var m=j.getImageData(0,0,f,h).data,p=j.createImageData(f,h),o=p.data,t=0;t<f;t++)for(var v=1;v<h;v++){var w=v-1<0?h-1:v-1,u=(v+1)%h,y=t-1<0?f-1:t-1,x=(t+1)%f,B=[],z=[0,0,m[(v*f+t)*4]/255*c];B.push([-1,0,m[(v*f+y)*4]/255*c]);B.push([-1,-1,m[(w*f+y)*4]/255*c]);B.push([0,-1,m[(w*f+t)*4]/255*c]);B.push([1,-1,m[(w*f+x)*4]/255*c]);
-B.push([1,0,m[(v*f+x)*4]/255*c]);B.push([1,1,m[(u*f+x)*4]/255*c]);B.push([0,1,m[(u*f+t)*4]/255*c]);B.push([-1,1,m[(u*f+y)*4]/255*c]);w=[];y=B.length;for(u=0;u<y;u++){var x=B[u],D=B[(u+1)%y],x=[x[0]-z[0],x[1]-z[1],x[2]-z[2]],D=[D[0]-z[0],D[1]-z[1],D[2]-z[2]];w.push(e([x[1]*D[2]-x[2]*D[1],x[2]*D[0]-x[0]*D[2],x[0]*D[1]-x[1]*D[0]]))}B=[0,0,0];for(u=0;u<w.length;u++)B[0]+=w[u][0],B[1]+=w[u][1],B[2]+=w[u][2];B[0]/=w.length;B[1]/=w.length;B[2]/=w.length;z=(v*f+t)*4;o[z]=(B[0]+1)/2*255|0;o[z+1]=(B[1]+0.5)*
+b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,k=document.createElement("canvas");k.width=f;k.height=h;var j=k.getContext("2d");j.drawImage(b,0,0);for(var m=j.getImageData(0,0,f,h).data,p=j.createImageData(f,h),o=p.data,t=0;t<f;t++)for(var u=1;u<h;u++){var w=u-1<0?h-1:u-1,v=(u+1)%h,y=t-1<0?f-1:t-1,x=(t+1)%f,B=[],z=[0,0,m[(u*f+t)*4]/255*c];B.push([-1,0,m[(u*f+y)*4]/255*c]);B.push([-1,-1,m[(w*f+y)*4]/255*c]);B.push([0,-1,m[(w*f+t)*4]/255*c]);B.push([1,-1,m[(w*f+x)*4]/255*c]);
+B.push([1,0,m[(u*f+x)*4]/255*c]);B.push([1,1,m[(v*f+x)*4]/255*c]);B.push([0,1,m[(v*f+t)*4]/255*c]);B.push([-1,1,m[(v*f+y)*4]/255*c]);w=[];y=B.length;for(v=0;v<y;v++){var x=B[v],D=B[(v+1)%y],x=[x[0]-z[0],x[1]-z[1],x[2]-z[2]],D=[D[0]-z[0],D[1]-z[1],D[2]-z[2]];w.push(e([x[1]*D[2]-x[2]*D[1],x[2]*D[0]-x[0]*D[2],x[0]*D[1]-x[1]*D[0]]))}B=[0,0,0];for(v=0;v<w.length;v++)B[0]+=w[v][0],B[1]+=w[v][1],B[2]+=w[v][2];B[0]/=w.length;B[1]/=w.length;B[2]/=w.length;z=(u*f+t)*4;o[z]=(B[0]+1)/2*255|0;o[z+1]=(B[1]+0.5)*
 255|0;o[z+2]=B[2]*255|0;o[z+3]=255}j.putImageData(p,0,0);return k}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
 if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
@@ -368,11 +368,11 @@ THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=
 THREE.Bone?h.skinMatrix:h.matrix;var k=h.animationCache.prevKey;h=h.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.scl=this.data.hierarchy[e].keys[0];h.pos=this.getNextKeyWith("pos",e,1);h.rot=this.getNextKeyWith("rot",e,1);h.scl=this.getNextKeyWith("scl",e,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,k,j,m,p,o,t=this.data.JIT.hierarchy,v,w;this.currentTime+=b*this.timeScale;w=this.currentTime;v=this.currentTime%=this.data.length;o=parseInt(Math.min(v*this.data.fps,this.data.length*this.data.fps),10);for(var u=0,y=this.hierarchy.length;u<y;u++)if(b=this.hierarchy[u],p=b.animationCache,this.JITCompile&&t[u][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=t[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
-!1):(b.matrix=t[u][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var x=0;x<3;x++){e=c[x];j=p.prevKey[e];m=p.nextKey[e];if(m.time<=w){if(v<w)if(this.loop){j=this.data.hierarchy[u].keys[0];for(m=this.getNextKeyWith(e,u,1);m.time<v;)j=m,m=this.getNextKeyWith(e,u,m.index+1)}else{this.stop();return}else{do j=m,m=this.getNextKeyWith(e,u,m.index+1);while(m.time<
-v)}p.prevKey[e]=j;p.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(v-j.time)/(m.time-j.time);h=j[e];k=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+u),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
-this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",u,m.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
-"rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&t[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(u=0;u<this.hierarchy.length;u++)t[u][o]=this.hierarchy[u]instanceof THREE.Bone?this.hierarchy[u].skinMatrix.clone():this.hierarchy[u].matrix.clone()}}};
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,k,j,m,p,o,t=this.data.JIT.hierarchy,u,w;this.currentTime+=b*this.timeScale;w=this.currentTime;u=this.currentTime%=this.data.length;o=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,y=this.hierarchy.length;v<y;v++)if(b=this.hierarchy[v],p=b.animationCache,this.JITCompile&&t[v][o]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=t[v][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
+!1):(b.matrix=t[v][o],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var x=0;x<3;x++){e=c[x];j=p.prevKey[e];m=p.nextKey[e];if(m.time<=w){if(u<w)if(this.loop){j=this.data.hierarchy[v].keys[0];for(m=this.getNextKeyWith(e,v,1);m.time<u;)j=m,m=this.getNextKeyWith(e,v,m.index+1)}else{this.stop();return}else{do j=m,m=this.getNextKeyWith(e,v,m.index+1);while(m.time<
+u)}p.prevKey[e]=j;p.nextKey[e]=m}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-j.time)/(m.time-j.time);h=j[e];k=m[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
+this.getPrevKeyWith("pos",v,j.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,m.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
+"rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&t[0][o]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)t[v][o]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
 THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,k,j,m,p,o;h=(b.length-1)*c;k=Math.floor(h);h-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];m=b[e[1]];p=b[e[2]];o=b[e[3]];e=h*h;j=h*e;f[0]=this.interpolate(k[0],m[0],p[0],o[0],h,e,j);f[1]=this.interpolate(k[1],m[1],p[1],o[1],h,e,j);f[2]=this.interpolate(k[2],m[2],p[2],o[2],h,e,j);return f};
 THREE.Animation.prototype.interpolate=function(b,c,e,f,h,k,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*k+b*h+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
 THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
@@ -406,13 +406,13 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec
 this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=
 document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
 this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,p=!1,o=1,t=0,v=0,w=0,u=0,y=0,x=window.innerWidth/2,B=window.innerHeight/2;this.update=
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*u),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(t>0||this.autoForward&&!(t<0)?1:t));this.translateX(b*v);this.translateY(b*w);p&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var h=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Matrix4,p=!1,o=1,t=0,u=0,w=0,v=0,y=0,x=window.innerWidth/2,B=window.innerHeight/2;this.update=
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*v),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(t>0||this.autoForward&&!(t<0)?1:t));this.translateX(b*u);this.translateY(b*w);p&&(this.roll+=this.rollSpeed*this.delta*o);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
 else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();j.copy(this.forward);k.set(0,1,0);h.cross(k,j).normalize();k.cross(j,h).normalize();this.matrix.n11=h.x;this.matrix.n12=k.x;this.matrix.n13=j.x;this.matrix.n21=h.y;this.matrix.n22=k.y;this.matrix.n23=j.y;this.matrix.n31=h.z;this.matrix.n32=k.z;this.matrix.n33=j.z;m.identity();m.n11=Math.cos(this.roll);m.n12=-Math.sin(this.roll);m.n21=Math.sin(this.roll);m.n22=Math.cos(this.roll);this.matrix.multiplySelf(m);
 this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
 this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){h.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);h.multiplyScalar(b);this.forward.subSelf(h);this.forward.normalize()};this.rotateVertically=function(b){k.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);k.multiplyScalar(b);this.forward.addSelf(k);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
-function(b){u=(b.clientX-x)/window.innerWidth;y=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:t=1;break;case 2:t=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:t=0;break;case 2:t=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:t=1;break;case 37:case 65:v=-1;break;
-case 40:case 83:t=-1;break;case 39:case 68:v=1;break;case 81:p=!0;o=1;break;case 69:p=!0;o=-1;break;case 82:w=1;break;case 70:w=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:t=0;break;case 37:case 65:v=0;break;case 40:case 83:t=0;break;case 39:case 68:v=0;break;case 81:p=!1;break;case 69:p=!1;break;case 82:w=0;break;case 70:w=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
+function(b){v=(b.clientX-x)/window.innerWidth;y=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:t=1;break;case 2:t=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:t=0;break;case 2:t=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:t=1;break;case 37:case 65:u=-1;break;
+case 40:case 83:t=-1;break;case 39:case 68:u=1;break;case 81:p=!0;o=1;break;case 69:p=!0;o=-1;break;case 82:w=1;break;case 70:w=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:t=0;break;case 37:case 65:u=0;break;case 40:case 83:t=0;break;case 39:case 68:u=0;break;case 81:p=!1;break;case 69:p=!1;break;case 82:w=0;break;case 70:w=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
 THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
 THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
 !1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,k=new THREE.Vector3,j=new THREE.Vector3,m=new THREE.Vector2,p=new THREE.Vector2,o=new THREE.Vector2,t=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
@@ -451,39 +451,39 @@ THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.sl
 THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,h,k){var j=Array.prototype.slice.call(arguments),m=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(m[m.length-2],m[m.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f),new THREE.Vector2(h,k)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:j})};
 THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b);this.curves.push(new THREE.SplineCurve(e));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};THREE.Path.prototype.arc=function(b,c,e,f,h,k){var j=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,h,k));this.actions.push({action:THREE.PathActions.ARC,args:j})};
 THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
-THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,k,j,m,p,o,t,v,w,u,y,x;f=0;for(h=this.actions.length;f<h;f++)switch(k=this.actions[f],j=k.action,k=k.args,j){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=k[2];p=k[3];v=k[0];w=k[1];e.length>0?(j=e[e.length-1],u=j.x,y=j.y):(j=this.actions[f-1].args,u=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b2(x,u,v,m),x=THREE.Shape.Utils.b2(x,y,w,
-p),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.BEZIER_CURVE_TO:m=k[4];p=k[5];v=k[0];w=k[1];o=k[2];t=k[3];e.length>0?(j=e[e.length-1],u=j.x,y=j.y):(j=this.actions[f-1].args,u=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b3(x,u,v,o,m),x=THREE.Shape.Utils.b3(x,y,w,t,p),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.CSPLINE_THRU:j=this.actions[f-1].args;j=[new THREE.Vector2(j[j.length-2],j[j.length-1])];x=b*k[0].length;j=j.concat(k[0]);k=new THREE.SplineCurve(j);
-for(j=1;j<=x;j++)e.push(k.getPointAt(j/x));break;case THREE.PathActions.ARC:j=this.actions[f-1].args;m=k[0];p=k[1];o=k[2];v=k[3];x=k[4];w=!!k[5];t=j[j.length-2];u=j[j.length-1];j.length==0&&(t=u=0);y=x-v;var B=b*2;for(j=1;j<=B;j++)x=j/B,w||(x=1-x),x=v+x*y,k=t+m+o*Math.cos(x),x=u+p+o*Math.sin(x),e.push(new THREE.Vector2(k,x))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)};
-THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var j=this.getPoints(),m,p,o,t,v;m=0;for(p=j.length;m<p;m++)o=j[m],t=o.x,v=o.y,o.x=b*t+c*v+e,o.y=f*v+h*t+k;return j};
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,k,j,m,p,o,t,u,w,v,y,x;f=0;for(h=this.actions.length;f<h;f++)switch(k=this.actions[f],j=k.action,k=k.args,j){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:m=k[2];p=k[3];u=k[0];w=k[1];e.length>0?(j=e[e.length-1],v=j.x,y=j.y):(j=this.actions[f-1].args,v=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b2(x,v,u,m),x=THREE.Shape.Utils.b2(x,y,w,
+p),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.BEZIER_CURVE_TO:m=k[4];p=k[5];u=k[0];w=k[1];o=k[2];t=k[3];e.length>0?(j=e[e.length-1],v=j.x,y=j.y):(j=this.actions[f-1].args,v=j[j.length-2],y=j[j.length-1]);for(j=1;j<=b;j++)x=j/b,k=THREE.Shape.Utils.b3(x,v,u,o,m),x=THREE.Shape.Utils.b3(x,y,w,t,p),e.push(new THREE.Vector2(k,x));break;case THREE.PathActions.CSPLINE_THRU:j=this.actions[f-1].args;j=[new THREE.Vector2(j[j.length-2],j[j.length-1])];x=b*k[0].length;j=j.concat(k[0]);k=new THREE.SplineCurve(j);
+for(j=1;j<=x;j++)e.push(k.getPointAt(j/x));break;case THREE.PathActions.ARC:j=this.actions[f-1].args;m=k[0];p=k[1];o=k[2];u=k[3];x=k[4];w=!!k[5];t=j[j.length-2];v=j[j.length-1];j.length==0&&(t=v=0);y=x-u;var B=b*2;for(j=1;j<=B;j++)x=j/B,w||(x=1-x),x=u+x*y,k=t+m+o*Math.cos(x),x=v+p+o*Math.sin(x),e.push(new THREE.Vector2(k,x))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)};
+THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var j=this.getPoints(),m,p,o,t,u;m=0;for(p=j.length;m<p;m++)o=j[m],t=o.x,u=o.y,o.x=b*t+c*u+e,o.y=f*u+h*t+k;return j};
 THREE.Path.prototype.debug=function(b){var c=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,h,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],h=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";f=
 this.getPoints();b=0;for(e=f.length;b<e;b++)h=f[b],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
 THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],k=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&k.actions.length!=0&&(h.push(k),k=new THREE.Path),k[e].apply(k,f);k.actions.length!=0&&h.push(k);if(h.length==0)return[];var j,k=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(j&&k.push(j),j=new THREE.Shape,j.actions=f.actions,j.curves=
 f.curves):j.holes.push(f);k.push(j)}else{j=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(j.actions=f.actions,j.curves=f.curves,k.push(j),j=new THREE.Shape):j.holes.push(f)}return k};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(b){return new THREE.ExtrudeGeometry(this,b)};
 THREE.Shape.prototype.getPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedPoints(b,this.bends);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedSpacedPoints(b,this.bends);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};
 THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,j,m,p,o,t,v,w,u,y=[];for(p=0;p<c.length;p++){o=c[p];f=f.concat(o);k=Number.POSITIVE_INFINITY;for(h=0;h<o.length;h++){w=o[h];u=[];for(v=0;v<e.length;v++)t=e[v],t=w.distanceToSquared(t),u.push(t),t<k&&(k=t,j=h,m=v)}h=m-1>=0?m-1:e.length-1;k=j-1>=0?j-1:o.length-1;var x=[o[j],e[m],e[h]];v=THREE.FontUtils.Triangulate.area(x);var B=[o[j],o[k],e[m]];w=THREE.FontUtils.Triangulate.area(B);u=m;t=j;m+=1;j+=-1;m<0&&(m+=e.length);m%=
-e.length;j<0&&(j+=o.length);j%=o.length;h=m-1>=0?m-1:e.length-1;k=j-1>=0?j-1:o.length-1;x=[o[j],e[m],e[h]];x=THREE.FontUtils.Triangulate.area(x);B=[o[j],o[k],e[m]];B=THREE.FontUtils.Triangulate.area(B);v+w>x+B&&(m=u,j=t,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=o.length),j%=o.length,h=m-1>=0?m-1:e.length-1,k=j-1>=0?j-1:o.length-1);v=e.slice(0,m);w=e.slice(m);u=o.slice(j);t=o.slice(0,j);k=[o[j],o[k],e[m]];y.push([o[j],e[m],e[h]]);y.push(k);e=v.concat(u).concat(t).concat(w)}return{shape:e,isolatedPts:y,
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,j,m,p,o,t,u,w,v,y=[];for(p=0;p<c.length;p++){o=c[p];f=f.concat(o);k=Number.POSITIVE_INFINITY;for(h=0;h<o.length;h++){w=o[h];v=[];for(u=0;u<e.length;u++)t=e[u],t=w.distanceToSquared(t),v.push(t),t<k&&(k=t,j=h,m=u)}h=m-1>=0?m-1:e.length-1;k=j-1>=0?j-1:o.length-1;var x=[o[j],e[m],e[h]];u=THREE.FontUtils.Triangulate.area(x);var B=[o[j],o[k],e[m]];w=THREE.FontUtils.Triangulate.area(B);v=m;t=j;m+=1;j+=-1;m<0&&(m+=e.length);m%=
+e.length;j<0&&(j+=o.length);j%=o.length;h=m-1>=0?m-1:e.length-1;k=j-1>=0?j-1:o.length-1;x=[o[j],e[m],e[h]];x=THREE.FontUtils.Triangulate.area(x);B=[o[j],o[k],e[m]];B=THREE.FontUtils.Triangulate.area(B);u+w>x+B&&(m=v,j=t,m<0&&(m+=e.length),m%=e.length,j<0&&(j+=o.length),j%=o.length,h=m-1>=0?m-1:e.length-1,k=j-1>=0?j-1:o.length-1);u=e.slice(0,m);w=e.slice(m);v=o.slice(j);t=o.slice(0,j);k=[o[j],o[k],e[m]];y.push([o[j],e[m],e[h]]);y.push(k);e=u.concat(v).concat(t).concat(w)}return{shape:e,isolatedPts:y,
 allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,j,m,p,o={};k=0;for(j=f.length;k<j;k++)p=f[k].x+":"+f[k].y,o[p]!==void 0&&console.log("Duplicate point",p),o[p]=k;k=0;for(j=e.length;k<j;k++){m=e[k];for(f=0;f<3;f++)p=m[f].x+":"+m[f].y,p=o[p],p!==void 0&&(m[f]=p)}k=0;for(j=h.length;k<j;k++){m=h[k];for(f=0;f<3;f++)p=m[f].x+":"+m[f].y,p=o[p],p!==void 0&&(m[f]=p)}return e.concat(h)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<
 0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,h){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,h)}};
 THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",h=c.weight!==void 0?c.weight:"normal",k=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=h;THREE.FontUtils.style=k};
 THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
-THREE.CubeGeometry=function(b,c,e,f,h,k,j,m,p){function o(b,c,e,j,m,o,p,u){var v,w,x=f||1,y=h||1,M=m/2,L=o/2,S=t.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")v="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")v="y",y=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")v="x",x=k||1;var n=x+1,V=y+1;m/=x;var fa=o/y;for(w=0;w<V;w++)for(o=0;o<n;o++){var Q=new THREE.Vector3;Q[b]=(o*m-M)*e;Q[c]=(w*fa-L)*j;Q[v]=p;t.vertices.push(new THREE.Vertex(Q))}for(w=0;w<y;w++)for(o=0;o<x;o++)t.faces.push(new THREE.Face4(o+n*
-w+S,o+n*(w+1)+S,o+1+n*(w+1)+S,o+1+n*w+S,null,null,u)),t.faceVertexUvs[0].push([new THREE.UV(o/x,w/y),new THREE.UV(o/x,(w+1)/y),new THREE.UV((o+1)/x,(w+1)/y),new THREE.UV((o+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,v=b/2,w=c/2,u=e/2,m=m?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var x in p)this.sides[x]!=void 0&&(this.sides[x]=
-p[x]);this.sides.px&&o("z","y",1*m,-1,e,c,-v,this.materials[0]);this.sides.nx&&o("z","y",-1*m,-1,e,c,v,this.materials[1]);this.sides.py&&o("x","z",1*m,1,b,e,w,this.materials[2]);this.sides.ny&&o("x","z",1*m,-1,b,e,-w,this.materials[3]);this.sides.pz&&o("x","y",1*m,-1,b,c,u,this.materials[4]);this.sides.nz&&o("x","y",-1*m,-1,b,c,-u,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=t.vertices.length;e<f;e++){for(var j=t.vertices[e],h=!1,k=0,m=b.length;k<m;k++){var o=b[k];if(j.position.x==o.position.x&&
+THREE.CubeGeometry=function(b,c,e,f,h,k,j,m,p){function o(b,c,e,j,m,o,u,p){var v,w,x=f||1,y=h||1,M=m/2,L=o/2,P=t.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")v="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")v="y",y=k||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")v="x",x=k||1;var n=x+1,X=y+1;m/=x;var la=o/y;for(w=0;w<X;w++)for(o=0;o<n;o++){var R=new THREE.Vector3;R[b]=(o*m-M)*e;R[c]=(w*la-L)*j;R[v]=u;t.vertices.push(new THREE.Vertex(R))}for(w=0;w<y;w++)for(o=0;o<x;o++)t.faces.push(new THREE.Face4(o+n*
+w+P,o+n*(w+1)+P,o+1+n*(w+1)+P,o+1+n*w+P,null,null,p)),t.faceVertexUvs[0].push([new THREE.UV(o/x,w/y),new THREE.UV(o/x,(w+1)/y),new THREE.UV((o+1)/x,(w+1)/y),new THREE.UV((o+1)/x,w/y)])}THREE.Geometry.call(this);var t=this,u=b/2,w=c/2,v=e/2,m=m?-1:1;if(j!==void 0)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var x in p)this.sides[x]!=void 0&&(this.sides[x]=
+p[x]);this.sides.px&&o("z","y",1*m,-1,e,c,-u,this.materials[0]);this.sides.nx&&o("z","y",-1*m,-1,e,c,u,this.materials[1]);this.sides.py&&o("x","z",1*m,1,b,e,w,this.materials[2]);this.sides.ny&&o("x","z",1*m,-1,b,e,-w,this.materials[3]);this.sides.pz&&o("x","y",1*m,-1,b,c,v,this.materials[4]);this.sides.nz&&o("x","y",-1*m,-1,b,c,-v,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=t.vertices.length;e<f;e++){for(var j=t.vertices[e],h=!1,k=0,m=b.length;k<m;k++){var o=b[k];if(j.position.x==o.position.x&&
 j.position.y==o.position.y&&j.position.z==o.position.z){c[e]=k;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(j.position.clone()))}e=0;for(f=t.faces.length;e<f;e++)j=t.faces[e],j.a=c[j.a],j.b=c[j.b],j.c=c[j.c],j.d=c[j.d];t.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
-THREE.CylinderGeometry=function(b,c,e,f,h,k){function j(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,p,o=Math.PI*2,t=f/2;for(p=0;p<b;p++)j(Math.sin(o*p/b)*c,Math.cos(o*p/b)*c,-t);for(p=0;p<b;p++)j(Math.sin(o*p/b)*e,Math.cos(o*p/b)*e,t);var v,w,u,y,x=c-e;for(p=0;p<b;p++)v=new THREE.Vector3,v.copy(m.vertices[p].position),v.z=x,v.normalize(),w=new THREE.Vector3,w.copy(m.vertices[p+b].position),w.z=x,w.normalize(),u=new THREE.Vector3,u.copy(m.vertices[b+
-(p+1)%b].position),u.z=x,u.normalize(),y=new THREE.Vector3,y.copy(m.vertices[(p+1)%b].position),y.z=x,y.normalize(),m.faces.push(new THREE.Face4(p,p+b,b+(p+1)%b,(p+1)%b,[v,w,u,y]));if(e>0){e=new THREE.Vector3(0,0,-1);j(0,0,-t-(k||0));for(p=b;p<b+b/2;p++)m.faces.push(new THREE.Face4(2*b,(2*p-2*b)%b,(2*p-2*b+1)%b,(2*p-2*b+2)%b,[e,e,e,e]))}if(c>0){c=new THREE.Vector3(0,0,1);j(0,0,t+(h||0));for(p=b+b/2;p<2*b;p++)m.faces.push(new THREE.Face4(2*b+1,(2*p-2*b+2)%b+b,(2*p-2*b+1)%b+b,(2*p-2*b)%b+b,[c,c,c,c]))}p=
-0;for(b=this.faces.length;p<b;p++)h=[],t=this.faces[p],c=this.vertices[t.a],k=this.vertices[t.b],e=this.vertices[t.c],v=this.vertices[t.d],h.push(new THREE.UV(0.5+Math.atan2(c.position.x,c.position.y)/o,0.5+c.position.z/f)),h.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/o,0.5+k.position.z/f)),h.push(new THREE.UV(0.5+Math.atan2(e.position.x,e.position.y)/o,0.5+e.position.z/f)),t instanceof THREE.Face4&&h.push(new THREE.UV(0.5+Math.atan2(v.position.x,v.position.y)/o,0.5+v.position.z/
+THREE.CylinderGeometry=function(b,c,e,f,h,k){function j(b,c,e){m.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var m=this,p,o=Math.PI*2,t=f/2;for(p=0;p<b;p++)j(Math.sin(o*p/b)*c,Math.cos(o*p/b)*c,-t);for(p=0;p<b;p++)j(Math.sin(o*p/b)*e,Math.cos(o*p/b)*e,t);var u,w,v,y,x=c-e;for(p=0;p<b;p++)u=new THREE.Vector3,u.copy(m.vertices[p].position),u.z=x,u.normalize(),w=new THREE.Vector3,w.copy(m.vertices[p+b].position),w.z=x,w.normalize(),v=new THREE.Vector3,v.copy(m.vertices[b+
+(p+1)%b].position),v.z=x,v.normalize(),y=new THREE.Vector3,y.copy(m.vertices[(p+1)%b].position),y.z=x,y.normalize(),m.faces.push(new THREE.Face4(p,p+b,b+(p+1)%b,(p+1)%b,[u,w,v,y]));if(e>0){e=new THREE.Vector3(0,0,-1);j(0,0,-t-(k||0));for(p=b;p<b+b/2;p++)m.faces.push(new THREE.Face4(2*b,(2*p-2*b)%b,(2*p-2*b+1)%b,(2*p-2*b+2)%b,[e,e,e,e]))}if(c>0){c=new THREE.Vector3(0,0,1);j(0,0,t+(h||0));for(p=b+b/2;p<2*b;p++)m.faces.push(new THREE.Face4(2*b+1,(2*p-2*b+2)%b+b,(2*p-2*b+1)%b+b,(2*p-2*b)%b+b,[c,c,c,c]))}p=
+0;for(b=this.faces.length;p<b;p++)h=[],t=this.faces[p],c=this.vertices[t.a],k=this.vertices[t.b],e=this.vertices[t.c],u=this.vertices[t.d],h.push(new THREE.UV(0.5+Math.atan2(c.position.x,c.position.y)/o,0.5+c.position.z/f)),h.push(new THREE.UV(0.5+Math.atan2(k.position.x,k.position.y)/o,0.5+k.position.z/f)),h.push(new THREE.UV(0.5+Math.atan2(e.position.x,e.position.y)/o,0.5+e.position.z/f)),t instanceof THREE.Face4&&h.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/o,0.5+u.position.z/
 f)),this.faceVertexUvs[0].push(h);this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};
 THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
 THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,j=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,k=THREE.ExtrudeGeometry.__v4,m=THREE.ExtrudeGeometry.__v5,n=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);j.set(b.x-e.x,b.y-e.y);f=f.normalize();j=j.normalize();h.set(-f.y,f.x);k.set(j.y,-j.x);m.copy(b).addSelf(h);n.copy(b).addSelf(k);if(m.equals(n))return k.clone();
-m.copy(c).addSelf(h);n.copy(e).addSelf(k);h=f.dot(k);k=n.subSelf(m).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 c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(k).addSelf(m).subSelf(b).clone()}function h(b){for(G=b.length;--G>=0;){aa=G;ja=G-1;ja<0&&(ja=b.length-
-1);for(var c=0,e=u+t*2,c=0;c<e;c++){var f=fa*c,j=fa*(c+1),h=ha+aa+f,k=ha+aa+j,n=h,f=ha+ja+f,j=ha+ja+j,o=k;n+=Y;f+=Y;j+=Y;o+=Y;F.faces.push(new THREE.Face4(n,f,j,o,null,null,E));E&&(n=c/e,f=(c+1)/e,j=m+p*2,h=(F.vertices[h].position.z+p)/j,k=(F.vertices[k].position.z+p)/j,F.faceVertexUvs[0].push([new THREE.UV(h,n),new THREE.UV(k,n),new THREE.UV(k,f),new THREE.UV(h,f)]))}}}function k(b,c,e){F.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function j(b,c,e){b+=Y;c+=Y;e+=Y;F.faces.push(new THREE.Face3(b,
-c,e,null,null,C));if(C){var f=J.maxY,j=J.maxX,h=F.vertices[c].position.x,c=F.vertices[c].position.y,k=F.vertices[e].position.x,e=F.vertices[e].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[b].position.x/j,F.vertices[b].position.y/f),new THREE.UV(h/j,c/f),new THREE.UV(k/j,e/f)])}}var m=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,o=c.bevelSize!==void 0?c.bevelSize:p-2,t=c.bevelSegments!==void 0?c.bevelSegments:3,v=c.bevelEnabled!==void 0?c.bevelEnabled:
-!0,w=c.curveSegments!==void 0?c.curveSegments:12,u=c.steps!==void 0?c.steps:1,y=c.bendPath,x=c.extrudePath,B,z=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,E=c.extrudeMaterial,J=this.shapebb;if(x)B=x.getPoints(w),u=B.length,z=!0,v=!1;v||(o=p=t=0);var O,K,I,F=this,Y=this.vertices.length;y&&b.addWrapPath(y);w=D?b.extractAllSpacedPoints(w):b.extractAllPoints(w);y=w.shape;w=w.holes;if(x=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(I=w.length;K<I;K++)O=w[K],THREE.Shape.Utils.isClockWise(O)&&
-(w[K]=O.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,w);D=y;K=0;for(I=w.length;K<I;K++)O=w[K],y=y.concat(O);var G,M,L,S,n,V,fa=y.length,Q=x.length,da=[];G=0;M=D.length;aa=M-1;for(ja=G+1;G<M;G++,aa++,ja++)aa==M&&(aa=0),ja==M&&(ja=0),da[G]=f(D[G],D[aa],D[ja]);var $=[],ka,U=da.concat();K=0;for(I=w.length;K<I;K++){O=w[K];ka=[];G=0;M=O.length;aa=M-1;for(ja=G+1;G<M;G++,aa++,ja++)aa==M&&(aa=0),ja==M&&(ja=0),ka[G]=f(O[G],O[aa],O[ja]);$.push(ka);U=U.concat(ka)}for(L=0;L<t;L++){S=L/t;n=p*(1-S);S=
-o*Math.sin(S*Math.PI/2);G=0;for(M=D.length;G<M;G++)V=e(D[G],da[G],S),k(V.x,V.y,-n);K=0;for(I=w.length;K<I;K++){O=w[K];ka=$[K];G=0;for(M=O.length;G<M;G++)V=e(O[G],ka[G],S),k(V.x,V.y,-n)}}S=o;for(G=0;G<fa;G++)V=v?e(y[G],U[G],S):y[G],z?k(V.x,V.y+B[0].y,B[0].x):k(V.x,V.y,0);for(L=1;L<=u;L++)for(G=0;G<fa;G++)V=v?e(y[G],U[G],S):y[G],z?k(V.x,V.y+B[L-1].y,B[L-1].x):k(V.x,V.y,m/u*L);for(L=t-1;L>=0;L--){S=L/t;n=p*(1-S);S=o*Math.sin(S*Math.PI/2);G=0;for(M=D.length;G<M;G++)V=e(D[G],da[G],S),k(V.x,V.y,m+n);K=
-0;for(I=w.length;K<I;K++){O=w[K];ka=$[K];G=0;for(M=O.length;G<M;G++)V=e(O[G],ka[G],S),z?k(V.x,V.y+B[u-1].y,B[u-1].x+n):k(V.x,V.y,m+n)}}if(v){v=fa*0;for(G=0;G<Q;G++)o=x[G],j(o[2]+v,o[1]+v,o[0]+v);v=fa*(u+t*2);for(G=0;G<Q;G++)o=x[G],j(o[0]+v,o[1]+v,o[2]+v)}else{for(G=0;G<Q;G++)o=x[G],j(o[2],o[1],o[0]);for(G=0;G<Q;G++)o=x[G],j(o[0]+fa*u,o[1]+fa*u,o[2]+fa*u)}var aa,ja,ha=0;h(D);ha+=D.length;K=0;for(I=w.length;K<I;K++)O=w[K],h(O),ha+=O.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
+m.copy(c).addSelf(h);n.copy(e).addSelf(k);h=f.dot(k);k=n.subSelf(m).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 c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(k).addSelf(m).subSelf(b).clone()}function h(b){for(G=b.length;--G>=0;){ha=G;ka=G-1;ka<0&&(ka=b.length-
+1);for(var c=0,e=v+t*2,c=0;c<e;c++){var f=la*c,j=la*(c+1),h=$+ha+f,k=$+ha+j,n=h,f=$+ka+f,j=$+ka+j,o=k;n+=T;f+=T;j+=T;o+=T;F.faces.push(new THREE.Face4(n,f,j,o,null,null,E));E&&(n=c/e,f=(c+1)/e,j=m+p*2,h=(F.vertices[h].position.z+p)/j,k=(F.vertices[k].position.z+p)/j,F.faceVertexUvs[0].push([new THREE.UV(h,n),new THREE.UV(k,n),new THREE.UV(k,f),new THREE.UV(h,f)]))}}}function k(b,c,e){F.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function j(b,c,e){b+=T;c+=T;e+=T;F.faces.push(new THREE.Face3(b,
+c,e,null,null,C));if(C){var f=J.maxY,j=J.maxX,h=F.vertices[c].position.x,c=F.vertices[c].position.y,k=F.vertices[e].position.x,e=F.vertices[e].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[b].position.x/j,F.vertices[b].position.y/f),new THREE.UV(h/j,c/f),new THREE.UV(k/j,e/f)])}}var m=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,o=c.bevelSize!==void 0?c.bevelSize:p-2,t=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:
+!0,w=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,y=c.bendPath,x=c.extrudePath,B,z=!1,D=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,E=c.extrudeMaterial,J=this.shapebb;if(x)B=x.getPoints(w),v=B.length,z=!0,u=!1;u||(o=p=t=0);var O,K,H,F=this,T=this.vertices.length;y&&b.addWrapPath(y);w=D?b.extractAllSpacedPoints(w):b.extractAllPoints(w);y=w.shape;w=w.holes;if(x=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(H=w.length;K<H;K++)O=w[K],THREE.Shape.Utils.isClockWise(O)&&
+(w[K]=O.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(y,w);D=y;K=0;for(H=w.length;K<H;K++)O=w[K],y=y.concat(O);var G,M,L,P,n,X,la=y.length,R=x.length,ga=[];G=0;M=D.length;ha=M-1;for(ka=G+1;G<M;G++,ha++,ka++)ha==M&&(ha=0),ka==M&&(ka=0),ga[G]=f(D[G],D[ha],D[ka]);var Z=[],da,ca=ga.concat();K=0;for(H=w.length;K<H;K++){O=w[K];da=[];G=0;M=O.length;ha=M-1;for(ka=G+1;G<M;G++,ha++,ka++)ha==M&&(ha=0),ka==M&&(ka=0),da[G]=f(O[G],O[ha],O[ka]);Z.push(da);ca=ca.concat(da)}for(L=0;L<t;L++){P=L/t;n=p*(1-P);
+P=o*Math.sin(P*Math.PI/2);G=0;for(M=D.length;G<M;G++)X=e(D[G],ga[G],P),k(X.x,X.y,-n);K=0;for(H=w.length;K<H;K++){O=w[K];da=Z[K];G=0;for(M=O.length;G<M;G++)X=e(O[G],da[G],P),k(X.x,X.y,-n)}}P=o;for(G=0;G<la;G++)X=u?e(y[G],ca[G],P):y[G],z?k(X.x,X.y+B[0].y,B[0].x):k(X.x,X.y,0);for(L=1;L<=v;L++)for(G=0;G<la;G++)X=u?e(y[G],ca[G],P):y[G],z?k(X.x,X.y+B[L-1].y,B[L-1].x):k(X.x,X.y,m/v*L);for(L=t-1;L>=0;L--){P=L/t;n=p*(1-P);P=o*Math.sin(P*Math.PI/2);G=0;for(M=D.length;G<M;G++)X=e(D[G],ga[G],P),k(X.x,X.y,m+n);
+K=0;for(H=w.length;K<H;K++){O=w[K];da=Z[K];G=0;for(M=O.length;G<M;G++)X=e(O[G],da[G],P),z?k(X.x,X.y+B[v-1].y,B[v-1].x+n):k(X.x,X.y,m+n)}}if(u){u=la*0;for(G=0;G<R;G++)o=x[G],j(o[2]+u,o[1]+u,o[0]+u);u=la*(v+t*2);for(G=0;G<R;G++)o=x[G],j(o[0]+u,o[1]+u,o[2]+u)}else{for(G=0;G<R;G++)o=x[G],j(o[2],o[1],o[0]);for(G=0;G<R;G++)o=x[G],j(o[0]+la*v,o[1]+la*v,o[2]+la*v)}var ha,ka,$=0;h(D);$+=D.length;K=0;for(H=w.length;K<H;K++)O=w[K],h(O),$+=O.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
 THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
 THREE.IcosahedronGeometry=function(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=h.vertices[b].position,j=h.vertices[e].position;return c((f.x+j.x)/2,(f.y+j.y)/2,(f.z+j.z)/2)}var h=this,k=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
 -b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var j=0;j<this.subdivisions;j++){var b=new THREE.Geometry,m;for(m in k.faces){var p=f(k.faces[m].a,k.faces[m].b),o=f(k.faces[m].b,k.faces[m].c),t=f(k.faces[m].c,k.faces[m].a);e(k.faces[m].a,p,t,b);e(k.faces[m].b,o,
@@ -492,19 +492,19 @@ THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;t
 for(m=0;m<f.length-1;m++)this.faces.push(new THREE.Face4(h[m],h[m+1],f[m+1],f[m])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,m/b.length),new THREE.UV(1-p/this.angle,(m+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(m+1)/b.length),new THREE.UV(1-(p-c)/this.angle,m/b.length)]);f=h;h=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
 THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,k=b/2,j=c/2,e=e||1,f=f||1,m=e+1,p=f+1;b/=e;var o=c/f;for(h=0;h<p;h++)for(c=0;c<m;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(h*o-j),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+m*h,c+m*(h+1),c+1+m*(h+1),c+1+m*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/f)]);this.computeCentroids();this.computeFaceNormals()};
 THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,k=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e<j+1;e++){f=e/j;var m=b*Math.cos(f*h),p=b*Math.sin(f*h),o=[],t=0;for(f=0;f<k;f++){var v=2*f/k,w=p*Math.sin(v*h),v=p*Math.cos(v*h);(e==0||e==j)&&f>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(v,m,w)))-1);o.push(t)}c.push(o)}for(var u,y,x,h=c.length,e=0;e<h;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){o=f==k-1;j=c[e][o?0:f+1];m=c[e][o?k-1:f];p=c[e-1][o?
-k-1:f];o=c[e-1][o?0:f+1];w=e/(h-1);u=(e-1)/(h-1);y=(f+1)/k;var v=f/k,t=new THREE.UV(1-y,w),w=new THREE.UV(1-v,w),v=new THREE.UV(1-v,u),B=new THREE.UV(1-y,u);e<c.length-1&&(u=this.vertices[j].position.clone(),y=this.vertices[m].position.clone(),x=this.vertices[p].position.clone(),u.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,w,v]));e>1&&(u=
-this.vertices[j].position.clone(),y=this.vertices[p].position.clone(),x=this.vertices[o].position.clone(),u.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,p,o,[new THREE.Vector3(u.x,u.y,u.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,v,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,k=Math.max(3,c||8),j=Math.max(2,e||6),c=[],e=0;e<j+1;e++){f=e/j;var m=b*Math.cos(f*h),p=b*Math.sin(f*h),o=[],t=0;for(f=0;f<k;f++){var u=2*f/k,w=p*Math.sin(u*h),u=p*Math.cos(u*h);(e==0||e==j)&&f>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,m,w)))-1);o.push(t)}c.push(o)}for(var v,y,x,h=c.length,e=0;e<h;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){o=f==k-1;j=c[e][o?0:f+1];m=c[e][o?k-1:f];p=c[e-1][o?
+k-1:f];o=c[e-1][o?0:f+1];w=e/(h-1);v=(e-1)/(h-1);y=(f+1)/k;var u=f/k,t=new THREE.UV(1-y,w),w=new THREE.UV(1-u,w),u=new THREE.UV(1-u,v),B=new THREE.UV(1-y,v);e<c.length-1&&(v=this.vertices[j].position.clone(),y=this.vertices[m].position.clone(),x=this.vertices[p].position.clone(),v.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,m,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,w,u]));e>1&&(v=
+this.vertices[j].position.clone(),y=this.vertices[p].position.clone(),x=this.vertices[o].position.clone(),v.normalize(),y.normalize(),x.normalize(),this.faces.push(new THREE.Face3(j,p,o,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([t,u,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
 THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
 THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
 THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
 THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
-this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,j=[],b=0;b<k;b++){var m=new THREE.Path,m=this.extractGlyphPoints(h[b],c,e,f,m);f+=m.offset;j.push(m.path)}return{paths:j,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],j,m,p,o,t,v,w,u,y,x,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));p=c.length;for(b=0;b<p;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;o=c[b++]*e;k.push(new THREE.Vector2(m,
-o));h.moveTo(m,o);break;case "l":m=c[b++]*e+f;o=c[b++]*e;k.push(new THREE.Vector2(m,o));h.lineTo(m,o);break;case "q":m=c[b++]*e+f;o=c[b++]*e;w=c[b++]*e+f;u=c[b++]*e;h.quadraticCurveTo(w,u,m,o);if(j=k[k.length-1]){t=j.x;v=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++){var z=j/divisions,D=THREE.Shape.Utils.b2(z,t,w,m),z=THREE.Shape.Utils.b2(z,v,u,o);k.push(new THREE.Vector2(D,z))}}break;case "b":if(m=c[b++]*e+f,o=c[b++]*e,w=c[b++]*e+f,u=c[b++]*-e,y=c[b++]*e+f,x=c[b++]*-e,h.bezierCurveTo(m,o,
-w,u,y,x),j=k[k.length-1]){t=j.x;v=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++)z=j/divisions,D=THREE.Shape.Utils.b3(z,t,w,y,m),z=THREE.Shape.Utils.b3(z,v,u,x,o),k.push(new THREE.Vector2(D,z))}}}return{offset:B.ha*e,points:k,path:h}}}};
-(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,j=0;j<c;k=j++)h+=b[k].x*b[j].y-b[j].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],j=[],m=[],p,o,t;if(c(b)>0)for(o=0;o<h;o++)j[o]=o;else for(o=0;o<h;o++)j[o]=h-1-o;var v=2*h;for(o=h-1;h>2;){if(v--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}p=o;h<=p&&(p=0);o=p+1;h<=o&&(o=0);t=o+1;h<=t&&(t=0);var w;a:{w=b;var u=p,y=o,x=t,B=h,z=j,D=void 0,C=void 0,E=void 0,
-J=void 0,O=void 0,K=void 0,I=void 0,F=void 0,Y=void 0,C=w[z[u]].x,E=w[z[u]].y,J=w[z[y]].x,O=w[z[y]].y,K=w[z[x]].x,I=w[z[x]].y;if(1.0E-10>(J-C)*(I-E)-(O-E)*(K-C))w=!1;else{for(D=0;D<B;D++)if(!(D==u||D==y||D==x)){var F=w[z[D]].x,Y=w[z[D]].y,G=void 0,M=void 0,L=void 0,S=void 0,n=void 0,V=void 0,fa=void 0,Q=void 0,da=void 0,$=void 0,ka=void 0,U=void 0,G=L=n=void 0,G=K-J,M=I-O,L=C-K,S=E-I,n=J-C,V=O-E,fa=F-C,Q=Y-E,da=F-J,$=Y-O,ka=F-K,U=Y-I,G=G*$-M*da,n=n*Q-V*fa,L=L*U-S*ka;if(G>=0&&L>=0&&n>=0){w=!1;break a}}w=
-!0}}if(w){k.push([b[j[p]],b[j[o]],b[j[t]]]);m.push([j[p],j[o],j[t]]);p=o;for(t=o+1;t<h;p++,t++)j[p]=j[t];h--;v=2*h}}if(f)return m;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
+this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,j=[],b=0;b<k;b++){var m=new THREE.Path,m=this.extractGlyphPoints(h[b],c,e,f,m);f+=m.offset;j.push(m.path)}return{paths:j,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],j,m,p,o,t,u,w,v,y,x,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));p=c.length;for(b=0;b<p;)switch(m=c[b++],m){case "m":m=c[b++]*e+f;o=c[b++]*e;k.push(new THREE.Vector2(m,
+o));h.moveTo(m,o);break;case "l":m=c[b++]*e+f;o=c[b++]*e;k.push(new THREE.Vector2(m,o));h.lineTo(m,o);break;case "q":m=c[b++]*e+f;o=c[b++]*e;w=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(w,v,m,o);if(j=k[k.length-1]){t=j.x;u=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++){var z=j/divisions,D=THREE.Shape.Utils.b2(z,t,w,m),z=THREE.Shape.Utils.b2(z,u,v,o);k.push(new THREE.Vector2(D,z))}}break;case "b":if(m=c[b++]*e+f,o=c[b++]*e,w=c[b++]*e+f,v=c[b++]*-e,y=c[b++]*e+f,x=c[b++]*-e,h.bezierCurveTo(m,o,
+w,v,y,x),j=k[k.length-1]){t=j.x;u=j.y;j=1;for(divisions=this.divisions;j<=divisions;j++)z=j/divisions,D=THREE.Shape.Utils.b3(z,t,w,y,m),z=THREE.Shape.Utils.b3(z,u,v,x,o),k.push(new THREE.Vector2(D,z))}}}return{offset:B.ha*e,points:k,path:h}}}};
+(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,j=0;j<c;k=j++)h+=b[k].x*b[j].y-b[j].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],j=[],m=[],p,o,t;if(c(b)>0)for(o=0;o<h;o++)j[o]=o;else for(o=0;o<h;o++)j[o]=h-1-o;var u=2*h;for(o=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return m;return k}p=o;h<=p&&(p=0);o=p+1;h<=o&&(o=0);t=o+1;h<=t&&(t=0);var w;a:{w=b;var v=p,y=o,x=t,B=h,z=j,D=void 0,C=void 0,E=void 0,
+J=void 0,O=void 0,K=void 0,H=void 0,F=void 0,T=void 0,C=w[z[v]].x,E=w[z[v]].y,J=w[z[y]].x,O=w[z[y]].y,K=w[z[x]].x,H=w[z[x]].y;if(1.0E-10>(J-C)*(H-E)-(O-E)*(K-C))w=!1;else{for(D=0;D<B;D++)if(!(D==v||D==y||D==x)){var F=w[z[D]].x,T=w[z[D]].y,G=void 0,M=void 0,L=void 0,P=void 0,n=void 0,X=void 0,la=void 0,R=void 0,ga=void 0,Z=void 0,da=void 0,ca=void 0,G=L=n=void 0,G=K-J,M=H-O,L=C-K,P=E-H,n=J-C,X=O-E,la=F-C,R=T-E,ga=F-J,Z=T-O,da=F-K,ca=T-H,G=G*Z-M*ga,n=n*R-X*la,L=L*ca-P*da;if(G>=0&&L>=0&&n>=0){w=!1;break a}}w=
+!0}}if(w){k.push([b[j[p]],b[j[o]],b[j[t]]]);m.push([j[p],j[o],j[t]]);p=o;for(t=o+1;t<h;p++,t++)j[p]=j[t];h--;u=2*h}}if(f)return m;return k};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
 THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var k=f/this.segmentsT*this.arc,j=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var m=new THREE.Vector3;m.x=(this.radius+this.tube*Math.cos(j))*Math.cos(k);m.y=(this.radius+this.tube*Math.cos(j))*Math.sin(k);m.z=
 this.tube*Math.sin(j);this.vertices.push(new THREE.Vertex(m));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(m.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,k=(this.segmentsT+1)*(e-1)+f-1,j=(this.segmentsT+1)*(e-1)+f,m=(this.segmentsT+1)*e+f,p=new THREE.Face4(h,k,j,m,[c[h],c[k],c[j],c[m]]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[j]);p.normal.addSelf(c[m]);p.normal.normalize();this.faces.push(p);
 this.faceVertexUvs[0].push([b[h].clone(),b[k].clone(),b[j].clone(),b[m].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
@@ -518,65 +518,65 @@ new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow
 1)b[e].wrapT=THREE.RepeatWrapping}k&&b[e].offset.set(k[0],k[1]);if(m){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[m[0]]!==void 0)b[e].wrapS=h[m[0]];if(h[m[1]]!==void 0)b[e].wrapT=h[m[1]]}f(b[e],c+"/"+j)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var j,m,p;m="MeshLambertMaterial";j={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?m="MeshPhongMaterial":b.shading=="Basic"&&(m="MeshBasicMaterial"));
 if(b.blending)if(b.blending=="Additive")j.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")j.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")j.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)j.transparent=b.transparent;if(b.depthTest!==void 0)j.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")j.vertexColors=THREE.FaceColors;else if(b.vertexColors)j.vertexColors=THREE.VertexColors;if(b.colorDiffuse)j.color=k(b.colorDiffuse);
 else if(b.DbgColor)j.color=b.DbgColor;if(b.colorSpecular)j.specular=k(b.colorSpecular);if(b.colorAmbient)j.ambient=k(b.colorAmbient);if(b.transparency)j.opacity=b.transparency;if(b.specularCoef)j.shininess=b.specularCoef;b.mapDiffuse&&c&&h(j,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&h(j,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&h(j,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
-b.mapSpecular&&c&&h(j,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var o=THREE.ShaderUtils.lib.normal,t=THREE.UniformsUtils.clone(o.uniforms),v=j.color;m=j.specular;p=j.ambient;var w=j.shininess;t.tNormal.texture=j.normalMap;if(b.mapNormalFactor)t.uNormalScale.value=b.mapNormalFactor;if(j.map)t.tDiffuse.texture=j.map,t.enableDiffuse.value=!0;if(j.specularMap)t.tSpecular.texture=j.specularMap,t.enableSpecular.value=!0;if(j.lightMap)t.tAO.texture=
-j.lightMap,t.enableAO.value=!0;t.uDiffuseColor.value.setHex(v);t.uSpecularColor.value.setHex(m);t.uAmbientColor.value.setHex(p);t.uShininess.value=w;if(j.opacity)t.uOpacity.value=j.opacity;j=new THREE.MeshShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:t,lights:!0,fog:!0})}else j=new THREE[m](j);return j},constructor:THREE.Loader};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
+b.mapSpecular&&c&&h(j,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var o=THREE.ShaderUtils.lib.normal,t=THREE.UniformsUtils.clone(o.uniforms),u=j.color;m=j.specular;p=j.ambient;var w=j.shininess;t.tNormal.texture=j.normalMap;if(b.mapNormalFactor)t.uNormalScale.value=b.mapNormalFactor;if(j.map)t.tDiffuse.texture=j.map,t.enableDiffuse.value=!0;if(j.specularMap)t.tSpecular.texture=j.specularMap,t.enableSpecular.value=!0;if(j.lightMap)t.tAO.texture=
+j.lightMap,t.enableAO.value=!0;t.uDiffuseColor.value.setHex(u);t.uSpecularColor.value.setHex(m);t.uAmbientColor.value.setHex(p);t.uShininess.value=w;if(j.opacity)t.uOpacity.value=j.opacity;j=new THREE.MeshShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:t,lights:!0,fog:!0})}else j=new THREE[m](j);return j},constructor:THREE.Loader};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
 THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,p,o,t,v,w,u,y,x,B,z,D,C,E=b.faces;v=b.vertices;var J=b.normals,O=b.colors,K=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&K++;for(e=0;e<K;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(t=v.length;o<t;)w=new THREE.Vertex,w.position.x=v[o++]*c,w.position.y=
-v[o++]*c,w.position.z=v[o++]*c,f.vertices.push(w);o=0;for(t=E.length;o<t;){c=E[o++];v=c&1;p=c&2;e=c&4;h=c&8;u=c&16;w=c&32;x=c&64;c&=128;v?(B=new THREE.Face4,B.a=E[o++],B.b=E[o++],B.c=E[o++],B.d=E[o++],v=4):(B=new THREE.Face3,B.a=E[o++],B.b=E[o++],B.c=E[o++],v=3);if(p)p=E[o++],B.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<K;e++)z=b.uvs[e],y=E[o++],C=z[y*2],y=z[y*2+1],f.faceUvs[e][p]=new THREE.UV(C,y);if(h)for(e=0;e<K;e++){z=b.uvs[e];D=[];for(h=0;h<v;h++)y=E[o++],C=z[y*2],y=z[y*2+1],D[h]=
-new THREE.UV(C,y);f.faceVertexUvs[e][p]=D}if(u)u=E[o++]*3,h=new THREE.Vector3,h.x=J[u++],h.y=J[u++],h.z=J[u],B.normal=h;if(w)for(e=0;e<v;e++)u=E[o++]*3,h=new THREE.Vector3,h.x=J[u++],h.y=J[u++],h.z=J[u],B.vertexNormals.push(h);if(x)w=E[o++],w=new THREE.Color(O[w]),B.color=w;if(c)for(e=0;e<v;e++)w=E[o++],w=new THREE.Color(O[w]),B.vertexColors.push(w);f.faces.push(B)}}})(h);(function(){var c,e,h,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
-p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,p,o,t,v,w,u,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];u=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;p=0;for(o=y.length;p<o;p+=3)t=y[p]*c,v=y[p+1]*
-c,w=y[p+2]*c,u.push(new THREE.Vertex(new THREE.Vector3(t,v,w)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];o=f.morphColors[e].colors;t=b.morphColors[e].colors;c=0;for(p=t.length;c<p;c+=3)v=new THREE.Color(16755200),v.setRGB(t[c],t[c+1],t[c+2]),o.push(v)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,h,p,o,t,u,w,v,y,x,B,z,D,C,E=b.faces;u=b.vertices;var J=b.normals,O=b.colors,K=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&K++;for(e=0;e<K;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];o=0;for(t=u.length;o<t;)w=new THREE.Vertex,w.position.x=u[o++]*c,w.position.y=
+u[o++]*c,w.position.z=u[o++]*c,f.vertices.push(w);o=0;for(t=E.length;o<t;){c=E[o++];u=c&1;p=c&2;e=c&4;h=c&8;v=c&16;w=c&32;x=c&64;c&=128;u?(B=new THREE.Face4,B.a=E[o++],B.b=E[o++],B.c=E[o++],B.d=E[o++],u=4):(B=new THREE.Face3,B.a=E[o++],B.b=E[o++],B.c=E[o++],u=3);if(p)p=E[o++],B.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<K;e++)z=b.uvs[e],y=E[o++],C=z[y*2],y=z[y*2+1],f.faceUvs[e][p]=new THREE.UV(C,y);if(h)for(e=0;e<K;e++){z=b.uvs[e];D=[];for(h=0;h<u;h++)y=E[o++],C=z[y*2],y=z[y*2+1],D[h]=
+new THREE.UV(C,y);f.faceVertexUvs[e][p]=D}if(v)v=E[o++]*3,h=new THREE.Vector3,h.x=J[v++],h.y=J[v++],h.z=J[v],B.normal=h;if(w)for(e=0;e<u;e++)v=E[o++]*3,h=new THREE.Vector3,h.x=J[v++],h.y=J[v++],h.z=J[v],B.vertexNormals.push(h);if(x)w=E[o++],w=new THREE.Color(O[w]),B.color=w;if(c)for(e=0;e<u;e++)w=E[o++],w=new THREE.Color(O[w]),B.vertexColors.push(w);f.faces.push(B)}}})(h);(function(){var c,e,h,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
+p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,p,o,t,u,w,v,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];v=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;p=0;for(o=y.length;p<o;p+=3)t=y[p]*c,u=y[p+1]*
+c,w=y[p+2]*c,v.push(new THREE.Vertex(new THREE.Vector3(t,u,w)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];o=f.morphColors[e].colors;t=b.morphColors[e].colors;c=0;for(p=t.length;c<p;c+=3)u=new THREE.Color(16755200),u.setRGB(t[c],t[c+1],t[c+2]),o.push(u)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
 f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
 THREE.BinaryLoader.prototype.load=function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),h=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),k=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,h,f,k)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
 c.postMessage(b)};
 THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var j=new XMLHttpRequest,m=f+"/"+b,p=0;j.onreadystatechange=function(){j.readyState==4?j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,e,h,c):alert("Couldn't load ["+m+"] ["+j.status+"]"):j.readyState==3?k&&(p==0&&(p=j.getResponseHeader("Content-Length")),k({total:p,loaded:j.responseText.length})):j.readyState==2&&(p=j.getResponseHeader("Content-Length"))};j.open("GET",m,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
 j.setRequestHeader("Content-Type","text/plain");j.send(null)};
-THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=t(b,c),h=t(b,c+1),j=t(b,c+2),k=t(b,c+3),m=(k<<1&255|j>>7)-127;f|=(j&127)<<16|h<<8;if(f==0&&m==-127)return 0;return(1-2*(k>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,m)}function h(b,c){var e=t(b,c),f=t(b,c+1),j=t(b,c+2);return(t(b,c+3)<<24)+(j<<16)+(f<<8)+e}function p(b,c){var e=t(b,c);return(t(b,c+1)<<8)+e}function o(b,c){var e=t(b,c);return e>127?e-256:e}function t(b,c){return b.charCodeAt(c)&255}function v(c){var e,
-f,j;e=h(b,c);f=h(b,c+O);j=h(b,c+K);c=p(b,c+I);z.faces.push(new THREE.Face3(e,f,j,null,null,z.materials[c]))}function w(c){var e,f,j,k,n,o;e=h(b,c);f=h(b,c+O);j=h(b,c+K);k=p(b,c+I);n=h(b,c+F);o=h(b,c+Y);c=h(b,c+G);k=z.materials[k];var t=E[o*3],u=E[o*3+1];o=E[o*3+2];var v=E[c*3],w=E[c*3+1],c=E[c*3+2];z.faces.push(new THREE.Face3(e,f,j,[new THREE.Vector3(E[n*3],E[n*3+1],E[n*3+2]),new THREE.Vector3(t,u,o),new THREE.Vector3(v,w,c)],null,k))}function u(c){var e,f,j,k;e=h(b,c);f=h(b,c+M);j=h(b,c+L);k=h(b,
-c+S);c=p(b,c+n);z.faces.push(new THREE.Face4(e,f,j,k,null,null,z.materials[c]))}function y(c){var e,f,j,k,o,t,u,v;e=h(b,c);f=h(b,c+M);j=h(b,c+L);k=h(b,c+S);o=p(b,c+n);t=h(b,c+V);u=h(b,c+fa);v=h(b,c+Q);c=h(b,c+da);o=z.materials[o];var w=E[u*3],x=E[u*3+1];u=E[u*3+2];var y=E[v*3],B=E[v*3+1];v=E[v*3+2];var C=E[c*3],D=E[c*3+1],c=E[c*3+2];z.faces.push(new THREE.Face4(e,f,j,k,[new THREE.Vector3(E[t*3],E[t*3+1],E[t*3+2]),new THREE.Vector3(w,x,u),new THREE.Vector3(y,B,v),new THREE.Vector3(C,D,c)],null,o))}
-function x(c){var e,f,j,k;e=h(b,c);f=h(b,c+$);j=h(b,c+ka);c=J[e*2];k=J[e*2+1];e=J[f*2];var n=z.faceVertexUvs[0];f=J[f*2+1];var o=J[j*2];j=J[j*2+1];var p=[];p.push(new THREE.UV(c,k));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,j));n.push(p)}function B(c){var e,f,j,k,n,o;e=h(b,c);f=h(b,c+U);j=h(b,c+aa);k=h(b,c+ja);c=J[e*2];n=J[e*2+1];e=J[f*2];o=J[f*2+1];f=J[j*2];var p=z.faceVertexUvs[0];j=J[j*2+1];var t=J[k*2];k=J[k*2+1];var u=[];u.push(new THREE.UV(c,n));u.push(new THREE.UV(e,o));u.push(new THREE.UV(f,
-j));u.push(new THREE.UV(t,k));p.push(u)}var z=this,D=0,C,E=[],J=[],O,K,I,F,Y,G,M,L,S,n,V,fa,Q,da,$,ka,U,aa,ja,ha,X,ca,ga,ia,ma;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,f,c);C={signature:b.substr(D,8),header_bytes:t(b,D+8),vertex_coordinate_bytes:t(b,D+9),normal_coordinate_bytes:t(b,D+10),uv_coordinate_bytes:t(b,D+11),vertex_index_bytes:t(b,D+12),normal_index_bytes:t(b,D+13),uv_index_bytes:t(b,D+14),material_index_bytes:t(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b,
-D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=C.header_bytes;O=C.vertex_index_bytes;K=C.vertex_index_bytes*2;I=C.vertex_index_bytes*3;F=C.vertex_index_bytes*3+C.material_index_bytes;Y=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;G=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes;
-L=C.vertex_index_bytes*2;S=C.vertex_index_bytes*3;n=C.vertex_index_bytes*4;V=C.vertex_index_bytes*4+C.material_index_bytes;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;Q=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;da=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;$=C.uv_index_bytes;ka=C.uv_index_bytes*2;U=C.uv_index_bytes;aa=C.uv_index_bytes*2;ja=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;ma=C.vertex_index_bytes*
-4+C.material_index_bytes;ha=C.ntri_flat*c;X=C.ntri_smooth*(c+C.normal_index_bytes*3);ca=C.ntri_flat_uv*(c+C.uv_index_bytes*3);ga=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ia=C.nquad_flat*ma;c=C.nquad_smooth*(ma+C.normal_index_bytes*4);ma=C.nquad_flat_uv*(ma+C.uv_index_bytes*4);D+=function(c){for(var f,h,k,m=C.vertex_coordinate_bytes*3,n=c+C.nvertices*m;c<n;c+=m)f=e(b,c),h=e(b,c+C.vertex_coordinate_bytes),k=e(b,c+C.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
-h,k)));return C.nvertices*m}(D);D+=function(c){for(var e,f,h,j=C.normal_coordinate_bytes*3,k=c+C.nnormals*j;c<k;c+=j)e=o(b,c),f=o(b,c+C.normal_coordinate_bytes),h=o(b,c+C.normal_coordinate_bytes*2),E.push(e/127,f/127,h/127);return C.nnormals*j}(D);D+=function(c){for(var f,h,k=C.uv_coordinate_bytes*2,m=c+C.nuvs*k;c<m;c+=k)f=e(b,c),h=e(b,c+C.uv_coordinate_bytes),J.push(f,h);return C.nuvs*k}(D);ha=D+ha;X=ha+X;ca=X+ca;ga=ca+ga;ia=ga+ia;c=ia+c;ma=c+ma;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,
-f=e+C.uv_index_bytes*3,h=b+C.ntri_flat_uv*f;for(c=b;c<h;c+=f)v(c),x(c+e);return h-b})(X);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,h=b+C.ntri_smooth_uv*f;for(c=b;c<h;c+=f)w(c),x(c+e);return h-b})(ca);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,h=b+C.nquad_flat_uv*f;for(c=b;c<h;c+=f)u(c),B(c+e);return h-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
-4,f=e+C.uv_index_bytes*4,h=b+C.nquad_smooth_uv*f;for(c=b;c<h;c+=f)y(c),B(c+e);return h-b})(ma);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(D);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(ha);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(ga);(function(b){var c,
+THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=t(b,c),h=t(b,c+1),j=t(b,c+2),k=t(b,c+3),m=(k<<1&255|j>>7)-127;f|=(j&127)<<16|h<<8;if(f==0&&m==-127)return 0;return(1-2*(k>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,m)}function h(b,c){var e=t(b,c),f=t(b,c+1),j=t(b,c+2);return(t(b,c+3)<<24)+(j<<16)+(f<<8)+e}function p(b,c){var e=t(b,c);return(t(b,c+1)<<8)+e}function o(b,c){var e=t(b,c);return e>127?e-256:e}function t(b,c){return b.charCodeAt(c)&255}function u(c){var e,
+f,j;e=h(b,c);f=h(b,c+O);j=h(b,c+K);c=p(b,c+H);z.faces.push(new THREE.Face3(e,f,j,null,null,z.materials[c]))}function w(c){var e,f,j,k,n,o;e=h(b,c);f=h(b,c+O);j=h(b,c+K);k=p(b,c+H);n=h(b,c+F);o=h(b,c+T);c=h(b,c+G);k=z.materials[k];var u=E[o*3],t=E[o*3+1];o=E[o*3+2];var v=E[c*3],w=E[c*3+1],c=E[c*3+2];z.faces.push(new THREE.Face3(e,f,j,[new THREE.Vector3(E[n*3],E[n*3+1],E[n*3+2]),new THREE.Vector3(u,t,o),new THREE.Vector3(v,w,c)],null,k))}function v(c){var e,f,j,k;e=h(b,c);f=h(b,c+M);j=h(b,c+L);k=h(b,
+c+P);c=p(b,c+n);z.faces.push(new THREE.Face4(e,f,j,k,null,null,z.materials[c]))}function y(c){var e,f,j,k,o,u,t,v;e=h(b,c);f=h(b,c+M);j=h(b,c+L);k=h(b,c+P);o=p(b,c+n);u=h(b,c+X);t=h(b,c+la);v=h(b,c+R);c=h(b,c+ga);o=z.materials[o];var w=E[t*3],x=E[t*3+1];t=E[t*3+2];var y=E[v*3],B=E[v*3+1];v=E[v*3+2];var C=E[c*3],D=E[c*3+1],c=E[c*3+2];z.faces.push(new THREE.Face4(e,f,j,k,[new THREE.Vector3(E[u*3],E[u*3+1],E[u*3+2]),new THREE.Vector3(w,x,t),new THREE.Vector3(y,B,v),new THREE.Vector3(C,D,c)],null,o))}
+function x(c){var e,f,j,k;e=h(b,c);f=h(b,c+Z);j=h(b,c+da);c=J[e*2];k=J[e*2+1];e=J[f*2];var n=z.faceVertexUvs[0];f=J[f*2+1];var o=J[j*2];j=J[j*2+1];var p=[];p.push(new THREE.UV(c,k));p.push(new THREE.UV(e,f));p.push(new THREE.UV(o,j));n.push(p)}function B(c){var e,f,j,k,n,o;e=h(b,c);f=h(b,c+ca);j=h(b,c+ha);k=h(b,c+ka);c=J[e*2];n=J[e*2+1];e=J[f*2];o=J[f*2+1];f=J[j*2];var p=z.faceVertexUvs[0];j=J[j*2+1];var u=J[k*2];k=J[k*2+1];var t=[];t.push(new THREE.UV(c,n));t.push(new THREE.UV(e,o));t.push(new THREE.UV(f,
+j));t.push(new THREE.UV(u,k));p.push(t)}var z=this,D=0,C,E=[],J=[],O,K,H,F,T,G,M,L,P,n,X,la,R,ga,Z,da,ca,ha,ka,$,U,W,ja,ia,ma;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(z,f,c);C={signature:b.substr(D,8),header_bytes:t(b,D+8),vertex_coordinate_bytes:t(b,D+9),normal_coordinate_bytes:t(b,D+10),uv_coordinate_bytes:t(b,D+11),vertex_index_bytes:t(b,D+12),normal_index_bytes:t(b,D+13),uv_index_bytes:t(b,D+14),material_index_bytes:t(b,D+15),nvertices:h(b,D+16),nnormals:h(b,D+16+4),nuvs:h(b,
+D+16+8),ntri_flat:h(b,D+16+12),ntri_smooth:h(b,D+16+16),ntri_flat_uv:h(b,D+16+20),ntri_smooth_uv:h(b,D+16+24),nquad_flat:h(b,D+16+28),nquad_smooth:h(b,D+16+32),nquad_flat_uv:h(b,D+16+36),nquad_smooth_uv:h(b,D+16+40)};D+=C.header_bytes;O=C.vertex_index_bytes;K=C.vertex_index_bytes*2;H=C.vertex_index_bytes*3;F=C.vertex_index_bytes*3+C.material_index_bytes;T=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;G=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;M=C.vertex_index_bytes;
+L=C.vertex_index_bytes*2;P=C.vertex_index_bytes*3;n=C.vertex_index_bytes*4;X=C.vertex_index_bytes*4+C.material_index_bytes;la=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;R=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ga=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;Z=C.uv_index_bytes;da=C.uv_index_bytes*2;ca=C.uv_index_bytes;ha=C.uv_index_bytes*2;ka=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;ma=C.vertex_index_bytes*
+4+C.material_index_bytes;$=C.ntri_flat*c;U=C.ntri_smooth*(c+C.normal_index_bytes*3);W=C.ntri_flat_uv*(c+C.uv_index_bytes*3);ja=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ia=C.nquad_flat*ma;c=C.nquad_smooth*(ma+C.normal_index_bytes*4);ma=C.nquad_flat_uv*(ma+C.uv_index_bytes*4);D+=function(c){for(var f,h,k,m=C.vertex_coordinate_bytes*3,n=c+C.nvertices*m;c<n;c+=m)f=e(b,c),h=e(b,c+C.vertex_coordinate_bytes),k=e(b,c+C.vertex_coordinate_bytes*2),z.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
+h,k)));return C.nvertices*m}(D);D+=function(c){for(var e,f,h,j=C.normal_coordinate_bytes*3,k=c+C.nnormals*j;c<k;c+=j)e=o(b,c),f=o(b,c+C.normal_coordinate_bytes),h=o(b,c+C.normal_coordinate_bytes*2),E.push(e/127,f/127,h/127);return C.nnormals*j}(D);D+=function(c){for(var f,h,k=C.uv_coordinate_bytes*2,m=c+C.nuvs*k;c<m;c+=k)f=e(b,c),h=e(b,c+C.uv_coordinate_bytes),J.push(f,h);return C.nuvs*k}(D);$=D+$;U=$+U;W=U+W;ja=W+ja;ia=ja+ia;c=ia+c;ma=c+ma;(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,
+f=e+C.uv_index_bytes*3,h=b+C.ntri_flat_uv*f;for(c=b;c<h;c+=f)u(c),x(c+e);return h-b})(U);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=e+C.uv_index_bytes*3,h=b+C.ntri_smooth_uv*f;for(c=b;c<h;c+=f)w(c),x(c+e);return h-b})(W);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=e+C.uv_index_bytes*4,h=b+C.nquad_flat_uv*f;for(c=b;c<h;c+=f)v(c),B(c+e);return h-b})(c);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
+4,f=e+C.uv_index_bytes*4,h=b+C.nquad_smooth_uv*f;for(c=b;c<h;c+=f)y(c),B(c+e);return h-b})(ma);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(D);(function(b){var c,e=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})($);(function(b){var c,e=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*e;for(c=b;c<f;c+=e)v(c);return f-b})(ja);(function(b){var c,
 e=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=b+C.nquad_smooth*e;for(c=b;c<f;c+=e)y(c);return f-b})(ia);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function m(){for(u in M.objects)if(!Q.objects[u])if(D=M.objects[u],D.geometry!==void 0){if(O=Q.geometries[D.geometry]){var b=!1;Y=[];for($=0;$<D.materials.length;$++)Y[$]=Q.materials[D.materials[$]],b=Y[$]instanceof THREE.MeshShaderMaterial;b&&O.computeTangents();C=D.position;r=D.rotation;
-q=D.quaternion;s=D.scale;q=0;Y.length==0&&(Y[0]=new THREE.MeshFaceMaterial);Y.length>1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,Y);object.name=u;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=D.visible;Q.scene.addObject(object);Q.objects[u]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b));
-if(D.castsShadow)b=new THREE.ShadowVolume(O),Q.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},Q.triggers[object.name]=b)}}else C=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=u,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
-s[1],s[2]),object.visible=D.visible!==void 0?D.visible:!1,Q.scene.addObject(object),Q.objects[u]=object,Q.empties[u]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},Q.triggers[object.name]=b)}function p(b){return function(c){Q.geometries[b]=c;m();S-=1;e.onLoadComplete();t()}}function o(b){return function(c){Q.geometries[b]=c}}function t(){e.callbackProgress({totalModels:V,totalTextures:fa,loadedModels:V-S,loadedTextures:fa-n},Q);e.onLoadProgress();S==0&&n==0&&c(Q)}
-var v,w,u,y,x,B,z,D,C,E,J,O,K,I,F,Y,G,M,L,S,n,V,fa,Q;M=b.data;F=new THREE.BinaryLoader;L=new THREE.JSONLoader;n=S=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(u in M.objects)if(D=M.objects[u],D.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;E=M.transform.rotation;var da=M.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);E&&Q.scene.rotation.set(E[0],
-E[1],E[2]);da&&Q.scene.scale.set(da[0],da[1],da[2]);(b||E||da)&&Q.scene.updateMatrix()}b=function(){n-=1;t();e.onLoadComplete()};for(x in M.cameras){E=M.cameras[x];if(E.type=="perspective")K=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;K.position.set(C[0],C[1],C[2]);K.target.position.set(E[0],E[1],E[2]);Q.cameras[x]=K}for(y in M.lights)x=M.lights[y],
-K=x.color!==void 0?x.color:16777215,E=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,G=new THREE.DirectionalLight(K,E),G.position.set(C[0],C[1],C[2]),G.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,G=new THREE.PointLight(K,E,d),G.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(G=new THREE.AmbientLight(K)),Q.scene.addLight(G),Q.lights[y]=G;for(B in M.fogs)y=M.fogs[B],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0,
-y.density)),E=y.color,I.color.setRGB(E[0],E[1],E[2]),Q.fogs[B]=I;if(Q.cameras&&M.defaults.camera)Q.currentCamera=Q.cameras[M.defaults.camera];if(Q.fogs&&M.defaults.fog)Q.scene.fog=Q.fogs[M.defaults.fog];E=M.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(E[0],E[1],E[2]);Q.bgColorAlpha=M.defaults.bgalpha;for(v in M.geometries)if(B=M.geometries[v],B.type=="bin_mesh"||B.type=="ascii_mesh")S+=1,e.onLoadStart();V=S;for(v in M.geometries)B=M.geometries[v],B.type=="cube"?(O=new THREE.CubeGeometry(B.width,
-B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),Q.geometries[v]=O):B.type=="plane"?(O=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),Q.geometries[v]=O):B.type=="sphere"?(O=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),Q.geometries[v]=O):B.type=="cylinder"?(O=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),Q.geometries[v]=O):B.type=="torus"?(O=new THREE.TorusGeometry(B.radius,
-B.tube,B.segmentsR,B.segmentsT),Q.geometries[v]=O):B.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(B.subdivisions),Q.geometries[v]=O):B.type=="bin_mesh"?F.load({model:f(B.url,M.urlBaseType),callback:p(v)}):B.type=="ascii_mesh"?L.load({model:f(B.url,M.urlBaseType),callback:p(v)}):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&L.createModel(B,o(v),"");for(z in M.textures)if(v=M.textures[z],v.url instanceof Array){n+=v.url.length;for(F=0;F<v.url.length;F++)e.onLoadStart()}else n+=1,e.onLoadStart();
-fa=n;for(z in M.textures){v=M.textures[z];if(v.mapping!=void 0&&THREE[v.mapping]!=void 0)v.mapping=new THREE[v.mapping];if(v.url instanceof Array){F=[];for(var $=0;$<v.url.length;$++)F[$]=f(v.url[$],M.urlBaseType);F=THREE.ImageUtils.loadTextureCube(F,v.mapping,b)}else{F=THREE.ImageUtils.loadTexture(f(v.url,M.urlBaseType),v.mapping,b);if(THREE[v.minFilter]!=void 0)F.minFilter=THREE[v.minFilter];if(THREE[v.magFilter]!=void 0)F.magFilter=THREE[v.magFilter];if(v.repeat){F.repeat.set(v.repeat[0],v.repeat[1]);
-if(v.repeat[0]!=1)F.wrapS=THREE.RepeatWrapping;if(v.repeat[1]!=1)F.wrapT=THREE.RepeatWrapping}v.offset&&F.offset.set(v.offset[0],v.offset[1]);if(v.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[v.wrap[0]]!==void 0)F.wrapS=L[v.wrap[0]];if(L[v.wrap[1]]!==void 0)F.wrapT=L[v.wrap[1]]}}Q.textures[z]=F}for(w in M.materials){z=M.materials[w];for(J in z.parameters)if(J=="envMap"||J=="map"||J=="lightMap")z.parameters[J]=Q.textures[z.parameters[J]];else if(J=="shading")z.parameters[J]=
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function m(){for(v in M.objects)if(!R.objects[v])if(D=M.objects[v],D.geometry!==void 0){if(O=R.geometries[D.geometry]){var b=!1;T=[];for(Z=0;Z<D.materials.length;Z++)T[Z]=R.materials[D.materials[Z]],b=T[Z]instanceof THREE.MeshShaderMaterial;b&&O.computeTangents();C=D.position;r=D.rotation;
+q=D.quaternion;s=D.scale;q=0;T.length==0&&(T[0]=new THREE.MeshFaceMaterial);T.length>1&&(T=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,T);object.name=v;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=D.visible;R.scene.addObject(object);R.objects[v]=object;D.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),R.scene.collisions.colliders.push(b));
+if(D.castsShadow)b=new THREE.ShadowVolume(O),R.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},R.triggers[object.name]=b)}}else C=D.position,r=D.rotation,q=D.quaternion,s=D.scale,q=0,object=new THREE.Object3D,object.name=v,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=D.visible!==void 0?D.visible:!1,R.scene.addObject(object),R.objects[v]=object,R.empties[v]=object,D.trigger&&D.trigger.toLowerCase()!="none"&&(b={type:D.trigger,object:D},R.triggers[object.name]=b)}function p(b){return function(c){R.geometries[b]=c;m();P-=1;e.onLoadComplete();t()}}function o(b){return function(c){R.geometries[b]=c}}function t(){e.callbackProgress({totalModels:X,totalTextures:la,loadedModels:X-P,loadedTextures:la-n},R);e.onLoadProgress();P==0&&n==0&&c(R)}
+var u,w,v,y,x,B,z,D,C,E,J,O,K,H,F,T,G,M,L,P,n,X,la,R;M=b.data;F=new THREE.BinaryLoader;L=new THREE.JSONLoader;n=P=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in M.objects)if(D=M.objects[v],D.meshCollider){b=!0;break}if(b)R.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;E=M.transform.rotation;var ga=M.transform.scale;b&&R.scene.position.set(b[0],b[1],b[2]);E&&R.scene.rotation.set(E[0],
+E[1],E[2]);ga&&R.scene.scale.set(ga[0],ga[1],ga[2]);(b||E||ga)&&R.scene.updateMatrix()}b=function(){n-=1;t();e.onLoadComplete()};for(x in M.cameras){E=M.cameras[x];if(E.type=="perspective")K=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho")K=new THREE.Camera,K.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far);C=E.position;E=E.target;K.position.set(C[0],C[1],C[2]);K.target.position.set(E[0],E[1],E[2]);R.cameras[x]=K}for(y in M.lights)x=M.lights[y],
+K=x.color!==void 0?x.color:16777215,E=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(C=x.direction,G=new THREE.DirectionalLight(K,E),G.position.set(C[0],C[1],C[2]),G.position.normalize()):x.type=="point"?(C=x.position,d=x.distance,G=new THREE.PointLight(K,E,d),G.position.set(C[0],C[1],C[2])):x.type=="ambient"&&(G=new THREE.AmbientLight(K)),R.scene.addLight(G),R.lights[y]=G;for(B in M.fogs)y=M.fogs[B],y.type=="linear"?H=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(H=new THREE.FogExp2(0,
+y.density)),E=y.color,H.color.setRGB(E[0],E[1],E[2]),R.fogs[B]=H;if(R.cameras&&M.defaults.camera)R.currentCamera=R.cameras[M.defaults.camera];if(R.fogs&&M.defaults.fog)R.scene.fog=R.fogs[M.defaults.fog];E=M.defaults.bgcolor;R.bgColor=new THREE.Color;R.bgColor.setRGB(E[0],E[1],E[2]);R.bgColorAlpha=M.defaults.bgalpha;for(u in M.geometries)if(B=M.geometries[u],B.type=="bin_mesh"||B.type=="ascii_mesh")P+=1,e.onLoadStart();X=P;for(u in M.geometries)B=M.geometries[u],B.type=="cube"?(O=new THREE.CubeGeometry(B.width,
+B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),R.geometries[u]=O):B.type=="plane"?(O=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),R.geometries[u]=O):B.type=="sphere"?(O=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),R.geometries[u]=O):B.type=="cylinder"?(O=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),R.geometries[u]=O):B.type=="torus"?(O=new THREE.TorusGeometry(B.radius,
+B.tube,B.segmentsR,B.segmentsT),R.geometries[u]=O):B.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(B.subdivisions),R.geometries[u]=O):B.type=="bin_mesh"?F.load({model:f(B.url,M.urlBaseType),callback:p(u)}):B.type=="ascii_mesh"?L.load({model:f(B.url,M.urlBaseType),callback:p(u)}):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&L.createModel(B,o(u),"");for(z in M.textures)if(u=M.textures[z],u.url instanceof Array){n+=u.url.length;for(F=0;F<u.url.length;F++)e.onLoadStart()}else n+=1,e.onLoadStart();
+la=n;for(z in M.textures){u=M.textures[z];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){F=[];for(var Z=0;Z<u.url.length;Z++)F[Z]=f(u.url[Z],M.urlBaseType);F=THREE.ImageUtils.loadTextureCube(F,u.mapping,b)}else{F=THREE.ImageUtils.loadTexture(f(u.url,M.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)F.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)F.magFilter=THREE[u.magFilter];if(u.repeat){F.repeat.set(u.repeat[0],u.repeat[1]);
+if(u.repeat[0]!=1)F.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)F.wrapT=THREE.RepeatWrapping}u.offset&&F.offset.set(u.offset[0],u.offset[1]);if(u.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[u.wrap[0]]!==void 0)F.wrapS=L[u.wrap[0]];if(L[u.wrap[1]]!==void 0)F.wrapT=L[u.wrap[1]]}}R.textures[z]=F}for(w in M.materials){z=M.materials[w];for(J in z.parameters)if(J=="envMap"||J=="map"||J=="lightMap")z.parameters[J]=R.textures[z.parameters[J]];else if(J=="shading")z.parameters[J]=
 z.parameters[J]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(J=="blending")z.parameters[J]=THREE[z.parameters[J]]?THREE[z.parameters[J]]:THREE.NormalBlending;else if(J=="combine")z.parameters[J]=z.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(J=="vertexColors")if(z.parameters[J]=="face")z.parameters[J]=THREE.FaceColors;else if(z.parameters[J])z.parameters[J]=THREE.VertexColors;if(z.parameters.opacity!==void 0&&z.parameters.opacity<1)z.parameters.transparent=
-!0;if(z.parameters.normalMap){v=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(v.uniforms);F=z.parameters.color;L=z.parameters.specular;B=z.parameters.ambient;I=z.parameters.shininess;b.tNormal.texture=Q.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)b.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)b.tDiffuse.texture=z.parameters.map,b.enableDiffuse.value=!0;if(z.parameters.lightMap)b.tAO.texture=z.parameters.lightMap,b.enableAO.value=!0;if(z.parameters.specularMap)b.tSpecular.texture=
-Q.textures[z.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(F);b.uSpecularColor.value.setHex(L);b.uAmbientColor.value.setHex(B);b.uShininess.value=I;if(z.parameters.opacity)b.uOpacity.value=z.parameters.opacity;z=new THREE.MeshShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:b,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);Q.materials[w]=z}m();e.callbackSync(Q)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
+!0;if(z.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);F=z.parameters.color;L=z.parameters.specular;B=z.parameters.ambient;H=z.parameters.shininess;b.tNormal.texture=R.textures[z.parameters.normalMap];if(z.parameters.normalMapFactor)b.uNormalScale.value=z.parameters.normalMapFactor;if(z.parameters.map)b.tDiffuse.texture=z.parameters.map,b.enableDiffuse.value=!0;if(z.parameters.lightMap)b.tAO.texture=z.parameters.lightMap,b.enableAO.value=!0;if(z.parameters.specularMap)b.tSpecular.texture=
+R.textures[z.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(F);b.uSpecularColor.value.setHex(L);b.uAmbientColor.value.setHex(B);b.uShininess.value=H;if(z.parameters.opacity)b.uOpacity.value=z.parameters.opacity;z=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else z=new THREE[z.type](z.parameters);R.materials[w]=z}m();e.callbackSync(R)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
 THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
 THREE.UTF8Loader.prototype.load=function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,h=b.scale!==void 0?b.scale:1,k=b.offsetX!==void 0?b.offsetX:0,j=b.offsetY!==void 0?b.offsetY:0,m=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,h,k,j,m):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)};
 THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var k=0,j=0;j<c;++j){var m=b.charCodeAt(j+f);k+=m>>1^-(m&1);e[8*j+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=j=0;h<c;h++)m=b.charCodeAt(h+f),k[h]=j-m,m==0&&j++;return[e,k]};
 THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var j=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var j=THREE.UTF8Loader.prototype.decompressMesh(b),o=[],t=[];(function(b,j,o){for(var p,t,B,z=b.length;o<z;o+=j)p=b[o],t=b[o+1],B=b[o+2],p=p/16383*e,t=t/16383*e,B=B/16383*e,p+=f,t+=h,B+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(p,t,B)))})(j[0],8,0);(function(b,c,e){for(var f,h,j=b.length;e<j;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,t.push(f,h)})(j[0],8,3);(function(b,
-c,e){for(var f,h,j,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],j=b[e+2],f=(f-512)/511,h=(h-512)/511,j=(j-512)/511,o.push(f,h,j)})(j[0],8,5);(function(b){var e,f,h,j,k,p,D,C,E,J=b.length;for(e=0;e<J;e+=3){f=b[e];h=b[e+1];j=b[e+2];k=c;C=f;E=h;p=j;D=f;var O=h,K=j,I=k.materials[0],F=o[O*3],Y=o[O*3+1],O=o[O*3+2],G=o[K*3],M=o[K*3+1],K=o[K*3+2];D=new THREE.Vector3(o[D*3],o[D*3+1],o[D*3+2]);O=new THREE.Vector3(F,Y,O);K=new THREE.Vector3(G,M,K);k.faces.push(new THREE.Face3(C,E,p,[D,O,K],null,I));k=t[f*2];f=t[f*2+
+c,e){for(var f,h,j,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],j=b[e+2],f=(f-512)/511,h=(h-512)/511,j=(j-512)/511,o.push(f,h,j)})(j[0],8,5);(function(b){var e,f,h,j,k,p,D,C,E,J=b.length;for(e=0;e<J;e+=3){f=b[e];h=b[e+1];j=b[e+2];k=c;C=f;E=h;p=j;D=f;var O=h,K=j,H=k.materials[0],F=o[O*3],T=o[O*3+1],O=o[O*3+2],G=o[K*3],M=o[K*3+1],K=o[K*3+2];D=new THREE.Vector3(o[D*3],o[D*3+1],o[D*3+2]);O=new THREE.Vector3(F,T,O);K=new THREE.Vector3(G,M,K);k.faces.push(new THREE.Face3(C,E,p,[D,O,K],null,H));k=t[f*2];f=t[f*2+
 1];p=t[h*2];D=t[h*2+1];C=t[j*2];E=t[j*2+1];j=c.faceVertexUvs[0];h=p;p=D;D=[];D.push(new THREE.UV(k,f));D.push(new THREE.UV(h,p));D.push(new THREE.UV(C,E));j.push(D)}})(j[1]);this.computeCentroids();this.computeFaceNormals()};j.prototype=new THREE.Geometry;j.prototype.constructor=j;c(new j)};
 THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,j,m,p,o,t,v){j=(j-t)/(v-t);t=this.normal_cache;c[k]=m+j*this.delta;c[k+1]=p;c[k+2]=o;h[k]=this.lerp(t[b],t[b+3],j);h[k+1]=this.lerp(t[b+1],t[b+4],j);h[k+2]=this.lerp(t[b+2],t[b+5],j)};this.VIntY=function(b,c,h,k,j,m,p,o,t,v){j=(j-t)/(v-t);t=this.normal_cache;c[k]=m;c[k+1]=p+j*this.delta;c[k+
-2]=o;c=b+this.yd*3;h[k]=this.lerp(t[b],t[c],j);h[k+1]=this.lerp(t[b+1],t[c+1],j);h[k+2]=this.lerp(t[b+2],t[c+2],j)};this.VIntZ=function(b,c,h,k,j,m,p,o,t,v){j=(j-t)/(v-t);t=this.normal_cache;c[k]=m;c[k+1]=p;c[k+2]=o+j*this.delta;c=b+this.zd*3;h[k]=this.lerp(t[b],t[c],j);h[k+1]=this.lerp(t[b+1],t[c+1],j);h[k+2]=this.lerp(t[b+2],t[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,j,m){var p=k+1,o=k+this.yd,t=k+this.zd,v=p+this.yd,w=p+this.zd,u=k+this.yd+this.zd,y=p+this.yd+this.zd,x=0,B=this.field[k],z=this.field[p],D=this.field[o],C=this.field[v],E=this.field[t],J=this.field[w],O=this.field[u],K=this.field[y];B<j&&(x|=1);z<j&&(x|=2);D<j&&(x|=8);C<j&&(x|=4);E<j&&(x|=16);J<j&&(x|=32);O<j&&(x|=128);K<j&&(x|=64);var I=THREE.edgeTable[x];if(I==0)return 0;var F=this.delta,
-Y=b+F,G=c+F,F=h+F;I&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,j,b,c,h,B,z));I&2&&(this.compNorm(p),this.compNorm(v),this.VIntY(p*3,this.vlist,this.nlist,3,j,Y,c,h,z,C));I&4&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,6,j,b,G,h,D,C));I&8&&(this.compNorm(k),this.compNorm(o),this.VIntY(k*3,this.vlist,this.nlist,9,j,b,c,h,B,D));I&16&&(this.compNorm(t),this.compNorm(w),this.VIntX(t*3,this.vlist,this.nlist,12,j,b,c,F,E,J));I&32&&(this.compNorm(w),
-this.compNorm(y),this.VIntY(w*3,this.vlist,this.nlist,15,j,Y,c,F,J,K));I&64&&(this.compNorm(u),this.compNorm(y),this.VIntX(u*3,this.vlist,this.nlist,18,j,b,G,F,O,K));I&128&&(this.compNorm(t),this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,21,j,b,c,F,E,O));I&256&&(this.compNorm(k),this.compNorm(t),this.VIntZ(k*3,this.vlist,this.nlist,24,j,b,c,h,B,E));I&512&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,27,j,Y,c,h,z,J));I&1024&&(this.compNorm(v),this.compNorm(y),this.VIntZ(v*
-3,this.vlist,this.nlist,30,j,Y,G,h,C,K));I&2048&&(this.compNorm(o),this.compNorm(u),this.VIntZ(o*3,this.vlist,this.nlist,33,j,b,G,h,D,O));x<<=4;for(j=k=0;THREE.triTable[x+j]!=-1;)b=x+j,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],m),j+=3,k++;return k};this.posnormtriv=function(b,c,h,k,j,m){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,j,m,p,o,t,u){j=(j-t)/(u-t);t=this.normal_cache;c[k]=m+j*this.delta;c[k+1]=p;c[k+2]=o;h[k]=this.lerp(t[b],t[b+3],j);h[k+1]=this.lerp(t[b+1],t[b+4],j);h[k+2]=this.lerp(t[b+2],t[b+5],j)};this.VIntY=function(b,c,h,k,j,m,p,o,t,u){j=(j-t)/(u-t);t=this.normal_cache;c[k]=m;c[k+1]=p+j*this.delta;c[k+
+2]=o;c=b+this.yd*3;h[k]=this.lerp(t[b],t[c],j);h[k+1]=this.lerp(t[b+1],t[c+1],j);h[k+2]=this.lerp(t[b+2],t[c+2],j)};this.VIntZ=function(b,c,h,k,j,m,p,o,t,u){j=(j-t)/(u-t);t=this.normal_cache;c[k]=m;c[k+1]=p;c[k+2]=o+j*this.delta;c=b+this.zd*3;h[k]=this.lerp(t[b],t[c],j);h[k+1]=this.lerp(t[b+1],t[c+1],j);h[k+2]=this.lerp(t[b+2],t[c+2],j)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,h,k,j,m){var p=k+1,o=k+this.yd,t=k+this.zd,u=p+this.yd,w=p+this.zd,v=k+this.yd+this.zd,y=p+this.yd+this.zd,x=0,B=this.field[k],z=this.field[p],D=this.field[o],C=this.field[u],E=this.field[t],J=this.field[w],O=this.field[v],K=this.field[y];B<j&&(x|=1);z<j&&(x|=2);D<j&&(x|=8);C<j&&(x|=4);E<j&&(x|=16);J<j&&(x|=32);O<j&&(x|=128);K<j&&(x|=64);var H=THREE.edgeTable[x];if(H==0)return 0;var F=this.delta,
+T=b+F,G=c+F,F=h+F;H&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,j,b,c,h,B,z));H&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,j,T,c,h,z,C));H&4&&(this.compNorm(o),this.compNorm(u),this.VIntX(o*3,this.vlist,this.nlist,6,j,b,G,h,D,C));H&8&&(this.compNorm(k),this.compNorm(o),this.VIntY(k*3,this.vlist,this.nlist,9,j,b,c,h,B,D));H&16&&(this.compNorm(t),this.compNorm(w),this.VIntX(t*3,this.vlist,this.nlist,12,j,b,c,F,E,J));H&32&&(this.compNorm(w),
+this.compNorm(y),this.VIntY(w*3,this.vlist,this.nlist,15,j,T,c,F,J,K));H&64&&(this.compNorm(v),this.compNorm(y),this.VIntX(v*3,this.vlist,this.nlist,18,j,b,G,F,O,K));H&128&&(this.compNorm(t),this.compNorm(v),this.VIntY(t*3,this.vlist,this.nlist,21,j,b,c,F,E,O));H&256&&(this.compNorm(k),this.compNorm(t),this.VIntZ(k*3,this.vlist,this.nlist,24,j,b,c,h,B,E));H&512&&(this.compNorm(p),this.compNorm(w),this.VIntZ(p*3,this.vlist,this.nlist,27,j,T,c,h,z,J));H&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
+3,this.vlist,this.nlist,30,j,T,G,h,C,K));H&2048&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*3,this.vlist,this.nlist,33,j,b,G,h,D,O));x<<=4;for(j=k=0;THREE.triTable[x+j]!=-1;)b=x+j,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],m),j+=3,k++;return k};this.posnormtriv=function(b,c,h,k,j,m){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
 4]=b[k+1];this.positionArray[p+5]=b[k+2];this.positionArray[p+6]=b[j];this.positionArray[p+7]=b[j+1];this.positionArray[p+8]=b[j+2];this.normalArray[p]=c[h];this.normalArray[p+1]=c[h+1];this.normalArray[p+2]=c[h+2];this.normalArray[p+3]=c[k];this.normalArray[p+4]=c[k+1];this.normalArray[p+5]=c[k+2];this.normalArray[p+6]=c[j];this.normalArray[p+7]=c[j+1];this.normalArray[p+8]=c[j+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&m(this)};this.begin=function(){this.count=0;
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,k,j){var m=this.size*Math.sqrt(k/j),p=h*this.size,o=c*this.size,t=b*this.size,v=Math.floor(p-m);v<1&&(v=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var w=Math.floor(o-m);w<1&&(w=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var u=Math.floor(t-m);u<1&&(u=1);m=Math.floor(t+m);m>this.size-1&&(m=this.size-
-1);for(var y,x,B,z,D,C;v<p;v++){t=this.size2*v;x=v/this.size-h;D=x*x;for(x=w;x<o;x++){B=t+this.size*x;y=x/this.size-c;C=y*y;for(y=u;y<m;y++)z=y/this.size-b,z=k/(1.0E-6+z*z+C+D)-j,z>0&&(this.field[B+y]+=z)}}};this.addPlaneX=function(b,c){var h,k,j,m,p,o=this.size,t=this.yd,v=this.zd,w=this.field,u=o*Math.sqrt(b/c);u>o&&(u=o);for(h=0;h<u;h++)if(k=h/o,k*=k,m=b/(1.0E-4+k)-c,m>0)for(k=0;k<o;k++){p=h+k*t;for(j=0;j<o;j++)w[v*j+p]+=m}};this.addPlaneY=function(b,c){var h,k,j,m,p,o,t=this.size,v=this.yd,w=
-this.zd,u=this.field,y=t*Math.sqrt(b/c);y>t&&(y=t);for(k=0;k<y;k++)if(h=k/t,h*=h,m=b/(1.0E-4+h)-c,m>0){p=k*v;for(h=0;h<t;h++){o=p+h;for(j=0;j<t;j++)u[w*j+o]+=m}}};this.addPlaneZ=function(b,c){var h,k,j,m,p,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(h=j/size,h*=h,m=b/(1.0E-4+h)-c,m>0){p=zd*j;for(k=0;k<size;k++){o=p+k*yd;for(h=0;h<size;h++)field[o+h]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,h,k,j,m,p,o,t,v,w=this.size-2;for(j=1;j<w;j++){v=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(k=1;k<w;k++){t=v+this.size*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<w;h++)m=(h-this.halfsize)/this.halfsize,c=t+h,this.polygonize(m,p,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var j,m,p,o,t,v,w,u;for(j=0;j<k.count;j++)w=j*3,t=w+1,u=w+2,m=k.positionArray[w],
-p=k.positionArray[t],o=k.positionArray[u],v=new THREE.Vector3(m,p,o),m=k.normalArray[w],p=k.normalArray[t],o=k.normalArray[u],w=new THREE.Vector3(m,p,o),w.normalize(),t=new THREE.Vertex(v),c.vertices.push(t),h.push(w);nfaces=k.count/3;for(j=0;j<nfaces;j++)w=(b+j)*3,t=w+1,u=w+2,v=h[w],m=h[t],p=h[u],w=new THREE.Face3(w,t,u,[v,m,p]),c.faces.push(w);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,k,j){var m=this.size*Math.sqrt(k/j),p=h*this.size,o=c*this.size,t=b*this.size,u=Math.floor(p-m);u<1&&(u=1);p=Math.floor(p+m);p>this.size-1&&(p=this.size-1);var w=Math.floor(o-m);w<1&&(w=1);o=Math.floor(o+m);o>this.size-1&&(o=this.size-1);var v=Math.floor(t-m);v<1&&(v=1);m=Math.floor(t+m);m>this.size-1&&(m=this.size-
+1);for(var y,x,B,z,D,C;u<p;u++){t=this.size2*u;x=u/this.size-h;D=x*x;for(x=w;x<o;x++){B=t+this.size*x;y=x/this.size-c;C=y*y;for(y=v;y<m;y++)z=y/this.size-b,z=k/(1.0E-6+z*z+C+D)-j,z>0&&(this.field[B+y]+=z)}}};this.addPlaneX=function(b,c){var h,k,j,m,p,o=this.size,t=this.yd,u=this.zd,w=this.field,v=o*Math.sqrt(b/c);v>o&&(v=o);for(h=0;h<v;h++)if(k=h/o,k*=k,m=b/(1.0E-4+k)-c,m>0)for(k=0;k<o;k++){p=h+k*t;for(j=0;j<o;j++)w[u*j+p]+=m}};this.addPlaneY=function(b,c){var h,k,j,m,p,o,t=this.size,u=this.yd,w=
+this.zd,v=this.field,y=t*Math.sqrt(b/c);y>t&&(y=t);for(k=0;k<y;k++)if(h=k/t,h*=h,m=b/(1.0E-4+h)-c,m>0){p=k*u;for(h=0;h<t;h++){o=p+h;for(j=0;j<t;j++)v[w*j+o]+=m}}};this.addPlaneZ=function(b,c){var h,k,j,m,p,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(j=0;j<dist;j++)if(h=j/size,h*=h,m=b/(1.0E-4+h)-c,m>0){p=zd*j;for(k=0;k<size;k++){o=p+k*yd;for(h=0;h<size;h++)field[o+h]+=m}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,h,k,j,m,p,o,t,u,w=this.size-2;for(j=1;j<w;j++){u=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(k=1;k<w;k++){t=u+this.size*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<w;h++)m=(h-this.halfsize)/this.halfsize,c=t+h,this.polygonize(m,p,o,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var j,m,p,o,t,u,w,v;for(j=0;j<k.count;j++)w=j*3,t=w+1,v=w+2,m=k.positionArray[w],
+p=k.positionArray[t],o=k.positionArray[v],u=new THREE.Vector3(m,p,o),m=k.normalArray[w],p=k.normalArray[t],o=k.normalArray[v],w=new THREE.Vector3(m,p,o),w.normalize(),t=new THREE.Vertex(u),c.vertices.push(t),h.push(w);nfaces=k.count/3;for(j=0;j<nfaces;j++)w=(b+j)*3,t=w+1,v=w+2,u=h[w],m=h[t],p=h[v],w=new THREE.Face3(w,t,v,[u,m,p]),c.faces.push(w);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
@@ -619,9 +619,9 @@ f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,m,0);break;case
 THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
 THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
 THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,p,o,t;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},v=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.WebGLRenderTarget(512,512,b),u=new THREE.Camera(53,1,1,1E4);u.position.z=
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:v},mapRight:{type:"t",value:1,texture:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
-var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);v.width=b;v.height=f;w.width=b;w.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||o!==e.near||t!==e.fov){p=e.aspect;o=e.near;t=e.fov;var z=e.projectionMatrix.clone(),D=125/30*0.5,C=D*o/125,E=o*Math.tan(t*Math.PI/360),J;j.n14=D;m.n14=-D;D=-E*p+C;J=E*p+C;z.n11=2*o/(J-D);z.n13=(J+D)/(J-D);h.projectionMatrix=z.clone();D=-E*p-C;J=E*p-C;z.n11=2*o/(J-D);
-z.n13=(J+D)/(J-D);k.projectionMatrix=z.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=o;h.far=e.far;f.call(c,b,h,v,!0);k.matrix=e.matrixWorld.clone().multiplySelf(j);k.update(null,!0);k.position.copy(e.position);k.near=o;k.far=e.far;f.call(c,b,k,w,!0);f.call(c,y,u)}};
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,j=new THREE.Matrix4,m=new THREE.Matrix4,p,o,t;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.Camera(53,1,1,1E4);v.position.z=
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:w}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
+var y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;w.width=b;w.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||o!==e.near||t!==e.fov){p=e.aspect;o=e.near;t=e.fov;var z=e.projectionMatrix.clone(),D=125/30*0.5,C=D*o/125,E=o*Math.tan(t*Math.PI/360),J;j.n14=D;m.n14=-D;D=-E*p+C;J=E*p+C;z.n11=2*o/(J-D);z.n13=(J+D)/(J-D);h.projectionMatrix=z.clone();D=-E*p-C;J=E*p-C;z.n11=2*o/(J-D);
+z.n13=(J+D)/(J-D);k.projectionMatrix=z.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(m);h.update(null,!0);h.position.copy(e.position);h.near=o;h.far=e.far;f.call(c,b,h,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(j);k.update(null,!0);k.position.copy(e.position);k.near=o;k.far=e.far;f.call(c,b,k,w,!0);f.call(c,y,v)}};
 if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,k,j=new THREE.Camera,m=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();j.fov=e.fov;j.aspect=0.5*e.aspect;j.near=e.near;j.far=e.far;
 j.updateProjectionMatrix();j.position.copy(e.position);j.target.position.copy(e.target.position);j.translateX(c.separation);m.projectionMatrix=j.projectionMatrix;m.position.copy(e.position);m.target.position.copy(e.target.position);m.translateX(-c.separation);this.setViewport(0,0,h,k);f.call(c,b,j);this.setViewport(h,0,h,k);f.call(c,b,m,!1)}};

+ 147 - 147
build/custom/ThreeWebGL.js

@@ -16,36 +16,36 @@ b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;thi
 normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
 THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)e=e.concat(this.intersectObject(b[c]));e.sort(function(b,c){return b.distance-c.distance});return e},intersectObject:function(b){function c(b,c,d){var e;e=d.clone().subSelf(b).dot(c);if(e<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(e));return d.distanceTo(b)}function d(b,c,d,e){var e=e.clone().subSelf(c),
 d=d.clone().subSelf(c),j=b.clone().subSelf(c),b=e.dot(e),c=e.dot(d),e=e.dot(j),h=d.dot(d),d=d.dot(j),j=1/(b*h-c*c),h=(h*e-c*d)*j,b=(b*d-c*e)*j;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
-Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,r,p,n,q,s,w,C=b.geometry,y=C.vertices,F=[],e=0;for(j=C.faces.length;e<j;e++)if(h=C.faces[e],s=this.origin.clone(),w=this.direction.clone(),p=b.matrixWorld,k=p.multiplyVector3(h.centroid.clone()).subSelf(s),q=k.dot(w),!(q<=0)&&(k=p.multiplyVector3(y[h.a].position.clone()),m=p.multiplyVector3(y[h.b].position.clone()),r=p.multiplyVector3(y[h.c].position.clone()),p=h instanceof THREE.Face4?p.multiplyVector3(y[h.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
-q=w.dot(n),b.doubleSided||(b.flipSided?q>0:q<0)))if(q=n.dot((new THREE.Vector3).sub(k,s))/q,s=s.addSelf(w.multiplyScalar(q)),h instanceof THREE.Face3)d(s,k,m,r)&&(h={distance:this.origin.distanceTo(s),point:s,face:h,object:b},F.push(h));else if(h instanceof THREE.Face4&&(d(s,k,m,p)||d(s,m,r,p)))h={distance:this.origin.distanceTo(s),point:s,face:h,object:b},F.push(h);F.sort(function(b,c){return b.distance-c.distance});return F}else return[]}};
-THREE.Rectangle=function(){function b(){h=e-c;k=j-d}var c,d,e,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return j};this.set=function(h,k,n,q){m=!1;c=h;d=k;e=n;j=q;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,e=h,j=k):(c=c<h?c:h,d=d<k?d:k,e=e>h?e:h,j=j>k?j:k);b()};this.add3Points=
-function(h,k,n,q,s,w){m?(m=!1,c=h<n?h<s?h:s:n<s?n:s,d=k<q?k<w?k:w:q<w?q:w,e=h>n?h>s?h:s:n>s?n:s,j=k>q?k>w?k:w:q>w?q:w):(c=h<n?h<s?h<c?h:c:s<c?s:c:n<s?n<c?n:c:s<c?s:c,d=k<q?k<w?k<d?k:d:w<d?w:d:q<w?q<d?q:d:w<d?w:d,e=h>n?h>s?h>e?h:e:s>e?s:e:n>s?n>e?n:e:s>e?s:e,j=k>q?k>w?k>j?k:j:w>j?w:j:q>w?q>j?q:j:w>j?w:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),j=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),e=e>h.getRight()?e:h.getRight(),j=j>
+Math.max(b.scale.y,b.scale.z)))return[];var j,h,k,m,r,n,q,s,u,v,B=b.geometry,y=B.vertices,E=[],e=0;for(j=B.faces.length;e<j;e++)if(h=B.faces[e],u=this.origin.clone(),v=this.direction.clone(),n=b.matrixWorld,k=n.multiplyVector3(h.centroid.clone()).subSelf(u),s=k.dot(v),!(s<=0)&&(k=n.multiplyVector3(y[h.a].position.clone()),m=n.multiplyVector3(y[h.b].position.clone()),r=n.multiplyVector3(y[h.c].position.clone()),n=h instanceof THREE.Face4?n.multiplyVector3(y[h.d].position.clone()):null,q=b.matrixRotationWorld.multiplyVector3(h.normal.clone()),
+s=v.dot(q),b.doubleSided||(b.flipSided?s>0:s<0)))if(s=q.dot((new THREE.Vector3).sub(k,u))/s,u=u.addSelf(v.multiplyScalar(s)),h instanceof THREE.Face3)d(u,k,m,r)&&(h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},E.push(h));else if(h instanceof THREE.Face4&&(d(u,k,m,n)||d(u,m,r,n)))h={distance:this.origin.distanceTo(u),point:u,face:h,object:b},E.push(h);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}};
+THREE.Rectangle=function(){function b(){h=e-c;k=j-d}var c,d,e,j,h,k,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return j};this.set=function(h,k,q,s){m=!1;c=h;d=k;e=q;j=s;b()};this.addPoint=function(h,k){m?(m=!1,c=h,d=k,e=h,j=k):(c=c<h?c:h,d=d<k?d:k,e=e>h?e:h,j=j>k?j:k);b()};this.add3Points=
+function(h,k,q,s,u,v){m?(m=!1,c=h<q?h<u?h:u:q<u?q:u,d=k<s?k<v?k:v:s<v?s:v,e=h>q?h>u?h:u:q>u?q:u,j=k>s?k>v?k:v:s>v?s:v):(c=h<q?h<u?h<c?h:c:u<c?u:c:q<u?q<c?q:c:u<c?u:c,d=k<s?k<v?k<d?k:d:v<d?v:d:s<v?s<d?s:d:v<d?v:d,e=h>q?h>u?h>e?h:e:u>e?u:e:q>u?q>e?q:e:u>e?u:e,j=k>s?k>v?k>j?k:j:v>j?v:j:s>v?s>j?s:j:v>j?v:j);b()};this.addRectangle=function(h){m?(m=!1,c=h.getLeft(),d=h.getTop(),e=h.getRight(),j=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),d=d<h.getTop()?d:h.getTop(),e=e>h.getRight()?e:h.getRight(),j=j>
 h.getBottom()?j:h.getBottom());b()};this.inflate=function(h){c-=h;d-=h;e+=h;j+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e<h.getRight()?e:h.getRight();j=j<h.getBottom()?j:h.getBottom();b()};this.instersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(j,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){m=!0;j=e=d=c=0;b()};this.isEmpty=function(){return m}};THREE.Matrix3=function(){this.m=[]};
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,j,h,k,m,r,p,n,q,s,w,C,y){this.set(b||1,c||0,d||0,e||0,j||0,h||1,k||0,m||0,r||0,p||0,n||1,q||0,s||0,w||0,C||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,j,h,k,m,r,p,n,q,s,w,C,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=r;this.n32=p;this.n33=n;this.n34=q;this.n41=s;this.n42=w;this.n43=C;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,j,h,k,m,r,n,q,s,u,v,B,y){this.set(b||1,c||0,d||0,e||0,j||0,h||1,k||0,m||0,r||0,n||0,q||1,s||0,u||0,v||0,B||0,y||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,j,h,k,m,r,n,q,s,u,v,B,y){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=j;this.n22=h;this.n23=k;this.n24=m;this.n31=r;this.n32=n;this.n33=q;this.n34=s;this.n41=u;this.n42=v;this.n43=B;this.n44=y;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
 c,d){var e=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(b,c).normalize();if(h.length()===0)h.z=1;e.cross(d,h).normalize();e.length()===0&&(h.x+=1.0E-4,e.cross(d,h).normalize());j.cross(h,e).normalize();this.n11=e.x;this.n12=j.x;this.n13=h.x;this.n21=e.y;this.n22=j.y;this.n23=h.y;this.n31=e.z;this.n32=j.z;this.n33=h.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,j=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*j;
 b.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*j;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*j;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,j=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*j;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*j;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*j;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*j;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+
-d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,q=b.n32,s=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44,xa=c.n11,ya=
-c.n12,ka=c.n13,oa=c.n14,R=c.n21,M=c.n22,v=c.n23,U=c.n24,N=c.n31,Z=c.n32,S=c.n33,V=c.n34,H=c.n41,f=c.n42,ua=c.n43,Fa=c.n44;this.n11=d*xa+e*R+j*N+h*H;this.n12=d*ya+e*M+j*Z+h*f;this.n13=d*ka+e*v+j*S+h*ua;this.n14=d*oa+e*U+j*V+h*Fa;this.n21=k*xa+m*R+r*N+p*H;this.n22=k*ya+m*M+r*Z+p*f;this.n23=k*ka+m*v+r*S+p*ua;this.n24=k*oa+m*U+r*V+p*Fa;this.n31=n*xa+q*R+s*N+w*H;this.n32=n*ya+q*M+s*Z+w*f;this.n33=n*ka+q*v+s*S+w*ua;this.n34=n*oa+q*U+s*V+w*Fa;this.n41=C*xa+y*R+F*N+L*H;this.n42=C*ya+y*M+F*Z+L*f;this.n43=
-C*ka+y*v+F*S+L*ua;this.n44=C*oa+y*U+F*V+L*Fa;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
-b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,r=this.n31,p=this.n32,n=this.n33,q=this.n34,s=this.n41,w=this.n42,C=this.n43,y=this.n44;return e*k*p*s-d*m*p*s-e*h*n*s+c*m*n*s+d*h*q*s-c*k*q*s-e*k*r*w+d*m*r*w+e*j*n*w-b*m*n*w-d*j*q*w+b*k*q*w+e*h*r*C-c*m*r*C-e*j*p*C+b*m*p*C+c*j*q*C-b*h*q*C-d*h*r*y+c*k*
-r*y+d*j*p*y-b*k*p*y-c*j*n*y+b*h*n*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
+d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,n=b.n24,q=b.n31,s=b.n32,u=b.n33,v=b.n34,B=b.n41,y=b.n42,E=b.n43,K=b.n44,wa=c.n11,xa=
+c.n12,ja=c.n13,na=c.n14,R=c.n21,L=c.n22,w=c.n23,T=c.n24,M=c.n31,Y=c.n32,S=c.n33,U=c.n34,I=c.n41,f=c.n42,ta=c.n43,Ea=c.n44;this.n11=d*wa+e*R+j*M+h*I;this.n12=d*xa+e*L+j*Y+h*f;this.n13=d*ja+e*w+j*S+h*ta;this.n14=d*na+e*T+j*U+h*Ea;this.n21=k*wa+m*R+r*M+n*I;this.n22=k*xa+m*L+r*Y+n*f;this.n23=k*ja+m*w+r*S+n*ta;this.n24=k*na+m*T+r*U+n*Ea;this.n31=q*wa+s*R+u*M+v*I;this.n32=q*xa+s*L+u*Y+v*f;this.n33=q*ja+s*w+u*S+v*ta;this.n34=q*na+s*T+u*U+v*Ea;this.n41=B*wa+y*R+E*M+K*I;this.n42=B*xa+y*L+E*Y+K*f;this.n43=
+B*ja+y*w+E*S+K*ta;this.n44=B*na+y*T+E*U+K*Ea;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
+b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,j=this.n21,h=this.n22,k=this.n23,m=this.n24,r=this.n31,n=this.n32,q=this.n33,s=this.n34,u=this.n41,v=this.n42,B=this.n43,y=this.n44;return e*k*n*u-d*m*n*u-e*h*q*u+c*m*q*u+d*h*s*u-c*k*s*u-e*k*r*v+d*m*r*v+e*j*q*v-b*m*q*v-d*j*s*v+b*k*s*v+e*h*r*B-c*m*r*B-e*j*n*B+b*m*n*B+c*j*s*B-b*h*s*B-d*h*r*y+c*k*
+r*y+d*j*n*y-b*k*n*y-c*j*q*y+b*h*q*y},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
 b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=
 this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
 this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
-0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,r=j*h,p=j*k;this.set(r*h+d,r*k-e*m,r*m+e*k,0,r*k+e*m,p*k+d,p*m-e*h,0,r*m-e*k,p*m+e*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
+0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),j=1-d,h=b.x,k=b.y,m=b.z,r=j*h,n=j*k;this.set(r*h+d,r*k-e*m,r*m+e*k,0,r*k+e*m,n*k+d,n*m-e*h,0,r*m-e*k,n*m+e*h,j*m*m+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
 new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,e=b.y,j=b.z,h=Math.cos(d),d=Math.sin(d),k=Math.cos(e),e=Math.sin(e),m=Math.cos(j),j=Math.sin(j);switch(c){case "YXZ":var r=
-k*m,p=k*j,n=e*m,q=e*j;this.n11=r+q*d;this.n12=n*d-p;this.n13=h*e;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=p*d-n;this.n32=q+r*d;this.n33=h*k;break;case "ZXY":r=k*m;p=k*j;n=e*m;q=e*j;this.n11=r-q*d;this.n12=-h*j;this.n13=n+p*d;this.n21=p+n*d;this.n22=h*m;this.n23=q-r*d;this.n31=-h*e;this.n32=d;this.n33=h*k;break;case "ZYX":r=h*m;p=h*j;n=d*m;q=d*j;this.n11=k*m;this.n12=n*e-p;this.n13=r*e+q;this.n21=k*j;this.n22=q*e+r;this.n23=p*e-n;this.n31=-e;this.n32=d*k;this.n33=h*k;break;case "YZX":r=h*k;p=
-h*e;n=d*k;q=d*e;this.n11=k*m;this.n12=q-r*j;this.n13=n*j+p;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-e*m;this.n32=p*j+n;this.n33=r-q*j;break;case "XZY":r=h*k;p=h*e;n=d*k;q=d*e;this.n11=k*m;this.n12=-j;this.n13=e*m;this.n21=r*j+q;this.n22=h*m;this.n23=p*j-n;this.n31=n*j-p;this.n32=d*m;this.n33=q*j+r;break;default:r=h*m,p=h*j,n=d*m,q=d*j,this.n11=k*m,this.n12=-k*j,this.n13=e,this.n21=p+n*e,this.n22=r-q*e,this.n23=-d*k,this.n31=q-r*e,this.n32=n+p*e,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=
-b.x,d=b.y,e=b.z,j=b.w,h=c+c,k=d+d,m=e+e,b=c*h,r=c*k;c*=m;var p=d*k;d*=m;e*=m;h*=j;k*=j;j*=m;this.n11=1-(p+e);this.n12=r-j;this.n13=c+k;this.n21=r+j;this.n22=1-(b+e);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+p);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2;
+k*m,n=k*j,q=e*m,s=e*j;this.n11=r+s*d;this.n12=q*d-n;this.n13=h*e;this.n21=h*j;this.n22=h*m;this.n23=-d;this.n31=n*d-q;this.n32=s+r*d;this.n33=h*k;break;case "ZXY":r=k*m;n=k*j;q=e*m;s=e*j;this.n11=r-s*d;this.n12=-h*j;this.n13=q+n*d;this.n21=n+q*d;this.n22=h*m;this.n23=s-r*d;this.n31=-h*e;this.n32=d;this.n33=h*k;break;case "ZYX":r=h*m;n=h*j;q=d*m;s=d*j;this.n11=k*m;this.n12=q*e-n;this.n13=r*e+s;this.n21=k*j;this.n22=s*e+r;this.n23=n*e-q;this.n31=-e;this.n32=d*k;this.n33=h*k;break;case "YZX":r=h*k;n=
+h*e;q=d*k;s=d*e;this.n11=k*m;this.n12=s-r*j;this.n13=q*j+n;this.n21=j;this.n22=h*m;this.n23=-d*m;this.n31=-e*m;this.n32=n*j+q;this.n33=r-s*j;break;case "XZY":r=h*k;n=h*e;q=d*k;s=d*e;this.n11=k*m;this.n12=-j;this.n13=e*m;this.n21=r*j+s;this.n22=h*m;this.n23=n*j-q;this.n31=q*j-n;this.n32=d*m;this.n33=s*j+r;break;default:r=h*m,n=h*j,q=d*m,s=d*j,this.n11=k*m,this.n12=-k*j,this.n13=e,this.n21=n+q*e,this.n22=r-s*e,this.n23=-d*k,this.n31=s-r*e,this.n32=q+n*e,this.n33=h*k}return this},setRotationFromQuaternion:function(b){var c=
+b.x,d=b.y,e=b.z,j=b.w,h=c+c,k=d+d,m=e+e,b=c*h,r=c*k;c*=m;var n=d*k;d*=m;e*=m;h*=j;k*=j;j*=m;this.n11=1-(n+e);this.n12=r-j;this.n13=c+k;this.n21=r+j;this.n22=1-(b+e);this.n23=d-h;this.n31=c-k;this.n32=d+h;this.n33=1-(b+n);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,j=THREE.Matrix4.__m2;
 e.identity();e.setRotationFromQuaternion(c);j.setScale(d.x,d.y,d.z);this.multiply(e,j);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var e=THREE.Matrix4.__v1,j=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);j.set(this.n12,this.n22,this.n32);h.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=e.length();
 d.y=j.length();d.z=h.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=d.x;e.n21/=d.x;e.n31/=d.x;e.n12/=d.y;e.n22/=d.y;e.n32/=d.y;e.n13/=d.z;e.n23/=d.z;e.n33/=d.z;c.setFromRotationMatrix(e);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,j=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*j;this.n23=
 b.n23*j;this.n33=b.n33*j}};
-THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,p=b.n24,n=b.n31,q=b.n32,s=b.n33,w=b.n34,C=b.n41,y=b.n42,F=b.n43,L=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=r*w*y-p*s*y+p*q*F-m*w*F-r*q*L+m*s*L;c.n12=h*s*y-j*w*y-h*q*F+e*w*F+j*q*L-e*s*L;c.n13=j*p*y-h*r*y+h*m*F-e*p*F-j*m*L+e*r*L;c.n14=h*r*q-j*p*q-h*m*s+e*p*s+j*m*w-e*r*w;c.n21=p*s*C-r*w*C-p*n*F+k*w*F+r*n*L-k*s*L;c.n22=j*w*C-h*s*C+h*n*F-d*w*F-j*n*L+d*s*L;c.n23=h*r*C-j*p*C-h*k*F+d*p*F+j*k*L-d*r*L;c.n24=
-j*p*n-h*r*n+h*k*s-d*p*s-j*k*w+d*r*w;c.n31=m*w*C-p*q*C+p*n*y-k*w*y-m*n*L+k*q*L;c.n32=h*q*C-e*w*C-h*n*y+d*w*y+e*n*L-d*q*L;c.n33=j*p*C-h*m*C+h*k*y-d*p*y-e*k*L+d*m*L;c.n34=h*m*n-e*p*n-h*k*q+d*p*q+e*k*w-d*m*w;c.n41=r*q*C-m*s*C-r*n*y+k*s*y+m*n*F-k*q*F;c.n42=e*s*C-j*q*C+j*n*y-d*s*y-e*n*F+d*q*F;c.n43=j*m*C-e*r*C-j*k*y+d*r*y+e*k*F-d*m*F;c.n44=e*r*n-j*m*n+j*k*q-d*r*q-e*k*s+d*m*s;c.multiplyScalar(1/b.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,p=b.n23*b.n12-b.n22*b.n13,n=-b.n23*b.n11+b.n21*b.n13,q=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*k+b.n31*p;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*r;d[6]=b*p;d[7]=b*n;d[8]=b*q;return c};
+THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,j=b.n13,h=b.n14,k=b.n21,m=b.n22,r=b.n23,n=b.n24,q=b.n31,s=b.n32,u=b.n33,v=b.n34,B=b.n41,y=b.n42,E=b.n43,K=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=r*v*y-n*u*y+n*s*E-m*v*E-r*s*K+m*u*K;c.n12=h*u*y-j*v*y-h*s*E+e*v*E+j*s*K-e*u*K;c.n13=j*n*y-h*r*y+h*m*E-e*n*E-j*m*K+e*r*K;c.n14=h*r*s-j*n*s-h*m*u+e*n*u+j*m*v-e*r*v;c.n21=n*u*B-r*v*B-n*q*E+k*v*E+r*q*K-k*u*K;c.n22=j*v*B-h*u*B+h*q*E-d*v*E-j*q*K+d*u*K;c.n23=h*r*B-j*n*B-h*k*E+d*n*E+j*k*K-d*r*K;c.n24=
+j*n*q-h*r*q+h*k*u-d*n*u-j*k*v+d*r*v;c.n31=m*v*B-n*s*B+n*q*y-k*v*y-m*q*K+k*s*K;c.n32=h*s*B-e*v*B-h*q*y+d*v*y+e*q*K-d*s*K;c.n33=j*n*B-h*m*B+h*k*y-d*n*y-e*k*K+d*m*K;c.n34=h*m*q-e*n*q-h*k*s+d*n*s+e*k*v-d*m*v;c.n41=r*s*B-m*u*B-r*q*y+k*u*y+m*q*E-k*s*E;c.n42=e*u*B-j*s*B+j*q*y-d*u*y-e*q*E+d*s*E;c.n43=j*m*B-e*r*B-j*k*y+d*r*y+e*k*E-d*m*E;c.n44=e*r*q-j*m*q+j*k*s-d*r*s-e*k*u+d*m*u;c.multiplyScalar(1/b.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,j=-b.n33*b.n21+b.n31*b.n23,h=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,m=b.n33*b.n11-b.n31*b.n13,r=-b.n32*b.n11+b.n31*b.n12,n=b.n23*b.n12-b.n22*b.n13,q=-b.n23*b.n11+b.n21*b.n13,s=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*k+b.n31*n;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*j;d[2]=b*h;d[3]=b*k;d[4]=b*m;d[5]=b*r;d[6]=b*n;d[7]=b*q;d[8]=b*s;return c};
 THREE.Matrix4.makeFrustum=function(b,c,d,e,j,h){var k;k=new THREE.Matrix4;k.n11=2*j/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*j/(e-d);k.n23=(e+d)/(e-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(h+j)/(h-j);k.n34=-2*h*j/(h-j);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,d,e){var j,b=d*Math.tan(b*Math.PI/360);j=-b;return THREE.Matrix4.makeFrustum(j*c,b*c,j,b,d,e)};
-THREE.Matrix4.makeOrtho=function(b,c,d,e,j,h){var k,m,r,p;k=new THREE.Matrix4;m=c-b;r=d-e;p=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/r;k.n23=0;k.n24=-((d+e)/r);k.n31=0;k.n32=0;k.n33=-2/p;k.n34=-((h+j)/p);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
+THREE.Matrix4.makeOrtho=function(b,c,d,e,j,h){var k,m,r,n;k=new THREE.Matrix4;m=c-b;r=d-e;n=h-j;k.n11=2/m;k.n12=0;k.n13=0;k.n14=-((c+b)/m);k.n21=0;k.n22=2/r;k.n23=0;k.n24=-((d+e)/r);k.n31=0;k.n32=0;k.n33=-2/n;k.n34=-((h+j)/n);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
 THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
 !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3;this.name=""};
 THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
@@ -55,8 +55,8 @@ this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matri
 THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,j=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-j),j=Math.sin(-j),h=Math.cos(d),d=Math.sin(d),k=b*c,m=e*j;this.w=k*h-m*d;this.x=k*d+m*h;this.y=e*c*h+b*j*d;this.z=b*j*h-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);
 this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
-this.x,d=this.y,e=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-e*k;this.y=d*b+j*k+e*h-c*m;this.z=e*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-e*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,j=b.z,h=this.x,k=this.y,m=this.z,r=this.w,p=r*d+k*j-m*e,n=r*e+m*d-h*j,q=r*j+h*e-k*d,d=-h*
-d-k*e-m*j;c.x=p*r+d*-h+n*-m-q*-k;c.y=n*r+d*-k+q*-h-p*-m;c.z=q*r+d*-m+p*-k-n*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;d.w=b.w*j+c.w*e;d.x=b.x*j+c.x*e;d.y=b.y*j+c.y*e;d.z=b.z*j+c.z*e;return d};
+this.x,d=this.y,e=this.z,j=this.w,h=b.x,k=b.y,m=b.z,b=b.w;this.x=c*b+j*h+d*m-e*k;this.y=d*b+j*k+e*h-c*m;this.z=e*b+j*m+c*k-d*h;this.w=j*b-c*h-d*k-e*m;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,j=b.z,h=this.x,k=this.y,m=this.z,r=this.w,n=r*d+k*j-m*e,q=r*e+m*d-h*j,s=r*j+h*e-k*d,d=-h*
+d-k*e-m*j;c.x=n*r+d*-h+q*-m-s*-k;c.y=q*r+d*-k+s*-h-n*-m;c.z=s*r+d*-m+n*-k-q*-h;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var j=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(j)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var h=Math.acos(j),k=Math.sqrt(1-j*j);if(Math.abs(k)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;j=Math.sin((1-e)*h)/k;e=Math.sin(e*h)/k;d.w=b.w*j+c.w*e;d.x=b.x*j+c.x*e;d.y=b.y*j+c.y*e;d.z=b.z*j+c.z*e;return d};
 THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,e,j,h){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
 THREE.Face4=function(b,c,d,e,j,h,k){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=j instanceof THREE.Vector3?j:new THREE.Vector3;this.vertexNormals=j instanceof Array?j:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
 THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
@@ -65,17 +65,17 @@ THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function()
 d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,j,h,k,m=new THREE.Vector3,r=new THREE.Vector3;e=0;for(j=this.faces.length;e<j;e++){h=this.faces[e];if(b&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else c=this.vertices[h.a],d=this.vertices[h.b],k=this.vertices[h.c],m.sub(k.position,d.position),r.sub(c.position,d.position),m.crossSelf(r);m.isZero()||
 m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=
 this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),
-d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,f,c,d,e,j,h){m=b.vertices[f].position;r=b.vertices[c].position;p=b.vertices[d].position;n=k[e];q=k[j];s=k[h];w=r.x-m.x;C=p.x-m.x;y=r.y-m.y;F=p.y-m.y;L=r.z-m.z;xa=p.z-m.z;ya=q.u-n.u;ka=s.u-n.u;oa=q.v-n.v;R=s.v-n.v;M=1/(ya*R-ka*oa);Z.set((R*
-w-oa*C)*M,(R*y-oa*F)*M,(R*L-oa*xa)*M);S.set((ya*C-ka*w)*M,(ya*F-ka*y)*M,(ya*xa-ka*L)*M);U[f].addSelf(Z);U[c].addSelf(Z);U[d].addSelf(Z);N[f].addSelf(S);N[c].addSelf(S);N[d].addSelf(S)}var c,d,e,j,h,k,m,r,p,n,q,s,w,C,y,F,L,xa,ya,ka,oa,R,M,v,U=[],N=[],Z=new THREE.Vector3,S=new THREE.Vector3,V=new THREE.Vector3,H=new THREE.Vector3,f=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)U[c]=new THREE.Vector3,N[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],
-h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var ua=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)f.copy(h.vertexNormals[e]),j=h[ua[e]],v=U[j],V.copy(v),V.subSelf(f.multiplyScalar(f.dot(v))).normalize(),H.cross(h.vertexNormals[e],v),j=H.dot(N[j]),j=j<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(V.x,V.y,V.z,j)}this.hasTangents=!0},computeBoundingBox:function(){var b;
+d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,f,c,d,e,j,h){m=b.vertices[f].position;r=b.vertices[c].position;n=b.vertices[d].position;q=k[e];s=k[j];u=k[h];v=r.x-m.x;B=n.x-m.x;y=r.y-m.y;E=n.y-m.y;K=r.z-m.z;wa=n.z-m.z;xa=s.u-q.u;ja=u.u-q.u;na=s.v-q.v;R=u.v-q.v;L=1/(xa*R-ja*na);Y.set((R*
+v-na*B)*L,(R*y-na*E)*L,(R*K-na*wa)*L);S.set((xa*B-ja*v)*L,(xa*E-ja*y)*L,(xa*wa-ja*K)*L);T[f].addSelf(Y);T[c].addSelf(Y);T[d].addSelf(Y);M[f].addSelf(S);M[c].addSelf(S);M[d].addSelf(S)}var c,d,e,j,h,k,m,r,n,q,s,u,v,B,y,E,K,wa,xa,ja,na,R,L,w,T=[],M=[],Y=new THREE.Vector3,S=new THREE.Vector3,U=new THREE.Vector3,I=new THREE.Vector3,f=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)T[c]=new THREE.Vector3,M[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)h=this.faces[c],k=this.faceVertexUvs[0][c],
+h instanceof THREE.Face3?b(this,h.a,h.b,h.c,0,1,2):h instanceof THREE.Face4&&(b(this,h.a,h.b,h.c,0,1,2),b(this,h.a,h.b,h.d,0,1,3));var ta=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(e=0;e<h.vertexNormals.length;e++)f.copy(h.vertexNormals[e]),j=h[ta[e]],w=T[j],U.copy(w),U.subSelf(f.multiplyScalar(f.dot(w))).normalize(),I.cross(h.vertexNormals[e],w),j=I.dot(M[j]),j=j<0?-1:1,h.vertexTangents[e]=new THREE.Vector4(U.x,U.y,U.z,j)}this.hasTangents=!0},computeBoundingBox:function(){var b;
 if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
 else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===
 void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=1,b[c].array.push(d))}var d,e,j,h,k,m={};d=0;for(e=this.faces.length;d<e;d++)k=this.faces[d],k instanceof THREE.Face3?(j=b(k.a,k.b),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.a,k.c),c(m,j,d)):k instanceof THREE.Face4&&(j=b(k.b,k.d),c(m,j,d),j=b(k.a,k.b),c(m,j,d),j=b(k.a,k.d),c(m,j,d),j=b(k.b,k.c),c(m,j,d),j=b(k.c,k.d),c(m,j,d));d=0;for(e=this.edges.length;d<e;d++){k=this.edges[d];j=k.vertexIndices[0];h=k.vertexIndices[1];
 k.faceIndices=m[b(j,h)].array;for(j=0;j<k.faceIndices.length;j++)h=k.faceIndices[j],k.faces.push(this.faces[h])}}};THREE.GeometryCount=0;
-THREE.Spline=function(b){function c(b,c,d,e,j,h,k){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*k+(-3*(c-d)-2*b-e)*h+b*j+c}this.points=b;var d=[],e={x:0,y:0,z:0},j,h,k,m,r,p,n,q,s;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){j=(this.points.length-1)*b;h=Math.floor(j);k=j-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;p=this.points[d[0]];n=this.points[d[1]];
-q=this.points[d[2]];s=this.points[d[3]];m=k*k;r=k*m;e.x=c(p.x,n.x,q.x,s.x,k,m,r);e.y=c(p.y,n.y,q.y,s.y,k,m,r);e.z=c(p.z,n.z,q.z,s.z,k,m,r);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);d=this.points.length*b;j.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
-m+=h.distanceTo(j),j.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(k[c]=m,e=c);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var c,d,e,j,h,k,m=[],p=new THREE.Vector3,r=this.getLength();m.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=r.chunks[c]-r.chunks[c-1];k=Math.ceil(b*d/r.total);j=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<k-1;d++)e=j+d*(1/k)*(h-j),position=this.getPoint(e),m.push(p.copy(position).clone());
-m.push(p.copy(this.points[c]).clone())}this.points=m}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,e,j){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=j||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
+THREE.Spline=function(b){function c(b,c,d,e,j,h,k){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*k+(-3*(c-d)-2*b-e)*h+b*j+c}this.points=b;var d=[],e={x:0,y:0,z:0},j,h,k,m,r,n,q,s,u;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){j=(this.points.length-1)*b;h=Math.floor(j);k=j-h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>this.points.length-2?h:h+1;d[3]=h>this.points.length-3?h:h+2;n=this.points[d[0]];q=this.points[d[1]];
+s=this.points[d[2]];u=this.points[d[3]];m=k*k;r=k*m;e.x=c(n.x,q.x,s.x,u.x,k,m,r);e.y=c(n.y,q.y,s.y,u.y,k,m,r);e.z=c(n.z,q.z,s.z,u.z,k,m,r);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,j=new THREE.Vector3,h=new THREE.Vector3,k=[],m=0;k[0]=0;b||(b=100);d=this.points.length*b;j.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
+m+=h.distanceTo(j),j.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(k[c]=m,e=c);k[k.length]=m;return{chunks:k,total:m}};this.reparametrizeByArcLength=function(b){var c,d,e,j,h,k,m=[],n=new THREE.Vector3,r=this.getLength();m.push(n.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=r.chunks[c]-r.chunks[c-1];k=Math.ceil(b*d/r.total);j=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<k-1;d++)e=j+d*(1/k)*(h-j),position=this.getPoint(e),m.push(n.copy(position).clone());
+m.push(n.copy(this.points[c]).clone())}this.points=m}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,e,j){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=j||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
 THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,e=b*d,b=Math.abs(b*c-e),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*b/this.fullWidth,e+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.setViewOffset=function(b,c,d,e,j,h){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=e;this.width=j;this.height=h;this.updateProjectionMatrix()};
@@ -128,17 +128,17 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
 THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
 THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
 THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
-THREE.Projector=function(){function b(){var b=r[m]=r[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var f=0,d=1,e=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return e>=0&&j>=0&&h>=0&&k>=0?!0:e<0&&j<0||h<0&&k<0?!1:(e<0?f=Math.max(f,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j))),h<0?f=Math.max(f,h/(h-k)):k<0&&(d=Math.min(d,h/(h-k))),d<f?!1:(b.lerpSelf(c,f),c.lerpSelf(b,1-d),!0))}var e,j,h=[],k,m,r=[],p,n,q=[],s,w=[],C,y,F=[],L,xa,ya=[],ka=[],oa=[],R=new THREE.Vector4,
-M=new THREE.Vector4,v=new THREE.Matrix4,U=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(b,c){v.multiply(c.projectionMatrix,c.matrixWorldInverse);v.multiplyVector3(b);return b};this.unprojectVector=function(b,c){v.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));v.multiplyVector3(b);return b};this.projectObjects=function(b,d,f){var k,
-m;j=ka.length=0;k=b.objects;b=0;for(d=k.length;b<d;b++){m=k[b];var p;if(!(p=!m.visible))if(p=m instanceof THREE.Mesh){a:{p=void 0;for(var r=m.matrixWorld,n=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),q=0;q<6;q++)if(p=N[q].x*r.n14+N[q].y*r.n24+N[q].z*r.n34+N[q].w,p<=n){p=!1;break a}p=!0}p=!p}if(!p)p=h[j]=h[j]||new THREE.RenderableObject,j++,e=p,R.copy(m.position),v.multiplyVector3(R),e.object=m,e.z=R.z,ka.push(e)}f&&ka.sort(c);return ka};this.projectScene=function(e,
-j,f){var h=j.near,R=j.far,ka,va,W,$,I,X,P,ma,ga,Q,za,Da,Ea,ia,sa,Aa,Ca;xa=y=s=n=oa.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);e.update(void 0,!1,j);v.multiply(j.projectionMatrix,j.matrixWorldInverse);N[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);N[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);N[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);N[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);N[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);N[5].set(v.n41+
-v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(ka=0;ka<6;ka++)ga=N[ka],ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z));ga=this.projectObjects(e,j,!0);e=0;for(ka=ga.length;e<ka;e++)if(Q=ga[e].object,Q.visible)if(za=Q.matrixWorld,Da=Q.matrixRotationWorld,Ea=Q.materials,ia=Q.overdraw,m=0,Q instanceof THREE.Mesh){sa=Q.geometry;$=sa.vertices;Aa=sa.faces;sa=sa.faceVertexUvs;va=0;for(W=$.length;va<W;va++)k=b(),k.positionWorld.copy($[va].position),za.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>h&&k.positionScreen.z<R;$=0;for(va=Aa.length;$<va;$++){W=Aa[$];if(W instanceof THREE.Face3)if(I=r[W.a],X=r[W.b],P=r[W.c],I.visible&&X.visible&&P.visible&&(Q.doubleSided||Q.flipSided!=(P.positionScreen.x-I.positionScreen.x)*(X.positionScreen.y-I.positionScreen.y)-(P.positionScreen.y-I.positionScreen.y)*(X.positionScreen.x-I.positionScreen.x)<0))ma=q[n]=q[n]||
-new THREE.RenderableFace3,n++,p=ma,p.v1.copy(I),p.v2.copy(X),p.v3.copy(P);else continue;else if(W instanceof THREE.Face4)if(I=r[W.a],X=r[W.b],P=r[W.c],ma=r[W.d],I.visible&&X.visible&&P.visible&&ma.visible&&(Q.doubleSided||Q.flipSided!=((ma.positionScreen.x-I.positionScreen.x)*(X.positionScreen.y-I.positionScreen.y)-(ma.positionScreen.y-I.positionScreen.y)*(X.positionScreen.x-I.positionScreen.x)<0||(X.positionScreen.x-P.positionScreen.x)*(ma.positionScreen.y-P.positionScreen.y)-(X.positionScreen.y-
-P.positionScreen.y)*(ma.positionScreen.x-P.positionScreen.x)<0)))Ca=w[s]=w[s]||new THREE.RenderableFace4,s++,p=Ca,p.v1.copy(I),p.v2.copy(X),p.v3.copy(P),p.v4.copy(ma);else continue;p.normalWorld.copy(W.normal);Da.multiplyVector3(p.normalWorld);p.centroidWorld.copy(W.centroid);za.multiplyVector3(p.centroidWorld);p.centroidScreen.copy(p.centroidWorld);v.multiplyVector3(p.centroidScreen);P=W.vertexNormals;I=0;for(X=P.length;I<X;I++)ma=p.vertexNormalsWorld[I],ma.copy(P[I]),Da.multiplyVector3(ma);I=0;
-for(X=sa.length;I<X;I++)if(Ca=sa[I][$]){P=0;for(ma=Ca.length;P<ma;P++)p.uvs[I][P]=Ca[P]}p.meshMaterials=Ea;p.faceMaterials=W.materials;p.overdraw=ia;p.z=p.centroidScreen.z;oa.push(p)}}else if(Q instanceof THREE.Line){U.multiply(v,za);$=Q.geometry.vertices;I=b();I.positionScreen.copy($[0].position);U.multiplyVector4(I.positionScreen);va=1;for(W=$.length;va<W;va++)if(I=b(),I.positionScreen.copy($[va].position),U.multiplyVector4(I.positionScreen),X=r[m-2],Z.copy(I.positionScreen),S.copy(X.positionScreen),
-d(Z,S))Z.multiplyScalar(1/Z.w),S.multiplyScalar(1/S.w),za=F[y]=F[y]||new THREE.RenderableLine,y++,C=za,C.v1.positionScreen.copy(Z),C.v2.positionScreen.copy(S),C.z=Math.max(Z.z,S.z),C.materials=Q.materials,oa.push(C)}else if(Q instanceof THREE.Particle&&(M.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),v.multiplyVector4(M),M.z/=M.w,M.z>0&&M.z<1))za=ya[xa]=ya[xa]||new THREE.RenderableParticle,xa++,L=za,L.x=M.x/M.w,L.y=M.y/M.w,L.z=M.z,L.rotation=Q.rotation.z,L.scale.x=Q.scale.x*Math.abs(L.x-
-(M.x+j.projectionMatrix.n11)/(M.w+j.projectionMatrix.n14)),L.scale.y=Q.scale.y*Math.abs(L.y-(M.y+j.projectionMatrix.n22)/(M.w+j.projectionMatrix.n24)),L.materials=Q.materials,oa.push(L);f&&oa.sort(c);return oa}};
+THREE.Projector=function(){function b(){var b=r[m]=r[m]||new THREE.RenderableVertex;m++;return b}function c(b,c){return c.z-b.z}function d(b,c){var f=0,d=1,e=b.z+b.w,j=c.z+c.w,h=-b.z+b.w,k=-c.z+c.w;return e>=0&&j>=0&&h>=0&&k>=0?!0:e<0&&j<0||h<0&&k<0?!1:(e<0?f=Math.max(f,e/(e-j)):j<0&&(d=Math.min(d,e/(e-j))),h<0?f=Math.max(f,h/(h-k)):k<0&&(d=Math.min(d,h/(h-k))),d<f?!1:(b.lerpSelf(c,f),c.lerpSelf(b,1-d),!0))}var e,j,h=[],k,m,r=[],n,q,s=[],u,v=[],B,y,E=[],K,wa,xa=[],ja=[],na=[],R=new THREE.Vector4,
+L=new THREE.Vector4,w=new THREE.Matrix4,T=new THREE.Matrix4,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(b,c){w.multiply(c.projectionMatrix,c.matrixWorldInverse);w.multiplyVector3(b);return b};this.unprojectVector=function(b,c){w.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));w.multiplyVector3(b);return b};this.projectObjects=function(b,d,f){var k,
+m;j=ja.length=0;k=b.objects;b=0;for(d=k.length;b<d;b++){m=k[b];var n;if(!(n=!m.visible))if(n=m instanceof THREE.Mesh){a:{n=void 0;for(var r=m.matrixWorld,q=-m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)),s=0;s<6;s++)if(n=M[s].x*r.n14+M[s].y*r.n24+M[s].z*r.n34+M[s].w,n<=q){n=!1;break a}n=!0}n=!n}if(!n)n=h[j]=h[j]||new THREE.RenderableObject,j++,e=n,R.copy(m.position),w.multiplyVector3(R),e.object=m,e.z=R.z,ja.push(e)}f&&ja.sort(c);return ja};this.projectScene=function(e,
+j,f){var h=j.near,R=j.far,ja,ua,V,Z,C,W,O,la,fa,Q,ya,Ca,Da,ha,ra,za,Ba;wa=y=u=q=na.length=0;j.matrixAutoUpdate&&j.update(void 0,!0);e.update(void 0,!1,j);w.multiply(j.projectionMatrix,j.matrixWorldInverse);M[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);M[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);M[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);M[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);M[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);M[5].set(w.n41+
+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(ja=0;ja<6;ja++)fa=M[ja],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(e,j,!0);e=0;for(ja=fa.length;e<ja;e++)if(Q=fa[e].object,Q.visible)if(ya=Q.matrixWorld,Ca=Q.matrixRotationWorld,Da=Q.materials,ha=Q.overdraw,m=0,Q instanceof THREE.Mesh){ra=Q.geometry;Z=ra.vertices;za=ra.faces;ra=ra.faceVertexUvs;ua=0;for(V=Z.length;ua<V;ua++)k=b(),k.positionWorld.copy(Z[ua].position),ya.multiplyVector3(k.positionWorld),k.positionScreen.copy(k.positionWorld),
+w.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>h&&k.positionScreen.z<R;Z=0;for(ua=za.length;Z<ua;Z++){V=za[Z];if(V instanceof THREE.Face3)if(C=r[V.a],W=r[V.b],O=r[V.c],C.visible&&W.visible&&O.visible&&(Q.doubleSided||Q.flipSided!=(O.positionScreen.x-C.positionScreen.x)*(W.positionScreen.y-C.positionScreen.y)-(O.positionScreen.y-C.positionScreen.y)*(W.positionScreen.x-C.positionScreen.x)<0))la=s[q]=s[q]||
+new THREE.RenderableFace3,q++,n=la,n.v1.copy(C),n.v2.copy(W),n.v3.copy(O);else continue;else if(V instanceof THREE.Face4)if(C=r[V.a],W=r[V.b],O=r[V.c],la=r[V.d],C.visible&&W.visible&&O.visible&&la.visible&&(Q.doubleSided||Q.flipSided!=((la.positionScreen.x-C.positionScreen.x)*(W.positionScreen.y-C.positionScreen.y)-(la.positionScreen.y-C.positionScreen.y)*(W.positionScreen.x-C.positionScreen.x)<0||(W.positionScreen.x-O.positionScreen.x)*(la.positionScreen.y-O.positionScreen.y)-(W.positionScreen.y-
+O.positionScreen.y)*(la.positionScreen.x-O.positionScreen.x)<0)))Ba=v[u]=v[u]||new THREE.RenderableFace4,u++,n=Ba,n.v1.copy(C),n.v2.copy(W),n.v3.copy(O),n.v4.copy(la);else continue;n.normalWorld.copy(V.normal);Ca.multiplyVector3(n.normalWorld);n.centroidWorld.copy(V.centroid);ya.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);w.multiplyVector3(n.centroidScreen);O=V.vertexNormals;C=0;for(W=O.length;C<W;C++)la=n.vertexNormalsWorld[C],la.copy(O[C]),Ca.multiplyVector3(la);C=0;
+for(W=ra.length;C<W;C++)if(Ba=ra[C][Z]){O=0;for(la=Ba.length;O<la;O++)n.uvs[C][O]=Ba[O]}n.meshMaterials=Da;n.faceMaterials=V.materials;n.overdraw=ha;n.z=n.centroidScreen.z;na.push(n)}}else if(Q instanceof THREE.Line){T.multiply(w,ya);Z=Q.geometry.vertices;C=b();C.positionScreen.copy(Z[0].position);T.multiplyVector4(C.positionScreen);ua=1;for(V=Z.length;ua<V;ua++)if(C=b(),C.positionScreen.copy(Z[ua].position),T.multiplyVector4(C.positionScreen),W=r[m-2],Y.copy(C.positionScreen),S.copy(W.positionScreen),
+d(Y,S))Y.multiplyScalar(1/Y.w),S.multiplyScalar(1/S.w),ya=E[y]=E[y]||new THREE.RenderableLine,y++,B=ya,B.v1.positionScreen.copy(Y),B.v2.positionScreen.copy(S),B.z=Math.max(Y.z,S.z),B.materials=Q.materials,na.push(B)}else if(Q instanceof THREE.Particle&&(L.set(Q.matrixWorld.n14,Q.matrixWorld.n24,Q.matrixWorld.n34,1),w.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))ya=xa[wa]=xa[wa]||new THREE.RenderableParticle,wa++,K=ya,K.x=L.x/L.w,K.y=L.y/L.w,K.z=L.z,K.rotation=Q.rotation.z,K.scale.x=Q.scale.x*Math.abs(K.x-
+(L.x+j.projectionMatrix.n11)/(L.w+j.projectionMatrix.n14)),K.scale.y=Q.scale.y*Math.abs(K.y-(L.y+j.projectionMatrix.n22)/(L.w+j.projectionMatrix.n24)),K.materials=Q.materials,na.push(K);f&&na.sort(c);return na}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
@@ -174,119 +174,119 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
 "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"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
 THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},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}",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")}};
-THREE.WebGLRenderer=function(b){function c(b,c,d){var e,j,h,k=b.vertices,B=k.length,m=b.colors,T=m.length,p=b.__vertexArray,D=b.__colorArray,r=b.__sortArray,q=b.__dirtyVertices,n=b.__dirtyColors,s=b.__webglCustomAttributes,v,u;if(s)for(v in s)s[v].offset=0;if(d.sortParticles){sa.multiplySelf(d.matrixWorld);for(e=0;e<B;e++)j=k[e].position,Ka.copy(j),sa.multiplyVector3(Ka),r[e]=[Ka.z,e];r.sort(function(b,c){return c[0]-b[0]});for(e=0;e<B;e++)j=k[r[e][1]].position,h=e*3,p[h]=j.x,p[h+1]=j.y,p[h+2]=j.z;
-for(e=0;e<T;e++)h=e*3,color=m[r[e][1]],D[h]=color.r,D[h+1]=color.g,D[h+2]=color.b;if(s)for(v in s){e=s[v];m=e.value.length;for(h=0;h<m;h++){index=r[h][1];T=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[T]=e.value[index]}else{if(e.boundTo===void 0||e.boundTo==="vertices")u=e.value[index];e.size===2?(e.array[T]=u.x,e.array[T+1]=u.y):e.size===3?e.type==="c"?(e.array[T]=u.r,e.array[T+1]=u.g,e.array[T+2]=u.b):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z):(e.array[T]=
-u.x,e.array[T+1]=u.y,e.array[T+2]=u.z,e.array[T+3]=u.w)}e.offset+=e.size}}}else{if(q)for(e=0;e<B;e++)j=k[e].position,h=e*3,p[h]=j.x,p[h+1]=j.y,p[h+2]=j.z;if(n)for(e=0;e<T;e++)color=m[e],h=e*3,D[h]=color.r,D[h+1]=color.g,D[h+2]=color.b;if(s)for(v in s)if(e=s[v],e.__original.needsUpdate){m=e.value.length;for(h=0;h<m;h++){T=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[T]=e.value[h]}else{if(e.boundTo===void 0||e.boundTo==="vertices")u=e.value[h];e.size===2?(e.array[T]=
-u.x,e.array[T+1]=u.y):e.size===3?e.type==="c"?(e.array[T]=u.r,e.array[T+1]=u.g,e.array[T+2]=u.b):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z):(e.array[T]=u.x,e.array[T+1]=u.y,e.array[T+2]=u.z,e.array[T+3]=u.w)}e.offset+=e.size}}}if(q||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,p,c);if(n||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,D,c);if(s)for(v in s)if(e=s[v],e.__original.needsUpdate||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
-e.buffer),f.bufferData(f.ARRAY_BUFFER,e.array,c)}function d(b,c,d,e,j){e.program||H.initMaterial(e,c,d,j);if(e.morphTargets&&!j.__webglMorphTargetInfluences){j.__webglMorphTargetInfluences=new Float32Array(H.maxMorphTargets);for(var h=0,k=H.maxMorphTargets;h<k;h++)j.__webglMorphTargetInfluences[h]=0}var h=e.program,k=h.uniforms,B=e.uniforms;h!=Fa&&(f.useProgram(h),Fa=h);f.uniformMatrix4fv(k.projectionMatrix,!1,Aa);if(d&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||
-e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(B.fogColor.value=d.color,d instanceof THREE.Fog)B.fogNear.value=d.near,B.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)B.fogDensity.value=d.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var m,p,E,D=0,r=0,q=0,n,u,s,w=Ta,G=w.directional.colors,K=w.directional.positions,C=w.point.colors,A=w.point.positions,y=w.point.distances,
-L=0,F=0,d=p=s=0;for(m=c.length;d<m;d++)if(p=c[d],E=p.color,n=p.position,u=p.intensity,s=p.distance,p instanceof THREE.AmbientLight)D+=E.r,r+=E.g,q+=E.b;else if(p instanceof THREE.DirectionalLight)s=L*3,G[s]=E.r*u,G[s+1]=E.g*u,G[s+2]=E.b*u,K[s]=n.x,K[s+1]=n.y,K[s+2]=n.z,L+=1;else if(p instanceof THREE.SpotLight)s=L*3,G[s]=E.r*u,G[s+1]=E.g*u,G[s+2]=E.b*u,E=1/n.length(),K[s]=n.x*E,K[s+1]=n.y*E,K[s+2]=n.z*E,L+=1;else if(p instanceof THREE.PointLight)p=F*3,C[p]=E.r*u,C[p+1]=E.g*u,C[p+2]=E.b*u,A[p]=n.x,
-A[p+1]=n.y,A[p+2]=n.z,y[F]=s,F+=1;for(d=L*3;d<G.length;d++)G[d]=0;for(d=F*3;d<C.length;d++)C[d]=0;w.point.length=F;w.directional.length=L;w.ambient[0]=D;w.ambient[1]=r;w.ambient[2]=q;c=Ta;B.enableLighting.value=c.directional.length+c.point.length;B.ambientLightColor.value=c.ambient;B.directionalLightColor.value=c.directional.colors;B.directionalLightDirection.value=c.directional.positions;B.pointLightColor.value=c.point.colors;B.pointLightPosition.value=c.point.positions;B.pointLightDistance.value=
-c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)B.diffuse.value=e.color,B.opacity.value=e.opacity,(B.map.texture=e.map)&&B.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),B.lightMap.texture=e.lightMap,B.envMap.texture=e.envMap,B.reflectivity.value=e.reflectivity,B.refractionRatio.value=e.refractionRatio,B.combine.value=e.combine,B.useRefract.value=e.envMap&&e.envMap.mapping instanceof
-THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)B.diffuse.value=e.color,B.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)B.psColor.value=e.color,B.opacity.value=e.opacity,B.size.value=e.size,B.scale.value=Ga.height/2,B.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)B.ambient.value=e.ambient,B.specular.value=e.specular,B.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)B.mNear.value=b.near,B.mFar.value=b.far,B.opacity.value=
-e.opacity;else if(e instanceof THREE.MeshNormalMaterial)B.opacity.value=e.opacity;if(j.receiveShadow&&!e._shadowPass&&B.shadowMatrix){for(c=0;c<La.length;c++)B.shadowMatrix.value[c]=La[c],B.shadowMap.texture[c]=H.shadowMap[c];B.shadowDarkness.value=H.shadowMapDarkness;B.shadowBias.value=H.shadowMapBias}for(var O in B)if(m=h.uniforms[O])if(d=B[O],D=d.type,c=d.value,D=="i")f.uniform1i(m,c);else if(D=="f")f.uniform1f(m,c);else if(D=="v2")f.uniform2f(m,c.x,c.y);else if(D=="v3")f.uniform3f(m,c.x,c.y,c.z);
-else if(D=="v4")f.uniform4f(m,c.x,c.y,c.z,c.w);else if(D=="c")f.uniform3f(m,c.r,c.g,c.b);else if(D=="fv1")f.uniform1fv(m,c);else if(D=="fv")f.uniform3fv(m,c);else if(D=="v3v"){if(!d._array)d._array=new Float32Array(3*c.length);D=0;for(r=c.length;D<r;D++)q=D*3,d._array[q]=c[D].x,d._array[q+1]=c[D].y,d._array[q+2]=c[D].z;f.uniform3fv(m,d._array)}else if(D=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);f.uniformMatrix4fv(m,!1,d._array)}else if(D=="m4v"){if(!d._array)d._array=
-new Float32Array(16*c.length);D=0;for(r=c.length;D<r;D++)c[D].flattenToArrayOffset(d._array,D*16);f.uniformMatrix4fv(m,!1,d._array)}else if(D=="t"){if(f.uniform1i(m,c),m=d.texture)if(m.image instanceof Array&&m.image.length==6){if(d=m,d.image.length==6)if(d.needsUpdate){if(!d.image.__webglTextureCube)d.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_CUBE_MAP,d.image.__webglTextureCube);for(c=0;c<6;c++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,
-f.RGBA,f.RGBA,f.UNSIGNED_BYTE,d.image[c]);M(f.TEXTURE_CUBE_MAP,d,d.image[0]);d.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_CUBE_MAP,d.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(d=m,f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_CUBE_MAP,d.__webglTexture)):v(m,c)}else if(D=="tv"){if(!d._array){d._array=[];D=0;for(r=d.texture.length;D<r;D++)d._array[D]=c+D}f.uniform1iv(m,d._array);D=0;for(r=d.texture.length;D<r;D++)(m=d.texture[D])&&
-v(m,d._array[D])}f.uniformMatrix4fv(k.modelViewMatrix,!1,j._modelViewMatrixArray);k.normalMatrix&&f.uniformMatrix3fv(k.normalMatrix,!1,j._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&k.cameraPosition!==null&&f.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning||j.receiveShadow)&&k.objectMatrix!==null&&f.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray);
-(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&k.viewMatrix!==null&&f.uniformMatrix4fv(k.viewMatrix,!1,Ca);e.skinning&&(f.uniformMatrix4fv(k.cameraInverseMatrix,!1,Ca),f.uniformMatrix4fv(k.boneGlobalMatrices,!1,j.boneMatrices));return h}function e(b,c,e,j,h,k){if(j.opacity!=0){var m,b=d(b,c,e,j,k).attributes;if(!j.morphTargets&&b.position>=0)f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,
-3,f.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0)):c.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var e=0,B=k.morphTargetForcedOrder,p=k.morphTargetInfluences;e<j.numSupportedMorphTargets&&e<B.length;)f.bindBuffer(f.ARRAY_BUFFER,
-h.__webglMorphTargetsBuffers[B[e]]),f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[e]=p[B[e]],e++;else{var B=[],r=-1,E=0,p=k.morphTargetInfluences,D,n=p.length,e=0;for(k.morphTargetBase!==-1&&(B[k.morphTargetBase]=!0);e<j.numSupportedMorphTargets;){for(D=0;D<n;D++)!B[D]&&p[D]>r&&(E=D,r=p[E]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[E]);f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[e]=r;B[E]=1;r=
+THREE.WebGLRenderer=function(b){function c(b,c,d){var e,j,h,k=b.vertices,m=k.length,G=b.colors,H=G.length,D=b.__vertexArray,n=b.__colorArray,r=b.__sortArray,s=b.__dirtyVertices,q=b.__dirtyColors,u=b.__webglCustomAttributes,w,p;if(u)for(w in u)u[w].offset=0;if(d.sortParticles){ra.multiplySelf(d.matrixWorld);for(e=0;e<m;e++)j=k[e].position,Ka.copy(j),ra.multiplyVector3(Ka),r[e]=[Ka.z,e];r.sort(function(b,c){return c[0]-b[0]});for(e=0;e<m;e++)j=k[r[e][1]].position,h=e*3,D[h]=j.x,D[h+1]=j.y,D[h+2]=j.z;
+for(e=0;e<H;e++)h=e*3,color=G[r[e][1]],n[h]=color.r,n[h+1]=color.g,n[h+2]=color.b;if(u)for(w in u){e=u[w];G=e.value.length;for(h=0;h<G;h++){index=r[h][1];H=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[H]=e.value[index]}else{if(e.boundTo===void 0||e.boundTo==="vertices")p=e.value[index];e.size===2?(e.array[H]=p.x,e.array[H+1]=p.y):e.size===3?e.type==="c"?(e.array[H]=p.r,e.array[H+1]=p.g,e.array[H+2]=p.b):(e.array[H]=p.x,e.array[H+1]=p.y,e.array[H+2]=p.z):(e.array[H]=
+p.x,e.array[H+1]=p.y,e.array[H+2]=p.z,e.array[H+3]=p.w)}e.offset+=e.size}}}else{if(s)for(e=0;e<m;e++)j=k[e].position,h=e*3,D[h]=j.x,D[h+1]=j.y,D[h+2]=j.z;if(q)for(e=0;e<H;e++)color=G[e],h=e*3,n[h]=color.r,n[h+1]=color.g,n[h+2]=color.b;if(u)for(w in u)if(e=u[w],e.__original.needsUpdate){G=e.value.length;for(h=0;h<G;h++){H=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[H]=e.value[h]}else{if(e.boundTo===void 0||e.boundTo==="vertices")p=e.value[h];e.size===2?(e.array[H]=
+p.x,e.array[H+1]=p.y):e.size===3?e.type==="c"?(e.array[H]=p.r,e.array[H+1]=p.g,e.array[H+2]=p.b):(e.array[H]=p.x,e.array[H+1]=p.y,e.array[H+2]=p.z):(e.array[H]=p.x,e.array[H+1]=p.y,e.array[H+2]=p.z,e.array[H+3]=p.w)}e.offset+=e.size}}}if(s||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,D,c);if(q||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,n,c);if(u)for(w in u)if(e=u[w],e.__original.needsUpdate||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
+e.buffer),f.bufferData(f.ARRAY_BUFFER,e.array,c)}function d(b,c,d,e,j){e.program||I.initMaterial(e,c,d,j);if(e.morphTargets&&!j.__webglMorphTargetInfluences){j.__webglMorphTargetInfluences=new Float32Array(I.maxMorphTargets);for(var h=0,k=I.maxMorphTargets;h<k;h++)j.__webglMorphTargetInfluences[h]=0}var h=e.program,k=h.uniforms,m=e.uniforms;h!=Ea&&(f.useProgram(h),Ea=h);f.uniformMatrix4fv(k.projectionMatrix,!1,za);if(d&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||
+e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(m.fogColor.value=d.color,d instanceof THREE.Fog)m.fogNear.value=d.near,m.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)m.fogDensity.value=d.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var G,n,D,r=0,s=0,q=0,p,u,v,B=Ua,F=B.directional.colors,J=B.directional.positions,y=B.point.colors,A=B.point.positions,K=B.point.distances,
+E=0,C=0,d=n=v=0;for(G=c.length;d<G;d++)if(n=c[d],D=n.color,p=n.position,u=n.intensity,v=n.distance,n instanceof THREE.AmbientLight)r+=D.r,s+=D.g,q+=D.b;else if(n instanceof THREE.DirectionalLight)v=E*3,F[v]=D.r*u,F[v+1]=D.g*u,F[v+2]=D.b*u,J[v]=p.x,J[v+1]=p.y,J[v+2]=p.z,E+=1;else if(n instanceof THREE.SpotLight)v=E*3,F[v]=D.r*u,F[v+1]=D.g*u,F[v+2]=D.b*u,D=1/p.length(),J[v]=p.x*D,J[v+1]=p.y*D,J[v+2]=p.z*D,E+=1;else if(n instanceof THREE.PointLight)n=C*3,y[n]=D.r*u,y[n+1]=D.g*u,y[n+2]=D.b*u,A[n]=p.x,
+A[n+1]=p.y,A[n+2]=p.z,K[C]=v,C+=1;for(d=E*3;d<F.length;d++)F[d]=0;for(d=C*3;d<y.length;d++)y[d]=0;B.point.length=C;B.directional.length=E;B.ambient[0]=r;B.ambient[1]=s;B.ambient[2]=q;c=Ua;m.enableLighting.value=c.directional.length+c.point.length;m.ambientLightColor.value=c.ambient;m.directionalLightColor.value=c.directional.colors;m.directionalLightDirection.value=c.directional.positions;m.pointLightColor.value=c.point.colors;m.pointLightPosition.value=c.point.positions;m.pointLightDistance.value=
+c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)m.diffuse.value=e.color,m.opacity.value=e.opacity,(m.map.texture=e.map)&&m.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),m.lightMap.texture=e.lightMap,m.envMap.texture=e.envMap,m.reflectivity.value=e.reflectivity,m.refractionRatio.value=e.refractionRatio,m.combine.value=e.combine,m.useRefract.value=e.envMap&&e.envMap.mapping instanceof
+THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)m.diffuse.value=e.color,m.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)m.psColor.value=e.color,m.opacity.value=e.opacity,m.size.value=e.size,m.scale.value=Ga.height/2,m.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)m.ambient.value=e.ambient,m.specular.value=e.specular,m.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)m.mNear.value=b.near,m.mFar.value=b.far,m.opacity.value=
+e.opacity;else if(e instanceof THREE.MeshNormalMaterial)m.opacity.value=e.opacity;if(j.receiveShadow&&!e._shadowPass&&m.shadowMatrix){for(c=0;c<La.length;c++)m.shadowMatrix.value[c]=La[c],m.shadowMap.texture[c]=I.shadowMap[c];m.shadowDarkness.value=I.shadowMapDarkness;m.shadowBias.value=I.shadowMapBias}for(var N in m)if(G=h.uniforms[N])if(d=m[N],r=d.type,c=d.value,r=="i")f.uniform1i(G,c);else if(r=="f")f.uniform1f(G,c);else if(r=="v2")f.uniform2f(G,c.x,c.y);else if(r=="v3")f.uniform3f(G,c.x,c.y,c.z);
+else if(r=="v4")f.uniform4f(G,c.x,c.y,c.z,c.w);else if(r=="c")f.uniform3f(G,c.r,c.g,c.b);else if(r=="fv1")f.uniform1fv(G,c);else if(r=="fv")f.uniform3fv(G,c);else if(r=="v3v"){if(!d._array)d._array=new Float32Array(3*c.length);r=0;for(s=c.length;r<s;r++)q=r*3,d._array[q]=c[r].x,d._array[q+1]=c[r].y,d._array[q+2]=c[r].z;f.uniform3fv(G,d._array)}else if(r=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);f.uniformMatrix4fv(G,!1,d._array)}else if(r=="m4v"){if(!d._array)d._array=
+new Float32Array(16*c.length);r=0;for(s=c.length;r<s;r++)c[r].flattenToArrayOffset(d._array,r*16);f.uniformMatrix4fv(G,!1,d._array)}else if(r=="t"){if(f.uniform1i(G,c),G=d.texture)if(G.image instanceof Array&&G.image.length==6){if(d=G,d.image.length==6)if(d.needsUpdate){if(!d.image.__webglTextureCube)d.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_CUBE_MAP,d.image.__webglTextureCube);for(c=0;c<6;c++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,
+f.RGBA,f.RGBA,f.UNSIGNED_BYTE,d.image[c]);L(f.TEXTURE_CUBE_MAP,d,d.image[0]);d.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_CUBE_MAP,d.image.__webglTextureCube)}else G instanceof THREE.WebGLRenderTargetCube?(d=G,f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_CUBE_MAP,d.__webglTexture)):w(G,c)}else if(r=="tv"){if(!d._array){d._array=[];r=0;for(s=d.texture.length;r<s;r++)d._array[r]=c+r}f.uniform1iv(G,d._array);r=0;for(s=d.texture.length;r<s;r++)(G=d.texture[r])&&
+w(G,d._array[r])}f.uniformMatrix4fv(k.modelViewMatrix,!1,j._modelViewMatrixArray);k.normalMatrix&&f.uniformMatrix3fv(k.normalMatrix,!1,j._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&k.cameraPosition!==null&&f.uniform3f(k.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning||j.receiveShadow)&&k.objectMatrix!==null&&f.uniformMatrix4fv(k.objectMatrix,!1,j._objectMatrixArray);
+(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&k.viewMatrix!==null&&f.uniformMatrix4fv(k.viewMatrix,!1,Ba);e.skinning&&(f.uniformMatrix4fv(k.cameraInverseMatrix,!1,Ba),f.uniformMatrix4fv(k.boneGlobalMatrices,!1,j.boneMatrices));return h}function e(b,c,e,j,h,k){if(j.opacity!=0){var m,b=d(b,c,e,j,k).attributes;if(!j.morphTargets&&b.position>=0)f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,
+3,f.FLOAT,!1,0,0);else if(k.morphTargetBase){c=j.program.attributes;k.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[k.morphTargetBase]),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0)):c.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(k.morphTargetForcedOrder.length)for(var e=0,n=k.morphTargetForcedOrder,G=k.morphTargetInfluences;e<j.numSupportedMorphTargets&&e<n.length;)f.bindBuffer(f.ARRAY_BUFFER,
+h.__webglMorphTargetsBuffers[n[e]]),f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0),k.__webglMorphTargetInfluences[e]=G[n[e]],e++;else{var n=[],r=-1,D=0,G=k.morphTargetInfluences,s,q=G.length,e=0;for(k.morphTargetBase!==-1&&(n[k.morphTargetBase]=!0);e<j.numSupportedMorphTargets;){for(s=0;s<q;s++)!n[s]&&G[s]>r&&(D=s,r=G[D]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[D]);f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0);k.__webglMorphTargetInfluences[e]=r;n[D]=1;r=
 -1;e++}}j.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(j.program.uniforms.morphTargetInfluences,k.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(m in h.__webglCustomAttributes)b[m]>=0&&(c=h.__webglCustomAttributes[m],f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(b[m],c.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),
 f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)):
 f.disableVertexAttribArray(b.uv2));j.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),
-f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(f.lineWidth(j.wireframeLinewidth),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,f.UNSIGNED_SHORT,0)):(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),H.data.vertices+=h.__webglFaceCount,H.data.faces+=h.__webglFaceCount/3,H.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?
-f.LINE_STRIP:f.LINES,f.lineWidth(j.linewidth),f.drawArrays(k,0,h.__webglLineCount),H.data.drawCalls++):k instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),H.data.drawCalls++):k instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,h.__webglVertexCount),H.data.drawCalls++)}}function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),
-f.bufferData(f.ARRAY_BUFFER,b.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,h,j,k,m,p,r,E,D,n,q=b.count*3;for(n=0;n<q;n+=9)d=b.normalArray,e=d[n],h=d[n+1],j=d[n+2],k=d[n+3],p=d[n+4],E=d[n+5],m=d[n+6],r=d[n+7],D=d[n+8],e=(e+k+m)/3,h=(h+p+r)/3,j=(j+E+D)/3,d[n]=e,d[n+1]=h,d[n+2]=j,d[n+3]=e,d[n+4]=h,d[n+5]=j,d[n+
-6]=e,d[n+7]=h,d[n+8]=j}f.bufferData(f.ARRAY_BUFFER,b.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(c.attributes.normal);f.vertexAttribPointer(c.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,b.count);b.count=0}function h(b){if(W!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),W=b.doubleSided;if($!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),$=b.flipSided}function k(b){X!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),X=b)}function m(b,
-c,d){P!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),P=b);if(b&&(ma!=c||ga!=d))f.polygonOffset(c,d),ma=c,ga=d}function r(b){ia[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ia[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ia[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ia[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ia[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ia[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);
-for(var c,b=0;b<6;b++)c=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=ia[d].x*c.n14+ia[d].y*c.n24+ia[d].z*c.n34+ia[d].w,b<=f)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function q(b){var c,d,f=b.object,e=b.opaque,h=b.transparent;h.count=0;b=e.count=0;for(c=f.materials.length;b<c;b++)d=f.materials[b],d.transparent?n(h,d):n(e,d)}function s(b){var c,
-d,f,e,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=j.materials.length;c<d;c++)(e=j.materials[c])&&(e.transparent?n(m,e):n(k,e))}else(e=c)&&(e.transparent?n(m,e):n(k,e))}function w(b,c){return c.z-b.z}function C(b,c){var m,Sa,J,n=0,ha,B,q,s,E=b.lights;pa||(pa=new THREE.Camera(H.shadowCameraFov,c.aspect,H.shadowCameraNear,H.shadowCameraFar));m=0;for(Sa=E.length;m<Sa;m++)if(J=
-E[m],J instanceof THREE.SpotLight&&J.castShadow){H.shadowMap[n]||(H.shadowMap[n]=new THREE.WebGLRenderTarget(H.shadowMapWidth,H.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));La[n]||(La[n]=new THREE.Matrix4);ha=H.shadowMap[n];B=La[n];pa.position.copy(J.position);pa.target.position.copy(J.target.position);pa.update(void 0,!0);b.update(void 0,!1,pa);B.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);B.multiplySelf(pa.projectionMatrix);B.multiplySelf(pa.matrixWorldInverse);
-pa.matrixWorldInverse.flattenToArray(Ca);pa.projectionMatrix.flattenToArray(Aa);sa.multiply(pa.projectionMatrix,pa.matrixWorldInverse);r(sa);H.initWebGLObjects(b);U(ha);f.clearColor(1,1,1,1);H.clear();f.clearColor(wa.r,wa.g,wa.b,Ia);B=b.__webglObjects.length;J=b.__webglObjectsImmediate.length;for(ha=0;ha<B;ha++)q=b.__webglObjects[ha],s=q.object,s.visible&&s.castShadow?!(s instanceof THREE.Mesh)||!s.frustumCulled||p(s)?(s.matrixWorld.flattenToArray(s._objectMatrixArray),F(s,pa,!1),q.render=!0):q.render=
-!1:q.render=!1;k(!0);R(THREE.NormalBlending);for(ha=0;ha<B;ha++)if(q=b.__webglObjects[ha],q.render)s=q.object,buffer=q.buffer,h(s),q=s.customDepthMaterial?s.customDepthMaterial:s.geometry.morphTargets.length?Ua:Qa,e(pa,E,null,q,buffer,s);for(ha=0;ha<J;ha++)q=b.__webglObjectsImmediate[ha],s=q.object,s.visible&&s.castShadow&&(s.matrixAutoUpdate&&s.matrixWorld.flattenToArray(s._objectMatrixArray),F(s,pa,!1),h(s),program=d(pa,E,null,Qa,s),s.render(function(b){j(b,program,Qa.shading)}));n++}}function y(b,
-c){var d,e,h;d=u.attributes;var j=u.uniforms,k=Ea/Da,m,p=[],n=Da*0.5,s=Ea*0.5,D=!0;f.useProgram(u.program);Fa=u.program;X=I=-1;Va||(f.enableVertexAttribArray(u.attributes.position),f.enableVertexAttribArray(u.attributes.uv),Va=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.uniformMatrix4fv(j.projectionMatrix,
-!1,Aa);f.activeTexture(f.TEXTURE0);f.uniform1i(j.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(w);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(f.uniform1i(j.useScreenCoordinates,1),f.uniform3f(j.screenPosition,
-(h.position.x-n)/n,(s-h.position.y)/s,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(j.useScreenCoordinates,0),f.uniform1i(j.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Ea:1),p[0]=m*k*h.scale.x,p[1]=m*h.scale.y,f.uniform2f(j.uvScale,h.uvScale.x,h.uvScale.y),f.uniform2f(j.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(j.alignment,h.alignment.x,h.alignment.y),f.uniform1f(j.opacity,h.opacity),
-f.uniform1f(j.rotation,h.rotation),f.uniform2fv(j.scale,p),h.mergeWith3D&&!D?(f.enable(f.DEPTH_TEST),D=!0):!h.mergeWith3D&&D&&(f.disable(f.DEPTH_TEST),D=!1),R(h.blending),v(h.map,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(va)}function F(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function L(b){var c,
-d,f,e;e=b.__materials;b=0;for(d=e.length;b<d;b++)if(f=e[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function xa(b){var c,d,f,e;e=b.__materials;b=0;for(d=e.length;b<d;b++)if(f=e[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function ya(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function ka(b){function c(b){var e=[];d=0;for(f=b.length;d<f;d++)b[d]==void 0?e.push("undefined"):e.push(b[d].id);return e.join("_")}
-var d,f,e,h,j,k,m,p,n={},D=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(h=b.faces.length;e<h;e++)j=b.faces[e],k=j.materials,m=c(k),n[m]==void 0&&(n[m]={hash:m,counter:0}),p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:k,vertices:0,numMorphTargets:D}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+j>65535&&(n[m].counter+=1,p=n[m].hash+"_"+n[m].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
-materials:k,vertices:0,numMorphTargets:D})),b.geometryGroups[p].faces.push(e),b.geometryGroups[p].vertices+=j}function oa(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(b){if(b!=I){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD);
-f.blendFunc(f.ZERO,f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA)}I=b}}function M(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,V(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,V(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,V(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,V(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S,
-f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,S(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,S(c.minFilter)))}function v(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=f.createTexture();f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,V(b.format),b.image.width,b.image.height,0,V(b.format),f.UNSIGNED_BYTE,b.image.data):
-f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);M(f.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function U(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=f.createRenderbuffer();b.__webglTexture=f.createTexture();if(c){f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);
-M(f.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=f.createFramebuffer(),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null)}else b.__webglFramebuffer=f.createFramebuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),M(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,0,V(b.format),b.width,b.height,0,V(b.format),V(b.type),null);f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)f.bindFramebuffer(f.FRAMEBUFFER,
-b.__webglFramebuffer[d]),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&
-b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var e,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,
-h=e=0):(c=null,d=Da,b=Ea,e=Q,h=za);c!=Ra&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(e,h,d,b),Ra=c)}function N(b){b instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,b.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))}function Z(b,c){var d;b=="fragment"?d=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&(d=f.createShader(f.VERTEX_SHADER));
-f.shaderSource(d,c);f.compileShader(d);if(!f.getShaderParameter(d,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(d)),console.error(c),null;return d}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;
-case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;
-case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var H=this,f,ua=[],Fa=null,Ra=null,va=!0,W=null,$=null,I=null,X=null,P=null,ma=null,ga=null,Q=0,za=0,Da=0,Ea=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,Aa=new Float32Array(16),Ca=new Float32Array(16),Ka=new THREE.Vector4,Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ya=b.stencil!==void 0?b.stencil:!0,Za=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,$a=b.antialias!==void 0?b.antialias:!1,wa=b.clearColor!==void 0?new THREE.Color(b.clearColor):
-new THREE.Color(0),Ia=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;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=!0;var pa,La=[],b=THREE.ShaderLib.depthRGBA,
-Wa=THREE.UniformsUtils.clone(b.uniforms),Qa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa}),Ua=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Wa,morphTargets:!0});Qa._shadowPass=!0;Ua._shadowPass=!0;try{if(!(f=Ga.getContext("experimental-webgl",{antialias:$a,stencil:Ya,preserveDrawingBuffer:Za})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+
-" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(ab){console.error(ab)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(wa.r,wa.g,wa.b,Ia);this.context=f;var Xa=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,
-u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);i=0;u.vertices[i++]=-1;u.vertices[i++]=-1;u.vertices[i++]=0;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=0;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=0;i=u.vertices[i++]=0;u.faces[i++]=0;u.faces[i++]=1;u.faces[i++]=2;u.faces[i++]=0;u.faces[i++]=2;u.faces[i++]=3;u.vertexBuffer=f.createBuffer();u.elementBuffer=f.createBuffer();
-f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,u.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,u.faces,f.STATIC_DRAW);u.program=f.createProgram();f.attachShader(u.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(u.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=f.getAttribLocation(u.program,"position");
-u.attributes.uv=f.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=f.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=f.getUniformLocation(u.program,"uvScale");u.uniforms.rotation=f.getUniformLocation(u.program,"rotation");u.uniforms.scale=f.getUniformLocation(u.program,"scale");u.uniforms.alignment=f.getUniformLocation(u.program,"alignment");u.uniforms.map=f.getUniformLocation(u.program,"map");u.uniforms.opacity=f.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=
-f.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=f.getUniformLocation(u.program,"affectedByDistance");u.uniforms.screenPosition=f.getUniformLocation(u.program,"screenPosition");u.uniforms.modelViewMatrix=f.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=f.getUniformLocation(u.program,"projectionMatrix");var Va=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,
-d,e){Q=b;za=c;Da=d;Ea=e;f.viewport(Q,za,Da,Ea)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){va=b;f.depthMask(b)};this.setClearColorHex=function(b,c){wa.setHex(b);Ia=c;f.clearColor(wa.r,wa.g,wa.b,Ia)};this.setClearColor=function(b,c){wa.copy(b);Ia=c;f.clearColor(wa.r,wa.g,wa.b,Ia)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)};
-this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);
-f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d])}else if(b instanceof THREE.Ribbon)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer);
-else if(b instanceof THREE.Line)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.ParticleSystem)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer)};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,f.deleteTexture(b.__webglTexture)};this.initMaterial=function(b,c,d,e){var h,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof
-THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var p,n,s;p=s=m=0;for(n=c.length;p<n;p++)j=c[p],j instanceof THREE.SpotLight&&s++,j instanceof THREE.DirectionalLight&&
-s++,j instanceof THREE.PointLight&&m++;m+s<=_maxLights?p=s:(p=Math.ceil(_maxLights*s/(m+s)),m=_maxLights-p);j={directional:p,point:m};m=s=0;for(p=c.length;m<p;m++)n=c[m],n instanceof THREE.SpotLight&&n.castShadow&&s++;var D=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)D=e.bones.length;var r;a:{p=b.fragmentShader;n=b.vertexShader;var m=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,
-morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:D,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:s,alphaTest:b.alphaTest},q,e=[];k?e.push(k):(e.push(p),e.push(n));for(q in d)e.push(q),e.push(d[q]);k=e.join();q=0;for(e=ua.length;q<e;q++)if(ua[q].code==k){r=ua[q].program;break a}q=f.createProgram();e=
-[Xa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.sizeAttenuation?
-"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0));k instanceof THREE.Mesh?(j.wireframe?(f.lineWidth(j.wireframeLinewidth),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,f.UNSIGNED_SHORT,0)):(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),I.data.vertices+=h.__webglFaceCount,I.data.faces+=h.__webglFaceCount/3,I.data.drawCalls++):k instanceof THREE.Line?(k=k.type==THREE.LineStrip?
+f.LINE_STRIP:f.LINES,f.lineWidth(j.linewidth),f.drawArrays(k,0,h.__webglLineCount),I.data.drawCalls++):k instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),I.data.drawCalls++):k instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,h.__webglVertexCount),I.data.drawCalls++)}}function j(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),
+f.bufferData(f.ARRAY_BUFFER,b.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,h,j,k,m,G,n,r,s,q,p=b.count*3;for(q=0;q<p;q+=9)d=b.normalArray,e=d[q],h=d[q+1],j=d[q+2],k=d[q+3],G=d[q+4],r=d[q+5],m=d[q+6],n=d[q+7],s=d[q+8],e=(e+k+m)/3,h=(h+G+n)/3,j=(j+r+s)/3,d[q]=e,d[q+1]=h,d[q+2]=j,d[q+3]=e,d[q+4]=h,d[q+5]=j,d[q+
+6]=e,d[q+7]=h,d[q+8]=j}f.bufferData(f.ARRAY_BUFFER,b.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(c.attributes.normal);f.vertexAttribPointer(c.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,b.count);b.count=0}function h(b){if(V!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),V=b.doubleSided;if(Z!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),Z=b.flipSided}function k(b){W!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),W=b)}function m(b,
+c,d){O!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),O=b);if(b&&(la!=c||fa!=d))f.polygonOffset(c,d),la=c,fa=d}function r(b){ha[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ha[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ha[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ha[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ha[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ha[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);
+for(var c,b=0;b<6;b++)c=ha[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function n(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=ha[d].x*c.n14+ha[d].y*c.n24+ha[d].z*c.n34+ha[d].w,b<=f)return!1;return!0}function q(b,c){b.list[b.count]=c;b.count+=1}function s(b){var c,d,f=b.object,e=b.opaque,h=b.transparent;h.count=0;b=e.count=0;for(c=f.materials.length;b<c;b++)d=f.materials[b],d.transparent?q(h,d):q(e,d)}function u(b){var c,
+d,f,e,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=j.materials.length;c<d;c++)(e=j.materials[c])&&(e.transparent?q(m,e):q(k,e))}else(e=c)&&(e.transparent?q(m,e):q(k,e))}function v(b,c){return c.z-b.z}function B(b,c){var m,Ta,Ma,q=0,s,p,G,H,D=b.lights;oa||(oa=new THREE.Camera(I.shadowCameraFov,c.aspect,I.shadowCameraNear,I.shadowCameraFar));m=0;for(Ta=D.length;m<Ta;m++)if(Ma=
+D[m],Ma instanceof THREE.SpotLight&&Ma.castShadow){I.shadowMap[q]||(I.shadowMap[q]=new THREE.WebGLRenderTarget(I.shadowMapWidth,I.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));La[q]||(La[q]=new THREE.Matrix4);s=I.shadowMap[q];p=La[q];oa.position.copy(Ma.position);oa.target.position.copy(Ma.target.position);oa.update(void 0,!0);b.update(void 0,!1,oa);p.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);p.multiplySelf(oa.projectionMatrix);p.multiplySelf(oa.matrixWorldInverse);
+oa.matrixWorldInverse.flattenToArray(Ba);oa.projectionMatrix.flattenToArray(za);ra.multiply(oa.projectionMatrix,oa.matrixWorldInverse);r(ra);I.initWebGLObjects(b);T(s);f.clearColor(1,1,1,1);I.clear();f.clearColor(va.r,va.g,va.b,Ia);p=b.__webglObjects.length;Ma=b.__webglObjectsImmediate.length;for(s=0;s<p;s++)G=b.__webglObjects[s],H=G.object,H.visible&&H.castShadow?!(H instanceof THREE.Mesh)||!H.frustumCulled||n(H)?(H.matrixWorld.flattenToArray(H._objectMatrixArray),E(H,oa,!1),G.render=!0):G.render=
+!1:G.render=!1;k(!0);R(THREE.NormalBlending);for(s=0;s<p;s++)if(G=b.__webglObjects[s],G.render)H=G.object,buffer=G.buffer,h(H),G=H.customDepthMaterial?H.customDepthMaterial:H.geometry.morphTargets.length?Va:Ra,e(oa,D,null,G,buffer,H);for(s=0;s<Ma;s++)G=b.__webglObjectsImmediate[s],H=G.object,H.visible&&H.castShadow&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),E(H,oa,!1),h(H),program=d(oa,D,null,Ra,H),H.render(function(b){j(b,program,Ra.shading)}));q++}}function y(b,c){var d,
+e,h;d=p.attributes;var j=p.uniforms,k=Da/Ca,m,n=[],r=Ca*0.5,q=Da*0.5,s=!0;f.useProgram(p.program);Ea=p.program;W=C=-1;Wa||(f.enableVertexAttribArray(p.attributes.position),f.enableVertexAttribArray(p.attributes.uv),Wa=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,p.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,p.elementBuffer);f.uniformMatrix4fv(j.projectionMatrix,
+!1,za);f.activeTexture(f.TEXTURE0);f.uniform1i(j.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(v);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(f.uniform1i(j.useScreenCoordinates,1),f.uniform3f(j.screenPosition,
+(h.position.x-r)/r,(q-h.position.y)/q,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(j.useScreenCoordinates,0),f.uniform1i(j.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray)),m=h.map.image.width/(h.scaleByViewport?Da:1),n[0]=m*k*h.scale.x,n[1]=m*h.scale.y,f.uniform2f(j.uvScale,h.uvScale.x,h.uvScale.y),f.uniform2f(j.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(j.alignment,h.alignment.x,h.alignment.y),f.uniform1f(j.opacity,h.opacity),
+f.uniform1f(j.rotation,h.rotation),f.uniform2fv(j.scale,n),h.mergeWith3D&&!s?(f.enable(f.DEPTH_TEST),s=!0):!h.mergeWith3D&&s&&(f.disable(f.DEPTH_TEST),s=!1),R(h.blending),w(h.map,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(ua)}function E(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function K(b){var c,
+d,f,e;e=b.__materials;b=0;for(d=e.length;b<d;b++)if(f=e[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function wa(b){var c,d,f,e;e=b.__materials;b=0;for(d=e.length;b<d;b++)if(f=e[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function xa(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function ja(b){function c(b){var e=[];d=0;for(f=b.length;d<f;d++)b[d]==void 0?e.push("undefined"):e.push(b[d].id);return e.join("_")}
+var d,f,e,h,j,k,m,n,r={},q=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(h=b.faces.length;e<h;e++)j=b.faces[e],k=j.materials,m=c(k),r[m]==void 0&&(r[m]={hash:m,counter:0}),n=r[m].hash+"_"+r[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:q}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(r[m].counter+=1,n=r[m].hash+"_"+r[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],
+materials:k,vertices:0,numMorphTargets:q})),b.geometryGroups[n].faces.push(e),b.geometryGroups[n].vertices+=j;b.geometryGroupsList=[];for(var s in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[s])}function na(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(b){if(b!=C){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,
+f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,f.ONE,f.ONE_MINUS_SRC_ALPHA)}C=b}}function L(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,U(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,U(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,U(c.magFilter)),f.texParameteri(b,
+f.TEXTURE_MIN_FILTER,U(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,S(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,S(c.minFilter)))}function w(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=f.createTexture();f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,
+0,U(b.format),b.image.width,b.image.height,0,U(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);L(f.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function T(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=f.createRenderbuffer();
+b.__webglTexture=f.createTexture();if(c){f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);L(f.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=f.createFramebuffer(),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),null)}else b.__webglFramebuffer=f.createFramebuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),L(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,0,U(b.format),b.width,b.height,0,U(b.format),U(b.type),
+null);f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer[d]),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,0);else f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height),
+f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,
+null)}var e,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height,h=e=0):(c=null,d=Ca,b=Da,e=Q,h=ya);c!=Sa&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(e,h,d,b),Sa=c)}function M(b){b instanceof THREE.WebGLRenderTargetCube?(f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,b.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))}
+function Y(b,c){var d;b=="fragment"?d=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&(d=f.createShader(f.VERTEX_SHADER));f.shaderSource(d,c);f.compileShader(d);if(!f.getShaderParameter(d,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(d)),console.error(c),null;return d}function S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function U(b){switch(b){case THREE.RepeatWrapping:return f.REPEAT;
+case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;
+case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var I=this,f,ta=[],Ea=
+null,Sa=null,ua=!0,V=null,Z=null,C=null,W=null,O=null,la=null,fa=null,Q=0,ya=0,Ca=0,Da=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ra=new THREE.Matrix4,za=new Float32Array(16),Ba=new Float32Array(16),Ka=new THREE.Vector4,Ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Za=b.stencil!==void 0?
+b.stencil:!0,$a=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ab=b.antialias!==void 0?b.antialias:!1,va=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Ia=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;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=!0;var oa,La=[],b=THREE.ShaderLib.depthRGBA,Xa=THREE.UniformsUtils.clone(b.uniforms),Ra=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Xa}),Va=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Xa,morphTargets:!0});Ra._shadowPass=!0;Va._shadowPass=!0;try{if(!(f=Ga.getContext("experimental-webgl",
+{antialias:ab,stencil:Za,preserveDrawingBuffer:$a})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(bb){console.error(bb)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);
+f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(va.r,va.g,va.b,Ia);this.context=f;var Ya=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,p={};p.vertices=new Float32Array(16);p.faces=new Uint16Array(6);i=0;p.vertices[i++]=-1;p.vertices[i++]=-1;p.vertices[i++]=0;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=-1;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=1;p.vertices[i++]=0;p.vertices[i++]=-1;p.vertices[i++]=1;p.vertices[i++]=0;i=p.vertices[i++]=
+0;p.faces[i++]=0;p.faces[i++]=1;p.faces[i++]=2;p.faces[i++]=0;p.faces[i++]=2;p.faces[i++]=3;p.vertexBuffer=f.createBuffer();p.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,p.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,p.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,p.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,p.faces,f.STATIC_DRAW);p.program=f.createProgram();f.attachShader(p.program,Y("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(p.program,Y("vertex",
+THREE.ShaderLib.sprite.vertexShader));f.linkProgram(p.program);p.attributes={};p.uniforms={};p.attributes.position=f.getAttribLocation(p.program,"position");p.attributes.uv=f.getAttribLocation(p.program,"uv");p.uniforms.uvOffset=f.getUniformLocation(p.program,"uvOffset");p.uniforms.uvScale=f.getUniformLocation(p.program,"uvScale");p.uniforms.rotation=f.getUniformLocation(p.program,"rotation");p.uniforms.scale=f.getUniformLocation(p.program,"scale");p.uniforms.alignment=f.getUniformLocation(p.program,
+"alignment");p.uniforms.map=f.getUniformLocation(p.program,"map");p.uniforms.opacity=f.getUniformLocation(p.program,"opacity");p.uniforms.useScreenCoordinates=f.getUniformLocation(p.program,"useScreenCoordinates");p.uniforms.affectedByDistance=f.getUniformLocation(p.program,"affectedByDistance");p.uniforms.screenPosition=f.getUniformLocation(p.program,"screenPosition");p.uniforms.modelViewMatrix=f.getUniformLocation(p.program,"modelViewMatrix");p.uniforms.projectionMatrix=f.getUniformLocation(p.program,
+"projectionMatrix");var Wa=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,e){Q=b;ya=c;Ca=d;Da=e;f.viewport(Q,ya,Ca,Da)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(b){ua=b;f.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);Ia=c;f.clearColor(va.r,va.g,va.b,Ia)};this.setClearColor=
+function(b,c){va.copy(b);Ia=c;f.clearColor(va.r,va.g,va.b,Ia)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);
+f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d])}else if(b instanceof
+THREE.Ribbon)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.Line)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.ParticleSystem)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer)};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,f.deleteTexture(b.__webglTexture)};this.initMaterial=function(b,c,d,e){var h,j,k;
+b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var m=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(m.uniforms);b.vertexShader=m.vertexShader;b.fragmentShader=m.fragmentShader}var n,
+r,q;n=q=m=0;for(r=c.length;n<r;n++)j=c[n],j instanceof THREE.SpotLight&&q++,j instanceof THREE.DirectionalLight&&q++,j instanceof THREE.PointLight&&m++;m+q<=_maxLights?n=q:(n=Math.ceil(_maxLights*q/(m+q)),m=_maxLights-n);j={directional:n,point:m};m=q=0;for(n=c.length;m<n;m++)r=c[m],r instanceof THREE.SpotLight&&r.castShadow&&q++;var s=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)s=e.bones.length;var p;a:{n=b.fragmentShader;r=b.vertexShader;var m=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,
+lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:s,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:q,alphaTest:b.alphaTest},u,e=[];k?e.push(k):(e.push(n),e.push(r));for(u in d)e.push(u),e.push(d[u]);
+k=e.join();u=0;for(e=ta.length;u<e;u++)if(ta[u].code==k){p=ta[u].program;break a}u=f.createProgram();e=[Ya?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":
+"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.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");
 j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":
-"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(q,Z("fragment",j+p));f.attachShader(q,Z("vertex",e+n));f.linkProgram(q);f.getProgramParameter(q,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(q,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");q.uniforms=
-{};q.attributes={};var u,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(u in m)e.push(u);u=e;e=0;for(m=u.length;e<m;e++)p=u[e],q.uniforms[p]=f.getUniformLocation(q,p);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(u=0;u<d.maxMorphTargets;u++)e.push("morphTarget"+u);for(r in c)e.push(r);r=e;u=0;for(c=r.length;u<c;u++)d=
-r[u],q.attributes[d]=f.getAttribLocation(q,d);ua.push({program:q,code:k});r=q}b.program=r;r=b.program.attributes;r.position>=0&&f.enableVertexAttribArray(r.position);r.color>=0&&f.enableVertexAttribArray(r.color);r.normal>=0&&f.enableVertexAttribArray(r.normal);r.tangent>=0&&f.enableVertexAttribArray(r.tangent);b.skinning&&r.skinVertexA>=0&&r.skinVertexB>=0&&r.skinIndex>=0&&r.skinWeight>=0&&(f.enableVertexAttribArray(r.skinVertexA),f.enableVertexAttribArray(r.skinVertexB),f.enableVertexAttribArray(r.skinIndex),
-f.enableVertexAttribArray(r.skinWeight));if(b.attributes)for(h in b.attributes)r[h]!==void 0&&r[h]>=0&&f.enableVertexAttribArray(r[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)u="morphTarget"+h,r[u]>=0&&(f.enableVertexAttribArray(r[u]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,e){U(b);b=0;c&&(b|=f.COLOR_BUFFER_BIT);d&&(b|=f.DEPTH_BUFFER_BIT);e&&(b|=f.STENCIL_BUFFER_BIT);f.clear(b)};this.render=function(b,c,f,n){var J,u,ha,B,v,T,E,D,L=b.lights,
-Pa=b.fog;this.shadowMapEnabled&&C(b,c);H.data.vertices=0;H.data.faces=0;H.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ca);c.projectionMatrix.flattenToArray(Aa);sa.multiply(c.projectionMatrix,c.matrixWorldInverse);r(sa);this.initWebGLObjects(b);U(f);(this.autoClear||n)&&this.clear();v=b.__webglObjects.length;for(n=0;n<v;n++)if(J=b.__webglObjects[n],E=J.object,E.visible)if(!(E instanceof THREE.Mesh)||!E.frustumCulled||p(E)){if(E.matrixWorld.flattenToArray(E._objectMatrixArray),
-F(E,c,!0),s(J),J.render=!0,this.sortObjects)J.object.renderDepth?J.z=J.object.renderDepth:(Ka.copy(E.position),sa.multiplyVector3(Ka),J.z=Ka.z)}else J.render=!1;else J.render=!1;this.sortObjects&&b.__webglObjects.sort(w);T=b.__webglObjectsImmediate.length;for(n=0;n<T;n++)J=b.__webglObjectsImmediate[n],E=J.object,E.visible&&(E.matrixAutoUpdate&&E.matrixWorld.flattenToArray(E._objectMatrixArray),F(E,c,!0),q(J));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);R(b.overrideMaterial.blending);for(n=
-0;n<v;n++)if(J=b.__webglObjects[n],J.render)E=J.object,D=J.buffer,h(E),e(c,L,Pa,b.overrideMaterial,D,E);for(n=0;n<T;n++)J=b.__webglObjectsImmediate[n],E=J.object,E.visible&&(h(E),u=d(c,L,Pa,b.overrideMaterial,E),E.render(function(c){j(c,u,b.overrideMaterial.shading)}))}else{R(THREE.NormalBlending);for(n=v-1;n>=0;n--)if(J=b.__webglObjects[n],J.render){E=J.object;D=J.buffer;ha=J.opaque;h(E);for(J=0;J<ha.count;J++)B=ha.list[J],k(B.depthTest),m(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),
-e(c,L,Pa,B,D,E)}for(n=0;n<T;n++)if(J=b.__webglObjectsImmediate[n],E=J.object,E.visible){ha=J.opaque;h(E);for(J=0;J<ha.count;J++)B=ha.list[J],k(B.depthTest),m(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),u=d(c,L,Pa,B,E),E.render(function(b){j(b,u,B.shading)})}for(n=0;n<v;n++)if(J=b.__webglObjects[n],J.render){E=J.object;D=J.buffer;ha=J.transparent;h(E);for(J=0;J<ha.count;J++)B=ha.list[J],R(B.blending),k(B.depthTest),m(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),e(c,L,
-Pa,B,D,E)}for(n=0;n<T;n++)if(J=b.__webglObjectsImmediate[n],E=J.object,E.visible){ha=J.transparent;h(E);for(J=0;J<ha.count;J++)B=ha.list[J],R(B.blending),k(B.depthTest),m(B.polygonOffset,B.polygonOffsetFactor,B.polygonOffsetUnits),u=d(c,L,Pa,B,E),E.render(function(b){j(b,u,B.shading)})}}b.__webglSprites.length&&y(b,c);f&&f.minFilter!==THREE.NearestFilter&&f.minFilter!==THREE.LinearFilter&&N(f)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],
-b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,h=void 0,j=void 0,k=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in j=d.geometry,j.geometryGroups==void 0&&ka(j),j.geometryGroups){k=j.geometryGroups[h];if(!k.__webglVertexBuffer){var m=
-k;m.__webglVertexBuffer=f.createBuffer();m.__webglNormalBuffer=f.createBuffer();m.__webglTangentBuffer=f.createBuffer();m.__webglColorBuffer=f.createBuffer();m.__webglUVBuffer=f.createBuffer();m.__webglUV2Buffer=f.createBuffer();m.__webglSkinVertexABuffer=f.createBuffer();m.__webglSkinVertexBBuffer=f.createBuffer();m.__webglSkinIndicesBuffer=f.createBuffer();m.__webglSkinWeightsBuffer=f.createBuffer();m.__webglFaceBuffer=f.createBuffer();m.__webglLineBuffer=f.createBuffer();if(m.numMorphTargets){var n=
-void 0,p=void 0;m.__webglMorphTargetsBuffers=[];n=0;for(p=m.numMorphTargets;n<p;n++)m.__webglMorphTargetsBuffers.push(f.createBuffer())}for(var m=k,n=d,r=void 0,s=void 0,q=void 0,u=q=void 0,v=void 0,w=void 0,C=w=p=0,y=q=s=void 0,F=y=s=r=void 0,q=void 0,u=n.geometry,v=u.faces,y=m.faces,r=0,s=y.length;r<s;r++)q=y[r],q=v[q],q instanceof THREE.Face3?(p+=3,w+=1,C+=3):q instanceof THREE.Face4&&(p+=4,w+=2,C+=4);for(var r=m,s=n,G=y=v=void 0,K=void 0,G=void 0,q=[],v=0,y=s.materials.length;v<y;v++)if(G=s.materials[v],
-G instanceof THREE.MeshFaceMaterial){G=0;for(l=r.materials.length;G<l;G++)(K=r.materials[G])&&q.push(K)}else(K=G)&&q.push(K);r=q;m.__materials=r;a:{v=s=void 0;y=r.length;for(s=0;s<y;s++)if(v=r[s],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){s=!0;break a}s=!1}a:{y=v=void 0;q=r.length;for(v=0;v<q;v++)if(y=r[v],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;
-break a}y=!1}a:{q=v=void 0;G=r.length;for(v=0;v<G;v++)if(q=r[v],q.vertexColors){q=q.vertexColors;break a}q=!1}m.__vertexArray=new Float32Array(p*3);if(y)m.__normalArray=new Float32Array(p*3);if(u.hasTangents)m.__tangentArray=new Float32Array(p*4);if(q)m.__colorArray=new Float32Array(p*3);if(s){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=
-new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(w*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(C*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];u=0;for(v=m.numMorphTargets;u<v;u++)m.__morphTargetsArrays.push(new Float32Array(p*3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=s;m.__vertexColorType=q;m.__normalType=
-y;m.__webglFaceCount=w*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=C*2;u=0;for(v=r.length;u<v;u++)if(s=r[u],s.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in s.attributes){q=s.attributes[a];y={};for(F in q)y[F]=q[F];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,w=1,y.type==="v2"?w=2:y.type==="v3"?w=3:y.type==="v4"?w=4:y.type==="c"&&(w=3),y.size=w,y.array=new Float32Array(p*w),y.buffer=f.createBuffer(),
-y.buffer.belongsToAttribute=a,q.needsUpdate=!0,y.__original=q;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}oa(e.__webglObjects,k,d)}else if(d instanceof THREE.Ribbon){j=d.geometry;if(!j.__webglVertexBuffer)h=j,h.__webglVertexBuffer=f.createBuffer(),h.__webglColorBuffer=f.createBuffer(),h=j,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=
-new Float32Array(k*3),h.__webglVertexCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;oa(e.__webglObjects,j,d)}else if(d instanceof THREE.Line){j=d.geometry;if(!j.__webglVertexBuffer)h=j,h.__webglVertexBuffer=f.createBuffer(),h.__webglColorBuffer=f.createBuffer(),h=j,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglLineCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;oa(e.__webglObjects,j,d)}else if(d instanceof THREE.ParticleSystem){j=d.geometry;
-if(!j.__webglVertexBuffer){h=j;h.__webglVertexBuffer=f.createBuffer();h.__webglColorBuffer=f.createBuffer();h=j;k=d;m=h.vertices.length;h.__vertexArray=new Float32Array(m*3);h.__colorArray=new Float32Array(m*3);h.__sortArray=[];h.__webglParticleCount=m;h.__materials=k.materials;F=p=n=void 0;n=0;for(p=k.materials.length;n<p;n++)if(F=k.materials[n],F.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in F.attributes){originalAttribute=F.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
+"",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(u,Y("fragment",j+n));f.attachShader(u,Y("vertex",e+r));f.linkProgram(u);f.getProgramParameter(u,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(u,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");u.uniforms=
+{};u.attributes={};var v,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(v in m)e.push(v);v=e;e=0;for(m=v.length;e<m;e++)n=v[e],u.uniforms[n]=f.getUniformLocation(u,n);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(v=0;v<d.maxMorphTargets;v++)e.push("morphTarget"+v);for(p in c)e.push(p);p=e;v=0;for(c=p.length;v<c;v++)d=
+p[v],u.attributes[d]=f.getAttribLocation(u,d);ta.push({program:u,code:k});p=u}b.program=p;p=b.program.attributes;p.position>=0&&f.enableVertexAttribArray(p.position);p.color>=0&&f.enableVertexAttribArray(p.color);p.normal>=0&&f.enableVertexAttribArray(p.normal);p.tangent>=0&&f.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(f.enableVertexAttribArray(p.skinVertexA),f.enableVertexAttribArray(p.skinVertexB),f.enableVertexAttribArray(p.skinIndex),
+f.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(h in b.attributes)p[h]!==void 0&&p[h]>=0&&f.enableVertexAttribArray(p[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)v="morphTarget"+h,p[v]>=0&&(f.enableVertexAttribArray(p[v]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,c,d,e){T(b);b=0;c&&(b|=f.COLOR_BUFFER_BIT);d&&(b|=f.DEPTH_BUFFER_BIT);e&&(b|=f.STENCIL_BUFFER_BIT);f.clear(b)};this.render=function(b,c,f,q){var p,w,Fa,ga,G,H,D,K,C=b.lights,
+Qa=b.fog;this.shadowMapEnabled&&B(b,c);I.data.vertices=0;I.data.faces=0;I.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ba);c.projectionMatrix.flattenToArray(za);ra.multiply(c.projectionMatrix,c.matrixWorldInverse);r(ra);this.initWebGLObjects(b);T(f);(this.autoClear||q)&&this.clear();G=b.__webglObjects.length;for(q=0;q<G;q++)if(p=b.__webglObjects[q],D=p.object,D.visible)if(!(D instanceof THREE.Mesh)||!D.frustumCulled||n(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),
+E(D,c,!0),u(p),p.render=!0,this.sortObjects)p.object.renderDepth?p.z=p.object.renderDepth:(Ka.copy(D.position),ra.multiplyVector3(Ka),p.z=Ka.z)}else p.render=!1;else p.render=!1;this.sortObjects&&b.__webglObjects.sort(v);H=b.__webglObjectsImmediate.length;for(q=0;q<H;q++)p=b.__webglObjectsImmediate[q],D=p.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),E(D,c,!0),s(p));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);R(b.overrideMaterial.blending);for(q=
+0;q<G;q++)if(p=b.__webglObjects[q],p.render)D=p.object,K=p.buffer,h(D),e(c,C,Qa,b.overrideMaterial,K,D);for(q=0;q<H;q++)p=b.__webglObjectsImmediate[q],D=p.object,D.visible&&(h(D),w=d(c,C,Qa,b.overrideMaterial,D),D.render(function(c){j(c,w,b.overrideMaterial.shading)}))}else{R(THREE.NormalBlending);for(q=G-1;q>=0;q--)if(p=b.__webglObjects[q],p.render){D=p.object;K=p.buffer;Fa=p.opaque;h(D);for(p=0;p<Fa.count;p++)ga=Fa.list[p],k(ga.depthTest),m(ga.polygonOffset,ga.polygonOffsetFactor,ga.polygonOffsetUnits),
+e(c,C,Qa,ga,K,D)}for(q=0;q<H;q++)if(p=b.__webglObjectsImmediate[q],D=p.object,D.visible){Fa=p.opaque;h(D);for(p=0;p<Fa.count;p++)ga=Fa.list[p],k(ga.depthTest),m(ga.polygonOffset,ga.polygonOffsetFactor,ga.polygonOffsetUnits),w=d(c,C,Qa,ga,D),D.render(function(b){j(b,w,ga.shading)})}for(q=0;q<G;q++)if(p=b.__webglObjects[q],p.render){D=p.object;K=p.buffer;Fa=p.transparent;h(D);for(p=0;p<Fa.count;p++)ga=Fa.list[p],R(ga.blending),k(ga.depthTest),m(ga.polygonOffset,ga.polygonOffsetFactor,ga.polygonOffsetUnits),
+e(c,C,Qa,ga,K,D)}for(q=0;q<H;q++)if(p=b.__webglObjectsImmediate[q],D=p.object,D.visible){Fa=p.transparent;h(D);for(p=0;p<Fa.count;p++)ga=Fa.list[p],R(ga.blending),k(ga.depthTest),m(ga.polygonOffset,ga.polygonOffsetFactor,ga.polygonOffsetUnits),w=d(c,C,Qa,ga,D),D.render(function(b){j(b,w,ga.shading)})}}b.__webglSprites.length&&y(b,c);f&&f.minFilter!==THREE.NearestFilter&&f.minFilter!==THREE.LinearFilter&&M(f)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=
+[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,h=void 0,j=void 0,k=void 0;if(!d.__webglInit)if(d.__webglInit=!0,d._modelViewMatrix=new THREE.Matrix4,d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray),d instanceof THREE.Mesh)for(h in j=d.geometry,j.geometryGroups==void 0&&ja(j),j.geometryGroups){k=j.geometryGroups[h];if(!k.__webglVertexBuffer){var m=
+k;m.__webglVertexBuffer=f.createBuffer();m.__webglNormalBuffer=f.createBuffer();m.__webglTangentBuffer=f.createBuffer();m.__webglColorBuffer=f.createBuffer();m.__webglUVBuffer=f.createBuffer();m.__webglUV2Buffer=f.createBuffer();m.__webglSkinVertexABuffer=f.createBuffer();m.__webglSkinVertexBBuffer=f.createBuffer();m.__webglSkinIndicesBuffer=f.createBuffer();m.__webglSkinWeightsBuffer=f.createBuffer();m.__webglFaceBuffer=f.createBuffer();m.__webglLineBuffer=f.createBuffer();if(m.numMorphTargets){var p=
+void 0,n=void 0;m.__webglMorphTargetsBuffers=[];p=0;for(n=m.numMorphTargets;p<n;p++)m.__webglMorphTargetsBuffers.push(f.createBuffer())}for(var m=k,p=d,q=void 0,r=void 0,s=void 0,u=s=void 0,v=void 0,w=void 0,B=w=n=0,y=s=r=void 0,C=y=r=q=void 0,s=void 0,u=p.geometry,v=u.faces,y=m.faces,q=0,r=y.length;q<r;q++)s=y[q],s=v[s],s instanceof THREE.Face3?(n+=3,w+=1,B+=3):s instanceof THREE.Face4&&(n+=4,w+=2,B+=4);for(var q=m,r=p,F=y=v=void 0,J=void 0,F=void 0,s=[],v=0,y=r.materials.length;v<y;v++)if(F=r.materials[v],
+F instanceof THREE.MeshFaceMaterial){F=0;for(l=q.materials.length;F<l;F++)(J=q.materials[F])&&s.push(J)}else(J=F)&&s.push(J);q=s;m.__materials=q;a:{v=r=void 0;y=q.length;for(r=0;r<y;r++)if(v=q[r],v.map||v.lightMap||v instanceof THREE.MeshShaderMaterial){r=!0;break a}r=!1}a:{y=v=void 0;s=q.length;for(v=0;v<s;v++)if(y=q[v],!(y instanceof THREE.MeshBasicMaterial&&!y.envMap||y instanceof THREE.MeshDepthMaterial)){y=y&&y.shading!=void 0&&y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;
+break a}y=!1}a:{s=v=void 0;F=q.length;for(v=0;v<F;v++)if(s=q[v],s.vertexColors){s=s.vertexColors;break a}s=!1}m.__vertexArray=new Float32Array(n*3);if(y)m.__normalArray=new Float32Array(n*3);if(u.hasTangents)m.__tangentArray=new Float32Array(n*4);if(s)m.__colorArray=new Float32Array(n*3);if(r){if(u.faceUvs.length>0||u.faceVertexUvs.length>0)m.__uvArray=new Float32Array(n*2);if(u.faceUvs.length>1||u.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(n*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)m.__skinVertexAArray=
+new Float32Array(n*4),m.__skinVertexBArray=new Float32Array(n*4),m.__skinIndexArray=new Float32Array(n*4),m.__skinWeightArray=new Float32Array(n*4);m.__faceArray=new Uint16Array(w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(B*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];u=0;for(v=m.numMorphTargets;u<v;u++)m.__morphTargetsArrays.push(new Float32Array(n*3))}m.__needsSmoothNormals=y==THREE.SmoothShading;m.__uvType=r;m.__vertexColorType=s;m.__normalType=
+y;m.__webglFaceCount=w*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0);m.__webglLineCount=B*2;u=0;for(v=q.length;u<v;u++)if(r=q[u],r.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in r.attributes){s=r.attributes[a];y={};for(C in s)y[C]=s[C];if(!y.__webglInitialized||y.createUniqueBuffers)y.__webglInitialized=!0,w=1,y.type==="v2"?w=2:y.type==="v3"?w=3:y.type==="v4"?w=4:y.type==="c"&&(w=3),y.size=w,y.array=new Float32Array(n*w),y.buffer=f.createBuffer(),
+y.buffer.belongsToAttribute=a,s.needsUpdate=!0,y.__original=s;m.__webglCustomAttributes[a]=y}}m.__inittedArrays=!0;j.__dirtyVertices=!0;j.__dirtyMorphTargets=!0;j.__dirtyElements=!0;j.__dirtyUvs=!0;j.__dirtyNormals=!0;j.__dirtyTangents=!0;j.__dirtyColors=!0}na(e.__webglObjects,k,d)}else if(d instanceof THREE.Ribbon){j=d.geometry;if(!j.__webglVertexBuffer)h=j,h.__webglVertexBuffer=f.createBuffer(),h.__webglColorBuffer=f.createBuffer(),h=j,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=
+new Float32Array(k*3),h.__webglVertexCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;na(e.__webglObjects,j,d)}else if(d instanceof THREE.Line){j=d.geometry;if(!j.__webglVertexBuffer)h=j,h.__webglVertexBuffer=f.createBuffer(),h.__webglColorBuffer=f.createBuffer(),h=j,k=h.vertices.length,h.__vertexArray=new Float32Array(k*3),h.__colorArray=new Float32Array(k*3),h.__webglLineCount=k,j.__dirtyVertices=!0,j.__dirtyColors=!0;na(e.__webglObjects,j,d)}else if(d instanceof THREE.ParticleSystem){j=d.geometry;
+if(!j.__webglVertexBuffer){h=j;h.__webglVertexBuffer=f.createBuffer();h.__webglColorBuffer=f.createBuffer();h=j;k=d;m=h.vertices.length;h.__vertexArray=new Float32Array(m*3);h.__colorArray=new Float32Array(m*3);h.__sortArray=[];h.__webglParticleCount=m;h.__materials=k.materials;C=n=p=void 0;p=0;for(n=k.materials.length;p<n;p++)if(C=k.materials[p],C.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in C.attributes){originalAttribute=C.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
 originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(m*size),attribute.buffer=f.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;h.__webglCustomAttributes[a]=attribute}}j.__dirtyVertices=
-!0;j.__dirtyColors=!0}oa(e.__webglObjects,j,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];d=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)ya(d.__webglObjects,e);else if(e instanceof
-THREE.Sprite){d=d.__webglSprites;j=void 0;for(j=d.length-1;j>=0;j--)d[j]==e&&d.splice(j,1)}else e instanceof THREE.MarchingCubes&&ya(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)if(h=b.__webglObjects[d].object,n=m=j=k=void 0,h instanceof THREE.Mesh){j=h.geometry;for(k in j.geometryGroups)if(m=j.geometryGroups[k],n=L(m),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||j.__dirtyTangents||
-n)if(n=m,p=f.DYNAMIC_DRAW,F=!j.dynamic,n.__inittedArrays){var I=C=w=void 0,A=void 0,M=I=void 0,H=void 0,Q=void 0,O=void 0,N=K=G=q=y=v=s=r=u=void 0,t=A=O=A=Q=H=void 0,o=void 0,z=o=t=H=void 0,R=void 0,V=z=o=t=I=I=M=O=A=z=o=t=R=z=o=t=R=z=o=t=void 0,ja=0,P=0,X=0,Z=0,W=0,S=0,Y=0,U=0,la=0,x=0,na=0,z=t=0,z=void 0,qa=n.__vertexArray,ma=n.__uvArray,pa=n.__uv2Array,$=n.__normalArray,aa=n.__tangentArray,ra=n.__colorArray,ca=n.__skinVertexAArray,da=n.__skinVertexBArray,ea=n.__skinIndexArray,fa=n.__skinWeightArray,
-sa=n.__morphTargetsArrays,ga=n.__webglCustomAttributes,o=void 0,ia=n.__faceArray,Ba=n.__lineArray,wa=n.__needsSmoothNormals,r=n.__vertexColorType,u=n.__uvType,s=n.__normalType,ta=h.geometry,va=ta.__dirtyVertices,za=ta.__dirtyElements,ua=ta.__dirtyUvs,Ca=ta.__dirtyNormals,Da=ta.__dirtyTangents,Ea=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Aa=ta.vertices,Ga=n.faces,Ka=ta.faces,Ia=ta.faceVertexUvs[0],La=ta.faceVertexUvs[1],Ma=ta.skinVerticesA,Na=ta.skinVerticesB,Oa=ta.skinIndices,Ja=ta.skinWeights,Ha=
-ta.morphTargets;if(ga)for(V in ga)ga[V].offset=0,ga[V].offsetSrc=0;w=0;for(C=Ga.length;w<C;w++)if(I=Ga[w],A=Ka[I],Ia&&(v=Ia[I]),La&&(y=La[I]),I=A.vertexNormals,M=A.normal,H=A.vertexColors,Q=A.color,O=A.vertexTangents,A instanceof THREE.Face3){if(va)q=Aa[A.a].position,G=Aa[A.b].position,K=Aa[A.c].position,qa[P]=q.x,qa[P+1]=q.y,qa[P+2]=q.z,qa[P+3]=G.x,qa[P+4]=G.y,qa[P+5]=G.z,qa[P+6]=K.x,qa[P+7]=K.y,qa[P+8]=K.z,P+=9;if(ga)for(V in ga)if(o=ga[V],o.__original.needsUpdate)t=o.offset,z=o.offsetSrc,o.size===
-1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[t]=o.value[A.a],o.array[t+1]=o.value[A.b],o.array[t+2]=o.value[A.c]):o.boundTo==="faces"?(z=o.value[z],o.array[t]=z,o.array[t+1]=z,o.array[t+2]=z,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[t]=o.value[z],o.array[t+1]=o.value[z+1],o.array[t+2]=o.value[z+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(q=o.value[A.a],G=o.value[A.b],K=o.value[A.c]):o.boundTo==="faces"?(K=G=q=z=o.value[z],o.offsetSrc++):o.boundTo===
-"faceVertices"&&(q=o.value[z],G=o.value[z+1],K=o.value[z+2],o.offsetSrc+=3),o.size===2?(o.array[t]=q.x,o.array[t+1]=q.y,o.array[t+2]=G.x,o.array[t+3]=G.y,o.array[t+4]=K.x,o.array[t+5]=K.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[t]=q.r,o.array[t+1]=q.g,o.array[t+2]=q.b,o.array[t+3]=G.r,o.array[t+4]=G.g,o.array[t+5]=G.b,o.array[t+6]=K.r,o.array[t+7]=K.g,o.array[t+8]=K.b):(o.array[t]=q.x,o.array[t+1]=q.y,o.array[t+2]=q.z,o.array[t+3]=G.x,o.array[t+4]=G.y,o.array[t+5]=G.z,o.array[t+6]=K.x,o.array[t+
-7]=K.y,o.array[t+8]=K.z),o.offset+=9):(o.array[t]=q.x,o.array[t+1]=q.y,o.array[t+2]=q.z,o.array[t+3]=q.w,o.array[t+4]=G.x,o.array[t+5]=G.y,o.array[t+6]=G.z,o.array[t+7]=G.w,o.array[t+8]=K.x,o.array[t+9]=K.y,o.array[t+10]=K.z,o.array[t+11]=K.w,o.offset+=12));if(Fa){t=0;for(o=Ha.length;t<o;t++)q=Ha[t].vertices[A.a].position,G=Ha[t].vertices[A.b].position,K=Ha[t].vertices[A.c].position,z=sa[t],z[na]=q.x,z[na+1]=q.y,z[na+2]=q.z,z[na+3]=G.x,z[na+4]=G.y,z[na+5]=G.z,z[na+6]=K.x,z[na+7]=K.y,z[na+8]=K.z;na+=
-9}if(Ja.length)t=Ja[A.a],o=Ja[A.b],z=Ja[A.c],fa[x]=t.x,fa[x+1]=t.y,fa[x+2]=t.z,fa[x+3]=t.w,fa[x+4]=o.x,fa[x+5]=o.y,fa[x+6]=o.z,fa[x+7]=o.w,fa[x+8]=z.x,fa[x+9]=z.y,fa[x+10]=z.z,fa[x+11]=z.w,t=Oa[A.a],o=Oa[A.b],z=Oa[A.c],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=o.x,ea[x+5]=o.y,ea[x+6]=o.z,ea[x+7]=o.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,t=Ma[A.a],o=Ma[A.b],z=Ma[A.c],ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=o.x,ca[x+5]=o.y,ca[x+6]=o.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=
-z.y,ca[x+10]=z.z,ca[x+11]=1,t=Na[A.a],o=Na[A.b],z=Na[A.c],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=1,da[x+4]=o.x,da[x+5]=o.y,da[x+6]=o.z,da[x+7]=1,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=1,x+=12;if(Ea&&r)H.length==3&&r==THREE.VertexColors?(A=H[0],t=H[1],o=H[2]):o=t=A=Q,ra[la]=A.r,ra[la+1]=A.g,ra[la+2]=A.b,ra[la+3]=t.r,ra[la+4]=t.g,ra[la+5]=t.b,ra[la+6]=o.r,ra[la+7]=o.g,ra[la+8]=o.b,la+=9;if(Da&&ta.hasTangents)H=O[0],Q=O[1],A=O[2],aa[Y]=H.x,aa[Y+1]=H.y,aa[Y+2]=H.z,aa[Y+3]=H.w,aa[Y+4]=Q.x,aa[Y+
-5]=Q.y,aa[Y+6]=Q.z,aa[Y+7]=Q.w,aa[Y+8]=A.x,aa[Y+9]=A.y,aa[Y+10]=A.z,aa[Y+11]=A.w,Y+=12;if(Ca&&s)if(I.length==3&&wa)for(O=0;O<3;O++)M=I[O],$[S]=M.x,$[S+1]=M.y,$[S+2]=M.z,S+=3;else for(O=0;O<3;O++)$[S]=M.x,$[S+1]=M.y,$[S+2]=M.z,S+=3;if(ua&&v!==void 0&&u)for(O=0;O<3;O++)I=v[O],ma[X]=I.u,ma[X+1]=I.v,X+=2;if(ua&&y!==void 0&&u)for(O=0;O<3;O++)I=y[O],pa[Z]=I.u,pa[Z+1]=I.v,Z+=2;za&&(ia[W]=ja,ia[W+1]=ja+1,ia[W+2]=ja+2,W+=3,Ba[U]=ja,Ba[U+1]=ja+1,Ba[U+2]=ja,Ba[U+3]=ja+2,Ba[U+4]=ja+1,Ba[U+5]=ja+2,U+=6,ja+=3)}else if(A instanceof
-THREE.Face4){if(va)q=Aa[A.a].position,G=Aa[A.b].position,K=Aa[A.c].position,N=Aa[A.d].position,qa[P]=q.x,qa[P+1]=q.y,qa[P+2]=q.z,qa[P+3]=G.x,qa[P+4]=G.y,qa[P+5]=G.z,qa[P+6]=K.x,qa[P+7]=K.y,qa[P+8]=K.z,qa[P+9]=N.x,qa[P+10]=N.y,qa[P+11]=N.z,P+=12;if(ga)for(V in ga)if(o=ga[V],o.__original.needsUpdate)t=o.offset,z=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[t]=o.value[A.a],o.array[t+1]=o.value[A.b],o.array[t+2]=o.value[A.c],o.array[t+3]=o.value[A.d]):o.boundTo==="faces"?
-(z=o.value[z],o.array[t]=z,o.array[t+1]=z,o.array[t+2]=z,o.array[t+3]=z,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[t]=o.value[z],o.array[t+1]=o.value[z+1],o.array[t+2]=o.value[z+2],o.array[t+3]=o.value[z+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(q=o.value[A.a],G=o.value[A.b],K=o.value[A.c],N=o.value[A.d]):o.boundTo==="faces"?(N=K=G=q=z=o.value[z],o.offsetSrc++):o.boundTo==="faceVertices"&&(q=o.value[z],G=o.value[z+1],K=o.value[z+2],N=o.value[z+3],o.offsetSrc+=
-4),o.size===2?(o.array[t]=q.x,o.array[t+1]=q.y,o.array[t+2]=G.x,o.array[t+3]=G.y,o.array[t+4]=K.x,o.array[t+5]=K.y,o.array[t+6]=N.x,o.array[t+7]=N.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[t]=q.r,o.array[t+1]=q.g,o.array[t+2]=q.b,o.array[t+3]=G.r,o.array[t+4]=G.g,o.array[t+5]=G.b,o.array[t+6]=K.r,o.array[t+7]=K.g,o.array[t+8]=K.b,o.array[t+9]=N.r,o.array[t+10]=N.g,o.array[t+11]=N.b):(o.array[t]=q.x,o.array[t+1]=q.y,o.array[t+2]=q.z,o.array[t+3]=G.x,o.array[t+4]=G.y,o.array[t+5]=G.z,o.array[t+
-6]=K.x,o.array[t+7]=K.y,o.array[t+8]=K.z,o.array[t+9]=N.x,o.array[t+10]=N.y,o.array[t+11]=N.z),o.offset+=12):(o.array[t]=q.x,o.array[t+1]=q.y,o.array[t+2]=q.z,o.array[t+3]=q.w,o.array[t+4]=G.x,o.array[t+5]=G.y,o.array[t+6]=G.z,o.array[t+7]=G.w,o.array[t+8]=K.x,o.array[t+9]=K.y,o.array[t+10]=K.z,o.array[t+11]=K.w,o.array[t+12]=N.x,o.array[t+13]=N.y,o.array[t+14]=N.z,o.array[t+15]=N.w,o.offset+=16));if(Fa){t=0;for(o=Ha.length;t<o;t++)q=Ha[t].vertices[A.a].position,G=Ha[t].vertices[A.b].position,K=Ha[t].vertices[A.c].position,
-N=Ha[t].vertices[A.d].position,z=sa[t],z[na]=q.x,z[na+1]=q.y,z[na+2]=q.z,z[na+3]=G.x,z[na+4]=G.y,z[na+5]=G.z,z[na+6]=K.x,z[na+7]=K.y,z[na+8]=K.z,z[na+9]=N.x,z[na+10]=N.y,z[na+11]=N.z;na+=12}if(Ja.length)t=Ja[A.a],o=Ja[A.b],z=Ja[A.c],R=Ja[A.d],fa[x]=t.x,fa[x+1]=t.y,fa[x+2]=t.z,fa[x+3]=t.w,fa[x+4]=o.x,fa[x+5]=o.y,fa[x+6]=o.z,fa[x+7]=o.w,fa[x+8]=z.x,fa[x+9]=z.y,fa[x+10]=z.z,fa[x+11]=z.w,fa[x+12]=R.x,fa[x+13]=R.y,fa[x+14]=R.z,fa[x+15]=R.w,t=Oa[A.a],o=Oa[A.b],z=Oa[A.c],R=Oa[A.d],ea[x]=t.x,ea[x+1]=t.y,
-ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=o.x,ea[x+5]=o.y,ea[x+6]=o.z,ea[x+7]=o.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,ea[x+12]=R.x,ea[x+13]=R.y,ea[x+14]=R.z,ea[x+15]=R.w,t=Ma[A.a],o=Ma[A.b],z=Ma[A.c],R=Ma[A.d],ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=o.x,ca[x+5]=o.y,ca[x+6]=o.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.z,ca[x+11]=1,ca[x+12]=R.x,ca[x+13]=R.y,ca[x+14]=R.z,ca[x+15]=1,t=Na[A.a],o=Na[A.b],z=Na[A.c],A=Na[A.d],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=1,da[x+4]=o.x,da[x+
-5]=o.y,da[x+6]=o.z,da[x+7]=1,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=1,da[x+12]=A.x,da[x+13]=A.y,da[x+14]=A.z,da[x+15]=1,x+=16;if(Ea&&r)H.length==4&&r==THREE.VertexColors?(A=H[0],t=H[1],o=H[2],H=H[3]):H=o=t=A=Q,ra[la]=A.r,ra[la+1]=A.g,ra[la+2]=A.b,ra[la+3]=t.r,ra[la+4]=t.g,ra[la+5]=t.b,ra[la+6]=o.r,ra[la+7]=o.g,ra[la+8]=o.b,ra[la+9]=H.r,ra[la+10]=H.g,ra[la+11]=H.b,la+=12;if(Da&&ta.hasTangents)H=O[0],Q=O[1],A=O[2],O=O[3],aa[Y]=H.x,aa[Y+1]=H.y,aa[Y+2]=H.z,aa[Y+3]=H.w,aa[Y+4]=Q.x,aa[Y+5]=Q.y,aa[Y+
-6]=Q.z,aa[Y+7]=Q.w,aa[Y+8]=A.x,aa[Y+9]=A.y,aa[Y+10]=A.z,aa[Y+11]=A.w,aa[Y+12]=O.x,aa[Y+13]=O.y,aa[Y+14]=O.z,aa[Y+15]=O.w,Y+=16;if(Ca&&s)if(I.length==4&&wa)for(O=0;O<4;O++)M=I[O],$[S]=M.x,$[S+1]=M.y,$[S+2]=M.z,S+=3;else for(O=0;O<4;O++)$[S]=M.x,$[S+1]=M.y,$[S+2]=M.z,S+=3;if(ua&&v!==void 0&&u)for(O=0;O<4;O++)I=v[O],ma[X]=I.u,ma[X+1]=I.v,X+=2;if(ua&&y!==void 0&&u)for(O=0;O<4;O++)I=y[O],pa[Z]=I.u,pa[Z+1]=I.v,Z+=2;za&&(ia[W]=ja,ia[W+1]=ja+1,ia[W+2]=ja+3,ia[W+3]=ja+1,ia[W+4]=ja+2,ia[W+5]=ja+3,W+=6,Ba[U]=
-ja,Ba[U+1]=ja+1,Ba[U+2]=ja,Ba[U+3]=ja+3,Ba[U+4]=ja+1,Ba[U+5]=ja+2,Ba[U+6]=ja+2,Ba[U+7]=ja+3,U+=8,ja+=4)}va&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,qa,p));if(ga)for(V in ga)o=ga[V],o.__original.needsUpdate&&(f.bindBuffer(f.ARRAY_BUFFER,o.buffer),f.bufferData(f.ARRAY_BUFFER,o.array,p));if(Fa){t=0;for(o=Ha.length;t<o;t++)f.bindBuffer(f.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[t]),f.bufferData(f.ARRAY_BUFFER,sa[t],p)}Ea&&la>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglColorBuffer),
-f.bufferData(f.ARRAY_BUFFER,ra,p));Ca&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,$,p));Da&&ta.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,aa,p));ua&&X>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,ma,p));ua&&Z>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,pa,p));za&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,
-ia,p),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,Ba,p));x>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,ca,p),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,da,p),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,ea,p),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,fa,p));F&&(delete n.__inittedArrays,
-delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;xa(m)}else if(h instanceof THREE.Ribbon){j=h.geometry;if(j.__dirtyVertices||
-j.__dirtyColors){h=j;k=f.DYNAMIC_DRAW;m=C=w=w=void 0;u=h.vertices;n=h.colors;r=u.length;p=n.length;s=h.__vertexArray;F=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<r;w++)C=u[w].position,m=w*3,s[m]=C.x,s[m+1]=C.y,s[m+2]=C.z;f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,s,k)}if(v){for(w=0;w<p;w++)color=n[w],m=w*3,F[m]=color.r,F[m+1]=color.g,F[m+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,F,k)}}j.__dirtyVertices=
-!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=f.DYNAMIC_DRAW;m=C=w=w=void 0;u=h.vertices;n=h.colors;r=u.length;p=n.length;s=h.__vertexArray;F=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<r;w++)C=u[w].position,m=w*3,s[m]=C.x,s[m+1]=C.y,s[m+2]=C.z;f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,s,k)}if(v){for(w=0;w<p;w++)color=n[w],m=w*3,F[m]=color.r,F[m+1]=color.g,F[m+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,
-h.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,F,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)j=h.geometry,n=L(j),(j.__dirtyVertices||j.__dirtyColors||h.sortParticles||n)&&c(j,f.DYNAMIC_DRAW,h),j.__dirtyVertices=!1,j.__dirtyColors=!1,xa(j)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW),b=="back"?f.cullFace(f.BACK):b=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK),f.enable(f.CULL_FACE)):f.disable(f.CULL_FACE)};
-this.supportsVertexTextures=function(){return Xa}};
+!0;j.__dirtyColors=!0}na(e.__webglObjects,j,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];d=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)xa(d.__webglObjects,e);else if(e instanceof
+THREE.Sprite){d=d.__webglSprites;j=void 0;for(j=d.length-1;j>=0;j--)d[j]==e&&d.splice(j,1)}else e instanceof THREE.MarchingCubes&&xa(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)if(h=b.__webglObjects[d].object,n=k=j=void 0,h instanceof THREE.Mesh){j=h.geometry;m=0;for(p=j.geometryGroupsList.length;m<p;m++)if(k=j.geometryGroupsList[m],n=K(k),j.__dirtyVertices||j.__dirtyMorphTargets||j.__dirtyElements||j.__dirtyUvs||j.__dirtyNormals||j.__dirtyColors||
+j.__dirtyTangents||n)if(n=k,C=f.DYNAMIC_DRAW,w=!j.dynamic,n.__inittedArrays){var E=u=B=void 0,A=void 0,L=E=void 0,I=void 0,Q=void 0,N=void 0,P=J=F=s=y=v=r=q=void 0,M=void 0,t=A=N=A=Q=I=void 0,o=void 0,z=o=t=I=void 0,R=void 0,U=z=o=t=E=E=L=N=A=z=o=t=R=z=o=t=R=z=o=t=void 0,ia=0,O=0,W=0,Y=0,V=0,S=0,X=0,T=0,ka=0,x=0,ma=0,z=t=0,z=void 0,pa=n.__vertexArray,la=n.__uvArray,oa=n.__uv2Array,Z=n.__normalArray,$=n.__tangentArray,qa=n.__colorArray,aa=n.__skinVertexAArray,ca=n.__skinVertexBArray,da=n.__skinIndexArray,
+ea=n.__skinWeightArray,ra=n.__morphTargetsArrays,fa=n.__webglCustomAttributes,o=void 0,ha=n.__faceArray,Aa=n.__lineArray,va=n.__needsSmoothNormals,r=n.__vertexColorType,q=n.__uvType,v=n.__normalType,sa=h.geometry,ua=sa.__dirtyVertices,ya=sa.__dirtyElements,ta=sa.__dirtyUvs,Ba=sa.__dirtyNormals,Ca=sa.__dirtyTangents,Da=sa.__dirtyColors,Ea=sa.__dirtyMorphTargets,za=sa.vertices,Ga=n.faces,Ka=sa.faces,Ia=sa.faceVertexUvs[0],La=sa.faceVertexUvs[1],Na=sa.skinVerticesA,Oa=sa.skinVerticesB,Pa=sa.skinIndices,
+Ja=sa.skinWeights,Ha=sa.morphTargets;if(fa)for(U in fa)fa[U].offset=0,fa[U].offsetSrc=0;B=0;for(u=Ga.length;B<u;B++)if(E=Ga[B],A=Ka[E],Ia&&(y=Ia[E]),La&&(s=La[E]),E=A.vertexNormals,L=A.normal,I=A.vertexColors,Q=A.color,N=A.vertexTangents,A instanceof THREE.Face3){if(ua)F=za[A.a].position,J=za[A.b].position,P=za[A.c].position,pa[O]=F.x,pa[O+1]=F.y,pa[O+2]=F.z,pa[O+3]=J.x,pa[O+4]=J.y,pa[O+5]=J.z,pa[O+6]=P.x,pa[O+7]=P.y,pa[O+8]=P.z,O+=9;if(fa)for(U in fa)if(o=fa[U],o.__original.needsUpdate)t=o.offset,
+z=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[t]=o.value[A.a],o.array[t+1]=o.value[A.b],o.array[t+2]=o.value[A.c]):o.boundTo==="faces"?(z=o.value[z],o.array[t]=z,o.array[t+1]=z,o.array[t+2]=z,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[t]=o.value[z],o.array[t+1]=o.value[z+1],o.array[t+2]=o.value[z+2],o.offsetSrc+=3),o.offset+=3):(o.boundTo===void 0||o.boundTo==="vertices"?(F=o.value[A.a],J=o.value[A.b],P=o.value[A.c]):o.boundTo==="faces"?(P=J=F=z=o.value[z],
+o.offsetSrc++):o.boundTo==="faceVertices"&&(F=o.value[z],J=o.value[z+1],P=o.value[z+2],o.offsetSrc+=3),o.size===2?(o.array[t]=F.x,o.array[t+1]=F.y,o.array[t+2]=J.x,o.array[t+3]=J.y,o.array[t+4]=P.x,o.array[t+5]=P.y,o.offset+=6):o.size===3?(o.type==="c"?(o.array[t]=F.r,o.array[t+1]=F.g,o.array[t+2]=F.b,o.array[t+3]=J.r,o.array[t+4]=J.g,o.array[t+5]=J.b,o.array[t+6]=P.r,o.array[t+7]=P.g,o.array[t+8]=P.b):(o.array[t]=F.x,o.array[t+1]=F.y,o.array[t+2]=F.z,o.array[t+3]=J.x,o.array[t+4]=J.y,o.array[t+5]=
+J.z,o.array[t+6]=P.x,o.array[t+7]=P.y,o.array[t+8]=P.z),o.offset+=9):(o.array[t]=F.x,o.array[t+1]=F.y,o.array[t+2]=F.z,o.array[t+3]=F.w,o.array[t+4]=J.x,o.array[t+5]=J.y,o.array[t+6]=J.z,o.array[t+7]=J.w,o.array[t+8]=P.x,o.array[t+9]=P.y,o.array[t+10]=P.z,o.array[t+11]=P.w,o.offset+=12));if(Ea){t=0;for(o=Ha.length;t<o;t++)F=Ha[t].vertices[A.a].position,J=Ha[t].vertices[A.b].position,P=Ha[t].vertices[A.c].position,z=ra[t],z[ma]=F.x,z[ma+1]=F.y,z[ma+2]=F.z,z[ma+3]=J.x,z[ma+4]=J.y,z[ma+5]=J.z,z[ma+6]=
+P.x,z[ma+7]=P.y,z[ma+8]=P.z;ma+=9}if(Ja.length)t=Ja[A.a],o=Ja[A.b],z=Ja[A.c],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=o.x,ea[x+5]=o.y,ea[x+6]=o.z,ea[x+7]=o.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,t=Pa[A.a],o=Pa[A.b],z=Pa[A.c],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=t.w,da[x+4]=o.x,da[x+5]=o.y,da[x+6]=o.z,da[x+7]=o.w,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=z.w,t=Na[A.a],o=Na[A.b],z=Na[A.c],aa[x]=t.x,aa[x+1]=t.y,aa[x+2]=t.z,aa[x+3]=1,aa[x+4]=o.x,aa[x+5]=o.y,aa[x+6]=
+o.z,aa[x+7]=1,aa[x+8]=z.x,aa[x+9]=z.y,aa[x+10]=z.z,aa[x+11]=1,t=Oa[A.a],o=Oa[A.b],z=Oa[A.c],ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=o.x,ca[x+5]=o.y,ca[x+6]=o.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.z,ca[x+11]=1,x+=12;if(Da&&r)I.length==3&&r==THREE.VertexColors?(A=I[0],t=I[1],o=I[2]):o=t=A=Q,qa[ka]=A.r,qa[ka+1]=A.g,qa[ka+2]=A.b,qa[ka+3]=t.r,qa[ka+4]=t.g,qa[ka+5]=t.b,qa[ka+6]=o.r,qa[ka+7]=o.g,qa[ka+8]=o.b,ka+=9;if(Ca&&sa.hasTangents)I=N[0],Q=N[1],A=N[2],$[X]=I.x,$[X+1]=I.y,$[X+2]=
+I.z,$[X+3]=I.w,$[X+4]=Q.x,$[X+5]=Q.y,$[X+6]=Q.z,$[X+7]=Q.w,$[X+8]=A.x,$[X+9]=A.y,$[X+10]=A.z,$[X+11]=A.w,X+=12;if(Ba&&v)if(E.length==3&&va)for(N=0;N<3;N++)L=E[N],Z[S]=L.x,Z[S+1]=L.y,Z[S+2]=L.z,S+=3;else for(N=0;N<3;N++)Z[S]=L.x,Z[S+1]=L.y,Z[S+2]=L.z,S+=3;if(ta&&y!==void 0&&q)for(N=0;N<3;N++)E=y[N],la[W]=E.u,la[W+1]=E.v,W+=2;if(ta&&s!==void 0&&q)for(N=0;N<3;N++)E=s[N],oa[Y]=E.u,oa[Y+1]=E.v,Y+=2;ya&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+2,V+=3,Aa[T]=ia,Aa[T+1]=ia+1,Aa[T+2]=ia,Aa[T+3]=ia+2,Aa[T+4]=ia+1,
+Aa[T+5]=ia+2,T+=6,ia+=3)}else if(A instanceof THREE.Face4){if(ua)F=za[A.a].position,J=za[A.b].position,P=za[A.c].position,M=za[A.d].position,pa[O]=F.x,pa[O+1]=F.y,pa[O+2]=F.z,pa[O+3]=J.x,pa[O+4]=J.y,pa[O+5]=J.z,pa[O+6]=P.x,pa[O+7]=P.y,pa[O+8]=P.z,pa[O+9]=M.x,pa[O+10]=M.y,pa[O+11]=M.z,O+=12;if(fa)for(U in fa)if(o=fa[U],o.__original.needsUpdate)t=o.offset,z=o.offsetSrc,o.size===1?(o.boundTo===void 0||o.boundTo==="vertices"?(o.array[t]=o.value[A.a],o.array[t+1]=o.value[A.b],o.array[t+2]=o.value[A.c],
+o.array[t+3]=o.value[A.d]):o.boundTo==="faces"?(z=o.value[z],o.array[t]=z,o.array[t+1]=z,o.array[t+2]=z,o.array[t+3]=z,o.offsetSrc++):o.boundTo==="faceVertices"&&(o.array[t]=o.value[z],o.array[t+1]=o.value[z+1],o.array[t+2]=o.value[z+2],o.array[t+3]=o.value[z+3],o.offsetSrc+=4),o.offset+=4):(o.boundTo===void 0||o.boundTo==="vertices"?(F=o.value[A.a],J=o.value[A.b],P=o.value[A.c],M=o.value[A.d]):o.boundTo==="faces"?(M=P=J=F=z=o.value[z],o.offsetSrc++):o.boundTo==="faceVertices"&&(F=o.value[z],J=o.value[z+
+1],P=o.value[z+2],M=o.value[z+3],o.offsetSrc+=4),o.size===2?(o.array[t]=F.x,o.array[t+1]=F.y,o.array[t+2]=J.x,o.array[t+3]=J.y,o.array[t+4]=P.x,o.array[t+5]=P.y,o.array[t+6]=M.x,o.array[t+7]=M.y,o.offset+=8):o.size===3?(o.type==="c"?(o.array[t]=F.r,o.array[t+1]=F.g,o.array[t+2]=F.b,o.array[t+3]=J.r,o.array[t+4]=J.g,o.array[t+5]=J.b,o.array[t+6]=P.r,o.array[t+7]=P.g,o.array[t+8]=P.b,o.array[t+9]=M.r,o.array[t+10]=M.g,o.array[t+11]=M.b):(o.array[t]=F.x,o.array[t+1]=F.y,o.array[t+2]=F.z,o.array[t+3]=
+J.x,o.array[t+4]=J.y,o.array[t+5]=J.z,o.array[t+6]=P.x,o.array[t+7]=P.y,o.array[t+8]=P.z,o.array[t+9]=M.x,o.array[t+10]=M.y,o.array[t+11]=M.z),o.offset+=12):(o.array[t]=F.x,o.array[t+1]=F.y,o.array[t+2]=F.z,o.array[t+3]=F.w,o.array[t+4]=J.x,o.array[t+5]=J.y,o.array[t+6]=J.z,o.array[t+7]=J.w,o.array[t+8]=P.x,o.array[t+9]=P.y,o.array[t+10]=P.z,o.array[t+11]=P.w,o.array[t+12]=M.x,o.array[t+13]=M.y,o.array[t+14]=M.z,o.array[t+15]=M.w,o.offset+=16));if(Ea){t=0;for(o=Ha.length;t<o;t++)F=Ha[t].vertices[A.a].position,
+J=Ha[t].vertices[A.b].position,P=Ha[t].vertices[A.c].position,M=Ha[t].vertices[A.d].position,z=ra[t],z[ma]=F.x,z[ma+1]=F.y,z[ma+2]=F.z,z[ma+3]=J.x,z[ma+4]=J.y,z[ma+5]=J.z,z[ma+6]=P.x,z[ma+7]=P.y,z[ma+8]=P.z,z[ma+9]=M.x,z[ma+10]=M.y,z[ma+11]=M.z;ma+=12}if(Ja.length)t=Ja[A.a],o=Ja[A.b],z=Ja[A.c],R=Ja[A.d],ea[x]=t.x,ea[x+1]=t.y,ea[x+2]=t.z,ea[x+3]=t.w,ea[x+4]=o.x,ea[x+5]=o.y,ea[x+6]=o.z,ea[x+7]=o.w,ea[x+8]=z.x,ea[x+9]=z.y,ea[x+10]=z.z,ea[x+11]=z.w,ea[x+12]=R.x,ea[x+13]=R.y,ea[x+14]=R.z,ea[x+15]=R.w,
+t=Pa[A.a],o=Pa[A.b],z=Pa[A.c],R=Pa[A.d],da[x]=t.x,da[x+1]=t.y,da[x+2]=t.z,da[x+3]=t.w,da[x+4]=o.x,da[x+5]=o.y,da[x+6]=o.z,da[x+7]=o.w,da[x+8]=z.x,da[x+9]=z.y,da[x+10]=z.z,da[x+11]=z.w,da[x+12]=R.x,da[x+13]=R.y,da[x+14]=R.z,da[x+15]=R.w,t=Na[A.a],o=Na[A.b],z=Na[A.c],R=Na[A.d],aa[x]=t.x,aa[x+1]=t.y,aa[x+2]=t.z,aa[x+3]=1,aa[x+4]=o.x,aa[x+5]=o.y,aa[x+6]=o.z,aa[x+7]=1,aa[x+8]=z.x,aa[x+9]=z.y,aa[x+10]=z.z,aa[x+11]=1,aa[x+12]=R.x,aa[x+13]=R.y,aa[x+14]=R.z,aa[x+15]=1,t=Oa[A.a],o=Oa[A.b],z=Oa[A.c],A=Oa[A.d],
+ca[x]=t.x,ca[x+1]=t.y,ca[x+2]=t.z,ca[x+3]=1,ca[x+4]=o.x,ca[x+5]=o.y,ca[x+6]=o.z,ca[x+7]=1,ca[x+8]=z.x,ca[x+9]=z.y,ca[x+10]=z.z,ca[x+11]=1,ca[x+12]=A.x,ca[x+13]=A.y,ca[x+14]=A.z,ca[x+15]=1,x+=16;if(Da&&r)I.length==4&&r==THREE.VertexColors?(A=I[0],t=I[1],o=I[2],I=I[3]):I=o=t=A=Q,qa[ka]=A.r,qa[ka+1]=A.g,qa[ka+2]=A.b,qa[ka+3]=t.r,qa[ka+4]=t.g,qa[ka+5]=t.b,qa[ka+6]=o.r,qa[ka+7]=o.g,qa[ka+8]=o.b,qa[ka+9]=I.r,qa[ka+10]=I.g,qa[ka+11]=I.b,ka+=12;if(Ca&&sa.hasTangents)I=N[0],Q=N[1],A=N[2],N=N[3],$[X]=I.x,$[X+
+1]=I.y,$[X+2]=I.z,$[X+3]=I.w,$[X+4]=Q.x,$[X+5]=Q.y,$[X+6]=Q.z,$[X+7]=Q.w,$[X+8]=A.x,$[X+9]=A.y,$[X+10]=A.z,$[X+11]=A.w,$[X+12]=N.x,$[X+13]=N.y,$[X+14]=N.z,$[X+15]=N.w,X+=16;if(Ba&&v)if(E.length==4&&va)for(N=0;N<4;N++)L=E[N],Z[S]=L.x,Z[S+1]=L.y,Z[S+2]=L.z,S+=3;else for(N=0;N<4;N++)Z[S]=L.x,Z[S+1]=L.y,Z[S+2]=L.z,S+=3;if(ta&&y!==void 0&&q)for(N=0;N<4;N++)E=y[N],la[W]=E.u,la[W+1]=E.v,W+=2;if(ta&&s!==void 0&&q)for(N=0;N<4;N++)E=s[N],oa[Y]=E.u,oa[Y+1]=E.v,Y+=2;ya&&(ha[V]=ia,ha[V+1]=ia+1,ha[V+2]=ia+3,ha[V+
+3]=ia+1,ha[V+4]=ia+2,ha[V+5]=ia+3,V+=6,Aa[T]=ia,Aa[T+1]=ia+1,Aa[T+2]=ia,Aa[T+3]=ia+3,Aa[T+4]=ia+1,Aa[T+5]=ia+2,Aa[T+6]=ia+2,Aa[T+7]=ia+3,T+=8,ia+=4)}ua&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,pa,C));if(fa)for(U in fa)o=fa[U],o.__original.needsUpdate&&(f.bindBuffer(f.ARRAY_BUFFER,o.buffer),f.bufferData(f.ARRAY_BUFFER,o.array,C));if(Ea){t=0;for(o=Ha.length;t<o;t++)f.bindBuffer(f.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[t]),f.bufferData(f.ARRAY_BUFFER,ra[t],
+C)}Da&&ka>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,qa,C));Ba&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,Z,C));Ca&&sa.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,$,C));ta&&W>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,la,C));ta&&Y>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,oa,C));ya&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,
+n.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ha,C),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,Aa,C));x>0&&(f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,aa,C),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ca,C),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,da,C),f.bindBuffer(f.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,
+ea,C));w&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}j.__dirtyVertices=!1;j.__dirtyMorphTargets=!1;j.__dirtyElements=!1;j.__dirtyUvs=!1;j.__dirtyNormals=!1;j.__dirtyTangents=!1;j.__dirtyColors=!1;wa(k)}else if(h instanceof THREE.Ribbon){j=
+h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=f.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;p=h.colors;q=u.length;n=p.length;r=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<q;w++)B=u[w].position,m=w*3,r[m]=B.x,r[m+1]=B.y,r[m+2]=B.z;f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,r,k)}if(v){for(w=0;w<n;w++)color=p[w],m=w*3,C[m]=color.r,C[m+1]=color.g,C[m+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,
+C,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.Line){j=h.geometry;if(j.__dirtyVertices||j.__dirtyColors){h=j;k=f.DYNAMIC_DRAW;m=B=w=w=void 0;u=h.vertices;p=h.colors;q=u.length;n=p.length;r=h.__vertexArray;C=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(w=0;w<q;w++)B=u[w].position,m=w*3,r[m]=B.x,r[m+1]=B.y,r[m+2]=B.z;f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,r,k)}if(v){for(w=0;w<n;w++)color=p[w],m=w*3,C[m]=color.r,C[m+1]=color.g,
+C[m+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,C,k)}}j.__dirtyVertices=!1;j.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)j=h.geometry,n=K(j),(j.__dirtyVertices||j.__dirtyColors||h.sortParticles||n)&&c(j,f.DYNAMIC_DRAW,h),j.__dirtyVertices=!1,j.__dirtyColors=!1,wa(j)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW),b=="back"?f.cullFace(f.BACK):b=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK),
+f.enable(f.CULL_FACE)):f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return Ya}};
 THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
 THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};
 THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};

+ 2 - 0
examples/webgl_geometry_text.html

@@ -45,6 +45,8 @@
 
 		<script type="text/javascript" src="js/postprocessing/EffectComposer.js"></script>
 		<script type="text/javascript" src="js/postprocessing/RenderPass.js"></script>
+		<script type="text/javascript" src="js/postprocessing/ShaderPass.js"></script>
+		<script type="text/javascript" src="js/postprocessing/MaskPass.js"></script>
 		<script type="text/javascript" src="js/postprocessing/BloomPass.js"></script>
 		<script type="text/javascript" src="js/postprocessing/FilmPass.js"></script>
 

+ 1 - 0
examples/webgl_materials_video.html

@@ -42,6 +42,7 @@
 
 		<script type="text/javascript" src="js/postprocessing/EffectComposer.js"></script>
 		<script type="text/javascript" src="js/postprocessing/RenderPass.js"></script>
+		<script type="text/javascript" src="js/postprocessing/MaskPass.js"></script>
 		<script type="text/javascript" src="js/postprocessing/BloomPass.js"></script>
 		<script type="text/javascript" src="js/postprocessing/ShaderPass.js"></script>
 

+ 14 - 7
src/renderers/WebGLRenderer.js

@@ -4207,7 +4207,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-
 		return false;
 
 	};
@@ -4246,9 +4245,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			// check all geometry groups
 
-			for ( g in geometry.geometryGroups ) {
+			for( var i = 0, il = geometry.geometryGroupsList.length; i < il; i ++ ) {
 
-				geometryGroup = geometry.geometryGroups[ g ];
+				geometryGroup = geometry.geometryGroupsList[ i ];
 
 				customAttributeDirty = areCustomAttributesDirty( geometryGroup );
 
@@ -4400,7 +4399,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			var hash_array = [];
 
-			for ( i = 0, l = material.length; i < l; i++ ) {
+			for ( i = 0, l = material.length; i < l; i ++ ) {
 
 				if ( material[ i ] == undefined ) {
 
@@ -4418,7 +4417,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		for ( f = 0, fl = geometry.faces.length; f < fl; f++ ) {
+		for ( f = 0, fl = geometry.faces.length; f < fl; f ++ ) {
 
 			face = geometry.faces[ f ];
 			materials = face.materials;
@@ -4459,6 +4458,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		geometry.geometryGroupsList = [];
+
+		for ( var g in geometry.geometryGroups ) {
+
+			geometry.geometryGroupsList.push( geometry.geometryGroups[ g ] );
+
+		}
+
 	};
 
 	function addBuffer( objlist, buffer, object ) {
@@ -5420,13 +5427,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 			material, meshMaterial,
 			materials = [];
 
-		for ( m = 0, ml = object.materials.length; m < ml; m++ ) {
+		for ( m = 0, ml = object.materials.length; m < ml; m ++ ) {
 
 			meshMaterial = object.materials[ m ];
 
 			if ( meshMaterial instanceof THREE.MeshFaceMaterial ) {
 
-				for ( i = 0, l = geometryGroup.materials.length; i < l; i++ ) {
+				for ( i = 0, l = geometryGroup.materials.length; i < l; i ++ ) {
 
 					material = geometryGroup.materials[ i ];